# What "Lean-verified" means

## The question

When a result is called "Lean-verified", what exactly has been checked?

## Why it matters

Results are more and more often described as "Lean-verified". A reader needs to know what that label promises before relying on it.

## What answering it would help with

A shared, exact meaning of the label lets readers and authors say what was checked and what was not.

## What our research shows

**The answer in one line:** given the definitions and axioms in scope, Lean's kernel accepted this proof of this statement. Nothing more is promised.

### The idea in one paragraph

Lean is a proof assistant. You write a mathematical statement and a proof in a precise language. A small program inside Lean, the **kernel**, then checks every step of the proof against Lean's rules, starting from the definitions and **axioms** (starting assumptions) that are in scope. If the kernel accepts, the statement follows from those definitions and axioms by the rules. That is the guarantee, and it is a strong one: it does not depend on trusting the person who wrote the proof, or the tactics (helper programs) that helped build it, because the kernel's verdict is the one that counts at the end.

### What is checked, step by step

1. **The statement is read.** Lean turns the text of a theorem into a precise internal form. For example 2 + 2 = 5 is read as a statement about natural numbers (0, 1, 2, ...) unless something says otherwise. Which symbol means what is decided by the definitions in scope. The kernel does not choose these; it only checks what it is handed.
2. **The proof is checked.** The kernel checks that the proof really proves that statement. A proof that does not is rejected with an error.
3. **The axioms can be listed.** A command prints the axioms a theorem depends on, directly or through other theorems:

```
#print axioms theoremName
```

   Lean's reference manual says a clean result uses only three standard axioms:

```
propext
Classical.choice
Quot.sound
```

   Anything else tells you something. The special axiom sorryAx means a sorry (a placeholder for a missing proof) is somewhere underneath. A name ending in a native-computation marker means the proof used native computation. Any other name is an axiom someone added, and the theorem is valid only if that axiom is.

The axiom report **reads** what is stored. It does not check anything again.

### Checking again

Two kinds of re-check exist.

- **A replay with the same kernel.** leanchecker ships with Lean. After a build it reads the compiled files and sends every stored declaration through the kernel again. This catches a declaration that was stored without ever going through the kernel (chapter 3 shows one). Its own documentation says it is not an external verifier, only a tool for detecting tampering with the environment. It uses the same kernel code, so it cannot catch a mistake in the kernel itself.
- **A different kernel.** Lean can export a proof as plain text, and other programs can check that text with a kernel written separately: **nanoda** (written in Rust) and **lean4lean** (the kernel written again, in Lean itself). If two kernels written by different people agree, a bug in one is unlikely to be present in the other. Chapter 4 explains how far that helps.

The Lean reference manual lists these as an escalating sequence: the check marks in the editor, then the axiom report, then re-checking, then external checkers. Which step is enough depends on whether you are guarding against honest mistakes or against someone who is trying to mislead.

### Yesterday, today, tomorrow

**Yesterday.** Leonardo de Moura and the Lean community built Lean around a small kernel, so that trust rests on a short piece of code and not on every proof author. Kim Morrison and Sebastian Ullrich wrote the replay tool that became leanchecker, Mario Carneiro wrote lean4lean, and ammkrn wrote nanoda. The Lean reference manual has a chapter, "Validating a Lean Proof", that sets out the checks in order.

**Today.** I read "Lean-verified" as a claim with a precise meaning: given these definitions and these axioms, the kernel accepted this proof of this statement. Chapter 3 shows, with real output, what that does and does not rule out.

**Tomorrow.** Each Lean result I publish can say which of the checks above it passed, in the same words every time. A result that passed only the checks in steps 1 and 2 is labelled that way.

## Check it yourself

The checks named in this chapter (the build, the axiom report and leanchecker) are run on seven small files in [the check guide](../VERIFY.md), each with its command and expected output.

## Where to go next

- What can a "Lean-verified" result still get wrong even when every step above passes? See [What "Lean-verified" does not mean](02-what-it-does-not-mean.md).
- What does it look like when a clean build says 2 + 2 = 5? See [Five ways to get 2 + 2 = 5 past a build](03-two-plus-two-is-five.md).
