Verification files for the shorter Lean proof of RH and of GRH for Dirichlet L-functions

Source: github.com/lsernau/grh-lean, commit 72fead10, published 25 November 2026.

Andrew Sutherland (MIT), checks run with Claude Code. Page last updated 2026-11-27 17:27 UTC. All checks have finished.

This page concerns the shorter proof only. The checks of the original 17-million-line proof are recorded on a separate page.

Summary

The repository contains two Lean 4 projects, a “readable” edition (grh/, 803 files, 477,124 lines, of which 299,902 are code) and a “compact” edition (grh-compact/, 794 files, 112,827 lines, of which 76,149 are code). Here “code” means lines that are neither blank nor comment, and the counts cover the .lean files under src/. For comparison, the original proof is 175,187 files and 17,374,215 lines, of which 15,531,759 are code; it contains no comments. Each proves the same five theorems as the original proof: Mathlib's RiemannHypothesis and four statements about zeros of the Riemann zeta function and of Dirichlet L-functions. Both use Lean v4.35.0 and Mathlib at commit 56a00585.

Both editions compile without errors, and in both the five theorems depend only on the axioms propext, Classical.choice and Quot.sound. Every module of both editions has been replayed through the Lean kernel. Exports of the five theorems made independently on two machines are byte-identical, and nanoda, con-leche and con-ron accept them for both editions. The --compare modes of con-leche and con-ron each confirm all five theorems against the challenge file.

lake comparator --paranoid (Lean v4.35.0) reports “Your solution is okay!” for both editions. It builds the project in a sandbox, compares the five statements with the challenge file, checks the axioms, and then runs Lean's kernel and every external checker shipped with Lean: nanoda, lean4lean, con-leche, con-ron and the paranoid build of Lean's own checker. For the compact edition it passed independently on two machines. For the readable edition it passed on the larger machine; lean4lean needs 332 GB of memory for that edition, more than the smaller machine has, so the run there was stopped without a verdict (see the note below the table).

Schoenfeld’s explicit bound |ψ(x) − x| < √x log²x / (8π) for x ≥ 73.2, which is equivalent to the Riemann Hypothesis, has also been checked as a Lean theorem derived from the compact edition: lake comparator --paranoid reports “Your solution is okay!” both for the equivalence and for the bound itself (see below).

What was verified

All times are UTC. "Sandboxed" means the step ran with no network access and with only the project folder writable.

