Skip to content
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

multiplication_by_m_isogeny is only correct up to automorphism #32490

Closed
yyyyx4 opened this issue Sep 8, 2021 · 20 comments
Closed

multiplication_by_m_isogeny is only correct up to automorphism #32490

yyyyx4 opened this issue Sep 8, 2021 · 20 comments

Comments

@yyyyx4
Copy link
Member

yyyyx4 commented Sep 8, 2021

This is wrong:

sage: E = EllipticCurve(QQbar, [1,0])
sage: E.multiplication_by_m_isogeny(1).rational_maps()
(x, -y)
sage: E = EllipticCurve(GF(127), [1,0])
sage: P = E.random_point()
sage: E.multiplication_by_m_isogeny(5)(P)
(15 : 56 : 1)
sage: 5*P
(15 : 71 : 1)
sage: -5*P
(15 : 56 : 1)
sage: E.multiplication_by_m(5) == (-E.multiplication_by_m_isogeny(5)).rational_maps()
True

It isn't consistently wrong:

sage: E = EllipticCurve(QQ, [1,0])
sage: E.multiplication_by_m_isogeny(1).rational_maps()
(x, y)

The trouble is that the method first constructs an isogeny with the correct kernel and codomain, then sets the precomputed rational maps. However, the isomorphism to the prescribed codomain is not unique, and picking the wrong one means the resulting isogeny is off by an automorphism — most commonly [-1].

The patch is not pretty, but it seems to fix the issue for now and shouldn't cause any significant slowdowns.
Once (if) #32388 gets in, we should probably instead use an EllipticCurveHom subclass specifically for scalar multiplications that imitates a normal isogeny but with different internals. I do have a draft of this ready and it's not only much cleaner, but also resolves part of #8014.

Depends on #32388

CC: @JohnCremona @defeo

Component: elliptic curves

Author: Lorenz Panny

Branch/Commit: ead071d

Reviewer: Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/32490

@yyyyx4 yyyyx4 added this to the sage-9.5 milestone Sep 8, 2021
@yyyyx4

This comment has been minimized.

@yyyyx4
Copy link
Member Author

yyyyx4 commented Sep 8, 2021

New commits:

2d1c955make sure multiplication_by_m_isogeny picks the correct isomorphism

@yyyyx4
Copy link
Member Author

yyyyx4 commented Sep 8, 2021

@yyyyx4
Copy link
Member Author

yyyyx4 commented Sep 8, 2021

Commit: 2d1c955

@yyyyx4
Copy link
Member Author

yyyyx4 commented Sep 8, 2021

Stopgaps: mathematically_wrong

@yyyyx4
Copy link
Member Author

yyyyx4 commented Sep 8, 2021

Author: Lorenz Panny

@yyyyx4 yyyyx4 changed the title sign errors in multiplication_by_m_isogeny multiplication_by_m_isogeny is only correct up to automorphism Sep 8, 2021
@tscrim
Copy link
Collaborator

tscrim commented Sep 13, 2021

comment:3

Based on your description, it seems like the thing to do would be to make #32388 a dependency since it generally seems to be better. You can then use this ticket as motivation for #32388 if that is necessary.

@yyyyx4
Copy link
Member Author

yyyyx4 commented Sep 13, 2021

comment:4

Replying to @tscrim:

Based on your description, it seems like the thing to do would be to make #32388 a dependency since it generally seems to be better.

I was worried that #32388 might take a while to get in, which could cause this (in principle, totally unrelated) bug to remain unfixed for no good reason if there was a dependency. Hence why I figured the best way to proceed would be to first apply this minimal bugfix and pursue the longer-term solution based on EllipticCurveHom later.

@tscrim
Copy link
Collaborator

tscrim commented Sep 13, 2021

Changed stopgaps from mathematically_wrong to none

@tscrim
Copy link
Collaborator

tscrim commented Sep 13, 2021

Reviewer: Travis Scrimshaw

@tscrim
Copy link
Collaborator

tscrim commented Sep 13, 2021

comment:5

Then let's get the bug-fix in.

@yyyyx4
Copy link
Member Author

yyyyx4 commented Sep 17, 2021

comment:6

Now that #32388 is also green, this will almost certainly cause test failures when both are merged (since this currently uses a method deprecated in #32388). What's the recommended way of dealing with this? Should I rebase this onto #32388 using the new syntax and add a dependency after all?

@tscrim
Copy link
Collaborator

tscrim commented Sep 17, 2021

comment:7

Sounds like you should make this depend on #32388.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 17, 2021

Branch pushed to git repo; I updated commit sha1 and set ticket back to needs_review. This was a forced push. Last 10 new commits:

69a15a2reflect deprecation of mutable isogenies in doctests
c24d57fRevert "hack to make * compose isogenies and isomorphisms correctly"
5714eaamake * compose isogenies and isomorphisms correctly
b2d61b8make patchbot plugins happier
bb8c235return NotImplemented instead of raising NotImplementedError
207d534add EllipticCurveHom to documentation
c6b8f66feedback from #32388: inline _switch_sign()
fdc6117#32388: more doctests
40081c7not necessary
ead071dmake sure multiplication_by_m_isogeny picks the correct isomorphism

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 17, 2021

Changed commit from 2d1c955 to ead071d

@yyyyx4
Copy link
Member Author

yyyyx4 commented Sep 17, 2021

comment:9

Rebased and adapted to the new syntax. (Only the last commit is relevant here; the rest are from #32388.)

@yyyyx4
Copy link
Member Author

yyyyx4 commented Sep 17, 2021

Dependencies: #32388

@tscrim
Copy link
Collaborator

tscrim commented Sep 21, 2021

comment:10

LGTM. Thanks.

@yyyyx4
Copy link
Member Author

yyyyx4 commented Oct 23, 2021

comment:11

Bumping priority since this bug can lead to mathematical errors.

@vbraun
Copy link
Member

vbraun commented Oct 23, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants