Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
deprecate mutant isogeny methods
Browse files Browse the repository at this point in the history
  • Loading branch information
yyyyx4 committed Aug 17, 2021
1 parent 6e34c55 commit 3e10548
Showing 1 changed file with 53 additions and 17 deletions.
70 changes: 53 additions & 17 deletions src/sage/schemes/elliptic_curves/ell_curve_isogeny.py
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ class EllipticCurveIsogeny(EllipticCurveHom):
# Kernel Data
#

__kernel_list = None # list of elements in the kernel
__kernel_list = None # list of elements in the kernel; stored as a tuple for immutability

__kernel_polynomial_list = None # polynomial stored as a little endian list of coefficients

Expand Down Expand Up @@ -1015,7 +1015,7 @@ def __init__(self, E, kernel, codomain=None, degree=None, model=None, check=True
self.__setup_post_isomorphism(codomain, model)

if (pre_isom is not None):
self.set_pre_isomorphism(pre_isom)
self._set_pre_isomorphism(pre_isom)

if (post_isom is not None):
self.__set_post_isomorphism(old_codomain, post_isom) #(trac #7096)
Expand Down Expand Up @@ -1311,17 +1311,8 @@ def __neg__(self):
True
"""
# save off the kernel lists
kernel_list = self.__kernel_list
self.__kernel_list = None

output = copy(self)

# reset the kernel lists
output.__kernel_list = copy(kernel_list)
self.__kernel_list = kernel_list

output.switch_sign()
output._switch_sign()
return output

#
Expand Down Expand Up @@ -1874,7 +1865,7 @@ def all_multiples(itr, terminal):
for P in kernel_gens:
kernel_set += Set(flatten([all_multiples(P,Q)
for Q in kernel_set]))
self.__kernel_list = kernel_set.list()
self.__kernel_list = tuple(kernel_set)
self.__kernel_2tor = {}
self.__kernel_non2tor = {}
self.__degree = Integer(len(kernel_set))
Expand Down Expand Up @@ -2885,6 +2876,12 @@ def set_pre_isomorphism(self, preWI):
r"""
Modify this isogeny by precomposing with a Weierstrass isomorphism.
.. WARNING::
Isogenies will be immutable in a future release of Sage.
This method is deprecated in favor of using the ``*`` operator
to compose elliptic-curve morphisms.
EXAMPLES::
sage: E = EllipticCurve(GF(31), [1,1,0,1,-1])
Expand Down Expand Up @@ -2936,6 +2933,15 @@ def set_pre_isomorphism(self, preWI):
sage: phi(Epr((168,1188)))
(0 : 1 : 0)
"""
from sage.misc.superseded import deprecation
deprecation(32388, 'Elliptic-curve isogenies will be immutable in a future release of Sage.'
' Use phi*psi instead of phi.set_pre_isomorphism(psi) to obtain the composite isogeny.')
return self._set_pre_isomorphism(preWI)

def _set_pre_isomorphism(self, preWI):
"""
Implementation of :meth:`set_pre_isomorphism`.
"""
WIdom = preWI.domain()
WIcod = preWI.codomain()

Expand Down Expand Up @@ -2963,6 +2969,12 @@ def set_post_isomorphism(self, postWI):
r"""
Modify this isogeny by postcomposing with a Weierstrass isomorphism.
.. WARNING::
Isogenies will be immutable in a future release of Sage.
This method is deprecated in favor of using the ``*`` operator
to compose elliptic-curve morphisms.
EXAMPLES::
sage: E = EllipticCurve(j=GF(31)(0))
Expand Down Expand Up @@ -2997,6 +3009,15 @@ def set_post_isomorphism(self, postWI):
sage: phi
Isogeny of degree 4 from Elliptic Curve defined by y^2 = x^3 + x over Number Field in a with defining polynomial x^2 + 2 to Elliptic Curve defined by y^2 = x^3 + (-44)*x + 112 over Number Field in a with defining polynomial x^2 + 2
"""
from sage.misc.superseded import deprecation
deprecation(32388, 'Elliptic-curve isogenies will be immutable in a future release of Sage.'
' Use psi*phi instead of phi.set_post_isomorphism(psi) to obtain the composite isogeny.')
return self._set_post_isomorphism(postWI)

def _set_post_isomorphism(self, postWI):
"""
Implementation of :meth:`set_post_isomorphism`.
"""
WIdom = postWI.domain()
WIcod = postWI.codomain()
Expand Down Expand Up @@ -3085,6 +3106,12 @@ def switch_sign(self):
r"""
Compose this isogeny with `[-1]` (negation).
.. WARNING::
Isogenies will be immutable in a future version of Sage.
This method is deprecated in favor of using the unary ``-``
operator to negate elliptic-curve morphisms.
EXAMPLES::
sage: E = EllipticCurve(GF(23), [0,0,0,1,0])
Expand Down Expand Up @@ -3134,7 +3161,16 @@ def switch_sign(self):
((x^2 + (-a)*x - 2)/(x + (-a)), (-x^2*y + (2*a)*x*y - y)/(x^2 + (-2*a)*x - 1))
"""
self.set_post_isomorphism(WeierstrassIsomorphism(self.__E2, (-1,0,-self.__E2.a1(),-self.__E2.a3())))
from sage.misc.superseded import deprecation
deprecation(32388, 'Elliptic-curve isogenies will be immutable in a future release of Sage.'
' Use -phi instead of phi.switch_sign() to obtain the negated isogeny.')
self._switch_sign()

def _switch_sign(self):
"""
Implementation of :meth:`switch_sign`.
"""
self._set_post_isomorphism(WeierstrassIsomorphism(self.__E2, (-1,0,-self.__E2.a1(),-self.__E2.a3())))

def is_normalized(self, via_formal=True, check_by_pullback=True):
r"""
Expand Down Expand Up @@ -3428,8 +3464,8 @@ def dual(self):

phi_hat = EllipticCurveIsogeny(E1, None, E2, d)

phi_hat.set_pre_isomorphism(pre_isom)
phi_hat.set_post_isomorphism(post_isom)
phi_hat._set_pre_isomorphism(pre_isom)
phi_hat._set_post_isomorphism(post_isom)
phi_hat.__perform_inheritance_housekeeping()

assert phi_hat.codomain() == self.domain()
Expand All @@ -3454,7 +3490,7 @@ def dual(self):
aut = [a for a in auts if a.u == sc]
if len(aut) != 1:
raise ValueError("There is a bug in dual().")
phi_hat.set_post_isomorphism(aut[0])
phi_hat._set_post_isomorphism(aut[0])

self.__dual = phi_hat

Expand Down

0 comments on commit 3e10548

Please sign in to comment.