TL;DR
Within a single week in November 2026, an AI-coauthored formal proof of the Riemann Hypothesis shrank from a monstrous 17.4 million lines of Lean 4 code down to 478,591 lines—just 2.8% of its original size. Was this massive diet achieved by trimming dead weight, or by throwing out the draft and starting fresh? By tracing individual mathematical statements across three versions of the repository, the authors reveal that simply deleting unused code would barely have made a dent; the condensed proof is an almost complete, ground-up rewrite.
What Problem Does This Paper Address?
On November 20, 2026, Levent Alpöge and Claude (an AI system) released a Lean 4 formalization—machine-checked mathematical code—proving the Riemann Hypothesis. At 175,187 files and 17.4 million lines, it was verified by the Lean kernel, yet far too colossal for any human mathematician to read from cover to cover.
Almost immediately, two things happened. Hundreds of GitHub volunteers began consolidating files and deleting dead code (creating Version 2). Days later, a new, vastly shorter edition produced in collaboration with Anthropic and Claude became the community’s main branch (Version 3), clocking in at just 0.48 million lines.
For anyone trying to audit, teach, or maintain giant AI-generated proofs, how that 97.2% reduction happened matters enormously. If Version 3 was merely pruned (cutting unused lemmas while keeping the rest intact), auditors can trace definitions straight back to the original release. If it was rewritten, it is an entirely new mathematical text that must be understood on its own. Aggregate line counts can’t tell the difference, so the authors stepped in to trace every declaration across all three editions.
Methods
Drawing on "Eduinformatics"—an approach that emphasizes analyzing exhaustive primary records rather than misleading high-level summaries—the authors tracked individual declarations (theorems, lemmas, and definitions) across the versions:
- Filtering for "Real" Declarations: Compiling Lean code generates thousands of behind-the-scenes helper constants. Building on a rule from their earlier work, the authors read compiled
.oleanindex files for Versions 2 and 3, folding compiler-generated auxiliaries back into their parent declarations so only human-level, "real" declarations were counted. (Because Version 1 was too massive to compile in time, its declarations were parsed directly from source text.) - Clone-Style Text Matching: Declarations were matched across versions by comparing their names and normalized statement text (stripping formatting, attributes, and whitespace). Matches were ranked from strict counterparts (identical full names or matching statements of 40+ characters) down to loose, name-only hints.
- Dependency Graph Slicing: To find the theoretical limit of deletion alone, the authors built a declaration-level dependency graph (over 16 million edges for Version 2) and ran a breadth-first search starting from the five main Riemann Hypothesis theorems. Everything reachable on that graph forms the minimum possible core that simple deletion could never shrink further.
Datasets
Rather than ML training benchmarks, the dataset consists of three public Git snapshots of the Lean 4 Riemann Hypothesis formalization:
- Version (1) (
40e56bab02): The original Nov 20, 2026 release (175,187 files; 17,374,215 lines; 1,057,984 source-parsed declarations). - Version (2) (
e497a66): The volunteer-consolidated branch onrohanarun/riemann-hypothesisfrom Nov 25 (47,885 modules; 14,583,569 lines; 871,784 compiled real declarations). - Version (3) (
3b68810): The condensedmainbranch onleanprover-community/riemann-hypothesisfrom Nov 26, based onlsernau/grh-lean(802 files; 478,591 lines; 26,019 compiled real declarations).
Key Insights and Ideas
- Two completely different species of editing: Moving from Version 1 to Version 2 was true consolidation—files were merged and dead parts cut, while keeping declaration names intact. Moving from Version 2 to Version 3 threw out almost the entire vocabulary of the proof and wrote a new one.
- Dead-code pruning hits a brick wall: You might guess a 17-million-line AI proof is 95% hallucinated fluff sitting on the sidelines. Not so. Nearly 95% of Version 2's declarations are actively wired into the dependency tree of the final theorems. You cannot tidy a sprawling AI proof into a compact one just by deleting unreachable code.
- Fewer steps, not shorter steps: Surprisingly, individual declarations didn't get more concise in Version 3—their average length stayed virtually identical (~13.5 lines), as did their rate of calling external
Mathlibconstants. The proof shrank because it used 33.5 times fewer declarations, not denser ones. - Architectural untangling: Version 2 was a giant knot where all seven top-level namespaces depended cyclically on each other. Version 3 cleanly separated a general background library (
Lib) from the proof-specific layer (New), with zero backward dependencies from the library to the proof.
Key Results
- Near-zero survival in Version 3: While 92.3% of Version 2’s real declarations carried over strictly from Version 1, only 47 out of 26,018 declarations in Version 3’s dependency graph (0.18%) strictly match Version 2—and 9 of those are the fixed challenge statements required by the task.
- Even workhorse lemmas were abandoned: Dropped declarations weren't just unused leftovers; their usage profile mirrored the whole codebase. Even among Version 2's 5,507 most heavily reused declarations (each called by $\ge$100 other modules), only 17 (0.31%) survived into Version 3.
- The hard floor of pruning: In Version 2, 826,654 of 871,784 real declarations (94.8%) are reachable from the five main theorems, taking up 10.43 million of its 10.74 million declaration lines (97.2%). Deleting every unreachable declaration would cut just 2.83% of declaration lines. Version 3 sits at 278,198 declaration lines—meaning 10.15 million lines of reduction had to come from rewriting.
- Unreachable $\neq$ Deletable: When the authors tested deleting 114 "unused" (unreachable) declarations in Version 3, 111 broke the build—often because Lean tactics like
simporrwused them in source code before unfolding them away in the compiled output.
Limitations and Future Work
- Textual match $\neq$ mathematical identity: Comparing normalized syntax only catches copied declarations. If the same mathematical lemma was restated under a new namespace with reordered arguments or new types, textual matching misses it. (A manual check of 40 loosely matched names found only 5% stated the exact same result.)
- Uncompiled Version 1 & moving targets: Version 1 was source-parsed rather than compiled due to build-time constraints, and Version 3 is an actively evolving repository (over 1,000 pull requests were open the day after the snapshot).
- Process remains a black box: The data reveals what changed between versions, not how humans and Claude divided the labor or why the new proof needed so many fewer declarations. Future work is not explicitly proposed by the authors.
Summary updated