13. Certifying

Draft

What a check establishes

On 21 November 2026 the Lean Focused Research Organization (FRO) and the Mathlib Initiative declared "full confidence" in a proof of the Riemann hypothesis that had been released the day before as a Lean library of 175,187 files (the introduction quotes the sentence). Nobody reads 175,000 files in a day, and the statement does not claim that anyone did: instead, it reports four checks, three of them automated. This part asks what checks of that kind actually establish. Its answer is that "checked in Lean" is not a single atomic guarantee, but a chain of trust with five distinct links that can each be audited separately: the formal statement, the definitions underneath it, the axioms invoked, the kernel program, and the build environment. Section 12 looked at that chain from the side of whoever produces a proof; this part takes the side of a skeptical auditor certifying one.

The first step is to isolate what a kernel's "accepted" verdict guarantees and what it leaves on trust. From there, each potential vulnerability forces the next safeguard in sequence. Compiling a Lean project executes arbitrary user-written metaprograms inside the build process, so an auditor must move the check away from the live build onto an inert text export containing no executable code (Section 13.3). Any single kernel implementation might harbor a soundness bug, so multiple separately written kernels replay that same inert export (Section 13.4). Even an export accepted by every kernel only proves some proposition, since the proof files could have silently redefined a symbol in the theorem statement, so a comparator tool must check that the proved statement matches a clean standalone specification down to every underlying definition and permitted axiom (Sections 13.5 and 13.6). With those gates in place, Section 13.7 evaluates the four checks cited on 21 November alongside subsequent audits, and Section 13.8 confronts the question at the bottom of the stack: how to trust or verify the proof checkers themselves.

The series reads one edition of that proof, the readable edition of 25 November (Section 12), and this is its chain, drawn to scale.

squares    one square to a thing, its area its lines of text, all on one scale

           counted on the trusted side                 untrusted: need not be read
           the statement                 54 lines      the proof              477,124 lines
           Lean's kernel              8,028 lines        (Lib 285,088, New 191,998)
           nanoda                     8,801 lines      elaborator, tactics    133,460 lines
           lean4lean                  4,015 lines      Mathlib's tactics       81,374 lines
             (two other checkers: a second opinion,      (they overlap what is under the statement:
             not more to read)                           989,440 lines of Mathlib by imports)
           the comparator               591 lines
             (the tool in its own repository; the judge inside Lean 4.35.0,
             run as lake comparator, is 1,011 lines)
           definitions under it: an open range, from 333 lines followed here
             to 1,576,682 that their file imports (4,889 modules)

enlarged   the square in focus divided into its parts: Lean's kernel is 36 files,
           the largest inductive.cpp, 1,417 lines

point      no sum and no ratio: the definitions under the statement have no number in lines,
           and the published export of the statements holds 52,173 declarations
(the live figure needs JavaScript and loads about 0.24 MB of data)
Lines of text as areas on one scale, counted for this series on 1 December 2026; nothing was built or run. Green: counted on the trusted side: the statement, Lean’s kernel, the comparator. Hollow green: two other checkers, a second opinion, not more to read. Dashed: the definitions under the statement, an open range from the 333 lines followed here (the green speck) to the 1,576,682 their file imports. Hatched: what need not be read, because a kernel checks what it produces; Mathlib’s tactics overlap the dashed square. Point at a square, or use the arrow keys, to enlarge it.

On the trusted side stand 54 lines of project statement files and the 8,028 lines of Lean's C++ kernel; on the untrusted side stand 477,124 lines of proof script, which a kernel checks mechanically so a human reader need not inspect them for logical gaps. How much library code sits underneath the statement itself resists a single line count: tracing the core definitions directly by hand took 333 lines (Section 11.1), counting every Mathlib file transitively imported by Statements.lean sweeps in 1,576,682 lines, and exporting the exact closure of constants referenced by the five elaborated statements yields 52,173 low-level declarations (Section 11.6).Lines of text, comments and blank lines included, counted for this series on 1 December 2026 at fixed versions: the readable edition at its commit 72fead1, Lean 4.35.0, Mathlib at the edition's pin. Nothing was built or run for these counts. The count of declarations is from the page of checks cited in Section 13.7.

Those 477,124 lines of proof can go unread for logical validity because Lean's kernel has a narrow, well-defined job. Given an environment of previously accepted declarations, a target statement, and a candidate proof term, the kernel computes the term's type and tests whether it matches the statement (Section 6); how tactics or models discovered that term is never part of its input. An accepted theorem therefore establishes a four-part relation: this proof term inhabits this statement in this environment, according to this checking program. Of those four components, only the proof term itself requires zero trust, because it was just verified; all remaining trust shifts onto the statement, the environment, and the checking program. Making that separation rigorous starts with defining what a kernel check does.

Definition 13.1.1 (a check). An environment \(E\) is a finite sequence of declarations (axioms, definitions, theorems, inductive types and the other kinds of Section 6.4), each accepted by the kernel in the environment formed by those before it. To check a theorem named c, with statement \(T\) and proof term \(e\), in \(E\) is to have the kernel decide that \(T\) is a proposition of \(E\) and that

\[E \vdash e : T ,\]

which it does by computing a type of \(e\) and comparing it with \(T\) up to definitional equality (Section 6.3). If it succeeds the theorem is accepted, and c joins \(E\) as a constant of type \(T\).

Definition 13.1.1 describes the mechanical test a C++ or Rust binary runs on data structures in memory. Turning a passing run into a mathematical conclusion about Lean's formal type theory requires one explicit assumption about that binary.

Proposition 13.1.2 (what acceptance gives). Suppose the kernel is sound for Lean's type theory: every judgment it accepts can be derived by the rules of Section 6.2. If it accepts a theorem c : T := e that has no hypotheses, then \(T\) is derivable in that theory from the axioms of \(E\) that \(T\) and \(e\) reach through the constants they mention.

The audit examined in Section 13.7 states this directly for riemannHypothesis in the 20 November archive: "If a sound kernel accepts a term of type RiemannHypothesis, then RiemannHypothesis is derivable in Lean’s type theory from the axioms that the term uses."E. Schiller, arXiv:2611.37492v1 (27 November 2026), Section II-C; the paper is cited in full in Section 13.7. It concerns the archive of 20 November; the sentence holds of any theorem without hypotheses. Unused axioms elsewhere in \(E\) play no role, because the check of c succeeds identically when \(E\) is pruned down to the constants transitively mentioned by \(T\) and \(e\), which is the pruned environment written out in a theorem export (Section 13.3). Notice how cleanly Proposition 13.1.2 separates four distinct questions. Formal derivability in Lean's type theory is its conclusion. Implementation soundness of the checker, together with its compiler and hardware, is its hypothesis. Whether formal derivability rules out proving False depends in turn on the logical consistency of Lean's type theory with those axioms (Sections 6.6 and 13.8). And semantic faithfulness, whether the formal type \(T\) genuinely expresses the mathematical conjecture humans intend, does not appear in the proposition at all.

