module import TauCeti.NumberTheory.ArithmeticDirichletSeries.Convergence import Mathlib.Algebra.Order.Star.Real import Mathlib.Analysis.Complex.CoveringMap import Mathlib.Analysis.Normed.Group.Tannery import Mathlib.Analysis.SpecialFunctions.Complex.Analytic import Mathlib.Analysis.SpecialFunctions.Log.Summable import Mathlib.Data.Finset.Functor import Mathlib.NumberTheory.NumberField.DedekindZeta import Mathlib.RingTheory.Ideal.Int import TauCeti.NumberTheory.RamificationInertia.Tower public import Lib.ClassField.Places.Ideles import Lib.Adelic.Adeles.StrongApproximation /-! # Euler products over primes of a number field and densities at primes of degree one This file treats Hecke characters of a number field `K`, given by their finite part `ψ`, a character of the finite ideles `(𝔸f K)Λ£`, and Euler products with coefficients `a v`, `β€–a vβ€– ≀ 1`, over the primes `v` of `K`, as functions of a real variable `s > 1`. * `New.IsHeckeOfType`: `ψ` has open kernel and `ψ x * ∏ w, (Ξ¦ w x / β€–Ξ¦ w xβ€–) ^ n w = 1` on `KΛ£`; `New.heckeCoeff ψ S` is the value of `ψ` at the local idele of the chosen uniformiser for `v βˆ‰ S`, and `0` for `v ∈ S`. * `New.eulerProd`: the product `∏ (1 - a v * q ^ (-s))⁻¹`, defined as `exp` of a sum of logarithms; `New.hasProd_eulerProd` says that it is the limit of the partial products. * `New.hasSum_eulerProd`: for a completely multiplicative function on ideals, of modulus at most `1`, the product equals the Dirichlet series. * `New.HasPrimeDensity`: the Dirichlet mean of `a` over the primes of degree one. Densities are linear and monotone (`New.HasPrimeDensity.sum`, `New.HasPrimeDensity.re_le_re`). * `New.hasPrimeDensity_of_tendsto`: the density is read off from the order of the pole or zero of the product at `1`. Up to a bounded error, the logarithm of the product is the sum of `a v * q ^ (-s)` over the primes of degree one (`New.norm_log_one_add_neg_mul_cpow_sub_ite_le_of_norm_le_one`, `New.sum_inv_minFac_sq_le_finrank`). Here `New.FinPlace K` is the type of nonzero primes of `π“ž K`, `q = v.q` is the absolute norm of `v`, and degree one means that `q` is prime. Notions from other files: * `New.locIdele v`: sends `x ∈ K_vΛ£` to the finite idele with component `x` at `v` and `1` elsewhere; `New.uniformizer v` is a chosen uniformiser of the completion `K_v`. * `Ξ¦ w` (class `New.PlaceEmbedding`): a chosen complex embedding of `K` inducing the infinite place `w`. ## Relation to the literature Known; see `Lib.ClassField.HeckeL.ContinuationAtOne` for sources. -/ @[expose] public section noncomputable section open NumberField IsDedekindDomain.HeightOneSpectrum Filter Topology Complex Finset Ideal Module ContinuousAt Set namespace New variable {K : Type*} [Field K] [NumberField K] (ψ : (𝔸f K)Λ£ β†’* β„‚Λ£) (n : InfinitePlace K β†’ β„€) (a b : FinPlace K β†’ β„‚) {s : ℝ} /-- The character `ψ` of the finite ideles is the finite part of a Hecke character of type `n`, where `n` gives an integer exponent `n w` to each infinite place `w`: the kernel of `ψ` is open, and `ψ x * ∏ w, (Ξ¦ w x / β€–Ξ¦ w xβ€–) ^ n w = 1` for `x ∈ KΛ£`, with `Ξ¦ w` the chosen complex embedding inducing `w` and `x` read as a finite idele by the diagonal embedding. -/ def IsHeckeOfType [PlaceEmbedding K] : Prop := ψ.ker.IsOpen ∧ βˆ€ x : KΛ£, ψ (principalIdele x) * ∏ w : InfinitePlace K, (Ξ¦ w x.val / β€–Ξ¦ w xβ€–) ^ n w = 1 /-- `ψ` is unramified at the finite place `v`: it is `1` on the units of the completion `K_v` of valuation `1`, read as finite ideles by `New.locIdele v`. -/ def CharUnramifiedAt (v : FinPlace K) : Prop := βˆ€ u : (LocField v)Λ£, Valued.v u.val = 1 β†’ ψ (locIdele v u) = 1 /-- The function on finite places sending `v βˆ‰ S` to the value of `ψ` at the local idele of the chosen uniformiser `uniformizer v` of `K_v`, and `v ∈ S` to `0`. -/ def heckeCoeff (S : Set (FinPlace K)) : FinPlace K β†’ β„‚ := indicator Sᢜ fun v : FinPlace K ↦ (ψ (locIdele v (uniformizer v))).val /-- The Euler product `∏ (1 - a v * q ^ (-s))⁻¹` over the primes `v` of `K`, with `q = v.q` the norm of `v`, as a function of real `s`. It is written `exp (-βˆ‘' v, log (1 + -(a v * q ^ (-s))))`, in the form `log (1 + w)` of Mathlib's bounds for the logarithm. The value at `s` is the limit of this expression at `s` within `(1, ∞)`: for `β€–a vβ€– ≀ 1` and `s > 1` it is the expression itself (`New.eulerProd_eq_exp`, `New.hasProd_eulerProd`), at `s = 1` it is the limit from the right if that exists, and for `s < 1` it has no meaning. With `a = heckeCoeff ψ S` and `ψ` unramified at every `v βˆ‰ S` it is the Euler product of the Hecke `L`-function of `ψ` without the factors at `S`. -/ def eulerProd : ℝ β†’ β„‚ := extendFrom (Set.Ioi 1) fun s : ℝ ↦ exp (-βˆ‘' v : FinPlace K, Complex.log (1 + -(a v * v.q ^ (-s : β„‚)))) /-- The Dirichlet mean of `a` over the primes of degree one (those of prime norm `q`) is `l`, with a bounded error: for `s > 1` near `1` the series `βˆ‘ a v * q ^ (-s)` over these primes converges, and its sum is `l * log (1 / (s - 1)) + x s` with `x` bounded as `s β†’ 1⁺`. -/ def HasPrimeDensity (l : β„‚) : Prop := βˆƒ x : ℝ β†’ β„‚, -- `βˆ‘ a v * q ^ (-s) = -l * log (s - 1) + O(1)` as `s β†’ 1⁺`, over the `v` whose norm `q` is -- prime x =O[𝓝[>] 1] (1 : ℝ β†’ ℝ) ∧ βˆ€αΆ  s : ℝ in 𝓝[>] 1, HasSum (fun v : FinPlace K ↦ ite v.q.Prime (a v) 0 * v.q ^ (-s : β„‚)) (x s - l * Real.log (s - 1)) /-- For a finite set `u` of primes of `K`, the sum over `v ∈ u` of `1 / p ^ 2`, with `p` the least prime factor of the norm `v.q`, is at most the degree `[K : β„š]`. -/ lemma sum_inv_minFac_sq_le_finrank (u : Finset (FinPlace K)) : βˆ‘ v ∈ u, (v.q.minFac ^ 2 : ℝ)⁻¹ ≀ finrank β„š K := by -- Group the primes by the least factor `p` of their norm. The primes of one group lie over the -- same rational prime, so there are at most `[K : β„š]` of them, and `βˆ‘ 1 / p ^ 2 ≀ 1`. have h_minFac (v : FinPlace K) : v.q.minFac = absNorm (v.asIdeal.under β„€) := by -- The norm of `v` is a positive power of the rational prime below `v`. simp [← (v.asIdeal.under β„€).absNorm_pow_inertiaDeg v.asIdeal, (Nat.absNorm_under_prime _).pow_minFac (inertiaDeg_pos ..).ne'] have h_group (v : FinPlace K) : #{w ∈ u | w.q.minFac = v.q.minFac} ≀ finrank β„š K := by grw [← RingOfIntegers.rank, ← TauCeti.RamificationInertia.ncard_primesOver_le_finrank (v.asIdeal.under β„€), ← Set.ncard_coe_finset] refine Set.ncard_le_ncard_of_injOn _ (fun w hw ↦ ⟨w.isPrime, ⟨ext ?_⟩⟩) asIdeal_injective.injOn (IsDedekindDomain.primesOver_finite ..) -- `w` lies over the prime below `v`: two ideals of `β„€` with the same norm are equal. simp_all [Int.cast_mem_ideal_iff] -- The least prime factors lie in `(1, N)` for `N` one more than their maximum. set N : β„• := u.sup fun v : FinPlace K ↦ v.q.minFac + 1 have h_range : u.image (fun v : FinPlace K ↦ v.q.minFac) βŠ† Ioo 1 N := image_subset_iff.mpr fun v hv ↦ mem_Ioo.mpr ⟨(Nat.minFac_prime v.one_lt_q.ne').one_lt, le_sup (f := fun w : FinPlace K ↦ w.q.minFac + 1) hv⟩ calc _ = βˆ‘ p ∈ u.image (fun v : FinPlace K ↦ v.q.minFac), #{w ∈ u | w.q.minFac = p} β€’ (p ^ 2 : ℝ)⁻¹ := sum_comp (fun p : β„• ↦ (p ^ 2 : ℝ)⁻¹) _ _ ≀ βˆ‘ p ∈ u.image (fun v : FinPlace K ↦ v.q.minFac), finrank β„š K β€’ (p ^ 2 : ℝ)⁻¹ := sum_le_sum (forall_mem_image.mpr fun v _ ↦ nsmul_le_nsmul_left (by positivity) (h_group v)) _ ≀ finrank β„š K β€’ (2 / ((1 : β„•) + 1) : ℝ) := by -- `βˆ‘ 1 / p ^ 2 ≀ 2 / (1 + 1)` over `1 < p < N`. grw [← smul_sum, h_range, sum_Ioo_inv_sq_le] _ = finrank β„š K := by norm_num variable {a b} {l l' : β„‚} /-- For real `s > 1` the series of `N(I) ^ (-s)` over all ideals `I` of `π“ž K` converges, with `N(I) = absNorm I` (the zero ideal has norm `0` and term `0`). -/ lemma summable_absNorm_rpow (hs : 1 < s) : Summable fun I : Ideal (π“ž K) ↦ (absNorm I : ℝ) ^ (-s) := by refine (summable_subtype_and_compl (s := (nonZeroDivisors (Ideal (π“ž K)) : Set _))).1 ⟨(TauCeti.summable_absNorm_rpow_ideal_iff (K := K)).mpr hs, ?_⟩ have h_fin : ((nonZeroDivisors (Ideal (π“ž K)) : Set (Ideal (π“ž K)))ᢜ).Finite := (Set.finite_singleton (βŠ₯ : Ideal (π“ž K))).subset fun I hI ↦ by_contra fun hne ↦ hI (mem_nonZeroDivisors_of_ne_zero hne) exact h_fin.summable (fun I ↦ (absNorm I : ℝ) ^ (-s)) /-- For `β€–a vβ€– ≀ 1` and real `t ≀ s`, the term `-(a v * q ^ (-s))` of the Euler factor has norm at most `q ^ (-t)`, with `q = v.q` the norm of the prime `v`. -/ private lemma norm_neg_mul_cpow_le_rpow_of_norm_le_one (ha : βˆ€ v : FinPlace K, β€–a vβ€– ≀ 1) {t : ℝ} (ht : t ≀ s) (v : FinPlace K) : β€–-(a v * v.q ^ (-s : β„‚))β€– ≀ (v.q : ℝ) ^ (-t) := by grw [norm_neg, norm_mul_le, ha, one_mul, norm_cpow_le, ht] Β· -- `β€–q ^ (-s)β€– = q ^ (-s)` for the positive real `q`. simp Β· exact mod_cast v.one_lt_q.le /-- For `β€–a vβ€– ≀ 1` and real `s β‰₯ 1`, the term `-(a v * q ^ (-s))` has norm at most `1 / q`. -/ private lemma norm_neg_mul_cpow_le_inv_of_norm_le_one (ha : βˆ€ v : FinPlace K, β€–a vβ€– ≀ 1) (hs : 1 ≀ s) (v : FinPlace K) : β€–-(a v * v.q ^ (-s : β„‚))β€– ≀ (v.q : ℝ)⁻¹ := by simpa [Real.rpow_neg] using norm_neg_mul_cpow_le_rpow_of_norm_le_one ha hs v /-- For `β€–a vβ€– ≀ 1` and real `1 ≀ Οƒ ≀ s`, the logarithm of the Euler factor `1 - a v * q ^ (-s)` has norm at most `2 * q ^ (-Οƒ)`. -/ lemma norm_log_one_add_neg_mul_cpow_le_of_norm_le_one (ha : βˆ€ v : FinPlace K, β€–a vβ€– ≀ 1) {Οƒ : ℝ} (hΟƒ : 1 ≀ Οƒ) (hΟƒs : Οƒ ≀ s) (v : FinPlace K) : β€–Complex.log (1 + -(a v * v.q ^ (-s : β„‚)))β€– ≀ 2 * v.q ^ (-Οƒ) := by set w : β„‚ := -(a v * v.q ^ (-s : β„‚)) have h_inv : β€–wβ€– ≀ (v.q : ℝ)⁻¹ := norm_neg_mul_cpow_le_inv_of_norm_le_one ha (hΟƒ.trans hΟƒs) v have h_half : β€–wβ€– ≀ 1 / 2 := by rw [one_div] exact h_inv.trans (inv_antiβ‚€ two_pos (mod_cast v.one_lt_q)) exact (norm_log_one_add_half_le_self h_half).trans (mul_le_mul (by norm_num) (norm_neg_mul_cpow_le_rpow_of_norm_le_one ha hΟƒs v) (norm_nonneg w) zero_le_two) /-- For `β€–a vβ€– ≀ 1` and real `s β‰₯ 1`, the logarithm of the Euler factor `1 - a v * q ^ (-s)` differs from `-(a v * q ^ (-s))` (if `q` is prime) or from `0` (if not) by at most `2 / p ^ 2`, with `p` the least prime factor of `q`. -/ lemma norm_log_one_add_neg_mul_cpow_sub_ite_le_of_norm_le_one (ha : βˆ€ v : FinPlace K, β€–a vβ€– ≀ 1) (hs : 1 ≀ s) (v : FinPlace K) : β€–Complex.log (1 + -(a v * v.q ^ (-s : β„‚))) - (if v.q.Prime then -(a v * v.q ^ (-s : β„‚)) else 0)β€– ≀ 2 / v.q.minFac ^ 2 := by set w : β„‚ := -(a v * v.q ^ (-s : β„‚)) split_ifs with hq Β· -- `q` is its own least factor, and `β€–log (1 + w) - wβ€– ≀ β€–wβ€– ^ 2 / (1 - β€–wβ€–) / 2 ≀ 1 / q ^ 2`. have h_inv : β€–wβ€– ≀ (v.q : ℝ)⁻¹ := norm_neg_mul_cpow_le_inv_of_norm_le_one ha hs v have h_half : β€–wβ€– ≀ 2⁻¹ := h_inv.trans (inv_antiβ‚€ two_pos (mod_cast v.one_lt_q)) grw [norm_log_one_add_sub_self_le (h_half.trans_lt (by norm_num)), ← sub_le_sub_left h_half, h_inv, hq.minFac_eq] ring_nf linarith [sq_nonneg (v.q : ℝ)⁻¹] Β· -- Nothing is subtracted, `β€–log (1 + w)β€– ≀ 2 / q` and `minFac q ^ 2 ≀ q`. have h_sq : ((v.q.minFac : ℝ) ^ 2) ≀ v.q := mod_cast Nat.minFac_sq_le_self (zero_lt_one.trans v.one_lt_q) hq rw [sub_zero] calc β€–log (1 + w)β€– ≀ 2 / v.q := by simpa only [Real.rpow_neg_one, div_eq_mul_inv] using norm_log_one_add_neg_mul_cpow_le_of_norm_le_one ha (le_refl 1) hs v _ ≀ 2 / v.q.minFac ^ 2 := div_le_div_of_nonneg_left zero_le_two (pow_pos (mod_cast v.q.minFac_pos) 2) h_sq /-- For `β€–a vβ€– ≀ 1` and real `s β‰₯ 1`, the Euler factor `1 - a v * q ^ (-s)` lies in the slit plane, where the logarithm is continuous. -/ lemma one_add_neg_mul_cpow_mem_slitPlane_of_norm_le_one (ha : βˆ€ v : FinPlace K, β€–a vβ€– ≀ 1) (hs : 1 ≀ s) (v : FinPlace K) : 1 + -(a v * v.q ^ (-s : β„‚)) ∈ slitPlane := mem_slitPlane_of_norm_lt_one ((norm_neg_mul_cpow_le_inv_of_norm_le_one ha hs v).trans_lt (inv_lt_one_of_one_ltβ‚€ (mod_cast v.one_lt_q))) /-- If `β€–a vβ€– ≀ 1` and `s > 1`, the series `βˆ‘ v, log (1 - a v * q ^ (-s))` converges, its sum is continuous at `s`, and `New.eulerProd a s` is the exponential of minus this sum. -/ @[local simp] lemma eulerProd_eq_exp (ha : βˆ€ v : FinPlace K, β€–a vβ€– ≀ 1) (hs : 1 < s) : let logFactor (s : ℝ) (v : FinPlace K) : β„‚ := Complex.log (1 + -(a v * v.q ^ (-s : β„‚))) eulerProd a s = exp (-βˆ‘' v : FinPlace K, logFactor s v) ∧ Summable (logFactor s) ∧ ContinuousAt (fun t : ℝ ↦ -βˆ‘' v : FinPlace K, logFactor t v) s := by -- Fix `Οƒ` between `1` and `s`. For `t β‰₯ Οƒ` the logarithms are dominated by the convergent series -- `βˆ‘ 2 * q ^ (-Οƒ)`, which gives summability and, by dominated convergence, continuity. intro logFactor obtain βŸ¨Οƒ, hΟƒ, hΟƒs⟩ : βˆƒ Οƒ : ℝ, 1 < Οƒ ∧ Οƒ < s := exists_between hs have h_sum : Summable fun v : FinPlace K ↦ 2 * (v.q : ℝ) ^ (-Οƒ) := ((summable_absNorm_rpow hΟƒ).comp_injective asIdeal_injective).mul_left _ have h_bound (t : ℝ) (ht : Οƒ ≀ t) (v : FinPlace K) : β€–logFactor t vβ€– ≀ 2 * (v.q : ℝ) ^ (-Οƒ) := norm_log_one_add_neg_mul_cpow_le_of_norm_le_one ha hΟƒ.le ht v have h_term (v : FinPlace K) : ContinuousAt (fun t : ℝ ↦ logFactor t v) s := ContinuousAt.clog (by fun_prop (disch := simp [IsDedekindDomain.HeightOneSpectrum.ne_bot])) (one_add_neg_mul_cpow_mem_slitPlane_of_norm_le_one ha hs.le v) have h_cont : ContinuousAt (fun t : ℝ ↦ -βˆ‘' v : FinPlace K, logFactor t v) s := (tendsto_tsum_of_dominated_convergence h_sum h_term (.mono (Ici_mem_nhds hΟƒs) h_bound)).neg -- The extension by continuity keeps the value at a point of continuity. exact ⟨extendFrom_eq (subset_closure hs) h_cont.cexp.continuousWithinAt.tendsto, h_sum.of_norm_bounded (h_bound s hΟƒs.le), h_cont⟩ /-- For `β€–a vβ€– ≀ 1` and real `s > 1`, `New.eulerProd a s` is the exponential of minus the sum of the logarithms of the Euler factors `1 - a v * q ^ (-s)`. -/ lemma eulerProd_eq_exp_neg_tsum_log_of_norm_le_one (ha : βˆ€ v : FinPlace K, β€–a vβ€– ≀ 1) (hs : 1 < s) : eulerProd a s = exp (-βˆ‘' v : FinPlace K, Complex.log (1 + -(a v * v.q ^ (-s : β„‚)))) := by obtain ⟨h_eq, -, -⟩ := eulerProd_eq_exp ha hs exact h_eq /-- For `β€–a vβ€– ≀ 1` and real `s > 1`, the logarithms of the Euler factors `1 - a v * q ^ (-s)` are summable over the primes `v`. -/ lemma summable_log_one_add_neg_mul_cpow_of_norm_le_one (ha : βˆ€ v : FinPlace K, β€–a vβ€– ≀ 1) (hs : 1 < s) : Summable fun v : FinPlace K ↦ Complex.log (1 + -(a v * v.q ^ (-s : β„‚))) := by obtain ⟨-, h_sum, -⟩ := eulerProd_eq_exp ha hs exact h_sum /-- If `β€–a vβ€– ≀ 1` for all primes `v` of `K` and `s > 1` is real, the Euler product `∏ v, (1 - a v * q ^ (-s))⁻¹` converges unconditionally to `New.eulerProd a s`. -/ lemma hasProd_eulerProd (ha : βˆ€ v : FinPlace K, β€–a vβ€– ≀ 1) (hs : 1 < s) : HasProd (fun v : FinPlace K ↦ (1 - a v * v.q ^ (-s : β„‚))⁻¹) (eulerProd a s) := by have h_sum := (summable_log_one_add_neg_mul_cpow_of_norm_le_one ha hs).hasSum rw [eulerProd_eq_exp_neg_tsum_log_of_norm_le_one ha hs, exp_neg] -- The factor `1 - x` is written `1 + -x`, the form whose logarithms are summed. simp only [sub_eq_add_neg] exact (hasProd_of_hasSum_log (fun v ↦ slitPlane_ne_zero (one_add_neg_mul_cpow_mem_slitPlane_of_norm_le_one ha hs.le v)) h_sum).invβ‚€ (exp_ne_zero _) /-- For `β€–a vβ€– ≀ 1`, a finite set `Q` of primes and `P s = ∏ w ∈ Q, (1 - a w * q_w ^ (-s))`: `P` is analytic at the real point `1`, `P 1 β‰  0`, and for real `s > 1` setting the coefficients at `Q` to zero multiplies the Euler product by `P s`. -/ lemma eulerProd_erase (ha : βˆ€ v : FinPlace K, β€–a vβ€– ≀ 1) (Q : Finset (FinPlace K)) : let P (s : β„‚) : β„‚ := ∏ w ∈ Q, (1 - a w * w.q ^ (-s)) AnalyticAt ℝ (P ∘ ofReal) 1 ∧ P 1 β‰  0 ∧ βˆ€ s > (1 : ℝ), eulerProd (indicator Qᢜ a) s = eulerProd a s * P s := by intro P have h_factor_ne {t : ℝ} (ht : 1 ≀ t) (w : FinPlace K) : 1 - a w * w.q ^ (-t : β„‚) β‰  0 := by simpa [sub_eq_add_neg] using slitPlane_ne_zero (one_add_neg_mul_cpow_mem_slitPlane_of_norm_le_one ha ht w) have hP_analytic : AnalyticAt β„‚ P 1 := by fun_prop (disch := simp [IsDedekindDomain.HeightOneSpectrum.ne_bot]) have hP_one : P 1 β‰  0 := prod_ne_zero_iff.mpr fun w _ ↦ by simpa using h_factor_ne le_rfl w refine ⟨(hP_analytic.restrictScalars (π•œ' := β„‚)).comp_of_eq (ofRealCLM.analyticAt 1) (by simp), hP_one, fun s hs ↦ ?_⟩ -- The two convergent products have the same factors outside `Q`, so their values differ by -- the quotient of the finite products over `Q`. let g (v : FinPlace K) : β„‚ := (1 - Set.indicator Qᢜ a v * v.q ^ (-s : β„‚))⁻¹ have h_erased : HasProd g (eulerProd (Set.indicator Qᢜ a) s) := hasProd_eulerProd (fun v ↦ (norm_indicator_le_norm_self a v).trans (ha v)) hs have h_congr : HasProd g (eulerProd a s * ((∏ w ∈ Q, g w) / ∏ w ∈ Q, (1 - a w * w.q ^ (-s : β„‚))⁻¹)) := (hasProd_eulerProd ha hs).congr_cofiniteβ‚€ (fun w _ ↦ inv_ne_zero (h_factor_ne hs.le w)) fun w hw ↦ by simp [g, hw] -- At `Q` the new factors are `1` and the old ones have product `(P s)⁻¹`. have h_g_one : βˆ€ w ∈ Q, g w = 1 := fun w hw ↦ by simp [g, hw] rw [h_erased.unique h_congr, prod_eq_one h_g_one, prod_inv_distrib, one_div, inv_inv] /-- If `β€–a vβ€– ≀ 1` for all `v` and `(s - 1) ^ l * eulerProd a s` tends to some `c β‰  0` as real `s ↓ 1`, with `l` a complex number, then `a` has density `l` over the primes of degree one. This means `HasPrimeDensity a l`: the sum of `a v * q_v ^ (-s)` over the primes `v` of prime norm `q_v` equals `l * log (1 / (s - 1))` plus a term bounded as `s ↓ 1`. (A pole of order `m` is the case `l = m`, a zero of order `m` the case `l = -m`.) -/ lemma hasPrimeDensity_of_tendsto (ha : βˆ€ v : FinPlace K, β€–a vβ€– ≀ 1) {l : β„‚} {c : β„‚} (hc : c β‰  0) (h_lim : Tendsto (fun s : ℝ ↦ (s - 1) ^ l * eulerProd a s) (𝓝[>] 1) (𝓝 c)) : HasPrimeDensity a l := by -- `logProd` is a continuous logarithm of `(s - 1) ^ l * eulerProd a s` for `s > 1`. As -- `exp logProd` tends to `c β‰  0`, `logProd` stays bounded near `1`; and the logarithm of the -- Euler product differs from the sum over the primes of degree one by a bounded error. let L (s : ℝ) (v : FinPlace K) : β„‚ := log (1 + -(a v * v.q ^ (-s : β„‚))) let logProd (s : ℝ) : β„‚ := (s - 1).log * l + -βˆ‘' v, L s v have h_exp_logProd (s : ℝ) (hs_gt : 1 < s) : (s - 1) ^ l * eulerProd a s = exp (logProd s) := by have h_ne : (s : β„‚) - 1 β‰  0 := sub_ne_zero.mpr (mod_cast hs_gt.ne') rw [eulerProd_eq_exp_neg_tsum_log_of_norm_le_one ha hs_gt, cpow_def_of_ne_zero h_ne, ← exp_add] simp [logProd, L, ofReal_log (sub_nonneg.mpr hs_gt.le)] have h_exp : Tendsto (fun s : ℝ ↦ exp (logProd s) / c) (𝓝[>] 1) (𝓝 (c / c)) := (tendsto_nhdsWithin_congr h_exp_logProd h_lim).div_const c have h_one : c / c ∈ slitPlane := by simp [div_self hc] obtain ⟨s₁, hs₁, h_slit⟩ : βˆƒ s₁ ∈ Set.Ioi (1 : ℝ), βˆ€ s ∈ Set.Ioc 1 s₁, exp (logProd s) / c ∈ slitPlane := mem_nhdsGT_iff_exists_Ioc_subset.mp (h_exp (isOpen_slitPlane.mem_nhds h_one)) have hlog_cont : ContinuousOn logProd (Ioc 1 s₁) := by refine .add (by fun_prop (disch := grind)) fun s ⟨hs_gt, _⟩ ↦ ?_ obtain ⟨-, -, h_cont⟩ := eulerProd_eq_exp ha hs_gt exact h_cont.continuousWithinAt -- On `(1, s₁]` the function `logProd - log (exp logProd / c)` is a continuous logarithm of the -- constant `c`, so it is constant. have h_exp_eq (t : ℝ) (ht : t ∈ Ioc 1 s₁) : exp (logProd t - log (exp (logProd t) / c)) = c := by rw [exp_sub, exp_log (slitPlane_ne_zero (h_slit t ht)), div_div_cancelβ‚€ (exp_ne_zero _)] have hlog_const (s : ℝ) (hs : s ∈ Set.Ioc 1 s₁) : logProd s - log (exp (logProd s) / c) = logProd s₁ - log (exp (logProd s₁) / c) := isCoveringMap_exp.constOn_of_comp isPreconnected_Ioc (hlog_cont.fun_sub ((hlog_cont.cexp.div_const c).clog h_slit)) (fun t ht t' ht' ↦ Subtype.ext ((h_exp_eq t ht).trans (h_exp_eq t' ht').symm)) hs ⟨hs₁, le_rfl⟩ let C : β„‚ := logProd s₁ - log (exp (logProd s₁) / c) have hlog_bdd : (fun s ↦ C + log (exp (logProd s) / c)) =O[𝓝[>] 1] (1 : ℝ β†’ ℝ) := ((h_exp.clog h_one).const_add C).isBigO_one ℝ -- The error terms `E s v` are bounded, uniformly in `s > 1`, by a convergent series. let E (s : ℝ) (v : FinPlace K) : β„‚ := L s v - ite v.q.Prime (-(a v * v.q ^ (-s : β„‚))) 0 have hE_le (s : ℝ) (hs : 1 < s) (v : FinPlace K) : β€–E s vβ€– ≀ 2 * (v.q.minFac ^ 2 : ℝ)⁻¹ := (norm_log_one_add_neg_mul_cpow_sub_ite_le_of_norm_le_one ha hs.le v).trans_eq (div_eq_mul_inv _ _) have h_sum : Summable fun v : FinPlace K ↦ 2 * (v.q.minFac ^ 2 : ℝ)⁻¹ := (summable_of_sum_le (fun v ↦ by positivity) sum_inv_minFac_sq_le_finrank).mul_left 2 have hE_bdd : (fun s ↦ βˆ‘' v, E s v) =O[𝓝[>] 1] (1 : ℝ β†’ ℝ) := (isBoundedUnder_of_eventually_le <| eventually_mem_nhdsWithin.mono fun s hs ↦ tsum_of_norm_bounded h_sum.hasSum (hE_le s hs)).isBigO_one ℝ -- The bounded error term: the sum of the `E s v` plus `logProd s`, written as the constant -- logarithm `C` of `c` plus `log (exp (logProd s) / c)`. let err (s : ℝ) : β„‚ := βˆ‘' v, E s v + (C + log (exp (logProd s) / c)) refine ⟨err, hE_bdd.add hlog_bdd, .mono (Ioc_mem_nhdsGT hs₁) fun s ⟨hs_gt, hs_le⟩ ↦ ?_⟩ -- The terms are `E s v - L s v`, and `-βˆ‘' v, L s v = logProd s - log (s - 1) * l`. have h_terms : (fun v : FinPlace K ↦ ite v.q.Prime (a v) 0 * v.q ^ (-s : β„‚)) = fun v ↦ E s v - L s v := by grind have h_value : err s - l * Real.log (s - 1) = βˆ‘' v, E s v - βˆ‘' v, L s v := by linear_combination -hlog_const s ⟨hs_gt, hs_le⟩ rw [h_terms, h_value] exact (h_sum.of_norm_bounded (hE_le s hs_gt)).hasSum.sub (summable_log_one_add_neg_mul_cpow_of_norm_le_one ha hs_gt).hasSum open Real /-- If `β€–a vβ€– ≀ 1` for all `v` and `s β‰₯ Οƒ β‰₯ 2` are real, the Euler product with coefficients `a` is nonzero at `s`, and the logarithm of its modulus has absolute value at most `2 * [K : β„š] * 2 ^ (2 - Οƒ)`. -/ lemma eulerProd_ne_zero_and_abs_log_norm_le (ha : βˆ€ v : FinPlace K, β€–a vβ€– ≀ 1) {Οƒ : ℝ} (hΟƒ : 2 ≀ Οƒ) (hs : Οƒ ≀ s) : eulerProd a s β‰  0 ∧ |Real.log β€–eulerProd a sβ€–| ≀ 2 * finrank β„š K * 2 ^ (2 - Οƒ) := by have hs_one : 1 < s := by linarith have h_summable := summable_log_one_add_neg_mul_cpow_of_norm_le_one ha hs_one -- Each logarithm is at most `2 * q ^ (-Οƒ) ≀ 2 * 2 ^ (2 - Οƒ) / p ^ 2`, as `q β‰₯ 2` and `p ≀ q` for -- the least prime factor `p` of `q`. have h_term (v : FinPlace K) : β€–log (1 + -(a v * v.q ^ (-s : β„‚)))β€– ≀ 2 * 2 ^ (2 - Οƒ) * (v.q.minFac ^ 2 : ℝ)⁻¹ := by have hq : (2 : ℝ) ≀ v.q := mod_cast v.one_lt_q have hp : 0 < v.q.minFac := v.q.minFac_pos calc _ ≀ 2 * (v.q : ℝ) ^ (-Οƒ) := norm_log_one_add_neg_mul_cpow_le_of_norm_le_one ha (by linarith) hs v _ = 2 * v.q ^ (2 - Οƒ) * (v.q ^ 2 : ℝ)⁻¹ := by simp [rpow_sub, v.q_bounds, field, rpow_neg] _ ≀ _ := by grw [rpow_le_rpow_of_nonpos two_pos hq (sub_nonpos.mpr hΟƒ), Nat.minFac_le v.one_lt_q.le] -- Sum over the primes, using `βˆ‘ p⁻² ≀ [K : β„š]`. have h_sum : β€–βˆ‘' v, log (1 + -(a v * v.q ^ (-s : β„‚)))β€– ≀ 2 * finrank β„š K * 2 ^ (2 - Οƒ) := by refine le_of_tendsto' h_summable.hasSum.norm fun u ↦ ?_ grw [norm_sum_le, h_term, ← Finset.mul_sum, sum_inv_minFac_sq_le_finrank u, mul_right_comm] -- The product is `exp (-z)` for the sum `z` of the logarithms: it is nonzero, and -- `|log β€–exp (-z)β€–| = |re z| ≀ β€–zβ€–`. rw [eulerProd_eq_exp_neg_tsum_log_of_norm_le_one ha hs_one] refine ⟨exp_ne_zero _, ?_⟩ set z : β„‚ := βˆ‘' v : FinPlace K, Complex.log (1 + -(a v * v.q ^ (-s : β„‚))) calc |Real.log β€–exp (-z)β€–| = |z.re| := by rw [norm_exp, Real.log_exp, neg_re, abs_neg] _ ≀ β€–zβ€– := abs_re_le_norm z _ ≀ 2 * finrank β„š K * 2 ^ (2 - Οƒ) := h_sum open scoped Classical in /-- For a number field `K`, a summable function `t` on the ideals of `π“ž K` with `t (v * I) = t v * t I` for every nonzero prime `v` and ideal `I`, and a finite set `T` of nonzero primes of `π“ž K`, summing `t I` over the ideals not divisible by any prime in `T` gives `(βˆ‘' I, t I) * ∏ v ∈ T, (1 - t v)`. -/ private lemma hasSum_sieved_ideal {t : Ideal (π“ž K) β†’ β„‚} (h_summable : Summable t) (h_t_mul : βˆ€ (v : FinPlace K) (I : Ideal (π“ž K)), t (v.asIdeal * I) = t v.asIdeal * t I) (T : Finset (FinPlace K)) : HasSum (fun I : Ideal (π“ž K) ↦ if βˆ€ v ∈ T, Β¬v.asIdeal ∣ I then t I else 0) ((βˆ‘' I, t I) * ∏ v ∈ T, (1 - t v.asIdeal)) := by let sieved (T : Finset (FinPlace K)) (I : Ideal (π“ž K)) : β„‚ := if βˆ€ v ∈ T, Β¬v.asIdeal ∣ I then t I else 0 change HasSum (sieved T) ((βˆ‘' I, t I) * ∏ v ∈ T, (1 - t v.asIdeal)) induction T using Finset.cons_induction with | empty => simpa [sieved] using h_summable.hasSum | cons v T hv ih => -- The terms removed at `v` are those of the ideals `v * I`: they are `t v` times the old -- terms at `I`. let removed (I : Ideal (π“ž K)) : β„‚ := sieved T I - sieved (cons v T hv) I have h_mul (I : Ideal (π“ž K)) : removed (v.asIdeal * I) = t v.asIdeal * sieved T I := by -- `t` is multiplicative; `v ∣ v * I`, and a prime `w ∈ T` (so `w β‰  v`) divides `v * I` -- if and only if it divides `I`. have h_cons_zero : sieved (cons v T hv) (v.asIdeal * I) = 0 := ite_eq_right fun h ↦ h v (mem_cons_self v T) (dvd_mul_right v.asIdeal I) have h_iff : (βˆ€ w ∈ T, Β¬w.asIdeal ∣ v.asIdeal * I) ↔ βˆ€ w ∈ T, Β¬w.asIdeal ∣ I := by refine forallβ‚‚_congr fun w hw ↦ ?_ simp [(prime w).dvd_mul, prime_dvd_prime_iff_eq (prime w) (prime v), asIdeal_injective.ne (ne_of_mem_of_not_mem hw hv)] simp only [removed, h_cons_zero, sub_zero] simp only [sieved, h_iff, h_t_mul v I, mul_ite, mul_zero] have h_off : βˆ€ I βˆ‰ Set.range fun J : Ideal (π“ž K) ↦ v.asIdeal * J, removed I = 0 := by grind [dvd_def] have h_removed : HasSum removed (t v.asIdeal * ((βˆ‘' I, t I) * ∏ w ∈ T, (1 - t w.asIdeal))) := ((mul_right_injectiveβ‚€ v.ne_bot).hasSum_iff h_off).mp ((ih.mul_left (t v.asIdeal)).congr_fun h_mul) rw [prod_cons, mul_left_comm, one_sub_mul] exact (ih.sub h_removed).congr_fun fun I ↦ (sub_sub_self _ _).symm /-- Euler product: for `Ο‡` multiplicative on the ideals of `π“ž K` with `β€–Ο‡ Iβ€– ≀ 1` and real `s > 1`, the series `βˆ‘ I, Ο‡ I * N(I) ^ (-s)` converges to the Euler product with coefficients `Ο‡ v`. -/ lemma hasSum_eulerProd (Ο‡ : Ideal (π“ž K) β†’* β„‚) (hΟ‡ : βˆ€ I : Ideal (π“ž K), β€–Ο‡ Iβ€– ≀ 1) (hs : 1 < s) : HasSum (fun I : Ideal (π“ž K) ↦ Ο‡ I * I.absNorm ^ (-s : β„‚)) (eulerProd (fun v : FinPlace K ↦ Ο‡ v.asIdeal) s) := by classical -- Sieve: multiplying the series by the factors `1 - Ο‡ v * N v ^ (-s)`, `v ∈ T`, removes the -- ideals divisible by a prime of `T`. As `T` grows only the term `1` of the unit ideal survives, -- so the sum of the series times the inverse of the Euler product is `1`. let t (I : Ideal (π“ž K)) : β„‚ := Ο‡ I * I.absNorm ^ (-s : β„‚) let sieved (T : Finset (FinPlace K)) (I : Ideal (π“ž K)) : β„‚ := if βˆ€ v ∈ T, Β¬v.asIdeal ∣ I then t I else 0 have h_norm_le (I : Ideal (π“ž K)) : β€–t Iβ€– ≀ (absNorm I : ℝ) ^ (-s) := by grw [norm_mul_le, hΟ‡, norm_cpow_le] simp have h_summable : Summable t := (summable_absNorm_rpow hs).of_norm_bounded h_norm_le have h_t_mul (v : FinPlace K) (I : Ideal (π“ž K)) : t (v.asIdeal * I) = t v.asIdeal * t I := by simp only [t, map_mul, Nat.cast_mul, natCast_mul_cpow] ring have h_sieve (T : Finset (FinPlace K)) : HasSum (sieved T) ((βˆ‘' I, t I) * ∏ v ∈ T, (1 - t v.asIdeal)) := hasSum_sieved_ideal h_summable h_t_mul T -- Termwise limit: a proper ideal lies in some prime, and is removed once `T` contains it. have h_term (I : Ideal (π“ž K)) : Tendsto (fun T ↦ sieved T I) atTop (𝓝 (if I = ⊀ then 1 else 0)) := by split_ifs with hI Β· simp [sieved, t, hI, ← one_eq_top, (prime _).not_dvd_one] Β· obtain ⟨v, hI_le⟩ : βˆƒ v : FinPlace K, I ≀ v.asIdeal := (ideal_ne_top_iff_exists (RingOfIntegers.not_isField K) I).mp hI have h_zero : βˆ€ T β‰₯ ({v} : Finset (FinPlace K)), sieved T I = 0 := by grind [dvd_iff_le] exact tendsto_atTop_of_eventually_const h_zero -- Dominated convergence: each sieved term is `t I` or `0`. have h_bound (T : Finset (FinPlace K)) (I : Ideal (π“ž K)) : β€–sieved T Iβ€– ≀ β€–t Iβ€– := by grind [norm_zero] have h_lim_one : Tendsto (fun T : Finset (FinPlace K) ↦ (βˆ‘' I, t I) * ∏ v ∈ T, (1 - t v.asIdeal)) atTop (𝓝 1) := by have h_dom := tendsto_tsum_of_dominated_convergence h_summable.norm h_term (.of_forall h_bound) rw [tsum_ite_eq] at h_dom exact h_dom.congr fun T ↦ (h_sieve T).tsum_eq -- The partial products of the factors `1 - t v` tend to the inverse of the Euler product. have h_lim_prod : HasProd (fun v : FinPlace K ↦ 1 - t v.asIdeal) (eulerProd (fun v : FinPlace K ↦ Ο‡ v.asIdeal) s)⁻¹ := by have h_ne : eulerProd (fun v : FinPlace K ↦ Ο‡ v.asIdeal) s β‰  0 := by simp [eulerProd_eq_exp_neg_tsum_log_of_norm_le_one (fun v ↦ hΟ‡ v.asIdeal) hs] simpa only [inv_inv] using (hasProd_eulerProd (fun v ↦ hΟ‡ v.asIdeal) hs).invβ‚€ h_ne exact h_summable.hasSum_iff.mpr (eq_of_mul_inv_eq_one (tendsto_nhds_unique (h_lim_prod.const_mul _) h_lim_one)) /-- Densities are linear: if each `a i` has density `l i` over the primes of degree one, then `βˆ‘ i, w i * a i` has density `βˆ‘ i, w i * l i`. -/ lemma HasPrimeDensity.sum {ΞΉ : Type*} [Fintype ΞΉ] {a : ΞΉ β†’ FinPlace K β†’ β„‚} (w : ΞΉ β†’ β„‚) {l : ΞΉ β†’ β„‚} (h : βˆ€ i : ΞΉ, HasPrimeDensity (a i) (l i)) : HasPrimeDensity (fun v : FinPlace K ↦ βˆ‘ i : ΞΉ, w i * a i v) (βˆ‘ i : ΞΉ, w i * l i) := by -- Take the same combination of the bounded error terms. choose x h_bdd h_sum using h refine βŸ¨βˆ‘ i, fun s ↦ w i * x i s, .sum fun i _ ↦ (h_bdd i).const_mul_left (w i), ?_⟩ filter_upwards [eventually_all.mpr h_sum] with s hs convert hasSum_sum (s := Finset.univ) fun i _ ↦ (hs i).mul_left (w i) using 1 Β· ext v by_cases hq : v.q.Prime <;> simp [hq, Finset.sum_mul, mul_assoc] Β· simp [Finset.sum_apply, mul_sub, Finset.sum_sub_distrib, Finset.sum_mul, mul_assoc] /-- Suppose `a` has density `l` and `b` has density `l'` in the Dirichlet sense of `HasPrimeDensity`: over the primes `v` of degree one (prime norm `q_v`), `βˆ‘ a v * q_v ^ (-s) = l * log (1 / (s - 1)) + O(1)` as `s ↓ 1`, and likewise for `b` and `l'`. Suppose also that `Re (a v) ≀ Re (b v)` for all but finitely many primes `v` of degree one. Then `Re l ≀ Re l'`. -/ lemma HasPrimeDensity.re_le_re (ha : HasPrimeDensity a l) (hb : HasPrimeDensity b l') (h_le : βˆ€αΆ  v : FinPlace K in cofinite, v.q.Prime β†’ (a v).re ≀ (b v).re) : l.re ≀ l'.re := by -- Subtract the two series. Outside a finite set `S` the terms `d s v` have real part `β‰₯ 0`, so -- `βˆ‘ v ∈ S, re (d s v) + re (l' - l) log (s - 1) ≀ β€–y s - x sβ€–`, which is bounded as `s ↓ 1`. -- If `re l' < re l` the left side tends to `+∞`. obtain ⟨x, hx_bdd, hx_sum⟩ := ha obtain ⟨y, hy_bdd, hy_sum⟩ := hb by_contra! h_lt let S := (eventually_cofinite.mp h_le).toFinset let d (s : ℝ) (v : FinPlace K) : β„‚ := ite v.q.Prime (b v) 0 * v.q ^ (-s : β„‚) - ite v.q.Prime (a v) 0 * v.q ^ (-s : β„‚) have h_nonneg s v (hv : v βˆ‰ S) : 0 ≀ (d s v).re := by have h_real : (v.q : β„‚) ^ (-s : β„‚) = ((v.q : ℝ) ^ (-s) : ℝ) := by simp [ofReal_cpow] simp only [d, h_real, ← sub_mul, re_mul_ofReal, sub_re] refine mul_nonneg ?_ (by positivity) by_cases hq : v.q.Prime <;> simp_all [S] have h_bound : βˆ€αΆ  s : ℝ in 𝓝[>] 1, βˆ‘ v ∈ S, (d s v).re + (l'.re - l.re) * (s - 1).log ≀ β€–y s - x sβ€– := by filter_upwards [hx_sum, hy_sum] with s has hbs refine le_trans ?_ (re_le_norm _) grw [sum_le_hasSum S (h_nonneg s) (hasSum_re (hbs.sub has))] grind [sub_re, re_mul_ofReal] -- As `re l' < re l`, the left side of `h_bound` tends to `+∞`, but the right side is bounded. have h_cont : ContinuousAt (fun s ↦ βˆ‘ v ∈ S, (d s v).re) 1 := by fun_prop (disch := simp) have h_log : Tendsto (fun s : ℝ ↦ (s - 1).log) (𝓝[>] 1) atBot := tendsto_log_nhdsGT_zero.comp (by simp [Tendsto, map_subRight_nhdsGT]) exact not_isBoundedUnder_of_tendsto_atTop (h_cont.continuousWithinAt.tendsto.add_atTop (h_log.const_mul_atBot_of_neg (sub_neg.mpr h_lt))) ((hy_bdd.sub hx_bdd).isBoundedUnder_le.mono_le h_bound) /-- For `c ∈ β„‚` the constant family `v ↦ c` has density `c` over the primes of degree one of `K`, in the sense of `New.HasPrimeDensity`. -/ lemma hasPrimeDensity_const (c : β„‚) : HasPrimeDensity (fun _ : FinPlace K ↦ c) c := by -- The simple pole of `ΞΆ_K` at `s = 1` gives the constant family `1` mean `1`; scale by `c`. suffices HasPrimeDensity (fun _ : FinPlace K ↦ 1) 1 by simpa using HasPrimeDensity.sum (ΞΉ := Unit) (fun _ ↦ c) fun _ ↦ this refine hasPrimeDensity_of_tendsto (fun _ ↦ by simp) (ofReal_ne_zero.mpr (dedekindZeta_residue_ne_zero K)) (tendsto_nhdsWithin_congr (fun s hs ↦ ?_) (tendsto_sub_one_mul_dedekindZeta_nhdsGT K)) -- For `s > 1` the Euler product with coefficients `1` is `ΞΆ_K(s)`: group the ideals by norm. rw [cpow_one] refine congrArg _ (((hasSum_eulerProd (K := K) 1 (fun _ ↦ by simp) hs).tsum_fiberwise absNorm).congr_fun fun n ↦ ?_).tsum_eq rw [tsum_congr fun I : absNorm ⁻¹' {n} ↦ by rw [I.property, MonoidHom.one_apply, one_mul], tsum_const, nsmul_eq_mul] rcases eq_or_ne n 0 with rfl | hn <;> simp [*, zero_cpow, (zero_lt_one.trans hs).ne', LSeries.term_of_ne_zero, cpow_neg, div_eq_mul_inv, Set.preimage, Set.coe_ofPred] /-- A number field `K` has infinitely many primes of degree one, that is, finite places `w` whose absolute norm `w.q` is a prime number. -/ lemma frequently_prime_q : βˆƒαΆ  w : FinPlace K in cofinite, w.q.Prime := by -- Otherwise the hypothesis of `HasPrimeDensity.re_le_re` for the constants `1` and `0` holds -- vacuously outside a finite set, and it gives `1 ≀ 0`. by_contra h_few have h_le := (hasPrimeDensity_const (K := K) 1).re_le_re (hasPrimeDensity_const 0) ((not_frequently.mp h_few).mono fun _ h_not h_prime ↦ (h_not h_prime).elim) norm_num at h_le /-- Let `L/K` be an extension of number fields and `c ∈ β„‚`. Consider the family that sends `v` to `c` times the number of places `w` of `L` above `v` whose residue field has the same cardinality `q_w = q_v`, that is, those of relative residue degree one. This family has density `c` over the primes of degree one of `K`: the sum of its values times `q_v ^ (-s)` over the `v` of prime norm is `c * log (1 / (s - 1))` plus a term bounded as `s ↓ 1`. -/ lemma hasPrimeDensity_card_degree_one (L : Type*) [Field L] [NumberField L] [Algebra K L] (c : β„‚) : HasPrimeDensity (fun v : FinPlace K ↦ c * {w : FinPlace L | w.below K = v ∧ w.q = v.q}.ncard) c := by -- The constant family `c` on the primes of `L` has mean `c`; group its series by the prime of -- `K` below. obtain ⟨x, hx, h_sum⟩ : HasPrimeDensity (fun _ : FinPlace L ↦ c) c := hasPrimeDensity_const c refine ⟨x, hx, h_sum.mono fun s hs ↦ ?_⟩ -- It remains to compare, for each `v`, the term of `v` with the sum over the primes above `v`. have h_fiber (v : FinPlace K) : ite v.q.Prime (c * {w : FinPlace L | w.below K = v ∧ w.q = v.q}.ncard) 0 * v.q ^ (-s : β„‚) = βˆ‘' w : (fun w : FinPlace L ↦ w.below K) ⁻¹' {v}, ite (w : FinPlace L).q.Prime c 0 * (w : FinPlace L).q ^ (-s : β„‚) := by set S : Set (FinPlace L) := {w : FinPlace L | w.below K = v ∧ w.q = v.q} have hS : S βŠ† (fun w : FinPlace L ↦ w.below K) ⁻¹' {v} := fun _ ⟨h_below, _⟩ ↦ h_below -- A prime `w` above `v` of prime norm lies in `S`, because `w.q` is a power of `v.q`. have h_prime (w : FinPlace L) (hw : w.below K = v) (hq : w.q.Prime) : w ∈ S := by subst hw obtain ⟨h_q_eq, -⟩ := hq.pow_eq_iff.mp ((Ideal.under (π“ž K) w.asIdeal).absNorm_pow_inertiaDeg w.asIdeal) exact ⟨rfl, h_q_eq.symm⟩ -- On `S` every term is the same, since `w.q = v.q` there. have h_term (w : S) : ite (w : FinPlace L).q.Prime c 0 * ((w : FinPlace L).q : β„‚) ^ (-s : β„‚) = ite v.q.Prime c 0 * (v.q : β„‚) ^ (-s : β„‚) := by obtain ⟨w, -, hw_q⟩ := w rw [hw_q] -- Only the `w ∈ S` contribute to the sum over the primes above `v`. have h_support : Function.support (fun w : (fun w : FinPlace L ↦ w.below K) ⁻¹' {v} ↦ ite (w : FinPlace L).q.Prime c 0 * ((w : FinPlace L).q : β„‚) ^ (-s : β„‚)) βŠ† Set.range (Set.inclusion hS) := fun w hw ↦ have hq : (w : FinPlace L).q.Prime := of_not_not fun hq ↦ by simp [hq] at hw ⟨⟨w, h_prime w w.property hq⟩, rfl⟩ calc ite v.q.Prime (c * S.ncard) 0 * (v.q : β„‚) ^ (-s : β„‚) = S.ncard β€’ (ite v.q.Prime c 0 * (v.q : β„‚) ^ (-s : β„‚)) := by by_cases hq : v.q.Prime <;> simp [hq, mul_left_comm, mul_assoc] _ = βˆ‘' w : S, ite (w : FinPlace L).q.Prime c 0 * ((w : FinPlace L).q : β„‚) ^ (-s : β„‚) := by rw [tsum_congr h_term, tsum_const, Nat.card_coe_set_eq] _ = _ := (Set.inclusion_injective hS).tsum_eq h_support exact (hs.tsum_fiberwise fun w : FinPlace L ↦ w.below K).congr_fun h_fiber end New end