View all blog posts
Code

The Minimal Model Program, Formalized in Lean

How a century of birational geometry—and recent AI-generated proofs—became 2.1 million lines of machine-checked mathematical truth

The Minimal Model Program Formalized in Lean

On October 6, OpenAI announced solutions to hundreds of open problems in mathematics, including landmark manuscripts claiming to settle the remaining open cases of the 4-dimensional Minimal Model Program (MMP). Yet as AI begins operating beyond the capacity of human peer review, mathematics faces a new bottleneck: when a proof spans hundreds of pages of intricate casework generated by a model, how do we know what is actually true?

Without verification, complex AI reasoning is a black box we have to take on faith. The solution to this problem lies in formal verification.

Today, Axiom Math is releasing a complete Lean formalization of the Minimal Model Program in dimensions 2, 3, and 4. Spanning 2 million lines of machine-checked code packaged into a reusable library, our release brings classical birational geometry together with OpenAI’s recent four-dimensional breakthroughs into a single, verified setting.

Built directly on top of Axiom’s formalization of the Stacks Project, this work demonstrates a fundamental shift in how mathematical knowledge is built: raw AI generates plausible conjectures, while formalized AI builds permanent, composable ground truth.

Why Mathematicians Simplify Shapes: The 2D Blueprint

Algebraic geometry studies algebraic varieties, which are geometric spaces defined by systems of polynomial equations. Just as $y = x^{2}$ carves out a parabola in the plane, systems of polynomials in many variables carve out higher-dimensional varieties with rich internal geometry.

Classifying all algebraic varieties up to isomorphism is hopelessly vast. Instead, birational geometry classifies varieties up to modifications on lower-dimensional subsets. This allows mathematicians to split the daunting task of classification into two parts. First, given a variety $X$, we apply a sequence of birational transformations—each modifying $X$ only along lower-dimensional loci—until reaching a “minimal model” $X'$ that cannot be simplified any further. Second, we classify the resulting minimal models and fibred spaces using discrete numerical invariants.

For a concrete picture, consider a smooth projective surface $X$ with a distinguished point. The birational operation known as a blow-up replaces that single point with an entire projective line $\mathbb{P}^{1}$ recording all tangent directions through the point. Away from the point and the newly inserted curve, the two surfaces are identical.

Blowing up a point $p$ of a surface $X$. Each line through $p$ meets the exceptional curve $E \cong \mathbb{P}^{1}$ in the point recording its direction; the map $\pi$ contracts $E$ back to $p$.
Blowing up a point $p$ of a surface $X$. Each line through $p$ meets the exceptional curve $E \cong \mathbb{P}^{1}$ in the point recording its direction; the map $\pi$ contracts $E$ back to $p$.

Around the turn of the twentieth century, Guido Castelnuovo, Federigo Enriques, and the Italian school showed when this process can be reversed. By Castelnuovo’s contraction theorem, if a smooth projective surface contains a $(-1)$-curve—a smooth rational curve with self-intersection $-1$—that curve can be collapsed back down to a smooth point.

Because each contraction drops a positive integer invariant called the Picard number $\rho(X)$ by one, this process cannot continue forever. After finitely many steps, one reaches a minimal surface $X'$ containing no $(-1)$-curves. In the mid-twentieth century, Kunihiko Kodaira extended this theory to complex surfaces, culminating in the Enriques–Kodaira classification, which organizes minimal surfaces into ten distinct geometric families governed by their Kodaira dimension $\kappa(X)$ and Hodge numbers.

Running the Algorithm: Extremal Contractions and Flips

The Minimal Model Program generalizes the Enriques–Kodaira blueprint to arbitrary dimensions. Rather than hunting for $(-1)$-curves, the higher-dimensional algorithm is governed by the canonical class $K_{X}$, which measures the intrinsic curvature of the variety.

To simplify $X$, the MMP inductively removes curves along which $X$ has positive curvature—that is, $K_{X}$-negative curves, which are curves $C$ whose intersection pairing satisfies $K_{X} \cdot C < 0$. Two foundational theorems drive each step of the algorithm. First, the Cone Theorem describes the geometry of the cone of curves $\overline{NE}(X)$ up to deformation, asserting that the $K_{X}$-negative portion is locally generated by countably many extremal rays. Second, the Contraction Theorem guarantees that any $K_{X}$-negative extremal ray determines a morphism $f \colon X \to Z$, called an extremal contraction, that collapses precisely the family of curves spanning that ray.

