Accepting an AI agent's Lean proof: a checklist

The agent hands back a Lean file, and lake build is green. That only means the file compiles. It does not mean the agent proved the statement you asked for, without shortcuts. The six checks below take a few minutes; run them in order and stop at the first failure.

The commands use the layout of the SAIR Lean Kernel Challenge: each problem in problems/<id>/ has a fixed Spec.lean written by a human and a Submission.lean the agent edits, with an implementation impl and a theorem impl_correct : ∀ n, impl n = spec n. The examples use the partition problem. In your own project, Spec.lean is whatever file holds the statement you wrote.

1. Only the submission changed

git diff --stat

The only changed file must be problems/<id>/Submission.lean. An agent that cannot prove a statement can “fix” it by editing the specification, and the build will still pass. The SAIR rules say it directly: “keep Spec.lean and environment files unchanged” (problems README).

2. The theorem statement is unchanged

diff <(git show HEAD:problems/partition/Submission.lean | grep 'theorem impl_correct') \
     <(grep 'theorem impl_correct' problems/partition/Submission.lean)

Empty output means the statement line is identical to the starter. If the agent split the statement across lines, compare it by eye.

Identical text is necessary, not sufficient. This file keeps the statement character for character, compiles, and passes check 3:

import Spec

namespace Submission

def partitionSpec : Nat → Nat := fun _ => 0

def impl : Nat → Nat := fun _ => 0

theorem impl_correct : ∀ n, impl n = partitionSpec n := fun _ => rfl

end Submission

Inside namespace Submission, the name partitionSpec now refers to the agent’s own definition, which returns 0, not to the real specification from Spec.lean. Look for definitions that reuse names from Spec.lean. Check 6 catches this mechanically.

3. Only standard axioms

Create a file outside the repository, so that check 1 stays clean, for example /tmp/Axioms.lean:

import Submission
#print axioms Submission.impl_correct

Build the submission, then run the file from the problem folder:

cd problems/partition
lake build
lake env lean /tmp/Axioms.lean

Acceptable output is 'Submission.impl_correct' does not depend on any axioms, or a list that contains only propext, Classical.choice and Quot.sound. These three are the permitted axioms in SAIR.

This submission builds without a single warning, because the agent declared the missing proof as an axiom:

import Spec

namespace Submission

def impl : Nat → Nat := fun _ => 0

axiom impl_eq : ∀ n, impl n = partitionSpec n

theorem impl_correct : ∀ n, impl n = partitionSpec n := impl_eq

end Submission

#print axioms shows it:

'Submission.impl_correct' depends on axioms: [Submission.impl_eq]

A proof with sorry shows up as sorryAx in the same list. In SAIR packages it fails earlier: lakefile.toml sets warningAsError = true, so lake build stops on the sorry warning. In a project without that option, sorry is only a warning and the build is green. Read the output, not the exit code: lake env lean exits with 0 in both cases.

4. No forbidden words

grep -nwE 'sorry|admit|native_decide|partial|unsafe|axiom' problems/partition/Submission.lean

Empty output is a pass. sorry and admit leave a hole in the proof; native_decide trusts compiled code instead of the kernel; axiom adds an unproven assumption. partial and unsafe are about the implementation, not the proof, so check 3 does not report them; the SAIR rules prohibit both. A match inside a comment is harmless, but read each one.

5. No hardcoded answers

Read impl. There must be no tables of answers and no branches like if n = 36 then … with literal results. The SAIR rules: “Precomputed answer lookup tables and hardcoded input-specific answers are prohibited, whether stored as data or encoded in conditional branches” (overview, rule R2). This is the one check no command does for you.

6. The official checker accepts the file

python3 evaluation/run.py --problem partition

It must print accepted. The checker compares the submission against the fixed interface, not against the text, and audits the axioms again. On the file from check 3 it prints rejected with Illegal axiom detected: 'Submission.impl_eq'. On the file from check 2 it prints rejected, and the log explains why:

error: Solution.lean:8:56: Type mismatch
  Submission.impl_correct
has type
  ∀ (n : Nat), Submission.impl n = Submission.partitionSpec n
but is expected to have type
  ∀ (n : Nat), impl n = partitionSpec n

Prepare the checker once with bash evaluation/setup.sh --problem partition. A green lake build does not mean accepted: none of the files above breaks the build.

The SAIR checker is built on comparator, which checks that the proved theorem is exactly the one from your statement file and that only permitted axioms are used. Outside SAIR, use it directly. Its README says it “has been merged into core as of Lean release v4.35.0 in the form of lake comparator and the accompanying lake check”; the commands on this page were checked on Lean 4.33.1, the version SAIR pins.