CheckReadable editionCompact edition
Sandboxed lake build of the whole project (machine A)pass
9,852 jobs, no errors; 32 min 12 s, finished 23:05:36 UTC on 25 November (log)
pass
9,843 jobs, no errors; 33 min 32 s, finished 23:06:56 UTC on 25 November (log)
#print axioms for the five theorems (the repository's scripts/PrintAxioms.lean)pass
each depends on propext, Classical.choice, Quot.sound only (log)
pass
each depends on propext, Classical.choice, Quot.sound only (log)
lake comparator --paranoid (Lean v4.35.0) on a fresh clone, machine B: build, statement comparison, axiom check, then in sequence nanoda, Lean paranoid kernel, lean4lean, nanoda again, con-leche, con-ron and Lean default kernelpass
build inside the judge's sandbox passed (9,850 jobs); statement comparison and axiom check pass; nanoda, Lean paranoid kernel, lean4lean, nanoda (second pass), con-leche, con-ron and Lean default kernel all accept; “Your solution is okay!”; exit 0 at 02:47:54 UTC on 26 November, 4 h 9 min 59 s after starting at 22:37:54 UTC on 25 November, of which about 2 h 40 min was lean4lean (see the note below) (log)
pass
build inside the judge's sandbox passed (9,841 jobs); statement comparison and axiom check pass; nanoda, Lean paranoid kernel, lean4lean, nanoda (second pass), con-leche, con-ron and Lean default kernel all accept; “Your solution is okay!”; exit 0 at 00:49:14 UTC on 26 November, 2 h 11 min 19 s after starting at 22:37:54 UTC on 25 November (log)
lake comparator --paranoid (Lean v4.35.0), machine A, independent second runnot completed: insufficient memory. lean4lean needs 332 GB for this edition (measured on machine B, row above) and machine A has 128 GB, so we stopped lean4lean partway through and this run has no verdict. Every other stage accepted. The line “lean4lean kernel rejected the solution” in the log reflects our stopping it, not a finding by lean4lean (guard log). See the note below.pass
statement comparison and axiom check pass; nanoda, Lean paranoid kernel, lean4lean, nanoda (second pass), con-leche, con-ron and Lean default kernel all accept; “Your solution is okay!”; exit 0 at 01:39:22 UTC on 26 November, 2 h 32 min 18 s after starting at 23:07:03 UTC on 25 November (log)
lake comparator without --paranoid (Lean v4.35.0), machine B: build, statement comparison, axiom check, nanoda and Lean default kernelpass
statement comparison and axiom check pass; nanoda accepts; Lean default kernel accepts; “Your solution is okay!”; exit 0 at 00:46:56 UTC on 26 November, after 39 min 3 s (log)
not run
Lean kernel replay of every module (leanchecker, one process per module), sandboxed, machine Apass
803 of 803 modules accepted; 12 min 0 s, finished 23:19:24 UTC on 25 November (results)
pass
794 of 794 modules accepted; 12 min 8 s, finished 23:19:32 UTC on 25 November (results)
Exports made by lake comparator on machines A and B, comparedpass
challenge and solution exports byte-identical on the two machines; solution 4,485,867,644 bytes, sha256 baf221c8…6fc1
pass
challenge and solution exports byte-identical on the two machines; solution 5,172,274,528 bytes, sha256 ab7b4223…115b
con-leche --compare (branch compare, 5dc36dc1): challenge export against solution export, machine Bpass
accepts: all five theorems “justified by the solution”; 216,571 solution and 52,173 challenge declarations accepted; exit 0 at 23:19:06 UTC on 25 November (log)
pass
accepts: all five theorems “justified by the solution”; 204,583 solution and 52,173 challenge declarations accepted; exit 0 at 23:19:01 UTC on 25 November (log)
con-ron --compare (master, 3f22699b): challenge export against solution export, machine Bpass
accepts: all five theorems “justified by the solution”; exit 0 at 23:19:16 UTC on 25 November (log)
pass
accepts: all five theorems “justified by the solution”; exit 0 at 23:19:19 UTC on 25 November (log)
con-leche bundled with Lean v4.35.0, on the solution export, machine Bpass
accepted 216,571 declarations (--verified); 1 min 16 s (log)
pass
accepted 204,583 declarations (--verified); 1 min 53 s (log)
con-ron bundled with Lean v4.35.0, on the solution export, machine Bpass
accepted 216,571 declarations (--verified); 1 min 9 s (log)
pass
accepted 204,583 declarations (--verified); 1 min 16 s (log)
lean4lean bundled with Lean v4.35.0, on the solution export, machine Bpass
checked 216,568 declarations; 2 h 35 min 5 s, exit 0 at 01:49:24 UTC on 26 November; peak memory 332 GB. Of that time, 2 h 12 min went on the one definition New.Variety.tiltTheory (log). See the note below.
pass
checked 204,580 declarations; 28 min 39 s, exit 0 at 23:42:58 UTC on 25 November (log)
Lean default kernel (leanchecker --from-export), on the solution export, machine Bpass
accepts; 29 min 29 s, exit 0 at 23:42:24 UTC on 25 November (log)
pass
accepts; 33 min 5 s, exit 0 at 23:46:00 UTC on 25 November (log)

Machine A is a 16-core AMD Ryzen AI Max+ 395 with 128 GB of memory; machine B is a 192-core AWS r8a.48xlarge with 1.5 TB. The two machines ran from separate clones of the same commit. lake comparator builds the project itself inside its own bwrap sandbox, so the runs on machine B are independent of the builds on machine A; the runs on machine A reuse the build in the first row.

The rows below the two lake comparator rows are separate runs of individual checkers on copies of the exports that lake comparator itself made on machine B (A = readable, B = compact in the scripts). They were run in parallel so that each result is available without waiting for the judge to reach that checker in its sequence. The lean4lean shipped with Lean v4.35.0 does not read this toolchain's compiled files (“incompatible header”), so lean4lean was run on the exports only, not module by module.

