Multi-agent LLM framework autoformalizes research papers and PutnamBench problems into Lean 4, extending Mathlib with new type definitions validated by auxiliary lemmas.
Abstract
While Large Language Models (LLMs) have demonstrated exceptional capabilities in mathematical reasoning, they frequently produce subtle errors that evade human detection. Formal mathematical languages like Lean 4 offer mechanical proof checking, strongly motivating the need for autoformalization: the automatic translation of natural language mathematics into verifiable code. Recent trends indicate that general-purpose LLMs, heavily optimized for standard programming, now outperform smaller models explicitly fine-tuned for Lean. Leveraging this shift, we introduce *Theo*, an agentic autoformalization framework powered by general coding LLMs. At the core of our system is an orchestrator that manages a multi-agent pipeline tailored for research-level mathematics. Because cutting-edge research frequently relies on concepts outside the scope of existing libraries like Mathlib, our system dynamically extends necessary type definitions and validates them via a novel Auxiliary Lemma technique before formalizing the primary theorems. We applied our approach to PutnamBench, producing machine-checked Lean proofs for a random sample of 32 problems. Furthermore, we evaluate our system on seven research papers—five from the ACM Symposium on Theory of Computing (STOC) and two recent OpenAI manuscripts—spanning combinatorics, communication complexity, mechanism design, learning theory, number theory, discrete geometry, and graph theory. We successfully formalize their main theorems and proofs and validate the generated formalizations with human experts; notably, two developments require no axioms beyond Lean's kernel. All of our formalizations are available at https://beyondthelibrary.github.io/formal_arxiv/.
Problem
LLM-generated mathematical proofs often contain subtle errors, so they need mechanical verification. Research mathematics also relies on concepts missing from Mathlib, which makes direct autoformalization into Lean difficult.
Approach
Theo is a multi-agent pipeline built on Claude Code. An orchestrator manages a statement-formalization pipeline and a proving pipeline. In the statement pipeline, agents extract the main theorem, plan the types missing from Mathlib, and formalize each type in parallel. Each type is validated by proving general auxiliary lemmas and passing a Faithfulness Judge that uses back-translation. The proving pipeline drafts a natural-language proof, decomposes it into lemmas, and formalizes it into a self-contained Lean proof.
Figure 1 : Overview of our agentic system. The user interacts through the Claude Code interface (left), providing the paper in L a T e X and PDF form together with a prompt, and the system returns Lean code. The orchestrator drives two pipelines. The Formalization pipeline (top, Section 2.1 ) extracts the main theorem, then iterates over the required types, planning and formalizing each type togetFigure 2 : Type Formalizer Expanded; This is part of the main pipeline where we formalize and investigate each type candidate.
Results
The system solved all 32 randomly sampled PutnamBench problems, which gives a lower-bound accuracy of 91.3% at 95% confidence, at under $5 per problem. It formalized the main theorems and proofs of five STOC papers, with outputs validated by human experts. Two of these needed no axioms beyond Lean's kernel.
Paper
Area
Axioms beyond kernel
Mackenzie and Saffidine
Communication complexity
None
Gravin and Jia
Mechanism design
None
Pham
Combinatorics
1
Rivkin et al.
Information-theoretic LB
2
Kalai et al.
Learning theory
3
Axioms beyond Lean's kernel in STOC paper formalizations