NeurIPS 2026QuestionsPapersAreasAboutMarkdown

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

Jialin Lu, Soonho Kong, Rodrigo Stehling, Kaiyu Yang, Zhangyang "Atlas" Wang, Weiran Sun, Wuyang Chen

NeurIPS page · OpenReview · alphaXiv · Open on the map

Category: LLM Agents, Evals & Benchmarks › Software Engineering Benchmarks · Type: new method · Keywords: proof refactoring, multi-objective optimization, agentic retrieval, Lean theorem proving, version compatibility, LLM inference

Areas: Code & Coding Agents › Code Verification › Verified code generation; AI Agents › Agent Benchmarking › Agentic code and proof generation

Summary

Lean Refactor is a plug-and-play retrieval-augmented agentic framework that performs multi-objective, controllable, and version-robust refactoring of Lean proofs, achieving high token compression and compilation-time reduction.

Explained to a 5-year-old

Some people write long, complicated instructions for computers to solve math problems. These instructions are often too long to be useful. A new tool helps make those instructions shorter and more reliable. It uses a smart helper that looks up helpful tricks from a collection of good ideas. The tricks are organized by which versions of the computer they work with.

Explained to a 5-year-old, longer

People write long lists of steps for computers to solve math problems. These lists are called proofs and can be very long. Sometimes the lists are too long to be useful. Also, when the computer updates its rules, the old lists might not work anymore. A new tool helps make those lists shorter and more reliable. It uses a smart assistant that can think and ask questions. This assistant looks up helpful tricks from a collection of good ideas. The tricks are organized by which versions of the computer they work with. The tool balances three things: how short the list is, how fast the computer runs it, and whether it works with the current version. It can compress the proof by more than half on some test sets. It also reduces the time the computer spends checking the proof. This makes the math proofs easier to use and less likely to break in the future.

For a technical reader

The system leverages a frozen agentic LLM that queries a curated repository of refactoring strategies, each tagged with version compatibility and expected performance gains. By filtering retrieved strategies based on the target Lean/Mathlib version, it generates proofs that simultaneously reduce token count, compilation time, and version fragility. Experiments show substantial compression (up to 70% on benchmarks) and speed improvements (up to 60% reduction in compilation time) compared to prior methods and automated tools like Claude Code.

Problem

Adapting large language model-generated proofs for Lean is challenging because they are often verbose and brittle across library versions, and refactoring must balance multiple objectives such as proof length, compilation cost, and version compatibility.

Method

The approach uses a frozen agentic LLM augmented with retrieval from a curated database of multi-objective refactoring strategies, each annotated with Lean/Mathlib version support and expected compilation-cost reduction. It steers the LLM to generate refactored proofs that balance proof length, compilation cost, and version compatibility. Retrieval is filtered by target version to improve relevance.

Results

The approach achieves over 70% token-level compression on competition benchmarks, over 20% on research repositories, and up to 60% compilation-time reduction, while also improving zero-shot version transfer of refactored miniF2F proofs.

Contributions

It introduces a retrieval-augmented agentic framework for multi-objective proof refactoring that balances proof length, compilation cost, and version compatibility, and provides a version-filtered strategy database that enables robust refactoring across Lean releases without retraining. The framework demonstrates significant compression and compilation improvements over prior work.

Practical relevance

The framework can significantly reduce proof size and compilation time, making LLM-generated proofs more efficient and maintainable for formal verification pipelines.

This page was written by language models from the title and abstract of each paper, and the answers were checked by two other models. It can be wrong: check the paper itself. Suggest a correction