Skip to content

Commit 8861ca1

Browse files
committed
suggested details and TestSuite
1 parent dd30f47 commit 8861ca1

File tree

1 file changed

+6
-22
lines changed

1 file changed

+6
-22
lines changed

src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
from sage.schemes.elliptic_curves.ell_generic import is_EllipticCurve
7878
from sage.schemes.hyperelliptic_curves.constructor import HyperellipticCurve
7979
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
8181
from sage.structure.parent import Parent
8282
from sage.structure.richcmp import richcmp
8383
from sage.structure.unique_representation import UniqueRepresentation
@@ -114,6 +114,7 @@ def __init__(self, parent, p0, p1, p2, check=True):
114114
115115
sage: B.<t> = PolynomialRing(Integers(125))
116116
sage: R = monsky_washnitzer.SpecialCubicQuotientRing(t^3 - t + B(1/4))
117+
sage: TestSuite(R).run()
117118
sage: p = R.create_element(t, t^2 - 2, 3)
118119
sage: -p
119120
(124*T) + (124*T^2 + 2)*x + (122)*x^2
@@ -396,7 +397,7 @@ def _mul_(self, other):
396397
check=False)
397398

398399

399-
class SpecialCubicQuotientRing(Parent):
400+
class SpecialCubicQuotientRing(UniqueRepresentation, Parent):
400401
r"""
401402
Specialised class for representing the quotient ring
402403
`R[x,T]/(T - x^3 - ax - b)`, where `R` is an
@@ -428,6 +429,7 @@ class SpecialCubicQuotientRing(Parent):
428429
sage: R
429430
SpecialCubicQuotientRing over Ring of integers modulo 125
430431
with polynomial T = x^3 + 124*x + 94
432+
sage: TestSuite(R).run()
431433
432434
Get generators::
433435
@@ -522,13 +524,6 @@ def __init__(self, Q, laurent_series=False):
522524
raise ArithmeticError("2 and 3 must be invertible in the "
523525
"coefficient ring (=%s) of Q" % base_ring)
524526

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:
532527
self._a = Q[1]
533528
self._b = Q[0]
534529
if laurent_series:
@@ -547,7 +542,7 @@ def __init__(self, Q, laurent_series=False):
547542
m = matrix(QQ, [[1, -12, 2], [-3, 30, -3], [2, -12, 1]]) / 6
548543
self._speedup_matrix = m.change_ring(base_ring).list()
549544

550-
def _repr_(self):
545+
def _repr_(self) -> str:
551546
"""
552547
String representation.
553548
@@ -2391,18 +2386,10 @@ def __init__(self, Q, R=None, invert_y=True):
23912386
23922387
sage: HQR is SpecialHyperellipticQuotientRing(E)
23932388
True
2394-
23952389
"""
23962390
if R is None:
23972391
R = Q.base_ring()
23982392

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-
24062393
x = PolynomialRing(R, 'xx').gen()
24072394
if is_EllipticCurve(Q):
24082395
E = Q
@@ -2439,9 +2426,6 @@ def __init__(self, Q, R=None, invert_y=True):
24392426
self._series_ring_y = self._series_ring.gen(0)
24402427
self._series_ring_0 = self._series_ring.zero()
24412428

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.
24452429
Parent.__init__(self, base=R, category=Algebras(R).Commutative())
24462430

24472431
self._poly_ring = PolynomialRing(self._series_ring, 'x')
@@ -2456,7 +2440,7 @@ def __init__(self, Q, R=None, invert_y=True):
24562440
self._monomial_diffs = {}
24572441
self._monomial_diff_coeffs = {}
24582442

2459-
def _repr_(self):
2443+
def _repr_(self) -> str:
24602444
r"""
24612445
String representation.
24622446

0 commit comments

Comments
 (0)