The AI Proof That Wasn't Finished
An AI system produced a Lean formalization of a competition problem. The proof checker accepted four helper lemmas — and the main theorem rests on a single sorry. What the kernel actually certified, declaration by declaration.
The question
A paper published in May 2026 describes formalizing a hard olympiad problem in Lean with the help of an AI theorem-proving service. Its artifact contains definitions, four helper lemmas, and a main theorem stating the problem. A hurried headline would write itself: AI proves competition problem in Lean.
That headline would be false, whatever the paper itself says (this chapter
reports what the kernel certified, not what anyone claimed). The main
theorem’s proof is a single sorry, Lean’s explicit marker for “assumed
without proof”. The proof assistant accepted the file, and
reported, for anyone who asked, that the headline result depends on an axiom
asserting any proposition whatsoever. Four lemmas are genuinely proved. The
theorem is not.
This chapter is about the difference between those two sentences, and about the mechanical procedure that tells them apart.
The question this investigation asks is not whether that mathematics is true. It is narrower and fully mechanical: of the declarations in the published artifact, which ones did the Lean kernel accept without unproved assumptions?
That question has a definitive answer, because Lean can print it. For every
declaration, #print axioms lists exactly what the proof used. A proof that
goes through honestly lists only Lean’s standard logical axioms. A proof that
passes through sorry lists sorryAx — an axiom from which anything follows.
The setup
The problem is the “grasshopper” problem from the 2009 International Mathematics Olympiad, as formalized by G. R. Lau using the Aristotle API for AI-assisted theorem proving (arXiv:2605.20120v1, May 2026). Roughly: given distinct positive jump lengths and a forbidden set $M$ smaller than the number of jumps, whose total is not itself forbidden, there is an ordering of the jumps whose partial sums all avoid $M$.
The artifact travels inside the paper’s own arXiv e-print (pinned by hash in the audit record). It is small: one 124-line Lean file plus a 24-line options file that the main file does not even import, built against Lean 4.28 with the pinned Mathlib revision. Its declarations are:
- two abbreviations,
PS(partial sums of a permuted jump sequence) andG; - four helper lemmas:
PS_last,PS_swap,PS_swap_eq, andmaximizer_swap_in_M; - the main theorem
grasshopper, whose proof is the single wordsorryon line 122 — visible in the text before any kernel runs.
No licence statement was found on the paper’s page or in the e-print, so this book does not reproduce the artifact’s code. Everything reported here — declaration names, short identifiers, hashes, and the kernel’s own verdicts — can be stated without quoting it.
Run it
The audit rebuilds the artifact’s toolchain in an isolated image (separate from the book’s main Lean environment, which uses a different Lean/Mathlib revision) and compiles five variants of the file, each with a generated footer that prints every declaration’s axioms and fully elaborated type:
docker build -t grasshopper-env:4.28.0 docker/grasshopper # network needed, once
$gimg = docker image inspect grasshopper-env:4.28.0 --format '{{.Id}}'
docker run --rm --network none -e AUDIT_IMAGE_ID=$gimg `
-v "${PWD}:/source:ro" -v "${PWD}/out:/out" grasshopper-env:4.28.0 `
python3 /source/experiments/investigations/n3-grasshopper/audit.py `
--tarball /source/docs/research/math-inv-02/sources/files/lau-2026-arXiv-2605.20120v1-eprint.tar.gz `
--env /home/audit/env --out /out/n3-grasshopper-audit
The audit reads the artifact from the pinned e-print at run time into a scratch directory that is deleted afterwards. The source file is not copied into the output. The output is not free of the artifact, though. Each variant’s log holds Lean’s own messages, and those include the fully elaborated statement of every declaration, plus one linter warning that quotes a line of the artifact’s proof. So the logs stay private and are not reproduced. This chapter quotes none of them; it reports names, fingerprints and verdicts only.
In the book’s own image. math-engine proof grasshopper, run in math-env
as shown in the introduction, does not re-run the kernel: math-env does not
carry Lean 4.28. It checks that the recorded audit is byte-identical to its
pinned manifest, then re-reads the five recorded kernel logs and re-derives
every finding from Lean’s own axiom and error lines. Its status is
historical_verified_…, which says exactly that.
Without Docker. The audit needs the artifact’s own Lean 4.28 toolchain, so
there is no plain-Python version of the kernel run. The log analysis runs with
plain Python. The recorded run is in
experiments/investigations/n3-grasshopper/kernel-runs/2026-11-13-pinned/;
its notebook.md lists every declaration’s standing and axioms, and quotes
none of the artifact.
What happened
The audit behaved exactly as specified, on all five variants:
| Variant | What was changed | Kernel verdict |
|---|---|---|
original |
nothing | Four helpers clean; grasshopper depends on sorryAx; binding to the published statement accepted (inheriting sorryAx) |
without_main |
main theorem removed | Four helpers clean, with identical types and axioms (compared from result.json; the comparison is not made by the audit itself) |
hidden_sorry |
the last tactic of PS_swap_eq replaced by sorry |
It propagates: PS_swap_eq and maximizer_swap_in_M, which uses it, both show sorryAx; the other two helpers stay clean |
changed_statement |
one index in PS_swap_eq’s statement altered |
PS_swap_eq is rejected with an error inside it, and maximizer_swap_in_M, which depends on it, fails too |
substitution |
main theorem restated as True, proved trivially |
Axioms clean, but binding to the published statement refused |
“Clean” means the only axioms are Lean’s standard three (propext,
Classical.choice, Quot.sound). Anything else fails the audit loudly.
Three of these rows deserve emphasis. The without_main row shows the helpers
stand on their own: deleting the headline theorem changes neither their types
nor their standing. The hidden_sorry row shows the audit is not fooled by a
sorry buried mid-proof — it surfaces in every declaration downstream. And
the substitution row makes the chapter’s central distinction executable: a
clean axiom list is not enough. A theorem proved about the wrong statement —
even the trivially true one — is refused at the binding step, because the
check is on the statement, not the name.
Why
The proved content of the artifact is the four helpers, about the partial sums
PS of a permuted jump sequence. PS_last says the last partial sum is the
total of all the jumps. PS_swap and PS_swap_eq concern what swapping two
jumps does to the partial sums, and maximizer_swap_in_M concerns a maximizing
choice and the forbidden set; their exact statements are in the audit record,
not reproduced here. Each is kernel-accepted without unproved assumptions, and
each is independent of the missing main proof.
What is not established is the combination: that these helpers compose into a
proof of the grasshopper claim. The composition is exactly what the sorry
stands in for. Whether the helpers represent genuine progress toward a proof is
a mathematical judgement for a human reader, not a kernel verdict. The kernel
does not grade promise.
There is a second open question, recorded but not settled: the paper itself notes four differences between the Lean statement and the competition statement (a cardinality condition, the cases $n = 0$ and $0 \in M$, and indexing). Whether the formalization says exactly what IMO 2009 Problem 6 says is a correspondence question in the same sense as the Fermat chapter’s bridges — and it is unresolved here. The audit checks what the kernel certified about the artifact’s own statements.
Why acceptance is not certification
The dependency picture is a fan-in with one bad leaf: four clean helpers feed
a main theorem whose proof is sorry, and the taint reaches everything the
sorry touches — including a sorry buried mid-proof.
What the kernel assumed, per declaration. Green helpers rest on Lean’s three
standard axioms only; the dashed main theorem rests on sorryAx. The audit’s
hidden-sorry variant shows the propagation: a sorry inside PS_swap_eq
taints it and its downstream user. Clean axioms alone do not certify the
statement — the substitution variant is refused at binding, not at axioms.
Consider the counterfactual this audit is built to catch. Suppose a reader —
or an automated benchmark — counts “Lean accepted the file” as “the AI proved
the theorem”. Lean does accept files containing sorry: it elaborates the
declaration, adds it to the environment, and prints a warning. Acceptance is
not certification. The safeguard the audit implements is to ask the kernel, for
each declaration separately, what it assumed — and to treat sorryAx as what
it is: the assumption of any proposition at all.
The failure controls show the safeguard working in both directions. It finds a
real sorry (original), finds an injected one (hidden), refuses to let proofs
drift from their statements (changed), and refuses to let a clean proof of the
wrong statement impersonate the claim (substitution). A checker that merely
counted errors would pass the substitution variant. Ours must not.
What was actually checked
For each of the five variants, the audit records, from Lean itself:
- whether the file compiled;
- for each of the five declarations, whether it exists, its fully elaborated
type (as a fingerprint) and the axioms it depends on (
#print axioms); - whether the main theorem can be bound to the published statement, as in Chapter 5.
Every verdict comes from what the kernel reports, never from searching the text
for the word sorry. That is why the hidden-sorry variant is caught in a
lemma whose own text contains no sorry at all.
The audit was run once, in an isolated image with the artifact’s pinned Lean
4.28 and Mathlib, separate from the book’s main environment, and every variant
came out as specified before the run. The comparison of the helpers with and
without the main theorem was made by hand from result.json; the audit script
does not make the comparison itself.
What this establishes
About the published artifact, as pinned: four helper declarations are proved
without unproved assumptions, and the headline theorem is not — it depends on
sorryAx. The helpers are independent of the gap. The audit procedure detects
hidden assumptions, statement drift, and theorem substitution.
It establishes nothing about the grasshopper problem itself, nothing about whether the helpers point toward a proof, and nothing about AI systems beyond this artifact. Above all, it does not assess the paper’s text — only the code it ships.
What remains open
- Licence. No licence has been found for the artifact. The chapter therefore describes it and quotes none of its code; the audit logs, which contain elaborated statements, are not reproduced. The kernel verdicts and hashes are reported, but the artifact itself is not redistributed.
- Correspondence. The Lean statement’s exact relation to IMO 2009 Problem 6 is not settled here.
- Limits of the audit. The comparison of helper declarations was done by hand; the notebook does not print the Mathlib revision; the logs contain elaborated statements and are kept private.
Try it yourself
- Write a short Lean file with one honest lemma and one theorem proved by
sorrythat uses the lemma. Which declarations does#print axiomsflag? Now make the lemma usesorryinstead. Which are flagged now? - Why does the substitution variant need the binding check at all, when its axioms are clean?
- The paper itself records four differences between its Lean statement and the olympiad problem. Which of them would change the problem’s answer, and which only its bookkeeping?
Worked answers: Chapter 35 — Appendix A: Solutions to the Exercises (Part IV, Appendix A)#chapter-5-the-ai-proof-that-wasnt-finished.
Evidence record
| Audit | N3-GRASSHOPPER-00 kernel audit, five variants |
| Record | experiments/investigations/n3-grasshopper/kernel-runs/2026-11-13-pinned/ (result.json, per-variant logs, notebook.md, SHA256SUMS) |
| Toolchain | Isolated grasshopper-env image: Lean 4.28.0, Mathlib 8f9d9cff…; main math-env untouched |
| E-print | docs/research/math-inv-02/sources/files/lau-2026-arXiv-2605.20120v1-eprint.tar.gz (sha256 5e3dfe1e…) |
| Reader run | math-engine proof grasshopper, run 20261113T232915Z-a62abc70 in math-env (sha256:74006085…), source commit 1f9158e: the audit record was imported and verified (7 files); the findings were re-derived from the kernel logs, with no kernel run. Record: experiments/investigations/n3-grasshopper/runner-runs/2026-11-13-pinned/ |
| What it establishes | The audit behaves as expected on all variants. The Lean statement’s relation to IMO 2009 Problem 6 remains open. |
Sources
- G. R. Lau, “Using Aristotle API for AI-Assisted Theorem Proving in Lean 4: A Formalisation Case Study of the Grasshopper Problem”, arXiv:2605.20120v1 (19 May 2026). IMO 2009 Problem 6 is the competition source; the four Lean-vs-IMO differences are the paper’s own record.
- Audit kit:
experiments/investigations/n3-grasshopper/audit.py; environment:docker/grasshopper/; analysis:N3-GRASSHOPPER-00.md.
Further Reading
For deeper study; not sources for the chapter’s claims.
- Kaiyu Yang, Aidan Swope, Alex Gu, Rahul Chalamala, Peiyang Song, Shixing Yu, Saad Godil, Ryan J. Prenger, Animashree Anandkumar. “LeanDojo: Theorem Proving with Retrieval-Augmented Language Models.” Advances in Neural Information Processing Systems 36 (2023), 21573–21612. DOI. Why read it: A major open environment and benchmark for AI theorem proving in Lean, showing how statements, proofs and retrieval are represented in a real formal library.
- Yuhuai Wu, Albert Q. Jiang, Wenda Li, Markus Rabe, Charles Staats, Mateja Jamnik, Christian Szegedy. “Autoformalization with Large Language Models.” Advances in Neural Information Processing Systems 35 (2022), 32353–32368. DOI. Why read it: Directly addresses the translation from informal to formal statements, the correspondence problem that the Grasshopper audit can describe but not settle.
- Austin Letson, Leopoldo Sarra, Auguste Poiroux, et al. “SorryDB: Can AI Provers Complete Real-World Lean Theorems?” arXiv:2603.02668 (preprint, 2026). arXiv. Why read it: A 2026 benchmark of open Lean tasks drawn from real formalization projects, exactly the kind of unfinished goal the chapter audits; it is a preprint, not a peer-reviewed result.
The mathematics behind this chapter: Chapter 16 — What a Proof Rests On (Part II, Chapter 7) (dependencies, axioms and why a compiling file can leave its headline unproved).
Next: Chapter 7, a famous proof that was accepted for eleven years, and the small map that broke it.