Mathematics and formalisation

Warwick Mathematics Colloquium

Mathematics and formalisation

Damiano Testa

University of Warwick

Friday 27 November 2026

ζ

The slides

Last Friday Wednesday

A proof of the Riemann hypothesis, in Lean

Levent Alpöge announced a proof of the Riemann hypothesis, found working with Claude, and published it only as Lean code.

17 million

300,000

lines of Lean code;
Mathlib, by comparison: 2.4 million

175,187

803

files;
Mathlib: about 8,700

< 1 day

< 1 hour

until an independent check reported that every file compiles

Struck through: Alpöge’s proof, as announced on Friday. Since Wednesday: a shorter rewriting by Luke Sernau and colleagues at Anthropic, with Claude.

How much of the proof do we need to read?

Can we trust the proof?

What can we learn from the proof?

Andrew Sutherland’s proof explorer

Proof stats

What is in it

It proves

the Riemann hypothesis, as stated in Mathlib, and GRH for Dirichlet L-functions

Its size

300,000 lines of code, in 803 files; Mathlib has 2.4 million lines

Known and new

over half the code is known results missing from Mathlib, say the AI authors

It draws on

parts of class field theory, Galois representations, p-adic Hodge theory, Shimura varieties, theta lifts and the Siegel–Weil formula, and a trace formula

One proof assistant among several

What is Lean?

Lean is a proof assistant: given a statement and a proof, it checks that the proof really proves the statement.

It cannot tell us whether the statement says what we mean.

Statement and proof Lean its kernel checks every step Accepted the proof proves the statement Rejected Lean points to the step that fails

Other proof assistants include Rocq (formerly Coq), Isabelle, HOL Light, Mizar, Metamath; this talk is about Lean.

About me

My formalisation experience

Mathlib

Involved since 2020, as a contributor and as a maintainer.

AI

Involved in training models for formalisation, and in using them for (auto)formalisation projects, small and large.

Current projects

Formalising the outputs of computer algebra systems in Lean, with Matthew Ballard, Anton Leykin and Michael Stillman.

More recently, the Classification of Finite Simple Groups, with Inna Capdeboscq.

A human research project

Mathlib: written and reviewed by people

Lean’s library of mathematics: 2.4 million lines, about 85,000 definitions and 245,000 theorems, written since 2017 by more than 750 contributors.
Every mathematical addition is human-reviewed before it is merged.

A research project

organising mathematics so that each concept has one canonical definition

For mathematicians

a shared body of checked mathematics, to use and to extend

For AI provers, too

the language of their statements, their tools, their training data

Every AI-written Lean proof in this talk builds on Mathlib.

How we got here

AI provers: years in the making

By

Aug 2019

The IMO Grand Challenge: can an AI win IMO gold, with proofs in Lean?

posed by Selsam, de Moura, Buzzard, …

Sep 2020

A language model writes formal proofs (GPT-f)

OpenAI

Aug 2021

miniF2F: 488 olympiad problems, stated formally

Zheng, Han, Polu

Feb 2022

Olympiad problems solved in Lean, two adapted from the IMO

OpenAI

Nov 2022

Ten IMO problems solved in Lean

Meta AI

May 2024

Open-weight provers for Lean, free for anyone to run

DeepSeek; later Moonshot AI (Kimi), Numina

Jul 2024

IMO 2024: silver, three problems in Lean (statements formalised by hand)

Google DeepMind (AlphaProof)

Jul 2025

IMO 2025: gold, five of six problems in Lean†

Harmonic (Aristotle), ByteDance

Dec 2025

Putnam 2025: all twelve problems in Lean, eight within the exam

Axiom; Numina

Jan 2026

Erdős problems begin to fall to AI, with proofs in Lean

Harmonic (Aristotle) and others

† In the setting of the IMO Grand Challenge, though not under all its rules: it also asks for an open-source system, released before the IMO.

Also building provers for Lean: Apple, Mistral (Leanstral), Logical Intelligence, Tencent, Shanghai AI Lab, StepFun, and many academic groups.

The bitter lesson, in mathematics

Formal proofs, written by AI, at scale

By

Lines of Lean code

Sep 2025

The strong prime number theorem

Math, Inc. (Gauss)

28k

Feb 2026

Sphere packing in dimensions 8 and 24

Math, Inc. (Gauss)

180k

May 2026

An Erdős problem: the unit distance conjecture is false