lean4lean on the readable edition. lean4lean accepts both editions, but at very different cost. On the compact edition it finished in 28 min 39 s using 7 GB of memory. On the readable edition it took 2 h 35 min and 332 GB, of which 2 h 12 min (7,917,635 ms by its own report) went on the single definition New.Variety.tiltTheory (src/Lib/PadicComparison/Primitive/PeriodCoefficients.lean, line 650); the compact edition defines tiltTheory differently. Lean's own kernel, in its default and paranoid builds, checks the whole readable export in about half an hour with under 8 GB. In practice this means lake comparator --paranoid on the readable edition needs a machine with well over 332 GB of memory and about four hours. Machine A has 128 GB, so the run there could not finish; we stopped lean4lean there at 00:48:16 UTC on 26 November, when it had reached 70 GB and was still growing, and that run has no verdict. The judge then ran its remaining stages, which all accepted, and ended at 01:34:10 UTC on 26 November with exit 1 and the message “lean4lean exited with 143”, the code for a process that was terminated.

Declaration counts. The readable export contains 216,571 declaration records and the compact export 204,583; these are the numbers con-leche and con-ron report. Four of those records are the constants of Lean's built-in quotient type (Quot, Quot.mk, Quot.lift, Quot.ind). lean4lean reports three fewer in each edition (216,568 and 204,580), which is what one gets if those four are counted as a single declaration; we have not confirmed this in lean4lean's source.

Export sizes. The compact edition has the shorter source but the larger export (5.17 GB against 4.49 GB). An export records fully elaborated proof terms, not source text. 165,163 declarations, from Mathlib and Lean's libraries, appear in both exports and account for about 1.75 GB in each. The remainder is 51,408 declarations and about 2.73 GB in the readable edition, against 39,420 declarations and about 3.42 GB in the compact edition: fewer declarations, but larger proof terms on average. These byte figures charge each term to the first declaration that uses it, so they are approximate (script).

An arithmetic consequence: Schoenfeld’s bound

Schoenfeld proved in 1976 that the Riemann Hypothesis implies an explicit bound for the Chebyshev function ψ: |ψ(x) − x| < √x log²x / (8π) for all x ≥ 73.2 (L. Schoenfeld, Sharper bounds for the Chebyshev functions θ(x) and ψ(x). II, Math. Comp. 30 (1976), 337–360, Theorem 10). The converse also holds. The repository github.com/AndrewVSutherland/schoenfeld-rh-lean proves the equivalence in Lean, on the same Lean and Mathlib versions as the shorter proof:

theorem schoenfeld_strict_bound_iff_riemannHypothesis :
    (∀ x : ℝ, 73.2 ≤ x → |Chebyshev.psi x - x| < Real.sqrt x * Real.log x ^ 2 / (8 * Real.pi)) ↔
      RiemannHypothesis

Combined with riemannHypothesis from the compact edition, it gives the bound itself as a Lean theorem whose statement uses Mathlib only:

theorem schoenfeld_strict_bound :
    ∀ x : ℝ, 73.2 ≤ x → |Chebyshev.psi x - x| < Real.sqrt x * Real.log x ^ 2 / (8 * Real.pi)
CheckResult
The equivalence: lake comparator --paranoid (Lean v4.35.0) on a fresh clone of schoenfeld-rh-lean at commit 0e52d7b1, machine Apass
“Your solution is okay!”, exit 0 at 17:23:34 UTC on 26 November, 6 min 19 s after the Mathlib cache was fetched. Lean paranoid kernel, lean4lean, nanoda, con-leche, con-ron and Lean default kernel all accept; 64,053 declarations (log, timeline)
The equivalence: #print axioms and source scanpass
depends on propext, Classical.choice, Quot.sound only; no axiom, native_decide, unsafe or #eval in the sources, and sorry only in Challenge.lean
The bound itself: lake comparator --paranoid (Lean v4.35.0) on the end-to-end project, machine A; compiles the compact edition and schoenfeld-rh-lean from sourcepass
“Your solution is okay!”, exit 0 at 19:51:20 UTC on 26 November, 2 h 26 min after the setup script finished. All 9,929 build jobs completed; Lean paranoid kernel, lean4lean, nanoda, con-leche, con-ron and Lean default kernel all accept; 206,292 declarations (log, timeline, setup log)

