source
stringlengths
17
118
lean4
stringlengths
0
335k
.lake/packages/mathlib/Mathlib/Topology/Algebra/FilterBasis.lean
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] GroupFilterBasis /-- `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 f s ↦ 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 * x) • V ∈ (a * x) • B.filter := smul_set_mem_smul_filter <| B.mem_filter_of_mem V_in _ = a • x • V := smul_smul .. |>.symm _ ⊆ a • (V * V) := smul_set_mono <| smul_set_subset_smul hx _ ⊆ a • U := smul_set_mono hVU @[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 an additive group is endowed with a topological structure coming from an additive group filter basis, then it's an additive topological group. -/] instance (priority := 100) isTopologicalGroup (B : GroupFilterBasis G) : @IsTopologicalGroup G B.topology _ := by letI := B.topology have basis := B.nhds_one_hasBasis have basis' := basis.prod basis refine IsTopologicalGroup.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 @[to_additive] lemma t2Space_iff [t : TopologicalSpace G] (F : GroupFilterBasis G) (hG : F.topology = t) : T2Space G ↔ ⋂₀ F.sets = {1} := by have : IsTopologicalGroup G := hG ▸ F.isTopologicalGroup rw [IsTopologicalGroup.t2Space_iff_one_closed, ← closure_eq_iff_isClosed, R0Space.closure_singleton, ← hG, F.nhds_one_eq, FilterBasis.ker_filter] @[to_additive] lemma t2Space_iff_sInter_subset [t : TopologicalSpace G] (F : GroupFilterBasis G) (hG : F.topology = t) : T2Space G ↔ ⋂₀ F.sets ⊆ {1} := by rw [F.t2Space_iff hG, subset_antisymm_iff, and_iff_left_iff_imp] rintro - simpa using fun _ ↦ F.one 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 B s ↦ 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) : @IsTopologicalRing 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 IsTopologicalRing.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 B s ↦ 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 additive 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*} [IsTopologicalRing R] [TopologicalSpace M] [IsTopologicalAddGroup 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 [IsTopologicalRing 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
.lake/packages/mathlib/Mathlib/Topology/Algebra/UniformField.lean
import Mathlib.RingTheory.SimpleRing.Basic 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.IsTopologicalDivisionRing`. -/ 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 : Prop extends T0Space K 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) := (isUniformEmbedding_coe K).injective.nontrivial variable {K} /-- extension of inversion to the completion of a field. -/ def hatInv : hat K → hat K := isDenseInducing_coe.extend fun x : K => (↑x⁻¹ : hat K) @[fun_prop] theorem continuous_hatInv [CompletableTopField K] {x : hat K} (h : x ≠ 0) : ContinuousAt hatInv x := by refine isDenseInducing_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 := isDenseInducing_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 rw [isDenseInducing_coe.nhds_eq_comap (0 : K), ← Filter.comap_inf] norm_cast rw [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 [IsTopologicalDivisionRing K] theorem hatInv_extends {x : K} (h : x ≠ 0) : hatInv (x : hat K) = ↑(x⁻¹ : K) := isDenseInducing_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 (isDenseEmbedding_coe.injective H) variable [IsUniformAddGroup 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 fun_prop (disch := assumption) have clo : x ∈ closure (c '' {0}ᶜ) := by have := isDenseInducing_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 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 _ _ => rfl qsmul := _ qsmul_def := fun _ _ => rfl instance : IsTopologicalDivisionRing (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 : IsUniformInducing i := isUniformEmbedding_subtype_val.isUniformInducing 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.isInducing.nhds_eq_comap, inf_F, Filter.map_bot] instance (priority := 100) completableTopField_of_complete (L : Type*) [Field L] [UniformSpace L] [IsTopologicalDivisionRing 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' variable {α β : Type*} [Field β] [b : UniformSpace β] [CompletableTopField β] [Field α] /-- The pullback of a completable topological field along a uniform inducing ring homomorphism is a completable topological field. -/ theorem IsUniformInducing.completableTopField [UniformSpace α] [T0Space α] {f : α →+* β} (hf : IsUniformInducing f) : CompletableTopField α := by refine CompletableTopField.mk (fun F F_cau inf_F => ?_) rw [← IsUniformInducing.cauchy_map_iff hf] at F_cau ⊢ have h_comm : (f ∘ fun x => x⁻¹) = (fun x => x⁻¹) ∘ f := by ext; simp only [Function.comp_apply, map_inv₀] rw [Filter.map_comm h_comm] apply CompletableTopField.nice _ F_cau rw [← Filter.push_pull', ← map_zero f, ← hf.isInducing.nhds_eq_comap, inf_F, Filter.map_bot]
.lake/packages/mathlib/Mathlib/Topology/Algebra/NonUnitalAlgebra.lean
import Mathlib.Algebra.Algebra.NonUnitalSubalgebra import Mathlib.Topology.Algebra.Module.Basic /-! # Non-unital topological (sub)algebras A non-unital topological algebra over a topological semiring `R` is a topological (non-unital) semiring with a compatible continuous scalar multiplication by elements of `R`. We reuse typeclass `ContinuousSMul` to express the latter condition. ## Results Any non-unital subalgebra of a non-unital topological algebra is itself a non-unital topological algebra, and its closure is again a non-unital subalgebra. -/ namespace NonUnitalSubalgebra section Semiring variable {R A B : Type*} [CommSemiring R] [TopologicalSpace A] variable [NonUnitalSemiring A] [Module R A] [IsTopologicalSemiring A] variable [ContinuousConstSMul R A] instance instIsTopologicalSemiring (s : NonUnitalSubalgebra R A) : IsTopologicalSemiring s := s.toNonUnitalSubsemiring.instIsTopologicalSemiring /-- The (topological) closure of a non-unital subalgebra of a non-unital topological algebra is itself a non-unital subalgebra. -/ def topologicalClosure (s : NonUnitalSubalgebra R A) : NonUnitalSubalgebra R A := { s.toNonUnitalSubsemiring.topologicalClosure, s.toSubmodule.topologicalClosure with carrier := _root_.closure (s : Set A) } theorem le_topologicalClosure (s : NonUnitalSubalgebra R A) : s ≤ s.topologicalClosure := subset_closure theorem isClosed_topologicalClosure (s : NonUnitalSubalgebra R A) : IsClosed (s.topologicalClosure : Set A) := isClosed_closure theorem topologicalClosure_minimal {s t : NonUnitalSubalgebra R A} (h : s ≤ t) (ht : IsClosed (t : Set A)) : s.topologicalClosure ≤ t := closure_minimal h ht /-- If a non-unital subalgebra of a non-unital topological algebra is commutative, then so is its topological closure. See note [reducible non-instances]. -/ abbrev nonUnitalCommSemiringTopologicalClosure [T2Space A] (s : NonUnitalSubalgebra R A) (hs : ∀ x y : s, x * y = y * x) : NonUnitalCommSemiring s.topologicalClosure := s.toNonUnitalSubsemiring.nonUnitalCommSemiringTopologicalClosure hs variable [TopologicalSpace B] [NonUnitalSemiring B] [Module R B] [IsTopologicalSemiring B] [ContinuousConstSMul R B] (s : NonUnitalSubalgebra R A) {φ : A →ₙₐ[R] B} lemma map_topologicalClosure_le (hφ : Continuous φ) : map φ s.topologicalClosure ≤ (map φ s).topologicalClosure := image_closure_subset_closure_image hφ lemma topologicalClosure_map_le (hφ : IsClosedMap φ) : (map φ s).topologicalClosure ≤ map φ s.topologicalClosure := hφ.closure_image_subset _ lemma topologicalClosure_map (hφ : IsClosedMap φ) (hφ' : Continuous φ) : (map φ s).topologicalClosure = map φ s.topologicalClosure := SetLike.coe_injective <| hφ.closure_image_eq_of_continuous hφ' _ variable (R) in open NonUnitalAlgebra in lemma topologicalClosure_adjoin_le_centralizer_centralizer [IsScalarTower R A A] [SMulCommClass R A A] [T2Space A] (s : Set A) : (adjoin R s).topologicalClosure ≤ centralizer R (centralizer R s) := topologicalClosure_minimal (adjoin_le_centralizer_centralizer R s) (Set.isClosed_centralizer _) end Semiring section Ring variable {R A : Type*} [CommRing R] [TopologicalSpace A] variable [NonUnitalRing A] [Module R A] [IsTopologicalRing A] variable [ContinuousConstSMul R A] instance instIsTopologicalRing (s : NonUnitalSubalgebra R A) : IsTopologicalRing s := s.toNonUnitalSubring.instIsTopologicalRing /-- If a non-unital subalgebra of a non-unital topological algebra is commutative, then so is its topological closure. See note [reducible non-instances]. -/ abbrev nonUnitalCommRingTopologicalClosure [T2Space A] (s : NonUnitalSubalgebra R A) (hs : ∀ x y : s, x * y = y * x) : NonUnitalCommRing s.topologicalClosure := { s.topologicalClosure.toNonUnitalRing, s.toSubsemigroup.commSemigroupTopologicalClosure hs with } end Ring end NonUnitalSubalgebra namespace NonUnitalAlgebra open NonUnitalSubalgebra variable (R : Type*) {A : Type*} [CommSemiring R] [NonUnitalSemiring A] variable [Module R A] [IsScalarTower R A A] [SMulCommClass R A A] variable [TopologicalSpace A] [IsTopologicalSemiring A] [ContinuousConstSMul R A] /-- The topological closure of the non-unital subalgebra generated by a single element. -/ def elemental (x : A) : NonUnitalSubalgebra R A := adjoin R {x} |>.topologicalClosure namespace elemental @[simp, aesop safe (rule_sets := [SetLike])] theorem self_mem (x : A) : x ∈ elemental R x := le_topologicalClosure _ <| self_mem_adjoin_singleton R x variable {R} in theorem le_of_mem {x : A} {s : NonUnitalSubalgebra R A} (hs : IsClosed (s : Set A)) (hx : x ∈ s) : elemental R x ≤ s := topologicalClosure_minimal (adjoin_le <| by simpa using hx) hs variable {R} in theorem le_iff_mem {x : A} {s : NonUnitalSubalgebra R A} (hs : IsClosed (s : Set A)) : elemental R x ≤ s ↔ x ∈ s := ⟨fun h ↦ h (self_mem R x), fun h ↦ le_of_mem hs h⟩ instance isClosed (x : A) : IsClosed (elemental R x : Set A) := isClosed_topologicalClosure _ instance [T2Space A] {x : A} : NonUnitalCommSemiring (elemental R x) := nonUnitalCommSemiringTopologicalClosure _ letI : NonUnitalCommSemiring (adjoin R {x}) := NonUnitalAlgebra.adjoinNonUnitalCommSemiringOfComm R fun y hy z hz => by rw [Set.mem_singleton_iff] at hy hz rw [hy, hz] fun _ _ => mul_comm _ _ instance {R A : Type*} [CommRing R] [NonUnitalRing A] [Module R A] [IsScalarTower R A A] [SMulCommClass R A A] [TopologicalSpace A] [IsTopologicalRing A] [ContinuousConstSMul R A] [T2Space A] {x : A} : NonUnitalCommRing (elemental R x) where mul_comm := mul_comm instance {A : Type*} [UniformSpace A] [CompleteSpace A] [NonUnitalSemiring A] [IsTopologicalSemiring A] [Module R A] [IsScalarTower R A A] [SMulCommClass R A A] [ContinuousConstSMul R A] (x : A) : CompleteSpace (elemental R x) := isClosed_closure.completeSpace_coe /-- The coercion from an elemental algebra to the full algebra is a `IsClosedEmbedding`. -/ theorem isClosedEmbedding_coe (x : A) : Topology.IsClosedEmbedding ((↑) : elemental R x → A) where eq_induced := rfl injective := Subtype.coe_injective isClosed_range := by simpa using isClosed R x lemma le_centralizer_centralizer [T2Space A] (x : A) : elemental R x ≤ centralizer R (centralizer R {x}) := topologicalClosure_adjoin_le_centralizer_centralizer R {x} end elemental end NonUnitalAlgebra
.lake/packages/mathlib/Mathlib/Topology/Algebra/MulAction.lean
import Mathlib.Algebra.AddTorsor.Defs import Mathlib.GroupTheory.GroupAction.SubMulAction import Mathlib.Topology.Algebra.Constructions import Mathlib.Topology.Algebra.ConstMulAction import Mathlib.Topology.Connected.Basic /-! # 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ˣ`. ## 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] lemma IsScalarTower.continuousSMul {M : Type*} (N : Type*) {α : Type*} [Monoid N] [SMul M N] [MulAction N α] [SMul M α] [IsScalarTower M N α] [TopologicalSpace M] [TopologicalSpace N] [TopologicalSpace α] [ContinuousSMul M N] [ContinuousSMul N α] : ContinuousSMul M α := { continuous_smul := by suffices Continuous (fun p : M × α ↦ (p.1 • (1 : N)) • p.2) by simpa fun_prop } @[to_additive] instance : ContinuousSMul (ULift M) X := ⟨(continuous_smul (M := M)).comp₂ (continuous_uliftDown.comp continuous_fst) continuous_snd⟩ @[to_additive] instance (priority := 100) ContinuousSMul.continuousConstSMul : ContinuousConstSMul M X where continuous_const_smul _ := continuous_smul.comp (continuous_const.prodMk 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_def, 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.prodMk_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.prodMk 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.prodMap 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.prodMap 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 Topology.IsInducing.continuousSMul {N : Type*} [SMul N Y] [TopologicalSpace N] {f : N → M} (hg : IsInducing 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 := IsInducing.subtypeVal.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 := IsInducing.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 := IsInducing.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 variable (M) /-- The stabilizer of a continuous group action on a discrete space is an open subgroup. -/ lemma stabilizer_isOpen [DiscreteTopology X] (x : X) : IsOpen (MulAction.stabilizer M x : Set M) := IsOpen.preimage (f := fun g ↦ g • x) (by fun_prop) (isOpen_discrete {x}) 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)).prodMk (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.prodMk ((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) := let _ := sInf ts { continuous_smul := by -- Porting note: needs `( :)` rw [← (sInf_singleton (a := ‹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] include G in /-- 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
.lake/packages/mathlib/Mathlib/Topology/Algebra/GroupWithZero.lean
import Mathlib.Algebra.Group.Pi.Lemmas import Mathlib.Algebra.GroupWithZero.Units.Equiv import Mathlib.Topology.Algebra.Monoid import Mathlib.Topology.Homeomorph.Lemmas /-! # Topological group with zero In this file we define `ContinuousInv₀` 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 `ContinuousInv₀` 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 `IsTopologicalGroup`s. We also use `'` in the typeclass name `ContinuousInv₀` 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 ContinuousInv₀ (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 ContinuousInv₀ (continuousAt_inv₀) @[deprecated (since := "2025-09-01")] alias HasContinuousInv₀ := ContinuousInv₀ section Inv₀ variable [Zero G₀] [Inv G₀] [TopologicalSpace G₀] [ContinuousInv₀ G₀] {l : Filter α} {f : α → G₀} {s : Set α} {a : α} /-! ### Continuity of `fun x ↦ x⁻¹` at a non-zero point We define `ContinuousInv₀` 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₀ section GroupWithZero variable [GroupWithZero G₀] [TopologicalSpace G₀] [ContinuousInv₀ G₀] /-- 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.isEmbedding_val₀ : IsEmbedding (val : G₀ˣ → G₀) := embedding_val_mk <| (continuousOn_inv₀ (G₀ := G₀)).mono fun _ ↦ IsUnit.ne_zero /-- If a group with zero has continuous inversion, then its group of units is homeomorphic to the set of nonzero elements. -/ noncomputable def unitsHomeomorphNeZero : G₀ˣ ≃ₜ {g : G₀ // g ≠ 0} := Units.isEmbedding_val₀.toHomeomorph.trans <| show _ ≃ₜ {g | _} from .setCongr <| Set.ext fun x ↦ (Units.exists_iff_ne_zero (p := (· = x))).trans <| by simp end GroupWithZero section NhdsInv open scoped Pointwise variable [GroupWithZero G₀] [TopologicalSpace G₀] [ContinuousInv₀ 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, Function.comp_def, 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₀] [ContinuousInv₀ 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 change 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.tendsto.prodMk tendsto_top) · fun_prop (disch := assumption) /-- `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 ContinuousInv₀.of_nhds_one (h : Tendsto Inv.inv (𝓝 (1 : G₀)) (𝓝 1)) : ContinuousInv₀ 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 [Function.comp_def, mul_inv_rev, mul_inv_cancel_right₀ hx'] @[deprecated (since := "2025-09-01")] alias HasContinuousInv₀.of_nhds_one := ContinuousInv₀.of_nhds_one end map_comap section ZPow variable [GroupWithZero G₀] [TopologicalSpace G₀] [ContinuousInv₀ G₀] [ContinuousMul G₀] theorem continuousAt_zpow₀ (x : G₀) (m : ℤ) (h : x ≠ 0 ∨ 0 ≤ m) : ContinuousAt (fun x => x ^ m) x := by rcases 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_ge 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
.lake/packages/mathlib/Mathlib/Topology/Algebra/Order/Support.lean
import Mathlib.Algebra.Order.Group.Indicator import Mathlib.Topology.Algebra.Support /-! # The topological support of sup and inf of functions In a topological space `X` and a space `M` with `Sup` structure, for `f g : X → M` with compact support, we show that `f ⊔ g` has compact support. Similarly, in `β` with `Inf` structure, `f ⊓ g` has compact support if so do `f` and `g`. -/ variable {X M : Type*} [TopologicalSpace X] [One M] section SemilatticeSup variable [SemilatticeSup M] @[to_additive] theorem HasCompactMulSupport.sup {f g : X → M} (hf : HasCompactMulSupport f) (hg : HasCompactMulSupport g) : HasCompactMulSupport (f ⊔ g) := by apply IsCompact.of_isClosed_subset (IsCompact.union hf hg) (isClosed_mulTSupport _) rw [mulTSupport, mulTSupport, mulTSupport, ← closure_union] apply closure_mono exact Function.mulSupport_sup f g end SemilatticeSup section SemilatticeInf variable [SemilatticeInf M] @[to_additive] theorem HasCompactMulSupport.inf {f g : X → M} (hf : HasCompactMulSupport f) (hg : HasCompactMulSupport g) : HasCompactMulSupport (f ⊓ g) := by apply IsCompact.of_isClosed_subset (IsCompact.union hf hg) (isClosed_mulTSupport _) rw [mulTSupport, mulTSupport, mulTSupport, ← closure_union] apply closure_mono exact Function.mulSupport_inf f g end SemilatticeInf
.lake/packages/mathlib/Mathlib/Topology/Algebra/Order/Module.lean
import Mathlib.Algebra.Order.Nonneg.Module import Mathlib.Topology.Algebra.ConstMulAction import Mathlib.Topology.Algebra.MulAction /-! # Continuous nonnegative scalar multiplication -/ variable {R α : Type*} [Semiring R] [PartialOrder R] [SMul R α] [TopologicalSpace α] instance [ContinuousConstSMul R α] : ContinuousConstSMul {r : R // 0 ≤ r} α where continuous_const_smul r := continuous_const_smul r.1 instance [TopologicalSpace R] [ContinuousSMul R α] : ContinuousSMul {r : R // 0 ≤ r} α where continuous_smul := continuous_smul (M := R).comp <| continuous_subtype_val.prodMap continuous_id
.lake/packages/mathlib/Mathlib/Topology/Algebra/Order/Group.lean
import Mathlib.Algebra.Order.Group.Basic import Mathlib.Topology.Algebra.Group.Defs import Mathlib.Topology.Order.LeftRightNhds /-! # Topology on a linear ordered commutative group In this file we prove that a linear ordered 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 Function open scoped Topology variable {G : Type*} [TopologicalSpace G] [CommGroup G] [LinearOrder G] [IsOrderedMonoid G] [OrderTopology G] -- see Note [lower instance priority] @[to_additive] instance (priority := 100) LinearOrderedCommGroup.toIsTopologicalGroup : IsTopologicalGroup G where continuous_mul := by simp only [continuous_iff_continuousAt, Prod.forall, ContinuousAt, LinearOrderedCommGroup.tendsto_nhds] intro a b ε hε rcases dense_or_discrete 1 ε with ⟨δ, hδ₁, hδε⟩ | ⟨-, hε_min⟩ · filter_upwards [(eventually_mabs_div_lt _ hδ₁).prod_nhds (eventually_mabs_div_lt _ (one_lt_div'.mpr hδε))] rintro ⟨c, d⟩ ⟨hc, hd⟩ calc |c * d / (a * b)|ₘ = |(c / a) * (d / b)|ₘ := by rw [div_mul_div_comm] _ ≤ |c / a|ₘ * |d / b|ₘ := mabs_mul_le .. _ < δ * (ε / δ) := mul_lt_mul_of_lt_of_lt hc hd _ = ε := mul_div_cancel .. · have (x : G) : ∀ᶠ y in 𝓝 x, y = x := (eventually_mabs_div_lt _ hε).mono fun y hy ↦ mabs_div_le_one.mp <| hε_min _ hy filter_upwards [(this _).prod_nhds (this _)] simp [hε] continuous_inv := continuous_iff_continuousAt.2 fun a ↦ LinearOrderedCommGroup.tendsto_nhds.2 fun ε ε0 ↦ (eventually_mabs_div_lt a ε0).mono fun x hx ↦ by rwa [inv_div_inv, mabs_div_comm] @[to_additive (attr := continuity)] theorem continuous_mabs : Continuous (mabs : G → G) := continuous_id.max continuous_inv section Tendsto variable {α : Type*} {l : Filter α} {f : α → G} @[to_additive] protected theorem Filter.Tendsto.mabs {a : G} (h : Tendsto f l (𝓝 a)) : Tendsto (fun x => |f x|ₘ) l (𝓝 |a|ₘ) := (continuous_mabs.tendsto _).comp h @[to_additive (attr := simp)] theorem comap_mabs_nhds_one : comap mabs (𝓝 (1 : G)) = 𝓝 1 := by simp [nhds_eq_iInf_mabs_div] @[to_additive] theorem tendsto_one_iff_mabs_tendsto_one (f : α → G) : Tendsto f l (𝓝 1) ↔ Tendsto (mabs ∘ f) l (𝓝 1) := by rw [← tendsto_comap_iff, comap_mabs_nhds_one] end Tendsto variable {X : Type*} [TopologicalSpace X] {f : X → G} {s : Set X} {x : X} @[to_additive (attr := fun_prop)] protected theorem Continuous.mabs (h : Continuous f) : Continuous fun x => |f x|ₘ := continuous_mabs.comp h @[to_additive (attr := fun_prop)] protected theorem ContinuousAt.mabs (h : ContinuousAt f x) : ContinuousAt (fun x => |f x|ₘ) x := Filter.Tendsto.mabs h @[to_additive] protected theorem ContinuousWithinAt.mabs (h : ContinuousWithinAt f s x) : ContinuousWithinAt (fun x => |f x|ₘ) s x := Filter.Tendsto.mabs h @[to_additive (attr := fun_prop)] protected theorem ContinuousOn.mabs (h : ContinuousOn f s) : ContinuousOn (fun x => |f x|ₘ) s := fun x hx => (h x hx).mabs @[to_additive] theorem tendsto_mabs_nhdsNE_one : Tendsto (mabs : G → G) (𝓝[≠] 1) (𝓝[>] 1) := (continuous_mabs.tendsto' (1 : G) 1 mabs_one).inf <| tendsto_principal_principal.2 fun _x => one_lt_mabs.2 /-- In a linearly ordered multiplicative group, the integer powers of an element are dense iff they are the whole group. -/ @[to_additive /-- In a linearly ordered additive group, the integer multiples of an element are dense iff they are the whole group. -/] theorem denseRange_zpow_iff_surjective {a : G} : DenseRange (a ^ · : ℤ → G) ↔ Surjective (a ^ · : ℤ → G) := by refine ⟨fun h ↦ ?_, fun h ↦ h.denseRange⟩ wlog ha₀ : 1 < a generalizing a · simp only [← range_eq_univ, DenseRange] at * rcases (not_lt.1 ha₀).eq_or_lt with rfl | hlt · simpa only [one_zpow, range_const, dense_iff_closure_eq, closure_singleton] using h · have H : range (a⁻¹ ^ · : ℤ → G) = range (a ^ · : ℤ → G) := by simpa only [← inv_zpow, zpow_neg, comp_def] using neg_surjective.range_comp (a ^ · : ℤ → G) rw [← H] apply this <;> simpa only [H, one_lt_inv'] intro b obtain ⟨m, hm, hm'⟩ : ∃ m : ℤ, a ^ m ∈ Ioo b (b * a * a) := by have hne : (Ioo b (b * a * a)).Nonempty := ⟨b * a, by simpa⟩ simpa using h.exists_mem_open isOpen_Ioo hne rcases eq_or_ne b (a ^ (m - 1)) with rfl | hne; · simp suffices (Ioo (a ^ m) (a ^ (m + 1))).Nonempty by rcases h.exists_mem_open isOpen_Ioo this with ⟨l, hl⟩ have : m < l ∧ l < m + 1 := by simpa [zpow_lt_zpow_iff_right ha₀] using hl cutsat rcases hne.lt_or_gt with hlt | hlt · refine ⟨b * a * a, hm', ?_⟩ simpa only [zpow_add, zpow_sub, zpow_one, ← div_eq_mul_inv, lt_div_iff_mul_lt, mul_lt_mul_iff_right] using hlt · use b * a simp only [mem_Ioo, zpow_add, zpow_sub, zpow_one, ← div_eq_mul_inv, mul_lt_mul_iff_right] at hlt ⊢ exact ⟨div_lt_iff_lt_mul.1 hlt, hm⟩ /-- In a nontrivial densely linearly ordered commutative group, the integer powers of an element can't be dense. -/ @[to_additive /-- In a nontrivial densely linearly ordered additive group, the integer multiples of an element can't be dense. -/] theorem not_denseRange_zpow [Nontrivial G] [DenselyOrdered G] {a : G} : ¬DenseRange (a ^ · : ℤ → G) := denseRange_zpow_iff_surjective.not.mpr fun h ↦ not_isCyclic_of_denselyOrdered G ⟨⟨a, h⟩⟩
.lake/packages/mathlib/Mathlib/Topology/Algebra/Order/LiminfLimsup.lean
import Mathlib.Algebra.Order.Group.DenselyOrdered import Mathlib.Data.Real.Archimedean import Mathlib.Topology.Algebra.Group.Basic import Mathlib.Topology.Order.LiminfLimsup /-! # 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 universe u v variable {ι α β R S : Type*} {X : ι → Type*} section LiminfLimsupAdd variable [AddCommGroup α] [ConditionallyCompleteLinearOrder α] [DenselyOrdered α] [AddLeftMono α] {f : Filter ι} [f.NeBot] {u v : ι → α} lemma le_limsup_add (h₁ : IsBoundedUnder (fun x1 x2 ↦ x1 ≤ x2) f u := by isBoundedDefault) (h₂ : IsCoboundedUnder (fun x1 x2 ↦ x1 ≤ x2) f u := by isBoundedDefault) (h₃ : IsBoundedUnder (fun x1 x2 ↦ x1 ≤ x2) f v := by isBoundedDefault) (h₄ : IsBoundedUnder (fun x1 x2 ↦ x1 ≥ x2) f v := by isBoundedDefault) : (limsup u f) + liminf v f ≤ limsup (u + v) f := by have h := isCoboundedUnder_le_add h₄ h₂ -- These `have` tactic improve performance. have h' := isBoundedUnder_le_add h₃ h₁ rw [add_comm] at h h' refine add_le_of_forall_lt fun a a_u b b_v ↦ (le_limsup_iff h h').2 fun c c_ab ↦ ?_ refine ((frequently_lt_of_lt_limsup h₂ a_u).and_eventually (eventually_lt_of_lt_liminf b_v h₄)).mono fun _ ab_x ↦ ?_ exact c_ab.trans (add_lt_add ab_x.1 ab_x.2) lemma limsup_add_le (h₁ : IsBoundedUnder (fun x1 x2 ↦ x1 ≥ x2) f u := by isBoundedDefault) (h₂ : IsBoundedUnder (fun x1 x2 ↦ x1 ≤ x2) f u := by isBoundedDefault) (h₃ : IsCoboundedUnder (fun x1 x2 ↦ x1 ≤ x2) f v := by isBoundedDefault) (h₄ : IsBoundedUnder (fun x1 x2 ↦ x1 ≤ x2) f v := by isBoundedDefault) : limsup (u + v) f ≤ (limsup u f) + limsup v f := by have h := isCoboundedUnder_le_add h₁ h₃ have h' := isBoundedUnder_le_add h₂ h₄ refine le_add_of_forall_lt fun a a_u b b_v ↦ ?_ rw [limsup_le_iff h h'] intro c c_ab filter_upwards [eventually_lt_of_limsup_lt a_u, eventually_lt_of_limsup_lt b_v] with x a_x b_x exact (add_lt_add a_x b_x).trans c_ab lemma le_liminf_add (h₁ : IsBoundedUnder (fun x1 x2 ↦ x1 ≥ x2) f u := by isBoundedDefault) (h₂ : IsBoundedUnder (fun x1 x2 ↦ x1 ≤ x2) f u := by isBoundedDefault) (h₃ : IsBoundedUnder (fun x1 x2 ↦ x1 ≥ x2) f v := by isBoundedDefault) (h₄ : IsCoboundedUnder (fun x1 x2 ↦ x1 ≥ x2) f v := by isBoundedDefault) : (liminf u f) + liminf v f ≤ liminf (u + v) f := by have h := isCoboundedUnder_ge_add h₂ h₄ have h' := isBoundedUnder_ge_add h₁ h₃ refine add_le_of_forall_lt fun a a_u b b_v ↦ ?_ rw [le_liminf_iff h h'] intro c c_ab filter_upwards [eventually_lt_of_lt_liminf a_u, eventually_lt_of_lt_liminf b_v] with x a_x b_x exact c_ab.trans (add_lt_add a_x b_x) lemma liminf_add_le (h₁ : IsBoundedUnder (fun x1 x2 ↦ x1 ≥ x2) f u := by isBoundedDefault) (h₂ : IsBoundedUnder (fun x1 x2 ↦ x1 ≤ x2) f u := by isBoundedDefault) (h₃ : IsBoundedUnder (fun x1 x2 ↦ x1 ≥ x2) f v := by isBoundedDefault) (h₄ : IsCoboundedUnder (fun x1 x2 ↦ x1 ≥ x2) f v := by isBoundedDefault) : liminf (u + v) f ≤ (limsup u f) + liminf v f := by have h := isCoboundedUnder_ge_add h₂ h₄ have h' := isBoundedUnder_ge_add h₁ h₃ refine le_add_of_forall_lt fun a a_u b b_v ↦ (liminf_le_iff h h').2 fun _ c_ab ↦ ?_ refine ((frequently_lt_of_liminf_lt h₄ b_v).and_eventually (eventually_lt_of_limsup_lt a_u h₂)).mono fun _ ab_x ↦ ?_ exact (add_lt_add ab_x.2 ab_x.1).trans c_ab end LiminfLimsupAdd section LiminfLimsupMul open Filter Real variable {f : Filter ι} {u v : ι → ℝ} lemma le_limsup_mul (h₁ : ∃ᶠ x in f, 0 ≤ u x) (h₂ : IsBoundedUnder (fun x1 x2 ↦ x1 ≤ x2) f u) (h₃ : 0 ≤ᶠ[f] v) (h₄ : IsBoundedUnder (fun x1 x2 ↦ x1 ≤ x2) f v) : (limsup u f) * liminf v f ≤ limsup (u * v) f := by have h := IsCoboundedUnder.of_frequently_ge (a := 0) <| (h₁.and_eventually h₃).mono fun x ⟨ux_0, vx_0⟩ ↦ mul_nonneg ux_0 vx_0 have h' := isBoundedUnder_le_mul_of_nonneg h₁ h₂ h₃ h₄ have u0 : 0 ≤ limsup u f := le_limsup_of_frequently_le h₁ h₂ have uv : 0 ≤ limsup (u * v) f := le_limsup_of_frequently_le ((h₁.and_eventually h₃).mono fun _ ⟨hu, hv⟩ ↦ mul_nonneg hu hv) h' refine mul_le_of_forall_lt_of_nonneg u0 uv fun a a0 au b b0 bv ↦ ?_ refine (le_limsup_iff h h').2 fun c c_ab ↦ ?_ replace h₁ := IsCoboundedUnder.of_frequently_ge h₁ -- Pre-compute it to gain 4 s. have h₅ := frequently_lt_of_lt_limsup h₁ au have h₆ := eventually_lt_of_lt_liminf bv (isBoundedUnder_of_eventually_ge h₃) apply (h₅.and_eventually (h₆.and h₃)).mono exact fun x ⟨xa, ⟨xb, _⟩⟩ ↦ c_ab.trans_le <| mul_le_mul xa.le xb.le b0 (a0.trans xa.le) lemma limsup_mul_le (h₁ : ∃ᶠ x in f, 0 ≤ u x) (h₂ : IsBoundedUnder (fun x1 x2 ↦ x1 ≤ x2) f u) (h₃ : 0 ≤ᶠ[f] v) (h₄ : IsBoundedUnder (fun x1 x2 ↦ x1 ≤ x2) f v) : limsup (u * v) f ≤ (limsup u f) * limsup v f := by have h := IsCoboundedUnder.of_frequently_ge (a := 0) <| (h₁.and_eventually h₃).mono fun x ⟨ux_0, vx_0⟩ ↦ mul_nonneg ux_0 vx_0 have h' := isBoundedUnder_le_mul_of_nonneg h₁ h₂ h₃ h₄ refine le_mul_of_forall_lt₀ fun a a_u b b_v ↦ (limsup_le_iff h h').2 fun c c_ab ↦ ?_ filter_upwards [eventually_lt_of_limsup_lt a_u, eventually_lt_of_limsup_lt b_v, h₃] with x x_a x_b v_0 apply lt_of_le_of_lt _ c_ab rcases lt_or_ge (u x) 0 with u_0 | u_0 · apply (mul_nonpos_of_nonpos_of_nonneg u_0.le v_0).trans exact mul_nonneg ((le_limsup_of_frequently_le h₁ h₂).trans a_u.le) (v_0.trans x_b.le) · exact mul_le_mul x_a.le x_b.le v_0 (u_0.trans x_a.le) lemma le_liminf_mul [f.NeBot] (h₁ : 0 ≤ᶠ[f] u) (h₂ : IsBoundedUnder (fun x1 x2 ↦ x1 ≤ x2) f u) (h₃ : 0 ≤ᶠ[f] v) (h₄ : IsCoboundedUnder (fun x1 x2 ↦ x1 ≥ x2) f v) : (liminf u f) * liminf v f ≤ liminf (u * v) f := by have h := isCoboundedUnder_ge_mul_of_nonneg h₁ h₂ h₃ h₄ have h' := isBoundedUnder_of_eventually_ge (a := 0) <| (h₁.and h₃).mono fun x ⟨u0, v0⟩ ↦ mul_nonneg u0 v0 apply mul_le_of_forall_lt_of_nonneg (le_liminf_of_le h₂.isCoboundedUnder_ge h₁) (le_liminf_of_le h ((h₁.and h₃).mono fun x ⟨u0, v0⟩ ↦ mul_nonneg u0 v0)) intro a a0 au b b0 bv refine (le_liminf_iff h h').2 fun c c_ab ↦ ?_ filter_upwards [eventually_lt_of_lt_liminf au (isBoundedUnder_of_eventually_ge h₁), eventually_lt_of_lt_liminf bv (isBoundedUnder_of_eventually_ge h₃)] with x xa xb exact c_ab.trans_le (mul_le_mul xa.le xb.le b0 (a0.trans xa.le)) lemma liminf_mul_le [f.NeBot] (h₁ : 0 ≤ᶠ[f] u) (h₂ : IsBoundedUnder (fun x1 x2 ↦ x1 ≤ x2) f u) (h₃ : 0 ≤ᶠ[f] v) (h₄ : IsCoboundedUnder (fun x1 x2 ↦ x1 ≥ x2) f v) : liminf (u * v) f ≤ (limsup u f) * liminf v f := by have h := isCoboundedUnder_ge_mul_of_nonneg h₁ h₂ h₃ h₄ have h' := isBoundedUnder_of_eventually_ge (a := 0) <| (h₁.and h₃).mono fun x ⟨u_0, v_0⟩ ↦ mul_nonneg u_0 v_0 refine le_mul_of_forall_lt₀ fun a a_u b b_v ↦ (liminf_le_iff h h').2 fun c c_ab ↦ ?_ refine ((frequently_lt_of_liminf_lt h₄ b_v).and_eventually ((eventually_lt_of_limsup_lt a_u).and (h₁.and h₃))).mono fun x ⟨x_v, x_u, u_0, v_0⟩ ↦ ?_ exact (mul_le_mul x_u.le x_v.le v_0 (u_0.trans x_u.le)).trans_lt c_ab end LiminfLimsupMul 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] [AddLeftMono R] (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 ↦ by dsimp; gcongr) (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] [AddRightMono 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 ↦ by dsimp; gcongr) (continuous_add_right c).continuousAt bdd_above cobdd).symm /-- `liminf (c + xᵢ) = c + liminf xᵢ`. -/ lemma liminf_const_add (F : Filter ι) [NeBot F] [Add R] [ContinuousAdd R] [AddLeftMono R] (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 ↦ by dsimp; gcongr) (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] [AddRightMono 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 ↦ by dsimp; gcongr) (continuous_add_right c).continuousAt cobdd bdd_below).symm /-- `limsup (c - xᵢ) = c - liminf xᵢ`. -/ lemma limsup_const_sub (F : Filter ι) [AddCommSemigroup R] [Sub R] [ContinuousSub R] [OrderedSub R] [AddLeftMono R] (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 := by rcases F.eq_or_neBot with rfl | _ · simp only [liminf, limsInf, limsup, limsSup, map_bot, eventually_bot, Set.setOf_true] simp only [IsCoboundedUnder, IsCobounded, map_bot, eventually_bot, true_implies] at cobdd rcases cobdd with ⟨x, hx⟩ refine (csInf_le ?_ (Set.mem_univ _)).antisymm (tsub_le_iff_tsub_le.1 (le_csSup ?_ (Set.mem_univ _))) · refine ⟨x - x, mem_lowerBounds.2 fun y ↦ ?_⟩ simp only [Set.mem_univ, true_implies] exact tsub_le_iff_tsub_le.1 (hx (x - y)) · refine ⟨x, mem_upperBounds.2 fun y ↦ ?_⟩ simp only [Set.mem_univ, hx y, implies_true] · exact (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 ι) [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 := by rcases F.eq_or_neBot with rfl | _ · have {a : R} : sInf Set.univ ≤ a := by apply csInf_le _ (Set.mem_univ a) simp only [IsCoboundedUnder, IsCobounded, map_bot, eventually_bot, true_implies] at cobdd rcases cobdd with ⟨x, hx⟩ refine ⟨x, mem_lowerBounds.2 fun y ↦ ?_⟩ simp only [Set.mem_univ, hx y, implies_true] simp only [limsup, limsSup, map_bot, eventually_bot, Set.setOf_true] exact this.antisymm (tsub_le_iff_right.2 this) · apply (Monotone.map_limsSup_of_continuousAt (F := F.map f) (f := fun (x : R) ↦ x - c) _ _).symm · exact fun _ _ h ↦ tsub_le_tsub_right h c · exact (continuous_sub_right c).continuousAt /-- `liminf (c - xᵢ) = c - limsup xᵢ`. -/ lemma liminf_const_sub (F : Filter ι) [NeBot F] [AddCommSemigroup R] [Sub R] [ContinuousSub R] [OrderedSub R] [AddLeftMono R] (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
.lake/packages/mathlib/Mathlib/Topology/Algebra/Order/Archimedean.lean
import Mathlib.GroupTheory.Archimedean import Mathlib.Topology.Algebra.Order.Group import Mathlib.Algebra.Group.Subgroup.ZPowers.Basic 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 {𝕜} [Field 𝕜] [LinearOrder 𝕜] [IsStrictOrderedRing 𝕜] [TopologicalSpace 𝕜] [OrderTopology 𝕜] [Archimedean 𝕜] : DenseRange ((↑) : ℚ → 𝕜) := dense_of_exists_between fun _ _ h => Set.exists_range_iff.2 <| exists_rat_btwn h namespace Subgroup variable {G : Type*} [CommGroup G] [LinearOrder G] [IsOrderedMonoid G] [TopologicalSpace G] [OrderTopology G] [MulArchimedean G] /-- A subgroup of an archimedean linear ordered multiplicative commutative group with order topology is dense provided that for all `ε > 1` there exists an element of the subgroup that belongs to `(1, ε)`. -/ @[to_additive /-- 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_one (S : Subgroup G) (hS : ∀ ε > 1, ∃ g ∈ S, g ∈ Ioo 1 ε) : Dense (S : Set G) := by cases subsingleton_or_nontrivial G · refine fun x => _root_.subset_closure ?_ rw [Subsingleton.elim x 1] exact one_mem S refine dense_of_exists_between fun a b hlt => ?_ rcases hS (b / a) (one_lt_div'.2 hlt) with ⟨g, hgS, hg0, hg⟩ rcases (existsUnique_add_zpow_mem_Ioc hg0 1 a).exists with ⟨m, hm⟩ rw [one_mul] at hm refine ⟨g ^ m, zpow_mem hgS _, hm.1, hm.2.trans_lt ?_⟩ rwa [lt_div_iff_mul_lt'] at hg /-- Let `S` be a nontrivial subgroup in an archimedean linear ordered multiplicative commutative group `G` with order topology. If the set of elements of `S` that are greater than one does not have a minimal element, then `S` is dense `G`. -/ @[to_additive /-- 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 : Subgroup G) (hbot : S ≠ ⊥) (H : ¬∃ a : G, IsLeast { g : G | g ∈ S ∧ 1 < g } a) : Dense (S : Set G) := by refine S.dense_of_not_isolated_one fun ε ε1 => ?_ contrapose! H exact exists_isLeast_one_lt hbot ε1 (disjoint_left.2 H) /-- A subgroup of an archimedean linear ordered multiplicative commutative group `G` with order topology either is dense in `G` or is a cyclic subgroup. -/ @[to_additive 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. -/] theorem dense_or_cyclic (S : Subgroup G) : Dense (S : Set G) ∨ ∃ a : G, S = closure {a} := by refine (em _).imp (dense_of_not_isolated_one S) fun h => ?_ push_neg at h rcases h with ⟨ε, ε1, hε⟩ exact cyclic_of_isolated_one ε1 (disjoint_left.2 hε) variable [Nontrivial G] [DenselyOrdered G] /-- In a nontrivial densely linear ordered archimedean topological multiplicative group, a subgroup is either dense or is cyclic, but not both. For a non-exclusive `Or` version with weaker assumptions, see `Subgroup.dense_or_cyclic` above. -/ @[to_additive dense_xor'_cyclic /-- In a nontrivial densely linear ordered archimedean topological additive group, a subgroup is either dense or is cyclic, but not both. For a non-exclusive `Or` version with weaker assumptions, see `AddSubgroup.dense_or_cyclic` above. -/] theorem dense_xor'_cyclic (s : Subgroup G) : Xor' (Dense (s : Set G)) (∃ a, s = .zpowers a) := by if hd : Dense (s : Set G) then simp only [hd, xor_true] rintro ⟨a, rfl⟩ exact not_denseRange_zpow hd else simp only [hd, xor_false, id, zpowers_eq_closure] exact s.dense_or_cyclic.resolve_left hd @[to_additive] theorem dense_iff_ne_zpowers {s : Subgroup G} : Dense (s : Set G) ↔ ∀ a, s ≠ .zpowers a := by simp [xor_iff_iff_not.1 s.dense_xor'_cyclic] end Subgroup
.lake/packages/mathlib/Mathlib/Topology/Algebra/Order/UpperLower.lean
import Mathlib.Algebra.Order.UpperLower import Mathlib.Topology.Algebra.Group.Pointwise /-! # 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) IsOrderedMonoid.to_hasUpperLowerClosure [CommGroup α] [PartialOrder α] [IsOrderedMonoid α] [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
.lake/packages/mathlib/Mathlib/Topology/Algebra/Order/ArchimedeanDiscrete.lean
import Mathlib.GroupTheory.ArchimedeanDensely import Mathlib.GroupTheory.SpecificGroups.Cyclic import Mathlib.Topology.Algebra.IsUniformGroup.Basic import Mathlib.Topology.Algebra.Order.Archimedean import Mathlib.Topology.Order.DenselyOrdered /-! # Discreteness of subgroups in archimedean ordered groups This file contains some supplements to the results in `Mathlib.Topology.Algebra.Order.Archimedean`, involving discreteness of subgroups, which require heavier imports. -/ namespace Subgroup variable {G : Type*} [CommGroup G] [LinearOrder G] [IsOrderedMonoid G] [TopologicalSpace G] [OrderTopology G] /-- In a linearly ordered group with the order topology, the powers of a single element form a discrete subgroup. -/ @[to_additive /-- In a linearly ordered additive group with the order topology, the multiples of a single element form a discrete subgroup. -/] instance instDiscreteTopologyZMultiples (g : G) : DiscreteTopology (zpowers g) := by wlog ha : 1 ≤ g · specialize this g⁻¹ (one_le_inv'.mpr (le_of_not_ge ha)) rwa [zpowers_inv] at this rcases eq_or_lt_of_le ha with rfl | ha · rw [zpowers_one_eq_bot] exact Subsingleton.discreteTopology rw [discreteTopology_iff_isOpen_singleton_one, isOpen_induced_iff] refine ⟨Set.Ioo (g ^ (-1 : ℤ)) (g ^ (1 : ℤ)), isOpen_Ioo, ?_⟩ ext ⟨_, ⟨n, rfl⟩⟩ constructor · simp only [Set.mem_preimage, Set.mem_Ioo, Set.mem_singleton_iff, and_imp] intro hn hn' rw [zpow_lt_zpow_iff_right ha] at hn hn' simp only [Subtype.ext_iff, show n = 0 by omega, zpow_zero, coe_one] · simp_all variable [MulArchimedean G] @[to_additive] instance [DiscreteTopology G] : IsCyclic G := by nontriviality G exact LinearOrderedCommGroup.isCyclic_iff_not_denselyOrdered.mpr fun h ↦ have := h.subsingleton_of_discreteTopology; false_of_nontrivial_of_subsingleton G /-- In an Archimedean densely linearly ordered group (with the order topology), a subgroup is discrete iff it is cyclic. -/ @[to_additive /-- In an Archimedean linearly ordered additive group (with the order topology), a subgroup is discrete iff it is cyclic. -/] lemma discrete_iff_cyclic {H : Subgroup G} : IsCyclic H ↔ DiscreteTopology H := by nontriviality G using isCyclic_of_subsingleton, Subsingleton.discreteTopology rw [Subgroup.isCyclic_iff_exists_zpowers_eq_top] constructor · rintro ⟨g, rfl⟩ infer_instance · have := H.dense_or_cyclic simp only [← Subgroup.zpowers_eq_closure, Eq.comm (a := H)] at this refine fun hA ↦ this.elim (fun h ↦ ?_) id -- remains to show a contradiction assuming `H` is both dense and discrete obtain rfl : H = ⊤ := by rw [← coe_eq_univ, ← (dense_iff_closure_eq.mp h), H.isClosed_of_discrete.closure_eq] have : DiscreteTopology G := by rwa [← (Homeomorph.Set.univ G).discreteTopology_iff] exact isCyclic_iff_exists_zpowers_eq_top.mp inferInstance end Subgroup
.lake/packages/mathlib/Mathlib/Topology/Algebra/Order/Floor.lean
import Mathlib.Algebra.Order.Floor.Ring import Mathlib.Order.Filter.AtTopBot.Floor import Mathlib.Topology.Algebra.Order.Group /-! # 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 namespace FloorSemiring open scoped Nat variable {K : Type*} [Field K] [LinearOrder K] [IsStrictOrderedRing K] [FloorSemiring K] [TopologicalSpace K] [OrderTopology K] theorem tendsto_mul_pow_div_factorial_sub_atTop (a c : K) (d : ℕ) : Tendsto (fun n ↦ a * c ^ n / (n - d)!) atTop (𝓝 0) := by rw [tendsto_order] constructor all_goals intro ε hε filter_upwards [eventually_mul_pow_lt_factorial_sub (a * ε⁻¹) c d] with n h rw [mul_right_comm, ← div_eq_mul_inv] at h · rw [div_lt_iff_of_neg hε] at h rwa [lt_div_iff₀' (Nat.cast_pos.mpr (Nat.factorial_pos _))] · rw [div_lt_iff₀ hε] at h rwa [div_lt_iff₀' (Nat.cast_pos.mpr (Nat.factorial_pos _))] theorem tendsto_pow_div_factorial_atTop (c : K) : Tendsto (fun n ↦ c ^ n / n !) atTop (𝓝 0) := by convert tendsto_mul_pow_div_factorial_sub_atTop 1 c 0 rw [one_mul] end FloorSemiring variable {α β γ : Type*} [Ring α] [LinearOrder α] [FloorRing α] section variable [IsStrictOrderedRing α] -- TODO: move to `Mathlib/Order/Filter/AtTopBot/Floor.lean` 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⟩ end 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 [IsStrictOrderedRing α] (n : ℤ) : ContinuousOn (fun x => ceil x : α → α) (Ioc (n - 1) n : Set α) := (continuousOn_congr <| ceil_eq_on_Ioc' n).mpr continuousOn_const section OrderClosedTopology variable [IsStrictOrderedRing α] [OrderClosedTopology α] omit [IsStrictOrderedRing α] in theorem tendsto_floor_right_pure_floor (x : α) : Tendsto (floor : α → ℤ) (𝓝[≥] x) (pure ⌊x⌋) := tendsto_pure.2 <| mem_of_superset (Ico_mem_nhdsGE <| 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_nhdsLE <| 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_nhdsLT 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 : α) omit [IsStrictOrderedRing α] in 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_nhdsGT <| 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 [IsTopologicalAddGroup α] (n : ℤ) : ContinuousOn (fract : α → α) (Ico n (n + 1) : Set α) := continuousOn_id.sub (continuousOn_floor n) theorem continuousAt_fract [OrderClosedTopology α] [IsTopologicalAddGroup α] {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 _) variable [IsStrictOrderedRing α] theorem tendsto_fract_left' [OrderClosedTopology α] [IsTopologicalAddGroup α] (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 α] [IsTopologicalAddGroup α] (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 α] [IsTopologicalAddGroup α] (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 α] [IsTopologicalAddGroup α] (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, ← nhdsLT_sup_nhdsGE (n : α), prod_sup, tendsto_sup] constructor · refine (((h (s, 1) ⟨trivial, zero_le_one, le_rfl⟩).tendsto.mono_left ?_).comp (tendsto_id.prodMap (tendsto_fract_left _))).mono_right (le_of_eq ?_) · rw [nhdsWithin_prod_eq, nhdsWithin_univ, ← nhdsWithin_Ico_eq_nhdsLT 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.prodMap (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.prodMap (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.prodMk 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
.lake/packages/mathlib/Mathlib/Topology/Algebra/Order/Field.lean
import Mathlib.Algebra.Order.Group.Pointwise.Interval import Mathlib.Order.Filter.AtTopBot.Field 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) section Semifield variable {𝕜 α : Type*} [Semifield 𝕜] [LinearOrder 𝕜] [IsStrictOrderedRing 𝕜] [TopologicalSpace 𝕜] [OrderTopology 𝕜] {l : Filter α} {f g : α → 𝕜} /-- In a linearly ordered semifield 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_pos {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 -- TODO: after removing this deprecated alias, -- rename `Filter.Tendsto.atTop_mul'` to `Filter.Tendsto.atTop_mul`. -- Same for the other 3 similar aliases below. /-- In a linearly ordered semifield 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.pos_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_pos hC hf @[simp] lemma inv_atTop₀ : (atTop : Filter 𝕜)⁻¹ = 𝓝[>] 0 := (((atTop_basis_Ioi' (0 : 𝕜)).map _).comp_surjective inv_surjective).eq_of_same_basis <| (nhdsGT_basis _).congr (by simp) fun a ha ↦ by simp [inv_Ioi₀ (inv_pos.2 ha)] @[simp] lemma inv_nhdsGT_zero : (𝓝[>] (0 : 𝕜))⁻¹ = atTop := by rw [← inv_atTop₀, inv_inv] /-- The function `x ↦ x⁻¹` tends to `+∞` on the right of `0`. -/ theorem tendsto_inv_nhdsGT_zero : Tendsto (fun x : 𝕜 => x⁻¹) (𝓝[>] (0 : 𝕜)) atTop := inv_nhdsGT_zero.le /-- The function `r ↦ r⁻¹` tends to `0` on the right as `r → +∞`. -/ theorem tendsto_inv_atTop_nhdsGT_zero : Tendsto (fun r : 𝕜 => r⁻¹) atTop (𝓝[>] (0 : 𝕜)) := inv_atTop₀.le theorem tendsto_inv_atTop_zero : Tendsto (fun r : 𝕜 => r⁻¹) atTop (𝓝 0) := tendsto_inv_atTop_nhdsGT_zero.mono_right inf_le_left 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_nhdsGT_zero (h : Tendsto f l (𝓝[>] 0)) : Tendsto f⁻¹ l atTop := tendsto_inv_nhdsGT_zero.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' -- see Note [lower instance priority] instance (priority := 100) IsStrictOrderedRing.toContinuousInv₀ [ContinuousMul 𝕜] : ContinuousInv₀ 𝕜 := .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₀).2 h₁)] with y hy exact hxx'.trans_lt <| lt_inv_of_lt_inv₀ hy.1 hy.2 · filter_upwards [Ioi_mem_nhds (inv_lt_one_of_one_lt₀ hx)] with y hy exact inv_lt_of_inv_lt₀ (by positivity) hy @[deprecated (since := "2025-09-01")] alias IsStrictOrderedRing.toHasContinuousInv₀ := IsStrictOrderedRing.toContinuousInv₀ end Semifield /-- 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 IsTopologicalRing.of_norm {R 𝕜 : Type*} [NonUnitalNonAssocRing R] [Field 𝕜] [LinearOrder 𝕜] [IsStrictOrderedRing 𝕜] [TopologicalSpace R] [IsTopologicalAddGroup 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 < ε })) : IsTopologicalRing 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 IsTopologicalRing.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 at * calc norm (x * y) ≤ norm x * norm y := norm_mul_le _ _ _ < ε := (mul_le_of_le_one_left (norm_nonneg _) hx.le).trans_lt hy 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*} [Field 𝕜] [LinearOrder 𝕜] [IsStrictOrderedRing 𝕜] [TopologicalSpace 𝕜] [OrderTopology 𝕜] {l : Filter α} {f g : α → 𝕜} -- see Note [lower instance priority] instance (priority := 100) IsStrictOrderedRing.topologicalRing : IsTopologicalRing 𝕜 := .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 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_pos (neg_pos.2 hC) hg.neg simpa only [Function.comp_def, 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_pos {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_pos hC hg simpa [Function.comp_def] 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 [Function.comp_def] 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.pos_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_pos 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_atBot₀ : (atBot : Filter 𝕜)⁻¹ = 𝓝[<] 0 := (((atBot_basis_Iio' (0 : 𝕜)).map _).comp_surjective inv_surjective).eq_of_same_basis <| (nhdsLT_basis _).congr (by simp) fun a ha ↦ by simp [inv_Iio₀ (inv_neg''.2 ha)] @[simp] lemma inv_nhdsLT_zero : (𝓝[<] (0 : 𝕜))⁻¹ = atBot := by rw [← inv_atBot₀, inv_inv] /-- The function `x ↦ x⁻¹` tends to `-∞` on the left of `0`. -/ theorem tendsto_inv_nhdsLT_zero : Tendsto (fun x : 𝕜 => x⁻¹) (𝓝[<] (0 : 𝕜)) atBot := inv_nhdsLT_zero.le @[deprecated (since := "2025-04-23")] alias tendsto_inv_zero_atBot := tendsto_inv_nhdsLT_zero /-- The function `r ↦ r⁻¹` tends to `0` on the left as `r → -∞`. -/ theorem tendsto_inv_atBot_nhdsLT_zero : Tendsto (fun r : 𝕜 => r⁻¹) atBot (𝓝[<] (0 : 𝕜)) := inv_atBot₀.le @[deprecated (since := "2025-04-23")] alias tendsto_inv_atBot_zero' := tendsto_inv_atBot_nhdsLT_zero theorem tendsto_inv_atBot_zero : Tendsto (fun r : 𝕜 => r⁻¹) atBot (𝓝 0) := tendsto_inv_atBot_nhdsLT_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.div_atBot {a : 𝕜} (h : Tendsto f l (𝓝 a)) (hg : Tendsto g l atBot) : Tendsto (fun x => f x / g x) l (𝓝 0) := by simp only [div_eq_mul_inv] exact mul_zero a ▸ h.mul (tendsto_inv_atBot_zero.comp hg) lemma Filter.Tendsto.const_div_atTop (hg : Tendsto g l atTop) (r : 𝕜) : Tendsto (fun n ↦ r / g n) l (𝓝 0) := tendsto_const_nhds.div_atTop hg lemma Filter.Tendsto.const_div_atBot (hg : Tendsto g l atBot) (r : 𝕜) : Tendsto (fun n ↦ r / g n) l (𝓝 0) := tendsto_const_nhds.div_atBot hg theorem Filter.Tendsto.inv_tendsto_atBot (h : Tendsto f l atBot) : Tendsto f⁻¹ l (𝓝 0) := tendsto_inv_atBot_zero.comp h theorem Filter.Tendsto.inv_tendsto_nhdsLT_zero (h : Tendsto f l (𝓝[<] 0)) : Tendsto f⁻¹ l atBot := tendsto_inv_nhdsLT_zero.comp h /-- If `g` tends to zero and there exists a constant `C : 𝕜` such that eventually `|f x| ≤ C`, then the product `f * g` tends to zero. -/ theorem bdd_le_mul_tendsto_zero' {f g : α → 𝕜} (C : 𝕜) (hf : ∀ᶠ x in l, |f x| ≤ C) (hg : Tendsto g l (𝓝 0)) : Tendsto (fun x ↦ f x * g x) l (𝓝 0) := by rw [tendsto_zero_iff_abs_tendsto_zero] have hC : Tendsto (fun x ↦ |C * g x|) l (𝓝 0) := by convert (hg.const_mul C).abs simp_rw [mul_zero, abs_zero] apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds hC · filter_upwards [hf] with x _ using abs_nonneg _ · filter_upwards [hf] with x hx simp only [comp_apply, abs_mul] exact mul_le_mul_of_nonneg_right (hx.trans (le_abs_self C)) (abs_nonneg _) /-- If `g` tends to zero and there exist constants `b B : 𝕜` such that eventually `b ≤ f x| ≤ B`, then the product `f * g` tends to zero. -/ theorem bdd_le_mul_tendsto_zero {f g : α → 𝕜} {b B : 𝕜} (hb : ∀ᶠ x in l, b ≤ f x) (hB : ∀ᶠ x in l, f x ≤ B) (hg : Tendsto g l (𝓝 0)) : Tendsto (fun x ↦ f x * g x) l (𝓝 0) := by set C := max |b| |B| have hbC : -C ≤ b := neg_le.mpr (le_max_of_le_left (neg_le_abs b)) have hBC : B ≤ C := le_max_of_le_right (le_abs_self B) apply bdd_le_mul_tendsto_zero' C _ hg filter_upwards [hb, hB] exact fun x hbx hBx ↦ abs_le.mpr ⟨hbC.trans hbx, hBx.trans hBC⟩ /-- If `g` tends to `atTop` and there exist constants `b B : 𝕜` such that eventually `b ≤ f x| ≤ B`, then the quotient `f / g` tends to zero. -/ theorem tendsto_bdd_div_atTop_nhds_zero {f g : α → 𝕜} {b B : 𝕜} (hb : ∀ᶠ x in l, b ≤ f x) (hB : ∀ᶠ x in l, f x ≤ B) (hg : Tendsto g l atTop) : Tendsto (fun x => f x / g x) l (𝓝 0) := by simp only [div_eq_mul_inv] exact bdd_le_mul_tendsto_zero hb hB hg.inv_tendsto_atTop 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 | 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)⟩ · rcases 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 instance (priority := 100) IsStrictOrderedRing.toIsTopologicalDivisionRing : IsTopologicalDivisionRing 𝕜 := ⟨⟩ -- TODO: generalize to a `GroupWithZero` theorem comap_mulLeft_nhdsGT_zero {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_nhdsGT_zero_mul_left {x : 𝕜} (hx : 0 < x) {p : 𝕜 → Prop} (h : ∀ᶠ ε in 𝓝[>] 0, p ε) : ∀ᶠ ε in 𝓝[>] 0, p (x * ε) := by rw [← comap_mulLeft_nhdsGT_zero hx] exact h.comap fun ε => x * ε
.lake/packages/mathlib/Mathlib/Topology/Algebra/Monoid/FunOnFinite.lean
import Mathlib.Topology.Algebra.Monoid import Mathlib.LinearAlgebra.Finsupp.Pi /-! # Continuity of the functoriality of `X → M` when `X` is finite -/ namespace FunOnFinite lemma continuous_map (M : Type*) [AddCommMonoid M] [TopologicalSpace M] [ContinuousAdd M] {X Y : Type*} [Finite X] [Finite Y] (f : X → Y) : Continuous (FunOnFinite.map (M := M) f) := by classical have := Fintype.ofFinite X refine continuous_pi (fun y ↦ ?_) simp only [FunOnFinite.map_apply_apply] exact continuous_finset_sum _ (fun _ _ ↦ continuous_apply _) lemma continuous_linearMap (R M : Type*) [Semiring R] [AddCommMonoid M] [Module R M] [TopologicalSpace M] [ContinuousAdd M] {X Y : Type*} [Finite X] [Finite Y] (f : X → Y) : Continuous (FunOnFinite.linearMap R M f) := FunOnFinite.continuous_map _ _ end FunOnFinite
.lake/packages/mathlib/Mathlib/Topology/Algebra/Monoid/Defs.lean
import Mathlib.Topology.Constructions.SumProd /-! # Topological monoids - definitions In this file we define two mixin typeclasses: - `ContinuousMul M` says that the multiplication on `M` is continuous as a function on `M × M`; - `ContinuousAdd M` says that the addition on `M` is continuous as a function on `M × M`. These classes are `Prop`-valued mixins, i.e., they take data (`TopologicalSpace`, `Mul`/`Add`) as arguments instead of extending typeclasses with these fields. We also provide convenience dot notation lemmas like `Filter.Tendsto.mul` and `ContinuousAt.add`. -/ open scoped Topology /-- 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*) [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*) [TopologicalSpace M] [Mul M] : Prop where continuous_mul : Continuous fun p : M × M => p.1 * p.2 section ContinuousMul variable {M : Type*} [TopologicalSpace M] [Mul 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] theorem Filter.Tendsto.mul {α : Type*} {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)) := (continuous_mul.tendsto _).comp (hf.prodMk_nhds hg) @[to_additive] lemma Filter.tendsto_of_div_tendsto_one {α E : Type*} [CommGroup E] [TopologicalSpace E] [ContinuousMul E] {f g : α → E} (m : E) {x : Filter α} (hf : Tendsto f x (𝓝 m)) (hfg : Tendsto (g / f) x (𝓝 1)) : Tendsto g x (𝓝 m) := by simpa using Tendsto.mul hf hfg variable {X : Type*} [TopologicalSpace X] {f g : X → M} {s : Set X} {x : X} @[to_additive (attr := continuity, fun_prop)] theorem Continuous.mul (hf : Continuous f) (hg : Continuous g) : Continuous fun x => f x * g x := continuous_mul.comp₂ hf hg @[to_additive] theorem ContinuousWithinAt.mul (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 (attr := fun_prop)] theorem ContinuousAt.mul (hf : ContinuousAt f x) (hg : ContinuousAt g x) : ContinuousAt (fun x => f x * g x) x := Filter.Tendsto.mul hf hg @[to_additive (attr := fun_prop)] theorem ContinuousOn.mul (hf : ContinuousOn f s) (hg : ContinuousOn g s) : ContinuousOn (fun x => f x * g x) s := fun x hx ↦ (hf x hx).mul (hg x hx) end ContinuousMul
.lake/packages/mathlib/Mathlib/Topology/Algebra/Monoid/AddChar.lean
import Mathlib.Algebra.Group.AddChar import Mathlib.Topology.DenseEmbedding /-! # Additive characters of topological monoids -/ lemma DenseRange.addChar_eq_of_eval_one_eq {A M : Type*} [TopologicalSpace A] [AddMonoidWithOne A] [Monoid M] [TopologicalSpace M] [T2Space M] (hdr : DenseRange ((↑) : ℕ → A)) {κ₁ κ₂ : AddChar A M} (hκ₁ : Continuous κ₁) (hκ₂ : Continuous κ₂) (h : κ₁ 1 = κ₂ 1) : κ₁ = κ₂ := by refine DFunLike.coe_injective <| hdr.equalizer hκ₁ hκ₂ (funext fun n ↦ ?_) simp only [Function.comp_apply, ← nsmul_one, h, AddChar.map_nsmul_eq_pow]
.lake/packages/mathlib/Mathlib/Topology/Algebra/RestrictedProduct/Basic.lean
import Mathlib.Algebra.Ring.Pi import Mathlib.Algebra.Ring.Subring.Defs import Mathlib.GroupTheory.GroupAction.SubMulAction import Mathlib.Order.Filter.Cofinite -- for `Πʳ i, [R i, A i]` notation, confuses shake import Mathlib.Algebra.Module.Pi /-! # Restricted products of sets, groups and rings We define the **restricted product** of `R : ι → Type*` of types, relative to a family of subsets `A : (i : ι) → Set (R i)` and a filter `𝓕 : Filter ι`. This is the set of all `x : Π i, R i` such that the set `{j | x j ∈ A j}` belongs to `𝓕`. We denote it by `Πʳ i, [R i, A i]_[𝓕]`. The main case of interest, which we shall refer to as the "classical restricted product", is that of `𝓕 = cofinite`. Recall that this is the filter of all subsets of `ι`, which are *cofinite* in the sense that they have finite complement. Hence, the associated restricted product is the set of all `x : Π i, R i` such that `x j ∈ A j` for all but finitely many `j`s. We denote it simply by `Πʳ i, [R i, A i]`. Another notable case is that of the principal filter `𝓕 = 𝓟 s` corresponding to some subset `s` of `ι`. The associated restricted product `Πʳ i, [R i, A i]_[𝓟 s]` is the set of all `x : Π i, R i` such that `x j ∈ A j` for all `j ∈ s`. Put another way, this is just `(Π i ∈ s, A i) × (Π i ∉ s, R i)`, modulo the obvious isomorphism. We endow these types with the obvious algebraic structures. We also show various compatibility results. See also the file `Mathlib/Topology/Algebra/RestrictedProduct/TopologicalSpace.lean`, which puts the structure of a topological space on a restricted product of topological spaces. ## Main definitions * `RestrictedProduct`: the restricted product of a family `R` of types, relative to a family `A` of subsets and a filter `𝓕` on the indexing set. This is denoted `Πʳ i, [R i, A i]_[𝓕]`, or simply `Πʳ i, [R i, A i]` when `𝓕 = cofinite`. * `RestrictedProduct.instDFunLike`: interpret an element of `Πʳ i, [R i, A i]_[𝓕]` as an element of `Π i, R i` using the `DFunLike` machinery. * `RestrictedProduct.structureMap`: the inclusion map from `Π i, A i` to `Πʳ i, [R i, A i]_[𝓕]`. ## Notation * `Πʳ i, [R i, A i]_[𝓕]` is `RestrictedProduct R A 𝓕`. * `Πʳ i, [R i, A i]` is `RestrictedProduct R A cofinite`. ## Tags restricted product, adeles, ideles -/ open Set Filter variable {ι : Type*} variable (R : ι → Type*) (A : (i : ι) → Set (R i)) /-! ## Definition and elementary maps -/ /-- The **restricted product** of a family `R : ι → Type*` of types, relative to subsets `A : (i : ι) → Set (R i)` and the filter `𝓕 : Filter ι`, is the set of all `x : Π i, R i` such that the set `{j | x j ∈ A j}` belongs to `𝓕`. We denote it by `Πʳ i, [R i, A i]_[𝓕]`. The most common use case is with `𝓕 = cofinite`, in which case the restricted product is the set of all `x : Π i, R i` such that `x j ∈ A j` for all but finitely many `j`. We denote it simply by `Πʳ i, [R i, A i]`. Similarly, if `S` is a principal filter, the restricted product `Πʳ i, [R i, A i]_[𝓟 s]` is the set of all `x : Π i, R i` such that `∀ j ∈ S, x j ∈ A j`. -/ def RestrictedProduct (𝓕 : Filter ι) : Type _ := {x : Π i, R i // ∀ᶠ i in 𝓕, x i ∈ A i} open Batteries.ExtendedBinder /-- `Πʳ i, [R i, A i]_[𝓕]` is `RestrictedProduct R A 𝓕`. -/ scoped[RestrictedProduct] notation3 "Πʳ " (...) ", " "[" r:(scoped R => R)", " a:(scoped A => A) "]_[" f "]" => RestrictedProduct r a f /-- `Πʳ i, [R i, A i]` is `RestrictedProduct R A cofinite`. -/ scoped[RestrictedProduct] notation3 "Πʳ " (...) ", " "[" r:(scoped R => R)", " a:(scoped A => A) "]" => RestrictedProduct r a cofinite namespace RestrictedProduct open scoped RestrictedProduct variable {𝓕 𝓖 : Filter ι} instance : DFunLike (Πʳ i, [R i, A i]_[𝓕]) ι R where coe x i := x.1 i coe_injective' _ _ := Subtype.ext variable {R A} in /-- Constructor for `RestrictedProduct`. -/ abbrev mk (x : Π i, R i) (hx : ∀ᶠ i in 𝓕, x i ∈ A i) : Πʳ i, [R i, A i]_[𝓕] := ⟨x, hx⟩ @[simp] lemma mk_apply (x : Π i, R i) (hx : ∀ᶠ i in 𝓕, x i ∈ A i) (i : ι) : (mk x hx) i = x i := rfl @[ext] lemma ext {x y : Πʳ i, [R i, A i]_[𝓕]} (h : ∀ i, x i = y i) : x = y := Subtype.ext <| funext h lemma range_coe : range ((↑) : Πʳ i, [R i, A i]_[𝓕] → Π i, R i) = {x | ∀ᶠ i in 𝓕, x i ∈ A i} := Subtype.range_val_subtype lemma range_coe_principal {S : Set ι} : range ((↑) : Πʳ i, [R i, A i]_[𝓟 S] → Π i, R i) = S.pi A := range_coe R A @[simp] lemma eventually (x : Πʳ i, [R i, A i]_[𝓕]) : ∀ᶠ i in 𝓕, x i ∈ A i := x.2 variable (𝓕) in /-- The *structure map* of the restricted product is the obvious inclusion from `Π i, A i` into `Πʳ i, [R i, A i]_[𝓕]`. -/ def structureMap (x : Π i, A i) : Πʳ i, [R i, A i]_[𝓕] := ⟨fun i ↦ x i, .of_forall fun i ↦ (x i).2⟩ /-- If `𝓕 ≤ 𝓖`, the restricted product `Πʳ i, [R i, A i]_[𝓖]` is naturally included in `Πʳ i, [R i, A i]_[𝓕]`. This is the corresponding map. -/ def inclusion (h : 𝓕 ≤ 𝓖) (x : Πʳ i, [R i, A i]_[𝓖]) : Πʳ i, [R i, A i]_[𝓕] := ⟨x, x.2.filter_mono h⟩ variable (𝓕) in lemma inclusion_eq_id : inclusion R A (le_refl 𝓕) = id := rfl lemma exists_inclusion_eq_of_eventually (h : 𝓕 ≤ 𝓖) {x : Πʳ i, [R i, A i]_[𝓕]} (hx𝓖 : ∀ᶠ i in 𝓖, x i ∈ A i) : ∃ x' : Πʳ i, [R i, A i]_[𝓖], inclusion R A h x' = x := ⟨⟨x.1, hx𝓖⟩, rfl⟩ lemma exists_structureMap_eq_of_forall {x : Πʳ i, [R i, A i]_[𝓕]} (hx : ∀ i, x.1 i ∈ A i) : ∃ x' : Π i, A i, structureMap R A 𝓕 x' = x := ⟨fun i ↦ ⟨x i, hx i⟩, rfl⟩ lemma range_inclusion (h : 𝓕 ≤ 𝓖) : Set.range (inclusion R A h) = {x | ∀ᶠ i in 𝓖, x i ∈ A i} := subset_antisymm (range_subset_iff.mpr fun x ↦ x.2) (fun _ hx ↦ mem_range.mpr <| exists_inclusion_eq_of_eventually R A h hx) lemma range_structureMap : Set.range (structureMap R A 𝓕) = {f | ∀ i, f.1 i ∈ A i} := subset_antisymm (range_subset_iff.mpr fun x i ↦ (x i).2) (fun _ hx ↦ mem_range.mpr <| exists_structureMap_eq_of_forall R A hx) section Algebra /-! ## Algebraic instances on restricted products In this section, we endow the restricted product with its algebraic instances. To avoid any unnecessary coercions, we use subobject classes for the subset `B i` of each `R i`. -/ variable {S : ι → Type*} -- subobject type variable [Π i, SetLike (S i) (R i)] variable {B : Π i, S i} @[to_additive] instance [Π i, One (R i)] [∀ i, OneMemClass (S i) (R i)] : One (Πʳ i, [R i, B i]_[𝓕]) where one := ⟨fun _ ↦ 1, .of_forall fun _ ↦ one_mem _⟩ @[to_additive (attr := simp)] lemma one_apply [Π i, One (R i)] [∀ i, OneMemClass (S i) (R i)] (i : ι) : (1 : Πʳ i, [R i, B i]_[𝓕]) i = 1 := rfl @[to_additive] instance [Π i, Inv (R i)] [∀ i, InvMemClass (S i) (R i)] : Inv (Πʳ i, [R i, B i]_[𝓕]) where inv x := ⟨fun i ↦ (x i)⁻¹, x.2.mono fun _ ↦ inv_mem⟩ @[to_additive (attr := simp)] lemma inv_apply [Π i, Inv (R i)] [∀ i, InvMemClass (S i) (R i)] (x : Πʳ i, [R i, B i]_[𝓕]) (i : ι) : (x⁻¹) i = (x i)⁻¹ := rfl @[to_additive] instance [Π i, Mul (R i)] [∀ i, MulMemClass (S i) (R i)] : Mul (Πʳ i, [R i, B i]_[𝓕]) where mul x y := ⟨fun i ↦ x i * y i, y.2.mp (x.2.mono fun _ ↦ mul_mem)⟩ @[to_additive (attr := simp)] lemma mul_apply [Π i, Mul (R i)] [∀ i, MulMemClass (S i) (R i)] (x y : Πʳ i, [R i, B i]_[𝓕]) (i : ι) : (x * y) i = x i * y i := rfl @[to_additive] instance {G : Type*} [Π i, SMul G (R i)] [∀ i, SMulMemClass (S i) G (R i)] : SMul G (Πʳ i, [R i, B i]_[𝓕]) where smul g x := ⟨fun i ↦ g • (x i), x.2.mono fun _ ↦ SMulMemClass.smul_mem g⟩ @[to_additive (attr := simp)] lemma smul_apply {G : Type*} [Π i, SMul G (R i)] [∀ i, SMulMemClass (S i) G (R i)] (g : G) (x : Πʳ i, [R i, B i]_[𝓕]) (i : ι) : (g • x) i = g • x i := rfl @[to_additive] instance [Π i, DivInvMonoid (R i)] [∀ i, SubgroupClass (S i) (R i)] : Div (Πʳ i, [R i, B i]_[𝓕]) where div x y := ⟨fun i ↦ x i / y i, y.2.mp (x.2.mono fun _ ↦ div_mem)⟩ @[to_additive (attr := simp)] lemma div_apply [Π i, DivInvMonoid (R i)] [∀ i, SubgroupClass (S i) (R i)] (x y : Πʳ i, [R i, B i]_[𝓕]) (i : ι) : (x / y) i = x i / y i := rfl instance instNSMul [Π i, AddMonoid (R i)] [∀ i, AddSubmonoidClass (S i) (R i)] : SMul ℕ (Πʳ i, [R i, B i]_[𝓕]) where smul n x := ⟨fun i ↦ n • (x i), x.2.mono fun _ hi ↦ nsmul_mem hi n⟩ @[to_additive existing instNSMul] instance [Π i, Monoid (R i)] [∀ i, SubmonoidClass (S i) (R i)] : Pow (Πʳ i, [R i, B i]_[𝓕]) ℕ where pow x n := ⟨fun i ↦ x i ^ n, x.2.mono fun _ hi ↦ pow_mem hi n⟩ @[to_additive] lemma pow_apply [Π i, Monoid (R i)] [∀ i, SubmonoidClass (S i) (R i)] (x : Πʳ i, [R i, B i]_[𝓕]) (n : ℕ) (i : ι) : (x ^ n) i = x i ^ n := rfl @[to_additive] instance [Π i, Monoid (R i)] [∀ i, SubmonoidClass (S i) (R i)] : Monoid (Πʳ i, [R i, B i]_[𝓕]) := DFunLike.coe_injective.monoid _ rfl (fun _ _ ↦ rfl) (fun _ _ ↦ rfl) @[to_additive] instance [Π i, CommMonoid (R i)] [∀ i, SubmonoidClass (S i) (R i)] : CommMonoid (Πʳ i, [R i, B i]_[𝓕]) := DFunLike.coe_injective.commMonoid _ rfl (fun _ _ ↦ rfl) (fun _ _ ↦ rfl) instance instZSMul [Π i, SubNegMonoid (R i)] [∀ i, AddSubgroupClass (S i) (R i)] : SMul ℤ (Πʳ i, [R i, B i]_[𝓕]) where smul n x := ⟨fun i ↦ n • x i, x.2.mono fun _ hi ↦ zsmul_mem hi n⟩ @[to_additive existing instZSMul] instance [Π i, DivInvMonoid (R i)] [∀ i, SubgroupClass (S i) (R i)] : Pow (Πʳ i, [R i, B i]_[𝓕]) ℤ where pow x n := ⟨fun i ↦ x i ^ n, x.2.mono fun _ hi ↦ zpow_mem hi n⟩ @[to_additive] lemma zpow_apply [Π i, DivInvMonoid (R i)] [∀ i, SubgroupClass (S i) (R i)] (x : Πʳ i, [R i, B i]_[𝓕]) (n : ℤ) (i : ι) : (x ^ n) i = x i ^ n := rfl instance [Π i, AddMonoidWithOne (R i)] [∀ i, AddSubmonoidWithOneClass (S i) (R i)] : NatCast (Πʳ i, [R i, B i]_[𝓕]) where natCast n := ⟨fun _ ↦ n, .of_forall fun _ ↦ natCast_mem _ n⟩ @[to_additive] instance [Π i, Group (R i)] [∀ i, SubgroupClass (S i) (R i)] : Group (Πʳ i, [R i, B i]_[𝓕]) := DFunLike.coe_injective.group _ rfl (fun _ _ ↦ rfl) (fun _ ↦ rfl) (fun _ _ ↦ rfl) (fun _ _ ↦ rfl) (fun _ _ ↦ rfl) @[to_additive] instance [Π i, CommGroup (R i)] [∀ i, SubgroupClass (S i) (R i)] : CommGroup (Πʳ i, [R i, B i]_[𝓕]) := DFunLike.coe_injective.commGroup _ rfl (fun _ _ ↦ rfl) (fun _ ↦ rfl) (fun _ _ ↦ rfl) (fun _ _ ↦ rfl) (fun _ _ ↦ rfl) instance [Π i, Ring (R i)] [∀ i, SubringClass (S i) (R i)] : IntCast (Πʳ i, [R i, B i]_[𝓕]) where intCast n := ⟨fun _ ↦ n, .of_forall fun _ ↦ intCast_mem _ n⟩ instance [Π i, Ring (R i)] [∀ i, SubringClass (S i) (R i)] : Ring (Πʳ i, [R i, B i]_[𝓕]) := DFunLike.coe_injective.ring _ rfl rfl (fun _ _ ↦ rfl) (fun _ _ ↦ rfl) (fun _ ↦ rfl) (fun _ _ ↦ rfl) (fun _ _ ↦ rfl) (fun _ _ ↦ rfl) (fun _ _ ↦ rfl) (fun _ ↦ rfl) (fun _ ↦ rfl) instance [Π i, CommRing (R i)] [∀ i, SubringClass (S i) (R i)] : CommRing (Πʳ i, [R i, B i]_[𝓕]) where mul_comm _ _ := DFunLike.coe_injective <| funext (fun _ ↦ mul_comm _ _) variable {R} in /-- The coercion from the restricted product of monoids `A i` to the (normal) product is a monoid homomorphism. -/ @[to_additive /-- The coercion from the restricted product of additive monoids `A i` to the (normal) product is an additive monoid homomorphism. -/] def coeMonoidHom [∀ i, Monoid (R i)] [∀ i, SubmonoidClass (S i) (R i)] : Πʳ i, [R i, B i]_[𝓕] →* Π i, R i where toFun := (↑) map_one' := rfl map_mul' _ _ := rfl instance {R₀ : Type*} [Semiring R₀] [Π i, AddCommMonoid (R i)] [Π i, Module R₀ (R i)] [∀ i, AddSubmonoidClass (S i) (R i)] [∀ i, SMulMemClass (S i) R₀ (R i)] : Module R₀ (Πʳ i, [R i, B i]_[𝓕]) := DFunLike.coe_injective.module R₀ (M := Π i, R i) coeAddMonoidHom (fun _ _ ↦ rfl) end Algebra section eval variable {S : ι → Type*} variable [Π i, SetLike (S i) (R i)] variable {B : Π i, S i} /-- `RestrictedProduct.evalMonoidHom j` is the monoid homomorphism from the restricted product `Πʳ i, [R i, B i]_[𝓕]` to the component `R j`. -/ @[to_additive /-- `RestrictedProduct.evalAddMonoidHom j` is the monoid homomorphism from the restricted product `Πʳ i, [R i, B i]_[𝓕]` to the component `R j`. -/] def evalMonoidHom (j : ι) [Π i, Monoid (R i)] [∀ i, SubmonoidClass (S i) (R i)] : (Πʳ i, [R i, B i]_[𝓕]) →* R j where toFun x := x j map_one' := rfl map_mul' _ _ := rfl @[simp] lemma evalMonoidHom_apply [Π i, Monoid (R i)] [∀ i, SubmonoidClass (S i) (R i)] (x : Πʳ i, [R i, B i]_[𝓕]) (j : ι) : evalMonoidHom R j x = x j := rfl /-- `RestrictedProduct.evalRingHom j` is the ring homomorphism from the restricted product `Πʳ i, [R i, B i]_[𝓕]` to the component `R j`. -/ def evalRingHom (j : ι) [Π i, Ring (R i)] [∀ i, SubringClass (S i) (R i)] : (Πʳ i, [R i, B i]_[𝓕]) →+* R j where __ := evalMonoidHom R j __ := evalAddMonoidHom R j @[simp] lemma evalRingHom_apply [Π i, Ring (R i)] [∀ i, SubringClass (S i) (R i)] (x : Πʳ i, [R i, B i]_[𝓕]) (j : ι) : evalRingHom R j x = x j := rfl end eval section map variable {ι₁ ι₂ : Type*} variable (R₁ : ι₁ → Type*) (R₂ : ι₂ → Type*) variable {𝓕₁ : Filter ι₁} {𝓕₂ : Filter ι₂} variable {A₁ : (i : ι₁) → Set (R₁ i)} {A₂ : (i : ι₂) → Set (R₂ i)} variable {S₁ : ι₁ → Type*} {S₂ : ι₂ → Type*} variable [Π i, SetLike (S₁ i) (R₁ i)] [Π j, SetLike (S₂ j) (R₂ j)] variable {B₁ : Π i, S₁ i} {B₂ : Π j, S₂ j} variable (f : ι₂ → ι₁) (hf : Tendsto f 𝓕₂ 𝓕₁) section set variable (φ : ∀ j, R₁ (f j) → R₂ j) (hφ : ∀ᶠ j in 𝓕₂, MapsTo (φ j) (A₁ (f j)) (A₂ j)) /-- Given two restricted products `Πʳ (i : ι₁), [R₁ i, A₁ i]_[𝓕₁]` and `Πʳ (j : ι₂), [R₂ j, A₂ j]_[𝓕₂]`, `RestrictedProduct.mapAlong` gives a function between them. The data needed is a function `f : ι₂ → ι₁` such that `𝓕₂` tends to `𝓕₁` along `f`, and functions `φ j : R₁ (f j) → R₂ j` sending `A₁ (f j)` into `A₂ j` for an `𝓕₂`-large set of `j`'s. See also `mapAlongMonoidHom`, `mapAlongAddMonoidHom` and `mapAlongRingHom` for variants. -/ def mapAlong (x : Πʳ i, [R₁ i, A₁ i]_[𝓕₁]) : Πʳ j, [R₂ j, A₂ j]_[𝓕₂] := ⟨fun j ↦ φ j (x (f j)), by filter_upwards [hf.eventually x.2, hφ] using fun _ h1 h2 ↦ h2 h1⟩ @[simp] lemma mapAlong_apply (x : Πʳ i, [R₁ i, A₁ i]_[𝓕₁]) (j : ι₂) : x.mapAlong R₁ R₂ f hf φ hφ j = φ j (x (f j)) := rfl -- variant of `mapAlong` where the index set is constant /-- The maps between restricted products over a fixed index type, given maps on the factors. -/ def map {G H : ι → Type*} {C : (i : ι) → Set (G i)} {D : (i : ι) → Set (H i)} (φ : (i : ι) → G i → H i) (hφ : ∀ᶠ i in 𝓕, MapsTo (φ i) (C i) (D i)) (x : Πʳ i, [G i, C i]_[𝓕]) : (Πʳ i, [H i, D i]_[𝓕]) := mapAlong G H id Filter.tendsto_id φ hφ x @[simp] lemma map_apply {G H : ι → Type*} {C : (i : ι) → Set (G i)} {D : (i : ι) → Set (H i)} (φ : (i : ι) → G i → H i) (hφ : ∀ᶠ i in 𝓕, MapsTo (φ i) (C i) (D i)) (x : Πʳ i, [G i, C i]_[𝓕]) (j : ι) : x.map φ hφ j = φ j (x j) := rfl end set section monoid variable [Π i, Monoid (R₁ i)] [Π i, Monoid (R₂ i)] [∀ i, SubmonoidClass (S₁ i) (R₁ i)] [∀ i, SubmonoidClass (S₂ i) (R₂ i)] (φ : ∀ j, R₁ (f j) →* R₂ j) (hφ : ∀ᶠ j in 𝓕₂, MapsTo (φ j) (B₁ (f j)) (B₂ j)) /-- Given two restricted products `Πʳ (i : ι₁), [R₁ i, B₁ i]_[𝓕₁]` and `Πʳ (j : ι₂), [R₂ j, B₂ j]_[𝓕₂]` of monoids, `RestrictedProduct.mapAlongMonoidHom` gives a monoid homomorphism between them. The data needed is a function `f : ι₂ → ι₁` such that `𝓕₂` tends to `𝓕₁` along `f`, and monoid homomorphisms `φ j : R₁ (f j) → R₂ j` sending `B₁ (f j)` into `B₂ j` for an `𝓕₂`-large set of `j`'s. -/ @[to_additive /-- Given two restricted products `Πʳ (i : ι₁), [R₁ i, B₁ i]_[𝓕₁]` and `Πʳ (j : ι₂), [R₂ j, B₂ j]_[𝓕₂]` of additive monoids, `RestrictedProduct.mapAlongAddMonoidHom` gives a additive monoid homomorphism between them. The data needed is a function `f : ι₂ → ι₁` such that `𝓕₂` tends to `𝓕₁` along `f`, and additive monoid homomorphisms `φ j : R₁ (f j) → R₂ j` sending `B₁ (f j)` into `B₂ j` for an `𝓕₂`-large set of `j`'s. -/] def mapAlongMonoidHom : Πʳ i, [R₁ i, B₁ i]_[𝓕₁] →* Πʳ j, [R₂ j, B₂ j]_[𝓕₂] where toFun := mapAlong R₁ R₂ f hf (fun j r ↦ φ j r) hφ map_one' := by ext i exact map_one (φ i) map_mul' x y := by ext i exact map_mul (φ i) _ _ @[to_additive (attr := simp)] lemma mapAlongMonoidHom_apply (x : Πʳ i, [R₁ i, B₁ i]_[𝓕₁]) (j : ι₂) : x.mapAlongMonoidHom R₁ R₂ f hf φ hφ j = φ j (x (f j)) := rfl end monoid section ring variable [Π i, Ring (R₁ i)] [Π i, Ring (R₂ i)] [∀ i, SubringClass (S₁ i) (R₁ i)] [∀ i, SubringClass (S₂ i) (R₂ i)] (φ : ∀ j, R₁ (f j) →+* R₂ j) (hφ : ∀ᶠ j in 𝓕₂, MapsTo (φ j) (B₁ (f j)) (B₂ j)) /-- Given two restricted products of rings `Πʳ (i : ι₁), [R₁ i, B₁ i]_[𝓕₁]` and `Πʳ (j : ι₂), [R₂ j, B₂ j]_[𝓕₂]`, `RestrictedProduct.mapAlongRingHom` gives a ring homomorphism between them. The data needed is a function `f : ι₂ → ι₁` such that `𝓕₂` tends to `𝓕₁` along `f`, and ring homomorphisms `φ j : R₁ (f j) → R₂ j` sending `B₁ (f j)` into `B₂ j` for an `𝓕₂`-large set of `j`'s. -/ def mapAlongRingHom : Πʳ i, [R₁ i, B₁ i]_[𝓕₁] →+* Πʳ j, [R₂ j, B₂ j]_[𝓕₂] where __ := mapAlongMonoidHom R₁ R₂ f hf (fun j ↦ φ j) hφ __ := mapAlongAddMonoidHom R₁ R₂ f hf (fun j ↦ φ j) hφ @[simp] lemma mapAlongRingHom_apply (x : Πʳ i, [R₁ i, B₁ i]_[𝓕₁]) (j : ι₂) : x.mapAlongRingHom R₁ R₂ f hf φ hφ j = φ j (x (f j)) := rfl end ring end map end RestrictedProduct
.lake/packages/mathlib/Mathlib/Topology/Algebra/RestrictedProduct/TopologicalSpace.lean
import Mathlib.Topology.Algebra.Group.Pointwise import Mathlib.Topology.Algebra.RestrictedProduct.Basic import Mathlib.Topology.Algebra.Ring.Basic /-! # Restricted products of topological spaces, topological groups and rings We endow a restricted product of topological spaces with a natural topology, which we describe below. We also show various compatibility results when we change filters, and extend the construction of restricted products of algebraic structures to the topological setting. In particular, with the theory of adeles in mind, we show that if each `R i` is a locally compact topological ring with open subring `A i`, and if all but finitely many of the `A i`s are also compact, then `Πʳ i, [R i, A i]` is a locally compact topological ring. ## Main definitions * `RestrictedProduct.topologicalSpace`: the `TopologicalSpace` instance on the restricted product `Πʳ i, [R i, A i]_[𝓕]`. ## Topology on the restricted product The topology on the restricted product `Πʳ i, [R i, A i]_[𝓕]` is defined in the following way: 1. If `𝓕` is some principal filter `𝓟 s`, recall that `Πʳ i, [R i, A i]_[𝓟 s]` is canonically identified with `(Π i ∈ s, A i) × (Π i ∉ s, R i)`. We endow it with the product topology, which is also the topology induced from the full product `Π i, R i`. 2. In general, we note that `𝓕` is the infimum of the principal filters coarser than `𝓕`. We then endow `Πʳ i, [R i, A i]_[𝓕]` with the inductive limit / final topology associated to the inclusion maps `Πʳ i, [R i, A i]_[𝓟 s] → Πʳ i, [R i, A i]_[𝓕]` where `𝓕 ≤ 𝓟 s`. In particular: * On the classical restricted product, with respect to the cofinite filter, this corresponds to taking the inductive limit of the `Πʳ i, [R i, A i]_[𝓟 s]` over all *cofinite* sets `s : Set ι`. * If `𝓕 = 𝓟 s` is a principal filter, this second step clearly does not change the topology, since `s` belongs to the indexing set of the inductive limit. Taking advantage of that second remark, we do not actually declare an instance specific to principal filters. Instead, we provide directly the general instance (corresponding to step 2 above) as `RestrictedProduct.topologicalSpace`. We then prove that, for a principal filter, the map to the full product is an inducing (`RestrictedProduct.isEmbedding_coe_of_principal`), and that the topology for a general `𝓕` is indeed the expected inductive limit (`RestrictedProduct.topologicalSpace_eq_iSup`). ## Main statements * `RestrictedProduct.isEmbedding_coe_of_principal`: for any set `S`, `Πʳ i, [R i, A i]_[𝓟 S]` is endowed with the subset topology coming from `Π i, R i`. * `RestrictedProduct.topologicalSpace_eq_iSup`: the topology on `Πʳ i, [R i, A i]_[𝓕]` is the inductive limit / final topology associated to the natural maps `Πʳ i, [R i, A i]_[𝓟 S] → Πʳ i, [R i, A i]_[𝓕]`, where `𝓕 ≤ 𝓟 S`. * `RestrictedProduct.continuous_dom`: a map from `Πʳ i, [R i, A i]_[𝓕]` is continuous *if and only if* its restriction to each `Πʳ i, [R i, A i]_[𝓟 s]` (with `𝓕 ≤ 𝓟 s`) is continuous. * `RestrictedProduct.continuous_dom_prod_left`: assume that each `A i` is an **open** subset of `R i`. Then, for any topological space `Y`, a map from `Y × Πʳ i, [R i, A i]` is continuous *if and only if* its restriction to each `Y × Πʳ i, [R i, A i]_[𝓟 S]` (with `S` cofinite) is continuous. * `RestrictedProduct.isTopologicalGroup`: if each `R i` is a topological group and each `A i` is an open subgroup of `R i`, then `Πʳ i, [R i, A i]` is a topological group. * `RestrictedProduct.isTopologicalRing`: if each `R i` is a topological ring and each `A i` is an open subring of `R i`, then `Πʳ i, [R i, A i]` is a topological ring. * `RestrictedProduct.continuousSMul`: if some topological monoid `G` acts on each `M i`, and each `A i` is stable for that action, then the natural action of `G` on `Πʳ i, [M i, A i]` is also continuous. In particular, if each `M i` is a topological `R`-module and each `A i` is an open sub-`R`-module of `M i`, then `Πʳ i, [M i, A i]` is a topological `R`-module. * `RestrictedProduct.weaklyLocallyCompactSpace_of_cofinite`: if each `R i` is weakly locally compact, each `A i` is open, and all but finitely many `A i`s are also compact, then the restricted product `Πʳ i, [R i, A i]` is weakly locally compact. * `RestrictedProduct.locallyCompactSpace_of_group`: assume that each `R i` is a locally compact group with `A i` an open subgroup. Assume also that all but finitely many `A i`s are compact. Then the restricted product `Πʳ i, [R i, A i]` is a locally compact group. ## Implementation details Outside of principal filters and the cofinite filter, the topology we define on the restricted product does not seem well-behaved. While declaring a single instance is practical, it may conflict with more interesting topologies in some other cases. Thus, future contributions should not restrain from specializing these instances to principal and cofinite filters if necessary. ## Tags restricted product, adeles, ideles -/ open Set Topology Filter variable {ι : Type*} variable (R : ι → Type*) (A : (i : ι) → Set (R i)) namespace RestrictedProduct open scoped RestrictedProduct variable {𝓕 𝓖 : Filter ι} section Topology /-! ## Topology on the restricted product The topology on the restricted product `Πʳ i, [R i, A i]_[𝓕]` is defined in the following way: 1. If `𝓕` is some principal filter `𝓟 s`, recall that `Πʳ i, [R i, A i]_[𝓟 s]` is canonically identified with `(Π i ∈ s, A i) × (Π i ∉ s, R i)`. We endow it with the product topology, which is also the topology induced from the full product `Π i, R i`. 2. In general, we note that `𝓕` is the infimum of the principal filters coarser than `𝓕`. We then endow `Πʳ i, [R i, A i]_[𝓕]` with the inductive limit / final topology associated to the inclusion maps `Πʳ i, [R i, A i]_[𝓟 s] → Πʳ i, [R i, A i]_[𝓕]` where `𝓕 ≤ 𝓟 s`. In particular: * On the classical restricted product, with respect to the cofinite filter, this corresponds to taking the inductive limit of the `Πʳ i, [R i, A i]_[𝓟 s]` over all *cofinite* sets `s : Set ι`. * If `𝓕 = 𝓟 s` is a principal filter, this second step clearly does not change the topology, since `s` belongs to the indexing set of the inductive limit. Taking advantage of that second remark, we do not actually declare an instance specific to principal filters. Instead, we provide directly the general instance (corresponding to step 2 above) as `RestrictedProduct.topologicalSpace`. We then prove that, for a principal filter, the map to the full product is an inducing (`RestrictedProduct.isEmbedding_coe_of_principal`), and that the topology for a general `𝓕` is indeed the expected inductive limit (`RestrictedProduct.topologicalSpace_eq_iSup`). Note: outside of these two cases, this topology on the restricted product does not seem well-behaved. While declaring a single instance is practical, it may conflict with more interesting topologies in some other cases. Thus, future contributions should not restrain from specializing these instances to principal and cofinite filters if necessary. -/ /-! ### Definition of the topology -/ variable {R A R' A'} variable {𝓕 : Filter ι} variable [∀ i, TopologicalSpace (R i)] variable (R A 𝓕) in instance topologicalSpace : TopologicalSpace (Πʳ i, [R i, A i]_[𝓕]) := ⨆ (S : Set ι) (hS : 𝓕 ≤ 𝓟 S), .coinduced (inclusion R A hS) (.induced ((↑) : Πʳ i, [R i, A i]_[𝓟 S] → Π i, R i) inferInstance) @[fun_prop] theorem continuous_coe : Continuous ((↑) : Πʳ i, [R i, A i]_[𝓕] → Π i, R i) := continuous_iSup_dom.mpr fun _ ↦ continuous_iSup_dom.mpr fun _ ↦ continuous_coinduced_dom.mpr continuous_induced_dom @[fun_prop] theorem continuous_eval (i : ι) : Continuous (fun (x : Πʳ i, [R i, A i]_[𝓕]) ↦ x i) := continuous_apply _ |>.comp continuous_coe @[fun_prop] theorem continuous_inclusion {𝓖 : Filter ι} (h : 𝓕 ≤ 𝓖) : Continuous (inclusion R A h) := by simp_rw [continuous_iff_coinduced_le, topologicalSpace, coinduced_iSup, coinduced_compose] exact iSup₂_le fun S hS ↦ le_iSup₂_of_le S (le_trans h hS) le_rfl instance [∀ i, T0Space (R i)] : T0Space (Πʳ i, [R i, A i]_[𝓕]) := t0Space_of_injective_of_continuous DFunLike.coe_injective continuous_coe instance [∀ i, T1Space (R i)] : T1Space (Πʳ i, [R i, A i]_[𝓕]) := t1Space_of_injective_of_continuous DFunLike.coe_injective continuous_coe instance [∀ i, T2Space (R i)] : T2Space (Πʳ i, [R i, A i]_[𝓕]) := .of_injective_continuous DFunLike.coe_injective continuous_coe section principal /-! ### Topological facts in the principal case -/ variable {S : Set ι} theorem topologicalSpace_eq_of_principal : topologicalSpace R A (𝓟 S) = .induced ((↑) : Πʳ i, [R i, A i]_[𝓟 S] → Π i, R i) inferInstance := le_antisymm (continuous_iff_le_induced.mp continuous_coe) <| (le_iSup₂_of_le S le_rfl <| by rw [inclusion_eq_id R A (𝓟 S), @coinduced_id]) theorem topologicalSpace_eq_of_top : topologicalSpace R A ⊤ = .induced ((↑) : Πʳ i, [R i, A i]_[⊤] → Π i, R i) inferInstance := principal_univ ▸ topologicalSpace_eq_of_principal theorem topologicalSpace_eq_of_bot : topologicalSpace R A ⊥ = .induced ((↑) : Πʳ i, [R i, A i]_[⊥] → Π i, R i) inferInstance := principal_empty ▸ topologicalSpace_eq_of_principal theorem isEmbedding_coe_of_principal : IsEmbedding ((↑) : Πʳ i, [R i, A i]_[𝓟 S] → Π i, R i) where eq_induced := topologicalSpace_eq_of_principal injective := DFunLike.coe_injective theorem isEmbedding_coe_of_top : IsEmbedding ((↑) : Πʳ i, [R i, A i]_[⊤] → Π i, R i) := principal_univ ▸ isEmbedding_coe_of_principal theorem isEmbedding_coe_of_bot : IsEmbedding ((↑) : Πʳ i, [R i, A i]_[⊥] → Π i, R i) := principal_empty ▸ isEmbedding_coe_of_principal theorem continuous_rng_of_principal {X : Type*} [TopologicalSpace X] {f : X → Πʳ i, [R i, A i]_[𝓟 S]} : Continuous f ↔ Continuous ((↑) ∘ f : X → Π i, R i) := isEmbedding_coe_of_principal.continuous_iff theorem continuous_rng_of_top {X : Type*} [TopologicalSpace X] {f : X → Πʳ i, [R i, A i]_[⊤]} : Continuous f ↔ Continuous ((↑) ∘ f : X → Π i, R i) := isEmbedding_coe_of_top.continuous_iff theorem continuous_rng_of_bot {X : Type*} [TopologicalSpace X] {f : X → Πʳ i, [R i, A i]_[⊥]} : Continuous f ↔ Continuous ((↑) ∘ f : X → Π i, R i) := isEmbedding_coe_of_bot.continuous_iff lemma continuous_rng_of_principal_iff_forall {X : Type*} [TopologicalSpace X] {f : X → Πʳ (i : ι), [R i, A i]_[𝓟 S]} : Continuous f ↔ ∀ i : ι, Continuous ((fun x ↦ x i) ∘ f) := continuous_rng_of_principal.trans continuous_pi_iff /-- The obvious bijection between `Πʳ i, [R i, A i]_[⊤]` and `Π i, A i` is a homeomorphism. -/ def homeoTop : (Π i, A i) ≃ₜ (Πʳ i, [R i, A i]_[⊤]) where toFun f := ⟨fun i ↦ f i, fun i ↦ (f i).2⟩ invFun f i := ⟨f i, f.2 i⟩ continuous_toFun := continuous_rng_of_top.mpr <| continuous_pi fun i ↦ continuous_subtype_val.comp <| continuous_apply i continuous_invFun := continuous_pi fun i ↦ continuous_induced_rng.mpr <| continuous_eval i /-- The obvious bijection between `Πʳ i, [R i, A i]_[⊥]` and `Π i, R i` is a homeomorphism. -/ def homeoBot : (Π i, R i) ≃ₜ (Πʳ i, [R i, A i]_[⊥]) where toFun f := ⟨fun i ↦ f i, eventually_bot⟩ invFun f i := f i continuous_toFun := continuous_rng_of_bot.mpr <| continuous_pi fun i ↦ continuous_apply i continuous_invFun := continuous_pi continuous_eval /-- Assume that `S` is a subset of `ι` with finite complement, that each `R i` is weakly locally compact, and that `A i` is *compact* for all `i ∈ S`. Then the restricted product `Πʳ i, [R i, A i]_[𝓟 S]` is locally compact. Note: we spell "`S` has finite complement" as `cofinite ≤ 𝓟 S`. -/ theorem weaklyLocallyCompactSpace_of_principal [∀ i, WeaklyLocallyCompactSpace (R i)] (hS : cofinite ≤ 𝓟 S) (hAcompact : ∀ i ∈ S, IsCompact (A i)) : WeaklyLocallyCompactSpace (Πʳ i, [R i, A i]_[𝓟 S]) where exists_compact_mem_nhds := fun x ↦ by rw [le_principal_iff, mem_cofinite] at hS classical have : ∀ i, ∃ K, IsCompact K ∧ K ∈ 𝓝 (x i) := fun i ↦ exists_compact_mem_nhds (x i) choose K K_compact hK using this set Q : Set (Π i, R i) := univ.pi (fun i ↦ if i ∈ S then A i else K i) with Q_def have Q_compact : IsCompact Q := isCompact_univ_pi fun i ↦ by split_ifs with his · exact hAcompact i his · exact K_compact i set U : Set (Π i, R i) := Sᶜ.pi K have U_nhds : U ∈ 𝓝 (x : Π i, R i) := set_pi_mem_nhds hS fun i _ ↦ hK i have QU : (↑) ⁻¹' U ⊆ ((↑) ⁻¹' Q : Set (Πʳ i, [R i, A i]_[𝓟 S])) := fun y H i _ ↦ by dsimp only split_ifs with hi · exact y.2 hi · exact H i hi refine ⟨((↑) ⁻¹' Q), ?_, mem_of_superset ?_ QU⟩ · refine isEmbedding_coe_of_principal.isCompact_preimage_iff ?_ |>.mpr Q_compact simp_rw [range_coe_principal, Q_def, pi_if, mem_univ, true_and] exact inter_subset_left · simpa only [isEmbedding_coe_of_principal.nhds_eq_comap] using preimage_mem_comap U_nhds instance [∀ i, WeaklyLocallyCompactSpace (R i)] [hS : Fact (cofinite ≤ 𝓟 S)] [hAcompact : ∀ i, CompactSpace (A i)] : WeaklyLocallyCompactSpace (Πʳ i, [R i, A i]_[𝓟 S]) := weaklyLocallyCompactSpace_of_principal hS.out fun _ _ ↦ isCompact_iff_compactSpace.mpr inferInstance end principal section general /-! ### Topological facts in the general case -/ variable (𝓕) in theorem topologicalSpace_eq_iSup : topologicalSpace R A 𝓕 = ⨆ (S : Set ι) (hS : 𝓕 ≤ 𝓟 S), .coinduced (inclusion R A hS) (topologicalSpace R A (𝓟 S)) := by simp_rw [topologicalSpace_eq_of_principal, topologicalSpace] /-- The **universal property** of the topology on the restricted product: a map from `Πʳ i, [R i, A i]_[𝓕]` is continuous *iff* its restriction to each `Πʳ i, [R i, A i]_[𝓟 s]` (with `𝓕 ≤ 𝓟 s`) is continuous. See also `RestrictedProduct.continuous_dom_prod_left`. -/ theorem continuous_dom {X : Type*} [TopologicalSpace X] {f : Πʳ i, [R i, A i]_[𝓕] → X} : Continuous f ↔ ∀ (S : Set ι) (hS : 𝓕 ≤ 𝓟 S), Continuous (f ∘ inclusion R A hS) := by simp_rw [topologicalSpace_eq_of_principal, continuous_iSup_dom, continuous_coinduced_dom] theorem isEmbedding_inclusion_principal {S : Set ι} (hS : 𝓕 ≤ 𝓟 S) : IsEmbedding (inclusion R A hS) := .of_comp (continuous_inclusion hS) continuous_coe isEmbedding_coe_of_principal theorem isEmbedding_inclusion_top : IsEmbedding (inclusion R A (le_top : 𝓕 ≤ ⊤)) := .of_comp (continuous_inclusion _) continuous_coe isEmbedding_coe_of_top /-- `Π i, A i` has the subset topology from the restricted product. -/ theorem isEmbedding_structureMap : IsEmbedding (structureMap R A 𝓕) := isEmbedding_inclusion_top.comp homeoTop.isEmbedding end general section cofinite /-! ### Topological facts in the case where `𝓕 = cofinite` and all `A i`s are open The classical restricted product, associated to the cofinite filter, satisfies more topological properties when each `A i` is an open subset of `R i`. The key fact is that each `Πʳ i, [R i, A i]_[𝓟 S]` (with `S` cofinite) then embeds **as an open subset** in `Πʳ i, [R i, A i]`. This allows us to prove a "universal property with parameters", expressing that for any arbitrary topological space `X` (of "parameters"), the product `X × Πʳ i, [R i, A i]` is still the inductive limit of the `X × Πʳ i, [R i, A i]_[𝓟 S]` for `S` cofinite. This fact, which is **not true** for a general inductive limit, will allow us to prove continuity of functions of two variables (e.g algebraic operations), which would otherwise be inaccessible. -/ variable (hAopen : ∀ i, IsOpen (A i)) include hAopen in theorem isOpen_forall_imp_mem_of_principal {S : Set ι} (hS : cofinite ≤ 𝓟 S) {p : ι → Prop} : IsOpen {f : Πʳ i, [R i, A i]_[𝓟 S] | ∀ i, p i → f.1 i ∈ A i} := by rw [le_principal_iff] at hS convert isOpen_set_pi (hS.inter_of_left {i | p i}) (fun i _ ↦ hAopen i) |>.preimage continuous_coe ext f refine ⟨fun H i hi ↦ H i hi.2, fun H i hiT ↦ ?_⟩ by_cases hiS : i ∈ S · exact f.2 hiS · exact H i ⟨hiS, hiT⟩ include hAopen in theorem isOpen_forall_mem_of_principal {S : Set ι} (hS : cofinite ≤ 𝓟 S) : IsOpen {f : Πʳ i, [R i, A i]_[𝓟 S] | ∀ i, f.1 i ∈ A i} := by convert isOpen_forall_imp_mem_of_principal hAopen hS (p := fun _ ↦ True) simp include hAopen in theorem isOpen_forall_imp_mem {p : ι → Prop} : IsOpen {f : Πʳ i, [R i, A i] | ∀ i, p i → f.1 i ∈ A i} := by simp_rw [topologicalSpace_eq_iSup cofinite, isOpen_iSup_iff, isOpen_coinduced] exact fun S hS ↦ isOpen_forall_imp_mem_of_principal hAopen hS include hAopen in theorem isOpen_forall_mem : IsOpen {f : Πʳ i, [R i, A i] | ∀ i, f.1 i ∈ A i} := by simp_rw [topologicalSpace_eq_iSup cofinite, isOpen_iSup_iff, isOpen_coinduced] exact fun S hS ↦ isOpen_forall_mem_of_principal hAopen hS include hAopen in theorem isOpenEmbedding_inclusion_principal {S : Set ι} (hS : cofinite ≤ 𝓟 S) : IsOpenEmbedding (inclusion R A hS) where toIsEmbedding := isEmbedding_inclusion_principal hS isOpen_range := by rw [range_inclusion] exact isOpen_forall_imp_mem hAopen include hAopen in /-- `Π i, A i` is homeomorphic to an open subset of the restricted product. -/ theorem isOpenEmbedding_structureMap : IsOpenEmbedding (structureMap R A cofinite) where toIsEmbedding := isEmbedding_structureMap isOpen_range := by rw [range_structureMap] exact isOpen_forall_mem hAopen include hAopen in theorem nhds_eq_map_inclusion {S : Set ι} (hS : cofinite ≤ 𝓟 S) (x : Πʳ i, [R i, A i]_[𝓟 S]) : (𝓝 (inclusion R A hS x)) = .map (inclusion R A hS) (𝓝 x) := by rw [isOpenEmbedding_inclusion_principal hAopen hS |>.map_nhds_eq x] include hAopen in theorem nhds_eq_map_structureMap (x : Π i, A i) : (𝓝 (structureMap R A cofinite x)) = .map (structureMap R A cofinite) (𝓝 x) := by rw [isOpenEmbedding_structureMap hAopen |>.map_nhds_eq x] include hAopen in /-- If each `R i` is weakly locally compact, each `A i` is open, and all but finitely many `A i`s are also compact, then the restricted product `Πʳ i, [R i, A i]` is weakly locally compact. -/ theorem weaklyLocallyCompactSpace_of_cofinite [∀ i, WeaklyLocallyCompactSpace (R i)] (hAcompact : ∀ᶠ i in cofinite, IsCompact (A i)) : WeaklyLocallyCompactSpace (Πʳ i, [R i, A i]) where exists_compact_mem_nhds := fun x ↦ by set S := {i | IsCompact (A i) ∧ x i ∈ A i} have hS : cofinite ≤ 𝓟 S := le_principal_iff.mpr (hAcompact.and x.2) have hSx : ∀ i ∈ S, x i ∈ A i := fun i hi ↦ hi.2 have hSA : ∀ i ∈ S, IsCompact (A i) := fun i hi ↦ hi.1 haveI := weaklyLocallyCompactSpace_of_principal hS hSA rcases exists_inclusion_eq_of_eventually R A hS hSx with ⟨x', hxx'⟩ rw [← hxx', nhds_eq_map_inclusion hAopen] rcases exists_compact_mem_nhds x' with ⟨K, K_compact, hK⟩ exact ⟨inclusion R A hS '' K, K_compact.image (continuous_inclusion hS), image_mem_map hK⟩ instance [hAopen : Fact (∀ i, IsOpen (A i))] [∀ i, WeaklyLocallyCompactSpace (R i)] [hAcompact : ∀ i, CompactSpace (A i)] : WeaklyLocallyCompactSpace (Πʳ i, [R i, A i]) := weaklyLocallyCompactSpace_of_cofinite hAopen.out <| .of_forall fun _ ↦ isCompact_iff_compactSpace.mpr inferInstance include hAopen in /-- The **universal property with parameters** of the topology on the restricted product: for any topological space `Y` of "parameters", a map from `(Πʳ i, [R i, A i]) × Y` is continuous *iff* its restriction to each `(Πʳ i, [R i, A i]_[𝓟 S]) × Y` (with `S` cofinite) is continuous. -/ theorem continuous_dom_prod_right {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] {f : Πʳ i, [R i, A i] × Y → X} : Continuous f ↔ ∀ (S : Set ι) (hS : cofinite ≤ 𝓟 S), Continuous (f ∘ (Prod.map (inclusion R A hS) id)) := by refine ⟨fun H S hS ↦ H.comp ((continuous_inclusion hS).prodMap continuous_id), fun H ↦ ?_⟩ simp_rw [continuous_iff_continuousAt, ContinuousAt] rintro ⟨x, y⟩ set S : Set ι := {i | x i ∈ A i} have hS : cofinite ≤ 𝓟 S := le_principal_iff.mpr x.2 have hxS : ∀ i ∈ S, x i ∈ A i := fun i hi ↦ hi rcases exists_inclusion_eq_of_eventually R A hS hxS with ⟨x', hxx'⟩ rw [← hxx', nhds_prod_eq, nhds_eq_map_inclusion hAopen hS x', ← Filter.map_id (f := 𝓝 y), prod_map_map_eq, ← nhds_prod_eq, tendsto_map'_iff] exact H S hS |>.tendsto ⟨x', y⟩ -- TODO: get from the previous one instead of copy-pasting include hAopen in /-- The **universal property with parameters** of the topology on the restricted product: for any topological space `Y` of "parameters", a map from `Y × Πʳ i, [R i, A i]` is continuous *iff* its restriction to each `Y × Πʳ i, [R i, A i]_[𝓟 S]` (with `S` cofinite) is continuous. -/ theorem continuous_dom_prod_left {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] {f : Y × Πʳ i, [R i, A i] → X} : Continuous f ↔ ∀ (S : Set ι) (hS : cofinite ≤ 𝓟 S), Continuous (f ∘ (Prod.map id (inclusion R A hS))) := by refine ⟨fun H S hS ↦ H.comp (continuous_id.prodMap (continuous_inclusion hS)), fun H ↦ ?_⟩ simp_rw [continuous_iff_continuousAt, ContinuousAt] rintro ⟨y, x⟩ set S : Set ι := {i | x i ∈ A i} have hS : cofinite ≤ 𝓟 S := le_principal_iff.mpr x.2 have hxS : ∀ i ∈ S, x i ∈ A i := fun i hi ↦ hi rcases exists_inclusion_eq_of_eventually R A hS hxS with ⟨x', hxx'⟩ rw [← hxx', nhds_prod_eq, nhds_eq_map_inclusion hAopen hS x', ← Filter.map_id (f := 𝓝 y), prod_map_map_eq, ← nhds_prod_eq, tendsto_map'_iff] exact H S hS |>.tendsto ⟨y, x'⟩ include hAopen in /-- A map from `Πʳ i, [R i, A i] × Πʳ i, [R' i, A' i]` is continuous *iff* its restriction to each `Πʳ i, [R i, A i]_[𝓟 S] × Πʳ i, [R' i, A' i]_[𝓟 S]` (with `S` cofinite) is continuous. This is the key result for continuity of multiplication and addition. -/ theorem continuous_dom_prod {R' : ι → Type*} {A' : (i : ι) → Set (R' i)} [∀ i, TopologicalSpace (R' i)] (hAopen' : ∀ i, IsOpen (A' i)) {X : Type*} [TopologicalSpace X] {f : Πʳ i, [R i, A i] × Πʳ i, [R' i, A' i] → X} : Continuous f ↔ ∀ (S : Set ι) (hS : cofinite ≤ 𝓟 S), Continuous (f ∘ (Prod.map (inclusion R A hS) (inclusion R' A' hS))) := by simp_rw [continuous_dom_prod_right hAopen, continuous_dom_prod_left hAopen'] refine ⟨fun H S hS ↦ H S hS S hS, fun H S hS T hT ↦ ?_⟩ set U := S ∩ T have hU : cofinite ≤ 𝓟 (S ∩ T) := inf_principal ▸ le_inf hS hT have hSU : 𝓟 U ≤ 𝓟 S := principal_mono.mpr inter_subset_left have hTU : 𝓟 U ≤ 𝓟 T := principal_mono.mpr inter_subset_right exact (H U hU).comp ((continuous_inclusion hSU).prodMap (continuous_inclusion hTU)) /-- A finitary (instead of binary) version of `continuous_dom_prod`. -/ theorem continuous_dom_pi {n : Type*} [Finite n] {X : Type*} [TopologicalSpace X] {A : n → ι → Type*} [∀ j i, TopologicalSpace (A j i)] {C : (j : n) → (i : ι) → Set (A j i)} (hCopen : ∀ j i, IsOpen (C j i)) {f : (Π j : n, Πʳ i : ι, [A j i, C j i]) → X} : Continuous f ↔ ∀ (S : Set ι) (hS : cofinite ≤ 𝓟 S), Continuous (f ∘ Pi.map fun _ ↦ inclusion _ _ hS) := by refine ⟨by fun_prop, fun H ↦ ?_⟩ simp_rw [continuous_iff_continuousAt, ContinuousAt] intro x set S : Set ι := {i | ∀ j, x j i ∈ C j i} have hS : cofinite ≤ 𝓟 S := by rw [le_principal_iff] change ∀ᶠ i in cofinite, ∀ j : n, x j i ∈ C j i simp [-eventually_cofinite] let x' (j : n) : Πʳ i : ι, [A j i, C j i]_[𝓟 S] := .mk (fun i ↦ x j i) (fun i hi ↦ hi _) have hxx' : Pi.map (fun j ↦ inclusion _ _ hS) x' = x := rfl simp_rw [← hxx', nhds_pi, Pi.map_apply, nhds_eq_map_inclusion (hCopen _), ← map_piMap_pi_finite, tendsto_map'_iff, ← nhds_pi] exact (H _ _).tendsto _ end cofinite end Topology section Compatibility /-! ## Compatibility properties between algebra and topology -/ variable {S : ι → Type*} -- subobject type variable [Π i, SetLike (S i) (R i)] variable {B : Π i, S i} variable {T : Set ι} {𝓕 : Filter ι} variable [Π i, TopologicalSpace (R i)] section general @[to_additive] instance [Π i, Inv (R i)] [∀ i, InvMemClass (S i) (R i)] [∀ i, ContinuousInv (R i)] : ContinuousInv (Πʳ i, [R i, B i]_[𝓕]) where continuous_inv := by rw [continuous_dom] intro T hT haveI : ContinuousInv (Πʳ i, [R i, B i]_[𝓟 T]) := isEmbedding_coe_of_principal.continuousInv fun _ ↦ rfl exact (continuous_inclusion hT).comp continuous_inv @[to_additive] instance {G : Type*} [Π i, SMul G (R i)] [∀ i, SMulMemClass (S i) G (R i)] [∀ i, ContinuousConstSMul G (R i)] : ContinuousConstSMul G (Πʳ i, [R i, B i]_[𝓕]) where continuous_const_smul g := by rw [continuous_dom] intro T hT haveI : ContinuousConstSMul G (Πʳ i, [R i, B i]_[𝓟 T]) := isEmbedding_coe_of_principal.continuousConstSMul id rfl exact (continuous_inclusion hT).comp (continuous_const_smul g) end general section principal @[to_additive] instance [Π i, Mul (R i)] [∀ i, MulMemClass (S i) (R i)] [∀ i, ContinuousMul (R i)] : ContinuousMul (Πʳ i, [R i, B i]_[𝓟 T]) := let φ : Πʳ i, [R i, B i]_[𝓟 T] →ₙ* Π i, R i := { toFun := (↑) map_mul' := fun _ _ ↦ rfl } isEmbedding_coe_of_principal.continuousMul φ @[to_additive] instance {G : Type*} [TopologicalSpace G] [Π i, SMul G (R i)] [∀ i, SMulMemClass (S i) G (R i)] [∀ i, ContinuousSMul G (R i)] : ContinuousSMul G (Πʳ i, [R i, B i]_[𝓟 T]) := isEmbedding_coe_of_principal.continuousSMul continuous_id rfl @[to_additive] instance [Π i, Group (R i)] [∀ i, SubgroupClass (S i) (R i)] [∀ i, IsTopologicalGroup (R i)] : IsTopologicalGroup (Πʳ i, [R i, B i]_[𝓟 T]) where instance [Π i, Ring (R i)] [∀ i, SubringClass (S i) (R i)] [∀ i, IsTopologicalRing (R i)] : IsTopologicalRing (Πʳ i, [R i, B i]_[𝓟 T]) where end principal section cofinite theorem nhds_zero_eq_map_ofPre [Π i, Zero (R i)] [∀ i, ZeroMemClass (S i) (R i)] (hBopen : ∀ i, IsOpen (B i : Set (R i))) (hT : cofinite ≤ 𝓟 T) : (𝓝 (inclusion R (fun i ↦ B i) hT 0)) = .map (inclusion R (fun i ↦ B i) hT) (𝓝 0) := nhds_eq_map_inclusion hBopen hT 0 theorem nhds_zero_eq_map_structureMap [Π i, Zero (R i)] [∀ i, ZeroMemClass (S i) (R i)] (hBopen : ∀ i, IsOpen (B i : Set (R i))) : (𝓝 (structureMap R (fun i ↦ B i) cofinite 0)) = .map (structureMap R (fun i ↦ B i) cofinite) (𝓝 0) := nhds_eq_map_structureMap hBopen 0 -- TODO: Make `IsOpen` a class like `IsClosed` ? variable [hBopen : Fact (∀ i, IsOpen (B i : Set (R i)))] @[to_additive] instance [Π i, Mul (R i)] [∀ i, MulMemClass (S i) (R i)] [∀ i, ContinuousMul (R i)] : ContinuousMul (Πʳ i, [R i, B i]) where continuous_mul := by rw [continuous_dom_prod hBopen.out hBopen.out] exact fun S hS ↦ (continuous_inclusion hS).comp continuous_mul @[to_additive] instance continuousSMul {G : Type*} [TopologicalSpace G] [Π i, SMul G (R i)] [∀ i, SMulMemClass (S i) G (R i)] [∀ i, ContinuousSMul G (R i)] : ContinuousSMul G (Πʳ i, [R i, B i]) where continuous_smul := by rw [continuous_dom_prod_left hBopen.out] exact fun S hS ↦ (continuous_inclusion hS).comp continuous_smul @[to_additive] instance isTopologicalGroup [Π i, Group (R i)] [∀ i, SubgroupClass (S i) (R i)] [∀ i, IsTopologicalGroup (R i)] : IsTopologicalGroup (Πʳ i, [R i, B i]) where instance isTopologicalRing [Π i, Ring (R i)] [∀ i, SubringClass (S i) (R i)] [∀ i, IsTopologicalRing (R i)] : IsTopologicalRing (Πʳ i, [R i, B i]) where /-- Assume that each `R i` is a locally compact group with `A i` an open subgroup. Assume also that all but finitely many `A i`s are compact. Then the restricted product `Πʳ i, [R i, A i]` is a locally compact group. -/ @[to_additive /-- Assume that each `R i` is a locally compact additive group with `A i` an open subgroup. Assume also that all but finitely many `A i`s are compact. Then the restricted product `Πʳ i, [R i, A i]` is a locally compact additive group. -/] theorem locallyCompactSpace_of_group [Π i, Group (R i)] [∀ i, SubgroupClass (S i) (R i)] [∀ i, IsTopologicalGroup (R i)] [∀ i, LocallyCompactSpace (R i)] (hBcompact : ∀ᶠ i in cofinite, IsCompact (B i : Set (R i))) : LocallyCompactSpace (Πʳ i, [R i, B i]) := haveI : WeaklyLocallyCompactSpace (Πʳ i, [R i, B i]) := weaklyLocallyCompactSpace_of_cofinite hBopen.out hBcompact inferInstance open Pointwise in @[to_additive] instance [Π i, Group (R i)] [∀ i, SubgroupClass (S i) (R i)] [∀ i, IsTopologicalGroup (R i)] [hAcompact : ∀ i, CompactSpace (B i)] : LocallyCompactSpace (Πʳ i, [R i, B i]) := -- TODO: extract as a lemma haveI : ∀ i, WeaklyLocallyCompactSpace (R i) := fun i ↦ .mk fun x ↦ ⟨x • (B i : Set (R i)), .smul _ (isCompact_iff_compactSpace.mpr inferInstance), hBopen.out i |>.smul _ |>.mem_nhds <| by simpa using smul_mem_smul_set (a := x) (one_mem (B i))⟩ locallyCompactSpace_of_group _ <| .of_forall fun _ ↦ isCompact_iff_compactSpace.mpr inferInstance end cofinite end Compatibility section map_continuous variable {ι₁ ι₂ : Type*} variable (R₁ : ι₁ → Type*) (R₂ : ι₂ → Type*) variable [∀ i, TopologicalSpace (R₁ i)] [∀ i, TopologicalSpace (R₂ i)] variable {𝓕₁ : Filter ι₁} {𝓕₂ : Filter ι₂} variable {A₁ : (i : ι₁) → Set (R₁ i)} {A₂ : (i : ι₂) → Set (R₂ i)} variable (f : ι₂ → ι₁) (hf : Tendsto f 𝓕₂ 𝓕₁) variable (φ : ∀ j, R₁ (f j) → R₂ j) (hφ : ∀ᶠ j in 𝓕₂, MapsTo (φ j) (A₁ (f j)) (A₂ j)) theorem mapAlong_continuous (φ_cont : ∀ j, Continuous (φ j)) : Continuous (mapAlong R₁ R₂ f hf φ hφ) := by rw [continuous_dom] intro S hS set T := f ⁻¹' S ∩ {j | MapsTo (φ j) (A₁ (f j)) (A₂ j)} have hT : 𝓕₂ ≤ 𝓟 T := by rw [le_principal_iff] at hS ⊢ exact inter_mem (hf hS) hφ have hf' : Tendsto f (𝓟 T) (𝓟 S) := by aesop have hφ' : ∀ᶠ j in 𝓟 T, MapsTo (φ j) (A₁ (f j)) (A₂ j) := by aesop have key : mapAlong R₁ R₂ f hf φ hφ ∘ inclusion R₁ A₁ hS = inclusion R₂ A₂ hT ∘ mapAlong R₁ R₂ f hf' φ hφ' := rfl rw [key] exact continuous_inclusion _ |>.comp <| continuous_rng_of_principal.mpr <| continuous_pi fun j ↦ φ_cont j |>.comp <| continuous_eval (f j) end map_continuous end RestrictedProduct
.lake/packages/mathlib/Mathlib/Topology/Algebra/Category/ProfiniteGrp/Basic.lean
import Mathlib.Algebra.Category.Grp.FiniteGrp import Mathlib.Topology.Algebra.Group.ClosedSubgroup import Mathlib.Topology.Algebra.ContinuousMonoidHom import Mathlib.Topology.Category.Profinite.Basic import Mathlib.Topology.Separation.Connected /-! # Category of Profinite Groups We say `G` is a profinite group if it is a topological group which is compact and totally disconnected. ## Main definitions and results * `ProfiniteGrp` is the category of profinite groups. * `ProfiniteGrp.pi` : The pi-type of profinite groups is also a profinite group. * `ofFiniteGrp` : A `FiniteGrp` when given the discrete topology can be considered as a profinite group. * `ofClosedSubgroup` : A closed subgroup of a profinite group is profinite. -/ universe u v open CategoryTheory Topology /-- The category of profinite groups. A term of this type consists of a profinite set with a topological group structure. -/ @[pp_with_univ] structure ProfiniteGrp where /-- The underlying profinite topological space. -/ toProfinite : Profinite /-- The group structure. -/ [group : Group toProfinite] /-- The above data together form a topological group. -/ [topologicalGroup : IsTopologicalGroup toProfinite] /-- The category of profinite additive groups. A term of this type consists of a profinite set with a topological additive group structure. -/ @[pp_with_univ] structure ProfiniteAddGrp where /-- The underlying profinite topological space. -/ toProfinite : Profinite /-- The additive group structure. -/ [addGroup : AddGroup toProfinite] /-- The above data together form a topological additive group. -/ [topologicalAddGroup : IsTopologicalAddGroup toProfinite] attribute [to_additive] ProfiniteGrp @[to_additive] instance : CoeSort ProfiniteGrp (Type u) where coe G := G.toProfinite attribute [instance] ProfiniteGrp.group ProfiniteGrp.topologicalGroup ProfiniteAddGrp.addGroup ProfiniteAddGrp.topologicalAddGroup /-- Construct a term of `ProfiniteGrp` from a type endowed with the structure of a compact and totally disconnected topological group. (The condition of being Hausdorff can be omitted here because totally disconnected implies that {1} is a closed set, thus implying Hausdorff in a topological group.) -/ @[to_additive /-- Construct a term of `ProfiniteAddGrp` from a type endowed with the structure of a compact and totally disconnected topological additive group. (The condition of being Hausdorff can be omitted here because totally disconnected implies that {0} is a closed set, thus implying Hausdorff in a topological additive group.) -/] abbrev ProfiniteGrp.of (G : Type u) [Group G] [TopologicalSpace G] [IsTopologicalGroup G] [CompactSpace G] [TotallyDisconnectedSpace G] : ProfiniteGrp.{u} where toProfinite := .of G group := ‹_› topologicalGroup := ‹_› @[to_additive] lemma ProfiniteGrp.coe_of (G : Type u) [Group G] [TopologicalSpace G] [IsTopologicalGroup G] [CompactSpace G] [TotallyDisconnectedSpace G] : (ProfiniteGrp.of G : Type u) = G := rfl /-- The type of morphisms in `ProfiniteAddGrp`. -/ @[ext] structure ProfiniteAddGrp.Hom (A B : ProfiniteAddGrp.{u}) where private mk :: /-- The underlying `ContinuousAddMonoidHom`. -/ hom' : A →ₜ+ B /-- The type of morphisms in `ProfiniteGrp`. -/ @[to_additive existing (attr := ext)] structure ProfiniteGrp.Hom (A B : ProfiniteGrp.{u}) where private mk :: /-- The underlying `ContinuousMonoidHom`. -/ hom' : A →ₜ* B @[to_additive] instance : Category ProfiniteGrp where Hom A B := ProfiniteGrp.Hom A B id A := ⟨ContinuousMonoidHom.id A⟩ comp f g := ⟨g.hom'.comp f.hom'⟩ @[to_additive] instance : ConcreteCategory ProfiniteGrp (fun X Y => X →ₜ* Y) where hom f := f.hom' ofHom f := ⟨f⟩ /-- The underlying `ContinuousMonoidHom`. -/ @[to_additive /-- The underlying `ContinuousAddMonoidHom`. -/] abbrev ProfiniteGrp.Hom.hom {M N : ProfiniteGrp.{u}} (f : ProfiniteGrp.Hom M N) : M →ₜ* N := ConcreteCategory.hom (C := ProfiniteGrp) f /-- Typecheck a `ContinuousMonoidHom` as a morphism in `ProfiniteGrp`. -/ @[to_additive /-- Typecheck a `ContinuousAddMonoidHom` as a morphism in `ProfiniteAddGrp`. -/] abbrev ProfiniteGrp.ofHom {X Y : Type u} [Group X] [TopologicalSpace X] [IsTopologicalGroup X] [CompactSpace X] [TotallyDisconnectedSpace X] [Group Y] [TopologicalSpace Y] [IsTopologicalGroup Y] [CompactSpace Y] [TotallyDisconnectedSpace Y] (f : X →ₜ* Y) : ProfiniteGrp.of X ⟶ ProfiniteGrp.of Y := ConcreteCategory.ofHom f namespace ProfiniteGrp @[to_additive] instance {M N : ProfiniteGrp.{u}} : CoeFun (M ⟶ N) (fun _ ↦ M → N) where coe f := f.hom @[to_additive (attr := simp)] lemma hom_id {A : ProfiniteGrp.{u}} : (𝟙 A : A ⟶ A).hom = ContinuousMonoidHom.id A := rfl /- Provided for rewriting. -/ @[to_additive] lemma id_apply (A : ProfiniteGrp.{u}) (a : A) : (𝟙 A : A ⟶ A) a = a := by simp @[to_additive (attr := simp)] lemma hom_comp {A B C : ProfiniteGrp.{u}} (f : A ⟶ B) (g : B ⟶ C) : (f ≫ g).hom = g.hom.comp f.hom := rfl /- Provided for rewriting. -/ @[to_additive] lemma comp_apply {A B C : ProfiniteGrp.{u}} (f : A ⟶ B) (g : B ⟶ C) (a : A) : (f ≫ g) a = g (f a) := by simp only [hom_comp, ContinuousMonoidHom.comp_toFun] @[to_additive (attr := ext)] lemma hom_ext {A B : ProfiniteGrp.{u}} {f g : A ⟶ B} (hf : f.hom = g.hom) : f = g := Hom.ext hf variable {X Y Z : Type u} [Group X] [TopologicalSpace X] [IsTopologicalGroup X] [CompactSpace X] [TotallyDisconnectedSpace X] [Group Y] [TopologicalSpace Y] [IsTopologicalGroup Y] [CompactSpace Y] [TotallyDisconnectedSpace Y] [Group Z] [TopologicalSpace Z] [IsTopologicalGroup Z] [CompactSpace Z] [TotallyDisconnectedSpace Z] @[to_additive (attr := simp)] lemma hom_ofHom (f : X →ₜ* Y) : (ofHom f).hom = f := rfl @[to_additive (attr := simp)] lemma ofHom_hom {A B : ProfiniteGrp.{u}} (f : A ⟶ B) : ofHom (Hom.hom f) = f := rfl @[to_additive (attr := simp)] lemma ofHom_id : ofHom (ContinuousMonoidHom.id X) = 𝟙 (of X) := rfl @[to_additive (attr := simp)] lemma ofHom_comp (f : X →ₜ* Y) (g : Y →ₜ* Z) : ofHom (g.comp f) = ofHom f ≫ ofHom g := rfl @[to_additive] lemma ofHom_apply (f : X →ₜ* Y) (x : X) : ofHom f x = f x := rfl @[to_additive] lemma inv_hom_apply {A B : ProfiniteGrp.{u}} (e : A ≅ B) (x : A) : e.inv (e.hom x) = x := by simp @[to_additive] lemma hom_inv_apply {A B : ProfiniteGrp.{u}} (e : A ≅ B) (x : B) : e.hom (e.inv x) = x := by simp @[to_additive (attr := simp)] theorem coe_id (X : ProfiniteGrp) : (𝟙 X : X → X) = id := rfl @[to_additive (attr := simp)] theorem coe_comp {X Y Z : ProfiniteGrp} (f : X ⟶ Y) (g : Y ⟶ Z) : (f ≫ g : X → Z) = g ∘ f := rfl /-- Construct a term of `ProfiniteGrp` from a type endowed with the structure of a profinite topological group. -/ @[to_additive /-- Construct a term of `ProfiniteAddGrp` from a type endowed with the structure of a profinite topological additive group. -/] abbrev ofProfinite (G : Profinite) [Group G] [IsTopologicalGroup G] : ProfiniteGrp := of G /-- The pi-type of profinite groups is a profinite group. -/ @[to_additive /-- The pi-type of profinite additive groups is a profinite additive group. -/] def pi {α : Type u} (β : α → ProfiniteGrp) : ProfiniteGrp := let pitype := Profinite.pi fun (a : α) => (β a).toProfinite letI (a : α): Group (β a).toProfinite := (β a).group letI : Group pitype := Pi.group letI : IsTopologicalGroup pitype := Pi.topologicalGroup ofProfinite pitype /-- A `FiniteGrp` when given the discrete topology can be considered as a profinite group. -/ @[to_additive /-- A `FiniteAddGrp` when given the discrete topology can be considered as a profinite additive group. -/] def ofFiniteGrp (G : FiniteGrp) : ProfiniteGrp := letI : TopologicalSpace G := ⊥ letI : DiscreteTopology G := ⟨rfl⟩ letI : IsTopologicalGroup G := {} of G @[to_additive] instance : HasForget₂ FiniteGrp ProfiniteGrp where forget₂ := { obj := ofFiniteGrp map := fun f => ⟨f.hom, by continuity⟩ } @[to_additive] instance : HasForget₂ ProfiniteGrp GrpCat where forget₂.obj P := GrpCat.of P forget₂.map f := GrpCat.ofHom f.hom.toMonoidHom /-- A closed subgroup of a profinite group is profinite. -/ @[to_additive /-- A closed additive subgroup of a profinite additive group is profinite. -/] def ofClosedSubgroup {G : ProfiniteGrp} (H : ClosedSubgroup G) : ProfiniteGrp := letI : CompactSpace H := inferInstance of H.1 /-- A topological group that has a `ContinuousMulEquiv` to a profinite group is profinite. -/ @[to_additive /-- A topological additive group that has a `ContinuousAddEquiv` to a profinite additive group is profinite. -/] def ofContinuousMulEquiv {G : ProfiniteGrp.{u}} {H : Type v} [TopologicalSpace H] [Group H] [IsTopologicalGroup H] (e : G ≃ₜ* H) : ProfiniteGrp.{v} := let _ : CompactSpace H := Homeomorph.compactSpace e.toHomeomorph let _ : TotallyDisconnectedSpace H := Homeomorph.totallyDisconnectedSpace e.toHomeomorph .of H /-- Build an isomorphism in the category `ProfiniteGrp` from a `ContinuousMulEquiv` between `ProfiniteGrp`s. -/ def ContinuousMulEquiv.toProfiniteGrpIso {X Y : ProfiniteGrp} (e : X ≃ₜ* Y) : X ≅ Y where hom := ofHom e inv := ofHom e.symm /-- The functor mapping a profinite group to its underlying profinite space. -/ @[to_additive] instance : HasForget₂ ProfiniteGrp Profinite where forget₂ := { obj G := G.toProfinite map f := CompHausLike.ofHom _ ⟨f, by continuity⟩} @[to_additive] instance : (forget₂ ProfiniteGrp Profinite).Faithful := { map_injective := fun {_ _} _ _ h => ConcreteCategory.hom_ext _ _ (CategoryTheory.congr_fun h) } instance : (forget₂ ProfiniteGrp Profinite).ReflectsIsomorphisms where reflects {X Y} f _ := by let i := asIso ((forget₂ ProfiniteGrp Profinite).map f) let e : X ≃ₜ* Y := { CompHausLike.homeoOfIso i with map_mul' := map_mul f.hom } exact (ContinuousMulEquiv.toProfiniteGrpIso e).isIso_hom instance : (forget ProfiniteGrp.{u}).ReflectsIsomorphisms := CategoryTheory.reflectsIsomorphisms_comp (forget₂ ProfiniteGrp Profinite) (forget Profinite) end ProfiniteGrp /-! ### Limits in the category of profinite groups In this section, we construct limits in the category of profinite groups. * `ProfiniteGrp.limitCone` : The explicit limit cone in `ProfiniteGrp`. * `ProfiniteGrp.limitConeIsLimit`: `ProfiniteGrp.limitCone` is a limit cone. -/ section Limits namespace ProfiniteGrp variable {J : Type v} [SmallCategory J] (F : J ⥤ ProfiniteGrp.{max v u}) /-- Auxiliary construction to obtain the group structure on the limit of profinite groups. -/ @[to_additive /-- Auxiliary construction to obtain the additive group structure on the limit of profinite additive groups. -/] def limitConePtAux : Subgroup (Π j : J, F.obj j) where carrier := {x | ∀ ⦃i j : J⦄ (π : i ⟶ j), F.map π (x i) = x j} mul_mem' hx hy _ _ π := by simp only [Pi.mul_apply, map_mul, hx π, hy π] one_mem' := by simp only [Set.mem_setOf_eq, Pi.one_apply, map_one, implies_true] inv_mem' h _ _ π := by simp only [Pi.inv_apply, map_inv, h π] @[to_additive] instance : Group (Profinite.limitCone (F ⋙ (forget₂ ProfiniteGrp Profinite))).pt := inferInstanceAs (Group (limitConePtAux F)) @[to_additive] instance : IsTopologicalGroup (Profinite.limitCone (F ⋙ (forget₂ ProfiniteGrp Profinite))).pt := inferInstanceAs (IsTopologicalGroup (limitConePtAux F)) /-- The explicit limit cone in `ProfiniteGrp`. -/ @[to_additive /-- The explicit limit cone in `ProfiniteAddGrp`. -/] abbrev limitCone : Limits.Cone F where pt := ofProfinite (Profinite.limitCone (F ⋙ (forget₂ ProfiniteGrp Profinite))).pt π := { app := fun j => ⟨{ toFun := fun x => x.1 j map_one' := rfl map_mul' := fun x y => rfl continuous_toFun := by exact (continuous_apply j).comp (continuous_iff_le_induced.mpr fun U a => a) }⟩ naturality := fun i j f => by simp only [Functor.const_obj_obj, Functor.comp_obj, Functor.const_obj_map, Category.id_comp, Functor.comp_map] congr exact funext fun x => (x.2 f).symm } /-- `ProfiniteGrp.limitCone` is a limit cone. -/ @[to_additive /-- `ProfiniteAddGrp.limitCone` is a limit cone. -/] def limitConeIsLimit : Limits.IsLimit (limitCone F) where lift cone := ofHom { ((Profinite.limitConeIsLimit (F ⋙ (forget₂ ProfiniteGrp Profinite))).lift ((forget₂ ProfiniteGrp Profinite).mapCone cone)).hom with map_one' := Subtype.ext (funext fun j ↦ map_one (cone.π.app j).hom) -- TODO: investigate whether it's possible to set up `ext` lemmas for the `TopCat`-related -- categories so that `by ext j; exact map_one (cone.π.app j)` works here, similarly below. map_mul' := fun _ _ ↦ Subtype.ext (funext fun j ↦ map_mul (cone.π.app j).hom _ _) } uniq cone m h := by apply (forget₂ ProfiniteGrp Profinite).map_injective simpa using (Profinite.limitConeIsLimit (F ⋙ (forget₂ ProfiniteGrp Profinite))).uniq ((forget₂ ProfiniteGrp Profinite).mapCone cone) ((forget₂ ProfiniteGrp Profinite).map m) (fun j ↦ congrArg (forget₂ ProfiniteGrp Profinite).map (h j)) @[to_additive] instance : Limits.HasLimit F where exists_limit := Nonempty.intro { cone := limitCone F isLimit := limitConeIsLimit F } @[to_additive] instance : Limits.PreservesLimits (forget₂ ProfiniteGrp Profinite) where preservesLimitsOfShape := { preservesLimit := fun {F} ↦ CategoryTheory.Limits.preservesLimit_of_preserves_limit_cone (limitConeIsLimit F) (Profinite.limitConeIsLimit (F ⋙ (forget₂ ProfiniteGrp Profinite))) } @[to_additive] instance : CompactSpace (limitConePtAux F) := inferInstanceAs (CompactSpace (Profinite.limitCone (F ⋙ (forget₂ ProfiniteGrp Profinite))).pt) /-- The abbreviation for the limit of `ProfiniteGrp`s. -/ @[to_additive /-- The abbreviation for the limit of `ProfiniteAddGrp`s. -/] abbrev limit : ProfiniteGrp := ProfiniteGrp.of (ProfiniteGrp.limitConePtAux F) @[to_additive (attr := ext)] lemma limit_ext (x y : limit F) (hxy : ∀ j, x.val j = y.val j) : x = y := Subtype.ext (funext hxy) @[to_additive (attr := simp)] lemma limit_one_val (j : J) : (1 : limit F).val j = 1 := rfl @[to_additive (attr := simp)] lemma limit_mul_val (x y : limit F) (j : J) : (x * y).val j = x.val j * y.val j := rfl end ProfiniteGrp end Limits
.lake/packages/mathlib/Mathlib/Topology/Algebra/Category/ProfiniteGrp/Limits.lean
import Mathlib.CategoryTheory.ConcreteCategory.EpiMono import Mathlib.Topology.Algebra.Category.ProfiniteGrp.Basic import Mathlib.Topology.Algebra.ClopenNhdofOne /-! # A profinite group is the projective limit of finite groups We define the topological group isomorphism between a profinite group and the projective limit of its quotients by open normal subgroups. ## Main definitions * `toFiniteQuotientFunctor` : The functor from `OpenNormalSubgroup P` to `FiniteGrp` sending an open normal subgroup `U` to `P ⧸ U`, where `P : ProfiniteGrp`. * `toLimit` : The continuous homomorphism from a profinite group `P` to the projective limit of its quotients by open normal subgroups ordered by inclusion. * `ContinuousMulEquivLimittoFiniteQuotientFunctor` : The `toLimit` is a `ContinuousMulEquiv` ## Main Statements * `OpenNormalSubgroupSubClopenNhdsOfOne` : For any open neighborhood of `1` there is an open normal subgroup contained in it. -/ universe u open CategoryTheory IsTopologicalGroup namespace ProfiniteGrp instance (P : ProfiniteGrp) : SmallCategory (OpenNormalSubgroup P) := Preorder.smallCategory (OpenNormalSubgroup ↑P.toProfinite.toTop) /-- The functor from `OpenNormalSubgroup P` to `FiniteGrp` sending `U` to `P ⧸ U`, where `P : ProfiniteGrp`. -/ def toFiniteQuotientFunctor (P : ProfiniteGrp) : OpenNormalSubgroup P ⥤ FiniteGrp where obj := fun H => FiniteGrp.of (P ⧸ H.toSubgroup) map := fun fHK => FiniteGrp.ofHom (QuotientGroup.map _ _ (.id _) (leOfHom fHK)) map_id _ := ConcreteCategory.ext <| QuotientGroup.map_id _ map_comp f g := ConcreteCategory.ext <| (QuotientGroup.map_comp_map _ _ _ (.id _) (.id _) (leOfHom f) (leOfHom g)).symm /-- The `MonoidHom` from a profinite group `P` to the projective limit of its quotients by open normal subgroups ordered by inclusion -/ def toLimit_fun (P : ProfiniteGrp.{u}) : P →* limit (toFiniteQuotientFunctor P ⋙ forget₂ FiniteGrp ProfiniteGrp) where toFun p := ⟨fun _ => QuotientGroup.mk p, fun _ ↦ fun _ _ ↦ rfl⟩ map_one' := Subtype.val_inj.mp rfl map_mul' _ _ := Subtype.val_inj.mp rfl lemma toLimit_fun_continuous (P : ProfiniteGrp.{u}) : Continuous (toLimit_fun P) := by apply continuous_induced_rng.mpr (continuous_pi _) intro H dsimp only [Functor.comp_obj, CompHausLike.coe_of, Functor.comp_map, CompHausLike.toCompHausLike_map, CompHausLike.compHausLikeToTop_map, Set.mem_setOf_eq, toLimit_fun, MonoidHom.coe_mk, OneHom.coe_mk, Function.comp_apply] apply Continuous.mk intro s _ rw [← (Set.biUnion_preimage_singleton QuotientGroup.mk s)] refine isOpen_iUnion (fun i ↦ isOpen_iUnion (fun _ ↦ ?_)) convert IsOpen.leftCoset H.toOpenSubgroup.isOpen' (Quotient.out i) ext x simp only [Set.mem_preimage, Set.mem_singleton_iff] nth_rw 1 [← QuotientGroup.out_eq' i, eq_comm, QuotientGroup.eq] exact Iff.symm (Set.mem_smul_set_iff_inv_smul_mem) /-- The morphism in the category of `ProfiniteGrp` from a profinite group `P` to the projective limit of its quotients by open normal subgroups ordered by inclusion -/ def toLimit (P : ProfiniteGrp.{u}) : P ⟶ limit (toFiniteQuotientFunctor P ⋙ forget₂ FiniteGrp ProfiniteGrp) := ofHom { toLimit_fun P with continuous_toFun := toLimit_fun_continuous P } /-- An auxiliary result, superseded by `toLimit_surjective` -/ theorem denseRange_toLimit (P : ProfiniteGrp.{u}) : DenseRange (toLimit P) := by apply dense_iff_inter_open.mpr rintro U ⟨s, hsO, hsv⟩ ⟨⟨spc, hspc⟩, uDefaultSpec⟩ simp_rw [← hsv, Set.mem_preimage] at uDefaultSpec rcases (isOpen_pi_iff.mp hsO) _ uDefaultSpec with ⟨J, fJ, hJ1, hJ2⟩ let M := iInf (fun (j : J) => j.1.1.1) have hM : M.Normal := Subgroup.normal_iInf_normal fun j => j.1.isNormal' have hMOpen : IsOpen (M : Set P) := by rw [Subgroup.coe_iInf] exact isOpen_iInter_of_finite fun i => i.1.1.isOpen' let m : OpenNormalSubgroup P := { M with isOpen' := hMOpen } rcases QuotientGroup.mk'_surjective M (spc m) with ⟨origin, horigin⟩ use (toLimit P) origin refine ⟨?_, origin, rfl⟩ rw [← hsv] apply hJ2 intro a a_in_J let M_to_Na : m ⟶ a := (iInf_le (fun (j : J) => j.1.1.1) ⟨a, a_in_J⟩).hom rw [← (P.toLimit origin).property M_to_Na] change (P.toFiniteQuotientFunctor.map M_to_Na) (QuotientGroup.mk' M origin) ∈ _ rw [horigin] exact Set.mem_of_eq_of_mem (hspc M_to_Na) (hJ1 a a_in_J).2 theorem toLimit_surjective (P : ProfiniteGrp.{u}) : Function.Surjective (toLimit P) := by have : IsClosed (Set.range P.toLimit) := P.toLimit.hom.continuous_toFun.isClosedMap.isClosed_range rw [← Set.range_eq_univ, ← closure_eq_iff_isClosed.mpr this, Dense.closure_eq (denseRange_toLimit P)] theorem toLimit_injective (P : ProfiniteGrp.{u}) : Function.Injective (toLimit P) := by change Function.Injective (toLimit P).hom.toMonoidHom rw [← MonoidHom.ker_eq_bot_iff, Subgroup.eq_bot_iff_forall] intro x h by_contra xne1 rcases exist_openNormalSubgroup_sub_open_nhds_of_one (isOpen_compl_singleton) (Set.mem_compl_singleton_iff.mpr fun a => xne1 a.symm) with ⟨H, hH⟩ exact hH ((QuotientGroup.eq_one_iff x).mp (congrFun (Subtype.val_inj.mpr h) H)) rfl /-- The topological group isomorphism between a profinite group and the projective limit of its quotients by open normal subgroups -/ noncomputable def continuousMulEquivLimittoFiniteQuotientFunctor (P : ProfiniteGrp.{u}) : P ≃ₜ* (limit (toFiniteQuotientFunctor P ⋙ forget₂ FiniteGrp ProfiniteGrp)) := { (Continuous.homeoOfEquivCompactToT2 (f := Equiv.ofBijective _ ⟨toLimit_injective P, toLimit_surjective P⟩) P.toLimit.hom.continuous_toFun) with map_mul' := (toLimit P).hom.map_mul' } instance isIso_toLimit (P : ProfiniteGrp.{u}) : IsIso (toLimit P) := by rw [CategoryTheory.ConcreteCategory.isIso_iff_bijective] exact ⟨toLimit_injective P, toLimit_surjective P⟩ /-- The isomorphism in the category of profinite group between a profinite group and the projective limit of its quotients by open normal subgroups -/ noncomputable def isoLimittoFiniteQuotientFunctor (P : ProfiniteGrp.{u}) : P ≅ (limit (toFiniteQuotientFunctor P ⋙ forget₂ FiniteGrp ProfiniteGrp)) := ContinuousMulEquiv.toProfiniteGrpIso (continuousMulEquivLimittoFiniteQuotientFunctor P) end ProfiniteGrp
.lake/packages/mathlib/Mathlib/Topology/Algebra/Group/CompactOpen.lean
import Mathlib.Topology.Algebra.ContinuousMonoidHom import Mathlib.Topology.Algebra.Equicontinuity import Mathlib.Topology.Algebra.Group.Compact import Mathlib.Topology.ContinuousMap.Algebra import Mathlib.Topology.UniformSpace.Ascoli /-! # The compact-open topology on continuous monoid morphisms. -/ open Function Topology open scoped Pointwise variable (F A B C D E : Type*) [Monoid A] [Monoid B] [Monoid C] [Monoid D] [CommGroup E] [TopologicalSpace A] [TopologicalSpace B] [TopologicalSpace C] [TopologicalSpace D] [TopologicalSpace E] [IsTopologicalGroup E] namespace ContinuousMonoidHom @[to_additive] instance : TopologicalSpace (ContinuousMonoidHom A B) := TopologicalSpace.induced toContinuousMap ContinuousMap.compactOpen @[to_additive] theorem isInducing_toContinuousMap : IsInducing (toContinuousMap : ContinuousMonoidHom A B → C(A, B)) := ⟨rfl⟩ @[to_additive] theorem isEmbedding_toContinuousMap : IsEmbedding (toContinuousMap : ContinuousMonoidHom A B → C(A, B)) := ⟨isInducing_toContinuousMap A B, toContinuousMap_injective⟩ @[to_additive] instance instContinuousEvalConst : ContinuousEvalConst (ContinuousMonoidHom A B) A B := .of_continuous_forget (isInducing_toContinuousMap A B).continuous @[to_additive] instance instContinuousEval [LocallyCompactPair A B] : ContinuousEval (ContinuousMonoidHom A B) A B := .of_continuous_forget (isInducing_toContinuousMap A B).continuous @[to_additive] lemma range_toContinuousMap : Set.range (toContinuousMap : ContinuousMonoidHom A B → C(A, B)) = {f : C(A, B) | f 1 = 1 ∧ ∀ x y, f (x * y) = f x * f y} := by refine Set.Subset.antisymm (Set.range_subset_iff.2 fun f ↦ ⟨map_one f, map_mul f⟩) ?_ rintro f ⟨h1, hmul⟩ exact ⟨{ f with map_one' := h1, map_mul' := hmul }, rfl⟩ @[to_additive] theorem isClosedEmbedding_toContinuousMap [ContinuousMul B] [T2Space B] : IsClosedEmbedding (toContinuousMap : ContinuousMonoidHom A B → C(A, B)) where toIsEmbedding := isEmbedding_toContinuousMap A B isClosed_range := by simp only [range_toContinuousMap, Set.setOf_and, Set.setOf_forall] refine .inter (isClosed_singleton.preimage (continuous_eval_const 1)) <| isClosed_iInter fun x ↦ isClosed_iInter fun y ↦ ?_ exact isClosed_eq (continuous_eval_const (x * y)) <| .mul (continuous_eval_const x) (continuous_eval_const y) variable {A B C D E} @[to_additive] instance [T2Space B] : T2Space (ContinuousMonoidHom A B) := (isEmbedding_toContinuousMap A B).t2Space @[to_additive] instance : IsTopologicalGroup (ContinuousMonoidHom A E) := let hi := isInducing_toContinuousMap A E let hc := hi.continuous { continuous_mul := hi.continuous_iff.mpr (continuous_mul.comp (Continuous.prodMap hc hc)) continuous_inv := hi.continuous_iff.mpr (continuous_inv.comp hc) } @[to_additive] theorem continuous_of_continuous_uncurry {A : Type*} [TopologicalSpace A] (f : A → ContinuousMonoidHom B C) (h : Continuous (Function.uncurry fun x y => f x y)) : Continuous f := (isInducing_toContinuousMap _ _).continuous_iff.mpr (ContinuousMap.continuous_of_continuous_uncurry _ h) @[to_additive] theorem continuous_comp [LocallyCompactSpace B] : Continuous fun f : ContinuousMonoidHom A B × ContinuousMonoidHom B C => f.2.comp f.1 := (isInducing_toContinuousMap A C).continuous_iff.2 <| ContinuousMap.continuous_comp'.comp ((isInducing_toContinuousMap A B).prodMap (isInducing_toContinuousMap B C)).continuous @[to_additive] theorem continuous_comp_left (f : ContinuousMonoidHom A B) : Continuous fun g : ContinuousMonoidHom B C => g.comp f := (isInducing_toContinuousMap A C).continuous_iff.2 <| f.toContinuousMap.continuous_precomp.comp (isInducing_toContinuousMap B C).continuous @[to_additive] theorem continuous_comp_right (f : ContinuousMonoidHom B C) : Continuous fun g : ContinuousMonoidHom A B => f.comp g := (isInducing_toContinuousMap A C).continuous_iff.2 <| f.toContinuousMap.continuous_postcomp.comp (isInducing_toContinuousMap A B).continuous variable (E) in /-- `ContinuousMonoidHom _ f` is a functor. -/ @[to_additive /-- `ContinuousAddMonoidHom _ f` is a functor. -/] def compLeft (f : ContinuousMonoidHom A B) : ContinuousMonoidHom (ContinuousMonoidHom B E) (ContinuousMonoidHom A E) where toFun g := g.comp f map_one' := rfl map_mul' _g _h := rfl continuous_toFun := f.continuous_comp_left variable (A) in /-- `ContinuousMonoidHom f _` is a functor. -/ @[to_additive /-- `ContinuousAddMonoidHom f _` is a functor. -/] def compRight {B : Type*} [CommGroup B] [TopologicalSpace B] [IsTopologicalGroup B] (f : ContinuousMonoidHom B E) : ContinuousMonoidHom (ContinuousMonoidHom A B) (ContinuousMonoidHom A E) where toFun g := f.comp g map_one' := ext fun _a => map_one f map_mul' g h := ext fun a => map_mul f (g a) (h a) continuous_toFun := f.continuous_comp_right section DiscreteTopology variable [DiscreteTopology A] [ContinuousMul B] [T2Space B] @[to_additive] lemma isClosedEmbedding_coe : IsClosedEmbedding ((⇑) : (A →ₜ* B) → A → B) := ContinuousMap.isHomeomorph_coe.isClosedEmbedding.comp <| isClosedEmbedding_toContinuousMap .. @[to_additive] instance [CompactSpace B] : CompactSpace (A →ₜ* B) := ContinuousMonoidHom.isClosedEmbedding_coe.compactSpace end DiscreteTopology section LocallyCompact variable {X Y : Type*} [TopologicalSpace X] [Group X] [IsTopologicalGroup X] [UniformSpace Y] [CommGroup Y] [IsUniformGroup Y] [T0Space Y] [CompactSpace Y] @[to_additive] theorem locallyCompactSpace_of_equicontinuousAt (U : Set X) (V : Set Y) (hU : IsCompact U) (hV : V ∈ nhds (1 : Y)) (h : EquicontinuousAt (fun f : {f : X →* Y | Set.MapsTo f U V} ↦ (f : X → Y)) 1) : LocallyCompactSpace (ContinuousMonoidHom X Y) := by replace h := equicontinuous_of_equicontinuousAt_one _ h obtain ⟨W, hWo, hWV, hWc⟩ := local_compact_nhds hV let S1 : Set (X →* Y) := {f | Set.MapsTo f U W} let S2 : Set (ContinuousMonoidHom X Y) := {f | Set.MapsTo f U W} let S3 : Set C(X, Y) := (↑) '' S2 let S4 : Set (X → Y) := (↑) '' S3 replace h : Equicontinuous ((↑) : S1 → X → Y) := h.comp (Subtype.map _root_.id fun f hf ↦ hf.mono_right hWV) have hS4 : S4 = (↑) '' S1 := by ext constructor · rintro ⟨-, ⟨f, hf, rfl⟩, rfl⟩ exact ⟨f, hf, rfl⟩ · rintro ⟨f, hf, rfl⟩ exact ⟨⟨f, h.continuous ⟨f, hf⟩⟩, ⟨⟨f, h.continuous ⟨f, hf⟩⟩, hf, rfl⟩, rfl⟩ replace h : Equicontinuous ((↑) : S3 → X → Y) := by rw [equicontinuous_iff_range, ← Set.image_eq_range] at h ⊢ rwa [← hS4] at h replace hS4 : S4 = Set.pi U (fun _ ↦ W) ∩ Set.range ((↑) : (X →* Y) → (X → Y)) := by simp_rw [hS4, Set.ext_iff, Set.mem_image, S1, Set.mem_setOf_eq] exact fun f ↦ ⟨fun ⟨g, hg, hf⟩ ↦ hf ▸ ⟨hg, g, rfl⟩, fun ⟨hg, g, hf⟩ ↦ ⟨g, hf ▸ hg, hf⟩⟩ replace hS4 : IsClosed S4 := hS4.symm ▸ (isClosed_set_pi (fun _ _ ↦ hWc.isClosed)).inter (MonoidHom.isClosed_range_coe X Y) have hS2 : (interior S2).Nonempty := by let T : Set (ContinuousMonoidHom X Y) := {f | Set.MapsTo f U (interior W)} have h1 : T.Nonempty := ⟨1, fun _ _ ↦ mem_interior_iff_mem_nhds.mpr hWo⟩ have h2 : T ⊆ S2 := fun f hf ↦ hf.mono_right interior_subset have h3 : IsOpen T := isOpen_induced (ContinuousMap.isOpen_setOf_mapsTo hU isOpen_interior) exact h1.mono (interior_maximal h2 h3) exact TopologicalSpace.PositiveCompacts.locallyCompactSpace_of_group ⟨⟨S2, (isInducing_toContinuousMap X Y).isCompact_iff.mpr (ArzelaAscoli.isCompact_of_equicontinuous S3 hS4.isCompact h)⟩, hS2⟩ variable [LocallyCompactSpace X] @[to_additive] theorem locallyCompactSpace_of_hasBasis (V : ℕ → Set Y) (hV : ∀ {n x}, x ∈ V n → x * x ∈ V n → x ∈ V (n + 1)) (hVo : Filter.HasBasis (nhds 1) (fun _ ↦ True) V) : LocallyCompactSpace (ContinuousMonoidHom X Y) := by obtain ⟨U0, hU0c, hU0o⟩ := exists_compact_mem_nhds (1 : X) let U_aux : ℕ → {S : Set X | S ∈ nhds 1} := Nat.rec ⟨U0, hU0o⟩ <| fun _ S ↦ let h := exists_closed_nhds_one_inv_eq_mul_subset S.2 ⟨Classical.choose h, (Classical.choose_spec h).1⟩ let U : ℕ → Set X := fun n ↦ (U_aux n).1 have hU1 : ∀ n, U n ∈ nhds 1 := fun n ↦ (U_aux n).2 have hU2 : ∀ n, U (n + 1) * U (n + 1) ⊆ U n := fun n ↦ (Classical.choose_spec (exists_closed_nhds_one_inv_eq_mul_subset (U_aux n).2)).2.2.2 have hU3 : ∀ n, U (n + 1) ⊆ U n := fun n x hx ↦ hU2 n (mul_one x ▸ Set.mul_mem_mul hx (mem_of_mem_nhds (hU1 (n + 1)))) have hU4 : ∀ f : X →* Y, Set.MapsTo f (U 0) (V 0) → ∀ n, Set.MapsTo f (U n) (V n) := by intro f hf n induction n with | zero => exact hf | succ n ih => exact fun x hx ↦ hV (ih (hU3 n hx)) (map_mul f x x ▸ ih (hU2 n (Set.mul_mem_mul hx hx))) apply locallyCompactSpace_of_equicontinuousAt (U 0) (V 0) hU0c (hVo.mem_of_mem trivial) rw [hVo.uniformity_of_nhds_one.equicontinuousAt_iff_right] refine fun n _ ↦ Filter.eventually_iff_exists_mem.mpr ⟨U n, hU1 n, fun x hx ⟨f, hf⟩ ↦ ?_⟩ rw [Set.mem_setOf_eq, map_one, div_one] exact hU4 f hf n hx end LocallyCompact end ContinuousMonoidHom
.lake/packages/mathlib/Mathlib/Topology/Algebra/Group/OpenMapping.lean
import Mathlib.Topology.Baire.Lemmas import Mathlib.Topology.Algebra.Group.Pointwise /-! # 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] [IsTopologicalGroup 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 := countable_cover_nhds_of_sigmaCompact fun _ ↦ by simpa 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 [A, MulAction.compHom_smul_def] rw [this] exact isOpenMap_smul_of_sigmaCompact _
.lake/packages/mathlib/Mathlib/Topology/Algebra/Group/Compact.lean
import Mathlib.Topology.Algebra.Group.Pointwise import Mathlib.Topology.Sets.Compacts /-! # Additional results on topological groups A result on topological groups that has been separated out as it requires more substantial imports developing positive compacts. -/ universe u variable {G : Type u} [TopologicalSpace G] [Group G] [IsTopologicalGroup 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)
.lake/packages/mathlib/Mathlib/Topology/Algebra/Group/AddTorsor.lean
import Mathlib.Algebra.AddTorsor.Basic import Mathlib.Topology.Algebra.Monoid import Mathlib.Topology.Algebra.Group.Defs /-! # Topological torsors of additive groups This file defines topological torsors of additive groups, that is, torsors where `+ᵥ` and `-ᵥ` are continuous. -/ open Topology section AddTorsor variable {V P α : Type*} [AddGroup V] [TopologicalSpace V] [AddTorsor V P] [TopologicalSpace P] variable (P) in /-- A topological torsor over a topological additive group is a torsor where `+ᵥ` and `-ᵥ` are continuous. -/ class IsTopologicalAddTorsor extends ContinuousVAdd V P where continuous_vsub : Continuous (fun x : P × P => x.1 -ᵥ x.2) export IsTopologicalAddTorsor (continuous_vsub) attribute [fun_prop] continuous_vsub variable [IsTopologicalAddTorsor P] theorem Filter.Tendsto.vsub {l : Filter α} {f g : α → P} {x y : P} (hf : Tendsto f l (𝓝 x)) (hg : Tendsto g l (𝓝 y)) : Tendsto (f -ᵥ g) l (𝓝 (x -ᵥ y)) := (continuous_vsub.tendsto (x, y)).comp (hf.prodMk_nhds hg) variable [TopologicalSpace α] @[fun_prop] theorem Continuous.vsub {f g : α → P} (hf : Continuous f) (hg : Continuous g) : Continuous (fun x ↦ f x -ᵥ g x) := continuous_vsub.comp₂ hf hg @[fun_prop] nonrec theorem ContinuousAt.vsub {f g : α → P} {x : α} (hf : ContinuousAt f x) (hg : ContinuousAt g x) : ContinuousAt (fun x ↦ f x -ᵥ g x) x := hf.vsub hg @[fun_prop] nonrec theorem ContinuousWithinAt.vsub {f g : α → P} {x : α} {s : Set α} (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) : ContinuousWithinAt (fun x ↦ f x -ᵥ g x) s x := hf.vsub hg @[fun_prop] theorem ContinuousOn.vsub {f g : α → P} {s : Set α} (hf : ContinuousOn f s) (hg : ContinuousOn g s) : ContinuousOn (fun x ↦ f x -ᵥ g x) s := fun x hx ↦ (hf x hx).vsub (hg x hx) include P in variable (V P) in /-- The underlying group of a topological torsor is a topological group. This is not an instance, as `P` cannot be inferred. -/ theorem IsTopologicalAddTorsor.to_isTopologicalAddGroup : IsTopologicalAddGroup V where continuous_add := by have ⟨p⟩ : Nonempty P := inferInstance conv => enter [1, x] equals (x.1 +ᵥ x.2 +ᵥ p) -ᵥ p => rw [vadd_vadd, vadd_vsub] fun_prop continuous_neg := by have ⟨p⟩ : Nonempty P := inferInstance conv => enter [1, v] equals p -ᵥ (v +ᵥ p) => rw [vsub_vadd_eq_vsub_sub, vsub_self, zero_sub] fun_prop /-- The map `v ↦ v +ᵥ p` as a homeomorphism between `V` and `P`. -/ @[simps!] def Homeomorph.vaddConst (p : P) : V ≃ₜ P where __ := Equiv.vaddConst p continuous_toFun := by fun_prop continuous_invFun := by fun_prop end AddTorsor section AddGroup variable {G : Type*} [AddGroup G] [TopologicalSpace G] [IsTopologicalAddGroup G] instance : IsTopologicalAddTorsor G where continuous_vsub := by simp only [vsub_eq_sub]; fun_prop end AddGroup section Prod variable {V W P Q : Type*} [AddCommGroup V] [TopologicalSpace V] [AddTorsor V P] [TopologicalSpace P] [IsTopologicalAddTorsor P] [AddCommGroup W] [TopologicalSpace W] [AddTorsor W Q] [TopologicalSpace Q] [IsTopologicalAddTorsor Q] instance : IsTopologicalAddTorsor (P × Q) where continuous_vadd := Continuous.prodMk (by fun_prop) (by fun_prop) continuous_vsub := Continuous.prodMk (by fun_prop) (by fun_prop) end Prod section Pi variable {ι : Type*} {V P : ι → Type*} [∀ i, AddCommGroup (V i)] [∀ i, TopologicalSpace (V i)] [∀ i, AddTorsor (V i) (P i)] [∀ i, TopologicalSpace (P i)] [∀ i, IsTopologicalAddTorsor (P i)] instance : IsTopologicalAddTorsor ((i : ι) → P i) where continuous_vadd := continuous_pi <| by simp only [Pi.vadd_apply']; fun_prop continuous_vsub := continuous_pi <| by simp only [Pi.vsub_apply]; fun_prop end Pi
.lake/packages/mathlib/Mathlib/Topology/Algebra/Group/SubmonoidClosure.lean
import Mathlib.Order.Filter.AtTopBot.Group import Mathlib.Topology.Algebra.Group.Basic /-! # Topological closure of the submonoid closure In this file we prove several versions of the following statement: if `G` is a compact topological group and `s : Set G`, then the topological closures of `Submonoid.closure s` and `Subgroup.closure s` are equal. The proof is based on the following observation, see `mapClusterPt_self_zpow_atTop_pow`: each `x^m`, `m : ℤ` is a limit point (`MapClusterPt`) of the sequence `x^n`, `n : ℕ`, as `n → ∞`. -/ open Filter Function Set open scoped Topology variable {G : Type*} @[to_additive] theorem mapClusterPt_atTop_zpow_iff_pow [DivInvMonoid G] [TopologicalSpace G] {x y : G} : MapClusterPt x atTop (y ^ · : ℤ → G) ↔ MapClusterPt x atTop (y ^ · : ℕ → G) := by simp_rw [MapClusterPt, ← Nat.map_cast_int_atTop, map_map, comp_def, zpow_natCast] variable [Group G] [TopologicalSpace G] [CompactSpace G] [IsTopologicalGroup G] @[to_additive] theorem mapClusterPt_self_zpow_atTop_pow (x : G) (m : ℤ) : MapClusterPt (x ^ m) atTop (x ^ · : ℕ → G) := by obtain ⟨y, hy⟩ : ∃ y, MapClusterPt y atTop (x ^ · : ℤ → G) := exists_clusterPt_of_compactSpace _ rw [← mapClusterPt_atTop_zpow_iff_pow] have H : MapClusterPt (x ^ m) (atTop.curry atTop) ↿(fun a b ↦ x ^ (m + b - a)) := by have : ContinuousAt (fun yz ↦ x ^ m * yz.2 / yz.1) (y, y) := by fun_prop simpa only [comp_def, ← zpow_sub, ← zpow_add, div_eq_mul_inv, Prod.map, mul_inv_cancel_right] using (hy.curry_prodMap hy).continuousAt_comp this suffices Tendsto ↿(fun a b ↦ m + b - a) (atTop.curry atTop) atTop from H.of_comp this refine Tendsto.curry <| .of_forall fun a ↦ ?_ simp only [sub_eq_add_neg] -- TODO: add `Tendsto.atTop_sub_const` etc exact tendsto_atTop_add_const_right _ _ (tendsto_atTop_add_const_left atTop m tendsto_id) @[to_additive] theorem mapClusterPt_one_atTop_pow (x : G) : MapClusterPt 1 atTop (x ^ · : ℕ → G) := by simpa using mapClusterPt_self_zpow_atTop_pow x 0 @[to_additive] theorem mapClusterPt_self_atTop_pow (x : G) : MapClusterPt x atTop (x ^ · : ℕ → G) := by simpa using mapClusterPt_self_zpow_atTop_pow x 1 @[to_additive] theorem mapClusterPt_atTop_pow_tfae (x y : G) : List.TFAE [ MapClusterPt x atTop (y ^ · : ℕ → G), MapClusterPt x atTop (y ^ · : ℤ → G), x ∈ closure (range (y ^ · : ℕ → G)), x ∈ closure (range (y ^ · : ℤ → G)), ] := by tfae_have 2 ↔ 1 := mapClusterPt_atTop_zpow_iff_pow tfae_have 3 → 4 := by refine fun h ↦ closure_mono (range_subset_iff.2 fun n ↦ ?_) h exact ⟨n, zpow_natCast _ _⟩ tfae_have 4 → 1 := by refine fun h ↦ closure_minimal ?_ isClosed_setOf_clusterPt h exact range_subset_iff.2 (mapClusterPt_self_zpow_atTop_pow _) tfae_have 1 → 3 := by rw [mem_closure_iff_clusterPt] exact (ClusterPt.mono · (le_principal_iff.2 range_mem_map)) tfae_finish @[to_additive] theorem mapClusterPt_atTop_pow_iff_mem_topologicalClosure_zpowers {x y : G} : MapClusterPt x atTop (y ^ · : ℕ → G) ↔ x ∈ (Subgroup.zpowers y).topologicalClosure := (mapClusterPt_atTop_pow_tfae x y).out 0 3 @[to_additive (attr := simp)] theorem mapClusterPt_inv_atTop_pow {x y : G} : MapClusterPt x⁻¹ atTop (y ^ · : ℕ → G) ↔ MapClusterPt x atTop (y ^ · : ℕ → G) := by simp only [mapClusterPt_atTop_pow_iff_mem_topologicalClosure_zpowers, inv_mem_iff] @[to_additive] theorem closure_range_zpow_eq_pow (x : G) : closure (range (x ^ · : ℤ → G)) = closure (range (x ^ · : ℕ → G)) := by ext y exact (mapClusterPt_atTop_pow_tfae y x).out 3 2 @[to_additive] theorem denseRange_zpow_iff_pow {x : G} : DenseRange (x ^ · : ℤ → G) ↔ DenseRange (x ^ · : ℕ → G) := by simp only [DenseRange, dense_iff_closure_eq, closure_range_zpow_eq_pow] @[to_additive] theorem topologicalClosure_subgroupClosure_toSubmonoid (s : Set G) : (Subgroup.closure s).toSubmonoid.topologicalClosure = (Submonoid.closure s).topologicalClosure := by refine le_antisymm ?_ (closure_mono <| Subgroup.le_closure_toSubmonoid _) refine Submonoid.topologicalClosure_minimal _ ?_ isClosed_closure rw [Subgroup.closure_toSubmonoid, Submonoid.closure_le] refine union_subset (Submonoid.subset_closure.trans subset_closure) fun x hx ↦ ?_ refine closure_mono (Submonoid.powers_le.2 (Submonoid.subset_closure <| Set.mem_inv.1 hx)) ?_ rw [Submonoid.coe_powers, ← closure_range_zpow_eq_pow, ← Subgroup.coe_zpowers, ← Subgroup.topologicalClosure_coe, SetLike.mem_coe, ← inv_mem_iff] exact subset_closure <| Subgroup.mem_zpowers _ @[to_additive] theorem closure_submonoidClosure_eq_closure_subgroupClosure (s : Set G) : closure (Submonoid.closure s : Set G) = closure (Subgroup.closure s) := congrArg SetLike.coe (topologicalClosure_subgroupClosure_toSubmonoid s).symm @[to_additive] theorem dense_submonoidClosure_iff_subgroupClosure {s : Set G} : Dense (Submonoid.closure s : Set G) ↔ Dense (Subgroup.closure s : Set G) := by simp only [dense_iff_closure_eq, closure_submonoidClosure_eq_closure_subgroupClosure]
.lake/packages/mathlib/Mathlib/Topology/Algebra/Group/Pointwise.lean
import Mathlib.Topology.Algebra.Group.Basic import Mathlib.Topology.Maps.Proper.Basic /-! # Pointwise operations on sets in topological groups -/ open Set Filter TopologicalSpace Function Topology Pointwise MulOpposite universe u v w x variable {G : Type w} {H : Type x} {α : Type u} {β : Type v} /-! ### 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 β} 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 β} open Prod in /-- If `G` acts on `X` continuously, the set `s • t` is closed when `s : Set G` is *compact* and `t : Set X` is *closed*. See also `IsClosed.smul_right_of_isCompact` for a version with the assumptions on `s` and `t` reversed, assuming that the action is *proper*. -/ @[to_additive /-- If `G` acts on `X` continuously, the set `s +ᵥ t` is closed when `s : Set G` is *compact* and `t : Set X` is *closed*. See also `IsClosed.vadd_right_of_isCompact` for a version with the assumptions on `s` and `t` reversed, assuming that the action is *proper*. -/] theorem IsClosed.smul_left_of_isCompact (ht : IsClosed t) (hs : IsCompact s) : IsClosed (s • t) := by let Φ : s × β ≃ₜ s × β := { toFun := fun gx ↦ (gx.1, (gx.1 : α) • gx.2) invFun := fun gx ↦ (gx.1, (gx.1 : α)⁻¹ • gx.2) left_inv := fun _ ↦ by simp right_inv := fun _ ↦ by simp } have : s • t = (snd ∘ Φ) '' (snd ⁻¹' t) := subset_antisymm (smul_subset_iff.mpr fun g hg x hx ↦ mem_image_of_mem (snd ∘ Φ) (x := ⟨⟨g, hg⟩, x⟩) hx) (image_subset_iff.mpr fun ⟨⟨g, hg⟩, x⟩ hx ↦ smul_mem_smul hg hx) rw [this] have : CompactSpace s := isCompact_iff_compactSpace.mp hs exact (isProperMap_snd_of_compactSpace.comp Φ.isProperMap).isClosedMap _ (ht.preimage continuous_snd) @[to_additive] theorem MulAction.isClosedMap_quotient [CompactSpace α] : letI := orbitRel α β IsClosedMap (Quotient.mk' : β → Quotient (orbitRel α β)) := by intro t ht rw [← isQuotientMap_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] simp only [image_smul] 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 rwa [← smul_eq_mul, ← smul_eq_mul, singleton_smul, smul_mem_nhds_smul_iff] @[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 [← image_op_smul] exact hs.smul_left @[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 rw [mul_singleton] exact smul_mem_nhds_smul (op a) 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 IsTopologicalGroup variable [TopologicalSpace G] [Group G] [IsTopologicalGroup 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] 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 @[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 [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 IsTopologicalGroup section FilterMul section variable (G) [TopologicalSpace G] [Group G] [IsTopologicalGroup G] @[to_additive] instance (priority := 100) IsTopologicalGroup.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 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⁻¹).isEmbedding.inseparable_iff] simp [div_eq_mul_inv] @[to_additive] theorem IsTopologicalGroup.t2Space_iff_one_closed : T2Space G ↔ IsClosed ({1} : Set G) := ⟨fun _ ↦ isClosed_singleton, fun h ↦ have := IsTopologicalGroup.t1Space G h; inferInstance⟩ @[to_additive] theorem IsTopologicalGroup.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_cancel]) /-- 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 end section variable [TopologicalSpace G] [Group G] [IsTopologicalGroup G] /-- 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) /-- 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 end end FilterMul
.lake/packages/mathlib/Mathlib/Topology/Algebra/Group/Basic.lean
import Mathlib.Algebra.Group.Subgroup.Pointwise import Mathlib.Algebra.Group.Submonoid.Units import Mathlib.Algebra.Group.Submonoid.MulOpposite import Mathlib.Algebra.Order.Archimedean.Basic import Mathlib.Order.Filter.Bases.Finite import Mathlib.Topology.Algebra.Group.Defs import Mathlib.Topology.Algebra.Monoid import Mathlib.Topology.Homeomorph.Lemmas /-! # Topological groups This file defines the following typeclasses: * `IsTopologicalGroup`, `IsTopologicalAddGroup`: 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 `IsTopologicalGroup` 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 MulOpposite Pointwise universe u v w x variable {G : Type w} {H : Type x} {α : Type u} {β : Type v} /-- In a Hausdorff magma with continuous multiplication, the centralizer of any set is closed. -/ lemma Set.isClosed_centralizer {M : Type*} (s : Set M) [Mul M] [TopologicalSpace M] [ContinuousMul M] [T2Space M] : IsClosed (centralizer s) := by rw [centralizer, setOf_forall] refine isClosed_sInter ?_ rintro - ⟨m, ht, rfl⟩ refine isClosed_imp (by simp) <| isClosed_eq ?_ ?_ all_goals fun_prop 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_iff_isOpen_singleton_one : DiscreteTopology G ↔ IsOpen ({1} : Set G) := MulAction.IsPretransitive.discreteTopology_iff G 1 @[to_additive] theorem discreteTopology_of_isOpen_singleton_one (h : IsOpen ({1} : Set G)) : DiscreteTopology G := discreteTopology_iff_isOpen_singleton_one.mpr h end ContinuousMulGroup /-! ### `ContinuousInv` and `ContinuousNeg` -/ section ContinuousInv variable [TopologicalSpace G] [Inv G] [ContinuousInv G] @[to_additive] theorem ContinuousInv.induced {α : Type*} {β : Type*} {F : Type*} [FunLike F α β] [Group α] [DivisionMonoid β] [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_def, 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_uliftUp.comp (continuous_inv.comp continuous_uliftDown)⟩ @[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 variable [TopologicalSpace α] {f : α → G} {s : Set α} {x : α} @[to_additive] instance OrderDual.instContinuousInv : ContinuousInv Gᵒᵈ := ‹ContinuousInv G› @[to_additive] instance Prod.continuousInv [TopologicalSpace H] [Inv H] [ContinuousInv H] : ContinuousInv (G × H) := ⟨continuous_inv.fst'.prodMk 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⟩ @[to_additive] instance (priority := 100) topologicalGroup_of_discreteTopology [TopologicalSpace H] [Group H] [DiscreteTopology H] : IsTopologicalGroup H := ⟨⟩ 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_eq_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 nhds_inv (a : G) : 𝓝 a⁻¹ = (𝓝 a)⁻¹ := ((Homeomorph.inv G).map_nhds_eq a).symm @[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 Topology.IsInducing.continuousInv {G H : Type*} [Inv G] [Inv H] [TopologicalSpace G] [TopologicalSpace H] [ContinuousInv H] {f : G → H} (hf : IsInducing f) (hf_inv : ∀ x, f x⁻¹ = (f x)⁻¹) : ContinuousInv G := ⟨hf.continuous_iff.2 <| by simpa only [Function.comp_def, hf_inv] using hf.continuous.inv⟩ section IsTopologicalGroup /-! ### 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. -/ 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 continuous_addConj_prod /-- Conjugation is jointly continuous on `G × G` when both `add` and `neg` are continuous. -/] theorem IsTopologicalGroup.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 IsTopologicalGroup.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 IsTopologicalGroup.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] [IsTopologicalGroup G] [TopologicalSpace α] {f : α → G} {s : Set α} {x : α} instance : IsTopologicalGroup (ULift G) where section ZPow @[to_additive (attr := continuity, fun_prop)] 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] [IsTopologicalAddGroup A] : ContinuousConstSMul ℤ A := ⟨continuous_zsmul⟩ instance AddGroup.continuousSMul_int {A} [AddGroup A] [TopologicalSpace A] [IsTopologicalAddGroup 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] [CommGroup H] [PartialOrder H] [IsOrderedMonoid H] [ContinuousInv H] @[to_additive] theorem tendsto_inv_nhdsGT {a : H} : Tendsto Inv.inv (𝓝[>] a) (𝓝[<] a⁻¹) := (continuous_inv.tendsto a).inf <| by simp @[to_additive] theorem tendsto_inv_nhdsLT {a : H} : Tendsto Inv.inv (𝓝[<] a) (𝓝[>] a⁻¹) := (continuous_inv.tendsto a).inf <| by simp @[to_additive] theorem tendsto_inv_nhdsGT_inv {a : H} : Tendsto Inv.inv (𝓝[>] a⁻¹) (𝓝[<] a) := by simpa only [inv_inv] using tendsto_inv_nhdsGT (a := a⁻¹) @[to_additive] theorem tendsto_inv_nhdsLT_inv {a : H} : Tendsto Inv.inv (𝓝[<] a⁻¹) (𝓝[>] a) := by simpa only [inv_inv] using tendsto_inv_nhdsLT (a := a⁻¹) @[to_additive] theorem tendsto_inv_nhdsGE {a : H} : Tendsto Inv.inv (𝓝[≥] a) (𝓝[≤] a⁻¹) := (continuous_inv.tendsto a).inf <| by simp @[to_additive] theorem tendsto_inv_nhdsLE {a : H} : Tendsto Inv.inv (𝓝[≤] a) (𝓝[≥] a⁻¹) := (continuous_inv.tendsto a).inf <| by simp @[to_additive] theorem tendsto_inv_nhdsGE_inv {a : H} : Tendsto Inv.inv (𝓝[≥] a⁻¹) (𝓝[≤] a) := by simpa only [inv_inv] using tendsto_inv_nhdsGE (a := a⁻¹) @[to_additive] theorem tendsto_inv_nhdsLE_inv {a : H} : Tendsto Inv.inv (𝓝[≤] a⁻¹) (𝓝[≥] a) := by simpa only [inv_inv] using tendsto_inv_nhdsLE (a := a⁻¹) alias tendsto_inv_nhdsWithin_Iic_inv := tendsto_inv_nhdsLE_inv end OrderedCommGroup @[to_additive] instance Prod.instIsTopologicalGroup [TopologicalSpace H] [Group H] [IsTopologicalGroup H] : IsTopologicalGroup (G × H) where continuous_inv := continuous_inv.prodMap continuous_inv @[to_additive] instance OrderDual.instIsTopologicalGroup : IsTopologicalGroup Gᵒᵈ where @[to_additive] instance Pi.topologicalGroup {C : β → Type*} [∀ b, TopologicalSpace (C b)] [∀ b, Group (C b)] [∀ b, IsTopologicalGroup (C b)] : IsTopologicalGroup (∀ b, C b) where continuous_inv := continuous_pi fun i => (continuous_apply i).inv open MulOpposite @[to_additive] instance [Inv α] [ContinuousInv α] : ContinuousInv αᵐᵒᵖ := opHomeomorph.symm.isInducing.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 α] [IsTopologicalGroup α] : IsTopologicalGroup αᵐᵒᵖ 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 := by dsimp; fun_prop continuous_invFun := by dsimp; fun_prop } @[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 Topology.IsInducing.topologicalGroup {F : Type*} [Group H] [TopologicalSpace H] [FunLike F H G] [MonoidHomClass F H G] (f : F) (hf : IsInducing f) : IsTopologicalGroup H := { toContinuousMul := hf.continuousMul _ toContinuousInv := hf.continuousInv (map_inv f) } @[to_additive] theorem topologicalGroup_induced {F : Type*} [Group H] [FunLike F H G] [MonoidHomClass F H G] (f : F) : @IsTopologicalGroup H (induced f ‹_›) _ := letI := induced f ‹_› IsInducing.topologicalGroup f ⟨rfl⟩ namespace Subgroup @[to_additive] instance (S : Subgroup G) : IsTopologicalGroup S := IsInducing.subtypeVal.topologicalGroup S.subtype 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] [IsTopologicalGroup 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] [IsTopologicalGroup G] (N : Subgroup G) [N.Normal] : (Subgroup.topologicalClosure N).Normal where conj_mem n hn g := by apply map_mem_closure (IsTopologicalGroup.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] [DivisionMonoid G] [ContinuousInv 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] [IsTopologicalGroup 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. See note [reducible non-instances]. -/ @[to_additive /-- If a subgroup of an additive topological group is commutative, then so is its topological closure. See note [reducible non-instances]. -/] abbrev 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, Function.comp_def, 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] [IsTopologicalGroup 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, Function.comp_def, 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] lemma IsTopologicalGroup.isInducing_iff_nhds_one {H : Type*} [Group H] [TopologicalSpace H] [IsTopologicalGroup H] {F : Type*} [FunLike F G H] [MonoidHomClass F G H] {f : F} : Topology.IsInducing f ↔ 𝓝 (1 : G) = (𝓝 (1 : H)).comap f := by rw [Topology.isInducing_iff_nhds] refine ⟨(map_one f ▸ · 1), fun hf x ↦ ?_⟩ rw [← nhds_translation_mul_inv, ← nhds_translation_mul_inv (f x), Filter.comap_comap, hf, Filter.comap_comap] congr 1 ext; simp @[to_additive] lemma IsTopologicalGroup.isOpenMap_iff_nhds_one {H : Type*} [Monoid H] [TopologicalSpace H] [ContinuousConstSMul H H] {F : Type*} [FunLike F G H] [MonoidHomClass F G H] {f : F} : IsOpenMap f ↔ 𝓝 1 ≤ .map f (𝓝 1) := by refine ⟨fun H ↦ map_one f ▸ H.nhds_le 1, fun h ↦ IsOpenMap.of_nhds_le fun x ↦ ?_⟩ have : Filter.map (f x * ·) (𝓝 1) = 𝓝 (f x) := by simpa [-Homeomorph.map_nhds_eq, Units.smul_def] using (Homeomorph.smul ((toUnits x).map (MonoidHomClass.toMonoidHom f))).map_nhds_eq (1 : H) rw [← map_mul_left_nhds_one x, Filter.map_map, Function.comp_def, ← this] refine (Filter.map_mono h).trans ?_ simp [Function.comp_def] @[deprecated (since := "2025-09-16")] alias TopologicalGroup.isOpenMap_iff_nhds_one := IsTopologicalGroup.isOpenMap_iff_nhds_one @[deprecated (since := "2025-09-16")] alias TopologicalGroup.isOpenMap_iff_nhds_zero := IsTopologicalAddGroup.isOpenMap_iff_nhds_zero -- TODO: unify with `QuotientGroup.isOpenQuotientMap_mk` /-- Let `A` and `B` be topological groups, and let `φ : A → B` be a continuous surjective group homomorphism. Assume furthermore that `φ` is a quotient map (i.e., `V ⊆ B` is open iff `φ⁻¹ V` is open). Then `φ` is an open quotient map, and in particular an open map. -/ @[to_additive /-- Let `A` and `B` be topological additive groups, and let `φ : A → B` be a continuous surjective additive group homomorphism. Assume furthermore that `φ` is a quotient map (i.e., `V ⊆ B` is open iff `φ⁻¹ V` is open). Then `φ` is an open quotient map, and in particular an open map. -/] lemma MonoidHom.isOpenQuotientMap_of_isQuotientMap {A : Type*} [Group A] [TopologicalSpace A] [ContinuousMul A] {B : Type*} [Group B] [TopologicalSpace B] {F : Type*} [FunLike F A B] [MonoidHomClass F A B] {φ : F} (hφ : IsQuotientMap φ) : IsOpenQuotientMap φ where surjective := hφ.surjective continuous := hφ.continuous isOpenMap := by -- We need to check that if `U ⊆ A` is open then `φ⁻¹ (φ U)` is open. intro U hU rw [← hφ.isOpen_preimage] -- It suffices to show that `φ⁻¹ (φ U) = ⋃ (U * k⁻¹)` as `k` runs through the kernel of `φ`, -- as `U * k⁻¹` is open because `x ↦ x * k` is continuous. -- Remark: here is where we use that we have groups not monoids (you cannot avoid -- using both `k` and `k⁻¹` at this point). suffices ⇑φ ⁻¹' (⇑φ '' U) = ⋃ k ∈ ker (φ : A →* B), (fun x ↦ x * k) ⁻¹' U by exact this ▸ isOpen_biUnion (fun k _ ↦ Continuous.isOpen_preimage (by fun_prop) _ hU) ext x -- But this is an elementary calculation. constructor · rintro ⟨y, hyU, hyx⟩ apply Set.mem_iUnion_of_mem (x⁻¹ * y) simp_all · rintro ⟨_, ⟨k, rfl⟩, _, ⟨(hk : φ k = 1), rfl⟩, hx⟩ use x * k, hx rw [map_mul, hk, mul_one] @[to_additive] theorem IsTopologicalGroup.ext {G : Type*} [Group G] {t t' : TopologicalSpace G} (tg : @IsTopologicalGroup G t _) (tg' : @IsTopologicalGroup 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 IsTopologicalGroup.ext_iff {G : Type*} [Group G] {t t' : TopologicalSpace G} (tg : @IsTopologicalGroup G t _) (tg' : @IsTopologicalGroup 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, Function.comp_def, mul_assoc, mul_inv_rev, inv_mul_cancel_left] using this @[to_additive] theorem IsTopologicalGroup.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)) : IsTopologicalGroup 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 IsTopologicalGroup.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)) : IsTopologicalGroup G := by refine IsTopologicalGroup.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 [Function.comp_def] using hleft _ @[to_additive] theorem IsTopologicalGroup.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)) : IsTopologicalGroup G := IsTopologicalGroup.of_nhds_one hmul hinv hleft (by simpa using tendsto_id) variable (G) in /-- 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 IsTopologicalGroup.exists_antitone_basis_nhds_one [FirstCountableTopology G] : ∃ 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, 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⟩ end IsTopologicalGroup section ContinuousDiv variable [TopologicalSpace G] [Div G] [ContinuousDiv G] @[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) 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 end ContinuousDiv section DivInvTopologicalGroup variable [Group G] [TopologicalSpace G] [IsTopologicalGroup G] /-- A version of `Homeomorph.mulLeft a b⁻¹` that is defeq to `a / b`. -/ @[to_additive (attr := simps! +simpRhs) /-- 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! +simpRhs) /-- 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 section FilterMul section variable (G) [TopologicalSpace G] [Group G] [ContinuousMul G] @[to_additive] theorem IsTopologicalGroup.t1Space (h : @IsClosed G _ {1}) : T1Space G := ⟨fun x => by simpa using isClosedMap_mul_right x _ h⟩ end section variable [TopologicalSpace G] [Group G] [IsTopologicalGroup G] variable (S : Subgroup G) [Subgroup.Normal S] [IsClosed (S : Set G)] /-- 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, coe_subtype, mem_preimage, mem_image, Prod.exists] exact Set.smul_inter_ne_empty_iff' } /-- 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.prodMap continuous_id have H : Set.Finite _ := hS ((hK.prod hL).image (continuous_mul.comp this)).compl_mem_cocompact simp only [preimage_compl, compl_compl, coe_subtype, comp_apply] at H apply Finite.of_preimage _ (equivOp S).surjective convert H using 1 ext x simp only [image_smul, mem_setOf_eq, 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_mono 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] [IsTopologicalGroup 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) ?_ obtain ⟨g₀, hg₀⟩ := hV 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 [mul_inv_cancel_right] end section variable [TopologicalSpace G] [Group G] [IsTopologicalGroup 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] [IsTopologicalGroup G] : IsTopologicalAddGroup (Additive G) where continuous_neg := @continuous_inv G _ _ _ instance {G} [TopologicalSpace G] [AddGroup G] [IsTopologicalAddGroup G] : IsTopologicalGroup (Multiplicative G) where continuous_inv := @continuous_neg G _ _ _ /-- 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.isEmbedding_val [Group G] [TopologicalSpace G] [ContinuousInv G] : IsEmbedding (val : Gˣ → G) := toUnits_homeomorph.symm.isEmbedding lemma Continuous.of_coeHom_comp [Group G] [Monoid H] [TopologicalSpace G] [TopologicalSpace H] [ContinuousInv G] {f : G →* Hˣ} (hf : Continuous ((Units.coeHom H).comp f)) : Continuous f := by apply continuous_induced_rng.mpr ?_ refine continuous_prodMk.mpr ⟨hf, ?_⟩ simp_rw [← map_inv] exact MulOpposite.continuous_op.comp (hf.comp continuous_inv) namespace Units open MulOpposite (continuous_op continuous_unop) @[to_additive] theorem range_embedProduct [Monoid α] : Set.range (embedProduct α) = {p : α × αᵐᵒᵖ | p.1 * unop p.2 = 1 ∧ unop p.2 * p.1 = 1} := Set.range_eq_iff _ _ |>.mpr ⟨fun a ↦ ⟨a.mul_inv, a.inv_mul⟩, fun p hp ↦ ⟨⟨p.1, unop p.2, hp.1, hp.2⟩, rfl⟩⟩ variable [Monoid α] [TopologicalSpace α] [Monoid β] [TopologicalSpace β] @[to_additive] instance [ContinuousMul α] : IsTopologicalGroup αˣ where continuous_inv := Units.continuous_iff.2 <| ⟨continuous_coe_inv, continuous_val⟩ @[to_additive] theorem isClosedEmbedding_embedProduct [T1Space α] [ContinuousMul α] : IsClosedEmbedding (embedProduct α) where toIsEmbedding := isEmbedding_embedProduct isClosed_range := by rw [range_embedProduct] refine .inter (isClosed_singleton.preimage ?_) (isClosed_singleton.preimage ?_) <;> fun_prop @[to_additive] instance [T1Space α] [ContinuousMul α] [CompactSpace α] : CompactSpace αˣ := isClosedEmbedding_embedProduct.compactSpace @[to_additive] instance [T1Space α] [ContinuousMul α] [WeaklyLocallyCompactSpace α] : WeaklyLocallyCompactSpace αˣ := isClosedEmbedding_embedProduct.weaklyLocallyCompactSpace @[to_additive] instance [T1Space α] [ContinuousMul α] [LocallyCompactSpace α] : LocallyCompactSpace αˣ := isClosedEmbedding_embedProduct.locallyCompactSpace lemma _root_.Submonoid.units_isCompact [T1Space α] [ContinuousMul α] {S : Submonoid α} (hS : IsCompact (S : Set α)) : IsCompact (S.units : Set αˣ) := by have : IsCompact (S ×ˢ S.op) := hS.prod (opHomeomorph.isCompact_preimage.mp hS) exact isClosedEmbedding_embedProduct.isCompact_preimage this /-- The topological group isomorphism between the units of a product of two monoids, and the product of the units of each monoid. -/ @[to_additive prodAddUnits /-- 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 _root_.Homeomorph.prodUnits : (α × β)ˣ ≃ₜ αˣ × βˣ where continuous_toFun := (continuous_fst.units_map (MonoidHom.fst α β)).prodMk (continuous_snd.units_map (MonoidHom.snd α β)) continuous_invFun := Units.continuous_iff.2 ⟨continuous_val.fst'.prodMk continuous_val.snd', continuous_coe_inv.fst'.prodMk 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, @IsTopologicalGroup G t _) : @IsTopologicalGroup G (sInf ts) _ := letI := sInf ts { toContinuousInv := @continuousInv_sInf _ _ _ fun t ht => @IsTopologicalGroup.toContinuousInv G t _ <| h t ht toContinuousMul := @continuousMul_sInf _ _ _ fun t ht => @IsTopologicalGroup.toContinuousMul G t _ <| h t ht } @[to_additive] theorem topologicalGroup_iInf {ts' : ι → TopologicalSpace G} (h' : ∀ i, @IsTopologicalGroup G (ts' i) _) : @IsTopologicalGroup 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₁ : @IsTopologicalGroup G t₁ _) (h₂ : @IsTopologicalGroup G t₂ _) : @IsTopologicalGroup G (t₁ ⊓ t₂) _ := by rw [inf_eq_iInf] refine topologicalGroup_iInf fun b => ?_ cases b <;> assumption end LatticeOps
.lake/packages/mathlib/Mathlib/Topology/Algebra/Group/Quotient.lean
import Mathlib.GroupTheory.GroupAction.Quotient import Mathlib.GroupTheory.QuotientGroup.Defs import Mathlib.Topology.Algebra.Group.Pointwise import Mathlib.Topology.Maps.OpenQuotient /-! # Topology on the quotient group In this file we define topology on `G ⧸ N`, where `N` is a subgroup of `G`, and prove basic properties of this topology. -/ assert_not_exists Cardinal open Topology open scoped Pointwise variable {G : Type*} [TopologicalSpace G] [Group G] namespace QuotientGroup @[to_additive] instance instTopologicalSpace (N : Subgroup G) : TopologicalSpace (G ⧸ N) := instTopologicalSpaceQuotient @[to_additive] instance [CompactSpace G] (N : Subgroup G) : CompactSpace (G ⧸ N) := Quotient.compactSpace @[to_additive] theorem isQuotientMap_mk (N : Subgroup G) : IsQuotientMap (mk : G → G ⧸ N) := isQuotientMap_quot_mk @[to_additive (attr := continuity, fun_prop)] theorem continuous_mk {N : Subgroup G} : Continuous (mk : G → G ⧸ N) := continuous_quot_mk section ContinuousMul variable [ContinuousMul G] {N : Subgroup G} @[to_additive] theorem isOpenMap_coe : IsOpenMap ((↑) : G → G ⧸ N) := isOpenMap_quotient_mk'_mul @[to_additive] theorem isOpenQuotientMap_mk : IsOpenQuotientMap (mk : G → G ⧸ N) := MulAction.isOpenQuotientMap_quotientMk @[to_additive (attr := simp)] theorem dense_preimage_mk {s : Set (G ⧸ N)} : Dense ((↑) ⁻¹' s : Set G) ↔ Dense s := isOpenQuotientMap_mk.dense_preimage_iff @[to_additive] theorem dense_image_mk {s : Set G} : Dense (mk '' s : Set (G ⧸ N)) ↔ Dense (s * (N : Set G)) := by rw [← dense_preimage_mk, preimage_image_mk_eq_mul] @[to_additive] instance instContinuousSMul : ContinuousSMul G (G ⧸ N) where continuous_smul := by rw [← (IsOpenQuotientMap.id.prodMap isOpenQuotientMap_mk).continuous_comp_iff] exact continuous_mk.comp continuous_mul @[to_additive] instance instContinuousConstSMul : ContinuousConstSMul G (G ⧸ N) := inferInstance @[to_additive] theorem t1Space_iff : T1Space (G ⧸ N) ↔ IsClosed (N : Set G) := by rw [← QuotientGroup.preimage_mk_one, MulAction.IsPretransitive.t1Space_iff G (mk 1), isClosed_coinduced] rfl @[to_additive] theorem discreteTopology_iff : DiscreteTopology (G ⧸ N) ↔ IsOpen (N : Set G) := by rw [← QuotientGroup.preimage_mk_one, MulAction.IsPretransitive.discreteTopology_iff G (mk 1), isOpen_coinduced] rfl /-- The quotient of a topological group `G` by a closed subgroup `N` is T1. When `G` is normal, this implies (because `G ⧸ N` is a topological group) that the quotient is T3 (see `QuotientGroup.instT3Space`). Back to the general case, we will show later that the quotient is in fact T2 since `N` acts on `G` properly. -/ @[to_additive /-- The quotient of a topological additive group `G` by a closed subgroup `N` is T1. When `G` is normal, this implies (because `G ⧸ N` is a topological additive group) that the quotient is T3 (see `QuotientAddGroup.instT3Space`). Back to the general case, we will show later that the quotient is in fact T2 since `N` acts on `G` properly. -/] instance instT1Space [hN : IsClosed (N : Set G)] : T1Space (G ⧸ N) := t1Space_iff.mpr hN -- TODO: `IsOpen` should be an class and this should be an instance @[to_additive] theorem discreteTopology (hN : IsOpen (N : Set G)) : DiscreteTopology (G ⧸ N) := discreteTopology_iff.mpr hN /-- A quotient of a locally compact group is locally compact. -/ @[to_additive] instance instLocallyCompactSpace [LocallyCompactSpace G] (N : Subgroup G) : LocallyCompactSpace (G ⧸ N) := QuotientGroup.isOpenQuotientMap_mk.locallyCompactSpace variable (N) /-- 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 nhds_eq (x : G) : 𝓝 (x : G ⧸ N) = Filter.map (↑) (𝓝 x) := (isOpenQuotientMap_mk.map_nhds_eq _).symm @[to_additive] instance instFirstCountableTopology [FirstCountableTopology G] : FirstCountableTopology (G ⧸ N) where nhds_generated_countable := mk_surjective.forall.2 fun x ↦ nhds_eq N x ▸ inferInstance /-- 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 instSecondCountableTopology [SecondCountableTopology G] : SecondCountableTopology (G ⧸ N) := ContinuousConstSMul.secondCountableTopology end ContinuousMul variable [IsTopologicalGroup G] (N : Subgroup G) @[to_additive] instance instIsTopologicalGroup [N.Normal] : IsTopologicalGroup (G ⧸ N) where continuous_mul := by rw [← (isOpenQuotientMap_mk.prodMap isOpenQuotientMap_mk).continuous_comp_iff] exact continuous_mk.comp continuous_mul continuous_inv := continuous_inv.quotient_map' _ @[to_additive] theorem isClosedMap_coe {H : Subgroup G} (hH : IsCompact (H : Set G)) : IsClosedMap ((↑) : G → G ⧸ H) := by intro t ht rw [← (isQuotientMap_mk H).isClosed_preimage, preimage_image_mk_eq_mul] exact ht.mul_right_of_isCompact hH @[to_additive] instance instT3Space [N.Normal] [hN : IsClosed (N : Set G)] : T3Space (G ⧸ N) := by infer_instance end QuotientGroup
.lake/packages/mathlib/Mathlib/Topology/Algebra/Group/GroupTopology.lean
import Mathlib.Topology.Algebra.Group.Basic /-! ### 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. -/ open Set Filter TopologicalSpace Function Topology Pointwise MulOpposite universe u v w x variable {G : Type w} {H : Type x} {α : Type u} {β : Type v} /-- A group topology on a group `α` is a topology for which multiplication and inversion are continuous. -/ structure GroupTopology (α : Type u) [Group α] : Type u extends TopologicalSpace α, IsTopologicalGroup α /-- An additive group topology on an additive group `α` is a topology for which addition and negation are continuous. -/ structure AddGroupTopology (α : Type u) [AddGroup α] : Type u extends TopologicalSpace α, IsTopologicalAddGroup α 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.toIsTopologicalGroup 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.toIsTopologicalGroup 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 α fun_prop continuous_inv := continuous_bot }⟩ @[to_additive (attr := simp)] theorem toTopologicalSpace_bot : (⊥ : GroupTopology α).toTopologicalSpace = ⊥ := rfl @[to_additive] instance : BoundedOrder (GroupTopology α) where le_top x := show x.toTopologicalSpace ≤ ⊤ from le_top bot_le x := show ⊥ ≤ x.toTopologicalSpace from bot_le @[to_additive] instance : Min (GroupTopology α) where min 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 α) := ⟨⊤⟩ /-- 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 _ 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 := (· ⊓ ·) } /-- 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
.lake/packages/mathlib/Mathlib/Topology/Algebra/Group/Defs.lean
import Mathlib.Topology.Algebra.Monoid.Defs /-! # Definitions about topological groups In this file we define mixin classes `ContinuousInv`, `IsTopologicalGroup`, and `ContinuousDiv`, as well as their additive versions. These classes say that the corresponding operations are continuous: - `ContinuousInv G` says that `(·⁻¹)` is continuous on `G`; - `IsTopologicalGroup G` says that `(· * ·)` is continuous on `G × G` and `(·⁻¹)` is continuous on `G`; - `ContinuousDiv G` says that `(· / ·)` is continuous on `G`. For groups, `ContinuousDiv G` is equivalent to `IsTopologicalGroup G`, but we use the additive version `ContinuousSub` for types like `NNReal`, where subtraction is not given by `a - b = a + (-b)`. We also provide convenience dot notation lemmas like `ContinuousAt.neg`. -/ open scoped Topology universe u variable {G α X : Type*} [TopologicalSpace X] /-- 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] /-- 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 topological groups with zero (including topological fields) assuming additionally that the limit is nonzero, use `Filter.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 {f : X → G} {s : Set X} {x : X} @[to_additive (attr := continuity, fun_prop)] theorem Continuous.inv (hf : Continuous f) : Continuous fun x => (f x)⁻¹ := continuous_inv.comp hf @[to_additive] nonrec theorem ContinuousWithinAt.inv (hf : ContinuousWithinAt f s x) : ContinuousWithinAt (fun x => (f x)⁻¹) s x := hf.inv @[to_additive (attr := fun_prop)] nonrec theorem ContinuousAt.inv (hf : ContinuousAt f x) : ContinuousAt (fun x => (f x)⁻¹) x := hf.inv @[to_additive (attr := fun_prop)] theorem ContinuousOn.inv (hf : ContinuousOn f s) : ContinuousOn (fun x => (f x)⁻¹) s := fun x hx ↦ (hf x hx).inv end ContinuousInv /-- A topological (additive) group is a group in which the addition and negation 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 `IsUniformAddGroup` using `IsTopologicalAddGroup.rightUniformSpace` and `isUniformAddGroup_of_addCommGroup`. -/ class IsTopologicalAddGroup (G : Type u) [TopologicalSpace G] [AddGroup G] : Prop extends ContinuousAdd G, ContinuousNeg G /-- 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 `IsUniformGroup` using `IsTopologicalGroup.rightUniformSpace` and `isUniformGroup_of_commGroup`. -/ @[to_additive] class IsTopologicalGroup (G : Type*) [TopologicalSpace G] [Group G] : Prop extends ContinuousMul G, ContinuousInv G /-- 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) IsTopologicalGroup.to_continuousDiv {G : Type u} [TopologicalSpace G] [Group G] [IsTopologicalGroup G] : ContinuousDiv G where continuous_div' := by simp only [div_eq_mul_inv] exact continuous_mul.comp₂ continuous_fst <| continuous_inv.comp continuous_snd 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.prodMk_nhds hg) variable {f g : X → G} {s : Set X} {x : X} @[to_additive (attr := fun_prop) sub] nonrec theorem ContinuousAt.div' (hf : ContinuousAt f x) (hg : ContinuousAt g x) : ContinuousAt (fun x => f x / g x) x := hf.div' 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) @[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 hg end ContinuousDiv
.lake/packages/mathlib/Mathlib/Topology/Algebra/Group/ClosedSubgroup.lean
import Mathlib.Algebra.Group.Subgroup.Basic import Mathlib.GroupTheory.Index import Mathlib.Topology.Algebra.Group.Quotient /-! # Closed subgroups of a topological group This file builds the frame of closed subgroups in a topological group `G`, and its additive version `ClosedAddSubgroup`. ## Main definitions and results * `normalCore_isClosed`: The `normalCore` of a closed subgroup is closed. * `finindex_closedSubgroup_isOpen`: A closed subgroup with finite index is open. ## TODO Actually provide the `Order.Frame (ClosedSubgroup G)` instance. -/ section universe u v /-- The type of closed subgroups of a topological group. -/ @[ext] structure ClosedSubgroup (G : Type u) [Group G] [TopologicalSpace G] extends Subgroup G where isClosed' : IsClosed carrier /-- The type of closed subgroups of an additive topological group. -/ @[ext] structure ClosedAddSubgroup (G : Type u) [AddGroup G] [TopologicalSpace G] extends AddSubgroup G where isClosed' : IsClosed carrier attribute [to_additive] ClosedSubgroup attribute [coe] ClosedSubgroup.toSubgroup ClosedAddSubgroup.toAddSubgroup namespace ClosedSubgroup variable (G : Type u) [Group G] [TopologicalSpace G] variable {G} in @[to_additive] theorem toSubgroup_injective : Function.Injective (ClosedSubgroup.toSubgroup : ClosedSubgroup G → Subgroup G) := fun A B h ↦ by ext rw [h] @[to_additive] instance : SetLike (ClosedSubgroup G) G where coe U := U.1 coe_injective' _ _ h := toSubgroup_injective <| SetLike.ext' h @[to_additive] instance : SubgroupClass (ClosedSubgroup G) G where mul_mem := Subsemigroup.mul_mem' _ one_mem U := U.one_mem' inv_mem := Subgroup.inv_mem' _ @[to_additive] instance : Coe (ClosedSubgroup G) (Subgroup G) where coe := toSubgroup @[to_additive] instance instInfClosedSubgroup : Min (ClosedSubgroup G) := ⟨fun U V ↦ ⟨U ⊓ V, U.isClosed'.inter V.isClosed'⟩⟩ @[to_additive] instance instSemilatticeInfClosedSubgroup : SemilatticeInf (ClosedSubgroup G) := SetLike.coe_injective.semilatticeInf ((↑) : ClosedSubgroup G → Set G) fun _ _ ↦ rfl @[to_additive] instance [CompactSpace G] (H : ClosedSubgroup G) : CompactSpace H := isCompact_iff_compactSpace.mp (IsClosed.isCompact H.isClosed') end ClosedSubgroup open scoped Pointwise namespace Subgroup variable {G : Type u} [Group G] [TopologicalSpace G] [ContinuousMul G] lemma normalCore_isClosed (H : Subgroup G) (h : IsClosed (H : Set G)) : IsClosed (H.normalCore : Set G) := by rw [normalCore_eq_iInf_conjAct] push_cast apply isClosed_iInter intro g convert IsClosed.preimage (IsTopologicalGroup.continuous_conj (ConjAct.ofConjAct g⁻¹)) h using 1 exact Set.ext (fun t ↦ Set.mem_smul_set_iff_inv_smul_mem) @[to_additive] lemma isOpen_of_isClosed_of_finiteIndex (H : Subgroup G) [H.FiniteIndex] (h : IsClosed (H : Set G)) : IsOpen (H : Set G) := by rw [← QuotientGroup.t1Space_iff] at h rw [← QuotientGroup.discreteTopology_iff] infer_instance end Subgroup end
.lake/packages/mathlib/Mathlib/Topology/Algebra/Group/TopologicalAbelianization.lean
import Mathlib.GroupTheory.Commutator.Basic import Mathlib.Tactic.Group 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] [IsTopologicalGroup 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
.lake/packages/mathlib/Mathlib/Topology/Algebra/Group/Units.lean
import Mathlib.Algebra.Group.Pi.Units import Mathlib.Algebra.Group.Submonoid.Units import Mathlib.Topology.Algebra.Constructions import Mathlib.Topology.Algebra.ContinuousMonoidHom /-! # Topological properties of units This file contains lemmas about the topology of units in topological monoids, including results about submonoid units and units of product spaces. -/ open Units /-- If a submonoid is open in a topological monoid, then its units form an open subset of the units of the monoid. -/ @[to_additive /-- If a submonoid is open in a topological additive monoid, then its additive units form an open subset of the additive units of the monoid. -/] lemma Submonoid.isOpen_units {M : Type*} [TopologicalSpace M] [Monoid M] {U : Submonoid M} (hU : IsOpen (U : Set M)) : IsOpen (U.units : Set Mˣ) := (hU.preimage Units.continuous_val).inter (hU.preimage Units.continuous_coe_inv) /-- The isomorphism of topological groups between the units of a product and the product of the units. -/ @[to_additive /-- The isomorphism of topological additive groups between the additive units of a product and the product of the additive units. -/] def ContinuousMulEquiv.piUnits {ι : Type*} {M : ι → Type*} [(i : ι) → Monoid (M i)] [(i : ι) → TopologicalSpace (M i)] : (Π i, M i)ˣ ≃ₜ* Π i, (M i)ˣ where __ := MulEquiv.piUnits continuous_toFun := continuous_pi fun _ ↦ Units.continuous_iff.mpr ⟨continuous_apply _ |>.comp Units.continuous_val, continuous_apply _ |>.comp Units.continuous_coe_inv⟩ continuous_invFun := Units.continuous_iff.mpr ⟨continuous_pi fun _ ↦ Units.continuous_val.comp <| continuous_apply _, continuous_pi fun _ ↦ Units.continuous_coe_inv.comp <| continuous_apply _⟩
.lake/packages/mathlib/Mathlib/Topology/Algebra/Module/WeakDual.lean
import Mathlib.LinearAlgebra.BilinearMap import Mathlib.Topology.Algebra.Module.LinearMap import Mathlib.Topology.Algebra.Module.WeakBilin /-! # Weak dual topology We continue in the setting of `Mathlib/Topology/Algebra/Module/WeakBilin.lean`, which 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 this file, we consider two special cases. 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 `WeakDual 𝕜 E` and `WeakSpace 𝕜 E`, with the respective topology instances on it. * `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. ## References * [H. H. Schaefer, *Topological Vector Spaces*][schaefer1966] ## Tags weak-star, weak dual, duality -/ noncomputable section open Filter open Topology variable {α 𝕜 𝕝 E F : Type*} /-- 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) deriving AddCommMonoid, Module 𝕜, TopologicalSpace, ContinuousAdd, Inhabited, FunLike, ContinuousLinearMapClass namespace WeakDual section Semiring variable [CommSemiring 𝕜] [TopologicalSpace 𝕜] [ContinuousAdd 𝕜] variable [ContinuousConstSMul 𝕜 𝕜] variable [AddCommMonoid E] [Module 𝕜 E] [TopologicalSpace E] /-- 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) := (WeakBilin.isEmbedding ContinuousLinearMap.coe_injective).t2Space end Semiring section Ring variable [CommRing 𝕜] [TopologicalSpace 𝕜] [IsTopologicalAddGroup 𝕜] [ContinuousConstSMul 𝕜 𝕜] variable [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] [IsTopologicalAddGroup E] instance instAddCommGroup : AddCommGroup (WeakDual 𝕜 E) := WeakBilin.instAddCommGroup (topDualPairing 𝕜 E) instance instIsTopologicalAddGroup : IsTopologicalAddGroup (WeakDual 𝕜 E) := WeakBilin.instIsTopologicalAddGroup (topDualPairing 𝕜 E) end Ring 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 deriving AddCommMonoid, Module 𝕜, TopologicalSpace, ContinuousAdd section Semiring variable [CommSemiring 𝕜] [TopologicalSpace 𝕜] [ContinuousAdd 𝕜] variable [ContinuousConstSMul 𝕜 𝕜] variable [AddCommMonoid E] [Module 𝕜 E] [TopologicalSpace E] namespace WeakSpace instance instModule' [CommSemiring 𝕝] [Module 𝕝 E] : Module 𝕝 (WeakSpace 𝕜 E) := WeakBilin.instModule' (topDualPairing 𝕜 E).flip instance instIsScalarTower [CommSemiring 𝕝] [Module 𝕝 𝕜] [Module 𝕝 E] [IsScalarTower 𝕝 𝕜 E] : IsScalarTower 𝕝 𝕜 (WeakSpace 𝕜 E) := WeakBilin.instIsScalarTower (topDualPairing 𝕜 E).flip instance instContinuousSMul [ContinuousSMul 𝕜 𝕜] : ContinuousSMul 𝕜 (WeakSpace 𝕜 E) := WeakBilin.instContinuousSMul _ 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 toWeakSpaceCLM : E →L[𝕜] WeakSpace 𝕜 E where __ := toWeakSpace 𝕜 E cont := by apply WeakBilin.continuous_of_continuous_eval exact ContinuousLinearMap.continuous variable (𝕜 E) in @[simp] theorem toWeakSpaceCLM_eq_toWeakSpace (x : E) : toWeakSpaceCLM 𝕜 E x = toWeakSpace 𝕜 E x := by rfl theorem toWeakSpaceCLM_bijective : Function.Bijective (toWeakSpaceCLM 𝕜 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 (toWeakSpaceCLM 𝕜 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 ((toWeakSpaceCLM 𝕜 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 Semiring section Ring namespace WeakSpace variable [CommRing 𝕜] [TopologicalSpace 𝕜] [IsTopologicalAddGroup 𝕜] [ContinuousConstSMul 𝕜 𝕜] variable [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] [IsTopologicalAddGroup E] instance instAddCommGroup : AddCommGroup (WeakSpace 𝕜 E) := WeakBilin.instAddCommGroup (topDualPairing 𝕜 E).flip instance instIsTopologicalAddGroup : IsTopologicalAddGroup (WeakSpace 𝕜 E) := WeakBilin.instIsTopologicalAddGroup (topDualPairing 𝕜 E).flip end WeakSpace end Ring
.lake/packages/mathlib/Mathlib/Topology/Algebra/Module/PointwiseConvergence.lean
import Mathlib.Topology.Algebra.Module.StrongTopology import Mathlib.Topology.Algebra.Module.WeakDual /-! # Topology of pointwise convergence on continous linear maps ## Main definitions * `PointwiseConvergenceCLM`: Type synonym of `E →SL[σ] F` equipped with the uniform convergence topology on finite sets. * `PointwiseConvergenceCLM.evalCLM`: The evaluation map `(f : E →SLₚₜ[σ] F) ↦ f a` for fixed `a : E` as a continuous linear map. * `ContinousLinearMap.toPointwiseConvergenceCLM`: The canonical map from `E →SL[σ] F` to `E →SLₚₜ[σ] F` as a continuous linear map. This is the statement that bounded convergence is stronger than pointwise convergence. * `PointwiseConvergenceCLM.equivWeakDual`: The continuous equivalence between `E →Lₚₜ[𝕜] 𝕜` and `WeakDual 𝕜 E`. ## Main statements * `PointwiseConvergenceCLM.tendsto_iff_forall_tendsto`: In the topology of pointwise convergence, `a` converges to `a₀` iff for every `x : E` the map `a · x` converges to `a₀ x`. * `PointwiseConvergenceCLM.continuous_of_continuous_eval`: A map to `g : α → E →SLₚₜ[σ] F` is continuous if for every `x : E` the evaluation `g · x` is continuous. ## Notation * `E →SLₚₜ[σ] F` is space of continuous linear maps equipped with pointwise convergence topology. -/ /-! ### Topology of pointwise convergence -/ variable {α ι : Type*} [TopologicalSpace α] variable {𝕜 𝕜₁ 𝕜₂ : Type*} [NormedField 𝕜] [NormedField 𝕜₁] [NormedField 𝕜₂] variable {σ : 𝕜₁ →+* 𝕜₂} variable {E F Fᵤ : Type*} [AddCommGroup E] [TopologicalSpace E] [AddCommGroup F] [TopologicalSpace F] [IsTopologicalAddGroup F] [AddCommGroup Fᵤ] [UniformSpace Fᵤ] [IsUniformAddGroup Fᵤ] [Module 𝕜 E] [Module 𝕜 F] [Module 𝕜 Fᵤ] [Module 𝕜₁ E] [Module 𝕜₂ F] [Module 𝕜₂ Fᵤ] open Set Topology variable (σ E F) in /-- The space of continuous linear maps equipped with the topology of pointwise convergence, sometimes also called the *strong operator topology*. We avoid this terminology since so many other things share similar names, and using "pointwise convergence" in the name is more informative. This topology is also known as the weak*-topology in the case that `σ = RingHom.id 𝕜` and `F = 𝕜` -/ abbrev PointwiseConvergenceCLM := UniformConvergenceCLM σ F {s : Set E | Finite s} @[inherit_doc] notation:25 E " →SLₚₜ[" σ "] " F => PointwiseConvergenceCLM σ E F @[inherit_doc] notation:25 E " →Lₚₜ[" R "] " F => PointwiseConvergenceCLM (RingHom.id R) E F namespace PointwiseConvergenceCLM instance continuousEvalConst : ContinuousEvalConst (E →SLₚₜ[σ] F) E F := UniformConvergenceCLM.continuousEvalConst _ _ _ (sUnion_eq_univ_iff.mpr fun x ↦ ⟨{x}, finite_singleton x, rfl⟩) protected theorem hasBasis_nhds_zero_of_basis {ι : Type*} {p : ι → Prop} {b : ι → Set F} (h : (𝓝 0 : Filter F).HasBasis p b) : (𝓝 (0 : E →SLₚₜ[σ] F)).HasBasis (fun Si : Set E × ι => Finite 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 | Finite S } ⟨∅, Set.finite_empty⟩ (directedOn_of_sup_mem fun _ _ => Set.Finite.union) h protected theorem hasBasis_nhds_zero : (𝓝 (0 : E →SLₚₜ[σ] F)).HasBasis (fun SV : Set E × Set F => Finite SV.1 ∧ SV.2 ∈ (𝓝 0 : Filter F)) fun SV => { f : E →SLₚₜ[σ] F | ∀ x ∈ SV.1, f x ∈ SV.2 } := PointwiseConvergenceCLM.hasBasis_nhds_zero_of_basis (𝓝 0).basis_sets variable (σ E Fᵤ) in protected theorem isUniformEmbedding_coeFn : IsUniformEmbedding ((↑) : (E →SLₚₜ[σ] Fᵤ) → (E → Fᵤ)) := (UniformOnFun.isUniformEmbedding_toFun_finite E Fᵤ).comp (UniformConvergenceCLM.isUniformEmbedding_coeFn σ Fᵤ _) variable (σ E F) in protected theorem isEmbedding_coeFn : IsEmbedding ((↑) : (E →SLₚₜ[σ] F) → (E → F)) := let _: UniformSpace F := IsTopologicalAddGroup.rightUniformSpace F have _ : IsUniformAddGroup F := isUniformAddGroup_of_addCommGroup PointwiseConvergenceCLM.isUniformEmbedding_coeFn σ E F |>.isEmbedding /-- In the topology of pointwise convergence, `a` converges to `a₀` iff for every `x : E` the map `a · x` converges to `a₀ x`. -/ theorem tendsto_iff_forall_tendsto {p : Filter ι} {a : ι → E →SLₚₜ[σ] F} {a₀ : E →SLₚₜ[σ] F} : Filter.Tendsto a p (𝓝 a₀) ↔ ∀ x : E, Filter.Tendsto (a · x) p (𝓝 (a₀ x)) := by simp [(PointwiseConvergenceCLM.isEmbedding_coeFn σ E F).tendsto_nhds_iff, tendsto_pi_nhds] variable (σ E F) in /-- Coercion from `E →SLₚₜ[σ] F` to `E →ₛₗ[σ] F` as a `𝕜₂`-linear map. -/ @[simps!] def coeLMₛₗ [ContinuousConstSMul 𝕜₂ F] : (E →SLₚₜ[σ] F) →ₗ[𝕜₂] E →ₛₗ[σ] F := ContinuousLinearMap.coeLMₛₗ σ variable (𝕜 E F) in /-- Coercion from `E →Lₚₜ[𝕜] F` to `E →ₗ[𝕜] F` as a `𝕜`-linear map. -/ @[simps!] def coeLM [ContinuousConstSMul 𝕜 F] : (E →Lₚₜ[𝕜] F) →ₗ[𝕜] E →ₗ[𝕜] F := ContinuousLinearMap.coeLM 𝕜 variable (σ F) in /-- The evaluation map `(f : E →SLₚₜ[σ] F) ↦ f a` for `a : E` as a continuous linear map. -/ @[simps!] def evalCLM [ContinuousConstSMul 𝕜₂ F] (a : E) : (E →SLₚₜ[σ] F) →L[𝕜₂] F where toLinearMap := (coeLMₛₗ σ E F).flip a cont := continuous_eval_const a /-- A map to `E →SLₚₜ[σ] F` is continuous if for every `x : E` the evaluation `g · x` is continuous. -/ theorem continuous_of_continuous_eval {g : α → E →SLₚₜ[σ] F} (h : ∀ x, Continuous (g · x)) : Continuous g := by simp [(PointwiseConvergenceCLM.isEmbedding_coeFn σ E F).continuous_iff, continuous_pi_iff, h] variable (𝕜₂ σ E F) in /-- The topology of bounded convergence is stronger than the topology of pointwise convergence. -/ @[simps!] def _root_.ContinuousLinearMap.toPointwiseConvergenceCLM [ContinuousSMul 𝕜₁ E] [ContinuousConstSMul 𝕜₂ F] : (E →SL[σ] F) →L[𝕜₂] (E →SLₚₜ[σ] F) where toLinearMap := LinearMap.id cont := continuous_id_of_le (UniformConvergenceCLM.topologicalSpace_mono _ _ fun _ ↦ Set.Finite.isVonNBounded) variable (𝕜 E) in /-- The topology of pointwise convergence on `E →Lₚₜ[𝕜] 𝕜` coincides with the weak-* topology. -/ @[simps!] def equivWeakDual : (E →Lₚₜ[𝕜] 𝕜) ≃L[𝕜] WeakDual 𝕜 E where toLinearEquiv := LinearEquiv.refl 𝕜 (E →L[𝕜] 𝕜) continuous_toFun := WeakDual.continuous_of_continuous_eval (fun y ↦ (evalCLM _ 𝕜 y).continuous) continuous_invFun := continuous_of_continuous_eval (WeakBilin.eval_continuous _) end PointwiseConvergenceCLM
.lake/packages/mathlib/Mathlib/Topology/Algebra/Module/Compact.lean
import Mathlib.LinearAlgebra.Finsupp.LinearCombination import Mathlib.RingTheory.Finiteness.Defs import Mathlib.Topology.Algebra.Ring.Basic import Mathlib.RingTheory.Noetherian.Defs /-! # Compact submodules -/ variable {R M : Type*} [CommSemiring R] [TopologicalSpace R] [AddCommMonoid M] [Module R M] variable [TopologicalSpace M] [ContinuousAdd M] [ContinuousSMul R M] lemma Submodule.isCompact_of_fg [CompactSpace R] {N : Submodule R M} (hN : N.FG) : IsCompact (X := M) N := by obtain ⟨s, hs⟩ := hN have : LinearMap.range (Fintype.linearCombination R (α := s) Subtype.val) = N := by simp [hs] rw [← this] refine isCompact_range ?_ simp only [Fintype.linearCombination, Finset.univ_eq_attach, LinearMap.coe_mk, AddHom.coe_mk] fun_prop lemma Ideal.isCompact_of_fg [IsTopologicalSemiring R] [CompactSpace R] {I : Ideal R} (hI : I.FG) : IsCompact (X := R) I := Submodule.isCompact_of_fg hI variable (R M) in lemma Module.Finite.compactSpace [CompactSpace R] [Module.Finite R M] : CompactSpace M := ⟨Submodule.isCompact_of_fg (Module.Finite.fg_top (R := R))⟩ instance (priority := low) IsNoetherianRing.isClosed_ideal {R : Type*} [CommRing R] [TopologicalSpace R] [IsTopologicalRing R] [IsNoetherianRing R] [CompactSpace R] [T2Space R] (I : Ideal R) : IsClosed (X := R) I := (Ideal.isCompact_of_fg (IsNoetherian.noetherian I)).isClosed
.lake/packages/mathlib/Mathlib/Topology/Algebra/Module/Star.lean
import Mathlib.Algebra.Star.Module import Mathlib.Topology.Algebra.Module.Equiv 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 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 [IsTopologicalAddGroup A] [ContinuousStar A] [ContinuousConstSMul R A] : Continuous (StarModule.decomposeProdAdjoint R A) := (continuous_selfAdjointPart R A).prodMk (continuous_skewAdjointPart R A) theorem continuous_decomposeProdAdjoint_symm [ContinuousAdd 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! -isSimp] def selfAdjointPartL [ContinuousAdd A] [ContinuousStar A] [ContinuousConstSMul R A] : A →L[R] selfAdjoint A where toLinearMap := selfAdjointPart R cont := continuous_selfAdjointPart _ _ /-- 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 [IsTopologicalAddGroup 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 _ _
.lake/packages/mathlib/Mathlib/Topology/Algebra/Module/PerfectPairing.lean
import Mathlib.LinearAlgebra.BilinearMap import Mathlib.Topology.Algebra.Module.LinearMap /-! # Continuous perfect pairings This file defines continuous perfect pairings. For a topological ring `R` and two topological modules `M` and `N`, a continuous perfect pairing is a continuous bilinear map `M × N → R` that is bijective in both arguments. We require continuity in the forward direction only so that we can put several different topologies on the continuous dual (e.g., strong, weak, weak-*). For example, if `M` is weakly reflexive then there is a continuous perfect pairing between `M` and `WeakDual R M`, even though the map `WeakDual R M ≃ₗ[R] StrongDual R M` (where `StrongDual R M` is equipped with its strong topology) is not in general a homeomorphism. ## TODO Adapt `PerfectPairing` to this Prop-valued typeclass paradigm -/ open Function namespace LinearMap variable {R M N : Type*} [CommRing R] [TopologicalSpace R] [AddCommGroup M] [Module R M] [TopologicalSpace M] [AddCommGroup N] [Module R N] [TopologicalSpace N] (p : M →ₗ[R] N →ₗ[R] R) {x : M} {y : N} /-- For a topological ring `R` and two topological modules `M` and `N`, a continuous perfect pairing is a continuous bilinear map `M × N → R` that is bijective in both arguments. We require continuity in the forward direction only so that we can put several different topologies on the continuous dual: strong, weak, weak-* topology... -/ @[ext] class IsContPerfPair (p : M →ₗ[R] N →ₗ[R] R) where continuous_uncurry (p) : Continuous fun (x, y) ↦ p x y bijective_left (p) : Bijective fun x ↦ ContinuousLinearMap.mk (p x) <| continuous_uncurry.comp <| .prodMk_right x bijective_right (p) : Bijective fun y ↦ ContinuousLinearMap.mk (p.flip y) <| continuous_uncurry.comp <| .prodMk_left y variable [p.IsContPerfPair] alias continuous_uncurry_of_isContPerfPair := IsContPerfPair.continuous_uncurry /-- Given a perfect pairing between `M`and `N`, we may interchange the roles of `M` and `N`. -/ instance flip.instIsContPerfPair : p.flip.IsContPerfPair where continuous_uncurry := p.continuous_uncurry_of_isContPerfPair.comp continuous_swap bijective_left := IsContPerfPair.bijective_right p bijective_right := IsContPerfPair.bijective_left p lemma continuous_of_isContPerfPair : Continuous (p x) := p.continuous_uncurry_of_isContPerfPair.comp <| .prodMk_right x variable [IsTopologicalRing R] /-- Turn a continuous perfect pairing between `M` and `N` into a map from `M` to continuous linear maps `N → R`. -/ noncomputable def toContPerfPair : M ≃ₗ[R] StrongDual R N := .ofBijective { toFun := _, map_add' x y := by ext; simp, map_smul' r x := by ext; simp } <| IsContPerfPair.bijective_left p @[simp] lemma toLinearMap_toContPerfPair (x : M) : p.toContPerfPair x = p x := rfl @[simp] lemma toContPerfPair_apply (x : M) (y : N) : p.toContPerfPair x y = p x y := rfl end LinearMap
.lake/packages/mathlib/Mathlib/Topology/Algebra/Module/ClosedSubmodule.lean
import Mathlib.Topology.Algebra.Module.LinearMap import Mathlib.Topology.Sets.Closeds /-! # Closed submodules of a topological module This file builds the frame of closed `R`-submodules of a topological module `M`. One can turn `s : Submodule R E` + `hs : IsClosed s` into `s : ClosedSubmodule R E` in a tactic block by doing `lift s to ClosedSubmodule R E using hs`. ## TODO Actually provide the `Order.Frame (ClosedSubmodule R M)` instance. -/ open Function Order TopologicalSpace variable {ι : Sort*} {R M N O : Type*} [Semiring R] [AddCommMonoid M] [TopologicalSpace M] [Module R M] [AddCommMonoid N] [TopologicalSpace N] [Module R N] [AddCommMonoid O] [TopologicalSpace O] [Module R O] variable (R M) in /-- The type of closed submodules of a topological module. -/ @[ext] structure ClosedSubmodule extends Submodule R M, Closeds M where namespace ClosedSubmodule variable {s t : ClosedSubmodule R M} {x : M} attribute [coe] toSubmodule toCloseds /-- Reinterpret a closed submodule as a submodule. -/ add_decl_doc toSubmodule /-- Reinterpret a closed submodule as a closed set. -/ add_decl_doc toCloseds lemma toSubmodule_injective : Injective (toSubmodule : ClosedSubmodule R M → Submodule R M) := fun s t h ↦ by cases s; congr! instance : SetLike (ClosedSubmodule R M) M where coe s := s.1 coe_injective' _ _ h := toSubmodule_injective <| SetLike.coe_injective h lemma toCloseds_injective : Injective (toCloseds : ClosedSubmodule R M → Closeds M) := fun _s _t h ↦ SetLike.coe_injective congr(($h : Set M)) instance : AddSubmonoidClass (ClosedSubmodule R M) M where zero_mem s := s.zero_mem add_mem {s} := s.add_mem instance : SMulMemClass (ClosedSubmodule R M) R M where smul_mem {s} r := s.smul_mem r instance : Coe (ClosedSubmodule R M) (Submodule R M) where coe := toSubmodule @[simp] lemma carrier_eq_coe (s : ClosedSubmodule R M) : s.carrier = s := rfl @[simp] lemma mem_mk {s : Submodule R M} {hs} : x ∈ mk s hs ↔ x ∈ s := .rfl @[simp, norm_cast] lemma coe_toSubmodule (s : ClosedSubmodule R M) : (s.toSubmodule : Set M) = s := rfl @[simp] lemma coe_toCloseds (s : ClosedSubmodule R M) : (s.toCloseds : Set M) = s := rfl lemma isClosed (s : ClosedSubmodule R M) : IsClosed (s : Set M) := s.isClosed' initialize_simps_projections ClosedSubmodule (carrier → coe, as_prefix coe) instance : CanLift (Submodule R M) (ClosedSubmodule R M) toSubmodule (IsClosed (X := M) ·) where prf s hs := ⟨⟨s, hs⟩, rfl⟩ @[simp, norm_cast] lemma toSubmodule_le_toSubmodule {s t : ClosedSubmodule R M} : s.toSubmodule ≤ t.toSubmodule ↔ s ≤ t := .rfl /-- The preimage of a closed submodule under a continuous linear map as a closed submodule. -/ @[simps!] def comap (f : M →L[R] N) (s : ClosedSubmodule R N) : ClosedSubmodule R M where toSubmodule := .comap f s isClosed' := by simpa using s.isClosed.preimage f.continuous @[simp] lemma mem_comap {f : M →L[R] N} {s : ClosedSubmodule R N} {x : M} : x ∈ s.comap f ↔ f x ∈ s := .rfl @[simp] lemma toSubmodule_comap (f : M →L[R] N) (s : ClosedSubmodule R N) : (s.comap f).toSubmodule = s.toSubmodule.comap f := rfl @[simp] lemma comap_id (s : ClosedSubmodule R M) : s.comap (.id _ _) = s := rfl lemma comap_comap (g : N →L[R] O) (f : M →L[R] N) (s : ClosedSubmodule R O) : (s.comap g).comap f = s.comap (g.comp f) := rfl instance instInf : Min (ClosedSubmodule R M) where min s t := ⟨s ⊓ t, s.isClosed.inter t.isClosed⟩ instance instInfSet : InfSet (ClosedSubmodule R M) where sInf S := ⟨⨅ s ∈ S, s, by simpa using isClosed_biInter fun x hx ↦ x.isClosed⟩ @[simp, norm_cast] lemma toSubmodule_sInf (S : Set (ClosedSubmodule R M)) : toSubmodule (sInf S) = ⨅ s ∈ S, s.toSubmodule := rfl @[simp, norm_cast] lemma toSubmodule_iInf (f : ι → ClosedSubmodule R M) : toSubmodule (⨅ i, f i) = ⨅ i, (f i).toSubmodule := by rw [iInf, toSubmodule_sInf, iInf_range] @[simp, norm_cast] lemma coe_sInf (S : Set (ClosedSubmodule R M)) : ↑(sInf S) = ⨅ s ∈ S, (s : Set M) := by simp [← coe_toSubmodule] @[simp, norm_cast] lemma coe_iInf (f : ι → ClosedSubmodule R M) : ↑(⨅ i, f i) = ⨅ i, (f i : Set M) := by simp [← coe_toSubmodule] @[simp] lemma mem_sInf {S : Set (ClosedSubmodule R M)} : x ∈ sInf S ↔ ∀ s ∈ S, x ∈ s := by simp [← SetLike.mem_coe] @[simp] lemma mem_iInf {f : ι → ClosedSubmodule R M} : x ∈ ⨅ i, f i ↔ ∀ i, x ∈ f i := by simp [← SetLike.mem_coe] instance instSemilatticeInf : SemilatticeInf (ClosedSubmodule R M) := toSubmodule_injective.semilatticeInf _ fun _ _ ↦ rfl @[simp, norm_cast] lemma toSubmodule_inf (s t : ClosedSubmodule R M) : toSubmodule (s ⊓ t) = s.toSubmodule ⊓ t.toSubmodule := rfl @[simp, norm_cast] lemma coe_inf (s t : ClosedSubmodule R M) : ↑(s ⊓ t) = (s ⊓ t : Set M) := rfl @[simp] lemma mem_inf : x ∈ s ⊓ t ↔ x ∈ s ∧ x ∈ t := .rfl instance : CompleteSemilatticeInf (ClosedSubmodule R M) where sInf_le s a ha _ := by simp only [toSubmodule_sInf, Submodule.mem_iInf] exact fun h ↦ h a ha le_sInf s a ha b := by simp only [toSubmodule_sInf, Submodule.mem_iInf] exact fun a i hi ↦ ha i hi a instance : OrderTop (ClosedSubmodule R M) where top := ⟨⊤, isClosed_univ⟩ le_top s := le_top (a := s.toSubmodule) @[simp, norm_cast] lemma toSubmodule_top : toSubmodule (⊤ : ClosedSubmodule R M) = ⊤ := rfl @[simp, norm_cast] lemma coe_top : ((⊤ : ClosedSubmodule R M) : Set M) = .univ := rfl @[simp] lemma mem_top : x ∈ (⊤ : ClosedSubmodule R M) := trivial section T1Space variable [T1Space M] instance instOrderBot : OrderBot (ClosedSubmodule R M) where bot := ⟨⊥, isClosed_singleton⟩ bot_le s := bot_le (a := s.toSubmodule) @[simp, norm_cast] lemma toSubmodule_bot : toSubmodule (⊥ : ClosedSubmodule R M) = ⊥ := rfl @[simp, norm_cast] lemma coe_bot : ((⊥ : ClosedSubmodule R M) : Set M) = {0} := rfl @[simp] lemma mem_bot : x ∈ (⊥ : ClosedSubmodule R M) ↔ x = 0 := .rfl end T1Space end ClosedSubmodule namespace Submodule variable [ContinuousAdd M] [ContinuousConstSMul R M] /-- The closure of a submodule as a closed submodule. -/ @[simps!] protected def closure (s : Submodule R M) : ClosedSubmodule R M where toSubmodule := s.topologicalClosure isClosed' := isClosed_closure @[simp] lemma closure_le {s : Submodule R M} {t : ClosedSubmodule R M} : s.closure ≤ t ↔ s ≤ t := t.isClosed.closure_subset_iff @[simp] lemma mem_closure_iff {x : M} {s : Submodule R M} : x ∈ s.closure ↔ x ∈ s.topologicalClosure := Iff.rfl end Submodule namespace ClosedSubmodule variable [ContinuousAdd N] [ContinuousConstSMul R N] {f : M →L[R] N} @[simp] lemma closure_toSubmodule_eq {s : ClosedSubmodule R N} : s.toSubmodule.closure = s := by ext x simp [closure_eq_iff_isClosed.mpr (ClosedSubmodule.isClosed s)] /-- The closure of the image of a closed submodule under a continuous linear map is a closed submodule. `ClosedSubmodule.map f` is left-adjoint to `ClosedSubmodule.comap f`. See `ClosedSubmodule.gc_map_comap`. -/ def map (f : M →L[R] N) (s : ClosedSubmodule R M) : ClosedSubmodule R N := (s.toSubmodule.map f).closure @[simp] lemma map_id [ContinuousAdd M] [ContinuousConstSMul R M] (s : ClosedSubmodule R M) : s.map (.id _ _) = s := SetLike.coe_injective <| by simpa [map] using s.isClosed.closure_eq lemma map_le_iff_le_comap {s : ClosedSubmodule R M} {t : ClosedSubmodule R N} : map f s ≤ t ↔ s ≤ comap f t := by simp [map, Submodule.map_le_iff_le_comap]; simp [← toSubmodule_le_toSubmodule] lemma gc_map_comap : GaloisConnection (map f) (comap f) := fun _ _ ↦ map_le_iff_le_comap variable {s t : ClosedSubmodule R N} {x : N} instance : Max (ClosedSubmodule R N) where max s t := (s.toSubmodule ⊔ t.toSubmodule).closure @[simp] lemma toSubmodule_sup : toSubmodule (s ⊔ t) = (s.toSubmodule ⊔ t.toSubmodule).closure := rfl @[simp, norm_cast] lemma coe_sup : ↑(s ⊔ t) = closure (s.toSubmodule ⊔ t.toSubmodule).carrier := by simp only [← coe_toSubmodule, toSubmodule_sup] simp only [coe_toSubmodule, Submodule.coe_closure, Submodule.carrier_eq_coe] @[simp] lemma mem_sup : x ∈ s ⊔ t ↔ x ∈ closure (s.toSubmodule ⊔ t.toSubmodule).carrier := Iff.rfl instance : SupSet (ClosedSubmodule R N) where sSup S := ⟨(⨆ s ∈ S, s.toSubmodule).closure, isClosed_closure⟩ @[simp] lemma toSubmodule_sSup (S : Set (ClosedSubmodule R N)) : toSubmodule (sSup S) = (⨆ s ∈ S, s.toSubmodule).closure := rfl @[simp] lemma toSubmodule_iSup (f : ι → ClosedSubmodule R N) : toSubmodule (⨆ i, f i) = (⨆ i, (f i).toSubmodule).closure := by rw [iSup, toSubmodule_sSup, iSup_range] @[simp, norm_cast] lemma coe_sSup (S : Set (ClosedSubmodule R N)) : ↑(sSup S) = closure (⨆ s ∈ S, s.toSubmodule).carrier := by simp only [← coe_toSubmodule, toSubmodule_sSup] simp only [coe_toSubmodule, Submodule.coe_closure, Submodule.carrier_eq_coe] @[simp, norm_cast] lemma coe_iSup (f : ι → ClosedSubmodule R N) : ↑(⨆ i, f i) = closure (⨆ i, (f i).toSubmodule).carrier := by simp only [← coe_toSubmodule, toSubmodule_iSup, Submodule.carrier_eq_coe] rfl @[simp] lemma mem_sSup {S : Set (ClosedSubmodule R N)} : x ∈ sSup S ↔ x ∈ closure (⨆ s ∈ S, s.toSubmodule).carrier := Iff.rfl @[simp] lemma mem_iSup {f : ι → ClosedSubmodule R N} : x ∈ ⨆ i, f i ↔ x ∈ closure (⨆ i, (f i).toSubmodule).carrier := by simp [← SetLike.mem_coe] instance : SemilatticeSup (ClosedSubmodule R N) where sup s t := s ⊔ t le_sup_left _ _ _ hx := subset_closure <| Submodule.mem_sup_left hx le_sup_right _ _ _ hx := subset_closure <| Submodule.mem_sup_right hx sup_le _ _ _ ha hb := Submodule.closure_le.mpr <| sup_le_iff.mpr ⟨ha, hb⟩ instance : CompleteSemilatticeSup (ClosedSubmodule R N) where le_sSup s a ha x hx := subset_closure <| Submodule.mem_iSup_of_mem _ <| Submodule.mem_iSup_of_mem ha hx sSup_le s a h x := by rw [← ClosedSubmodule.closure_toSubmodule_eq (s := a)] apply closure_mono simp only [Submodule.coe_toAddSubmonoid, coe_toSubmodule] intro y hy simp only [SetLike.mem_coe, Submodule.mem_iSup] at hy exact hy a fun b _ hz ↦ Submodule.mem_iSup _ |>.mp hz _ <| fun hb ↦ h b hb instance : Lattice (ClosedSubmodule R N) where instance [T1Space N] : CompleteLattice (ClosedSubmodule R N) where end ClosedSubmodule
.lake/packages/mathlib/Mathlib/Topology/Algebra/Module/StrongDual.lean
import Mathlib.Topology.Algebra.Module.LinearMap import Mathlib.Analysis.LocallyConvex.Polar deprecated_module (since := "2025-09-03")
.lake/packages/mathlib/Mathlib/Topology/Algebra/Module/PerfectSpace.lean
import Mathlib.Analysis.SpecificLimits.Normed import Mathlib.Topology.Perfect /-! # Vector spaces over nontrivially normed fields are perfect spaces -/ open Filter Set open scoped Topology variable (𝕜 E : Type*) [NontriviallyNormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] [Nontrivial E] [TopologicalSpace E] [ContinuousAdd E] [ContinuousSMul 𝕜 E] include 𝕜 in lemma perfectSpace_of_module : PerfectSpace E := by refine ⟨fun x hx ↦ ?_⟩ let ⟨r, hr₀, hr⟩ := NormedField.exists_norm_lt_one 𝕜 obtain ⟨c, hc⟩ : ∃ (c : E), c ≠ 0 := exists_ne 0 have A : Tendsto (fun (n : ℕ) ↦ x + r ^ n • c) atTop (𝓝 (x + (0 : 𝕜) • c)) := by apply Tendsto.add tendsto_const_nhds exact (tendsto_pow_atTop_nhds_zero_of_norm_lt_one hr).smul tendsto_const_nhds have B : Tendsto (fun (n : ℕ) ↦ x + r ^ n • c) atTop (𝓝[univ \ {x}] x) := by simp only [zero_smul, add_zero] at A simp [tendsto_nhdsWithin_iff, A, hc, norm_pos_iff.mp hr₀] exact accPt_principal_iff_nhdsWithin.mpr ((atTop_neBot.map _).mono B) instance : PerfectSpace 𝕜 := perfectSpace_of_module 𝕜 𝕜
.lake/packages/mathlib/Mathlib/Topology/Algebra/Module/Basic.lean
import Mathlib.Algebra.Module.Opposite import Mathlib.Topology.Algebra.Group.Quotient import Mathlib.Topology.Algebra.Ring.Basic import Mathlib.Topology.UniformSpace.UniformEmbedding import Mathlib.LinearAlgebra.Finsupp.LinearCombination import Mathlib.LinearAlgebra.Pi import Mathlib.LinearAlgebra.Quotient.Defs /-! # Theory of topological modules We use the class `ContinuousSMul` for topological (semi) modules and topological vector spaces. -/ assert_not_exists Cardinal TrivialStar 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 [IsTopologicalRing R] [IsTopologicalAddGroup 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 rw [← nhds_prod_eq] at hmul refine continuous_of_continuousAt_zero₂ (AddMonoidHom.smul : R →+ M →+ M) ?_ ?_ ?_ <;> simpa [ContinuousAt] variable (R M) in omit [TopologicalSpace R] in /-- A topological module over a ring has continuous negation. This cannot be an instance, because it would cause search for `[Module ?R M]` with unknown `R`. -/ theorem ContinuousNeg.of_continuousConstSMul [ContinuousConstSMul R M] : ContinuousNeg M where continuous_neg := by simpa using continuous_const_smul (T := M) (-1 : R) 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*} [SMul R M₁] [SMul R M₂] [u : TopologicalSpace R] {t : TopologicalSpace M₂} [ContinuousSMul R M₂] {F : Type*} [FunLike F M₁ M₂] [MulActionHomClass F R M₁ M₂] (f : F) theorem continuousSMul_induced : @ContinuousSMul R M₁ _ u (t.induced f) := let _ : TopologicalSpace M₁ := t.induced f IsInducing.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 [Submodule.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 instance topologicalAddGroup {R M : Type*} [Ring R] [AddCommGroup M] [Module R M] [TopologicalSpace M] [IsTopologicalAddGroup M] (S : Submodule R M) : IsTopologicalAddGroup S := inferInstanceAs (IsTopologicalAddGroup S.toAddSubgroup) end Submodule section closure variable {R : Type u} {M : Type v} [Semiring R] [TopologicalSpace M] [AddCommMonoid 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, norm_cast] 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 namespace Submodule variable {ι R : Type*} {M : ι → Type*} [Semiring R] [∀ i, AddCommMonoid (M i)] [∀ i, Module R (M i)] [∀ i, TopologicalSpace (M i)] [DecidableEq ι] /-- If `s i` is a family of submodules, each is in its module, then the closure of their span in the indexed product of the modules is the product of their closures. In case of a finite index type, this statement immediately follows from `Submodule.iSup_map_single`. However, the statement is true for an infinite index type as well. -/ theorem closure_coe_iSup_map_single (s : ∀ i, Submodule R (M i)) : closure (↑(⨆ i, (s i).map (LinearMap.single R M i)) : Set (∀ i, M i)) = Set.univ.pi fun i ↦ closure (s i) := by rw [← closure_pi_set] refine (closure_mono ?_).antisymm <| closure_minimal ?_ isClosed_closure · exact SetLike.coe_mono <| iSup_map_single_le · simp only [Set.subset_def, mem_closure_iff] intro x hx U hU hxU rcases isOpen_pi_iff.mp hU x hxU with ⟨t, V, hV, hVU⟩ refine ⟨∑ i ∈ t, Pi.single i (x i), hVU ?_, ?_⟩ · simp_all [Finset.sum_pi_single] · exact sum_mem fun i hi ↦ mem_iSup_of_mem i <| mem_map_of_mem <| hx _ <| Set.mem_univ _ /-- If `s i` is a family of submodules, each is in its module, then the closure of their span in the indexed product of the modules is the product of their closures. In case of a finite index type, this statement immediately follows from `Submodule.iSup_map_single`. However, the statement is true for an infinite index type as well. This version is stated in terms of `Submodule.topologicalClosure`, thus assumes that `M i`s are topological modules over `R`. However, the statement is true without assuming continuity of the operations, see `Submodule.closure_coe_iSup_map_single` above. -/ theorem topologicalClosure_iSup_map_single [∀ i, ContinuousAdd (M i)] [∀ i, ContinuousConstSMul R (M i)] (s : ∀ i, Submodule R (M i)) : topologicalClosure (⨆ i, (s i).map (LinearMap.single R M i)) = pi Set.univ fun i ↦ (s i).topologicalClosure := SetLike.coe_injective <| closure_coe_iSup_map_single _ end Submodule 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 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 -fullyApplied] 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! -fullyApplied] 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 section Quotient namespace Submodule variable {R M : Type*} [Ring R] [AddCommGroup M] [Module R M] [TopologicalSpace M] (S : Submodule R M) instance _root_.QuotientModule.Quotient.topologicalSpace : TopologicalSpace (M ⧸ S) := inferInstanceAs (TopologicalSpace (Quotient S.quotientRel)) theorem isOpenMap_mkQ [ContinuousAdd M] : IsOpenMap S.mkQ := QuotientAddGroup.isOpenMap_coe theorem isOpenQuotientMap_mkQ [ContinuousAdd M] : IsOpenQuotientMap S.mkQ := QuotientAddGroup.isOpenQuotientMap_mk instance topologicalAddGroup_quotient [IsTopologicalAddGroup M] : IsTopologicalAddGroup (M ⧸ S) := inferInstanceAs <| IsTopologicalAddGroup (M ⧸ S.toAddSubgroup) instance continuousSMul_quotient [TopologicalSpace R] [IsTopologicalAddGroup M] [ContinuousSMul R M] : ContinuousSMul R (M ⧸ S) where continuous_smul := by rw [← (IsOpenQuotientMap.id.prodMap S.isOpenQuotientMap_mkQ).continuous_comp_iff] exact continuous_quot_mk.comp continuous_smul instance t3_quotient_of_isClosed [IsTopologicalAddGroup M] [IsClosed (S : Set M)] : T3Space (M ⧸ S) := letI : IsClosed (S.toAddSubgroup : Set M) := ‹_› QuotientAddGroup.instT3Space S.toAddSubgroup end Submodule end Quotient
.lake/packages/mathlib/Mathlib/Topology/Algebra/Module/FiniteDimension.lean
import Mathlib.Analysis.LocallyConvex.BalancedCoreHull import Mathlib.Analysis.Normed.Module.Basic import Mathlib.LinearAlgebra.FiniteDimensional.Lemmas import Mathlib.RingTheory.LocalRing.Basic import Mathlib.Topology.Algebra.Module.Determinant import Mathlib.Topology.Algebra.Module.ModuleTopology import Mathlib.Topology.Algebra.Module.Simple import Mathlib.Topology.Algebra.SeparationQuotient.FiniteDimensional /-! # 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] [IsTopologicalAddGroup 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.lean` 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`. -/ open Filter Module Set TopologicalSpace Topology universe u v w x noncomputable section section FiniteDimensional variable {𝕜 E F : Type*} [AddCommGroup E] [TopologicalSpace E] [AddCommGroup F] [TopologicalSpace F] [IsTopologicalAddGroup F] /-- The space of continuous linear maps between finite-dimensional spaces is finite-dimensional. -/ instance ContinuousLinearMap.instModuleFinite [CommRing 𝕜] [Module 𝕜 E] [Module.Finite 𝕜 E] [Module 𝕜 F] [IsNoetherian 𝕜 F] [ContinuousConstSMul 𝕜 F] : Module.Finite 𝕜 (E →L[𝕜] F) := .of_injective (ContinuousLinearMap.coeLM 𝕜 : (E →L[𝕜] F) →ₗ[𝕜] E →ₗ[𝕜] F) ContinuousLinearMap.coe_injective /-- The space of continuous linear maps between finite-dimensional spaces is finite-dimensional. This theorem is here to match searches looking for `FiniteDimensional` instead of `Module.Finite`. We use a strictly more general `ContinuousLinearMap.instModuleFinite` as an instance. -/ protected theorem ContinuousLinearMap.finiteDimensional [Field 𝕜] [Module 𝕜 E] [FiniteDimensional 𝕜 E] [Module 𝕜 F] [FiniteDimensional 𝕜 F] [ContinuousConstSMul 𝕜 F] : FiniteDimensional 𝕜 (E →L[𝕜] F) := inferInstance end FiniteDimensional section NormedField variable {𝕜 : Type u} [hnorm : NontriviallyNormedField 𝕜] {E : Type v} [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] [IsTopologicalAddGroup E] [ContinuousSMul 𝕜 E] {F : Type w} [AddCommGroup F] [Module 𝕜 F] [TopologicalSpace F] [IsTopologicalAddGroup F] [ContinuousSMul 𝕜 F] {F' : Type x} [AddCommGroup F'] [Module 𝕜 F'] [TopologicalSpace F'] [IsTopologicalAddGroup 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₁ : @IsTopologicalAddGroup 𝕜 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 IsTopologicalAddGroup.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. 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 notMem_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), one_mul] 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 𝕜 ▸ (LinearMap.range l).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.toMulActionHom) ?_ rw [t2Space_iff] 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. simp_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 := IsTopologicalAddGroup.rightUniformSpace E letI : IsUniformAddGroup E := isUniformAddGroup_of_addCommGroup suffices ∀ n, Fintype.card ι = n → Continuous ξ.equivFun by exact this _ rfl intro n hn induction n generalizing ι E with | zero => rw [Fintype.card_eq_zero_iff] at hn exact continuous_of_const fun x y => funext hn.elim | succ n IH => haveI : FiniteDimensional 𝕜 E := ξ.finiteDimensional_of_finite -- 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 : IsUniformAddGroup s := s.toAddSubgroup.isUniformAddGroup let b := Basis.ofVectorSpace 𝕜 s have U : IsUniformEmbedding 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.isUniformEmbedding b.equivFun.symm.toLinearMap.continuous_on_pi this have : IsComplete (s : Set E) := completeSpace_coe_iff_isComplete.1 ((completeSpace_congr U).1 inferInstance) 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 𝕜 ▸ (LinearMap.range f).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) /-- A finite-dimensional t2 vector space over a complete field must carry the module topology. Not declared as a global instance only for performance reasons. -/ @[local instance] lemma isModuleTopologyOfFiniteDimensional [T2Space E] [FiniteDimensional 𝕜 E] : IsModuleTopology 𝕜 E := -- for the proof, go to a model vector space `b → 𝕜` thanks to `continuous_equivFun_basis`, and -- use that it has the module topology let b := Basis.ofVectorSpace 𝕜 E have continuousEquiv : E ≃L[𝕜] (Basis.ofVectorSpaceIndex 𝕜 E) → 𝕜 := { __ := b.equivFun continuous_toFun := continuous_equivFun_basis_aux b continuous_invFun := IsModuleTopology.continuous_of_linearMap (R := 𝕜) (A := (Basis.ofVectorSpaceIndex 𝕜 E) → 𝕜) (B := E) b.equivFun.symm } IsModuleTopology.iso continuousEquiv.symm /-- 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 := IsModuleTopology.continuous_of_linearMap f 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 := ξ.finiteDimensional_of_finite ξ.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 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 := IsModuleTopology.isOpenMap_of_surjective hf instance canLiftContinuousLinearMap : CanLift (E →ₗ[𝕜] F) (E →L[𝕜] F) (↑) fun _ => True := ⟨fun f _ => ⟨LinearMap.toContinuousLinearMap f, rfl⟩⟩ lemma toContinuousLinearMap_eq_iff_eq_toLinearMap (f : E →ₗ[𝕜] E) (g : E →L[𝕜] E) : f.toContinuousLinearMap = g ↔ f = g.toLinearMap := by simp [ContinuousLinearMap.ext_iff, LinearMap.ext_iff] lemma _root_.ContinuousLinearMap.toLinearMap_eq_iff_eq_toContinuousLinearMap (g : E →L[𝕜] E) (f : E →ₗ[𝕜] E) : g.toLinearMap = f ↔ g = f.toContinuousLinearMap := by simp [ContinuousLinearMap.ext_iff, LinearMap.ext_iff] 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 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 Module.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 := v.finiteDimensional_of_finite LinearMap.toContinuousLinearMap (v.constr 𝕜 f) @[simp] 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 := v.finiteDimensional_of_finite 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 Module.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 IsUniformAddGroup variable (𝕜 E : Type*) [NontriviallyNormedField 𝕜] [CompleteSpace 𝕜] [AddCommGroup E] [UniformSpace E] [T2Space E] [IsUniformAddGroup E] [Module 𝕜 E] [ContinuousSMul 𝕜 E] include 𝕜 in theorem FiniteDimensional.complete [FiniteDimensional 𝕜 E] : CompleteSpace E := by set e := ContinuousLinearEquiv.ofFinrankEq (@finrank_fin_fun 𝕜 _ _ (finrank 𝕜 E)).symm have : IsUniformEmbedding e.toEquiv.symm := e.symm.isUniformEmbedding exact (completeSpace_congr this).1 inferInstance variable {𝕜 E} /-- A finite-dimensional subspace is complete. -/ theorem Submodule.complete_of_finiteDimensional (s : Submodule 𝕜 E) [FiniteDimensional 𝕜 s] : IsComplete (s : Set E) := haveI : IsUniformAddGroup s := s.toAddSubgroup.isUniformAddGroup completeSpace_coe_iff_isComplete.1 (FiniteDimensional.complete 𝕜 s) end IsUniformAddGroup variable {𝕜 E F : Type*} [NontriviallyNormedField 𝕜] [CompleteSpace 𝕜] [AddCommGroup E] [TopologicalSpace E] [IsTopologicalAddGroup E] [Module 𝕜 E] [ContinuousSMul 𝕜 E] [AddCommGroup F] [TopologicalSpace F] [T2Space F] [IsTopologicalAddGroup F] [Module 𝕜 F] [ContinuousSMul 𝕜 F] /-- A finite-dimensional subspace is closed. -/ theorem Submodule.closed_of_finiteDimensional [T2Space E] (s : Submodule 𝕜 E) [FiniteDimensional 𝕜 s] : IsClosed (s : Set E) := letI := IsTopologicalAddGroup.rightUniformSpace E haveI : IsUniformAddGroup E := isUniformAddGroup_of_addCommGroup s.complete_of_finiteDimensional.isClosed /-- An injective linear map with finite-dimensional domain is a closed embedding. -/ theorem LinearMap.isClosedEmbedding_of_injective [T2Space E] [FiniteDimensional 𝕜 E] {f : E →ₗ[𝕜] F} (hf : LinearMap.ker f = ⊥) : IsClosedEmbedding f := let g := LinearEquiv.ofInjective f (LinearMap.ker_eq_bot.mp hf) { IsEmbedding.subtypeVal.comp g.toContinuousLinearEquiv.toHomeomorph.isEmbedding with isClosed_range := by haveI := f.finiteDimensional_range simpa [LinearMap.coe_range f] using (LinearMap.range f).closed_of_finiteDimensional } theorem isClosedEmbedding_smul_left [T2Space E] {c : E} (hc : c ≠ 0) : IsClosedEmbedding fun x : 𝕜 => x • c := LinearMap.isClosedEmbedding_of_injective (LinearMap.ker_toSpanSingleton 𝕜 E hc) -- `smul` is a closed map in the first argument. theorem isClosedMap_smul_left [T2Space E] (c : E) : IsClosedMap fun x : 𝕜 => x • c := by by_cases hc : c = 0 · simp_rw [hc, smul_zero] exact isClosedMap_const · exact (isClosedEmbedding_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⟩ /-- If `K` is a complete field and `V` is a finite-dimensional vector space over `K` (equipped with any topology so that `V` is a topological `K`-module, meaning `[IsTopologicalAddGroup V]` and `[ContinuousSMul K V]`), and `K` is locally compact, then `V` is locally compact. This is not an instance because `K` cannot be inferred. -/ theorem LocallyCompactSpace.of_finiteDimensional_of_complete (K V : Type*) [NontriviallyNormedField K] [CompleteSpace K] [LocallyCompactSpace K] [AddCommGroup V] [TopologicalSpace V] [IsTopologicalAddGroup V] [Module K V] [ContinuousSMul K V] [FiniteDimensional K V] : LocallyCompactSpace V := -- Reduce to `SeparationQuotient V`, which is a `T2Space`. suffices LocallyCompactSpace (SeparationQuotient V) from SeparationQuotient.isInducing_mk.locallyCompactSpace <| SeparationQuotient.range_mk (X := V) ▸ isClosed_univ.isLocallyClosed let ⟨_, ⟨b⟩⟩ := Basis.exists_basis K (SeparationQuotient V) have := FiniteDimensional.fintypeBasisIndex b b.equivFun.toContinuousLinearEquiv.toHomeomorph.isOpenEmbedding.locallyCompactSpace
.lake/packages/mathlib/Mathlib/Topology/Algebra/Module/UniformConvergence.lean
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.lean`, 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 Topology open scoped Pointwise UniformConvergence Uniformity section Module variable (𝕜 α E H : Type*) {hom : Type*} [NormedField 𝕜] [AddCommGroup H] [Module 𝕜 H] [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace H] [UniformSpace E] [IsUniformAddGroup 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φ : IsInducing (ofFun ∘ φ)) (h : ∀ u : H, Bornology.IsVonNBounded 𝕜 (Set.range (φ u))) : ContinuousSMul 𝕜 H := by have : IsTopologicalAddGroup H := let ofFun' : (α → E) →+ (α →ᵤ E) := AddMonoidHom.id _ IsInducing.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`. -/ lemma UniformOnFun.continuousSMul_induced_of_image_bounded (φ : hom) (hφ : IsInducing (ofFun 𝔖 ∘ φ)) (h : ∀ u : H, ∀ s ∈ 𝔖, Bornology.IsVonNBounded 𝕜 ((φ u : α → E) '' s)) : ContinuousSMul 𝕜 H := by obtain rfl := hφ.eq_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) IsInducing.subtypeVal fun ⟨u, hu⟩ => h u hu end Module
.lake/packages/mathlib/Mathlib/Topology/Algebra/Module/Cardinality.lean
import Mathlib.Algebra.Module.Card import Mathlib.Analysis.SpecificLimits.Normed import Mathlib.SetTheory.Cardinal.Continuum import Mathlib.SetTheory.Cardinal.CountableCover import Mathlib.LinearAlgebra.Basis.VectorSpace 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 [add_ne_left] 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 𝕜] [Zero E] [MulActionWithZero 𝕜 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_of_one_lt₀ 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 𝕜] [AddGroup E] [MulActionWithZero 𝕜 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 𝕜] [AddGroup E] [MulActionWithZero 𝕜 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 (notMem_singleton_empty.1 H) _ ≤ #s := mk_le_mk_of_subset interior_subset _ ≤ ℵ₀ := le_aleph0 hs
.lake/packages/mathlib/Mathlib/Topology/Algebra/Module/LinearMapPiProd.lean
import Mathlib.Topology.Algebra.Module.LinearMap /-! # Continuous linear maps on products and Pi types -/ assert_not_exists TrivialStar open LinearMap (ker range) open Topology Filter Pointwise universe u v w u' namespace ContinuousLinearMap section Semiring /-! ### Properties that hold for non-necessarily commutative semirings. -/ variable {R : Type*} [Semiring R] {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₃] {M₄ : Type*} [TopologicalSpace M₄] [AddCommMonoid M₄] [Module R M₄] /-- The Cartesian product of two bounded linear maps, as a bounded linear map. -/ protected def prod (f₁ : M₁ →L[R] M₂) (f₂ : M₁ →L[R] M₃) : M₁ →L[R] M₂ × M₃ := ⟨(f₁ : M₁ →ₗ[R] M₂).prod f₂, f₁.2.prodMk f₂.2⟩ @[simp, norm_cast] theorem coe_prod (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 (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 : M₁ →L[R] M₁ × M₂ := (ContinuousLinearMap.id R M₁).prod 0 /-- The right injection into a product is a continuous linear map. -/ def inr : M₂ →L[R] M₁ × M₂ := (0 : M₂ →L[R] M₁).prod (.id R M₂) end @[simp] theorem inl_apply (x : M₁) : inl R M₁ M₂ x = (x, 0) := rfl @[simp] theorem inr_apply (x : M₂) : inr R M₁ M₂ x = (0, x) := rfl @[simp, norm_cast] theorem coe_inl : (inl R M₁ M₂ : M₁ →ₗ[R] M₁ × M₂) = LinearMap.inl R M₁ M₂ := rfl @[simp, norm_cast] theorem coe_inr : (inr R M₁ M₂ : M₂ →ₗ[R] M₁ × M₂) = LinearMap.inr R M₁ M₂ := rfl lemma comp_inl_add_comp_inr (L : M₁ × M₂ →L[R] M₃) (v : M₁ × M₂) : L.comp (.inl R M₁ M₂) v.1 + L.comp (.inr R M₁ M₂) v.2 = L v := by simp [← map_add] @[simp] theorem ker_prod (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₃) variable (R M₁ M₂) /-- `Prod.fst` as a `ContinuousLinearMap`. -/ def fst : M₁ × M₂ →L[R] M₁ where cont := continuous_fst toLinearMap := LinearMap.fst R M₁ M₂ /-- `Prod.snd` as a `ContinuousLinearMap`. -/ def snd : 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 : ↑(fst R M₁ M₂) = LinearMap.fst R M₁ M₂ := rfl @[simp, norm_cast] theorem coe_fst' : ⇑(fst R M₁ M₂) = Prod.fst := rfl @[simp, norm_cast] theorem coe_snd : ↑(snd R M₁ M₂) = LinearMap.snd R M₁ M₂ := rfl @[simp, norm_cast] theorem coe_snd' : ⇑(snd R M₁ M₂) = Prod.snd := rfl @[simp] theorem fst_prod_snd : (fst R M₁ M₂).prod (snd R M₁ M₂) = .id R (M₁ × M₂) := ext fun ⟨_x, _y⟩ => rfl @[simp] theorem fst_comp_prod (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 (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 (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 (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' (f₁ : M₁ →L[R] M₂) (f₂ : M₃ →L[R] M₄) : ⇑(f₁.prodMap f₂) = Prod.map f₁ f₂ := rfl 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, 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 @[simp] theorem proj_pi (f : ∀ i, M₂ →L[R] φ i) (i : ι) : (proj i).comp (pi f) = f i := rfl @[simp] theorem coe_proj (i : ι) : (proj i).toLinearMap = (LinearMap.proj i : ((i : ι) → φ i) →ₗ[R] _) := rfl @[simp] theorem pi_proj : pi proj = .id R (∀ i, φ i) := rfl @[simp] theorem pi_proj_comp (f : M₂ →L[R] ∀ i, φ i) : pi (proj · ∘L f) = f := 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 fun_prop @[simp] lemma _root_.Pi.compRightL_apply {α : Type*} (f : α → ι) (v : (i : ι) → φ i) (i : α) : Pi.compRightL R φ f v i = v (f i) := rfl /-- `Pi.single` as a bundled continuous linear map. -/ @[simps! -fullyApplied] def single [DecidableEq ι] (i : ι) : φ i →L[R] (∀ i, φ i) where toLinearMap := .single R φ i cont := continuous_single _ lemma sum_comp_single [Fintype ι] [DecidableEq ι] (L : (Π i, φ i) →L[R] M) (v : Π i, φ i) : ∑ i, L.comp (.single R φ i) (v i) = L v := by simp [← map_sum, LinearMap.sum_single_apply] end Pi section Ring variable {R : Type*} [Ring R] {M : Type*} [TopologicalSpace M] [AddCommGroup M] [Module R M] {M₂ : Type*} [TopologicalSpace M₂] [AddCommGroup M₂] [Module R M₂] {M₃ : Type*} [TopologicalSpace M₃] [AddCommGroup 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 (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 end Ring section SMul variable {R : Type*} [Semiring R] {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₃] /-- `ContinuousLinearMap.prod` as an `Equiv`. -/ @[simps apply] def prodEquiv : (M →L[R] M₂) × (M →L[R] M₃) ≃ (M →L[R] M₂ × M₃) where toFun f := f.1.prod f.2 invFun f := ⟨(fst _ _ _).comp f, (snd _ _ _).comp f⟩ theorem prod_ext_iff {f g : M × M₂ →L[R] M₃} : 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 × M₂ →L[R] M₃} (hl : f.comp (inl _ _ _) = g.comp (inl _ _ _)) (hr : f.comp (inr _ _ _) = g.comp (inr _ _ _)) : f = g := prod_ext_iff.2 ⟨hl, hr⟩ variable (S : Type*) [Semiring S] [Module S M₂] [ContinuousAdd M₂] [SMulCommClass R S M₂] [ContinuousConstSMul S M₂] [Module S M₃] [ContinuousAdd M₃] [SMulCommClass R S M₃] [ContinuousConstSMul S M₃] /-- `ContinuousLinearMap.prod` as a `LinearEquiv`. See `ContinuousLinearMap.prodL` for the `ContinuousLinearEquiv` version. -/ @[simps apply] def prodₗ : ((M →L[R] M₂) × (M →L[R] M₃)) ≃ₗ[S] M →L[R] M₂ × M₃ := { prodEquiv with map_add' := fun _f _g => rfl map_smul' := fun _c _f => rfl } end SMul section coprod variable {R S M N M₁ M₂ : Type*} [Semiring R] [TopologicalSpace M] [TopologicalSpace N] [TopologicalSpace M₁] [TopologicalSpace M₂] section AddCommMonoid variable [AddCommMonoid M] [Module R M] [ContinuousAdd M] [AddCommMonoid N] [Module R N] [ContinuousAdd N] [AddCommMonoid M₁] [Module R M₁] [AddCommMonoid M₂] [Module R M₂] /-- The continuous linear map given by `(x, y) ↦ f₁ x + f₂ y`. -/ @[simps! coe apply] def coprod (f₁ : M₁ →L[R] M) (f₂ : M₂ →L[R] M) : M₁ × M₂ →L[R] M := ⟨.coprod f₁ f₂, (f₁.cont.comp continuous_fst).add (f₂.cont.comp continuous_snd)⟩ @[simp] lemma coprod_add (f₁ g₁ : M₁ →L[R] M) (f₂ g₂ : M₂ →L[R] M) : (f₁ + g₁).coprod (f₂ + g₂) = f₁.coprod f₂ + g₁.coprod g₂ := by ext <;> simp lemma range_coprod (f₁ : M₁ →L[R] M) (f₂ : M₂ →L[R] M) : range (f₁.coprod f₂) = range f₁ ⊔ range f₂ := LinearMap.range_coprod .. lemma comp_fst_add_comp_snd (f₁ : M₁ →L[R] M) (f₂ : M₂ →L[R] M) : f₁.comp (.fst _ _ _) + f₂.comp (.snd _ _ _) = f₁.coprod f₂ := rfl lemma comp_coprod (f : M →L[R] N) (g₁ : M₁ →L[R] M) (g₂ : M₂ →L[R] M) : f.comp (g₁.coprod g₂) = (f.comp g₁).coprod (f.comp g₂) := coe_injective <| LinearMap.comp_coprod .. @[simp] lemma coprod_comp_inl (f₁ : M₁ →L[R] M) (f₂ : M₂ →L[R] M) : (f₁.coprod f₂).comp (.inl _ _ _) = f₁ := coe_injective <| LinearMap.coprod_inl .. @[simp] lemma coprod_comp_inr (f₁ : M₁ →L[R] M) (f₂ : M₂ →L[R] M) : (f₁.coprod f₂).comp (.inr _ _ _) = f₂ := coe_injective <| LinearMap.coprod_inr .. @[simp] lemma coprod_inl_inr : ContinuousLinearMap.coprod (.inl R M N) (.inr R M N) = .id R (M × N) := coe_injective <| LinearMap.coprod_inl_inr /-- Taking the product of two maps with the same codomain is equivalent to taking the product of their domains. See note [bundled maps over different rings] for why separate `R` and `S` semirings are used. See `ContinuousLinearMap.coprodEquivL` for the `ContinuousLinearEquiv` version. -/ @[simps] def coprodEquiv [ContinuousAdd M₁] [ContinuousAdd M₂] [Semiring S] [Module S M] [ContinuousConstSMul S M] [SMulCommClass R S M] : ((M₁ →L[R] M) × (M₂ →L[R] M)) ≃ₗ[S] M₁ × M₂ →L[R] M where toFun f := f.1.coprod f.2 invFun f := (f.comp (.inl ..), f.comp (.inr ..)) left_inv f := by simp right_inv f := by simp [← comp_coprod f (.inl R M₁ M₂)] map_add' a b := coprod_add .. map_smul' r a := by dsimp ext <;> simp [smul_apply] end AddCommMonoid section AddCommGroup variable [AddCommGroup M] [Module R M] [ContinuousAdd M] [AddCommMonoid M₁] [Module R M₁] [AddCommGroup M₂] [Module R M₂] lemma ker_coprod_of_disjoint_range {f₁ : M₁ →L[R] M} {f₂ : M₂ →L[R] M} (hf : Disjoint (range f₁) (range f₂)) : LinearMap.ker (f₁.coprod f₂) = (LinearMap.ker f₁).prod (LinearMap.ker f₂) := LinearMap.ker_coprod_of_disjoint_range f₁.toLinearMap f₂.toLinearMap hf end AddCommGroup end coprod end ContinuousLinearMap
.lake/packages/mathlib/Mathlib/Topology/Algebra/Module/Simple.lean
import Mathlib.RingTheory.SimpleModule.Basic 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 (LinearMap.ker l).isClosed_or_dense_of_isCoatom (LinearMap.isCoatom_ker_of_surjective hl) · rw [LinearMap.ker_zero] left exact isClosed_univ
.lake/packages/mathlib/Mathlib/Topology/Algebra/Module/StrongTopology.lean
import Mathlib.Topology.Algebra.Module.Equiv import Mathlib.Topology.Algebra.Module.UniformConvergence import Mathlib.Topology.Algebra.SeparationQuotient.Section import Mathlib.Topology.Hom.ContinuousEvalConst /-! # 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. * `CompactConvergenceCLM` is an abbreviation for `UniformConvergenceCLM σ F {(S : Set E) | IsCompact S}` with notation `E →SL_c[σ] F`, denoting the topology of compact convergence on continuous linear maps. ## Main statements * `UniformConvergenceCLM.instIsTopologicalAddGroup` 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] ## Tags uniform convergence, bounded convergence -/ open Bornology Filter Function Set Topology open scoped UniformConvergence Uniformity section General /-! ### 𝔖-Topologies -/ variable {𝕜₁ 𝕜₂ : Type*} [NormedField 𝕜₁] [NormedField 𝕜₂] (σ : 𝕜₁ →+* 𝕜₂) {E F : Type*} [AddCommGroup E] [Module 𝕜₁ E] [TopologicalSpace E] [AddCommGroup F] [Module 𝕜₂ F] variable (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] (_ : Set (Set E)) := E →SL[σ] F namespace UniformConvergenceCLM instance instFunLike [TopologicalSpace F] (𝔖 : Set (Set E)) : FunLike (UniformConvergenceCLM σ F 𝔖) E F := ContinuousLinearMap.funLike @[ext] theorem ext [TopologicalSpace F] {𝔖 : Set (Set E)} {f g : UniformConvergenceCLM σ F 𝔖} (h : ∀ x, f x = g x) : f = g := DFunLike.ext f g h instance instContinuousSemilinearMapClass [TopologicalSpace F] (𝔖 : Set (Set E)) : ContinuousSemilinearMapClass (UniformConvergenceCLM σ F 𝔖) σ E F := ContinuousLinearMap.continuousSemilinearMapClass instance instTopologicalSpace [TopologicalSpace F] [IsTopologicalAddGroup F] (𝔖 : Set (Set E)) : TopologicalSpace (UniformConvergenceCLM σ F 𝔖) := (@UniformOnFun.topologicalSpace E F (IsTopologicalAddGroup.rightUniformSpace F) 𝔖).induced (DFunLike.coe : (UniformConvergenceCLM σ F 𝔖) → (E →ᵤ[𝔖] F)) theorem topologicalSpace_eq [UniformSpace F] [IsUniformAddGroup F] (𝔖 : Set (Set E)) : instTopologicalSpace σ F 𝔖 = TopologicalSpace.induced (UniformOnFun.ofFun 𝔖 ∘ DFunLike.coe) (UniformOnFun.topologicalSpace E F 𝔖) := by rw [instTopologicalSpace] congr exact IsUniformAddGroup.rightUniformSpace_eq /-- The uniform structure associated with `ContinuousLinearMap.strongTopology`. We make sure that this has nice definitional properties. -/ instance instUniformSpace [UniformSpace F] [IsUniformAddGroup F] (𝔖 : Set (Set E)) : UniformSpace (UniformConvergenceCLM σ F 𝔖) := UniformSpace.replaceTopology ((UniformOnFun.uniformSpace E F 𝔖).comap (UniformOnFun.ofFun 𝔖 ∘ DFunLike.coe)) (by rw [UniformConvergenceCLM.instTopologicalSpace, IsUniformAddGroup.rightUniformSpace_eq]; rfl) theorem uniformSpace_eq [UniformSpace F] [IsUniformAddGroup F] (𝔖 : Set (Set E)) : instUniformSpace σ F 𝔖 = UniformSpace.comap (UniformOnFun.ofFun 𝔖 ∘ DFunLike.coe) (UniformOnFun.uniformSpace E F 𝔖) := by rw [instUniformSpace, UniformSpace.replaceTopology_eq] @[simp] theorem uniformity_toTopologicalSpace_eq [UniformSpace F] [IsUniformAddGroup F] (𝔖 : Set (Set E)) : (UniformConvergenceCLM.instUniformSpace σ F 𝔖).toTopologicalSpace = UniformConvergenceCLM.instTopologicalSpace σ F 𝔖 := rfl theorem isUniformInducing_coeFn [UniformSpace F] [IsUniformAddGroup F] (𝔖 : Set (Set E)) : IsUniformInducing (α := UniformConvergenceCLM σ F 𝔖) (UniformOnFun.ofFun 𝔖 ∘ DFunLike.coe) := ⟨rfl⟩ theorem isUniformEmbedding_coeFn [UniformSpace F] [IsUniformAddGroup F] (𝔖 : Set (Set E)) : IsUniformEmbedding (α := UniformConvergenceCLM σ F 𝔖) (UniformOnFun.ofFun 𝔖 ∘ DFunLike.coe) := ⟨isUniformInducing_coeFn .., DFunLike.coe_injective⟩ theorem isEmbedding_coeFn [UniformSpace F] [IsUniformAddGroup F] (𝔖 : Set (Set E)) : IsEmbedding (X := UniformConvergenceCLM σ F 𝔖) (Y := E →ᵤ[𝔖] F) (UniformOnFun.ofFun 𝔖 ∘ DFunLike.coe) := IsUniformEmbedding.isEmbedding (isUniformEmbedding_coeFn _ _ _) instance instAddCommGroup [TopologicalSpace F] [IsTopologicalAddGroup F] (𝔖 : Set (Set E)) : AddCommGroup (UniformConvergenceCLM σ F 𝔖) := ContinuousLinearMap.addCommGroup @[simp] theorem coe_zero [TopologicalSpace F] [IsTopologicalAddGroup F] (𝔖 : Set (Set E)) : ⇑(0 : UniformConvergenceCLM σ F 𝔖) = 0 := rfl instance instIsUniformAddGroup [UniformSpace F] [IsUniformAddGroup F] (𝔖 : Set (Set E)) : IsUniformAddGroup (UniformConvergenceCLM σ F 𝔖) := by let φ : (UniformConvergenceCLM σ F 𝔖) →+ E →ᵤ[𝔖] F := ⟨⟨(DFunLike.coe : (UniformConvergenceCLM σ F 𝔖) → E →ᵤ[𝔖] F), rfl⟩, fun _ _ => rfl⟩ exact (isUniformEmbedding_coeFn _ _ _).isUniformAddGroup φ instance instIsTopologicalAddGroup [TopologicalSpace F] [IsTopologicalAddGroup F] (𝔖 : Set (Set E)) : IsTopologicalAddGroup (UniformConvergenceCLM σ F 𝔖) := by letI : UniformSpace F := IsTopologicalAddGroup.rightUniformSpace F haveI : IsUniformAddGroup F := isUniformAddGroup_of_addCommGroup infer_instance theorem continuousEvalConst [TopologicalSpace F] [IsTopologicalAddGroup F] (𝔖 : Set (Set E)) (h𝔖 : ⋃₀ 𝔖 = Set.univ) : ContinuousEvalConst (UniformConvergenceCLM σ F 𝔖) E F where continuous_eval_const x := by letI : UniformSpace F := IsTopologicalAddGroup.rightUniformSpace F haveI : IsUniformAddGroup F := isUniformAddGroup_of_addCommGroup exact (UniformOnFun.uniformContinuous_eval h𝔖 x).continuous.comp (isEmbedding_coeFn σ F 𝔖).continuous theorem t2Space [TopologicalSpace F] [IsTopologicalAddGroup F] [T2Space F] (𝔖 : Set (Set E)) (h𝔖 : ⋃₀ 𝔖 = univ) : T2Space (UniformConvergenceCLM σ F 𝔖) := by letI : UniformSpace F := IsTopologicalAddGroup.rightUniformSpace F haveI : IsUniformAddGroup F := isUniformAddGroup_of_addCommGroup haveI : T2Space (E →ᵤ[𝔖] F) := UniformOnFun.t2Space_of_covering h𝔖 exact (isEmbedding_coeFn σ F 𝔖).t2Space instance instDistribMulAction (M : Type*) [Monoid M] [DistribMulAction M F] [SMulCommClass 𝕜₂ M F] [TopologicalSpace F] [IsTopologicalAddGroup 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] [IsTopologicalAddGroup F] (𝔖 : Set (Set E)) : Module R (UniformConvergenceCLM σ F 𝔖) := ContinuousLinearMap.module theorem continuousSMul [RingHomSurjective σ] [RingHomIsometric σ] [TopologicalSpace F] [IsTopologicalAddGroup F] [ContinuousSMul 𝕜₂ F] (𝔖 : Set (Set E)) (h𝔖₃ : ∀ S ∈ 𝔖, IsVonNBounded 𝕜₁ S) : ContinuousSMul 𝕜₂ (UniformConvergenceCLM σ F 𝔖) := by letI : UniformSpace F := IsTopologicalAddGroup.rightUniformSpace F haveI : IsUniformAddGroup F := isUniformAddGroup_of_addCommGroup 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] [IsTopologicalAddGroup 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 := IsTopologicalAddGroup.rightUniformSpace F haveI : IsUniformAddGroup F := isUniformAddGroup_of_addCommGroup rw [(isEmbedding_coeFn σ F 𝔖).isInducing.nhds_eq_comap] exact (UniformOnFun.hasBasis_nhds_zero_of_basis 𝔖 h𝔖₁ h𝔖₂ h).comap DFunLike.coe theorem hasBasis_nhds_zero [TopologicalSpace F] [IsTopologicalAddGroup 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 theorem nhds_zero_eq_of_basis [TopologicalSpace F] [IsTopologicalAddGroup F] (𝔖 : Set (Set E)) {ι : Type*} {p : ι → Prop} {b : ι → Set F} (h : (𝓝 0 : Filter F).HasBasis p b) : 𝓝 (0 : UniformConvergenceCLM σ F 𝔖) = ⨅ (s : Set E) (_ : s ∈ 𝔖) (i : ι) (_ : p i), 𝓟 {f : UniformConvergenceCLM σ F 𝔖 | MapsTo f s (b i)} := by letI : UniformSpace F := IsTopologicalAddGroup.rightUniformSpace F haveI : IsUniformAddGroup F := isUniformAddGroup_of_addCommGroup rw [(isEmbedding_coeFn σ F 𝔖).isInducing.nhds_eq_comap, UniformOnFun.nhds_eq_of_basis _ _ h.uniformity_of_nhds_zero] simp [MapsTo] theorem nhds_zero_eq [TopologicalSpace F] [IsTopologicalAddGroup F] (𝔖 : Set (Set E)) : 𝓝 (0 : UniformConvergenceCLM σ F 𝔖) = ⨅ s ∈ 𝔖, ⨅ t ∈ 𝓝 (0 : F), 𝓟 {f : UniformConvergenceCLM σ F 𝔖 | MapsTo f s t} := nhds_zero_eq_of_basis _ _ _ (𝓝 0).basis_sets variable {F} in theorem eventually_nhds_zero_mapsTo [TopologicalSpace F] [IsTopologicalAddGroup F] {𝔖 : Set (Set E)} {s : Set E} (hs : s ∈ 𝔖) {U : Set F} (hu : U ∈ 𝓝 0) : ∀ᶠ f : UniformConvergenceCLM σ F 𝔖 in 𝓝 0, MapsTo f s U := by rw [nhds_zero_eq] apply_rules [mem_iInf_of_mem, mem_principal_self] variable {σ F} in theorem isVonNBounded_image2_apply {R : Type*} [SeminormedRing R] [TopologicalSpace F] [IsTopologicalAddGroup F] [DistribMulAction R F] [ContinuousConstSMul R F] [SMulCommClass 𝕜₂ R F] {𝔖 : Set (Set E)} {S : Set (UniformConvergenceCLM σ F 𝔖)} (hS : IsVonNBounded R S) {s : Set E} (hs : s ∈ 𝔖) : IsVonNBounded R (Set.image2 (fun f x ↦ f x) S s) := by intro U hU filter_upwards [hS (eventually_nhds_zero_mapsTo σ hs hU)] with c hc rw [image2_subset_iff] intro f hf x hx rcases hc hf with ⟨g, hg, rfl⟩ exact smul_mem_smul_set (hg hx) variable {σ F} in /-- A set `S` of continuous linear maps with topology of uniform convergence on sets `s ∈ 𝔖` is von Neumann bounded iff for any `s ∈ 𝔖`, the set `{f x | (f ∈ S) (x ∈ s)}` is von Neumann bounded. -/ theorem isVonNBounded_iff {R : Type*} [NormedDivisionRing R] [TopologicalSpace F] [IsTopologicalAddGroup F] [Module R F] [ContinuousConstSMul R F] [SMulCommClass 𝕜₂ R F] {𝔖 : Set (Set E)} {S : Set (UniformConvergenceCLM σ F 𝔖)} : IsVonNBounded R S ↔ ∀ s ∈ 𝔖, IsVonNBounded R (Set.image2 (fun f x ↦ f x) S s) := by refine ⟨fun hS s hs ↦ isVonNBounded_image2_apply hS hs, fun h ↦ ?_⟩ simp_rw [isVonNBounded_iff_absorbing_le, nhds_zero_eq, le_iInf_iff, le_principal_iff] intro s hs U hU rw [Filter.mem_absorbing, Absorbs] filter_upwards [h s hs hU, eventually_ne_cobounded 0] with c hc hc₀ f hf rw [mem_smul_set_iff_inv_smul_mem₀ hc₀] intro x hx simpa only [mem_smul_set_iff_inv_smul_mem₀ hc₀] using hc (mem_image2_of_mem hf hx) instance instUniformContinuousConstSMul (M : Type*) [Monoid M] [DistribMulAction M F] [SMulCommClass 𝕜₂ M F] [UniformSpace F] [IsUniformAddGroup F] [UniformContinuousConstSMul M F] (𝔖 : Set (Set E)) : UniformContinuousConstSMul M (UniformConvergenceCLM σ F 𝔖) := (isUniformInducing_coeFn σ F 𝔖).uniformContinuousConstSMul fun _ _ ↦ by rfl instance instContinuousConstSMul (M : Type*) [Monoid M] [DistribMulAction M F] [SMulCommClass 𝕜₂ M F] [TopologicalSpace F] [IsTopologicalAddGroup F] [ContinuousConstSMul M F] (𝔖 : Set (Set E)) : ContinuousConstSMul M (UniformConvergenceCLM σ F 𝔖) := let _ := IsTopologicalAddGroup.rightUniformSpace F have _ : IsUniformAddGroup F := isUniformAddGroup_of_addCommGroup have _ := uniformContinuousConstSMul_of_continuousConstSMul M F inferInstance theorem tendsto_iff_tendstoUniformlyOn {ι : Type*} {p : Filter ι} [UniformSpace F] [IsUniformAddGroup F] (𝔖 : Set (Set E)) {a : ι → UniformConvergenceCLM σ F 𝔖} {a₀ : UniformConvergenceCLM σ F 𝔖} : Filter.Tendsto a p (𝓝 a₀) ↔ ∀ s ∈ 𝔖, TendstoUniformlyOn (a · ·) a₀ p s := by rw [(isEmbedding_coeFn σ F 𝔖).tendsto_nhds_iff, UniformOnFun.tendsto_iff_tendstoUniformlyOn] rfl variable {F} in theorem isUniformInducing_postcomp {G : Type*} [AddCommGroup G] [UniformSpace G] [IsUniformAddGroup G] {𝕜₃ : Type*} [NormedField 𝕜₃] [Module 𝕜₃ G] {τ : 𝕜₂ →+* 𝕜₃} {ρ : 𝕜₁ →+* 𝕜₃} [RingHomCompTriple σ τ ρ] [UniformSpace F] [IsUniformAddGroup F] (g : F →SL[τ] G) (hg : IsUniformInducing g) (𝔖 : Set (Set E)) : IsUniformInducing (α := UniformConvergenceCLM σ F 𝔖) (β := UniformConvergenceCLM ρ G 𝔖) g.comp := by rw [← (isUniformInducing_coeFn _ _ _).of_comp_iff] exact (UniformOnFun.postcomp_isUniformInducing hg).comp (isUniformInducing_coeFn _ _ _) theorem completeSpace [UniformSpace F] [IsUniformAddGroup F] [ContinuousSMul 𝕜₂ F] [CompleteSpace F] {𝔖 : Set (Set E)} (h𝔖 : IsCoherentWith 𝔖) (h𝔖U : ⋃₀ 𝔖 = univ) : CompleteSpace (UniformConvergenceCLM σ F 𝔖) := by wlog hF : T2Space F generalizing F · rw [(isUniformInducing_postcomp σ (SeparationQuotient.mkCLM 𝕜₂ F) SeparationQuotient.isUniformInducing_mk _).completeSpace_congr] exacts [this _ inferInstance, SeparationQuotient.postcomp_mkCLM_surjective F σ E] rw [completeSpace_iff_isComplete_range (isUniformInducing_coeFn _ _ _)] apply IsClosed.isComplete have H₁ : IsClosed {f : E →ᵤ[𝔖] F | Continuous ((UniformOnFun.toFun 𝔖) f)} := UniformOnFun.isClosed_setOf_continuous h𝔖 convert H₁.inter <| (LinearMap.isClosed_range_coe E F σ).preimage (UniformOnFun.uniformContinuous_toFun h𝔖U).continuous exact ContinuousLinearMap.range_coeFn_eq variable {𝔖₁ 𝔖₂ : Set (Set E)} theorem uniformSpace_mono [UniformSpace F] [IsUniformAddGroup 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] [IsTopologicalAddGroup F] (h : 𝔖₂ ⊆ 𝔖₁) : instTopologicalSpace σ F 𝔖₁ ≤ instTopologicalSpace σ F 𝔖₂ := by letI := IsTopologicalAddGroup.rightUniformSpace F haveI : IsUniformAddGroup F := isUniformAddGroup_of_addCommGroup 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] [IsTopologicalAddGroup F] : TopologicalSpace (E →SL[σ] F) := UniformConvergenceCLM.instTopologicalSpace σ F { S | IsVonNBounded 𝕜₁ S } instance topologicalAddGroup [TopologicalSpace F] [IsTopologicalAddGroup F] : IsTopologicalAddGroup (E →SL[σ] F) := UniformConvergenceCLM.instIsTopologicalAddGroup σ F _ instance continuousSMul [RingHomSurjective σ] [RingHomIsometric σ] [TopologicalSpace F] [IsTopologicalAddGroup F] [ContinuousSMul 𝕜₂ F] : ContinuousSMul 𝕜₂ (E →SL[σ] F) := UniformConvergenceCLM.continuousSMul σ F { S | IsVonNBounded 𝕜₁ S } fun _ hs => hs instance uniformSpace [UniformSpace F] [IsUniformAddGroup F] : UniformSpace (E →SL[σ] F) := UniformConvergenceCLM.instUniformSpace σ F { S | IsVonNBounded 𝕜₁ S } instance isUniformAddGroup [UniformSpace F] [IsUniformAddGroup F] : IsUniformAddGroup (E →SL[σ] F) := UniformConvergenceCLM.instIsUniformAddGroup σ F _ instance instContinuousEvalConst [TopologicalSpace F] [IsTopologicalAddGroup F] [ContinuousSMul 𝕜₁ E] : ContinuousEvalConst (E →SL[σ] F) E F := UniformConvergenceCLM.continuousEvalConst σ F _ Bornology.sUnion_isVonNBounded_eq_univ instance instT2Space [TopologicalSpace F] [IsTopologicalAddGroup F] [ContinuousSMul 𝕜₁ E] [T2Space F] : T2Space (E →SL[σ] F) := UniformConvergenceCLM.t2Space σ F _ Bornology.sUnion_isVonNBounded_eq_univ protected theorem hasBasis_nhds_zero_of_basis [TopologicalSpace F] [IsTopologicalAddGroup F] {ι : Type*} {p : ι → Prop} {b : ι → Set F} (h : (𝓝 0 : Filter F).HasBasis p b) : (𝓝 (0 : E →SL[σ] F)).HasBasis (fun Si : Set E × ι => 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 | IsVonNBounded 𝕜₁ S } ⟨∅, isVonNBounded_empty 𝕜₁ E⟩ (directedOn_of_sup_mem fun _ _ => IsVonNBounded.union) h protected theorem hasBasis_nhds_zero [TopologicalSpace F] [IsTopologicalAddGroup F] : (𝓝 (0 : E →SL[σ] F)).HasBasis (fun SV : Set E × Set F => 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 theorem isUniformEmbedding_toUniformOnFun [UniformSpace F] [IsUniformAddGroup F] : IsUniformEmbedding fun f : E →SL[σ] F ↦ UniformOnFun.ofFun {s | Bornology.IsVonNBounded 𝕜₁ s} f := UniformConvergenceCLM.isUniformEmbedding_coeFn .. instance uniformContinuousConstSMul {M : Type*} [Monoid M] [DistribMulAction M F] [SMulCommClass 𝕜₂ M F] [UniformSpace F] [IsUniformAddGroup 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] [IsTopologicalAddGroup F] [ContinuousConstSMul M F] : ContinuousConstSMul M (E →SL[σ] F) := UniformConvergenceCLM.instContinuousConstSMul σ F _ _ protected theorem nhds_zero_eq_of_basis [TopologicalSpace F] [IsTopologicalAddGroup F] {ι : Type*} {p : ι → Prop} {b : ι → Set F} (h : (𝓝 0 : Filter F).HasBasis p b) : 𝓝 (0 : E →SL[σ] F) = ⨅ (s : Set E) (_ : IsVonNBounded 𝕜₁ s) (i : ι) (_ : p i), 𝓟 {f : E →SL[σ] F | MapsTo f s (b i)} := UniformConvergenceCLM.nhds_zero_eq_of_basis _ _ _ h protected theorem nhds_zero_eq [TopologicalSpace F] [IsTopologicalAddGroup F] : 𝓝 (0 : E →SL[σ] F) = ⨅ (s : Set E) (_ : IsVonNBounded 𝕜₁ s) (U : Set F) (_ : U ∈ 𝓝 0), 𝓟 {f : E →SL[σ] F | MapsTo f s U} := UniformConvergenceCLM.nhds_zero_eq .. /-- If `s` is a von Neumann bounded set and `U` is a neighbourhood of zero, then sufficiently small continuous linear maps map `s` to `U`. -/ theorem eventually_nhds_zero_mapsTo [TopologicalSpace F] [IsTopologicalAddGroup F] {s : Set E} (hs : IsVonNBounded 𝕜₁ s) {U : Set F} (hu : U ∈ 𝓝 0) : ∀ᶠ f : E →SL[σ] F in 𝓝 0, MapsTo f s U := UniformConvergenceCLM.eventually_nhds_zero_mapsTo _ hs hu /-- If `S` is a von Neumann bounded set of continuous linear maps `f : E →SL[σ] F` and `s` is a von Neumann bounded set in the domain, then the set `{f x | (f ∈ S) (x ∈ s)}` is von Neumann bounded. See also `isVonNBounded_iff` for an `Iff` version with stronger typeclass assumptions. -/ theorem isVonNBounded_image2_apply {R : Type*} [SeminormedRing R] [TopologicalSpace F] [IsTopologicalAddGroup F] [DistribMulAction R F] [ContinuousConstSMul R F] [SMulCommClass 𝕜₂ R F] {S : Set (E →SL[σ] F)} (hS : IsVonNBounded R S) {s : Set E} (hs : IsVonNBounded 𝕜₁ s) : IsVonNBounded R (Set.image2 (fun f x ↦ f x) S s) := UniformConvergenceCLM.isVonNBounded_image2_apply hS hs /-- A set `S` of continuous linear maps is von Neumann bounded iff for any von Neumann bounded set `s`, the set `{f x | (f ∈ S) (x ∈ s)}` is von Neumann bounded. For the forward implication with weaker typeclass assumptions, see `isVonNBounded_image2_apply`. -/ theorem isVonNBounded_iff {R : Type*} [NormedDivisionRing R] [TopologicalSpace F] [IsTopologicalAddGroup F] [Module R F] [ContinuousConstSMul R F] [SMulCommClass 𝕜₂ R F] {S : Set (E →SL[σ] F)} : IsVonNBounded R S ↔ ∀ s, IsVonNBounded 𝕜₁ s → IsVonNBounded R (Set.image2 (fun f x ↦ f x) S s) := UniformConvergenceCLM.isVonNBounded_iff theorem completeSpace [UniformSpace F] [IsUniformAddGroup F] [ContinuousSMul 𝕜₂ F] [CompleteSpace F] [ContinuousSMul 𝕜₁ E] (h : IsCoherentWith {s : Set E | IsVonNBounded 𝕜₁ s}) : CompleteSpace (E →SL[σ] F) := UniformConvergenceCLM.completeSpace _ _ h sUnion_isVonNBounded_eq_univ instance instCompleteSpace [IsTopologicalAddGroup E] [ContinuousSMul 𝕜₁ E] [SequentialSpace E] [UniformSpace F] [IsUniformAddGroup F] [ContinuousSMul 𝕜₂ F] [CompleteSpace F] : CompleteSpace (E →SL[σ] F) := completeSpace <| .of_seq fun _ _ h ↦ (h.isVonNBounded_range 𝕜₁).insert _ 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 [IsTopologicalAddGroup 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 := IsTopologicalAddGroup.rightUniformSpace G haveI : IsUniformAddGroup G := isUniformAddGroup_of_addCommGroup rw [(UniformConvergenceCLM.isEmbedding_coeFn _ _ _).continuous_iff] apply (UniformOnFun.precomp_uniformContinuous fun S hS => hS.image L).continuous.comp (UniformConvergenceCLM.isEmbedding_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 [IsTopologicalAddGroup F] [IsTopologicalAddGroup 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 := IsTopologicalAddGroup.rightUniformSpace G haveI : IsUniformAddGroup G := isUniformAddGroup_of_addCommGroup letI : UniformSpace F := IsTopologicalAddGroup.rightUniformSpace F haveI : IsUniformAddGroup F := isUniformAddGroup_of_addCommGroup rw [(UniformConvergenceCLM.isEmbedding_coeFn _ _ _).continuous_iff] exact (UniformOnFun.postcomp_uniformContinuous L.uniformContinuous).continuous.comp (UniformConvergenceCLM.isEmbedding_coeFn _ _ _).continuous end BoundedSets section BilinearMaps variable {𝕜 𝕜₂ 𝕜₃ : Type*} [NormedField 𝕜] [NormedField 𝕜₂] [NormedField 𝕜₃] {E F G : Type*} [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] [AddCommGroup F] [Module 𝕜₂ F] [TopologicalSpace F] [AddCommGroup G] [Module 𝕜₃ G] [TopologicalSpace G] [IsTopologicalAddGroup G] [ContinuousConstSMul 𝕜₃ G] {σ₁₃ : 𝕜 →+* 𝕜₃} {σ₂₃ : 𝕜₂ →+* 𝕜₃} /-- Send a continuous sesquilinear map to an abstract sesquilinear map (forgetting continuity). -/ def toLinearMap₁₂ (L : E →SL[σ₁₃] F →SL[σ₂₃] G) : E →ₛₗ[σ₁₃] F →ₛₗ[σ₂₃] G := (coeLMₛₗ σ₂₃).comp L.toLinearMap @[deprecated (since := "2025-07-28")] alias toLinearMap₂ := toLinearMap₁₂ @[simp] lemma toLinearMap₁₂_apply (L : E →SL[σ₁₃] F →SL[σ₂₃] G) (v : E) (w : F) : L.toLinearMap₁₂ v w = L v w := rfl @[deprecated (since := "2025-07-28")] alias toLinearMap₂_apply := toLinearMap₁₂_apply /-- Send a continuous bilinear form to an abstract bilinear form (forgetting continuity). -/ def toBilinForm (L : E →L[𝕜] E →L[𝕜] 𝕜) : LinearMap.BilinForm 𝕜 E := L.toLinearMap₁₂ @[simp] lemma toBilinForm_apply (L : E →L[𝕜] E →L[𝕜] 𝕜) (v : E) (w : E) : L.toBilinForm v w = L v w := rfl end BilinearMaps section RestrictScalars variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [AddCommGroup E] [TopologicalSpace E] [Module 𝕜 E] [ContinuousSMul 𝕜 E] {F : Type*} [AddCommGroup F] section UniformSpace variable [UniformSpace F] [IsUniformAddGroup F] [Module 𝕜 F] (𝕜' : Type*) [NontriviallyNormedField 𝕜'] [NormedAlgebra 𝕜' 𝕜] [Module 𝕜' E] [IsScalarTower 𝕜' 𝕜 E] [Module 𝕜' F] [IsScalarTower 𝕜' 𝕜 F] theorem isUniformEmbedding_restrictScalars : IsUniformEmbedding (restrictScalars 𝕜' : (E →L[𝕜] F) → (E →L[𝕜'] F)) := by rw [← isUniformEmbedding_toUniformOnFun.of_comp_iff] convert isUniformEmbedding_toUniformOnFun using 4 with s exact ⟨fun h ↦ h.extend_scalars _, fun h ↦ h.restrict_scalars _⟩ theorem uniformContinuous_restrictScalars : UniformContinuous (restrictScalars 𝕜' : (E →L[𝕜] F) → (E →L[𝕜'] F)) := (isUniformEmbedding_restrictScalars 𝕜').uniformContinuous end UniformSpace variable [TopologicalSpace F] [IsTopologicalAddGroup F] [Module 𝕜 F] (𝕜' : Type*) [NontriviallyNormedField 𝕜'] [NormedAlgebra 𝕜' 𝕜] [Module 𝕜' E] [IsScalarTower 𝕜' 𝕜 E] [Module 𝕜' F] [IsScalarTower 𝕜' 𝕜 F] theorem isEmbedding_restrictScalars : IsEmbedding (restrictScalars 𝕜' : (E →L[𝕜] F) → (E →L[𝕜'] F)) := letI : UniformSpace F := IsTopologicalAddGroup.rightUniformSpace F haveI : IsUniformAddGroup F := isUniformAddGroup_of_addCommGroup (isUniformEmbedding_restrictScalars _).isEmbedding @[continuity, fun_prop] theorem continuous_restrictScalars : Continuous (restrictScalars 𝕜' : (E →L[𝕜] F) → (E →L[𝕜'] F)) := (isEmbedding_restrictScalars _).continuous variable (𝕜 E F) variable (𝕜'' : Type*) [Ring 𝕜''] [Module 𝕜'' F] [ContinuousConstSMul 𝕜'' F] [SMulCommClass 𝕜 𝕜'' F] [SMulCommClass 𝕜' 𝕜'' F] /-- `ContinuousLinearMap.restrictScalars` as a `ContinuousLinearMap`. -/ def restrictScalarsL : (E →L[𝕜] F) →L[𝕜''] E →L[𝕜'] F := .mk <| restrictScalarsₗ 𝕜 E F 𝕜' 𝕜'' variable {𝕜 E F 𝕜' 𝕜''} @[simp] theorem coe_restrictScalarsL : (restrictScalarsL 𝕜 E F 𝕜' 𝕜'' : (E →L[𝕜] F) →ₗ[𝕜''] E →L[𝕜'] F) = restrictScalarsₗ 𝕜 E F 𝕜' 𝕜'' := rfl @[simp] theorem coe_restrict_scalarsL' : ⇑(restrictScalarsL 𝕜 E F 𝕜' 𝕜'') = restrictScalars 𝕜' := rfl end RestrictScalars section Prod variable {𝕜 E F G : Type*} (S : Type*) [NormedField 𝕜] [Semiring S] [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] [IsTopologicalAddGroup E] [ContinuousConstSMul 𝕜 E] [AddCommGroup F] [Module 𝕜 F] [TopologicalSpace F] [IsTopologicalAddGroup F] [ContinuousConstSMul 𝕜 F] [AddCommGroup G] [Module 𝕜 G] [TopologicalSpace G] [IsTopologicalAddGroup G] [ContinuousConstSMul 𝕜 G] [Module S G] [SMulCommClass 𝕜 S G] [ContinuousConstSMul S G] /-- `ContinuousLinearMap.coprod` as a `ContinuousLinearEquiv`. -/ @[simps!] def coprodEquivL : ((E →L[𝕜] G) × (F →L[𝕜] G)) ≃L[S] (E × F →L[𝕜] G) where __ := coprodEquiv continuous_toFun := (((fst 𝕜 E F).precomp G).coprod ((snd 𝕜 E F).precomp G)).continuous continuous_invFun := (((inl 𝕜 E F).precomp G).prod ((inr 𝕜 E F).precomp G)).continuous variable [Module S F] [SMulCommClass 𝕜 S F] [ContinuousConstSMul S F] /-- `ContinuousLinearMap.prod` as a `ContinuousLinearEquiv`. -/ @[simps! apply] def prodL : ((E →L[𝕜] F) × (E →L[𝕜] G)) ≃L[S] (E →L[𝕜] F × G) where __ := prodₗ S continuous_toFun := by change Continuous fun x => .id 𝕜 _ ∘L prodₗ S x simp_rw [← coprod_inl_inr] exact (((inl 𝕜 F G).postcomp E).coprod ((inr 𝕜 F G).postcomp E)).continuous continuous_invFun := (((fst 𝕜 F G).postcomp E).prod ((snd 𝕜 F G).postcomp E)).continuous end Prod 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] [NormedField 𝕜] [NormedField 𝕜₂] [NormedField 𝕜₃] [NormedField 𝕜₄] [Module 𝕜 E] [Module 𝕜₂ F] [Module 𝕜₃ G] [Module 𝕜₄ H] [TopologicalSpace E] [TopologicalSpace F] [TopologicalSpace G] [TopologicalSpace H] [IsTopologicalAddGroup G] [IsTopologicalAddGroup 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 apply symm_apply toLinearEquiv_apply toLinearEquiv_symm_apply] 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 } end Semilinear section Linear variable {𝕜 : Type*} {E : Type*} {F : Type*} {G : Type*} {H : Type*} [AddCommGroup E] [AddCommGroup F] [AddCommGroup G] [AddCommGroup H] [NormedField 𝕜] [Module 𝕜 E] [Module 𝕜 F] [Module 𝕜 G] [Module 𝕜 H] [TopologicalSpace E] [TopologicalSpace F] [TopologicalSpace G] [TopologicalSpace H] [IsTopologicalAddGroup G] [IsTopologicalAddGroup 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 section CompactSets /-! ### Topology of compact convergence for continuous linear maps -/ variable {𝕜₁ 𝕜₂ : Type*} [NormedField 𝕜₁] [NormedField 𝕜₂] {σ : 𝕜₁ →+* 𝕜₂} {E F : Type*} [AddCommGroup E] [Module 𝕜₁ E] [AddCommGroup F] [Module 𝕜₂ F] variable (E F σ) in /-- The topology of compact convergence on `E →L[𝕜] F`. -/ abbrev CompactConvergenceCLM [TopologicalSpace E] [TopologicalSpace F] := UniformConvergenceCLM σ F {(S : Set E) | IsCompact S} @[inherit_doc] scoped[CompactConvergenceCLM] notation E " →SL_c[" σ "] " F => CompactConvergenceCLM σ E F namespace CompactConvergenceCLM instance continuousSMul [RingHomSurjective σ] [RingHomIsometric σ] [UniformSpace E] [IsUniformAddGroup E] [TopologicalSpace F] [IsTopologicalAddGroup F] [ContinuousSMul 𝕜₁ E] [ContinuousSMul 𝕜₂ F] : ContinuousSMul 𝕜₂ (E →SL_c[σ] F) := UniformConvergenceCLM.continuousSMul σ F { S | IsCompact S } (fun _ hs => hs.totallyBounded.isVonNBounded 𝕜₁) instance instContinuousEvalConst [TopologicalSpace E] [TopologicalSpace F] [IsTopologicalAddGroup F] : ContinuousEvalConst (E →SL_c[σ] F) E F := UniformConvergenceCLM.continuousEvalConst σ F _ sUnion_isCompact_eq_univ instance instT2Space [TopologicalSpace E] [TopologicalSpace F] [IsTopologicalAddGroup F] [T2Space F] : T2Space (E →SL_c[σ] F) := UniformConvergenceCLM.t2Space σ F _ sUnion_isCompact_eq_univ protected theorem hasBasis_nhds_zero_of_basis [TopologicalSpace E] [TopologicalSpace F] [IsTopologicalAddGroup F] {ι : Type*} {p : ι → Prop} {b : ι → Set F} (h : (𝓝 0 : Filter F).HasBasis p b) : (𝓝 (0 : E →SL_c[σ] F)).HasBasis (fun Si : Set E × ι => IsCompact Si.1 ∧ p Si.2) fun Si => { f : E →SL_c[σ] F | ∀ x ∈ Si.1, f x ∈ b Si.2 } := UniformConvergenceCLM.hasBasis_nhds_zero_of_basis σ F { S | IsCompact S } ⟨∅, isCompact_empty⟩ (directedOn_of_sup_mem fun _ _ => IsCompact.union) h protected theorem hasBasis_nhds_zero [TopologicalSpace E] [TopologicalSpace F] [IsTopologicalAddGroup F] : (𝓝 (0 : E →SL_c[σ] F)).HasBasis (fun SV : Set E × Set F => IsCompact SV.1 ∧ SV.2 ∈ (𝓝 0 : Filter F)) fun SV => { f : E →SL_c[σ] F | ∀ x ∈ SV.1, f x ∈ SV.2 } := CompactConvergenceCLM.hasBasis_nhds_zero_of_basis (𝓝 0).basis_sets end CompactConvergenceCLM end CompactSets
.lake/packages/mathlib/Mathlib/Topology/Algebra/Module/LinearMap.lean
import Mathlib.Algebra.Module.LinearMap.DivisionRing import Mathlib.LinearAlgebra.Projection import Mathlib.Topology.Algebra.ContinuousMonoidHom import Mathlib.Topology.Algebra.IsUniformGroup.Defs import Mathlib.Topology.Algebra.Module.Basic /-! # Continuous linear maps 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₂`. -/ assert_not_exists TrivialStar open LinearMap (ker range) open Topology Filter Pointwise universe u v w u' /-- 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₂] : Prop extends SemilinearMapClass F σ M M₂, ContinuousMapClass F M M₂ /-- `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₂ /-- The *strong dual* of a topological vector space `M` over a ring `R`. This is the space of continuous linear functionals and is equipped with the topology of uniform convergence on bounded subsets. `StrongDual R M` is an abbreviation for `M →L[R] R`. -/ abbrev StrongDual (R : Type*) [Semiring R] [TopologicalSpace R] (M : Type*) [TopologicalSpace M] [AddCommMonoid M] [Module R M] : Type _ := M →L[R] R 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' 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₂] [IsUniformAddGroup E₁] [IsUniformAddGroup 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 theorem toContinuousAddMonoidHom_injective : Function.Injective ((↑) : (M₁ →SL[σ₁₂] M₂) → ContinuousAddMonoidHom M₁ M₂) := (DFunLike.coe_injective.of_comp_iff _).1 DFunLike.coe_injective @[simp, norm_cast] theorem toContinuousAddMonoidHom_inj {f g : M₁ →SL[σ₁₂] M₂} : (f : ContinuousAddMonoidHom M₁ M₂) = g ↔ f = g := toContinuousAddMonoidHom_injective.eq_iff /-- 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 (toFun → apply, toLinearMap → coe, as_prefix 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 theorem range_coeFn_eq : Set.range ((⇑) : (M₁ →SL[σ₁₂] M₂) → (M₁ → M₂)) = {f | Continuous f} ∩ Set.range ((⇑) : (M₁ →ₛₗ[σ₁₂] M₂) → (M₁ → M₂)) := by ext f constructor · rintro ⟨f, rfl⟩ exact ⟨f.continuous, f, rfl⟩ · rintro ⟨hfc, f, rfl⟩ exact ⟨⟨f, hfc⟩, rfl⟩ -- 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] protected theorem map_smulₛₗ (f : M₁ →SL[σ₁₂] M₂) (c : R₁) (x : M₁) : f (c • x) = σ₁₂ c • f x := (toLinearMap _).map_smulₛₗ _ _ 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 @[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 @[simp, norm_cast] theorem toContinuousAddMonoidHom_zero : ((0 : M₁ →SL[σ₁₂] M₂) : ContinuousAddMonoidHom M₁ 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. -/ protected 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₁) : ContinuousLinearMap.id R₁ M₁ x = x := rfl @[simp, norm_cast] theorem coe_id : (ContinuousLinearMap.id R₁ M₁ : M₁ →ₗ[R₁] M₁) = LinearMap.id := rfl @[simp, norm_cast] theorem coe_id' : ⇑(ContinuousLinearMap.id R₁ M₁) = id := rfl @[simp, norm_cast] theorem toContinuousAddMonoidHom_id : (ContinuousLinearMap.id R₁ M₁ : ContinuousAddMonoidHom M₁ M₁) = .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 @[simp, norm_cast] theorem toContinuousAddMonoidHom_add (f g : M₁ →SL[σ₁₂] M₂) : ↑(f + g) = (f + g : ContinuousAddMonoidHom M₁ M₂) := rfl instance addCommMonoid : AddCommMonoid (M₁ →SL[σ₁₂] M₂) where zero_add := by intros ext apply_rules [zero_add, add_assoc, add_zero, neg_add_cancel, add_comm] add_zero := by intros ext apply_rules [zero_add, add_assoc, add_zero, neg_add_cancel, add_comm] add_comm := by intros ext apply_rules [zero_add, add_assoc, add_zero, neg_add_cancel, add_comm] add_assoc := by intros ext apply_rules [zero_add, add_assoc, add_zero, neg_add_cancel, 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 @[simp, norm_cast] theorem toContinuousAddMonoidHom_comp (h : M₂ →SL[σ₂₃] M₃) (f : M₁ →SL[σ₁₂] M₂) : (↑(h.comp f) : ContinuousAddMonoidHom M₁ M₃) = (h : ContinuousAddMonoidHom M₂ M₃).comp 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₂) : (ContinuousLinearMap.id R₂ M₂).comp f = f := ext fun _x => rfl section variable {R E F : Type*} [Semiring R] [TopologicalSpace E] [AddCommMonoid E] [Module R E] [TopologicalSpace F] [AddCommMonoid F] [Module R F] /-- `g ∘ f = id` as `ContinuousLinearMap`s implies `g ∘ f = id` as functions. -/ lemma leftInverse_of_comp {f : E →L[R] F} {g : F →L[R] E} (hinv : g.comp f = ContinuousLinearMap.id R E) : Function.LeftInverse g f := by simpa [← Function.rightInverse_iff_comp] using congr(⇑$hinv) /-- `f ∘ g = id` as `ContinuousLinearMap`s implies `f ∘ g = id` as functions. -/ lemma rightInverse_of_comp {f : E →L[R] F} {g : F →L[R] E} (hinv : f.comp g = ContinuousLinearMap.id R F) : Function.RightInverse g f := leftInverse_of_comp hinv end @[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_finset_sum {ι : Type*} {s : Finset ι} [ContinuousAdd M₂] [ContinuousAdd M₃] (g : M₂ →SL[σ₂₃] M₃) (f : ι → M₁ →SL[σ₁₂] M₂) : g.comp (∑ i ∈ s, f i) = ∑ i ∈ s, g.comp (f i) := by ext simp theorem finset_sum_comp {ι : Type*} {s : Finset ι} [ContinuousAdd M₃] (g : ι → M₂ →SL[σ₂₃] M₃) (f : M₁ →SL[σ₁₂] M₂) : (∑ i ∈ s, g i).comp f = ∑ i ∈ s, (g i).comp f := by ext simp only [coe_comp', coe_sum', Function.comp_apply, Finset.sum_apply] 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₁) : (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 variable {F : Type*} 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 (hs := isClosed_eq (map_continuous f) (map_continuous g)) /-- 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] 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 _ 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`. -/ @[simps coe] 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 theorem range_smulRight_apply {R : Type*} [DivisionSemiring R] [Module R M₁] [Module R M₂] [TopologicalSpace R] [ContinuousSMul R M₂] {f : M₁ →L[R] R} (hf : f ≠ 0) (x : M₂) : range (f.smulRight x) = Submodule.span R {x} := LinearMap.range_smulRight_apply (by simpa [coe_inj, ← coe_zero] using hf) x 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 @[simp] theorem toSpanSingleton_apply (x : M₁) (r : R₁) : toSpanSingleton R₁ x r = r • x := rfl theorem toSpanSingleton_one (x : M₁) : toSpanSingleton R₁ x 1 = x := one_smul _ _ theorem toSpanSingleton_add [ContinuousAdd M₁] (x y : M₁) : toSpanSingleton R₁ (x + y) = toSpanSingleton R₁ x + toSpanSingleton R₁ y := coe_inj.mp <| LinearMap.toSpanSingleton_add _ _ theorem toSpanSingleton_smul {α} [Monoid α] [DistribMulAction α M₁] [ContinuousConstSMul α M₁] [SMulCommClass R₁ α M₁] (c : α) (x : M₁) : toSpanSingleton R₁ (c • x) = c • toSpanSingleton R₁ x := coe_inj.mp <| LinearMap.toSpanSingleton_smul _ _ @[deprecated (since := "2025-08-28")] alias toSpanSingleton_smul' := toSpanSingleton_smul theorem one_smulRight_eq_toSpanSingleton (x : M₁) : (1 : R₁ →L[R₁] R₁).smulRight x = toSpanSingleton R₁ x := rfl @[simp] theorem toLinearMap_toSpanSingleton (x : M₁) : (toSpanSingleton R₁ x).toLinearMap = LinearMap.toSpanSingleton R₁ M₁ x := rfl variable {R₁} in theorem comp_toSpanSingleton (f : M₁ →L[R₁] M₂) (x : M₁) : f ∘L toSpanSingleton R₁ x = toSpanSingleton R₁ (f x) := coe_inj.mp <| LinearMap.comp_toSpanSingleton _ _ end ToSpanSingleton end Semiring 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 [IsTopologicalAddGroup 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 @[simp, norm_cast] theorem toContinuousAddMonoidHom_neg (f : M →SL[σ₁₂] M₂) : ↑(-f) = -(f : ContinuousAddMonoidHom M M₂) := 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 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] neg_add_cancel _ := by ext; apply neg_add_cancel 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 @[simp, norm_cast] theorem toContinuousAddMonoidHom_sub (f g : M →SL[σ₁₂] M₂) : ↑(f - g) = (f - g : ContinuousAddMonoidHom M M₂) := rfl end @[simp] theorem comp_neg [RingHomCompTriple σ₁₂ σ₂₃ σ₁₃] [IsTopologicalAddGroup M₂] [IsTopologicalAddGroup M₃] (g : M₂ →SL[σ₂₃] M₃) (f : M →SL[σ₁₂] M₂) : g.comp (-f) = -g.comp f := by ext x simp @[simp] theorem neg_comp [RingHomCompTriple σ₁₂ σ₂₃ σ₁₃] [IsTopologicalAddGroup M₃] (g : M₂ →SL[σ₂₃] M₃) (f : M →SL[σ₁₂] M₂) : (-g).comp f = -g.comp f := by ext simp @[simp] theorem comp_sub [RingHomCompTriple σ₁₂ σ₂₃ σ₁₃] [IsTopologicalAddGroup M₂] [IsTopologicalAddGroup 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 σ₁₂ σ₂₃ σ₁₃] [IsTopologicalAddGroup 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 [IsTopologicalAddGroup 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 [IsTopologicalAddGroup M] (z : ℤ) (m : M) : (↑z : M →L[R] M) m = z • m := rfl theorem smulRight_one_pow [TopologicalSpace R] [IsTopologicalRing R] (c : R) (n : ℕ) : smulRight (1 : R →L[R] R) c ^ n = smulRight (1 : R →L[R] R) (c ^ n) := by induction n with | zero => ext; simp | succ n ihn => 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 [IsTopologicalAddGroup 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 [IsTopologicalAddGroup 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 [IsTopologicalAddGroup 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 [IsTopologicalAddGroup 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.2 <| by simp [h y] end end Ring section DivisionRing 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 : StrongDual R M) (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 fun_prop, by simp, fun a => by simp [hx]⟩ end DivisionRing 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 : M →SL[σ₁₂] M₂) 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₃] /-- 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[R] S`, `c.smulRightₗ` is the linear map from `F` to `E →L[R] 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₃] variable [IsTopologicalAddGroup 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 section Semiring variable {A M₁ M₂ R S : Type*} [Semiring A] [Semiring R] [Semiring S] [AddCommMonoid M₁] [Module A M₁] [Module R M₁] [TopologicalSpace M₁] [AddCommMonoid M₂] [Module A M₂] [Module R M₂] [TopologicalSpace M₂] [LinearMap.CompatibleSMul M₁ M₂ R A] variable (R) in /-- 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⟩ @[simp] 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 toContinuousAddMonoidHom_restrictScalars (f : M₁ →L[A] M₂) : ↑(f.restrictScalars R) = (f : ContinuousAddMonoidHom M₁ M₂) := rfl @[simp] lemma restrictScalars_zero : (0 : M₁ →L[A] M₂).restrictScalars R = 0 := rfl @[simp] lemma restrictScalars_add [ContinuousAdd M₂] (f g : M₁ →L[A] M₂) : (f + g).restrictScalars R = f.restrictScalars R + g.restrictScalars R := rfl variable [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 [ContinuousAdd M₂] variable (A R S M₁ M₂) in /-- `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 @[simp] theorem coe_restrictScalarsₗ : ⇑(restrictScalarsₗ A M₁ M₂ R S) = restrictScalars R := rfl end Semiring section Ring variable {A R S M₁ M₂ : Type*} [Ring A] [Ring R] [Ring S] [AddCommGroup M₁] [Module A M₁] [Module R M₁] [TopologicalSpace M₁] [AddCommGroup M₂] [Module A M₂] [Module R M₂] [TopologicalSpace M₂] [LinearMap.CompatibleSMul M₁ M₂ R A] [IsTopologicalAddGroup M₂] @[simp] lemma restrictScalars_sub (f g : M₁ →L[A] M₂) : (f - g).restrictScalars R = f.restrictScalars R - g.restrictScalars R := rfl @[simp] lemma restrictScalars_neg (f : M₁ →L[A] M₂) : (-f).restrictScalars R = -f.restrictScalars R := rfl end Ring end RestrictScalars end ContinuousLinearMap namespace Submodule variable {R : Type*} [Ring R] {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 [IsTopologicalAddGroup M] [T1Space M] {p : Submodule R M} (h : ClosedComplemented p) : IsClosed (p : Set M) := by rcases h with ⟨f, hf⟩ have : ker (ContinuousLinearMap.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) := ⟨(ContinuousLinearMap.id R M).codRestrict ⊤ fun _x => trivial, fun x => Subtype.ext_iff.2 <| by simp⟩ 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₂] [IsTopologicalAddGroup 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⟩ namespace ContinuousLinearMap @[grind =] theorem isIdempotentElem_toLinearMap_iff {R M : Type*} [Semiring R] [TopologicalSpace M] [AddCommMonoid M] [Module R M] {f : M →L[R] M} : IsIdempotentElem f.toLinearMap ↔ IsIdempotentElem f := by simp only [IsIdempotentElem, Module.End.mul_eq_comp, ← coe_comp, mul_def, coe_inj] alias ⟨_, IsIdempotentElem.toLinearMap⟩ := isIdempotentElem_toLinearMap_iff variable {R M : Type*} [Ring R] [TopologicalSpace M] [AddCommGroup M] [Module R M] open ContinuousLinearMap /-- Idempotent operators are equal iff their range and kernels are. -/ lemma IsIdempotentElem.ext_iff {p q : M →L[R] M} (hp : IsIdempotentElem p) (hq : IsIdempotentElem q) : p = q ↔ range p = range q ∧ ker p = ker q := by simpa using LinearMap.IsIdempotentElem.ext_iff hp.toLinearMap hq.toLinearMap alias ⟨_, IsIdempotentElem.ext⟩ := IsIdempotentElem.ext_iff /-- `range f` is invariant under `T` if and only if `f ∘L T ∘L f = T ∘L f`, for idempotent `f`. -/ lemma IsIdempotentElem.range_mem_invtSubmodule_iff {f T : M →L[R] M} (hf : IsIdempotentElem f) : LinearMap.range f ∈ Module.End.invtSubmodule T ↔ f ∘L T ∘L f = T ∘L f := by simpa [← ContinuousLinearMap.coe_comp] using LinearMap.IsIdempotentElem.range_mem_invtSubmodule_iff (T := T) hf.toLinearMap alias ⟨IsIdempotentElem.conj_eq_of_range_mem_invtSubmodule, IsIdempotentElem.range_mem_invtSubmodule⟩ := IsIdempotentElem.range_mem_invtSubmodule_iff /-- `ker f` is invariant under `T` if and only if `f ∘L T ∘L f = f ∘L T`, for idempotent `f`. -/ lemma IsIdempotentElem.ker_mem_invtSubmodule_iff {f T : M →L[R] M} (hf : IsIdempotentElem f) : LinearMap.ker f ∈ Module.End.invtSubmodule T ↔ f ∘L T ∘L f = f ∘L T := by simpa [← ContinuousLinearMap.coe_comp] using LinearMap.IsIdempotentElem.ker_mem_invtSubmodule_iff (T := T) hf.toLinearMap alias ⟨IsIdempotentElem.conj_eq_of_ker_mem_invtSubmodule, IsIdempotentElem.ker_mem_invtSubmodule⟩ := IsIdempotentElem.ker_mem_invtSubmodule_iff /-- An idempotent operator `f` commutes with `T` if and only if both `range f` and `ker f` are invariant under `T`. -/ lemma IsIdempotentElem.commute_iff {f T : M →L[R] M} (hf : IsIdempotentElem f) : Commute f T ↔ (LinearMap.range f ∈ Module.End.invtSubmodule T ∧ LinearMap.ker f ∈ Module.End.invtSubmodule T) := by simpa [Commute, SemiconjBy, Module.End.mul_eq_comp, ← coe_comp] using LinearMap.IsIdempotentElem.commute_iff (T := T) hf.toLinearMap variable [IsTopologicalAddGroup M] /-- An idempotent operator `f` commutes with an unit operator `T` if and only if `T (range f) = range f` and `T (ker f) = ker f`. -/ theorem IsIdempotentElem.commute_iff_of_isUnit {f T : M →L[R] M} (hT : IsUnit T) (hf : IsIdempotentElem f) : Commute f T ↔ (range f).map T = range f ∧ (ker f).map T = ker f := by have := hT.map ContinuousLinearMap.toLinearMapRingHom lift T to (M →L[R] M)ˣ using hT simpa [Commute, SemiconjBy, Module.End.mul_eq_comp, ← ContinuousLinearMap.coe_comp] using LinearMap.IsIdempotentElem.commute_iff_of_isUnit this hf.toLinearMap theorem IsIdempotentElem.range_eq_ker {p : M →L[R] M} (hp : IsIdempotentElem p) : LinearMap.range p = LinearMap.ker (1 - p) := LinearMap.IsIdempotentElem.range_eq_ker hp.toLinearMap theorem IsIdempotentElem.ker_eq_range {p : M →L[R] M} (hp : IsIdempotentElem p) : LinearMap.ker p = LinearMap.range (1 - p) := LinearMap.IsIdempotentElem.ker_eq_range hp.toLinearMap open ContinuousLinearMap in theorem IsIdempotentElem.isClosed_range [T1Space M] {p : M →L[R] M} (hp : IsIdempotentElem p) : IsClosed (LinearMap.range p : Set M) := hp.range_eq_ker ▸ isClosed_ker (1 - p) end ContinuousLinearMap section topDualPairing variable {𝕜 E : Type*} [CommSemiring 𝕜] [TopologicalSpace 𝕜] [ContinuousAdd 𝕜] [AddCommMonoid E] [Module 𝕜 E] [TopologicalSpace E] [ContinuousConstSMul 𝕜 𝕜] variable (𝕜 E) in /-- The canonical pairing of a vector space and its topological dual. -/ def topDualPairing : (E →L[𝕜] 𝕜) →ₗ[𝕜] E →ₗ[𝕜] 𝕜 := ContinuousLinearMap.coeLM 𝕜 @[deprecated (since := "2025-08-12")] alias NormedSpace.dualPairing := topDualPairing @[deprecated (since := "2025-09-03")] alias strongDualPairing := topDualPairing @[simp] theorem topDualPairing_apply (v : E →L[𝕜] 𝕜) (x : E) : topDualPairing 𝕜 E v x = v x := rfl @[deprecated (since := "2025-08-12")] alias NormedSpace.dualPairing_apply := topDualPairing_apply @[deprecated (since := "2025-09-03")] alias StrongDual.dualPairing_apply := topDualPairing_apply end topDualPairing
.lake/packages/mathlib/Mathlib/Topology/Algebra/Module/Equiv.lean
import Mathlib.Topology.Algebra.Module.LinearMapPiProd /-! # Continuous linear equivalences Continuous semilinear / linear / star-linear equivalences between topological modules are denoted by `M ≃SL[σ] M₂`, `M ≃L[R] M₂` and `M ≃L⋆[R] M₂`. -/ assert_not_exists TrivialStar open LinearMap (ker range) open Topology Filter Pointwise universe u v w u' section /-- 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`. -/ 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₂] : Prop extends SemilinearEquivClass F σ M M₂ 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 } instance (priority := 100) [EquivLike F M M₂] [s : ContinuousSemilinearEquivClass F σ M M₂] : HomeomorphClass F M M₂ := { s with } end ContinuousSemilinearEquivClass namespace ContinuousLinearMap 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)] variable (R φ) /-- 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 => Continuous.comp (continuous_apply (A := φ) i) <| @continuous_subtype_val _ _ fun x => x ∈ (⨅ i ∈ J, ker (proj i : (∀ i, φ i) →L[R] φ i) : Submodule R (∀ i, φ i)) continuous_invFun := Continuous.subtype_mk (continuous_pi fun i => by dsimp split_ifs <;> [apply continuous_apply; exact continuous_zero]) _ end Pi 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₄] [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 obtain ⟨f', _⟩ := f obtain ⟨g', _⟩ := 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 @[simp] theorem coe_mk (e : M₁ ≃ₛₗ[σ₁₂] M₂) (a b) : ⇑(ContinuousLinearEquiv.mk e a b) = e := rfl 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`. theorem map_zero (e : M₁ ≃SL[σ₁₂] M₂) : e (0 : M₁) = 0 := (e : M₁ →SL[σ₁₂] M₂).map_zero 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] 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 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 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 } @[simp] theorem refl_apply (x : M₁) : ContinuousLinearEquiv.refl R₁ M₁ x = x := rfl 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 toLinearEquiv_symm (e : M₁ ≃SL[σ₁₂] M₂) : e.symm.toLinearEquiv = e.toLinearEquiv.symm := rfl @[deprecated (since := "2025-06-08")] alias symm_toLinearEquiv := toLinearEquiv_symm @[simp] theorem coe_symm_toLinearEquiv (e : M₁ ≃SL[σ₁₂] M₂) : ⇑e.toLinearEquiv.symm = e.symm := rfl @[simp] theorem toHomeomorph_symm (e : M₁ ≃SL[σ₁₂] M₂) : e.symm.toHomeomorph = e.toHomeomorph.symm := rfl @[deprecated "use instead `toHomeomorph_symm`, in the reverse direction" (since := "2025-06-08")] theorem symm_toHomeomorph (e : M₁ ≃SL[σ₁₂] M₂) : e.toHomeomorph.symm = e.symm.toHomeomorph := rfl @[simp] theorem coe_symm_toHomeomorph (e : M₁ ≃SL[σ₁₂] M₂) : ⇑e.toHomeomorph.symm = e.symm := 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 prodCongr [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.prodCongr e'.toLinearEquiv with continuous_toFun := e.continuous_toFun.prodMap e'.continuous_toFun continuous_invFun := e.continuous_invFun.prodMap e'.continuous_invFun } @[deprecated (since := "2025-06-06")] alias prod := prodCongr @[simp, norm_cast] theorem prodCongr_apply [Module R₁ M₂] [Module R₁ M₃] [Module R₁ M₄] (e : M₁ ≃L[R₁] M₂) (e' : M₃ ≃L[R₁] M₄) (x) : e.prodCongr e' x = (e x.1, e' x.2) := rfl @[deprecated (since := "2025-06-06")] alias prod_apply := prodCongr_apply @[simp, norm_cast] theorem coe_prodCongr [Module R₁ M₂] [Module R₁ M₃] [Module R₁ M₄] (e : M₁ ≃L[R₁] M₂) (e' : M₃ ≃L[R₁] M₄) : (e.prodCongr e' : M₁ × M₃ →L[R₁] M₂ × M₄) = (e : M₁ →L[R₁] M₂).prodMap (e' : M₃ →L[R₁] M₄) := rfl @[deprecated (since := "2025-06-06")] alias coe_prod := coe_prodCongr theorem prodCongr_symm [Module R₁ M₂] [Module R₁ M₃] [Module R₁ M₄] (e : M₁ ≃L[R₁] M₂) (e' : M₃ ≃L[R₁] M₄) : (e.prodCongr e').symm = e.symm.prodCongr e'.symm := rfl @[deprecated (since := "2025-06-06")] alias prod_symm := prodCongr_symm 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 section prodAssoc variable (R M₁ M₂ M₃ : Type*) [Semiring R] [AddCommMonoid M₁] [AddCommMonoid M₂] [AddCommMonoid M₃] [Module R M₁] [Module R M₂] [Module R M₃] [TopologicalSpace M₁] [TopologicalSpace M₂] [TopologicalSpace M₃] /-- The product of topological modules is associative up to continuous linear isomorphism. This is `LinearEquiv.prodAssoc` prodAssoc as a continuous linear equivalence. -/ def prodAssoc : ((M₁ × M₂) × M₃) ≃L[R] M₁ × M₂ × M₃ where toLinearEquiv := LinearEquiv.prodAssoc R M₁ M₂ M₃ continuous_toFun := (continuous_fst.comp continuous_fst).prodMk ((continuous_snd.comp continuous_fst).prodMk continuous_snd) continuous_invFun := (continuous_fst.prodMk (continuous_fst.comp continuous_snd)).prodMk (continuous_snd.comp continuous_snd) @[simp] lemma prodAssoc_toLinearEquiv : (prodAssoc R M₁ M₂ M₃).toLinearEquiv = LinearEquiv.prodAssoc R M₁ M₂ M₃ := rfl @[simp] lemma coe_prodAssoc : (prodAssoc R M₁ M₂ M₃ : (M₁ × M₂) × M₃ → M₁ × M₂ × M₃) = Equiv.prodAssoc M₁ M₂ M₃ := rfl @[simp] lemma prodAssoc_apply (p₁ : M₁) (p₂ : M₂) (p₃ : M₃) : prodAssoc R M₁ M₂ M₃ ((p₁, p₂), p₃) = (p₁, (p₂, p₃)) := rfl @[simp] lemma prodAssoc_symm_apply (p₁ : M₁) (p₂ : M₂) (p₃ : M₃) : (prodAssoc R M₁ M₂ M₃).symm (p₁, (p₂, p₃)) = ((p₁, p₂), p₃) := rfl end prodAssoc section prodProdProdComm variable (R M₁ M₂ M₃ M₄ : Type*) [Semiring R] [AddCommMonoid M₁] [AddCommMonoid M₂] [AddCommMonoid M₃] [AddCommMonoid M₄] [Module R M₁] [Module R M₂] [Module R M₃] [Module R M₄] [TopologicalSpace M₁] [TopologicalSpace M₂] [TopologicalSpace M₃] [TopologicalSpace M₄] /-- The product of topological modules is four-way commutative up to continuous linear isomorphism. This is `LinearEquiv.prodProdProdComm` prodAssoc as a continuous linear equivalence. -/ def prodProdProdComm : ((M₁ × M₂) × M₃ × M₄) ≃L[R] (M₁ × M₃) × M₂ × M₄ where toLinearEquiv := LinearEquiv.prodProdProdComm R M₁ M₂ M₃ M₄ continuous_toFun := by fun_prop continuous_invFun := by fun_prop @[simp] theorem prodProdProdComm_symm : (prodProdProdComm R M₁ M₂ M₃ M₄).symm = prodProdProdComm R M₁ M₃ M₂ M₄ := rfl @[simp] lemma prodProdProdComm_toLinearEquiv : (prodProdProdComm R M₁ M₂ M₃ M₄).toLinearEquiv = LinearEquiv.prodProdProdComm R M₁ M₂ M₃ M₄ := rfl @[simp] lemma coe_prodProdProdComm : (prodProdProdComm R M₁ M₂ M₃ M₄ : (M₁ × M₂) × M₃ × M₄ → (M₁ × M₃) × M₂ × M₄) = Equiv.prodProdProdComm M₁ M₂ M₃ M₄ := rfl @[simp] lemma prodProdProdComm_apply (p₁ : M₁) (p₂ : M₂) (p₃ : M₃) (p₄ : M₄) : prodProdProdComm R M₁ M₂ M₃ M₄ ((p₁, p₂), p₃, p₄) = ((p₁, p₃), p₂, p₄) := rfl end prodProdProdComm section prodUnique variable (R M N : Type*) [Semiring R] [TopologicalSpace M] [AddCommMonoid M] [TopologicalSpace N] [AddCommMonoid N] [Unique N] [Module R M] [Module R N] /-- The natural equivalence `M × N ≃L[R] M` for any `Unique` type `N`. This is `Equiv.prodUnique` as a continuous linear equivalence. -/ def prodUnique : (M × N) ≃L[R] M where toLinearEquiv := LinearEquiv.prodUnique continuous_toFun := by change Continuous (Equiv.prodUnique M N) dsimp; fun_prop continuous_invFun := by change Continuous fun x ↦ (x, default) fun_prop @[simp] lemma coe_prodUnique : (prodUnique R M N).toEquiv = Equiv.prodUnique M N := rfl @[simp] lemma prodUnique_apply (x : M × N) : prodUnique R M N x = x.1 := rfl @[simp] lemma prodUnique_symm_apply (x : M) : (prodUnique R M N).symm x = (x, default) := rfl /-- The natural equivalence `N × M ≃L[R] M` for any `Unique` type `N`. This is `Equiv.uniqueProd` as a continuous linear equivalence. -/ def uniqueProd : (N × M) ≃L[R] M where toLinearEquiv := LinearEquiv.uniqueProd continuous_toFun := by change Continuous (Equiv.uniqueProd M N) dsimp; fun_prop continuous_invFun := by change Continuous fun x ↦ (default, x) fun_prop @[simp] lemma coe_uniqueProd : (uniqueProd R M N).toEquiv = Equiv.uniqueProd M N := rfl @[simp] lemma uniqueProd_apply (x : N × M) : uniqueProd R M N x = x.2 := rfl @[simp] lemma uniqueProd_symm_apply (x : M) : (uniqueProd R M N).symm x = (default, x) := rfl end prodUnique 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 -- 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 -- 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 := rfl theorem symm_bijective : Function.Bijective (ContinuousLinearEquiv.symm : (M₁ ≃SL[σ₁₂] M₂) → _) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ @[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 lemma image_eq_preimage_symm (e : M₁ ≃SL[σ₁₂] M₂) (s : Set M₁) : e '' s = e.symm ⁻¹' s := e.toLinearEquiv.toEquiv.image_eq_preimage_symm 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_symm, 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 lemma isUniformEmbedding {E₁ E₂ : Type*} [UniformSpace E₁] [UniformSpace E₂] [AddCommGroup E₁] [AddCommGroup E₂] [Module R₁ E₁] [Module R₂ E₂] [IsUniformAddGroup E₁] [IsUniformAddGroup E₂] (e : E₁ ≃SL[σ₁₂] E₂) : IsUniformEmbedding e := e.toLinearEquiv.toEquiv.isUniformEmbedding e.toContinuousLinearMap.uniformContinuous e.symm.toContinuousLinearMap.uniformContinuous protected theorem _root_.LinearEquiv.isUniformEmbedding {E₁ E₂ : Type*} [UniformSpace E₁] [UniformSpace E₂] [AddCommGroup E₁] [AddCommGroup E₂] [Module R₁ E₁] [Module R₂ E₂] [IsUniformAddGroup E₁] [IsUniformAddGroup E₂] (e : E₁ ≃ₛₗ[σ₁₂] E₂) (h₁ : Continuous e) (h₂ : Continuous e.symm) : IsUniformEmbedding e := ContinuousLinearEquiv.isUniformEmbedding ({ e with continuous_toFun := h₁ continuous_invFun := h₂ } : E₁ ≃SL[σ₁₂] E₂) /-- Create a `ContinuousLinearEquiv` from two `ContinuousLinearMap`s that are inverse of each other. See also `equivOfInverse'`. -/ 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 /-- Create a `ContinuousLinearEquiv` from two `ContinuousLinearMap`s that are inverse of each other, in the `ContinuousLinearMap.comp` sense. See also `equivOfInverse`. -/ def equivOfInverse' (f₁ : M₁ →SL[σ₁₂] M₂) (f₂ : M₂ →SL[σ₂₁] M₁) (h₁ : f₁.comp f₂ = .id R₂ M₂) (h₂ : f₂.comp f₁ = .id R₁ M₁) : M₁ ≃SL[σ₁₂] M₂ := equivOfInverse f₁ f₂ (fun x ↦ by simpa using congr($(h₂) x)) (fun x ↦ by simpa using congr($(h₁) x)) @[simp] theorem equivOfInverse'_apply (f₁ : M₁ →SL[σ₁₂] M₂) (f₂ h₁ h₂ x) : equivOfInverse' f₁ f₂ h₁ h₂ x = f₁ x := rfl /-- The inverse of `equivOfInverse'` is obtained by swapping the order of its parameters. -/ @[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 inv_mul_cancel 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_uliftDown continuous_invFun := continuous_uliftUp } /-- 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] section Pi /-- Combine a family of linear equivalences into a linear equivalence of `pi`-types. This is `Equiv.piCongrLeft` as a `ContinuousLinearEquiv`. -/ def piCongrLeft (R : Type*) [Semiring R] {ι ι' : Type*} (φ : ι → Type*) [∀ i, AddCommMonoid (φ i)] [∀ i, Module R (φ i)] [∀ i, TopologicalSpace (φ i)] (e : ι' ≃ ι) : ((i' : ι') → φ (e i')) ≃L[R] (i : ι) → φ i where __ := Homeomorph.piCongrLeft e __ := LinearEquiv.piCongrLeft R φ e /-- The product over `S ⊕ T` of a family of topological modules is isomorphic (topologically and algebraically) to the product of (the product over `S`) and (the product over `T`). This is `Equiv.sumPiEquivProdPi` as a `ContinuousLinearEquiv`. -/ def sumPiEquivProdPi (R : Type*) [Semiring R] (S T : Type*) (A : S ⊕ T → Type*) [∀ st, AddCommMonoid (A st)] [∀ st, Module R (A st)] [∀ st, TopologicalSpace (A st)] : ((st : S ⊕ T) → A st) ≃L[R] ((s : S) → A (Sum.inl s)) × ((t : T) → A (Sum.inr t)) where __ := LinearEquiv.sumPiEquivProdPi R S T A __ := Homeomorph.sumPiEquivProdPi S T A /-- The product `Π t : α, f t` of a family of topological modules is isomorphic (both topologically and algebraically) to the space `f ⬝` when `α` only contains `⬝`. This is `Equiv.piUnique` as a `ContinuousLinearEquiv`. -/ @[simps! -fullyApplied] def piUnique {α : Type*} [Unique α] (R : Type*) [Semiring R] (f : α → Type*) [∀ x, AddCommMonoid (f x)] [∀ x, Module R (f x)] [∀ x, TopologicalSpace (f x)] : (Π t, f t) ≃L[R] f default where __ := LinearEquiv.piUnique R f __ := Homeomorph.piUnique f end Pi section piCongrRight variable {ι : Type*} {M : ι → Type*} [∀ i, TopologicalSpace (M i)] [∀ i, AddCommMonoid (M i)] [∀ i, Module R₁ (M i)] {N : ι → Type*} [∀ i, TopologicalSpace (N i)] [∀ i, AddCommMonoid (N i)] [∀ i, Module R₁ (N i)] (f : (i : ι) → M i ≃L[R₁] N i) /-- Combine a family of continuous linear equivalences into a continuous linear equivalence of pi-types. -/ def piCongrRight : ((i : ι) → M i) ≃L[R₁] (i : ι) → N i := { LinearEquiv.piCongrRight fun i ↦ f i with continuous_toFun := by exact continuous_pi fun i ↦ (f i).continuous_toFun.comp (continuous_apply i) continuous_invFun := by exact continuous_pi fun i => (f i).continuous_invFun.comp (continuous_apply i) } @[simp] theorem piCongrRight_apply (m : (i : ι) → M i) (i : ι) : piCongrRight f m i = (f i) (m i) := rfl @[simp] theorem piCongrRight_symm_apply (n : (i : ι) → N i) (i : ι) : (piCongrRight f).symm n i = (f i).symm (n i) := rfl end piCongrRight section DistribMulAction variable {G : Type*} [Group G] [DistribMulAction G M₁] [ContinuousConstSMul G M₁] [SMulCommClass G R₁ M₁] /-- Scalar multiplication by a group element as a continuous linear equivalence. -/ @[simps! apply_toLinearEquiv apply_apply] def smulLeft : G →* M₁ ≃L[R₁] M₁ where toFun g := ⟨DistribMulAction.toModuleAut _ _ g, continuous_const_smul _, continuous_const_smul _⟩ map_mul' _ _ := toLinearEquiv_injective <| map_mul (DistribMulAction.toModuleAut _ _) _ _ map_one' := toLinearEquiv_injective <| map_one <| DistribMulAction.toModuleAut _ _ end DistribMulAction end AddCommMonoid section Aut /-! ### Automorphisms as continuous linear equivalences and as units of the ring of endomorphisms The next theorems cover the identification between `M ≃L[R] M`and the group of units of the ring `M →L[R] M`. -/ variable {R M : Type*} [Semiring R] [AddCommMonoid M] [Module R M] [TopologicalSpace 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 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 Aut section AutRing /-! ### Units of a ring as linear automorphisms -/ variable (R : Type*) [Semiring R] [TopologicalSpace R] [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 AutRing section Pi 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! -fullyApplied 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! -fullyApplied apply symm_apply] def finTwoArrow : (Fin 2 → M) ≃L[R] M × M := { piFinTwo R fun _ => M with toLinearEquiv := LinearEquiv.finTwoArrow R M } section variable {n : ℕ} {R : Type*} {M : Fin n.succ → Type*} {N : Type*} variable [Semiring R] variable [∀ i, AddCommMonoid (M i)] [∀ i, Module R (M i)] [∀ i, TopologicalSpace (M i)] variable (R M) in /-- `Fin.consEquiv` as a continuous linear equivalence. -/ @[simps!] def _root_.Fin.consEquivL : (M 0 × Π i, M (Fin.succ i)) ≃L[R] (Π i, M i) where __ := Fin.consLinearEquiv R M continuous_toFun := continuous_id.fst.finCons continuous_id.snd continuous_invFun := .prodMk (continuous_apply 0) (by continuity) /-- `Fin.cons` in the codomain of continuous linear maps. -/ abbrev _root_.ContinuousLinearMap.finCons [AddCommMonoid N] [Module R N] [TopologicalSpace N] (f : N →L[R] M 0) (fs : N →L[R] Π i, M (Fin.succ i)) : N →L[R] Π i, M i := Fin.consEquivL R M ∘L f.prod fs end end Pi 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 [IsTopologicalAddGroup 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).prodMk ((e'.continuous_toFun.comp continuous_snd).add <| f.continuous.comp continuous_fst) continuous_invFun := (e.continuous_invFun.comp continuous_fst).prodMk (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 variable (R) in /-- The negation map as a continuous linear equivalence. -/ def neg [ContinuousNeg M] : M ≃L[R] M := { LinearEquiv.neg R with continuous_toFun := continuous_neg continuous_invFun := continuous_neg } @[simp] theorem coe_neg [ContinuousNeg M] : (neg R : M → M) = -id := rfl @[simp] theorem neg_apply [ContinuousNeg M] (x : M) : neg R x = -x := by simp @[simp] theorem symm_neg [ContinuousNeg M] : (neg R : M ≃L[R] M).symm = neg R := 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 σ₂₁ σ₁₂] 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 theorem map_neg (e : M ≃SL[σ₁₂] M₂) (x : M) : e (-x) = -e x := (e : M →SL[σ₁₂] M₂).map_neg x variable [Module R M₂] [IsTopologicalAddGroup 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 simp [h x] @[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 end ContinuousLinearEquiv namespace ContinuousLinearMap variable {R : Type*} {M M₂ M₃ : Type*} [TopologicalSpace M] [TopologicalSpace M₂] [TopologicalSpace M₃] variable [Semiring R] [AddCommMonoid M] [Module R M] [AddCommMonoid M₂] [Module R M₂] [AddCommMonoid M₃] [Module R M₃] /-- A continuous linear map is invertible if it is the forward direction of a continuous linear equivalence. -/ def IsInvertible (f : M →L[R] M₂) : Prop := ∃ (A : M ≃L[R] M₂), A = f open Classical in /-- 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 : f.IsInvertible then ((Classical.choose h).symm : M₂ →L[R] M) else 0 @[simp] lemma isInvertible_equiv {f : M ≃L[R] M₂} : IsInvertible (f : M →L[R] M₂) := ⟨f, rfl⟩ /-- 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 simp [inverse] /-- By definition, if `f` is not invertible then `inverse f = 0`. -/ @[simp] lemma inverse_of_not_isInvertible {f : M →L[R] M₂} (hf : ¬ f.IsInvertible) : f.inverse = 0 := dif_neg hf @[simp] theorem isInvertible_zero_iff : IsInvertible (0 : M →L[R] M₂) ↔ Subsingleton M ∧ Subsingleton M₂ := by refine ⟨fun ⟨e, he⟩ ↦ ?_, ?_⟩ · have A : Subsingleton M := by refine ⟨fun x y ↦ e.injective ?_⟩ simp [he, ← ContinuousLinearEquiv.coe_coe] exact ⟨A, e.toEquiv.symm.subsingleton⟩ · rintro ⟨hM, hM₂⟩ let e : M ≃L[R] M₂ := { toFun := 0 invFun := 0 left_inv x := Subsingleton.elim _ _ right_inv x := Subsingleton.elim _ _ map_add' x y := Subsingleton.elim _ _ map_smul' c x := Subsingleton.elim _ _ } refine ⟨e, ?_⟩ ext x exact Subsingleton.elim _ _ @[simp] theorem inverse_zero : inverse (0 : M →L[R] M₂) = 0 := by by_cases h : IsInvertible (0 : M →L[R] M₂) · rcases isInvertible_zero_iff.1 h with ⟨hM, hM₂⟩ ext x exact Subsingleton.elim _ _ · exact inverse_of_not_isInvertible h lemma IsInvertible.comp {g : M₂ →L[R] M₃} {f : M →L[R] M₂} (hg : g.IsInvertible) (hf : f.IsInvertible) : (g ∘L f).IsInvertible := by rcases hg with ⟨N, rfl⟩ rcases hf with ⟨M, rfl⟩ exact ⟨M.trans N, rfl⟩ lemma IsInvertible.of_inverse {f : M →L[R] M₂} {g : M₂ →L[R] M} (hf : f ∘L g = .id R M₂) (hg : g ∘L f = .id R M) : f.IsInvertible := ⟨ContinuousLinearEquiv.equivOfInverse' _ _ hf hg, rfl⟩ lemma inverse_eq {f : M →L[R] M₂} {g : M₂ →L[R] M} (hf : f ∘L g = .id R M₂) (hg : g ∘L f = .id R M) : f.inverse = g := by have : f = ContinuousLinearEquiv.equivOfInverse' f g hf hg := rfl rw [this, inverse_equiv] rfl lemma IsInvertible.inverse_apply_eq {f : M →L[R] M₂} {x : M} {y : M₂} (hf : f.IsInvertible) : f.inverse y = x ↔ y = f x := by rcases hf with ⟨M, rfl⟩ simp only [inverse_equiv, ContinuousLinearEquiv.coe_coe] exact ContinuousLinearEquiv.symm_apply_eq M @[simp] lemma isInvertible_equiv_comp {e : M₂ ≃L[R] M₃} {f : M →L[R] M₂} : ((e : M₂ →L[R] M₃) ∘L f).IsInvertible ↔ f.IsInvertible := by constructor · rintro ⟨A, hA⟩ have : f = e.symm ∘L ((e : M₂ →L[R] M₃) ∘L f) := by ext; simp rw [this, ← hA] simp · rintro ⟨M, rfl⟩ simp @[simp] lemma isInvertible_comp_equiv {e : M₃ ≃L[R] M} {f : M →L[R] M₂} : (f ∘L (e : M₃ →L[R] M)).IsInvertible ↔ f.IsInvertible := by constructor · rintro ⟨A, hA⟩ have : f = (f ∘L (e : M₃ →L[R] M)) ∘L e.symm := by ext; simp rw [this, ← hA] simp · rintro ⟨M, rfl⟩ simp @[simp] lemma inverse_equiv_comp {e : M₂ ≃L[R] M₃} {f : M →L[R] M₂} : (e ∘L f).inverse = f.inverse ∘L (e.symm : M₃ →L[R] M₂) := by by_cases hf : f.IsInvertible · rcases hf with ⟨A, rfl⟩ simp only [ContinuousLinearEquiv.comp_coe, inverse_equiv, ContinuousLinearEquiv.coe_inj] rfl · rw [inverse_of_not_isInvertible (by simp [hf]), inverse_of_not_isInvertible hf, zero_comp] @[simp] lemma inverse_comp_equiv {e : M₃ ≃L[R] M} {f : M →L[R] M₂} : (f ∘L e).inverse = (e.symm : M →L[R] M₃) ∘L f.inverse := by by_cases hf : f.IsInvertible · rcases hf with ⟨A, rfl⟩ simp only [ContinuousLinearEquiv.comp_coe, inverse_equiv, ContinuousLinearEquiv.coe_inj] rfl · rw [inverse_of_not_isInvertible (by simp [hf]), inverse_of_not_isInvertible hf, comp_zero] lemma IsInvertible.inverse_comp_of_left {g : M₂ →L[R] M₃} {f : M →L[R] M₂} (hg : g.IsInvertible) : (g ∘L f).inverse = f.inverse ∘L g.inverse := by rcases hg with ⟨N, rfl⟩ simp lemma IsInvertible.inverse_comp_apply_of_left {g : M₂ →L[R] M₃} {f : M →L[R] M₂} {v : M₃} (hg : g.IsInvertible) : (g ∘L f).inverse v = f.inverse (g.inverse v) := by simp only [hg.inverse_comp_of_left, coe_comp', Function.comp_apply] lemma IsInvertible.inverse_comp_of_right {g : M₂ →L[R] M₃} {f : M →L[R] M₂} (hf : f.IsInvertible) : (g ∘L f).inverse = f.inverse ∘L g.inverse := by rcases hf with ⟨M, rfl⟩ simp lemma IsInvertible.inverse_comp_apply_of_right {g : M₂ →L[R] M₃} {f : M →L[R] M₂} {v : M₃} (hf : f.IsInvertible) : (g ∘L f).inverse v = f.inverse (g.inverse v) := by simp only [hf.inverse_comp_of_right, coe_comp', Function.comp_apply] @[simp] theorem ringInverse_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 @[deprecated (since := "2025-04-22")] alias ring_inverse_equiv := ringInverse_equiv /-- The function `ContinuousLinearEquiv.inverse` can be written in terms of `Ring.inverse` for the ring of self-maps of the domain. -/ theorem inverse_eq_ringInverse (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₁ : f.IsInvertible · 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 @[deprecated (since := "2025-04-22")] alias to_ring_inverse := inverse_eq_ringInverse theorem ringInverse_eq_inverse : Ring.inverse = inverse (R := R) (M := M) := by ext simp [inverse_eq_ringInverse (ContinuousLinearEquiv.refl R M)] @[deprecated (since := "2025-04-22")] alias ring_inverse_eq_map_inverse := ringInverse_eq_inverse @[simp] theorem inverse_id : (ContinuousLinearMap.id R M).inverse = .id R M := by rw [← ringInverse_eq_inverse] exact Ring.inverse_one _ /-- Composition of a map on a product with the exchange of the product factors -/ theorem coprod_comp_prodComm [ContinuousAdd M] (f : M₂ →L[R] M) (g : M₃ →L[R] M) : f.coprod g ∘L ContinuousLinearEquiv.prodComm R M₃ M₂ = g.coprod f := by ext <;> simp end ContinuousLinearMap namespace Submodule variable {R : Type*} [Ring R] {M : Type*} [TopologicalSpace M] [AddCommGroup M] [Module R M] open ContinuousLinearMap /-- 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 [IsTopologicalAddGroup 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, fun _ ↦ rfl⟩ end Submodule namespace MulOpposite variable (R : Type*) [Semiring R] [τR : TopologicalSpace R] [IsTopologicalSemiring R] {M : Type*} [AddCommMonoid M] [Module R M] [TopologicalSpace M] [ContinuousSMul R M] /-- The function `op` is a continuous linear equivalence. -/ @[simps!] def opContinuousLinearEquiv : M ≃L[R] Mᵐᵒᵖ where __ := MulOpposite.opLinearEquiv R end MulOpposite end
.lake/packages/mathlib/Mathlib/Topology/Algebra/Module/WeakBilin.lean
import Mathlib.Topology.Algebra.Module.LinearMap 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. ## Main definitions The main definition is the type `WeakBilin B`. * 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`. ## 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`. ## References * [H. H. Schaefer, *Topological Vector Spaces*][schaefer1966] ## Tags weak-star, weak dual, duality -/ noncomputable section open Filter open Topology variable {α 𝕜 𝕝 E F : 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 deriving AddCommMonoid, Module 𝕜 namespace WeakBilin 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 𝕝] [AddCommMonoid E] [Module 𝕜 E] [AddCommMonoid F] [Module 𝕜 F] [m : Module 𝕝 E] (B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜) : Module 𝕝 (WeakBilin B) := m instance instIsScalarTower [CommSemiring 𝕜] [CommSemiring 𝕝] [AddCommMonoid E] [Module 𝕜 E] [AddCommMonoid 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 @[fun_prop] 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 isEmbedding {B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜} (hB : Function.Injective B) : IsEmbedding fun (x : WeakBilin B) y => B x y := Function.Injective.isEmbedding_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, (isEmbedding hB).tendsto_nhds_iff] 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] /-- Map `F` into the topological dual of `E` with the weak topology induced by `F` -/ def eval [ContinuousAdd 𝕜] [ContinuousConstSMul 𝕜 𝕜] : F →ₗ[𝕜] StrongDual 𝕜 (WeakBilin B) where toFun f := ⟨B.flip f, by fun_prop⟩ map_add' _ _ := by ext; simp map_smul' _ _ := by ext; simp 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 `IsTopologicalAddGroup`, meaning that addition and negation are continuous. -/ instance instIsTopologicalAddGroup [ContinuousAdd 𝕜] : IsTopologicalAddGroup (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
.lake/packages/mathlib/Mathlib/Topology/Algebra/Module/LinearPMap.lean
import Mathlib.LinearAlgebra.LinearPMap import Mathlib.Topology.Algebra.Module.Basic import Mathlib.Topology.Algebra.Module.Equiv /-! # 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.isClosable_iff_exists_closed_extension`: an unbounded operator is closable iff it has a closed extension. * `LinearPMap.IsClosable.existsUnique`: 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 -/ section Basic /-- 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 obtain ⟨f', hf⟩ := 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 existsUnique_of_exists_of_unique hf fun _ _ hy₁ hy₂ => eq_of_eq_graph ?_ rw [← hy₁, ← hy₂] open Classical in /-- 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 h1 h2 · 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 := ⟨x, f.le_closure.1 h2⟩ have hyz : x = z := rfl rw [f.le_closure.2 hyz] exact domRestrict_apply hyz end Basic /-! ### Topological properties of the inverse -/ section Inverse variable {f : E →ₗ.[R] F} /-- The inverse of `f : LinearPMap` is closed if and only if `f` is closed. -/ theorem inverse_closed_iff (hf : LinearMap.ker f.toFun = ⊥) : f.inverse.IsClosed ↔ f.IsClosed := by rw [IsClosed, inverse_graph hf] exact (ContinuousLinearEquiv.prodComm R E F).isClosed_image variable [ContinuousAdd E] [ContinuousAdd F] variable [TopologicalSpace R] [ContinuousSMul R E] [ContinuousSMul 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 := (LinearEquiv.prodComm R E F).toEquiv.image_eq_preimage_symm f.graph have h2 := (LinearEquiv.prodComm R E F).toEquiv.image_eq_preimage_symm (_root_.closure f.graph) simp only [LinearEquiv.coe_toEquiv, LinearEquiv.prodComm_apply] 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
.lake/packages/mathlib/Mathlib/Topology/Algebra/Module/Determinant.lean
import Mathlib.Topology.Algebra.Module.Equiv 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) theorem det_pi {ι R M : Type*} [Fintype ι] [CommRing R] [AddCommGroup M] [TopologicalSpace M] [Module R M] [Module.Free R M] [Module.Finite R M] (f : ι → M →L[R] M) : (pi (fun i ↦ (f i).comp (proj i))).det = ∏ i, (f i).det := LinearMap.det_pi _ theorem det_one_smulRight {𝕜 : Type*} [CommRing 𝕜] [TopologicalSpace 𝕜] [ContinuousMul 𝕜] (v : 𝕜) : ((1 : 𝕜 →L[𝕜] 𝕜).smulRight v).det = v := by simp 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
.lake/packages/mathlib/Mathlib/Topology/Algebra/Module/CharacterSpace.lean
import Mathlib.Topology.Algebra.Module.WeakDual import Mathlib.Algebra.Algebra.Spectrum.Basic import Mathlib.Topology.ContinuousMap.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*} -- 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 /-- This has to come after `WeakDual.CharacterSpace.instFunLike`, otherwise the right-hand side gets coerced via `Subtype.val` instead of directly via `DFunLike`. -/ @[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.algebraMap_self, 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 [AlgHomClass.commutes]⟩ end Kernel section GelfandTransform open ContinuousMap variable (𝕜 A) [CommRing 𝕜] [NoZeroDivisors 𝕜] [TopologicalSpace 𝕜] [IsTopologicalRing 𝕜] [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_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
.lake/packages/mathlib/Mathlib/Topology/Algebra/Module/ModuleTopology.lean
import Mathlib.Topology.Algebra.Module.Equiv import Mathlib.RingTheory.Finiteness.Cardinality import Mathlib.Algebra.Algebra.Bilinear import Mathlib.Algebra.Group.Basic /-! # A "module topology" for modules over a topological ring If `R` is a topological ring acting on an additive abelian group `A`, we define the *module topology* to be the finest topology on `A` making both the maps `• : R × A → A` and `+ : A × A → A` continuous (with all the products having the product topology). Note that `- : A → A` is also automatically continuous as it is `a ↦ (-1) • a`. This topology was suggested by Will Sawin [here](https://mathoverflow.net/a/477763/1384). ## Mathematical details I (buzzard) don't know of any reference for this other than Sawin's mathoverflow answer, so I expand some of the details here. First note that the definition makes sense in far more generality (for example `R` just needs to be a topological space acting on an additive monoid). Next note that there *is* a finest topology with this property! Indeed, topologies on a fixed type form a complete lattice (infinite infs and sups exist). So if `τ` is the Inf of all the topologies on `A` which make `+` and `•` continuous, then the claim is that `+` and `•` are still continuous for `τ` (note that topologies are ordered so that finer topologies are smaller). To show `+ : A × A → A` is continuous we equivalently need to show that the pushforward of the product topology `τ × τ` along `+` is `≤ τ`, and because `τ` is the greatest lower bound of the topologies making `•` and `+` continuous, it suffices to show that it's `≤ σ` for any topology `σ` on `A` which makes `+` and `•` continuous. However pushforward and products are monotone, so `τ × τ ≤ σ × σ`, and the pushforward of `σ × σ` is `≤ σ` because that's precisely the statement that `+` is continuous for `σ`. The proof for `•` follows mutatis mutandis. A *topological module* for a topological ring `R` is an `R`-module `A` with a topology making `+` and `•` continuous. The discussion so far has shown that the module topology makes an `R`-module `A` into a topological module, and moreover is the finest topology with this property. A crucial observation is that if `M` is a topological `R`-module, if `A` is an `R`-module with no topology, and if `φ : A → M` is linear, then the pullback of `M`'s topology to `A` is a topology making `A` into a topological module. Let's for example check that `•` is continuous. If `U ⊆ A` is open then by definition of the pullback topology, `U = φ⁻¹(V)` for some open `V ⊆ M`, and now the pullback of `U` under `•` is just the pullback along the continuous map `id × φ : R × A → R × M` of the preimage of `V` under the continuous map `• : R × M → M`, so it's open. The proof for `+` is similar. As a consequence of this, we see that if `φ : A → M` is a linear map between topological `R`-modules modules and if `A` has the module topology, then `φ` is automatically continuous. Indeed the argument above shows that if `A → M` is linear then the module topology on `A` is `≤` the pullback of the module topology on `M` (because it's the inf of a set containing this topology) which is the definition of continuity. We also deduce that the module topology is a functor from the category of `R`-modules (`R` a topological ring) to the category of topological `R`-modules, and it is perhaps unsurprising that this is an adjoint to the forgetful functor. Indeed, if `A` is an `R`-module and `M` is a topological `R`-module, then the previous paragraph shows that the linear maps `A → M` are precisely the continuous linear maps from (`A` with its module topology) to `M`, so the module topology is a left adjoint to the forgetful functor. This file develops the theory of the module topology. ## Main theorems * `IsTopologicalSemiring.toIsModuleTopology : IsModuleTopology R R`. The module topology on `R` is `R`'s topology. * `IsModuleTopology.iso [IsModuleTopology R A] (e : A ≃L[R] B) : IsModuleTopology R B`. If `A` and `B` are `R`-modules with topologies, if `e` is a topological isomorphism between them, and if `A` has the module topology, then `B` has the module topology. * `IsModuleTopology.instProd` : If `M` and `N` are `R`-modules each equipped with the module topology, then the product topology on `M × N` is the module topology. * `IsModuleTopology.instPi` : Given a finite collection of `R`-modules each of which has the module topology, the product topology on the product module is the module topology. * `IsModuleTopology.isTopologicalRing` : If `D` is an `R`-algebra equipped with the module topology, and `D` is finite as an `R`-module, then `D` is a topological ring (that is, addition, negation and multiplication are continuous). Now say `φ : A →ₗ[R] B` is an `R`-linear map between `R`-modules equipped with the module topology. * `IsModuleTopology.continuous_of_linearMap φ` is the proof that `φ` is automatically continuous. * `IsModuleTopology.isQuotientMap_of_surjective (hφ : Function.Surjective φ)` is the proof that if furthermore `φ` is surjective then it is a quotient map, that is, the module topology on `B` is the pushforward of the module topology on `A`. Now say `ψ : A →ₗ[R] B →ₗ[R] C` is an `R`-bilinear map between `R`-modules equipped with the module topology. * `IsModuleTopology.continuous_bilinear_of_finite_left` : If `A` is finite then `A × B → C` is continuous. * `IsModuleTopology.continuous_bilinear_of_finite_right` : If `B` is finite then `A × B → C` is continuous. ## TODO * The module topology is a functor from the category of `R`-modules to the category of topological `R`-modules, and it's an adjoint to the forgetful functor. -/ section basics /- This section is just boilerplate, defining the module topology and making some infrastructure. Note that we don't even need that `R` is a ring in the main definitions, just that it acts on `A`. -/ variable (R : Type*) [TopologicalSpace R] (A : Type*) [Add A] [SMul R A] /-- The module topology, for a module `A` over a topological ring `R`. It's the finest topology making addition and the `R`-action continuous, or equivalently the finest topology making `A` into a topological `R`-module. More precisely it's the Inf of the set of topologies with these properties; theorems `continuousSMul` and `continuousAdd` show that the module topology also has these properties. -/ abbrev moduleTopology : TopologicalSpace A := sInf {t | @ContinuousSMul R A _ _ t ∧ @ContinuousAdd A t _} /-- A class asserting that the topology on a module over a topological ring `R` is the module topology. See `moduleTopology` for more discussion of the module topology. -/ class IsModuleTopology [τA : TopologicalSpace A] : Prop where /-- Note that this should not be used directly, and `eq_moduleTopology`, which takes `R` and `A` explicitly, should be used instead. -/ eq_moduleTopology' : τA = moduleTopology R A theorem eq_moduleTopology [τA : TopologicalSpace A] [IsModuleTopology R A] : τA = moduleTopology R A := IsModuleTopology.eq_moduleTopology' (R := R) (A := A) /-- Note that the topology isn't part of the discrimination key so this gets tried on every `IsModuleTopology` goal and hence the low priority. -/ instance (priority := low) {R : Type*} [TopologicalSpace R] {A : Type*} [Add A] [SMul R A] : letI := moduleTopology R A; IsModuleTopology R A := letI := moduleTopology R A; ⟨rfl⟩ /-- Scalar multiplication `• : R × A → A` is continuous if `R` is a topological ring, and `A` is an `R` module with the module topology. -/ theorem ModuleTopology.continuousSMul : @ContinuousSMul R A _ _ (moduleTopology R A) := /- Proof: We need to prove that the product topology is finer than the pullback of the module topology. But the module topology is an Inf and thus a limit, and pullback is a right adjoint, so it preserves limits. We must thus show that the product topology is finer than an Inf, so it suffices to show it's a lower bound, which is not hard. All this is wrapped into `continuousSMul_sInf`. -/ continuousSMul_sInf fun _ h ↦ h.1 /-- Addition `+ : A × A → A` is continuous if `R` is a topological ring, and `A` is an `R` module with the module topology. -/ theorem ModuleTopology.continuousAdd : @ContinuousAdd A (moduleTopology R A) _ := continuousAdd_sInf fun _ h ↦ h.2 instance IsModuleTopology.toContinuousSMul [TopologicalSpace A] [IsModuleTopology R A] : ContinuousSMul R A := eq_moduleTopology R A ▸ ModuleTopology.continuousSMul R A -- this can't be an instance because typeclass inference can't be expected to find `R`. theorem IsModuleTopology.toContinuousAdd [TopologicalSpace A] [IsModuleTopology R A] : ContinuousAdd A := eq_moduleTopology R A ▸ ModuleTopology.continuousAdd R A /-- The module topology is `≤` any topology making `A` into a topological module. -/ theorem moduleTopology_le [τA : TopologicalSpace A] [ContinuousSMul R A] [ContinuousAdd A] : moduleTopology R A ≤ τA := sInf_le ⟨inferInstance, inferInstance⟩ end basics namespace IsModuleTopology section basics variable {R : Type*} [TopologicalSpace R] {A : Type*} [Add A] [SMul R A] [τA : TopologicalSpace A] /-- If `A` is a topological `R`-module and the identity map from (`A` with its given topology) to (`A` with the module topology) is continuous, then the topology on `A` is the module topology. -/ theorem of_continuous_id [ContinuousAdd A] [ContinuousSMul R A] (h : @Continuous A A τA (moduleTopology R A) id) : IsModuleTopology R A where -- The topologies are equal because each is finer than the other. One inclusion -- follows from the continuity hypothesis; the other is because the module topology -- is the inf of all the topologies making `A` a topological module. eq_moduleTopology' := le_antisymm (continuous_id_iff_le.1 h) (moduleTopology_le _ _) /-- The zero module has the module topology. -/ instance instSubsingleton [Subsingleton A] : IsModuleTopology R A where eq_moduleTopology' := Subsingleton.elim _ _ end basics section iso variable {R : Type*} [τR : TopologicalSpace R] [Semiring R] variable {A : Type*} [AddCommMonoid A] [Module R A] [τA : TopologicalSpace A] [IsModuleTopology R A] variable {B : Type*} [AddCommMonoid B] [Module R B] [τB : TopologicalSpace B] /-- If `A` and `B` are `R`-modules, homeomorphic via an `R`-linear homeomorphism, and if `A` has the module topology, then so does `B`. -/ theorem iso (e : A ≃L[R] B) : IsModuleTopology R B where eq_moduleTopology' := by -- get these in before I start putting new topologies on A and B and have to use `@` let g : A →ₗ[R] B := e let g' : B →ₗ[R] A := e.symm let h : A →+ B := e let h' : B →+ A := e.symm simp_rw [e.toHomeomorph.symm.isInducing.1, eq_moduleTopology R A, moduleTopology, induced_sInf] apply congr_arg ext τ -- from this point on the definitions of `g`, `g'` etc. above don't work without `@`. rw [Set.mem_image] constructor · rintro ⟨σ, ⟨hσ1, hσ2⟩, rfl⟩ exact ⟨continuousSMul_induced g'.toMulActionHom, continuousAdd_induced h'⟩ · rintro ⟨h1, h2⟩ use τ.induced e rw [induced_compose] refine ⟨⟨continuousSMul_induced g.toMulActionHom, continuousAdd_induced h⟩, ?_⟩ nth_rw 2 [← induced_id (t := τ)] simp end iso section self variable (R : Type*) [Semiring R] [τR : TopologicalSpace R] [IsTopologicalSemiring R] /-! We now fix once and for all a topological semiring `R`. We first prove that the module topology on `R` considered as a module over itself, is `R`'s topology. -/ /-- The topology on a topological semiring `R` agrees with the module topology when considering `R` as an `R`-module in the obvious way (i.e., via `Semiring.toModule`). -/ instance _root_.IsTopologicalSemiring.toIsModuleTopology : IsModuleTopology R R := by /- By a previous lemma it suffices to show that the identity from (R,usual) to (R, module topology) is continuous. -/ apply of_continuous_id /- The idea needed here is to rewrite the identity function as the composite of `r ↦ (r,1)` from `R` to `R × R`, and multiplication `R × R → R`. -/ rw [show (id : R → R) = (fun rs ↦ rs.1 • rs.2) ∘ (fun r ↦ (r, 1)) by ext; simp] /- It thus suffices to show that each of these maps are continuous. For this claim to even make sense, we need to topologise `R × R`. The trick is to do this by giving the first `R` the usual topology `τR` and the second `R` the module topology. To do this we have to "fight mathlib" a bit with `@`, because there is more than one topology on `R` here. -/ apply @Continuous.comp R (R × R) R τR (@instTopologicalSpaceProd R R τR (moduleTopology R R)) (moduleTopology R R) · /- The map R × R → R is `•`, so by a fundamental property of the module topology, this is continuous. -/ exact @continuous_smul _ _ _ _ (moduleTopology R R) <| ModuleTopology.continuousSMul .. · /- The map `R → R × R` sending `r` to `(r,1)` is a map into a product, so it suffices to show that each of the two factors is continuous. But the first is the identity function on `(R, usual topology)` and the second is a constant function. -/ exact @Continuous.prodMk _ _ _ _ (moduleTopology R R) _ _ _ continuous_id <| @continuous_const _ _ _ (moduleTopology R R) _ end self section MulOpposite variable (R : Type*) [Semiring R] [τR : TopologicalSpace R] [IsTopologicalSemiring R] /-- The module topology coming from the action of the topological ring `Rᵐᵒᵖ` on `R` (via `Semiring.toOppositeModule`, i.e. via `(op r) • m = m * r`) is `R`'s topology. -/ instance _root_.IsTopologicalSemiring.toOppositeIsModuleTopology : IsModuleTopology Rᵐᵒᵖ R := .iso (MulOpposite.opContinuousLinearEquiv Rᵐᵒᵖ).symm end MulOpposite section function variable {R : Type*} [τR : TopologicalSpace R] [Semiring R] variable {A : Type*} [AddCommMonoid A] [Module R A] [aA : TopologicalSpace A] [IsModuleTopology R A] variable {B : Type*} [AddCommMonoid B] [Module R B] [aB : TopologicalSpace B] [ContinuousAdd B] [ContinuousSMul R B] /-- Every `R`-linear map between two topological `R`-modules, where the source has the module topology, is continuous. -/ @[fun_prop, continuity] theorem continuous_of_distribMulActionHom (φ : A →+[R] B) : Continuous φ := by -- the proof: We know that `+ : B × B → B` and `• : R × B → B` are continuous for the module -- topology on `B`, and two earlier theorems (`continuousSMul_induced` and -- `continuousAdd_induced`) say that hence `+` and `•` on `A` are continuous if `A` -- is given the topology induced from `φ`. Hence the module topology is finer than -- the induced topology, and so the function is continuous. rw [eq_moduleTopology R A, continuous_iff_le_induced] exact sInf_le <| ⟨continuousSMul_induced (φ.toMulActionHom), continuousAdd_induced φ.toAddMonoidHom⟩ @[fun_prop, continuity] theorem continuous_of_linearMap (φ : A →ₗ[R] B) : Continuous φ := continuous_of_distribMulActionHom φ.toDistribMulActionHom variable (R) in theorem continuous_neg (C : Type*) [AddCommGroup C] [Module R C] [TopologicalSpace C] [IsModuleTopology R C] : Continuous (fun a ↦ -a : C → C) := haveI : ContinuousAdd C := IsModuleTopology.toContinuousAdd R C continuous_of_linearMap (LinearEquiv.neg R).toLinearMap variable (R) in theorem continuousNeg (C : Type*) [AddCommGroup C] [Module R C] [TopologicalSpace C] [IsModuleTopology R C] : ContinuousNeg C where continuous_neg := continuous_neg R C variable (R) in theorem topologicalAddGroup (C : Type*) [AddCommGroup C] [Module R C] [TopologicalSpace C] [IsModuleTopology R C] : IsTopologicalAddGroup C where continuous_add := (IsModuleTopology.toContinuousAdd R C).1 continuous_neg := continuous_neg R C @[fun_prop, continuity] theorem continuous_of_ringHom {R A B} [CommSemiring R] [Semiring A] [Algebra R A] [Semiring B] [TopologicalSpace R] [TopologicalSpace A] [IsModuleTopology R A] [TopologicalSpace B] [IsTopologicalSemiring B] (φ : A →+* B) (hφ : Continuous (φ.comp (algebraMap R A))) : Continuous φ := by let inst := Module.compHom B (φ.comp (algebraMap R A)) let φ' : A →ₗ[R] B := ⟨φ, fun r m ↦ by simp [Algebra.smul_def]; rfl⟩ have : ContinuousSMul R B := ⟨(hφ.comp continuous_fst).mul continuous_snd⟩ exact continuous_of_linearMap φ' end function section surjection variable {R : Type*} [τR : TopologicalSpace R] [Ring R] variable {A : Type*} [AddCommGroup A] [Module R A] [TopologicalSpace A] [IsModuleTopology R A] variable {B : Type*} [AddCommGroup B] [Module R B] open Topology in /-- A linear surjection between modules with the module topology is a quotient map. Equivalently, the pushforward of the module topology along a surjective linear map is again the module topology. -/ theorem isQuotientMap_of_surjective [τB : TopologicalSpace B] [IsModuleTopology R B] {φ : A →ₗ[R] B} (hφ : Function.Surjective φ) : IsQuotientMap φ where surjective := hφ eq_coinduced := by -- We need to prove that the topology on B is coinduced from that on A. -- First tell the typeclass inference system that A and B are topological groups. haveI := topologicalAddGroup R A haveI := topologicalAddGroup R B -- Because φ is linear, it's continuous for the module topologies (by a previous result). have this : Continuous φ := continuous_of_linearMap φ -- So the coinduced topology is finer than the module topology on B. rw [continuous_iff_coinduced_le] at this -- So STP the module topology on B is ≤ the topology coinduced from A refine le_antisymm ?_ this rw [eq_moduleTopology R B] -- Now let's remove B's topology from the typeclass system clear! τB -- and replace it with the coinduced topology (which will be the same, but that's what we're -- trying to prove). This means we don't have to fight with the typeclass system. letI : TopologicalSpace B := .coinduced φ inferInstance -- With this new topology on `B`, φ is a quotient map by definition, -- and hence an open quotient map by a result in the library. have hφo : IsOpenQuotientMap φ := AddMonoidHom.isOpenQuotientMap_of_isQuotientMap ⟨hφ, rfl⟩ -- We're trying to prove the module topology on B is ≤ the coinduced topology. -- But recall that the module topology is the Inf of the topologies on B making addition -- and scalar multiplication continuous, so it suffices to prove -- that the coinduced topology on B has these properties. refine sInf_le ⟨?_, ?_⟩ · -- In this branch, we prove that `• : R × B → B` is continuous for the coinduced topology. apply ContinuousSMul.mk -- We know that `• : R × A → A` is continuous, by assumption. obtain ⟨hA⟩ : ContinuousSMul R A := inferInstance /- By linearity of φ, this diagram commutes: R × A --(•)--> A | | |id × φ |φ | | \/ \/ R × B --(•)--> B -/ have hφ2 : (fun p ↦ p.1 • p.2 : R × B → B) ∘ (Prod.map id φ) = φ ∘ (fun p ↦ p.1 • p.2 : R × A → A) := by ext; simp -- Furthermore, the identity from R to R is an open quotient map as is `φ`, -- so the product `id × φ` is an open quotient map, by a result in the library. have hoq : IsOpenQuotientMap (_ : R × A → R × B) := IsOpenQuotientMap.prodMap .id hφo -- This is the left map in the diagram. So by a standard fact about open quotient maps, -- to prove that the bottom map is continuous, it suffices to prove -- that the diagonal map is continuous. rw [← hoq.continuous_comp_iff] -- but the diagonal is the composite of the continuous maps `φ` and `• : R × A → A` rw [hφ2] -- so we're done exact Continuous.comp hφo.continuous hA · /- In this branch we show that addition is continuous for the coinduced topology on `B`. The argument is basically the same, this time using commutativity of A × A --(+)--> A | | |φ × φ |φ | | \/ \/ B × B --(+)--> B -/ apply ContinuousAdd.mk obtain ⟨hA⟩ := IsModuleTopology.toContinuousAdd R A have hφ2 : (fun p ↦ p.1 + p.2 : B × B → B) ∘ (Prod.map φ φ) = φ ∘ (fun p ↦ p.1 + p.2 : A × A → A) := by ext; simp rw [← (IsOpenQuotientMap.prodMap hφo hφo).continuous_comp_iff, hφ2] exact Continuous.comp hφo.continuous hA /-- A linear surjection between modules with the module topology is an open quotient map. -/ theorem isOpenQuotientMap_of_surjective [TopologicalSpace B] [IsModuleTopology R B] {φ : A →ₗ[R] B} (hφ : Function.Surjective φ) : IsOpenQuotientMap φ := have := toContinuousAdd R A AddMonoidHom.isOpenQuotientMap_of_isQuotientMap <| isQuotientMap_of_surjective hφ omit [IsModuleTopology R A] in /-- A linear surjection to a module with the module topology is open. -/ theorem isOpenMap_of_surjective [TopologicalSpace B] [IsModuleTopology R B] [ContinuousAdd A] [ContinuousSMul R A] {φ : A →ₗ[R] B} (hφ : Function.Surjective φ) : IsOpenMap φ := by have hOpenMap := letI : TopologicalSpace A := moduleTopology R A have : IsModuleTopology R A := ⟨rfl⟩ isOpenQuotientMap_of_surjective hφ |>.isOpenMap intro U hU exact hOpenMap U <| moduleTopology_le R A U hU lemma _root_.ModuleTopology.eq_coinduced_of_surjective {φ : A →ₗ[R] B} (hφ : Function.Surjective φ) : moduleTopology R B = TopologicalSpace.coinduced φ inferInstance := by letI : TopologicalSpace B := moduleTopology R B haveI : IsModuleTopology R B := ⟨rfl⟩ exact (isQuotientMap_of_surjective hφ).eq_coinduced instance instQuot (S : Submodule R A) : IsModuleTopology R (A ⧸ S) := by constructor have := toContinuousAdd R A have quot := (Submodule.isOpenQuotientMap_mkQ S).isQuotientMap.eq_coinduced have module := ModuleTopology.eq_coinduced_of_surjective <| Submodule.mkQ_surjective S rw [quot, module] end surjection section Prod variable {R : Type*} [TopologicalSpace R] [Semiring R] variable {M : Type*} [AddCommMonoid M] [Module R M] [TopologicalSpace M] [IsModuleTopology R M] variable {N : Type*} [AddCommMonoid N] [Module R N] [TopologicalSpace N] [IsModuleTopology R N] /-- The product of the module topologies for two modules over a topological ring is the module topology. -/ instance instProd : IsModuleTopology R (M × N) := by constructor have : ContinuousAdd M := toContinuousAdd R M have : ContinuousAdd N := toContinuousAdd R N -- In this proof, `M × N` always denotes the product with its *product* topology. -- Addition `(M × N)² → M × N` and scalar multiplication `R × (M × N) → M × N` -- are continuous for the product topology (by results in the library), so the module topology -- on `M × N` is finer than the product topology (as it's the Inf of such topologies). -- It thus remains to show that the product topology is finer than the module topology. refine le_antisymm ?_ <| sInf_le ⟨Prod.continuousSMul, Prod.continuousAdd⟩ -- Or equivalently, if `P` denotes `M × N` with the module topology, let P := M × N let τP : TopologicalSpace P := moduleTopology R P have : IsModuleTopology R P := ⟨rfl⟩ have : ContinuousAdd P := ModuleTopology.continuousAdd R P -- and if `i` denotes the identity map from `M × N` to `P` let i : M × N → P := id -- then we need to show that `i` is continuous. rw [← continuous_id_iff_le] change @Continuous (M × N) P instTopologicalSpaceProd τP i -- But `i` can be written as (m, n) ↦ (m, 0) + (0, n) -- or equivalently as i₁ ∘ pr₁ + i₂ ∘ pr₂, where prᵢ are the projections, -- the iⱼ's are linear inclusions M → P and N → P, and the addition is P × P → P. let i₁ : M →ₗ[R] P := LinearMap.inl R M N let i₂ : N →ₗ[R] P := LinearMap.inr R M N rw [show (i : M × N → P) = (fun abcd ↦ abcd.1 + abcd.2 : P × P → P) ∘ (fun ab ↦ (i₁ ab.1, i₂ ab.2)) by ext ⟨a, b⟩ <;> aesop] -- and these maps are all continuous, hence `i` is too fun_prop end Prod section Pi variable {R : Type*} [TopologicalSpace R] [Semiring R] variable {ι : Type*} [Finite ι] {A : ι → Type*} [∀ i, AddCommMonoid (A i)] [∀ i, Module R (A i)] [∀ i, TopologicalSpace (A i)] [∀ i, IsModuleTopology R (A i)] /-- The product of the module topologies for a finite family of modules over a topological ring is the module topology. -/ instance instPi : IsModuleTopology R (∀ i, A i) := by -- This is an easy induction on the size of the finite type, given the result -- for binary products above. We use a "decategorified" induction principle for finite types. induction ι using Finite.induction_empty_option · -- invariance under equivalence of the finite type we're taking the product over case of_equiv X Y e _ _ _ _ _ => exact iso (ContinuousLinearEquiv.piCongrLeft R A e) · -- empty case infer_instance · -- "inductive step" is to check for product over `Option ι` case when known for product over `ι` case h_option ι _ hind _ _ _ _ => -- `Option ι` is a `Sum` of `ι` and `Unit` let e : Option ι ≃ ι ⊕ Unit := Equiv.optionEquivSumPUnit ι -- so suffices to check for a product of modules over `ι ⊕ Unit` suffices IsModuleTopology R ((i' : ι ⊕ Unit) → A (e.symm i')) from iso (.piCongrLeft R A e.symm) -- but such a product is isomorphic to a binary product -- of (product over `ι`) and (product over `Unit`) suffices IsModuleTopology R (((s : ι) → A (e.symm (Sum.inl s))) × ((t : Unit) → A (e.symm (Sum.inr t)))) from iso (ContinuousLinearEquiv.sumPiEquivProdPi R ι Unit _).symm -- The product over `ι` has the module topology by the inductive hypothesis, -- and the product over `Unit` is just a module which is assumed to have the module topology have := iso (ContinuousLinearEquiv.piUnique R (fun t ↦ A (e.symm (Sum.inr t)))).symm -- so the result follows from the previous lemma (binary products). infer_instance end Pi section bilinear section semiring variable {R : Type*} [TopologicalSpace R] [CommSemiring R] variable {B : Type*} [AddCommMonoid B] [Module R B] [TopologicalSpace B] [IsModuleTopology R B] variable {C : Type*} [AddCommMonoid C] [Module R C] [TopologicalSpace C] [IsModuleTopology R C] /-- If `n` is finite and `B`,`C` are `R`-modules with the module topology, then any bilinear map `Rⁿ × B → C` is automatically continuous. Note that whilst this result works for semirings, for rings this result is superseded by `IsModuleTopology.continuous_bilinear_of_finite_left`. -/ theorem continuous_bilinear_of_pi_fintype (ι : Type*) [Finite ι] (bil : (ι → R) →ₗ[R] B →ₗ[R] C) : Continuous (fun ab ↦ bil ab.1 ab.2 : ((ι → R) × B → C)) := by classical cases nonempty_fintype ι -- The map in question, `(f, b) ↦ bil f b`, is easily checked to be equal to -- `(f, b) ↦ ∑ᵢ f i • bil (single i 1) b` where `single i 1 : ι → R` sends `i` to `1` and -- everything else to `0`. have h : (fun fb ↦ bil fb.1 fb.2 : ((ι → R) × B → C)) = (fun fb ↦ ∑ i, ((fb.1 i) • (bil (Finsupp.single i 1) fb.2) : C)) := by ext ⟨f, b⟩ nth_rw 1 [← Finset.univ_sum_single f] simp_rw [← Finsupp.single_eq_pi_single, map_sum, LinearMap.coeFn_sum, Finset.sum_apply] refine Finset.sum_congr rfl (fun x _ ↦ ?_) rw [← Finsupp.smul_single_one] push_cast simp rw [h] -- But this map is obviously continuous, because for a fixed `i`, `bil (single i 1)` is -- linear and thus continuous, and scalar multiplication and finite sums are continuous haveI : ContinuousAdd C := toContinuousAdd R C fun_prop end semiring section ring variable {R : Type*} [TopologicalSpace R] [CommRing R] [IsTopologicalRing R] variable {A : Type*} [AddCommGroup A] [Module R A] [aA : TopologicalSpace A] [IsModuleTopology R A] variable {B : Type*} [AddCommGroup B] [Module R B] [aB : TopologicalSpace B] [IsModuleTopology R B] variable {C : Type*} [AddCommGroup C] [Module R C] [aC : TopologicalSpace C] [IsModuleTopology R C] /-- If `A`, `B` and `C` have the module topology, and if furthermore `A` is a finite `R`-module, then any bilinear map `A × B → C` is automatically continuous -/ @[continuity, fun_prop] theorem continuous_bilinear_of_finite_left [Module.Finite R A] (bil : A →ₗ[R] B →ₗ[R] C) : Continuous (fun ab ↦ bil ab.1 ab.2 : (A × B → C)) := by -- `A` is finite and hence admits a surjection from `Rⁿ` for some finite `n`. obtain ⟨m, f, hf⟩ := Module.Finite.exists_fin' R A -- The induced linear map `φ : Rⁿ × B → A × B` is surjective let bil' : (Fin m → R) →ₗ[R] B →ₗ[R] C := bil.comp f let φ := f.prodMap (LinearMap.id : B →ₗ[R] B) have hφ : Function.Surjective φ := Function.Surjective.prodMap hf fun b ↦ ⟨b, rfl⟩ -- ... and thus a quotient map, so it suffices to prove that the composite `Rⁿ × B → C` is -- continuous. rw [Topology.IsQuotientMap.continuous_iff (isQuotientMap_of_surjective hφ)] -- But this follows from an earlier result. exact continuous_bilinear_of_pi_fintype (Fin m) bil' /-- If `A`, `B` and `C` have the module topology, and if furthermore `B` is a finite `R`-module, then any bilinear map `A × B → C` is automatically continuous -/ @[continuity, fun_prop] theorem continuous_bilinear_of_finite_right [Module.Finite R B] (bil : A →ₗ[R] B →ₗ[R] C) : Continuous (fun ab ↦ bil ab.1 ab.2 : (A × B → C)) := by -- We already proved this when `A` is finite instead of `B`, so it's obvious by symmetry rw [show (fun ab ↦ bil ab.1 ab.2 : (A × B → C)) = ((fun ba ↦ bil.flip ba.1 ba.2 : (B × A → C)) ∘ (Prod.swap : A × B → B × A)) by ext; simp] fun_prop end ring end bilinear section algebra variable (R : Type*) [CommRing R] [TopologicalSpace R] [IsTopologicalRing R] (D : Type*) [Ring D] [Algebra R D] [Module.Finite R D] [TopologicalSpace D] [IsModuleTopology R D] include R in /-- If `D` is an `R`-algebra, finite as an `R`-module, and if `D` has the module topology, then multiplication on `D` is automatically continuous. -/ @[continuity, fun_prop] theorem continuous_mul_of_finite : Continuous (fun ab ↦ ab.1 * ab.2 : D × D → D) := -- Proof: multiplication is bilinear so this follows from previous results. continuous_bilinear_of_finite_left (LinearMap.mul R D) include R in /-- If `R` is a topological ring and `D` is an `R`-algebra, finite as an `R`-module, and if `D` is given the module topology, then `D` is a topological ring. -/ theorem isTopologicalRing : IsTopologicalRing D where -- Proof: we have already checked all the axioms above. continuous_add := (toContinuousAdd R D).1 continuous_mul := continuous_mul_of_finite R D continuous_neg := continuous_neg R D end algebra end IsModuleTopology
.lake/packages/mathlib/Mathlib/Topology/Algebra/Module/LocallyConvex.lean
import Mathlib.Analysis.Convex.Topology import Mathlib.Topology.Connected.LocPathConnected import Mathlib.Analysis.Convex.PathConnected /-! # 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 -/ assert_not_exists NormedSpace 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*) [Semiring 𝕜] [PartialOrder 𝕜] [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*) [Semiring 𝕜] [PartialOrder 𝕜] [AddCommMonoid E] [Module 𝕜 E] [TopologicalSpace E] theorem locallyConvexSpace_iff : LocallyConvexSpace 𝕜 E ↔ ∀ x : E, (𝓝 x).HasBasis (fun s : Set E => s ∈ 𝓝 x ∧ Convex 𝕜 s) id := ⟨fun _ ↦ 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*) [Semiring 𝕜] [PartialOrder 𝕜] [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] [IsTopologicalAddGroup 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 _ => LocallyConvexSpace.convex_basis 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.toLocPathConnectedSpace [Module ℝ E] [ContinuousSMul ℝ E] [LocallyConvexSpace ℝ E] : LocPathConnectedSpace E := .of_bases (fun x ↦ convex_basis (𝕜 := ℝ) x) fun _ _ hs ↦ hs.2.isPathConnected <| nonempty_of_mem <| mem_of_mem_nhds hs.1 /-- Convex subsets of locally convex spaces are locally path-connected. -/ theorem Convex.locPathConnectedSpace [Module ℝ E] [ContinuousSMul ℝ E] [LocallyConvexSpace ℝ E] {S : Set E} (hS : Convex ℝ S) : LocPathConnectedSpace S := by refine ⟨fun x ↦ ⟨fun s ↦ ⟨fun hs ↦ ?_, fun ⟨t, ht⟩ ↦ mem_of_superset ht.1.1 ht.2⟩⟩⟩ let ⟨t, ht⟩ := (mem_nhds_subtype S x s).mp hs let ⟨t', ht'⟩ := (LocallyConvexSpace.convex_basis (𝕜 := ℝ) x.1).mem_iff.mp ht.1 refine ⟨(↑) ⁻¹' t', ⟨?_, ?_⟩, (preimage_mono ht'.2).trans ht.2⟩ · exact continuousAt_subtype_val.preimage_mem_nhds ht'.1.1 · refine Subtype.preimage_coe_self_inter _ _ ▸ IsPathConnected.preimage_coe ?_ inter_subset_left exact (hS.inter ht'.1.2).isPathConnected ⟨x, x.2, mem_of_mem_nhds ht'.1.1⟩ end Module section LinearOrderedField variable (𝕜 E : Type*) [Field 𝕜] [LinearOrder 𝕜] [IsStrictOrderedRing 𝕜] [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] [IsTopologicalAddGroup 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} [LocallyConvexSpace 𝕜 E] {s t : Set E} {x : E} /-- In a locally convex space, every two disjoint convex sets such that one is compact and the other is closed admit disjoint convex open neighborhoods. -/ theorem Disjoint.exists_open_convexes (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 := IsTopologicalAddGroup.rightUniformSpace E haveI : IsUniformAddGroup E := isUniformAddGroup_of_addCommGroup 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 /-- In a locally convex space, every point `x` and closed convex set `s ∌ x` admit disjoint convex open neighborhoods. -/ lemma exists_open_convex_of_notMem (hx : x ∉ s) (hsconv : Convex 𝕜 s) (hsclosed : IsClosed s) : ∃ U V : Set E, IsOpen U ∧ IsOpen V ∧ Convex 𝕜 U ∧ Convex 𝕜 V ∧ x ∈ U ∧ s ⊆ V ∧ Disjoint U V := by simpa [*] using Disjoint.exists_open_convexes (s := {x}) (t := s) (𝕜 := 𝕜) @[deprecated (since := "2025-05-23")] alias exists_open_convex_of_not_mem := exists_open_convex_of_notMem end LinearOrderedField section LatticeOps variable {ι : Sort*} {𝕜 E F : Type*} [Semiring 𝕜] [PartialOrder 𝕜] [AddCommMonoid E] [Module 𝕜 E] [AddCommMonoid F] [Module 𝕜 F] protected theorem LocallyConvexSpace.sInf {ts : Set (TopologicalSpace E)} (h : ∀ t ∈ ts, @LocallyConvexSpace 𝕜 E _ _ _ _ t) : @LocallyConvexSpace 𝕜 E _ _ _ _ (sInf ts) := by letI : TopologicalSpace E := sInf ts refine .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 .iInf' fun i : ts => (@locallyConvexSpace_iff 𝕜 E _ _ _ _ ↑i).mp (h (↑i) i.2) x @[deprecated (since := "2025-05-05")] alias locallyConvexSpace_sInf := LocallyConvexSpace.sInf protected theorem LocallyConvexSpace.iInf {ts' : ι → TopologicalSpace E} (h' : ∀ i, @LocallyConvexSpace 𝕜 E _ _ _ _ (ts' i)) : @LocallyConvexSpace 𝕜 E _ _ _ _ (⨅ i, ts' i) := .sInf <| by rwa [forall_mem_range] @[deprecated (since := "2025-05-05")] alias locallyConvexSpace_iInf := LocallyConvexSpace.iInf protected 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 .iInf fun b => ?_ cases b <;> assumption @[deprecated (since := "2025-05-05")] alias locallyConvexSpace_inf := LocallyConvexSpace.inf protected 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 @[deprecated (since := "2025-05-05")] alias locallyConvexSpace_induced := LocallyConvexSpace.induced 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) := .iInf fun i => .induced (LinearMap.proj i) instance Prod.locallyConvexSpace [TopologicalSpace E] [TopologicalSpace F] [LocallyConvexSpace 𝕜 E] [LocallyConvexSpace 𝕜 F] : LocallyConvexSpace 𝕜 (E × F) := .inf (.induced (LinearMap.fst _ _ _)) (.induced (LinearMap.snd _ _ _)) end LatticeOps section LinearOrderedSemiring /-- A linear ordered semiring is a locally convex space over itself. -/ instance LinearOrderedSemiring.toLocallyConvexSpace {R : Type*} [TopologicalSpace R] [Semiring R] [LinearOrder R] [IsStrictOrderedRing R] [OrderTopology R] : LocallyConvexSpace R R where convex_basis x := by obtain hl | hl := isBot_or_exists_lt x · refine hl.rec ?_ _ intro refine nhds_bot_basis.to_hasBasis' ?_ ?_ · intros refine ⟨Set.Iio _, ?_, .rfl⟩ simp_all [Iio_mem_nhds, convex_Iio] · simp +contextual obtain hu | hu := isTop_or_exists_gt x · refine hu.rec ?_ _ intro refine nhds_top_basis.to_hasBasis' ?_ ?_ · intros refine ⟨Set.Ioi _, ?_, subset_rfl⟩ simp_all · simp +contextual refine (nhds_basis_Ioo' hl hu).to_hasBasis' ?_ ?_ · simp only [id_eq, and_imp, Prod.forall] exact fun _ _ h₁ h₂ ↦ ⟨_, by simp [h₁, h₂, Ioo_mem_nhds, convex_Ioo], subset_rfl⟩ · simp +contextual end LinearOrderedSemiring lemma Convex.eventually_nhdsWithin_segment {E 𝕜 : Type*} [Semiring 𝕜] [PartialOrder 𝕜] [AddCommMonoid E] [Module 𝕜 E] [TopologicalSpace E] [LocallyConvexSpace 𝕜 E] {s : Set E} (hs : Convex 𝕜 s) {x₀ : E} (hx₀s : x₀ ∈ s) {p : E → Prop} (h : ∀ᶠ x in 𝓝[s] x₀, p x) : ∀ᶠ x in 𝓝[s] x₀, ∀ y ∈ segment 𝕜 x₀ x, p y := by rw [eventually_nhdsWithin_iff, (LocallyConvexSpace.convex_basis (𝕜 := 𝕜) x₀).eventually_iff] at h ⊢ obtain ⟨u, ⟨hu_nhds, hu_convex⟩, h⟩ := h refine ⟨u, ⟨hu_nhds, hu_convex⟩, fun x hxu hxs y hy ↦ h ?_ (hs.segment_subset hx₀s hxs hy)⟩ suffices segment 𝕜 x₀ x ⊆ u from this hy exact hu_convex.segment_subset (mem_of_mem_nhds hu_nhds) hxu
.lake/packages/mathlib/Mathlib/Topology/Algebra/Module/Multilinear/Topology.lean
import Mathlib.Topology.Algebra.Module.Multilinear.Bounded import Mathlib.Topology.Algebra.Module.UniformConvergence import Mathlib.Topology.Algebra.SeparationQuotient.Section import Mathlib.Topology.Hom.ContinuousEvalConst import Mathlib.Topology.Algebra.InfiniteSum.Basic /-! # 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 Topology open scoped 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_update_add, f.map_update_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] [IsTopologicalAddGroup F] : TopologicalSpace (ContinuousMultilinearMap 𝕜 E F) := .induced toUniformOnFun <| @UniformOnFun.topologicalSpace _ _ (IsTopologicalAddGroup.rightUniformSpace F) _ instance instUniformSpace [UniformSpace F] [IsUniformAddGroup F] : UniformSpace (ContinuousMultilinearMap 𝕜 E F) := .replaceTopology (.comap toUniformOnFun <| UniformOnFun.uniformSpace _ _ _) <| by rw [instTopologicalSpace, IsUniformAddGroup.rightUniformSpace_eq]; rfl section IsUniformAddGroup variable [UniformSpace F] [IsUniformAddGroup F] lemma isUniformInducing_toUniformOnFun : IsUniformInducing (toUniformOnFun : ContinuousMultilinearMap 𝕜 E F → ((Π i, E i) →ᵤ[{s | IsVonNBounded 𝕜 s}] F)) := ⟨rfl⟩ lemma isUniformEmbedding_toUniformOnFun : IsUniformEmbedding (toUniformOnFun : ContinuousMultilinearMap 𝕜 E F → _) := ⟨isUniformInducing_toUniformOnFun, DFunLike.coe_injective⟩ lemma isEmbedding_toUniformOnFun : IsEmbedding (toUniformOnFun : ContinuousMultilinearMap 𝕜 E F → ((Π i, E i) →ᵤ[{s | IsVonNBounded 𝕜 s}] F)) := isUniformEmbedding_toUniformOnFun.isEmbedding theorem uniformContinuous_coe_fun [∀ i, ContinuousSMul 𝕜 (E i)] : UniformContinuous (DFunLike.coe : ContinuousMultilinearMap 𝕜 E F → (Π i, E i) → F) := (UniformOnFun.uniformContinuous_toFun sUnion_isVonNBounded_eq_univ).comp isUniformEmbedding_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 instIsUniformAddGroup : IsUniformAddGroup (ContinuousMultilinearMap 𝕜 E F) := let φ : ContinuousMultilinearMap 𝕜 E F →+ (Π i, E i) →ᵤ[{s | IsVonNBounded 𝕜 s}] F := { toFun := toUniformOnFun, map_add' := fun _ _ ↦ rfl, map_zero' := rfl } isUniformEmbedding_toUniformOnFun.isUniformAddGroup φ 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 isUniformEmbedding_toUniformOnFun.uniformContinuousConstSMul fun _ _ ↦ rfl theorem isUniformInducing_postcomp {G : Type*} [AddCommGroup G] [UniformSpace G] [IsUniformAddGroup G] [Module 𝕜 G] (g : F →L[𝕜] G) (hg : IsUniformInducing g) : IsUniformInducing (g.compContinuousMultilinearMap : ContinuousMultilinearMap 𝕜 E F → ContinuousMultilinearMap 𝕜 E G) := by rw [← isUniformInducing_toUniformOnFun.of_comp_iff] exact (UniformOnFun.postcomp_isUniformInducing hg).comp isUniformInducing_toUniformOnFun section CompleteSpace variable [∀ i, ContinuousSMul 𝕜 (E i)] [ContinuousConstSMul 𝕜 F] [CompleteSpace F] open UniformOnFun in theorem completeSpace (h : IsCoherentWith {s : Set (Π i, E i) | IsVonNBounded 𝕜 s}) : CompleteSpace (ContinuousMultilinearMap 𝕜 E F) := by classical wlog hF : T2Space F generalizing F · rw [(isUniformInducing_postcomp (SeparationQuotient.mkCLM _ _) SeparationQuotient.isUniformInducing_mk).completeSpace_congr] · exact this inferInstance · intro f use (SeparationQuotient.outCLM _ _).compContinuousMultilinearMap f simp [DFunLike.ext_iff] have H : ∀ {m : Π i, E i}, Continuous fun f : (Π i, E i) →ᵤ[{s | IsVonNBounded 𝕜 s}] F ↦ toFun _ f m := (uniformContinuous_eval (sUnion_isVonNBounded_eq_univ) _).continuous rw [completeSpace_iff_isComplete_range isUniformInducing_toUniformOnFun, 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, IsTopologicalAddGroup (E i)] [SequentialSpace (Π i, E i)] : CompleteSpace (ContinuousMultilinearMap 𝕜 E F) := completeSpace <| .of_seq fun _u x hux ↦ (hux.isVonNBounded_range 𝕜).insert x end CompleteSpace section RestrictScalars variable (𝕜' : Type*) [NontriviallyNormedField 𝕜'] [NormedAlgebra 𝕜' 𝕜] [∀ i, Module 𝕜' (E i)] [∀ i, IsScalarTower 𝕜' 𝕜 (E i)] [Module 𝕜' F] [IsScalarTower 𝕜' 𝕜 F] [∀ i, ContinuousSMul 𝕜 (E i)] theorem isUniformEmbedding_restrictScalars : IsUniformEmbedding (restrictScalars 𝕜' : ContinuousMultilinearMap 𝕜 E F → ContinuousMultilinearMap 𝕜' E F) := by letI : NontriviallyNormedField 𝕜 := ⟨let ⟨x, hx⟩ := @NontriviallyNormedField.non_trivial 𝕜' _; ⟨algebraMap 𝕜' 𝕜 x, by simpa⟩⟩ rw [← isUniformEmbedding_toUniformOnFun.of_comp_iff] convert isUniformEmbedding_toUniformOnFun using 4 with s exact ⟨fun h ↦ h.extend_scalars _, fun h ↦ h.restrict_scalars _⟩ theorem uniformContinuous_restrictScalars : UniformContinuous (restrictScalars 𝕜' : ContinuousMultilinearMap 𝕜 E F → ContinuousMultilinearMap 𝕜' E F) := (isUniformEmbedding_restrictScalars 𝕜').uniformContinuous end RestrictScalars end IsUniformAddGroup variable [TopologicalSpace F] [IsTopologicalAddGroup F] instance instIsTopologicalAddGroup : IsTopologicalAddGroup (ContinuousMultilinearMap 𝕜 E F) := letI := IsTopologicalAddGroup.rightUniformSpace F haveI := isUniformAddGroup_of_addCommGroup (G := F) inferInstance instance instContinuousConstSMul {M : Type*} [Monoid M] [DistribMulAction M F] [SMulCommClass 𝕜 M F] [ContinuousConstSMul M F] : ContinuousConstSMul M (ContinuousMultilinearMap 𝕜 E F) := by letI := IsTopologicalAddGroup.rightUniformSpace F haveI := isUniformAddGroup_of_addCommGroup (G := F) infer_instance instance instContinuousSMul [ContinuousSMul 𝕜 F] : ContinuousSMul 𝕜 (ContinuousMultilinearMap 𝕜 E F) := letI := IsTopologicalAddGroup.rightUniformSpace F haveI := isUniformAddGroup_of_addCommGroup (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 _ _ _ _ φ isEmbedding_toUniformOnFun.isInducing 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 := IsTopologicalAddGroup.rightUniformSpace F haveI : IsUniformAddGroup F := isUniformAddGroup_of_addCommGroup 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)] instance : ContinuousEvalConst (ContinuousMultilinearMap 𝕜 E F) (Π i, E i) F where continuous_eval_const x := let _ := IsTopologicalAddGroup.rightUniformSpace F have _ := isUniformAddGroup_of_addCommGroup (G := F) (uniformContinuous_eval_const x).continuous instance instT2Space [T2Space F] : T2Space (ContinuousMultilinearMap 𝕜 E F) := .of_injective_continuous DFunLike.coe_injective continuous_coeFun instance instT3Space [T2Space F] : T3Space (ContinuousMultilinearMap 𝕜 E F) := inferInstance section RestrictScalars variable {𝕜' : Type*} [NontriviallyNormedField 𝕜'] [NormedAlgebra 𝕜' 𝕜] [∀ i, Module 𝕜' (E i)] [∀ i, IsScalarTower 𝕜' 𝕜 (E i)] [Module 𝕜' F] [IsScalarTower 𝕜' 𝕜 F] theorem isEmbedding_restrictScalars : IsEmbedding (restrictScalars 𝕜' : ContinuousMultilinearMap 𝕜 E F → ContinuousMultilinearMap 𝕜' E F) := letI : UniformSpace F := IsTopologicalAddGroup.rightUniformSpace F haveI : IsUniformAddGroup F := isUniformAddGroup_of_addCommGroup (isUniformEmbedding_restrictScalars _).isEmbedding @[continuity, fun_prop] theorem continuous_restrictScalars : Continuous (restrictScalars 𝕜' : ContinuousMultilinearMap 𝕜 E F → ContinuousMultilinearMap 𝕜' E F) := isEmbedding_restrictScalars.continuous variable (𝕜') in /-- `ContinuousMultilinearMap.restrictScalars` as a `ContinuousLinearMap`. -/ @[simps -fullyApplied apply] def restrictScalarsLinear [ContinuousConstSMul 𝕜' F] : ContinuousMultilinearMap 𝕜 E F →L[𝕜'] ContinuousMultilinearMap 𝕜' E F where toFun := restrictScalars 𝕜' map_add' _ _ := rfl map_smul' _ _ := rfl end RestrictScalars 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
.lake/packages/mathlib/Mathlib/Topology/Algebra/Module/Multilinear/Basic.lean
import Mathlib.Topology.Algebra.Module.LinearMapPiProd import Mathlib.LinearAlgebra.Multilinear.Basic import Mathlib.Algebra.BigOperators.Fin /-! # 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 /-- 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_update_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_update_add' m i x y @[simp] theorem map_update_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_update_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. -/ @[simps!] 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.prodMk 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⟩ 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.prod` as an `Equiv`. -/ @[simps apply symm_apply_fst symm_apply_snd, simps -isSimp symm_apply] def prodEquiv : (ContinuousMultilinearMap R M₁ M₂ × ContinuousMultilinearMap R M₁ M₃) ≃ ContinuousMultilinearMap R M₁ (M₂ × M₃) where toFun f := f.1.prod f.2 invFun f := ((ContinuousLinearMap.fst _ _ _).compContinuousMultilinearMap f, (ContinuousLinearMap.snd _ _ _).compContinuousMultilinearMap f) theorem prod_ext_iff {f g : ContinuousMultilinearMap R M₁ (M₂ × M₃)} : f = g ↔ (ContinuousLinearMap.fst _ _ _).compContinuousMultilinearMap f = (ContinuousLinearMap.fst _ _ _).compContinuousMultilinearMap g ∧ (ContinuousLinearMap.snd _ _ _).compContinuousMultilinearMap f = (ContinuousLinearMap.snd _ _ _).compContinuousMultilinearMap g := by rw [← Prod.mk_inj, ← prodEquiv_symm_apply, ← prodEquiv_symm_apply, Equiv.apply_eq_iff_eq] @[ext] theorem prod_ext {f g : ContinuousMultilinearMap R M₁ (M₂ × M₃)} (h₁ : (ContinuousLinearMap.fst _ _ _).compContinuousMultilinearMap f = (ContinuousLinearMap.fst _ _ _).compContinuousMultilinearMap g) (h₂ : (ContinuousLinearMap.snd _ _ _).compContinuousMultilinearMap f = (ContinuousLinearMap.snd _ _ _).compContinuousMultilinearMap g) : f = g := prod_ext_iff.mpr ⟨h₁, h₂⟩ theorem eq_prod_iff {f : ContinuousMultilinearMap R M₁ (M₂ × M₃)} {g : ContinuousMultilinearMap R M₁ M₂} {h : ContinuousMultilinearMap R M₁ M₃} : f = g.prod h ↔ (ContinuousLinearMap.fst _ _ _).compContinuousMultilinearMap f = g ∧ (ContinuousLinearMap.snd _ _ _).compContinuousMultilinearMap f = h := prod_ext_iff theorem add_prod_add [ContinuousAdd M₂] [ContinuousAdd M₃] (f₁ f₂ : ContinuousMultilinearMap R M₁ M₂) (g₁ g₂ : ContinuousMultilinearMap R M₁ M₃) : (f₁ + f₂).prod (g₁ + g₂) = f₁.prod g₁ + f₂.prod g₂ := rfl theorem smul_prod_smul {S : Type*} [Monoid S] [DistribMulAction S M₂] [DistribMulAction S M₃] [ContinuousConstSMul S M₂] [SMulCommClass R S M₂] [ContinuousConstSMul S M₃] [SMulCommClass R S M₃] (c : S) (f : ContinuousMultilinearMap R M₁ M₂) (g : ContinuousMultilinearMap R M₁ M₃) : (c • f).prod (c • g) = c • f.prod g := rfl @[simp] theorem zero_prod_zero : (0 : ContinuousMultilinearMap R M₁ M₂).prod (0 : ContinuousMultilinearMap R M₁ M₃) = 0 := 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 /-- 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', 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_update_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_update_sub _ _ _ _ section IsTopologicalAddGroup variable [IsTopologicalAddGroup 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 theorem neg_prod_neg [AddCommGroup M₃] [Module R M₃] [TopologicalSpace M₃] [IsTopologicalAddGroup M₃] (f : ContinuousMultilinearMap R M₁ M₂) (g : ContinuousMultilinearMap R M₁ M₃) : (-f).prod (-g) = - f.prod g := rfl theorem sub_prod_sub [AddCommGroup M₃] [Module R M₃] [TopologicalSpace M₃] [IsTopologicalAddGroup M₃] (f₁ f₂ : ContinuousMultilinearMap R M₁ M₂) (g₁ g₂ : ContinuousMultilinearMap R M₁ M₃) : (f₁ - f₂).prod (g₁ - g₂) = f₁.prod g₁ - f₂.prod g₂ := rfl end IsTopologicalAddGroup 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 _ _ /-- If two continuous `R`-multilinear maps from `R` are equal on 1, then they are equal. This is the multilinear version of `ContinuousLinearMap.ext_ring`. -/ @[ext] theorem ext_ring [Finite ι] [TopologicalSpace R] ⦃f g : ContinuousMultilinearMap R (fun _ : ι => R) M₂⦄ (h : f (fun _ ↦ 1) = g (fun _ ↦ 1)) : f = g := toMultilinearMap_injective <| MultilinearMap.ext_ring h 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 +simpRhs] 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 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 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 theorem mkPiAlgebra_eq_mkPiAlgebraFin {n : ℕ} : ContinuousMultilinearMap.mkPiAlgebra R (Fin n) A = ContinuousMultilinearMap.mkPiAlgebraFin R n A := by ext simp [List.prod_ofFn] end CommAlgebra 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
.lake/packages/mathlib/Mathlib/Topology/Algebra/Module/Multilinear/Bounded.lean
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 f (update y i₀ ((a / ∏ i ∈ I, c i) • y i₀)) ∈ V := hft fun i hi => by rcases eq_or_ne i i₀ with rfl | hne · simp_rw [update_self, 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_of_ne hne, y, I.piecewise_eq_of_mem _ _ hi] exact hc _ _ le_rfl _ hx _ = a • f x := by rw [f.map_update_smul, update_eq_self, f.map_piecewise_smul, div_eq_mul_inv, mul_smul, inv_smul_smul₀ hc₀'] /-- 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
.lake/packages/mathlib/Mathlib/Topology/Algebra/Module/Alternating/Topology.lean
import Mathlib.Topology.Algebra.Module.Multilinear.Topology import Mathlib.Topology.Algebra.Module.Alternating.Basic /-! # Topology on continuous alternating maps In this file we define `UniformSpace` and `TopologicalSpace` structures on the space of continuous alternating maps between topological vector spaces. The structures are induced by those on `ContinuousMultilinearMap`s, and most of the lemmas follow from the corresponding lemmas about `ContinuousMultilinearMap`s. -/ open Bornology Function Set Topology open scoped UniformConvergence Filter namespace ContinuousAlternatingMap variable {𝕜 E F ι : Type*} [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] [AddCommGroup F] [Module 𝕜 F] section IsClosedRange variable [TopologicalSpace F] [IsTopologicalAddGroup F] instance instTopologicalSpace : TopologicalSpace (E [⋀^ι]→L[𝕜] F) := .induced toContinuousMultilinearMap inferInstance lemma isClosed_range_toContinuousMultilinearMap [ContinuousSMul 𝕜 E] [T2Space F] : IsClosed (Set.range (toContinuousMultilinearMap : (E [⋀^ι]→L[𝕜] F) → ContinuousMultilinearMap 𝕜 (fun _ : ι ↦ E) F)) := by simp only [range_toContinuousMultilinearMap, setOf_forall] repeat refine isClosed_iInter fun _ ↦ ?_ exact isClosed_singleton.preimage (continuous_eval_const _) end IsClosedRange section IsUniformAddGroup variable [UniformSpace F] [IsUniformAddGroup F] instance instUniformSpace : UniformSpace (E [⋀^ι]→L[𝕜] F) := .comap toContinuousMultilinearMap inferInstance lemma isUniformEmbedding_toContinuousMultilinearMap : IsUniformEmbedding (toContinuousMultilinearMap : (E [⋀^ι]→L[𝕜] F) → _) where injective := toContinuousMultilinearMap_injective comap_uniformity := rfl lemma uniformContinuous_toContinuousMultilinearMap : UniformContinuous (toContinuousMultilinearMap : (E [⋀^ι]→L[𝕜] F) → _) := isUniformEmbedding_toContinuousMultilinearMap.uniformContinuous theorem uniformContinuous_coe_fun [ContinuousSMul 𝕜 E] : UniformContinuous (DFunLike.coe : (E [⋀^ι]→L[𝕜] F) → (ι → E) → F) := ContinuousMultilinearMap.uniformContinuous_coe_fun.comp uniformContinuous_toContinuousMultilinearMap theorem uniformContinuous_eval_const [ContinuousSMul 𝕜 E] (x : ι → E) : UniformContinuous fun f : E [⋀^ι]→L[𝕜] F ↦ f x := uniformContinuous_pi.1 uniformContinuous_coe_fun x instance instIsUniformAddGroup : IsUniformAddGroup (E [⋀^ι]→L[𝕜] F) := isUniformEmbedding_toContinuousMultilinearMap.isUniformAddGroup (toContinuousMultilinearMapLinear (R := ℕ)) instance instUniformContinuousConstSMul {M : Type*} [Monoid M] [DistribMulAction M F] [SMulCommClass 𝕜 M F] [ContinuousConstSMul M F] : UniformContinuousConstSMul M (E [⋀^ι]→L[𝕜] F) := isUniformEmbedding_toContinuousMultilinearMap.uniformContinuousConstSMul fun _ _ ↦ rfl theorem isUniformInducing_postcomp {G : Type*} [AddCommGroup G] [UniformSpace G] [IsUniformAddGroup G] [Module 𝕜 G] (g : F →L[𝕜] G) (hg : IsUniformInducing g) : IsUniformInducing (g.compContinuousAlternatingMap : (E [⋀^ι]→L[𝕜] F) → (E [⋀^ι]→L[𝕜] G)) := by rw [← isUniformEmbedding_toContinuousMultilinearMap.1.of_comp_iff] exact (ContinuousMultilinearMap.isUniformInducing_postcomp g hg).comp isUniformEmbedding_toContinuousMultilinearMap.1 section CompleteSpace variable [ContinuousSMul 𝕜 E] [ContinuousConstSMul 𝕜 F] [CompleteSpace F] open UniformOnFun in theorem completeSpace (h : IsCoherentWith {s : Set (ι → E) | IsVonNBounded 𝕜 s}) : CompleteSpace (E [⋀^ι]→L[𝕜] F) := by wlog hF : T2Space F generalizing F · rw [(isUniformInducing_postcomp (SeparationQuotient.mkCLM _ _) SeparationQuotient.isUniformInducing_mk).completeSpace_congr] · exact this inferInstance · intro f use (SeparationQuotient.outCLM _ _).compContinuousAlternatingMap f ext simp have := ContinuousMultilinearMap.completeSpace (F := F) h rw [completeSpace_iff_isComplete_range isUniformEmbedding_toContinuousMultilinearMap.isUniformInducing] apply isClosed_range_toContinuousMultilinearMap.isComplete instance instCompleteSpace [IsTopologicalAddGroup E] [SequentialSpace (ι → E)] : CompleteSpace (E [⋀^ι]→L[𝕜] F) := completeSpace <| .of_seq fun _u x hux ↦ (hux.isVonNBounded_range 𝕜).insert x end CompleteSpace section RestrictScalars variable (𝕜' : Type*) [NontriviallyNormedField 𝕜'] [NormedAlgebra 𝕜' 𝕜] [Module 𝕜' E] [IsScalarTower 𝕜' 𝕜 E] [Module 𝕜' F] [IsScalarTower 𝕜' 𝕜 F] [ContinuousSMul 𝕜 E] theorem isUniformEmbedding_restrictScalars : IsUniformEmbedding (restrictScalars 𝕜' : E [⋀^ι]→L[𝕜] F → E [⋀^ι]→L[𝕜'] F) := by rw [← isUniformEmbedding_toContinuousMultilinearMap.of_comp_iff] exact (ContinuousMultilinearMap.isUniformEmbedding_restrictScalars 𝕜').comp isUniformEmbedding_toContinuousMultilinearMap theorem uniformContinuous_restrictScalars : UniformContinuous (restrictScalars 𝕜' : E [⋀^ι]→L[𝕜] F → E [⋀^ι]→L[𝕜'] F) := (isUniformEmbedding_restrictScalars 𝕜').uniformContinuous end RestrictScalars end IsUniformAddGroup variable [TopologicalSpace F] [IsTopologicalAddGroup F] lemma isEmbedding_toContinuousMultilinearMap : IsEmbedding (toContinuousMultilinearMap : (E [⋀^ι]→L[𝕜] F → _)) := letI := IsTopologicalAddGroup.rightUniformSpace F haveI := isUniformAddGroup_of_addCommGroup (G := F) isUniformEmbedding_toContinuousMultilinearMap.isEmbedding instance instIsTopologicalAddGroup : IsTopologicalAddGroup (E [⋀^ι]→L[𝕜] F) := isEmbedding_toContinuousMultilinearMap.topologicalAddGroup (toContinuousMultilinearMapLinear (R := ℕ)) @[continuity, fun_prop] lemma continuous_toContinuousMultilinearMap : Continuous (toContinuousMultilinearMap : (E [⋀^ι]→L[𝕜] F → _)) := isEmbedding_toContinuousMultilinearMap.continuous instance instContinuousConstSMul {M : Type*} [Monoid M] [DistribMulAction M F] [SMulCommClass 𝕜 M F] [ContinuousConstSMul M F] : ContinuousConstSMul M (E [⋀^ι]→L[𝕜] F) := isEmbedding_toContinuousMultilinearMap.continuousConstSMul id rfl instance instContinuousSMul [ContinuousSMul 𝕜 F] : ContinuousSMul 𝕜 (E [⋀^ι]→L[𝕜] F) := isEmbedding_toContinuousMultilinearMap.continuousSMul continuous_id rfl theorem hasBasis_nhds_zero_of_basis {ι' : Type*} {p : ι' → Prop} {b : ι' → Set F} (h : (𝓝 (0 : F)).HasBasis p b) : (𝓝 (0 : E [⋀^ι]→L[𝕜] F)).HasBasis (fun Si : Set (ι → E) × ι' => IsVonNBounded 𝕜 Si.1 ∧ p Si.2) fun Si => { f | MapsTo f Si.1 (b Si.2) } := by rw [nhds_induced] exact (ContinuousMultilinearMap.hasBasis_nhds_zero_of_basis h).comap _ theorem hasBasis_nhds_zero : (𝓝 (0 : E [⋀^ι]→L[𝕜] F)).HasBasis (fun SV : Set (ι → E) × 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 [ContinuousSMul 𝕜 E] lemma isClosedEmbedding_toContinuousMultilinearMap [T2Space F] : IsClosedEmbedding (toContinuousMultilinearMap : (E [⋀^ι]→L[𝕜] F) → ContinuousMultilinearMap 𝕜 (fun _ : ι ↦ E) F) := ⟨isEmbedding_toContinuousMultilinearMap, isClosed_range_toContinuousMultilinearMap⟩ instance instContinuousEvalConst : ContinuousEvalConst (E [⋀^ι]→L[𝕜] F) (ι → E) F := .of_continuous_forget continuous_toContinuousMultilinearMap instance instT2Space [T2Space F] : T2Space (E [⋀^ι]→L[𝕜] F) := .of_injective_continuous DFunLike.coe_injective continuous_coeFun instance instT3Space [T2Space F] : T3Space (E [⋀^ι]→L[𝕜] F) := inferInstance /-- The inclusion of *alternating* continuous multi-linear maps into continuous multi-linear maps as a continuous linear map. -/ @[simps! -fullyApplied] def toContinuousMultilinearMapCLM (R : Type*) [Semiring R] [Module R F] [ContinuousConstSMul R F] [SMulCommClass 𝕜 R F] : E [⋀^ι]→L[𝕜] F →L[R] ContinuousMultilinearMap 𝕜 (fun _ : ι ↦ E) F := ⟨toContinuousMultilinearMapLinear, continuous_induced_dom⟩ section RestrictScalars variable {𝕜' : Type*} [NontriviallyNormedField 𝕜'] [NormedAlgebra 𝕜' 𝕜] [Module 𝕜' E] [IsScalarTower 𝕜' 𝕜 E] [Module 𝕜' F] [IsScalarTower 𝕜' 𝕜 F] theorem isEmbedding_restrictScalars : IsEmbedding (restrictScalars 𝕜' : E [⋀^ι]→L[𝕜] F → E [⋀^ι]→L[𝕜'] F) := letI : UniformSpace F := IsTopologicalAddGroup.rightUniformSpace F haveI : IsUniformAddGroup F := isUniformAddGroup_of_addCommGroup (isUniformEmbedding_restrictScalars _).isEmbedding @[continuity, fun_prop] theorem continuous_restrictScalars : Continuous (restrictScalars 𝕜' : E [⋀^ι]→L[𝕜] F → E [⋀^ι]→L[𝕜'] F) := isEmbedding_restrictScalars.continuous variable (𝕜') in /-- `ContinuousMultilinearMap.restrictScalars` as a `ContinuousLinearMap`. -/ @[simps -fullyApplied apply] def restrictScalarsCLM [ContinuousConstSMul 𝕜' F] : E [⋀^ι]→L[𝕜] F →L[𝕜'] E [⋀^ι]→L[𝕜'] F where toFun := restrictScalars 𝕜' map_add' _ _ := rfl map_smul' _ _ := rfl end RestrictScalars variable (𝕜 E F) /-- The application of a multilinear map as a `ContinuousLinearMap`. -/ def apply [ContinuousConstSMul 𝕜 F] (m : ι → E) : E [⋀^ι]→L[𝕜] 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 : ι → E} {c : E [⋀^ι]→L[𝕜] F} : apply 𝕜 E F m c = c m := rfl theorem hasSum_eval {α : Type*} {p : α → E [⋀^ι]→L[𝕜] F} {q : E [⋀^ι]→L[𝕜] F} (h : HasSum p q) (m : ι → E) : HasSum (fun a => p a m) (q m) := h.map (applyAddHom m) (continuous_eval_const m) theorem tsum_eval [T2Space F] {α : Type*} {p : α → E [⋀^ι]→L[𝕜] F} (hp : Summable p) (m : ι → E) : (∑' a, p a) m = ∑' a, p a m := (hasSum_eval hp.hasSum m).tsum_eq.symm end ContinuousAlternatingMap
.lake/packages/mathlib/Mathlib/Topology/Algebra/Module/Alternating/Basic.lean
import Mathlib.LinearAlgebra.Alternating.Basic import Mathlib.LinearAlgebra.BilinearMap import Mathlib.Topology.Algebra.Module.Equiv 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_update_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_update_add' m i x y @[simp] theorem map_update_smul [DecidableEq ι] (m : ι → M) (i : ι) (c : R) (x : M) : f (update m i (c • x)) = c • f (update m i x) := f.map_update_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 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. This is available as a continuous linear isomorphism at `ContinuousLinearEquiv.continuousAlternatingMapCongrLeft`. This is `ContinuousAlternatingMap.compContinuousLinearMap` as an equivalence. -/ @[simps -fullyApplied apply] def _root_.ContinuousLinearEquiv.continuousAlternatingMapCongrLeftEquiv (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 [Function.comp_def] right_inv f := by ext; simp [Function.comp_def] /-- A continuous linear equivalence of codomains defines an equivalence between continuous alternating maps. -/ @[simps -fullyApplied apply] def _root_.ContinuousLinearEquiv.continuousAlternatingMapCongrRightEquiv (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.continuousAlternatingMapCongrRightEquiv f) = e ∘ f := rfl /-- Continuous linear equivalences between domains and codomains define an equivalence between the spaces of continuous alternating maps. -/ def _root_.ContinuousLinearEquiv.continuousAlternatingMapCongrEquiv (e : M ≃L[R] M') (e' : N ≃L[R] N') : M [⋀^ι]→L[R] N ≃ M' [⋀^ι]→L[R] N' := e.continuousAlternatingMapCongrLeftEquiv.trans e'.continuousAlternatingMapCongrRightEquiv /-- `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 /-- 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 N ι : Type*} [Ring R] [AddCommGroup M] [Module R M] [TopologicalSpace M] [AddCommGroup N] [Module R N] [TopologicalSpace N] (f g : M [⋀^ι]→L[R] N) @[simp] theorem map_update_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_update_sub _ _ _ _ section IsTopologicalAddGroup variable [IsTopologicalAddGroup 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 IsTopologicalAddGroup end Ring section CommSemiring variable {R M N ι : Type*} [CommSemiring R] [AddCommMonoid M] [Module R M] [TopologicalSpace M] [AddCommMonoid N] [Module R N] [TopologicalSpace N] (f : 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 _ _ /-- If two continuous `R`-alternating maps from `R` are equal on 1, then they are equal. This is the alternating version of `ContinuousLinearMap.ext_ring`. -/ @[ext] theorem ext_ring [Finite ι] [TopologicalSpace R] ⦃f g : R [⋀^ι]→L[R] M⦄ (h : f (fun _ ↦ 1) = g (fun _ ↦ 1)) : f = g := toAlternatingMap_injective <| AlternatingMap.ext_ring h /-- The only continuous `R`-alternating map from two or more copies of `R` is the zero map. -/ instance uniqueOfCommRing [Finite ι] [Nontrivial ι] [TopologicalSpace R] : Unique (R [⋀^ι]→L[R] N) where uniq _ := toAlternatingMap_injective <| Subsingleton.elim _ _ 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 -fullyApplied 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 +simpRhs] 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 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 _ _ _ => rfl) (fun _ _ _ => 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] [IsTopologicalAddGroup N] [Fintype ι] [DecidableEq ι] (f : ContinuousMultilinearMap R (fun _ : ι => M) N) /-- Alternatization of a continuous multilinear map. -/ @[simps -isSimp 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, Function.comp_def] @[simp] theorem alternatization_apply_toAlternatingMap : (alternatization f).toAlternatingMap = MultilinearMap.alternatization f.1 := by ext v simp [alternatization_apply_apply, MultilinearMap.alternatization_apply, Function.comp_def] end ContinuousMultilinearMap
.lake/packages/mathlib/Mathlib/Topology/Algebra/Constructions/DomMulAct.lean
import Mathlib.Topology.Homeomorph.Lemmas import Mathlib.GroupTheory.GroupAction.DomAct.Basic /-! # Topological space structure on `Mᵈᵐᵃ` and `Mᵈᵃᵃ` In this file we define `TopologicalSpace` structure on `Mᵈᵐᵃ` and `Mᵈᵃᵃ` and prove basic theorems about these topologies. The topologies on `Mᵈᵐᵃ` and `Mᵈᵃᵃ` are the same as the topology on `M`. Formally, they are induced by `DomMulAct.mk.symm` and `DomAddAct.mk.symm`, since the types aren't definitionally equal. ## Tags topological space, group action, domain action -/ open Filter TopologicalSpace Topology namespace DomMulAct variable {M : Type*} [TopologicalSpace M] /-- Put the same topological space structure on `Mᵈᵐᵃ` as on the original space. -/ @[to_additive /-- Put the same topological space structure on `Mᵈᵃᵃ` as on the original space. -/] 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 continuous_toFun := by dsimp; fun_prop continuous_invFun := by dsimp; fun_prop @[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 isInducing_mk : IsInducing (@mk M) := mkHomeomorph.isInducing @[to_additive] theorem isEmbedding_mk : IsEmbedding (@mk M) := mkHomeomorph.isEmbedding @[to_additive] theorem isOpenEmbedding_mk : IsOpenEmbedding (@mk M) := mkHomeomorph.isOpenEmbedding @[to_additive] theorem isClosedEmbedding_mk : IsClosedEmbedding (@mk M) := mkHomeomorph.isClosedEmbedding @[to_additive] theorem isQuotientMap_mk : IsQuotientMap (@mk M) := mkHomeomorph.isQuotientMap @[to_additive] theorem isInducing_mk_symm : IsInducing (@mk M).symm := mkHomeomorph.symm.isInducing @[to_additive] theorem isEmbedding_mk_symm : IsEmbedding (@mk M).symm := mkHomeomorph.symm.isEmbedding @[to_additive] theorem isOpenEmbedding_mk_symm : IsOpenEmbedding (@mk M).symm := mkHomeomorph.symm.isOpenEmbedding @[to_additive] theorem isClosedEmbedding_mk_symm : IsClosedEmbedding (@mk M).symm := mkHomeomorph.symm.isClosedEmbedding @[to_additive] theorem isQuotientMap_mk_symm : IsQuotientMap (@mk M).symm := mkHomeomorph.symm.isQuotientMap @[to_additive] instance instT0Space [T0Space M] : T0Space Mᵈᵐᵃ := mkHomeomorph.t0Space @[to_additive] instance instT1Space [T1Space M] : T1Space Mᵈᵐᵃ := mkHomeomorph.t1Space @[to_additive] instance instT2Space [T2Space M] : T2Space Mᵈᵐᵃ := mkHomeomorph.t2Space @[to_additive] instance instT25Space [T25Space M] : T25Space Mᵈᵐᵃ := mkHomeomorph.t25Space @[to_additive] instance instT3Space [T3Space M] : T3Space Mᵈᵐᵃ := mkHomeomorph.t3Space @[to_additive] instance instT4Space [T4Space M] : T4Space Mᵈᵐᵃ := mkHomeomorph.t4Space @[to_additive] instance instT5Space [T5Space M] : T5Space Mᵈᵐᵃ := mkHomeomorph.t5Space @[to_additive] instance instR0Space [R0Space M] : R0Space Mᵈᵐᵃ := isEmbedding_mk_symm.r0Space @[to_additive] instance instR1Space [R1Space M] : R1Space Mᵈᵐᵃ := isEmbedding_mk_symm.r1Space @[to_additive] instance instRegularSpace [RegularSpace M] : RegularSpace Mᵈᵐᵃ := isEmbedding_mk_symm.regularSpace @[to_additive] instance instNormalSpace [NormalSpace M] : NormalSpace Mᵈᵐᵃ := mkHomeomorph.normalSpace @[to_additive] instance instCompletelyNormalSpace [CompletelyNormalSpace M] : CompletelyNormalSpace Mᵈᵐᵃ := isEmbedding_mk_symm.completelyNormalSpace @[to_additive] instance instDiscreteTopology [DiscreteTopology M] : DiscreteTopology Mᵈᵐᵃ := isEmbedding_mk_symm.discreteTopology @[to_additive] instance instSeparableSpace [SeparableSpace M] : SeparableSpace Mᵈᵐᵃ := isQuotientMap_mk.separableSpace @[to_additive] instance instFirstCountableTopology [FirstCountableTopology M] : FirstCountableTopology Mᵈᵐᵃ := isInducing_mk_symm.firstCountableTopology @[to_additive] instance instSecondCountableTopology [SecondCountableTopology M] : SecondCountableTopology Mᵈᵐᵃ := isInducing_mk_symm.secondCountableTopology @[to_additive] instance instCompactSpace [CompactSpace M] : CompactSpace Mᵈᵐᵃ := mkHomeomorph.compactSpace @[to_additive] instance instLocallyCompactSpace [LocallyCompactSpace M] : LocallyCompactSpace Mᵈᵐᵃ := isOpenEmbedding_mk_symm.locallyCompactSpace @[to_additive] instance instWeaklyLocallyCompactSpace [WeaklyLocallyCompactSpace M] : WeaklyLocallyCompactSpace Mᵈᵐᵃ := isClosedEmbedding_mk_symm.weaklyLocallyCompactSpace @[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
.lake/packages/mathlib/Mathlib/Topology/Algebra/MetricSpace/Lipschitz.lean
import Mathlib.Topology.Algebra.Order.Field import Mathlib.Topology.MetricSpace.Lipschitz /-! # Lipschitz continuous functions This file develops Lipschitz continuous functions further with some results that depend on algebra. -/ assert_not_exists Module.Basis Ideal open Filter Set NNReal Metric variable {α β : Type*} [PseudoMetricSpace α] [PseudoMetricSpace β] {K : ℝ≥0} lemma LipschitzWith.cauchySeq_comp {f : α → β} (hf : LipschitzWith K f) {u : ℕ → α} (hu : CauchySeq u) : CauchySeq (f ∘ u) := by rcases cauchySeq_iff_le_tendsto_0.1 hu with ⟨b, b_nonneg, hb, blim⟩ refine cauchySeq_iff_le_tendsto_0.2 ⟨fun n ↦ K * b n, ?_, ?_, ?_⟩ · exact fun n ↦ mul_nonneg (by positivity) (b_nonneg n) · exact fun n m N hn hm ↦ hf.dist_le_mul_of_le (hb n m N hn hm) · rw [← mul_zero (K : ℝ)] exact blim.const_mul _ lemma LipschitzOnWith.cauchySeq_comp {s : Set α} {f : α → β} (hf : LipschitzOnWith K f s) {u : ℕ → α} (hu : CauchySeq u) (h'u : range u ⊆ s) : CauchySeq (f ∘ u) := by rcases cauchySeq_iff_le_tendsto_0.1 hu with ⟨b, b_nonneg, hb, blim⟩ refine cauchySeq_iff_le_tendsto_0.2 ⟨fun n ↦ K * b n, ?_, ?_, ?_⟩ · exact fun n ↦ mul_nonneg (by positivity) (b_nonneg n) · intro n m N hn hm have A n : u n ∈ s := h'u (mem_range_self _) apply (hf.dist_le_mul _ (A n) _ (A m)).trans exact mul_le_mul_of_nonneg_left (hb n m N hn hm) K.2 · rw [← mul_zero (K : ℝ)] exact blim.const_mul _ /-- If a function is locally Lipschitz around a point, then it is continuous at this point. -/ theorem continuousAt_of_locally_lipschitz {f : α → β} {x : α} {r : ℝ} (hr : 0 < r) (K : ℝ) (h : ∀ y, dist y x < r → dist (f y) (f x) ≤ K * dist y x) : ContinuousAt f x := by -- We use `h` to squeeze `dist (f y) (f x)` between `0` and `K * dist y x` refine tendsto_iff_dist_tendsto_zero.2 (squeeze_zero' (Eventually.of_forall fun _ => dist_nonneg) (mem_of_superset (ball_mem_nhds _ hr) h) ?_) -- Then show that `K * dist y x` tends to zero as `y → x` refine (continuous_const.mul (continuous_id.dist continuous_const)).tendsto' _ _ ?_ simp
.lake/packages/mathlib/Mathlib/Topology/Algebra/Star/Unitary.lean
import Mathlib.Algebra.Star.Unitary import Mathlib.Topology.Algebra.Group.Defs import Mathlib.Topology.Algebra.Star import Mathlib.Topology.Algebra.Monoid /-! # Topological properties of the unitary (sub)group * In a topological star monoid `R`, `unitary R` is a topological group * In a topological star monoid `R` which is T1, `unitary R` is closed as a subset of `R`. -/ variable {R : Type*} [Monoid R] [StarMul R] [TopologicalSpace R] instance [ContinuousStar R] : ContinuousStar (unitary R) where continuous_star := continuous_induced_rng.mpr continuous_subtype_val.star instance [ContinuousStar R] : ContinuousInv (unitary R) where continuous_inv := continuous_star instance [ContinuousMul R] [ContinuousStar R] : IsTopologicalGroup (unitary R) where lemma isClosed_unitary [T1Space R] [ContinuousStar R] [ContinuousMul R] : IsClosed (unitary R : Set R) := by let f (u : R) : R × R := (star u * u, u * star u) have hf : f ⁻¹' {(1, 1)} = unitary R := by ext u; simp [f, Unitary.mem_iff] rw [← hf] exact isClosed_singleton.preimage (by fun_prop)
.lake/packages/mathlib/Mathlib/Topology/Algebra/Star/Real.lean
import Mathlib.Data.NNReal.Star import Mathlib.Topology.Algebra.Star import Mathlib.Topology.MetricSpace.Pseudo.Constructions /-! # Topological properties of conjugation on ℝ -/ assert_not_exists IsTopologicalRing UniformContinuousConstSMul UniformOnFun noncomputable section instance : ContinuousStar ℝ := ⟨continuous_id⟩ namespace NNReal instance : ContinuousStar ℝ≥0 where continuous_star := continuous_id end NNReal
.lake/packages/mathlib/Mathlib/Topology/Algebra/IsUniformGroup/DiscreteSubgroup.lean
import Mathlib.GroupTheory.Commensurable import Mathlib.Topology.Algebra.ContinuousMonoidHom import Mathlib.Topology.Algebra.Group.ClosedSubgroup import Mathlib.Topology.Algebra.IsUniformGroup.Basic /-! # Discrete subgroups of topological groups Note that the instance `Subgroup.isClosed_of_discrete` does not live here, in order that it can be used in other files without requiring lots of group-theoretic imports. -/ open Filter Topology Uniformity variable {G : Type*} [Group G] [TopologicalSpace G] /-- If `G` has a topology, and `H ≤ K` are subgroups, then `H` as a subgroup of `K` is isomorphic, as a topological group, to `H` as a subgroup of `G`. This is `subgroupOfEquivOfLe` upgraded to a `ContinuousMulEquiv`. -/ @[to_additive (attr := simps! apply) /-- If `G` has a topology, and `H ≤ K` are subgroups, then `H` as a subgroup of `K` is isomorphic, as a topological group, to `H` as a subgroup of `G`. This is `addSubgroupOfEquivOfLe` upgraded to a `ContinuousAddEquiv`.-/] def Subgroup.subgroupOfContinuousMulEquivOfLe {H K : Subgroup G} (hHK : H ≤ K) : (H.subgroupOf K) ≃ₜ* H := (subgroupOfEquivOfLe hHK).toContinuousMulEquiv (by simp only [subgroupOfEquivOfLe, Topology.IsInducing.subtypeVal.isOpen_iff, exists_exists_and_eq_and] simpa [Set.ext_iff] using fun s ↦ exists_congr fun t ↦ and_congr_right fun _ ↦ ⟨fun aux g hgh ↦ aux g (hHK hgh) hgh, by grind⟩) @[to_additive (attr := simp)] lemma Subgroup.subgroupOfContinuousMulEquivOfLe_symm_apply {H K : Subgroup G} (hHK : H ≤ K) (g : H) : (subgroupOfContinuousMulEquivOfLe hHK).symm g = ⟨⟨g.1, hHK g.2⟩, g.2⟩ := rfl @[to_additive (attr := simp)] lemma Subgroup.subgroupOfContinuousMulEquivOfLe_toMulEquiv {H K : Subgroup G} (hHK : H ≤ K) : (subgroupOfContinuousMulEquivOfLe hHK : H.subgroupOf K ≃* H) = subgroupOfEquivOfLe hHK := by rfl variable [IsTopologicalGroup G] [T2Space G] /-- If `G` is a topological group and `H` a finite-index subgroup, then `G` is topologically discrete iff `H` is. -/ @[to_additive] lemma Subgroup.discreteTopology_iff_of_finiteIndex {H : Subgroup G} [H.FiniteIndex] : DiscreteTopology H ↔ DiscreteTopology G := by refine ⟨fun hH ↦ ?_, fun hG ↦ inferInstance⟩ suffices IsOpen (H : Set G) by rw [discreteTopology_iff_isOpen_singleton_one, isOpen_singleton_iff_nhds_eq_pure, ← H.coe_one, ← this.isOpenEmbedding_subtypeVal.map_nhds_eq, nhds_discrete, map_pure] exact H.isOpen_of_isClosed_of_finiteIndex Subgroup.isClosed_of_discrete @[to_additive] lemma Subgroup.discreteTopology_iff_of_isFiniteRelIndex {H K : Subgroup G} (hHK : H ≤ K) [IsFiniteRelIndex H K] : DiscreteTopology H ↔ DiscreteTopology K := by haveI : (H.subgroupOf K).FiniteIndex := IsFiniteRelIndex.to_finiteIndex_subgroupOf rw [← (subgroupOfContinuousMulEquivOfLe hHK).discreteTopology_iff, discreteTopology_iff_of_finiteIndex] @[to_additive] lemma Subgroup.Commensurable.discreteTopology_iff {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G] [T2Space G] {H K : Subgroup G} (h : Commensurable H K) : DiscreteTopology H ↔ DiscreteTopology K := calc DiscreteTopology H ↔ DiscreteTopology ↑(H ⊓ K) := haveI : IsFiniteRelIndex (H ⊓ K) H := ⟨Subgroup.inf_relIndex_left H K ▸ h.2⟩ (Subgroup.discreteTopology_iff_of_isFiniteRelIndex inf_le_left).symm _ ↔ DiscreteTopology K := haveI : IsFiniteRelIndex (H ⊓ K) K := ⟨Subgroup.inf_relIndex_right H K ▸ h.1⟩ Subgroup.discreteTopology_iff_of_isFiniteRelIndex inf_le_right
.lake/packages/mathlib/Mathlib/Topology/Algebra/IsUniformGroup/Order.lean
import Mathlib.Topology.Algebra.IsUniformGroup.Defs import Mathlib.Topology.Order.Basic import Mathlib.Topology.UniformSpace.UniformConvergence /-! # TendstoUniformlyOn on ordered spaces We gather some results about `TendstoUniformlyOn f g K` on ordered spaces, in particular bounding the values of `f` in terms of bounds on the limit `g`. -/ open Filter Function Finset Topology variable {α ι : Type*} section order variable {β : Type*} [UniformSpace β] [AddGroup β] [IsUniformAddGroup β] [PartialOrder β] [OrderTopology β] [AddLeftMono β] [AddRightMono β] variable {f : ι → α → β} {g : α → β} {K : Set α} {p : Filter ι} /-- If a sequence of functions converges uniformly on a set to a function `g` which is bounded above by a value `u`, then the sequence is strictly bounded by any `v` such that `u < v`. -/ lemma TendstoUniformlyOn.eventually_forall_lt {u v : β} (huv : u < v) (hf : TendstoUniformlyOn f g p K) (hg : ∀ x ∈ K, g x ≤ u) : ∀ᶠ i in p, ∀ x ∈ K, f i x < v := by simp only [tendstoUniformlyOn_iff_tendsto, uniformity_eq_comap_neg_add_nhds_zero, tendsto_iff_eventually, eventually_comap, Prod.forall] at * conv at hf => enter [2]; rw [eventually_iff_exists_mem] have hf2 := hf (fun x ↦ -x.1 + x.2 < -u + v) ⟨_, (isOpen_gt' (-u + v)).mem_nhds (by simp [huv]), fun y hy a b hab ↦ (hab.symm ▸ hy :)⟩ filter_upwards [eventually_prod_principal_iff.mp hf2] with i hi x hx simpa using add_lt_add_of_le_of_lt (hg x hx) (hi x hx) lemma TendstoUniformlyOn.eventually_forall_le {u v : β} (huv : u < v) (hf : TendstoUniformlyOn f g p K) (hg : ∀ x ∈ K, g x ≤ u) : ∀ᶠ i in p, ∀ x ∈ K, f i x ≤ v := by filter_upwards [hf.eventually_forall_lt huv hg] with i hi x hx using (hi x hx).le end order
.lake/packages/mathlib/Mathlib/Topology/Algebra/IsUniformGroup/Basic.lean
import Mathlib.Topology.UniformSpace.UniformConvergence import Mathlib.Topology.UniformSpace.CompleteSeparated import Mathlib.Topology.UniformSpace.Compact import Mathlib.Topology.UniformSpace.HeineCantor import Mathlib.Topology.Algebra.IsUniformGroup.Constructions import Mathlib.Topology.Algebra.Group.Quotient import Mathlib.Topology.DiscreteSubset import Mathlib.Tactic.Abel /-! # Uniform structure on topological groups ## Main results * 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 IsUniformGroup open Filter Set variable {α : Type*} {β : Type*} variable [UniformSpace α] [Group α] [IsUniformGroup α] @[to_additive] theorem isUniformEmbedding_translate_mul (a : α) : IsUniformEmbedding 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] injective := mul_left_injective a } section Cauchy namespace IsUniformGroup variable {ι G : Type*} [Group G] [UniformSpace G] [IsUniformGroup G] @[to_additive] lemma cauchy_iff_tendsto (𝓕 : Filter G) : Cauchy 𝓕 ↔ NeBot 𝓕 ∧ Tendsto (fun p ↦ p.1 / p.2) (𝓕 ×ˢ 𝓕) (𝓝 1) := by simp [Cauchy, uniformity_eq_comap_nhds_one_swapped, ← tendsto_iff_comap] @[to_additive] lemma cauchy_iff_tendsto_swapped (𝓕 : Filter G) : Cauchy 𝓕 ↔ NeBot 𝓕 ∧ Tendsto (fun p ↦ p.2 / p.1) (𝓕 ×ˢ 𝓕) (𝓝 1) := by simp [Cauchy, uniformity_eq_comap_nhds_one, ← tendsto_iff_comap] @[to_additive] lemma cauchy_map_iff_tendsto (𝓕 : Filter ι) (f : ι → G) : Cauchy (map f 𝓕) ↔ NeBot 𝓕 ∧ Tendsto (fun p ↦ f p.1 / f p.2) (𝓕 ×ˢ 𝓕) (𝓝 1) := by simp [cauchy_map_iff, uniformity_eq_comap_nhds_one_swapped, Function.comp_def] @[to_additive] lemma cauchy_map_iff_tendsto_swapped (𝓕 : Filter ι) (f : ι → G) : Cauchy (map f 𝓕) ↔ NeBot 𝓕 ∧ Tendsto (fun p ↦ f p.2 / f p.1) (𝓕 ×ˢ 𝓕) (𝓝 1) := by simp [cauchy_map_iff, uniformity_eq_comap_nhds_one, Function.comp_def] end IsUniformGroup end Cauchy namespace Subgroup @[to_additive] instance isUniformGroup (S : Subgroup α) : IsUniformGroup S := .comap S.subtype end Subgroup @[to_additive] theorem CauchySeq.mul {ι : Type*} [Preorder ι] {u v : ι → α} (hu : CauchySeq u) (hv : CauchySeq v) : CauchySeq (u * v) := uniformContinuous_mul.comp_cauchySeq (hu.prodMk 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] @[to_additive] theorem totallyBounded_inv {s : Set α} (hs : TotallyBounded s) : TotallyBounded (s⁻¹) := by convert TotallyBounded.image hs uniformContinuous_inv aesop 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.prodMk 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.prodMk 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.prodMk 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.prodMk 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.prodMk 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.prodMk 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 @[to_additive] instance (priority := 100) IsUniformGroup.of_compactSpace [UniformSpace β] [Group β] [ContinuousDiv β] [CompactSpace β] : IsUniformGroup β where uniformContinuous_div := CompactSpace.uniformContinuous_of_continuous continuous_div' end IsUniformGroup section IsTopologicalGroup open Filter variable (G : Type*) [Group G] [TopologicalSpace G] [IsTopologicalGroup G] attribute [local instance] IsTopologicalGroup.rightUniformSpace @[to_additive (attr := deprecated IsUniformGroup.of_compactSpace (since := "2025-09-27"))] theorem topologicalGroup_is_uniform_of_compactSpace [CompactSpace G] : IsUniformGroup G := inferInstance 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] 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 end IsTopologicalGroup namespace IsTopologicalGroup variable {ι α G : Type*} [Group G] [u : UniformSpace G] [IsTopologicalGroup G] @[to_additive] theorem tendstoUniformly_iff (F : ι → α → G) (f : α → G) (p : Filter ι) (hu : IsTopologicalGroup.rightUniformSpace G = u) : TendstoUniformly F f p ↔ ∀ u ∈ 𝓝 (1 : G), ∀ᶠ i in p, ∀ a, F i a / f a ∈ u := hu ▸ ⟨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 tendstoUniformlyOn_iff (F : ι → α → G) (f : α → G) (p : Filter ι) (s : Set α) (hu : IsTopologicalGroup.rightUniformSpace G = u) : TendstoUniformlyOn F f p s ↔ ∀ u ∈ 𝓝 (1 : G), ∀ᶠ i in p, ∀ a ∈ s, F i a / f a ∈ u := hu ▸ ⟨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 tendstoLocallyUniformly_iff [TopologicalSpace α] (F : ι → α → G) (f : α → G) (p : Filter ι) (hu : IsTopologicalGroup.rightUniformSpace G = u) : TendstoLocallyUniformly F f p ↔ ∀ u ∈ 𝓝 (1 : G), ∀ (x : α), ∃ t ∈ 𝓝 x, ∀ᶠ i in p, ∀ a ∈ t, F i a / f a ∈ u := hu ▸ ⟨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 tendstoLocallyUniformlyOn_iff [TopologicalSpace α] (F : ι → α → G) (f : α → G) (p : Filter ι) (s : Set α) (hu : IsTopologicalGroup.rightUniformSpace G = u) : TendstoLocallyUniformlyOn F f p s ↔ ∀ u ∈ 𝓝 (1 : G), ∀ x ∈ s, ∃ t ∈ 𝓝[s] x, ∀ᶠ i in p, ∀ a ∈ t, F i a / f a ∈ u := hu ▸ ⟨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 IsTopologicalGroup open Filter Set Function section variable {α : Type*} {β : Type*} {hom : Type*} variable [TopologicalSpace α] [Group α] [IsTopologicalGroup α] -- β is a dense subgroup of α, inclusion is denoted by e variable [TopologicalSpace β] [Group β] variable [FunLike hom β α] [MonoidHomClass hom β α] {e : hom} @[to_additive] theorem tendsto_div_comap_self (de : IsDenseInducing e) (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 simp 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 IsDenseInducing 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 α] [IsTopologicalAddGroup α] variable [TopologicalSpace β] [AddCommGroup β] variable [TopologicalSpace γ] [AddCommGroup γ] [IsTopologicalAddGroup γ] variable [TopologicalSpace δ] [AddCommGroup δ] variable [UniformSpace G] [AddCommGroup G] variable {e : β →+ α} (de : IsDenseInducing e) variable {f : δ →+ γ} (df : IsDenseInducing f) variable {φ : β →+ δ →+ G} variable (hφ : Continuous (fun p : β × δ => φ p.1 p.2)) variable {W' : Set G} (W'_nhds : W' ∈ 𝓝 (0 : G)) include de hφ include W'_nhds in 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.prodMk (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'_nhds variable [IsUniformAddGroup G] include df W'_nhds in 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'_nhds with ⟨W, W_nhds, 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_nhds 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₁_nhds, V₁, V₁_nhds, H⟩ obtain ⟨x₁, x₁_in⟩ : U₁.Nonempty := (de.comap_nhds_neBot _).nonempty_of_mem U₁_nhds obtain ⟨y₁, y₁_in⟩ : V₁.Nonempty := (df.comap_nhds_neBot _).nonempty_of_mem V₁_nhds have cont_flip : Continuous fun p : δ × β => φ.flip p.1 p.2 := by change Continuous ((fun p : β × δ => φ p.1 p.2) ∘ Prod.swap) exact hφ.comp continuous_swap rcases extend_Z_bilin_aux de hφ W_nhds x₀ y₁ with ⟨U₂, U₂_nhds, HU⟩ rcases extend_Z_bilin_aux df cont_flip W_nhds y₀ x₁ with ⟨V₂, V₂_nhds, HV⟩ exists U₁ ∩ U₂, inter_mem U₁_nhds U₂_nhds, V₁ ∩ V₂, inter_mem V₁_nhds V₂_nhds 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 IsDenseInducing variable [T0Space G] [CompleteSpace G] /-- 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.prodMap 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.prodMap df).dense (x₀, y₀)) U h with ⟨x, x_in, ⟨z, z_x⟩⟩ exists z simp_all · 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'_nhds have key := extend_Z_bilin_key de df hφ W'_nhds x₀ y₀ rcases key with ⟨U, U_nhds, V, V_nhds, h⟩ rw [mem_comap] at U_nhds rcases U_nhds with ⟨U', U'_nhds, U'_sub⟩ rw [mem_comap] at V_nhds rcases V_nhds with ⟨V', V'_nhds, V'_sub⟩ rw [mem_map, mem_comap, nhds_prod_eq] exists (U' ×ˢ V') ×ˢ U' ×ˢ V' rw [mem_prod_same_iff] have := prod_mem_prod U'_nhds V'_nhds grind end IsDenseInducing 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] [IsTopologicalGroup G] [FirstCountableTopology G] (N : Subgroup G) [N.Normal] [@CompleteSpace G (IsTopologicalGroup.rightUniformSpace G)] : @CompleteSpace (G ⧸ N) (IsTopologicalGroup.rightUniformSpace (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) := IsTopologicalGroup.rightUniformSpace (G ⧸ N) letI : UniformSpace G := IsTopologicalGroup.rightUniformSpace G haveI : (𝓤 (G ⧸ N)).IsCountablyGenerated := comap.isCountablyGenerated _ _ obtain ⟨u, hu, u_mul⟩ := IsTopologicalGroup.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 `IsTopologicalGroup.rightUniformSpace`. 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 `IsTopologicalAddGroup.rightUniformSpace`. 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] [IsUniformGroup G] [FirstCountableTopology G] (N : Subgroup G) [N.Normal] [hG : CompleteSpace G] : @CompleteSpace (G ⧸ N) (IsTopologicalGroup.rightUniformSpace (G ⧸ N)) := by rw [← @IsUniformGroup.rightUniformSpace_eq _ us _ _] at hG infer_instance end CompleteQuotient
.lake/packages/mathlib/Mathlib/Topology/Algebra/IsUniformGroup/Constructions.lean
import Mathlib.Topology.Algebra.IsUniformGroup.Defs import Mathlib.Topology.UniformSpace.Pi import Mathlib.Topology.UniformSpace.UniformEmbedding /-! # Constructions of new uniform groups from old ones -/ variable {G H hom : Type*} [Group G] [Group H] section LatticeOps @[to_additive] theorem isUniformGroup_sInf {us : Set (UniformSpace G)} (h : ∀ u ∈ us, @IsUniformGroup G u _) : @IsUniformGroup G (sInf us) _ := @IsUniformGroup.mk G (_) _ <| uniformContinuous_sInf_rng.mpr fun u hu => uniformContinuous_sInf_dom₂ hu hu (@IsUniformGroup.uniformContinuous_div G u _ (h u hu)) @[to_additive] theorem isUniformGroup_iInf {ι : Sort*} {us' : ι → UniformSpace G} (h' : ∀ i, @IsUniformGroup G (us' i) _) : @IsUniformGroup G (⨅ i, us' i) _ := by rw [← sInf_range] exact isUniformGroup_sInf (Set.forall_mem_range.mpr h') @[to_additive] theorem isUniformGroup_inf {u₁ u₂ : UniformSpace G} (h₁ : @IsUniformGroup G u₁ _) (h₂ : @IsUniformGroup G u₂ _) : @IsUniformGroup G (u₁ ⊓ u₂) _ := by rw [inf_eq_iInf] refine isUniformGroup_iInf fun b => ?_ cases b <;> assumption end LatticeOps section Comap @[to_additive] lemma IsUniformInducing.isUniformGroup [UniformSpace G] [UniformSpace H] [IsUniformGroup H] [FunLike hom G H] [MonoidHomClass hom G H] (f : hom) (hf : IsUniformInducing f) : IsUniformGroup G where uniformContinuous_div := by simp_rw [hf.uniformContinuous_iff, Function.comp_def, map_div] exact uniformContinuous_div.comp (hf.uniformContinuous.prodMap hf.uniformContinuous) @[to_additive] protected theorem IsUniformGroup.comap {u : UniformSpace H} [IsUniformGroup H] [FunLike hom G H] [MonoidHomClass hom G H] (f : hom) : @IsUniformGroup G (u.comap f) _ := letI : UniformSpace G := u.comap f; IsUniformInducing.isUniformGroup f ⟨rfl⟩ end Comap section PiProd @[to_additive] instance Prod.instIsUniformGroup [UniformSpace G] [hG : IsUniformGroup G] [UniformSpace H] [hH : IsUniformGroup H] : IsUniformGroup (G × H) := by rw [instUniformSpaceProd] exact isUniformGroup_inf (.comap <| MonoidHom.fst G H) (.comap <| MonoidHom.snd G H) @[to_additive] instance Pi.instIsUniformGroup {ι : Type*} {G : ι → Type*} [∀ i, UniformSpace (G i)] [∀ i, Group (G i)] [∀ i, IsUniformGroup (G i)] : IsUniformGroup (∀ i, G i) := by rw [Pi.uniformSpace_eq] exact isUniformGroup_iInf fun i ↦ .comap (Pi.evalMonoidHom G i) end PiProd section DiscreteUniformity /-- The discrete uniformity makes a group a `IsUniformGroup. -/ @[to_additive /-- The discrete uniformity makes an additive group a `IsUniformAddGroup`. -/] instance [UniformSpace G] [DiscreteUniformity G] : IsUniformGroup G where uniformContinuous_div := DiscreteUniformity.uniformContinuous (G × G) fun p ↦ p.1 / p.2 end DiscreteUniformity
.lake/packages/mathlib/Mathlib/Topology/Algebra/IsUniformGroup/Defs.lean
import Mathlib.Topology.UniformSpace.Basic import Mathlib.Topology.Algebra.Group.Basic /-! # Uniform structure on topological groups Given a topological group `G`, one can naturally build two uniform structures (the "left" and "right" ones) on `G` inducing its topology. This file defines typeclasses for groups equipped with either of these uniform strucures, as well as a separate typeclass for the (very common) case where the given uniform structure coincides with **both** the left and right uniform structures. ## Main declarations * `IsRightUniformGroup` and `IsRightUniformAddGroup`: Multiplicative and additive topological groups endowed with the associated right uniform structure. This means that two points `x` and `y` are close precisely when `y * x⁻¹` is close to `1` / `y + (-x)` close to `0`. * `IsLeftUniformGroup` and `IsLeftUniformAddGroup`: Multiplicative and additive topological groups endowed with the associated left uniform structure. This means that two points `x` and `y` are close precisely when `x⁻¹ * y` is close to `1` / `(-x) + y` close to `0`. * `IsUniformGroup` and `IsUniformAddGroup`: Multiplicative and additive uniform groups, i.e., groups with uniformly continuous `(*)` and `(⁻¹)` / `(+)` and `(-)`. This corresponds to the conjuction of the two conditions above, although this result is not in Mathlib yet. ## Main results * `IsTopologicalAddGroup.rightUniformSpace` and `comm_topologicalAddGroup_is_uniform` can be used to construct a canonical uniformity for a topological additive group. See `Mathlib/Topology/Algebra/IsUniformGroup/Basic.lean` for further results. ## Implementation Notes Since the most frequent use case is `G` being a commutative additive groups, `Mathlib` originally did essentially all the theory under the assumption `IsUniformGroup G`. For this reason, you may find results stated under this assumption even though they may hold under either `IsRightUniformGroup G` or `IsLeftUniformGroup G`. -/ assert_not_exists Cauchy noncomputable section open Uniformity Topology Filter Pointwise section LeftRight open Filter Set variable {G Gₗ Gᵣ Hₗ Hᵣ X : Type*} /-- A **right-uniform additive group** is a topological additive group endowed with the associated right uniform structure: the uniformity filter `𝓤 G` is the inverse image of `𝓝 0` by the map `(x, y) ↦ y + (-x)`. In other words, we declare that two points `x` and `y` are infinitely close precisely when `y + (-x)` is infinitely close to `0`. -/ class IsRightUniformAddGroup (G : Type*) [UniformSpace G] [AddGroup G] : Prop extends IsTopologicalAddGroup G where uniformity_eq : 𝓤 G = comap (fun x : G × G ↦ x.2 + (-x.1)) (𝓝 0) /-- A **right-uniform group** is a topological group endowed with the associated right uniform structure: the uniformity filter `𝓤 G` is the inverse image of `𝓝 1` by the map `(x, y) ↦ y * x⁻¹`. In other words, we declare that two points `x` and `y` are infinitely close precisely when `y * x⁻¹` is infinitely close to `1`. -/ @[to_additive] class IsRightUniformGroup (G : Type*) [UniformSpace G] [Group G] : Prop extends IsTopologicalGroup G where uniformity_eq : 𝓤 G = comap (fun x : G × G ↦ x.2 * x.1⁻¹) (𝓝 1) /-- A **left-uniform additive group** is a topological additive group endowed with the associated left uniform structure: the uniformity filter `𝓤 G` is the inverse image of `𝓝 0` by the map `(x, y) ↦ (-x) + y`. In other words, we declare that two points `x` and `y` are infinitely close precisely when `(-x) + y` is infinitely close to `0`. -/ class IsLeftUniformAddGroup (G : Type*) [UniformSpace G] [AddGroup G] : Prop extends IsTopologicalAddGroup G where uniformity_eq : 𝓤 G = comap (fun x : G × G ↦ (-x.1) + x.2) (𝓝 0) /-- A **left-uniform group** is a topological group endowed with the associated left uniform structure: the uniformity filter `𝓤 G` is the inverse image of `𝓝 1` by the map `(x, y) ↦ x⁻¹ * y`. In other words, we declare that two points `x` and `y` are infinitely close precisely when `x⁻¹ * y` is infinitely close to `1`. -/ @[to_additive] class IsLeftUniformGroup (G : Type*) [UniformSpace G] [Group G] : Prop extends IsTopologicalGroup G where uniformity_eq : 𝓤 G = comap (fun x : G × G ↦ x.1⁻¹ * x.2) (𝓝 1) attribute [instance 10] IsRightUniformAddGroup.toIsTopologicalAddGroup attribute [instance 10] IsRightUniformGroup.toIsTopologicalGroup attribute [instance 10] IsLeftUniformAddGroup.toIsTopologicalAddGroup attribute [instance 10] IsLeftUniformGroup.toIsTopologicalGroup variable [UniformSpace Gₗ] [UniformSpace Gᵣ] [Group Gₗ] [Group Gᵣ] variable [UniformSpace Hₗ] [UniformSpace Hᵣ] [Group Hₗ] [Group Hᵣ] variable [IsLeftUniformGroup Gₗ] [IsRightUniformGroup Gᵣ] variable [IsLeftUniformGroup Hₗ] [IsRightUniformGroup Hᵣ] variable [UniformSpace X] variable (Gₗ Gᵣ) @[to_additive] lemma uniformity_eq_comap_mul_inv_nhds_one : 𝓤 Gᵣ = comap (fun x : Gᵣ × Gᵣ ↦ x.2 * x.1⁻¹) (𝓝 1) := IsRightUniformGroup.uniformity_eq @[to_additive] lemma uniformity_eq_comap_inv_mul_nhds_one : 𝓤 Gₗ = comap (fun x : Gₗ × Gₗ ↦ x.1⁻¹ * x.2) (𝓝 1) := IsLeftUniformGroup.uniformity_eq @[to_additive] lemma uniformity_eq_comap_mul_inv_nhds_one_swapped : 𝓤 Gᵣ = comap (fun x : Gᵣ × Gᵣ ↦ x.1 * x.2⁻¹) (𝓝 1) := by rw [← comap_swap_uniformity, uniformity_eq_comap_mul_inv_nhds_one, comap_comap] rfl @[to_additive] lemma uniformity_eq_comap_inv_mul_nhds_one_swapped : 𝓤 Gₗ = comap (fun x : Gₗ × Gₗ ↦ x.2⁻¹ * x.1) (𝓝 1) := by rw [← comap_swap_uniformity, uniformity_eq_comap_inv_mul_nhds_one, comap_comap] rfl @[to_additive] theorem uniformity_eq_comap_nhds_one : 𝓤 Gᵣ = comap (fun x : Gᵣ × Gᵣ => x.2 / x.1) (𝓝 1) := by simp_rw [div_eq_mul_inv] exact uniformity_eq_comap_mul_inv_nhds_one Gᵣ @[to_additive] theorem uniformity_eq_comap_nhds_one_swapped : 𝓤 Gᵣ = comap (fun x : Gᵣ × Gᵣ => x.1 / x.2) (𝓝 1) := by rw [← comap_swap_uniformity, uniformity_eq_comap_nhds_one, comap_comap] rfl variable {Gₗ Gᵣ} end LeftRight section IsUniformGroup open Filter Set variable {α : Type*} {β : Type*} /-- A uniform group is a group in which multiplication and inversion are uniformly continuous. `IsUniformGroup G` is equivalent to the fact that `G` is a topological group, and the uniformity coincides with **both** the associated left and right uniformities (see `IsUniformGroup.isRightUniformGroup`, `IsUniformGroup.isLeftUniformGroup` and `IsUniformGroup.of_left_right`). Since there are topological groups where these two uniformities do **not** coincide, not all topological groups admit a uniform group structure in this sense. This is however the case for commutative groups, which are the main motivation for the existence of this typeclass. -/ class IsUniformGroup (α : 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. `IsUniformAddGroup G` is equivalent to the fact that `G` is a topological additive group, and the uniformity coincides with **both** the associated left and right uniformities (see `IsUniformAddGroup.isRightUniformAddGroup`, `IsUniformAddGroup.isLeftUniformAddGroup` and `IsUniformAddGroup.of_left_right`). Since there are topological groups where these two uniformities do **not** coincide, not all topological groups admit a uniform group structure in this sense. This is however the case for commutative groups, which are the main motivation for the existence of this typeclass. -/ class IsUniformAddGroup (α : Type*) [UniformSpace α] [AddGroup α] : Prop where uniformContinuous_sub : UniformContinuous fun p : α × α => p.1 - p.2 attribute [to_additive] IsUniformGroup @[to_additive] theorem IsUniformGroup.mk' {α} [UniformSpace α] [Group α] (h₁ : UniformContinuous fun p : α × α => p.1 * p.2) (h₂ : UniformContinuous fun p : α => p⁻¹) : IsUniformGroup α := ⟨by simpa only [div_eq_mul_inv] using h₁.comp (uniformContinuous_fst.prodMk (h₂.comp uniformContinuous_snd))⟩ variable [UniformSpace α] [Group α] [IsUniformGroup α] @[to_additive] theorem uniformContinuous_div : UniformContinuous fun p : α × α => p.1 / p.2 := IsUniformGroup.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.prodMk 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] theorem UniformContinuous.mul_const [UniformSpace β] {f : β → α} (hf : UniformContinuous f) (a : α) : UniformContinuous fun x ↦ f x * a := hf.mul uniformContinuous_const @[to_additive] theorem UniformContinuous.const_mul [UniformSpace β] {f : β → α} (hf : UniformContinuous f) (a : α) : UniformContinuous fun x ↦ a * f x := uniformContinuous_const.mul hf @[to_additive] theorem uniformContinuous_mul_left (a : α) : UniformContinuous fun b : α => a * b := uniformContinuous_id.const_mul _ @[to_additive] theorem uniformContinuous_mul_right (a : α) : UniformContinuous fun b : α => b * a := uniformContinuous_id.mul_const _ @[to_additive] theorem UniformContinuous.div_const [UniformSpace β] {f : β → α} (hf : UniformContinuous f) (a : α) : UniformContinuous fun x ↦ f x / a := hf.div uniformContinuous_const @[to_additive] theorem uniformContinuous_div_const (a : α) : UniformContinuous fun b : α => b / a := uniformContinuous_id.div_const _ @[to_additive] theorem Filter.Tendsto.uniformity_mul {ι : Type*} {f g : ι → α × α} {l : Filter ι} (hf : Tendsto f l (𝓤 α)) (hg : Tendsto g l (𝓤 α)) : Tendsto (f * g) l (𝓤 α) := have : Tendsto (fun (p : (α × α) × (α × α)) ↦ p.1 * p.2) (𝓤 α ×ˢ 𝓤 α) (𝓤 α) := by simpa [UniformContinuous, uniformity_prod_eq_prod] using uniformContinuous_mul (α := α) this.comp (hf.prodMk hg) @[to_additive] theorem Filter.Tendsto.uniformity_inv {ι : Type*} {f : ι → α × α} {l : Filter ι} (hf : Tendsto f l (𝓤 α)) : Tendsto (f⁻¹) l (𝓤 α) := have : Tendsto (· ⁻¹) (𝓤 α) (𝓤 α) := uniformContinuous_inv this.comp hf @[to_additive] theorem Filter.Tendsto.uniformity_inv_iff {ι : Type*} {f : ι → α × α} {l : Filter ι} : Tendsto (f⁻¹) l (𝓤 α) ↔ Tendsto f l (𝓤 α) := ⟨fun H ↦ inv_inv f ▸ H.uniformity_inv, Filter.Tendsto.uniformity_inv⟩ @[to_additive] theorem Filter.Tendsto.uniformity_div {ι : Type*} {f g : ι → α × α} {l : Filter ι} (hf : Tendsto f l (𝓤 α)) (hg : Tendsto g l (𝓤 α)) : Tendsto (f / g) l (𝓤 α) := by rw [div_eq_mul_inv] exact hf.uniformity_mul hg.uniformity_inv /-- If `f : ι → G × G` converges to the uniformity, then any `g : ι → G × G` converges to the uniformity iff `f * g` does. This is often useful when `f` is valued in the diagonal, in which case its convergence is automatic. -/ @[to_additive /-- If `f : ι → G × G` converges to the uniformity, then any `g : ι → G × G` converges to the uniformity iff `f + g` does. This is often useful when `f` is valued in the diagonal, in which case its convergence is automatic. -/] theorem Filter.Tendsto.uniformity_mul_iff_right {ι : Type*} {f g : ι → α × α} {l : Filter ι} (hf : Tendsto f l (𝓤 α)) : Tendsto (f * g) l (𝓤 α) ↔ Tendsto g l (𝓤 α) := ⟨fun hfg ↦ by simpa using hf.uniformity_inv.uniformity_mul hfg, hf.uniformity_mul⟩ /-- If `g : ι → G × G` converges to the uniformity, then any `f : ι → G × G` converges to the uniformity iff `f * g` does. This is often useful when `g` is valued in the diagonal, in which case its convergence is automatic. -/ @[to_additive /-- If `g : ι → G × G` converges to the uniformity, then any `f : ι → G × G` converges to the uniformity iff `f + g` does. This is often useful when `g` is valued in the diagonal, in which case its convergence is automatic. -/] theorem Filter.Tendsto.uniformity_mul_iff_left {ι : Type*} {f g : ι → α × α} {l : Filter ι} (hg : Tendsto g l (𝓤 α)) : Tendsto (f * g) l (𝓤 α) ↔ Tendsto f l (𝓤 α) := ⟨fun hfg ↦ by simpa using hfg.uniformity_mul hg.uniformity_inv, fun hf ↦ hf.uniformity_mul hg⟩ @[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) IsUniformGroup.to_topologicalGroup : IsTopologicalGroup α where continuous_mul := uniformContinuous_mul.continuous continuous_inv := uniformContinuous_inv.continuous @[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, Function.comp_def] _ ≤ (𝓤 α).map fun x : α × α => (x.1 * a, x.2 * a) := Filter.map_mono (uniformContinuous_id.mul uniformContinuous_const) ) namespace MulOpposite @[to_additive] instance : IsUniformGroup αᵐᵒᵖ := ⟨uniformContinuous_op.comp ((uniformContinuous_unop.comp uniformContinuous_snd).inv.mul <| uniformContinuous_unop.comp uniformContinuous_fst)⟩ end MulOpposite section variable (α) @[to_additive] instance IsUniformGroup.isRightUniformGroup : IsRightUniformGroup α where uniformity_eq := by refine eq_of_forall_le_iff fun 𝓕 ↦ ?_ rw [nhds_eq_comap_uniformity, comap_comap, ← tendsto_iff_comap, ← (tendsto_diag_uniformity Prod.fst 𝓕).uniformity_mul_iff_left, ← tendsto_id'] congrm Tendsto ?_ _ _ ext <;> simp @[to_additive] instance IsUniformGroup.isLeftUniformGroup : IsLeftUniformGroup α where uniformity_eq := by refine eq_of_forall_le_iff fun 𝓕 ↦ ?_ rw [nhds_eq_comap_uniformity, comap_comap, ← tendsto_iff_comap, ← (tendsto_diag_uniformity Prod.fst 𝓕).uniformity_mul_iff_right, ← tendsto_id'] congrm Tendsto ?_ _ _ ext <;> simp @[to_additive] theorem IsUniformGroup.ext {G : Type*} [Group G] {u v : UniformSpace G} (hu : @IsUniformGroup G u _) (hv : @IsUniformGroup G v _) (h : @nhds _ u.toTopologicalSpace 1 = @nhds _ v.toTopologicalSpace 1) : u = v := UniformSpace.ext <| by rw [(have := hu; uniformity_eq_comap_nhds_one), (have := hv; uniformity_eq_comap_nhds_one), h] @[to_additive] theorem IsUniformGroup.ext_iff {G : Type*} [Group G] {u v : UniformSpace G} (hu : @IsUniformGroup G u _) (hv : @IsUniformGroup G v _) : u = v ↔ @nhds _ u.toTopologicalSpace 1 = @nhds _ v.toTopologicalSpace 1 := ⟨fun h => h ▸ rfl, hu.ext hv⟩ variable {α} @[to_additive] theorem IsUniformGroup.uniformity_countably_generated [(𝓝 (1 : α)).IsCountablyGenerated] : (𝓤 α).IsCountablyGenerated := by rw [uniformity_eq_comap_nhds_one] exact Filter.comap.isCountablyGenerated _ _ open MulOpposite end section OfLeftAndRight variable [UniformSpace β] [Group β] [IsLeftUniformGroup β] [IsRightUniformGroup β] open Prod (snd) in /-- Note: this assumes `[IsLeftUniformGroup β] [IsRightUniformGroup β]` instead of the more typical (and equivalent) `[IsUniformGroup β]` because this is used in the proof of said equivalence. -/ @[to_additive /-- Note: this assumes `[IsLeftUniformAddGroup β] [IsRightUniformAddGroup β]` instead of the more typical (and equivalent) `[IsUniformAddGroup β]` because this is used in the proof of said equivalence. -/] theorem comap_conj_nhds_one : comap (fun gx : β × β ↦ gx.1 * gx.2 * gx.1⁻¹) (𝓝 1) = comap snd (𝓝 1) := by let dr : β × β → β := fun xy ↦ xy.2 * xy.1⁻¹ let dl : β × β → β := fun xy ↦ xy.1⁻¹ * xy.2 let conj : β × β → β := fun gx ↦ gx.1 * gx.2 * gx.1⁻¹ let φ : β × β ≃ β × β := (Equiv.refl β).prodShear (fun b ↦ (Equiv.mulLeft b).symm) have conj_φ : conj ∘ φ = dr := by ext; simp [conj, φ, dr] have snd_φ : snd ∘ φ = dl := by ext; simp [φ, dl] rw [← (comap_injective φ.surjective).eq_iff, comap_comap, comap_comap, conj_φ, snd_φ, ← uniformity_eq_comap_inv_mul_nhds_one, ← uniformity_eq_comap_mul_inv_nhds_one] open Prod (snd) in /-- Note: this assumes `[IsLeftUniformGroup β] [IsRightUniformGroup β]` instead of the more typical (and equivalent) `[IsUniformGroup β]` because this is used in the proof of said equivalence. -/ @[to_additive /-- Note: this assumes `[IsLeftUniformAddGroup β] [IsRightUniformAddGroup β]` instead of the more typical (and equivalent) `[IsUniformAddGroup β]` because this is used in the proof of said equivalence. -/] theorem tendsto_conj_nhds_one : Tendsto (fun gx : β × β ↦ gx.1 * gx.2 * gx.1⁻¹) (comap snd (𝓝 1)) (𝓝 1) := by rw [tendsto_iff_comap, comap_conj_nhds_one] /-- Note: this assumes `[IsLeftUniformGroup β] [IsRightUniformGroup β]` instead of the more typical (and equivalent) `[IsUniformGroup β]` because this is used in the proof of said equivalence. -/ @[to_additive /-- Note: this assumes `[IsLeftUniformAddGroup β] [IsRightUniformAddGroup β]` instead of the more typical (and equivalent) `[IsUniformAddGroup β]` because this is used in the proof of said equivalence. -/] theorem Filter.Tendsto.conj_nhds_one {ι : Type*} {l : Filter ι} {x : ι → β} (hx : Tendsto x l (𝓝 1)) (g : ι → β) : Tendsto (g * x * g⁻¹) l (𝓝 1) := by have : Tendsto (fun i ↦ (g i, x i)) l (comap Prod.snd (𝓝 1)) := by rwa [tendsto_comap_iff] -- `exact` works but is quite slow... convert tendsto_conj_nhds_one.comp this theorem IsUniformGroup.of_left_right : IsUniformGroup β where uniformContinuous_div := by let φ : (β × β) × (β × β) → β := fun ⟨⟨x₁, x₂⟩, ⟨y₁, y₂⟩⟩ ↦ x₂ * y₂⁻¹ * y₁ * x₁⁻¹ let ψ : (β × β) × (β × β) → β := fun ⟨⟨x₁, x₂⟩, ⟨y₁, y₂⟩⟩ ↦ (x₁⁻¹ * x₂) * (y₂⁻¹ * y₁) let g : (β × β) × (β × β) → β := fun ⟨⟨x₁, x₂⟩, ⟨y₁, y₂⟩⟩ ↦ x₁ suffices Tendsto φ (𝓤 β ×ˢ 𝓤 β) (𝓝 1) by rw [UniformContinuous, uniformity_eq_comap_mul_inv_nhds_one β, tendsto_comap_iff, uniformity_prod_eq_prod, tendsto_map'_iff] simpa [Function.comp_def, div_eq_mul_inv, ← mul_assoc] have φ_ψ_conj : φ = g * ψ * g⁻¹ := by ext simp [φ, ψ, g, mul_assoc] have ψ_tendsto : Tendsto ψ (𝓤 β ×ˢ 𝓤 β) (𝓝 1) := by rw [← one_mul 1] refine .mul ?_ ?_ · rw [uniformity_eq_comap_inv_mul_nhds_one] exact tendsto_comap.comp tendsto_fst · rw [uniformity_eq_comap_inv_mul_nhds_one_swapped] exact tendsto_comap.comp tendsto_snd exact φ_ψ_conj ▸ ψ_tendsto.conj_nhds_one g theorem isUniformGroup_iff_left_right {γ : Type*} [Group γ] [UniformSpace γ] : IsUniformGroup γ ↔ IsLeftUniformGroup γ ∧ IsRightUniformGroup γ := ⟨fun _ ↦ ⟨inferInstance, inferInstance⟩, fun ⟨_, _⟩ ↦ .of_left_right⟩ theorem eventually_forall_conj_nhds_one {p : α → Prop} (hp : ∀ᶠ x in 𝓝 1, p x) : ∀ᶠ x in 𝓝 1, ∀ g, p (g * x * g⁻¹) := by simpa using tendsto_conj_nhds_one.eventually hp end OfLeftAndRight @[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 β] [IsUniformGroup β] [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 β] [IsUniformGroup β] [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 β] [IsUniformGroup β] (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 IsUniformGroup.uniformContinuous_iff_isOpen_ker {hom : Type*} [UniformSpace β] [DiscreteTopology β] [Group β] [IsUniformGroup β] [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 β] [IsUniformGroup β] [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 end IsUniformGroup section IsTopologicalGroup open Filter variable (G : Type*) [Group G] [TopologicalSpace G] [IsTopologicalGroup 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 `IsUniformGroup` structure. Two important special cases where they _do_ coincide are for commutative groups (see `isUniformGroup_of_commGroup`) and for compact groups (see `IsUniformGroup.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 `IsUniformAddGroup` structure. Two important special cases where they _do_ coincide are for commutative additive groups (see `isUniformAddGroup_of_addCommGroup`) and for compact additive groups (see `IsUniformAddGroup.of_compactSpace`). -/] def IsTopologicalGroup.rightUniformSpace : 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, Function.comp_def, nhds_translation_div] @[deprecated (since := "2025-09-26")] alias IsTopologicalAddGroup.toUniformSpace := IsTopologicalAddGroup.rightUniformSpace @[to_additive existing, deprecated (since := "2025-09-26")] alias IsTopologicalGroup.toUniformSpace := IsTopologicalGroup.rightUniformSpace attribute [local instance] IsTopologicalGroup.rightUniformSpace @[to_additive] theorem uniformity_eq_comap_nhds_one' : 𝓤 G = comap (fun p : G × G => p.2 / p.1) (𝓝 (1 : G)) := rfl end IsTopologicalGroup section TopologicalCommGroup universe u v w x open Filter variable (G : Type*) [CommGroup G] [TopologicalSpace G] [IsTopologicalGroup G] section attribute [local instance] IsTopologicalGroup.rightUniformSpace variable {G} @[to_additive] theorem isUniformGroup_of_commGroup : IsUniformGroup G := by constructor simp only [UniformContinuous, uniformity_prod_eq_prod, uniformity_eq_comap_nhds_one', tendsto_comap_iff, tendsto_map'_iff, prod_comap_comap_eq, Function.comp_def, div_div_div_comm _ (Prod.snd (Prod.snd _)), ← nhds_prod_eq] exact (continuous_div'.tendsto' 1 1 (div_one 1)).comp tendsto_comap alias comm_topologicalGroup_is_uniform := isUniformGroup_of_commGroup open Set end @[to_additive] theorem IsUniformGroup.rightUniformSpace_eq {G : Type*} [u : UniformSpace G] [Group G] [IsUniformGroup G] : IsTopologicalGroup.rightUniformSpace G = u := by ext : 1 rw [uniformity_eq_comap_nhds_one' G, uniformity_eq_comap_nhds_one G] @[deprecated (since := "2025-09-26")] alias IsUniformAddGroup.toUniformSpace_eq := IsUniformAddGroup.rightUniformSpace_eq @[to_additive existing, deprecated (since := "2025-09-26")] alias IsUniformGroup.toUniformSpace_eq := IsUniformGroup.rightUniformSpace_eq end TopologicalCommGroup
.lake/packages/mathlib/Mathlib/Topology/Algebra/ProperAction/AddTorsor.lean
import Mathlib.Topology.Algebra.Group.AddTorsor import Mathlib.Topology.Algebra.ProperAction.Basic /-! # The action underlying a topological additive torsor is proper. -/ variable {V P : Type*} [AddGroup V] [AddTorsor V P] variable [TopologicalSpace V] [TopologicalSpace P] [IsTopologicalAddTorsor P] /-- If `P` is a topological torsor over `V`, the action of `V` on `P` is proper. -/ instance : ProperVAdd V P where isProperMap_vadd_pair := by let Φ : V × P ≃ₜ P × P := { toFun vp := (vp.1 +ᵥ vp.2, vp.2) invFun pq := (pq.1 -ᵥ pq.2, pq.2) left_inv _ := by simp right_inv _ := by simp } exact Φ.isProperMap
.lake/packages/mathlib/Mathlib/Topology/Algebra/ProperAction/Basic.lean
import Mathlib.Topology.Algebra.Group.Quotient import Mathlib.Topology.Algebra.MulAction import Mathlib.Topology.Algebra.Group.Defs import Mathlib.Topology.LocalAtTarget /-! # 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. ## 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_t1Group`: If a T1 group acts properly on a topological space, then this topological space is T2. ## 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 : Type*} [Group G] [MulAction G X] variable [TopologicalSpace G] [TopologicalSpace X] /-- 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 /-- An additive group `G` acts 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). -/] instance 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 : IsOpenQuotientMap (Prod.map π π) := MulAction.isOpenQuotientMap_quotientMk.prodMap MulAction.isOpenQuotientMap_quotientMk rw [← this.isQuotientMap.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', MulAction.orbitRel_apply, MulAction.mem_orbit_iff] all_goals infer_instance /-- If a T1 group acts properly on a topological space, then this topological space is T2. -/ @[to_additive /-- If a T1 group acts properly on a topological space, then this topological space is T2. -/] theorem t2Space_of_properSMul_of_t1Group [h_proper : ProperSMul G X] [T1Space G] : T2Space X := by let f := fun x : X ↦ ((1 : G), x) have proper_f : IsProperMap f := by refine IsClosedEmbedding.isProperMap ⟨?_, ?_⟩ · let g := fun gx : G × X ↦ gx.2 have : Function.LeftInverse g f := fun x ↦ by simp [f, g] exact this.isEmbedding (by fun_prop) (by fun_prop) · have : range f = ({1} ×ˢ univ) := by simp [f, Set.singleton_prod] 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 [f, g] have range_gf : range (g ∘ f) = diagonal X := by simp [this] rw [← range_gf] exact (proper_g.comp proper_f).isClosed_range /-- If two groups `H` and `G` act on a topological space `X` such that `G` acts properly and there exists a group homomorphism `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 homomorphism `H → G` which is a closed embedding compatible with the actions, then `H` also acts properly on `X`. -/] theorem properSMul_of_isClosedEmbedding {H : Type*} [Group H] [MulAction H X] [TopologicalSpace H] [ProperSMul G X] (f : H →* G) (f_clemb : IsClosedEmbedding f) (f_compat : ∀ (h : H) (x : X), f h • x = h • x) : ProperSMul H X where isProperMap_smul_pair := by have h : IsProperMap (Prod.map f (fun x : X ↦ x)) := f_clemb.isProperMap.prodMap 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 ProperSMul.isProperMap_smul_pair.comp h /-- 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_isClosedEmbedding H.subtype H_closed.isClosedEmbedding_subtypeVal fun _ _ ↦ rfl /-- The action `G ↷ G` by left translations is proper. -/ @[to_additive /-- The action `G ↷ G` by left translations is proper. -/] instance [IsTopologicalGroup G] : ProperSMul G G where isProperMap_smul_pair := by let Φ : G × G ≃ₜ G × G := { toFun := fun gh ↦ (gh.1 * gh.2, gh.2) invFun := fun gh ↦ (gh.1 * gh.2⁻¹, gh.2) left_inv := fun _ ↦ by simp right_inv := fun _ ↦ by simp } exact Φ.isProperMap open MulOpposite in /-- The action `Gᵐᵒᵖ ↷ G` by right translations is proper. -/ @[to_additive /-- The action `Gᵃᵒᵖ ↷ G` by right translations is proper. -/] instance [IsTopologicalGroup G] : ProperSMul Gᵐᵒᵖ G where isProperMap_smul_pair := by let Φ : Gᵐᵒᵖ × G ≃ₜ G × G := { toFun := fun gh ↦ (gh.2 * (unop gh.1), gh.2) invFun := fun gh ↦ (op (gh.2⁻¹ * gh.1), gh.2) left_inv := fun _ ↦ by simp right_inv := fun _ ↦ by simp } exact Φ.isProperMap /-- Given a closed subgroup `H` of a topological group `G`, the right action of `H` on `G` is proper. Note that the corresponding statement for the left action can be proven by `inferInstance`. -/ @[to_additive /-- Given a closed subgroup `H` of an additive topological group `G`, the right action of `H` on `G` is proper. Note that the corresponding statement for the left action can be proven by `inferInstance`. -/] instance [IsTopologicalGroup G] {H : Subgroup G} [H_closed : IsClosed (H : Set G)] : ProperSMul H.op G := have : IsClosed (H.op : Set Gᵐᵒᵖ) := H_closed.preimage MulOpposite.continuous_unop inferInstance @[to_additive] instance QuotientGroup.instT2Space [IsTopologicalGroup G] {H : Subgroup G} [IsClosed (H : Set G)] : T2Space (G ⧸ H) := t2Space_quotient_mulAction_of_properSMul /-- If `G` acts on `X` properly, then the map `G × T → X × T, (g, t) ↦ (g • t, t)` is still proper for *any* subset `T` of `X`. -/ @[to_additive /-- If `G` acts on `X` properly, then the map `G × T → X × T, (g, t) ↦ (g +ᵥ t, t)` is still proper for *any* subset `T` of `X`. -/] lemma ProperSMul.isProperMap_smul_pair_set [ProperSMul G X] {t : Set X} : IsProperMap (fun (gx : G × t) ↦ ((gx.1 • gx.2, gx.2) : X × t)) := by let Φ : G × X → X × X := fun gx ↦ (gx.1 • gx.2, gx.2) have Φ_proper : IsProperMap Φ := ProperSMul.isProperMap_smul_pair let α : G × t ≃ₜ (Φ ⁻¹' (snd ⁻¹' t)) := have : univ ×ˢ t = Φ ⁻¹' (snd ⁻¹' t) := by rw [univ_prod]; rfl Homeomorph.Set.univ G |>.symm.prodCongr (.refl t) |>.trans ((Homeomorph.Set.prod _ t).symm) |>.trans (Homeomorph.setCongr this) let β : X × t ≃ₜ (snd ⁻¹' t) := Homeomorph.Set.univ X |>.symm.prodCongr (.refl t) |>.trans ((Homeomorph.Set.prod _ t).symm) |>.trans (Homeomorph.setCongr univ_prod) exact β.symm.isProperMap.comp (Φ_proper.restrictPreimage (snd ⁻¹' t)) |>.comp α.isProperMap open Pointwise in /-- If `G` acts on `X` properly, the set `s • t` is closed when `s : Set G` is *closed* and `t : Set X` is *compact*. See also `IsClosed.smul_left_of_isCompact` for a version with the assumptions on `s` and `t` reversed. -/ @[to_additive /-- If `G` acts on `X` properly, the set `s +ᵥ t` is closed when `s : Set G` is *closed* and `t : Set X` is *compact*. In particular, this applies when the action comes from an `IsTopologicalAddTorsor`. See also `IsClosed.vadd_left_of_isCompact` for a version with the assumptions on `s` and `t` reversed. -/] theorem IsClosed.smul_right_of_isCompact [ProperSMul G X] {s : Set G} {t : Set X} (hs : IsClosed s) (ht : IsCompact t) : IsClosed (s • t) := by let Ψ : G × t → X × t := fun gx ↦ (gx.1 • gx.2, gx.2) have Ψ_proper : IsProperMap Ψ := ProperSMul.isProperMap_smul_pair_set have : s • t = (fst ∘ Ψ) '' (fst ⁻¹' s) := subset_antisymm (smul_subset_iff.mpr fun g hg x hx ↦ mem_image_of_mem (fst ∘ Ψ) (x := ⟨g, ⟨x, hx⟩⟩) hg) (image_subset_iff.mpr fun ⟨g, ⟨x, hx⟩⟩ hg ↦ smul_mem_smul hg hx) rw [this] have : CompactSpace t := isCompact_iff_compactSpace.mp ht exact (isProperMap_fst_of_compactSpace.comp Ψ_proper).isClosedMap _ (hs.preimage continuous_fst) /-! One may expect `IsClosed.smul_right_of_isCompact` to hold for arbitrary continuous actions, 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 `ℝ`. -/
.lake/packages/mathlib/Mathlib/Topology/Algebra/ProperAction/ProperlyDiscontinuous.lean
import Mathlib.Topology.Algebra.ProperAction.Basic import Mathlib.Topology.Maps.Proper.CompactlyGenerated /-! # When a proper action is properly discontinuous This file proves that if a discrete group acts on a T2 space `X` such that `X × X` is compactly generated, and if the action is continuous in the second variable, then the action is properly discontinuous if and only if it is proper. This is in particular true if `X` is first-countable or weakly locally compact. ## Main statement * `properlyDiscontinuousSMul_iff_properSMul`: If a discrete group acts on a T2 space `X` such that `X × X` is compactly generated, and if the action is continuous in the second variable, then the action is properly discontinuous if and only if it is proper. ## Tags group action, proper action, properly discontinuous, compactly generated -/ variable {G X : Type*} [Group G] [MulAction G X] [TopologicalSpace G] [TopologicalSpace X] open Prod Set /-- If a discrete group acts on a T2 space `X` such that `X × X` is compactly generated, and if the action is continuous in the second variable, then the action is properly discontinuous if and only if it is proper. This is in particular true if `X` is first-countable or weakly locally compact. There was an older version of this theorem which was changed to this one to make use of the `CompactlyGeneratedSpace` typeclass. (since 2024-11-10) -/ theorem properlyDiscontinuousSMul_iff_properSMul [T2Space X] [DiscreteTopology G] [ContinuousConstSMul G X] [CompactlyGeneratedSpace (X × X)] : 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.2 ⟨(continuous_prod_of_discrete_left.2 continuous_const_smul).prodMk (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 also 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_of_discrete_left.2 continuous_const_smul).prodMk (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)) := ProperSMul.isProperMap_smul_pair.comp <| (Homeomorph.inv G).isProperMap.prodMap isProperMap_id --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
.lake/packages/mathlib/Mathlib/Topology/Algebra/Ring/Compact.lean
import Mathlib.RingTheory.DedekindDomain.Factorization import Mathlib.RingTheory.DiscreteValuationRing.Basic import Mathlib.RingTheory.HopkinsLevitzki import Mathlib.RingTheory.IntegralDomain import Mathlib.RingTheory.LocalRing.Quotient import Mathlib.Topology.Algebra.Group.ClosedSubgroup import Mathlib.Topology.Algebra.Field import Mathlib.Topology.Algebra.Module.Basic import Mathlib.Topology.Algebra.Module.Compact import Mathlib.Topology.Algebra.OpenSubgroup import Mathlib.Topology.Algebra.Ring.Ideal /-! # Compact Hausdorff Rings ## Main results - `IsArtinianRing.finite_of_compactSpace_of_t2Space`: Compact Hausdorff Artinian rings are finite (and thus discrete). - `Ideal.isOpen_of_isMaximal`: Maximal ideals are open in compact Hausdorff Noetherian rings. - `IsLocalRing.isOpen_iff_finite_quotient`: An ideal in a compact Hausdorff Noetherian local ring is open iff it has finite index. - `IsDedekindDomain.isOpen_iff`: An ideal in a compact Hausdorff Dedekind domain (that is not a field) is open iff it is non-zero. ## Future projects Show that compact Hausdorff rings are totally disconnected and linearly topologized. See https://ncatlab.org/nlab/show/compact+Hausdorff+rings+are+profinite -/ attribute [local instance] Ideal.Quotient.field Fintype.ofFinite finite_of_compact_of_discrete DivisionRing.finite_of_compactSpace_of_t2Space variable {R : Type*} [CommRing R] [TopologicalSpace R] variable [IsTopologicalRing R] [CompactSpace R] [T2Space R] namespace IsArtinianRing /-- Compact Hausdorff Artinian (commutative) rings are finite. This is not an instance, as it would apply to every `Finite` goal, causing slowly failing typeclass search in some cases. -/ theorem finite_of_compactSpace_of_t2Space [IsArtinianRing R] : Finite R := by obtain ⟨n, hn⟩ := IsArtinianRing.isNilpotent_jacobson_bot (R := R) have H : (∏ p : PrimeSpectrum R, p.asIdeal) ^ n = ⊥ := by rw [← le_bot_iff, ← Ideal.zero_eq_bot, ← hn] gcongr rw [Ideal.jacobson_bot, Ring.jacobson_eq_sInf_isMaximal, le_sInf_iff] exact fun I hI ↦ Ideal.prod_le_inf.trans (Finset.inf_le (b := PrimeSpectrum.mk I hI.isPrime) (by simp)) have := Ideal.finite_quotient_prod (R := R) PrimeSpectrum.asIdeal Finset.univ (fun _ _ ↦ IsNoetherian.noetherian _) (fun _ _ ↦ inferInstance) have := Ideal.finite_quotient_pow (IsNoetherian.noetherian (∏ p : PrimeSpectrum R, p.asIdeal)) n rw [H] at this exact .of_equiv _ (RingEquiv.quotientBot R).toEquiv end IsArtinianRing section IsNoetherianRing variable [IsNoetherianRing R] lemma Ideal.isOpen_of_isMaximal (I : Ideal R) [I.IsMaximal] : IsOpen (X := R) I := have : I.toAddSubgroup.FiniteIndex := @AddSubgroup.finiteIndex_of_finite_quotient _ _ _ (inferInstanceAs (Finite (R ⧸ I))) I.toAddSubgroup.isOpen_of_isClosed_of_finiteIndex (inferInstanceAs (IsClosed (X := R) I)) lemma Ideal.isOpen_pow_of_isMaximal (I : Ideal R) [I.IsMaximal] (n : ℕ) : IsOpen (X := R) ↑(I ^ n) := have : (I ^ n).toAddSubgroup.FiniteIndex := @AddSubgroup.finiteIndex_of_finite_quotient _ _ _ (Ideal.finite_quotient_pow (IsNoetherian.noetherian _) _) (I ^ n).toAddSubgroup.isOpen_of_isClosed_of_finiteIndex (Ideal.isCompact_of_fg (IsNoetherian.noetherian _)).isClosed -- Note: this is only by infer_instance because of the opened local instances. instance (priority := low) (I : Ideal R) [I.IsMaximal] : Finite (R ⧸ I) := inferInstance end IsNoetherianRing namespace IsLocalRing variable [IsLocalRing R] [IsNoetherianRing R] variable (R) in lemma isOpen_maximalIdeal_pow (n : ℕ) : IsOpen (X := R) ↑(maximalIdeal R ^ n) := Ideal.isOpen_pow_of_isMaximal _ _ variable (R) in lemma isOpen_maximalIdeal : IsOpen (X := R) ↑(maximalIdeal R) := Ideal.isOpen_of_isMaximal _ instance finite_residueField_of_compactSpace : Finite (ResidueField R) := inferInstanceAs (Finite (R ⧸ _)) lemma isOpen_iff_finite_quotient {I : Ideal R} : IsOpen (X := R) I ↔ Finite (R ⧸ I) := by refine ⟨AddSubgroup.quotient_finite_of_isOpen I.toAddSubgroup, fun H ↦ ?_⟩ obtain ⟨n, hn⟩ := exists_maximalIdeal_pow_le_of_isArtinianRing_quotient I exact AddSubgroup.isOpen_mono (H₁ := (maximalIdeal R ^ n).toAddSubgroup) (H₂ := I.toAddSubgroup) hn (isOpen_maximalIdeal_pow R n) end IsLocalRing section IsDedekindDomain lemma IsDedekindDomain.isOpen_of_ne_bot [IsDedekindDomain R] {I : Ideal R} (hI : I ≠ ⊥) : IsOpen (X := R) I := by rw [← Ideal.finprod_heightOneSpectrum_factorization hI, finprod_eq_finset_prod_of_mulSupport_subset _ (s := (Ideal.finite_mulSupport hI).toFinset) (by simp)] refine @AddSubgroup.isOpen_of_isClosed_of_finiteIndex _ _ _ _ (Submodule.toAddSubgroup _) ?_ (IsNoetherianRing.isClosed_ideal _) refine @AddSubgroup.finiteIndex_of_finite_quotient _ _ _ ?_ refine Ideal.finite_quotient_prod _ _ (fun _ _ ↦ IsNoetherian.noetherian _) fun _ _ ↦ ?_ exact Ideal.finite_quotient_pow (IsNoetherian.noetherian _) _ lemma IsDedekindDomain.isOpen_iff [IsDedekindDomain R] (hR : ¬ IsField R) {I : Ideal R} : IsOpen (X := R) I ↔ I ≠ ⊥ := by refine ⟨?_, IsDedekindDomain.isOpen_of_ne_bot⟩ rintro H rfl have := discreteTopology_iff_isOpen_singleton_zero.mpr H exact hR (Finite.isField_of_domain R) lemma IsDiscreteValuationRing.isOpen_iff [IsDomain R] [IsDiscreteValuationRing R] {I : Ideal R} : IsOpen (X := R) I ↔ I ≠ ⊥ := IsDedekindDomain.isOpen_iff (not_isField R) end IsDedekindDomain
.lake/packages/mathlib/Mathlib/Topology/Algebra/Ring/Basic.lean
import Mathlib.Algebra.Order.AbsoluteValue.Basic import Mathlib.Algebra.Ring.Opposite import Mathlib.Algebra.Ring.Prod import Mathlib.Algebra.Ring.Subring.Basic import Mathlib.Topology.Algebra.Group.GroupTopology /-! # 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. -/ assert_not_exists Cardinal open Set Filter TopologicalSpace Function Topology Filter section IsTopologicalSemiring variable (R : 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 `IsTopologicalSemiring` class should *only* be instantiated in the presence of a `NonUnitalNonAssocSemiring` instance; if there is an instance of `NonUnitalNonAssocRing`, then `IsTopologicalRing` should be used. Note: in the presence of `NonAssocRing`, these classes are mathematically equivalent (see `IsTopologicalSemiring.continuousNeg_of_mul` or `IsTopologicalSemiring.toIsTopologicalRing`). -/ class IsTopologicalSemiring [TopologicalSpace R] [NonUnitalNonAssocSemiring R] : Prop extends ContinuousAdd R, ContinuousMul R /-- 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 `IsTopologicalSemiring.continuousNeg_of_mul` and `topological_semiring.to_topological_add_group`) -/ class IsTopologicalRing [TopologicalSpace R] [NonUnitalNonAssocRing R] : Prop extends IsTopologicalSemiring R, ContinuousNeg R variable {R} /-- If `R` is a ring with a continuous multiplication, then negation is continuous as well since it is just multiplication with `-1`. -/ theorem IsTopologicalSemiring.continuousNeg_of_mul [TopologicalSpace R] [NonAssocRing R] [ContinuousMul R] : ContinuousNeg R where continuous_neg := by simpa using (continuous_const.mul continuous_id : Continuous fun x : R => -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 IsTopologicalSemiring.toIsTopologicalRing [TopologicalSpace R] [NonAssocRing R] (_ : IsTopologicalSemiring R) : IsTopologicalRing R where toContinuousNeg := IsTopologicalSemiring.continuousNeg_of_mul -- See note [lower instance priority] instance (priority := 100) IsTopologicalRing.to_topologicalAddGroup [NonUnitalNonAssocRing R] [TopologicalSpace R] [IsTopologicalRing R] : IsTopologicalAddGroup R := ⟨⟩ instance (priority := 50) DiscreteTopology.topologicalSemiring [TopologicalSpace R] [NonUnitalNonAssocSemiring R] [DiscreteTopology R] : IsTopologicalSemiring R := ⟨⟩ instance (priority := 50) DiscreteTopology.topologicalRing [TopologicalSpace R] [NonUnitalNonAssocRing R] [DiscreteTopology R] : IsTopologicalRing R := ⟨⟩ section namespace NonUnitalSubsemiring variable [TopologicalSpace R] [NonUnitalSemiring R] [IsTopologicalSemiring R] instance instIsTopologicalSemiring (S : NonUnitalSubsemiring R) : IsTopologicalSemiring S := { S.toSubsemigroup.continuousMul, S.toAddSubmonoid.continuousAdd with } /-- The (topological) closure of a non-unital subsemiring of a non-unital topological semiring is itself a non-unital subsemiring. -/ def topologicalClosure (s : NonUnitalSubsemiring R) : NonUnitalSubsemiring R := { s.toSubsemigroup.topologicalClosure, s.toAddSubmonoid.topologicalClosure with carrier := _root_.closure (s : Set R) } @[simp] theorem topologicalClosure_coe (s : NonUnitalSubsemiring R) : (s.topologicalClosure : Set R) = _root_.closure (s : Set R) := rfl theorem le_topologicalClosure (s : NonUnitalSubsemiring R) : s ≤ s.topologicalClosure := _root_.subset_closure theorem isClosed_topologicalClosure (s : NonUnitalSubsemiring R) : IsClosed (s.topologicalClosure : Set R) := isClosed_closure theorem topologicalClosure_minimal (s : NonUnitalSubsemiring R) {t : NonUnitalSubsemiring R} (h : s ≤ t) (ht : IsClosed (t : Set R)) : s.topologicalClosure ≤ t := closure_minimal h ht /-- If a non-unital subsemiring of a non-unital topological semiring is commutative, then so is its topological closure. See note [reducible non-instances] -/ abbrev nonUnitalCommSemiringTopologicalClosure [T2Space R] (s : NonUnitalSubsemiring R) (hs : ∀ x y : s, x * y = y * x) : NonUnitalCommSemiring s.topologicalClosure := { NonUnitalSubsemiringClass.toNonUnitalSemiring s.topologicalClosure, s.toSubsemigroup.commSemigroupTopologicalClosure hs with } end NonUnitalSubsemiring variable [TopologicalSpace R] [Semiring R] [IsTopologicalSemiring R] instance : IsTopologicalSemiring (ULift R) where namespace Subsemiring instance topologicalSemiring (S : Subsemiring R) : IsTopologicalSemiring S := { S.toSubmonoid.continuousMul, S.toAddSubmonoid.continuousAdd with } instance continuousSMul (s : Subsemiring R) (X) [TopologicalSpace X] [MulAction R X] [ContinuousSMul R X] : ContinuousSMul s X := Submonoid.continuousSMul end Subsemiring /-- The (topological-space) closure of a subsemiring of a topological semiring is itself a subsemiring. -/ def Subsemiring.topologicalClosure (s : Subsemiring R) : Subsemiring R := { s.toSubmonoid.topologicalClosure, s.toAddSubmonoid.topologicalClosure with carrier := _root_.closure (s : Set R) } @[simp] theorem Subsemiring.topologicalClosure_coe (s : Subsemiring R) : (s.topologicalClosure : Set R) = _root_.closure (s : Set R) := rfl theorem Subsemiring.le_topologicalClosure (s : Subsemiring R) : s ≤ s.topologicalClosure := _root_.subset_closure theorem Subsemiring.isClosed_topologicalClosure (s : Subsemiring R) : IsClosed (s.topologicalClosure : Set R) := isClosed_closure theorem Subsemiring.topologicalClosure_minimal (s : Subsemiring R) {t : Subsemiring R} (h : s ≤ t) (ht : IsClosed (t : Set R)) : s.topologicalClosure ≤ t := closure_minimal h ht /-- If a subsemiring of a topological semiring is commutative, then so is its topological closure. See note [reducible non-instances]. -/ abbrev Subsemiring.commSemiringTopologicalClosure [T2Space R] (s : Subsemiring R) (hs : ∀ x y : s, x * y = y * x) : CommSemiring s.topologicalClosure := { s.topologicalClosure.toSemiring, s.toSubmonoid.commMonoidTopologicalClosure hs with } end section variable {S : Type*} [TopologicalSpace R] [TopologicalSpace S] /-- The product topology on the Cartesian product of two topological semirings makes the product into a topological semiring. -/ instance [NonUnitalNonAssocSemiring R] [NonUnitalNonAssocSemiring S] [IsTopologicalSemiring R] [IsTopologicalSemiring S] : IsTopologicalSemiring (R × S) where /-- The product topology on the Cartesian product of two topological rings makes the product into a topological ring. -/ instance [NonUnitalNonAssocRing R] [NonUnitalNonAssocRing S] [IsTopologicalRing R] [IsTopologicalRing S] : IsTopologicalRing (R × S) where end #adaptation_note /-- nightly-2024-04-08 needed to help `Pi.instIsTopologicalSemiring` -/ instance {ι : Type*} {R : ι → Type*} [∀ i, TopologicalSpace (R i)] [∀ i, NonUnitalNonAssocSemiring (R i)] [∀ i, IsTopologicalSemiring (R i)] : ContinuousAdd ((i : ι) → R i) := inferInstance instance Pi.instIsTopologicalSemiring {ι : Type*} {R : ι → Type*} [∀ i, TopologicalSpace (R i)] [∀ i, NonUnitalNonAssocSemiring (R i)] [∀ i, IsTopologicalSemiring (R i)] : IsTopologicalSemiring (∀ i, R i) where instance Pi.instIsTopologicalRing {ι : Type*} {R : ι → Type*} [∀ i, TopologicalSpace (R i)] [∀ i, NonUnitalNonAssocRing (R i)] [∀ i, IsTopologicalRing (R i)] : IsTopologicalRing (∀ i, R i) := ⟨⟩ section MulOpposite open MulOpposite instance [NonUnitalNonAssocSemiring R] [TopologicalSpace R] [ContinuousAdd R] : ContinuousAdd Rᵐᵒᵖ := continuousAdd_induced opAddEquiv.symm instance [NonUnitalNonAssocSemiring R] [TopologicalSpace R] [IsTopologicalSemiring R] : IsTopologicalSemiring Rᵐᵒᵖ := ⟨⟩ instance [NonUnitalNonAssocRing R] [TopologicalSpace R] [ContinuousNeg R] : ContinuousNeg Rᵐᵒᵖ := opHomeomorph.symm.isInducing.continuousNeg fun _ => rfl instance [NonUnitalNonAssocRing R] [TopologicalSpace R] [IsTopologicalRing R] : IsTopologicalRing Rᵐᵒᵖ := ⟨⟩ end MulOpposite section AddOpposite open AddOpposite instance [NonUnitalNonAssocSemiring R] [TopologicalSpace R] [ContinuousMul R] : ContinuousMul Rᵃᵒᵖ := continuousMul_induced opMulEquiv.symm instance [NonUnitalNonAssocSemiring R] [TopologicalSpace R] [IsTopologicalSemiring R] : IsTopologicalSemiring Rᵃᵒᵖ := ⟨⟩ instance [NonUnitalNonAssocRing R] [TopologicalSpace R] [IsTopologicalRing R] : IsTopologicalRing Rᵃᵒᵖ := ⟨⟩ end AddOpposite section variable {R : Type*} [NonUnitalNonAssocRing R] [TopologicalSpace R] theorem IsTopologicalRing.of_addGroup_of_nhds_zero [IsTopologicalAddGroup 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) : IsTopologicalRing 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 IsTopologicalRing.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)) : IsTopologicalRing R := have := IsTopologicalAddGroup.of_comm_of_nhds_zero hadd hneg hleft IsTopologicalRing.of_addGroup_of_nhds_zero hmul hmul_left hmul_right end variable [TopologicalSpace R] section variable [NonUnitalNonAssocRing R] [IsTopologicalRing R] instance : IsTopologicalRing (ULift R) where /-- In a topological semiring, the left-multiplication `AddMonoidHom` is continuous. -/ theorem mulLeft_continuous (x : R) : Continuous (AddMonoidHom.mulLeft x) := continuous_const.mul continuous_id /-- In a topological semiring, the right-multiplication `AddMonoidHom` is continuous. -/ theorem mulRight_continuous (x : R) : Continuous (AddMonoidHom.mulRight x) := continuous_id.mul continuous_const end namespace NonUnitalSubring variable [NonUnitalRing R] [IsTopologicalRing R] instance instIsTopologicalRing (S : NonUnitalSubring R) : IsTopologicalRing S := { S.toSubsemigroup.continuousMul, inferInstanceAs (IsTopologicalAddGroup S.toAddSubgroup) with } /-- The (topological) closure of a non-unital subring of a non-unital topological ring is itself a non-unital subring. -/ def topologicalClosure (S : NonUnitalSubring R) : NonUnitalSubring R := { S.toSubsemigroup.topologicalClosure, S.toAddSubgroup.topologicalClosure with carrier := _root_.closure (S : Set R) } theorem le_topologicalClosure (s : NonUnitalSubring R) : s ≤ s.topologicalClosure := _root_.subset_closure theorem isClosed_topologicalClosure (s : NonUnitalSubring R) : IsClosed (s.topologicalClosure : Set R) := isClosed_closure theorem topologicalClosure_minimal (s : NonUnitalSubring R) {t : NonUnitalSubring R} (h : s ≤ t) (ht : IsClosed (t : Set R)) : s.topologicalClosure ≤ t := closure_minimal h ht /-- If a non-unital subring of a non-unital topological ring is commutative, then so is its topological closure. See note [reducible non-instances] -/ abbrev nonUnitalCommRingTopologicalClosure [T2Space R] (s : NonUnitalSubring R) (hs : ∀ x y : s, x * y = y * x) : NonUnitalCommRing s.topologicalClosure := { s.topologicalClosure.toNonUnitalRing, s.toSubsemigroup.commSemigroupTopologicalClosure hs with } end NonUnitalSubring variable [Ring R] [IsTopologicalRing R] instance Subring.instIsTopologicalRing (S : Subring R) : IsTopologicalRing S := { S.toSubmonoid.continuousMul, inferInstanceAs (IsTopologicalAddGroup S.toAddSubgroup) with } instance Subring.continuousSMul (s : Subring R) (X) [TopologicalSpace X] [MulAction R X] [ContinuousSMul R X] : ContinuousSMul s X := Subsemiring.continuousSMul s.toSubsemiring X /-- The (topological-space) closure of a subring of a topological ring is itself a subring. -/ def Subring.topologicalClosure (S : Subring R) : Subring R := { S.toSubmonoid.topologicalClosure, S.toAddSubgroup.topologicalClosure with carrier := _root_.closure (S : Set R) } theorem Subring.le_topologicalClosure (s : Subring R) : s ≤ s.topologicalClosure := _root_.subset_closure theorem Subring.isClosed_topologicalClosure (s : Subring R) : IsClosed (s.topologicalClosure : Set R) := isClosed_closure theorem Subring.topologicalClosure_minimal (s : Subring R) {t : Subring R} (h : s ≤ t) (ht : IsClosed (t : Set R)) : s.topologicalClosure ≤ t := closure_minimal h ht /-- If a subring of a topological ring is commutative, then so is its topological closure. See note [reducible non-instances]. -/ abbrev Subring.commRingTopologicalClosure [T2Space R] (s : Subring R) (hs : ∀ x y : s, x * y = y * x) : CommRing s.topologicalClosure := { s.topologicalClosure.toRing, s.toSubmonoid.commMonoidTopologicalClosure hs with } end IsTopologicalSemiring /-! ### Lattice of ring topologies We define a type class `RingTopology R` which endows a ring `R` with a topology such that all ring operations are continuous. Ring topologies on a fixed ring `R` are ordered, by reverse inclusion. They form a complete lattice, with `⊥` the discrete topology and `⊤` the indiscrete topology. Any function `f : R → S` induces `coinduced f : TopologicalSpace R → RingTopology S`. -/ universe u v /-- A ring topology on a ring `R` is a topology for which addition, negation and multiplication are continuous. -/ structure RingTopology (R : Type u) [Ring R] : Type u extends TopologicalSpace R, IsTopologicalRing R namespace RingTopology variable {R : Type*} [Ring R] instance inhabited {R : Type u} [Ring R] : Inhabited (RingTopology R) := ⟨let _ : TopologicalSpace R := ⊤; { continuous_add := continuous_top continuous_mul := continuous_top continuous_neg := continuous_top }⟩ theorem toTopologicalSpace_injective : Injective (toTopologicalSpace : RingTopology R → TopologicalSpace R) := by intro f g _; cases f; cases g; congr @[ext] theorem ext {f g : RingTopology R} (h : f.IsOpen = g.IsOpen) : f = g := toTopologicalSpace_injective <| TopologicalSpace.ext h /-- The ordering on ring topologies on the ring `R`. `t ≤ s` if every set open in `s` is also open in `t` (`t` is finer than `s`). -/ instance : PartialOrder (RingTopology R) := PartialOrder.lift RingTopology.toTopologicalSpace toTopologicalSpace_injective private def def_sInf (S : Set (RingTopology R)) : RingTopology R := 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 `R` 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 R) where sInf := def_sInf sInf_le := fun _ a haS => sInf_le (α := TopologicalSpace R) ⟨a, ⟨haS, rfl⟩⟩ le_sInf := fun _ _ h => le_sInf (α := TopologicalSpace R) <| forall_mem_image.2 h instance : CompleteLattice (RingTopology R) := completeLatticeOfCompleteSemilatticeInf _ /-- Given `f : R → S` and a topology on `R`, the coinduced ring topology on `S` is the finest topology such that `f` is continuous and `S` is a topological ring. -/ def coinduced {R S : Type*} [t : TopologicalSpace R] [Ring S] (f : R → S) : RingTopology S := sInf { b : RingTopology S | t.coinduced f ≤ b.toTopologicalSpace } theorem coinduced_continuous {R S : Type*} [t : TopologicalSpace R] [Ring S] (f : R → S) : 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 R) : AddGroupTopology R where toTopologicalSpace := t.toTopologicalSpace toIsTopologicalAddGroup := @IsTopologicalRing.to_topologicalAddGroup _ _ t.toTopologicalSpace t.toIsTopologicalRing /-- The order embedding from ring topologies on `a` to additive group topologies on `a`. -/ def toAddGroupTopology.orderEmbedding : OrderEmbedding (RingTopology R) (AddGroupTopology R) := 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] [Semiring S] [PartialOrder 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
.lake/packages/mathlib/Mathlib/Topology/Algebra/Ring/Ideal.lean
import Mathlib.Topology.Algebra.Ring.Basic import Mathlib.Topology.Algebra.Group.Quotient import Mathlib.RingTheory.Ideal.Quotient.Defs /-! # 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. -/ open Topology section Ring variable {R : Type*} [TopologicalSpace R] [Ring R] [IsTopologicalRing 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 /-- This is not `@[simp]` since otherwise it causes timeouts downstream as `simp` tries and fails to generate 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 [IsTopologicalRing R] theorem QuotientRing.isOpenMap_coe : IsOpenMap (mk N) := QuotientAddGroup.isOpenMap_coe theorem QuotientRing.isOpenQuotientMap_mk : IsOpenQuotientMap (mk N) := QuotientAddGroup.isOpenQuotientMap_mk theorem QuotientRing.isQuotientMap_coe_coe : IsQuotientMap fun p : R × R => (mk N p.1, mk N p.2) := ((isOpenQuotientMap_mk N).prodMap (isOpenQuotientMap_mk N)).isQuotientMap instance topologicalRing_quotient : IsTopologicalRing (R ⧸ N) where __ := QuotientAddGroup.instIsTopologicalAddGroup _ continuous_mul := (QuotientRing.isQuotientMap_coe_coe N).continuous_iff.2 <| continuous_quot_mk.comp continuous_mul instance [CompactSpace R] : CompactSpace (R ⧸ N) := Quotient.compactSpace end CommRing
.lake/packages/mathlib/Mathlib/Topology/Algebra/Ring/Real.lean
import Mathlib.Data.EReal.Operations import Mathlib.Topology.Algebra.Order.Field import Mathlib.Topology.Algebra.IsUniformGroup.Defs import Mathlib.Topology.Bornology.Real import Mathlib.Topology.Instances.Int import Mathlib.Topology.Order.MonotoneContinuity import Mathlib.Topology.Order.Real import Mathlib.Topology.UniformSpace.Real /-! # Topological algebra properties of ℝ This file defines topological field/(semi)ring structures on the (extended) (nonnegative) reals and shows the algebraic operations are (uniformly) continuous. It also includes a bit of more general topological theory of the reals, needed to define the structures and prove continuity. -/ assert_not_exists StarRing UniformContinuousConstSMul UniformOnFun noncomputable section universe u v w variable {α : Type u} {β : Type v} {γ : Type w} instance : NoncompactSpace ℝ := Int.isClosedEmbedding_coe_real.noncompactSpace theorem Real.uniformContinuous_add : UniformContinuous fun p : ℝ × ℝ => p.1 + p.2 := Metric.uniformContinuous_iff.2 fun _ε ε0 => let ⟨δ, δ0, Hδ⟩ := rat_add_continuous_lemma abs ε0 ⟨δ, δ0, fun _ _ h => let ⟨h₁, h₂⟩ := max_lt_iff.1 h Hδ h₁ h₂⟩ theorem Real.uniformContinuous_neg : UniformContinuous (@Neg.neg ℝ _) := Metric.uniformContinuous_iff.2 fun ε ε0 => ⟨_, ε0, fun _ _ h => by simpa only [abs_sub_comm, Real.dist_eq, neg_sub_neg] using h⟩ instance : IsUniformAddGroup ℝ := IsUniformAddGroup.mk' Real.uniformContinuous_add Real.uniformContinuous_neg theorem Real.uniformContinuous_const_mul {x : ℝ} : UniformContinuous (x * ·) := uniformContinuous_of_continuousAt_zero (DistribMulAction.toAddMonoidHom ℝ x) (continuous_const_smul x).continuousAt -- short-circuit type class inference instance : IsTopologicalAddGroup ℝ := by infer_instance instance : IsTopologicalRing ℝ := inferInstance instance : IsTopologicalDivisionRing ℝ := inferInstance namespace EReal instance : ContinuousNeg EReal := ⟨negOrderIso.continuous⟩ end EReal namespace NNReal /-! Instances for the following typeclasses are defined: * `IsTopologicalSemiring ℝ≥0` * `ContinuousSub ℝ≥0` * `ContinuousInv₀ ℝ≥0` (continuity of `x⁻¹` away from `0`) * `ContinuousSMul ℝ≥0 α` (whenever `α` has a continuous `MulAction ℝ α`) Everything is inherited from the corresponding structures on the reals. -/ -- short-circuit type class inference instance : IsTopologicalSemiring ℝ≥0 where toContinuousAdd := continuousAdd_induced toRealHom toContinuousMul := continuousMul_induced toRealHom instance : ContinuousSub ℝ≥0 := ⟨((continuous_coe.fst'.sub continuous_coe.snd').max continuous_const).subtype_mk _⟩ instance : ContinuousInv₀ ℝ≥0 := inferInstance variable {α : Type*} instance [TopologicalSpace α] [MulAction ℝ α] [ContinuousSMul ℝ α] : ContinuousSMul ℝ≥0 α where continuous_smul := continuous_induced_dom.fst'.smul continuous_snd end NNReal namespace ENNReal open Filter NNReal Set Topology theorem isEmbedding_coe : IsEmbedding ((↑) : ℝ≥0 → ℝ≥0∞) := coe_strictMono.isEmbedding_of_ordConnected <| by rw [range_coe']; exact ordConnected_Iio @[simp, norm_cast] theorem tendsto_coe {f : Filter α} {m : α → ℝ≥0} {a : ℝ≥0} : Tendsto (fun a => (m a : ℝ≥0∞)) f (𝓝 ↑a) ↔ Tendsto m f (𝓝 a) := isEmbedding_coe.tendsto_nhds_iff.symm theorem isOpenEmbedding_coe : IsOpenEmbedding ((↑) : ℝ≥0 → ℝ≥0∞) := ⟨isEmbedding_coe, by rw [range_coe']; exact isOpen_Iio⟩ theorem nhds_coe_coe {r p : ℝ≥0} : 𝓝 ((r : ℝ≥0∞), (p : ℝ≥0∞)) = (𝓝 (r, p)).map fun p : ℝ≥0 × ℝ≥0 => (↑p.1, ↑p.2) := ((isOpenEmbedding_coe.prodMap isOpenEmbedding_coe).map_nhds_eq (r, p)).symm instance : ContinuousAdd ℝ≥0∞ := by refine ⟨continuous_iff_continuousAt.2 ?_⟩ rintro ⟨_ | a, b⟩ · exact tendsto_nhds_top_mono' continuousAt_fst fun p => le_add_right le_rfl rcases b with (_ | b) · exact tendsto_nhds_top_mono' continuousAt_snd fun p => le_add_left le_rfl simp only [ContinuousAt, some_eq_coe, nhds_coe_coe, ← coe_add, tendsto_map'_iff, Function.comp_def, tendsto_coe, tendsto_add] instance : ContinuousInv ℝ≥0∞ := ⟨OrderIso.invENNReal.continuous⟩ end ENNReal
.lake/packages/mathlib/Mathlib/Topology/Algebra/InfiniteSum/GroupCompletion.lean
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 α] [IsUniformAddGroup α] {L : SummationFilter β} /-- 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 L ↔ HasSum f a L := (isDenseInducing_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 L ↔ Summable (toCompl ∘ f) L ∧ ∑'[L] i, toCompl (f i) ∈ Set.range toCompl := (isDenseInducing_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 ∈ 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 [L.NeBot] {f : β → α} (hf : Summable f L) : ∑'[L] i, toCompl (f i) = ∑'[L] i, f i := (hf.map_tsum toCompl (continuous_coe α)).symm
.lake/packages/mathlib/Mathlib/Topology/Algebra/InfiniteSum/NatInt.lean
import Mathlib.Logic.Encodable.Lattice import Mathlib.Order.Filter.AtTopBot.Finset import Mathlib.Topology.Algebra.InfiniteSum.Group /-! # 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 `[IsTopologicalAddGroup G]`, here as some results require -- `[IsUniformAddGroup G]` instead /-! ## Sums over `ℕ` -/ section Nat section Monoid /-- 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 HasProd.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)) := h.hasProd.tendsto_prod_nat namespace 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) := ((range k).hasProd f).mul_compl <| (notMemRangeEquiv k).symm.hasProd_iff.mp h @[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 [Function.comp_def] 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] protected theorem Multipliable.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 hf.prod_mul_tprod_nat_mul'.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 IsTopologicalGroup variable [TopologicalSpace G] [IsTopologicalGroup 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] protected theorem Multipliable.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 := Multipliable.prod_mul_tprod_nat_mul' <| (multipliable_nat_add_iff k).2 h @[to_additive] protected theorem Multipliable.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, hf.prod_mul_tprod_nat_add i] 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 IsTopologicalGroup section IsUniformGroup variable [UniformSpace G] [IsUniformGroup 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_gt (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_gt 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 IsUniformGroup section IsTopologicalGroup variable [TopologicalSpace G] [IsTopologicalGroup 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 := IsTopologicalGroup.rightUniformSpace G have : IsUniformGroup G := isUniformGroup_of_commGroup 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 IsTopologicalGroup 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, reduceCtorEq] @[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₂) @[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] 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] at hx suffices x = 0 by simp only [this, if_true] cutsat _ = (∏ x ∈ u1, f x) * ∏ x ∈ u2, f x := prod_union_inter _ = (∏ b ∈ v', f b) * ∏ b ∈ v', f (-b) := by simp [u1, u2] _ = ∏ b ∈ v', (f b * f (-b)) := prod_mul_distrib.symm⟩ @[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₂ @[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 IsTopologicalGroup variable [TopologicalSpace G] [IsTopologicalGroup 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 @[to_additive] protected lemma Multipliable.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 IsTopologicalGroup section IsUniformGroup -- results which depend on completeness variable [UniformSpace G] [IsUniformGroup 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] -- We're not really using the ring structure here: -- we only use multiplication by `-1`, so perhaps this can be generalised further. theorem Summable.alternating {α} [Ring α] [UniformSpace α] [IsUniformAddGroup α] [CompleteSpace α] {f : ℕ → α} (hf : Summable f) : Summable (fun n => (-1) ^ n * f n) := by apply Summable.even_add_odd · simp only [even_two, Even.mul_right, Even.neg_pow, one_pow, one_mul] exact hf.comp_injective (mul_right_injective₀ (two_ne_zero' ℕ)) · simp only [pow_add, even_two, Even.mul_right, Even.neg_pow, one_pow, pow_one, mul_neg, mul_one, neg_mul, one_mul] apply Summable.neg apply hf.comp_injective exact (add_left_injective 1).comp (mul_right_injective₀ (two_ne_zero' ℕ)) end IsUniformGroup end Int section PNat @[to_additive] theorem multipliable_pnat_iff_multipliable_succ {f : ℕ → M} : Multipliable (fun x : ℕ+ ↦ f x) ↔ Multipliable fun x ↦ f (x + 1) := Equiv.pnatEquivNat.symm.multipliable_iff.symm @[deprecated (since := "2025-09-31")] alias pnat_multipliable_iff_multipliable_succ := multipliable_pnat_iff_multipliable_succ @[to_additive] theorem tprod_pnat_eq_tprod_succ {f : ℕ → M} : ∏' n : ℕ+, f n = ∏' n, f (n + 1) := (Equiv.pnatEquivNat.symm.tprod_eq _).symm @[to_additive] lemma tprod_zero_pnat_eq_tprod_nat [TopologicalSpace G] [IsTopologicalGroup G] [T2Space G] {f : ℕ → G} (hf : Multipliable f) : f 0 * ∏' n : ℕ+, f ↑n = ∏' n, f n := by simpa [hf.tprod_eq_zero_mul] using tprod_pnat_eq_tprod_succ @[to_additive tsum_int_eq_zero_add_two_mul_tsum_pnat] theorem tprod_int_eq_zero_mul_tprod_pnat_sq [UniformSpace G] [IsUniformGroup G] [CompleteSpace G] [T2Space G] {f : ℤ → G} (hf : ∀ n : ℤ, f (-n) = f n) (hf2 : Multipliable f) : ∏' n, f n = f 0 * (∏' n : ℕ+, f n) ^ 2 := by have hf3 : Multipliable fun n : ℕ ↦ f n := (multipliable_int_iff_multipliable_nat_and_neg.mp hf2).1 have hf4 : Multipliable fun n : ℕ+ ↦ f n := by rwa [multipliable_pnat_iff_multipliable_succ (f := (f ·)), multipliable_nat_add_iff 1 (f := (f ·))] have := tprod_nat_mul_neg hf2 rw [← tprod_zero_pnat_eq_tprod_nat (by simpa [hf] using hf3.mul hf3), mul_comm _ (f 0)] at this simp only [hf, Nat.cast_zero, mul_assoc, mul_right_inj] at this rw [← this, mul_right_inj, hf4.tprod_mul hf4, sq] end PNat
.lake/packages/mathlib/Mathlib/Topology/Algebra/InfiniteSum/ENNReal.lean
import Mathlib.Data.Real.ENatENNReal import Mathlib.Data.Set.Card import Mathlib.Topology.Instances.ENNReal.Lemmas /-! # Infinite sums of ENNReal and Set.encard This file provides lemmas relating sums of constants to the cardinality of the domain of these sums. ## TODO + Once we have a topology on `ENat`, provide an `ENat`-valued version + Provide versions which sum over the whole type. -/ open Set Function variable {α : Type*} (s : Set α) namespace ENNReal lemma tsum_set_one : ∑' _ : s, (1 : ℝ≥0∞) = s.encard := by obtain (hfin | hinf) := Set.finite_or_infinite s · lift s to Finset α using hfin simp [tsum_fintype] · have : Infinite s := infinite_coe_iff.mpr hinf rw [tsum_const_eq_top_of_ne_zero one_ne_zero, encard_eq_top hinf, ENat.toENNReal_top] lemma tsum_set_const (c : ℝ≥0∞) : ∑' _ : s, c = s.encard * c := by simp [← tsum_set_one, ← ENNReal.tsum_mul_right] @[simp] lemma tsum_one : ∑' _ : α, (1 : ℝ≥0∞) = ENat.card α := by rw [← tsum_univ]; simpa [encard_univ] using tsum_set_one univ @[simp] lemma tsum_const (c : ℝ≥0∞) : ∑' _ : α, c = ENat.card α * c := by rw [← tsum_univ]; simpa [encard_univ] using tsum_set_const univ c end ENNReal
.lake/packages/mathlib/Mathlib/Topology/Algebra/InfiniteSum/Module.lean
import Mathlib.Topology.Algebra.InfiniteSum.Constructions import Mathlib.Topology.Algebra.Module.Equiv /-! # Infinite sums in topological vector spaces -/ variable {α β γ δ : Type*} open Filter Finset Function section ConstSMul variable [Monoid γ] [TopologicalSpace α] [AddCommMonoid α] [DistribMulAction γ α] [ContinuousConstSMul γ α] {f : β → α} {L : SummationFilter β} theorem HasSum.const_smul {a : α} (b : γ) (hf : HasSum f a L) : HasSum (fun i ↦ b • f i) (b • a) L := hf.map (DistribMulAction.toAddMonoidHom α _) <| continuous_const_smul _ theorem Summable.const_smul (b : γ) (hf : Summable f L) : Summable (fun i ↦ b • f i) L := (hf.hasSum.const_smul _).summable /-- Infinite sums commute with scalar multiplication. Version for scalars living in a `Monoid`, but requiring a summability hypothesis. -/ protected theorem Summable.tsum_const_smul [T2Space α] [L.NeBot] (b : γ) (hf : Summable f L) : ∑'[L] i, b • f i = b • ∑'[L] 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 : γ) : ∑'[L] (i : β), g • f i = g • ∑'[L] (i : β), f i := ((Homeomorph.smul g).isClosedEmbedding.map_tsum f (g := show α ≃+ α from { AddMonoidHom.smulLeft g with invFun := AddMonoidHom.smulLeft g⁻¹, left_inv a := by simp, right_inv a := by simp })).symm /-- Infinite sums commute with scalar multiplication. Version for scalars living in a `DivisionSemiring`; 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*} [DivisionSemiring γ] [Module γ α] [ContinuousConstSMul γ α] [T2Space α] (g : γ) : ∑'[L] (i : β), g • f i = g • ∑'[L] (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} {L : SummationFilter ι} theorem HasSum.smul_const {r : R} (hf : HasSum f r L) (a : M) : HasSum (fun z ↦ f z • a) (r • a) L := hf.map ((smulAddHom R M).flip a) (continuous_id.smul continuous_const) theorem Summable.smul_const (hf : Summable f L) (a : M) : Summable (fun z ↦ f z • a) L := (hf.hasSum.smul_const _).summable protected theorem Summable.tsum_smul_const [T2Space M] [L.NeBot] (hf : Summable f L) (a : M) : ∑'[L] z, f z • a = (∑'[L] 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 σ' σ] {L : SummationFilter ι} /-- 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 L) : HasSum (fun b : ι ↦ φ (f b)) (φ x) L := 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 L) : Summable (fun b : ι ↦ φ (f b)) L:= (hf.hasSum.mapL φ).summable alias Summable.mapL := ContinuousLinearMap.summable protected theorem ContinuousLinearMap.map_tsum [T2Space M₂] [L.NeBot] {f : ι → M} (φ : M →SL[σ] M₂) (hf : Summable f L) : φ (∑'[L] z, f z) = ∑'[L] 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 L ↔ HasSum f (e.symm y) L := ⟨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) L ↔ HasSum f x L := by rw [e.hasSum, ContinuousLinearEquiv.symm_apply_apply] protected theorem ContinuousLinearEquiv.summable {f : ι → M} (e : M ≃SL[σ] M₂) : (Summable (fun b : ι ↦ e (f b)) L) ↔ Summable f L := ⟨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₂} : (∑'[L] z, e (f z)) = y ↔ ∑'[L] z, f z = e.symm y := by by_cases hf : Summable f L · by_cases hL : L.NeBot · 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⟩ · simp only [tsum_bot hL, eq_symm_apply] constructor <;> rintro rfl exacts [e.map_finsum f, (e.map_finsum f).symm] · have hf' : ¬Summable (fun z ↦ e (f z)) L := 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 (∑'[L] z, f z) = ∑'[L] 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] -- we can't use `to_additive`, because it tries to translate `•` into `+ᵥ` /-- 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'' _ 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 end automorphize
.lake/packages/mathlib/Mathlib/Topology/Algebra/InfiniteSum/Ring.lean
import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.BigOperators.Ring.Finset import Mathlib.Algebra.Ring.GeomSum import Mathlib.Topology.Algebra.InfiniteSum.Constructions import Mathlib.Topology.Algebra.InfiniteSum.NatInt import Mathlib.Topology.Algebra.GroupWithZero 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 * `Summable.tsum_pow_mul_one_sub`, `Summable.one_sub_mul_tsum_pow`: geometric series formula. * `tprod_one_add`: expanding `∏' i : ι, (1 + f i)` as infinite sum. -/ open Filter Finset Function variable {ι κ α : Type*} {L : SummationFilter ι} section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] [TopologicalSpace α] [IsTopologicalSemiring α] {f : ι → α} {a₁ : α} theorem HasSum.mul_left (a₂) (h : HasSum f a₁ L) : HasSum (fun i ↦ a₂ * f i) (a₂ * a₁) L := by simpa only using h.map (AddMonoidHom.mulLeft a₂) (continuous_const.mul continuous_id) theorem HasSum.mul_right (a₂) (hf : HasSum f a₁ L) : HasSum (fun i ↦ f i * a₂) (a₁ * a₂) L := by simpa only using hf.map (AddMonoidHom.mulRight a₂) (continuous_id.mul continuous_const) theorem Summable.mul_left (a) (hf : Summable f L) : Summable (fun i ↦ a * f i) L := (hf.hasSum.mul_left _).summable theorem Summable.mul_right (a) (hf : Summable f L) : Summable (fun i ↦ f i * a) L := (hf.hasSum.mul_right _).summable section tsum variable [T2Space α] [L.NeBot] protected theorem Summable.tsum_mul_left (a) (hf : Summable f L) : ∑'[L] i, a * f i = a * ∑'[L] i, f i := (hf.hasSum.mul_left _).tsum_eq protected theorem Summable.tsum_mul_right (a) (hf : Summable f L) : ∑'[L] i, f i * a = (∑'[L] i, f i) * a := (hf.hasSum.mul_right _).tsum_eq theorem Commute.tsum_right (a) (h : ∀ i, Commute a (f i)) : Commute a (∑'[L] i, f i) := by classical by_cases hf : Summable f L · exact (hf.tsum_mul_left a).symm.trans ((tsum_congr h).trans (hf.tsum_mul_right a)) · exact (tsum_eq_zero_of_not_summable hf).symm ▸ Commute.zero_right _ theorem Commute.tsum_left (a) (h : ∀ i, Commute (f i) a) : Commute (∑'[L] i, f i) a := (Commute.tsum_right _ fun i ↦ (h i).symm).symm end tsum end NonUnitalNonAssocSemiring section DivisionSemiring variable [DivisionSemiring α] [TopologicalSpace α] [IsTopologicalSemiring α] {f : ι → α} {a a₁ a₂ : α} theorem HasSum.div_const (h : HasSum f a L) (b : α) : HasSum (fun i ↦ f i / b) (a / b) L := by simp only [div_eq_mul_inv, h.mul_right b⁻¹] theorem Summable.div_const (h : Summable f L) (b : α) : Summable (fun i ↦ f i / b) L := (h.hasSum.div_const _).summable theorem hasSum_mul_left_iff (h : a₂ ≠ 0) : HasSum (fun i ↦ a₂ * f i) (a₂ * a₁) L ↔ HasSum f a₁ L:= ⟨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₂) L ↔ HasSum f a₁ L := ⟨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₂) L ↔ HasSum f a₁ L := 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) L) ↔ Summable f L := ⟨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) L) ↔ Summable f L:= ⟨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) L) ↔ Summable f L := by simpa only [div_eq_mul_inv] using summable_mul_right_iff (inv_ne_zero h) theorem tsum_mul_left [T2Space α] : ∑'[L] x, a * f x = a * ∑'[L] x, f x := by by_cases ha : a = 0 · simp [ha] · exact ((Homeomorph.mulLeft₀ a ha).isClosedEmbedding.map_tsum f (g := AddMonoidHom.mulLeft a)).symm theorem tsum_mul_right [T2Space α] : ∑'[L] x, f x * a = (∑'[L] x, f x) * a := by by_cases ha : a = 0 · simp [ha] · exact ((Homeomorph.mulRight₀ a ha).isClosedEmbedding.map_tsum f (g := AddMonoidHom.mulRight a)).symm theorem tsum_div_const [T2Space α] : ∑'[L] x, f x / a = (∑'[L] x, f x) / a := by simpa only [div_eq_mul_inv] using tsum_mul_right theorem HasSum.const_div (h : HasSum (fun x ↦ 1 / f x) a L) (b : α) : HasSum (fun i ↦ b / f i) (b * a) L := by have := h.mul_left b simpa only [div_eq_mul_inv, one_mul] using this theorem Summable.const_div (h : Summable (fun x ↦ 1 / f x) L) (b : α) : Summable (fun i ↦ b / f i) L := (h.hasSum.const_div b).summable theorem hasSum_const_div_iff (h : a₂ ≠ 0) : HasSum (fun i ↦ a₂ / f i) (a₂ * a₁) L ↔ HasSum (1/ f) a₁ L := by simpa only [div_eq_mul_inv, one_mul] using hasSum_mul_left_iff h theorem summable_const_div_iff (h : a ≠ 0) : (Summable (fun i ↦ a / f i) L) ↔ Summable (1 / f) L := by simpa only [div_eq_mul_inv, one_mul] using summable_mul_left_iff h 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 α] [IsTopologicalSemiring α] {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. -/ protected theorem Summable.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 α] [IsTopologicalSemiring α] 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 (L := .unconditional _)] exact h.sigma' fun n ↦ (hasSum_fintype _).summable /-- The **Cauchy product formula** for the product of two infinite 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. -/ protected theorem Summable.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 (L := .unconditional _)] rw [hf.tsum_mul_tsum hg hfg, ← sigmaAntidiagonalEquivProd.tsum_eq (_ : A × A → α)] exact (summable_mul_prod_iff_summable_mul_sigma_antidiagonal.mp hfg).tsum_sigma' (fun n ↦ (hasSum_fintype _).summable) end HasAntidiagonal section Nat variable [TopologicalSpace α] [NonUnitalNonAssocSemiring α] {f g : ℕ → α} variable [T3Space α] [IsTopologicalSemiring α] 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. -/ protected theorem Summable.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 hf.tsum_mul_tsum_eq_tsum_sum_antidiagonal hg hfg end Nat end CauchyProduct section GeomSeries /-! ### Geometric series `∑' n : ℕ, x ^ n` This section gives a general result about geometric series without assuming additional structure on the topological ring. For normed ring, see also `geom_series_mul_neg` and friends. -/ variable [Ring α] [TopologicalSpace α] [IsTopologicalRing α] [T2Space α] theorem Summable.tsum_pow_mul_one_sub {x : α} (h : Summable (x ^ ·)) : (∑' (i : ℕ), x ^ i) * (1 - x) = 1 := by refine tendsto_nhds_unique (h.hasSum.mul_right (1 - x)).tendsto_sum_nat ?_ simpa [← Finset.sum_mul, geom_sum_mul_neg] using tendsto_const_nhds.sub h.tendsto_atTop_zero theorem Summable.one_sub_mul_tsum_pow {x : α} (h : Summable (x ^ ·)) : (1 - x) * ∑' (i : ℕ), x ^ i = 1 := by refine tendsto_nhds_unique (h.hasSum.mul_left (1 - x)).tendsto_sum_nat ?_ simpa [← Finset.mul_sum, mul_neg_geom_sum] using tendsto_const_nhds.sub h.tendsto_atTop_zero end GeomSeries section ProdOneSum /-! ### Infinite product of `1 + f i` This section extends `Finset.prod_one_add` to the infinite product `∏' i : ι, (1 + f i) = ∑' s : Finset ι, ∏ i ∈ s, f i`. -/ variable [CommSemiring α] [TopologicalSpace α] {f : ι → α} theorem hasProd_one_add_of_hasSum_prod {a : α} (h : HasSum (∏ i ∈ ·, f i) a) : HasProd (1 + f ·) a := by simp_rw [HasProd, prod_one_add] exact h.comp tendsto_finset_powerset_atTop_atTop /-- `∏' i : ι, (1 + f i)` is convergent if `∑' s : Finset ι, ∏ i ∈ s, f i` is convergent. For complete normed ring, see also `multipliable_one_add_of_summable`. -/ theorem multipliable_one_add_of_summable_prod (h : Summable (∏ i ∈ ·, f i)) : Multipliable (1 + f ·) := by obtain ⟨a, h⟩ := h exact ⟨a, hasProd_one_add_of_hasSum_prod h⟩ theorem tprod_one_add [T2Space α] (h : Summable (∏ i ∈ ·, f i)) : ∏' i, (1 + f i) = ∑' s, ∏ i ∈ s, f i := HasProd.tprod_eq <| hasProd_one_add_of_hasSum_prod h.hasSum end ProdOneSum
.lake/packages/mathlib/Mathlib/Topology/Algebra/InfiniteSum/Group.lean
import Mathlib.SetTheory.Cardinal.Finite import Mathlib.Topology.Algebra.InfiniteSum.Basic import Mathlib.Topology.UniformSpace.Cauchy import Mathlib.Topology.Algebra.IsUniformGroup.Defs import Mathlib.Topology.Algebra.Group.Pointwise /-! # 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*} {L : SummationFilter β} section IsTopologicalGroup variable [CommGroup α] [TopologicalSpace α] [IsTopologicalGroup α] variable {f g : β → α} {a a₁ a₂ : α} -- `by simpa using` speeds up elaboration. Why? @[to_additive] theorem HasProd.inv (h : HasProd f a L) : HasProd (fun b ↦ (f b)⁻¹) a⁻¹ L := by simpa only using h.map (MonoidHom.id α)⁻¹ continuous_inv @[to_additive] theorem Multipliable.inv (hf : Multipliable f L) : Multipliable (fun b ↦ (f b)⁻¹) L := hf.hasProd.inv.multipliable @[to_additive] theorem Multipliable.of_inv (hf : Multipliable (fun b ↦ (f b)⁻¹) L) : Multipliable f L := by simpa only [inv_inv] using hf.inv @[to_additive] theorem multipliable_inv_iff : (Multipliable (fun b ↦ (f b)⁻¹) L) ↔ Multipliable f L:= ⟨Multipliable.of_inv, Multipliable.inv⟩ @[to_additive] theorem HasProd.div (hf : HasProd f a₁ L) (hg : HasProd g a₂ L) : HasProd (fun b ↦ f b / g b) (a₁ / a₂) L := by simp only [div_eq_mul_inv] exact hf.mul hg.inv @[to_additive] theorem Multipliable.div (hf : Multipliable f L) (hg : Multipliable g L) : Multipliable (fun b ↦ f b / g b) L := (hf.hasProd.div hg.hasProd).multipliable @[to_additive] theorem Multipliable.trans_div (hg : Multipliable g L) (hfg : Multipliable (fun b ↦ f b / g b) L) : Multipliable f L := 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) L) : Multipliable f L ↔ Multipliable g L := ⟨fun hf ↦ hf.trans_div <| by simpa only [inv_div] using hfg.inv, fun hg ↦ hg.trans_div hfg⟩ @[to_additive] theorem HasProd.update [L.LeAtTop] (hf : HasProd f a₁ L) (b : β) [DecidableEq β] (a : α) : HasProd (update f b a) (a / f b * a₁) L := by convert (hasProd_ite_eq b (a / f b) (L := L)).mul hf with b' by_cases h : b' = b · rw [h, update_self] simp · simp only [h, update_of_ne, if_false, Ne, one_mul, not_false_iff] @[to_additive] theorem Multipliable.update [L.LeAtTop] (hf : Multipliable f L) (b : β) [DecidableEq β] (a : α) : Multipliable (update f b a) L := (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 [L.LeAtTop] [DecidableEq β] (hf : HasProd f a L) (b : β) : HasProd (fun n ↦ ite (n = b) 1 (f n)) (a / f b) L := by convert hf.update b 1 using 1 · ext n rw [Function.update_apply] · rw [div_mul_eq_mul_div, one_mul] /-- A more general version of `Multipliable.congr`, allowing the functions to disagree on a finite set. Note that this requires the target to be a group, and hence fails for products valued in a ring. See `Multipliable.congr_cofinite₀` for a version applying in this case, with an additional non-vanishing hypothesis. -/ @[to_additive /-- A more general version of `Summable.congr`, allowing the functions to disagree on a finite set. -/] theorem Multipliable.congr_cofinite (hf : Multipliable f) (hfg : f =ᶠ[cofinite] g) : Multipliable g := hfg.multipliable_compl_iff.mp <| (hfg.multipliable_compl_iff.mpr hf).congr (by simp) /-- A more general version of `multipliable_congr`, allowing the functions to disagree on a finite set. -/ @[to_additive /-- A more general version of `summable_congr`, allowing the functions to disagree on a finite set. -/] theorem multipliable_congr_cofinite (hfg : f =ᶠ[cofinite] g) : Multipliable f ↔ Multipliable g := ⟨fun h ↦ h.congr_cofinite hfg, fun h ↦ h.congr_cofinite (hfg.mono fun _ h' ↦ h'.symm)⟩ @[to_additive] theorem Multipliable.congr_atTop {f₁ g₁ : ℕ → α} (hf : Multipliable f₁) (hfg : f₁ =ᶠ[atTop] g₁) : Multipliable g₁ := hf.congr_cofinite (Nat.cofinite_eq_atTop ▸ hfg) @[to_additive] theorem multipliable_congr_atTop {f₁ g₁ : ℕ → α} (hfg : f₁ =ᶠ[atTop] g₁) : Multipliable f₁ ↔ Multipliable g₁ := multipliable_congr_cofinite (Nat.cofinite_eq_atTop ▸ hfg) section tprod variable [T2Space α] @[to_additive] theorem tprod_inv : ∏'[L] b, (f b)⁻¹ = (∏'[L] b, f b)⁻¹ := ((Homeomorph.inv α).isClosedEmbedding.map_tprod f (g := MulEquiv.inv α)).symm @[to_additive] protected theorem Multipliable.tprod_div [L.NeBot] (hf : Multipliable f L) (hg : Multipliable g L) : ∏'[L] b, (f b / g b) = (∏'[L] b, f b) / ∏'[L] b, g b := (hf.hasProd.div hg.hasProd).tprod_eq @[to_additive] protected theorem Multipliable.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. -/] protected theorem Multipliable.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 IsTopologicalGroup section IsUniformGroup 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 [IsUniformGroup α] {f g : β → α} @[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, prod_atTop_atTop_eq, uniformity_eq_comap_nhds_one α, tendsto_comap_iff, Function.comp_def, 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 with g b = f b, f b = ∏ b ∈ t, g b := calc ∏ b ∈ t with g b = f b, f b = ∏ b ∈ t with 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_notMem 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] protected theorem Multipliable.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] protected theorem Multipliable.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 [← hf.tprod_subtype_mul_tprod_subtype_compl s] simp only [Finset.tprod_subtype', mul_right_inj] rfl end IsUniformGroup section IsTopologicalGroup variable {G : Type*} [TopologicalSpace G] [CommGroup G] [IsTopologicalGroup 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 := IsTopologicalGroup.rightUniformSpace G have : IsUniformGroup G := isUniformGroup_of_commGroup 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 := IsTopologicalGroup.rightUniformSpace G have : IsUniformGroup G := isUniformGroup_of_commGroup 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_notMem.mono fun x hx ↦ ?_ · simpa using hs {x} (disjoint_singleton_left.2 hx) @[to_additive] theorem Multipliable.finite_mulSupport_of_discreteTopology {α : Type*} [CommGroup α] [TopologicalSpace α] [DiscreteTopology α] {β : Type*} (f : β → α) (h : Multipliable f) : Set.Finite f.mulSupport := haveI : IsTopologicalGroup α := ⟨⟩ h.tendsto_cofinite_one (discreteTopology_iff_singleton_mem_nhds.mp ‹_› 1) @[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 IsTopologicalGroup section CommGroupWithZero variable {K : Type*} [CommGroupWithZero K] [TopologicalSpace K] [ContinuousMul K] {f g : α → K} /-! ## Groups with a zero These lemmas apply to a `CommGroupWithZero`; the most familiar case is when `K` is a field. These are specific to the product setting and do not have a sensible additive analogue. -/ open Finset in lemma HasProd.congr_cofinite₀ {c : K} (hc : HasProd f c) {s : Finset α} (hs : ∀ a ∈ s, f a ≠ 0) (hs' : ∀ a ∉ s, f a = g a) : HasProd g (c * ((∏ i ∈ s, g i) / ∏ i ∈ s, f i)) := by classical refine (Tendsto.mul_const ((∏ i ∈ s, g i) / ∏ i ∈ s, f i) hc).congr' ?_ filter_upwards [eventually_ge_atTop s] with t ht calc (∏ i ∈ t, f i) * ((∏ i ∈ s, g i) / ∏ i ∈ s, f i) _ = ((∏ i ∈ s, f i) * ∏ i ∈ t \ s, g i) * _ := by conv_lhs => rw [← union_sdiff_of_subset ht, prod_union disjoint_sdiff, prod_congr rfl fun i hi ↦ hs' i (mem_sdiff.mp hi).2] _ = (∏ i ∈ s, g i) * ∏ i ∈ t \ s, g i := by rw [← mul_div_assoc, ← div_mul_eq_mul_div, ← div_mul_eq_mul_div, div_self, one_mul, mul_comm] exact prod_ne_zero_iff.mpr hs _ = ∏ i ∈ t, g i := by rw [← prod_union disjoint_sdiff, union_sdiff_of_subset ht] protected lemma Multipliable.tsum_congr_cofinite₀ [T2Space K] (hc : Multipliable f) {s : Finset α} (hs : ∀ a ∈ s, f a ≠ 0) (hs' : ∀ a ∉ s, f a = g a) : ∏' i, g i = ((∏' i, f i) * ((∏ i ∈ s, g i) / ∏ i ∈ s, f i)) := (hc.hasProd.congr_cofinite₀ hs hs').tprod_eq /-- See also `Multipliable.congr_cofinite`, which does not have a non-vanishing condition, but instead requires the target to be a group under multiplication (and hence fails for infinite products in a ring). -/ lemma Multipliable.congr_cofinite₀ (hf : Multipliable f) (hf' : ∀ a, f a ≠ 0) (hfg : ∀ᶠ a in cofinite, f a = g a) : Multipliable g := by classical obtain ⟨c, hc⟩ := hf obtain ⟨s, hs⟩ : ∃ s : Finset α, ∀ i ∉ s, f i = g i := ⟨hfg.toFinset, by simp⟩ exact (hc.congr_cofinite₀ (fun a _ ↦ hf' a) hs).multipliable end CommGroupWithZero
.lake/packages/mathlib/Mathlib/Topology/Algebra/InfiniteSum/TsumUniformlyOn.lean
import Mathlib.Analysis.Calculus.IteratedDeriv.Defs import Mathlib.Analysis.Calculus.UniformLimitsDeriv import Mathlib.Analysis.Normed.Group.FunctionSeries import Mathlib.Topology.Algebra.InfiniteSum.UniformOn /-! # Differentiability of sum of functions We prove some `HasSumUniformlyOn` versions of theorems from `Mathlib.Analysis.NormedSpace.FunctionSeries`. Alongside this we prove `derivWithin_tsum` which states that the derivative of a series of functions is the sum of the derivatives, under suitable conditions we also prove an `iteratedDerivWithin` version. -/ open Set Metric TopologicalSpace Function Filter open scoped Topology NNReal section UniformlyOn variable {α β F : Type*} [NormedAddCommGroup F] [CompleteSpace F] {u : α → ℝ} theorem HasSumUniformlyOn.of_norm_le_summable {f : α → β → F} (hu : Summable u) {s : Set β} (hfu : ∀ n x, x ∈ s → ‖f n x‖ ≤ u n) : HasSumUniformlyOn f (fun x ↦ ∑' n, f n x) {s} := by simp [hasSumUniformlyOn_iff_tendstoUniformlyOn, tendstoUniformlyOn_tsum hu hfu] theorem HasSumUniformlyOn.of_norm_le_summable_eventually {ι : Type*} {f : ι → β → F} {u : ι → ℝ} (hu : Summable u) {s : Set β} (hfu : ∀ᶠ n in cofinite, ∀ x ∈ s, ‖f n x‖ ≤ u n) : HasSumUniformlyOn f (fun x ↦ ∑' n, f n x) {s} := by simp [hasSumUniformlyOn_iff_tendstoUniformlyOn, tendstoUniformlyOn_tsum_of_cofinite_eventually hu hfu] lemma SummableLocallyUniformlyOn.of_locally_bounded_eventually [TopologicalSpace β] [LocallyCompactSpace β] {f : α → β → F} {s : Set β} (hs : IsOpen s) (hu : ∀ K ⊆ s, IsCompact K → ∃ u : α → ℝ, Summable u ∧ ∀ᶠ n in cofinite, ∀ k ∈ K, ‖f n k‖ ≤ u n) : SummableLocallyUniformlyOn f s := by apply HasSumLocallyUniformlyOn.summableLocallyUniformlyOn (g := fun x ↦ ∑' n, f n x) rw [hasSumLocallyUniformlyOn_iff_tendstoLocallyUniformlyOn, tendstoLocallyUniformlyOn_iff_forall_isCompact hs] intro K hK hKc obtain ⟨u, hu1, hu2⟩ := hu K hK hKc exact tendstoUniformlyOn_tsum_of_cofinite_eventually hu1 hu2 lemma SummableLocallyUniformlyOn_of_locally_bounded [TopologicalSpace β] [LocallyCompactSpace β] {f : α → β → F} {s : Set β} (hs : IsOpen s) (hu : ∀ K ⊆ s, IsCompact K → ∃ u : α → ℝ, Summable u ∧ ∀ n, ∀ k ∈ K, ‖f n k‖ ≤ u n) : SummableLocallyUniformlyOn f s := by apply SummableLocallyUniformlyOn.of_locally_bounded_eventually hs intro K hK hKc obtain ⟨u, hu1, hu2⟩ := hu K hK hKc exact ⟨u, hu1, by filter_upwards using hu2⟩ end UniformlyOn variable {ι F E : Type*} [NontriviallyNormedField E] [IsRCLikeNormedField E] [NormedAddCommGroup F] [NormedSpace E F] {s : Set E} /-- The `derivWithin` of a sum whose derivative is absolutely and uniformly convergent sum on an open set `s` is the sum of the derivatives of sequence of functions on the open set `s` -/ theorem derivWithin_tsum {f : ι → E → F} (hs : IsOpen s) {x : E} (hx : x ∈ s) (hf : ∀ y ∈ s, Summable fun n ↦ f n y) (h : SummableLocallyUniformlyOn (fun n ↦ (derivWithin (fun z ↦ f n z) s)) s) (hf2 : ∀ n r, r ∈ s → DifferentiableAt E (f n) r) : derivWithin (fun z ↦ ∑' n, f n z) s x = ∑' n, derivWithin (f n) s x := by apply HasDerivWithinAt.derivWithin ?_ (hs.uniqueDiffWithinAt hx) apply HasDerivAt.hasDerivWithinAt apply hasDerivAt_of_tendstoLocallyUniformlyOn hs _ _ (fun y hy ↦ (hf y hy).hasSum) hx (f' := fun n : Finset ι ↦ fun a ↦ ∑ i ∈ n, derivWithin (fun z ↦ f i z) s a) · obtain ⟨g, hg⟩ := h apply (hasSumLocallyUniformlyOn_iff_tendstoLocallyUniformlyOn.mp hg).congr_right exact fun _ hb ↦ (hg.tsum_eqOn hb).symm · filter_upwards with t r hr using HasDerivAt.fun_sum (fun q hq ↦ ((hf2 q r hr).differentiableWithinAt.hasDerivWithinAt.hasDerivAt) (hs.mem_nhds hr)) /-- If a sequence of functions `fₙ` is such that `∑ fₙ (z)` is summable for each `z` in an open set `s`, and for each `1 ≤ k ≤ m`, the series of `k`-th iterated derivatives `∑ (iteratedDerivWithin k fₙ s) (z)` is summable locally uniformly on `s`, and each `fₙ` is `m`-times differentiable, then the `m`-th iterated derivative of the sum is the sum of the `m`-th iterated derivatives. -/ theorem iteratedDerivWithin_tsum {f : ι → E → F} (m : ℕ) (hs : IsOpen s) {x : E} (hx : x ∈ s) (hsum : ∀ t ∈ s, Summable (fun n : ι ↦ f n t)) (h : ∀ k, 1 ≤ k → k ≤ m → SummableLocallyUniformlyOn (fun n ↦ (iteratedDerivWithin k (fun z ↦ f n z) s)) s) (hf2 : ∀ n k r, k ≤ m → r ∈ s → DifferentiableAt E (iteratedDerivWithin k (fun z ↦ f n z) s) r) : iteratedDerivWithin m (fun z ↦ ∑' n, f n z) s x = ∑' n, iteratedDerivWithin m (f n) s x := by induction m generalizing x with | zero => simp | succ m hm => simp_rw [iteratedDerivWithin_succ] rw [← derivWithin_tsum hs hx _ _ (fun n r hr ↦ hf2 n m r (by cutsat) hr)] · exact derivWithin_congr (fun t ht ↦ hm ht (fun k hk1 hkm ↦ h k hk1 (by cutsat)) (fun k r e hr he ↦ hf2 k r e (by cutsat) he)) (hm hx (fun k hk1 hkm ↦ h k hk1 (by cutsat)) (fun k r e hr he ↦ hf2 k r e (by cutsat) he)) · intro r hr by_cases hm2 : m = 0 · simp [hm2, hsum r hr] · exact ((h m (by cutsat) (by cutsat)).summable hr).congr (fun _ ↦ by simp) · exact SummableLocallyUniformlyOn_congr (fun _ _ ht ↦ iteratedDerivWithin_succ) (h (m + 1) (by cutsat) (by cutsat))
.lake/packages/mathlib/Mathlib/Topology/Algebra/InfiniteSum/Order.lean
import Mathlib.Algebra.Order.Archimedean.Basic import Mathlib.Algebra.Order.BigOperators.Ring.Finset 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 variable {ι κ α : Type*} {L : SummationFilter ι} section Preorder variable [Preorder α] [CommMonoid α] [TopologicalSpace α] {a c : α} {f : ι → α} @[to_additive] lemma hasProd_le_of_prod_le [ClosedIicTopology α] [L.NeBot] (hf : HasProd f a L) (h : ∀ s, ∏ i ∈ s, f i ≤ c) : a ≤ c := le_of_tendsto' hf h @[to_additive] theorem le_hasProd_of_le_prod [ClosedIciTopology α] [L.NeBot] (hf : HasProd f a L) (h : ∀ s, c ≤ ∏ i ∈ s, f i) : c ≤ a := ge_of_tendsto' hf h @[to_additive] protected theorem Multipliable.tprod_le_of_prod_range_le [ClosedIicTopology α] {f : ℕ → α} (hf : Multipliable f) (h : ∀ n, ∏ i ∈ range n, f i ≤ c) : ∏' n, f n ≤ c := le_of_tendsto' hf.hasProd.tendsto_prod_nat h end Preorder section OrderedCommMonoid variable [CommMonoid α] [PartialOrder α] [IsOrderedMonoid α] [TopologicalSpace α] [OrderClosedTopology α] {f g : ι → α} {a a₁ a₂ : α} @[to_additive] theorem hasProd_le (h : ∀ i, f i ≤ g i) (hf : HasProd f a₁ L) (hg : HasProd g a₂ L) [L.NeBot] : a₁ ≤ a₂ := le_of_tendsto_of_tendsto' hf hg fun _ ↦ prod_le_prod' fun i _ ↦ h i @[to_additive] theorem hasProd_mono (hf : HasProd f a₁ L) (hg : HasProd g a₂ L) (h : f ≤ g) [L.NeBot] : a₁ ≤ a₂ := hasProd_le h hf hg @[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] protected theorem Multipliable.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] protected lemma Multipliable.tprod_subtype_le {κ γ : Type*} [CommGroup γ] [PartialOrder γ] [IsOrderedMonoid γ] [UniformSpace γ] [IsUniformGroup γ] [OrderClosedTopology γ] [CompleteSpace γ] (f : κ → γ) (β : Set κ) (h : ∀ a : κ, 1 ≤ f a) (hf : Multipliable f) : (∏' (b : β), f b) ≤ (∏' (a : κ), f a) := by apply Multipliable.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, implies_true]) (by apply hf.subtype) apply hf @[to_additive] theorem prod_le_hasProd [L.NeBot] [L.LeAtTop] (s : Finset ι) (hs : ∀ i, i ∉ s → 1 ≤ f i) (hf : HasProd f a L) : ∏ i ∈ s, f i ≤ a := by refine ge_of_tendsto hf <| .filter_mono L.le_atTop <| eventually_atTop.2 ?_ exact ⟨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 := by classical exact isLUB_of_tendsto_atTop (Finset.prod_mono_set_of_one_le' h) hf @[to_additive] theorem le_hasProd [L.NeBot] [L.LeAtTop] (hf : HasProd f a L) (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 lt_hasProd [L.NeBot] [L.LeAtTop] [MulRightStrictMono α] (hf : HasProd f a L) (i : ι) (hi : ∀ (j : ι), j ≠ i → 1 ≤ f j) (j : ι) (hij : j ≠ i) (hj : 1 < f j) : f i < a := by classical calc f i < f j * f i := lt_mul_of_one_lt_left' (f i) hj _ = ∏ k ∈ {j, i}, f k := by rw [Finset.prod_pair hij] _ ≤ a := prod_le_hasProd _ (fun k hk ↦ hi k (hk ∘ mem_insert_of_mem ∘ mem_singleton.mpr)) hf @[to_additive] protected theorem Multipliable.prod_le_tprod [L.NeBot] [L.LeAtTop] {f : ι → α} (s : Finset ι) (hs : ∀ i, i ∉ s → 1 ≤ f i) (hf : Multipliable f L) : ∏ i ∈ s, f i ≤ ∏'[L] i, f i := prod_le_hasProd s hs hf.hasProd @[to_additive] protected theorem Multipliable.le_tprod [L.NeBot] [L.LeAtTop] (hf : Multipliable f L) (i : ι) (hb : ∀ j ≠ i, 1 ≤ f j) : f i ≤ ∏'[L] i, f i := le_hasProd hf.hasProd i hb @[to_additive (attr := gcongr)] protected theorem Multipliable.tprod_le_tprod [L.NeBot] (h : ∀ i, f i ≤ g i) (hf : Multipliable f L) (hg : Multipliable g L) : ∏'[L] i, f i ≤ ∏'[L] i, g i := hasProd_le h hf.hasProd hg.hasProd @[to_additive (attr := mono)] protected theorem Multipliable.tprod_mono [L.NeBot] (hf : Multipliable f L) (hg : Multipliable g L) (h : f ≤ g) : ∏'[L] n, f n ≤ ∏'[L] n, g n := hf.tprod_le_tprod h hg omit [IsOrderedMonoid α] in @[to_additive] protected theorem Multipliable.tprod_le_of_prod_le [L.NeBot] (hf : Multipliable f L) (h : ∀ s, ∏ i ∈ s, f i ≤ a₂) : ∏'[L] i, f i ≤ a₂ := hasProd_le_of_prod_le hf.hasProd h omit [IsOrderedMonoid α] in @[to_additive] theorem tprod_le_of_prod_le' (ha₂ : 1 ≤ a₂) (h : ∀ s, ∏ i ∈ s, f i ≤ a₂) : ∏'[L] i, f i ≤ a₂ := by by_cases hL : L.NeBot · by_cases hf : Multipliable f L · exact hf.tprod_le_of_prod_le h · rwa [tprod_eq_one_of_not_multipliable hf] · by_cases hf : f.mulSupport.Finite · simpa [tprod_bot hL, finprod_eq_prod _ hf] using h _ · rwa [tprod_bot hL, finprod_of_infinite_mulSupport hf] @[to_additive] theorem HasProd.one_le [L.NeBot] (h : ∀ i, 1 ≤ g i) (ha : HasProd g a L) : 1 ≤ a := hasProd_le h hasProd_one ha @[to_additive] theorem HasProd.le_one [L.NeBot] (h : ∀ i, g i ≤ 1) (ha : HasProd g a L) : a ≤ 1 := hasProd_le h ha hasProd_one @[to_additive tsum_nonneg] theorem one_le_tprod (h : ∀ i, 1 ≤ g i) : 1 ≤ ∏'[L] i, g i := by by_cases hg : Multipliable g L · by_cases hL : L.NeBot · exact hg.hasProd.one_le h · simpa [tprod_bot hL] using one_le_finprod' h · rw [tprod_eq_one_of_not_multipliable hg] @[to_additive] theorem tprod_le_one (h : ∀ i, f i ≤ 1) : ∏'[L] i, f i ≤ 1 := by by_cases hf : Multipliable f L · by_cases hL : L.NeBot · exact hf.hasProd.le_one h · simp only [tprod_bot hL] exact finprod_induction (· ≤ 1) le_rfl (fun _ _ ↦ mul_le_one') h · rw [tprod_eq_one_of_not_multipliable hf] @[to_additive] theorem hasProd_one_iff_of_one_le [L.LeAtTop] [L.NeBot] (hf : ∀ i, 1 ≤ f i) : HasProd f 1 L ↔ 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 [CommGroup α] [PartialOrder α] [IsOrderedMonoid α] [TopologicalSpace α] [IsTopologicalGroup α] [OrderClosedTopology α] {f g : ι → α} {a₁ a₂ : α} {i : ι} @[to_additive] theorem hasProd_lt [L.NeBot] [L.LeAtTop] (h : f ≤ g) (hi : f i < g i) (hf : HasProd f a₁ L) (hg : HasProd g a₂ L) : a₁ < a₂ := by classical 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] protected theorem Multipliable.tprod_lt_tprod [L.NeBot] [L.LeAtTop] (h : f ≤ g) (hi : f i < g i) (hf : Multipliable f L) (hg : Multipliable g L) : ∏'[L] n, f n < ∏'[L] n, g n := hasProd_lt h hi hf.hasProd hg.hasProd @[to_additive (attr := mono)] protected theorem Multipliable.tprod_strict_mono [L.NeBot] [L.LeAtTop] (hf : Multipliable f L) (hg : Multipliable g L) (h : f < g) : ∏'[L] n, f n < ∏'[L] n, g n := let ⟨hle, _i, hi⟩ := Pi.lt_def.mp h hf.tprod_lt_tprod hle hi hg @[to_additive Summable.tsum_pos] protected theorem Multipliable.one_lt_tprod [L.LeAtTop] [L.NeBot] (hsum : Multipliable g L) (hg : ∀ i, 1 ≤ g i) (i : ι) (hi : 1 < g i) : 1 < ∏'[L] i, g i := by rw [← tprod_one (L := L)] exact multipliable_one.tprod_lt_tprod hg hi hsum end OrderedCommGroup section CanonicallyOrderedMul variable [CommMonoid α] [PartialOrder α] [IsOrderedMonoid α] [CanonicallyOrderedMul α] [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] protected theorem Multipliable.le_tprod' (hf : Multipliable f) (i : ι) : f i ≤ ∏' i, f i := hf.le_tprod 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] protected theorem Multipliable.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] protected theorem Multipliable.tprod_ne_one_iff (hf : Multipliable f) : ∏' i, f i ≠ 1 ↔ ∃ x, f x ≠ 1 := by rw [Ne, hf.tprod_eq_one_iff, not_forall] omit [IsOrderedMonoid α] in @[to_additive] theorem isLUB_hasProd' (hf : HasProd f a) : IsLUB (Set.range fun s ↦ ∏ i ∈ s, f i) a := by classical exact isLUB_of_tendsto_atTop (Finset.prod_mono_set' f) hf end CanonicallyOrderedMul 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 [CommMonoid α] [LinearOrder α] [IsOrderedMonoid α] [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 [CommMonoid α] [LinearOrder α] [CanonicallyOrderedMul α] [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 [CommGroup α] [LinearOrder α] [IsOrderedMonoid α] [UniformSpace α] [IsUniformGroup α] [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 [AddCommGroup α] [LinearOrder α] [IsOrderedAddMonoid α] [TopologicalSpace α] [Archimedean α] [OrderClosedTopology α] {b : α} (hb : 0 < b) (hf : Summable fun _ : ι ↦ b) : Finite ι := by have H : ∀ s : Finset ι, #s • 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 ≤ 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 [AddCommGroup α] [LinearOrder α] [IsOrderedAddMonoid α] [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 section LinearOrderedCommRing variable [CommRing α] [LinearOrder α] [IsStrictOrderedRing α] [TopologicalSpace α] [OrderTopology α] {f : ι → α} {x : α} nonrec theorem HasProd.abs (hfx : HasProd f x) : HasProd (|f ·|) |x| := by simpa only [HasProd, ← abs_prod] using hfx.abs theorem Multipliable.abs (hf : Multipliable f) : Multipliable (|f ·|) := let ⟨x, hx⟩ := hf; ⟨|x|, hx.abs⟩ protected theorem Multipliable.abs_tprod (hf : Multipliable f) : |∏' i, f i| = ∏' i, |f i| := hf.hasProd.abs.tprod_eq.symm end LinearOrderedCommRing theorem Summable.tendsto_atTop_of_pos [Field α] [LinearOrder α] [IsStrictOrderedRing α] [TopologicalSpace α] [OrderTopology α] {f : ℕ → α} (hf : Summable f⁻¹) (hf' : ∀ n, 0 < f n) : Tendsto f atTop atTop := inv_inv f ▸ Filter.Tendsto.inv_tendsto_nhdsGT_zero <| tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within _ hf.tendsto_atTop_zero <| Eventually.of_forall fun _ ↦ inv_pos.2 (hf' _) namespace Mathlib.Meta.Positivity open Qq Lean Meta Finset attribute [local instance] monadLiftOptionMetaM in /-- Positivity extension for infinite sums. This extension only proves non-negativity, strict positivity is more delicate for infinite sums and requires more assumptions. -/ @[positivity tsum _] def evalTsum : PositivityExt where eval {u α} zα pα e := do match e with | ~q(@tsum _ $ι $instCommMonoid $instTopSpace $f $L) => lambdaBoundedTelescope f 1 fun args (body : Q($α)) => do let #[(i : Q($ι))] := args | failure let rbody ← core zα pα body let pbody ← rbody.toNonneg let pr : Q(∀ i, 0 ≤ $f i) ← mkLambdaFVars #[i] pbody let mα' ← synthInstanceQ q(AddCommMonoid $α) let oα' ← synthInstanceQ q(PartialOrder $α) let pα' ← synthInstanceQ q(IsOrderedAddMonoid $α) let instOrderClosed ← synthInstanceQ q(OrderClosedTopology $α) assertInstancesCommute return .nonnegative q(@tsum_nonneg $ι $α $L $mα' $oα' $pα' $instTopSpace $instOrderClosed $f $pr) | _ => throwError "not tsum" end Mathlib.Meta.Positivity
.lake/packages/mathlib/Mathlib/Topology/Algebra/InfiniteSum/Basic.lean
import Mathlib.Algebra.BigOperators.Group.Finset.Indicator import Mathlib.Data.Fintype.BigOperators import Mathlib.Topology.Algebra.InfiniteSum.Defs import Mathlib.Topology.Algebra.Monoid.Defs import Mathlib.Order.Filter.AtTopBot.BigOperators /-! # 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 Topology SummationFilter variable {α β γ : Type*} section HasProd variable [CommMonoid α] [TopologicalSpace α] variable {f g : β → α} {a b : α} {L : SummationFilter β} /-- Constant one function has product `1` -/ @[to_additive /-- Constant zero function has sum `0` -/] theorem hasProd_one : HasProd (fun _ ↦ 1 : β → α) 1 L := by simp [HasProd, tendsto_const_nhds] @[to_additive] theorem hasProd_empty [IsEmpty β] : HasProd f 1 L := by convert hasProd_one @[to_additive (attr := nontriviality)] theorem HasProd.of_subsingleton_cod [Subsingleton α] : HasProd f 1 L := by convert hasProd_one @[to_additive] theorem multipliable_one : Multipliable (fun _ ↦ 1 : β → α) L := hasProd_one.multipliable @[to_additive] theorem multipliable_empty [IsEmpty β] : Multipliable f L := hasProd_empty.multipliable @[to_additive (attr := nontriviality)] theorem Multipliable.of_subsingleton_cod [Subsingleton α] : Multipliable f L := HasProd.of_subsingleton_cod.multipliable /-- See `multipliable_congr_cofinite` for a version allowing the functions to disagree on a finite set. -/ @[to_additive /-- See `summable_congr_cofinite` for a version allowing the functions to disagree on a finite set. -/] theorem multipliable_congr (hfg : ∀ b, f b = g b) : Multipliable f L ↔ Multipliable g L := iff_of_eq (congr_arg (Multipliable · L) <| funext hfg) /-- See `Multipliable.congr_cofinite` for a version allowing the functions to disagree on a finite set. -/ @[to_additive /-- See `Summable.congr_cofinite` for a version allowing the functions to disagree on a finite set. -/] theorem Multipliable.congr (hf : Multipliable f L) (hfg : ∀ b, f b = g b) : Multipliable g L := (multipliable_congr hfg).mp hf @[to_additive] lemma HasProd.congr_fun (hf : HasProd f a L) (h : ∀ x : β, g x = f x) : HasProd g a L := (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 [L.HasSupport] (h : (mulSupport f).Finite) : Multipliable f L := by apply multipliable_of_ne_finset_one (s := h.toFinset); simp @[to_additive] lemma Multipliable.of_finite [Finite β] [L.HasSupport] {f : β → α} : Multipliable f L := 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) (L := unconditional β) [L.LeAtTop] : HasProd f (f b) L := suffices HasProd f (∏ b' ∈ {b}, f b') L by simpa using this hasProd_prod_of_ne_finset_one <| by simpa [hf] @[to_additive (attr := simp)] lemma hasProd_unique [Unique β] (f : β → α) (L := unconditional β) [L.LeAtTop] : HasProd f (f default) L := hasProd_single default (fun _ hb ↦ False.elim <| hb <| Unique.uniq ..) L @[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 : α) (L := unconditional β) [L.LeAtTop] : HasProd (fun b' ↦ if b' = b then a else 1) a L := by convert hasProd_single b (hf := fun b' hb' ↦ if_neg hb') (L := L) 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 L) {G} [FunLike G α γ] [MonoidHomClass G α γ] (g : G) (hg : Continuous g) : HasProd (g ∘ f) (g a) L := 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 Topology.IsInducing.hasProd_iff [CommMonoid γ] [TopologicalSpace γ] {G} [FunLike G α γ] [MonoidHomClass G α γ] {g : G} (hg : IsInducing g) (f : β → α) (a : α) : HasProd (g ∘ f) (g a) L ↔ HasProd f a L := 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 L) {G} [FunLike G α γ] [MonoidHomClass G α γ] (g : G) (hg : Continuous g) : Multipliable (g ∘ f) L := (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) L ↔ Multipliable f L := ⟨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 [L.NeBot] [CommMonoid γ] [TopologicalSpace γ] [T2Space γ] (hf : Multipliable f L) {G} [FunLike G α γ] [MonoidHomClass G α γ] (g : G) (hg : Continuous g) : g (∏'[L] i, f i) = ∏'[L] i, g (f i) := (HasProd.tprod_eq (HasProd.map hf.hasProd g hg)).symm @[to_additive] lemma Topology.IsClosedEmbedding.map_tprod {ι α α' G : Type*} [CommMonoid α] [CommMonoid α'] [TopologicalSpace α] [TopologicalSpace α'] [T2Space α'] (f : ι → α) {L : SummationFilter ι} {g : G} [FunLike G α α'] [MonoidHomClass G α α'] (hge : Topology.IsClosedEmbedding g) : g (∏'[L] i, f i) = ∏'[L] i, g (f i) := by by_cases hL : L.NeBot · by_cases h : Multipliable f L · exact h.map_tprod g hge.continuous · rw [tprod_eq_one_of_not_multipliable h, tprod_eq_one_of_not_multipliable, map_one] contrapose! h -- need to show `g ∘ f` multipliable implies `g` multipliable simp only [Multipliable, HasProd] at h ⊢ obtain ⟨b, hb⟩ := h obtain ⟨a, ha⟩ : b ∈ Set.range g := hge.isClosed_range.mem_of_tendsto hb (.of_forall <| by simp [← map_prod]) use a simp [hge.tendsto_nhds_iff, Function.comp_def, ha, hb] · simpa [tprod_bot hL] using (MonoidHomClass.toMonoidHom g).map_finprod_of_injective hge.injective _ /-- Special case of `Topology.IsClosedEmbedding.map_tprod`, logically weaker but possibly easier to apply in practice. -/ @[to_additive /-- Special case of `Topology.IsClosedEmbedding.map_tsum`, logically weaker but possibly easier to apply in practice. -/] lemma Function.LeftInverse.map_tprod {G : Type*} (f : β → α) [CommMonoid γ] [TopologicalSpace γ] [T2Space γ] {g : G} [FunLike G α γ] [MonoidHomClass G α γ] (hg : Continuous g) {g' : γ → α} (hg' : Continuous g') (hgg' : LeftInverse g' g) : g (∏'[L] b, f b) = ∏'[L] b, g (f b) := (hgg'.isClosedEmbedding hg' hg).map_tprod _ @[to_additive] lemma Topology.IsInducing.multipliable_iff_tprod_comp_mem_range [CommMonoid γ] [TopologicalSpace γ] [T2Space γ] {G} [FunLike G α γ] [MonoidHomClass G α γ] {g : G} (hg : IsInducing g) (f : β → α) : Multipliable f L ↔ Multipliable (g ∘ f) L ∧ ∏'[L] i, g (f i) ∈ Set.range g := by constructor · intro hf constructor · exact hf.map g hg.continuous · by_cases hL : L.NeBot · exact ⟨_, hf.map_tprod g hg.continuous⟩ · by_cases hfs : (mulSupport fun x ↦ g (f x)).Finite · simp [tprod_bot hL, finprod_eq_prod, hfs, ← map_prod] · exact ⟨1, by simp [tprod_bot hL, finprod_of_infinite_mulSupport hfs]⟩ · 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) L ↔ Multipliable f L := 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 L) (hg : HasProd g b L) : HasProd (fun b ↦ f b * g b) (a * b) L := by dsimp only [HasProd] at hf hg ⊢ simp_rw [prod_mul_distrib] exact hf.mul hg @[to_additive] theorem Multipliable.mul (hf : Multipliable f L) (hg : Multipliable g L) : Multipliable (fun b ↦ f b * g b) L := (hf.hasProd.mul hg.hasProd).multipliable @[to_additive] theorem hasProd_prod {f : γ → β → α} {a : γ → α} {s : Finset γ} : (∀ i ∈ s, HasProd (f i) (a i) L) → HasProd (fun b ↦ ∏ i ∈ s, f i b) (∏ i ∈ s, a i) L := by classical exact Finset.induction_on s (by simp only [hasProd_one, prod_empty, forall_true_iff]) <| by simp +contextual 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) L) : Multipliable (fun b ↦ ∏ i ∈ s, f i b) L := (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' [L.LeAtTop] [L.NeBot] {α : Type*} [TopologicalSpace α] [CommMonoid α] [T2Space α] [ContinuousMul α] [DecidableEq β] {f : β → α} {a a' : α} (hf : HasProd f a L) (b : β) (x : α) (hf' : HasProd (update f b x) a' L) : 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 L) simp_rw [this] at h exact HasProd.unique h (hf'.mul (hasProd_ite_eq b (f b) L)) /-- 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 [L.LeAtTop] [L.NeBot] {α : Type*} [TopologicalSpace α] [CommMonoid α] [T2Space α] [ContinuousMul α] [DecidableEq β] {f : β → α} {a : α} (hf : HasProd f a L) (b : β) (a' : α) (hf' : HasProd (fun n ↦ ite (n = b) 1 (f n)) a' L) : 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 : β → α} {L : SummationFilter β} @[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 [L.LeAtTop] (hf : (mulSupport f).Finite) : ∏'[L] b, f b = ∏ᶠ b, f b := by simp [tprod_def, multipliable_of_finite_mulSupport hf, hf, show L.HasSupport by infer_instance] @[to_additive] theorem tprod_eq_prod' [L.LeAtTop] {s : Finset β} (hf : mulSupport f ⊆ s) : ∏'[L] 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 [L.LeAtTop] {s : Finset β} (hf : ∀ b ∉ s, f b = 1) : ∏'[L] b, f b = ∏ b ∈ s, f b := tprod_eq_prod' <| mulSupport_subset_iff'.2 hf @[to_additive (attr := simp)] theorem tprod_one : ∏'[L] _, (1 : α) = 1 := by rw [tprod_def, dif_pos multipliable_one, mulSupport_fun_one, Set.empty_inter, Set.mulIndicator_one, finprod_one, eq_true_intro hasProd_one, if_true, ite_self] @[to_additive (attr := simp)] theorem tprod_empty [IsEmpty β] : ∏'[L] b, f b = 1 := by convert tprod_one (L := L) @[to_additive] theorem tprod_congr {f g : β → α} (hfg : ∀ b, f b = g b) : ∏'[L] b, f b = ∏'[L] b, g b := congr_arg (tprod · L) (funext hfg) @[to_additive] theorem tprod_congr₂ {f g : β → γ → α} {M : SummationFilter γ} (hfg : ∀ b c, f b c = g b c) : ∏'[L] b, ∏'[M] c, f b c = ∏'[L] b, ∏'[M] c, g b c := tprod_congr fun b ↦ tprod_congr fun c ↦ hfg b c @[to_additive] theorem tprod_fintype [L.LeAtTop] [Fintype β] (f : β → α) : ∏'[L] b, f b = ∏ b, f b := by apply tprod_eq_prod; simp @[to_additive] theorem prod_eq_tprod_mulIndicator (f : β → α) (s : Finset β) (L := unconditional β) [L.LeAtTop] : ∏ x ∈ s, f x = ∏'[L] 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 [L.LeAtTop] {f : β → α} (b : β) (hf : ∀ b' ≠ b, f b' = 1) : ∏'[L] 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 : β → α) (L := unconditional β) [L.LeAtTop] : ∏'[L] b', (if b' = b then a b' else 1) = a b := by rw [tprod_eq_mulSingle b] · simp · intro b' hb'; simp [hb'] @[to_additive (attr := simp)] 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 @[to_additive (attr := simp)] theorem tprod_singleton (b : β) (f : β → α) : ∏' x : ({b} : Set β), f x = f b := by rw [← coe_singleton, Finset.tprod_subtype', prod_singleton] @[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 classical 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, SummationFilter.support_eq_univ, Set.inter_univ, show (unconditional β).HasSupport by infer_instance, show (unconditional γ).HasSupport by infer_instance, true_and, if_neg hf_fin, if_neg hf_fin', Multipliable] simp [hg.hasProd_iff (mulSupport_subset_iff'.1 hf)] @[to_additive] theorem Equiv.tprod_eq (e : γ ≃ β) (f : β → α) : ∏' c, f (e c) = ∏' b, f b := e.injective.tprod_eq <| by simp @[to_additive (attr := simp)] theorem tprod_comp_neg {β : Type*} [InvolutiveNeg β] (f : β → α) : ∏' d, f (-d) = ∏' d, f d := (Equiv.neg β).tprod_eq f /-! ### `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 @[to_additive (attr := simp)] 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 → α) : ∏'[L] b, (if h : P then 1 else x b h) = if h : P then 1 else ∏'[L] b, x b h := by by_cases hP : P <;> simp [hP] @[to_additive] theorem tprod_dite_left (P : Prop) [Decidable P] (x : β → P → α) : ∏'[L] b, (if h : P then x b h else 1) = if h : P then ∏'[L] 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] protected theorem Multipliable.tprod_mul [L.NeBot] (hf : Multipliable f L) (hg : Multipliable g L) : ∏'[L] b, (f b * g b) = (∏'[L] b, f b) * ∏'[L] b, g b := (hf.hasProd.mul hg.hasProd).tprod_eq @[to_additive] protected theorem Multipliable.tprod_finsetProd [L.NeBot] {f : γ → β → α} {s : Finset γ} (hf : ∀ i ∈ s, Multipliable (f i) L) : ∏'[L] b, ∏ i ∈ s, f i b = ∏ i ∈ s, ∏'[L] 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`. -/] protected theorem Multipliable.tprod_eq_mul_tprod_ite' [DecidableEq β] [L.LeAtTop] [L.NeBot] {f : β → α} (b : β) (hf : Multipliable (update f b 1) L) : ∏'[L] x, f x = f b * ∏'[L] x, ite (x = b) 1 (f x) := calc ∏'[L] x, f x = ∏'[L] 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] _ = (∏'[L] x, ite (x = b) (f x) 1) * ∏'[L] x, update f b 1 x := Multipliable.tprod_mul ⟨ite (b = b) (f b) 1, hasProd_single b (fun _ hb ↦ if_neg hb) L⟩ hf _ = ite (b = b) (f b) 1 * ∏'[L] x, update f b 1 x := by congr exact tprod_eq_mulSingle b fun b' hb' ↦ if_neg hb' _ = f b * ∏'[L] x, ite (x = b) 1 (f x) := by simp only [update, if_true, eq_rec_constant, dite_eq_ite] @[to_additive] protected theorem Multipliable.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] protected theorem Multipliable.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] protected theorem Multipliable.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 section CommMonoidWithZero variable [CommMonoidWithZero α] [TopologicalSpace α] {f : β → α} {L : SummationFilter β} lemma hasProd_zero_of_exists_eq_zero (hf : ∃ b, f b = 0) [L.LeAtTop] : HasProd f 0 L := by obtain ⟨b, hb⟩ := hf apply tendsto_const_nhds.congr' filter_upwards [(eventually_ge_atTop {b}).filter_mono L.le_atTop] with s hs exact (Finset.prod_eq_zero (Finset.singleton_subset_iff.mp hs) hb).symm lemma multipliable_of_exists_eq_zero (hf : ∃ b, f b = 0) [L.LeAtTop] : Multipliable f L := ⟨0, hasProd_zero_of_exists_eq_zero hf⟩ lemma tprod_of_exists_eq_zero [T2Space α] [L.NeBot] [L.LeAtTop] (hf : ∃ b, f b = 0) : ∏'[L] b, f b = 0 := (hasProd_zero_of_exists_eq_zero hf).tprod_eq end CommMonoidWithZero
.lake/packages/mathlib/Mathlib/Topology/Algebra/InfiniteSum/Constructions.lean
import Mathlib.Order.Filter.AtTopBot.Finset 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*} {L : SummationFilter β} /-! ## 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 (L := .unconditional β) 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_right_injective 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_left_injective 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.prodMk] theorem HasProd.prodMk {f : β → α} {g : β → γ} {a : α} {b : γ} (hf : HasProd f a L) (hg : HasProd g b L) : HasProd (fun x ↦ (⟨f x, g x⟩ : α × γ)) ⟨a, b⟩ L := by simp [HasProd, ← prod_mk_prod, Filter.Tendsto.prodMk_nhds hf hg] end ProdCodomain section ContinuousMul variable [CommMonoid α] [TopologicalSpace α] [ContinuousMul α] section Sum @[to_additive] lemma HasProd.sum {α β M : Type*} [CommMonoid M] [TopologicalSpace M] [ContinuousMul M] {f : α ⊕ β → M} {a b : M} (h₁ : HasProd (f ∘ Sum.inl) a) (h₂ : HasProd (f ∘ Sum.inr) b) : HasProd f (a * b) := by have : Tendsto ((∏ b ∈ ·, f b) ∘ sumEquiv.symm) (atTop.map sumEquiv) (nhds (a * b)) := by rw [Finset.sumEquiv.map_atTop, ← prod_atTop_atTop_eq] convert (tendsto_mul.comp (nhds_prod_eq (x := a) (y := b) ▸ Tendsto.prodMap h₁ h₂)) ext s simp simpa [Tendsto, ← Filter.map_map] using this @[to_additive /-- For the statement that `tsum` commutes with `Finset.sum`, see `Summable.tsum_finsetSum`. -/] protected lemma Multipliable.tprod_sum {α β M : Type*} [CommMonoid M] [TopologicalSpace M] [ContinuousMul M] [T2Space M] {f : α ⊕ β → M} (h₁ : Multipliable (f ∘ .inl)) (h₂ : Multipliable (f ∘ .inr)) : ∏' i, f i = (∏' i, f (.inl i)) * (∏' i, f (.inr i)) := (h₁.hasProd.sum h₂.hasProd).tprod_eq @[to_additive] lemma Multipliable.sum {α β M : Type*} [CommMonoid M] [TopologicalSpace M] [ContinuousMul M] (f : α ⊕ β → M) (h₁ : Multipliable (f ∘ Sum.inl)) (h₂ : Multipliable (f ∘ Sum.inr)) : Multipliable f := ⟨_, .sum h₁.hasProd h₂.hasProd⟩ end Sum 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 with 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] protected theorem Multipliable.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 Summable.tsum_prod'] protected theorem Multipliable.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 Summable.tsum_prod_uncurry] protected theorem Multipliable.tprod_prod_uncurry {f : β → γ → α} (h : Multipliable (Function.uncurry f)) (h₁ : ∀ b, Multipliable fun c ↦ f b c) : ∏' p : β × γ, uncurry f p = ∏' (b) (c), f b c := (h.hasProd.prod_fiberwise fun b ↦ (h₁ b).hasProd).tprod_eq.symm @[to_additive] protected theorem Multipliable.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 rw [← h.tprod_prod_uncurry h₁, ← h.prod_symm.tprod_prod_uncurry h₂, ← (Equiv.prodComm γ β).tprod_eq (uncurry f)] rfl end T3Space end ContinuousMul section CompleteSpace variable [CommGroup α] [UniformSpace α] [IsUniformGroup α] @[to_additive] theorem HasProd.of_sigma {γ : β → Type*} {f : (Σ b : β, γ b) → α} {g : β → α} {a : α} (hf : ∀ b, HasProd (fun c ↦ f ⟨b, c⟩) (g b)) (hg : HasProd g a) (h : CauchySeq (fun (s : Finset (Σ b : β, γ b)) ↦ ∏ i ∈ s, f i)) : HasProd f a := by classical apply le_nhds_of_cauchy_adhp h simp only [← mapClusterPt_def, mapClusterPt_iff_frequently, frequently_atTop, ge_iff_le, le_eq_subset] intro u hu s rcases mem_nhds_iff.1 hu with ⟨v, vu, v_open, hv⟩ obtain ⟨t0, st0, ht0⟩ : ∃ t0, ∏ i ∈ t0, g i ∈ v ∧ s.image Sigma.fst ⊆ t0 := by have A : ∀ᶠ t0 in (atTop : Filter (Finset β)), ∏ i ∈ t0, g i ∈ v := hg (v_open.mem_nhds hv) exact (A.and (Ici_mem_atTop _)).exists have L : Tendsto (fun t : Finset (Σ b, γ b) ↦ ∏ p ∈ t with p.1 ∈ t0, f p) atTop (𝓝 <| ∏ b ∈ t0, 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)) have : ∃ t, ∏ p ∈ t with p.1 ∈ t0, f p ∈ v ∧ s ⊆ t := ((Tendsto.eventually_mem L (v_open.mem_nhds st0)).and (Ici_mem_atTop _)).exists obtain ⟨t, tv, st⟩ := this refine ⟨{p ∈ t | p.1 ∈ t0}, fun x hx ↦ ?_, vu tv⟩ simpa only [mem_filter, st hx, true_and] using ht0 (mem_image_of_mem Sigma.fst hx) variable [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 Summable.prod] lemma Multipliable.prod {f : β × γ → α} (h : Multipliable f) : Multipliable fun b ↦ ∏' c, f (b, c) := ((Equiv.sigmaEquivProd β γ).multipliable_iff.mpr h).sigma @[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] protected theorem Multipliable.tprod_sigma {γ : β → Type*} {f : (Σ b : β, γ b) → α} (ha : Multipliable f) : ∏' p, f p = ∏' (b) (c), f ⟨b, c⟩ := Multipliable.tprod_sigma' (fun b ↦ ha.sigma_factor b) ha @[to_additive Summable.tsum_prod] protected theorem Multipliable.tprod_prod {f : β × γ → α} (h : Multipliable f) : ∏' p, f p = ∏' (b) (c), f ⟨b, c⟩ := h.tprod_prod' h.prod_factor @[to_additive] protected theorem Multipliable.tprod_comm {f : β → γ → α} (h : Multipliable (Function.uncurry f)) : ∏' (c) (b), f b c = ∏' (b) (c), f b c := h.tprod_comm' h.prod_factor h.prod_symm.prod_factor end CompleteT0Space end CompleteSpace section Pi variable {ι : Type*} {X : α → Type*} [∀ x, CommMonoid (X x)] [∀ x, TopologicalSpace (X x)] {L : SummationFilter ι} @[to_additive] theorem Pi.hasProd {f : ι → ∀ x, X x} {g : ∀ x, X x} : HasProd f g L ↔ ∀ x, HasProd (fun i ↦ f i x) (g x) L := by simp only [HasProd, tendsto_pi_nhds, prod_apply] @[to_additive] theorem Pi.multipliable {f : ι → ∀ x, X x} : Multipliable f L ↔ ∀ x, Multipliable (fun i ↦ f i x) L := by simp only [Multipliable, Pi.hasProd, Classical.skolem] @[to_additive] theorem tprod_apply [L.NeBot] [∀ x, T2Space (X x)] {f : ι → ∀ x, X x} {x : α} (hf : Multipliable f L) : (∏'[L] i, f i) x = ∏'[L] 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 L) : HasSum (fun a ↦ op (f a)) (op a) L := (hf.map (@opAddEquiv α _) continuous_op :) theorem Summable.op (hf : Summable f L) : Summable (op ∘ f) L := hf.hasSum.op.summable theorem HasSum.unop {f : β → αᵐᵒᵖ} {a : αᵐᵒᵖ} (hf : HasSum f a L) : HasSum (fun a ↦ unop (f a)) (unop a) L := (hf.map (@opAddEquiv α _).symm continuous_unop :) theorem Summable.unop {f : β → αᵐᵒᵖ} (hf : Summable f L) : Summable (unop ∘ f) L := hf.hasSum.unop.summable @[simp] theorem hasSum_op : HasSum (fun a ↦ op (f a)) (op a) L ↔ HasSum f a L := ⟨HasSum.unop, HasSum.op⟩ @[simp] theorem hasSum_unop {f : β → αᵐᵒᵖ} {a : αᵐᵒᵖ} : HasSum (fun a ↦ unop (f a)) (unop a) L ↔ HasSum f a L := ⟨HasSum.op, HasSum.unop⟩ @[simp] theorem summable_op : (Summable (fun a ↦ op (f a)) L) ↔ Summable f L:= ⟨Summable.unop, Summable.op⟩ theorem summable_unop {f : β → αᵐᵒᵖ} : (Summable (fun a ↦ unop (f a)) L) ↔ Summable f L := ⟨Summable.op, Summable.unop⟩ theorem tsum_op [T2Space α] : ∑'[L] x, op (f x) = op (∑'[L] x, f x) := (opHomeomorph.isClosedEmbedding.map_tsum f (g := opAddEquiv)).symm theorem tsum_unop [T2Space α] {f : β → αᵐᵒᵖ} : ∑'[L] x, unop (f x) = unop (∑'[L] 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 L) : HasSum (fun b ↦ star (f b)) (star a) L := by simpa only using h.map (starAddEquiv : α ≃+ α) continuous_star theorem Summable.star (hf : Summable f L) : Summable (fun b ↦ star (f b)) L := hf.hasSum.star.summable theorem Summable.ofStar (hf : Summable (fun b ↦ Star.star (f b)) L) : Summable f L := by simpa only [star_star] using hf.star @[simp] theorem summable_star_iff : Summable (fun b ↦ star (f b)) L ↔ Summable f L := ⟨Summable.ofStar, Summable.star⟩ @[simp] theorem summable_star_iff' : Summable (star f) L ↔ Summable f L := summable_star_iff theorem tsum_star [T2Space α] : star (∑'[L] b, f b) = ∑'[L] b, star (f b) := Function.LeftInverse.map_tsum (g := starAddEquiv) f continuous_star continuous_star star_star end ContinuousStar
.lake/packages/mathlib/Mathlib/Topology/Algebra/InfiniteSum/UniformOn.lean
import Mathlib.Topology.Algebra.InfiniteSum.Defs import Mathlib.Topology.Algebra.UniformConvergence import Mathlib.Order.Filter.AtTopBot.Finset /-! # Infinite sum and products that converge uniformly on a set This file defines the notion of uniform convergence of infinite sums and products of functions, on a given family of subsets of their domain. It also defines the notion of local uniform convergence of infinite sums and products of functions on a set. -/ noncomputable section open Filter Function open scoped Topology variable {α β ι : Type*} [CommMonoid α] {f : ι → β → α} {g : β → α} {𝔖 : Set (Set β)} {x : β} {s : Set β} {I : Finset ι} [UniformSpace α] /-! ## Uniform convergence of sums and products -/ section UniformlyOn variable (f g 𝔖) in /-- `HasProdUniformlyOn f g 𝔖` means that the (potentially infinite) product `∏' i, f i b` for `b : β` converges uniformly on each `s ∈ 𝔖` to `g`. -/ @[to_additive /-- `HasSumUniformlyOn f g 𝔖` means that the (potentially infinite) sum `∑' i, f i b` for `b : β` converges uniformly on each `s ∈ 𝔖` to `g`. -/] def HasProdUniformlyOn : Prop := HasProd (fun i ↦ UniformOnFun.ofFun 𝔖 (f i)) (UniformOnFun.ofFun 𝔖 g) variable (f g 𝔖) in /-- `MultipliableUniformlyOn f 𝔖` means that there is some infinite product to which `f` converges uniformly on every `s ∈ 𝔖`. Use `fun x ↦ ∏' i, f i x` to get the product function. -/ @[to_additive /-- `SummableUniformlyOn f s` means that there is some infinite sum to which `f` converges uniformly on every `s ∈ 𝔖`. Use fun x ↦ ∑' i, f i x to get the sum function. -/] def MultipliableUniformlyOn : Prop := Multipliable (fun i ↦ UniformOnFun.ofFun 𝔖 (f i)) @[to_additive] lemma MultipliableUniformlyOn.exists (h : MultipliableUniformlyOn f 𝔖) : ∃ g, HasProdUniformlyOn f g 𝔖 := h @[to_additive] theorem HasProdUniformlyOn.multipliableUniformlyOn (h : HasProdUniformlyOn f g 𝔖) : MultipliableUniformlyOn f 𝔖 := ⟨g, h⟩ @[to_additive] lemma hasProdUniformlyOn_iff_tendstoUniformlyOn : HasProdUniformlyOn f g 𝔖 ↔ ∀ s ∈ 𝔖, TendstoUniformlyOn (fun I b ↦ ∏ i ∈ I, f i b) g atTop s := by simpa [HasProdUniformlyOn, HasProd, ← UniformOnFun.ofFun_prod, Finset.prod_fn] using UniformOnFun.tendsto_iff_tendstoUniformlyOn @[to_additive] lemma HasProdUniformlyOn.congr {f' : ι → β → α} (h : HasProdUniformlyOn f g 𝔖) (hff' : ∀ s ∈ 𝔖, ∀ᶠ (n : Finset ι) in atTop, Set.EqOn (fun b ↦ ∏ i ∈ n, f i b) (fun b ↦ ∏ i ∈ n, f' i b) s) : HasProdUniformlyOn f' g 𝔖 := by rw [hasProdUniformlyOn_iff_tendstoUniformlyOn] at * exact fun s hs ↦ TendstoUniformlyOn.congr (h s hs) (hff' s hs) @[to_additive] lemma HasProdUniformlyOn.congr_right {g' : β → α} (h : HasProdUniformlyOn f g 𝔖) (hgg' : ∀ s ∈ 𝔖, Set.EqOn g g' s) : HasProdUniformlyOn f g' 𝔖 := by rw [hasProdUniformlyOn_iff_tendstoUniformlyOn] at * exact fun s hs ↦ TendstoUniformlyOn.congr_right (h s hs) (hgg' s hs) @[to_additive] lemma HasProdUniformlyOn.tendstoUniformlyOn_finsetRange {f : ℕ → β → α} (h : HasProdUniformlyOn f g 𝔖) (hs : s ∈ 𝔖) : TendstoUniformlyOn (fun N b ↦ ∏ i ∈ Finset.range N, f i b) g atTop s := by rw [hasProdUniformlyOn_iff_tendstoUniformlyOn] at h exact fun v hv => Filter.tendsto_finset_range.eventually (h s hs v hv) @[to_additive] theorem HasProdUniformlyOn.hasProd (h : HasProdUniformlyOn f g 𝔖) (hs : s ∈ 𝔖) (hx : x ∈ s) : HasProd (f · x) (g x) := (hasProdUniformlyOn_iff_tendstoUniformlyOn.mp h s hs).tendsto_at hx @[to_additive] theorem HasProdUniformlyOn.tprod_eqOn [T2Space α] (h : HasProdUniformlyOn f g 𝔖) (hs : s ∈ 𝔖) : s.EqOn (∏' b, f b ·) g := fun _ hx ↦ (h.hasProd hs hx).tprod_eq @[to_additive] theorem HasProdUniformlyOn.tprod_eq [T2Space α] (h : HasProdUniformlyOn f g 𝔖) (hs : ⋃₀ 𝔖 = Set.univ) : (∏' b, f b ·) = g := by ext x obtain ⟨s, hs, hx⟩ := by simpa [← hs] using Set.mem_univ x exact h.tprod_eqOn hs hx @[to_additive] theorem MultipliableUniformlyOn.multipliable (h : MultipliableUniformlyOn f 𝔖) (hs : s ∈ 𝔖) (hx : x ∈ s) : Multipliable (f · x) := match h.exists with | ⟨_, hg⟩ => (hg.hasProd hs hx).multipliable @[to_additive] theorem MultipliableUniformlyOn.hasProdUniformlyOn [T2Space α] (h : MultipliableUniformlyOn f 𝔖) : HasProdUniformlyOn f (∏' i, f i ·) 𝔖 := by obtain ⟨g, hg⟩ := h.exists simp only [hasProdUniformlyOn_iff_tendstoUniformlyOn] intro s hs exact (hasProdUniformlyOn_iff_tendstoUniformlyOn.mp hg s hs).congr_right (hg.tprod_eqOn hs).symm end UniformlyOn section LocallyUniformlyOn /-! ## Locally uniform convergence of sums and products -/ variable [TopologicalSpace β] variable (f g s) in /-- `HasProdLocallyUniformlyOn f g s` means that the (potentially infinite) product `∏' i, f i b` for `b : β` converges locally uniformly on `s` to `g b` (in the sense of `TendstoLocallyUniformlyOn`). -/ @[to_additive /-- `HasSumLocallyUniformlyOn f g s` means that the (potentially infinite) sum `∑' i, f i b` for `b : β` converges locally uniformly on `s` to `g b` (in the sense of `TendstoLocallyUniformlyOn`). -/] def HasProdLocallyUniformlyOn : Prop := TendstoLocallyUniformlyOn (fun I b ↦ ∏ i ∈ I, f i b) g atTop s variable (f g s) in /-- `MultipliableLocallyUniformlyOn f s` means that the product `∏' i, f i b` converges locally uniformly on `s` to something. -/ @[to_additive /-- `SummableLocallyUniformlyOn f s` means that `∑' i, f i b` converges locally uniformly on `s` to something. -/] def MultipliableLocallyUniformlyOn : Prop := ∃ g, HasProdLocallyUniformlyOn f g s @[to_additive] lemma hasProdLocallyUniformlyOn_iff_tendstoLocallyUniformlyOn : HasProdLocallyUniformlyOn f g s ↔ TendstoLocallyUniformlyOn (fun I b ↦ ∏ i ∈ I, f i b) g atTop s := Iff.rfl /-- If every `x ∈ s` has a neighbourhood within `s` on which `b ↦ ∏' i, f i b` converges uniformly to `g`, then the product converges locally uniformly on `s` to `g`. Note that this is not a tautology, and the converse is only true if the domain is locally compact. -/ @[to_additive /-- If every `x ∈ s` has a neighbourhood within `s` on which `b ↦ ∑' i, f i b` converges uniformly to `g`, then the sum converges locally uniformly. Note that this is not a tautology, and the converse is only true if the domain is locally compact. -/] lemma hasProdLocallyUniformlyOn_of_of_forall_exists_nhds (h : ∀ x ∈ s, ∃ t ∈ 𝓝[s] x, HasProdUniformlyOn f g {t}) : HasProdLocallyUniformlyOn f g s := tendstoLocallyUniformlyOn_of_forall_exists_nhds <| by simpa [hasProdUniformlyOn_iff_tendstoUniformlyOn] using h @[deprecated (since := "2025-05-22")] alias hasProdLocallyUniformlyOn_of_of_forall_exists_nhd := hasProdLocallyUniformlyOn_of_of_forall_exists_nhds @[deprecated (since := "2025-05-22")] alias hasSumLocallyUniformlyOn_of_of_forall_exists_nhd := hasSumLocallyUniformlyOn_of_of_forall_exists_nhds @[to_additive] lemma HasProdUniformlyOn.hasProdLocallyUniformlyOn (h : HasProdUniformlyOn f g {s}) : HasProdLocallyUniformlyOn f g s := by simp [HasProdLocallyUniformlyOn, hasProdUniformlyOn_iff_tendstoUniformlyOn] at * exact TendstoUniformlyOn.tendstoLocallyUniformlyOn h @[to_additive] lemma hasProdLocallyUniformlyOn_of_forall_compact (hs : IsOpen s) [LocallyCompactSpace β] (h : ∀ K ⊆ s, IsCompact K → HasProdUniformlyOn f g {K}) : HasProdLocallyUniformlyOn f g s := by rw [HasProdLocallyUniformlyOn, tendstoLocallyUniformlyOn_iff_forall_isCompact hs] simpa [hasProdUniformlyOn_iff_tendstoUniformlyOn] using h @[to_additive] theorem HasProdLocallyUniformlyOn.multipliableLocallyUniformlyOn (h : HasProdLocallyUniformlyOn f g s) : MultipliableLocallyUniformlyOn f s := ⟨g, h⟩ /-- If every `x ∈ s` has a neighbourhood within `s` on which `b ↦ ∏' i, f i b` converges uniformly, then the product converges locally uniformly on `s`. Note that this is not a tautology, and the converse is only true if the domain is locally compact. -/ @[to_additive /-- If every `x ∈ s` has a neighbourhood within `s` on which `b ↦ ∑' i, f i b` converges uniformly, then the sum converges locally uniformly. Note that this is not a tautology, and the converse is only true if the domain is locally compact. -/] lemma multipliableLocallyUniformlyOn_of_of_forall_exists_nhds [T2Space α] (h : ∀ x ∈ s, ∃ t ∈ 𝓝[s] x, MultipliableUniformlyOn f {t}) : MultipliableLocallyUniformlyOn f s := (hasProdLocallyUniformlyOn_of_of_forall_exists_nhds <| fun x hx ↦ match h x hx with | ⟨t, ht, htr⟩ => ⟨t, ht, htr.hasProdUniformlyOn⟩).multipliableLocallyUniformlyOn @[deprecated (since := "2025-05-22")] alias multipliableLocallyUniformlyOn_of_of_forall_exists_nhd := multipliableLocallyUniformlyOn_of_of_forall_exists_nhds @[deprecated (since := "2025-05-22")] alias summableLocallyUniformlyOn_of_of_forall_exists_nhd := summableLocallyUniformlyOn_of_of_forall_exists_nhds @[to_additive] theorem HasProdLocallyUniformlyOn.hasProd (h : HasProdLocallyUniformlyOn f g s) (hx : x ∈ s) : HasProd (f · x) (g x) := h.tendsto_at hx @[to_additive] theorem MultipliableLocallyUniformlyOn.multipliable (h : MultipliableLocallyUniformlyOn f s) (hx : x ∈ s) : Multipliable (f · x) := match h with | ⟨_, hg⟩ => (hg.hasProd hx).multipliable @[to_additive] theorem MultipliableLocallyUniformlyOn.hasProdLocallyUniformlyOn [T2Space α] (h : MultipliableLocallyUniformlyOn f s) : HasProdLocallyUniformlyOn f (∏' i, f i ·) s := match h with | ⟨_, hg⟩ => hg.congr_right fun _ hb ↦ (hg.hasProd hb).tprod_eq.symm @[to_additive] theorem HasProdLocallyUniformlyOn.tprod_eqOn [T2Space α] (h : HasProdLocallyUniformlyOn f g s) : Set.EqOn (∏' i, f i ·) g s := fun _ hx ↦ (h.hasProd hx).tprod_eq @[to_additive] lemma MultipliableLocallyUniformlyOn_congr [T2Space α] {f f' : ι → β → α} (h : ∀ i, s.EqOn (f i) (f' i)) (h2 : MultipliableLocallyUniformlyOn f s) : MultipliableLocallyUniformlyOn f' s := by apply HasProdLocallyUniformlyOn.multipliableLocallyUniformlyOn exact (h2.hasProdLocallyUniformlyOn).congr fun v ↦ eqOn_fun_finsetProd h v @[to_additive] lemma HasProdLocallyUniformlyOn.tendstoLocallyUniformlyOn_finsetRange {f : ℕ → β → α} (h : HasProdLocallyUniformlyOn f g s) : TendstoLocallyUniformlyOn (fun N b ↦ ∏ i ∈ Finset.range N, f i b) g atTop s := by rw [hasProdLocallyUniformlyOn_iff_tendstoLocallyUniformlyOn] at h intro v hv r hr obtain ⟨t, ht, htr⟩ := h v hv r hr exact ⟨t, ht, Filter.tendsto_finset_range.eventually htr⟩ end LocallyUniformlyOn
.lake/packages/mathlib/Mathlib/Topology/Algebra/InfiniteSum/Defs.lean
import Mathlib.Algebra.BigOperators.Finprod import Mathlib.Topology.Algebra.InfiniteSum.SummationFilter import Mathlib.Topology.Separation.Hausdorff import Mathlib.Algebra.BigOperators.Group.Finset.Preimage /-! # Infinite sum and product in a topological monoid This file defines infinite products and sums for (possibly infinite) indexed families of elements in a commutative topological monoid (resp. add monoid). To handle convergence questions we use the formalism of *summation filters* (defined in the file `Mathlib.Topology.Algebra.InfiniteSum.SummationFilter`). These are filters on the finite subsets of a given type, and we define a function to be *summable* for a summation filter `L` if its partial sums over finite subsets tend to a limit along `L` (and similarly for products). This simultaneously generalizes several different kinds of summation: for instance, *unconditional summation* (which makes sense for any index type) where we take the limit with respect to the `atTop` filter; but also *conditional summation* for functions on `ℕ`, where the limit is over the partial sums `∑ i ∈ range n, f i` as `n → ∞` (so there exist conditionally-summable sequences which are not unconditionally summable). ## Implementation notes We say that a function `f : β → α` has a product of `a` w.r.t. the summation filter `L` if the function `fun s : Finset β ↦ ∏ b ∈ s, f b` converges to `a` w.r.t. the filter `L.filter` on `Finset β`. In the most important case of unconditional summation, this translates to the following condition: 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 SummationFilter open scoped Topology variable {α β γ : Type*} section HasProd variable [CommMonoid α] [TopologicalSpace α] /-- `HasProd f a L` means that the (potentially infinite) product of the `f b` for `b : β` converges to `a` along the SummationFilter `L`. By default `L` is the `unconditional` one, corresponding to the limit of all finite sets towards the entire type. So we take the product over bigger and bigger finite sets. This product operation is invariant under permuting the terms (while products for more general summation filters usually are not). For the definition and many statements, `α` does not need to be a topological monoid, only a monoid with a topology (i.e. the multiplication is not assumed to be continuous). 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 /-- `HasSum f a L` means that the (potentially infinite) sum of the `f b` for `b : β` converges to `a` along the SummationFilter `L``. By default `L` is the `unconditional` one, corresponding to the limit of all finite sets towards the entire type. So we take the sum over bigger and bigger finite sets. This sum operation is invariant under permuting the terms (while sums for more general summation filters usually are not). This is based on Mario Carneiro's [infinite sum `df-tsms` in Metamath](http://us.metamath.org/mpeuni/df-tsms.html). In particular, the function `ℕ → ℝ` sending `n` to `(-1) ^ n / (n + 1)` does not have a sum for this definition, although it is summable for the `conditional` summation filter that takes limits of sums over `n ∈ {0, ..., X}` as `X → ∞`. However, a series which is *absolutely* convergent with respect to the conditional summation filter is in fact unconditionally summable. For the definition and many statements, `α` does not need to be a topological additive monoid, only an additive monoid with a topology (i.e. the addition is not assumed to be continuous). We only add this assumption later, for the lemmas where it is relevant. -/] def HasProd (f : β → α) (a : α) (L := unconditional β) : Prop := Tendsto (fun s : Finset β ↦ ∏ b ∈ s, f b) L.filter (𝓝 a) /-- `Multipliable f` means that `f` has some (infinite) product with respect to `L`. Use `tprod` to get the value. -/ @[to_additive /-- `Summable f` means that `f` has some (infinite) sum with respect to `L`. Use `tsum` to get the value. -/] def Multipliable (f : β → α) (L := unconditional β) : Prop := ∃ a, HasProd f a L @[to_additive] lemma Multipliable.mono_filter {f : β → α} {L₁ L₂ : SummationFilter β} (hf : Multipliable f L₂) (h : L₁.filter ≤ L₂.filter) : Multipliable f L₁ := match hf with | ⟨a, ha⟩ => ⟨a, ha.mono_left h⟩ open scoped Classical in /-- `∏' i, f i` is the unconditional product of `f`, if it exists, or 1 otherwise. ] More generally, if `L` is a `SummationFilter`, `∏'[L] i, f i` is the product of `f` with respect to `L` if it exists, and `1` otherwise. (Note that even if the unconditional product exists, it might not be unique 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`. Similar remarks apply to more general summation filters.) -/ @[to_additive /-- `∑' i, f i` is the unconditional sum of `f` if it exists, or 0 otherwise. More generally, if `L` is a `SummationFilter`, `∑'[L] i, f i` is the sum of `f` with respect to `L` if it exists, and `0` otherwise. (Note that even if the unconditional sum exists, it might not be unique if the topology is not separated. When the support of `f` is finite, we make the most reasonable choice, to use the sum over the support. Otherwise, we choose arbitrarily an `a` satisfying `HasSum f a`. Similar remarks apply to more general summation filters.) -/] noncomputable irreducible_def tprod (f : β → α) (L := unconditional β) := if h : Multipliable f L then if L.HasSupport ∧ (mulSupport f ∩ L.support).Finite then finprod (L.support.mulIndicator f) else if HasProd f 1 L then 1 else h.choose else 1 variable {L : SummationFilter β} @[inherit_doc tprod] notation3 "∏'[" L "]" (...)", "r:67:(scoped f => tprod f L) => r @[inherit_doc tsum] notation3 "∑'[" L "]" (...)", "r:67:(scoped f => tsum f L) => r -- see note [operator precedence of big operators] @[inherit_doc tprod] notation3 "∏' "(...)", "r:67:(scoped f => tprod f (unconditional _)) => r @[inherit_doc tsum] notation3 "∑' "(...)", "r:67:(scoped f => tsum f (unconditional _)) => r @[to_additive] lemma hasProd_bot (hL : ¬L.NeBot) (f : β → α) (a : α) : HasProd f a L := by have : L.filter = ⊥ := by contrapose! hL; exact ⟨⟨hL⟩⟩ rw [HasProd, this] exact tendsto_bot @[to_additive] lemma multipliable_bot (hL : ¬L.NeBot) (f : β → α) : Multipliable f L := ⟨1, hasProd_bot hL ..⟩ /-- If the summation filter is the trivial filter `⊥`, then the topological product is equal to the finite product (which is taken to be 1 if the multiplicative support of `f` is infinite). Note that in this case `HasProd f a` is satisfied for *every* element `a` of the target, so the value assigned to the `tprod` is a question of conventions. -/ @[to_additive /-- If the summation filter is the trivial filter `⊥`, then the topological sum is equal to the finite sum (which is taken to be 1 if the support of `f` is infinite). Note that in this case `HasSum f a` is satisfied for *every* element `a` of the target, so the value assigned to the `tsum` is a question of conventions. -/] lemma tprod_bot (hL : ¬L.NeBot) (f : β → α) : ∏'[L] b, f b = ∏ᶠ b, f b := by simp only [tprod_def, dif_pos (multipliable_bot hL f)] haveI : L.LeAtTop := L.leAtTop_of_not_NeBot hL rw [L.support_eq_univ, Set.inter_univ, Set.mulIndicator_univ] by_cases hf : (mulSupport f).Finite · rw [eq_true_intro hf, if_pos] simp only [and_true] infer_instance · rwa [if_neg (by tauto), if_pos (hasProd_bot hL _ _), finprod_of_infinite_mulSupport] variable {f : β → α} {a : α} {s : Finset β} @[to_additive] theorem HasProd.multipliable (h : HasProd f a L) : Multipliable f L := ⟨a, h⟩ @[to_additive] theorem tprod_eq_one_of_not_multipliable (h : ¬Multipliable f L) : ∏'[L] b, f b = 1 := by simp [tprod_def, h] @[to_additive] theorem Function.Injective.hasProd_map_iff {L : SummationFilter γ} {g : γ → β} (hg : Injective g) : HasProd f a (L.map ⟨g, hg⟩) ↔ HasProd (f ∘ g) a L := by simp [HasProd, Function.comp_def] @[to_additive] theorem Function.Injective.hasProd_comap_iff_of_hasSupport [L.HasSupport] {g : γ → β} (hg : Injective g) (hf : ∀ x ∈ L.support, x ∉ Set.range g → f x = 1) : HasProd (f ∘ g) a (L.comap ⟨g, hg⟩) ↔ HasProd f a L := by simp only [HasProd, SummationFilter.comap_filter, tendsto_map'_iff, comp_apply, Embedding.coeFn_mk, Function.comp_def] refine tendsto_congr' ?_ filter_upwards [L.eventually_le_support] with s hs rw [s.prod_preimage] exact fun x h h' ↦ hf x (hs h) h' @[to_additive] theorem Function.Injective.hasProd_comap_iff {g : γ → β} (hg : Injective g) (hf : ∀ x, x ∉ Set.range g → f x = 1) : HasProd (f ∘ g) a (L.comap ⟨g, hg⟩) ↔ HasProd f a L := by simp only [HasProd, SummationFilter.comap_filter, tendsto_map'_iff, comp_apply, Embedding.coeFn_mk, Function.comp_def] refine tendsto_congr fun s ↦ ?_ rw [s.prod_preimage] exact fun x _ h ↦ hf x 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 rw [← hg.hasProd_comap_iff hf, SummationFilter.comap_unconditional] @[to_additive] theorem hasProd_subtype_comap_iff_of_mulSupport_subset {s : Set β} (hf : mulSupport f ⊆ s) : HasProd (f ∘ (↑) : s → α) a (L.comap <| Embedding.subtype _) ↔ HasProd f a L := Subtype.coe_injective.hasProd_comap_iff <| by simpa using mulSupport_subset_iff'.1 hf @[to_additive] theorem hasProd_subtype_iff_of_mulSupport_subset {s : Set β} (hf : mulSupport f ⊆ s) : HasProd (f ∘ (↑) : s → α) a ↔ HasProd f a := by simpa using hasProd_subtype_comap_iff_of_mulSupport_subset hf (L := unconditional _) @[to_additive] theorem hasProd_fintype_support [Fintype β] (f : β → α) (L : SummationFilter β) [L.HasSupport] [DecidablePred (· ∈ L.support)] : HasProd f (∏ b ∈ L.support, f b) L := by apply tendsto_nhds_of_eventually_eq have h1 : ⋂ b ∈ L.support, {s | b ∈ s} ∈ L.filter := (L.filter.biInter_mem L.support.toFinite).mpr (by tauto) have h2 : ⋂ b ∈ L.supportᶜ, {s | b ∉ s} ∈ L.filter := (L.filter.biInter_mem L.supportᶜ.toFinite).mpr (fun b hb ↦ (L.eventually_mem_or_not_mem b).resolve_left hb) filter_upwards [h1, h2] with s hs hs' congr 1 simp only [Set.mem_iInter, Set.mem_setOf_eq, Set.mem_compl_iff] at hs hs' grind [Set.mem_toFinset] @[to_additive] theorem hasProd_fintype [Fintype β] (f : β → α) (L := unconditional β) [L.LeAtTop] : HasProd f (∏ b, f b) L := by simpa using hasProd_fintype_support f L @[to_additive] theorem Finset.hasProd_support (s : Finset β) (f : β → α) (L := unconditional (s : Set β)) [L.HasSupport] [DecidablePred (· ∈ L.support)] : HasProd (f ∘ (↑) : (↑s : Set β) → α) (∏ b ∈ (L.support.toFinset.map <| Embedding.subtype _), f b) L := by simpa [prod_attach] using hasProd_fintype_support (f ∘ Subtype.val) L -- note this is not deduced from `Finset.hasProd_support` to avoid needing `[DecidableEq β]` @[to_additive] protected theorem Finset.hasProd (s : Finset β) (f : β → α) (L := unconditional (s : Set β)) [L.LeAtTop] : HasProd (f ∘ (↑) : (↑s : Set β) → α) (∏ b ∈ s, f b) L := by simpa [prod_attach, Embedding.subtype] using Finset.hasProd_support s f L /-- 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_support_of_ne_finset_one (hf : ∀ b ∈ L.support, b ∉ s → f b = 1) [L.HasSupport] [DecidablePred (· ∈ L.support)] : HasProd f (∏ b ∈ (↑s ∩ L.support).toFinset, f b) L := by apply tendsto_nhds_of_eventually_eq have h1 : ⋂ b ∈ (↑s ∩ L.support), {s | b ∈ s} ∈ L.filter := (L.filter.biInter_mem (Set.toFinite _)).mpr (fun b hb ↦ hb.2) filter_upwards [h1, L.eventually_le_support] with t ht ht' simp only [Set.mem_iInter] at ht apply Finset.prod_congr_of_eq_on_inter <;> · simp only [Set.mem_toFinset] grind /-- 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) [L.LeAtTop] : HasProd f (∏ b ∈ s, f b) L := ((hasProd_subtype_iff_of_mulSupport_subset <| mulSupport_subset_iff'.2 hf).1 <| s.hasProd f) |>.mono_left L.le_atTop @[to_additive] theorem multipliable_of_ne_finset_one (hf : ∀ b ∉ s, f b = 1) [L.HasSupport] : Multipliable f L := by classical exact (hasProd_prod_support_of_ne_finset_one (fun b _ hb ↦ hf b hb)).multipliable @[to_additive] theorem Multipliable.hasProd (ha : Multipliable f L) : HasProd f (∏'[L] b, f b) L := by -- This is quite delicate because of the fiddly special-casing for finite products. classical rw [tprod_def, dif_pos ha] split_ifs with h h' · convert hasProd_prod_support_of_ne_finset_one (s := h.2.toFinset) (L := L) _ using 2 · simp only [Set.inter_eq_left.mpr (show ↑h.2.toFinset ⊆ L.support by simp)] simp only [Set.Finite.coe_toFinset, Finset.toFinset_coe] rw [finprod_eq_prod_of_mulSupport_subset (s := h.2.toFinset)] · exact Finset.prod_congr rfl (by aesop) · simp · grind [Set.Finite.mem_toFinset, mem_mulSupport] · exact h.1 · exact h' · exact ha.choose_spec variable [T2Space α] [L.NeBot] @[to_additive] theorem HasProd.unique {a₁ a₂ : α} : HasProd f a₁ L → HasProd f a₂ L → a₁ = a₂ := by classical exact tendsto_nhds_unique @[to_additive] theorem HasProd.tprod_eq (ha : HasProd f a L) : ∏'[L] b, f b = a := (Multipliable.hasProd ⟨a, ha⟩).unique ha @[to_additive] theorem Multipliable.hasProd_iff (h : Multipliable f L) : HasProd f a L ↔ ∏'[L] b, f b = a := Iff.intro HasProd.tprod_eq fun eq ↦ eq ▸ h.hasProd @[to_additive] theorem tprod_eq_of_filter_le {L₁ L₂ : SummationFilter β} [L₁.NeBot] (h : L₁.filter ≤ L₂.filter) (hf : Multipliable f L₂) : ∏'[L₁] b, f b = ∏'[L₂] b, f b := (hf.mono_filter h).hasProd_iff.mp (hf.hasProd.mono_left h) @[to_additive] theorem tprod_eq_of_multipliable_unconditional [L.LeAtTop] (hf : Multipliable f) : ∏'[L] b, f b = ∏' b, f b := tprod_eq_of_filter_le L.le_atTop hf end HasProd
.lake/packages/mathlib/Mathlib/Topology/Algebra/InfiniteSum/ConditionalInt.lean
import Mathlib.Algebra.BigOperators.Group.Finset.Interval import Mathlib.Algebra.Order.Ring.Star import Mathlib.Order.Filter.AtTopBot.Interval import Mathlib.Topology.Algebra.InfiniteSum.Defs import Mathlib.Topology.Algebra.Monoid.Defs import Mathlib.Tactic.FinCases /-! # Sums over symmetric integer intervals This file contains some lemmas about sums over symmetric integer intervals `Ixx -N N` used, for example in the definition of the Eisenstein series `E2`. In particular we define `symmetricIcc`, `symmetricIco`, `symmetricIoc` and `symmetricIoo` as `SummationFilter`s corresponding to the intervals `Icc -N N`, `Ico -N N`, `Ioc -N N` respectively. We also prove that these filters are all `NeBot` and `LeAtTop`. -/ open Finset Topology Function Filter SummationFilter namespace SummationFilter section IntervalFilters variable (G : Type*) [Neg G] [Preorder G] [LocallyFiniteOrder G] /-- The SummationFilter on a locally finite order `G` corresponding to the symmetric intervals `Icc (-N) N`· -/ @[simps] def symmetricIcc : SummationFilter G where filter := atTop.map (fun g ↦ Icc (-g) g) /-- The SummationFilter on a locally finite order `G` corresponding to the symmetric intervals `Ioo (-N) N`· Note that for `G = ℤ` this coincides with `symmetricIcc` so one should use that. See `symmetricIcc_eq_symmetricIoo_int`. -/ @[simps] def symmetricIoo : SummationFilter G where filter := atTop.map (fun g ↦ Ioo (-g) g) /-- The SummationFilter on a locally finite order `G` corresponding to the symmetric intervals `Ico (-N) N`· -/ @[simps] def symmetricIco : SummationFilter G where filter := atTop.map (fun N ↦ Ico (-N) N) /-- The SummationFilter on a locally finite order `G` corresponding to the symmetric intervals `Ioc (-N) N`· -/ @[simps] def symmetricIoc : SummationFilter G where filter := atTop.map (fun N ↦ Ioc (-N) N) variable [(atTop : Filter G).NeBot] instance : (symmetricIcc G).NeBot where ne_bot := by simp [symmetricIcc, Filter.NeBot.map] instance : (symmetricIco G).NeBot where ne_bot := by simp [symmetricIco, Filter.NeBot.map] instance : (symmetricIoc G).NeBot where ne_bot := by simp [symmetricIoc, Filter.NeBot.map] instance : (symmetricIoo G).NeBot where ne_bot := by simp [symmetricIoo, Filter.NeBot.map] section LeAtTop variable {G : Type*} [AddCommGroup G] [PartialOrder G] [IsOrderedAddMonoid G] [LocallyFiniteOrder G] lemma symmetricIcc_le_Conditional : (symmetricIcc G).filter ≤ (conditional G).filter := Filter.map_mono (tendsto_neg_atTop_atBot.prodMk tendsto_id) instance : (symmetricIcc G).LeAtTop where le_atTop := le_trans symmetricIcc_le_Conditional (conditional G).le_atTop variable [NoTopOrder G] [NoBotOrder G] instance : (symmetricIco G).LeAtTop where le_atTop := by rw [symmetricIco, map_le_iff_le_comap, ← @tendsto_iff_comap] exact tendsto_Ico_neg_atTop_atTop instance : (symmetricIoc G).LeAtTop where le_atTop := by rw [symmetricIoc, map_le_iff_le_comap, ← @tendsto_iff_comap] exact tendsto_Ioc_neg_atTop_atTop instance : (symmetricIoo G).LeAtTop where le_atTop := by rw [symmetricIoo, map_le_iff_le_comap, ← @tendsto_iff_comap] exact tendsto_Ioo_neg_atTop_atTop end LeAtTop end IntervalFilters section Int variable {α : Type*} {f : ℤ → α} [CommGroup α] [TopologicalSpace α] [ContinuousMul α] lemma symmetricIcc_eq_map_Icc_nat : (symmetricIcc ℤ).filter = atTop.map (fun N : ℕ ↦ Icc (-(N : ℤ)) N) := by simp [← Nat.map_cast_int_atTop, Function.comp_def] lemma symmetricIcc_eq_symmetricIoo_int : symmetricIcc ℤ = symmetricIoo ℤ := by simp only [symmetricIcc, symmetricIoo, mk.injEq] ext s simp only [← Nat.map_cast_int_atTop, Filter.map_map, Filter.mem_map, mem_atTop_sets, ge_iff_le, Set.mem_preimage, comp_apply] refine ⟨fun ⟨a, ha⟩ ↦ ⟨a + 1, fun b hb ↦ ?_⟩, fun ⟨a, ha⟩ ↦ ⟨a - 1, fun b hb ↦ ?_⟩⟩ <;> [ convert ha (b - 1) (by grind) using 1; convert ha (b + 1) (by grind) using 1 ] <;> simpa [Finset.ext_iff] using by grind @[to_additive] lemma HasProd.hasProd_symmetricIco_of_hasProd_symmetricIcc {a : α} (hf : HasProd f a (symmetricIcc ℤ)) (hf2 : Tendsto (fun N : ℕ ↦ (f N)⁻¹) atTop (𝓝 1)) : HasProd f a (symmetricIco ℤ) := by simp only [HasProd, tendsto_map'_iff, symmetricIcc_eq_map_Icc_nat, ← Nat.map_cast_int_atTop, symmetricIco] at * apply tendsto_of_div_tendsto_one _ hf simpa [Pi.div_def, fun N : ℕ ↦ prod_Icc_eq_prod_Ico_mul f (show (-N : ℤ) ≤ N by omega)] using hf2 @[to_additive] lemma multipliable_symmetricIco_of_multiplible_symmetricIcc (hf : Multipliable f (symmetricIcc ℤ)) (hf2 : Tendsto (fun N : ℕ ↦ (f N)⁻¹) atTop (𝓝 1)) : Multipliable f (symmetricIco ℤ) := (hf.hasProd.hasProd_symmetricIco_of_hasProd_symmetricIcc hf2).multipliable @[to_additive] lemma tprod_symmetricIcc_eq_tprod_symmetricIco [T2Space α] (hf : Multipliable f (symmetricIcc ℤ)) (hf2 : Tendsto (fun N : ℕ ↦ (f N)⁻¹) atTop (𝓝 1)) : ∏'[symmetricIco ℤ] b, f b = ∏'[symmetricIcc ℤ] b, f b := (hf.hasProd.hasProd_symmetricIco_of_hasProd_symmetricIcc hf2).tprod_eq @[to_additive] lemma hasProd_symmetricIcc_iff {α : Type*} [CommMonoid α] [TopologicalSpace α] {f : ℤ → α} {a : α} : HasProd f a (symmetricIcc ℤ) ↔ Tendsto (fun N : ℕ ↦ ∏ n ∈ Icc (-(N : ℤ)) N, f n) atTop (𝓝 a) := by simp [HasProd, symmetricIcc, ← Nat.map_cast_int_atTop, comp_def] @[to_additive] lemma hasProd_symmetricIco_int_iff {α : Type*} [CommMonoid α] [TopologicalSpace α] {f : ℤ → α} {a : α} : HasProd f a (symmetricIco ℤ) ↔ Tendsto (fun N : ℕ ↦ ∏ n ∈ Ico (-(N : ℤ)) (N : ℤ), f n) atTop (𝓝 a) := by simp [HasProd, symmetricIco, ← Nat.map_cast_int_atTop, comp_def] @[to_additive] lemma hasProd_symmetricIoc_int_iff {α : Type*} [CommMonoid α] [TopologicalSpace α] {f : ℤ → α} {a : α} : HasProd f a (symmetricIoc ℤ) ↔ Tendsto (fun N : ℕ ↦ ∏ n ∈ Ioc (-(N : ℤ)) (N : ℤ), f n) atTop (𝓝 a) := by simp [HasProd, symmetricIoc, ← Nat.map_cast_int_atTop, comp_def] end Int end SummationFilter
.lake/packages/mathlib/Mathlib/Topology/Algebra/InfiniteSum/Field.lean
import Mathlib.Analysis.Normed.Group.Continuity import Mathlib.Analysis.Normed.Ring.Basic import Mathlib.Topology.Algebra.InfiniteSum.Defs /-! # Infinite sums and products in topological fields Lemmas on topological sums in rings with a strictly multiplicative norm, of which normed fields are the most familiar examples. -/ section NormMulClass variable {α E : Type*} [SeminormedCommRing E] [NormMulClass E] [NormOneClass E] {f : α → E} {x : E} nonrec theorem HasProd.norm (hfx : HasProd f x) : HasProd (‖f ·‖) ‖x‖ := by simp only [HasProd, ← norm_prod] exact hfx.norm theorem Multipliable.norm (hf : Multipliable f) : Multipliable (‖f ·‖) := let ⟨x, hx⟩ := hf; ⟨‖x‖, hx.norm⟩ protected theorem Multipliable.norm_tprod (hf : Multipliable f) : ‖∏' i, f i‖ = ∏' i, ‖f i‖ := hf.hasProd.norm.tprod_eq.symm end NormMulClass
.lake/packages/mathlib/Mathlib/Topology/Algebra/InfiniteSum/SummationFilter.lean
import Mathlib.Data.Finset.Preimage import Mathlib.Order.Filter.AtTopBot.CountablyGenerated import Mathlib.Order.Interval.Finset.Nat import Mathlib.Order.LiminfLimsup /-! # Summation filters We define a `SummationFilter` on `β` to be a filter on the finite subsets of `β`. These are used in defining summability: if `L` is a summation filter, we define the `L`-sum of `f` to be the limit along `L` of the sums over finsets (if this limit exists). This file only develops the basic machinery of summation filters - the key definitions `HasSum`, `tsum` and `summable` (and their product variants) are in the file `Mathlib.Topology.Algebra.InfiniteSum.Defs`. -/ open Set Filter Function variable {α β γ : Type*} /-- A filter on the set of finite subsets of a type `β`. (Used for defining infinite topological sums and products, as limits along the given filter of partial sums / products over finsets.) -/ structure SummationFilter (β) where /-- The filter -/ filter : Filter (Finset β) namespace SummationFilter /-- Typeclass asserting that a summation filter `L` is consistent with unconditional summation, so that any unconditionally-summable function is `L`-summable with the same sum. -/ class LeAtTop (L : SummationFilter β) : Prop where le_atTop : L.filter ≤ atTop export LeAtTop (le_atTop) /-- Typeclass asserting that a summation filter is non-vacuous (if this is not satisfied, then every function is summable with every possible sum simultaneously). -/ class NeBot (L : SummationFilter β) : Prop where ne_bot : L.filter.NeBot /-- Makes the `NeBot` instance visible to the typeclass machinery. -/ instance (L : SummationFilter β) [L.NeBot] : L.filter.NeBot := NeBot.ne_bot lemma neBot_or_eq_bot (L : SummationFilter β) : L.NeBot ∨ L.filter = ⊥ := by by_cases h : L.filter = ⊥ · exact .inr h · exact .inl ⟨⟨h⟩⟩ section support /-- The support of a summation filter (its `lim inf`, considered as a filter of sets). -/ def support (L : SummationFilter β) : Set β := {b | ∀ᶠ s in L.filter, b ∈ s} lemma support_eq_limsInf (L : SummationFilter β) : support L = limsInf (L.filter.map (↑)) := by refine eq_of_forall_ge_iff fun c ↦ ?_ simpa [support, limsInf, setOf_subset] using ⟨fun hL b hb x hx ↦ hL x <| hb.mp <| .of_forall fun c hc ↦ hc hx, fun hL x hx ↦ singleton_subset_iff.mp <| hL _ <| by simpa using hx⟩ lemma support_eq_univ_iff {L : SummationFilter β} : L.support = univ ↔ L.filter ≤ atTop := by simp only [support, Set.eq_univ_iff_forall, Set.mem_setOf] refine ⟨fun h s hs ↦ ?_, fun h b ↦ .filter_mono h ?_⟩ · obtain ⟨t, ht⟩ := mem_atTop_sets.mp hs have := (Filter.biInter_finset_mem t).mpr fun b hb ↦ h b exact Filter.mem_of_superset this fun r hr ↦ ht r (by simpa using hr) · filter_upwards [eventually_ge_atTop {b}] using by simp @[simp] lemma support_eq_univ (L : SummationFilter β) [L.LeAtTop] : L.support = univ := support_eq_univ_iff.mpr L.le_atTop instance [IsEmpty β] (L : SummationFilter β) : L.LeAtTop := ⟨support_eq_univ_iff.mp <| Subsingleton.elim ..⟩ lemma leAtTop_of_not_NeBot (L : SummationFilter β) (hL : ¬L.NeBot) : L.LeAtTop := by have hLs : L.support = Set.univ := by simp [SummationFilter.support, L.neBot_or_eq_bot.resolve_left hL] exact ⟨L.support_eq_univ_iff.mp hLs⟩ /-- Decidability instance: useful when working with `Finset` sums / products. -/ instance (L : SummationFilter β) [L.LeAtTop] : DecidablePred (· ∈ L.support) := fun b ↦ isTrue (by simp) end support section has_support /-- Typeclass asserting that the sets in `L.filter` are eventually contained in `L.support`. This is a sufficient condition for `L`-summation to behave well on finitely-supported functions: every finitely-supported `f` is `L`-summable with the sum `∑ᶠ x ∈ L.support, f x` (and similarly for products). -/ class HasSupport (L : SummationFilter β) : Prop where eventually_le_support : ∀ᶠ s in L.filter, ↑s ⊆ L.support export HasSupport (eventually_le_support) instance (L : SummationFilter β) [L.LeAtTop] : HasSupport L := ⟨by simp⟩ lemma eventually_mem_or_not_mem (L : SummationFilter β) [HasSupport L] (b : β) : (∀ᶠ s in L.filter, b ∈ s) ∨ (∀ᶠ s in L.filter, b ∉ s) := by rw [or_iff_not_imp_left] intro hb filter_upwards [L.eventually_le_support] with a ha using notMem_subset ha hb end has_support section map_comap /-- Pushforward of a summation filter along an embedding. (We define this only for embeddings, rather than arbitrary maps, since this is the only case needed for the intended applications, and this avoids requiring a `DecidableEq` instance on `γ`.) -/ @[simps] def map (L : SummationFilter β) (f : β ↪ γ) : SummationFilter γ where filter := L.filter.map (Finset.map f) @[simp] lemma support_map (L : SummationFilter β) [L.NeBot] (f : β ↪ γ) : (L.map f).support = f '' L.support := by ext c rcases em (c ∈ range f) with ⟨b, rfl⟩ | hc · simp [support] · exact ⟨fun hc' ↦ have := hc'.exists; by grind, by grind⟩ /-- If `L` has well-defined support, then so does its map along an embedding. -/ instance (L : SummationFilter β) [HasSupport L] (f : β ↪ γ) : HasSupport (L.map f) := by constructor by_cases h : L.NeBot · simp only [map_filter, eventually_map, Finset.coe_map, image_subset_iff, support_map] filter_upwards [L.eventually_le_support] with a using by grind · have : L.filter = ⊥ := by contrapose! h; exact ⟨⟨h⟩⟩ simp [this] /-- Pullback of a summation filter along an embedding. -/ @[simps] def comap (L : SummationFilter β) (f : γ ↪ β) : SummationFilter γ where filter := L.filter.map (fun s ↦ s.preimage f f.injective.injOn) @[simp] lemma support_comap (L : SummationFilter β) (f : γ ↪ β) : (L.comap f).support = f ⁻¹' L.support := by simp [support] /-- If `L` has well-defined support, then so does its comap along an embedding. -/ instance (L : SummationFilter β) [HasSupport L] (f : γ ↪ β) : HasSupport (L.comap f) := by constructor simp only [support_comap, comap_filter, eventually_map, Finset.coe_preimage] filter_upwards [L.eventually_le_support] with a using Set.preimage_mono instance (L : SummationFilter β) [LeAtTop L] (f : γ ↪ β) : LeAtTop (L.comap f) := ⟨by rw [← support_eq_univ_iff]; simp⟩ end map_comap section examples /-! ## Examples of summation filters -/ variable (β) /-- **Unconditional summation**: a function on `β` is said to be *unconditionally summable* if its partial sums over finite subsets converge with respect to the `atTop` filter. -/ @[simps] def unconditional : SummationFilter β where filter := atTop instance : (unconditional β).LeAtTop := ⟨le_rfl⟩ instance : (unconditional β).NeBot := ⟨atTop_neBot⟩ /-- This instance is useful for some measure-theoretic statements. -/ instance [Countable β] : IsCountablyGenerated (unconditional β).filter := atTop.isCountablyGenerated /-- The unconditional filter is preserved by comaps. -/ @[simp] lemma comap_unconditional {β} (f : γ ↪ β) : (unconditional β).comap f = unconditional γ := by classical simp only [unconditional, comap] congr 1 with s simp only [mem_map, mem_atTop_sets, ge_iff_le, Finset.le_eq_subset, mem_preimage] constructor <;> rintro ⟨t, ht⟩ · refine ⟨t.preimage f (by simp), fun x hx ↦ ?_⟩ simpa [Finset.union_eq_right.mpr hx] using ht (t ∪ x.map f) t.subset_union_left · exact ⟨_, fun b hb ↦ ht _ (Finset.map_subset_iff_subset_preimage.mp hb)⟩ /-- If `β` is finite, then `unconditional β` is the only summation filter `L` on `β` satisfying `L.LeAtTop` and `L.NeBot`. -/ lemma eq_unconditional_of_finite {β} [Finite β] (L : SummationFilter β) [L.LeAtTop] [L.NeBot] : L = unconditional β := by classical haveI := Fintype.ofFinite β have hAtTop : (atTop : Filter (Finset β)) = pure Finset.univ := by rw [(isTop_iff_eq_top.mpr rfl).atTop_eq (a := Finset.univ), ← Finset.top_eq_univ, Ici_top, principal_singleton] have hL := L.le_atTop have hL' : ∅ ∉ L.filter := empty_mem_iff_bot.not.mpr <| NeBot.ne_bot.ne' cases L with | mk F => simp only [unconditional, hAtTop] at * congr 1 refine eq_of_le_of_ge hL (pure_le_iff.mpr ?_) contrapose! hL' obtain ⟨s, hs, hs'⟩ := hL' simpa [inter_singleton_eq_empty.mpr hs'] using inter_mem hs (le_pure_iff.mp hL) section conditionalTop variable [Preorder β] [LocallyFiniteOrder β] /-- **Conditional summation**, for ordered types `β` such that closed intervals `[x, y]` are finite: this corresponds to limits of finite sums over larger and larger intervals. -/ @[simps] def conditional : SummationFilter β where filter := (atBot ×ˢ atTop).map (fun p ↦ Finset.Icc p.1 p.2) instance : (conditional β).LeAtTop := ⟨support_eq_univ_iff.mp <| by simpa [eq_univ_iff_forall, support, -eventually_and] using fun x ↦ prod_mem_prod (eventually_le_atBot x) (eventually_ge_atTop x)⟩ instance [Nonempty β] [IsDirected β (· ≤ ·)] [IsDirected β (· ≥ ·)] : (conditional β).NeBot := ⟨by simp; infer_instance⟩ instance [IsCountablyGenerated (atTop : Filter β)] [IsCountablyGenerated (atBot : Filter β)] : IsCountablyGenerated (conditional β).filter := map.isCountablyGenerated .. /-- When `β` has a bottom element, `conditional β` is given by limits over finite intervals `{y | y ≤ x}` as `x → atTop`. -/ @[simp high] -- want this to be prioritized over `conditional_filter` when they both apply lemma conditional_filter_eq_map_Iic {γ} [PartialOrder γ] [LocallyFiniteOrder γ] [OrderBot γ] : (conditional γ).filter = atTop.map Finset.Iic := by simp [(isBot_bot).atBot_eq, comp_def, Finset.Icc_bot] /-- When `β` has a top element, `conditional β` is given by limits over finite intervals `{y | x ≤ y}` as `x → atBot`. -/ @[simp high] -- want this to be prioritized over `conditional_filter` when they both apply lemma conditional_filter_eq_map_Ici {γ} [PartialOrder γ] [LocallyFiniteOrder γ] [OrderTop γ] : (conditional γ).filter = atBot.map Finset.Ici := by simp [(isTop_top).atTop_eq, comp_def, Finset.Icc_top] /-- Conditional summation over `ℕ` is given by limits of sums over `Finset.range n` as `n → ∞`. -/ @[simp high + 1] -- want this to be prioritized over `conditional_filter_eq_map_Ici` lemma conditional_filter_eq_map_range : (conditional ℕ).filter = atTop.map Finset.range := by have (n : ℕ) : Finset.Iic n = Finset.range (n + 1) := by ext x; simp [Nat.lt_succ] simp only [conditional_filter_eq_map_Iic, funext this] apply le_antisymm <;> rw [← Tendsto] <;> simp only [tendsto_atTop', mem_map, mem_atTop_sets, mem_preimage] <;> rintro s ⟨a, ha⟩ · exact ⟨a + 1, fun b hb ↦ ha (b + 1) (by omega)⟩ · exact ⟨a + 1, fun b hb ↦ by convert ha (b - 1) (by omega); omega⟩ end conditionalTop end examples end SummationFilter
.lake/packages/mathlib/Mathlib/Topology/Algebra/InfiniteSum/Nonarchimedean.lean
import Mathlib.Algebra.Group.Subgroup.Finite import Mathlib.Topology.Algebra.InfiniteSum.GroupCompletion import Mathlib.Topology.Algebra.InfiniteSum.Ring import Mathlib.Topology.Algebra.Nonarchimedean.Completion /-! # 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 `α` (`NonarchimedeanAddGroup.summable_iff_tendsto_cofinite_zero`). We also prove the analogous result in the multiplicative setting (`NonarchimedeanGroup.multipliable_iff_tendsto_cofinite_one`). We also prove that multiplication distributes over arbitrarily indexed sums in a nonarchimedean ring. That is, let `R` be a nonarchimedean ring, let `f : α → R` be a function that sums to `a : R`, and let `g : β → R` be a function that sums to `b : R`. Then `fun (i : α × β) ↦ (f i.1) * (g i.2)` sums to `a * b` (`HasSum.mul_of_nonarchimedean`). -/ open Filter Topology namespace NonarchimedeanGroup variable {α G : Type*} variable [CommGroup G] [UniformSpace G] [IsUniformGroup 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 nonarchimedean abelian group, and let `f : ℕ → G` be a function such that the quotients `f (n + 1) / f n` tend to one. Then the function is a Cauchy sequence. -/ @[to_additive /-- Let `G` be a nonarchimedean additive abelian group, and let `f : ℕ → G` be a function such that the differences `f (n + 1) - f n` tend to zero. Then the function is a Cauchy sequence. -/] lemma cauchySeq_of_tendsto_div_nhds_one {f : ℕ → G} (hf : Tendsto (fun n ↦ f (n + 1) / f n) atTop (𝓝 1)) : CauchySeq f := by suffices Tendsto (fun p : ℕ × ℕ ↦ f p.2 / f p.1) atTop (𝓝 1) by simpa [CauchySeq, cauchy_map_iff, prod_atTop_atTop_eq, uniformity_eq_comap_nhds_one G, atTop_neBot] rw [tendsto_atTop'] intro s hs obtain ⟨t, ht⟩ := is_nonarchimedean s hs obtain ⟨N, hN⟩ : ∃ N : ℕ, ∀ b, N ≤ b → f (b + 1) / f b ∈ t := by simpa using tendsto_def.mp hf t t.mem_nhds_one refine ⟨(N, N), ?_⟩ rintro ⟨M, M'⟩ ⟨(hMN : N ≤ M), (hMN' : N ≤ M')⟩ apply ht wlog h : M ≤ M' generalizing M M' · simpa [inv_div] using t.inv_mem <| this _ _ hMN' hMN (le_of_not_ge h) obtain ⟨k, rfl⟩ := Nat.exists_eq_add_of_le h clear h hMN' induction k with | zero => simp | succ k ih => simpa using t.mul_mem (hN _ (by cutsat : N ≤ M + k)) ih /-- 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 section NonarchimedeanRing variable {α β R : Type*} variable [Ring R] [UniformSpace R] [IsUniformAddGroup R] [NonarchimedeanRing R] /- Let `R` be a complete nonarchimedean ring. If functions `f : α → R` and `g : β → R` are summable, then so is `fun i : α × β ↦ f i.1 * g i.2`. We will prove later that the assumption that `R` is complete is not necessary. -/ private theorem Summable.mul_of_complete_nonarchimedean [CompleteSpace R] {f : α → R} {g : β → R} (hf : Summable f) (hg : Summable g) : Summable (fun i : α × β ↦ f i.1 * g i.2) := by rw [NonarchimedeanAddGroup.summable_iff_tendsto_cofinite_zero] at * exact tendsto_mul_cofinite_nhds_zero hf hg /-- Let `R` be a nonarchimedean ring, let `f : α → R` be a function that sums to `a : R`, and let `g : β → R` be a function that sums to `b : R`. Then `fun i : α × β ↦ f i.1 * g i.2` sums to `a * b`. -/ theorem HasSum.mul_of_nonarchimedean {f : α → R} {g : β → R} {a b : R} (hf : HasSum f a) (hg : HasSum g b) : HasSum (fun i : α × β ↦ f i.1 * g i.2) (a * b) := by rw [← hasSum_iff_hasSum_compl] at * simp only [Function.comp_def, UniformSpace.Completion.toCompl_apply, UniformSpace.Completion.coe_mul] exact (hf.mul hg) (hf.summable.mul_of_complete_nonarchimedean hg.summable :) /-- Let `R` be a nonarchimedean ring. If functions `f : α → R` and `g : β → R` are summable, then so is `fun i : α × β ↦ f i.1 * g i.2`. -/ theorem Summable.mul_of_nonarchimedean {f : α → R} {g : β → R} (hf : Summable f) (hg : Summable g) : Summable (fun i : α × β ↦ f i.1 * g i.2) := (hf.hasSum.mul_of_nonarchimedean hg.hasSum).summable theorem tsum_mul_tsum_of_nonarchimedean [T0Space R] {f : α → R} {g : β → R} (hf : Summable f) (hg : Summable g) : (∑' i, f i) * (∑' i, g i) = ∑' i : α × β, f i.1 * g i.2 := (hf.hasSum.mul_of_nonarchimedean hg.hasSum).tsum_eq.symm end NonarchimedeanRing
.lake/packages/mathlib/Mathlib/Topology/Algebra/InfiniteSum/Real.lean
import Mathlib.Algebra.BigOperators.Intervals import Mathlib.Topology.Algebra.InfiniteSum.Order import Mathlib.Topology.Instances.ENNReal.Lemmas /-! # 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 Summable.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 simpa using 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 simpa using 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 := (summable_of_sum_range_le hf h).tsum_le_of_sum_range_le 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`. -/ protected theorem Summable.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 := Summable.tsum_lt_tsum h hi (.of_nonneg_of_le h0 h hg) hg end summable
.lake/packages/mathlib/Mathlib/Topology/Algebra/Nonarchimedean/Bases.lean
import Mathlib.Algebra.Algebra.Basic import Mathlib.Algebra.Module.Submodule.Pointwise import Mathlib.Topology.Algebra.FilterBasis import Mathlib.Topology.Algebra.Nonarchimedean.Basic /-! # Neighborhood bases for non-archimedean rings and modules This file 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⟩ obtain ⟨k, hk⟩ := hB.inter i j 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⟩ obtain ⟨k, hk⟩ := hB.mul i use B k constructor · use k · exact hk mul_left' := by rintro x₀ _ ⟨i, rfl⟩ obtain ⟨k, hk⟩ := hB.leftMul x₀ i use B k constructor · use k · exact hk mul_right' := by rintro x₀ _ ⟨i, rfl⟩ obtain ⟨k, hk⟩ := hB.rightMul x₀ i 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 := 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 [non-Archimedean 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⟩ obtain ⟨k, hk⟩ := hB.inter i j 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 { (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 [non-Archimedean 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_note2 «non-Archimedean non-instances» /-- The non-Archimedean subgroup basis lemmas cannot be instances because some instances (such as `MeasureTheory.AEEqFun.instAddMonoid` or `IsTopologicalAddGroup.toContinuousAdd`) cause the search for `@IsTopologicalAddGroup β ?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) include hB hsmul 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 { 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)
.lake/packages/mathlib/Mathlib/Topology/Algebra/Nonarchimedean/TotallyDisconnected.lean
import Mathlib.Topology.Algebra.Nonarchimedean.Basic /-! # Total separatedness of nonarchimedean groups In this file, we prove that a nonarchimedean group is a totally separated topological space. The fact that a nonarchimedean group is a totally disconnected topological space is implied by the fact that a nonarchimedean group is totally separated. ## Main results - `NonarchimedeanGroup.instTotallySeparated`: A nonarchimedean group is a totally separated topological space. ## Notation - `G` : Is a nonarchimedean group. - `V` : Is an open subgroup which is a neighbourhood of the identity in `G`. ## References See Proposition 2.3.9 and Problem 63 in [F. Q. Gouvêa, *p-adic numbers*][gouvea1997]. -/ open Pointwise TopologicalSpace variable {G : Type*} [TopologicalSpace G] [Group G] [NonarchimedeanGroup G] [T2Space G] namespace NonarchimedeanGroup @[to_additive] lemma exists_openSubgroup_separating {a b : G} (h : a ≠ b) : ∃ V : OpenSubgroup G, Disjoint (a • (V : Set G)) (b • V) := by obtain ⟨u, v, _, open_v, mem_u, mem_v, dis⟩ := t2_separation (h ∘ inv_mul_eq_one.mp) obtain ⟨V, hV⟩ := is_nonarchimedean v (open_v.mem_nhds mem_v) use V simp only [Disjoint, Set.le_eq_subset, Set.bot_eq_empty, Set.subset_empty_iff] intro x mem_aV mem_bV by_contra! con obtain ⟨s, hs⟩ := con have hsa : s ∈ a • (V : Set G) := mem_aV hs have hsb : s ∈ b • (V : Set G) := mem_bV hs rw [mem_leftCoset_iff] at hsa hsb refine dis.subset_compl_right mem_u (hV ?_) simpa [mul_assoc] using mul_mem hsa (inv_mem hsb) @[to_additive] instance (priority := 100) instTotallySeparated : TotallySeparatedSpace G where isTotallySeparated_univ x _ y _ hxy := by obtain ⟨V, dxy⟩ := exists_openSubgroup_separating hxy exact ⟨_, _, V.isOpen.smul x, (V.isClosed.smul x).isOpen_compl, mem_own_leftCoset .., dxy.subset_compl_left <| mem_own_leftCoset .., by simp, disjoint_compl_right⟩ end NonarchimedeanGroup
.lake/packages/mathlib/Mathlib/Topology/Algebra/Nonarchimedean/Completion.lean
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] [IsUniformAddGroup 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 (isDenseInducing_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] [IsTopologicalRing R] [IsUniformAddGroup R] [NonarchimedeanRing R] : NonarchimedeanRing (Completion R) where is_nonarchimedean := NonarchimedeanAddGroup.is_nonarchimedean
.lake/packages/mathlib/Mathlib/Topology/Algebra/Nonarchimedean/Basic.lean
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 Topology open scoped Pointwise /-- A topological additive group is nonarchimedean if every neighborhood of 0 contains an open subgroup. -/ class NonarchimedeanAddGroup (G : Type*) [AddGroup G] [TopologicalSpace G] : Prop extends IsTopologicalAddGroup G 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] : Prop extends IsTopologicalGroup G 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] : Prop extends IsTopologicalRing R 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] [IsTopologicalGroup 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 : IsOpenEmbedding 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 rw [nhds_prod_eq, Filter.mem_prod_iff] at hU rcases hU with ⟨U₁, hU₁, U₂, hU₂, h⟩ obtain ⟨V, hV⟩ := is_nonarchimedean _ hU₁ obtain ⟨W, hW⟩ := is_nonarchimedean _ hU₂ use V grind /-- 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 Prod.instNonarchimedeanGroup : NonarchimedeanGroup (G × K) where is_nonarchimedean _ hU := let ⟨V, W, h⟩ := prod_subset hU ⟨V.prod W, ‹_›⟩ end NonarchimedeanGroup namespace 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
.lake/packages/mathlib/Mathlib/Topology/Algebra/Nonarchimedean/AdicTopology.lean
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 IsTopologicalAddGroup 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.algebraMap_self, 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.algebraMap_self, 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.algebraMap_self, 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 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] [IsTopologicalRing 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 IsTopologicalAddGroup.ext · apply @IsTopologicalRing.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] [IsTopologicalRing 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 obtain ⟨m, hm⟩ := h.right V hV 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] [IsTopologicalRing 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] omit [IsTopologicalRing R] in theorem IsAdic.hasBasis_nhds_zero {I : Ideal R} (hI : IsAdic I) : (𝓝 (0 : R)).HasBasis (fun _ ↦ True) fun n ↦ ↑(I ^ n) := hI ▸ Ideal.hasBasis_nhds_zero_adic I omit [IsTopologicalRing R] in theorem IsAdic.hasBasis_nhds {I : Ideal R} (hI : IsAdic I) (x : R) : (𝓝 x).HasBasis (fun _ ↦ True) fun n ↦ (x + ·) '' ↑(I ^ n) := hI ▸ Ideal.hasBasis_nhds_adic I x 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 := IsTopologicalAddGroup.rightUniformSpace R instance (priority := 100) : IsUniformAddGroup R := isUniformAddGroup_of_addCommGroup /-- 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 : IsTopologicalRing (UniformSpace.Completion R) := by infer_instance example (M : Type*) [AddCommGroup M] [Module R M] : @IsTopologicalAddGroup 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