OpenAI

1.2M

Aug 2026

At least 67.2% of the non-trivial zeros of ζ lie on the critical line

Anthropic (Claude)

100k

Sep 2026

Fermat’s Last Theorem

Anthropic (Claude)

13M

Sep 2026

Navier–Stokes blow-up, with forcing

OpenAI

430k

Oct 2026

722 papers at once, among them a quasi-Riemann hypothesis†

OpenAI

30M

Oct 2026

The classification of finite simple groups

Axiom

43M

Nov 2026

The Stacks Project

Axiom

16M

Nov 2026

Navier–Stokes blow-up, without forcing*

Alpöge, Buckmaster, with Claude

600k

Nov 2026

The Riemann hypothesis

Alpöge; Sernau et al., with Claude

300k

For comparison: all of Mathlib

its community, since 2017

2.4M

† 176 of them come with a formalised main result, the quasi-Riemann hypothesis among them.

* The proof depends on an interval-arithmetic certificate that has not been released yet.

A thought experiment

Imagine we had a proof of the Riemann hypothesis, in 300,000 lines of Lean code

What would we get?

a proof that nobody has read through (yet?)

a certificate that the Riemann hypothesis holds

a lingering doubt that the check was fooled

Hold on to that doubt: we will come back to it.

We could take this as a zero-knowledge formalisation.

As with a zero-knowledge proof in cryptography, we are convinced that the statement is true, and learn nothing else.

Two ways to check a proof

Three burdens come apart

Reading a proof does three jobs at once; a proof assistant pulls them apart.

Reading the proof

With a proof assistant

The statement

in the author’s words

in formal definitions

The proof

referees and readers

the kernel

Understanding

comes with the checking

has to be sought for its own sake

Reading an argument as long as the proof of the Riemann hypothesis
would take referees years; a proof assistant checks it in under an hour.

The trusted base

What do we have to trust?

What could go wrong

What helps

The statement

it does not say what we mean

short, built on trusted definitions

The definitions

a word does not mean what its name says

Mathlib: reviewed, used, tested

The proof

it redefines the words

statement and proof kept apart

The kernel

the checker has a bug

several independent kernels

The assumptions

hidden hypotheses slip in

only the three standard axioms

No human has to read the proof.

The statement

The Riemann hypothesis, as stated in Mathlib

def RiemannHypothesis : Prop := ∀ (s : ℂ) (zero : riemannZeta s = 0) (nontrivial : ¬∃ n : ℕ, s = -2 * (n + 1)) (not_pole : s ≠ 1), s.re = 1 / 2

Every zero of ζ, other than −2, −4, −6, …, has real part ½.

The trivial zeros

nontrivial excludes the trivial zeros.

The pole

In Mathlib, even ζ(1) has a value: (γ − log 4π)/2. It is not 0, and not_pole excludes it anyway.

The main file proves the statement above.

The definitions

Why we trust Mathlib’s definitions

Anyone can read Mathlib’s definition of ζ, and its reviewers did, carefully: every declaration in Mathlib goes through a rigorous review.

On top of that, Mathlib proves that it has the properties that characterise ζ:

ζ(s) = ∏ over primes p of (1 − p^−s)^−1, for Re s > 1

holomorphic, except at s = 1

Plus ζ(2) = π²/6, the functional equation, the trivial zeros, no zeros with Re s ≥ 1, and much more.

Read the statement; trust the library for the definitions.

Misformalisation

It happens

Mathlib’s unit ball in ℝ × ℝ in the Euclidean plane

Types

Written with ℝ × ℝ, the unit disc is a square.

Hypotheses

“If 0 < x < 1, then …”, with no type for x: Lean takes x to be a natural number, the hypotheses never hold, and every conclusion is provable.

An Erdős problem

For x₁, x₂, … in [0, 1], are there infinitely many m, n with |x_(m+n) − x_m| ≤ 1/(√5 n)?
Initially formalised with m ≠ 0 instead of n ≠ 0.

Benchmarks

An ICML 2026 audit of miniF2F and four other benchmarks found 398 defects, each confirmed in Lean: false statements, vacuous ones, unsound axioms.

Side checks

Vetting statements

No machine can certify that a statement means what we intend. But we can test it, cheaply and often.

Familiar facts

Prove what we already know about each definition: ζ(2) = π²/6.

Examples

