TL;DR
This paper introduces Theo, a multi-agent framework powered by general-purpose coding LLMs that automatically translates informal, research-level mathematics into machine-verifiable Lean 4 code. By treating mathematical formalization like a software engineering project—complete with object-oriented type decomposition and unit-test-style validation—Theo achieves state-of-the-art proof accuracy on benchmarks at a fraction of the cost of specialized systems.
What Problem Does This Paper Address?
While Large Language Models (LLMs) are increasingly capable of generating mathematical arguments, they are notorious for making subtle logical errors that easily slip past human reviewers. To ensure absolute correctness, mathematicians use formal verification languages like Lean 4, which mechanically check every step of a proof. However, translating natural-language mathematics into formal code—a process called autoformalization—is incredibly difficult.
Existing autoformalization tools suffer from two major bottlenecks:
- Rigid Pipelines: Traditional systems process statements sequentially and fail completely if an early step goes wrong, while single-agent setups quickly saturate their context windows with compilation errors.
- Limited Libraries: Cutting-edge research frequently uses novel concepts completely absent from Lean’s standard mathematical library (Mathlib). When a system encounters an undefined mathematical object, the translation grinds to a halt.
Methods
The authors introduce Theo, an agentic framework orchestrated within a Claude Code session that splits autoformalization into two distinct, interactive pipelines: Statement Formalization and Proof Formalization.
To overcome the limitations of existing tools, Theo introduces several novel software engineering-inspired techniques:
- "Type-First" Paradigm: Instead of jumping straight to the theorem, Theo first scans the paper to identify missing mathematical concepts and dynamically builds the necessary vocabulary (types and definitions) in Lean.
- Auxiliary Lemma Unit-Testing: To ensure these new definitions are actually correct and usable, a sub-agent generates and attempts to prove general "auxiliary lemmas" about them. If the proof fails, it signals that the definition is flawed, prompting the orchestrator to backtrack and refactor the type.
- Faithfulness Judge: Because theorem statements lack a mechanical ground truth, Theo uses an independent model ensemble to verify semantic alignment. It performs "blind verification" by back-translating the generated Lean code into natural language and comparing it to the original text.
Datasets
Theo was evaluated using two primary sources:
- PutnamBench: A high-difficulty benchmark consisting of problems from the prestigious Putnam Mathematical Competition. The authors tested Theo on a random sample of 32 problems.
- Research-Level Papers: Seven recent, cutting-edge mathematics and computer science papers—five from the ACM Symposium on Theory of Computing (STOC) and two from OpenAI manuscripts—spanning fields like combinatorics, graph theory, and mechanism design.
Key Insights and Ideas
- Coding LLMs Outperform Math LLMs: Heavily optimized, general-purpose coding models (like Claude) actually perform better at writing formal mathematical code than smaller models explicitly fine-tuned on Lean.
- Math as Software Architecture: Treating mathematical definitions as object-oriented types and using auxiliary lemmas as unit tests provides a robust proxy for correctness before tackling primary proofs.
- Automated Literature Auditing: Autoformalization can actively find bugs in peer-reviewed literature. While processing a published STOC paper (Pham [17]), Theo discovered a genuine, human-verified logical gap in a structural lemma, demonstrating its utility as a tool for scientific rigorousness.
- The Subscription Arbitrage: Running multi-agent loops over flat-rate commercial coding subscriptions (like Claude Code) drastically lowers the barrier to entry, costing orders of magnitude less than metered APIs or local GPU clusters.
Key Results
Theo achieved remarkable efficiency and accuracy across both evaluation sets:
- PutnamBench Mastery: Theo successfully solved 32 out of 32 randomly sampled problems, establishing a statistical lower-bound accuracy of $\ge 91.3\%$ across the entire benchmark. This significantly outperforms specialized state-of-the-art models.
- Extreme Cost Efficiency: Theo achieved these results at an operational cost of roughly \$5 per problem using a standard flat-rate subscription. Competing systems like Aleph or Seed-Prover cost between \$54 and \$168 per problem due to heavy API or GPU compute demands.
- Research-Level Success: Theo successfully formalized the headline theorems and proofs for all 7 targeted research papers. Remarkably, two of these developments were completed axiom-free, meaning the system proved everything from scratch using only Lean's core kernel.
Limitations and Future Work
- Exclusion of Algorithmic Proofs: The framework currently restricts its attention to non-algorithmic mathematical theorems. It does not formalize actual algorithms or verify their computational complexity and execution correctness.
- Closed-Source Dependency: Theo relies entirely on Claude Code. Because the underlying closed-source models change over time, exact reproducibility of the results may fluctuate as the backing models evolve.
Summary updated