grh-lean: a different Lean proof of the Riemann hypothesis, in 300,000 lines of code instead of 15.5 million

On 20 November 2026 Levent Alpöge published a machine-checked proof of the Riemann hypothesis and GRH for Dirichlet L-functions, generated with Claude: 15.5 million lines of Lean code. On 25 November grh-lean proved the same five theorems in 300,000 lines of code. The evidence points to a substantially different proof rather than a trimmed copy. How it was produced has not been disclosed. All counts on this page are lines of code, excluding comments and blank lines.

Original proof
15.5M
lines of code · 175,187 files
Original, live code only
9.2-10.2M
what remains after removing boilerplate, dead code and placeholders
grh-lean, readable edition
300k
lines of code · 52× smaller
grh-lean, compact edition
76k
essentially the same argument, compressed for size, not for reading

A different proof, not a pruned one

About 5.4-6.4 million lines of the original are overhead: file boilerplate, dead code, and code used only through placeholder objects. Removing all of it leaves 9.2-10.2 million lines of code the proof actually uses. Getting from there to 300,000, roughly 31-34× smaller, required replacing the core of the argument.

Lines of code

Live code is measured on the original's full kernel export (1,468,418 declarations), walked from the five theorems. The range comes from names that could not be matched with certainty.

Lines of code in the original Abelian-variety branch Everything else Total
File boilerplate (imports, namespaces, options) 1.34M 0.94M 2.29M
Dead code (never used by the five theorems) 0.99-1.55M 0.94-1.38M 1.94-2.93M
Used only through placeholder objects ≥ 0.60M ≥ 0.57M ≥ 1.17M
Live code, used by the proof 3.86-4.41M 5.31-5.75M 9.17-10.16M
Total 7.34M 8.20M 15.53M

The first three rows could be removed without new mathematics; for the third, that assumes the placeholders do no real work. Boilerplate is mostly an artifact of splitting the original into 175,187 small files; the readable edition has 803. The live code could not be removed, only rewritten or replaced. Categories come from separate measurements and agree with the totals to within 0.2%.

  • The core changedNo Ferrero-Washington and no dependence on Vandiver's conjecture. The abelian-variety branch, 7.3M lines of code and 47% of the original, is almost entirely gone. Abelian varieties still appear, as abelian schemes within the Shimura-variety background: 24,422 lines in the readable edition, of which 1,409 are basic abelian-scheme theory.
  • Lemmas were rewritten, not carried overOnly 8-14% of declaration names occur in the original, and even matching names can state different theorems.
  • What stayedThe five theorem statements (byte-identical) and the top-level strategy. The authors say the rewrite "follows that proof's method; many steps are proved by other arguments".
  • Placeholder objects are goneThe original contains placeholder definitions that are trivially True or zero (geoDegenerate, anyGeometry). These are the objects J. L. Nielsen's critique of the original refers to. Neither grh-lean edition contains them, and a scan of both found no definitions of that kind.
  • OpenWhether the new route was found by learning from the original, by avoiding its weak points, or independently is not stated.

300,000 lines of code is the number that matters

The readable edition is the version a person could work through. It has 299,902 lines of code; its 138,466 comment lines and 38,756 blank lines come on top, for 477,124 lines in total. The compact edition is essentially the same argument compressed to 76,151 lines of code: inlined lemmas, heavy automation, 72-character lines. Some steps are proved differently. It is smaller, but harder to read. The original has no comments: its 17.4 million total lines are 15.5 million lines of code plus 1.8 million blank lines. No mathematician has read either edition through.

Measure Original Readable Compact
Lines of code 15,531,759 299,902 76,151
+ Comment lines 0 138,466 20,331
+ Blank lines 1,842,456 38,756 16,345
= Total lines 17,374,215 477,124 112,827
Declarations ~1,060,800 23,822 10,933
Files 175,187 803 794

The only extended human-readable account of grh-lean is a 1,356-page write-up of the compact edition generated by AI agents (Bartosz Naskręcki, in progress), not yet refereed by a human.

Harder to work with, according to the people cleaning it up

A maintainer of the community effort to clean up the Lean code reports three things about the new version. It needs a lot more compilation. It feels more "magic". And it relies on many more results from outside Mathlib, which also have to be checked. He preferred working on the original, ugly and verbose as it is. The code supports the second and third points directly; on compilation, the picture is mixed.

Maintainer's observation What the code shows
Much more compilation Both editions import all of Mathlib (import Mathlib) at their base, so every build needs the whole library compiled or downloaded. The original imported 344 specific Mathlib modules. The new proof also relies on automation that re-runs on every build. Measured end to end, however, it still builds much faster: 32-34 minutes on a 16-core machine, against about 21 hours reported for the original on unspecified hardware.
More "magic" Steps are found by automated search at build time instead of being written out. Per 1,000 lines of code, the compact edition uses grind 36 times and aesop 17 times; the original uses each less than once per 10,000 lines.
Many more results from outside Mathlib 59% of the readable edition (177,492 lines of code) is background theory built inside the project rather than taken from Mathlib. That includes class field theory, theta correspondences and Siegel-Weil, discrete series, Galois representations, p-adic Hodge theory and Shimura varieties. Its reference list compares 228 literature citations, with 66 places confirmed. All of it is proved in Lean, with no extra axioms. Whether each result matches the published theorem it cites is a separate question that the proof checkers do not answer.

What has not been disclosed

The repository is a single commit with a README. Nothing about how the proof was produced has been published.

Item Status What is known
Method, tooling, prompts Not disclosed One second-hand description: unroll into one flat proof, simplify across modules, rebuild.
Model versions Not disclosed "Claude".
Division of work, people vs Claude Not disclosed Claude wrote the Lean text; colleagues are unnamed.
Why the route changed Not disclosed README says "many steps are proved by other arguments".
Start date and time taken Not disclosed Published 5.2 days after the original's release.
Compute, tokens, cost Not disclosed No published estimate. For scale: reading the original once would take roughly 290M tokens.
Drafts and failed attempts Not disclosed Single commit; no history.
Cost of the original proof Not disclosed Third-party estimates range from $6k to $605k (the top figure includes labour).

Verified by machine, understood by no one

Andrew Sutherland (MIT) checked the original and both editions; Michael Rubinstein (Waterloo) checked the original and the compact edition. Every check passed. Each proof was built from source and re-checked by Lean's own kernel and several independently written proof checkers. Its statements were matched against a separate challenge file containing only the statements, and it uses only Lean's three standard axioms. These checks establish that the stated theorems are proved. They do not establish that anyone understands the proof.

Cost to check Original Readable Compact
Full end-to-end check 64-123 h 4 h 10 min 2 h 11 min
Memory needed ~100 GB > 128 GB ≤ 128 GB
Expanded proof checked 61.6 GB 4.49 GB 5.17 GB
Cloud cost of one full check* $984-$1,883 ~$64 ~$34

* At $15.34/h, AWS r8a.48xlarge on demand (192 cores, 1.5 TB), the machine used for the editions. The original's figure assumes the same machine; its check is single-threaded, so a smaller machine would cost less.

Authors

grh-lean Luke Sernau (Anthropic), "in collaboration with my colleagues at Anthropic, and Claude". Single commit, 25 Nov 2026. Lean text written by Claude.
Original proof Levent Alpöge (Anthropic), with Claude.
Independent checks Andrew Sutherland (MIT), Michael Rubinstein (Waterloo).