Exhibit something that satisfies all the hypotheses.

A second reader

Ask an AI to read the formal statement back in words, and to look for slips.

Consequences

Prove that it implies something easier to state: for the Riemann hypothesis,
proved equivalent to σ(n) ≤ H_n + exp(H_n) log H_n for all n, where H_n is the sum of 1/k for k from 1 to n.

Too easy?

If a famous open problem is proved, or disproved, in a few lines, the formal statement is likely not the famous problem.

Each test is a yes-or-no question; together they pin the statement down.

Counting bits

How much does a proof tell us?

1 bit2 bits3 bits

Without engagement

Unread, the proof gives us one bit of information: the statement is true. It is the same with human proofs: they can be beautiful and enlightening, but no engagement means no gain.

AI proofs tend to be verbose, meandering and inefficient, which makes this harder.

Probing further

However, by asking many yes-or-no questions, we can probe further and extract progressively more information.

But every bit is only worth having if the check is honest.

The proof

Tricks that could fool us

Lean is also a programming language: a file can add notation, redefine commands, and run programs while Lean reads it. Three tricks that look fine in the editor:

Notation

One line makes the word RiemannHypothesis mean “true”, and Lean even displays it as RiemannHypothesis.

A hidden axiom

Assume the result as an axiom, then redefine #print axioms so that it lists only the usual three.

No kernel

A short program adds the “theorem” without the kernel ever checking it.

Among 300,000 lines, one is enough.

Comparator

Trusted statement, untrusted proof

The statement kept apart, and read by us The proof untrusted, whoever wrote it comparator builds both in a sandbox the same statement as the one we read, definitions included only the standard axioms no gaps, no new assumptions accepted by the kernel replayed from scratch, by one or more kernels

In Lean, the statement comes after the development,
which could change what it means.

Comparator builds the statement from our own file without the proof,
and compares it with the theorem proved.

Lean’s documentation calls comparator, with independent kernels, the gold standard.

The kernel

Who checks the checker?

The kernel is small, and every proof in Mathlib passes through it. But it is software, and software has bugs. So there are others, written independently.

Lean’s kernel

written in C++; the official one

lean4lean

written in Lean, by Mario Carneiro

nanoda

written in Rust, by Chris Bailey

con-leche

written in Lean and proved sound, by Claude, supervised by Joachim Breitner

The Lean Kernel Arena pits more than thirty checkers, in Rust, Haskell, OCaml, Java, … even TeX and COBOL, against 90 wrong proofs, 135 correct ones, and the whole of Mathlib.

If several independent kernels accept a proof, a bug would have to be in all of them.

Back to last Wednesday

Checking the proof, in public

Andrew Sutherland checked the long, the short and the shortest; for the short one:

passed

all 803 files compile, with no errors, in a sandbox: 32 minutes

passed

built on two machines: the same export, byte for byte

passed

only the three standard axioms

passed

nothing in the source adds axioms or notation, or runs programs

passed

it proves the same five statements as Friday’s: comparator’s statement check, and con-leche’s

passed

Lean’s kernel re-checked every file, then the whole export: 12 and 29 minutes

passed

accepted by nanoda (Rust), and by con-leche and lean4lean (both in Lean)

passed

comparator, end to end, with every checker that ships with Lean: “Your solution is okay!”

Status on Thursday 26 November, 02:50 UTC, math.mit.edu/~drew/shortgrh.
Friday’s proof passed every check: math.mit.edu/~drew/grh

Understanding

Certainty, before understanding

“I am presenting the world with a complete argument before having mastered a massive neighbourhood around its mathematics.”

Levent Alpöge, 20 November 2026

The search for understanding has started on the Riemann hypothesis.

Human formalisation for Mathlib isolates ideas, abstractions and patterns.

To close

Back to the three questions

How much of the proof do we need to read?

Just the statement, using Mathlib’s definitions, which are reviewed and tested.

Can we trust the proof?

Yes: comparator checks it against our statement, with more than one kernel.

What can we learn from the proof?

As much as we engage with it: understanding still takes work.

The statement comes from Mathlib, the proof from anyone, the check from Lean.

Understanding is the next piece of mathematics.

Thank you

ζ

The slides

Two texts behind this talk

Rich Sutton, The Bitter Lesson (2019)

Ted Chiang, “Catching crumbs from the table” (Nature, 2000), reprinted as The Evolution of Human Science

PDF