Checking a major proof by hand can take a team of mathematicians years. Anthropic just used Claude to skip that wait for one of the most famous theorems in mathematics.
On September 5, 2026, Anthropic announced that Claude had completed the first fully formalized, machine-checked Lean 4 proof of Fermat's Last Theorem — a project the company says experts thought would take many years. Anthropic calls it the largest Lean proof ever written. The theorem itself was proven by Sir Andrew Wiles in 1995, more than 350 years after Pierre de Fermat first conjectured it in 1637. What's new is not the mathematics — it's that a computer can now check every one of Wiles's logical steps automatically, and that Claude, largely unsupervised, is the one that wrote the 13-million-line file that makes that checking possible.
TL;DR — what actually happened
| Question | Direct answer |
|---|---|
| Did Claude prove FLT? | No — Wiles proved it in 1995. Claude formalized that proof in Lean 4 |
| How big is the proof? | Over 13 million lines of Lean code — more than 5x the size of Mathlib |
| How many supporting theorems? | 29,500–30,300, across areas of math never before formalized |
| How long did it take? | Completed last month (August 2026); build records point to ~11 days |
| Compute | On the order of six billion output tokens, dozens of Claude agents in parallel |
| Which model? | Unnamed — described as a research model roughly comparable to Fable 5 |
| Human review? | Kevin Buzzard (Imperial College London) reviewed the final proof |
| Machine verification? | Lean kernel + independent nanoda kernel + Mathlib's own comparator tool |
| License / access? | Public on GitHub, Apache 2.0, research artifact — not accepting contributions |
What Fermat's Last Theorem actually says
Fermat's Last Theorem states that the equation x^n + y^n = z^n has no positive integer solutions for any integer n greater than 2. For n = 2, of course, solutions are everywhere — 3² + 4² = 5² is the Pythagorean theorem. Fermat claimed in 1637, in the margin of a book, that no such triple exists once the exponent climbs past 2, and that he had "a truly marvelous proof" too large for the margin to contain. Whether that proof ever existed is one of math's oldest running jokes; what's certain is that it took 358 years and the invention of entire new fields of mathematics before anyone produced one that held up.
Andrew Wiles's 1995 proof didn't attack the equation directly. It went through the modularity theorem — showing that every semistable elliptic curve is "modular," meaning it can be associated with a modular form. Wiles, building on work by Gerhard Frey, Jean-Pierre Serre, and Ken Ribet, showed that if a counterexample to Fermat's equation existed, it would produce an elliptic curve that couldn't be modular — a contradiction. The proof drew on algebraic number theory, arithmetic geometry, and Galois representation theory that didn't exist in anything like usable form in Fermat's lifetime, which is exactly why the "marginal proof" claim is almost certainly wrong. It is one of the most celebrated results in 20th-century mathematics, and Wiles was ultimately awarded the Abel Prize for it in 2016.
That density is also what makes it a brutal formalization target. A Lean proof has to encode not just Wiles's final argument but every supporting theorem in number theory and geometry the argument leans on — which is the 29,500-theorem count below.
Anthropic's own words
Anthropic's announcement, posted to X, is worth quoting in full because every clause carries a specific claim:
"Checking that a major mathematical proof is correct can take years. Formalization — converting the mathematical reasoning into a form computer proof assistants like Lean can verify — can help. Last month, Claude completed the first formalized proof of Fermat's Last Theorem, one of the most famous theorems of all time. This was a project experts thought would take many years. It is the largest Lean proof ever written. Fermat's Last Theorem was first proven in 1995 by Sir Andrew Wiles, more than 350 years after it was conjectured. Our proof, which totals over 13 million lines of code, provides machine verification. More importantly, it proves over 29,000 other theorems that the proof requires, across many areas of math which had never before been formalized. We see this as a major step in the long process of firming up the core of mathematical knowledge, building on work from three centuries of mathematicians and hundreds of contributors to Lean and Mathlib. We are optimistic that AI-assisted verification of mathematical proofs will help reduce the burden of refereeing mathematics in an era where more proofs are being produced than ever before."
Notice the framing: Anthropic explicitly calls the 29,000-plus side theorems "more important" than the headline formalization itself. That's the tell that this announcement is really about infrastructure, not a trophy.
The scale, with numbers that hold up under scrutiny
Anthropic's tweet gives the headline figures; the project's own GitHub repository and research post fill in the rest with build logs a skeptic can actually audit:
| Metric | Value |
|---|---|
| Lines of Lean code | 13,000,000+ |
| Theorems proved | 29,511–30,300 (sources vary slightly by count method) |
| Compiled modules | 60,475 |
| Definition modules | 1,450 |
| Size relative to Mathlib | Over 5x the entire Mathlib library |
| From-scratch build time | ~5 hours 32 minutes at 96 parallel jobs |
| Comparator verification runtime | ~14 hours 46 minutes, 230 GB peak memory |
| Independent kernel check | 1,052,234 declarations, zero errors, ~30 minutes |
| Axioms used | Exactly 3 — propext, Classical.choice, Quot.sound |
| Duration of the project | ~11 days of largely autonomous work |
| Estimated compute | ~6 billion output tokens |
That last row is the one worth sitting with. Six billion output tokens is roughly 200x the token spend Anthropic reported for its Riemann zeta lower-bound result a month earlier — a fair comparison since both were unreleased research runs, and a sign of how differently "formalize an existing 350-year-old proof" and "find a new inequality" scale as agentic tasks. Formalization is enormous but mechanical; discovery is smaller but requires the "courage" Anthropic credited in the Riemann case. Different shapes of hard.
The proof also isn't standing alone. Per the repository's ATTRIBUTION.md, it explicitly builds on Kevin Buzzard's Imperial College London FLT project (the Frey package, Galois representations, deformation theory) and on flt-regular, the existing Lean formalization of Kummer's theorem — plus 23 re-proved Mathlib lemmas. Claude didn't start from zero; it extended years of human-written Lean infrastructure that already existed for exactly this purpose, which is also why Buzzard was the natural reviewer.
How the formalization actually got built
The methodology matters more than the headline count, and it follows a pattern this blog has now covered across three separate math results this year.
A shared dependency graph, not a single agent writing top to bottom. According to reporting on the project, the work ran through a platform called Prove2Me, which maintains a directed acyclic graph (DAG) of theorem statements still needing proofs. Dozens of Claude agents worked against that shared graph in parallel — one agent's completed theorem becomes a dependency another agent can immediately build on, rather than agents working in isolated silos and merging at the end.
Following an existing exposition, not improvising a new proof route. The formalization follows the Darmon–Diamond–Taylor simplified exposition of Wiles's argument — a well-trodden path through the modularity lifting machinery that number theorists already consider the cleanest route through the proof. Claude was formalizing a known argument, not searching for a new mathematical idea, which is a materially different task from what produced the Riemann zeta result or OpenAI's Erdős geometry result.
Three independent verification passes, not one. The finished proof went through the standard Lean kernel check, a from-scratch lake build against Lean 4.33.1 and Mathlib v4.33.0, an entirely separate nanoda kernel implementation written in Rust (to catch a bug specific to the reference Lean kernel itself), and Mathlib's own comparator tool — which exists specifically to confirm a submitted proof's formal statement is not a subtly weaker restatement of the theorem it claims to prove. The comparator's verdict, quoted verbatim in the repo: "Your solution is okay!"
A named human expert as the final check. Kevin Buzzard, whose own decade-plus of Lean work on Fermat's Last Theorem the project directly incorporates, reviewed the completed formalization. His quoted assessment: "AI autoformalization artefacts are now robust enough to be built upon; the proof is multi-layered." That's a domain expert saying the artifact is trustworthy enough to extend — not just check once and discard.
What machine-checking does and doesn't buy you
This is the part worth being precise about, because "machine-verified" gets thrown around loosely in AI-math coverage this year.
Lean's kernel guarantees that every step in a formal proof follows from its stated definitions and Lean's three foundational axioms, with zero gaps and no informal hand-waving — no sorry placeholders standing in for unproven steps, which the repository confirms are absent throughout. That is a real, strong guarantee, and it is why 1,052,234 declarations checked with an independent kernel and zero errors is meaningful evidence rather than marketing.
What it does not guarantee is that the formal theorem statement being checked faithfully captures the informal claim mathematicians care about. If a formalization quietly weakens a hypothesis or restates the conclusion in a technically-true-but-narrower form, Lean will happily verify the weaker thing and call it done. We flagged exactly this gap when covering OpenAI Astra's ten claimed math proofs: a Lean certificate is a floor on rigor, not a substitute for a referee reading the statement. That's precisely why the comparator step — which checks the formal statement against Mathlib's own canonical statement of Fermat's Last Theorem — and Buzzard's independent review both exist here. Together they close the gap that pure kernel-checking alone leaves open.
Why this matters beyond pure mathematics
The reason a builder audience should care about a 389-year-old number theory problem is not the number theory. It's what formal verification is, and where else the same machinery already runs.
Lean and Mathlib are general-purpose formal verification tools, not math-only ones. The same kernel that checks "no counterexample to Fermat's equation exists" checks that a piece of software satisfies its specification with the same zero-gap guarantee. We covered exactly that applied to systems security last month: Proofcraft's confidentiality proofs for the seL4 microkernel on AArch64 close out a full stack of functional correctness, integrity, and confidentiality proofs for a real operating-system kernel, using the same category of machine-checked rigor. Smart-contract auditing and safety-critical control software increasingly borrow the same discipline for the same reason: a test suite proves your code works on the cases you thought to test; a formal proof proves it works on every case the specification allows.
This is also a capability data point, separate from the math. Thirteen million lines of interdependent, logically consistent code, produced by a multi-agent system over 11 days with minimal human intervention, is a sustained long-horizon reasoning and coordination task at a scale no human team has attempted for this theorem. It's a different kind of evidence than a single clever inequality — it says something about coordination and consistency at scale, not insight, and it's the same "search versus judgment" question we raised about the Riemann result: extending known machinery broadly and correctly is not the same claim as finding a genuinely new idea, even when the artifact it produces is enormous.
Mathematics keeps being the domain that goes first. As Paul Graham argued about why LLMs got good at math before writing, domains with a cheap, automatic right/wrong signal are the ones agents can search hard against. Lean is that signal in its purest available form — a proof either compiles against three axioms or it doesn't, with no room for a grader's taste. Every result in this genre this year, from Leanstral 1.5's push for "proof abundance" to the Star Fleet Math run against 27 Erdős problems, has been possible because Lean gives agents a grader that never gets tired or generous.
Where this sits in 2026's AI-mathematics run
This is not an isolated event, and reading it against the year's pattern is more informative than reading it alone:
- May 2026 — OpenAI models resolved an 80-year Erdős planar unit-distance problem.
- June 2026 — the IEEE "Big Mathematics" debate over whether AI replaces or extends mathematicians.
- July 2026 — Leanstral 1.5 ships as a free, Lean-native formal-verification model, and 20 parallel Codex agents chase 27 Erdős conjectures in Lean 4.
- August 2026 — an unreleased Claude research model pushes a Riemann zeta lower bound from 41.6% to 67.2%, and Proofcraft completes seL4's confidentiality proof stack on AArch64 — the same machine-checking discipline applied to systems, not math.
- September 2026 — this: the largest Lean proof ever written, completed in 11 days.
The throughline across all of them is not "AI solves math" — it's that formal verification has become the price of admission for a credible AI mathematics claim. A model announcing a result without a Lean artifact gets read skeptically now; one that ships the checkable file gets a much longer benefit of the doubt, exactly as it should.
What to take from this if you build with agents
- Long-horizon formalization tasks reward a shared dependency graph over isolated agents. Prove2Me's DAG structure — where completed sub-theorems immediately become available dependencies for other agents — is the same "planner distributes work, workers pull from a shared frontier" pattern worth copying for any large decomposable task, not just proofs.
- Machine verification is a floor, not a ceiling. Kernel-checking catches every logical gap; it does not catch a mistranslated specification. Pair automated verification with a domain-expert review of the statement, the way Buzzard's review complements the comparator tool here.
- Building on existing verified infrastructure beats starting from zero. The project's explicit reuse of Buzzard's prior FLT project and the flt-regular library is why 11 days was possible at all — the same lesson as reusing a vetted library over reimplementing from scratch in ordinary software engineering.
- Scale and difficulty are different axes. Thirteen million lines formalizing a known proof path is a different (and in some ways easier) task than the smaller, harder search that produced the Riemann result. Don't read "biggest artifact" as "hardest problem" — measure them separately.
Bottom line
Anthropic says Claude produced the first fully formalized, machine-checked Lean 4 proof of Fermat's Last Theorem — over 13 million lines of code, roughly 29,500 supporting theorems across previously unformalized areas of math, completed in about 11 days and reviewed by Kevin Buzzard, whose own Lean work on the theorem the project builds on. The theorem was already proven, by Wiles, in 1995. What's new is that every step of that argument is now checkable by a machine in minutes rather than years — and that a largely autonomous multi-agent system, not a team of formalization specialists, is what got it there.
Related on explainx.ai
- Fact-checking the Zhi-Wei Sun / GPT-5.6 Sol prime-gap claim (Sept 2026) — a viral misattribution, and what "formalized in Lean" should actually mean when a claim invokes it
- Claude pushed a Riemann zeta lower bound from 41.6% to 67.2% using 60 subagents — the same lab's other major 2026 math result, and the closer read on what "machine-checked" does and doesn't prove
- seL4 on AArch64: Proofcraft completes the security proof stack — formal verification applied to systems security, not math
- OpenAI Astra's ten math proofs and their Lean certificates — what a Lean certificate proves and where the gaps are
- Leanstral 1.5: proof abundance and code verification for all
- Star Fleet Math: 20 parallel Codex agents, Lean 4, 27 Erdős proposals
- Will AI replace mathematicians? The IEEE "Big Mathematics" debate
- OpenAI solves an 80-year Erdős geometry problem
- Paul Graham on why LLMs crush math but lag at writing
- EEBench: the benchmark that grades whether AI can design circuits — the same deterministic-verification logic, applied to SPICE-simulated hardware instead of Lean-checked proofs
Primary sources: Anthropic's announcement on X (September 5, 2026) · Anthropic research post, "Formalizing Fermat's Last Theorem" · Full proof and build logs on GitHub
Accurate as of September 5, 2026. The generating model is unnamed by Anthropic and described only as comparable to the Claude Fable 5 line; duration and token-spend figures come from public build records and reporting on the project, not an official Anthropic figure, and are presented as such. Follow @explainx_ai for updates.
