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

What upstream says
This project starts from b-mehta/EllipticCurveRank at 9cb92e9a7ddf28666d89cb221a89fb35de75b4d3 (2026-11-27). Its README at that commit follows, unchanged, with its headings two levels down; README.md here is this project's. Upstream has no AGENTS.md.
README.md
ECCompute
Certified lower bounds on the Mordell-Weil rank of elliptic curves over ℚ, in Lean 4 on top of
mathlib.
For a Weierstrass curve E/ℚ and an integer ρ, ECCompute produces a term of HasRankGE E ρ:
E(ℚ) contains a finitely generated subgroup of rank at least ρ. Every check reduces in the Lean
kernel via Lean.reflBoolTrue.
The headline result is
curve 302 of the ICARM Elliptic Curve Rank
Leaderboard, at rank at least 31 (the curve's attribution is on the linked page):
def curve302 : WeierstrassCurve ℚ :=
⟨1, 1, 1, -1284727764113567728281797636015784768866707681415849262157224232063,
560368321454261339256859338901915312332769858684945406858043869199456710681989058863306170127006181⟩
theorem curve302_hasRankGE_31 : HasRankGE curve302 31 := by
unfold curve302
certify_curve torsion 31 "data/curve302.txt" "data/curve302-labels.txt"
The points and labels are read from data/.
How it works
HasRankGE E ρ says the Mordell-Weil group E(ℚ) contains a finitely generated ℤ-submodule of
free rank at least ρ. The rank of a subgroup bounds the rank of the whole group, so this is
exactly rank E(ℚ) ≥ ρ. Phrasing the bound through a subgroup means a proof needs only ρ
explicit independent points, not the theorem that E(ℚ) is itself finitely generated (Mordell-Weil),
which mathlib does not have.
To exhibit such a subgroup we take ρ points from the leaderboard and show they are independent.
The tool for this is a descent map, due to Cremona. Fix a prime p and a root θ of the curve's
cubic modulo p. Sending a point P = (x, y) to 0 when x − θ is a square modulo p, and to
1 when it is not, defines a group homomorphism E(ℚ) → 𝔽₂. Several choices of (p, θ) combine
into one homomorphism E(ℚ) → 𝔽₂^k. Points whose images are linearly independent are themselves
independent, so the rank is at least ρ (minus a small 2-torsion correction). Independence of the
ρ image vectors comes down to inverting one matrix over 𝔽₂.
A certificate is that precomputed data: the points, the matrix and its inverse, and the torsion
bound. certify_curve rechecks it inside the Lean kernel, so nothing outside Lean's core is
trusted.
Layout
ECCompute/Theory/- the descent character and the rank-bound argument.ECCompute/Soundness/- theBool-valued checkers the kernel reduces (matrix inverse over𝔽₂, primality, 2-torsion, points on the curve).ECCompute/Kernel.lean- the raw kernel-reducibleBoolfolds the checkers run on.ECCompute/Certificate.lean,ECCompute/MainTheorem.lean,ECCompute/Tactic/- the certificate type, the assembled rank boundhasRankGE_of_certificate, and thecertify_curvetactic.ForMathlib/- lemmas destined upstream (2-torsion,padicValInt, rational denominators).data/- the points and labels each certificate reads.
The certified curves live in a separate Curves library, so building the core theory does not
recompile them:
Curves/- certified curves, named by their id on the ICARM Elliptic Curve Rank Leaderboard: high-rank curves spanning rank20to31(Nagao, Fermigier, Martin-McMillen, Elkies, Elkies-Klagsbrun, and curve302at rank31).
Building
The project uses a pinned mathlib. After cloning, fetch the cache once, then build the core theory:
lake exe cache get
lake build
lake build compiles the theory and the certify_curve tactic. The certified curves are their own
library; build them with
lake build Curves
Acknowledgements
The descent method is Section 2 of J. E. Cremona, On the computation of Mordell-Weil and 2-Selmer groups of elliptic curves, filter.pdf.
Much of this work was done at the Lean for the LMFDB workshop, funded by Scalable Theorem Proving via Mathematical Databases through the AI for Math Fund (Renaissance Philanthropy, founding donor XTX Markets).