The Stacks Project, formalized in Lean

Open original

Axiom has released a Lean formalization of the Stacks Project, the open-source algebraic geometry reference, as a single machine-checked library of about 16 million lines. It is meant for researchers and AI agents to import definitions and theorems into new formal proofs.

  • The library covers the full Stacks Project, roughly 7,500 pages, and is described as the largest integrated, reusable formalized mathematics library built so far.
  • Each Lean declaration links back to the permanent Stacks tags, so readers can compare the code side by side with the original text and a dependency graph.
  • Formalization surfaced dozens of statements in the Stacks Project needing fixes, including missing hypotheses and claims that fail in full generality, with agents building counterexamples.

Axiom has released a Lean formalization of the entire Stacks Project, the open-source reference that lays out the foundations of modern algebraic geometry. The text runs about 7,500 pages, and the formalization comes to roughly 16 million lines of code, which the company calls the largest integrated, reusable library of formalized mathematics yet built. The point is not just a pile of verified theorems. Researchers and AI agents can now import definitions and results from one connected codebase into new proofs, and permanent Stacks tags tie each Lean declaration back to the canonical text. The project started in 2005 under Columbia mathematician Johan de Jong and grew through contributions from hundreds of mathematicians over two decades. The Lean and Mathlib communities supplied the base library and abstractions that made a job this size possible. The motivation is a worry about verification. As AI systems produce mathematical arguments faster than people can check them by hand, formal proof becomes the practical safeguard. Fields with mature Lean infrastructure can formalize new results fairly quickly, but algebraic geometry has been hard to reach. A single modern proof can rest on a long chain of results from commutative algebra, schemes, sheaves, cohomology, and algebraic stacks before its own argument starts. The article's claim is that the math existed in the Stacks Project but the Lean infrastructure did not. Axiom says it closed that gap by deploying coordinated swarms of AI agents to translate, prove, and integrate thousands of theorems in parallel. The harder problem, according to the authors, was software engineering rather than mathematics. Uncoordinated AI code generation can produce small isolated scripts fast, but a multi-million-line library needs stable interfaces and clean abstractions. Without coordination, two agents can prove correct results about the same object using incompatible definitions, or rebuild machinery that already exists in Mathlib. Lean's kernel will accept both versions in isolation, which is why architecture matters. The release keeps the original tag structure, and the site stacks.axiommath.ai lets readers view the original pages beside the Lean code and an interactive dependency graph. Because one Stacks tag can map to several formal declarations, some new and some bridged to existing Mathlib results, the interface tracks those mappings explicitly.

Ask about this article