← All papers
First page of Par for the Proof: Agentic Compression of Lean 4 Proofs under Exact Compiler Feedback

Par for the Proof: Agentic Compression of Lean 4 Proofs under Exact Compiler Feedback

Supreeth Rao, Anirudh Gupta, Ajay Kumar Nair, Manan Tayal

cs.AI Nov 27, 2026 · v1 cs.CL
An LLM agent shortens existing Lean 4 proofs, using Lean metaprograms to measure token length and heartbeats and a deterministic Lean optimizer for local rewrites.
We describe our closed-track entry to the Lean Refactor Arena, where Lean 4 proofs must be rewritten to be shorter (fewer tokens) and cheaper to check (fewer heartbeats) while still compiling on every listed toolchain, for at most \$3 of API spend per problem. We treat the task as a search against an exact, compiler-defined cost. A frontier model (gpt-6.1-sol) proposes proofs. A Lean metaprogram inserted into the target file measures each candidate as the competition does, at the cost of elaborating one declaration, and the best candidate so far is replaced only by one with a strictly higher three-axis score. A deterministic Lean optimizer then polishes the winner with verified local rewrites, and a reproduction of the competition scorer judges it. On the 60-problem final benchmark, our submission scores a combined 87.88 on the arena (length -80.2%, heartbeats -83.4%, all 67 cross-toolchain checks passed), at \$2.83 per problem on average and \$2.97 at most. The score tracked the number of verified evaluations the budget bought: a cheaper model per turn, a session policy that spends the whole allowance, and half-price Flex tokens each raised it, while more information, more structure, or forced diversity did not.

The Lean Refactor Arena asks entrants to rewrite Lean 4 proofs so they use fewer tokens and fewer heartbeats while still compiling on every listed toolchain. The closed track caps API spend at $3 per problem. Because heartbeat cost is unbounded and token length depends on Lean's own lexer, every candidate must be measured exactly rather than estimated.

Compression is treated as a search against an exact, compiler-defined three-axis score. A frontier model (gpt-6.1-sol) proposes proof bodies, assisted by a librarian model and by Lean-metaprogram tools for name search, goal states and profiling. A Lean metaprogram inserted into the target file measures each candidate on a farm of warm per-toolchain Lean processes, and a strict keep-best incumbent is replaced only by a candidate with a higher score. A deterministic Lean optimizer then polishes the winner with verified local rewrites, and an independent reproduction of the competition scorer judges the result.

On the 60-problem final benchmark the entry scored 87.88 combined on the arena: length fell 80.2%, heartbeats fell 83.4%, and all 67 cross-toolchain checks passed. Spend averaged $2.83 per problem and never exceeded $2.97. Ablations showed the score tracked the number of verified evaluations the budget bought, while extra information, added structure or forced diversity did not help.

CorpusLen.%HB%Score
Strata80.0084.7188.24
PhysLib68.7753.6674.14
ArkLib87.8093.4193.74
PutnamBench96.3897.2197.86
All 60 (arena, official)80.2483.3987.88
Submitted run by corpus