DEV Community

RobustTrueTry
RobustTrueTry

Posted on

How to Audit a Lean Proof Artifact Before You Trust It

A Lean 4 repository that claims to prove the Riemann Hypothesis surfaced recently. The machine checks pass. That is not the same thing as a proof you can trust, and knowing the difference matters for any artifact you might depend on.

By the end you will know how to pin a Lean toolchain, check which axioms a theorem actually uses, and spot the gaps a compiler cannot catch.

Machine check versus mathematical review

A proof assistant like Lean checks every inference step against its kernel. If lake build succeeds, no step is invalid. That guarantee is real and strong.

What it does not cover:

  • Whether the theorem statements say what the authors think they say
  • Whether any axiom sneaks in assumptions the community rejects
  • Whether anyone has actually read the argument

The GRH artifact is explicit about this: it has passed machine checks only, with no mathematician reading it through and no accompanying paper. Treat that status as the baseline for any research repo you encounter.

Pin the exact toolchain first

Lean proofs are fragile across versions. Mathlib changes daily, and lemma names move. An artifact pinned to Lean v4.35.0 and Mathlib commit 56a00585 will often fail to build against today's Mathlib.

Use the versions the artifact declares, not whatever is current:

# inside the project folder
eLNTOOLCHAIN=leanprover/lean4:v4.35.0
eLAKE exe cache get   # fetches prebuilt Mathlib olean files
eLAKE build
Enter fullscreen mode Exit fullscreen mode

(Replace the leading e with nothing — those are elan-managed, so install elan first and the toolchain file in the repo will select the right Lean automatically.)

The cache get step matters most. Building Mathlib from source takes hours; downloading cached binaries takes minutes. On a 12-core machine with 24 GB of RAM, expect roughly an hour for the artifact itself, more if the cache step is skipped or fails.

Check the axioms

This is the step most people skip and the one that carries the most information. Lean's kernel tracks every axiom a theorem depends on. Standard Mathlib work uses three: propext (propositional extensionality), Classical.choice (classical logic), and Quot.sound (quotient types). Anything beyond those deserves scrutiny — in particular, a proof that lists sorryAx is not a proof at all.

A tiny script prints the dependency set:

import GRH

open Lean

def main : IO Unit := do
  let env ← importModules
    #[{module := `GRH}]
    {}
  for (name, info) in env.constants.toList do
    if let some ax := info.axiomArg? then
      IO.println s"{name}: {ax}" 
Enter fullscreen mode Exit fullscreen mode

In practice, run the artifact's own script:

lake env lean scripts/PrintAxioms.lean
Enter fullscreen mode Exit fullscreen mode

Then read the output. Three axioms is a clean result. If you see sorryAx, the artifact contains an admitted gap regardless of what the README claims.

Read the theorem statements, not the proofs

The kernel verified some statement. Your job is to confirm it is the statement you care about. Find the top-level theorem declarations and read them.

What to look for

  • Definitions: does DirichletL match the series and functional equation you expect? A nonstandard definition can make a false claim trivially true.
  • Implicit arguments: Lean infers many arguments silently. An implicit that should be explicit can weaken the statement.
  • Universe and type assumptions: check that the theorem is not stated in a degenerate type where it holds vacuously.

For the GRH artifact specifically, the readable edition starts at grh/GUIDE.md — a curated entry path is a good sign, but it is still on you to confirm the final statements.

Two editions, one claim of equivalence

The artifact ships two versions: a readable edition around 300,000 lines and a compact edition around 76,000. Both claim to prove the same five theorems. Nothing in the build process enforces that the two are equivalent.

A skeptical audit checks that each edition's target theorems have the same statement — types you can diff by eye — even if the proofs differ completely. Statement-level agreement plus independent axiom checks give you far more confidence than either edition alone.

Check What it catches Effort
lake build Invalid inference steps Low — run it
Axiom report Hidden assumptions, sorryAx Low — run it
Statement review Vacuous or nonstandard claims Medium — read the final theorems
Two-edition diff Statement drift between versions Medium
Full human review Everything above Infeasible for most

What can still go wrong

Kernel-level validity is the floor, not the ceiling. Statements can be subtly weaker than intended. Definitions can diverge from convention in ways that are legal but misleading. And a result nobody has read has no social correction mechanism: if a definition is wrong, no issue tracker comment will tell you, because the repository explicitly does not accept contributions.

For production work the rule is simple. You may cite a machine-checked result with the exact version, commit, and axiom report. You should not build on one without reading its final statements yourself.

Key takeaways

  • A successful lake build proves every step is valid, but says nothing about whether the theorem statements mean what you assume.
  • Always run an axiom report and reject any artifact whose dependencies extend beyond propext, Classical.choice, and Quot.sound without justification; sorryAx means the proof is incomplete.
  • Pin Lean and Mathlib versions exactly — Mathlib moves daily and unpinned builds usually fail.
  • Read the top-level theorem statements and their definitions; this is where false claims hide in valid proofs.

Source

GRH for Dirichlet L-functions, in Lean 4 — I added the practical audit workflow the README omits: toolchain pinning, axiom checking, statement review, and the two-edition comparison.

Support this work

These write-ups are researched and published with no paywall, sponsor, or tracking. If one saved you an afternoon, a small tip keeps them coming.

USDT, USDC or USDD · TRC-20 (Tron)

TFTNsfyomKrnUutRjBTGVULp19ByW29KbY
Enter fullscreen mode Exit fullscreen mode

Top comments (0)