Birth of Math Engineering: Refactoring a 300,000-Line Proof of the Riemann Hypothesis Without Knowing Lean
On November 20, 2026, Levent Alpöge and Claude released a Lean 4 proof of the Riemann Hypothesis: roughly 17 million lines of code across more than 175,000 files. Within a day, the Lean FRO and Mathlib Initiative verified that the exported proof passed independent checkers (Lean's kernel and nanoda ) against Mathlib's vetted statement of the hypothesis, relying only on Lean's three standard…
On November 20, 2026, Levent Alpöge and Claude unveiled a Lean 4 proof of the Riemann Hypothesis, totaling approximately 17 million lines of code spread across more than 175,000 files. Within 24 hours, the Lean FRO and Mathlib Initiative confirmed that the exported proof passed independent checks using Lean's kernel and nanoda, aligning with Mathlib's verified statement of the hypothesis, relying solely on Lean's three core axioms (propext, Classical.choice, and Quot.sound) and containing no "sorry" placeholders.
A few days later, the community repository (leanprover-community/riemann-hypothesis) was streamlined to around 300,000 lines across 800+ files, with a compact version of approximately 76,000 lines verified. Over the past week, I oversaw the merging of over 20 refactoring pull requests into that repository, focusing on three key changes: #9695: refactor(Weil) by constructing four complete Witt splittings from dual frames (30 net lines removed), #9452: refactor(OneLift) by summing linear maps in the gluing construction (20 net lines removed), and #9445: refactor(Seesaw) by inferring measurability in the Bessel cutoff argument (20 net lines removed).
I lack knowledge of Lean and the specific mathematical concepts involved, merely employing standard software engineering practices. I utilized two existing maintenance tools, dry-lint (a code duplication linter for Python, TypeScript, and Lua) and CI-esta (a CI profiler and build-acceleration toolkit), and enlisted the assistance of coding agents Claude and Codex to add Lean support.
The linter identified duplicated declarations and proof blocks, while the agents refactored the Lean code to eliminate lines and reuse abstractions; the Lean kernel and CI verified that each modification maintained the theorem's integrity. My primary responsibility was managing the token budget, verifying tool outputs, and encouraging the agents to generalize the tooling for more extensive simplifications.
This account serves as a technical analysis of our approach, the measurements taken on a 300,000-line formal proof, and the challenges encountered. A subsequent piece will delve into the broader theory of mathematical engineering and the implications for AI in mathematics.
Rewritten by urgent.news; may contain errors — check the original.
Source: dev.to