What happens next depends on the dimension of the locus swept out by the contracted curves. If the family of curves sweeps out the entire variety $X$, then $\dim Z < \dim X$. In this fiber-type contraction, the map $X \to Z$ presents $X$ as a Mori fiber space—a family of lower-dimensional Fano varieties parameterized by $Z$—and the algorithm terminates. If instead the curves sweep out a subvariety of codimension one (a divisor), then $X \to Z$ is a divisorial contraction. Here $Z$ has the same dimension as $X$, its Picard number $\rho(Z) = \rho(X) - 1$ strictly drops, and we feed $Z$ back into the MMP.

However, if the contracted curves sweep out a locus of codimension two or greater, a genuine higher-dimensional obstacle appears. After such a small contraction, the resulting space $Z$ becomes so badly singular that its canonical class $K_{Z}$ is no longer $\mathbb{Q}$-Cartier, meaning we can no longer even compute intersection numbers $K_{Z} \cdot C$ to continue the algorithm.

A flip. The small contraction $f$ collapses the $K_{X}$-negative curve $C$ to a point of $Z$ where $K_{Z}$ is not $\mathbb{Q}$-Cartier; the flip $f^{+}\colon X^{+}\to Z$ replaces $C$ with a $K_{X^{+}}$-positive curve $C^{+}$.
A flip. The small contraction $f$ collapses the $K_{X}$-negative curve $C$ to a point of $Z$ where $K_{Z}$ is not $\mathbb{Q}$-Cartier; the flip $f^{+}\colon X^{+}\to Z$ replaces $C$ with a $K_{X^{+}}$-positive curve $C^{+}$.

To rescue the algorithm from a small contraction $X \to Z$, we must perform surgery known as a flip. Rather than stopping at $Z$, we construct a companion birational map $X^{+}\to Z$ that extracts the singular locus and replaces the $K_{X}$-negative curves with $K_{X^{+}}$-positive curves.

This reveals one of the deepest lessons of modern birational geometry: even if we only care about smooth varieties, the MMP forces us to pass through singular ones. Mathematicians had to identify delicate classes of singularities—such as terminal and Kawamata log terminal (klt) singularities—that are broad enough to remain closed under divisorial contractions and flips, yet restrictive enough to preserve the cohomological tools of smooth geometry.

When mathematicians speak of “proving the MMP,” they mean proving two things: the existence of flips, which ensures that for every small contraction $X \to Z$ the flipped variety $X^{+}$ actually exists, and the termination of flips, which guarantees that there is no infinite chain of flips $X \dashrightarrow X_{1} \dashrightarrow X_{2} \dashrightarrow \cdots$. While divisorial contractions are bounded by the Picard number $\rho(X)$, flips leave $\rho(X)$ unchanged, making termination notoriously difficult to control.

The 3D MMP, Log Pairs, and BCHM

Dimension 3 is the first dimension where flips become unavoidable. In the 1980s and early 1990s—building on Grothendieck’s scheme-theoretic foundations and breakthroughs by Miles Reid, Yujiro Kawamata, and János Kollár—Shigefumi Mori proved the existence of 3-fold flips through a tour-de-force classification of terminal threefold singularities, earning the 1990 Fields Medal.

Shortly thereafter, Vyacheslav Shokurov proved the termination of 3-fold flips. Using Hironaka’s resolution of singularities, Shokurov introduced a discrete nonnegative integer invariant called the difficulty, which measures the complexity of the singularities of the threefold. By proving that the difficulty strictly decreases after every flip, he guaranteed that the 3D MMP must terminate after finitely many steps.

When the 3D MMP terminates, it decomposes any threefold into fundamental building blocks, much like the fundamental theorem of arithmetic factors integers into primes. The output is either a minimal model, where $K_{X}$ is nef ($K_{X} \cdot C \ge 0$ for every curve $C$) and can be studied via its Kodaira dimension, or a Mori fiber space $X \to Z$, where $Z$ is a curve or a surface. Because classifying these fibrations requires understanding the base $Z$, the classification of 3-folds exhibits a recursive structure that rests directly on the 2D classification of surfaces.

To push this induction beyond dimension 3, mathematicians generalized the program from varieties $X$ to log pairs $(X, \Delta)$, where $\Delta$ is a formal $\mathbb{Q}$-linear combination of codimension-one subvarieties playing the role of a boundary. In 2005, Christopher Hacon and James McKernan clarified the inductive engine of the log-MMP, proving that the termination of log-flips in dimension $n - 1$ implies the existence of log-flips in dimension $n$.

