module import Mathlib.Algebra.Order.Archimedean.Real.Hom import TauCeti.NumberTheory.NumberField.Global.Ideles.FiniteOpenSubgroup public import Mathlib.NumberTheory.NumberField.ClassNumber import Mathlib.Topology.MetricSpace.Ultra.TotallySeparated import TauCeti.RingTheory.DedekindDomain.FiniteAdeleRing.Topology import TauCeti.Topology.Algebra.Group.Units import TauCeti.RingTheory.DedekindDomain.FiniteAdeleRing.IntegralIdeal public import Lib.General.Measure.HaarModulus public import Lib.Adelic.Adeles.Basic public import Lib.General.Topology import Lib.General.Groups.ProfiniteCharacters import TauCeti.RingTheory.DedekindDomain.FiniteAdeleRing.LocalUnits /-! # Finite ideles, principal ideles and the class group; finite index of open subgroups The finite ideles of a number field `K` are the units `(𝔸f K)ˣ` of the finite adeles. They embed in the units of the adeles `New.𝔸 K`, the pairs of a map `NumberField.InfinitePlace K → ℂ` and a finite adele, with component `1` at the infinite places. `New.FinPlace K` is the set of finite places, and `New.LocField v` is the completion at `v`. The file defines principal, local and S-unit ideles and proves their basic properties. It then relates the finite ideles to fractional ideals and the class group, and deduces that every open subgroup containing the totally positive elements of `Kˣ` has finite index. ## Main definitions and results * `New.principalIdele`, `New.locIdele`, `New.ideleAt`: the principal idele of an element of `Kˣ`, the idele with one given component and `1` elsewhere, and the component at a place. * `New.idelesUnitOff`: the ideles that are units outside `S`; open (`New.isOpen_idelesUnitOff`), and compact for `S = ∅` (`New.isCompact_idelesUnitOff_empty`). * `New.ideleDivisor`: the canonical fractional ideal of a finite idele. `New.ideleDivisor_le_one_iff` characterises integrality, `New.ker_ideleDivisor` identifies the everywhere-integral units, and `New.ideleDivisor_uniformizer` gives the divisor of a local uniformiser. * `New.ker_finIdeleClassGroup`: the kernel of the class group map, given by `Kˣ` times these units. * `New.exists_sup_idelesUnitOff_eq_top`: for a suitable finite `S`, every idele is a principal idele times a unit outside `S`. * `New.finiteIndex_idele_subgroup_of_isOpen`: an open subgroup that contains the totally positive elements of `Kˣ` has finite index. Notions from other files: * `New.Ô K`: the integral finite adeles, whose component at every place lies in its ring of integers; `New.uniformizer w` is a chosen uniformiser of the completion at `w`. * `S.unit K` (Mathlib): the `S`-units, the `x` in `Kˣ` of valuation `1` at every finite place outside `S`. ## Relation to the literature Known; see `Lib.ClassField.Places.LocalFields` for sources. -/ @[expose] public section noncomputable section /-! ## Finite ideles: principal and local ideles, S-unit ideles, positivity `New.mem_of_locIdele_mem` uses `New.exists_finset_cover_mulSupport_ideleAt`, which follows from the compactness of `New.idelesUnitOff ∅`. `New.eventually_unramified` follows from Tau Ceti's `IsDedekindDomain.FiniteAdeleRing.eventually_unitsOfAdicCompletion_mem_of_isOpen`. -/ section Ideles open IsDedekindDomain Set Units FiniteAdeleRing namespace New variable {K : Type*} [Field K] [NumberField K] /-! ### Principal ideles, local ideles, components and ideles that are units outside `S` -/ /-- The diagonal homomorphism from K^× to the finite ideles of K. -/ abbrev principalIdele : Kˣ →* (𝔸f K)ˣ := map (algebraMap K (𝔸f K)).toMonoidHom variable (S : Set (FinPlace K)) (a : (𝔸f K)ˣ) (v : FinPlace K) /-- The homomorphism sending x ∈ K_v^× to the finite idele with component x at v and 1 elsewhere. -/ def locIdele : (LocField v)ˣ →* (𝔸f K)ˣ := unitsMapNonUnital (singleAdele v) /-- The homomorphism from the finite ideles of K to the units of `New.𝔸 K` sending a to (1, a), with component 1 at every infinite place. -/ abbrev finIdeleIncl : (𝔸f K)ˣ →* (𝔸 K)ˣ := map (MonoidHom.inr (NumberField.InfinitePlace K → ℂ) (𝔸f K)) /-- For a finite place v, the homomorphism from K_v^× to the units of `New.𝔸 K` placing the element at v and 1 at all other places, finite and infinite. -/ def locFullIdele : (LocField v)ˣ →* (𝔸 K)ˣ := finIdeleIncl.comp (unitsMapNonUnital (singleAdele v)) /-- The homomorphism sending a finite idele to its component in K_v^×. -/ def ideleAt : (𝔸f K)ˣ →* (LocField v)ˣ := map (evalAt v).toMonoidHom /-- The group of finite ideles of K whose components at all places outside S are units. -/ def idelesUnitOff : Subgroup (𝔸f K)ˣ := ⨅ v ∉ S, ((map Valued.v.toMonoidHom).comp (ideleAt v)).ker @[simp] lemma locIdele_apply_self (x : (LocField v)ˣ) : (locIdele v x).val v = x := by simp [locIdele] @[simp] lemma ideleAt_locIdele (x : (LocField v)ˣ) : ideleAt v (locIdele v x) = x := ext (locIdele_apply_self v x) @[fun_prop] lemma continuous_ideleAt : Continuous (ideleAt v) := (continuous_evalAt v).units_map /-! ### First properties: membership, openness and compactness -/ /-- A finite idele `a` is a unit at all but finitely many places. -/ lemma finite_setOf_valued_val_ne_one : {v : FinPlace K | Valued.v (a.val v) ≠ 1}.Finite := unitsEquiv_finite_valued_eq_one a private lemma idelesUnitOff_eq_sIntegralUnits : idelesUnitOff S = sIntegralUnits (NumberField.RingOfIntegers K) K S := by ext a simp [idelesUnitOff, ← val_inj, ideleAt] /-- The ideles that are units at every place are the units of the ring of integral adeles. -/ lemma idelesUnitOff_empty : idelesUnitOff ∅ = (Ô K).units := by rw [idelesUnitOff_eq_sIntegralUnits, sIntegralUnits_empty] exact integralUnits_eq_units_integralAdeles (NumberField.RingOfIntegers K) K lemma isOpen_idelesUnitOff : (idelesUnitOff S).IsOpen := by rw [idelesUnitOff_eq_sIntegralUnits] exact TauCeti.isOpen_sIntegralUnits (NumberField.RingOfIntegers K) K S variable {S a v} {w : FinPlace K} @[simp] lemma locIdele_apply_of_ne (h_ne : w ≠ v) (x : (LocField v)ˣ) : (locIdele v x).val w = 1 := by simp_all [locIdele] @[simp] lemma ideleAt_locIdele_of_ne (h_ne : w ≠ v) (x : (LocField v)ˣ) : ideleAt w (locIdele v x) = 1 := ext (locIdele_apply_of_ne h_ne x) /-- The library construction of a local idele has the same components as `locIdele`. -/ private lemma unitsOfAdicCompletion_eq_locIdele (v : FinPlace K) (x : (LocField v)ˣ) : unitsOfAdicCompletion K v x = locIdele v x := by apply Units.ext ext w by_cases hw : w = v · subst w simp · simp [hw] /-- The product of ideles supported at individual places has the prescribed component on the finite set of places, and component one outside it. -/ lemma ideleAt_prod_locIdele [DecidableEq (FinPlace K)] (T : Finset (FinPlace K)) (x : ∀ u : FinPlace K, (LocField u)ˣ) : ideleAt w (∏ u ∈ T, locIdele u (x u)) = if w ∈ T then x w else 1 := by rw [map_prod, Finset.prod_eq_ite _ fun u _ hu ↦ ideleAt_locIdele_of_ne hu.symm _] simp @[simp] lemma mem_idelesUnitOff : a ∈ idelesUnitOff S ↔ ∀ v : FinPlace K, v ∉ S → Valued.v (a.val v) = 1 := by rw [idelesUnitOff_eq_sIntegralUnits, mem_sIntegralUnits_iff] /-- Two finite ideles have the same valuations outside `S` exactly when their quotient is a unit outside `S`. -/ lemma div_mem_idelesUnitOff_iff {b : (𝔸f K)ˣ} : a / b ∈ idelesUnitOff S ↔ ∀ w : FinPlace K, w ∉ S → Valued.v (a.val w) = Valued.v (b.val w) := by rw [mem_idelesUnitOff] refine forall₂_congr fun w _ ↦ ?_ change Valued.v (↑(ideleAt w (a / b)) : LocField w) = 1 ↔ Valued.v (↑(ideleAt w a) : LocField w) = Valued.v (↑(ideleAt w b) : LocField w) rw [map_div, Units.val_div_eq_div_val, map_div₀] exact div_eq_one_iff_eq (by simp) lemma idelesUnitOff_mono {T : Set (FinPlace K)} (h_sub : S ⊆ T) : idelesUnitOff S ≤ idelesUnitOff T := biInf_mono fun _ hv ↦ Set.notMem_subset h_sub hv lemma isCompact_idelesUnitOff_empty : IsCompact (idelesUnitOff (K := K) ∅ : Set (𝔸f K)ˣ) := by rw [idelesUnitOff_empty] exact (Ô K).units_isCompact isCompact_Ô /-- The principal idele of `x` is a unit outside `S` exactly when `x` is an `S`-unit. -/ lemma principalIdele_mem_idelesUnitOff {x : Kˣ} : principalIdele x ∈ idelesUnitOff S ↔ x ∈ S.unit K := by aesop /-! ### Approximating an idele by finitely many components -/ /-- For an open neighbourhood `U` of `1` there is a finite set `T` of places such that an idele that is a unit everywhere and lies outside `U` has a component `≠ 1` at some place of `T`. Equivalently, the ideles that are units everywhere and `1` on `T` lie in `U`. -/ lemma exists_finset_cover_mulSupport_ideleAt {U : Set (𝔸f K)ˣ} (hU : IsOpen U) (h_one : 1 ∈ U) : ∃ T : Finset (FinPlace K), (idelesUnitOff ∅).carrier \ U ⊆ ⋃ v ∈ T, (ideleAt v).ker.carrierᶜ := by -- the complement of `U` in the units is compact and avoids `1`, so finitely many of the open -- sets `{a | ideleAt v a ≠ 1}` cover it refine (isCompact_idelesUnitOff_empty.diff hU).elim_finite_subcover _ (fun v ↦ (continuous_ideleAt v).isOpen_mulSupport) fun a ⟨_, ha_notMem⟩ ↦ ?_ have ha_ne : a ≠ 1 := (ne_of_mem_of_not_mem h_one ha_notMem).symm simpa [ideleAt, ← val_inj, DFunLike.ext_iff] using ha_ne /-- A closed subgroup H of the finite ideles contains a as soon as it contains, for every place v, the idele with component a_v at v and 1 elsewhere. -/ lemma mem_of_locIdele_mem {H : Subgroup (𝔸f K)ˣ} (hH : IsClosed H.carrier) (ha : ∀ v : FinPlace K, locIdele v (ideleAt v a) ∈ H) : a ∈ H := by classical -- If `a ∉ H`, the set `a⁻¹ Hᶜ` is an open neighbourhood of `1`. It contains `a⁻¹ b`, where -- `b ∈ H` is the product of the components of `a` at enough places; this says `b ∉ H`. by_contra ha_notMem -- An idele that is a unit everywhere and `1` at the places of `T` lies in `a⁻¹ Hᶜ`. obtain ⟨T, hT⟩ : ∃ T : Finset (FinPlace K), (idelesUnitOff ∅).carrier \ (fun x ↦ a⁻¹ * x) '' H.carrierᶜ ⊆ ⋃ v ∈ T, (⇑(ideleAt v)).mulSupport := exists_finset_cover_mulSupport_ideleAt (isOpenMap_mul_left a⁻¹ _ hH.isOpen_compl) ⟨a, ha_notMem, inv_mul_cancel a⟩ -- Enlarge `T` by the places where `a` is not a unit. set T' : Finset (FinPlace K) := T ∪ (finite_setOf_valued_val_ne_one a).toFinset with hT' set b : (𝔸f K)ˣ := ∏ v ∈ T', locIdele v (ideleAt v a) with hb have hb_mem : b ∈ H := prod_mem fun v _ ↦ ha v have hb_at (w : FinPlace K) : ideleAt w b = if w ∈ T' then ideleAt w a else 1 := ideleAt_prod_locIdele T' fun v ↦ ideleAt v a -- `a⁻¹ b` is `1` on `T'` and equals `a⁻¹`, a unit, elsewhere. have h_unit : a⁻¹ * b ∈ idelesUnitOff ∅ := by aesop (add simp [idelesUnitOff, hb_at, hT']) have h_notMem : a⁻¹ * b ∉ (fun x ↦ a⁻¹ * x) '' H.carrierᶜ := by simpa using hb_mem obtain ⟨v, hv, hv_ne⟩ : ∃ v ∈ T, ideleAt v (a⁻¹ * b) ≠ 1 := by simpa using hT ⟨h_unit, h_notMem⟩ have h_one : ideleAt v (a⁻¹ * b) = 1 := by simp [hb_at, hT', hv] exact hv_ne h_one /-- The idele with component `x` at `v` and `1` elsewhere is a unit outside any `S` when `x` is a unit of the integers at `v`. -/ lemma locIdele_mem_idelesUnitOff {x : (LocField v)ˣ} (hx_unit : Valued.v x.val = 1) {S : Set (FinPlace K)} : locIdele v x ∈ idelesUnitOff S := by simp_all [← and_forall_ne v] /-- A homomorphism ψ with open kernel from the finite ideles of K to a commutative group is trivial on the local units at all but finitely many finite places. -/ lemma eventually_unramified {C : Type*} [CommGroup C] (ψ : (𝔸f K)ˣ →* C) (h_open : ψ.ker.IsOpen) : ∀ᶠ v : FinPlace K in Filter.cofinite, ∀ x : (LocField v)ˣ, Valued.v x.val = 1 → ψ (locIdele v x) = 1 := by -- The open kernel contains the local units at almost every place. simpa only [unitsOfAdicCompletion_eq_locIdele, MonoidHom.mem_ker] using eventually_unitsOfAdicCompletion_mem_of_isOpen (H := ψ.ker) h_open /-! ### Totally positive elements -/ /-- An element x of K is totally positive if φ(x) > 0 for every ring homomorphism φ : K → ℝ. -/ def IsTotallyPositive (x : K) : Prop := ∀ φ : K →+* ℝ, 0 < φ x end New end Ideles /-! ## Ideles, fractional ideals and the class group Here `v` is `Valued.v`, the multiplicative valuation of a completion, so the order of an element at a place is `-log (v _)`. -/ section IdeleClasses open NumberField IsDedekindDomain FractionalIdeal WithZero Subgroup ClassGroup HeightOneSpectrum Function Units FiniteAdeleRing Valued namespace New variable {K : Type*} [Field K] [NumberField K] {R S : Set (FinPlace K)} attribute [-simp] WithZero.inv_exp attribute [local simp] WithZero.exp_neg /-- The fractional ideal of a finite idele. -/ @[no_expose] def ideleDivisor : (𝔸f K)ˣ →* (FractionalIdeal (nonZeroDivisors (𝓞 K)) K)ˣ := toFractionalIdeal /-- A finite idele has integral divisor exactly when it is integral at every place. -/ lemma ideleDivisor_le_one_iff (x : (𝔸f K)ˣ) : (ideleDivisor x).val ≤ 1 ↔ x.val ∈ Ô K := toFractionalIdeal_le_one_iff x /-- The divisor map has kernel the everywhere-integral units. -/ lemma ker_ideleDivisor : (ideleDivisor (K := K)).ker = idelesUnitOff ∅ := by rw [ideleDivisor, ker_toFractionalIdeal, integralUnits_eq_units_integralAdeles, idelesUnitOff_empty] rfl /-- A local uniformiser has divisor the corresponding prime ideal. -/ lemma ideleDivisor_uniformizer (w : FinPlace K) : ideleDivisor (locIdele w (uniformizer w)) = FractionalIdeal.mk0 K ⟨w.asIdeal, mem_nonZeroDivisors_of_ne_zero w.ne_bot⟩ := by rw [ideleDivisor, ← unitsOfAdicCompletion_eq_locIdele, toFractionalIdeal_unitsOfAdicCompletion_of_valued_eq_exp_neg_one w (v_uniformizer w)] exact Units.ext (HeightOneSpectrum.coe_unitOfPrime w K) /-- The ideal class attached to a finite idele. -/ @[no_expose] def finIdeleClassGroup : (𝔸f K)ˣ →* ClassGroup (𝓞 K) := toClassGroup (𝓞 K) K /-- The kernel of the finite-idele class group map is generated by the principal ideles and the everywhere-integral units. -/ lemma ker_finIdeleClassGroup : (finIdeleClassGroup (K := K)).ker = principalIdele.range ⊔ idelesUnitOff ∅ := by rw [finIdeleClassGroup, ker_toClassGroup, integralUnits_eq_units_integralAdeles, idelesUnitOff_empty, sup_comm] rfl /-- For every finite idele a of K, the power a^h, with h the class number of K, is a principal idele times an idele that is a unit at every prime. -/ lemma pow_classNumber_mem_principal_sup (a : (𝔸f K)ˣ) : a ^ classNumber K ∈ principalIdele.range ⊔ idelesUnitOff ∅ := by -- The class of `a` has order dividing the class number. rw [← ker_finIdeleClassGroup, MonoidHom.mem_ker, map_pow] exact pow_card_eq_one /-- For finite sets `R`, `R'` of finite places there is a finite set `T` that contains `R`, meets `R'` only inside `R`, and is such that every finite idele is a principal idele times an idele that is a unit outside `T`. -/ lemma exists_sup_idelesUnitOff_eq_top (hR : R.Finite) (R' : Set (FinPlace K)) (hR' : R'.Finite) : ∃ T : Set (FinPlace K), T.Finite ∧ R ⊆ T ∧ (∀ v ∈ R', v ∈ T → v ∈ R) ∧ principalIdele.range ⊔ idelesUnitOff T = ⊤ := by obtain ⟨T, hT, hRT, hTR', h_sup⟩ := exists_finite_sIntegralUnits_sup_range_unitEmbedding_eq_top K hR hR' refine ⟨T, hT, hRT, fun v hvR' hvT ↦ hTR' ⟨hvT, hvR'⟩, ?_⟩ rw [idelesUnitOff_eq_sIntegralUnits, sup_comm] exact h_sup /-- Every finite set of places `R` lies in a finite set `S` such that every finite idele is a principal idele times an idele that is a unit outside `S`. -/ lemma exists_superset_sup_idelesUnitOff_eq_top (hR : R.Finite) : ∃ S : Set (FinPlace K), S.Finite ∧ R ⊆ S ∧ principalIdele.range ⊔ idelesUnitOff S = ⊤ := by obtain ⟨S, hS, hRS, -, h_sup⟩ := exists_sup_idelesUnitOff_eq_top hR ∅ Set.finite_empty exact ⟨S, hS, hRS, h_sup⟩ /-- An open subgroup `H` of the finite ideles that contains the principal ideles of the totally positive elements of `Kˣ` has finite index. -/ lemma finiteIndex_idele_subgroup_of_isOpen (H : Subgroup (𝔸f K)ˣ) (h_open : H.IsOpen) (h_pos : ∀ x : Kˣ, IsTotallyPositive x.val → principalIdele x ∈ H) : H.FiniteIndex := by refine NumberField.finiteIndex_of_isOpen_of_totallyPositiveUnits_le h_open fun x hx ↦ ?_ apply h_pos x intro φ -- The image under the real embedding is positive at the standard real place of `ℝ`. have hw : (InfinitePlace.mk Complex.ofRealHom).IsReal := InfinitePlace.isReal_mk_iff.mpr (by ext t; simp) have h_positive := (NumberField.mem_totallyPositiveUnits.mp hx).map φ simpa only [Real.ringHom_apply] using NumberField.isTotallyPositive_iff.mp h_positive _ hw /-- The finite ideles form a nonarchimedean group: they have the compact open subgroup `idelesUnitOff ∅`. -/ instance : NonarchimedeanGroup (𝔸f K)ˣ := -- The open subgroup `idelesUnitOff ∅` is compact and totally disconnected, hence nonarchimedean. -- The ideles map continuously and injectively to the product of the completions, which is -- totally disconnected. have h_inj : Function.Injective fun (a : (𝔸f K)ˣ) (w : FinPlace K) ↦ a.val w := by aesop_cat have h_disconnected : TotallyDisconnectedSpace (𝔸f K)ˣ := ⟨fun s _ h ↦ s.subsingleton_of_image h_inj (h.image (fun a w ↦ a.val w) (by fun_prop)).subsingleton⟩ have h_compact : CompactSpace (idelesUnitOff (∅ : Set (FinPlace K))) := isCompact_iff_compactSpace.mp isCompact_idelesUnitOff_empty .nonarchimedean_of_emb (idelesUnitOff ∅).subtype (isOpen_idelesUnitOff ∅).isOpenEmbedding_subtypeVal end New end IdeleClasses end