Skip to content
Docs
Download Markdown
In this article

Verify a formal proof task

Use Lean to check the exact theorem and reject incomplete proofs.

Download Markdown

Use the task-package specification to choose the package layout and record evidence for the exact revision.

Give the solver the exact statement to prove, and pin the Lean toolchain and allowed imports. This example uses an original natural-number equality. Lean proof validation

Author and verify

Keep a verifier-owned declaration with the target type. Check that the submitted proof inhabits that type and inspect the axioms it depends on. Here the Tier 2 reference is the proof checker and its pinned environment. Decide the allowed axiom set before calibration. Use a separate rubric if the clarity of the explanation also matters.

Calibrate and correct

Run a complete proof, an incomplete proof and a proof of a different statement. Pin the theorem, checker and imports for every trial. A rejected proof is a failed check. A missing toolchain is an infrastructure error. If a placeholder or an unapproved axiom passes, tighten the verifier and rerun all controls.

Worked example

Use Lean 4.19.0 from the official release. Run these commands in a new directory. The complete proof should compile and report no axioms. The incomplete proof and the proof of another theorem should be rejected. Lean 4.19.0 release

set -eu
cat > Complete.lean <<'EOF'
theorem submitted (n : Nat) : n + 2 = (n + 1) + 1 := by rfl
theorem checked : ∀ n : Nat, n + 2 = (n + 1) + 1 := submitted
#print axioms checked
EOF
lean -DwarningAsError=true Complete.lean > complete.txt
grep -Fx "'checked' does not depend on any axioms" complete.txt

sed 's/by rfl/by sorry/' Complete.lean > Incomplete.lean
if lean -DwarningAsError=true Incomplete.lean > incomplete.txt 2>&1; then
  echo "Incomplete proof passed" >&2
  exit 1
fi
grep -F 'uses' incomplete.txt
cat > Wrong.lean <<'EOF'
theorem submitted (n : Nat) : n = n := by rfl
theorem checked : ∀ n : Nat, n + 2 = (n + 1) + 1 := submitted
EOF
if lean -DwarningAsError=true Wrong.lean > wrong.txt 2>&1; then
  echo "Wrong theorem passed" >&2
  exit 1
fi
grep -F 'type mismatch' wrong.txt
printf '%s\n' 'complete proof pass, incomplete and wrong-theorem proofs fail'

For a package verifier, keep the target declaration and axiom policy outside the solver's output. Compile in the isolated environment you pinned for the taskA specific item a contributor claims or enters.