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.Field.ZMod |
| 9 | |
| 10 | import Mathlib.Data.Rat.Cast.Defs |
| 11 | import Mathlib.Data.Rat.Lemmas |
| 12 | |
| 13 | public import Mathlib.NumberTheory.Padics.PadicNumbers |
| 14 | public import Mathlib.RingTheory.Valuation.Integers |
| 15 | |
| 16 | /-! |
| 17 | # Good denominators mod a prime |
| 18 | |
| 19 | For a prime `p`, the "good denominator" predicate `(q.den : ZMod p) ≠ 0` on `ℚ` says that `q` lies |
| 20 | in the `p`-adic valuation ring `(Rat.padicValuation p).integer` (`Rat.mem_padicInteger_iff`), so it |
| 21 | is closed under the field operations through that subring. |
| 22 | |
| 23 | ## Main results |
| 24 | |
| 25 | * `Rat.den_add_ne_zero`, `Rat.den_sub_ne_zero`, `Rat.den_mul_ne_zero`, `Rat.den_pow_ne_zero`: |
| 26 | closure of `(·.den : ZMod p) ≠ 0` under the field operations. |
| 27 | -/ |
| 28 | |
| 29 | section |
| 30 | |
| 31 | namespace Rat |
| 32 | |
| 33 | variable {p : ℕ} |
| 34 | |
| 35 | /-- A rational lies in the `p`-adic valuation ring iff its denominator is nonzero mod `p`. -/ |
| 36 | public theorem mem_padicInteger_iff [Fact p.Prime] {x : ℚ} : |
| 37 | x ∈ (Rat.padicValuation p).integer ↔ (x.den : ZMod p) ≠ 0 := by |
| 38 | rw [Valuation.mem_integer_iff, Rat.padicValuation_le_one_iff, Ne, ZMod.natCast_eq_zero_iff] |
| 39 | |
| 40 | variable {x y : ℚ} |
| 41 | |
| 42 | /-- `(·.den : ZMod p) ≠ 0` is closed under addition. -/ |
| 43 | public theorem den_add_ne_zero (hp : p.Prime) (hx : (x.den : ZMod p) ≠ 0) |
| 44 | (hy : (y.den : ZMod p) ≠ 0) : ((x + y).den : ZMod p) ≠ 0 := |
| 45 | have : Fact p.Prime := ⟨hp⟩ |
| 46 | mem_padicInteger_iff.mp (add_mem (mem_padicInteger_iff.mpr hx) (mem_padicInteger_iff.mpr hy)) |
| 47 | |
| 48 | /-- `(·.den : ZMod p) ≠ 0` is closed under subtraction. -/ |
| 49 | public theorem den_sub_ne_zero (hp : p.Prime) (hx : (x.den : ZMod p) ≠ 0) |
| 50 | (hy : (y.den : ZMod p) ≠ 0) : ((x - y).den : ZMod p) ≠ 0 := |
| 51 | have : Fact p.Prime := ⟨hp⟩ |
| 52 | mem_padicInteger_iff.mp (sub_mem (mem_padicInteger_iff.mpr hx) (mem_padicInteger_iff.mpr hy)) |
| 53 | |
| 54 | /-- `(·.den : ZMod p) ≠ 0` is closed under multiplication. -/ |
| 55 | public theorem den_mul_ne_zero (hp : p.Prime) (hx : (x.den : ZMod p) ≠ 0) |
| 56 | (hy : (y.den : ZMod p) ≠ 0) : ((x * y).den : ZMod p) ≠ 0 := |
| 57 | have : Fact p.Prime := ⟨hp⟩ |
| 58 | mem_padicInteger_iff.mp (mul_mem (mem_padicInteger_iff.mpr hx) (mem_padicInteger_iff.mpr hy)) |
| 59 | |
| 60 | /-- `(·.den : ZMod p) ≠ 0` is closed under powers. -/ |
| 61 | public theorem den_pow_ne_zero (hp : p.Prime) (hx : (x.den : ZMod p) ≠ 0) (n : ℕ) : |
| 62 | ((x ^ n).den : ZMod p) ≠ 0 := |
| 63 | have : Fact p.Prime := ⟨hp⟩ |
| 64 | mem_padicInteger_iff.mp (pow_mem (mem_padicInteger_iff.mpr hx) n) |
| 65 | |
| 66 | |
| 67 | end Rat |
| 68 | |
| 69 | end |