-
-
Notifications
You must be signed in to change notification settings - Fork 511
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
Add hyperelliptic curves using the smooth model #39161
base: develop
Are you sure you want to change the base?
Conversation
Co-Authored-By: grhkm21 <83517584+grhkm21@users.noreply.github.com> Co-Authored-By: sabrinakunzweiler <22136626+sabrinakunzweiler@users.noreply.github.com>
…m' into hyperelliptic-curve
…m' into hyperelliptic_curve_sm
Documentation preview for this PR (built with commit 34dd9ac; changes) is ready! 🎉 |
Not an expert here, but why exactly would it be backwards incompatible to just replace the old class with the new one entirely? (can't you find some reasonable bijective correspondence between old and new model?) |
there's some details about it here: https://groups.google.com/g/sage-devel/c/kIwcYIzm4is/m/b3eefNSzAQAJ generally, my understanding is that if a user is running code with In my mind that means
|
@grhkm21 looks like your most recent commits broke other doctests |
We chose not to normalise all points, but rather just the points where the weight of the coordinate corresponding to the last nonzero entry of the points
Do you think it's worth making a global flag Of course in that case whatever the global variable is, the user can always import explicitly from one of the two module to select which to use regardless. Some cursory notes:
|
A lot of these points are very good, thank you. I'll try and fix them all after the holidays! |
@GiacomoPope can you mark this PR as draft? |
@grhkm21 I have marked it as a draft PR |
Overview
This PR includes a whole new module into schemes which implements hyperelliptic curves over the smooth model, and focuses on implementing decent arithmetic for Jac(H) for all reasonable cases, something which is not done properly in the current implementation due to limitations of the curve model used.
The idea is that
hyperelliptic_curves_sm
will be available with the old model for some time, until someone decides we should depreciate the old model in favour of this new implementation.Motivation
The current implementation of hyperelliptic curves in SageMath uses the projective plane model. Although this works nicely enough for imaginary curves with only one point at infinity, it is not descriptive enough for the real models. My gut feeling is the projective plane model was used as in early Sage days this was easier to do and allowed hyperelliptic curves to be supported at all. Mathematically, I believe it makes much more sense to use a weighted projective model to have this new description but it requires more tools which we only have thanks to the work of others in sage since it was released.
This PR is a total rewrite of the hyperelliptic curve classes to instead use the smooth model for hyperelliptic curves which facilitates implementing arithmetic of Jacobians of hyperelliptic curves for (almost) all cases. In particular, now if one tries to perform arithmetic on Jac(C) one either gets the correct value or a well-handled error instead of just returning something which is wrong.
The hope is that with this new model for the curves, more recent research in the area of hyperelliptic curves and their jacobians can be more easily integrated. As a personal example, being able to compute arithmetic in Jac(H) for the real model unconditionally would help with the implementation of genus two isogenies which are "in vogue" right now in the cryptography world.
Content of PR
This PR looks WAY bigger than it is, as it duplicates ALL code from
hyperelliptic_curves
and then has modifications to allow this to work in the new curve model. I believe the best thing to do in the long run is to depreciate the old hyperelliptic curve impl and have this replace it, but this will take years(?) so I think we'll just have to have both side by side for a while.This PR still needs a lot of work including:
but the code has sat at this stage for a long time without much more progress from the three of us, so I think the best thing to do is open up the PR and try and get some extra attention on getting this code ready to be included.
One benefit is that all this code is "new" in that it should not conflict with anyone else's work, so we can get this code into a good position and keep adding to it with more interesting maths once the base layer is in place
Example of better arithmetic
For example, this code fixed the following issue:
#32024
and is also related to the issues #37109 #37093 #37101 #37626
Help!
This code needs more work, and lots of time spent on the review which I don't think is a reasonable thing to do for one person. So if this area interests you any help would be appreciated (either in the review of some of the code or some extra commits which tidy up aspects)