Claude 13 Million Line Lean Code Audited
📐 News

Claude 13 Million Line Lean Code Audited

Anthropic September 4 post records Claude writing 13 million lines of Lean code for Fermat’s Last Theorem formalization over 11 days. Audit covers source

The AI Dude · September 7, 2026 · 4 min read

Anthropic Research Post

"Claude worked largely autonomously over 11 days to write the proof in the Lean programming language" appears in the September 4 research post on anthropic.com. The same paragraph records 13 million lines of Lean code and 29,500 intermediate theorems proved during the run. SiliconANGLE reported the same numbers the same day, attributing them directly to the Anthropic release.

The work used an internal research model described as roughly comparable to Claude Fable 5.1 per Anthropic's announcement. Dozens of agents operated inside the Prove2Me platform, which maintained a directed acyclic graph of theorem statements and separated statements from proofs to reduce compilation time. Total output reached six billion tokens.

The announcement notes that the finished proof uses just Lean’s three standard axioms. A comparator confirmed that the theorem’s statement matches Mathlib’s own statement of Fermat’s Last Theorem. The effort followed a simplified version of Wiles’s proof from Darmon, Diamond, and Taylor, with human input limited to occasional high-level directives such as “Jacobian as a scheme sounds high priority.”

Kevin Buzzard reviewed the result and stated that the proof is multi-layered and that AI autoformalization artefacts are now robust enough to be built upon. The post records that initial agent attempts without Prove2Me lost track of project state and stopped collaborating effectively, contributing failed efforts that still accounted for roughly 7 percent of the non-boilerplate lines retained in the final artifact. Buzzard added in the same review that the work shows autoformalization of algebra, harmonic analysis, geometry and number theory.

Lean Code Lines

The post states it wrote 13 million lines of Lean. The figure covers the total code emitted by the agent team while constructing the formalization.

Mathlib, the main community library the proof builds on, is described as over 5x smaller than the new artifact. Every line was produced under Lean’s three standard axioms with no additional assumptions. The artifact is the largest Lean proof ever constructed according to the announcement.

The code generation process involved multiple agents defining concepts, proving intermediate theorems, and chaining those results into harder statements. Excerpts from the agents show timestamps such as “The FLT root reads PROVED on prove2me at 02:00:57Z Aug-18” and “Historic moment for this campaign.” The full proof and a written walk-through are available on GitHub as stated in the source.

Separate theorem statements and proofs into different files was one of the platform features credited with lowering resource consumption. Natural-language descriptions of each theorem statement were also maintained to simplify the proof path. The platform further enabled search and reuse across the directed acyclic graph of statements.

Theorem Count Scope

The 29,500 theorems count only those statements that received machine-checked proofs inside the Prove2Me harness. Each theorem corresponds to a node in the directed acyclic graph that agents consulted to select the next task. The count excludes failed efforts that contributed ~7% of the non-boilerplate lines in the final proof.

The scope follows a simplified version of Wiles’s proof from Darmon, Diamond, and Taylor. Human input was limited to occasional high-level directives such as priority ordering for specific sub-theorems. The finished artifact was verified by Lean and cross-checked against Mathlib’s statement of Fermat’s Last Theorem.

The announcement records that Claude produced computer-verifiable proofs of 30,300 theorems along the way, using 29,500 in the final proof. Three core sub-theorems formed the main colored sections of the Prove2Me plan graph. The total exceeds the size of prior community formalization efforts by a wide margin.

The source notes that automatically formalizing a proof as complex as FLT is presented as a step toward checking larger portions of the mathematical literature. It also records that the same approach was applied in a smaller test formalizing Vinogradov’s Three Primes Theorem under the Hardy-Littlewood Circle Method. The announcement further states that the techniques will enable rigorous checks of LLM-generated mathematics, a process currently costly when led by humans.

Consumer Plan Experiment

The six billion tokens were generated on an internal research deployment. Anthropic researchers did a small experiment using three personal Claude Max plans to formalize applications of the Hardy-Littlewood Circle Method. Collaborating entirely through Prove2Me, the agents jointly completed a formalization of Vinogradov’s Three Primes Theorem in just three days.

The announcement states that with the right scaffold, collaborative formalization of major results with consumer AI subscriptions is achievable. It records that Anthropic and other labs have expanded support for external researchers with free and discounted subscriptions and research credits, plus dedicated grants for larger scientific projects.

The internal model used is described as roughly comparable to Claude Fable 5.1. Source 2 notes that rival OpenAI used its latest Astra model on several Erdos problems in the same period, though under different conditions and without the same Lean formalization target. The pricing page for gpt-6-astra lists input at $10 per million tokens and output at $50 per million tokens, with cached input at $1 and cache writes at $12.50.

Batch and Flex pricing on the same page sit at 50 percent of standard rates, while fast mode doubles the applicable rates. The 11-day figure would turn out to be wrong if the Prove2Me platform had not been used, since initial attempts without it failed to complete the proof.

claudefermat-last-theoremleananthropicformalization
Share 𝕏 / Twitter Reddit LinkedIn

Keep reading

Weekly issue

The 5 AI tools that mattered this week.

One email, Fridays. No spam, unsubscribe anytime.