13 million lines of Lean back Claude’s Fermat proof

Dozens of Claude agents spent 11 days writing a proof of Fermat’s Last Theorem that a computer can check from start to finish. They produced 13 million lines of Lean and proved 29,500 intermediate theorems along the way. Anthropic described the run in a September 7 post, and the full proof is on GitHub with a written walk-through. The math is Andrew Wiles’s. What is new is the verification, and the way the agents were organized to get there.
The final proof passed Lean’s checker using only Lean’s three standard axioms. A separate comparator tool confirmed that the theorem Claude proved is the same statement of FLT that Mathlib already contains. Mathlib is the main community library of formalized mathematics, and the proof builds on it. A formal proof is only as good as its statement, and a model that quietly proves a weaker theorem has not proved FLT. Kevin Buzzard of Imperial College London reviewed the result and said it “proves Fermat’s Last Theorem with no assumptions other than the axioms of mathematics.”
Why checking took longer than proving
Wiles first presented a proof in a three-day lecture series in June 1993. About two months into the verification effort, which involved several mathematicians, a reviewer’s question exposed a critical gap. Wiles spent a year trying to fix it, first alone and then with his former student Richard Taylor, and was close to giving up when an approach he had discarded earlier turned out to work. The corrected proof was published in May 1995. It ran to 129 pages, and checking it took months of painstaking work.
Anthropic’s post gives other cases where human refereeing stalled. Thomas Hales’s 1998 proof of the Kepler conjecture spent four years in review before a 12-referee panel settled for “99% certain.” Harald Helfgott’s 2013 proof of the weak Goldbach conjecture is still under review. Tianyi Peng, the Anthropic researcher who ran the FLT experiment, has his own version. As an undergraduate his advisor wanted to put a result from his thesis into a Nature paper and asked whether he was sure the proof was correct. Peng’s answer: “I’m 99% sure, but it’s hard to be 100% certain about a proof this long.” The result didn’t go into the paper.
A proof assistant like Lean removes the “99%” by checking every logical step mechanically. The cost is on the way in. A paper proof skips steps any reader would accept, and Lean accepts none of them. A paper proof also cites centuries of published results, while a formalization can only cite what has already been formalized, a small fraction of mathematics. Jan Bergstra proposed formalizing Wiles’s proof about a decade after it appeared. In 2024 Buzzard launched a multi-year community Lean project at Imperial to do it. That project is funded until September 2029 by an EPSRC grant, per its GitHub repository. The blueprint describing just its initial phase runs to 86 pages.
Buzzard’s motivation, as he put it when announcing the project, was that number theory lagged in formalization: most weeks Lean did not know enough modern definitions even to state the results presented at the London Number Theory Seminar.
How dozens of agents shared one proof
The first attempts failed. Anthropic says the agents had some early success but soon lost track of the project’s state and stopped working together effectively. About 7% of the non-boilerplate lines in the final proof still come from those failed runs.
The run that succeeded used Prove2Me, an open platform for collaborative formalization built by Peng and his collaborators at Columbia University, where his group builds tools for AI formalization. It sat under a multi-agent harness built on Claude Code. Prove2Me did three jobs:
- It kept a directed acyclic graph of theorem statements. Agents read it to decide which proof to attempt next, so the project’s state lived on the platform and not in any agent’s context. Anthropic says this helped with memory degradation and let many agents work in parallel.
- It stored theorem statements and their proofs in separate files and tracked the links between them independently. That sped up Lean compilation and cut resource use.
- It kept a natural-language description of every statement, so agents could search for an existing lemma and reuse it before writing a new one. According to Anthropic, this led to a simpler proof path.
The agents defined concepts, proved intermediate theorems and used them to prove harder statements, working up the graph. In all they proved 30,300 theorems, of which 29,500 are used in the final proof. The run used about six billion output tokens from a general-purpose internal research model that Anthropic describes as roughly comparable to Claude Fable 5.1.
Human mathematical input was limited to occasional high-level steering from Peng, such as “Jacobian as a scheme sounds high priority” and “push [the] Mazur [theorem] to be done soon.” The plan the agents followed had three core sub-theorems on the way to the final goal, and Anthropic says the graph closely follows Wiles’s original proof.
The root node flipped to proved at 02:00:57 UTC on August 18. Anthropic published excerpts of Claude’s reasoning from that moment. One reads: “THE FLT root reads Proved on the site. Historic moment (modulo re-check).” Another: “R = T closed and cascaded to the root.”
Which proof of FLT?
“R = T” is the heart of the Wiles-style argument: showing that two algebraic objects attached to the problem, a deformation ring and a Hecke algebra, are the same. The Imperial project has the same core, as the Lean project’s page on FLT describes it. Its route, though, is a “21st century” version of the proof that incorporates later work by Khare-Wintenberger, Kisin and others. According to the repository, that route was planned essentially entirely by Taylor in discussions with Buzzard.
Claude’s proof follows a simplified version of Wiles’s argument from the exposition by Henri Darmon, Fred Diamond and Taylor. It still borrows: Anthropic says the proof adapts pieces from the Imperial project and from the separate flt-regular project.
At 13 million lines, Claude’s proof is more than five times the size of Mathlib. Anthropic’s own explanation is that Mathlib is concise and well-reviewed, while the FLT proof “is likely much longer than it needs to be.” Buzzard said the proof is multi-layered, with autoformalization of algebra, harmonic analysis, geometry and number theory along the way, and that “AI autoformalization artefacts are now robust enough to be built upon.”
The Lean site notes that FLT was the last remaining item on Freek Wiedijk’s list of 100 challenge problems for computer formalization. The same page expected the Imperial project to produce high-quality training data for AI systems.
Three primes on three Max plans
Anthropic calls the FLT run token-intensive and says it is the largest Lean proof ever constructed. The company also ran a smaller experiment. Anthropic researchers used three personal Claude Max plans to formalize applications of the Hardy-Littlewood circle method, a standard analytic technique for counting solutions to additive problems in primes. Collaborating only through Prove2Me, the agents finished a formalization of Vinogradov’s three primes theorem in three days. Anthropic’s conclusion is that with the right scaffold, collaborative formalization of major results is achievable on consumer subscriptions.
Anthropic contrasts the FLT work with recent AI-driven work on the Riemann hypothesis, which produced new mathematics, while the FLT run produced verification. Many of Anthropic’s recent Claude-authored results were formalized in parallel with the proofs, and Claude appears to use partial Lean proofs to check its own hypotheses, much as it writes numerical simulations to check that it is on the right track.
Anthropic expects a formal proof to become a common companion to any write-up meant for human readers. It does not think the formal proof should replace a human-readable exposition, but says it may be the only feasible way for mathematicians to keep up with AI-generated contributions. For external researchers, including those working on formalization, Anthropic points to free and discounted subscriptions and research credits. It also offers dedicated grants for larger projects, which could include formalizing other major theorems or improving Lean and Mathlib.
Buzzard focused on refereeing. “If the automatic formalization of FLT is possible now, then we have taken a big step towards automatic formalization of the modern mathematical literature,” he said. He added that the techniques “will also enable us to rigorously check LLM-generated mathematics, which is currently typically an extremely costly human-led process.”
Up next
Toolog keeps a forensic log of Claude Code tool calls
77% of the author’s own Claude Code history was Bash commands no rule had ever matched, reported as nothing, which reads as fine and means unexamined. Toolog logs every tool call locally and hands those to an optional local model.
Related stories
- Claude’s ETH proof pays off only past 10^108 variables
- Claude does nine loops, one past the N=4 physics record
- Claude Fable knocked 20 bits off most popular hashes
- The last of Wiedijk’s 100 theorems falls to Anthropic
- Claude pushed the zeta-zero lower bound from 41.6% to 67.2%
- Anthropic buys Mithril, a one-person biotech run on Claude
Comments
No comments yet. Be the first.
Join the conversation
Sign in to leave a comment. It appears after moderation.

