← Back to Blog | Portfolio Home

Claude and Fermat's Last Theorem: How AI Formalized a 13-Million-Line Proof in Lean

Published on 2026-09-04 by Mukesh Pal

#Claude Fermat's Last Theorem Lean proof#AI mathematical formalization#Lean theorem prover AI#multi-agent AI coordination#Prove2Me Anthropic#autoformalization mathematics AI

Claude and Fermat's Last Theorem: How AI Formalized a 13-Million-Line Proof in Lean

Introduction

Fermat's Last Theorem — the deceptively simple claim that no three positive integers $a$, $b$, and $c$ can satisfy $a^n + b^n = c^n$ for any integer $n$ greater than 2 — took over 350 years to prove after Pierre de Fermat first stated it in 1637, finally resolved by Andrew Wiles in 1994.

On September 4, 2026, Anthropic published something new about this famous result: not a new mathematical proof, but the first complete formalization of the existing proof — translated into Lean, a formal language a computer can verify line by line with zero tolerance for logical gaps — produced largely autonomously by Claude over 11 days.

---

What Happened?

Anthropic researcher Tianyi Peng, whose group at Columbia University builds AI formalization tools, set out to test whether Claude could make meaningful progress formalizing Fermat's Last Theorem (FLT) in Lean.

According to Anthropic's official research post, the result exceeded expectations: working largely autonomously over 11 days, Claude produced the first end-to-end, computer-checked proof of FLT, writing 13 million lines of Lean code and proving 30,300 intermediate theorems, of which 29,500 were used in the final proof.

The complete proof is publicly available on GitHub, and Anthropic shared it with Kevin Buzzard, an Imperial College London mathematician and prominent figure in the Lean formalization community, who reviewed and praised the work.

---

The Technology Behind It

The key distinction to understand here is between proving a mathematical statement and formalizing an existing proof:

---

Future Possibilities

Kevin Buzzard's own framing suggests the most significant implication may not be this specific proof, but what it suggests is now possible: if a result as complex as Fermat's Last Theorem can be formalized this quickly given the right tooling, a broader push toward automatically formalizing large portions of the modern mathematical literature becomes more plausible.

Given Anthropic's stated interest in AI-assisted formal verification more broadly, and the reusability of the underlying coordination and tooling (Prove2Me, the shared dependency-graph pattern), it's reasonable to expect continued investment in applying similar multi-agent formalization approaches to other complex mathematical results, and potentially to formal verification tasks in software and safety-critical systems engineering as well.

---

My Perspective

What I find most transferable about this result, as a developer, isn't the mathematics itself — it's the coordination architecture.

Using a shared dependency graph to let dozens of parallel agents decide what to work on next, based on what's already been established elsewhere in the effort, is a clean and genuinely reusable pattern for any large, structurally decomposable problem you might want to throw a multi-agent system at — well beyond formal mathematics.

I'd also encourage treating the legitimate critiques here (substantial reliance on existing formalization infrastructure, a failed first attempt, massive parallelism rather than sustained single-agent effort) as adding to the story rather than undermining it: a well-designed multi-agent system that successfully builds on existing human work and specialized tooling to accomplish something previously infeasible is a genuinely useful and realistic picture of how this kind of AI-assisted work actually happens.

---

Conclusion

Anthropic's formalization of Fermat's Last Theorem demonstrates that multi-agent AI systems, given the right coordination infrastructure and enough time, can now tackle mathematical formalization tasks of genuinely major scale and significance — verified not by a benchmark or human judgment, but by Lean's deterministic, zero-ambiguity proof checker.

The achievement is real and independently praised by a credible domain expert, even as legitimate questions about the framing of "autonomy" and the substantial role of existing formalization infrastructure deserve equal attention. Together, the full picture offers a realistic understanding of where AI-assisted mathematics currently stands.

---

FAQ

Did Claude discover a new mathematical proof of Fermat's Last Theorem?

No. Fermat's Last Theorem was already proven by Andrew Wiles in 1994. What Claude did was formalize that existing proof — translating it into Lean, a language a computer can verify with zero ambiguity — which is a distinct and historically very tedious task, separate from originating the underlying mathematical insight.

Did Claude do this work entirely on its own, from scratch?

Not entirely. Independent analysis found that Anthropic's own GitHub repository credits 106 upstream files to Imperial College London's existing FLT formalization project and to Mathlib, meaning a meaningful amount of existing human formalization work was built upon. Claude's first attempt at the task also reportedly failed before success was achieved using a purpose-built coordination tool called Prove2Me.

What does "computer-checked" actually mean here?

It means the entire proof was verified by Lean's kernel — a deterministic program that checks every logical step in a formal proof against a small set of foundational axioms, with no tolerance for unproven placeholder steps (sorry) or logical gaps. This is a fundamentally different, stricter form of verification than typical AI benchmark scoring.