View all blog posts
Code

The Weil Conjectures, Formalized in Lean

From the work of Grothendieck and Deligne to a reusable formal proof

The Weil conjectures formalized in Lean

Axiom has formalized the classical Weil conjectures in Lean, a proof assistant that checks mathematical arguments step by step. Alexander Grothendieck and Pierre Deligne’s landmark proof showed how geometry governs the number of solutions to polynomial equations over finite fields. These counts are encoded in zeta functions whose zeros and poles determine them, much as the zeros of the Riemann zeta function govern the distribution of prime numbers. In the finite-field setting, the proof explains the geometric meaning of those zeros and poles and establishes the analogue of the Riemann hypothesis. [2, 5, 10] Our development makes these theorems available as computer-checked results that future formal proofs can use. It builds on Mathlib, the Lean community’s mathematics library, and Axiom’s formalization of the Stacks Project.[1]

This achievement embodies Grothendieck’s “rising sea” approach to mathematics: understanding advances through the development of a surrounding theory, gradually bringing an apparently inaccessible problem within reach. [9] The Stacks Project demonstrates the power of that approach through its organization and exposition. It unifies an immense body of algebraic geometry into a coherent theory from which further results emerge. Our formalization mirrors that progression. The deep mathematics has not disappeared; it has become available for reuse, allowing the next proof to begin where earlier work leaves off.

A finite count with a geometric meaning

An algebraic variety is a geometric object defined by polynomial equations; its points are solutions to those equations. The Weil conjectures concern varieties over finite fields. For a prime p, the integers modulo p form a finite field: two integers represent the same element when their difference is divisible by p. This field has p elements and allows addition, subtraction, multiplication, and division by nonzero elements. More generally, every finite field has $q = p^m$ elements for some prime p and positive integer m. Restricting a point’s coordinates to the chosen field turns the search for solutions into a finite counting problem.

The surprising discovery was that geometry constrains the count of possible solutions. Work by Emil Artin and F. K. Schmidt had connected the arithmetic of curves to zeta functions (finite-field analogues of the Riemann zeta function). In the 1930s, Helmut Hasse proved a striking estimate for elliptic curves, which can be represented by nonsingular cubic equations, with a point at infinity included. If N counts the points over a field with q elements, then

$$|N-(q+1)| \leq 2\sqrt{q}.^*$$

For q = 997, Hasse’s bound restricts the number of points to between 935 and 1061. During the 1940s, André Weil extended this result to smooth projective curves of every genus (the invariant analogous to the number of handles of a surface), establishing the analogue of the Riemann hypothesis for these curves. His theory of correspondences (algebraic relations between points on curves) reduced the estimate to proving that a quadratic form built from these relations is nonnegative. [2, 11]

In 1949, Weil proposed that a much larger pattern governed point counts on varieties of every dimension. Fix a variety X over a field with q elements. For each positive integer $r$, let $N_X(q,r)$ count the points on $X$ over the degree-r extension, a field with qʳ elements in which the same equations may have additional solutions. With T a formal variable, these counts define the zeta function:

$$Z(X,q,T)=\exp\left(\sum_{r=1}^{\infty}\frac{N_X(q,r)T^r}{r}\right)$$

For an elliptic curve E over a field with p elements, where p is prime, the zeta function takes a particularly simple form:

$$Z(E,p,T)=\frac{1-a_pT+pT^2}{(1-T)(1-pT)}=\frac{(1-\alpha_pT)(1-\beta_pT)}{(1-T)(1-pT)}$$

Here $a_p=p+1-N_E(p,1)=\alpha_p+\beta_p$ and $\alpha_p\beta_p=p$. Hasse’s theorem is equivalent to $|\alpha_p|=|\beta_p|=\sqrt{p}$: the reciprocals of the two zeta zeros lie on a circle of radius $\sqrt{p}$. Their sum measures the deviation of the point count from $p + 1$; the triangle inequality recovers Hasse’s bound. This is the pattern Weil sought in higher dimensions. [11]

Weil predicted that for a smooth projective variety X, the zeta function $Z(X,q,T)$ is a rational function (a quotient of polynomials). Loosely speaking, smooth means that the variety has no singularities; projective means that it is a closed subspace of projective space, where points at infinity are included.

Writing $d=\dim(X)$, Weil also predicted a functional equation relating $Z\left(X,q,\frac{1}{q^dT}\right)$ to $Z(X,q,T)$. With the change of variables $T=q^{-s}$, up to an explicit factor, this becomes a symmetry between s and $d − s$; for curves, it is the familiar $s\leftrightarrow 1-s$ symmetry of the Riemann zeta function. [11]

Weil further predicted that the polynomial factors of the zeta function should reflect the topology of a corresponding complex variety, when the two are related by good reduction: passing to finite characteristic without introducing singularities. Finally, the reciprocals of the roots of those factors should have precisely prescribed magnitudes. Rationality, the functional equation, the topological comparison, and the Riemann hypothesis form the four classical Weil conjectures. [2]