This culminated in the landmark 2006 paper by Caucher Birkar, Paolo Cascini, Christopher Hacon, and James McKernan commonly referred to as BCHM. BCHM established the existence of log-flips in arbitrary dimensions and proved the existence of minimal models for varieties of log general type. Rather than solving termination in general, BCHM cleverly showed that by running the MMP with scaling—carefully choosing which extremal ray to contract at each step—that specific sequence of flips is guaranteed to terminate. Birkar later proved a major boundedness theorem for Fano varieties (the BAB conjecture), earning the 2018 Fields Medal for his contributions to the program and its fundamental building blocks.

The 4-Dimensional MMP and AI Verification

Despite the triumph of BCHM, proving the unconditional termination of log-flips—and establishing the full MMP outside the BCHM hypotheses—remained a central challenge starting in dimension 4. As the dimension grows, the possible configurations of singularities and their discrepancy invariants after a flip become vastly more intricate, making Shokurov-style difficulty functions extraordinarily hard to control.

Over the past two decades, mathematicians steadily chipped away at special cases of the 4-fold MMP, including Joaquín Moraga’s recent 2025 theorem establishing termination for pseudo-effective 4-fold flips. Then, in autumn 2026, OpenAI released a series of manuscripts claiming to resolve the remaining open cases needed to complete the 4-dimensional MMP.

In dimension 4, the casework is so intricate that traditional human peer review of these AI-generated manuscripts could take years. Yet no formalization accompanied OpenAI’s papers, largely because the vast foundational machinery of modern algebraic geometry had never been available in a proof assistant.

Axiom’s formalization closes that gap in days. How did our AI agents build a 2.1-million-line verified codebase—larger than many operating systems—so quickly?

They didn’t start from scratch. They built directly on top of Axiom’s Lean formalization of the Stacks Project. Initiated by Johan de Jong and developed by a global community of contributors, the Stacks Project is the definitive connected reference for scheme theory and algebraic geometry. By importing our formalized Stacks Project APIs alongside Mathlib, Axiom’s agents had immediate, machine-checked access to cohomology, sheaf theory, resolution properties, and birational morphisms.

In Lean, every implicit assumption in a human or AI manuscript must be made explicit, and every edge case in 4-dimensional singularity theory must compile against the kernel. While mathematical peer review checks that definitions capture the intended geometric intuition, Lean guarantees with mathematical certainty that the conclusions follow from the stated hypotheses.

Why Formalized AI Matters

The mathematics behind this release belongs to generations of geometers—from Castelnuovo, Enriques, and Kodaira to Grothendieck, Mori, Shokurov, Birkar, Hacon, McKernan, Cascini, Kollár, and Moraga—and to the Lean and Mathlib communities whose infrastructure makes formalization possible.

With dimensions 2, 3, and 4 locked into machine-checked ground truth, the foundation is now in place for future researchers and AI agents to build upon these theorems without having to reconstruct a century of prerequisites. As AI-driven discovery scales past the limits of human review, informal reasoning becomes a bottleneck. Verification is what makes it science. By compiling 2.1 million lines of birational geometry into a machine-checked library, Axiom is turning AI output into mathematical certainty and permanent, composable human knowledge.

Explore the Release

The complete Lean 4 codebase is available at https://github.com/AxiomMath/MMP.

References

Caucher Birkar, Paolo Cascini, Christopher D. Hacon, and James McKernan, Existence of minimal models for varieties of log general type, Journal of the American Mathematical Society 23 (2010), 405–468.

Christopher D. Hacon and James McKernan, Extension theorems and the existence of flips, in Flips for 3-folds and 4-folds, Oxford University Press (2007), 76–110.

János Kollár, Minimal models of algebraic threefolds: Mori’s program, Astérisque 177–178 (1989), 303–326.

Shigefumi Mori, Flip theorem and the existence of minimal models for 3-folds, Journal of the American Mathematical Society 1 (1988), 117–253.

Joaquín Moraga, Termination of pseudo-effective 4-fold flips (2025).

OpenAI, Termination for projective log canonical fourfolds with rational boundary (2026).

Vyacheslav V. Shokurov, Three-dimensional log flips, Izvestiya Rossiiskoi Akademii Nauk. Seriya Matematicheskaya 56 (1992), 105–203.