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.ArithmeticDirichletSeries.Convergence |
| 4 | import Mathlib.Algebra.Order.Star.Real |
| 5 | import Mathlib.Analysis.Complex.CoveringMap |
| 6 | import Mathlib.Analysis.Normed.Group.Tannery |
| 7 | import Mathlib.Analysis.SpecialFunctions.Complex.Analytic |
| 8 | import Mathlib.Analysis.SpecialFunctions.Log.Summable |
| 9 | import Mathlib.Data.Finset.Functor |
| 10 | import Mathlib.NumberTheory.NumberField.DedekindZeta |
| 11 | import Mathlib.RingTheory.Ideal.Int |
| 12 | import TauCeti.NumberTheory.RamificationInertia.Tower |
| 13 | public import Lib.ClassField.Places.Ideles |
| 14 | import Lib.Adelic.Adeles.StrongApproximation |
| 15 | |
| 16 | /-! |
| 17 | # Euler products over primes of a number field and densities at primes of degree one |
| 18 | |
| 19 | This file treats Hecke characters of a number field `K`, given by their finite part `ψ`, a |
| 20 | character of the finite ideles `(𝔸f K)ˣ`, and Euler products with coefficients `a v`, `‖a v‖ ≤ 1`, |
| 21 | over the primes `v` of `K`, as functions of a real variable `s > 1`. |
| 22 | |
| 23 | * `New.IsHeckeOfType`: `ψ` has open kernel and `ψ x * ∏ w, (Φ w x / ‖Φ w x‖) ^ n w = 1` on `Kˣ`; |
| 24 | `New.heckeCoeff ψ S` is the value of `ψ` at the local idele of the chosen uniformiser for `v ∉ S`, |
| 25 | and `0` for `v ∈ S`. |
| 26 | * `New.eulerProd`: the product `∏ (1 - a v * q ^ (-s))⁻¹`, defined as `exp` of a sum of logarithms; |
| 27 | `New.hasProd_eulerProd` says that it is the limit of the partial products. |
| 28 | * `New.hasSum_eulerProd`: for a completely multiplicative function on ideals, of modulus at most |
| 29 | `1`, the product equals the Dirichlet series. |
| 30 | * `New.HasPrimeDensity`: the Dirichlet mean of `a` over the primes of degree one. Densities are |
| 31 | linear and monotone (`New.HasPrimeDensity.sum`, `New.HasPrimeDensity.re_le_re`). |
| 32 | * `New.hasPrimeDensity_of_tendsto`: the density is read off from the order of the pole or zero of |
| 33 | the product at `1`. |
| 34 | |
| 35 | Up to a bounded error, the logarithm of the product is the sum of `a v * q ^ (-s)` over the primes |
| 36 | of degree one (`New.norm_log_one_add_neg_mul_cpow_sub_ite_le_of_norm_le_one`, |
| 37 | `New.sum_inv_minFac_sq_le_finrank`). Here `New.FinPlace K` is the type of nonzero primes of `𝓞 K`, |
| 38 | `q = v.q` is the absolute norm of `v`, and degree one means that `q` is prime. |
| 39 | |
| 40 | Notions from other files: |
| 41 | * `New.locIdele v`: sends `x ∈ K_vˣ` to the finite idele with component `x` at `v` and `1` |
| 42 | elsewhere; `New.uniformizer v` is a chosen uniformiser of the completion `K_v`. |
| 43 | * `Φ w` (class `New.PlaceEmbedding`): a chosen complex embedding of `K` inducing the infinite |
| 44 | place `w`. |
| 45 | |
| 46 | ## Relation to the literature |
| 47 | |
| 48 | Known; see `Lib.ClassField.HeckeL.ContinuationAtOne` for sources. |
| 49 | -/ |
| 50 | |
| 51 | @[expose] public section |
| 52 | |
| 53 | noncomputable section |
| 54 | |
| 55 | open NumberField IsDedekindDomain.HeightOneSpectrum Filter Topology Complex Finset Ideal Module |
| 56 | ContinuousAt Set |
| 57 | |
| 58 | namespace New |
| 59 | |
| 60 | variable {K : Type*} [Field K] [NumberField K] |
| 61 | (ψ : (𝔸f K)ˣ →* ℂˣ) (n : InfinitePlace K → ℤ) (a b : FinPlace K → ℂ) {s : ℝ} |
| 62 | |
| 63 | /-- The character `ψ` of the finite ideles is the finite part of a Hecke character of type `n`, |
| 64 | where `n` gives an integer exponent `n w` to each infinite place `w`: the kernel of `ψ` is open, |
| 65 | and `ψ x * ∏ w, (Φ w x / ‖Φ w x‖) ^ n w = 1` for `x ∈ Kˣ`, with `Φ w` the chosen complex embedding |
| 66 | inducing `w` and `x` read as a finite idele by the diagonal embedding. -/ |
| 67 | def IsHeckeOfType [PlaceEmbedding K] : Prop := |
| 68 | ψ.ker.IsOpen ∧ |
| 69 | ∀ x : Kˣ, ψ (principalIdele x) * ∏ w : InfinitePlace K, (Φ w x.val / ‖Φ w x‖) ^ n w = 1 |
| 70 | |
| 71 | /-- `ψ` is unramified at the finite place `v`: it is `1` on the units of the completion `K_v` of |
| 72 | valuation `1`, read as finite ideles by `New.locIdele v`. -/ |
| 73 | def CharUnramifiedAt (v : FinPlace K) : Prop := |
| 74 | ∀ u : (LocField v)ˣ, Valued.v u.val = 1 → ψ (locIdele v u) = 1 |
| 75 | |
| 76 | /-- The function on finite places sending `v ∉ S` to the value of `ψ` at the local idele of the |
| 77 | chosen uniformiser `uniformizer v` of `K_v`, and `v ∈ S` to `0`. -/ |
| 78 | def heckeCoeff (S : Set (FinPlace K)) : FinPlace K → ℂ := |
| 79 | indicator Sᶜ fun v : FinPlace K ↦ (ψ (locIdele v (uniformizer v))).val |
| 80 | |
| 81 | /-- The Euler product `∏ (1 - a v * q ^ (-s))⁻¹` over the primes `v` of `K`, with `q = v.q` the norm |
| 82 | of `v`, as a function of real `s`. It is written `exp (-∑' v, log (1 + -(a v * q ^ (-s))))`, in the |
| 83 | form `log (1 + w)` of Mathlib's bounds for the logarithm. The value at `s` is the limit of this |
| 84 | expression at `s` within `(1, ∞)`: for `‖a v‖ ≤ 1` and `s > 1` it is the expression itself |
| 85 | (`New.eulerProd_eq_exp`, `New.hasProd_eulerProd`), at `s = 1` it is the limit from the right if that |
| 86 | exists, and for `s < 1` it has no meaning. With `a = heckeCoeff ψ S` and `ψ` unramified at every |
| 87 | `v ∉ S` it is the Euler product of the Hecke `L`-function of `ψ` without the factors at `S`. -/ |
| 88 | def eulerProd : ℝ → ℂ := |
| 89 | extendFrom (Set.Ioi 1) fun s : ℝ ↦ |
| 90 | exp (-∑' v : FinPlace K, Complex.log (1 + -(a v * v.q ^ (-s : ℂ)))) |
| 91 | |
| 92 | /-- The Dirichlet mean of `a` over the primes of degree one (those of prime norm `q`) is `l`, with |
| 93 | a bounded error: for `s > 1` near `1` the series `∑ a v * q ^ (-s)` over these primes converges, |
| 94 | and its sum is `l * log (1 / (s - 1)) + x s` with `x` bounded as `s → 1⁺`. -/ |
| 95 | def HasPrimeDensity (l : ℂ) : Prop := |
| 96 | ∃ x : ℝ → ℂ, |
| 97 | -- `∑ a v * q ^ (-s) = -l * log (s - 1) + O(1)` as `s → 1⁺`, over the `v` whose norm `q` is |
| 98 | -- prime |
| 99 | x =O[𝓝[>] 1] (1 : ℝ → ℝ) ∧ |
| 100 | ∀ᶠ s : ℝ in 𝓝[>] 1, |
| 101 | HasSum (fun v : FinPlace K ↦ ite v.q.Prime (a v) 0 * v.q ^ (-s : ℂ)) |
| 102 | (x s - l * Real.log (s - 1)) |
| 103 | |
| 104 | /-- For a finite set `u` of primes of `K`, the sum over `v ∈ u` of `1 / p ^ 2`, with `p` the least |
| 105 | prime factor of the norm `v.q`, is at most the degree `[K : ℚ]`. -/ |
| 106 | lemma sum_inv_minFac_sq_le_finrank (u : Finset (FinPlace K)) : |
| 107 | ∑ v ∈ u, (v.q.minFac ^ 2 : ℝ)⁻¹ ≤ finrank ℚ K := by |
| 108 | -- Group the primes by the least factor `p` of their norm. The primes of one group lie over the |
| 109 | -- same rational prime, so there are at most `[K : ℚ]` of them, and `∑ 1 / p ^ 2 ≤ 1`. |
| 110 | have h_minFac (v : FinPlace K) : v.q.minFac = absNorm (v.asIdeal.under ℤ) := by |
| 111 | -- The norm of `v` is a positive power of the rational prime below `v`. |
| 112 | simp [← (v.asIdeal.under ℤ).absNorm_pow_inertiaDeg v.asIdeal, |
| 113 | (Nat.absNorm_under_prime _).pow_minFac (inertiaDeg_pos ..).ne'] |
| 114 | have h_group (v : FinPlace K) : #{w ∈ u | w.q.minFac = v.q.minFac} ≤ finrank ℚ K := by |
| 115 | grw [← RingOfIntegers.rank, |
| 116 | ← TauCeti.RamificationInertia.ncard_primesOver_le_finrank (v.asIdeal.under ℤ), |
| 117 | ← Set.ncard_coe_finset] |
| 118 | refine Set.ncard_le_ncard_of_injOn _ (fun w hw ↦ ⟨w.isPrime, ⟨ext ?_⟩⟩) asIdeal_injective.injOn |
| 119 | (IsDedekindDomain.primesOver_finite ..) |
| 120 | -- `w` lies over the prime below `v`: two ideals of `ℤ` with the same norm are equal. |
| 121 | simp_all [Int.cast_mem_ideal_iff] |
| 122 | -- The least prime factors lie in `(1, N)` for `N` one more than their maximum. |
| 123 | set N : ℕ := u.sup fun v : FinPlace K ↦ v.q.minFac + 1 |
| 124 | have h_range : u.image (fun v : FinPlace K ↦ v.q.minFac) ⊆ Ioo 1 N := |
| 125 | image_subset_iff.mpr fun v hv ↦ mem_Ioo.mpr ⟨(Nat.minFac_prime v.one_lt_q.ne').one_lt, |
| 126 | le_sup (f := fun w : FinPlace K ↦ w.q.minFac + 1) hv⟩ |
| 127 | calc |
| 128 | _ = ∑ p ∈ u.image (fun v : FinPlace K ↦ v.q.minFac), |
| 129 | #{w ∈ u | w.q.minFac = p} • (p ^ 2 : ℝ)⁻¹ := |
| 130 | sum_comp (fun p : ℕ ↦ (p ^ 2 : ℝ)⁻¹) _ |
| 131 | _ ≤ ∑ p ∈ u.image (fun v : FinPlace K ↦ v.q.minFac), finrank ℚ K • (p ^ 2 : ℝ)⁻¹ := |
| 132 | sum_le_sum (forall_mem_image.mpr fun v _ ↦ nsmul_le_nsmul_left (by positivity) (h_group v)) |
| 133 | _ ≤ finrank ℚ K • (2 / ((1 : ℕ) + 1) : ℝ) := by |
| 134 | -- `∑ 1 / p ^ 2 ≤ 2 / (1 + 1)` over `1 < p < N`. |
| 135 | grw [← smul_sum, h_range, sum_Ioo_inv_sq_le] |
| 136 | _ = finrank ℚ K := by norm_num |
| 137 | |
| 138 | variable {a b} {l l' : ℂ} |
| 139 | |
| 140 | /-- For real `s > 1` the series of `N(I) ^ (-s)` over all ideals `I` of `𝓞 K` converges, with |
| 141 | `N(I) = absNorm I` (the zero ideal has norm `0` and term `0`). -/ |
| 142 | lemma summable_absNorm_rpow (hs : 1 < s) : |
| 143 | Summable fun I : Ideal (𝓞 K) ↦ (absNorm I : ℝ) ^ (-s) := by |
| 144 | refine (summable_subtype_and_compl (s := (nonZeroDivisors (Ideal (𝓞 K)) : Set _))).1 |
| 145 | ⟨(TauCeti.summable_absNorm_rpow_ideal_iff (K := K)).mpr hs, ?_⟩ |
| 146 | have h_fin : ((nonZeroDivisors (Ideal (𝓞 K)) : Set (Ideal (𝓞 K)))ᶜ).Finite := |
| 147 | (Set.finite_singleton (⊥ : Ideal (𝓞 K))).subset fun I hI ↦ |
| 148 | by_contra fun hne ↦ hI (mem_nonZeroDivisors_of_ne_zero hne) |
| 149 | exact h_fin.summable (fun I ↦ (absNorm I : ℝ) ^ (-s)) |
| 150 | |
| 151 | /-- For `‖a v‖ ≤ 1` and real `t ≤ s`, the term `-(a v * q ^ (-s))` of the Euler factor has norm at |
| 152 | most `q ^ (-t)`, with `q = v.q` the norm of the prime `v`. -/ |
| 153 | private lemma norm_neg_mul_cpow_le_rpow_of_norm_le_one (ha : ∀ v : FinPlace K, ‖a v‖ ≤ 1) {t : ℝ} |
| 154 | (ht : t ≤ s) (v : FinPlace K) : ‖-(a v * v.q ^ (-s : ℂ))‖ ≤ (v.q : ℝ) ^ (-t) := by |
| 155 | grw [norm_neg, norm_mul_le, ha, one_mul, norm_cpow_le, ht] |
| 156 | · -- `‖q ^ (-s)‖ = q ^ (-s)` for the positive real `q`. |
| 157 | simp |
| 158 | · exact mod_cast v.one_lt_q.le |
| 159 | |
| 160 | /-- For `‖a v‖ ≤ 1` and real `s ≥ 1`, the term `-(a v * q ^ (-s))` has norm at most `1 / q`. -/ |
| 161 | private lemma norm_neg_mul_cpow_le_inv_of_norm_le_one (ha : ∀ v : FinPlace K, ‖a v‖ ≤ 1) |
| 162 | (hs : 1 ≤ s) (v : FinPlace K) : ‖-(a v * v.q ^ (-s : ℂ))‖ ≤ (v.q : ℝ)⁻¹ := by |
| 163 | simpa [Real.rpow_neg] using norm_neg_mul_cpow_le_rpow_of_norm_le_one ha hs v |
| 164 | |
| 165 | /-- For `‖a v‖ ≤ 1` and real `1 ≤ σ ≤ s`, the logarithm of the Euler factor `1 - a v * q ^ (-s)` has |
| 166 | norm at most `2 * q ^ (-σ)`. -/ |
| 167 | lemma norm_log_one_add_neg_mul_cpow_le_of_norm_le_one (ha : ∀ v : FinPlace K, ‖a v‖ ≤ 1) |
| 168 | {σ : ℝ} (hσ : 1 ≤ σ) (hσs : σ ≤ s) (v : FinPlace K) : |
| 169 | ‖Complex.log (1 + -(a v * v.q ^ (-s : ℂ)))‖ ≤ 2 * v.q ^ (-σ) := by |
| 170 | set w : ℂ := -(a v * v.q ^ (-s : ℂ)) |
| 171 | have h_inv : ‖w‖ ≤ (v.q : ℝ)⁻¹ := norm_neg_mul_cpow_le_inv_of_norm_le_one ha (hσ.trans hσs) v |
| 172 | have h_half : ‖w‖ ≤ 1 / 2 := by |
| 173 | rw [one_div] |
| 174 | exact h_inv.trans (inv_anti₀ two_pos (mod_cast v.one_lt_q)) |
| 175 | exact (norm_log_one_add_half_le_self h_half).trans |
| 176 | (mul_le_mul (by norm_num) (norm_neg_mul_cpow_le_rpow_of_norm_le_one ha hσs v) |
| 177 | (norm_nonneg w) zero_le_two) |
| 178 | |
| 179 | /-- For `‖a v‖ ≤ 1` and real `s ≥ 1`, the logarithm of the Euler factor `1 - a v * q ^ (-s)` |
| 180 | differs from `-(a v * q ^ (-s))` (if `q` is prime) or from `0` (if not) by at most `2 / p ^ 2`, with |
| 181 | `p` the least prime factor of `q`. -/ |
| 182 | lemma norm_log_one_add_neg_mul_cpow_sub_ite_le_of_norm_le_one (ha : ∀ v : FinPlace K, ‖a v‖ ≤ 1) |
| 183 | (hs : 1 ≤ s) (v : FinPlace K) : |
| 184 | ‖Complex.log (1 + -(a v * v.q ^ (-s : ℂ))) - |
| 185 | (if v.q.Prime then -(a v * v.q ^ (-s : ℂ)) else 0)‖ ≤ 2 / v.q.minFac ^ 2 := by |
| 186 | set w : ℂ := -(a v * v.q ^ (-s : ℂ)) |
| 187 | split_ifs with hq |
| 188 | · -- `q` is its own least factor, and `‖log (1 + w) - w‖ ≤ ‖w‖ ^ 2 / (1 - ‖w‖) / 2 ≤ 1 / q ^ 2`. |
| 189 | have h_inv : ‖w‖ ≤ (v.q : ℝ)⁻¹ := norm_neg_mul_cpow_le_inv_of_norm_le_one ha hs v |
| 190 | have h_half : ‖w‖ ≤ 2⁻¹ := h_inv.trans (inv_anti₀ two_pos (mod_cast v.one_lt_q)) |
| 191 | grw [norm_log_one_add_sub_self_le (h_half.trans_lt (by norm_num)), |
| 192 | ← sub_le_sub_left h_half, h_inv, hq.minFac_eq] |
| 193 | ring_nf |
| 194 | linarith [sq_nonneg (v.q : ℝ)⁻¹] |
| 195 | · -- Nothing is subtracted, `‖log (1 + w)‖ ≤ 2 / q` and `minFac q ^ 2 ≤ q`. |
| 196 | have h_sq : ((v.q.minFac : ℝ) ^ 2) ≤ v.q := |
| 197 | mod_cast Nat.minFac_sq_le_self (zero_lt_one.trans v.one_lt_q) hq |
| 198 | rw [sub_zero] |
| 199 | calc |
| 200 | ‖log (1 + w)‖ ≤ 2 / v.q := by |
| 201 | simpa only [Real.rpow_neg_one, div_eq_mul_inv] using |
| 202 | norm_log_one_add_neg_mul_cpow_le_of_norm_le_one ha (le_refl 1) hs v |
| 203 | _ ≤ 2 / v.q.minFac ^ 2 := div_le_div_of_nonneg_left zero_le_two |
| 204 | (pow_pos (mod_cast v.q.minFac_pos) 2) h_sq |
| 205 | |
| 206 | /-- For `‖a v‖ ≤ 1` and real `s ≥ 1`, the Euler factor `1 - a v * q ^ (-s)` lies in the slit plane, |
| 207 | where the logarithm is continuous. -/ |
| 208 | lemma one_add_neg_mul_cpow_mem_slitPlane_of_norm_le_one (ha : ∀ v : FinPlace K, ‖a v‖ ≤ 1) |
| 209 | (hs : 1 ≤ s) (v : FinPlace K) : 1 + -(a v * v.q ^ (-s : ℂ)) ∈ slitPlane := |
| 210 | mem_slitPlane_of_norm_lt_one ((norm_neg_mul_cpow_le_inv_of_norm_le_one ha hs v).trans_lt |
| 211 | (inv_lt_one_of_one_lt₀ (mod_cast v.one_lt_q))) |
| 212 | |
| 213 | /-- If `‖a v‖ ≤ 1` and `s > 1`, the series `∑ v, log (1 - a v * q ^ (-s))` converges, its sum is |
| 214 | continuous at `s`, and `New.eulerProd a s` is the exponential of minus this sum. -/ |
| 215 | @[local simp] |
| 216 | lemma eulerProd_eq_exp (ha : ∀ v : FinPlace K, ‖a v‖ ≤ 1) (hs : 1 < s) : |
| 217 | let logFactor (s : ℝ) (v : FinPlace K) : ℂ := Complex.log (1 + -(a v * v.q ^ (-s : ℂ))) |
| 218 | eulerProd a s = exp (-∑' v : FinPlace K, logFactor s v) ∧ |
| 219 | Summable (logFactor s) ∧ |
| 220 | ContinuousAt (fun t : ℝ ↦ -∑' v : FinPlace K, logFactor t v) s := by |
| 221 | -- Fix `σ` between `1` and `s`. For `t ≥ σ` the logarithms are dominated by the convergent series |
| 222 | -- `∑ 2 * q ^ (-σ)`, which gives summability and, by dominated convergence, continuity. |
| 223 | intro logFactor |
| 224 | obtain ⟨σ, hσ, hσs⟩ : ∃ σ : ℝ, 1 < σ ∧ σ < s := exists_between hs |
| 225 | have h_sum : Summable fun v : FinPlace K ↦ 2 * (v.q : ℝ) ^ (-σ) := |
| 226 | ((summable_absNorm_rpow hσ).comp_injective asIdeal_injective).mul_left _ |
| 227 | have h_bound (t : ℝ) (ht : σ ≤ t) (v : FinPlace K) : ‖logFactor t v‖ ≤ 2 * (v.q : ℝ) ^ (-σ) := |
| 228 | norm_log_one_add_neg_mul_cpow_le_of_norm_le_one ha hσ.le ht v |
| 229 | have h_term (v : FinPlace K) : ContinuousAt (fun t : ℝ ↦ logFactor t v) s := |
| 230 | ContinuousAt.clog (by fun_prop (disch := simp [IsDedekindDomain.HeightOneSpectrum.ne_bot])) |
| 231 | (one_add_neg_mul_cpow_mem_slitPlane_of_norm_le_one ha hs.le v) |
| 232 | have h_cont : ContinuousAt (fun t : ℝ ↦ -∑' v : FinPlace K, logFactor t v) s := |
| 233 | (tendsto_tsum_of_dominated_convergence h_sum h_term (.mono (Ici_mem_nhds hσs) h_bound)).neg |
| 234 | -- The extension by continuity keeps the value at a point of continuity. |
| 235 | exact ⟨extendFrom_eq (subset_closure hs) h_cont.cexp.continuousWithinAt.tendsto, |
| 236 | h_sum.of_norm_bounded (h_bound s hσs.le), h_cont⟩ |
| 237 | |
| 238 | /-- For `‖a v‖ ≤ 1` and real `s > 1`, `New.eulerProd a s` is the exponential of minus the sum of |
| 239 | the logarithms of the Euler factors `1 - a v * q ^ (-s)`. -/ |
| 240 | lemma eulerProd_eq_exp_neg_tsum_log_of_norm_le_one (ha : ∀ v : FinPlace K, ‖a v‖ ≤ 1) (hs : 1 < s) : |
| 241 | eulerProd a s = exp (-∑' v : FinPlace K, Complex.log (1 + -(a v * v.q ^ (-s : ℂ)))) := by |
| 242 | obtain ⟨h_eq, -, -⟩ := eulerProd_eq_exp ha hs |
| 243 | exact h_eq |
| 244 | |
| 245 | /-- For `‖a v‖ ≤ 1` and real `s > 1`, the logarithms of the Euler factors `1 - a v * q ^ (-s)` are |
| 246 | summable over the primes `v`. -/ |
| 247 | lemma summable_log_one_add_neg_mul_cpow_of_norm_le_one (ha : ∀ v : FinPlace K, ‖a v‖ ≤ 1) |
| 248 | (hs : 1 < s) : Summable fun v : FinPlace K ↦ Complex.log (1 + -(a v * v.q ^ (-s : ℂ))) := by |
| 249 | obtain ⟨-, h_sum, -⟩ := eulerProd_eq_exp ha hs |
| 250 | exact h_sum |
| 251 | |
| 252 | /-- If `‖a v‖ ≤ 1` for all primes `v` of `K` and `s > 1` is real, the Euler product |
| 253 | `∏ v, (1 - a v * q ^ (-s))⁻¹` converges unconditionally to `New.eulerProd a s`. -/ |
| 254 | lemma hasProd_eulerProd (ha : ∀ v : FinPlace K, ‖a v‖ ≤ 1) (hs : 1 < s) : |
| 255 | HasProd (fun v : FinPlace K ↦ (1 - a v * v.q ^ (-s : ℂ))⁻¹) (eulerProd a s) := by |
| 256 | have h_sum := (summable_log_one_add_neg_mul_cpow_of_norm_le_one ha hs).hasSum |
| 257 | rw [eulerProd_eq_exp_neg_tsum_log_of_norm_le_one ha hs, exp_neg] |
| 258 | -- The factor `1 - x` is written `1 + -x`, the form whose logarithms are summed. |
| 259 | simp only [sub_eq_add_neg] |
| 260 | exact (hasProd_of_hasSum_log (fun v ↦ slitPlane_ne_zero |
| 261 | (one_add_neg_mul_cpow_mem_slitPlane_of_norm_le_one ha hs.le v)) h_sum).inv₀ (exp_ne_zero _) |
| 262 | |
| 263 | /-- For `‖a v‖ ≤ 1`, a finite set `Q` of primes and `P s = ∏ w ∈ Q, (1 - a w * q_w ^ (-s))`: `P` is |
| 264 | analytic at the real point `1`, `P 1 ≠ 0`, and for real `s > 1` setting the coefficients at `Q` to |
| 265 | zero multiplies the Euler product by `P s`. -/ |
| 266 | lemma eulerProd_erase (ha : ∀ v : FinPlace K, ‖a v‖ ≤ 1) (Q : Finset (FinPlace K)) : |
| 267 | let P (s : ℂ) : ℂ := ∏ w ∈ Q, (1 - a w * w.q ^ (-s)) |
| 268 | AnalyticAt ℝ (P ∘ ofReal) 1 ∧ |
| 269 | P 1 ≠ 0 ∧ |
| 270 | ∀ s > (1 : ℝ), eulerProd (indicator Qᶜ a) s = eulerProd a s * P s := by |
| 271 | intro P |
| 272 | have h_factor_ne {t : ℝ} (ht : 1 ≤ t) (w : FinPlace K) : 1 - a w * w.q ^ (-t : ℂ) ≠ 0 := by |
| 273 | simpa [sub_eq_add_neg] using |
| 274 | slitPlane_ne_zero (one_add_neg_mul_cpow_mem_slitPlane_of_norm_le_one ha ht w) |
| 275 | have hP_analytic : AnalyticAt ℂ P 1 := by |
| 276 | fun_prop (disch := simp [IsDedekindDomain.HeightOneSpectrum.ne_bot]) |
| 277 | have hP_one : P 1 ≠ 0 := prod_ne_zero_iff.mpr fun w _ ↦ by simpa using h_factor_ne le_rfl w |
| 278 | refine ⟨(hP_analytic.restrictScalars (𝕜' := ℂ)).comp_of_eq (ofRealCLM.analyticAt 1) (by simp), |
| 279 | hP_one, fun s hs ↦ ?_⟩ |
| 280 | -- The two convergent products have the same factors outside `Q`, so their values differ by |
| 281 | -- the quotient of the finite products over `Q`. |
| 282 | let g (v : FinPlace K) : ℂ := (1 - Set.indicator Qᶜ a v * v.q ^ (-s : ℂ))⁻¹ |
| 283 | have h_erased : HasProd g (eulerProd (Set.indicator Qᶜ a) s) := |
| 284 | hasProd_eulerProd (fun v ↦ (norm_indicator_le_norm_self a v).trans (ha v)) hs |
| 285 | have h_congr : HasProd g (eulerProd a s * |
| 286 | ((∏ w ∈ Q, g w) / ∏ w ∈ Q, (1 - a w * w.q ^ (-s : ℂ))⁻¹)) := |
| 287 | (hasProd_eulerProd ha hs).congr_cofinite₀ (fun w _ ↦ inv_ne_zero (h_factor_ne hs.le w)) |
| 288 | fun w hw ↦ by simp [g, hw] |
| 289 | -- At `Q` the new factors are `1` and the old ones have product `(P s)⁻¹`. |
| 290 | have h_g_one : ∀ w ∈ Q, g w = 1 := fun w hw ↦ by simp [g, hw] |
| 291 | rw [h_erased.unique h_congr, prod_eq_one h_g_one, prod_inv_distrib, one_div, inv_inv] |
| 292 | |
| 293 | /-- If `‖a v‖ ≤ 1` for all `v` and `(s - 1) ^ l * eulerProd a s` tends to some `c ≠ 0` as real |
| 294 | `s ↓ 1`, with `l` a complex number, then `a` has density `l` over the primes of degree one. This |
| 295 | means `HasPrimeDensity a l`: the sum of `a v * q_v ^ (-s)` over the primes `v` of prime norm `q_v` |
| 296 | equals `l * log (1 / (s - 1))` plus a term bounded as `s ↓ 1`. (A pole of order `m` is the case |
| 297 | `l = m`, a zero of order `m` the case `l = -m`.) -/ |
| 298 | lemma hasPrimeDensity_of_tendsto (ha : ∀ v : FinPlace K, ‖a v‖ ≤ 1) {l : ℂ} {c : ℂ} (hc : c ≠ 0) |
| 299 | (h_lim : Tendsto (fun s : ℝ ↦ (s - 1) ^ l * eulerProd a s) (𝓝[>] 1) (𝓝 c)) : |
| 300 | HasPrimeDensity a l := by |
| 301 | -- `logProd` is a continuous logarithm of `(s - 1) ^ l * eulerProd a s` for `s > 1`. As |
| 302 | -- `exp logProd` tends to `c ≠ 0`, `logProd` stays bounded near `1`; and the logarithm of the |
| 303 | -- Euler product differs from the sum over the primes of degree one by a bounded error. |
| 304 | let L (s : ℝ) (v : FinPlace K) : ℂ := log (1 + -(a v * v.q ^ (-s : ℂ))) |
| 305 | let logProd (s : ℝ) : ℂ := (s - 1).log * l + -∑' v, L s v |
| 306 | have h_exp_logProd (s : ℝ) (hs_gt : 1 < s) : (s - 1) ^ l * eulerProd a s = exp (logProd s) := by |
| 307 | have h_ne : (s : ℂ) - 1 ≠ 0 := sub_ne_zero.mpr (mod_cast hs_gt.ne') |
| 308 | rw [eulerProd_eq_exp_neg_tsum_log_of_norm_le_one ha hs_gt, cpow_def_of_ne_zero h_ne, ← exp_add] |
| 309 | simp [logProd, L, ofReal_log (sub_nonneg.mpr hs_gt.le)] |
| 310 | have h_exp : Tendsto (fun s : ℝ ↦ exp (logProd s) / c) (𝓝[>] 1) (𝓝 (c / c)) := |
| 311 | (tendsto_nhdsWithin_congr h_exp_logProd h_lim).div_const c |
| 312 | have h_one : c / c ∈ slitPlane := by simp [div_self hc] |
| 313 | obtain ⟨s₁, hs₁, h_slit⟩ : |
| 314 | ∃ s₁ ∈ Set.Ioi (1 : ℝ), ∀ s ∈ Set.Ioc 1 s₁, exp (logProd s) / c ∈ slitPlane := |
| 315 | mem_nhdsGT_iff_exists_Ioc_subset.mp (h_exp (isOpen_slitPlane.mem_nhds h_one)) |
| 316 | have hlog_cont : ContinuousOn logProd (Ioc 1 s₁) := by |
| 317 | refine .add (by fun_prop (disch := grind)) fun s ⟨hs_gt, _⟩ ↦ ?_ |
| 318 | obtain ⟨-, -, h_cont⟩ := eulerProd_eq_exp ha hs_gt |
| 319 | exact h_cont.continuousWithinAt |
| 320 | -- On `(1, s₁]` the function `logProd - log (exp logProd / c)` is a continuous logarithm of the |
| 321 | -- constant `c`, so it is constant. |
| 322 | have h_exp_eq (t : ℝ) (ht : t ∈ Ioc 1 s₁) : exp (logProd t - log (exp (logProd t) / c)) = c := by |
| 323 | rw [exp_sub, exp_log (slitPlane_ne_zero (h_slit t ht)), div_div_cancel₀ (exp_ne_zero _)] |
| 324 | have hlog_const (s : ℝ) (hs : s ∈ Set.Ioc 1 s₁) : |
| 325 | logProd s - log (exp (logProd s) / c) = logProd s₁ - log (exp (logProd s₁) / c) := |
| 326 | isCoveringMap_exp.constOn_of_comp isPreconnected_Ioc |
| 327 | (hlog_cont.fun_sub ((hlog_cont.cexp.div_const c).clog h_slit)) |
| 328 | (fun t ht t' ht' ↦ Subtype.ext ((h_exp_eq t ht).trans (h_exp_eq t' ht').symm)) hs |
| 329 | ⟨hs₁, le_rfl⟩ |
| 330 | let C : ℂ := logProd s₁ - log (exp (logProd s₁) / c) |
| 331 | have hlog_bdd : (fun s ↦ C + log (exp (logProd s) / c)) =O[𝓝[>] 1] (1 : ℝ → ℝ) := |
| 332 | ((h_exp.clog h_one).const_add C).isBigO_one ℝ |
| 333 | -- The error terms `E s v` are bounded, uniformly in `s > 1`, by a convergent series. |
| 334 | let E (s : ℝ) (v : FinPlace K) : ℂ := L s v - ite v.q.Prime (-(a v * v.q ^ (-s : ℂ))) 0 |
| 335 | have hE_le (s : ℝ) (hs : 1 < s) (v : FinPlace K) : ‖E s v‖ ≤ 2 * (v.q.minFac ^ 2 : ℝ)⁻¹ := |
| 336 | (norm_log_one_add_neg_mul_cpow_sub_ite_le_of_norm_le_one ha hs.le v).trans_eq |
| 337 | (div_eq_mul_inv _ _) |
| 338 | have h_sum : Summable fun v : FinPlace K ↦ 2 * (v.q.minFac ^ 2 : ℝ)⁻¹ := |
| 339 | (summable_of_sum_le (fun v ↦ by positivity) sum_inv_minFac_sq_le_finrank).mul_left 2 |
| 340 | have hE_bdd : (fun s ↦ ∑' v, E s v) =O[𝓝[>] 1] (1 : ℝ → ℝ) := |
| 341 | (isBoundedUnder_of_eventually_le <| eventually_mem_nhdsWithin.mono fun s hs ↦ |
| 342 | tsum_of_norm_bounded h_sum.hasSum (hE_le s hs)).isBigO_one ℝ |
| 343 | -- The bounded error term: the sum of the `E s v` plus `logProd s`, written as the constant |
| 344 | -- logarithm `C` of `c` plus `log (exp (logProd s) / c)`. |
| 345 | let err (s : ℝ) : ℂ := ∑' v, E s v + (C + log (exp (logProd s) / c)) |
| 346 | refine ⟨err, hE_bdd.add hlog_bdd, .mono (Ioc_mem_nhdsGT hs₁) fun s ⟨hs_gt, hs_le⟩ ↦ ?_⟩ |
| 347 | -- The terms are `E s v - L s v`, and `-∑' v, L s v = logProd s - log (s - 1) * l`. |
| 348 | have h_terms : (fun v : FinPlace K ↦ ite v.q.Prime (a v) 0 * v.q ^ (-s : ℂ)) = |
| 349 | fun v ↦ E s v - L s v := by grind |
| 350 | have h_value : err s - l * Real.log (s - 1) = ∑' v, E s v - ∑' v, L s v := by |
| 351 | linear_combination -hlog_const s ⟨hs_gt, hs_le⟩ |
| 352 | rw [h_terms, h_value] |
| 353 | exact (h_sum.of_norm_bounded (hE_le s hs_gt)).hasSum.sub |
| 354 | (summable_log_one_add_neg_mul_cpow_of_norm_le_one ha hs_gt).hasSum |
| 355 | |
| 356 | open Real |
| 357 | |
| 358 | /-- If `‖a v‖ ≤ 1` for all `v` and `s ≥ σ ≥ 2` are real, the Euler product with coefficients `a` is |
| 359 | nonzero at `s`, and the logarithm of its modulus has absolute value at most |
| 360 | `2 * [K : ℚ] * 2 ^ (2 - σ)`. -/ |
| 361 | lemma eulerProd_ne_zero_and_abs_log_norm_le (ha : ∀ v : FinPlace K, ‖a v‖ ≤ 1) {σ : ℝ} (hσ : 2 ≤ σ) |
| 362 | (hs : σ ≤ s) : |
| 363 | eulerProd a s ≠ 0 ∧ |Real.log ‖eulerProd a s‖| ≤ 2 * finrank ℚ K * 2 ^ (2 - σ) := by |
| 364 | have hs_one : 1 < s := by linarith |
| 365 | have h_summable := summable_log_one_add_neg_mul_cpow_of_norm_le_one ha hs_one |
| 366 | -- Each logarithm is at most `2 * q ^ (-σ) ≤ 2 * 2 ^ (2 - σ) / p ^ 2`, as `q ≥ 2` and `p ≤ q` for |
| 367 | -- the least prime factor `p` of `q`. |
| 368 | have h_term (v : FinPlace K) : |
| 369 | ‖log (1 + -(a v * v.q ^ (-s : ℂ)))‖ ≤ 2 * 2 ^ (2 - σ) * (v.q.minFac ^ 2 : ℝ)⁻¹ := by |
| 370 | have hq : (2 : ℝ) ≤ v.q := mod_cast v.one_lt_q |
| 371 | have hp : 0 < v.q.minFac := v.q.minFac_pos |
| 372 | calc _ ≤ 2 * (v.q : ℝ) ^ (-σ) := |
| 373 | norm_log_one_add_neg_mul_cpow_le_of_norm_le_one ha (by linarith) hs v |
| 374 | _ = 2 * v.q ^ (2 - σ) * (v.q ^ 2 : ℝ)⁻¹ := by simp [rpow_sub, v.q_bounds, field, rpow_neg] |
| 375 | _ ≤ _ := by |
| 376 | grw [rpow_le_rpow_of_nonpos two_pos hq (sub_nonpos.mpr hσ), Nat.minFac_le v.one_lt_q.le] |
| 377 | -- Sum over the primes, using `∑ p⁻² ≤ [K : ℚ]`. |
| 378 | have h_sum : ‖∑' v, log (1 + -(a v * v.q ^ (-s : ℂ)))‖ ≤ 2 * finrank ℚ K * 2 ^ (2 - σ) := by |
| 379 | refine le_of_tendsto' h_summable.hasSum.norm fun u ↦ ?_ |
| 380 | grw [norm_sum_le, h_term, ← Finset.mul_sum, sum_inv_minFac_sq_le_finrank u, mul_right_comm] |
| 381 | -- The product is `exp (-z)` for the sum `z` of the logarithms: it is nonzero, and |
| 382 | -- `|log ‖exp (-z)‖| = |re z| ≤ ‖z‖`. |
| 383 | rw [eulerProd_eq_exp_neg_tsum_log_of_norm_le_one ha hs_one] |
| 384 | refine ⟨exp_ne_zero _, ?_⟩ |
| 385 | set z : ℂ := ∑' v : FinPlace K, Complex.log (1 + -(a v * v.q ^ (-s : ℂ))) |
| 386 | calc |Real.log ‖exp (-z)‖| = |z.re| := by rw [norm_exp, Real.log_exp, neg_re, abs_neg] |
| 387 | _ ≤ ‖z‖ := abs_re_le_norm z |
| 388 | _ ≤ 2 * finrank ℚ K * 2 ^ (2 - σ) := h_sum |
| 389 | |
| 390 | open scoped Classical in |
| 391 | /-- For a number field `K`, a summable function `t` on the ideals of `𝓞 K` with |
| 392 | `t (v * I) = t v * t I` for every nonzero prime `v` and ideal `I`, and a finite set `T` of nonzero |
| 393 | primes of `𝓞 K`, summing `t I` over the ideals not divisible by any prime in `T` gives |
| 394 | `(∑' I, t I) * ∏ v ∈ T, (1 - t v)`. -/ |
| 395 | private lemma hasSum_sieved_ideal {t : Ideal (𝓞 K) → ℂ} (h_summable : Summable t) |
| 396 | (h_t_mul : ∀ (v : FinPlace K) (I : Ideal (𝓞 K)), t (v.asIdeal * I) = t v.asIdeal * t I) |
| 397 | (T : Finset (FinPlace K)) : |
| 398 | HasSum (fun I : Ideal (𝓞 K) ↦ if ∀ v ∈ T, ¬v.asIdeal ∣ I then t I else 0) |
| 399 | ((∑' I, t I) * ∏ v ∈ T, (1 - t v.asIdeal)) := by |
| 400 | let sieved (T : Finset (FinPlace K)) (I : Ideal (𝓞 K)) : ℂ := |
| 401 | if ∀ v ∈ T, ¬v.asIdeal ∣ I then t I else 0 |
| 402 | change HasSum (sieved T) ((∑' I, t I) * ∏ v ∈ T, (1 - t v.asIdeal)) |
| 403 | induction T using Finset.cons_induction with |
| 404 | | empty => simpa [sieved] using h_summable.hasSum |
| 405 | | cons v T hv ih => |
| 406 | -- The terms removed at `v` are those of the ideals `v * I`: they are `t v` times the old |
| 407 | -- terms at `I`. |
| 408 | let removed (I : Ideal (𝓞 K)) : ℂ := sieved T I - sieved (cons v T hv) I |
| 409 | have h_mul (I : Ideal (𝓞 K)) : removed (v.asIdeal * I) = t v.asIdeal * sieved T I := by |
| 410 | -- `t` is multiplicative; `v ∣ v * I`, and a prime `w ∈ T` (so `w ≠ v`) divides `v * I` |
| 411 | -- if and only if it divides `I`. |
| 412 | have h_cons_zero : sieved (cons v T hv) (v.asIdeal * I) = 0 := |
| 413 | ite_eq_right fun h ↦ h v (mem_cons_self v T) (dvd_mul_right v.asIdeal I) |
| 414 | have h_iff : (∀ w ∈ T, ¬w.asIdeal ∣ v.asIdeal * I) ↔ ∀ w ∈ T, ¬w.asIdeal ∣ I := by |
| 415 | refine forall₂_congr fun w hw ↦ ?_ |
| 416 | simp [(prime w).dvd_mul, prime_dvd_prime_iff_eq (prime w) (prime v), |
| 417 | asIdeal_injective.ne (ne_of_mem_of_not_mem hw hv)] |
| 418 | simp only [removed, h_cons_zero, sub_zero] |
| 419 | simp only [sieved, h_iff, h_t_mul v I, mul_ite, mul_zero] |
| 420 | have h_off : ∀ I ∉ Set.range fun J : Ideal (𝓞 K) ↦ v.asIdeal * J, removed I = 0 := by |
| 421 | grind [dvd_def] |
| 422 | have h_removed : |
| 423 | HasSum removed (t v.asIdeal * ((∑' I, t I) * ∏ w ∈ T, (1 - t w.asIdeal))) := |
| 424 | ((mul_right_injective₀ v.ne_bot).hasSum_iff h_off).mp |
| 425 | ((ih.mul_left (t v.asIdeal)).congr_fun h_mul) |
| 426 | rw [prod_cons, mul_left_comm, one_sub_mul] |
| 427 | exact (ih.sub h_removed).congr_fun fun I ↦ (sub_sub_self _ _).symm |
| 428 | |
| 429 | /-- Euler product: for `χ` multiplicative on the ideals of `𝓞 K` with `‖χ I‖ ≤ 1` and real `s > 1`, |
| 430 | the series `∑ I, χ I * N(I) ^ (-s)` converges to the Euler product with coefficients `χ v`. -/ |
| 431 | lemma hasSum_eulerProd (χ : Ideal (𝓞 K) →* ℂ) (hχ : ∀ I : Ideal (𝓞 K), ‖χ I‖ ≤ 1) (hs : 1 < s) : |
| 432 | HasSum (fun I : Ideal (𝓞 K) ↦ χ I * I.absNorm ^ (-s : ℂ)) |
| 433 | (eulerProd (fun v : FinPlace K ↦ χ v.asIdeal) s) := by |
| 434 | classical |
| 435 | -- Sieve: multiplying the series by the factors `1 - χ v * N v ^ (-s)`, `v ∈ T`, removes the |
| 436 | -- ideals divisible by a prime of `T`. As `T` grows only the term `1` of the unit ideal survives, |
| 437 | -- so the sum of the series times the inverse of the Euler product is `1`. |
| 438 | let t (I : Ideal (𝓞 K)) : ℂ := χ I * I.absNorm ^ (-s : ℂ) |
| 439 | let sieved (T : Finset (FinPlace K)) (I : Ideal (𝓞 K)) : ℂ := |
| 440 | if ∀ v ∈ T, ¬v.asIdeal ∣ I then t I else 0 |
| 441 | have h_norm_le (I : Ideal (𝓞 K)) : ‖t I‖ ≤ (absNorm I : ℝ) ^ (-s) := by |
| 442 | grw [norm_mul_le, hχ, norm_cpow_le] |
| 443 | simp |
| 444 | have h_summable : Summable t := (summable_absNorm_rpow hs).of_norm_bounded h_norm_le |
| 445 | have h_t_mul (v : FinPlace K) (I : Ideal (𝓞 K)) : t (v.asIdeal * I) = t v.asIdeal * t I := by |
| 446 | simp only [t, map_mul, Nat.cast_mul, natCast_mul_cpow] |
| 447 | ring |
| 448 | have h_sieve (T : Finset (FinPlace K)) : |
| 449 | HasSum (sieved T) ((∑' I, t I) * ∏ v ∈ T, (1 - t v.asIdeal)) := |
| 450 | hasSum_sieved_ideal h_summable h_t_mul T |
| 451 | -- Termwise limit: a proper ideal lies in some prime, and is removed once `T` contains it. |
| 452 | have h_term (I : Ideal (𝓞 K)) : |
| 453 | Tendsto (fun T ↦ sieved T I) atTop (𝓝 (if I = ⊤ then 1 else 0)) := by |
| 454 | split_ifs with hI |
| 455 | · simp [sieved, t, hI, ← one_eq_top, (prime _).not_dvd_one] |
| 456 | · obtain ⟨v, hI_le⟩ : ∃ v : FinPlace K, I ≤ v.asIdeal := |
| 457 | (ideal_ne_top_iff_exists (RingOfIntegers.not_isField K) I).mp hI |
| 458 | have h_zero : ∀ T ≥ ({v} : Finset (FinPlace K)), sieved T I = 0 := by grind [dvd_iff_le] |
| 459 | exact tendsto_atTop_of_eventually_const h_zero |
| 460 | -- Dominated convergence: each sieved term is `t I` or `0`. |
| 461 | have h_bound (T : Finset (FinPlace K)) (I : Ideal (𝓞 K)) : ‖sieved T I‖ ≤ ‖t I‖ := by |
| 462 | grind [norm_zero] |
| 463 | have h_lim_one : Tendsto (fun T : Finset (FinPlace K) ↦ (∑' I, t I) * ∏ v ∈ T, (1 - t v.asIdeal)) |
| 464 | atTop (𝓝 1) := by |
| 465 | have h_dom := tendsto_tsum_of_dominated_convergence h_summable.norm h_term (.of_forall h_bound) |
| 466 | rw [tsum_ite_eq] at h_dom |
| 467 | exact h_dom.congr fun T ↦ (h_sieve T).tsum_eq |
| 468 | -- The partial products of the factors `1 - t v` tend to the inverse of the Euler product. |
| 469 | have h_lim_prod : HasProd (fun v : FinPlace K ↦ 1 - t v.asIdeal) |
| 470 | (eulerProd (fun v : FinPlace K ↦ χ v.asIdeal) s)⁻¹ := by |
| 471 | have h_ne : eulerProd (fun v : FinPlace K ↦ χ v.asIdeal) s ≠ 0 := by |
| 472 | simp [eulerProd_eq_exp_neg_tsum_log_of_norm_le_one (fun v ↦ hχ v.asIdeal) hs] |
| 473 | simpa only [inv_inv] using (hasProd_eulerProd (fun v ↦ hχ v.asIdeal) hs).inv₀ h_ne |
| 474 | exact h_summable.hasSum_iff.mpr |
| 475 | (eq_of_mul_inv_eq_one (tendsto_nhds_unique (h_lim_prod.const_mul _) h_lim_one)) |
| 476 | |
| 477 | /-- Densities are linear: if each `a i` has density `l i` over the primes of degree one, then |
| 478 | `∑ i, w i * a i` has density `∑ i, w i * l i`. -/ |
| 479 | lemma HasPrimeDensity.sum {ι : Type*} [Fintype ι] {a : ι → FinPlace K → ℂ} (w : ι → ℂ) {l : ι → ℂ} |
| 480 | (h : ∀ i : ι, HasPrimeDensity (a i) (l i)) : |
| 481 | HasPrimeDensity (fun v : FinPlace K ↦ ∑ i : ι, w i * a i v) (∑ i : ι, w i * l i) := by |
| 482 | -- Take the same combination of the bounded error terms. |
| 483 | choose x h_bdd h_sum using h |
| 484 | refine ⟨∑ i, fun s ↦ w i * x i s, .sum fun i _ ↦ (h_bdd i).const_mul_left (w i), ?_⟩ |
| 485 | filter_upwards [eventually_all.mpr h_sum] with s hs |
| 486 | convert hasSum_sum (s := Finset.univ) fun i _ ↦ (hs i).mul_left (w i) using 1 |
| 487 | · ext v |
| 488 | by_cases hq : v.q.Prime <;> simp [hq, Finset.sum_mul, mul_assoc] |
| 489 | · simp [Finset.sum_apply, mul_sub, Finset.sum_sub_distrib, Finset.sum_mul, mul_assoc] |
| 490 | |
| 491 | /-- Suppose `a` has density `l` and `b` has density `l'` in the Dirichlet sense of |
| 492 | `HasPrimeDensity`: over the primes `v` of degree one (prime norm `q_v`), |
| 493 | `∑ a v * q_v ^ (-s) = l * log (1 / (s - 1)) + O(1)` as `s ↓ 1`, and likewise for `b` and `l'`. |
| 494 | Suppose also that `Re (a v) ≤ Re (b v)` for all but finitely many primes `v` of degree one. Then |
| 495 | `Re l ≤ Re l'`. -/ |
| 496 | lemma HasPrimeDensity.re_le_re (ha : HasPrimeDensity a l) (hb : HasPrimeDensity b l') |
| 497 | (h_le : ∀ᶠ v : FinPlace K in cofinite, v.q.Prime → (a v).re ≤ (b v).re) : |
| 498 | l.re ≤ l'.re := by |
| 499 | -- Subtract the two series. Outside a finite set `S` the terms `d s v` have real part `≥ 0`, so |
| 500 | -- `∑ v ∈ S, re (d s v) + re (l' - l) log (s - 1) ≤ ‖y s - x s‖`, which is bounded as `s ↓ 1`. |
| 501 | -- If `re l' < re l` the left side tends to `+∞`. |
| 502 | obtain ⟨x, hx_bdd, hx_sum⟩ := ha |
| 503 | obtain ⟨y, hy_bdd, hy_sum⟩ := hb |
| 504 | by_contra! h_lt |
| 505 | let S := (eventually_cofinite.mp h_le).toFinset |
| 506 | let d (s : ℝ) (v : FinPlace K) : ℂ := |
| 507 | ite v.q.Prime (b v) 0 * v.q ^ (-s : ℂ) - ite v.q.Prime (a v) 0 * v.q ^ (-s : ℂ) |
| 508 | have h_nonneg s v (hv : v ∉ S) : 0 ≤ (d s v).re := by |
| 509 | have h_real : (v.q : ℂ) ^ (-s : ℂ) = ((v.q : ℝ) ^ (-s) : ℝ) := by simp [ofReal_cpow] |
| 510 | simp only [d, h_real, ← sub_mul, re_mul_ofReal, sub_re] |
| 511 | refine mul_nonneg ?_ (by positivity) |
| 512 | by_cases hq : v.q.Prime <;> simp_all [S] |
| 513 | have h_bound : ∀ᶠ s : ℝ in 𝓝[>] 1, |
| 514 | ∑ v ∈ S, (d s v).re + (l'.re - l.re) * (s - 1).log ≤ ‖y s - x s‖ := by |
| 515 | filter_upwards [hx_sum, hy_sum] with s has hbs |
| 516 | refine le_trans ?_ (re_le_norm _) |
| 517 | grw [sum_le_hasSum S (h_nonneg s) (hasSum_re (hbs.sub has))] |
| 518 | grind [sub_re, re_mul_ofReal] |
| 519 | -- As `re l' < re l`, the left side of `h_bound` tends to `+∞`, but the right side is bounded. |
| 520 | have h_cont : ContinuousAt (fun s ↦ ∑ v ∈ S, (d s v).re) 1 := by fun_prop (disch := simp) |
| 521 | have h_log : Tendsto (fun s : ℝ ↦ (s - 1).log) (𝓝[>] 1) atBot := |
| 522 | tendsto_log_nhdsGT_zero.comp (by simp [Tendsto, map_subRight_nhdsGT]) |
| 523 | exact not_isBoundedUnder_of_tendsto_atTop |
| 524 | (h_cont.continuousWithinAt.tendsto.add_atTop (h_log.const_mul_atBot_of_neg (sub_neg.mpr h_lt))) |
| 525 | ((hy_bdd.sub hx_bdd).isBoundedUnder_le.mono_le h_bound) |
| 526 | |
| 527 | /-- For `c ∈ ℂ` the constant family `v ↦ c` has density `c` over the primes of degree one of `K`, in |
| 528 | the sense of `New.HasPrimeDensity`. -/ |
| 529 | lemma hasPrimeDensity_const (c : ℂ) : HasPrimeDensity (fun _ : FinPlace K ↦ c) c := by |
| 530 | -- The simple pole of `ζ_K` at `s = 1` gives the constant family `1` mean `1`; scale by `c`. |
| 531 | suffices HasPrimeDensity (fun _ : FinPlace K ↦ 1) 1 by |
| 532 | simpa using HasPrimeDensity.sum (ι := Unit) (fun _ ↦ c) fun _ ↦ this |
| 533 | refine hasPrimeDensity_of_tendsto (fun _ ↦ by simp) |
| 534 | (ofReal_ne_zero.mpr (dedekindZeta_residue_ne_zero K)) |
| 535 | (tendsto_nhdsWithin_congr (fun s hs ↦ ?_) (tendsto_sub_one_mul_dedekindZeta_nhdsGT K)) |
| 536 | -- For `s > 1` the Euler product with coefficients `1` is `ζ_K(s)`: group the ideals by norm. |
| 537 | rw [cpow_one] |
| 538 | refine congrArg _ (((hasSum_eulerProd (K := K) 1 (fun _ ↦ by simp) hs).tsum_fiberwise |
| 539 | absNorm).congr_fun fun n ↦ ?_).tsum_eq |
| 540 | rw [tsum_congr fun I : absNorm ⁻¹' {n} ↦ by rw [I.property, MonoidHom.one_apply, one_mul], |
| 541 | tsum_const, nsmul_eq_mul] |
| 542 | rcases eq_or_ne n 0 with rfl | hn <;> simp [*, zero_cpow, (zero_lt_one.trans hs).ne', |
| 543 | LSeries.term_of_ne_zero, cpow_neg, div_eq_mul_inv, Set.preimage, Set.coe_ofPred] |
| 544 | |
| 545 | /-- A number field `K` has infinitely many primes of degree one, that is, finite places `w` whose |
| 546 | absolute norm `w.q` is a prime number. -/ |
| 547 | lemma frequently_prime_q : ∃ᶠ w : FinPlace K in cofinite, w.q.Prime := by |
| 548 | -- Otherwise the hypothesis of `HasPrimeDensity.re_le_re` for the constants `1` and `0` holds |
| 549 | -- vacuously outside a finite set, and it gives `1 ≤ 0`. |
| 550 | by_contra h_few |
| 551 | have h_le := (hasPrimeDensity_const (K := K) 1).re_le_re (hasPrimeDensity_const 0) |
| 552 | ((not_frequently.mp h_few).mono fun _ h_not h_prime ↦ (h_not h_prime).elim) |
| 553 | norm_num at h_le |
| 554 | |
| 555 | /-- Let `L/K` be an extension of number fields and `c ∈ ℂ`. Consider the family that sends `v` to |
| 556 | `c` times the number of places `w` of `L` above `v` whose residue field has the same cardinality |
| 557 | `q_w = q_v`, that is, those of relative residue degree one. This family has density `c` over the |
| 558 | primes of degree one of `K`: the sum of its values times `q_v ^ (-s)` over the `v` of prime norm is |
| 559 | `c * log (1 / (s - 1))` plus a term bounded as `s ↓ 1`. -/ |
| 560 | lemma hasPrimeDensity_card_degree_one (L : Type*) [Field L] [NumberField L] [Algebra K L] (c : ℂ) : |
| 561 | HasPrimeDensity (fun v : FinPlace K ↦ c * {w : FinPlace L | w.below K = v ∧ w.q = v.q}.ncard) |
| 562 | c := by |
| 563 | -- The constant family `c` on the primes of `L` has mean `c`; group its series by the prime of |
| 564 | -- `K` below. |
| 565 | obtain ⟨x, hx, h_sum⟩ : HasPrimeDensity (fun _ : FinPlace L ↦ c) c := hasPrimeDensity_const c |
| 566 | refine ⟨x, hx, h_sum.mono fun s hs ↦ ?_⟩ |
| 567 | -- It remains to compare, for each `v`, the term of `v` with the sum over the primes above `v`. |
| 568 | have h_fiber (v : FinPlace K) : |
| 569 | ite v.q.Prime (c * {w : FinPlace L | w.below K = v ∧ w.q = v.q}.ncard) 0 * v.q ^ (-s : ℂ) = |
| 570 | ∑' w : (fun w : FinPlace L ↦ w.below K) ⁻¹' {v}, |
| 571 | ite (w : FinPlace L).q.Prime c 0 * (w : FinPlace L).q ^ (-s : ℂ) := by |
| 572 | set S : Set (FinPlace L) := {w : FinPlace L | w.below K = v ∧ w.q = v.q} |
| 573 | have hS : S ⊆ (fun w : FinPlace L ↦ w.below K) ⁻¹' {v} := fun _ ⟨h_below, _⟩ ↦ h_below |
| 574 | -- A prime `w` above `v` of prime norm lies in `S`, because `w.q` is a power of `v.q`. |
| 575 | have h_prime (w : FinPlace L) (hw : w.below K = v) (hq : w.q.Prime) : w ∈ S := by |
| 576 | subst hw |
| 577 | obtain ⟨h_q_eq, -⟩ := |
| 578 | hq.pow_eq_iff.mp ((Ideal.under (𝓞 K) w.asIdeal).absNorm_pow_inertiaDeg w.asIdeal) |
| 579 | exact ⟨rfl, h_q_eq.symm⟩ |
| 580 | -- On `S` every term is the same, since `w.q = v.q` there. |
| 581 | have h_term (w : S) : ite (w : FinPlace L).q.Prime c 0 * ((w : FinPlace L).q : ℂ) ^ (-s : ℂ) = |
| 582 | ite v.q.Prime c 0 * (v.q : ℂ) ^ (-s : ℂ) := by |
| 583 | obtain ⟨w, -, hw_q⟩ := w |
| 584 | rw [hw_q] |
| 585 | -- Only the `w ∈ S` contribute to the sum over the primes above `v`. |
| 586 | have h_support : Function.support (fun w : (fun w : FinPlace L ↦ w.below K) ⁻¹' {v} ↦ |
| 587 | ite (w : FinPlace L).q.Prime c 0 * ((w : FinPlace L).q : ℂ) ^ (-s : ℂ)) ⊆ |
| 588 | Set.range (Set.inclusion hS) := fun w hw ↦ |
| 589 | have hq : (w : FinPlace L).q.Prime := of_not_not fun hq ↦ by simp [hq] at hw |
| 590 | ⟨⟨w, h_prime w w.property hq⟩, rfl⟩ |
| 591 | calc ite v.q.Prime (c * S.ncard) 0 * (v.q : ℂ) ^ (-s : ℂ) |
| 592 | = S.ncard • (ite v.q.Prime c 0 * (v.q : ℂ) ^ (-s : ℂ)) := by |
| 593 | by_cases hq : v.q.Prime <;> simp [hq, mul_left_comm, mul_assoc] |
| 594 | _ = ∑' w : S, ite (w : FinPlace L).q.Prime c 0 * ((w : FinPlace L).q : ℂ) ^ (-s : ℂ) := by |
| 595 | rw [tsum_congr h_term, tsum_const, Nat.card_coe_set_eq] |
| 596 | _ = _ := (Set.inclusion_injective hS).tsum_eq h_support |
| 597 | exact (hs.tsum_fiberwise fun w : FinPlace L ↦ w.below K).congr_fun h_fiber |
| 598 | |
| 599 | end New |
| 600 | |
| 601 | end |