The topological prediction was remarkable. Finite-field point counts should recover Betti numbers, which count independent topological features in different dimensions. Arithmetic over a finite set was detecting the structure of a continuous geometric space.

Dwork finds a different entrance

In 1959, Bernard Dwork proved that the infinitely many point counts could indeed be encoded by a quotient of two finite polynomials. This was rationality, the first general breakthrough on the Weil conjectures; his paper appeared in 1960. His theorem even allowed singularities and varieties that were not projective. [3]

Dwork reached this result through p-adic analysis, in which divisibility by powers of a prime gives a different way to measure size. Combining estimates in this arithmetic notion of size with ordinary estimates on integers, he proved rationality before the geometric machinery was ready. The structure of the zeta function was established, but the geometric meaning of its factors remained to be explained.

Grothendieck builds the common language

Over the complex numbers, a smooth projective curve can be studied as a compact surface, with its genus counting the handles. Over a finite field, there is no ordinary surface whose holes we can count. Grothendieck’s program sought algebraic tools that could recover the geometric information relevant to counting solutions.

That program required new foundations. Schemes extended the notion of a variety, giving geometry over complex numbers and over finite fields a common language. Sheaves organized local information so that it could be fitted together. Grothendieck developed these foundations in the Éléments de géométrie algébrique, written with Jean Dieudonné, and the Séminaire de géométrie algébrique. Michael Artin and Jean-Louis Verdier contributed to the cohomological theory. [4]

Cohomology records geometric features using linear algebra: it assigns a vector space to each degree, whose dimension is a Betti number. For a torus, the first three Betti numbers are 1, 2, 1: one connected component, two independent directions for closed loops, and one two-dimensional surface class. Maps between spaces induce linear maps between their cohomology groups.

Étale cohomology makes this approach possible over finite fields. It uses algebraic maps that behave like local coverings without branching to recover the properties needed from ordinary topology. For the smooth projective varieties considered here, the resulting cohomology spaces are finite-dimensional, so questions about geometry can be translated into matrix calculations. *

Frobenius supplies the connection to counting. Raising coordinates to the q-th power fixes precisely the points defined over the field with q elements; repeating the operation detects points over its extensions. This geometric operation induces linear maps on cohomology.

Counting points now becomes a calculation with these linear maps. The trace of a matrix is the sum of its diagonal entries, or equivalently its eigenvalues counted with multiplicity. If F denotes the action of Frobenius and $H^i(X)$ the degree-i cohomology space, the Grothendieck–Lefschetz trace formula says

$$N_X(q,r)=\sum_{i=0}^{2d}(-1)^i\operatorname{Tr}(F^r\mid H^i(X)).$$

For the elliptic curve over a field with p elements considered earlier, $\alpha_p$ and $\beta_p$ are exactly the two eigenvalues on its middle cohomology. They are the same numbers that appeared in the numerator of its zeta function. The formula above extends that relationship to higher-dimensional varieties and to every finite extension of the field.

The eigenvalues give polynomial factors for the zeta function, explaining rationality. Poincaré duality pairs complementary cohomological degrees and yields the functional equation. Comparison with complex geometry recovers the predicted Betti numbers. What remained was to establish the exact magnitudes of the eigenvalues. Grothendieck’s standard conjectures proposed a route through positivity for algebraic cycles, higher-dimensional relatives of the correspondences Weil had used for curves. Deligne found another way.

Deligne obtains the exact estimate

Identifying the eigenvalues did not yet control their sizes. Deligne proved that they had exactly the magnitudes Weil predicted, completing the decisive step in 1973 and publishing it in La conjecture de Weil I in 1974. His proof began with Grothendieck’s cohomological interpretation and duality. [5]

Deligne studied a variety through a moving family of slices, much as one might study a surface by intersecting it with moving planes. Such a family is called a Lefschetz pencil. Most slices are smooth, but a few develop controlled singularities. Following how the cohomology changes around these exceptional slices—a phenomenon called monodromy—provides information about the original variety.

A connection with number theory supplied a crucial estimate. Robert Rankin had bounded coefficients of modular forms by studying expressions involving their squares. Deligne explicitly credited reading Rankin with catalyzing his main lemma. He found a related positivity argument in geometry: nonnegative coefficients allowed him to compare information from individual slices with information from the entire family, controlled by the trace formula.

A further argument removed the slack in the estimate. A fixed extra factor in a bound for a k-th power approaches 1 after taking k-th roots as k grows. Applied to the geometric setting, this turns an approximate upper bound into a sharp one. Together with Poincaré duality, this sharp upper bound forces the exact magnitude Weil predicted. In cohomological degree i, every Frobenius eigenvalue $\alpha$ satisfies

