cs.AINov 27, 2026

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

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

Organizations: Emergence AI · Student at the Indian Institute of Science

Abstract

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.

Figures & tables

Appendix figures & tables7 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

May 18, 2026

Lean Refactor: Multi-Objective Controllable Proof Optimization via Agentic Strategy Search

We present Lean Refactor, a plug-and-play retrieval-augmented agentic framework for multi-objective, controllable, and version-robust refactoring of Lean proofs. LLM-generated proofs are notoriously correct-but-verbose and brittle across library versions, yet existing refactoring works overlook three practical challenges: 1) Lean refactoring is natively multi-objective (proof length, compilation cost, and version compatibility are often in tension); 2) Lean repositories have fragile compatibility, whereas LLM releases are unaware of Lean/Mathlib versions; 3) Training-based pipelines require repeated fine-tuning with each new LLM release, scaling neither with model churn nor with Lean's release cycle. Lean Refactor steers a frozen agentic LLM with retrievals from a curated database of multi-objective refactoring strategies, each densely annotated with metadata such as supported Lean/Mathlib versions and expected compilation-cost reduction. Experiments show over 70%70\% token-level compression on competition benchmarks, over 20%20\% on research repositories, and up to 60%60\% compilation-time reduction, outperforming prior work and Claude Code. Version-filtered retrieval further improves compression on the target Lean version, and refactored miniF2F proofs exhibit stronger zero-shot version transfer to future Lean releases than their unrefactored counterparts.
Nov 24, 2026

Verified Proof Refactoring with Codex and Qwen

We refactor existing Lean 4 proofs to reduce source length and checking cost while preserving theorem statements and compatibility across Lean versions. A locally served Qwen model uses the open-source Codex CLI to inspect source, retrieve declarations, and test proof replacements. The host keeps a replacement only if it improves the objective and Lean accepts it on every required version. A deterministic CPU pass then refines the verified proofs. On the 60 problems in Lean Refactor Arena, model search achieves a local mean combined score of 82.07, and cleanup raises it to 82.18. The final proofs pass all 127 required proof--version checks. Our system placed first in the open-source LLM track of Lean Refactor Arena at VeriCodeGen.
Sep 29, 2026

LeanPolish: Verified Supervision for Lean Proof Compression

Verified proof edits offer a natural source of supervision for improving language-model-generated Lean proofs. Yet verification establishes that an edit is correct, not that its training signal is free of search artifacts. We introduce LeanPolish, a symbolic Lean 4 pipeline that releases 33,402 accepted local edits and 65,596 same-state failed attempts, and use it to study what models learn from this supervision. First-success search admits a goal-independent rule with perfect ranking accuracy; teacher-selected evaluation sites also reward trivial deletions. Continuing menu evaluation beyond the first success removes the ordering shortcut: a trained ranker selects the best candidate on 70.1% of evaluated held-out states, versus 36.9% for the strongest frozen baseline. For compression, iterating the symbolic pass raises miniF2F savings from 19.7% to 27.5%, exceeding the neural hybrids we test there. Verified neural editing helps on other proof sources, but matched frozen-model controls show that its gains need not come from training. The supervision does improve whole-proof rewriting: fine-tuning raises verified token reduction from 2.8% to 5.5% on 19 PutnamBench proofs. Together, the released edits, complete candidate pools, and controlled evaluations separate learning to imitate a search policy from improving on that search. They provide a reproducible basis for studying proof improvement while keeping correctness, compression, and edit policy distinct.