Opened 14 months ago
Last modified 2 weeks ago
#31603 new defect
is_unit() gives incorrect result for quotient of number ring
Reported by: | gh-mathehertogh | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | sage-9.7 |
Component: | number fields | Keywords: | |
Cc: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
Consider the following example:
sage: version() 'SageMath version 9.3.beta6, Release Date: 2021-01-17' sage: K.<a> = NumberField(x^3-2) sage: O = K.maximal_order() sage: I = O.ideal(4) sage: Omod4 = O.quotient(I, 'b') sage: a + I == 1 # Are a and 4 coprime? (no) False sage: a_bar = Omod4(a) sage: a_bar.is_unit() # So this should return False... True sage: a_bar.parent() Quotient of Maximal Order in Number Field in a with defining polynomial x^3 - 2 by the ideal (4)
Clearly the method is_unit()
gives the wrong answer in this example.
I checked the implementation:
sage: a_bar.is_unit?? ... def is_unit(self): """ Return True if self is a unit in the quotient ring. ... """ if self.__rep.is_unit(): return True from sage.categories.fields import Fields if self.parent() in Fields: return not self.is_zero() try: self.__invert__() return True except ArithmeticError: return False raise NotImplementedError
When I trace through this, I do not understand what happens.
On the first line self.__rep.is_unit()
returns True
, while my debugger says self
has no attribute __rep
.
When I step into this call, I end up in K.is_field()
, which returns True
.
I tried checking if for some reason we where executing the line if self.parent() in Fields
, but this does not seem to be the case: self.parent()
gives
Quotient of Maximal Order in Number Field in a with defining polynomial x^3 - 2 by the ideal (4)
Change History (5)
comment:1 Changed 14 months ago by
comment:2 Changed 12 months ago by
- Milestone changed from sage-9.3 to sage-9.4
Moving to 9.4, as 9.3 has been released.
comment:3 Changed 9 months ago by
- Milestone changed from sage-9.4 to sage-9.5
comment:4 Changed 5 months ago by
- Milestone changed from sage-9.5 to sage-9.6
comment:5 Changed 2 weeks ago by
- Milestone changed from sage-9.6 to sage-9.7
self.__rep
is another name forself.lift()
, which is equal toa
.The lift is erroneously being considered as an element of the field
K
, instead of as an element of the orderO
.Possibly related tickets: #12242 and #28552.