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

feat(AlgebraicGeometry/EllipticCurve/Jacobian): implement group law for Jacobian coordinates #9405

Open
wants to merge 25 commits into
base: master
Choose a base branch
from

Conversation

@Multramate Multramate added WIP Work in progress t-number-theory Number theory (also use t-algebra or t-analysis to specialize) t-algebraic-geometry Algebraic geometry labels Jan 2, 2024
@Multramate Multramate added blocked-by-math-PR This PR depends on another PR to Mathlib awaiting-review The author would like community review of the PR awaiting-CI and removed WIP Work in progress labels Jan 4, 2024
@Multramate Multramate changed the title feat(AlgebraicGeometry/EllipticCurve/Jacobian): implement Jacobian coordinates feat(AlgebraicGeometry/EllipticCurve/Jacobian): implement group law for Jacobian coordinates Jan 4, 2024
@alexjbest
Copy link
Member

So do you want both types of coordinates in Mathlib? What is the motivation for doing it that way, rather than just choosing one type of coordinates?

@Multramate
Copy link
Collaborator Author

So do you want both types of coordinates in Mathlib? What is the motivation for doing it that way, rather than just choosing one type of coordinates?

I need Jacobian coordinates, because their coordinates are precisely the division polynomials in #6703 and the phi_n/omega_n defined in AEC Exercise III.3.7, albeit with an error. I don't need projective coordinates at the moment, but I believe it might be a very useful definition in general (e.g. to give an elementary definition of reduction modulo p without any bias on the weights). In fact projective coordinates was my toy model for Jacobian coordinates because originally I wasn't sure how to write the API at all.

mathlib-bors bot pushed a commit that referenced this pull request Feb 23, 2024
…nd nonsingularity for Jacobian coordinates (#9432)

Define a Jacobian point representative over a ring `R` as the type `Fin 3 -> R`, and its equivalence class `PointClass` as a quotient by the usual weighted scaling relation. Define the analogous `equation` and `nonsingular` predicates on `Fin 3 -> F` over a field `F`, and lift `nonsingular` to `PointClass`. This also has minimal API (e.g. it's missing many of the `equation` lemmas) as most computations should ideally be done using the affine API.

This is the first in a series of four PRs leading to #9405 and is analogous to #9416
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. label Feb 23, 2024
thorimur pushed a commit that referenced this pull request Feb 24, 2024
…nd nonsingularity for Jacobian coordinates (#9432)

Define a Jacobian point representative over a ring `R` as the type `Fin 3 -> R`, and its equivalence class `PointClass` as a quotient by the usual weighted scaling relation. Define the analogous `equation` and `nonsingular` predicates on `Fin 3 -> F` over a field `F`, and lift `nonsingular` to `PointClass`. This also has minimal API (e.g. it's missing many of the `equation` lemmas) as most computations should ideally be done using the affine API.

This is the first in a series of four PRs leading to #9405 and is analogous to #9416
thorimur pushed a commit that referenced this pull request Feb 26, 2024
…nd nonsingularity for Jacobian coordinates (#9432)

Define a Jacobian point representative over a ring `R` as the type `Fin 3 -> R`, and its equivalence class `PointClass` as a quotient by the usual weighted scaling relation. Define the analogous `equation` and `nonsingular` predicates on `Fin 3 -> F` over a field `F`, and lift `nonsingular` to `PointClass`. This also has minimal API (e.g. it's missing many of the `equation` lemmas) as most computations should ideally be done using the affine API.

This is the first in a series of four PRs leading to #9405 and is analogous to #9416
riccardobrasca pushed a commit that referenced this pull request Mar 1, 2024
…nd nonsingularity for Jacobian coordinates (#9432)

Define a Jacobian point representative over a ring `R` as the type `Fin 3 -> R`, and its equivalence class `PointClass` as a quotient by the usual weighted scaling relation. Define the analogous `equation` and `nonsingular` predicates on `Fin 3 -> F` over a field `F`, and lift `nonsingular` to `PointClass`. This also has minimal API (e.g. it's missing many of the `equation` lemmas) as most computations should ideally be done using the affine API.

This is the first in a series of four PRs leading to #9405 and is analogous to #9416
dagurtomas pushed a commit that referenced this pull request Mar 22, 2024
…nd nonsingularity for Jacobian coordinates (#9432)

Define a Jacobian point representative over a ring `R` as the type `Fin 3 -> R`, and its equivalence class `PointClass` as a quotient by the usual weighted scaling relation. Define the analogous `equation` and `nonsingular` predicates on `Fin 3 -> F` over a field `F`, and lift `nonsingular` to `PointClass`. This also has minimal API (e.g. it's missing many of the `equation` lemmas) as most computations should ideally be done using the affine API.

This is the first in a series of four PRs leading to #9405 and is analogous to #9416
Louddy pushed a commit that referenced this pull request Apr 15, 2024
…nd nonsingularity for Jacobian coordinates (#9432)

Define a Jacobian point representative over a ring `R` as the type `Fin 3 -> R`, and its equivalence class `PointClass` as a quotient by the usual weighted scaling relation. Define the analogous `equation` and `nonsingular` predicates on `Fin 3 -> F` over a field `F`, and lift `nonsingular` to `PointClass`. This also has minimal API (e.g. it's missing many of the `equation` lemmas) as most computations should ideally be done using the affine API.

This is the first in a series of four PRs leading to #9405 and is analogous to #9416
@alreadydone
Copy link
Contributor

I'd like to merge master into this soon, because I'm building on top of this branch but WeierstrassCurve.map is not available here. I expect this PR to be merged as a whole so I won't update the "prerequisite" PRs. Before I merge I'd like to get #12874 in.

@Multramate
Copy link
Collaborator Author

Sure, give me a couple of hours and I'll hopefully update everything by today!

@alreadydone
Copy link
Contributor

Thanks!

@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. label May 20, 2024
Comment on lines +557 to +560
def dblX (P : Fin 3 → R) : R :=
(3 * P x ^ 2 + 2 * V.a₂ * P x * P z ^ 2 + V.a₄ * P z ^ 4 - V.a₁ * P y * P z) ^ 2
+ V.a₁ * (3 * P x ^ 2 + 2 * V.a₂ * P x * P z ^ 2 + V.a₄ * P z ^ 4 - V.a₁ * P y * P z) * P z
* (P y - V.negY P) - V.a₂ * P z ^ 2 * (P y - V.negY P) ^ 2 - 2 * P x * (P y - V.negY P) ^ 2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about replacing the appearances of the RHS of WeierstrassCurve.Jacobian.eval_polynomialX by the LHS in this definition and in dblY below? We could replace P y - V.negY P with the evaluation of polynomialY too, but that wouldn't be shorter.

@alreadydone
Copy link
Contributor

alreadydone commented May 27, 2024

Here are some additions and changes I made to the Jacobian file for the purpose of division polynomials, and maybe you want to incorporate them into one or more of your PRs. I still think it makes sense to merge this PR as a whole and close the others.

@Multramate
Copy link
Collaborator Author

Thanks! I'll have a look later in the week. I don't mind merging this PR as a whole, but I don't want to set a precedent where 1000+ line feat PRs are acceptable. Maybe we can do this for Projective once the Jacobian ones are done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-review The author would like community review of the PR blocked-by-math-PR This PR depends on another PR to Mathlib blocked-by-other-PR t-algebraic-geometry Algebraic geometry t-number-theory Number theory (also use t-algebra or t-analysis to specialize)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants