RH · checked in Lean

For engineers and developers: how the proof is checked

The proof is software, and checking it is a software-assurance problem. This page treats it that way: the codebase, the trusted computing base, and how to reproduce the checks.

TL;DR

  • The proof is about 17 million lines of Lean 4 (175,187 modules) that depend only on Mathlib.
  • It was checked by Lean's kernel and by several independent kernels; the five main theorems use only Lean's three standard axioms.
  • A separate challenge file, written using only Mathlib, confirms the theorems state exactly the Riemann Hypothesis and GRH for Dirichlet L-functions.
  • You can reproduce the fastest checks yourself; the steps are below.

The codebase

ItemValue
Distributionlean.tar.gz in 14 archive parts from alpo.ge (listed in footnote 1 of remark.pdf); 239,275,554 bytes; sha256 9631b4f0…49c7fc. Mirror: Deicyde/riemann-hypothesis
SizeAbout 17 million lines (community statement); 175,187 Lean modules (MIT)
Toolchainleanprover/lean4:v4.33.1; Mathlib pinned to commit 0df444a3 (tag v4.33.1). This is the proof's own toolchain. Some checking tools below (the full lake comparator run and the bundled checkers) were run with Lean v4.36.0; that is a different, later toolchain for the tools, not a different version of the proof.
DependenciesMathlib only. "The codebase depends directly only on Mathlib." (community statement)
Libraries (lakefile)BuildAid, CompanionTheory, Development, Formalism, GroundTheory, GroundTheoryFields, Lemmata, PositivityTheory, ReciprocityTheory, Supplements, Main
OptionsautoImplicit = false, maxHeartbeats = 4000000 (20× the default), --tstack=400000

The entry point: Main.lean

import Statements
import Supplements.Kernels.MainTheoremsAll

theorem riemannHypothesis : RiemannHypothesis := rhOfAll
theorem riemannZeta_eq_zero_re : RiemannZetaZerosOnLine := rhOfAll
theorem LFunction_ne_zero_of_half_lt_re : DirichletLNonvanishingRightOfHalf := allChi
theorem LFunction_eq_zero_re : DirichletLZerosOnLine := claimAll.2.1
theorem LFunction_eq_zero_re_of_isPrimitive : PrimitiveDirichletLZerosOnLine := critAll

RiemannHypothesis is Mathlib's definition (Mathlib/NumberTheory/LSeries/RiemannZeta.lean). The other four types are defined in the project's Statements.lean, so a reviewer can't trust them as written. That is why the community wrote a separate challenge file that restates all five theorems using only Mathlib, and compared the two mechanically.

The trust model in one diagram

  1. Elaborator (large, untrusted): turns source code and tactics into proof terms. Bugs here can't create false proofs, because its output is re-checked.
  2. Export: lean4export writes every declaration as plain data (NDJSON). The solution export is 61.6 GB unpacked. It is "inert": no project code runs when it is checked.
  3. Kernels (small, trusted): type-check every declaration in the export against the rules of Lean's type theory. Several independent implementations were used.
  4. Comparator: confirms that the theorem names in the solution have exactly the types in the challenge file, and that only allowed axioms are used.

The checks that were run

From Andrew Sutherland's verification page at MIT (as of its update at 04:35 UTC on 22 Nov 2026; the page says it "will be updated as the remaining checks finish"):

CheckKindResult
All 175,187 modules compile (Lean v4.33.1, Mathlib v4.33.1)Buildpass, zero errors
#print axioms for the five theoremsAuditpropext, Classical.choice, Quot.sound only
No axioms declared outside Lean coreAuditpass (15 axioms in the environment, all in Init)
Mathlib files identical to the official cacheAuditpass (8,322 Mathlib and 378 dependency .olean files, byte for byte)
Independent sandboxed lake build Main (no network, read-only source)Rebuildpass; its export is byte-identical to the published one
leanchecker kernel replay of every moduleLean's own kernel (not independent)175,187 of 175,187, zero rejections
nanoda (Rust kernel) on the full exportIndependent, full exportaccepts (27 min 42 s on 80 threads)
con-leche master on the full exportIndependent, full exportaccepts 1,468,418 declarations in --verified mode
con-leche --compare and con-ron --compare, challenge against solutionIndependent, full export + statement matchall five theorems "justified by the solution" (con-ron: 1,468,418 solution declarations accepted in --verified mode)
lean4lean on every compiled moduleIndependent, compiled modules (not the export)175,187 of 175,187 (five needed a raised step limit on decide +kernel computations)
Lean default and paranoid kernels on the export; full lake comparator on the main proofLean's own kernel + judgenot finished at that update (statement comparison and axiom check already passed); see Status for the latest. The completed lake comparator run listed at 04:16:52 UTC is for the Robin1984 sanity check only.