$$|\alpha|=q^{i/2}.^*$$

This is the Riemann hypothesis over finite fields. For elliptic curves, i = 1 gives the square-root magnitude that Hasse had established. In higher dimensions, each degree has its own prescribed scale. Deligne’s Weil II, published in 1980, developed a broader theory of these scales, called weights, with applications far beyond the original conjectures. [6]

The Stacks Project makes the theory usable

The Stacks Project, maintained by Aise Johan de Jong and developed with many contributors, organizes an immense body of algebraic geometry into a reference that readers can build on. Its definitions and proofs are arranged so that later arguments can use earlier results without rebuilding their foundations. Permanent identifiers, called tags, make those dependencies explicit. [7]

That organization and exposition deserve substantial credit. After working through the relevant foundations, a reader approaches the Weil conjectures with much of the necessary mathematics already in hand. Our formalization mirrors this progression: the Weil development uses the same formal definitions as Axiom’s formalization of the Stacks Project, making earlier proofs directly available to later ones.

The project’s principal reference is Eberhard Freitag and Reinhardt Kiehl’s Étale Cohomology and the Weil Conjecture. The decisive weight estimate comes from Axiom’s formalization of the Stacks Project, where it is proved along Gérard Laumon’s later Fourier-transform route. The development therefore establishes the classical conclusions without reproducing Deligne’s 1974 proof line by line. [1, 8]

The Stacks Project records Deligne’s weight theorem as Tag 03VH. In Lean, citing that tag is not enough: the theorem must be backed by a formal proof. The Weil project then combines that checked result with the trace formula, duality, and comparison theorems. Its concluding argument can be comparatively short because the difficult mathematics beneath it is already available.

What we have formalized

We formalized the four Weil conjectures, including the comparison with Betti numbers under good reduction. We package the point-counting conclusions into a theorem that later Lean proofs can invoke, using Mathlib’s standard definitions and the shared foundations described above. [1]

Lean checks whether the stated conclusions follow from the definitions and assumptions. The repository reports a sorry-free proof with no added axioms beyond Lean’s standard logical foundations. There are also technical refinements. The relevant characteristic polynomials have integer coefficients and are independent of the auxiliary prime used to construct cohomology. The central eigenvalue and point-counting results apply to smooth proper varieties; properness is an algebraic analogue of compactness, allowing a broader setting than projectivity. [1]

The development owes its foundations to the contributors to the Stacks Project, the Lean and Mathlib communities, and the mathematical authors whose work it encodes.

What comes next

Ramanujan’s tau function records the integer coefficients of a particular modular form. One of the most compelling applications of Deligne’s theorem is the proof of Ramanujan’s predicted bound for these coefficients. Rankin’s work on these coefficients helped inspire Deligne’s proof; that proof in turn supplied the decisive ingredient for Ramanujan’s conjectured bound. Deligne connected the modular form to cohomology of an associated higher-dimensional geometric construction. The weight law then gives, for every prime p,

$$|\tau(p)|\leq 2p^{11/2}.$$

This application is not part of the present formalization. A formal proof must still build the connection between modular forms and cohomology. But it can now take the Weil theorem as an established input. The same relationship between foundations and discovery that shaped the original mathematics can guide its formal development: a new project begins with a profound key ingredient already available.

Sources and further reading

[4] Alexander Grothendieck and Jean Dieudonné, Éléments de géométrie algébrique (EGA), Publications Mathématiques de l’IHÉS (1960–1967); Michael Artin, Alexander Grothendieck, and Jean-Louis Verdier, Théorie des topos et cohomologie étale des schémas (SGA 4), Lecture Notes in Mathematics 269, 270 and 305, Springer (1972–1973).

[12] Ken Ono and Amir D. Aczel, My Search for Ramanujan: How I Learned to Count, Springer (2016).

Contributors

Lead Contributor: Tony Yue Yu

Contributors: Letong Hong, Kenny Lau, Jannis Limperg, Brian Nugent, Ken Ono, Ashvin Swaminathan, Jesse Thorner, Edison Xie.

A note from Ken Ono

In 1955, at the Tokyo–Nikko conference, André Weil noticed the talent of a young Japanese graduate student, my father, Takashi Ono, and arranged a two-year position for him at the Institute for Advanced Study. At an impromptu after-dinner talk during that conference, Weil told the story of Ramanujan, and years later my father passed that story on to me. In 1997, my parents and I visited Weil at the Institute so that they could thank him. As I wrote in my memoir, “I was to be the next link in the chain.” [12]

Seeing Weil’s conjectures checked line by line in Lean is, for me, a way of returning some of that gratitude. Because Deligne’s proof is also the key to Ramanujan’s conjecture, the next step of this work would close the circle.

— Ken Ono, Founding Mathematician, Axiom Math