Par for the Proof: Agentic Compression of Lean 4 Proofs under Exact Compiler Feedback
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.
| Corpus | Len.% | HB% | Score |
|---|---|---|---|
| Strata | 80.00 | 84.71 | 88.24 |
| PhysLib | 68.77 | 53.66 | 74.14 |
| ArkLib | 87.80 | 93.41 | 93.74 |
| PutnamBench | 96.38 | 97.21 | 97.86 |
| All 60 (arena, official) | 80.24 | 83.39 | 87.88 |
