Birch and Swinnerton-Dyer: certified ranks in Lean
ECCompute: Lean that certifies rank lower bounds for 480 elliptic curves, up to rank ≥ 31. Certify more, rerun it, read what 2026 claimed about BSD

| 1 | /- |
| 2 | Copyright (c) 2026 Bhavik Mehta. All rights reserved. |
| 3 | Released under the GNU General Public License version 3.0 as described in the file LICENSE. |
| 4 | Authors: Bhavik Mehta |
| 5 | -/ |
| 6 | module |
| 7 | |
| 8 | public import Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Point |
| 9 | public import Mathlib.AlgebraicGeometry.EllipticCurve.Weierstrass |
| 10 | |
| 11 | /-! |
| 12 | # Roots of the 2-torsion polynomial |
| 13 | |
| 14 | For a Weierstrass curve `W` over a field of characteristic different from `2` with nonzero |
| 15 | discriminant, this file identifies the roots of `W.twoTorsionPolynomial` with the `X`-coordinates |
| 16 | of the nonzero `2`-torsion affine points of `W`. |
| 17 | |
| 18 | ## Main results |
| 19 | |
| 20 | * `WeierstrassCurve.isRoot_twoTorsionPolynomial_iff`: `x` is a root of `W.twoTorsionPolynomial` |
| 21 | if and only if it is the `X`-coordinate of a nonzero affine point `P` with `P + P = 0`. |
| 22 | -/ |
| 23 | |
| 24 | section |
| 25 | |
| 26 | open Polynomial |
| 27 | |
| 28 | namespace WeierstrassCurve |
| 29 | |
| 30 | variable {F : Type*} [Field F] (W : WeierstrassCurve F) |
| 31 | |
| 32 | /-- Evaluate the 2-torsion polynomial at `x`, expanded via the `bᵢ` coefficients. -/ |
| 33 | @[grind =] |
| 34 | public lemma eval_twoTorsionPolynomial_toPoly {x : F} : |
| 35 | W.twoTorsionPolynomial.toPoly.eval x = 4 * x ^ 3 + W.b₂ * x ^ 2 + 2 * W.b₄ * x + W.b₆ := by |
| 36 | simp [twoTorsionPolynomial, Cubic.toPoly] |
| 37 | |
| 38 | /-- A nonzero affine point `some x y h` with `P + P = 0` satisfies `y = W.negY x y`. -/ |
| 39 | public theorem Y_eq_negY_of_add_self [DecidableEq F] {x y : F} (h : W.toAffine.Nonsingular x y) |
| 40 | (hP : (Affine.Point.some x y h : W.toAffine.Point) + Affine.Point.some x y h = 0) : |
| 41 | y = W.toAffine.negY x y := by |
| 42 | by_contra hne |
| 43 | rw [Affine.Point.add_self_of_Y_ne hne] at hP |
| 44 | exact Affine.Point.some_ne_zero _ hP |
| 45 | |
| 46 | /-- A nonzero affine `2`-torsion point `some x y h` of `W` (with `P + P = 0`) has `X`-coordinate a |
| 47 | root of `W.twoTorsionPolynomial`. -/ |
| 48 | public theorem isRoot_twoTorsionPolynomial_of_add_self [DecidableEq F] {x y : F} |
| 49 | (h : W.toAffine.Nonsingular x y) |
| 50 | (hP : (Affine.Point.some x y h : W.toAffine.Point) + Affine.Point.some x y h = 0) : |
| 51 | W.twoTorsionPolynomial.toPoly.IsRoot x := by |
| 52 | rw [IsRoot.def, eval_twoTorsionPolynomial_toPoly, b₂, b₄, b₆] |
| 53 | have hy : y = W.toAffine.negY x y := Y_eq_negY_of_add_self W h hP |
| 54 | rw [Affine.negY] at hy |
| 55 | have he : 2 * y + W.a₁ * x + W.a₃ = 0 := by linear_combination hy |
| 56 | have heq := h.left |
| 57 | rw [Affine.equation_iff] at heq |
| 58 | linear_combination (2 * y + W.a₁ * x + W.a₃) * he - 4 * heq |
| 59 | |
| 60 | /-- `x` is a root of the `2`-torsion polynomial of a Weierstrass curve of characteristic |
| 61 | different from `2` with nonzero discriminant if and only if it is the `X`-coordinate of a nonzero |
| 62 | affine `2`-torsion point. -/ |
| 63 | public theorem isRoot_twoTorsionPolynomial_iff [DecidableEq F] (h2 : (2 : F) ≠ 0) (hΔ : W.Δ ≠ 0) |
| 64 | {x : F} : |
| 65 | W.twoTorsionPolynomial.toPoly.IsRoot x ↔ |
| 66 | ∃ y, ∃ h : W.toAffine.Nonsingular x y, |
| 67 | (Affine.Point.some x y h : W.toAffine.Point) + Affine.Point.some x y h = 0 := by |
| 68 | refine ⟨fun hroot ↦ ?_, fun ⟨y, hns, hP⟩ ↦ isRoot_twoTorsionPolynomial_of_add_self W hns hP⟩ |
| 69 | have h4 : (4 : F) ≠ 0 := by |
| 70 | have h22 : (4 : F) = 2 * 2 := by norm_num |
| 71 | rw [h22] |
| 72 | exact mul_ne_zero h2 h2 |
| 73 | rw [IsRoot.def, eval_twoTorsionPolynomial_toPoly, b₂, b₄, b₆] at hroot |
| 74 | obtain ⟨y, he⟩ : ∃ y : F, 2 * y + W.a₁ * x + W.a₃ = 0 := |
| 75 | ⟨(-W.a₁ * x - W.a₃) / 2, by field_simp; ring⟩ |
| 76 | have heq : W.toAffine.Equation x y := by |
| 77 | rw [Affine.equation_iff] |
| 78 | have h4G : (4 : F) * (y ^ 2 + W.a₁ * x * y + W.a₃ * y |
| 79 | - (x ^ 3 + W.a₂ * x ^ 2 + W.a₄ * x + W.a₆)) = 0 := by |
| 80 | linear_combination (2 * y + W.a₁ * x + W.a₃) * he - hroot |
| 81 | linear_combination (mul_eq_zero.mp h4G).resolve_left h4 |
| 82 | exact ⟨y, (Affine.equation_iff_nonsingular_of_Δ_ne_zero hΔ).mp heq, |
| 83 | Affine.Point.add_self_of_Y_eq (by rw [Affine.negY]; linear_combination he)⟩ |
| 84 | |
| 85 | end WeierstrassCurve |
| 86 | |
| 87 | end |