Documentation

CslibFrontier.Foundations.AlgebraicGeometry.EllipticCurve.Montgomery

Montgomery elliptic curves #

A Montgomery curve over a commutative ring R is given by B v² = u³ + A u² + u with B (A² - 4) ≠ 0 ([BS23], Section 15.2.1, p. 619). Over a field F, the coordinate substitution (u, v) = (B x, B y) transforms this equation into the Weierstrass curve M.toWeierstrass (Y² = X³ + (A/B) X² + (1/B²) X), which is the quadratic twist (ofCubic M.A 1 0).quadraticTwist M.B⁻¹. When 2 ≠ 0 in F, M.toWeierstrass is elliptic and M.toWeierstrassEquiv identifies M.Point with M.toWeierstrass.toAffine.Point. Over a finite field of characteristic ≠ 2, 4 divides #M.Point, so no Montgomery curve is related by a change of variables to a Weierstrass curve of odd order.

Main definitions #

Main results #

References #

structure MontgomeryCurve (R : Type u_1) [CommRing R] :
Type u_1

A Montgomery elliptic curve B v² = u³ + A u² + u over a commutative ring R, with non-degeneracy condition B (A² - 4) ≠ 0 ([BS23], Section 15.2.1, p. 619).

  • A : R

    The quadratic coefficient A in B v² = u³ + A u² + u.

  • B : R

    The twist coefficient B in B v² = u³ + A u² + u.

  • nondegenerate : self.B * (self.A ^ 2 - 4) ≠ 0

    Non-degeneracy: B (A² - 4) ≠ 0, avoiding singular curves when 2 ≠ 0.

theorem MontgomeryCurve.B_ne_zero {F : Type u_1} [Field F] (M : MontgomeryCurve F) :
M.B ≠ 0

The twist coefficient M.B is nonzero.

theorem MontgomeryCurve.discr_ne_zero {F : Type u_1} [Field F] (M : MontgomeryCurve F) :
M.A ^ 2 - 4 ≠ 0

The Montgomery discriminant factor M.A ^ 2 - 4 is nonzero.

def MontgomeryCurve.Equation {F : Type u_1} [Field F] (M : MontgomeryCurve F) (u v : F) :

The affine Montgomery curve equation B v² = u³ + A u² + u.

Instances For
    @[instance_reducible]
    inductive MontgomeryCurve.Point {F : Type u_1} [Field F] (M : MontgomeryCurve F) :
    Type u_1

    Points of a Montgomery curve M: the point at infinity .zero or an affine solution .some u v h.

    def MontgomeryCurve.instDecidableEqPoint.decEq {F✝ : Type u_2} {inst✝ : Field F✝} {M✝ : MontgomeryCurve F✝} [DecidableEq F✝] (x✝ x✝¹ : M✝.Point) :
    Decidable (x✝ = x✝¹)
    @[instance_reducible]
    instance MontgomeryCurve.instDecidableEqPoint {F✝ : Type u_2} {inst✝ : Field F✝} {M✝ : MontgomeryCurve F✝} [DecidableEq F✝] :
    def MontgomeryCurve.pointEquivOption {F : Type u_1} [Field F] (M : MontgomeryCurve F) :
    M.Point ≃ Option { uv : F × F // M.Equation uv.1 uv.2 }

    The points of a Montgomery curve M are equivalent to Option of the affine solutions of M.Equation.

    theorem MontgomeryCurve.natCard_point_eq_one_add {F : Type u_1} [Field F] (M : MontgomeryCurve F) [Finite F] :
    Nat.card M.Point = 1 + Nat.card { uv : F × F // M.Equation uv.1 uv.2 }

    Over a finite field, the number of points on M is one (the point at infinity) plus the number of affine solutions of M.Equation.

    The Weierstrass model Y² = X³ + (A/B) X² + (1/B²) X of M, obtained by substituting (u, v) = (B X, B Y). This coincides with the quadratic twist (ofCubic M.A 1 0).quadraticTwist M.B⁻¹. The change of variables of [BS23], Section 15.2.1, p. 619, u := B x - A/3 and v := B y, also removes the quadratic term; it is toShortWeierstrass.

    M.toWeierstrass is the quadratic twist of Y² = X³ + A X² + X by B⁻¹.

    theorem MontgomeryCurve.toWeierstrass_Δ {F : Type u_1} [Field F] (M : MontgomeryCurve F) :
    M.toWeierstrass.Δ = 16 * (M.A ^ 2 - 4) / M.B ^ 6

    The discriminant of M.toWeierstrass is 16 (A² - 4) / B⁶.

    When 2 ≠ 0 in F, M.toWeierstrass is an elliptic curve.

    Affine solutions (B x, B y) of M.Equation correspond to affine solutions (x, y) of M.toWeierstrass.

    theorem MontgomeryCurve.toWeierstrass_equation_div {F : Type u_1} [Field F] (M : MontgomeryCurve F) {u v : F} (h : M.Equation u v) :

    An affine point (u, v) on M maps to an affine solution (u / B, v / B) of M.toWeierstrass.

    theorem MontgomeryCurve.toWeierstrass_nonsingular_div {F : Type u_1} [Field F] (M : MontgomeryCurve F) (h2 : 2 ≠ 0) {u v : F} (h : M.Equation u v) :

    When 2 ≠ 0, an affine point (u, v) on M maps to a nonsingular point (u / B, v / B) on M.toWeierstrass.

    noncomputable def MontgomeryCurve.toWeierstrassEquiv {F : Type u_1} [Field F] (M : MontgomeryCurve F) (h2 : 2 ≠ 0) :

    Equivalence between M.Point and the affine points of M.toWeierstrass when 2 ≠ 0 ([BS23], Section 15.2.1, p. 619).

    @[simp]
    theorem MontgomeryCurve.toWeierstrassEquiv_some {F : Type u_1} [Field F] (M : MontgomeryCurve F) (h2 : 2 ≠ 0) {u v : F} (h : M.Equation u v) :

    M.toWeierstrassEquiv maps an affine point .some u v h to .some (u / M.B) (v / M.B).

    @[simp]

    (M.toWeierstrassEquiv h2).symm maps .some x y h to .some (M.B * x) (M.B * y).

    Shift X ↦ X - A / (3 B) transforming M.toWeierstrass into short Weierstrass form when 3 ≠ 0 ([BS23], Section 15.2.1, p. 619).

    When 2 and 3 are invertible in F, M.toShortWeierstrass equals the curve obtained from M.toWeierstrass via Mathlib's WeierstrassCurve.toShortNF.

    When 3 ≠ 0, M.toShortWeierstrass is in short Weierstrass normal form (a₁ = a₂ = a₃ = 0).

    In characteristic three (3 = 0 in F), if M.A ≠ 0 then M.toShortWeierstrass is not in short normal form, since a₂ = A / B ≠ 0.

    Affine solutions (B x - A / 3, B y) of M.Equation correspond to affine solutions (x, y) of M.toShortWeierstrass, without requiring 3 ≠ 0.

    Over a finite field of characteristic ≠ 2, 4 ∣ #M.toWeierstrass(F) ([BS23], Section 15.2.1, p. 619).

    Over a finite field of characteristic ≠ 2, the order of any Montgomery curve is divisible by 4 ([BS23], Section 15.2.1, p. 619).

    No Montgomery curve over a finite field of characteristic ≠ 2 is related by a change of variables to a Weierstrass curve of odd order.