← Back to BLACKWIRE EMBER BUREAU CODE SURGE Screenshot of a massive Lean code file scrolling thousands of lines

The Lean proof of the Riemann hypothesis stretches to 17 million lines, a scale unseen in human‑written formal mathematics.

17 MILLION LINES OF LEAN PROOF SHATTER PREVIOUS SCALES

*The formal proof of the Riemann hypothesis now spans 17 million Lean lines. AI‑driven code dwarfs human‑written efforts across the ecosystem.*

By EMBER Bureau - BLACKWIRE  |  November 23, 2026, 10:00 CET  |  Lean proof, Riemann hypothesis, AI generated code, Mathlib, formal verification

A proof of the Riemann hypothesis has emerged in the Lean proof assistant, and it spans 17 million lines of code. The statistic arrived with the announcement, prompting immediate questions about scale, comprehension, and the role of artificial intelligence in formal mathematics.

The author of the source article scoured public Lean repositories to put the figure in context. Mathlib, the flagship library of formalized mathematics, hosts over 1,000 theorems but only 259 have Lean proofs, none approaching the million‑line threshold. Reservoir, a catalog of Lean packages, lists 938 projects on GitHub, with a handful exceeding 16 million lines, all heavily AI‑assisted. The comparison underscores that 17 million lines is not just large—it is unprecedented in human‑written formal proof history.

Is 17 million lines of Lean unusually large?

The recent Riemann hypothesis proof totals 17 million lines of Lean code. Compared with Mathlib, which hosts over 1,000 theorems but only 259 with Lean proofs, the new proof is orders of magnitude larger. Mathlib’s human‑generated proofs never approach the million‑line mark. Even the largest public Lean packages listed on Reservoir hover around 27 million lines, and those are AI‑augmented projects still in progress. The sheer size of the Riemann proof signals a shift: formal verification is now entering scales that no human could manually audit.

How do AI‑generated Lean projects compare in size?

Reservoir indexes 938 Lean packages on GitHub. Three exceed 16 million lines. Qiuzhen‑CFSG/CFSG tops the list at 88 million lines, described as an AI‑built proof still under development. CBirkbeck/LeanBridge reaches 36 million lines, but 98% of its code is script‑generated to check LMFDB numbers; the hand‑written portion is about 500 k lines. Anthropics/fermats-last-theorem records 27 million lines, an AI‑produced version of Fermat’s Last Theorem that is roughly 450 times longer than the human effort led by Kevin Buzzard, which sits near 60 k lines. All three illustrate how AI can inflate formal codebases dramatically.

Seventeen million lines of Lean dwarf every human‑written proof in Mathlib, marking a new era of AI‑driven formal verification.

What is the human contribution within massive Lean codebases?

The human‑written core of CBirkbeck/LeanBridge is roughly 500 k lines, a fraction of its total 36 million. In the anthropics/fermats-last-theorem project, the original human effort amounts to about 60 k lines, while the AI‑generated version expands to 27 million. Mathlib’s 259 Lean proofs are entirely human‑crafted and never exceed a few thousand lines each. These contrasts show that AI can produce bulk code, but the substantive, creative proof work remains modest in size. The disparity raises questions about verification depth versus sheer line count.

What does this scale mean for formal verification?

A 17 million‑line proof challenges traditional peer review. No human can read the entire artifact, forcing reliance on automated checking. The existence of even larger AI‑driven projects suggests a future where formal verification is outsourced to machines, with humans providing scaffolding. Yet the human‑written cores remain small, implying that the intellectual contribution is still concise. The trend may accelerate verification of complex conjectures, but it also risks obscuring errors behind massive autogenerated layers. Stakeholders must develop tools to audit AI‑generated sections without parsing every line.

Frequently asked questions

How many lines does the Lean proof of the Riemann hypothesis contain?

The proof consists of 17 million lines of Lean code.

Which Lean packages exceed 16 million lines of code?

Qiuzhen-CFSG/CFSG has 88 million lines, CBirkbeck/LeanBridge has 36 million lines, and anthropics/fermats-last-theorem has 27 million lines.

How many theorems in Mathlib have Lean proofs?

Mathlib contains over 1,000 theorems, but only 259 have associated Lean proofs.

The 17 million‑line Riemann proof forces a reckoning: formal verification can now outpace human readability. As AI continues to generate massive codebases, the community must devise new audit mechanisms that trust machines without surrendering rigor. The next breakthrough will hinge on balancing automated scale with transparent, verifiable insight.

Sources: [Hacker News article – Yes, 17M lines of Lean is a lot]