Skip to content

Implement kernel_points and inverse_image for elliptic curve hom #40251

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions src/sage/schemes/elliptic_curves/hom.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,29 @@
"""
raise NotImplementedError('children must implement')

def kernel_points(self):
"""
Return an iterator over the points in the kernel of this
elliptic-curve morphism.

TESTS::

sage: E.<P, Q> = EllipticCurve(GF(5^2), [1, 2, 3, 3, 1])
sage: f = E.isogeny([P*3, Q*3])
sage: set(f.kernel_points())
{(0 : 1 : 0), (4 : 4 : 1), (2*z2 + 4 : 4*z2 + 4 : 1), (3*z2 + 1 : z2 + 3 : 1)}

In the inseparable case::

sage: E = EllipticCurve(GF(23), [1,1])
sage: set(E.scalar_multiplication(23).kernel_points())
{(0 : 1 : 0)}
"""
E = self.domain()
yield E.zero()
for x in self.kernel_polynomial().roots(multiplicities=False):
yield from E.lift_x(x, all=True)

def dual(self):
r"""
Return the dual of this elliptic-curve morphism.
Expand Down Expand Up @@ -526,6 +549,34 @@
# returns the first component of rational_maps()
raise NotImplementedError('children must implement')

def inverse_image(self, Q, /):
"""
Return an arbitrary element ``P`` in the domain such that
``self(P) == Q``, or raise ``ValueError`` if no such
element exists.

EXAMPLES::

sage: E.<P, Q> = EllipticCurve(GF(5^2), [1, 2, 3, 3, 1])
sage: f = E.isogeny([P*3, Q*3])
sage: f(f.inverse_image(f(Q))) == f(Q)
True
sage: E.scalar_multiplication(-1).inverse_image(P) == -P
True
sage: f.inverse_image(f.codomain().0)
Traceback (most recent call last):
...
ValueError: ...
"""
if not self.base_ring().is_exact():
from warnings import warn
warn('computing inverse image over inexact base ring is not guaranteed to be correct')

Check warning on line 573 in src/sage/schemes/elliptic_curves/hom.py

View check run for this annotation

Codecov / codecov/patch

src/sage/schemes/elliptic_curves/hom.py#L572-L573

Added lines #L572 - L573 were not covered by tests
E = self.domain()
for P in E.lift_x((self.x_rational_map() - Q.x()).numerator().any_root(), all=True):
if self(P) == Q:
return P
raise NotImplementedError

Check warning on line 578 in src/sage/schemes/elliptic_curves/hom.py

View check run for this annotation

Codecov / codecov/patch

src/sage/schemes/elliptic_curves/hom.py#L578

Added line #L578 was not covered by tests

def scaling_factor(self):
r"""
Return the Weierstrass scaling factor associated to this
Expand Down
Loading