Skip to content

Commit d409888

Browse files
committed
search for a pair of pre- and post-isomorphism instead of just a post-isomorphism when computing dual isogeny
1 parent 3dd953c commit d409888

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

src/sage/schemes/elliptic_curves/ell_curve_isogeny.py

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3197,6 +3197,18 @@ def dual(self):
31973197
sage: phi._EllipticCurveIsogeny__clear_cached_values() # forget the dual
31983198
sage: -phi.dual() == (-phi).dual()
31993199
True
3200+
3201+
Check that :trac:`37168` is fixed::
3202+
3203+
sage: R.<x> = GF(23)[]
3204+
sage: F.<a> = FiniteField(23^2, modulus=x^2-x+1)
3205+
sage: E0 = EllipticCurve(F, (0, 1))
3206+
sage: E1 = EllipticCurve(F, (8, 1))
3207+
sage: phi = E0.isogeny(kernel=E0((a, 0)), codomain=E1)
3208+
sage: phi.dual()
3209+
Isogeny of degree 2
3210+
from Elliptic Curve defined by y^2 = x^3 + 8*x + 1 over Finite Field in a of size 23^2
3211+
to Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field in a of size 23^2
32003212
"""
32013213
if self.__base_field.characteristic() in (2, 3):
32023214
raise NotImplementedError("computation of dual isogenies not yet implemented in characteristics 2 and 3")
@@ -3260,17 +3272,18 @@ def dual(self):
32603272
E2 = E2pr.change_weierstrass_model(u/F(d), 0, 0, 0)
32613273

32623274
phi_hat = EllipticCurveIsogeny(E1, None, E2, d)
3263-
3264-
pre_iso = self._codomain.isomorphism_to(E1)
3265-
post_iso = E2.isomorphism_to(self._domain)
3266-
32673275
# assert phi_hat.scaling_factor() == 1
3268-
sc = u * pre_iso.scaling_factor() * post_iso.scaling_factor() / F(d)
3269-
if not sc.is_one():
3270-
auts = self._codomain.automorphisms()
3271-
aut = [a for a in auts if a.u == sc]
3272-
assert len(aut) == 1, "bug in dual()"
3273-
pre_iso *= aut[0]
3276+
3277+
for pre_iso in self._codomain.isomorphisms(E1):
3278+
for post_iso in E2.isomorphisms(self._domain):
3279+
sc = u * pre_iso.scaling_factor() * post_iso.scaling_factor()
3280+
if sc == d:
3281+
break
3282+
else:
3283+
continue
3284+
break
3285+
else:
3286+
assert "bug in dual()"
32743287

32753288
phi_hat._set_pre_isomorphism(pre_iso)
32763289
phi_hat._set_post_isomorphism(post_iso)

0 commit comments

Comments
 (0)