Claude Formalizes Fermat's Last Theorem in Lean
Anthropic has announced the first complete computer-checked proof of Fermat's Last Theorem (FLT), produced by Claude. Working largely autonomously over 11 days, the AI system wrote 13 million lines of Lean code and proved 29,500 intermediate theorems to achieve a result that the mathematical community had expected would take years to formalize.
The Achievement: Autoformalization of FLT
Claude's formalization of Fermat's Last Theorem is a significant milestone in autoformalization—the process of converting human-readable mathematical reasoning into a form that computers can verify algorithmically.
Key technical metrics of the project include:
- Timeline: 11 days of autonomous work.
- Scale: 13 million lines of Lean code, which is over five times the size of Mathlib (the primary community library for Lean).
- Complexity: 30,300 theorems were proved in total, with 29,500 used in the final proof.
- Resource Consumption: Approximately six billion output tokens from an internal research model comparable to Claude Fable 5.1.
The proof follows a simplified version of the 1995 proof by Andrew Wiles, specifically the exposition by Darmon, Diamond, and Taylor. It relies only on Lean's three standard axioms and was verified by a comparator to match Mathlib's statement of FLT.
Overcoming the Verification Challenge with Prove2Me
Formalizing complex proofs is difficult because proof assistants like Lean require every logical step to be explicit, whereas human proofs often skip "obvious" steps. To manage this complexity, Anthropic utilized Prove2Me, an open collaborative platform designed by Tianyi Peng and collaborators at Columbia University.
Prove2Me enabled the success of the project through three primary mechanisms:
- Directed Acyclic Graph (DAG) Management: The platform maintained a DAG of theorem statements, allowing multiple agents to work in parallel and mitigating memory degradation by providing a clear roadmap of what to prove next.
- Optimized Compilation: By separating theorem statements from their proofs into different files, the system reduced Lean compilation time and resource consumption.
- Natural Language Indexing: Each theorem statement was accompanied by a natural-language description, which facilitated search and reuse across the agent team.
Implications for Mathematical Research
This result demonstrates that AI can now formalize large portions of existing mathematical literature, which has immediate implications for the rigor and verification of the field.
Reducing the Burden of Peer Review
traditionally, verifying a novel mathematical result can take months or years. Autoformalization can lighten the load for human referees and provide a rigorous way to check LLM-generated mathematics, which is currently a costly human-led process.
Enhancing AI's Own Reasoning
Anthropic notes that writing Lean code helps Claude prove novel results. By formalizing proofs in parallel with their discovery, the AI can independently check its own hypotheses, similar to how a researcher uses numerical simulations to verify a direction.
Community Perspectives and Critiques
While the achievement was hailed as "extraordinary" by Kevin Buzzard of Imperial College London, the project sparked significant discussion among the technical community regarding the nature of the proof.
Concerns Over "Spaghetti Code"
Some critics argue that the sheer volume of code (13 million lines) suggests the proof may be inefficient or lack the reusable abstractions that human mathematicians strive for. One commenter noted:
This is quite useless actually. The whole point of formalizing FLT was to clean up modern number theory into reusable abstractions... If its 13 million LoC, it might involve so much spaghetti that its unusable other than the result.
Trust in the Verifier
Questions were raised regarding whether the AI might have exploited latent bugs in the Lean kernel itself. Because the proof is so large and generated by an AI, some users questioned the "who verifies the verifier" problem, suggesting that a smaller kernel like Metamath might be more trustworthy for such a massive output.
Societal Value of Brute Force
There is a debate on whether "brute force" autoformalization provides the same value as human-led formalization. Some argue that by solving famous problems through massive token expenditure and agentic scaling, AI labs may disincentivize the painstaking work of creating human-comprehensible formal libraries.
Sources
Related
- Dispatch
- Dispatch
- Dispatch
- Dispatch
- Dispatch