-
-
Notifications
You must be signed in to change notification settings - Fork 482
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
test whether point is actually on the curve when evaluating elliptic-curve isomorphism #35799
test whether point is actually on the curve when evaluating elliptic-curve isomorphism #35799
Conversation
How about the case that Currently it does sage: E.ambient_space()
Projective Space of dimension 2 over Finite Field of size 101
sage: E.random_point()
(93 : 84 : 1)
sage: P = E.ambient_space()
sage: P(93,84,1)
(93 : 84 : 1)
sage: p = P(93,84,1)
sage: p
(93 : 84 : 1)
sage: f(p)
(93 : 84 : 1) |
The patch should add a doctest to illustrate the error now raised. @kwankyu I'm not sure about that. If the argument P supplied was not an elliptic curve point but only a point in P2, would you raise an error if P is not on a curve? Would you regard the Weierstrass map as a map from P2 to itself and return another point in P2 (whether or not P or f(P) are on the curve)? Or if you did test whether P is on the curve would the returned pint be a point on the curve even though P was not? This looks like a can of worms to me, and checking that P is in the actual domain in the strong sense, as in this patch, seems the simplest way. Let's merge this (once it has been rebased) and if you want to open an issue then do so. |
I'm adding "needs work" just to get the doctest added. Then I would give this a positive review, but should allow @kwankyu to respond to my comments above first. |
If f is a map from a general curve in P2, then I would expect that f(P) gives a point in the codomain of the map after coercing P to a point on the curve (and raise an error if not coercible).
Here we are dealing with elliptic curves and morphisms between them. Things should work as expected by experts in this domain of research. So I do not object to the patch if it is "right" for you. |
By the way, I am just thankful to you for reviewing PRs. I think we are short of domain expert reviewers, especially on elliptic curves. |
Apparently |
Thanks, I have been one of the major contributors to the elliptic curves section of Sage since the very beginning, and still have more that I want to do. I should have plenty of time to review others' hard work, being retired! |
Agreed re consistency! Regarding @kwankyu 's suggestion, I prefer to leave it as it as (+ this patch), leaving more general questions about morphisms in algebraic geometry to others. There's a good reason (efficiency via special-casing) for using custom code for elliptic curve morphisms. [The very first contribution I made to Sage in 2007 (apart from rewriting eclib to make it possible to interface with it) was to implement Weierstrass morphisms. I did not know much python back then (and even now see plenty of pythonisms I didn't know existed, especially when reviewing @yyyyx4 's code :)] |
...so that conversions are done properly (in particular, checking that the input point is actually on the curve)
97bfaff
to
d38cf45
Compare
In the newest version of this branch I've changed
To be fair, a lot of modern-day Pythonisms didn't even exist 15 years back... 🙂 |
Documentation preview for this PR (built with commit 94068f7; changes) is ready! 🎉 |
…aluating elliptic-curve isomorphism In Sage 10.0: ```sage sage: E = EllipticCurve(GF(101), [1,1]) sage: f = E.automorphisms()[0] sage: EE = EllipticCurve(GF(101), [5,5]) sage: P = EE.lift_x(2) sage: P in f.domain() False sage: f(P) (2 : 15 : 1) sage: f(P) in f.codomain() True sage: f.codomain().defining_polynomial()(*f(P)) 12 ``` Sage will happily "evaluate" a `WeierstrassIsomorphism` on just about any `EllipticCurvePoint`, even a point which explicitly lies on a *different* curve. This simple patch adds a check to remove this footgun. URL: sagemath#35799 Reported by: Lorenz Panny Reviewer(s): Kwankyu Lee
In Sage 10.0:
Sage will happily "evaluate" a
WeierstrassIsomorphism
on just about anyEllipticCurvePoint
, even a point which explicitly lies on a different curve. This simple patch adds a check to remove this footgun.