The end-to-end project is the small download schoenfeld-bound.tar.gz: a challenge file, a one-line solution, and a script that clones grh-lean at commit 72fead10 and schoenfeld-rh-lean at commit 0e52d7b1, both unmodified. The judge compiles both from source inside its sandbox.

About the Schoenfeld repository: it has 24 files of its own (3,335 lines, of which 2,720 are code), plus 62 modules (15,195 lines, of which 12,232 are code) taken unchanged from PrimeNumberTheoremAnd (Riemann's ξ function, its Hadamard factorization, the digamma series) and one file (365 lines, of which 277 are code) taken from rh-prime-error (the converse direction); all three are under the Apache 2.0 licence. It was written by AI agents and, like the proof above, has passed machine checks only. The repository proves an equivalence; the bound itself depends on the proof of the Riemann Hypothesis checked on this page.

The statements

The five theorems are stated in src/Statements.lean, which imports only Mathlib, and src/Main.lean. Statements.lean is byte-for-byte the same file in the two editions, and its four definitions are textually identical to those in the original proof's Statements.lean. The theorem names and the list of permitted axioms in comparator.json are also the same as in the original proof.

The Mathlib underneath is not the same: the original proof used Mathlib at commit 0df444a3 (21 August 2026) with Lean v4.33.1, and this one uses commit 56a00585 (13 October 2026) with Lean v4.35.0. We compared the two challenge exports, which contain everything the five statements depend on, declaration by declaration and up to renaming of bound variables (script). The four definitions in Statements.lean, the types of the five theorems, and Mathlib's riemannZeta, RiemannHypothesis, DirichletCharacter, DirichletCharacter.LFunction, ZMod.LFunction, HurwitzZeta.hurwitzZeta, mellin, Complex.Gamma, Real and Complex are the same terms in both. Lower down the two are not identical. Of the 50,232 declarations that appear under the same name in both exports, 39,482 are the same and 10,750 differ in some respect, ranging from reorganised definitions of basic algebraic classes to a renamed universe variable; 1,460 names occur only in the original's export and 1,941 only in this one. So the statements proved here are word for word those of the original proof and are built from the same top-level definitions, but they are statements about a later Mathlib, and we have not checked formally that the two versions are equivalent.

theorem riemannHypothesis : RiemannHypothesis
theorem riemannZeta_eq_zero_re : RiemannZetaZerosOnLine
theorem LFunction_ne_zero_of_half_lt_re : DirichletLNonvanishingRightOfHalf
theorem LFunction_eq_zero_re : DirichletLZerosOnLine
theorem LFunction_eq_zero_re_of_isPrimitive : PrimitiveDirichletLZerosOnLine

def RiemannZetaZerosOnLine : Prop :=
  ∀ s : ℂ, riemannZeta s = 0 → (¬∃ n : ℕ, s = -2 * ((n : ℂ) + 1)) → s ≠ 1 → s.re = 1 / 2

def DirichletLNonvanishingRightOfHalf : Prop :=
  ∀ (N : ℕ) [NeZero N] (χ : DirichletCharacter ℂ N) (s : ℂ),
    1 / 2 < s.re → (χ ≠ 1 ∨ s ≠ 1) → DirichletCharacter.LFunction χ s ≠ 0

def DirichletLZerosOnLine : Prop :=
  ∀ (N : ℕ) [NeZero N] (χ : DirichletCharacter ℂ N) (s : ℂ),
    0 < s.re → s.re < 1 → DirichletCharacter.LFunction χ s = 0 → s.re = 1 / 2

def PrimitiveDirichletLZerosOnLine : Prop :=
  ∀ (N : ℕ) [NeZero N] (χ : DirichletCharacter ℂ N), χ.IsPrimitive →
    ∀ s : ℂ, 0 < s.re → s.re < 1 → DirichletCharacter.LFunction χ s = 0 → s.re = 1 / 2

The kernels check elaborated terms, not source text. This file prints the five statements as Lean v4.35.0 elaborates them with pp.all, so that no notation, coercion or implicit argument is hidden (script); the output is identical in the two editions. For example, RiemannHypothesis elaborates to:

def RiemannHypothesis : Prop :=
∀ (s : Complex),
  @Eq.{1} Complex (riemannZeta s) (@OfNat.ofNat.{0} Complex (nat_lit 0) (@Zero.toOfNat0.{0} Complex Complex.instZero)) →
    Not
        (@Exists.{1} Nat fun (n : Nat) =>
          @Eq.{1} Complex s
            (@HMul.hMul.{0, 0, 0} Complex Complex Complex (@instHMul.{0} Complex Complex.instMul)
              (@Neg.neg.{0} Complex Complex.instNeg
                (@OfNat.ofNat.{0} Complex (nat_lit 2)
                  (@instOfNatAtLeastTwo.{0} Complex (nat_lit 2) Complex.instNatCast RiemannHypothesis._proof_1)))
              (@HAdd.hAdd.{0, 0, 0} Complex Complex Complex (@instHAdd.{0} Complex Complex.instAdd)
                (@Nat.cast.{0} Complex Complex.instNatCast n)
                (@OfNat.ofNat.{0} Complex (nat_lit 1) (@One.toOfNat1.{0} Complex Complex.instOne))))) →
      @Ne.{1} Complex s (@OfNat.ofNat.{0} Complex (nat_lit 1) (@One.toOfNat1.{0} Complex Complex.instOne)) →
        @Eq.{1} Real (Complex.re s)
          (@HDiv.hDiv.{0, 0, 0} Real Real Real (@instHDiv.{0} Real (@DivInvMonoid.toDiv.{0} Real Real.instDivInvMonoid))
            (@OfNat.ofNat.{0} Real (nat_lit 1) (@One.toOfNat1.{0} Real Real.instOne))
            (@OfNat.ofNat.{0} Real (nat_lit 2)
              (@instOfNatAtLeastTwo.{0} Real (nat_lit 2) Real.instNatCast RiemannHypothesis._proof_1)))

Source scan

Before building, both editions were searched for constructs that add assumptions, run code during compilation, or change how terms are checked. Neither contains any axiom declaration, native_decide, #eval, unsafe, opaque, implemented_by, extern, initialize, custom elab, macro or syntax, or any kernel-related option. The only uses of sorry are in Challenge.lean, where they stand in for the proofs to be compared. Every file imports only Mathlib or the project's own modules. This scan is a text search and is a precaution, not a proof; the axiom audit and the kernel checks above are what establish the result.

Downloads

Statements

Exports

Readable edition

Compact edition

Schoenfeld's bound

Scripts and source hashes

SHA-256 hashes of every file here are in SHA256SUMS.

Check it yourself

On Linux with elan and bubblewrap installed:

git clone https://github.com/lsernau/grh-lean && cd grh-lean
git checkout 72fead102f663d5c7a407964a13dc0cf9d977207
cd grh-compact            # or: cd grh
lake exe cache get
ulimit -s unlimited
PATH="$(dirname "$(elan which lean)"):$PATH" lake comparator --paranoid

The readable edition needs a very large machine for this command. With --paranoid, lean4lean on the readable edition (cd grh) used 332 GB of memory and the whole run took about four hours; on a machine with less memory it will run out. The compact edition peaked at about 7 GB in lean4lean and finished in about two and a half hours on a 16-core desktop. For the readable edition on an ordinary machine, drop --paranoid: plain lake comparator runs Lean's kernel and nanoda only, and took 39 minutes on machine B.

Two practical points. lake comparator looks for the bundled checkers on the PATH, which is why the toolchain's bin folder is added above; without it the command stops at once with "nanoda kernel nanoda_bin was not found". On a machine with very many cores, lake exe cache get may need a higher open-file limit (ulimit -n 65536).

Provenance

Caveats