AI Just Formalized Fermat’s Last Theorem Using 13 Million Lines of Code
Mathematics

AI Just Formalized Fermat’s Last Theorem Using 13 Million Lines of Code

Anthropic’s Claude AI has successfully converted the proof of Fermat’s Last Theorem into a computer-verified Lean formalization in just 11 days.

By Rabia Shah
Published:
Email this Article
Ai Cracks The Code Behind A Legendary Theorem In Just 11 Days After Decades Of Human Effort Scaled
| Shutterstock

A recent collaborative effort between artificial intelligence and mathematical logic has reached a significant milestone: the formal verification of Fermat’s Last Theorem. By leveraging a network of Claude agents, researchers have successfully converted the century-defying proof into 13 million lines of code compatible with the Lean proof assistant, marking a shift in how complex mathematical arguments are audited for accuracy.

A Centuries-Old Challenge Met with Modern Computing

Proposed by Pierre de Fermat in 1637, the theorem asserts that no three positive integers a, b, and c satisfy the equation aⁿ + bⁿ = cⁿ for any integer value of n greater than 2. While Fermat famously claimed to have a solution, the proof remained elusive for over 350 years. It was not until 1993 that mathematician Andrew Wiles, later working with Richard Taylor to address a critical flaw, successfully demonstrated the theorem using modern number theory. Their work was formally published in 1995.

The recent initiative, documented by Anthropic, focused on the rigorous process of formalization. Unlike human-readable proofs, which often rely on contextual knowledge or skipped logical steps, a formal proof requires every single inference to be explicitly defined. Using a simplified version of the Wiles–Taylor–Wiles argument developed by researchers Darmon, Diamond, and Taylor, multiple AI agents worked to map the reasoning into Lean, an environment where logical validity is checked automatically. The result was a massive codebase comprising 13 million lines and over 30,000 intermediate theorems.

Claude’s Prove2Me roadmap for formalizing Fermat’s Last Theorem ©anthropic
Claude’s Prove2Me roadmap for formalizing Fermat’s Last Theorem ©anthropic

Efficiency and the Future of Peer Review

The project highlights a potential evolution in academic mathematics. Traditionally, checking a major proof can span years of intensive study by specialists. Mathematician Kevin Buzzard of Imperial College London, who began his own attempt at formalizing the theorem in 2024, noted that while the mathematical community already held the original proof to be correct, the AI-driven formalization provides a new level of absolute certainty through machine verification.

The technical hurdles were substantial. Early attempts saw AI agents struggling to maintain project coherence, leading to the development of Prove2Me, a platform designed to organize and manage dependencies between various agents. The final output, which demanded roughly six billion tokens of processing power, resulted in a codebase larger than the existing Mathlib library. Despite the achievement, experts like Buzzard emphasize that this does not change our fundamental mathematical understanding of the theorem; rather, it demonstrates a radical increase in the speed at which formal verification can be achieved.

This development suggests a future where researchers might eventually attach machine-checked certificates to their findings, streamlining the peer-review process. As AI systems continue to generate longer and more intricate mathematical arguments, these tools may prove essential in identifying logical gaps and managing the growing complexity of modern research.

By automating the drudgery of translation, AI is not replacing the mathematician but acting as an advanced assistant that can bridge the gap between human intuition and machine-verified precision. For the long-standing Fermat’s Last Theorem, this milestone marks the transition of a historical giant into a new era of digital, provable certainty.

Fact Checked

This article has been fact checked for accuracy, with information verified against reputable sources. Learn more about us and our editorial process.

Last reviewed on .

Article history

  • Latest version

Reference(s)

  1. Formalizing Fermat's Last Theorem.” <https://www.anthropic.com/research/formalizing-fermats-last-theorem>.
  2. https://twitter.com/AnthropicAI/status/2095947707605266436/video/1.” <https://t.co/pdT8zwlV4A>.

Cite this page:

Shah, Rabia. “AI Just Formalized Fermat’s Last Theorem Using 13 Million Lines of Code.” BioScience. BioScience ISSN 2521-5760, 10 September 2026. <https://www.bioscience.com.pk/en/subject/mathematics/ai-cracks-the-code-behind-a-legendary-theorem-in-just-11-days-after-decades-of-human-effort>. Shah, R. (2026, September 10). “AI Just Formalized Fermat’s Last Theorem Using 13 Million Lines of Code.” BioScience. ISSN 2521-5760. Retrieved September 10, 2026 from https://www.bioscience.com.pk/en/subject/mathematics/ai-cracks-the-code-behind-a-legendary-theorem-in-just-11-days-after-decades-of-human-effort Shah, Rabia. “AI Just Formalized Fermat’s Last Theorem Using 13 Million Lines of Code.” BioScience. ISSN 2521-5760. https://www.bioscience.com.pk/en/subject/mathematics/ai-cracks-the-code-behind-a-legendary-theorem-in-just-11-days-after-decades-of-human-effort (accessed September 10, 2026).
End of the article