Claude's 13M-Line Lean Proof of Fermat's Last Theorem
Anthropic published something in early September that is easy to misread, so let me be careful about what actually happened. Claude did not solve a famous open problem. What it did is, in some ways, stranger: it took one of the most famous solved problems in mathematics, Andrew Wiles’s proof of Fermat’s Last Theorem, and rewrote it as a formal proof that a computer can verify end to end, in 13 million lines of Lean. The output is not new mathematics. The output is certainty, which turns out to be a bigger deal than it sounds.
The reason this matters to anyone who tracks open source AI models is that the whole stack here is open: Lean is an open-source proof assistant, the proof rests on Mathlib, a community-built open-source library of formalized mathematics, and the artifact Anthropic produced is something other mathematicians can inspect and rerun. This is not a black box making an unverifiable claim. It is a machine producing an artifact that any skeptic can check themselves.
What “formalizing” means, exactly
Fermat’s Last Theorem states that there are no positive integers a, b, and c that satisfy a^n + b^n = c^n for any integer n greater than 2. It was famously scribbled in a book margin in 1637 with a note claiming a proof that did not fit, and it stayed unproven for more than three and a half centuries. Wiles finally proved it in 1994, using mathematics that did not exist in Fermat’s day, and his proof, together with a correction by Richard Taylor, has been accepted ever since.
There is a gap between “accepted by mathematicians” and “verified by a machine.” A human proof is a persuasive argument written for other humans, and at the frontier of modern mathematics those arguments are long, subtle, and occasionally wrong in ways that take years to surface. Formalization closes that gap. You write the proof in a language like Lean, which has a small, trusted kernel that mechanically checks every step against the rules of the logic. If the kernel accepts it, the theorem is true, no matter how long or intricate the argument.
So what Anthropic actually did was translate Wiles’s human proof into a form Lean’s kernel could check. That is a translation and reconstruction project on an enormous scale, not a discovery.
The numbers are the story
The scale is hard to overstate. The formalization runs to 13 million lines of Lean and something like 29,500 intermediate lemmas and theorems. It took the system about 11 days to produce, using roughly 6 billion output tokens on an internal model comparable in scale to Claude Fable 5.1. For context, the entire Mathlib library, the collective effort of a large open-source community over years, is around 2.2 million lines. This single artifact is several times the size of everything mathematicians had formalized together up to that point.
Those numbers matter for two reasons. First, they tell you this is not a toy example; it is the largest single formalization ever produced, by a wide margin. Second, they tell you something about the economics: 6 billion tokens of output is a lot of inference, and the fact that a lab could spend it on a single proof attempt is a signal about where AI research compute is going.
LLM benchmarks 2026: the formal-proof axis
For anyone tracking LLM benchmarks 2026, the interesting thing is that this does not fit the existing leaderboard. There is no standard benchmark row for “formalized a 350-year-old theorem end to end,” and that is exactly why the result is hard to compare and easy to over-hype. Frontier models are increasingly judged on benchmarks like software-engineering tasks, competitive programming, and graduate-level reasoning, and those all have a common weakness: they reward producing a plausible answer, not a verified one.
Formal verification is a different axis. A formal proof is either machine-checked or it is not, and there is no partial credit for sounding right. That is a genuinely useful property that the current benchmark suite does not measure well, and I would expect to see formal-math tasks become a more standard part of evaluation over the next year. When they do, this Anthropic result will be the reference point they are compared against.
The caveat is that this is a single, hand-tended result with a huge amount of engineering around it, not a reproducible benchmark number. You cannot yet run “formalize a hard theorem” as an off-the-shelf evaluation the way you can run a coding benchmark, and the human and compute cost behind this one artifact is not something a typical evaluation budget can absorb.
Why verification is the point, not the math
It is worth sitting with the phrase “it is not a new proof” because it is the key to understanding what this means. Fermat’s Last Theorem was already proved by Wiles. The mathematical content was not in question. What Anthropic demonstrated is a different capability: taking a deep, cross-disciplinary human argument and turning it into something a machine can verify with certainty.
That capability matters far beyond Fermat’s Last Theorem. Modern mathematics, and increasingly modern software and hardware, rest on arguments so complex that no single human can hold them in their head. Wiles’s proof itself draws on decades of machinery across algebraic geometry and number theory, and the process of formalizing it required reconstructing a great deal of that background in Lean. If AI can reliably convert such arguments into machine-checkable form, it changes how mathematicians, and eventually engineers, establish what is actually true.
There is also a concrete trust angle. The formalization was checked not just by Lean’s own kernel but by a second independent checker, Comparator, and by an independent reimplementation of the Lean kernel. That belt-and-suspenders approach is the right instinct, because when you claim a 13-million-line proof is correct, the first question any skeptic asks is whether the checker itself can be trusted.
What a Lean proof actually looks like
If you have never seen Lean, the idea is easier to grasp with a concrete example. In Lean you do not write prose; you write statements and tactics, and the kernel checks each step. A trivial fact, like the commutativity of addition on natural numbers, is written as a theorem with a proof, and even that proof must reduce to steps the kernel can verify:
theorem add_comm (a b : Nat) : a + b = b + a := by
induction a with
| zero => simp
| succ a ih => simp [Nat.add_succ, ih]
That is the whole game at a different scale. A 13-million-line formalization is the same discipline applied to the entirety of Wiles’s argument: every definition, every lemma, every appeal to a prior result has to be written down in a form this kernel accepts. The reason the token count is so large is that “write it in a form the kernel accepts” is far more demanding than “write it in a form a human finds convincing.”
The wider pattern in AI and math
This result is not happening in a vacuum. September 2026 has been an unusually dense month for AI-and-mathematics headlines, and it is worth separating them because they are not the same kind of claim. There are results that claim to prove something new, like OpenAI’s announcement around the Navier-Stokes problem, which is a different animal: a claimed new theorem that the community is now scrutinizing. There are results that formalize something already known, like this Fermat work, where the mathematical content is settled and the contribution is certainty. And there are results in between, like recent machine-verified progress on Riemann-adjacent bounds, which mix new computation with formal checking.
Keeping those categories apart matters, because the public conversation tends to flatten them all into “AI did math.” A formalization of a known theorem, a claimed proof of an open problem, and a new computational bound are three very different achievements with very different levels of trustworthiness. The Fermat result is the most trustworthy of the three, precisely because it makes the smallest mathematical claim.
How the work was actually done
The technical shape of the project is a multi-agent workflow rather than a single long generation. Claude worked in stages: it built up a formalization plan, decomposed the proof into thousands of smaller statements, generated Lean code for each, and used the Lean kernel’s errors as feedback to iterate until each step compiled and checked. That is the part that generalizes. The loop of “generate a formal statement, feed the checker’s errors back, fix it, repeat” is exactly the kind of task where a language model plus a verifier outperforms a language model alone, because the verifier supplies ground truth that a model trying to sound plausible cannot fake.
The 11 days and 6 billion tokens are also a reminder of how expensive the iterative loop is. Formal proof is not a single forward pass; it is thousands of rounds of generation and correction, and the cost compounds. That is why this is a milestone and not yet a product.
Limitations and caveats
I want to keep the perspective balanced, because this result has attracted both breathless and dismissive reactions. On the dismissive side: it is not new mathematics, and calling it “Claude proved Fermat’s Last Theorem” would be wrong, since the theorem was proved decades ago and the hard intellectual work belonged to Wiles. On the breathless side: it is genuinely the largest formalization ever done, by an order of magnitude, and the engineering achievement is real even if the math is old.
A subtler caveat is that “13 million lines” is a measure of size, not insight. A bloated formalization can be huge without being elegant, and part of the follow-up work for mathematicians will be judging whether the structure Claude chose is useful or just verbose. There is also the question of whether the proof is fully self-contained down to foundational axioms, or whether it leans on accepted results in Mathlib that were themselves not re-derived, which is a normal and legitimate choice but a real one worth understanding before you treat the artifact as absolute ground truth.
Who should care about this
You should care if you work on formal verification, automated theorem proving, or the intersection of AI and mathematics, because this is the new high-water mark for what a model-plus-verifier loop can produce. You should also care if you think about AI evaluation, because it exposes a gap in how we currently measure reasoning. Mathematicians who want to check or build on the artifact have a concrete new object to study.
You can safely ignore it if what you care about is whether a model can reason about your codebase or answer your customer’s questions, because none of this transfers directly to those tasks. The capabilities on display here are narrow and expensive, and the leap from “formalized a proof with a huge engineering effort” to “reliably reasons in general” is still very much unmade.
Sources
- Anthropic, “Formalizing Fermat’s Last Theorem” (September 4, 2026) — https://www.anthropic.com/
- Clay Mathematics Institute, Millennium Prize Problems — https://www.claymath.org/millennium-problems
- Mathlib, the Lean mathematical library — https://leanprover-community.github.io/
- Coverage of the formalization scale (13M lines, 29,500 theorems, 6B tokens) — https://claypier.com/en/claude-fermat-last-theorem-lean/