Articles

Anthropic Claude Formalizes Fermat's Last Theorem in Lean

Anthropic says Claude agents produced the first complete, machine-checked proof of Fermat's Last Theorem in Lean — 13M lines of code in about 11 days.

Chisato Chisato · · 6 min read
Mathematical equations written in white chalk on a dark blackboard

Anthropic said on September 4, 2026 that a swarm of Claude agents produced the first complete, computer-checked formalization of Fermat’s Last Theorem in the Lean 4 proof assistant — a result mathematicians had expected would take a human community years to finish. According to the company, the agents generated roughly 13 million lines of Lean code, proved more than 30,000 intermediate theorems (about 29,500 of which fed into the final result), and completed the job in a little under two weeks, with the headline figure widely reported as 11 days.

The claim is notable not because Fermat’s Last Theorem is in doubt — Andrew Wiles proved it in the mid-1990s — but because turning that proof into code a machine can check line by line has been one of the hardest open engineering problems in formal mathematics. Anthropic is presenting the effort as evidence that current models, orchestrated as long-running agents, can now sustain the kind of multi-week, self-directed technical work that until recently required a coordinated team of specialists.

What was actually proved

Fermat’s Last Theorem states that no three positive integers a, b, and c can satisfy aⁿ + bⁿ = cⁿ for any integer exponent n greater than 2. It sat unproven for more than 350 years until Andrew Wiles, with a later assist from Richard Taylor, closed it in 1994–95 using deep machinery from algebraic geometry and number theory.

What Anthropic’s agents produced is not a new mathematical proof but a formalization: a translation of a known proof into the strict, machine-verifiable language of a proof assistant. In that setting every step must be justified from axioms with no hand-waving, which is exactly why formalizing large modern proofs is so laborious. Anthropic says Claude followed a simplified version of Wiles’s proof and built on existing formalized mathematics rather than starting from nothing.

Crucially, the finished artifact was checked by Lean itself, and Anthropic says it relies on just Lean’s three standard axioms — the same trusted foundation the wider Lean community accepts. A separate comparator confirmed that the statement the agents proved matches Mathlib’s own formal statement of Fermat’s Last Theorem, guarding against the classic formalization failure mode in which a system proves something subtly weaker than the theorem it claims.

It stands on Kevin Buzzard’s project

The result does not exist in a vacuum. Since 2024, mathematician Kevin Buzzard at Imperial College London has led a high-profile community effort to formalize Fermat’s Last Theorem in Lean — a multi-year undertaking precisely because the underlying mathematics is so vast. Anthropic says Claude built on existing formalized mathematics, including work from Buzzard’s FLT project, rather than reconstructing every prerequisite from scratch.

That lineage matters for interpreting the claim. The agents were not inventing the roadmap; they were filling in an enormous, tedious body of intermediate results along a route that human mathematicians had already charted. The scale is still striking: the codebase Anthropic describes is on the order of five times larger than Lean’s main Mathlib library, the shared repository that represents years of pooled human formalization effort.

How Anthropic ran the agents

The work was done with a Claude Code–based multi-agent harness in which dozens of Claude agents collaborated — defining concepts, proving intermediate lemmas, and then chaining those lemmas to attack progressively harder statements. Anthropic says the run consumed roughly six billion output tokens from a general-purpose internal research model, which it characterizes as roughly comparable to Claude Fable 5.1, the model line the company took to general availability days earlier.

The single most important technical detail is that Claude’s first attempt failed. What unlocked the result, Anthropic says, was giving the agents access to an open-source tool called Prove2Me, which helps an AI agent decide the optimal next step across a long, branching workflow. In a task with tens of thousands of interdependent sub-goals, knowing what to work on next — and not thrashing between dead ends — turns out to be as important as the raw ability to prove any individual lemma. Prove2Me acted as the scheduler and decision layer that kept the swarm productive over days of continuous work.

That framing fits a pattern Anthropic and its rivals have leaned into all year: progress increasingly comes from agentic scaffolding — memory, planning, and tool use wrapped around a capable base model — rather than from the base model alone. It echoes OpenAI’s recent claims that its Astra system tackled open math problems, and Google DeepMind’s framing of an automated “discovery loop” for research.

The caveats matter

Several qualifications keep this from being the science-fiction headline it can read as. First, this is a formalization of an existing proof, not a newly discovered theorem — the mathematics was Wiles’s, and the route was largely Buzzard’s community project. Second, the agents leaned heavily on already-formalized prerequisites; the 13-million-line figure reflects the sheer bulk of number-theoretic scaffolding a full Lean proof requires, not 13 million lines of novel insight.

Third, the underlying engine was an internal model Anthropic likens to Fable 5.1 rather than a public product, so the exact conditions are not independently reproducible today. And the effort’s own history — a failed first attempt rescued only by adding a third-party planning tool — is a reminder that these systems remain brittle at the frontier of long-horizon work, succeeding through orchestration and iteration rather than a single clean shot.

Even with those caveats, the verification story is the strongest part of the claim. Because the output is checked by Lean against Mathlib’s statement using standard axioms, the correctness of the artifact does not depend on trusting Claude — it depends on trusting Lean, which the mathematics community already does. That is the whole point of formalization: it converts “an AI says it proved this” into “a proof checker confirms this compiles.”

Why formalization is the real prize

The deeper significance is less about Fermat and more about the toolchain. Formal proofs are the closest thing mathematics has to unit tests: once a result is in Lean, it can be trusted, reused, and built upon without re-checking the human argument. The bottleneck has always been labor — formalization is painstaking, and there are far more important theorems than there are people willing to encode them.

If agents can reliably shoulder that labor, the addressable target is not one famous theorem but the long tail of modern mathematics that has never been formalized, plus adjacent domains — hardware verification, cryptographic protocol proofs, and safety-critical software — where machine-checked correctness is worth real money. That is the same logic driving interest in AI for scientific discovery more broadly.

It also lands in a year when Anthropic has pushed hard on verifiable, auditable AI behavior, from content provenance watermarking to enterprise governance. A result whose correctness is externally checkable — rather than taken on the model’s word — is very much on-brand for that positioning.

What it means

Read carefully, this is a milestone in AI-assisted formalization, not a claim that Claude out-reasoned Wiles. The mathematics was known; the human roadmap existed; the achievement is that an agent swarm executed a years-scale encoding task in days, and produced something a proof checker independently accepts.

Who wins: Anthropic, which gets a flagship demonstration that its models can sustain long-horizon, tool-driven technical work — a direct pitch to enterprises weighing agentic deployments. The Lean and Mathlib communities benefit too, if the formalized artifact and the Prove2Me tooling feed back into open mathematics rather than staying locked inside a lab.

What to watch: independent verification and release. The most valuable follow-through would be publishing the Lean code so the community can inspect it, confirm it compiles cleanly, and check how much genuinely new formalization it contributed versus how much it inherited from Buzzard’s project. Watch, too, whether the approach generalizes to theorems that haven’t been mapped out by humans first — that, not Fermat, is where an agent would be doing the mathematics rather than the typing. And watch the cost curve: six billion tokens for one proof is enormous today, but the trajectory of model pricing over 2026 suggests the arithmetic that makes this a stunt now could make it routine surprisingly fast.

Chisato Chisato · · 5 min read

Anthropic Claude for Scientists: 10,000 Free Seats

Anthropic is opening 10,000 free and discounted Claude Team seats for scientists and widening its AI for Science program. Here's what's included and who qualifies.

#AI #Anthropic #Research