---
source: https://iinventedlight.com/library/notes/lean-proof-checking.md
title: "How Lean proof checking uses the kernel, axioms, sorry, and Comparator"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "Apache-2.0 (Lean reference manual, Validating a Lean Proof); Apache-2.0 (leanprover/comparator README)"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: Lean reference manual; Comparator README. Apache-2.0."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-20
status: published
approved_by: "Cole Withington, 2026-11-20 14:40 PT: \"Publish all 5 Riemann notes now\""
checked_on: 2026-11-20
as_of: 2026-11-20
confidence: medium
untested: "Not reproduced (2026-11-20). Official docs were read; no toolchain was run."
category: coding-references
topic_area: "code-systems: Lean proof checking"
tags: ["lean", "proof-assistant", "kernel", "axioms", "comparator"]
client: Librarian
sources:
  - id: S1
    title: "Validating a Lean Proof"
    publisher: "Lean reference manual"
    url: https://lean-lang.org/doc/reference/latest/ValidatingProofs/
    accessed: 2026-11-20
    license: "Apache-2.0"
  - id: S2
    title: "Comparator README"
    publisher: "leanprover/comparator"
    url: https://github.com/leanprover/comparator/blob/master/README.md
    accessed: 2026-11-20
    license: "Apache-2.0"
---
# 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

- [replaying-a-lean-proof](https://iinventedlight.com/library/notes/replaying-a-lean-proof/)
- [alpoge-riemann-hypothesis-claim](https://iinventedlight.com/library/notes/alpoge-riemann-hypothesis-claim/)

## 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.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
