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.Algebra.Module.Torsion.Basic |
| 9 | public import Mathlib.FieldTheory.Finiteness |
| 10 | public import Mathlib.Algebra.Field.ZMod |
| 11 | |
| 12 | import ECCompute.ForMathlib.ModuleTorsionQuotient |
| 13 | import Mathlib.LinearAlgebra.FreeModule.ModN |
| 14 | |
| 15 | /-! |
| 16 | # The rank-bound deduction (abstract core) |
| 17 | |
| 18 | The group-theoretic core of the rank-bound descent argument, for a finitely generated |
| 19 | additive abelian group `H` as a `ℤ`-module and a prime `p`. |
| 20 | |
| 21 | Write `H ⧸ pH` for `ModN H p` (the quotient of `H` by its `p`-th multiples, a `ZMod p`-vector |
| 22 | space) and `H[p] = Submodule.torsionBy ℤ H p` for the `p`-torsion. The cardinality identity |
| 23 | `|H ⧸ nH| = n ^ rank H · |H[n]|` lives in `ECCompute.ForMathlib.ModuleTorsionQuotient` |
| 24 | (`ModN.natCard_modN`). |
| 25 | |
| 26 | ## Main results |
| 27 | |
| 28 | * `RankDeduction.rank_ge_le`: `Nat.card ι ≤ rank H + t` when `Nat.card H[p] ≤ p ^ t` and a |
| 29 | finite family `g : ι → H` has linearly independent images under a descent-character hom |
| 30 | `φ : H →+ (ι → ZMod p)`, the form the certificate uses at `p = 2`. |
| 31 | |
| 32 | An invertible matrix over `ZMod p` supplies the linear-independence hypothesis. |
| 33 | -/ |
| 34 | |
| 35 | open Module ModN |
| 36 | |
| 37 | namespace RankDeduction |
| 38 | |
| 39 | variable {ι H : Type*} [AddCommGroup H] [Module.Finite ℤ H] [Finite ι] {p : ℕ} |
| 40 | |
| 41 | /-- If a finite family `g : ι → H` has linearly independent images under an additive hom |
| 42 | `φ : H →+ (ι → ZMod p)`, then `H ⧸ pH` has dimension at least `Nat.card ι`. (The hom |
| 43 | automatically factors through `H ⧸ pH`, since the target has characteristic `p`.) -/ |
| 44 | theorem card_le_finrank_modN (hp : p.Prime) (g : ι → H) |
| 45 | (φ : H →+ (ι → ZMod p)) (hindep : LinearIndependent (ZMod p) (fun i ↦ φ (g i))) : |
| 46 | Nat.card ι ≤ finrank (ZMod p) (ModN H p) := by |
| 47 | have : Fact p.Prime := ⟨hp⟩ |
| 48 | have : Fintype ι := Fintype.ofFinite ι |
| 49 | have hφ : ∀ h, p • φ h = 0 := fun h ↦ by |
| 50 | rw [← Nat.cast_smul_eq_nsmul (ZMod p), ZMod.natCast_self, zero_smul] |
| 51 | set ψ : ModN H p →ₗ[ZMod p] (ι → ZMod p) := ModN.liftEquiv'.symm ⟨φ, hφ⟩ |
| 52 | have hψ : ∀ x, ψ (ModN.mkQ p x) = φ x := fun x ↦ rfl |
| 53 | have hmk : LinearIndependent (ZMod p) (fun i ↦ ModN.mkQ p (g i)) := |
| 54 | LinearIndependent.of_comp ψ (by simpa only [Function.comp_def, hψ] using hindep) |
| 55 | simpa using hmk.fintype_card_le_finrank |
| 56 | |
| 57 | /-- From `|H[p]| ≤ p ^ t` and a finite family of group elements whose images under `φ` are |
| 58 | linearly independent, `Nat.card ι ≤ rank H + t`. This is the form the certificate uses at |
| 59 | `p = 2`. -/ |
| 60 | public theorem rank_ge_le (hp : p.Prime) {t : ℕ} (g : ι → H) |
| 61 | (φ : H →+ (ι → ZMod p)) (hindep : LinearIndependent (ZMod p) (fun i ↦ φ (g i))) |
| 62 | (ht : Nat.card (Submodule.torsionBy ℤ H p) ≤ p ^ t) : |
| 63 | Nat.card ι ≤ finrank ℤ H + t := by |
| 64 | have : Fact p.Prime := ⟨hp⟩ |
| 65 | grw [card_le_finrank_modN hp g φ hindep, ← Nat.pow_le_pow_iff_right hp.one_lt] |
| 66 | calc |
| 67 | p ^ finrank (ZMod p) (ModN H p) |
| 68 | _ = Nat.card (ZMod p) ^ finrank (ZMod p) (ModN H p) := by simp |
| 69 | _ ≤ p ^ (finrank ℤ H + t) := by grw [← Module.natCard_eq_pow_finrank, natCard_modN, ht, pow_add] |
| 70 | |
| 71 | end RankDeduction |