How Lean proof checking uses the kernel, axioms, sorry, and Comparator
Answer: The Lean kernel can accept a proof of a stated theorem. List the axioms that the theorem depends on. For a possibly malicious proof, use Comparator with a trusted challenge.
The kernel and everyday checks
The Lean manual has a section on validating a proof. In everyday use, blue double check marks next to a theorem are the usual sign that checking succeeded. Those marks mean the statement was elaborated, and that the Lean kernel accepted a proof of it. Building the module with lake build, with no error or warning, gives the same guarantees. This protects against an incomplete proof of the current theorem, and against explicit use of sorry there. Marks can still appear if a dependency contains sorry.
Axioms and sorry
Sorry and incomplete proofs are elaborated to axioms. You can detect them by listing the axioms a proof relies on. After the theorem, use #print axioms thmName, and check that only the built-in axioms propext, Classical.choice, and Quot.sound are reported. Those three are standard in Lean's logic, and are described as benign. If sorryAx is reported, the theorem or a dependency uses sorry, or is incomplete. Any other axiom means a custom axiom was declared, or that native evaluation was used.
Comparator-style statement checking
When a purported proof may be malicious, the manual recommends Comparator. First write a challenge file in a trusted environment, containing the theorem statements with sorry in place of proofs. A solution file then supplies the same theorems with proofs attached. If the run meets the requirements, the statements match exactly, the configured kernels accept the proofs, and no axioms outside the permitted list are used. The usual permitted axioms are propext, Quot.sound, and Classical.choice. In a malicious situation, invoke the tool with the --paranoid flag, so several independently written kernels check the result. Nanoda is one such external checker. As of Lean release v4.35.0, the project has been merged into core in the form of lake comparator. The run still trusts the challenge, sandbox, and kernels.
See also
Claims
- id: C1 claim: The Lean reference manual explains how to validate a proof expressed in Lean. source: S1 evidence: "This section discusses how to validate a proof expressed in Lean."
- id: C2 claim: The three built-in axioms named above are treated as standard and benign. source: S1 evidence: "The three axioms above are standard axioms of Lean's logic, and benign."
- id: C3 claim: Comparator is presented as a judge for checking Lean proofs against a challenge. source: S2 evidence: "Comparator is a trustworthy judge for Lean proofs."
Sources
- [S1] https://lean-lang.org/doc/reference/latest/ValidatingProofs/ (Apache-2.0)
- [S2] https://github.com/leanprover/comparator/blob/master/README.md (Apache-2.0)
License: CC BY 4.0. Summary by iinventedlight (AI-assisted). Sources: Lean reference manual; Comparator README. Apache-2.0.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Lean reference manual; Comparator README. Apache-2.0.
Cite this
iinventedlight. 2026. "How Lean proof checking uses the kernel, axioms, sorry, and Comparator." iinventedlight Library, iil:note:dezax79s, version of 2026-11-20. https://iinventedlight.com/library/notes/lean-proof-checking/. License: CC-BY-4.0.
@misc{iil_note_dezax79s,
author = {{iinventedlight}},
title = {{How Lean proof checking uses the kernel, axioms, sorry, and Comparator}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-20},
url = {https://iinventedlight.com/library/notes/lean-proof-checking/},
note = {Permanent ID iil:note:dezax79s. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/lean-proof-checking.md.