In the readable edition, the top-level declaration is a single line: theorem riemannHypothesis : RiemannHypothesis := New.zeta_zeros_on_line New.grh (Section 12.3). Here \(T\) is Mathlib's definition RiemannHypothesis (Section 11.5), \(e\) applies one lemma to another, and no assumptions stand to the left of the colon. Everything those two lemmas draw from the 477,124-line repository lives inside \(E\). In the published export covering all five main theorems and their transitive dependencies, \(E\) totals 216,571 declarations: 165,163 from Mathlib and Lean's core libraries (shared with the compact edition's export) plus 51,408 from the project itself.

Proposition 13.1.2 takes \(E\) and \(T\) as given and assumes a sound kernel. An audit has to account for every one of those assumptions.

Which parts of an environment of 216,571 declarations does a person have to read? The question was answered in 1997, for an imagined machine-checked proof of Fermat's last theorem.

Is the meaning of the formal theorem really what is claimed? This is an informal question; it cannot be answered by a machine, as one side of the “equivalence” is informal5. You must bridge this fundamental gap by using your own understanding; you will want to consider the formal theorem in light of your understanding of the formal system (the logic) being used, any assumptions used in the proof, and all the definitions used in stating the formal theorem. The difficulty is how can you read the formal proof to decide its meaning for yourself, given the size and obscure presentation of formal proofs. This issue is sometimes overlooked in discussions of reliability of formal proof. You don’t need to read the entire proof in order to believe the theorem. Given that you have reason to believe the putative proof is a correct derivation in the given logic (by independent checking), only the outstanding assumptions, the formal statement of the theorem, and the definitions used hereditarily in stating the formal theorem must be read. Although the formal proof, perhaps partially generated by machine, may contain many definitions and lemmas, these need not be read, as we trust that they are all correctly formulated and used as allowed by the logic, since they are checked by our trusted proof checker.

—Robert Pollack, "How to believe a machine-checked proof" (1997). BRICS Report RS-97-18, University of Aarhus, July 1997 (brics.dk), Section 1.1, the second of two steps; the first asks whether the object is a derivation at all, which is the question a kernel answers. The superscript is the report's own footnote mark. Its opening sets the terms: "By machine-checked proof I mean a formal derivation in some given formal system; I am talking about derivability, not about truth."

Pollack's "outstanding assumptions" are the axioms in \(E\), his "formal statement" is \(T\), and his "definitions used hereditarily" are the slice of \(E\) reachable from \(T\). Adding the kernel that verifies the derivation and the build process that constructs the proof terms produces five distinct links, each visible in the readable edition.

The statement. The file src/Statements.lean has 16 lines, importing Mathlib and introducing four definitions, while the first of the five main theorems uses Mathlib's own RiemannHypothesis directly as its type (Section 11.6 reads this file line by line). A kernel never sees surface .lean syntax: it sees the fully elaborated expression produced by Section 9's elaborator, with every hidden coercion, type-class instance, and universe level written out explicitly.

The definitions under it. Stating a theorem pulls in every definition its symbols mention, and every definition those mention in turn, all the way down to the natural numbers. The published export of the five statements alone contains 52,173 declarations. An automated comparator takes that entire foundation as given: whatever the trusted statement file imports counts as part of the question being asked, not part of the untrusted answer (Section 13.5).

The axioms. Standard mathematics in Lean rests on three axioms: propext, Quot.sound, and Classical.choice (Section 7). The readable edition includes a seven-line script that imports Main and runs #print axioms on each of the five theorems. Because #print axioms reads compiled module metadata on the elaborator's side rather than walking raw kernel exports, and because querying across an import is the exact setup where Lean 4.35.0 can omit an axiom hidden behind a constructor (Section 7.5), Section 13.7 distinguishes that script from export-level axiom checks.

The kernel. Type-checking rests on Lean's 8,028 lines of C++ across 36 files (Section 6.7), which an auditor either trusts by inspection or cross-checks against separately implemented kernels (Section 13.4).

The build. Before any kernel can check a proof term, Lean's elaborator and tactics must construct it by compiling the project and executing its metaprograms (Section 13.3).

The edition draws the same line in a sentence of its README: "To trust the result, read src/Statements.lean, which imports only Mathlib, the five statements in src/Main.lean, and the list of axioms, and build or replay the files. All other definitions occur only inside the proof."README of the readable edition (grh/README.md of github.com/lsernau/grh-lean at commit 72fead1, 25 November 2026), section "Theorems", last paragraph. Its guide repeats the instruction and names #print axioms for the list. It is Pollack's list, with his trusted proof checker spelled "build or replay". Everything on it is read except that last clause, which is run, and whatever a kernel reads afterwards, a build wrote.

The build runs code

A Lean repository is not passive data; it is executable code. Custom tactics, macros, and elaborators run arbitrary programs inside the lean process during compilation (Sections 8.6 and 10), and the Lean reference manual states the security consequence bluntly: "Importing libraries created by a determined malicious attacker and building them without further protection can compromise the user's system, after which no further meaningful checks are possible."The Lean Language Reference, chapter "Validating a Lean Proof" (lean-lang.org, as served on 1 December 2026), in the comments on re-checking with lean4checker. If you merely run lake build on untrusted source files, a malicious tactic could overwrite files, mutate in-memory environment tables with kernel checking disabled, or print a fake success message and exit cleanly. Under the manual's validation protocol, the build is therefore isolated inside a sandbox with no network access, a read-only filesystem, and a single writable output directory, and certification never trusts the exit status of that sandboxed process. Instead, independent checkers inspect an inert text file written out at the end of the build: the export.

file      Euclid's theorem as Lean 4.35.0 exported it: 15,938 lines of text, read from the top
lanes     names 2,805 · universe levels 19 · expressions 12,716 · declarations 397
          every index in a line names a line above it

 13,250   {"app":{"arg":10531,"fn":9389},"ie":10535}         Euclid.Prime (Euclid.minFac (HAdd.hAdd.{0, 0,…
 13,264   {"ie":10549,"lam":{"binderInfo":"default","body":…  fun (n : Nat) => let hp : Euclid.Prime (Eucli…
 13,265   {"thm":{"all":[2385],"levelParams":[],"name":2385,"type":10517,"value":10549}}
          name 2385 ← line 13,227 · type 10517 ← line 13,232 · value 10549 ← line 13,264
          the kernel: accepted, the value has the type stated

replay    at line 13,265 this page's kernel has accepted 311 declarations (365 constants) in 33,829 steps,
          starting from an empty environment; the 2,673 lines below are not needed for the theorem
change    "arg" of line 13,250 lowered by one (10531 to 10530): the replay stops 15 lines later, the kernel
          refuses the theorem (application type mismatch); 310 declarations stand, 2,673 lines are never read
          the index line 13,250 takes for itself lowered by one: the reader refuses that line
          the name of the bound variable in line 13,264 lowered by one (4 to 3): all 397 still accepted
(the live figure needs JavaScript and loads about 0.9 MB of data and 0.3 MB of code)
The file a checker reads: Euclid’s theorem as Lean 4.35.0 exported it. The band is the whole file, a lane to a kind of line, with the size of each table so far. Green: the line being replayed. The listing shows the file there and what each line builds; brackets join a line to the lines it names. Step or run through what this page’s kernel read. Change one index lowers one number by one: the replay stops where a declaration no longer checks, and the rest is hatched; some changes pass. Counts are exact. The kernel is a separate implementation, written with Lean’s at hand.

An export contains zero executable code, and every line in it can reference only strictly earlier lines. Because there are no forward references and no metaprograms to run, a standalone verifier can stream the file once from top to bottom, starting from an empty environment, and have verified a theorem from scratch the moment it finishes checking that theorem's line. For Euclid's theorem, the running example of this series, that happens at line 13,265 of 15,938, the 311th declaration in the file. Sections 13.4 through 13.6 build on this format, so we state its exact structure first.

Definition 13.3.1 (export, replay). An export is a text file in JSON (JavaScript Object Notation), one object to a line. After a header, each line is a name, a universe level, an expression or a declaration; a line of the first three kinds takes the next index of its table and is built from entries of smaller index, and a declaration gives its name, its type and, where it has one, its value by index. To replay an export is to hand its declarations, in the order of the file, to a kernel that starts from the empty environment. The replay accepts if the kernel accepts every declaration.

Replaying an export recovers Proposition 13.1.2 without trusting a single line of the build process: so long as the replaying kernel is sound, every theorem in the export is formally derivable from the axioms declared in that file. Equally important are the three things a bare replay cannot tell you. First, it does not prove that the export actually came from the source repository in front of you: as the help text of lake check (Section 13.4) warns when replaying an externally supplied file, doing so "only establishes that the export file is accepted and nothing about the project this command is being run in". Second, a bare kernel never objects to extra axioms, which look to it like valid assumptions. Third, a bare replay does not check whether the theorem at the end still states what you think it states. Across the 40 export lines encoding the statement and proof of Euclid's theorem, there are 122 ways to decrement a single integer index by one: this page's parser rejects 38 of those mutations as malformed, this page's kernel rejects 78 as ill-typed, and six still pass as completely valid proofs, including one mutation that simply attaches a different identifier to the theorem. A renamed theorem is still a well-typed declaration. (Lean's official C++ kernel was not run on those 122 mutated files; this page's kernel is a separate implementation in JavaScript, written with Lean's source as its reference.)

For the readable edition, the published export is a 4,485,867,644-byte file, and builds run on two separate machines produced byte-for-byte identical exports, according to the verification page cited in Section 13.7. Moving verification onto an export adds two small pieces of glue to the trusted base, namely the exporter that serializes declarations and the parser that reads them into a kernel (1,129 lines in Lean 4.35.0), and it still relies on the hypothesis of Proposition 13.1.2: that the kernel itself has no soundness bug.

Kernels, and three procedures called checking

One kernel can be wrong. The remedy written into the toolchain is a list.

def bundledKernels (lean : LeanInstall) : Array (String × Array String) :=
  let exe (name : String) := lean.binDir / name |>.addExtension System.FilePath.exeExtension
  #[
    ("Lean paranoid", #[(exe "leanchecker-paranoid").toString, "--silent", "--from-export"]),
    ("lean4lean", #[(exe "lean4lean").toString, "--import"]),
    ("nanoda", #[(exe "nanoda_bin").toString]),
    ("con-leche", #[(exe "con-leche").toString]),
    ("con-ron", #[(exe "con-ron").toString])
  ]
-- ...
def standardAxioms : Array Lean.Name :=
  #[``propext, ``Classical.choice, ``Quot.sound]

These five programs ship with Lean 4.35.0 and read exports. The option --paranoid of Lean's checking commands runs all of them beside Lean's own kernel and accepts only if each one does.The listing is lines 572 to 580 and 662 to 663 of src/lake/Lake/CLI/Check.lean in Lean 4.35.0. The reference manual, in its section on Lake: "The solution must be accepted by each of these external checkers, in addition to the configured external kernels and Lean's kernel." The list is that of Lean 4.35.0: on the development branch a change merged on 30 November 2026 (pull request 16903 of github.com/leanprover/lean4) disables lean4lean and nanoda until they follow a renovation of the kernel's logic. The argument for the list was made eight days before the proof appeared.

This can happen. There was a soundness bug in Lean’s kernel which was fixed four hours after it was discovered, and a subsequent review of Lean’s code base by OpenAI found several more, all of which were fixed before they were announced publicly. There may in theory be more soundness bugs in Lean’s kernel. However, this does not matter.

Why not? Because Lean now has many kernels, created by users, written in many different languages, and at least one of which is formally verified to have no bugs, right down to the assembly level. If you want to make absolutely sure that there is no reward-hacking then again there is a one-line answer: lake comparator --paranoid. A malicious piece of code exploiting an as-yet-undiscovered bug in Lean’s official kernel will not pass this test unless it exploits as-yet-undiscovered bugs in many independent systems all at once. For example this webpage from the Lean kernel arena demonstrates that OpenAI’s resolution of the Navier–Stokes problem is accepted by multiple kernels as well as Lean’s official kernel.

—Kevin Buzzard, "…and the proof is checked in Lean" (12 November 2026). Xena project blog, xenaproject.wordpress.com, under "Question 4", whether the code exploits a bug in Lean's official kernel. One clause says more than the documents behind it: what is proved about those kernels is narrower than "no bugs", by their authors' own account (Section 13.8). On the four hours: the post does not name the bug. Of the kernel bug of July 2026 its postmortem says "We pushed a fix one hour after the report", and the repository's record has the fix proposed 1 h 40 min after the report and merged about ten hours after it. The accounts differ, and no source read here says why.

That argument can be held against the list, program by program.

Remark 13.4.1 (six kernels are not six witnesses). Cross-checking reduces risk only insofar as the checkers do not share design or code bugs, and by their own documentation these six binaries are less independent than a raw count suggests. "Lean paranoid" is Lean's official C++ kernel recompiled with a hardened memory allocator. lean4lean translates that C++ kernel directly into Lean, and its README notes that it "likely shares some implementation bugs with it (it's not really an independent implementation)". By contrast, nanoda was written from scratch in Rust, while con-leche was written separately in Lean and con-ron translates con-leche into Rust. All six also read the same export file emitted by a single exporter. In a documented incident from July 2026, a bogus "disproof" of the Collatz conjecture slipped past both Lean's official kernel and a week-old build of nanoda via two unrelated bugs, while lean4lean, as a faithful port, inherited the official kernel's bug; the postmortem noted that "checking with an independent kernel still works, since it required two distinct bugs in two implementations, but users who rely on it need current versions of both".L. de Moura, "Postmortem for Kernel Soundness Bug #14576", 1 August 2026 (leodemoura.github.io), section "Why nanoda did not catch it". The README quoted is that of github.com/digama0/lean4lean, as fetched on 1 December 2026. Nor do all six checkers accept identical sets of valid terms: as Section 6.6 showed, two groups among them draw the boundary of definitional equality in slightly different places.

Which kernels check a proof is only half the question; what input artifact they check matters just as much. Across Lean's 2026 repository records, "checked" can refer to three very different procedures beyond ordinary compilation, and Lean's maintainers assign them sharply different levels of trust.

Compiled, and three ways of being checkedtop to bottom, less is trusted; the words in ink are each program's own, from its documentation, its source or a run that others published, none from a run made here

  1. 13.3compile lean, lake build

    The project's own tactics and programs run, and compiled files of earlier builds are loaded as they are. Everything is trusted: the elaborator, every metaprogram, every file on disk.

    (prints nothing; exit code 0)

  2. 13.4replay compiled files leanchecker

    Lean's kernel checks a module's stored declarations again, on top of its imports as loaded. Reports of September and November 2026 describe forged files that pass; the mode was removed from the development branch on 23 November 2026.

    This is not an external verifier, simply

    a tool to detect "environment hacking".

  3. 13.4export, then replay lake check

    A build in a sandbox writes an export, kernels replay it from the empty environment, and any axiom beyond the standard three is an error. It does not say which statement was proved.

    Uses axioms: propext, Classical.choice,

    Quot.sound

  4. 13.5export, replay, compare lake comparator

    The same, and each named theorem must have the statement of a trusted challenge file, with every definition under it, and no axiom outside a stated list.

    Your solution is okay!

green: the one procedure that ties a proof to a statement

The weakest of the three runs leanchecker directly on compiled .olean files, the binary module snapshots left behind by lake build, asking Lean's kernel to re-verify each module's declarations on top of its imported .olean dependencies. Its own documentation warns that it is "not an external verifier". Because .olean files are rich binary snapshots generated inside the untrusted build process, metaprograms can craft .olean states where a declaration appears already checked when it never passed the kernel: in September and November 2026, seven bug reports demonstrated forged or manipulated .olean files that leanchecker accepted, three of them proving False with zero listed axioms. A maintainer described one report as "maybe just outside this tools trust model"; .olean replay was patched and then, on 23 November 2026, removed altogether on Lean's development branch (though as of 1 December 2026 no tagged release includes those changes, and Lean 4.35.0 still ships the old mode). Above another report filed the next day, a maintainer pinned a clarification: .olean replay "is not part of the recommended and usual procedure to check proofs", so the flaw "does not threaten the validity of Lean proofs checked that way, including Riemann Hypothesis and other high profile proofs".Records of github.com/leanprover/lean4 as fetched on 1 December 2026: the reports are issues 15100, 15101, 16674, 16675, 16688, 16730 and 16734; the phrase about the trust model is from a comment of 22 November 2026 on 16674 by the login nomeata, whom the record marks as a collaborator; the removal is pull request 16690; the note stands above 16730, by the same login, and the record does not date it; the words on the comparator quoted next are from that login's comment of 24 November under the same report. None of the reports was reproduced for this series, and none of these records names an edition of the proof. The second procedure, lake check in Lean's build tool Lake, builds inside a sandbox, emits a flat text export, replays that export from an empty environment, and rejects any axiom outside the standard three. The third procedure, lake comparator, adds statement and prelude matching on top of sandboxed export replay (Section 13.5), earning the same maintainer's label as "the “really secure” check".

To mark clearly where the kernel's responsibility ends and the surrounding verification harness's responsibility begins, Lean's maintainers use a one-sentence criterion that motivates Section 13.5.

Definition 13.4.2 (kernel soundness bug, as Lean's maintainers define it). "If the official kernel accepts an exported proof of False under the standard prelude and permitted axioms, that is a kernel soundness bug."

Every qualifier in that sentence carves out an attack that a bare kernel is not designed to catch on its own: exported, because binary .olean snapshots can be forged; under the standard prelude, the foundational declarations of Lean's core library, because the C++ kernel accelerates arithmetic on Nat literals using built-in big-integer code and trusts by name that the environment's Nat.add actually defines addition (Section 13.5); and permitted axioms, because a bare kernel treats any axiom declaration as a valid assumption (Section 13.6)."Kernel bug hunt", a guide by Lean's maintainers for people who look for such bugs, undated, as served on 1 December 2026 (hackmd.io), section "What we are looking for".

Moving from .olean files to a flat JSON export satisfies the first qualifier. Enforcing the standard prelude, the permitted axioms, and the intended theorem statement requires comparing two exports side by side.

Comparing statements

Replaying an export shows that some theorem was proved; confirming which theorem was proved requires holding the solution's export against a short, human-audited specification file that imports nothing untrusted. The readable edition supplies that specification in Challenge.lean, paired with judge settings in comparator.json.

import Statements

/-! The five theorems of `src/Main.lean`, with `sorry` in place of their proofs, for the tool
Comparator. This file imports only `src/Statements.lean`, which imports only Mathlib. Nothing
imports this file. -/

theorem riemannHypothesis : RiemannHypothesis := by
  sorry

-- ...
{
  "challenge_module": "Challenge",
  "solution_module": "Main",
  "theorem_names": [
    "riemannHypothesis",
    "riemannZeta_eq_zero_re",
    "LFunction_ne_zero_of_half_lt_re",
    "LFunction_eq_zero_re",
    "LFunction_eq_zero_re_of_isPrimitive"
  ],
  "definition_names": [],
  "permitted_axioms": [
    "propext",
    "Quot.sound",
    "Classical.choice"
  ],
  "enable_nanoda": true
}

Here Challenge.lean states the target theorems with sorry placeholders, the project under src/Main.lean proves declarations of the same names, and the judge, shipped since Lean 4.35.0 as lake comparator, builds and exports both sides separately before comparing them. Section 12.3 deferred what a passing verdict guarantees: three concrete checks, backed by explicit environmental assumptions.

Definition 13.5.1 (a judgment). Given a challenge, a solution, a list of theorem names and a list of permitted axioms, the judgment "accepted" means, by the tool's documentation and by its source in Lean 4.35.0 as read for this series (the tool was not run here): (i) each named theorem has the same statement in the two exports, and every constant that can be reached from those statements, or from the constants for which the kernel has built-in code, is the same declaration in both; (ii) every axiom that can be reached from the named theorems of the solution is on the list; (iii) Lean's kernel and every further kernel that was configured accept the solution's export. By the manual this presupposes that everything the challenge imports is trusted, and the project's build configuration and dependencies with it; that the build started clean, in the sandbox, and not as a privileged user; that the kernels do not all share a fault that lets a wrong proof pass; and that the solution exploits no unknown flaw of other software or hardware on the machine.

Clause (i) closes off definition spoofing inside the proof files. Buzzard gives the canonical example of a rogue proof script "which redefines x^n to mean 37": on screen the final theorem line would still look like Fermat's last theorem while asserting something trivial, and comparing the two exports catches the mismatch because the definition underneath the exponentiation symbol in the solution no longer matches the one in Challenge.lean.

The one-line answer: lake comparator. You can read more about this answer here. But in short, this tool checks that the theorem stated in a trusted file and the theorem proved via untrusted imports are identical, and that only the axioms of mathematics are used in the proof.

—Kevin Buzzard, "…and the proof is checked in Lean" (12 November 2026). Under "Question 3", whether the code proves the theorem as stated. The word "here" links to the reference manual's chapter on validating a proof. The paragraph before this one, which poses the question, breaks off in the middle of a sentence on the page as fetched for this series, and is not quoted.

The second half of clause (i) blocks an environment-spoofing attack against bare export replay. Because Lean's C++ kernel accelerates Nat arithmetic with built-in machine code, in the maintainers' words it "recognizes these declarations by name and does not check that they are the official ones". In October 2026 a bug hunter submitted a crafted export that bound the identifier Nat.add to a different function; both Lean's default kernel and nanoda accepted the export, exploiting the disagreement between the fake definition and the hardcoded arithmetic. Maintainers closed the issue explaining that prelude spoofing "is not a kernel soundness bug" and that comparator "checks for exactly this kind of exploit" by verifying that every primitive recognized by the kernel matches the challenge's prelude.The guide "Kernel bug hunt", section "Known issues"; issue 15908 of github.com/leanprover/lean4, opened and closed on 24 October 2026 by the record's clock, which is the evening of 23 October in New York; the answer is the closing comment, by the login leodemoura, whom the record marks as a member. By the report's own table lean4lean rejected that export and con-leche and con-ron declined it. Not reproduced here. Meanwhile, clause (ii) requires an explicit whitelist rather than a hidden default: as the tool's help text explains, permitted_axioms "is deliberately not defaulted: it is what the verdict means, so the challenge author states it".

What comparator never judges is the challenge file itself. If Challenge.lean formalizes the wrong mathematical claim, a valid proof of that wrong claim still earns "accepted". Similarly, if a challenge leaves an unimplemented definition stub for the solver to supply, the specification "can be gamed", as the documentation warns: asked to fill in a predicate P and prove RiemannHypothesis ↔ P, a solver can simply define P := RiemannHypothesis and close the equivalence by reflexivity. In the readable edition, definition_names is empty ([]), leaving no definitions open for the solution to choose.

For this series lake comparator itself was not run, because it requires the Linux sandbox utility bubblewrap (bwrap), which is unavailable on the build machine used here. Wherever statement comparisons appear in Sections 13.6 and 13.9, they use a small standalone script written for this series that checks two exports against clause (ii) and the statement-reachable half of clause (i), without checking kernel primitives or running a kernel of its own.

With the specification of each verification gate in place, all of them can be tested experimentally against concrete exploits.

Ways to cheat, and the gate that stops each

Every link in the chain of trust invites its own style of attack, and each attack fits into a short .lean file. Nine exploit files were constructed for this series, each making Lean 4.35.0 appear to accept a theorem it never genuinely proved, from Euclid's theorem proved without an argument to lines that look like Goldbach's conjecture or the twin prime conjecture while asserting something trivial. Alongside one honest baseline proof, all ten files were put through five successive verification gates, running every tool directly unless noted otherwise.

recorded with Lean 4.35.0: nine ways of cheating under an honest proof, against five gates
●  the gate stops it     ▒  the cheat passes     w  passes with a warning     ○  not observed: a judgment, or documentation

                                             Lean's  #print   replay of the export    comparison    reading
                                             check   axioms   replay only  axiom list (a stand-in)  (a judgment)
an honest proof                                –       –          –           –            –            –
sorry                                          w       ●          ▒           ●            ●            ▒
an added axiom                                 ▒       ●          ▒           ●            ●            ▒
native_decide with an implementation that lies ▒       ●          ▒           ●            ●            ▒
a declaration added without the kernel         ▒       ▒          ●           ●           ▒ ○           ▒
an axiom behind the constructor of a type …    ▒     ▒ 1 of 2     ▒           ●            ●            ▒
a definition that shadows the statement's name ▒       ▒          ▒           ▒            ●            ○
the same name with another definition          ▒       ▒          ▒           ▒            ●            ○
a hypothesis that nothing satisfies            ▒       ▒          ▒           ▒            ▒            ○
a junk value                                   ▒       ▒          ▒           ▒            ▒            ○

first stop   #print axioms 3 · the replay 2 (1 of them only by a checker that holds axioms to a list) ·
             the comparison 2 · a person reading 2
unreported   #print axioms from an importing file names no axiom for 1 of 2 copies (3 of 24 in the larger
             recording); whether a proof can draw on an axiom that stays unreported in this way was not examined
stand-in     Lean's own comparator was not run here; by its documentation it would also reject the declaration
             added without the kernel
(the live figure needs JavaScript and loads about 0.1 MB of data)
Nine ways to make Lean 4.35.0 announce a theorem that is less than it looks, each tried on a real file, under an honest proof. A column is a gate; the replay is two columns, because kernels that only replay accept any axiom and checkers that hold axioms to a list do not. Green: the first gate that stops each cheat. Hatched: the cheat passes. Rings: not observed, a judgment or a tool’s documentation. The comparison is a stand-in written here; Lean’s own comparator was not run. Point at a cell to read the programs’ own words, and the file of its row.

No single gate catches all nine: #print axioms flags unpermitted assumptions that a bare kernel treats as legal, export replay catches metaprogramming bypasses that #print axioms misses, statement comparison catches definition spoofing that passes every kernel, and two exploits slip past every automated tool because the bug sits in the theorem statement itself. Plain lean compilation rejects zero of the nine files, emitting a warning on only one (sorry).

The first three exploits smuggle an unpermitted axiom into the export: an explicit sorry, a custom axiom asserting the goal outright, and native_decide paired with a lying native implementation (where @[implemented_by] swaps a pure decision function for unchecked compiled code at runtime, and native_decide records its answer as a trust-me axiom in the environment; Section 10.4). Because a bare kernel treats any syntactically valid axiom as an allowed premise, Lean's default kernel, lean4lean, and this page's kernel accept all three exports. Checkers that enforce an axiom whitelist stop them cold: nanoda, configured to allow only the three standard axioms, halts with export file declares unpermitted axiom "sorryAx", while con-leche and con-ron refuse to certify the files. So would lake check (not run here), whose help text specifies a replay "erroring on any use of non-standard axioms".

The fourth exploit turns Section 10.7's architecture inside out: a custom tactic disables kernel checking (debug.skipKernelTC) for a single step and injects an ill-typed theorem directly into Lean's environment. Plain compilation exits with code 0, and #print axioms reports that the theorem depends on zero axioms, which is literally true because no axiom constant was referenced; the fake proof term simply never visited the kernel. Replaying the flat export from an empty environment catches the forgery immediately across all eight replay runs, with Lean's kernel and lean4lean halting on (kernel) declaration type mismatch. Our kernel-free comparison stand-in lets this file pass, whereas full lake comparator runs kernel replay on the solution export and rejects it, according to its documentation.

The fifth exploit packages the finding of Section 7.5 into 20 lines: a theorem mentions only an inductive structure whose constructor secretly depends on a custom axiom A. Queried inside the declaring file, #print axioms reports A; queried from a second file that imports the theorem, #print axioms omits A on 1 of 2 copies of the declarations (3 of 24 in the larger test), even though the copies differ only in identifier names. Walking the raw exported terms recovers A every time. Here the test file proves nothing false since A : True, and the open question from Section 7.5, whether a proof of False can exploit an axiom omitted by #print axioms in this way, was not investigated further; the upstream bug report quoted in Section 7.5 remains open. Both axiom-whitelisting replay checkers and the export comparator stop this file unconditionally, because both inspect the flat export where A sits plainly in the declaration table.

The sixth and seventh exploits tamper with the definitions underneath the theorem name: one introduces a local Prime predicate outside the trusted namespace to shadow Euclid.Prime, while the other edits Prime directly to drop the divisor condition. Every kernel accepts both exports without complaint, because each file validly proves the trivial statement it defined; only comparing the solution's export against Challenge.lean catches that the underlying Prime constant changed. The final two exploits defeat even lake comparator, because the mistake lives inside the statement specification that both challenge and solution share. One states Goldbach's conjecture with the divisibility hypothesis written backwards as n ∣ 2 ("n divides 2") instead of 2 ∣ n ("2 divides n"); since no integer \(n \ge 4\) divides 2, the implication holds vacuously for every \(n \ge 4\). The other states the twin prime conjecture over Nat using q - p - 2 = 0; because natural-number subtraction in Lean is a total function that truncates negative results to zero (2 - p = 0 for every \(p \ge 2\), Section 7.6), setting \(q = 2\) makes 2 - p - 2 evaluate to 0 - 2 = 0 for arbitrarily large primes \(p\). Catching specification bugs like vacuous premises and truncating subtraction depends entirely on a human auditing link one; whether a careful reader would spot these two is this series' judgment rather than an experimental measurement.

Even the export pipeline has subtle boundary cases, documented in two upstream bug reports from late November 2026 (neither reproduced here): lake check omits declarations marked private or starting with an underscore when invoking the exporter, and the exporter passes records flagged as built-in quotient primitives without re-verifying them.Issues 16706 and 16734 of github.com/leanprover/lean4, as fetched on 1 December 2026. By the first, a project with a private axiom of False passed with the three standard axioms listed; it is open and unanswered. By the second, nothing can use such a record; it was closed as "known and expected", a maintainer adding that "lake comparator takes it into account and some external checkers also validate quot declarations". Consequently, lake check confirms only that the exported declarations replay under standard axioms, whereas lake comparator is what binds the proved theorem to a clean external statement and the authentic standard prelude.

Which gates were applied in November 2026, and to which text, is a matter of record.

The four criteria of 21 November

With the links and their gates in hand, the statement of 21 November can be read. It concerns the archive of 20 November, 17,374,215 lines on Lean 4.33.1, and after its claim it gives its reasons.

The codebase depends directly only on Mathlib. Over the past day, the Lean and Mathlib communities have rallied to verify the proof's correctness. We hereby certify that both the statement and the proof of the Riemann Hypothesis are correct. The four criteria in https://xenaproject.wordpress.com/2026/11/12/and-the-proof-is-checked-in-lean/ are all satisfied.

The statement of the Riemann Hypothesis is correct. This statement is part of Mathlib: RiemannHypothesis and has been carefully vetted by experts in Lean and number theory.

Alpöge’s library compiles correctly. By now, dozens of people have reported correct compilation of the codebase, reproducing the same raw proof export file. The library compiles without errors or build failures.

The code proves the correct statement. Crucially, the community has added a file that isolates the statement of the Riemann Hypothesis and imports only Mathlib. That statement was compared against the theorem proved by Alpöge using two independent tools (comparator and con-leche –compare), both confirming that the theorem proved in Alpöge’s library is exactly Mathlib’s statement of the Riemann Hypothesis.

The Lean proof is valid. The exported raw proof has been checked by several proof checkers, including Lean’s official kernel, the con-leche and con-ron checkers, and several independent checkers contributed by third parties and implemented in different programming languages. The checkers con-leche and con-ron come with a formal proof, relative to set theory, that they cannot accept a false proof, thus addressing concerns that Lean’s logic itself might have flaws that the proof could exploit. An extensive overview is available at https://math.mit.edu/~drew/grh/. These checks ran on an inert export of the proof, out of reach of hypothetical malicious code in the Lean proof sources.

—Lean FRO and Mathlib Initiative, "Lean verification of the Riemann Hypothesis" (21 November 2026). Lean community blog, leanprover-community.github.io, the five paragraphs after "Our rationale is outlined below"; the paragraph before them, with the words "full confidence", is quoted in the introduction. The statement is about the archive released on 20 November. The two addresses are printed as the page prints them; the dash before "compare" is the page's.

Those four paragraphs answer, in order, the four questions Buzzard had posed nine days earlier. Together, the signatories vouch for two claims: that the formal statement is faithful and that the formal proof is valid. For the statement, they cite human expert review of Mathlib's RiemannHypothesis, the sole check no program can perform. For the proof, they cite three mechanical checks: independent builds reproducing the same export file, statement comparison against an isolated Mathlib-only specification using two tools, and multi-kernel export replay including two checkers backed by formal soundness theorems. Section 13.8 tabulates the residual assumptions that remain even after all four criteria pass. The blog announcement itself omits byte counts and cryptographic hashes for the export, pointing readers to an external verification page.

Crucially, the 21 November statement certifies the 20 November archive rather than the readable edition examined in this series. Published four days later, the readable edition is a distinct proof of the same five surface statements in which, by its README, "many steps are proved by other arguments", built on newer versions of Lean and Mathlib: among the 50,232 underlying declarations sharing names beneath the theorem statements in the two releases, 39,482 match and 10,750 differ due to toolchain and library updates, and the verification page reporting those counts notes that it has "not checked formally that the two versions are equivalent".A. Sutherland, "Verification files for the shorter Lean proof of RH and of GRH for Dirichlet L-functions", math.mit.edu/~drew/shortgrh, as last updated on 27 November 2026, section "The statements". The sizes of the export in Sections 13.1 and 13.3 and each of his checks in the figure of the published checks are from its table "What was verified" and the notes under it; its head says that the checks were run with Claude Code. Another published check of the shorter proof, by M. Rubinstein, is of the compact edition, which this series does not read. Confidence in the readable edition therefore rests on its own dedicated record of checks.

rows      a row to a check of the readable edition, in its source's order: 18 published, 1 search of
          its text made for this series; times as published (different machines), on a logarithmic axis

          check                         reads     own soundness       threads    time
Andrew Sutherland (MIT), with Claude Code, finished 25 Nov 18:05 to 21:47 in New York
          Lean (elaborator and kernel)  source                        not given  32 min 12 s
          #print axioms                 compiled
          lake comparator --paranoid    export                        not given  4 h 9 min 59 s
          lake comparator --paranoid    export                                   no verdict
          lake comparator               export                        not given  39 min 3 s
          Lean's own kernel             compiled                      not given  12 min 0 s
          con-leche --compare           export    yes
          con-ron --compare             export    yes, by refinement
          con-leche                     export    yes                 not given  1 min 16 s
          con-ron                       export    yes, by refinement  not given  1 min 9 s
          lean4lean                     export    partly              not given  2 h 35 min 5 s
          Lean's own kernel             export                        not given  29 min 29 s
the edition's authors, by its README: 6 checks; this series: 1 search of the text

context   compact edition 15 checks, original archive 40, the longest 122 h 45 min
point     of 19 checks none failed, one has no verdict; con-leche and con-ron accepted the
          216,571 declarations of its export in 1 min 16 s and 1 min 9 s (no thread count given)
(the live figure needs JavaScript and loads about 0.07 MB of data)
Every machine check of the readable edition gathered for this series, grouped by who ran it, in the source’s order: 18 are published, and none of those was run again here; one is a search of its text made for this series. A dot stands in the lane of what the check read. Green: the checkers that come with a proof of their own soundness. Times are as published, on a logarithmic axis: different machines, and no thread count for any of them. The hatched run ended without a verdict, which is not a rejection. The bottom rows give the other editions’ checks for context. Point at a check to read it with its source. As of 1 December 2026.

Across the 19 checks of the readable edition compiled here (18 published externally and none re-run for this series, plus one text scan run here), zero failed and one terminated without a verdict. Andrew Sutherland at MIT ran 12 of the 18, assisted by Claude Code according to his page header, with completion timestamps spanning 18:05 to 21:47 on 25 November in New York; six more come from the edition's own README; and the 19th is a keyword scan of the source text run for this series, a check of the kind Sutherland's page rightly calls "a precaution, not a proof". The last of Sutherland's 12 runs to finish was lake comparator --paranoid on a clean checkout: after 4 h 9 min 59 s on a 192-core server, it printed "Your solution is okay!". Two of those external checkers, con-leche and con-ron, carry formal soundness proofs whose scope and assumptions Section 13.8 examines; they verified all 216,571 exported declarations in 1 min 16 s and 1 min 9 s (thread counts unreported). The single inconclusive run stopped because lean4lean required 332 GB of RAM on this export while that machine had 128 GB, an out-of-memory halt that neither accepts nor rejects the proof. The authors' own run of Comparator v4.35.0, as noted in their README, used "a stand-in for its sandbox", and as of 1 December 2026 no third party beyond Sutherland had published an independent check of the readable edition.

Two entries in those verification logs rely on the weaker mechanisms identified earlier. First, both the authors and Sutherland ran the edition's #print axioms script from an importing file, the pattern vulnerable to the constructor-axiom omission of Section 13.6. Second, the lake env leanchecker <module> command in the README, along with Sutherland's module-by-module replay of all 803 .olean files, runs .olean replay, the deprecated first procedure of Section 13.4. Neither weakness affects the export-based checks: on our test exploits, nanoda (given an axiom whitelist), con-leche, and con-ron all rejected every unpermitted axiom in the flat export, and lake comparator enforces its configured whitelist directly on the export. Nothing points to a hidden axiom in the readable edition; the question was simply not tested directly here.

Meanwhile, a high-profile critique of the 20 November archive raised a completely different worry. According to the audit paper that answered it, a manuscript dated 20 November observed that an internal predicate named as if it encoded a deep geometric condition was actually defined inside the proof as the trivial constant True, and concluded on that basis that the archive "does not contain a proof of the Riemann Hypothesis". An independent audit posted a week later compiled the archive, confirmed that the internal predicate really was True, and explained why the conclusion does not follow.

We do not claim to understand the mathematics of the archive, and we do not claim that the Riemann Hypothesis is now settled. A kernel can have an implementation defect, imported declarations can be compromised, and a formal statement can fail to capture the intended claim. Those are real concerns. The lack of geometric meaning in an internal construction is not, by itself, one of them.

—Eryk Schiller, "Does a Trivially True Predicate Invalidate a Kernel-Checked Proof?" (27 November 2026). E. Schiller, "Does a Trivially True Predicate Invalidate a Kernel-Checked Proof? An Independent Build and Dependency Audit of the Alpöge Lean Archive for the Riemann Hypothesis", arXiv:2611.37492v1, a preprint that has not been peer-reviewed; Section I, the paragraph before the last. The critique it answers, a manuscript by J. L. Nielsen dated 20 November 2026, was not found for this series and is known here only through this paper's account of it.

Why does an internal True predicate alarm a human referee yet leave a kernel-checked theorem intact? In an informal paper, if Lemma 42 claims to establish a geometric property and Lemma 43 silently relies on the name of that property rather than its formal definition, discovering that "geometric" was defined as True collapses the bridge between the two lemmas. In Lean, Lemma 43 can use only what the formal definition of the predicate actually provides: defining an internal helper predicate as True gives downstream steps less information to extract, never more, so if the final proof of RiemannHypothesis still type-checks, downstream steps never needed that geometric condition in the first place. Stated generally, this is an immediate consequence of Proposition 13.1.2, which inspects only the final type \(T\) and the axioms reached, never the intended meaning of internal helper constants.

Proposition 13.7.1 (a trivial part does not weaken a theorem without hypotheses). Let a kernel that is sound in the sense of Proposition 13.1.2 accept c : T := e, with no hypotheses. Then the conclusion of that proposition holds whatever the constants inside \(e\) are called and whatever they were meant to express: a subterm of type True, an equality that holds by rfl, a structure with a field that nothing reads. And \(e\) is a term of type \(T\), not of type \(T = T\), which is another proposition and has a proof for every \(T\).

Formally, no typing rule ever consults the English name of an internal identifier. Nor does attaching an internal True premise make a deduction vacuous, because True → P is logically equivalent to P; only an unsatisfiable hypothesis on the final theorem itself creates vacuity, as in the backwards Goldbach premise n ∣ 2 of Section 13.6, and here riemannHypothesis has no hypotheses at all. What a True field inside a proof can be is dead weight, so Schiller's audit separates three precise questions about any suspect internal constant: whether it is reached in the dependency closure of the main theorem, whether any term actually takes it apart via a projection or recursor, and whether it is removable, meaning the development still compiles cleanly if the field is deleted.

miniature  the audit paper's own example, compiled by Lean 4.35.0 and replayed in this page (32 declarations)

           structure Certificate (n : Nat) where
             geo : True                                   the certificate: a trivially true field
             arithmetic : n = 2 + 3
           def witness : Certificate 5 := ⟨trivial, rfl⟩
           theorem certifiedArithmetic : 5 = 2 + 3 := witness.arithmetic

reaches    certifiedArithmetic → witness → trivial → True          39 constants under the theorem
never      Certificate.geo, .rec, .casesOn, .recOn, .mk._flat_ctor: declared with the structure, never reached

                                         reached        taken apart     removable
the miniature, the field geo             yes            no              yes: 29 declarations, the same statement
the miniature, the field arithmetic      yes            yes             no: Lean refuses the theorem
the original archive, its certificate    established    not detected    not established
  as its audit reports, not run here:    14 of 1,478,219 reached constants refer to the predicate, 0 to a recursor
the readable edition                     no source says, for any of the three
  searched here as text:                 none of the audit's 17 names in its 812 files, 479,613 lines
(the live figure needs JavaScript and loads about 0.2 MB of data and 0.3 MB of code)
A proof can carry a certificate that says nothing. The miniature is the audit paper’s own example, compiled by Lean 4.35.0 and replayed here: the field geo is True. Green: its proof, on its way from the theorem. Hatched list: what is declared with the structure and never reached, the field’s readers among them. Remove a field to see the theorem stand or fall. Three levels are kept apart: reached, taken apart, removable. Dots: found in this page, for the miniature only. Rings: what the audit reports of the original archive, not run here. For the readable edition, the one this series reads, no source says.

In the miniature, which is the audit's own example as Lean 4.35.0 compiled it, the page answers all three: the trivially true field is reached, none of the 39 constants under the theorem takes it apart, and without it the same statement is accepted, whereas without the other field Lean refuses the theorem. That holds of the miniature and of nothing else. For the archive of 20 November the audit reports the first as established and the second as not detected, and says that the experiment for the third was described and not run. It calls itself "not a certification of the claimed proof" and ends: "The defensible position is therefore not that the Riemann Hypothesis has been proved. It is that the critique has not shown that it has not." For the readable edition no source says whether the critique or the audit bears on it; a search of its text finds none of the names that the audit prints, which shows that those names do not occur in it and nothing more.

So a theorem that a sound kernel has checked does not depend on its intermediate objects meaning anything, and depends entirely on its statement meaning what is wanted. The audit names the price of the first half for the archive it read: if the conditions on the route are as weak as reported and the checks are sound, the content that forces the zeros onto the line "must sit somewhere else in the 1.48 million constants. We have not located it." Looking for it is a matter of understanding, not of certification (Section 14).

Certification has a debt of its own left: both propositions of this part assume a sound kernel.

Who checks the checker

Sections 13.1 to 13.7 moved the question whether 477,124 lines make a derivation to a program of 8,028 lines and its relatives. But a program that checks proofs because people err was itself written by people, and a survey of the field names the danger: "an infinite regress".J. Harrison, "Formal proof: theory and practice", Notices of the AMS 55(11), 2008, in the section on proof assistants: "we seem to be in danger of an infinite regress." The standard answer is decades older than Lean.

One may wonder whether proofs verified by a computer are at all reliable. Indeed, many computer programs are faulty. It was emphasised by de Bruijn that in case of verification of formal proofs, there is an essential gain in reliability. Indeed a verifying program only needs to see whether in the putative proof the small number of logical rules are always observed. Although the proof may have the size of several Megabytes, the verifying program can be small. This program then can be inspected in the usual way by a mathematician or logician. If someone does not believe the statement that a proof has been verified, one can do independent checking by a trusted proof-checking program. In order to do this one does need formal proofs of the statements. A Mathematical Assistant satisfying the possibility of independent checking by a small program is said to satisfy the de Bruijn criterion.

—Henk Barendregt and Freek Wiedijk, "The challenge of computer mathematics" (2005). Philosophical Transactions of the Royal Society A 363, 2005; Section 3, p. 12 of the authors' copy. The criterion is named for N. G. de Bruijn, who began the proof checker Automath around 1967; a history of the field cites Barendregt (1997) for the name.

Thus de Bruijn's answer halts the regress at a verifier small enough for humans to audit line by line. Whether Lean satisfies that ideal depends on how small "small" has to be.

Definition 13.8.1 (the de Bruijn criterion). A proof assistant satisfies the de Bruijn criterion if the proofs it accepts exist as objects that can be handed to a small program, written apart from the assistant, which checks them.

Lean meets this criterion through the JSON export format of Section 13.3 paired with standalone checkers from Section 13.4, such as Lean's 8,028-line C++ kernel or the 8,801-line Rust checker nanoda. As Barendregt and Wiedijk noted, requiring the kernel to evaluate programs internally to decide definitional equality (Section 6.3) "puts somewhat of a strain" on keeping the checker tiny: what takes a few hundred lines in a system without computation rules grows to roughly eight thousand lines here.

Human code inspection cannot guarantee zero bugs in eight thousand lines of C++, as July 2026 demonstrated (Remark 13.4.1). The stronger remedy is to verify the checker mathematically. con-leche implements a Lean export checker in Lean itself alongside a machine-checked soundness proof.

Theorem 13.8.2 (con-leche, as its README states it). Let \(V\) be a model of the set theory that the proof assumes: the axioms of Zermelo and Fraenkel without infinity and without choice, with a countable chain of Grothendieck universes \(U_0 \in U_1 \in \cdots\). If a run of the program on a file, in the idealized model of files and threads in which the proof is made, can end in acceptance, then the file parses and its declarations have a model in \(V\): an assignment of a set to each constant under which every constant is a member of its type. In particular no file that declares a theorem of type False is accepted.

According to its authors, that soundness proof is itself checked by Lean's kernel. Two boundaries circumscribe what Theorem 13.8.2 guarantees. First, the proof is relative to a strong set-theoretic hypothesis, guaranteeing soundness only if such a universe model \(V\) exists. Second, the theorem reasons about an idealized Lean model of file reading and multithreading rather than the compiled binary and operating system that actually execute ("con-leche is not bulletproof"), since real-world I/O and thread scheduling remain "out of reach for a completely rigorous verification". That compiler gap motivates con-ron, which translates con-leche into Rust together with a refinement proof so an exploitable compiler bug would have to strike Lean's C backend and the Rust compiler identically, though its README still cautions, "This is not a high assurance verification effort".The READMEs of github.com/leanprover/con-leche (sections "The Main Theorem", "Proofs about IO" and "Set theory assumption", where choice "is inherited from Lean as the meta-logic") and of github.com/leanprover/con-ron (section "Method"), as fetched on 1 December 2026; L. de Moura, "Lean Now Ships with Verified Kernels", 15 October 2026 (leodemoura.github.io), which says that the checker "was implemented and proven consistent by Claude (Fable and Opus), under heavy supervision by Joachim Breitner at the Lean FRO". As for the set-theoretic hypothesis, no formal consistency proof could avoid one: by Gödel's second incompleteness theorem (Section 3.5, and historically traced in The painted rock), a consistent foundational system cannot prove its own consistency without assuming a stronger ambient theory. Writing for mathematicians in October 2026, Thomas Hales summarized the ceiling in one sentence: "The most we might hope for is a relative consistency proof". At that time he knew "of no complete, public relative-consistency proof covering Lean abstract type theory", describing con-leche as establishing "a closely related consistency claim".T. Hales, "What mathematicians should know about the Lean Theorem Prover: questions of reliability and AI", guest post on Terence Tao's blog, 9 October 2026 (terrytao.wordpress.com), items 2 and 3 of its section "Bug extermination".

An older objection is to the whole enterprise. De Millo, Lipton and Perlis argued in 1979, against the formal verification of programs, that confidence in a theorem comes from a social process among mathematicians, and that a verification is too long and too shallow to be read; of verifications they wrote that "one either believes them blindly as a pure act of faith, or not at all". Pollack, who took the sentence as said of machine-checked proofs, replied that formal proofs have a social process of their own, "namely independent checking", and in November 2026 it ran in public on the archive of 20 November, with builds repeated by "dozens of people" and kernels in several languages, as the joint statement reports.R. A. De Millo, R. J. Lipton and A. J. Perlis, "Social processes and proofs of theorems and programs", Communications of the ACM 22(5), 1979, quoted here as Pollack quotes it in Section 1.2 of his report; his caveat is in its introduction. His own caveat stands beside the reply: machine-checked mathematics "depends on empirical knowledge about the physical world", on chips, compilers and operating systems, as a proof that a person reads does not.

What is left when all of it has been done, the reference manual lists in six lines, and each has had its place in this part.

what remains, in the manual's words where it stands
"The soundness of Lean’s logic." a model in set theory for the theory of Lean 3 (Section 6.6); for whatever con-leche accepts, Theorem 13.8.2
"The plumbing provided by the comparator tool is correct." 591 lines in the tool as published apart from Lean, at its version 4.35.0, and 1,011 in the judge that ships inside Lean 4.35.0 as lake comparator, with no proof about either; a second comparison by another rule exists in con-leche
"The sandbox used by comparator is secure." bubblewrap, outside Lean (Section 13.3)
"There is no implementation bug affecting all of the used checkers simultaneously." how independent the checkers are (Section 13.4)
"No human error or misleading presentation of the theorem statement in the trusted challenge file." a person reads (Sections 11.6 and 13.2)
"All requirements for using comparator have been met." trusted imports and configuration, a clean build (Definition 13.5.1)
The assumptions that remain after a positive judgment by the comparator, as the Lean Language Reference lists them in the section "Remaining Issues" of its chapter "Validating a Lean Proof" (as served on 1 December 2026), each beside the place where this part examined it.

At the smallest size the chain can be watched at work.

In Lean

What plain compilation lets through, export replay stops; what export replay lets through, statement comparison stops.

Example 13.9.1 (the chain in miniature). Two tiny files compiled with Lean 4.35.0 on the machine used for this series put all three stages on display: exporting with leanexport, replaying through two bundled kernels, and comparing statements with the standalone script from Section 13.5. First, Challenge.lean states that n + n is even with sorry as its proof, while Solution.lean supplies a genuine proof:

/-- `n` is twice some number. -/
def IsEven (n : Nat) : Prop := ∃ k, n = 2 * k

theorem isEven_add_self (n : Nat) : IsEven (n + n) := sorry
/-- `n` is twice some number. -/
def IsEven (n : Nat) : Prop := ∃ k, n = 2 * k

theorem isEven_add_self (n : Nat) : IsEven (n + n) := ⟨n, (Nat.two_mul n).symm⟩

#print axioms isEven_add_self

Lean compiles the second, the exporter writes the theorem with everything under it, and two kernels that never saw the source replay the file:

$ lean -o Solution.olean Solution.lean
'isEven_add_self' does not depend on any axioms
$ LEAN_PATH=. leanexport Solution -- isEven_add_self > solution.ndjson
$ leanchecker --from-export solution.ndjson
Lean default kernel accepts the solution
$ con-leche --verified --jobs=1 solution.ndjson
con-leche: accepted 67 declarations (--verified)

Even for a one-line fact about n + n, serializing every underlying natural-number and existential declaration produces a 2,251-line export covering 67 declarations. Next we try the metaprogramming bypass from Section 10.7, where a custom tactic switches off kernel checking for one declaration to slip a fake proof into the environment:

import Lean
open Lean Elab Tactic

/-- Adds a lemma stating the goal, proved by `True.intro`, with the kernel's check switched off for
that one addition, and closes the goal with the lemma. -/
elab "behind_its_back" : tactic => do
  let goal ← getMainGoal
  let type ← instantiateMVars (← goal.getType)
  let some thm ← Term.getDeclName? | throwError "no declaration"
  let name := thm ++ `unchecked
  let decl := Declaration.thmDecl { name, levelParams := [], type, value := mkConst ``True.intro }
  withOptions (debug.skipKernelTC.set · true) <| addDecl decl
  goal.assign (mkConst name)
  replaceMainGoal []

theorem two_eq_five : 2 = 5 := by behind_its_back

Plain lean compiles this file cleanly with exit code 0, and #print axioms two_eq_five reports zero axioms. Replaying the exported file from an empty environment catches the forgery immediately:

$ leanchecker --from-export behind.ndjson
Lean default kernel rejects the solution: while replaying declaration 'two_eq_five.unchecked':
(kernel) declaration type mismatch, 'two_eq_five.unchecked' has type
  True
but it is expected to have type
  Eq 2 5

con-leche refuses the same declaration, with invalid: type mismatch in theorem two_eq_five.unchecked. Neither the exit code of a build nor its list of axioms replaces the replay. When the kernel does refuse a theorem during a build, Lean keeps the refused name as an axiom (Section 10.7): a later theorem that cites it is accepted with that name in its list, and lean ends with an error and writes no compiled file.

The comparison is the one step that could not be made here with Lean's own tool. In a project that holds the two files and a configuration like that of Section 13.5, the command is lake comparator --config comparator.json. Asked of the files of Section 13.6, it stopped before judging:

error: `lake comparator` needs `bwrap` to sandbox the code it checks, and it was not found.

The stand-in of Section 13.5, given the exports of Challenge.lean and Solution.lean, answers:

accepted: isEven_add_self
  yes  the solution declares it as a theorem
  yes  the statement is the challenge's
  yes  every constant under the statement is the same in both
  yes  every axiom under the proof is permitted

With IsEven redefined as True and the theorem proved by trivial, Lean compiles the file, #print axioms lists nothing, both kernels accept the export, and only the comparison objects, at its third line: the definition of IsEven differs. ◁

"Checked in Lean" says that a term of the stated type exists in a stated environment, according to named programs. Each further word of confidence rests on a link that can be audited apart from the others: the statement by reading it, the definitions and the axioms by comparing two exports, the kernel by running other kernels on the same file, the build by repeating it in a sandbox. None of the links says why the statement should hold.

That is where a certificate stops. How to read a proof that programs have accepted and nobody has explained is the question of Section 14.

← Back to all posts