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

| 1 | module |
| 2 | |
| 3 | import TauCeti.NumberTheory.Padics.Factorial |
| 4 | public import Mathlib.RingTheory.PowerSeries.Exp |
| 5 | public import Mathlib.RingTheory.MvPowerSeries.Rename |
| 6 | import Mathlib.Analysis.SpecialFunctions.RegularizedHypergeometric |
| 7 | import Mathlib.Topology.Algebra.Valued.LocallyCompact |
| 8 | import TauCeti.RingTheory.MvPowerSeries.Derivative |
| 9 | public import Lib.GLn.SchurModule.Basic |
| 10 | public import Lib.General.Algebra.AdicCompletion |
| 11 | |
| 12 | /-! |
| 13 | # Integral power series over ℂ_p: jets, the chain rule and the exponential |
| 14 | |
| 15 | A power series over `ℂ_[p]` is called integral if it comes, through `New.seriesToCp`, from a series |
| 16 | with coefficients in the ring of integers of `ℂ_[p]`. |
| 17 | |
| 18 | ## Main definitions and results |
| 19 | |
| 20 | * `New.mem_range_seriesToCp`: a series in one variable is integral iff all its coefficients have |
| 21 | norm at most one. |
| 22 | * `New.jet_subst_linearSeries`: for a linear substitution `M`, the jet `P(∂) (F ∘ M) (0)` is the jet |
| 23 | of `F` along the polynomial `New.linSubst M P` obtained from `P` by the transposed substitution. |
| 24 | * `New.expSubst`: the exponential `exp a` of a power series `a` in several variables without |
| 25 | constant term; it turns finite sums into products (`New.expSubst_add`, `New.expSubst_sum`). |
| 26 | * `New.padicValNat_factorial_mem_Icc`: `n / (p - 1) - v_p(n!)` lies in `[0, K]` for `n < p ^ K`. |
| 27 | |
| 28 | Notions from other files: |
| 29 | * `MvPolynomial.jetPairing`: the pairing `P(∂)F(0)` of a polynomial `P` with a power series `F`, |
| 30 | the sum over exponents `d` of `d!` times the product of the `d`-th coefficients of `P` and `F`. |
| 31 | * `New.linearSeries`: the linear form `∑ c_i z_i`, as a power series in the variables `z_i`. |
| 32 | * `New.linSubst`: for a matrix `M` over `R`, the `R`-algebra map of polynomial rings that sends |
| 33 | `X_b` to `∑_t M_(t b) X_t`. |
| 34 | |
| 35 | ## Relation to the literature |
| 36 | |
| 37 | Known results: the chain rule and the functional equation of the exponential for formal power |
| 38 | series, and Legendre's formula for the valuation of a factorial. |
| 39 | -/ |
| 40 | |
| 41 | @[expose] public section |
| 42 | |
| 43 | /-! ## The inclusion of integral power series -/ |
| 44 | |
| 45 | section PadicSeriesDefs |
| 46 | |
| 47 | variable {p : ℕ} [Fact p.Prime] {σ : Type} |
| 48 | |
| 49 | /-- The inclusion of power series over the integers `valRingCp p` into power series over `ℂ_[p]`, as |
| 50 | a ring homomorphism. -/ |
| 51 | noncomputable abbrev New.seriesToCp : MvPowerSeries σ (valRingCp p) →+* MvPowerSeries σ ℂ_[p] := |
| 52 | MvPowerSeries.map (σ := σ) (valRingCp p).subtype |
| 53 | |
| 54 | @[simp] |
| 55 | lemma New.seriesToCp_smul (k : valRingCp p) (f : MvPowerSeries σ (valRingCp p)) : |
| 56 | seriesToCp (p := p) (σ := σ) (k • f) = (k : ℂ_[p]) • seriesToCp f := |
| 57 | rfl |
| 58 | |
| 59 | end PadicSeriesDefs |
| 60 | |
| 61 | /-! ## Integral series, units, partial derivatives and linear forms -/ |
| 62 | |
| 63 | section IntegralSeries |
| 64 | |
| 65 | open MvPowerSeries PowerSeries |
| 66 | |
| 67 | namespace New |
| 68 | |
| 69 | /-- The linear form ∑ c_i z_i, as a power series in the variables z_i. -/ |
| 70 | noncomputable def linearSeries {ι R : Type*} [Fintype ι] [CommSemiring R] (c : ι → R) : |
| 71 | MvPowerSeries ι R := |
| 72 | ∑ i : ι, c i • MvPowerSeries.X i |
| 73 | |
| 74 | /-- Scaling the coefficients of a linear form scales its power series by the same scalar. -/ |
| 75 | lemma linearSeries_smul {ι R : Type*} [Fintype ι] [CommSemiring R] (a : R) (c : ι → R) : |
| 76 | linearSeries (a • c) = a • linearSeries c := by |
| 77 | simp [linearSeries, Finset.smul_sum, mul_smul] |
| 78 | |
| 79 | /-- Summing the coefficients of finitely many linear forms sums their power series. -/ |
| 80 | lemma linearSeries_sum {ι J R : Type*} [Fintype ι] [CommSemiring R] (s : Finset J) (c : J → ι → R) : |
| 81 | linearSeries (∑ j ∈ s, c j) = ∑ j ∈ s, linearSeries (c j) := by |
| 82 | simp only [linearSeries, Finset.sum_apply, Finset.sum_smul] |
| 83 | rw [Finset.sum_comm] |
| 84 | |
| 85 | variable {σ : Type*} {R S : Type*} [CommRing R] [CommRing S] {p : ℕ} [Fact p.Prime] |
| 86 | |
| 87 | /-- A power series `f` in one variable over `ℂ_[p]` comes from a series over the ring of integers |
| 88 | `valRingCp p` if and only if all its coefficients have norm at most one. -/ |
| 89 | lemma mem_range_seriesToCp {f : ℂ_[p]⟦X⟧} : |
| 90 | f ∈ seriesToCp.range ↔ ∀ n : ℕ, ‖f.coeff n‖ ≤ 1 := by |
| 91 | constructor |
| 92 | · rintro ⟨g, rfl⟩ n |
| 93 | exact (g.coeff (Finsupp.single () n)).property |
| 94 | · intro hf |
| 95 | have h_mem (d : Unit →₀ ℕ) : f d ∈ valRingCp p := by |
| 96 | rw [d.unique_single] |
| 97 | exact hf (d ()) |
| 98 | exact ⟨fun d ↦ ⟨f d, h_mem d⟩, rfl⟩ |
| 99 | |
| 100 | lemma map_pderiv (Ψ : R →+* S) (i : σ) (f : MvPowerSeries σ R) : |
| 101 | MvPowerSeries.map Ψ (pderiv i f) = pderiv i (MvPowerSeries.map Ψ f) := by |
| 102 | ext |
| 103 | simp [coeff_pderiv] |
| 104 | |
| 105 | @[simp] |
| 106 | lemma isUnit_integer_iff_norm_eq_one {c : valRingCp p} : IsUnit c ↔ ‖(c : ℂ_[p])‖ = 1 := |
| 107 | Valued.integer.isUnit_iff_norm_eq_one |
| 108 | |
| 109 | @[simp] |
| 110 | lemma constantCoeff_linearSeries [Fintype σ] (c : σ → R) : |
| 111 | MvPowerSeries.constantCoeff (linearSeries c) = 0 := by |
| 112 | simp [linearSeries] |
| 113 | |
| 114 | end New |
| 115 | |
| 116 | end IntegralSeries |
| 117 | |
| 118 | /-! ## Rescaling after substitution -/ |
| 119 | |
| 120 | /-- Rescaling the result of a substitution rescales every image of a variable. -/ |
| 121 | lemma MvPowerSeries.rescale_subst {σ τ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] |
| 122 | (a : τ → S) {v : σ → MvPowerSeries τ S} (hv : MvPowerSeries.HasSubst v) |
| 123 | (f : MvPowerSeries σ R) : |
| 124 | MvPowerSeries.rescale a (f.subst v) = f.subst (fun i ↦ MvPowerSeries.rescale a (v i)) := by |
| 125 | rw [MvPowerSeries.rescale_eq_subst, |
| 126 | MvPowerSeries.subst_comp_subst_apply hv (MvPowerSeries.HasSubst.smul_X a)] |
| 127 | congr 1 |
| 128 | funext i |
| 129 | rw [← MvPowerSeries.rescale_eq_subst] |
| 130 | |
| 131 | open PowerSeries in |
| 132 | /-- Substituting `a X` in `f(T)` gives `f(T(a X))`, if `T(0) = 0`. -/ |
| 133 | lemma New.rescale_subst {R S : Type*} [CommRing R] [CommRing S] [Algebra R S] |
| 134 | {a : S} {T : S⟦X⟧} (hT₀ : T.constantCoeff = 0) {f : R⟦X⟧} : |
| 135 | rescale a (f.subst T) = f.subst (rescale a T) := by |
| 136 | have hT : PowerSeries.HasSubst T := .of_constantCoeff_zero' hT₀ |
| 137 | simpa only [PowerSeries.rescale_eq, PowerSeries.subst_def] using |
| 138 | MvPowerSeries.rescale_subst (fun _ : Unit ↦ a) hT.const f |
| 139 | |
| 140 | /-! ## The chain rule and jets of linear substitutions -/ |
| 141 | |
| 142 | section JetChainRule |
| 143 | |
| 144 | open MvPolynomial (jetPairing jetPairing_eq_sum jetPairing_mul_X) |
| 145 | |
| 146 | open MvPowerSeries Finset WithPiTopology |
| 147 | |
| 148 | |
| 149 | /-- Jets of a linear substitution. Let `M` be a matrix and substitute the linear forms |
| 150 | `(M z)_i = ∑_k M_(i k) z_k` into the series `F`. The jet `P(∂) F(M z) (0)` equals the jet of `F` |
| 151 | along `linSubst M P`, the polynomial `P(Mᵀ x)`. -/ |
| 152 | lemma New.jet_subst_linearSeries {ι κ R : Type} [CommRing R] [Fintype ι] [Fintype κ] |
| 153 | (M : Matrix ι κ R) (P : MvPolynomial κ R) : |
| 154 | ∀ F : MvPowerSeries ι R, |
| 155 | jetPairing P (subst (fun i : ι ↦ linearSeries (M i)) F) = jetPairing (linSubst M P) F := by |
| 156 | classical |
| 157 | have hM : HasSubst fun i : ι ↦ linearSeries (M i) := |
| 158 | hasSubst_of_constantCoeff_zero fun i ↦ constantCoeff_linearSeries (M i) |
| 159 | induction P using MvPolynomial.induction_on with |
| 160 | | C c => |
| 161 | intro F |
| 162 | have h_const : constantCoeff (subst (fun i : ι ↦ linearSeries (M i)) F) = constantCoeff F := by |
| 163 | rw [constantCoeff_subst hM, finsum_eq_single _ 0 fun d hd ↦ ?_] |
| 164 | · simp |
| 165 | obtain ⟨i, hi⟩ : ∃ i : ι, d i ≠ 0 := Finsupp.ne_iff.1 hd |
| 166 | simp [Finsupp.prod_fintype, prod_eq_zero (mem_univ i), hi] |
| 167 | simp [jetPairing_eq_sum, h_const] |
| 168 | | add P Q hP hQ => simp [hP, hQ] |
| 169 | | mul_X P k hP => |
| 170 | intro F |
| 171 | -- A factor `X k` acts on the series as `∂_k`, and the chain rule moves the derivative inside. |
| 172 | have h_chain : pderiv k (subst (fun i : ι ↦ linearSeries (M i)) F) = |
| 173 | ∑ i : ι, M i k • subst (fun i : ι ↦ linearSeries (M i)) (pderiv i F) := by |
| 174 | rw [pderiv_subst hM] |
| 175 | simp [linearSeries, pderiv_X, Pi.single_apply] |
| 176 | have h_lin : linSubst M (P * .X k) = ∑ i : ι, M i k • (linSubst M P * .X i) := by |
| 177 | simp [linSubst, mul_sum] |
| 178 | simp only [h_lin, map_sum, map_smul, LinearMap.sum_apply, LinearMap.smul_apply, |
| 179 | jetPairing_mul_X, h_chain, hP] |
| 180 | |
| 181 | end JetChainRule |
| 182 | |
| 183 | /-! ## The exponential of a series and p-adic norms of factorials -/ |
| 184 | |
| 185 | section PadicExp |
| 186 | |
| 187 | open PowerSeries Nat List |
| 188 | |
| 189 | namespace New |
| 190 | |
| 191 | variable {p : ℕ} [hp : Fact p.Prime] {σ : Type*} |
| 192 | |
| 193 | /-- The series `exp a`, obtained by substituting `a` into the exponential series over a |
| 194 | `ℚ`-algebra `R`. It is meaningful when `a` has no constant term. -/ |
| 195 | noncomputable abbrev expSubst {R : Type*} [CommRing R] [Algebra ℚ R] (a : MvPowerSeries σ R) : |
| 196 | MvPowerSeries σ R := |
| 197 | (exp R).subst a |
| 198 | |
| 199 | /-- The functional equation `exp (a + b) = exp a * exp b` for series `a`, `b` without constant |
| 200 | term over a characteristic-zero field. -/ |
| 201 | lemma expSubst_add {R : Type*} [Field R] [CharZero R] (a : MvPowerSeries σ R) |
| 202 | {b : MvPowerSeries σ R} (ha : a.constantCoeff = 0) (hb : b.constantCoeff = 0) : |
| 203 | expSubst (a + b) = expSubst a * expSubst b := by |
| 204 | -- The universal case in two variables: `exp (X 0 + X 1) = exp (X 0) * exp (X 1)`. |
| 205 | have h_univ : expSubst (.X 0 + .X 1 : MvPowerSeries (Fin 2) R) = |
| 206 | expSubst (.X 0) * expSubst (.X 1) := by |
| 207 | ext e |
| 208 | -- The coefficients agree: `(m + n).choose m / (m + n)! = 1 / m! * (1 / n!)`. |
| 209 | rw [coeff_subst_X_zero_add_X_one, coeff_subst_X_zero_subst_mul_X_one] |
| 210 | simp [cast_add_choose] |
| 211 | field [factorial_ne_zero] |
| 212 | -- Substituting `a` for `X 0` and `b` for `X 1` commutes with the exponential. |
| 213 | have hab : MvPowerSeries.HasSubst ![a, b] := |
| 214 | MvPowerSeries.hasSubst_of_constantCoeff_zero (by simp [ha, hb]) |
| 215 | have h_comm (F : MvPowerSeries (Fin 2) R) (hF : F.constantCoeff = 0) : |
| 216 | (expSubst F).subst ![a, b] = expSubst (F.subst ![a, b]) := |
| 217 | -- `PowerSeries.subst` is `MvPowerSeries.subst` for a family indexed by `Unit` |
| 218 | MvPowerSeries.subst_comp_subst_apply (HasSubst.of_constantCoeff_zero hF).const hab _ |
| 219 | simpa [MvPowerSeries.subst_add hab, MvPowerSeries.subst_mul hab, h_comm, |
| 220 | MvPowerSeries.subst_X hab] using congrArg (MvPowerSeries.subst ![a, b]) h_univ |
| 221 | |
| 222 | /-- The exponential of a finite sum of series without constant term is the product of their |
| 223 | exponentials. -/ |
| 224 | lemma expSubst_sum {R I : Type*} [Field R] [CharZero R] {t : Finset I} |
| 225 | {a : I → MvPowerSeries σ R} (h_const : ∀ i : I, (a i).constantCoeff = 0) : |
| 226 | expSubst (t.sum a) = ∏ i ∈ t, expSubst (a i) := by |
| 227 | induction t using Finset.cons_induction with |
| 228 | | empty => simp [subst_zero_eq_C_constantCoeff] |
| 229 | | cons i t hi ih => simp [expSubst_add _ (h_const i), h_const, ih] |
| 230 | |
| 231 | /-- The norm of a nonzero natural number `n` in `ℂ_[p]` is `p ^ (-v_p(n))`. -/ |
| 232 | lemma norm_natCast_eq_inv_pow_padicValNat {n : ℕ} (hn : n ≠ 0) : |
| 233 | ‖(n : ℂ_[p])‖ = (p : ℝ)⁻¹ ^ padicValNat p n := by |
| 234 | simpa [Padic.norm_eq_zpow_neg_valuation, hn, Nat.padicValNat_def] using |
| 235 | PadicComplex.norm_extends' p n |
| 236 | |
| 237 | /-- The `p`-adic norm of a finite product of nonzero natural numbers. -/ |
| 238 | lemma norm_prod_natCast_eq_rpow_neg_sum {X : Type*} [Fintype X] {n : X → ℕ} |
| 239 | (hn : ∀ x, n x ≠ 0) : |
| 240 | ‖∏ x, (n x : ℂ_[p])‖ = (p : ℝ) ^ (-∑ x, (padicValNat p (n x) : ℝ)) := by |
| 241 | simp [norm_natCast_eq_inv_pow_padicValNat, hn, Real.rpow_neg p.cast_nonneg, |
| 242 | ← Nat.cast_sum, Finset.prod_pow_eq_pow_sum] |
| 243 | |
| 244 | /-- For `p` prime and `n < p ^ K` one has `n / (p - 1) - K ≤ v_p(n!) ≤ n / (p - 1)`, a consequence |
| 245 | of Legendre's formula. -/ |
| 246 | lemma padicValNat_factorial_mem_Icc {n K : ℕ} (hn : n < p ^ K) : |
| 247 | (padicValNat p n ! : ℝ) ∈ Set.Icc ((n : ℝ) / (p - 1) - K) (n / (p - 1)) := by |
| 248 | rcases eq_or_ne n 0 with rfl | hn0 |
| 249 | · simp [Nat.padicValNat_def] |
| 250 | rw [Set.mem_Icc, Nat.padicValNat_def] |
| 251 | refine ⟨?_, TauCeti.multiplicity_factorial_le_div p n⟩ |
| 252 | have hlog : Nat.log p n + 1 ≤ K := Nat.succ_le_of_lt (Nat.log_lt_of_lt_pow hn0 hn) |
| 253 | exact (sub_le_sub_left (by exact_mod_cast hlog) _).trans |
| 254 | (TauCeti.div_sub_log_le_multiplicity_factorial p n) |
| 255 | |
| 256 | /-- Substituting `a` into the rescaled series `f(c X)` is substituting `c • a` into `f`. -/ |
| 257 | lemma subst_rescale_eq_subst_smul {R : Type*} [CommRing R] {c : R} (a : MvPowerSeries σ R) |
| 258 | (ha : HasSubst a) (f : R⟦X⟧) : |
| 259 | (rescale c f).subst a = f.subst (c • a) := by |
| 260 | rw [rescale_eq_subst, subst_comp_subst_apply (.smul_X' c) ha, subst_smul ha, subst_X ha] |
| 261 | |
| 262 | end New |
| 263 | |
| 264 | end PadicExp |
| 265 | |
| 266 | /-! ## Renaming the variables of a jet -/ |
| 267 | |
| 268 | section JetRename |
| 269 | |
| 270 | open MvPolynomial Finsupp |
| 271 | |
| 272 | /-- The jet pairing `P(∂)F(0)` of a polynomial `P` with a power series `F` is unchanged when both |
| 273 | are renamed along an injective map `e` of variables; `Q` is the renamed polynomial. -/ |
| 274 | lemma New.jet_rename {σ τ R : Type*} (e : σ ↪ τ) [CommSemiring R] {P : MvPolynomial σ R} |
| 275 | {Q : MvPolynomial τ R} (h : rename e P = Q) (F : MvPowerSeries σ R) : |
| 276 | jetPairing Q (F.rename e) = jetPairing P F := by |
| 277 | subst h |
| 278 | induction P using MvPolynomial.induction_on' with |
| 279 | | monomial d r => simp [rename_monomial, ← embDomain_eq_mapDomain, prod, jetPairing_monomial] |
| 280 | | add P Q hP hQ => simp [hP, hQ] |
| 281 | |
| 282 | end JetRename |