Anthropic's Claude formally proves Fermat's Last Theorem
Anthropic just open-sourced the first complete, machine-checked proof of Fermat's Last Theorem in Lean 4, generated entirely by AI agents. Spanning over 13 million lines of code and 29,511 theorems, the massive artifact successfully passed checks by two independent verification kernels without extra axioms. It marks a historic milestone for AI-driven mathematics.

Anthropic just open-sourced fermats-last-theorem, a complete, machine-checked Lean 4 proof of Fermat's Last Theorem on GitHub. Spanning 29,511 theorems, 1,450 definition modules, and more than 13 million lines of code, it stands as the longest Lean proof artifact ever created.
The codebase follows the historic proof route mapped out by Frey, Serre, Ribet, Wiles, and Taylor-Wiles. It is distributed under the Apache 2.0 license as a standalone research artifact, complete with an offline interactive documentation viewer.
How it was built
The entire Lean source was generated by AI agents building on top of human-written open-source libraries, with Lean itself acting as the uncompromising arbiter. Because it was written strictly for machine checking rather than human reading, variable labels and intermediate names carry algorithmic pipeline tags rather than intuitive textbook names.
Purity was guaranteed from the ground up. The build relies strictly on Lean's three standard axioms without any sorry placeholders, added axioms, or native_decide shortcuts. Every declaration was checked against Lean 4.33.1 and Mathlib v4.33.0.
To leave zero doubt about correctness, Anthropic verified the output twice. Beyond passing standard Lean kernel replays and comparator checks, the entire environment was exported and passed through nanoda, an independent Lean kernel written in Rust. It checked 1,052,234 declarations with zero errors.
How to run it and system requirements
Rebuilding the entire proof from source requires serious hardware running Linux or macOS, as file paths are too long for Windows. Lake pulls Mathlib and compiles everything from scratch.
You will need around 5 GB of RAM per parallel worker, with peak usage hitting 153 GB across 96 threads, taking about 5.5 hours. Total disk usage requires tens of gigabytes, plus over 200 GB of temporary C build artifacts. Running the single-threaded comparator script requires up to 300 GB of memory and nearly 15 hours.
If you just want to inspect the mathematical argument, you do not need a server cluster. The repository includes an offline html directory of around 390 MB. Opening html/index.html in any modern browser lets you explore step-by-step theorem routes and interactive dependency graphs without running a local server.
Why it matters
This release is primarily valuable for formal verification researchers, mathematicians, and engineers working on autonomous agent workflows. It provides concrete proof that AI agents, when paired with an automated theorem prover, can tackle one of humanity's most complex mathematical achievements without hallucinating errors along the way.
While the machine-generated syntax is dense and unreadable for casual study, it shows how AI can eliminate decades of tedious formalization grunt work. It firmly establishes formal logic kernels as the gold standard for validating AI-generated science.
Sources (1)
- github.com(opens in a new tab)Originalgithub.com