A green Lean build can still hide a sorry. I built a one-command audit for your proof artifact.
A proof assistant can say a proof is correct and still be wrong about what was proved. A file can build green while it contains a sorry, rests on an axiom nobody disclosed, or proves a weaker statement than the one annou
A proof assistant can say a proof is correct and still be wrong about what was proved. A file can build green while it contains a sorry, rests on an axiom nobody disclosed, or proves a weaker statement than the one announced. I built a one-command check that audits a Lean 4 proof artifact before you trust it.
Why a green build is not enough
Three facts, all verified live on 2026-11-29:
- Bernstein's "False computer-checked proofs" (version 20261125, cr.yp.to/proofs/falseccp.html) lists reported soundness bugs by checker: HOL Light 3, Mizar 7, Metamath 9, Isabelle 20, Lean 3/4 23, HOL98/HOL4 24, Coq/Rocq 111. These are bugs reported, not the total that exist, and a bug can be shared between checkers.
- The Lean manual ("Validating a Lean Proof", lean-lang.org) says the blue check-mark still shows when a dependency uses
sorry- only#print axiomsrevealssorryAx. It counts unreviewed AI-generated proofs as the malicious case. - de Moura: "Proof assistants guarantee that proofs are correct, but correctness alone is not enough. Someone has to read the theorem statements and confirm they capture the intended mathematics."
The manual's answer is a 3-fact audit: the build is clean, the statement matches the claim, and the axioms are clean. The problem is that the audit lives in prose. There is no single command that runs it, prints a verdict, and fails a CI gate. So I turned the guide into a CLI.
What I built
proofcheck is a zero-dependency TypeScript CLI (Node 20+). It scans a Lean 4 proof artifact, checks 7 rules, and prints a verdict - VERIFIED, NEEDS-REVIEW, or NOT-CHECKED - with an exit code your CI gate can use. It runs no code from the artifact itself.
git clone https://github.com/techdevfun/proofcheck.git
cd proofcheck
npm install
npm run build
node dist/cli.js audit my-proof
Five commands: init (scaffold config + claim), audit (full table + verdict), check (one line + exit code for CI), diff (compare against an approved baseline), explain (each rule, with sources and dates).
You write a claim.json first - the theorem name, the statement as announced, the Lean version it must pin:
{
"theorem": "two_plus_two",
"statement": "theorem two_plus_two : 2 + 2 = 4",
"leanVersion": "leanprover/lean4:v4.33.1",
"mathlibVersion": "56a00585",
"allowedAxioms": [],
"disclosedNativeDecide": false,
"source": "link to the paper or announcement stating this theorem"
}
Then audit checks the artifact against that claim, not against itself.
The 7 rules
| Rule | Severity | What it checks |
|---|---|---|
| P1 NO-SORRY | HIGH | No sorry / admit / sorryAx in any .lean file except .lake/ and lakefile.lean
|
| P2 NO-NATIVE-DECIDE | MEDIUM | No native_decide / Lean.trustCompiler / @[implemented_by] unless disclosed in the claim or config |
| P3 AXIOM-INVENTORY | HIGH | No non-standard axiom evidence: no sorryAx, no used custom axiom. The standard set is propext, Classical.choice, Quot.sound
|
| P4 STATEMENT-MATCHES-CLAIM | HIGH | The theorem statement in the file matches claim.json after whitespace normalization |
| P5 TOOLCHAIN-PINNED | MEDIUM | A lean-toolchain file exists and matches the version in claim.json; a pinned Mathlib revision must appear in the lakefile |
| P6 CHECKER-VERSION-KNOWN-BUGS | MEDIUM, warn-only | Warns with the count of reported soundness bugs for this Lean version from the Bernstein snapshot (version 20261125). Never fails the verdict |
| P7 NO-CUSTOM-AXIOM-DECL | MEDIUM | No self-declared axiom in the artifact unless it is in the claim/config allowlist |
Verdict: NOT-CHECKED if any HIGH rule fails; NEEDS-REVIEW if only MEDIUM rules fail or a rule is skipped (for example no claim.json); VERIFIED if everything passes. P6 is warn-only and never fails a verdict.
It catches the real shapes
A clean artifact:
$ proofcheck audit examples/clean-proof
proofcheck audit examples/clean-proof
Lean files scanned: 1
Claim: two_plus_two (claim.json)
P1 NO-SORRY PASS [HIGH] no sorry/admit/sorryAx in 1 Lean file(s)
P2 NO-NATIVE-DECIDE PASS [MEDIUM] no native_decide / trustCompiler / implemented_by
P3 AXIOM-INVENTORY PASS [HIGH] static inventory: no non-standard axiom evidence; standard axioms assumed: propext, Classical.choice, Quot.sound (full inventory needs --recheck with a Lean toolchain).
P4 STATEMENT-MATCHES-CLAIM PASS [HIGH] statement of "two_plus_two" matches claim.json (whitespace-normalized).
- Main.lean:4: theorem two_plus_two : 2 + 2 = 4
P5 TOOLCHAIN-PINNED PASS [MEDIUM] lean-toolchain pins leanprover/lean4:v4.33.1.
P6 CHECKER-VERSION-KNOWN-BUGS WARN [MEDIUM] Lean 3/4 has 23 reported soundness bugs (Bernstein snapshot version 20261125, checked 2026-11-29). A reported bug is not proof this artifact is affected - warn only.
- source: https://cr.yp.to/proofs/falseccp.html
P7 NO-CUSTOM-AXIOM-DECL PASS [MEDIUM] no custom axiom declarations
Verdict: VERIFIED
VERIFIED means no gaps were found by the 7 static rules - it does not prove the theorem is true; a human must read the statement.
A sorry hiding in a dependency file - the exact case the Lean manual warns about, where the blue check-mark still shows:
$ proofcheck audit examples/sorry-proof
proofcheck audit examples/sorry-proof
Lean files scanned: 2
Claim: two_plus_two (claim.json)
P1 NO-SORRY FAIL [HIGH] 1 sorry/admit/sorryAx hit(s) - the proof has a hole even if it builds green.
- Dep.lean:4: sorry
P2 NO-NATIVE-DECIDE PASS [MEDIUM] no native_decide / trustCompiler / implemented_by
P3 AXIOM-INVENTORY FAIL [HIGH] non-standard axiom evidence: sorryAx (via sorry/admit).
- Dep.lean:4: sorry
P4 STATEMENT-MATCHES-CLAIM PASS [HIGH] statement of "two_plus_two" matches claim.json (whitespace-normalized).
- Main.lean:4: theorem two_plus_two : 2 + 2 = 4
P5 TOOLCHAIN-PINNED PASS [MEDIUM] lean-toolchain pins leanprover/lean4:v4.33.1.
P6 CHECKER-VERSION-KNOWN-BUGS WARN [MEDIUM] Lean 3/4 has 23 reported soundness bugs (Bernstein snapshot version 20261125, checked 2026-11-29). A reported bug is not proof this artifact is affected - warn only.
- source: https://cr.yp.to/proofs/falseccp.html
P7 NO-CUSTOM-AXIOM-DECL PASS [MEDIUM] no custom axiom declarations
Verdict: NOT-CHECKED
VERIFIED means no gaps were found by the 7 static rules - it does not prove the theorem is true; a human must read the statement.
Three more shapes are locked in tests: a statement mismatch (the file proves an instance, the claim announces a general statement - P4 only, NOT-CHECKED), an undisclosed native_decide (P2 only, NEEDS-REVIEW), and a false custom axiom declared and used (P3 + P7, NOT-CHECKED).
Drift: catch the second sorry
diff compares the current audit against an approved baseline:
proofcheck audit --json my-proof > baseline.json
# ... later, or after a PR ...
proofcheck diff --baseline baseline.json my-proof
Exit 1 when a rule regresses from PASS to FAIL, when a new sorry appears, or when the statement or axiom set drifts. A second sorry is caught even when the first one was already failing at baseline.
Recheck: the real toolchain when you have one
Static scanning is the core and runs everywhere. audit --recheck is a bonus: when lean / lake are on PATH, proofcheck also runs lake build in the artifact directory and reports pass/fail. When no toolchain is present it skips cleanly with a note and never fails the audit for that. proofcheck never runs code from the artifact itself: --recheck only calls lean / lake on files you point it at.
Where rivals beat us
-
Lean itself (
lake build,#print axioms) is the checker, and the kernel is the final source of truth. proofcheck only reads their results (or scans statically when no toolchain is present). It does not replace the checker, and the manual's 3-fact guide goes deeper on independent reproduction and on reading a statement like an expert. - leanchecker replays compiled results through the kernel independently of Lean - stronger as a second checker. proofcheck is a re-checker of a different kind: it does not replay anything, it scans the artifact, inventories the axioms against a claim, diffs the statement, and gives a verdict. Multi-checker verification is on the roadmap.
- LeanWarp is a hosted verification service: you upload the artifact and it verifies it for you. That is convenient, and it is also a dependency on someone else's server and someone else's queue. proofcheck is local: it runs on your machine, in your CI, with no upload and no account.
- lean-goal is an LSP plugin that helps you write and explore proofs inside your editor. It is a development aid, not a CI gate: it does not scan an artifact, diff a statement against a claim, or fail a build with an exit code.
- proofcheck is the local combined 3-fact audit CLI: clean build + statement matches the claim + clean axioms, one command, one verdict, one exit code. It does not judge whether a theorem is true.
Honest limits
- A VERIFIED verdict is not "this theorem is true". It is "no gaps found by the 7 static rules". A human must still read the statement.
- P3 inventory is declaration-level: it can prove a non-standard axiom is present, not that the full axiom set is exactly the 3 standard ones. The full inventory needs
--recheckwith a real Lean toolchain. -
--recheckneeds a real Lean toolchain on PATH. The live path against a real toolchain has never been exercised - only stub-tested - so treat a recheck pass as a bonus signal, not as the audit itself. - Statement comparison is textual (whitespace-normalized). It can miss a subtle semantic difference, so the diff prints both sides for a human to read.
- The soundness-bug snapshot is frozen at Bernstein version 20261125. New bugs reported after that date are not in it, and P6 warns only.
- Checkers share bugs, and a checker bug can in principle let a false statement through every checker. Multi-checker runs are a roadmap item, not in v0.1.0.
- proofcheck makes no claim about any real mathematical claim (Riemann, discrete logarithm, or any other). It audits only the artifact it is given.
Install
Install from source for now - the npm package is not published yet:
git clone https://github.com/techdevfun/proofcheck.git
cd proofcheck
npm install
npm run build
44 tests (unit + e2e), tsc strict, eslint + prettier clean. The repo is github.com/techdevfun/proofcheck. If you review Lean proofs - yours, a colleague's, or one an AI agent just handed you - run it in CI before you trust the artifact. The green build was never the whole audit.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.