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 ECCompute.Kernel |
| 9 | |
| 10 | import Mathlib.Data.List.Basic |
| 11 | |
| 12 | /-! |
| 13 | # Soundness of the `Bool` folds |
| 14 | |
| 15 | `allBelow_iff` and `allList_iff` characterize the kernel folds `ECCompute.allBelow` and |
| 16 | `ECCompute.allList` (from `Kernel`) as a bounded `∀` and a list `∀`, and the `succ`/`cons` lemmas |
| 17 | peel one step. |
| 18 | -/ |
| 19 | |
| 20 | namespace ECCompute |
| 21 | |
| 22 | section |
| 23 | variable {n : ℕ} {p : ℕ → Bool} |
| 24 | |
| 25 | /-- `allBelow 0 p` is vacuously `true`. -/ |
| 26 | @[simp] theorem allBelow_zero : allBelow 0 p = true := rfl |
| 27 | |
| 28 | /-- `allBelow (n + 1) p` peels the top index: it folds `p n` into `allBelow n p`. -/ |
| 29 | @[simp, grind =] theorem allBelow_succ : allBelow (n + 1) p = (p n).and (allBelow n p) := rfl |
| 30 | |
| 31 | /-- `allBelow` is `true` exactly when `p` holds at every `m < n`. -/ |
| 32 | @[grind =] public theorem allBelow_iff : allBelow n p ↔ ∀ m < n, p m := by |
| 33 | induction n with |
| 34 | | zero => simp |
| 35 | | succ k ih => |
| 36 | rw [allBelow_succ, Bool.and_eq_true, ih] |
| 37 | grind |
| 38 | |
| 39 | end |
| 40 | |
| 41 | section |
| 42 | variable {α : Type} {p : α → Bool} {l : List α} |
| 43 | |
| 44 | /-- `allList` over the empty list is `true`. -/ |
| 45 | @[simp] theorem allList_nil : allList p [] = true := rfl |
| 46 | |
| 47 | /-- `allList` peels the head element, folding `p a` into `allList p l`. -/ |
| 48 | @[simp, grind =] theorem allList_cons {a : α} : allList p (a :: l) = (p a).and (allList p l) := rfl |
| 49 | |
| 50 | /-- `allList` computes the universal quantifier over the members of a list. -/ |
| 51 | @[grind =] public theorem allList_iff : allList p l ↔ ∀ a ∈ l, p a := by |
| 52 | induction l with |
| 53 | | nil => simp |
| 54 | | cons a t ih => rw [allList_cons, Bool.and_eq_true, ih, List.forall_mem_cons] |
| 55 | |
| 56 | end |
| 57 | |
| 58 | end ECCompute |