Anthropic Claude autoformalizes Fermat’s Last Theorem

TL;DR

Anthropic’s Claude model generated a full, Lean‑verified proof of Fermat’s Last Theorem in just 11 days, writing 13 million lines of code and proving 29,500 intermediate theorems, which shows that AI can now autonomously formalize highly complex mathematical results.

Overview of the Achievement

Claude worked largely without human intervention to translate Andrew Wiles’s proof into a machine‑checkable form. The resulting Lean proof was posted on GitHub and reviewed by Kevin Buzzard, who confirmed its correctness against Mathlib’s statement of the theorem.

"This extraordinary autoformalization achievement… proves Fermat’s Last Theorem with no assumptions other than the axioms of mathematics." – Kevin Buzzard

Technical Process

Automated Proof Generation

  • Claude operated for 11 days, producing 13 million lines of Lean code.
  • The system proved 30,300 theorems in total, of which 29,500 appear in the final FLT proof.
  • Dozens of Claude agents collaborated, each handling definition, intermediate lemma, or higher‑level theorem.

Prove2Me Collaboration Platform

Prove2Me, an open collaborative formalization platform, was critical for success:

  1. Directed Acyclic Graph (DAG) of theorem statements – guided agents to the next logical goal and prevented loss of project state.
  2. Separate storage of statements and proofs – accelerated Lean compilation and reduced resource usage.
  3. Natural‑language descriptions – enabled efficient search and reuse of existing lemmas.

These features mitigated memory degradation and allowed parallel work across many agents.

Resource Consumption

  • Approximately 6 billion output tokens were generated by a research‑grade model comparable to Claude Fable 5.1.
  • The proof relies only on Lean’s three standard axioms; a comparator confirmed exact alignment with Mathlib’s FLT statement.

Comparison with Prior Efforts

  • The community blueprint for formalizing FLT (86 pages) projected years of work; Claude completed the task in under two weeks.
  • The final Lean code base is >5× larger than Mathlib, the main library of formalized mathematics used as a foundation.
  • Earlier attempts at auto‑formalization of FLT failed early, contributing only ~7 % of the non‑boilerplate lines in the final proof.

Implications for Mathematics

Reducing Verification Burden

  • Automatic formalization can dramatically shorten the time needed to verify complex proofs, which historically required months or years of human effort.
  • Kevin Buzzard noted that this step brings the community closer to auto‑formalizing the modern mathematical literature, potentially rooting out hidden errors and easing referee workloads.

Trust in AI‑Generated Mathematics

  • Formal proofs provide an unambiguous correctness guarantee, complementing human‑readable expositions.
  • As AI‑generated conjectures increase, having an automated pipeline that simultaneously produces a Lean proof can make the validation process scalable.

Scaling to Other Theorems

  • Anthropic demonstrated a three‑day formalization of Vinogradov’s Three‑Primes Theorem using the same collaborative setup.
  • With appropriate scaffolding, major results could be formalized by consumer‑grade AI subscriptions.

Future Directions and Support

  • Anthropic and other labs are expanding free or discounted access for external researchers, along with dedicated grants for large‑scale formalization projects.
  • Ongoing work aims to improve Lean, Mathlib, and collaborative tools like Prove2Me to lower the barrier for future auto‑formalizations.

Acknowledgments

The effort builds on decades of mathematical development—from Wiles’s original proof to the Imperial College FLT project and the broader Lean community. Kevin Buzzard provided review and feedback, and the proof follows the exposition by Darmon, Diamond, and Taylor.

Resources

  • GitHub repository – Full Lean proof and accompanying walk‑through: https://github.com/anthropics/fermats-last-theorem
  • Prove2Me paper – Detailed description of the collaborative platform: Chen et al., 2026, arXiv 2608.28433.
  • Related Anthropic posts – Autoformalization of the Riemann hypothesis, automated alignment research, and other AI‑driven scientific advances.

Sources