-
-
Notifications
You must be signed in to change notification settings - Fork 554
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
fix number fields being unique parents -- this got broken over the years #11670
Comments
This comment has been minimized.
This comment has been minimized.
comment:1
When working on this ticket, I also found a potentially serious bug, which is that the parameters
Attached patch fixes that. |
Attachment: trac_11670.patch.gz |
This comment has been minimized.
This comment has been minimized.
comment:4
I should comment on UniqueFactory and UniqueRepresentation (from sage.structure.unique*). I made some attempt to use it, but decided against it for this patch. The main reason is that I want to fully maintain backward compatibility with old pickled objects, since there are a lot of pickled number field elements in the wild, and that is really opaque using UniqueRepresentation. (Also, I am concerned using UniqueRepresentation has some efficiency issues in terms of size and later changing how pickling works, since every time you pickle an object it wraps it in its own wrapper around other stuff, leading to another level of abstraction.) I don't claim that the current approach is the easiest to maintain in the long run -- in fact, it got broke before by bad patches. But in this new patch, I've added a ton of comments and a big warning to help prevent this in the future. |
comment:5
I also applied the patch to sage-4.7.2.alpha1 and ran "make ptestlong" with complete success. |
comment:6
Does that fix the issues discussed on #10448 as well? There, I tried to fix the missing uniqueness of maximal orders in number fields using cached_method decorators. However, the most recent post on #10448 (five months ago) also mentions the problem that number fields aren't unique, and thus the maximal orders can only be as unique as the umber fields they are contained in. |
comment:8
Some brief remarks:
not
|
comment:9
One problem bugging me at #10667 remains: If one calls the method If I can fix it then I'll post a patch here, not at #10667. |
comment:10
Yep. Here is an explicit example exposing the missing uniqueness:
I guess it can be fixed in the |
comment:11
Aha, it boils down to one line in try:
return self.__absolute_field[names]
except KeyError:
pass
except AttributeError:
self.__absolute_field = {}
K = NumberField(self.defining_polynomial(), names, cache=False)
K._set_structure(maps.NameChangeMap(K, self), maps.NameChangeMap(self, K))
self.__absolute_field[names] = K
return K Why is the option |
comment:12
I read the comment
in |
comment:13
I see a potential work-around. In my example, we have
Would it make sense to declare two number fields different if they have different |
Author: William Stein |
Reviewer: Simon King |
comment:33
With your changes, Sage doesn't complain anymore if the user does not specify the name of the generator, but silently names it "a":
I don't like this; since the name is part of the defining data, I think we should insist on the user specifying the name. If you think this should be changed, I think it is better to create a new ticket so this interface issue can be discussed separately from the technical changes made in this ticket. |
comment:35
Replying to @pjbruin:
You are right. I just implemented what the docstring used to say. I fixed the implementation and the docstring. |
Changed branch from u/saraedum/ticket/11670 to u/pbruin/11670-NumberField_unique |
Changed reviewer from Simon King to Simon King, Peter Bruin |
comment:36
Thanks. I made a reviewer patch to fix some typos, formatting and Python 3 compatibility things; I changed the error message for I would be happy give this a positive review, but I think it is better if Simon or someone else with expertise in this area takes a quick look at it as well. |
Work Issues: merge conflicts with 6.2β8 |
Branch pushed to git repo; I updated commit sha1. New commits:
|
New commits:
|
Changed work issues from merge conflicts with 6.2β8 to none |
comment:40
OK, let's not leave this to bitrot. As an additional test, I checked that #11669 (which depends on this ticket) still works correctly, and it does. |
Changed branch from u/pbruin/11670-NumberField_unique to |
For example, these are all wrong:
NOTE: To keep this project manageable for now, this ticket does not address similar issues for relative number fields, if there are any.
This is related to #10448.
Component: number fields
Author: Julian Rueth
Branch/Commit:
8b06ff7
Reviewer: Simon King, Peter Bruin
Issue created by migration from https://trac.sagemath.org/ticket/11670
The text was updated successfully, but these errors were encountered: