New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x in IntegralDomains() should refine category #15183
Comments
Branch: u/saraedum/ticket/15183 |
Dependencies: #14482 |
Author: Julian Rueth |
comment:5
Simon, I believe I mostly adapted your code from Fields. Do mind having a look at this? |
Branch pushed to git repo; I updated commit sha1. New commits:
|
Commit: |
Branch pushed to git repo; I updated commit sha1. This was a forced push. Recent commits:
|
comment:10
Sorry, I uploaded the wrong branch to this ticket. Should be fixed now. |
comment:11
The main problem for me is that it uses git, and as much as I know, the "master" branch in the trac-git version of Sage does not pass tests. Hence, I currently have no version of Sage which I could use to test your changes. And besides, my knowledge of git is too little to really understand what has changed and what happened in a dependency. In any case, are you really sure that But |
comment:12
Really, by the time you've established that |
comment:13
Replying to @simon-king-jena:
I see.
You could use
What does
I believe that's why the check |
comment:14
Replying to @nbruin:
Sure, in the case of Z/nZ this is true. However, I tried to implement this on the level of categories, and I don't think that |
comment:15
Replying to @saraedum:
No, it calls
Do you suggest to introduce a custom |
comment:16
Replying to @simon-king-jena:
Sorry, that's what I meant.
Yes. This is what my patch does. Here is the diff: changeset:2282a39 |
comment:17
Can you tell me why the patchbot only found errors in TWO files, namely
?? On my machine, I got many more errors. Or perhaps I am on the wrong branch. I currently have
where #15120 is supposed to fix some remaining tests. But I am not sure, perhaps one of the two branches above is not the sage-trac master. How can I find out whether my current branch pulls from github or from trac? |
comment:18
Replying to @simon-king-jena:
I'm not sure what the patchbot does. It might merge in a few changes for the doctests but I don't know.
|
comment:19
Replying to @saraedum:
Not really.
Neither trac nor github are mentioned...
Am I correct that this would pull into my "public/sage-git/master" branch, but would not affect the other branch called "master"? I am sure that one branch was obtained from github and the other from trac, and it is a shame that it can't clearly (at least to my understanding) tell which is which. |
comment:20
Replying to @simon-king-jena:
So,
This would pull into the current branch, the one with the asterisk in
It seems that they both came from trac. At least their latest version does. It does not really matter where they originally came from. |
comment:21
Replying to @saraedum:
So, to my surprise, there is no github in it. |
comment:23
Okay guys, it looks like Nicolas says that category containment should not refine the category, and on the other hand Fields already do it. What do you decide ? Nathann |
comment:24
Just in case... Nathann |
comment:25
Replying to @nathanncohen:
For good reason! Category refinement involves changing the class of an object after creation, and actually after usage! Python lets you do those things, but really it is a dangerous hack. We have seen cases in which the hash of a parent depends on the class of the parent. Hence, if a category refinement happens after (or while) using a parent P as key of a dictionary, it used to be possible that P was put in the wrong hash bucket of the dictionary. Fortunately, someone (I think it was Volker) added a security layer, so that now changing the class results in an error if it changes the hash. But apart from hash, one often sees the following in def __cmp__(self, other):
c = cmp(type(self),type(other))
if c:
return c
return cmp(<data for self>,<data for other>) Hence, if you add category refinement, comparison could break: Imagine you originally had Mathematically, a category refinement should be fine, and one may think that the category framework is designed to be stable against category refinement ("if you refine the category of P, then P may inherit different methods from the category framework than before, but these new methods will fit better."). However, some of these methods do caching. Hence, if P originally belongs to category C1 and it got some method One could argue that it is a bug if you do get a mess upon category refinement. But perhaps it is wise to not consciously ask for trouble...
Yes, I know, I have to take the full blame... But the situation was different than the situation here! When I introduced category refinement for fields, I was motivated by a concrete example that was important to a "powerful" Sage sub-community (you know, elliptic curves and so on): This example became way too slow after implementing the category framework for all rings. Reason: Initialisation of these rings took way too long, since for each ring it was needed to test whether the modulus is a prime number. Guided by this example (and a similar example for matrix spaces) I found that a "lazy" category initialisation can avoid certain severe regressions. However, here, things are different: As much as I understand, the suggestion is to let Put differently: I haven't seen any concrete "real world" example that shows that we need lazy category initialisation for (some) integral domains. Without such example, I'd say we should better not open Pandora's box again. |
comment:27
So, does this ticket still need review? Should it be closed as wontfix? |
comment:28
Simon made a good point. I did this for consistency with Fields. I see now that it is better not to introduce this change. |
Currently,
IntegerModRing
refines its category if asked for membership inFields()
:The same does not happen for
IntegralDomains()
:The changes on this ticket copy the logic from fields over to integral domains.
Depends on #14482
CC: @simon-king-jena @nthiery
Component: categories
Author: Julian Rueth
Branch/Commit: u/saraedum/ticket/15183 @
2282a39
Issue created by migration from https://trac.sagemath.org/ticket/15183
The text was updated successfully, but these errors were encountered: