← All articles

Claude closed Fermat in 11 days: 13.4 million lines of Lean and not a single “obviously”

Glowing geometric shapes - Fermat's Last Theorem formalized by artificial intelligence

On September 4, Anthropic showed the first-ever complete machine test of Fermat's Last Theorem. Claude in 11 days, almost without the help of people, translated Andrew Wiles's proof into the language Lean: 13.4 million lines of code, about 30 thousand intermediate theorems, zero “obvious from what has been said.” The project, which mathematicians had been planning for years - only the drawing of the first phase by Kevin Buzzard of Imperial College London was 86 pages long - was completed in a week and a half.

Let us immediately clarify what is not here: there is no new evidence. The model did not come up with its own path to the theorem. She did something different, and, frankly, no less complex - she took a human proof, where on every page there are disclaimers like “this follows trivially,” and rewrote it so that the compiler checks each step. Mathematicians after 1995 were 99.9% confident in the theorem. Now you can go one hundred percent: Lean has run through the entire derivation from the three standard axioms, and there is nothing more to doubt.

What exactly did the computer check?

Numbers are more appropriate here than epithets.

  • The 13.4 million lines of Lean are more than five times larger than the entire Mathlib, the system's main formal mathematics library.
  • About 30 thousand intermediate theorems have been proven; the final output involved approximately 29,500.
  • Compiling a repository on a 96-core machine takes about 20 times longer than compiling Mathlib. Buzzard was given a server with 500 GB of RAM for the duration of the test.
  • Reliance is only on three standard axioms Lean. No “assumptions for simplicity.”

Kevin Buzzard, the same mathematician who has been leading the Fermat formalization project for the community since 2024, downloaded the repository, assembled it and ran the comparator: the output formulation of the theorem coincides with the reference one from Mathlib, all checks are green. His review: “an extraordinary achievement of auto-formalization.”

Glowing graph of related theorems - visualization of machine verification of a proof

One line in the margin, three and a half centuries of work

Around 1637, Pierre de Fermat attributed the statement in the margins of Diophantus' Arithmetic: for n greater than two, the equation aⁿ + bⁿ = cⁿ has no solutions in natural numbers. Below is a phrase that has become a legend: “I have found a truly wonderful proof, but the margins are too narrow for it.” Generations of mathematicians from Euler to Kummer moved towards the result in chunks. In 1908, a prize of 100 thousand gold marks was awarded for proof, and in the first year 621 incorrect solutions were received.

In June 1993, Andrew Wiles presented his proof in a lecture series at Cambridge. Two months later, a reviewer asked a question that revealed a hole in one of the designs. For a year, Wiles patched it up - first alone, then together with former student Richard Taylor - was on the verge of giving it all up, and in 1995 he published a 129-page text. The last, “engineering” question remained: is it possible to force the computer to confirm all this in its entirety?

Not a new proof, but a new opportunity

It is based on Darmon, Diamond and Taylor's 1995 analysis of the Wiles–Taylor argument through the Langlands–Tunnell theorem and Ribet level descent. The idea of ​​formalizing Wiles was voiced back in the 2000s by Dutch computer scientist Jan Bergstra, but until recently this was considered work for an entire scientific direction. Individual cases - fourth degree, regular simple ones - were moved to Lean earlier. With the new repository, Weidik's entire list of 100 formalization tasks is closed: the benchmark against which this area was compared is twenty years old.

Buzzard, by the way, honestly writes: mathematically, the work does not reveal anything new - he already believed in Wiles. The value lies elsewhere. Reviewing a new article in mathematics takes months, or even years; If a machine can be asked to formalize a proof on the fly, peer review will shrink and hidden assumptions at the expert level will begin to surface. For science, where everything rests on the honesty of conclusions, this is a serious shift.

What those 11 days looked like from the inside

The work was led by Tianyi Peng, an Anthropic researcher who had previously assembled a group of AI formalization tools at Columbia University. According to him, he initially did not plan to reach the end: he only wanted to see how much Claude would advance Buzzard’s project. Promoted to the finals.

Many agents worked in parallel: some completed mathematical definitions, others stormed intermediate lemmas, others moved up the theorem tree, and others assembled the parts back into a single conclusion. The first days went wrong - the agents lost the overall picture of the project, and about seven percent of the early attempts remained in the final code. The turnaround happened when the team was transferred to the Prove2Me platform: the proof in it is a graph of theorem nodes, where you can see what has already been proven, what is awaiting prerequisites and what to take next. Statements are separated from proofs, compilation is accelerated, and each theorem has a searchable text description. The scale of the work is about six billion output tokens, and human prompts were reduced to high-level: “this direction is a priority.”

Where to watch

The repository is posted on GitHub - if you wish, you can run the check yourself if you have a machine with 96 cores and strong nerves. Primary sources: analysis from Anthropic And Buzzard's post on the Xena Project blog.

And if, after a story with 13 million lines, you want to see how modern models cope with smaller tasks - algorithms, code, calculations - take a look at the sections "Code" And "Chat" on NeuralSpace: there you can experiment with models and connect them to your projects via the API.