/- Copyright (c) 2026 LANA Project. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: LANA Project -/ import Iut.Tower.Basic import Iut.Concrete.Invariants /-! # `βˆ‘_p log(d^K_p) = log(d_K)` The local different contributions `log(d^K_p) = βˆ‘_{v ∣ p} w_v d_v log p` of `Iut.InitialThetaData.logDK` sum, over any finite set of primes containing the residue characteristics of the places dividing the different, to the normalized degree `log(d_K) = log N(𝔑_{K/β„š})/[K : β„š]` of the different (`Iut.logDifferentDeg`): since `w_v d_v = (e_v f_v/[K : β„š])Β·(ord_v(𝔑)/e_v) = f_vΒ·ord_v(𝔑)/[K : β„š]`, the contribution of `p` is `βˆ‘_{v ∣ p} ord_v(𝔑)Β·f_vΒ·log p/[K : β„š]`, and `log N(𝔑) = βˆ‘_v ord_v(𝔑)Β·f_vΒ·log p_v` (`Iut.log_absNorm_eq_sum_ordAt`). -/ namespace Iut open NumberField IsDedekindDomain universe u namespace InitialThetaData variable (D : InitialThetaData.{u}) /-- The weight of a finite place of the fiber over `p` is `[K_v : β„š_p]/[K : β„š]`. -/ lemma weight_finite_eq {p : Nat.Primes} (w : LocalTheory.Fiber D.Kt (.finite p)) : LocalTheory.weight D.Kt (.finite p) w = placeWeight D.Kt (LocalTheory.fiberPlace D.Kt w) := by rcases w with ⟨w, hw⟩ rcases w with w | w Β· rfl Β· exact absurd hw (by simp [LocalTheory.toRational]) /-- The summand of `log(d^K_p)` at a place `v ∣ p` is `ord_v(𝔑)Β·f_vΒ·log p/[K : β„š]`. -/ lemma weight_mul_differentExponent (v : FinitePlace D.Kt) : placeWeight D.Kt v * differentExponent D.Kt v * Real.log (residueChar v) = (ordAt (differentIdeal β„€ (π“ž D.Kt)) v : ℝ) * (inertDeg D.Kt v * Real.log (residueChar v)) / Module.finrank β„š D.Kt := by unfold placeWeight differentExponent localDeg rw [← ordDifferent_eq_ordAt] have he : (ramIdx D.Kt v : ℝ) β‰  0 := by exact_mod_cast (ramIdx_pos' v).ne' have hn : (Module.finrank β„š D.Kt : ℝ) β‰  0 := by exact_mod_cast Module.finrank_pos.ne' push_cast field_simp /-- `log(d^K_p)` as a sum over any finite set of places containing the places over `p` dividing the different: `log(d^K_p) = βˆ‘_{v ∈ s, p_v = p} ord_v(𝔑)Β·f_vΒ·log p/[K : β„š]`. -/ lemma logDK_eq_sum_filter (p : β„•) (s : Finset (FinitePlace D.Kt)) (hs : βˆ€ w, ordAt (differentIdeal β„€ (π“ž D.Kt)) w β‰  0 β†’ w ∈ s) : D.logDK p = βˆ‘ w ∈ s.filter (fun w => residueChar w = p), (ordAt (differentIdeal β„€ (π“ž D.Kt)) w : ℝ) * (inertDeg D.Kt w * Real.log (residueChar w)) / Module.finrank β„š D.Kt := by classical unfold InitialThetaData.logDK split_ifs with hp Β· haveI := LocalTheory.fiber_finite D.Kt p haveI : Fintype {w : FinitePlace D.Kt // residueChar w = p} := Fintype.ofFinite _ set g : FinitePlace D.Kt β†’ ℝ := fun w => (ordAt (differentIdeal β„€ (π“ž D.Kt)) w : ℝ) * (inertDeg D.Kt w * Real.log (residueChar w)) / Module.finrank β„š D.Kt with hg have h1 : βˆ‘ v : LocalTheory.Fiber D.Kt (.finite ⟨p, hp⟩), LocalTheory.weight D.Kt _ v * differentExponent D.Kt (LocalTheory.fiberPlace D.Kt v) * Real.log p = βˆ‘ w : {w : FinitePlace D.Kt // residueChar w = p}, g w.1 := by refine Fintype.sum_equiv (LocalTheory.fiberFiniteEquiv D.Kt ⟨p, hp⟩) _ (fun w => g w.1) fun v => ?_ rw [weight_finite_eq] change placeWeight D.Kt (LocalTheory.fiberPlace D.Kt v) * differentExponent D.Kt (LocalTheory.fiberPlace D.Kt v) * Real.log (p : ℝ) = g (LocalTheory.fiberPlace D.Kt v) rw [show ((p : β„•) : ℝ) = residueChar (LocalTheory.fiberPlace D.Kt v) by rw [LocalTheory.residueChar_fiberPlace D.Kt v], hg] exact D.weight_mul_differentExponent _ rw [h1] -- the sum over the subtype is the sum over the filtered set have h2 : βˆ‘ w : {w : FinitePlace D.Kt // residueChar w = p}, g w.1 = βˆ‘ w ∈ (Finset.univ : Finset {w : FinitePlace D.Kt // residueChar w = p}).map (Function.Embedding.subtype _), g w := by rw [Finset.sum_map] rfl rw [h2] symm refine Finset.sum_subset ?_ ?_ Β· intro w hw rw [Finset.mem_filter] at hw rw [Finset.mem_map] exact ⟨⟨w, hw.2⟩, Finset.mem_univ _, rfl⟩ Β· intro w hwβ‚‚ hw rw [Finset.mem_map] at hwβ‚‚ obtain ⟨⟨w', hw'⟩, -, rfl⟩ := hwβ‚‚ rw [Finset.mem_filter, not_and] at hw have hws : w' βˆ‰ s := fun h => hw h hw' have : ordAt (differentIdeal β„€ (π“ž D.Kt)) w' = 0 := by by_contra h exact hws (hs w' h) simp [this] Β· symm refine Finset.sum_eq_zero fun w hw => ?_ rw [Finset.mem_filter] at hw exact absurd (hw.2 β–Έ Iut.residueChar_prime w) hp /-- **`βˆ‘_p log(d^K_p) = log(d_K)`** over any finite set of primes containing the residue characteristics of the places dividing the different. -/ theorem sum_logDK_eq (S : Finset β„•) (hS : βˆ€ w : FinitePlace D.Kt, ordAt (differentIdeal β„€ (π“ž D.Kt)) w β‰  0 β†’ residueChar w ∈ S) : βˆ‘ p ∈ S, D.logDK p = logDifferentDeg D.Kt := by classical set s := (ordAt_support_finite (differentIdeal β„€ (π“ž D.Kt))).toFinset with hs_def have hs : βˆ€ w, ordAt (differentIdeal β„€ (π“ž D.Kt)) w β‰  0 β†’ w ∈ s := fun w hw => (Set.Finite.mem_toFinset _).mpr hw simp_rw [D.logDK_eq_sum_filter _ s hs] rw [Finset.sum_fiberwise_of_maps_to (s := s) (t := S) (g := residueChar) (fun w (hw : w ∈ s) => hS w ((Set.Finite.mem_toFinset _).mp hw))] unfold logDifferentDeg rw [log_absNorm_eq_sum_ordAt _ differentIdeal_ne_bot s hs, Finset.sum_div] /-- **`βˆ‘_{p ∈ V_β„š^dst} log(d^K_p) = log(d_K)`**: the distinguished primes contain the residue characteristics of the ramified places, hence of the places dividing the different. -/ theorem sum_dst_logDK_eq : βˆ‘ p ∈ D.dst, D.logDK p = logDifferentDeg D.Kt := D.sum_logDK_eq D.dst fun w hw => D.mem_dst_of_ramified w fun h1 => hw (by rw [← ordDifferent_eq_ordAt]; exact LocalTheory.ordDifferent_eq_zero D.Kt w h1) end InitialThetaData end Iut