path
stringlengths
11
71
content
stringlengths
75
124k
Topology\Algebra\Field.lean
/- Copyright (c) 2021 Patrick Massot. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison -/ import Mathlib.Algebra.Field.Subfield import Mathlib.Algebra.GroupWithZero.Divisibility import Mathlib.Topology.Algebra.GroupWithZero import Mathlib.Topology.Algebra.Ring.Basic import Mathlib.Topology.Order.LocalExtr /-! # Topological fields A topological division ring is a topological ring whose inversion function is continuous at every non-zero element. -/ variable {K : Type*} [DivisionRing K] [TopologicalSpace K] /-- Left-multiplication by a nonzero element of a topological division ring is proper, i.e., inverse images of compact sets are compact. -/ theorem Filter.tendsto_cocompact_mul_left₀ [ContinuousMul K] {a : K} (ha : a ≠ 0) : Filter.Tendsto (fun x : K => a * x) (Filter.cocompact K) (Filter.cocompact K) := Filter.tendsto_cocompact_mul_left (inv_mul_cancel ha) /-- Right-multiplication by a nonzero element of a topological division ring is proper, i.e., inverse images of compact sets are compact. -/ theorem Filter.tendsto_cocompact_mul_right₀ [ContinuousMul K] {a : K} (ha : a ≠ 0) : Filter.Tendsto (fun x : K => x * a) (Filter.cocompact K) (Filter.cocompact K) := Filter.tendsto_cocompact_mul_right (mul_inv_cancel ha) variable (K) /-- A topological division ring is a division ring with a topology where all operations are continuous, including inversion. -/ class TopologicalDivisionRing extends TopologicalRing K, HasContinuousInv₀ K : Prop section Subfield variable {α : Type*} [Field α] [TopologicalSpace α] [TopologicalDivisionRing α] /-- The (topological-space) closure of a subfield of a topological field is itself a subfield. -/ def Subfield.topologicalClosure (K : Subfield α) : Subfield α := { K.toSubring.topologicalClosure with carrier := _root_.closure (K : Set α) inv_mem' := fun x hx => by dsimp only at hx ⊢ rcases eq_or_ne x 0 with (rfl | h) · rwa [inv_zero] · -- Porting note (#11215): TODO: Lean fails to find InvMemClass instance rw [← @inv_coe_set α (Subfield α) _ _ SubfieldClass.toInvMemClass K, ← Set.image_inv] exact mem_closure_image (continuousAt_inv₀ h) hx } theorem Subfield.le_topologicalClosure (s : Subfield α) : s ≤ s.topologicalClosure := _root_.subset_closure theorem Subfield.isClosed_topologicalClosure (s : Subfield α) : IsClosed (s.topologicalClosure : Set α) := isClosed_closure theorem Subfield.topologicalClosure_minimal (s : Subfield α) {t : Subfield α} (h : s ≤ t) (ht : IsClosed (t : Set α)) : s.topologicalClosure ≤ t := closure_minimal h ht end Subfield section affineHomeomorph /-! This section is about affine homeomorphisms from a topological field `𝕜` to itself. Technically it does not require `𝕜` to be a topological field, a topological ring that happens to be a field is enough. -/ variable {𝕜 : Type*} [Field 𝕜] [TopologicalSpace 𝕜] [TopologicalRing 𝕜] /-- The map `fun x => a * x + b`, as a homeomorphism from `𝕜` (a topological field) to itself, when `a ≠ 0`. -/ @[simps] def affineHomeomorph (a b : 𝕜) (h : a ≠ 0) : 𝕜 ≃ₜ 𝕜 where toFun x := a * x + b invFun y := (y - b) / a left_inv x := by simp only [add_sub_cancel_right] exact mul_div_cancel_left₀ x h right_inv y := by simp [mul_div_cancel₀ _ h] end affineHomeomorph section LocalExtr variable {α β : Type*} [TopologicalSpace α] [LinearOrderedSemifield β] {a : α} open Topology theorem IsLocalMin.inv {f : α → β} {a : α} (h1 : IsLocalMin f a) (h2 : ∀ᶠ z in 𝓝 a, 0 < f z) : IsLocalMax f⁻¹ a := by filter_upwards [h1, h2] with z h3 h4 using(inv_le_inv h4 h2.self_of_nhds).mpr h3 end LocalExtr section Preconnected /-! Some results about functions on preconnected sets valued in a ring or field with a topology. -/ open Set variable {α 𝕜 : Type*} {f g : α → 𝕜} {S : Set α} [TopologicalSpace α] [TopologicalSpace 𝕜] [T1Space 𝕜] /-- If `f` is a function `α → 𝕜` which is continuous on a preconnected set `S`, and `f ^ 2 = 1` on `S`, then either `f = 1` on `S`, or `f = -1` on `S`. -/ theorem IsPreconnected.eq_one_or_eq_neg_one_of_sq_eq [Ring 𝕜] [NoZeroDivisors 𝕜] (hS : IsPreconnected S) (hf : ContinuousOn f S) (hsq : EqOn (f ^ 2) 1 S) : EqOn f 1 S ∨ EqOn f (-1) S := by have : DiscreteTopology ({1, -1} : Set 𝕜) := Finite.instDiscreteTopology have hmaps : MapsTo f S {1, -1} := by simpa only [EqOn, Pi.one_apply, Pi.pow_apply, sq_eq_one_iff] using hsq simpa using hS.eqOn_const_of_mapsTo hf hmaps /-- If `f, g` are functions `α → 𝕜`, both continuous on a preconnected set `S`, with `f ^ 2 = g ^ 2` on `S`, and `g z ≠ 0` all `z ∈ S`, then either `f = g` or `f = -g` on `S`. -/ theorem IsPreconnected.eq_or_eq_neg_of_sq_eq [Field 𝕜] [HasContinuousInv₀ 𝕜] [ContinuousMul 𝕜] (hS : IsPreconnected S) (hf : ContinuousOn f S) (hg : ContinuousOn g S) (hsq : EqOn (f ^ 2) (g ^ 2) S) (hg_ne : ∀ {x : α}, x ∈ S → g x ≠ 0) : EqOn f g S ∨ EqOn f (-g) S := by have hsq : EqOn ((f / g) ^ 2) 1 S := fun x hx => by simpa [div_eq_one_iff_eq (pow_ne_zero _ (hg_ne hx))] using hsq hx simpa (config := { contextual := true }) [EqOn, div_eq_iff (hg_ne _)] using hS.eq_one_or_eq_neg_one_of_sq_eq (hf.div hg fun z => hg_ne) hsq /-- If `f, g` are functions `α → 𝕜`, both continuous on a preconnected set `S`, with `f ^ 2 = g ^ 2` on `S`, and `g z ≠ 0` all `z ∈ S`, then as soon as `f = g` holds at one point of `S` it holds for all points. -/ theorem IsPreconnected.eq_of_sq_eq [Field 𝕜] [HasContinuousInv₀ 𝕜] [ContinuousMul 𝕜] (hS : IsPreconnected S) (hf : ContinuousOn f S) (hg : ContinuousOn g S) (hsq : EqOn (f ^ 2) (g ^ 2) S) (hg_ne : ∀ {x : α}, x ∈ S → g x ≠ 0) {y : α} (hy : y ∈ S) (hy' : f y = g y) : EqOn f g S := fun x hx => by rcases hS.eq_or_eq_neg_of_sq_eq hf hg @hsq @hg_ne with (h | h) · exact h hx · rw [h _, Pi.neg_apply, neg_eq_iff_add_eq_zero, ← two_mul, mul_eq_zero, iff_false_iff.2 (hg_ne _)] at hy' ⊢ <;> assumption end Preconnected
Topology\Algebra\FilterBasis.lean
/- Copyright (c) 2021 Patrick Massot. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot -/ import Mathlib.Order.Filter.Bases import Mathlib.Topology.Algebra.Module.Basic /-! # Group and ring filter bases A `GroupFilterBasis` is a `FilterBasis` on a group with some properties relating the basis to the group structure. The main theorem is that a `GroupFilterBasis` on a group gives a topology on the group which makes it into a topological group with neighborhoods of the neutral element generated by the given basis. ## Main definitions and results Given a group `G` and a ring `R`: * `GroupFilterBasis G`: the type of filter bases that will become neighborhood of `1` for a topology on `G` compatible with the group structure * `GroupFilterBasis.topology`: the associated topology * `GroupFilterBasis.isTopologicalGroup`: the compatibility between the above topology and the group structure * `RingFilterBasis R`: the type of filter bases that will become neighborhood of `0` for a topology on `R` compatible with the ring structure * `RingFilterBasis.topology`: the associated topology * `RingFilterBasis.isTopologicalRing`: the compatibility between the above topology and the ring structure ## References * [N. Bourbaki, *General Topology*][bourbaki1966] -/ open Filter Set TopologicalSpace Function open Topology Filter Pointwise universe u /-- A `GroupFilterBasis` on a group is a `FilterBasis` satisfying some additional axioms. Example : if `G` is a topological group then the neighbourhoods of the identity are a `GroupFilterBasis`. Conversely given a `GroupFilterBasis` one can define a topology compatible with the group structure on `G`. -/ class GroupFilterBasis (G : Type u) [Group G] extends FilterBasis G where one' : ∀ {U}, U ∈ sets → (1 : G) ∈ U mul' : ∀ {U}, U ∈ sets → ∃ V ∈ sets, V * V ⊆ U inv' : ∀ {U}, U ∈ sets → ∃ V ∈ sets, V ⊆ (fun x ↦ x⁻¹) ⁻¹' U conj' : ∀ x₀, ∀ {U}, U ∈ sets → ∃ V ∈ sets, V ⊆ (fun x ↦ x₀ * x * x₀⁻¹) ⁻¹' U /-- An `AddGroupFilterBasis` on an additive group is a `FilterBasis` satisfying some additional axioms. Example : if `G` is a topological group then the neighbourhoods of the identity are an `AddGroupFilterBasis`. Conversely given an `AddGroupFilterBasis` one can define a topology compatible with the group structure on `G`. -/ class AddGroupFilterBasis (A : Type u) [AddGroup A] extends FilterBasis A where zero' : ∀ {U}, U ∈ sets → (0 : A) ∈ U add' : ∀ {U}, U ∈ sets → ∃ V ∈ sets, V + V ⊆ U neg' : ∀ {U}, U ∈ sets → ∃ V ∈ sets, V ⊆ (fun x ↦ -x) ⁻¹' U conj' : ∀ x₀, ∀ {U}, U ∈ sets → ∃ V ∈ sets, V ⊆ (fun x ↦ x₀ + x + -x₀) ⁻¹' U attribute [to_additive existing] GroupFilterBasis GroupFilterBasis.conj' GroupFilterBasis.toFilterBasis /-- `GroupFilterBasis` constructor in the commutative group case. -/ @[to_additive "`AddGroupFilterBasis` constructor in the additive commutative group case."] def groupFilterBasisOfComm {G : Type*} [CommGroup G] (sets : Set (Set G)) (nonempty : sets.Nonempty) (inter_sets : ∀ x y, x ∈ sets → y ∈ sets → ∃ z ∈ sets, z ⊆ x ∩ y) (one : ∀ U ∈ sets, (1 : G) ∈ U) (mul : ∀ U ∈ sets, ∃ V ∈ sets, V * V ⊆ U) (inv : ∀ U ∈ sets, ∃ V ∈ sets, V ⊆ (fun x ↦ x⁻¹) ⁻¹' U) : GroupFilterBasis G := { sets := sets nonempty := nonempty inter_sets := inter_sets _ _ one' := one _ mul' := mul _ inv' := inv _ conj' := fun x U U_in ↦ ⟨U, U_in, by simp only [mul_inv_cancel_comm, preimage_id']; rfl⟩ } namespace GroupFilterBasis variable {G : Type u} [Group G] {B : GroupFilterBasis G} @[to_additive] instance : Membership (Set G) (GroupFilterBasis G) := ⟨fun s f ↦ s ∈ f.sets⟩ @[to_additive] theorem one {U : Set G} : U ∈ B → (1 : G) ∈ U := GroupFilterBasis.one' @[to_additive] theorem mul {U : Set G} : U ∈ B → ∃ V ∈ B, V * V ⊆ U := GroupFilterBasis.mul' @[to_additive] theorem inv {U : Set G} : U ∈ B → ∃ V ∈ B, V ⊆ (fun x ↦ x⁻¹) ⁻¹' U := GroupFilterBasis.inv' @[to_additive] theorem conj : ∀ x₀, ∀ {U}, U ∈ B → ∃ V ∈ B, V ⊆ (fun x ↦ x₀ * x * x₀⁻¹) ⁻¹' U := GroupFilterBasis.conj' /-- The trivial group filter basis consists of `{1}` only. The associated topology is discrete. -/ @[to_additive "The trivial additive group filter basis consists of `{0}` only. The associated topology is discrete."] instance : Inhabited (GroupFilterBasis G) where default := { sets := {{1}} nonempty := singleton_nonempty _ inter_sets := by simp one' := by simp mul' := by simp inv' := by simp conj' := by simp } @[to_additive] theorem subset_mul_self (B : GroupFilterBasis G) {U : Set G} (h : U ∈ B) : U ⊆ U * U := fun x x_in ↦ ⟨1, one h, x, x_in, one_mul x⟩ /-- The neighborhood function of a `GroupFilterBasis`. -/ @[to_additive "The neighborhood function of an `AddGroupFilterBasis`."] def N (B : GroupFilterBasis G) : G → Filter G := fun x ↦ map (fun y ↦ x * y) B.toFilterBasis.filter @[to_additive (attr := simp)] theorem N_one (B : GroupFilterBasis G) : B.N 1 = B.toFilterBasis.filter := by simp only [N, one_mul, map_id'] @[to_additive] protected theorem hasBasis (B : GroupFilterBasis G) (x : G) : HasBasis (B.N x) (fun V : Set G ↦ V ∈ B) fun V ↦ (fun y ↦ x * y) '' V := HasBasis.map (fun y ↦ x * y) toFilterBasis.hasBasis /-- The topological space structure coming from a group filter basis. -/ @[to_additive "The topological space structure coming from an additive group filter basis."] def topology (B : GroupFilterBasis G) : TopologicalSpace G := TopologicalSpace.mkOfNhds B.N @[to_additive] theorem nhds_eq (B : GroupFilterBasis G) {x₀ : G} : @nhds G B.topology x₀ = B.N x₀ := by apply TopologicalSpace.nhds_mkOfNhds_of_hasBasis (fun x ↦ (FilterBasis.hasBasis _).map _) · intro a U U_in exact ⟨1, B.one U_in, mul_one a⟩ · intro a U U_in rcases GroupFilterBasis.mul U_in with ⟨V, V_in, hVU⟩ filter_upwards [image_mem_map (B.mem_filter_of_mem V_in)] rintro _ ⟨x, hx, rfl⟩ calc a • U ⊇ a • (V * V) := smul_set_mono hVU _ ⊇ a • x • V := smul_set_mono <| smul_set_subset_smul hx _ = (a * x) • V := smul_smul .. _ ∈ (a * x) • B.filter := smul_set_mem_smul_filter <| B.mem_filter_of_mem V_in @[to_additive] theorem nhds_one_eq (B : GroupFilterBasis G) : @nhds G B.topology (1 : G) = B.toFilterBasis.filter := by rw [B.nhds_eq] simp only [N, one_mul] exact map_id @[to_additive] theorem nhds_hasBasis (B : GroupFilterBasis G) (x₀ : G) : HasBasis (@nhds G B.topology x₀) (fun V : Set G ↦ V ∈ B) fun V ↦ (fun y ↦ x₀ * y) '' V := by rw [B.nhds_eq] apply B.hasBasis @[to_additive] theorem nhds_one_hasBasis (B : GroupFilterBasis G) : HasBasis (@nhds G B.topology 1) (fun V : Set G ↦ V ∈ B) id := by rw [B.nhds_one_eq] exact B.toFilterBasis.hasBasis @[to_additive] theorem mem_nhds_one (B : GroupFilterBasis G) {U : Set G} (hU : U ∈ B) : U ∈ @nhds G B.topology 1 := by rw [B.nhds_one_hasBasis.mem_iff] exact ⟨U, hU, rfl.subset⟩ -- See note [lower instance priority] /-- If a group is endowed with a topological structure coming from a group filter basis then it's a topological group. -/ @[to_additive "If a group is endowed with a topological structure coming from a group filter basis then it's a topological group."] instance (priority := 100) isTopologicalGroup (B : GroupFilterBasis G) : @TopologicalGroup G B.topology _ := by letI := B.topology have basis := B.nhds_one_hasBasis have basis' := basis.prod basis refine TopologicalGroup.of_nhds_one ?_ ?_ ?_ ?_ · rw [basis'.tendsto_iff basis] suffices ∀ U ∈ B, ∃ V W, (V ∈ B ∧ W ∈ B) ∧ ∀ a b, a ∈ V → b ∈ W → a * b ∈ U by simpa intro U U_in rcases mul U_in with ⟨V, V_in, hV⟩ refine ⟨V, V, ⟨V_in, V_in⟩, ?_⟩ intro a b a_in b_in exact hV <| mul_mem_mul a_in b_in · rw [basis.tendsto_iff basis] intro U U_in simpa using inv U_in · intro x₀ rw [nhds_eq, nhds_one_eq] rfl · intro x₀ rw [basis.tendsto_iff basis] intro U U_in exact conj x₀ U_in end GroupFilterBasis /-- A `RingFilterBasis` on a ring is a `FilterBasis` satisfying some additional axioms. Example : if `R` is a topological ring then the neighbourhoods of the identity are a `RingFilterBasis`. Conversely given a `RingFilterBasis` on a ring `R`, one can define a topology on `R` which is compatible with the ring structure. -/ class RingFilterBasis (R : Type u) [Ring R] extends AddGroupFilterBasis R where mul' : ∀ {U}, U ∈ sets → ∃ V ∈ sets, V * V ⊆ U mul_left' : ∀ (x₀ : R) {U}, U ∈ sets → ∃ V ∈ sets, V ⊆ (fun x ↦ x₀ * x) ⁻¹' U mul_right' : ∀ (x₀ : R) {U}, U ∈ sets → ∃ V ∈ sets, V ⊆ (fun x ↦ x * x₀) ⁻¹' U namespace RingFilterBasis variable {R : Type u} [Ring R] (B : RingFilterBasis R) instance : Membership (Set R) (RingFilterBasis R) := ⟨fun s B ↦ s ∈ B.sets⟩ theorem mul {U : Set R} (hU : U ∈ B) : ∃ V ∈ B, V * V ⊆ U := mul' hU theorem mul_left (x₀ : R) {U : Set R} (hU : U ∈ B) : ∃ V ∈ B, V ⊆ (fun x ↦ x₀ * x) ⁻¹' U := mul_left' x₀ hU theorem mul_right (x₀ : R) {U : Set R} (hU : U ∈ B) : ∃ V ∈ B, V ⊆ (fun x ↦ x * x₀) ⁻¹' U := mul_right' x₀ hU /-- The topology associated to a ring filter basis. It has the given basis as a basis of neighborhoods of zero. -/ def topology : TopologicalSpace R := B.toAddGroupFilterBasis.topology /-- If a ring is endowed with a topological structure coming from a ring filter basis then it's a topological ring. -/ instance (priority := 100) isTopologicalRing {R : Type u} [Ring R] (B : RingFilterBasis R) : @TopologicalRing R B.topology _ := by let B' := B.toAddGroupFilterBasis letI := B'.topology have basis := B'.nhds_zero_hasBasis have basis' := basis.prod basis haveI := B'.isTopologicalAddGroup apply TopologicalRing.of_addGroup_of_nhds_zero · rw [basis'.tendsto_iff basis] suffices ∀ U ∈ B', ∃ V W, (V ∈ B' ∧ W ∈ B') ∧ ∀ a b, a ∈ V → b ∈ W → a * b ∈ U by simpa intro U U_in rcases B.mul U_in with ⟨V, V_in, hV⟩ refine ⟨V, V, ⟨V_in, V_in⟩, ?_⟩ intro a b a_in b_in exact hV <| mul_mem_mul a_in b_in · intro x₀ rw [basis.tendsto_iff basis] intro U simpa using B.mul_left x₀ · intro x₀ rw [basis.tendsto_iff basis] intro U simpa using B.mul_right x₀ end RingFilterBasis /-- A `ModuleFilterBasis` on a module is a `FilterBasis` satisfying some additional axioms. Example : if `M` is a topological module then the neighbourhoods of zero are a `ModuleFilterBasis`. Conversely given a `ModuleFilterBasis` one can define a topology compatible with the module structure on `M`. -/ structure ModuleFilterBasis (R M : Type*) [CommRing R] [TopologicalSpace R] [AddCommGroup M] [Module R M] extends AddGroupFilterBasis M where smul' : ∀ {U}, U ∈ sets → ∃ V ∈ 𝓝 (0 : R), ∃ W ∈ sets, V • W ⊆ U smul_left' : ∀ (x₀ : R) {U}, U ∈ sets → ∃ V ∈ sets, V ⊆ (fun x ↦ x₀ • x) ⁻¹' U smul_right' : ∀ (m₀ : M) {U}, U ∈ sets → ∀ᶠ x in 𝓝 (0 : R), x • m₀ ∈ U namespace ModuleFilterBasis variable {R M : Type*} [CommRing R] [TopologicalSpace R] [AddCommGroup M] [Module R M] (B : ModuleFilterBasis R M) instance GroupFilterBasis.hasMem : Membership (Set M) (ModuleFilterBasis R M) := ⟨fun s B ↦ s ∈ B.sets⟩ theorem smul {U : Set M} (hU : U ∈ B) : ∃ V ∈ 𝓝 (0 : R), ∃ W ∈ B, V • W ⊆ U := B.smul' hU theorem smul_left (x₀ : R) {U : Set M} (hU : U ∈ B) : ∃ V ∈ B, V ⊆ (fun x ↦ x₀ • x) ⁻¹' U := B.smul_left' x₀ hU theorem smul_right (m₀ : M) {U : Set M} (hU : U ∈ B) : ∀ᶠ x in 𝓝 (0 : R), x • m₀ ∈ U := B.smul_right' m₀ hU /-- If `R` is discrete then the trivial additive group filter basis on any `R`-module is a module filter basis. -/ instance [DiscreteTopology R] : Inhabited (ModuleFilterBasis R M) := ⟨{ show AddGroupFilterBasis M from default with smul' := by rintro U (rfl : U ∈ {{(0 : M)}}) use univ, univ_mem, {0}, rfl rintro a ⟨x, -, m, rfl, rfl⟩ simp only [smul_zero, mem_singleton_iff] smul_left' := by rintro x₀ U (h : U ∈ {{(0 : M)}}) rw [mem_singleton_iff] at h use {0}, rfl simp [h] smul_right' := by rintro m₀ U (h : U ∈ (0 : Set (Set M))) rw [Set.mem_zero] at h simp [h, nhds_discrete] }⟩ /-- The topology associated to a module filter basis on a module over a topological ring. It has the given basis as a basis of neighborhoods of zero. -/ def topology : TopologicalSpace M := B.toAddGroupFilterBasis.topology /-- The topology associated to a module filter basis on a module over a topological ring. It has the given basis as a basis of neighborhoods of zero. This version gets the ring topology by unification instead of type class inference. -/ def topology' {R M : Type*} [CommRing R] {_ : TopologicalSpace R} [AddCommGroup M] [Module R M] (B : ModuleFilterBasis R M) : TopologicalSpace M := B.toAddGroupFilterBasis.topology /-- A topological add group with a basis of `𝓝 0` satisfying the axioms of `ModuleFilterBasis` is a topological module. This lemma is mathematically useless because one could obtain such a result by applying `ModuleFilterBasis.continuousSMul` and use the fact that group topologies are characterized by their neighborhoods of 0 to obtain the `ContinuousSMul` on the pre-existing topology. But it turns out it's just easier to get it as a byproduct of the proof, so this is just a free quality-of-life improvement. -/ theorem _root_.ContinuousSMul.of_basis_zero {ι : Type*} [TopologicalRing R] [TopologicalSpace M] [TopologicalAddGroup M] {p : ι → Prop} {b : ι → Set M} (h : HasBasis (𝓝 0) p b) (hsmul : ∀ {i}, p i → ∃ V ∈ 𝓝 (0 : R), ∃ j, p j ∧ V • b j ⊆ b i) (hsmul_left : ∀ (x₀ : R) {i}, p i → ∃ j, p j ∧ MapsTo (x₀ • ·) (b j) (b i)) (hsmul_right : ∀ (m₀ : M) {i}, p i → ∀ᶠ x in 𝓝 (0 : R), x • m₀ ∈ b i) : ContinuousSMul R M := by apply ContinuousSMul.of_nhds_zero · rw [h.tendsto_right_iff] intro i hi rcases hsmul hi with ⟨V, V_in, j, hj, hVj⟩ apply mem_of_superset (prod_mem_prod V_in <| h.mem_of_mem hj) rintro ⟨v, w⟩ ⟨v_in : v ∈ V, w_in : w ∈ b j⟩ exact hVj (Set.smul_mem_smul v_in w_in) · intro m₀ rw [h.tendsto_right_iff] intro i hi exact hsmul_right m₀ hi · intro x₀ rw [h.tendsto_right_iff] intro i hi rcases hsmul_left x₀ hi with ⟨j, hj, hji⟩ exact mem_of_superset (h.mem_of_mem hj) hji /-- If a module is endowed with a topological structure coming from a module filter basis then it's a topological module. -/ instance (priority := 100) continuousSMul [TopologicalRing R] : @ContinuousSMul R M _ _ B.topology := by let B' := B.toAddGroupFilterBasis let _ := B'.topology have _ := B'.isTopologicalAddGroup exact ContinuousSMul.of_basis_zero B'.nhds_zero_hasBasis (fun {_} => by simpa using B.smul) (by simpa using B.smul_left) B.smul_right /-- Build a module filter basis from compatible ring and additive group filter bases. -/ def ofBases {R M : Type*} [CommRing R] [AddCommGroup M] [Module R M] (BR : RingFilterBasis R) (BM : AddGroupFilterBasis M) (smul : ∀ {U}, U ∈ BM → ∃ V ∈ BR, ∃ W ∈ BM, V • W ⊆ U) (smul_left : ∀ (x₀ : R) {U}, U ∈ BM → ∃ V ∈ BM, V ⊆ (fun x ↦ x₀ • x) ⁻¹' U) (smul_right : ∀ (m₀ : M) {U}, U ∈ BM → ∃ V ∈ BR, V ⊆ (fun x ↦ x • m₀) ⁻¹' U) : @ModuleFilterBasis R M _ BR.topology _ _ := let _ := BR.topology { BM with smul' := by intro U U_in rcases smul U_in with ⟨V, V_in, W, W_in, H⟩ exact ⟨V, BR.toAddGroupFilterBasis.mem_nhds_zero V_in, W, W_in, H⟩ smul_left' := smul_left smul_right' := by intro m₀ U U_in rcases smul_right m₀ U_in with ⟨V, V_in, H⟩ exact mem_of_superset (BR.toAddGroupFilterBasis.mem_nhds_zero V_in) H } end ModuleFilterBasis
Topology\Algebra\GroupCompletion.lean
/- Copyright (c) 2018 Patrick Massot. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Johannes Hölzl -/ import Mathlib.Topology.Algebra.UniformGroup import Mathlib.Topology.Algebra.UniformMulAction import Mathlib.Topology.UniformSpace.Completion /-! # Completion of topological groups: This files endows the completion of a topological abelian group with a group structure. More precisely the instance `UniformSpace.Completion.addGroup` builds an abelian group structure on the completion of an abelian group endowed with a compatible uniform structure. Then the instance `UniformSpace.Completion.uniformAddGroup` proves this group structure is compatible with the completed uniform structure. The compatibility condition is `UniformAddGroup`. ## Main declarations: Beyond the instances explained above (that don't have to be explicitly invoked), the main constructions deal with continuous group morphisms. * `AddMonoidHom.extension`: extends a continuous group morphism from `G` to a complete separated group `H` to `Completion G`. * `AddMonoidHom.completion`: promotes a continuous group morphism from `G` to `H` into a continuous group morphism from `Completion G` to `Completion H`. -/ noncomputable section variable {M R α β : Type*} section Group open UniformSpace CauchyFilter Filter Set variable [UniformSpace α] instance [Zero α] : Zero (Completion α) := ⟨(0 : α)⟩ instance [Neg α] : Neg (Completion α) := ⟨Completion.map (fun a ↦ -a : α → α)⟩ instance [Add α] : Add (Completion α) := ⟨Completion.map₂ (· + ·)⟩ instance [Sub α] : Sub (Completion α) := ⟨Completion.map₂ Sub.sub⟩ @[norm_cast] theorem UniformSpace.Completion.coe_zero [Zero α] : ((0 : α) : Completion α) = 0 := rfl end Group namespace UniformSpace.Completion open UniformSpace section Zero instance [UniformSpace α] [MonoidWithZero M] [Zero α] [MulActionWithZero M α] [UniformContinuousConstSMul M α] : MulActionWithZero M (Completion α) := { (inferInstance : MulAction M <| Completion α) with smul_zero := fun r ↦ by rw [← coe_zero, ← coe_smul, MulActionWithZero.smul_zero r] zero_smul := ext' (continuous_const_smul _) continuous_const fun a ↦ by rw [← coe_smul, zero_smul, coe_zero] } end Zero section UniformAddGroup variable [UniformSpace α] [AddGroup α] [UniformAddGroup α] @[norm_cast] theorem coe_neg (a : α) : ((-a : α) : Completion α) = -a := (map_coe uniformContinuous_neg a).symm @[norm_cast] theorem coe_sub (a b : α) : ((a - b : α) : Completion α) = a - b := (map₂_coe_coe a b Sub.sub uniformContinuous_sub).symm @[norm_cast] theorem coe_add (a b : α) : ((a + b : α) : Completion α) = a + b := (map₂_coe_coe a b (· + ·) uniformContinuous_add).symm instance : AddMonoid (Completion α) := { (inferInstance : Zero <| Completion α), (inferInstance : Add <| Completion α) with zero_add := fun a ↦ Completion.induction_on a (isClosed_eq (continuous_map₂ continuous_const continuous_id) continuous_id) fun a ↦ show 0 + (a : Completion α) = a by rw [← coe_zero, ← coe_add, zero_add] add_zero := fun a ↦ Completion.induction_on a (isClosed_eq (continuous_map₂ continuous_id continuous_const) continuous_id) fun a ↦ show (a : Completion α) + 0 = a by rw [← coe_zero, ← coe_add, add_zero] add_assoc := fun a b c ↦ Completion.induction_on₃ a b c (isClosed_eq (continuous_map₂ (continuous_map₂ continuous_fst (continuous_fst.comp continuous_snd)) (continuous_snd.comp continuous_snd)) (continuous_map₂ continuous_fst (continuous_map₂ (continuous_fst.comp continuous_snd) (continuous_snd.comp continuous_snd)))) fun a b c ↦ show (a : Completion α) + b + c = a + (b + c) by repeat' rw_mod_cast [add_assoc] nsmul := (· • ·) nsmul_zero := fun a ↦ Completion.induction_on a (isClosed_eq continuous_map continuous_const) fun a ↦ show 0 • (a : Completion α) = 0 by rw [← coe_smul, ← coe_zero, zero_smul] nsmul_succ := fun n a ↦ Completion.induction_on a (isClosed_eq continuous_map <| continuous_map₂ continuous_map continuous_id) fun a ↦ show (n + 1) • (a : Completion α) = n • (a : Completion α) + (a : Completion α) by rw [← coe_smul, succ_nsmul, coe_add, coe_smul] } instance : SubNegMonoid (Completion α) := { (inferInstance : AddMonoid <| Completion α), (inferInstance : Neg <| Completion α), (inferInstance : Sub <| Completion α) with sub_eq_add_neg := fun a b ↦ Completion.induction_on₂ a b (isClosed_eq (continuous_map₂ continuous_fst continuous_snd) (continuous_map₂ continuous_fst (Completion.continuous_map.comp continuous_snd))) fun a b ↦ mod_cast congr_arg ((↑) : α → Completion α) (sub_eq_add_neg a b) zsmul := (· • ·) zsmul_zero' := fun a ↦ Completion.induction_on a (isClosed_eq continuous_map continuous_const) fun a ↦ show (0 : ℤ) • (a : Completion α) = 0 by rw [← coe_smul, ← coe_zero, zero_smul] zsmul_succ' := fun n a ↦ Completion.induction_on a (isClosed_eq continuous_map <| continuous_map₂ continuous_map continuous_id) fun a ↦ show Int.ofNat n.succ • (a : Completion α) = _ by rw [← coe_smul, show Int.ofNat n.succ • a = Int.ofNat n • a + a from SubNegMonoid.zsmul_succ' n a, coe_add, coe_smul] zsmul_neg' := fun n a ↦ Completion.induction_on a (isClosed_eq continuous_map <| Completion.continuous_map.comp continuous_map) fun a ↦ show (Int.negSucc n) • (a : Completion α) = _ by rw [← coe_smul, show (Int.negSucc n) • a = -((n.succ : ℤ) • a) from SubNegMonoid.zsmul_neg' n a, coe_neg, coe_smul] } instance addGroup : AddGroup (Completion α) := { (inferInstance : SubNegMonoid <| Completion α) with add_left_neg := fun a ↦ Completion.induction_on a (isClosed_eq (continuous_map₂ Completion.continuous_map continuous_id) continuous_const) fun a ↦ show -(a : Completion α) + a = 0 by rw_mod_cast [add_left_neg] rfl } instance uniformAddGroup : UniformAddGroup (Completion α) := ⟨uniformContinuous_map₂ Sub.sub⟩ instance {M} [Monoid M] [DistribMulAction M α] [UniformContinuousConstSMul M α] : DistribMulAction M (Completion α) := { (inferInstance : MulAction M <| Completion α) with smul_add := fun r x y ↦ induction_on₂ x y (isClosed_eq ((continuous_fst.add continuous_snd).const_smul _) ((continuous_fst.const_smul _).add (continuous_snd.const_smul _))) fun a b ↦ by simp only [← coe_add, ← coe_smul, smul_add] smul_zero := fun r ↦ by rw [← coe_zero, ← coe_smul, smul_zero r] } /-- The map from a group to its completion as a group hom. -/ @[simps] def toCompl : α →+ Completion α where toFun := (↑) map_add' := coe_add map_zero' := coe_zero theorem continuous_toCompl : Continuous (toCompl : α → Completion α) := continuous_coe α variable (α) theorem denseInducing_toCompl : DenseInducing (toCompl : α → Completion α) := denseInducing_coe variable {α} end UniformAddGroup section UniformAddCommGroup variable [UniformSpace α] [AddCommGroup α] [UniformAddGroup α] instance instAddCommGroup : AddCommGroup (Completion α) := { (inferInstance : AddGroup <| Completion α) with add_comm := fun a b ↦ Completion.induction_on₂ a b (isClosed_eq (continuous_map₂ continuous_fst continuous_snd) (continuous_map₂ continuous_snd continuous_fst)) fun x y ↦ by change (x : Completion α) + ↑y = ↑y + ↑x rw [← coe_add, ← coe_add, add_comm] } instance instModule [Semiring R] [Module R α] [UniformContinuousConstSMul R α] : Module R (Completion α) := { (inferInstance : DistribMulAction R <| Completion α), (inferInstance : MulActionWithZero R <| Completion α) with add_smul := fun a b ↦ ext' (continuous_const_smul _) ((continuous_const_smul _).add (continuous_const_smul _)) fun x ↦ by rw [← coe_smul, add_smul, coe_add, coe_smul, coe_smul] } end UniformAddCommGroup end UniformSpace.Completion section AddMonoidHom variable [UniformSpace α] [AddGroup α] [UniformAddGroup α] [UniformSpace β] [AddGroup β] [UniformAddGroup β] open UniformSpace UniformSpace.Completion /-- Extension to the completion of a continuous group hom. -/ def AddMonoidHom.extension [CompleteSpace β] [T0Space β] (f : α →+ β) (hf : Continuous f) : Completion α →+ β := have hf : UniformContinuous f := uniformContinuous_addMonoidHom_of_continuous hf { toFun := Completion.extension f map_zero' := by rw [← coe_zero, extension_coe hf, f.map_zero] map_add' := fun a b ↦ Completion.induction_on₂ a b (isClosed_eq (continuous_extension.comp continuous_add) ((continuous_extension.comp continuous_fst).add (continuous_extension.comp continuous_snd))) fun a b ↦ show Completion.extension f _ = Completion.extension f _ + Completion.extension f _ by rw_mod_cast [extension_coe hf, extension_coe hf, extension_coe hf, f.map_add] } theorem AddMonoidHom.extension_coe [CompleteSpace β] [T0Space β] (f : α →+ β) (hf : Continuous f) (a : α) : f.extension hf a = f a := UniformSpace.Completion.extension_coe (uniformContinuous_addMonoidHom_of_continuous hf) a @[continuity] theorem AddMonoidHom.continuous_extension [CompleteSpace β] [T0Space β] (f : α →+ β) (hf : Continuous f) : Continuous (f.extension hf) := UniformSpace.Completion.continuous_extension /-- Completion of a continuous group hom, as a group hom. -/ def AddMonoidHom.completion (f : α →+ β) (hf : Continuous f) : Completion α →+ Completion β := (toCompl.comp f).extension (continuous_toCompl.comp hf) @[continuity] theorem AddMonoidHom.continuous_completion (f : α →+ β) (hf : Continuous f) : Continuous (AddMonoidHom.completion f hf : Completion α → Completion β) := continuous_map theorem AddMonoidHom.completion_coe (f : α →+ β) (hf : Continuous f) (a : α) : AddMonoidHom.completion f hf a = f a := map_coe (uniformContinuous_addMonoidHom_of_continuous hf) a theorem AddMonoidHom.completion_zero : AddMonoidHom.completion (0 : α →+ β) continuous_const = 0 := by ext x refine Completion.induction_on x ?_ ?_ · apply isClosed_eq (AddMonoidHom.continuous_completion (0 : α →+ β) continuous_const) exact continuous_const · intro a simp [(0 : α →+ β).completion_coe continuous_const, coe_zero] theorem AddMonoidHom.completion_add {γ : Type*} [AddCommGroup γ] [UniformSpace γ] [UniformAddGroup γ] (f g : α →+ γ) (hf : Continuous f) (hg : Continuous g) : AddMonoidHom.completion (f + g) (hf.add hg) = AddMonoidHom.completion f hf + AddMonoidHom.completion g hg := by have hfg := hf.add hg ext x refine Completion.induction_on x ?_ ?_ · exact isClosed_eq ((f + g).continuous_completion hfg) ((f.continuous_completion hf).add (g.continuous_completion hg)) · intro a simp [(f + g).completion_coe hfg, coe_add, f.completion_coe hf, g.completion_coe hg] end AddMonoidHom
Topology\Algebra\GroupWithZero.lean
/- Copyright (c) 2020 Yury G. Kudryashov. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yury G. Kudryashov -/ import Mathlib.Algebra.Group.Pi.Lemmas import Mathlib.Topology.Algebra.Monoid import Mathlib.Topology.Homeomorph /-! # Topological group with zero In this file we define `HasContinuousInv₀` to be a mixin typeclass a type with `Inv` and `Zero` (e.g., a `GroupWithZero`) such that `fun x ↦ x⁻¹` is continuous at all nonzero points. Any normed (semi)field has this property. Currently the only example of `HasContinuousInv₀` in `mathlib` which is not a normed field is the type `NNReal` (a.k.a. `ℝ≥0`) of nonnegative real numbers. Then we prove lemmas about continuity of `x ↦ x⁻¹` and `f / g` providing dot-style `*.inv₀` and `*.div` operations on `Filter.Tendsto`, `ContinuousAt`, `ContinuousWithinAt`, `ContinuousOn`, and `Continuous`. As a special case, we provide `*.div_const` operations that require only `DivInvMonoid` and `ContinuousMul` instances. All lemmas about `(⁻¹)` use `inv₀` in their names because lemmas without `₀` are used for `TopologicalGroup`s. We also use `'` in the typeclass name `HasContinuousInv₀` for the sake of consistency of notation. On a `GroupWithZero` with continuous multiplication, we also define left and right multiplication as homeomorphisms. -/ open Topology Filter Function /-! ### A `DivInvMonoid` with continuous multiplication If `G₀` is a `DivInvMonoid` with continuous `(*)`, then `(/y)` is continuous for any `y`. In this section we prove lemmas that immediately follow from this fact providing `*.div_const` dot-style operations on `Filter.Tendsto`, `ContinuousAt`, `ContinuousWithinAt`, `ContinuousOn`, and `Continuous`. -/ variable {α β G₀ : Type*} section DivConst variable [DivInvMonoid G₀] [TopologicalSpace G₀] [ContinuousMul G₀] {f : α → G₀} {s : Set α} {l : Filter α} theorem Filter.Tendsto.div_const {x : G₀} (hf : Tendsto f l (𝓝 x)) (y : G₀) : Tendsto (fun a => f a / y) l (𝓝 (x / y)) := by simpa only [div_eq_mul_inv] using hf.mul tendsto_const_nhds variable [TopologicalSpace α] nonrec theorem ContinuousAt.div_const {a : α} (hf : ContinuousAt f a) (y : G₀) : ContinuousAt (fun x => f x / y) a := hf.div_const y nonrec theorem ContinuousWithinAt.div_const {a} (hf : ContinuousWithinAt f s a) (y : G₀) : ContinuousWithinAt (fun x => f x / y) s a := hf.div_const _ theorem ContinuousOn.div_const (hf : ContinuousOn f s) (y : G₀) : ContinuousOn (fun x => f x / y) s := by simpa only [div_eq_mul_inv] using hf.mul continuousOn_const @[continuity, fun_prop] theorem Continuous.div_const (hf : Continuous f) (y : G₀) : Continuous fun x => f x / y := by simpa only [div_eq_mul_inv] using hf.mul continuous_const end DivConst /-- A type with `0` and `Inv` such that `fun x ↦ x⁻¹` is continuous at all nonzero points. Any normed (semi)field has this property. -/ class HasContinuousInv₀ (G₀ : Type*) [Zero G₀] [Inv G₀] [TopologicalSpace G₀] : Prop where /-- The map `fun x ↦ x⁻¹` is continuous at all nonzero points. -/ continuousAt_inv₀ : ∀ ⦃x : G₀⦄, x ≠ 0 → ContinuousAt Inv.inv x export HasContinuousInv₀ (continuousAt_inv₀) section Inv₀ variable [Zero G₀] [Inv G₀] [TopologicalSpace G₀] [HasContinuousInv₀ G₀] {l : Filter α} {f : α → G₀} {s : Set α} {a : α} /-! ### Continuity of `fun x ↦ x⁻¹` at a non-zero point We define `HasContinuousInv₀` to be a `GroupWithZero` such that the operation `x ↦ x⁻¹` is continuous at all nonzero points. In this section we prove dot-style `*.inv₀` lemmas for `Filter.Tendsto`, `ContinuousAt`, `ContinuousWithinAt`, `ContinuousOn`, and `Continuous`. -/ theorem tendsto_inv₀ {x : G₀} (hx : x ≠ 0) : Tendsto Inv.inv (𝓝 x) (𝓝 x⁻¹) := continuousAt_inv₀ hx theorem continuousOn_inv₀ : ContinuousOn (Inv.inv : G₀ → G₀) {0}ᶜ := fun _x hx => (continuousAt_inv₀ hx).continuousWithinAt /-- If a function converges to a nonzero value, its inverse converges to the inverse of this value. We use the name `Filter.Tendsto.inv₀` as `Filter.Tendsto.inv` is already used in multiplicative topological groups. -/ theorem Filter.Tendsto.inv₀ {a : G₀} (hf : Tendsto f l (𝓝 a)) (ha : a ≠ 0) : Tendsto (fun x => (f x)⁻¹) l (𝓝 a⁻¹) := (tendsto_inv₀ ha).comp hf variable [TopologicalSpace α] nonrec theorem ContinuousWithinAt.inv₀ (hf : ContinuousWithinAt f s a) (ha : f a ≠ 0) : ContinuousWithinAt (fun x => (f x)⁻¹) s a := hf.inv₀ ha @[fun_prop] nonrec theorem ContinuousAt.inv₀ (hf : ContinuousAt f a) (ha : f a ≠ 0) : ContinuousAt (fun x => (f x)⁻¹) a := hf.inv₀ ha @[continuity, fun_prop] theorem Continuous.inv₀ (hf : Continuous f) (h0 : ∀ x, f x ≠ 0) : Continuous fun x => (f x)⁻¹ := continuous_iff_continuousAt.2 fun x => (hf.tendsto x).inv₀ (h0 x) @[fun_prop] theorem ContinuousOn.inv₀ (hf : ContinuousOn f s) (h0 : ∀ x ∈ s, f x ≠ 0) : ContinuousOn (fun x => (f x)⁻¹) s := fun x hx => (hf x hx).inv₀ (h0 x hx) end Inv₀ /-- If `G₀` is a group with zero with topology such that `x ↦ x⁻¹` is continuous at all nonzero points. Then the coercion `G₀ˣ → G₀` is a topological embedding. -/ theorem Units.embedding_val₀ [GroupWithZero G₀] [TopologicalSpace G₀] [HasContinuousInv₀ G₀] : Embedding (val : G₀ˣ → G₀) := embedding_val_mk <| (continuousOn_inv₀ (G₀ := G₀)).mono fun _ ↦ IsUnit.ne_zero section NhdsInv variable [GroupWithZero G₀] [TopologicalSpace G₀] [HasContinuousInv₀ G₀] {x : G₀} lemma nhds_inv₀ (hx : x ≠ 0) : 𝓝 x⁻¹ = (𝓝 x)⁻¹ := by refine le_antisymm (inv_le_iff_le_inv.1 ?_) (tendsto_inv₀ hx) simpa only [inv_inv] using tendsto_inv₀ (inv_ne_zero hx) lemma tendsto_inv_iff₀ {l : Filter α} {f : α → G₀} (hx : x ≠ 0) : Tendsto (fun x ↦ (f x)⁻¹) l (𝓝 x⁻¹) ↔ Tendsto f l (𝓝 x) := by simp only [nhds_inv₀ hx, ← Filter.comap_inv, tendsto_comap_iff, (· ∘ ·), inv_inv] end NhdsInv /-! ### Continuity of division If `G₀` is a `GroupWithZero` with `x ↦ x⁻¹` continuous at all nonzero points and `(*)`, then division `(/)` is continuous at any point where the denominator is continuous. -/ section Div variable [GroupWithZero G₀] [TopologicalSpace G₀] [HasContinuousInv₀ G₀] [ContinuousMul G₀] {f g : α → G₀} theorem Filter.Tendsto.div {l : Filter α} {a b : G₀} (hf : Tendsto f l (𝓝 a)) (hg : Tendsto g l (𝓝 b)) (hy : b ≠ 0) : Tendsto (f / g) l (𝓝 (a / b)) := by simpa only [div_eq_mul_inv] using hf.mul (hg.inv₀ hy) theorem Filter.tendsto_mul_iff_of_ne_zero [T1Space G₀] {f g : α → G₀} {l : Filter α} {x y : G₀} (hg : Tendsto g l (𝓝 y)) (hy : y ≠ 0) : Tendsto (fun n => f n * g n) l (𝓝 <| x * y) ↔ Tendsto f l (𝓝 x) := by refine ⟨fun hfg => ?_, fun hf => hf.mul hg⟩ rw [← mul_div_cancel_right₀ x hy] refine Tendsto.congr' ?_ (hfg.div hg hy) exact (hg.eventually_ne hy).mono fun n hn => mul_div_cancel_right₀ _ hn variable [TopologicalSpace α] [TopologicalSpace β] {s : Set α} {a : α} nonrec theorem ContinuousWithinAt.div (hf : ContinuousWithinAt f s a) (hg : ContinuousWithinAt g s a) (h₀ : g a ≠ 0) : ContinuousWithinAt (f / g) s a := hf.div hg h₀ theorem ContinuousOn.div (hf : ContinuousOn f s) (hg : ContinuousOn g s) (h₀ : ∀ x ∈ s, g x ≠ 0) : ContinuousOn (f / g) s := fun x hx => (hf x hx).div (hg x hx) (h₀ x hx) /-- Continuity at a point of the result of dividing two functions continuous at that point, where the denominator is nonzero. -/ nonrec theorem ContinuousAt.div (hf : ContinuousAt f a) (hg : ContinuousAt g a) (h₀ : g a ≠ 0) : ContinuousAt (f / g) a := hf.div hg h₀ @[continuity] theorem Continuous.div (hf : Continuous f) (hg : Continuous g) (h₀ : ∀ x, g x ≠ 0) : Continuous (f / g) := by simpa only [div_eq_mul_inv] using hf.mul (hg.inv₀ h₀) theorem continuousOn_div : ContinuousOn (fun p : G₀ × G₀ => p.1 / p.2) { p | p.2 ≠ 0 } := continuousOn_fst.div continuousOn_snd fun _ => id @[fun_prop] theorem Continuous.div₀ (hf : Continuous f) (hg : Continuous g) (h₀ : ∀ x, g x ≠ 0) : Continuous (fun x => f x / g x) := by simpa only [div_eq_mul_inv] using hf.mul (hg.inv₀ h₀) @[fun_prop] theorem ContinuousAt.div₀ (hf : ContinuousAt f a) (hg : ContinuousAt g a) (h₀ : g a ≠ 0) : ContinuousAt (fun x => f x / g x) a := ContinuousAt.div hf hg h₀ @[fun_prop] theorem ContinuousOn.div₀ (hf : ContinuousOn f s) (hg : ContinuousOn g s) (h₀ : ∀ x ∈ s, g x ≠ 0) : ContinuousOn (fun x => f x / g x) s := ContinuousOn.div hf hg h₀ /-- The function `f x / g x` is discontinuous when `g x = 0`. However, under appropriate conditions, `h x (f x / g x)` is still continuous. The condition is that if `g a = 0` then `h x y` must tend to `h a 0` when `x` tends to `a`, with no information about `y`. This is represented by the `⊤` filter. Note: `tendsto_prod_top_iff` characterizes this convergence in uniform spaces. See also `Filter.prod_top` and `Filter.mem_prod_top`. -/ theorem ContinuousAt.comp_div_cases {f g : α → G₀} (h : α → G₀ → β) (hf : ContinuousAt f a) (hg : ContinuousAt g a) (hh : g a ≠ 0 → ContinuousAt (↿h) (a, f a / g a)) (h2h : g a = 0 → Tendsto (↿h) (𝓝 a ×ˢ ⊤) (𝓝 (h a 0))) : ContinuousAt (fun x => h x (f x / g x)) a := by show ContinuousAt (↿h ∘ fun x => (x, f x / g x)) a by_cases hga : g a = 0 · rw [ContinuousAt] simp_rw [comp_apply, hga, div_zero] exact (h2h hga).comp (continuousAt_id.prod_mk tendsto_top) · exact ContinuousAt.comp (hh hga) (continuousAt_id.prod (hf.div hg hga)) /-- `h x (f x / g x)` is continuous under certain conditions, even if the denominator is sometimes `0`. See docstring of `ContinuousAt.comp_div_cases`. -/ theorem Continuous.comp_div_cases {f g : α → G₀} (h : α → G₀ → β) (hf : Continuous f) (hg : Continuous g) (hh : ∀ a, g a ≠ 0 → ContinuousAt (↿h) (a, f a / g a)) (h2h : ∀ a, g a = 0 → Tendsto (↿h) (𝓝 a ×ˢ ⊤) (𝓝 (h a 0))) : Continuous fun x => h x (f x / g x) := continuous_iff_continuousAt.mpr fun a => hf.continuousAt.comp_div_cases _ hg.continuousAt (hh a) (h2h a) end Div /-! ### Left and right multiplication as homeomorphisms -/ namespace Homeomorph variable [TopologicalSpace α] [GroupWithZero α] [ContinuousMul α] /-- Left multiplication by a nonzero element in a `GroupWithZero` with continuous multiplication is a homeomorphism of the underlying type. -/ protected def mulLeft₀ (c : α) (hc : c ≠ 0) : α ≃ₜ α := { Equiv.mulLeft₀ c hc with continuous_toFun := continuous_mul_left _ continuous_invFun := continuous_mul_left _ } /-- Right multiplication by a nonzero element in a `GroupWithZero` with continuous multiplication is a homeomorphism of the underlying type. -/ protected def mulRight₀ (c : α) (hc : c ≠ 0) : α ≃ₜ α := { Equiv.mulRight₀ c hc with continuous_toFun := continuous_mul_right _ continuous_invFun := continuous_mul_right _ } @[simp] theorem coe_mulLeft₀ (c : α) (hc : c ≠ 0) : ⇑(Homeomorph.mulLeft₀ c hc) = (c * ·) := rfl @[simp] theorem mulLeft₀_symm_apply (c : α) (hc : c ≠ 0) : ((Homeomorph.mulLeft₀ c hc).symm : α → α) = (c⁻¹ * ·) := rfl @[simp] theorem coe_mulRight₀ (c : α) (hc : c ≠ 0) : ⇑(Homeomorph.mulRight₀ c hc) = (· * c) := rfl @[simp] theorem mulRight₀_symm_apply (c : α) (hc : c ≠ 0) : ((Homeomorph.mulRight₀ c hc).symm : α → α) = (· * c⁻¹) := rfl end Homeomorph section map_comap variable [TopologicalSpace G₀] [GroupWithZero G₀] [ContinuousMul G₀] {a : G₀} theorem map_mul_left_nhds₀ (ha : a ≠ 0) (b : G₀) : map (a * ·) (𝓝 b) = 𝓝 (a * b) := (Homeomorph.mulLeft₀ a ha).map_nhds_eq b theorem map_mul_left_nhds_one₀ (ha : a ≠ 0) : map (a * ·) (𝓝 1) = 𝓝 (a) := by rw [map_mul_left_nhds₀ ha, mul_one] theorem map_mul_right_nhds₀ (ha : a ≠ 0) (b : G₀) : map (· * a) (𝓝 b) = 𝓝 (b * a) := (Homeomorph.mulRight₀ a ha).map_nhds_eq b theorem map_mul_right_nhds_one₀ (ha : a ≠ 0) : map (· * a) (𝓝 1) = 𝓝 (a) := by rw [map_mul_right_nhds₀ ha, one_mul] theorem nhds_translation_mul_inv₀ (ha : a ≠ 0) : comap (· * a⁻¹) (𝓝 1) = 𝓝 a := ((Homeomorph.mulRight₀ a ha).symm.comap_nhds_eq 1).trans <| by simp /-- If a group with zero has continuous multiplication and `fun x ↦ x⁻¹` is continuous at one, then it is continuous at any unit. -/ theorem HasContinuousInv₀.of_nhds_one (h : Tendsto Inv.inv (𝓝 (1 : G₀)) (𝓝 1)) : HasContinuousInv₀ G₀ where continuousAt_inv₀ x hx := by have hx' := inv_ne_zero hx rw [ContinuousAt, ← map_mul_left_nhds_one₀ hx, ← nhds_translation_mul_inv₀ hx', tendsto_map'_iff, tendsto_comap_iff] simpa only [(· ∘ ·), mul_inv_rev, mul_inv_cancel_right₀ hx'] end map_comap section ZPow variable [GroupWithZero G₀] [TopologicalSpace G₀] [HasContinuousInv₀ G₀] [ContinuousMul G₀] theorem continuousAt_zpow₀ (x : G₀) (m : ℤ) (h : x ≠ 0 ∨ 0 ≤ m) : ContinuousAt (fun x => x ^ m) x := by cases' m with m m · simpa only [Int.ofNat_eq_coe, zpow_natCast] using continuousAt_pow x m · simp only [zpow_negSucc] have hx : x ≠ 0 := h.resolve_right (Int.negSucc_lt_zero m).not_le exact (continuousAt_pow x (m + 1)).inv₀ (pow_ne_zero _ hx) theorem continuousOn_zpow₀ (m : ℤ) : ContinuousOn (fun x : G₀ => x ^ m) {0}ᶜ := fun _x hx => (continuousAt_zpow₀ _ _ (Or.inl hx)).continuousWithinAt theorem Filter.Tendsto.zpow₀ {f : α → G₀} {l : Filter α} {a : G₀} (hf : Tendsto f l (𝓝 a)) (m : ℤ) (h : a ≠ 0 ∨ 0 ≤ m) : Tendsto (fun x => f x ^ m) l (𝓝 (a ^ m)) := (continuousAt_zpow₀ _ m h).tendsto.comp hf variable {X : Type*} [TopologicalSpace X] {a : X} {s : Set X} {f : X → G₀} @[fun_prop] nonrec theorem ContinuousAt.zpow₀ (hf : ContinuousAt f a) (m : ℤ) (h : f a ≠ 0 ∨ 0 ≤ m) : ContinuousAt (fun x => f x ^ m) a := hf.zpow₀ m h nonrec theorem ContinuousWithinAt.zpow₀ (hf : ContinuousWithinAt f s a) (m : ℤ) (h : f a ≠ 0 ∨ 0 ≤ m) : ContinuousWithinAt (fun x => f x ^ m) s a := hf.zpow₀ m h @[fun_prop] theorem ContinuousOn.zpow₀ (hf : ContinuousOn f s) (m : ℤ) (h : ∀ a ∈ s, f a ≠ 0 ∨ 0 ≤ m) : ContinuousOn (fun x => f x ^ m) s := fun a ha => (hf a ha).zpow₀ m (h a ha) @[continuity, fun_prop] theorem Continuous.zpow₀ (hf : Continuous f) (m : ℤ) (h0 : ∀ a, f a ≠ 0 ∨ 0 ≤ m) : Continuous fun x => f x ^ m := continuous_iff_continuousAt.2 fun x => (hf.tendsto x).zpow₀ m (h0 x) end ZPow
Topology\Algebra\Localization.lean
/- Copyright (c) 2021 María Inés de Frutos-Fernández. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: María Inés de Frutos-Fernández -/ import Mathlib.GroupTheory.MonoidLocalization.Basic import Mathlib.RingTheory.OreLocalization.Ring import Mathlib.Topology.Algebra.Ring.Basic /-! # Localization of topological rings The topological localization of a topological commutative ring `R` at a submonoid `M` is the ring `Localization M` endowed with the final ring topology of the natural homomorphism sending `x : R` to the equivalence class of `(x, 1)` in the localization of `R` at an `M`. ## Main Results - `Localization.ringTopology`: The localization of a topological commutative ring at a submonoid is a topological ring. -/ variable {R : Type*} [CommRing R] [TopologicalSpace R] {M : Submonoid R} /-- The ring topology on `Localization M` coinduced from the natural homomorphism sending `x : R` to the equivalence class of `(x, 1)`. -/ def Localization.ringTopology : RingTopology (Localization M) := RingTopology.coinduced (Localization.monoidOf M).toFun instance : TopologicalSpace (Localization M) := Localization.ringTopology.toTopologicalSpace instance : TopologicalRing (Localization M) := Localization.ringTopology.toTopologicalRing
Topology\Algebra\Monoid.lean
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro -/ import Mathlib.Algebra.BigOperators.Finprod import Mathlib.Order.Filter.Pointwise import Mathlib.Topology.Algebra.MulAction import Mathlib.Algebra.BigOperators.Pi import Mathlib.Topology.ContinuousFunction.Basic import Mathlib.Algebra.Group.ULift /-! # Theory of topological monoids In this file we define mixin classes `ContinuousMul` and `ContinuousAdd`. While in many applications the underlying type is a monoid (multiplicative or additive), we do not require this in the definitions. -/ universe u v open scoped Classical open Set Filter TopologicalSpace open scoped Classical open Topology Pointwise variable {ι α M N X : Type*} [TopologicalSpace X] @[to_additive (attr := continuity, fun_prop)] theorem continuous_one [TopologicalSpace M] [One M] : Continuous (1 : X → M) := @continuous_const _ _ _ _ 1 /-- Basic hypothesis to talk about a topological additive monoid or a topological additive semigroup. A topological additive monoid over `M`, for example, is obtained by requiring both the instances `AddMonoid M` and `ContinuousAdd M`. Continuity in only the left/right argument can be stated using `ContinuousConstVAdd α α`/`ContinuousConstVAdd αᵐᵒᵖ α`. -/ class ContinuousAdd (M : Type u) [TopologicalSpace M] [Add M] : Prop where continuous_add : Continuous fun p : M × M => p.1 + p.2 /-- Basic hypothesis to talk about a topological monoid or a topological semigroup. A topological monoid over `M`, for example, is obtained by requiring both the instances `Monoid M` and `ContinuousMul M`. Continuity in only the left/right argument can be stated using `ContinuousConstSMul α α`/`ContinuousConstSMul αᵐᵒᵖ α`. -/ @[to_additive] class ContinuousMul (M : Type u) [TopologicalSpace M] [Mul M] : Prop where continuous_mul : Continuous fun p : M × M => p.1 * p.2 section ContinuousMul variable [TopologicalSpace M] [Mul M] [ContinuousMul M] @[to_additive] instance : ContinuousMul Mᵒᵈ := ‹ContinuousMul M› @[to_additive (attr := continuity, fun_prop)] theorem continuous_mul : Continuous fun p : M × M => p.1 * p.2 := ContinuousMul.continuous_mul @[to_additive] instance : ContinuousMul (ULift.{u} M) := by constructor apply continuous_uLift_up.comp exact continuous_mul.comp₂ (continuous_uLift_down.comp continuous_fst) (continuous_uLift_down.comp continuous_snd) @[to_additive] instance ContinuousMul.to_continuousSMul : ContinuousSMul M M := ⟨continuous_mul⟩ @[to_additive] instance ContinuousMul.to_continuousSMul_op : ContinuousSMul Mᵐᵒᵖ M := ⟨show Continuous ((fun p : M × M => p.1 * p.2) ∘ Prod.swap ∘ Prod.map MulOpposite.unop id) from continuous_mul.comp <| continuous_swap.comp <| Continuous.prod_map MulOpposite.continuous_unop continuous_id⟩ @[to_additive] theorem ContinuousMul.induced {α : Type*} {β : Type*} {F : Type*} [FunLike F α β] [MulOneClass α] [MulOneClass β] [MonoidHomClass F α β] [tβ : TopologicalSpace β] [ContinuousMul β] (f : F) : @ContinuousMul α (tβ.induced f) _ := by let tα := tβ.induced f refine ⟨continuous_induced_rng.2 ?_⟩ simp only [Function.comp, map_mul] fun_prop @[to_additive (attr := continuity, fun_prop)] theorem Continuous.mul {f g : X → M} (hf : Continuous f) (hg : Continuous g) : Continuous fun x => f x * g x := continuous_mul.comp (hf.prod_mk hg : _) @[to_additive (attr := continuity)] theorem continuous_mul_left (a : M) : Continuous fun b : M => a * b := continuous_const.mul continuous_id @[to_additive (attr := continuity)] theorem continuous_mul_right (a : M) : Continuous fun b : M => b * a := continuous_id.mul continuous_const @[to_additive (attr := fun_prop)] theorem ContinuousOn.mul {f g : X → M} {s : Set X} (hf : ContinuousOn f s) (hg : ContinuousOn g s) : ContinuousOn (fun x => f x * g x) s := (continuous_mul.comp_continuousOn (hf.prod hg) : _) @[to_additive] theorem tendsto_mul {a b : M} : Tendsto (fun p : M × M => p.fst * p.snd) (𝓝 (a, b)) (𝓝 (a * b)) := continuous_iff_continuousAt.mp ContinuousMul.continuous_mul (a, b) @[to_additive] theorem Filter.Tendsto.mul {f g : α → M} {x : Filter α} {a b : M} (hf : Tendsto f x (𝓝 a)) (hg : Tendsto g x (𝓝 b)) : Tendsto (fun x => f x * g x) x (𝓝 (a * b)) := tendsto_mul.comp (hf.prod_mk_nhds hg) @[to_additive] theorem Filter.Tendsto.const_mul (b : M) {c : M} {f : α → M} {l : Filter α} (h : Tendsto (fun k : α => f k) l (𝓝 c)) : Tendsto (fun k : α => b * f k) l (𝓝 (b * c)) := tendsto_const_nhds.mul h @[to_additive] theorem Filter.Tendsto.mul_const (b : M) {c : M} {f : α → M} {l : Filter α} (h : Tendsto (fun k : α => f k) l (𝓝 c)) : Tendsto (fun k : α => f k * b) l (𝓝 (c * b)) := h.mul tendsto_const_nhds @[to_additive] theorem le_nhds_mul (a b : M) : 𝓝 a * 𝓝 b ≤ 𝓝 (a * b) := by rw [← map₂_mul, ← map_uncurry_prod, ← nhds_prod_eq] exact continuous_mul.tendsto _ @[to_additive (attr := simp)] theorem nhds_one_mul_nhds {M} [MulOneClass M] [TopologicalSpace M] [ContinuousMul M] (a : M) : 𝓝 (1 : M) * 𝓝 a = 𝓝 a := ((le_nhds_mul _ _).trans_eq <| congr_arg _ (one_mul a)).antisymm <| le_mul_of_one_le_left' <| pure_le_nhds 1 @[to_additive (attr := simp)] theorem nhds_mul_nhds_one {M} [MulOneClass M] [TopologicalSpace M] [ContinuousMul M] (a : M) : 𝓝 a * 𝓝 1 = 𝓝 a := ((le_nhds_mul _ _).trans_eq <| congr_arg _ (mul_one a)).antisymm <| le_mul_of_one_le_right' <| pure_le_nhds 1 section tendsto_nhds variable {𝕜 : Type*} [Preorder 𝕜] [Zero 𝕜] [Mul 𝕜] [TopologicalSpace 𝕜] [ContinuousMul 𝕜] {l : Filter α} {f : α → 𝕜} {b c : 𝕜} (hb : 0 < b) theorem Filter.TendstoNhdsWithinIoi.const_mul [PosMulStrictMono 𝕜] [PosMulReflectLT 𝕜] (h : Tendsto f l (𝓝[>] c)) : Tendsto (fun a => b * f a) l (𝓝[>] (b * c)) := tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within _ ((tendsto_nhds_of_tendsto_nhdsWithin h).const_mul b) <| (tendsto_nhdsWithin_iff.mp h).2.mono fun _ => (mul_lt_mul_left hb).mpr theorem Filter.TendstoNhdsWithinIio.const_mul [PosMulStrictMono 𝕜] [PosMulReflectLT 𝕜] (h : Tendsto f l (𝓝[<] c)) : Tendsto (fun a => b * f a) l (𝓝[<] (b * c)) := tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within _ ((tendsto_nhds_of_tendsto_nhdsWithin h).const_mul b) <| (tendsto_nhdsWithin_iff.mp h).2.mono fun _ => (mul_lt_mul_left hb).mpr theorem Filter.TendstoNhdsWithinIoi.mul_const [MulPosStrictMono 𝕜] [MulPosReflectLT 𝕜] (h : Tendsto f l (𝓝[>] c)) : Tendsto (fun a => f a * b) l (𝓝[>] (c * b)) := tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within _ ((tendsto_nhds_of_tendsto_nhdsWithin h).mul_const b) <| (tendsto_nhdsWithin_iff.mp h).2.mono fun _ => (mul_lt_mul_right hb).mpr theorem Filter.TendstoNhdsWithinIio.mul_const [MulPosStrictMono 𝕜] [MulPosReflectLT 𝕜] (h : Tendsto f l (𝓝[<] c)) : Tendsto (fun a => f a * b) l (𝓝[<] (c * b)) := tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within _ ((tendsto_nhds_of_tendsto_nhdsWithin h).mul_const b) <| (tendsto_nhdsWithin_iff.mp h).2.mono fun _ => (mul_lt_mul_right hb).mpr end tendsto_nhds @[to_additive] protected theorem Specializes.mul {a b c d : M} (hab : a ⤳ b) (hcd : c ⤳ d) : (a * c) ⤳ (b * d) := hab.smul hcd @[to_additive] protected theorem Inseparable.mul {a b c d : M} (hab : Inseparable a b) (hcd : Inseparable c d) : Inseparable (a * c) (b * d) := hab.smul hcd @[to_additive] protected theorem Specializes.pow {M : Type*} [Monoid M] [TopologicalSpace M] [ContinuousMul M] {a b : M} (h : a ⤳ b) (n : ℕ) : (a ^ n) ⤳ (b ^ n) := Nat.recOn n (by simp only [pow_zero, specializes_rfl]) fun _ ihn ↦ by simpa only [pow_succ] using ihn.mul h @[to_additive] protected theorem Inseparable.pow {M : Type*} [Monoid M] [TopologicalSpace M] [ContinuousMul M] {a b : M} (h : Inseparable a b) (n : ℕ) : Inseparable (a ^ n) (b ^ n) := (h.specializes.pow n).antisymm (h.specializes'.pow n) /-- Construct a unit from limits of units and their inverses. -/ @[to_additive (attr := simps) "Construct an additive unit from limits of additive units and their negatives."] def Filter.Tendsto.units [TopologicalSpace N] [Monoid N] [ContinuousMul N] [T2Space N] {f : ι → Nˣ} {r₁ r₂ : N} {l : Filter ι} [l.NeBot] (h₁ : Tendsto (fun x => ↑(f x)) l (𝓝 r₁)) (h₂ : Tendsto (fun x => ↑(f x)⁻¹) l (𝓝 r₂)) : Nˣ where val := r₁ inv := r₂ val_inv := by symm simpa using h₁.mul h₂ inv_val := by symm simpa using h₂.mul h₁ @[to_additive (attr := fun_prop)] theorem ContinuousAt.mul {f g : X → M} {x : X} (hf : ContinuousAt f x) (hg : ContinuousAt g x) : ContinuousAt (fun x => f x * g x) x := Filter.Tendsto.mul hf hg @[to_additive] theorem ContinuousWithinAt.mul {f g : X → M} {s : Set X} {x : X} (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) : ContinuousWithinAt (fun x => f x * g x) s x := Filter.Tendsto.mul hf hg @[to_additive] instance Prod.continuousMul [TopologicalSpace N] [Mul N] [ContinuousMul N] : ContinuousMul (M × N) := ⟨(continuous_fst.fst'.mul continuous_fst.snd').prod_mk (continuous_snd.fst'.mul continuous_snd.snd')⟩ @[to_additive] instance Pi.continuousMul {C : ι → Type*} [∀ i, TopologicalSpace (C i)] [∀ i, Mul (C i)] [∀ i, ContinuousMul (C i)] : ContinuousMul (∀ i, C i) where continuous_mul := continuous_pi fun i => (continuous_apply i).fst'.mul (continuous_apply i).snd' /-- A version of `Pi.continuousMul` for non-dependent functions. It is needed because sometimes Lean 3 fails to use `Pi.continuousMul` for non-dependent functions. -/ @[to_additive "A version of `Pi.continuousAdd` for non-dependent functions. It is needed because sometimes Lean fails to use `Pi.continuousAdd` for non-dependent functions."] instance Pi.continuousMul' : ContinuousMul (ι → M) := Pi.continuousMul @[to_additive] instance (priority := 100) continuousMul_of_discreteTopology [TopologicalSpace N] [Mul N] [DiscreteTopology N] : ContinuousMul N := ⟨continuous_of_discreteTopology⟩ open Filter open Function @[to_additive] theorem ContinuousMul.of_nhds_one {M : Type u} [Monoid M] [TopologicalSpace M] (hmul : Tendsto (uncurry ((· * ·) : M → M → M)) (𝓝 1 ×ˢ 𝓝 1) <| 𝓝 1) (hleft : ∀ x₀ : M, 𝓝 x₀ = map (fun x => x₀ * x) (𝓝 1)) (hright : ∀ x₀ : M, 𝓝 x₀ = map (fun x => x * x₀) (𝓝 1)) : ContinuousMul M := ⟨by rw [continuous_iff_continuousAt] rintro ⟨x₀, y₀⟩ have key : (fun p : M × M => x₀ * p.1 * (p.2 * y₀)) = ((fun x => x₀ * x) ∘ fun x => x * y₀) ∘ uncurry (· * ·) := by ext p simp [uncurry, mul_assoc] have key₂ : ((fun x => x₀ * x) ∘ fun x => y₀ * x) = fun x => x₀ * y₀ * x := by ext x simp [mul_assoc] calc map (uncurry (· * ·)) (𝓝 (x₀, y₀)) = map (uncurry (· * ·)) (𝓝 x₀ ×ˢ 𝓝 y₀) := by rw [nhds_prod_eq] _ = map (fun p : M × M => x₀ * p.1 * (p.2 * y₀)) (𝓝 1 ×ˢ 𝓝 1) := by -- Porting note: `rw` was able to prove this -- Now it fails with `failed to rewrite using equation theorems for 'Function.uncurry'` -- and `failed to rewrite using equation theorems for 'Function.comp'`. -- Removing those two lemmas, the `rw` would succeed, but then needs a `rfl`. simp (config := { unfoldPartialApp := true }) only [uncurry] simp_rw [hleft x₀, hright y₀, prod_map_map_eq, Filter.map_map, Function.comp_def] _ = map ((fun x => x₀ * x) ∘ fun x => x * y₀) (map (uncurry (· * ·)) (𝓝 1 ×ˢ 𝓝 1)) := by rw [key, ← Filter.map_map] _ ≤ map ((fun x : M => x₀ * x) ∘ fun x => x * y₀) (𝓝 1) := map_mono hmul _ = 𝓝 (x₀ * y₀) := by rw [← Filter.map_map, ← hright, hleft y₀, Filter.map_map, key₂, ← hleft]⟩ @[to_additive] theorem continuousMul_of_comm_of_nhds_one (M : Type u) [CommMonoid M] [TopologicalSpace M] (hmul : Tendsto (uncurry ((· * ·) : M → M → M)) (𝓝 1 ×ˢ 𝓝 1) (𝓝 1)) (hleft : ∀ x₀ : M, 𝓝 x₀ = map (fun x => x₀ * x) (𝓝 1)) : ContinuousMul M := by apply ContinuousMul.of_nhds_one hmul hleft intro x₀ simp_rw [mul_comm, hleft x₀] end ContinuousMul section PointwiseLimits variable (M₁ M₂ : Type*) [TopologicalSpace M₂] [T2Space M₂] @[to_additive] theorem isClosed_setOf_map_one [One M₁] [One M₂] : IsClosed { f : M₁ → M₂ | f 1 = 1 } := isClosed_eq (continuous_apply 1) continuous_const @[to_additive] theorem isClosed_setOf_map_mul [Mul M₁] [Mul M₂] [ContinuousMul M₂] : IsClosed { f : M₁ → M₂ | ∀ x y, f (x * y) = f x * f y } := by simp only [setOf_forall] exact isClosed_iInter fun x => isClosed_iInter fun y => isClosed_eq (continuous_apply _) -- Porting note: proof was: -- `((continuous_apply _).mul (continuous_apply _))` (by continuity) -- Porting note: split variables command over two lines, can't change explicitness at the same time -- as declaring new variables. variable {M₁ M₂} variable [MulOneClass M₁] [MulOneClass M₂] [ContinuousMul M₂] {F : Type*} [FunLike F M₁ M₂] [MonoidHomClass F M₁ M₂] {l : Filter α} /-- Construct a bundled monoid homomorphism `M₁ →* M₂` from a function `f` and a proof that it belongs to the closure of the range of the coercion from `M₁ →* M₂` (or another type of bundled homomorphisms that has a `MonoidHomClass` instance) to `M₁ → M₂`. -/ @[to_additive (attr := simps (config := .asFn)) "Construct a bundled additive monoid homomorphism `M₁ →+ M₂` from a function `f` and a proof that it belongs to the closure of the range of the coercion from `M₁ →+ M₂` (or another type of bundled homomorphisms that has an `AddMonoidHomClass` instance) to `M₁ → M₂`."] def monoidHomOfMemClosureRangeCoe (f : M₁ → M₂) (hf : f ∈ closure (range fun (f : F) (x : M₁) => f x)) : M₁ →* M₂ where toFun := f map_one' := (isClosed_setOf_map_one M₁ M₂).closure_subset_iff.2 (range_subset_iff.2 map_one) hf map_mul' := (isClosed_setOf_map_mul M₁ M₂).closure_subset_iff.2 (range_subset_iff.2 map_mul) hf /-- Construct a bundled monoid homomorphism from a pointwise limit of monoid homomorphisms. -/ @[to_additive (attr := simps! (config := .asFn)) "Construct a bundled additive monoid homomorphism from a pointwise limit of additive monoid homomorphisms"] def monoidHomOfTendsto (f : M₁ → M₂) (g : α → F) [l.NeBot] (h : Tendsto (fun a x => g a x) l (𝓝 f)) : M₁ →* M₂ := monoidHomOfMemClosureRangeCoe f <| mem_closure_of_tendsto h <| eventually_of_forall fun _ => mem_range_self _ variable (M₁ M₂) @[to_additive] theorem MonoidHom.isClosed_range_coe : IsClosed (Set.range ((↑) : (M₁ →* M₂) → M₁ → M₂)) := isClosed_of_closure_subset fun f hf => ⟨monoidHomOfMemClosureRangeCoe f hf, rfl⟩ end PointwiseLimits @[to_additive] theorem Inducing.continuousMul {M N F : Type*} [Mul M] [Mul N] [FunLike F M N] [MulHomClass F M N] [TopologicalSpace M] [TopologicalSpace N] [ContinuousMul N] (f : F) (hf : Inducing f) : ContinuousMul M := ⟨(hf.continuousSMul hf.continuous (map_mul f _ _)).1⟩ @[to_additive] theorem continuousMul_induced {M N F : Type*} [Mul M] [Mul N] [FunLike F M N] [MulHomClass F M N] [TopologicalSpace N] [ContinuousMul N] (f : F) : @ContinuousMul M (induced f ‹_›) _ := letI := induced f ‹_› Inducing.continuousMul f ⟨rfl⟩ @[to_additive] instance Subsemigroup.continuousMul [TopologicalSpace M] [Semigroup M] [ContinuousMul M] (S : Subsemigroup M) : ContinuousMul S := Inducing.continuousMul ({ toFun := (↑), map_mul' := fun _ _ => rfl} : MulHom S M) ⟨rfl⟩ @[to_additive] instance Submonoid.continuousMul [TopologicalSpace M] [Monoid M] [ContinuousMul M] (S : Submonoid M) : ContinuousMul S := S.toSubsemigroup.continuousMul section MulOneClass variable [TopologicalSpace M] [MulOneClass M] [ContinuousMul M] @[to_additive exists_open_nhds_zero_half] theorem exists_open_nhds_one_split {s : Set M} (hs : s ∈ 𝓝 (1 : M)) : ∃ V : Set M, IsOpen V ∧ (1 : M) ∈ V ∧ ∀ v ∈ V, ∀ w ∈ V, v * w ∈ s := by have : (fun a : M × M => a.1 * a.2) ⁻¹' s ∈ 𝓝 ((1, 1) : M × M) := tendsto_mul (by simpa only [one_mul] using hs) simpa only [prod_subset_iff] using exists_nhds_square this @[to_additive exists_nhds_zero_half] theorem exists_nhds_one_split {s : Set M} (hs : s ∈ 𝓝 (1 : M)) : ∃ V ∈ 𝓝 (1 : M), ∀ v ∈ V, ∀ w ∈ V, v * w ∈ s := let ⟨V, Vo, V1, hV⟩ := exists_open_nhds_one_split hs ⟨V, IsOpen.mem_nhds Vo V1, hV⟩ /-- Given a neighborhood `U` of `1` there is an open neighborhood `V` of `1` such that `V * V ⊆ U`. -/ @[to_additive "Given an open neighborhood `U` of `0` there is an open neighborhood `V` of `0` such that `V + V ⊆ U`."] theorem exists_open_nhds_one_mul_subset {U : Set M} (hU : U ∈ 𝓝 (1 : M)) : ∃ V : Set M, IsOpen V ∧ (1 : M) ∈ V ∧ V * V ⊆ U := by simpa only [mul_subset_iff] using exists_open_nhds_one_split hU end MulOneClass section ContinuousMul variable [TopologicalSpace M] [Monoid M] [ContinuousMul M] @[to_additive] theorem Submonoid.top_closure_mul_self_subset (s : Submonoid M) : _root_.closure (s : Set M) * _root_.closure s ⊆ _root_.closure s := image2_subset_iff.2 fun _ hx _ hy => map_mem_closure₂ continuous_mul hx hy fun _ ha _ hb => s.mul_mem ha hb @[to_additive] theorem Submonoid.top_closure_mul_self_eq (s : Submonoid M) : _root_.closure (s : Set M) * _root_.closure s = _root_.closure s := Subset.antisymm s.top_closure_mul_self_subset fun x hx => ⟨x, hx, 1, _root_.subset_closure s.one_mem, mul_one _⟩ /-- The (topological-space) closure of a submonoid of a space `M` with `ContinuousMul` is itself a submonoid. -/ @[to_additive "The (topological-space) closure of an additive submonoid of a space `M` with `ContinuousAdd` is itself an additive submonoid."] def Submonoid.topologicalClosure (s : Submonoid M) : Submonoid M where carrier := _root_.closure (s : Set M) one_mem' := _root_.subset_closure s.one_mem mul_mem' ha hb := s.top_closure_mul_self_subset ⟨_, ha, _, hb, rfl⟩ @[to_additive] theorem Submonoid.coe_topologicalClosure (s : Submonoid M) : (s.topologicalClosure : Set M) = _root_.closure (s : Set M) := rfl @[to_additive] theorem Submonoid.le_topologicalClosure (s : Submonoid M) : s ≤ s.topologicalClosure := _root_.subset_closure @[to_additive] theorem Submonoid.isClosed_topologicalClosure (s : Submonoid M) : IsClosed (s.topologicalClosure : Set M) := isClosed_closure @[to_additive] theorem Submonoid.topologicalClosure_minimal (s : Submonoid M) {t : Submonoid M} (h : s ≤ t) (ht : IsClosed (t : Set M)) : s.topologicalClosure ≤ t := closure_minimal h ht /-- If a submonoid of a topological monoid is commutative, then so is its topological closure. -/ @[to_additive "If a submonoid of an additive topological monoid is commutative, then so is its topological closure."] def Submonoid.commMonoidTopologicalClosure [T2Space M] (s : Submonoid M) (hs : ∀ x y : s, x * y = y * x) : CommMonoid s.topologicalClosure := { s.topologicalClosure.toMonoid with mul_comm := have : ∀ x ∈ s, ∀ y ∈ s, x * y = y * x := fun x hx y hy => congr_arg Subtype.val (hs ⟨x, hx⟩ ⟨y, hy⟩) fun ⟨x, hx⟩ ⟨y, hy⟩ => Subtype.ext <| eqOn_closure₂ this continuous_mul (continuous_snd.mul continuous_fst) x hx y hy } @[to_additive exists_nhds_zero_quarter] theorem exists_nhds_one_split4 {u : Set M} (hu : u ∈ 𝓝 (1 : M)) : ∃ V ∈ 𝓝 (1 : M), ∀ {v w s t}, v ∈ V → w ∈ V → s ∈ V → t ∈ V → v * w * s * t ∈ u := by rcases exists_nhds_one_split hu with ⟨W, W1, h⟩ rcases exists_nhds_one_split W1 with ⟨V, V1, h'⟩ use V, V1 intro v w s t v_in w_in s_in t_in simpa only [mul_assoc] using h _ (h' v v_in w w_in) _ (h' s s_in t t_in) @[to_additive] theorem IsCompact.mul {s t : Set M} (hs : IsCompact s) (ht : IsCompact t) : IsCompact (s * t) := by rw [← image_mul_prod] exact (hs.prod ht).image continuous_mul @[to_additive] theorem tendsto_list_prod {f : ι → α → M} {x : Filter α} {a : ι → M} : ∀ l : List ι, (∀ i ∈ l, Tendsto (f i) x (𝓝 (a i))) → Tendsto (fun b => (l.map fun c => f c b).prod) x (𝓝 (l.map a).prod) | [], _ => by simp [tendsto_const_nhds] | f::l, h => by simp only [List.map_cons, List.prod_cons] exact (h f (List.mem_cons_self _ _)).mul (tendsto_list_prod l fun c hc => h c (List.mem_cons_of_mem _ hc)) @[to_additive (attr := continuity)] theorem continuous_list_prod {f : ι → X → M} (l : List ι) (h : ∀ i ∈ l, Continuous (f i)) : Continuous fun a => (l.map fun i => f i a).prod := continuous_iff_continuousAt.2 fun x => tendsto_list_prod l fun c hc => continuous_iff_continuousAt.1 (h c hc) x @[to_additive] theorem continuousOn_list_prod {f : ι → X → M} (l : List ι) {t : Set X} (h : ∀ i ∈ l, ContinuousOn (f i) t) : ContinuousOn (fun a => (l.map fun i => f i a).prod) t := by intro x hx rw [continuousWithinAt_iff_continuousAt_restrict _ hx] refine tendsto_list_prod _ fun i hi => ?_ specialize h i hi x hx rw [continuousWithinAt_iff_continuousAt_restrict _ hx] at h exact h @[to_additive (attr := continuity)] theorem continuous_pow : ∀ n : ℕ, Continuous fun a : M => a ^ n | 0 => by simpa using continuous_const | k + 1 => by simp only [pow_succ'] exact continuous_id.mul (continuous_pow _) instance AddMonoid.continuousConstSMul_nat {A} [AddMonoid A] [TopologicalSpace A] [ContinuousAdd A] : ContinuousConstSMul ℕ A := ⟨continuous_nsmul⟩ instance AddMonoid.continuousSMul_nat {A} [AddMonoid A] [TopologicalSpace A] [ContinuousAdd A] : ContinuousSMul ℕ A := ⟨continuous_prod_of_discrete_left.mpr continuous_nsmul⟩ -- We register `Continuous.pow` as a `continuity` lemma with low penalty (so -- `continuity` will try it before other `continuity` lemmas). This is a -- workaround for goals of the form `Continuous fun x => x ^ 2`, where -- `continuity` applies `Continuous.mul` since the goal is defeq to -- `Continuous fun x => x * x`. -- -- To properly fix this, we should make sure that `continuity` applies its -- lemmas with reducible transparency, preventing the unfolding of `^`. But this -- is quite an invasive change. @[to_additive (attr := aesop safe -100 (rule_sets := [Continuous]), fun_prop)] theorem Continuous.pow {f : X → M} (h : Continuous f) (n : ℕ) : Continuous fun b => f b ^ n := (continuous_pow n).comp h @[to_additive] theorem continuousOn_pow {s : Set M} (n : ℕ) : ContinuousOn (fun (x : M) => x ^ n) s := (continuous_pow n).continuousOn @[to_additive] theorem continuousAt_pow (x : M) (n : ℕ) : ContinuousAt (fun (x : M) => x ^ n) x := (continuous_pow n).continuousAt @[to_additive] theorem Filter.Tendsto.pow {l : Filter α} {f : α → M} {x : M} (hf : Tendsto f l (𝓝 x)) (n : ℕ) : Tendsto (fun x => f x ^ n) l (𝓝 (x ^ n)) := (continuousAt_pow _ _).tendsto.comp hf @[to_additive] theorem ContinuousWithinAt.pow {f : X → M} {x : X} {s : Set X} (hf : ContinuousWithinAt f s x) (n : ℕ) : ContinuousWithinAt (fun x => f x ^ n) s x := Filter.Tendsto.pow hf n @[to_additive (attr := fun_prop)] theorem ContinuousAt.pow {f : X → M} {x : X} (hf : ContinuousAt f x) (n : ℕ) : ContinuousAt (fun x => f x ^ n) x := Filter.Tendsto.pow hf n @[to_additive (attr := fun_prop)] theorem ContinuousOn.pow {f : X → M} {s : Set X} (hf : ContinuousOn f s) (n : ℕ) : ContinuousOn (fun x => f x ^ n) s := fun x hx => (hf x hx).pow n /-- Left-multiplication by a left-invertible element of a topological monoid is proper, i.e., inverse images of compact sets are compact. -/ theorem Filter.tendsto_cocompact_mul_left {a b : M} (ha : b * a = 1) : Filter.Tendsto (fun x : M => a * x) (Filter.cocompact M) (Filter.cocompact M) := by refine Filter.Tendsto.of_tendsto_comp ?_ (Filter.comap_cocompact_le (continuous_mul_left b)) convert Filter.tendsto_id ext x simp [← mul_assoc, ha] /-- Right-multiplication by a right-invertible element of a topological monoid is proper, i.e., inverse images of compact sets are compact. -/ theorem Filter.tendsto_cocompact_mul_right {a b : M} (ha : a * b = 1) : Filter.Tendsto (fun x : M => x * a) (Filter.cocompact M) (Filter.cocompact M) := by refine Filter.Tendsto.of_tendsto_comp ?_ (Filter.comap_cocompact_le (continuous_mul_right b)) simp only [comp_mul_right, ha, mul_one] exact Filter.tendsto_id -- Porting note: changed proof /-- If `R` acts on `A` via `A`, then continuous multiplication implies continuous scalar multiplication by constants. Notably, this instances applies when `R = A`, or when `[Algebra R A]` is available. -/ @[to_additive "If `R` acts on `A` via `A`, then continuous addition implies continuous affine addition by constants."] instance (priority := 100) IsScalarTower.continuousConstSMul {R A : Type*} [Monoid A] [SMul R A] [IsScalarTower R A A] [TopologicalSpace A] [ContinuousMul A] : ContinuousConstSMul R A where continuous_const_smul q := by simp (config := { singlePass := true }) only [← smul_one_mul q (_ : A)] exact continuous_const.mul continuous_id /-- If the action of `R` on `A` commutes with left-multiplication, then continuous multiplication implies continuous scalar multiplication by constants. Notably, this instances applies when `R = Aᵐᵒᵖ`. -/ @[to_additive "If the action of `R` on `A` commutes with left-addition, then continuous addition implies continuous affine addition by constants. Notably, this instances applies when `R = Aᵃᵒᵖ`."] instance (priority := 100) SMulCommClass.continuousConstSMul {R A : Type*} [Monoid A] [SMul R A] [SMulCommClass R A A] [TopologicalSpace A] [ContinuousMul A] : ContinuousConstSMul R A where continuous_const_smul q := by simp (config := { singlePass := true }) only [← mul_smul_one q (_ : A)] exact continuous_id.mul continuous_const end ContinuousMul namespace MulOpposite /-- If multiplication is continuous in `α`, then it also is in `αᵐᵒᵖ`. -/ @[to_additive "If addition is continuous in `α`, then it also is in `αᵃᵒᵖ`."] instance [TopologicalSpace α] [Mul α] [ContinuousMul α] : ContinuousMul αᵐᵒᵖ := ⟨continuous_op.comp (continuous_unop.snd'.mul continuous_unop.fst')⟩ end MulOpposite namespace Units open MulOpposite variable [TopologicalSpace α] [Monoid α] [ContinuousMul α] /-- If multiplication on a monoid is continuous, then multiplication on the units of the monoid, with respect to the induced topology, is continuous. Inversion is also continuous, but we register this in a later file, `Topology.Algebra.Group`, because the predicate `ContinuousInv` has not yet been defined. -/ @[to_additive "If addition on an additive monoid is continuous, then addition on the additive units of the monoid, with respect to the induced topology, is continuous. Negation is also continuous, but we register this in a later file, `Topology.Algebra.Group`, because the predicate `ContinuousNeg` has not yet been defined."] instance : ContinuousMul αˣ := inducing_embedProduct.continuousMul (embedProduct α) end Units @[to_additive] theorem Continuous.units_map [Monoid M] [Monoid N] [TopologicalSpace M] [TopologicalSpace N] (f : M →* N) (hf : Continuous f) : Continuous (Units.map f) := Units.continuous_iff.2 ⟨hf.comp Units.continuous_val, hf.comp Units.continuous_coe_inv⟩ section variable [TopologicalSpace M] [CommMonoid M] @[to_additive] theorem Submonoid.mem_nhds_one (S : Submonoid M) (oS : IsOpen (S : Set M)) : (S : Set M) ∈ 𝓝 (1 : M) := IsOpen.mem_nhds oS S.one_mem variable [ContinuousMul M] @[to_additive] theorem tendsto_multiset_prod {f : ι → α → M} {x : Filter α} {a : ι → M} (s : Multiset ι) : (∀ i ∈ s, Tendsto (f i) x (𝓝 (a i))) → Tendsto (fun b => (s.map fun c => f c b).prod) x (𝓝 (s.map a).prod) := by rcases s with ⟨l⟩ simpa using tendsto_list_prod l @[to_additive] theorem tendsto_finset_prod {f : ι → α → M} {x : Filter α} {a : ι → M} (s : Finset ι) : (∀ i ∈ s, Tendsto (f i) x (𝓝 (a i))) → Tendsto (fun b => ∏ c ∈ s, f c b) x (𝓝 (∏ c ∈ s, a c)) := tendsto_multiset_prod _ @[to_additive (attr := continuity)] theorem continuous_multiset_prod {f : ι → X → M} (s : Multiset ι) : (∀ i ∈ s, Continuous (f i)) → Continuous fun a => (s.map fun i => f i a).prod := by rcases s with ⟨l⟩ simpa using continuous_list_prod l @[to_additive] theorem continuousOn_multiset_prod {f : ι → X → M} (s : Multiset ι) {t : Set X} : (∀ i ∈ s, ContinuousOn (f i) t) → ContinuousOn (fun a => (s.map fun i => f i a).prod) t := by rcases s with ⟨l⟩ simpa using continuousOn_list_prod l @[to_additive (attr := continuity, fun_prop)] theorem continuous_finset_prod {f : ι → X → M} (s : Finset ι) : (∀ i ∈ s, Continuous (f i)) → Continuous fun a => ∏ i ∈ s, f i a := continuous_multiset_prod _ @[to_additive] theorem continuousOn_finset_prod {f : ι → X → M} (s : Finset ι) {t : Set X} : (∀ i ∈ s, ContinuousOn (f i) t) → ContinuousOn (fun a => ∏ i ∈ s, f i a) t := continuousOn_multiset_prod _ @[to_additive] theorem eventuallyEq_prod {X M : Type*} [CommMonoid M] {s : Finset ι} {l : Filter X} {f g : ι → X → M} (hs : ∀ i ∈ s, f i =ᶠ[l] g i) : ∏ i ∈ s, f i =ᶠ[l] ∏ i ∈ s, g i := by replace hs : ∀ᶠ x in l, ∀ i ∈ s, f i x = g i x := by rwa [eventually_all_finset] filter_upwards [hs] with x hx simp only [Finset.prod_apply, Finset.prod_congr rfl hx] open Function @[to_additive] theorem LocallyFinite.exists_finset_mulSupport {M : Type*} [CommMonoid M] {f : ι → X → M} (hf : LocallyFinite fun i => mulSupport <| f i) (x₀ : X) : ∃ I : Finset ι, ∀ᶠ x in 𝓝 x₀, (mulSupport fun i => f i x) ⊆ I := by rcases hf x₀ with ⟨U, hxU, hUf⟩ refine ⟨hUf.toFinset, mem_of_superset hxU fun y hy i hi => ?_⟩ rw [hUf.coe_toFinset] exact ⟨y, hi, hy⟩ @[to_additive] theorem finprod_eventually_eq_prod {M : Type*} [CommMonoid M] {f : ι → X → M} (hf : LocallyFinite fun i => mulSupport (f i)) (x : X) : ∃ s : Finset ι, ∀ᶠ y in 𝓝 x, ∏ᶠ i, f i y = ∏ i ∈ s, f i y := let ⟨I, hI⟩ := hf.exists_finset_mulSupport x ⟨I, hI.mono fun _ hy => finprod_eq_prod_of_mulSupport_subset _ fun _ hi => hy hi⟩ @[to_additive] theorem continuous_finprod {f : ι → X → M} (hc : ∀ i, Continuous (f i)) (hf : LocallyFinite fun i => mulSupport (f i)) : Continuous fun x => ∏ᶠ i, f i x := by refine continuous_iff_continuousAt.2 fun x => ?_ rcases finprod_eventually_eq_prod hf x with ⟨s, hs⟩ refine ContinuousAt.congr ?_ (EventuallyEq.symm hs) exact tendsto_finset_prod _ fun i _ => (hc i).continuousAt @[to_additive] theorem continuous_finprod_cond {f : ι → X → M} {p : ι → Prop} (hc : ∀ i, p i → Continuous (f i)) (hf : LocallyFinite fun i => mulSupport (f i)) : Continuous fun x => ∏ᶠ (i) (_ : p i), f i x := by simp only [← finprod_subtype_eq_finprod_cond] exact continuous_finprod (fun i => hc i i.2) (hf.comp_injective Subtype.coe_injective) end instance [TopologicalSpace M] [Mul M] [ContinuousMul M] : ContinuousAdd (Additive M) where continuous_add := @continuous_mul M _ _ _ instance [TopologicalSpace M] [Add M] [ContinuousAdd M] : ContinuousMul (Multiplicative M) where continuous_mul := @continuous_add M _ _ _ section LatticeOps variable {ι' : Sort*} [Mul M] @[to_additive] theorem continuousMul_sInf {ts : Set (TopologicalSpace M)} (h : ∀ t ∈ ts, @ContinuousMul M t _) : @ContinuousMul M (sInf ts) _ := letI := sInf ts { continuous_mul := continuous_sInf_rng.2 fun t ht => continuous_sInf_dom₂ ht ht (@ContinuousMul.continuous_mul M t _ (h t ht)) } @[to_additive] theorem continuousMul_iInf {ts : ι' → TopologicalSpace M} (h' : ∀ i, @ContinuousMul M (ts i) _) : @ContinuousMul M (⨅ i, ts i) _ := by rw [← sInf_range] exact continuousMul_sInf (Set.forall_mem_range.mpr h') @[to_additive] theorem continuousMul_inf {t₁ t₂ : TopologicalSpace M} (h₁ : @ContinuousMul M t₁ _) (h₂ : @ContinuousMul M t₂ _) : @ContinuousMul M (t₁ ⊓ t₂) _ := by rw [inf_eq_iInf] refine continuousMul_iInf fun b => ?_ cases b <;> assumption end LatticeOps namespace ContinuousMap variable [Mul X] [ContinuousMul X] /-- The continuous map `fun y => y * x` -/ @[to_additive "The continuous map `fun y => y + x`"] protected def mulRight (x : X) : C(X, X) := mk _ (continuous_mul_right x) @[to_additive (attr := simp)] theorem coe_mulRight (x : X) : ⇑(ContinuousMap.mulRight x) = fun y => y * x := rfl /-- The continuous map `fun y => x * y` -/ @[to_additive "The continuous map `fun y => x + y`"] protected def mulLeft (x : X) : C(X, X) := mk _ (continuous_mul_left x) @[to_additive (attr := simp)] theorem coe_mulLeft (x : X) : ⇑(ContinuousMap.mulLeft x) = fun y => x * y := rfl end ContinuousMap
Topology\Algebra\MulAction.lean
/- Copyright (c) 2021 Yury Kudryashov. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yury Kudryashov -/ import Mathlib.Algebra.AddTorsor import Mathlib.Topology.Algebra.Constructions import Mathlib.GroupTheory.GroupAction.SubMulAction import Mathlib.Topology.Algebra.ConstMulAction /-! # Continuous monoid action In this file we define class `ContinuousSMul`. We say `ContinuousSMul M X` if `M` acts on `X` and the map `(c, x) ↦ c • x` is continuous on `M × X`. We reuse this class for topological (semi)modules, vector spaces and algebras. ## Main definitions * `ContinuousSMul M X` : typeclass saying that the map `(c, x) ↦ c • x` is continuous on `M × X`; * `Units.continuousSMul`: scalar multiplication by `Mˣ` is continuous when scalar multiplication by `M` is continuous. This allows `Homeomorph.smul` to be used with on monoids with `G = Mˣ`. -- Porting note: These have all moved * `Homeomorph.smul_of_ne_zero`: if a group with zero `G₀` (e.g., a field) acts on `X` and `c : G₀` is a nonzero element of `G₀`, then scalar multiplication by `c` is a homeomorphism of `X`; * `Homeomorph.smul`: scalar multiplication by an element of a group `G` acting on `X` is a homeomorphism of `X`. ## Main results Besides homeomorphisms mentioned above, in this file we provide lemmas like `Continuous.smul` or `Filter.Tendsto.smul` that provide dot-syntax access to `ContinuousSMul`. -/ open Topology Pointwise open Filter /-- Class `ContinuousSMul M X` says that the scalar multiplication `(•) : M → X → X` is continuous in both arguments. We use the same class for all kinds of multiplicative actions, including (semi)modules and algebras. -/ class ContinuousSMul (M X : Type*) [SMul M X] [TopologicalSpace M] [TopologicalSpace X] : Prop where /-- The scalar multiplication `(•)` is continuous. -/ continuous_smul : Continuous fun p : M × X => p.1 • p.2 export ContinuousSMul (continuous_smul) /-- Class `ContinuousVAdd M X` says that the additive action `(+ᵥ) : M → X → X` is continuous in both arguments. We use the same class for all kinds of additive actions, including (semi)modules and algebras. -/ class ContinuousVAdd (M X : Type*) [VAdd M X] [TopologicalSpace M] [TopologicalSpace X] : Prop where /-- The additive action `(+ᵥ)` is continuous. -/ continuous_vadd : Continuous fun p : M × X => p.1 +ᵥ p.2 export ContinuousVAdd (continuous_vadd) attribute [to_additive] ContinuousSMul attribute [continuity, fun_prop] continuous_smul continuous_vadd section Main variable {M X Y α : Type*} [TopologicalSpace M] [TopologicalSpace X] [TopologicalSpace Y] section SMul variable [SMul M X] [ContinuousSMul M X] @[to_additive] instance : ContinuousSMul (ULift M) X := ⟨(continuous_smul (M := M)).comp₂ (continuous_uLift_down.comp continuous_fst) continuous_snd⟩ @[to_additive] instance (priority := 100) ContinuousSMul.continuousConstSMul : ContinuousConstSMul M X where continuous_const_smul _ := continuous_smul.comp (continuous_const.prod_mk continuous_id) theorem ContinuousSMul.induced {R : Type*} {α : Type*} {β : Type*} {F : Type*} [FunLike F α β] [Semiring R] [AddCommMonoid α] [AddCommMonoid β] [Module R α] [Module R β] [TopologicalSpace R] [LinearMapClass F R α β] [tβ : TopologicalSpace β] [ContinuousSMul R β] (f : F) : @ContinuousSMul R α _ _ (tβ.induced f) := by let tα := tβ.induced f refine ⟨continuous_induced_rng.2 ?_⟩ simp only [Function.comp, map_smul] fun_prop @[to_additive] theorem Filter.Tendsto.smul {f : α → M} {g : α → X} {l : Filter α} {c : M} {a : X} (hf : Tendsto f l (𝓝 c)) (hg : Tendsto g l (𝓝 a)) : Tendsto (fun x => f x • g x) l (𝓝 <| c • a) := (continuous_smul.tendsto _).comp (hf.prod_mk_nhds hg) @[to_additive] theorem Filter.Tendsto.smul_const {f : α → M} {l : Filter α} {c : M} (hf : Tendsto f l (𝓝 c)) (a : X) : Tendsto (fun x => f x • a) l (𝓝 (c • a)) := hf.smul tendsto_const_nhds variable {f : Y → M} {g : Y → X} {b : Y} {s : Set Y} @[to_additive] theorem ContinuousWithinAt.smul (hf : ContinuousWithinAt f s b) (hg : ContinuousWithinAt g s b) : ContinuousWithinAt (fun x => f x • g x) s b := Filter.Tendsto.smul hf hg @[to_additive (attr := fun_prop)] theorem ContinuousAt.smul (hf : ContinuousAt f b) (hg : ContinuousAt g b) : ContinuousAt (fun x => f x • g x) b := Filter.Tendsto.smul hf hg @[to_additive (attr := fun_prop)] theorem ContinuousOn.smul (hf : ContinuousOn f s) (hg : ContinuousOn g s) : ContinuousOn (fun x => f x • g x) s := fun x hx => (hf x hx).smul (hg x hx) @[to_additive (attr := continuity, fun_prop)] theorem Continuous.smul (hf : Continuous f) (hg : Continuous g) : Continuous fun x => f x • g x := continuous_smul.comp (hf.prod_mk hg) /-- If a scalar action is central, then its right action is continuous when its left action is. -/ @[to_additive "If an additive action is central, then its right action is continuous when its left action is."] instance ContinuousSMul.op [SMul Mᵐᵒᵖ X] [IsCentralScalar M X] : ContinuousSMul Mᵐᵒᵖ X := ⟨by suffices Continuous fun p : M × X => MulOpposite.op p.fst • p.snd from this.comp (MulOpposite.continuous_unop.prod_map continuous_id) simpa only [op_smul_eq_smul] using (continuous_smul : Continuous fun p : M × X => _)⟩ @[to_additive] instance MulOpposite.continuousSMul : ContinuousSMul M Xᵐᵒᵖ := ⟨MulOpposite.continuous_op.comp <| continuous_smul.comp <| continuous_id.prod_map MulOpposite.continuous_unop⟩ @[to_additive] protected theorem Specializes.smul {a b : M} {x y : X} (h₁ : a ⤳ b) (h₂ : x ⤳ y) : (a • x) ⤳ (b • y) := (h₁.prod h₂).map continuous_smul @[to_additive] protected theorem Inseparable.smul {a b : M} {x y : X} (h₁ : Inseparable a b) (h₂ : Inseparable x y) : Inseparable (a • x) (b • y) := (h₁.prod h₂).map continuous_smul @[to_additive] lemma IsCompact.smul_set {k : Set M} {u : Set X} (hk : IsCompact k) (hu : IsCompact u) : IsCompact (k • u) := by rw [← Set.image_smul_prod] exact IsCompact.image (hk.prod hu) continuous_smul @[to_additive] lemma smul_set_closure_subset (K : Set M) (L : Set X) : closure K • closure L ⊆ closure (K • L) := Set.smul_subset_iff.2 fun _x hx _y hy ↦ map_mem_closure₂ continuous_smul hx hy fun _a ha _b hb ↦ Set.smul_mem_smul ha hb /-- Suppose that `N` acts on `X` and `M` continuously acts on `Y`. Suppose that `g : Y → X` is an action homomorphism in the following sense: there exists a continuous function `f : N → M` such that `g (c • x) = f c • g x`. Then the action of `N` on `X` is continuous as well. In many cases, `f = id` so that `g` is an action homomorphism in the sense of `MulActionHom`. However, this version also works for semilinear maps and `f = Units.val`. -/ @[to_additive "Suppose that `N` additively acts on `X` and `M` continuously additively acts on `Y`. Suppose that `g : Y → X` is an additive action homomorphism in the following sense: there exists a continuous function `f : N → M` such that `g (c +ᵥ x) = f c +ᵥ g x`. Then the action of `N` on `X` is continuous as well. In many cases, `f = id` so that `g` is an action homomorphism in the sense of `AddActionHom`. However, this version also works for `f = AddUnits.val`."] lemma Inducing.continuousSMul {N : Type*} [SMul N Y] [TopologicalSpace N] {f : N → M} (hg : Inducing g) (hf : Continuous f) (hsmul : ∀ {c x}, g (c • x) = f c • g x) : ContinuousSMul N Y where continuous_smul := by simpa only [hg.continuous_iff, Function.comp_def, hsmul] using (hf.comp continuous_fst).smul <| hg.continuous.comp continuous_snd @[to_additive] instance SMulMemClass.continuousSMul {S : Type*} [SetLike S X] [SMulMemClass S M X] (s : S) : ContinuousSMul M s := inducing_subtype_val.continuousSMul continuous_id rfl end SMul section Monoid variable [Monoid M] [MulAction M X] [ContinuousSMul M X] @[to_additive] instance Units.continuousSMul : ContinuousSMul Mˣ X := inducing_id.continuousSMul Units.continuous_val rfl /-- If an action is continuous, then composing this action with a continuous homomorphism gives again a continuous action. -/ @[to_additive] theorem MulAction.continuousSMul_compHom {N : Type*} [TopologicalSpace N] [Monoid N] {f : N →* M} (hf : Continuous f) : letI : MulAction N X := MulAction.compHom _ f ContinuousSMul N X := by let _ : MulAction N X := MulAction.compHom _ f exact ⟨(hf.comp continuous_fst).smul continuous_snd⟩ @[to_additive] instance Submonoid.continuousSMul {S : Submonoid M} : ContinuousSMul S X := inducing_id.continuousSMul continuous_subtype_val rfl end Monoid section Group variable [Group M] [MulAction M X] [ContinuousSMul M X] @[to_additive] instance Subgroup.continuousSMul {S : Subgroup M} : ContinuousSMul S X := S.toSubmonoid.continuousSMul end Group @[to_additive] instance Prod.continuousSMul [SMul M X] [SMul M Y] [ContinuousSMul M X] [ContinuousSMul M Y] : ContinuousSMul M (X × Y) := ⟨(continuous_fst.smul (continuous_fst.comp continuous_snd)).prod_mk (continuous_fst.smul (continuous_snd.comp continuous_snd))⟩ @[to_additive] instance {ι : Type*} {γ : ι → Type*} [∀ i, TopologicalSpace (γ i)] [∀ i, SMul M (γ i)] [∀ i, ContinuousSMul M (γ i)] : ContinuousSMul M (∀ i, γ i) := ⟨continuous_pi fun i => (continuous_fst.smul continuous_snd).comp <| continuous_fst.prod_mk ((continuous_apply i).comp continuous_snd)⟩ end Main section LatticeOps variable {ι : Sort*} {M X : Type*} [TopologicalSpace M] [SMul M X] @[to_additive] theorem continuousSMul_sInf {ts : Set (TopologicalSpace X)} (h : ∀ t ∈ ts, @ContinuousSMul M X _ _ t) : @ContinuousSMul M X _ _ (sInf ts) := -- Porting note: {} doesn't work because `sInf ts` isn't found by TC search. `(_)` finds it by -- unification instead. @ContinuousSMul.mk M X _ _ (_) <| by -- Porting note: needs `( :)` rw [← (@sInf_singleton _ _ ‹TopologicalSpace M›:)] exact continuous_sInf_rng.2 fun t ht => continuous_sInf_dom₂ (Eq.refl _) ht (@ContinuousSMul.continuous_smul _ _ _ _ t (h t ht)) @[to_additive] theorem continuousSMul_iInf {ts' : ι → TopologicalSpace X} (h : ∀ i, @ContinuousSMul M X _ _ (ts' i)) : @ContinuousSMul M X _ _ (⨅ i, ts' i) := continuousSMul_sInf <| Set.forall_mem_range.mpr h @[to_additive] theorem continuousSMul_inf {t₁ t₂ : TopologicalSpace X} [@ContinuousSMul M X _ _ t₁] [@ContinuousSMul M X _ _ t₂] : @ContinuousSMul M X _ _ (t₁ ⊓ t₂) := by rw [inf_eq_iInf] refine continuousSMul_iInf fun b => ?_ cases b <;> assumption end LatticeOps section AddTorsor variable (G : Type*) (P : Type*) [AddGroup G] [AddTorsor G P] [TopologicalSpace G] variable [PreconnectedSpace G] [TopologicalSpace P] [ContinuousVAdd G P] /-- An `AddTorsor` for a connected space is a connected space. This is not an instance because it loops for a group as a torsor over itself. -/ protected theorem AddTorsor.connectedSpace : ConnectedSpace P := { isPreconnected_univ := by convert isPreconnected_univ.image (Equiv.vaddConst (Classical.arbitrary P) : G → P) (continuous_id.vadd continuous_const).continuousOn rw [Set.image_univ, Equiv.range_eq_univ] toNonempty := inferInstance } end AddTorsor
Topology\Algebra\MvPolynomial.lean
/- Copyright (c) 2023 Ruben Van de Velde. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Ruben Van de Velde -/ import Mathlib.Algebra.MvPolynomial.Basic import Mathlib.Topology.Algebra.Ring.Basic /-! # Multivariate polynomials and continuity In this file we prove the following lemma: * `MvPolynomial.continuous_eval`: `MvPolynomial.eval` is continuous ## Tags multivariate polynomial, continuity -/ variable {X σ : Type*} [TopologicalSpace X] [CommSemiring X] [TopologicalSemiring X] (p : MvPolynomial σ X) theorem MvPolynomial.continuous_eval : Continuous fun x ↦ eval x p := by continuity
Topology\Algebra\OpenSubgroup.lean
/- Copyright (c) 2019 Johan Commelin. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johan Commelin -/ import Mathlib.RingTheory.Ideal.Basic import Mathlib.Topology.Algebra.Ring.Basic import Mathlib.Topology.Sets.Opens /-! # Open subgroups of a topological groups This files builds the lattice `OpenSubgroup G` of open subgroups in a topological group `G`, and its additive version `OpenAddSubgroup`. This lattice has a top element, the subgroup of all elements, but no bottom element in general. The trivial subgroup which is the natural candidate bottom has no reason to be open (this happens only in discrete groups). Note that this notion is especially relevant in a non-archimedean context, for instance for `p`-adic groups. ## Main declarations * `OpenSubgroup.isClosed`: An open subgroup is automatically closed. * `Subgroup.isOpen_mono`: A subgroup containing an open subgroup is open. There are also versions for additive groups, submodules and ideals. * `OpenSubgroup.comap`: Open subgroups can be pulled back by a continuous group morphism. ## TODO * Prove that the identity component of a locally path connected group is an open subgroup. Up to now this file is really geared towards non-archimedean algebra, not Lie groups. -/ open TopologicalSpace Topology Function /-- The type of open subgroups of a topological additive group. -/ structure OpenAddSubgroup (G : Type*) [AddGroup G] [TopologicalSpace G] extends AddSubgroup G where isOpen' : IsOpen carrier /-- The type of open subgroups of a topological group. -/ @[to_additive] structure OpenSubgroup (G : Type*) [Group G] [TopologicalSpace G] extends Subgroup G where isOpen' : IsOpen carrier /-- Reinterpret an `OpenSubgroup` as a `Subgroup`. -/ add_decl_doc OpenSubgroup.toSubgroup /-- Reinterpret an `OpenAddSubgroup` as an `AddSubgroup`. -/ add_decl_doc OpenAddSubgroup.toAddSubgroup attribute [coe] OpenSubgroup.toSubgroup OpenAddSubgroup.toAddSubgroup namespace OpenSubgroup variable {G : Type*} [Group G] [TopologicalSpace G] variable {U V : OpenSubgroup G} {g : G} @[to_additive] instance hasCoeSubgroup : CoeTC (OpenSubgroup G) (Subgroup G) := ⟨toSubgroup⟩ @[to_additive] theorem toSubgroup_injective : Injective ((↑) : OpenSubgroup G → Subgroup G) | ⟨_, _⟩, ⟨_, _⟩, rfl => rfl @[to_additive] instance : SetLike (OpenSubgroup G) G where coe U := U.1 coe_injective' _ _ h := toSubgroup_injective <| SetLike.ext' h @[to_additive] instance : SubgroupClass (OpenSubgroup G) G where mul_mem := Subsemigroup.mul_mem' _ one_mem U := U.one_mem' inv_mem := Subgroup.inv_mem' _ /-- Coercion from `OpenSubgroup G` to `Opens G`. -/ @[to_additive (attr := coe) "Coercion from `OpenAddSubgroup G` to `Opens G`."] def toOpens (U : OpenSubgroup G) : Opens G := ⟨U, U.isOpen'⟩ @[to_additive] instance hasCoeOpens : CoeTC (OpenSubgroup G) (Opens G) := ⟨toOpens⟩ @[to_additive (attr := simp, norm_cast)] theorem coe_toOpens : ((U : Opens G) : Set G) = U := rfl @[to_additive (attr := simp, norm_cast)] theorem coe_toSubgroup : ((U : Subgroup G) : Set G) = U := rfl @[to_additive (attr := simp, norm_cast)] theorem mem_toOpens : g ∈ (U : Opens G) ↔ g ∈ U := Iff.rfl @[to_additive (attr := simp, norm_cast)] theorem mem_toSubgroup : g ∈ (U : Subgroup G) ↔ g ∈ U := Iff.rfl @[to_additive (attr := ext)] theorem ext (h : ∀ x, x ∈ U ↔ x ∈ V) : U = V := SetLike.ext h variable (U) @[to_additive] protected theorem isOpen : IsOpen (U : Set G) := U.isOpen' @[to_additive] theorem mem_nhds_one : (U : Set G) ∈ 𝓝 (1 : G) := U.isOpen.mem_nhds U.one_mem variable {U} @[to_additive] instance : Top (OpenSubgroup G) := ⟨⟨⊤, isOpen_univ⟩⟩ @[to_additive (attr := simp)] theorem mem_top (x : G) : x ∈ (⊤ : OpenSubgroup G) := trivial @[to_additive (attr := simp, norm_cast)] theorem coe_top : ((⊤ : OpenSubgroup G) : Set G) = Set.univ := rfl @[to_additive (attr := simp, norm_cast)] theorem toSubgroup_top : ((⊤ : OpenSubgroup G) : Subgroup G) = ⊤ := rfl @[to_additive (attr := simp, norm_cast)] theorem toOpens_top : ((⊤ : OpenSubgroup G) : Opens G) = ⊤ := rfl @[to_additive] instance : Inhabited (OpenSubgroup G) := ⟨⊤⟩ @[to_additive] theorem isClosed [ContinuousMul G] (U : OpenSubgroup G) : IsClosed (U : Set G) := by apply isOpen_compl_iff.1 refine isOpen_iff_forall_mem_open.2 fun x hx => ⟨(fun y => y * x⁻¹) ⁻¹' U, ?_, ?_, ?_⟩ · refine fun u hux hu => hx ?_ simp only [Set.mem_preimage, SetLike.mem_coe] at hux hu ⊢ convert U.mul_mem (U.inv_mem hux) hu simp · exact U.isOpen.preimage (continuous_mul_right _) · simp [one_mem] @[to_additive] theorem isClopen [ContinuousMul G] (U : OpenSubgroup G) : IsClopen (U : Set G) := ⟨U.isClosed, U.isOpen⟩ section variable {H : Type*} [Group H] [TopologicalSpace H] /-- The product of two open subgroups as an open subgroup of the product group. -/ @[to_additive "The product of two open subgroups as an open subgroup of the product group."] def prod (U : OpenSubgroup G) (V : OpenSubgroup H) : OpenSubgroup (G × H) := ⟨.prod U V, U.isOpen.prod V.isOpen⟩ @[to_additive (attr := simp, norm_cast)] theorem coe_prod (U : OpenSubgroup G) (V : OpenSubgroup H) : (U.prod V : Set (G × H)) = (U : Set G) ×ˢ (V : Set H) := rfl @[to_additive (attr := simp, norm_cast)] theorem toSubgroup_prod (U : OpenSubgroup G) (V : OpenSubgroup H) : (U.prod V : Subgroup (G × H)) = (U : Subgroup G).prod V := rfl end @[to_additive] instance instInfOpenSubgroup : Inf (OpenSubgroup G) := ⟨fun U V => ⟨U ⊓ V, U.isOpen.inter V.isOpen⟩⟩ @[to_additive (attr := simp, norm_cast)] theorem coe_inf : (↑(U ⊓ V) : Set G) = (U : Set G) ∩ V := rfl @[to_additive (attr := simp, norm_cast)] theorem toSubgroup_inf : (↑(U ⊓ V) : Subgroup G) = ↑U ⊓ ↑V := rfl @[to_additive (attr := simp, norm_cast)] theorem toOpens_inf : (↑(U ⊓ V) : Opens G) = ↑U ⊓ ↑V := rfl @[to_additive (attr := simp)] theorem mem_inf {x} : x ∈ U ⊓ V ↔ x ∈ U ∧ x ∈ V := Iff.rfl @[to_additive] instance instPartialOrderOpenSubgroup : PartialOrder (OpenSubgroup G) := inferInstance -- Porting note: we override `toPartialorder` to get better `le` @[to_additive] instance instSemilatticeInfOpenSubgroup : SemilatticeInf (OpenSubgroup G) := { SetLike.coe_injective.semilatticeInf ((↑) : OpenSubgroup G → Set G) fun _ _ => rfl with toInf := instInfOpenSubgroup toPartialOrder := instPartialOrderOpenSubgroup } @[to_additive] instance : OrderTop (OpenSubgroup G) where top := ⊤ le_top _ := Set.subset_univ _ @[to_additive (attr := simp, norm_cast)] theorem toSubgroup_le : (U : Subgroup G) ≤ (V : Subgroup G) ↔ U ≤ V := Iff.rfl variable {N : Type*} [Group N] [TopologicalSpace N] /-- The preimage of an `OpenSubgroup` along a continuous `Monoid` homomorphism is an `OpenSubgroup`. -/ @[to_additive "The preimage of an `OpenAddSubgroup` along a continuous `AddMonoid` homomorphism is an `OpenAddSubgroup`."] def comap (f : G →* N) (hf : Continuous f) (H : OpenSubgroup N) : OpenSubgroup G := ⟨.comap f H, H.isOpen.preimage hf⟩ @[to_additive (attr := simp, norm_cast)] theorem coe_comap (H : OpenSubgroup N) (f : G →* N) (hf : Continuous f) : (H.comap f hf : Set G) = f ⁻¹' H := rfl @[to_additive (attr := simp, norm_cast)] theorem toSubgroup_comap (H : OpenSubgroup N) (f : G →* N) (hf : Continuous f) : (H.comap f hf : Subgroup G) = (H : Subgroup N).comap f := rfl @[to_additive (attr := simp)] theorem mem_comap {H : OpenSubgroup N} {f : G →* N} {hf : Continuous f} {x : G} : x ∈ H.comap f hf ↔ f x ∈ H := Iff.rfl @[to_additive] theorem comap_comap {P : Type*} [Group P] [TopologicalSpace P] (K : OpenSubgroup P) (f₂ : N →* P) (hf₂ : Continuous f₂) (f₁ : G →* N) (hf₁ : Continuous f₁) : (K.comap f₂ hf₂).comap f₁ hf₁ = K.comap (f₂.comp f₁) (hf₂.comp hf₁) := rfl end OpenSubgroup namespace Subgroup variable {G : Type*} [Group G] [TopologicalSpace G] @[to_additive] theorem isOpen_of_mem_nhds [ContinuousMul G] (H : Subgroup G) {g : G} (hg : (H : Set G) ∈ 𝓝 g) : IsOpen (H : Set G) := by refine isOpen_iff_mem_nhds.2 fun x hx => ?_ have hg' : g ∈ H := SetLike.mem_coe.1 (mem_of_mem_nhds hg) have : Filter.Tendsto (fun y => y * (x⁻¹ * g)) (𝓝 x) (𝓝 g) := (continuous_id.mul continuous_const).tendsto' _ _ (mul_inv_cancel_left _ _) simpa only [SetLike.mem_coe, Filter.mem_map', H.mul_mem_cancel_right (H.mul_mem (H.inv_mem hx) hg')] using this hg @[to_additive] theorem isOpen_mono [ContinuousMul G] {H₁ H₂ : Subgroup G} (h : H₁ ≤ H₂) (h₁ : IsOpen (H₁ : Set G)) : IsOpen (H₂ : Set G) := isOpen_of_mem_nhds _ <| Filter.mem_of_superset (h₁.mem_nhds <| one_mem H₁) h @[to_additive] theorem isOpen_of_openSubgroup [ContinuousMul G] (H: Subgroup G) {U : OpenSubgroup G} (h : ↑U ≤ H) : IsOpen (H : Set G) := isOpen_mono h U.isOpen /-- If a subgroup of a topological group has `1` in its interior, then it is open. -/ @[to_additive "If a subgroup of an additive topological group has `0` in its interior, then it is open."] theorem isOpen_of_one_mem_interior [ContinuousMul G] (H: Subgroup G) (h_1_int : (1 : G) ∈ interior (H : Set G)) : IsOpen (H : Set G) := isOpen_of_mem_nhds H <| mem_interior_iff_mem_nhds.1 h_1_int end Subgroup namespace OpenSubgroup variable {G : Type*} [Group G] [TopologicalSpace G] [ContinuousMul G] @[to_additive] instance : Sup (OpenSubgroup G) := ⟨fun U V => ⟨U ⊔ V, Subgroup.isOpen_mono (le_sup_left : U.1 ≤ U.1 ⊔ V.1) U.isOpen⟩⟩ @[to_additive (attr := simp, norm_cast)] theorem toSubgroup_sup (U V : OpenSubgroup G) : (↑(U ⊔ V) : Subgroup G) = ↑U ⊔ ↑V := rfl -- Porting note: we override `toPartialorder` to get better `le` @[to_additive] instance : Lattice (OpenSubgroup G) := { instSemilatticeInfOpenSubgroup, toSubgroup_injective.semilatticeSup ((↑) : OpenSubgroup G → Subgroup G) fun _ _ => rfl with toPartialOrder := instPartialOrderOpenSubgroup } end OpenSubgroup namespace Submodule open OpenAddSubgroup variable {R : Type*} {M : Type*} [CommRing R] variable [AddCommGroup M] [TopologicalSpace M] [TopologicalAddGroup M] [Module R M] theorem isOpen_mono {U P : Submodule R M} (h : U ≤ P) (hU : IsOpen (U : Set M)) : IsOpen (P : Set M) := @AddSubgroup.isOpen_mono M _ _ _ U.toAddSubgroup P.toAddSubgroup h hU end Submodule namespace Ideal variable {R : Type*} [CommRing R] variable [TopologicalSpace R] [TopologicalRing R] theorem isOpen_of_isOpen_subideal {U I : Ideal R} (h : U ≤ I) (hU : IsOpen (U : Set R)) : IsOpen (I : Set R) := @Submodule.isOpen_mono R R _ _ _ _ Semiring.toModule _ _ h hU end Ideal
Topology\Algebra\Polynomial.lean
/- Copyright (c) 2018 Robert Y. Lewis. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Robert Y. Lewis -/ import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Inductions import Mathlib.Algebra.Polynomial.Splits import Mathlib.Analysis.Normed.Field.Basic import Mathlib.RingTheory.Polynomial.Vieta /-! # Polynomials and limits In this file we prove the following lemmas. * `Polynomial.continuous_eval₂`: `Polynomial.eval₂` defines a continuous function. * `Polynomial.continuous_aeval`: `Polynomial.aeval` defines a continuous function; we also prove convenience lemmas `Polynomial.continuousAt_aeval`, `Polynomial.continuousWithinAt_aeval`, `Polynomial.continuousOn_aeval`. * `Polynomial.continuous`: `Polynomial.eval` defines a continuous functions; we also prove convenience lemmas `Polynomial.continuousAt`, `Polynomial.continuousWithinAt`, `Polynomial.continuousOn`. * `Polynomial.tendsto_norm_atTop`: `fun x ↦ ‖Polynomial.eval (z x) p‖` tends to infinity provided that `fun x ↦ ‖z x‖` tends to infinity and `0 < degree p`; * `Polynomial.tendsto_abv_eval₂_atTop`, `Polynomial.tendsto_abv_atTop`, `Polynomial.tendsto_abv_aeval_atTop`: a few versions of the previous statement for `IsAbsoluteValue abv` instead of norm. ## Tags Polynomial, continuity -/ open IsAbsoluteValue Filter namespace Polynomial open Polynomial section TopologicalSemiring variable {R S : Type*} [Semiring R] [TopologicalSpace R] [TopologicalSemiring R] (p : R[X]) @[continuity, fun_prop] protected theorem continuous_eval₂ [Semiring S] (p : S[X]) (f : S →+* R) : Continuous fun x => p.eval₂ f x := by simp only [eval₂_eq_sum, Finsupp.sum] exact continuous_finset_sum _ fun c _ => continuous_const.mul (continuous_pow _) @[continuity, fun_prop] protected theorem continuous : Continuous fun x => p.eval x := p.continuous_eval₂ _ @[fun_prop] protected theorem continuousAt {a : R} : ContinuousAt (fun x => p.eval x) a := p.continuous.continuousAt @[fun_prop] protected theorem continuousWithinAt {s a} : ContinuousWithinAt (fun x => p.eval x) s a := p.continuous.continuousWithinAt @[fun_prop] protected theorem continuousOn {s} : ContinuousOn (fun x => p.eval x) s := p.continuous.continuousOn end TopologicalSemiring section TopologicalAlgebra variable {R A : Type*} [CommSemiring R] [Semiring A] [Algebra R A] [TopologicalSpace A] [TopologicalSemiring A] (p : R[X]) @[continuity, fun_prop] protected theorem continuous_aeval : Continuous fun x : A => aeval x p := p.continuous_eval₂ _ @[fun_prop] protected theorem continuousAt_aeval {a : A} : ContinuousAt (fun x : A => aeval x p) a := p.continuous_aeval.continuousAt @[fun_prop] protected theorem continuousWithinAt_aeval {s a} : ContinuousWithinAt (fun x : A => aeval x p) s a := p.continuous_aeval.continuousWithinAt @[fun_prop] protected theorem continuousOn_aeval {s} : ContinuousOn (fun x : A => aeval x p) s := p.continuous_aeval.continuousOn end TopologicalAlgebra theorem tendsto_abv_eval₂_atTop {R S k α : Type*} [Semiring R] [Ring S] [LinearOrderedField k] (f : R →+* S) (abv : S → k) [IsAbsoluteValue abv] (p : R[X]) (hd : 0 < degree p) (hf : f p.leadingCoeff ≠ 0) {l : Filter α} {z : α → S} (hz : Tendsto (abv ∘ z) l atTop) : Tendsto (fun x => abv (p.eval₂ f (z x))) l atTop := by revert hf; refine degree_pos_induction_on p hd ?_ ?_ ?_ <;> clear hd p · rintro _ - hc rw [leadingCoeff_mul_X, leadingCoeff_C] at hc simpa [abv_mul abv] using hz.const_mul_atTop ((abv_pos abv).2 hc) · intro _ _ ihp hf rw [leadingCoeff_mul_X] at hf simpa [abv_mul abv] using (ihp hf).atTop_mul_atTop hz · intro _ a hd ihp hf rw [add_comm, leadingCoeff_add_of_degree_lt (degree_C_le.trans_lt hd)] at hf refine tendsto_atTop_of_add_const_right (abv (-f a)) ?_ refine tendsto_atTop_mono (fun _ => abv_add abv _ _) ?_ simpa using ihp hf theorem tendsto_abv_atTop {R k α : Type*} [Ring R] [LinearOrderedField k] (abv : R → k) [IsAbsoluteValue abv] (p : R[X]) (h : 0 < degree p) {l : Filter α} {z : α → R} (hz : Tendsto (abv ∘ z) l atTop) : Tendsto (fun x => abv (p.eval (z x))) l atTop := by apply tendsto_abv_eval₂_atTop _ _ _ h _ hz exact mt leadingCoeff_eq_zero.1 (ne_zero_of_degree_gt h) theorem tendsto_abv_aeval_atTop {R A k α : Type*} [CommSemiring R] [Ring A] [Algebra R A] [LinearOrderedField k] (abv : A → k) [IsAbsoluteValue abv] (p : R[X]) (hd : 0 < degree p) (h₀ : algebraMap R A p.leadingCoeff ≠ 0) {l : Filter α} {z : α → A} (hz : Tendsto (abv ∘ z) l atTop) : Tendsto (fun x => abv (aeval (z x) p)) l atTop := tendsto_abv_eval₂_atTop _ abv p hd h₀ hz variable {α R : Type*} [NormedRing R] [IsAbsoluteValue (norm : R → ℝ)] theorem tendsto_norm_atTop (p : R[X]) (h : 0 < degree p) {l : Filter α} {z : α → R} (hz : Tendsto (fun x => ‖z x‖) l atTop) : Tendsto (fun x => ‖p.eval (z x)‖) l atTop := p.tendsto_abv_atTop norm h hz theorem exists_forall_norm_le [ProperSpace R] (p : R[X]) : ∃ x, ∀ y, ‖p.eval x‖ ≤ ‖p.eval y‖ := if hp0 : 0 < degree p then p.continuous.norm.exists_forall_le <| p.tendsto_norm_atTop hp0 tendsto_norm_cocompact_atTop else ⟨p.coeff 0, by rw [eq_C_of_degree_le_zero (le_of_not_gt hp0)]; simp⟩ section Roots open Polynomial NNReal variable {F K : Type*} [CommRing F] [NormedField K] open Multiset theorem eq_one_of_roots_le {p : F[X]} {f : F →+* K} {B : ℝ} (hB : B < 0) (h1 : p.Monic) (h2 : Splits f p) (h3 : ∀ z ∈ (map f p).roots, ‖z‖ ≤ B) : p = 1 := h1.natDegree_eq_zero_iff_eq_one.mp (by contrapose! hB rw [← h1.natDegree_map f, natDegree_eq_card_roots' h2] at hB obtain ⟨z, hz⟩ := card_pos_iff_exists_mem.mp (zero_lt_iff.mpr hB) exact le_trans (norm_nonneg _) (h3 z hz)) theorem coeff_le_of_roots_le {p : F[X]} {f : F →+* K} {B : ℝ} (i : ℕ) (h1 : p.Monic) (h2 : Splits f p) (h3 : ∀ z ∈ (map f p).roots, ‖z‖ ≤ B) : ‖(map f p).coeff i‖ ≤ B ^ (p.natDegree - i) * p.natDegree.choose i := by obtain hB | hB := lt_or_le B 0 · rw [eq_one_of_roots_le hB h1 h2 h3, Polynomial.map_one, natDegree_one, zero_tsub, pow_zero, one_mul, coeff_one] split_ifs with h <;> simp [h] rw [← h1.natDegree_map f] obtain hi | hi := lt_or_le (map f p).natDegree i · rw [coeff_eq_zero_of_natDegree_lt hi, norm_zero] positivity rw [coeff_eq_esymm_roots_of_splits ((splits_id_iff_splits f).2 h2) hi, (h1.map _).leadingCoeff, one_mul, norm_mul, norm_pow, norm_neg, norm_one, one_pow, one_mul] apply ((norm_multiset_sum_le _).trans <| sum_le_card_nsmul _ _ fun r hr => _).trans · rw [Multiset.map_map, card_map, card_powersetCard, ← natDegree_eq_card_roots' h2, Nat.choose_symm hi, mul_comm, nsmul_eq_mul] intro r hr simp_rw [Multiset.mem_map] at hr obtain ⟨_, ⟨s, hs, rfl⟩, rfl⟩ := hr rw [mem_powersetCard] at hs lift B to ℝ≥0 using hB rw [← coe_nnnorm, ← NNReal.coe_pow, NNReal.coe_le_coe, ← nnnormHom_apply, ← MonoidHom.coe_coe, MonoidHom.map_multiset_prod] refine (prod_le_pow_card _ B fun x hx => ?_).trans_eq (by rw [card_map, hs.2]) obtain ⟨z, hz, rfl⟩ := Multiset.mem_map.1 hx exact h3 z (mem_of_le hs.1 hz) /-- The coefficients of the monic polynomials of bounded degree with bounded roots are uniformly bounded. -/ theorem coeff_bdd_of_roots_le {B : ℝ} {d : ℕ} (f : F →+* K) {p : F[X]} (h1 : p.Monic) (h2 : Splits f p) (h3 : p.natDegree ≤ d) (h4 : ∀ z ∈ (map f p).roots, ‖z‖ ≤ B) (i : ℕ) : ‖(map f p).coeff i‖ ≤ max B 1 ^ d * d.choose (d / 2) := by obtain hB | hB := le_or_lt 0 B · apply (coeff_le_of_roots_le i h1 h2 h4).trans calc _ ≤ max B 1 ^ (p.natDegree - i) * p.natDegree.choose i := by gcongr; apply le_max_left _ ≤ max B 1 ^ d * p.natDegree.choose i := by gcongr · apply le_max_right · exact le_trans (Nat.sub_le _ _) h3 _ ≤ max B 1 ^ d * d.choose (d / 2) := by gcongr; exact (i.choose_mono h3).trans (i.choose_le_middle d) · rw [eq_one_of_roots_le hB h1 h2 h4, Polynomial.map_one, coeff_one] refine _root_.trans ?_ (one_le_mul_of_one_le_of_one_le (one_le_pow_of_one_le (le_max_right B 1) d) ?_) · split_ifs <;> norm_num · exact mod_cast Nat.succ_le_iff.mpr (Nat.choose_pos (d.div_le_self 2)) end Roots end Polynomial
Topology\Algebra\PontryaginDual.lean
/- Copyright (c) 2022 Thomas Browning. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning -/ import Mathlib.Analysis.SpecialFunctions.Complex.Circle import Mathlib.Topology.Algebra.ContinuousMonoidHom /-! # Pontryagin dual This file defines the Pontryagin dual of a topological group. The Pontryagin dual of a topological group `A` is the topological group of continuous homomorphisms `A →* circle` with the compact-open topology. For example, `ℤ` and `circle` are Pontryagin duals of each other. This is an example of Pontryagin duality, which states that a locally compact abelian topological group is canonically isomorphic to its double dual. ## Main definitions * `PontryaginDual A`: The group of continuous homomorphisms `A →* circle`. -/ open Pointwise Function variable (A B C D E G : Type*) [Monoid A] [Monoid B] [Monoid C] [Monoid D] [CommGroup E] [Group G] [TopologicalSpace A] [TopologicalSpace B] [TopologicalSpace C] [TopologicalSpace D] [TopologicalSpace E] [TopologicalSpace G] [TopologicalGroup E] [TopologicalGroup G] /-- The Pontryagin dual of `A` is the group of continuous homomorphism `A → circle`. -/ def PontryaginDual := ContinuousMonoidHom A circle -- Porting note: `deriving` doesn't derive these instances instance : TopologicalSpace (PontryaginDual A) := (inferInstance : TopologicalSpace (ContinuousMonoidHom A circle)) instance : T2Space (PontryaginDual A) := (inferInstance : T2Space (ContinuousMonoidHom A circle)) -- Porting note: instance is now noncomputable noncomputable instance : CommGroup (PontryaginDual A) := (inferInstance : CommGroup (ContinuousMonoidHom A circle)) instance : TopologicalGroup (PontryaginDual A) := (inferInstance : TopologicalGroup (ContinuousMonoidHom A circle)) -- Porting note: instance is now noncomputable noncomputable instance : Inhabited (PontryaginDual A) := (inferInstance : Inhabited (ContinuousMonoidHom A circle)) instance [LocallyCompactSpace G] : LocallyCompactSpace (PontryaginDual G) := by let Vn : ℕ → Set circle := fun n ↦ expMapCircle '' { x | |x| < Real.pi / 2 ^ (n + 1)} have hVn : ∀ n x, x ∈ Vn n ↔ |Complex.arg x| < Real.pi / 2 ^ (n + 1) := by refine fun n x ↦ ⟨?_, fun hx ↦ ⟨Complex.arg x, hx, expMapCircle_arg x⟩⟩ rintro ⟨t, ht : |t| < _, rfl⟩ have ht' := ht.trans_le (div_le_self Real.pi_nonneg (one_le_pow_of_one_le one_le_two (n + 1))) rwa [arg_expMapCircle (neg_lt_of_abs_lt ht') (lt_of_abs_lt ht').le] refine ContinuousMonoidHom.locallyCompactSpace_of_hasBasis Vn ?_ ?_ · intro n x h1 h2 rw [hVn] at h1 h2 ⊢ rwa [Submonoid.coe_mul, Complex.arg_mul (ne_zero_of_mem_circle x) (ne_zero_of_mem_circle x), ← two_mul, abs_mul, abs_two, ← lt_div_iff' two_pos, div_div, ← pow_succ] at h2 apply Set.Ioo_subset_Ioc_self rw [← two_mul, Set.mem_Ioo, ← abs_lt, abs_mul, abs_two, ← lt_div_iff' two_pos] exact h1.trans_le (div_le_div_of_nonneg_left Real.pi_nonneg two_pos (le_self_pow one_le_two n.succ_ne_zero)) · rw [← expMapCircle_zero, ← isLocalHomeomorph_expMapCircle.map_nhds_eq 0] refine ((nhds_basis_zero_abs_sub_lt ℝ).to_hasBasis (fun x hx ↦ ⟨Nat.ceil (Real.pi / x), trivial, fun t ht ↦ ?_⟩) fun k _ ↦ ⟨Real.pi / 2 ^ (k + 1), by positivity, le_rfl⟩).map expMapCircle rw [Set.mem_setOf_eq] at ht ⊢ refine lt_of_lt_of_le ht ?_ rw [div_le_iff' (pow_pos two_pos _), ← div_le_iff hx] refine (Nat.le_ceil (Real.pi / x)).trans ?_ exact_mod_cast (Nat.le_succ _).trans (Nat.lt_two_pow _).le variable {A B C D E} namespace PontryaginDual open ContinuousMonoidHom instance : FunLike (PontryaginDual A) A circle := ContinuousMonoidHom.funLike noncomputable instance : ContinuousMonoidHomClass (PontryaginDual A) A circle := ContinuousMonoidHom.ContinuousMonoidHomClass /-- `PontryaginDual` is a contravariant functor. -/ noncomputable def map (f : ContinuousMonoidHom A B) : ContinuousMonoidHom (PontryaginDual B) (PontryaginDual A) := f.compLeft circle @[simp] theorem map_apply (f : ContinuousMonoidHom A B) (x : PontryaginDual B) (y : A) : map f x y = x (f y) := rfl @[simp] theorem map_one : map (one A B) = one (PontryaginDual B) (PontryaginDual A) := ext fun x => ext (fun _y => OneHomClass.map_one x) @[simp] theorem map_comp (g : ContinuousMonoidHom B C) (f : ContinuousMonoidHom A B) : map (comp g f) = ContinuousMonoidHom.comp (map f) (map g) := ext fun _x => ext fun _y => rfl @[simp] nonrec theorem map_mul (f g : ContinuousMonoidHom A E) : map (f * g) = map f * map g := ext fun x => ext fun y => map_mul x (f y) (g y) variable (A B C D E) /-- `ContinuousMonoidHom.dual` as a `ContinuousMonoidHom`. -/ noncomputable def mapHom [LocallyCompactSpace E] : ContinuousMonoidHom (ContinuousMonoidHom A E) (ContinuousMonoidHom (PontryaginDual E) (PontryaginDual A)) where toFun := map map_one' := map_one map_mul' := map_mul continuous_toFun := continuous_of_continuous_uncurry _ continuous_comp end PontryaginDual
Topology\Algebra\ProperAction.lean
/- Copyright (c) 2024 Anatole Dedeker. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Anatole Dedeker, Etienne Marion, Florestan Martin-Baillon, Vincent Guirardel -/ import Mathlib.Topology.Algebra.Group.Basic import Mathlib.Topology.Algebra.MulAction import Mathlib.Topology.Maps.Proper.Basic import Mathlib.Topology.Sequences /-! # Proper group action In this file we define proper action of a group on a topological space, and we prove that in this case the quotient space is T2. We also give equivalent definitions of proper action using ultrafilters and show the transfer of proper action to a closed subgroup. We give sufficent conditions on the topological space such that the action is properly discontinuous (see `ProperlyDiscontinuousSMul`) if and only if it is continuous in the first variable (see `ContinuousConstSMul`) and proper in the sense defined here. ## Main definitions * `ProperSMul` : a group `G` acts properly on a topological space `X` if the map `(g, x) ↦ (g • x, x)` is proper, in the sense of `IsProperMap`. ## Main statements * `t2Space_quotient_mulAction_of_properSMul`: If a group `G` acts properly on a topological space `X`, then the quotient space is Hausdorff (T2). * `t2Space_of_properSMul_of_t2Group`: If a T2 group acts properly on a topological space, then this topological space is T2. * `properlyDiscontinuousSMul_iff_properSMul`: If a discrete group acts on a T2 space `X` such that `X × X` is compactly generated, then the action is properly discontinuous if and only if it is continuous in the second variable and proper. This in particular true if `X` is locally compact or first-countable. ## Implementation notes Concerning `properlyDiscontinuousSMul_iff_properSMul`, this result should be the only one needed to link properly discontinuous and proper actions. TODO: Replace the compactly generated hypothesis by a typeclass instance such that `WeaklyLocallyCompactSpace.isProperMap_iff_isCompact_preimage` and `SequentialSpace.isProperMap_iff_isCompact_preimage` are inferred by typeclass inference. ## References * [N. Bourbaki, *General Topology*][bourbaki1966] ## Tags Hausdorff, group action, proper action -/ open Filter Topology Set Prod /-- Proper group action in the sense of Bourbaki: the map `G × X → X × X` is a proper map (see `IsProperMap`). -/ class ProperVAdd (G X : Type*) [TopologicalSpace G] [TopologicalSpace X] [AddGroup G] [AddAction G X] : Prop where /-- Proper group action in the sense of Bourbaki: the map `G × X → X × X` is a proper map (see `IsProperMap`). -/ isProperMap_vadd_pair : IsProperMap (fun gx ↦ (gx.1 +ᵥ gx.2, gx.2) : G × X → X × X) /-- Proper group action in the sense of Bourbaki: the map `G × X → X × X` is a proper map (see `IsProperMap`). -/ @[to_additive existing (attr := mk_iff)] class ProperSMul (G X : Type*) [TopologicalSpace G] [TopologicalSpace X] [Group G] [MulAction G X] : Prop where /-- Proper group action in the sense of Bourbaki: the map `G × X → X × X` is a proper map (see `IsProperMap`). -/ isProperMap_smul_pair : IsProperMap (fun gx ↦ (gx.1 • gx.2, gx.2) : G × X → X × X) attribute [to_additive existing] properSMul_iff variable {G X Y Z : Type*} [Group G] [MulAction G X] [MulAction G Y] variable [TopologicalSpace G] [TopologicalSpace X] [TopologicalSpace Y] variable [TopologicalSpace Z] /-- If a group acts properly then in particular it acts continuously. -/ @[to_additive "If a group acts properly then in particular it acts continuously."] -- See note [lower instance property] instance (priority := 100) ProperSMul.toContinuousSMul [ProperSMul G X] : ContinuousSMul G X where continuous_smul := isProperMap_smul_pair.continuous.fst /-- A group `G` acts properly on a topological space `X` if and only if for all ultrafilters `𝒰` on `X × G`, if `𝒰` converges to `(x₁, x₂)` along the map `(g, x) ↦ (g • x, x)`, then there exists `g : G` such that `g • x₂ = x₁` and `𝒰.fst` converges to `g`. -/ @[to_additive "A group acts `G` properly on a topological space `X` if and only if for all ultrafilters `𝒰` on `X`, if `𝒰` converges to `(x₁, x₂)` along the map `(g, x) ↦ (g • x, x)`, then there exists `g : G` such that `g • x₂ = x₁` and `𝒰.fst` converges to `g`."] theorem properSMul_iff_continuousSMul_ultrafilter_tendsto : ProperSMul G X ↔ ContinuousSMul G X ∧ (∀ 𝒰 : Ultrafilter (G × X), ∀ x₁ x₂ : X, Tendsto (fun gx : G × X ↦ (gx.1 • gx.2, gx.2)) 𝒰 (𝓝 (x₁, x₂)) → ∃ g : G, g • x₂ = x₁ ∧ Tendsto (Prod.fst : G × X → G) 𝒰 (𝓝 g)) := by refine ⟨fun h ↦ ⟨inferInstance, fun 𝒰 x₁ x₂ h' ↦ ?_⟩, fun ⟨cont, h⟩ ↦ ?_⟩ · rw [properSMul_iff, isProperMap_iff_ultrafilter] at h rcases h.2 h' with ⟨gx, hgx1, hgx2⟩ refine ⟨gx.1, ?_, (continuous_fst.tendsto gx).mono_left hgx2⟩ simp only [Prod.mk.injEq] at hgx1 rw [← hgx1.2, hgx1.1] · rw [properSMul_iff, isProperMap_iff_ultrafilter] refine ⟨by fun_prop, fun 𝒰 (x₁, x₂) hxx ↦ ?_⟩ rcases h 𝒰 x₁ x₂ hxx with ⟨g, hg1, hg2⟩ refine ⟨(g, x₂), by simp_rw [hg1], ?_⟩ rw [nhds_prod_eq, 𝒰.le_prod] exact ⟨hg2, (continuous_snd.tendsto _).comp hxx⟩ /-- A group `G` acts properly on a T2 topological space `X` if and only if for all ultrafilters `𝒰` on `X × G`, if `𝒰` converges to `(x₁, x₂)` along the map `(g, x) ↦ (g • x, x)`, then there exists `g : G` such that `𝒰.fst` converges to `g`. -/ theorem properSMul_iff_continuousSMul_ultrafilter_tendsto_t2 [T2Space X] : ProperSMul G X ↔ ContinuousSMul G X ∧ (∀ 𝒰 : Ultrafilter (G × X), ∀ x₁ x₂ : X, Tendsto (fun gx : G × X ↦ (gx.1 • gx.2, gx.2)) 𝒰 (𝓝 (x₁, x₂)) → ∃ g : G, Tendsto (Prod.fst : G × X → G) 𝒰 (𝓝 g)) := by rw [properSMul_iff_continuousSMul_ultrafilter_tendsto] refine and_congr_right fun hc ↦ ?_ congrm ∀ 𝒰 x₁ x₂ hxx, ∃ g, ?_ exact and_iff_right_of_imp fun hg ↦ tendsto_nhds_unique (hg.smul ((continuous_snd.tendsto _).comp hxx)) ((continuous_fst.tendsto _).comp hxx) /-- If `G` acts properly on `X`, then the quotient space is Hausdorff (T2). -/ @[to_additive "If `G` acts properly on `X`, then the quotient space is Hausdorff (T2)."] theorem t2Space_quotient_mulAction_of_properSMul [ProperSMul G X] : T2Space (Quotient (MulAction.orbitRel G X)) := by rw [t2_iff_isClosed_diagonal] set R := MulAction.orbitRel G X let π : X → Quotient R := Quotient.mk' have : QuotientMap (Prod.map π π) := (isOpenMap_quotient_mk'_mul.prod isOpenMap_quotient_mk'_mul).to_quotientMap (continuous_quotient_mk'.prod_map continuous_quotient_mk') ((surjective_quotient_mk' _).prodMap (surjective_quotient_mk' _)) rw [← this.isClosed_preimage] convert ProperSMul.isProperMap_smul_pair.isClosedMap.isClosed_range · ext ⟨x₁, x₂⟩ simp only [mem_preimage, map_apply, mem_diagonal_iff, mem_range, Prod.mk.injEq, Prod.exists, exists_eq_right] rw [Quotient.eq_rel, MulAction.orbitRel_apply, MulAction.mem_orbit_iff] all_goals infer_instance /-- If a T2 group acts properly on a topological space, then this topological space is T2. -/ @[to_additive "If a T2 group acts properly on a topological space, then this topological space is T2."] theorem t2Space_of_properSMul_of_t2Group [h_proper : ProperSMul G X] [T2Space G] : T2Space X := by let f := fun x : X ↦ ((1 : G), x) have proper_f : IsProperMap f := by apply isProperMap_of_closedEmbedding rw [closedEmbedding_iff] constructor · let g := fun gx : G × X ↦ gx.2 have : Function.LeftInverse g f := fun x ↦ by simp exact this.embedding (by fun_prop) (by fun_prop) · have : range f = ({1} ×ˢ univ) := by simp rw [this] exact isClosed_singleton.prod isClosed_univ rw [t2_iff_isClosed_diagonal] let g := fun gx : G × X ↦ (gx.1 • gx.2, gx.2) have proper_g : IsProperMap g := (properSMul_iff G X).1 h_proper have : g ∘ f = fun x ↦ (x, x) := by ext x <;> simp have range_gf : range (g ∘ f) = diagonal X := by simp [this] rw [← range_gf] exact (proper_f.comp proper_g).isClosed_range /-- If two groups `H` and `G` act on a topological space `X` such that `G` acts properly and there exists a group homomorphims `H → G` which is a closed embedding compatible with the actions, then `H` also acts properly on `X`. -/ @[to_additive "If two groups `H` and `G` act on a topological space `X` such that `G` acts properly and there exists a group homomorphims `H → G` which is a closed embedding compatible with the actions, then `H` also acts properly on `X`."] theorem properSMul_of_closedEmbedding {H : Type*} [Group H] [MulAction H X] [TopologicalSpace H] [ProperSMul G X] (f : H →* G) (f_clemb : ClosedEmbedding f) (f_compat : ∀ (h : H) (x : X), f h • x = h • x) : ProperSMul H X where isProperMap_smul_pair := by have := isProperMap_of_closedEmbedding f_clemb have h : IsProperMap (Prod.map f (fun x : X ↦ x)) := IsProperMap.prod_map this isProperMap_id have : (fun hx : H × X ↦ (hx.1 • hx.2, hx.2)) = (fun hx ↦ (f hx.1 • hx.2, hx.2)) := by simp [f_compat] rw [this] exact h.comp <| ProperSMul.isProperMap_smul_pair /-- If `H` is a closed subgroup of `G` and `G` acts properly on X then so does `H`. -/ @[to_additive "If `H` is a closed subgroup of `G` and `G` acts properly on X then so does `H`."] instance {H : Subgroup G} [ProperSMul G X] [H_closed : IsClosed (H : Set G)] : ProperSMul H X := properSMul_of_closedEmbedding H.subtype H_closed.closedEmbedding_subtype_val fun _ _ ↦ rfl /-- If a discrete group acts on a T2 space `X` such that `X × X` is compactly generated, then the action is properly discontinuous if and only if it is continuous in the second variable and proper. -/ theorem properlyDiscontinuousSMul_iff_properSMul [T2Space X] [DiscreteTopology G] [ContinuousConstSMul G X] (compactlyGenerated : ∀ s : Set (X × X), IsClosed s ↔ ∀ ⦃K⦄, IsCompact K → IsClosed (s ∩ K)) : ProperlyDiscontinuousSMul G X ↔ ProperSMul G X := by constructor · intro h rw [properSMul_iff] -- We have to show that `f : (g, x) ↦ (g • x, x)` is proper. -- Continuity follows from continuity of `g • ·` and the fact that `G` has the -- discrete topology, thanks to `continuous_of_partial_of_discrete`. -- Because `X × X` is compactly generated, to show that f is proper -- it is enough to show that the preimage of a compact set `K` is compact. refine (isProperMap_iff_isCompact_preimage compactlyGenerated).2 ⟨(continuous_prod_mk.2 ⟨continuous_prod_of_discrete_left.2 continuous_const_smul, by fun_prop⟩), fun K hK ↦ ?_⟩ -- We set `K' := pr₁(K) ∪ pr₂(K)`, which is compact because `K` is compact and `pr₁` and -- `pr₂` are continuous. We halso have that `K ⊆ K' × K'`, and `K` is closed because `X` is T2. -- Therefore `f ⁻¹ (K)` is also closed and `f ⁻¹ (K) ⊆ f ⁻¹ (K' × K')`, thus it suffices to -- show that `f ⁻¹ (K' × K')` is compact. let K' := fst '' K ∪ snd '' K have hK' : IsCompact K' := (hK.image continuous_fst).union (hK.image continuous_snd) let E := {g : G | Set.Nonempty ((g • ·) '' K' ∩ K')} -- The set `E` is finite because the action is properly discontinuous. have fin : Set.Finite E := by simp_rw [E, nonempty_iff_ne_empty] exact h.finite_disjoint_inter_image hK' hK' -- Therefore we can rewrite `f ⁻¹ (K' × K')` as a finite union of compact sets. have : (fun gx : G × X ↦ (gx.1 • gx.2, gx.2)) ⁻¹' (K' ×ˢ K') = ⋃ g ∈ E, {g} ×ˢ ((g⁻¹ • ·) '' K' ∩ K') := by ext gx simp only [mem_preimage, mem_prod, nonempty_def, mem_inter_iff, mem_image, exists_exists_and_eq_and, mem_setOf_eq, singleton_prod, iUnion_exists, biUnion_and', mem_iUnion, exists_prop, E] constructor · exact fun ⟨gx_mem, x_mem⟩ ↦ ⟨gx.2, x_mem, gx.1, gx_mem, ⟨gx.2, ⟨⟨gx.1 • gx.2, gx_mem, by simp⟩, x_mem⟩, rfl⟩⟩ · rintro ⟨x, -, g, -, ⟨-, ⟨⟨x', x'_mem, rfl⟩, ginvx'_mem⟩, rfl⟩⟩ exact ⟨by simpa, by simpa⟩ -- Indeed each set in this finite union is the product of a singleton and -- the intersection of the compact `K'` with its image by some element `g`, and this image is -- compact because `g • ·` is continuous. have : IsCompact ((fun gx : G × X ↦ (gx.1 • gx.2, gx.2)) ⁻¹' (K' ×ˢ K')) := this ▸ fin.isCompact_biUnion fun g hg ↦ isCompact_singleton.prod <| (hK'.image <| continuous_const_smul _).inter hK' -- We conclude as explained above. exact this.of_isClosed_subset (hK.isClosed.preimage <| continuous_prod_mk.2 ⟨continuous_prod_of_discrete_left.2 continuous_const_smul, by fun_prop⟩) <| preimage_mono fun x hx ↦ ⟨Or.inl ⟨x, hx, rfl⟩, Or.inr ⟨x, hx, rfl⟩⟩ · intro h; constructor intro K L hK hL simp_rw [← nonempty_iff_ne_empty] -- We want to show that a subset of `G` is finite, but as `G` has the discrete topology it -- is enough to show that this subset is compact. apply IsCompact.finite_of_discrete -- Now set `h : (g, x) ↦ (g⁻¹ • x, x)`, because `f` is proper by hypothesis, so is `h`. have : IsProperMap (fun gx : G × X ↦ (gx.1⁻¹ • gx.2, gx.2)) := (IsProperMap.prod_map (Homeomorph.isProperMap (Homeomorph.inv G)) isProperMap_id).comp <| ProperSMul.isProperMap_smul_pair --But we also have that `{g | Set.Nonempty ((g • ·) '' K ∩ L)} = h ⁻¹ (K × L)`, which -- concludes the proof. have eq : {g | Set.Nonempty ((g • ·) '' K ∩ L)} = fst '' ((fun gx : G × X ↦ (gx.1⁻¹ • gx.2, gx.2)) ⁻¹' (K ×ˢ L)) := by simp_rw [nonempty_def] ext g; constructor · exact fun ⟨_, ⟨x, x_mem, rfl⟩, hx⟩ ↦ ⟨(g, g • x), ⟨by simpa, hx⟩, rfl⟩ · rintro ⟨gx, hgx, rfl⟩ exact ⟨gx.2, ⟨gx.1⁻¹ • gx.2, hgx.1, by simp⟩, hgx.2⟩ exact eq ▸ IsCompact.image (this.isCompact_preimage <| hK.prod hL) continuous_fst /-- If a discrete group acts on a T2 and locally compact space `X`, then the action is properly discontinuous if and only if it is continuous in the second variable and proper. -/ theorem WeaklyLocallyCompactSpace.properlyDiscontinuousSMul_iff_properSMul [T2Space X] [WeaklyLocallyCompactSpace X] [DiscreteTopology G] [ContinuousConstSMul G X] : ProperlyDiscontinuousSMul G X ↔ ProperSMul G X := _root_.properlyDiscontinuousSMul_iff_properSMul (fun _ ↦ compactlyGenerated_of_weaklyLocallyCompactSpace) /-- If a discrete group acts on a T2 and first-countable space `X`, then the action is properly discontinuous if and only if it is continuous in the second variable and proper. -/ theorem FirstCountableTopology.properlyDiscontinuousSMul_iff_properSMul [T2Space X] [FirstCountableTopology X] [DiscreteTopology G] [ContinuousConstSMul G X] : ProperlyDiscontinuousSMul G X ↔ ProperSMul G X := _root_.properlyDiscontinuousSMul_iff_properSMul (fun _ ↦ compactlyGenerated_of_sequentialSpace)
Topology\Algebra\ProperConstSMul.lean
/- Copyright (c) 2023 Yury Kudryashov. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yury Kudryashov -/ import Mathlib.Topology.Algebra.ConstMulAction import Mathlib.Topology.Maps.Proper.Basic /-! # Actions by proper maps In this file we define `ProperConstSMul M X` to be a mixin `Prop`-value class stating that `(c • ·)` is a proper map for all `c`. Note that this is **not** the same as a proper action (not yet in `Mathlib`) which requires `(c, x) ↦ (c • x, x)` to be a proper map. We also provide 4 instances: - for a continuous action on a compact Hausdorff space, - and for a continuous group action on a general space; - for the action on `X × Y`; - for the action on `∀ i, X i`. -/ /-- A mixin typeclass saying that the `(c +ᵥ ·)` is a proper map for all `c`. Note that this is **not** the same as a proper additive action (not yet in `Mathlib`). -/ class ProperConstVAdd (M X : Type*) [VAdd M X] [TopologicalSpace X] : Prop where /-- `(c +ᵥ ·)` is a proper map. -/ isProperMap_vadd (c : M) : IsProperMap ((c +ᵥ ·) : X → X) /-- A mixin typeclass saying that `(c • ·)` is a proper map for all `c`. Note that this is **not** the same as a proper multiplicative action (not yet in `Mathlib`). -/ @[to_additive] class ProperConstSMul (M X : Type*) [SMul M X] [TopologicalSpace X] : Prop where /-- `(c • ·)` is a proper map. -/ isProperMap_smul (c : M) : IsProperMap ((c • ·) : X → X) /-- `(c • ·)` is a proper map. -/ @[to_additive "`(c +ᵥ ·)` is a proper map."] theorem isProperMap_smul {M : Type*} (c : M) (X : Type*) [SMul M X] [TopologicalSpace X] [h : ProperConstSMul M X] : IsProperMap ((c • ·) : X → X) := h.1 c /-- The preimage of a compact set under `(c • ·)` is a compact set. -/ @[to_additive "The preimage of a compact set under `(c +ᵥ ·)` is a compact set."] theorem IsCompact.preimage_smul {M X : Type*} [SMul M X] [TopologicalSpace X] [ProperConstSMul M X] {s : Set X} (hs : IsCompact s) (c : M) : IsCompact ((c • ·) ⁻¹' s) := (isProperMap_smul c X).isCompact_preimage hs @[to_additive] instance (priority := 100) {M X : Type*} [SMul M X] [TopologicalSpace X] [ContinuousConstSMul M X] [T2Space X] [CompactSpace X] : ProperConstSMul M X := ⟨fun c ↦ (continuous_const_smul c).isProperMap⟩ @[to_additive] instance (priority := 100) {G X : Type*} [Group G] [MulAction G X] [TopologicalSpace X] [ContinuousConstSMul G X] : ProperConstSMul G X := ⟨fun c ↦ (Homeomorph.smul c).isProperMap⟩ instance {M X Y : Type*} [SMul M X] [TopologicalSpace X] [ProperConstSMul M X] [SMul M Y] [TopologicalSpace Y] [ProperConstSMul M Y] : ProperConstSMul M (X × Y) := ⟨fun c ↦ (isProperMap_smul c X).prod_map (isProperMap_smul c Y)⟩ instance {M ι : Type*} {X : ι → Type*} [∀ i, SMul M (X i)] [∀ i, TopologicalSpace (X i)] [∀ i, ProperConstSMul M (X i)] : ProperConstSMul M (∀ i, X i) := ⟨fun c ↦ .pi_map fun i ↦ isProperMap_smul c (X i)⟩
Topology\Algebra\Semigroup.lean
/- Copyright (c) 2021 David Wärn. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: David Wärn -/ import Mathlib.Topology.Separation import Mathlib.Algebra.Group.Defs /-! # Idempotents in topological semigroups This file provides a sufficient condition for a semigroup `M` to contain an idempotent (i.e. an element `m` such that `m * m = m `), namely that `M` is a nonempty compact Hausdorff space where right-multiplication by constants is continuous. We also state a corresponding lemma guaranteeing that a subset of `M` contains an idempotent. -/ /-- Any nonempty compact Hausdorff semigroup where right-multiplication is continuous contains an idempotent, i.e. an `m` such that `m * m = m`. -/ @[to_additive "Any nonempty compact Hausdorff additive semigroup where right-addition is continuous contains an idempotent, i.e. an `m` such that `m + m = m`"] theorem exists_idempotent_of_compact_t2_of_continuous_mul_left {M} [Nonempty M] [Semigroup M] [TopologicalSpace M] [CompactSpace M] [T2Space M] (continuous_mul_left : ∀ r : M, Continuous (· * r)) : ∃ m : M, m * m = m := by /- We apply Zorn's lemma to the poset of nonempty closed subsemigroups of `M`. It will turn out that any minimal element is `{m}` for an idempotent `m : M`. -/ let S : Set (Set M) := { N | IsClosed N ∧ N.Nonempty ∧ ∀ (m) (_ : m ∈ N) (m') (_ : m' ∈ N), m * m' ∈ N } rsuffices ⟨N, ⟨N_closed, ⟨m, hm⟩, N_mul⟩, N_minimal⟩ : ∃ N ∈ S, ∀ N' ∈ S, N' ⊆ N → N' = N · use m /- We now have an element `m : M` of a minimal subsemigroup `N`, and want to show `m + m = m`. We first show that every element of `N` is of the form `m' + m`. -/ have scaling_eq_self : (· * m) '' N = N := by apply N_minimal · refine ⟨(continuous_mul_left m).isClosedMap _ N_closed, ⟨_, ⟨m, hm, rfl⟩⟩, ?_⟩ rintro _ ⟨m'', hm'', rfl⟩ _ ⟨m', hm', rfl⟩ exact ⟨m'' * m * m', N_mul _ (N_mul _ hm'' _ hm) _ hm', mul_assoc _ _ _⟩ · rintro _ ⟨m', hm', rfl⟩ exact N_mul _ hm' _ hm /- In particular, this means that `m' * m = m` for some `m'`. We now use minimality again to show that this holds for all `m' ∈ N`. -/ have absorbing_eq_self : N ∩ { m' | m' * m = m } = N := by apply N_minimal · refine ⟨N_closed.inter ((T1Space.t1 m).preimage (continuous_mul_left m)), ?_, ?_⟩ · rwa [← scaling_eq_self] at hm · rintro m'' ⟨mem'', eq'' : _ = m⟩ m' ⟨mem', eq' : _ = m⟩ refine ⟨N_mul _ mem'' _ mem', ?_⟩ rw [Set.mem_setOf_eq, mul_assoc, eq', eq''] apply Set.inter_subset_left -- Thus `m * m = m` as desired. rw [← absorbing_eq_self] at hm exact hm.2 refine zorn_superset _ fun c hcs hc => ?_ refine ⟨⋂₀ c, ⟨isClosed_sInter fun t ht => (hcs ht).1, ?_, fun m hm m' hm' => ?_⟩, fun s hs => Set.sInter_subset_of_mem hs⟩ · obtain rfl | hcnemp := c.eq_empty_or_nonempty · rw [Set.sInter_empty] apply Set.univ_nonempty convert @IsCompact.nonempty_iInter_of_directed_nonempty_isCompact_isClosed _ _ _ hcnemp.coe_sort ((↑) : c → Set M) ?_ ?_ ?_ ?_ · exact Set.sInter_eq_iInter · refine DirectedOn.directed_val (IsChain.directedOn hc.symm) exacts [fun i => (hcs i.prop).2.1, fun i => (hcs i.prop).1.isCompact, fun i => (hcs i.prop).1] · rw [Set.mem_sInter] exact fun t ht => (hcs ht).2.2 m (Set.mem_sInter.mp hm t ht) m' (Set.mem_sInter.mp hm' t ht) /-- A version of `exists_idempotent_of_compact_t2_of_continuous_mul_left` where the idempotent lies in some specified nonempty compact subsemigroup. -/ @[to_additive exists_idempotent_in_compact_add_subsemigroup "A version of `exists_idempotent_of_compact_t2_of_continuous_add_left` where the idempotent lies in some specified nonempty compact additive subsemigroup."] theorem exists_idempotent_in_compact_subsemigroup {M} [Semigroup M] [TopologicalSpace M] [T2Space M] (continuous_mul_left : ∀ r : M, Continuous (· * r)) (s : Set M) (snemp : s.Nonempty) (s_compact : IsCompact s) (s_add : ∀ᵉ (x ∈ s) (y ∈ s), x * y ∈ s) : ∃ m ∈ s, m * m = m := by let M' := { m // m ∈ s } letI : Semigroup M' := { mul := fun p q => ⟨p.1 * q.1, s_add _ p.2 _ q.2⟩ mul_assoc := fun p q r => Subtype.eq (mul_assoc _ _ _) } haveI : CompactSpace M' := isCompact_iff_compactSpace.mp s_compact haveI : Nonempty M' := nonempty_subtype.mpr snemp have : ∀ p : M', Continuous (· * p) := fun p => ((continuous_mul_left p.1).comp continuous_subtype_val).subtype_mk _ obtain ⟨⟨m, hm⟩, idem⟩ := exists_idempotent_of_compact_t2_of_continuous_mul_left this exact ⟨m, hm, Subtype.ext_iff.mp idem⟩
Topology\Algebra\Star.lean
/- Copyright (c) 2022 Eric Wieser. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Eric Wieser -/ import Mathlib.Algebra.Star.Pi import Mathlib.Algebra.Star.Prod import Mathlib.Topology.Algebra.Constructions import Mathlib.Topology.ContinuousFunction.Basic /-! # Continuity of `star` This file defines the `ContinuousStar` typeclass, along with instances on `Pi`, `Prod`, `MulOpposite`, and `Units`. -/ open Filter Topology /-- Basic hypothesis to talk about a topological space with a continuous `star` operator. -/ class ContinuousStar (R : Type*) [TopologicalSpace R] [Star R] : Prop where /-- The `star` operator is continuous. -/ continuous_star : Continuous (star : R → R) export ContinuousStar (continuous_star) section Continuity variable {α R : Type*} [TopologicalSpace R] [Star R] [ContinuousStar R] theorem continuousOn_star {s : Set R} : ContinuousOn star s := continuous_star.continuousOn theorem continuousWithinAt_star {s : Set R} {x : R} : ContinuousWithinAt star s x := continuous_star.continuousWithinAt theorem continuousAt_star {x : R} : ContinuousAt star x := continuous_star.continuousAt theorem tendsto_star (a : R) : Tendsto star (𝓝 a) (𝓝 (star a)) := continuousAt_star theorem Filter.Tendsto.star {f : α → R} {l : Filter α} {y : R} (h : Tendsto f l (𝓝 y)) : Tendsto (fun x => star (f x)) l (𝓝 (star y)) := (continuous_star.tendsto y).comp h variable [TopologicalSpace α] {f : α → R} {s : Set α} {x : α} @[continuity, fun_prop] theorem Continuous.star (hf : Continuous f) : Continuous fun x => star (f x) := continuous_star.comp hf @[fun_prop] theorem ContinuousAt.star (hf : ContinuousAt f x) : ContinuousAt (fun x => star (f x)) x := continuousAt_star.comp hf @[fun_prop] theorem ContinuousOn.star (hf : ContinuousOn f s) : ContinuousOn (fun x => star (f x)) s := continuous_star.comp_continuousOn hf theorem ContinuousWithinAt.star (hf : ContinuousWithinAt f s x) : ContinuousWithinAt (fun x => star (f x)) s x := Filter.Tendsto.star hf /-- The star operation bundled as a continuous map. -/ @[simps] def starContinuousMap : C(R, R) := ⟨star, continuous_star⟩ end Continuity section Instances variable {R S ι : Type*} instance [Star R] [Star S] [TopologicalSpace R] [TopologicalSpace S] [ContinuousStar R] [ContinuousStar S] : ContinuousStar (R × S) := ⟨(continuous_star.comp continuous_fst).prod_mk (continuous_star.comp continuous_snd)⟩ instance {C : ι → Type*} [∀ i, TopologicalSpace (C i)] [∀ i, Star (C i)] [∀ i, ContinuousStar (C i)] : ContinuousStar (∀ i, C i) where continuous_star := continuous_pi fun i => Continuous.star (continuous_apply i) instance [Star R] [TopologicalSpace R] [ContinuousStar R] : ContinuousStar Rᵐᵒᵖ := ⟨MulOpposite.continuous_op.comp <| MulOpposite.continuous_unop.star⟩ instance [Monoid R] [StarMul R] [TopologicalSpace R] [ContinuousStar R] : ContinuousStar Rˣ := ⟨continuous_induced_rng.2 Units.continuous_embedProduct.star⟩ end Instances
Topology\Algebra\StarSubalgebra.lean
/- Copyright (c) 2022 Jireh Loreaux. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Jireh Loreaux -/ import Mathlib.Algebra.Star.Subalgebra import Mathlib.Topology.Algebra.Algebra import Mathlib.Topology.Algebra.Star /-! # Topological star (sub)algebras A topological star algebra over a topological semiring `R` is a topological semiring with a compatible continuous scalar multiplication by elements of `R` and a continuous star operation. We reuse typeclass `ContinuousSMul` for topological algebras. ## Results This is just a minimal stub for now! The topological closure of a star subalgebra is still a star subalgebra, which as a star algebra is a topological star algebra. -/ namespace StarSubalgebra section TopologicalStarAlgebra variable {R A B : Type*} [CommSemiring R] [StarRing R] variable [TopologicalSpace A] [Semiring A] [Algebra R A] [StarRing A] [StarModule R A] instance [TopologicalSemiring A] (s : StarSubalgebra R A) : TopologicalSemiring s := s.toSubalgebra.topologicalSemiring /-- The `StarSubalgebra.inclusion` of a star subalgebra is an `Embedding`. -/ theorem embedding_inclusion {S₁ S₂ : StarSubalgebra R A} (h : S₁ ≤ S₂) : Embedding (inclusion h) := { induced := Eq.symm induced_compose inj := Subtype.map_injective h Function.injective_id } /-- The `StarSubalgebra.inclusion` of a closed star subalgebra is a `ClosedEmbedding`. -/ theorem closedEmbedding_inclusion {S₁ S₂ : StarSubalgebra R A} (h : S₁ ≤ S₂) (hS₁ : IsClosed (S₁ : Set A)) : ClosedEmbedding (inclusion h) := { embedding_inclusion h with isClosed_range := isClosed_induced_iff.2 ⟨S₁, hS₁, by convert (Set.range_subtype_map id _).symm · rw [Set.image_id]; rfl · intro _ h' apply h h' ⟩ } variable [TopologicalSemiring A] [ContinuousStar A] variable [TopologicalSpace B] [Semiring B] [Algebra R B] [StarRing B] /-- The closure of a star subalgebra in a topological star algebra as a star subalgebra. -/ def topologicalClosure (s : StarSubalgebra R A) : StarSubalgebra R A := { s.toSubalgebra.topologicalClosure with carrier := closure (s : Set A) star_mem' := fun ha => map_mem_closure continuous_star ha fun x => (star_mem : x ∈ s → star x ∈ s) } theorem topologicalClosure_toSubalgebra_comm (s : StarSubalgebra R A) : s.topologicalClosure.toSubalgebra = s.toSubalgebra.topologicalClosure := SetLike.coe_injective rfl @[simp] theorem topologicalClosure_coe (s : StarSubalgebra R A) : (s.topologicalClosure : Set A) = closure (s : Set A) := rfl theorem le_topologicalClosure (s : StarSubalgebra R A) : s ≤ s.topologicalClosure := subset_closure theorem isClosed_topologicalClosure (s : StarSubalgebra R A) : IsClosed (s.topologicalClosure : Set A) := isClosed_closure instance {A : Type*} [UniformSpace A] [CompleteSpace A] [Semiring A] [StarRing A] [TopologicalSemiring A] [ContinuousStar A] [Algebra R A] [StarModule R A] {S : StarSubalgebra R A} : CompleteSpace S.topologicalClosure := isClosed_closure.completeSpace_coe theorem topologicalClosure_minimal {s t : StarSubalgebra R A} (h : s ≤ t) (ht : IsClosed (t : Set A)) : s.topologicalClosure ≤ t := closure_minimal h ht theorem topologicalClosure_mono : Monotone (topologicalClosure : _ → StarSubalgebra R A) := fun _ S₂ h => topologicalClosure_minimal (h.trans <| le_topologicalClosure S₂) (isClosed_topologicalClosure S₂) theorem topologicalClosure_map_le [StarModule R B] [TopologicalSemiring B] [ContinuousStar B] (s : StarSubalgebra R A) (φ : A →⋆ₐ[R] B) (hφ : IsClosedMap φ) : (map φ s).topologicalClosure ≤ map φ s.topologicalClosure := hφ.closure_image_subset _ theorem map_topologicalClosure_le [StarModule R B] [TopologicalSemiring B] [ContinuousStar B] (s : StarSubalgebra R A) (φ : A →⋆ₐ[R] B) (hφ : Continuous φ) : map φ s.topologicalClosure ≤ (map φ s).topologicalClosure := image_closure_subset_closure_image hφ theorem topologicalClosure_map [StarModule R B] [TopologicalSemiring B] [ContinuousStar B] (s : StarSubalgebra R A) (φ : A →⋆ₐ[R] B) (hφ : ClosedEmbedding φ) : (map φ s).topologicalClosure = map φ s.topologicalClosure := SetLike.coe_injective <| hφ.closure_image_eq _ theorem _root_.Subalgebra.topologicalClosure_star_comm (s : Subalgebra R A) : (star s).topologicalClosure = star s.topologicalClosure := by suffices ∀ t : Subalgebra R A, (star t).topologicalClosure ≤ star t.topologicalClosure from le_antisymm (this s) (by simpa only [star_star] using Subalgebra.star_mono (this (star s))) exact fun t => (star t).topologicalClosure_minimal (Subalgebra.star_mono subset_closure) (isClosed_closure.preimage continuous_star) /-- If a star subalgebra of a topological star algebra is commutative, then so is its topological closure. See note [reducible non-instances]. -/ abbrev commSemiringTopologicalClosure [T2Space A] (s : StarSubalgebra R A) (hs : ∀ x y : s, x * y = y * x) : CommSemiring s.topologicalClosure := s.toSubalgebra.commSemiringTopologicalClosure hs /-- If a star subalgebra of a topological star algebra is commutative, then so is its topological closure. See note [reducible non-instances]. -/ abbrev commRingTopologicalClosure {R A} [CommRing R] [StarRing R] [TopologicalSpace A] [Ring A] [Algebra R A] [StarRing A] [StarModule R A] [TopologicalRing A] [ContinuousStar A] [T2Space A] (s : StarSubalgebra R A) (hs : ∀ x y : s, x * y = y * x) : CommRing s.topologicalClosure := s.toSubalgebra.commRingTopologicalClosure hs /-- Continuous `StarAlgHom`s from the topological closure of a `StarSubalgebra` whose compositions with the `StarSubalgebra.inclusion` map agree are, in fact, equal. -/ theorem _root_.StarAlgHom.ext_topologicalClosure [T2Space B] {S : StarSubalgebra R A} {φ ψ : S.topologicalClosure →⋆ₐ[R] B} (hφ : Continuous φ) (hψ : Continuous ψ) (h : φ.comp (inclusion (le_topologicalClosure S)) = ψ.comp (inclusion (le_topologicalClosure S))) : φ = ψ := by rw [DFunLike.ext'_iff] have : Dense (Set.range <| inclusion (le_topologicalClosure S)) := by refine embedding_subtype_val.toInducing.dense_iff.2 fun x => ?_ convert show ↑x ∈ closure (S : Set A) from x.prop rw [← Set.range_comp] exact Set.ext fun y => ⟨by rintro ⟨y, rfl⟩ exact y.prop, fun hy => ⟨⟨y, hy⟩, rfl⟩⟩ refine Continuous.ext_on this hφ hψ ?_ rintro _ ⟨x, rfl⟩ simpa only using DFunLike.congr_fun h x theorem _root_.StarAlgHomClass.ext_topologicalClosure [T2Space B] {F : Type*} {S : StarSubalgebra R A} [FunLike F S.topologicalClosure B] [AlgHomClass F R S.topologicalClosure B] [StarAlgHomClass F R S.topologicalClosure B] {φ ψ : F} (hφ : Continuous φ) (hψ : Continuous ψ) (h : ∀ x : S, φ (inclusion (le_topologicalClosure S) x) = ψ ((inclusion (le_topologicalClosure S)) x)) : φ = ψ := by -- Porting note: an intervening coercion seems to have appeared since ML3 have : (φ : S.topologicalClosure →⋆ₐ[R] B) = (ψ : S.topologicalClosure →⋆ₐ[R] B) := by refine StarAlgHom.ext_topologicalClosure (R := R) (A := A) (B := B) hφ hψ (StarAlgHom.ext ?_) simpa only [StarAlgHom.coe_comp, StarAlgHom.coe_coe] using h rw [DFunLike.ext'_iff, ← StarAlgHom.coe_coe] apply congrArg _ this end TopologicalStarAlgebra end StarSubalgebra section Elemental open StarSubalgebra StarAlgebra variable (R : Type*) {A B : Type*} [CommSemiring R] [StarRing R] variable [TopologicalSpace A] [Semiring A] [StarRing A] [TopologicalSemiring A] variable [ContinuousStar A] [Algebra R A] [StarModule R A] variable [TopologicalSpace B] [Semiring B] [StarRing B] [Algebra R B] /-- The topological closure of the subalgebra generated by a single element. -/ def elementalStarAlgebra (x : A) : StarSubalgebra R A := (adjoin R ({x} : Set A)).topologicalClosure namespace elementalStarAlgebra @[aesop safe apply (rule_sets := [SetLike])] theorem self_mem (x : A) : x ∈ elementalStarAlgebra R x := SetLike.le_def.mp (le_topologicalClosure _) (self_mem_adjoin_singleton R x) theorem star_self_mem (x : A) : star x ∈ elementalStarAlgebra R x := star_mem <| self_mem R x /-- The `elementalStarAlgebra` generated by a normal element is commutative. -/ instance [T2Space A] {x : A} [IsStarNormal x] : CommSemiring (elementalStarAlgebra R x) := StarSubalgebra.commSemiringTopologicalClosure _ mul_comm /-- The `elementalStarAlgebra` generated by a normal element is commutative. -/ instance {R A} [CommRing R] [StarRing R] [TopologicalSpace A] [Ring A] [Algebra R A] [StarRing A] [StarModule R A] [TopologicalRing A] [ContinuousStar A] [T2Space A] {x : A} [IsStarNormal x] : CommRing (elementalStarAlgebra R x) := StarSubalgebra.commRingTopologicalClosure _ mul_comm theorem isClosed (x : A) : IsClosed (elementalStarAlgebra R x : Set A) := isClosed_closure instance {A : Type*} [UniformSpace A] [CompleteSpace A] [Semiring A] [StarRing A] [TopologicalSemiring A] [ContinuousStar A] [Algebra R A] [StarModule R A] (x : A) : CompleteSpace (elementalStarAlgebra R x) := isClosed_closure.completeSpace_coe theorem le_of_isClosed_of_mem {S : StarSubalgebra R A} (hS : IsClosed (S : Set A)) {x : A} (hx : x ∈ S) : elementalStarAlgebra R x ≤ S := topologicalClosure_minimal (adjoin_le <| Set.singleton_subset_iff.2 hx) hS /-- The coercion from an elemental algebra to the full algebra as a `ClosedEmbedding`. -/ theorem closedEmbedding_coe (x : A) : ClosedEmbedding ((↑) : elementalStarAlgebra R x → A) := { induced := rfl inj := Subtype.coe_injective isClosed_range := by convert isClosed R x exact Set.ext fun y => ⟨by rintro ⟨y, rfl⟩ exact y.prop, fun hy => ⟨⟨y, hy⟩, rfl⟩⟩ } @[elab_as_elim] theorem induction_on {x y : A} (hy : y ∈ elementalStarAlgebra R x) {P : (u : A) → u ∈ elementalStarAlgebra R x → Prop} (self : P x (self_mem R x)) (star_self : P (star x) (star_self_mem R x)) (algebraMap : ∀ r, P (algebraMap R A r) (_root_.algebraMap_mem _ r)) (add : ∀ u hu v hv, P u hu → P v hv → P (u + v) (add_mem hu hv)) (mul : ∀ u hu v hv, P u hu → P v hv → P (u * v) (mul_mem hu hv)) (closure : ∀ s : Set A, (hs : s ⊆ elementalStarAlgebra R x) → (∀ u, (hu : u ∈ s) → P u (hs hu)) → ∀ v, (hv : v ∈ closure s) → P v (closure_minimal hs (isClosed R x) hv)) : P y hy := by apply closure (adjoin R {x} : Set A) subset_closure (fun y hy ↦ ?_) y hy rw [SetLike.mem_coe, ← mem_toSubalgebra, adjoin_toSubalgebra] at hy induction hy using Algebra.adjoin_induction'' with | mem u hu => obtain ((rfl : u = x) | (hu : star u = x)) := by simpa using hu · exact self · simp_rw [← hu, star_star] at star_self exact star_self | algebraMap r => exact algebraMap r | add u hu_mem v hv_mem hu hv => exact add u (subset_closure hu_mem) v (subset_closure hv_mem) (hu hu_mem) (hv hv_mem) | mul u hu_mem v hv_mem hu hv => exact mul u (subset_closure hu_mem) v (subset_closure hv_mem) (hu hu_mem) (hv hv_mem) theorem starAlgHomClass_ext [T2Space B] {F : Type*} {a : A} [FunLike F (elementalStarAlgebra R a) B] [AlgHomClass F R _ B] [StarAlgHomClass F R _ B] {φ ψ : F} (hφ : Continuous φ) (hψ : Continuous ψ) (h : φ ⟨a, self_mem R a⟩ = ψ ⟨a, self_mem R a⟩) : φ = ψ := by -- Note: help with unfolding `elementalStarAlgebra` have : StarAlgHomClass F R (↥(topologicalClosure (adjoin R {a}))) B := inferInstanceAs (StarAlgHomClass F R (elementalStarAlgebra R a) B) refine StarAlgHomClass.ext_topologicalClosure hφ hψ fun x => ?_ refine adjoin_induction' x ?_ ?_ ?_ ?_ ?_ exacts [fun y hy => by simpa only [Set.mem_singleton_iff.mp hy] using h, fun r => by simp only [AlgHomClass.commutes], fun x y hx hy => by simp only [map_add, hx, hy], fun x y hx hy => by simp only [map_mul, hx, hy], fun x hx => by simp only [map_star, hx]] end elementalStarAlgebra end Elemental
Topology\Algebra\UniformConvergence.lean
/- Copyright (c) 2022 Anatole Dedecker. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Anatole Dedecker -/ import Mathlib.Topology.Algebra.UniformMulAction import Mathlib.Algebra.Module.Pi /-! # Algebraic facts about the topology of uniform convergence This file contains algebraic compatibility results about the uniform structure of uniform convergence / `𝔖`-convergence. They will mostly be useful for defining strong topologies on the space of continuous linear maps between two topological vector spaces. ## Main statements * `UniformFun.uniform_group` : if `G` is a uniform group, then `α →ᵤ G` a uniform group * `UniformOnFun.uniform_group` : if `G` is a uniform group, then for any `𝔖 : Set (Set α)`, `α →ᵤ[𝔖] G` a uniform group. ## Implementation notes Like in `Mathlib.Topology.UniformSpace.UniformConvergenceTopology`, we use the type aliases `UniformFun` (denoted `α →ᵤ β`) and `UniformOnFun` (denoted `α →ᵤ[𝔖] β`) for functions from `α` to `β` endowed with the structures of uniform convergence and `𝔖`-convergence. ## References * [N. Bourbaki, *General Topology, Chapter X*][bourbaki1966] * [N. Bourbaki, *Topological Vector Spaces*][bourbaki1987] ## Tags uniform convergence, strong dual -/ open Filter open scoped Topology Pointwise UniformConvergence Uniformity section AlgebraicInstances variable {α β ι R : Type*} {𝔖 : Set <| Set α} {x : α} @[to_additive] instance [One β] : One (α →ᵤ β) := Pi.instOne @[to_additive (attr := simp)] lemma UniformFun.toFun_one [One β] : toFun (1 : α →ᵤ β) = 1 := rfl @[to_additive (attr := simp)] lemma UniformFun.ofFun_one [One β] : ofFun (1 : α → β) = 1 := rfl @[to_additive] instance [One β] : One (α →ᵤ[𝔖] β) := Pi.instOne @[to_additive (attr := simp)] lemma UniformOnFun.toFun_one [One β] : toFun 𝔖 (1 : α →ᵤ[𝔖] β) = 1 := rfl @[to_additive (attr := simp)] lemma UniformOnFun.one_apply [One β] : ofFun 𝔖 (1 : α → β) = 1 := rfl @[to_additive] instance [Mul β] : Mul (α →ᵤ β) := Pi.instMul @[to_additive (attr := simp)] lemma UniformFun.toFun_mul [Mul β] (f g : α →ᵤ β) : toFun (f * g) = toFun f * toFun g := rfl @[to_additive (attr := simp)] lemma UniformFun.ofFun_mul [Mul β] (f g : α → β) : ofFun (f * g) = ofFun f * ofFun g := rfl @[to_additive] instance [Mul β] : Mul (α →ᵤ[𝔖] β) := Pi.instMul @[to_additive (attr := simp)] lemma UniformOnFun.toFun_mul [Mul β] (f g : α →ᵤ[𝔖] β) : toFun 𝔖 (f * g) = toFun 𝔖 f * toFun 𝔖 g := rfl @[to_additive (attr := simp)] lemma UniformOnFun.ofFun_mul [Mul β] (f g : α → β) : ofFun 𝔖 (f * g) = ofFun 𝔖 f * ofFun 𝔖 g := rfl @[to_additive] instance [Inv β] : Inv (α →ᵤ β) := Pi.instInv @[to_additive (attr := simp)] lemma UniformFun.toFun_inv [Inv β] (f : α →ᵤ β) : toFun (f⁻¹) = (toFun f)⁻¹ := rfl @[to_additive (attr := simp)] lemma UniformFun.ofFun_inv [Inv β] (f : α → β) : ofFun (f⁻¹) = (ofFun f)⁻¹ := rfl @[to_additive] instance [Inv β] : Inv (α →ᵤ[𝔖] β) := Pi.instInv @[to_additive (attr := simp)] lemma UniformOnFun.toFun_inv [Inv β] (f : α →ᵤ[𝔖] β) : toFun 𝔖 (f⁻¹) = (toFun 𝔖 f)⁻¹ := rfl @[to_additive (attr := simp)] lemma UniformOnFun.ofFun_inv [Inv β] (f : α → β) : ofFun 𝔖 (f⁻¹) = (ofFun 𝔖 f)⁻¹ := rfl @[to_additive] instance [Div β] : Div (α →ᵤ β) := Pi.instDiv @[to_additive (attr := simp)] lemma UniformFun.toFun_div [Div β] (f g : α →ᵤ β) : toFun (f / g) = toFun f / toFun g := rfl @[to_additive (attr := simp)] lemma UniformFun.ofFun_div [Div β] (f g : α → β) : ofFun (f / g) = ofFun f / ofFun g := rfl @[to_additive] instance [Div β] : Div (α →ᵤ[𝔖] β) := Pi.instDiv @[to_additive (attr := simp)] lemma UniformOnFun.toFun_div [Div β] (f g : α →ᵤ[𝔖] β) : toFun 𝔖 (f / g) = toFun 𝔖 f / toFun 𝔖 g := rfl @[to_additive (attr := simp)] lemma UniformOnFun.ofFun_div [Div β] (f g : α → β) : ofFun 𝔖 (f / g) = ofFun 𝔖 f / ofFun 𝔖 g := rfl @[to_additive] instance [Monoid β] : Monoid (α →ᵤ β) := Pi.monoid @[to_additive] instance [Monoid β] : Monoid (α →ᵤ[𝔖] β) := Pi.monoid @[to_additive] instance [CommMonoid β] : CommMonoid (α →ᵤ β) := Pi.commMonoid @[to_additive] instance [CommMonoid β] : CommMonoid (α →ᵤ[𝔖] β) := Pi.commMonoid @[to_additive] instance [Group β] : Group (α →ᵤ β) := Pi.group @[to_additive] instance [Group β] : Group (α →ᵤ[𝔖] β) := Pi.group @[to_additive] instance [CommGroup β] : CommGroup (α →ᵤ β) := Pi.commGroup @[to_additive] instance [CommGroup β] : CommGroup (α →ᵤ[𝔖] β) := Pi.commGroup instance {M : Type*} [SMul M β] : SMul M (α →ᵤ β) := Pi.instSMul @[simp] lemma UniformFun.toFun_smul {M : Type*} [SMul M β] (c : M) (f : α →ᵤ β) : toFun (c • f) = c • toFun f := rfl @[simp] lemma UniformFun.ofFun_smul {M : Type*} [SMul M β] (c : M) (f : α → β) : ofFun (c • f) = c • ofFun f := rfl instance {M : Type*} [SMul M β] : SMul M (α →ᵤ[𝔖] β) := Pi.instSMul @[simp] lemma UniformOnFun.toFun_smul {M : Type*} [SMul M β] (c : M) (f : α →ᵤ[𝔖] β) : toFun 𝔖 (c • f) = c • toFun 𝔖 f := rfl @[simp] lemma UniformOnFun.ofFun_smul {M : Type*} [SMul M β] (c : M) (f : α → β) : ofFun 𝔖 (c • f) = c • ofFun 𝔖 f := rfl instance {M N : Type*} [SMul M N] [SMul M β] [SMul N β] [IsScalarTower M N β] : IsScalarTower M N (α →ᵤ β) := Pi.isScalarTower instance {M N : Type*} [SMul M N] [SMul M β] [SMul N β] [IsScalarTower M N β] : IsScalarTower M N (α →ᵤ[𝔖] β) := Pi.isScalarTower instance {M N : Type*} [SMul M β] [SMul N β] [SMulCommClass M N β] : SMulCommClass M N (α →ᵤ β) := Pi.smulCommClass instance {M N : Type*} [SMul M β] [SMul N β] [SMulCommClass M N β] : SMulCommClass M N (α →ᵤ[𝔖] β) := Pi.smulCommClass instance {M : Type*} [Monoid M] [MulAction M β] : MulAction M (α →ᵤ β) := Pi.mulAction _ instance {M : Type*} [Monoid M] [MulAction M β] : MulAction M (α →ᵤ[𝔖] β) := Pi.mulAction _ instance {M : Type*} [Monoid M] [AddMonoid β] [DistribMulAction M β] : DistribMulAction M (α →ᵤ β) := Pi.distribMulAction _ instance {M : Type*} [Monoid M] [AddMonoid β] [DistribMulAction M β] : DistribMulAction M (α →ᵤ[𝔖] β) := Pi.distribMulAction _ instance [Semiring R] [AddCommMonoid β] [Module R β] : Module R (α →ᵤ β) := Pi.module _ _ _ instance [Semiring R] [AddCommMonoid β] [Module R β] : Module R (α →ᵤ[𝔖] β) := Pi.module _ _ _ end AlgebraicInstances section Group variable {α G ι : Type*} [Group G] {𝔖 : Set <| Set α} [UniformSpace G] [UniformGroup G] /-- If `G` is a uniform group, then `α →ᵤ G` is a uniform group as well. -/ @[to_additive "If `G` is a uniform additive group, then `α →ᵤ G` is a uniform additive group as well."] instance : UniformGroup (α →ᵤ G) := ⟨(-- Since `(/) : G × G → G` is uniformly continuous, -- `UniformFun.postcomp_uniformContinuous` tells us that -- `((/) ∘ —) : (α →ᵤ G × G) → (α →ᵤ G)` is uniformly continuous too. By precomposing with -- `UniformFun.uniformEquivProdArrow`, this gives that -- `(/) : (α →ᵤ G) × (α →ᵤ G) → (α →ᵤ G)` is also uniformly continuous UniformFun.postcomp_uniformContinuous uniformContinuous_div).comp UniformFun.uniformEquivProdArrow.symm.uniformContinuous⟩ @[to_additive] protected theorem UniformFun.hasBasis_nhds_one_of_basis {p : ι → Prop} {b : ι → Set G} (h : (𝓝 1 : Filter G).HasBasis p b) : (𝓝 1 : Filter (α →ᵤ G)).HasBasis p fun i => { f : α →ᵤ G | ∀ x, toFun f x ∈ b i } := by convert UniformFun.hasBasis_nhds_of_basis α _ (1 : α →ᵤ G) h.uniformity_of_nhds_one simp @[to_additive] protected theorem UniformFun.hasBasis_nhds_one : (𝓝 1 : Filter (α →ᵤ G)).HasBasis (fun V : Set G => V ∈ (𝓝 1 : Filter G)) fun V => { f : α → G | ∀ x, f x ∈ V } := UniformFun.hasBasis_nhds_one_of_basis (basis_sets _) /-- Let `𝔖 : Set (Set α)`. If `G` is a uniform group, then `α →ᵤ[𝔖] G` is a uniform group as well. -/ @[to_additive "Let `𝔖 : Set (Set α)`. If `G` is a uniform additive group, then `α →ᵤ[𝔖] G` is a uniform additive group as well."] instance : UniformGroup (α →ᵤ[𝔖] G) := ⟨(-- Since `(/) : G × G → G` is uniformly continuous, -- `UniformOnFun.postcomp_uniformContinuous` tells us that -- `((/) ∘ —) : (α →ᵤ[𝔖] G × G) → (α →ᵤ[𝔖] G)` is uniformly continuous too. By precomposing with -- `UniformOnFun.uniformEquivProdArrow`, this gives that -- `(/) : (α →ᵤ[𝔖] G) × (α →ᵤ[𝔖] G) → (α →ᵤ[𝔖] G)` is also uniformly continuous UniformOnFun.postcomp_uniformContinuous uniformContinuous_div).comp UniformOnFun.uniformEquivProdArrow.symm.uniformContinuous⟩ @[to_additive] protected theorem UniformOnFun.hasBasis_nhds_one_of_basis (𝔖 : Set <| Set α) (h𝔖₁ : 𝔖.Nonempty) (h𝔖₂ : DirectedOn (· ⊆ ·) 𝔖) {p : ι → Prop} {b : ι → Set G} (h : (𝓝 1 : Filter G).HasBasis p b) : (𝓝 1 : Filter (α →ᵤ[𝔖] G)).HasBasis (fun Si : Set α × ι => Si.1 ∈ 𝔖 ∧ p Si.2) fun Si => { f : α →ᵤ[𝔖] G | ∀ x ∈ Si.1, toFun 𝔖 f x ∈ b Si.2 } := by have := h.uniformity_of_nhds_one_swapped convert UniformOnFun.hasBasis_nhds_of_basis α _ 𝔖 (1 : α →ᵤ[𝔖] G) h𝔖₁ h𝔖₂ this simp [UniformOnFun.gen] @[to_additive] protected theorem UniformOnFun.hasBasis_nhds_one (𝔖 : Set <| Set α) (h𝔖₁ : 𝔖.Nonempty) (h𝔖₂ : DirectedOn (· ⊆ ·) 𝔖) : (𝓝 1 : Filter (α →ᵤ[𝔖] G)).HasBasis (fun SV : Set α × Set G => SV.1 ∈ 𝔖 ∧ SV.2 ∈ (𝓝 1 : Filter G)) fun SV => { f : α →ᵤ[𝔖] G | ∀ x ∈ SV.1, f x ∈ SV.2 } := UniformOnFun.hasBasis_nhds_one_of_basis 𝔖 h𝔖₁ h𝔖₂ (basis_sets _) end Group section ConstSMul variable (M α X : Type*) [SMul M X] [UniformSpace X] [UniformContinuousConstSMul M X] instance UniformFun.uniformContinuousConstSMul : UniformContinuousConstSMul M (α →ᵤ X) where uniformContinuous_const_smul c := UniformFun.postcomp_uniformContinuous <| uniformContinuous_const_smul c instance UniformFunOn.uniformContinuousConstSMul {𝔖 : Set (Set α)} : UniformContinuousConstSMul M (α →ᵤ[𝔖] X) where uniformContinuous_const_smul c := UniformOnFun.postcomp_uniformContinuous <| uniformContinuous_const_smul c end ConstSMul
Topology\Algebra\UniformField.lean
/- Copyright (c) 2019 Patrick Massot. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot -/ import Mathlib.Algebra.Field.Subfield import Mathlib.Topology.Algebra.Field import Mathlib.Topology.Algebra.UniformRing /-! # Completion of topological fields The goal of this file is to prove the main part of Proposition 7 of Bourbaki GT III 6.8 : The completion `hat K` of a Hausdorff topological field is a field if the image under the mapping `x ↦ x⁻¹` of every Cauchy filter (with respect to the additive uniform structure) which does not have a cluster point at `0` is a Cauchy filter (with respect to the additive uniform structure). Bourbaki does not give any detail here, he refers to the general discussion of extending functions defined on a dense subset with values in a complete Hausdorff space. In particular the subtlety about clustering at zero is totally left to readers. Note that the separated completion of a non-separated topological field is the zero ring, hence the separation assumption is needed. Indeed the kernel of the completion map is the closure of zero which is an ideal. Hence it's either zero (and the field is separated) or the full field, which implies one is sent to zero and the completion ring is trivial. The main definition is `CompletableTopField` which packages the assumptions as a Prop-valued type class and the main results are the instances `UniformSpace.Completion.Field` and `UniformSpace.Completion.TopologicalDivisionRing`. -/ noncomputable section open uniformity Topology open Set UniformSpace UniformSpace.Completion Filter variable (K : Type*) [Field K] [UniformSpace K] local notation "hat" => Completion /-- A topological field is completable if it is separated and the image under the mapping x ↦ x⁻¹ of every Cauchy filter (with respect to the additive uniform structure) which does not have a cluster point at 0 is a Cauchy filter (with respect to the additive uniform structure). This ensures the completion is a field. -/ class CompletableTopField extends T0Space K : Prop where nice : ∀ F : Filter K, Cauchy F → 𝓝 0 ⊓ F = ⊥ → Cauchy (map (fun x => x⁻¹) F) namespace UniformSpace namespace Completion instance (priority := 100) [T0Space K] : Nontrivial (hat K) := ⟨⟨0, 1, fun h => zero_ne_one <| (uniformEmbedding_coe K).inj h⟩⟩ variable {K} /-- extension of inversion to the completion of a field. -/ def hatInv : hat K → hat K := denseInducing_coe.extend fun x : K => (↑x⁻¹ : hat K) theorem continuous_hatInv [CompletableTopField K] {x : hat K} (h : x ≠ 0) : ContinuousAt hatInv x := by refine denseInducing_coe.continuousAt_extend ?_ apply mem_of_superset (compl_singleton_mem_nhds h) intro y y_ne rw [mem_compl_singleton_iff] at y_ne apply CompleteSpace.complete have : (fun (x : K) => (↑x⁻¹ : hat K)) = ((fun (y : K) => (↑y : hat K))∘(fun (x : K) => (x⁻¹ : K))) := by unfold Function.comp simp rw [this, ← Filter.map_map] apply Cauchy.map _ (Completion.uniformContinuous_coe K) apply CompletableTopField.nice · haveI := denseInducing_coe.comap_nhds_neBot y apply cauchy_nhds.comap rw [Completion.comap_coe_eq_uniformity] · have eq_bot : 𝓝 (0 : hat K) ⊓ 𝓝 y = ⊥ := by by_contra h exact y_ne (eq_of_nhds_neBot <| neBot_iff.mpr h).symm erw [denseInducing_coe.nhds_eq_comap (0 : K), ← Filter.comap_inf, eq_bot] exact comap_bot open Classical in /- The value of `hat_inv` at zero is not really specified, although it's probably zero. Here we explicitly enforce the `inv_zero` axiom. -/ instance instInvCompletion : Inv (hat K) := ⟨fun x => if x = 0 then 0 else hatInv x⟩ variable [TopologicalDivisionRing K] theorem hatInv_extends {x : K} (h : x ≠ 0) : hatInv (x : hat K) = ↑(x⁻¹ : K) := denseInducing_coe.extend_eq_at ((continuous_coe K).continuousAt.comp (continuousAt_inv₀ h)) variable [CompletableTopField K] @[norm_cast] theorem coe_inv (x : K) : (x : hat K)⁻¹ = ((x⁻¹ : K) : hat K) := by by_cases h : x = 0 · rw [h, inv_zero] dsimp [Inv.inv] norm_cast simp · conv_lhs => dsimp [Inv.inv] rw [if_neg] · exact hatInv_extends h · exact fun H => h (denseEmbedding_coe.inj H) variable [UniformAddGroup K] theorem mul_hatInv_cancel {x : hat K} (x_ne : x ≠ 0) : x * hatInv x = 1 := by haveI : T1Space (hat K) := T2Space.t1Space let f := fun x : hat K => x * hatInv x let c := (fun (x : K) => (x : hat K)) change f x = 1 have cont : ContinuousAt f x := by letI : TopologicalSpace (hat K × hat K) := instTopologicalSpaceProd have : ContinuousAt (fun y : hat K => ((y, hatInv y) : hat K × hat K)) x := continuous_id.continuousAt.prod (continuous_hatInv x_ne) exact (_root_.continuous_mul.continuousAt.comp this : _) have clo : x ∈ closure (c '' {0}ᶜ) := by have := denseInducing_coe.dense x rw [← image_univ, show (univ : Set K) = {0} ∪ {0}ᶜ from (union_compl_self _).symm, image_union] at this apply mem_closure_of_mem_closure_union this rw [image_singleton] exact compl_singleton_mem_nhds x_ne have fxclo : f x ∈ closure (f '' (c '' {0}ᶜ)) := mem_closure_image cont clo have : f '' (c '' {0}ᶜ) ⊆ {1} := by rw [image_image] rintro _ ⟨z, z_ne, rfl⟩ rw [mem_singleton_iff] rw [mem_compl_singleton_iff] at z_ne dsimp [f] rw [hatInv_extends z_ne, ← coe_mul] rw [mul_inv_cancel z_ne, coe_one] replace fxclo := closure_mono this fxclo rwa [closure_singleton, mem_singleton_iff] at fxclo instance instField : Field (hat K) where exists_pair_ne := ⟨0, 1, fun h => zero_ne_one ((uniformEmbedding_coe K).inj h)⟩ mul_inv_cancel := fun x x_ne => by simp only [Inv.inv, if_neg x_ne, mul_hatInv_cancel x_ne] inv_zero := by simp only [Inv.inv, ite_true] -- TODO: use a better defeq nnqsmul := _ nnqsmul_def := fun q a => rfl qsmul := _ qsmul_def := fun a x => rfl instance : TopologicalDivisionRing (hat K) := { Completion.topologicalRing with continuousAt_inv₀ := by intro x x_ne have : { y | hatInv y = y⁻¹ } ∈ 𝓝 x := haveI : {(0 : hat K)}ᶜ ⊆ { y : hat K | hatInv y = y⁻¹ } := by intro y y_ne rw [mem_compl_singleton_iff] at y_ne dsimp [Inv.inv] rw [if_neg y_ne] mem_of_superset (compl_singleton_mem_nhds x_ne) this exact ContinuousAt.congr (continuous_hatInv x_ne) this } end Completion end UniformSpace variable (L : Type*) [Field L] [UniformSpace L] [CompletableTopField L] instance Subfield.completableTopField (K : Subfield L) : CompletableTopField K where nice F F_cau inf_F := by let i : K →+* L := K.subtype have hi : UniformInducing i := uniformEmbedding_subtype_val.toUniformInducing rw [← hi.cauchy_map_iff] at F_cau ⊢ rw [map_comm (show (i ∘ fun x => x⁻¹) = (fun x => x⁻¹) ∘ i by ext; rfl)] apply CompletableTopField.nice _ F_cau rw [← Filter.push_pull', ← map_zero i, ← hi.inducing.nhds_eq_comap, inf_F, Filter.map_bot] instance (priority := 100) completableTopField_of_complete (L : Type*) [Field L] [UniformSpace L] [TopologicalDivisionRing L] [T0Space L] [CompleteSpace L] : CompletableTopField L where nice F cau_F hF := by haveI : NeBot F := cau_F.1 rcases CompleteSpace.complete cau_F with ⟨x, hx⟩ have hx' : x ≠ 0 := by rintro rfl rw [inf_eq_right.mpr hx] at hF exact cau_F.1.ne hF exact Filter.Tendsto.cauchy_map <| calc map (fun x => x⁻¹) F ≤ map (fun x => x⁻¹) (𝓝 x) := map_mono hx _ ≤ 𝓝 x⁻¹ := continuousAt_inv₀ hx'
Topology\Algebra\UniformFilterBasis.lean
/- Copyright (c) 2021 Patrick Massot. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot -/ import Mathlib.Topology.Algebra.FilterBasis import Mathlib.Topology.Algebra.UniformGroup /-! # Uniform properties of neighborhood bases in topological algebra This files contains properties of filter bases on algebraic structures that also require the theory of uniform spaces. The only result so far is a characterization of Cauchy filters in topological groups. -/ open uniformity Filter open Filter namespace AddGroupFilterBasis variable {G : Type*} [AddCommGroup G] (B : AddGroupFilterBasis G) /-- The uniform space structure associated to an abelian group filter basis via the associated topological abelian group structure. -/ protected def uniformSpace : UniformSpace G := @TopologicalAddGroup.toUniformSpace G _ B.topology B.isTopologicalAddGroup /-- The uniform space structure associated to an abelian group filter basis via the associated topological abelian group structure is compatible with its group structure. -/ protected theorem uniformAddGroup : @UniformAddGroup G B.uniformSpace _ := @comm_topologicalAddGroup_is_uniform G _ B.topology B.isTopologicalAddGroup theorem cauchy_iff {F : Filter G} : @Cauchy G B.uniformSpace F ↔ F.NeBot ∧ ∀ U ∈ B, ∃ M ∈ F, ∀ᵉ (x ∈ M) (y ∈ M), y - x ∈ U := by letI := B.uniformSpace haveI := B.uniformAddGroup suffices F ×ˢ F ≤ uniformity G ↔ ∀ U ∈ B, ∃ M ∈ F, ∀ᵉ (x ∈ M) (y ∈ M), y - x ∈ U by constructor <;> rintro ⟨h', h⟩ <;> refine ⟨h', ?_⟩ <;> [rwa [← this]; rwa [this]] rw [uniformity_eq_comap_nhds_zero G, ← map_le_iff_le_comap] change Tendsto _ _ _ ↔ _ simp [(basis_sets F).prod_self.tendsto_iff B.nhds_zero_hasBasis, @forall_swap (_ ∈ _) G] end AddGroupFilterBasis
Topology\Algebra\UniformGroup.lean
/- Copyright (c) 2018 Patrick Massot. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Johannes Hölzl -/ import Mathlib.Topology.UniformSpace.UniformConvergence import Mathlib.Topology.UniformSpace.UniformEmbedding import Mathlib.Topology.UniformSpace.CompleteSeparated import Mathlib.Topology.UniformSpace.Compact import Mathlib.Topology.Algebra.Group.Basic import Mathlib.Topology.DiscreteSubset import Mathlib.Tactic.Abel /-! # Uniform structure on topological groups This file defines uniform groups and its additive counterpart. These typeclasses should be preferred over using `[TopologicalSpace α] [TopologicalGroup α]` since every topological group naturally induces a uniform structure. ## Main declarations * `UniformGroup` and `UniformAddGroup`: Multiplicative and additive uniform groups, that i.e., groups with uniformly continuous `(*)` and `(⁻¹)` / `(+)` and `(-)`. ## Main results * `TopologicalAddGroup.toUniformSpace` and `comm_topologicalAddGroup_is_uniform` can be used to construct a canonical uniformity for a topological add group. * extension of ℤ-bilinear maps to complete groups (useful for ring completions) * `QuotientGroup.completeSpace` and `QuotientAddGroup.completeSpace` guarantee that quotients of first countable topological groups by normal subgroups are themselves complete. In particular, the quotient of a Banach space by a subspace is complete. -/ noncomputable section open Uniformity Topology Filter Pointwise section UniformGroup open Filter Set variable {α : Type*} {β : Type*} /-- A uniform group is a group in which multiplication and inversion are uniformly continuous. -/ class UniformGroup (α : Type*) [UniformSpace α] [Group α] : Prop where uniformContinuous_div : UniformContinuous fun p : α × α => p.1 / p.2 /-- A uniform additive group is an additive group in which addition and negation are uniformly continuous. -/ class UniformAddGroup (α : Type*) [UniformSpace α] [AddGroup α] : Prop where uniformContinuous_sub : UniformContinuous fun p : α × α => p.1 - p.2 attribute [to_additive] UniformGroup @[to_additive] theorem UniformGroup.mk' {α} [UniformSpace α] [Group α] (h₁ : UniformContinuous fun p : α × α => p.1 * p.2) (h₂ : UniformContinuous fun p : α => p⁻¹) : UniformGroup α := ⟨by simpa only [div_eq_mul_inv] using h₁.comp (uniformContinuous_fst.prod_mk (h₂.comp uniformContinuous_snd))⟩ variable [UniformSpace α] [Group α] [UniformGroup α] @[to_additive] theorem uniformContinuous_div : UniformContinuous fun p : α × α => p.1 / p.2 := UniformGroup.uniformContinuous_div @[to_additive] theorem UniformContinuous.div [UniformSpace β] {f : β → α} {g : β → α} (hf : UniformContinuous f) (hg : UniformContinuous g) : UniformContinuous fun x => f x / g x := uniformContinuous_div.comp (hf.prod_mk hg) @[to_additive] theorem UniformContinuous.inv [UniformSpace β] {f : β → α} (hf : UniformContinuous f) : UniformContinuous fun x => (f x)⁻¹ := by have : UniformContinuous fun x => 1 / f x := uniformContinuous_const.div hf simp_all @[to_additive] theorem uniformContinuous_inv : UniformContinuous fun x : α => x⁻¹ := uniformContinuous_id.inv @[to_additive] theorem UniformContinuous.mul [UniformSpace β] {f : β → α} {g : β → α} (hf : UniformContinuous f) (hg : UniformContinuous g) : UniformContinuous fun x => f x * g x := by have : UniformContinuous fun x => f x / (g x)⁻¹ := hf.div hg.inv simp_all @[to_additive] theorem uniformContinuous_mul : UniformContinuous fun p : α × α => p.1 * p.2 := uniformContinuous_fst.mul uniformContinuous_snd @[to_additive UniformContinuous.const_nsmul] theorem UniformContinuous.pow_const [UniformSpace β] {f : β → α} (hf : UniformContinuous f) : ∀ n : ℕ, UniformContinuous fun x => f x ^ n | 0 => by simp_rw [pow_zero] exact uniformContinuous_const | n + 1 => by simp_rw [pow_succ'] exact hf.mul (hf.pow_const n) @[to_additive uniformContinuous_const_nsmul] theorem uniformContinuous_pow_const (n : ℕ) : UniformContinuous fun x : α => x ^ n := uniformContinuous_id.pow_const n @[to_additive UniformContinuous.const_zsmul] theorem UniformContinuous.zpow_const [UniformSpace β] {f : β → α} (hf : UniformContinuous f) : ∀ n : ℤ, UniformContinuous fun x => f x ^ n | (n : ℕ) => by simp_rw [zpow_natCast] exact hf.pow_const _ | Int.negSucc n => by simp_rw [zpow_negSucc] exact (hf.pow_const _).inv @[to_additive uniformContinuous_const_zsmul] theorem uniformContinuous_zpow_const (n : ℤ) : UniformContinuous fun x : α => x ^ n := uniformContinuous_id.zpow_const n @[to_additive] instance (priority := 10) UniformGroup.to_topologicalGroup : TopologicalGroup α where continuous_mul := uniformContinuous_mul.continuous continuous_inv := uniformContinuous_inv.continuous @[to_additive] instance [UniformSpace β] [Group β] [UniformGroup β] : UniformGroup (α × β) := ⟨((uniformContinuous_fst.comp uniformContinuous_fst).div (uniformContinuous_fst.comp uniformContinuous_snd)).prod_mk ((uniformContinuous_snd.comp uniformContinuous_fst).div (uniformContinuous_snd.comp uniformContinuous_snd))⟩ @[to_additive] instance Pi.instUniformGroup {ι : Type*} {G : ι → Type*} [∀ i, UniformSpace (G i)] [∀ i, Group (G i)] [∀ i, UniformGroup (G i)] : UniformGroup (∀ i, G i) where uniformContinuous_div := uniformContinuous_pi.mpr fun i ↦ (uniformContinuous_proj G i).comp uniformContinuous_fst |>.div <| (uniformContinuous_proj G i).comp uniformContinuous_snd @[to_additive] theorem uniformity_translate_mul (a : α) : ((𝓤 α).map fun x : α × α => (x.1 * a, x.2 * a)) = 𝓤 α := le_antisymm (uniformContinuous_id.mul uniformContinuous_const) (calc 𝓤 α = ((𝓤 α).map fun x : α × α => (x.1 * a⁻¹, x.2 * a⁻¹)).map fun x : α × α => (x.1 * a, x.2 * a) := by simp [Filter.map_map, (· ∘ ·)] _ ≤ (𝓤 α).map fun x : α × α => (x.1 * a, x.2 * a) := Filter.map_mono (uniformContinuous_id.mul uniformContinuous_const) ) @[to_additive] theorem uniformEmbedding_translate_mul (a : α) : UniformEmbedding fun x : α => x * a := { comap_uniformity := by nth_rw 1 [← uniformity_translate_mul a, comap_map] rintro ⟨p₁, p₂⟩ ⟨q₁, q₂⟩ simp only [Prod.mk.injEq, mul_left_inj, imp_self] inj := mul_left_injective a } namespace MulOpposite @[to_additive] instance : UniformGroup αᵐᵒᵖ := ⟨uniformContinuous_op.comp ((uniformContinuous_unop.comp uniformContinuous_snd).inv.mul <| uniformContinuous_unop.comp uniformContinuous_fst)⟩ end MulOpposite section LatticeOps variable [Group β] @[to_additive] theorem uniformGroup_sInf {us : Set (UniformSpace β)} (h : ∀ u ∈ us, @UniformGroup β u _) : @UniformGroup β (sInf us) _ := -- Porting note: {_} does not find `sInf us` instance, see `continuousSMul_sInf` @UniformGroup.mk β (_) _ <| uniformContinuous_sInf_rng.mpr fun u hu => uniformContinuous_sInf_dom₂ hu hu (@UniformGroup.uniformContinuous_div β u _ (h u hu)) @[to_additive] theorem uniformGroup_iInf {ι : Sort*} {us' : ι → UniformSpace β} (h' : ∀ i, @UniformGroup β (us' i) _) : @UniformGroup β (⨅ i, us' i) _ := by rw [← sInf_range] exact uniformGroup_sInf (Set.forall_mem_range.mpr h') @[to_additive] theorem uniformGroup_inf {u₁ u₂ : UniformSpace β} (h₁ : @UniformGroup β u₁ _) (h₂ : @UniformGroup β u₂ _) : @UniformGroup β (u₁ ⊓ u₂) _ := by rw [inf_eq_iInf] refine uniformGroup_iInf fun b => ?_ cases b <;> assumption @[to_additive] lemma UniformInducing.uniformGroup {γ : Type*} [Group γ] [UniformSpace γ] [UniformGroup γ] [UniformSpace β] {F : Type*} [FunLike F β γ] [MonoidHomClass F β γ] (f : F) (hf : UniformInducing f) : UniformGroup β where uniformContinuous_div := by simp_rw [hf.uniformContinuous_iff, Function.comp_def, map_div] exact uniformContinuous_div.comp (hf.uniformContinuous.prod_map hf.uniformContinuous) @[to_additive] protected theorem UniformGroup.comap {γ : Type*} [Group γ] {u : UniformSpace γ} [UniformGroup γ] {F : Type*} [FunLike F β γ] [MonoidHomClass F β γ] (f : F) : @UniformGroup β (u.comap f) _ := letI : UniformSpace β := u.comap f; UniformInducing.uniformGroup f ⟨rfl⟩ end LatticeOps namespace Subgroup @[to_additive] instance uniformGroup (S : Subgroup α) : UniformGroup S := .comap S.subtype end Subgroup section variable (α) @[to_additive] theorem uniformity_eq_comap_nhds_one : 𝓤 α = comap (fun x : α × α => x.2 / x.1) (𝓝 (1 : α)) := by rw [nhds_eq_comap_uniformity, Filter.comap_comap] refine le_antisymm (Filter.map_le_iff_le_comap.1 ?_) ?_ · intro s hs rcases mem_uniformity_of_uniformContinuous_invariant uniformContinuous_div hs with ⟨t, ht, hts⟩ refine mem_map.2 (mem_of_superset ht ?_) rintro ⟨a, b⟩ simpa [subset_def] using hts a b a · intro s hs rcases mem_uniformity_of_uniformContinuous_invariant uniformContinuous_mul hs with ⟨t, ht, hts⟩ refine ⟨_, ht, ?_⟩ rintro ⟨a, b⟩ simpa [subset_def] using hts 1 (b / a) a @[to_additive] theorem uniformity_eq_comap_nhds_one_swapped : 𝓤 α = comap (fun x : α × α => x.1 / x.2) (𝓝 (1 : α)) := by rw [← comap_swap_uniformity, uniformity_eq_comap_nhds_one, comap_comap] rfl @[to_additive] theorem UniformGroup.ext {G : Type*} [Group G] {u v : UniformSpace G} (hu : @UniformGroup G u _) (hv : @UniformGroup G v _) (h : @nhds _ u.toTopologicalSpace 1 = @nhds _ v.toTopologicalSpace 1) : u = v := UniformSpace.ext <| by rw [@uniformity_eq_comap_nhds_one _ u _ hu, @uniformity_eq_comap_nhds_one _ v _ hv, h] @[to_additive] theorem UniformGroup.ext_iff {G : Type*} [Group G] {u v : UniformSpace G} (hu : @UniformGroup G u _) (hv : @UniformGroup G v _) : u = v ↔ @nhds _ u.toTopologicalSpace 1 = @nhds _ v.toTopologicalSpace 1 := ⟨fun h => h ▸ rfl, hu.ext hv⟩ variable {α} @[to_additive] theorem UniformGroup.uniformity_countably_generated [(𝓝 (1 : α)).IsCountablyGenerated] : (𝓤 α).IsCountablyGenerated := by rw [uniformity_eq_comap_nhds_one] exact Filter.comap.isCountablyGenerated _ _ open MulOpposite @[to_additive] theorem uniformity_eq_comap_inv_mul_nhds_one : 𝓤 α = comap (fun x : α × α => x.1⁻¹ * x.2) (𝓝 (1 : α)) := by rw [← comap_uniformity_mulOpposite, uniformity_eq_comap_nhds_one, ← op_one, ← comap_unop_nhds, comap_comap, comap_comap] simp [(· ∘ ·)] @[to_additive] theorem uniformity_eq_comap_inv_mul_nhds_one_swapped : 𝓤 α = comap (fun x : α × α => x.2⁻¹ * x.1) (𝓝 (1 : α)) := by rw [← comap_swap_uniformity, uniformity_eq_comap_inv_mul_nhds_one, comap_comap] rfl end @[to_additive] theorem Filter.HasBasis.uniformity_of_nhds_one {ι} {p : ι → Prop} {U : ι → Set α} (h : (𝓝 (1 : α)).HasBasis p U) : (𝓤 α).HasBasis p fun i => { x : α × α | x.2 / x.1 ∈ U i } := by rw [uniformity_eq_comap_nhds_one] exact h.comap _ @[to_additive] theorem Filter.HasBasis.uniformity_of_nhds_one_inv_mul {ι} {p : ι → Prop} {U : ι → Set α} (h : (𝓝 (1 : α)).HasBasis p U) : (𝓤 α).HasBasis p fun i => { x : α × α | x.1⁻¹ * x.2 ∈ U i } := by rw [uniformity_eq_comap_inv_mul_nhds_one] exact h.comap _ @[to_additive] theorem Filter.HasBasis.uniformity_of_nhds_one_swapped {ι} {p : ι → Prop} {U : ι → Set α} (h : (𝓝 (1 : α)).HasBasis p U) : (𝓤 α).HasBasis p fun i => { x : α × α | x.1 / x.2 ∈ U i } := by rw [uniformity_eq_comap_nhds_one_swapped] exact h.comap _ @[to_additive] theorem Filter.HasBasis.uniformity_of_nhds_one_inv_mul_swapped {ι} {p : ι → Prop} {U : ι → Set α} (h : (𝓝 (1 : α)).HasBasis p U) : (𝓤 α).HasBasis p fun i => { x : α × α | x.2⁻¹ * x.1 ∈ U i } := by rw [uniformity_eq_comap_inv_mul_nhds_one_swapped] exact h.comap _ @[to_additive] theorem uniformContinuous_of_tendsto_one {hom : Type*} [UniformSpace β] [Group β] [UniformGroup β] [FunLike hom α β] [MonoidHomClass hom α β] {f : hom} (h : Tendsto f (𝓝 1) (𝓝 1)) : UniformContinuous f := by have : ((fun x : β × β => x.2 / x.1) ∘ fun x : α × α => (f x.1, f x.2)) = fun x : α × α => f (x.2 / x.1) := by ext; simp only [Function.comp_apply, map_div] rw [UniformContinuous, uniformity_eq_comap_nhds_one α, uniformity_eq_comap_nhds_one β, tendsto_comap_iff, this] exact Tendsto.comp h tendsto_comap /-- A group homomorphism (a bundled morphism of a type that implements `MonoidHomClass`) between two uniform groups is uniformly continuous provided that it is continuous at one. See also `continuous_of_continuousAt_one`. -/ @[to_additive "An additive group homomorphism (a bundled morphism of a type that implements `AddMonoidHomClass`) between two uniform additive groups is uniformly continuous provided that it is continuous at zero. See also `continuous_of_continuousAt_zero`."] theorem uniformContinuous_of_continuousAt_one {hom : Type*} [UniformSpace β] [Group β] [UniformGroup β] [FunLike hom α β] [MonoidHomClass hom α β] (f : hom) (hf : ContinuousAt f 1) : UniformContinuous f := uniformContinuous_of_tendsto_one (by simpa using hf.tendsto) @[to_additive] theorem MonoidHom.uniformContinuous_of_continuousAt_one [UniformSpace β] [Group β] [UniformGroup β] (f : α →* β) (hf : ContinuousAt f 1) : UniformContinuous f := _root_.uniformContinuous_of_continuousAt_one f hf /-- A homomorphism from a uniform group to a discrete uniform group is continuous if and only if its kernel is open. -/ @[to_additive "A homomorphism from a uniform additive group to a discrete uniform additive group is continuous if and only if its kernel is open."] theorem UniformGroup.uniformContinuous_iff_open_ker {hom : Type*} [UniformSpace β] [DiscreteTopology β] [Group β] [UniformGroup β] [FunLike hom α β] [MonoidHomClass hom α β] {f : hom} : UniformContinuous f ↔ IsOpen ((f : α →* β).ker : Set α) := by refine ⟨fun hf => ?_, fun hf => ?_⟩ · apply (isOpen_discrete ({1} : Set β)).preimage hf.continuous · apply uniformContinuous_of_continuousAt_one rw [ContinuousAt, nhds_discrete β, map_one, tendsto_pure] exact hf.mem_nhds (map_one f) @[to_additive] theorem uniformContinuous_monoidHom_of_continuous {hom : Type*} [UniformSpace β] [Group β] [UniformGroup β] [FunLike hom α β] [MonoidHomClass hom α β] {f : hom} (h : Continuous f) : UniformContinuous f := uniformContinuous_of_tendsto_one <| suffices Tendsto f (𝓝 1) (𝓝 (f 1)) by rwa [map_one] at this h.tendsto 1 @[to_additive] theorem CauchySeq.mul {ι : Type*} [Preorder ι] {u v : ι → α} (hu : CauchySeq u) (hv : CauchySeq v) : CauchySeq (u * v) := uniformContinuous_mul.comp_cauchySeq (hu.prod hv) @[to_additive] theorem CauchySeq.mul_const {ι : Type*} [Preorder ι] {u : ι → α} {x : α} (hu : CauchySeq u) : CauchySeq fun n => u n * x := (uniformContinuous_id.mul uniformContinuous_const).comp_cauchySeq hu @[to_additive] theorem CauchySeq.const_mul {ι : Type*} [Preorder ι] {u : ι → α} {x : α} (hu : CauchySeq u) : CauchySeq fun n => x * u n := (uniformContinuous_const.mul uniformContinuous_id).comp_cauchySeq hu @[to_additive] theorem CauchySeq.inv {ι : Type*} [Preorder ι] {u : ι → α} (h : CauchySeq u) : CauchySeq u⁻¹ := uniformContinuous_inv.comp_cauchySeq h @[to_additive] theorem totallyBounded_iff_subset_finite_iUnion_nhds_one {s : Set α} : TotallyBounded s ↔ ∀ U ∈ 𝓝 (1 : α), ∃ t : Set α, t.Finite ∧ s ⊆ ⋃ y ∈ t, y • U := (𝓝 (1 : α)).basis_sets.uniformity_of_nhds_one_inv_mul_swapped.totallyBounded_iff.trans <| by simp [← preimage_smul_inv, preimage] section UniformConvergence variable {ι : Type*} {l : Filter ι} {l' : Filter β} {f f' : ι → β → α} {g g' : β → α} {s : Set β} @[to_additive] theorem TendstoUniformlyOnFilter.mul (hf : TendstoUniformlyOnFilter f g l l') (hf' : TendstoUniformlyOnFilter f' g' l l') : TendstoUniformlyOnFilter (f * f') (g * g') l l' := fun u hu => ((uniformContinuous_mul.comp_tendstoUniformlyOnFilter (hf.prod hf')) u hu).diag_of_prod_left @[to_additive] theorem TendstoUniformlyOnFilter.div (hf : TendstoUniformlyOnFilter f g l l') (hf' : TendstoUniformlyOnFilter f' g' l l') : TendstoUniformlyOnFilter (f / f') (g / g') l l' := fun u hu => ((uniformContinuous_div.comp_tendstoUniformlyOnFilter (hf.prod hf')) u hu).diag_of_prod_left @[to_additive] theorem TendstoUniformlyOn.mul (hf : TendstoUniformlyOn f g l s) (hf' : TendstoUniformlyOn f' g' l s) : TendstoUniformlyOn (f * f') (g * g') l s := fun u hu => ((uniformContinuous_mul.comp_tendstoUniformlyOn (hf.prod hf')) u hu).diag_of_prod @[to_additive] theorem TendstoUniformlyOn.div (hf : TendstoUniformlyOn f g l s) (hf' : TendstoUniformlyOn f' g' l s) : TendstoUniformlyOn (f / f') (g / g') l s := fun u hu => ((uniformContinuous_div.comp_tendstoUniformlyOn (hf.prod hf')) u hu).diag_of_prod @[to_additive] theorem TendstoUniformly.mul (hf : TendstoUniformly f g l) (hf' : TendstoUniformly f' g' l) : TendstoUniformly (f * f') (g * g') l := fun u hu => ((uniformContinuous_mul.comp_tendstoUniformly (hf.prod hf')) u hu).diag_of_prod @[to_additive] theorem TendstoUniformly.div (hf : TendstoUniformly f g l) (hf' : TendstoUniformly f' g' l) : TendstoUniformly (f / f') (g / g') l := fun u hu => ((uniformContinuous_div.comp_tendstoUniformly (hf.prod hf')) u hu).diag_of_prod @[to_additive] theorem UniformCauchySeqOn.mul (hf : UniformCauchySeqOn f l s) (hf' : UniformCauchySeqOn f' l s) : UniformCauchySeqOn (f * f') l s := fun u hu => by simpa using (uniformContinuous_mul.comp_uniformCauchySeqOn (hf.prod' hf')) u hu @[to_additive] theorem UniformCauchySeqOn.div (hf : UniformCauchySeqOn f l s) (hf' : UniformCauchySeqOn f' l s) : UniformCauchySeqOn (f / f') l s := fun u hu => by simpa using (uniformContinuous_div.comp_uniformCauchySeqOn (hf.prod' hf')) u hu end UniformConvergence end UniformGroup section TopologicalGroup open Filter variable (G : Type*) [Group G] [TopologicalSpace G] [TopologicalGroup G] /-- The right uniformity on a topological group (as opposed to the left uniformity). Warning: in general the right and left uniformities do not coincide and so one does not obtain a `UniformGroup` structure. Two important special cases where they _do_ coincide are for commutative groups (see `comm_topologicalGroup_is_uniform`) and for compact groups (see `topologicalGroup_is_uniform_of_compactSpace`). -/ @[to_additive "The right uniformity on a topological additive group (as opposed to the left uniformity). Warning: in general the right and left uniformities do not coincide and so one does not obtain a `UniformAddGroup` structure. Two important special cases where they _do_ coincide are for commutative additive groups (see `comm_topologicalAddGroup_is_uniform`) and for compact additive groups (see `topologicalAddGroup_is_uniform_of_compactSpace`)."] def TopologicalGroup.toUniformSpace : UniformSpace G where uniformity := comap (fun p : G × G => p.2 / p.1) (𝓝 1) symm := have : Tendsto (fun p : G × G ↦ (p.2 / p.1)⁻¹) (comap (fun p : G × G ↦ p.2 / p.1) (𝓝 1)) (𝓝 1⁻¹) := tendsto_id.inv.comp tendsto_comap by simpa [tendsto_comap_iff] comp := Tendsto.le_comap fun U H ↦ by rcases exists_nhds_one_split H with ⟨V, V_nhds, V_mul⟩ refine mem_map.2 (mem_of_superset (mem_lift' <| preimage_mem_comap V_nhds) ?_) rintro ⟨x, y⟩ ⟨z, hz₁, hz₂⟩ simpa using V_mul _ hz₂ _ hz₁ nhds_eq_comap_uniformity _ := by simp only [comap_comap, (· ∘ ·), nhds_translation_div] attribute [local instance] TopologicalGroup.toUniformSpace @[to_additive] theorem uniformity_eq_comap_nhds_one' : 𝓤 G = comap (fun p : G × G => p.2 / p.1) (𝓝 (1 : G)) := rfl @[to_additive] theorem topologicalGroup_is_uniform_of_compactSpace [CompactSpace G] : UniformGroup G := ⟨by apply CompactSpace.uniformContinuous_of_continuous exact continuous_div'⟩ variable {G} @[to_additive] instance Subgroup.isClosed_of_discrete [T2Space G] {H : Subgroup G} [DiscreteTopology H] : IsClosed (H : Set G) := by obtain ⟨V, V_in, VH⟩ : ∃ (V : Set G), V ∈ 𝓝 (1 : G) ∧ V ∩ (H : Set G) = {1} := nhds_inter_eq_singleton_of_mem_discrete H.one_mem have : (fun p : G × G => p.2 / p.1) ⁻¹' V ∈ 𝓤 G := preimage_mem_comap V_in apply isClosed_of_spaced_out this intro h h_in h' h'_in contrapose! simp only [Set.mem_preimage, not_not] rintro (hyp : h' / h ∈ V) have : h' / h ∈ ({1} : Set G) := VH ▸ Set.mem_inter hyp (H.div_mem h'_in h_in) exact (eq_of_div_eq_one this).symm @[to_additive] lemma Subgroup.tendsto_coe_cofinite_of_discrete [T2Space G] (H : Subgroup G) [DiscreteTopology H] : Tendsto ((↑) : H → G) cofinite (cocompact _) := IsClosed.tendsto_coe_cofinite_of_discreteTopology inferInstance inferInstance @[to_additive] lemma MonoidHom.tendsto_coe_cofinite_of_discrete [T2Space G] {H : Type*} [Group H] {f : H →* G} (hf : Function.Injective f) (hf' : DiscreteTopology f.range) : Tendsto f cofinite (cocompact _) := by replace hf : Function.Injective f.rangeRestrict := by simpa exact f.range.tendsto_coe_cofinite_of_discrete.comp hf.tendsto_cofinite @[to_additive] theorem TopologicalGroup.tendstoUniformly_iff {ι α : Type*} (F : ι → α → G) (f : α → G) (p : Filter ι) : @TendstoUniformly α G ι (TopologicalGroup.toUniformSpace G) F f p ↔ ∀ u ∈ 𝓝 (1 : G), ∀ᶠ i in p, ∀ a, F i a / f a ∈ u := ⟨fun h u hu => h _ ⟨u, hu, fun _ => id⟩, fun h _ ⟨u, hu, hv⟩ => mem_of_superset (h u hu) fun _ hi a => hv (hi a)⟩ @[to_additive] theorem TopologicalGroup.tendstoUniformlyOn_iff {ι α : Type*} (F : ι → α → G) (f : α → G) (p : Filter ι) (s : Set α) : @TendstoUniformlyOn α G ι (TopologicalGroup.toUniformSpace G) F f p s ↔ ∀ u ∈ 𝓝 (1 : G), ∀ᶠ i in p, ∀ a ∈ s, F i a / f a ∈ u := ⟨fun h u hu => h _ ⟨u, hu, fun _ => id⟩, fun h _ ⟨u, hu, hv⟩ => mem_of_superset (h u hu) fun _ hi a ha => hv (hi a ha)⟩ @[to_additive] theorem TopologicalGroup.tendstoLocallyUniformly_iff {ι α : Type*} [TopologicalSpace α] (F : ι → α → G) (f : α → G) (p : Filter ι) : @TendstoLocallyUniformly α G ι (TopologicalGroup.toUniformSpace G) _ F f p ↔ ∀ u ∈ 𝓝 (1 : G), ∀ (x : α), ∃ t ∈ 𝓝 x, ∀ᶠ i in p, ∀ a ∈ t, F i a / f a ∈ u := ⟨fun h u hu => h _ ⟨u, hu, fun _ => id⟩, fun h _ ⟨u, hu, hv⟩ x => Exists.imp (fun _ ⟨h, hp⟩ => ⟨h, mem_of_superset hp fun _ hi a ha => hv (hi a ha)⟩) (h u hu x)⟩ @[to_additive] theorem TopologicalGroup.tendstoLocallyUniformlyOn_iff {ι α : Type*} [TopologicalSpace α] (F : ι → α → G) (f : α → G) (p : Filter ι) (s : Set α) : @TendstoLocallyUniformlyOn α G ι (TopologicalGroup.toUniformSpace G) _ F f p s ↔ ∀ u ∈ 𝓝 (1 : G), ∀ x ∈ s, ∃ t ∈ 𝓝[s] x, ∀ᶠ i in p, ∀ a ∈ t, F i a / f a ∈ u := ⟨fun h u hu => h _ ⟨u, hu, fun _ => id⟩, fun h _ ⟨u, hu, hv⟩ x => (Exists.imp fun _ ⟨h, hp⟩ => ⟨h, mem_of_superset hp fun _ hi a ha => hv (hi a ha)⟩) ∘ h u hu x⟩ end TopologicalGroup section TopologicalCommGroup universe u v w x open Filter variable (G : Type*) [CommGroup G] [TopologicalSpace G] [TopologicalGroup G] section attribute [local instance] TopologicalGroup.toUniformSpace variable {G} @[to_additive] -- Porting note: renamed theorem to conform to naming convention theorem comm_topologicalGroup_is_uniform : UniformGroup G := by have : Tendsto ((fun p : G × G => p.1 / p.2) ∘ fun p : (G × G) × G × G => (p.1.2 / p.1.1, p.2.2 / p.2.1)) (comap (fun p : (G × G) × G × G => (p.1.2 / p.1.1, p.2.2 / p.2.1)) ((𝓝 1).prod (𝓝 1))) (𝓝 (1 / 1)) := (tendsto_fst.div' tendsto_snd).comp tendsto_comap constructor rw [UniformContinuous, uniformity_prod_eq_prod, tendsto_map'_iff, uniformity_eq_comap_nhds_one' G, tendsto_comap_iff, prod_comap_comap_eq] simp only [Function.comp, div_eq_mul_inv, mul_inv_rev, inv_inv, mul_comm, mul_left_comm] at * simp only [inv_one, mul_one, ← mul_assoc] at this simp_rw [← mul_assoc, mul_comm] assumption open Set end @[to_additive] theorem UniformGroup.toUniformSpace_eq {G : Type*} [u : UniformSpace G] [Group G] [UniformGroup G] : TopologicalGroup.toUniformSpace G = u := by ext : 1 rw [uniformity_eq_comap_nhds_one' G, uniformity_eq_comap_nhds_one G] end TopologicalCommGroup open Filter Set Function section variable {α : Type*} {β : Type*} {hom : Type*} variable [TopologicalSpace α] [Group α] [TopologicalGroup α] -- β is a dense subgroup of α, inclusion is denoted by e variable [TopologicalSpace β] [Group β] variable [FunLike hom β α] [MonoidHomClass hom β α] {e : hom} (de : DenseInducing e) @[to_additive] theorem tendsto_div_comap_self (x₀ : α) : Tendsto (fun t : β × β => t.2 / t.1) ((comap fun p : β × β => (e p.1, e p.2)) <| 𝓝 (x₀, x₀)) (𝓝 1) := by have comm : ((fun x : α × α => x.2 / x.1) ∘ fun t : β × β => (e t.1, e t.2)) = e ∘ fun t : β × β => t.2 / t.1 := by ext t change e t.2 / e t.1 = e (t.2 / t.1) rw [← map_div e t.2 t.1] have lim : Tendsto (fun x : α × α => x.2 / x.1) (𝓝 (x₀, x₀)) (𝓝 (e 1)) := by simpa using (continuous_div'.comp (@continuous_swap α α _ _)).tendsto (x₀, x₀) simpa using de.tendsto_comap_nhds_nhds lim comm end namespace DenseInducing variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} variable {G : Type*} -- β is a dense subgroup of α, inclusion is denoted by e -- δ is a dense subgroup of γ, inclusion is denoted by f variable [TopologicalSpace α] [AddCommGroup α] [TopologicalAddGroup α] variable [TopologicalSpace β] [AddCommGroup β] [TopologicalAddGroup β] variable [TopologicalSpace γ] [AddCommGroup γ] [TopologicalAddGroup γ] variable [TopologicalSpace δ] [AddCommGroup δ] [TopologicalAddGroup δ] variable [UniformSpace G] [AddCommGroup G] [UniformAddGroup G] [T0Space G] [CompleteSpace G] variable {e : β →+ α} (de : DenseInducing e) variable {f : δ →+ γ} (df : DenseInducing f) variable {φ : β →+ δ →+ G} variable (hφ : Continuous (fun p : β × δ => φ p.1 p.2)) variable {W' : Set G} (W'_nhd : W' ∈ 𝓝 (0 : G)) private theorem extend_Z_bilin_aux (x₀ : α) (y₁ : δ) : ∃ U₂ ∈ comap e (𝓝 x₀), ∀ x ∈ U₂, ∀ x' ∈ U₂, (fun p : β × δ => φ p.1 p.2) (x' - x, y₁) ∈ W' := by let Nx := 𝓝 x₀ let ee := fun u : β × β => (e u.1, e u.2) have lim1 : Tendsto (fun a : β × β => (a.2 - a.1, y₁)) (comap e Nx ×ˢ comap e Nx) (𝓝 (0, y₁)) := by have := Tendsto.prod_mk (tendsto_sub_comap_self de x₀) (tendsto_const_nhds : Tendsto (fun _ : β × β => y₁) (comap ee <| 𝓝 (x₀, x₀)) (𝓝 y₁)) rw [nhds_prod_eq, prod_comap_comap_eq, ← nhds_prod_eq] exact (this : _) have lim2 : Tendsto (fun p : β × δ => φ p.1 p.2) (𝓝 (0, y₁)) (𝓝 0) := by simpa using hφ.tendsto (0, y₁) have lim := lim2.comp lim1 rw [tendsto_prod_self_iff] at lim simp_rw [forall_mem_comm] exact lim W' W'_nhd private theorem extend_Z_bilin_key (x₀ : α) (y₀ : γ) : ∃ U ∈ comap e (𝓝 x₀), ∃ V ∈ comap f (𝓝 y₀), ∀ x ∈ U, ∀ x' ∈ U, ∀ (y) (_ : y ∈ V) (y') (_ : y' ∈ V), (fun p : β × δ => φ p.1 p.2) (x', y') - (fun p : β × δ => φ p.1 p.2) (x, y) ∈ W' := by let ee := fun u : β × β => (e u.1, e u.2) let ff := fun u : δ × δ => (f u.1, f u.2) have lim_φ : Filter.Tendsto (fun p : β × δ => φ p.1 p.2) (𝓝 (0, 0)) (𝓝 0) := by simpa using hφ.tendsto (0, 0) have lim_φ_sub_sub : Tendsto (fun p : (β × β) × δ × δ => (fun p : β × δ => φ p.1 p.2) (p.1.2 - p.1.1, p.2.2 - p.2.1)) ((comap ee <| 𝓝 (x₀, x₀)) ×ˢ (comap ff <| 𝓝 (y₀, y₀))) (𝓝 0) := by have lim_sub_sub : Tendsto (fun p : (β × β) × δ × δ => (p.1.2 - p.1.1, p.2.2 - p.2.1)) (comap ee (𝓝 (x₀, x₀)) ×ˢ comap ff (𝓝 (y₀, y₀))) (𝓝 0 ×ˢ 𝓝 0) := by have := Filter.prod_mono (tendsto_sub_comap_self de x₀) (tendsto_sub_comap_self df y₀) rwa [prod_map_map_eq] at this rw [← nhds_prod_eq] at lim_sub_sub exact Tendsto.comp lim_φ lim_sub_sub rcases exists_nhds_zero_quarter W'_nhd with ⟨W, W_nhd, W4⟩ have : ∃ U₁ ∈ comap e (𝓝 x₀), ∃ V₁ ∈ comap f (𝓝 y₀), ∀ (x) (_ : x ∈ U₁) (x') (_ : x' ∈ U₁), ∀ (y) (_ : y ∈ V₁) (y') (_ : y' ∈ V₁), (fun p : β × δ => φ p.1 p.2) (x' - x, y' - y) ∈ W := by rcases tendsto_prod_iff.1 lim_φ_sub_sub W W_nhd with ⟨U, U_in, V, V_in, H⟩ rw [nhds_prod_eq, ← prod_comap_comap_eq, mem_prod_same_iff] at U_in V_in rcases U_in with ⟨U₁, U₁_in, HU₁⟩ rcases V_in with ⟨V₁, V₁_in, HV₁⟩ exists U₁, U₁_in, V₁, V₁_in intro x x_in x' x'_in y y_in y' y'_in exact H _ _ (HU₁ (mk_mem_prod x_in x'_in)) (HV₁ (mk_mem_prod y_in y'_in)) rcases this with ⟨U₁, U₁_nhd, V₁, V₁_nhd, H⟩ obtain ⟨x₁, x₁_in⟩ : U₁.Nonempty := (de.comap_nhds_neBot _).nonempty_of_mem U₁_nhd obtain ⟨y₁, y₁_in⟩ : V₁.Nonempty := (df.comap_nhds_neBot _).nonempty_of_mem V₁_nhd have cont_flip : Continuous fun p : δ × β => φ.flip p.1 p.2 := by show Continuous ((fun p : β × δ => φ p.1 p.2) ∘ Prod.swap) exact hφ.comp continuous_swap rcases extend_Z_bilin_aux de hφ W_nhd x₀ y₁ with ⟨U₂, U₂_nhd, HU⟩ rcases extend_Z_bilin_aux df cont_flip W_nhd y₀ x₁ with ⟨V₂, V₂_nhd, HV⟩ exists U₁ ∩ U₂, inter_mem U₁_nhd U₂_nhd, V₁ ∩ V₂, inter_mem V₁_nhd V₂_nhd rintro x ⟨xU₁, xU₂⟩ x' ⟨x'U₁, x'U₂⟩ y ⟨yV₁, yV₂⟩ y' ⟨y'V₁, y'V₂⟩ have key_formula : φ x' y' - φ x y = φ (x' - x) y₁ + φ (x' - x) (y' - y₁) + φ x₁ (y' - y) + φ (x - x₁) (y' - y) := by simp; abel rw [key_formula] have h₁ := HU x xU₂ x' x'U₂ have h₂ := H x xU₁ x' x'U₁ y₁ y₁_in y' y'V₁ have h₃ := HV y yV₂ y' y'V₂ have h₄ := H x₁ x₁_in x xU₁ y yV₁ y' y'V₁ exact W4 h₁ h₂ h₃ h₄ open DenseInducing /-- Bourbaki GT III.6.5 Theorem I: ℤ-bilinear continuous maps from dense images into a complete Hausdorff group extend by continuity. Note: Bourbaki assumes that α and β are also complete Hausdorff, but this is not necessary. -/ theorem extend_Z_bilin : Continuous (extend (de.prod df) (fun p : β × δ => φ p.1 p.2)) := by refine continuous_extend_of_cauchy _ ?_ rintro ⟨x₀, y₀⟩ constructor · apply NeBot.map apply comap_neBot intro U h rcases mem_closure_iff_nhds.1 ((de.prod df).dense (x₀, y₀)) U h with ⟨x, x_in, ⟨z, z_x⟩⟩ exists z aesop · suffices map (fun p : (β × δ) × β × δ => (fun p : β × δ => φ p.1 p.2) p.2 - (fun p : β × δ => φ p.1 p.2) p.1) (comap (fun p : (β × δ) × β × δ => ((e p.1.1, f p.1.2), (e p.2.1, f p.2.2))) (𝓝 (x₀, y₀) ×ˢ 𝓝 (x₀, y₀))) ≤ 𝓝 0 by rwa [uniformity_eq_comap_nhds_zero G, prod_map_map_eq, ← map_le_iff_le_comap, Filter.map_map, prod_comap_comap_eq] intro W' W'_nhd have key := extend_Z_bilin_key de df hφ W'_nhd x₀ y₀ rcases key with ⟨U, U_nhd, V, V_nhd, h⟩ rw [mem_comap] at U_nhd rcases U_nhd with ⟨U', U'_nhd, U'_sub⟩ rw [mem_comap] at V_nhd rcases V_nhd with ⟨V', V'_nhd, V'_sub⟩ rw [mem_map, mem_comap, nhds_prod_eq] exists (U' ×ˢ V') ×ˢ U' ×ˢ V' rw [mem_prod_same_iff] simp only [exists_prop] constructor · have := prod_mem_prod U'_nhd V'_nhd tauto · intro p h' simp only [Set.mem_preimage, Set.prod_mk_mem_set_prod_eq] at h' rcases p with ⟨⟨x, y⟩, ⟨x', y'⟩⟩ apply h <;> tauto end DenseInducing section CompleteQuotient universe u open TopologicalSpace open Classical in /-- The quotient `G ⧸ N` of a complete first countable topological group `G` by a normal subgroup is itself complete. [N. Bourbaki, *General Topology*, IX.3.1 Proposition 4][bourbaki1966b] Because a topological group is not equipped with a `UniformSpace` instance by default, we must explicitly provide it in order to consider completeness. See `QuotientGroup.completeSpace` for a version in which `G` is already equipped with a uniform structure. -/ @[to_additive "The quotient `G ⧸ N` of a complete first countable topological additive group `G` by a normal additive subgroup is itself complete. Consequently, quotients of Banach spaces by subspaces are complete. [N. Bourbaki, *General Topology*, IX.3.1 Proposition 4][bourbaki1966b] Because an additive topological group is not equipped with a `UniformSpace` instance by default, we must explicitly provide it in order to consider completeness. See `QuotientAddGroup.completeSpace` for a version in which `G` is already equipped with a uniform structure."] instance QuotientGroup.completeSpace' (G : Type u) [Group G] [TopologicalSpace G] [TopologicalGroup G] [FirstCountableTopology G] (N : Subgroup G) [N.Normal] [@CompleteSpace G (TopologicalGroup.toUniformSpace G)] : @CompleteSpace (G ⧸ N) (TopologicalGroup.toUniformSpace (G ⧸ N)) := by /- Since `G ⧸ N` is a topological group it is a uniform space, and since `G` is first countable the uniformities of both `G` and `G ⧸ N` are countably generated. Moreover, we may choose a sequential antitone neighborhood basis `u` for `𝓝 (1 : G)` so that `(u (n + 1)) ^ 2 ⊆ u n`, and this descends to an antitone neighborhood basis `v` for `𝓝 (1 : G ⧸ N)`. Since `𝓤 (G ⧸ N)` is countably generated, it suffices to show any Cauchy sequence `x` converges. -/ letI : UniformSpace (G ⧸ N) := TopologicalGroup.toUniformSpace (G ⧸ N) letI : UniformSpace G := TopologicalGroup.toUniformSpace G haveI : (𝓤 (G ⧸ N)).IsCountablyGenerated := comap.isCountablyGenerated _ _ obtain ⟨u, hu, u_mul⟩ := TopologicalGroup.exists_antitone_basis_nhds_one G obtain ⟨hv, v_anti⟩ := hu.map ((↑) : G → G ⧸ N) rw [← QuotientGroup.nhds_eq N 1, QuotientGroup.mk_one] at hv refine UniformSpace.complete_of_cauchySeq_tendsto fun x hx => ?_ /- Given `n : ℕ`, for sufficiently large `a b : ℕ`, given any lift of `x b`, we can find a lift of `x a` such that the quotient of the lifts lies in `u n`. -/ have key₀ : ∀ i j : ℕ, ∃ M : ℕ, j < M ∧ ∀ a b : ℕ, M ≤ a → M ≤ b → ∀ g : G, x b = g → ∃ g' : G, g / g' ∈ u i ∧ x a = g' := by have h𝓤GN : (𝓤 (G ⧸ N)).HasBasis (fun _ ↦ True) fun i ↦ { x | x.snd / x.fst ∈ (↑) '' u i } := by simpa [uniformity_eq_comap_nhds_one'] using hv.comap _ rw [h𝓤GN.cauchySeq_iff] at hx simp only [mem_setOf_eq, forall_true_left, mem_image] at hx intro i j rcases hx i with ⟨M, hM⟩ refine ⟨max j M + 1, (le_max_left _ _).trans_lt (lt_add_one _), fun a b ha hb g hg => ?_⟩ obtain ⟨y, y_mem, hy⟩ := hM a (((le_max_right j _).trans (lt_add_one _).le).trans ha) b (((le_max_right j _).trans (lt_add_one _).le).trans hb) refine ⟨y⁻¹ * g, by simpa only [div_eq_mul_inv, mul_inv_rev, inv_inv, mul_inv_cancel_left] using y_mem, ?_⟩ rw [QuotientGroup.mk_mul, QuotientGroup.mk_inv, hy, hg, inv_div, div_mul_cancel] /- Inductively construct a subsequence `φ : ℕ → ℕ` using `key₀` so that if `a b : ℕ` exceed `φ (n + 1)`, then we may find lifts whose quotients lie within `u n`. -/ set φ : ℕ → ℕ := fun n => Nat.recOn n (choose <| key₀ 0 0) fun k yk => choose <| key₀ (k + 1) yk have hφ : ∀ n : ℕ, φ n < φ (n + 1) ∧ ∀ a b : ℕ, φ (n + 1) ≤ a → φ (n + 1) ≤ b → ∀ g : G, x b = g → ∃ g' : G, g / g' ∈ u (n + 1) ∧ x a = g' := fun n => choose_spec (key₀ (n + 1) (φ n)) /- Inductively construct a sequence `x' n : G` of lifts of `x (φ (n + 1))` such that quotients of successive terms lie in `x' n / x' (n + 1) ∈ u (n + 1)`. We actually need the proofs that each term is a lift to construct the next term, so we use a Σ-type. -/ set x' : ∀ n, PSigma fun g : G => x (φ (n + 1)) = g := fun n => Nat.recOn n ⟨choose (QuotientGroup.mk_surjective (x (φ 1))), (choose_spec (QuotientGroup.mk_surjective (x (φ 1)))).symm⟩ fun k hk => ⟨choose <| (hφ k).2 _ _ (hφ (k + 1)).1.le le_rfl hk.fst hk.snd, (choose_spec <| (hφ k).2 _ _ (hφ (k + 1)).1.le le_rfl hk.fst hk.snd).2⟩ have hx' : ∀ n : ℕ, (x' n).fst / (x' (n + 1)).fst ∈ u (n + 1) := fun n => (choose_spec <| (hφ n).2 _ _ (hφ (n + 1)).1.le le_rfl (x' n).fst (x' n).snd).1 /- The sequence `x'` is Cauchy. This is where we exploit the condition on `u`. The key idea is to show by decreasing induction that `x' m / x' n ∈ u m` if `m ≤ n`. -/ have x'_cauchy : CauchySeq fun n => (x' n).fst := by have h𝓤G : (𝓤 G).HasBasis (fun _ => True) fun i => { x | x.snd / x.fst ∈ u i } := by simpa [uniformity_eq_comap_nhds_one'] using hu.toHasBasis.comap _ rw [h𝓤G.cauchySeq_iff'] simp only [mem_setOf_eq, forall_true_left] exact fun m => ⟨m, fun n hmn => Nat.decreasingInduction' (fun k _ _ hk => u_mul k ⟨_, hx' k, _, hk, div_mul_div_cancel' _ _ _⟩) hmn (by simpa only [div_self'] using mem_of_mem_nhds (hu.mem _))⟩ /- Since `G` is complete, `x'` converges to some `x₀`, and so the image of this sequence under the quotient map converges to `↑x₀`. The image of `x'` is a convergent subsequence of `x`, and since `x` is Cauchy, this implies it converges. -/ rcases cauchySeq_tendsto_of_complete x'_cauchy with ⟨x₀, hx₀⟩ refine ⟨↑x₀, tendsto_nhds_of_cauchySeq_of_subseq hx (strictMono_nat_of_lt_succ fun n => (hφ (n + 1)).1).tendsto_atTop ?_⟩ convert ((continuous_coinduced_rng : Continuous ((↑) : G → G ⧸ N)).tendsto x₀).comp hx₀ exact funext fun n => (x' n).snd /-- The quotient `G ⧸ N` of a complete first countable uniform group `G` by a normal subgroup is itself complete. In contrast to `QuotientGroup.completeSpace'`, in this version `G` is already equipped with a uniform structure. [N. Bourbaki, *General Topology*, IX.3.1 Proposition 4][bourbaki1966b] Even though `G` is equipped with a uniform structure, the quotient `G ⧸ N` does not inherit a uniform structure, so it is still provided manually via `TopologicalGroup.toUniformSpace`. In the most common use cases, this coincides (definitionally) with the uniform structure on the quotient obtained via other means. -/ @[to_additive "The quotient `G ⧸ N` of a complete first countable uniform additive group `G` by a normal additive subgroup is itself complete. Consequently, quotients of Banach spaces by subspaces are complete. In contrast to `QuotientAddGroup.completeSpace'`, in this version `G` is already equipped with a uniform structure. [N. Bourbaki, *General Topology*, IX.3.1 Proposition 4][bourbaki1966b] Even though `G` is equipped with a uniform structure, the quotient `G ⧸ N` does not inherit a uniform structure, so it is still provided manually via `TopologicalAddGroup.toUniformSpace`. In the most common use case ─ quotients of normed additive commutative groups by subgroups ─ significant care was taken so that the uniform structure inherent in that setting coincides (definitionally) with the uniform structure provided here."] instance QuotientGroup.completeSpace (G : Type u) [Group G] [us : UniformSpace G] [UniformGroup G] [FirstCountableTopology G] (N : Subgroup G) [N.Normal] [hG : CompleteSpace G] : @CompleteSpace (G ⧸ N) (TopologicalGroup.toUniformSpace (G ⧸ N)) := by rw [← @UniformGroup.toUniformSpace_eq _ us _ _] at hG infer_instance end CompleteQuotient
Topology\Algebra\UniformMulAction.lean
/- Copyright (c) 2022 Yury G. Kudryashov. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yury G. Kudryashov -/ import Mathlib.Topology.Algebra.UniformGroup import Mathlib.Topology.UniformSpace.Completion /-! # Multiplicative action on the completion of a uniform space In this file we define typeclasses `UniformContinuousConstVAdd` and `UniformContinuousConstSMul` and prove that a multiplicative action on `X` with uniformly continuous `(•) c` can be extended to a multiplicative action on `UniformSpace.Completion X`. In later files once the additive group structure is set up, we provide * `UniformSpace.Completion.DistribMulAction` * `UniformSpace.Completion.MulActionWithZero` * `UniformSpace.Completion.Module` TODO: Generalise the results here from the concrete `Completion` to any `AbstractCompletion`. -/ universe u v w x y noncomputable section variable (R : Type u) (M : Type v) (N : Type w) (X : Type x) (Y : Type y) [UniformSpace X] [UniformSpace Y] /-- An additive action such that for all `c`, the map `fun x ↦ c +ᵥ x` is uniformly continuous. -/ class UniformContinuousConstVAdd [VAdd M X] : Prop where uniformContinuous_const_vadd : ∀ c : M, UniformContinuous (c +ᵥ · : X → X) /-- A multiplicative action such that for all `c`, the map `fun x ↦ c • x` is uniformly continuous. -/ @[to_additive] class UniformContinuousConstSMul [SMul M X] : Prop where uniformContinuous_const_smul : ∀ c : M, UniformContinuous (c • · : X → X) export UniformContinuousConstVAdd (uniformContinuous_const_vadd) export UniformContinuousConstSMul (uniformContinuous_const_smul) instance AddMonoid.uniformContinuousConstSMul_nat [AddGroup X] [UniformAddGroup X] : UniformContinuousConstSMul ℕ X := ⟨uniformContinuous_const_nsmul⟩ instance AddGroup.uniformContinuousConstSMul_int [AddGroup X] [UniformAddGroup X] : UniformContinuousConstSMul ℤ X := ⟨uniformContinuous_const_zsmul⟩ /-- A `DistribMulAction` that is continuous on a uniform group is uniformly continuous. This can't be an instance due to it forming a loop with `UniformContinuousConstSMul.to_continuousConstSMul` -/ theorem uniformContinuousConstSMul_of_continuousConstSMul [Monoid R] [AddCommGroup M] [DistribMulAction R M] [UniformSpace M] [UniformAddGroup M] [ContinuousConstSMul R M] : UniformContinuousConstSMul R M := ⟨fun r => uniformContinuous_of_continuousAt_zero (DistribMulAction.toAddMonoidHom M r) (Continuous.continuousAt (continuous_const_smul r))⟩ /-- The action of `Semiring.toModule` is uniformly continuous. -/ instance Ring.uniformContinuousConstSMul [Ring R] [UniformSpace R] [UniformAddGroup R] [ContinuousMul R] : UniformContinuousConstSMul R R := uniformContinuousConstSMul_of_continuousConstSMul _ _ /-- The action of `Semiring.toOppositeModule` is uniformly continuous. -/ instance Ring.uniformContinuousConstSMul_op [Ring R] [UniformSpace R] [UniformAddGroup R] [ContinuousMul R] : UniformContinuousConstSMul Rᵐᵒᵖ R := uniformContinuousConstSMul_of_continuousConstSMul _ _ section SMul variable [SMul M X] @[to_additive] instance (priority := 100) UniformContinuousConstSMul.to_continuousConstSMul [UniformContinuousConstSMul M X] : ContinuousConstSMul M X := ⟨fun c => (uniformContinuous_const_smul c).continuous⟩ variable {M X Y} @[to_additive] theorem UniformContinuous.const_smul [UniformContinuousConstSMul M X] {f : Y → X} (hf : UniformContinuous f) (c : M) : UniformContinuous (c • f) := (uniformContinuous_const_smul c).comp hf @[to_additive] lemma UniformInducing.uniformContinuousConstSMul [SMul M Y] [UniformContinuousConstSMul M Y] {f : X → Y} (hf : UniformInducing f) (hsmul : ∀ (c : M) x, f (c • x) = c • f x) : UniformContinuousConstSMul M X where uniformContinuous_const_smul c := by simpa only [hf.uniformContinuous_iff, Function.comp_def, hsmul] using hf.uniformContinuous.const_smul c /-- If a scalar action is central, then its right action is uniform continuous when its left action is. -/ @[to_additive "If an additive action is central, then its right action is uniform continuous when its left action is."] instance (priority := 100) UniformContinuousConstSMul.op [SMul Mᵐᵒᵖ X] [IsCentralScalar M X] [UniformContinuousConstSMul M X] : UniformContinuousConstSMul Mᵐᵒᵖ X := ⟨MulOpposite.rec' fun c ↦ by simpa only [op_smul_eq_smul] using uniformContinuous_const_smul c⟩ @[to_additive] instance MulOpposite.uniformContinuousConstSMul [UniformContinuousConstSMul M X] : UniformContinuousConstSMul M Xᵐᵒᵖ := ⟨fun c => MulOpposite.uniformContinuous_op.comp <| MulOpposite.uniformContinuous_unop.const_smul c⟩ end SMul @[to_additive] instance UniformGroup.to_uniformContinuousConstSMul {G : Type u} [Group G] [UniformSpace G] [UniformGroup G] : UniformContinuousConstSMul G G := ⟨fun _ => uniformContinuous_const.mul uniformContinuous_id⟩ namespace UniformSpace namespace Completion section SMul variable [SMul M X] @[to_additive] noncomputable instance : SMul M (Completion X) := ⟨fun c => Completion.map (c • ·)⟩ @[to_additive] theorem smul_def (c : M) (x : Completion X) : c • x = Completion.map (c • ·) x := rfl @[to_additive] instance : UniformContinuousConstSMul M (Completion X) := ⟨fun _ => uniformContinuous_map⟩ @[to_additive instVAddAssocClass] instance instIsScalarTower [SMul N X] [SMul M N] [UniformContinuousConstSMul M X] [UniformContinuousConstSMul N X] [IsScalarTower M N X] : IsScalarTower M N (Completion X) := ⟨fun m n x => by have : _ = (_ : Completion X → Completion X) := map_comp (uniformContinuous_const_smul m) (uniformContinuous_const_smul n) refine Eq.trans ?_ (congr_fun this.symm x) exact congr_arg (fun f => Completion.map f x) (funext (smul_assoc _ _))⟩ @[to_additive] instance [SMul N X] [SMulCommClass M N X] [UniformContinuousConstSMul M X] [UniformContinuousConstSMul N X] : SMulCommClass M N (Completion X) := ⟨fun m n x => by have hmn : m • n • x = (Completion.map (SMul.smul m) ∘ Completion.map (SMul.smul n)) x := rfl have hnm : n • m • x = (Completion.map (SMul.smul n) ∘ Completion.map (SMul.smul m)) x := rfl rw [hmn, hnm, map_comp, map_comp] · exact congr_arg (fun f => Completion.map f x) (funext (smul_comm _ _)) repeat' exact uniformContinuous_const_smul _⟩ @[to_additive] instance [SMul Mᵐᵒᵖ X] [IsCentralScalar M X] : IsCentralScalar M (Completion X) := ⟨fun c a => (congr_arg fun f => Completion.map f a) <| funext (op_smul_eq_smul c)⟩ variable {M X} variable [UniformContinuousConstSMul M X] @[to_additive (attr := simp, norm_cast)] theorem coe_smul (c : M) (x : X) : (↑(c • x) : Completion X) = c • (x : Completion X) := (map_coe (uniformContinuous_const_smul c) x).symm end SMul @[to_additive] noncomputable instance [Monoid M] [MulAction M X] [UniformContinuousConstSMul M X] : MulAction M (Completion X) where smul := (· • ·) one_smul := ext' (continuous_const_smul _) continuous_id fun a => by rw [← coe_smul, one_smul] mul_smul x y := ext' (continuous_const_smul _) ((continuous_const_smul _).const_smul _) fun a => by simp only [← coe_smul, mul_smul] end Completion end UniformSpace
Topology\Algebra\UniformRing.lean
/- Copyright (c) 2018 Patrick Massot. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Johannes Hölzl -/ import Mathlib.Algebra.Algebra.Defs import Mathlib.Logic.Equiv.TransferInstance import Mathlib.Topology.Algebra.GroupCompletion import Mathlib.Topology.Algebra.Ring.Ideal /-! # Completion of topological rings: This files endows the completion of a topological ring with a ring structure. More precisely the instance `UniformSpace.Completion.ring` builds a ring structure on the completion of a ring endowed with a compatible uniform structure in the sense of `UniformAddGroup`. There is also a commutative version when the original ring is commutative. Moreover, if a topological ring is an algebra over a commutative semiring, then so is its `UniformSpace.Completion`. The last part of the file builds a ring structure on the biggest separated quotient of a ring. ## Main declarations: Beyond the instances explained above (that don't have to be explicitly invoked), the main constructions deal with continuous ring morphisms. * `UniformSpace.Completion.extensionHom`: extends a continuous ring morphism from `R` to a complete separated group `S` to `Completion R`. * `UniformSpace.Completion.mapRingHom` : promotes a continuous ring morphism from `R` to `S` into a continuous ring morphism from `Completion R` to `Completion S`. TODO: Generalise the results here from the concrete `Completion` to any `AbstractCompletion`. -/ noncomputable section universe u namespace UniformSpace.Completion open DenseInducing UniformSpace Function section one_and_mul variable (α : Type*) [Ring α] [UniformSpace α] instance one : One (Completion α) := ⟨(1 : α)⟩ instance mul : Mul (Completion α) := ⟨curry <| (denseInducing_coe.prod denseInducing_coe).extend ((↑) ∘ uncurry (· * ·))⟩ @[norm_cast] theorem coe_one : ((1 : α) : Completion α) = 1 := rfl end one_and_mul variable {α : Type*} [Ring α] [UniformSpace α] [TopologicalRing α] @[norm_cast] theorem coe_mul (a b : α) : ((a * b : α) : Completion α) = a * b := ((denseInducing_coe.prod denseInducing_coe).extend_eq ((continuous_coe α).comp (@continuous_mul α _ _ _)) (a, b)).symm variable [UniformAddGroup α] theorem continuous_mul : Continuous fun p : Completion α × Completion α => p.1 * p.2 := by let m := (AddMonoidHom.mul : α →+ α →+ α).compr₂ toCompl have : Continuous fun p : α × α => m p.1 p.2 := by apply (continuous_coe α).comp _ simp only [AddMonoidHom.coe_mul, AddMonoidHom.coe_mulLeft] exact _root_.continuous_mul have di : DenseInducing (toCompl : α → Completion α) := denseInducing_coe convert di.extend_Z_bilin di this theorem Continuous.mul {β : Type*} [TopologicalSpace β] {f g : β → Completion α} (hf : Continuous f) (hg : Continuous g) : Continuous fun b => f b * g b := Continuous.comp continuous_mul (Continuous.prod_mk hf hg : _) instance ring : Ring (Completion α) := { AddMonoidWithOne.unary, (inferInstanceAs (AddCommGroup (Completion α))), (inferInstanceAs (Mul (Completion α))), (inferInstanceAs (One (Completion α))) with zero_mul := fun a => Completion.induction_on a (isClosed_eq (Continuous.mul continuous_const continuous_id) continuous_const) fun a => by rw [← coe_zero, ← coe_mul, zero_mul] mul_zero := fun a => Completion.induction_on a (isClosed_eq (Continuous.mul continuous_id continuous_const) continuous_const) fun a => by rw [← coe_zero, ← coe_mul, mul_zero] one_mul := fun a => Completion.induction_on a (isClosed_eq (Continuous.mul continuous_const continuous_id) continuous_id) fun a => by rw [← coe_one, ← coe_mul, one_mul] mul_one := fun a => Completion.induction_on a (isClosed_eq (Continuous.mul continuous_id continuous_const) continuous_id) fun a => by rw [← coe_one, ← coe_mul, mul_one] mul_assoc := fun a b c => Completion.induction_on₃ a b c (isClosed_eq (Continuous.mul (Continuous.mul continuous_fst (continuous_fst.comp continuous_snd)) (continuous_snd.comp continuous_snd)) (Continuous.mul continuous_fst (Continuous.mul (continuous_fst.comp continuous_snd) (continuous_snd.comp continuous_snd)))) fun a b c => by rw [← coe_mul, ← coe_mul, ← coe_mul, ← coe_mul, mul_assoc] left_distrib := fun a b c => Completion.induction_on₃ a b c (isClosed_eq (Continuous.mul continuous_fst (Continuous.add (continuous_fst.comp continuous_snd) (continuous_snd.comp continuous_snd))) (Continuous.add (Continuous.mul continuous_fst (continuous_fst.comp continuous_snd)) (Continuous.mul continuous_fst (continuous_snd.comp continuous_snd)))) fun a b c => by rw [← coe_add, ← coe_mul, ← coe_mul, ← coe_mul, ← coe_add, mul_add] right_distrib := fun a b c => Completion.induction_on₃ a b c (isClosed_eq (Continuous.mul (Continuous.add continuous_fst (continuous_fst.comp continuous_snd)) (continuous_snd.comp continuous_snd)) (Continuous.add (Continuous.mul continuous_fst (continuous_snd.comp continuous_snd)) (Continuous.mul (continuous_fst.comp continuous_snd) (continuous_snd.comp continuous_snd)))) fun a b c => by rw [← coe_add, ← coe_mul, ← coe_mul, ← coe_mul, ← coe_add, add_mul] } /-- The map from a uniform ring to its completion, as a ring homomorphism. -/ def coeRingHom : α →+* Completion α where toFun := (↑) map_one' := coe_one α map_zero' := coe_zero map_add' := coe_add map_mul' := coe_mul theorem continuous_coeRingHom : Continuous (coeRingHom : α → Completion α) := continuous_coe α variable {β : Type u} [UniformSpace β] [Ring β] [UniformAddGroup β] [TopologicalRing β] (f : α →+* β) (hf : Continuous f) /-- The completion extension as a ring morphism. -/ def extensionHom [CompleteSpace β] [T0Space β] : Completion α →+* β := have hf' : Continuous (f : α →+ β) := hf -- helping the elaborator have hf : UniformContinuous f := uniformContinuous_addMonoidHom_of_continuous hf' { toFun := Completion.extension f map_zero' := by simp_rw [← coe_zero, extension_coe hf, f.map_zero] map_add' := fun a b => Completion.induction_on₂ a b (isClosed_eq (continuous_extension.comp continuous_add) ((continuous_extension.comp continuous_fst).add (continuous_extension.comp continuous_snd))) fun a b => by simp_rw [← coe_add, extension_coe hf, f.map_add] map_one' := by rw [← coe_one, extension_coe hf, f.map_one] map_mul' := fun a b => Completion.induction_on₂ a b (isClosed_eq (continuous_extension.comp continuous_mul) ((continuous_extension.comp continuous_fst).mul (continuous_extension.comp continuous_snd))) fun a b => by simp_rw [← coe_mul, extension_coe hf, f.map_mul] } instance topologicalRing : TopologicalRing (Completion α) where continuous_add := continuous_add continuous_mul := continuous_mul /-- The completion map as a ring morphism. -/ def mapRingHom (hf : Continuous f) : Completion α →+* Completion β := extensionHom (coeRingHom.comp f) (continuous_coeRingHom.comp hf) section Algebra variable (A : Type*) [Ring A] [UniformSpace A] [UniformAddGroup A] [TopologicalRing A] (R : Type*) [CommSemiring R] [Algebra R A] [UniformContinuousConstSMul R A] @[simp] theorem map_smul_eq_mul_coe (r : R) : Completion.map (r • ·) = ((algebraMap R A r : Completion A) * ·) := by ext x refine Completion.induction_on x ?_ fun a => ?_ · exact isClosed_eq Completion.continuous_map (continuous_mul_left _) · simp_rw [map_coe (uniformContinuous_const_smul r) a, Algebra.smul_def, coe_mul] instance algebra : Algebra R (Completion A) := { (UniformSpace.Completion.coeRingHom : A →+* Completion A).comp (algebraMap R A) with commutes' := fun r x => Completion.induction_on x (isClosed_eq (continuous_mul_left _) (continuous_mul_right _)) fun a => by simpa only [coe_mul] using congr_arg ((↑) : A → Completion A) (Algebra.commutes r a) smul_def' := fun r x => congr_fun (map_smul_eq_mul_coe A R r) x } theorem algebraMap_def (r : R) : algebraMap R (Completion A) r = (algebraMap R A r : Completion A) := rfl end Algebra section CommRing variable (R : Type*) [CommRing R] [UniformSpace R] [UniformAddGroup R] [TopologicalRing R] instance commRing : CommRing (Completion R) := { Completion.ring with mul_comm := fun a b => Completion.induction_on₂ a b (isClosed_eq (continuous_fst.mul continuous_snd) (continuous_snd.mul continuous_fst)) fun a b => by rw [← coe_mul, ← coe_mul, mul_comm] } /-- A shortcut instance for the common case -/ instance algebra' : Algebra R (Completion R) := by infer_instance end CommRing end UniformSpace.Completion namespace UniformSpace variable {α : Type*} -- TODO: move (some of) these results to the file about topological rings theorem inseparableSetoid_ring (α) [CommRing α] [TopologicalSpace α] [TopologicalRing α] : inseparableSetoid α = Submodule.quotientRel (Ideal.closure ⊥) := Setoid.ext fun x y => addGroup_inseparable_iff.trans <| .trans (by rfl) (Submodule.quotientRel_r_def _).symm @[deprecated (since := "2024-03-09")] alias ring_sep_rel := inseparableSetoid_ring -- Equality of types is evil @[deprecated UniformSpace.inseparableSetoid_ring (since := "2024-02-16")] theorem ring_sep_quot (α : Type u) [r : CommRing α] [TopologicalSpace α] [TopologicalRing α] : SeparationQuotient α = (α ⧸ (⊥ : Ideal α).closure) := by rw [SeparationQuotient, @inseparableSetoid_ring α r] rfl /-- Given a topological ring `α` equipped with a uniform structure that makes subtraction uniformly continuous, get an homeomorphism between the separated quotient of `α` and the quotient ring corresponding to the closure of zero. -/ def sepQuotHomeomorphRingQuot (α) [CommRing α] [TopologicalSpace α] [TopologicalRing α] : SeparationQuotient α ≃ₜ α ⧸ (⊥ : Ideal α).closure where toEquiv := Quotient.congrRight fun x y => by rw [inseparableSetoid_ring] continuous_toFun := continuous_id.quotient_map' <| by rw [inseparableSetoid_ring]; exact fun _ _ ↦ id continuous_invFun := continuous_id.quotient_map' <| by rw [inseparableSetoid_ring]; exact fun _ _ ↦ id instance commRing [CommRing α] [TopologicalSpace α] [TopologicalRing α] : CommRing (SeparationQuotient α) := (sepQuotHomeomorphRingQuot _).commRing /-- Given a topological ring `α` equipped with a uniform structure that makes subtraction uniformly continuous, get an equivalence between the separated quotient of `α` and the quotient ring corresponding to the closure of zero. -/ def sepQuotRingEquivRingQuot (α) [CommRing α] [TopologicalSpace α] [TopologicalRing α] : SeparationQuotient α ≃+* α ⧸ (⊥ : Ideal α).closure := (sepQuotHomeomorphRingQuot _).ringEquiv instance topologicalRing [CommRing α] [TopologicalSpace α] [TopologicalRing α] : TopologicalRing (SeparationQuotient α) where toContinuousAdd := Inducing.continuousAdd (sepQuotRingEquivRingQuot α) (sepQuotHomeomorphRingQuot α).inducing toContinuousMul := Inducing.continuousMul (sepQuotRingEquivRingQuot α) (sepQuotHomeomorphRingQuot α).inducing toContinuousNeg := Inducing.continuousNeg (sepQuotHomeomorphRingQuot α).inducing <| map_neg (sepQuotRingEquivRingQuot α) end UniformSpace section UniformExtension variable {α : Type*} [UniformSpace α] [Semiring α] variable {β : Type*} [UniformSpace β] [Semiring β] [TopologicalSemiring β] variable {γ : Type*} [UniformSpace γ] [Semiring γ] [TopologicalSemiring γ] variable [T2Space γ] [CompleteSpace γ] /-- The dense inducing extension as a ring homomorphism. -/ noncomputable def DenseInducing.extendRingHom {i : α →+* β} {f : α →+* γ} (ue : UniformInducing i) (dr : DenseRange i) (hf : UniformContinuous f) : β →+* γ where toFun := (ue.denseInducing dr).extend f map_one' := by convert DenseInducing.extend_eq (ue.denseInducing dr) hf.continuous 1 exacts [i.map_one.symm, f.map_one.symm] map_zero' := by convert DenseInducing.extend_eq (ue.denseInducing dr) hf.continuous 0 <;> simp only [map_zero] map_add' := by have h := (uniformContinuous_uniformly_extend ue dr hf).continuous refine fun x y => DenseRange.induction_on₂ dr ?_ (fun a b => ?_) x y · exact isClosed_eq (Continuous.comp h continuous_add) ((h.comp continuous_fst).add (h.comp continuous_snd)) · simp_rw [← i.map_add, DenseInducing.extend_eq (ue.denseInducing dr) hf.continuous _, ← f.map_add] map_mul' := by have h := (uniformContinuous_uniformly_extend ue dr hf).continuous refine fun x y => DenseRange.induction_on₂ dr ?_ (fun a b => ?_) x y · exact isClosed_eq (Continuous.comp h continuous_mul) ((h.comp continuous_fst).mul (h.comp continuous_snd)) · simp_rw [← i.map_mul, DenseInducing.extend_eq (ue.denseInducing dr) hf.continuous _, ← f.map_mul] end UniformExtension
Topology\Algebra\WithZeroTopology.lean
/- Copyright (c) 2021 Patrick Massot. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot -/ import Mathlib.Topology.Algebra.GroupWithZero import Mathlib.Topology.Order.OrderClosed /-! # The topology on linearly ordered commutative groups with zero Let `Γ₀` be a linearly ordered commutative group to which we have adjoined a zero element. Then `Γ₀` may naturally be endowed with a topology that turns `Γ₀` into a topological monoid. Neighborhoods of zero are sets containing `{ γ | γ < γ₀ }` for some invertible element `γ₀` and every invertible element is open. In particular the topology is the following: "a subset `U ⊆ Γ₀` is open if `0 ∉ U` or if there is an invertible `γ₀ ∈ Γ₀` such that `{ γ | γ < γ₀ } ⊆ U`", see `WithZeroTopology.isOpen_iff`. We prove this topology is ordered and T₅ (in addition to be compatible with the monoid structure). All this is useful to extend a valuation to a completion. This is an abstract version of how the absolute value (resp. `p`-adic absolute value) on `ℚ` is extended to `ℝ` (resp. `ℚₚ`). ## Implementation notes This topology is defined as a scoped instance since it may not be the desired topology on a linearly ordered commutative group with zero. You can locally activate this topology using `open WithZeroTopology`. -/ open Topology Filter TopologicalSpace Filter Set Function namespace WithZeroTopology variable {α Γ₀ : Type*} [LinearOrderedCommGroupWithZero Γ₀] {γ γ₁ γ₂ : Γ₀} {l : Filter α} {f : α → Γ₀} /-- The topology on a linearly ordered commutative group with a zero element adjoined. A subset U is open if 0 ∉ U or if there is an invertible element γ₀ such that {γ | γ < γ₀} ⊆ U. -/ scoped instance (priority := 100) topologicalSpace : TopologicalSpace Γ₀ := nhdsAdjoint 0 <| ⨅ γ ≠ 0, 𝓟 (Iio γ) theorem nhds_eq_update : (𝓝 : Γ₀ → Filter Γ₀) = update pure 0 (⨅ γ ≠ 0, 𝓟 (Iio γ)) := by rw [nhds_nhdsAdjoint, sup_of_le_right] exact le_iInf₂ fun γ hγ ↦ le_principal_iff.2 <| zero_lt_iff.2 hγ /-! ### Neighbourhoods of zero -/ theorem nhds_zero : 𝓝 (0 : Γ₀) = ⨅ γ ≠ 0, 𝓟 (Iio γ) := by rw [nhds_eq_update, update_same] /-- In a linearly ordered group with zero element adjoined, `U` is a neighbourhood of `0` if and only if there exists a nonzero element `γ₀` such that `Iio γ₀ ⊆ U`. -/ theorem hasBasis_nhds_zero : (𝓝 (0 : Γ₀)).HasBasis (fun γ : Γ₀ => γ ≠ 0) Iio := by rw [nhds_zero] refine hasBasis_biInf_principal ?_ ⟨1, one_ne_zero⟩ exact directedOn_iff_directed.2 (Monotone.directed_ge fun a b hab => Iio_subset_Iio hab) theorem Iio_mem_nhds_zero (hγ : γ ≠ 0) : Iio γ ∈ 𝓝 (0 : Γ₀) := hasBasis_nhds_zero.mem_of_mem hγ /-- If `γ` is an invertible element of a linearly ordered group with zero element adjoined, then `Iio (γ : Γ₀)` is a neighbourhood of `0`. -/ theorem nhds_zero_of_units (γ : Γ₀ˣ) : Iio ↑γ ∈ 𝓝 (0 : Γ₀) := Iio_mem_nhds_zero γ.ne_zero theorem tendsto_zero : Tendsto f l (𝓝 (0 : Γ₀)) ↔ ∀ (γ₀) (_ : γ₀ ≠ 0), ∀ᶠ x in l, f x < γ₀ := by simp [nhds_zero] /-! ### Neighbourhoods of non-zero elements -/ /-- The neighbourhood filter of a nonzero element consists of all sets containing that element. -/ @[simp] theorem nhds_of_ne_zero {γ : Γ₀} (h₀ : γ ≠ 0) : 𝓝 γ = pure γ := nhds_nhdsAdjoint_of_ne _ h₀ /-- The neighbourhood filter of an invertible element consists of all sets containing that element. -/ theorem nhds_coe_units (γ : Γ₀ˣ) : 𝓝 (γ : Γ₀) = pure (γ : Γ₀) := nhds_of_ne_zero γ.ne_zero /-- If `γ` is an invertible element of a linearly ordered group with zero element adjoined, then `{γ}` is a neighbourhood of `γ`. -/ theorem singleton_mem_nhds_of_units (γ : Γ₀ˣ) : ({↑γ} : Set Γ₀) ∈ 𝓝 (γ : Γ₀) := by simp /-- If `γ` is a nonzero element of a linearly ordered group with zero element adjoined, then `{γ}` is a neighbourhood of `γ`. -/ theorem singleton_mem_nhds_of_ne_zero (h : γ ≠ 0) : ({γ} : Set Γ₀) ∈ 𝓝 (γ : Γ₀) := by simp [h] theorem hasBasis_nhds_of_ne_zero {x : Γ₀} (h : x ≠ 0) : HasBasis (𝓝 x) (fun _ : Unit => True) fun _ => {x} := by rw [nhds_of_ne_zero h] exact hasBasis_pure _ theorem hasBasis_nhds_units (γ : Γ₀ˣ) : HasBasis (𝓝 (γ : Γ₀)) (fun _ : Unit => True) fun _ => {↑γ} := hasBasis_nhds_of_ne_zero γ.ne_zero theorem tendsto_of_ne_zero {γ : Γ₀} (h : γ ≠ 0) : Tendsto f l (𝓝 γ) ↔ ∀ᶠ x in l, f x = γ := by rw [nhds_of_ne_zero h, tendsto_pure] theorem tendsto_units {γ₀ : Γ₀ˣ} : Tendsto f l (𝓝 (γ₀ : Γ₀)) ↔ ∀ᶠ x in l, f x = γ₀ := tendsto_of_ne_zero γ₀.ne_zero theorem Iio_mem_nhds (h : γ₁ < γ₂) : Iio γ₂ ∈ 𝓝 γ₁ := by rcases eq_or_ne γ₁ 0 with (rfl | h₀) <;> simp [*, h.ne', Iio_mem_nhds_zero] /-! ### Open/closed sets -/ theorem isOpen_iff {s : Set Γ₀} : IsOpen s ↔ (0 : Γ₀) ∉ s ∨ ∃ γ, γ ≠ 0 ∧ Iio γ ⊆ s := by rw [isOpen_iff_mem_nhds, ← and_forall_ne (0 : Γ₀)] simp (config := { contextual := true }) [nhds_of_ne_zero, imp_iff_not_or, hasBasis_nhds_zero.mem_iff] theorem isClosed_iff {s : Set Γ₀} : IsClosed s ↔ (0 : Γ₀) ∈ s ∨ ∃ γ, γ ≠ 0 ∧ s ⊆ Ici γ := by simp only [← isOpen_compl_iff, isOpen_iff, mem_compl_iff, not_not, ← compl_Ici, compl_subset_compl] theorem isOpen_Iio {a : Γ₀} : IsOpen (Iio a) := isOpen_iff.mpr <| imp_iff_not_or.mp fun ha => ⟨a, ne_of_gt ha, Subset.rfl⟩ /-! ### Instances -/ /-- The topology on a linearly ordered group with zero element adjoined is compatible with the order structure: the set `{p : Γ₀ × Γ₀ | p.1 ≤ p.2}` is closed. -/ @[nolint defLemma] scoped instance (priority := 100) orderClosedTopology : OrderClosedTopology Γ₀ where isClosed_le' := by simp only [← isOpen_compl_iff, compl_setOf, not_le, isOpen_iff_mem_nhds] rintro ⟨a, b⟩ (hab : b < a) rw [nhds_prod_eq, nhds_of_ne_zero (zero_le'.trans_lt hab).ne', pure_prod] exact Iio_mem_nhds hab /-- The topology on a linearly ordered group with zero element adjoined is T₅. -/ @[nolint defLemma] scoped instance (priority := 100) t5Space : T5Space Γ₀ where completely_normal := fun s t h₁ h₂ => by by_cases hs : 0 ∈ s · have ht : 0 ∉ t := fun ht => disjoint_left.1 h₁ (subset_closure hs) ht rwa [(isOpen_iff.2 (.inl ht)).nhdsSet_eq, disjoint_nhdsSet_principal] · rwa [(isOpen_iff.2 (.inl hs)).nhdsSet_eq, disjoint_principal_nhdsSet] /-- The topology on a linearly ordered group with zero element adjoined makes it a topological monoid. -/ @[nolint defLemma] scoped instance (priority := 100) : ContinuousMul Γ₀ where continuous_mul := by simp only [continuous_iff_continuousAt, ContinuousAt] rintro ⟨x, y⟩ wlog hle : x ≤ y generalizing x y · have := (this y x (le_of_not_le hle)).comp (continuous_swap.tendsto (x, y)) simpa only [mul_comm, Function.comp, Prod.swap] using this rcases eq_or_ne x 0 with (rfl | hx) <;> [rcases eq_or_ne y 0 with (rfl | hy); skip] · rw [zero_mul] refine ((hasBasis_nhds_zero.prod_nhds hasBasis_nhds_zero).tendsto_iff hasBasis_nhds_zero).2 fun γ hγ => ⟨(γ, 1), ⟨hγ, one_ne_zero⟩, ?_⟩ rintro ⟨x, y⟩ ⟨hx : x < γ, hy : y < 1⟩ exact (mul_lt_mul₀ hx hy).trans_eq (mul_one γ) · rw [zero_mul, nhds_prod_eq, nhds_of_ne_zero hy, prod_pure, tendsto_map'_iff] refine (hasBasis_nhds_zero.tendsto_iff hasBasis_nhds_zero).2 fun γ hγ => ?_ refine ⟨γ / y, div_ne_zero hγ hy, fun x hx => ?_⟩ calc x * y < γ / y * y := mul_lt_right₀ _ hx hy _ = γ := div_mul_cancel₀ _ hy · have hy : y ≠ 0 := ((zero_lt_iff.mpr hx).trans_le hle).ne' rw [nhds_prod_eq, nhds_of_ne_zero hx, nhds_of_ne_zero hy, prod_pure_pure] exact pure_le_nhds (x * y) @[nolint defLemma] scoped instance (priority := 100) : HasContinuousInv₀ Γ₀ := ⟨fun γ h => by rw [ContinuousAt, nhds_of_ne_zero h] exact pure_le_nhds γ⁻¹⟩ end WithZeroTopology
Topology\Algebra\Algebra\Rat.lean
/- Copyright (c) 2021 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Scott Morrison -/ import Mathlib.Algebra.Algebra.Rat import Mathlib.Topology.Algebra.Monoid /-! # Topological (sub)algebras over `Rat` ## Results This is just a minimal stub for now! -/ section DivisionRing /-- The action induced by `DivisionRing.toRatAlgebra` is continuous. -/ instance DivisionRing.continuousConstSMul_rat {A} [DivisionRing A] [TopologicalSpace A] [ContinuousMul A] [CharZero A] : ContinuousConstSMul ℚ A := ⟨fun r => by simpa only [Algebra.smul_def] using continuous_const.mul continuous_id⟩ end DivisionRing
Topology\Algebra\Constructions\DomMulAct.lean
/- Copyright (c) 2024 Yury Kudryashov. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yury Kudryashov -/ import Mathlib.Topology.Homeomorph import Mathlib.GroupTheory.GroupAction.DomAct.Basic /-! # Topological structure on `DomMulAct _` In this file we define topology on `DomMulAct _` and prove basic facts about this topology. The topology on `Mᵈᵐᵃ` is the same as the topology on `M` (formally, it is induced by `DomMulAct.mk.symm`, since the types aren't definitionally equal). -/ open Filter TopologicalSpace open scoped Topology namespace DomMulAct variable {M : Type*} [TopologicalSpace M] @[to_additive] instance instTopologicalSpace : TopologicalSpace Mᵈᵐᵃ := .induced mk.symm ‹_› @[to_additive (attr := continuity, fun_prop)] theorem continuous_mk : Continuous (@mk M) := continuous_induced_rng.2 continuous_id @[to_additive (attr := continuity, fun_prop)] theorem continuous_mk_symm : Continuous (@mk M).symm := continuous_induced_dom /-- `DomMulAct.mk` as a homeomorphism. -/ @[to_additive (attr := simps toEquiv) "`DomAddAct.mk` as a homeomorphism"] def mkHomeomorph : M ≃ₜ Mᵈᵐᵃ where toEquiv := mk @[to_additive (attr := simp)] theorem coe_mkHomeomorph : ⇑(mkHomeomorph : M ≃ₜ Mᵈᵐᵃ) = mk := rfl @[to_additive (attr := simp)] theorem coe_mkHomeomorph_symm : ⇑(mkHomeomorph : M ≃ₜ Mᵈᵐᵃ).symm = mk.symm := rfl @[to_additive] theorem inducing_mk : Inducing (@mk M) := mkHomeomorph.inducing @[to_additive] theorem embedding_mk : Embedding (@mk M) := mkHomeomorph.embedding @[to_additive] theorem openEmbedding_mk : OpenEmbedding (@mk M) := mkHomeomorph.openEmbedding @[to_additive] theorem closedEmbedding_mk : ClosedEmbedding (@mk M) := mkHomeomorph.closedEmbedding @[to_additive] theorem quotientMap_mk : QuotientMap (@mk M) := mkHomeomorph.quotientMap @[to_additive] theorem inducing_mk_symm : Inducing (@mk M).symm := mkHomeomorph.symm.inducing @[to_additive] theorem embedding_mk_symm : Embedding (@mk M).symm := mkHomeomorph.symm.embedding @[to_additive] theorem openEmbedding_mk_symm : OpenEmbedding (@mk M).symm := mkHomeomorph.symm.openEmbedding @[to_additive] theorem closedEmbedding_mk_symm : ClosedEmbedding (@mk M).symm := mkHomeomorph.symm.closedEmbedding @[to_additive] theorem quotientMap_mk_symm : QuotientMap (@mk M).symm := mkHomeomorph.symm.quotientMap @[to_additive] instance instT0Space [T0Space M] : T0Space Mᵈᵐᵃ := embedding_mk_symm.t0Space @[to_additive] instance instT1Space [T1Space M] : T1Space Mᵈᵐᵃ := embedding_mk_symm.t1Space @[to_additive] instance instT2Space [T2Space M] : T2Space Mᵈᵐᵃ := embedding_mk_symm.t2Space @[to_additive] instance instT25Space [T25Space M] : T25Space Mᵈᵐᵃ := embedding_mk_symm.t25Space @[to_additive] instance instT3Space [T3Space M] : T3Space Mᵈᵐᵃ := embedding_mk_symm.t3Space @[to_additive] instance instT4Space [T4Space M] : T4Space Mᵈᵐᵃ := closedEmbedding_mk_symm.t4Space @[to_additive] instance instT5Space [T5Space M] : T5Space Mᵈᵐᵃ := closedEmbedding_mk_symm.t5Space @[to_additive] instance instR0Space [R0Space M] : R0Space Mᵈᵐᵃ := embedding_mk_symm.r0Space @[to_additive] instance instR1Space [R1Space M] : R1Space Mᵈᵐᵃ := embedding_mk_symm.r1Space @[to_additive] instance instRegularSpace [RegularSpace M] : RegularSpace Mᵈᵐᵃ := embedding_mk_symm.regularSpace @[to_additive] instance instNormalSpace [NormalSpace M] : NormalSpace Mᵈᵐᵃ := closedEmbedding_mk_symm.normalSpace @[to_additive] instance instCompletelyNormalSpace [CompletelyNormalSpace M] : CompletelyNormalSpace Mᵈᵐᵃ := closedEmbedding_mk_symm.completelyNormalSpace @[to_additive] instance instDiscreteTopology [DiscreteTopology M] : DiscreteTopology Mᵈᵐᵃ := embedding_mk_symm.discreteTopology @[to_additive] instance instSeparableSpace [SeparableSpace M] : SeparableSpace Mᵈᵐᵃ := quotientMap_mk.separableSpace @[to_additive] instance instFirstCountableTopology [FirstCountableTopology M] : FirstCountableTopology Mᵈᵐᵃ := inducing_mk_symm.firstCountableTopology @[to_additive] instance instSecondCountableTopology [SecondCountableTopology M] : SecondCountableTopology Mᵈᵐᵃ := inducing_mk_symm.secondCountableTopology @[to_additive (attr := simp)] theorem map_mk_nhds (x : M) : map (mk : M → Mᵈᵐᵃ) (𝓝 x) = 𝓝 (mk x) := mkHomeomorph.map_nhds_eq x @[to_additive (attr := simp)] theorem map_mk_symm_nhds (x : Mᵈᵐᵃ) : map (mk.symm : Mᵈᵐᵃ → M) (𝓝 x) = 𝓝 (mk.symm x) := mkHomeomorph.symm.map_nhds_eq x @[to_additive (attr := simp)] theorem comap_mk_nhds (x : Mᵈᵐᵃ) : comap (mk : M → Mᵈᵐᵃ) (𝓝 x) = 𝓝 (mk.symm x) := mkHomeomorph.comap_nhds_eq x @[to_additive (attr := simp)] theorem comap_mk.symm_nhds (x : M) : comap (mk.symm : Mᵈᵐᵃ → M) (𝓝 x) = 𝓝 (mk x) := mkHomeomorph.symm.comap_nhds_eq x end DomMulAct
Topology\Algebra\Group\Basic.lean
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Patrick Massot -/ import Mathlib.GroupTheory.GroupAction.ConjAct import Mathlib.GroupTheory.GroupAction.Quotient import Mathlib.GroupTheory.QuotientGroup import Mathlib.Topology.Algebra.Monoid import Mathlib.Topology.Algebra.Constructions import Mathlib.Algebra.Order.Archimedean.Basic /-! # Topological groups This file defines the following typeclasses: * `TopologicalGroup`, `TopologicalAddGroup`: multiplicative and additive topological groups, i.e., groups with continuous `(*)` and `(⁻¹)` / `(+)` and `(-)`; * `ContinuousSub G` means that `G` has a continuous subtraction operation. There is an instance deducing `ContinuousSub` from `TopologicalGroup` but we use a separate typeclass because, e.g., `ℕ` and `ℝ≥0` have continuous subtraction but are not additive groups. We also define `Homeomorph` versions of several `Equiv`s: `Homeomorph.mulLeft`, `Homeomorph.mulRight`, `Homeomorph.inv`, and prove a few facts about neighbourhood filters in groups. ## Tags topological space, group, topological group -/ open Set Filter TopologicalSpace Function Topology Pointwise MulOpposite universe u v w x variable {G : Type w} {H : Type x} {α : Type u} {β : Type v} section ContinuousMulGroup /-! ### Groups with continuous multiplication In this section we prove a few statements about groups with continuous `(*)`. -/ variable [TopologicalSpace G] [Group G] [ContinuousMul G] /-- Multiplication from the left in a topological group as a homeomorphism. -/ @[to_additive "Addition from the left in a topological additive group as a homeomorphism."] protected def Homeomorph.mulLeft (a : G) : G ≃ₜ G := { Equiv.mulLeft a with continuous_toFun := continuous_const.mul continuous_id continuous_invFun := continuous_const.mul continuous_id } @[to_additive (attr := simp)] theorem Homeomorph.coe_mulLeft (a : G) : ⇑(Homeomorph.mulLeft a) = (a * ·) := rfl @[to_additive] theorem Homeomorph.mulLeft_symm (a : G) : (Homeomorph.mulLeft a).symm = Homeomorph.mulLeft a⁻¹ := by ext rfl @[to_additive] lemma isOpenMap_mul_left (a : G) : IsOpenMap (a * ·) := (Homeomorph.mulLeft a).isOpenMap @[to_additive IsOpen.left_addCoset] theorem IsOpen.leftCoset {U : Set G} (h : IsOpen U) (x : G) : IsOpen (x • U) := isOpenMap_mul_left x _ h @[to_additive] lemma isClosedMap_mul_left (a : G) : IsClosedMap (a * ·) := (Homeomorph.mulLeft a).isClosedMap @[to_additive IsClosed.left_addCoset] theorem IsClosed.leftCoset {U : Set G} (h : IsClosed U) (x : G) : IsClosed (x • U) := isClosedMap_mul_left x _ h /-- Multiplication from the right in a topological group as a homeomorphism. -/ @[to_additive "Addition from the right in a topological additive group as a homeomorphism."] protected def Homeomorph.mulRight (a : G) : G ≃ₜ G := { Equiv.mulRight a with continuous_toFun := continuous_id.mul continuous_const continuous_invFun := continuous_id.mul continuous_const } @[to_additive (attr := simp)] lemma Homeomorph.coe_mulRight (a : G) : ⇑(Homeomorph.mulRight a) = (· * a) := rfl @[to_additive] theorem Homeomorph.mulRight_symm (a : G) : (Homeomorph.mulRight a).symm = Homeomorph.mulRight a⁻¹ := by ext rfl @[to_additive] theorem isOpenMap_mul_right (a : G) : IsOpenMap (· * a) := (Homeomorph.mulRight a).isOpenMap @[to_additive IsOpen.right_addCoset] theorem IsOpen.rightCoset {U : Set G} (h : IsOpen U) (x : G) : IsOpen (op x • U) := isOpenMap_mul_right x _ h @[to_additive] theorem isClosedMap_mul_right (a : G) : IsClosedMap (· * a) := (Homeomorph.mulRight a).isClosedMap @[to_additive IsClosed.right_addCoset] theorem IsClosed.rightCoset {U : Set G} (h : IsClosed U) (x : G) : IsClosed (op x • U) := isClosedMap_mul_right x _ h @[to_additive] theorem discreteTopology_of_isOpen_singleton_one (h : IsOpen ({1} : Set G)) : DiscreteTopology G := by rw [← singletons_open_iff_discrete] intro g suffices {g} = (g⁻¹ * ·) ⁻¹' {1} by rw [this] exact (continuous_mul_left g⁻¹).isOpen_preimage _ h simp only [mul_one, Set.preimage_mul_left_singleton, eq_self_iff_true, inv_inv, Set.singleton_eq_singleton_iff] @[to_additive] theorem discreteTopology_iff_isOpen_singleton_one : DiscreteTopology G ↔ IsOpen ({1} : Set G) := ⟨fun h => forall_open_iff_discrete.mpr h {1}, discreteTopology_of_isOpen_singleton_one⟩ end ContinuousMulGroup /-! ### `ContinuousInv` and `ContinuousNeg` -/ /-- Basic hypothesis to talk about a topological additive group. A topological additive group over `M`, for example, is obtained by requiring the instances `AddGroup M` and `ContinuousAdd M` and `ContinuousNeg M`. -/ class ContinuousNeg (G : Type u) [TopologicalSpace G] [Neg G] : Prop where continuous_neg : Continuous fun a : G => -a attribute [continuity, fun_prop] ContinuousNeg.continuous_neg /-- Basic hypothesis to talk about a topological group. A topological group over `M`, for example, is obtained by requiring the instances `Group M` and `ContinuousMul M` and `ContinuousInv M`. -/ @[to_additive (attr := continuity)] class ContinuousInv (G : Type u) [TopologicalSpace G] [Inv G] : Prop where continuous_inv : Continuous fun a : G => a⁻¹ attribute [continuity, fun_prop] ContinuousInv.continuous_inv export ContinuousInv (continuous_inv) export ContinuousNeg (continuous_neg) section ContinuousInv variable [TopologicalSpace G] [Inv G] [ContinuousInv G] @[to_additive] theorem ContinuousInv.induced {α : Type*} {β : Type*} {F : Type*} [FunLike F α β] [Group α] [Group β] [MonoidHomClass F α β] [tβ : TopologicalSpace β] [ContinuousInv β] (f : F) : @ContinuousInv α (tβ.induced f) _ := by let _tα := tβ.induced f refine ⟨continuous_induced_rng.2 ?_⟩ simp only [Function.comp, map_inv] fun_prop @[to_additive] protected theorem Specializes.inv {x y : G} (h : x ⤳ y) : (x⁻¹) ⤳ (y⁻¹) := h.map continuous_inv @[to_additive] protected theorem Inseparable.inv {x y : G} (h : Inseparable x y) : Inseparable (x⁻¹) (y⁻¹) := h.map continuous_inv @[to_additive] protected theorem Specializes.zpow {G : Type*} [DivInvMonoid G] [TopologicalSpace G] [ContinuousMul G] [ContinuousInv G] {x y : G} (h : x ⤳ y) : ∀ m : ℤ, (x ^ m) ⤳ (y ^ m) | .ofNat n => by simpa using h.pow n | .negSucc n => by simpa using (h.pow (n + 1)).inv @[to_additive] protected theorem Inseparable.zpow {G : Type*} [DivInvMonoid G] [TopologicalSpace G] [ContinuousMul G] [ContinuousInv G] {x y : G} (h : Inseparable x y) (m : ℤ) : Inseparable (x ^ m) (y ^ m) := (h.specializes.zpow m).antisymm (h.specializes'.zpow m) @[to_additive] instance : ContinuousInv (ULift G) := ⟨continuous_uLift_up.comp (continuous_inv.comp continuous_uLift_down)⟩ @[to_additive] theorem continuousOn_inv {s : Set G} : ContinuousOn Inv.inv s := continuous_inv.continuousOn @[to_additive] theorem continuousWithinAt_inv {s : Set G} {x : G} : ContinuousWithinAt Inv.inv s x := continuous_inv.continuousWithinAt @[to_additive] theorem continuousAt_inv {x : G} : ContinuousAt Inv.inv x := continuous_inv.continuousAt @[to_additive] theorem tendsto_inv (a : G) : Tendsto Inv.inv (𝓝 a) (𝓝 a⁻¹) := continuousAt_inv /-- If a function converges to a value in a multiplicative topological group, then its inverse converges to the inverse of this value. For the version in normed fields assuming additionally that the limit is nonzero, use `Tendsto.inv'`. -/ @[to_additive "If a function converges to a value in an additive topological group, then its negation converges to the negation of this value."] theorem Filter.Tendsto.inv {f : α → G} {l : Filter α} {y : G} (h : Tendsto f l (𝓝 y)) : Tendsto (fun x => (f x)⁻¹) l (𝓝 y⁻¹) := (continuous_inv.tendsto y).comp h variable [TopologicalSpace α] {f : α → G} {s : Set α} {x : α} @[to_additive (attr := continuity, fun_prop)] theorem Continuous.inv (hf : Continuous f) : Continuous fun x => (f x)⁻¹ := continuous_inv.comp hf @[to_additive (attr := fun_prop)] theorem ContinuousAt.inv (hf : ContinuousAt f x) : ContinuousAt (fun x => (f x)⁻¹) x := continuousAt_inv.comp hf @[to_additive (attr := fun_prop)] theorem ContinuousOn.inv (hf : ContinuousOn f s) : ContinuousOn (fun x => (f x)⁻¹) s := continuous_inv.comp_continuousOn hf @[to_additive] theorem ContinuousWithinAt.inv (hf : ContinuousWithinAt f s x) : ContinuousWithinAt (fun x => (f x)⁻¹) s x := Filter.Tendsto.inv hf @[to_additive] instance Prod.continuousInv [TopologicalSpace H] [Inv H] [ContinuousInv H] : ContinuousInv (G × H) := ⟨continuous_inv.fst'.prod_mk continuous_inv.snd'⟩ variable {ι : Type*} @[to_additive] instance Pi.continuousInv {C : ι → Type*} [∀ i, TopologicalSpace (C i)] [∀ i, Inv (C i)] [∀ i, ContinuousInv (C i)] : ContinuousInv (∀ i, C i) where continuous_inv := continuous_pi fun i => (continuous_apply i).inv /-- A version of `Pi.continuousInv` for non-dependent functions. It is needed because sometimes Lean fails to use `Pi.continuousInv` for non-dependent functions. -/ @[to_additive "A version of `Pi.continuousNeg` for non-dependent functions. It is needed because sometimes Lean fails to use `Pi.continuousNeg` for non-dependent functions."] instance Pi.has_continuous_inv' : ContinuousInv (ι → G) := Pi.continuousInv @[to_additive] instance (priority := 100) continuousInv_of_discreteTopology [TopologicalSpace H] [Inv H] [DiscreteTopology H] : ContinuousInv H := ⟨continuous_of_discreteTopology⟩ section PointwiseLimits variable (G₁ G₂ : Type*) [TopologicalSpace G₂] [T2Space G₂] @[to_additive] theorem isClosed_setOf_map_inv [Inv G₁] [Inv G₂] [ContinuousInv G₂] : IsClosed { f : G₁ → G₂ | ∀ x, f x⁻¹ = (f x)⁻¹ } := by simp only [setOf_forall] exact isClosed_iInter fun i => isClosed_eq (continuous_apply _) (continuous_apply _).inv end PointwiseLimits instance [TopologicalSpace H] [Inv H] [ContinuousInv H] : ContinuousNeg (Additive H) where continuous_neg := @continuous_inv H _ _ _ instance [TopologicalSpace H] [Neg H] [ContinuousNeg H] : ContinuousInv (Multiplicative H) where continuous_inv := @continuous_neg H _ _ _ end ContinuousInv section ContinuousInvolutiveInv variable [TopologicalSpace G] [InvolutiveInv G] [ContinuousInv G] {s : Set G} @[to_additive] theorem IsCompact.inv (hs : IsCompact s) : IsCompact s⁻¹ := by rw [← image_inv] exact hs.image continuous_inv variable (G) /-- Inversion in a topological group as a homeomorphism. -/ @[to_additive "Negation in a topological group as a homeomorphism."] protected def Homeomorph.inv (G : Type*) [TopologicalSpace G] [InvolutiveInv G] [ContinuousInv G] : G ≃ₜ G := { Equiv.inv G with continuous_toFun := continuous_inv continuous_invFun := continuous_inv } @[to_additive (attr := simp)] lemma Homeomorph.coe_inv {G : Type*} [TopologicalSpace G] [InvolutiveInv G] [ContinuousInv G] : ⇑(Homeomorph.inv G) = Inv.inv := rfl @[to_additive] theorem isOpenMap_inv : IsOpenMap (Inv.inv : G → G) := (Homeomorph.inv _).isOpenMap @[to_additive] theorem isClosedMap_inv : IsClosedMap (Inv.inv : G → G) := (Homeomorph.inv _).isClosedMap variable {G} @[to_additive] theorem IsOpen.inv (hs : IsOpen s) : IsOpen s⁻¹ := hs.preimage continuous_inv @[to_additive] theorem IsClosed.inv (hs : IsClosed s) : IsClosed s⁻¹ := hs.preimage continuous_inv @[to_additive] theorem inv_closure : ∀ s : Set G, (closure s)⁻¹ = closure s⁻¹ := (Homeomorph.inv G).preimage_closure variable [TopologicalSpace α] {f : α → G} {s : Set α} {x : α} @[to_additive (attr := simp)] lemma continuous_inv_iff : Continuous f⁻¹ ↔ Continuous f := (Homeomorph.inv G).comp_continuous_iff @[to_additive (attr := simp)] lemma continuousAt_inv_iff : ContinuousAt f⁻¹ x ↔ ContinuousAt f x := (Homeomorph.inv G).comp_continuousAt_iff _ _ @[to_additive (attr := simp)] lemma continuousOn_inv_iff : ContinuousOn f⁻¹ s ↔ ContinuousOn f s := (Homeomorph.inv G).comp_continuousOn_iff _ _ @[to_additive] alias ⟨Continuous.of_inv, _⟩ := continuous_inv_iff @[to_additive] alias ⟨ContinuousAt.of_inv, _⟩ := continuousAt_inv_iff @[to_additive] alias ⟨ContinuousOn.of_inv, _⟩ := continuousOn_inv_iff end ContinuousInvolutiveInv section LatticeOps variable {ι' : Sort*} [Inv G] @[to_additive] theorem continuousInv_sInf {ts : Set (TopologicalSpace G)} (h : ∀ t ∈ ts, @ContinuousInv G t _) : @ContinuousInv G (sInf ts) _ := letI := sInf ts { continuous_inv := continuous_sInf_rng.2 fun t ht => continuous_sInf_dom ht (@ContinuousInv.continuous_inv G t _ (h t ht)) } @[to_additive] theorem continuousInv_iInf {ts' : ι' → TopologicalSpace G} (h' : ∀ i, @ContinuousInv G (ts' i) _) : @ContinuousInv G (⨅ i, ts' i) _ := by rw [← sInf_range] exact continuousInv_sInf (Set.forall_mem_range.mpr h') @[to_additive] theorem continuousInv_inf {t₁ t₂ : TopologicalSpace G} (h₁ : @ContinuousInv G t₁ _) (h₂ : @ContinuousInv G t₂ _) : @ContinuousInv G (t₁ ⊓ t₂) _ := by rw [inf_eq_iInf] refine continuousInv_iInf fun b => ?_ cases b <;> assumption end LatticeOps @[to_additive] theorem Inducing.continuousInv {G H : Type*} [Inv G] [Inv H] [TopologicalSpace G] [TopologicalSpace H] [ContinuousInv H] {f : G → H} (hf : Inducing f) (hf_inv : ∀ x, f x⁻¹ = (f x)⁻¹) : ContinuousInv G := ⟨hf.continuous_iff.2 <| by simpa only [(· ∘ ·), hf_inv] using hf.continuous.inv⟩ section TopologicalGroup /-! ### Topological groups A topological group is a group in which the multiplication and inversion operations are continuous. Topological additive groups are defined in the same way. Equivalently, we can require that the division operation `x y ↦ x * y⁻¹` (resp., subtraction) is continuous. -/ -- Porting note (#11215): TODO should this docstring be extended -- to match the multiplicative version? /-- A topological (additive) group is a group in which the addition and negation operations are continuous. -/ class TopologicalAddGroup (G : Type u) [TopologicalSpace G] [AddGroup G] extends ContinuousAdd G, ContinuousNeg G : Prop /-- A topological group is a group in which the multiplication and inversion operations are continuous. When you declare an instance that does not already have a `UniformSpace` instance, you should also provide an instance of `UniformSpace` and `UniformGroup` using `TopologicalGroup.toUniformSpace` and `topologicalCommGroup_isUniform`. -/ -- Porting note: check that these ↑ names exist once they've been ported in the future. @[to_additive] class TopologicalGroup (G : Type*) [TopologicalSpace G] [Group G] extends ContinuousMul G, ContinuousInv G : Prop section Conj instance ConjAct.units_continuousConstSMul {M} [Monoid M] [TopologicalSpace M] [ContinuousMul M] : ContinuousConstSMul (ConjAct Mˣ) M := ⟨fun _ => (continuous_const.mul continuous_id).mul continuous_const⟩ variable [TopologicalSpace G] [Inv G] [Mul G] [ContinuousMul G] /-- Conjugation is jointly continuous on `G × G` when both `mul` and `inv` are continuous. -/ @[to_additive "Conjugation is jointly continuous on `G × G` when both `add` and `neg` are continuous."] theorem TopologicalGroup.continuous_conj_prod [ContinuousInv G] : Continuous fun g : G × G => g.fst * g.snd * g.fst⁻¹ := continuous_mul.mul (continuous_inv.comp continuous_fst) /-- Conjugation by a fixed element is continuous when `mul` is continuous. -/ @[to_additive (attr := continuity) "Conjugation by a fixed element is continuous when `add` is continuous."] theorem TopologicalGroup.continuous_conj (g : G) : Continuous fun h : G => g * h * g⁻¹ := (continuous_mul_right g⁻¹).comp (continuous_mul_left g) /-- Conjugation acting on fixed element of the group is continuous when both `mul` and `inv` are continuous. -/ @[to_additive (attr := continuity) "Conjugation acting on fixed element of the additive group is continuous when both `add` and `neg` are continuous."] theorem TopologicalGroup.continuous_conj' [ContinuousInv G] (h : G) : Continuous fun g : G => g * h * g⁻¹ := (continuous_mul_right h).mul continuous_inv end Conj variable [TopologicalSpace G] [Group G] [TopologicalGroup G] [TopologicalSpace α] {f : α → G} {s : Set α} {x : α} instance : TopologicalGroup (ULift G) where section ZPow @[to_additive (attr := continuity)] theorem continuous_zpow : ∀ z : ℤ, Continuous fun a : G => a ^ z | Int.ofNat n => by simpa using continuous_pow n | Int.negSucc n => by simpa using (continuous_pow (n + 1)).inv instance AddGroup.continuousConstSMul_int {A} [AddGroup A] [TopologicalSpace A] [TopologicalAddGroup A] : ContinuousConstSMul ℤ A := ⟨continuous_zsmul⟩ instance AddGroup.continuousSMul_int {A} [AddGroup A] [TopologicalSpace A] [TopologicalAddGroup A] : ContinuousSMul ℤ A := ⟨continuous_prod_of_discrete_left.mpr continuous_zsmul⟩ @[to_additive (attr := continuity, fun_prop)] theorem Continuous.zpow {f : α → G} (h : Continuous f) (z : ℤ) : Continuous fun b => f b ^ z := (continuous_zpow z).comp h @[to_additive] theorem continuousOn_zpow {s : Set G} (z : ℤ) : ContinuousOn (fun x => x ^ z) s := (continuous_zpow z).continuousOn @[to_additive] theorem continuousAt_zpow (x : G) (z : ℤ) : ContinuousAt (fun x => x ^ z) x := (continuous_zpow z).continuousAt @[to_additive] theorem Filter.Tendsto.zpow {α} {l : Filter α} {f : α → G} {x : G} (hf : Tendsto f l (𝓝 x)) (z : ℤ) : Tendsto (fun x => f x ^ z) l (𝓝 (x ^ z)) := (continuousAt_zpow _ _).tendsto.comp hf @[to_additive] theorem ContinuousWithinAt.zpow {f : α → G} {x : α} {s : Set α} (hf : ContinuousWithinAt f s x) (z : ℤ) : ContinuousWithinAt (fun x => f x ^ z) s x := Filter.Tendsto.zpow hf z @[to_additive (attr := fun_prop)] theorem ContinuousAt.zpow {f : α → G} {x : α} (hf : ContinuousAt f x) (z : ℤ) : ContinuousAt (fun x => f x ^ z) x := Filter.Tendsto.zpow hf z @[to_additive (attr := fun_prop)] theorem ContinuousOn.zpow {f : α → G} {s : Set α} (hf : ContinuousOn f s) (z : ℤ) : ContinuousOn (fun x => f x ^ z) s := fun x hx => (hf x hx).zpow z end ZPow section OrderedCommGroup variable [TopologicalSpace H] [OrderedCommGroup H] [ContinuousInv H] @[to_additive] theorem tendsto_inv_nhdsWithin_Ioi {a : H} : Tendsto Inv.inv (𝓝[>] a) (𝓝[<] a⁻¹) := (continuous_inv.tendsto a).inf <| by simp [tendsto_principal_principal] @[to_additive] theorem tendsto_inv_nhdsWithin_Iio {a : H} : Tendsto Inv.inv (𝓝[<] a) (𝓝[>] a⁻¹) := (continuous_inv.tendsto a).inf <| by simp [tendsto_principal_principal] @[to_additive] theorem tendsto_inv_nhdsWithin_Ioi_inv {a : H} : Tendsto Inv.inv (𝓝[>] a⁻¹) (𝓝[<] a) := by simpa only [inv_inv] using @tendsto_inv_nhdsWithin_Ioi _ _ _ _ a⁻¹ @[to_additive] theorem tendsto_inv_nhdsWithin_Iio_inv {a : H} : Tendsto Inv.inv (𝓝[<] a⁻¹) (𝓝[>] a) := by simpa only [inv_inv] using @tendsto_inv_nhdsWithin_Iio _ _ _ _ a⁻¹ @[to_additive] theorem tendsto_inv_nhdsWithin_Ici {a : H} : Tendsto Inv.inv (𝓝[≥] a) (𝓝[≤] a⁻¹) := (continuous_inv.tendsto a).inf <| by simp [tendsto_principal_principal] @[to_additive] theorem tendsto_inv_nhdsWithin_Iic {a : H} : Tendsto Inv.inv (𝓝[≤] a) (𝓝[≥] a⁻¹) := (continuous_inv.tendsto a).inf <| by simp [tendsto_principal_principal] @[to_additive] theorem tendsto_inv_nhdsWithin_Ici_inv {a : H} : Tendsto Inv.inv (𝓝[≥] a⁻¹) (𝓝[≤] a) := by simpa only [inv_inv] using @tendsto_inv_nhdsWithin_Ici _ _ _ _ a⁻¹ @[to_additive] theorem tendsto_inv_nhdsWithin_Iic_inv {a : H} : Tendsto Inv.inv (𝓝[≤] a⁻¹) (𝓝[≥] a) := by simpa only [inv_inv] using @tendsto_inv_nhdsWithin_Iic _ _ _ _ a⁻¹ end OrderedCommGroup @[to_additive] instance [TopologicalSpace H] [Group H] [TopologicalGroup H] : TopologicalGroup (G × H) where continuous_inv := continuous_inv.prod_map continuous_inv @[to_additive] instance Pi.topologicalGroup {C : β → Type*} [∀ b, TopologicalSpace (C b)] [∀ b, Group (C b)] [∀ b, TopologicalGroup (C b)] : TopologicalGroup (∀ b, C b) where continuous_inv := continuous_pi fun i => (continuous_apply i).inv open MulOpposite @[to_additive] instance [Inv α] [ContinuousInv α] : ContinuousInv αᵐᵒᵖ := opHomeomorph.symm.inducing.continuousInv unop_inv /-- If multiplication is continuous in `α`, then it also is in `αᵐᵒᵖ`. -/ @[to_additive "If addition is continuous in `α`, then it also is in `αᵃᵒᵖ`."] instance [Group α] [TopologicalGroup α] : TopologicalGroup αᵐᵒᵖ where variable (G) @[to_additive] theorem nhds_one_symm : comap Inv.inv (𝓝 (1 : G)) = 𝓝 (1 : G) := ((Homeomorph.inv G).comap_nhds_eq _).trans (congr_arg nhds inv_one) @[to_additive] theorem nhds_one_symm' : map Inv.inv (𝓝 (1 : G)) = 𝓝 (1 : G) := ((Homeomorph.inv G).map_nhds_eq _).trans (congr_arg nhds inv_one) @[to_additive] theorem inv_mem_nhds_one {S : Set G} (hS : S ∈ (𝓝 1 : Filter G)) : S⁻¹ ∈ 𝓝 (1 : G) := by rwa [← nhds_one_symm'] at hS /-- The map `(x, y) ↦ (x, x * y)` as a homeomorphism. This is a shear mapping. -/ @[to_additive "The map `(x, y) ↦ (x, x + y)` as a homeomorphism. This is a shear mapping."] protected def Homeomorph.shearMulRight : G × G ≃ₜ G × G := { Equiv.prodShear (Equiv.refl _) Equiv.mulLeft with continuous_toFun := continuous_fst.prod_mk continuous_mul continuous_invFun := continuous_fst.prod_mk <| continuous_fst.inv.mul continuous_snd } @[to_additive (attr := simp)] theorem Homeomorph.shearMulRight_coe : ⇑(Homeomorph.shearMulRight G) = fun z : G × G => (z.1, z.1 * z.2) := rfl @[to_additive (attr := simp)] theorem Homeomorph.shearMulRight_symm_coe : ⇑(Homeomorph.shearMulRight G).symm = fun z : G × G => (z.1, z.1⁻¹ * z.2) := rfl variable {G} @[to_additive] protected theorem Inducing.topologicalGroup {F : Type*} [Group H] [TopologicalSpace H] [FunLike F H G] [MonoidHomClass F H G] (f : F) (hf : Inducing f) : TopologicalGroup H := { toContinuousMul := hf.continuousMul _ toContinuousInv := hf.continuousInv (map_inv f) } @[to_additive] -- Porting note: removed `protected` (needs to be in namespace) theorem topologicalGroup_induced {F : Type*} [Group H] [FunLike F H G] [MonoidHomClass F H G] (f : F) : @TopologicalGroup H (induced f ‹_›) _ := letI := induced f ‹_› Inducing.topologicalGroup f ⟨rfl⟩ namespace Subgroup @[to_additive] instance (S : Subgroup G) : TopologicalGroup S := Inducing.topologicalGroup S.subtype inducing_subtype_val end Subgroup /-- The (topological-space) closure of a subgroup of a topological group is itself a subgroup. -/ @[to_additive "The (topological-space) closure of an additive subgroup of an additive topological group is itself an additive subgroup."] def Subgroup.topologicalClosure (s : Subgroup G) : Subgroup G := { s.toSubmonoid.topologicalClosure with carrier := _root_.closure (s : Set G) inv_mem' := fun {g} hg => by simpa only [← Set.mem_inv, inv_closure, inv_coe_set] using hg } @[to_additive (attr := simp)] theorem Subgroup.topologicalClosure_coe {s : Subgroup G} : (s.topologicalClosure : Set G) = _root_.closure s := rfl @[to_additive] theorem Subgroup.le_topologicalClosure (s : Subgroup G) : s ≤ s.topologicalClosure := _root_.subset_closure @[to_additive] theorem Subgroup.isClosed_topologicalClosure (s : Subgroup G) : IsClosed (s.topologicalClosure : Set G) := isClosed_closure @[to_additive] theorem Subgroup.topologicalClosure_minimal (s : Subgroup G) {t : Subgroup G} (h : s ≤ t) (ht : IsClosed (t : Set G)) : s.topologicalClosure ≤ t := closure_minimal h ht @[to_additive] theorem DenseRange.topologicalClosure_map_subgroup [Group H] [TopologicalSpace H] [TopologicalGroup H] {f : G →* H} (hf : Continuous f) (hf' : DenseRange f) {s : Subgroup G} (hs : s.topologicalClosure = ⊤) : (s.map f).topologicalClosure = ⊤ := by rw [SetLike.ext'_iff] at hs ⊢ simp only [Subgroup.topologicalClosure_coe, Subgroup.coe_top, ← dense_iff_closure_eq] at hs ⊢ exact hf'.dense_image hf hs /-- The topological closure of a normal subgroup is normal. -/ @[to_additive "The topological closure of a normal additive subgroup is normal."] theorem Subgroup.is_normal_topologicalClosure {G : Type*} [TopologicalSpace G] [Group G] [TopologicalGroup G] (N : Subgroup G) [N.Normal] : (Subgroup.topologicalClosure N).Normal where conj_mem n hn g := by apply map_mem_closure (TopologicalGroup.continuous_conj g) hn exact fun m hm => Subgroup.Normal.conj_mem inferInstance m hm g @[to_additive] theorem mul_mem_connectedComponent_one {G : Type*} [TopologicalSpace G] [MulOneClass G] [ContinuousMul G] {g h : G} (hg : g ∈ connectedComponent (1 : G)) (hh : h ∈ connectedComponent (1 : G)) : g * h ∈ connectedComponent (1 : G) := by rw [connectedComponent_eq hg] have hmul : g ∈ connectedComponent (g * h) := by apply Continuous.image_connectedComponent_subset (continuous_mul_left g) rw [← connectedComponent_eq hh] exact ⟨(1 : G), mem_connectedComponent, by simp only [mul_one]⟩ simpa [← connectedComponent_eq hmul] using mem_connectedComponent @[to_additive] theorem inv_mem_connectedComponent_one {G : Type*} [TopologicalSpace G] [Group G] [TopologicalGroup G] {g : G} (hg : g ∈ connectedComponent (1 : G)) : g⁻¹ ∈ connectedComponent (1 : G) := by rw [← inv_one] exact Continuous.image_connectedComponent_subset continuous_inv _ ((Set.mem_image _ _ _).mp ⟨g, hg, rfl⟩) /-- The connected component of 1 is a subgroup of `G`. -/ @[to_additive "The connected component of 0 is a subgroup of `G`."] def Subgroup.connectedComponentOfOne (G : Type*) [TopologicalSpace G] [Group G] [TopologicalGroup G] : Subgroup G where carrier := connectedComponent (1 : G) one_mem' := mem_connectedComponent mul_mem' hg hh := mul_mem_connectedComponent_one hg hh inv_mem' hg := inv_mem_connectedComponent_one hg /-- If a subgroup of a topological group is commutative, then so is its topological closure. -/ @[to_additive "If a subgroup of an additive topological group is commutative, then so is its topological closure."] def Subgroup.commGroupTopologicalClosure [T2Space G] (s : Subgroup G) (hs : ∀ x y : s, x * y = y * x) : CommGroup s.topologicalClosure := { s.topologicalClosure.toGroup, s.toSubmonoid.commMonoidTopologicalClosure hs with } variable (G) in @[to_additive] lemma Subgroup.coe_topologicalClosure_bot : ((⊥ : Subgroup G).topologicalClosure : Set G) = _root_.closure ({1} : Set G) := by simp @[to_additive exists_nhds_half_neg] theorem exists_nhds_split_inv {s : Set G} (hs : s ∈ 𝓝 (1 : G)) : ∃ V ∈ 𝓝 (1 : G), ∀ v ∈ V, ∀ w ∈ V, v / w ∈ s := by have : (fun p : G × G => p.1 * p.2⁻¹) ⁻¹' s ∈ 𝓝 ((1, 1) : G × G) := continuousAt_fst.mul continuousAt_snd.inv (by simpa) simpa only [div_eq_mul_inv, nhds_prod_eq, mem_prod_self_iff, prod_subset_iff, mem_preimage] using this @[to_additive] theorem nhds_translation_mul_inv (x : G) : comap (· * x⁻¹) (𝓝 1) = 𝓝 x := ((Homeomorph.mulRight x⁻¹).comap_nhds_eq 1).trans <| show 𝓝 (1 * x⁻¹⁻¹) = 𝓝 x by simp @[to_additive (attr := simp)] theorem map_mul_left_nhds (x y : G) : map (x * ·) (𝓝 y) = 𝓝 (x * y) := (Homeomorph.mulLeft x).map_nhds_eq y @[to_additive] theorem map_mul_left_nhds_one (x : G) : map (x * ·) (𝓝 1) = 𝓝 x := by simp @[to_additive (attr := simp)] theorem map_mul_right_nhds (x y : G) : map (· * x) (𝓝 y) = 𝓝 (y * x) := (Homeomorph.mulRight x).map_nhds_eq y @[to_additive] theorem map_mul_right_nhds_one (x : G) : map (· * x) (𝓝 1) = 𝓝 x := by simp @[to_additive] theorem Filter.HasBasis.nhds_of_one {ι : Sort*} {p : ι → Prop} {s : ι → Set G} (hb : HasBasis (𝓝 1 : Filter G) p s) (x : G) : HasBasis (𝓝 x) p fun i => { y | y / x ∈ s i } := by rw [← nhds_translation_mul_inv] simp_rw [div_eq_mul_inv] exact hb.comap _ @[to_additive] theorem mem_closure_iff_nhds_one {x : G} {s : Set G} : x ∈ closure s ↔ ∀ U ∈ (𝓝 1 : Filter G), ∃ y ∈ s, y / x ∈ U := by rw [mem_closure_iff_nhds_basis ((𝓝 1 : Filter G).basis_sets.nhds_of_one x)] simp_rw [Set.mem_setOf, id] /-- A monoid homomorphism (a bundled morphism of a type that implements `MonoidHomClass`) from a topological group to a topological monoid is continuous provided that it is continuous at one. See also `uniformContinuous_of_continuousAt_one`. -/ @[to_additive "An additive monoid homomorphism (a bundled morphism of a type that implements `AddMonoidHomClass`) from an additive topological group to an additive topological monoid is continuous provided that it is continuous at zero. See also `uniformContinuous_of_continuousAt_zero`."] theorem continuous_of_continuousAt_one {M hom : Type*} [MulOneClass M] [TopologicalSpace M] [ContinuousMul M] [FunLike hom G M] [MonoidHomClass hom G M] (f : hom) (hf : ContinuousAt f 1) : Continuous f := continuous_iff_continuousAt.2 fun x => by simpa only [ContinuousAt, ← map_mul_left_nhds_one x, tendsto_map'_iff, (· ∘ ·), map_mul, map_one, mul_one] using hf.tendsto.const_mul (f x) @[to_additive continuous_of_continuousAt_zero₂] theorem continuous_of_continuousAt_one₂ {H M : Type*} [CommMonoid M] [TopologicalSpace M] [ContinuousMul M] [Group H] [TopologicalSpace H] [TopologicalGroup H] (f : G →* H →* M) (hf : ContinuousAt (fun x : G × H ↦ f x.1 x.2) (1, 1)) (hl : ∀ x, ContinuousAt (f x) 1) (hr : ∀ y, ContinuousAt (f · y) 1) : Continuous (fun x : G × H ↦ f x.1 x.2) := continuous_iff_continuousAt.2 fun (x, y) => by simp only [ContinuousAt, nhds_prod_eq, ← map_mul_left_nhds_one x, ← map_mul_left_nhds_one y, prod_map_map_eq, tendsto_map'_iff, (· ∘ ·), map_mul, MonoidHom.mul_apply] at * refine ((tendsto_const_nhds.mul ((hr y).comp tendsto_fst)).mul (((hl x).comp tendsto_snd).mul hf)).mono_right (le_of_eq ?_) simp only [map_one, mul_one, MonoidHom.one_apply] @[to_additive] theorem TopologicalGroup.ext {G : Type*} [Group G] {t t' : TopologicalSpace G} (tg : @TopologicalGroup G t _) (tg' : @TopologicalGroup G t' _) (h : @nhds G t 1 = @nhds G t' 1) : t = t' := TopologicalSpace.ext_nhds fun x ↦ by rw [← @nhds_translation_mul_inv G t _ _ x, ← @nhds_translation_mul_inv G t' _ _ x, ← h] @[to_additive] theorem TopologicalGroup.ext_iff {G : Type*} [Group G] {t t' : TopologicalSpace G} (tg : @TopologicalGroup G t _) (tg' : @TopologicalGroup G t' _) : t = t' ↔ @nhds G t 1 = @nhds G t' 1 := ⟨fun h => h ▸ rfl, tg.ext tg'⟩ @[to_additive] theorem ContinuousInv.of_nhds_one {G : Type*} [Group G] [TopologicalSpace G] (hinv : Tendsto (fun x : G => x⁻¹) (𝓝 1) (𝓝 1)) (hleft : ∀ x₀ : G, 𝓝 x₀ = map (fun x : G => x₀ * x) (𝓝 1)) (hconj : ∀ x₀ : G, Tendsto (fun x : G => x₀ * x * x₀⁻¹) (𝓝 1) (𝓝 1)) : ContinuousInv G := by refine ⟨continuous_iff_continuousAt.2 fun x₀ => ?_⟩ have : Tendsto (fun x => x₀⁻¹ * (x₀ * x⁻¹ * x₀⁻¹)) (𝓝 1) (map (x₀⁻¹ * ·) (𝓝 1)) := (tendsto_map.comp <| hconj x₀).comp hinv simpa only [ContinuousAt, hleft x₀, hleft x₀⁻¹, tendsto_map'_iff, (· ∘ ·), mul_assoc, mul_inv_rev, inv_mul_cancel_left] using this @[to_additive] theorem TopologicalGroup.of_nhds_one' {G : Type u} [Group G] [TopologicalSpace G] (hmul : Tendsto (uncurry ((· * ·) : G → G → G)) (𝓝 1 ×ˢ 𝓝 1) (𝓝 1)) (hinv : Tendsto (fun x : G => x⁻¹) (𝓝 1) (𝓝 1)) (hleft : ∀ x₀ : G, 𝓝 x₀ = map (fun x => x₀ * x) (𝓝 1)) (hright : ∀ x₀ : G, 𝓝 x₀ = map (fun x => x * x₀) (𝓝 1)) : TopologicalGroup G := { toContinuousMul := ContinuousMul.of_nhds_one hmul hleft hright toContinuousInv := ContinuousInv.of_nhds_one hinv hleft fun x₀ => le_of_eq (by rw [show (fun x => x₀ * x * x₀⁻¹) = (fun x => x * x₀⁻¹) ∘ fun x => x₀ * x from rfl, ← map_map, ← hleft, hright, map_map] simp [(· ∘ ·)]) } @[to_additive] theorem TopologicalGroup.of_nhds_one {G : Type u} [Group G] [TopologicalSpace G] (hmul : Tendsto (uncurry ((· * ·) : G → G → G)) (𝓝 1 ×ˢ 𝓝 1) (𝓝 1)) (hinv : Tendsto (fun x : G => x⁻¹) (𝓝 1) (𝓝 1)) (hleft : ∀ x₀ : G, 𝓝 x₀ = map (x₀ * ·) (𝓝 1)) (hconj : ∀ x₀ : G, Tendsto (x₀ * · * x₀⁻¹) (𝓝 1) (𝓝 1)) : TopologicalGroup G := by refine TopologicalGroup.of_nhds_one' hmul hinv hleft fun x₀ => ?_ replace hconj : ∀ x₀ : G, map (x₀ * · * x₀⁻¹) (𝓝 1) = 𝓝 1 := fun x₀ => map_eq_of_inverse (x₀⁻¹ * · * x₀⁻¹⁻¹) (by ext; simp [mul_assoc]) (hconj _) (hconj _) rw [← hconj x₀] simpa [(· ∘ ·)] using hleft _ @[to_additive] theorem TopologicalGroup.of_comm_of_nhds_one {G : Type u} [CommGroup G] [TopologicalSpace G] (hmul : Tendsto (uncurry ((· * ·) : G → G → G)) (𝓝 1 ×ˢ 𝓝 1) (𝓝 1)) (hinv : Tendsto (fun x : G => x⁻¹) (𝓝 1) (𝓝 1)) (hleft : ∀ x₀ : G, 𝓝 x₀ = map (x₀ * ·) (𝓝 1)) : TopologicalGroup G := TopologicalGroup.of_nhds_one hmul hinv hleft (by simpa using tendsto_id) end TopologicalGroup section QuotientTopologicalGroup variable [TopologicalSpace G] [Group G] [TopologicalGroup G] (N : Subgroup G) (n : N.Normal) @[to_additive] instance QuotientGroup.Quotient.topologicalSpace {G : Type*} [Group G] [TopologicalSpace G] (N : Subgroup G) : TopologicalSpace (G ⧸ N) := instTopologicalSpaceQuotient open QuotientGroup @[to_additive] theorem QuotientGroup.isOpenMap_coe : IsOpenMap ((↑) : G → G ⧸ N) := by intro s s_op change IsOpen (((↑) : G → G ⧸ N) ⁻¹' ((↑) '' s)) rw [QuotientGroup.preimage_image_mk N s] exact isOpen_iUnion fun n => (continuous_mul_right _).isOpen_preimage s s_op @[to_additive] instance topologicalGroup_quotient [N.Normal] : TopologicalGroup (G ⧸ N) where continuous_mul := by have cont : Continuous (((↑) : G → G ⧸ N) ∘ fun p : G × G ↦ p.fst * p.snd) := continuous_quot_mk.comp continuous_mul have quot : QuotientMap fun p : G × G ↦ ((p.1 : G ⧸ N), (p.2 : G ⧸ N)) := by apply IsOpenMap.to_quotientMap · exact (QuotientGroup.isOpenMap_coe N).prod (QuotientGroup.isOpenMap_coe N) · exact continuous_quot_mk.prod_map continuous_quot_mk · exact (surjective_quot_mk _).prodMap (surjective_quot_mk _) exact quot.continuous_iff.2 cont continuous_inv := by have quot := IsOpenMap.to_quotientMap (QuotientGroup.isOpenMap_coe N) continuous_quot_mk (surjective_quot_mk _) rw [quot.continuous_iff] exact continuous_quot_mk.comp continuous_inv /-- Neighborhoods in the quotient are precisely the map of neighborhoods in the prequotient. -/ @[to_additive "Neighborhoods in the quotient are precisely the map of neighborhoods in the prequotient."] theorem QuotientGroup.nhds_eq (x : G) : 𝓝 (x : G ⧸ N) = Filter.map (↑) (𝓝 x) := le_antisymm ((QuotientGroup.isOpenMap_coe N).nhds_le x) continuous_quot_mk.continuousAt variable (G) variable [FirstCountableTopology G] /-- Any first countable topological group has an antitone neighborhood basis `u : ℕ → Set G` for which `(u (n + 1)) ^ 2 ⊆ u n`. The existence of such a neighborhood basis is a key tool for `QuotientGroup.completeSpace` -/ @[to_additive "Any first countable topological additive group has an antitone neighborhood basis `u : ℕ → set G` for which `u (n + 1) + u (n + 1) ⊆ u n`. The existence of such a neighborhood basis is a key tool for `QuotientAddGroup.completeSpace`"] theorem TopologicalGroup.exists_antitone_basis_nhds_one : ∃ u : ℕ → Set G, (𝓝 1).HasAntitoneBasis u ∧ ∀ n, u (n + 1) * u (n + 1) ⊆ u n := by rcases (𝓝 (1 : G)).exists_antitone_basis with ⟨u, hu, u_anti⟩ have := ((hu.prod_nhds hu).tendsto_iff hu).mp (by simpa only [mul_one] using continuous_mul.tendsto ((1, 1) : G × G)) simp only [and_self_iff, mem_prod, and_imp, Prod.forall, exists_true_left, Prod.exists, forall_true_left] at this have event_mul : ∀ n : ℕ, ∀ᶠ m in atTop, u m * u m ⊆ u n := by intro n rcases this n with ⟨j, k, -, h⟩ refine atTop_basis.eventually_iff.mpr ⟨max j k, True.intro, fun m hm => ?_⟩ rintro - ⟨a, ha, b, hb, rfl⟩ exact h a b (u_anti ((le_max_left _ _).trans hm) ha) (u_anti ((le_max_right _ _).trans hm) hb) obtain ⟨φ, -, hφ, φ_anti_basis⟩ := HasAntitoneBasis.subbasis_with_rel ⟨hu, u_anti⟩ event_mul exact ⟨u ∘ φ, φ_anti_basis, fun n => hφ n.lt_succ_self⟩ /-- In a first countable topological group `G` with normal subgroup `N`, `1 : G ⧸ N` has a countable neighborhood basis. -/ @[to_additive "In a first countable topological additive group `G` with normal additive subgroup `N`, `0 : G ⧸ N` has a countable neighborhood basis."] instance QuotientGroup.nhds_one_isCountablyGenerated : (𝓝 (1 : G ⧸ N)).IsCountablyGenerated := (QuotientGroup.nhds_eq N 1).symm ▸ map.isCountablyGenerated _ _ end QuotientTopologicalGroup /-- A typeclass saying that `p : G × G ↦ p.1 - p.2` is a continuous function. This property automatically holds for topological additive groups but it also holds, e.g., for `ℝ≥0`. -/ class ContinuousSub (G : Type*) [TopologicalSpace G] [Sub G] : Prop where continuous_sub : Continuous fun p : G × G => p.1 - p.2 /-- A typeclass saying that `p : G × G ↦ p.1 / p.2` is a continuous function. This property automatically holds for topological groups. Lemmas using this class have primes. The unprimed version is for `GroupWithZero`. -/ @[to_additive existing] class ContinuousDiv (G : Type*) [TopologicalSpace G] [Div G] : Prop where continuous_div' : Continuous fun p : G × G => p.1 / p.2 -- see Note [lower instance priority] @[to_additive] instance (priority := 100) TopologicalGroup.to_continuousDiv [TopologicalSpace G] [Group G] [TopologicalGroup G] : ContinuousDiv G := ⟨by simp only [div_eq_mul_inv] exact continuous_fst.mul continuous_snd.inv⟩ export ContinuousSub (continuous_sub) export ContinuousDiv (continuous_div') section ContinuousDiv variable [TopologicalSpace G] [Div G] [ContinuousDiv G] @[to_additive sub] theorem Filter.Tendsto.div' {f g : α → G} {l : Filter α} {a b : G} (hf : Tendsto f l (𝓝 a)) (hg : Tendsto g l (𝓝 b)) : Tendsto (fun x => f x / g x) l (𝓝 (a / b)) := (continuous_div'.tendsto (a, b)).comp (hf.prod_mk_nhds hg) @[to_additive const_sub] theorem Filter.Tendsto.const_div' (b : G) {c : G} {f : α → G} {l : Filter α} (h : Tendsto f l (𝓝 c)) : Tendsto (fun k : α => b / f k) l (𝓝 (b / c)) := tendsto_const_nhds.div' h @[to_additive] lemma Filter.tendsto_const_div_iff {G : Type*} [CommGroup G] [TopologicalSpace G] [ContinuousDiv G] (b : G) {c : G} {f : α → G} {l : Filter α} : Tendsto (fun k : α ↦ b / f k) l (𝓝 (b / c)) ↔ Tendsto f l (𝓝 c) := by refine ⟨fun h ↦ ?_, Filter.Tendsto.const_div' b⟩ convert h.const_div' b with k <;> rw [div_div_cancel] @[to_additive sub_const] theorem Filter.Tendsto.div_const' {c : G} {f : α → G} {l : Filter α} (h : Tendsto f l (𝓝 c)) (b : G) : Tendsto (f · / b) l (𝓝 (c / b)) := h.div' tendsto_const_nhds lemma Filter.tendsto_div_const_iff {G : Type*} [CommGroupWithZero G] [TopologicalSpace G] [ContinuousDiv G] {b : G} (hb : b ≠ 0) {c : G} {f : α → G} {l : Filter α} : Tendsto (f · / b) l (𝓝 (c / b)) ↔ Tendsto f l (𝓝 c) := by refine ⟨fun h ↦ ?_, fun h ↦ Filter.Tendsto.div_const' h b⟩ convert h.div_const' b⁻¹ with k <;> rw [div_div, mul_inv_cancel hb, div_one] lemma Filter.tendsto_sub_const_iff {G : Type*} [AddCommGroup G] [TopologicalSpace G] [ContinuousSub G] (b : G) {c : G} {f : α → G} {l : Filter α} : Tendsto (f · - b) l (𝓝 (c - b)) ↔ Tendsto f l (𝓝 c) := by refine ⟨fun h ↦ ?_, fun h ↦ Filter.Tendsto.sub_const h b⟩ convert h.sub_const (-b) with k <;> rw [sub_sub, ← sub_eq_add_neg, sub_self, sub_zero] variable [TopologicalSpace α] {f g : α → G} {s : Set α} {x : α} @[to_additive (attr := continuity, fun_prop) sub] theorem Continuous.div' (hf : Continuous f) (hg : Continuous g) : Continuous fun x => f x / g x := continuous_div'.comp (hf.prod_mk hg : _) @[to_additive (attr := continuity) continuous_sub_left] lemma continuous_div_left' (a : G) : Continuous (a / ·) := continuous_const.div' continuous_id @[to_additive (attr := continuity) continuous_sub_right] lemma continuous_div_right' (a : G) : Continuous (· / a) := continuous_id.div' continuous_const @[to_additive (attr := fun_prop) sub] theorem ContinuousAt.div' {f g : α → G} {x : α} (hf : ContinuousAt f x) (hg : ContinuousAt g x) : ContinuousAt (fun x => f x / g x) x := Filter.Tendsto.div' hf hg @[to_additive sub] theorem ContinuousWithinAt.div' (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) : ContinuousWithinAt (fun x => f x / g x) s x := Filter.Tendsto.div' hf hg @[to_additive (attr := fun_prop) sub] theorem ContinuousOn.div' (hf : ContinuousOn f s) (hg : ContinuousOn g s) : ContinuousOn (fun x => f x / g x) s := fun x hx => (hf x hx).div' (hg x hx) end ContinuousDiv section DivInvTopologicalGroup variable [Group G] [TopologicalSpace G] [TopologicalGroup G] /-- A version of `Homeomorph.mulLeft a b⁻¹` that is defeq to `a / b`. -/ @[to_additive (attr := simps! (config := { simpRhs := true })) " A version of `Homeomorph.addLeft a (-b)` that is defeq to `a - b`. "] def Homeomorph.divLeft (x : G) : G ≃ₜ G := { Equiv.divLeft x with continuous_toFun := continuous_const.div' continuous_id continuous_invFun := continuous_inv.mul continuous_const } @[to_additive] theorem isOpenMap_div_left (a : G) : IsOpenMap (a / ·) := (Homeomorph.divLeft _).isOpenMap @[to_additive] theorem isClosedMap_div_left (a : G) : IsClosedMap (a / ·) := (Homeomorph.divLeft _).isClosedMap /-- A version of `Homeomorph.mulRight a⁻¹ b` that is defeq to `b / a`. -/ @[to_additive (attr := simps! (config := { simpRhs := true })) "A version of `Homeomorph.addRight (-a) b` that is defeq to `b - a`. "] def Homeomorph.divRight (x : G) : G ≃ₜ G := { Equiv.divRight x with continuous_toFun := continuous_id.div' continuous_const continuous_invFun := continuous_id.mul continuous_const } @[to_additive] lemma isOpenMap_div_right (a : G) : IsOpenMap (· / a) := (Homeomorph.divRight a).isOpenMap @[to_additive] lemma isClosedMap_div_right (a : G) : IsClosedMap (· / a) := (Homeomorph.divRight a).isClosedMap @[to_additive] theorem tendsto_div_nhds_one_iff {α : Type*} {l : Filter α} {x : G} {u : α → G} : Tendsto (u · / x) l (𝓝 1) ↔ Tendsto u l (𝓝 x) := haveI A : Tendsto (fun _ : α => x) l (𝓝 x) := tendsto_const_nhds ⟨fun h => by simpa using h.mul A, fun h => by simpa using h.div' A⟩ @[to_additive] theorem nhds_translation_div (x : G) : comap (· / x) (𝓝 1) = 𝓝 x := by simpa only [div_eq_mul_inv] using nhds_translation_mul_inv x end DivInvTopologicalGroup /-! ### Topological operations on pointwise sums and products A few results about interior and closure of the pointwise addition/multiplication of sets in groups with continuous addition/multiplication. See also `Submonoid.top_closure_mul_self_eq` in `Topology.Algebra.Monoid`. -/ section ContinuousConstSMul variable [TopologicalSpace β] [Group α] [MulAction α β] [ContinuousConstSMul α β] {s : Set α} {t : Set β} @[to_additive] theorem IsOpen.smul_left (ht : IsOpen t) : IsOpen (s • t) := by rw [← iUnion_smul_set] exact isOpen_biUnion fun a _ => ht.smul _ @[to_additive] theorem subset_interior_smul_right : s • interior t ⊆ interior (s • t) := interior_maximal (Set.smul_subset_smul_left interior_subset) isOpen_interior.smul_left @[to_additive] theorem smul_mem_nhds (a : α) {x : β} (ht : t ∈ 𝓝 x) : a • t ∈ 𝓝 (a • x) := by rcases mem_nhds_iff.1 ht with ⟨u, ut, u_open, hu⟩ exact mem_nhds_iff.2 ⟨a • u, smul_set_mono ut, u_open.smul a, smul_mem_smul_set hu⟩ variable [TopologicalSpace α] @[to_additive] theorem subset_interior_smul : interior s • interior t ⊆ interior (s • t) := (Set.smul_subset_smul_right interior_subset).trans subset_interior_smul_right end ContinuousConstSMul section ContinuousSMul variable [TopologicalSpace α] [TopologicalSpace β] [Group α] [MulAction α β] [ContinuousInv α] [ContinuousSMul α β] {s : Set α} {t : Set β} @[to_additive] theorem IsClosed.smul_left_of_isCompact (ht : IsClosed t) (hs : IsCompact s) : IsClosed (s • t) := by have : ∀ x ∈ s • t, ∃ g ∈ s, g⁻¹ • x ∈ t := by rintro x ⟨g, hgs, y, hyt, rfl⟩ refine ⟨g, hgs, ?_⟩ rwa [inv_smul_smul] choose! f hf using this refine isClosed_of_closure_subset (fun x hx ↦ ?_) rcases mem_closure_iff_ultrafilter.mp hx with ⟨u, hust, hux⟩ have : Ultrafilter.map f u ≤ 𝓟 s := calc Ultrafilter.map f u ≤ map f (𝓟 (s • t)) := map_mono (le_principal_iff.mpr hust) _ = 𝓟 (f '' (s • t)) := map_principal _ ≤ 𝓟 s := principal_mono.mpr (image_subset_iff.mpr (fun x hx ↦ (hf x hx).1)) rcases hs.ultrafilter_le_nhds (Ultrafilter.map f u) this with ⟨g, hg, hug⟩ suffices g⁻¹ • x ∈ t from ⟨g, hg, g⁻¹ • x, this, smul_inv_smul _ _⟩ exact ht.mem_of_tendsto ((Tendsto.inv hug).smul hux) (Eventually.mono hust (fun y hy ↦ (hf y hy).2)) /-! One may expect a version of `IsClosed.smul_left_of_isCompact` where `t` is compact and `s` is closed, but such a lemma can't be true in this level of generality. For a counterexample, consider `ℚ` acting on `ℝ` by translation, and let `s : Set ℚ := univ`, `t : set ℝ := {0}`. Then `s` is closed and `t` is compact, but `s +ᵥ t` is the set of all rationals, which is definitely not closed in `ℝ`. To fix the proof, we would need to make two additional assumptions: - for any `x ∈ t`, `s • {x}` is closed - for any `x ∈ t`, there is a continuous function `g : s • {x} → s` such that, for all `y ∈ s • {x}`, we have `y = (g y) • x` These are fairly specific hypotheses so we don't state this version of the lemmas, but an interesting fact is that these two assumptions are verified in the case of a `NormedAddTorsor` (or really, any `AddTorsor` with continuous `-ᵥ`). We prove this special case in `IsClosed.vadd_right_of_isCompact`. -/ @[to_additive] theorem MulAction.isClosedMap_quotient [CompactSpace α] : letI := orbitRel α β IsClosedMap (Quotient.mk' : β → Quotient (orbitRel α β)) := by intro t ht rw [← quotientMap_quotient_mk'.isClosed_preimage, MulAction.quotient_preimage_image_eq_union_mul] convert ht.smul_left_of_isCompact (isCompact_univ (X := α)) rw [← biUnion_univ, ← iUnion_smul_left_image] rfl end ContinuousSMul section ContinuousConstSMul variable [TopologicalSpace α] [Group α] [ContinuousConstSMul α α] {s t : Set α} @[to_additive] theorem IsOpen.mul_left : IsOpen t → IsOpen (s * t) := IsOpen.smul_left @[to_additive] theorem subset_interior_mul_right : s * interior t ⊆ interior (s * t) := subset_interior_smul_right @[to_additive] theorem subset_interior_mul : interior s * interior t ⊆ interior (s * t) := subset_interior_smul @[to_additive] theorem singleton_mul_mem_nhds (a : α) {b : α} (h : s ∈ 𝓝 b) : {a} * s ∈ 𝓝 (a * b) := by have := smul_mem_nhds a h rwa [← singleton_smul] at this @[to_additive] theorem singleton_mul_mem_nhds_of_nhds_one (a : α) (h : s ∈ 𝓝 (1 : α)) : {a} * s ∈ 𝓝 a := by simpa only [mul_one] using singleton_mul_mem_nhds a h end ContinuousConstSMul section ContinuousConstSMulOp variable [TopologicalSpace α] [Group α] [ContinuousConstSMul αᵐᵒᵖ α] {s t : Set α} @[to_additive] theorem IsOpen.mul_right (hs : IsOpen s) : IsOpen (s * t) := by rw [← iUnion_op_smul_set] exact isOpen_biUnion fun a _ => hs.smul _ @[to_additive] theorem subset_interior_mul_left : interior s * t ⊆ interior (s * t) := interior_maximal (Set.mul_subset_mul_right interior_subset) isOpen_interior.mul_right @[to_additive] theorem subset_interior_mul' : interior s * interior t ⊆ interior (s * t) := (Set.mul_subset_mul_left interior_subset).trans subset_interior_mul_left @[to_additive] theorem mul_singleton_mem_nhds (a : α) {b : α} (h : s ∈ 𝓝 b) : s * {a} ∈ 𝓝 (b * a) := by simp only [← iUnion_op_smul_set, mem_singleton_iff, iUnion_iUnion_eq_left] exact smul_mem_nhds _ h @[to_additive] theorem mul_singleton_mem_nhds_of_nhds_one (a : α) (h : s ∈ 𝓝 (1 : α)) : s * {a} ∈ 𝓝 a := by simpa only [one_mul] using mul_singleton_mem_nhds a h end ContinuousConstSMulOp section TopologicalGroup variable [TopologicalSpace G] [Group G] [TopologicalGroup G] {s t : Set G} @[to_additive] theorem IsOpen.div_left (ht : IsOpen t) : IsOpen (s / t) := by rw [← iUnion_div_left_image] exact isOpen_biUnion fun a _ => isOpenMap_div_left a t ht @[to_additive] theorem IsOpen.div_right (hs : IsOpen s) : IsOpen (s / t) := by rw [← iUnion_div_right_image] exact isOpen_biUnion fun a _ => isOpenMap_div_right a s hs @[to_additive] theorem subset_interior_div_left : interior s / t ⊆ interior (s / t) := interior_maximal (div_subset_div_right interior_subset) isOpen_interior.div_right @[to_additive] theorem subset_interior_div_right : s / interior t ⊆ interior (s / t) := interior_maximal (div_subset_div_left interior_subset) isOpen_interior.div_left @[to_additive] theorem subset_interior_div : interior s / interior t ⊆ interior (s / t) := (div_subset_div_left interior_subset).trans subset_interior_div_left @[to_additive] theorem IsOpen.mul_closure (hs : IsOpen s) (t : Set G) : s * closure t = s * t := by refine (mul_subset_iff.2 fun a ha b hb => ?_).antisymm (mul_subset_mul_left subset_closure) rw [mem_closure_iff] at hb have hbU : b ∈ s⁻¹ * {a * b} := ⟨a⁻¹, Set.inv_mem_inv.2 ha, a * b, rfl, inv_mul_cancel_left _ _⟩ obtain ⟨_, ⟨c, hc, d, rfl : d = _, rfl⟩, hcs⟩ := hb _ hs.inv.mul_right hbU exact ⟨c⁻¹, hc, _, hcs, inv_mul_cancel_left _ _⟩ @[to_additive] theorem IsOpen.closure_mul (ht : IsOpen t) (s : Set G) : closure s * t = s * t := by rw [← inv_inv (closure s * t), mul_inv_rev, inv_closure, ht.inv.mul_closure, mul_inv_rev, inv_inv, inv_inv] @[to_additive] theorem IsOpen.div_closure (hs : IsOpen s) (t : Set G) : s / closure t = s / t := by simp_rw [div_eq_mul_inv, inv_closure, hs.mul_closure] @[to_additive] theorem IsOpen.closure_div (ht : IsOpen t) (s : Set G) : closure s / t = s / t := by simp_rw [div_eq_mul_inv, ht.inv.closure_mul] @[to_additive] theorem IsClosed.mul_left_of_isCompact (ht : IsClosed t) (hs : IsCompact s) : IsClosed (s * t) := ht.smul_left_of_isCompact hs @[to_additive] theorem IsClosed.mul_right_of_isCompact (ht : IsClosed t) (hs : IsCompact s) : IsClosed (t * s) := by rw [← image_op_smul] exact IsClosed.smul_left_of_isCompact ht (hs.image continuous_op) @[to_additive] theorem QuotientGroup.isClosedMap_coe {H : Subgroup G} (hH : IsCompact (H : Set G)) : IsClosedMap ((↑) : G → G ⧸ H) := by intro t ht rw [← quotientMap_quotient_mk'.isClosed_preimage] convert ht.mul_right_of_isCompact hH refine (QuotientGroup.preimage_image_mk_eq_iUnion_image _ _).trans ?_ rw [iUnion_subtype, ← iUnion_mul_right_image] rfl @[to_additive] lemma subset_mul_closure_one {G} [MulOneClass G] [TopologicalSpace G] (s : Set G) : s ⊆ s * (closure {1} : Set G) := by have : s ⊆ s * ({1} : Set G) := by simp exact this.trans (smul_subset_smul_left subset_closure) @[to_additive] lemma IsCompact.mul_closure_one_eq_closure {K : Set G} (hK : IsCompact K) : K * (closure {1} : Set G) = closure K := by apply Subset.antisymm ?_ ?_ · calc K * (closure {1} : Set G) ⊆ closure K * (closure {1} : Set G) := smul_subset_smul_right subset_closure _ ⊆ closure (K * ({1} : Set G)) := smul_set_closure_subset _ _ _ = closure K := by simp · have : IsClosed (K * (closure {1} : Set G)) := IsClosed.smul_left_of_isCompact isClosed_closure hK rw [IsClosed.closure_subset_iff this] exact subset_mul_closure_one K @[to_additive] lemma IsClosed.mul_closure_one_eq {F : Set G} (hF : IsClosed F) : F * (closure {1} : Set G) = F := by refine Subset.antisymm ?_ (subset_mul_closure_one F) calc F * (closure {1} : Set G) = closure F * closure ({1} : Set G) := by rw [hF.closure_eq] _ ⊆ closure (F * ({1} : Set G)) := smul_set_closure_subset _ _ _ = F := by simp [hF.closure_eq] @[to_additive] lemma compl_mul_closure_one_eq {t : Set G} (ht : t * (closure {1} : Set G) = t) : tᶜ * (closure {1} : Set G) = tᶜ := by refine Subset.antisymm ?_ (subset_mul_closure_one tᶜ) rintro - ⟨x, hx, g, hg, rfl⟩ by_contra H have : x ∈ t * (closure {1} : Set G) := by rw [← Subgroup.coe_topologicalClosure_bot G] at hg ⊢ simp only [smul_eq_mul, mem_compl_iff, not_not] at H exact ⟨x * g, H, g⁻¹, Subgroup.inv_mem _ hg, by simp⟩ rw [ht] at this exact hx this @[to_additive] lemma compl_mul_closure_one_eq_iff {t : Set G} : tᶜ * (closure {1} : Set G) = tᶜ ↔ t * (closure {1} : Set G) = t := ⟨fun h ↦ by simpa using compl_mul_closure_one_eq h, fun h ↦ compl_mul_closure_one_eq h⟩ @[to_additive] lemma IsOpen.mul_closure_one_eq {U : Set G} (hU : IsOpen U) : U * (closure {1} : Set G) = U := compl_mul_closure_one_eq_iff.1 (hU.isClosed_compl.mul_closure_one_eq) end TopologicalGroup section FilterMul section variable (G) [TopologicalSpace G] [Group G] [ContinuousMul G] @[to_additive] theorem TopologicalGroup.t1Space (h : @IsClosed G _ {1}) : T1Space G := ⟨fun x => by simpa using isClosedMap_mul_right x _ h⟩ end section variable (G) [TopologicalSpace G] [Group G] [TopologicalGroup G] @[to_additive] instance (priority := 100) TopologicalGroup.regularSpace : RegularSpace G := by refine .of_exists_mem_nhds_isClosed_subset fun a s hs ↦ ?_ have : Tendsto (fun p : G × G => p.1 * p.2) (𝓝 (a, 1)) (𝓝 a) := continuous_mul.tendsto' _ _ (mul_one a) rcases mem_nhds_prod_iff.mp (this hs) with ⟨U, hU, V, hV, hUV⟩ rw [← image_subset_iff, image_prod] at hUV refine ⟨closure U, mem_of_superset hU subset_closure, isClosed_closure, ?_⟩ calc closure U ⊆ closure U * interior V := subset_mul_left _ (mem_interior_iff_mem_nhds.2 hV) _ = U * interior V := isOpen_interior.closure_mul U _ ⊆ U * V := mul_subset_mul_left interior_subset _ ⊆ s := hUV -- `inferInstance` can find these instances now variable {G} @[to_additive] theorem group_inseparable_iff {x y : G} : Inseparable x y ↔ x / y ∈ closure (1 : Set G) := by rw [← singleton_one, ← specializes_iff_mem_closure, specializes_comm, specializes_iff_inseparable, ← (Homeomorph.mulRight y⁻¹).embedding.inseparable_iff] simp [div_eq_mul_inv] @[to_additive] theorem TopologicalGroup.t2Space_iff_one_closed : T2Space G ↔ IsClosed ({1} : Set G) := ⟨fun _ ↦ isClosed_singleton, fun h ↦ have := TopologicalGroup.t1Space G h; inferInstance⟩ @[to_additive] theorem TopologicalGroup.t2Space_of_one_sep (H : ∀ x : G, x ≠ 1 → ∃ U ∈ 𝓝 (1 : G), x ∉ U) : T2Space G := by suffices T1Space G from inferInstance refine t1Space_iff_specializes_imp_eq.2 fun x y hspec ↦ by_contra fun hne ↦ ?_ rcases H (x * y⁻¹) (by rwa [Ne, mul_inv_eq_one]) with ⟨U, hU₁, hU⟩ exact hU <| mem_of_mem_nhds <| hspec.map (continuous_mul_right y⁻¹) (by rwa [mul_inv_self]) /-- Given a neighborhood `U` of the identity, one may find a neighborhood `V` of the identity which is closed, symmetric, and satisfies `V * V ⊆ U`. -/ @[to_additive "Given a neighborhood `U` of the identity, one may find a neighborhood `V` of the identity which is closed, symmetric, and satisfies `V + V ⊆ U`."] theorem exists_closed_nhds_one_inv_eq_mul_subset {U : Set G} (hU : U ∈ 𝓝 1) : ∃ V ∈ 𝓝 1, IsClosed V ∧ V⁻¹ = V ∧ V * V ⊆ U := by rcases exists_open_nhds_one_mul_subset hU with ⟨V, V_open, V_mem, hV⟩ rcases exists_mem_nhds_isClosed_subset (V_open.mem_nhds V_mem) with ⟨W, W_mem, W_closed, hW⟩ refine ⟨W ∩ W⁻¹, Filter.inter_mem W_mem (inv_mem_nhds_one G W_mem), W_closed.inter W_closed.inv, by simp [inter_comm], ?_⟩ calc W ∩ W⁻¹ * (W ∩ W⁻¹) ⊆ W * W := mul_subset_mul inter_subset_left inter_subset_left _ ⊆ V * V := mul_subset_mul hW hW _ ⊆ U := hV variable (S : Subgroup G) [Subgroup.Normal S] [IsClosed (S : Set G)] @[to_additive] instance Subgroup.t3_quotient_of_isClosed (S : Subgroup G) [Subgroup.Normal S] [hS : IsClosed (S : Set G)] : T3Space (G ⧸ S) := by rw [← QuotientGroup.ker_mk' S] at hS haveI := TopologicalGroup.t1Space (G ⧸ S) (quotientMap_quotient_mk'.isClosed_preimage.mp hS) infer_instance /-- A subgroup `S` of a topological group `G` acts on `G` properly discontinuously on the left, if it is discrete in the sense that `S ∩ K` is finite for all compact `K`. (See also `DiscreteTopology`.) -/ @[to_additive "A subgroup `S` of an additive topological group `G` acts on `G` properly discontinuously on the left, if it is discrete in the sense that `S ∩ K` is finite for all compact `K`. (See also `DiscreteTopology`."] theorem Subgroup.properlyDiscontinuousSMul_of_tendsto_cofinite (S : Subgroup G) (hS : Tendsto S.subtype cofinite (cocompact G)) : ProperlyDiscontinuousSMul S G := { finite_disjoint_inter_image := by intro K L hK hL have H : Set.Finite _ := hS ((hL.prod hK).image continuous_div').compl_mem_cocompact rw [preimage_compl, compl_compl] at H convert H ext x simp only [image_smul, mem_setOf_eq, coeSubtype, mem_preimage, mem_image, Prod.exists] exact Set.smul_inter_ne_empty_iff' } -- attribute [local semireducible] MulOpposite -- Porting note: doesn't work in Lean 4 /-- A subgroup `S` of a topological group `G` acts on `G` properly discontinuously on the right, if it is discrete in the sense that `S ∩ K` is finite for all compact `K`. (See also `DiscreteTopology`.) If `G` is Hausdorff, this can be combined with `t2Space_of_properlyDiscontinuousSMul_of_t2Space` to show that the quotient group `G ⧸ S` is Hausdorff. -/ @[to_additive "A subgroup `S` of an additive topological group `G` acts on `G` properly discontinuously on the right, if it is discrete in the sense that `S ∩ K` is finite for all compact `K`. (See also `DiscreteTopology`.) If `G` is Hausdorff, this can be combined with `t2Space_of_properlyDiscontinuousVAdd_of_t2Space` to show that the quotient group `G ⧸ S` is Hausdorff."] theorem Subgroup.properlyDiscontinuousSMul_opposite_of_tendsto_cofinite (S : Subgroup G) (hS : Tendsto S.subtype cofinite (cocompact G)) : ProperlyDiscontinuousSMul S.op G := { finite_disjoint_inter_image := by intro K L hK hL have : Continuous fun p : G × G => (p.1⁻¹, p.2) := continuous_inv.prod_map continuous_id have H : Set.Finite _ := hS ((hK.prod hL).image (continuous_mul.comp this)).compl_mem_cocompact simp only [preimage_compl, compl_compl, coeSubtype, comp_apply] at H apply Finite.of_preimage _ (equivOp S).surjective convert H using 1 ext x simp only [image_smul, mem_setOf_eq, coeSubtype, mem_preimage, mem_image, Prod.exists] exact Set.op_smul_inter_ne_empty_iff } end section /-! Some results about an open set containing the product of two sets in a topological group. -/ variable [TopologicalSpace G] [MulOneClass G] [ContinuousMul G] /-- Given a compact set `K` inside an open set `U`, there is an open neighborhood `V` of `1` such that `K * V ⊆ U`. -/ @[to_additive "Given a compact set `K` inside an open set `U`, there is an open neighborhood `V` of `0` such that `K + V ⊆ U`."] theorem compact_open_separated_mul_right {K U : Set G} (hK : IsCompact K) (hU : IsOpen U) (hKU : K ⊆ U) : ∃ V ∈ 𝓝 (1 : G), K * V ⊆ U := by refine hK.induction_on ?_ ?_ ?_ ?_ · exact ⟨univ, by simp⟩ · rintro s t hst ⟨V, hV, hV'⟩ exact ⟨V, hV, (mul_subset_mul_right hst).trans hV'⟩ · rintro s t ⟨V, V_in, hV'⟩ ⟨W, W_in, hW'⟩ use V ∩ W, inter_mem V_in W_in rw [union_mul] exact union_subset ((mul_subset_mul_left V.inter_subset_left).trans hV') ((mul_subset_mul_left V.inter_subset_right).trans hW') · intro x hx have := tendsto_mul (show U ∈ 𝓝 (x * 1) by simpa using hU.mem_nhds (hKU hx)) rw [nhds_prod_eq, mem_map, mem_prod_iff] at this rcases this with ⟨t, ht, s, hs, h⟩ rw [← image_subset_iff, image_mul_prod] at h exact ⟨t, mem_nhdsWithin_of_mem_nhds ht, s, hs, h⟩ open MulOpposite /-- Given a compact set `K` inside an open set `U`, there is an open neighborhood `V` of `1` such that `V * K ⊆ U`. -/ @[to_additive "Given a compact set `K` inside an open set `U`, there is an open neighborhood `V` of `0` such that `V + K ⊆ U`."] theorem compact_open_separated_mul_left {K U : Set G} (hK : IsCompact K) (hU : IsOpen U) (hKU : K ⊆ U) : ∃ V ∈ 𝓝 (1 : G), V * K ⊆ U := by rcases compact_open_separated_mul_right (hK.image continuous_op) (opHomeomorph.isOpenMap U hU) (image_subset op hKU) with ⟨V, hV : V ∈ 𝓝 (op (1 : G)), hV' : op '' K * V ⊆ op '' U⟩ refine ⟨op ⁻¹' V, continuous_op.continuousAt hV, ?_⟩ rwa [← image_preimage_eq V op_surjective, ← image_op_mul, image_subset_iff, preimage_image_eq _ op_injective] at hV' end section variable [TopologicalSpace G] [Group G] [TopologicalGroup G] /-- A compact set is covered by finitely many left multiplicative translates of a set with non-empty interior. -/ @[to_additive "A compact set is covered by finitely many left additive translates of a set with non-empty interior."] theorem compact_covered_by_mul_left_translates {K V : Set G} (hK : IsCompact K) (hV : (interior V).Nonempty) : ∃ t : Finset G, K ⊆ ⋃ g ∈ t, (g * ·) ⁻¹' V := by obtain ⟨t, ht⟩ : ∃ t : Finset G, K ⊆ ⋃ x ∈ t, interior ((x * ·) ⁻¹' V) := by refine hK.elim_finite_subcover (fun x => interior <| (x * ·) ⁻¹' V) (fun x => isOpen_interior) ?_ cases' hV with g₀ hg₀ refine fun g _ => mem_iUnion.2 ⟨g₀ * g⁻¹, ?_⟩ refine preimage_interior_subset_interior_preimage (continuous_const.mul continuous_id) ?_ rwa [mem_preimage, Function.id_def, inv_mul_cancel_right] exact ⟨t, Subset.trans ht <| iUnion₂_mono fun g _ => interior_subset⟩ /-- Every weakly locally compact separable topological group is σ-compact. Note: this is not true if we drop the topological group hypothesis. -/ @[to_additive SeparableWeaklyLocallyCompactAddGroup.sigmaCompactSpace "Every weakly locally compact separable topological additive group is σ-compact. Note: this is not true if we drop the topological group hypothesis."] instance (priority := 100) SeparableWeaklyLocallyCompactGroup.sigmaCompactSpace [SeparableSpace G] [WeaklyLocallyCompactSpace G] : SigmaCompactSpace G := by obtain ⟨L, hLc, hL1⟩ := exists_compact_mem_nhds (1 : G) refine ⟨⟨fun n => (fun x => x * denseSeq G n) ⁻¹' L, ?_, ?_⟩⟩ · intro n exact (Homeomorph.mulRight _).isCompact_preimage.mpr hLc · refine iUnion_eq_univ_iff.2 fun x => ?_ obtain ⟨_, ⟨n, rfl⟩, hn⟩ : (range (denseSeq G) ∩ (fun y => x * y) ⁻¹' L).Nonempty := by rw [← (Homeomorph.mulLeft x).apply_symm_apply 1] at hL1 exact (denseRange_denseSeq G).inter_nhds_nonempty ((Homeomorph.mulLeft x).continuous.continuousAt <| hL1) exact ⟨n, hn⟩ /-- Given two compact sets in a noncompact topological group, there is a translate of the second one that is disjoint from the first one. -/ @[to_additive "Given two compact sets in a noncompact additive topological group, there is a translate of the second one that is disjoint from the first one."] theorem exists_disjoint_smul_of_isCompact [NoncompactSpace G] {K L : Set G} (hK : IsCompact K) (hL : IsCompact L) : ∃ g : G, Disjoint K (g • L) := by have A : ¬K * L⁻¹ = univ := (hK.mul hL.inv).ne_univ obtain ⟨g, hg⟩ : ∃ g, g ∉ K * L⁻¹ := by contrapose! A exact eq_univ_iff_forall.2 A refine ⟨g, ?_⟩ refine disjoint_left.2 fun a ha h'a => hg ?_ rcases h'a with ⟨b, bL, rfl⟩ refine ⟨g * b, ha, b⁻¹, by simpa only [Set.mem_inv, inv_inv] using bL, ?_⟩ simp only [smul_eq_mul, mul_inv_cancel_right] /-- A compact neighborhood of `1` in a topological group admits a closed compact subset that is a neighborhood of `1`. -/ @[to_additive (attr := deprecated IsCompact.isCompact_isClosed_basis_nhds (since := "2024-01-28")) "A compact neighborhood of `0` in a topological additive group admits a closed compact subset that is a neighborhood of `0`."] theorem exists_isCompact_isClosed_subset_isCompact_nhds_one {L : Set G} (Lcomp : IsCompact L) (L1 : L ∈ 𝓝 (1 : G)) : ∃ K : Set G, IsCompact K ∧ IsClosed K ∧ K ⊆ L ∧ K ∈ 𝓝 (1 : G) := let ⟨K, ⟨hK, hK₁, hK₂⟩, hKL⟩ := (Lcomp.isCompact_isClosed_basis_nhds L1).mem_iff.1 L1 ⟨K, hK₁, hK₂, hKL, hK⟩ /-- If a point in a topological group has a compact neighborhood, then the group is locally compact. -/ @[to_additive] theorem IsCompact.locallyCompactSpace_of_mem_nhds_of_group {K : Set G} (hK : IsCompact K) {x : G} (h : K ∈ 𝓝 x) : LocallyCompactSpace G := by suffices WeaklyLocallyCompactSpace G from inferInstance refine ⟨fun y ↦ ⟨(y * x⁻¹) • K, ?_, ?_⟩⟩ · exact hK.smul _ · rw [← preimage_smul_inv] exact (continuous_const_smul _).continuousAt.preimage_mem_nhds (by simpa using h) /-- A topological group which is weakly locally compact is automatically locally compact. -/ @[to_additive (attr := deprecated WeaklyLocallyCompactSpace.locallyCompactSpace (since := "2024-01-28"))] theorem instLocallyCompactSpaceOfWeaklyOfGroup [WeaklyLocallyCompactSpace G] : LocallyCompactSpace G := WeaklyLocallyCompactSpace.locallyCompactSpace /-- If a function defined on a topological group has a support contained in a compact set, then either the function is trivial or the group is locally compact. -/ @[to_additive "If a function defined on a topological additive group has a support contained in a compact set, then either the function is trivial or the group is locally compact."] theorem eq_zero_or_locallyCompactSpace_of_support_subset_isCompact_of_group [TopologicalSpace α] [Zero α] [T1Space α] {f : G → α} {k : Set G} (hk : IsCompact k) (hf : support f ⊆ k) (h'f : Continuous f) : f = 0 ∨ LocallyCompactSpace G := by refine or_iff_not_imp_left.mpr fun h => ?_ simp_rw [funext_iff, Pi.zero_apply] at h push_neg at h obtain ⟨x, hx⟩ : ∃ x, f x ≠ 0 := h have : k ∈ 𝓝 x := mem_of_superset (h'f.isOpen_support.mem_nhds hx) hf exact IsCompact.locallyCompactSpace_of_mem_nhds_of_group hk this /-- If a function defined on a topological group has compact support, then either the function is trivial or the group is locally compact. -/ @[to_additive "If a function defined on a topological additive group has compact support, then either the function is trivial or the group is locally compact."] theorem HasCompactSupport.eq_zero_or_locallyCompactSpace_of_group [TopologicalSpace α] [Zero α] [T1Space α] {f : G → α} (hf : HasCompactSupport f) (h'f : Continuous f) : f = 0 ∨ LocallyCompactSpace G := eq_zero_or_locallyCompactSpace_of_support_subset_isCompact_of_group hf (subset_tsupport f) h'f /-- In a locally compact group, any neighborhood of the identity contains a compact closed neighborhood of the identity, even without separation assumptions on the space. -/ @[to_additive (attr := deprecated isCompact_isClosed_basis_nhds (since := "2024-01-28")) "In a locally compact additive group, any neighborhood of the identity contains a compact closed neighborhood of the identity, even without separation assumptions on the space."] theorem local_isCompact_isClosed_nhds_of_group [LocallyCompactSpace G] {U : Set G} (hU : U ∈ 𝓝 (1 : G)) : ∃ K : Set G, IsCompact K ∧ IsClosed K ∧ K ⊆ U ∧ (1 : G) ∈ interior K := let ⟨K, ⟨hK₁, hKco, hKcl⟩, hKU⟩ := (isCompact_isClosed_basis_nhds (1 : G)).mem_iff.1 hU ⟨K, hKco, hKcl, hKU, mem_interior_iff_mem_nhds.2 hK₁⟩ variable (G) @[to_additive (attr := deprecated exists_mem_nhds_isCompact_isClosed (since := "2024-01-28"))] theorem exists_isCompact_isClosed_nhds_one [WeaklyLocallyCompactSpace G] : ∃ K : Set G, IsCompact K ∧ IsClosed K ∧ K ∈ 𝓝 1 := let ⟨K, hK₁, hKcomp, hKcl⟩ := exists_mem_nhds_isCompact_isClosed (1 : G) ⟨K, hKcomp, hKcl, hK₁⟩ /-- A quotient of a locally compact group is locally compact. -/ @[to_additive] instance [LocallyCompactSpace G] (N : Subgroup G) : LocallyCompactSpace (G ⧸ N) := by refine ⟨fun x n hn ↦ ?_⟩ let π := ((↑) : G → G ⧸ N) have C : Continuous π := continuous_quotient_mk' obtain ⟨y, rfl⟩ : ∃ y, π y = x := Quot.exists_rep x have : π ⁻¹' n ∈ 𝓝 y := preimage_nhds_coinduced hn rcases local_compact_nhds this with ⟨s, s_mem, hs, s_comp⟩ exact ⟨π '' s, (QuotientGroup.isOpenMap_coe N).image_mem_nhds s_mem, mapsTo'.mp hs, s_comp.image C⟩ end section variable [TopologicalSpace G] [Group G] [TopologicalGroup G] @[to_additive] theorem nhds_mul (x y : G) : 𝓝 (x * y) = 𝓝 x * 𝓝 y := calc 𝓝 (x * y) = map (x * ·) (map (· * y) (𝓝 1 * 𝓝 1)) := by simp _ = map₂ (fun a b => x * (a * b * y)) (𝓝 1) (𝓝 1) := by rw [← map₂_mul, map_map₂, map_map₂] _ = map₂ (fun a b => x * a * (b * y)) (𝓝 1) (𝓝 1) := by simp only [mul_assoc] _ = 𝓝 x * 𝓝 y := by rw [← map_mul_left_nhds_one x, ← map_mul_right_nhds_one y, ← map₂_mul, map₂_map_left, map₂_map_right] /-- On a topological group, `𝓝 : G → Filter G` can be promoted to a `MulHom`. -/ @[to_additive (attr := simps) "On an additive topological group, `𝓝 : G → Filter G` can be promoted to an `AddHom`."] def nhdsMulHom : G →ₙ* Filter G where toFun := 𝓝 map_mul' _ _ := nhds_mul _ _ end end FilterMul instance {G} [TopologicalSpace G] [Group G] [TopologicalGroup G] : TopologicalAddGroup (Additive G) where continuous_neg := @continuous_inv G _ _ _ instance {G} [TopologicalSpace G] [AddGroup G] [TopologicalAddGroup G] : TopologicalGroup (Multiplicative G) where continuous_inv := @continuous_neg G _ _ _ section Quotient variable [Group G] [TopologicalSpace G] [ContinuousMul G] {Γ : Subgroup G} @[to_additive] instance QuotientGroup.continuousConstSMul : ContinuousConstSMul G (G ⧸ Γ) where continuous_const_smul g := by convert ((@continuous_const _ _ _ _ g).mul continuous_id).quotient_map' _ @[to_additive] theorem QuotientGroup.continuous_smul₁ (x : G ⧸ Γ) : Continuous fun g : G => g • x := by induction x using QuotientGroup.induction_on exact continuous_quotient_mk'.comp (continuous_mul_right _) /-- The quotient of a second countable topological group by a subgroup is second countable. -/ @[to_additive "The quotient of a second countable additive topological group by a subgroup is second countable."] instance QuotientGroup.secondCountableTopology [SecondCountableTopology G] : SecondCountableTopology (G ⧸ Γ) := ContinuousConstSMul.secondCountableTopology end Quotient /-- If `G` is a group with topological `⁻¹`, then it is homeomorphic to its units. -/ @[to_additive " If `G` is an additive group with topological negation, then it is homeomorphic to its additive units."] def toUnits_homeomorph [Group G] [TopologicalSpace G] [ContinuousInv G] : G ≃ₜ Gˣ where toEquiv := toUnits.toEquiv continuous_toFun := Units.continuous_iff.2 ⟨continuous_id, continuous_inv⟩ continuous_invFun := Units.continuous_val @[to_additive] theorem Units.embedding_val [Group G] [TopologicalSpace G] [ContinuousInv G] : Embedding (val : Gˣ → G) := toUnits_homeomorph.symm.embedding namespace Units open MulOpposite (continuous_op continuous_unop) variable [Monoid α] [TopologicalSpace α] [Monoid β] [TopologicalSpace β] @[to_additive] instance [ContinuousMul α] : TopologicalGroup αˣ where continuous_inv := Units.continuous_iff.2 <| ⟨continuous_coe_inv, continuous_val⟩ /-- The topological group isomorphism between the units of a product of two monoids, and the product of the units of each monoid. -/ @[to_additive "The topological group isomorphism between the additive units of a product of two additive monoids, and the product of the additive units of each additive monoid."] def Homeomorph.prodUnits : (α × β)ˣ ≃ₜ αˣ × βˣ where continuous_toFun := (continuous_fst.units_map (MonoidHom.fst α β)).prod_mk (continuous_snd.units_map (MonoidHom.snd α β)) continuous_invFun := Units.continuous_iff.2 ⟨continuous_val.fst'.prod_mk continuous_val.snd', continuous_coe_inv.fst'.prod_mk continuous_coe_inv.snd'⟩ toEquiv := MulEquiv.prodUnits.toEquiv end Units section LatticeOps variable {ι : Sort*} [Group G] @[to_additive] theorem topologicalGroup_sInf {ts : Set (TopologicalSpace G)} (h : ∀ t ∈ ts, @TopologicalGroup G t _) : @TopologicalGroup G (sInf ts) _ := letI := sInf ts { toContinuousInv := @continuousInv_sInf _ _ _ fun t ht => @TopologicalGroup.toContinuousInv G t _ <| h t ht toContinuousMul := @continuousMul_sInf _ _ _ fun t ht => @TopologicalGroup.toContinuousMul G t _ <| h t ht } @[to_additive] theorem topologicalGroup_iInf {ts' : ι → TopologicalSpace G} (h' : ∀ i, @TopologicalGroup G (ts' i) _) : @TopologicalGroup G (⨅ i, ts' i) _ := by rw [← sInf_range] exact topologicalGroup_sInf (Set.forall_mem_range.mpr h') @[to_additive] theorem topologicalGroup_inf {t₁ t₂ : TopologicalSpace G} (h₁ : @TopologicalGroup G t₁ _) (h₂ : @TopologicalGroup G t₂ _) : @TopologicalGroup G (t₁ ⊓ t₂) _ := by rw [inf_eq_iInf] refine topologicalGroup_iInf fun b => ?_ cases b <;> assumption end LatticeOps /-! ### Lattice of group topologies We define a type class `GroupTopology α` which endows a group `α` with a topology such that all group operations are continuous. Group topologies on a fixed group `α` are ordered, by reverse inclusion. They form a complete lattice, with `⊥` the discrete topology and `⊤` the indiscrete topology. Any function `f : α → β` induces `coinduced f : TopologicalSpace α → GroupTopology β`. The additive version `AddGroupTopology α` and corresponding results are provided as well. -/ /-- A group topology on a group `α` is a topology for which multiplication and inversion are continuous. -/ structure GroupTopology (α : Type u) [Group α] extends TopologicalSpace α, TopologicalGroup α : Type u /-- An additive group topology on an additive group `α` is a topology for which addition and negation are continuous. -/ structure AddGroupTopology (α : Type u) [AddGroup α] extends TopologicalSpace α, TopologicalAddGroup α : Type u attribute [to_additive] GroupTopology namespace GroupTopology variable [Group α] /-- A version of the global `continuous_mul` suitable for dot notation. -/ @[to_additive "A version of the global `continuous_add` suitable for dot notation."] theorem continuous_mul' (g : GroupTopology α) : haveI := g.toTopologicalSpace Continuous fun p : α × α => p.1 * p.2 := by letI := g.toTopologicalSpace haveI := g.toTopologicalGroup exact continuous_mul /-- A version of the global `continuous_inv` suitable for dot notation. -/ @[to_additive "A version of the global `continuous_neg` suitable for dot notation."] theorem continuous_inv' (g : GroupTopology α) : haveI := g.toTopologicalSpace Continuous (Inv.inv : α → α) := by letI := g.toTopologicalSpace haveI := g.toTopologicalGroup exact continuous_inv @[to_additive] theorem toTopologicalSpace_injective : Function.Injective (toTopologicalSpace : GroupTopology α → TopologicalSpace α) := fun f g h => by cases f cases g congr @[to_additive (attr := ext)] theorem ext' {f g : GroupTopology α} (h : f.IsOpen = g.IsOpen) : f = g := toTopologicalSpace_injective <| TopologicalSpace.ext h /-- The ordering on group topologies on the group `γ`. `t ≤ s` if every set open in `s` is also open in `t` (`t` is finer than `s`). -/ @[to_additive "The ordering on group topologies on the group `γ`. `t ≤ s` if every set open in `s` is also open in `t` (`t` is finer than `s`)."] instance : PartialOrder (GroupTopology α) := PartialOrder.lift toTopologicalSpace toTopologicalSpace_injective @[to_additive (attr := simp)] theorem toTopologicalSpace_le {x y : GroupTopology α} : x.toTopologicalSpace ≤ y.toTopologicalSpace ↔ x ≤ y := Iff.rfl @[to_additive] instance : Top (GroupTopology α) := let _t : TopologicalSpace α := ⊤ ⟨{ continuous_mul := continuous_top continuous_inv := continuous_top }⟩ @[to_additive (attr := simp)] theorem toTopologicalSpace_top : (⊤ : GroupTopology α).toTopologicalSpace = ⊤ := rfl @[to_additive] instance : Bot (GroupTopology α) := let _t : TopologicalSpace α := ⊥ ⟨{ continuous_mul := by haveI := discreteTopology_bot α continuity continuous_inv := continuous_bot }⟩ @[to_additive (attr := simp)] theorem toTopologicalSpace_bot : (⊥ : GroupTopology α).toTopologicalSpace = ⊥ := rfl @[to_additive] instance : BoundedOrder (GroupTopology α) where top := ⊤ le_top x := show x.toTopologicalSpace ≤ ⊤ from le_top bot := ⊥ bot_le x := show ⊥ ≤ x.toTopologicalSpace from bot_le @[to_additive] instance : Inf (GroupTopology α) where inf x y := ⟨x.1 ⊓ y.1, topologicalGroup_inf x.2 y.2⟩ @[to_additive (attr := simp)] theorem toTopologicalSpace_inf (x y : GroupTopology α) : (x ⊓ y).toTopologicalSpace = x.toTopologicalSpace ⊓ y.toTopologicalSpace := rfl @[to_additive] instance : SemilatticeInf (GroupTopology α) := toTopologicalSpace_injective.semilatticeInf _ toTopologicalSpace_inf @[to_additive] instance : Inhabited (GroupTopology α) := ⟨⊤⟩ local notation "cont" => @Continuous _ _ /-- Infimum of a collection of group topologies. -/ @[to_additive "Infimum of a collection of additive group topologies"] instance : InfSet (GroupTopology α) where sInf S := ⟨sInf (toTopologicalSpace '' S), topologicalGroup_sInf <| forall_mem_image.2 fun t _ => t.2⟩ @[to_additive (attr := simp)] theorem toTopologicalSpace_sInf (s : Set (GroupTopology α)) : (sInf s).toTopologicalSpace = sInf (toTopologicalSpace '' s) := rfl @[to_additive (attr := simp)] theorem toTopologicalSpace_iInf {ι} (s : ι → GroupTopology α) : (⨅ i, s i).toTopologicalSpace = ⨅ i, (s i).toTopologicalSpace := congr_arg sInf (range_comp _ _).symm /-- Group topologies on `γ` form a complete lattice, with `⊥` the discrete topology and `⊤` the indiscrete topology. The infimum of a collection of group topologies is the topology generated by all their open sets (which is a group topology). The supremum of two group topologies `s` and `t` is the infimum of the family of all group topologies contained in the intersection of `s` and `t`. -/ @[to_additive "Group topologies on `γ` form a complete lattice, with `⊥` the discrete topology and `⊤` the indiscrete topology. The infimum of a collection of group topologies is the topology generated by all their open sets (which is a group topology). The supremum of two group topologies `s` and `t` is the infimum of the family of all group topologies contained in the intersection of `s` and `t`."] instance : CompleteSemilatticeInf (GroupTopology α) := { inferInstanceAs (InfSet (GroupTopology α)), inferInstanceAs (PartialOrder (GroupTopology α)) with sInf_le := fun S a haS => toTopologicalSpace_le.1 <| sInf_le ⟨a, haS, rfl⟩ le_sInf := by intro S a hab apply (inferInstanceAs (CompleteLattice (TopologicalSpace α))).le_sInf rintro _ ⟨b, hbS, rfl⟩ exact hab b hbS } @[to_additive] instance : CompleteLattice (GroupTopology α) := { inferInstanceAs (BoundedOrder (GroupTopology α)), inferInstanceAs (SemilatticeInf (GroupTopology α)), completeLatticeOfCompleteSemilatticeInf _ with inf := (· ⊓ ·) top := ⊤ bot := ⊥ } /-- Given `f : α → β` and a topology on `α`, the coinduced group topology on `β` is the finest topology such that `f` is continuous and `β` is a topological group. -/ @[to_additive "Given `f : α → β` and a topology on `α`, the coinduced additive group topology on `β` is the finest topology such that `f` is continuous and `β` is a topological additive group."] def coinduced {α β : Type*} [t : TopologicalSpace α] [Group β] (f : α → β) : GroupTopology β := sInf { b : GroupTopology β | TopologicalSpace.coinduced f t ≤ b.toTopologicalSpace } @[to_additive] theorem coinduced_continuous {α β : Type*} [t : TopologicalSpace α] [Group β] (f : α → β) : Continuous[t, (coinduced f).toTopologicalSpace] f := by rw [continuous_sInf_rng] rintro _ ⟨t', ht', rfl⟩ exact continuous_iff_coinduced_le.2 ht' end GroupTopology
Topology\Algebra\Group\Compact.lean
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Patrick Massot -/ import Mathlib.Topology.Algebra.Group.Basic import Mathlib.Topology.CompactOpen import Mathlib.Topology.Sets.Compacts /-! # Additional results on topological groups Two results on topological groups that have been separated out as they require more substantial imports developing either positive compacts or the compact open topology. -/ universe u v w x variable {α : Type u} {β : Type v} {G : Type w} {H : Type x} section variable [TopologicalSpace G] [Group G] [TopologicalGroup G] /-- Every topological group in which there exists a compact set with nonempty interior is locally compact. -/ @[to_additive "Every topological additive group in which there exists a compact set with nonempty interior is locally compact."] theorem TopologicalSpace.PositiveCompacts.locallyCompactSpace_of_group (K : PositiveCompacts G) : LocallyCompactSpace G := let ⟨_x, hx⟩ := K.interior_nonempty K.isCompact.locallyCompactSpace_of_mem_nhds_of_group (mem_interior_iff_mem_nhds.1 hx) end section Quotient variable [Group G] [TopologicalSpace G] [TopologicalGroup G] {Γ : Subgroup G} @[to_additive] instance QuotientGroup.continuousSMul [LocallyCompactSpace G] : ContinuousSMul G (G ⧸ Γ) where continuous_smul := by let F : G × G ⧸ Γ → G ⧸ Γ := fun p => p.1 • p.2 change Continuous F have H : Continuous (F ∘ fun p : G × G => (p.1, QuotientGroup.mk p.2)) := by change Continuous fun p : G × G => QuotientGroup.mk (p.1 * p.2) exact continuous_coinduced_rng.comp continuous_mul exact QuotientMap.continuous_lift_prod_right quotientMap_quotient_mk' H end Quotient
Topology\Algebra\Group\OpenMapping.lean
/- Copyright (c) 2023 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Topology.Baire.Lemmas import Mathlib.Topology.Algebra.Group.Basic /-! # Open mapping theorem for morphisms of topological groups We prove that a continuous surjective group morphism from a sigma-compact group to a locally compact group is automatically open, in `MonoidHom.isOpenMap_of_sigmaCompact`. We deduce this from a similar statement for the orbits of continuous actions of sigma-compact groups on Baire spaces, given in `isOpenMap_smul_of_sigmaCompact`. Note that a sigma-compactness assumption is necessary. Indeed, let `G` be the real line with the discrete topology, and `H` the real line with the usual topology. Both are locally compact groups, and the identity from `G` to `H` is continuous but not open. -/ open scoped Topology Pointwise open MulAction Set Function variable {G X : Type*} [TopologicalSpace G] [TopologicalSpace X] [Group G] [TopologicalGroup G] [MulAction G X] [SigmaCompactSpace G] [BaireSpace X] [T2Space X] [ContinuousSMul G X] [IsPretransitive G X] /-- Consider a sigma-compact group acting continuously and transitively on a Baire space. Then the orbit map is open around the identity. It follows in `isOpenMap_smul_of_sigmaCompact` that it is open around any point. -/ @[to_additive "Consider a sigma-compact additive group acting continuously and transitively on a Baire space. Then the orbit map is open around zero. It follows in `isOpenMap_vadd_of_sigmaCompact` that it is open around any point."] theorem smul_singleton_mem_nhds_of_sigmaCompact {U : Set G} (hU : U ∈ 𝓝 1) (x : X) : U • {x} ∈ 𝓝 x := by /- Consider a small closed neighborhood `V` of the identity. Then the group is covered by countably many translates of `V`, say `gᵢ V`. Let also `Kₙ` be a sequence of compact sets covering the space. Then the image of `Kₙ ∩ gᵢ V` in the orbit is compact, and their unions covers the space. By Baire, one of them has nonempty interior. Then `gᵢ V • x` has nonempty interior, and so does `V • x`. Its interior contains a point `g' x` with `g' ∈ V`. Then `g'⁻¹ • V • x` contains a neighborhood of `x`, and it is included in `V⁻¹ • V • x`, which is itself contained in `U • x` if `V` is small enough. -/ obtain ⟨V, V_mem, V_closed, V_symm, VU⟩ : ∃ V ∈ 𝓝 (1 : G), IsClosed V ∧ V⁻¹ = V ∧ V * V ⊆ U := exists_closed_nhds_one_inv_eq_mul_subset hU obtain ⟨s, s_count, hs⟩ : ∃ (s : Set G), s.Countable ∧ ⋃ g ∈ s, g • V = univ := by apply countable_cover_nhds_of_sigma_compact (fun g ↦ ?_) convert smul_mem_nhds g V_mem simp only [smul_eq_mul, mul_one] let K : ℕ → Set G := compactCovering G let F : ℕ × s → Set X := fun p ↦ (K p.1 ∩ (p.2 : G) • V) • ({x} : Set X) obtain ⟨⟨n, ⟨g, hg⟩⟩, hi⟩ : ∃ i, (interior (F i)).Nonempty := by have : Nonempty X := ⟨x⟩ have : Encodable s := Countable.toEncodable s_count apply nonempty_interior_of_iUnion_of_closed · rintro ⟨n, ⟨g, hg⟩⟩ apply IsCompact.isClosed suffices H : IsCompact ((fun (g : G) ↦ g • x) '' (K n ∩ g • V)) by simpa only [F, smul_singleton] using H apply IsCompact.image · exact (isCompact_compactCovering G n).inter_right (V_closed.smul g) · exact continuous_id.smul continuous_const · apply eq_univ_iff_forall.2 (fun y ↦ ?_) obtain ⟨h, rfl⟩ : ∃ h, h • x = y := exists_smul_eq G x y obtain ⟨n, hn⟩ : ∃ n, h ∈ K n := exists_mem_compactCovering h obtain ⟨g, gs, hg⟩ : ∃ g ∈ s, h ∈ g • V := exists_set_mem_of_union_eq_top s _ hs _ simp only [F, smul_singleton, mem_iUnion, mem_image, mem_inter_iff, Prod.exists, Subtype.exists, exists_prop] exact ⟨n, g, gs, h, ⟨hn, hg⟩, rfl⟩ have I : (interior ((g • V) • {x})).Nonempty := by apply hi.mono apply interior_mono exact smul_subset_smul_right inter_subset_right obtain ⟨y, hy⟩ : (interior (V • ({x} : Set X))).Nonempty := by rw [smul_assoc, interior_smul] at I exact smul_set_nonempty.1 I obtain ⟨g', hg', rfl⟩ : ∃ g' ∈ V, g' • x = y := by simpa using interior_subset hy have J : (g' ⁻¹ • V) • {x} ∈ 𝓝 x := by apply mem_interior_iff_mem_nhds.1 rwa [smul_assoc, interior_smul, mem_inv_smul_set_iff] have : (g'⁻¹ • V) • {x} ⊆ U • ({x} : Set X) := by apply smul_subset_smul_right apply Subset.trans (smul_set_subset_smul (inv_mem_inv.2 hg')) ?_ rw [V_symm] exact VU exact Filter.mem_of_superset J this /-- Consider a sigma-compact group acting continuously and transitively on a Baire space. Then the orbit map is open. This is a version of the open mapping theorem, valid notably for the action of a sigma-compact locally compact group on a locally compact space. -/ @[to_additive "Consider a sigma-compact additive group acting continuously and transitively on a Baire space. Then the orbit map is open. This is a version of the open mapping theorem, valid notably for the action of a sigma-compact locally compact group on a locally compact space."] theorem isOpenMap_smul_of_sigmaCompact (x : X) : IsOpenMap (fun (g : G) ↦ g • x) := by /- We have already proved the theorem around the basepoint of the orbit, in `smul_singleton_mem_nhds_of_sigmaCompact`. The general statement follows around an arbitrary point by changing basepoints. -/ simp_rw [isOpenMap_iff_nhds_le, Filter.le_map_iff] intro g U hU have : (· • x) = (· • (g • x)) ∘ (· * g⁻¹) := by ext g simp [smul_smul] rw [this, image_comp, ← smul_singleton] apply smul_singleton_mem_nhds_of_sigmaCompact simpa using isOpenMap_mul_right g⁻¹ |>.image_mem_nhds hU /-- A surjective morphism of topological groups is open when the source group is sigma-compact and the target group is a Baire space (for instance a locally compact group). -/ @[to_additive] theorem MonoidHom.isOpenMap_of_sigmaCompact {H : Type*} [Group H] [TopologicalSpace H] [BaireSpace H] [T2Space H] [ContinuousMul H] (f : G →* H) (hf : Function.Surjective f) (h'f : Continuous f) : IsOpenMap f := by let A : MulAction G H := MulAction.compHom _ f have : ContinuousSMul G H := continuousSMul_compHom h'f have : IsPretransitive G H := isPretransitive_compHom hf have : f = (fun (g : G) ↦ g • (1 : H)) := by simp [MulAction.compHom_smul_def] rw [this] exact isOpenMap_smul_of_sigmaCompact _
Topology\Algebra\Group\TopologicalAbelianization.lean
/- Copyright (c) 2023 María Inés de Frutos-Fernández. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: María Inés de Frutos-Fernández -/ import Mathlib.GroupTheory.Abelianization import Mathlib.Topology.Algebra.Group.Basic /-! # The topological abelianization of a group. This file defines the topological abelianization of a topological group. ## Main definitions * `TopologicalAbelianization`: defines the topological abelianization of a group `G` as the quotient of `G` by the topological closure of its commutator subgroup.. ## Main results - `instNormalCommutatorClosure` : the topological closure of the commutator of a topological group `G` is a normal subgroup. ## Tags group, topological abelianization -/ variable (G : Type*) [Group G] [TopologicalSpace G] [TopologicalGroup G] instance instNormalCommutatorClosure : (commutator G).topologicalClosure.Normal := Subgroup.is_normal_topologicalClosure (commutator G) /-- The topological abelianization of `absoluteGaloisGroup`, that is, the quotient of `absoluteGaloisGroup` by the topological closure of its commutator subgroup. -/ abbrev TopologicalAbelianization := G ⧸ Subgroup.topologicalClosure (commutator G) local notation "G_ab" => TopologicalAbelianization namespace TopologicalAbelianization instance commGroup : CommGroup (G_ab G) where mul_comm := fun x y => Quotient.inductionOn₂' x y fun a b => Quotient.sound' <| QuotientGroup.leftRel_apply.mpr <| by have h : (a * b)⁻¹ * (b * a) = ⁅b⁻¹, a⁻¹⁆ := by group rw [h] exact Subgroup.le_topologicalClosure _ (Subgroup.commutator_mem_commutator (Subgroup.mem_top b⁻¹) (Subgroup.mem_top a⁻¹)) __ : Group (G_ab G) := inferInstance end TopologicalAbelianization
Topology\Algebra\InfiniteSum\Basic.lean
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mitchell Lee -/ import Mathlib.Topology.Algebra.InfiniteSum.Defs import Mathlib.Data.Fintype.BigOperators import Mathlib.Topology.Algebra.Monoid /-! # Lemmas on infinite sums and products in topological monoids This file contains many simple lemmas on `tsum`, `HasSum` etc, which are placed here in order to keep the basic file of definitions as short as possible. Results requiring a group (rather than monoid) structure on the target should go in `Group.lean`. -/ noncomputable section open Filter Finset Function open scoped Topology variable {α β γ δ : Type*} section HasProd variable [CommMonoid α] [TopologicalSpace α] variable {f g : β → α} {a b : α} {s : Finset β} /-- Constant one function has product `1` -/ @[to_additive "Constant zero function has sum `0`"] theorem hasProd_one : HasProd (fun _ ↦ 1 : β → α) 1 := by simp [HasProd, tendsto_const_nhds] @[to_additive] theorem hasProd_empty [IsEmpty β] : HasProd f 1 := by convert @hasProd_one α β _ _ @[to_additive] theorem multipliable_one : Multipliable (fun _ ↦ 1 : β → α) := hasProd_one.multipliable @[to_additive] theorem multipliable_empty [IsEmpty β] : Multipliable f := hasProd_empty.multipliable @[to_additive] theorem multipliable_congr (hfg : ∀ b, f b = g b) : Multipliable f ↔ Multipliable g := iff_of_eq (congr_arg Multipliable <| funext hfg) @[to_additive] theorem Multipliable.congr (hf : Multipliable f) (hfg : ∀ b, f b = g b) : Multipliable g := (multipliable_congr hfg).mp hf @[to_additive] lemma HasProd.congr_fun (hf : HasProd f a) (h : ∀ x : β, g x = f x) : HasProd g a := (funext h : g = f) ▸ hf @[to_additive] theorem HasProd.hasProd_of_prod_eq {g : γ → α} (h_eq : ∀ u : Finset γ, ∃ v : Finset β, ∀ v', v ⊆ v' → ∃ u', u ⊆ u' ∧ ∏ x ∈ u', g x = ∏ b ∈ v', f b) (hf : HasProd g a) : HasProd f a := le_trans (map_atTop_finset_prod_le_of_prod_eq h_eq) hf @[to_additive] theorem hasProd_iff_hasProd {g : γ → α} (h₁ : ∀ u : Finset γ, ∃ v : Finset β, ∀ v', v ⊆ v' → ∃ u', u ⊆ u' ∧ ∏ x ∈ u', g x = ∏ b ∈ v', f b) (h₂ : ∀ v : Finset β, ∃ u : Finset γ, ∀ u', u ⊆ u' → ∃ v', v ⊆ v' ∧ ∏ b ∈ v', f b = ∏ x ∈ u', g x) : HasProd f a ↔ HasProd g a := ⟨HasProd.hasProd_of_prod_eq h₂, HasProd.hasProd_of_prod_eq h₁⟩ @[to_additive] theorem Function.Injective.multipliable_iff {g : γ → β} (hg : Injective g) (hf : ∀ x ∉ Set.range g, f x = 1) : Multipliable (f ∘ g) ↔ Multipliable f := exists_congr fun _ ↦ hg.hasProd_iff hf @[to_additive (attr := simp)] theorem hasProd_extend_one {g : β → γ} (hg : Injective g) : HasProd (extend g f 1) a ↔ HasProd f a := by rw [← hg.hasProd_iff, extend_comp hg] exact extend_apply' _ _ @[to_additive (attr := simp)] theorem multipliable_extend_one {g : β → γ} (hg : Injective g) : Multipliable (extend g f 1) ↔ Multipliable f := exists_congr fun _ ↦ hasProd_extend_one hg @[to_additive] theorem hasProd_subtype_iff_mulIndicator {s : Set β} : HasProd (f ∘ (↑) : s → α) a ↔ HasProd (s.mulIndicator f) a := by rw [← Set.mulIndicator_range_comp, Subtype.range_coe, hasProd_subtype_iff_of_mulSupport_subset Set.mulSupport_mulIndicator_subset] @[to_additive] theorem multipliable_subtype_iff_mulIndicator {s : Set β} : Multipliable (f ∘ (↑) : s → α) ↔ Multipliable (s.mulIndicator f) := exists_congr fun _ ↦ hasProd_subtype_iff_mulIndicator @[to_additive (attr := simp)] theorem hasProd_subtype_mulSupport : HasProd (f ∘ (↑) : mulSupport f → α) a ↔ HasProd f a := hasProd_subtype_iff_of_mulSupport_subset <| Set.Subset.refl _ @[to_additive] protected theorem Finset.multipliable (s : Finset β) (f : β → α) : Multipliable (f ∘ (↑) : (↑s : Set β) → α) := (s.hasProd f).multipliable @[to_additive] protected theorem Set.Finite.multipliable {s : Set β} (hs : s.Finite) (f : β → α) : Multipliable (f ∘ (↑) : s → α) := by have := hs.toFinset.multipliable f rwa [hs.coe_toFinset] at this @[to_additive] theorem multipliable_of_finite_mulSupport (h : (mulSupport f).Finite) : Multipliable f := by apply multipliable_of_ne_finset_one (s := h.toFinset); simp @[to_additive] lemma Multipliable.of_finite [Finite β] {f : β → α} : Multipliable f := multipliable_of_finite_mulSupport <| Set.finite_univ.subset (Set.subset_univ _) @[to_additive] theorem hasProd_single {f : β → α} (b : β) (hf : ∀ (b') (_ : b' ≠ b), f b' = 1) : HasProd f (f b) := suffices HasProd f (∏ b' ∈ {b}, f b') by simpa using this hasProd_prod_of_ne_finset_one <| by simpa [hf] @[to_additive (attr := simp)] lemma hasProd_unique [Unique β] (f : β → α) : HasProd f (f default) := hasProd_single default (fun _ hb ↦ False.elim <| hb <| Unique.uniq ..) @[to_additive (attr := simp)] lemma hasProd_singleton (m : β) (f : β → α) : HasProd (({m} : Set β).restrict f) (f m) := hasProd_unique (Set.restrict {m} f) @[to_additive] theorem hasProd_ite_eq (b : β) [DecidablePred (· = b)] (a : α) : HasProd (fun b' ↦ if b' = b then a else 1) a := by convert @hasProd_single _ _ _ _ (fun b' ↦ if b' = b then a else 1) b (fun b' hb' ↦ if_neg hb') exact (if_pos rfl).symm @[to_additive] theorem Equiv.hasProd_iff (e : γ ≃ β) : HasProd (f ∘ e) a ↔ HasProd f a := e.injective.hasProd_iff <| by simp @[to_additive] theorem Function.Injective.hasProd_range_iff {g : γ → β} (hg : Injective g) : HasProd (fun x : Set.range g ↦ f x) a ↔ HasProd (f ∘ g) a := (Equiv.ofInjective g hg).hasProd_iff.symm @[to_additive] theorem Equiv.multipliable_iff (e : γ ≃ β) : Multipliable (f ∘ e) ↔ Multipliable f := exists_congr fun _ ↦ e.hasProd_iff @[to_additive] theorem Equiv.hasProd_iff_of_mulSupport {g : γ → α} (e : mulSupport f ≃ mulSupport g) (he : ∀ x : mulSupport f, g (e x) = f x) : HasProd f a ↔ HasProd g a := by have : (g ∘ (↑)) ∘ e = f ∘ (↑) := funext he rw [← hasProd_subtype_mulSupport, ← this, e.hasProd_iff, hasProd_subtype_mulSupport] @[to_additive] theorem hasProd_iff_hasProd_of_ne_one_bij {g : γ → α} (i : mulSupport g → β) (hi : Injective i) (hf : mulSupport f ⊆ Set.range i) (hfg : ∀ x, f (i x) = g x) : HasProd f a ↔ HasProd g a := Iff.symm <| Equiv.hasProd_iff_of_mulSupport (Equiv.ofBijective (fun x ↦ ⟨i x, fun hx ↦ x.coe_prop <| hfg x ▸ hx⟩) ⟨fun _ _ h ↦ hi <| Subtype.ext_iff.1 h, fun y ↦ (hf y.coe_prop).imp fun _ hx ↦ Subtype.ext hx⟩) hfg @[to_additive] theorem Equiv.multipliable_iff_of_mulSupport {g : γ → α} (e : mulSupport f ≃ mulSupport g) (he : ∀ x : mulSupport f, g (e x) = f x) : Multipliable f ↔ Multipliable g := exists_congr fun _ ↦ e.hasProd_iff_of_mulSupport he @[to_additive] protected theorem HasProd.map [CommMonoid γ] [TopologicalSpace γ] (hf : HasProd f a) {G} [FunLike G α γ] [MonoidHomClass G α γ] (g : G) (hg : Continuous g) : HasProd (g ∘ f) (g a) := by have : (g ∘ fun s : Finset β ↦ ∏ b ∈ s, f b) = fun s : Finset β ↦ ∏ b ∈ s, (g ∘ f) b := funext <| map_prod g _ unfold HasProd rw [← this] exact (hg.tendsto a).comp hf @[to_additive] protected theorem Inducing.hasProd_iff [CommMonoid γ] [TopologicalSpace γ] {G} [FunLike G α γ] [MonoidHomClass G α γ] {g : G} (hg : Inducing g) (f : β → α) (a : α) : HasProd (g ∘ f) (g a) ↔ HasProd f a := by simp_rw [HasProd, comp_apply, ← map_prod] exact hg.tendsto_nhds_iff.symm @[to_additive] protected theorem Multipliable.map [CommMonoid γ] [TopologicalSpace γ] (hf : Multipliable f) {G} [FunLike G α γ] [MonoidHomClass G α γ] (g : G) (hg : Continuous g) : Multipliable (g ∘ f) := (hf.hasProd.map g hg).multipliable @[to_additive] protected theorem Multipliable.map_iff_of_leftInverse [CommMonoid γ] [TopologicalSpace γ] {G G'} [FunLike G α γ] [MonoidHomClass G α γ] [FunLike G' γ α] [MonoidHomClass G' γ α] (g : G) (g' : G') (hg : Continuous g) (hg' : Continuous g') (hinv : Function.LeftInverse g' g) : Multipliable (g ∘ f) ↔ Multipliable f := ⟨fun h ↦ by have := h.map _ hg' rwa [← Function.comp.assoc, hinv.id] at this, fun h ↦ h.map _ hg⟩ @[to_additive] theorem Multipliable.map_tprod [CommMonoid γ] [TopologicalSpace γ] [T2Space γ] (hf : Multipliable f) {G} [FunLike G α γ] [MonoidHomClass G α γ] (g : G) (hg : Continuous g) : g (∏' i, f i) = ∏' i, g (f i) := (HasProd.tprod_eq (HasProd.map hf.hasProd g hg)).symm @[to_additive] theorem Inducing.multipliable_iff_tprod_comp_mem_range [CommMonoid γ] [TopologicalSpace γ] [T2Space γ] {G} [FunLike G α γ] [MonoidHomClass G α γ] {g : G} (hg : Inducing g) (f : β → α) : Multipliable f ↔ Multipliable (g ∘ f) ∧ ∏' i, g (f i) ∈ Set.range g := by constructor · intro hf constructor · exact hf.map g hg.continuous · use ∏' i, f i exact hf.map_tprod g hg.continuous · rintro ⟨hgf, a, ha⟩ use a have := hgf.hasProd simp_rw [comp_apply, ← ha] at this exact (hg.hasProd_iff f a).mp this /-- "A special case of `Multipliable.map_iff_of_leftInverse` for convenience" -/ @[to_additive "A special case of `Summable.map_iff_of_leftInverse` for convenience"] protected theorem Multipliable.map_iff_of_equiv [CommMonoid γ] [TopologicalSpace γ] {G} [EquivLike G α γ] [MulEquivClass G α γ] (g : G) (hg : Continuous g) (hg' : Continuous (EquivLike.inv g : γ → α)) : Multipliable (g ∘ f) ↔ Multipliable f := Multipliable.map_iff_of_leftInverse g (g : α ≃* γ).symm hg hg' (EquivLike.left_inv g) @[to_additive] theorem Function.Surjective.multipliable_iff_of_hasProd_iff {α' : Type*} [CommMonoid α'] [TopologicalSpace α'] {e : α' → α} (hes : Function.Surjective e) {f : β → α} {g : γ → α'} (he : ∀ {a}, HasProd f (e a) ↔ HasProd g a) : Multipliable f ↔ Multipliable g := hes.exists.trans <| exists_congr <| @he variable [ContinuousMul α] @[to_additive] theorem HasProd.mul (hf : HasProd f a) (hg : HasProd g b) : HasProd (fun b ↦ f b * g b) (a * b) := by dsimp only [HasProd] at hf hg ⊢ simp_rw [prod_mul_distrib] exact hf.mul hg @[to_additive] theorem Multipliable.mul (hf : Multipliable f) (hg : Multipliable g) : Multipliable fun b ↦ f b * g b := (hf.hasProd.mul hg.hasProd).multipliable @[to_additive] theorem hasProd_prod {f : γ → β → α} {a : γ → α} {s : Finset γ} : (∀ i ∈ s, HasProd (f i) (a i)) → HasProd (fun b ↦ ∏ i ∈ s, f i b) (∏ i ∈ s, a i) := by classical exact Finset.induction_on s (by simp only [hasProd_one, prod_empty, forall_true_iff]) <| by -- Porting note: with some help, `simp` used to be able to close the goal simp (config := { contextual := true }) only [mem_insert, forall_eq_or_imp, not_false_iff, prod_insert, and_imp] exact fun x s _ IH hx h ↦ hx.mul (IH h) @[to_additive] theorem multipliable_prod {f : γ → β → α} {s : Finset γ} (hf : ∀ i ∈ s, Multipliable (f i)) : Multipliable fun b ↦ ∏ i ∈ s, f i b := (hasProd_prod fun i hi ↦ (hf i hi).hasProd).multipliable @[to_additive] theorem HasProd.mul_disjoint {s t : Set β} (hs : Disjoint s t) (ha : HasProd (f ∘ (↑) : s → α) a) (hb : HasProd (f ∘ (↑) : t → α) b) : HasProd (f ∘ (↑) : (s ∪ t : Set β) → α) (a * b) := by rw [hasProd_subtype_iff_mulIndicator] at * rw [Set.mulIndicator_union_of_disjoint hs] exact ha.mul hb @[to_additive] theorem hasProd_prod_disjoint {ι} (s : Finset ι) {t : ι → Set β} {a : ι → α} (hs : (s : Set ι).Pairwise (Disjoint on t)) (hf : ∀ i ∈ s, HasProd (f ∘ (↑) : t i → α) (a i)) : HasProd (f ∘ (↑) : (⋃ i ∈ s, t i) → α) (∏ i ∈ s, a i) := by simp_rw [hasProd_subtype_iff_mulIndicator] at * rw [Finset.mulIndicator_biUnion _ _ hs] exact hasProd_prod hf @[to_additive] theorem HasProd.mul_isCompl {s t : Set β} (hs : IsCompl s t) (ha : HasProd (f ∘ (↑) : s → α) a) (hb : HasProd (f ∘ (↑) : t → α) b) : HasProd f (a * b) := by simpa [← hs.compl_eq] using (hasProd_subtype_iff_mulIndicator.1 ha).mul (hasProd_subtype_iff_mulIndicator.1 hb) @[to_additive] theorem HasProd.mul_compl {s : Set β} (ha : HasProd (f ∘ (↑) : s → α) a) (hb : HasProd (f ∘ (↑) : (sᶜ : Set β) → α) b) : HasProd f (a * b) := ha.mul_isCompl isCompl_compl hb @[to_additive] theorem Multipliable.mul_compl {s : Set β} (hs : Multipliable (f ∘ (↑) : s → α)) (hsc : Multipliable (f ∘ (↑) : (sᶜ : Set β) → α)) : Multipliable f := (hs.hasProd.mul_compl hsc.hasProd).multipliable @[to_additive] theorem HasProd.compl_mul {s : Set β} (ha : HasProd (f ∘ (↑) : (sᶜ : Set β) → α) a) (hb : HasProd (f ∘ (↑) : s → α) b) : HasProd f (a * b) := ha.mul_isCompl isCompl_compl.symm hb @[to_additive] theorem Multipliable.compl_add {s : Set β} (hs : Multipliable (f ∘ (↑) : (sᶜ : Set β) → α)) (hsc : Multipliable (f ∘ (↑) : s → α)) : Multipliable f := (hs.hasProd.compl_mul hsc.hasProd).multipliable /-- Version of `HasProd.update` for `CommMonoid` rather than `CommGroup`. Rather than showing that `f.update` has a specific product in terms of `HasProd`, it gives a relationship between the products of `f` and `f.update` given that both exist. -/ @[to_additive "Version of `HasSum.update` for `AddCommMonoid` rather than `AddCommGroup`. Rather than showing that `f.update` has a specific sum in terms of `HasSum`, it gives a relationship between the sums of `f` and `f.update` given that both exist."] theorem HasProd.update' {α β : Type*} [TopologicalSpace α] [CommMonoid α] [T2Space α] [ContinuousMul α] [DecidableEq β] {f : β → α} {a a' : α} (hf : HasProd f a) (b : β) (x : α) (hf' : HasProd (update f b x) a') : a * x = a' * f b := by have : ∀ b', f b' * ite (b' = b) x 1 = update f b x b' * ite (b' = b) (f b) 1 := by intro b' split_ifs with hb' · simpa only [Function.update_apply, hb', eq_self_iff_true] using mul_comm (f b) x · simp only [Function.update_apply, hb', if_false] have h := hf.mul (hasProd_ite_eq b x) simp_rw [this] at h exact HasProd.unique h (hf'.mul (hasProd_ite_eq b (f b))) /-- Version of `hasProd_ite_div_hasProd` for `CommMonoid` rather than `CommGroup`. Rather than showing that the `ite` expression has a specific product in terms of `HasProd`, it gives a relationship between the products of `f` and `ite (n = b) 0 (f n)` given that both exist. -/ @[to_additive "Version of `hasSum_ite_sub_hasSum` for `AddCommMonoid` rather than `AddCommGroup`. Rather than showing that the `ite` expression has a specific sum in terms of `HasSum`, it gives a relationship between the sums of `f` and `ite (n = b) 0 (f n)` given that both exist."] theorem eq_mul_of_hasProd_ite {α β : Type*} [TopologicalSpace α] [CommMonoid α] [T2Space α] [ContinuousMul α] [DecidableEq β] {f : β → α} {a : α} (hf : HasProd f a) (b : β) (a' : α) (hf' : HasProd (fun n ↦ ite (n = b) 1 (f n)) a') : a = a' * f b := by refine (mul_one a).symm.trans (hf.update' b 1 ?_) convert hf' apply update_apply end HasProd section tprod variable [CommMonoid α] [TopologicalSpace α] {f g : β → α} {a a₁ a₂ : α} @[to_additive] theorem tprod_congr_set_coe (f : β → α) {s t : Set β} (h : s = t) : ∏' x : s, f x = ∏' x : t, f x := by rw [h] @[to_additive] theorem tprod_congr_subtype (f : β → α) {P Q : β → Prop} (h : ∀ x, P x ↔ Q x) : ∏' x : {x // P x}, f x = ∏' x : {x // Q x}, f x := tprod_congr_set_coe f <| Set.ext h @[to_additive] theorem tprod_eq_finprod (hf : (mulSupport f).Finite) : ∏' b, f b = ∏ᶠ b, f b := by simp [tprod_def, multipliable_of_finite_mulSupport hf, hf] @[to_additive] theorem tprod_eq_prod' {s : Finset β} (hf : mulSupport f ⊆ s) : ∏' b, f b = ∏ b ∈ s, f b := by rw [tprod_eq_finprod (s.finite_toSet.subset hf), finprod_eq_prod_of_mulSupport_subset _ hf] @[to_additive] theorem tprod_eq_prod {s : Finset β} (hf : ∀ b ∉ s, f b = 1) : ∏' b, f b = ∏ b ∈ s, f b := tprod_eq_prod' <| mulSupport_subset_iff'.2 hf @[to_additive (attr := simp)] theorem tprod_one : ∏' _ : β, (1 : α) = 1 := by rw [tprod_eq_finprod] <;> simp @[to_additive (attr := simp)] theorem tprod_empty [IsEmpty β] : ∏' b, f b = 1 := by rw [tprod_eq_prod (s := (∅ : Finset β))] <;> simp @[to_additive] theorem tprod_congr {f g : β → α} (hfg : ∀ b, f b = g b) : ∏' b, f b = ∏' b, g b := congr_arg tprod (funext hfg) @[to_additive] theorem tprod_fintype [Fintype β] (f : β → α) : ∏' b, f b = ∏ b, f b := by apply tprod_eq_prod; simp @[to_additive] theorem prod_eq_tprod_mulIndicator (f : β → α) (s : Finset β) : ∏ x ∈ s, f x = ∏' x, Set.mulIndicator (↑s) f x := by rw [tprod_eq_prod' (Set.mulSupport_mulIndicator_subset), Finset.prod_mulIndicator_subset _ Finset.Subset.rfl] @[to_additive] theorem tprod_bool (f : Bool → α) : ∏' i : Bool, f i = f false * f true := by rw [tprod_fintype, Fintype.prod_bool, mul_comm] @[to_additive] theorem tprod_eq_mulSingle {f : β → α} (b : β) (hf : ∀ b' ≠ b, f b' = 1) : ∏' b, f b = f b := by rw [tprod_eq_prod (s := {b}), prod_singleton] exact fun b' hb' ↦ hf b' (by simpa using hb') @[to_additive] theorem tprod_tprod_eq_mulSingle (f : β → γ → α) (b : β) (c : γ) (hfb : ∀ b' ≠ b, f b' c = 1) (hfc : ∀ b', ∀ c' ≠ c, f b' c' = 1) : ∏' (b') (c'), f b' c' = f b c := calc ∏' (b') (c'), f b' c' = ∏' b', f b' c := tprod_congr fun b' ↦ tprod_eq_mulSingle _ (hfc b') _ = f b c := tprod_eq_mulSingle _ hfb @[to_additive (attr := simp)] theorem tprod_ite_eq (b : β) [DecidablePred (· = b)] (a : α) : ∏' b', (if b' = b then a else 1) = a := by rw [tprod_eq_mulSingle b] · simp · intro b' hb'; simp [hb'] -- Porting note: Added nolint simpNF, simpNF falsely claims that lhs does not simplify under simp @[to_additive (attr := simp, nolint simpNF)] theorem Finset.tprod_subtype (s : Finset β) (f : β → α) : ∏' x : { x // x ∈ s }, f x = ∏ x ∈ s, f x := by rw [← prod_attach]; exact tprod_fintype _ @[to_additive] theorem Finset.tprod_subtype' (s : Finset β) (f : β → α) : ∏' x : (s : Set β), f x = ∏ x ∈ s, f x := by simp -- Porting note: Added nolint simpNF, simpNF falsely claims that lhs does not simplify under simp @[to_additive (attr := simp, nolint simpNF)] theorem tprod_singleton (b : β) (f : β → α) : ∏' x : ({b} : Set β), f x = f b := by rw [← coe_singleton, Finset.tprod_subtype', prod_singleton] open scoped Classical in @[to_additive] theorem Function.Injective.tprod_eq {g : γ → β} (hg : Injective g) {f : β → α} (hf : mulSupport f ⊆ Set.range g) : ∏' c, f (g c) = ∏' b, f b := by have : mulSupport f = g '' mulSupport (f ∘ g) := by rw [mulSupport_comp_eq_preimage, Set.image_preimage_eq_iff.2 hf] rw [← Function.comp_def] by_cases hf_fin : (mulSupport f).Finite · have hfg_fin : (mulSupport (f ∘ g)).Finite := hf_fin.preimage hg.injOn lift g to γ ↪ β using hg simp_rw [tprod_eq_prod' hf_fin.coe_toFinset.ge, tprod_eq_prod' hfg_fin.coe_toFinset.ge, comp_apply, ← Finset.prod_map] refine Finset.prod_congr (Finset.coe_injective ?_) fun _ _ ↦ rfl simp [this] · have hf_fin' : ¬ Set.Finite (mulSupport (f ∘ g)) := by rwa [this, Set.finite_image_iff hg.injOn] at hf_fin simp_rw [tprod_def, if_neg hf_fin, if_neg hf_fin', Multipliable, funext fun a => propext <| hg.hasProd_iff (mulSupport_subset_iff'.1 hf) (a := a)] @[to_additive] theorem Equiv.tprod_eq (e : γ ≃ β) (f : β → α) : ∏' c, f (e c) = ∏' b, f b := e.injective.tprod_eq <| by simp /-! ### `tprod` on subsets - part 1 -/ @[to_additive] theorem tprod_subtype_eq_of_mulSupport_subset {f : β → α} {s : Set β} (hs : mulSupport f ⊆ s) : ∏' x : s, f x = ∏' x, f x := Subtype.val_injective.tprod_eq <| by simpa @[to_additive] theorem tprod_subtype_mulSupport (f : β → α) : ∏' x : mulSupport f, f x = ∏' x, f x := tprod_subtype_eq_of_mulSupport_subset Set.Subset.rfl @[to_additive] theorem tprod_subtype (s : Set β) (f : β → α) : ∏' x : s, f x = ∏' x, s.mulIndicator f x := by rw [← tprod_subtype_eq_of_mulSupport_subset Set.mulSupport_mulIndicator_subset, tprod_congr] simp -- Porting note: Added nolint simpNF, simpNF falsely claims that lhs does not simplify under simp @[to_additive (attr := simp, nolint simpNF)] theorem tprod_univ (f : β → α) : ∏' x : (Set.univ : Set β), f x = ∏' x, f x := tprod_subtype_eq_of_mulSupport_subset <| Set.subset_univ _ @[to_additive] theorem tprod_image {g : γ → β} (f : β → α) {s : Set γ} (hg : Set.InjOn g s) : ∏' x : g '' s, f x = ∏' x : s, f (g x) := ((Equiv.Set.imageOfInjOn _ _ hg).tprod_eq fun x ↦ f x).symm @[to_additive] theorem tprod_range {g : γ → β} (f : β → α) (hg : Injective g) : ∏' x : Set.range g, f x = ∏' x, f (g x) := by rw [← Set.image_univ, tprod_image f hg.injOn] simp_rw [← comp_apply (g := g), tprod_univ (f ∘ g)] /-- If `f b = 1` for all `b ∈ t`, then the product of `f a` with `a ∈ s` is the same as the product of `f a` with `a ∈ s ∖ t`. -/ @[to_additive "If `f b = 0` for all `b ∈ t`, then the sum of `f a` with `a ∈ s` is the same as the sum of `f a` with `a ∈ s ∖ t`."] lemma tprod_setElem_eq_tprod_setElem_diff {f : β → α} (s t : Set β) (hf₀ : ∀ b ∈ t, f b = 1) : ∏' a : s, f a = ∏' a : (s \ t : Set β), f a := .symm <| (Set.inclusion_injective (t := s) Set.diff_subset).tprod_eq (f := f ∘ (↑)) <| mulSupport_subset_iff'.2 fun b hb ↦ hf₀ b <| by simpa using hb /-- If `f b = 1`, then the product of `f a` with `a ∈ s` is the same as the product of `f a` for `a ∈ s ∖ {b}`. -/ @[to_additive "If `f b = 0`, then the sum of `f a` with `a ∈ s` is the same as the sum of `f a` for `a ∈ s ∖ {b}`."] lemma tprod_eq_tprod_diff_singleton {f : β → α} (s : Set β) {b : β} (hf₀ : f b = 1) : ∏' a : s, f a = ∏' a : (s \ {b} : Set β), f a := tprod_setElem_eq_tprod_setElem_diff s {b} fun _ ha ↦ ha ▸ hf₀ @[to_additive] theorem tprod_eq_tprod_of_ne_one_bij {g : γ → α} (i : mulSupport g → β) (hi : Injective i) (hf : mulSupport f ⊆ Set.range i) (hfg : ∀ x, f (i x) = g x) : ∏' x, f x = ∏' y, g y := by rw [← tprod_subtype_mulSupport g, ← hi.tprod_eq hf] simp only [hfg] @[to_additive] theorem Equiv.tprod_eq_tprod_of_mulSupport {f : β → α} {g : γ → α} (e : mulSupport f ≃ mulSupport g) (he : ∀ x, g (e x) = f x) : ∏' x, f x = ∏' y, g y := .symm <| tprod_eq_tprod_of_ne_one_bij _ (Subtype.val_injective.comp e.injective) (by simp) he @[to_additive] theorem tprod_dite_right (P : Prop) [Decidable P] (x : β → ¬P → α) : ∏' b : β, (if h : P then (1 : α) else x b h) = if h : P then (1 : α) else ∏' b : β, x b h := by by_cases hP : P <;> simp [hP] @[to_additive] theorem tprod_dite_left (P : Prop) [Decidable P] (x : β → P → α) : ∏' b : β, (if h : P then x b h else 1) = if h : P then ∏' b : β, x b h else 1 := by by_cases hP : P <;> simp [hP] @[to_additive (attr := simp)] lemma tprod_extend_one {γ : Type*} {g : γ → β} (hg : Injective g) (f : γ → α) : ∏' y, extend g f 1 y = ∏' x, f x := by have : mulSupport (extend g f 1) ⊆ Set.range g := mulSupport_subset_iff'.2 <| extend_apply' _ _ simp_rw [← hg.tprod_eq this, hg.extend_apply] variable [T2Space α] @[to_additive] theorem Function.Surjective.tprod_eq_tprod_of_hasProd_iff_hasProd {α' : Type*} [CommMonoid α'] [TopologicalSpace α'] {e : α' → α} (hes : Function.Surjective e) (h1 : e 1 = 1) {f : β → α} {g : γ → α'} (h : ∀ {a}, HasProd f (e a) ↔ HasProd g a) : ∏' b, f b = e (∏' c, g c) := by_cases (fun x ↦ (h.mpr x.hasProd).tprod_eq) fun hg : ¬Multipliable g ↦ by have hf : ¬Multipliable f := mt (hes.multipliable_iff_of_hasProd_iff @h).1 hg simp [tprod_def, hf, hg, h1] @[to_additive] theorem tprod_eq_tprod_of_hasProd_iff_hasProd {f : β → α} {g : γ → α} (h : ∀ {a}, HasProd f a ↔ HasProd g a) : ∏' b, f b = ∏' c, g c := surjective_id.tprod_eq_tprod_of_hasProd_iff_hasProd rfl @h section ContinuousMul variable [ContinuousMul α] @[to_additive] theorem tprod_mul (hf : Multipliable f) (hg : Multipliable g) : ∏' b, (f b * g b) = (∏' b, f b) * ∏' b, g b := (hf.hasProd.mul hg.hasProd).tprod_eq @[to_additive tsum_sum] theorem tprod_of_prod {f : γ → β → α} {s : Finset γ} (hf : ∀ i ∈ s, Multipliable (f i)) : ∏' b, ∏ i ∈ s, f i b = ∏ i ∈ s, ∏' b, f i b := (hasProd_prod fun i hi ↦ (hf i hi).hasProd).tprod_eq /-- Version of `tprod_eq_mul_tprod_ite` for `CommMonoid` rather than `CommGroup`. Requires a different convergence assumption involving `Function.update`. -/ @[to_additive "Version of `tsum_eq_add_tsum_ite` for `AddCommMonoid` rather than `AddCommGroup`. Requires a different convergence assumption involving `Function.update`."] theorem tprod_eq_mul_tprod_ite' [DecidableEq β] {f : β → α} (b : β) (hf : Multipliable (update f b 1)) : ∏' x, f x = f b * ∏' x, ite (x = b) 1 (f x) := calc ∏' x, f x = ∏' x, (ite (x = b) (f x) 1 * update f b 1 x) := tprod_congr fun n ↦ by split_ifs with h <;> simp [update_apply, h] _ = (∏' x, ite (x = b) (f x) 1) * ∏' x, update f b 1 x := tprod_mul ⟨ite (b = b) (f b) 1, hasProd_single b fun b hb ↦ if_neg hb⟩ hf _ = ite (b = b) (f b) 1 * ∏' x, update f b 1 x := by congr exact tprod_eq_mulSingle b fun b' hb' ↦ if_neg hb' _ = f b * ∏' x, ite (x = b) 1 (f x) := by simp only [update, eq_self_iff_true, if_true, eq_rec_constant, dite_eq_ite] @[to_additive] theorem tprod_mul_tprod_compl {s : Set β} (hs : Multipliable (f ∘ (↑) : s → α)) (hsc : Multipliable (f ∘ (↑) : ↑sᶜ → α)) : (∏' x : s, f x) * ∏' x : ↑sᶜ, f x = ∏' x, f x := (hs.hasProd.mul_compl hsc.hasProd).tprod_eq.symm @[to_additive] theorem tprod_union_disjoint {s t : Set β} (hd : Disjoint s t) (hs : Multipliable (f ∘ (↑) : s → α)) (ht : Multipliable (f ∘ (↑) : t → α)) : ∏' x : ↑(s ∪ t), f x = (∏' x : s, f x) * ∏' x : t, f x := (hs.hasProd.mul_disjoint hd ht.hasProd).tprod_eq @[to_additive] theorem tprod_finset_bUnion_disjoint {ι} {s : Finset ι} {t : ι → Set β} (hd : (s : Set ι).Pairwise (Disjoint on t)) (hf : ∀ i ∈ s, Multipliable (f ∘ (↑) : t i → α)) : ∏' x : ⋃ i ∈ s, t i, f x = ∏ i ∈ s, ∏' x : t i, f x := (hasProd_prod_disjoint _ hd fun i hi ↦ (hf i hi).hasProd).tprod_eq end ContinuousMul end tprod
Topology\Algebra\InfiniteSum\Constructions.lean
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl -/ import Mathlib.Topology.Algebra.InfiniteSum.Group import Mathlib.Topology.Algebra.Star /-! # Topological sums and functorial constructions Lemmas on the interaction of `tprod`, `tsum`, `HasProd`, `HasSum` etc with products, Sigma and Pi types, `MulOpposite`, etc. -/ noncomputable section open Filter Finset Function open scoped Topology variable {α β γ δ : Type*} /-! ## Product, Sigma and Pi types -/ section ProdDomain variable [CommMonoid α] [TopologicalSpace α] @[to_additive] theorem hasProd_pi_single [DecidableEq β] (b : β) (a : α) : HasProd (Pi.mulSingle b a) a := by convert hasProd_ite_eq b a simp [Pi.mulSingle_apply] @[to_additive (attr := simp)] theorem tprod_pi_single [DecidableEq β] (b : β) (a : α) : ∏' b', Pi.mulSingle b a b' = a := by rw [tprod_eq_mulSingle b] · simp · intro b' hb'; simp [hb'] @[to_additive tsum_setProd_singleton_left] lemma tprod_setProd_singleton_left (b : β) (t : Set γ) (f : β × γ → α) : (∏' x : {b} ×ˢ t, f x) = ∏' c : t, f (b, c) := by rw [tprod_congr_set_coe _ Set.singleton_prod, tprod_image _ (Prod.mk.inj_left b).injOn] @[to_additive tsum_setProd_singleton_right] lemma tprod_setProd_singleton_right (s : Set β) (c : γ) (f : β × γ → α) : (∏' x : s ×ˢ {c}, f x) = ∏' b : s, f (b, c) := by rw [tprod_congr_set_coe _ Set.prod_singleton, tprod_image _ (Prod.mk.inj_right c).injOn] @[to_additive Summable.prod_symm] theorem Multipliable.prod_symm {f : β × γ → α} (hf : Multipliable f) : Multipliable fun p : γ × β ↦ f p.swap := (Equiv.prodComm γ β).multipliable_iff.2 hf end ProdDomain section ProdCodomain variable [CommMonoid α] [TopologicalSpace α] [CommMonoid γ] [TopologicalSpace γ] @[to_additive HasSum.prod_mk] theorem HasProd.prod_mk {f : β → α} {g : β → γ} {a : α} {b : γ} (hf : HasProd f a) (hg : HasProd g b) : HasProd (fun x ↦ (⟨f x, g x⟩ : α × γ)) ⟨a, b⟩ := by simp [HasProd, ← prod_mk_prod, Filter.Tendsto.prod_mk_nhds hf hg] end ProdCodomain section ContinuousMul variable [CommMonoid α] [TopologicalSpace α] [ContinuousMul α] section RegularSpace variable [RegularSpace α] @[to_additive] theorem HasProd.sigma {γ : β → Type*} {f : (Σ b : β, γ b) → α} {g : β → α} {a : α} (ha : HasProd f a) (hf : ∀ b, HasProd (fun c ↦ f ⟨b, c⟩) (g b)) : HasProd g a := by classical refine (atTop_basis.tendsto_iff (closed_nhds_basis a)).mpr ?_ rintro s ⟨hs, hsc⟩ rcases mem_atTop_sets.mp (ha hs) with ⟨u, hu⟩ use u.image Sigma.fst, trivial intro bs hbs simp only [Set.mem_preimage, Finset.le_iff_subset] at hu have : Tendsto (fun t : Finset (Σb, γ b) ↦ ∏ p ∈ t.filter fun p ↦ p.1 ∈ bs, f p) atTop (𝓝 <| ∏ b ∈ bs, g b) := by simp only [← sigma_preimage_mk, prod_sigma] refine tendsto_finset_prod _ fun b _ ↦ ?_ change Tendsto (fun t ↦ (fun t ↦ ∏ s ∈ t, f ⟨b, s⟩) (preimage t (Sigma.mk b) _)) atTop (𝓝 (g b)) exact (hf b).comp (tendsto_finset_preimage_atTop_atTop (sigma_mk_injective)) refine hsc.mem_of_tendsto this (eventually_atTop.2 ⟨u, fun t ht ↦ hu _ fun x hx ↦ ?_⟩) exact mem_filter.2 ⟨ht hx, hbs <| mem_image_of_mem _ hx⟩ /-- If a function `f` on `β × γ` has product `a` and for each `b` the restriction of `f` to `{b} × γ` has product `g b`, then the function `g` has product `a`. -/ @[to_additive HasSum.prod_fiberwise "If a series `f` on `β × γ` has sum `a` and for each `b` the restriction of `f` to `{b} × γ` has sum `g b`, then the series `g` has sum `a`."] theorem HasProd.prod_fiberwise {f : β × γ → α} {g : β → α} {a : α} (ha : HasProd f a) (hf : ∀ b, HasProd (fun c ↦ f (b, c)) (g b)) : HasProd g a := HasProd.sigma ((Equiv.sigmaEquivProd β γ).hasProd_iff.2 ha) hf @[to_additive] theorem Multipliable.sigma' {γ : β → Type*} {f : (Σb : β, γ b) → α} (ha : Multipliable f) (hf : ∀ b, Multipliable fun c ↦ f ⟨b, c⟩) : Multipliable fun b ↦ ∏' c, f ⟨b, c⟩ := (ha.hasProd.sigma fun b ↦ (hf b).hasProd).multipliable end RegularSpace section T3Space variable [T3Space α] @[to_additive] theorem HasProd.sigma_of_hasProd {γ : β → Type*} {f : (Σb : β, γ b) → α} {g : β → α} {a : α} (ha : HasProd g a) (hf : ∀ b, HasProd (fun c ↦ f ⟨b, c⟩) (g b)) (hf' : Multipliable f) : HasProd f a := by simpa [(hf'.hasProd.sigma hf).unique ha] using hf'.hasProd @[to_additive] theorem tprod_sigma' {γ : β → Type*} {f : (Σb : β, γ b) → α} (h₁ : ∀ b, Multipliable fun c ↦ f ⟨b, c⟩) (h₂ : Multipliable f) : ∏' p, f p = ∏' (b) (c), f ⟨b, c⟩ := (h₂.hasProd.sigma fun b ↦ (h₁ b).hasProd).tprod_eq.symm @[to_additive tsum_prod'] theorem tprod_prod' {f : β × γ → α} (h : Multipliable f) (h₁ : ∀ b, Multipliable fun c ↦ f (b, c)) : ∏' p, f p = ∏' (b) (c), f (b, c) := (h.hasProd.prod_fiberwise fun b ↦ (h₁ b).hasProd).tprod_eq.symm @[to_additive] theorem tprod_comm' {f : β → γ → α} (h : Multipliable (Function.uncurry f)) (h₁ : ∀ b, Multipliable (f b)) (h₂ : ∀ c, Multipliable fun b ↦ f b c) : ∏' (c) (b), f b c = ∏' (b) (c), f b c := by erw [← tprod_prod' h h₁, ← tprod_prod' h.prod_symm h₂, ← (Equiv.prodComm γ β).tprod_eq (uncurry f)] rfl end T3Space end ContinuousMul section CompleteSpace variable [CommGroup α] [UniformSpace α] [UniformGroup α] [CompleteSpace α] @[to_additive] theorem Multipliable.sigma_factor {γ : β → Type*} {f : (Σb : β, γ b) → α} (ha : Multipliable f) (b : β) : Multipliable fun c ↦ f ⟨b, c⟩ := ha.comp_injective sigma_mk_injective @[to_additive] theorem Multipliable.sigma {γ : β → Type*} {f : (Σb : β, γ b) → α} (ha : Multipliable f) : Multipliable fun b ↦ ∏' c, f ⟨b, c⟩ := ha.sigma' fun b ↦ ha.sigma_factor b @[to_additive Summable.prod_factor] theorem Multipliable.prod_factor {f : β × γ → α} (h : Multipliable f) (b : β) : Multipliable fun c ↦ f (b, c) := h.comp_injective fun _ _ h ↦ (Prod.ext_iff.1 h).2 @[to_additive] lemma HasProd.tprod_fiberwise [T2Space α] {f : β → α} {a : α} (hf : HasProd f a) (g : β → γ) : HasProd (fun c : γ ↦ ∏' b : g ⁻¹' {c}, f b) a := (((Equiv.sigmaFiberEquiv g).hasProd_iff).mpr hf).sigma <| fun _ ↦ ((hf.multipliable.subtype _).hasProd_iff).mpr rfl section CompleteT0Space variable [T0Space α] @[to_additive] theorem tprod_sigma {γ : β → Type*} {f : (Σb : β, γ b) → α} (ha : Multipliable f) : ∏' p, f p = ∏' (b) (c), f ⟨b, c⟩ := tprod_sigma' (fun b ↦ ha.sigma_factor b) ha @[to_additive tsum_prod] theorem tprod_prod {f : β × γ → α} (h : Multipliable f) : ∏' p, f p = ∏' (b) (c), f ⟨b, c⟩ := tprod_prod' h h.prod_factor @[to_additive] theorem tprod_comm {f : β → γ → α} (h : Multipliable (Function.uncurry f)) : ∏' (c) (b), f b c = ∏' (b) (c), f b c := tprod_comm' h h.prod_factor h.prod_symm.prod_factor end CompleteT0Space end CompleteSpace section Pi variable {ι : Type*} {π : α → Type*} [∀ x, CommMonoid (π x)] [∀ x, TopologicalSpace (π x)] @[to_additive] theorem Pi.hasProd {f : ι → ∀ x, π x} {g : ∀ x, π x} : HasProd f g ↔ ∀ x, HasProd (fun i ↦ f i x) (g x) := by simp only [HasProd, tendsto_pi_nhds, prod_apply] @[to_additive] theorem Pi.multipliable {f : ι → ∀ x, π x} : Multipliable f ↔ ∀ x, Multipliable fun i ↦ f i x := by simp only [Multipliable, Pi.hasProd, Classical.skolem] @[to_additive] theorem tprod_apply [∀ x, T2Space (π x)] {f : ι → ∀ x, π x} {x : α} (hf : Multipliable f) : (∏' i, f i) x = ∏' i, f i x := (Pi.hasProd.mp hf.hasProd x).tprod_eq.symm end Pi /-! ## Multiplicative opposite -/ section MulOpposite open MulOpposite variable [AddCommMonoid α] [TopologicalSpace α] {f : β → α} {a : α} theorem HasSum.op (hf : HasSum f a) : HasSum (fun a ↦ op (f a)) (op a) := (hf.map (@opAddEquiv α _) continuous_op : _) theorem Summable.op (hf : Summable f) : Summable (op ∘ f) := hf.hasSum.op.summable theorem HasSum.unop {f : β → αᵐᵒᵖ} {a : αᵐᵒᵖ} (hf : HasSum f a) : HasSum (fun a ↦ unop (f a)) (unop a) := (hf.map (@opAddEquiv α _).symm continuous_unop : _) theorem Summable.unop {f : β → αᵐᵒᵖ} (hf : Summable f) : Summable (unop ∘ f) := hf.hasSum.unop.summable @[simp] theorem hasSum_op : HasSum (fun a ↦ op (f a)) (op a) ↔ HasSum f a := ⟨HasSum.unop, HasSum.op⟩ @[simp] theorem hasSum_unop {f : β → αᵐᵒᵖ} {a : αᵐᵒᵖ} : HasSum (fun a ↦ unop (f a)) (unop a) ↔ HasSum f a := ⟨HasSum.op, HasSum.unop⟩ @[simp] theorem summable_op : (Summable fun a ↦ op (f a)) ↔ Summable f := ⟨Summable.unop, Summable.op⟩ -- Porting note: This theorem causes a loop easily in Lean 4, so the priority should be `low`. @[simp low] theorem summable_unop {f : β → αᵐᵒᵖ} : (Summable fun a ↦ unop (f a)) ↔ Summable f := ⟨Summable.op, Summable.unop⟩ theorem tsum_op [T2Space α] : ∑' x, op (f x) = op (∑' x, f x) := by by_cases h : Summable f · exact h.hasSum.op.tsum_eq · have ho := summable_op.not.mpr h rw [tsum_eq_zero_of_not_summable h, tsum_eq_zero_of_not_summable ho, op_zero] theorem tsum_unop [T2Space α] {f : β → αᵐᵒᵖ} : ∑' x, unop (f x) = unop (∑' x, f x) := op_injective tsum_op.symm end MulOpposite /-! ## Interaction with the star -/ section ContinuousStar variable [AddCommMonoid α] [TopologicalSpace α] [StarAddMonoid α] [ContinuousStar α] {f : β → α} {a : α} theorem HasSum.star (h : HasSum f a) : HasSum (fun b ↦ star (f b)) (star a) := by simpa only using h.map (starAddEquiv : α ≃+ α) continuous_star theorem Summable.star (hf : Summable f) : Summable fun b ↦ star (f b) := hf.hasSum.star.summable theorem Summable.ofStar (hf : Summable fun b ↦ Star.star (f b)) : Summable f := by simpa only [star_star] using hf.star @[simp] theorem summable_star_iff : (Summable fun b ↦ star (f b)) ↔ Summable f := ⟨Summable.ofStar, Summable.star⟩ @[simp] theorem summable_star_iff' : Summable (star f) ↔ Summable f := summable_star_iff theorem tsum_star [T2Space α] : star (∑' b, f b) = ∑' b, star (f b) := by by_cases hf : Summable f · exact hf.hasSum.star.tsum_eq.symm · rw [tsum_eq_zero_of_not_summable hf, tsum_eq_zero_of_not_summable (mt Summable.ofStar hf), star_zero] end ContinuousStar
Topology\Algebra\InfiniteSum\Defs.lean
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl -/ import Mathlib.Topology.Separation import Mathlib.Algebra.BigOperators.Finprod /-! # Infinite sum and product over a topological monoid This file defines unconditionally convergent sums over a commutative topological additive monoid. For Euclidean spaces (finite dimensional Banach spaces) this is equivalent to absolute convergence. We also define unconditionally convergent products over a commutative topological multiplicative monoid. Note: There are summable sequences which are not unconditionally convergent! The other way holds generally, see `HasSum.tendsto_sum_nat`. ## Implementation notes We say that a function `f : β → α` has an unconditional product of `a` if the function `fun s : Finset β ↦ ∏ b ∈ s, f b` converges to `a` on the `atTop` filter on `Finset β`. In other words, for every neighborhood `U` of `a`, there exists a finite set `s : Finset β` of indices such that `∏ b ∈ s', f b ∈ U` for any finite set `s'` which is a superset of `s`. This may yield some unexpected results. For example, according to this definition, the product `∏' n : ℕ, (1 : ℝ) / 2` unconditionally exists and is equal to `0`. More strikingly, the product `∏' n : ℕ, (n : ℝ)` unconditionally exists and is equal to `0`, because one of its terms is `0` (even though the product of the remaining terms diverges). Users who would prefer that these products be considered not to exist can carry them out in the unit group `ℝˣ` rather than in `ℝ`. ## References * Bourbaki: General Topology (1995), Chapter 3 §5 (Infinite sums in commutative groups) -/ /- **NOTE**. This file is intended to be kept short, just enough to state the basic definitions and six key lemmas relating them together, namely `Summable.hasSum`, `Multipliable.hasProd`, `HasSum.tsum_eq`, `HasProd.tprod_eq`, `Summable.hasSum_iff`, and `Multipliable.hasProd_iff`. Do not add further lemmas here -- add them to `InfiniteSum.Basic` or (preferably) another, more specific file. -/ noncomputable section open Filter Function open scoped Topology variable {α β γ : Type*} section HasProd variable [CommMonoid α] [TopologicalSpace α] /-- Infinite product on a topological monoid The `atTop` filter on `Finset β` is the limit of all finite sets towards the entire type. So we take the product over bigger and bigger sets. This product operation is invariant under reordering. For the definition and many statements, `α` does not need to be a topological monoid. We only add this assumption later, for the lemmas where it is relevant. These are defined in an identical way to infinite sums (`HasSum`). For example, we say that the function `ℕ → ℝ` sending `n` to `1 / 2` has a product of `0`, rather than saying that it does not converge as some authors would. -/ @[to_additive "Infinite sum on a topological monoid The `atTop` filter on `Finset β` is the limit of all finite sets towards the entire type. So we sum up bigger and bigger sets. This sum operation is invariant under reordering. In particular, the function `ℕ → ℝ` sending `n` to `(-1)^n / (n+1)` does not have a sum for this definition, but a series which is absolutely convergent will have the correct sum. This is based on Mario Carneiro's [infinite sum `df-tsms` in Metamath](http://us.metamath.org/mpeuni/df-tsms.html). For the definition and many statements, `α` does not need to be a topological monoid. We only add this assumption later, for the lemmas where it is relevant."] def HasProd (f : β → α) (a : α) : Prop := Tendsto (fun s : Finset β ↦ ∏ b ∈ s, f b) atTop (𝓝 a) /-- `Multipliable f` means that `f` has some (infinite) product. Use `tprod` to get the value. -/ @[to_additive "`Summable f` means that `f` has some (infinite) sum. Use `tsum` to get the value."] def Multipliable (f : β → α) : Prop := ∃ a, HasProd f a open scoped Classical in /-- `∏' i, f i` is the product of `f` it exists, or 1 otherwise. -/ @[to_additive "`∑' i, f i` is the sum of `f` it exists, or 0 otherwise."] noncomputable irreducible_def tprod {β} (f : β → α) := if h : Multipliable f then /- Note that the product might not be uniquely defined if the topology is not separated. When the multiplicative support of `f` is finite, we make the most reasonable choice to use the product over the multiplicative support. Otherwise, we choose arbitrarily an `a` satisfying `HasProd f a`. -/ if (mulSupport f).Finite then finprod f else h.choose else 1 -- see Note [operator precedence of big operators] @[inherit_doc tprod] notation3 "∏' "(...)", "r:67:(scoped f => tprod f) => r @[inherit_doc tsum] notation3 "∑' "(...)", "r:67:(scoped f => tsum f) => r variable {f g : β → α} {a b : α} {s : Finset β} @[to_additive] theorem HasProd.multipliable (h : HasProd f a) : Multipliable f := ⟨a, h⟩ @[to_additive] theorem tprod_eq_one_of_not_multipliable (h : ¬Multipliable f) : ∏' b, f b = 1 := by simp [tprod_def, h] @[to_additive] theorem Function.Injective.hasProd_iff {g : γ → β} (hg : Injective g) (hf : ∀ x, x ∉ Set.range g → f x = 1) : HasProd (f ∘ g) a ↔ HasProd f a := by simp only [HasProd, Tendsto, comp_apply, hg.map_atTop_finset_prod_eq hf] @[to_additive] theorem hasProd_subtype_iff_of_mulSupport_subset {s : Set β} (hf : mulSupport f ⊆ s) : HasProd (f ∘ (↑) : s → α) a ↔ HasProd f a := Subtype.coe_injective.hasProd_iff <| by simpa using mulSupport_subset_iff'.1 hf @[to_additive] theorem hasProd_fintype [Fintype β] (f : β → α) : HasProd f (∏ b, f b) := OrderTop.tendsto_atTop_nhds _ @[to_additive] protected theorem Finset.hasProd (s : Finset β) (f : β → α) : HasProd (f ∘ (↑) : (↑s : Set β) → α) (∏ b ∈ s, f b) := by rw [← prod_attach] exact hasProd_fintype _ /-- If a function `f` is `1` outside of a finite set `s`, then it `HasProd` `∏ b ∈ s, f b`. -/ @[to_additive "If a function `f` vanishes outside of a finite set `s`, then it `HasSum` `∑ b ∈ s, f b`."] theorem hasProd_prod_of_ne_finset_one (hf : ∀ b ∉ s, f b = 1) : HasProd f (∏ b ∈ s, f b) := (hasProd_subtype_iff_of_mulSupport_subset <| mulSupport_subset_iff'.2 hf).1 <| s.hasProd f @[to_additive] theorem multipliable_of_ne_finset_one (hf : ∀ b ∉ s, f b = 1) : Multipliable f := (hasProd_prod_of_ne_finset_one hf).multipliable @[to_additive] theorem Multipliable.hasProd (ha : Multipliable f) : HasProd f (∏' b, f b) := by simp only [tprod_def, ha, dite_true] by_cases H : (mulSupport f).Finite · simp [H, hasProd_prod_of_ne_finset_one, finprod_eq_prod] · simpa [H] using ha.choose_spec @[to_additive] theorem HasProd.unique {a₁ a₂ : α} [T2Space α] : HasProd f a₁ → HasProd f a₂ → a₁ = a₂ := by classical exact tendsto_nhds_unique variable [T2Space α] @[to_additive] theorem HasProd.tprod_eq (ha : HasProd f a) : ∏' b, f b = a := (Multipliable.hasProd ⟨a, ha⟩).unique ha @[to_additive] theorem Multipliable.hasProd_iff (h : Multipliable f) : HasProd f a ↔ ∏' b, f b = a := Iff.intro HasProd.tprod_eq fun eq ↦ eq ▸ h.hasProd end HasProd
Topology\Algebra\InfiniteSum\Group.lean
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl -/ import Mathlib.Topology.Algebra.InfiniteSum.Basic import Mathlib.Topology.Algebra.UniformGroup /-! # Infinite sums and products in topological groups Lemmas on topological sums in groups (as opposed to monoids). -/ noncomputable section open Filter Finset Function open scoped Topology variable {α β γ δ : Type*} section TopologicalGroup variable [CommGroup α] [TopologicalSpace α] [TopologicalGroup α] variable {f g : β → α} {a a₁ a₂ : α} -- `by simpa using` speeds up elaboration. Why? @[to_additive] theorem HasProd.inv (h : HasProd f a) : HasProd (fun b ↦ (f b)⁻¹) a⁻¹ := by simpa only using h.map (MonoidHom.id α)⁻¹ continuous_inv @[to_additive] theorem Multipliable.inv (hf : Multipliable f) : Multipliable fun b ↦ (f b)⁻¹ := hf.hasProd.inv.multipliable @[to_additive] theorem Multipliable.of_inv (hf : Multipliable fun b ↦ (f b)⁻¹) : Multipliable f := by simpa only [inv_inv] using hf.inv @[to_additive] theorem multipliable_inv_iff : (Multipliable fun b ↦ (f b)⁻¹) ↔ Multipliable f := ⟨Multipliable.of_inv, Multipliable.inv⟩ @[to_additive] theorem HasProd.div (hf : HasProd f a₁) (hg : HasProd g a₂) : HasProd (fun b ↦ f b / g b) (a₁ / a₂) := by simp only [div_eq_mul_inv] exact hf.mul hg.inv @[to_additive] theorem Multipliable.div (hf : Multipliable f) (hg : Multipliable g) : Multipliable fun b ↦ f b / g b := (hf.hasProd.div hg.hasProd).multipliable @[to_additive] theorem Multipliable.trans_div (hg : Multipliable g) (hfg : Multipliable fun b ↦ f b / g b) : Multipliable f := by simpa only [div_mul_cancel] using hfg.mul hg @[to_additive] theorem multipliable_iff_of_multipliable_div (hfg : Multipliable fun b ↦ f b / g b) : Multipliable f ↔ Multipliable g := ⟨fun hf ↦ hf.trans_div <| by simpa only [inv_div] using hfg.inv, fun hg ↦ hg.trans_div hfg⟩ @[to_additive] theorem HasProd.update (hf : HasProd f a₁) (b : β) [DecidableEq β] (a : α) : HasProd (update f b a) (a / f b * a₁) := by convert (hasProd_ite_eq b (a / f b)).mul hf with b' by_cases h : b' = b · rw [h, update_same] simp [eq_self_iff_true, if_true, sub_add_cancel] · simp only [h, update_noteq, if_false, Ne, one_mul, not_false_iff] @[to_additive] theorem Multipliable.update (hf : Multipliable f) (b : β) [DecidableEq β] (a : α) : Multipliable (update f b a) := (hf.hasProd.update b a).multipliable @[to_additive] theorem HasProd.hasProd_compl_iff {s : Set β} (hf : HasProd (f ∘ (↑) : s → α) a₁) : HasProd (f ∘ (↑) : ↑sᶜ → α) a₂ ↔ HasProd f (a₁ * a₂) := by refine ⟨fun h ↦ hf.mul_compl h, fun h ↦ ?_⟩ rw [hasProd_subtype_iff_mulIndicator] at hf ⊢ rw [Set.mulIndicator_compl] simpa only [div_eq_mul_inv, mul_inv_cancel_comm] using h.div hf @[to_additive] theorem HasProd.hasProd_iff_compl {s : Set β} (hf : HasProd (f ∘ (↑) : s → α) a₁) : HasProd f a₂ ↔ HasProd (f ∘ (↑) : ↑sᶜ → α) (a₂ / a₁) := Iff.symm <| hf.hasProd_compl_iff.trans <| by rw [mul_div_cancel] @[to_additive] theorem Multipliable.multipliable_compl_iff {s : Set β} (hf : Multipliable (f ∘ (↑) : s → α)) : Multipliable (f ∘ (↑) : ↑sᶜ → α) ↔ Multipliable f where mp := fun ⟨_, ha⟩ ↦ (hf.hasProd.hasProd_compl_iff.1 ha).multipliable mpr := fun ⟨_, ha⟩ ↦ (hf.hasProd.hasProd_iff_compl.1 ha).multipliable @[to_additive] protected theorem Finset.hasProd_compl_iff (s : Finset β) : HasProd (fun x : { x // x ∉ s } ↦ f x) a ↔ HasProd f (a * ∏ i ∈ s, f i) := (s.hasProd f).hasProd_compl_iff.trans <| by rw [mul_comm] @[to_additive] protected theorem Finset.hasProd_iff_compl (s : Finset β) : HasProd f a ↔ HasProd (fun x : { x // x ∉ s } ↦ f x) (a / ∏ i ∈ s, f i) := (s.hasProd f).hasProd_iff_compl @[to_additive] protected theorem Finset.multipliable_compl_iff (s : Finset β) : (Multipliable fun x : { x // x ∉ s } ↦ f x) ↔ Multipliable f := (s.multipliable f).multipliable_compl_iff @[to_additive] theorem Set.Finite.multipliable_compl_iff {s : Set β} (hs : s.Finite) : Multipliable (f ∘ (↑) : ↑sᶜ → α) ↔ Multipliable f := (hs.multipliable f).multipliable_compl_iff @[to_additive] theorem hasProd_ite_div_hasProd [DecidableEq β] (hf : HasProd f a) (b : β) : HasProd (fun n ↦ ite (n = b) 1 (f n)) (a / f b) := by convert hf.update b 1 using 1 · ext n rw [Function.update_apply] · rw [div_mul_eq_mul_div, one_mul] section tprod variable [T2Space α] @[to_additive] theorem tprod_inv : ∏' b, (f b)⁻¹ = (∏' b, f b)⁻¹ := by by_cases hf : Multipliable f · exact hf.hasProd.inv.tprod_eq · simp [tprod_eq_one_of_not_multipliable hf, tprod_eq_one_of_not_multipliable (mt Multipliable.of_inv hf)] @[to_additive] theorem tprod_div (hf : Multipliable f) (hg : Multipliable g) : ∏' b, (f b / g b) = (∏' b, f b) / ∏' b, g b := (hf.hasProd.div hg.hasProd).tprod_eq @[to_additive] theorem prod_mul_tprod_compl {s : Finset β} (hf : Multipliable f) : (∏ x ∈ s, f x) * ∏' x : ↑(s : Set β)ᶜ, f x = ∏' x, f x := ((s.hasProd f).mul_compl (s.multipliable_compl_iff.2 hf).hasProd).tprod_eq.symm /-- Let `f : β → α` be a multipliable function and let `b ∈ β` be an index. Lemma `tprod_eq_mul_tprod_ite` writes `∏ n, f n` as `f b` times the product of the remaining terms. -/ @[to_additive "Let `f : β → α` be a summable function and let `b ∈ β` be an index. Lemma `tsum_eq_add_tsum_ite` writes `Σ' n, f n` as `f b` plus the sum of the remaining terms."] theorem tprod_eq_mul_tprod_ite [DecidableEq β] (hf : Multipliable f) (b : β) : ∏' n, f n = f b * ∏' n, ite (n = b) 1 (f n) := by rw [(hasProd_ite_div_hasProd hf.hasProd b).tprod_eq] exact (mul_div_cancel _ _).symm end tprod end TopologicalGroup section UniformGroup variable [CommGroup α] [UniformSpace α] /-- The **Cauchy criterion** for infinite products, also known as the **Cauchy convergence test** -/ @[to_additive "The **Cauchy criterion** for infinite sums, also known as the **Cauchy convergence test**"] theorem multipliable_iff_cauchySeq_finset [CompleteSpace α] {f : β → α} : Multipliable f ↔ CauchySeq fun s : Finset β ↦ ∏ b ∈ s, f b := by classical exact cauchy_map_iff_exists_tendsto.symm variable [UniformGroup α] {f g : β → α} {a a₁ a₂ : α} @[to_additive] theorem cauchySeq_finset_iff_prod_vanishing : (CauchySeq fun s : Finset β ↦ ∏ b ∈ s, f b) ↔ ∀ e ∈ 𝓝 (1 : α), ∃ s : Finset β, ∀ t, Disjoint t s → (∏ b ∈ t, f b) ∈ e := by classical simp only [CauchySeq, cauchy_map_iff, and_iff_right atTop_neBot, prod_atTop_atTop_eq, uniformity_eq_comap_nhds_one α, tendsto_comap_iff, (· ∘ ·), atTop_neBot, true_and] rw [tendsto_atTop'] constructor · intro h e he obtain ⟨⟨s₁, s₂⟩, h⟩ := h e he use s₁ ∪ s₂ intro t ht specialize h (s₁ ∪ s₂, s₁ ∪ s₂ ∪ t) ⟨le_sup_left, le_sup_of_le_left le_sup_right⟩ simpa only [Finset.prod_union ht.symm, mul_div_cancel_left] using h · rintro h e he rcases exists_nhds_split_inv he with ⟨d, hd, hde⟩ rcases h d hd with ⟨s, h⟩ use (s, s) rintro ⟨t₁, t₂⟩ ⟨ht₁, ht₂⟩ have : ((∏ b ∈ t₂, f b) / ∏ b ∈ t₁, f b) = (∏ b ∈ t₂ \ s, f b) / ∏ b ∈ t₁ \ s, f b := by rw [← Finset.prod_sdiff ht₁, ← Finset.prod_sdiff ht₂, mul_div_mul_right_eq_div] simp only [this] exact hde _ (h _ Finset.sdiff_disjoint) _ (h _ Finset.sdiff_disjoint) @[to_additive] theorem cauchySeq_finset_iff_tprod_vanishing : (CauchySeq fun s : Finset β ↦ ∏ b ∈ s, f b) ↔ ∀ e ∈ 𝓝 (1 : α), ∃ s : Finset β, ∀ t : Set β, Disjoint t s → (∏' b : t, f b) ∈ e := by simp_rw [cauchySeq_finset_iff_prod_vanishing, Set.disjoint_left, disjoint_left] refine ⟨fun vanish e he ↦ ?_, fun vanish e he ↦ ?_⟩ · obtain ⟨o, ho, o_closed, oe⟩ := exists_mem_nhds_isClosed_subset he obtain ⟨s, hs⟩ := vanish o ho refine ⟨s, fun t hts ↦ oe ?_⟩ by_cases ht : Multipliable fun a : t ↦ f a · classical refine o_closed.mem_of_tendsto ht.hasProd (eventually_of_forall fun t' ↦ ?_) rw [← prod_subtype_map_embedding fun _ _ ↦ by rfl] apply hs simp_rw [Finset.mem_map] rintro _ ⟨b, -, rfl⟩ exact hts b.prop · exact tprod_eq_one_of_not_multipliable ht ▸ mem_of_mem_nhds ho · obtain ⟨s, hs⟩ := vanish _ he exact ⟨s, fun t hts ↦ (t.tprod_subtype f).symm ▸ hs _ hts⟩ variable [CompleteSpace α] @[to_additive] theorem multipliable_iff_vanishing : Multipliable f ↔ ∀ e ∈ 𝓝 (1 : α), ∃ s : Finset β, ∀ t, Disjoint t s → (∏ b ∈ t, f b) ∈ e := by rw [multipliable_iff_cauchySeq_finset, cauchySeq_finset_iff_prod_vanishing] @[to_additive] theorem multipliable_iff_tprod_vanishing : Multipliable f ↔ ∀ e ∈ 𝓝 (1 : α), ∃ s : Finset β, ∀ t : Set β, Disjoint t s → (∏' b : t, f b) ∈ e := by rw [multipliable_iff_cauchySeq_finset, cauchySeq_finset_iff_tprod_vanishing] -- TODO: generalize to monoid with a uniform continuous subtraction operator: `(a + b) - b = a` @[to_additive] theorem Multipliable.multipliable_of_eq_one_or_self (hf : Multipliable f) (h : ∀ b, g b = 1 ∨ g b = f b) : Multipliable g := by classical exact multipliable_iff_vanishing.2 fun e he ↦ let ⟨s, hs⟩ := multipliable_iff_vanishing.1 hf e he ⟨s, fun t ht ↦ have eq : ∏ b ∈ t.filter fun b ↦ g b = f b, f b = ∏ b ∈ t, g b := calc ∏ b ∈ t.filter fun b ↦ g b = f b, f b = ∏ b ∈ t.filter fun b ↦ g b = f b, g b := Finset.prod_congr rfl fun b hb ↦ (Finset.mem_filter.1 hb).2.symm _ = ∏ b ∈ t, g b := by {refine Finset.prod_subset (Finset.filter_subset _ _) ?_ intro b hbt hb simp only [Finset.mem_filter, and_iff_right hbt] at hb exact (h b).resolve_right hb} eq ▸ hs _ <| Finset.disjoint_of_subset_left (Finset.filter_subset _ _) ht⟩ @[to_additive] protected theorem Multipliable.mulIndicator (hf : Multipliable f) (s : Set β) : Multipliable (s.mulIndicator f) := hf.multipliable_of_eq_one_or_self <| Set.mulIndicator_eq_one_or_self _ _ @[to_additive] theorem Multipliable.comp_injective {i : γ → β} (hf : Multipliable f) (hi : Injective i) : Multipliable (f ∘ i) := by simpa only [Set.mulIndicator_range_comp] using (hi.multipliable_iff (fun x hx ↦ Set.mulIndicator_of_not_mem hx _)).2 (hf.mulIndicator (Set.range i)) @[to_additive] theorem Multipliable.subtype (hf : Multipliable f) (s : Set β) : Multipliable (f ∘ (↑) : s → α) := hf.comp_injective Subtype.coe_injective @[to_additive] theorem multipliable_subtype_and_compl {s : Set β} : ((Multipliable fun x : s ↦ f x) ∧ Multipliable fun x : ↑sᶜ ↦ f x) ↔ Multipliable f := ⟨and_imp.2 Multipliable.mul_compl, fun h ↦ ⟨h.subtype s, h.subtype sᶜ⟩⟩ @[to_additive] theorem tprod_subtype_mul_tprod_subtype_compl [T2Space α] {f : β → α} (hf : Multipliable f) (s : Set β) : (∏' x : s, f x) * ∏' x : ↑sᶜ, f x = ∏' x, f x := ((hf.subtype s).hasProd.mul_compl (hf.subtype { x | x ∉ s }).hasProd).unique hf.hasProd @[to_additive] theorem prod_mul_tprod_subtype_compl [T2Space α] {f : β → α} (hf : Multipliable f) (s : Finset β) : (∏ x ∈ s, f x) * ∏' x : { x // x ∉ s }, f x = ∏' x, f x := by rw [← tprod_subtype_mul_tprod_subtype_compl hf s] simp only [Finset.tprod_subtype', mul_right_inj] rfl end UniformGroup section TopologicalGroup variable {G : Type*} [TopologicalSpace G] [CommGroup G] [TopologicalGroup G] {f : α → G} @[to_additive] theorem Multipliable.vanishing (hf : Multipliable f) ⦃e : Set G⦄ (he : e ∈ 𝓝 (1 : G)) : ∃ s : Finset α, ∀ t, Disjoint t s → (∏ k ∈ t, f k) ∈ e := by classical letI : UniformSpace G := TopologicalGroup.toUniformSpace G have : UniformGroup G := comm_topologicalGroup_is_uniform exact cauchySeq_finset_iff_prod_vanishing.1 hf.hasProd.cauchySeq e he @[to_additive] theorem Multipliable.tprod_vanishing (hf : Multipliable f) ⦃e : Set G⦄ (he : e ∈ 𝓝 1) : ∃ s : Finset α, ∀ t : Set α, Disjoint t s → (∏' b : t, f b) ∈ e := by classical letI : UniformSpace G := TopologicalGroup.toUniformSpace G have : UniformGroup G := comm_topologicalGroup_is_uniform exact cauchySeq_finset_iff_tprod_vanishing.1 hf.hasProd.cauchySeq e he /-- The product over the complement of a finset tends to `1` when the finset grows to cover the whole space. This does not need a multipliability assumption, as otherwise all such products are one. -/ @[to_additive "The sum over the complement of a finset tends to `0` when the finset grows to cover the whole space. This does not need a summability assumption, as otherwise all such sums are zero."] theorem tendsto_tprod_compl_atTop_one (f : α → G) : Tendsto (fun s : Finset α ↦ ∏' a : { x // x ∉ s }, f a) atTop (𝓝 1) := by classical by_cases H : Multipliable f · intro e he obtain ⟨s, hs⟩ := H.tprod_vanishing he rw [Filter.mem_map, mem_atTop_sets] exact ⟨s, fun t hts ↦ hs _ <| Set.disjoint_left.mpr fun a ha has ↦ ha (hts has)⟩ · refine tendsto_const_nhds.congr fun _ ↦ (tprod_eq_one_of_not_multipliable ?_).symm rwa [Finset.multipliable_compl_iff] /-- Product divergence test: if `f` is unconditionally multipliable, then `f x` tends to one along `cofinite`. -/ @[to_additive "Series divergence test: if `f` is unconditionally summable, then `f x` tends to zero along `cofinite`."] theorem Multipliable.tendsto_cofinite_one (hf : Multipliable f) : Tendsto f cofinite (𝓝 1) := by intro e he rw [Filter.mem_map] rcases hf.vanishing he with ⟨s, hs⟩ refine s.eventually_cofinite_nmem.mono fun x hx ↦ ?_ · simpa using hs {x} (disjoint_singleton_left.2 hx) @[to_additive] theorem Multipliable.countable_mulSupport [FirstCountableTopology G] [T1Space G] (hf : Multipliable f) : f.mulSupport.Countable := by simpa only [ker_nhds] using hf.tendsto_cofinite_one.countable_compl_preimage_ker @[to_additive] theorem multipliable_const_iff [Infinite β] [T2Space G] (a : G) : Multipliable (fun _ : β ↦ a) ↔ a = 1 := by refine ⟨fun h ↦ ?_, ?_⟩ · by_contra ha have : {a}ᶜ ∈ 𝓝 1 := compl_singleton_mem_nhds (Ne.symm ha) have : Finite β := by simpa [← Set.finite_univ_iff] using h.tendsto_cofinite_one this exact not_finite β · rintro rfl exact multipliable_one @[to_additive (attr := simp)] theorem tprod_const [T2Space G] (a : G) : ∏' _ : β, a = a ^ (Nat.card β) := by rcases finite_or_infinite β with hβ|hβ · letI : Fintype β := Fintype.ofFinite β rw [tprod_eq_prod (s := univ) (fun x hx ↦ (hx (mem_univ x)).elim)] simp only [prod_const, Nat.card_eq_fintype_card, Fintype.card] · simp only [Nat.card_eq_zero_of_infinite, pow_zero] rcases eq_or_ne a 1 with rfl|ha · simp · apply tprod_eq_one_of_not_multipliable simpa [multipliable_const_iff] using ha end TopologicalGroup
Topology\Algebra\InfiniteSum\GroupCompletion.lean
/- Copyright (c) 2024 Mitchell Lee. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mitchell Lee -/ import Mathlib.Topology.Algebra.GroupCompletion import Mathlib.Topology.Algebra.InfiniteSum.Group /-! # Infinite sums in the completion of a topological group -/ open UniformSpace.Completion variable {α β : Type*} [AddCommGroup α] [UniformSpace α] [UniformAddGroup α] /-- A function `f` has a sum in an uniform additive group `α` if and only if it has that sum in the completion of `α`. -/ theorem hasSum_iff_hasSum_compl (f : β → α) (a : α) : HasSum (toCompl ∘ f) a ↔ HasSum f a := (denseInducing_toCompl α).hasSum_iff f a /-- A function `f` is summable in a uniform additive group `α` if and only if it is summable in `Completion α` and its sum in `Completion α` lies in the range of `toCompl : α →+ Completion α`. -/ theorem summable_iff_summable_compl_and_tsum_mem (f : β → α) : Summable f ↔ Summable (toCompl ∘ f) ∧ ∑' i, toCompl (f i) ∈ Set.range toCompl := (denseInducing_toCompl α).summable_iff_tsum_comp_mem_range f /-- A function `f` is summable in a uniform additive group `α` if and only if the net of its partial sums is Cauchy and its sum in `Completion α` lies in the range of `toCompl : α →+ Completion α`. (The condition that the net of partial sums is Cauchy can be checked using `cauchySeq_finset_iff_sum_vanishing` or `cauchySeq_finset_iff_tsum_vanishing`.) -/ theorem summable_iff_cauchySeq_finset_and_tsum_mem (f : β → α) : Summable f ↔ CauchySeq (fun s : Finset β ↦ ∑ b in s, f b) ∧ ∑' i, toCompl (f i) ∈ Set.range toCompl := by classical constructor · rintro ⟨a, ha⟩ exact ⟨ha.cauchySeq, ((summable_iff_summable_compl_and_tsum_mem f).mp ⟨a, ha⟩).2⟩ · rintro ⟨h_cauchy, h_tsum⟩ apply (summable_iff_summable_compl_and_tsum_mem f).mpr constructor · apply summable_iff_cauchySeq_finset.mpr simp_rw [Function.comp_apply, ← map_sum] exact h_cauchy.map (uniformContinuous_coe α) · exact h_tsum /-- If a function `f` is summable in a uniform additive group `α`, then its sum in `α` is the same as its sum in `Completion α`. -/ theorem Summable.toCompl_tsum {f : β → α} (hf : Summable f) : ∑' i, toCompl (f i) = ∑' i, f i := (hf.map_tsum toCompl (continuous_coe α)).symm
Topology\Algebra\InfiniteSum\Module.lean
/- Copyright (c) 2020 Heather Macbeth. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Heather Macbeth, Yury Kudryashov, Frédéric Dupuis -/ import Mathlib.Topology.Algebra.InfiniteSum.Constructions import Mathlib.Topology.Algebra.Module.Basic /-! # Infinite sums in topological vector spaces -/ variable {α β γ δ : Type*} open Filter Finset Function section ConstSMul variable [Monoid γ] [TopologicalSpace α] [AddCommMonoid α] [DistribMulAction γ α] [ContinuousConstSMul γ α] {f : β → α} theorem HasSum.const_smul {a : α} (b : γ) (hf : HasSum f a) : HasSum (fun i ↦ b • f i) (b • a) := hf.map (DistribMulAction.toAddMonoidHom α _) <| continuous_const_smul _ theorem Summable.const_smul (b : γ) (hf : Summable f) : Summable fun i ↦ b • f i := (hf.hasSum.const_smul _).summable /-- Infinite sums commute with scalar multiplication. Version for scalars living in a `Monoid`, but requiring a summability hypothesis. -/ theorem tsum_const_smul [T2Space α] (b : γ) (hf : Summable f) : ∑' i, b • f i = b • ∑' i, f i := (hf.hasSum.const_smul _).tsum_eq /-- Infinite sums commute with scalar multiplication. Version for scalars living in a `Group`, but not requiring any summability hypothesis. -/ lemma tsum_const_smul' {γ : Type*} [Group γ] [DistribMulAction γ α] [ContinuousConstSMul γ α] [T2Space α] (g : γ) : ∑' (i : β), g • f i = g • ∑' (i : β), f i := by by_cases hf : Summable f · exact tsum_const_smul g hf rw [tsum_eq_zero_of_not_summable hf] simp only [smul_zero] let mul_g : α ≃+ α := DistribMulAction.toAddEquiv α g apply tsum_eq_zero_of_not_summable change ¬ Summable (mul_g ∘ f) rwa [Summable.map_iff_of_equiv mul_g] · apply continuous_const_smul · apply continuous_const_smul /-- Infinite sums commute with scalar multiplication. Version for scalars living in a `DivisionRing`; no summability hypothesis. This could be made to work for a `[GroupWithZero γ]` if there was such a thing as `DistribMulActionWithZero`. -/ lemma tsum_const_smul'' {γ : Type*} [DivisionRing γ] [Module γ α] [ContinuousConstSMul γ α] [T2Space α] (g : γ) : ∑' (i : β), g • f i = g • ∑' (i : β), f i := by rcases eq_or_ne g 0 with rfl | hg · simp · exact tsum_const_smul' (Units.mk0 g hg) end ConstSMul variable {ι κ R R₂ M M₂ : Type*} section SMulConst variable [Semiring R] [TopologicalSpace R] [TopologicalSpace M] [AddCommMonoid M] [Module R M] [ContinuousSMul R M] {f : ι → R} theorem HasSum.smul_const {r : R} (hf : HasSum f r) (a : M) : HasSum (fun z ↦ f z • a) (r • a) := hf.map ((smulAddHom R M).flip a) (continuous_id.smul continuous_const) theorem Summable.smul_const (hf : Summable f) (a : M) : Summable fun z ↦ f z • a := (hf.hasSum.smul_const _).summable theorem tsum_smul_const [T2Space M] (hf : Summable f) (a : M) : ∑' z, f z • a = (∑' z, f z) • a := (hf.hasSum.smul_const _).tsum_eq end SMulConst /-! Note we cannot derive the `mul` lemmas from these `smul` lemmas, as the `mul` versions do not require associativity, but `Module` does. -/ section tsum_smul_tsum variable [Semiring R] [AddCommMonoid M] [Module R M] variable [TopologicalSpace R] [TopologicalSpace M] [T3Space M] variable [ContinuousAdd M] [ContinuousSMul R M] variable {f : ι → R} {g : κ → M} {s : R} {t u : M} theorem HasSum.smul_eq (hf : HasSum f s) (hg : HasSum g t) (hfg : HasSum (fun x : ι × κ ↦ f x.1 • g x.2) u) : s • t = u := have key₁ : HasSum (fun i ↦ f i • t) (s • t) := hf.smul_const t have this : ∀ i : ι, HasSum (fun c : κ ↦ f i • g c) (f i • t) := fun i ↦ hg.const_smul (f i) have key₂ : HasSum (fun i ↦ f i • t) u := HasSum.prod_fiberwise hfg this key₁.unique key₂ theorem HasSum.smul (hf : HasSum f s) (hg : HasSum g t) (hfg : Summable fun x : ι × κ ↦ f x.1 • g x.2) : HasSum (fun x : ι × κ ↦ f x.1 • g x.2) (s • t) := let ⟨_u, hu⟩ := hfg (hf.smul_eq hg hu).symm ▸ hu /-- Scalar product of two infinites sums indexed by arbitrary types. -/ theorem tsum_smul_tsum (hf : Summable f) (hg : Summable g) (hfg : Summable fun x : ι × κ ↦ f x.1 • g x.2) : ((∑' x, f x) • ∑' y, g y) = ∑' z : ι × κ, f z.1 • g z.2 := hf.hasSum.smul_eq hg.hasSum hfg.hasSum end tsum_smul_tsum section HasSum -- Results in this section hold for continuous additive monoid homomorphisms or equivalences but we -- don't have bundled continuous additive homomorphisms. variable [Semiring R] [Semiring R₂] [AddCommMonoid M] [Module R M] [AddCommMonoid M₂] [Module R₂ M₂] [TopologicalSpace M] [TopologicalSpace M₂] {σ : R →+* R₂} {σ' : R₂ →+* R} [RingHomInvPair σ σ'] [RingHomInvPair σ' σ] /-- Applying a continuous linear map commutes with taking an (infinite) sum. -/ protected theorem ContinuousLinearMap.hasSum {f : ι → M} (φ : M →SL[σ] M₂) {x : M} (hf : HasSum f x) : HasSum (fun b : ι ↦ φ (f b)) (φ x) := by simpa only using hf.map φ.toLinearMap.toAddMonoidHom φ.continuous alias HasSum.mapL := ContinuousLinearMap.hasSum protected theorem ContinuousLinearMap.summable {f : ι → M} (φ : M →SL[σ] M₂) (hf : Summable f) : Summable fun b : ι ↦ φ (f b) := (hf.hasSum.mapL φ).summable alias Summable.mapL := ContinuousLinearMap.summable protected theorem ContinuousLinearMap.map_tsum [T2Space M₂] {f : ι → M} (φ : M →SL[σ] M₂) (hf : Summable f) : φ (∑' z, f z) = ∑' z, φ (f z) := (hf.hasSum.mapL φ).tsum_eq.symm /-- Applying a continuous linear map commutes with taking an (infinite) sum. -/ protected theorem ContinuousLinearEquiv.hasSum {f : ι → M} (e : M ≃SL[σ] M₂) {y : M₂} : HasSum (fun b : ι ↦ e (f b)) y ↔ HasSum f (e.symm y) := ⟨fun h ↦ by simpa only [e.symm.coe_coe, e.symm_apply_apply] using h.mapL (e.symm : M₂ →SL[σ'] M), fun h ↦ by simpa only [e.coe_coe, e.apply_symm_apply] using (e : M →SL[σ] M₂).hasSum h⟩ /-- Applying a continuous linear map commutes with taking an (infinite) sum. -/ protected theorem ContinuousLinearEquiv.hasSum' {f : ι → M} (e : M ≃SL[σ] M₂) {x : M} : HasSum (fun b : ι ↦ e (f b)) (e x) ↔ HasSum f x := by rw [e.hasSum, ContinuousLinearEquiv.symm_apply_apply] protected theorem ContinuousLinearEquiv.summable {f : ι → M} (e : M ≃SL[σ] M₂) : (Summable fun b : ι ↦ e (f b)) ↔ Summable f := ⟨fun hf ↦ (e.hasSum.1 hf.hasSum).summable, (e : M →SL[σ] M₂).summable⟩ theorem ContinuousLinearEquiv.tsum_eq_iff [T2Space M] [T2Space M₂] {f : ι → M} (e : M ≃SL[σ] M₂) {y : M₂} : (∑' z, e (f z)) = y ↔ ∑' z, f z = e.symm y := by by_cases hf : Summable f · exact ⟨fun h ↦ (e.hasSum.mp ((e.summable.mpr hf).hasSum_iff.mpr h)).tsum_eq, fun h ↦ (e.hasSum.mpr (hf.hasSum_iff.mpr h)).tsum_eq⟩ · have hf' : ¬Summable fun z ↦ e (f z) := fun h ↦ hf (e.summable.mp h) rw [tsum_eq_zero_of_not_summable hf, tsum_eq_zero_of_not_summable hf'] refine ⟨?_, fun H ↦ ?_⟩ · rintro rfl simp · simpa using congr_arg (fun z ↦ e z) H protected theorem ContinuousLinearEquiv.map_tsum [T2Space M] [T2Space M₂] {f : ι → M} (e : M ≃SL[σ] M₂) : e (∑' z, f z) = ∑' z, e (f z) := by refine symm (e.tsum_eq_iff.mpr ?_) rw [e.symm_apply_apply _] end HasSum section automorphize variable {M : Type*} [TopologicalSpace M] [AddCommMonoid M] [T2Space M] {R : Type*} [DivisionRing R] [Module R M] [ContinuousConstSMul R M] /-- Given a group `α` acting on a type `β`, and a function `f : β → M`, we "automorphize" `f` to a function `β ⧸ α → M` by summing over `α` orbits, `b ↦ ∑' (a : α), f(a • b)`. -/ @[to_additive "Given an additive group `α` acting on a type `β`, and a function `f : β → M`, we automorphize `f` to a function `β ⧸ α → M` by summing over `α` orbits, `b ↦ ∑' (a : α), f(a • b)`."] noncomputable def MulAction.automorphize [Group α] [MulAction α β] (f : β → M) : Quotient (MulAction.orbitRel α β) → M := by refine @Quotient.lift _ _ (_) (fun b ↦ ∑' (a : α), f (a • b)) ?_ intro b₁ b₂ ⟨a, (ha : a • b₂ = b₁)⟩ simp only rw [← ha] convert (Equiv.mulRight a).tsum_eq (fun a' ↦ f (a' • b₂)) using 1 simp only [Equiv.coe_mulRight] congr ext congr 1 simp only [mul_smul] /-- Automorphization of a function into an `R`-`Module` distributes, that is, commutes with the `R`-scalar multiplication. -/ lemma MulAction.automorphize_smul_left [Group α] [MulAction α β] (f : β → M) (g : Quotient (MulAction.orbitRel α β) → R) : MulAction.automorphize ((g ∘ (@Quotient.mk' _ (_))) • f) = g • (MulAction.automorphize f : Quotient (MulAction.orbitRel α β) → M) := by ext x apply @Quotient.inductionOn' β (MulAction.orbitRel α β) _ x _ intro b simp only [automorphize, Pi.smul_apply', comp_apply] set π : β → Quotient (MulAction.orbitRel α β) := Quotient.mk (MulAction.orbitRel α β) have H₁ : ∀ a : α, π (a • b) = π b := by intro a apply (@Quotient.eq _ (MulAction.orbitRel α β) (a • b) b).mpr use a change ∑' a : α, g (π (a • b)) • f (a • b) = g (π b) • ∑' a : α, f (a • b) simp_rw [H₁] exact tsum_const_smul'' _ /-- Automorphization of a function into an `R`-`Module` distributes, that is, commutes with the `R`-scalar multiplication. -/ lemma AddAction.automorphize_smul_left [AddGroup α] [AddAction α β] (f : β → M) (g : Quotient (AddAction.orbitRel α β) → R) : AddAction.automorphize ((g ∘ (@Quotient.mk' _ (_))) • f) = g • (AddAction.automorphize f : Quotient (AddAction.orbitRel α β) → M) := by ext x apply @Quotient.inductionOn' β (AddAction.orbitRel α β) _ x _ intro b simp only [automorphize, Pi.smul_apply', comp_apply] set π : β → Quotient (AddAction.orbitRel α β) := Quotient.mk (AddAction.orbitRel α β) have H₁ : ∀ a : α, π (a +ᵥ b) = π b := by intro a apply (@Quotient.eq _ (AddAction.orbitRel α β) (a +ᵥ b) b).mpr use a change ∑' a : α, g (π (a +ᵥ b)) • f (a +ᵥ b) = g (π b) • ∑' a : α, f (a +ᵥ b) simp_rw [H₁] exact tsum_const_smul'' _ attribute [to_additive existing MulAction.automorphize_smul_left] AddAction.automorphize_smul_left section variable {G : Type*} [Group G] {Γ : Subgroup G} /-- Given a subgroup `Γ` of a group `G`, and a function `f : G → M`, we "automorphize" `f` to a function `G ⧸ Γ → M` by summing over `Γ` orbits, `g ↦ ∑' (γ : Γ), f(γ • g)`. -/ @[to_additive "Given a subgroup `Γ` of an additive group `G`, and a function `f : G → M`, we automorphize `f` to a function `G ⧸ Γ → M` by summing over `Γ` orbits, `g ↦ ∑' (γ : Γ), f(γ • g)`."] noncomputable def QuotientGroup.automorphize (f : G → M) : G ⧸ Γ → M := MulAction.automorphize f /-- Automorphization of a function into an `R`-`Module` distributes, that is, commutes with the `R`-scalar multiplication. -/ lemma QuotientGroup.automorphize_smul_left (f : G → M) (g : G ⧸ Γ → R) : (QuotientGroup.automorphize ((g ∘ (@Quotient.mk' _ (_)) : G → R) • f) : G ⧸ Γ → M) = g • (QuotientGroup.automorphize f : G ⧸ Γ → M) := MulAction.automorphize_smul_left f g end section variable {G : Type*} [AddGroup G] {Γ : AddSubgroup G} /-- Automorphization of a function into an `R`-`Module` distributes, that is, commutes with the `R`-scalar multiplication. -/ lemma QuotientAddGroup.automorphize_smul_left (f : G → M) (g : G ⧸ Γ → R) : QuotientAddGroup.automorphize ((g ∘ (@Quotient.mk' _ (_))) • f) = g • (QuotientAddGroup.automorphize f : G ⧸ Γ → M) := AddAction.automorphize_smul_left f g end attribute [to_additive existing QuotientGroup.automorphize_smul_left] QuotientAddGroup.automorphize_smul_left end automorphize
Topology\Algebra\InfiniteSum\NatInt.lean
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl -/ import Mathlib.Topology.Algebra.InfiniteSum.Group import Mathlib.Logic.Encodable.Lattice /-! # Infinite sums and products over `ℕ` and `ℤ` This file contains lemmas about `HasSum`, `Summable`, `tsum`, `HasProd`, `Multipliable`, and `tprod` applied to the important special cases where the domain is `ℕ` or `ℤ`. For instance, we prove the formula `∑ i ∈ range k, f i + ∑' i, f (i + k) = ∑' i, f i`, ∈ `sum_add_tsum_nat_add`, as well as several results relating sums and products on `ℕ` to sums and products on `ℤ`. -/ noncomputable section open Filter Finset Function Encodable open scoped Topology variable {M : Type*} [CommMonoid M] [TopologicalSpace M] {m m' : M} variable {G : Type*} [CommGroup G] {g g' : G} -- don't declare [TopologicalAddGroup G] here as some results require [UniformAddGroup G] instead /-! ## Sums over `ℕ` -/ section Nat section Monoid namespace HasProd /-- If `f : ℕ → M` has product `m`, then the partial products `∏ i ∈ range n, f i` converge to `m`. -/ @[to_additive "If `f : ℕ → M` has sum `m`, then the partial sums `∑ i ∈ range n, f i` converge to `m`."] theorem tendsto_prod_nat {f : ℕ → M} (h : HasProd f m) : Tendsto (fun n ↦ ∏ i ∈ range n, f i) atTop (𝓝 m) := h.comp tendsto_finset_range /-- If `f : ℕ → M` is multipliable, then the partial products `∏ i ∈ range n, f i` converge to `∏' i, f i`. -/ @[to_additive "If `f : ℕ → M` is summable, then the partial sums `∑ i ∈ range n, f i` converge to `∑' i, f i`."] theorem Multipliable.tendsto_prod_tprod_nat {f : ℕ → M} (h : Multipliable f) : Tendsto (fun n ↦ ∏ i ∈ range n, f i) atTop (𝓝 (∏' i, f i)) := tendsto_prod_nat h.hasProd section ContinuousMul variable [ContinuousMul M] @[to_additive] theorem prod_range_mul {f : ℕ → M} {k : ℕ} (h : HasProd (fun n ↦ f (n + k)) m) : HasProd f ((∏ i ∈ range k, f i) * m) := by refine ((range k).hasProd f).mul_compl ?_ rwa [← (notMemRangeEquiv k).symm.hasProd_iff] @[to_additive] theorem zero_mul {f : ℕ → M} (h : HasProd (fun n ↦ f (n + 1)) m) : HasProd f (f 0 * m) := by simpa only [prod_range_one] using h.prod_range_mul @[to_additive] theorem even_mul_odd {f : ℕ → M} (he : HasProd (fun k ↦ f (2 * k)) m) (ho : HasProd (fun k ↦ f (2 * k + 1)) m') : HasProd f (m * m') := by have := mul_right_injective₀ (two_ne_zero' ℕ) replace ho := ((add_left_injective 1).comp this).hasProd_range_iff.2 ho refine (this.hasProd_range_iff.2 he).mul_isCompl ?_ ho simpa [(· ∘ ·)] using Nat.isCompl_even_odd end ContinuousMul end HasProd namespace Multipliable @[to_additive] theorem hasProd_iff_tendsto_nat [T2Space M] {f : ℕ → M} (hf : Multipliable f) : HasProd f m ↔ Tendsto (fun n : ℕ ↦ ∏ i ∈ range n, f i) atTop (𝓝 m) := by refine ⟨fun h ↦ h.tendsto_prod_nat, fun h ↦ ?_⟩ rw [tendsto_nhds_unique h hf.hasProd.tendsto_prod_nat] exact hf.hasProd section ContinuousMul variable [ContinuousMul M] @[to_additive] theorem comp_nat_add {f : ℕ → M} {k : ℕ} (h : Multipliable fun n ↦ f (n + k)) : Multipliable f := h.hasProd.prod_range_mul.multipliable @[to_additive] theorem even_mul_odd {f : ℕ → M} (he : Multipliable fun k ↦ f (2 * k)) (ho : Multipliable fun k ↦ f (2 * k + 1)) : Multipliable f := (he.hasProd.even_mul_odd ho.hasProd).multipliable end ContinuousMul end Multipliable section tprod variable {α β γ : Type*} section Encodable variable [Encodable β] /-- You can compute a product over an encodable type by multiplying over the natural numbers and taking a supremum. -/ @[to_additive "You can compute a sum over an encodable type by summing over the natural numbers and taking a supremum. This is useful for outer measures."] theorem tprod_iSup_decode₂ [CompleteLattice α] (m : α → M) (m0 : m ⊥ = 1) (s : β → α) : ∏' i : ℕ, m (⨆ b ∈ decode₂ β i, s b) = ∏' b : β, m (s b) := by rw [← tprod_extend_one (@encode_injective β _)] refine tprod_congr fun n ↦ ?_ rcases em (n ∈ Set.range (encode : β → ℕ)) with ⟨a, rfl⟩ | hn · simp [encode_injective.extend_apply] · rw [extend_apply' _ _ _ hn] rw [← decode₂_ne_none_iff, ne_eq, not_not] at hn simp [hn, m0] /-- `tprod_iSup_decode₂` specialized to the complete lattice of sets. -/ @[to_additive "`tsum_iSup_decode₂` specialized to the complete lattice of sets."] theorem tprod_iUnion_decode₂ (m : Set α → M) (m0 : m ∅ = 1) (s : β → Set α) : ∏' i, m (⋃ b ∈ decode₂ β i, s b) = ∏' b, m (s b) := tprod_iSup_decode₂ m m0 s end Encodable /-! Some properties about measure-like functions. These could also be functions defined on complete sublattices of sets, with the property that they are countably sub-additive. `R` will probably be instantiated with `(≤)` in all applications. -/ section Countable variable [Countable β] /-- If a function is countably sub-multiplicative then it is sub-multiplicative on countable types -/ @[to_additive "If a function is countably sub-additive then it is sub-additive on countable types"] theorem rel_iSup_tprod [CompleteLattice α] (m : α → M) (m0 : m ⊥ = 1) (R : M → M → Prop) (m_iSup : ∀ s : ℕ → α, R (m (⨆ i, s i)) (∏' i, m (s i))) (s : β → α) : R (m (⨆ b : β, s b)) (∏' b : β, m (s b)) := by cases nonempty_encodable β rw [← iSup_decode₂, ← tprod_iSup_decode₂ _ m0 s] exact m_iSup _ /-- If a function is countably sub-multiplicative then it is sub-multiplicative on finite sets -/ @[to_additive "If a function is countably sub-additive then it is sub-additive on finite sets"] theorem rel_iSup_prod [CompleteLattice α] (m : α → M) (m0 : m ⊥ = 1) (R : M → M → Prop) (m_iSup : ∀ s : ℕ → α, R (m (⨆ i, s i)) (∏' i, m (s i))) (s : γ → α) (t : Finset γ) : R (m (⨆ d ∈ t, s d)) (∏ d ∈ t, m (s d)) := by rw [iSup_subtype', ← Finset.tprod_subtype] exact rel_iSup_tprod m m0 R m_iSup _ /-- If a function is countably sub-multiplicative then it is binary sub-multiplicative -/ @[to_additive "If a function is countably sub-additive then it is binary sub-additive"] theorem rel_sup_mul [CompleteLattice α] (m : α → M) (m0 : m ⊥ = 1) (R : M → M → Prop) (m_iSup : ∀ s : ℕ → α, R (m (⨆ i, s i)) (∏' i, m (s i))) (s₁ s₂ : α) : R (m (s₁ ⊔ s₂)) (m s₁ * m s₂) := by convert rel_iSup_tprod m m0 R m_iSup fun b ↦ cond b s₁ s₂ · simp only [iSup_bool_eq, cond] · rw [tprod_fintype, Fintype.prod_bool, cond, cond] end Countable section ContinuousMul variable [T2Space M] [ContinuousMul M] @[to_additive] theorem prod_mul_tprod_nat_mul' {f : ℕ → M} {k : ℕ} (h : Multipliable (fun n ↦ f (n + k))) : ((∏ i ∈ range k, f i) * ∏' i, f (i + k)) = ∏' i, f i := h.hasProd.prod_range_mul.tprod_eq.symm @[to_additive] theorem tprod_eq_zero_mul' {f : ℕ → M} (hf : Multipliable (fun n ↦ f (n + 1))) : ∏' b, f b = f 0 * ∏' b, f (b + 1) := by simpa only [prod_range_one] using (prod_mul_tprod_nat_mul' hf).symm @[to_additive] theorem tprod_even_mul_odd {f : ℕ → M} (he : Multipliable fun k ↦ f (2 * k)) (ho : Multipliable fun k ↦ f (2 * k + 1)) : (∏' k, f (2 * k)) * ∏' k, f (2 * k + 1) = ∏' k, f k := (he.hasProd.even_mul_odd ho.hasProd).tprod_eq.symm end ContinuousMul end tprod end Monoid section TopologicalGroup variable [TopologicalSpace G] [TopologicalGroup G] @[to_additive] theorem hasProd_nat_add_iff {f : ℕ → G} (k : ℕ) : HasProd (fun n ↦ f (n + k)) g ↔ HasProd f (g * ∏ i ∈ range k, f i) := by refine Iff.trans ?_ (range k).hasProd_compl_iff rw [← (notMemRangeEquiv k).symm.hasProd_iff, Function.comp_def, coe_notMemRangeEquiv_symm] @[to_additive] theorem multipliable_nat_add_iff {f : ℕ → G} (k : ℕ) : (Multipliable fun n ↦ f (n + k)) ↔ Multipliable f := Iff.symm <| (Equiv.mulRight (∏ i ∈ range k, f i)).surjective.multipliable_iff_of_hasProd_iff (hasProd_nat_add_iff k).symm @[to_additive] theorem hasProd_nat_add_iff' {f : ℕ → G} (k : ℕ) : HasProd (fun n ↦ f (n + k)) (g / ∏ i ∈ range k, f i) ↔ HasProd f g := by simp [hasProd_nat_add_iff] @[to_additive] theorem prod_mul_tprod_nat_add [T2Space G] {f : ℕ → G} (k : ℕ) (h : Multipliable f) : ((∏ i ∈ range k, f i) * ∏' i, f (i + k)) = ∏' i, f i := prod_mul_tprod_nat_mul' <| (multipliable_nat_add_iff k).2 h @[to_additive] theorem tprod_eq_zero_mul [T2Space G] {f : ℕ → G} (hf : Multipliable f) : ∏' b, f b = f 0 * ∏' b, f (b + 1) := tprod_eq_zero_mul' <| (multipliable_nat_add_iff 1).2 hf /-- For `f : ℕ → G`, the product `∏' k, f (k + i)` tends to one. This does not require a multipliability assumption on `f`, as otherwise all such products are one. -/ @[to_additive "For `f : ℕ → G`, the sum `∑' k, f (k + i)` tends to zero. This does not require a summability assumption on `f`, as otherwise all such sums are zero."] theorem tendsto_prod_nat_add [T2Space G] (f : ℕ → G) : Tendsto (fun i ↦ ∏' k, f (k + i)) atTop (𝓝 1) := by by_cases hf : Multipliable f · have h₀ : (fun i ↦ (∏' i, f i) / ∏ j ∈ range i, f j) = fun i ↦ ∏' k : ℕ, f (k + i) := by ext1 i rw [div_eq_iff_eq_mul, mul_comm, prod_mul_tprod_nat_add i hf] have h₁ : Tendsto (fun _ : ℕ ↦ ∏' i, f i) atTop (𝓝 (∏' i, f i)) := tendsto_const_nhds simpa only [h₀, div_self'] using Tendsto.div' h₁ hf.hasProd.tendsto_prod_nat · refine tendsto_const_nhds.congr fun n ↦ (tprod_eq_one_of_not_multipliable ?_).symm rwa [multipliable_nat_add_iff n] end TopologicalGroup section UniformGroup variable [UniformSpace G] [UniformGroup G] @[to_additive] theorem cauchySeq_finset_iff_nat_tprod_vanishing {f : ℕ → G} : (CauchySeq fun s : Finset ℕ ↦ ∏ n ∈ s, f n) ↔ ∀ e ∈ 𝓝 (1 : G), ∃ N : ℕ, ∀ t ⊆ {n | N ≤ n}, (∏' n : t, f n) ∈ e := by refine cauchySeq_finset_iff_tprod_vanishing.trans ⟨fun vanish e he ↦ ?_, fun vanish e he ↦ ?_⟩ · obtain ⟨s, hs⟩ := vanish e he refine ⟨if h : s.Nonempty then s.max' h + 1 else 0, fun t ht ↦ hs _ <| Set.disjoint_left.mpr ?_⟩ split_ifs at ht with h · exact fun m hmt hms ↦ (s.le_max' _ hms).not_lt (Nat.succ_le_iff.mp <| ht hmt) · exact fun _ _ hs ↦ h ⟨_, hs⟩ · obtain ⟨N, hN⟩ := vanish e he exact ⟨range N, fun t ht ↦ hN _ fun n hnt ↦ le_of_not_lt fun h ↦ Set.disjoint_left.mp ht hnt (mem_range.mpr h)⟩ variable [CompleteSpace G] @[to_additive] theorem multipliable_iff_nat_tprod_vanishing {f : ℕ → G} : Multipliable f ↔ ∀ e ∈ 𝓝 1, ∃ N : ℕ, ∀ t ⊆ {n | N ≤ n}, (∏' n : t, f n) ∈ e := by rw [multipliable_iff_cauchySeq_finset, cauchySeq_finset_iff_nat_tprod_vanishing] end UniformGroup section TopologicalGroup variable [TopologicalSpace G] [TopologicalGroup G] @[to_additive] theorem Multipliable.nat_tprod_vanishing {f : ℕ → G} (hf : Multipliable f) ⦃e : Set G⦄ (he : e ∈ 𝓝 1) : ∃ N : ℕ, ∀ t ⊆ {n | N ≤ n}, (∏' n : t, f n) ∈ e := letI : UniformSpace G := TopologicalGroup.toUniformSpace G have : UniformGroup G := comm_topologicalGroup_is_uniform cauchySeq_finset_iff_nat_tprod_vanishing.1 hf.hasProd.cauchySeq e he @[to_additive] theorem Multipliable.tendsto_atTop_one {f : ℕ → G} (hf : Multipliable f) : Tendsto f atTop (𝓝 1) := by rw [← Nat.cofinite_eq_atTop] exact hf.tendsto_cofinite_one end TopologicalGroup end Nat /-! ## Sums over `ℤ` In this section we prove a variety of lemmas relating sums over `ℕ` to sums over `ℤ`. -/ section Int section Monoid @[to_additive HasSum.nat_add_neg_add_one] lemma HasProd.nat_mul_neg_add_one {f : ℤ → M} (hf : HasProd f m) : HasProd (fun n : ℕ ↦ f n * f (-(n + 1))) m := by change HasProd (fun n : ℕ ↦ f n * f (Int.negSucc n)) m have : Injective Int.negSucc := @Int.negSucc.inj refine hf.hasProd_of_prod_eq fun u ↦ ?_ refine ⟨u.preimage _ Nat.cast_injective.injOn ∪ u.preimage _ this.injOn, fun v' hv' ↦ ⟨v'.image Nat.cast ∪ v'.image Int.negSucc, fun x hx ↦ ?_, ?_⟩⟩ · simp only [mem_union, mem_image] cases x · exact Or.inl ⟨_, hv' (by simpa using Or.inl hx), rfl⟩ · exact Or.inr ⟨_, hv' (by simpa using Or.inr hx), rfl⟩ · rw [prod_union, prod_image Nat.cast_injective.injOn, prod_image this.injOn, prod_mul_distrib] simp only [disjoint_iff_ne, mem_image, ne_eq, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂, not_false_eq_true, implies_true, forall_const] @[to_additive Summable.nat_add_neg_add_one] lemma Multipliable.nat_mul_neg_add_one {f : ℤ → M} (hf : Multipliable f) : Multipliable (fun n : ℕ ↦ f n * f (-(n + 1))) := hf.hasProd.nat_mul_neg_add_one.multipliable @[to_additive tsum_nat_add_neg_add_one] lemma tprod_nat_mul_neg_add_one [T2Space M] {f : ℤ → M} (hf : Multipliable f) : ∏' (n : ℕ), (f n * f (-(n + 1))) = ∏' (n : ℤ), f n := hf.hasProd.nat_mul_neg_add_one.tprod_eq section ContinuousMul variable [ContinuousMul M] @[to_additive HasSum.of_nat_of_neg_add_one] lemma HasProd.of_nat_of_neg_add_one {f : ℤ → M} (hf₁ : HasProd (fun n : ℕ ↦ f n) m) (hf₂ : HasProd (fun n : ℕ ↦ f (-(n + 1))) m') : HasProd f (m * m') := by have hi₂ : Injective Int.negSucc := @Int.negSucc.inj have : IsCompl (Set.range ((↑) : ℕ → ℤ)) (Set.range Int.negSucc) := by constructor · rw [disjoint_iff_inf_le] rintro _ ⟨⟨i, rfl⟩, ⟨j, ⟨⟩⟩⟩ · rw [codisjoint_iff_le_sup] rintro (i | j) <;> simp exact (Nat.cast_injective.hasProd_range_iff.mpr hf₁).mul_isCompl this (hi₂.hasProd_range_iff.mpr hf₂) @[deprecated (since := "2024-03-04")] alias HasSum.nonneg_add_neg := HasSum.of_nat_of_neg_add_one @[to_additive Summable.of_nat_of_neg_add_one] lemma Multipliable.of_nat_of_neg_add_one {f : ℤ → M} (hf₁ : Multipliable fun n : ℕ ↦ f n) (hf₂ : Multipliable fun n : ℕ ↦ f (-(n + 1))) : Multipliable f := (hf₁.hasProd.of_nat_of_neg_add_one hf₂.hasProd).multipliable @[to_additive tsum_of_nat_of_neg_add_one] lemma tprod_of_nat_of_neg_add_one [T2Space M] {f : ℤ → M} (hf₁ : Multipliable fun n : ℕ ↦ f n) (hf₂ : Multipliable fun n : ℕ ↦ f (-(n + 1))) : ∏' n : ℤ, f n = (∏' n : ℕ, f n) * ∏' n : ℕ, f (-(n + 1)) := (hf₁.hasProd.of_nat_of_neg_add_one hf₂.hasProd).tprod_eq /-- If `f₀, f₁, f₂, ...` and `g₀, g₁, g₂, ...` have products `a`, `b` respectively, then the `ℤ`-indexed sequence: `..., g₂, g₁, g₀, f₀, f₁, f₂, ...` (with `f₀` at the `0`-th position) has product `a + b`. -/ @[to_additive "If `f₀, f₁, f₂, ...` and `g₀, g₁, g₂, ...` have sums `a`, `b` respectively, then the `ℤ`-indexed sequence: `..., g₂, g₁, g₀, f₀, f₁, f₂, ...` (with `f₀` at the `0`-th position) has sum `a + b`."] lemma HasProd.int_rec {f g : ℕ → M} (hf : HasProd f m) (hg : HasProd g m') : HasProd (Int.rec f g) (m * m') := HasProd.of_nat_of_neg_add_one hf hg /-- If `f₀, f₁, f₂, ...` and `g₀, g₁, g₂, ...` are both multipliable then so is the `ℤ`-indexed sequence: `..., g₂, g₁, g₀, f₀, f₁, f₂, ...` (with `f₀` at the `0`-th position). -/ @[to_additive "If `f₀, f₁, f₂, ...` and `g₀, g₁, g₂, ...` are both summable then so is the `ℤ`-indexed sequence: `..., g₂, g₁, g₀, f₀, f₁, f₂, ...` (with `f₀` at the `0`-th position)."] lemma Multipliable.int_rec {f g : ℕ → M} (hf : Multipliable f) (hg : Multipliable g) : Multipliable (Int.rec f g) := .of_nat_of_neg_add_one hf hg /-- If `f₀, f₁, f₂, ...` and `g₀, g₁, g₂, ...` are both multipliable, then the product of the `ℤ`-indexed sequence: `..., g₂, g₁, g₀, f₀, f₁, f₂, ...` (with `f₀` at the `0`-th position) is `(∏' n, f n) * ∏' n, g n`. -/ @[to_additive "If `f₀, f₁, f₂, ...` and `g₀, g₁, g₂, ...` are both summable, then the sum of the `ℤ`-indexed sequence: `..., g₂, g₁, g₀, f₀, f₁, f₂, ...` (with `f₀` at the `0`-th position) is `∑' n, f n + ∑' n, g n`."] lemma tprod_int_rec [T2Space M] {f g : ℕ → M} (hf : Multipliable f) (hg : Multipliable g) : ∏' n : ℤ, Int.rec f g n = (∏' n : ℕ, f n) * ∏' n : ℕ, g n := (hf.hasProd.int_rec hg.hasProd).tprod_eq @[to_additive] theorem HasProd.nat_mul_neg {f : ℤ → M} (hf : HasProd f m) : HasProd (fun n : ℕ ↦ f n * f (-n)) (m * f 0) := by -- Note this is much easier to prove if you assume more about the target space, but we have to -- work hard to prove it under the very minimal assumptions here. apply (hf.mul (hasProd_ite_eq (0 : ℤ) (f 0))).hasProd_of_prod_eq fun u ↦ ?_ refine ⟨u.image Int.natAbs, fun v' hv' ↦ ?_⟩ let u1 := v'.image fun x : ℕ ↦ (x : ℤ) let u2 := v'.image fun x : ℕ ↦ -(x : ℤ) have A : u ⊆ u1 ∪ u2 := by intro x hx simp only [u1, u2, mem_union, mem_image, exists_prop] rcases le_total 0 x with (h'x | h'x) · refine Or.inl ⟨_, hv' <| mem_image.mpr ⟨x, hx, rfl⟩, ?_⟩ simp only [Int.natCast_natAbs, abs_eq_self, h'x] · refine Or.inr ⟨_, hv' <| mem_image.mpr ⟨x, hx, rfl⟩, ?_⟩ simp only [abs_of_nonpos h'x, Int.natCast_natAbs, neg_neg] exact ⟨_, A, calc (∏ x ∈ u1 ∪ u2, (f x * if x = 0 then f 0 else 1)) = (∏ x ∈ u1 ∪ u2, f x) * ∏ x ∈ u1 ∩ u2, f x := by rw [prod_mul_distrib] congr 1 refine (prod_subset_one_on_sdiff inter_subset_union ?_ ?_).symm · intro x hx suffices x ≠ 0 by simp only [this, if_false] rintro rfl simp only [mem_sdiff, mem_union, mem_image, Nat.cast_eq_zero, exists_eq_right, neg_eq_zero, or_self, mem_inter, and_self, and_not_self, u1, u2] at hx · intro x hx simp only [u1, u2, mem_inter, mem_image, exists_prop] at hx suffices x = 0 by simp only [this, eq_self_iff_true, if_true] apply le_antisymm · rcases hx.2 with ⟨a, _, rfl⟩ simp only [Right.neg_nonpos_iff, Nat.cast_nonneg] · rcases hx.1 with ⟨a, _, rfl⟩ simp only [Nat.cast_nonneg] _ = (∏ x ∈ u1, f x) * ∏ x ∈ u2, f x := prod_union_inter _ = (∏ b ∈ v', f b) * ∏ b ∈ v', f (-b) := by simp only [u1, u2, Nat.cast_inj, imp_self, implies_true, forall_const, prod_image, neg_inj] _ = ∏ b ∈ v', (f b * f (-b)) := prod_mul_distrib.symm⟩ @[deprecated HasSum.nat_add_neg (since := "2024-03-04")] alias HasSum.sum_nat_of_sum_int := HasSum.nat_add_neg @[to_additive] theorem Multipliable.nat_mul_neg {f : ℤ → M} (hf : Multipliable f) : Multipliable fun n : ℕ ↦ f n * f (-n) := hf.hasProd.nat_mul_neg.multipliable @[to_additive] lemma tprod_nat_mul_neg [T2Space M] {f : ℤ → M} (hf : Multipliable f) : ∏' n : ℕ, (f n * f (-n)) = (∏' n : ℤ, f n) * f 0 := hf.hasProd.nat_mul_neg.tprod_eq @[to_additive HasSum.of_add_one_of_neg_add_one] theorem HasProd.of_add_one_of_neg_add_one {f : ℤ → M} (hf₁ : HasProd (fun n : ℕ ↦ f (n + 1)) m) (hf₂ : HasProd (fun n : ℕ ↦ f (-(n + 1))) m') : HasProd f (m * f 0 * m') := HasProd.of_nat_of_neg_add_one (mul_comm _ m ▸ HasProd.zero_mul hf₁) hf₂ @[deprecated HasSum.of_add_one_of_neg_add_one (since := "2024-03-04")] alias HasSum.pos_add_zero_add_neg := HasSum.of_add_one_of_neg_add_one @[to_additive Summable.of_add_one_of_neg_add_one] lemma Multipliable.of_add_one_of_neg_add_one {f : ℤ → M} (hf₁ : Multipliable fun n : ℕ ↦ f (n + 1)) (hf₂ : Multipliable fun n : ℕ ↦ f (-(n + 1))) : Multipliable f := (hf₁.hasProd.of_add_one_of_neg_add_one hf₂.hasProd).multipliable @[to_additive tsum_of_add_one_of_neg_add_one] lemma tprod_of_add_one_of_neg_add_one [T2Space M] {f : ℤ → M} (hf₁ : Multipliable fun n : ℕ ↦ f (n + 1)) (hf₂ : Multipliable fun n : ℕ ↦ f (-(n + 1))) : ∏' n : ℤ, f n = (∏' n : ℕ, f (n + 1)) * f 0 * ∏' n : ℕ, f (-(n + 1)) := (hf₁.hasProd.of_add_one_of_neg_add_one hf₂.hasProd).tprod_eq end ContinuousMul end Monoid section TopologicalGroup variable [TopologicalSpace G] [TopologicalGroup G] @[to_additive] lemma HasProd.of_nat_of_neg {f : ℤ → G} (hf₁ : HasProd (fun n : ℕ ↦ f n) g) (hf₂ : HasProd (fun n : ℕ ↦ f (-n)) g') : HasProd f (g * g' / f 0) := by refine mul_div_assoc' g .. ▸ hf₁.of_nat_of_neg_add_one (m' := g' / f 0) ?_ rwa [← hasProd_nat_add_iff' 1, prod_range_one, Nat.cast_zero, neg_zero] at hf₂ @[to_additive] lemma Multipliable.of_nat_of_neg {f : ℤ → G} (hf₁ : Multipliable fun n : ℕ ↦ f n) (hf₂ : Multipliable fun n : ℕ ↦ f (-n)) : Multipliable f := (hf₁.hasProd.of_nat_of_neg hf₂.hasProd).multipliable @[deprecated Summable.of_nat_of_neg (since := "2024-03-04")] alias summable_int_of_summable_nat := Summable.of_nat_of_neg @[to_additive] lemma tprod_of_nat_of_neg [T2Space G] {f : ℤ → G} (hf₁ : Multipliable fun n : ℕ ↦ f n) (hf₂ : Multipliable fun n : ℕ ↦ f (-n)) : ∏' n : ℤ, f n = (∏' n : ℕ, f n) * (∏' n : ℕ, f (-n)) / f 0 := (hf₁.hasProd.of_nat_of_neg hf₂.hasProd).tprod_eq end TopologicalGroup section UniformGroup -- results which depend on completeness variable [UniformSpace G] [UniformGroup G] [CompleteSpace G] /-- "iff" version of `Multipliable.of_nat_of_neg_add_one`. -/ @[to_additive "\"iff\" version of `Summable.of_nat_of_neg_add_one`."] lemma multipliable_int_iff_multipliable_nat_and_neg_add_one {f : ℤ → G} : Multipliable f ↔ (Multipliable fun n : ℕ ↦ f n) ∧ (Multipliable fun n : ℕ ↦ f (-(n + 1))) := by refine ⟨fun p ↦ ⟨?_, ?_⟩, fun ⟨hf₁, hf₂⟩ ↦ Multipliable.of_nat_of_neg_add_one hf₁ hf₂⟩ <;> apply p.comp_injective exacts [Nat.cast_injective, @Int.negSucc.inj] /-- "iff" version of `Multipliable.of_nat_of_neg`. -/ @[to_additive "\"iff\" version of `Summable.of_nat_of_neg`."] lemma multipliable_int_iff_multipliable_nat_and_neg {f : ℤ → G} : Multipliable f ↔ (Multipliable fun n : ℕ ↦ f n) ∧ (Multipliable fun n : ℕ ↦ f (-n)) := by refine ⟨fun p ↦ ⟨?_, ?_⟩, fun ⟨hf₁, hf₂⟩ ↦ Multipliable.of_nat_of_neg hf₁ hf₂⟩ <;> apply p.comp_injective exacts [Nat.cast_injective, neg_injective.comp Nat.cast_injective] end UniformGroup end Int
Topology\Algebra\InfiniteSum\Nonarchimedean.lean
/- Copyright (c) 2024 Mitchell Lee. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mitchell Lee -/ import Mathlib.Topology.Algebra.InfiniteSum.Group import Mathlib.Topology.Algebra.Nonarchimedean.Basic /-! # Infinite sums and products in nonarchimedean abelian groups Let `G` be a complete nonarchimedean abelian group and let `f : α → G` be a function. We prove that `f` is unconditionally summable if and only if `f a` tends to zero on the cofinite filter on `α`. We also prove the analogous result in the multiplicative setting. -/ open Filter Topology namespace NonarchimedeanGroup variable {α G : Type*} variable [CommGroup G] [UniformSpace G] [UniformGroup G] [NonarchimedeanGroup G] /-- Let `G` be a nonarchimedean multiplicative abelian group, and let `f : α → G` be a function that tends to one on the filter of cofinite sets. For each finite subset of `α`, consider the partial product of `f` on that subset. These partial products form a Cauchy filter. -/ @[to_additive "Let `G` be a nonarchimedean additive abelian group, and let `f : α → G` be a function that tends to zero on the filter of cofinite sets. For each finite subset of `α`, consider the partial sum of `f` on that subset. These partial sums form a Cauchy filter."] theorem cauchySeq_prod_of_tendsto_cofinite_one {f : α → G} (hf : Tendsto f cofinite (𝓝 1)) : CauchySeq (fun s ↦ ∏ i ∈ s, f i) := by /- Let `U` be a neighborhood of `1`. It suffices to show that there exists `s : Finset α` such that for any `t : Finset α` disjoint from `s`, we have `∏ i ∈ t, f i ∈ U`. -/ apply cauchySeq_finset_iff_prod_vanishing.mpr intro U hU -- Since `G` is nonarchimedean, `U` contains an open subgroup `V`. rcases is_nonarchimedean U hU with ⟨V, hV⟩ /- Let `s` be the set of all indices `i : α` such that `f i ∉ V`. By our assumption `hf`, this is finite. -/ use (tendsto_def.mp hf V V.mem_nhds_one).toFinset /- For any `t : Finset α` disjoint from `s`, the product `∏ i ∈ t, f i` is a product of elements of `V`, so it is an element of `V` too. Thus, `∏ i ∈ t, f i ∈ U`, as desired. -/ intro t ht apply hV apply Subgroup.prod_mem intro i hi simpa using Finset.disjoint_left.mp ht hi /-- Let `G` be a complete nonarchimedean multiplicative abelian group, and let `f : α → G` be a function that tends to one on the filter of cofinite sets. Then `f` is unconditionally multipliable. -/ @[to_additive "Let `G` be a complete nonarchimedean additive abelian group, and let `f : α → G` be a function that tends to zero on the filter of cofinite sets. Then `f` is unconditionally summable."] theorem multipliable_of_tendsto_cofinite_one [CompleteSpace G] {f : α → G} (hf : Tendsto f cofinite (𝓝 1)) : Multipliable f := CompleteSpace.complete (cauchySeq_prod_of_tendsto_cofinite_one hf) /-- Let `G` be a complete nonarchimedean multiplicative abelian group. Then a function `f : α → G` is unconditionally multipliable if and only if it tends to one on the filter of cofinite sets. -/ @[to_additive "Let `G` be a complete nonarchimedean additive abelian group. Then a function `f : α → G` is unconditionally summable if and only if it tends to zero on the filter of cofinite sets."] theorem multipliable_iff_tendsto_cofinite_one [CompleteSpace G] (f : α → G) : Multipliable f ↔ Tendsto f cofinite (𝓝 1) := ⟨Multipliable.tendsto_cofinite_one, multipliable_of_tendsto_cofinite_one⟩ end NonarchimedeanGroup
Topology\Algebra\InfiniteSum\Order.lean
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl -/ import Mathlib.Algebra.Order.Archimedean.Basic import Mathlib.Topology.Algebra.InfiniteSum.NatInt import Mathlib.Topology.Algebra.Order.Field import Mathlib.Topology.Order.MonotoneConvergence /-! # Infinite sum or product in an order This file provides lemmas about the interaction of infinite sums and products and order operations. -/ open Finset Filter Function open scoped Classical variable {ι κ α : Type*} section Preorder variable [Preorder α] [CommMonoid α] [TopologicalSpace α] [OrderClosedTopology α] [T2Space α] {f : ℕ → α} {c : α} @[to_additive] theorem tprod_le_of_prod_range_le (hf : Multipliable f) (h : ∀ n, ∏ i ∈ range n, f i ≤ c) : ∏' n, f n ≤ c := let ⟨_l, hl⟩ := hf hl.tprod_eq.symm ▸ le_of_tendsto' hl.tendsto_prod_nat h end Preorder section OrderedCommMonoid variable [OrderedCommMonoid α] [TopologicalSpace α] [OrderClosedTopology α] {f g : ι → α} {a a₁ a₂ : α} @[to_additive] theorem hasProd_le (h : ∀ i, f i ≤ g i) (hf : HasProd f a₁) (hg : HasProd g a₂) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto' hf hg fun _ ↦ prod_le_prod' fun i _ ↦ h i @[to_additive (attr := mono)] theorem hasProd_mono (hf : HasProd f a₁) (hg : HasProd g a₂) (h : f ≤ g) : a₁ ≤ a₂ := hasProd_le h hf hg @[to_additive] theorem hasProd_le_of_prod_le (hf : HasProd f a) (h : ∀ s, ∏ i ∈ s, f i ≤ a₂) : a ≤ a₂ := le_of_tendsto' hf h @[to_additive] theorem le_hasProd_of_le_prod (hf : HasProd f a) (h : ∀ s, a₂ ≤ ∏ i ∈ s, f i) : a₂ ≤ a := ge_of_tendsto' hf h @[to_additive] theorem hasProd_le_inj {g : κ → α} (e : ι → κ) (he : Injective e) (hs : ∀ c, c ∉ Set.range e → 1 ≤ g c) (h : ∀ i, f i ≤ g (e i)) (hf : HasProd f a₁) (hg : HasProd g a₂) : a₁ ≤ a₂ := by rw [← hasProd_extend_one he] at hf refine hasProd_le (fun c ↦ ?_) hf hg obtain ⟨i, rfl⟩ | h := em (c ∈ Set.range e) · rw [he.extend_apply] exact h _ · rw [extend_apply' _ _ _ h] exact hs _ h @[to_additive] theorem tprod_le_tprod_of_inj {g : κ → α} (e : ι → κ) (he : Injective e) (hs : ∀ c, c ∉ Set.range e → 1 ≤ g c) (h : ∀ i, f i ≤ g (e i)) (hf : Multipliable f) (hg : Multipliable g) : tprod f ≤ tprod g := hasProd_le_inj _ he hs h hf.hasProd hg.hasProd @[to_additive] lemma tprod_subtype_le {κ γ : Type*} [OrderedCommGroup γ] [UniformSpace γ] [UniformGroup γ] [OrderClosedTopology γ] [CompleteSpace γ] (f : κ → γ) (β : Set κ) (h : ∀ a : κ, 1 ≤ f a) (hf : Multipliable f) : (∏' (b : β), f b) ≤ (∏' (a : κ), f a) := by apply tprod_le_tprod_of_inj _ (Subtype.coe_injective) (by simp only [Subtype.range_coe_subtype, Set.setOf_mem_eq, h, implies_true]) (by simp only [le_refl, Subtype.forall, implies_true]) (by apply hf.subtype) apply hf @[to_additive] theorem prod_le_hasProd (s : Finset ι) (hs : ∀ i, i ∉ s → 1 ≤ f i) (hf : HasProd f a) : ∏ i ∈ s, f i ≤ a := ge_of_tendsto hf (eventually_atTop.2 ⟨s, fun _t hst ↦ prod_le_prod_of_subset_of_one_le' hst fun i _ hbs ↦ hs i hbs⟩) @[to_additive] theorem isLUB_hasProd (h : ∀ i, 1 ≤ f i) (hf : HasProd f a) : IsLUB (Set.range fun s ↦ ∏ i ∈ s, f i) a := isLUB_of_tendsto_atTop (Finset.prod_mono_set_of_one_le' h) hf @[to_additive] theorem le_hasProd (hf : HasProd f a) (i : ι) (hb : ∀ j, j ≠ i → 1 ≤ f j) : f i ≤ a := calc f i = ∏ i ∈ {i}, f i := by rw [prod_singleton] _ ≤ a := prod_le_hasProd _ (by simpa) hf @[to_additive] theorem prod_le_tprod {f : ι → α} (s : Finset ι) (hs : ∀ i, i ∉ s → 1 ≤ f i) (hf : Multipliable f) : ∏ i ∈ s, f i ≤ ∏' i, f i := prod_le_hasProd s hs hf.hasProd @[to_additive] theorem le_tprod (hf : Multipliable f) (i : ι) (hb : ∀ j, j ≠ i → 1 ≤ f j) : f i ≤ ∏' i, f i := le_hasProd hf.hasProd i hb @[to_additive] theorem tprod_le_tprod (h : ∀ i, f i ≤ g i) (hf : Multipliable f) (hg : Multipliable g) : ∏' i, f i ≤ ∏' i, g i := hasProd_le h hf.hasProd hg.hasProd @[to_additive (attr := mono)] theorem tprod_mono (hf : Multipliable f) (hg : Multipliable g) (h : f ≤ g) : ∏' n, f n ≤ ∏' n, g n := tprod_le_tprod h hf hg @[to_additive] theorem tprod_le_of_prod_le (hf : Multipliable f) (h : ∀ s, ∏ i ∈ s, f i ≤ a₂) : ∏' i, f i ≤ a₂ := hasProd_le_of_prod_le hf.hasProd h @[to_additive] theorem tprod_le_of_prod_le' (ha₂ : 1 ≤ a₂) (h : ∀ s, ∏ i ∈ s, f i ≤ a₂) : ∏' i, f i ≤ a₂ := by by_cases hf : Multipliable f · exact tprod_le_of_prod_le hf h · rw [tprod_eq_one_of_not_multipliable hf] exact ha₂ @[to_additive] theorem HasProd.one_le (h : ∀ i, 1 ≤ g i) (ha : HasProd g a) : 1 ≤ a := hasProd_le h hasProd_one ha @[to_additive] theorem HasProd.le_one (h : ∀ i, g i ≤ 1) (ha : HasProd g a) : a ≤ 1 := hasProd_le h ha hasProd_one @[to_additive tsum_nonneg] theorem one_le_tprod (h : ∀ i, 1 ≤ g i) : 1 ≤ ∏' i, g i := by by_cases hg : Multipliable g · exact hg.hasProd.one_le h · rw [tprod_eq_one_of_not_multipliable hg] @[to_additive] theorem tprod_le_one (h : ∀ i, f i ≤ 1) : ∏' i, f i ≤ 1 := by by_cases hf : Multipliable f · exact hf.hasProd.le_one h · rw [tprod_eq_one_of_not_multipliable hf] -- Porting note: generalized from `OrderedAddCommGroup` to `OrderedAddCommMonoid` @[to_additive] theorem hasProd_one_iff_of_one_le (hf : ∀ i, 1 ≤ f i) : HasProd f 1 ↔ f = 1 := by refine ⟨fun hf' ↦ ?_, ?_⟩ · ext i exact (hf i).antisymm' (le_hasProd hf' _ fun j _ ↦ hf j) · rintro rfl exact hasProd_one end OrderedCommMonoid section OrderedCommGroup variable [OrderedCommGroup α] [TopologicalSpace α] [TopologicalGroup α] [OrderClosedTopology α] {f g : ι → α} {a₁ a₂ : α} {i : ι} @[to_additive] theorem hasProd_lt (h : f ≤ g) (hi : f i < g i) (hf : HasProd f a₁) (hg : HasProd g a₂) : a₁ < a₂ := by have : update f i 1 ≤ update g i 1 := update_le_update_iff.mpr ⟨rfl.le, fun i _ ↦ h i⟩ have : 1 / f i * a₁ ≤ 1 / g i * a₂ := hasProd_le this (hf.update i 1) (hg.update i 1) simpa only [one_div, mul_inv_cancel_left] using mul_lt_mul_of_lt_of_le hi this @[to_additive (attr := mono)] theorem hasProd_strict_mono (hf : HasProd f a₁) (hg : HasProd g a₂) (h : f < g) : a₁ < a₂ := let ⟨hle, _i, hi⟩ := Pi.lt_def.mp h hasProd_lt hle hi hf hg @[to_additive] theorem tprod_lt_tprod (h : f ≤ g) (hi : f i < g i) (hf : Multipliable f) (hg : Multipliable g) : ∏' n, f n < ∏' n, g n := hasProd_lt h hi hf.hasProd hg.hasProd @[to_additive (attr := mono)] theorem tprod_strict_mono (hf : Multipliable f) (hg : Multipliable g) (h : f < g) : ∏' n, f n < ∏' n, g n := let ⟨hle, _i, hi⟩ := Pi.lt_def.mp h tprod_lt_tprod hle hi hf hg @[to_additive tsum_pos] theorem one_lt_tprod (hsum : Multipliable g) (hg : ∀ i, 1 ≤ g i) (i : ι) (hi : 1 < g i) : 1 < ∏' i, g i := by rw [← tprod_one] exact tprod_lt_tprod hg hi multipliable_one hsum end OrderedCommGroup section CanonicallyOrderedCommMonoid variable [CanonicallyOrderedCommMonoid α] [TopologicalSpace α] [OrderClosedTopology α] {f : ι → α} {a : α} @[to_additive] theorem le_hasProd' (hf : HasProd f a) (i : ι) : f i ≤ a := le_hasProd hf i fun _ _ ↦ one_le _ @[to_additive] theorem le_tprod' (hf : Multipliable f) (i : ι) : f i ≤ ∏' i, f i := le_tprod hf i fun _ _ ↦ one_le _ @[to_additive] theorem hasProd_one_iff : HasProd f 1 ↔ ∀ x, f x = 1 := (hasProd_one_iff_of_one_le fun _ ↦ one_le _).trans funext_iff @[to_additive] theorem tprod_eq_one_iff (hf : Multipliable f) : ∏' i, f i = 1 ↔ ∀ x, f x = 1 := by rw [← hasProd_one_iff, hf.hasProd_iff] @[to_additive] theorem tprod_ne_one_iff (hf : Multipliable f) : ∏' i, f i ≠ 1 ↔ ∃ x, f x ≠ 1 := by rw [Ne, tprod_eq_one_iff hf, not_forall] @[to_additive] theorem isLUB_hasProd' (hf : HasProd f a) : IsLUB (Set.range fun s ↦ ∏ i ∈ s, f i) a := isLUB_of_tendsto_atTop (Finset.prod_mono_set' f) hf end CanonicallyOrderedCommMonoid section LinearOrder /-! For infinite sums taking values in a linearly ordered monoid, the existence of a least upper bound for the finite sums is a criterion for summability. This criterion is useful when applied in a linearly ordered monoid which is also a complete or conditionally complete linear order, such as `ℝ`, `ℝ≥0`, `ℝ≥0∞`, because it is then easy to check the existence of a least upper bound. -/ @[to_additive] theorem hasProd_of_isLUB_of_one_le [LinearOrderedCommMonoid α] [TopologicalSpace α] [OrderTopology α] {f : ι → α} (i : α) (h : ∀ i, 1 ≤ f i) (hf : IsLUB (Set.range fun s ↦ ∏ i ∈ s, f i) i) : HasProd f i := tendsto_atTop_isLUB (Finset.prod_mono_set_of_one_le' h) hf @[to_additive] theorem hasProd_of_isLUB [CanonicallyLinearOrderedCommMonoid α] [TopologicalSpace α] [OrderTopology α] {f : ι → α} (b : α) (hf : IsLUB (Set.range fun s ↦ ∏ i ∈ s, f i) b) : HasProd f b := tendsto_atTop_isLUB (Finset.prod_mono_set' f) hf @[to_additive] theorem multipliable_mabs_iff [LinearOrderedCommGroup α] [UniformSpace α] [UniformGroup α] [CompleteSpace α] {f : ι → α} : (Multipliable fun x ↦ mabs (f x)) ↔ Multipliable f := let s := { x | 1 ≤ f x } have h1 : ∀ x : s, mabs (f x) = f x := fun x ↦ mabs_of_one_le x.2 have h2 : ∀ x : ↑sᶜ, mabs (f x) = (f x)⁻¹ := fun x ↦ mabs_of_lt_one (not_le.1 x.2) calc (Multipliable fun x ↦ mabs (f x)) ↔ (Multipliable fun x : s ↦ mabs (f x)) ∧ Multipliable fun x : ↑sᶜ ↦ mabs (f x) := multipliable_subtype_and_compl.symm _ ↔ (Multipliable fun x : s ↦ f x) ∧ Multipliable fun x : ↑sᶜ ↦ (f x)⁻¹ := by simp only [h1, h2] _ ↔ Multipliable f := by simp only [multipliable_inv_iff, multipliable_subtype_and_compl] alias ⟨Summable.of_abs, Summable.abs⟩ := summable_abs_iff theorem Finite.of_summable_const [LinearOrderedAddCommGroup α] [TopologicalSpace α] [Archimedean α] [OrderClosedTopology α] {b : α} (hb : 0 < b) (hf : Summable fun _ : ι ↦ b) : Finite ι := by have H : ∀ s : Finset ι, s.card • b ≤ ∑' _ : ι, b := fun s ↦ by simpa using sum_le_hasSum s (fun a _ ↦ hb.le) hf.hasSum obtain ⟨n, hn⟩ := Archimedean.arch (∑' _ : ι, b) hb have : ∀ s : Finset ι, s.card ≤ n := fun s ↦ by simpa [nsmul_le_nsmul_iff_left hb] using (H s).trans hn have : Fintype ι := fintypeOfFinsetCardLe n this infer_instance theorem Set.Finite.of_summable_const [LinearOrderedAddCommGroup α] [TopologicalSpace α] [Archimedean α] [OrderClosedTopology α] {b : α} (hb : 0 < b) (hf : Summable fun _ : ι ↦ b) : (Set.univ : Set ι).Finite := finite_univ_iff.2 <| .of_summable_const hb hf end LinearOrder theorem Summable.tendsto_atTop_of_pos [LinearOrderedField α] [TopologicalSpace α] [OrderTopology α] {f : ℕ → α} (hf : Summable f⁻¹) (hf' : ∀ n, 0 < f n) : Tendsto f atTop atTop := inv_inv f ▸ Filter.Tendsto.inv_tendsto_zero <| tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within _ hf.tendsto_atTop_zero <| eventually_of_forall fun _ ↦ inv_pos.2 (hf' _)
Topology\Algebra\InfiniteSum\Real.lean
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel, Yury Kudryashov -/ import Mathlib.Algebra.BigOperators.Intervals import Mathlib.Topology.Algebra.InfiniteSum.Order import Mathlib.Topology.Instances.Real import Mathlib.Topology.Instances.ENNReal /-! # Infinite sum in the reals This file provides lemmas about Cauchy sequences in terms of infinite sums and infinite sums valued in the reals. -/ open Filter Finset NNReal Topology variable {α β : Type*} [PseudoMetricSpace α] {f : ℕ → α} {a : α} /-- If the distance between consecutive points of a sequence is estimated by a summable series, then the original sequence is a Cauchy sequence. -/ theorem cauchySeq_of_dist_le_of_summable (d : ℕ → ℝ) (hf : ∀ n, dist (f n) (f n.succ) ≤ d n) (hd : Summable d) : CauchySeq f := by lift d to ℕ → ℝ≥0 using fun n ↦ dist_nonneg.trans (hf n) apply cauchySeq_of_edist_le_of_summable d (α := α) (f := f) · exact_mod_cast hf · exact_mod_cast hd theorem cauchySeq_of_summable_dist (h : Summable fun n ↦ dist (f n) (f n.succ)) : CauchySeq f := cauchySeq_of_dist_le_of_summable _ (fun _ ↦ le_rfl) h theorem dist_le_tsum_of_dist_le_of_tendsto (d : ℕ → ℝ) (hf : ∀ n, dist (f n) (f n.succ) ≤ d n) (hd : Summable d) {a : α} (ha : Tendsto f atTop (𝓝 a)) (n : ℕ) : dist (f n) a ≤ ∑' m, d (n + m) := by refine le_of_tendsto (tendsto_const_nhds.dist ha) (eventually_atTop.2 ⟨n, fun m hnm ↦ ?_⟩) refine le_trans (dist_le_Ico_sum_of_dist_le hnm fun _ _ ↦ hf _) ?_ rw [sum_Ico_eq_sum_range] refine sum_le_tsum (range _) (fun _ _ ↦ le_trans dist_nonneg (hf _)) ?_ exact hd.comp_injective (add_right_injective n) theorem dist_le_tsum_of_dist_le_of_tendsto₀ (d : ℕ → ℝ) (hf : ∀ n, dist (f n) (f n.succ) ≤ d n) (hd : Summable d) (ha : Tendsto f atTop (𝓝 a)) : dist (f 0) a ≤ tsum d := by simpa only [zero_add] using dist_le_tsum_of_dist_le_of_tendsto d hf hd ha 0 theorem dist_le_tsum_dist_of_tendsto (h : Summable fun n ↦ dist (f n) (f n.succ)) (ha : Tendsto f atTop (𝓝 a)) (n) : dist (f n) a ≤ ∑' m, dist (f (n + m)) (f (n + m).succ) := show dist (f n) a ≤ ∑' m, (fun x ↦ dist (f x) (f x.succ)) (n + m) from dist_le_tsum_of_dist_le_of_tendsto (fun n ↦ dist (f n) (f n.succ)) (fun _ ↦ le_rfl) h ha n theorem dist_le_tsum_dist_of_tendsto₀ (h : Summable fun n ↦ dist (f n) (f n.succ)) (ha : Tendsto f atTop (𝓝 a)) : dist (f 0) a ≤ ∑' n, dist (f n) (f n.succ) := by simpa only [zero_add] using dist_le_tsum_dist_of_tendsto h ha 0 section summable theorem not_summable_iff_tendsto_nat_atTop_of_nonneg {f : ℕ → ℝ} (hf : ∀ n, 0 ≤ f n) : ¬Summable f ↔ Tendsto (fun n : ℕ => ∑ i ∈ Finset.range n, f i) atTop atTop := by lift f to ℕ → ℝ≥0 using hf exact mod_cast NNReal.not_summable_iff_tendsto_nat_atTop theorem summable_iff_not_tendsto_nat_atTop_of_nonneg {f : ℕ → ℝ} (hf : ∀ n, 0 ≤ f n) : Summable f ↔ ¬Tendsto (fun n : ℕ => ∑ i ∈ Finset.range n, f i) atTop atTop := by rw [← not_iff_not, Classical.not_not, not_summable_iff_tendsto_nat_atTop_of_nonneg hf] theorem summable_sigma_of_nonneg {α} {β : α → Type*} {f : (Σ x, β x) → ℝ} (hf : ∀ x, 0 ≤ f x) : Summable f ↔ (∀ x, Summable fun y => f ⟨x, y⟩) ∧ Summable fun x => ∑' y, f ⟨x, y⟩ := by lift f to (Σx, β x) → ℝ≥0 using hf exact mod_cast NNReal.summable_sigma lemma summable_partition {α β : Type*} {f : β → ℝ} (hf : 0 ≤ f) {s : α → Set β} (hs : ∀ i, ∃! j, i ∈ s j) : Summable f ↔ (∀ j, Summable fun i : s j ↦ f i) ∧ Summable fun j ↦ ∑' i : s j, f i := by simpa only [← (Set.sigmaEquiv s hs).summable_iff] using summable_sigma_of_nonneg (fun _ ↦ hf _) theorem summable_prod_of_nonneg {α β} {f : (α × β) → ℝ} (hf : 0 ≤ f) : Summable f ↔ (∀ x, Summable fun y ↦ f (x, y)) ∧ Summable fun x ↦ ∑' y, f (x, y) := (Equiv.sigmaEquivProd _ _).summable_iff.symm.trans <| summable_sigma_of_nonneg fun _ ↦ hf _ theorem summable_of_sum_le {ι : Type*} {f : ι → ℝ} {c : ℝ} (hf : 0 ≤ f) (h : ∀ u : Finset ι, ∑ x ∈ u, f x ≤ c) : Summable f := ⟨⨆ u : Finset ι, ∑ x ∈ u, f x, tendsto_atTop_ciSup (Finset.sum_mono_set_of_nonneg hf) ⟨c, fun _ ⟨u, hu⟩ => hu ▸ h u⟩⟩ theorem summable_of_sum_range_le {f : ℕ → ℝ} {c : ℝ} (hf : ∀ n, 0 ≤ f n) (h : ∀ n, ∑ i ∈ Finset.range n, f i ≤ c) : Summable f := by refine (summable_iff_not_tendsto_nat_atTop_of_nonneg hf).2 fun H => ?_ rcases exists_lt_of_tendsto_atTop H 0 c with ⟨n, -, hn⟩ exact lt_irrefl _ (hn.trans_le (h n)) theorem Real.tsum_le_of_sum_range_le {f : ℕ → ℝ} {c : ℝ} (hf : ∀ n, 0 ≤ f n) (h : ∀ n, ∑ i ∈ Finset.range n, f i ≤ c) : ∑' n, f n ≤ c := _root_.tsum_le_of_sum_range_le (summable_of_sum_range_le hf h) h /-- If a sequence `f` with non-negative terms is dominated by a sequence `g` with summable series and at least one term of `f` is strictly smaller than the corresponding term in `g`, then the series of `f` is strictly smaller than the series of `g`. -/ theorem tsum_lt_tsum_of_nonneg {i : ℕ} {f g : ℕ → ℝ} (h0 : ∀ b : ℕ, 0 ≤ f b) (h : ∀ b : ℕ, f b ≤ g b) (hi : f i < g i) (hg : Summable g) : ∑' n, f n < ∑' n, g n := tsum_lt_tsum h hi (.of_nonneg_of_le h0 h hg) hg end summable
Topology\Algebra\InfiniteSum\Ring.lean
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl -/ import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Topology.Algebra.InfiniteSum.Constructions import Mathlib.Topology.Algebra.Ring.Basic /-! # Infinite sum in a ring This file provides lemmas about the interaction between infinite sums and multiplication. ## Main results * `tsum_mul_tsum_eq_tsum_sum_antidiagonal`: Cauchy product formula -/ open Filter Finset Function open scoped Classical variable {ι κ R α : Type*} section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] [TopologicalSpace α] [TopologicalSemiring α] {f g : ι → α} {a a₁ a₂ : α} theorem HasSum.mul_left (a₂) (h : HasSum f a₁) : HasSum (fun i ↦ a₂ * f i) (a₂ * a₁) := by simpa only using h.map (AddMonoidHom.mulLeft a₂) (continuous_const.mul continuous_id) theorem HasSum.mul_right (a₂) (hf : HasSum f a₁) : HasSum (fun i ↦ f i * a₂) (a₁ * a₂) := by simpa only using hf.map (AddMonoidHom.mulRight a₂) (continuous_id.mul continuous_const) theorem Summable.mul_left (a) (hf : Summable f) : Summable fun i ↦ a * f i := (hf.hasSum.mul_left _).summable theorem Summable.mul_right (a) (hf : Summable f) : Summable fun i ↦ f i * a := (hf.hasSum.mul_right _).summable section tsum variable [T2Space α] theorem Summable.tsum_mul_left (a) (hf : Summable f) : ∑' i, a * f i = a * ∑' i, f i := (hf.hasSum.mul_left _).tsum_eq theorem Summable.tsum_mul_right (a) (hf : Summable f) : ∑' i, f i * a = (∑' i, f i) * a := (hf.hasSum.mul_right _).tsum_eq theorem Commute.tsum_right (a) (h : ∀ i, Commute a (f i)) : Commute a (∑' i, f i) := if hf : Summable f then (hf.tsum_mul_left a).symm.trans ((congr_arg _ <| funext h).trans (hf.tsum_mul_right a)) else (tsum_eq_zero_of_not_summable hf).symm ▸ Commute.zero_right _ theorem Commute.tsum_left (a) (h : ∀ i, Commute (f i) a) : Commute (∑' i, f i) a := (Commute.tsum_right _ fun i ↦ (h i).symm).symm end tsum end NonUnitalNonAssocSemiring section DivisionSemiring variable [DivisionSemiring α] [TopologicalSpace α] [TopologicalSemiring α] {f g : ι → α} {a a₁ a₂ : α} theorem HasSum.div_const (h : HasSum f a) (b : α) : HasSum (fun i ↦ f i / b) (a / b) := by simp only [div_eq_mul_inv, h.mul_right b⁻¹] theorem Summable.div_const (h : Summable f) (b : α) : Summable fun i ↦ f i / b := (h.hasSum.div_const _).summable theorem hasSum_mul_left_iff (h : a₂ ≠ 0) : HasSum (fun i ↦ a₂ * f i) (a₂ * a₁) ↔ HasSum f a₁ := ⟨fun H ↦ by simpa only [inv_mul_cancel_left₀ h] using H.mul_left a₂⁻¹, HasSum.mul_left _⟩ theorem hasSum_mul_right_iff (h : a₂ ≠ 0) : HasSum (fun i ↦ f i * a₂) (a₁ * a₂) ↔ HasSum f a₁ := ⟨fun H ↦ by simpa only [mul_inv_cancel_right₀ h] using H.mul_right a₂⁻¹, HasSum.mul_right _⟩ theorem hasSum_div_const_iff (h : a₂ ≠ 0) : HasSum (fun i ↦ f i / a₂) (a₁ / a₂) ↔ HasSum f a₁ := by simpa only [div_eq_mul_inv] using hasSum_mul_right_iff (inv_ne_zero h) theorem summable_mul_left_iff (h : a ≠ 0) : (Summable fun i ↦ a * f i) ↔ Summable f := ⟨fun H ↦ by simpa only [inv_mul_cancel_left₀ h] using H.mul_left a⁻¹, fun H ↦ H.mul_left _⟩ theorem summable_mul_right_iff (h : a ≠ 0) : (Summable fun i ↦ f i * a) ↔ Summable f := ⟨fun H ↦ by simpa only [mul_inv_cancel_right₀ h] using H.mul_right a⁻¹, fun H ↦ H.mul_right _⟩ theorem summable_div_const_iff (h : a ≠ 0) : (Summable fun i ↦ f i / a) ↔ Summable f := by simpa only [div_eq_mul_inv] using summable_mul_right_iff (inv_ne_zero h) theorem tsum_mul_left [T2Space α] : ∑' x, a * f x = a * ∑' x, f x := if hf : Summable f then hf.tsum_mul_left a else if ha : a = 0 then by simp [ha] else by rw [tsum_eq_zero_of_not_summable hf, tsum_eq_zero_of_not_summable (mt (summable_mul_left_iff ha).mp hf), mul_zero] theorem tsum_mul_right [T2Space α] : ∑' x, f x * a = (∑' x, f x) * a := if hf : Summable f then hf.tsum_mul_right a else if ha : a = 0 then by simp [ha] else by rw [tsum_eq_zero_of_not_summable hf, tsum_eq_zero_of_not_summable (mt (summable_mul_right_iff ha).mp hf), zero_mul] theorem tsum_div_const [T2Space α] : ∑' x, f x / a = (∑' x, f x) / a := by simpa only [div_eq_mul_inv] using tsum_mul_right end DivisionSemiring /-! ### Multiplying two infinite sums In this section, we prove various results about `(∑' x : ι, f x) * (∑' y : κ, g y)`. Note that we always assume that the family `fun x : ι × κ ↦ f x.1 * g x.2` is summable, since there is no way to deduce this from the summabilities of `f` and `g` in general, but if you are working in a normed space, you may want to use the analogous lemmas in `Analysis.Normed.Module.Basic` (e.g `tsum_mul_tsum_of_summable_norm`). We first establish results about arbitrary index types, `ι` and `κ`, and then we specialize to `ι = κ = ℕ` to prove the Cauchy product formula (see `tsum_mul_tsum_eq_tsum_sum_antidiagonal`). #### Arbitrary index types -/ section tsum_mul_tsum variable [TopologicalSpace α] [T3Space α] [NonUnitalNonAssocSemiring α] [TopologicalSemiring α] {f : ι → α} {g : κ → α} {s t u : α} theorem HasSum.mul_eq (hf : HasSum f s) (hg : HasSum g t) (hfg : HasSum (fun x : ι × κ ↦ f x.1 * g x.2) u) : s * t = u := have key₁ : HasSum (fun i ↦ f i * t) (s * t) := hf.mul_right t have this : ∀ i : ι, HasSum (fun c : κ ↦ f i * g c) (f i * t) := fun i ↦ hg.mul_left (f i) have key₂ : HasSum (fun i ↦ f i * t) u := HasSum.prod_fiberwise hfg this key₁.unique key₂ theorem HasSum.mul (hf : HasSum f s) (hg : HasSum g t) (hfg : Summable fun x : ι × κ ↦ f x.1 * g x.2) : HasSum (fun x : ι × κ ↦ f x.1 * g x.2) (s * t) := let ⟨_u, hu⟩ := hfg (hf.mul_eq hg hu).symm ▸ hu /-- Product of two infinites sums indexed by arbitrary types. See also `tsum_mul_tsum_of_summable_norm` if `f` and `g` are absolutely summable. -/ theorem tsum_mul_tsum (hf : Summable f) (hg : Summable g) (hfg : Summable fun x : ι × κ ↦ f x.1 * g x.2) : ((∑' x, f x) * ∑' y, g y) = ∑' z : ι × κ, f z.1 * g z.2 := hf.hasSum.mul_eq hg.hasSum hfg.hasSum end tsum_mul_tsum /-! #### `ℕ`-indexed families (Cauchy product) We prove two versions of the Cauchy product formula. The first one is `tsum_mul_tsum_eq_tsum_sum_range`, where the `n`-th term is a sum over `Finset.range (n+1)` involving `Nat` subtraction. In order to avoid `Nat` subtraction, we also provide `tsum_mul_tsum_eq_tsum_sum_antidiagonal`, where the `n`-th term is a sum over all pairs `(k, l)` such that `k+l=n`, which corresponds to the `Finset` `Finset.antidiagonal n`. This in fact allows us to generalize to any type satisfying `[Finset.HasAntidiagonal A]` -/ section CauchyProduct section HasAntidiagonal variable {A : Type*} [AddCommMonoid A] [HasAntidiagonal A] variable [TopologicalSpace α] [NonUnitalNonAssocSemiring α] {f g : A → α} /-- The family `(k, l) : ℕ × ℕ ↦ f k * g l` is summable if and only if the family `(n, k, l) : Σ (n : ℕ), antidiagonal n ↦ f k * g l` is summable. -/ theorem summable_mul_prod_iff_summable_mul_sigma_antidiagonal : (Summable fun x : A × A ↦ f x.1 * g x.2) ↔ Summable fun x : Σn : A, antidiagonal n ↦ f (x.2 : A × A).1 * g (x.2 : A × A).2 := Finset.sigmaAntidiagonalEquivProd.summable_iff.symm variable [T3Space α] [TopologicalSemiring α] theorem summable_sum_mul_antidiagonal_of_summable_mul (h : Summable fun x : A × A ↦ f x.1 * g x.2) : Summable fun n ↦ ∑ kl ∈ antidiagonal n, f kl.1 * g kl.2 := by rw [summable_mul_prod_iff_summable_mul_sigma_antidiagonal] at h conv => congr; ext; rw [← Finset.sum_finset_coe, ← tsum_fintype] exact h.sigma' fun n ↦ (hasSum_fintype _).summable /-- The **Cauchy product formula** for the product of two infinites sums indexed by `ℕ`, expressed by summing on `Finset.antidiagonal`. See also `tsum_mul_tsum_eq_tsum_sum_antidiagonal_of_summable_norm` if `f` and `g` are absolutely summable. -/ theorem tsum_mul_tsum_eq_tsum_sum_antidiagonal (hf : Summable f) (hg : Summable g) (hfg : Summable fun x : A × A ↦ f x.1 * g x.2) : ((∑' n, f n) * ∑' n, g n) = ∑' n, ∑ kl ∈ antidiagonal n, f kl.1 * g kl.2 := by conv_rhs => congr; ext; rw [← Finset.sum_finset_coe, ← tsum_fintype] rw [tsum_mul_tsum hf hg hfg, ← sigmaAntidiagonalEquivProd.tsum_eq (_ : A × A → α)] exact tsum_sigma' (fun n ↦ (hasSum_fintype _).summable) (summable_mul_prod_iff_summable_mul_sigma_antidiagonal.mp hfg) end HasAntidiagonal section Nat variable [TopologicalSpace α] [NonUnitalNonAssocSemiring α] {f g : ℕ → α} variable [T3Space α] [TopologicalSemiring α] theorem summable_sum_mul_range_of_summable_mul (h : Summable fun x : ℕ × ℕ ↦ f x.1 * g x.2) : Summable fun n ↦ ∑ k ∈ range (n + 1), f k * g (n - k) := by simp_rw [← Nat.sum_antidiagonal_eq_sum_range_succ fun k l ↦ f k * g l] exact summable_sum_mul_antidiagonal_of_summable_mul h /-- The **Cauchy product formula** for the product of two infinites sums indexed by `ℕ`, expressed by summing on `Finset.range`. See also `tsum_mul_tsum_eq_tsum_sum_range_of_summable_norm` if `f` and `g` are absolutely summable. -/ theorem tsum_mul_tsum_eq_tsum_sum_range (hf : Summable f) (hg : Summable g) (hfg : Summable fun x : ℕ × ℕ ↦ f x.1 * g x.2) : ((∑' n, f n) * ∑' n, g n) = ∑' n, ∑ k ∈ range (n + 1), f k * g (n - k) := by simp_rw [← Nat.sum_antidiagonal_eq_sum_range_succ fun k l ↦ f k * g l] exact tsum_mul_tsum_eq_tsum_sum_antidiagonal hf hg hfg end Nat end CauchyProduct
Topology\Algebra\Module\Basic.lean
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Jan-David Salchow, Sébastien Gouëzel, Jean Lo, Yury Kudryashov, Frédéric Dupuis, Heather Macbeth -/ import Mathlib.Topology.Algebra.Ring.Basic import Mathlib.Topology.Algebra.MulAction import Mathlib.Topology.Algebra.UniformGroup import Mathlib.Topology.ContinuousFunction.Basic import Mathlib.Topology.UniformSpace.UniformEmbedding import Mathlib.Algebra.Algebra.Defs import Mathlib.LinearAlgebra.Projection import Mathlib.LinearAlgebra.Pi import Mathlib.LinearAlgebra.Finsupp /-! # Theory of topological modules and continuous linear maps. We use the class `ContinuousSMul` for topological (semi) modules and topological vector spaces. In this file we define continuous (semi-)linear maps, as semilinear maps between topological modules which are continuous. The set of continuous semilinear maps between the topological `R₁`-module `M` and `R₂`-module `M₂` with respect to the `RingHom` `σ` is denoted by `M →SL[σ] M₂`. Plain linear maps are denoted by `M →L[R] M₂` and star-linear maps by `M →L⋆[R] M₂`. The corresponding notation for equivalences is `M ≃SL[σ] M₂`, `M ≃L[R] M₂` and `M ≃L⋆[R] M₂`. -/ assert_not_exists Star.star open LinearMap (ker range) open Topology Filter Pointwise universe u v w u' section variable {R : Type*} {M : Type*} [Ring R] [TopologicalSpace R] [TopologicalSpace M] [AddCommGroup M] [Module R M] theorem ContinuousSMul.of_nhds_zero [TopologicalRing R] [TopologicalAddGroup M] (hmul : Tendsto (fun p : R × M => p.1 • p.2) (𝓝 0 ×ˢ 𝓝 0) (𝓝 0)) (hmulleft : ∀ m : M, Tendsto (fun a : R => a • m) (𝓝 0) (𝓝 0)) (hmulright : ∀ a : R, Tendsto (fun m : M => a • m) (𝓝 0) (𝓝 0)) : ContinuousSMul R M where continuous_smul := by refine continuous_of_continuousAt_zero₂ (AddMonoidHom.smul : R →+ M →+ M) ?_ ?_ ?_ <;> simpa [ContinuousAt, nhds_prod_eq] end section variable {R : Type*} {M : Type*} [Ring R] [TopologicalSpace R] [TopologicalSpace M] [AddCommGroup M] [ContinuousAdd M] [Module R M] [ContinuousSMul R M] /-- If `M` is a topological module over `R` and `0` is a limit of invertible elements of `R`, then `⊤` is the only submodule of `M` with a nonempty interior. This is the case, e.g., if `R` is a nontrivially normed field. -/ theorem Submodule.eq_top_of_nonempty_interior' [NeBot (𝓝[{ x : R | IsUnit x }] 0)] (s : Submodule R M) (hs : (interior (s : Set M)).Nonempty) : s = ⊤ := by rcases hs with ⟨y, hy⟩ refine Submodule.eq_top_iff'.2 fun x => ?_ rw [mem_interior_iff_mem_nhds] at hy have : Tendsto (fun c : R => y + c • x) (𝓝[{ x : R | IsUnit x }] 0) (𝓝 (y + (0 : R) • x)) := tendsto_const_nhds.add ((tendsto_nhdsWithin_of_tendsto_nhds tendsto_id).smul tendsto_const_nhds) rw [zero_smul, add_zero] at this obtain ⟨_, hu : y + _ • _ ∈ s, u, rfl⟩ := nonempty_of_mem (inter_mem (Filter.mem_map.1 (this hy)) self_mem_nhdsWithin) have hy' : y ∈ ↑s := mem_of_mem_nhds hy rwa [s.add_mem_iff_right hy', ← Units.smul_def, s.smul_mem_iff' u] at hu variable (R M) /-- Let `R` be a topological ring such that zero is not an isolated point (e.g., a nontrivially normed field, see `NormedField.punctured_nhds_neBot`). Let `M` be a nontrivial module over `R` such that `c • x = 0` implies `c = 0 ∨ x = 0`. Then `M` has no isolated points. We formulate this using `NeBot (𝓝[≠] x)`. This lemma is not an instance because Lean would need to find `[ContinuousSMul ?m_1 M]` with unknown `?m_1`. We register this as an instance for `R = ℝ` in `Real.punctured_nhds_module_neBot`. One can also use `haveI := Module.punctured_nhds_neBot R M` in a proof. -/ theorem Module.punctured_nhds_neBot [Nontrivial M] [NeBot (𝓝[≠] (0 : R))] [NoZeroSMulDivisors R M] (x : M) : NeBot (𝓝[≠] x) := by rcases exists_ne (0 : M) with ⟨y, hy⟩ suffices Tendsto (fun c : R => x + c • y) (𝓝[≠] 0) (𝓝[≠] x) from this.neBot refine Tendsto.inf ?_ (tendsto_principal_principal.2 <| ?_) · convert tendsto_const_nhds.add ((@tendsto_id R _).smul_const y) rw [zero_smul, add_zero] · intro c hc simpa [hy] using hc end section LatticeOps variable {ι R M₁ M₂ : Type*} [Semiring R] [AddCommMonoid M₁] [AddCommMonoid M₂] [Module R M₁] [Module R M₂] [u : TopologicalSpace R] {t : TopologicalSpace M₂} [ContinuousSMul R M₂] (f : M₁ →ₗ[R] M₂) theorem continuousSMul_induced : @ContinuousSMul R M₁ _ u (t.induced f) := let _ : TopologicalSpace M₁ := t.induced f Inducing.continuousSMul ⟨rfl⟩ continuous_id (map_smul f _ _) end LatticeOps /-- The span of a separable subset with respect to a separable scalar ring is again separable. -/ lemma TopologicalSpace.IsSeparable.span {R M : Type*} [AddCommMonoid M] [Semiring R] [Module R M] [TopologicalSpace M] [TopologicalSpace R] [SeparableSpace R] [ContinuousAdd M] [ContinuousSMul R M] {s : Set M} (hs : IsSeparable s) : IsSeparable (Submodule.span R s : Set M) := by rw [span_eq_iUnion_nat] refine .iUnion fun n ↦ .image ?_ ?_ · have : IsSeparable {f : Fin n → R × M | ∀ (i : Fin n), f i ∈ Set.univ ×ˢ s} := by apply isSeparable_pi (fun i ↦ .prod (.of_separableSpace Set.univ) hs) rwa [Set.univ_prod] at this · apply continuous_finset_sum _ (fun i _ ↦ ?_) exact (continuous_fst.comp (continuous_apply i)).smul (continuous_snd.comp (continuous_apply i)) namespace Submodule variable {α β : Type*} [TopologicalSpace β] instance topologicalAddGroup [Ring α] [AddCommGroup β] [Module α β] [TopologicalAddGroup β] (S : Submodule α β) : TopologicalAddGroup S := inferInstanceAs (TopologicalAddGroup S.toAddSubgroup) end Submodule section closure variable {R R' : Type u} {M M' : Type v} [Semiring R] [Ring R'] [TopologicalSpace M] [AddCommMonoid M] [TopologicalSpace M'] [AddCommGroup M'] [Module R M] [ContinuousConstSMul R M] [Module R' M'] [ContinuousConstSMul R' M'] theorem Submodule.mapsTo_smul_closure (s : Submodule R M) (c : R) : Set.MapsTo (c • ·) (closure s : Set M) (closure s) := have : Set.MapsTo (c • ·) (s : Set M) s := fun _ h ↦ s.smul_mem c h this.closure (continuous_const_smul c) theorem Submodule.smul_closure_subset (s : Submodule R M) (c : R) : c • closure (s : Set M) ⊆ closure (s : Set M) := (s.mapsTo_smul_closure c).image_subset variable [ContinuousAdd M] /-- The (topological-space) closure of a submodule of a topological `R`-module `M` is itself a submodule. -/ def Submodule.topologicalClosure (s : Submodule R M) : Submodule R M := { s.toAddSubmonoid.topologicalClosure with smul_mem' := s.mapsTo_smul_closure } @[simp] theorem Submodule.topologicalClosure_coe (s : Submodule R M) : (s.topologicalClosure : Set M) = closure (s : Set M) := rfl theorem Submodule.le_topologicalClosure (s : Submodule R M) : s ≤ s.topologicalClosure := subset_closure theorem Submodule.closure_subset_topologicalClosure_span (s : Set M) : closure s ⊆ (span R s).topologicalClosure := by rw [Submodule.topologicalClosure_coe] exact closure_mono subset_span theorem Submodule.isClosed_topologicalClosure (s : Submodule R M) : IsClosed (s.topologicalClosure : Set M) := isClosed_closure theorem Submodule.topologicalClosure_minimal (s : Submodule R M) {t : Submodule R M} (h : s ≤ t) (ht : IsClosed (t : Set M)) : s.topologicalClosure ≤ t := closure_minimal h ht theorem Submodule.topologicalClosure_mono {s : Submodule R M} {t : Submodule R M} (h : s ≤ t) : s.topologicalClosure ≤ t.topologicalClosure := closure_mono h /-- The topological closure of a closed submodule `s` is equal to `s`. -/ theorem IsClosed.submodule_topologicalClosure_eq {s : Submodule R M} (hs : IsClosed (s : Set M)) : s.topologicalClosure = s := SetLike.ext' hs.closure_eq /-- A subspace is dense iff its topological closure is the entire space. -/ theorem Submodule.dense_iff_topologicalClosure_eq_top {s : Submodule R M} : Dense (s : Set M) ↔ s.topologicalClosure = ⊤ := by rw [← SetLike.coe_set_eq, dense_iff_closure_eq] simp instance Submodule.topologicalClosure.completeSpace {M' : Type*} [AddCommMonoid M'] [Module R M'] [UniformSpace M'] [ContinuousAdd M'] [ContinuousConstSMul R M'] [CompleteSpace M'] (U : Submodule R M') : CompleteSpace U.topologicalClosure := isClosed_closure.completeSpace_coe /-- A maximal proper subspace of a topological module (i.e a `Submodule` satisfying `IsCoatom`) is either closed or dense. -/ theorem Submodule.isClosed_or_dense_of_isCoatom (s : Submodule R M) (hs : IsCoatom s) : IsClosed (s : Set M) ∨ Dense (s : Set M) := by refine (hs.le_iff.mp s.le_topologicalClosure).symm.imp ?_ dense_iff_topologicalClosure_eq_top.mpr exact fun h ↦ h ▸ isClosed_closure end closure section Pi theorem LinearMap.continuous_on_pi {ι : Type*} {R : Type*} {M : Type*} [Finite ι] [Semiring R] [TopologicalSpace R] [AddCommMonoid M] [Module R M] [TopologicalSpace M] [ContinuousAdd M] [ContinuousSMul R M] (f : (ι → R) →ₗ[R] M) : Continuous f := by cases nonempty_fintype ι classical -- for the proof, write `f` in the standard basis, and use that each coordinate is a continuous -- function. have : (f : (ι → R) → M) = fun x => ∑ i : ι, x i • f fun j => if i = j then 1 else 0 := by ext x exact f.pi_apply_eq_sum_univ x rw [this] refine continuous_finset_sum _ fun i _ => ?_ exact (continuous_apply i).smul continuous_const end Pi /-- Continuous linear maps between modules. We only put the type classes that are necessary for the definition, although in applications `M` and `M₂` will be topological modules over the topological ring `R`. -/ structure ContinuousLinearMap {R : Type*} {S : Type*} [Semiring R] [Semiring S] (σ : R →+* S) (M : Type*) [TopologicalSpace M] [AddCommMonoid M] (M₂ : Type*) [TopologicalSpace M₂] [AddCommMonoid M₂] [Module R M] [Module S M₂] extends M →ₛₗ[σ] M₂ where cont : Continuous toFun := by continuity attribute [inherit_doc ContinuousLinearMap] ContinuousLinearMap.cont @[inherit_doc] notation:25 M " →SL[" σ "] " M₂ => ContinuousLinearMap σ M M₂ @[inherit_doc] notation:25 M " →L[" R "] " M₂ => ContinuousLinearMap (RingHom.id R) M M₂ /-- `ContinuousSemilinearMapClass F σ M M₂` asserts `F` is a type of bundled continuous `σ`-semilinear maps `M → M₂`. See also `ContinuousLinearMapClass F R M M₂` for the case where `σ` is the identity map on `R`. A map `f` between an `R`-module and an `S`-module over a ring homomorphism `σ : R →+* S` is semilinear if it satisfies the two properties `f (x + y) = f x + f y` and `f (c • x) = (σ c) • f x`. -/ class ContinuousSemilinearMapClass (F : Type*) {R S : outParam Type*} [Semiring R] [Semiring S] (σ : outParam <| R →+* S) (M : outParam Type*) [TopologicalSpace M] [AddCommMonoid M] (M₂ : outParam Type*) [TopologicalSpace M₂] [AddCommMonoid M₂] [Module R M] [Module S M₂] [FunLike F M M₂] extends SemilinearMapClass F σ M M₂, ContinuousMapClass F M M₂ : Prop -- `σ`, `R` and `S` become metavariables, but they are all outparams so it's OK -- Porting note(#12094): removed nolint; dangerous_instance linter not ported yet -- attribute [nolint dangerous_instance] ContinuousSemilinearMapClass.toContinuousMapClass /-- `ContinuousLinearMapClass F R M M₂` asserts `F` is a type of bundled continuous `R`-linear maps `M → M₂`. This is an abbreviation for `ContinuousSemilinearMapClass F (RingHom.id R) M M₂`. -/ abbrev ContinuousLinearMapClass (F : Type*) (R : outParam Type*) [Semiring R] (M : outParam Type*) [TopologicalSpace M] [AddCommMonoid M] (M₂ : outParam Type*) [TopologicalSpace M₂] [AddCommMonoid M₂] [Module R M] [Module R M₂] [FunLike F M M₂] := ContinuousSemilinearMapClass F (RingHom.id R) M M₂ /-- Continuous linear equivalences between modules. We only put the type classes that are necessary for the definition, although in applications `M` and `M₂` will be topological modules over the topological semiring `R`. -/ -- Porting note (#5171): linter not ported yet; was @[nolint has_nonempty_instance] structure ContinuousLinearEquiv {R : Type*} {S : Type*} [Semiring R] [Semiring S] (σ : R →+* S) {σ' : S →+* R} [RingHomInvPair σ σ'] [RingHomInvPair σ' σ] (M : Type*) [TopologicalSpace M] [AddCommMonoid M] (M₂ : Type*) [TopologicalSpace M₂] [AddCommMonoid M₂] [Module R M] [Module S M₂] extends M ≃ₛₗ[σ] M₂ where continuous_toFun : Continuous toFun := by continuity continuous_invFun : Continuous invFun := by continuity attribute [inherit_doc ContinuousLinearEquiv] ContinuousLinearEquiv.continuous_toFun ContinuousLinearEquiv.continuous_invFun @[inherit_doc] notation:50 M " ≃SL[" σ "] " M₂ => ContinuousLinearEquiv σ M M₂ @[inherit_doc] notation:50 M " ≃L[" R "] " M₂ => ContinuousLinearEquiv (RingHom.id R) M M₂ /-- `ContinuousSemilinearEquivClass F σ M M₂` asserts `F` is a type of bundled continuous `σ`-semilinear equivs `M → M₂`. See also `ContinuousLinearEquivClass F R M M₂` for the case where `σ` is the identity map on `R`. A map `f` between an `R`-module and an `S`-module over a ring homomorphism `σ : R →+* S` is semilinear if it satisfies the two properties `f (x + y) = f x + f y` and `f (c • x) = (σ c) • f x`. -/ class ContinuousSemilinearEquivClass (F : Type*) {R : outParam Type*} {S : outParam Type*} [Semiring R] [Semiring S] (σ : outParam <| R →+* S) {σ' : outParam <| S →+* R} [RingHomInvPair σ σ'] [RingHomInvPair σ' σ] (M : outParam Type*) [TopologicalSpace M] [AddCommMonoid M] (M₂ : outParam Type*) [TopologicalSpace M₂] [AddCommMonoid M₂] [Module R M] [Module S M₂] [EquivLike F M M₂] extends SemilinearEquivClass F σ M M₂ : Prop where map_continuous : ∀ f : F, Continuous f := by continuity inv_continuous : ∀ f : F, Continuous (EquivLike.inv f) := by continuity attribute [inherit_doc ContinuousSemilinearEquivClass] ContinuousSemilinearEquivClass.map_continuous ContinuousSemilinearEquivClass.inv_continuous /-- `ContinuousLinearEquivClass F σ M M₂` asserts `F` is a type of bundled continuous `R`-linear equivs `M → M₂`. This is an abbreviation for `ContinuousSemilinearEquivClass F (RingHom.id R) M M₂`. -/ abbrev ContinuousLinearEquivClass (F : Type*) (R : outParam Type*) [Semiring R] (M : outParam Type*) [TopologicalSpace M] [AddCommMonoid M] (M₂ : outParam Type*) [TopologicalSpace M₂] [AddCommMonoid M₂] [Module R M] [Module R M₂] [EquivLike F M M₂] := ContinuousSemilinearEquivClass F (RingHom.id R) M M₂ namespace ContinuousSemilinearEquivClass variable (F : Type*) {R : Type*} {S : Type*} [Semiring R] [Semiring S] (σ : R →+* S) {σ' : S →+* R} [RingHomInvPair σ σ'] [RingHomInvPair σ' σ] (M : Type*) [TopologicalSpace M] [AddCommMonoid M] (M₂ : Type*) [TopologicalSpace M₂] [AddCommMonoid M₂] [Module R M] [Module S M₂] -- `σ'` becomes a metavariable, but it's OK since it's an outparam instance (priority := 100) continuousSemilinearMapClass [EquivLike F M M₂] [s : ContinuousSemilinearEquivClass F σ M M₂] : ContinuousSemilinearMapClass F σ M M₂ := { s with } end ContinuousSemilinearEquivClass section PointwiseLimits variable {M₁ M₂ α R S : Type*} [TopologicalSpace M₂] [T2Space M₂] [Semiring R] [Semiring S] [AddCommMonoid M₁] [AddCommMonoid M₂] [Module R M₁] [Module S M₂] [ContinuousConstSMul S M₂] variable [ContinuousAdd M₂] {σ : R →+* S} {l : Filter α} /-- Constructs a bundled linear map from a function and a proof that this function belongs to the closure of the set of linear maps. -/ @[simps (config := .asFn)] def linearMapOfMemClosureRangeCoe (f : M₁ → M₂) (hf : f ∈ closure (Set.range ((↑) : (M₁ →ₛₗ[σ] M₂) → M₁ → M₂))) : M₁ →ₛₗ[σ] M₂ := { addMonoidHomOfMemClosureRangeCoe f hf with map_smul' := (isClosed_setOf_map_smul M₁ M₂ σ).closure_subset_iff.2 (Set.range_subset_iff.2 LinearMap.map_smulₛₗ) hf } /-- Construct a bundled linear map from a pointwise limit of linear maps -/ @[simps! (config := .asFn)] def linearMapOfTendsto (f : M₁ → M₂) (g : α → M₁ →ₛₗ[σ] M₂) [l.NeBot] (h : Tendsto (fun a x => g a x) l (𝓝 f)) : M₁ →ₛₗ[σ] M₂ := linearMapOfMemClosureRangeCoe f <| mem_closure_of_tendsto h <| eventually_of_forall fun _ => Set.mem_range_self _ variable (M₁ M₂ σ) theorem LinearMap.isClosed_range_coe : IsClosed (Set.range ((↑) : (M₁ →ₛₗ[σ] M₂) → M₁ → M₂)) := isClosed_of_closure_subset fun f hf => ⟨linearMapOfMemClosureRangeCoe f hf, rfl⟩ end PointwiseLimits namespace ContinuousLinearMap section Semiring /-! ### Properties that hold for non-necessarily commutative semirings. -/ variable {R₁ : Type*} {R₂ : Type*} {R₃ : Type*} [Semiring R₁] [Semiring R₂] [Semiring R₃] {σ₁₂ : R₁ →+* R₂} {σ₂₃ : R₂ →+* R₃} {σ₁₃ : R₁ →+* R₃} {M₁ : Type*} [TopologicalSpace M₁] [AddCommMonoid M₁] {M'₁ : Type*} [TopologicalSpace M'₁] [AddCommMonoid M'₁] {M₂ : Type*} [TopologicalSpace M₂] [AddCommMonoid M₂] {M₃ : Type*} [TopologicalSpace M₃] [AddCommMonoid M₃] {M₄ : Type*} [TopologicalSpace M₄] [AddCommMonoid M₄] [Module R₁ M₁] [Module R₁ M'₁] [Module R₂ M₂] [Module R₃ M₃] attribute [coe] ContinuousLinearMap.toLinearMap /-- Coerce continuous linear maps to linear maps. -/ instance LinearMap.coe : Coe (M₁ →SL[σ₁₂] M₂) (M₁ →ₛₗ[σ₁₂] M₂) := ⟨toLinearMap⟩ theorem coe_injective : Function.Injective ((↑) : (M₁ →SL[σ₁₂] M₂) → M₁ →ₛₗ[σ₁₂] M₂) := by intro f g H cases f cases g congr instance funLike : FunLike (M₁ →SL[σ₁₂] M₂) M₁ M₂ where coe f := f.toLinearMap coe_injective' _ _ h := coe_injective (DFunLike.coe_injective h) instance continuousSemilinearMapClass : ContinuousSemilinearMapClass (M₁ →SL[σ₁₂] M₂) σ₁₂ M₁ M₂ where map_add f := map_add f.toLinearMap map_continuous f := f.2 map_smulₛₗ f := f.toLinearMap.map_smul' -- see Note [function coercion] /-- Coerce continuous linear maps to functions. -/ --instance toFun' : CoeFun (M₁ →SL[σ₁₂] M₂) fun _ => M₁ → M₂ := ⟨DFunLike.coe⟩ -- porting note (#10618): was `simp`, now `simp only` proves it theorem coe_mk (f : M₁ →ₛₗ[σ₁₂] M₂) (h) : (mk f h : M₁ →ₛₗ[σ₁₂] M₂) = f := rfl @[simp] theorem coe_mk' (f : M₁ →ₛₗ[σ₁₂] M₂) (h) : (mk f h : M₁ → M₂) = f := rfl @[continuity, fun_prop] protected theorem continuous (f : M₁ →SL[σ₁₂] M₂) : Continuous f := f.2 protected theorem uniformContinuous {E₁ E₂ : Type*} [UniformSpace E₁] [UniformSpace E₂] [AddCommGroup E₁] [AddCommGroup E₂] [Module R₁ E₁] [Module R₂ E₂] [UniformAddGroup E₁] [UniformAddGroup E₂] (f : E₁ →SL[σ₁₂] E₂) : UniformContinuous f := uniformContinuous_addMonoidHom_of_continuous f.continuous @[simp, norm_cast] theorem coe_inj {f g : M₁ →SL[σ₁₂] M₂} : (f : M₁ →ₛₗ[σ₁₂] M₂) = g ↔ f = g := coe_injective.eq_iff theorem coeFn_injective : @Function.Injective (M₁ →SL[σ₁₂] M₂) (M₁ → M₂) (↑) := DFunLike.coe_injective /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (h : M₁ →SL[σ₁₂] M₂) : M₁ → M₂ := h /-- See Note [custom simps projection]. -/ def Simps.coe (h : M₁ →SL[σ₁₂] M₂) : M₁ →ₛₗ[σ₁₂] M₂ := h initialize_simps_projections ContinuousLinearMap (toLinearMap_toFun → apply, toLinearMap → coe) @[ext] theorem ext {f g : M₁ →SL[σ₁₂] M₂} (h : ∀ x, f x = g x) : f = g := DFunLike.ext f g h /-- Copy of a `ContinuousLinearMap` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : M₁ →SL[σ₁₂] M₂) (f' : M₁ → M₂) (h : f' = ⇑f) : M₁ →SL[σ₁₂] M₂ where toLinearMap := f.toLinearMap.copy f' h cont := show Continuous f' from h.symm ▸ f.continuous @[simp] theorem coe_copy (f : M₁ →SL[σ₁₂] M₂) (f' : M₁ → M₂) (h : f' = ⇑f) : ⇑(f.copy f' h) = f' := rfl theorem copy_eq (f : M₁ →SL[σ₁₂] M₂) (f' : M₁ → M₂) (h : f' = ⇑f) : f.copy f' h = f := DFunLike.ext' h -- make some straightforward lemmas available to `simp`. protected theorem map_zero (f : M₁ →SL[σ₁₂] M₂) : f (0 : M₁) = 0 := map_zero f protected theorem map_add (f : M₁ →SL[σ₁₂] M₂) (x y : M₁) : f (x + y) = f x + f y := map_add f x y -- @[simp] -- Porting note (#10618): simp can prove this protected theorem map_smulₛₗ (f : M₁ →SL[σ₁₂] M₂) (c : R₁) (x : M₁) : f (c • x) = σ₁₂ c • f x := (toLinearMap _).map_smulₛₗ _ _ -- @[simp] -- Porting note (#10618): simp can prove this protected theorem map_smul [Module R₁ M₂] (f : M₁ →L[R₁] M₂) (c : R₁) (x : M₁) : f (c • x) = c • f x := by simp only [RingHom.id_apply, ContinuousLinearMap.map_smulₛₗ] @[simp] theorem map_smul_of_tower {R S : Type*} [Semiring S] [SMul R M₁] [Module S M₁] [SMul R M₂] [Module S M₂] [LinearMap.CompatibleSMul M₁ M₂ R S] (f : M₁ →L[S] M₂) (c : R) (x : M₁) : f (c • x) = c • f x := LinearMap.CompatibleSMul.map_smul (f : M₁ →ₗ[S] M₂) c x @[deprecated _root_.map_sum (since := "2023-09-16")] protected theorem map_sum {ι : Type*} (f : M₁ →SL[σ₁₂] M₂) (s : Finset ι) (g : ι → M₁) : f (∑ i ∈ s, g i) = ∑ i ∈ s, f (g i) := map_sum .. @[simp, norm_cast] theorem coe_coe (f : M₁ →SL[σ₁₂] M₂) : ⇑(f : M₁ →ₛₗ[σ₁₂] M₂) = f := rfl @[ext] theorem ext_ring [TopologicalSpace R₁] {f g : R₁ →L[R₁] M₁} (h : f 1 = g 1) : f = g := coe_inj.1 <| LinearMap.ext_ring h /-- If two continuous linear maps are equal on a set `s`, then they are equal on the closure of the `Submodule.span` of this set. -/ theorem eqOn_closure_span [T2Space M₂] {s : Set M₁} {f g : M₁ →SL[σ₁₂] M₂} (h : Set.EqOn f g s) : Set.EqOn f g (closure (Submodule.span R₁ s : Set M₁)) := (LinearMap.eqOn_span' h).closure f.continuous g.continuous /-- If the submodule generated by a set `s` is dense in the ambient module, then two continuous linear maps equal on `s` are equal. -/ theorem ext_on [T2Space M₂] {s : Set M₁} (hs : Dense (Submodule.span R₁ s : Set M₁)) {f g : M₁ →SL[σ₁₂] M₂} (h : Set.EqOn f g s) : f = g := ext fun x => eqOn_closure_span h (hs x) /-- Under a continuous linear map, the image of the `TopologicalClosure` of a submodule is contained in the `TopologicalClosure` of its image. -/ theorem _root_.Submodule.topologicalClosure_map [RingHomSurjective σ₁₂] [TopologicalSpace R₁] [TopologicalSpace R₂] [ContinuousSMul R₁ M₁] [ContinuousAdd M₁] [ContinuousSMul R₂ M₂] [ContinuousAdd M₂] (f : M₁ →SL[σ₁₂] M₂) (s : Submodule R₁ M₁) : s.topologicalClosure.map (f : M₁ →ₛₗ[σ₁₂] M₂) ≤ (s.map (f : M₁ →ₛₗ[σ₁₂] M₂)).topologicalClosure := image_closure_subset_closure_image f.continuous /-- Under a dense continuous linear map, a submodule whose `TopologicalClosure` is `⊤` is sent to another such submodule. That is, the image of a dense set under a map with dense range is dense. -/ theorem _root_.DenseRange.topologicalClosure_map_submodule [RingHomSurjective σ₁₂] [TopologicalSpace R₁] [TopologicalSpace R₂] [ContinuousSMul R₁ M₁] [ContinuousAdd M₁] [ContinuousSMul R₂ M₂] [ContinuousAdd M₂] {f : M₁ →SL[σ₁₂] M₂} (hf' : DenseRange f) {s : Submodule R₁ M₁} (hs : s.topologicalClosure = ⊤) : (s.map (f : M₁ →ₛₗ[σ₁₂] M₂)).topologicalClosure = ⊤ := by rw [SetLike.ext'_iff] at hs ⊢ simp only [Submodule.topologicalClosure_coe, Submodule.top_coe, ← dense_iff_closure_eq] at hs ⊢ exact hf'.dense_image f.continuous hs section SMulMonoid variable {S₂ T₂ : Type*} [Monoid S₂] [Monoid T₂] variable [DistribMulAction S₂ M₂] [SMulCommClass R₂ S₂ M₂] [ContinuousConstSMul S₂ M₂] variable [DistribMulAction T₂ M₂] [SMulCommClass R₂ T₂ M₂] [ContinuousConstSMul T₂ M₂] instance instSMul : SMul S₂ (M₁ →SL[σ₁₂] M₂) where smul c f := ⟨c • (f : M₁ →ₛₗ[σ₁₂] M₂), (f.2.const_smul _ : Continuous fun x => c • f x)⟩ instance mulAction : MulAction S₂ (M₁ →SL[σ₁₂] M₂) where one_smul _f := ext fun _x => one_smul _ _ mul_smul _a _b _f := ext fun _x => mul_smul _ _ _ theorem smul_apply (c : S₂) (f : M₁ →SL[σ₁₂] M₂) (x : M₁) : (c • f) x = c • f x := rfl @[simp, norm_cast] theorem coe_smul (c : S₂) (f : M₁ →SL[σ₁₂] M₂) : ↑(c • f) = c • (f : M₁ →ₛₗ[σ₁₂] M₂) := rfl @[simp, norm_cast] theorem coe_smul' (c : S₂) (f : M₁ →SL[σ₁₂] M₂) : ↑(c • f) = c • (f : M₁ → M₂) := rfl instance isScalarTower [SMul S₂ T₂] [IsScalarTower S₂ T₂ M₂] : IsScalarTower S₂ T₂ (M₁ →SL[σ₁₂] M₂) := ⟨fun a b f => ext fun x => smul_assoc a b (f x)⟩ instance smulCommClass [SMulCommClass S₂ T₂ M₂] : SMulCommClass S₂ T₂ (M₁ →SL[σ₁₂] M₂) := ⟨fun a b f => ext fun x => smul_comm a b (f x)⟩ end SMulMonoid /-- The continuous map that is constantly zero. -/ instance zero : Zero (M₁ →SL[σ₁₂] M₂) := ⟨⟨0, continuous_zero⟩⟩ instance inhabited : Inhabited (M₁ →SL[σ₁₂] M₂) := ⟨0⟩ @[simp] theorem default_def : (default : M₁ →SL[σ₁₂] M₂) = 0 := rfl @[simp] theorem zero_apply (x : M₁) : (0 : M₁ →SL[σ₁₂] M₂) x = 0 := rfl @[simp, norm_cast] theorem coe_zero : ((0 : M₁ →SL[σ₁₂] M₂) : M₁ →ₛₗ[σ₁₂] M₂) = 0 := rfl /- no simp attribute on the next line as simp does not always simplify `0 x` to `0` when `0` is the zero function, while it does for the zero continuous linear map, and this is the most important property we care about. -/ @[norm_cast] theorem coe_zero' : ⇑(0 : M₁ →SL[σ₁₂] M₂) = 0 := rfl instance uniqueOfLeft [Subsingleton M₁] : Unique (M₁ →SL[σ₁₂] M₂) := coe_injective.unique instance uniqueOfRight [Subsingleton M₂] : Unique (M₁ →SL[σ₁₂] M₂) := coe_injective.unique theorem exists_ne_zero {f : M₁ →SL[σ₁₂] M₂} (hf : f ≠ 0) : ∃ x, f x ≠ 0 := by by_contra! h exact hf (ContinuousLinearMap.ext h) section variable (R₁ M₁) /-- the identity map as a continuous linear map. -/ def id : M₁ →L[R₁] M₁ := ⟨LinearMap.id, continuous_id⟩ end instance one : One (M₁ →L[R₁] M₁) := ⟨id R₁ M₁⟩ theorem one_def : (1 : M₁ →L[R₁] M₁) = id R₁ M₁ := rfl theorem id_apply (x : M₁) : id R₁ M₁ x = x := rfl @[simp, norm_cast] theorem coe_id : (id R₁ M₁ : M₁ →ₗ[R₁] M₁) = LinearMap.id := rfl @[simp, norm_cast] theorem coe_id' : ⇑(id R₁ M₁) = _root_.id := rfl @[simp, norm_cast] theorem coe_eq_id {f : M₁ →L[R₁] M₁} : (f : M₁ →ₗ[R₁] M₁) = LinearMap.id ↔ f = id _ _ := by rw [← coe_id, coe_inj] @[simp] theorem one_apply (x : M₁) : (1 : M₁ →L[R₁] M₁) x = x := rfl instance [Nontrivial M₁] : Nontrivial (M₁ →L[R₁] M₁) := ⟨0, 1, fun e ↦ have ⟨x, hx⟩ := exists_ne (0 : M₁); hx (by simpa using DFunLike.congr_fun e.symm x)⟩ section Add variable [ContinuousAdd M₂] instance add : Add (M₁ →SL[σ₁₂] M₂) := ⟨fun f g => ⟨f + g, f.2.add g.2⟩⟩ @[simp] theorem add_apply (f g : M₁ →SL[σ₁₂] M₂) (x : M₁) : (f + g) x = f x + g x := rfl @[simp, norm_cast] theorem coe_add (f g : M₁ →SL[σ₁₂] M₂) : (↑(f + g) : M₁ →ₛₗ[σ₁₂] M₂) = f + g := rfl @[norm_cast] theorem coe_add' (f g : M₁ →SL[σ₁₂] M₂) : ⇑(f + g) = f + g := rfl instance addCommMonoid : AddCommMonoid (M₁ →SL[σ₁₂] M₂) where zero_add := by intros ext apply_rules [zero_add, add_assoc, add_zero, add_left_neg, add_comm] add_zero := by intros ext apply_rules [zero_add, add_assoc, add_zero, add_left_neg, add_comm] add_comm := by intros ext apply_rules [zero_add, add_assoc, add_zero, add_left_neg, add_comm] add_assoc := by intros ext apply_rules [zero_add, add_assoc, add_zero, add_left_neg, add_comm] nsmul := (· • ·) nsmul_zero f := by ext simp nsmul_succ n f := by ext simp [add_smul] @[simp, norm_cast] theorem coe_sum {ι : Type*} (t : Finset ι) (f : ι → M₁ →SL[σ₁₂] M₂) : ↑(∑ d ∈ t, f d) = (∑ d ∈ t, f d : M₁ →ₛₗ[σ₁₂] M₂) := map_sum (AddMonoidHom.mk ⟨((↑) : (M₁ →SL[σ₁₂] M₂) → M₁ →ₛₗ[σ₁₂] M₂), rfl⟩ fun _ _ => rfl) _ _ @[simp, norm_cast] theorem coe_sum' {ι : Type*} (t : Finset ι) (f : ι → M₁ →SL[σ₁₂] M₂) : ⇑(∑ d ∈ t, f d) = ∑ d ∈ t, ⇑(f d) := by simp only [← coe_coe, coe_sum, LinearMap.coeFn_sum] theorem sum_apply {ι : Type*} (t : Finset ι) (f : ι → M₁ →SL[σ₁₂] M₂) (b : M₁) : (∑ d ∈ t, f d) b = ∑ d ∈ t, f d b := by simp only [coe_sum', Finset.sum_apply] end Add variable [RingHomCompTriple σ₁₂ σ₂₃ σ₁₃] /-- Composition of bounded linear maps. -/ def comp (g : M₂ →SL[σ₂₃] M₃) (f : M₁ →SL[σ₁₂] M₂) : M₁ →SL[σ₁₃] M₃ := ⟨(g : M₂ →ₛₗ[σ₂₃] M₃).comp (f : M₁ →ₛₗ[σ₁₂] M₂), g.2.comp f.2⟩ @[inherit_doc comp] infixr:80 " ∘L " => @ContinuousLinearMap.comp _ _ _ _ _ _ (RingHom.id _) (RingHom.id _) (RingHom.id _) _ _ _ _ _ _ _ _ _ _ _ _ RingHomCompTriple.ids @[simp, norm_cast] theorem coe_comp (h : M₂ →SL[σ₂₃] M₃) (f : M₁ →SL[σ₁₂] M₂) : (h.comp f : M₁ →ₛₗ[σ₁₃] M₃) = (h : M₂ →ₛₗ[σ₂₃] M₃).comp (f : M₁ →ₛₗ[σ₁₂] M₂) := rfl @[simp, norm_cast] theorem coe_comp' (h : M₂ →SL[σ₂₃] M₃) (f : M₁ →SL[σ₁₂] M₂) : ⇑(h.comp f) = h ∘ f := rfl theorem comp_apply (g : M₂ →SL[σ₂₃] M₃) (f : M₁ →SL[σ₁₂] M₂) (x : M₁) : (g.comp f) x = g (f x) := rfl @[simp] theorem comp_id (f : M₁ →SL[σ₁₂] M₂) : f.comp (id R₁ M₁) = f := ext fun _x => rfl @[simp] theorem id_comp (f : M₁ →SL[σ₁₂] M₂) : (id R₂ M₂).comp f = f := ext fun _x => rfl @[simp] theorem comp_zero (g : M₂ →SL[σ₂₃] M₃) : g.comp (0 : M₁ →SL[σ₁₂] M₂) = 0 := by ext simp @[simp] theorem zero_comp (f : M₁ →SL[σ₁₂] M₂) : (0 : M₂ →SL[σ₂₃] M₃).comp f = 0 := by ext simp @[simp] theorem comp_add [ContinuousAdd M₂] [ContinuousAdd M₃] (g : M₂ →SL[σ₂₃] M₃) (f₁ f₂ : M₁ →SL[σ₁₂] M₂) : g.comp (f₁ + f₂) = g.comp f₁ + g.comp f₂ := by ext simp @[simp] theorem add_comp [ContinuousAdd M₃] (g₁ g₂ : M₂ →SL[σ₂₃] M₃) (f : M₁ →SL[σ₁₂] M₂) : (g₁ + g₂).comp f = g₁.comp f + g₂.comp f := by ext simp theorem comp_assoc {R₄ : Type*} [Semiring R₄] [Module R₄ M₄] {σ₁₄ : R₁ →+* R₄} {σ₂₄ : R₂ →+* R₄} {σ₃₄ : R₃ →+* R₄} [RingHomCompTriple σ₁₃ σ₃₄ σ₁₄] [RingHomCompTriple σ₂₃ σ₃₄ σ₂₄] [RingHomCompTriple σ₁₂ σ₂₄ σ₁₄] (h : M₃ →SL[σ₃₄] M₄) (g : M₂ →SL[σ₂₃] M₃) (f : M₁ →SL[σ₁₂] M₂) : (h.comp g).comp f = h.comp (g.comp f) := rfl instance instMul : Mul (M₁ →L[R₁] M₁) := ⟨comp⟩ theorem mul_def (f g : M₁ →L[R₁] M₁) : f * g = f.comp g := rfl @[simp] theorem coe_mul (f g : M₁ →L[R₁] M₁) : ⇑(f * g) = f ∘ g := rfl theorem mul_apply (f g : M₁ →L[R₁] M₁) (x : M₁) : (f * g) x = f (g x) := rfl instance monoidWithZero : MonoidWithZero (M₁ →L[R₁] M₁) where mul_zero f := ext fun _ => map_zero f zero_mul _ := ext fun _ => rfl mul_one _ := ext fun _ => rfl one_mul _ := ext fun _ => rfl mul_assoc _ _ _ := ext fun _ => rfl theorem coe_pow (f : M₁ →L[R₁] M₁) (n : ℕ) : ⇑(f ^ n) = f^[n] := hom_coe_pow _ rfl (fun _ _ ↦ rfl) _ _ instance instNatCast [ContinuousAdd M₁] : NatCast (M₁ →L[R₁] M₁) where natCast n := n • (1 : M₁ →L[R₁] M₁) instance semiring [ContinuousAdd M₁] : Semiring (M₁ →L[R₁] M₁) where __ := ContinuousLinearMap.monoidWithZero __ := ContinuousLinearMap.addCommMonoid left_distrib f g h := ext fun x => map_add f (g x) (h x) right_distrib _ _ _ := ext fun _ => LinearMap.add_apply _ _ _ toNatCast := instNatCast natCast_zero := zero_smul ℕ (1 : M₁ →L[R₁] M₁) natCast_succ n := AddMonoid.nsmul_succ n (1 : M₁ →L[R₁] M₁) /-- `ContinuousLinearMap.toLinearMap` as a `RingHom`. -/ @[simps] def toLinearMapRingHom [ContinuousAdd M₁] : (M₁ →L[R₁] M₁) →+* M₁ →ₗ[R₁] M₁ where toFun := toLinearMap map_zero' := rfl map_one' := rfl map_add' _ _ := rfl map_mul' _ _ := rfl @[simp] theorem natCast_apply [ContinuousAdd M₁] (n : ℕ) (m : M₁) : (↑n : M₁ →L[R₁] M₁) m = n • m := rfl @[simp] theorem ofNat_apply [ContinuousAdd M₁] (n : ℕ) [n.AtLeastTwo] (m : M₁) : ((no_index (OfNat.ofNat n) : M₁ →L[R₁] M₁)) m = OfNat.ofNat n • m := rfl section ApplyAction variable [ContinuousAdd M₁] /-- The tautological action by `M₁ →L[R₁] M₁` on `M`. This generalizes `Function.End.applyMulAction`. -/ instance applyModule : Module (M₁ →L[R₁] M₁) M₁ := Module.compHom _ toLinearMapRingHom @[simp] protected theorem smul_def (f : M₁ →L[R₁] M₁) (a : M₁) : f • a = f a := rfl /-- `ContinuousLinearMap.applyModule` is faithful. -/ instance applyFaithfulSMul : FaithfulSMul (M₁ →L[R₁] M₁) M₁ := ⟨fun {_ _} => ContinuousLinearMap.ext⟩ instance applySMulCommClass : SMulCommClass R₁ (M₁ →L[R₁] M₁) M₁ where smul_comm r e m := (e.map_smul r m).symm instance applySMulCommClass' : SMulCommClass (M₁ →L[R₁] M₁) R₁ M₁ where smul_comm := ContinuousLinearMap.map_smul instance continuousConstSMul_apply : ContinuousConstSMul (M₁ →L[R₁] M₁) M₁ := ⟨ContinuousLinearMap.continuous⟩ end ApplyAction /-- The cartesian product of two bounded linear maps, as a bounded linear map. -/ protected def prod [Module R₁ M₂] [Module R₁ M₃] (f₁ : M₁ →L[R₁] M₂) (f₂ : M₁ →L[R₁] M₃) : M₁ →L[R₁] M₂ × M₃ := ⟨(f₁ : M₁ →ₗ[R₁] M₂).prod f₂, f₁.2.prod_mk f₂.2⟩ @[simp, norm_cast] theorem coe_prod [Module R₁ M₂] [Module R₁ M₃] (f₁ : M₁ →L[R₁] M₂) (f₂ : M₁ →L[R₁] M₃) : (f₁.prod f₂ : M₁ →ₗ[R₁] M₂ × M₃) = LinearMap.prod f₁ f₂ := rfl @[simp, norm_cast] theorem prod_apply [Module R₁ M₂] [Module R₁ M₃] (f₁ : M₁ →L[R₁] M₂) (f₂ : M₁ →L[R₁] M₃) (x : M₁) : f₁.prod f₂ x = (f₁ x, f₂ x) := rfl section variable (R₁ M₁ M₂) /-- The left injection into a product is a continuous linear map. -/ def inl [Module R₁ M₂] : M₁ →L[R₁] M₁ × M₂ := (id R₁ M₁).prod 0 /-- The right injection into a product is a continuous linear map. -/ def inr [Module R₁ M₂] : M₂ →L[R₁] M₁ × M₂ := (0 : M₂ →L[R₁] M₁).prod (id R₁ M₂) end variable {F : Type*} @[simp] theorem inl_apply [Module R₁ M₂] (x : M₁) : inl R₁ M₁ M₂ x = (x, 0) := rfl @[simp] theorem inr_apply [Module R₁ M₂] (x : M₂) : inr R₁ M₁ M₂ x = (0, x) := rfl @[simp, norm_cast] theorem coe_inl [Module R₁ M₂] : (inl R₁ M₁ M₂ : M₁ →ₗ[R₁] M₁ × M₂) = LinearMap.inl R₁ M₁ M₂ := rfl @[simp, norm_cast] theorem coe_inr [Module R₁ M₂] : (inr R₁ M₁ M₂ : M₂ →ₗ[R₁] M₁ × M₂) = LinearMap.inr R₁ M₁ M₂ := rfl theorem isClosed_ker [T1Space M₂] [FunLike F M₁ M₂] [ContinuousSemilinearMapClass F σ₁₂ M₁ M₂] (f : F) : IsClosed (ker f : Set M₁) := continuous_iff_isClosed.1 (map_continuous f) _ isClosed_singleton theorem isComplete_ker {M' : Type*} [UniformSpace M'] [CompleteSpace M'] [AddCommMonoid M'] [Module R₁ M'] [T1Space M₂] [FunLike F M' M₂] [ContinuousSemilinearMapClass F σ₁₂ M' M₂] (f : F) : IsComplete (ker f : Set M') := (isClosed_ker f).isComplete instance completeSpace_ker {M' : Type*} [UniformSpace M'] [CompleteSpace M'] [AddCommMonoid M'] [Module R₁ M'] [T1Space M₂] [FunLike F M' M₂] [ContinuousSemilinearMapClass F σ₁₂ M' M₂] (f : F) : CompleteSpace (ker f) := (isComplete_ker f).completeSpace_coe instance completeSpace_eqLocus {M' : Type*} [UniformSpace M'] [CompleteSpace M'] [AddCommMonoid M'] [Module R₁ M'] [T2Space M₂] [FunLike F M' M₂] [ContinuousSemilinearMapClass F σ₁₂ M' M₂] (f g : F) : CompleteSpace (LinearMap.eqLocus f g) := IsClosed.completeSpace_coe <| isClosed_eq (map_continuous f) (map_continuous g) @[simp] theorem ker_prod [Module R₁ M₂] [Module R₁ M₃] (f : M₁ →L[R₁] M₂) (g : M₁ →L[R₁] M₃) : ker (f.prod g) = ker f ⊓ ker g := LinearMap.ker_prod (f : M₁ →ₗ[R₁] M₂) (g : M₁ →ₗ[R₁] M₃) /-- Restrict codomain of a continuous linear map. -/ def codRestrict (f : M₁ →SL[σ₁₂] M₂) (p : Submodule R₂ M₂) (h : ∀ x, f x ∈ p) : M₁ →SL[σ₁₂] p where cont := f.continuous.subtype_mk _ toLinearMap := (f : M₁ →ₛₗ[σ₁₂] M₂).codRestrict p h @[norm_cast] theorem coe_codRestrict (f : M₁ →SL[σ₁₂] M₂) (p : Submodule R₂ M₂) (h : ∀ x, f x ∈ p) : (f.codRestrict p h : M₁ →ₛₗ[σ₁₂] p) = (f : M₁ →ₛₗ[σ₁₂] M₂).codRestrict p h := rfl @[simp] theorem coe_codRestrict_apply (f : M₁ →SL[σ₁₂] M₂) (p : Submodule R₂ M₂) (h : ∀ x, f x ∈ p) (x) : (f.codRestrict p h x : M₂) = f x := rfl @[simp] theorem ker_codRestrict (f : M₁ →SL[σ₁₂] M₂) (p : Submodule R₂ M₂) (h : ∀ x, f x ∈ p) : ker (f.codRestrict p h) = ker f := (f : M₁ →ₛₗ[σ₁₂] M₂).ker_codRestrict p h /-- Restrict the codomain of a continuous linear map `f` to `f.range`. -/ abbrev rangeRestrict [RingHomSurjective σ₁₂] (f : M₁ →SL[σ₁₂] M₂) := f.codRestrict (LinearMap.range f) (LinearMap.mem_range_self f) @[simp] theorem coe_rangeRestrict [RingHomSurjective σ₁₂] (f : M₁ →SL[σ₁₂] M₂) : (f.rangeRestrict : M₁ →ₛₗ[σ₁₂] LinearMap.range f) = (f : M₁ →ₛₗ[σ₁₂] M₂).rangeRestrict := rfl /-- `Submodule.subtype` as a `ContinuousLinearMap`. -/ def _root_.Submodule.subtypeL (p : Submodule R₁ M₁) : p →L[R₁] M₁ where cont := continuous_subtype_val toLinearMap := p.subtype @[simp, norm_cast] theorem _root_.Submodule.coe_subtypeL (p : Submodule R₁ M₁) : (p.subtypeL : p →ₗ[R₁] M₁) = p.subtype := rfl @[simp] theorem _root_.Submodule.coe_subtypeL' (p : Submodule R₁ M₁) : ⇑p.subtypeL = p.subtype := rfl @[simp] -- @[norm_cast] -- Porting note: A theorem with this can't have a rhs starting with `↑`. theorem _root_.Submodule.subtypeL_apply (p : Submodule R₁ M₁) (x : p) : p.subtypeL x = x := rfl @[simp] theorem _root_.Submodule.range_subtypeL (p : Submodule R₁ M₁) : range p.subtypeL = p := Submodule.range_subtype _ @[simp] theorem _root_.Submodule.ker_subtypeL (p : Submodule R₁ M₁) : ker p.subtypeL = ⊥ := Submodule.ker_subtype _ variable (R₁ M₁ M₂) /-- `Prod.fst` as a `ContinuousLinearMap`. -/ def fst [Module R₁ M₂] : M₁ × M₂ →L[R₁] M₁ where cont := continuous_fst toLinearMap := LinearMap.fst R₁ M₁ M₂ /-- `Prod.snd` as a `ContinuousLinearMap`. -/ def snd [Module R₁ M₂] : M₁ × M₂ →L[R₁] M₂ where cont := continuous_snd toLinearMap := LinearMap.snd R₁ M₁ M₂ variable {R₁ M₁ M₂} @[simp, norm_cast] theorem coe_fst [Module R₁ M₂] : ↑(fst R₁ M₁ M₂) = LinearMap.fst R₁ M₁ M₂ := rfl @[simp, norm_cast] theorem coe_fst' [Module R₁ M₂] : ⇑(fst R₁ M₁ M₂) = Prod.fst := rfl @[simp, norm_cast] theorem coe_snd [Module R₁ M₂] : ↑(snd R₁ M₁ M₂) = LinearMap.snd R₁ M₁ M₂ := rfl @[simp, norm_cast] theorem coe_snd' [Module R₁ M₂] : ⇑(snd R₁ M₁ M₂) = Prod.snd := rfl @[simp] theorem fst_prod_snd [Module R₁ M₂] : (fst R₁ M₁ M₂).prod (snd R₁ M₁ M₂) = id R₁ (M₁ × M₂) := ext fun ⟨_x, _y⟩ => rfl @[simp] theorem fst_comp_prod [Module R₁ M₂] [Module R₁ M₃] (f : M₁ →L[R₁] M₂) (g : M₁ →L[R₁] M₃) : (fst R₁ M₂ M₃).comp (f.prod g) = f := ext fun _x => rfl @[simp] theorem snd_comp_prod [Module R₁ M₂] [Module R₁ M₃] (f : M₁ →L[R₁] M₂) (g : M₁ →L[R₁] M₃) : (snd R₁ M₂ M₃).comp (f.prod g) = g := ext fun _x => rfl /-- `Prod.map` of two continuous linear maps. -/ def prodMap [Module R₁ M₂] [Module R₁ M₃] [Module R₁ M₄] (f₁ : M₁ →L[R₁] M₂) (f₂ : M₃ →L[R₁] M₄) : M₁ × M₃ →L[R₁] M₂ × M₄ := (f₁.comp (fst R₁ M₁ M₃)).prod (f₂.comp (snd R₁ M₁ M₃)) @[simp, norm_cast] theorem coe_prodMap [Module R₁ M₂] [Module R₁ M₃] [Module R₁ M₄] (f₁ : M₁ →L[R₁] M₂) (f₂ : M₃ →L[R₁] M₄) : ↑(f₁.prodMap f₂) = (f₁ : M₁ →ₗ[R₁] M₂).prodMap (f₂ : M₃ →ₗ[R₁] M₄) := rfl @[simp, norm_cast] theorem coe_prodMap' [Module R₁ M₂] [Module R₁ M₃] [Module R₁ M₄] (f₁ : M₁ →L[R₁] M₂) (f₂ : M₃ →L[R₁] M₄) : ⇑(f₁.prodMap f₂) = Prod.map f₁ f₂ := rfl /-- The continuous linear map given by `(x, y) ↦ f₁ x + f₂ y`. -/ def coprod [Module R₁ M₂] [Module R₁ M₃] [ContinuousAdd M₃] (f₁ : M₁ →L[R₁] M₃) (f₂ : M₂ →L[R₁] M₃) : M₁ × M₂ →L[R₁] M₃ := ⟨LinearMap.coprod f₁ f₂, (f₁.cont.comp continuous_fst).add (f₂.cont.comp continuous_snd)⟩ @[norm_cast, simp] theorem coe_coprod [Module R₁ M₂] [Module R₁ M₃] [ContinuousAdd M₃] (f₁ : M₁ →L[R₁] M₃) (f₂ : M₂ →L[R₁] M₃) : (f₁.coprod f₂ : M₁ × M₂ →ₗ[R₁] M₃) = LinearMap.coprod f₁ f₂ := rfl @[simp] theorem coprod_apply [Module R₁ M₂] [Module R₁ M₃] [ContinuousAdd M₃] (f₁ : M₁ →L[R₁] M₃) (f₂ : M₂ →L[R₁] M₃) (x) : f₁.coprod f₂ x = f₁ x.1 + f₂ x.2 := rfl theorem range_coprod [Module R₁ M₂] [Module R₁ M₃] [ContinuousAdd M₃] (f₁ : M₁ →L[R₁] M₃) (f₂ : M₂ →L[R₁] M₃) : range (f₁.coprod f₂) = range f₁ ⊔ range f₂ := LinearMap.range_coprod _ _ theorem comp_fst_add_comp_snd [Module R₁ M₂] [Module R₁ M₃] [ContinuousAdd M₃] (f : M₁ →L[R₁] M₃) (g : M₂ →L[R₁] M₃) : f.comp (ContinuousLinearMap.fst R₁ M₁ M₂) + g.comp (ContinuousLinearMap.snd R₁ M₁ M₂) = f.coprod g := rfl theorem coprod_inl_inr [ContinuousAdd M₁] [ContinuousAdd M'₁] : (ContinuousLinearMap.inl R₁ M₁ M'₁).coprod (ContinuousLinearMap.inr R₁ M₁ M'₁) = ContinuousLinearMap.id R₁ (M₁ × M'₁) := by apply coe_injective; apply LinearMap.coprod_inl_inr section variable {R S : Type*} [Semiring R] [Semiring S] [Module R M₁] [Module R M₂] [Module R S] [Module S M₂] [IsScalarTower R S M₂] [TopologicalSpace S] [ContinuousSMul S M₂] /-- The linear map `fun x => c x • f`. Associates to a scalar-valued linear map and an element of `M₂` the `M₂`-valued linear map obtained by multiplying the two (a.k.a. tensoring by `M₂`). See also `ContinuousLinearMap.smulRightₗ` and `ContinuousLinearMap.smulRightL`. -/ def smulRight (c : M₁ →L[R] S) (f : M₂) : M₁ →L[R] M₂ := { c.toLinearMap.smulRight f with cont := c.2.smul continuous_const } @[simp] theorem smulRight_apply {c : M₁ →L[R] S} {f : M₂} {x : M₁} : (smulRight c f : M₁ → M₂) x = c x • f := rfl end variable [Module R₁ M₂] [TopologicalSpace R₁] [ContinuousSMul R₁ M₂] @[simp] theorem smulRight_one_one (c : R₁ →L[R₁] M₂) : smulRight (1 : R₁ →L[R₁] R₁) (c 1) = c := by ext simp [← ContinuousLinearMap.map_smul_of_tower] @[simp] theorem smulRight_one_eq_iff {f f' : M₂} : smulRight (1 : R₁ →L[R₁] R₁) f = smulRight (1 : R₁ →L[R₁] R₁) f' ↔ f = f' := by simp only [ContinuousLinearMap.ext_ring_iff, smulRight_apply, one_apply, one_smul] theorem smulRight_comp [ContinuousMul R₁] {x : M₂} {c : R₁} : (smulRight (1 : R₁ →L[R₁] R₁) x).comp (smulRight (1 : R₁ →L[R₁] R₁) c) = smulRight (1 : R₁ →L[R₁] R₁) (c • x) := by ext simp [mul_smul] section ToSpanSingleton variable (R₁) variable [ContinuousSMul R₁ M₁] /-- Given an element `x` of a topological space `M` over a semiring `R`, the natural continuous linear map from `R` to `M` by taking multiples of `x`. -/ def toSpanSingleton (x : M₁) : R₁ →L[R₁] M₁ where toLinearMap := LinearMap.toSpanSingleton R₁ M₁ x cont := continuous_id.smul continuous_const theorem toSpanSingleton_apply (x : M₁) (r : R₁) : toSpanSingleton R₁ x r = r • x := rfl theorem toSpanSingleton_add [ContinuousAdd M₁] (x y : M₁) : toSpanSingleton R₁ (x + y) = toSpanSingleton R₁ x + toSpanSingleton R₁ y := by ext1; simp [toSpanSingleton_apply] theorem toSpanSingleton_smul' {α} [Monoid α] [DistribMulAction α M₁] [ContinuousConstSMul α M₁] [SMulCommClass R₁ α M₁] (c : α) (x : M₁) : toSpanSingleton R₁ (c • x) = c • toSpanSingleton R₁ x := by ext1; rw [toSpanSingleton_apply, smul_apply, toSpanSingleton_apply, smul_comm] /-- A special case of `to_span_singleton_smul'` for when `R` is commutative. -/ theorem toSpanSingleton_smul (R) {M₁} [CommSemiring R] [AddCommMonoid M₁] [Module R M₁] [TopologicalSpace R] [TopologicalSpace M₁] [ContinuousSMul R M₁] (c : R) (x : M₁) : toSpanSingleton R (c • x) = c • toSpanSingleton R x := toSpanSingleton_smul' R c x end ToSpanSingleton end Semiring section Pi variable {R : Type*} [Semiring R] {M : Type*} [TopologicalSpace M] [AddCommMonoid M] [Module R M] {M₂ : Type*} [TopologicalSpace M₂] [AddCommMonoid M₂] [Module R M₂] {ι : Type*} {φ : ι → Type*} [∀ i, TopologicalSpace (φ i)] [∀ i, AddCommMonoid (φ i)] [∀ i, Module R (φ i)] /-- `pi` construction for continuous linear functions. From a family of continuous linear functions it produces a continuous linear function into a family of topological modules. -/ def pi (f : ∀ i, M →L[R] φ i) : M →L[R] ∀ i, φ i := ⟨LinearMap.pi fun i => f i, continuous_pi fun i => (f i).continuous⟩ @[simp] theorem coe_pi' (f : ∀ i, M →L[R] φ i) : ⇑(pi f) = fun c i => f i c := rfl @[simp] theorem coe_pi (f : ∀ i, M →L[R] φ i) : (pi f : M →ₗ[R] ∀ i, φ i) = LinearMap.pi fun i => f i := rfl theorem pi_apply (f : ∀ i, M →L[R] φ i) (c : M) (i : ι) : pi f c i = f i c := rfl theorem pi_eq_zero (f : ∀ i, M →L[R] φ i) : pi f = 0 ↔ ∀ i, f i = 0 := by simp only [ContinuousLinearMap.ext_iff, pi_apply, Function.funext_iff] exact forall_swap theorem pi_zero : pi (fun _ => 0 : ∀ i, M →L[R] φ i) = 0 := ext fun _ => rfl theorem pi_comp (f : ∀ i, M →L[R] φ i) (g : M₂ →L[R] M) : (pi f).comp g = pi fun i => (f i).comp g := rfl /-- The projections from a family of topological modules are continuous linear maps. -/ def proj (i : ι) : (∀ i, φ i) →L[R] φ i := ⟨LinearMap.proj i, continuous_apply _⟩ @[simp] theorem proj_apply (i : ι) (b : ∀ i, φ i) : (proj i : (∀ i, φ i) →L[R] φ i) b = b i := rfl theorem proj_pi (f : ∀ i, M₂ →L[R] φ i) (i : ι) : (proj i).comp (pi f) = f i := ext fun _c => rfl theorem iInf_ker_proj : (⨅ i, ker (proj i : (∀ i, φ i) →L[R] φ i) : Submodule R (∀ i, φ i)) = ⊥ := LinearMap.iInf_ker_proj variable (R φ) /-- Given a function `f : α → ι`, it induces a continuous linear function by right composition on product types. For `f = Subtype.val`, this corresponds to forgetting some set of variables. -/ def _root_.Pi.compRightL {α : Type*} (f : α → ι) : ((i : ι) → φ i) →L[R] ((i : α) → φ (f i)) where toFun := fun v i ↦ v (f i) map_add' := by intros; ext; simp map_smul' := by intros; ext; simp cont := by continuity @[simp] lemma _root_.Pi.compRightL_apply {α : Type*} (f : α → ι) (v : (i : ι) → φ i) (i : α) : Pi.compRightL R φ f v i = v (f i) := rfl /-- If `I` and `J` are complementary index sets, the product of the kernels of the `J`th projections of `φ` is linearly equivalent to the product over `I`. -/ def iInfKerProjEquiv {I J : Set ι} [DecidablePred fun i => i ∈ I] (hd : Disjoint I J) (hu : Set.univ ⊆ I ∪ J) : (⨅ i ∈ J, ker (proj i : (∀ i, φ i) →L[R] φ i) : Submodule R (∀ i, φ i)) ≃L[R] ∀ i : I, φ i where toLinearEquiv := LinearMap.iInfKerProjEquiv R φ hd hu continuous_toFun := continuous_pi fun i => by have := @continuous_subtype_val _ _ fun x => x ∈ (⨅ i ∈ J, ker (proj i : (∀ i, φ i) →L[R] φ i) : Submodule R (∀ i, φ i)) have := Continuous.comp (continuous_apply (π := φ) i) this exact this continuous_invFun := Continuous.subtype_mk (continuous_pi fun i => by -- Porting note: Was `dsimp`. change Continuous (⇑(if h : i ∈ I then LinearMap.proj (R := R) (ι := ↥I) (φ := fun i : ↥I => φ i) ⟨i, h⟩ else (0 : ((i : I) → φ i) →ₗ[R] φ i))) split_ifs <;> [apply continuous_apply; exact continuous_zero]) _ end Pi section Ring variable {R : Type*} [Ring R] {R₂ : Type*} [Ring R₂] {R₃ : Type*} [Ring R₃] {M : Type*} [TopologicalSpace M] [AddCommGroup M] {M₂ : Type*} [TopologicalSpace M₂] [AddCommGroup M₂] {M₃ : Type*} [TopologicalSpace M₃] [AddCommGroup M₃] {M₄ : Type*} [TopologicalSpace M₄] [AddCommGroup M₄] [Module R M] [Module R₂ M₂] [Module R₃ M₃] {σ₁₂ : R →+* R₂} {σ₂₃ : R₂ →+* R₃} {σ₁₃ : R →+* R₃} section protected theorem map_neg (f : M →SL[σ₁₂] M₂) (x : M) : f (-x) = -f x := by exact map_neg f x protected theorem map_sub (f : M →SL[σ₁₂] M₂) (x y : M) : f (x - y) = f x - f y := by exact map_sub f x y @[simp] theorem sub_apply' (f g : M →SL[σ₁₂] M₂) (x : M) : ((f : M →ₛₗ[σ₁₂] M₂) - g) x = f x - g x := rfl end section variable [Module R M₂] [Module R M₃] [Module R M₄] theorem range_prod_eq {f : M →L[R] M₂} {g : M →L[R] M₃} (h : ker f ⊔ ker g = ⊤) : range (f.prod g) = (range f).prod (range g) := LinearMap.range_prod_eq h theorem ker_prod_ker_le_ker_coprod [ContinuousAdd M₃] (f : M →L[R] M₃) (g : M₂ →L[R] M₃) : (LinearMap.ker f).prod (LinearMap.ker g) ≤ LinearMap.ker (f.coprod g) := LinearMap.ker_prod_ker_le_ker_coprod f.toLinearMap g.toLinearMap theorem ker_coprod_of_disjoint_range [ContinuousAdd M₃] (f : M →L[R] M₃) (g : M₂ →L[R] M₃) (hd : Disjoint (range f) (range g)) : LinearMap.ker (f.coprod g) = (LinearMap.ker f).prod (LinearMap.ker g) := LinearMap.ker_coprod_of_disjoint_range f.toLinearMap g.toLinearMap hd end section variable [TopologicalAddGroup M₂] instance neg : Neg (M →SL[σ₁₂] M₂) := ⟨fun f => ⟨-f, f.2.neg⟩⟩ @[simp] theorem neg_apply (f : M →SL[σ₁₂] M₂) (x : M) : (-f) x = -f x := rfl @[simp, norm_cast] theorem coe_neg (f : M →SL[σ₁₂] M₂) : (↑(-f) : M →ₛₗ[σ₁₂] M₂) = -f := rfl @[norm_cast] theorem coe_neg' (f : M →SL[σ₁₂] M₂) : ⇑(-f) = -f := rfl instance sub : Sub (M →SL[σ₁₂] M₂) := ⟨fun f g => ⟨f - g, f.2.sub g.2⟩⟩ instance addCommGroup : AddCommGroup (M →SL[σ₁₂] M₂) where __ := ContinuousLinearMap.addCommMonoid neg := (-·) sub := (· - ·) sub_eq_add_neg _ _ := by ext; apply sub_eq_add_neg nsmul := (· • ·) zsmul := (· • ·) zsmul_zero' f := by ext; simp zsmul_succ' n f := by ext; simp [add_smul, add_comm] zsmul_neg' n f := by ext; simp [add_smul] add_left_neg _ := by ext; apply add_left_neg theorem sub_apply (f g : M →SL[σ₁₂] M₂) (x : M) : (f - g) x = f x - g x := rfl @[simp, norm_cast] theorem coe_sub (f g : M →SL[σ₁₂] M₂) : (↑(f - g) : M →ₛₗ[σ₁₂] M₂) = f - g := rfl @[simp, norm_cast] theorem coe_sub' (f g : M →SL[σ₁₂] M₂) : ⇑(f - g) = f - g := rfl end @[simp] theorem comp_neg [RingHomCompTriple σ₁₂ σ₂₃ σ₁₃] [TopologicalAddGroup M₂] [TopologicalAddGroup M₃] (g : M₂ →SL[σ₂₃] M₃) (f : M →SL[σ₁₂] M₂) : g.comp (-f) = -g.comp f := by ext x simp @[simp] theorem neg_comp [RingHomCompTriple σ₁₂ σ₂₃ σ₁₃] [TopologicalAddGroup M₃] (g : M₂ →SL[σ₂₃] M₃) (f : M →SL[σ₁₂] M₂) : (-g).comp f = -g.comp f := by ext simp @[simp] theorem comp_sub [RingHomCompTriple σ₁₂ σ₂₃ σ₁₃] [TopologicalAddGroup M₂] [TopologicalAddGroup M₃] (g : M₂ →SL[σ₂₃] M₃) (f₁ f₂ : M →SL[σ₁₂] M₂) : g.comp (f₁ - f₂) = g.comp f₁ - g.comp f₂ := by ext simp @[simp] theorem sub_comp [RingHomCompTriple σ₁₂ σ₂₃ σ₁₃] [TopologicalAddGroup M₃] (g₁ g₂ : M₂ →SL[σ₂₃] M₃) (f : M →SL[σ₁₂] M₂) : (g₁ - g₂).comp f = g₁.comp f - g₂.comp f := by ext simp instance ring [TopologicalAddGroup M] : Ring (M →L[R] M) where __ := ContinuousLinearMap.semiring __ := ContinuousLinearMap.addCommGroup intCast z := z • (1 : M →L[R] M) intCast_ofNat := natCast_zsmul _ intCast_negSucc := negSucc_zsmul _ @[simp] theorem intCast_apply [TopologicalAddGroup M] (z : ℤ) (m : M) : (↑z : M →L[R] M) m = z • m := rfl theorem smulRight_one_pow [TopologicalSpace R] [TopologicalRing R] (c : R) (n : ℕ) : smulRight (1 : R →L[R] R) c ^ n = smulRight (1 : R →L[R] R) (c ^ n) := by induction' n with n ihn · ext simp · rw [pow_succ, ihn, mul_def, smulRight_comp, smul_eq_mul, pow_succ'] section variable {σ₂₁ : R₂ →+* R} [RingHomInvPair σ₁₂ σ₂₁] /-- Given a right inverse `f₂ : M₂ →L[R] M` to `f₁ : M →L[R] M₂`, `projKerOfRightInverse f₁ f₂ h` is the projection `M →L[R] LinearMap.ker f₁` along `LinearMap.range f₂`. -/ def projKerOfRightInverse [TopologicalAddGroup M] (f₁ : M →SL[σ₁₂] M₂) (f₂ : M₂ →SL[σ₂₁] M) (h : Function.RightInverse f₂ f₁) : M →L[R] LinearMap.ker f₁ := (id R M - f₂.comp f₁).codRestrict (LinearMap.ker f₁) fun x => by simp [h (f₁ x)] @[simp] theorem coe_projKerOfRightInverse_apply [TopologicalAddGroup M] (f₁ : M →SL[σ₁₂] M₂) (f₂ : M₂ →SL[σ₂₁] M) (h : Function.RightInverse f₂ f₁) (x : M) : (f₁.projKerOfRightInverse f₂ h x : M) = x - f₂ (f₁ x) := rfl @[simp] theorem projKerOfRightInverse_apply_idem [TopologicalAddGroup M] (f₁ : M →SL[σ₁₂] M₂) (f₂ : M₂ →SL[σ₂₁] M) (h : Function.RightInverse f₂ f₁) (x : LinearMap.ker f₁) : f₁.projKerOfRightInverse f₂ h x = x := by ext1 simp @[simp] theorem projKerOfRightInverse_comp_inv [TopologicalAddGroup M] (f₁ : M →SL[σ₁₂] M₂) (f₂ : M₂ →SL[σ₂₁] M) (h : Function.RightInverse f₂ f₁) (y : M₂) : f₁.projKerOfRightInverse f₂ h (f₂ y) = 0 := Subtype.ext_iff_val.2 <| by simp [h y] end end Ring section DivisionMonoid variable {R M : Type*} /-- A nonzero continuous linear functional is open. -/ protected theorem isOpenMap_of_ne_zero [TopologicalSpace R] [DivisionRing R] [ContinuousSub R] [AddCommGroup M] [TopologicalSpace M] [ContinuousAdd M] [Module R M] [ContinuousSMul R M] (f : M →L[R] R) (hf : f ≠ 0) : IsOpenMap f := let ⟨x, hx⟩ := exists_ne_zero hf IsOpenMap.of_sections fun y => ⟨fun a => y + (a - f y) • (f x)⁻¹ • x, Continuous.continuousAt <| by continuity, by simp, fun a => by simp [hx]⟩ end DivisionMonoid section SMulMonoid -- The M's are used for semilinear maps, and the N's for plain linear maps variable {R R₂ R₃ S S₃ : Type*} [Semiring R] [Semiring R₂] [Semiring R₃] [Monoid S] [Monoid S₃] {M : Type*} [TopologicalSpace M] [AddCommMonoid M] [Module R M] {M₂ : Type*} [TopologicalSpace M₂] [AddCommMonoid M₂] [Module R₂ M₂] {M₃ : Type*} [TopologicalSpace M₃] [AddCommMonoid M₃] [Module R₃ M₃] {N₂ : Type*} [TopologicalSpace N₂] [AddCommMonoid N₂] [Module R N₂] {N₃ : Type*} [TopologicalSpace N₃] [AddCommMonoid N₃] [Module R N₃] [DistribMulAction S₃ M₃] [SMulCommClass R₃ S₃ M₃] [ContinuousConstSMul S₃ M₃] [DistribMulAction S N₃] [SMulCommClass R S N₃] [ContinuousConstSMul S N₃] {σ₁₂ : R →+* R₂} {σ₂₃ : R₂ →+* R₃} {σ₁₃ : R →+* R₃} [RingHomCompTriple σ₁₂ σ₂₃ σ₁₃] @[simp] theorem smul_comp (c : S₃) (h : M₂ →SL[σ₂₃] M₃) (f : M →SL[σ₁₂] M₂) : (c • h).comp f = c • h.comp f := rfl variable [DistribMulAction S₃ M₂] [ContinuousConstSMul S₃ M₂] [SMulCommClass R₂ S₃ M₂] variable [DistribMulAction S N₂] [ContinuousConstSMul S N₂] [SMulCommClass R S N₂] @[simp] theorem comp_smul [LinearMap.CompatibleSMul N₂ N₃ S R] (hₗ : N₂ →L[R] N₃) (c : S) (fₗ : M →L[R] N₂) : hₗ.comp (c • fₗ) = c • hₗ.comp fₗ := by ext x exact hₗ.map_smul_of_tower c (fₗ x) @[simp] theorem comp_smulₛₗ [SMulCommClass R₂ R₂ M₂] [SMulCommClass R₃ R₃ M₃] [ContinuousConstSMul R₂ M₂] [ContinuousConstSMul R₃ M₃] (h : M₂ →SL[σ₂₃] M₃) (c : R₂) (f : M →SL[σ₁₂] M₂) : h.comp (c • f) = σ₂₃ c • h.comp f := by ext x simp only [coe_smul', coe_comp', Function.comp_apply, Pi.smul_apply, ContinuousLinearMap.map_smulₛₗ] instance distribMulAction [ContinuousAdd M₂] : DistribMulAction S₃ (M →SL[σ₁₂] M₂) where smul_add a f g := ext fun x => smul_add a (f x) (g x) smul_zero a := ext fun _ => smul_zero a end SMulMonoid section SMul -- The M's are used for semilinear maps, and the N's for plain linear maps variable {R R₂ R₃ S S₃ : Type*} [Semiring R] [Semiring R₂] [Semiring R₃] [Semiring S] [Semiring S₃] {M : Type*} [TopologicalSpace M] [AddCommMonoid M] [Module R M] {M₂ : Type*} [TopologicalSpace M₂] [AddCommMonoid M₂] [Module R₂ M₂] {M₃ : Type*} [TopologicalSpace M₃] [AddCommMonoid M₃] [Module R₃ M₃] {N₂ : Type*} [TopologicalSpace N₂] [AddCommMonoid N₂] [Module R N₂] {N₃ : Type*} [TopologicalSpace N₃] [AddCommMonoid N₃] [Module R N₃] [Module S₃ M₃] [SMulCommClass R₃ S₃ M₃] [ContinuousConstSMul S₃ M₃] [Module S N₂] [ContinuousConstSMul S N₂] [SMulCommClass R S N₂] [Module S N₃] [SMulCommClass R S N₃] [ContinuousConstSMul S N₃] {σ₁₂ : R →+* R₂} {σ₂₃ : R₂ →+* R₃} {σ₁₃ : R →+* R₃} [RingHomCompTriple σ₁₂ σ₂₃ σ₁₃] (c : S) (h : M₂ →SL[σ₂₃] M₃) (f g : M →SL[σ₁₂] M₂) (x y z : M) /-- `ContinuousLinearMap.prod` as an `Equiv`. -/ @[simps apply] def prodEquiv : (M →L[R] N₂) × (M →L[R] N₃) ≃ (M →L[R] N₂ × N₃) where toFun f := f.1.prod f.2 invFun f := ⟨(fst _ _ _).comp f, (snd _ _ _).comp f⟩ left_inv f := by ext <;> rfl right_inv f := by ext <;> rfl theorem prod_ext_iff {f g : M × N₂ →L[R] N₃} : f = g ↔ f.comp (inl _ _ _) = g.comp (inl _ _ _) ∧ f.comp (inr _ _ _) = g.comp (inr _ _ _) := by simp only [← coe_inj, LinearMap.prod_ext_iff] rfl @[ext] theorem prod_ext {f g : M × N₂ →L[R] N₃} (hl : f.comp (inl _ _ _) = g.comp (inl _ _ _)) (hr : f.comp (inr _ _ _) = g.comp (inr _ _ _)) : f = g := prod_ext_iff.2 ⟨hl, hr⟩ variable [ContinuousAdd M₂] [ContinuousAdd M₃] [ContinuousAdd N₂] instance module : Module S₃ (M →SL[σ₁₃] M₃) where zero_smul _ := ext fun _ => zero_smul S₃ _ add_smul _ _ _ := ext fun _ => add_smul _ _ _ instance isCentralScalar [Module S₃ᵐᵒᵖ M₃] [IsCentralScalar S₃ M₃] : IsCentralScalar S₃ (M →SL[σ₁₃] M₃) where op_smul_eq_smul _ _ := ext fun _ => op_smul_eq_smul _ _ variable (S) [ContinuousAdd N₃] /-- `ContinuousLinearMap.prod` as a `LinearEquiv`. -/ @[simps apply] def prodₗ : ((M →L[R] N₂) × (M →L[R] N₃)) ≃ₗ[S] M →L[R] N₂ × N₃ := { prodEquiv with map_add' := fun _f _g => rfl map_smul' := fun _c _f => rfl } /-- The coercion from `M →L[R] M₂` to `M →ₗ[R] M₂`, as a linear map. -/ @[simps] def coeLM : (M →L[R] N₃) →ₗ[S] M →ₗ[R] N₃ where toFun := (↑) map_add' f g := coe_add f g map_smul' c f := coe_smul c f variable {S} (σ₁₃) /-- The coercion from `M →SL[σ] M₂` to `M →ₛₗ[σ] M₂`, as a linear map. -/ @[simps] def coeLMₛₗ : (M →SL[σ₁₃] M₃) →ₗ[S₃] M →ₛₗ[σ₁₃] M₃ where toFun := (↑) map_add' f g := coe_add f g map_smul' c f := coe_smul c f end SMul section SMulRightₗ variable {R S T M M₂ : Type*} [Semiring R] [Semiring S] [Semiring T] [Module R S] [AddCommMonoid M₂] [Module R M₂] [Module S M₂] [IsScalarTower R S M₂] [TopologicalSpace S] [TopologicalSpace M₂] [ContinuousSMul S M₂] [TopologicalSpace M] [AddCommMonoid M] [Module R M] [ContinuousAdd M₂] [Module T M₂] [ContinuousConstSMul T M₂] [SMulCommClass R T M₂] [SMulCommClass S T M₂] /-- Given `c : E →L[𝕜] 𝕜`, `c.smulRightₗ` is the linear map from `F` to `E →L[𝕜] F` sending `f` to `fun e => c e • f`. See also `ContinuousLinearMap.smulRightL`. -/ def smulRightₗ (c : M →L[R] S) : M₂ →ₗ[T] M →L[R] M₂ where toFun := c.smulRight map_add' x y := by ext e apply smul_add (c e) map_smul' a x := by ext e dsimp apply smul_comm @[simp] theorem coe_smulRightₗ (c : M →L[R] S) : ⇑(smulRightₗ c : M₂ →ₗ[T] M →L[R] M₂) = c.smulRight := rfl end SMulRightₗ section CommRing variable {R : Type*} [CommRing R] {M : Type*} [TopologicalSpace M] [AddCommGroup M] {M₂ : Type*} [TopologicalSpace M₂] [AddCommGroup M₂] {M₃ : Type*} [TopologicalSpace M₃] [AddCommGroup M₃] [Module R M] [Module R M₂] [Module R M₃] [ContinuousConstSMul R M₃] variable [TopologicalAddGroup M₂] [ContinuousConstSMul R M₂] instance algebra : Algebra R (M₂ →L[R] M₂) := Algebra.ofModule smul_comp fun _ _ _ => comp_smul _ _ _ @[simp] theorem algebraMap_apply (r : R) (m : M₂) : algebraMap R (M₂ →L[R] M₂) r m = r • m := rfl end CommRing section RestrictScalars variable {A M M₂ : Type*} [Ring A] [AddCommGroup M] [AddCommGroup M₂] [Module A M] [Module A M₂] [TopologicalSpace M] [TopologicalSpace M₂] (R : Type*) [Ring R] [Module R M] [Module R M₂] [LinearMap.CompatibleSMul M M₂ R A] /-- If `A` is an `R`-algebra, then a continuous `A`-linear map can be interpreted as a continuous `R`-linear map. We assume `LinearMap.CompatibleSMul M M₂ R A` to match assumptions of `LinearMap.map_smul_of_tower`. -/ def restrictScalars (f : M →L[A] M₂) : M →L[R] M₂ := ⟨(f : M →ₗ[A] M₂).restrictScalars R, f.continuous⟩ variable {R} @[simp] -- @[norm_cast] -- Porting note: This theorem can't be a `norm_cast` theorem. theorem coe_restrictScalars (f : M →L[A] M₂) : (f.restrictScalars R : M →ₗ[R] M₂) = (f : M →ₗ[A] M₂).restrictScalars R := rfl @[simp] theorem coe_restrictScalars' (f : M →L[A] M₂) : ⇑(f.restrictScalars R) = f := rfl @[simp] theorem restrictScalars_zero : (0 : M →L[A] M₂).restrictScalars R = 0 := rfl section variable [TopologicalAddGroup M₂] @[simp] theorem restrictScalars_add (f g : M →L[A] M₂) : (f + g).restrictScalars R = f.restrictScalars R + g.restrictScalars R := rfl @[simp] theorem restrictScalars_neg (f : M →L[A] M₂) : (-f).restrictScalars R = -f.restrictScalars R := rfl end variable {S : Type*} variable [Ring S] [Module S M₂] [ContinuousConstSMul S M₂] [SMulCommClass A S M₂] [SMulCommClass R S M₂] @[simp] theorem restrictScalars_smul (c : S) (f : M →L[A] M₂) : (c • f).restrictScalars R = c • f.restrictScalars R := rfl variable (A M M₂ R S) variable [TopologicalAddGroup M₂] /-- `ContinuousLinearMap.restrictScalars` as a `LinearMap`. See also `ContinuousLinearMap.restrictScalarsL`. -/ def restrictScalarsₗ : (M →L[A] M₂) →ₗ[S] M →L[R] M₂ where toFun := restrictScalars R map_add' := restrictScalars_add map_smul' := restrictScalars_smul variable {A M M₂ R S} @[simp] theorem coe_restrictScalarsₗ : ⇑(restrictScalarsₗ A M M₂ R S) = restrictScalars R := rfl end RestrictScalars end ContinuousLinearMap namespace ContinuousLinearEquiv section AddCommMonoid variable {R₁ : Type*} {R₂ : Type*} {R₃ : Type*} [Semiring R₁] [Semiring R₂] [Semiring R₃] {σ₁₂ : R₁ →+* R₂} {σ₂₁ : R₂ →+* R₁} [RingHomInvPair σ₁₂ σ₂₁] [RingHomInvPair σ₂₁ σ₁₂] {σ₂₃ : R₂ →+* R₃} {σ₃₂ : R₃ →+* R₂} [RingHomInvPair σ₂₃ σ₃₂] [RingHomInvPair σ₃₂ σ₂₃] {σ₁₃ : R₁ →+* R₃} {σ₃₁ : R₃ →+* R₁} [RingHomInvPair σ₁₃ σ₃₁] [RingHomInvPair σ₃₁ σ₁₃] [RingHomCompTriple σ₁₂ σ₂₃ σ₁₃] [RingHomCompTriple σ₃₂ σ₂₁ σ₃₁] {M₁ : Type*} [TopologicalSpace M₁] [AddCommMonoid M₁] {M'₁ : Type*} [TopologicalSpace M'₁] [AddCommMonoid M'₁] {M₂ : Type*} [TopologicalSpace M₂] [AddCommMonoid M₂] {M₃ : Type*} [TopologicalSpace M₃] [AddCommMonoid M₃] {M₄ : Type*} [TopologicalSpace M₄] [AddCommMonoid M₄] [Module R₁ M₁] [Module R₁ M'₁] [Module R₂ M₂] [Module R₃ M₃] /-- A continuous linear equivalence induces a continuous linear map. -/ @[coe] def toContinuousLinearMap (e : M₁ ≃SL[σ₁₂] M₂) : M₁ →SL[σ₁₂] M₂ := { e.toLinearEquiv.toLinearMap with cont := e.continuous_toFun } /-- Coerce continuous linear equivs to continuous linear maps. -/ instance ContinuousLinearMap.coe : Coe (M₁ ≃SL[σ₁₂] M₂) (M₁ →SL[σ₁₂] M₂) := ⟨toContinuousLinearMap⟩ instance equivLike : EquivLike (M₁ ≃SL[σ₁₂] M₂) M₁ M₂ where coe f := f.toFun inv f := f.invFun coe_injective' f g h₁ h₂ := by cases' f with f' _ cases' g with g' _ rcases f' with ⟨⟨⟨_, _⟩, _⟩, _⟩ rcases g' with ⟨⟨⟨_, _⟩, _⟩, _⟩ congr left_inv f := f.left_inv right_inv f := f.right_inv instance continuousSemilinearEquivClass : ContinuousSemilinearEquivClass (M₁ ≃SL[σ₁₂] M₂) σ₁₂ M₁ M₂ where map_add f := f.map_add' map_smulₛₗ f := f.map_smul' map_continuous := continuous_toFun inv_continuous := continuous_invFun -- see Note [function coercion] -- /-- Coerce continuous linear equivs to maps. -/ -- instance : CoeFun (M₁ ≃SL[σ₁₂] M₂) fun _ => M₁ → M₂ := -- ⟨fun f => f⟩ -- Porting note: Syntactic tautology. theorem coe_apply (e : M₁ ≃SL[σ₁₂] M₂) (b : M₁) : (e : M₁ →SL[σ₁₂] M₂) b = e b := rfl @[simp] theorem coe_toLinearEquiv (f : M₁ ≃SL[σ₁₂] M₂) : ⇑f.toLinearEquiv = f := rfl @[simp, norm_cast] theorem coe_coe (e : M₁ ≃SL[σ₁₂] M₂) : ⇑(e : M₁ →SL[σ₁₂] M₂) = e := rfl theorem toLinearEquiv_injective : Function.Injective (toLinearEquiv : (M₁ ≃SL[σ₁₂] M₂) → M₁ ≃ₛₗ[σ₁₂] M₂) := by rintro ⟨e, _, _⟩ ⟨e', _, _⟩ rfl rfl @[ext] theorem ext {f g : M₁ ≃SL[σ₁₂] M₂} (h : (f : M₁ → M₂) = g) : f = g := toLinearEquiv_injective <| LinearEquiv.ext <| congr_fun h theorem coe_injective : Function.Injective ((↑) : (M₁ ≃SL[σ₁₂] M₂) → M₁ →SL[σ₁₂] M₂) := fun _e _e' h => ext <| funext <| ContinuousLinearMap.ext_iff.1 h @[simp, norm_cast] theorem coe_inj {e e' : M₁ ≃SL[σ₁₂] M₂} : (e : M₁ →SL[σ₁₂] M₂) = e' ↔ e = e' := coe_injective.eq_iff /-- A continuous linear equivalence induces a homeomorphism. -/ def toHomeomorph (e : M₁ ≃SL[σ₁₂] M₂) : M₁ ≃ₜ M₂ := { e with toEquiv := e.toLinearEquiv.toEquiv } @[simp] theorem coe_toHomeomorph (e : M₁ ≃SL[σ₁₂] M₂) : ⇑e.toHomeomorph = e := rfl theorem isOpenMap (e : M₁ ≃SL[σ₁₂] M₂) : IsOpenMap e := (ContinuousLinearEquiv.toHomeomorph e).isOpenMap theorem image_closure (e : M₁ ≃SL[σ₁₂] M₂) (s : Set M₁) : e '' closure s = closure (e '' s) := e.toHomeomorph.image_closure s theorem preimage_closure (e : M₁ ≃SL[σ₁₂] M₂) (s : Set M₂) : e ⁻¹' closure s = closure (e ⁻¹' s) := e.toHomeomorph.preimage_closure s @[simp] theorem isClosed_image (e : M₁ ≃SL[σ₁₂] M₂) {s : Set M₁} : IsClosed (e '' s) ↔ IsClosed s := e.toHomeomorph.isClosed_image theorem map_nhds_eq (e : M₁ ≃SL[σ₁₂] M₂) (x : M₁) : map e (𝓝 x) = 𝓝 (e x) := e.toHomeomorph.map_nhds_eq x -- Make some straightforward lemmas available to `simp`. -- @[simp] -- Porting note (#10618): simp can prove this theorem map_zero (e : M₁ ≃SL[σ₁₂] M₂) : e (0 : M₁) = 0 := (e : M₁ →SL[σ₁₂] M₂).map_zero -- @[simp] -- Porting note (#10618): simp can prove this theorem map_add (e : M₁ ≃SL[σ₁₂] M₂) (x y : M₁) : e (x + y) = e x + e y := (e : M₁ →SL[σ₁₂] M₂).map_add x y -- @[simp] -- Porting note (#10618): simp can prove this theorem map_smulₛₗ (e : M₁ ≃SL[σ₁₂] M₂) (c : R₁) (x : M₁) : e (c • x) = σ₁₂ c • e x := (e : M₁ →SL[σ₁₂] M₂).map_smulₛₗ c x -- @[simp] -- Porting note (#10618): simp can prove this theorem map_smul [Module R₁ M₂] (e : M₁ ≃L[R₁] M₂) (c : R₁) (x : M₁) : e (c • x) = c • e x := (e : M₁ →L[R₁] M₂).map_smul c x -- @[simp] -- Porting note (#10618): simp can prove this theorem map_eq_zero_iff (e : M₁ ≃SL[σ₁₂] M₂) {x : M₁} : e x = 0 ↔ x = 0 := e.toLinearEquiv.map_eq_zero_iff attribute [continuity] ContinuousLinearEquiv.continuous_toFun ContinuousLinearEquiv.continuous_invFun @[continuity] protected theorem continuous (e : M₁ ≃SL[σ₁₂] M₂) : Continuous (e : M₁ → M₂) := e.continuous_toFun protected theorem continuousOn (e : M₁ ≃SL[σ₁₂] M₂) {s : Set M₁} : ContinuousOn (e : M₁ → M₂) s := e.continuous.continuousOn protected theorem continuousAt (e : M₁ ≃SL[σ₁₂] M₂) {x : M₁} : ContinuousAt (e : M₁ → M₂) x := e.continuous.continuousAt protected theorem continuousWithinAt (e : M₁ ≃SL[σ₁₂] M₂) {s : Set M₁} {x : M₁} : ContinuousWithinAt (e : M₁ → M₂) s x := e.continuous.continuousWithinAt theorem comp_continuousOn_iff {α : Type*} [TopologicalSpace α] (e : M₁ ≃SL[σ₁₂] M₂) {f : α → M₁} {s : Set α} : ContinuousOn (e ∘ f) s ↔ ContinuousOn f s := e.toHomeomorph.comp_continuousOn_iff _ _ theorem comp_continuous_iff {α : Type*} [TopologicalSpace α] (e : M₁ ≃SL[σ₁₂] M₂) {f : α → M₁} : Continuous (e ∘ f) ↔ Continuous f := e.toHomeomorph.comp_continuous_iff /-- An extensionality lemma for `R ≃L[R] M`. -/ theorem ext₁ [TopologicalSpace R₁] {f g : R₁ ≃L[R₁] M₁} (h : f 1 = g 1) : f = g := ext <| funext fun x => mul_one x ▸ by rw [← smul_eq_mul, map_smul, h, map_smul] section variable (R₁ M₁) /-- The identity map as a continuous linear equivalence. -/ @[refl] protected def refl : M₁ ≃L[R₁] M₁ := { LinearEquiv.refl R₁ M₁ with continuous_toFun := continuous_id continuous_invFun := continuous_id } end @[simp, norm_cast] theorem coe_refl : ↑(ContinuousLinearEquiv.refl R₁ M₁) = ContinuousLinearMap.id R₁ M₁ := rfl @[simp, norm_cast] theorem coe_refl' : ⇑(ContinuousLinearEquiv.refl R₁ M₁) = id := rfl /-- The inverse of a continuous linear equivalence as a continuous linear equivalence-/ @[symm] protected def symm (e : M₁ ≃SL[σ₁₂] M₂) : M₂ ≃SL[σ₂₁] M₁ := { e.toLinearEquiv.symm with continuous_toFun := e.continuous_invFun continuous_invFun := e.continuous_toFun } @[simp] theorem symm_toLinearEquiv (e : M₁ ≃SL[σ₁₂] M₂) : e.symm.toLinearEquiv = e.toLinearEquiv.symm := by ext rfl @[simp] theorem symm_toHomeomorph (e : M₁ ≃SL[σ₁₂] M₂) : e.toHomeomorph.symm = e.symm.toHomeomorph := rfl /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (h : M₁ ≃SL[σ₁₂] M₂) : M₁ → M₂ := h /-- See Note [custom simps projection] -/ def Simps.symm_apply (h : M₁ ≃SL[σ₁₂] M₂) : M₂ → M₁ := h.symm initialize_simps_projections ContinuousLinearEquiv (toFun → apply, invFun → symm_apply) theorem symm_map_nhds_eq (e : M₁ ≃SL[σ₁₂] M₂) (x : M₁) : map e.symm (𝓝 (e x)) = 𝓝 x := e.toHomeomorph.symm_map_nhds_eq x /-- The composition of two continuous linear equivalences as a continuous linear equivalence. -/ @[trans] protected def trans (e₁ : M₁ ≃SL[σ₁₂] M₂) (e₂ : M₂ ≃SL[σ₂₃] M₃) : M₁ ≃SL[σ₁₃] M₃ := { e₁.toLinearEquiv.trans e₂.toLinearEquiv with continuous_toFun := e₂.continuous_toFun.comp e₁.continuous_toFun continuous_invFun := e₁.continuous_invFun.comp e₂.continuous_invFun } @[simp] theorem trans_toLinearEquiv (e₁ : M₁ ≃SL[σ₁₂] M₂) (e₂ : M₂ ≃SL[σ₂₃] M₃) : (e₁.trans e₂).toLinearEquiv = e₁.toLinearEquiv.trans e₂.toLinearEquiv := by ext rfl /-- Product of two continuous linear equivalences. The map comes from `Equiv.prodCongr`. -/ def prod [Module R₁ M₂] [Module R₁ M₃] [Module R₁ M₄] (e : M₁ ≃L[R₁] M₂) (e' : M₃ ≃L[R₁] M₄) : (M₁ × M₃) ≃L[R₁] M₂ × M₄ := { e.toLinearEquiv.prod e'.toLinearEquiv with continuous_toFun := e.continuous_toFun.prod_map e'.continuous_toFun continuous_invFun := e.continuous_invFun.prod_map e'.continuous_invFun } @[simp, norm_cast] theorem prod_apply [Module R₁ M₂] [Module R₁ M₃] [Module R₁ M₄] (e : M₁ ≃L[R₁] M₂) (e' : M₃ ≃L[R₁] M₄) (x) : e.prod e' x = (e x.1, e' x.2) := rfl @[simp, norm_cast] theorem coe_prod [Module R₁ M₂] [Module R₁ M₃] [Module R₁ M₄] (e : M₁ ≃L[R₁] M₂) (e' : M₃ ≃L[R₁] M₄) : (e.prod e' : M₁ × M₃ →L[R₁] M₂ × M₄) = (e : M₁ →L[R₁] M₂).prodMap (e' : M₃ →L[R₁] M₄) := rfl theorem prod_symm [Module R₁ M₂] [Module R₁ M₃] [Module R₁ M₄] (e : M₁ ≃L[R₁] M₂) (e' : M₃ ≃L[R₁] M₄) : (e.prod e').symm = e.symm.prod e'.symm := rfl variable (R₁ M₁ M₂) /-- Product of modules is commutative up to continuous linear isomorphism. -/ @[simps! apply toLinearEquiv] def prodComm [Module R₁ M₂] : (M₁ × M₂) ≃L[R₁] M₂ × M₁ := { LinearEquiv.prodComm R₁ M₁ M₂ with continuous_toFun := continuous_swap continuous_invFun := continuous_swap } @[simp] lemma prodComm_symm [Module R₁ M₂] : (prodComm R₁ M₁ M₂).symm = prodComm R₁ M₂ M₁ := rfl variable {R₁ M₁ M₂} protected theorem bijective (e : M₁ ≃SL[σ₁₂] M₂) : Function.Bijective e := e.toLinearEquiv.toEquiv.bijective protected theorem injective (e : M₁ ≃SL[σ₁₂] M₂) : Function.Injective e := e.toLinearEquiv.toEquiv.injective protected theorem surjective (e : M₁ ≃SL[σ₁₂] M₂) : Function.Surjective e := e.toLinearEquiv.toEquiv.surjective @[simp] theorem trans_apply (e₁ : M₁ ≃SL[σ₁₂] M₂) (e₂ : M₂ ≃SL[σ₂₃] M₃) (c : M₁) : (e₁.trans e₂) c = e₂ (e₁ c) := rfl @[simp] theorem apply_symm_apply (e : M₁ ≃SL[σ₁₂] M₂) (c : M₂) : e (e.symm c) = c := e.1.right_inv c @[simp] theorem symm_apply_apply (e : M₁ ≃SL[σ₁₂] M₂) (b : M₁) : e.symm (e b) = b := e.1.left_inv b @[simp] theorem symm_trans_apply (e₁ : M₂ ≃SL[σ₂₁] M₁) (e₂ : M₃ ≃SL[σ₃₂] M₂) (c : M₁) : (e₂.trans e₁).symm c = e₂.symm (e₁.symm c) := rfl @[simp] theorem symm_image_image (e : M₁ ≃SL[σ₁₂] M₂) (s : Set M₁) : e.symm '' (e '' s) = s := e.toLinearEquiv.toEquiv.symm_image_image s @[simp] theorem image_symm_image (e : M₁ ≃SL[σ₁₂] M₂) (s : Set M₂) : e '' (e.symm '' s) = s := e.symm.symm_image_image s @[simp, norm_cast] theorem comp_coe (f : M₁ ≃SL[σ₁₂] M₂) (f' : M₂ ≃SL[σ₂₃] M₃) : (f' : M₂ →SL[σ₂₃] M₃).comp (f : M₁ →SL[σ₁₂] M₂) = (f.trans f' : M₁ →SL[σ₁₃] M₃) := rfl -- Porting note: The priority should be higher than `comp_coe`. @[simp high] theorem coe_comp_coe_symm (e : M₁ ≃SL[σ₁₂] M₂) : (e : M₁ →SL[σ₁₂] M₂).comp (e.symm : M₂ →SL[σ₂₁] M₁) = ContinuousLinearMap.id R₂ M₂ := ContinuousLinearMap.ext e.apply_symm_apply -- Porting note: The priority should be higher than `comp_coe`. @[simp high] theorem coe_symm_comp_coe (e : M₁ ≃SL[σ₁₂] M₂) : (e.symm : M₂ →SL[σ₂₁] M₁).comp (e : M₁ →SL[σ₁₂] M₂) = ContinuousLinearMap.id R₁ M₁ := ContinuousLinearMap.ext e.symm_apply_apply @[simp] theorem symm_comp_self (e : M₁ ≃SL[σ₁₂] M₂) : (e.symm : M₂ → M₁) ∘ (e : M₁ → M₂) = id := by ext x exact symm_apply_apply e x @[simp] theorem self_comp_symm (e : M₁ ≃SL[σ₁₂] M₂) : (e : M₁ → M₂) ∘ (e.symm : M₂ → M₁) = id := by ext x exact apply_symm_apply e x @[simp] theorem symm_symm (e : M₁ ≃SL[σ₁₂] M₂) : e.symm.symm = e := by ext x rfl @[simp] theorem refl_symm : (ContinuousLinearEquiv.refl R₁ M₁).symm = ContinuousLinearEquiv.refl R₁ M₁ := rfl theorem symm_symm_apply (e : M₁ ≃SL[σ₁₂] M₂) (x : M₁) : e.symm.symm x = e x := rfl theorem symm_apply_eq (e : M₁ ≃SL[σ₁₂] M₂) {x y} : e.symm x = y ↔ x = e y := e.toLinearEquiv.symm_apply_eq theorem eq_symm_apply (e : M₁ ≃SL[σ₁₂] M₂) {x y} : y = e.symm x ↔ e y = x := e.toLinearEquiv.eq_symm_apply protected theorem image_eq_preimage (e : M₁ ≃SL[σ₁₂] M₂) (s : Set M₁) : e '' s = e.symm ⁻¹' s := e.toLinearEquiv.toEquiv.image_eq_preimage s protected theorem image_symm_eq_preimage (e : M₁ ≃SL[σ₁₂] M₂) (s : Set M₂) : e.symm '' s = e ⁻¹' s := by rw [e.symm.image_eq_preimage, e.symm_symm] @[simp] protected theorem symm_preimage_preimage (e : M₁ ≃SL[σ₁₂] M₂) (s : Set M₂) : e.symm ⁻¹' (e ⁻¹' s) = s := e.toLinearEquiv.toEquiv.symm_preimage_preimage s @[simp] protected theorem preimage_symm_preimage (e : M₁ ≃SL[σ₁₂] M₂) (s : Set M₁) : e ⁻¹' (e.symm ⁻¹' s) = s := e.symm.symm_preimage_preimage s protected theorem uniformEmbedding {E₁ E₂ : Type*} [UniformSpace E₁] [UniformSpace E₂] [AddCommGroup E₁] [AddCommGroup E₂] [Module R₁ E₁] [Module R₂ E₂] [UniformAddGroup E₁] [UniformAddGroup E₂] (e : E₁ ≃SL[σ₁₂] E₂) : UniformEmbedding e := e.toLinearEquiv.toEquiv.uniformEmbedding e.toContinuousLinearMap.uniformContinuous e.symm.toContinuousLinearMap.uniformContinuous protected theorem _root_.LinearEquiv.uniformEmbedding {E₁ E₂ : Type*} [UniformSpace E₁] [UniformSpace E₂] [AddCommGroup E₁] [AddCommGroup E₂] [Module R₁ E₁] [Module R₂ E₂] [UniformAddGroup E₁] [UniformAddGroup E₂] (e : E₁ ≃ₛₗ[σ₁₂] E₂) (h₁ : Continuous e) (h₂ : Continuous e.symm) : UniformEmbedding e := ContinuousLinearEquiv.uniformEmbedding ({ e with continuous_toFun := h₁ continuous_invFun := h₂ } : E₁ ≃SL[σ₁₂] E₂) /-- Create a `ContinuousLinearEquiv` from two `ContinuousLinearMap`s that are inverse of each other. -/ def equivOfInverse (f₁ : M₁ →SL[σ₁₂] M₂) (f₂ : M₂ →SL[σ₂₁] M₁) (h₁ : Function.LeftInverse f₂ f₁) (h₂ : Function.RightInverse f₂ f₁) : M₁ ≃SL[σ₁₂] M₂ := { f₁ with continuous_toFun := f₁.continuous invFun := f₂ continuous_invFun := f₂.continuous left_inv := h₁ right_inv := h₂ } @[simp] theorem equivOfInverse_apply (f₁ : M₁ →SL[σ₁₂] M₂) (f₂ h₁ h₂ x) : equivOfInverse f₁ f₂ h₁ h₂ x = f₁ x := rfl @[simp] theorem symm_equivOfInverse (f₁ : M₁ →SL[σ₁₂] M₂) (f₂ h₁ h₂) : (equivOfInverse f₁ f₂ h₁ h₂).symm = equivOfInverse f₂ f₁ h₂ h₁ := rfl variable (M₁) /-- The continuous linear equivalences from `M` to itself form a group under composition. -/ instance automorphismGroup : Group (M₁ ≃L[R₁] M₁) where mul f g := g.trans f one := ContinuousLinearEquiv.refl R₁ M₁ inv f := f.symm mul_assoc f g h := by ext rfl mul_one f := by ext rfl one_mul f := by ext rfl mul_left_inv f := by ext x exact f.left_inv x variable {M₁} {R₄ : Type*} [Semiring R₄] [Module R₄ M₄] {σ₃₄ : R₃ →+* R₄} {σ₄₃ : R₄ →+* R₃} [RingHomInvPair σ₃₄ σ₄₃] [RingHomInvPair σ₄₃ σ₃₄] {σ₂₄ : R₂ →+* R₄} {σ₁₄ : R₁ →+* R₄} [RingHomCompTriple σ₂₁ σ₁₄ σ₂₄] [RingHomCompTriple σ₂₄ σ₄₃ σ₂₃] [RingHomCompTriple σ₁₃ σ₃₄ σ₁₄] /-- The continuous linear equivalence between `ULift M₁` and `M₁`. This is a continuous version of `ULift.moduleEquiv`. -/ def ulift : ULift M₁ ≃L[R₁] M₁ := { ULift.moduleEquiv with continuous_toFun := continuous_uLift_down continuous_invFun := continuous_uLift_up } /-- A pair of continuous (semi)linear equivalences generates an equivalence between the spaces of continuous linear maps. See also `ContinuousLinearEquiv.arrowCongr`. -/ @[simps] def arrowCongrEquiv (e₁₂ : M₁ ≃SL[σ₁₂] M₂) (e₄₃ : M₄ ≃SL[σ₄₃] M₃) : (M₁ →SL[σ₁₄] M₄) ≃ (M₂ →SL[σ₂₃] M₃) where toFun f := (e₄₃ : M₄ →SL[σ₄₃] M₃).comp (f.comp (e₁₂.symm : M₂ →SL[σ₂₁] M₁)) invFun f := (e₄₃.symm : M₃ →SL[σ₃₄] M₄).comp (f.comp (e₁₂ : M₁ →SL[σ₁₂] M₂)) left_inv f := ContinuousLinearMap.ext fun x => by simp only [ContinuousLinearMap.comp_apply, symm_apply_apply, coe_coe] right_inv f := ContinuousLinearMap.ext fun x => by simp only [ContinuousLinearMap.comp_apply, apply_symm_apply, coe_coe] end AddCommMonoid section AddCommGroup variable {R : Type*} [Semiring R] {M : Type*} [TopologicalSpace M] [AddCommGroup M] {M₂ : Type*} [TopologicalSpace M₂] [AddCommGroup M₂] {M₃ : Type*} [TopologicalSpace M₃] [AddCommGroup M₃] {M₄ : Type*} [TopologicalSpace M₄] [AddCommGroup M₄] [Module R M] [Module R M₂] [Module R M₃] [Module R M₄] variable [TopologicalAddGroup M₄] /-- Equivalence given by a block lower diagonal matrix. `e` and `e'` are diagonal square blocks, and `f` is a rectangular block below the diagonal. -/ def skewProd (e : M ≃L[R] M₂) (e' : M₃ ≃L[R] M₄) (f : M →L[R] M₄) : (M × M₃) ≃L[R] M₂ × M₄ := { e.toLinearEquiv.skewProd e'.toLinearEquiv ↑f with continuous_toFun := (e.continuous_toFun.comp continuous_fst).prod_mk ((e'.continuous_toFun.comp continuous_snd).add <| f.continuous.comp continuous_fst) continuous_invFun := (e.continuous_invFun.comp continuous_fst).prod_mk (e'.continuous_invFun.comp <| continuous_snd.sub <| f.continuous.comp <| e.continuous_invFun.comp continuous_fst) } @[simp] theorem skewProd_apply (e : M ≃L[R] M₂) (e' : M₃ ≃L[R] M₄) (f : M →L[R] M₄) (x) : e.skewProd e' f x = (e x.1, e' x.2 + f x.1) := rfl @[simp] theorem skewProd_symm_apply (e : M ≃L[R] M₂) (e' : M₃ ≃L[R] M₄) (f : M →L[R] M₄) (x) : (e.skewProd e' f).symm x = (e.symm x.1, e'.symm (x.2 - f (e.symm x.1))) := rfl end AddCommGroup section Ring variable {R : Type*} [Ring R] {R₂ : Type*} [Ring R₂] {M : Type*} [TopologicalSpace M] [AddCommGroup M] [Module R M] {M₂ : Type*} [TopologicalSpace M₂] [AddCommGroup M₂] [Module R₂ M₂] variable {σ₁₂ : R →+* R₂} {σ₂₁ : R₂ →+* R} [RingHomInvPair σ₁₂ σ₂₁] [RingHomInvPair σ₂₁ σ₁₂] -- @[simp] -- Porting note (#10618): simp can prove this theorem map_sub (e : M ≃SL[σ₁₂] M₂) (x y : M) : e (x - y) = e x - e y := (e : M →SL[σ₁₂] M₂).map_sub x y -- @[simp] -- Porting note (#10618): simp can prove this theorem map_neg (e : M ≃SL[σ₁₂] M₂) (x : M) : e (-x) = -e x := (e : M →SL[σ₁₂] M₂).map_neg x section /-! The next theorems cover the identification between `M ≃L[𝕜] M`and the group of units of the ring `M →L[R] M`. -/ /-- An invertible continuous linear map `f` determines a continuous equivalence from `M` to itself. -/ def ofUnit (f : (M →L[R] M)ˣ) : M ≃L[R] M where toLinearEquiv := { toFun := f.val map_add' := by simp map_smul' := by simp invFun := f.inv left_inv := fun x => show (f.inv * f.val) x = x by rw [f.inv_val] simp right_inv := fun x => show (f.val * f.inv) x = x by rw [f.val_inv] simp } continuous_toFun := f.val.continuous continuous_invFun := f.inv.continuous /-- A continuous equivalence from `M` to itself determines an invertible continuous linear map. -/ def toUnit (f : M ≃L[R] M) : (M →L[R] M)ˣ where val := f inv := f.symm val_inv := by ext simp inv_val := by ext simp variable (R M) /-- The units of the algebra of continuous `R`-linear endomorphisms of `M` is multiplicatively equivalent to the type of continuous linear equivalences between `M` and itself. -/ def unitsEquiv : (M →L[R] M)ˣ ≃* M ≃L[R] M where toFun := ofUnit invFun := toUnit left_inv f := by ext rfl right_inv f := by ext rfl map_mul' x y := by ext rfl @[simp] theorem unitsEquiv_apply (f : (M →L[R] M)ˣ) (x : M) : unitsEquiv R M f x = (f : M →L[R] M) x := rfl end section variable (R) [TopologicalSpace R] variable [ContinuousMul R] /-- Continuous linear equivalences `R ≃L[R] R` are enumerated by `Rˣ`. -/ def unitsEquivAut : Rˣ ≃ R ≃L[R] R where toFun u := equivOfInverse (ContinuousLinearMap.smulRight (1 : R →L[R] R) ↑u) (ContinuousLinearMap.smulRight (1 : R →L[R] R) ↑u⁻¹) (fun x => by simp) fun x => by simp invFun e := ⟨e 1, e.symm 1, by rw [← smul_eq_mul, ← map_smul, smul_eq_mul, mul_one, symm_apply_apply], by rw [← smul_eq_mul, ← map_smul, smul_eq_mul, mul_one, apply_symm_apply]⟩ left_inv u := Units.ext <| by simp right_inv e := ext₁ <| by simp variable {R} @[simp] theorem unitsEquivAut_apply (u : Rˣ) (x : R) : unitsEquivAut R u x = x * u := rfl @[simp] theorem unitsEquivAut_apply_symm (u : Rˣ) (x : R) : (unitsEquivAut R u).symm x = x * ↑u⁻¹ := rfl @[simp] theorem unitsEquivAut_symm_apply (e : R ≃L[R] R) : ↑((unitsEquivAut R).symm e) = e 1 := rfl end variable [Module R M₂] [TopologicalAddGroup M] /-- A pair of continuous linear maps such that `f₁ ∘ f₂ = id` generates a continuous linear equivalence `e` between `M` and `M₂ × f₁.ker` such that `(e x).2 = x` for `x ∈ f₁.ker`, `(e x).1 = f₁ x`, and `(e (f₂ y)).2 = 0`. The map is given by `e x = (f₁ x, x - f₂ (f₁ x))`. -/ def equivOfRightInverse (f₁ : M →L[R] M₂) (f₂ : M₂ →L[R] M) (h : Function.RightInverse f₂ f₁) : M ≃L[R] M₂ × ker f₁ := equivOfInverse (f₁.prod (f₁.projKerOfRightInverse f₂ h)) (f₂.coprod (ker f₁).subtypeL) (fun x => by simp) fun ⟨x, y⟩ => by -- Porting note: `simp` timeouts. rw [ContinuousLinearMap.coprod_apply, Submodule.subtypeL_apply, _root_.map_add, ContinuousLinearMap.prod_apply, h x, ContinuousLinearMap.projKerOfRightInverse_comp_inv, ContinuousLinearMap.prod_apply, LinearMap.map_coe_ker, ContinuousLinearMap.projKerOfRightInverse_apply_idem, Prod.mk_add_mk, add_zero, zero_add] @[simp] theorem fst_equivOfRightInverse (f₁ : M →L[R] M₂) (f₂ : M₂ →L[R] M) (h : Function.RightInverse f₂ f₁) (x : M) : (equivOfRightInverse f₁ f₂ h x).1 = f₁ x := rfl @[simp] theorem snd_equivOfRightInverse (f₁ : M →L[R] M₂) (f₂ : M₂ →L[R] M) (h : Function.RightInverse f₂ f₁) (x : M) : ((equivOfRightInverse f₁ f₂ h x).2 : M) = x - f₂ (f₁ x) := rfl @[simp] theorem equivOfRightInverse_symm_apply (f₁ : M →L[R] M₂) (f₂ : M₂ →L[R] M) (h : Function.RightInverse f₂ f₁) (y : M₂ × ker f₁) : (equivOfRightInverse f₁ f₂ h).symm y = f₂ y.1 + y.2 := rfl end Ring section variable (ι R M : Type*) [Unique ι] [Semiring R] [AddCommMonoid M] [Module R M] [TopologicalSpace M] /-- If `ι` has a unique element, then `ι → M` is continuously linear equivalent to `M`. -/ def funUnique : (ι → M) ≃L[R] M := { Homeomorph.funUnique ι M with toLinearEquiv := LinearEquiv.funUnique ι R M } variable {ι R M} @[simp] theorem coe_funUnique : ⇑(funUnique ι R M) = Function.eval default := rfl @[simp] theorem coe_funUnique_symm : ⇑(funUnique ι R M).symm = Function.const ι := rfl variable (R M) /-- Continuous linear equivalence between dependent functions `(i : Fin 2) → M i` and `M 0 × M 1`. -/ @[simps! (config := .asFn) apply symm_apply] def piFinTwo (M : Fin 2 → Type*) [∀ i, AddCommMonoid (M i)] [∀ i, Module R (M i)] [∀ i, TopologicalSpace (M i)] : ((i : _) → M i) ≃L[R] M 0 × M 1 := { Homeomorph.piFinTwo M with toLinearEquiv := LinearEquiv.piFinTwo R M } /-- Continuous linear equivalence between vectors in `M² = Fin 2 → M` and `M × M`. -/ @[simps! (config := .asFn) apply symm_apply] def finTwoArrow : (Fin 2 → M) ≃L[R] M × M := { piFinTwo R fun _ => M with toLinearEquiv := LinearEquiv.finTwoArrow R M } end end ContinuousLinearEquiv namespace ContinuousLinearMap open scoped Classical variable {R : Type*} {M : Type*} {M₂ : Type*} [TopologicalSpace M] [TopologicalSpace M₂] section variable [Semiring R] variable [AddCommMonoid M₂] [Module R M₂] variable [AddCommMonoid M] [Module R M] /-- Introduce a function `inverse` from `M →L[R] M₂` to `M₂ →L[R] M`, which sends `f` to `f.symm` if `f` is a continuous linear equivalence and to `0` otherwise. This definition is somewhat ad hoc, but one needs a fully (rather than partially) defined inverse function for some purposes, including for calculus. -/ noncomputable def inverse : (M →L[R] M₂) → M₂ →L[R] M := fun f => if h : ∃ e : M ≃L[R] M₂, (e : M →L[R] M₂) = f then ((Classical.choose h).symm : M₂ →L[R] M) else 0 /-- By definition, if `f` is invertible then `inverse f = f.symm`. -/ @[simp] theorem inverse_equiv (e : M ≃L[R] M₂) : inverse (e : M →L[R] M₂) = e.symm := by have h : ∃ e' : M ≃L[R] M₂, (e' : M →L[R] M₂) = ↑e := ⟨e, rfl⟩ simp only [inverse, dif_pos h] congr exact mod_cast Classical.choose_spec h /-- By definition, if `f` is not invertible then `inverse f = 0`. -/ @[simp] theorem inverse_non_equiv (f : M →L[R] M₂) (h : ¬∃ e' : M ≃L[R] M₂, ↑e' = f) : inverse f = 0 := dif_neg h end section variable [Ring R] variable [AddCommGroup M] [Module R M] variable [AddCommGroup M₂] [Module R M₂] @[simp] theorem ring_inverse_equiv (e : M ≃L[R] M) : Ring.inverse ↑e = inverse (e : M →L[R] M) := by suffices Ring.inverse ((ContinuousLinearEquiv.unitsEquiv _ _).symm e : M →L[R] M) = inverse ↑e by convert this simp rfl /-- The function `ContinuousLinearEquiv.inverse` can be written in terms of `Ring.inverse` for the ring of self-maps of the domain. -/ theorem to_ring_inverse (e : M ≃L[R] M₂) (f : M →L[R] M₂) : inverse f = Ring.inverse ((e.symm : M₂ →L[R] M).comp f) ∘L e.symm := by by_cases h₁ : ∃ e' : M ≃L[R] M₂, e' = f · obtain ⟨e', he'⟩ := h₁ rw [← he'] change _ = Ring.inverse (e'.trans e.symm : M →L[R] M) ∘L (e.symm : M₂ →L[R] M) ext simp · suffices ¬IsUnit ((e.symm : M₂ →L[R] M).comp f) by simp [this, h₁] contrapose! h₁ rcases h₁ with ⟨F, hF⟩ use (ContinuousLinearEquiv.unitsEquiv _ _ F).trans e ext dsimp rw [hF] simp theorem ring_inverse_eq_map_inverse : Ring.inverse = @inverse R M M _ _ _ _ _ _ _ := by ext simp [to_ring_inverse (ContinuousLinearEquiv.refl R M)] end end ContinuousLinearMap namespace Submodule variable {R : Type*} [Ring R] {M : Type*} [TopologicalSpace M] [AddCommGroup M] [Module R M] {M₂ : Type*} [TopologicalSpace M₂] [AddCommGroup M₂] [Module R M₂] open ContinuousLinearMap /-- A submodule `p` is called *complemented* if there exists a continuous projection `M →ₗ[R] p`. -/ def ClosedComplemented (p : Submodule R M) : Prop := ∃ f : M →L[R] p, ∀ x : p, f x = x theorem ClosedComplemented.exists_isClosed_isCompl {p : Submodule R M} [T1Space p] (h : ClosedComplemented p) : ∃ q : Submodule R M, IsClosed (q : Set M) ∧ IsCompl p q := Exists.elim h fun f hf => ⟨ker f, isClosed_ker f, LinearMap.isCompl_of_proj hf⟩ protected theorem ClosedComplemented.isClosed [TopologicalAddGroup M] [T1Space M] {p : Submodule R M} (h : ClosedComplemented p) : IsClosed (p : Set M) := by rcases h with ⟨f, hf⟩ have : ker (id R M - p.subtypeL.comp f) = p := LinearMap.ker_id_sub_eq_of_proj hf exact this ▸ isClosed_ker _ @[simp] theorem closedComplemented_bot : ClosedComplemented (⊥ : Submodule R M) := ⟨0, fun x => by simp only [zero_apply, eq_zero_of_bot_submodule x]⟩ @[simp] theorem closedComplemented_top : ClosedComplemented (⊤ : Submodule R M) := ⟨(id R M).codRestrict ⊤ fun _x => trivial, fun x => Subtype.ext_iff_val.2 <| by simp⟩ /-- If `p` is a closed complemented submodule, then there exists a submodule `q` and a continuous linear equivalence `M ≃L[R] (p × q)` such that `e (x : p) = (x, 0)`, `e (y : q) = (0, y)`, and `e.symm x = x.1 + x.2`. In fact, the properties of `e` imply the properties of `e.symm` and vice versa, but we provide both for convenience. -/ lemma ClosedComplemented.exists_submodule_equiv_prod [TopologicalAddGroup M] {p : Submodule R M} (hp : p.ClosedComplemented) : ∃ (q : Submodule R M) (e : M ≃L[R] (p × q)), (∀ x : p, e x = (x, 0)) ∧ (∀ y : q, e y = (0, y)) ∧ (∀ x, e.symm x = x.1 + x.2) := let ⟨f, hf⟩ := hp ⟨LinearMap.ker f, .equivOfRightInverse _ p.subtypeL hf, fun _ ↦ by ext <;> simp [hf], fun _ ↦ by ext <;> simp [hf], fun _ ↦ rfl⟩ end Submodule theorem ContinuousLinearMap.closedComplemented_ker_of_rightInverse {R : Type*} [Ring R] {M : Type*} [TopologicalSpace M] [AddCommGroup M] {M₂ : Type*} [TopologicalSpace M₂] [AddCommGroup M₂] [Module R M] [Module R M₂] [TopologicalAddGroup M] (f₁ : M →L[R] M₂) (f₂ : M₂ →L[R] M) (h : Function.RightInverse f₂ f₁) : (ker f₁).ClosedComplemented := ⟨f₁.projKerOfRightInverse f₂ h, f₁.projKerOfRightInverse_apply_idem f₂ h⟩ section Quotient namespace Submodule variable {R M : Type*} [Ring R] [AddCommGroup M] [Module R M] [TopologicalSpace M] (S : Submodule R M) -- Porting note: This is required in Lean4. instance _root_.QuotientModule.Quotient.topologicalSpace : TopologicalSpace (M ⧸ S) := inferInstanceAs (TopologicalSpace (Quotient S.quotientRel)) theorem isOpenMap_mkQ [TopologicalAddGroup M] : IsOpenMap S.mkQ := QuotientAddGroup.isOpenMap_coe S.toAddSubgroup instance topologicalAddGroup_quotient [TopologicalAddGroup M] : TopologicalAddGroup (M ⧸ S) := _root_.topologicalAddGroup_quotient S.toAddSubgroup instance continuousSMul_quotient [TopologicalSpace R] [TopologicalAddGroup M] [ContinuousSMul R M] : ContinuousSMul R (M ⧸ S) := by constructor have quot : QuotientMap fun au : R × M => (au.1, S.mkQ au.2) := IsOpenMap.to_quotientMap (IsOpenMap.id.prod S.isOpenMap_mkQ) (continuous_id.prod_map continuous_quot_mk) (Function.surjective_id.prodMap <| surjective_quot_mk _) rw [quot.continuous_iff] exact continuous_quot_mk.comp continuous_smul instance t3_quotient_of_isClosed [TopologicalAddGroup M] [IsClosed (S : Set M)] : T3Space (M ⧸ S) := letI : IsClosed (S.toAddSubgroup : Set M) := ‹_› S.toAddSubgroup.t3_quotient_of_isClosed end Submodule end Quotient
Topology\Algebra\Module\Cardinality.lean
/- Copyright (c) 2023 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Algebra.Module.Card import Mathlib.SetTheory.Cardinal.CountableCover import Mathlib.SetTheory.Cardinal.Continuum import Mathlib.Analysis.SpecificLimits.Normed import Mathlib.Topology.MetricSpace.Perfect /-! # Cardinality of open subsets of vector spaces Any nonempty open subset of a topological vector space over a nontrivially normed field has the same cardinality as the whole space. This is proved in `cardinal_eq_of_isOpen`. We deduce that a countable set in a nontrivial vector space over a complete nontrivially normed field has dense complement, in `Set.Countable.dense_compl`. This follows from the previous argument and the fact that a complete nontrivially normed field has cardinality at least continuum, proved in `continuum_le_cardinal_of_nontriviallyNormedField`. -/ universe u v open Filter Pointwise Set Function Cardinal open scoped Cardinal Topology /-- A complete nontrivially normed field has cardinality at least continuum. -/ theorem continuum_le_cardinal_of_nontriviallyNormedField (𝕜 : Type*) [NontriviallyNormedField 𝕜] [CompleteSpace 𝕜] : 𝔠 ≤ #𝕜 := by suffices ∃ f : (ℕ → Bool) → 𝕜, range f ⊆ univ ∧ Continuous f ∧ Injective f by rcases this with ⟨f, -, -, f_inj⟩ simpa using lift_mk_le_lift_mk_of_injective f_inj apply Perfect.exists_nat_bool_injection _ univ_nonempty refine ⟨isClosed_univ, preperfect_iff_nhds.2 (fun x _ U hU ↦ ?_)⟩ rcases NormedField.exists_norm_lt_one 𝕜 with ⟨c, c_pos, hc⟩ have A : Tendsto (fun n ↦ x + c^n) atTop (𝓝 (x + 0)) := tendsto_const_nhds.add (tendsto_pow_atTop_nhds_zero_of_norm_lt_one hc) rw [add_zero] at A have B : ∀ᶠ n in atTop, x + c^n ∈ U := tendsto_def.1 A U hU rcases B.exists with ⟨n, hn⟩ refine ⟨x + c^n, by simpa using hn, ?_⟩ simp only [ne_eq, add_right_eq_self] apply pow_ne_zero simpa using c_pos /-- A nontrivial module over a complete nontrivially normed field has cardinality at least continuum. -/ theorem continuum_le_cardinal_of_module (𝕜 : Type u) (E : Type v) [NontriviallyNormedField 𝕜] [CompleteSpace 𝕜] [AddCommGroup E] [Module 𝕜 E] [Nontrivial E] : 𝔠 ≤ #E := by have A : lift.{v} (𝔠 : Cardinal.{u}) ≤ lift.{v} (#𝕜) := by simpa using continuum_le_cardinal_of_nontriviallyNormedField 𝕜 simpa using A.trans (Cardinal.mk_le_of_module 𝕜 E) /-- In a topological vector space over a nontrivially normed field, any neighborhood of zero has the same cardinality as the whole space. See also `cardinal_eq_of_mem_nhds`. -/ lemma cardinal_eq_of_mem_nhds_zero {E : Type*} (𝕜 : Type*) [NontriviallyNormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] [ContinuousSMul 𝕜 E] {s : Set E} (hs : s ∈ 𝓝 (0 : E)) : #s = #E := by /- As `s` is a neighborhood of `0`, the space is covered by the rescaled sets `c^n • s`, where `c` is any element of `𝕜` with norm `> 1`. All these sets are in bijection and have therefore the same cardinality. The conclusion follows. -/ obtain ⟨c, hc⟩ : ∃ x : 𝕜 , 1 < ‖x‖ := NormedField.exists_lt_norm 𝕜 1 have cn_ne : ∀ n, c^n ≠ 0 := by intro n apply pow_ne_zero rintro rfl simp only [norm_zero] at hc exact lt_irrefl _ (hc.trans zero_lt_one) have A : ∀ (x : E), ∀ᶠ n in (atTop : Filter ℕ), x ∈ c^n • s := by intro x have : Tendsto (fun n ↦ (c^n) ⁻¹ • x) atTop (𝓝 ((0 : 𝕜) • x)) := by have : Tendsto (fun n ↦ (c^n)⁻¹) atTop (𝓝 0) := by simp_rw [← inv_pow] apply tendsto_pow_atTop_nhds_zero_of_norm_lt_one rw [norm_inv] exact inv_lt_one hc exact Tendsto.smul_const this x rw [zero_smul] at this filter_upwards [this hs] with n (hn : (c ^ n)⁻¹ • x ∈ s) exact (mem_smul_set_iff_inv_smul_mem₀ (cn_ne n) _ _).2 hn have B : ∀ n, #(c^n • s :) = #s := by intro n have : (c^n • s :) ≃ s := { toFun := fun x ↦ ⟨(c^n)⁻¹ • x.1, (mem_smul_set_iff_inv_smul_mem₀ (cn_ne n) _ _).1 x.2⟩ invFun := fun x ↦ ⟨(c^n) • x.1, smul_mem_smul_set x.2⟩ left_inv := fun x ↦ by simp [smul_smul, mul_inv_cancel (cn_ne n)] right_inv := fun x ↦ by simp [smul_smul, inv_mul_cancel (cn_ne n)] } exact Cardinal.mk_congr this apply (Cardinal.mk_of_countable_eventually_mem A B).symm /-- In a topological vector space over a nontrivially normed field, any neighborhood of a point has the same cardinality as the whole space. -/ theorem cardinal_eq_of_mem_nhds {E : Type*} (𝕜 : Type*) [NontriviallyNormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] [ContinuousAdd E] [ContinuousSMul 𝕜 E] {s : Set E} {x : E} (hs : s ∈ 𝓝 x) : #s = #E := by let g := Homeomorph.addLeft x let t := g ⁻¹' s have : t ∈ 𝓝 0 := g.continuous.continuousAt.preimage_mem_nhds (by simpa [g] using hs) have A : #t = #E := cardinal_eq_of_mem_nhds_zero 𝕜 this have B : #t = #s := Cardinal.mk_subtype_of_equiv s g.toEquiv rwa [B] at A /-- In a topological vector space over a nontrivially normed field, any nonempty open set has the same cardinality as the whole space. -/ theorem cardinal_eq_of_isOpen {E : Type*} (𝕜 : Type*) [NontriviallyNormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] [ContinuousAdd E] [ContinuousSMul 𝕜 E] {s : Set E} (hs : IsOpen s) (h's : s.Nonempty) : #s = #E := by rcases h's with ⟨x, hx⟩ exact cardinal_eq_of_mem_nhds 𝕜 (hs.mem_nhds hx) /-- In a nontrivial topological vector space over a complete nontrivially normed field, any nonempty open set has cardinality at least continuum. -/ theorem continuum_le_cardinal_of_isOpen {E : Type*} (𝕜 : Type*) [NontriviallyNormedField 𝕜] [CompleteSpace 𝕜] [AddCommGroup E] [Module 𝕜 E] [Nontrivial E] [TopologicalSpace E] [ContinuousAdd E] [ContinuousSMul 𝕜 E] {s : Set E} (hs : IsOpen s) (h's : s.Nonempty) : 𝔠 ≤ #s := by simpa [cardinal_eq_of_isOpen 𝕜 hs h's] using continuum_le_cardinal_of_module 𝕜 E /-- In a nontrivial topological vector space over a complete nontrivially normed field, any countable set has dense complement. -/ theorem Set.Countable.dense_compl {E : Type u} (𝕜 : Type*) [NontriviallyNormedField 𝕜] [CompleteSpace 𝕜] [AddCommGroup E] [Module 𝕜 E] [Nontrivial E] [TopologicalSpace E] [ContinuousAdd E] [ContinuousSMul 𝕜 E] {s : Set E} (hs : s.Countable) : Dense sᶜ := by rw [← interior_eq_empty_iff_dense_compl] by_contra H apply lt_irrefl (ℵ₀ : Cardinal.{u}) calc (ℵ₀ : Cardinal.{u}) < 𝔠 := aleph0_lt_continuum _ ≤ #(interior s) := continuum_le_cardinal_of_isOpen 𝕜 isOpen_interior (nmem_singleton_empty.1 H) _ ≤ #s := mk_le_mk_of_subset interior_subset _ ≤ ℵ₀ := le_aleph0 hs
Topology\Algebra\Module\CharacterSpace.lean
/- Copyright (c) 2022 Frédéric Dupuis. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Frédéric Dupuis -/ import Mathlib.Topology.Algebra.Module.WeakDual import Mathlib.Algebra.Algebra.Spectrum import Mathlib.Topology.ContinuousFunction.Algebra import Mathlib.Data.Set.Lattice /-! # Character space of a topological algebra The character space of a topological algebra is the subset of elements of the weak dual that are also algebra homomorphisms. This space is used in the Gelfand transform, which gives an isomorphism between a commutative C⋆-algebra and continuous functions on the character space of the algebra. This, in turn, is used to construct the continuous functional calculus on C⋆-algebras. ## Implementation notes We define `WeakDual.characterSpace 𝕜 A` as a subset of the weak dual, which automatically puts the correct topology on the space. We then define `WeakDual.CharacterSpace.toAlgHom` which provides the algebra homomorphism corresponding to any element. We also provide `WeakDual.CharacterSpace.toCLM` which provides the element as a continuous linear map. (Even though `WeakDual 𝕜 A` is a type copy of `A →L[𝕜] 𝕜`, this is often more convenient.) ## Tags character space, Gelfand transform, functional calculus -/ namespace WeakDual /-- The character space of a topological algebra is the subset of elements of the weak dual that are also algebra homomorphisms. -/ def characterSpace (𝕜 : Type*) (A : Type*) [CommSemiring 𝕜] [TopologicalSpace 𝕜] [ContinuousAdd 𝕜] [ContinuousConstSMul 𝕜 𝕜] [NonUnitalNonAssocSemiring A] [TopologicalSpace A] [Module 𝕜 A] := {φ : WeakDual 𝕜 A | φ ≠ 0 ∧ ∀ x y : A, φ (x * y) = φ x * φ y} variable {𝕜 : Type*} {A : Type*} -- Porting note: even though the capitalization of the namespace differs, it doesn't matter -- because there is no dot notation since `characterSpace` is only a type via `CoeSort`. namespace CharacterSpace section NonUnitalNonAssocSemiring variable [CommSemiring 𝕜] [TopologicalSpace 𝕜] [ContinuousAdd 𝕜] [ContinuousConstSMul 𝕜 𝕜] [NonUnitalNonAssocSemiring A] [TopologicalSpace A] [Module 𝕜 A] instance instFunLike : FunLike (characterSpace 𝕜 A) A 𝕜 where coe φ := ((φ : WeakDual 𝕜 A) : A → 𝕜) coe_injective' φ ψ h := by ext1; apply DFunLike.ext; exact congr_fun h /-- Elements of the character space are continuous linear maps. -/ instance instContinuousLinearMapClass : ContinuousLinearMapClass (characterSpace 𝕜 A) 𝕜 A 𝕜 where map_smulₛₗ φ := (φ : WeakDual 𝕜 A).map_smul map_add φ := (φ : WeakDual 𝕜 A).map_add map_continuous φ := (φ : WeakDual 𝕜 A).cont -- Porting note: moved because Lean 4 doesn't see the `DFunLike` instance on `characterSpace 𝕜 A` -- until the `ContinuousLinearMapClass` instance is declared @[simp, norm_cast] protected theorem coe_coe (φ : characterSpace 𝕜 A) : ⇑(φ : WeakDual 𝕜 A) = (φ : A → 𝕜) := rfl @[ext] theorem ext {φ ψ : characterSpace 𝕜 A} (h : ∀ x, φ x = ψ x) : φ = ψ := DFunLike.ext _ _ h /-- An element of the character space, as a continuous linear map. -/ def toCLM (φ : characterSpace 𝕜 A) : A →L[𝕜] 𝕜 := (φ : WeakDual 𝕜 A) @[simp] theorem coe_toCLM (φ : characterSpace 𝕜 A) : ⇑(toCLM φ) = φ := rfl /-- Elements of the character space are non-unital algebra homomorphisms. -/ instance instNonUnitalAlgHomClass : NonUnitalAlgHomClass (characterSpace 𝕜 A) 𝕜 A 𝕜 := { CharacterSpace.instContinuousLinearMapClass with map_smulₛₗ := fun φ => map_smul φ map_zero := fun φ => map_zero φ map_mul := fun φ => φ.prop.2 } /-- An element of the character space, as a non-unital algebra homomorphism. -/ def toNonUnitalAlgHom (φ : characterSpace 𝕜 A) : A →ₙₐ[𝕜] 𝕜 where toFun := (φ : A → 𝕜) map_mul' := map_mul φ map_smul' := map_smul φ map_zero' := map_zero φ map_add' := map_add φ @[simp] theorem coe_toNonUnitalAlgHom (φ : characterSpace 𝕜 A) : ⇑(toNonUnitalAlgHom φ) = φ := rfl instance instIsEmpty [Subsingleton A] : IsEmpty (characterSpace 𝕜 A) := ⟨fun φ => φ.prop.1 <| ContinuousLinearMap.ext fun x => by rw [show x = 0 from Subsingleton.elim x 0, map_zero, map_zero] ⟩ variable (𝕜 A) theorem union_zero : characterSpace 𝕜 A ∪ {0} = {φ : WeakDual 𝕜 A | ∀ x y : A, φ (x * y) = φ x * φ y} := le_antisymm (by rintro φ (hφ | rfl) · exact hφ.2 · exact fun _ _ => by exact (zero_mul (0 : 𝕜)).symm) fun φ hφ => Or.elim (em <| φ = 0) Or.inr fun h₀ => Or.inl ⟨h₀, hφ⟩ /-- The `characterSpace 𝕜 A` along with `0` is always a closed set in `WeakDual 𝕜 A`. -/ theorem union_zero_isClosed [T2Space 𝕜] [ContinuousMul 𝕜] : IsClosed (characterSpace 𝕜 A ∪ {0}) := by simp only [union_zero, Set.setOf_forall] exact isClosed_iInter fun x => isClosed_iInter fun y => isClosed_eq (eval_continuous _) <| (eval_continuous _).mul (eval_continuous _) end NonUnitalNonAssocSemiring section Unital variable [CommRing 𝕜] [NoZeroDivisors 𝕜] [TopologicalSpace 𝕜] [ContinuousAdd 𝕜] [ContinuousConstSMul 𝕜 𝕜] [TopologicalSpace A] [Semiring A] [Algebra 𝕜 A] /-- In a unital algebra, elements of the character space are algebra homomorphisms. -/ instance instAlgHomClass : AlgHomClass (characterSpace 𝕜 A) 𝕜 A 𝕜 := haveI map_one' : ∀ φ : characterSpace 𝕜 A, φ 1 = 1 := fun φ => by have h₁ : φ 1 * (1 - φ 1) = 0 := by rw [mul_sub, sub_eq_zero, mul_one, ← map_mul φ, one_mul] rcases mul_eq_zero.mp h₁ with (h₂ | h₂) · have : ∀ a, φ (a * 1) = 0 := fun a => by simp only [map_mul φ, h₂, mul_zero] exact False.elim (φ.prop.1 <| ContinuousLinearMap.ext <| by simpa only [mul_one] using this) · exact (sub_eq_zero.mp h₂).symm { CharacterSpace.instNonUnitalAlgHomClass with map_one := map_one' commutes := fun φ r => by rw [Algebra.algebraMap_eq_smul_one, Algebra.id.map_eq_id, RingHom.id_apply] rw [map_smul, Algebra.id.smul_eq_mul, map_one' φ, mul_one] } /-- An element of the character space of a unital algebra, as an algebra homomorphism. -/ @[simps] def toAlgHom (φ : characterSpace 𝕜 A) : A →ₐ[𝕜] 𝕜 := { toNonUnitalAlgHom φ with map_one' := map_one φ commutes' := AlgHomClass.commutes φ } theorem eq_set_map_one_map_mul [Nontrivial 𝕜] : characterSpace 𝕜 A = {φ : WeakDual 𝕜 A | φ 1 = 1 ∧ ∀ x y : A, φ (x * y) = φ x * φ y} := by ext φ refine ⟨?_, ?_⟩ · rintro hφ lift φ to characterSpace 𝕜 A using hφ exact ⟨map_one φ, map_mul φ⟩ · rintro ⟨hφ₁, hφ₂⟩ refine ⟨?_, hφ₂⟩ rintro rfl exact zero_ne_one hφ₁ /-- under suitable mild assumptions on `𝕜`, the character space is a closed set in `WeakDual 𝕜 A`. -/ protected theorem isClosed [Nontrivial 𝕜] [T2Space 𝕜] [ContinuousMul 𝕜] : IsClosed (characterSpace 𝕜 A) := by rw [eq_set_map_one_map_mul, Set.setOf_and] refine IsClosed.inter (isClosed_eq (eval_continuous _) continuous_const) ?_ simpa only [(union_zero 𝕜 A).symm] using union_zero_isClosed _ _ end Unital section Ring variable [CommRing 𝕜] [NoZeroDivisors 𝕜] [TopologicalSpace 𝕜] [ContinuousAdd 𝕜] [ContinuousConstSMul 𝕜 𝕜] [TopologicalSpace A] [Ring A] [Algebra 𝕜 A] theorem apply_mem_spectrum [Nontrivial 𝕜] (φ : characterSpace 𝕜 A) (a : A) : φ a ∈ spectrum 𝕜 a := AlgHom.apply_mem_spectrum φ a theorem ext_ker {φ ψ : characterSpace 𝕜 A} (h : RingHom.ker φ = RingHom.ker ψ) : φ = ψ := by ext x have : x - algebraMap 𝕜 A (ψ x) ∈ RingHom.ker φ := by simpa only [h, RingHom.mem_ker, map_sub, AlgHomClass.commutes] using sub_self (ψ x) rwa [RingHom.mem_ker, map_sub, AlgHomClass.commutes, sub_eq_zero] at this end Ring end CharacterSpace section Kernel variable [Field 𝕜] [TopologicalSpace 𝕜] [ContinuousAdd 𝕜] [ContinuousConstSMul 𝕜 𝕜] variable [Ring A] [TopologicalSpace A] [Algebra 𝕜 A] /-- The `RingHom.ker` of `φ : characterSpace 𝕜 A` is maximal. -/ instance ker_isMaximal (φ : characterSpace 𝕜 A) : (RingHom.ker φ).IsMaximal := RingHom.ker_isMaximal_of_surjective φ fun z => ⟨algebraMap 𝕜 A z, by simp only [AlgHomClass.commutes, Algebra.id.map_eq_id, RingHom.id_apply]⟩ end Kernel section GelfandTransform open ContinuousMap variable (𝕜 A) [CommRing 𝕜] [NoZeroDivisors 𝕜] [TopologicalSpace 𝕜] [TopologicalRing 𝕜] [TopologicalSpace A] [Semiring A] [Algebra 𝕜 A] /-- The **Gelfand transform** is an algebra homomorphism (over `𝕜`) from a topological `𝕜`-algebra `A` into the `𝕜`-algebra of continuous `𝕜`-valued functions on the `characterSpace 𝕜 A`. The character space itself consists of all algebra homomorphisms from `A` to `𝕜`. -/ @[simps] def gelfandTransform : A →ₐ[𝕜] C(characterSpace 𝕜 A, 𝕜) where toFun a := { toFun := fun φ => φ a continuous_toFun := (eval_continuous a).comp continuous_induced_dom } map_one' := by ext a; simp only [coe_mk, coe_one, Pi.one_apply, map_one a] map_mul' a b := by ext; simp only [map_mul, coe_mk, coe_mul, Pi.mul_apply] map_zero' := by ext; simp only [map_zero, coe_mk, coe_mul, coe_zero, Pi.zero_apply] map_add' a b := by ext; simp only [map_add, coe_mk, coe_add, Pi.add_apply] commutes' k := by ext; simp [AlgHomClass.commutes] end GelfandTransform end WeakDual
Topology\Algebra\Module\Determinant.lean
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Jan-David Salchow, Sébastien Gouëzel, Jean Lo, Yury Kudryashov, Frédéric Dupuis, Heather Macbeth -/ import Mathlib.Topology.Algebra.Module.Basic import Mathlib.LinearAlgebra.Determinant /-! # The determinant of a continuous linear map. -/ namespace ContinuousLinearMap /-- The determinant of a continuous linear map, mainly as a convenience device to be able to write `A.det` instead of `(A : M →ₗ[R] M).det`. -/ noncomputable abbrev det {R : Type*} [CommRing R] {M : Type*} [TopologicalSpace M] [AddCommGroup M] [Module R M] (A : M →L[R] M) : R := LinearMap.det (A : M →ₗ[R] M) end ContinuousLinearMap namespace ContinuousLinearEquiv @[simp] theorem det_coe_symm {R : Type*} [Field R] {M : Type*} [TopologicalSpace M] [AddCommGroup M] [Module R M] (A : M ≃L[R] M) : (A.symm : M →L[R] M).det = (A : M →L[R] M).det⁻¹ := LinearEquiv.det_coe_symm A.toLinearEquiv end ContinuousLinearEquiv
Topology\Algebra\Module\FiniteDimension.lean
/- Copyright (c) 2022 Anatole Dedecker. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel, Anatole Dedecker -/ import Mathlib.Analysis.LocallyConvex.BalancedCoreHull import Mathlib.LinearAlgebra.FreeModule.Finite.Matrix import Mathlib.Topology.Algebra.Module.Simple import Mathlib.Topology.Algebra.Module.Determinant import Mathlib.RingTheory.LocalRing.Basic /-! # Finite dimensional topological vector spaces over complete fields Let `𝕜` be a complete nontrivially normed field, and `E` a topological vector space (TVS) over `𝕜` (i.e we have `[AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] [TopologicalAddGroup E]` and `[ContinuousSMul 𝕜 E]`). If `E` is finite dimensional and Hausdorff, then all linear maps from `E` to any other TVS are continuous. When `E` is a normed space, this gets us the equivalence of norms in finite dimension. ## Main results : * `LinearMap.continuous_iff_isClosed_ker` : a linear form is continuous if and only if its kernel is closed. * `LinearMap.continuous_of_finiteDimensional` : a linear map on a finite-dimensional Hausdorff space over a complete field is continuous. ## TODO Generalize more of `Mathlib.Analysis.Normed.Module.FiniteDimension` to general TVSs. ## Implementation detail The main result from which everything follows is the fact that, if `ξ : ι → E` is a finite basis, then `ξ.equivFun : E →ₗ (ι → 𝕜)` is continuous. However, for technical reasons, it is easier to prove this when `ι` and `E` live in the same universe. So we start by doing that as a private lemma, then we deduce `LinearMap.continuous_of_finiteDimensional` from it, and then the general result follows as `continuous_equivFun_basis`. -/ universe u v w x noncomputable section open Set FiniteDimensional TopologicalSpace Filter section Field variable {𝕜 E F : Type*} [Field 𝕜] [TopologicalSpace 𝕜] [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] [AddCommGroup F] [Module 𝕜 F] [TopologicalSpace F] [TopologicalAddGroup F] [ContinuousSMul 𝕜 F] /-- The space of continuous linear maps between finite-dimensional spaces is finite-dimensional. -/ instance [FiniteDimensional 𝕜 E] [FiniteDimensional 𝕜 F] : FiniteDimensional 𝕜 (E →L[𝕜] F) := FiniteDimensional.of_injective (ContinuousLinearMap.coeLM 𝕜 : (E →L[𝕜] F) →ₗ[𝕜] E →ₗ[𝕜] F) ContinuousLinearMap.coe_injective end Field section NormedField variable {𝕜 : Type u} [hnorm : NontriviallyNormedField 𝕜] {E : Type v} [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] [TopologicalAddGroup E] [ContinuousSMul 𝕜 E] {F : Type w} [AddCommGroup F] [Module 𝕜 F] [TopologicalSpace F] [TopologicalAddGroup F] [ContinuousSMul 𝕜 F] {F' : Type x} [AddCommGroup F'] [Module 𝕜 F'] [TopologicalSpace F'] [TopologicalAddGroup F'] [ContinuousSMul 𝕜 F'] /-- If `𝕜` is a nontrivially normed field, any T2 topology on `𝕜` which makes it a topological vector space over itself (with the norm topology) is *equal* to the norm topology. -/ theorem unique_topology_of_t2 {t : TopologicalSpace 𝕜} (h₁ : @TopologicalAddGroup 𝕜 t _) (h₂ : @ContinuousSMul 𝕜 𝕜 _ hnorm.toUniformSpace.toTopologicalSpace t) (h₃ : @T2Space 𝕜 t) : t = hnorm.toUniformSpace.toTopologicalSpace := by -- Let `𝓣₀` denote the topology on `𝕜` induced by the norm, and `𝓣` be any T2 vector -- topology on `𝕜`. To show that `𝓣₀ = 𝓣`, it suffices to show that they have the same -- neighborhoods of 0. refine TopologicalAddGroup.ext h₁ inferInstance (le_antisymm ?_ ?_) · -- To show `𝓣 ≤ 𝓣₀`, we have to show that closed balls are `𝓣`-neighborhoods of 0. rw [Metric.nhds_basis_closedBall.ge_iff] -- Let `ε > 0`. Since `𝕜` is nontrivially normed, we have `0 < ‖ξ₀‖ < ε` for some `ξ₀ : 𝕜`. intro ε hε rcases NormedField.exists_norm_lt 𝕜 hε with ⟨ξ₀, hξ₀, hξ₀ε⟩ -- Since `ξ₀ ≠ 0` and `𝓣` is T2, we know that `{ξ₀}ᶜ` is a `𝓣`-neighborhood of 0. -- Porting note: added `mem_compl_singleton_iff.mpr` have : {ξ₀}ᶜ ∈ @nhds 𝕜 t 0 := IsOpen.mem_nhds isOpen_compl_singleton <| mem_compl_singleton_iff.mpr <| Ne.symm <| norm_ne_zero_iff.mp hξ₀.ne.symm -- Thus, its balanced core `𝓑` is too. Let's show that the closed ball of radius `ε` contains -- `𝓑`, which will imply that the closed ball is indeed a `𝓣`-neighborhood of 0. have : balancedCore 𝕜 {ξ₀}ᶜ ∈ @nhds 𝕜 t 0 := balancedCore_mem_nhds_zero this refine mem_of_superset this fun ξ hξ => ?_ -- Let `ξ ∈ 𝓑`. We want to show `‖ξ‖ < ε`. If `ξ = 0`, this is trivial. by_cases hξ0 : ξ = 0 · rw [hξ0] exact Metric.mem_closedBall_self hε.le · rw [mem_closedBall_zero_iff] -- Now suppose `ξ ≠ 0`. By contradiction, let's assume `ε < ‖ξ‖`, and show that -- `ξ₀ ∈ 𝓑 ⊆ {ξ₀}ᶜ`, which is a contradiction. by_contra! h suffices (ξ₀ * ξ⁻¹) • ξ ∈ balancedCore 𝕜 {ξ₀}ᶜ by rw [smul_eq_mul 𝕜, mul_assoc, inv_mul_cancel hξ0, mul_one] at this exact not_mem_compl_iff.mpr (mem_singleton ξ₀) ((balancedCore_subset _) this) -- For that, we use that `𝓑` is balanced : since `‖ξ₀‖ < ε < ‖ξ‖`, we have `‖ξ₀ / ξ‖ ≤ 1`, -- hence `ξ₀ = (ξ₀ / ξ) • ξ ∈ 𝓑` because `ξ ∈ 𝓑`. refine (balancedCore_balanced _).smul_mem ?_ hξ rw [norm_mul, norm_inv, mul_inv_le_iff (norm_pos_iff.mpr hξ0), mul_one] exact (hξ₀ε.trans h).le · -- Finally, to show `𝓣₀ ≤ 𝓣`, we simply argue that `id = (fun x ↦ x • 1)` is continuous from -- `(𝕜, 𝓣₀)` to `(𝕜, 𝓣)` because `(•) : (𝕜, 𝓣₀) × (𝕜, 𝓣) → (𝕜, 𝓣)` is continuous. calc @nhds 𝕜 hnorm.toUniformSpace.toTopologicalSpace 0 = map id (@nhds 𝕜 hnorm.toUniformSpace.toTopologicalSpace 0) := map_id.symm _ = map (fun x => id x • (1 : 𝕜)) (@nhds 𝕜 hnorm.toUniformSpace.toTopologicalSpace 0) := by conv_rhs => congr ext rw [smul_eq_mul, mul_one] _ ≤ @nhds 𝕜 t ((0 : 𝕜) • (1 : 𝕜)) := (@Tendsto.smul_const _ _ _ hnorm.toUniformSpace.toTopologicalSpace t _ _ _ _ _ tendsto_id (1 : 𝕜)) _ = @nhds 𝕜 t 0 := by rw [zero_smul] /-- Any linear form on a topological vector space over a nontrivially normed field is continuous if its kernel is closed. -/ theorem LinearMap.continuous_of_isClosed_ker (l : E →ₗ[𝕜] 𝕜) (hl : IsClosed (LinearMap.ker l : Set E)) : Continuous l := by -- `l` is either constant or surjective. If it is constant, the result is trivial. by_cases H : finrank 𝕜 (LinearMap.range l) = 0 · rw [Submodule.finrank_eq_zero, LinearMap.range_eq_bot] at H rw [H] exact continuous_zero · -- In the case where `l` is surjective, we factor it as `φ : (E ⧸ l.ker) ≃ₗ[𝕜] 𝕜`. Note that -- `E ⧸ l.ker` is T2 since `l.ker` is closed. have : finrank 𝕜 (LinearMap.range l) = 1 := le_antisymm (finrank_self 𝕜 ▸ l.range.finrank_le) (zero_lt_iff.mpr H) have hi : Function.Injective ((LinearMap.ker l).liftQ l (le_refl _)) := by rw [← LinearMap.ker_eq_bot] exact Submodule.ker_liftQ_eq_bot _ _ _ (le_refl _) have hs : Function.Surjective ((LinearMap.ker l).liftQ l (le_refl _)) := by rw [← LinearMap.range_eq_top, Submodule.range_liftQ] exact Submodule.eq_top_of_finrank_eq ((finrank_self 𝕜).symm ▸ this) let φ : (E ⧸ LinearMap.ker l) ≃ₗ[𝕜] 𝕜 := LinearEquiv.ofBijective ((LinearMap.ker l).liftQ l (le_refl _)) ⟨hi, hs⟩ have hlφ : (l : E → 𝕜) = φ ∘ (LinearMap.ker l).mkQ := by ext; rfl -- Since the quotient map `E →ₗ[𝕜] (E ⧸ l.ker)` is continuous, the continuity of `l` will follow -- form the continuity of `φ`. suffices Continuous φ.toEquiv by rw [hlφ] exact this.comp continuous_quot_mk -- The pullback by `φ.symm` of the quotient topology is a T2 topology on `𝕜`, because `φ.symm` -- is injective. Since `φ.symm` is linear, it is also a vector space topology. -- Hence, we know that it is equal to the topology induced by the norm. have : induced φ.toEquiv.symm inferInstance = hnorm.toUniformSpace.toTopologicalSpace := by refine unique_topology_of_t2 (topologicalAddGroup_induced φ.symm.toLinearMap) (continuousSMul_induced φ.symm.toLinearMap) ?_ -- Porting note: was `rw [t2Space_iff]` refine (@t2Space_iff 𝕜 (induced (↑(LinearEquiv.toEquiv φ).symm) inferInstance)).mpr ?_ exact fun x y hxy => @separated_by_continuous _ _ (induced _ _) _ _ _ continuous_induced_dom _ _ (φ.toEquiv.symm.injective.ne hxy) -- Finally, the pullback by `φ.symm` is exactly the pushforward by `φ`, so we have to prove -- that `φ` is continuous when `𝕜` is endowed with the pushforward by `φ` of the quotient -- topology, which is trivial by definition of the pushforward. rw [this.symm, Equiv.induced_symm] exact continuous_coinduced_rng /-- Any linear form on a topological vector space over a nontrivially normed field is continuous if and only if its kernel is closed. -/ theorem LinearMap.continuous_iff_isClosed_ker (l : E →ₗ[𝕜] 𝕜) : Continuous l ↔ IsClosed (LinearMap.ker l : Set E) := ⟨fun h => isClosed_singleton.preimage h, l.continuous_of_isClosed_ker⟩ /-- Over a nontrivially normed field, any linear form which is nonzero on a nonempty open set is automatically continuous. -/ theorem LinearMap.continuous_of_nonzero_on_open (l : E →ₗ[𝕜] 𝕜) (s : Set E) (hs₁ : IsOpen s) (hs₂ : s.Nonempty) (hs₃ : ∀ x ∈ s, l x ≠ 0) : Continuous l := by refine l.continuous_of_isClosed_ker (l.isClosed_or_dense_ker.resolve_right fun hl => ?_) rcases hs₂ with ⟨x, hx⟩ have : x ∈ interior (LinearMap.ker l : Set E)ᶜ := by rw [mem_interior_iff_mem_nhds] exact mem_of_superset (hs₁.mem_nhds hx) hs₃ rwa [hl.interior_compl] at this variable [CompleteSpace 𝕜] /-- This version imposes `ι` and `E` to live in the same universe, so you should instead use `continuous_equivFun_basis` which gives the same result without universe restrictions. -/ private theorem continuous_equivFun_basis_aux [T2Space E] {ι : Type v} [Fintype ι] (ξ : Basis ι 𝕜 E) : Continuous ξ.equivFun := by letI : UniformSpace E := TopologicalAddGroup.toUniformSpace E letI : UniformAddGroup E := comm_topologicalAddGroup_is_uniform induction' hn : Fintype.card ι with n IH generalizing ι E · rw [Fintype.card_eq_zero_iff] at hn exact continuous_of_const fun x y => funext hn.elim · haveI : FiniteDimensional 𝕜 E := of_fintype_basis ξ -- first step: thanks to the induction hypothesis, any n-dimensional subspace is equivalent -- to a standard space of dimension n, hence it is complete and therefore closed. have H₁ : ∀ s : Submodule 𝕜 E, finrank 𝕜 s = n → IsClosed (s : Set E) := by intro s s_dim letI : UniformAddGroup s := s.toAddSubgroup.uniformAddGroup let b := Basis.ofVectorSpace 𝕜 s have U : UniformEmbedding b.equivFun.symm.toEquiv := by have : Fintype.card (Basis.ofVectorSpaceIndex 𝕜 s) = n := by rw [← s_dim] exact (finrank_eq_card_basis b).symm have : Continuous b.equivFun := IH b this exact b.equivFun.symm.uniformEmbedding b.equivFun.symm.toLinearMap.continuous_on_pi this have : IsComplete (s : Set E) := completeSpace_coe_iff_isComplete.1 ((completeSpace_congr U).1 (by infer_instance)) exact this.isClosed -- second step: any linear form is continuous, as its kernel is closed by the first step have H₂ : ∀ f : E →ₗ[𝕜] 𝕜, Continuous f := by intro f by_cases H : finrank 𝕜 (LinearMap.range f) = 0 · rw [Submodule.finrank_eq_zero, LinearMap.range_eq_bot] at H rw [H] exact continuous_zero · have : finrank 𝕜 (LinearMap.ker f) = n := by have Z := f.finrank_range_add_finrank_ker rw [finrank_eq_card_basis ξ, hn] at Z have : finrank 𝕜 (LinearMap.range f) = 1 := le_antisymm (finrank_self 𝕜 ▸ f.range.finrank_le) (zero_lt_iff.mpr H) rw [this, add_comm, Nat.add_one] at Z exact Nat.succ.inj Z have : IsClosed (LinearMap.ker f : Set E) := H₁ _ this exact LinearMap.continuous_of_isClosed_ker f this rw [continuous_pi_iff] intro i change Continuous (ξ.coord i) exact H₂ (ξ.coord i) /-- Any linear map on a finite dimensional space over a complete field is continuous. -/ theorem LinearMap.continuous_of_finiteDimensional [T2Space E] [FiniteDimensional 𝕜 E] (f : E →ₗ[𝕜] F') : Continuous f := by -- for the proof, go to a model vector space `b → 𝕜` thanks to `continuous_equivFun_basis`, and -- argue that all linear maps there are continuous. let b := Basis.ofVectorSpace 𝕜 E have A : Continuous b.equivFun := continuous_equivFun_basis_aux b have B : Continuous (f.comp (b.equivFun.symm : (Basis.ofVectorSpaceIndex 𝕜 E → 𝕜) →ₗ[𝕜] E)) := LinearMap.continuous_on_pi _ have : Continuous (f.comp (b.equivFun.symm : (Basis.ofVectorSpaceIndex 𝕜 E → 𝕜) →ₗ[𝕜] E) ∘ b.equivFun) := B.comp A convert this ext x dsimp rw [Basis.equivFun_symm_apply, Basis.sum_repr] instance LinearMap.continuousLinearMapClassOfFiniteDimensional [T2Space E] [FiniteDimensional 𝕜 E] : ContinuousLinearMapClass (E →ₗ[𝕜] F') 𝕜 E F' := { LinearMap.semilinearMapClass with map_continuous := fun f => f.continuous_of_finiteDimensional } /-- In finite dimensions over a non-discrete complete normed field, the canonical identification (in terms of a basis) with `𝕜^n` (endowed with the product topology) is continuous. This is the key fact which makes all linear maps from a T2 finite dimensional TVS over such a field continuous (see `LinearMap.continuous_of_finiteDimensional`), which in turn implies that all norms are equivalent in finite dimensions. -/ theorem continuous_equivFun_basis [T2Space E] {ι : Type*} [Finite ι] (ξ : Basis ι 𝕜 E) : Continuous ξ.equivFun := haveI : FiniteDimensional 𝕜 E := of_fintype_basis ξ ξ.equivFun.toLinearMap.continuous_of_finiteDimensional namespace LinearMap variable [T2Space E] [FiniteDimensional 𝕜 E] /-- The continuous linear map induced by a linear map on a finite dimensional space -/ def toContinuousLinearMap : (E →ₗ[𝕜] F') ≃ₗ[𝕜] E →L[𝕜] F' where toFun f := ⟨f, f.continuous_of_finiteDimensional⟩ invFun := (↑) map_add' _ _ := rfl map_smul' _ _ := rfl left_inv _ := rfl right_inv _ := ContinuousLinearMap.coe_injective rfl /-- Algebra equivalence between the linear maps and continuous linear maps on a finite dimensional space. -/ def _root_.Module.End.toContinuousLinearMap (E : Type v) [NormedAddCommGroup E] [NormedSpace 𝕜 E] [FiniteDimensional 𝕜 E] : (E →ₗ[𝕜] E) ≃ₐ[𝕜] (E →L[𝕜] E) := { LinearMap.toContinuousLinearMap with map_mul' := fun _ _ ↦ rfl commutes' := fun _ ↦ rfl } @[simp] theorem coe_toContinuousLinearMap' (f : E →ₗ[𝕜] F') : ⇑(LinearMap.toContinuousLinearMap f) = f := rfl @[simp] theorem coe_toContinuousLinearMap (f : E →ₗ[𝕜] F') : ((LinearMap.toContinuousLinearMap f) : E →ₗ[𝕜] F') = f := rfl @[simp] theorem coe_toContinuousLinearMap_symm : ⇑(toContinuousLinearMap : (E →ₗ[𝕜] F') ≃ₗ[𝕜] E →L[𝕜] F').symm = ((↑) : (E →L[𝕜] F') → E →ₗ[𝕜] F') := rfl @[simp] theorem det_toContinuousLinearMap (f : E →ₗ[𝕜] E) : (LinearMap.toContinuousLinearMap f).det = LinearMap.det f := rfl @[simp] theorem ker_toContinuousLinearMap (f : E →ₗ[𝕜] F') : ker (LinearMap.toContinuousLinearMap f) = ker f := rfl @[simp] theorem range_toContinuousLinearMap (f : E →ₗ[𝕜] F') : range (LinearMap.toContinuousLinearMap f) = range f := rfl /-- A surjective linear map `f` with finite dimensional codomain is an open map. -/ theorem isOpenMap_of_finiteDimensional (f : F →ₗ[𝕜] E) (hf : Function.Surjective f) : IsOpenMap f := by rcases f.exists_rightInverse_of_surjective (LinearMap.range_eq_top.2 hf) with ⟨g, hg⟩ refine IsOpenMap.of_sections fun x => ⟨fun y => g (y - f x) + x, ?_, ?_, fun y => ?_⟩ · exact ((g.continuous_of_finiteDimensional.comp <| continuous_id.sub continuous_const).add continuous_const).continuousAt · simp only rw [sub_self, map_zero, zero_add] · simp only [map_sub, map_add, ← comp_apply f g, hg, id_apply, sub_add_cancel] instance canLiftContinuousLinearMap : CanLift (E →ₗ[𝕜] F) (E →L[𝕜] F) (↑) fun _ => True := ⟨fun f _ => ⟨LinearMap.toContinuousLinearMap f, rfl⟩⟩ end LinearMap section variable [T2Space E] [T2Space F] [FiniteDimensional 𝕜 E] namespace LinearEquiv /-- The continuous linear equivalence induced by a linear equivalence on a finite dimensional space. -/ def toContinuousLinearEquiv (e : E ≃ₗ[𝕜] F) : E ≃L[𝕜] F := { e with continuous_toFun := e.toLinearMap.continuous_of_finiteDimensional continuous_invFun := haveI : FiniteDimensional 𝕜 F := e.finiteDimensional e.symm.toLinearMap.continuous_of_finiteDimensional } @[simp] theorem coe_toContinuousLinearEquiv (e : E ≃ₗ[𝕜] F) : (e.toContinuousLinearEquiv : E →ₗ[𝕜] F) = e := rfl @[simp] theorem coe_toContinuousLinearEquiv' (e : E ≃ₗ[𝕜] F) : (e.toContinuousLinearEquiv : E → F) = e := rfl @[simp] theorem coe_toContinuousLinearEquiv_symm (e : E ≃ₗ[𝕜] F) : (e.toContinuousLinearEquiv.symm : F →ₗ[𝕜] E) = e.symm := rfl @[simp] theorem coe_toContinuousLinearEquiv_symm' (e : E ≃ₗ[𝕜] F) : (e.toContinuousLinearEquiv.symm : F → E) = e.symm := rfl @[simp] theorem toLinearEquiv_toContinuousLinearEquiv (e : E ≃ₗ[𝕜] F) : e.toContinuousLinearEquiv.toLinearEquiv = e := by ext x rfl -- Porting note (#10618): @[simp] can prove this theorem toLinearEquiv_toContinuousLinearEquiv_symm (e : E ≃ₗ[𝕜] F) : e.toContinuousLinearEquiv.symm.toLinearEquiv = e.symm := by ext x rfl instance canLiftContinuousLinearEquiv : CanLift (E ≃ₗ[𝕜] F) (E ≃L[𝕜] F) ContinuousLinearEquiv.toLinearEquiv fun _ => True := ⟨fun f _ => ⟨_, f.toLinearEquiv_toContinuousLinearEquiv⟩⟩ end LinearEquiv variable [FiniteDimensional 𝕜 F] /-- Two finite-dimensional topological vector spaces over a complete normed field are continuously linearly equivalent if they have the same (finite) dimension. -/ theorem FiniteDimensional.nonempty_continuousLinearEquiv_of_finrank_eq (cond : finrank 𝕜 E = finrank 𝕜 F) : Nonempty (E ≃L[𝕜] F) := (nonempty_linearEquiv_of_finrank_eq cond).map LinearEquiv.toContinuousLinearEquiv /-- Two finite-dimensional topological vector spaces over a complete normed field are continuously linearly equivalent if and only if they have the same (finite) dimension. -/ theorem FiniteDimensional.nonempty_continuousLinearEquiv_iff_finrank_eq : Nonempty (E ≃L[𝕜] F) ↔ finrank 𝕜 E = finrank 𝕜 F := ⟨fun ⟨h⟩ => h.toLinearEquiv.finrank_eq, fun h => FiniteDimensional.nonempty_continuousLinearEquiv_of_finrank_eq h⟩ /-- A continuous linear equivalence between two finite-dimensional topological vector spaces over a complete normed field of the same (finite) dimension. -/ def ContinuousLinearEquiv.ofFinrankEq (cond : finrank 𝕜 E = finrank 𝕜 F) : E ≃L[𝕜] F := (LinearEquiv.ofFinrankEq E F cond).toContinuousLinearEquiv end namespace Basis variable {ι : Type*} [Finite ι] [T2Space E] /-- Construct a continuous linear map given the value at a finite basis. -/ def constrL (v : Basis ι 𝕜 E) (f : ι → F) : E →L[𝕜] F := haveI : FiniteDimensional 𝕜 E := FiniteDimensional.of_fintype_basis v LinearMap.toContinuousLinearMap (v.constr 𝕜 f) @[simp] -- Porting note: removed `norm_cast` theorem coe_constrL (v : Basis ι 𝕜 E) (f : ι → F) : (v.constrL f : E →ₗ[𝕜] F) = v.constr 𝕜 f := rfl /-- The continuous linear equivalence between a vector space over `𝕜` with a finite basis and functions from its basis indexing type to `𝕜`. -/ @[simps! apply] def equivFunL (v : Basis ι 𝕜 E) : E ≃L[𝕜] ι → 𝕜 := { v.equivFun with continuous_toFun := haveI : FiniteDimensional 𝕜 E := FiniteDimensional.of_fintype_basis v v.equivFun.toLinearMap.continuous_of_finiteDimensional continuous_invFun := by change Continuous v.equivFun.symm.toFun exact v.equivFun.symm.toLinearMap.continuous_of_finiteDimensional } @[simp] lemma equivFunL_symm_apply_repr (v : Basis ι 𝕜 E) (x : E) : v.equivFunL.symm (v.repr x) = x := v.equivFunL.symm_apply_apply x @[simp] theorem constrL_apply {ι : Type*} [Fintype ι] (v : Basis ι 𝕜 E) (f : ι → F) (e : E) : v.constrL f e = ∑ i, v.equivFun e i • f i := v.constr_apply_fintype 𝕜 _ _ @[simp 1100] theorem constrL_basis (v : Basis ι 𝕜 E) (f : ι → F) (i : ι) : v.constrL f (v i) = f i := v.constr_basis 𝕜 _ _ end Basis namespace ContinuousLinearMap variable [T2Space E] [FiniteDimensional 𝕜 E] /-- Builds a continuous linear equivalence from a continuous linear map on a finite-dimensional vector space whose determinant is nonzero. -/ def toContinuousLinearEquivOfDetNeZero (f : E →L[𝕜] E) (hf : f.det ≠ 0) : E ≃L[𝕜] E := ((f : E →ₗ[𝕜] E).equivOfDetNeZero hf).toContinuousLinearEquiv @[simp] theorem coe_toContinuousLinearEquivOfDetNeZero (f : E →L[𝕜] E) (hf : f.det ≠ 0) : (f.toContinuousLinearEquivOfDetNeZero hf : E →L[𝕜] E) = f := by ext x rfl @[simp] theorem toContinuousLinearEquivOfDetNeZero_apply (f : E →L[𝕜] E) (hf : f.det ≠ 0) (x : E) : f.toContinuousLinearEquivOfDetNeZero hf x = f x := rfl theorem _root_.Matrix.toLin_finTwoProd_toContinuousLinearMap (a b c d : 𝕜) : LinearMap.toContinuousLinearMap (Matrix.toLin (Basis.finTwoProd 𝕜) (Basis.finTwoProd 𝕜) !![a, b; c, d]) = (a • ContinuousLinearMap.fst 𝕜 𝕜 𝕜 + b • ContinuousLinearMap.snd 𝕜 𝕜 𝕜).prod (c • ContinuousLinearMap.fst 𝕜 𝕜 𝕜 + d • ContinuousLinearMap.snd 𝕜 𝕜 𝕜) := ContinuousLinearMap.ext <| Matrix.toLin_finTwoProd_apply _ _ _ _ end ContinuousLinearMap end NormedField section UniformAddGroup variable (𝕜 E : Type*) [NontriviallyNormedField 𝕜] [CompleteSpace 𝕜] [AddCommGroup E] [UniformSpace E] [T2Space E] [UniformAddGroup E] [Module 𝕜 E] [ContinuousSMul 𝕜 E] [FiniteDimensional 𝕜 E] theorem FiniteDimensional.complete : CompleteSpace E := by set e := ContinuousLinearEquiv.ofFinrankEq (@finrank_fin_fun 𝕜 _ _ (finrank 𝕜 E)).symm have : UniformEmbedding e.toLinearEquiv.toEquiv.symm := e.symm.uniformEmbedding exact (completeSpace_congr this).1 (by infer_instance) variable {𝕜 E} /-- A finite-dimensional subspace is complete. -/ theorem Submodule.complete_of_finiteDimensional (s : Submodule 𝕜 E) [FiniteDimensional 𝕜 s] : IsComplete (s : Set E) := haveI : UniformAddGroup s := s.toAddSubgroup.uniformAddGroup completeSpace_coe_iff_isComplete.1 (FiniteDimensional.complete 𝕜 s) end UniformAddGroup variable {𝕜 E F : Type*} [NontriviallyNormedField 𝕜] [CompleteSpace 𝕜] [AddCommGroup E] [TopologicalSpace E] [T2Space E] [TopologicalAddGroup E] [Module 𝕜 E] [ContinuousSMul 𝕜 E] [AddCommGroup F] [TopologicalSpace F] [T2Space F] [TopologicalAddGroup F] [Module 𝕜 F] [ContinuousSMul 𝕜 F] /-- A finite-dimensional subspace is closed. -/ theorem Submodule.closed_of_finiteDimensional (s : Submodule 𝕜 E) [FiniteDimensional 𝕜 s] : IsClosed (s : Set E) := letI := TopologicalAddGroup.toUniformSpace E haveI : UniformAddGroup E := comm_topologicalAddGroup_is_uniform s.complete_of_finiteDimensional.isClosed /-- An injective linear map with finite-dimensional domain is a closed embedding. -/ theorem LinearMap.closedEmbedding_of_injective [FiniteDimensional 𝕜 E] {f : E →ₗ[𝕜] F} (hf : LinearMap.ker f = ⊥) : ClosedEmbedding f := let g := LinearEquiv.ofInjective f (LinearMap.ker_eq_bot.mp hf) { embedding_subtype_val.comp g.toContinuousLinearEquiv.toHomeomorph.embedding with isClosed_range := by haveI := f.finiteDimensional_range simpa [LinearMap.range_coe f] using f.range.closed_of_finiteDimensional } theorem closedEmbedding_smul_left {c : E} (hc : c ≠ 0) : ClosedEmbedding fun x : 𝕜 => x • c := LinearMap.closedEmbedding_of_injective (LinearMap.ker_toSpanSingleton 𝕜 E hc) -- `smul` is a closed map in the first argument. theorem isClosedMap_smul_left (c : E) : IsClosedMap fun x : 𝕜 => x • c := by by_cases hc : c = 0 · simp_rw [hc, smul_zero] exact isClosedMap_const · exact (closedEmbedding_smul_left hc).isClosedMap theorem ContinuousLinearMap.exists_right_inverse_of_surjective [FiniteDimensional 𝕜 F] (f : E →L[𝕜] F) (hf : LinearMap.range f = ⊤) : ∃ g : F →L[𝕜] E, f.comp g = ContinuousLinearMap.id 𝕜 F := let ⟨g, hg⟩ := (f : E →ₗ[𝕜] F).exists_rightInverse_of_surjective hf ⟨LinearMap.toContinuousLinearMap g, ContinuousLinearMap.coe_inj.1 hg⟩
Topology\Algebra\Module\LinearPMap.lean
/- Copyright (c) 2022 Moritz Doll. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Moritz Doll -/ import Mathlib.LinearAlgebra.LinearPMap import Mathlib.Topology.Algebra.Module.Basic /-! # Partially defined linear operators over topological vector spaces We define basic notions of partially defined linear operators, which we call unbounded operators for short. In this file we prove all elementary properties of unbounded operators that do not assume that the underlying spaces are normed. ## Main definitions * `LinearPMap.IsClosed`: An unbounded operator is closed iff its graph is closed. * `LinearPMap.IsClosable`: An unbounded operator is closable iff the closure of its graph is a graph. * `LinearPMap.closure`: For a closable unbounded operator `f : LinearPMap R E F` the closure is the smallest closed extension of `f`. If `f` is not closable, then `f.closure` is defined as `f`. * `LinearPMap.HasCore`: a submodule contained in the domain is a core if restricting to the core does not lose information about the unbounded operator. ## Main statements * `LinearPMap.closable_iff_exists_closed_extension`: an unbounded operator is closable iff it has a closed extension. * `LinearPMap.closable.exists_unique`: there exists a unique closure * `LinearPMap.closureHasCore`: the domain of `f` is a core of its closure ## References * [J. Weidmann, *Linear Operators in Hilbert Spaces*][weidmann_linear] ## Tags Unbounded operators, closed operators -/ open Topology variable {R E F : Type*} variable [CommRing R] [AddCommGroup E] [AddCommGroup F] variable [Module R E] [Module R F] variable [TopologicalSpace E] [TopologicalSpace F] namespace LinearPMap /-! ### Closed and closable operators -/ /-- An unbounded operator is closed iff its graph is closed. -/ def IsClosed (f : E →ₗ.[R] F) : Prop := _root_.IsClosed (f.graph : Set (E × F)) variable [ContinuousAdd E] [ContinuousAdd F] variable [TopologicalSpace R] [ContinuousSMul R E] [ContinuousSMul R F] /-- An unbounded operator is closable iff the closure of its graph is a graph. -/ def IsClosable (f : E →ₗ.[R] F) : Prop := ∃ f' : LinearPMap R E F, f.graph.topologicalClosure = f'.graph /-- A closed operator is trivially closable. -/ theorem IsClosed.isClosable {f : E →ₗ.[R] F} (hf : f.IsClosed) : f.IsClosable := ⟨f, hf.submodule_topologicalClosure_eq⟩ /-- If `g` has a closable extension `f`, then `g` itself is closable. -/ theorem IsClosable.leIsClosable {f g : E →ₗ.[R] F} (hf : f.IsClosable) (hfg : g ≤ f) : g.IsClosable := by cases' hf with f' hf have : g.graph.topologicalClosure ≤ f'.graph := by rw [← hf] exact Submodule.topologicalClosure_mono (le_graph_of_le hfg) use g.graph.topologicalClosure.toLinearPMap rw [Submodule.toLinearPMap_graph_eq] exact fun _ hx hx' => f'.graph_fst_eq_zero_snd (this hx) hx' /-- The closure is unique. -/ theorem IsClosable.existsUnique {f : E →ₗ.[R] F} (hf : f.IsClosable) : ∃! f' : E →ₗ.[R] F, f.graph.topologicalClosure = f'.graph := by refine exists_unique_of_exists_of_unique hf fun _ _ hy₁ hy₂ => eq_of_eq_graph ?_ rw [← hy₁, ← hy₂] open scoped Classical /-- If `f` is closable, then `f.closure` is the closure. Otherwise it is defined as `f.closure = f`. -/ noncomputable def closure (f : E →ₗ.[R] F) : E →ₗ.[R] F := if hf : f.IsClosable then hf.choose else f theorem closure_def {f : E →ₗ.[R] F} (hf : f.IsClosable) : f.closure = hf.choose := by simp [closure, hf] theorem closure_def' {f : E →ₗ.[R] F} (hf : ¬f.IsClosable) : f.closure = f := by simp [closure, hf] /-- The closure (as a submodule) of the graph is equal to the graph of the closure (as a `LinearPMap`). -/ theorem IsClosable.graph_closure_eq_closure_graph {f : E →ₗ.[R] F} (hf : f.IsClosable) : f.graph.topologicalClosure = f.closure.graph := by rw [closure_def hf] exact hf.choose_spec /-- A `LinearPMap` is contained in its closure. -/ theorem le_closure (f : E →ₗ.[R] F) : f ≤ f.closure := by by_cases hf : f.IsClosable · refine le_of_le_graph ?_ rw [← hf.graph_closure_eq_closure_graph] exact (graph f).le_topologicalClosure rw [closure_def' hf] theorem IsClosable.closure_mono {f g : E →ₗ.[R] F} (hg : g.IsClosable) (h : f ≤ g) : f.closure ≤ g.closure := by refine le_of_le_graph ?_ rw [← (hg.leIsClosable h).graph_closure_eq_closure_graph] rw [← hg.graph_closure_eq_closure_graph] exact Submodule.topologicalClosure_mono (le_graph_of_le h) /-- If `f` is closable, then the closure is closed. -/ theorem IsClosable.closure_isClosed {f : E →ₗ.[R] F} (hf : f.IsClosable) : f.closure.IsClosed := by rw [IsClosed, ← hf.graph_closure_eq_closure_graph] exact f.graph.isClosed_topologicalClosure /-- If `f` is closable, then the closure is closable. -/ theorem IsClosable.closureIsClosable {f : E →ₗ.[R] F} (hf : f.IsClosable) : f.closure.IsClosable := hf.closure_isClosed.isClosable theorem isClosable_iff_exists_closed_extension {f : E →ₗ.[R] F} : f.IsClosable ↔ ∃ g : E →ₗ.[R] F, g.IsClosed ∧ f ≤ g := ⟨fun h => ⟨f.closure, h.closure_isClosed, f.le_closure⟩, fun ⟨_, hg, h⟩ => hg.isClosable.leIsClosable h⟩ /-! ### The core of a linear operator -/ /-- A submodule `S` is a core of `f` if the closure of the restriction of `f` to `S` is `f`. -/ structure HasCore (f : E →ₗ.[R] F) (S : Submodule R E) : Prop where le_domain : S ≤ f.domain closure_eq : (f.domRestrict S).closure = f theorem hasCore_def {f : E →ₗ.[R] F} {S : Submodule R E} (h : f.HasCore S) : (f.domRestrict S).closure = f := h.2 /-- For every unbounded operator `f` the submodule `f.domain` is a core of its closure. Note that we don't require that `f` is closable, due to the definition of the closure. -/ theorem closureHasCore (f : E →ₗ.[R] F) : f.closure.HasCore f.domain := by refine ⟨f.le_closure.1, ?_⟩ congr ext x y hxy · simp only [domRestrict_domain, Submodule.mem_inf, and_iff_left_iff_imp] intro hx exact f.le_closure.1 hx let z : f.closure.domain := ⟨y.1, f.le_closure.1 y.2⟩ have hyz : (y : E) = z := by simp rw [f.le_closure.2 hyz] exact domRestrict_apply (hxy.trans hyz) /-! ### Topological properties of the inverse -/ section Inverse variable {f : E →ₗ.[R] F} /-- If `f` is invertible and closable as well as its closure being invertible, then the graph of the inverse of the closure is given by the closure of the graph of the inverse. -/ theorem closure_inverse_graph (hf : LinearMap.ker f.toFun = ⊥) (hf' : f.IsClosable) (hcf : LinearMap.ker f.closure.toFun = ⊥) : f.closure.inverse.graph = f.inverse.graph.topologicalClosure := by rw [inverse_graph hf, inverse_graph hcf, ← hf'.graph_closure_eq_closure_graph] apply SetLike.ext' simp only [Submodule.topologicalClosure_coe, Submodule.map_coe, LinearEquiv.prodComm_apply] apply (image_closure_subset_closure_image continuous_swap).antisymm have h1 := Set.image_equiv_eq_preimage_symm f.graph (LinearEquiv.prodComm R E F).toEquiv have h2 := Set.image_equiv_eq_preimage_symm (_root_.closure f.graph) (LinearEquiv.prodComm R E F).toEquiv simp only [LinearEquiv.coe_toEquiv, LinearEquiv.prodComm_apply, LinearEquiv.coe_toEquiv_symm] at h1 h2 rw [h1, h2] apply continuous_swap.closure_preimage_subset /-- Assuming that `f` is invertible and closable, then the closure is invertible if and only if the inverse of `f` is closable. -/ theorem inverse_isClosable_iff (hf : LinearMap.ker f.toFun = ⊥) (hf' : f.IsClosable) : f.inverse.IsClosable ↔ LinearMap.ker f.closure.toFun = ⊥ := by constructor · intro ⟨f', h⟩ rw [LinearMap.ker_eq_bot'] intro ⟨x, hx⟩ hx' simp only [Submodule.mk_eq_zero] rw [toFun_eq_coe, eq_comm, image_iff] at hx' have : (0, x) ∈ graph f' := by rw [← h, inverse_graph hf] rw [← hf'.graph_closure_eq_closure_graph, ← SetLike.mem_coe, Submodule.topologicalClosure_coe] at hx' apply image_closure_subset_closure_image continuous_swap simp only [Set.mem_image, Prod.exists, Prod.swap_prod_mk, Prod.mk.injEq] exact ⟨x, 0, hx', rfl, rfl⟩ exact graph_fst_eq_zero_snd f' this rfl · intro h use f.closure.inverse exact (closure_inverse_graph hf hf' h).symm /-- If `f` is invertible and closable, then taking the closure and the inverse commute. -/ theorem inverse_closure (hf : LinearMap.ker f.toFun = ⊥) (hf' : f.IsClosable) (hcf : LinearMap.ker f.closure.toFun = ⊥) : f.inverse.closure = f.closure.inverse := by apply eq_of_eq_graph rw [closure_inverse_graph hf hf' hcf, ((inverse_isClosable_iff hf hf').mpr hcf).graph_closure_eq_closure_graph] end Inverse end LinearPMap
Topology\Algebra\Module\LocallyConvex.lean
/- Copyright (c) 2022 Anatole Dedecker. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Anatole Dedecker -/ import Mathlib.Analysis.Convex.Topology /-! # Locally convex topological modules A `LocallyConvexSpace` is a topological semimodule over an ordered semiring in which any point admits a neighborhood basis made of convex sets, or equivalently, in which convex neighborhoods of a point form a neighborhood basis at that point. In a module, this is equivalent to `0` satisfying such properties. ## Main results - `locallyConvexSpace_iff_zero` : in a module, local convexity at zero gives local convexity everywhere - `WithSeminorms.locallyConvexSpace` : a topology generated by a family of seminorms is locally convex (in `Analysis.LocallyConvex.WithSeminorms`) - `NormedSpace.locallyConvexSpace` : a normed space is locally convex (in `Analysis.LocallyConvex.WithSeminorms`) ## TODO - define a structure `LocallyConvexFilterBasis`, extending `ModuleFilterBasis`, for filter bases generating a locally convex topology -/ open TopologicalSpace Filter Set open Topology Pointwise section Semimodule /-- A `LocallyConvexSpace` is a topological semimodule over an ordered semiring in which convex neighborhoods of a point form a neighborhood basis at that point. -/ class LocallyConvexSpace (𝕜 E : Type*) [OrderedSemiring 𝕜] [AddCommMonoid E] [Module 𝕜 E] [TopologicalSpace E] : Prop where convex_basis : ∀ x : E, (𝓝 x).HasBasis (fun s : Set E => s ∈ 𝓝 x ∧ Convex 𝕜 s) id variable (𝕜 E : Type*) [OrderedSemiring 𝕜] [AddCommMonoid E] [Module 𝕜 E] [TopologicalSpace E] theorem locallyConvexSpace_iff : LocallyConvexSpace 𝕜 E ↔ ∀ x : E, (𝓝 x).HasBasis (fun s : Set E => s ∈ 𝓝 x ∧ Convex 𝕜 s) id := ⟨@LocallyConvexSpace.convex_basis _ _ _ _ _ _, LocallyConvexSpace.mk⟩ theorem LocallyConvexSpace.ofBases {ι : Type*} (b : E → ι → Set E) (p : E → ι → Prop) (hbasis : ∀ x : E, (𝓝 x).HasBasis (p x) (b x)) (hconvex : ∀ x i, p x i → Convex 𝕜 (b x i)) : LocallyConvexSpace 𝕜 E := ⟨fun x => (hbasis x).to_hasBasis (fun i hi => ⟨b x i, ⟨⟨(hbasis x).mem_of_mem hi, hconvex x i hi⟩, le_refl (b x i)⟩⟩) fun s hs => ⟨(hbasis x).index s hs.1, ⟨(hbasis x).property_index hs.1, (hbasis x).set_index_subset hs.1⟩⟩⟩ theorem LocallyConvexSpace.convex_basis_zero [LocallyConvexSpace 𝕜 E] : (𝓝 0 : Filter E).HasBasis (fun s => s ∈ (𝓝 0 : Filter E) ∧ Convex 𝕜 s) id := LocallyConvexSpace.convex_basis 0 theorem locallyConvexSpace_iff_exists_convex_subset : LocallyConvexSpace 𝕜 E ↔ ∀ x : E, ∀ U ∈ 𝓝 x, ∃ S ∈ 𝓝 x, Convex 𝕜 S ∧ S ⊆ U := (locallyConvexSpace_iff 𝕜 E).trans (forall_congr' fun _ => hasBasis_self) end Semimodule section Module variable (𝕜 E : Type*) [OrderedSemiring 𝕜] [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] [TopologicalAddGroup E] theorem LocallyConvexSpace.ofBasisZero {ι : Type*} (b : ι → Set E) (p : ι → Prop) (hbasis : (𝓝 0).HasBasis p b) (hconvex : ∀ i, p i → Convex 𝕜 (b i)) : LocallyConvexSpace 𝕜 E := by refine LocallyConvexSpace.ofBases 𝕜 E (fun (x : E) (i : ι) => (x + ·) '' b i) (fun _ => p) (fun x => ?_) fun x i hi => (hconvex i hi).translate x rw [← map_add_left_nhds_zero] exact hbasis.map _ theorem locallyConvexSpace_iff_zero : LocallyConvexSpace 𝕜 E ↔ (𝓝 0 : Filter E).HasBasis (fun s : Set E => s ∈ (𝓝 0 : Filter E) ∧ Convex 𝕜 s) id := ⟨fun h => @LocallyConvexSpace.convex_basis _ _ _ _ _ _ h 0, fun h => LocallyConvexSpace.ofBasisZero 𝕜 E _ _ h fun _ => And.right⟩ theorem locallyConvexSpace_iff_exists_convex_subset_zero : LocallyConvexSpace 𝕜 E ↔ ∀ U ∈ (𝓝 0 : Filter E), ∃ S ∈ (𝓝 0 : Filter E), Convex 𝕜 S ∧ S ⊆ U := (locallyConvexSpace_iff_zero 𝕜 E).trans hasBasis_self -- see Note [lower instance priority] instance (priority := 100) LocallyConvexSpace.toLocallyConnectedSpace [Module ℝ E] [ContinuousSMul ℝ E] [LocallyConvexSpace ℝ E] : LocallyConnectedSpace E := locallyConnectedSpace_of_connected_bases _ _ (fun x => @LocallyConvexSpace.convex_basis ℝ _ _ _ _ _ _ x) fun _ _ hs => hs.2.isPreconnected end Module section LinearOrderedField variable (𝕜 E : Type*) [LinearOrderedField 𝕜] [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] [TopologicalAddGroup E] [ContinuousConstSMul 𝕜 E] theorem LocallyConvexSpace.convex_open_basis_zero [LocallyConvexSpace 𝕜 E] : (𝓝 0 : Filter E).HasBasis (fun s => (0 : E) ∈ s ∧ IsOpen s ∧ Convex 𝕜 s) id := (LocallyConvexSpace.convex_basis_zero 𝕜 E).to_hasBasis (fun s hs => ⟨interior s, ⟨mem_interior_iff_mem_nhds.mpr hs.1, isOpen_interior, hs.2.interior⟩, interior_subset⟩) fun s hs => ⟨s, ⟨hs.2.1.mem_nhds hs.1, hs.2.2⟩, subset_rfl⟩ variable {𝕜 E} /-- In a locally convex space, if `s`, `t` are disjoint convex sets, `s` is compact and `t` is closed, then we can find open disjoint convex sets containing them. -/ theorem Disjoint.exists_open_convexes [LocallyConvexSpace 𝕜 E] {s t : Set E} (disj : Disjoint s t) (hs₁ : Convex 𝕜 s) (hs₂ : IsCompact s) (ht₁ : Convex 𝕜 t) (ht₂ : IsClosed t) : ∃ u v, IsOpen u ∧ IsOpen v ∧ Convex 𝕜 u ∧ Convex 𝕜 v ∧ s ⊆ u ∧ t ⊆ v ∧ Disjoint u v := by letI : UniformSpace E := TopologicalAddGroup.toUniformSpace E haveI : UniformAddGroup E := comm_topologicalAddGroup_is_uniform have := (LocallyConvexSpace.convex_open_basis_zero 𝕜 E).comap fun x : E × E => x.2 - x.1 rw [← uniformity_eq_comap_nhds_zero] at this rcases disj.exists_uniform_thickening_of_basis this hs₂ ht₂ with ⟨V, ⟨hV0, hVopen, hVconvex⟩, hV⟩ refine ⟨s + V, t + V, hVopen.add_left, hVopen.add_left, hs₁.add hVconvex, ht₁.add hVconvex, subset_add_left _ hV0, subset_add_left _ hV0, ?_⟩ simp_rw [← iUnion_add_left_image, image_add_left] simp_rw [UniformSpace.ball, ← preimage_comp, sub_eq_neg_add] at hV exact hV end LinearOrderedField section LatticeOps variable {ι : Sort*} {𝕜 E F : Type*} [OrderedSemiring 𝕜] [AddCommMonoid E] [Module 𝕜 E] [AddCommMonoid F] [Module 𝕜 F] theorem locallyConvexSpace_sInf {ts : Set (TopologicalSpace E)} (h : ∀ t ∈ ts, @LocallyConvexSpace 𝕜 E _ _ _ t) : @LocallyConvexSpace 𝕜 E _ _ _ (sInf ts) := by letI : TopologicalSpace E := sInf ts refine LocallyConvexSpace.ofBases 𝕜 E (fun _ => fun If : Set ts × (ts → Set E) => ⋂ i ∈ If.1, If.2 i) (fun x => fun If : Set ts × (ts → Set E) => If.1.Finite ∧ ∀ i ∈ If.1, If.2 i ∈ @nhds _ (↑i) x ∧ Convex 𝕜 (If.2 i)) (fun x => ?_) fun x If hif => convex_iInter fun i => convex_iInter fun hi => (hif.2 i hi).2 rw [nhds_sInf, ← iInf_subtype''] exact hasBasis_iInf' fun i : ts => (@locallyConvexSpace_iff 𝕜 E _ _ _ ↑i).mp (h (↑i) i.2) x theorem locallyConvexSpace_iInf {ts' : ι → TopologicalSpace E} (h' : ∀ i, @LocallyConvexSpace 𝕜 E _ _ _ (ts' i)) : @LocallyConvexSpace 𝕜 E _ _ _ (⨅ i, ts' i) := by refine locallyConvexSpace_sInf ?_ rwa [forall_mem_range] theorem locallyConvexSpace_inf {t₁ t₂ : TopologicalSpace E} (h₁ : @LocallyConvexSpace 𝕜 E _ _ _ t₁) (h₂ : @LocallyConvexSpace 𝕜 E _ _ _ t₂) : @LocallyConvexSpace 𝕜 E _ _ _ (t₁ ⊓ t₂) := by rw [inf_eq_iInf] refine locallyConvexSpace_iInf fun b => ?_ cases b <;> assumption theorem locallyConvexSpace_induced {t : TopologicalSpace F} [LocallyConvexSpace 𝕜 F] (f : E →ₗ[𝕜] F) : @LocallyConvexSpace 𝕜 E _ _ _ (t.induced f) := by letI : TopologicalSpace E := t.induced f refine LocallyConvexSpace.ofBases 𝕜 E (fun _ => preimage f) (fun x => fun s : Set F => s ∈ 𝓝 (f x) ∧ Convex 𝕜 s) (fun x => ?_) fun x s ⟨_, hs⟩ => hs.linear_preimage f rw [nhds_induced] exact (LocallyConvexSpace.convex_basis <| f x).comap f instance Pi.locallyConvexSpace {ι : Type*} {X : ι → Type*} [∀ i, AddCommMonoid (X i)] [∀ i, TopologicalSpace (X i)] [∀ i, Module 𝕜 (X i)] [∀ i, LocallyConvexSpace 𝕜 (X i)] : LocallyConvexSpace 𝕜 (∀ i, X i) := locallyConvexSpace_iInf fun i => locallyConvexSpace_induced (LinearMap.proj i) instance Prod.locallyConvexSpace [TopologicalSpace E] [TopologicalSpace F] [LocallyConvexSpace 𝕜 E] [LocallyConvexSpace 𝕜 F] : LocallyConvexSpace 𝕜 (E × F) := -- Porting note: had to specify `t₁` and `t₂` locallyConvexSpace_inf (t₁ := induced Prod.fst _) (t₂ := induced Prod.snd _) (locallyConvexSpace_induced (LinearMap.fst _ _ _)) (locallyConvexSpace_induced (LinearMap.snd _ _ _)) end LatticeOps
Topology\Algebra\Module\Simple.lean
/- Copyright (c) 2022 Anatole Dedecker. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Anatole Dedecker -/ import Mathlib.RingTheory.SimpleModule import Mathlib.Topology.Algebra.Module.Basic /-! # The kernel of a linear function is closed or dense In this file we prove (`LinearMap.isClosed_or_dense_ker`) that the kernel of a linear function `f : M →ₗ[R] N` is either closed or dense in `M` provided that `N` is a simple module over `R`. This applies, e.g., to the case when `R = N` is a division ring. -/ universe u v w variable {R : Type u} {M : Type v} {N : Type w} [Ring R] [TopologicalSpace R] [TopologicalSpace M] [AddCommGroup M] [AddCommGroup N] [Module R M] [ContinuousSMul R M] [Module R N] [ContinuousAdd M] [IsSimpleModule R N] /-- The kernel of a linear map taking values in a simple module over the base ring is closed or dense. Applies, e.g., to the case when `R = N` is a division ring. -/ theorem LinearMap.isClosed_or_dense_ker (l : M →ₗ[R] N) : IsClosed (LinearMap.ker l : Set M) ∨ Dense (LinearMap.ker l : Set M) := by rcases l.surjective_or_eq_zero with (hl | rfl) · exact l.ker.isClosed_or_dense_of_isCoatom (LinearMap.isCoatom_ker_of_surjective hl) · rw [LinearMap.ker_zero] left exact isClosed_univ
Topology\Algebra\Module\Star.lean
/- Copyright (c) 2023 Eric Wieser. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Eric Wieser, Frédéric Dupuis -/ import Mathlib.Algebra.Star.Module import Mathlib.Topology.Algebra.Module.Basic import Mathlib.Topology.Algebra.Star /-! # The star operation, bundled as a continuous star-linear equiv -/ @[inherit_doc] notation:25 M " →L⋆[" R "] " M₂ => ContinuousLinearMap (starRingEnd R) M M₂ @[inherit_doc] notation:50 M " ≃L⋆[" R "] " M₂ => ContinuousLinearEquiv (starRingEnd R) M M₂ /-- If `A` is a topological module over a commutative `R` with compatible actions, then `star` is a continuous semilinear equivalence. -/ @[simps!] def starL (R : Type*) {A : Type*} [CommSemiring R] [StarRing R] [AddCommMonoid A] [StarAddMonoid A] [Module R A] [StarModule R A] [TopologicalSpace A] [ContinuousStar A] : A ≃L⋆[R] A where toLinearEquiv := starLinearEquiv R continuous_toFun := continuous_star continuous_invFun := continuous_star -- TODO: this could be replaced with something like `(starL R).restrict_scalarsₛₗ h` if we -- implemented the idea in -- https://leanprover.zulipchat.com/#narrow/stream/217875-Is-there-code-for-X.3F/topic/Star-semilinear.20maps.20are.20semilinear.20when.20star.20is.20trivial/near/359557835 /-- If `A` is a topological module over a commutative `R` with trivial star and compatible actions, then `star` is a continuous linear equivalence. -/ @[simps!] def starL' (R : Type*) {A : Type*} [CommSemiring R] [StarRing R] [TrivialStar R] [AddCommMonoid A] [StarAddMonoid A] [Module R A] [StarModule R A] [TopologicalSpace A] [ContinuousStar A] : A ≃L[R] A := (starL R : A ≃L⋆[R] A).trans ({ AddEquiv.refl A with map_smul' := fun r a => by simp [starRingEnd_apply] continuous_toFun := continuous_id continuous_invFun := continuous_id } : A ≃L⋆[R] A) variable (R : Type*) (A : Type*) [Semiring R] [StarMul R] [TrivialStar R] [AddCommGroup A] [Module R A] [StarAddMonoid A] [StarModule R A] [Invertible (2 : R)] [TopologicalSpace A] theorem continuous_selfAdjointPart [ContinuousAdd A] [ContinuousStar A] [ContinuousConstSMul R A] : Continuous (selfAdjointPart R (A := A)) := ((continuous_const_smul _).comp <| continuous_id.add continuous_star).subtype_mk _ theorem continuous_skewAdjointPart [ContinuousSub A] [ContinuousStar A] [ContinuousConstSMul R A] : Continuous (skewAdjointPart R (A := A)) := ((continuous_const_smul _).comp <| continuous_id.sub continuous_star).subtype_mk _ theorem continuous_decomposeProdAdjoint [TopologicalAddGroup A] [ContinuousStar A] [ContinuousConstSMul R A] : Continuous (StarModule.decomposeProdAdjoint R A) := (continuous_selfAdjointPart R A).prod_mk (continuous_skewAdjointPart R A) theorem continuous_decomposeProdAdjoint_symm [TopologicalAddGroup A] : Continuous (StarModule.decomposeProdAdjoint R A).symm := (continuous_subtype_val.comp continuous_fst).add (continuous_subtype_val.comp continuous_snd) /-- The self-adjoint part of an element of a star module, as a continuous linear map. -/ @[simps!] def selfAdjointPartL [ContinuousAdd A] [ContinuousStar A] [ContinuousConstSMul R A] : A →L[R] selfAdjoint A where toLinearMap := selfAdjointPart R cont := continuous_selfAdjointPart _ _ -- Porting note: `simp only [selfAdjointPartL_toFun_coe]` proves this projection attribute [nolint simpNF] selfAdjointPartL_apply_coe /-- The skew-adjoint part of an element of a star module, as a continuous linear map. -/ @[simps!] def skewAdjointPartL [ContinuousSub A] [ContinuousStar A] [ContinuousConstSMul R A] : A →L[R] skewAdjoint A where toLinearMap := skewAdjointPart R cont := continuous_skewAdjointPart _ _ /-- The decomposition of elements of a star module into their self- and skew-adjoint parts, as a continuous linear equivalence. -/ @[simps!] def StarModule.decomposeProdAdjointL [TopologicalAddGroup A] [ContinuousStar A] [ContinuousConstSMul R A] : A ≃L[R] selfAdjoint A × skewAdjoint A where toLinearEquiv := StarModule.decomposeProdAdjoint R A continuous_toFun := continuous_decomposeProdAdjoint _ _ continuous_invFun := continuous_decomposeProdAdjoint_symm _ _
Topology\Algebra\Module\StrongTopology.lean
/- Copyright (c) 2022 Anatole Dedecker. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Anatole Dedecker -/ import Mathlib.Topology.Algebra.Module.UniformConvergence /-! # Strong topologies on the space of continuous linear maps In this file, we define the strong topologies on `E →L[𝕜] F` associated with a family `𝔖 : Set (Set E)` to be the topology of uniform convergence on the elements of `𝔖` (also called the topology of `𝔖`-convergence). The lemma `UniformOnFun.continuousSMul_of_image_bounded` tells us that this is a vector space topology if the continuous linear image of any element of `𝔖` is bounded (in the sense of `Bornology.IsVonNBounded`). We then declare an instance for the case where `𝔖` is exactly the set of all bounded subsets of `E`, giving us the so-called "topology of uniform convergence on bounded sets" (or "topology of bounded convergence"), which coincides with the operator norm topology in the case of `NormedSpace`s. Other useful examples include the weak-* topology (when `𝔖` is the set of finite sets or the set of singletons) and the topology of compact convergence (when `𝔖` is the set of relatively compact sets). ## Main definitions * `UniformConvergenceCLM` is a type synonym for `E →SL[σ] F` equipped with the `𝔖`-topology. * `UniformConvergenceCLM.instTopologicalSpace` is the topology mentioned above for an arbitrary `𝔖`. * `ContinuousLinearMap.topologicalSpace` is the topology of bounded convergence. This is declared as an instance. ## Main statements * `UniformConvergenceCLM.instTopologicalAddGroup` and `UniformConvergenceCLM.instContinuousSMul` show that the strong topology makes `E →L[𝕜] F` a topological vector space, with the assumptions on `𝔖` mentioned above. * `ContinuousLinearMap.topologicalAddGroup` and `ContinuousLinearMap.continuousSMul` register these facts as instances for the special case of bounded convergence. ## References * [N. Bourbaki, *Topological Vector Spaces*][bourbaki1987] ## TODO * Add convergence on compact subsets ## Tags uniform convergence, bounded convergence -/ open scoped Topology UniformConvergence section General /-! ### 𝔖-Topologies -/ variable {𝕜₁ 𝕜₂ : Type*} [NormedField 𝕜₁] [NormedField 𝕜₂] (σ : 𝕜₁ →+* 𝕜₂) {E F : Type*} [AddCommGroup E] [Module 𝕜₁ E] [TopologicalSpace E] [AddCommGroup F] [Module 𝕜₂ F] (F) /-- Given `E` and `F` two topological vector spaces and `𝔖 : Set (Set E)`, then `UniformConvergenceCLM σ F 𝔖` is a type synonym of `E →SL[σ] F` equipped with the "topology of uniform convergence on the elements of `𝔖`". If the continuous linear image of any element of `𝔖` is bounded, this makes `E →SL[σ] F` a topological vector space. -/ @[nolint unusedArguments] def UniformConvergenceCLM [TopologicalSpace F] [TopologicalAddGroup F] (_ : Set (Set E)) := E →SL[σ] F namespace UniformConvergenceCLM instance instFunLike [TopologicalSpace F] [TopologicalAddGroup F] (𝔖 : Set (Set E)) : FunLike (UniformConvergenceCLM σ F 𝔖) E F := ContinuousLinearMap.funLike instance instContinuousSemilinearMapClass [TopologicalSpace F] [TopologicalAddGroup F] (𝔖 : Set (Set E)) : ContinuousSemilinearMapClass (UniformConvergenceCLM σ F 𝔖) σ E F := ContinuousLinearMap.continuousSemilinearMapClass instance instTopologicalSpace [TopologicalSpace F] [TopologicalAddGroup F] (𝔖 : Set (Set E)) : TopologicalSpace (UniformConvergenceCLM σ F 𝔖) := (@UniformOnFun.topologicalSpace E F (TopologicalAddGroup.toUniformSpace F) 𝔖).induced (DFunLike.coe : (UniformConvergenceCLM σ F 𝔖) → (E →ᵤ[𝔖] F)) theorem topologicalSpace_eq [UniformSpace F] [UniformAddGroup F] (𝔖 : Set (Set E)) : instTopologicalSpace σ F 𝔖 = TopologicalSpace.induced DFunLike.coe (UniformOnFun.topologicalSpace E F 𝔖) := by rw [instTopologicalSpace] congr exact UniformAddGroup.toUniformSpace_eq /-- The uniform structure associated with `ContinuousLinearMap.strongTopology`. We make sure that this has nice definitional properties. -/ instance instUniformSpace [UniformSpace F] [UniformAddGroup F] (𝔖 : Set (Set E)) : UniformSpace (UniformConvergenceCLM σ F 𝔖) := UniformSpace.replaceTopology ((UniformOnFun.uniformSpace E F 𝔖).comap (DFunLike.coe : (UniformConvergenceCLM σ F 𝔖) → (E →ᵤ[𝔖] F))) (by rw [UniformConvergenceCLM.instTopologicalSpace, UniformAddGroup.toUniformSpace_eq]; rfl) theorem uniformSpace_eq [UniformSpace F] [UniformAddGroup F] (𝔖 : Set (Set E)) : instUniformSpace σ F 𝔖 = UniformSpace.comap DFunLike.coe (UniformOnFun.uniformSpace E F 𝔖) := by rw [instUniformSpace, UniformSpace.replaceTopology_eq] @[simp] theorem uniformity_toTopologicalSpace_eq [UniformSpace F] [UniformAddGroup F] (𝔖 : Set (Set E)) : (UniformConvergenceCLM.instUniformSpace σ F 𝔖).toTopologicalSpace = UniformConvergenceCLM.instTopologicalSpace σ F 𝔖 := rfl theorem uniformEmbedding_coeFn [UniformSpace F] [UniformAddGroup F] (𝔖 : Set (Set E)) : UniformEmbedding (α := UniformConvergenceCLM σ F 𝔖) (β := E →ᵤ[𝔖] F) DFunLike.coe := ⟨⟨rfl⟩, DFunLike.coe_injective⟩ theorem embedding_coeFn [UniformSpace F] [UniformAddGroup F] (𝔖 : Set (Set E)) : Embedding (X := UniformConvergenceCLM σ F 𝔖) (Y := E →ᵤ[𝔖] F) (UniformOnFun.ofFun 𝔖 ∘ DFunLike.coe) := UniformEmbedding.embedding (uniformEmbedding_coeFn _ _ _) instance instAddCommGroup [TopologicalSpace F] [TopologicalAddGroup F] (𝔖 : Set (Set E)) : AddCommGroup (UniformConvergenceCLM σ F 𝔖) := ContinuousLinearMap.addCommGroup instance instUniformAddGroup [UniformSpace F] [UniformAddGroup F] (𝔖 : Set (Set E)) : UniformAddGroup (UniformConvergenceCLM σ F 𝔖) := by let φ : (UniformConvergenceCLM σ F 𝔖) →+ E →ᵤ[𝔖] F := ⟨⟨(DFunLike.coe : (UniformConvergenceCLM σ F 𝔖) → E →ᵤ[𝔖] F), rfl⟩, fun _ _ => rfl⟩ exact (uniformEmbedding_coeFn _ _ _).uniformAddGroup φ instance instTopologicalAddGroup [TopologicalSpace F] [TopologicalAddGroup F] (𝔖 : Set (Set E)) : TopologicalAddGroup (UniformConvergenceCLM σ F 𝔖) := by letI : UniformSpace F := TopologicalAddGroup.toUniformSpace F haveI : UniformAddGroup F := comm_topologicalAddGroup_is_uniform infer_instance theorem t2Space [TopologicalSpace F] [TopologicalAddGroup F] [T2Space F] (𝔖 : Set (Set E)) (h𝔖 : ⋃₀ 𝔖 = Set.univ) : T2Space (UniformConvergenceCLM σ F 𝔖) := by letI : UniformSpace F := TopologicalAddGroup.toUniformSpace F haveI : UniformAddGroup F := comm_topologicalAddGroup_is_uniform haveI : T2Space (E →ᵤ[𝔖] F) := UniformOnFun.t2Space_of_covering h𝔖 exact (embedding_coeFn σ F 𝔖).t2Space instance instDistribMulAction (M : Type*) [Monoid M] [DistribMulAction M F] [SMulCommClass 𝕜₂ M F] [TopologicalSpace F] [TopologicalAddGroup F] [ContinuousConstSMul M F] (𝔖 : Set (Set E)) : DistribMulAction M (UniformConvergenceCLM σ F 𝔖) := ContinuousLinearMap.distribMulAction instance instModule (R : Type*) [Semiring R] [Module R F] [SMulCommClass 𝕜₂ R F] [TopologicalSpace F] [ContinuousConstSMul R F] [TopologicalAddGroup F] (𝔖 : Set (Set E)) : Module R (UniformConvergenceCLM σ F 𝔖) := ContinuousLinearMap.module theorem continuousSMul [RingHomSurjective σ] [RingHomIsometric σ] [TopologicalSpace F] [TopologicalAddGroup F] [ContinuousSMul 𝕜₂ F] (𝔖 : Set (Set E)) (h𝔖₃ : ∀ S ∈ 𝔖, Bornology.IsVonNBounded 𝕜₁ S) : ContinuousSMul 𝕜₂ (UniformConvergenceCLM σ F 𝔖) := by letI : UniformSpace F := TopologicalAddGroup.toUniformSpace F haveI : UniformAddGroup F := comm_topologicalAddGroup_is_uniform let φ : (UniformConvergenceCLM σ F 𝔖) →ₗ[𝕜₂] E → F := ⟨⟨DFunLike.coe, fun _ _ => rfl⟩, fun _ _ => rfl⟩ exact UniformOnFun.continuousSMul_induced_of_image_bounded 𝕜₂ E F (UniformConvergenceCLM σ F 𝔖) φ ⟨rfl⟩ fun u s hs => (h𝔖₃ s hs).image u theorem hasBasis_nhds_zero_of_basis [TopologicalSpace F] [TopologicalAddGroup F] {ι : Type*} (𝔖 : Set (Set E)) (h𝔖₁ : 𝔖.Nonempty) (h𝔖₂ : DirectedOn (· ⊆ ·) 𝔖) {p : ι → Prop} {b : ι → Set F} (h : (𝓝 0 : Filter F).HasBasis p b) : (𝓝 (0 : UniformConvergenceCLM σ F 𝔖)).HasBasis (fun Si : Set E × ι => Si.1 ∈ 𝔖 ∧ p Si.2) fun Si => { f : E →SL[σ] F | ∀ x ∈ Si.1, f x ∈ b Si.2 } := by letI : UniformSpace F := TopologicalAddGroup.toUniformSpace F haveI : UniformAddGroup F := comm_topologicalAddGroup_is_uniform rw [(embedding_coeFn σ F 𝔖).toInducing.nhds_eq_comap] exact (UniformOnFun.hasBasis_nhds_zero_of_basis 𝔖 h𝔖₁ h𝔖₂ h).comap DFunLike.coe theorem hasBasis_nhds_zero [TopologicalSpace F] [TopologicalAddGroup F] (𝔖 : Set (Set E)) (h𝔖₁ : 𝔖.Nonempty) (h𝔖₂ : DirectedOn (· ⊆ ·) 𝔖) : (𝓝 (0 : UniformConvergenceCLM σ F 𝔖)).HasBasis (fun SV : Set E × Set F => SV.1 ∈ 𝔖 ∧ SV.2 ∈ (𝓝 0 : Filter F)) fun SV => { f : UniformConvergenceCLM σ F 𝔖 | ∀ x ∈ SV.1, f x ∈ SV.2 } := hasBasis_nhds_zero_of_basis σ F 𝔖 h𝔖₁ h𝔖₂ (𝓝 0).basis_sets instance instUniformContinuousConstSMul (M : Type*) [Monoid M] [DistribMulAction M F] [SMulCommClass 𝕜₂ M F] [UniformSpace F] [UniformAddGroup F] [UniformContinuousConstSMul M F] (𝔖 : Set (Set E)) : UniformContinuousConstSMul M (UniformConvergenceCLM σ F 𝔖) := (uniformEmbedding_coeFn σ F 𝔖).toUniformInducing.uniformContinuousConstSMul fun _ _ ↦ by rfl instance instContinuousConstSMul (M : Type*) [Monoid M] [DistribMulAction M F] [SMulCommClass 𝕜₂ M F] [TopologicalSpace F] [TopologicalAddGroup F] [ContinuousConstSMul M F] (𝔖 : Set (Set E)) : ContinuousConstSMul M (UniformConvergenceCLM σ F 𝔖) := let _ := TopologicalAddGroup.toUniformSpace F have _ : UniformAddGroup F := comm_topologicalAddGroup_is_uniform have _ := uniformContinuousConstSMul_of_continuousConstSMul M F inferInstance theorem tendsto_iff_tendstoUniformlyOn {ι : Type*} {p : Filter ι} [UniformSpace F] [UniformAddGroup F] (𝔖 : Set (Set E)) {a : ι → UniformConvergenceCLM σ F 𝔖} {a₀ : UniformConvergenceCLM σ F 𝔖} : Filter.Tendsto a p (𝓝 a₀) ↔ ∀ s ∈ 𝔖, TendstoUniformlyOn (a · ·) a₀ p s := by rw [(embedding_coeFn σ F 𝔖).tendsto_nhds_iff, UniformOnFun.tendsto_iff_tendstoUniformlyOn] rfl variable {𝔖₁ 𝔖₂ : Set (Set E)} theorem uniformSpace_mono [UniformSpace F] [UniformAddGroup F] (h : 𝔖₂ ⊆ 𝔖₁) : instUniformSpace σ F 𝔖₁ ≤ instUniformSpace σ F 𝔖₂ := by simp_rw [uniformSpace_eq] exact UniformSpace.comap_mono (UniformOnFun.mono (le_refl _) h) theorem topologicalSpace_mono [TopologicalSpace F] [TopologicalAddGroup F] (h : 𝔖₂ ⊆ 𝔖₁) : instTopologicalSpace σ F 𝔖₁ ≤ instTopologicalSpace σ F 𝔖₂ := by letI := TopologicalAddGroup.toUniformSpace F haveI : UniformAddGroup F := comm_topologicalAddGroup_is_uniform simp_rw [← uniformity_toTopologicalSpace_eq] exact UniformSpace.toTopologicalSpace_mono (uniformSpace_mono σ F h) end UniformConvergenceCLM end General namespace ContinuousLinearMap section BoundedSets /-! ### Topology of bounded convergence -/ variable {𝕜₁ 𝕜₂ 𝕜₃ : Type*} [NormedField 𝕜₁] [NormedField 𝕜₂] [NormedField 𝕜₃] {σ : 𝕜₁ →+* 𝕜₂} {τ : 𝕜₂ →+* 𝕜₃} {ρ : 𝕜₁ →+* 𝕜₃} [RingHomCompTriple σ τ ρ] {E F G : Type*} [AddCommGroup E] [Module 𝕜₁ E] [AddCommGroup F] [Module 𝕜₂ F] [AddCommGroup G] [Module 𝕜₃ G] [TopologicalSpace E] /-- The topology of bounded convergence on `E →L[𝕜] F`. This coincides with the topology induced by the operator norm when `E` and `F` are normed spaces. -/ instance topologicalSpace [TopologicalSpace F] [TopologicalAddGroup F] : TopologicalSpace (E →SL[σ] F) := UniformConvergenceCLM.instTopologicalSpace σ F { S | Bornology.IsVonNBounded 𝕜₁ S } instance topologicalAddGroup [TopologicalSpace F] [TopologicalAddGroup F] : TopologicalAddGroup (E →SL[σ] F) := UniformConvergenceCLM.instTopologicalAddGroup σ F _ instance continuousSMul [RingHomSurjective σ] [RingHomIsometric σ] [TopologicalSpace F] [TopologicalAddGroup F] [ContinuousSMul 𝕜₂ F] : ContinuousSMul 𝕜₂ (E →SL[σ] F) := UniformConvergenceCLM.continuousSMul σ F { S | Bornology.IsVonNBounded 𝕜₁ S } fun _ hs => hs instance uniformSpace [UniformSpace F] [UniformAddGroup F] : UniformSpace (E →SL[σ] F) := UniformConvergenceCLM.instUniformSpace σ F { S | Bornology.IsVonNBounded 𝕜₁ S } instance uniformAddGroup [UniformSpace F] [UniformAddGroup F] : UniformAddGroup (E →SL[σ] F) := UniformConvergenceCLM.instUniformAddGroup σ F _ instance [TopologicalSpace F] [TopologicalAddGroup F] [ContinuousSMul 𝕜₁ E] [T2Space F] : T2Space (E →SL[σ] F) := UniformConvergenceCLM.t2Space σ F _ (Set.eq_univ_of_forall fun x => Set.mem_sUnion_of_mem (Set.mem_singleton x) (Bornology.isVonNBounded_singleton x)) protected theorem hasBasis_nhds_zero_of_basis [TopologicalSpace F] [TopologicalAddGroup F] {ι : Type*} {p : ι → Prop} {b : ι → Set F} (h : (𝓝 0 : Filter F).HasBasis p b) : (𝓝 (0 : E →SL[σ] F)).HasBasis (fun Si : Set E × ι => Bornology.IsVonNBounded 𝕜₁ Si.1 ∧ p Si.2) fun Si => { f : E →SL[σ] F | ∀ x ∈ Si.1, f x ∈ b Si.2 } := UniformConvergenceCLM.hasBasis_nhds_zero_of_basis σ F { S | Bornology.IsVonNBounded 𝕜₁ S } ⟨∅, Bornology.isVonNBounded_empty 𝕜₁ E⟩ (directedOn_of_sup_mem fun _ _ => Bornology.IsVonNBounded.union) h protected theorem hasBasis_nhds_zero [TopologicalSpace F] [TopologicalAddGroup F] : (𝓝 (0 : E →SL[σ] F)).HasBasis (fun SV : Set E × Set F => Bornology.IsVonNBounded 𝕜₁ SV.1 ∧ SV.2 ∈ (𝓝 0 : Filter F)) fun SV => { f : E →SL[σ] F | ∀ x ∈ SV.1, f x ∈ SV.2 } := ContinuousLinearMap.hasBasis_nhds_zero_of_basis (𝓝 0).basis_sets instance uniformContinuousConstSMul {M : Type*} [Monoid M] [DistribMulAction M F] [SMulCommClass 𝕜₂ M F] [UniformSpace F] [UniformAddGroup F] [UniformContinuousConstSMul M F] : UniformContinuousConstSMul M (E →SL[σ] F) := UniformConvergenceCLM.instUniformContinuousConstSMul σ F _ _ instance continuousConstSMul {M : Type*} [Monoid M] [DistribMulAction M F] [SMulCommClass 𝕜₂ M F] [TopologicalSpace F] [TopologicalAddGroup F] [ContinuousConstSMul M F] : ContinuousConstSMul M (E →SL[σ] F) := UniformConvergenceCLM.instContinuousConstSMul σ F _ _ variable (G) [TopologicalSpace F] [TopologicalSpace G] /-- Pre-composition by a *fixed* continuous linear map as a continuous linear map. Note that in non-normed space it is not always true that composition is continuous in both variables, so we have to fix one of them. -/ @[simps] def precomp [TopologicalAddGroup G] [ContinuousConstSMul 𝕜₃ G] [RingHomSurjective σ] [RingHomIsometric σ] (L : E →SL[σ] F) : (F →SL[τ] G) →L[𝕜₃] E →SL[ρ] G where toFun f := f.comp L map_add' f g := add_comp f g L map_smul' a f := smul_comp a f L cont := by letI : UniformSpace G := TopologicalAddGroup.toUniformSpace G haveI : UniformAddGroup G := comm_topologicalAddGroup_is_uniform rw [(UniformConvergenceCLM.embedding_coeFn _ _ _).continuous_iff] -- Porting note: without this, the following doesn't work change Continuous ((fun f ↦ UniformOnFun.ofFun _ (f ∘ L)) ∘ DFunLike.coe) exact (UniformOnFun.precomp_uniformContinuous fun S hS => hS.image L).continuous.comp (UniformConvergenceCLM.embedding_coeFn _ _ _).continuous variable (E) {G} /-- Post-composition by a *fixed* continuous linear map as a continuous linear map. Note that in non-normed space it is not always true that composition is continuous in both variables, so we have to fix one of them. -/ @[simps] def postcomp [TopologicalAddGroup F] [TopologicalAddGroup G] [ContinuousConstSMul 𝕜₃ G] [ContinuousConstSMul 𝕜₂ F] (L : F →SL[τ] G) : (E →SL[σ] F) →SL[τ] E →SL[ρ] G where toFun f := L.comp f map_add' := comp_add L map_smul' := comp_smulₛₗ L cont := by letI : UniformSpace G := TopologicalAddGroup.toUniformSpace G haveI : UniformAddGroup G := comm_topologicalAddGroup_is_uniform letI : UniformSpace F := TopologicalAddGroup.toUniformSpace F haveI : UniformAddGroup F := comm_topologicalAddGroup_is_uniform rw [(UniformConvergenceCLM.embedding_coeFn _ _ _).continuous_iff] exact (UniformOnFun.postcomp_uniformContinuous L.uniformContinuous).continuous.comp (UniformConvergenceCLM.embedding_coeFn _ _ _).continuous end BoundedSets section BilinearMaps variable {𝕜 : Type*} [NormedField 𝕜] {E F G : Type*} [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] [AddCommGroup F] [Module 𝕜 F] [TopologicalSpace F] [AddCommGroup G] [Module 𝕜 G] [TopologicalSpace G] [TopologicalAddGroup G] [ContinuousConstSMul 𝕜 G] /-- Send a continuous bilinear map to an abstract bilinear map (forgetting continuity). -/ def toLinearMap₂ (L : E →L[𝕜] F →L[𝕜] G) : E →ₗ[𝕜] F →ₗ[𝕜] G := (coeLM 𝕜).comp L.toLinearMap @[simp] lemma toLinearMap₂_apply (L : E →L[𝕜] F →L[𝕜] G) (v : E) (w : F) : L.toLinearMap₂ v w = L v w := rfl end BilinearMaps end ContinuousLinearMap open ContinuousLinearMap namespace ContinuousLinearEquiv /-! ### Continuous linear equivalences -/ section Semilinear variable {𝕜 : Type*} {𝕜₂ : Type*} {𝕜₃ : Type*} {𝕜₄ : Type*} {E : Type*} {F : Type*} {G : Type*} {H : Type*} [AddCommGroup E] [AddCommGroup F] [AddCommGroup G] [AddCommGroup H] [NontriviallyNormedField 𝕜] [NontriviallyNormedField 𝕜₂] [NontriviallyNormedField 𝕜₃] [NontriviallyNormedField 𝕜₄] [Module 𝕜 E] [Module 𝕜₂ F] [Module 𝕜₃ G] [Module 𝕜₄ H] [TopologicalSpace E] [TopologicalSpace F] [TopologicalSpace G] [TopologicalSpace H] [TopologicalAddGroup G] [TopologicalAddGroup H] [ContinuousConstSMul 𝕜₃ G] [ContinuousConstSMul 𝕜₄ H] {σ₁₂ : 𝕜 →+* 𝕜₂} {σ₂₁ : 𝕜₂ →+* 𝕜} {σ₂₃ : 𝕜₂ →+* 𝕜₃} {σ₁₃ : 𝕜 →+* 𝕜₃} {σ₃₄ : 𝕜₃ →+* 𝕜₄} {σ₄₃ : 𝕜₄ →+* 𝕜₃} {σ₂₄ : 𝕜₂ →+* 𝕜₄} {σ₁₄ : 𝕜 →+* 𝕜₄} [RingHomInvPair σ₁₂ σ₂₁] [RingHomInvPair σ₂₁ σ₁₂] [RingHomInvPair σ₃₄ σ₄₃] [RingHomInvPair σ₄₃ σ₃₄] [RingHomCompTriple σ₂₁ σ₁₄ σ₂₄] [RingHomCompTriple σ₂₄ σ₄₃ σ₂₃] [RingHomCompTriple σ₁₂ σ₂₃ σ₁₃] [RingHomCompTriple σ₁₃ σ₃₄ σ₁₄] [RingHomCompTriple σ₂₃ σ₃₄ σ₂₄] [RingHomCompTriple σ₁₂ σ₂₄ σ₁₄] [RingHomIsometric σ₁₂] [RingHomIsometric σ₂₁] /-- A pair of continuous (semi)linear equivalences generates a (semi)linear equivalence between the spaces of continuous (semi)linear maps. -/ @[simps] def arrowCongrSL (e₁₂ : E ≃SL[σ₁₂] F) (e₄₃ : H ≃SL[σ₄₃] G) : (E →SL[σ₁₄] H) ≃SL[σ₄₃] F →SL[σ₂₃] G := { e₁₂.arrowCongrEquiv e₄₃ with -- given explicitly to help `simps` toFun := fun L => (e₄₃ : H →SL[σ₄₃] G).comp (L.comp (e₁₂.symm : F →SL[σ₂₁] E)) -- given explicitly to help `simps` invFun := fun L => (e₄₃.symm : G →SL[σ₃₄] H).comp (L.comp (e₁₂ : E →SL[σ₁₂] F)) map_add' := fun f g => by simp only [add_comp, comp_add] map_smul' := fun t f => by simp only [smul_comp, comp_smulₛₗ] continuous_toFun := ((postcomp F e₄₃.toContinuousLinearMap).comp (precomp H e₁₂.symm.toContinuousLinearMap)).continuous continuous_invFun := ((precomp H e₁₂.toContinuousLinearMap).comp (postcomp F e₄₃.symm.toContinuousLinearMap)).continuous } -- Porting note: the following two lemmas were autogenerated by `simps` in Lean3, but this is -- no longer the case. The first one can already be proven by `simp`, but the second can't. theorem arrowCongrSL_toLinearEquiv_apply (e₁₂ : E ≃SL[σ₁₂] F) (e₄₃ : H ≃SL[σ₄₃] G) (L : E →SL[σ₁₄] H) : (e₁₂.arrowCongrSL e₄₃).toLinearEquiv L = (e₄₃ : H →SL[σ₄₃] G).comp (L.comp (e₁₂.symm : F →SL[σ₂₁] E)) := rfl @[simp] theorem arrowCongrSL_toLinearEquiv_symm_apply (e₁₂ : E ≃SL[σ₁₂] F) (e₄₃ : H ≃SL[σ₄₃] G) (L : F →SL[σ₂₃] G) : (e₁₂.arrowCongrSL e₄₃).toLinearEquiv.symm L = (e₄₃.symm : G →SL[σ₃₄] H).comp (L.comp (e₁₂ : E →SL[σ₁₂] F)) := rfl end Semilinear section Linear variable {𝕜 : Type*} {E : Type*} {F : Type*} {G : Type*} {H : Type*} [AddCommGroup E] [AddCommGroup F] [AddCommGroup G] [AddCommGroup H] [NontriviallyNormedField 𝕜] [Module 𝕜 E] [Module 𝕜 F] [Module 𝕜 G] [Module 𝕜 H] [TopologicalSpace E] [TopologicalSpace F] [TopologicalSpace G] [TopologicalSpace H] [TopologicalAddGroup G] [TopologicalAddGroup H] [ContinuousConstSMul 𝕜 G] [ContinuousConstSMul 𝕜 H] /-- A pair of continuous linear equivalences generates a continuous linear equivalence between the spaces of continuous linear maps. -/ def arrowCongr (e₁ : E ≃L[𝕜] F) (e₂ : H ≃L[𝕜] G) : (E →L[𝕜] H) ≃L[𝕜] F →L[𝕜] G := e₁.arrowCongrSL e₂ @[simp] lemma arrowCongr_apply (e₁ : E ≃L[𝕜] F) (e₂ : H ≃L[𝕜] G) (f : E →L[𝕜] H) (x : F) : e₁.arrowCongr e₂ f x = e₂ (f (e₁.symm x)) := rfl @[simp] lemma arrowCongr_symm (e₁ : E ≃L[𝕜] F) (e₂ : H ≃L[𝕜] G) : (e₁.arrowCongr e₂).symm = e₁.symm.arrowCongr e₂.symm := rfl end Linear end ContinuousLinearEquiv
Topology\Algebra\Module\UniformConvergence.lean
/- Copyright (c) 2022 Anatole Dedecker. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Anatole Dedecker -/ import Mathlib.Analysis.LocallyConvex.Bounded import Mathlib.Topology.Algebra.FilterBasis import Mathlib.Topology.Algebra.UniformConvergence /-! # Algebraic facts about the topology of uniform convergence This file contains algebraic compatibility results about the uniform structure of uniform convergence / `𝔖`-convergence. They will mostly be useful for defining strong topologies on the space of continuous linear maps between two topological vector spaces. ## Main statements * `UniformOnFun.continuousSMul_induced_of_image_bounded` : let `E` be a TVS, `𝔖 : Set (Set α)` and `H` a submodule of `α →ᵤ[𝔖] E`. If the image of any `S ∈ 𝔖` by any `u ∈ H` is bounded (in the sense of `Bornology.IsVonNBounded`), then `H`, equipped with the topology induced from `α →ᵤ[𝔖] E`, is a TVS. ## Implementation notes Like in `Mathlib.Topology.UniformSpace.UniformConvergenceTopology`, we use the type aliases `UniformFun` (denoted `α →ᵤ β`) and `UniformOnFun` (denoted `α →ᵤ[𝔖] β`) for functions from `α` to `β` endowed with the structures of uniform convergence and `𝔖`-convergence. ## References * [N. Bourbaki, *General Topology, Chapter X*][bourbaki1966] * [N. Bourbaki, *Topological Vector Spaces*][bourbaki1987] ## Tags uniform convergence, strong dual -/ open Filter open scoped Topology Pointwise UniformConvergence Uniformity section Module variable (𝕜 α E H : Type*) {hom : Type*} [NormedField 𝕜] [AddCommGroup H] [Module 𝕜 H] [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace H] [UniformSpace E] [UniformAddGroup E] [ContinuousSMul 𝕜 E] {𝔖 : Set <| Set α} [FunLike hom H (α → E)] [LinearMapClass hom 𝕜 H (α → E)] /-- Let `E` be a topological vector space over a normed field `𝕜`, let `α` be any type. Let `H` be a submodule of `α →ᵤ E` such that the range of each `f ∈ H` is von Neumann bounded. Then `H` is a topological vector space over `𝕜`, i.e., the pointwise scalar multiplication is continuous in both variables. For convenience we require that `H` is a vector space over `𝕜` with a topology induced by `UniformFun.ofFun ∘ φ`, where `φ : H →ₗ[𝕜] (α → E)`. -/ lemma UniformFun.continuousSMul_induced_of_range_bounded (φ : hom) (hφ : Inducing (ofFun ∘ φ)) (h : ∀ u : H, Bornology.IsVonNBounded 𝕜 (Set.range (φ u))) : ContinuousSMul 𝕜 H := by have : TopologicalAddGroup H := let ofFun' : (α → E) →+ (α →ᵤ E) := AddMonoidHom.id _ Inducing.topologicalAddGroup (ofFun'.comp (φ : H →+ (α → E))) hφ have hb : (𝓝 (0 : H)).HasBasis (· ∈ 𝓝 (0 : E)) fun V ↦ {u | ∀ x, φ u x ∈ V} := by simp only [hφ.nhds_eq_comap, Function.comp_apply, map_zero] exact UniformFun.hasBasis_nhds_zero.comap _ apply ContinuousSMul.of_basis_zero hb · intro U hU have : Tendsto (fun x : 𝕜 × E ↦ x.1 • x.2) (𝓝 0) (𝓝 0) := continuous_smul.tendsto' _ _ (zero_smul _ _) rcases ((Filter.basis_sets _).prod_nhds (Filter.basis_sets _)).tendsto_left_iff.1 this U hU with ⟨⟨V, W⟩, ⟨hV, hW⟩, hVW⟩ refine ⟨V, hV, W, hW, Set.smul_subset_iff.2 fun a ha u hu x ↦ ?_⟩ rw [map_smul] exact hVW (Set.mk_mem_prod ha (hu x)) · intro c U hU have : Tendsto (c • · : E → E) (𝓝 0) (𝓝 0) := (continuous_const_smul c).tendsto' _ _ (smul_zero _) refine ⟨_, this hU, fun u hu x ↦ ?_⟩ simpa only [map_smul] using hu x · intro u U hU simp only [Set.mem_setOf_eq, map_smul, Pi.smul_apply] simpa only [Set.mapsTo_range_iff] using (h u hU).eventually_nhds_zero (mem_of_mem_nhds hU) /-- Let `E` be a TVS, `𝔖 : Set (Set α)` and `H` a submodule of `α →ᵤ[𝔖] E`. If the image of any `S ∈ 𝔖` by any `u ∈ H` is bounded (in the sense of `Bornology.IsVonNBounded`), then `H`, equipped with the topology of `𝔖`-convergence, is a TVS. For convenience, we don't literally ask for `H : Submodule (α →ᵤ[𝔖] E)`. Instead, we prove the result for any vector space `H` equipped with a linear inducing to `α →ᵤ[𝔖] E`, which is often easier to use. We also state the `Submodule` version as `UniformOnFun.continuousSMul_submodule_of_image_bounded`. -/ theorem UniformOnFun.continuousSMul_induced_of_image_bounded (φ : hom) (hφ : Inducing (ofFun 𝔖 ∘ φ)) (h : ∀ u : H, ∀ s ∈ 𝔖, Bornology.IsVonNBounded 𝕜 ((φ u : α → E) '' s)) : ContinuousSMul 𝕜 H := by obtain rfl := hφ.induced; clear hφ simp only [induced_iInf, UniformOnFun.topologicalSpace_eq, induced_compose] refine continuousSMul_iInf fun s ↦ continuousSMul_iInf fun hs ↦ ?_ letI : TopologicalSpace H := .induced (UniformFun.ofFun ∘ s.restrict ∘ φ) (UniformFun.topologicalSpace s E) set φ' : H →ₗ[𝕜] (s → E) := { toFun := s.restrict ∘ φ, map_smul' := fun c x ↦ by exact congr_arg s.restrict (map_smul φ c x), map_add' := fun x y ↦ by exact congr_arg s.restrict (map_add φ x y) } refine UniformFun.continuousSMul_induced_of_range_bounded 𝕜 s E H φ' ⟨rfl⟩ fun u ↦ ?_ simpa only [Set.image_eq_range] using h u s hs /-- Let `E` be a TVS, `𝔖 : Set (Set α)` and `H` a submodule of `α →ᵤ[𝔖] E`. If the image of any `S ∈ 𝔖` by any `u ∈ H` is bounded (in the sense of `Bornology.IsVonNBounded`), then `H`, equipped with the topology of `𝔖`-convergence, is a TVS. If you have a hard time using this lemma, try the one above instead. -/ theorem UniformOnFun.continuousSMul_submodule_of_image_bounded (H : Submodule 𝕜 (α →ᵤ[𝔖] E)) (h : ∀ u ∈ H, ∀ s ∈ 𝔖, Bornology.IsVonNBounded 𝕜 (u '' s)) : @ContinuousSMul 𝕜 H _ _ ((UniformOnFun.topologicalSpace α E 𝔖).induced ((↑) : H → α →ᵤ[𝔖] E)) := UniformOnFun.continuousSMul_induced_of_image_bounded 𝕜 α E H (LinearMap.id.domRestrict H : H →ₗ[𝕜] α → E) inducing_subtype_val fun ⟨u, hu⟩ => h u hu end Module
Topology\Algebra\Module\WeakDual.lean
/- Copyright (c) 2021 Kalle Kytölä. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kalle Kytölä, Moritz Doll -/ import Mathlib.Topology.Algebra.Module.Basic import Mathlib.LinearAlgebra.BilinearMap /-! # Weak dual topology This file defines the weak topology given two vector spaces `E` and `F` over a commutative semiring `𝕜` and a bilinear form `B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜`. The weak topology on `E` is the coarsest topology such that for all `y : F` every map `fun x => B x y` is continuous. In the case that `F = E →L[𝕜] 𝕜` and `B` being the canonical pairing, we obtain the weak-* topology, `WeakDual 𝕜 E := (E →L[𝕜] 𝕜)`. Interchanging the arguments in the bilinear form yields the weak topology `WeakSpace 𝕜 E := E`. ## Main definitions The main definitions are the types `WeakBilin B` for the general case and the two special cases `WeakDual 𝕜 E` and `WeakSpace 𝕜 E` with the respective topology instances on it. * Given `B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜`, the type `WeakBilin B` is a type synonym for `E`. * The instance `WeakBilin.instTopologicalSpace` is the weak topology induced by the bilinear form `B`. * `WeakDual 𝕜 E` is a type synonym for `Dual 𝕜 E` (when the latter is defined): both are equal to the type `E →L[𝕜] 𝕜` of continuous linear maps from a module `E` over `𝕜` to the ring `𝕜`. * The instance `WeakDual.instTopologicalSpace` is the weak-* topology on `WeakDual 𝕜 E`, i.e., the coarsest topology making the evaluation maps at all `z : E` continuous. * `WeakSpace 𝕜 E` is a type synonym for `E` (when the latter is defined). * The instance `WeakSpace.instTopologicalSpace` is the weak topology on `E`, i.e., the coarsest topology such that all `v : dual 𝕜 E` remain continuous. ## Main results We establish that `WeakBilin B` has the following structure: * `WeakBilin.instContinuousAdd`: The addition in `WeakBilin B` is continuous. * `WeakBilin.instContinuousSMul`: The scalar multiplication in `WeakBilin B` is continuous. We prove the following results characterizing the weak topology: * `eval_continuous`: For any `y : F`, the evaluation mapping `fun x => B x y` is continuous. * `continuous_of_continuous_eval`: For a mapping to `WeakBilin B` to be continuous, it suffices that its compositions with pairing with `B` at all points `y : F` is continuous. * `tendsto_iff_forall_eval_tendsto`: Convergence in `WeakBilin B` can be characterized in terms of convergence of the evaluations at all points `y : F`. ## Notations No new notation is introduced. ## References * [H. H. Schaefer, *Topological Vector Spaces*][schaefer1966] ## Tags weak-star, weak dual, duality -/ noncomputable section open Filter open Topology variable {α 𝕜 𝕝 R E F M : Type*} section WeakTopology /-- The space `E` equipped with the weak topology induced by the bilinear form `B`. -/ @[nolint unusedArguments] def WeakBilin [CommSemiring 𝕜] [AddCommMonoid E] [Module 𝕜 E] [AddCommMonoid F] [Module 𝕜 F] (_ : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜) := E namespace WeakBilin -- Porting note: the next two instances should be derived from the definition instance instAddCommMonoid [CommSemiring 𝕜] [a : AddCommMonoid E] [Module 𝕜 E] [AddCommMonoid F] [Module 𝕜 F] (B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜) : AddCommMonoid (WeakBilin B) := a instance instModule [CommSemiring 𝕜] [AddCommMonoid E] [m : Module 𝕜 E] [AddCommMonoid F] [Module 𝕜 F] (B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜) : Module 𝕜 (WeakBilin B) := m instance instAddCommGroup [CommSemiring 𝕜] [a : AddCommGroup E] [Module 𝕜 E] [AddCommMonoid F] [Module 𝕜 F] (B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜) : AddCommGroup (WeakBilin B) := a instance (priority := 100) instModule' [CommSemiring 𝕜] [CommSemiring 𝕝] [AddCommGroup E] [Module 𝕜 E] [AddCommGroup F] [Module 𝕜 F] [m : Module 𝕝 E] (B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜) : Module 𝕝 (WeakBilin B) := m instance instIsScalarTower [CommSemiring 𝕜] [CommSemiring 𝕝] [AddCommGroup E] [Module 𝕜 E] [AddCommGroup F] [Module 𝕜 F] [SMul 𝕝 𝕜] [Module 𝕝 E] [s : IsScalarTower 𝕝 𝕜 E] (B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜) : IsScalarTower 𝕝 𝕜 (WeakBilin B) := s section Semiring variable [TopologicalSpace 𝕜] [CommSemiring 𝕜] variable [AddCommMonoid E] [Module 𝕜 E] variable [AddCommMonoid F] [Module 𝕜 F] variable (B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜) instance instTopologicalSpace : TopologicalSpace (WeakBilin B) := TopologicalSpace.induced (fun x y => B x y) Pi.topologicalSpace /-- The coercion `(fun x y => B x y) : E → (F → 𝕜)` is continuous. -/ theorem coeFn_continuous : Continuous fun (x : WeakBilin B) y => B x y := continuous_induced_dom theorem eval_continuous (y : F) : Continuous fun x : WeakBilin B => B x y := (continuous_pi_iff.mp (coeFn_continuous B)) y theorem continuous_of_continuous_eval [TopologicalSpace α] {g : α → WeakBilin B} (h : ∀ y, Continuous fun a => B (g a) y) : Continuous g := continuous_induced_rng.2 (continuous_pi_iff.mpr h) /-- The coercion `(fun x y => B x y) : E → (F → 𝕜)` is an embedding. -/ theorem embedding {B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜} (hB : Function.Injective B) : Embedding fun (x : WeakBilin B) y => B x y := Function.Injective.embedding_induced <| LinearMap.coe_injective.comp hB theorem tendsto_iff_forall_eval_tendsto {l : Filter α} {f : α → WeakBilin B} {x : WeakBilin B} (hB : Function.Injective B) : Tendsto f l (𝓝 x) ↔ ∀ y, Tendsto (fun i => B (f i) y) l (𝓝 (B x y)) := by rw [← tendsto_pi_nhds, Embedding.tendsto_nhds_iff (embedding hB)] rfl /-- Addition in `WeakBilin B` is continuous. -/ instance instContinuousAdd [ContinuousAdd 𝕜] : ContinuousAdd (WeakBilin B) := by refine ⟨continuous_induced_rng.2 ?_⟩ refine cast (congr_arg _ ?_) (((coeFn_continuous B).comp continuous_fst).add ((coeFn_continuous B).comp continuous_snd)) ext simp only [Function.comp_apply, Pi.add_apply, map_add, LinearMap.add_apply] /-- Scalar multiplication by `𝕜` on `WeakBilin B` is continuous. -/ instance instContinuousSMul [ContinuousSMul 𝕜 𝕜] : ContinuousSMul 𝕜 (WeakBilin B) := by refine ⟨continuous_induced_rng.2 ?_⟩ refine cast (congr_arg _ ?_) (continuous_fst.smul ((coeFn_continuous B).comp continuous_snd)) ext simp only [Function.comp_apply, Pi.smul_apply, LinearMap.map_smulₛₗ, RingHom.id_apply, LinearMap.smul_apply] end Semiring section Ring variable [TopologicalSpace 𝕜] [CommRing 𝕜] variable [AddCommGroup E] [Module 𝕜 E] variable [AddCommGroup F] [Module 𝕜 F] variable (B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜) /-- `WeakBilin B` is a `TopologicalAddGroup`, meaning that addition and negation are continuous. -/ instance instTopologicalAddGroup [ContinuousAdd 𝕜] : TopologicalAddGroup (WeakBilin B) where toContinuousAdd := by infer_instance continuous_neg := by refine continuous_induced_rng.2 (continuous_pi_iff.mpr fun y => ?_) refine cast (congr_arg _ ?_) (eval_continuous B (-y)) ext x simp only [map_neg, Function.comp_apply, LinearMap.neg_apply] end Ring end WeakBilin end WeakTopology section WeakStarTopology /-- The canonical pairing of a vector space and its topological dual. -/ def topDualPairing (𝕜 E) [CommSemiring 𝕜] [TopologicalSpace 𝕜] [ContinuousAdd 𝕜] [AddCommMonoid E] [Module 𝕜 E] [TopologicalSpace E] [ContinuousConstSMul 𝕜 𝕜] : (E →L[𝕜] 𝕜) →ₗ[𝕜] E →ₗ[𝕜] 𝕜 := ContinuousLinearMap.coeLM 𝕜 variable [CommSemiring 𝕜] [TopologicalSpace 𝕜] [ContinuousAdd 𝕜] variable [ContinuousConstSMul 𝕜 𝕜] variable [AddCommMonoid E] [Module 𝕜 E] [TopologicalSpace E] theorem topDualPairing_apply (v : E →L[𝕜] 𝕜) (x : E) : topDualPairing 𝕜 E v x = v x := rfl /-- The weak star topology is the topology coarsest topology on `E →L[𝕜] 𝕜` such that all functionals `fun v => v x` are continuous. -/ def WeakDual (𝕜 E : Type*) [CommSemiring 𝕜] [TopologicalSpace 𝕜] [ContinuousAdd 𝕜] [ContinuousConstSMul 𝕜 𝕜] [AddCommMonoid E] [Module 𝕜 E] [TopologicalSpace E] := WeakBilin (topDualPairing 𝕜 E) namespace WeakDual -- Porting note: the next four instances should be derived from the definition instance instAddCommMonoid : AddCommMonoid (WeakDual 𝕜 E) := WeakBilin.instAddCommMonoid (topDualPairing 𝕜 E) instance instModule : Module 𝕜 (WeakDual 𝕜 E) := WeakBilin.instModule (topDualPairing 𝕜 E) instance instTopologicalSpace : TopologicalSpace (WeakDual 𝕜 E) := WeakBilin.instTopologicalSpace (topDualPairing 𝕜 E) instance instContinuousAdd : ContinuousAdd (WeakDual 𝕜 E) := WeakBilin.instContinuousAdd (topDualPairing 𝕜 E) instance instInhabited : Inhabited (WeakDual 𝕜 E) := ContinuousLinearMap.inhabited instance instFunLike : FunLike (WeakDual 𝕜 E) E 𝕜 := ContinuousLinearMap.funLike instance instContinuousLinearMapClass : ContinuousLinearMapClass (WeakDual 𝕜 E) 𝕜 E 𝕜 := ContinuousLinearMap.continuousSemilinearMapClass /-- Helper instance for when there's too many metavariables to apply `DFunLike.hasCoeToFun` directly. -/ instance : CoeFun (WeakDual 𝕜 E) fun _ => E → 𝕜 := DFunLike.hasCoeToFun /-- If a monoid `M` distributively continuously acts on `𝕜` and this action commutes with multiplication on `𝕜`, then it acts on `WeakDual 𝕜 E`. -/ instance instMulAction (M) [Monoid M] [DistribMulAction M 𝕜] [SMulCommClass 𝕜 M 𝕜] [ContinuousConstSMul M 𝕜] : MulAction M (WeakDual 𝕜 E) := ContinuousLinearMap.mulAction /-- If a monoid `M` distributively continuously acts on `𝕜` and this action commutes with multiplication on `𝕜`, then it acts distributively on `WeakDual 𝕜 E`. -/ instance instDistribMulAction (M) [Monoid M] [DistribMulAction M 𝕜] [SMulCommClass 𝕜 M 𝕜] [ContinuousConstSMul M 𝕜] : DistribMulAction M (WeakDual 𝕜 E) := ContinuousLinearMap.distribMulAction /-- If `𝕜` is a topological module over a semiring `R` and scalar multiplication commutes with the multiplication on `𝕜`, then `WeakDual 𝕜 E` is a module over `R`. -/ instance instModule' (R) [Semiring R] [Module R 𝕜] [SMulCommClass 𝕜 R 𝕜] [ContinuousConstSMul R 𝕜] : Module R (WeakDual 𝕜 E) := ContinuousLinearMap.module instance instContinuousConstSMul (M) [Monoid M] [DistribMulAction M 𝕜] [SMulCommClass 𝕜 M 𝕜] [ContinuousConstSMul M 𝕜] : ContinuousConstSMul M (WeakDual 𝕜 E) := ⟨fun m => continuous_induced_rng.2 <| (WeakBilin.coeFn_continuous (topDualPairing 𝕜 E)).const_smul m⟩ /-- If a monoid `M` distributively continuously acts on `𝕜` and this action commutes with multiplication on `𝕜`, then it continuously acts on `WeakDual 𝕜 E`. -/ instance instContinuousSMul (M) [Monoid M] [DistribMulAction M 𝕜] [SMulCommClass 𝕜 M 𝕜] [TopologicalSpace M] [ContinuousSMul M 𝕜] : ContinuousSMul M (WeakDual 𝕜 E) := ⟨continuous_induced_rng.2 <| continuous_fst.smul ((WeakBilin.coeFn_continuous (topDualPairing 𝕜 E)).comp continuous_snd)⟩ theorem coeFn_continuous : Continuous fun (x : WeakDual 𝕜 E) y => x y := continuous_induced_dom theorem eval_continuous (y : E) : Continuous fun x : WeakDual 𝕜 E => x y := continuous_pi_iff.mp coeFn_continuous y theorem continuous_of_continuous_eval [TopologicalSpace α] {g : α → WeakDual 𝕜 E} (h : ∀ y, Continuous fun a => (g a) y) : Continuous g := continuous_induced_rng.2 (continuous_pi_iff.mpr h) instance instT2Space [T2Space 𝕜] : T2Space (WeakDual 𝕜 E) := Embedding.t2Space <| WeakBilin.embedding <| show Function.Injective (topDualPairing 𝕜 E) from ContinuousLinearMap.coe_injective end WeakDual /-- The weak topology is the topology coarsest topology on `E` such that all functionals `fun x => v x` are continuous. -/ def WeakSpace (𝕜 E) [CommSemiring 𝕜] [TopologicalSpace 𝕜] [ContinuousAdd 𝕜] [ContinuousConstSMul 𝕜 𝕜] [AddCommMonoid E] [Module 𝕜 E] [TopologicalSpace E] := WeakBilin (topDualPairing 𝕜 E).flip namespace WeakSpace -- Porting note: the next four instances should be derived from the definition instance instAddCommMonoid : AddCommMonoid (WeakSpace 𝕜 E) := WeakBilin.instAddCommMonoid (topDualPairing 𝕜 E).flip instance instModule : Module 𝕜 (WeakSpace 𝕜 E) := WeakBilin.instModule (topDualPairing 𝕜 E).flip instance instTopologicalSpace : TopologicalSpace (WeakSpace 𝕜 E) := WeakBilin.instTopologicalSpace (topDualPairing 𝕜 E).flip instance instContinuousAdd : ContinuousAdd (WeakSpace 𝕜 E) := WeakBilin.instContinuousAdd (topDualPairing 𝕜 E).flip variable [AddCommMonoid F] [Module 𝕜 F] [TopologicalSpace F] /-- A continuous linear map from `E` to `F` is still continuous when `E` and `F` are equipped with their weak topologies. -/ def map (f : E →L[𝕜] F) : WeakSpace 𝕜 E →L[𝕜] WeakSpace 𝕜 F := { f with cont := WeakBilin.continuous_of_continuous_eval _ fun l => WeakBilin.eval_continuous _ (l ∘L f) } theorem map_apply (f : E →L[𝕜] F) (x : E) : WeakSpace.map f x = f x := rfl @[simp] theorem coe_map (f : E →L[𝕜] F) : (WeakSpace.map f : E → F) = f := rfl end WeakSpace variable (𝕜 E) in /-- There is a canonical map `E → WeakSpace 𝕜 E` (the "identity" mapping). It is a linear equivalence. -/ def toWeakSpace : E ≃ₗ[𝕜] WeakSpace 𝕜 E := LinearEquiv.refl 𝕜 E variable (𝕜 E) in /-- For a topological vector space `E`, "identity mapping" `E → WeakSpace 𝕜 E` is continuous. This definition implements it as a continuous linear map. -/ def continuousLinearMapToWeakSpace : E →L[𝕜] WeakSpace 𝕜 E where __ := toWeakSpace 𝕜 E cont := by apply WeakBilin.continuous_of_continuous_eval exact ContinuousLinearMap.continuous variable (𝕜 E) in @[simp] theorem continuousLinearMapToWeakSpace_eq_toWeakSpace (x : E) : continuousLinearMapToWeakSpace 𝕜 E x = toWeakSpace 𝕜 E x := by rfl theorem continuousLinearMapToWeakSpace_bijective : Function.Bijective (continuousLinearMapToWeakSpace 𝕜 E) := (toWeakSpace 𝕜 E).bijective /-- The canonical map from `WeakSpace 𝕜 E` to `E` is an open map. -/ theorem isOpenMap_toWeakSpace_symm : IsOpenMap (toWeakSpace 𝕜 E).symm := IsOpenMap.of_inverse (continuousLinearMapToWeakSpace 𝕜 E).cont (toWeakSpace 𝕜 E).left_inv (toWeakSpace 𝕜 E).right_inv /-- A set in `E` which is open in the weak topology is open. -/ theorem WeakSpace.isOpen_of_isOpen (V : Set E) (hV : IsOpen ((continuousLinearMapToWeakSpace 𝕜 E) '' V : Set (WeakSpace 𝕜 E))) : IsOpen V := by simpa [Set.image_image] using isOpenMap_toWeakSpace_symm _ hV theorem tendsto_iff_forall_eval_tendsto_topDualPairing {l : Filter α} {f : α → WeakDual 𝕜 E} {x : WeakDual 𝕜 E} : Tendsto f l (𝓝 x) ↔ ∀ y, Tendsto (fun i => topDualPairing 𝕜 E (f i) y) l (𝓝 (topDualPairing 𝕜 E x y)) := WeakBilin.tendsto_iff_forall_eval_tendsto _ ContinuousLinearMap.coe_injective end WeakStarTopology
Topology\Algebra\Module\Alternating\Basic.lean
/- Copyright (c) 2023 Yury Kudryashov. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yury Kudryashov, Heather Macbeth, Sébastien Gouëzel -/ import Mathlib.LinearAlgebra.Alternating.Basic import Mathlib.LinearAlgebra.BilinearMap import Mathlib.Topology.Algebra.Module.Multilinear.Basic /-! # Continuous alternating multilinear maps In this file we define bundled continuous alternating maps and develop basic API about these maps, by reusing API about continuous multilinear maps and alternating maps. ## Notation `M [⋀^ι]→L[R] N`: notation for `R`-linear continuous alternating maps from `M` to `N`; the arguments are indexed by `i : ι`. ## Keywords multilinear map, alternating map, continuous -/ open Function Matrix /-- A continuous alternating map from `ι → M` to `N`, denoted `M [⋀^ι]→L[R] N`, is a continuous map that is - multilinear : `f (update m i (c • x)) = c • f (update m i x)` and `f (update m i (x + y)) = f (update m i x) + f (update m i y)`; - alternating : `f v = 0` whenever `v` has two equal coordinates. -/ structure ContinuousAlternatingMap (R M N ι : Type*) [Semiring R] [AddCommMonoid M] [Module R M] [TopologicalSpace M] [AddCommMonoid N] [Module R N] [TopologicalSpace N] extends ContinuousMultilinearMap R (fun _ : ι => M) N, M [⋀^ι]→ₗ[R] N where /-- Projection to `ContinuousMultilinearMap`s. -/ add_decl_doc ContinuousAlternatingMap.toContinuousMultilinearMap /-- Projection to `AlternatingMap`s. -/ add_decl_doc ContinuousAlternatingMap.toAlternatingMap @[inherit_doc] notation M " [⋀^" ι "]→L[" R "] " N:100 => ContinuousAlternatingMap R M N ι namespace ContinuousAlternatingMap section Semiring variable {R M M' N N' ι : Type*} [Semiring R] [AddCommMonoid M] [Module R M] [TopologicalSpace M] [AddCommMonoid M'] [Module R M'] [TopologicalSpace M'] [AddCommMonoid N] [Module R N] [TopologicalSpace N] [AddCommMonoid N'] [Module R N'] [TopologicalSpace N'] {n : ℕ} (f g : M [⋀^ι]→L[R] N) theorem toContinuousMultilinearMap_injective : Injective (ContinuousAlternatingMap.toContinuousMultilinearMap : M [⋀^ι]→L[R] N → ContinuousMultilinearMap R (fun _ : ι => M) N) | ⟨_, _⟩, ⟨_, _⟩, rfl => rfl theorem range_toContinuousMultilinearMap : Set.range (toContinuousMultilinearMap : M [⋀^ι]→L[R] N → ContinuousMultilinearMap R (fun _ : ι => M) N) = {f | ∀ (v : ι → M) (i j : ι), v i = v j → i ≠ j → f v = 0} := Set.ext fun f => ⟨fun ⟨g, hg⟩ => hg ▸ g.2, fun h => ⟨⟨f, h⟩, rfl⟩⟩ instance funLike : FunLike (M [⋀^ι]→L[R] N) (ι → M) N where coe f := f.toFun coe_injective' _ _ h := toContinuousMultilinearMap_injective <| DFunLike.ext' h instance continuousMapClass : ContinuousMapClass (M [⋀^ι]→L[R] N) (ι → M) N where map_continuous f := f.cont initialize_simps_projections ContinuousAlternatingMap (toFun → apply) @[continuity] theorem coe_continuous : Continuous f := f.cont @[simp] theorem coe_toContinuousMultilinearMap : ⇑f.toContinuousMultilinearMap = f := rfl @[simp] theorem coe_mk (f : ContinuousMultilinearMap R (fun _ : ι => M) N) (h) : ⇑(mk f h) = f := rfl -- not a `simp` lemma because this projection is a reducible call to `mk`, so `simp` can prove -- this lemma theorem coe_toAlternatingMap : ⇑f.toAlternatingMap = f := rfl @[ext] theorem ext {f g : M [⋀^ι]→L[R] N} (H : ∀ x, f x = g x) : f = g := DFunLike.ext _ _ H theorem toAlternatingMap_injective : Injective (toAlternatingMap : (M [⋀^ι]→L[R] N) → (M [⋀^ι]→ₗ[R] N)) := fun f g h => DFunLike.ext' <| by convert DFunLike.ext'_iff.1 h @[simp] theorem range_toAlternatingMap : Set.range (toAlternatingMap : M [⋀^ι]→L[R] N → (M [⋀^ι]→ₗ[R] N)) = {f : M [⋀^ι]→ₗ[R] N | Continuous f} := Set.ext fun f => ⟨fun ⟨g, hg⟩ => hg ▸ g.cont, fun h => ⟨{ f with cont := h }, DFunLike.ext' rfl⟩⟩ @[simp] theorem map_add [DecidableEq ι] (m : ι → M) (i : ι) (x y : M) : f (update m i (x + y)) = f (update m i x) + f (update m i y) := f.map_add' m i x y @[simp] theorem map_smul [DecidableEq ι] (m : ι → M) (i : ι) (c : R) (x : M) : f (update m i (c • x)) = c • f (update m i x) := f.map_smul' m i c x theorem map_coord_zero {m : ι → M} (i : ι) (h : m i = 0) : f m = 0 := f.toMultilinearMap.map_coord_zero i h @[simp] theorem map_update_zero [DecidableEq ι] (m : ι → M) (i : ι) : f (update m i 0) = 0 := f.toMultilinearMap.map_update_zero m i @[simp] theorem map_zero [Nonempty ι] : f 0 = 0 := f.toMultilinearMap.map_zero theorem map_eq_zero_of_eq (v : ι → M) {i j : ι} (h : v i = v j) (hij : i ≠ j) : f v = 0 := f.map_eq_zero_of_eq' v i j h hij theorem map_eq_zero_of_not_injective (v : ι → M) (hv : ¬Function.Injective v) : f v = 0 := f.toAlternatingMap.map_eq_zero_of_not_injective v hv /-- Restrict the codomain of a continuous alternating map to a submodule. -/ @[simps!] def codRestrict (f : M [⋀^ι]→L[R] N) (p : Submodule R N) (h : ∀ v, f v ∈ p) : M [⋀^ι]→L[R] p := { f.toAlternatingMap.codRestrict p h with toContinuousMultilinearMap := f.1.codRestrict p h } instance : Zero (M [⋀^ι]→L[R] N) := ⟨⟨0, (0 : M [⋀^ι]→ₗ[R] N).map_eq_zero_of_eq⟩⟩ instance : Inhabited (M [⋀^ι]→L[R] N) := ⟨0⟩ @[simp] theorem coe_zero : ⇑(0 : M [⋀^ι]→L[R] N) = 0 := rfl @[simp] theorem toContinuousMultilinearMap_zero : (0 : M [⋀^ι]→L[R] N).toContinuousMultilinearMap = 0 := rfl @[simp] theorem toAlternatingMap_zero : (0 : M [⋀^ι]→L[R] N).toAlternatingMap = 0 := rfl section SMul variable {R' R'' A : Type*} [Monoid R'] [Monoid R''] [Semiring A] [Module A M] [Module A N] [DistribMulAction R' N] [ContinuousConstSMul R' N] [SMulCommClass A R' N] [DistribMulAction R'' N] [ContinuousConstSMul R'' N] [SMulCommClass A R'' N] instance : SMul R' (M [⋀^ι]→L[A] N) := ⟨fun c f => ⟨c • f.1, (c • f.toAlternatingMap).map_eq_zero_of_eq⟩⟩ @[simp] theorem coe_smul (f : M [⋀^ι]→L[A] N) (c : R') : ⇑(c • f) = c • ⇑f := rfl theorem smul_apply (f : M [⋀^ι]→L[A] N) (c : R') (v : ι → M) : (c • f) v = c • f v := rfl @[simp] theorem toContinuousMultilinearMap_smul (c : R') (f : M [⋀^ι]→L[A] N) : (c • f).toContinuousMultilinearMap = c • f.toContinuousMultilinearMap := rfl @[simp] theorem toAlternatingMap_smul (c : R') (f : M [⋀^ι]→L[A] N) : (c • f).toAlternatingMap = c • f.toAlternatingMap := rfl instance [SMulCommClass R' R'' N] : SMulCommClass R' R'' (M [⋀^ι]→L[A] N) := ⟨fun _ _ _ => ext fun _ => smul_comm _ _ _⟩ instance [SMul R' R''] [IsScalarTower R' R'' N] : IsScalarTower R' R'' (M [⋀^ι]→L[A] N) := ⟨fun _ _ _ => ext fun _ => smul_assoc _ _ _⟩ instance [DistribMulAction R'ᵐᵒᵖ N] [IsCentralScalar R' N] : IsCentralScalar R' (M [⋀^ι]→L[A] N) := ⟨fun _ _ => ext fun _ => op_smul_eq_smul _ _⟩ instance : MulAction R' (M [⋀^ι]→L[A] N) := toContinuousMultilinearMap_injective.mulAction toContinuousMultilinearMap fun _ _ => rfl end SMul section ContinuousAdd variable [ContinuousAdd N] instance : Add (M [⋀^ι]→L[R] N) := ⟨fun f g => ⟨f.1 + g.1, (f.toAlternatingMap + g.toAlternatingMap).map_eq_zero_of_eq⟩⟩ @[simp] theorem coe_add : ⇑(f + g) = ⇑f + ⇑g := rfl @[simp] theorem add_apply (v : ι → M) : (f + g) v = f v + g v := rfl @[simp] theorem toContinuousMultilinearMap_add (f g : M [⋀^ι]→L[R] N) : (f + g).1 = f.1 + g.1 := rfl @[simp] theorem toAlternatingMap_add (f g : M [⋀^ι]→L[R] N) : (f + g).toAlternatingMap = f.toAlternatingMap + g.toAlternatingMap := rfl instance addCommMonoid : AddCommMonoid (M [⋀^ι]→L[R] N) := toContinuousMultilinearMap_injective.addCommMonoid _ rfl (fun _ _ => rfl) fun _ _ => rfl /-- Evaluation of a `ContinuousAlternatingMap` at a vector as an `AddMonoidHom`. -/ def applyAddHom (v : ι → M) : M [⋀^ι]→L[R] N →+ N := ⟨⟨fun f => f v, rfl⟩, fun _ _ => rfl⟩ @[simp] theorem sum_apply {α : Type*} (f : α → M [⋀^ι]→L[R] N) (m : ι → M) {s : Finset α} : (∑ a ∈ s, f a) m = ∑ a ∈ s, f a m := map_sum (applyAddHom m) f s /-- Projection to `ContinuousMultilinearMap`s as a bundled `AddMonoidHom`. -/ @[simps] def toMultilinearAddHom : M [⋀^ι]→L[R] N →+ ContinuousMultilinearMap R (fun _ : ι => M) N := ⟨⟨fun f => f.1, rfl⟩, fun _ _ => rfl⟩ end ContinuousAdd /-- If `f` is a continuous alternating map, then `f.toContinuousLinearMap m i` is the continuous linear map obtained by fixing all coordinates but `i` equal to those of `m`, and varying the `i`-th coordinate. -/ @[simps! apply] def toContinuousLinearMap [DecidableEq ι] (m : ι → M) (i : ι) : M →L[R] N := f.1.toContinuousLinearMap m i /-- The cartesian product of two continuous alternating maps, as a continuous alternating map. -/ @[simps!] def prod (f : M [⋀^ι]→L[R] N) (g : M [⋀^ι]→L[R] N') : M [⋀^ι]→L[R] (N × N') := ⟨f.1.prod g.1, (f.toAlternatingMap.prod g.toAlternatingMap).map_eq_zero_of_eq⟩ /-- Combine a family of continuous alternating maps with the same domain and codomains `M' i` into a continuous alternating map taking values in the space of functions `Π i, M' i`. -/ def pi {ι' : Type*} {M' : ι' → Type*} [∀ i, AddCommMonoid (M' i)] [∀ i, TopologicalSpace (M' i)] [∀ i, Module R (M' i)] (f : ∀ i, M [⋀^ι]→L[R] M' i) : M [⋀^ι]→L[R] ∀ i, M' i := ⟨ContinuousMultilinearMap.pi fun i => (f i).1, (AlternatingMap.pi fun i => (f i).toAlternatingMap).map_eq_zero_of_eq⟩ @[simp] theorem coe_pi {ι' : Type*} {M' : ι' → Type*} [∀ i, AddCommMonoid (M' i)] [∀ i, TopologicalSpace (M' i)] [∀ i, Module R (M' i)] (f : ∀ i, M [⋀^ι]→L[R] M' i) : ⇑(pi f) = fun m j => f j m := rfl theorem pi_apply {ι' : Type*} {M' : ι' → Type*} [∀ i, AddCommMonoid (M' i)] [∀ i, TopologicalSpace (M' i)] [∀ i, Module R (M' i)] (f : ∀ i, M [⋀^ι]→L[R] M' i) (m : ι → M) (j : ι') : pi f m j = f j m := rfl section variable (R M N) /-- The natural equivalence between continuous linear maps from `M` to `N` and continuous 1-multilinear alternating maps from `M` to `N`. -/ @[simps! apply_apply symm_apply_apply apply_toContinuousMultilinearMap] def ofSubsingleton [Subsingleton ι] (i : ι) : (M →L[R] N) ≃ M [⋀^ι]→L[R] N where toFun f := { AlternatingMap.ofSubsingleton R M N i f with toContinuousMultilinearMap := ContinuousMultilinearMap.ofSubsingleton R M N i f } invFun f := (ContinuousMultilinearMap.ofSubsingleton R M N i).symm f.1 left_inv _ := rfl right_inv _ := toContinuousMultilinearMap_injective <| (ContinuousMultilinearMap.ofSubsingleton R M N i).apply_symm_apply _ @[simp] theorem ofSubsingleton_toAlternatingMap [Subsingleton ι] (i : ι) (f : M →L[R] N) : (ofSubsingleton R M N i f).toAlternatingMap = AlternatingMap.ofSubsingleton R M N i f := rfl variable (ι) {N} /-- The constant map is alternating when `ι` is empty. -/ @[simps! toContinuousMultilinearMap apply] def constOfIsEmpty [IsEmpty ι] (m : N) : M [⋀^ι]→L[R] N := { AlternatingMap.constOfIsEmpty R M ι m with toContinuousMultilinearMap := ContinuousMultilinearMap.constOfIsEmpty R (fun _ => M) m } @[simp] theorem constOfIsEmpty_toAlternatingMap [IsEmpty ι] (m : N) : (constOfIsEmpty R M ι m).toAlternatingMap = AlternatingMap.constOfIsEmpty R M ι m := rfl end /-- If `g` is continuous alternating and `f` is a continuous linear map, then `g (f m₁, ..., f mₙ)` is again a continuous alternating map, that we call `g.compContinuousLinearMap f`. -/ def compContinuousLinearMap (g : M [⋀^ι]→L[R] N) (f : M' →L[R] M) : M' [⋀^ι]→L[R] N := { g.toAlternatingMap.compLinearMap (f : M' →ₗ[R] M) with toContinuousMultilinearMap := g.1.compContinuousLinearMap fun _ => f } @[simp] theorem compContinuousLinearMap_apply (g : M [⋀^ι]→L[R] N) (f : M' →L[R] M) (m : ι → M') : g.compContinuousLinearMap f m = g (f ∘ m) := rfl /-- Composing a continuous alternating map with a continuous linear map gives again a continuous alternating map. -/ def _root_.ContinuousLinearMap.compContinuousAlternatingMap (g : N →L[R] N') (f : M [⋀^ι]→L[R] N) : M [⋀^ι]→L[R] N' := { (g : N →ₗ[R] N').compAlternatingMap f.toAlternatingMap with toContinuousMultilinearMap := g.compContinuousMultilinearMap f.1 } @[simp] theorem _root_.ContinuousLinearMap.compContinuousAlternatingMap_coe (g : N →L[R] N') (f : M [⋀^ι]→L[R] N) : ⇑(g.compContinuousAlternatingMap f) = g ∘ f := rfl /-- A continuous linear equivalence of domains defines an equivalence between continuous alternating maps. -/ def _root_.ContinuousLinearEquiv.continuousAlternatingMapComp (e : M ≃L[R] M') : M [⋀^ι]→L[R] N ≃ M' [⋀^ι]→L[R] N where toFun f := f.compContinuousLinearMap ↑e.symm invFun f := f.compContinuousLinearMap ↑e left_inv f := by ext; simp [(· ∘ ·)] right_inv f := by ext; simp [(· ∘ ·)] /-- A continuous linear equivalence of codomains defines an equivalence between continuous alternating maps. -/ def _root_.ContinuousLinearEquiv.compContinuousAlternatingMap (e : N ≃L[R] N') : M [⋀^ι]→L[R] N ≃ M [⋀^ι]→L[R] N' where toFun := (e : N →L[R] N').compContinuousAlternatingMap invFun := (e.symm : N' →L[R] N).compContinuousAlternatingMap left_inv f := by ext; simp [(· ∘ ·)] right_inv f := by ext; simp [(· ∘ ·)] @[simp] theorem _root_.ContinuousLinearEquiv.compContinuousAlternatingMap_coe (e : N ≃L[R] N') (f : M [⋀^ι]→L[R] N) : ⇑(e.compContinuousAlternatingMap f) = e ∘ f := rfl /-- Continuous linear equivalences between domains and codomains define an equivalence between the spaces of continuous alternating maps. -/ def _root_.ContinuousLinearEquiv.continuousAlternatingMapCongr (e : M ≃L[R] M') (e' : N ≃L[R] N') : M [⋀^ι]→L[R] N ≃ M' [⋀^ι]→L[R] N' := e.continuousAlternatingMapComp.trans e'.compContinuousAlternatingMap /-- `ContinuousAlternatingMap.pi` as an `Equiv`. -/ @[simps] def piEquiv {ι' : Type*} {N : ι' → Type*} [∀ i, AddCommMonoid (N i)] [∀ i, TopologicalSpace (N i)] [∀ i, Module R (N i)] : (∀ i, M [⋀^ι]→L[R] N i) ≃ M [⋀^ι]→L[R] ∀ i, N i where toFun := pi invFun f i := (ContinuousLinearMap.proj i : _ →L[R] N i).compContinuousAlternatingMap f left_inv f := by ext; rfl right_inv f := by ext; rfl /-- In the specific case of continuous alternating maps on spaces indexed by `Fin (n+1)`, where one can build an element of `Π(i : Fin (n+1)), M i` using `cons`, one can express directly the additivity of an alternating map along the first variable. -/ theorem cons_add (f : ContinuousAlternatingMap R M N (Fin (n + 1))) (m : Fin n → M) (x y : M) : f (Fin.cons (x + y) m) = f (Fin.cons x m) + f (Fin.cons y m) := f.toMultilinearMap.cons_add m x y /-- In the specific case of continuous alternating maps on spaces indexed by `Fin (n+1)`, where one can build an element of `Π(i : Fin (n+1)), M i` using `cons`, one can express directly the additivity of an alternating map along the first variable. -/ theorem vecCons_add (f : ContinuousAlternatingMap R M N (Fin (n + 1))) (m : Fin n → M) (x y : M) : f (vecCons (x + y) m) = f (vecCons x m) + f (vecCons y m) := f.toMultilinearMap.cons_add m x y /-- In the specific case of continuous alternating maps on spaces indexed by `Fin (n+1)`, where one can build an element of `Π(i : Fin (n+1)), M i` using `cons`, one can express directly the multiplicativity of an alternating map along the first variable. -/ theorem cons_smul (f : ContinuousAlternatingMap R M N (Fin (n + 1))) (m : Fin n → M) (c : R) (x : M) : f (Fin.cons (c • x) m) = c • f (Fin.cons x m) := f.toMultilinearMap.cons_smul m c x /-- In the specific case of continuous alternating maps on spaces indexed by `Fin (n+1)`, where one can build an element of `Π(i : Fin (n+1)), M i` using `cons`, one can express directly the multiplicativity of an alternating map along the first variable. -/ theorem vecCons_smul (f : ContinuousAlternatingMap R M N (Fin (n + 1))) (m : Fin n → M) (c : R) (x : M) : f (vecCons (c • x) m) = c • f (vecCons x m) := f.toMultilinearMap.cons_smul m c x theorem map_piecewise_add [DecidableEq ι] (m m' : ι → M) (t : Finset ι) : f (t.piecewise (m + m') m') = ∑ s ∈ t.powerset, f (s.piecewise m m') := f.toMultilinearMap.map_piecewise_add _ _ _ /-- Additivity of a continuous alternating map along all coordinates at the same time, writing `f (m + m')` as the sum of `f (s.piecewise m m')` over all sets `s`. -/ theorem map_add_univ [DecidableEq ι] [Fintype ι] (m m' : ι → M) : f (m + m') = ∑ s : Finset ι, f (s.piecewise m m') := f.toMultilinearMap.map_add_univ _ _ section ApplySum open Fintype Finset variable {α : ι → Type*} [Fintype ι] [DecidableEq ι] (g' : ∀ i, α i → M) (A : ∀ i, Finset (α i)) /-- If `f` is continuous alternating, then `f (Σ_{j₁ ∈ A₁} g₁ j₁, ..., Σ_{jₙ ∈ Aₙ} gₙ jₙ)` is the sum of `f (g₁ (r 1), ..., gₙ (r n))` where `r` ranges over all functions with `r 1 ∈ A₁`, ..., `r n ∈ Aₙ`. This follows from multilinearity by expanding successively with respect to each coordinate. -/ theorem map_sum_finset : (f fun i => ∑ j ∈ A i, g' i j) = ∑ r ∈ piFinset A, f fun i => g' i (r i) := f.toMultilinearMap.map_sum_finset _ _ /-- If `f` is continuous alternating, then `f (Σ_{j₁} g₁ j₁, ..., Σ_{jₙ} gₙ jₙ)` is the sum of `f (g₁ (r 1), ..., gₙ (r n))` where `r` ranges over all functions `r`. This follows from multilinearity by expanding successively with respect to each coordinate. -/ theorem map_sum [∀ i, Fintype (α i)] : (f fun i => ∑ j, g' i j) = ∑ r : ∀ i, α i, f fun i => g' i (r i) := f.toMultilinearMap.map_sum _ end ApplySum section RestrictScalar variable (R) variable {A : Type*} [Semiring A] [SMul R A] [Module A M] [Module A N] [IsScalarTower R A M] [IsScalarTower R A N] /-- Reinterpret a continuous `A`-alternating map as a continuous `R`-alternating map, if `A` is an algebra over `R` and their actions on all involved modules agree with the action of `R` on `A`. -/ def restrictScalars (f : M [⋀^ι]→L[A] N) : M [⋀^ι]→L[R] N := { f with toContinuousMultilinearMap := f.1.restrictScalars R } @[simp] theorem coe_restrictScalars (f : M [⋀^ι]→L[A] N) : ⇑(f.restrictScalars R) = f := rfl end RestrictScalar end Semiring section Ring variable {R M M' N N' ι : Type*} [Ring R] [AddCommGroup M] [Module R M] [TopologicalSpace M] [AddCommGroup M'] [Module R M'] [TopologicalSpace M'] [AddCommGroup N] [Module R N] [TopologicalSpace N] [AddCommGroup N'] [Module R N'] [TopologicalSpace N'] {n : ℕ} (f g : M [⋀^ι]→L[R] N) @[simp] theorem map_sub [DecidableEq ι] (m : ι → M) (i : ι) (x y : M) : f (update m i (x - y)) = f (update m i x) - f (update m i y) := f.toMultilinearMap.map_sub _ _ _ _ section TopologicalAddGroup variable [TopologicalAddGroup N] instance : Neg (M [⋀^ι]→L[R] N) := ⟨fun f => { -f.toAlternatingMap with toContinuousMultilinearMap := -f.1 }⟩ @[simp] theorem coe_neg : ⇑(-f) = -f := rfl theorem neg_apply (m : ι → M) : (-f) m = -f m := rfl instance : Sub (M [⋀^ι]→L[R] N) := ⟨fun f g => { f.toAlternatingMap - g.toAlternatingMap with toContinuousMultilinearMap := f.1 - g.1 }⟩ @[simp] theorem coe_sub : ⇑(f - g) = ⇑f - ⇑g := rfl theorem sub_apply (m : ι → M) : (f - g) m = f m - g m := rfl instance : AddCommGroup (M [⋀^ι]→L[R] N) := toContinuousMultilinearMap_injective.addCommGroup _ rfl (fun _ _ => rfl) (fun _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl) fun _ _ => rfl end TopologicalAddGroup end Ring section CommSemiring variable {R M M' N N' ι : Type*} [CommSemiring R] [AddCommMonoid M] [Module R M] [TopologicalSpace M] [AddCommMonoid M'] [Module R M'] [TopologicalSpace M'] [AddCommMonoid N] [Module R N] [TopologicalSpace N] [AddCommMonoid N'] [Module R N'] [TopologicalSpace N'] {n : ℕ} (f g : M [⋀^ι]→L[R] N) theorem map_piecewise_smul [DecidableEq ι] (c : ι → R) (m : ι → M) (s : Finset ι) : f (s.piecewise (fun i => c i • m i) m) = (∏ i ∈ s, c i) • f m := f.toMultilinearMap.map_piecewise_smul _ _ _ /-- Multiplicativity of a continuous alternating map along all coordinates at the same time, writing `f (fun i ↦ c i • m i)` as `(∏ i, c i) • f m`. -/ theorem map_smul_univ [Fintype ι] (c : ι → R) (m : ι → M) : (f fun i => c i • m i) = (∏ i, c i) • f m := f.toMultilinearMap.map_smul_univ _ _ end CommSemiring section DistribMulAction variable {R A M N ι : Type*} [Monoid R] [Semiring A] [AddCommMonoid M] [AddCommMonoid N] [TopologicalSpace M] [TopologicalSpace N] [Module A M] [Module A N] [DistribMulAction R N] [ContinuousConstSMul R N] [SMulCommClass A R N] instance [ContinuousAdd N] : DistribMulAction R (M [⋀^ι]→L[A] N) := Function.Injective.distribMulAction toMultilinearAddHom toContinuousMultilinearMap_injective fun _ _ => rfl end DistribMulAction section Module variable {R A M N ι : Type*} [Semiring R] [Semiring A] [AddCommMonoid M] [AddCommMonoid N] [TopologicalSpace M] [TopologicalSpace N] [ContinuousAdd N] [Module A M] [Module A N] [Module R N] [ContinuousConstSMul R N] [SMulCommClass A R N] /-- The space of continuous alternating maps over an algebra over `R` is a module over `R`, for the pointwise addition and scalar multiplication. -/ instance : Module R (M [⋀^ι]→L[A] N) := Function.Injective.module _ toMultilinearAddHom toContinuousMultilinearMap_injective fun _ _ => rfl /-- Linear map version of the map `toMultilinearMap` associating to a continuous alternating map the corresponding multilinear map. -/ @[simps] def toContinuousMultilinearMapLinear : M [⋀^ι]→L[A] N →ₗ[R] ContinuousMultilinearMap A (fun _ : ι => M) N where toFun := toContinuousMultilinearMap map_add' _ _ := rfl map_smul' _ _ := rfl /-- Linear map version of the map `toAlternatingMap` associating to a continuous alternating map the corresponding alternating map. -/ @[simps (config := .asFn) apply] def toAlternatingMapLinear : (M [⋀^ι]→L[A] N) →ₗ[R] (M [⋀^ι]→ₗ[A] N) where toFun := toAlternatingMap map_add' := by simp map_smul' := by simp /-- `ContinuousAlternatingMap.pi` as a `LinearEquiv`. -/ @[simps (config := { simpRhs := true })] def piLinearEquiv {ι' : Type*} {M' : ι' → Type*} [∀ i, AddCommMonoid (M' i)] [∀ i, TopologicalSpace (M' i)] [∀ i, ContinuousAdd (M' i)] [∀ i, Module R (M' i)] [∀ i, Module A (M' i)] [∀ i, SMulCommClass A R (M' i)] [∀ i, ContinuousConstSMul R (M' i)] : (∀ i, M [⋀^ι]→L[A] M' i) ≃ₗ[R] M [⋀^ι]→L[A] ∀ i, M' i := { piEquiv with map_add' := fun _ _ => rfl map_smul' := fun _ _ => rfl } end Module section SMulRight variable {R A M N ι : Type*} [CommSemiring R] [AddCommMonoid M] [AddCommMonoid N] [Module R M] [Module R N] [TopologicalSpace R] [TopologicalSpace M] [TopologicalSpace N] [ContinuousSMul R N] (f : M [⋀^ι]→L[R] R) (z : N) /-- Given a continuous `R`-alternating map `f` taking values in `R`, `f.smulRight z` is the continuous alternating map sending `m` to `f m • z`. -/ @[simps! toContinuousMultilinearMap apply] def smulRight : M [⋀^ι]→L[R] N := { f.toAlternatingMap.smulRight z with toContinuousMultilinearMap := f.1.smulRight z } end SMulRight section Semiring variable {R M M' N N' ι : Type*} [CommSemiring R] [AddCommMonoid M] [Module R M] [TopologicalSpace M] [AddCommMonoid M'] [Module R M'] [TopologicalSpace M'] [AddCommMonoid N] [Module R N] [TopologicalSpace N] [ContinuousAdd N] [ContinuousConstSMul R N] [AddCommMonoid N'] [Module R N'] [TopologicalSpace N'] [ContinuousAdd N'] [ContinuousConstSMul R N'] /-- `ContinuousAlternatingMap.compContinuousLinearMap` as a bundled `LinearMap`. -/ @[simps] def compContinuousLinearMapₗ (f : M →L[R] M') : (M' [⋀^ι]→L[R] N) →ₗ[R] (M [⋀^ι]→L[R] N) where toFun g := g.compContinuousLinearMap f map_add' g g' := by ext; simp map_smul' c g := by ext; simp variable (R M N N') /-- `ContinuousLinearMap.compContinuousAlternatingMap` as a bundled bilinear map. -/ def _root_.ContinuousLinearMap.compContinuousAlternatingMapₗ : (N →L[R] N') →ₗ[R] (M [⋀^ι]→L[R] N) →ₗ[R] (M [⋀^ι]→L[R] N') := LinearMap.mk₂ R ContinuousLinearMap.compContinuousAlternatingMap (fun f₁ f₂ g => rfl) (fun c f g => rfl) (fun f g₁ g₂ => by ext1; apply f.map_add) fun c f g => by ext1; simp end Semiring end ContinuousAlternatingMap namespace ContinuousMultilinearMap variable {R M N ι : Type*} [Semiring R] [AddCommMonoid M] [Module R M] [TopologicalSpace M] [AddCommGroup N] [Module R N] [TopologicalSpace N] [TopologicalAddGroup N] [Fintype ι] [DecidableEq ι] (f g : ContinuousMultilinearMap R (fun _ : ι => M) N) /-- Alternatization of a continuous multilinear map. -/ @[simps (config := .lemmasOnly) apply_toContinuousMultilinearMap] def alternatization : ContinuousMultilinearMap R (fun _ : ι => M) N →+ M [⋀^ι]→L[R] N where toFun f := { toContinuousMultilinearMap := ∑ σ : Equiv.Perm ι, Equiv.Perm.sign σ • f.domDomCongr σ map_eq_zero_of_eq' := fun v i j hv hne => by simpa [MultilinearMap.alternatization_apply] using f.1.alternatization.map_eq_zero_of_eq' v i j hv hne } map_zero' := by ext; simp map_add' _ _ := by ext; simp [Finset.sum_add_distrib] theorem alternatization_apply_apply (v : ι → M) : alternatization f v = ∑ σ : Equiv.Perm ι, Equiv.Perm.sign σ • f (v ∘ σ) := by simp [alternatization, (· ∘ ·)] @[simp] theorem alternatization_apply_toAlternatingMap : (alternatization f).toAlternatingMap = MultilinearMap.alternatization f.1 := by ext v simp [alternatization_apply_apply, MultilinearMap.alternatization_apply, (· ∘ ·)] end ContinuousMultilinearMap
Topology\Algebra\Module\Multilinear\Basic.lean
/- Copyright (c) 2020 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Topology.Algebra.Module.Basic import Mathlib.LinearAlgebra.Multilinear.Basic /-! # Continuous multilinear maps We define continuous multilinear maps as maps from `(i : ι) → M₁ i` to `M₂` which are multilinear and continuous, by extending the space of multilinear maps with a continuity assumption. Here, `M₁ i` and `M₂` are modules over a ring `R`, and `ι` is an arbitrary type, and all these spaces are also topological spaces. ## Main definitions * `ContinuousMultilinearMap R M₁ M₂` is the space of continuous multilinear maps from `(i : ι) → M₁ i` to `M₂`. We show that it is an `R`-module. ## Implementation notes We mostly follow the API of multilinear maps. ## Notation We introduce the notation `M [×n]→L[R] M'` for the space of continuous `n`-multilinear maps from `M^n` to `M'`. This is a particular case of the general notion (where we allow varying dependent types as the arguments of our continuous multilinear maps), but arguably the most important one, especially when defining iterated derivatives. -/ open Function Fin Set universe u v w w₁ w₁' w₂ w₃ w₄ variable {R : Type u} {ι : Type v} {n : ℕ} {M : Fin n.succ → Type w} {M₁ : ι → Type w₁} {M₁' : ι → Type w₁'} {M₂ : Type w₂} {M₃ : Type w₃} {M₄ : Type w₄} /-- Continuous multilinear maps over the ring `R`, from `∀ i, M₁ i` to `M₂` where `M₁ i` and `M₂` are modules over `R` with a topological structure. In applications, there will be compatibility conditions between the algebraic and the topological structures, but this is not needed for the definition. -/ structure ContinuousMultilinearMap (R : Type u) {ι : Type v} (M₁ : ι → Type w₁) (M₂ : Type w₂) [Semiring R] [∀ i, AddCommMonoid (M₁ i)] [AddCommMonoid M₂] [∀ i, Module R (M₁ i)] [Module R M₂] [∀ i, TopologicalSpace (M₁ i)] [TopologicalSpace M₂] extends MultilinearMap R M₁ M₂ where cont : Continuous toFun attribute [inherit_doc ContinuousMultilinearMap] ContinuousMultilinearMap.cont @[inherit_doc] notation:25 M "[×" n "]→L[" R "] " M' => ContinuousMultilinearMap R (fun i : Fin n => M) M' namespace ContinuousMultilinearMap section Semiring variable [Semiring R] [∀ i, AddCommMonoid (M i)] [∀ i, AddCommMonoid (M₁ i)] [∀ i, AddCommMonoid (M₁' i)] [AddCommMonoid M₂] [AddCommMonoid M₃] [AddCommMonoid M₄] [∀ i, Module R (M i)] [∀ i, Module R (M₁ i)] [∀ i, Module R (M₁' i)] [Module R M₂] [Module R M₃] [Module R M₄] [∀ i, TopologicalSpace (M i)] [∀ i, TopologicalSpace (M₁ i)] [∀ i, TopologicalSpace (M₁' i)] [TopologicalSpace M₂] [TopologicalSpace M₃] [TopologicalSpace M₄] (f f' : ContinuousMultilinearMap R M₁ M₂) theorem toMultilinearMap_injective : Function.Injective (ContinuousMultilinearMap.toMultilinearMap : ContinuousMultilinearMap R M₁ M₂ → MultilinearMap R M₁ M₂) | ⟨f, hf⟩, ⟨g, hg⟩, h => by subst h; rfl instance funLike : FunLike (ContinuousMultilinearMap R M₁ M₂) (∀ i, M₁ i) M₂ where coe f := f.toFun coe_injective' _ _ h := toMultilinearMap_injective <| MultilinearMap.coe_injective h instance continuousMapClass : ContinuousMapClass (ContinuousMultilinearMap R M₁ M₂) (∀ i, M₁ i) M₂ where map_continuous := ContinuousMultilinearMap.cont instance : CoeFun (ContinuousMultilinearMap R M₁ M₂) fun _ => (∀ i, M₁ i) → M₂ := ⟨fun f => f⟩ /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (L₁ : ContinuousMultilinearMap R M₁ M₂) (v : ∀ i, M₁ i) : M₂ := L₁ v initialize_simps_projections ContinuousMultilinearMap (-toMultilinearMap, toMultilinearMap_toFun → apply) @[continuity] theorem coe_continuous : Continuous (f : (∀ i, M₁ i) → M₂) := f.cont @[simp] theorem coe_coe : (f.toMultilinearMap : (∀ i, M₁ i) → M₂) = f := rfl @[ext] theorem ext {f f' : ContinuousMultilinearMap R M₁ M₂} (H : ∀ x, f x = f' x) : f = f' := DFunLike.ext _ _ H @[simp] theorem map_add [DecidableEq ι] (m : ∀ i, M₁ i) (i : ι) (x y : M₁ i) : f (update m i (x + y)) = f (update m i x) + f (update m i y) := f.map_add' m i x y @[simp] theorem map_smul [DecidableEq ι] (m : ∀ i, M₁ i) (i : ι) (c : R) (x : M₁ i) : f (update m i (c • x)) = c • f (update m i x) := f.map_smul' m i c x theorem map_coord_zero {m : ∀ i, M₁ i} (i : ι) (h : m i = 0) : f m = 0 := f.toMultilinearMap.map_coord_zero i h @[simp] theorem map_zero [Nonempty ι] : f 0 = 0 := f.toMultilinearMap.map_zero instance : Zero (ContinuousMultilinearMap R M₁ M₂) := ⟨{ (0 : MultilinearMap R M₁ M₂) with cont := continuous_const }⟩ instance : Inhabited (ContinuousMultilinearMap R M₁ M₂) := ⟨0⟩ @[simp] theorem zero_apply (m : ∀ i, M₁ i) : (0 : ContinuousMultilinearMap R M₁ M₂) m = 0 := rfl @[simp] theorem toMultilinearMap_zero : (0 : ContinuousMultilinearMap R M₁ M₂).toMultilinearMap = 0 := rfl section SMul variable {R' R'' A : Type*} [Monoid R'] [Monoid R''] [Semiring A] [∀ i, Module A (M₁ i)] [Module A M₂] [DistribMulAction R' M₂] [ContinuousConstSMul R' M₂] [SMulCommClass A R' M₂] [DistribMulAction R'' M₂] [ContinuousConstSMul R'' M₂] [SMulCommClass A R'' M₂] instance : SMul R' (ContinuousMultilinearMap A M₁ M₂) := ⟨fun c f => { c • f.toMultilinearMap with cont := f.cont.const_smul c }⟩ @[simp] theorem smul_apply (f : ContinuousMultilinearMap A M₁ M₂) (c : R') (m : ∀ i, M₁ i) : (c • f) m = c • f m := rfl @[simp] theorem toMultilinearMap_smul (c : R') (f : ContinuousMultilinearMap A M₁ M₂) : (c • f).toMultilinearMap = c • f.toMultilinearMap := rfl instance [SMulCommClass R' R'' M₂] : SMulCommClass R' R'' (ContinuousMultilinearMap A M₁ M₂) := ⟨fun _ _ _ => ext fun _ => smul_comm _ _ _⟩ instance [SMul R' R''] [IsScalarTower R' R'' M₂] : IsScalarTower R' R'' (ContinuousMultilinearMap A M₁ M₂) := ⟨fun _ _ _ => ext fun _ => smul_assoc _ _ _⟩ instance [DistribMulAction R'ᵐᵒᵖ M₂] [IsCentralScalar R' M₂] : IsCentralScalar R' (ContinuousMultilinearMap A M₁ M₂) := ⟨fun _ _ => ext fun _ => op_smul_eq_smul _ _⟩ instance : MulAction R' (ContinuousMultilinearMap A M₁ M₂) := Function.Injective.mulAction toMultilinearMap toMultilinearMap_injective fun _ _ => rfl end SMul section ContinuousAdd variable [ContinuousAdd M₂] instance : Add (ContinuousMultilinearMap R M₁ M₂) := ⟨fun f f' => ⟨f.toMultilinearMap + f'.toMultilinearMap, f.cont.add f'.cont⟩⟩ @[simp] theorem add_apply (m : ∀ i, M₁ i) : (f + f') m = f m + f' m := rfl @[simp] theorem toMultilinearMap_add (f g : ContinuousMultilinearMap R M₁ M₂) : (f + g).toMultilinearMap = f.toMultilinearMap + g.toMultilinearMap := rfl instance addCommMonoid : AddCommMonoid (ContinuousMultilinearMap R M₁ M₂) := toMultilinearMap_injective.addCommMonoid _ rfl (fun _ _ => rfl) fun _ _ => rfl /-- Evaluation of a `ContinuousMultilinearMap` at a vector as an `AddMonoidHom`. -/ def applyAddHom (m : ∀ i, M₁ i) : ContinuousMultilinearMap R M₁ M₂ →+ M₂ where toFun f := f m map_zero' := rfl map_add' _ _ := rfl @[simp] theorem sum_apply {α : Type*} (f : α → ContinuousMultilinearMap R M₁ M₂) (m : ∀ i, M₁ i) {s : Finset α} : (∑ a ∈ s, f a) m = ∑ a ∈ s, f a m := map_sum (applyAddHom m) f s end ContinuousAdd /-- If `f` is a continuous multilinear map, then `f.toContinuousLinearMap m i` is the continuous linear map obtained by fixing all coordinates but `i` equal to those of `m`, and varying the `i`-th coordinate. -/ def toContinuousLinearMap [DecidableEq ι] (m : ∀ i, M₁ i) (i : ι) : M₁ i →L[R] M₂ := { f.toMultilinearMap.toLinearMap m i with cont := f.cont.comp (continuous_const.update i continuous_id) } /-- The cartesian product of two continuous multilinear maps, as a continuous multilinear map. -/ def prod (f : ContinuousMultilinearMap R M₁ M₂) (g : ContinuousMultilinearMap R M₁ M₃) : ContinuousMultilinearMap R M₁ (M₂ × M₃) := { f.toMultilinearMap.prod g.toMultilinearMap with cont := f.cont.prod_mk g.cont } @[simp] theorem prod_apply (f : ContinuousMultilinearMap R M₁ M₂) (g : ContinuousMultilinearMap R M₁ M₃) (m : ∀ i, M₁ i) : (f.prod g) m = (f m, g m) := rfl /-- Combine a family of continuous multilinear maps with the same domain and codomains `M' i` into a continuous multilinear map taking values in the space of functions `∀ i, M' i`. -/ def pi {ι' : Type*} {M' : ι' → Type*} [∀ i, AddCommMonoid (M' i)] [∀ i, TopologicalSpace (M' i)] [∀ i, Module R (M' i)] (f : ∀ i, ContinuousMultilinearMap R M₁ (M' i)) : ContinuousMultilinearMap R M₁ (∀ i, M' i) where cont := continuous_pi fun i => (f i).coe_continuous toMultilinearMap := MultilinearMap.pi fun i => (f i).toMultilinearMap @[simp] theorem coe_pi {ι' : Type*} {M' : ι' → Type*} [∀ i, AddCommMonoid (M' i)] [∀ i, TopologicalSpace (M' i)] [∀ i, Module R (M' i)] (f : ∀ i, ContinuousMultilinearMap R M₁ (M' i)) : ⇑(pi f) = fun m j => f j m := rfl theorem pi_apply {ι' : Type*} {M' : ι' → Type*} [∀ i, AddCommMonoid (M' i)] [∀ i, TopologicalSpace (M' i)] [∀ i, Module R (M' i)] (f : ∀ i, ContinuousMultilinearMap R M₁ (M' i)) (m : ∀ i, M₁ i) (j : ι') : pi f m j = f j m := rfl /-- Restrict the codomain of a continuous multilinear map to a submodule. -/ @[simps! toMultilinearMap apply_coe] def codRestrict (f : ContinuousMultilinearMap R M₁ M₂) (p : Submodule R M₂) (h : ∀ v, f v ∈ p) : ContinuousMultilinearMap R M₁ p := ⟨f.1.codRestrict p h, f.cont.subtype_mk _⟩ section variable (R M₂ M₃) /-- The natural equivalence between continuous linear maps from `M₂` to `M₃` and continuous 1-multilinear maps from `M₂` to `M₃`. -/ @[simps! apply_toMultilinearMap apply_apply symm_apply_apply] def ofSubsingleton [Subsingleton ι] (i : ι) : (M₂ →L[R] M₃) ≃ ContinuousMultilinearMap R (fun _ : ι => M₂) M₃ where toFun f := ⟨MultilinearMap.ofSubsingleton R M₂ M₃ i f, (map_continuous f).comp (continuous_apply i)⟩ invFun f := ⟨(MultilinearMap.ofSubsingleton R M₂ M₃ i).symm f.toMultilinearMap, (map_continuous f).comp <| continuous_pi fun _ ↦ continuous_id⟩ left_inv _ := rfl right_inv f := toMultilinearMap_injective <| (MultilinearMap.ofSubsingleton R M₂ M₃ i).apply_symm_apply f.toMultilinearMap variable (M₁) {M₂} /-- The constant map is multilinear when `ι` is empty. -/ @[simps! toMultilinearMap apply] def constOfIsEmpty [IsEmpty ι] (m : M₂) : ContinuousMultilinearMap R M₁ M₂ where toMultilinearMap := MultilinearMap.constOfIsEmpty R _ m cont := continuous_const end /-- If `g` is continuous multilinear and `f` is a collection of continuous linear maps, then `g (f₁ m₁, ..., fₙ mₙ)` is again a continuous multilinear map, that we call `g.compContinuousLinearMap f`. -/ def compContinuousLinearMap (g : ContinuousMultilinearMap R M₁' M₄) (f : ∀ i : ι, M₁ i →L[R] M₁' i) : ContinuousMultilinearMap R M₁ M₄ := { g.toMultilinearMap.compLinearMap fun i => (f i).toLinearMap with cont := g.cont.comp <| continuous_pi fun j => (f j).cont.comp <| continuous_apply _ } @[simp] theorem compContinuousLinearMap_apply (g : ContinuousMultilinearMap R M₁' M₄) (f : ∀ i : ι, M₁ i →L[R] M₁' i) (m : ∀ i, M₁ i) : g.compContinuousLinearMap f m = g fun i => f i <| m i := rfl /-- Composing a continuous multilinear map with a continuous linear map gives again a continuous multilinear map. -/ def _root_.ContinuousLinearMap.compContinuousMultilinearMap (g : M₂ →L[R] M₃) (f : ContinuousMultilinearMap R M₁ M₂) : ContinuousMultilinearMap R M₁ M₃ := { g.toLinearMap.compMultilinearMap f.toMultilinearMap with cont := g.cont.comp f.cont } @[simp] theorem _root_.ContinuousLinearMap.compContinuousMultilinearMap_coe (g : M₂ →L[R] M₃) (f : ContinuousMultilinearMap R M₁ M₂) : (g.compContinuousMultilinearMap f : (∀ i, M₁ i) → M₃) = (g : M₂ → M₃) ∘ (f : (∀ i, M₁ i) → M₂) := by ext m rfl /-- `ContinuousMultilinearMap.pi` as an `Equiv`. -/ @[simps] def piEquiv {ι' : Type*} {M' : ι' → Type*} [∀ i, AddCommMonoid (M' i)] [∀ i, TopologicalSpace (M' i)] [∀ i, Module R (M' i)] : (∀ i, ContinuousMultilinearMap R M₁ (M' i)) ≃ ContinuousMultilinearMap R M₁ (∀ i, M' i) where toFun := ContinuousMultilinearMap.pi invFun f i := (ContinuousLinearMap.proj i : _ →L[R] M' i).compContinuousMultilinearMap f left_inv f := by ext rfl right_inv f := by ext rfl /-- An equivalence of the index set defines an equivalence between the spaces of continuous multilinear maps. This is the forward map of this equivalence. -/ @[simps! toMultilinearMap apply] nonrec def domDomCongr {ι' : Type*} (e : ι ≃ ι') (f : ContinuousMultilinearMap R (fun _ : ι => M₂) M₃) : ContinuousMultilinearMap R (fun _ : ι' => M₂) M₃ where toMultilinearMap := f.domDomCongr e cont := f.cont.comp <| continuous_pi fun _ => continuous_apply _ /-- An equivalence of the index set defines an equivalence between the spaces of continuous multilinear maps. In case of normed spaces, this is a linear isometric equivalence, see `ContinuousMultilinearMap.domDomCongrₗᵢ`. -/ @[simps] def domDomCongrEquiv {ι' : Type*} (e : ι ≃ ι') : ContinuousMultilinearMap R (fun _ : ι => M₂) M₃ ≃ ContinuousMultilinearMap R (fun _ : ι' => M₂) M₃ where toFun := domDomCongr e invFun := domDomCongr e.symm left_inv _ := ext fun _ => by simp right_inv _ := ext fun _ => by simp section linearDeriv variable [ContinuousAdd M₂] [DecidableEq ι] [Fintype ι] (x y : ∀ i, M₁ i) /-- The derivative of a continuous multilinear map, as a continuous linear map from `∀ i, M₁ i` to `M₂`; see `ContinuousMultilinearMap.hasFDerivAt`. -/ def linearDeriv : (∀ i, M₁ i) →L[R] M₂ := ∑ i : ι, (f.toContinuousLinearMap x i).comp (.proj i) @[simp] lemma linearDeriv_apply : f.linearDeriv x y = ∑ i, f (Function.update x i (y i)) := by unfold linearDeriv toContinuousLinearMap simp only [ContinuousLinearMap.coe_sum', ContinuousLinearMap.coe_comp', ContinuousLinearMap.coe_mk', LinearMap.coe_mk, LinearMap.coe_toAddHom, Finset.sum_apply] rfl end linearDeriv /-- In the specific case of continuous multilinear maps on spaces indexed by `Fin (n+1)`, where one can build an element of `(i : Fin (n+1)) → M i` using `cons`, one can express directly the additivity of a multilinear map along the first variable. -/ theorem cons_add (f : ContinuousMultilinearMap R M M₂) (m : ∀ i : Fin n, M i.succ) (x y : M 0) : f (cons (x + y) m) = f (cons x m) + f (cons y m) := f.toMultilinearMap.cons_add m x y /-- In the specific case of continuous multilinear maps on spaces indexed by `Fin (n+1)`, where one can build an element of `(i : Fin (n+1)) → M i` using `cons`, one can express directly the multiplicativity of a multilinear map along the first variable. -/ theorem cons_smul (f : ContinuousMultilinearMap R M M₂) (m : ∀ i : Fin n, M i.succ) (c : R) (x : M 0) : f (cons (c • x) m) = c • f (cons x m) := f.toMultilinearMap.cons_smul m c x theorem map_piecewise_add [DecidableEq ι] (m m' : ∀ i, M₁ i) (t : Finset ι) : f (t.piecewise (m + m') m') = ∑ s ∈ t.powerset, f (s.piecewise m m') := f.toMultilinearMap.map_piecewise_add _ _ _ /-- Additivity of a continuous multilinear map along all coordinates at the same time, writing `f (m + m')` as the sum of `f (s.piecewise m m')` over all sets `s`. -/ theorem map_add_univ [DecidableEq ι] [Fintype ι] (m m' : ∀ i, M₁ i) : f (m + m') = ∑ s : Finset ι, f (s.piecewise m m') := f.toMultilinearMap.map_add_univ _ _ section ApplySum open Fintype Finset variable {α : ι → Type*} [Fintype ι] (g : ∀ i, α i → M₁ i) (A : ∀ i, Finset (α i)) /-- If `f` is continuous multilinear, then `f (Σ_{j₁ ∈ A₁} g₁ j₁, ..., Σ_{jₙ ∈ Aₙ} gₙ jₙ)` is the sum of `f (g₁ (r 1), ..., gₙ (r n))` where `r` ranges over all functions with `r 1 ∈ A₁`, ..., `r n ∈ Aₙ`. This follows from multilinearity by expanding successively with respect to each coordinate. -/ theorem map_sum_finset [DecidableEq ι] : (f fun i => ∑ j ∈ A i, g i j) = ∑ r ∈ piFinset A, f fun i => g i (r i) := f.toMultilinearMap.map_sum_finset _ _ /-- If `f` is continuous multilinear, then `f (Σ_{j₁} g₁ j₁, ..., Σ_{jₙ} gₙ jₙ)` is the sum of `f (g₁ (r 1), ..., gₙ (r n))` where `r` ranges over all functions `r`. This follows from multilinearity by expanding successively with respect to each coordinate. -/ theorem map_sum [DecidableEq ι] [∀ i, Fintype (α i)] : (f fun i => ∑ j, g i j) = ∑ r : ∀ i, α i, f fun i => g i (r i) := f.toMultilinearMap.map_sum _ end ApplySum section RestrictScalar variable (R) variable {A : Type*} [Semiring A] [SMul R A] [∀ i : ι, Module A (M₁ i)] [Module A M₂] [∀ i, IsScalarTower R A (M₁ i)] [IsScalarTower R A M₂] /-- Reinterpret an `A`-multilinear map as an `R`-multilinear map, if `A` is an algebra over `R` and their actions on all involved modules agree with the action of `R` on `A`. -/ def restrictScalars (f : ContinuousMultilinearMap A M₁ M₂) : ContinuousMultilinearMap R M₁ M₂ where toMultilinearMap := f.toMultilinearMap.restrictScalars R cont := f.cont @[simp] theorem coe_restrictScalars (f : ContinuousMultilinearMap A M₁ M₂) : ⇑(f.restrictScalars R) = f := rfl end RestrictScalar end Semiring section Ring variable [Ring R] [∀ i, AddCommGroup (M₁ i)] [AddCommGroup M₂] [∀ i, Module R (M₁ i)] [Module R M₂] [∀ i, TopologicalSpace (M₁ i)] [TopologicalSpace M₂] (f f' : ContinuousMultilinearMap R M₁ M₂) @[simp] theorem map_sub [DecidableEq ι] (m : ∀ i, M₁ i) (i : ι) (x y : M₁ i) : f (update m i (x - y)) = f (update m i x) - f (update m i y) := f.toMultilinearMap.map_sub _ _ _ _ section TopologicalAddGroup variable [TopologicalAddGroup M₂] instance : Neg (ContinuousMultilinearMap R M₁ M₂) := ⟨fun f => { -f.toMultilinearMap with cont := f.cont.neg }⟩ @[simp] theorem neg_apply (m : ∀ i, M₁ i) : (-f) m = -f m := rfl instance : Sub (ContinuousMultilinearMap R M₁ M₂) := ⟨fun f g => { f.toMultilinearMap - g.toMultilinearMap with cont := f.cont.sub g.cont }⟩ @[simp] theorem sub_apply (m : ∀ i, M₁ i) : (f - f') m = f m - f' m := rfl instance : AddCommGroup (ContinuousMultilinearMap R M₁ M₂) := toMultilinearMap_injective.addCommGroup _ rfl (fun _ _ => rfl) (fun _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl) fun _ _ => rfl end TopologicalAddGroup end Ring section CommSemiring variable [CommSemiring R] [∀ i, AddCommMonoid (M₁ i)] [AddCommMonoid M₂] [∀ i, Module R (M₁ i)] [Module R M₂] [∀ i, TopologicalSpace (M₁ i)] [TopologicalSpace M₂] (f : ContinuousMultilinearMap R M₁ M₂) theorem map_piecewise_smul [DecidableEq ι] (c : ι → R) (m : ∀ i, M₁ i) (s : Finset ι) : f (s.piecewise (fun i => c i • m i) m) = (∏ i ∈ s, c i) • f m := f.toMultilinearMap.map_piecewise_smul _ _ _ /-- Multiplicativity of a continuous multilinear map along all coordinates at the same time, writing `f (fun i ↦ c i • m i)` as `(∏ i, c i) • f m`. -/ theorem map_smul_univ [Fintype ι] (c : ι → R) (m : ∀ i, M₁ i) : (f fun i => c i • m i) = (∏ i, c i) • f m := f.toMultilinearMap.map_smul_univ _ _ end CommSemiring section DistribMulAction variable {R' R'' A : Type*} [Monoid R'] [Monoid R''] [Semiring A] [∀ i, AddCommMonoid (M₁ i)] [AddCommMonoid M₂] [∀ i, TopologicalSpace (M₁ i)] [TopologicalSpace M₂] [∀ i, Module A (M₁ i)] [Module A M₂] [DistribMulAction R' M₂] [ContinuousConstSMul R' M₂] [SMulCommClass A R' M₂] [DistribMulAction R'' M₂] [ContinuousConstSMul R'' M₂] [SMulCommClass A R'' M₂] instance [ContinuousAdd M₂] : DistribMulAction R' (ContinuousMultilinearMap A M₁ M₂) := Function.Injective.distribMulAction { toFun := toMultilinearMap, map_zero' := toMultilinearMap_zero, map_add' := toMultilinearMap_add } toMultilinearMap_injective fun _ _ => rfl end DistribMulAction section Module variable {R' A : Type*} [Semiring R'] [Semiring A] [∀ i, AddCommMonoid (M₁ i)] [AddCommMonoid M₂] [∀ i, TopologicalSpace (M₁ i)] [TopologicalSpace M₂] [ContinuousAdd M₂] [∀ i, Module A (M₁ i)] [Module A M₂] [Module R' M₂] [ContinuousConstSMul R' M₂] [SMulCommClass A R' M₂] /-- The space of continuous multilinear maps over an algebra over `R` is a module over `R`, for the pointwise addition and scalar multiplication. -/ instance : Module R' (ContinuousMultilinearMap A M₁ M₂) := Function.Injective.module _ { toFun := toMultilinearMap, map_zero' := toMultilinearMap_zero, map_add' := toMultilinearMap_add } toMultilinearMap_injective fun _ _ => rfl /-- Linear map version of the map `toMultilinearMap` associating to a continuous multilinear map the corresponding multilinear map. -/ @[simps] def toMultilinearMapLinear : ContinuousMultilinearMap A M₁ M₂ →ₗ[R'] MultilinearMap A M₁ M₂ where toFun := toMultilinearMap map_add' := toMultilinearMap_add map_smul' := toMultilinearMap_smul /-- `ContinuousMultilinearMap.pi` as a `LinearEquiv`. -/ @[simps (config := { simpRhs := true })] def piLinearEquiv {ι' : Type*} {M' : ι' → Type*} [∀ i, AddCommMonoid (M' i)] [∀ i, TopologicalSpace (M' i)] [∀ i, ContinuousAdd (M' i)] [∀ i, Module R' (M' i)] [∀ i, Module A (M' i)] [∀ i, SMulCommClass A R' (M' i)] [∀ i, ContinuousConstSMul R' (M' i)] : (∀ i, ContinuousMultilinearMap A M₁ (M' i)) ≃ₗ[R'] ContinuousMultilinearMap A M₁ (∀ i, M' i) := { piEquiv with map_add' := fun _ _ => rfl map_smul' := fun _ _ => rfl } end Module section CommAlgebra variable (R ι) (A : Type*) [Fintype ι] [CommSemiring R] [CommSemiring A] [Algebra R A] [TopologicalSpace A] [ContinuousMul A] /-- The continuous multilinear map on `A^ι`, where `A` is a normed commutative algebra over `𝕜`, associating to `m` the product of all the `m i`. See also `ContinuousMultilinearMap.mkPiAlgebraFin`. -/ protected def mkPiAlgebra : ContinuousMultilinearMap R (fun _ : ι => A) A where cont := continuous_finset_prod _ fun _ _ => continuous_apply _ toMultilinearMap := MultilinearMap.mkPiAlgebra R ι A @[simp] theorem mkPiAlgebra_apply (m : ι → A) : ContinuousMultilinearMap.mkPiAlgebra R ι A m = ∏ i, m i := rfl end CommAlgebra section Algebra variable (R n) (A : Type*) [CommSemiring R] [Semiring A] [Algebra R A] [TopologicalSpace A] [ContinuousMul A] /-- The continuous multilinear map on `A^n`, where `A` is a normed algebra over `𝕜`, associating to `m` the product of all the `m i`. See also: `ContinuousMultilinearMap.mkPiAlgebra`. -/ protected def mkPiAlgebraFin : A[×n]→L[R] A where cont := by change Continuous fun m => (List.ofFn m).prod simp_rw [List.ofFn_eq_map] exact continuous_list_prod _ fun i _ => continuous_apply _ toMultilinearMap := MultilinearMap.mkPiAlgebraFin R n A variable {R n A} @[simp] theorem mkPiAlgebraFin_apply (m : Fin n → A) : ContinuousMultilinearMap.mkPiAlgebraFin R n A m = (List.ofFn m).prod := rfl end Algebra section SMulRight variable [CommSemiring R] [∀ i, AddCommMonoid (M₁ i)] [AddCommMonoid M₂] [∀ i, Module R (M₁ i)] [Module R M₂] [TopologicalSpace R] [∀ i, TopologicalSpace (M₁ i)] [TopologicalSpace M₂] [ContinuousSMul R M₂] (f : ContinuousMultilinearMap R M₁ R) (z : M₂) /-- Given a continuous `R`-multilinear map `f` taking values in `R`, `f.smulRight z` is the continuous multilinear map sending `m` to `f m • z`. -/ @[simps! toMultilinearMap apply] def smulRight : ContinuousMultilinearMap R M₁ M₂ where toMultilinearMap := f.toMultilinearMap.smulRight z cont := f.cont.smul continuous_const end SMulRight section CommRing variable {M : Type*} variable [Fintype ι] [CommRing R] [AddCommMonoid M] [Module R M] variable [TopologicalSpace R] [TopologicalSpace M] variable [ContinuousMul R] [ContinuousSMul R M] variable (R ι) in /-- The canonical continuous multilinear map on `R^ι`, associating to `m` the product of all the `m i` (multiplied by a fixed reference element `z` in the target module) -/ protected def mkPiRing (z : M) : ContinuousMultilinearMap R (fun _ : ι => R) M := (ContinuousMultilinearMap.mkPiAlgebra R ι R).smulRight z @[simp] theorem mkPiRing_apply (z : M) (m : ι → R) : (ContinuousMultilinearMap.mkPiRing R ι z : (ι → R) → M) m = (∏ i, m i) • z := rfl theorem mkPiRing_apply_one_eq_self (f : ContinuousMultilinearMap R (fun _ : ι => R) M) : ContinuousMultilinearMap.mkPiRing R ι (f fun _ => 1) = f := toMultilinearMap_injective f.toMultilinearMap.mkPiRing_apply_one_eq_self theorem mkPiRing_eq_iff {z₁ z₂ : M} : ContinuousMultilinearMap.mkPiRing R ι z₁ = ContinuousMultilinearMap.mkPiRing R ι z₂ ↔ z₁ = z₂ := by rw [← toMultilinearMap_injective.eq_iff] exact MultilinearMap.mkPiRing_eq_iff theorem mkPiRing_zero : ContinuousMultilinearMap.mkPiRing R ι (0 : M) = 0 := by ext; rw [mkPiRing_apply, smul_zero, ContinuousMultilinearMap.zero_apply] theorem mkPiRing_eq_zero_iff (z : M) : ContinuousMultilinearMap.mkPiRing R ι z = 0 ↔ z = 0 := by rw [← mkPiRing_zero, mkPiRing_eq_iff] end CommRing end ContinuousMultilinearMap
Topology\Algebra\Module\Multilinear\Bounded.lean
/- Copyright (c) 2024 Yury Kudryashov. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yury Kudryashov -/ import Mathlib.Analysis.LocallyConvex.Bounded import Mathlib.Topology.Algebra.Module.Multilinear.Basic /-! # Images of (von Neumann) bounded sets under continuous multilinear maps In this file we prove that continuous multilinear maps send von Neumann bounded sets to von Neumann bounded sets. We prove 2 versions of the theorem: one assumes that the index type is nonempty, and the other assumes that the codomain is a topological vector space. ## Implementation notes We do not assume the index type `ι` to be finite. While for a nonzero continuous multilinear map the family `∀ i, E i` has to be essentially finite (more precisely, all but finitely many `E i` has to be trivial), proving theorems without a `[Finite ι]` assumption saves us some typeclass searches here and there. -/ open Bornology Filter Set Function open scoped Topology namespace Bornology.IsVonNBounded variable {ι 𝕜 F : Type*} {E : ι → Type*} [NormedField 𝕜] [∀ i, AddCommGroup (E i)] [∀ i, Module 𝕜 (E i)] [∀ i, TopologicalSpace (E i)] [AddCommGroup F] [Module 𝕜 F] [TopologicalSpace F] /-- The image of a von Neumann bounded set under a continuous multilinear map is von Neumann bounded. This version does not assume that the topologies on the domain and on the codomain agree with the vector space structure in any way but it assumes that `ι` is nonempty. -/ theorem image_multilinear' [Nonempty ι] {s : Set (∀ i, E i)} (hs : IsVonNBounded 𝕜 s) (f : ContinuousMultilinearMap 𝕜 E F) : IsVonNBounded 𝕜 (f '' s) := fun V hV ↦ by classical if h₁ : ∀ c : 𝕜, ‖c‖ ≤ 1 then exact absorbs_iff_norm.2 ⟨2, fun c hc ↦ by linarith [h₁ c]⟩ else let _ : NontriviallyNormedField 𝕜 := ⟨by simpa using h₁⟩ obtain ⟨I, t, ht₀, hft⟩ : ∃ (I : Finset ι) (t : ∀ i, Set (E i)), (∀ i, t i ∈ 𝓝 0) ∧ Set.pi I t ⊆ f ⁻¹' V := by have hfV : f ⁻¹' V ∈ 𝓝 0 := (map_continuous f).tendsto' _ _ f.map_zero hV rwa [nhds_pi, Filter.mem_pi, exists_finite_iff_finset] at hfV have : ∀ i, ∃ c : 𝕜, c ≠ 0 ∧ ∀ c' : 𝕜, ‖c'‖ ≤ ‖c‖ → ∀ x ∈ s, c' • x i ∈ t i := fun i ↦ by rw [isVonNBounded_pi_iff] at hs have := (hs i).tendsto_smallSets_nhds.eventually (mem_lift' (ht₀ i)) rcases NormedAddCommGroup.nhds_zero_basis_norm_lt.eventually_iff.1 this with ⟨r, hr₀, hr⟩ rcases NormedField.exists_norm_lt 𝕜 hr₀ with ⟨c, hc₀, hc⟩ refine ⟨c, norm_pos_iff.1 hc₀, fun c' hle x hx ↦ ?_⟩ exact hr (hle.trans_lt hc) ⟨_, ⟨x, hx, rfl⟩, rfl⟩ choose c hc₀ hc using this rw [absorbs_iff_eventually_nhds_zero (mem_of_mem_nhds hV), NormedAddCommGroup.nhds_zero_basis_norm_lt.eventually_iff] have hc₀' : ∏ i ∈ I, c i ≠ 0 := Finset.prod_ne_zero_iff.2 fun i _ ↦ hc₀ i refine ⟨‖∏ i ∈ I, c i‖, norm_pos_iff.2 hc₀', fun a ha ↦ mapsTo_image_iff.2 fun x hx ↦ ?_⟩ let ⟨i₀⟩ := ‹Nonempty ι› set y := I.piecewise (fun i ↦ c i • x i) x calc a • f x = f (update y i₀ ((a / ∏ i ∈ I, c i) • y i₀)) := by rw [f.map_smul, update_eq_self, f.map_piecewise_smul, div_eq_mul_inv, mul_smul, inv_smul_smul₀ hc₀'] _ ∈ V := hft fun i hi ↦ by rcases eq_or_ne i i₀ with rfl | hne · simp_rw [update_same, y, I.piecewise_eq_of_mem _ _ hi, smul_smul] refine hc _ _ ?_ _ hx calc ‖(a / ∏ i ∈ I, c i) * c i‖ ≤ (‖∏ i ∈ I, c i‖ / ‖∏ i ∈ I, c i‖) * ‖c i‖ := by rw [norm_mul, norm_div]; gcongr; exact ha.out.le _ ≤ 1 * ‖c i‖ := by gcongr; apply div_self_le_one _ = ‖c i‖ := one_mul _ · simp_rw [update_noteq hne, y, I.piecewise_eq_of_mem _ _ hi] exact hc _ _ le_rfl _ hx /-- The image of a von Neumann bounded set under a continuous multilinear map is von Neumann bounded. This version assumes that the codomain is a topological vector space. -/ theorem image_multilinear [ContinuousSMul 𝕜 F] {s : Set (∀ i, E i)} (hs : IsVonNBounded 𝕜 s) (f : ContinuousMultilinearMap 𝕜 E F) : IsVonNBounded 𝕜 (f '' s) := by cases isEmpty_or_nonempty ι with | inl h => exact (isBounded_iff_isVonNBounded _).1 <| @Set.Finite.isBounded _ (vonNBornology 𝕜 F) _ (s.toFinite.image _) | inr h => exact hs.image_multilinear' f end IsVonNBounded end Bornology
Topology\Algebra\Module\Multilinear\Topology.lean
/- Copyright (c) 2023 Yury Kudryashov. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yury Kudryashov -/ import Mathlib.Topology.Algebra.Module.Multilinear.Bounded import Mathlib.Topology.Algebra.Module.UniformConvergence /-! # Topology on continuous multilinear maps In this file we define `TopologicalSpace` and `UniformSpace` structures on `ContinuousMultilinearMap 𝕜 E F`, where `E i` is a family of vector spaces over `𝕜` with topologies and `F` is a topological vector space. -/ open Bornology Function Set open scoped Topology UniformConvergence Filter namespace ContinuousMultilinearMap variable {𝕜 ι : Type*} {E : ι → Type*} {F : Type*} [NormedField 𝕜] [∀ i, TopologicalSpace (E i)] [∀ i, AddCommGroup (E i)] [∀ i, Module 𝕜 (E i)] [AddCommGroup F] [Module 𝕜 F] /-- An auxiliary definition used to define topology on `ContinuousMultilinearMap 𝕜 E F`. -/ def toUniformOnFun [TopologicalSpace F] (f : ContinuousMultilinearMap 𝕜 E F) : (Π i, E i) →ᵤ[{s | IsVonNBounded 𝕜 s}] F := UniformOnFun.ofFun _ f open UniformOnFun in lemma range_toUniformOnFun [DecidableEq ι] [TopologicalSpace F] : range toUniformOnFun = {f : (Π i, E i) →ᵤ[{s | IsVonNBounded 𝕜 s}] F | Continuous (toFun _ f) ∧ (∀ (m : Π i, E i) i x y, toFun _ f (update m i (x + y)) = toFun _ f (update m i x) + toFun _ f (update m i y)) ∧ (∀ (m : Π i, E i) i (c : 𝕜) x, toFun _ f (update m i (c • x)) = c • toFun _ f (update m i x))} := by ext f constructor · rintro ⟨f, rfl⟩ exact ⟨f.cont, f.map_add, f.map_smul⟩ · rintro ⟨hcont, hadd, hsmul⟩ exact ⟨⟨⟨f, by intro; convert hadd, by intro; convert hsmul⟩, hcont⟩, rfl⟩ @[simp] lemma toUniformOnFun_toFun [TopologicalSpace F] (f : ContinuousMultilinearMap 𝕜 E F) : UniformOnFun.toFun _ f.toUniformOnFun = f := rfl instance instTopologicalSpace [TopologicalSpace F] [TopologicalAddGroup F] : TopologicalSpace (ContinuousMultilinearMap 𝕜 E F) := .induced toUniformOnFun <| @UniformOnFun.topologicalSpace _ _ (TopologicalAddGroup.toUniformSpace F) _ instance instUniformSpace [UniformSpace F] [UniformAddGroup F] : UniformSpace (ContinuousMultilinearMap 𝕜 E F) := .replaceTopology (.comap toUniformOnFun <| UniformOnFun.uniformSpace _ _ _) <| by rw [instTopologicalSpace, UniformAddGroup.toUniformSpace_eq]; rfl section UniformAddGroup variable [UniformSpace F] [UniformAddGroup F] lemma uniformEmbedding_toUniformOnFun : UniformEmbedding (toUniformOnFun : ContinuousMultilinearMap 𝕜 E F → _) where inj := DFunLike.coe_injective comap_uniformity := rfl lemma embedding_toUniformOnFun : Embedding (toUniformOnFun : ContinuousMultilinearMap 𝕜 E F → _) := uniformEmbedding_toUniformOnFun.embedding theorem uniformContinuous_coe_fun [∀ i, ContinuousSMul 𝕜 (E i)] : UniformContinuous (DFunLike.coe : ContinuousMultilinearMap 𝕜 E F → (Π i, E i) → F) := (UniformOnFun.uniformContinuous_toFun isVonNBounded_covers).comp uniformEmbedding_toUniformOnFun.uniformContinuous theorem uniformContinuous_eval_const [∀ i, ContinuousSMul 𝕜 (E i)] (x : Π i, E i) : UniformContinuous fun f : ContinuousMultilinearMap 𝕜 E F ↦ f x := uniformContinuous_pi.1 uniformContinuous_coe_fun x instance instUniformAddGroup : UniformAddGroup (ContinuousMultilinearMap 𝕜 E F) := let φ : ContinuousMultilinearMap 𝕜 E F →+ (Π i, E i) →ᵤ[{s | IsVonNBounded 𝕜 s}] F := { toFun := toUniformOnFun, map_add' := fun _ _ ↦ rfl, map_zero' := rfl } uniformEmbedding_toUniformOnFun.uniformAddGroup φ instance instUniformContinuousConstSMul {M : Type*} [Monoid M] [DistribMulAction M F] [SMulCommClass 𝕜 M F] [ContinuousConstSMul M F] : UniformContinuousConstSMul M (ContinuousMultilinearMap 𝕜 E F) := haveI := uniformContinuousConstSMul_of_continuousConstSMul M F uniformEmbedding_toUniformOnFun.uniformContinuousConstSMul fun _ _ ↦ rfl variable [∀ i, ContinuousSMul 𝕜 (E i)] [ContinuousConstSMul 𝕜 F] [CompleteSpace F] [T2Space F] open UniformOnFun in theorem completeSpace (h : RestrictGenTopology {s : Set (Π i, E i) | IsVonNBounded 𝕜 s}) : CompleteSpace (ContinuousMultilinearMap 𝕜 E F) := by classical have H : ∀ {m : Π i, E i}, Continuous fun f : (Π i, E i) →ᵤ[{s | IsVonNBounded 𝕜 s}] F ↦ toFun _ f m := (uniformContinuous_eval (isVonNBounded_covers) _).continuous rw [completeSpace_iff_isComplete_range uniformEmbedding_toUniformOnFun.toUniformInducing, range_toUniformOnFun] simp only [setOf_and, setOf_forall] apply_rules [IsClosed.isComplete, IsClosed.inter] · exact UniformOnFun.isClosed_setOf_continuous h · exact isClosed_iInter fun m ↦ isClosed_iInter fun i ↦ isClosed_iInter fun x ↦ isClosed_iInter fun y ↦ isClosed_eq H (H.add H) · exact isClosed_iInter fun m ↦ isClosed_iInter fun i ↦ isClosed_iInter fun c ↦ isClosed_iInter fun x ↦ isClosed_eq H (H.const_smul _) instance instCompleteSpace [∀ i, TopologicalAddGroup (E i)] [SequentialSpace (Π i, E i)] : CompleteSpace (ContinuousMultilinearMap 𝕜 E F) := completeSpace <| .of_seq fun _u x hux ↦ (hux.isVonNBounded_range 𝕜).insert x end UniformAddGroup variable [TopologicalSpace F] [TopologicalAddGroup F] instance instContinuousConstSMul {M : Type*} [Monoid M] [DistribMulAction M F] [SMulCommClass 𝕜 M F] [ContinuousConstSMul M F] : ContinuousConstSMul M (ContinuousMultilinearMap 𝕜 E F) := by letI := TopologicalAddGroup.toUniformSpace F haveI := comm_topologicalAddGroup_is_uniform (G := F) infer_instance instance instContinuousSMul [ContinuousSMul 𝕜 F] : ContinuousSMul 𝕜 (ContinuousMultilinearMap 𝕜 E F) := letI := TopologicalAddGroup.toUniformSpace F haveI := comm_topologicalAddGroup_is_uniform (G := F) let φ : ContinuousMultilinearMap 𝕜 E F →ₗ[𝕜] (Π i, E i) → F := { toFun := (↑), map_add' := fun _ _ ↦ rfl, map_smul' := fun _ _ ↦ rfl } UniformOnFun.continuousSMul_induced_of_image_bounded _ _ _ _ φ embedding_toUniformOnFun.toInducing fun _ _ hu ↦ hu.image_multilinear _ theorem hasBasis_nhds_zero_of_basis {ι : Type*} {p : ι → Prop} {b : ι → Set F} (h : (𝓝 (0 : F)).HasBasis p b) : (𝓝 (0 : ContinuousMultilinearMap 𝕜 E F)).HasBasis (fun Si : Set (Π i, E i) × ι => IsVonNBounded 𝕜 Si.1 ∧ p Si.2) fun Si => { f | MapsTo f Si.1 (b Si.2) } := by letI : UniformSpace F := TopologicalAddGroup.toUniformSpace F haveI : UniformAddGroup F := comm_topologicalAddGroup_is_uniform rw [nhds_induced] refine (UniformOnFun.hasBasis_nhds_zero_of_basis _ ?_ ?_ h).comap DFunLike.coe · exact ⟨∅, isVonNBounded_empty _ _⟩ · exact directedOn_of_sup_mem fun _ _ => Bornology.IsVonNBounded.union theorem hasBasis_nhds_zero : (𝓝 (0 : ContinuousMultilinearMap 𝕜 E F)).HasBasis (fun SV : Set (Π i, E i) × Set F => IsVonNBounded 𝕜 SV.1 ∧ SV.2 ∈ 𝓝 0) fun SV => { f | MapsTo f SV.1 SV.2 } := hasBasis_nhds_zero_of_basis (Filter.basis_sets _) variable [∀ i, ContinuousSMul 𝕜 (E i)] theorem continuous_eval_const (x : Π i, E i) : Continuous fun p : ContinuousMultilinearMap 𝕜 E F ↦ p x := by letI := TopologicalAddGroup.toUniformSpace F haveI := comm_topologicalAddGroup_is_uniform (G := F) exact (uniformContinuous_eval_const x).continuous @[deprecated (since := "2024-04-10")] alias continuous_eval_left := continuous_eval_const theorem continuous_coe_fun : Continuous (DFunLike.coe : ContinuousMultilinearMap 𝕜 E F → (Π i, E i) → F) := continuous_pi continuous_eval_const instance instT2Space [T2Space F] : T2Space (ContinuousMultilinearMap 𝕜 E F) := .of_injective_continuous DFunLike.coe_injective continuous_coe_fun variable (𝕜 E F) /-- The application of a multilinear map as a `ContinuousLinearMap`. -/ def apply [ContinuousConstSMul 𝕜 F] (m : Π i, E i) : ContinuousMultilinearMap 𝕜 E F →L[𝕜] F where toFun c := c m map_add' _ _ := rfl map_smul' _ _ := rfl cont := continuous_eval_const m variable {𝕜 E F} @[simp] lemma apply_apply [ContinuousConstSMul 𝕜 F] {m : Π i, E i} {c : ContinuousMultilinearMap 𝕜 E F} : apply 𝕜 E F m c = c m := rfl theorem hasSum_eval {α : Type*} {p : α → ContinuousMultilinearMap 𝕜 E F} {q : ContinuousMultilinearMap 𝕜 E F} (h : HasSum p q) (m : Π i, E i) : HasSum (fun a => p a m) (q m) := h.map (applyAddHom m) (continuous_eval_const m) theorem tsum_eval [T2Space F] {α : Type*} {p : α → ContinuousMultilinearMap 𝕜 E F} (hp : Summable p) (m : Π i, E i) : (∑' a, p a) m = ∑' a, p a m := (hasSum_eval hp.hasSum m).tsum_eq.symm end ContinuousMultilinearMap
Topology\Algebra\Nonarchimedean\AdicTopology.lean
/- Copyright (c) 2021 Patrick Massot. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot -/ import Mathlib.RingTheory.Ideal.Maps import Mathlib.Topology.Algebra.Nonarchimedean.Bases import Mathlib.Topology.Algebra.UniformRing /-! # Adic topology Given a commutative ring `R` and an ideal `I` in `R`, this file constructs the unique topology on `R` which is compatible with the ring structure and such that a set is a neighborhood of zero if and only if it contains a power of `I`. This topology is non-archimedean: every neighborhood of zero contains an open subgroup, namely a power of `I`. It also studies the predicate `IsAdic` which states that a given topological ring structure is adic, proving a characterization and showing that raising an ideal to a positive power does not change the associated topology. Finally, it defines `WithIdeal`, a class registering an ideal in a ring and providing the corresponding adic topology to the type class inference system. ## Main definitions and results * `Ideal.adic_basis`: the basis of submodules given by powers of an ideal. * `Ideal.adicTopology`: the adic topology associated to an ideal. It has the above basis for neighborhoods of zero. * `Ideal.nonarchimedean`: the adic topology is non-archimedean * `isAdic_iff`: A topological ring is `J`-adic if and only if it admits the powers of `J` as a basis of open neighborhoods of zero. * `WithIdeal`: a class registering an ideal in a ring. ## Implementation notes The `I`-adic topology on a ring `R` has a contrived definition using `I^n • ⊤` instead of `I` to make sure it is definitionally equal to the `I`-topology on `R` seen as an `R`-module. -/ variable {R : Type*} [CommRing R] open Set TopologicalAddGroup Submodule Filter open Topology Pointwise namespace Ideal theorem adic_basis (I : Ideal R) : SubmodulesRingBasis fun n : ℕ => (I ^ n • ⊤ : Ideal R) := { inter := by suffices ∀ i j : ℕ, ∃ k, I ^ k ≤ I ^ i ∧ I ^ k ≤ I ^ j by simpa only [smul_eq_mul, mul_top, Algebra.id.map_eq_id, map_id, le_inf_iff] using this intro i j exact ⟨max i j, pow_le_pow_right (le_max_left i j), pow_le_pow_right (le_max_right i j)⟩ leftMul := by suffices ∀ (a : R) (i : ℕ), ∃ j : ℕ, a • I ^ j ≤ I ^ i by simpa only [smul_top_eq_map, Algebra.id.map_eq_id, map_id] using this intro r n use n rintro a ⟨x, hx, rfl⟩ exact (I ^ n).smul_mem r hx mul := by suffices ∀ i : ℕ, ∃ j : ℕ, (↑(I ^ j) * ↑(I ^ j) : Set R) ⊆ (↑(I ^ i) : Set R) by simpa only [smul_top_eq_map, Algebra.id.map_eq_id, map_id] using this intro n use n rintro a ⟨x, _hx, b, hb, rfl⟩ exact (I ^ n).smul_mem x hb } /-- The adic ring filter basis associated to an ideal `I` is made of powers of `I`. -/ def ringFilterBasis (I : Ideal R) := I.adic_basis.toRing_subgroups_basis.toRingFilterBasis /-- The adic topology associated to an ideal `I`. This topology admits powers of `I` as a basis of neighborhoods of zero. It is compatible with the ring structure and is non-archimedean. -/ def adicTopology (I : Ideal R) : TopologicalSpace R := (adic_basis I).topology theorem nonarchimedean (I : Ideal R) : @NonarchimedeanRing R _ I.adicTopology := I.adic_basis.toRing_subgroups_basis.nonarchimedean /-- For the `I`-adic topology, the neighborhoods of zero has basis given by the powers of `I`. -/ theorem hasBasis_nhds_zero_adic (I : Ideal R) : HasBasis (@nhds R I.adicTopology (0 : R)) (fun _n : ℕ => True) fun n => ((I ^ n : Ideal R) : Set R) := ⟨by intro U rw [I.ringFilterBasis.toAddGroupFilterBasis.nhds_zero_hasBasis.mem_iff] constructor · rintro ⟨-, ⟨i, rfl⟩, h⟩ replace h : ↑(I ^ i) ⊆ U := by simpa using h exact ⟨i, trivial, h⟩ · rintro ⟨i, -, h⟩ exact ⟨(I ^ i : Ideal R), ⟨i, by simp⟩, h⟩⟩ theorem hasBasis_nhds_adic (I : Ideal R) (x : R) : HasBasis (@nhds R I.adicTopology x) (fun _n : ℕ => True) fun n => (fun y => x + y) '' (I ^ n : Ideal R) := by letI := I.adicTopology have := I.hasBasis_nhds_zero_adic.map fun y => x + y rwa [map_add_left_nhds_zero x] at this variable (I : Ideal R) (M : Type*) [AddCommGroup M] [Module R M] theorem adic_module_basis : I.ringFilterBasis.SubmodulesBasis fun n : ℕ => I ^ n • (⊤ : Submodule R M) := { inter := fun i j => ⟨max i j, le_inf_iff.mpr ⟨smul_mono_left <| pow_le_pow_right (le_max_left i j), smul_mono_left <| pow_le_pow_right (le_max_right i j)⟩⟩ smul := fun m i => ⟨(I ^ i • ⊤ : Ideal R), ⟨i, by simp⟩, fun a a_in => by replace a_in : a ∈ I ^ i := by simpa [(I ^ i).mul_top] using a_in exact smul_mem_smul a_in mem_top⟩ } /-- The topology on an `R`-module `M` associated to an ideal `M`. Submodules $I^n M$, written `I^n • ⊤` form a basis of neighborhoods of zero. -/ def adicModuleTopology : TopologicalSpace M := @ModuleFilterBasis.topology R M _ I.adic_basis.topology _ _ (I.ringFilterBasis.moduleFilterBasis (I.adic_module_basis M)) /-- The elements of the basis of neighborhoods of zero for the `I`-adic topology on an `R`-module `M`, seen as open additive subgroups of `M`. -/ def openAddSubgroup (n : ℕ) : @OpenAddSubgroup R _ I.adicTopology := by letI := I.adicTopology refine ⟨(I ^ n).toAddSubgroup, ?_⟩ convert (I.adic_basis.toRing_subgroups_basis.openAddSubgroup n).isOpen change (↑(I ^ n) : Set R) = ↑(I ^ n • (⊤ : Ideal R)) simp [smul_top_eq_map, Algebra.id.map_eq_id, map_id, restrictScalars_self] end Ideal section IsAdic /-- Given a topology on a ring `R` and an ideal `J`, `IsAdic J` means the topology is the `J`-adic one. -/ def IsAdic [H : TopologicalSpace R] (J : Ideal R) : Prop := H = J.adicTopology /-- A topological ring is `J`-adic if and only if it admits the powers of `J` as a basis of open neighborhoods of zero. -/ theorem isAdic_iff [top : TopologicalSpace R] [TopologicalRing R] {J : Ideal R} : IsAdic J ↔ (∀ n : ℕ, IsOpen ((J ^ n : Ideal R) : Set R)) ∧ ∀ s ∈ 𝓝 (0 : R), ∃ n : ℕ, ((J ^ n : Ideal R) : Set R) ⊆ s := by constructor · intro H change _ = _ at H rw [H] letI := J.adicTopology constructor · intro n exact (J.openAddSubgroup n).isOpen' · intro s hs simpa using J.hasBasis_nhds_zero_adic.mem_iff.mp hs · rintro ⟨H₁, H₂⟩ apply TopologicalAddGroup.ext · apply @TopologicalRing.to_topologicalAddGroup · apply (RingSubgroupsBasis.toRingFilterBasis _).toAddGroupFilterBasis.isTopologicalAddGroup · ext s letI := Ideal.adic_basis J rw [J.hasBasis_nhds_zero_adic.mem_iff] constructor <;> intro H · rcases H₂ s H with ⟨n, h⟩ exact ⟨n, trivial, h⟩ · rcases H with ⟨n, -, hn⟩ rw [mem_nhds_iff] exact ⟨_, hn, H₁ n, (J ^ n).zero_mem⟩ variable [TopologicalSpace R] [TopologicalRing R] theorem is_ideal_adic_pow {J : Ideal R} (h : IsAdic J) {n : ℕ} (hn : 0 < n) : IsAdic (J ^ n) := by rw [isAdic_iff] at h ⊢ constructor · intro m rw [← pow_mul] apply h.left · intro V hV cases' h.right V hV with m hm use m refine Set.Subset.trans ?_ hm cases n · exfalso exact Nat.not_succ_le_zero 0 hn rw [← pow_mul, Nat.succ_mul] apply Ideal.pow_le_pow_right apply Nat.le_add_left theorem is_bot_adic_iff {A : Type*} [CommRing A] [TopologicalSpace A] [TopologicalRing A] : IsAdic (⊥ : Ideal A) ↔ DiscreteTopology A := by rw [isAdic_iff] constructor · rintro ⟨h, _h'⟩ rw [discreteTopology_iff_isOpen_singleton_zero] simpa using h 1 · intros constructor · simp · intro U U_nhds use 1 simp [mem_of_mem_nhds U_nhds] end IsAdic /-- The ring `R` is equipped with a preferred ideal. -/ class WithIdeal (R : Type*) [CommRing R] where i : Ideal R namespace WithIdeal variable (R) variable [WithIdeal R] instance (priority := 100) : TopologicalSpace R := i.adicTopology instance (priority := 100) : NonarchimedeanRing R := RingSubgroupsBasis.nonarchimedean _ instance (priority := 100) : UniformSpace R := TopologicalAddGroup.toUniformSpace R instance (priority := 100) : UniformAddGroup R := comm_topologicalAddGroup_is_uniform /-- The adic topology on an `R` module coming from the ideal `WithIdeal.I`. This cannot be an instance because `R` cannot be inferred from `M`. -/ def topologicalSpaceModule (M : Type*) [AddCommGroup M] [Module R M] : TopologicalSpace M := (i : Ideal R).adicModuleTopology M /- The next examples are kept to make sure potential future refactors won't break the instance chaining. -/ example : NonarchimedeanRing R := by infer_instance example : TopologicalRing (UniformSpace.Completion R) := by infer_instance example (M : Type*) [AddCommGroup M] [Module R M] : @TopologicalAddGroup M (WithIdeal.topologicalSpaceModule R M) _ := by infer_instance example (M : Type*) [AddCommGroup M] [Module R M] : @ContinuousSMul R M _ _ (WithIdeal.topologicalSpaceModule R M) := by infer_instance example (M : Type*) [AddCommGroup M] [Module R M] : @NonarchimedeanAddGroup M _ (WithIdeal.topologicalSpaceModule R M) := SubmodulesBasis.nonarchimedean _ end WithIdeal
Topology\Algebra\Nonarchimedean\Bases.lean
/- Copyright (c) 2021 Patrick Massot. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot -/ import Mathlib.Topology.Algebra.Nonarchimedean.Basic import Mathlib.Topology.Algebra.FilterBasis import Mathlib.Algebra.Module.Submodule.Pointwise /-! # Neighborhood bases for non-archimedean rings and modules This files contains special families of filter bases on rings and modules that give rise to non-archimedean topologies. The main definition is `RingSubgroupsBasis` which is a predicate on a family of additive subgroups of a ring. The predicate ensures there is a topology `RingSubgroupsBasis.topology` which is compatible with a ring structure and admits the given family as a basis of neighborhoods of zero. In particular the given subgroups become open subgroups (bundled in `RingSubgroupsBasis.openAddSubgroup`) and we get a non-archimedean topological ring (`RingSubgroupsBasis.nonarchimedean`). A special case of this construction is given by `SubmodulesBasis` where the subgroups are sub-modules in a commutative algebra. This important example gives rise to the adic topology (studied in its own file). -/ open Set Filter Function Lattice open Topology Filter Pointwise /-- A family of additive subgroups on a ring `A` is a subgroups basis if it satisfies some axioms ensuring there is a topology on `A` which is compatible with the ring structure and admits this family as a basis of neighborhoods of zero. -/ structure RingSubgroupsBasis {A ι : Type*} [Ring A] (B : ι → AddSubgroup A) : Prop where /-- Condition for `B` to be a filter basis on `A`. -/ inter : ∀ i j, ∃ k, B k ≤ B i ⊓ B j /-- For each set `B` in the submodule basis on `A`, there is another basis element `B'` such that the set-theoretic product `B' * B'` is in `B`. -/ mul : ∀ i, ∃ j, (B j : Set A) * B j ⊆ B i /-- For any element `x : A` and any set `B` in the submodule basis on `A`, there is another basis element `B'` such that `B' * x` is in `B`. -/ leftMul : ∀ x : A, ∀ i, ∃ j, (B j : Set A) ⊆ (x * ·) ⁻¹' B i /-- For any element `x : A` and any set `B` in the submodule basis on `A`, there is another basis element `B'` such that `x * B'` is in `B`. -/ rightMul : ∀ x : A, ∀ i, ∃ j, (B j : Set A) ⊆ (· * x) ⁻¹' B i namespace RingSubgroupsBasis variable {A ι : Type*} [Ring A] theorem of_comm {A ι : Type*} [CommRing A] (B : ι → AddSubgroup A) (inter : ∀ i j, ∃ k, B k ≤ B i ⊓ B j) (mul : ∀ i, ∃ j, (B j : Set A) * B j ⊆ B i) (leftMul : ∀ x : A, ∀ i, ∃ j, (B j : Set A) ⊆ (fun y : A => x * y) ⁻¹' B i) : RingSubgroupsBasis B := { inter mul leftMul rightMul := fun x i ↦ (leftMul x i).imp fun j hj ↦ by simpa only [mul_comm] using hj } /-- Every subgroups basis on a ring leads to a ring filter basis. -/ def toRingFilterBasis [Nonempty ι] {B : ι → AddSubgroup A} (hB : RingSubgroupsBasis B) : RingFilterBasis A where sets := { U | ∃ i, U = B i } nonempty := by inhabit ι exact ⟨B default, default, rfl⟩ inter_sets := by rintro _ _ ⟨i, rfl⟩ ⟨j, rfl⟩ cases' hB.inter i j with k hk use B k constructor · use k · exact hk zero' := by rintro _ ⟨i, rfl⟩ exact (B i).zero_mem add' := by rintro _ ⟨i, rfl⟩ use B i constructor · use i · rintro x ⟨y, y_in, z, z_in, rfl⟩ exact (B i).add_mem y_in z_in neg' := by rintro _ ⟨i, rfl⟩ use B i constructor · use i · intro x x_in exact (B i).neg_mem x_in conj' := by rintro x₀ _ ⟨i, rfl⟩ use B i constructor · use i · simp mul' := by rintro _ ⟨i, rfl⟩ cases' hB.mul i with k hk use B k constructor · use k · exact hk mul_left' := by rintro x₀ _ ⟨i, rfl⟩ cases' hB.leftMul x₀ i with k hk use B k constructor · use k · exact hk mul_right' := by rintro x₀ _ ⟨i, rfl⟩ cases' hB.rightMul x₀ i with k hk use B k constructor · use k · exact hk variable [Nonempty ι] {B : ι → AddSubgroup A} (hB : RingSubgroupsBasis B) theorem mem_addGroupFilterBasis_iff {V : Set A} : V ∈ hB.toRingFilterBasis.toAddGroupFilterBasis ↔ ∃ i, V = B i := Iff.rfl theorem mem_addGroupFilterBasis (i) : (B i : Set A) ∈ hB.toRingFilterBasis.toAddGroupFilterBasis := ⟨i, rfl⟩ /-- The topology defined from a subgroups basis, admitting the given subgroups as a basis of neighborhoods of zero. -/ def topology : TopologicalSpace A := hB.toRingFilterBasis.toAddGroupFilterBasis.topology theorem hasBasis_nhds_zero : HasBasis (@nhds A hB.topology 0) (fun _ => True) fun i => B i := ⟨by intro s rw [hB.toRingFilterBasis.toAddGroupFilterBasis.nhds_zero_hasBasis.mem_iff] constructor · rintro ⟨-, ⟨i, rfl⟩, hi⟩ exact ⟨i, trivial, hi⟩ · rintro ⟨i, -, hi⟩ exact ⟨B i, ⟨i, rfl⟩, hi⟩⟩ theorem hasBasis_nhds (a : A) : HasBasis (@nhds A hB.topology a) (fun _ => True) fun i => { b | b - a ∈ B i } := ⟨by intro s rw [(hB.toRingFilterBasis.toAddGroupFilterBasis.nhds_hasBasis a).mem_iff] simp only [true_and] constructor · rintro ⟨-, ⟨i, rfl⟩, hi⟩ use i suffices h : { b : A | b - a ∈ B i } = (fun y => a + y) '' ↑(B i) by rw [h] assumption simp only [image_add_left, neg_add_eq_sub] ext b simp · rintro ⟨i, hi⟩ use B i constructor · use i · rw [image_subset_iff] rintro b b_in apply hi simpa using b_in⟩ /-- Given a subgroups basis, the basis elements as open additive subgroups in the associated topology. -/ def openAddSubgroup (i : ι) : @OpenAddSubgroup A _ hB.topology := -- Porting note: failed to synthesize instance `TopologicalSpace A` let _ := hB.topology { B i with isOpen' := by rw [isOpen_iff_mem_nhds] intro a a_in rw [(hB.hasBasis_nhds a).mem_iff] use i, trivial rintro b b_in simpa using (B i).add_mem a_in b_in } -- see Note [nonarchimedean non instances] theorem nonarchimedean : @NonarchimedeanRing A _ hB.topology := by letI := hB.topology constructor intro U hU obtain ⟨i, -, hi : (B i : Set A) ⊆ U⟩ := hB.hasBasis_nhds_zero.mem_iff.mp hU exact ⟨hB.openAddSubgroup i, hi⟩ end RingSubgroupsBasis variable {ι R A : Type*} [CommRing R] [CommRing A] [Algebra R A] /-- A family of submodules in a commutative `R`-algebra `A` is a submodules basis if it satisfies some axioms ensuring there is a topology on `A` which is compatible with the ring structure and admits this family as a basis of neighborhoods of zero. -/ structure SubmodulesRingBasis (B : ι → Submodule R A) : Prop where /-- Condition for `B` to be a filter basis on `A`. -/ inter : ∀ i j, ∃ k, B k ≤ B i ⊓ B j /-- For any element `a : A` and any set `B` in the submodule basis on `A`, there is another basis element `B'` such that `a • B'` is in `B`. -/ leftMul : ∀ (a : A) (i), ∃ j, a • B j ≤ B i /-- For each set `B` in the submodule basis on `A`, there is another basis element `B'` such that the set-theoretic product `B' * B'` is in `B`. -/ mul : ∀ i, ∃ j, (B j : Set A) * B j ⊆ B i namespace SubmodulesRingBasis variable {B : ι → Submodule R A} (hB : SubmodulesRingBasis B) theorem toRing_subgroups_basis (hB : SubmodulesRingBasis B) : RingSubgroupsBasis fun i => (B i).toAddSubgroup := by apply RingSubgroupsBasis.of_comm (fun i => (B i).toAddSubgroup) hB.inter hB.mul intro a i rcases hB.leftMul a i with ⟨j, hj⟩ use j rintro b (b_in : b ∈ B j) exact hj ⟨b, b_in, rfl⟩ /-- The topology associated to a basis of submodules in an algebra. -/ def topology [Nonempty ι] (hB : SubmodulesRingBasis B) : TopologicalSpace A := hB.toRing_subgroups_basis.topology end SubmodulesRingBasis variable {M : Type*} [AddCommGroup M] [Module R M] /-- A family of submodules in an `R`-module `M` is a submodules basis if it satisfies some axioms ensuring there is a topology on `M` which is compatible with the module structure and admits this family as a basis of neighborhoods of zero. -/ structure SubmodulesBasis [TopologicalSpace R] (B : ι → Submodule R M) : Prop where /-- Condition for `B` to be a filter basis on `M`. -/ inter : ∀ i j, ∃ k, B k ≤ B i ⊓ B j /-- For any element `m : M` and any set `B` in the basis, `a • m` lies in `B` for all `a` sufficiently close to `0`. -/ smul : ∀ (m : M) (i : ι), ∀ᶠ a in 𝓝 (0 : R), a • m ∈ B i namespace SubmodulesBasis variable [TopologicalSpace R] [Nonempty ι] {B : ι → Submodule R M} (hB : SubmodulesBasis B) /-- The image of a submodules basis is a module filter basis. -/ def toModuleFilterBasis : ModuleFilterBasis R M where sets := { U | ∃ i, U = B i } nonempty := by inhabit ι exact ⟨B default, default, rfl⟩ inter_sets := by rintro _ _ ⟨i, rfl⟩ ⟨j, rfl⟩ cases' hB.inter i j with k hk use B k constructor · use k · exact hk zero' := by rintro _ ⟨i, rfl⟩ exact (B i).zero_mem add' := by rintro _ ⟨i, rfl⟩ use B i constructor · use i · rintro x ⟨y, y_in, z, z_in, rfl⟩ exact (B i).add_mem y_in z_in neg' := by rintro _ ⟨i, rfl⟩ use B i constructor · use i · intro x x_in exact (B i).neg_mem x_in conj' := by rintro x₀ _ ⟨i, rfl⟩ use B i constructor · use i · simp smul' := by rintro _ ⟨i, rfl⟩ use univ constructor · exact univ_mem · use B i constructor · use i · rintro _ ⟨a, -, m, hm, rfl⟩ exact (B i).smul_mem _ hm smul_left' := by rintro x₀ _ ⟨i, rfl⟩ use B i constructor · use i · intro m exact (B i).smul_mem _ smul_right' := by rintro m₀ _ ⟨i, rfl⟩ exact hB.smul m₀ i /-- The topology associated to a basis of submodules in a module. -/ def topology : TopologicalSpace M := hB.toModuleFilterBasis.toAddGroupFilterBasis.topology /-- Given a submodules basis, the basis elements as open additive subgroups in the associated topology. -/ def openAddSubgroup (i : ι) : @OpenAddSubgroup M _ hB.topology := let _ := hB.topology -- Porting note: failed to synthesize instance `TopologicalSpace A` { (B i).toAddSubgroup with isOpen' := by letI := hB.topology rw [isOpen_iff_mem_nhds] intro a a_in rw [(hB.toModuleFilterBasis.toAddGroupFilterBasis.nhds_hasBasis a).mem_iff] use B i constructor · use i · rintro - ⟨b, b_in, rfl⟩ exact (B i).add_mem a_in b_in } -- see Note [nonarchimedean non instances] theorem nonarchimedean (hB : SubmodulesBasis B) : @NonarchimedeanAddGroup M _ hB.topology := by letI := hB.topology constructor intro U hU obtain ⟨-, ⟨i, rfl⟩, hi : (B i : Set M) ⊆ U⟩ := hB.toModuleFilterBasis.toAddGroupFilterBasis.nhds_zero_hasBasis.mem_iff.mp hU exact ⟨hB.openAddSubgroup i, hi⟩ library_note "nonarchimedean non instances"/-- The non archimedean subgroup basis lemmas cannot be instances because some instances (such as `MeasureTheory.AEEqFun.instAddMonoid` or `topological_add_group.to_has_continuous_add`) cause the search for `@TopologicalAddGroup β ?m1 ?m2`, i.e. a search for a topological group where the topology/group structure are unknown. -/ end SubmodulesBasis section /- In this section, we check that in an `R`-algebra `A` over a ring equipped with a topology, a basis of `R`-submodules which is compatible with the topology on `R` is also a submodule basis in the sense of `R`-modules (forgetting about the ring structure on `A`) and those two points of view definitionaly gives the same topology on `A`. -/ variable [TopologicalSpace R] {B : ι → Submodule R A} (hB : SubmodulesRingBasis B) (hsmul : ∀ (m : A) (i : ι), ∀ᶠ a : R in 𝓝 0, a • m ∈ B i) theorem SubmodulesRingBasis.toSubmodulesBasis : SubmodulesBasis B := { inter := hB.inter smul := hsmul } example [Nonempty ι] : hB.topology = (hB.toSubmodulesBasis hsmul).topology := rfl end /-- Given a ring filter basis on a commutative ring `R`, define a compatibility condition on a family of submodules of an `R`-module `M`. This compatibility condition allows to get a topological module structure. -/ structure RingFilterBasis.SubmodulesBasis (BR : RingFilterBasis R) (B : ι → Submodule R M) : Prop where /-- Condition for `B` to be a filter basis on `M`. -/ inter : ∀ i j, ∃ k, B k ≤ B i ⊓ B j /-- For any element `m : M` and any set `B i` in the submodule basis on `M`, there is a `U` in the ring filter basis on `R` such that `U * m` is in `B i`. -/ smul : ∀ (m : M) (i : ι), ∃ U ∈ BR, U ⊆ (· • m) ⁻¹' B i theorem RingFilterBasis.submodulesBasisIsBasis (BR : RingFilterBasis R) {B : ι → Submodule R M} (hB : BR.SubmodulesBasis B) : @_root_.SubmodulesBasis ι R _ M _ _ BR.topology B := let _ := BR.topology -- Porting note: failed to synthesize instance `TopologicalSpace R` { inter := hB.inter smul := by letI := BR.topology intro m i rcases hB.smul m i with ⟨V, V_in, hV⟩ exact mem_of_superset (BR.toAddGroupFilterBasis.mem_nhds_zero V_in) hV } /-- The module filter basis associated to a ring filter basis and a compatible submodule basis. This allows to build a topological module structure compatible with the given module structure and the topology associated to the given ring filter basis. -/ def RingFilterBasis.moduleFilterBasis [Nonempty ι] (BR : RingFilterBasis R) {B : ι → Submodule R M} (hB : BR.SubmodulesBasis B) : @ModuleFilterBasis R M _ BR.topology _ _ := @SubmodulesBasis.toModuleFilterBasis ι R _ M _ _ BR.topology _ _ (BR.submodulesBasisIsBasis hB)
Topology\Algebra\Nonarchimedean\Basic.lean
/- Copyright (c) 2021 Ashwin Iyengar. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kevin Buzzard, Johan Commelin, Ashwin Iyengar, Patrick Massot -/ import Mathlib.Algebra.Group.Subgroup.Basic import Mathlib.Topology.Algebra.OpenSubgroup import Mathlib.Topology.Algebra.Ring.Basic /-! # Nonarchimedean Topology In this file we set up the theory of nonarchimedean topological groups and rings. A nonarchimedean group is a topological group whose topology admits a basis of open neighborhoods of the identity element in the group consisting of open subgroups. A nonarchimedean ring is a topological ring whose underlying topological (additive) group is nonarchimedean. ## Definitions - `NonarchimedeanAddGroup`: nonarchimedean additive group. - `NonarchimedeanGroup`: nonarchimedean multiplicative group. - `NonarchimedeanRing`: nonarchimedean ring. -/ open scoped Pointwise Topology /-- A topological additive group is nonarchimedean if every neighborhood of 0 contains an open subgroup. -/ class NonarchimedeanAddGroup (G : Type*) [AddGroup G] [TopologicalSpace G] extends TopologicalAddGroup G : Prop where is_nonarchimedean : ∀ U ∈ 𝓝 (0 : G), ∃ V : OpenAddSubgroup G, (V : Set G) ⊆ U /-- A topological group is nonarchimedean if every neighborhood of 1 contains an open subgroup. -/ @[to_additive] class NonarchimedeanGroup (G : Type*) [Group G] [TopologicalSpace G] extends TopologicalGroup G : Prop where is_nonarchimedean : ∀ U ∈ 𝓝 (1 : G), ∃ V : OpenSubgroup G, (V : Set G) ⊆ U /-- A topological ring is nonarchimedean if its underlying topological additive group is nonarchimedean. -/ class NonarchimedeanRing (R : Type*) [Ring R] [TopologicalSpace R] extends TopologicalRing R : Prop where is_nonarchimedean : ∀ U ∈ 𝓝 (0 : R), ∃ V : OpenAddSubgroup R, (V : Set R) ⊆ U -- see Note [lower instance priority] /-- Every nonarchimedean ring is naturally a nonarchimedean additive group. -/ instance (priority := 100) NonarchimedeanRing.to_nonarchimedeanAddGroup (R : Type*) [Ring R] [TopologicalSpace R] [t : NonarchimedeanRing R] : NonarchimedeanAddGroup R := { t with } namespace NonarchimedeanGroup variable {G : Type*} [Group G] [TopologicalSpace G] [NonarchimedeanGroup G] variable {H : Type*} [Group H] [TopologicalSpace H] [TopologicalGroup H] variable {K : Type*} [Group K] [TopologicalSpace K] [NonarchimedeanGroup K] /-- If a topological group embeds into a nonarchimedean group, then it is nonarchimedean. -/ @[to_additive] theorem nonarchimedean_of_emb (f : G →* H) (emb : OpenEmbedding f) : NonarchimedeanGroup H := { is_nonarchimedean := fun U hU => have h₁ : f ⁻¹' U ∈ 𝓝 (1 : G) := by apply emb.continuous.tendsto rwa [f.map_one] let ⟨V, hV⟩ := is_nonarchimedean (f ⁻¹' U) h₁ ⟨{ Subgroup.map f V with isOpen' := emb.isOpenMap _ V.isOpen }, Set.image_subset_iff.2 hV⟩ } /-- An open neighborhood of the identity in the cartesian product of two nonarchimedean groups contains the cartesian product of an open neighborhood in each group. -/ @[to_additive NonarchimedeanAddGroup.prod_subset "An open neighborhood of the identity in the cartesian product of two nonarchimedean groups contains the cartesian product of an open neighborhood in each group."] theorem prod_subset {U} (hU : U ∈ 𝓝 (1 : G × K)) : ∃ (V : OpenSubgroup G) (W : OpenSubgroup K), (V : Set G) ×ˢ (W : Set K) ⊆ U := by erw [nhds_prod_eq, Filter.mem_prod_iff] at hU rcases hU with ⟨U₁, hU₁, U₂, hU₂, h⟩ cases' is_nonarchimedean _ hU₁ with V hV cases' is_nonarchimedean _ hU₂ with W hW use V; use W rw [Set.prod_subset_iff] intro x hX y hY exact Set.Subset.trans (Set.prod_mono hV hW) h (Set.mem_sep hX hY) /-- An open neighborhood of the identity in the cartesian square of a nonarchimedean group contains the cartesian square of an open neighborhood in the group. -/ @[to_additive NonarchimedeanAddGroup.prod_self_subset "An open neighborhood of the identity in the cartesian square of a nonarchimedean group contains the cartesian square of an open neighborhood in the group."] theorem prod_self_subset {U} (hU : U ∈ 𝓝 (1 : G × G)) : ∃ V : OpenSubgroup G, (V : Set G) ×ˢ (V : Set G) ⊆ U := let ⟨V, W, h⟩ := prod_subset hU ⟨V ⊓ W, by refine Set.Subset.trans (Set.prod_mono ?_ ?_) ‹_› <;> simp⟩ /-- The cartesian product of two nonarchimedean groups is nonarchimedean. -/ @[to_additive "The cartesian product of two nonarchimedean groups is nonarchimedean."] instance : NonarchimedeanGroup (G × K) where is_nonarchimedean U hU := let ⟨V, W, h⟩ := prod_subset hU ⟨V.prod W, ‹_›⟩ end NonarchimedeanGroup namespace NonarchimedeanRing open NonarchimedeanRing open NonarchimedeanAddGroup variable {R S : Type*} variable [Ring R] [TopologicalSpace R] [NonarchimedeanRing R] variable [Ring S] [TopologicalSpace S] [NonarchimedeanRing S] /-- The cartesian product of two nonarchimedean rings is nonarchimedean. -/ instance : NonarchimedeanRing (R × S) where is_nonarchimedean := NonarchimedeanAddGroup.is_nonarchimedean /-- Given an open subgroup `U` and an element `r` of a nonarchimedean ring, there is an open subgroup `V` such that `r • V` is contained in `U`. -/ theorem left_mul_subset (U : OpenAddSubgroup R) (r : R) : ∃ V : OpenAddSubgroup R, r • (V : Set R) ⊆ U := ⟨U.comap (AddMonoidHom.mulLeft r) (continuous_mul_left r), (U : Set R).image_preimage_subset _⟩ /-- An open subgroup of a nonarchimedean ring contains the square of another one. -/ theorem mul_subset (U : OpenAddSubgroup R) : ∃ V : OpenAddSubgroup R, (V : Set R) * V ⊆ U := by let ⟨V, H⟩ := prod_self_subset <| (U.isOpen.preimage continuous_mul).mem_nhds <| by simpa only [Set.mem_preimage, Prod.snd_zero, mul_zero] using U.zero_mem use V rintro v ⟨a, ha, b, hb, hv⟩ have hy := H (Set.mk_mem_prod ha hb) simp only [Set.mem_preimage, SetLike.mem_coe, hv] at hy rw [SetLike.mem_coe] exact hy end NonarchimedeanRing
Topology\Algebra\Nonarchimedean\Completion.lean
/- Copyright (c) 2024 Mitchell Lee. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mitchell Lee -/ import Mathlib.Topology.Algebra.Nonarchimedean.Basic import Mathlib.Topology.Algebra.GroupCompletion import Mathlib.Topology.Algebra.UniformRing /-! # The completion of a nonarchimedean additive group The completion of a nonarchimedean additive group is a nonarchimedean additive group. The completion of a nonarchimedean ring is a nonarchimedean ring. -/ open UniformSpace UniformSpace.Completion AddSubgroup OpenAddSubgroup Topology /-- The completion of a nonarchimedean additive group is a nonarchimedean additive group. -/ instance {G : Type*} [AddGroup G] [UniformSpace G] [UniformAddGroup G] [NonarchimedeanAddGroup G] : NonarchimedeanAddGroup (Completion G) where is_nonarchimedean := by /- Let `U` be a neighborhood of `0` in `Completion G`. We wish to show that `U` contains an open additive subgroup of `Completion G`. -/ intro U hU /- Since `Completion G` is regular, there is a closed neighborhood `C` of `0` which is contained in `U`. -/ obtain ⟨C, ⟨hC, C_closed⟩, C_subset_U⟩ := (closed_nhds_basis 0).mem_iff.mp hU /- By continuity, the preimage of `C` in `G`, written `toCompl ⁻¹' U'`, is a neighborhood of `0`. -/ have : toCompl ⁻¹' C ∈ 𝓝 0 := continuous_toCompl.continuousAt.preimage_mem_nhds (by rwa [map_zero]) /- Therefore, since `G` is nonarchimedean, there exists an open subgroup `W` of `G` that is contained within `toCompl ⁻¹' C`. -/ obtain ⟨W, hCW⟩ := NonarchimedeanAddGroup.is_nonarchimedean (toCompl ⁻¹' C) this /- Now, let `V = (W.map toCompl).topologicalClosure` be the result of mapping `W` back to `Completion G` and taking the topological closure. -/ let V : Set (Completion G) := (W.map toCompl).topologicalClosure /- We claim that this set `V` satisfies the desired properties. There are three conditions to check: 1. `V` is a subgroup of `Completion G`. 2. `V` is open. 3. `V ⊆ U`. The first condition follows directly from the fact that the topological closure of a subgroup is a subgroup. Now, let us check that `V` is open. -/ have : IsOpen V := by /- Since `V` is a subgroup of `Completion G`, it suffices to show that it is a neighborhood of `0` in `Completion G`. This follows from the fact that `toCompl : G → Completion G` is dense inducing and `W` is a neighborhood of `0` in `G`. -/ apply isOpen_of_mem_nhds (g := 0) apply (denseInducing_toCompl _).closure_image_mem_nhds exact mem_nhds_zero W use ⟨_, this⟩ /- Finally, it remains to show that `V ⊆ U`. It suffices to show that `V ⊆ C`, which follows from the fact that `W ⊆ toCompl ⁻¹' C` and `C` is closed. -/ suffices V ⊆ C from this.trans C_subset_U exact closure_minimal (Set.image_subset_iff.mpr hCW) C_closed /-- The completion of a nonarchimedean ring is a nonarchimedean ring. -/ instance {R : Type*} [Ring R] [UniformSpace R] [TopologicalRing R] [UniformAddGroup R] [NonarchimedeanRing R] : NonarchimedeanRing (Completion R) where is_nonarchimedean := NonarchimedeanAddGroup.is_nonarchimedean
Topology\Algebra\Order\Archimedean.lean
/- Copyright (c) 2022 Yury G. Kudryashov. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yury G. Kudryashov -/ import Mathlib.GroupTheory.Archimedean import Mathlib.Topology.Order.Basic /-! # Topology on archimedean groups and fields In this file we prove the following theorems: - `Rat.denseRange_cast`: the coercion from `ℚ` to a linear ordered archimedean field has dense range; - `AddSubgroup.dense_of_not_isolated_zero`, `AddSubgroup.dense_of_no_min`: two sufficient conditions for a subgroup of an archimedean linear ordered additive commutative group to be dense; - `AddSubgroup.dense_or_cyclic`: an additive subgroup of an archimedean linear ordered additive commutative group `G` with order topology either is dense in `G` or is a cyclic subgroup. -/ open Set /-- Rational numbers are dense in a linear ordered archimedean field. -/ theorem Rat.denseRange_cast {𝕜} [LinearOrderedField 𝕜] [TopologicalSpace 𝕜] [OrderTopology 𝕜] [Archimedean 𝕜] : DenseRange ((↑) : ℚ → 𝕜) := dense_of_exists_between fun _ _ h => Set.exists_range_iff.2 <| exists_rat_btwn h namespace AddSubgroup variable {G : Type*} [LinearOrderedAddCommGroup G] [TopologicalSpace G] [OrderTopology G] [Archimedean G] /-- An additive subgroup of an archimedean linear ordered additive commutative group with order topology is dense provided that for all positive `ε` there exists a positive element of the subgroup that is less than `ε`. -/ theorem dense_of_not_isolated_zero (S : AddSubgroup G) (hS : ∀ ε > 0, ∃ g ∈ S, g ∈ Ioo 0 ε) : Dense (S : Set G) := by cases subsingleton_or_nontrivial G · refine fun x => _root_.subset_closure ?_ rw [Subsingleton.elim x 0] exact zero_mem S refine dense_of_exists_between fun a b hlt => ?_ rcases hS (b - a) (sub_pos.2 hlt) with ⟨g, hgS, hg0, hg⟩ rcases (existsUnique_add_zsmul_mem_Ioc hg0 0 a).exists with ⟨m, hm⟩ rw [zero_add] at hm refine ⟨m • g, zsmul_mem hgS _, hm.1, hm.2.trans_lt ?_⟩ rwa [lt_sub_iff_add_lt'] at hg /-- Let `S` be a nontrivial additive subgroup in an archimedean linear ordered additive commutative group `G` with order topology. If the set of positive elements of `S` does not have a minimal element, then `S` is dense `G`. -/ theorem dense_of_no_min (S : AddSubgroup G) (hbot : S ≠ ⊥) (H : ¬∃ a : G, IsLeast { g : G | g ∈ S ∧ 0 < g } a) : Dense (S : Set G) := by refine S.dense_of_not_isolated_zero fun ε ε0 => ?_ contrapose! H exact exists_isLeast_pos hbot ε0 (disjoint_left.2 H) /-- An additive subgroup of an archimedean linear ordered additive commutative group `G` with order topology either is dense in `G` or is a cyclic subgroup. -/ theorem dense_or_cyclic (S : AddSubgroup G) : Dense (S : Set G) ∨ ∃ a : G, S = closure {a} := by refine (em _).imp (dense_of_not_isolated_zero S) fun h => ?_ push_neg at h rcases h with ⟨ε, ε0, hε⟩ exact cyclic_of_isolated_zero ε0 (disjoint_left.2 hε) end AddSubgroup
Topology\Algebra\Order\Compact.lean
/- Copyright (c) 2021 Patrick Massot. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Yury Kudryashov -/ import Mathlib.Topology.Order.LocalExtr import Mathlib.Topology.Order.IntermediateValue import Mathlib.Topology.Support import Mathlib.Topology.Order.IsLUB /-! # Compactness of a closed interval In this file we prove that a closed interval in a conditionally complete linear ordered type with order topology (or a product of such types) is compact. We prove the extreme value theorem (`IsCompact.exists_isMinOn`, `IsCompact.exists_isMaxOn`): a continuous function on a compact set takes its minimum and maximum values. We provide many variations of this theorem. We also prove that the image of a closed interval under a continuous map is a closed interval, see `ContinuousOn.image_Icc`. ## Tags compact, extreme value theorem -/ open Filter OrderDual TopologicalSpace Function Set open scoped Filter Topology /-! ### Compactness of a closed interval In this section we define a typeclass `CompactIccSpace α` saying that all closed intervals in `α` are compact. Then we provide an instance for a `ConditionallyCompleteLinearOrder` and prove that the product (both `α × β` and an indexed product) of spaces with this property inherits the property. We also prove some simple lemmas about spaces with this property. -/ /-- This typeclass says that all closed intervals in `α` are compact. This is true for all conditionally complete linear orders with order topology and products (finite or infinite) of such spaces. -/ class CompactIccSpace (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- A closed interval `Set.Icc a b` is a compact set for all `a` and `b`. -/ isCompact_Icc : ∀ {a b : α}, IsCompact (Icc a b) export CompactIccSpace (isCompact_Icc) variable {α : Type*} -- Porting note (#11215): TODO: make it the definition lemma CompactIccSpace.mk' [TopologicalSpace α] [Preorder α] (h : ∀ {a b : α}, a ≤ b → IsCompact (Icc a b)) : CompactIccSpace α where isCompact_Icc {a b} := by_cases h fun hab => by rw [Icc_eq_empty hab]; exact isCompact_empty -- Porting note (#11215): TODO: drop one `'` lemma CompactIccSpace.mk'' [TopologicalSpace α] [PartialOrder α] (h : ∀ {a b : α}, a < b → IsCompact (Icc a b)) : CompactIccSpace α := .mk' fun hab => hab.eq_or_lt.elim (by rintro rfl; simp) h instance [TopologicalSpace α] [Preorder α] [CompactIccSpace α] : CompactIccSpace (αᵒᵈ) where isCompact_Icc := by intro a b convert isCompact_Icc (α := α) (a := b) (b := a) using 1 exact dual_Icc (α := α) /-- A closed interval in a conditionally complete linear order is compact. -/ instance (priority := 100) ConditionallyCompleteLinearOrder.toCompactIccSpace (α : Type*) [ConditionallyCompleteLinearOrder α] [TopologicalSpace α] [OrderTopology α] : CompactIccSpace α := by refine .mk'' fun {a b} hlt => ?_ rcases le_or_lt a b with hab | hab swap · simp [hab] refine isCompact_iff_ultrafilter_le_nhds.2 fun f hf => ?_ contrapose! hf rw [le_principal_iff] have hpt : ∀ x ∈ Icc a b, {x} ∉ f := fun x hx hxf => hf x hx ((le_pure_iff.2 hxf).trans (pure_le_nhds x)) set s := { x ∈ Icc a b | Icc a x ∉ f } have hsb : b ∈ upperBounds s := fun x hx => hx.1.2 have sbd : BddAbove s := ⟨b, hsb⟩ have ha : a ∈ s := by simp [s, hpt, hab] rcases hab.eq_or_lt with (rfl | _hlt) · exact ha.2 -- Porting note: the `obtain` below was instead -- `set c := Sup s` -- `have hsc : IsLUB s c := isLUB_csSup ⟨a, ha⟩ sbd` obtain ⟨c, hsc⟩ : ∃ c, IsLUB s c := ⟨sSup s, isLUB_csSup ⟨a, ha⟩ ⟨b, hsb⟩⟩ have hc : c ∈ Icc a b := ⟨hsc.1 ha, hsc.2 hsb⟩ specialize hf c hc have hcs : c ∈ s := by rcases hc.1.eq_or_lt with (rfl | hlt); · assumption refine ⟨hc, fun hcf => hf fun U hU => ?_⟩ rcases (mem_nhdsWithin_Iic_iff_exists_Ioc_subset' hlt).1 (mem_nhdsWithin_of_mem_nhds hU) with ⟨x, hxc, hxU⟩ rcases ((hsc.frequently_mem ⟨a, ha⟩).and_eventually (Ioc_mem_nhdsWithin_Iic ⟨hxc, le_rfl⟩)).exists with ⟨y, ⟨_hyab, hyf⟩, hy⟩ refine mem_of_superset (f.diff_mem_iff.2 ⟨hcf, hyf⟩) (Subset.trans ?_ hxU) rw [diff_subset_iff] exact Subset.trans Icc_subset_Icc_union_Ioc <| union_subset_union Subset.rfl <| Ioc_subset_Ioc_left hy.1.le rcases hc.2.eq_or_lt with (rfl | hlt) · exact hcs.2 exfalso refine hf fun U hU => ?_ rcases (mem_nhdsWithin_Ici_iff_exists_mem_Ioc_Ico_subset hlt).1 (mem_nhdsWithin_of_mem_nhds hU) with ⟨y, hxy, hyU⟩ refine mem_of_superset ?_ hyU; clear! U have hy : y ∈ Icc a b := ⟨hc.1.trans hxy.1.le, hxy.2⟩ by_cases hay : Icc a y ∈ f · refine mem_of_superset (f.diff_mem_iff.2 ⟨f.diff_mem_iff.2 ⟨hay, hcs.2⟩, hpt y hy⟩) ?_ rw [diff_subset_iff, union_comm, Ico_union_right hxy.1.le, diff_subset_iff] exact Icc_subset_Icc_union_Icc · exact ((hsc.1 ⟨hy, hay⟩).not_lt hxy.1).elim instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, CompactIccSpace (α i)] : CompactIccSpace (∀ i, α i) := ⟨fun {a b} => (pi_univ_Icc a b ▸ isCompact_univ_pi) fun _ => isCompact_Icc⟩ instance Pi.compact_Icc_space' {α β : Type*} [Preorder β] [TopologicalSpace β] [CompactIccSpace β] : CompactIccSpace (α → β) := inferInstance instance {α β : Type*} [Preorder α] [TopologicalSpace α] [CompactIccSpace α] [Preorder β] [TopologicalSpace β] [CompactIccSpace β] : CompactIccSpace (α × β) := ⟨fun {a b} => (Icc_prod_eq a b).symm ▸ isCompact_Icc.prod isCompact_Icc⟩ /-- An unordered closed interval is compact. -/ theorem isCompact_uIcc {α : Type*} [LinearOrder α] [TopologicalSpace α] [CompactIccSpace α] {a b : α} : IsCompact (uIcc a b) := isCompact_Icc -- See note [lower instance priority] /-- A complete linear order is a compact space. We do not register an instance for a `[CompactIccSpace α]` because this would only add instances for products (indexed or not) of complete linear orders, and we have instances with higher priority that cover these cases. -/ instance (priority := 100) compactSpace_of_completeLinearOrder {α : Type*} [CompleteLinearOrder α] [TopologicalSpace α] [OrderTopology α] : CompactSpace α := ⟨by simp only [← Icc_bot_top, isCompact_Icc]⟩ section variable {α : Type*} [Preorder α] [TopologicalSpace α] [CompactIccSpace α] instance compactSpace_Icc (a b : α) : CompactSpace (Icc a b) := isCompact_iff_compactSpace.mp isCompact_Icc end /-! ### Extreme value theorem -/ section LinearOrder variable {α β γ : Type*} [LinearOrder α] [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] theorem IsCompact.exists_isLeast [ClosedIicTopology α] {s : Set α} (hs : IsCompact s) (ne_s : s.Nonempty) : ∃ x, IsLeast s x := by haveI : Nonempty s := ne_s.to_subtype suffices (s ∩ ⋂ x ∈ s, Iic x).Nonempty from ⟨this.choose, this.choose_spec.1, mem_iInter₂.mp this.choose_spec.2⟩ rw [biInter_eq_iInter] by_contra H rw [not_nonempty_iff_eq_empty] at H rcases hs.elim_directed_family_closed (fun x : s => Iic ↑x) (fun x => isClosed_Iic) H (Monotone.directed_ge fun _ _ h => Iic_subset_Iic.mpr h) with ⟨x, hx⟩ exact not_nonempty_iff_eq_empty.mpr hx ⟨x, x.2, le_rfl⟩ theorem IsCompact.exists_isGreatest [ClosedIciTopology α] {s : Set α} (hs : IsCompact s) (ne_s : s.Nonempty) : ∃ x, IsGreatest s x := IsCompact.exists_isLeast (α := αᵒᵈ) hs ne_s theorem IsCompact.exists_isGLB [ClosedIicTopology α] {s : Set α} (hs : IsCompact s) (ne_s : s.Nonempty) : ∃ x ∈ s, IsGLB s x := (hs.exists_isLeast ne_s).imp (fun x (hx : IsLeast s x) => ⟨hx.1, hx.isGLB⟩) theorem IsCompact.exists_isLUB [ClosedIciTopology α] {s : Set α} (hs : IsCompact s) (ne_s : s.Nonempty) : ∃ x ∈ s, IsLUB s x := IsCompact.exists_isGLB (α := αᵒᵈ) hs ne_s theorem cocompact_le_atBot_atTop [CompactIccSpace α] : cocompact α ≤ atBot ⊔ atTop := by refine fun s hs ↦ mem_cocompact.mpr <| (isEmpty_or_nonempty α).casesOn ?_ ?_ <;> intro · exact ⟨∅, isCompact_empty, fun x _ ↦ (IsEmpty.false x).elim⟩ · obtain ⟨t, ht⟩ := mem_atBot_sets.mp hs.1 obtain ⟨u, hu⟩ := mem_atTop_sets.mp hs.2 refine ⟨Icc t u, isCompact_Icc, fun x hx ↦ ?_⟩ exact (not_and_or.mp hx).casesOn (fun h ↦ ht x (le_of_not_le h)) fun h ↦ hu x (le_of_not_le h) theorem cocompact_le_atBot [OrderTop α] [CompactIccSpace α] : cocompact α ≤ atBot := by refine fun _ hs ↦ mem_cocompact.mpr <| (isEmpty_or_nonempty α).casesOn ?_ ?_ <;> intro · exact ⟨∅, isCompact_empty, fun x _ ↦ (IsEmpty.false x).elim⟩ · obtain ⟨t, ht⟩ := mem_atBot_sets.mp hs refine ⟨Icc t ⊤, isCompact_Icc, fun _ hx ↦ ?_⟩ exact (not_and_or.mp hx).casesOn (fun h ↦ ht _ (le_of_not_le h)) (fun h ↦ (h le_top).elim) theorem cocompact_le_atTop [OrderBot α] [CompactIccSpace α] : cocompact α ≤ atTop := cocompact_le_atBot (α := αᵒᵈ) theorem atBot_le_cocompact [NoMinOrder α] [ClosedIicTopology α] : atBot ≤ cocompact α := by refine fun s hs ↦ ?_ obtain ⟨t, ht, hts⟩ := mem_cocompact.mp hs refine (Set.eq_empty_or_nonempty t).casesOn (fun h_empty ↦ ?_) (fun h_nonempty ↦ ?_) · rewrite [compl_univ_iff.mpr h_empty, univ_subset_iff] at hts convert univ_mem · haveI := h_nonempty.nonempty obtain ⟨a, ha⟩ := ht.exists_isLeast h_nonempty obtain ⟨b, hb⟩ := exists_lt a exact Filter.mem_atBot_sets.mpr ⟨b, fun b' hb' ↦ hts <| Classical.byContradiction fun hc ↦ LT.lt.false <| hb'.trans_lt <| hb.trans_le <| ha.2 (not_not_mem.mp hc)⟩ theorem atTop_le_cocompact [NoMaxOrder α] [ClosedIciTopology α] : atTop ≤ cocompact α := atBot_le_cocompact (α := αᵒᵈ) theorem atBot_atTop_le_cocompact [NoMinOrder α] [NoMaxOrder α] [OrderClosedTopology α] : atBot ⊔ atTop ≤ cocompact α := sup_le atBot_le_cocompact atTop_le_cocompact @[simp 900] theorem cocompact_eq_atBot_atTop [NoMaxOrder α] [NoMinOrder α] [OrderClosedTopology α] [CompactIccSpace α] : cocompact α = atBot ⊔ atTop := cocompact_le_atBot_atTop.antisymm atBot_atTop_le_cocompact @[simp] theorem cocompact_eq_atBot [NoMinOrder α] [OrderTop α] [ClosedIicTopology α] [CompactIccSpace α] : cocompact α = atBot := cocompact_le_atBot.antisymm atBot_le_cocompact @[simp] theorem cocompact_eq_atTop [NoMaxOrder α] [OrderBot α] [ClosedIciTopology α] [CompactIccSpace α] : cocompact α = atTop := cocompact_le_atTop.antisymm atTop_le_cocompact /-- The **extreme value theorem**: a continuous function realizes its minimum on a compact set. -/ theorem IsCompact.exists_isMinOn [ClosedIicTopology α] {s : Set β} (hs : IsCompact s) (ne_s : s.Nonempty) {f : β → α} (hf : ContinuousOn f s) : ∃ x ∈ s, IsMinOn f s x := by rcases (hs.image_of_continuousOn hf).exists_isLeast (ne_s.image f) with ⟨_, ⟨x, hxs, rfl⟩, hx⟩ exact ⟨x, hxs, forall_mem_image.1 hx⟩ /-- If a continuous function lies strictly above `a` on a compact set, it has a lower bound strictly above `a`. -/ theorem IsCompact.exists_forall_le' [ClosedIicTopology α] [NoMaxOrder α] {f : β → α} {s : Set β} (hs : IsCompact s) (hf : ContinuousOn f s) {a : α} (hf' : ∀ b ∈ s, a < f b) : ∃ a', a < a' ∧ ∀ b ∈ s, a' ≤ f b := by rcases s.eq_empty_or_nonempty with (rfl | hs') · obtain ⟨a', ha'⟩ := exists_gt a exact ⟨a', ha', fun _ a ↦ a.elim⟩ · obtain ⟨x, hx, hx'⟩ := hs.exists_isMinOn hs' hf exact ⟨f x, hf' x hx, hx'⟩ /-- The **extreme value theorem**: a continuous function realizes its minimum on a compact set. -/ @[deprecated IsCompact.exists_isMinOn (since := "2023-02-06")] theorem IsCompact.exists_forall_le [ClosedIicTopology α] {s : Set β} (hs : IsCompact s) (ne_s : s.Nonempty) {f : β → α} (hf : ContinuousOn f s) : ∃ x ∈ s, ∀ y ∈ s, f x ≤ f y := hs.exists_isMinOn ne_s hf /-- The **extreme value theorem**: a continuous function realizes its maximum on a compact set. -/ theorem IsCompact.exists_isMaxOn [ClosedIciTopology α] {s : Set β} (hs : IsCompact s) (ne_s : s.Nonempty) {f : β → α} (hf : ContinuousOn f s) : ∃ x ∈ s, IsMaxOn f s x := IsCompact.exists_isMinOn (α := αᵒᵈ) hs ne_s hf /-- The **extreme value theorem**: a continuous function realizes its maximum on a compact set. -/ @[deprecated IsCompact.exists_isMaxOn (since := "2023-02-06")] theorem IsCompact.exists_forall_ge [ClosedIciTopology α] {s : Set β} (hs : IsCompact s) (ne_s : s.Nonempty) {f : β → α} (hf : ContinuousOn f s) : ∃ x ∈ s, ∀ y ∈ s, f y ≤ f x := IsCompact.exists_isMaxOn hs ne_s hf /-- The **extreme value theorem**: if a function `f` is continuous on a closed set `s` and it is larger than a value in its image away from compact sets, then it has a minimum on this set. -/ theorem ContinuousOn.exists_isMinOn' [ClosedIicTopology α] {s : Set β} {f : β → α} (hf : ContinuousOn f s) (hsc : IsClosed s) {x₀ : β} (h₀ : x₀ ∈ s) (hc : ∀ᶠ x in cocompact β ⊓ 𝓟 s, f x₀ ≤ f x) : ∃ x ∈ s, IsMinOn f s x := by rcases (hasBasis_cocompact.inf_principal _).eventually_iff.1 hc with ⟨K, hK, hKf⟩ have hsub : insert x₀ (K ∩ s) ⊆ s := insert_subset_iff.2 ⟨h₀, inter_subset_right⟩ obtain ⟨x, hx, hxf⟩ : ∃ x ∈ insert x₀ (K ∩ s), ∀ y ∈ insert x₀ (K ∩ s), f x ≤ f y := ((hK.inter_right hsc).insert x₀).exists_isMinOn (insert_nonempty _ _) (hf.mono hsub) refine ⟨x, hsub hx, fun y hy => ?_⟩ by_cases hyK : y ∈ K exacts [hxf _ (Or.inr ⟨hyK, hy⟩), (hxf _ (Or.inl rfl)).trans (hKf ⟨hyK, hy⟩)] /-- The **extreme value theorem**: if a function `f` is continuous on a closed set `s` and it is larger than a value in its image away from compact sets, then it has a minimum on this set. -/ @[deprecated ContinuousOn.exists_isMinOn' (since := "2023-02-06")] theorem ContinuousOn.exists_forall_le' [ClosedIicTopology α] {s : Set β} {f : β → α} (hf : ContinuousOn f s) (hsc : IsClosed s) {x₀ : β} (h₀ : x₀ ∈ s) (hc : ∀ᶠ x in cocompact β ⊓ 𝓟 s, f x₀ ≤ f x) : ∃ x ∈ s, ∀ y ∈ s, f x ≤ f y := hf.exists_isMinOn' hsc h₀ hc /-- The **extreme value theorem**: if a function `f` is continuous on a closed set `s` and it is smaller than a value in its image away from compact sets, then it has a maximum on this set. -/ theorem ContinuousOn.exists_isMaxOn' [ClosedIciTopology α] {s : Set β} {f : β → α} (hf : ContinuousOn f s) (hsc : IsClosed s) {x₀ : β} (h₀ : x₀ ∈ s) (hc : ∀ᶠ x in cocompact β ⊓ 𝓟 s, f x ≤ f x₀) : ∃ x ∈ s, IsMaxOn f s x := ContinuousOn.exists_isMinOn' (α := αᵒᵈ) hf hsc h₀ hc /-- The **extreme value theorem**: if a function `f` is continuous on a closed set `s` and it is smaller than a value in its image away from compact sets, then it has a maximum on this set. -/ @[deprecated ContinuousOn.exists_isMaxOn' (since := "2023-02-06")] theorem ContinuousOn.exists_forall_ge' [ClosedIciTopology α] {s : Set β} {f : β → α} (hf : ContinuousOn f s) (hsc : IsClosed s) {x₀ : β} (h₀ : x₀ ∈ s) (hc : ∀ᶠ x in cocompact β ⊓ 𝓟 s, f x ≤ f x₀) : ∃ x ∈ s, ∀ y ∈ s, f y ≤ f x := hf.exists_isMaxOn' hsc h₀ hc /-- The **extreme value theorem**: if a continuous function `f` is larger than a value in its range away from compact sets, then it has a global minimum. -/ theorem Continuous.exists_forall_le' [ClosedIicTopology α] {f : β → α} (hf : Continuous f) (x₀ : β) (h : ∀ᶠ x in cocompact β, f x₀ ≤ f x) : ∃ x : β, ∀ y : β, f x ≤ f y := let ⟨x, _, hx⟩ := hf.continuousOn.exists_isMinOn' isClosed_univ (mem_univ x₀) (by rwa [principal_univ, inf_top_eq]) ⟨x, fun y => hx (mem_univ y)⟩ /-- The **extreme value theorem**: if a continuous function `f` is smaller than a value in its range away from compact sets, then it has a global maximum. -/ theorem Continuous.exists_forall_ge' [ClosedIciTopology α] {f : β → α} (hf : Continuous f) (x₀ : β) (h : ∀ᶠ x in cocompact β, f x ≤ f x₀) : ∃ x : β, ∀ y : β, f y ≤ f x := Continuous.exists_forall_le' (α := αᵒᵈ) hf x₀ h /-- The **extreme value theorem**: if a continuous function `f` tends to infinity away from compact sets, then it has a global minimum. -/ theorem Continuous.exists_forall_le [ClosedIicTopology α] [Nonempty β] {f : β → α} (hf : Continuous f) (hlim : Tendsto f (cocompact β) atTop) : ∃ x, ∀ y, f x ≤ f y := by inhabit β exact hf.exists_forall_le' default (hlim.eventually <| eventually_ge_atTop _) /-- The **extreme value theorem**: if a continuous function `f` tends to negative infinity away from compact sets, then it has a global maximum. -/ theorem Continuous.exists_forall_ge [ClosedIciTopology α] [Nonempty β] {f : β → α} (hf : Continuous f) (hlim : Tendsto f (cocompact β) atBot) : ∃ x, ∀ y, f y ≤ f x := Continuous.exists_forall_le (α := αᵒᵈ) hf hlim /-- A continuous function with compact support has a global minimum. -/ @[to_additive "A continuous function with compact support has a global minimum."] theorem Continuous.exists_forall_le_of_hasCompactMulSupport [ClosedIicTopology α] [Nonempty β] [One α] {f : β → α} (hf : Continuous f) (h : HasCompactMulSupport f) : ∃ x : β, ∀ y : β, f x ≤ f y := by obtain ⟨_, ⟨x, rfl⟩, hx⟩ := (h.isCompact_range hf).exists_isLeast (range_nonempty _) rw [mem_lowerBounds, forall_mem_range] at hx exact ⟨x, hx⟩ /-- A continuous function with compact support has a global maximum. -/ @[to_additive "A continuous function with compact support has a global maximum."] theorem Continuous.exists_forall_ge_of_hasCompactMulSupport [ClosedIciTopology α] [Nonempty β] [One α] {f : β → α} (hf : Continuous f) (h : HasCompactMulSupport f) : ∃ x : β, ∀ y : β, f y ≤ f x := Continuous.exists_forall_le_of_hasCompactMulSupport (α := αᵒᵈ) hf h /-- A compact set is bounded below -/ theorem IsCompact.bddBelow [ClosedIicTopology α] [Nonempty α] {s : Set α} (hs : IsCompact s) : BddBelow s := by rcases s.eq_empty_or_nonempty with rfl | hne · exact bddBelow_empty · obtain ⟨a, -, has⟩ := hs.exists_isLeast hne exact ⟨a, has⟩ /-- A compact set is bounded above -/ theorem IsCompact.bddAbove [ClosedIciTopology α] [Nonempty α] {s : Set α} (hs : IsCompact s) : BddAbove s := IsCompact.bddBelow (α := αᵒᵈ) hs /-- A continuous function is bounded below on a compact set. -/ theorem IsCompact.bddBelow_image [ClosedIicTopology α] [Nonempty α] {f : β → α} {K : Set β} (hK : IsCompact K) (hf : ContinuousOn f K) : BddBelow (f '' K) := (hK.image_of_continuousOn hf).bddBelow /-- A continuous function is bounded above on a compact set. -/ theorem IsCompact.bddAbove_image [ClosedIciTopology α] [Nonempty α] {f : β → α} {K : Set β} (hK : IsCompact K) (hf : ContinuousOn f K) : BddAbove (f '' K) := IsCompact.bddBelow_image (α := αᵒᵈ) hK hf /-- A continuous function with compact support is bounded below. -/ @[to_additive " A continuous function with compact support is bounded below. "] theorem Continuous.bddBelow_range_of_hasCompactMulSupport [ClosedIicTopology α] [One α] {f : β → α} (hf : Continuous f) (h : HasCompactMulSupport f) : BddBelow (range f) := (h.isCompact_range hf).bddBelow /-- A continuous function with compact support is bounded above. -/ @[to_additive " A continuous function with compact support is bounded above. "] theorem Continuous.bddAbove_range_of_hasCompactMulSupport [ClosedIciTopology α] [One α] {f : β → α} (hf : Continuous f) (h : HasCompactMulSupport f) : BddAbove (range f) := Continuous.bddBelow_range_of_hasCompactMulSupport (α := αᵒᵈ) hf h end LinearOrder section ConditionallyCompleteLinearOrder variable {α β γ : Type*} [ConditionallyCompleteLinearOrder α] [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] theorem IsCompact.sSup_lt_iff_of_continuous [ClosedIciTopology α] {f : β → α} {K : Set β} (hK : IsCompact K) (h0K : K.Nonempty) (hf : ContinuousOn f K) (y : α) : sSup (f '' K) < y ↔ ∀ x ∈ K, f x < y := by refine ⟨fun h x hx => (le_csSup (hK.bddAbove_image hf) <| mem_image_of_mem f hx).trans_lt h, fun h => ?_⟩ obtain ⟨x, hx, h2x⟩ := hK.exists_isMaxOn h0K hf refine (csSup_le (h0K.image f) ?_).trans_lt (h x hx) rintro _ ⟨x', hx', rfl⟩; exact h2x hx' theorem IsCompact.lt_sInf_iff_of_continuous [ClosedIicTopology α] {f : β → α} {K : Set β} (hK : IsCompact K) (h0K : K.Nonempty) (hf : ContinuousOn f K) (y : α) : y < sInf (f '' K) ↔ ∀ x ∈ K, y < f x := IsCompact.sSup_lt_iff_of_continuous (α := αᵒᵈ) hK h0K hf y end ConditionallyCompleteLinearOrder /-! ### Min and max elements of a compact set -/ section InfSup variable {α β : Type*} [ConditionallyCompleteLinearOrder α] [TopologicalSpace α] [TopologicalSpace β] theorem IsCompact.sInf_mem [ClosedIicTopology α] {s : Set α} (hs : IsCompact s) (ne_s : s.Nonempty) : sInf s ∈ s := let ⟨_a, ha⟩ := hs.exists_isLeast ne_s ha.csInf_mem theorem IsCompact.sSup_mem [ClosedIciTopology α] {s : Set α} (hs : IsCompact s) (ne_s : s.Nonempty) : sSup s ∈ s := IsCompact.sInf_mem (α := αᵒᵈ) hs ne_s theorem IsCompact.isGLB_sInf [ClosedIicTopology α] {s : Set α} (hs : IsCompact s) (ne_s : s.Nonempty) : IsGLB s (sInf s) := isGLB_csInf ne_s hs.bddBelow theorem IsCompact.isLUB_sSup [ClosedIciTopology α] {s : Set α} (hs : IsCompact s) (ne_s : s.Nonempty) : IsLUB s (sSup s) := IsCompact.isGLB_sInf (α := αᵒᵈ) hs ne_s theorem IsCompact.isLeast_sInf [ClosedIicTopology α] {s : Set α} (hs : IsCompact s) (ne_s : s.Nonempty) : IsLeast s (sInf s) := ⟨hs.sInf_mem ne_s, (hs.isGLB_sInf ne_s).1⟩ theorem IsCompact.isGreatest_sSup [ClosedIciTopology α] {s : Set α} (hs : IsCompact s) (ne_s : s.Nonempty) : IsGreatest s (sSup s) := IsCompact.isLeast_sInf (α := αᵒᵈ) hs ne_s theorem IsCompact.exists_sInf_image_eq_and_le [ClosedIicTopology α] {s : Set β} (hs : IsCompact s) (ne_s : s.Nonempty) {f : β → α} (hf : ContinuousOn f s) : ∃ x ∈ s, sInf (f '' s) = f x ∧ ∀ y ∈ s, f x ≤ f y := let ⟨x, hxs, hx⟩ := (hs.image_of_continuousOn hf).sInf_mem (ne_s.image f) ⟨x, hxs, hx.symm, fun _y hy => hx.trans_le <| csInf_le (hs.image_of_continuousOn hf).bddBelow <| mem_image_of_mem f hy⟩ theorem IsCompact.exists_sSup_image_eq_and_ge [ClosedIciTopology α] {s : Set β} (hs : IsCompact s) (ne_s : s.Nonempty) {f : β → α} (hf : ContinuousOn f s) : ∃ x ∈ s, sSup (f '' s) = f x ∧ ∀ y ∈ s, f y ≤ f x := IsCompact.exists_sInf_image_eq_and_le (α := αᵒᵈ) hs ne_s hf theorem IsCompact.exists_sInf_image_eq [ClosedIicTopology α] {s : Set β} (hs : IsCompact s) (ne_s : s.Nonempty) {f : β → α} (hf : ContinuousOn f s) : ∃ x ∈ s, sInf (f '' s) = f x := let ⟨x, hxs, hx, _⟩ := hs.exists_sInf_image_eq_and_le ne_s hf ⟨x, hxs, hx⟩ theorem IsCompact.exists_sSup_image_eq [ClosedIciTopology α] {s : Set β} (hs : IsCompact s) (ne_s : s.Nonempty) : ∀ {f : β → α}, ContinuousOn f s → ∃ x ∈ s, sSup (f '' s) = f x := IsCompact.exists_sInf_image_eq (α := αᵒᵈ) hs ne_s end InfSup section ExistsExtr variable {α β : Type*} [LinearOrder α] [TopologicalSpace α] [TopologicalSpace β] theorem IsCompact.exists_isMinOn_mem_subset [ClosedIicTopology α] {f : β → α} {s t : Set β} {z : β} (ht : IsCompact t) (hf : ContinuousOn f t) (hz : z ∈ t) (hfz : ∀ z' ∈ t \ s, f z < f z') : ∃ x ∈ s, IsMinOn f t x := let ⟨x, hxt, hfx⟩ := ht.exists_isMinOn ⟨z, hz⟩ hf ⟨x, by_contra fun hxs => (hfz x ⟨hxt, hxs⟩).not_le (hfx hz), hfx⟩ theorem IsCompact.exists_isMaxOn_mem_subset [ClosedIciTopology α] {f : β → α} {s t : Set β} {z : β} (ht : IsCompact t) (hf : ContinuousOn f t) (hz : z ∈ t) (hfz : ∀ z' ∈ t \ s, f z' < f z) : ∃ x ∈ s, IsMaxOn f t x := let ⟨x, hxt, hfx⟩ := ht.exists_isMaxOn ⟨z, hz⟩ hf ⟨x, by_contra fun hxs => (hfz x ⟨hxt, hxs⟩).not_le (hfx hz), hfx⟩ @[deprecated IsCompact.exists_isMinOn_mem_subset (since := "2023-02-06")] theorem IsCompact.exists_isLocalMinOn_mem_subset [ClosedIicTopology α] {f : β → α} {s t : Set β} {z : β} (ht : IsCompact t) (hf : ContinuousOn f t) (hz : z ∈ t) (hfz : ∀ z' ∈ t \ s, f z < f z') : ∃ x ∈ s, IsLocalMinOn f t x := let ⟨x, hxs, h⟩ := ht.exists_isMinOn_mem_subset hf hz hfz ⟨x, hxs, h.localize⟩ -- Porting note: rfc: assume `t ∈ 𝓝ˢ s` (a.k.a. `s ⊆ interior t`) instead of `s ⊆ t` and -- `IsOpen s`? theorem IsCompact.exists_isLocalMin_mem_open [ClosedIicTopology α] {f : β → α} {s t : Set β} {z : β} (ht : IsCompact t) (hst : s ⊆ t) (hf : ContinuousOn f t) (hz : z ∈ t) (hfz : ∀ z' ∈ t \ s, f z < f z') (hs : IsOpen s) : ∃ x ∈ s, IsLocalMin f x := let ⟨x, hxs, h⟩ := ht.exists_isMinOn_mem_subset hf hz hfz ⟨x, hxs, h.isLocalMin <| mem_nhds_iff.2 ⟨s, hst, hs, hxs⟩⟩ theorem IsCompact.exists_isLocalMax_mem_open [ClosedIciTopology α] {f : β → α} {s t : Set β} {z : β} (ht : IsCompact t) (hst : s ⊆ t) (hf : ContinuousOn f t) (hz : z ∈ t) (hfz : ∀ z' ∈ t \ s, f z' < f z) (hs : IsOpen s) : ∃ x ∈ s, IsLocalMax f x := let ⟨x, hxs, h⟩ := ht.exists_isMaxOn_mem_subset hf hz hfz ⟨x, hxs, h.isLocalMax <| mem_nhds_iff.2 ⟨s, hst, hs, hxs⟩⟩ end ExistsExtr variable {α β γ : Type*} [ConditionallyCompleteLinearOrder α] [TopologicalSpace α] [OrderTopology α] [TopologicalSpace β] [TopologicalSpace γ] theorem eq_Icc_of_connected_compact {s : Set α} (h₁ : IsConnected s) (h₂ : IsCompact s) : s = Icc (sInf s) (sSup s) := eq_Icc_csInf_csSup_of_connected_bdd_closed h₁ h₂.bddBelow h₂.bddAbove h₂.isClosed /-- If `f : γ → β → α` is a function that is continuous as a function on `γ × β`, `α` is a conditionally complete linear order, and `K : Set β` is a compact set, then `fun x ↦ sSup (f x '' K)` is a continuous function. -/ /- Porting note (#11215): TODO: generalize. The following version seems to be true: ``` theorem IsCompact.tendsto_sSup {f : γ → β → α} {g : β → α} {K : Set β} {l : Filter γ} (hK : IsCompact K) (hf : ∀ y ∈ K, Tendsto ↿f (l ×ˢ 𝓝[K] y) (𝓝 (g y))) (hgc : ContinuousOn g K) : Tendsto (fun x => sSup (f x '' K)) l (𝓝 (sSup (g '' K))) := _ ``` Moreover, it seems that `hgc` follows from `hf` (Yury Kudryashov). -/ theorem IsCompact.continuous_sSup {f : γ → β → α} {K : Set β} (hK : IsCompact K) (hf : Continuous ↿f) : Continuous fun x => sSup (f x '' K) := by rcases eq_empty_or_nonempty K with (rfl | h0K) · simp_rw [image_empty] exact continuous_const rw [continuous_iff_continuousAt] intro x obtain ⟨y, hyK, h2y, hy⟩ := hK.exists_sSup_image_eq_and_ge h0K (show Continuous fun y => f x y from hf.comp <| Continuous.Prod.mk x).continuousOn rw [ContinuousAt, h2y, tendsto_order] have := tendsto_order.mp ((show Continuous fun x => f x y from hf.comp <| continuous_id.prod_mk continuous_const).tendsto x) refine ⟨fun z hz => ?_, fun z hz => ?_⟩ · refine (this.1 z hz).mono fun x' hx' => hx'.trans_le <| le_csSup ?_ <| mem_image_of_mem (f x') hyK exact hK.bddAbove_image (hf.comp <| Continuous.Prod.mk x').continuousOn · have h : ({x} : Set γ) ×ˢ K ⊆ ↿f ⁻¹' Iio z := by rintro ⟨x', y'⟩ ⟨(rfl : x' = x), hy'⟩ exact (hy y' hy').trans_lt hz obtain ⟨u, v, hu, _, hxu, hKv, huv⟩ := generalized_tube_lemma isCompact_singleton hK (isOpen_Iio.preimage hf) h refine eventually_of_mem (hu.mem_nhds (singleton_subset_iff.mp hxu)) fun x' hx' => ?_ rw [hK.sSup_lt_iff_of_continuous h0K (show Continuous (f x') from hf.comp <| Continuous.Prod.mk x').continuousOn] exact fun y' hy' => huv (mk_mem_prod hx' (hKv hy')) theorem IsCompact.continuous_sInf {f : γ → β → α} {K : Set β} (hK : IsCompact K) (hf : Continuous ↿f) : Continuous fun x => sInf (f x '' K) := IsCompact.continuous_sSup (α := αᵒᵈ) hK hf namespace ContinuousOn /-! ### Image of a closed interval -/ variable [DenselyOrdered α] [ConditionallyCompleteLinearOrder β] [OrderTopology β] {f : α → β} {a b c : α} open scoped Interval theorem image_Icc (hab : a ≤ b) (h : ContinuousOn f <| Icc a b) : f '' Icc a b = Icc (sInf <| f '' Icc a b) (sSup <| f '' Icc a b) := eq_Icc_of_connected_compact ⟨(nonempty_Icc.2 hab).image f, isPreconnected_Icc.image f h⟩ (isCompact_Icc.image_of_continuousOn h) theorem image_uIcc_eq_Icc (h : ContinuousOn f [[a, b]]) : f '' [[a, b]] = Icc (sInf (f '' [[a, b]])) (sSup (f '' [[a, b]])) := image_Icc min_le_max h theorem image_uIcc (h : ContinuousOn f <| [[a, b]]) : f '' [[a, b]] = [[sInf (f '' [[a, b]]), sSup (f '' [[a, b]])]] := by refine h.image_uIcc_eq_Icc.trans (uIcc_of_le ?_).symm refine csInf_le_csSup ?_ ?_ (nonempty_uIcc.image _) <;> rw [h.image_uIcc_eq_Icc] exacts [bddBelow_Icc, bddAbove_Icc] theorem sInf_image_Icc_le (h : ContinuousOn f <| Icc a b) (hc : c ∈ Icc a b) : sInf (f '' Icc a b) ≤ f c := by have := mem_image_of_mem f hc rw [h.image_Icc (hc.1.trans hc.2)] at this exact this.1 theorem le_sSup_image_Icc (h : ContinuousOn f <| Icc a b) (hc : c ∈ Icc a b) : f c ≤ sSup (f '' Icc a b) := by have := mem_image_of_mem f hc rw [h.image_Icc (hc.1.trans hc.2)] at this exact this.2 end ContinuousOn
Topology\Algebra\Order\Field.lean
/- Copyright (c) 2022 Benjamin Davidson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Benjamin Davidson, Devon Tuma, Eric Rodriguez, Oliver Nash -/ import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Topology.Algebra.Field import Mathlib.Topology.Algebra.Order.Group /-! # Topologies on linear ordered fields In this file we prove that a linear ordered field with order topology has continuous multiplication and division (apart from zero in the denominator). We also prove theorems like `Filter.Tendsto.mul_atTop`: if `f` tends to a positive number and `g` tends to positive infinity, then `f * g` tends to positive infinity. -/ open Set Filter TopologicalSpace Function open scoped Pointwise Topology open OrderDual (toDual ofDual) /-- If a (possibly non-unital and/or non-associative) ring `R` admits a submultiplicative nonnegative norm `norm : R → 𝕜`, where `𝕜` is a linear ordered field, and the open balls `{ x | norm x < ε }`, `ε > 0`, form a basis of neighborhoods of zero, then `R` is a topological ring. -/ theorem TopologicalRing.of_norm {R 𝕜 : Type*} [NonUnitalNonAssocRing R] [LinearOrderedField 𝕜] [TopologicalSpace R] [TopologicalAddGroup R] (norm : R → 𝕜) (norm_nonneg : ∀ x, 0 ≤ norm x) (norm_mul_le : ∀ x y, norm (x * y) ≤ norm x * norm y) (nhds_basis : (𝓝 (0 : R)).HasBasis ((0 : 𝕜) < ·) (fun ε ↦ { x | norm x < ε })) : TopologicalRing R := by have h0 : ∀ f : R → R, ∀ c ≥ (0 : 𝕜), (∀ x, norm (f x) ≤ c * norm x) → Tendsto f (𝓝 0) (𝓝 0) := by refine fun f c c0 hf ↦ (nhds_basis.tendsto_iff nhds_basis).2 fun ε ε0 ↦ ?_ rcases exists_pos_mul_lt ε0 c with ⟨δ, δ0, hδ⟩ refine ⟨δ, δ0, fun x hx ↦ (hf _).trans_lt ?_⟩ exact (mul_le_mul_of_nonneg_left (le_of_lt hx) c0).trans_lt hδ apply TopologicalRing.of_addGroup_of_nhds_zero case hmul => refine ((nhds_basis.prod nhds_basis).tendsto_iff nhds_basis).2 fun ε ε0 ↦ ?_ refine ⟨(1, ε), ⟨one_pos, ε0⟩, fun (x, y) ⟨hx, hy⟩ => ?_⟩ simp only [sub_zero] at * calc norm (x * y) ≤ norm x * norm y := norm_mul_le _ _ _ < ε := mul_lt_of_le_one_of_lt_of_nonneg hx.le hy (norm_nonneg _) case hmul_left => exact fun x => h0 _ (norm x) (norm_nonneg _) (norm_mul_le x) case hmul_right => exact fun y => h0 (· * y) (norm y) (norm_nonneg y) fun x => (norm_mul_le x y).trans_eq (mul_comm _ _) variable {𝕜 α : Type*} [LinearOrderedField 𝕜] [TopologicalSpace 𝕜] [OrderTopology 𝕜] {l : Filter α} {f g : α → 𝕜} -- see Note [lower instance priority] instance (priority := 100) LinearOrderedField.topologicalRing : TopologicalRing 𝕜 := .of_norm abs abs_nonneg (fun _ _ ↦ (abs_mul _ _).le) <| by simpa using nhds_basis_abs_sub_lt (0 : 𝕜) /-- In a linearly ordered field with the order topology, if `f` tends to `Filter.atTop` and `g` tends to a positive constant `C` then `f * g` tends to `Filter.atTop`. -/ theorem Filter.Tendsto.atTop_mul {C : 𝕜} (hC : 0 < C) (hf : Tendsto f l atTop) (hg : Tendsto g l (𝓝 C)) : Tendsto (fun x => f x * g x) l atTop := by refine tendsto_atTop_mono' _ ?_ (hf.atTop_mul_const (half_pos hC)) filter_upwards [hg.eventually (lt_mem_nhds (half_lt_self hC)), hf.eventually_ge_atTop 0] with x hg hf using mul_le_mul_of_nonneg_left hg.le hf /-- In a linearly ordered field with the order topology, if `f` tends to a positive constant `C` and `g` tends to `Filter.atTop` then `f * g` tends to `Filter.atTop`. -/ theorem Filter.Tendsto.mul_atTop {C : 𝕜} (hC : 0 < C) (hf : Tendsto f l (𝓝 C)) (hg : Tendsto g l atTop) : Tendsto (fun x => f x * g x) l atTop := by simpa only [mul_comm] using hg.atTop_mul hC hf /-- In a linearly ordered field with the order topology, if `f` tends to `Filter.atTop` and `g` tends to a negative constant `C` then `f * g` tends to `Filter.atBot`. -/ theorem Filter.Tendsto.atTop_mul_neg {C : 𝕜} (hC : C < 0) (hf : Tendsto f l atTop) (hg : Tendsto g l (𝓝 C)) : Tendsto (fun x => f x * g x) l atBot := by have := hf.atTop_mul (neg_pos.2 hC) hg.neg simpa only [(· ∘ ·), neg_mul_eq_mul_neg, neg_neg] using tendsto_neg_atTop_atBot.comp this /-- In a linearly ordered field with the order topology, if `f` tends to a negative constant `C` and `g` tends to `Filter.atTop` then `f * g` tends to `Filter.atBot`. -/ theorem Filter.Tendsto.neg_mul_atTop {C : 𝕜} (hC : C < 0) (hf : Tendsto f l (𝓝 C)) (hg : Tendsto g l atTop) : Tendsto (fun x => f x * g x) l atBot := by simpa only [mul_comm] using hg.atTop_mul_neg hC hf /-- In a linearly ordered field with the order topology, if `f` tends to `Filter.atBot` and `g` tends to a positive constant `C` then `f * g` tends to `Filter.atBot`. -/ theorem Filter.Tendsto.atBot_mul {C : 𝕜} (hC : 0 < C) (hf : Tendsto f l atBot) (hg : Tendsto g l (𝓝 C)) : Tendsto (fun x => f x * g x) l atBot := by have := (tendsto_neg_atBot_atTop.comp hf).atTop_mul hC hg simpa [(· ∘ ·)] using tendsto_neg_atTop_atBot.comp this /-- In a linearly ordered field with the order topology, if `f` tends to `Filter.atBot` and `g` tends to a negative constant `C` then `f * g` tends to `Filter.atTop`. -/ theorem Filter.Tendsto.atBot_mul_neg {C : 𝕜} (hC : C < 0) (hf : Tendsto f l atBot) (hg : Tendsto g l (𝓝 C)) : Tendsto (fun x => f x * g x) l atTop := by have := (tendsto_neg_atBot_atTop.comp hf).atTop_mul_neg hC hg simpa [(· ∘ ·)] using tendsto_neg_atBot_atTop.comp this /-- In a linearly ordered field with the order topology, if `f` tends to a positive constant `C` and `g` tends to `Filter.atBot` then `f * g` tends to `Filter.atBot`. -/ theorem Filter.Tendsto.mul_atBot {C : 𝕜} (hC : 0 < C) (hf : Tendsto f l (𝓝 C)) (hg : Tendsto g l atBot) : Tendsto (fun x => f x * g x) l atBot := by simpa only [mul_comm] using hg.atBot_mul hC hf /-- In a linearly ordered field with the order topology, if `f` tends to a negative constant `C` and `g` tends to `Filter.atBot` then `f * g` tends to `Filter.atTop`. -/ theorem Filter.Tendsto.neg_mul_atBot {C : 𝕜} (hC : C < 0) (hf : Tendsto f l (𝓝 C)) (hg : Tendsto g l atBot) : Tendsto (fun x => f x * g x) l atTop := by simpa only [mul_comm] using hg.atBot_mul_neg hC hf @[simp] lemma inv_atTop₀ : (atTop : Filter 𝕜)⁻¹ = 𝓝[>] 0 := (((atTop_basis_Ioi' (0 : 𝕜)).map _).comp_surjective inv_surjective).eq_of_same_basis <| (nhdsWithin_Ioi_basis _).congr (by simp) fun a ha ↦ by simp [inv_Ioi (inv_pos.2 ha)] @[simp] lemma inv_nhdsWithin_Ioi_zero : (𝓝[>] (0 : 𝕜))⁻¹ = atTop := by rw [← inv_atTop₀, inv_inv] /-- The function `x ↦ x⁻¹` tends to `+∞` on the right of `0`. -/ theorem tendsto_inv_zero_atTop : Tendsto (fun x : 𝕜 => x⁻¹) (𝓝[>] (0 : 𝕜)) atTop := inv_nhdsWithin_Ioi_zero.le /-- The function `r ↦ r⁻¹` tends to `0` on the right as `r → +∞`. -/ theorem tendsto_inv_atTop_zero' : Tendsto (fun r : 𝕜 => r⁻¹) atTop (𝓝[>] (0 : 𝕜)) := inv_atTop₀.le theorem tendsto_inv_atTop_zero : Tendsto (fun r : 𝕜 => r⁻¹) atTop (𝓝 0) := tendsto_inv_atTop_zero'.mono_right inf_le_left theorem Filter.Tendsto.div_atTop {a : 𝕜} (h : Tendsto f l (𝓝 a)) (hg : Tendsto g l atTop) : Tendsto (fun x => f x / g x) l (𝓝 0) := by simp only [div_eq_mul_inv] exact mul_zero a ▸ h.mul (tendsto_inv_atTop_zero.comp hg) theorem Filter.Tendsto.inv_tendsto_atTop (h : Tendsto f l atTop) : Tendsto f⁻¹ l (𝓝 0) := tendsto_inv_atTop_zero.comp h theorem Filter.Tendsto.inv_tendsto_zero (h : Tendsto f l (𝓝[>] 0)) : Tendsto f⁻¹ l atTop := tendsto_inv_zero_atTop.comp h /-- The function `x^(-n)` tends to `0` at `+∞` for any positive natural `n`. A version for positive real powers exists as `tendsto_rpow_neg_atTop`. -/ theorem tendsto_pow_neg_atTop {n : ℕ} (hn : n ≠ 0) : Tendsto (fun x : 𝕜 => x ^ (-(n : ℤ))) atTop (𝓝 0) := by simpa only [zpow_neg, zpow_natCast] using (@tendsto_pow_atTop 𝕜 _ _ hn).inv_tendsto_atTop theorem tendsto_zpow_atTop_zero {n : ℤ} (hn : n < 0) : Tendsto (fun x : 𝕜 => x ^ n) atTop (𝓝 0) := by lift -n to ℕ using le_of_lt (neg_pos.mpr hn) with N h rw [← neg_pos, ← h, Nat.cast_pos] at hn simpa only [h, neg_neg] using tendsto_pow_neg_atTop hn.ne' theorem tendsto_const_mul_zpow_atTop_zero {n : ℤ} {c : 𝕜} (hn : n < 0) : Tendsto (fun x => c * x ^ n) atTop (𝓝 0) := mul_zero c ▸ Filter.Tendsto.const_mul c (tendsto_zpow_atTop_zero hn) theorem tendsto_const_mul_pow_nhds_iff' {n : ℕ} {c d : 𝕜} : Tendsto (fun x : 𝕜 => c * x ^ n) atTop (𝓝 d) ↔ (c = 0 ∨ n = 0) ∧ c = d := by rcases eq_or_ne n 0 with (rfl | hn) · simp [tendsto_const_nhds_iff] rcases lt_trichotomy c 0 with (hc | rfl | hc) · have := tendsto_const_mul_pow_atBot_iff.2 ⟨hn, hc⟩ simp [not_tendsto_nhds_of_tendsto_atBot this, hc.ne, hn] · simp [tendsto_const_nhds_iff] · have := tendsto_const_mul_pow_atTop_iff.2 ⟨hn, hc⟩ simp [not_tendsto_nhds_of_tendsto_atTop this, hc.ne', hn] theorem tendsto_const_mul_pow_nhds_iff {n : ℕ} {c d : 𝕜} (hc : c ≠ 0) : Tendsto (fun x : 𝕜 => c * x ^ n) atTop (𝓝 d) ↔ n = 0 ∧ c = d := by simp [tendsto_const_mul_pow_nhds_iff', hc] theorem tendsto_const_mul_zpow_atTop_nhds_iff {n : ℤ} {c d : 𝕜} (hc : c ≠ 0) : Tendsto (fun x : 𝕜 => c * x ^ n) atTop (𝓝 d) ↔ n = 0 ∧ c = d ∨ n < 0 ∧ d = 0 := by refine ⟨fun h => ?_, fun h => ?_⟩ · cases n with -- Porting note: Lean 3 proof used `by_cases`, then `lift` but `lift` failed | ofNat n => left simpa [tendsto_const_mul_pow_nhds_iff hc] using h | negSucc n => have hn := Int.negSucc_lt_zero n exact Or.inr ⟨hn, tendsto_nhds_unique h (tendsto_const_mul_zpow_atTop_zero hn)⟩ · cases' h with h h · simp only [h.left, h.right, zpow_zero, mul_one] exact tendsto_const_nhds · exact h.2.symm ▸ tendsto_const_mul_zpow_atTop_zero h.1 -- see Note [lower instance priority] instance (priority := 100) LinearOrderedSemifield.toHasContinuousInv₀ {𝕜} [LinearOrderedSemifield 𝕜] [TopologicalSpace 𝕜] [OrderTopology 𝕜] [ContinuousMul 𝕜] : HasContinuousInv₀ 𝕜 := .of_nhds_one <| tendsto_order.2 <| by refine ⟨fun x hx => ?_, fun x hx => ?_⟩ · obtain ⟨x', h₀, hxx', h₁⟩ : ∃ x', 0 < x' ∧ x ≤ x' ∧ x' < 1 := ⟨max x (1 / 2), one_half_pos.trans_le (le_max_right _ _), le_max_left _ _, max_lt hx one_half_lt_one⟩ filter_upwards [Ioo_mem_nhds one_pos (one_lt_inv h₀ h₁)] with y hy exact hxx'.trans_lt <| inv_inv x' ▸ inv_lt_inv_of_lt hy.1 hy.2 · filter_upwards [Ioi_mem_nhds (inv_lt_one hx)] with y hy simpa only [inv_inv] using inv_lt_inv_of_lt (inv_pos.2 <| one_pos.trans hx) hy instance (priority := 100) LinearOrderedField.toTopologicalDivisionRing : TopologicalDivisionRing 𝕜 := ⟨⟩ -- Porting note (#11215): TODO: generalize to a `GroupWithZero` theorem nhdsWithin_pos_comap_mul_left {x : 𝕜} (hx : 0 < x) : comap (x * ·) (𝓝[>] 0) = 𝓝[>] 0 := by rw [nhdsWithin, comap_inf, comap_principal, preimage_const_mul_Ioi _ hx, zero_div] congr 1 refine ((Homeomorph.mulLeft₀ x hx.ne').comap_nhds_eq _).trans ?_ simp theorem eventually_nhdsWithin_pos_mul_left {x : 𝕜} (hx : 0 < x) {p : 𝕜 → Prop} (h : ∀ᶠ ε in 𝓝[>] 0, p ε) : ∀ᶠ ε in 𝓝[>] 0, p (x * ε) := by rw [← nhdsWithin_pos_comap_mul_left hx] exact h.comap fun ε => x * ε
Topology\Algebra\Order\Floor.lean
/- Copyright (c) 2020 Anatole Dedecker. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Anatole Dedecker -/ import Mathlib.Algebra.Order.Floor import Mathlib.Topology.Algebra.Order.Group import Mathlib.Topology.Order.Basic /-! # Topological facts about `Int.floor`, `Int.ceil` and `Int.fract` This file proves statements about limits and continuity of functions involving `floor`, `ceil` and `fract`. ## Main declarations * `tendsto_floor_atTop`, `tendsto_floor_atBot`, `tendsto_ceil_atTop`, `tendsto_ceil_atBot`: `Int.floor` and `Int.ceil` tend to +-∞ in +-∞. * `continuousOn_floor`: `Int.floor` is continuous on `Ico n (n + 1)`, because constant. * `continuousOn_ceil`: `Int.ceil` is continuous on `Ioc n (n + 1)`, because constant. * `continuousOn_fract`: `Int.fract` is continuous on `Ico n (n + 1)`. * `ContinuousOn.comp_fract`: Precomposing a continuous function satisfying `f 0 = f 1` with `Int.fract` yields another continuous function. -/ open Filter Function Int Set Topology variable {α β γ : Type*} [LinearOrderedRing α] [FloorRing α] theorem tendsto_floor_atTop : Tendsto (floor : α → ℤ) atTop atTop := floor_mono.tendsto_atTop_atTop fun b => ⟨(b + 1 : ℤ), by rw [floor_intCast]; exact (lt_add_one _).le⟩ theorem tendsto_floor_atBot : Tendsto (floor : α → ℤ) atBot atBot := floor_mono.tendsto_atBot_atBot fun b => ⟨b, (floor_intCast _).le⟩ theorem tendsto_ceil_atTop : Tendsto (ceil : α → ℤ) atTop atTop := ceil_mono.tendsto_atTop_atTop fun b => ⟨b, (ceil_intCast _).ge⟩ theorem tendsto_ceil_atBot : Tendsto (ceil : α → ℤ) atBot atBot := ceil_mono.tendsto_atBot_atBot fun b => ⟨(b - 1 : ℤ), by rw [ceil_intCast]; exact (sub_one_lt _).le⟩ variable [TopologicalSpace α] theorem continuousOn_floor (n : ℤ) : ContinuousOn (fun x => floor x : α → α) (Ico n (n + 1) : Set α) := (continuousOn_congr <| floor_eq_on_Ico' n).mpr continuousOn_const theorem continuousOn_ceil (n : ℤ) : ContinuousOn (fun x => ceil x : α → α) (Ioc (n - 1) n : Set α) := (continuousOn_congr <| ceil_eq_on_Ioc' n).mpr continuousOn_const section OrderClosedTopology variable [OrderClosedTopology α] theorem tendsto_floor_right_pure_floor (x : α) : Tendsto (floor : α → ℤ) (𝓝[≥] x) (pure ⌊x⌋) := tendsto_pure.2 <| mem_of_superset (Ico_mem_nhdsWithin_Ici' <| lt_floor_add_one x) fun _y hy => floor_eq_on_Ico _ _ ⟨(floor_le x).trans hy.1, hy.2⟩ theorem tendsto_floor_right_pure (n : ℤ) : Tendsto (floor : α → ℤ) (𝓝[≥] n) (pure n) := by simpa only [floor_intCast] using tendsto_floor_right_pure_floor (n : α) theorem tendsto_ceil_left_pure_ceil (x : α) : Tendsto (ceil : α → ℤ) (𝓝[≤] x) (pure ⌈x⌉) := tendsto_pure.2 <| mem_of_superset (Ioc_mem_nhdsWithin_Iic' <| sub_lt_iff_lt_add.2 <| ceil_lt_add_one _) fun _y hy => ceil_eq_on_Ioc _ _ ⟨hy.1, hy.2.trans (le_ceil _)⟩ theorem tendsto_ceil_left_pure (n : ℤ) : Tendsto (ceil : α → ℤ) (𝓝[≤] n) (pure n) := by simpa only [ceil_intCast] using tendsto_ceil_left_pure_ceil (n : α) theorem tendsto_floor_left_pure_ceil_sub_one (x : α) : Tendsto (floor : α → ℤ) (𝓝[<] x) (pure (⌈x⌉ - 1)) := have h₁ : ↑(⌈x⌉ - 1) < x := by rw [cast_sub, cast_one, sub_lt_iff_lt_add]; exact ceil_lt_add_one _ have h₂ : x ≤ ↑(⌈x⌉ - 1) + 1 := by rw [cast_sub, cast_one, sub_add_cancel]; exact le_ceil _ tendsto_pure.2 <| mem_of_superset (Ico_mem_nhdsWithin_Iio' h₁) fun _y hy => floor_eq_on_Ico _ _ ⟨hy.1, hy.2.trans_le h₂⟩ theorem tendsto_floor_left_pure_sub_one (n : ℤ) : Tendsto (floor : α → ℤ) (𝓝[<] n) (pure (n - 1)) := by simpa only [ceil_intCast] using tendsto_floor_left_pure_ceil_sub_one (n : α) theorem tendsto_ceil_right_pure_floor_add_one (x : α) : Tendsto (ceil : α → ℤ) (𝓝[>] x) (pure (⌊x⌋ + 1)) := have : ↑(⌊x⌋ + 1) - 1 ≤ x := by rw [cast_add, cast_one, add_sub_cancel_right]; exact floor_le _ tendsto_pure.2 <| mem_of_superset (Ioc_mem_nhdsWithin_Ioi' <| lt_succ_floor _) fun _y hy => ceil_eq_on_Ioc _ _ ⟨this.trans_lt hy.1, hy.2⟩ theorem tendsto_ceil_right_pure_add_one (n : ℤ) : Tendsto (ceil : α → ℤ) (𝓝[>] n) (pure (n + 1)) := by simpa only [floor_intCast] using tendsto_ceil_right_pure_floor_add_one (n : α) theorem tendsto_floor_right (n : ℤ) : Tendsto (fun x => floor x : α → α) (𝓝[≥] n) (𝓝[≥] n) := ((tendsto_pure_pure _ _).comp (tendsto_floor_right_pure n)).mono_right <| pure_le_nhdsWithin le_rfl theorem tendsto_floor_right' (n : ℤ) : Tendsto (fun x => floor x : α → α) (𝓝[≥] n) (𝓝 n) := (tendsto_floor_right n).mono_right inf_le_left theorem tendsto_ceil_left (n : ℤ) : Tendsto (fun x => ceil x : α → α) (𝓝[≤] n) (𝓝[≤] n) := ((tendsto_pure_pure _ _).comp (tendsto_ceil_left_pure n)).mono_right <| pure_le_nhdsWithin le_rfl theorem tendsto_ceil_left' (n : ℤ) : Tendsto (fun x => ceil x : α → α) (𝓝[≤] n) (𝓝 n) := (tendsto_ceil_left n).mono_right inf_le_left theorem tendsto_floor_left (n : ℤ) : Tendsto (fun x => floor x : α → α) (𝓝[<] n) (𝓝[≤] (n - 1)) := ((tendsto_pure_pure _ _).comp (tendsto_floor_left_pure_sub_one n)).mono_right <| by rw [← @cast_one α, ← cast_sub]; exact pure_le_nhdsWithin le_rfl theorem tendsto_ceil_right (n : ℤ) : Tendsto (fun x => ceil x : α → α) (𝓝[>] n) (𝓝[≥] (n + 1)) := ((tendsto_pure_pure _ _).comp (tendsto_ceil_right_pure_add_one n)).mono_right <| by rw [← @cast_one α, ← cast_add]; exact pure_le_nhdsWithin le_rfl theorem tendsto_floor_left' (n : ℤ) : Tendsto (fun x => floor x : α → α) (𝓝[<] n) (𝓝 (n - 1)) := (tendsto_floor_left n).mono_right inf_le_left theorem tendsto_ceil_right' (n : ℤ) : Tendsto (fun x => ceil x : α → α) (𝓝[>] n) (𝓝 (n + 1)) := (tendsto_ceil_right n).mono_right inf_le_left end OrderClosedTopology theorem continuousOn_fract [TopologicalAddGroup α] (n : ℤ) : ContinuousOn (fract : α → α) (Ico n (n + 1) : Set α) := continuousOn_id.sub (continuousOn_floor n) theorem continuousAt_fract [OrderClosedTopology α] [TopologicalAddGroup α] {x : α} (h : x ≠ ⌊x⌋) : ContinuousAt fract x := (continuousOn_fract ⌊x⌋).continuousAt <| Ico_mem_nhds ((floor_le _).lt_of_ne h.symm) (lt_floor_add_one _) theorem tendsto_fract_left' [OrderClosedTopology α] [TopologicalAddGroup α] (n : ℤ) : Tendsto (fract : α → α) (𝓝[<] n) (𝓝 1) := by rw [← sub_sub_cancel (n : α) 1] refine (tendsto_id.mono_left nhdsWithin_le_nhds).sub ?_ exact tendsto_floor_left' n theorem tendsto_fract_left [OrderClosedTopology α] [TopologicalAddGroup α] (n : ℤ) : Tendsto (fract : α → α) (𝓝[<] n) (𝓝[<] 1) := tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within _ (tendsto_fract_left' _) (eventually_of_forall fract_lt_one) theorem tendsto_fract_right' [OrderClosedTopology α] [TopologicalAddGroup α] (n : ℤ) : Tendsto (fract : α → α) (𝓝[≥] n) (𝓝 0) := sub_self (n : α) ▸ (tendsto_nhdsWithin_of_tendsto_nhds tendsto_id).sub (tendsto_floor_right' n) theorem tendsto_fract_right [OrderClosedTopology α] [TopologicalAddGroup α] (n : ℤ) : Tendsto (fract : α → α) (𝓝[≥] n) (𝓝[≥] 0) := tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within _ (tendsto_fract_right' _) (eventually_of_forall fract_nonneg) local notation "I" => (Icc 0 1 : Set α) variable [OrderTopology α] [TopologicalSpace β] [TopologicalSpace γ] /-- Do not use this, use `ContinuousOn.comp_fract` instead. -/ theorem ContinuousOn.comp_fract' {f : β → α → γ} (h : ContinuousOn (uncurry f) <| univ ×ˢ I) (hf : ∀ s, f s 0 = f s 1) : Continuous fun st : β × α => f st.1 (fract st.2) := by change Continuous (uncurry f ∘ Prod.map id fract) rw [continuous_iff_continuousAt] rintro ⟨s, t⟩ rcases em (∃ n : ℤ, t = n) with (⟨n, rfl⟩ | ht) · rw [ContinuousAt, nhds_prod_eq, ← nhds_left'_sup_nhds_right (n : α), prod_sup, tendsto_sup] constructor · refine (((h (s, 1) ⟨trivial, zero_le_one, le_rfl⟩).tendsto.mono_left ?_).comp (tendsto_id.prod_map (tendsto_fract_left _))).mono_right (le_of_eq ?_) · rw [nhdsWithin_prod_eq, nhdsWithin_univ, ← nhdsWithin_Ico_eq_nhdsWithin_Iio one_pos] exact Filter.prod_mono le_rfl (nhdsWithin_mono _ Ico_subset_Icc_self) · simp [hf] · refine (((h (s, 0) ⟨trivial, le_rfl, zero_le_one⟩).tendsto.mono_left <| le_of_eq ?_).comp (tendsto_id.prod_map (tendsto_fract_right _))).mono_right (le_of_eq ?_) <;> simp [nhdsWithin_prod_eq, nhdsWithin_univ] · replace ht : t ≠ ⌊t⌋ := fun ht' => ht ⟨_, ht'⟩ refine (h.continuousAt ?_).comp (continuousAt_id.prod_map (continuousAt_fract ht)) exact prod_mem_nhds univ_mem (Icc_mem_nhds (fract_pos.2 ht) (fract_lt_one _)) theorem ContinuousOn.comp_fract {s : β → α} {f : β → α → γ} (h : ContinuousOn (uncurry f) <| univ ×ˢ Icc 0 1) (hs : Continuous s) (hf : ∀ s, f s 0 = f s 1) : Continuous fun x : β => f x <| Int.fract (s x) := (h.comp_fract' hf).comp (continuous_id.prod_mk hs) /-- A special case of `ContinuousOn.comp_fract`. -/ theorem ContinuousOn.comp_fract'' {f : α → β} (h : ContinuousOn f I) (hf : f 0 = f 1) : Continuous (f ∘ fract) := ContinuousOn.comp_fract (h.comp continuousOn_snd fun _x hx => (mem_prod.mp hx).2) continuous_id fun _ => hf
Topology\Algebra\Order\Group.lean
/- Copyright (c) 2020 Yury Kudryashov. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yury Kudryashov -/ import Mathlib.Topology.Algebra.Group.Basic import Mathlib.Topology.Order.LeftRightNhds /-! # Topology on a linear ordered additive commutative group In this file we prove that a linear ordered additive commutative group with order topology is a topological group. We also prove continuity of `abs : G → G` and provide convenience lemmas like `ContinuousAt.abs`. -/ open Set Filter open Topology Filter variable {α G : Type*} [TopologicalSpace G] [LinearOrderedAddCommGroup G] [OrderTopology G] variable {l : Filter α} {f g : α → G} -- see Note [lower instance priority] instance (priority := 100) LinearOrderedAddCommGroup.topologicalAddGroup : TopologicalAddGroup G where continuous_add := by refine continuous_iff_continuousAt.2 ?_ rintro ⟨a, b⟩ refine LinearOrderedAddCommGroup.tendsto_nhds.2 fun ε ε0 => ?_ rcases dense_or_discrete 0 ε with (⟨δ, δ0, δε⟩ | ⟨_h₁, h₂⟩) · -- If there exists `δ ∈ (0, ε)`, then we choose `δ`-nhd of `a` and `(ε-δ)`-nhd of `b` filter_upwards [(eventually_abs_sub_lt a δ0).prod_nhds (eventually_abs_sub_lt b (sub_pos.2 δε))] rintro ⟨x, y⟩ ⟨hx : |x - a| < δ, hy : |y - b| < ε - δ⟩ rw [add_sub_add_comm] calc |x - a + (y - b)| ≤ |x - a| + |y - b| := abs_add _ _ _ < δ + (ε - δ) := add_lt_add hx hy _ = ε := add_sub_cancel _ _ · -- Otherwise `ε`-nhd of each point `a` is `{a}` have hε : ∀ {x y}, |x - y| < ε → x = y := by intro x y h simpa [sub_eq_zero] using h₂ _ h filter_upwards [(eventually_abs_sub_lt a ε0).prod_nhds (eventually_abs_sub_lt b ε0)] rintro ⟨x, y⟩ ⟨hx : |x - a| < ε, hy : |y - b| < ε⟩ simpa [hε hx, hε hy] continuous_neg := continuous_iff_continuousAt.2 fun a => LinearOrderedAddCommGroup.tendsto_nhds.2 fun ε ε0 => (eventually_abs_sub_lt a ε0).mono fun x hx => by rwa [neg_sub_neg, abs_sub_comm] @[continuity] theorem continuous_abs : Continuous (abs : G → G) := continuous_id.max continuous_neg protected theorem Filter.Tendsto.abs {a : G} (h : Tendsto f l (𝓝 a)) : Tendsto (fun x => |f x|) l (𝓝 |a|) := (continuous_abs.tendsto _).comp h theorem tendsto_zero_iff_abs_tendsto_zero (f : α → G) : Tendsto f l (𝓝 0) ↔ Tendsto (abs ∘ f) l (𝓝 0) := by refine ⟨fun h => (abs_zero : |(0 : G)| = 0) ▸ h.abs, fun h => ?_⟩ have : Tendsto (fun a => -|f a|) l (𝓝 0) := (neg_zero : -(0 : G) = 0) ▸ h.neg exact tendsto_of_tendsto_of_tendsto_of_le_of_le this h (fun x => neg_abs_le <| f x) fun x => le_abs_self <| f x variable [TopologicalSpace α] {a : α} {s : Set α} @[fun_prop] protected theorem Continuous.abs (h : Continuous f) : Continuous fun x => |f x| := continuous_abs.comp h @[fun_prop] protected theorem ContinuousAt.abs (h : ContinuousAt f a) : ContinuousAt (fun x => |f x|) a := Filter.Tendsto.abs h protected theorem ContinuousWithinAt.abs (h : ContinuousWithinAt f s a) : ContinuousWithinAt (fun x => |f x|) s a := Filter.Tendsto.abs h @[fun_prop] protected theorem ContinuousOn.abs (h : ContinuousOn f s) : ContinuousOn (fun x => |f x|) s := fun x hx => (h x hx).abs theorem tendsto_abs_nhdsWithin_zero : Tendsto (abs : G → G) (𝓝[≠] 0) (𝓝[>] 0) := (continuous_abs.tendsto' (0 : G) 0 abs_zero).inf <| tendsto_principal_principal.2 fun _x => abs_pos.2
Topology\Algebra\Order\LiminfLimsup.lean
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov, Yaël Dillies -/ import Mathlib.Algebra.BigOperators.Intervals import Mathlib.Algebra.BigOperators.Ring import Mathlib.Algebra.Order.Group.Indicator import Mathlib.Order.LiminfLimsup import Mathlib.Order.Filter.Archimedean import Mathlib.Order.Filter.CountableInter import Mathlib.Topology.Algebra.Group.Basic import Mathlib.Data.Set.Lattice import Mathlib.Topology.Order.Monotone /-! # Lemmas about liminf and limsup in an order topology. ## Main declarations * `BoundedLENhdsClass`: Typeclass stating that neighborhoods are eventually bounded above. * `BoundedGENhdsClass`: Typeclass stating that neighborhoods are eventually bounded below. ## Implementation notes The same lemmas are true in `ℝ`, `ℝ × ℝ`, `ι → ℝ`, `EuclideanSpace ι ℝ`. To avoid code duplication, we provide an ad hoc axiomatisation of the properties we need. -/ open Filter TopologicalSpace open scoped Topology Classical universe u v variable {ι α β R S : Type*} {π : ι → Type*} /-- Ad hoc typeclass stating that neighborhoods are eventually bounded above. -/ class BoundedLENhdsClass (α : Type*) [Preorder α] [TopologicalSpace α] : Prop where isBounded_le_nhds (a : α) : (𝓝 a).IsBounded (· ≤ ·) /-- Ad hoc typeclass stating that neighborhoods are eventually bounded below. -/ class BoundedGENhdsClass (α : Type*) [Preorder α] [TopologicalSpace α] : Prop where isBounded_ge_nhds (a : α) : (𝓝 a).IsBounded (· ≥ ·) section Preorder variable [Preorder α] [Preorder β] [TopologicalSpace α] [TopologicalSpace β] section BoundedLENhdsClass variable [BoundedLENhdsClass α] [BoundedLENhdsClass β] {f : Filter ι} {u : ι → α} {a : α} theorem isBounded_le_nhds (a : α) : (𝓝 a).IsBounded (· ≤ ·) := BoundedLENhdsClass.isBounded_le_nhds _ theorem Filter.Tendsto.isBoundedUnder_le (h : Tendsto u f (𝓝 a)) : f.IsBoundedUnder (· ≤ ·) u := (isBounded_le_nhds a).mono h theorem Filter.Tendsto.bddAbove_range_of_cofinite [IsDirected α (· ≤ ·)] (h : Tendsto u cofinite (𝓝 a)) : BddAbove (Set.range u) := h.isBoundedUnder_le.bddAbove_range_of_cofinite theorem Filter.Tendsto.bddAbove_range [IsDirected α (· ≤ ·)] {u : ℕ → α} (h : Tendsto u atTop (𝓝 a)) : BddAbove (Set.range u) := h.isBoundedUnder_le.bddAbove_range theorem isCobounded_ge_nhds (a : α) : (𝓝 a).IsCobounded (· ≥ ·) := (isBounded_le_nhds a).isCobounded_flip theorem Filter.Tendsto.isCoboundedUnder_ge [NeBot f] (h : Tendsto u f (𝓝 a)) : f.IsCoboundedUnder (· ≥ ·) u := h.isBoundedUnder_le.isCobounded_flip instance : BoundedGENhdsClass αᵒᵈ := ⟨@isBounded_le_nhds α _ _ _⟩ instance Prod.instBoundedLENhdsClass : BoundedLENhdsClass (α × β) := by refine ⟨fun x ↦ ?_⟩ obtain ⟨a, ha⟩ := isBounded_le_nhds x.1 obtain ⟨b, hb⟩ := isBounded_le_nhds x.2 rw [← @Prod.mk.eta _ _ x, nhds_prod_eq] exact ⟨(a, b), ha.prod_mk hb⟩ instance Pi.instBoundedLENhdsClass [Finite ι] [∀ i, Preorder (π i)] [∀ i, TopologicalSpace (π i)] [∀ i, BoundedLENhdsClass (π i)] : BoundedLENhdsClass (∀ i, π i) := by refine ⟨fun x ↦ ?_⟩ rw [nhds_pi] choose f hf using fun i ↦ isBounded_le_nhds (x i) exact ⟨f, eventually_pi hf⟩ end BoundedLENhdsClass section BoundedGENhdsClass variable [BoundedGENhdsClass α] [BoundedGENhdsClass β] {f : Filter ι} {u : ι → α} {a : α} theorem isBounded_ge_nhds (a : α) : (𝓝 a).IsBounded (· ≥ ·) := BoundedGENhdsClass.isBounded_ge_nhds _ theorem Filter.Tendsto.isBoundedUnder_ge (h : Tendsto u f (𝓝 a)) : f.IsBoundedUnder (· ≥ ·) u := (isBounded_ge_nhds a).mono h theorem Filter.Tendsto.bddBelow_range_of_cofinite [IsDirected α (· ≥ ·)] (h : Tendsto u cofinite (𝓝 a)) : BddBelow (Set.range u) := h.isBoundedUnder_ge.bddBelow_range_of_cofinite theorem Filter.Tendsto.bddBelow_range [IsDirected α (· ≥ ·)] {u : ℕ → α} (h : Tendsto u atTop (𝓝 a)) : BddBelow (Set.range u) := h.isBoundedUnder_ge.bddBelow_range theorem isCobounded_le_nhds (a : α) : (𝓝 a).IsCobounded (· ≤ ·) := (isBounded_ge_nhds a).isCobounded_flip theorem Filter.Tendsto.isCoboundedUnder_le [NeBot f] (h : Tendsto u f (𝓝 a)) : f.IsCoboundedUnder (· ≤ ·) u := h.isBoundedUnder_ge.isCobounded_flip instance : BoundedLENhdsClass αᵒᵈ := ⟨@isBounded_ge_nhds α _ _ _⟩ instance Prod.instBoundedGENhdsClass : BoundedGENhdsClass (α × β) := ⟨(Prod.instBoundedLENhdsClass (α := αᵒᵈ) (β := βᵒᵈ)).isBounded_le_nhds⟩ instance Pi.instBoundedGENhdsClass [Finite ι] [∀ i, Preorder (π i)] [∀ i, TopologicalSpace (π i)] [∀ i, BoundedGENhdsClass (π i)] : BoundedGENhdsClass (∀ i, π i) := ⟨(Pi.instBoundedLENhdsClass (π := fun i ↦ (π i)ᵒᵈ)).isBounded_le_nhds⟩ end BoundedGENhdsClass -- See note [lower instance priority] instance (priority := 100) OrderTop.to_BoundedLENhdsClass [OrderTop α] : BoundedLENhdsClass α := ⟨fun _a ↦ isBounded_le_of_top⟩ -- See note [lower instance priority] instance (priority := 100) OrderBot.to_BoundedGENhdsClass [OrderBot α] : BoundedGENhdsClass α := ⟨fun _a ↦ isBounded_ge_of_bot⟩ -- See note [lower instance priority] instance (priority := 100) OrderTopology.to_BoundedLENhdsClass [IsDirected α (· ≤ ·)] [OrderTopology α] : BoundedLENhdsClass α := ⟨fun a ↦ ((isTop_or_exists_gt a).elim fun h ↦ ⟨a, eventually_of_forall h⟩) <| Exists.imp fun _b ↦ ge_mem_nhds⟩ -- See note [lower instance priority] instance (priority := 100) OrderTopology.to_BoundedGENhdsClass [IsDirected α (· ≥ ·)] [OrderTopology α] : BoundedGENhdsClass α := ⟨fun a ↦ ((isBot_or_exists_lt a).elim fun h ↦ ⟨a, eventually_of_forall h⟩) <| Exists.imp fun _b ↦ le_mem_nhds⟩ end Preorder section LiminfLimsup section ConditionallyCompleteLinearOrder variable [ConditionallyCompleteLinearOrder α] [TopologicalSpace α] [OrderTopology α] /-- If the liminf and the limsup of a filter coincide, then this filter converges to their common value, at least if the filter is eventually bounded above and below. -/ theorem le_nhds_of_limsSup_eq_limsInf {f : Filter α} {a : α} (hl : f.IsBounded (· ≤ ·)) (hg : f.IsBounded (· ≥ ·)) (hs : f.limsSup = a) (hi : f.limsInf = a) : f ≤ 𝓝 a := tendsto_order.2 ⟨fun _ hb ↦ gt_mem_sets_of_limsInf_gt hg <| hi.symm ▸ hb, fun _ hb ↦ lt_mem_sets_of_limsSup_lt hl <| hs.symm ▸ hb⟩ theorem limsSup_nhds (a : α) : limsSup (𝓝 a) = a := csInf_eq_of_forall_ge_of_forall_gt_exists_lt (isBounded_le_nhds a) (fun a' (h : { n : α | n ≤ a' } ∈ 𝓝 a) ↦ show a ≤ a' from @mem_of_mem_nhds α a _ _ h) fun b (hba : a < b) ↦ show ∃ c, { n : α | n ≤ c } ∈ 𝓝 a ∧ c < b from match dense_or_discrete a b with | Or.inl ⟨c, hac, hcb⟩ => ⟨c, ge_mem_nhds hac, hcb⟩ | Or.inr ⟨_, h⟩ => ⟨a, (𝓝 a).sets_of_superset (gt_mem_nhds hba) h, hba⟩ theorem limsInf_nhds : ∀ a : α, limsInf (𝓝 a) = a := limsSup_nhds (α := αᵒᵈ) /-- If a filter is converging, its limsup coincides with its limit. -/ theorem limsInf_eq_of_le_nhds {f : Filter α} {a : α} [NeBot f] (h : f ≤ 𝓝 a) : f.limsInf = a := have hb_ge : IsBounded (· ≥ ·) f := (isBounded_ge_nhds a).mono h have hb_le : IsBounded (· ≤ ·) f := (isBounded_le_nhds a).mono h le_antisymm (calc f.limsInf ≤ f.limsSup := limsInf_le_limsSup hb_le hb_ge _ ≤ (𝓝 a).limsSup := limsSup_le_limsSup_of_le h hb_ge.isCobounded_flip (isBounded_le_nhds a) _ = a := limsSup_nhds a) (calc a = (𝓝 a).limsInf := (limsInf_nhds a).symm _ ≤ f.limsInf := limsInf_le_limsInf_of_le h (isBounded_ge_nhds a) hb_le.isCobounded_flip) /-- If a filter is converging, its liminf coincides with its limit. -/ theorem limsSup_eq_of_le_nhds : ∀ {f : Filter α} {a : α} [NeBot f], f ≤ 𝓝 a → f.limsSup = a := limsInf_eq_of_le_nhds (α := αᵒᵈ) /-- If a function has a limit, then its limsup coincides with its limit. -/ theorem Filter.Tendsto.limsup_eq {f : Filter β} {u : β → α} {a : α} [NeBot f] (h : Tendsto u f (𝓝 a)) : limsup u f = a := limsSup_eq_of_le_nhds h /-- If a function has a limit, then its liminf coincides with its limit. -/ theorem Filter.Tendsto.liminf_eq {f : Filter β} {u : β → α} {a : α} [NeBot f] (h : Tendsto u f (𝓝 a)) : liminf u f = a := limsInf_eq_of_le_nhds h /-- If the liminf and the limsup of a function coincide, then the limit of the function exists and has the same value. -/ theorem tendsto_of_liminf_eq_limsup {f : Filter β} {u : β → α} {a : α} (hinf : liminf u f = a) (hsup : limsup u f = a) (h : f.IsBoundedUnder (· ≤ ·) u := by isBoundedDefault) (h' : f.IsBoundedUnder (· ≥ ·) u := by isBoundedDefault) : Tendsto u f (𝓝 a) := le_nhds_of_limsSup_eq_limsInf h h' hsup hinf /-- If a number `a` is less than or equal to the `liminf` of a function `f` at some filter and is greater than or equal to the `limsup` of `f`, then `f` tends to `a` along this filter. -/ theorem tendsto_of_le_liminf_of_limsup_le {f : Filter β} {u : β → α} {a : α} (hinf : a ≤ liminf u f) (hsup : limsup u f ≤ a) (h : f.IsBoundedUnder (· ≤ ·) u := by isBoundedDefault) (h' : f.IsBoundedUnder (· ≥ ·) u := by isBoundedDefault) : Tendsto u f (𝓝 a) := if hf : f = ⊥ then hf.symm ▸ tendsto_bot else haveI : NeBot f := ⟨hf⟩ tendsto_of_liminf_eq_limsup (le_antisymm (le_trans (liminf_le_limsup h h') hsup) hinf) (le_antisymm hsup (le_trans hinf (liminf_le_limsup h h'))) h h' /-- Assume that, for any `a < b`, a sequence can not be infinitely many times below `a` and above `b`. If it is also ultimately bounded above and below, then it has to converge. This even works if `a` and `b` are restricted to a dense subset. -/ theorem tendsto_of_no_upcrossings [DenselyOrdered α] {f : Filter β} {u : β → α} {s : Set α} (hs : Dense s) (H : ∀ a ∈ s, ∀ b ∈ s, a < b → ¬((∃ᶠ n in f, u n < a) ∧ ∃ᶠ n in f, b < u n)) (h : f.IsBoundedUnder (· ≤ ·) u := by isBoundedDefault) (h' : f.IsBoundedUnder (· ≥ ·) u := by isBoundedDefault) : ∃ c : α, Tendsto u f (𝓝 c) := by rcases f.eq_or_neBot with rfl | hbot · exact ⟨sInf ∅, tendsto_bot⟩ refine ⟨limsup u f, ?_⟩ apply tendsto_of_le_liminf_of_limsup_le _ le_rfl h h' by_contra! hlt obtain ⟨a, ⟨⟨la, au⟩, as⟩⟩ : ∃ a, (f.liminf u < a ∧ a < f.limsup u) ∧ a ∈ s := dense_iff_inter_open.1 hs (Set.Ioo (f.liminf u) (f.limsup u)) isOpen_Ioo (Set.nonempty_Ioo.2 hlt) obtain ⟨b, ⟨⟨ab, bu⟩, bs⟩⟩ : ∃ b, (a < b ∧ b < f.limsup u) ∧ b ∈ s := dense_iff_inter_open.1 hs (Set.Ioo a (f.limsup u)) isOpen_Ioo (Set.nonempty_Ioo.2 au) have A : ∃ᶠ n in f, u n < a := frequently_lt_of_liminf_lt (IsBounded.isCobounded_ge h) la have B : ∃ᶠ n in f, b < u n := frequently_lt_of_lt_limsup (IsBounded.isCobounded_le h') bu exact H a as b bs ab ⟨A, B⟩ variable [FirstCountableTopology α] {f : Filter β} [CountableInterFilter f] {u : β → α} theorem eventually_le_limsup (hf : IsBoundedUnder (· ≤ ·) f u := by isBoundedDefault) : ∀ᶠ b in f, u b ≤ f.limsup u := by obtain ha | ha := isTop_or_exists_gt (f.limsup u) · exact eventually_of_forall fun _ => ha _ by_cases H : IsGLB (Set.Ioi (f.limsup u)) (f.limsup u) · obtain ⟨u, -, -, hua, hu⟩ := H.exists_seq_antitone_tendsto ha have := fun n => eventually_lt_of_limsup_lt (hu n) hf exact (eventually_countable_forall.2 this).mono fun b hb => ge_of_tendsto hua <| eventually_of_forall fun n => (hb _).le · obtain ⟨x, hx, xa⟩ : ∃ x, (∀ ⦃b⦄, f.limsup u < b → x ≤ b) ∧ f.limsup u < x := by simp only [IsGLB, IsGreatest, lowerBounds, upperBounds, Set.mem_Ioi, Set.mem_setOf_eq, not_and, not_forall, not_le, exists_prop] at H exact H fun x => le_of_lt filter_upwards [eventually_lt_of_limsup_lt xa hf] with y hy contrapose! hy exact hx hy theorem eventually_liminf_le (hf : IsBoundedUnder (· ≥ ·) f u := by isBoundedDefault) : ∀ᶠ b in f, f.liminf u ≤ u b := eventually_le_limsup (α := αᵒᵈ) hf end ConditionallyCompleteLinearOrder section CompleteLinearOrder variable [CompleteLinearOrder α] [TopologicalSpace α] [FirstCountableTopology α] [OrderTopology α] {f : Filter β} [CountableInterFilter f] {u : β → α} @[simp] theorem limsup_eq_bot : f.limsup u = ⊥ ↔ u =ᶠ[f] ⊥ := ⟨fun h => (EventuallyLE.trans eventually_le_limsup <| eventually_of_forall fun _ => h.le).mono fun x hx => le_antisymm hx bot_le, fun h => by rw [limsup_congr h] exact limsup_const_bot⟩ @[simp] theorem liminf_eq_top : f.liminf u = ⊤ ↔ u =ᶠ[f] ⊤ := limsup_eq_bot (α := αᵒᵈ) end CompleteLinearOrder end LiminfLimsup section Monotone variable {F : Filter ι} [NeBot F] [ConditionallyCompleteLinearOrder R] [TopologicalSpace R] [OrderTopology R] [ConditionallyCompleteLinearOrder S] [TopologicalSpace S] [OrderTopology S] /-- An antitone function between (conditionally) complete linear ordered spaces sends a `Filter.limsSup` to the `Filter.liminf` of the image if the function is continuous at the `limsSup` (and the filter is bounded from above and frequently bounded from below). -/ theorem Antitone.map_limsSup_of_continuousAt {F : Filter R} [NeBot F] {f : R → S} (f_decr : Antitone f) (f_cont : ContinuousAt f F.limsSup) (bdd_above : F.IsBounded (· ≤ ·) := by isBoundedDefault) (cobdd : F.IsCobounded (· ≤ ·) := by isBoundedDefault) : f F.limsSup = F.liminf f := by apply le_antisymm · rw [limsSup, f_decr.map_sInf_of_continuousAt' f_cont bdd_above cobdd] apply le_of_forall_lt intro c hc simp only [liminf, limsInf, eventually_map] at hc ⊢ obtain ⟨d, hd, h'd⟩ := exists_lt_of_lt_csSup (bdd_above.recOn fun x hx ↦ ⟨f x, Set.mem_image_of_mem f hx⟩) hc apply lt_csSup_of_lt ?_ ?_ h'd · simpa only [BddAbove, upperBounds] using Antitone.isCoboundedUnder_ge_of_isCobounded f_decr cobdd · rcases hd with ⟨e, ⟨he, fe_eq_d⟩⟩ filter_upwards [he] with x hx using (fe_eq_d.symm ▸ f_decr hx) · by_cases h' : ∃ c, c < F.limsSup ∧ Set.Ioo c F.limsSup = ∅ · rcases h' with ⟨c, c_lt, hc⟩ have B : ∃ᶠ n in F, F.limsSup ≤ n := by apply (frequently_lt_of_lt_limsSup cobdd c_lt).mono intro x hx by_contra! have : (Set.Ioo c F.limsSup).Nonempty := ⟨x, ⟨hx, this⟩⟩ simp only [hc, Set.not_nonempty_empty] at this apply liminf_le_of_frequently_le _ (bdd_above.isBoundedUnder f_decr) exact B.mono fun x hx ↦ f_decr hx push_neg at h' by_contra! H have not_bot : ¬ IsBot F.limsSup := fun maybe_bot ↦ lt_irrefl (F.liminf f) <| lt_of_le_of_lt (liminf_le_of_frequently_le (frequently_of_forall (fun r ↦ f_decr (maybe_bot r))) (bdd_above.isBoundedUnder f_decr)) H obtain ⟨l, l_lt, h'l⟩ : ∃ l < F.limsSup, Set.Ioc l F.limsSup ⊆ { x : R | f x < F.liminf f } := by apply exists_Ioc_subset_of_mem_nhds ((tendsto_order.1 f_cont.tendsto).2 _ H) simpa [IsBot] using not_bot obtain ⟨m, l_m, m_lt⟩ : (Set.Ioo l F.limsSup).Nonempty := by contrapose! h' exact ⟨l, l_lt, h'⟩ have B : F.liminf f ≤ f m := by apply liminf_le_of_frequently_le _ _ · apply (frequently_lt_of_lt_limsSup cobdd m_lt).mono exact fun x hx ↦ f_decr hx.le · exact IsBounded.isBoundedUnder f_decr bdd_above have I : f m < F.liminf f := h'l ⟨l_m, m_lt.le⟩ exact lt_irrefl _ (B.trans_lt I) /-- A continuous antitone function between (conditionally) complete linear ordered spaces sends a `Filter.limsup` to the `Filter.liminf` of the images (if the filter is bounded from above and frequently bounded from below). -/ theorem Antitone.map_limsup_of_continuousAt {f : R → S} (f_decr : Antitone f) (a : ι → R) (f_cont : ContinuousAt f (F.limsup a)) (bdd_above : F.IsBoundedUnder (· ≤ ·) a := by isBoundedDefault) (cobdd : F.IsCoboundedUnder (· ≤ ·) a := by isBoundedDefault) : f (F.limsup a) = F.liminf (f ∘ a) := f_decr.map_limsSup_of_continuousAt f_cont bdd_above cobdd /-- An antitone function between (conditionally) complete linear ordered spaces sends a `Filter.limsInf` to the `Filter.limsup` of the image if the function is continuous at the `limsInf` (and the filter is bounded from below and frequently bounded from above). -/ theorem Antitone.map_limsInf_of_continuousAt {F : Filter R} [NeBot F] {f : R → S} (f_decr : Antitone f) (f_cont : ContinuousAt f F.limsInf) (cobdd : F.IsCobounded (· ≥ ·) := by isBoundedDefault) (bdd_below : F.IsBounded (· ≥ ·) := by isBoundedDefault) : f F.limsInf = F.limsup f := Antitone.map_limsSup_of_continuousAt (R := Rᵒᵈ) (S := Sᵒᵈ) f_decr.dual f_cont bdd_below cobdd /-- A continuous antitone function between (conditionally) complete linear ordered spaces sends a `Filter.liminf` to the `Filter.limsup` of the images (if the filter is bounded from below and frequently bounded from above). -/ theorem Antitone.map_liminf_of_continuousAt {f : R → S} (f_decr : Antitone f) (a : ι → R) (f_cont : ContinuousAt f (F.liminf a)) (cobdd : F.IsCoboundedUnder (· ≥ ·) a := by isBoundedDefault) (bdd_below : F.IsBoundedUnder (· ≥ ·) a := by isBoundedDefault) : f (F.liminf a) = F.limsup (f ∘ a) := f_decr.map_limsInf_of_continuousAt f_cont cobdd bdd_below /-- A monotone function between (conditionally) complete linear ordered spaces sends a `Filter.limsSup` to the `Filter.limsup` of the image if the function is continuous at the `limsSup` (and the filter is bounded from above and frequently bounded from below). -/ theorem Monotone.map_limsSup_of_continuousAt {F : Filter R} [NeBot F] {f : R → S} (f_incr : Monotone f) (f_cont : ContinuousAt f F.limsSup) (bdd_above : F.IsBounded (· ≤ ·) := by isBoundedDefault) (cobdd : F.IsCobounded (· ≤ ·) := by isBoundedDefault) : f F.limsSup = F.limsup f := Antitone.map_limsSup_of_continuousAt (S := Sᵒᵈ) f_incr f_cont bdd_above cobdd /-- A continuous monotone function between (conditionally) complete linear ordered spaces sends a `Filter.limsup` to the `Filter.limsup` of the images (if the filter is bounded from above and frequently bounded from below). -/ theorem Monotone.map_limsup_of_continuousAt {f : R → S} (f_incr : Monotone f) (a : ι → R) (f_cont : ContinuousAt f (F.limsup a)) (bdd_above : F.IsBoundedUnder (· ≤ ·) a := by isBoundedDefault) (cobdd : F.IsCoboundedUnder (· ≤ ·) a := by isBoundedDefault) : f (F.limsup a) = F.limsup (f ∘ a) := f_incr.map_limsSup_of_continuousAt f_cont bdd_above cobdd /-- A monotone function between (conditionally) complete linear ordered spaces sends a `Filter.limsInf` to the `Filter.liminf` of the image if the function is continuous at the `limsInf` (and the filter is bounded from below and frequently bounded from above). -/ theorem Monotone.map_limsInf_of_continuousAt {F : Filter R} [NeBot F] {f : R → S} (f_incr : Monotone f) (f_cont : ContinuousAt f F.limsInf) (cobdd : F.IsCobounded (· ≥ ·) := by isBoundedDefault) (bdd_below : F.IsBounded (· ≥ ·) := by isBoundedDefault) : f F.limsInf = F.liminf f := Antitone.map_limsSup_of_continuousAt (R := Rᵒᵈ) f_incr.dual f_cont bdd_below cobdd /-- A continuous monotone function between (conditionally) complete linear ordered spaces sends a `Filter.liminf` to the `Filter.liminf` of the images (if the filter is bounded from below and frequently bounded from above). -/ theorem Monotone.map_liminf_of_continuousAt {f : R → S} (f_incr : Monotone f) (a : ι → R) (f_cont : ContinuousAt f (F.liminf a)) (cobdd : F.IsCoboundedUnder (· ≥ ·) a := by isBoundedDefault) (bdd_below : F.IsBoundedUnder (· ≥ ·) a := by isBoundedDefault) : f (F.liminf a) = F.liminf (f ∘ a) := f_incr.map_limsInf_of_continuousAt f_cont cobdd bdd_below end Monotone section InfiAndSupr open Topology open Filter Set variable [CompleteLinearOrder R] [TopologicalSpace R] [OrderTopology R] theorem iInf_eq_of_forall_le_of_tendsto {x : R} {as : ι → R} (x_le : ∀ i, x ≤ as i) {F : Filter ι} [Filter.NeBot F] (as_lim : Filter.Tendsto as F (𝓝 x)) : ⨅ i, as i = x := by refine iInf_eq_of_forall_ge_of_forall_gt_exists_lt (fun i ↦ x_le i) ?_ apply fun w x_lt_w ↦ ‹Filter.NeBot F›.nonempty_of_mem (eventually_lt_of_tendsto_lt x_lt_w as_lim) theorem iSup_eq_of_forall_le_of_tendsto {x : R} {as : ι → R} (le_x : ∀ i, as i ≤ x) {F : Filter ι} [Filter.NeBot F] (as_lim : Filter.Tendsto as F (𝓝 x)) : ⨆ i, as i = x := iInf_eq_of_forall_le_of_tendsto (R := Rᵒᵈ) le_x as_lim theorem iUnion_Ici_eq_Ioi_of_lt_of_tendsto (x : R) {as : ι → R} (x_lt : ∀ i, x < as i) {F : Filter ι} [Filter.NeBot F] (as_lim : Filter.Tendsto as F (𝓝 x)) : ⋃ i : ι, Ici (as i) = Ioi x := by have obs : x ∉ range as := by intro maybe_x_is rcases mem_range.mp maybe_x_is with ⟨i, hi⟩ simpa only [hi, lt_self_iff_false] using x_lt i -- Porting note: `rw at *` was too destructive. Let's only rewrite `obs` and the goal. have := iInf_eq_of_forall_le_of_tendsto (fun i ↦ (x_lt i).le) as_lim rw [← this] at obs rw [← this] exact iUnion_Ici_eq_Ioi_iInf obs theorem iUnion_Iic_eq_Iio_of_lt_of_tendsto (x : R) {as : ι → R} (lt_x : ∀ i, as i < x) {F : Filter ι} [Filter.NeBot F] (as_lim : Filter.Tendsto as F (𝓝 x)) : ⋃ i : ι, Iic (as i) = Iio x := iUnion_Ici_eq_Ioi_of_lt_of_tendsto (R := Rᵒᵈ) x lt_x as_lim end InfiAndSupr section Indicator theorem limsup_eq_tendsto_sum_indicator_nat_atTop (s : ℕ → Set α) : limsup s atTop = { ω | Tendsto (fun n ↦ ∑ k ∈ Finset.range n, (s (k + 1)).indicator (1 : α → ℕ) ω) atTop atTop } := by ext ω simp only [limsup_eq_iInf_iSup_of_nat, Set.iSup_eq_iUnion, Set.iInf_eq_iInter, Set.mem_iInter, Set.mem_iUnion, exists_prop] constructor · intro hω refine tendsto_atTop_atTop_of_monotone' (fun n m hnm ↦ Finset.sum_mono_set_of_nonneg (fun i ↦ Set.indicator_nonneg (fun _ _ ↦ zero_le_one) _) (Finset.range_mono hnm)) ?_ rintro ⟨i, h⟩ simp only [mem_upperBounds, Set.mem_range, forall_exists_index, forall_apply_eq_imp_iff] at h induction' i with k hk · obtain ⟨j, hj₁, hj₂⟩ := hω 1 refine not_lt.2 (h <| j + 1) (lt_of_le_of_lt (Finset.sum_const_zero.symm : 0 = ∑ k ∈ Finset.range (j + 1), 0).le ?_) refine Finset.sum_lt_sum (fun m _ ↦ Set.indicator_nonneg (fun _ _ ↦ zero_le_one) _) ⟨j - 1, Finset.mem_range.2 (lt_of_le_of_lt (Nat.sub_le _ _) j.lt_succ_self), ?_⟩ rw [Nat.sub_add_cancel hj₁, Set.indicator_of_mem hj₂] exact zero_lt_one · rw [imp_false] at hk push_neg at hk obtain ⟨i, hi⟩ := hk obtain ⟨j, hj₁, hj₂⟩ := hω (i + 1) replace hi : (∑ k ∈ Finset.range i, (s (k + 1)).indicator 1 ω) = k + 1 := le_antisymm (h i) hi refine not_lt.2 (h <| j + 1) ?_ rw [← Finset.sum_range_add_sum_Ico _ (i.le_succ.trans (hj₁.trans j.le_succ)), hi] refine lt_add_of_pos_right _ ?_ rw [(Finset.sum_const_zero.symm : 0 = ∑ k ∈ Finset.Ico i (j + 1), 0)] refine Finset.sum_lt_sum (fun m _ ↦ Set.indicator_nonneg (fun _ _ ↦ zero_le_one) _) ⟨j - 1, Finset.mem_Ico.2 ⟨(Nat.le_sub_iff_add_le (le_trans ((le_add_iff_nonneg_left _).2 zero_le') hj₁)).2 hj₁, lt_of_le_of_lt (Nat.sub_le _ _) j.lt_succ_self⟩, ?_⟩ rw [Nat.sub_add_cancel (le_trans ((le_add_iff_nonneg_left _).2 zero_le') hj₁), Set.indicator_of_mem hj₂] exact zero_lt_one · rintro hω i rw [Set.mem_setOf_eq, tendsto_atTop_atTop] at hω by_contra! hcon obtain ⟨j, h⟩ := hω (i + 1) have : (∑ k ∈ Finset.range j, (s (k + 1)).indicator 1 ω) ≤ i := by have hle : ∀ j ≤ i, (∑ k ∈ Finset.range j, (s (k + 1)).indicator 1 ω) ≤ i := by refine fun j hij ↦ (Finset.sum_le_card_nsmul _ _ _ ?_ : _ ≤ (Finset.range j).card • 1).trans ?_ · exact fun m _ ↦ Set.indicator_apply_le' (fun _ ↦ le_rfl) fun _ ↦ zero_le_one · simpa only [Finset.card_range, smul_eq_mul, mul_one] by_cases hij : j < i · exact hle _ hij.le · rw [← Finset.sum_range_add_sum_Ico _ (not_lt.1 hij)] suffices (∑ k ∈ Finset.Ico i j, (s (k + 1)).indicator 1 ω) = 0 by rw [this, add_zero] exact hle _ le_rfl refine Finset.sum_eq_zero fun m hm ↦ ?_ exact Set.indicator_of_not_mem (hcon _ <| (Finset.mem_Ico.1 hm).1.trans m.le_succ) _ exact not_le.2 (lt_of_lt_of_le i.lt_succ_self <| h _ le_rfl) this theorem limsup_eq_tendsto_sum_indicator_atTop (R : Type*) [StrictOrderedSemiring R] [Archimedean R] (s : ℕ → Set α) : limsup s atTop = { ω | Tendsto (fun n ↦ ∑ k ∈ Finset.range n, (s (k + 1)).indicator (1 : α → R) ω) atTop atTop } := by rw [limsup_eq_tendsto_sum_indicator_nat_atTop s] ext ω simp only [Set.mem_setOf_eq] rw [(_ : (fun n ↦ ∑ k ∈ Finset.range n, (s (k + 1)).indicator (1 : α → R) ω) = fun n ↦ ↑(∑ k ∈ Finset.range n, (s (k + 1)).indicator (1 : α → ℕ) ω))] · exact tendsto_natCast_atTop_iff.symm · ext n simp only [Set.indicator, Pi.one_apply, Finset.sum_boole, Nat.cast_id] end Indicator section LiminfLimsupAddSub variable [ConditionallyCompleteLinearOrder R] [TopologicalSpace R] [OrderTopology R] /-- `liminf (c + xᵢ) = c + liminf xᵢ`. -/ lemma limsup_const_add (F : Filter ι) [NeBot F] [Add R] [ContinuousAdd R] [CovariantClass R R (fun x y ↦ x + y) fun x y ↦ x ≤ y] (f : ι → R) (c : R) (bdd_above : F.IsBoundedUnder (· ≤ ·) f) (cobdd : F.IsCoboundedUnder (· ≤ ·) f) : Filter.limsup (fun i ↦ c + f i) F = c + Filter.limsup f F := (Monotone.map_limsSup_of_continuousAt (F := F.map f) (f := fun (x : R) ↦ c + x) (fun _ _ h ↦ add_le_add_left h c) (continuous_add_left c).continuousAt bdd_above cobdd).symm /-- `limsup (xᵢ + c) = (limsup xᵢ) + c`. -/ lemma limsup_add_const (F : Filter ι) [NeBot F] [Add R] [ContinuousAdd R] [CovariantClass R R (Function.swap fun x y ↦ x + y) fun x y ↦ x ≤ y] (f : ι → R) (c : R) (bdd_above : F.IsBoundedUnder (· ≤ ·) f) (cobdd : F.IsCoboundedUnder (· ≤ ·) f) : Filter.limsup (fun i ↦ f i + c) F = Filter.limsup f F + c := (Monotone.map_limsSup_of_continuousAt (F := F.map f) (f := fun (x : R) ↦ x + c) (fun _ _ h ↦ add_le_add_right h c) (continuous_add_right c).continuousAt bdd_above cobdd).symm /-- `liminf (c + xᵢ) = c + limsup xᵢ`. -/ lemma liminf_const_add (F : Filter ι) [NeBot F] [Add R] [ContinuousAdd R] [CovariantClass R R (fun x y ↦ x + y) fun x y ↦ x ≤ y] (f : ι → R) (c : R) (cobdd : F.IsCoboundedUnder (· ≥ ·) f) (bdd_below : F.IsBoundedUnder (· ≥ ·) f) : Filter.liminf (fun i ↦ c + f i) F = c + Filter.liminf f F := (Monotone.map_limsInf_of_continuousAt (F := F.map f) (f := fun (x : R) ↦ c + x) (fun _ _ h ↦ add_le_add_left h c) (continuous_add_left c).continuousAt cobdd bdd_below).symm /-- `liminf (xᵢ + c) = (liminf xᵢ) + c`. -/ lemma liminf_add_const (F : Filter ι) [NeBot F] [Add R] [ContinuousAdd R] [CovariantClass R R (Function.swap fun x y ↦ x + y) fun x y ↦ x ≤ y] (f : ι → R) (c : R) (cobdd : F.IsCoboundedUnder (· ≥ ·) f) (bdd_below : F.IsBoundedUnder (· ≥ ·) f) : Filter.liminf (fun i ↦ f i + c) F = Filter.liminf f F + c := (Monotone.map_limsInf_of_continuousAt (F := F.map f) (f := fun (x : R) ↦ x + c) (fun _ _ h ↦ add_le_add_right h c) (continuous_add_right c).continuousAt cobdd bdd_below).symm /-- `limsup (c - xᵢ) = c - liminf xᵢ`. -/ lemma limsup_const_sub (F : Filter ι) [NeBot F] [AddCommSemigroup R] [Sub R] [ContinuousSub R] [OrderedSub R] [CovariantClass R R (fun x y ↦ x + y) fun x y ↦ x ≤ y] (f : ι → R) (c : R) (cobdd : F.IsCoboundedUnder (· ≥ ·) f) (bdd_below : F.IsBoundedUnder (· ≥ ·) f) : Filter.limsup (fun i ↦ c - f i) F = c - Filter.liminf f F := (Antitone.map_limsInf_of_continuousAt (F := F.map f) (f := fun (x : R) ↦ c - x) (fun _ _ h ↦ tsub_le_tsub_left h c) (continuous_sub_left c).continuousAt cobdd bdd_below).symm /-- `limsup (xᵢ - c) = (limsup xᵢ) - c`. -/ lemma limsup_sub_const (F : Filter ι) [NeBot F] [AddCommSemigroup R] [Sub R] [ContinuousSub R] [OrderedSub R] (f : ι → R) (c : R) (bdd_above : F.IsBoundedUnder (· ≤ ·) f) (cobdd : F.IsCoboundedUnder (· ≤ ·) f) : Filter.limsup (fun i ↦ f i - c) F = Filter.limsup f F - c := (Monotone.map_limsSup_of_continuousAt (F := F.map f) (f := fun (x : R) ↦ x - c) (fun _ _ h ↦ tsub_le_tsub_right h c) (continuous_sub_right c).continuousAt bdd_above cobdd).symm /-- `liminf (c - xᵢ) = c - limsup xᵢ`. -/ lemma liminf_const_sub (F : Filter ι) [NeBot F] [AddCommSemigroup R] [Sub R] [ContinuousSub R] [OrderedSub R] [CovariantClass R R (fun x y ↦ x + y) fun x y ↦ x ≤ y] (f : ι → R) (c : R) (bdd_above : F.IsBoundedUnder (· ≤ ·) f) (cobdd : F.IsCoboundedUnder (· ≤ ·) f) : Filter.liminf (fun i ↦ c - f i) F = c - Filter.limsup f F := (Antitone.map_limsSup_of_continuousAt (F := F.map f) (f := fun (x : R) ↦ c - x) (fun _ _ h ↦ tsub_le_tsub_left h c) (continuous_sub_left c).continuousAt bdd_above cobdd).symm /-- `liminf (xᵢ - c) = (liminf xᵢ) - c`. -/ lemma liminf_sub_const (F : Filter ι) [NeBot F] [AddCommSemigroup R] [Sub R] [ContinuousSub R] [OrderedSub R] (f : ι → R) (c : R) (cobdd : F.IsCoboundedUnder (· ≥ ·) f) (bdd_below : F.IsBoundedUnder (· ≥ ·) f) : Filter.liminf (fun i ↦ f i - c) F = Filter.liminf f F - c := (Monotone.map_limsInf_of_continuousAt (F := F.map f) (f := fun (x : R) ↦ x - c) (fun _ _ h ↦ tsub_le_tsub_right h c) (continuous_sub_right c).continuousAt cobdd bdd_below).symm end LiminfLimsupAddSub -- section
Topology\Algebra\Order\Rolle.lean
/- Copyright (c) 2019 Yury Kudryashov. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yury Kudryashov -/ import Mathlib.Topology.Order.ExtendFrom import Mathlib.Topology.Algebra.Order.Compact import Mathlib.Topology.Order.LocalExtr import Mathlib.Topology.Order.T5 /-! # Rolle's Theorem (topological part) In this file we prove the purely topological part of Rolle's Theorem: a function that is continuous on an interval $[a, b]$, $a < b$, has a local extremum at a point $x ∈ (a, b)$ provided that $f(a)=f(b)$. We also prove several variations of this statement. In `Mathlib/Analysis/Calculus/LocalExtr/Rolle` we use these lemmas to prove several versions of Rolle's Theorem from calculus. ## Keywords local minimum, local maximum, extremum, Rolle's Theorem -/ open Filter Set Topology variable {X Y : Type*} [ConditionallyCompleteLinearOrder X] [DenselyOrdered X] [TopologicalSpace X] [OrderTopology X] [LinearOrder Y] [TopologicalSpace Y] [OrderTopology Y] {f : X → Y} {a b : X} {l : Y} /-- A continuous function on a closed interval with `f a = f b` takes either its maximum or its minimum value at a point in the interior of the interval. -/ theorem exists_Ioo_extr_on_Icc (hab : a < b) (hfc : ContinuousOn f (Icc a b)) (hfI : f a = f b) : ∃ c ∈ Ioo a b, IsExtrOn f (Icc a b) c := by have ne : (Icc a b).Nonempty := nonempty_Icc.2 (le_of_lt hab) -- Consider absolute min and max points obtain ⟨c, cmem, cle⟩ : ∃ c ∈ Icc a b, ∀ x ∈ Icc a b, f c ≤ f x := isCompact_Icc.exists_isMinOn ne hfc obtain ⟨C, Cmem, Cge⟩ : ∃ C ∈ Icc a b, ∀ x ∈ Icc a b, f x ≤ f C := isCompact_Icc.exists_isMaxOn ne hfc by_cases hc : f c = f a · by_cases hC : f C = f a · have : ∀ x ∈ Icc a b, f x = f a := fun x hx => le_antisymm (hC ▸ Cge x hx) (hc ▸ cle x hx) -- `f` is a constant, so we can take any point in `Ioo a b` rcases nonempty_Ioo.2 hab with ⟨c', hc'⟩ refine ⟨c', hc', Or.inl fun x hx ↦ ?_⟩ simp only [mem_setOf_eq, this x hx, this c' (Ioo_subset_Icc_self hc'), le_rfl] · refine ⟨C, ⟨lt_of_le_of_ne Cmem.1 <| mt ?_ hC, lt_of_le_of_ne Cmem.2 <| mt ?_ hC⟩, Or.inr Cge⟩ exacts [fun h => by rw [h], fun h => by rw [h, hfI]] · refine ⟨c, ⟨lt_of_le_of_ne cmem.1 <| mt ?_ hc, lt_of_le_of_ne cmem.2 <| mt ?_ hc⟩, Or.inl cle⟩ exacts [fun h => by rw [h], fun h => by rw [h, hfI]] /-- A continuous function on a closed interval with `f a = f b` has a local extremum at some point of the corresponding open interval. -/ theorem exists_isLocalExtr_Ioo (hab : a < b) (hfc : ContinuousOn f (Icc a b)) (hfI : f a = f b) : ∃ c ∈ Ioo a b, IsLocalExtr f c := let ⟨c, cmem, hc⟩ := exists_Ioo_extr_on_Icc hab hfc hfI ⟨c, cmem, hc.isLocalExtr <| Icc_mem_nhds cmem.1 cmem.2⟩ /-- If a function `f` is continuous on an open interval and tends to the same value at its endpoints, then it has an extremum on this open interval. -/ lemma exists_isExtrOn_Ioo_of_tendsto (hab : a < b) (hfc : ContinuousOn f (Ioo a b)) (ha : Tendsto f (𝓝[>] a) (𝓝 l)) (hb : Tendsto f (𝓝[<] b) (𝓝 l)) : ∃ c ∈ Ioo a b, IsExtrOn f (Ioo a b) c := by have h : EqOn (extendFrom (Ioo a b) f) f (Ioo a b) := extendFrom_extends hfc obtain ⟨c, hc, hfc⟩ : ∃ c ∈ Ioo a b, IsExtrOn (extendFrom (Ioo a b) f) (Icc a b) c := exists_Ioo_extr_on_Icc hab (continuousOn_Icc_extendFrom_Ioo hab.ne hfc ha hb) ((eq_lim_at_left_extendFrom_Ioo hab ha).trans (eq_lim_at_right_extendFrom_Ioo hab hb).symm) exact ⟨c, hc, (hfc.on_subset Ioo_subset_Icc_self).congr h (h hc)⟩ /-- If a function `f` is continuous on an open interval and tends to the same value at its endpoints, then it has a local extremum on this open interval. -/ lemma exists_isLocalExtr_Ioo_of_tendsto (hab : a < b) (hfc : ContinuousOn f (Ioo a b)) (ha : Tendsto f (𝓝[>] a) (𝓝 l)) (hb : Tendsto f (𝓝[<] b) (𝓝 l)) : ∃ c ∈ Ioo a b, IsLocalExtr f c := let ⟨c, cmem, hc⟩ := exists_isExtrOn_Ioo_of_tendsto hab hfc ha hb ⟨c, cmem, hc.isLocalExtr <| Ioo_mem_nhds cmem.1 cmem.2⟩
Topology\Algebra\Order\UpperLower.lean
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies -/ import Mathlib.Algebra.Order.UpperLower import Mathlib.Topology.Algebra.Group.Basic /-! # Topological facts about upper/lower/order-connected sets The topological closure and interior of an upper/lower/order-connected set is an upper/lower/order-connected set (with the notable exception of the closure of an order-connected set). ## Implementation notes The same lemmas are true in the additive/multiplicative worlds. To avoid code duplication, we provide `HasUpperLowerClosure`, an ad hoc axiomatisation of the properties we need. -/ open Function Set open Pointwise /-- Ad hoc class stating that the closure of an upper set is an upper set. This is used to state lemmas that do not mention algebraic operations for both the additive and multiplicative versions simultaneously. If you find a satisfying replacement for this typeclass, please remove it! -/ class HasUpperLowerClosure (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where isUpperSet_closure : ∀ s : Set α, IsUpperSet s → IsUpperSet (closure s) isLowerSet_closure : ∀ s : Set α, IsLowerSet s → IsLowerSet (closure s) isOpen_upperClosure : ∀ s : Set α, IsOpen s → IsOpen (upperClosure s : Set α) isOpen_lowerClosure : ∀ s : Set α, IsOpen s → IsOpen (lowerClosure s : Set α) variable {α : Type*} [TopologicalSpace α] -- See note [lower instance priority] @[to_additive] instance (priority := 100) OrderedCommGroup.to_hasUpperLowerClosure [OrderedCommGroup α] [ContinuousConstSMul α α] : HasUpperLowerClosure α where isUpperSet_closure s h x y hxy hx := closure_mono (h.smul_subset <| one_le_div'.2 hxy) <| by rw [closure_smul] exact ⟨x, hx, div_mul_cancel _ _⟩ isLowerSet_closure s h x y hxy hx := closure_mono (h.smul_subset <| div_le_one'.2 hxy) <| by rw [closure_smul] exact ⟨x, hx, div_mul_cancel _ _⟩ isOpen_upperClosure s hs := by rw [← mul_one s, ← mul_upperClosure] exact hs.mul_right isOpen_lowerClosure s hs := by rw [← mul_one s, ← mul_lowerClosure] exact hs.mul_right variable [Preorder α] [HasUpperLowerClosure α] {s : Set α} protected theorem IsUpperSet.closure : IsUpperSet s → IsUpperSet (closure s) := HasUpperLowerClosure.isUpperSet_closure _ protected theorem IsLowerSet.closure : IsLowerSet s → IsLowerSet (closure s) := HasUpperLowerClosure.isLowerSet_closure _ protected theorem IsOpen.upperClosure : IsOpen s → IsOpen (upperClosure s : Set α) := HasUpperLowerClosure.isOpen_upperClosure _ protected theorem IsOpen.lowerClosure : IsOpen s → IsOpen (lowerClosure s : Set α) := HasUpperLowerClosure.isOpen_lowerClosure _ instance : HasUpperLowerClosure αᵒᵈ where isUpperSet_closure := @IsLowerSet.closure α _ _ _ isLowerSet_closure := @IsUpperSet.closure α _ _ _ isOpen_upperClosure := @IsOpen.lowerClosure α _ _ _ isOpen_lowerClosure := @IsOpen.upperClosure α _ _ _ /- Note: `s.OrdConnected` does not imply `(closure s).OrdConnected`, as we can see by taking `s := Ioo 0 1 × Ioo 1 2 ∪ Ioo 2 3 × Ioo 0 1` because then `closure s = Icc 0 1 × Icc 1 2 ∪ Icc 2 3 × Icc 0 1` is not order-connected as `(1, 1) ∈ closure s`, `(2, 1) ∈ closure s` but `Icc (1, 1) (2, 1) ⊈ closure s`. `s` looks like ``` xxooooo xxooooo oooooxx oooooxx ``` -/ protected theorem IsUpperSet.interior (h : IsUpperSet s) : IsUpperSet (interior s) := by rw [← isLowerSet_compl, ← closure_compl] exact h.compl.closure protected theorem IsLowerSet.interior (h : IsLowerSet s) : IsLowerSet (interior s) := h.toDual.interior protected theorem Set.OrdConnected.interior (h : s.OrdConnected) : (interior s).OrdConnected := by rw [← h.upperClosure_inter_lowerClosure, interior_inter] exact (upperClosure s).upper.interior.ordConnected.inter (lowerClosure s).lower.interior.ordConnected
Topology\Algebra\Ring\Basic.lean
/- Copyright (c) 2018 Patrick Massot. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Johannes Hölzl -/ import Mathlib.Algebra.Order.AbsoluteValue import Mathlib.Algebra.Ring.Prod import Mathlib.Algebra.Ring.Subring.Basic import Mathlib.Topology.Algebra.Group.Basic /-! # Topological (semi)rings A topological (semi)ring is a (semi)ring equipped with a topology such that all operations are continuous. Besides this definition, this file proves that the topological closure of a subring (resp. an ideal) is a subring (resp. an ideal) and defines products and quotients of topological (semi)rings. ## Main Results - `Subring.topologicalClosure`/`Subsemiring.topologicalClosure`: the topological closure of a `Subring`/`Subsemiring` is itself a `Sub(semi)ring`. - The product of two topological (semi)rings is a topological (semi)ring. - The indexed product of topological (semi)rings is a topological (semi)ring. -/ open Set Filter TopologicalSpace Function Topology Filter section TopologicalSemiring variable (α : Type*) /-- a topological semiring is a semiring `R` where addition and multiplication are continuous. We allow for non-unital and non-associative semirings as well. The `TopologicalSemiring` class should *only* be instantiated in the presence of a `NonUnitalNonAssocSemiring` instance; if there is an instance of `NonUnitalNonAssocRing`, then `TopologicalRing` should be used. Note: in the presence of `NonAssocRing`, these classes are mathematically equivalent (see `TopologicalSemiring.continuousNeg_of_mul` or `TopologicalSemiring.toTopologicalRing`). -/ class TopologicalSemiring [TopologicalSpace α] [NonUnitalNonAssocSemiring α] extends ContinuousAdd α, ContinuousMul α : Prop /-- A topological ring is a ring `R` where addition, multiplication and negation are continuous. If `R` is a (unital) ring, then continuity of negation can be derived from continuity of multiplication as it is multiplication with `-1`. (See `TopologicalSemiring.continuousNeg_of_mul` and `topological_semiring.to_topological_add_group`) -/ class TopologicalRing [TopologicalSpace α] [NonUnitalNonAssocRing α] extends TopologicalSemiring α, ContinuousNeg α : Prop variable {α} /-- If `R` is a ring with a continuous multiplication, then negation is continuous as well since it is just multiplication with `-1`. -/ theorem TopologicalSemiring.continuousNeg_of_mul [TopologicalSpace α] [NonAssocRing α] [ContinuousMul α] : ContinuousNeg α where continuous_neg := by simpa using (continuous_const.mul continuous_id : Continuous fun x : α => -1 * x) /-- If `R` is a ring which is a topological semiring, then it is automatically a topological ring. This exists so that one can place a topological ring structure on `R` without explicitly proving `continuous_neg`. -/ theorem TopologicalSemiring.toTopologicalRing [TopologicalSpace α] [NonAssocRing α] (_ : TopologicalSemiring α) : TopologicalRing α where toContinuousNeg := TopologicalSemiring.continuousNeg_of_mul -- See note [lower instance priority] instance (priority := 100) TopologicalRing.to_topologicalAddGroup [NonUnitalNonAssocRing α] [TopologicalSpace α] [TopologicalRing α] : TopologicalAddGroup α := ⟨⟩ instance (priority := 50) DiscreteTopology.topologicalSemiring [TopologicalSpace α] [NonUnitalNonAssocSemiring α] [DiscreteTopology α] : TopologicalSemiring α := ⟨⟩ instance (priority := 50) DiscreteTopology.topologicalRing [TopologicalSpace α] [NonUnitalNonAssocRing α] [DiscreteTopology α] : TopologicalRing α := ⟨⟩ section variable [TopologicalSpace α] [Semiring α] [TopologicalSemiring α] instance : TopologicalSemiring (ULift α) where namespace Subsemiring -- Porting note: named instance because generated name was huge instance topologicalSemiring (S : Subsemiring α) : TopologicalSemiring S := { S.toSubmonoid.continuousMul, S.toAddSubmonoid.continuousAdd with } end Subsemiring /-- The (topological-space) closure of a subsemiring of a topological semiring is itself a subsemiring. -/ def Subsemiring.topologicalClosure (s : Subsemiring α) : Subsemiring α := { s.toSubmonoid.topologicalClosure, s.toAddSubmonoid.topologicalClosure with carrier := _root_.closure (s : Set α) } @[simp] theorem Subsemiring.topologicalClosure_coe (s : Subsemiring α) : (s.topologicalClosure : Set α) = _root_.closure (s : Set α) := rfl theorem Subsemiring.le_topologicalClosure (s : Subsemiring α) : s ≤ s.topologicalClosure := _root_.subset_closure theorem Subsemiring.isClosed_topologicalClosure (s : Subsemiring α) : IsClosed (s.topologicalClosure : Set α) := isClosed_closure theorem Subsemiring.topologicalClosure_minimal (s : Subsemiring α) {t : Subsemiring α} (h : s ≤ t) (ht : IsClosed (t : Set α)) : s.topologicalClosure ≤ t := closure_minimal h ht /-- If a subsemiring of a topological semiring is commutative, then so is its topological closure. -/ def Subsemiring.commSemiringTopologicalClosure [T2Space α] (s : Subsemiring α) (hs : ∀ x y : s, x * y = y * x) : CommSemiring s.topologicalClosure := { s.topologicalClosure.toSemiring, s.toSubmonoid.commMonoidTopologicalClosure hs with } end section variable {β : Type*} [TopologicalSpace α] [TopologicalSpace β] /-- The product topology on the cartesian product of two topological semirings makes the product into a topological semiring. -/ instance [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β] [TopologicalSemiring α] [TopologicalSemiring β] : TopologicalSemiring (α × β) where /-- The product topology on the cartesian product of two topological rings makes the product into a topological ring. -/ instance [NonUnitalNonAssocRing α] [NonUnitalNonAssocRing β] [TopologicalRing α] [TopologicalRing β] : TopologicalRing (α × β) where end #adaptation_note /-- nightly-2024-04-08, needed to help `Pi.instTopologicalSemiring` -/ instance {β : Type*} {C : β → Type*} [∀ b, TopologicalSpace (C b)] [∀ b, NonUnitalNonAssocSemiring (C b)] [∀ b, TopologicalSemiring (C b)] : ContinuousAdd ((b : β) → C b) := inferInstance instance Pi.instTopologicalSemiring {β : Type*} {C : β → Type*} [∀ b, TopologicalSpace (C b)] [∀ b, NonUnitalNonAssocSemiring (C b)] [∀ b, TopologicalSemiring (C b)] : TopologicalSemiring (∀ b, C b) where instance Pi.instTopologicalRing {β : Type*} {C : β → Type*} [∀ b, TopologicalSpace (C b)] [∀ b, NonUnitalNonAssocRing (C b)] [∀ b, TopologicalRing (C b)] : TopologicalRing (∀ b, C b) := ⟨⟩ section MulOpposite open MulOpposite instance [NonUnitalNonAssocSemiring α] [TopologicalSpace α] [ContinuousAdd α] : ContinuousAdd αᵐᵒᵖ := continuousAdd_induced opAddEquiv.symm instance [NonUnitalNonAssocSemiring α] [TopologicalSpace α] [TopologicalSemiring α] : TopologicalSemiring αᵐᵒᵖ := ⟨⟩ instance [NonUnitalNonAssocRing α] [TopologicalSpace α] [ContinuousNeg α] : ContinuousNeg αᵐᵒᵖ := opHomeomorph.symm.inducing.continuousNeg fun _ => rfl instance [NonUnitalNonAssocRing α] [TopologicalSpace α] [TopologicalRing α] : TopologicalRing αᵐᵒᵖ := ⟨⟩ end MulOpposite section AddOpposite open AddOpposite instance [NonUnitalNonAssocSemiring α] [TopologicalSpace α] [ContinuousMul α] : ContinuousMul αᵃᵒᵖ := continuousMul_induced opMulEquiv.symm instance [NonUnitalNonAssocSemiring α] [TopologicalSpace α] [TopologicalSemiring α] : TopologicalSemiring αᵃᵒᵖ := ⟨⟩ instance [NonUnitalNonAssocRing α] [TopologicalSpace α] [TopologicalRing α] : TopologicalRing αᵃᵒᵖ := ⟨⟩ end AddOpposite section variable {R : Type*} [NonUnitalNonAssocRing R] [TopologicalSpace R] theorem TopologicalRing.of_addGroup_of_nhds_zero [TopologicalAddGroup R] (hmul : Tendsto (uncurry ((· * ·) : R → R → R)) (𝓝 0 ×ˢ 𝓝 0) <| 𝓝 0) (hmul_left : ∀ x₀ : R, Tendsto (fun x : R => x₀ * x) (𝓝 0) <| 𝓝 0) (hmul_right : ∀ x₀ : R, Tendsto (fun x : R => x * x₀) (𝓝 0) <| 𝓝 0) : TopologicalRing R where continuous_mul := by refine continuous_of_continuousAt_zero₂ (AddMonoidHom.mul (R := R)) ?_ ?_ ?_ <;> simpa only [ContinuousAt, mul_zero, zero_mul, nhds_prod_eq, AddMonoidHom.mul_apply] theorem TopologicalRing.of_nhds_zero (hadd : Tendsto (uncurry ((· + ·) : R → R → R)) (𝓝 0 ×ˢ 𝓝 0) <| 𝓝 0) (hneg : Tendsto (fun x => -x : R → R) (𝓝 0) (𝓝 0)) (hmul : Tendsto (uncurry ((· * ·) : R → R → R)) (𝓝 0 ×ˢ 𝓝 0) <| 𝓝 0) (hmul_left : ∀ x₀ : R, Tendsto (fun x : R => x₀ * x) (𝓝 0) <| 𝓝 0) (hmul_right : ∀ x₀ : R, Tendsto (fun x : R => x * x₀) (𝓝 0) <| 𝓝 0) (hleft : ∀ x₀ : R, 𝓝 x₀ = map (fun x => x₀ + x) (𝓝 0)) : TopologicalRing R := have := TopologicalAddGroup.of_comm_of_nhds_zero hadd hneg hleft TopologicalRing.of_addGroup_of_nhds_zero hmul hmul_left hmul_right end variable [TopologicalSpace α] section variable [NonUnitalNonAssocRing α] [TopologicalRing α] instance : TopologicalRing (ULift α) where /-- In a topological semiring, the left-multiplication `AddMonoidHom` is continuous. -/ theorem mulLeft_continuous (x : α) : Continuous (AddMonoidHom.mulLeft x) := continuous_const.mul continuous_id /-- In a topological semiring, the right-multiplication `AddMonoidHom` is continuous. -/ theorem mulRight_continuous (x : α) : Continuous (AddMonoidHom.mulRight x) := continuous_id.mul continuous_const end variable [Ring α] [TopologicalRing α] instance Subring.instTopologicalRing (S : Subring α) : TopologicalRing S := { S.toSubmonoid.continuousMul, inferInstanceAs (TopologicalAddGroup S.toAddSubgroup) with } /-- The (topological-space) closure of a subring of a topological ring is itself a subring. -/ def Subring.topologicalClosure (S : Subring α) : Subring α := { S.toSubmonoid.topologicalClosure, S.toAddSubgroup.topologicalClosure with carrier := _root_.closure (S : Set α) } theorem Subring.le_topologicalClosure (s : Subring α) : s ≤ s.topologicalClosure := _root_.subset_closure theorem Subring.isClosed_topologicalClosure (s : Subring α) : IsClosed (s.topologicalClosure : Set α) := isClosed_closure theorem Subring.topologicalClosure_minimal (s : Subring α) {t : Subring α} (h : s ≤ t) (ht : IsClosed (t : Set α)) : s.topologicalClosure ≤ t := closure_minimal h ht /-- If a subring of a topological ring is commutative, then so is its topological closure. -/ def Subring.commRingTopologicalClosure [T2Space α] (s : Subring α) (hs : ∀ x y : s, x * y = y * x) : CommRing s.topologicalClosure := { s.topologicalClosure.toRing, s.toSubmonoid.commMonoidTopologicalClosure hs with } end TopologicalSemiring /-! ### Lattice of ring topologies We define a type class `RingTopology α` which endows a ring `α` with a topology such that all ring operations are continuous. Ring topologies on a fixed ring `α` are ordered, by reverse inclusion. They form a complete lattice, with `⊥` the discrete topology and `⊤` the indiscrete topology. Any function `f : α → β` induces `coinduced f : TopologicalSpace α → RingTopology β`. -/ universe u v /-- A ring topology on a ring `α` is a topology for which addition, negation and multiplication are continuous. -/ structure RingTopology (α : Type u) [Ring α] extends TopologicalSpace α, TopologicalRing α : Type u namespace RingTopology variable {α : Type*} [Ring α] instance inhabited {α : Type u} [Ring α] : Inhabited (RingTopology α) := ⟨let _ : TopologicalSpace α := ⊤; { continuous_add := continuous_top continuous_mul := continuous_top continuous_neg := continuous_top }⟩ theorem toTopologicalSpace_injective : Injective (toTopologicalSpace : RingTopology α → TopologicalSpace α) := by intro f g _; cases f; cases g; congr @[ext] theorem ext {f g : RingTopology α} (h : f.IsOpen = g.IsOpen) : f = g := toTopologicalSpace_injective <| TopologicalSpace.ext h /-- The ordering on ring topologies on the ring `α`. `t ≤ s` if every set open in `s` is also open in `t` (`t` is finer than `s`). -/ instance : PartialOrder (RingTopology α) := PartialOrder.lift RingTopology.toTopologicalSpace toTopologicalSpace_injective private def def_sInf (S : Set (RingTopology α)) : RingTopology α := let _ := sInf (toTopologicalSpace '' S) { toContinuousAdd := continuousAdd_sInf <| forall_mem_image.2 fun t _ => let _ := t.1; t.toContinuousAdd toContinuousMul := continuousMul_sInf <| forall_mem_image.2 fun t _ => let _ := t.1; t.toContinuousMul toContinuousNeg := continuousNeg_sInf <| forall_mem_image.2 fun t _ => let _ := t.1; t.toContinuousNeg } /-- Ring topologies on `α` form a complete lattice, with `⊥` the discrete topology and `⊤` the indiscrete topology. The infimum of a collection of ring topologies is the topology generated by all their open sets (which is a ring topology). The supremum of two ring topologies `s` and `t` is the infimum of the family of all ring topologies contained in the intersection of `s` and `t`. -/ instance : CompleteSemilatticeInf (RingTopology α) where sInf := def_sInf sInf_le := fun _ a haS => sInf_le (α := TopologicalSpace α) ⟨a, ⟨haS, rfl⟩⟩ le_sInf := fun _ _ h => le_sInf (α := TopologicalSpace α) <| forall_mem_image.2 h instance : CompleteLattice (RingTopology α) := completeLatticeOfCompleteSemilatticeInf _ /-- Given `f : α → β` and a topology on `α`, the coinduced ring topology on `β` is the finest topology such that `f` is continuous and `β` is a topological ring. -/ def coinduced {α β : Type*} [t : TopologicalSpace α] [Ring β] (f : α → β) : RingTopology β := sInf { b : RingTopology β | t.coinduced f ≤ b.toTopologicalSpace } theorem coinduced_continuous {α β : Type*} [t : TopologicalSpace α] [Ring β] (f : α → β) : Continuous[t, (coinduced f).toTopologicalSpace] f := continuous_sInf_rng.2 <| forall_mem_image.2 fun _ => continuous_iff_coinduced_le.2 /-- The forgetful functor from ring topologies on `a` to additive group topologies on `a`. -/ def toAddGroupTopology (t : RingTopology α) : AddGroupTopology α where toTopologicalSpace := t.toTopologicalSpace toTopologicalAddGroup := @TopologicalRing.to_topologicalAddGroup _ _ t.toTopologicalSpace t.toTopologicalRing /-- The order embedding from ring topologies on `a` to additive group topologies on `a`. -/ def toAddGroupTopology.orderEmbedding : OrderEmbedding (RingTopology α) (AddGroupTopology α) := OrderEmbedding.ofMapLEIff toAddGroupTopology fun _ _ => Iff.rfl end RingTopology section AbsoluteValue /-- Construct an absolute value on a semiring `T` from an absolute value on a semiring `R` and an injective ring homomorphism `f : T →+* R` -/ def AbsoluteValue.comp {R S T : Type*} [Semiring T] [Semiring R] [OrderedSemiring S] (v : AbsoluteValue R S) {f : T →+* R} (hf : Function.Injective f) : AbsoluteValue T S where toMulHom := v.1.comp f nonneg' _ := v.nonneg _ eq_zero' _ := v.eq_zero.trans (map_eq_zero_iff f hf) add_le' _ _ := (congr_arg v (map_add f _ _)).trans_le (v.add_le _ _) end AbsoluteValue
Topology\Algebra\Ring\Ideal.lean
/- Copyright (c) 2018 Patrick Massot. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot -/ import Mathlib.Topology.Algebra.Ring.Basic import Mathlib.RingTheory.Ideal.Quotient /-! # Ideals and quotients of topological rings In this file we define `Ideal.closure` to be the topological closure of an ideal in a topological ring. We also define a `TopologicalSpace` structure on the quotient of a topological ring by an ideal and prove that the quotient is a topological ring. -/ section Ring variable {R : Type*} [TopologicalSpace R] [Ring R] [TopologicalRing R] /-- The closure of an ideal in a topological ring as an ideal. -/ protected def Ideal.closure (I : Ideal R) : Ideal R := { AddSubmonoid.topologicalClosure I.toAddSubmonoid with carrier := closure I smul_mem' := fun c _ hx => map_mem_closure (mulLeft_continuous _) hx fun _ => I.mul_mem_left c } @[simp] theorem Ideal.coe_closure (I : Ideal R) : (I.closure : Set R) = closure I := rfl -- Porting note: removed `@[simp]` because we make the instance argument explicit since otherwise -- it causes timeouts as `simp` tries and fails to generated an `IsClosed` instance. -- https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/!4.234852.20heartbeats.20of.20the.20linter theorem Ideal.closure_eq_of_isClosed (I : Ideal R) (hI : IsClosed (I : Set R)) : I.closure = I := SetLike.ext' hI.closure_eq end Ring section CommRing variable {R : Type*} [TopologicalSpace R] [CommRing R] (N : Ideal R) open Ideal.Quotient instance topologicalRingQuotientTopology : TopologicalSpace (R ⧸ N) := instTopologicalSpaceQuotient -- note for the reader: in the following, `mk` is `Ideal.Quotient.mk`, the canonical map `R → R/I`. variable [TopologicalRing R] theorem QuotientRing.isOpenMap_coe : IsOpenMap (mk N) := by intro s s_op change IsOpen (mk N ⁻¹' (mk N '' s)) rw [quotient_ring_saturate] exact isOpen_iUnion fun ⟨n, _⟩ => isOpenMap_add_left n s s_op theorem QuotientRing.quotientMap_coe_coe : QuotientMap fun p : R × R => (mk N p.1, mk N p.2) := IsOpenMap.to_quotientMap ((QuotientRing.isOpenMap_coe N).prod (QuotientRing.isOpenMap_coe N)) ((continuous_quot_mk.comp continuous_fst).prod_mk (continuous_quot_mk.comp continuous_snd)) (by rintro ⟨⟨x⟩, ⟨y⟩⟩; exact ⟨(x, y), rfl⟩) instance topologicalRing_quotient : TopologicalRing (R ⧸ N) := TopologicalSemiring.toTopologicalRing { continuous_add := have cont : Continuous (mk N ∘ fun p : R × R => p.fst + p.snd) := continuous_quot_mk.comp continuous_add (QuotientMap.continuous_iff (QuotientRing.quotientMap_coe_coe N)).mpr cont continuous_mul := have cont : Continuous (mk N ∘ fun p : R × R => p.fst * p.snd) := continuous_quot_mk.comp continuous_mul (QuotientMap.continuous_iff (QuotientRing.quotientMap_coe_coe N)).mpr cont } end CommRing
Topology\Algebra\Valued\NormedValued.lean
/- Copyright (c) 2024 María Inés de Frutos-Fernández. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: María Inés de Frutos-Fernández -/ import Mathlib.Analysis.Normed.Field.Basic import Mathlib.RingTheory.Valuation.RankOne import Mathlib.Topology.Algebra.Valued.ValuationTopology /-! # Correspondence between nontrivial nonarchimedean norms and rank one valuations Nontrivial nonarchimedean norms correspond to rank one valuations. ## Main Definitions * `NormedField.toValued` : the valued field structure on a nonarchimedean normed field `K`, determined by the norm. * `Valued.toNormedField` : the normed field structure determined by a rank one valuation. ## Tags norm, nonarchimedean, nontrivial, valuation, rank one -/ noncomputable section open Filter Set Valuation open scoped NNReal variable {K : Type*} [hK : NormedField K] (h : IsNonarchimedean (norm : K → ℝ)) namespace NormedField /-- The valuation on a nonarchimedean normed field `K` defined as `nnnorm`. -/ def valuation : Valuation K ℝ≥0 where toFun := nnnorm map_zero' := nnnorm_zero map_one' := nnnorm_one map_mul' := nnnorm_mul map_add_le_max' := h theorem valuation_apply (x : K) : valuation h x = ‖x‖₊ := rfl /-- The valued field structure on a nonarchimedean normed field `K`, determined by the norm. -/ def toValued : Valued K ℝ≥0 := { hK.toUniformSpace, @NonUnitalNormedRing.toNormedAddCommGroup K _ with v := valuation h is_topological_valuation := fun U => by rw [Metric.mem_nhds_iff] exact ⟨fun ⟨ε, hε, h⟩ => ⟨Units.mk0 ⟨ε, le_of_lt hε⟩ (ne_of_gt hε), fun x hx ↦ h (mem_ball_zero_iff.mpr hx)⟩, fun ⟨ε, hε⟩ => ⟨(ε : ℝ), NNReal.coe_pos.mpr (Units.zero_lt _), fun x hx ↦ hε (mem_ball_zero_iff.mp hx)⟩⟩ } end NormedField namespace Valued variable {L : Type*} [Field L] {Γ₀ : Type*} [LinearOrderedCommGroupWithZero Γ₀] [val : Valued L Γ₀] [hv : RankOne val.v] /-- The norm function determined by a rank one valuation on a field `L`. -/ def norm : L → ℝ := fun x : L => hv.hom (Valued.v x) theorem norm_nonneg (x : L) : 0 ≤ norm x := by simp only [norm, NNReal.zero_le_coe] theorem norm_add_le (x y : L) : norm (x + y) ≤ max (norm x) (norm y) := by simp only [norm, NNReal.coe_le_coe, le_max_iff, StrictMono.le_iff_le hv.strictMono] exact le_max_iff.mp (Valuation.map_add_le_max' val.v _ _) theorem norm_eq_zero {x : L} (hx : norm x = 0) : x = 0 := by simpa [norm, NNReal.coe_eq_zero, RankOne.hom_eq_zero_iff, zero_iff] using hx variable (L) (Γ₀) /-- The normed field structure determined by a rank one valuation. -/ def toNormedField : NormedField L := { (inferInstance : Field L) with norm := norm dist := fun x y => norm (x - y) dist_self := fun x => by simp only [sub_self, norm, Valuation.map_zero, hv.hom.map_zero, NNReal.coe_zero] dist_comm := fun x y => by simp only [norm]; rw [← neg_sub, Valuation.map_neg] dist_triangle := fun x y z => by simp only [← sub_add_sub_cancel x y z] exact le_trans (norm_add_le _ _) (max_le_add_of_nonneg (norm_nonneg _) (norm_nonneg _)) eq_of_dist_eq_zero := fun hxy => eq_of_sub_eq_zero (norm_eq_zero hxy) dist_eq := fun x y => rfl norm_mul' := fun x y => by simp only [norm, ← NNReal.coe_mul, _root_.map_mul] toUniformSpace := Valued.toUniformSpace uniformity_dist := by haveI : Nonempty { ε : ℝ // ε > 0 } := nonempty_Ioi_subtype ext U rw [hasBasis_iff.mp (Valued.hasBasis_uniformity L Γ₀), iInf_subtype', mem_iInf_of_directed] · simp only [true_and_iff, mem_principal, Subtype.exists, gt_iff_lt, exists_prop] refine ⟨fun ⟨ε, hε⟩ => ?_, fun ⟨r, hr_pos, hr⟩ => ?_⟩ · set δ : ℝ≥0 := hv.hom ε with hδ have hδ_pos : 0 < δ := by rw [hδ, ← _root_.map_zero hv.hom] exact hv.strictMono (Units.zero_lt ε) use δ, hδ_pos apply subset_trans _ hε intro x hx simp only [mem_setOf_eq, norm, hδ, NNReal.val_eq_coe, NNReal.coe_lt_coe] at hx rw [mem_setOf, ← neg_sub, Valuation.map_neg] exact (RankOne.strictMono Valued.v).lt_iff_lt.mp hx · haveI : Nontrivial Γ₀ˣ := (nontrivial_iff_exists_ne (1 : Γ₀ˣ)).mpr ⟨RankOne.unit val.v, RankOne.unit_ne_one val.v⟩ obtain ⟨u, hu⟩ := Real.exists_lt_of_strictMono hv.strictMono hr_pos use u apply subset_trans _ hr intro x hx simp only [norm, mem_setOf_eq] apply lt_trans _ hu rw [NNReal.coe_lt_coe, ← neg_sub, Valuation.map_neg] exact (RankOne.strictMono Valued.v).lt_iff_lt.mpr hx · simp only [Directed] intro x y use min x y simp only [le_principal_iff, mem_principal, setOf_subset_setOf, Prod.forall] exact ⟨fun a b hab => lt_of_lt_of_le hab (min_le_left _ _), fun a b hab => lt_of_lt_of_le hab (min_le_right _ _)⟩ } end Valued
Topology\Algebra\Valued\ValuationTopology.lean
/- Copyright (c) 2021 Patrick Massot. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot -/ import Mathlib.Topology.Algebra.Nonarchimedean.Bases import Mathlib.Topology.Algebra.UniformFilterBasis import Mathlib.RingTheory.Valuation.ValuationSubring /-! # The topology on a valued ring In this file, we define the non archimedean topology induced by a valuation on a ring. The main definition is a `Valued` type class which equips a ring with a valuation taking values in a group with zero. Other instances are then deduced from this. -/ open scoped Classical open Topology uniformity open Set Valuation noncomputable section universe v u variable {R : Type u} [Ring R] {Γ₀ : Type v} [LinearOrderedCommGroupWithZero Γ₀] namespace Valuation variable (v : Valuation R Γ₀) /-- The basis of open subgroups for the topology on a ring determined by a valuation. -/ theorem subgroups_basis : RingSubgroupsBasis fun γ : Γ₀ˣ => (v.ltAddSubgroup γ : AddSubgroup R) := { inter := by rintro γ₀ γ₁ use min γ₀ γ₁ simp only [ltAddSubgroup, Units.min_val, Units.val_le_val, lt_min_iff, AddSubgroup.mk_le_mk, setOf_subset_setOf, le_inf_iff, and_imp, imp_self, implies_true, forall_const, and_true] tauto mul := by rintro γ cases' exists_square_le γ with γ₀ h use γ₀ rintro - ⟨r, r_in, s, s_in, rfl⟩ calc (v (r * s) : Γ₀) = v r * v s := Valuation.map_mul _ _ _ _ < γ₀ * γ₀ := mul_lt_mul₀ r_in s_in _ ≤ γ := mod_cast h leftMul := by rintro x γ rcases GroupWithZero.eq_zero_or_unit (v x) with (Hx | ⟨γx, Hx⟩) · use (1 : Γ₀ˣ) rintro y _ change v (x * y) < _ rw [Valuation.map_mul, Hx, zero_mul] exact Units.zero_lt γ · use γx⁻¹ * γ rintro y (vy_lt : v y < ↑(γx⁻¹ * γ)) change (v (x * y) : Γ₀) < γ rw [Valuation.map_mul, Hx, mul_comm] rw [Units.val_mul, mul_comm] at vy_lt simpa using mul_inv_lt_of_lt_mul₀ vy_lt rightMul := by rintro x γ rcases GroupWithZero.eq_zero_or_unit (v x) with (Hx | ⟨γx, Hx⟩) · use 1 rintro y _ change v (y * x) < _ rw [Valuation.map_mul, Hx, mul_zero] exact Units.zero_lt γ · use γx⁻¹ * γ rintro y (vy_lt : v y < ↑(γx⁻¹ * γ)) change (v (y * x) : Γ₀) < γ rw [Valuation.map_mul, Hx] rw [Units.val_mul, mul_comm] at vy_lt simpa using mul_inv_lt_of_lt_mul₀ vy_lt } end Valuation /-- A valued ring is a ring that comes equipped with a distinguished valuation. The class `Valued` is designed for the situation that there is a canonical valuation on the ring. TODO: show that there always exists an equivalent valuation taking values in a type belonging to the same universe as the ring. See Note [forgetful inheritance] for why we extend `UniformSpace`, `UniformAddGroup`. -/ class Valued (R : Type u) [Ring R] (Γ₀ : outParam (Type v)) [LinearOrderedCommGroupWithZero Γ₀] extends UniformSpace R, UniformAddGroup R where v : Valuation R Γ₀ is_topological_valuation : ∀ s, s ∈ 𝓝 (0 : R) ↔ ∃ γ : Γ₀ˣ, { x : R | v x < γ } ⊆ s -- Porting note(#12094): removed nolint; dangerous_instance linter not ported yet --attribute [nolint dangerous_instance] Valued.toUniformSpace namespace Valued /-- Alternative `Valued` constructor for use when there is no preferred `UniformSpace` structure. -/ def mk' (v : Valuation R Γ₀) : Valued R Γ₀ := { v toUniformSpace := @TopologicalAddGroup.toUniformSpace R _ v.subgroups_basis.topology _ toUniformAddGroup := @comm_topologicalAddGroup_is_uniform _ _ v.subgroups_basis.topology _ is_topological_valuation := by letI := @TopologicalAddGroup.toUniformSpace R _ v.subgroups_basis.topology _ intro s rw [Filter.hasBasis_iff.mp v.subgroups_basis.hasBasis_nhds_zero s] exact exists_congr fun γ => by rw [true_and]; rfl } variable (R Γ₀) variable [_i : Valued R Γ₀] theorem hasBasis_nhds_zero : (𝓝 (0 : R)).HasBasis (fun _ => True) fun γ : Γ₀ˣ => { x | v x < (γ : Γ₀) } := by simp [Filter.hasBasis_iff, is_topological_valuation] -- Porting note: Replaced `𝓤 R` with `uniformity R` theorem hasBasis_uniformity : (uniformity R).HasBasis (fun _ => True) fun γ : Γ₀ˣ => { p : R × R | v (p.2 - p.1) < (γ : Γ₀) } := by rw [uniformity_eq_comap_nhds_zero] exact (hasBasis_nhds_zero R Γ₀).comap _ theorem toUniformSpace_eq : toUniformSpace = @TopologicalAddGroup.toUniformSpace R _ v.subgroups_basis.topology _ := UniformSpace.ext ((hasBasis_uniformity R Γ₀).eq_of_same_basis <| v.subgroups_basis.hasBasis_nhds_zero.comap _) variable {R Γ₀} theorem mem_nhds {s : Set R} {x : R} : s ∈ 𝓝 x ↔ ∃ γ : Γ₀ˣ, { y | (v (y - x) : Γ₀) < γ } ⊆ s := by simp only [← nhds_translation_add_neg x, ← sub_eq_add_neg, preimage_setOf_eq, true_and, ((hasBasis_nhds_zero R Γ₀).comap fun y => y - x).mem_iff] theorem mem_nhds_zero {s : Set R} : s ∈ 𝓝 (0 : R) ↔ ∃ γ : Γ₀ˣ, { x | v x < (γ : Γ₀) } ⊆ s := by simp only [mem_nhds, sub_zero] theorem loc_const {x : R} (h : (v x : Γ₀) ≠ 0) : { y : R | v y = v x } ∈ 𝓝 x := by rw [mem_nhds] use Units.mk0 _ h rw [Units.val_mk0] intro y y_in exact Valuation.map_eq_of_sub_lt _ y_in instance (priority := 100) : TopologicalRing R := (toUniformSpace_eq R Γ₀).symm ▸ v.subgroups_basis.toRingFilterBasis.isTopologicalRing theorem cauchy_iff {F : Filter R} : Cauchy F ↔ F.NeBot ∧ ∀ γ : Γ₀ˣ, ∃ M ∈ F, ∀ᵉ (x ∈ M) (y ∈ M), (v (y - x) : Γ₀) < γ := by rw [toUniformSpace_eq, AddGroupFilterBasis.cauchy_iff] apply and_congr Iff.rfl simp_rw [Valued.v.subgroups_basis.mem_addGroupFilterBasis_iff] constructor · intro h γ exact h _ (Valued.v.subgroups_basis.mem_addGroupFilterBasis _) · rintro h - ⟨γ, rfl⟩ exact h γ variable (R) /-- The unit ball of a valued ring is open. -/ theorem integer_isOpen : IsOpen (_i.v.integer : Set R) := by rw [isOpen_iff_mem_nhds] intro x hx rw [mem_nhds] exact ⟨1, fun y hy => (sub_add_cancel y x).symm ▸ le_trans (map_add _ _ _) (max_le (le_of_lt hy) hx)⟩ /-- The valuation subring of a valued field is open. -/ theorem valuationSubring_isOpen (K : Type u) [Field K] [hv : Valued K Γ₀] : IsOpen (hv.v.valuationSubring : Set K) := integer_isOpen K end Valued
Topology\Algebra\Valued\ValuedField.lean
/- Copyright (c) 2021 Patrick Massot. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot -/ import Mathlib.Topology.Algebra.Valued.ValuationTopology import Mathlib.Topology.Algebra.WithZeroTopology import Mathlib.Topology.Algebra.UniformField /-! # Valued fields and their completions In this file we study the topology of a field `K` endowed with a valuation (in our application to adic spaces, `K` will be the valuation field associated to some valuation on a ring, defined in valuation.basic). We already know from valuation.topology that one can build a topology on `K` which makes it a topological ring. The first goal is to show `K` is a topological *field*, ie inversion is continuous at every non-zero element. The next goal is to prove `K` is a *completable* topological field. This gives us a completion `hat K` which is a topological field. We also prove that `K` is automatically separated, so the map from `K` to `hat K` is injective. Then we extend the valuation given on `K` to a valuation on `hat K`. -/ open Filter Set open Topology section DivisionRing variable {K : Type*} [DivisionRing K] {Γ₀ : Type*} [LinearOrderedCommGroupWithZero Γ₀] section ValuationTopologicalDivisionRing section InversionEstimate variable (v : Valuation K Γ₀) -- The following is the main technical lemma ensuring that inversion is continuous -- in the topology induced by a valuation on a division ring (i.e. the next instance) -- and the fact that a valued field is completable -- [BouAC, VI.5.1 Lemme 1] theorem Valuation.inversion_estimate {x y : K} {γ : Γ₀ˣ} (y_ne : y ≠ 0) (h : v (x - y) < min (γ * (v y * v y)) (v y)) : v (x⁻¹ - y⁻¹) < γ := by have hyp1 : v (x - y) < γ * (v y * v y) := lt_of_lt_of_le h (min_le_left _ _) have hyp1' : v (x - y) * (v y * v y)⁻¹ < γ := mul_inv_lt_of_lt_mul₀ hyp1 have hyp2 : v (x - y) < v y := lt_of_lt_of_le h (min_le_right _ _) have key : v x = v y := Valuation.map_eq_of_sub_lt v hyp2 have x_ne : x ≠ 0 := by intro h apply y_ne rw [h, v.map_zero] at key exact v.zero_iff.1 key.symm have decomp : x⁻¹ - y⁻¹ = x⁻¹ * (y - x) * y⁻¹ := by rw [mul_sub_left_distrib, sub_mul, mul_assoc, show y * y⁻¹ = 1 from mul_inv_cancel y_ne, show x⁻¹ * x = 1 from inv_mul_cancel x_ne, mul_one, one_mul] calc v (x⁻¹ - y⁻¹) = v (x⁻¹ * (y - x) * y⁻¹) := by rw [decomp] _ = v x⁻¹ * (v <| y - x) * v y⁻¹ := by repeat' rw [Valuation.map_mul] _ = (v x)⁻¹ * (v <| y - x) * (v y)⁻¹ := by rw [map_inv₀, map_inv₀] _ = (v <| y - x) * (v y * v y)⁻¹ := by rw [mul_assoc, mul_comm, key, mul_assoc, mul_inv_rev] _ = (v <| y - x) * (v y * v y)⁻¹ := rfl _ = (v <| x - y) * (v y * v y)⁻¹ := by rw [Valuation.map_sub_swap] _ < γ := hyp1' end InversionEstimate open Valued /-- The topology coming from a valuation on a division ring makes it a topological division ring [BouAC, VI.5.1 middle of Proposition 1] -/ instance (priority := 100) Valued.topologicalDivisionRing [Valued K Γ₀] : TopologicalDivisionRing K := { (by infer_instance : TopologicalRing K) with continuousAt_inv₀ := by intro x x_ne s s_in cases' Valued.mem_nhds.mp s_in with γ hs; clear s_in rw [mem_map, Valued.mem_nhds] change ∃ γ : Γ₀ˣ, { y : K | (v (y - x) : Γ₀) < γ } ⊆ { x : K | x⁻¹ ∈ s } have vx_ne := (Valuation.ne_zero_iff <| v).mpr x_ne let γ' := Units.mk0 _ vx_ne use min (γ * (γ' * γ')) γ' intro y y_in apply hs simp only [mem_setOf_eq] at y_in rw [Units.min_val, Units.val_mul, Units.val_mul] at y_in exact Valuation.inversion_estimate _ x_ne y_in } /-- A valued division ring is separated. -/ instance (priority := 100) ValuedRing.separated [Valued K Γ₀] : T0Space K := by suffices T2Space K by infer_instance apply TopologicalAddGroup.t2Space_of_zero_sep intro x x_ne refine ⟨{ k | v k < v x }, ?_, fun h => lt_irrefl _ h⟩ rw [Valued.mem_nhds] have vx_ne := (Valuation.ne_zero_iff <| v).mpr x_ne let γ' := Units.mk0 _ vx_ne exact ⟨γ', fun y hy => by simpa using hy⟩ section open WithZeroTopology open Valued theorem Valued.continuous_valuation [Valued K Γ₀] : Continuous (v : K → Γ₀) := by rw [continuous_iff_continuousAt] intro x rcases eq_or_ne x 0 with (rfl | h) · rw [ContinuousAt, map_zero, WithZeroTopology.tendsto_zero] intro γ hγ rw [Filter.Eventually, Valued.mem_nhds_zero] use Units.mk0 γ hγ; rfl · have v_ne : (v x : Γ₀) ≠ 0 := (Valuation.ne_zero_iff _).mpr h rw [ContinuousAt, WithZeroTopology.tendsto_of_ne_zero v_ne] apply Valued.loc_const v_ne end end ValuationTopologicalDivisionRing end DivisionRing namespace Valued open UniformSpace variable {K : Type*} [Field K] {Γ₀ : Type*} [LinearOrderedCommGroupWithZero Γ₀] [hv : Valued K Γ₀] local notation "hat " => Completion /-- A valued field is completable. -/ instance (priority := 100) completable : CompletableTopField K := { ValuedRing.separated with nice := by rintro F hF h0 have : ∃ γ₀ : Γ₀ˣ, ∃ M ∈ F, ∀ x ∈ M, (γ₀ : Γ₀) ≤ v x := by rcases Filter.inf_eq_bot_iff.mp h0 with ⟨U, U_in, M, M_in, H⟩ rcases Valued.mem_nhds_zero.mp U_in with ⟨γ₀, hU⟩ exists γ₀, M, M_in intro x xM apply le_of_not_lt _ intro hyp have : x ∈ U ∩ M := ⟨hU hyp, xM⟩ rwa [H] at this rcases this with ⟨γ₀, M₀, M₀_in, H₀⟩ rw [Valued.cauchy_iff] at hF ⊢ refine ⟨hF.1.map _, ?_⟩ replace hF := hF.2 intro γ rcases hF (min (γ * γ₀ * γ₀) γ₀) with ⟨M₁, M₁_in, H₁⟩ clear hF use (fun x : K => x⁻¹) '' (M₀ ∩ M₁) constructor · rw [mem_map] apply mem_of_superset (Filter.inter_mem M₀_in M₁_in) exact subset_preimage_image _ _ · rintro _ ⟨x, ⟨x_in₀, x_in₁⟩, rfl⟩ _ ⟨y, ⟨_, y_in₁⟩, rfl⟩ simp only [mem_setOf_eq] specialize H₁ x x_in₁ y y_in₁ replace x_in₀ := H₀ x x_in₀ clear H₀ apply Valuation.inversion_estimate · have : (v x : Γ₀) ≠ 0 := by intro h rw [h] at x_in₀ simp at x_in₀ exact (Valuation.ne_zero_iff _).mp this · refine lt_of_lt_of_le H₁ ?_ rw [Units.min_val] apply min_le_min _ x_in₀ rw [mul_assoc] have : ((γ₀ * γ₀ : Γ₀ˣ) : Γ₀) ≤ v x * v x := calc ↑γ₀ * ↑γ₀ ≤ ↑γ₀ * v x := mul_le_mul_left' x_in₀ ↑γ₀ _ ≤ _ := mul_le_mul_right' x_in₀ (v x) rw [Units.val_mul] exact mul_le_mul_left' this γ } open WithZeroTopology /-- The extension of the valuation of a valued field to the completion of the field. -/ noncomputable def extension : hat K → Γ₀ := Completion.denseInducing_coe.extend (v : K → Γ₀) theorem continuous_extension : Continuous (Valued.extension : hat K → Γ₀) := by refine Completion.denseInducing_coe.continuous_extend ?_ intro x₀ rcases eq_or_ne x₀ 0 with (rfl | h) · refine ⟨0, ?_⟩ erw [← Completion.denseInducing_coe.toInducing.nhds_eq_comap] exact Valued.continuous_valuation.tendsto' 0 0 (map_zero v) · have preimage_one : v ⁻¹' {(1 : Γ₀)} ∈ 𝓝 (1 : K) := by have : (v (1 : K) : Γ₀) ≠ 0 := by rw [Valuation.map_one] exact zero_ne_one.symm convert Valued.loc_const this ext x rw [Valuation.map_one, mem_preimage, mem_singleton_iff, mem_setOf_eq] obtain ⟨V, V_in, hV⟩ : ∃ V ∈ 𝓝 (1 : hat K), ∀ x : K, (x : hat K) ∈ V → (v x : Γ₀) = 1 := by rwa [Completion.denseInducing_coe.nhds_eq_comap, mem_comap] at preimage_one have : ∃ V' ∈ 𝓝 (1 : hat K), (0 : hat K) ∉ V' ∧ ∀ (x) (_ : x ∈ V') (y) (_ : y ∈ V'), x * y⁻¹ ∈ V := by have : Tendsto (fun p : hat K × hat K => p.1 * p.2⁻¹) ((𝓝 1) ×ˢ (𝓝 1)) (𝓝 1) := by rw [← nhds_prod_eq] conv => congr rfl rfl rw [← one_mul (1 : hat K)] refine Tendsto.mul continuous_fst.continuousAt (Tendsto.comp ?_ continuous_snd.continuousAt) -- Porting note: Added `ContinuousAt.tendsto` convert (continuousAt_inv₀ (zero_ne_one.symm : 1 ≠ (0 : hat K))).tendsto exact inv_one.symm rcases tendsto_prod_self_iff.mp this V V_in with ⟨U, U_in, hU⟩ let hatKstar := ({0}ᶜ : Set <| hat K) have : hatKstar ∈ 𝓝 (1 : hat K) := compl_singleton_mem_nhds zero_ne_one.symm use U ∩ hatKstar, Filter.inter_mem U_in this constructor · rintro ⟨_, h'⟩ rw [mem_compl_singleton_iff] at h' exact h' rfl · rintro x ⟨hx, _⟩ y ⟨hy, _⟩ apply hU <;> assumption rcases this with ⟨V', V'_in, zeroV', hV'⟩ have nhds_right : (fun x => x * x₀) '' V' ∈ 𝓝 x₀ := by have l : Function.LeftInverse (fun x : hat K => x * x₀⁻¹) fun x : hat K => x * x₀ := by intro x simp only [mul_assoc, mul_inv_cancel h, mul_one] have r : Function.RightInverse (fun x : hat K => x * x₀⁻¹) fun x : hat K => x * x₀ := by intro x simp only [mul_assoc, inv_mul_cancel h, mul_one] have c : Continuous fun x : hat K => x * x₀⁻¹ := continuous_id.mul continuous_const rw [image_eq_preimage_of_inverse l r] rw [← mul_inv_cancel h] at V'_in exact c.continuousAt V'_in have : ∃ z₀ : K, ∃ y₀ ∈ V', ↑z₀ = y₀ * x₀ ∧ z₀ ≠ 0 := by rcases Completion.denseRange_coe.mem_nhds nhds_right with ⟨z₀, y₀, y₀_in, H : y₀ * x₀ = z₀⟩ refine ⟨z₀, y₀, y₀_in, ⟨H.symm, ?_⟩⟩ rintro rfl exact mul_ne_zero (ne_of_mem_of_not_mem y₀_in zeroV') h H rcases this with ⟨z₀, y₀, y₀_in, hz₀, z₀_ne⟩ have vz₀_ne : (v z₀ : Γ₀) ≠ 0 := by rwa [Valuation.ne_zero_iff] refine ⟨v z₀, ?_⟩ rw [WithZeroTopology.tendsto_of_ne_zero vz₀_ne, eventually_comap] filter_upwards [nhds_right] with x x_in a ha rcases x_in with ⟨y, y_in, rfl⟩ have : (v (a * z₀⁻¹) : Γ₀) = 1 := by apply hV have : (z₀⁻¹ : K) = (z₀ : hat K)⁻¹ := map_inv₀ (Completion.coeRingHom : K →+* hat K) z₀ rw [Completion.coe_mul, this, ha, hz₀, mul_inv, mul_comm y₀⁻¹, ← mul_assoc, mul_assoc y, mul_inv_cancel h, mul_one] solve_by_elim calc v a = v (a * z₀⁻¹ * z₀) := by rw [mul_assoc, inv_mul_cancel z₀_ne, mul_one] _ = v (a * z₀⁻¹) * v z₀ := Valuation.map_mul _ _ _ _ = v z₀ := by rw [this, one_mul] @[simp, norm_cast] theorem extension_extends (x : K) : extension (x : hat K) = v x := by refine Completion.denseInducing_coe.extend_eq_of_tendsto ?_ rw [← Completion.denseInducing_coe.nhds_eq_comap] exact Valued.continuous_valuation.continuousAt /-- the extension of a valuation on a division ring to its completion. -/ noncomputable def extensionValuation : Valuation (hat K) Γ₀ where toFun := Valued.extension map_zero' := by rw [← v.map_zero (R := K), ← Valued.extension_extends (0 : K)] rfl map_one' := by simp only rw [← Completion.coe_one, Valued.extension_extends (1 : K)] exact Valuation.map_one _ map_mul' x y := by apply Completion.induction_on₂ x y (p := fun x y => extension (x * y) = extension x * extension y) · have c1 : Continuous fun x : hat K × hat K => Valued.extension (x.1 * x.2) := Valued.continuous_extension.comp (continuous_fst.mul continuous_snd) have c2 : Continuous fun x : hat K × hat K => Valued.extension x.1 * Valued.extension x.2 := (Valued.continuous_extension.comp continuous_fst).mul (Valued.continuous_extension.comp continuous_snd) exact isClosed_eq c1 c2 · intro x y norm_cast exact Valuation.map_mul _ _ _ map_add_le_max' x y := by rw [le_max_iff] apply Completion.induction_on₂ x y (p := fun x y => extension (x + y) ≤ extension x ∨ extension (x + y) ≤ extension y) · have cont : Continuous (Valued.extension : hat K → Γ₀) := Valued.continuous_extension exact (isClosed_le (cont.comp continuous_add) <| cont.comp continuous_fst).union (isClosed_le (cont.comp continuous_add) <| cont.comp continuous_snd) · intro x y norm_cast rw [← le_max_iff] exact v.map_add x y -- Bourbaki CA VI §5 no.3 Proposition 5 (d) theorem closure_coe_completion_v_lt {γ : Γ₀ˣ} : closure ((↑) '' { x : K | v x < (γ : Γ₀) }) = { x : hat K | extensionValuation x < (γ : Γ₀) } := by ext x let γ₀ := extensionValuation x suffices γ₀ ≠ 0 → (x ∈ closure ((↑) '' { x : K | v x < (γ : Γ₀) }) ↔ γ₀ < (γ : Γ₀)) by rcases eq_or_ne γ₀ 0 with h | h · simp only [h, (Valuation.zero_iff _).mp h, mem_setOf_eq, Valuation.map_zero, Units.zero_lt, iff_true_iff] apply subset_closure exact ⟨0, by simp only [mem_setOf_eq, Valuation.map_zero, Units.zero_lt, true_and_iff]; rfl⟩ · exact this h intro h have hγ₀ : extension ⁻¹' {γ₀} ∈ 𝓝 x := continuous_extension.continuousAt.preimage_mem_nhds (WithZeroTopology.singleton_mem_nhds_of_ne_zero h) rw [mem_closure_iff_nhds'] refine ⟨fun hx => ?_, fun hx s hs => ?_⟩ · obtain ⟨⟨-, y, hy₁ : v y < (γ : Γ₀), rfl⟩, hy₂⟩ := hx _ hγ₀ replace hy₂ : v y = γ₀ := by simpa using hy₂ rwa [← hy₂] · obtain ⟨y, hy₁, hy₂⟩ := Completion.denseRange_coe.mem_nhds (inter_mem hγ₀ hs) replace hy₁ : v y = γ₀ := by simpa using hy₁ rw [← hy₁] at hx exact ⟨⟨y, ⟨y, hx, rfl⟩⟩, hy₂⟩ noncomputable instance valuedCompletion : Valued (hat K) Γ₀ where v := extensionValuation is_topological_valuation s := by suffices HasBasis (𝓝 (0 : hat K)) (fun _ => True) fun γ : Γ₀ˣ => { x | extensionValuation x < γ } by rw [this.mem_iff] exact exists_congr fun γ => by simp simp_rw [← closure_coe_completion_v_lt] exact (hasBasis_nhds_zero K Γ₀).hasBasis_of_denseInducing Completion.denseInducing_coe -- Porting note: removed @[norm_cast] attribute due to error: -- norm_cast: badly shaped lemma, rhs can't start with coe @[simp] theorem valuedCompletion_apply (x : K) : Valued.v (x : hat K) = v x := extension_extends x end Valued section Notation namespace Valued variable (K : Type*) [Field K] {Γ₀ : outParam Type*} [LinearOrderedCommGroupWithZero Γ₀] [vK : Valued K Γ₀] /-- A `Valued` version of `Valuation.integer`, enabling the notation `𝒪[K]` for the valuation integers of a valued field `K`. -/ @[reducible] def integer : Subring K := (vK.v).integer @[inherit_doc] scoped notation "𝒪[" K "]" => Valued.integer K /-- An abbrevation for `LocalRing.maximalIdeal 𝒪[K]` of a valued field `K`, enabling the notation `𝓂[K]` for the maximal ideal in `𝒪[K]` of a valued field `K`. -/ @[reducible] def maximalIdeal : Ideal 𝒪[K] := LocalRing.maximalIdeal 𝒪[K] @[inherit_doc] scoped notation "𝓂[" K "]" => maximalIdeal K /-- An abbrevation for `LocalRing.ResidueField 𝒪[K]` of a `Valued` instance, enabling the notation `𝓀[K]` for the residue field of a valued field `K`. -/ @[reducible] def ResidueField := LocalRing.ResidueField (𝒪[K]) @[inherit_doc] scoped notation "𝓀[" K "]" => ResidueField K end Valued end Notation
Topology\Baire\CompleteMetrizable.lean
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel, Yury Kudryashov -/ import Mathlib.Analysis.SpecificLimits.Basic import Mathlib.Topology.Metrizable.Uniformity /-! # First Baire theorem In this file we prove that a completely metrizable topological space is a Baire space. Since `Mathlib` does not have the notion of a completely metrizable topological space yet, we state it for a complete uniform space with countably generated uniformity filter. -/ open Filter EMetric Set open scoped Topology Uniformity ENNReal variable {X : Type*} [UniformSpace X] [CompleteSpace X] [(𝓤 X).IsCountablyGenerated] /-- **First Baire theorem**: a completely metrizable topological space has Baire property. Since `Mathlib` does not have the notion of a completely metrizable topological space yet, we state it for a complete uniform space with countably generated uniformity filter. -/ instance (priority := 100) BaireSpace.of_pseudoEMetricSpace_completeSpace : BaireSpace X := by let _ := UniformSpace.pseudoMetricSpace X refine ⟨fun f ho hd => ?_⟩ let B : ℕ → ℝ≥0∞ := fun n => 1 / 2 ^ n have Bpos : ∀ n, 0 < B n := fun n ↦ ENNReal.div_pos one_ne_zero <| ENNReal.pow_ne_top ENNReal.coe_ne_top /- Translate the density assumption into two functions `center` and `radius` associating to any n, x, δ, δpos a center and a positive radius such that `closedBall center radius` is included both in `f n` and in `closedBall x δ`. We can also require `radius ≤ (1/2)^(n+1)`, to ensure we get a Cauchy sequence later. -/ have : ∀ n x δ, δ ≠ 0 → ∃ y r, 0 < r ∧ r ≤ B (n + 1) ∧ closedBall y r ⊆ closedBall x δ ∩ f n := by intro n x δ δpos have : x ∈ closure (f n) := hd n x rcases EMetric.mem_closure_iff.1 this (δ / 2) (ENNReal.half_pos δpos) with ⟨y, ys, xy⟩ rw [edist_comm] at xy obtain ⟨r, rpos, hr⟩ : ∃ r > 0, closedBall y r ⊆ f n := nhds_basis_closed_eball.mem_iff.1 (isOpen_iff_mem_nhds.1 (ho n) y ys) refine ⟨y, min (min (δ / 2) r) (B (n + 1)), ?_, ?_, fun z hz => ⟨?_, ?_⟩⟩ · show 0 < min (min (δ / 2) r) (B (n + 1)) exact lt_min (lt_min (ENNReal.half_pos δpos) rpos) (Bpos (n + 1)) · show min (min (δ / 2) r) (B (n + 1)) ≤ B (n + 1) exact min_le_right _ _ · show z ∈ closedBall x δ calc edist z x ≤ edist z y + edist y x := edist_triangle _ _ _ _ ≤ min (min (δ / 2) r) (B (n + 1)) + δ / 2 := add_le_add hz (le_of_lt xy) _ ≤ δ / 2 + δ / 2 := (add_le_add (le_trans (min_le_left _ _) (min_le_left _ _)) le_rfl) _ = δ := ENNReal.add_halves δ show z ∈ f n exact hr (calc edist z y ≤ min (min (δ / 2) r) (B (n + 1)) := hz _ ≤ r := le_trans (min_le_left _ _) (min_le_right _ _)) choose! center radius Hpos HB Hball using this refine fun x => (mem_closure_iff_nhds_basis nhds_basis_closed_eball).2 fun ε εpos => ?_ /- `ε` is positive. We have to find a point in the ball of radius `ε` around `x` belonging to all `f n`. For this, we construct inductively a sequence `F n = (c n, r n)` such that the closed ball `closedBall (c n) (r n)` is included in the previous ball and in `f n`, and such that `r n` is small enough to ensure that `c n` is a Cauchy sequence. Then `c n` converges to a limit which belongs to all the `f n`. -/ let F : ℕ → X × ℝ≥0∞ := fun n => Nat.recOn n (Prod.mk x (min ε (B 0))) fun n p => Prod.mk (center n p.1 p.2) (radius n p.1 p.2) let c : ℕ → X := fun n => (F n).1 let r : ℕ → ℝ≥0∞ := fun n => (F n).2 have rpos : ∀ n, 0 < r n := by intro n induction n with | zero => exact lt_min εpos (Bpos 0) | succ n hn => exact Hpos n (c n) (r n) hn.ne' have r0 : ∀ n, r n ≠ 0 := fun n => (rpos n).ne' have rB : ∀ n, r n ≤ B n := by intro n cases n with | zero => exact min_le_right _ _ | succ n => exact HB n (c n) (r n) (r0 n) have incl : ∀ n, closedBall (c (n + 1)) (r (n + 1)) ⊆ closedBall (c n) (r n) ∩ f n := fun n => Hball n (c n) (r n) (r0 n) have cdist : ∀ n, edist (c n) (c (n + 1)) ≤ B n := by intro n rw [edist_comm] have A : c (n + 1) ∈ closedBall (c (n + 1)) (r (n + 1)) := mem_closedBall_self have I := calc closedBall (c (n + 1)) (r (n + 1)) ⊆ closedBall (c n) (r n) := Subset.trans (incl n) inter_subset_left _ ⊆ closedBall (c n) (B n) := closedBall_subset_closedBall (rB n) exact I A have : CauchySeq c := cauchySeq_of_edist_le_geometric_two _ ENNReal.one_ne_top cdist -- as the sequence `c n` is Cauchy in a complete space, it converges to a limit `y`. rcases cauchySeq_tendsto_of_complete this with ⟨y, ylim⟩ -- this point `y` will be the desired point. We will check that it belongs to all -- `f n` and to `ball x ε`. use y simp only [exists_prop, Set.mem_iInter] have I : ∀ n, ∀ m ≥ n, closedBall (c m) (r m) ⊆ closedBall (c n) (r n) := by intro n refine Nat.le_induction ?_ fun m _ h => ?_ · exact Subset.refl _ · exact Subset.trans (incl m) (Subset.trans inter_subset_left h) have yball : ∀ n, y ∈ closedBall (c n) (r n) := by intro n refine isClosed_ball.mem_of_tendsto ylim ?_ refine (Filter.eventually_ge_atTop n).mono fun m hm => ?_ exact I n m hm mem_closedBall_self constructor · show ∀ n, y ∈ f n intro n have : closedBall (c (n + 1)) (r (n + 1)) ⊆ f n := Subset.trans (incl n) inter_subset_right exact this (yball (n + 1)) show edist y x ≤ ε exact le_trans (yball 0) (min_le_left _ _)
Topology\Baire\Lemmas.lean
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Topology.GDelta /-! # Baire spaces A topological space is called a *Baire space* if a countable intersection of dense open subsets is dense. Baire theorems say that all completely metrizable spaces and all locally compact regular spaces are Baire spaces. We prove the theorems in `Mathlib/Topology/Baire/CompleteMetrizable` and `Mathlib/Topology/Baire/LocallyCompactRegular`. In this file we prove various corollaries of Baire theorems. The good concept underlying the theorems is that of a Gδ set, i.e., a countable intersection of open sets. Then Baire theorem can also be formulated as the fact that a countable intersection of dense Gδ sets is a dense Gδ set. We deduce this version from Baire property. We also prove the important consequence that, if the space is covered by a countable union of closed sets, then the union of their interiors is dense. We also prove that in Baire spaces, the `residual` sets are exactly those containing a dense Gδ set. -/ noncomputable section open scoped Topology open Filter Set TopologicalSpace variable {X α : Type*} {ι : Sort*} section BaireTheorem variable [TopologicalSpace X] [BaireSpace X] /-- Definition of a Baire space. -/ theorem dense_iInter_of_isOpen_nat {f : ℕ → Set X} (ho : ∀ n, IsOpen (f n)) (hd : ∀ n, Dense (f n)) : Dense (⋂ n, f n) := BaireSpace.baire_property f ho hd /-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with ⋂₀. -/ theorem dense_sInter_of_isOpen {S : Set (Set X)} (ho : ∀ s ∈ S, IsOpen s) (hS : S.Countable) (hd : ∀ s ∈ S, Dense s) : Dense (⋂₀ S) := by rcases S.eq_empty_or_nonempty with h | h · simp [h] · rcases hS.exists_eq_range h with ⟨f, rfl⟩ exact dense_iInter_of_isOpen_nat (forall_mem_range.1 ho) (forall_mem_range.1 hd) /-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with an index set which is a countable set in any type. -/ theorem dense_biInter_of_isOpen {S : Set α} {f : α → Set X} (ho : ∀ s ∈ S, IsOpen (f s)) (hS : S.Countable) (hd : ∀ s ∈ S, Dense (f s)) : Dense (⋂ s ∈ S, f s) := by rw [← sInter_image] refine dense_sInter_of_isOpen ?_ (hS.image _) ?_ <;> rwa [forall_mem_image] /-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with an index set which is a countable type. -/ theorem dense_iInter_of_isOpen [Countable ι] {f : ι → Set X} (ho : ∀ i, IsOpen (f i)) (hd : ∀ i, Dense (f i)) : Dense (⋂ s, f s) := dense_sInter_of_isOpen (forall_mem_range.2 ho) (countable_range _) (forall_mem_range.2 hd) /-- A set is residual (comeagre) if and only if it includes a dense `Gδ` set. -/ theorem mem_residual {s : Set X} : s ∈ residual X ↔ ∃ t ⊆ s, IsGδ t ∧ Dense t := by constructor · rw [mem_residual_iff] rintro ⟨S, hSo, hSd, Sct, Ss⟩ refine ⟨_, Ss, ⟨_, fun t ht => hSo _ ht, Sct, rfl⟩, ?_⟩ exact dense_sInter_of_isOpen hSo Sct hSd rintro ⟨t, ts, ho, hd⟩ exact mem_of_superset (residual_of_dense_Gδ ho hd) ts /-- A property holds on a residual (comeagre) set if and only if it holds on some dense `Gδ` set. -/ theorem eventually_residual {p : X → Prop} : (∀ᶠ x in residual X, p x) ↔ ∃ t : Set X, IsGδ t ∧ Dense t ∧ ∀ x ∈ t, p x := by simp only [Filter.Eventually, mem_residual, subset_def, mem_setOf_eq] tauto theorem dense_of_mem_residual {s : Set X} (hs : s ∈ residual X) : Dense s := let ⟨_, hts, _, hd⟩ := mem_residual.1 hs hd.mono hts /-- Baire theorem: a countable intersection of dense Gδ sets is dense. Formulated here with ⋂₀. -/ theorem dense_sInter_of_Gδ {S : Set (Set X)} (ho : ∀ s ∈ S, IsGδ s) (hS : S.Countable) (hd : ∀ s ∈ S, Dense s) : Dense (⋂₀ S) := dense_of_mem_residual ((countable_sInter_mem hS).mpr (fun _ hs => residual_of_dense_Gδ (ho _ hs) (hd _ hs))) /-- Baire theorem: a countable intersection of dense Gδ sets is dense. Formulated here with an index set which is a countable type. -/ theorem dense_iInter_of_Gδ [Countable ι] {f : ι → Set X} (ho : ∀ s, IsGδ (f s)) (hd : ∀ s, Dense (f s)) : Dense (⋂ s, f s) := dense_sInter_of_Gδ (forall_mem_range.2 ‹_›) (countable_range _) (forall_mem_range.2 ‹_›) /-- Baire theorem: a countable intersection of dense Gδ sets is dense. Formulated here with an index set which is a countable set in any type. -/ theorem dense_biInter_of_Gδ {S : Set α} {f : ∀ x ∈ S, Set X} (ho : ∀ s (H : s ∈ S), IsGδ (f s H)) (hS : S.Countable) (hd : ∀ s (H : s ∈ S), Dense (f s H)) : Dense (⋂ s ∈ S, f s ‹_›) := by rw [biInter_eq_iInter] haveI := hS.to_subtype exact dense_iInter_of_Gδ (fun s => ho s s.2) fun s => hd s s.2 /-- Baire theorem: the intersection of two dense Gδ sets is dense. -/ theorem Dense.inter_of_Gδ {s t : Set X} (hs : IsGδ s) (ht : IsGδ t) (hsc : Dense s) (htc : Dense t) : Dense (s ∩ t) := by rw [inter_eq_iInter] apply dense_iInter_of_Gδ <;> simp [Bool.forall_bool, *] /-- If a countable family of closed sets cover a dense `Gδ` set, then the union of their interiors is dense. Formulated here with `⋃`. -/ theorem IsGδ.dense_iUnion_interior_of_closed [Countable ι] {s : Set X} (hs : IsGδ s) (hd : Dense s) {f : ι → Set X} (hc : ∀ i, IsClosed (f i)) (hU : s ⊆ ⋃ i, f i) : Dense (⋃ i, interior (f i)) := by let g i := (frontier (f i))ᶜ have hgo : ∀ i, IsOpen (g i) := fun i => isClosed_frontier.isOpen_compl have hgd : Dense (⋂ i, g i) := by refine dense_iInter_of_isOpen hgo fun i x => ?_ rw [closure_compl, interior_frontier (hc _)] exact id refine (hd.inter_of_Gδ hs (.iInter_of_isOpen fun i => (hgo i)) hgd).mono ?_ rintro x ⟨hxs, hxg⟩ rw [mem_iInter] at hxg rcases mem_iUnion.1 (hU hxs) with ⟨i, hi⟩ exact mem_iUnion.2 ⟨i, self_diff_frontier (f i) ▸ ⟨hi, hxg _⟩⟩ /-- If a countable family of closed sets cover a dense `Gδ` set, then the union of their interiors is dense. Formulated here with a union over a countable set in any type. -/ theorem IsGδ.dense_biUnion_interior_of_closed {t : Set α} {s : Set X} (hs : IsGδ s) (hd : Dense s) (ht : t.Countable) {f : α → Set X} (hc : ∀ i ∈ t, IsClosed (f i)) (hU : s ⊆ ⋃ i ∈ t, f i) : Dense (⋃ i ∈ t, interior (f i)) := by haveI := ht.to_subtype simp only [biUnion_eq_iUnion, SetCoe.forall'] at * exact hs.dense_iUnion_interior_of_closed hd hc hU /-- If a countable family of closed sets cover a dense `Gδ` set, then the union of their interiors is dense. Formulated here with `⋃₀`. -/ theorem IsGδ.dense_sUnion_interior_of_closed {T : Set (Set X)} {s : Set X} (hs : IsGδ s) (hd : Dense s) (hc : T.Countable) (hc' : ∀ t ∈ T, IsClosed t) (hU : s ⊆ ⋃₀ T) : Dense (⋃ t ∈ T, interior t) := hs.dense_biUnion_interior_of_closed hd hc hc' <| by rwa [← sUnion_eq_biUnion] /-- Baire theorem: if countably many closed sets cover the whole space, then their interiors are dense. Formulated here with an index set which is a countable set in any type. -/ theorem dense_biUnion_interior_of_closed {S : Set α} {f : α → Set X} (hc : ∀ s ∈ S, IsClosed (f s)) (hS : S.Countable) (hU : ⋃ s ∈ S, f s = univ) : Dense (⋃ s ∈ S, interior (f s)) := IsGδ.univ.dense_biUnion_interior_of_closed dense_univ hS hc hU.ge /-- Baire theorem: if countably many closed sets cover the whole space, then their interiors are dense. Formulated here with `⋃₀`. -/ theorem dense_sUnion_interior_of_closed {S : Set (Set X)} (hc : ∀ s ∈ S, IsClosed s) (hS : S.Countable) (hU : ⋃₀ S = univ) : Dense (⋃ s ∈ S, interior s) := IsGδ.univ.dense_sUnion_interior_of_closed dense_univ hS hc hU.ge /-- Baire theorem: if countably many closed sets cover the whole space, then their interiors are dense. Formulated here with an index set which is a countable type. -/ theorem dense_iUnion_interior_of_closed [Countable ι] {f : ι → Set X} (hc : ∀ i, IsClosed (f i)) (hU : ⋃ i, f i = univ) : Dense (⋃ i, interior (f i)) := IsGδ.univ.dense_iUnion_interior_of_closed dense_univ hc hU.ge /-- One of the most useful consequences of Baire theorem: if a countable union of closed sets covers the space, then one of the sets has nonempty interior. -/ theorem nonempty_interior_of_iUnion_of_closed [Nonempty X] [Countable ι] {f : ι → Set X} (hc : ∀ i, IsClosed (f i)) (hU : ⋃ i, f i = univ) : ∃ i, (interior <| f i).Nonempty := by simpa using (dense_iUnion_interior_of_closed hc hU).nonempty end BaireTheorem
Topology\Baire\LocallyCompactRegular.lean
/- Copyright (c) 2022 Damien Thomine. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Damien Thomine -/ import Mathlib.Topology.Sets.Compacts /-! # Second Baire theorem In this file we prove that a locally compact regular topological space has Baire property. -/ open TopologicalSpace Set /-- **Second Baire theorem**: locally compact R₁ spaces are Baire. -/ instance (priority := 100) BaireSpace.of_t2Space_locallyCompactSpace {X : Type*} [TopologicalSpace X] [R1Space X] [LocallyCompactSpace X] : BaireSpace X := by constructor intro f ho hd /- To prove that an intersection of open dense subsets is dense, prove that its intersection with any open neighbourhood `U` is dense. Define recursively a decreasing sequence `K` of compact neighbourhoods: start with some compact neighbourhood inside `U`, then at each step, take its interior, intersect with `f n`, then choose a compact neighbourhood inside the intersection. -/ rw [dense_iff_inter_open] intro U U_open U_nonempty -- Choose an antitone sequence of positive compacts such that `closure (K 0) ⊆ U` -- and `closure (K (n + 1)) ⊆ f n` for all `n` obtain ⟨K, hK_anti, hKf, hKU⟩ : ∃ K : ℕ → PositiveCompacts X, (∀ n, K (n + 1) ≤ K n) ∧ (∀ n, closure ↑(K (n + 1)) ⊆ f n) ∧ closure ↑(K 0) ⊆ U := by rcases U_open.exists_positiveCompacts_closure_subset U_nonempty with ⟨K₀, hK₀⟩ have : ∀ (n) (K : PositiveCompacts X), ∃ K' : PositiveCompacts X, closure ↑K' ⊆ f n ∩ interior K := by refine fun n K ↦ ((ho n).inter isOpen_interior).exists_positiveCompacts_closure_subset ?_ rw [inter_comm] exact (hd n).inter_open_nonempty _ isOpen_interior K.interior_nonempty choose K_next hK_next using this -- The next two lines are faster than a single `refine`. use Nat.rec K₀ K_next refine ⟨fun n ↦ ?_, fun n ↦ (hK_next n _).trans inter_subset_left, hK₀⟩ exact subset_closure.trans <| (hK_next _ _).trans <| inter_subset_right.trans interior_subset -- Prove that ̀`⋂ n : ℕ, closure (K n)` is inside `U ∩ ⋂ n : ℕ, f n`. have hK_subset : (⋂ n, closure (K n) : Set X) ⊆ U ∩ ⋂ n, f n := fun x hx ↦ by simp only [mem_iInter, mem_inter_iff] at hx ⊢ exact ⟨hKU <| hx 0, fun n ↦ hKf n <| hx (n + 1)⟩ /- Prove that `⋂ n : ℕ, closure (K n)` is not empty, as an intersection of a decreasing sequence of nonempty compact closed subsets. -/ have hK_nonempty : (⋂ n, closure (K n) : Set X).Nonempty := IsCompact.nonempty_iInter_of_sequence_nonempty_isCompact_isClosed _ (fun n => closure_mono <| hK_anti n) (fun n => (K n).nonempty.closure) (K 0).isCompact.closure fun n => isClosed_closure exact hK_nonempty.mono hK_subset
Topology\Bornology\Absorbs.lean
/- Copyright (c) 2020 Jean Lo, Yury Kudryashov. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Jean Lo, Yury Kudryashov -/ import Mathlib.Data.Set.Pointwise.SMul import Mathlib.Topology.Bornology.Basic /-! # Absorption of sets Let `M` act on `α`, let `A` and `B` be sets in `α`. We say that `A` *absorbs* `B` if for sufficiently large `a : M`, we have `B ⊆ a • A`. Formally, "for sufficiently large `a : M`" means "for all but a bounded set of `a`". Traditionally, this definition is formulated for the action of a (semi)normed ring on a module over that ring. We formulate it in a more general settings for two reasons: - this way we don't have to depend on metric spaces, normed rings etc; - some proofs look nicer with this definition than with something like `∃ r : ℝ, ∀ a : R, r ≤ ‖a‖ → B ⊆ a • A`. ## Implementation notes For now, all theorems assume that we deal with (a generalization of) a module over a division ring. Some lemmas have multiplicative versions for `MulDistribMulAction`s. They can be added later when someone needs them. ## Keywords absorbs, absorbent -/ open Set Bornology Filter open scoped Pointwise assert_not_exists Real section Defs variable (M : Type*) {α : Type*} [Bornology M] [SMul M α] /-- A set `s` absorbs another set `t` if `t` is contained in all scalings of `s` by all but a bounded set of elements. -/ def Absorbs (s t : Set α) : Prop := ∀ᶠ a in cobounded M, t ⊆ a • s /-- A set is *absorbent* if it absorbs every singleton. -/ def Absorbent (s : Set α) : Prop := ∀ x, Absorbs M s {x} end Defs namespace Absorbs section SMul variable {M α : Type*} [Bornology M] [SMul M α] {s s₁ s₂ t t₁ t₂ : Set α} {S T : Set (Set α)} protected lemma empty : Absorbs M s ∅ := by simp [Absorbs] @[deprecated (since := "2024-01-16")] alias _root_.absorbs_empty := Absorbs.empty protected lemma eventually (h : Absorbs M s t) : ∀ᶠ a in cobounded M, t ⊆ a • s := h @[simp] lemma of_boundedSpace [BoundedSpace M] : Absorbs M s t := by simp [Absorbs] lemma mono_left (h : Absorbs M s₁ t) (hs : s₁ ⊆ s₂) : Absorbs M s₂ t := h.mono fun _a ha ↦ ha.trans <| smul_set_mono hs lemma mono_right (h : Absorbs M s t₁) (ht : t₂ ⊆ t₁) : Absorbs M s t₂ := h.mono fun _ ↦ ht.trans lemma mono (h : Absorbs M s₁ t₁) (hs : s₁ ⊆ s₂) (ht : t₂ ⊆ t₁) : Absorbs M s₂ t₂ := (h.mono_left hs).mono_right ht @[simp] lemma _root_.absorbs_union : Absorbs M s (t₁ ∪ t₂) ↔ Absorbs M s t₁ ∧ Absorbs M s t₂ := by simp [Absorbs] protected lemma union (h₁ : Absorbs M s t₁) (h₂ : Absorbs M s t₂) : Absorbs M s (t₁ ∪ t₂) := absorbs_union.2 ⟨h₁, h₂⟩ lemma _root_.Set.Finite.absorbs_sUnion {T : Set (Set α)} (hT : T.Finite) : Absorbs M s (⋃₀ T) ↔ ∀ t ∈ T, Absorbs M s t := by simp [Absorbs, hT] protected lemma sUnion (hT : T.Finite) (hs : ∀ t ∈ T, Absorbs M s t) : Absorbs M s (⋃₀ T) := hT.absorbs_sUnion.2 hs @[simp] lemma _root_.absorbs_iUnion {ι : Sort*} [Finite ι] {t : ι → Set α} : Absorbs M s (⋃ i, t i) ↔ ∀ i, Absorbs M s (t i) := (finite_range t).absorbs_sUnion.trans forall_mem_range protected alias ⟨_, iUnion⟩ := absorbs_iUnion lemma _root_.Set.Finite.absorbs_biUnion {ι : Type*} {t : ι → Set α} {I : Set ι} (hI : I.Finite) : Absorbs M s (⋃ i ∈ I, t i) ↔ ∀ i ∈ I, Absorbs M s (t i) := by simp [Absorbs, hI] protected alias ⟨_, biUnion⟩ := Set.Finite.absorbs_biUnion @[deprecated (since := "2024-01-16")] alias _root_.Set.Finite.absorbs_iUnion := Set.Finite.absorbs_biUnion @[simp] lemma _root_.absorbs_biUnion_finset {ι : Type*} {t : ι → Set α} {I : Finset ι} : Absorbs M s (⋃ i ∈ I, t i) ↔ ∀ i ∈ I, Absorbs M s (t i) := I.finite_toSet.absorbs_biUnion protected alias ⟨_, biUnion_finset⟩ := absorbs_biUnion_finset @[deprecated (since := "2024-01-16")] alias _root_.absorbs_iUnion_finset := absorbs_biUnion_finset end SMul section AddZero variable {M E : Type*} [Bornology M] {s₁ s₂ t₁ t₂ : Set E} protected lemma add [AddZeroClass E] [DistribSMul M E] (h₁ : Absorbs M s₁ t₁) (h₂ : Absorbs M s₂ t₂) : Absorbs M (s₁ + s₂) (t₁ + t₂) := h₂.mp <| h₁.eventually.mono fun x hx₁ hx₂ ↦ by rw [smul_add]; exact add_subset_add hx₁ hx₂ protected lemma zero [Zero E] [SMulZeroClass M E] {s : Set E} (hs : 0 ∈ s) : Absorbs M s 0 := eventually_of_forall fun _ ↦ zero_subset.2 <| zero_mem_smul_set hs end AddZero section GroupWithZero variable {G₀ α : Type*} [GroupWithZero G₀] [Bornology G₀] [MulAction G₀ α] {s t u : Set α} {S : Set (Set α)} @[simp] protected lemma univ : Absorbs G₀ univ s := (eventually_ne_cobounded 0).mono fun a ha ↦ by rw [smul_set_univ₀ ha]; apply subset_univ lemma _root_.absorbs_iff_eventually_cobounded_mapsTo : Absorbs G₀ s t ↔ ∀ᶠ c in cobounded G₀, MapsTo (c⁻¹ • ·) t s := eventually_congr <| (eventually_ne_cobounded 0).mono fun c hc ↦ by rw [← preimage_smul_inv₀ hc]; rfl alias ⟨eventually_cobounded_mapsTo, _⟩ := absorbs_iff_eventually_cobounded_mapsTo lemma _root_.Set.Finite.absorbs_sInter (hS : S.Finite) : Absorbs G₀ (⋂₀ S) t ↔ ∀ s ∈ S, Absorbs G₀ s t := by simp only [absorbs_iff_eventually_cobounded_mapsTo, mapsTo_sInter, hS.eventually_all] protected alias ⟨_, sInter⟩ := Set.Finite.absorbs_sInter @[simp] lemma _root_.absorbs_inter : Absorbs G₀ (s ∩ t) u ↔ Absorbs G₀ s u ∧ Absorbs G₀ t u := by simpa using ((finite_singleton t).insert s).absorbs_sInter protected lemma inter (hs : Absorbs G₀ s u) (ht : Absorbs G₀ t u) : Absorbs G₀ (s ∩ t) u := absorbs_inter.2 ⟨hs, ht⟩ @[simp] lemma _root_.absorbs_iInter {ι : Sort*} [Finite ι] {s : ι → Set α} : Absorbs G₀ (⋂ i, s i) t ↔ ∀ i, Absorbs G₀ (s i) t := (finite_range s).absorbs_sInter.trans forall_mem_range protected alias ⟨_, iInter⟩ := absorbs_iInter lemma _root_.Set.Finite.absorbs_biInter {ι : Type*} {I : Set ι} (hI : I.Finite) {s : ι → Set α} : Absorbs G₀ (⋂ i ∈ I, s i) t ↔ ∀ i ∈ I, Absorbs G₀ (s i) t := by simpa only [sInter_image, forall_mem_image] using (hI.image s).absorbs_sInter protected alias ⟨_, biInter⟩ := Set.Finite.absorbs_biInter @[simp] lemma _root_.absorbs_zero_iff [NeBot (cobounded G₀)] {E : Type*} [AddMonoid E] [DistribMulAction G₀ E] {s : Set E} : Absorbs G₀ s 0 ↔ 0 ∈ s := by simp only [absorbs_iff_eventually_cobounded_mapsTo, ← singleton_zero, mapsTo_singleton, smul_zero, eventually_const] end GroupWithZero end Absorbs section AddGroup variable {M E : Type*} [Monoid M] [AddGroup E] [DistribMulAction M E] [Bornology M] @[simp] lemma absorbs_neg_neg {s t : Set E} : Absorbs M (-s) (-t) ↔ Absorbs M s t := by simp [Absorbs] alias ⟨Absorbs.of_neg_neg, Absorbs.neg_neg⟩ := absorbs_neg_neg lemma Absorbs.sub {s₁ s₂ t₁ t₂ : Set E} (h₁ : Absorbs M s₁ t₁) (h₂ : Absorbs M s₂ t₂) : Absorbs M (s₁ - s₂) (t₁ - t₂) := by simpa only [sub_eq_add_neg] using h₁.add h₂.neg_neg end AddGroup namespace Absorbent section SMul variable {M α : Type*} [Bornology M] [SMul M α] {s t : Set α} protected theorem mono (ht : Absorbent M s) (hsub : s ⊆ t) : Absorbent M t := fun x ↦ (ht x).mono_left hsub @[deprecated (since := "2024-01-16")] protected alias subset := Absorbent.mono theorem _root_.absorbent_iff_forall_absorbs_singleton : Absorbent M s ↔ ∀ x, Absorbs M s {x} := .rfl protected theorem absorbs (hs : Absorbent M s) {x : α} : Absorbs M s {x} := hs x theorem absorbs_finite (hs : Absorbent M s) (ht : t.Finite) : Absorbs M s t := by rw [← Set.biUnion_of_singleton t] exact .biUnion ht fun _ _ => hs.absorbs end SMul theorem vadd_absorbs {M E : Type*} [Bornology M] [AddZeroClass E] [DistribSMul M E] {s₁ s₂ t : Set E} {x : E} (h₁ : Absorbent M s₁) (h₂ : Absorbs M s₂ t) : Absorbs M (s₁ + s₂) (x +ᵥ t) := by rw [← singleton_vadd]; exact (h₁ x).add h₂ end Absorbent section GroupWithZero variable {G₀ α E : Type*} [GroupWithZero G₀] [Bornology G₀] [MulAction G₀ α] lemma absorbent_univ : Absorbent G₀ (univ : Set α) := fun _ ↦ .univ lemma absorbent_iff_inv_smul {s : Set α} : Absorbent G₀ s ↔ ∀ x, ∀ᶠ c in cobounded G₀, c⁻¹ • x ∈ s := forall_congr' fun x ↦ by simp only [absorbs_iff_eventually_cobounded_mapsTo, mapsTo_singleton] lemma Absorbent.zero_mem [NeBot (cobounded G₀)] [AddMonoid E] [DistribMulAction G₀ E] {s : Set E} (hs : Absorbent G₀ s) : (0 : E) ∈ s := absorbs_zero_iff.1 (hs 0) end GroupWithZero
Topology\Bornology\Basic.lean
/- Copyright (c) 2022 Jireh Loreaux. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Jireh Loreaux -/ import Mathlib.Order.Filter.Cofinite /-! # Basic theory of bornology We develop the basic theory of bornologies. Instead of axiomatizing bounded sets and defining bornologies in terms of those, we recognize that the cobounded sets form a filter and define a bornology as a filter of cobounded sets which contains the cofinite filter. This allows us to make use of the extensive library for filters, but we also provide the relevant connecting results for bounded sets. The specification of a bornology in terms of the cobounded filter is equivalent to the standard one (e.g., see [Bourbaki, *Topological Vector Spaces*][bourbaki1987], **covering bornology**, now often called simply **bornology**) in terms of bounded sets (see `Bornology.ofBounded`, `IsBounded.union`, `IsBounded.subset`), except that we do not allow the empty bornology (that is, we require that *some* set must be bounded; equivalently, `∅` is bounded). In the literature the cobounded filter is generally referred to as the *filter at infinity*. ## Main definitions - `Bornology α`: a class consisting of `cobounded : Filter α` and a proof that this filter contains the `cofinite` filter. - `Bornology.IsCobounded`: the predicate that a set is a member of the `cobounded α` filter. For `s : Set α`, one should prefer `Bornology.IsCobounded s` over `s ∈ cobounded α`. - `bornology.IsBounded`: the predicate that states a set is bounded (i.e., the complement of a cobounded set). One should prefer `Bornology.IsBounded s` over `sᶜ ∈ cobounded α`. - `BoundedSpace α`: a class extending `Bornology α` with the condition `Bornology.IsBounded (Set.univ : Set α)` Although use of `cobounded α` is discouraged for indicating the (co)boundedness of individual sets, it is intended for regular use as a filter on `α`. -/ open Set Filter variable {ι α β : Type*} /-- A **bornology** on a type `α` is a filter of cobounded sets which contains the cofinite filter. Such spaces are equivalently specified by their bounded sets, see `Bornology.ofBounded` and `Bornology.ext_iff_isBounded`-/ class Bornology (α : Type*) where /-- The filter of cobounded sets in a bornology. This is a field of the structure, but one should always prefer `Bornology.cobounded` because it makes the `α` argument explicit. -/ cobounded' : Filter α /-- The cobounded filter in a bornology is smaller than the cofinite filter. This is a field of the structure, but one should always prefer `Bornology.le_cofinite` because it makes the `α` argument explicit. -/ le_cofinite' : cobounded' ≤ cofinite /- porting note: Because Lean 4 doesn't accept the `[]` syntax to make arguments of structure fields explicit, we have to define these separately, prove the `ext` lemmas manually, and initialize new `simps` projections. -/ /-- The filter of cobounded sets in a bornology. -/ def Bornology.cobounded (α : Type*) [Bornology α] : Filter α := Bornology.cobounded' alias Bornology.Simps.cobounded := Bornology.cobounded lemma Bornology.le_cofinite (α : Type*) [Bornology α] : cobounded α ≤ cofinite := Bornology.le_cofinite' initialize_simps_projections Bornology (cobounded' → cobounded) @[ext] lemma Bornology.ext (t t' : Bornology α) (h_cobounded : @Bornology.cobounded α t = @Bornology.cobounded α t') : t = t' := by cases t cases t' congr /-- A constructor for bornologies by specifying the bounded sets, and showing that they satisfy the appropriate conditions. -/ @[simps] def Bornology.ofBounded {α : Type*} (B : Set (Set α)) (empty_mem : ∅ ∈ B) (subset_mem : ∀ s₁ ∈ B, ∀ s₂ ⊆ s₁, s₂ ∈ B) (union_mem : ∀ s₁ ∈ B, ∀ s₂ ∈ B, s₁ ∪ s₂ ∈ B) (singleton_mem : ∀ x, {x} ∈ B) : Bornology α where cobounded' := comk (· ∈ B) empty_mem subset_mem union_mem le_cofinite' := by simpa [le_cofinite_iff_compl_singleton_mem] /-- A constructor for bornologies by specifying the bounded sets, and showing that they satisfy the appropriate conditions. -/ @[simps! cobounded] def Bornology.ofBounded' {α : Type*} (B : Set (Set α)) (empty_mem : ∅ ∈ B) (subset_mem : ∀ s₁ ∈ B, ∀ s₂ ⊆ s₁, s₂ ∈ B) (union_mem : ∀ s₁ ∈ B, ∀ s₂ ∈ B, s₁ ∪ s₂ ∈ B) (sUnion_univ : ⋃₀ B = univ) : Bornology α := Bornology.ofBounded B empty_mem subset_mem union_mem fun x => by rw [sUnion_eq_univ_iff] at sUnion_univ rcases sUnion_univ x with ⟨s, hs, hxs⟩ exact subset_mem s hs {x} (singleton_subset_iff.mpr hxs) namespace Bornology section /-- `IsCobounded` is the predicate that `s` is in the filter of cobounded sets in the ambient bornology on `α` -/ def IsCobounded [Bornology α] (s : Set α) : Prop := s ∈ cobounded α /-- `IsBounded` is the predicate that `s` is bounded relative to the ambient bornology on `α`. -/ def IsBounded [Bornology α] (s : Set α) : Prop := IsCobounded sᶜ variable {_ : Bornology α} {s t : Set α} {x : α} theorem isCobounded_def {s : Set α} : IsCobounded s ↔ s ∈ cobounded α := Iff.rfl theorem isBounded_def {s : Set α} : IsBounded s ↔ sᶜ ∈ cobounded α := Iff.rfl @[simp] theorem isBounded_compl_iff : IsBounded sᶜ ↔ IsCobounded s := by rw [isBounded_def, isCobounded_def, compl_compl] @[simp] theorem isCobounded_compl_iff : IsCobounded sᶜ ↔ IsBounded s := Iff.rfl alias ⟨IsBounded.of_compl, IsCobounded.compl⟩ := isBounded_compl_iff alias ⟨IsCobounded.of_compl, IsBounded.compl⟩ := isCobounded_compl_iff @[simp] theorem isBounded_empty : IsBounded (∅ : Set α) := by rw [isBounded_def, compl_empty] exact univ_mem theorem nonempty_of_not_isBounded (h : ¬IsBounded s) : s.Nonempty := by rw [nonempty_iff_ne_empty] rintro rfl exact h isBounded_empty @[simp] theorem isBounded_singleton : IsBounded ({x} : Set α) := by rw [isBounded_def] exact le_cofinite _ (finite_singleton x).compl_mem_cofinite theorem isBounded_iff_forall_mem : IsBounded s ↔ ∀ x ∈ s, IsBounded s := ⟨fun h _ _ ↦ h, fun h ↦ by rcases s.eq_empty_or_nonempty with rfl | ⟨x, hx⟩ exacts [isBounded_empty, h x hx]⟩ @[simp] theorem isCobounded_univ : IsCobounded (univ : Set α) := univ_mem @[simp] theorem isCobounded_inter : IsCobounded (s ∩ t) ↔ IsCobounded s ∧ IsCobounded t := inter_mem_iff theorem IsCobounded.inter (hs : IsCobounded s) (ht : IsCobounded t) : IsCobounded (s ∩ t) := isCobounded_inter.2 ⟨hs, ht⟩ @[simp] theorem isBounded_union : IsBounded (s ∪ t) ↔ IsBounded s ∧ IsBounded t := by simp only [← isCobounded_compl_iff, compl_union, isCobounded_inter] theorem IsBounded.union (hs : IsBounded s) (ht : IsBounded t) : IsBounded (s ∪ t) := isBounded_union.2 ⟨hs, ht⟩ theorem IsCobounded.superset (hs : IsCobounded s) (ht : s ⊆ t) : IsCobounded t := mem_of_superset hs ht theorem IsBounded.subset (ht : IsBounded t) (hs : s ⊆ t) : IsBounded s := ht.superset (compl_subset_compl.mpr hs) @[simp] theorem sUnion_bounded_univ : ⋃₀ { s : Set α | IsBounded s } = univ := sUnion_eq_univ_iff.2 fun a => ⟨{a}, isBounded_singleton, mem_singleton a⟩ theorem IsBounded.insert (h : IsBounded s) (x : α) : IsBounded (insert x s) := isBounded_singleton.union h @[simp] theorem isBounded_insert : IsBounded (insert x s) ↔ IsBounded s := ⟨fun h ↦ h.subset (subset_insert _ _), (.insert · x)⟩ theorem comap_cobounded_le_iff [Bornology β] {f : α → β} : (cobounded β).comap f ≤ cobounded α ↔ ∀ ⦃s⦄, IsBounded s → IsBounded (f '' s) := by refine ⟨fun h s hs => ?_, fun h t ht => ⟨(f '' tᶜ)ᶜ, h <| IsCobounded.compl ht, compl_subset_comm.1 <| subset_preimage_image _ _⟩⟩ obtain ⟨t, ht, hts⟩ := h hs.compl rw [subset_compl_comm, ← preimage_compl] at hts exact (IsCobounded.compl ht).subset ((image_subset f hts).trans <| image_preimage_subset _ _) end theorem ext_iff' {t t' : Bornology α} : t = t' ↔ ∀ s, s ∈ @cobounded α t ↔ s ∈ @cobounded α t' := Bornology.ext_iff.trans Filter.ext_iff theorem ext_iff_isBounded {t t' : Bornology α} : t = t' ↔ ∀ s, @IsBounded α t s ↔ @IsBounded α t' s := ext_iff'.trans compl_surjective.forall variable {s : Set α} theorem isCobounded_ofBounded_iff (B : Set (Set α)) {empty_mem subset_mem union_mem sUnion_univ} : @IsCobounded _ (ofBounded B empty_mem subset_mem union_mem sUnion_univ) s ↔ sᶜ ∈ B := Iff.rfl theorem isBounded_ofBounded_iff (B : Set (Set α)) {empty_mem subset_mem union_mem sUnion_univ} : @IsBounded _ (ofBounded B empty_mem subset_mem union_mem sUnion_univ) s ↔ s ∈ B := by rw [isBounded_def, ofBounded_cobounded, compl_mem_comk] variable [Bornology α] theorem isCobounded_biInter {s : Set ι} {f : ι → Set α} (hs : s.Finite) : IsCobounded (⋂ i ∈ s, f i) ↔ ∀ i ∈ s, IsCobounded (f i) := biInter_mem hs @[simp] theorem isCobounded_biInter_finset (s : Finset ι) {f : ι → Set α} : IsCobounded (⋂ i ∈ s, f i) ↔ ∀ i ∈ s, IsCobounded (f i) := biInter_finset_mem s @[simp] theorem isCobounded_iInter [Finite ι] {f : ι → Set α} : IsCobounded (⋂ i, f i) ↔ ∀ i, IsCobounded (f i) := iInter_mem theorem isCobounded_sInter {S : Set (Set α)} (hs : S.Finite) : IsCobounded (⋂₀ S) ↔ ∀ s ∈ S, IsCobounded s := sInter_mem hs theorem isBounded_biUnion {s : Set ι} {f : ι → Set α} (hs : s.Finite) : IsBounded (⋃ i ∈ s, f i) ↔ ∀ i ∈ s, IsBounded (f i) := by simp only [← isCobounded_compl_iff, compl_iUnion, isCobounded_biInter hs] theorem isBounded_biUnion_finset (s : Finset ι) {f : ι → Set α} : IsBounded (⋃ i ∈ s, f i) ↔ ∀ i ∈ s, IsBounded (f i) := isBounded_biUnion s.finite_toSet theorem isBounded_sUnion {S : Set (Set α)} (hs : S.Finite) : IsBounded (⋃₀ S) ↔ ∀ s ∈ S, IsBounded s := by rw [sUnion_eq_biUnion, isBounded_biUnion hs] @[simp] theorem isBounded_iUnion [Finite ι] {s : ι → Set α} : IsBounded (⋃ i, s i) ↔ ∀ i, IsBounded (s i) := by rw [← sUnion_range, isBounded_sUnion (finite_range s), forall_mem_range] lemma eventually_ne_cobounded (a : α) : ∀ᶠ x in cobounded α, x ≠ a := le_cofinite_iff_eventually_ne.1 (le_cofinite _) a end Bornology open Bornology theorem Filter.HasBasis.disjoint_cobounded_iff [Bornology α] {ι : Sort*} {p : ι → Prop} {s : ι → Set α} {l : Filter α} (h : l.HasBasis p s) : Disjoint l (cobounded α) ↔ ∃ i, p i ∧ IsBounded (s i) := h.disjoint_iff_left theorem Set.Finite.isBounded [Bornology α] {s : Set α} (hs : s.Finite) : IsBounded s := Bornology.le_cofinite α hs.compl_mem_cofinite nonrec lemma Filter.Tendsto.eventually_ne_cobounded [Bornology α] {f : β → α} {l : Filter β} (h : Tendsto f l (cobounded α)) (a : α) : ∀ᶠ x in l, f x ≠ a := h.eventually <| eventually_ne_cobounded a instance : Bornology PUnit := ⟨⊥, bot_le⟩ /-- The cofinite filter as a bornology -/ abbrev Bornology.cofinite : Bornology α where cobounded' := Filter.cofinite le_cofinite' := le_rfl /-- A space with a `Bornology` is a **bounded space** if `Set.univ : Set α` is bounded. -/ class BoundedSpace (α : Type*) [Bornology α] : Prop where /-- The `Set.univ` is bounded. -/ bounded_univ : Bornology.IsBounded (univ : Set α) /-- A finite space is bounded. -/ instance (priority := 100) BoundedSpace.of_finite {α : Type*} [Bornology α] [Finite α] : BoundedSpace α where bounded_univ := (toFinite _).isBounded namespace Bornology variable [Bornology α] theorem isBounded_univ : IsBounded (univ : Set α) ↔ BoundedSpace α := ⟨fun h => ⟨h⟩, fun h => h.1⟩ theorem cobounded_eq_bot_iff : cobounded α = ⊥ ↔ BoundedSpace α := by rw [← isBounded_univ, isBounded_def, compl_univ, empty_mem_iff_bot] variable [BoundedSpace α] theorem IsBounded.all (s : Set α) : IsBounded s := BoundedSpace.bounded_univ.subset s.subset_univ theorem IsCobounded.all (s : Set α) : IsCobounded s := compl_compl s ▸ IsBounded.all sᶜ variable (α) @[simp] theorem cobounded_eq_bot : cobounded α = ⊥ := cobounded_eq_bot_iff.2 ‹_› end Bornology namespace OrderDual variable [Bornology α] instance instBornology : Bornology αᵒᵈ := ‹Bornology α› @[simp] lemma isCobounded_preimage_ofDual {s : Set α} : IsCobounded (ofDual ⁻¹' s) ↔ IsCobounded s := Iff.rfl @[simp] lemma isCobounded_preimage_toDual {s : Set αᵒᵈ} : IsCobounded (toDual ⁻¹' s) ↔ IsCobounded s := Iff.rfl @[simp] lemma isBounded_preimage_ofDual {s : Set α} : IsBounded (ofDual ⁻¹' s) ↔ IsBounded s := Iff.rfl @[simp] lemma isBounded_preimage_toDual {s : Set αᵒᵈ} : IsBounded (toDual ⁻¹' s) ↔ IsBounded s := Iff.rfl end OrderDual
Topology\Bornology\BoundedOperation.lean
/- Copyright (c) 2024 Kalle Kytölä. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kalle Kytölä -/ import Mathlib.Analysis.Normed.Group.Basic import Mathlib.Analysis.Normed.Field.Basic /-! # Bounded operations This file introduces type classes for bornologically bounded operations. In particular, when combined with type classes which guarantee continuity of the same operations, we can equip bounded continuous functions with the corresponding operations. ## Main definitions * `BoundedAdd R`: a class guaranteeing boundedness of addition. * `BoundedSub R`: a class guaranteeing boundedness of subtraction. * `BoundedMul R`: a class guaranteeing boundedness of multiplication. -/ open scoped NNReal section bounded_add /-! ### Bounded addition -/ open Pointwise /-- A typeclass saying that `(p : R × R) ↦ p.1 + p.2` maps any product of bounded sets to a bounded set. This property follows from `LipschitzAdd`, and thus automatically holds, e.g., for seminormed additive groups. -/ class BoundedAdd (R : Type*) [Bornology R] [Add R] : Prop where isBounded_add : ∀ {s t : Set R}, Bornology.IsBounded s → Bornology.IsBounded t → Bornology.IsBounded (s + t) variable {R : Type*} lemma isBounded_add [Bornology R] [Add R] [BoundedAdd R] {s t : Set R} (hs : Bornology.IsBounded s) (ht : Bornology.IsBounded t) : Bornology.IsBounded (s + t) := BoundedAdd.isBounded_add hs ht lemma add_bounded_of_bounded_of_bounded {X : Type*} [PseudoMetricSpace R] [Add R] [BoundedAdd R] {f g : X → R} (f_bdd : ∃ C, ∀ x y, dist (f x) (f y) ≤ C) (g_bdd : ∃ C, ∀ x y, dist (g x) (g y) ≤ C) : ∃ C, ∀ x y, dist ((f + g) x) ((f + g) y) ≤ C := by obtain ⟨C, hC⟩ := Metric.isBounded_iff.mp <| isBounded_add (Metric.isBounded_range_iff.mpr f_bdd) (Metric.isBounded_range_iff.mpr g_bdd) use C intro x y exact hC (Set.add_mem_add (Set.mem_range_self (f := f) x) (Set.mem_range_self (f := g) x)) (Set.add_mem_add (Set.mem_range_self (f := f) y) (Set.mem_range_self (f := g) y)) instance [PseudoMetricSpace R] [AddMonoid R] [LipschitzAdd R] : BoundedAdd R where isBounded_add {s t} s_bdd t_bdd := by have bdd : Bornology.IsBounded (s ×ˢ t) := Bornology.IsBounded.prod s_bdd t_bdd obtain ⟨C, add_lip⟩ := ‹LipschitzAdd R›.lipschitz_add convert add_lip.isBounded_image bdd ext p simp only [Set.mem_image, Set.mem_prod, Prod.exists] constructor · intro ⟨a, a_in_s, b, b_in_t, eq_p⟩ exact ⟨a, b, ⟨a_in_s, b_in_t⟩, eq_p⟩ · intro ⟨a, b, ⟨a_in_s, b_in_t⟩, eq_p⟩ simpa [← eq_p] using Set.add_mem_add a_in_s b_in_t end bounded_add section bounded_sub /-! ### Bounded subtraction -/ open Pointwise /-- A typeclass saying that `(p : R × R) ↦ p.1 - p.2` maps any product of bounded sets to a bounded set. This property automatically holds for seminormed additive groups, but it also holds, e.g., for `ℝ≥0`. -/ class BoundedSub (R : Type*) [Bornology R] [Sub R] : Prop where isBounded_sub : ∀ {s t : Set R}, Bornology.IsBounded s → Bornology.IsBounded t → Bornology.IsBounded (s - t) variable {R : Type*} lemma isBounded_sub [Bornology R] [Sub R] [BoundedSub R] {s t : Set R} (hs : Bornology.IsBounded s) (ht : Bornology.IsBounded t) : Bornology.IsBounded (s - t) := BoundedSub.isBounded_sub hs ht lemma sub_bounded_of_bounded_of_bounded {X : Type*} [PseudoMetricSpace R] [Sub R] [BoundedSub R] {f g : X → R} (f_bdd : ∃ C, ∀ x y, dist (f x) (f y) ≤ C) (g_bdd : ∃ C, ∀ x y, dist (g x) (g y) ≤ C) : ∃ C, ∀ x y, dist ((f - g) x) ((f - g) y) ≤ C := by obtain ⟨C, hC⟩ := Metric.isBounded_iff.mp <| isBounded_sub (Metric.isBounded_range_iff.mpr f_bdd) (Metric.isBounded_range_iff.mpr g_bdd) use C intro x y exact hC (Set.sub_mem_sub (Set.mem_range_self (f := f) x) (Set.mem_range_self (f := g) x)) (Set.sub_mem_sub (Set.mem_range_self (f := f) y) (Set.mem_range_self (f := g) y)) lemma boundedSub_of_lipschitzWith_sub [PseudoMetricSpace R] [Sub R] {K : NNReal} (lip : LipschitzWith K (fun (p : R × R) ↦ p.1 - p.2)) : BoundedSub R where isBounded_sub {s t} s_bdd t_bdd := by have bdd : Bornology.IsBounded (s ×ˢ t) := Bornology.IsBounded.prod s_bdd t_bdd convert lip.isBounded_image bdd ext p simp only [Set.mem_image, Set.mem_prod, Prod.exists] constructor · intro ⟨a, a_in_s, b, b_in_t, eq_p⟩ exact ⟨a, b, ⟨a_in_s, b_in_t⟩, eq_p⟩ · intro ⟨a, b, ⟨a_in_s, b_in_t⟩, eq_p⟩ simpa [← eq_p] using Set.sub_mem_sub a_in_s b_in_t end bounded_sub section bounded_mul /-! ### Bounded multiplication -/ open Pointwise Set /-- A typeclass saying that `(p : R × R) ↦ p.1 * p.2` maps any product of bounded sets to a bounded set. This property automatically holds for non-unital seminormed rings, but it also holds, e.g., for `ℝ≥0`. -/ class BoundedMul (R : Type*) [Bornology R] [Mul R] : Prop where isBounded_mul : ∀ {s t : Set R}, Bornology.IsBounded s → Bornology.IsBounded t → Bornology.IsBounded (s * t) variable {R : Type*} lemma isBounded_mul [Bornology R] [Mul R] [BoundedMul R] {s t : Set R} (hs : Bornology.IsBounded s) (ht : Bornology.IsBounded t) : Bornology.IsBounded (s * t) := BoundedMul.isBounded_mul hs ht lemma isBounded_pow {R : Type*} [Bornology R] [Monoid R] [BoundedMul R] {s : Set R} (s_bdd : Bornology.IsBounded s) (n : ℕ) : Bornology.IsBounded ((fun x ↦ x ^ n) '' s) := by induction' n with n hn · by_cases s_empty : s = ∅ · simp [s_empty] simp_rw [← nonempty_iff_ne_empty] at s_empty simp [s_empty] · have obs : ((fun x ↦ x ^ (n + 1)) '' s) ⊆ ((fun x ↦ x ^ n) '' s) * s := by intro x hx simp only [mem_image] at hx obtain ⟨y, y_in_s, ypow_eq_x⟩ := hx rw [← ypow_eq_x, pow_succ y n] apply Set.mul_mem_mul _ y_in_s use y exact (isBounded_mul hn s_bdd).subset obs lemma mul_bounded_of_bounded_of_bounded {X : Type*} [PseudoMetricSpace R] [Mul R] [BoundedMul R] {f g : X → R} (f_bdd : ∃ C, ∀ x y, dist (f x) (f y) ≤ C) (g_bdd : ∃ C, ∀ x y, dist (g x) (g y) ≤ C) : ∃ C, ∀ x y, dist ((f * g) x) ((f * g) y) ≤ C := by obtain ⟨C, hC⟩ := Metric.isBounded_iff.mp <| isBounded_mul (Metric.isBounded_range_iff.mpr f_bdd) (Metric.isBounded_range_iff.mpr g_bdd) use C intro x y exact hC (Set.mul_mem_mul (Set.mem_range_self (f := f) x) (Set.mem_range_self (f := g) x)) (Set.mul_mem_mul (Set.mem_range_self (f := f) y) (Set.mem_range_self (f := g) y)) end bounded_mul section SeminormedAddCommGroup /-! ### Bounded operations in seminormed additive commutative groups -/ variable {R : Type*} [SeminormedAddCommGroup R] lemma SeminormedAddCommGroup.lipschitzWith_sub : LipschitzWith 2 (fun (p : R × R) ↦ p.1 - p.2) := by convert LipschitzWith.prod_fst.sub LipschitzWith.prod_snd norm_num instance : BoundedSub R := boundedSub_of_lipschitzWith_sub SeminormedAddCommGroup.lipschitzWith_sub end SeminormedAddCommGroup section NonUnitalSeminormedRing /-! ### Bounded operations in non-unital seminormed rings -/ variable {R : Type*} [NonUnitalSeminormedRing R] instance : BoundedMul R where isBounded_mul {s t} hs ht := by obtain ⟨Af, hAf⟩ := (Metric.isBounded_iff_subset_closedBall 0).mp hs obtain ⟨Ag, hAg⟩ := (Metric.isBounded_iff_subset_closedBall 0).mp ht rw [Metric.isBounded_iff] at hs ht ⊢ use 2 * Af * Ag intro z hz w hw obtain ⟨x₁, hx₁, y₁, hy₁, z_eq⟩ := Set.mem_mul.mp hz obtain ⟨x₂, hx₂, y₂, hy₂, w_eq⟩ := Set.mem_mul.mp hw rw [← w_eq, ← z_eq, dist_eq_norm] have hAf' : 0 ≤ Af := Metric.nonempty_closedBall.mp ⟨_, hAf hx₁⟩ have aux : ∀ {x y}, x ∈ s → y ∈ t → ‖x * y‖ ≤ Af * Ag := by intro x y x_in_s y_in_t apply (norm_mul_le _ _).trans (mul_le_mul _ _ (norm_nonneg _) hAf') · exact mem_closedBall_zero_iff.mp (hAf x_in_s) · exact mem_closedBall_zero_iff.mp (hAg y_in_t) calc ‖x₁ * y₁ - x₂ * y₂‖ _ ≤ ‖x₁ * y₁‖ + ‖x₂ * y₂‖ := norm_sub_le _ _ _ ≤ Af * Ag + Af * Ag := add_le_add (aux hx₁ hy₁) (aux hx₂ hy₂) _ = 2 * Af * Ag := by simp [← two_mul, mul_assoc] end NonUnitalSeminormedRing section NNReal /-! ### Bounded operations in ℝ≥0 -/ instance : BoundedSub ℝ≥0 := boundedSub_of_lipschitzWith_sub NNReal.lipschitzWith_sub open Metric in instance : BoundedMul ℝ≥0 where isBounded_mul {s t} hs ht := by obtain ⟨Af, hAf⟩ := (isBounded_iff_subset_closedBall 0).mp hs obtain ⟨Ag, hAg⟩ := (isBounded_iff_subset_closedBall 0).mp ht have key : IsCompact (closedBall (0 : ℝ≥0) Af ×ˢ closedBall (0 : ℝ≥0) Ag) := IsCompact.prod (isCompact_closedBall _ _) (isCompact_closedBall _ _) apply Bornology.IsBounded.subset (key.image continuous_mul).isBounded intro _ ⟨x, x_in_s, y, y_in_t, xy_eq⟩ exact ⟨⟨x, y⟩, by simpa only [Set.mem_prod] using ⟨⟨hAf x_in_s, hAg y_in_t⟩, xy_eq⟩⟩ end NNReal
Topology\Bornology\Constructions.lean
/- Copyright (c) 2022 Yury G. Kudryashov. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yury G. Kudryashov -/ import Mathlib.Topology.Bornology.Basic /-! # Bornology structure on products and subtypes In this file we define `Bornology` and `BoundedSpace` instances on `α × β`, `Π i, π i`, and `{x // p x}`. We also prove basic lemmas about `Bornology.cobounded` and `Bornology.IsBounded` on these types. -/ open Set Filter Bornology Function open Filter variable {α β ι : Type*} {π : ι → Type*} [Bornology α] [Bornology β] [∀ i, Bornology (π i)] instance Prod.instBornology : Bornology (α × β) where cobounded' := (cobounded α).coprod (cobounded β) le_cofinite' := @coprod_cofinite α β ▸ coprod_mono ‹Bornology α›.le_cofinite ‹Bornology β›.le_cofinite instance Pi.instBornology : Bornology (∀ i, π i) where cobounded' := Filter.coprodᵢ fun i => cobounded (π i) le_cofinite' := iSup_le fun _ ↦ (comap_mono (Bornology.le_cofinite _)).trans (comap_cofinite_le _) /-- Inverse image of a bornology. -/ abbrev Bornology.induced {α β : Type*} [Bornology β] (f : α → β) : Bornology α where cobounded' := comap f (cobounded β) le_cofinite' := (comap_mono (Bornology.le_cofinite β)).trans (comap_cofinite_le _) instance {p : α → Prop} : Bornology (Subtype p) := Bornology.induced (Subtype.val : Subtype p → α) namespace Bornology /-! ### Bounded sets in `α × β` -/ theorem cobounded_prod : cobounded (α × β) = (cobounded α).coprod (cobounded β) := rfl theorem isBounded_image_fst_and_snd {s : Set (α × β)} : IsBounded (Prod.fst '' s) ∧ IsBounded (Prod.snd '' s) ↔ IsBounded s := compl_mem_coprod.symm lemma IsBounded.image_fst {s : Set (α × β)} (hs : IsBounded s) : IsBounded (Prod.fst '' s) := (isBounded_image_fst_and_snd.2 hs).1 lemma IsBounded.image_snd {s : Set (α × β)} (hs : IsBounded s) : IsBounded (Prod.snd '' s) := (isBounded_image_fst_and_snd.2 hs).2 variable {s : Set α} {t : Set β} {S : ∀ i, Set (π i)} theorem IsBounded.fst_of_prod (h : IsBounded (s ×ˢ t)) (ht : t.Nonempty) : IsBounded s := fst_image_prod s ht ▸ h.image_fst theorem IsBounded.snd_of_prod (h : IsBounded (s ×ˢ t)) (hs : s.Nonempty) : IsBounded t := snd_image_prod hs t ▸ h.image_snd theorem IsBounded.prod (hs : IsBounded s) (ht : IsBounded t) : IsBounded (s ×ˢ t) := isBounded_image_fst_and_snd.1 ⟨hs.subset <| fst_image_prod_subset _ _, ht.subset <| snd_image_prod_subset _ _⟩ theorem isBounded_prod_of_nonempty (hne : Set.Nonempty (s ×ˢ t)) : IsBounded (s ×ˢ t) ↔ IsBounded s ∧ IsBounded t := ⟨fun h => ⟨h.fst_of_prod hne.snd, h.snd_of_prod hne.fst⟩, fun h => h.1.prod h.2⟩ theorem isBounded_prod : IsBounded (s ×ˢ t) ↔ s = ∅ ∨ t = ∅ ∨ IsBounded s ∧ IsBounded t := by rcases s.eq_empty_or_nonempty with (rfl | hs); · simp rcases t.eq_empty_or_nonempty with (rfl | ht); · simp simp only [hs.ne_empty, ht.ne_empty, isBounded_prod_of_nonempty (hs.prod ht), false_or_iff] theorem isBounded_prod_self : IsBounded (s ×ˢ s) ↔ IsBounded s := by rcases s.eq_empty_or_nonempty with (rfl | hs); · simp exact (isBounded_prod_of_nonempty (hs.prod hs)).trans and_self_iff /-! ### Bounded sets in `Π i, π i` -/ theorem cobounded_pi : cobounded (∀ i, π i) = Filter.coprodᵢ fun i => cobounded (π i) := rfl theorem forall_isBounded_image_eval_iff {s : Set (∀ i, π i)} : (∀ i, IsBounded (eval i '' s)) ↔ IsBounded s := compl_mem_coprodᵢ.symm lemma IsBounded.image_eval {s : Set (∀ i, π i)} (hs : IsBounded s) (i : ι) : IsBounded (eval i '' s) := forall_isBounded_image_eval_iff.2 hs i theorem IsBounded.pi (h : ∀ i, IsBounded (S i)) : IsBounded (pi univ S) := forall_isBounded_image_eval_iff.1 fun i => (h i).subset eval_image_univ_pi_subset theorem isBounded_pi_of_nonempty (hne : (pi univ S).Nonempty) : IsBounded (pi univ S) ↔ ∀ i, IsBounded (S i) := ⟨fun H i => @eval_image_univ_pi _ _ _ i hne ▸ forall_isBounded_image_eval_iff.2 H i, IsBounded.pi⟩ theorem isBounded_pi : IsBounded (pi univ S) ↔ (∃ i, S i = ∅) ∨ ∀ i, IsBounded (S i) := by by_cases hne : ∃ i, S i = ∅ · simp [hne, univ_pi_eq_empty_iff.2 hne] · simp only [hne, false_or_iff] simp only [not_exists, ← Ne.eq_def, ← nonempty_iff_ne_empty, ← univ_pi_nonempty_iff] at hne exact isBounded_pi_of_nonempty hne /-! ### Bounded sets in `{x // p x}` -/ theorem isBounded_induced {α β : Type*} [Bornology β] {f : α → β} {s : Set α} : @IsBounded α (Bornology.induced f) s ↔ IsBounded (f '' s) := compl_mem_comap theorem isBounded_image_subtype_val {p : α → Prop} {s : Set { x // p x }} : IsBounded (Subtype.val '' s) ↔ IsBounded s := isBounded_induced.symm end Bornology /-! ### Bounded spaces -/ open Bornology instance [BoundedSpace α] [BoundedSpace β] : BoundedSpace (α × β) := by simp [← cobounded_eq_bot_iff, cobounded_prod] instance [∀ i, BoundedSpace (π i)] : BoundedSpace (∀ i, π i) := by simp [← cobounded_eq_bot_iff, cobounded_pi] theorem boundedSpace_induced_iff {α β : Type*} [Bornology β] {f : α → β} : @BoundedSpace α (Bornology.induced f) ↔ IsBounded (range f) := by rw [← @isBounded_univ _ (Bornology.induced f), isBounded_induced, image_univ] -- Porting note: had to explicitly provided the bornology to `isBounded_univ`. theorem boundedSpace_subtype_iff {p : α → Prop} : BoundedSpace (Subtype p) ↔ IsBounded { x | p x } := by rw [boundedSpace_induced_iff, Subtype.range_coe_subtype] theorem boundedSpace_val_set_iff {s : Set α} : BoundedSpace s ↔ IsBounded s := boundedSpace_subtype_iff alias ⟨_, Bornology.IsBounded.boundedSpace_subtype⟩ := boundedSpace_subtype_iff alias ⟨_, Bornology.IsBounded.boundedSpace_val⟩ := boundedSpace_val_set_iff instance [BoundedSpace α] {p : α → Prop} : BoundedSpace (Subtype p) := (IsBounded.all { x | p x }).boundedSpace_subtype /-! ### `Additive`, `Multiplicative` The bornology on those type synonyms is inherited without change. -/ instance : Bornology (Additive α) := ‹Bornology α› instance : Bornology (Multiplicative α) := ‹Bornology α› instance [BoundedSpace α] : BoundedSpace (Additive α) := ‹BoundedSpace α› instance [BoundedSpace α] : BoundedSpace (Multiplicative α) := ‹BoundedSpace α› /-! ### Order dual The bornology on this type synonym is inherited without change. -/ instance : Bornology αᵒᵈ := ‹Bornology α› instance [BoundedSpace α] : BoundedSpace αᵒᵈ := ‹BoundedSpace α›
Topology\Bornology\Hom.lean
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies -/ import Mathlib.Topology.Bornology.Basic /-! # Locally bounded maps This file defines locally bounded maps between bornologies. We use the `DFunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `LocallyBoundedMap`: Locally bounded maps. Maps which preserve boundedness. ## Typeclasses * `LocallyBoundedMapClass` -/ open Bornology Filter Function Set variable {F α β γ δ : Type*} /-- The type of bounded maps from `α` to `β`, the maps which send a bounded set to a bounded set. -/ structure LocallyBoundedMap (α β : Type*) [Bornology α] [Bornology β] where /-- The function underlying a locally bounded map -/ toFun : α → β /-- The pullback of the `Bornology.cobounded` filter under the function is contained in the cobounded filter. Equivalently, the function maps bounded sets to bounded sets. -/ comap_cobounded_le' : (cobounded β).comap toFun ≤ cobounded α section /-- `LocallyBoundedMapClass F α β` states that `F` is a type of bounded maps. You should extend this class when you extend `LocallyBoundedMap`. -/ class LocallyBoundedMapClass (F : Type*) (α β : outParam Type*) [Bornology α] [Bornology β] [FunLike F α β] : Prop where /-- The pullback of the `Bornology.cobounded` filter under the function is contained in the cobounded filter. Equivalently, the function maps bounded sets to bounded sets. -/ comap_cobounded_le (f : F) : (cobounded β).comap f ≤ cobounded α end export LocallyBoundedMapClass (comap_cobounded_le) variable [FunLike F α β] theorem Bornology.IsBounded.image [Bornology α] [Bornology β] [LocallyBoundedMapClass F α β] (f : F) {s : Set α} (hs : IsBounded s) : IsBounded (f '' s) := comap_cobounded_le_iff.1 (comap_cobounded_le f) hs /-- Turn an element of a type `F` satisfying `LocallyBoundedMapClass F α β` into an actual `LocallyBoundedMap`. This is declared as the default coercion from `F` to `LocallyBoundedMap α β`. -/ @[coe] def LocallyBoundedMapClass.toLocallyBoundedMap [Bornology α] [Bornology β] [LocallyBoundedMapClass F α β] (f : F) : LocallyBoundedMap α β where toFun := f comap_cobounded_le' := comap_cobounded_le f instance [Bornology α] [Bornology β] [LocallyBoundedMapClass F α β] : CoeTC F (LocallyBoundedMap α β) := ⟨fun f => ⟨f, comap_cobounded_le f⟩⟩ namespace LocallyBoundedMap variable [Bornology α] [Bornology β] [Bornology γ] [Bornology δ] instance : FunLike (LocallyBoundedMap α β) α β where coe f := f.toFun coe_injective' f g h := by cases f cases g congr instance : LocallyBoundedMapClass (LocallyBoundedMap α β) α β where comap_cobounded_le f := f.comap_cobounded_le' -- Porting note: syntactic tautology because of the way coercions work @[ext] theorem ext {f g : LocallyBoundedMap α β} (h : ∀ a, f a = g a) : f = g := DFunLike.ext f g h /-- Copy of a `LocallyBoundedMap` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : LocallyBoundedMap α β) (f' : α → β) (h : f' = f) : LocallyBoundedMap α β := ⟨f', h.symm ▸ f.comap_cobounded_le'⟩ @[simp] theorem coe_copy (f : LocallyBoundedMap α β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl theorem copy_eq (f : LocallyBoundedMap α β) (f' : α → β) (h : f' = f) : f.copy f' h = f := DFunLike.ext' h /-- Construct a `LocallyBoundedMap` from the fact that the function maps bounded sets to bounded sets. -/ def ofMapBounded (f : α → β) (h : ∀ ⦃s : Set α⦄, IsBounded s → IsBounded (f '' s)) : LocallyBoundedMap α β := ⟨f, comap_cobounded_le_iff.2 h⟩ -- Porting note: I had to provide the type of `h` explicitly. @[simp] theorem coe_ofMapBounded (f : α → β) {h} : ⇑(ofMapBounded f h) = f := rfl @[simp] theorem ofMapBounded_apply (f : α → β) {h} (a : α) : ofMapBounded f h a = f a := rfl variable (α) /-- `id` as a `LocallyBoundedMap`. -/ protected def id : LocallyBoundedMap α α := ⟨id, comap_id.le⟩ instance : Inhabited (LocallyBoundedMap α α) := ⟨LocallyBoundedMap.id α⟩ @[simp] theorem coe_id : ⇑(LocallyBoundedMap.id α) = id := rfl variable {α} @[simp] theorem id_apply (a : α) : LocallyBoundedMap.id α a = a := rfl /-- Composition of `LocallyBoundedMap`s as a `LocallyBoundedMap`. -/ def comp (f : LocallyBoundedMap β γ) (g : LocallyBoundedMap α β) : LocallyBoundedMap α γ where toFun := f ∘ g comap_cobounded_le' := comap_comap.ge.trans <| (comap_mono f.comap_cobounded_le').trans g.comap_cobounded_le' @[simp] theorem coe_comp (f : LocallyBoundedMap β γ) (g : LocallyBoundedMap α β) : ⇑(f.comp g) = f ∘ g := rfl @[simp] theorem comp_apply (f : LocallyBoundedMap β γ) (g : LocallyBoundedMap α β) (a : α) : f.comp g a = f (g a) := rfl @[simp] theorem comp_assoc (f : LocallyBoundedMap γ δ) (g : LocallyBoundedMap β γ) (h : LocallyBoundedMap α β) : (f.comp g).comp h = f.comp (g.comp h) := rfl @[simp] theorem comp_id (f : LocallyBoundedMap α β) : f.comp (LocallyBoundedMap.id α) = f := ext fun _ => rfl @[simp] theorem id_comp (f : LocallyBoundedMap α β) : (LocallyBoundedMap.id β).comp f = f := ext fun _ => rfl @[simp] theorem cancel_right {g₁ g₂ : LocallyBoundedMap β γ} {f : LocallyBoundedMap α β} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h => ext <| hf.forall.2 <| DFunLike.ext_iff.1 h, congrArg (comp · _)⟩ @[simp] theorem cancel_left {g : LocallyBoundedMap β γ} {f₁ f₂ : LocallyBoundedMap α β} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h => ext fun a => hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ end LocallyBoundedMap
Topology\Category\Born.lean
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies -/ import Mathlib.CategoryTheory.ConcreteCategory.BundledHom import Mathlib.Topology.Bornology.Hom /-! # The category of bornologies This defines `Born`, the category of bornologies. -/ universe u open CategoryTheory /-- The category of bornologies. -/ def Born := Bundled Bornology namespace Born instance : CoeSort Born Type* := Bundled.coeSort instance (X : Born) : Bornology X := X.str /-- Construct a bundled `Born` from a `Bornology`. -/ def of (α : Type*) [Bornology α] : Born := Bundled.of α instance : Inhabited Born := ⟨of PUnit⟩ instance : BundledHom @LocallyBoundedMap where id := @LocallyBoundedMap.id comp := @LocallyBoundedMap.comp hom_ext _ _ := DFunLike.coe_injective instance : LargeCategory.{u} Born := BundledHom.category LocallyBoundedMap instance : ConcreteCategory Born := BundledHom.concreteCategory LocallyBoundedMap end Born
Topology\Category\CompactlyGenerated.lean
/- Copyright (c) 2024 Dagur Asgeirsson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Dagur Asgeirsson -/ import Mathlib.Topology.Compactness.CompactlyGeneratedSpace import Mathlib.CategoryTheory.Elementwise /-! # Compactly generated topological spaces This file defines the category of compactly generated topological spaces. These are spaces `X` such that a map `f : X → Y` is continuous whenever the composition `S → X → Y` is continuous for all compact Hausdorff spaces `S` mapping continuously to `X`. ## TODO * `CompactlyGenerated` is a reflective subcategory of `TopCat`. * `CompactlyGenerated` is cartesian closed. * Every first-countable space is `u`-compactly generated for every universe `u`. -/ attribute [local instance] CategoryTheory.ConcreteCategory.instFunLike universe u w open CategoryTheory Topology TopologicalSpace /-- The type of `u`-compactly generated `w`-small topological spaces. -/ structure CompactlyGenerated where /-- The underlying topological space of an object of `CompactlyGenerated`. -/ toTop : TopCat.{w} /-- The underlying topological space is compactly generated. -/ [is_compactly_generated : UCompactlyGeneratedSpace.{u} toTop] namespace CompactlyGenerated instance : Inhabited CompactlyGenerated.{u, w} := ⟨{ toTop := { α := ULift (Fin 37) } }⟩ instance : CoeSort CompactlyGenerated Type* := ⟨fun X => X.toTop⟩ attribute [instance] is_compactly_generated instance : Category.{w, w+1} CompactlyGenerated.{u, w} := InducedCategory.category toTop instance : ConcreteCategory.{w} CompactlyGenerated.{u, w} := InducedCategory.concreteCategory _ variable (X : Type w) [TopologicalSpace X] [UCompactlyGeneratedSpace.{u} X] /-- Constructor for objects of the category `CompactlyGenerated`. -/ def of : CompactlyGenerated.{u, w} where toTop := TopCat.of X is_compactly_generated := ‹_› /-- The fully faithful embedding of `CompactlyGenerated` in `TopCat`. -/ @[simps!] def compactlyGeneratedToTop : CompactlyGenerated.{u, w} ⥤ TopCat.{w} := inducedFunctor _ /-- `compactlyGeneratedToTop` is fully faithful. -/ def fullyFaithfulCompactlyGeneratedToTop : compactlyGeneratedToTop.{u, w}.FullyFaithful := fullyFaithfulInducedFunctor _ instance : compactlyGeneratedToTop.{u, w}.Full := fullyFaithfulCompactlyGeneratedToTop.full instance : compactlyGeneratedToTop.{u, w}.Faithful := fullyFaithfulCompactlyGeneratedToTop.faithful /-- Construct an isomorphism from a homeomorphism. -/ @[simps hom inv] def isoOfHomeo {X Y : CompactlyGenerated.{u, w}} (f : X ≃ₜ Y) : X ≅ Y where hom := ⟨f, f.continuous⟩ inv := ⟨f.symm, f.symm.continuous⟩ hom_inv_id := by ext x exact f.symm_apply_apply x inv_hom_id := by ext x exact f.apply_symm_apply x /-- Construct a homeomorphism from an isomorphism. -/ @[simps] def homeoOfIso {X Y : CompactlyGenerated.{u, w}} (f : X ≅ Y) : X ≃ₜ Y where toFun := f.hom invFun := f.inv left_inv x := by simp right_inv x := by simp continuous_toFun := f.hom.continuous continuous_invFun := f.inv.continuous /-- The equivalence between isomorphisms in `CompactlyGenerated` and homeomorphisms of topological spaces. -/ @[simps] def isoEquivHomeo {X Y : CompactlyGenerated.{u, w}} : (X ≅ Y) ≃ (X ≃ₜ Y) where toFun := homeoOfIso invFun := isoOfHomeo left_inv f := by ext rfl right_inv f := by ext rfl end CompactlyGenerated
Topology\Category\Compactum.lean
/- Copyright (c) 2020 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Monad.Types import Mathlib.CategoryTheory.Monad.Limits import Mathlib.CategoryTheory.Equivalence import Mathlib.Topology.Category.CompHaus.Basic import Mathlib.Topology.Category.Profinite.Basic import Mathlib.Data.Set.Constructions /-! # Compacta and Compact Hausdorff Spaces Recall that, given a monad `M` on `Type*`, an *algebra* for `M` consists of the following data: - A type `X : Type*` - A "structure" map `M X → X`. This data must also satisfy a distributivity and unit axiom, and algebras for `M` form a category in an evident way. See the file `CategoryTheory.Monad.Algebra` for a general version, as well as the following link. https://ncatlab.org/nlab/show/monad This file proves the equivalence between the category of *compact Hausdorff topological spaces* and the category of algebras for the *ultrafilter monad*. ## Notation: Here are the main objects introduced in this file. - `Compactum` is the type of compacta, which we define as algebras for the ultrafilter monad. - `compactumToCompHaus` is the functor `Compactum ⥤ CompHaus`. Here `CompHaus` is the usual category of compact Hausdorff spaces. - `compactumToCompHaus.isEquivalence` is a term of type `IsEquivalence compactumToCompHaus`. The proof of this equivalence is a bit technical. But the idea is quite simply that the structure map `Ultrafilter X → X` for an algebra `X` of the ultrafilter monad should be considered as the map sending an ultrafilter to its limit in `X`. The topology on `X` is then defined by mimicking the characterization of open sets in terms of ultrafilters. Any `X : Compactum` is endowed with a coercion to `Type*`, as well as the following instances: - `TopologicalSpace X`. - `CompactSpace X`. - `T2Space X`. Any morphism `f : X ⟶ Y` of is endowed with a coercion to a function `X → Y`, which is shown to be continuous in `continuous_of_hom`. The function `Compactum.ofTopologicalSpace` can be used to construct a `Compactum` from a topological space which satisfies `CompactSpace` and `T2Space`. We also add wrappers around structures which already exist. Here are the main ones, all in the `Compactum` namespace: - `forget : Compactum ⥤ Type*` is the forgetful functor, which induces a `ConcreteCategory` instance for `Compactum`. - `free : Type* ⥤ Compactum` is the left adjoint to `forget`, and the adjunction is in `adj`. - `str : Ultrafilter X → X` is the structure map for `X : Compactum`. The notation `X.str` is preferred. - `join : Ultrafilter (Ultrafilter X) → Ultrafilter X` is the monadic join for `X : Compactum`. Again, the notation `X.join` is preferred. - `incl : X → Ultrafilter X` is the unit for `X : Compactum`. The notation `X.incl` is preferred. ## References - E. Manes, Algebraic Theories, Graduate Texts in Mathematics 26, Springer-Verlag, 1976. - https://ncatlab.org/nlab/show/ultrafilter -/ universe u open CategoryTheory Filter Ultrafilter TopologicalSpace CategoryTheory.Limits FiniteInter open scoped Classical open Topology local notation "β" => ofTypeMonad Ultrafilter /-- The type `Compactum` of Compacta, defined as algebras for the ultrafilter monad. -/ def Compactum := Monad.Algebra β deriving Category, Inhabited namespace Compactum /-- The forgetful functor to Type* -/ def forget : Compactum ⥤ Type* := Monad.forget _ --deriving CreatesLimits, Faithful -- Porting note: deriving fails, adding manually. Note `CreatesLimits` now noncomputable instance : forget.Faithful := show (Monad.forget _).Faithful from inferInstance noncomputable instance : CreatesLimits forget := show CreatesLimits <| Monad.forget _ from inferInstance /-- The "free" Compactum functor. -/ def free : Type* ⥤ Compactum := Monad.free _ /-- The adjunction between `free` and `forget`. -/ def adj : free ⊣ forget := Monad.adj _ -- Basic instances instance : ConcreteCategory Compactum where forget := forget -- Porting note: changed from forget to X.A instance : CoeSort Compactum Type* := ⟨fun X => X.A⟩ instance {X Y : Compactum} : CoeFun (X ⟶ Y) fun _ => X → Y := ⟨fun f => f.f⟩ instance : HasLimits Compactum := hasLimits_of_hasLimits_createsLimits forget /-- The structure map for a compactum, essentially sending an ultrafilter to its limit. -/ def str (X : Compactum) : Ultrafilter X → X := X.a /-- The monadic join. -/ def join (X : Compactum) : Ultrafilter (Ultrafilter X) → Ultrafilter X := (β ).μ.app _ /-- The inclusion of `X` into `Ultrafilter X`. -/ def incl (X : Compactum) : X → Ultrafilter X := (β ).η.app _ @[simp] theorem str_incl (X : Compactum) (x : X) : X.str (X.incl x) = x := by change ((β ).η.app _ ≫ X.a) _ = _ rw [Monad.Algebra.unit] rfl @[simp] theorem str_hom_commute (X Y : Compactum) (f : X ⟶ Y) (xs : Ultrafilter X) : f (X.str xs) = Y.str (map f xs) := by change (X.a ≫ f.f) _ = _ rw [← f.h] rfl @[simp] theorem join_distrib (X : Compactum) (uux : Ultrafilter (Ultrafilter X)) : X.str (X.join uux) = X.str (map X.str uux) := by change ((β ).μ.app _ ≫ X.a) _ = _ rw [Monad.Algebra.assoc] rfl -- Porting note: changes to X.A from X since Lean can't see through X to X.A below instance {X : Compactum} : TopologicalSpace X.A where IsOpen U := ∀ F : Ultrafilter X, X.str F ∈ U → U ∈ F isOpen_univ _ _ := Filter.univ_sets _ isOpen_inter _ _ h3 h4 _ h6 := Filter.inter_sets _ (h3 _ h6.1) (h4 _ h6.2) isOpen_sUnion := fun _ h1 _ ⟨T, hT, h2⟩ => mem_of_superset (h1 T hT _ h2) (Set.subset_sUnion_of_mem hT) theorem isClosed_iff {X : Compactum} (S : Set X) : IsClosed S ↔ ∀ F : Ultrafilter X, S ∈ F → X.str F ∈ S := by rw [← isOpen_compl_iff] constructor · intro cond F h by_contra c specialize cond F c rw [compl_mem_iff_not_mem] at cond contradiction · intro h1 F h2 specialize h1 F cases' F.mem_or_compl_mem S with h h exacts [absurd (h1 h) h2, h] instance {X : Compactum} : CompactSpace X := by constructor rw [isCompact_iff_ultrafilter_le_nhds] intro F _ refine ⟨X.str F, by tauto, ?_⟩ rw [le_nhds_iff] intro S h1 h2 exact h2 F h1 /-- A local definition used only in the proofs. -/ private def basic {X : Compactum} (A : Set X) : Set (Ultrafilter X) := { F | A ∈ F } /-- A local definition used only in the proofs. -/ private def cl {X : Compactum} (A : Set X) : Set X := X.str '' basic A private theorem basic_inter {X : Compactum} (A B : Set X) : basic (A ∩ B) = basic A ∩ basic B := by ext G constructor · intro hG constructor <;> filter_upwards [hG] with _ exacts [And.left, And.right] · rintro ⟨h1, h2⟩ exact inter_mem h1 h2 private theorem subset_cl {X : Compactum} (A : Set X) : A ⊆ cl A := fun a ha => ⟨X.incl a, ha, by simp⟩ private theorem cl_cl {X : Compactum} (A : Set X) : cl (cl A) ⊆ cl A := by rintro _ ⟨F, hF, rfl⟩ -- Notation to be used in this proof. let fsu := Finset (Set (Ultrafilter X)) let ssu := Set (Set (Ultrafilter X)) let ι : fsu → ssu := fun x ↦ ↑x let C0 : ssu := { Z | ∃ B ∈ F, X.str ⁻¹' B = Z } let AA := { G : Ultrafilter X | A ∈ G } let C1 := insert AA C0 let C2 := finiteInterClosure C1 -- C0 is closed under intersections. have claim1 : ∀ (B) (_ : B ∈ C0) (C) (_ : C ∈ C0), B ∩ C ∈ C0 := by rintro B ⟨Q, hQ, rfl⟩ C ⟨R, hR, rfl⟩ use Q ∩ R simp only [and_true_iff, eq_self_iff_true, Set.preimage_inter] exact inter_sets _ hQ hR -- All sets in C0 are nonempty. have claim2 : ∀ B ∈ C0, Set.Nonempty B := by rintro B ⟨Q, hQ, rfl⟩ obtain ⟨q⟩ := Filter.nonempty_of_mem hQ use X.incl q simpa -- The intersection of AA with every set in C0 is nonempty. have claim3 : ∀ B ∈ C0, (AA ∩ B).Nonempty := by rintro B ⟨Q, hQ, rfl⟩ have : (Q ∩ cl A).Nonempty := Filter.nonempty_of_mem (inter_mem hQ hF) rcases this with ⟨q, hq1, P, hq2, hq3⟩ refine ⟨P, hq2, ?_⟩ rw [← hq3] at hq1 simpa -- Suffices to show that the intersection of any finite subcollection of C1 is nonempty. suffices ∀ T : fsu, ι T ⊆ C1 → (⋂₀ ι T).Nonempty by obtain ⟨G, h1⟩ := exists_ultrafilter_of_finite_inter_nonempty _ this use X.join G have : G.map X.str = F := Ultrafilter.coe_le_coe.1 fun S hS => h1 (Or.inr ⟨S, hS, rfl⟩) rw [join_distrib, this] exact ⟨h1 (Or.inl rfl), rfl⟩ -- C2 is closed under finite intersections (by construction!). have claim4 := finiteInterClosure_finiteInter C1 -- C0 is closed under finite intersections by claim1. have claim5 : FiniteInter C0 := ⟨⟨_, univ_mem, Set.preimage_univ⟩, claim1⟩ -- Every element of C2 is nonempty. have claim6 : ∀ P ∈ C2, (P : Set (Ultrafilter X)).Nonempty := by suffices ∀ P ∈ C2, P ∈ C0 ∨ ∃ Q ∈ C0, P = AA ∩ Q by intro P hP cases' this P hP with h h · exact claim2 _ h · rcases h with ⟨Q, hQ, rfl⟩ exact claim3 _ hQ intro P hP exact claim5.finiteInterClosure_insert _ hP intro T hT -- Suffices to show that the intersection of the T's is contained in C2. suffices ⋂₀ ι T ∈ C2 by exact claim6 _ this -- Finish apply claim4.finiteInter_mem T intro t ht exact finiteInterClosure.basic (@hT t ht) theorem isClosed_cl {X : Compactum} (A : Set X) : IsClosed (cl A) := by rw [isClosed_iff] intro F hF exact cl_cl _ ⟨F, hF, rfl⟩ theorem str_eq_of_le_nhds {X : Compactum} (F : Ultrafilter X) (x : X) : ↑F ≤ 𝓝 x → X.str F = x := by -- Notation to be used in this proof. let fsu := Finset (Set (Ultrafilter X)) let ssu := Set (Set (Ultrafilter X)) let ι : fsu → ssu := fun x ↦ ↑x let T0 : ssu := { S | ∃ A ∈ F, S = basic A } let AA := X.str ⁻¹' {x} let T1 := insert AA T0 let T2 := finiteInterClosure T1 intro cond -- If F contains a closed set A, then x is contained in A. have claim1 : ∀ A : Set X, IsClosed A → A ∈ F → x ∈ A := by intro A hA h by_contra H rw [le_nhds_iff] at cond specialize cond Aᶜ H hA.isOpen_compl rw [Ultrafilter.mem_coe, Ultrafilter.compl_mem_iff_not_mem] at cond contradiction -- If A ∈ F, then x ∈ cl A. have claim2 : ∀ A : Set X, A ∈ F → x ∈ cl A := by intro A hA exact claim1 (cl A) (isClosed_cl A) (mem_of_superset hA (subset_cl A)) -- T0 is closed under intersections. have claim3 : ∀ (S1) (_ : S1 ∈ T0) (S2) (_ : S2 ∈ T0), S1 ∩ S2 ∈ T0 := by rintro S1 ⟨S1, hS1, rfl⟩ S2 ⟨S2, hS2, rfl⟩ exact ⟨S1 ∩ S2, inter_mem hS1 hS2, by simp [basic_inter]⟩ -- For every S ∈ T0, the intersection AA ∩ S is nonempty. have claim4 : ∀ S ∈ T0, (AA ∩ S).Nonempty := by rintro S ⟨S, hS, rfl⟩ rcases claim2 _ hS with ⟨G, hG, hG2⟩ exact ⟨G, hG2, hG⟩ -- Every element of T0 is nonempty. have claim5 : ∀ S ∈ T0, Set.Nonempty S := by rintro S ⟨S, hS, rfl⟩ exact ⟨F, hS⟩ -- Every element of T2 is nonempty. have claim6 : ∀ S ∈ T2, Set.Nonempty S := by suffices ∀ S ∈ T2, S ∈ T0 ∨ ∃ Q ∈ T0, S = AA ∩ Q by intro S hS cases' this _ hS with h h · exact claim5 S h · rcases h with ⟨Q, hQ, rfl⟩ exact claim4 Q hQ intro S hS apply finiteInterClosure_insert · constructor · use Set.univ refine ⟨Filter.univ_sets _, ?_⟩ ext refine ⟨?_, by tauto⟩ · intro apply Filter.univ_sets · exact claim3 · exact hS -- It suffices to show that the intersection of any finite subset of T1 is nonempty. suffices ∀ F : fsu, ↑F ⊆ T1 → (⋂₀ ι F).Nonempty by obtain ⟨G, h1⟩ := Ultrafilter.exists_ultrafilter_of_finite_inter_nonempty _ this have c1 : X.join G = F := Ultrafilter.coe_le_coe.1 fun P hP => h1 (Or.inr ⟨P, hP, rfl⟩) have c2 : G.map X.str = X.incl x := by refine Ultrafilter.coe_le_coe.1 fun P hP => ?_ apply mem_of_superset (h1 (Or.inl rfl)) rintro x ⟨rfl⟩ exact hP simp [← c1, c2] -- Finish... intro T hT refine claim6 _ (finiteInter_mem (.finiteInterClosure_finiteInter _) _ ?_) intro t ht exact finiteInterClosure.basic (@hT t ht) theorem le_nhds_of_str_eq {X : Compactum} (F : Ultrafilter X) (x : X) : X.str F = x → ↑F ≤ 𝓝 x := fun h => le_nhds_iff.mpr fun s hx hs => hs _ <| by rwa [h] -- All the hard work above boils down to this `T2Space` instance. instance {X : Compactum} : T2Space X := by rw [t2_iff_ultrafilter] intro _ _ F hx hy rw [← str_eq_of_le_nhds _ _ hx, ← str_eq_of_le_nhds _ _ hy] /-- The structure map of a compactum actually computes limits. -/ theorem lim_eq_str {X : Compactum} (F : Ultrafilter X) : F.lim = X.str F := by rw [Ultrafilter.lim_eq_iff_le_nhds, le_nhds_iff] tauto theorem cl_eq_closure {X : Compactum} (A : Set X) : cl A = closure A := by ext rw [mem_closure_iff_ultrafilter] constructor · rintro ⟨F, h1, h2⟩ exact ⟨F, h1, le_nhds_of_str_eq _ _ h2⟩ · rintro ⟨F, h1, h2⟩ exact ⟨F, h1, str_eq_of_le_nhds _ _ h2⟩ /-- Any morphism of compacta is continuous. -/ theorem continuous_of_hom {X Y : Compactum} (f : X ⟶ Y) : Continuous f := by rw [continuous_iff_ultrafilter] intro x g h rw [Tendsto, ← coe_map] apply le_nhds_of_str_eq rw [← str_hom_commute, str_eq_of_le_nhds _ x _] apply h /-- Given any compact Hausdorff space, we construct a Compactum. -/ noncomputable def ofTopologicalSpace (X : Type*) [TopologicalSpace X] [CompactSpace X] [T2Space X] : Compactum where A := X a := Ultrafilter.lim unit := by ext x exact lim_eq (pure_le_nhds _) assoc := by ext FF change Ultrafilter (Ultrafilter X) at FF set x := (Ultrafilter.map Ultrafilter.lim FF).lim with c1 have c2 : ∀ (U : Set X) (F : Ultrafilter X), F.lim ∈ U → IsOpen U → U ∈ F := by intro U F h1 hU exact isOpen_iff_ultrafilter.mp hU _ h1 _ (Ultrafilter.le_nhds_lim _) have c3 : ↑(Ultrafilter.map Ultrafilter.lim FF) ≤ 𝓝 x := by rw [le_nhds_iff] intro U hx hU exact mem_coe.2 (c2 _ _ (by rwa [← c1]) hU) have c4 : ∀ U : Set X, x ∈ U → IsOpen U → { G : Ultrafilter X | U ∈ G } ∈ FF := by intro U hx hU suffices Ultrafilter.lim ⁻¹' U ∈ FF by apply mem_of_superset this intro P hP exact c2 U P hP hU exact @c3 U (IsOpen.mem_nhds hU hx) apply lim_eq rw [le_nhds_iff] exact c4 /-- Any continuous map between Compacta is a morphism of compacta. -/ def homOfContinuous {X Y : Compactum} (f : X → Y) (cont : Continuous f) : X ⟶ Y := { f h := by rw [continuous_iff_ultrafilter] at cont ext (F : Ultrafilter X) specialize cont (X.str F) F (le_nhds_of_str_eq F (X.str F) rfl) simp only [types_comp_apply, ofTypeFunctor_map] exact str_eq_of_le_nhds (Ultrafilter.map f F) _ cont } end Compactum /-- The functor functor from Compactum to CompHaus. -/ def compactumToCompHaus : Compactum ⥤ CompHaus where obj X := { toTop := { α := X }, prop := trivial } map := fun f => { toFun := f continuous_toFun := Compactum.continuous_of_hom _ } namespace compactumToCompHaus /-- The functor `compactumToCompHaus` is full. -/ instance full : compactumToCompHaus.{u}.Full where map_surjective f := ⟨Compactum.homOfContinuous f.1 f.2, rfl⟩ /-- The functor `compactumToCompHaus` is faithful. -/ instance faithful : compactumToCompHaus.Faithful where -- Porting note: this used to be obviously (though it consumed a bit of memory) map_injective := by intro _ _ _ _ h -- Porting note (#11041): `ext` gets confused by coercion using forget. apply Monad.Algebra.Hom.ext apply congrArg (fun f => f.toFun) h /-- This definition is used to prove essential surjectivity of `compactumToCompHaus`. -/ def isoOfTopologicalSpace {D : CompHaus} : compactumToCompHaus.obj (Compactum.ofTopologicalSpace D) ≅ D where hom := { toFun := id continuous_toFun := continuous_def.2 fun _ h => by rw [isOpen_iff_ultrafilter'] at h exact h } inv := { toFun := id continuous_toFun := continuous_def.2 fun _ h1 => by rw [isOpen_iff_ultrafilter'] intro _ h2 exact h1 _ h2 } /-- The functor `compactumToCompHaus` is essentially surjective. -/ instance essSurj : compactumToCompHaus.EssSurj := { mem_essImage := fun X => ⟨Compactum.ofTopologicalSpace X, ⟨isoOfTopologicalSpace⟩⟩ } /-- The functor `compactumToCompHaus` is an equivalence of categories. -/ instance isEquivalence : compactumToCompHaus.IsEquivalence where end compactumToCompHaus /-- The forgetful functors of `Compactum` and `CompHaus` are compatible via `compactumToCompHaus`. -/ def compactumToCompHausCompForget : compactumToCompHaus ⋙ CategoryTheory.forget CompHaus ≅ Compactum.forget := NatIso.ofComponents fun X => eqToIso rfl /- TODO: `forget CompHaus` is monadic, as it is isomorphic to the composition of an equivalence with the monadic functor `forget Compactum`. Once we have the API to transfer monadicity of functors along such isomorphisms, the instance `CreatesLimits (forget CompHaus)` can be deduced from this monadicity. -/ noncomputable instance CompHaus.forgetCreatesLimits : CreatesLimits (forget CompHaus) := by let e : forget CompHaus ≅ compactumToCompHaus.inv ⋙ Compactum.forget := (((forget CompHaus).leftUnitor.symm ≪≫ isoWhiskerRight compactumToCompHaus.asEquivalence.symm.unitIso (forget CompHaus)) ≪≫ compactumToCompHaus.inv.associator compactumToCompHaus (forget CompHaus)) ≪≫ isoWhiskerLeft _ compactumToCompHausCompForget exact createsLimitsOfNatIso e.symm noncomputable instance Profinite.forgetCreatesLimits : CreatesLimits (forget Profinite) := by change CreatesLimits (profiniteToCompHaus ⋙ forget _) infer_instance
Topology\Category\FinTopCat.lean
/- Copyright (c) 2024 Christian Merten. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Christian Merten -/ import Mathlib.CategoryTheory.FintypeCat import Mathlib.Topology.Category.TopCat.Basic /-! # Category of finite topological spaces Definition of the category of finite topological spaces with the canonical forgetful functors. -/ universe u open CategoryTheory /-- A bundled finite topological space. -/ structure FinTopCat where /-- carrier of a finite topological space. -/ toTop : TopCat.{u} [fintype : Fintype toTop] namespace FinTopCat instance : Inhabited FinTopCat := ⟨{ toTop := { α := PEmpty } }⟩ instance : CoeSort FinTopCat (Type u) := ⟨fun X => X.toTop⟩ attribute [instance] fintype instance : Category FinTopCat := InducedCategory.category toTop instance : ConcreteCategory FinTopCat := InducedCategory.concreteCategory _ instance (X : FinTopCat) : TopologicalSpace ((forget FinTopCat).obj X) := inferInstanceAs <| TopologicalSpace X instance (X : FinTopCat) : Fintype ((forget FinTopCat).obj X) := X.fintype /-- Construct a bundled `FinTopCat` from the underlying type and the appropriate typeclasses. -/ def of (X : Type u) [Fintype X] [TopologicalSpace X] : FinTopCat where toTop := TopCat.of X fintype := ‹_› @[simp] theorem coe_of (X : Type u) [Fintype X] [TopologicalSpace X] : (of X : Type u) = X := rfl /-- The forgetful functor to `FintypeCat`. -/ instance : HasForget₂ FinTopCat FintypeCat := HasForget₂.mk' (fun X ↦ FintypeCat.of X) (fun _ ↦ rfl) (fun f ↦ f.toFun) HEq.rfl instance (X : FinTopCat) : TopologicalSpace ((forget₂ FinTopCat FintypeCat).obj X) := inferInstanceAs <| TopologicalSpace X /-- The forgetful functor to `TopCat`. -/ instance : HasForget₂ FinTopCat TopCat := InducedCategory.hasForget₂ _ instance (X : FinTopCat) : Fintype ((forget₂ FinTopCat TopCat).obj X) := X.fintype end FinTopCat
Topology\Category\Locale.lean
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies -/ import Mathlib.Order.Category.Frm /-! # The category of locales This file defines `Locale`, the category of locales. This is the opposite of the category of frames. -/ universe u open CategoryTheory Opposite Order TopologicalSpace /-- The category of locales. -/ def Locale := Frmᵒᵖ deriving LargeCategory namespace Locale instance : CoeSort Locale Type* := ⟨fun X => X.unop⟩ instance (X : Locale) : Frame X := X.unop.str /-- Construct a bundled `Locale` from a `Frame`. -/ def of (α : Type*) [Frame α] : Locale := op <| Frm.of α @[simp] theorem coe_of (α : Type*) [Frame α] : ↥(of α) = α := rfl instance : Inhabited Locale := ⟨of PUnit⟩ end Locale /-- The forgetful functor from `Top` to `Locale` which forgets that the space has "enough points". -/ @[simps!] def topToLocale : TopCat ⥤ Locale := topCatOpToFrm.rightOp -- Note, `CompHaus` is too strong. We only need `T0Space`. instance CompHausToLocale.faithful : (compHausToTop ⋙ topToLocale.{u}).Faithful := ⟨fun h => by dsimp at h exact Opens.comap_injective (Quiver.Hom.op_inj h)⟩
Topology\Category\Sequential.lean
/- Copyright (c) 2024 Dagur Asgeirsson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Dagur Asgeirsson -/ import Mathlib.CategoryTheory.Elementwise import Mathlib.Topology.Sequences import Mathlib.Topology.Instances.Discrete import Mathlib.Topology.Category.TopCat.Basic /-! # The category of sequential topological spaces We define the category `Sequential` of sequential topological spaces. We follow the ususal template for defining categories of topological spaces, by giving it the induced category structure from `TopCat`. -/ open CategoryTheory attribute [local instance] ConcreteCategory.instFunLike universe u /-- The type sequential topological spaces. -/ structure Sequential where /-- The underlying topological space of an object of `Sequential`. -/ toTop : TopCat.{u} /-- The underlying topological space is sequential. -/ [is_sequential : SequentialSpace toTop] namespace Sequential instance : Inhabited Sequential.{u} := ⟨{ toTop := { α := ULift (Fin 37) } }⟩ instance : CoeSort Sequential Type* := ⟨fun X => X.toTop⟩ attribute [instance] is_sequential instance : Category.{u, u+1} Sequential.{u} := InducedCategory.category toTop instance : ConcreteCategory.{u} Sequential.{u} := InducedCategory.concreteCategory _ variable (X : Type u) [TopologicalSpace X] [SequentialSpace X] /-- Constructor for objects of the category `Sequential`. -/ def of : Sequential.{u} where toTop := TopCat.of X is_sequential := ‹_› /-- The fully faithful embedding of `Sequential` in `TopCat`. -/ @[simps!] def sequentialToTop : Sequential.{u} ⥤ TopCat.{u} := inducedFunctor _ /-- The functor to `TopCat` is indeed fully faithful.-/ def fullyFaithfulSequentialToTop : sequentialToTop.FullyFaithful := fullyFaithfulInducedFunctor _ instance : sequentialToTop.{u}.Full := inferInstanceAs (inducedFunctor _).Full instance : sequentialToTop.{u}.Faithful := inferInstanceAs (inducedFunctor _).Faithful /-- Construct an isomorphism from a homeomorphism. -/ @[simps hom inv] def isoOfHomeo {X Y : Sequential.{u}} (f : X ≃ₜ Y) : X ≅ Y where hom := ⟨f, f.continuous⟩ inv := ⟨f.symm, f.symm.continuous⟩ hom_inv_id := by ext x exact f.symm_apply_apply x inv_hom_id := by ext x exact f.apply_symm_apply x /-- Construct a homeomorphism from an isomorphism. -/ @[simps] def homeoOfIso {X Y : Sequential.{u}} (f : X ≅ Y) : X ≃ₜ Y where toFun := f.hom invFun := f.inv left_inv x := by simp right_inv x := by simp continuous_toFun := f.hom.continuous continuous_invFun := f.inv.continuous /-- The equivalence between isomorphisms in `Sequential` and homeomorphisms of topological spaces. -/ @[simps] def isoEquivHomeo {X Y : Sequential.{u}} : (X ≅ Y) ≃ (X ≃ₜ Y) where toFun := homeoOfIso invFun := isoOfHomeo left_inv f := by ext rfl right_inv f := by ext rfl end Sequential
Topology\Category\TopCommRingCat.lean
/- Copyright (c) 2019 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Scott Morrison -/ import Mathlib.Algebra.Category.Ring.Basic import Mathlib.Topology.Category.TopCat.Basic import Mathlib.Topology.Algebra.Ring.Basic /-! # Category of topological commutative rings We introduce the category `TopCommRingCat` of topological commutative rings together with the relevant forgetful functors to topological spaces and commutative rings. -/ universe u open CategoryTheory /-- A bundled topological commutative ring. -/ structure TopCommRingCat where /-- carrier of a topological commutative ring. -/ α : Type u [isCommRing : CommRing α] [isTopologicalSpace : TopologicalSpace α] [isTopologicalRing : TopologicalRing α] namespace TopCommRingCat instance : Inhabited TopCommRingCat := ⟨⟨PUnit⟩⟩ instance : CoeSort TopCommRingCat (Type u) := ⟨TopCommRingCat.α⟩ attribute [instance] isCommRing isTopologicalSpace isTopologicalRing instance : Category TopCommRingCat.{u} where Hom R S := { f : R →+* S // Continuous f } id R := ⟨RingHom.id R, by rw [RingHom.id]; continuity⟩ comp f g := ⟨g.val.comp f.val, by -- TODO automate cases f cases g dsimp; apply Continuous.comp <;> assumption⟩ instance : ConcreteCategory TopCommRingCat.{u} where forget := { obj := fun R => R map := fun f => f.val } -- Porting note: Old proof was `forget_faithful := { }` forget_faithful := { map_injective := fun {_ _ a b} h => Subtype.ext <| RingHom.coe_inj h } /-- Construct a bundled `TopCommRingCat` from the underlying type and the appropriate typeclasses. -/ def of (X : Type u) [CommRing X] [TopologicalSpace X] [TopologicalRing X] : TopCommRingCat := ⟨X⟩ @[simp] theorem coe_of (X : Type u) [CommRing X] [TopologicalSpace X] [TopologicalRing X] : (of X : Type u) = X := rfl instance forgetTopologicalSpace (R : TopCommRingCat) : TopologicalSpace ((forget TopCommRingCat).obj R) := R.isTopologicalSpace instance forgetCommRing (R : TopCommRingCat) : CommRing ((forget TopCommRingCat).obj R) := R.isCommRing instance forgetTopologicalRing (R : TopCommRingCat) : TopologicalRing ((forget TopCommRingCat).obj R) := R.isTopologicalRing instance hasForgetToCommRingCat : HasForget₂ TopCommRingCat CommRingCat := HasForget₂.mk' (fun R => CommRingCat.of R) (fun _ => rfl) (fun f => f.val) HEq.rfl instance forgetToCommRingCatTopologicalSpace (R : TopCommRingCat) : TopologicalSpace ((forget₂ TopCommRingCat CommRingCat).obj R) := R.isTopologicalSpace /-- The forgetful functor to `TopCat`. -/ instance hasForgetToTopCat : HasForget₂ TopCommRingCat TopCat := HasForget₂.mk' (fun R => TopCat.of R) (fun _ => rfl) (fun f => ⟨⇑f.1, f.2⟩) HEq.rfl instance forgetToTopCatCommRing (R : TopCommRingCat) : CommRing ((forget₂ TopCommRingCat TopCat).obj R) := R.isCommRing instance forgetToTopCatTopologicalRing (R : TopCommRingCat) : TopologicalRing ((forget₂ TopCommRingCat TopCat).obj R) := R.isTopologicalRing /-- The forgetful functors to `Type` do not reflect isomorphisms, but the forgetful functor from `TopCommRingCat` to `TopCat` does. -/ instance : (forget₂ TopCommRingCat.{u} TopCat.{u}).ReflectsIsomorphisms where reflects {X Y} f _ := by -- We have an isomorphism in `TopCat`, let i_Top := asIso ((forget₂ TopCommRingCat TopCat).map f) -- and a `RingEquiv`. let e_Ring : X ≃+* Y := { f.1, ((forget TopCat).mapIso i_Top).toEquiv with } -- Putting these together we obtain the isomorphism we're after: exact ⟨⟨⟨e_Ring.symm, i_Top.inv.2⟩, ⟨by ext x exact e_Ring.left_inv x, by ext x exact e_Ring.right_inv x⟩⟩⟩ end TopCommRingCat
Topology\Category\UniformSpace.lean
/- Copyright (c) 2019 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Reid Barton, Patrick Massot, Scott Morrison -/ import Mathlib.CategoryTheory.Adjunction.Reflective import Mathlib.CategoryTheory.ConcreteCategory.UnbundledHom import Mathlib.CategoryTheory.Monad.Limits import Mathlib.Topology.Category.TopCat.Basic import Mathlib.Topology.UniformSpace.Completion /-! # The category of uniform spaces We construct the category of uniform spaces, show that the complete separated uniform spaces form a reflective subcategory, and hence possess all limits that uniform spaces do. TODO: show that uniform spaces actually have all limits! -/ universe u open CategoryTheory /-- A (bundled) uniform space. -/ def UniformSpaceCat : Type (u + 1) := Bundled UniformSpace namespace UniformSpaceCat /-- The information required to build morphisms for `UniformSpace`. -/ instance : UnbundledHom @UniformContinuous := ⟨@uniformContinuous_id, @UniformContinuous.comp⟩ deriving instance LargeCategory for UniformSpaceCat instance : ConcreteCategory UniformSpaceCat := inferInstanceAs <| ConcreteCategory <| Bundled UniformSpace instance : CoeSort UniformSpaceCat Type* := Bundled.coeSort instance (x : UniformSpaceCat) : UniformSpace x := x.str /-- Construct a bundled `UniformSpace` from the underlying type and the typeclass. -/ def of (α : Type u) [UniformSpace α] : UniformSpaceCat := ⟨α, ‹_›⟩ instance : Inhabited UniformSpaceCat := ⟨UniformSpaceCat.of Empty⟩ @[simp] theorem coe_of (X : Type u) [UniformSpace X] : (of X : Type u) = X := rfl instance (X Y : UniformSpaceCat) : CoeFun (X ⟶ Y) fun _ => X → Y := ⟨(forget UniformSpaceCat).map⟩ @[simp] theorem coe_comp {X Y Z : UniformSpaceCat} (f : X ⟶ Y) (g : Y ⟶ Z) : (f ≫ g : X → Z) = g ∘ f := rfl @[simp] theorem coe_id (X : UniformSpaceCat) : (𝟙 X : X → X) = id := rfl -- Porting note (#11119): removed `simp` attribute -- due to `LEFT-HAND SIDE HAS VARIABLE AS HEAD SYMBOL.` theorem coe_mk {X Y : UniformSpaceCat} (f : X → Y) (hf : UniformContinuous f) : ((⟨f, hf⟩ : X ⟶ Y) : X → Y) = f := rfl theorem hom_ext {X Y : UniformSpaceCat} {f g : X ⟶ Y} : (f : X → Y) = g → f = g := Subtype.eq /-- The forgetful functor from uniform spaces to topological spaces. -/ instance hasForgetToTop : HasForget₂ UniformSpaceCat.{u} TopCat.{u} where forget₂ := { obj := fun X => TopCat.of X map := fun f => { toFun := f continuous_toFun := f.property.continuous } } end UniformSpaceCat /-- A (bundled) complete separated uniform space. -/ structure CpltSepUniformSpace where /-- The underlying space -/ α : Type u [isUniformSpace : UniformSpace α] [isCompleteSpace : CompleteSpace α] [isT0 : T0Space α] namespace CpltSepUniformSpace instance : CoeSort CpltSepUniformSpace (Type u) := ⟨CpltSepUniformSpace.α⟩ attribute [instance] isUniformSpace isCompleteSpace isT0 /-- The function forgetting that a complete separated uniform spaces is complete and separated. -/ def toUniformSpace (X : CpltSepUniformSpace) : UniformSpaceCat := UniformSpaceCat.of X instance completeSpace (X : CpltSepUniformSpace) : CompleteSpace (toUniformSpace X).α := CpltSepUniformSpace.isCompleteSpace X instance t0Space (X : CpltSepUniformSpace) : T0Space (toUniformSpace X).α := CpltSepUniformSpace.isT0 X /-- Construct a bundled `UniformSpace` from the underlying type and the appropriate typeclasses. -/ def of (X : Type u) [UniformSpace X] [CompleteSpace X] [T0Space X] : CpltSepUniformSpace := ⟨X⟩ @[simp] theorem coe_of (X : Type u) [UniformSpace X] [CompleteSpace X] [T0Space X] : (of X : Type u) = X := rfl instance : Inhabited CpltSepUniformSpace := ⟨CpltSepUniformSpace.of Empty⟩ /-- The category instance on `CpltSepUniformSpace`. -/ instance category : LargeCategory CpltSepUniformSpace := InducedCategory.category toUniformSpace /-- The concrete category instance on `CpltSepUniformSpace`. -/ instance concreteCategory : ConcreteCategory CpltSepUniformSpace := InducedCategory.concreteCategory toUniformSpace instance hasForgetToUniformSpace : HasForget₂ CpltSepUniformSpace UniformSpaceCat := InducedCategory.hasForget₂ toUniformSpace end CpltSepUniformSpace namespace UniformSpaceCat open UniformSpace open CpltSepUniformSpace /-- The functor turning uniform spaces into complete separated uniform spaces. -/ noncomputable def completionFunctor : UniformSpaceCat ⥤ CpltSepUniformSpace where obj X := CpltSepUniformSpace.of (Completion X) map f := ⟨Completion.map f.1, Completion.uniformContinuous_map⟩ map_id _ := Subtype.eq Completion.map_id map_comp f g := Subtype.eq (Completion.map_comp g.property f.property).symm /-- The inclusion of a uniform space into its completion. -/ def completionHom (X : UniformSpaceCat) : X ⟶ (forget₂ CpltSepUniformSpace UniformSpaceCat).obj (completionFunctor.obj X) where val := ((↑) : X → Completion X) property := Completion.uniformContinuous_coe X @[simp] theorem completionHom_val (X : UniformSpaceCat) (x) : (completionHom X) x = (x : Completion X) := rfl /-- The mate of a morphism from a `UniformSpace` to a `CpltSepUniformSpace`. -/ noncomputable def extensionHom {X : UniformSpaceCat} {Y : CpltSepUniformSpace} (f : X ⟶ (forget₂ CpltSepUniformSpace UniformSpaceCat).obj Y) : completionFunctor.obj X ⟶ Y where val := Completion.extension f property := Completion.uniformContinuous_extension -- Porting note (#10754): added this instance to make things compile instance (X : UniformSpaceCat) : UniformSpace ((forget _).obj X) := show UniformSpace X from inferInstance -- This was a global instance prior to #13170. We may experiment with removing it. attribute [local instance] CategoryTheory.ConcreteCategory.instFunLike in @[simp] theorem extensionHom_val {X : UniformSpaceCat} {Y : CpltSepUniformSpace} (f : X ⟶ (forget₂ _ _).obj Y) (x) : (extensionHom f) x = Completion.extension f x := rfl @[simp] theorem extension_comp_coe {X : UniformSpaceCat} {Y : CpltSepUniformSpace} (f : toUniformSpace (CpltSepUniformSpace.of (Completion X)) ⟶ toUniformSpace Y) : extensionHom (completionHom X ≫ f) = f := by apply Subtype.eq funext x exact congr_fun (Completion.extension_comp_coe f.property) x /-- The completion functor is left adjoint to the forgetful functor. -/ noncomputable def adj : completionFunctor ⊣ forget₂ CpltSepUniformSpace UniformSpaceCat := Adjunction.mkOfHomEquiv { homEquiv := fun X Y => { toFun := fun f => completionHom X ≫ f invFun := fun f => extensionHom f left_inv := fun f => by dsimp; erw [extension_comp_coe] right_inv := fun f => by apply Subtype.eq; funext x; cases f exact @Completion.extension_coe _ _ _ _ _ (CpltSepUniformSpace.t0Space _) ‹_› _ } homEquiv_naturality_left_symm := fun {X' X Y} f g => by apply hom_ext; funext x; dsimp erw [coe_comp] -- Porting note: used to be `erw [← Completion.extension_map]` have := (Completion.extension_map (γ := Y) (f := g) g.2 f.2) simp only [forget_map_eq_coe] at this ⊢ erw [this] rfl } noncomputable instance : Reflective (forget₂ CpltSepUniformSpace UniformSpaceCat) where adj := adj map_surjective f := ⟨f, rfl⟩ open CategoryTheory.Limits -- TODO Once someone defines `HasLimits UniformSpace`, turn this into an instance. example [HasLimits.{u} UniformSpaceCat.{u}] : HasLimits.{u} CpltSepUniformSpace.{u} := hasLimits_of_reflective <| forget₂ CpltSepUniformSpace UniformSpaceCat.{u} end UniformSpaceCat
Topology\Category\CompHaus\Basic.lean
/- Copyright (c) 2020 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz, Bhavik Mehta -/ import Mathlib.CategoryTheory.Monad.Limits import Mathlib.Topology.StoneCech import Mathlib.Topology.UrysohnsLemma import Mathlib.Topology.Category.CompHausLike.Basic import Mathlib.Topology.Category.TopCat.Limits.Basic /-! # The category of Compact Hausdorff Spaces We construct the category of compact Hausdorff spaces. The type of compact Hausdorff spaces is denoted `CompHaus`, and it is endowed with a category instance making it a full subcategory of `TopCat`. The fully faithful functor `CompHaus ⥤ TopCat` is denoted `compHausToTop`. **Note:** The file `Mathlib/Topology/Category/Compactum.lean` provides the equivalence between `Compactum`, which is defined as the category of algebras for the ultrafilter monad, and `CompHaus`. `CompactumToCompHaus` is the functor from `Compactum` to `CompHaus` which is proven to be an equivalence of categories in `CompactumToCompHaus.isEquivalence`. See `Mathlib/Topology/Category/Compactum.lean` for a more detailed discussion where these definitions are introduced. -/ universe v u -- This was a global instance prior to #13170. We may experiment with removing it. attribute [local instance] CategoryTheory.ConcreteCategory.instFunLike open CategoryTheory CompHausLike /-- The category of compact Hausdorff spaces. -/ abbrev CompHaus := CompHausLike (fun _ ↦ True) namespace CompHaus instance : Inhabited CompHaus := ⟨{ toTop := { α := PEmpty }, prop := trivial}⟩ instance : CoeSort CompHaus Type* := ⟨fun X => X.toTop⟩ instance {X : CompHaus} : CompactSpace X := X.is_compact instance {X : CompHaus} : T2Space X := X.is_hausdorff variable (X : Type*) [TopologicalSpace X] [CompactSpace X] [T2Space X] instance : HasProp (fun _ ↦ True) X := ⟨trivial⟩ /-- A constructor for objects of the category `CompHaus`, taking a type, and bundling the compact Hausdorff topology found by typeclass inference. -/ abbrev of : CompHaus := CompHausLike.of _ X end CompHaus /-- The fully faithful embedding of `CompHaus` in `TopCat`. -/ -- Porting note: `semireducible` -> `.default`. abbrev compHausToTop : CompHaus.{u} ⥤ TopCat.{u} := CompHausLike.compHausLikeToTop _ -- deriving Full, Faithful -- Porting note: deriving fails, adding manually. /-- (Implementation) The object part of the compactification functor from topological spaces to compact Hausdorff spaces. -/ @[simps!] def stoneCechObj (X : TopCat) : CompHaus := CompHaus.of (StoneCech X) /-- (Implementation) The bijection of homsets to establish the reflective adjunction of compact Hausdorff spaces in topological spaces. -/ noncomputable def stoneCechEquivalence (X : TopCat.{u}) (Y : CompHaus.{u}) : (stoneCechObj X ⟶ Y) ≃ (X ⟶ compHausToTop.obj Y) where toFun f := { toFun := f ∘ stoneCechUnit continuous_toFun := f.2.comp (@continuous_stoneCechUnit X _) } invFun f := { toFun := stoneCechExtend f.2 continuous_toFun := continuous_stoneCechExtend f.2 } left_inv := by rintro ⟨f : StoneCech X ⟶ Y, hf : Continuous f⟩ -- Porting note: `ext` fails. apply ContinuousMap.ext intro (x : StoneCech X) refine congr_fun ?_ x apply Continuous.ext_on denseRange_stoneCechUnit (continuous_stoneCechExtend _) hf · rintro _ ⟨y, rfl⟩ apply congr_fun (stoneCechExtend_extends (hf.comp _)) y apply continuous_stoneCechUnit right_inv := by rintro ⟨f : (X : Type _) ⟶ Y, hf : Continuous f⟩ -- Porting note: `ext` fails. apply ContinuousMap.ext intro exact congr_fun (stoneCechExtend_extends hf) _ /-- The Stone-Cech compactification functor from topological spaces to compact Hausdorff spaces, left adjoint to the inclusion functor. -/ noncomputable def topToCompHaus : TopCat.{u} ⥤ CompHaus.{u} := Adjunction.leftAdjointOfEquiv stoneCechEquivalence.{u} fun _ _ _ _ _ => rfl theorem topToCompHaus_obj (X : TopCat) : ↥(topToCompHaus.obj X) = StoneCech X := rfl /-- The category of compact Hausdorff spaces is reflective in the category of topological spaces. -/ noncomputable instance compHausToTop.reflective : Reflective compHausToTop where L := topToCompHaus adj := Adjunction.adjunctionOfEquivLeft _ _ noncomputable instance compHausToTop.createsLimits : CreatesLimits compHausToTop := monadicCreatesLimits _ instance CompHaus.hasLimits : Limits.HasLimits CompHaus := hasLimits_of_hasLimits_createsLimits compHausToTop instance CompHaus.hasColimits : Limits.HasColimits CompHaus := hasColimits_of_reflective compHausToTop namespace CompHaus /-- An explicit limit cone for a functor `F : J ⥤ CompHaus`, defined in terms of `TopCat.limitCone`. -/ def limitCone {J : Type v} [SmallCategory J] (F : J ⥤ CompHaus.{max v u}) : Limits.Cone F := letI FF : J ⥤ TopCat := F ⋙ compHausToTop { pt := { toTop := (TopCat.limitCone FF).pt is_compact := by show CompactSpace { u : ∀ j, F.obj j | ∀ {i j : J} (f : i ⟶ j), (F.map f) (u i) = u j } rw [← isCompact_iff_compactSpace] apply IsClosed.isCompact have : { u : ∀ j, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } = ⋂ (i : J) (j : J) (f : i ⟶ j), { u | F.map f (u i) = u j } := by ext1 simp only [Set.mem_iInter, Set.mem_setOf_eq] rw [this] apply isClosed_iInter intro i apply isClosed_iInter intro j apply isClosed_iInter intro f apply isClosed_eq · exact (ContinuousMap.continuous (F.map f)).comp (continuous_apply i) · exact continuous_apply j is_hausdorff := show T2Space { u : ∀ j, F.obj j | ∀ {i j : J} (f : i ⟶ j), (F.map f) (u i) = u j } from inferInstance prop := trivial } π := { app := fun j => (TopCat.limitCone FF).π.app j naturality := by intro _ _ f ext ⟨x, hx⟩ simp only [comp_apply, Functor.const_obj_map, id_apply] exact (hx f).symm } } /-- The limit cone `CompHaus.limitCone F` is indeed a limit cone. -/ def limitConeIsLimit {J : Type v} [SmallCategory J] (F : J ⥤ CompHaus.{max v u}) : Limits.IsLimit.{v} (limitCone.{v,u} F) := letI FF : J ⥤ TopCat := F ⋙ compHausToTop { lift := fun S => (TopCat.limitConeIsLimit FF).lift (compHausToTop.mapCone S) fac := fun S => (TopCat.limitConeIsLimit FF).fac (compHausToTop.mapCone S) uniq := fun S => (TopCat.limitConeIsLimit FF).uniq (compHausToTop.mapCone S) } theorem epi_iff_surjective {X Y : CompHaus.{u}} (f : X ⟶ Y) : Epi f ↔ Function.Surjective f := by constructor · dsimp [Function.Surjective] contrapose! rintro ⟨y, hy⟩ hf let C := Set.range f have hC : IsClosed C := (isCompact_range f.continuous).isClosed let D := ({y} : Set Y) have hD : IsClosed D := isClosed_singleton have hCD : Disjoint C D := by rw [Set.disjoint_singleton_right] rintro ⟨y', hy'⟩ exact hy y' hy' obtain ⟨φ, hφ0, hφ1, hφ01⟩ := exists_continuous_zero_one_of_isClosed hC hD hCD haveI : CompactSpace (ULift.{u} <| Set.Icc (0 : ℝ) 1) := Homeomorph.ulift.symm.compactSpace haveI : T2Space (ULift.{u} <| Set.Icc (0 : ℝ) 1) := Homeomorph.ulift.symm.t2Space let Z := of (ULift.{u} <| Set.Icc (0 : ℝ) 1) let g : Y ⟶ Z := ⟨fun y' => ⟨⟨φ y', hφ01 y'⟩⟩, continuous_uLift_up.comp (φ.continuous.subtype_mk fun y' => hφ01 y')⟩ let h : Y ⟶ Z := ⟨fun _ => ⟨⟨0, Set.left_mem_Icc.mpr zero_le_one⟩⟩, continuous_const⟩ have H : h = g := by rw [← cancel_epi f] ext x -- Porting note: `ext` doesn't apply these two lemmas. apply ULift.ext apply Subtype.ext dsimp -- Porting note: This `change` is not ideal. -- I think lean is having issues understanding when a `ContinuousMap` should be considered -- as a morphism. -- TODO(?): Make morphisms in `CompHaus` (and other topological categories) -- into a one-field-structure. change 0 = φ (f x) simp only [hφ0 (Set.mem_range_self x), Pi.zero_apply] apply_fun fun e => (e y).down.1 at H dsimp [Z] at H change 0 = φ y at H simp only [hφ1 (Set.mem_singleton y), Pi.one_apply] at H exact zero_ne_one H · rw [← CategoryTheory.epi_iff_surjective] apply (forget CompHaus).epi_of_epi_map end CompHaus /-- Every `CompHausLike` admits a functor to `CompHaus`. -/ abbrev compHausLikeToCompHaus (P : TopCat → Prop) : CompHausLike P ⥤ CompHaus := CompHausLike.toCompHausLike (by simp only [implies_true])
Topology\Category\CompHaus\EffectiveEpi.lean
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz, Dagur Asgeirsson -/ import Mathlib.Topology.Category.CompHaus.Limits import Mathlib.Topology.Category.CompHausLike.EffectiveEpi /-! # Effective epimorphisms in `CompHaus` This file proves that `EffectiveEpi`, `Epi` and `Surjective` are all equivalent in `CompHaus`. As a consequence we deduce from the material in `Mathlib.Topology.Category.CompHausLike.EffectiveEpi` that `CompHaus` is `Preregular` and `Precoherent`. We also prove that for a finite family of morphisms in `CompHaus` with fixed target, the conditions jointly surjective, jointly epimorphic and effective epimorphic are all equivalent. ## Projects - Define regular categories, and show that `CompHaus` is regular. - Define coherent categories, and show that `CompHaus` is actually coherent. -/ universe u open CategoryTheory Limits CompHausLike attribute [local instance] ConcreteCategory.instFunLike namespace CompHaus open List in theorem effectiveEpi_tfae {B X : CompHaus.{u}} (π : X ⟶ B) : TFAE [ EffectiveEpi π , Epi π , Function.Surjective π ] := by tfae_have 1 → 2 · intro; infer_instance tfae_have 2 ↔ 3 · exact epi_iff_surjective π tfae_have 3 → 1 · exact fun hπ ↦ ⟨⟨effectiveEpiStruct π hπ⟩⟩ tfae_finish instance : Preregular CompHaus := preregular fun _ _ _ ↦ ((effectiveEpi_tfae _).out 0 2).mp example : Precoherent CompHaus.{u} := inferInstance -- TODO: prove this for `Type*` open List in theorem effectiveEpiFamily_tfae {α : Type} [Finite α] {B : CompHaus.{u}} (X : α → CompHaus.{u}) (π : (a : α) → (X a ⟶ B)) : TFAE [ EffectiveEpiFamily X π , Epi (Sigma.desc π) , ∀ b : B, ∃ (a : α) (x : X a), π a x = b ] := by tfae_have 2 → 1 · intro simpa [← effectiveEpi_desc_iff_effectiveEpiFamily, (effectiveEpi_tfae (Sigma.desc π)).out 0 1] tfae_have 1 → 2 · intro; infer_instance tfae_have 3 → 2 · intro e rw [epi_iff_surjective] intro b obtain ⟨t, x, h⟩ := e b refine ⟨Sigma.ι X t x, ?_⟩ change (Sigma.ι X t ≫ Sigma.desc π) x = _ simpa using h tfae_have 2 → 3 · intro e; rw [epi_iff_surjective] at e let i : ∐ X ≅ finiteCoproduct X := (colimit.isColimit _).coconePointUniqueUpToIso (finiteCoproduct.isColimit _) intro b obtain ⟨t, rfl⟩ := e b let q := i.hom t refine ⟨q.1,q.2,?_⟩ have : t = i.inv (i.hom t) := show t = (i.hom ≫ i.inv) t by simp only [i.hom_inv_id]; rfl rw [this] show _ = (i.inv ≫ Sigma.desc π) (i.hom t) suffices i.inv ≫ Sigma.desc π = finiteCoproduct.desc X π by rw [this]; rfl rw [Iso.inv_comp_eq] apply colimit.hom_ext rintro ⟨a⟩ simp only [i, Discrete.functor_obj, colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, colimit.comp_coconePointUniqueUpToIso_hom_assoc] ext; rfl tfae_finish theorem effectiveEpiFamily_of_jointly_surjective {α : Type} [Finite α] {B : CompHaus.{u}} (X : α → CompHaus.{u}) (π : (a : α) → (X a ⟶ B)) (surj : ∀ b : B, ∃ (a : α) (x : X a), π a x = b) : EffectiveEpiFamily X π := ((effectiveEpiFamily_tfae X π).out 2 0).mp surj end CompHaus
Topology\Category\CompHaus\Limits.lean
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz, Dagur Asgeirsson -/ import Mathlib.Topology.Category.CompHaus.Basic import Mathlib.Topology.Category.CompHausLike.Limits /-! # Explicit limits and colimits This file applies the general API for explicit limits and colimits in `CompHausLike P` (see the file `Mathlib.Topology.Category.CompHausLike.Limits`) to the special case of `CompHaus`. -/ namespace CompHaus universe u w open CategoryTheory Limits CompHausLike instance : HasExplicitPullbacks (fun _ ↦ True) where hasProp _ _ := inferInstance instance : HasExplicitFiniteCoproducts.{w, u} (fun _ ↦ True) where hasProp _ := inferInstance example : FinitaryExtensive CompHaus.{u} := inferInstance /-- A one-element space is terminal in `CompHaus` -/ abbrev isTerminalPUnit : IsTerminal (CompHaus.of PUnit.{u + 1}) := CompHausLike.isTerminalPUnit /-- The isomorphism from an arbitrary terminal object of `CompHaus` to a one-element space. -/ noncomputable def terminalIsoPUnit : ⊤_ CompHaus.{u} ≅ CompHaus.of PUnit := terminalIsTerminal.uniqueUpToIso CompHaus.isTerminalPUnit noncomputable example : PreservesFiniteCoproducts compHausToTop := inferInstance end CompHaus
Topology\Category\CompHaus\Projective.lean
/- Copyright (c) 2021 Johan Commelin. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johan Commelin -/ import Mathlib.Topology.Category.CompHaus.Basic import Mathlib.Topology.StoneCech import Mathlib.CategoryTheory.Preadditive.Projective import Mathlib.CategoryTheory.ConcreteCategory.EpiMono /-! # CompHaus has enough projectives In this file we show that `CompHaus` has enough projectives. ## Main results Let `X` be a compact Hausdorff space. * `CompHaus.projective_ultrafilter`: the space `Ultrafilter X` is a projective object * `CompHaus.projectivePresentation`: the natural map `Ultrafilter X → X` is a projective presentation ## Reference See [miraglia2006introduction] Chapter 21 for a proof that `CompHaus` has enough projectives. -/ noncomputable section open CategoryTheory Function namespace CompHaus attribute [local instance] ConcreteCategory.instFunLike instance projective_ultrafilter (X : Type*) : Projective (of <| Ultrafilter X) where factors {Y Z} f g hg := by rw [epi_iff_surjective] at hg obtain ⟨g', hg'⟩ := hg.hasRightInverse let t : X → Y := g' ∘ f ∘ (pure : X → Ultrafilter X) let h : Ultrafilter X → Y := Ultrafilter.extend t have hh : Continuous h := continuous_ultrafilter_extend _ use ⟨h, hh⟩ apply (forget CompHaus).map_injective simp only [Functor.map_comp, ContinuousMap.coe_mk, coe_comp] convert denseRange_pure.equalizer (g.continuous.comp hh) f.continuous _ -- Porting note: We need to get the coercions to functions under control. -- The next two lines should not be needed. let g'' : ContinuousMap Y Z := g have : g'' ∘ g' = id := hg'.comp_eq_id -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [comp.assoc, ultrafilter_extend_extends, ← comp.assoc, this, id_comp] /-- For any compact Hausdorff space `X`, the natural map `Ultrafilter X → X` is a projective presentation. -/ def projectivePresentation (X : CompHaus) : ProjectivePresentation X where p := of <| Ultrafilter X f := ⟨_, continuous_ultrafilter_extend id⟩ projective := CompHaus.projective_ultrafilter X epi := ConcreteCategory.epi_of_surjective _ fun x => ⟨(pure x : Ultrafilter X), congr_fun (ultrafilter_extend_extends (𝟙 X)) x⟩ instance : EnoughProjectives CompHaus where presentation X := ⟨projectivePresentation X⟩ end CompHaus
Topology\Category\CompHausLike\Basic.lean
/- Copyright (c) 2024 Dagur Asgeirsson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz, Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca -/ import Mathlib.CategoryTheory.Functor.ReflectsIso import Mathlib.Topology.Category.TopCat.Basic /-! # Categories of Compact Hausdorff Spaces We construct the category of compact Hausdorff spaces satisfying an additional property `P`. -/ universe u open CategoryTheory attribute [local instance] ConcreteCategory.instFunLike variable (P : TopCat.{u} → Prop) /-- The type of Compact Hausdorff topological spaces satisfying an additional property `P`. -/ structure CompHausLike where /-- The underlying topological space of an object of `CompHausLike P`. -/ toTop : TopCat /-- The underlying topological space is compact. -/ [is_compact : CompactSpace toTop] /-- The underlying topological space is T2. -/ [is_hausdorff : T2Space toTop] /-- The underlying topological space satisfies P. -/ prop : P toTop namespace CompHausLike attribute [instance] is_compact is_hausdorff instance : CoeSort (CompHausLike P) (Type u) := ⟨fun X => X.toTop⟩ instance category : Category (CompHausLike P) := InducedCategory.category toTop instance concreteCategory : ConcreteCategory (CompHausLike P) := InducedCategory.concreteCategory _ instance hasForget₂ : HasForget₂ (CompHausLike P) TopCat := InducedCategory.hasForget₂ _ variable (X : Type u) [TopologicalSpace X] [CompactSpace X] [T2Space X] /-- This wraps the predicate `P : TopCat → Prop` in a typeclass. -/ class HasProp : Prop where hasProp : P (TopCat.of X) variable [HasProp P X] /-- A constructor for objects of the category `CompHausLike P`, taking a type, and bundling the compact Hausdorff topology found by typeclass inference. -/ def of : CompHausLike P where toTop := TopCat.of X is_compact := ‹_› is_hausdorff := ‹_› prop := HasProp.hasProp @[simp] theorem coe_of : (CompHausLike.of P X : Type _) = X := rfl @[simp] theorem coe_id (X : CompHausLike P) : (𝟙 ((forget (CompHausLike P)).obj X)) = id := rfl @[simp] theorem coe_comp {X Y Z : CompHausLike P} (f : X ⟶ Y) (g : Y ⟶ Z) : ((forget (CompHausLike P)).map f ≫ (forget (CompHausLike P)).map g) = g ∘ f := rfl -- Note (#10754): Lean does not see through the forgetful functor here instance (X : CompHausLike.{u} P) : TopologicalSpace ((forget (CompHausLike P)).obj X) := inferInstanceAs (TopologicalSpace X.toTop) -- Note (#10754): Lean does not see through the forgetful functor here instance (X : CompHausLike.{u} P) : CompactSpace ((forget (CompHausLike P)).obj X) := inferInstanceAs (CompactSpace X.toTop) -- Note (#10754): Lean does not see through the forgetful functor here instance (X : CompHausLike.{u} P) : T2Space ((forget (CompHausLike P)).obj X) := inferInstanceAs (T2Space X.toTop) variable {P} /-- If `P` imples `P'`, then there is a functor from `CompHausLike P` to `CompHausLike P'`. -/ @[simps] def toCompHausLike {P P' : TopCat → Prop} (h : ∀ (X : CompHausLike P), P X.toTop → P' X.toTop) : CompHausLike P ⥤ CompHausLike P' where obj X := have : HasProp P' X := ⟨(h _ X.prop)⟩ CompHausLike.of _ X map f := f section variable {P P' : TopCat → Prop} (h : ∀ (X : CompHausLike P), P X.toTop → P' X.toTop) /-- If `P` imples `P'`, then the functor from `CompHausLike P` to `CompHausLike P'` is fully faithful. -/ def fullyFaithfulToCompHausLike : (toCompHausLike h).FullyFaithful := fullyFaithfulInducedFunctor _ instance : (toCompHausLike h).Full := (fullyFaithfulToCompHausLike h).full instance : (toCompHausLike h).Faithful := (fullyFaithfulToCompHausLike h).faithful end variable (P) /-- The fully faithful embedding of `CompHausLike P` in `TopCat`. -/ @[simps!] def compHausLikeToTop : CompHausLike.{u} P ⥤ TopCat.{u} := inducedFunctor _ -- deriving Full, Faithful -- Porting note: deriving fails, adding manually. example {P P' : TopCat → Prop} (h : ∀ (X : CompHausLike P), P X.toTop → P' X.toTop) : toCompHausLike h ⋙ compHausLikeToTop P' = compHausLikeToTop P := rfl /-- The functor from `CompHausLike P` to `TopCat` is fully faithful. -/ def fullyFaithfulCompHausLikeToTop : (compHausLikeToTop P).FullyFaithful := fullyFaithfulInducedFunctor _ instance : (compHausLikeToTop P).Full := inferInstanceAs (inducedFunctor _).Full instance : (compHausLikeToTop P).Faithful := inferInstanceAs (inducedFunctor _).Faithful instance (X : CompHausLike P) : CompactSpace ((compHausLikeToTop P).obj X) := inferInstanceAs (CompactSpace X.toTop) instance (X : CompHausLike P) : T2Space ((compHausLikeToTop P).obj X) := inferInstanceAs (T2Space X.toTop) variable {P} theorem epi_of_surjective {X Y : CompHausLike.{u} P} (f : X ⟶ Y) (hf : Function.Surjective f) : Epi f := by rw [← CategoryTheory.epi_iff_surjective] at hf exact (forget (CompHausLike P)).epi_of_epi_map hf theorem mono_iff_injective {X Y : CompHausLike.{u} P} (f : X ⟶ Y) : Mono f ↔ Function.Injective f := by constructor · intro hf x₁ x₂ h let g₁ : X ⟶ X := ⟨fun _ => x₁, continuous_const⟩ let g₂ : X ⟶ X := ⟨fun _ => x₂, continuous_const⟩ have : g₁ ≫ f = g₂ ≫ f := by ext; exact h exact ContinuousMap.congr_fun ((cancel_mono _).mp this) x₁ · rw [← CategoryTheory.mono_iff_injective] apply (forget (CompHausLike P)).mono_of_mono_map /-- Any continuous function on compact Hausdorff spaces is a closed map. -/ theorem isClosedMap {X Y : CompHausLike.{u} P} (f : X ⟶ Y) : IsClosedMap f := fun _ hC => (hC.isCompact.image f.continuous).isClosed /-- Any continuous bijection of compact Hausdorff spaces is an isomorphism. -/ theorem isIso_of_bijective {X Y : CompHausLike.{u} P} (f : X ⟶ Y) (bij : Function.Bijective f) : IsIso f := by let E := Equiv.ofBijective _ bij have hE : Continuous E.symm := by rw [continuous_iff_isClosed] intro S hS rw [← E.image_eq_preimage] exact isClosedMap f S hS refine ⟨⟨⟨E.symm, hE⟩, ?_, ?_⟩⟩ · ext x apply E.symm_apply_apply · ext x apply E.apply_symm_apply instance forget_reflectsIsomorphisms : (forget (CompHausLike.{u} P)).ReflectsIsomorphisms := ⟨by intro A B f hf; exact isIso_of_bijective _ ((isIso_iff_bijective f).mp hf)⟩ /-- Any continuous bijection of compact Hausdorff spaces induces an isomorphism. -/ noncomputable def isoOfBijective {X Y : CompHausLike.{u} P} (f : X ⟶ Y) (bij : Function.Bijective f) : X ≅ Y := letI := isIso_of_bijective _ bij asIso f /-- Construct an isomorphism from a homeomorphism. -/ @[simps!] def isoOfHomeo {X Y : CompHausLike.{u} P} (f : X ≃ₜ Y) : X ≅ Y := (fullyFaithfulCompHausLikeToTop P).preimageIso (TopCat.isoOfHomeo f) /-- Construct a homeomorphism from an isomorphism. -/ @[simps!] def homeoOfIso {X Y : CompHausLike.{u} P} (f : X ≅ Y) : X ≃ₜ Y := TopCat.homeoOfIso <| (compHausLikeToTop P).mapIso f /-- The equivalence between isomorphisms in `CompHaus` and homeomorphisms of topological spaces. -/ @[simps] def isoEquivHomeo {X Y : CompHausLike.{u} P} : (X ≅ Y) ≃ (X ≃ₜ Y) where toFun := homeoOfIso invFun := isoOfHomeo left_inv _ := rfl right_inv _ := rfl end CompHausLike
Topology\Category\CompHausLike\EffectiveEpi.lean
/- Copyright (c) 2024 Dagur Asgeirsson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz, Dagur Asgeirsson -/ import Mathlib.CategoryTheory.Sites.Coherent.Comparison import Mathlib.Topology.Category.CompHausLike.Limits /-! # Effective epimorphisms in `CompHausLike` In any category of compact Hausdorff spaces, continuous surjections are effective epimorphisms. We deduce that if the converse holds and explicit pullbacks exist, then `CompHausLike P` is preregular. If furthermore explicit finite coproducts exist, then `CompHausLike P` is precoherent. -/ universe u open CategoryTheory Limits attribute [local instance] ConcreteCategory.instFunLike namespace CompHausLike variable {P : TopCat.{u} → Prop} /-- If `π` is a surjective morphism in `CompHausLike P`, then it is an effective epi. -/ noncomputable def effectiveEpiStruct {B X : CompHausLike P} (π : X ⟶ B) (hπ : Function.Surjective π) : EffectiveEpiStruct π where desc e h := (QuotientMap.of_surjective_continuous hπ π.continuous).lift e fun a b hab ↦ DFunLike.congr_fun (h ⟨fun _ ↦ a, continuous_const⟩ ⟨fun _ ↦ b, continuous_const⟩ (by ext; exact hab)) a fac e h := ((QuotientMap.of_surjective_continuous hπ π.continuous).lift_comp e fun a b hab ↦ DFunLike.congr_fun (h ⟨fun _ ↦ a, continuous_const⟩ ⟨fun _ ↦ b, continuous_const⟩ (by ext; exact hab)) a) uniq e h g hm := by suffices g = (QuotientMap.of_surjective_continuous hπ π.continuous).liftEquiv ⟨e, fun a b hab ↦ DFunLike.congr_fun (h ⟨fun _ ↦ a, continuous_const⟩ ⟨fun _ ↦ b, continuous_const⟩ (by ext; exact hab)) a⟩ by assumption rw [← Equiv.symm_apply_eq (QuotientMap.of_surjective_continuous hπ π.continuous).liftEquiv] ext simp only [QuotientMap.liftEquiv_symm_apply_coe, ContinuousMap.comp_apply, ← hm] rfl theorem preregular [HasExplicitPullbacks P] (hs : ∀ ⦃X Y : CompHausLike P⦄ (f : X ⟶ Y), EffectiveEpi f → Function.Surjective f) : Preregular (CompHausLike P) where exists_fac := by intro X Y Z f π hπ refine ⟨pullback f π, pullback.fst f π, ⟨⟨effectiveEpiStruct _ ?_⟩⟩, pullback.snd f π, (pullback.condition _ _).symm⟩ intro y obtain ⟨z, hz⟩ := hs π hπ (f y) exact ⟨⟨(y, z), hz.symm⟩, rfl⟩ theorem precoherent [HasExplicitPullbacks P] [HasExplicitFiniteCoproducts.{0} P] (hs : ∀ ⦃X Y : CompHausLike P⦄ (f : X ⟶ Y), EffectiveEpi f → Function.Surjective f) : Precoherent (CompHausLike P) := by have : Preregular (CompHausLike P) := preregular hs infer_instance end CompHausLike
Topology\Category\CompHausLike\Limits.lean
/- Copyright (c) 2024 Dagur Asgeirsson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz, Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca -/ import Mathlib.CategoryTheory.Extensive import Mathlib.CategoryTheory.Limits.Preserves.Finite import Mathlib.Topology.Category.CompHausLike.Basic /-! # Explicit limits and colimits This file collects some constructions of explicit limits and colimits in `CompHausLike P`, which may be useful due to their definitional properties. ## Main definitions * `HasExplicitFiniteCoproducts`: A typeclass describing the property that forming all finite disjoint unions is stable under the property `P`. - Given this property, we deduce that `CompHausLike P` has finite coproducts and the inclusion functors to other `CompHausLike P'` and to `TopCat` preserve them. * `HasExplicitPullbacks`: A typeclass describing the property that forming all "explicit pullbacks" is stable under the property `P`. Here, explicit pullbacks are defined as a subset of the product. - Given this property, we deduce that `CompHausLike P` has pullbacks and the inclusion functors to other `CompHausLike P'` and to `TopCat` preserve them. - We also define a variant `HasExplicitPullbacksOfInclusions` which is says that explicit pullbacks along inclusion maps into finite disjoint unions exist. `Stonean` has this property but not the stronger one. ## Main results * Given `[HasExplicitPullbacksOfInclusions P]` (which is implied by `[HasExplicitPullbacks P]`), we provide an instance `FinitaryExtensive (CompHausLike P)`. -/ namespace CompHausLike universe w u open CategoryTheory Limits attribute [local instance] ConcreteCategory.instFunLike section FiniteCoproducts variable {P : TopCat.{max u w} → Prop} {α : Type w} [Finite α] (X : α → CompHausLike P) /-- A typeclass describing the property that forming the disjoint union is stable under the property `P`. -/ abbrev HasExplicitFiniteCoproduct := HasProp P (Σ (a : α), X a) variable [HasExplicitFiniteCoproduct X] /-- The coproduct of a finite family of objects in `CompHaus`, constructed as the disjoint union with its usual topology. -/ def finiteCoproduct : CompHausLike P := CompHausLike.of P (Σ (a : α), X a) /-- The inclusion of one of the factors into the explicit finite coproduct. -/ def finiteCoproduct.ι (a : α) : X a ⟶ finiteCoproduct X where toFun := fun x ↦ ⟨a, x⟩ continuous_toFun := continuous_sigmaMk (σ := fun a ↦ X a) /-- To construct a morphism from the explicit finite coproduct, it suffices to specify a morphism from each of its factors. This is essentially the universal property of the coproduct. -/ def finiteCoproduct.desc {B : CompHausLike P} (e : (a : α) → (X a ⟶ B)) : finiteCoproduct X ⟶ B where toFun := fun ⟨a, x⟩ ↦ e a x continuous_toFun := by apply continuous_sigma intro a; exact (e a).continuous @[reassoc (attr := simp)] lemma finiteCoproduct.ι_desc {B : CompHausLike P} (e : (a : α) → (X a ⟶ B)) (a : α) : finiteCoproduct.ι X a ≫ finiteCoproduct.desc X e = e a := rfl lemma finiteCoproduct.hom_ext {B : CompHausLike P} (f g : finiteCoproduct X ⟶ B) (h : ∀ a : α, finiteCoproduct.ι X a ≫ f = finiteCoproduct.ι X a ≫ g) : f = g := by ext ⟨a, x⟩ specialize h a apply_fun (fun q ↦ q x) at h exact h /-- The coproduct cocone associated to the explicit finite coproduct. -/ abbrev finiteCoproduct.cofan : Limits.Cofan X := Cofan.mk (finiteCoproduct X) (finiteCoproduct.ι X) /-- The explicit finite coproduct cocone is a colimit cocone. -/ def finiteCoproduct.isColimit : Limits.IsColimit (finiteCoproduct.cofan X) := mkCofanColimit _ (fun s ↦ desc _ fun a ↦ s.inj a) (fun _ _ ↦ ι_desc _ _ _) fun _ _ hm ↦ finiteCoproduct.hom_ext _ _ _ fun a ↦ (DFunLike.ext _ _ fun t ↦ congrFun (congrArg DFunLike.coe (hm a)) t) lemma finiteCoproduct.ι_injective (a : α) : Function.Injective (finiteCoproduct.ι X a) := by intro x y hxy exact eq_of_heq (Sigma.ext_iff.mp hxy).2 lemma finiteCoproduct.ι_jointly_surjective (R : finiteCoproduct X) : ∃ (a : α) (r : X a), R = finiteCoproduct.ι X a r := ⟨R.fst, R.snd, rfl⟩ lemma finiteCoproduct.ι_desc_apply {B : CompHausLike P} {π : (a : α) → X a ⟶ B} (a : α) : ∀ x, finiteCoproduct.desc X π (finiteCoproduct.ι X a x) = π a x := by intro x change (ι X a ≫ desc X π) _ = _ simp only [ι_desc] instance : HasCoproduct X where exists_colimit := ⟨finiteCoproduct.cofan X, finiteCoproduct.isColimit X⟩ variable (P) in /-- A typeclass describing the property that forming all finite disjoint unions is stable under the property `P`. -/ class HasExplicitFiniteCoproducts : Prop where hasProp {α : Type w} [Finite α] (X : α → CompHausLike.{max u w} P) : HasExplicitFiniteCoproduct X /- This linter complains that the universes `u` and `w` only occur together, but `w` appears by itself in the indexing type of the coproduct. In almost all cases, `w` will be either `0` or `u`, but we want to allow both possibilities. -/ attribute [nolint checkUnivs] HasExplicitFiniteCoproducts attribute [instance] HasExplicitFiniteCoproducts.hasProp instance [HasExplicitFiniteCoproducts.{w} P] (α : Type w) [Finite α] : HasColimitsOfShape (Discrete α) (CompHausLike P) where has_colimit _ := hasColimitOfIso Discrete.natIsoFunctor instance [HasExplicitFiniteCoproducts.{w} P] : HasFiniteCoproducts (CompHausLike.{max u w} P) where out n := by let α := ULift.{w} (Fin n) let e : Discrete α ≌ Discrete (Fin n) := Discrete.equivalence Equiv.ulift exact hasColimitsOfShape_of_equivalence e variable {P : TopCat.{u} → Prop} [HasExplicitFiniteCoproducts.{0} P] example : HasFiniteCoproducts (CompHausLike.{u} P) := inferInstance /-- The inclusion maps into the explicit finite coproduct are open embeddings. -/ lemma finiteCoproduct.openEmbedding_ι (a : α) : OpenEmbedding (finiteCoproduct.ι X a) := openEmbedding_sigmaMk (σ := fun a ↦ (X a)) /-- The inclusion maps into the abstract finite coproduct are open embeddings. -/ lemma Sigma.openEmbedding_ι (a : α) : OpenEmbedding (Sigma.ι X a) := by refine OpenEmbedding.of_comp _ (homeoOfIso ((colimit.isColimit _).coconePointUniqueUpToIso (finiteCoproduct.isColimit X))).openEmbedding ?_ convert finiteCoproduct.openEmbedding_ι X a ext x change (Sigma.ι X a ≫ _) x = _ simp /-- The functor to `TopCat` preserves finite coproducts if they exist. -/ instance (P) [HasExplicitFiniteCoproducts.{0} P] : PreservesFiniteCoproducts (compHausLikeToTop P) := by refine ⟨fun J hJ ↦ ⟨fun {F} ↦ ?_⟩⟩ suffices PreservesColimit (Discrete.functor (F.obj ∘ Discrete.mk)) (compHausLikeToTop P) from preservesColimitOfIsoDiagram _ Discrete.natIsoFunctor.symm apply preservesColimitOfPreservesColimitCocone (CompHausLike.finiteCoproduct.isColimit _) exact TopCat.sigmaCofanIsColimit _ /-- The functor to another `CompHausLike` preserves finite coproducts if they exist. -/ noncomputable instance {P' : TopCat.{u} → Prop} (h : ∀ (X : CompHausLike P), P X.toTop → P' X.toTop) : PreservesFiniteCoproducts (toCompHausLike h) := by have : PreservesFiniteCoproducts (toCompHausLike h ⋙ compHausLikeToTop P') := inferInstanceAs (PreservesFiniteCoproducts (compHausLikeToTop _)) exact preservesFiniteCoproductsOfReflectsOfPreserves (toCompHausLike h) (compHausLikeToTop P') end FiniteCoproducts section Pullbacks variable {P : TopCat.{u} → Prop} {X Y B : CompHausLike P} (f : X ⟶ B) (g : Y ⟶ B) /-- A typeclass describing the property that an explicit pullback is stable under the property `P`. -/ abbrev HasExplicitPullback := HasProp P { xy : X × Y | f xy.fst = g xy.snd } variable [HasExplicitPullback f g] -- (hP : P (TopCat.of { xy : X × Y | f xy.fst = g xy.snd })) /-- The pullback of two morphisms `f,g` in `CompHaus`, constructed explicitly as the set of pairs `(x,y)` such that `f x = g y`, with the topology induced by the product. -/ def pullback : CompHausLike P := letI set := { xy : X × Y | f xy.fst = g xy.snd } haveI : CompactSpace set := isCompact_iff_compactSpace.mp (isClosed_eq (f.continuous.comp continuous_fst) (g.continuous.comp continuous_snd)).isCompact CompHausLike.of P set /-- The projection from the pullback to the first component. -/ def pullback.fst : pullback f g ⟶ X where toFun := fun ⟨⟨x, _⟩, _⟩ ↦ x continuous_toFun := Continuous.comp continuous_fst continuous_subtype_val /-- The projection from the pullback to the second component. -/ def pullback.snd : pullback f g ⟶ Y where toFun := fun ⟨⟨_,y⟩,_⟩ ↦ y continuous_toFun := Continuous.comp continuous_snd continuous_subtype_val @[reassoc] lemma pullback.condition : pullback.fst f g ≫ f = pullback.snd f g ≫ g := by ext ⟨_,h⟩; exact h /-- Construct a morphism to the explicit pullback given morphisms to the factors which are compatible with the maps to the base. This is essentially the universal property of the pullback. -/ def pullback.lift {Z : CompHausLike P} (a : Z ⟶ X) (b : Z ⟶ Y) (w : a ≫ f = b ≫ g) : Z ⟶ pullback f g where toFun := fun z ↦ ⟨⟨a z, b z⟩, by apply_fun (fun q ↦ q z) at w; exact w⟩ continuous_toFun := by apply Continuous.subtype_mk rw [continuous_prod_mk] exact ⟨a.continuous, b.continuous⟩ @[reassoc (attr := simp)] lemma pullback.lift_fst {Z : CompHausLike P} (a : Z ⟶ X) (b : Z ⟶ Y) (w : a ≫ f = b ≫ g) : pullback.lift f g a b w ≫ pullback.fst f g = a := rfl @[reassoc (attr := simp)] lemma pullback.lift_snd {Z : CompHausLike P} (a : Z ⟶ X) (b : Z ⟶ Y) (w : a ≫ f = b ≫ g) : pullback.lift f g a b w ≫ pullback.snd f g = b := rfl lemma pullback.hom_ext {Z : CompHausLike P} (a b : Z ⟶ pullback f g) (hfst : a ≫ pullback.fst f g = b ≫ pullback.fst f g) (hsnd : a ≫ pullback.snd f g = b ≫ pullback.snd f g) : a = b := by ext z apply_fun (fun q ↦ q z) at hfst hsnd apply Subtype.ext apply Prod.ext · exact hfst · exact hsnd /-- The pullback cone whose cone point is the explicit pullback. -/ @[simps! pt π] def pullback.cone : Limits.PullbackCone f g := Limits.PullbackCone.mk (pullback.fst f g) (pullback.snd f g) (pullback.condition f g) /-- The explicit pullback cone is a limit cone. -/ @[simps! lift] def pullback.isLimit : Limits.IsLimit (pullback.cone f g) := Limits.PullbackCone.isLimitAux _ (fun s ↦ pullback.lift f g s.fst s.snd s.condition) (fun _ ↦ pullback.lift_fst _ _ _ _ _) (fun _ ↦ pullback.lift_snd _ _ _ _ _) (fun _ _ hm ↦ pullback.hom_ext _ _ _ _ (hm .left) (hm .right)) instance : HasLimit (cospan f g) where exists_limit := ⟨⟨pullback.cone f g, pullback.isLimit f g⟩⟩ /-- The functor to `TopCat` creates pullbacks if they exist. -/ noncomputable instance : CreatesLimit (cospan f g) (compHausLikeToTop P) := by refine createsLimitOfFullyFaithfulOfIso (pullback f g) (((TopCat.pullbackConeIsLimit f g).conePointUniqueUpToIso (limit.isLimit _)) ≪≫ Limits.lim.mapIso (?_ ≪≫ (diagramIsoCospan _).symm)) exact Iso.refl _ /-- The functor to `TopCat` preserves pullbacks. -/ noncomputable instance : PreservesLimit (cospan f g) (compHausLikeToTop P) := preservesLimitOfCreatesLimitAndHasLimit _ _ /-- The functor to another `CompHausLike` preserves pullbacks. -/ noncomputable instance {P' : TopCat → Prop} (h : ∀ (X : CompHausLike P), P X.toTop → P' X.toTop) : PreservesLimit (cospan f g) (toCompHausLike h) := by have : PreservesLimit (cospan f g) (toCompHausLike h ⋙ compHausLikeToTop P') := inferInstanceAs (PreservesLimit _ (compHausLikeToTop _)) exact preservesLimitOfReflectsOfPreserves (toCompHausLike h) (compHausLikeToTop P') variable (P) in /-- A typeclass describing the property that forming all explicit pullbacks is stable under the property `P`. -/ class HasExplicitPullbacks : Prop where hasProp {X Y B : CompHausLike P} (f : X ⟶ B) (g : Y ⟶ B) : HasExplicitPullback f g attribute [instance] HasExplicitPullbacks.hasProp instance [HasExplicitPullbacks P] : HasPullbacks (CompHausLike P) where has_limit F := hasLimitOfIso (diagramIsoCospan F).symm variable (P) in /-- A typeclass describing the property that explicit pullbacks along inclusion maps into disjoint unions is stable under the property `P`. -/ class HasExplicitPullbacksOfInclusions [HasExplicitFiniteCoproducts.{0} P] : Prop where hasProp : ∀ {X Y Z : CompHausLike P} (f : Z ⟶ X ⨿ Y), HasExplicitPullback coprod.inl f attribute [instance] HasExplicitPullbacksOfInclusions.hasProp instance [HasExplicitPullbacks P] [HasExplicitFiniteCoproducts.{0} P] : HasExplicitPullbacksOfInclusions P where hasProp _ := inferInstance end Pullbacks section FiniteCoproducts variable {P : TopCat.{u} → Prop} [HasExplicitFiniteCoproducts.{0} P] instance [HasExplicitPullbacksOfInclusions P] : HasPullbacksOfInclusions (CompHausLike P) where hasPullbackInl _ := inferInstance theorem hasPullbacksOfInclusions (hP' : ∀ ⦃X Y B : CompHausLike.{u} P⦄ (f : X ⟶ B) (g : Y ⟶ B) (_ : OpenEmbedding f), HasExplicitPullback f g) : HasExplicitPullbacksOfInclusions P := { hasProp := by intro _ _ _ f apply hP' exact Sigma.openEmbedding_ι _ _ } /-- The functor to `TopCat` preserves pullbacks of inclusions if they exist. -/ noncomputable instance [HasExplicitPullbacksOfInclusions P] : PreservesPullbacksOfInclusions (compHausLikeToTop P) := { preservesPullbackInl := by intros X Y Z f infer_instance } instance [HasExplicitPullbacksOfInclusions P] : FinitaryExtensive (CompHausLike P) := finitaryExtensive_of_preserves_and_reflects (compHausLikeToTop P) theorem finitaryExtensive (hP' : ∀ ⦃X Y B : CompHausLike.{u} P⦄ (f : X ⟶ B) (g : Y ⟶ B) (_ : OpenEmbedding f), HasExplicitPullback f g) : FinitaryExtensive (CompHausLike P) := have := hasPullbacksOfInclusions hP' finitaryExtensive_of_preserves_and_reflects (compHausLikeToTop P) end FiniteCoproducts section Terminal variable {P : TopCat.{u} → Prop} /-- A one-element space is terminal in `CompHaus` -/ def isTerminalPUnit [HasProp P PUnit.{u+1}] : IsTerminal (CompHausLike.of P PUnit.{u + 1}) := haveI : ∀ X, Unique (X ⟶ CompHausLike.of P PUnit.{u + 1}) := fun _ ↦ ⟨⟨⟨fun _ ↦ PUnit.unit, continuous_const⟩⟩, fun _ ↦ rfl⟩ Limits.IsTerminal.ofUnique _ end Terminal end CompHausLike
Topology\Category\LightProfinite\AsLimit.lean
/- Copyright (c) 2024 Dagur Asgeirsson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Dagur Asgeirsson -/ import Mathlib.Topology.Category.LightProfinite.Basic /-! # Light profinite sets as limits of finite sets. We show that any light profinite set is isomorphic to a sequential limit of finite sets. The limit cone for `S : LightProfinite` is `S.asLimitCone`, the fact that it's a limit is `S.asLimit`. We also prove that the projection and transition maps in this limit are surjective. -/ noncomputable section open CategoryTheory Limits CompHausLike attribute [local instance] ConcreteCategory.instFunLike namespace LightProfinite universe u variable (S : LightProfinite.{u}) /-- The functor `ℕᵒᵖ ⥤ FintypeCat` whose limit is isomorphic to `S`. -/ abbrev fintypeDiagram : ℕᵒᵖ ⥤ FintypeCat := S.toLightDiagram.diagram /-- An abbreviation for `S.fintypeDiagram ⋙ FintypeCat.toProfinite`. -/ abbrev diagram : ℕᵒᵖ ⥤ LightProfinite := S.fintypeDiagram ⋙ FintypeCat.toLightProfinite /-- A cone over `S.diagram` whose cone point is isomorphic to `S`. (Auxiliary definition, use `S.asLimitCone` instead.) -/ def asLimitConeAux : Cone S.diagram := let c : Cone (S.diagram ⋙ lightToProfinite) := S.toLightDiagram.cone let hc : IsLimit c := S.toLightDiagram.isLimit liftLimit hc /-- An auxiliary isomorphism of cones used to prove that `S.asLimitConeAux` is a limit cone. -/ def isoMapCone : lightToProfinite.mapCone S.asLimitConeAux ≅ S.toLightDiagram.cone := let c : Cone (S.diagram ⋙ lightToProfinite) := S.toLightDiagram.cone let hc : IsLimit c := S.toLightDiagram.isLimit liftedLimitMapsToOriginal hc /-- `S.asLimitConeAux` is indeed a limit cone. (Auxiliary definition, use `S.asLimit` instead.) -/ def asLimitAux : IsLimit S.asLimitConeAux := let hc : IsLimit (lightToProfinite.mapCone S.asLimitConeAux) := S.toLightDiagram.isLimit.ofIsoLimit S.isoMapCone.symm isLimitOfReflects lightToProfinite hc /-- A cone over `S.diagram` whose cone point is `S`. -/ def asLimitCone : Cone S.diagram where pt := S π := { app := fun n ↦ (lightToProfiniteFullyFaithful.preimageIso <| (Cones.forget _).mapIso S.isoMapCone).inv ≫ S.asLimitConeAux.π.app n naturality := fun _ _ _ ↦ by simp only [Category.assoc, S.asLimitConeAux.w]; rfl } /-- `S.asLimitCone` is indeed a limit cone. -/ def asLimit : IsLimit S.asLimitCone := S.asLimitAux.ofIsoLimit <| Cones.ext (lightToProfiniteFullyFaithful.preimageIso <| (Cones.forget _).mapIso S.isoMapCone) (fun _ ↦ by rw [← @Iso.inv_comp_eq]; rfl) /-- A bundled version of `S.asLimitCone` and `S.asLimit`. -/ def lim : Limits.LimitCone S.diagram := ⟨S.asLimitCone, S.asLimit⟩ /-- The projection from `S` to the `n`th component of `S.diagram`. -/ abbrev proj (n : ℕ) : S ⟶ S.diagram.obj ⟨n⟩ := S.asLimitCone.π.app ⟨n⟩ lemma lightToProfinite_map_proj_eq (n : ℕ) : lightToProfinite.map (S.proj n) = (lightToProfinite.obj S).asLimitCone.π.app _ := by simp? says simp only [toCompHausLike_obj, Functor.comp_obj, FintypeCat.toLightProfinite_obj_toTop_α, toCompHausLike_map, coe_of] let c : Cone (S.diagram ⋙ lightToProfinite) := S.toLightDiagram.cone let hc : IsLimit c := S.toLightDiagram.isLimit exact liftedLimitMapsToOriginal_inv_map_π hc _ lemma proj_surjective (n : ℕ) : Function.Surjective (S.proj n) := by change Function.Surjective (lightToProfinite.map (S.proj n)) rw [lightToProfinite_map_proj_eq] exact DiscreteQuotient.proj_surjective _ /-- An abbreviation for the `n`th component of `S.diagram`. -/ abbrev component (n : ℕ) : LightProfinite := S.diagram.obj ⟨n⟩ /-- The transition map from `S_{n+1}` to `S_n` in `S.diagram`. -/ abbrev transitionMap (n : ℕ) : S.component (n+1) ⟶ S.component n := S.diagram.map ⟨homOfLE (Nat.le_succ _)⟩ /-- The transition map from `S_m` to `S_n` in `S.diagram`, when `m ≤ n`. -/ abbrev transitionMapLE {n m : ℕ} (h : n ≤ m) : S.component m ⟶ S.component n := S.diagram.map ⟨homOfLE h⟩ lemma proj_comp_transitionMap (n : ℕ) : S.proj (n + 1) ≫ S.diagram.map ⟨homOfLE (Nat.le_succ _)⟩ = S.proj n := S.asLimitCone.w (homOfLE (Nat.le_succ n)).op lemma proj_comp_transitionMap' (n : ℕ) : S.transitionMap n ∘ S.proj (n + 1) = S.proj n := by rw [← S.proj_comp_transitionMap n] rfl lemma proj_comp_transitionMapLE {n m : ℕ} (h : n ≤ m) : S.proj m ≫ S.diagram.map ⟨homOfLE h⟩ = S.proj n := S.asLimitCone.w (homOfLE h).op lemma proj_comp_transitionMapLE' {n m : ℕ} (h : n ≤ m) : S.transitionMapLE h ∘ S.proj m = S.proj n := by rw [← S.proj_comp_transitionMapLE h] rfl lemma surjective_transitionMap (n : ℕ) : Function.Surjective (S.transitionMap n) := by apply Function.Surjective.of_comp (g := S.proj (n + 1)) simpa only [proj_comp_transitionMap'] using S.proj_surjective n lemma surjective_transitionMapLE {n m : ℕ} (h : n ≤ m) : Function.Surjective (S.transitionMapLE h) := by apply Function.Surjective.of_comp (g := S.proj m) simpa only [proj_comp_transitionMapLE'] using S.proj_surjective n end LightProfinite
Topology\Category\LightProfinite\Basic.lean
/- Copyright (c) 2023 Dagur Asgeirsson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Dagur Asgeirsson -/ import Mathlib.CategoryTheory.Limits.Shapes.Countable import Mathlib.Topology.Category.Profinite.AsLimit import Mathlib.Topology.Category.Profinite.CofilteredLimit import Mathlib.Topology.ClopenBox /-! # Light profinite spaces We construct the category `LightProfinite` of light profinite topological spaces. These are implemented as totally disconnected second countable compact Hausdorff spaces. This file also defines the category `LightDiagram`, which consists of those spaces that can be written as a sequential limit (in `Profinite`) of finite sets. We define an equivalence of categories `LightProfinite ≌ LightDiagram` and prove that these are essentially small categories. -/ /- The basic API for `LightProfinite` is largely copied from the API of `Profinite`; where possible, try to keep them in sync -/ universe v u /- Previously, this had accidentally been made a global instance, and we now turn it on locally when convenient. -/ attribute [local instance] CategoryTheory.ConcreteCategory.instFunLike open CategoryTheory Limits Opposite FintypeCat Topology TopologicalSpace CompHausLike /-- `LightProfinite` is the category of second countable profinite spaces. -/ abbrev LightProfinite := CompHausLike (fun X ↦ TotallyDisconnectedSpace X ∧ SecondCountableTopology X) namespace LightProfinite instance (X : Type*) [TopologicalSpace X] [TotallyDisconnectedSpace X] [SecondCountableTopology X] : HasProp (fun Y ↦ TotallyDisconnectedSpace Y ∧ SecondCountableTopology Y) X := ⟨⟨(inferInstance : TotallyDisconnectedSpace X), (inferInstance : SecondCountableTopology X)⟩⟩ /-- Construct a term of `LightProfinite` from a type endowed with the structure of a compact, Hausdorff, totally disconnected and second countable topological space. -/ abbrev of (X : Type*) [TopologicalSpace X] [CompactSpace X] [T2Space X] [TotallyDisconnectedSpace X] [SecondCountableTopology X] : LightProfinite := CompHausLike.of _ X instance : Inhabited LightProfinite := ⟨LightProfinite.of PEmpty⟩ instance {X : LightProfinite} : TotallyDisconnectedSpace X := X.prop.1 instance {X : LightProfinite} : SecondCountableTopology X := X.prop.2 instance {X : LightProfinite} : TotallyDisconnectedSpace ((forget LightProfinite).obj X) := X.prop.1 instance {X : LightProfinite} : SecondCountableTopology ((forget LightProfinite).obj X) := X.prop.2 end LightProfinite /-- The fully faithful embedding of `LightProfinite` in `Profinite`. -/ abbrev lightToProfinite : LightProfinite ⥤ Profinite := CompHausLike.toCompHausLike (fun _ ↦ inferInstance) /-- `lightToProfinite` is fully faithful. -/ abbrev lightToProfiniteFullyFaithful : lightToProfinite.FullyFaithful := fullyFaithfulToCompHausLike _ /-- The fully faithful embedding of `LightProfinite` in `CompHaus`. -/ abbrev lightProfiniteToCompHaus : LightProfinite ⥤ CompHaus := compHausLikeToCompHaus _ /-- The fully faithful embedding of `LightProfinite` in `TopCat`. This is definitionally the same as the obvious composite. -/ abbrev LightProfinite.toTopCat : LightProfinite ⥤ TopCat := CompHausLike.compHausLikeToTop _ section DiscreteTopology attribute [local instance] FintypeCat.botTopology attribute [local instance] FintypeCat.discreteTopology /-- The natural functor from `Fintype` to `LightProfinite`, endowing a finite type with the discrete topology. -/ @[simps!] def FintypeCat.toLightProfinite : FintypeCat ⥤ LightProfinite where obj A := LightProfinite.of A map f := ⟨f, by continuity⟩ attribute [nolint simpNF] FintypeCat.toLightProfinite_map_apply /-- `FintypeCat.toLightProfinite` is fully faithful. -/ def FintypeCat.toLightProfiniteFullyFaithful : toLightProfinite.FullyFaithful where preimage f := (f : _ → _) map_preimage _ := rfl preimage_map _ := rfl instance : FintypeCat.toLightProfinite.Faithful := FintypeCat.toLightProfiniteFullyFaithful.faithful instance : FintypeCat.toLightProfinite.Full := FintypeCat.toLightProfiniteFullyFaithful.full end DiscreteTopology namespace LightProfinite instance {J : Type v} [SmallCategory J] (F : J ⥤ LightProfinite.{max u v}) : TotallyDisconnectedSpace (CompHaus.limitCone.{v, u} (F ⋙ lightProfiniteToCompHaus)).pt.toTop := by change TotallyDisconnectedSpace ({ u : ∀ j : J, F.obj j | _ } : Type _) exact Subtype.totallyDisconnectedSpace /-- An explicit limit cone for a functor `F : J ⥤ LightProfinite`, for a countable category `J` defined in terms of `CompHaus.limitCone`, which is defined in terms of `TopCat.limitCone`. -/ def limitCone {J : Type v} [SmallCategory J] [CountableCategory J] (F : J ⥤ LightProfinite.{max u v}) : Limits.Cone F where pt := { toTop := (CompHaus.limitCone.{v, u} (F ⋙ lightProfiniteToCompHaus)).pt.toTop prop := by constructor · infer_instance · change SecondCountableTopology ({ u : ∀ j : J, F.obj j | _ } : Type _) apply inducing_subtype_val.secondCountableTopology } π := { app := (CompHaus.limitCone.{v, u} (F ⋙ lightProfiniteToCompHaus)).π.app naturality := by intro j k f ext ⟨g, p⟩ exact (p f).symm } /-- The limit cone `LightProfinite.limitCone F` is indeed a limit cone. -/ def limitConeIsLimit {J : Type v} [SmallCategory J] [CountableCategory J] (F : J ⥤ LightProfinite.{max u v}) : Limits.IsLimit (limitCone F) where lift S := (CompHaus.limitConeIsLimit.{v, u} (F ⋙ lightProfiniteToCompHaus)).lift (lightProfiniteToCompHaus.mapCone S) uniq S m h := (CompHaus.limitConeIsLimit.{v, u} _).uniq (lightProfiniteToCompHaus.mapCone S) _ h noncomputable instance createsCountableLimits {J : Type v} [SmallCategory J] [CountableCategory J] : CreatesLimitsOfShape J lightToProfinite.{max v u} where CreatesLimit {F} := have : HasLimitsOfSize Profinite := hasLimitsOfSizeShrink _ createsLimitOfFullyFaithfulOfIso (limitCone.{v, u} F).pt <| (Profinite.limitConeIsLimit.{v, u} (F ⋙ lightToProfinite)).conePointUniqueUpToIso (limit.isLimit _) instance : HasCountableLimits LightProfinite where out _ := { has_limit := fun F ↦ ⟨limitCone F, limitConeIsLimit F⟩ } noncomputable instance : PreservesLimitsOfShape ℕᵒᵖ (forget LightProfinite.{u}) := have : PreservesLimitsOfSize.{0, 0} (forget Profinite.{u}) := preservesLimitsOfSizeShrink _ inferInstanceAs (PreservesLimitsOfShape ℕᵒᵖ (lightToProfinite ⋙ forget Profinite)) variable {X Y : LightProfinite.{u}} (f : X ⟶ Y) /-- Any morphism of light profinite spaces is a closed map. -/ theorem isClosedMap : IsClosedMap f := CompHausLike.isClosedMap _ /-- Any continuous bijection of light profinite spaces induces an isomorphism. -/ theorem isIso_of_bijective (bij : Function.Bijective f) : IsIso f := haveI := CompHausLike.isIso_of_bijective (lightProfiniteToCompHaus.map f) bij isIso_of_fully_faithful lightProfiniteToCompHaus _ /-- Any continuous bijection of light profinite spaces induces an isomorphism. -/ noncomputable def isoOfBijective (bij : Function.Bijective f) : X ≅ Y := letI := LightProfinite.isIso_of_bijective f bij asIso f instance forget_reflectsIsomorphisms : (forget LightProfinite).ReflectsIsomorphisms := by constructor intro A B f hf exact LightProfinite.isIso_of_bijective _ ((isIso_iff_bijective f).mp hf) theorem epi_iff_surjective {X Y : LightProfinite.{u}} (f : X ⟶ Y) : Epi f ↔ Function.Surjective f := by constructor · -- Note: in mathlib3 `contrapose` saw through `Function.Surjective`. dsimp [Function.Surjective] contrapose! rintro ⟨y, hy⟩ hf let C := Set.range f have hC : IsClosed C := (isCompact_range f.continuous).isClosed let U := Cᶜ have hyU : y ∈ U := by refine Set.mem_compl ?_ rintro ⟨y', hy'⟩ exact hy y' hy' have hUy : U ∈ 𝓝 y := hC.compl_mem_nhds hyU obtain ⟨V, hV, hyV, hVU⟩ := isTopologicalBasis_isClopen.mem_nhds_iff.mp hUy classical let Z := of (ULift.{u} <| Fin 2) let g : Y ⟶ Z := ⟨(LocallyConstant.ofIsClopen hV).map ULift.up, LocallyConstant.continuous _⟩ let h : Y ⟶ Z := ⟨fun _ => ⟨1⟩, continuous_const⟩ have H : h = g := by rw [← cancel_epi f] ext x apply ULift.ext dsimp [g, LocallyConstant.ofIsClopen] -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [CategoryTheory.comp_apply, ContinuousMap.coe_mk, CategoryTheory.comp_apply, ContinuousMap.coe_mk, Function.comp_apply, if_neg] refine mt (fun α => hVU α) ?_ simp only [U, C, Set.mem_range_self, not_true, not_false_iff, Set.mem_compl_iff] apply_fun fun e => (e y).down at H dsimp [g, LocallyConstant.ofIsClopen] at H -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [ContinuousMap.coe_mk, ContinuousMap.coe_mk, Function.comp_apply, if_pos hyV] at H exact top_ne_bot H · rw [← CategoryTheory.epi_iff_surjective] apply (forget LightProfinite).epi_of_epi_map end LightProfinite /-- A structure containing the data of sequential limit in `Profinite` of finite sets. -/ structure LightDiagram : Type (u+1) where /-- The indexing diagram. -/ diagram : ℕᵒᵖ ⥤ FintypeCat /-- The limit cone. -/ cone : Cone (diagram ⋙ FintypeCat.toProfinite.{u}) /-- The limit cone is limiting. -/ isLimit : IsLimit cone namespace LightDiagram /-- The underlying `Profinite` of a `LightDiagram`. -/ def toProfinite (S : LightDiagram) : Profinite := S.cone.pt @[simps!] instance : Category LightDiagram := InducedCategory.category toProfinite instance concreteCategory : ConcreteCategory LightDiagram := InducedCategory.concreteCategory _ end LightDiagram /-- The fully faithful embedding `LightDiagram ⥤ Profinite` -/ @[simps!] def lightDiagramToProfinite : LightDiagram ⥤ Profinite := inducedFunctor _ instance : lightDiagramToProfinite.Faithful := show (inducedFunctor _).Faithful from inferInstance instance : lightDiagramToProfinite.Full := show (inducedFunctor _).Full from inferInstance instance {X : LightDiagram} : TopologicalSpace ((forget LightDiagram).obj X) := (inferInstance : TopologicalSpace X.cone.pt) instance {X : LightDiagram} : TotallyDisconnectedSpace ((forget LightDiagram).obj X) := (inferInstance : TotallyDisconnectedSpace X.cone.pt) instance {X : LightDiagram} : CompactSpace ((forget LightDiagram).obj X) := (inferInstance : CompactSpace X.cone.pt ) instance {X : LightDiagram} : T2Space ((forget LightDiagram).obj X) := (inferInstance : T2Space X.cone.pt ) namespace LightProfinite instance (S : LightProfinite) : Countable (Clopens S) := by rw [TopologicalSpace.Clopens.countable_iff_second_countable] infer_instance instance instCountableDiscreteQuotient (S : LightProfinite) : Countable (DiscreteQuotient ((lightToProfinite.obj S))) := (DiscreteQuotient.finsetClopens_inj S).countable /-- A profinite space which is light gives rise to a light profinite space. -/ noncomputable def toLightDiagram (S : LightProfinite.{u}) : LightDiagram.{u} where diagram := sequentialFunctor _ ⋙ (lightToProfinite.obj S).fintypeDiagram cone := (Functor.Initial.limitConeComp (sequentialFunctor _) (lightToProfinite.obj S).lim).cone isLimit := (Functor.Initial.limitConeComp (sequentialFunctor _) (lightToProfinite.obj S).lim).isLimit end LightProfinite /-- The functor part of the equivalence `LightProfinite ≌ LightDiagram` -/ @[simps] noncomputable def lightProfiniteToLightDiagram : LightProfinite.{u} ⥤ LightDiagram.{u} where obj X := X.toLightDiagram map f := f open scoped Classical in instance (S : LightDiagram.{u}) : SecondCountableTopology S.cone.pt := by rw [← TopologicalSpace.Clopens.countable_iff_second_countable] refine @Countable.of_equiv _ _ ?_ (LocallyConstant.equivClopens (X := S.cone.pt)) refine @Function.Surjective.countable (Σ (n : ℕ), LocallyConstant ((S.diagram ⋙ FintypeCat.toProfinite).obj ⟨n⟩) (Fin 2)) _ ?_ ?_ ?_ · apply @instCountableSigma _ _ _ ?_ intro n refine @Finite.to_countable _ ?_ refine @Finite.of_injective _ ((S.diagram ⋙ FintypeCat.toProfinite).obj ⟨n⟩ → (Fin 2)) ?_ _ LocallyConstant.coe_injective refine @Pi.finite _ _ ?_ _ simp only [Functor.comp_obj] exact show (Finite (S.diagram.obj _)) from inferInstance · exact fun a ↦ a.snd.comap (S.cone.π.app ⟨a.fst⟩) · intro a obtain ⟨n, g, h⟩ := Profinite.exists_locallyConstant S.cone S.isLimit a exact ⟨⟨unop n, g⟩, h.symm⟩ /-- The inverse part of the equivalence `LightProfinite ≌ LightDiagram` -/ @[simps] def lightDiagramToLightProfinite : LightDiagram.{u} ⥤ LightProfinite.{u} where obj X := LightProfinite.of X.cone.pt map f := f /-- The equivalence of categories `LightProfinite ≌ LightDiagram` -/ noncomputable def LightProfinite.equivDiagram : LightProfinite.{u} ≌ LightDiagram.{u} where functor := lightProfiniteToLightDiagram inverse := lightDiagramToLightProfinite unitIso := Iso.refl _ counitIso := NatIso.ofComponents (fun X ↦ lightDiagramToProfinite.preimageIso (Iso.refl _)) (by intro _ _ f simp only [Functor.comp_obj, lightDiagramToLightProfinite_obj, lightProfiniteToLightDiagram_obj, Functor.id_obj, Functor.comp_map, lightDiagramToLightProfinite_map, lightProfiniteToLightDiagram_map, lightDiagramToProfinite_obj, Functor.preimageIso_hom, Iso.refl_hom, Functor.id_map] erw [lightDiagramToProfinite.preimage_id, lightDiagramToProfinite.preimage_id, Category.comp_id f]) functor_unitIso_comp _ := by simpa using lightDiagramToProfinite.preimage_id instance : lightProfiniteToLightDiagram.IsEquivalence := show LightProfinite.equivDiagram.functor.IsEquivalence from inferInstance instance : lightDiagramToLightProfinite.IsEquivalence := show LightProfinite.equivDiagram.inverse.IsEquivalence from inferInstance noncomputable section EssentiallySmall open LightDiagram /-- This is an auxiliary definition used to show that `LightDiagram` is essentially small. Note that below we put a category instance on this structure which is completely different from the category instance on `ℕᵒᵖ ⥤ FintypeCat.Skeleton.{u}`. Neither the morphisms nor the objects are the same. -/ structure LightDiagram' : Type u where /-- The diagram takes values in a small category equivalent to `FintypeCat`. -/ diagram : ℕᵒᵖ ⥤ FintypeCat.Skeleton.{u} /-- A `LightDiagram'` yields a `Profinite`. -/ def LightDiagram'.toProfinite (S : LightDiagram') : Profinite := limit (S.diagram ⋙ FintypeCat.Skeleton.equivalence.functor ⋙ FintypeCat.toProfinite.{u}) instance : Category LightDiagram' := InducedCategory.category LightDiagram'.toProfinite /-- The functor part of the equivalence of categories `LightDiagram' ≌ LightDiagram`. -/ def LightDiagram'.toLightFunctor : LightDiagram'.{u} ⥤ LightDiagram.{u} where obj X := ⟨X.diagram ⋙ Skeleton.equivalence.functor, _, limit.isLimit _⟩ map f := f instance : LightDiagram'.toLightFunctor.{u}.Faithful := ⟨id⟩ instance : LightDiagram'.toLightFunctor.{u}.Full where map_surjective f := ⟨f, rfl⟩ instance : LightDiagram'.toLightFunctor.{u}.EssSurj where mem_essImage Y := ⟨⟨Y.diagram ⋙ Skeleton.equivalence.inverse⟩, ⟨lightDiagramToProfinite.preimageIso ( (Limits.lim.mapIso (isoWhiskerRight ((isoWhiskerLeft Y.diagram Skeleton.equivalence.counitIso)) toProfinite)) ≪≫ (limit.isLimit _).conePointUniqueUpToIso Y.isLimit)⟩⟩ instance : LightDiagram'.toLightFunctor.IsEquivalence where /-- The equivalence beween `LightDiagram` and a small category. -/ def LightDiagram.equivSmall : LightDiagram.{u} ≌ LightDiagram'.{u} := LightDiagram'.toLightFunctor.asEquivalence.symm instance : EssentiallySmall.{u} LightDiagram.{u} where equiv_smallCategory := ⟨LightDiagram', inferInstance, ⟨LightDiagram.equivSmall⟩⟩ instance : EssentiallySmall.{u} LightProfinite.{u} where equiv_smallCategory := ⟨LightDiagram', inferInstance, ⟨LightProfinite.equivDiagram.trans LightDiagram.equivSmall⟩⟩ end EssentiallySmall
Topology\Category\LightProfinite\EffectiveEpi.lean
/- Copyright (c) 2023 Dagur Asgeirsson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Dagur Asgeirsson -/ import Mathlib.Topology.Category.CompHausLike.EffectiveEpi import Mathlib.Topology.Category.LightProfinite.Limits /-! # Effective epimorphisms in `LightProfinite` This file proves that `EffectiveEpi` and `Surjective` are equivalent in `LightProfinite`. As a consequence we deduce from the material in `Mathlib.Topology.Category.CompHausLike.EffectiveEpi` that `LightProfinite` is `Preregular` and `Precoherent`. -/ universe u open CategoryTheory Limits CompHausLike attribute [local instance] ConcreteCategory.instFunLike namespace LightProfinite theorem effectiveEpi_iff_surjective {X Y : LightProfinite.{u}} (f : X ⟶ Y) : EffectiveEpi f ↔ Function.Surjective f := by refine ⟨fun h ↦ ?_, fun h ↦ ⟨⟨effectiveEpiStruct f h⟩⟩⟩ rw [← epi_iff_surjective] infer_instance instance : Preregular LightProfinite.{u} := by apply CompHausLike.preregular intro _ _ f exact (effectiveEpi_iff_surjective f).mp example : Precoherent LightProfinite.{u} := inferInstance end LightProfinite
Topology\Category\LightProfinite\Limits.lean
/- Copyright (c) 2024 Dagur Asgeirsson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Dagur Asgeirsson -/ import Mathlib.Topology.Category.CompHausLike.Limits import Mathlib.Topology.Category.LightProfinite.Basic /-! # Explicit limits and colimits This file applies the general API for explicit limits and colimits in `CompHausLike P` (see the file `Mathlib.Topology.Category.CompHausLike.Limits`) to the special case of `LightProfinite`. -/ namespace LightProfinite universe u w open CategoryTheory Limits CompHausLike instance : HasExplicitPullbacks (fun Y ↦ TotallyDisconnectedSpace Y ∧ SecondCountableTopology Y) where hasProp _ _ := { hasProp := ⟨show TotallyDisconnectedSpace {_xy : _ | _} from inferInstance, show SecondCountableTopology {_xy : _ | _} from inferInstance⟩ } instance : HasExplicitFiniteCoproducts.{w, u} (fun Y ↦ TotallyDisconnectedSpace Y ∧ SecondCountableTopology Y) where hasProp _ := { hasProp := ⟨show TotallyDisconnectedSpace (Σ (_a : _), _) from inferInstance, show SecondCountableTopology (Σ (_a : _), _) from inferInstance⟩ } /-- A one-element space is terminal in `Profinite` -/ abbrev isTerminalPUnit : IsTerminal (LightProfinite.of PUnit.{u + 1}) := CompHausLike.isTerminalPUnit example : FinitaryExtensive LightProfinite.{u} := inferInstance noncomputable example : PreservesFiniteCoproducts lightProfiniteToCompHaus.{u} := inferInstance end LightProfinite