77
77
from sage .schemes .elliptic_curves .ell_generic import is_EllipticCurve
78
78
from sage .schemes .hyperelliptic_curves .constructor import HyperellipticCurve
79
79
from sage .schemes .hyperelliptic_curves .hyperelliptic_generic import is_HyperellipticCurve
80
- from sage .structure .element import Element , ModuleElement
80
+ from sage .structure .element import ModuleElement
81
81
from sage .structure .parent import Parent
82
82
from sage .structure .richcmp import richcmp
83
83
from sage .structure .unique_representation import UniqueRepresentation
@@ -114,6 +114,7 @@ def __init__(self, parent, p0, p1, p2, check=True):
114
114
115
115
sage: B.<t> = PolynomialRing(Integers(125))
116
116
sage: R = monsky_washnitzer.SpecialCubicQuotientRing(t^3 - t + B(1/4))
117
+ sage: TestSuite(R).run()
117
118
sage: p = R.create_element(t, t^2 - 2, 3)
118
119
sage: -p
119
120
(124*T) + (124*T^2 + 2)*x + (122)*x^2
@@ -396,7 +397,7 @@ def _mul_(self, other):
396
397
check = False )
397
398
398
399
399
- class SpecialCubicQuotientRing (Parent ):
400
+ class SpecialCubicQuotientRing (UniqueRepresentation , Parent ):
400
401
r"""
401
402
Specialised class for representing the quotient ring
402
403
`R[x,T]/(T - x^3 - ax - b)`, where `R` is an
@@ -428,6 +429,7 @@ class SpecialCubicQuotientRing(Parent):
428
429
sage: R
429
430
SpecialCubicQuotientRing over Ring of integers modulo 125
430
431
with polynomial T = x^3 + 124*x + 94
432
+ sage: TestSuite(R).run()
431
433
432
434
Get generators::
433
435
@@ -522,13 +524,6 @@ def __init__(self, Q, laurent_series=False):
522
524
raise ArithmeticError ("2 and 3 must be invertible in the "
523
525
"coefficient ring (=%s) of Q" % base_ring )
524
526
525
- # .__init__ tries to establish a coercion
526
- # from the base ring, by github issue #9138. The corresponding
527
- # hom set is cached. In order to use self as cache key, its
528
- # string representation is used. In otder to get the string
529
- # representation, we need to know the attributes _a and
530
- # _b. Hence, in #9138, we have to move .__init__
531
- # further down:
532
527
self ._a = Q [1 ]
533
528
self ._b = Q [0 ]
534
529
if laurent_series :
@@ -547,7 +542,7 @@ def __init__(self, Q, laurent_series=False):
547
542
m = matrix (QQ , [[1 , - 12 , 2 ], [- 3 , 30 , - 3 ], [2 , - 12 , 1 ]]) / 6
548
543
self ._speedup_matrix = m .change_ring (base_ring ).list ()
549
544
550
- def _repr_ (self ):
545
+ def _repr_ (self ) -> str :
551
546
"""
552
547
String representation.
553
548
@@ -2391,18 +2386,10 @@ def __init__(self, Q, R=None, invert_y=True):
2391
2386
2392
2387
sage: HQR is SpecialHyperellipticQuotientRing(E)
2393
2388
True
2394
-
2395
2389
"""
2396
2390
if R is None :
2397
2391
R = Q .base_ring ()
2398
2392
2399
- # Github issue #9138: .__init__ must not be
2400
- # done so early. It tries to register a coercion, but that
2401
- # requires the hash being available. But the hash, in its
2402
- # default implementation, relies on the string representation,
2403
- # which is not available at this point.
2404
- # .__init__(self, R) # moved to below.
2405
-
2406
2393
x = PolynomialRing (R , 'xx' ).gen ()
2407
2394
if is_EllipticCurve (Q ):
2408
2395
E = Q
@@ -2439,9 +2426,6 @@ def __init__(self, Q, R=None, invert_y=True):
2439
2426
self ._series_ring_y = self ._series_ring .gen (0 )
2440
2427
self ._series_ring_0 = self ._series_ring .zero ()
2441
2428
2442
- # Github issue #9138: Initialise the parent here!
2443
- # Below, we do self(self._poly_ring.gen(0)), which requires
2444
- # the initialisation being finished.
2445
2429
Parent .__init__ (self , base = R , category = Algebras (R ).Commutative ())
2446
2430
2447
2431
self ._poly_ring = PolynomialRing (self ._series_ring , 'x' )
@@ -2456,7 +2440,7 @@ def __init__(self, Q, R=None, invert_y=True):
2456
2440
self ._monomial_diffs = {}
2457
2441
self ._monomial_diff_coeffs = {}
2458
2442
2459
- def _repr_ (self ):
2443
+ def _repr_ (self ) -> str :
2460
2444
r"""
2461
2445
String representation.
2462
2446
0 commit comments