Riemann hypothesis: the Lean proof, cleaned up together
The 2026 Lean proof of the Riemann hypothesis and GRH, machine-checked by others, not refereed, no word from Clay; cleaned up together: more readable, faster to build, the theorems unchanged

From a one-sided bound on the primes to a zero-free half-plane
This is the chapter asked for by #30 (T-6). It states and proves in prose the criterion
New.LFunction_ne_zero_of_primeRemainder_le of src/New/Reduction/Zeros/Criterion.lean, and says
how the prime number theorem New.eventually_abs_primeRemainder_exp_le_inv_pow of
src/New/Reduction/Zeros/PrimeNumberTheorem.lean enters. It does not prove the one-sided bound
itself: that bound is the rest of the proof.
1. The objects
Fix a modulus q and a prime d, and let χ_K = (·/d) be the Legendre symbol, which Lean calls
chiK d. The weight
λ(n) = Λ(n) (1 - χ_K(n)) for n ≡ 1 mod q, and 0 otherwise,
is New.lambdaKResidueClass d q. It is nonnegative, because 0 ≤ 1 - χ_K(n) ≤ 2
(New.lambdaKResidueClass_nonneg, New.one_sub_chiK_mem_Icc), and at most 2 Λ(n).
The mean of logarithmic derivatives
G_q(s) = (∑_ψ (logDeriv E_{ψχ_K}(s) - logDeriv E_ψ(s)) - 1) / φ(q),
summed over the characters ψ mod q, is New.logDerivMean d q. Here E_ψ = entireL ψ is
L(s, ψ), multiplied by s - 1 when ψ is principal, and ψχ_K = quadTwist ψ d.
The remainder is
R_q(x) = ∑_{n ≤ x} λ(n) (1/n - 1/x) - log x / φ(q) - c_q, with c_q = re G_q(1),
and is New.primeRemainder d q. The constant c_q is the one for which R_q(x) → 0; §5 says how
the prime number theorem identifies it.
2. The statement
Criterion (New.LFunction_ne_zero_of_primeRemainder_le). Let q₀ be a positive multiple of
8, let d₀ be a prime with d₀ ≡ 7 mod 8 and d₀ coprime to q₀, and let β > 1/2. Suppose
that for every prime d ≡ d₀ mod q₀ there is A with
R_{q₀}(x) ≤ A x^(β - 1) for all large real x.
Then for every character ψ mod q₀ and every ρ ≠ 1 with re ρ > β, one has L(ρ, ψ) ≠ 0.
In Lean the primes are quantified as d : Primes with (d : ℕ) ≡ d₀ [MOD q₀], the bound is
h_bound, and the conclusion is ψ.LFunction ρ ≠ 0 under hρ_ne : ρ ≠ 1 and
hρ_re : β < ρ.re.
So a bound on the primes ≡ 1 mod q₀ — one-sided, and only for the primes of one class mod
q₀ — forces a zero-free half-plane for all characters mod q₀. Nothing is assumed about real
zeros: the argument below excludes them together with the complex ones.
3. One prime: the two zero counts agree
Lemma (New.sum_entireL_orders_eq_twisted_of_primeRemainder_le). Let d be a prime with
d ≡ 7 mod 8, coprime to q, let β > 0, and suppose
R_q(x) ≤ A x^(β - 1) for all large x,
and that on the real interval (β, 1) the total order of the twisted zeros does not exceed the
untwisted one:
∑_χ ord_x E_{χχ_K} ≤ ∑_χ ord_x E_χ for β < x < 1.
Then at every ρ with re ρ > β the two total orders agree, with multiplicities:
∑_χ ord_ρ E_χ = ∑_χ ord_ρ E_{χχ_K}.
The proof has four steps.
The transform and its residues. Define n(s) = ∑_χ ord_s E_χ and
n'(s) = ∑_χ ord_s E_{χχ_K}, and
r(s) = (n(s) - n'(s)) / (φ(q) s (1 - s)).
New.isPolar_primeRemainder says that v ↦ R_q(e^v) has a Laplace transform which converges for
re s > 2 and continues meromorphically to re s > 0 with at most simple poles, whose residue at
s ≠ 1 is exactly r(s), and with no pole at 1. That is the statement New.IsPolar with
residue r, obtained from New.tendsto_logDerivMean_residue and the vanishing of the numerator
at 1 (New.ofReal_re_logDerivMean_one).
The sign on the real interval. For real x with β < x < 1 the assumed inequality
n'(x) ≤ n(x) and the positivity of φ(q) x (1 - x) give re (r x) ≥ 0. For real x ≥ 1 both
counts vanish, since no L(s, ψ) vanishes for re s ≥ 1 (New.entireL_ne_zero), so again
re (r x) = 0. Thus the residue has nonnegative real part at every real point right of β.
The growth condition. The assumed one-sided bound, read at x = e^v, is
R_q(e^v) ≤ A e^((β - 1) v) for all large v; this is exp_bound in the Lean proof.
Landau's lemma. New.IsPolar.landau applies to a transform of one sign: if the residues at real
points right of β have nonnegative real part and the transform grows at most like
e^((β - 1) v), then there is no pole right of β, i.e. r(ρ) = 0. Hence n(ρ) = n'(ρ), first
as complex numbers and then as natural numbers. This is Landau's lemma of 1905, the same device
that turns a one-sided prime bound into a zero-free region in the classical proofs.
4. Choosing the prime, and closing the argument
Lemma (New.exists_entireL_quadTwist_ne_zero). Let β > 1/2, let H be real, and let a be
an invertible class mod N all of whose primes are ≡ 7 mod 8 and coprime to N. Then some
prime d of that class has no zero of any L(s, ξ (·/d)), ξ mod N, in the box
β ≤ re s, |im s| ≤ H.
This lemma is where β > 1/2 is used, and it needs no prime number theorem: the bound on bad
primes is played against the divergence of ∑ log p / p over the class (Dirichlet), through the
zero-density estimate New.zero_density_quadTwist of src/Lib/Analytic/QuadraticTwist.lean.
Proof of the criterion. Apply the choice lemma with N = q₀, a = d₀, H = |ρ.im|; the
hypotheses on the class are supplied by d₀ ≡ 7 mod 8 and (d₀, q₀) = 1, using 8 ∣ q₀. Let
d be the prime it returns. At every s with β ≤ re s and |im s| ≤ |ρ.im| all twisted
L-functions are nonzero, so the twisted total order at s is 0; in particular the hypothesis
hreal of the lemma of §3 holds, with 0 ≤ n(x) on (β, 1). The bound for this d is the one
assumed for the class. The lemma of §3 then gives ∑_χ ord_ρ E_χ = 0. A sum of natural numbers is
zero only if every term is, so ord_ρ E_ψ = 0 for every ψ, that is L(ρ, ψ) ≠ 0. Since
ρ ≠ 1, E_ψ and L(·, ψ) agree at ρ, and the conclusion follows.
5. Where the prime number theorem enters
Theorem (New.eventually_abs_primeRemainder_exp_le_inv_pow). Let d be an odd prime coprime
to q, and let B be a natural number. Then for all large real v,
|R_q(e^v)| ≤ 1 / v^B.
The proof applies a Tauberian theorem (New.eventually_abs_le_inv_pow_of_transform) to the
Laplace transform of v ↦ R_q(e^v), which is (G_q(s)/s - c_q)/(s - 1) by
New.integral_primeRemainder, and uses the holomorphy and growth of G_q(s)/s on
re s ≥ 1 - l^(-26), |s| ≤ e^l (New.eventually_norm_logDerivMean_div_le).
The theorem enters the chapter at three places, and it is worth separating them.
-
The constant. With
B = 1it givesR_q(x) → 0, so the subtractedc_q = re G_q(1)is the constant that makes the remainder tend to zero, as the docstring ofNew.primeRemainderrecords. -
The tail in the one-sided bound. In
src/New/Reduction/OneSidedBound.leanthe theorem is used withB ≥ 24/ε: for every large integerxand everyl ≥ x^(ε/12),|R_{q₀}(e^l)| ≤ x^(-2)and|R_1(e^l)| ≤ x^(-2)(New.eventually_abs_primeRemainder_exp_le). These two bounds are two of the three terms inserted intoNew.Data.primeRemainder_le, and they yield the one-sided bound at integers,R_{q₀}(x) ≤ (64 φ(q₀) + 3) x^(-1/2 + 6ε)(New.eventually_primeRemainder_natCast_le). That is the shape fed into the criterion, withβ = 1/2 + 6ε. -
What it cannot do. The theorem gives logarithmic decay,
1/(log x)^B, which is slower than every powerx^(-δ),δ > 0. It therefore cannot supply the hypothesisR_q(x) ≤ A x^(β - 1)of the criterion for anyβ < 1: that hypothesis is polynomial decay, and it is what the main inequality establishes, not what the prime number theorem gives. The theorem only makes the remainder small enough that the main inequality can absorb it.
6. What this chapter does not show
The one-sided bound R_q(x) ≤ A x^(β - 1) itself. The criterion is conditional on it; the
argument above converts it into the absence of zeros, and stops there. The bound is the content
of the rest of the proof.
7. Declarations used
| Declaration | What it says here |
|---|---|
New.lambdaKResidueClass |
the weight λ(n) = Λ(n)(1 - χ_K(n)) on n ≡ 1 mod q, 0 elsewhere |
New.logDerivMean |
the mean G_q of the differences of logarithmic derivatives, less 1/φ(q) |
New.primeRemainder |
the remainder R_q(x), with c_q = re G_q(1) |
New.isPolar_primeRemainder |
the transform of v ↦ R_q(e^v) has at most simple poles, residue r(s), none at 1 |
New.IsPolar.landau |
Landau's lemma: no pole right of β under a one-sided bound and nonnegative residues |
New.sum_entireL_orders_eq_twisted_of_primeRemainder_le |
at one prime, the twisted and untwisted total orders agree right of β |
New.exists_entireL_quadTwist_ne_zero |
a prime of the class whose quadratic twists have no zero in the box |
New.LFunction_ne_zero_of_primeRemainder_le |
the criterion: L(ρ, ψ) ≠ 0 for ρ ≠ 1, re ρ > β |
New.eventually_abs_primeRemainder_exp_le_inv_pow |
the prime number theorem for R_q: ` |
New.eventually_abs_primeRemainder_exp_le |
with B ≥ 24/ε, the tail is ≤ x^(-2) beyond x^(ε/12) |
New.eventually_primeRemainder_natCast_le |
the resulting one-sided bound R_{q₀}(x) ≤ (64φ(q₀)+3) x^(-1/2+6ε) |