The community statement adds that con-leche and con-ron "come with a formal proof, relative to set theory, that they cannot accept a false proof".

A sanity check that avoids Mathlib's zeta definition

The proof was also combined with an independent formalisation of Robin's and Lagarias's criteria (kimihiro64/Robin1984). This yields two unconditional statements about the divisor sum \(\sigma(n)\), which don't mention zeta at all. Both passed the same checks:

theorem robin_inequality :
    ∀ n : ℕ, 5040 < n →
      ((ArithmeticFunction.sigma 1 n : ℕ) : ℝ) <
        Real.exp Real.eulerMascheroniConstant * (n : ℝ) * Real.log (Real.log (n : ℝ))
$$\sigma(n)\lt e^{\gamma}\,n\ln\ln n\quad\text{for all } n\gt 5040.$$

Our own spot checks

Reproduce the fastest check yourself

From the MIT page. Check the sizes and hashes before you start:

ItemSizesha256
solution.ndjson.zst (download)7.7 GB (7,699,933,588 bytes)61a8938ad5f5e57397c1c0e3b954916af546d9004ade01c3555744a681b05381
solution.ndjson (unpacked)61,570,595,788 bytes5ea74b912147c5c93cc2b6d70cc727cf908df2f62ac6a20480a3fa02f6be244e
challenge.ndjson.zst (download)47 MBsee the page's SHA256SUMS
challenge.ndjson (unpacked)350,862,970 bytesbd484ac9886a96f26b1d9a7a59ebd45b7a70d102c015d4f31f9302bbdd6ab2b9
con-leche, branch comparecommit5dc36dc15b7bee891a02406b78a8ac816a47baad
con-leche, master (plain check)commitcd2eceab2e9b10404c663b468639c8aa99d0d1f2
con-ron, mastercommit3f22699b8fd370f97fa9a784f7df7c5decf8e100

Machine: Lean v4.36.0 (the comparator tooling's version; the proof itself builds with v4.33.1). con-leche needs about 50 GB of RAM and took under four minutes on 64 threads; the full lake comparator needs roughly 100 GB of RAM and 70 GB of disk. Full commit hashes are from GitHub; the MIT page gives the short forms.

zstd -d --long=30 solution.ndjson.zst      # --long=30 is required
zstd -d --long=27 challenge.ndjson.zst
sha256sum solution.ndjson challenge.ndjson  # compare with the published hashes

git clone https://github.com/leanprover/con-leche && cd con-leche
git checkout 5dc36dc15b7bee891a02406b78a8ac816a47baad   # branch compare; use cd2eceab2e9b10404c663b468639c8aa99d0d1f2 (master) for the plain check
lake build con-leche
.lake/build/bin/con-leche --compare challenge.ndjson solution.ndjson

The expected hashes are in the table above.

How this site is checked

This explainer has its own public CI (GitHub Actions runs). It checks the explainer, not the proof. Each push and pull request runs numeric fixtures (zeta against mpmath values, π(x) up to 106) and a Playwright suite against a local static server: KaTeX errors, console errors, internal links and anchors, the interactive activities, and layout at 17 viewports. After a deploy to main, a smoke job runs against the live Pages URL, and a weekly job checks external links. Details are on the Sources page.

Caveats engineers will care about

Want the mathematical strategy behind the code, with which Lean definitions match which steps? See How the argument works.

Reading the code

The proof map shows each step's real Lean statement and file path. The outer layers (RhOfRight.lean, CritLine.lean, Imprimitive.lean, TopWin.lean) are short and readable. The deep layers are large, machine-generated in style, and hard to read.