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

📅 2026-05-18
📈 Citations: 0
Influential: 0
📄 PDF

career value

190K/year
🤖 AI Summary
This work addresses the challenges of verbose and version-fragile Lean proofs generated by large language models by proposing a plug-and-play retrieval-augmented agent framework. The approach integrates a frozen large language model with a tactic library annotated with version and performance metadata, leveraging a version-aware retrieval mechanism to enable controllable proof refactoring optimized for multiple objectives—proof length, compilation overhead, and cross-version compatibility—without requiring repeated fine-tuning. Experimental results on competitive benchmarks demonstrate that the method reduces token count by over 70% on average, shrinks repository size by more than 20%, and cuts compilation time by up to 60%, substantially outperforming baselines such as Claude Code while exhibiting superior zero-shot generalization across Lean versions.
📝 Abstract
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\%$ token-level compression on competition benchmarks, over $20\%$ on research repositories, and up to $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.
Problem

Research questions and friction points this paper is trying to address.

Lean proof refactoring
multi-objective optimization
version compatibility
LLM-generated proofs
compilation cost
Innovation

Methods, ideas, or system contributions that make the work stand out.

multi-objective optimization
retrieval-augmented agent
version-robust refactoring
Lean proof compression
zero-shot version transfer
🔎 Similar Papers