
Anthropic's Claude autonomously formalizes Fermat's Last Theorem in Lean in 11 days
Published by AINave Editorial • Reviewed by Ramit
Anthropic used Claude to produce the first complete computer-checked proof of Fermat's Last Theorem, formalizing Andrew Wiles' 1995 proof into 13 million lines of Lean code in 11 days. For AI builders, this demonstrates that multi-agent workflows with intelligent tooling can handle long-horizon formal verification tasks that mathematicians expected to take years.
13 million lines of Lean code in 11 days
The proof of Fermat's Last Theorem, originally proposed in 1637, has been turned into a machine-verifiable format using the Lean programming language. Anthropic reported that Claude worked largely autonomously over 11 days with an internal research model described as roughly on par with Claude Fable 5.1. The system spun up several dozen AI agents that generated 6 billion tokens of output and proved at least 29,500 intermediate theorems. The resulting Lean formalization is 13 million lines of code, making it the largest Lean file ever created.
Initial attempts failed until Claude gained access to Prove2Me, an open-source tool that helps agents determine the optimal next step in a long workflow and reduces inference costs. The formalization spans algebra, harmonic analysis, geometry, and number theory.
Why this matters for AI builders
This project shows that LLMs can coordinate complex multi-step formalization tasks with minimal human supervision. For builders working on automated reasoning, verification, or long-horizon agent tasks, the combination of multi-agent coordination and external planning tools like Prove2Me is the real signal. The same pattern could apply to formal verification of software, protocol proofs, or smart contract validation.
Mathematician Kevin Buzzard, whose work was used in the formalization, noted that AI autoformalization artifacts are now robust enough to be built upon. This suggests a shift: mathematicians may move from manually writing Lean code to verifying AI-generated formal proofs.
This work follows Anthropic's earlier discovery of new information about the Riemann zeta function using Claude, and mirrors OpenAI's use of Astra to solve several Erdos problems, signaling a broader push toward AI-assisted mathematics.
Practical implications for formal verification
Computer-checked proofs eliminate the risk of human error and make it easier for researchers to share and build on each other's work. If AI can routinely produce formalizations, the bottleneck shifts from writing proofs to verifying them. For developers, the ability to generate machine-checkable proofs of complex logic could apply to critical systems, security protocols, and correctness guarantees in software.
Caveats and open questions
The evidence comes from Anthropic's blog post and tech news reports; the exact line counts and intermediate theorem counts are vendor claims and have not been independently verified. The model used is an internal research model, not a publicly available API, so replicability is limited. Early attempts failed before Prove2Me was added, which suggests the approach is sensitive to tooling and workflow design. At 6 billion tokens of output, the inference cost is substantial, and the method may not generalize to all proofs or domains without similar planning infrastructure.
FAQs
Sources
- Anthropic uses Claude to formalize proof of Fermat’s Last Theorem - SiliconANGLE
- Formalizing Fermat's Last Theorem \ Anthropic
- Anthropic Formalizes Fermat's Last Theorem With Claude
- Anthropic’s Claude Agents Formalize Fermat’s Last Theorem in ...
- Anthropic uses Claude to formalize proof of Fermat’s Last ...
- Fermat's last theorem machine-checked: Claude completes in 11 days what took years to plan
- Claude helps complete first formalized proof of Fermat’s Last Theorem
- Anthropic’s Claude formalizes Fermat’s Last Theorem in 11 days
- AI Just Solved a 350-Year-Old Math Problem By Writing the Longest Proof Ever
- Anthropic says Claude formalized Fermat's Last Theorem proof ...
- Claude AI Formalizes Fermat's Last Theorem in Lean Proof




















