Claude Formalizes Fermat's Last Theorem in Lean in 11 Days
Anthropic announced on September 4 that its Claude AI produced the first fully computer-verified proof of Fermat's Last Theorem, writing about 13 million lines of Lean proof code in 11 days.

Anthropic announced on September 4, 2026, that its Claude AI produced the first-ever computer-checked proof of Fermat's Last Theorem, verifiable from start to finish. The theorem states that no positive integers a, b, c satisfy a^n + b^n = c^n for any integer n greater than 2. More than three decades after mathematician Andrew Wiles published his 129-page proof in 1995, no one had mechanically verified its logic from the ground up. Claude worked largely autonomously for 11 days and produced roughly 13 million lines of code in Lean, a computer proof assistant.
The project was led by Tianyi Peng, an Anthropic researcher who works on AI-driven mathematical formalization. Along the way, Claude produced computer-verifiable proofs of about 30,300 intermediate theorems, of which roughly 29,500 were used in the final proof. The resulting code is more than five times the size of Mathlib, Lean's main community mathematics library. Dozens of Claude agents worked in parallel, defining concepts and proving intermediate theorems before tackling harder statements. Early attempts failed: agents lost track of the project's overall state and stopped reusing each other's results effectively. About 7% of the non-boilerplate lines in the final proof trace back to those failed attempts.
What a computer-verified formal proof actually is
A mathematics paper written for human readers routinely skips steps judged "obvious." A proof assistant like Lean cannot: every step, however trivial, has to be spelled out. Rewriting an existing proof into that form is called "formalization." Because a single broken logical link can invalidate everything that follows, a formalized proof only earns a guarantee of correctness independent of human review once it passes Lean's mechanical check. Claude's proof relies on nothing but Lean's three standard axioms, with zero uses of "sorry" — the placeholder that lets a step go temporarily unproven. A comparison tool confirmed the statement Claude proved matches Mathlib's own statement of Fermat's Last Theorem, and an independent Lean kernel written in Rust, called "nanoda," checked more than a million declarations without error.
Why Fermat's Last Theorem is such an emblematic case
The theorem gets its name from a note the French mathematician Pierre de Fermat scribbled around 1637 in the margin of a copy of Diophantus's Arithmetica, claiming he had found "a truly marvelous proof" that the margin was too narrow to contain. For more than 350 years, generations of mathematicians searched for that proof in vain. In 1908, a prize worth one to two million dollars in today's money was offered for a correct proof; 621 wrong attempts arrived in the first year alone. In June 1993, Andrew Wiles announced his proof in a three-day lecture series, but a reviewer found a critical gap about two months into the verification process. It took Wiles nearly a year, working with his former student Richard Taylor, to fix it before publishing the final version in May 1995 — 129 pages that took the mathematical community months to verify. Notably for an international reader, the Taniyama–Shimura conjecture that underlies Wiles's proof was formulated in the 1950s by Japanese mathematicians Yutaka Taniyama and Goro Shimura. What Claude formalized is a simplified version of Wiles's proof, due to Darmon, Diamond and Taylor.
This extraordinary autoformalization achievement, which Anthropic researchers say only took 11 days, proves Fermat's Last Theorem with no assumptions other than the axioms of mathematics. Along the way we see autoformalization of algebra, harmonic analysis, geometry and number theory, and we learn that AI autoformalization artefacts are now robust enough to be built upon; the proof is multi-layered.
- Working time: 11 days, largely autonomous
- Lean code produced: about 13 million lines, more than 5 times Mathlib
- Theorems proved: about 30,300, of which 29,500 used in the final proof
- Output tokens consumed: about 6 billion, on a research model roughly comparable to Claude Fable 5.1
- Axioms relied on: only Lean's 3 standard axioms, zero uses of "sorry"
What Claude actually did — and what it didn't
It matters that Claude did not "discover" Wiles's original proof on its own. The mathematical reasoning was established by Wiles and his collaborators in 1995; Claude's job was to rewrite a simplified version of that reasoning into the rigorous symbolic form Lean can check, then have it mechanically verified — that is formalization, not discovery. This is distinct from recent AI work on the Riemann hypothesis, which aimed to produce genuinely new mathematics. Anthropic is explicit that the novelty here lies in verification, not discovery. The work relied on Prove2Me, a collaborative mathematics-formalization platform built by Tianyi Peng, which tracks dependencies between theorems as a directed acyclic graph so that multiple Claude agents know which theorem to tackle next. Human input was limited to high-level instructions from Peng, such as "prioritize the Jacobian as a scheme."
As AI produces more mathematical proofs, the burden of checking them by hand grows heavier. Anthropic expects it to become common to produce a formalized, computer-checkable proof alongside any paper written for human readers. Kevin Buzzard, who has led a multi-year community project since 2024 to formalize Fermat's Last Theorem in Lean at Imperial College London — whose initial blueprint alone already runs to 86 pages — called this a big step toward autoformalizing the modern mathematical literature: rooting out errors in the existing corpus, lightening the load on referees, and enabling rigorous checks of AI-generated mathematics.
For a technology or research organization, the lesson goes beyond a single mathematical trophy. The same proof assistants that verified this theorem are already used to verify cryptographic protocols, compiler correctness, and safety-critical code in aerospace and semiconductor design. An AI agent that can produce millions of lines of machine-checked proof in days rather than years is a concrete signal that formal verification, long considered too slow and specialized to scale, may become far more accessible to engineering teams outside pure mathematics — as long as, as Anthropic itself stresses, this verification capability is never mistaken for an ability to autonomously discover new mathematics.
Sources
- Formalizing Fermat's Last TheoremAnthropic · September 4, 2026
- Claudeがフェルマーの最終定理を11日で形式化、1300万行のLeanコードで初の完全な機械検証済み証明を完成GIGAZINE · September 7, 2026



