Claude-assisted rewrite of Riemann proof fits in 76,000 lines of Lean code
Edited and reviewed by AI Ping Editorial Team
Key points
- The new Lean editions of the Riemann hypothesis proof contain about 300,000 and 76,000 lines of code.
- Both editions target five theorems on the zeros of the zeta function and Dirichlet L-functions.
- Including comments and blank lines, the compact edition’s Lean files contain 112,854 lines.
On November 25, Luke Sernau released two shorter editions of the Riemann hypothesis proof that he produced with colleagues at Anthropic and with Claude. The edition designed for reading has about 300,000 lines of code. Its compact counterpart has about 76,000. Both use Lean, a language in which a computer can check a mathematical proof.
The starting point was the roughly 17 million lines Levent Alpöge released on November 20. A day later, the Lean FRO and the Mathlib Initiative certified that the original proof established the precise statement of the Riemann hypothesis in the Mathlib library. The rewrite follows Alpöge’s method, with new arguments for many intermediate steps. The researchers credit Claude with writing the new Lean code and accompanying documentation. The two editions still prove the same five final theorems.
The prime number theorem describes how frequently primes occur on average. How far their distribution strays from that average is tied to the Riemann zeta function. A zero is an input at which a function takes the value zero. The Riemann hypothesis puts every nontrivial zero of the zeta function on one vertical line in the complex plane, where the real part is one half.
The first two of the five theorems express the Riemann hypothesis by its Mathlib name and explicitly in terms of zeros. The other three concern Dirichlet L-functions. They rule out zeros to the right of the central line, with an exception for the pole, place zeros in the strip between real parts zero and one on the line, and state the special case for primitive Dirichlet characters.
What the line counts include
Counting every line in the released files gives a different figure from the authors’ code estimates. AI Ping counted all files with the .lean extension in the November 25 archive. The longer edition had 477,151 lines across 805 files and the compact one had 112,854 across 796. That count includes blank lines and comments intended for people.
The largest part of the compact edition by file count is background mathematics. Its authors classify 573 files as results known from the literature, with proofs that Mathlib does not supply. Another 219 files set up and develop the argument itself. The background library can be read independently of that development.
The reading guide traces the route back to prime distribution. Three intermediate theorems feed into a central inequality. The next step limits how large an error in a weighted sum over primes can grow in one direction. From that bound the argument reaches the result about zeros. The guide points to the file that spells out the inputs to the inequality and shows which terms cancel.
For readers building either project, the researchers give an estimate of one to two hours on 12 processor cores with 24 GB of memory. Both editions pin the same Lean and Mathlib versions. In the archive, the files defining the target propositions and the challenge files matched byte for byte across the two editions. The files connecting those targets to their proofs differed.
What the checkers compared
One of the tools, Lean’s Comparator, checks the conclusion of a submitted proof against a separately specified target. It also checks whether the proof depends only on the permitted axioms, the assumptions taken as given. Matching target files establishes what the two editions set out to prove. Checking each proof against that target addresses whether it gets there.
The researchers report that the compact edition’s sources compiled and were replayed through Lean’s kernel, the part that checks the proof. They also report successful Comparator checks on both editions. For the longer edition they exported the five theorems together with everything those theorems depend on. According to the researchers, three independently implemented checkers accepted that export.
When Alpöge announced the original proof, he described understanding the argument better and explaining it in writing as work still ahead. Sernau says the new editions have undergone machine checks and still await a complete reading by a mathematician. The readable edition now has a contents list with a title for each file, plus an index that links results with source files and related work. A reader investigating one step, such as the central inequality, can locate the code for it and trace its references.
Sources
- GRH for Dirichlet L-functions in Lean 4 · two editions — Luke Sernau
- Compact edition · layout and kernel checks — 연구진 · compact edition
- Readable edition · source index and proof export checks — 연구진 · readable edition
- Source tree used for the independent line count and file comparison — 공개 연구 아카이브
- Main.lean · five theorem declarations — 연구진 · Lean 소스
- Riemann Hypothesis · prime distribution and zeta zeros — Clay Mathematics Institute
- Lean verification of the Riemann Hypothesis · November 21 — Lean FRO / Mathlib Initiative
- Reading guide · from the main inequality to the zeros — 연구진 · reading guide
- Comparator · checking a proof against a specified theorem — Lean
- Author’s remarks on the original proof — Levent Alpöge
