Riemann hypothesis Lean proof cut from 17 million lines to 76,000: what grh-lean changes
A rewrite of the Claude-assisted Lean proof of the Riemann hypothesis, written by Claude with Anthropic staff, cuts it from about 17.4 million lines to 300,000 in a readable edition and 76,000 in a compact one. Both are machine-checked; no human has read them through.
The Lean proof of the Riemann hypothesis that Levent Alpöge released with Claude on November 20 ran to about 17.4 million lines in 175,187 files. This week, Luke Sernau published lsernau/grh-lean, a rewrite of the same proof in two editions: a readable one of about 300,000 lines and a compact one of about 76,000 lines. Both prove the same five theorems, including Mathlib's RiemannHypothesis, using only Lean's three standard axioms.
Sernau says the shorter version was produced with his colleagues at Anthropic and Claude, and both READMEs state that the Lean text and the documents were written by Claude. Here is what changed, what has and has not been checked, how to build it yourself, and what is still missing.
Quick facts
- Repository: lsernau/grh-lean on GitHub, Apache 2.0 license (Copyright 2026 Anthropic, PBC).
- Editions: grh/ (readable, about 300,000 lines of code in 801 files) and grh-compact/ (about 76,000 lines of code in 792 files). Each is its own Lake project.
- Theorems: riemannHypothesis, plus four statements covering zeros of the zeta function and of Dirichlet L-functions for all moduli and characters. The README notes the last three say nothing about zeros with real part at most 0.
- Axioms: propext, Classical.choice and Quot.sound only.
- Toolchain: Lean v4.35.0 and Mathlib at commit 56a00585. The original archive used Lean v4.33.1.
- Status: machine-checked only. The README says no mathematician has read it through and no paper comes with it.
How much smaller is it?
The compact edition is about 0.44% of the original line count, so roughly 229 times smaller (a 99.56% cut). The readable edition is about 1.7% of the original, roughly 58 times smaller. The file count fell from 175,187 to 792. These ratios are our arithmetic from the line and file counts in the two READMEs and the mirror of the original archive.
| Version | Lines of code | Files | What was checked |
|---|---|---|---|
| Alpöge and Claude, original (Nov 20) | about 17.4 million | 175,187 | Certified by the Lean and Mathlib communities |
| rh-trim, dead-code removal (community) | 15.95 million (cut of about 8%) | 172,500 | Never built with 0 errors; best round had 17 |
| grh-lean, readable edition | about 300,000 | 801 | Builds, no sorry; Comparator; nanoda, con-leche, con-ron accept the export |
| grh-lean, compact edition | about 76,000 | 792 | Builds, no sorry; kernel replay of each module; Comparator |
For scale, Kevin Buzzard wrote that OpenAI's Lean formalization of its Navier-Stokes result is about 640,000 lines and compiles on his laptop, while Anthropic's Fermat's Last Theorem formalization was about 13 million lines. The compact Riemann proof is about one eighth the size of the Navier-Stokes one.
How did they shrink it?
Mostly by rewriting, not by deleting. The READMEs say the rewrite follows the original proof's method, but many steps are proved by other arguments, and background material was ported from the original and then rewritten. The compact edition goes further and uses other arguments in some steps than the readable one.
Mechanical cleanup alone did not get far. The community project keithadler/rh-trim found that the final argument is only about 6.6% of the original proof, with the rest building the tools it needs, much of it established mathematics missing from Mathlib. Removing code the final theorem does not reference cut about 8% of the lines, but that trimmed version never compiled without errors.
Sernau has said little about method. In the Lean community chat, as relayed on Hacker News, he said he unrolled definitions into a long, flat proof, looked for simplifications there, and rolled them back up, which let him simplify across module boundaries, and that some parts needed entirely new arguments, such as removing the dependence on Vandiver. Neither the READMEs nor Sernau's comments say which Claude model was used, how long it took, or how many people worked on it.
What has been checked, and what has not
Every file in both editions compiles against the pinned Lean and Mathlib without errors or sorry, and all five theorems depend only on the three standard axioms. Both editions were also run through Comparator v4.35.0, Lean's tool for checking that a proof matches a fixed statement; the READMEs say it needs about 64 GB of memory and a few hours. For the readable edition, an export of the five theorems with everything they depend on was accepted by three independent checkers: nanoda, con-leche and con-ron. For the compact edition, the README says each module was replayed through Lean's kernel. The compact edition's Comparator configuration also enables the nanoda kernel.
What the checks do not show: that a human understands the argument. The READMEs say the checks only show that Lean accepts the proof of the stated theorems, and that no mathematician has read it through. As of November 26 we found no community statement on the new editions; the November 21 statement covered the original archive.
How to build it yourself
You need Lean v4.35.0 (set in each folder's lean-toolchain file) and about 24 GB of memory; the README times a build on a 12-core machine. In either the grh or grh-compact folder, run these three commands:
lake exe cache get
lake build
lake env lean scripts/PrintAxioms.leanThe README says a build takes one to two hours on 12 cores, or about 85 minutes longer if the Mathlib cache is missing, and prints some linter and deprecation warnings. The axiom script's first result should read: 'riemannHypothesis' depends on axioms: [propext, Classical.choice, Quot.sound]. To check that the theorems say what they should, read src/Statements.lean, which imports only Mathlib, and the five statements in src/Main.lean. For reading the proof itself, the readable edition's GUIDE.md gives a reading order and a glossary.
Try it with your AI. Paste this into Claude Code or another coding agent to build and audit grh-lean on your own machine. Run it in a container or VM.
I want to check the Lean proof in the GitHub repository lsernau/grh-lean myself. Work
inside [path to an empty folder in a container or VM]. Do not install anything except
the Lean toolchain manager elan from its official source (github.com/leanprover/elan) if
it is missing, and ask me before running its installer; lake will download the Lean
toolchain and Mathlib, which is expected. If git is missing, stop and tell me. Also do
not read or touch credential files, and do not delete anything outside this folder. Show
me each command before you run it.
First check: my CPU core count and free memory. The README asks for about 24 GB of
memory and times a build at one to two hours on 12 cores. If I have less than about 24
GB free, tell me and stop; if I have fewer cores, just warn me it will take longer. Do
not run anything as root or with sudo.
Then:
1. Clone the repository and pick the [grh-compact or grh] folder. Confirm that
lean-toolchain says v4.35.0 and that lake-manifest.json pins Mathlib at commit
56a005855ea17e0b0958f73ec801ae140b0a1679.
2. Run: lake exe cache get, then lake build. Report the time taken and any errors
(warnings are expected).
3. Run: lake env lean scripts/PrintAxioms.lean and show me the five results. Flag any
axiom other than propext, Classical.choice and Quot.sound.
4. Show me src/Statements.lean and the five theorem statements in src/Main.lean, and
confirm Statements.lean imports only Mathlib.
5. Search src for sorry, admit and axiom declarations, and list any you find, separating
real uses from matches inside comments or docstrings (Challenge.lean, outside src,
contains sorry on purpose).
Summarize what these checks prove and what they do not.Known limits
- No human-readable paper. The README says none comes with it, and no mathematician has read the proof through.
- Research artifact: the repository says it is not maintained and does not accept contributions.
- The compact edition is written to be short, not easy to read; the README says so. Use the readable edition to follow the argument.
- The method is mostly undisclosed. Sernau said he is not able to say much about it.
- Hardware: building needs about 24 GB of memory; running Comparator needs about 64 GB.
FAQ
Did Claude solve the Riemann hypothesis? Levent Alpöge says he found the proof working with Claude, and the Lean and Mathlib communities certified the original Lean proof on November 21. The new grh-lean editions are shorter rewrites of that proof, written by Claude with Anthropic staff. All of this is machine-checked, but there is still no human-readable paper.
Is grh-lean a new proof? No. The READMEs say it follows the original proof's method, though many individual steps are proved by other arguments.
Can I build it on a laptop? Only if it has enough memory. The README asks for about 24 GB and quotes one to two hours on 12 cores with the Mathlib cache.
Why does the size matter? At 17 million lines, compiling the original took heavy hardware and no one could read it end to end. A 76,000-line version compiles on a strong workstation, and a 300,000-line version with a reading guide gives mathematicians something they can start to read.
Which axioms does the grh-lean proof use? Only Lean's three standard axioms: propext, Classical.choice and Quot.sound. Running scripts/PrintAxioms.lean lists them for each of the five theorems.
Related on claudefox
- Masullo's Riemann hypothesis proof: what AI reviewers and a Lean formalization have found
- Riemann hypothesis proof certified: Lean and Mathlib communities confirm Alpöge's Claude-assisted proof
- Did Claude solve the Riemann hypothesis? What Levent Alpöge's Lean proof shows so far
- Claude's VP ≠ VNP proof: what Anthropic posted, what Lean checks, and why it is not P ≠ NP
Source: GitHub: lsernau/grh-lean (README), grh-lean readable edition README, grh-lean compact edition README, grh-lean reading guide (GUIDE.md), GitHub: keithadler/rh-trim, GitHub: CocoSgt/riemann-hypothesis-lean (mirror of the original Lean archive), Lean community blog: Lean verification of the Riemann Hypothesis, Andrew Sutherland (MIT): verification files for the original Lean proof, Xena Project (Kevin Buzzard): ...and the proof is checked in Lean, Levent Alpöge: announcement note (remark.pdf), Hacker News discussion, relaying Luke Sernau's Lean Zulip comments
This story first appeared in the claudefox daily briefing for November 26, 2026.