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(EllipticCurve): ZSMul formula in terms of division polynomials #13782

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

Conversation

Multramate and others added 30 commits January 2, 2024 22:51
@alreadydone alreadydone removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jun 12, 2024
@alreadydone alreadydone force-pushed the DivisionPolynomial_smul branch from 2061693 to 734af33 Compare June 15, 2024 04:36
@alreadydone alreadydone force-pushed the DivisionPolynomial_smul branch from 734af33 to 55c38c6 Compare June 15, 2024 04:42
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jun 17, 2024
Comment on lines +509 to +516
suppress_compilation in
/-- The `ω` family of division polynomials: `ω n` gives the second (`Y`) coordinate in
Jacobian coordinates of the scalar multiplication by `n`. -/
protected def ω (n : ℤ) : R[X][Y] :=
redInvarDenom W.ψ₂ (C W.Ψ₃) (C W.preΨ₄) n *
((CC W.a₁ * polynomialY W - polynomialX W) * C W.Ψ₃
+ 4 * polynomial W * (2 * polynomial W + C W.Ψ₂Sq))
- compl₂EDSAux W.ψ₂ (C W.Ψ₃) (C W.preΨ₄) n + negPolynomial W * W.ψ n ^ 3
Copy link
Collaborator

@Multramate Multramate Jul 8, 2024

Choose a reason for hiding this comment

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

Is suppress_compilation just the same as tagging noncomputable?

Anyways, I'm wondering if it's possible to extract a version of ω that very close to being a univariate polynomial, i.e. Ω for ω analogous to Ψ for ψ, where Ω is some univariate polynomial times a constant (2?) multiple of ψ. This way the ZSmul formula can be expressed in affine coordinates as n • (x, y) = (f(x), g(x) * h(x, y)) for some univariate rational functions f and g and some bivariate polynomial h, mirroring Sutherland's statement in Lemma 5.21. When a₁ and a₃ are zero, then there should be a way to define Ω so that h(x, y) is just y.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll see what I can do with ω.

Lean is sometimes slow to compile something computable or fails to compile due to incomplete support. Verifying computability seems to always be fast though, so there should never be a need to mark a computable def noncomputable. To deal with slow compilation people have invented suppress_compilation and that's what we should use instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not yet sure what could be done for ω; the best idea I have is to take the expression
$$\omega_n=\frac{\psi_{n+1}\psi_n\psi_{n-1}}{\psi_3}(a_1 F_Y-F_X)-\frac{\psi_{n-2}\psi_{n+1}^2}{\psi_2}+(Y-F_Y)\psi_n^3$$
(first posted on Zulip, here I removed the multiple of polynomial) and try to analyze the even n and odd n cases separately. You can always write it as p(X)+Yq(X) in a unique way and maybe you will be able to compute the degrees of p(X) and q(X).

An inadvertent discovery: when I tried to derive negDblY from $$\omega_2$$, I arrived at the very simple expression ψ₃ polynomialX + Y polynomialY^3. Comparing this with what we have in mathlib we arrive at the identity ψ₃ + polynomialX^2 - a1 polynomialX polynomialY - (3x + a2) polynomialY^2 + (12 x + b2) polynomial = 0. In my notes I've explained that dblX can be taken to be X polynomialY^2 - ψh₃ where ψh₃ is the weighted homogenization of ψ₃. This new discovery shows that negDblY can be taken to be Y polynomialY^3 + ψh₃ polynomialX which is of a similar form. TODO: use this to simplify the expressions here.

Copy link
Collaborator

@Multramate Multramate Sep 21, 2024

Choose a reason for hiding this comment

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

Thanks for the identities. I guess we'd have to either redefine ψh₃ recursively, or get the homogenisation API working and apply it to the existing ψ₃. It's probably not too urgent now but we should do it eventually.

The reason I'm asking for Ω is because I need Sutherland's argument for Theorem 5.8 to finish the computation for |E[n]| = n^2. We can translate that theorem into division polynomial language, and he essentially relates |E[n]| to the number of roots of ψ² (as a univariate polynomial), by showing that the fibers (x₀, y₀) of multiplication by n (after shifting 0 to a suitable point (a, b)) are uniquely determined by x₀, and we can show this easily if we have an expression for ω directly in terms of y. The same argument happens to also work to show that multiplication by n is surjective (the "standard" proof to this is a non-trivial fact about morphisms of curves).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think there's a need to define the whole family ψh recursively (which I think is what you mean); in any case ψh₃ will be one of the base cases, so it either needs to be directly written down, or obtained from ψ₃ via homogenization API.
I'll read Sutherland to understand what is really needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked-by-other-PR This PR depends on another PR to Mathlib (this label is automatically managed by a bot) merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) t-algebra Algebra (groups, rings, fields, etc) 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.

3 participants