path
stringlengths
11
71
content
stringlengths
75
124k
Analysis\CStarAlgebra\ContinuousFunctionalCalculus\Unital.lean
/- Copyright (c) 2024 Jireh Loreaux. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Jireh Loreaux -/ import Mathlib.Algebra.Algebra.Quasispectrum import Mathlib.Algebra.Algebra.Spectrum import Mathlib.Algebra.Star.Order import Mathlib.Topology.Algebra.Polynomial import Mathlib.Topology.ContinuousFunction.Algebra import Mathlib.Tactic.ContinuousFunctionalCalculus /-! # The continuous functional calculus This file defines a generic API for the *continuous functional calculus* which is suitable in a wide range of settings. A continuous functional calculus for an element `a : A` in a topological `R`-algebra is a continuous extension of the polynomial functional calculus (i.e., `Polynomial.aeval`) to continuous `R`-valued functions on `spectrum R a`. More precisely, it is a continuous star algebra homomorphism `C(spectrum R a, R) →⋆ₐ[R] A` that sends `(ContinuousMap.id R).restrict (spectrum R a)` to `a`. In all cases of interest (e.g., when `spectrum R a` is compact and `R` is `ℝ≥0`, `ℝ`, or `ℂ`), this is sufficient to uniquely determine the continuous functional calculus which is encoded in the `UniqueContinuousFunctionalCalculus` class. Although these properties suffice to uniquely determine the continuous functional calculus, we choose to bundle more information into the class itself. Namely, we include that the star algebra homomorphism is a closed embedding, and also that the spectrum of the image of `f : C(spectrum R a, R)` under this morphism is the range of `f`. In addition, the class specifies a collection of continuous functional calculi for elements satisfying a given predicate `p : A → Prop`, and we require that this predicate is preserved by the functional calculus. Although `cfcHom : p a → C(spectrum R a, R) →*ₐ[R] A` is a necessity for getting the full power out of the continuous functional calculus, this declaration will generally not be accessed directly by the user. One reason for this is that `cfcHom` requires a proof of `p a` (indeed, if the spectrum is empty, there cannot exist a star algebra homomorphism like this). Instead, we provide the completely unbundled `cfc : (R → R) → A → A` which operates on bare functions and provides junk values when either `a` does not satisfy the property `p`, or else when the function which is the argument to `cfc` is not continuous on the spectrum of `a`. This completely unbundled approach may give up some conveniences, but it allows for tremendous freedom. In particular, `cfc f a` makes sense for *any* `a : A` and `f : R → R`. This is quite useful in a variety of settings, but perhaps the most important is the following. Besides being a star algebra homomorphism sending the identity to `a`, the key property enjoyed by the continuous functional calculus is the *composition property*, which guarantees that `cfc (g ∘ f) a = cfc g (cfc f a)` under suitable hypotheses on `a`, `f` and `g`. Note that this theorem is nearly impossible to state nicely in terms of `cfcHom` (see `cfcHom_comp`). An additional advantage of the unbundled approach is that expressions like `fun x : R ↦ x⁻¹` are valid arguments to `cfc`, and a bundled continuous counterpart can only make sense when the spectrum of `a` does not contain zero and when we have an `⁻¹` operation on the domain. A reader familiar with C⋆-algebra theory may be somewhat surprised at the level of abstraction here. For instance, why not require `A` to be an actual C⋆-algebra? Why define separate continuous functional calculi for `R := ℂ`, `ℝ` or `ℝ≥0` instead of simply using the continuous functional calculus for normal elements? The reason for both can be explained with a simple example, `A := Matrix n n ℝ`. In Mathlib, matrices are not equipped with a norm (nor even a metric), and so requiring `A` to be a C⋆-algebra is far too stringent. Likewise, `A` is not a `ℂ`-algebra, and so it is impossible to consider the `ℂ`-spectrum of `a : Matrix n n ℝ`. There is another, more practical reason to define separate continuous functional calculi for different scalar rings. It gives us the ability to use functions defined on these types, and the algebra of functions on them. For example, for `R := ℝ` it is quite natural to consider the functions `(·⁺ : ℝ → ℝ)` and `(·⁻ : ℝ → ℝ)` because the functions `ℝ → ℝ` form a lattice ordered group. If `a : A` is selfadjoint, and we define `a⁺ := cfc (·⁺ : ℝ → ℝ) a`, and likewise for `a⁻`, then the properties `a⁺ * a⁻ = 0 = a⁻ * a⁺` and `a = a⁺ - a⁻` are trivial consequences of the corresponding facts for functions. In contrast, if we had to do this using functions on `ℂ`, the proofs of these facts would be much more cumbersome. ## Example The canonical example of the continuous functional calculus is when `A := Matrix n n ℂ`, `R := ℂ` and `p := IsStarNormal`. In this case, `spectrum ℂ a` consists of the eigenvalues of the normal matrix `a : Matrix n n ℂ`, and, because this set is discrete, any function is continuous on the spectrum. The continuous functional calculus allows us to make sense of expressions like `log a` (`:= cfc log a`), and when `0 ∉ spectrum ℂ a`, we get the nice property `exp (log a) = a`, which arises from the composition property `cfc exp (cfc log a) = cfc (exp ∘ log) a = cfc id a = a`, since `exp ∘ log = id` *on the spectrum of `a`*. Of course, there are other ways to make sense of `exp` and `log` for matrices (power series), and these agree with the continuous functional calculus. In fact, given `f : C(spectrum ℂ a, ℂ)`, `cfc f a` amounts to diagonalizing `a` (possible since `a` is normal), and applying `f` to the resulting diagonal entries. That is, if `a = u * d * star u` with `u` a unitary matrix and `d` diagonal, then `cfc f a = u * d.map f * star u`. In addition, if `a : Matrix n n ℂ` is positive semidefinite, then the `ℂ`-spectrum of `a` is contained in (the range of the coercion of) `ℝ≥0`. In this case, we get a continuous functional calculus with `R := ℝ≥0`. From this we can define `√a := cfc a NNReal.sqrt`, which is also positive semidefinite (because `cfc` preserves the predicate), and this is truly a square root since ``` √a * √a = cfc NNReal.sqrt a * cfc NNReal.sqrt a = cfc (NNReal.sqrt ^ 2) a = cfc id a = a ``` The composition property allows us to show that, in fact, this is the *unique* positive semidefinite square root of `a` because, if `b` is any positive semidefinite square root, then ``` b = cfc id b = cfc (NNReal.sqrt ∘ (· ^ 2)) b = cfc NNReal.sqrt (cfc b (· ^ 2)) = cfc NNReal.sqrt a = √a ``` ## Main declarations + `ContinuousFunctionalCalculus R (p : A → Prop)`: a class stating that every `a : A` satisfying `p a` has a star algebra homomorphism from the continuous `R`-valued functions on the `R`-spectrum of `a` into the algebra `A`. This map is a closed embedding, and satisfies the **spectral mapping theorem**. + `cfcHom : p a → C(spectrum R a, R) →⋆ₐ[R] A`: the underlying star algebra homomorphism for an element satisfying property `p`. + `cfc : (R → R) → A → A`: an unbundled version of `cfcHom` which takes the junk value `0` when `cfcHom` is not defined. + `cfcUnits`: builds a unit from `cfc f a` when `f` is nonzero and continuous on the specturm of `a`. ## Main theorems + `cfc_comp : cfc (x ↦ g (f x)) a = cfc g (cfc f a)` + `cfc_polynomial`: the continuous functional calculus extends the polynomial functional calculus. ## Implementation details Instead of defining a class depending on a term `a : A`, we register it for an `outParam` predicate `p : A → Prop`, and then any element of `A` satisfying this predicate has the associated star algebra homomorphism with the specified properties. In so doing we avoid a common pitfall: dependence of the class on a term. This avoids annoying situations where `a b : A` are propositionally equal, but not definitionally so, and hence Lean would not be able to automatically identify the continuous functional calculi associated to these elements. In order to guarantee the necessary properties, we require that the continuous functional calculus preserves this predicate. That is, `p a → p (cfc f a)` for any function `f` continuous on the spectrum of `a`. As stated above, the unbundled approach to `cfc` has its advantages. For instance, given an expression `cfc f a`, the user is free to rewrite either `a` or `f` as desired with no possibility of the expression ceasing to be defined. However, this unbundling also has some potential downsides. In particular, by unbundling, proof requirements are deferred until the user calls the lemmas, most of which have hypotheses both of `p a` and of `ContinuousOn f (spectrum R a)`. In order to minimize burden to the user, we provide `autoParams` in terms of two tactics. Goals related to continuity are dispatched by (a small wrapper around) `fun_prop`. As for goals involving the predicate `p`, it should be noted that these will only ever be of the form `IsStarNormal a`, `IsSelfAdjoint a` or `0 ≤ a`. For the moment we provide a rudimentary tactic to deal with these goals, but it can be modified to become more sophisticated as the need arises. -/ section Basic /-- A star `R`-algebra `A` has a *continuous functional calculus* for elements satisfying the property `p : A → Prop` if + for every such element `a : A` there is a star algebra homomorphism `cfcHom : C(spectrum R a, R) →⋆ₐ[R] A` sending the (restriction of) the identity map to `a`. + `cfcHom` is a closed embedding for which the spectrum of the image of function `f` is its range. + `cfcHom` preserves the property `p`. + `p 0` is true, which ensures among other things that `p ≠ fun _ ↦ False`. The property `p` is marked as an `outParam` so that the user need not specify it. In practice, + for `R := ℂ`, we choose `p := IsStarNormal`, + for `R := ℝ`, we choose `p := IsSelfAdjoint`, + for `R := ℝ≥0`, we choose `p := (0 ≤ ·)`. Instead of directly providing the data we opt instead for a `Prop` class. In all relevant cases, the continuous functional calculus is uniquely determined, and utilizing this approach prevents diamonds or problems arising from multiple instances. -/ class ContinuousFunctionalCalculus (R : Type*) {A : Type*} (p : outParam (A → Prop)) [CommSemiring R] [StarRing R] [MetricSpace R] [TopologicalSemiring R] [ContinuousStar R] [Ring A] [StarRing A] [TopologicalSpace A] [Algebra R A] : Prop where predicate_zero : p 0 exists_cfc_of_predicate : ∀ a, p a → ∃ φ : C(spectrum R a, R) →⋆ₐ[R] A, ClosedEmbedding φ ∧ φ ((ContinuousMap.id R).restrict <| spectrum R a) = a ∧ (∀ f, spectrum R (φ f) = Set.range f) ∧ ∀ f, p (φ f) /-- A class guaranteeing that the continuous functional calculus is uniquely determined by the properties that it is a continuous star algebra homomorphism mapping the (restriction of) the identity to `a`. This is the necessary tool used to establish `cfcHom_comp` and the more common variant `cfc_comp`. This class has instances, which can be found in `Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unique`, in each of the common cases `ℂ`, `ℝ` and `ℝ≥0` as a consequence of the Stone-Weierstrass theorem. This class is separate from `ContinuousFunctionalCalculus` primarily because we will later use `SpectrumRestricts` to derive an instance of `ContinuousFunctionalCalculus` on a scalar subring from one on a larger ring (i.e., to go from a continuous functional calculus over `ℂ` for normal elements to one over `ℝ` for selfadjoint elements), and proving this additional property is preserved would be burdensome or impossible. -/ class UniqueContinuousFunctionalCalculus (R A : Type*) [CommSemiring R] [StarRing R] [MetricSpace R] [TopologicalSemiring R] [ContinuousStar R] [Ring A] [StarRing A] [TopologicalSpace A] [Algebra R A] : Prop where eq_of_continuous_of_map_id (s : Set R) [CompactSpace s] (φ ψ : C(s, R) →⋆ₐ[R] A) (hφ : Continuous φ) (hψ : Continuous ψ) (h : φ (.restrict s <| .id R) = ψ (.restrict s <| .id R)) : φ = ψ compactSpace_spectrum (a : A) : CompactSpace (spectrum R a) variable {R A : Type*} {p : A → Prop} [CommSemiring R] [StarRing R] [MetricSpace R] variable [TopologicalSemiring R] [ContinuousStar R] [TopologicalSpace A] [Ring A] [StarRing A] variable [Algebra R A] [ContinuousFunctionalCalculus R p] lemma StarAlgHom.ext_continuousMap [UniqueContinuousFunctionalCalculus R A] (a : A) (φ ψ : C(spectrum R a, R) →⋆ₐ[R] A) (hφ : Continuous φ) (hψ : Continuous ψ) (h : φ (.restrict (spectrum R a) <| .id R) = ψ (.restrict (spectrum R a) <| .id R)) : φ = ψ := have := UniqueContinuousFunctionalCalculus.compactSpace_spectrum (R := R) a UniqueContinuousFunctionalCalculus.eq_of_continuous_of_map_id (spectrum R a) φ ψ hφ hψ h section cfcHom variable {a : A} (ha : p a) -- Note: since `spectrum R a` is closed, we may always extend `f : C(spectrum R a, R)` to a function -- of type `C(R, R)` by the Tietze extension theorem (assuming `R` is either `ℝ`, `ℂ` or `ℝ≥0`). /-- The star algebra homomorphism underlying a instance of the continuous functional calculus; a version for continuous functions on the spectrum. In this case, the user must supply the fact that `a` satisfies the predicate `p`, for otherwise it may be the case that no star algebra homomorphism exists. For instance if `R := ℝ` and `a` is an element whose spectrum (in `ℂ`) is disjoint from `ℝ`, then `spectrum ℝ a = ∅` and so there can be no star algebra homomorphism between these spaces. While `ContinuousFunctionalCalculus` is stated in terms of these homomorphisms, in practice the user should instead prefer `cfc` over `cfcHom`. -/ noncomputable def cfcHom : C(spectrum R a, R) →⋆ₐ[R] A := (ContinuousFunctionalCalculus.exists_cfc_of_predicate a ha).choose lemma cfcHom_closedEmbedding : ClosedEmbedding <| (cfcHom ha : C(spectrum R a, R) →⋆ₐ[R] A) := (ContinuousFunctionalCalculus.exists_cfc_of_predicate a ha).choose_spec.1 lemma cfcHom_id : cfcHom ha ((ContinuousMap.id R).restrict <| spectrum R a) = a := (ContinuousFunctionalCalculus.exists_cfc_of_predicate a ha).choose_spec.2.1 /-- The **spectral mapping theorem** for the continuous functional calculus. -/ lemma cfcHom_map_spectrum (f : C(spectrum R a, R)) : spectrum R (cfcHom ha f) = Set.range f := (ContinuousFunctionalCalculus.exists_cfc_of_predicate a ha).choose_spec.2.2.1 f lemma cfcHom_predicate (f : C(spectrum R a, R)) : p (cfcHom ha f) := (ContinuousFunctionalCalculus.exists_cfc_of_predicate a ha).choose_spec.2.2.2 f lemma cfcHom_eq_of_continuous_of_map_id [UniqueContinuousFunctionalCalculus R A] (φ : C(spectrum R a, R) →⋆ₐ[R] A) (hφ₁ : Continuous φ) (hφ₂ : φ (.restrict (spectrum R a) <| .id R) = a) : cfcHom ha = φ := (cfcHom ha).ext_continuousMap a φ (cfcHom_closedEmbedding ha).continuous hφ₁ <| by rw [cfcHom_id ha, hφ₂] theorem cfcHom_comp [UniqueContinuousFunctionalCalculus R A] (f : C(spectrum R a, R)) (f' : C(spectrum R a, spectrum R (cfcHom ha f))) (hff' : ∀ x, f x = f' x) (g : C(spectrum R (cfcHom ha f), R)) : cfcHom ha (g.comp f') = cfcHom (cfcHom_predicate ha f) g := by let φ : C(spectrum R (cfcHom ha f), R) →⋆ₐ[R] A := (cfcHom ha).comp <| ContinuousMap.compStarAlgHom' R R f' suffices cfcHom (cfcHom_predicate ha f) = φ from DFunLike.congr_fun this.symm g refine cfcHom_eq_of_continuous_of_map_id (cfcHom_predicate ha f) φ ?_ ?_ · exact (cfcHom_closedEmbedding ha).continuous.comp f'.continuous_comp_left · simp only [φ, StarAlgHom.comp_apply, ContinuousMap.compStarAlgHom'_apply] congr ext x simp [hff'] end cfcHom section CFC open scoped Classical in /-- This is the *continuous functional calculus* of an element `a : A` applied to bare functions. When either `a` does not satisfy the predicate `p` (i.e., `a` is not `IsStarNormal`, `IsSelfAdjoint`, or `0 ≤ a` when `R` is `ℂ`, `ℝ`, or `ℝ≥0`, respectively), or when `f : R → R` is not continuous on the spectrum of `a`, then `cfc f a` returns the junk value `0`. This is the primary declaration intended for widespread use of the continuous functional calculus, and all the API applies to this declaration. For more information, see the module documentation for `Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital`. -/ noncomputable irreducible_def cfc (f : R → R) (a : A) : A := if h : p a ∧ ContinuousOn f (spectrum R a) then cfcHom h.1 ⟨_, h.2.restrict⟩ else 0 variable (f g : R → R) (a : A) (ha : p a := by cfc_tac) variable (hf : ContinuousOn f (spectrum R a) := by cfc_cont_tac) variable (hg : ContinuousOn g (spectrum R a) := by cfc_cont_tac) lemma cfc_apply : cfc f a = cfcHom (a := a) ha ⟨_, hf.restrict⟩ := by rw [cfc_def, dif_pos ⟨ha, hf⟩] lemma cfc_apply_pi {ι : Type*} (f : ι → R → R) (a : A) (ha : p a := by cfc_tac) (hf : ∀ i, ContinuousOn (f i) (spectrum R a) := by cfc_cont_tac) : (fun i => cfc (f i) a) = (fun i => cfcHom (a := a) ha ⟨_, (hf i).restrict⟩) := by ext i simp only [cfc_apply (f i) a ha (hf i)] lemma cfc_apply_of_not_and {f : R → R} (a : A) (ha : ¬ (p a ∧ ContinuousOn f (spectrum R a))) : cfc f a = 0 := by rw [cfc_def, dif_neg ha] lemma cfc_apply_of_not_predicate {f : R → R} (a : A) (ha : ¬ p a) : cfc f a = 0 := by rw [cfc_def, dif_neg (not_and_of_not_left _ ha)] lemma cfc_apply_of_not_continuousOn {f : R → R} (a : A) (hf : ¬ ContinuousOn f (spectrum R a)) : cfc f a = 0 := by rw [cfc_def, dif_neg (not_and_of_not_right _ hf)] lemma cfcHom_eq_cfc_extend {a : A} (g : R → R) (ha : p a) (f : C(spectrum R a, R)) : cfcHom ha f = cfc (Function.extend Subtype.val f g) a := by have h : f = (spectrum R a).restrict (Function.extend Subtype.val f g) := by ext; simp [Subtype.val_injective.extend_apply] have hg : ContinuousOn (Function.extend Subtype.val f g) (spectrum R a) := continuousOn_iff_continuous_restrict.mpr <| h ▸ map_continuous f rw [cfc_apply ..] congr! lemma cfc_cases (P : A → Prop) (a : A) (f : R → R) (h₀ : P 0) (haf : (hf : ContinuousOn f (spectrum R a)) → (ha : p a) → P (cfcHom ha ⟨_, hf.restrict⟩)) : P (cfc f a) := by by_cases h : p a ∧ ContinuousOn f (spectrum R a) · rw [cfc_apply f a h.1 h.2] exact haf h.2 h.1 · simp only [not_and_or] at h obtain (h | h) := h · rwa [cfc_apply_of_not_predicate _ h] · rwa [cfc_apply_of_not_continuousOn _ h] variable (R) in lemma cfc_id (ha : p a := by cfc_tac) : cfc (id : R → R) a = a := cfc_apply (id : R → R) a ▸ cfcHom_id (p := p) ha variable (R) in lemma cfc_id' (ha : p a := by cfc_tac) : cfc (fun x : R ↦ x) a = a := cfc_id R a /-- The **spectral mapping theorem** for the continuous functional calculus. -/ lemma cfc_map_spectrum (ha : p a := by cfc_tac) (hf : ContinuousOn f (spectrum R a) := by cfc_cont_tac) : spectrum R (cfc f a) = f '' spectrum R a := by simp [cfc_apply f a, cfcHom_map_spectrum (p := p)] lemma cfc_const (r : R) (a : A) (ha : p a := by cfc_tac) : cfc (fun _ ↦ r) a = algebraMap R A r := by rw [cfc_apply (fun _ : R ↦ r) a, ← AlgHomClass.commutes (cfcHom ha (p := p)) r] congr variable (R) in lemma cfc_predicate_zero : p 0 := ContinuousFunctionalCalculus.predicate_zero (R := R) lemma cfc_predicate (f : R → R) (a : A) : p (cfc f a) := cfc_cases p a f (cfc_predicate_zero R) fun _ _ ↦ cfcHom_predicate .. lemma cfc_predicate_algebraMap (r : R) : p (algebraMap R A r) := cfc_const r (0 : A) (cfc_predicate_zero R) ▸ cfc_predicate (fun _ ↦ r) 0 variable (R) in lemma cfc_predicate_one : p 1 := map_one (algebraMap R A) ▸ cfc_predicate_algebraMap (1 : R) lemma cfc_congr {f g : R → R} {a : A} (hfg : (spectrum R a).EqOn f g) : cfc f a = cfc g a := by by_cases h : p a ∧ ContinuousOn g (spectrum R a) · rw [cfc_apply (ha := h.1) (hf := h.2.congr hfg), cfc_apply (ha := h.1) (hf := h.2)] congr exact Set.restrict_eq_iff.mpr hfg · obtain (ha | hg) := not_and_or.mp h · simp [cfc_apply_of_not_predicate a ha] · rw [cfc_apply_of_not_continuousOn a hg, cfc_apply_of_not_continuousOn] exact fun hf ↦ hg (hf.congr hfg.symm) lemma eqOn_of_cfc_eq_cfc {f g : R → R} {a : A} (h : cfc f a = cfc g a) (hf : ContinuousOn f (spectrum R a) := by cfc_cont_tac) (hg : ContinuousOn g (spectrum R a) := by cfc_cont_tac) (ha : p a := by cfc_tac) : (spectrum R a).EqOn f g := by rw [cfc_apply f a, cfc_apply g a] at h have := (cfcHom_closedEmbedding (show p a from ha) (R := R)).inj h intro x hx congrm($(this) ⟨x, hx⟩) variable {a f g} in lemma cfc_eq_cfc_iff_eqOn (ha : p a := by cfc_tac) (hf : ContinuousOn f (spectrum R a) := by cfc_cont_tac) (hg : ContinuousOn g (spectrum R a) := by cfc_cont_tac) : cfc f a = cfc g a ↔ (spectrum R a).EqOn f g := ⟨eqOn_of_cfc_eq_cfc, cfc_congr⟩ variable (R) lemma cfc_one (ha : p a := by cfc_tac) : cfc (1 : R → R) a = 1 := cfc_apply (1 : R → R) a ▸ map_one (cfcHom (show p a from ha)) lemma cfc_const_one (ha : p a := by cfc_tac) : cfc (fun _ : R ↦ 1) a = 1 := cfc_one R a @[simp] lemma cfc_zero : cfc (0 : R → R) a = 0 := by by_cases ha : p a · exact cfc_apply (0 : R → R) a ▸ map_zero (cfcHom ha) · rw [cfc_apply_of_not_predicate a ha] @[simp] lemma cfc_const_zero : cfc (fun _ : R ↦ 0) a = 0 := cfc_zero R a variable {R} lemma cfc_mul (f g : R → R) (a : A) (hf : ContinuousOn f (spectrum R a) := by cfc_cont_tac) (hg : ContinuousOn g (spectrum R a) := by cfc_cont_tac) : cfc (fun x ↦ f x * g x) a = cfc f a * cfc g a := by by_cases ha : p a · rw [cfc_apply f a, cfc_apply g a, ← map_mul, cfc_apply _ a] congr · simp [cfc_apply_of_not_predicate a ha] lemma cfc_pow (f : R → R) (n : ℕ) (a : A) (hf : ContinuousOn f (spectrum R a) := by cfc_cont_tac) (ha : p a := by cfc_tac) : cfc (fun x ↦ (f x) ^ n) a = cfc f a ^ n := by rw [cfc_apply f a, ← map_pow, cfc_apply _ a] congr lemma cfc_add (f g : R → R) (hf : ContinuousOn f (spectrum R a) := by cfc_cont_tac) (hg : ContinuousOn g (spectrum R a) := by cfc_cont_tac) : cfc (fun x ↦ f x + g x) a = cfc f a + cfc g a := by by_cases ha : p a · rw [cfc_apply f a, cfc_apply g a, ← map_add, cfc_apply _ a] congr · simp [cfc_apply_of_not_predicate a ha] lemma cfc_const_add (r : R) (f : R → R) (a : A) (hf : ContinuousOn f (spectrum R a) := by cfc_cont_tac) (ha : p a := by cfc_tac) : cfc (fun x => r + f x) a = algebraMap R A r + cfc f a := by have : (fun z => r + f z) = (fun z => (fun _ => r) z + f z) := by ext; simp rw [this, cfc_add a _ _ (continuousOn_const (c := r)) hf, cfc_const r a ha] lemma cfc_add_const (r : R) (f : R → R) (a : A) (hf : ContinuousOn f (spectrum R a) := by cfc_cont_tac) (ha : p a := by cfc_tac) : cfc (fun x => f x + r) a = cfc f a + algebraMap R A r := by rw [add_comm (cfc f a)] conv_lhs => simp only [add_comm] exact cfc_const_add r f a hf ha open Finset in lemma cfc_sum {ι : Type*} (f : ι → R → R) (a : A) (s : Finset ι) (hf : ∀ i ∈ s, ContinuousOn (f i) (spectrum R a) := by cfc_cont_tac) : cfc (∑ i in s, f i) a = ∑ i in s, cfc (f i) a := by by_cases ha : p a · have hsum : s.sum f = fun z => ∑ i ∈ s, f i z := by ext; simp have hf' : ContinuousOn (∑ i : s, f i) (spectrum R a) := by rw [sum_coe_sort s, hsum] exact continuousOn_finset_sum s fun i hi => hf i hi rw [← sum_coe_sort s, ← sum_coe_sort s] rw [cfc_apply_pi _ a _ (fun ⟨i, hi⟩ => hf i hi), ← map_sum, cfc_apply _ a ha hf'] congr 1 ext simp · simp [cfc_apply_of_not_predicate a ha] open Finset in lemma cfc_sum_univ {ι : Type*} [Fintype ι] (f : ι → R → R) (a : A) (hf : ∀ i, ContinuousOn (f i) (spectrum R a) := by cfc_cont_tac) : cfc (∑ i, f i) a = ∑ i, cfc (f i) a := cfc_sum f a _ fun i _ ↦ hf i lemma cfc_smul {S : Type*} [SMul S R] [ContinuousConstSMul S R] [SMulZeroClass S A] [IsScalarTower S R A] [IsScalarTower S R (R → R)] (s : S) (f : R → R) (a : A) (hf : ContinuousOn f (spectrum R a) := by cfc_cont_tac) : cfc (fun x ↦ s • f x) a = s • cfc f a := by by_cases ha : p a · rw [cfc_apply f a, cfc_apply _ a] simp_rw [← Pi.smul_def, ← smul_one_smul R s _] rw [← map_smul] congr · simp [cfc_apply_of_not_predicate a ha] lemma cfc_const_mul (r : R) (f : R → R) (a : A) (hf : ContinuousOn f (spectrum R a) := by cfc_cont_tac) : cfc (fun x ↦ r * f x) a = r • cfc f a := cfc_smul r f a lemma cfc_star (f : R → R) (a : A) : cfc (fun x ↦ star (f x)) a = star (cfc f a) := by by_cases h : p a ∧ ContinuousOn f (spectrum R a) · obtain ⟨ha, hf⟩ := h rw [cfc_apply f a, ← map_star, cfc_apply _ a] congr · obtain (ha | hf) := not_and_or.mp h · simp [cfc_apply_of_not_predicate a ha] · rw [cfc_apply_of_not_continuousOn a hf, cfc_apply_of_not_continuousOn, star_zero] exact fun hf_star ↦ hf <| by simpa using hf_star.star lemma cfc_pow_id (a : A) (n : ℕ) (ha : p a := by cfc_tac) : cfc (· ^ n : R → R) a = a ^ n := by rw [cfc_pow .., cfc_id' ..] lemma cfc_smul_id {S : Type*} [SMul S R] [ContinuousConstSMul S R] [SMulZeroClass S A] [IsScalarTower S R A] [IsScalarTower S R (R → R)] (s : S) (a : A) (ha : p a := by cfc_tac) : cfc (s • · : R → R) a = s • a := by rw [cfc_smul .., cfc_id' ..] lemma cfc_const_mul_id (r : R) (a : A) (ha : p a := by cfc_tac) : cfc (r * ·) a = r • a := cfc_smul_id r a lemma cfc_star_id (ha : p a := by cfc_tac) : cfc (star · : R → R) a = star a := by rw [cfc_star .., cfc_id' ..] section Polynomial open Polynomial lemma cfc_eval_X (ha : p a := by cfc_tac) : cfc (X : R[X]).eval a = a := by simpa using cfc_id R a lemma cfc_eval_C (r : R) (a : A) (ha : p a := by cfc_tac) : cfc (C r).eval a = algebraMap R A r := by simp [cfc_const r a] lemma cfc_map_polynomial (q : R[X]) (f : R → R) (a : A) (ha : p a := by cfc_tac) (hf : ContinuousOn f (spectrum R a) := by cfc_cont_tac) : cfc (fun x ↦ q.eval (f x)) a = aeval (cfc f a) q := by induction q using Polynomial.induction_on with | h_C r => simp [cfc_const r a] | h_add q₁ q₂ hq₁ hq₂ => simp only [eval_add, map_add, ← hq₁, ← hq₂, cfc_add a (q₁.eval <| f ·) (q₂.eval <| f ·)] | h_monomial n r _ => simp only [eval_mul, eval_C, eval_pow, eval_X, map_mul, aeval_C, map_pow, aeval_X] rw [cfc_const_mul .., cfc_pow _ (n + 1) _, ← smul_eq_mul, algebraMap_smul] lemma cfc_polynomial (q : R[X]) (a : A) (ha : p a := by cfc_tac) : cfc q.eval a = aeval a q := by rw [cfc_map_polynomial .., cfc_id' ..] end Polynomial lemma CFC.eq_algebraMap_of_spectrum_subset_singleton (r : R) (h_spec : spectrum R a ⊆ {r}) (ha : p a := by cfc_tac) : a = algebraMap R A r := by simpa [cfc_id R a, cfc_const r a] using cfc_congr (f := id) (g := fun _ : R ↦ r) (a := a) fun x hx ↦ by simpa using h_spec hx lemma CFC.eq_zero_of_spectrum_subset_zero (h_spec : spectrum R a ⊆ {0}) (ha : p a := by cfc_tac) : a = 0 := by simpa using eq_algebraMap_of_spectrum_subset_singleton a 0 h_spec lemma CFC.eq_one_of_spectrum_subset_one (h_spec : spectrum R a ⊆ {1}) (ha : p a := by cfc_tac) : a = 1 := by simpa using eq_algebraMap_of_spectrum_subset_singleton a 1 h_spec variable [UniqueContinuousFunctionalCalculus R A] lemma cfc_comp (g f : R → R) (a : A) (ha : p a := by cfc_tac) (hg : ContinuousOn g (f '' spectrum R a) := by cfc_cont_tac) (hf : ContinuousOn f (spectrum R a) := by cfc_cont_tac) : cfc (g ∘ f) a = cfc g (cfc f a) := by have := hg.comp hf <| (spectrum R a).mapsTo_image f have sp_eq : spectrum R (cfcHom (show p a from ha) (ContinuousMap.mk _ hf.restrict)) = f '' (spectrum R a) := by rw [cfcHom_map_spectrum (by exact ha) _] ext simp rw [cfc_apply .., cfc_apply f a, cfc_apply _ _ (cfcHom_predicate (show p a from ha) _) (by convert hg), ← cfcHom_comp _ _] swap · exact ContinuousMap.mk _ <| hf.restrict.codRestrict fun x ↦ by rw [sp_eq]; use x.1; simp · congr · exact fun _ ↦ rfl lemma cfc_comp' (g f : R → R) (a : A) (hg : ContinuousOn g (f '' spectrum R a) := by cfc_cont_tac) (hf : ContinuousOn f (spectrum R a) := by cfc_cont_tac) (ha : p a := by cfc_tac) : cfc (g <| f ·) a = cfc g (cfc f a) := cfc_comp g f a lemma cfc_comp_pow (f : R → R) (n : ℕ) (a : A) (hf : ContinuousOn f ((· ^ n) '' (spectrum R a)) := by cfc_cont_tac) (ha : p a := by cfc_tac) : cfc (f <| · ^ n) a = cfc f (a ^ n) := by rw [cfc_comp' .., cfc_pow_id ..] lemma cfc_comp_smul {S : Type*} [SMul S R] [ContinuousConstSMul S R] [SMulZeroClass S A] [IsScalarTower S R A] [IsScalarTower S R (R → R)] (s : S) (f : R → R) (a : A) (hf : ContinuousOn f ((s • ·) '' (spectrum R a)) := by cfc_cont_tac) (ha : p a := by cfc_tac) : cfc (f <| s • ·) a = cfc f (s • a) := by rw [cfc_comp' .., cfc_smul_id ..] lemma cfc_comp_const_mul (r : R) (f : R → R) (a : A) (hf : ContinuousOn f ((r * ·) '' (spectrum R a)) := by cfc_cont_tac) (ha : p a := by cfc_tac) : cfc (f <| r * ·) a = cfc f (r • a) := by rw [cfc_comp' .., cfc_const_mul_id ..] lemma cfc_comp_star (f : R → R) (a : A) (hf : ContinuousOn f (star '' (spectrum R a)) := by cfc_cont_tac) (ha : p a := by cfc_tac) : cfc (f <| star ·) a = cfc f (star a) := by rw [cfc_comp' .., cfc_star_id ..] open Polynomial in lemma cfc_comp_polynomial (q : R[X]) (f : R → R) (a : A) (hf : ContinuousOn f (q.eval '' (spectrum R a)) := by cfc_cont_tac) (ha : p a := by cfc_tac) : cfc (f <| q.eval ·) a = cfc f (aeval a q) := by rw [cfc_comp' .., cfc_polynomial ..] lemma CFC.spectrum_algebraMap_subset (r : R) : spectrum R (algebraMap R A r) ⊆ {r} := by rw [← cfc_const r 0 (cfc_predicate_zero R), cfc_map_spectrum (fun _ ↦ r) 0 (cfc_predicate_zero R)] rintro - ⟨x, -, rfl⟩ simp lemma CFC.spectrum_algebraMap_eq [Nontrivial A] (r : R) : spectrum R (algebraMap R A r) = {r} := by have hp : p 0 := cfc_predicate_zero R rw [← cfc_const r 0 hp, cfc_map_spectrum (fun _ => r) 0 hp] exact Set.Nonempty.image_const (⟨0, spectrum.zero_mem (R := R) not_isUnit_zero⟩) _ lemma CFC.spectrum_zero_eq [Nontrivial A] : spectrum R (0 : A) = {0} := by have : (0 : A) = algebraMap R A 0 := Eq.symm (RingHom.map_zero (algebraMap R A)) rw [this, spectrum_algebraMap_eq] lemma CFC.spectrum_one_eq [Nontrivial A] : spectrum R (1 : A) = {1} := by have : (1 : A) = algebraMap R A 1 := Eq.symm (RingHom.map_one (algebraMap R A)) rw [this, spectrum_algebraMap_eq] @[simp] lemma cfc_algebraMap (r : R) (f : R → R) : cfc f (algebraMap R A r) = algebraMap R A (f r) := by have h₁ : ContinuousOn f (spectrum R (algebraMap R A r)) := continuousOn_singleton _ _ |>.mono <| CFC.spectrum_algebraMap_subset r rw [cfc_apply f (algebraMap R A r) (cfc_predicate_algebraMap r), ← AlgHomClass.commutes (cfcHom (p := p) (cfc_predicate_algebraMap r)) (f r)] congr ext ⟨x, hx⟩ apply CFC.spectrum_algebraMap_subset r at hx simp_all @[simp] lemma cfc_apply_zero {f : R → R} : cfc f (0 : A) = algebraMap R A (f 0) := by simpa using cfc_algebraMap (A := A) 0 f @[simp] lemma cfc_apply_one {f : R → R} : cfc f (1 : A) = algebraMap R A (f 1) := by simpa using cfc_algebraMap (A := A) 1 f instance IsStarNormal.cfc_map (f : R → R) (a : A) : IsStarNormal (cfc f a) where star_comm_self := by rw [Commute, SemiconjBy] by_cases h : ContinuousOn f (spectrum R a) · rw [← cfc_star, ← cfc_mul .., ← cfc_mul ..] congr! 2 exact mul_comm _ _ · simp [cfc_apply_of_not_continuousOn a h] end CFC end Basic section Inv variable {R A : Type*} {p : A → Prop} [Semifield R] [StarRing R] [MetricSpace R] variable [TopologicalSemiring R] [ContinuousStar R] [TopologicalSpace A] variable [Ring A] [StarRing A] [Algebra R A] [ContinuousFunctionalCalculus R p] variable (f : R → R) (a : A) lemma isUnit_cfc_iff (hf : ContinuousOn f (spectrum R a) := by cfc_cont_tac) (ha : p a := by cfc_tac) : IsUnit (cfc f a) ↔ ∀ x ∈ spectrum R a, f x ≠ 0 := by rw [← spectrum.zero_not_mem_iff R, cfc_map_spectrum ..] aesop alias ⟨_, isUnit_cfc⟩ := isUnit_cfc_iff variable [HasContinuousInv₀ R] /-- Bundle `cfc f a` into a unit given a proof that `f` is nonzero on the spectrum of `a`. -/ @[simps] noncomputable def cfcUnits (hf' : ∀ x ∈ spectrum R a, f x ≠ 0) (hf : ContinuousOn f (spectrum R a) := by cfc_cont_tac) (ha : p a := by cfc_tac) : Aˣ where val := cfc f a inv := cfc (fun x ↦ (f x)⁻¹) a val_inv := by rw [← cfc_mul .., ← cfc_one R a] exact cfc_congr fun _ _ ↦ by aesop inv_val := by rw [← cfc_mul .., ← cfc_one R a] exact cfc_congr fun _ _ ↦ by aesop lemma cfcUnits_pow (hf' : ∀ x ∈ spectrum R a, f x ≠ 0) (n : ℕ) (hf : ContinuousOn f (spectrum R a) := by cfc_cont_tac) (ha : p a := by cfc_tac) : (cfcUnits f a hf') ^ n = cfcUnits (forall₂_imp (fun _ _ ↦ pow_ne_zero n) hf') (hf := hf.pow n) := by ext cases n with | zero => simp [cfc_const_one R a] | succ n => simp [cfc_pow f _ a] lemma cfc_inv (hf' : ∀ x ∈ spectrum R a, f x ≠ 0) (hf : ContinuousOn f (spectrum R a) := by cfc_cont_tac) (ha : p a := by cfc_tac) : cfc (fun x ↦ (f x) ⁻¹) a = Ring.inverse (cfc f a) := by rw [← val_inv_cfcUnits f a hf', ← val_cfcUnits f a hf', Ring.inverse_unit] lemma cfc_inv_id (a : Aˣ) (ha : p a := by cfc_tac) : cfc (fun x ↦ x⁻¹ : R → R) (a : A) = a⁻¹ := by rw [← Ring.inverse_unit] convert cfc_inv (id : R → R) (a : A) ?_ · exact (cfc_id R (a : A)).symm · rintro x hx rfl exact spectrum.zero_not_mem R a.isUnit hx lemma cfc_map_div (f g : R → R) (a : A) (hg' : ∀ x ∈ spectrum R a, g x ≠ 0) (hf : ContinuousOn f (spectrum R a) := by cfc_cont_tac) (hg : ContinuousOn g (spectrum R a) := by cfc_cont_tac) (ha : p a := by cfc_tac) : cfc (fun x ↦ f x / g x) a = cfc f a * Ring.inverse (cfc g a) := by simp only [div_eq_mul_inv] rw [cfc_mul .., cfc_inv g a hg'] variable [UniqueContinuousFunctionalCalculus R A] @[fun_prop] lemma Units.continuousOn_inv₀_spectrum (a : Aˣ) : ContinuousOn (· ⁻¹) (spectrum R (a : A)) := continuousOn_inv₀.mono <| by simpa only [Set.subset_compl_singleton_iff] using spectrum.zero_not_mem R a.isUnit @[fun_prop] lemma Units.continuousOn_zpow₀_spectrum (a : Aˣ) (n : ℤ) : ContinuousOn (· ^ n) (spectrum R (a : A)) := (continuousOn_zpow₀ n).mono <| by simpa only [Set.subset_compl_singleton_iff] using spectrum.zero_not_mem R a.isUnit lemma cfc_comp_inv (f : R → R) (a : Aˣ) (hf : ContinuousOn f ((· ⁻¹) '' (spectrum R (a : A))) := by cfc_cont_tac) (ha : p a := by cfc_tac) : cfc (fun x ↦ f x⁻¹) (a : A) = cfc f (↑a⁻¹ : A) := by rw [cfc_comp' .., cfc_inv_id _] lemma cfcUnits_zpow (hf' : ∀ x ∈ spectrum R a, f x ≠ 0) (n : ℤ) (hf : ContinuousOn f (spectrum R a) := by cfc_cont_tac) (ha : p a := by cfc_tac) : (cfcUnits f a hf') ^ n = cfcUnits (f ^ n) a (forall₂_imp (fun _ _ ↦ zpow_ne_zero n) hf') (hf.zpow₀ n (forall₂_imp (fun _ _ ↦ Or.inl) hf')) := by cases n with | ofNat _ => simpa using cfcUnits_pow f a hf' _ | negSucc n => simp only [zpow_negSucc, ← inv_pow] ext exact cfc_pow (hf := hf.inv₀ hf') _ |>.symm lemma cfc_zpow (a : Aˣ) (n : ℤ) (ha : p a := by cfc_tac) : cfc (fun x : R ↦ x ^ n) (a : A) = ↑(a ^ n) := by cases n with | ofNat n => simpa using cfc_pow_id (a : A) n | negSucc n => simp only [zpow_negSucc, ← inv_pow, Units.val_pow_eq_pow_val] have := cfc_pow (fun x ↦ x⁻¹ : R → R) (n + 1) (a : A) exact this.trans <| congr($(cfc_inv_id a) ^ (n + 1)) lemma cfc_comp_zpow (f : R → R) (n : ℤ) (a : Aˣ) (hf : ContinuousOn f ((· ^ n) '' (spectrum R (a : A))) := by cfc_cont_tac) (ha : p a := by cfc_tac) : cfc (fun x ↦ f (x ^ n)) (a : A) = cfc f (↑(a ^ n) : A) := by rw [cfc_comp' .., cfc_zpow a] end Inv section Neg variable {R A : Type*} {p : A → Prop} [CommRing R] [StarRing R] [MetricSpace R] variable [TopologicalRing R] [ContinuousStar R] [TopologicalSpace A] variable [Ring A] [StarRing A] [Algebra R A] [ContinuousFunctionalCalculus R p] variable (f g : R → R) (a : A) (hf : ContinuousOn f (spectrum R a) := by cfc_cont_tac) variable (hg : ContinuousOn g (spectrum R a) := by cfc_cont_tac) lemma cfc_sub : cfc (fun x ↦ f x - g x) a = cfc f a - cfc g a := by by_cases ha : p a · rw [cfc_apply f a, cfc_apply g a, ← map_sub, cfc_apply ..] congr · simp [cfc_apply_of_not_predicate a ha] lemma cfc_neg : cfc (fun x ↦ - (f x)) a = - (cfc f a) := by by_cases h : p a ∧ ContinuousOn f (spectrum R a) · obtain ⟨ha, hf⟩ := h rw [cfc_apply f a, ← map_neg, cfc_apply ..] congr · obtain (ha | hf) := not_and_or.mp h · simp [cfc_apply_of_not_predicate a ha] · rw [cfc_apply_of_not_continuousOn a hf, cfc_apply_of_not_continuousOn, neg_zero] exact fun hf_neg ↦ hf <| by simpa using hf_neg.neg lemma cfc_neg_id (ha : p a := by cfc_tac) : cfc (- · : R → R) a = -a := by rw [cfc_neg _ a, cfc_id' R a] variable [UniqueContinuousFunctionalCalculus R A] lemma cfc_comp_neg (hf : ContinuousOn f ((- ·) '' (spectrum R (a : A))) := by cfc_cont_tac) (ha : p a := by cfc_tac) : cfc (f <| - ·) a = cfc f (-a) := by rw [cfc_comp' .., cfc_neg_id _] end Neg section Order section Semiring variable {R A : Type*} {p : A → Prop} [OrderedCommSemiring R] [StarRing R] variable [StarOrderedRing R] [MetricSpace R] [TopologicalSemiring R] [ContinuousStar R] variable [∀ (α) [TopologicalSpace α], StarOrderedRing C(α, R)] variable [TopologicalSpace A] [Ring A] [StarRing A] [PartialOrder A] [StarOrderedRing A] variable [Algebra R A] [StarModule R A] [ContinuousFunctionalCalculus R p] variable [NonnegSpectrumClass R A] lemma cfcHom_mono {a : A} (ha : p a) {f g : C(spectrum R a, R)} (hfg : f ≤ g) : cfcHom ha f ≤ cfcHom ha g := OrderHomClass.mono (cfcHom ha) hfg lemma cfcHom_nonneg_iff {a : A} (ha : p a) {f : C(spectrum R a, R)} : 0 ≤ cfcHom ha f ↔ 0 ≤ f := by constructor · exact fun hf x ↦ (cfcHom_map_spectrum ha (R := R) _ ▸ spectrum_nonneg_of_nonneg hf) ⟨x, rfl⟩ · simpa using (cfcHom_mono ha (f := 0) (g := f) ·) lemma cfc_mono {f g : R → R} {a : A} (h : ∀ x ∈ spectrum R a, f x ≤ g x) (hf : ContinuousOn f (spectrum R a) := by cfc_cont_tac) (hg : ContinuousOn g (spectrum R a) := by cfc_cont_tac) : cfc f a ≤ cfc g a := by by_cases ha : p a · rw [cfc_apply f a, cfc_apply g a] exact cfcHom_mono ha fun x ↦ h x.1 x.2 · simp only [cfc_apply_of_not_predicate _ ha, le_rfl] lemma cfc_nonneg_iff (f : R → R) (a : A) (hf : ContinuousOn f (spectrum R a) := by cfc_cont_tac) (ha : p a := by cfc_tac) : 0 ≤ cfc f a ↔ ∀ x ∈ spectrum R a, 0 ≤ f x := by rw [cfc_apply .., cfcHom_nonneg_iff, ContinuousMap.le_def] simp lemma StarOrderedRing.nonneg_iff_spectrum_nonneg (a : A) (ha : p a := by cfc_tac) : 0 ≤ a ↔ ∀ x ∈ spectrum R a, 0 ≤ x := by have := cfc_nonneg_iff (id : R → R) a (by fun_prop) ha simpa [cfc_id _ a ha] using this lemma cfc_nonneg {f : R → R} {a : A} (h : ∀ x ∈ spectrum R a, 0 ≤ f x) : 0 ≤ cfc f a := by by_cases hf : ContinuousOn f (spectrum R a) · simpa using cfc_mono h · simp only [cfc_apply_of_not_continuousOn _ hf, le_rfl] lemma cfc_nonpos (f : R → R) (a : A) (h : ∀ x ∈ spectrum R a, f x ≤ 0) : cfc f a ≤ 0 := by by_cases hf : ContinuousOn f (spectrum R a) · simpa using cfc_mono h · simp only [cfc_apply_of_not_continuousOn _ hf, le_rfl] lemma cfc_le_algebraMap (f : R → R) (r : R) (a : A) (h : ∀ x ∈ spectrum R a, f x ≤ r) (hf : ContinuousOn f (spectrum R a) := by cfc_cont_tac) (ha : p a := by cfc_tac) : cfc f a ≤ algebraMap R A r := cfc_const r a ▸ cfc_mono h lemma algebraMap_le_cfc (f : R → R) (r : R) (a : A) (h : ∀ x ∈ spectrum R a, r ≤ f x) (hf : ContinuousOn f (spectrum R a) := by cfc_cont_tac) (ha : p a := by cfc_tac) : algebraMap R A r ≤ cfc f a := cfc_const r a ▸ cfc_mono h lemma le_algebraMap_of_spectrum_le {r : R} {a : A} (h : ∀ x ∈ spectrum R a, x ≤ r) (ha : p a := by cfc_tac) : a ≤ algebraMap R A r := by rw [← cfc_id R a] exact cfc_le_algebraMap id r a h lemma algebraMap_le_of_le_spectrum {r : R} {a : A} (h : ∀ x ∈ spectrum R a, r ≤ x) (ha : p a := by cfc_tac) : algebraMap R A r ≤ a := by rw [← cfc_id R a] exact algebraMap_le_cfc id r a h lemma cfc_le_one (f : R → R) (a : A) (h : ∀ x ∈ spectrum R a, f x ≤ 1) : cfc f a ≤ 1 := by apply cfc_cases (· ≤ 1) _ _ (by simp) fun hf ha ↦ ?_ rw [← map_one (cfcHom ha (R := R))] apply cfcHom_mono ha simpa [ContinuousMap.le_def] using h lemma one_le_cfc (f : R → R) (a : A) (h : ∀ x ∈ spectrum R a, 1 ≤ f x) (hf : ContinuousOn f (spectrum R a) := by cfc_cont_tac) (ha : p a := by cfc_tac) : 1 ≤ cfc f a := by simpa using algebraMap_le_cfc f 1 a h end Semiring section Ring variable {R A : Type*} {p : A → Prop} [OrderedCommRing R] [StarRing R] variable [MetricSpace R] [TopologicalRing R] [ContinuousStar R] variable [∀ (α) [TopologicalSpace α], StarOrderedRing C(α, R)] variable [TopologicalSpace A] [Ring A] [StarRing A] [PartialOrder A] [StarOrderedRing A] variable [Algebra R A] [StarModule R A] [ContinuousFunctionalCalculus R p] variable [NonnegSpectrumClass R A] lemma cfcHom_le_iff {a : A} (ha : p a) {f g : C(spectrum R a, R)} : cfcHom ha f ≤ cfcHom ha g ↔ f ≤ g := by rw [← sub_nonneg, ← map_sub, cfcHom_nonneg_iff, sub_nonneg] lemma cfc_le_iff (f g : R → R) (a : A) (hf : ContinuousOn f (spectrum R a) := by cfc_cont_tac) (hg : ContinuousOn g (spectrum R a) := by cfc_cont_tac) (ha : p a := by cfc_tac) : cfc f a ≤ cfc g a ↔ ∀ x ∈ spectrum R a, f x ≤ g x := by rw [cfc_apply f a, cfc_apply g a, cfcHom_le_iff (show p a from ha), ContinuousMap.le_def] simp lemma cfc_nonpos_iff (f : R → R) (a : A) (hf : ContinuousOn f (spectrum R a) := by cfc_cont_tac) (ha : p a := by cfc_tac) : cfc f a ≤ 0 ↔ ∀ x ∈ spectrum R a, f x ≤ 0 := by simp_rw [← neg_nonneg, ← cfc_neg] exact cfc_nonneg_iff (fun x ↦ -f x) a end Ring end Order
Analysis\CStarAlgebra\ContinuousFunctionalCalculus\Unitary.lean
/- Copyright (c) 2024 Jireh Loreaux. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Jireh Loreaux -/ import Mathlib.Tactic.Peel import Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital import Mathlib.Analysis.Complex.Basic /-! # Conditions on unitary elements imposed by the continuous functional calculus ## Main theorems * `unitary_iff_isStarNormal_and_spectrum_subset_unitary`: An element is unitary if and only if it is star-normal and its spectrum lies on the unit circle. -/ section Generic variable {R A : Type*} {p : A → Prop} [CommRing R] [StarRing R] [MetricSpace R] variable [TopologicalRing R] [ContinuousStar R] [TopologicalSpace A] [Ring A] [StarRing A] variable [Algebra R A] [StarModule R A] [ContinuousFunctionalCalculus R p] lemma cfc_unitary_iff (f : R → R) (a : A) (ha : p a := by cfc_tac) (hf : ContinuousOn f (spectrum R a) := by cfc_cont_tac) : cfc f a ∈ unitary A ↔ ∀ x ∈ spectrum R a, star (f x) * f x = 1 := by simp only [unitary, Submonoid.mem_mk, Subsemigroup.mem_mk, Set.mem_setOf_eq] rw [← IsStarNormal.cfc_map (p := p) f a |>.star_comm_self |>.eq, and_self, ← cfc_one R a, ← cfc_star, ← cfc_mul .., cfc_eq_cfc_iff_eqOn] exact Iff.rfl end Generic section Complex variable {A : Type*} [TopologicalSpace A] [Ring A] [StarRing A] [Algebra ℂ A] [StarModule ℂ A] [ContinuousFunctionalCalculus ℂ (IsStarNormal : A → Prop)] lemma unitary_iff_isStarNormal_and_spectrum_subset_unitary {u : A} : u ∈ unitary A ↔ IsStarNormal u ∧ spectrum ℂ u ⊆ unitary ℂ := by rw [← and_iff_right_of_imp isStarNormal_of_mem_unitary] refine and_congr_right fun hu ↦ ?_ nth_rw 1 [← cfc_id ℂ u] rw [cfc_unitary_iff id u, Set.subset_def] congr! with x - simp [unitary.mem_iff_star_mul_self] lemma mem_unitary_of_spectrum_subset_unitary {u : A} [IsStarNormal u] (hu : spectrum ℂ u ⊆ unitary ℂ) : u ∈ unitary A := unitary_iff_isStarNormal_and_spectrum_subset_unitary.mpr ⟨‹_›, hu⟩ lemma spectrum_subset_unitary_of_mem_unitary {u : A} (hu : u ∈ unitary A) : spectrum ℂ u ⊆ unitary ℂ := unitary_iff_isStarNormal_and_spectrum_subset_unitary.mp hu |>.right end Complex
Analysis\Distribution\AEEqOfIntegralContDiff.lean
/- Copyright (c) 2023 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Geometry.Manifold.PartitionOfUnity import Mathlib.Geometry.Manifold.Metrizable import Mathlib.MeasureTheory.Function.AEEqOfIntegral /-! # Functions which vanish as distributions vanish as functions In a finite dimensional normed real vector space endowed with a Borel measure, consider a locally integrable function whose integral against all compactly supported smooth functions vanishes. Then the function is almost everywhere zero. This is proved in `ae_eq_zero_of_integral_contDiff_smul_eq_zero`. A version for two functions having the same integral when multiplied by smooth compactly supported functions is also given in `ae_eq_of_integral_contDiff_smul_eq`. These are deduced from the same results on finite-dimensional real manifolds, given respectively as `ae_eq_zero_of_integral_smooth_smul_eq_zero` and `ae_eq_of_integral_smooth_smul_eq`. -/ open MeasureTheory Filter Metric Function Set TopologicalSpace open scoped Topology Manifold variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] section Manifold variable {H : Type*} [TopologicalSpace H] (I : ModelWithCorners ℝ E H) {M : Type*} [TopologicalSpace M] [ChartedSpace H M] [SmoothManifoldWithCorners I M] [MeasurableSpace M] [BorelSpace M] [SigmaCompactSpace M] [T2Space M] {f f' : M → F} {μ : Measure M} /-- If a locally integrable function `f` on a finite-dimensional real manifold has zero integral when multiplied by any smooth compactly supported function, then `f` vanishes almost everywhere. -/ theorem ae_eq_zero_of_integral_smooth_smul_eq_zero (hf : LocallyIntegrable f μ) (h : ∀ g : M → ℝ, Smooth I 𝓘(ℝ) g → HasCompactSupport g → ∫ x, g x • f x ∂μ = 0) : ∀ᵐ x ∂μ, f x = 0 := by -- record topological properties of `M` have := I.locallyCompactSpace have := ChartedSpace.locallyCompactSpace H M have := I.secondCountableTopology have := ChartedSpace.secondCountable_of_sigma_compact H M have := ManifoldWithCorners.metrizableSpace I M let _ : MetricSpace M := TopologicalSpace.metrizableSpaceMetric M -- it suffices to show that the integral of the function vanishes on any compact set `s` apply ae_eq_zero_of_forall_setIntegral_isCompact_eq_zero' hf (fun s hs ↦ Eq.symm ?_) obtain ⟨δ, δpos, hδ⟩ : ∃ δ, 0 < δ ∧ IsCompact (cthickening δ s) := hs.exists_isCompact_cthickening -- choose a sequence of smooth functions `gₙ` equal to `1` on `s` and vanishing outside of the -- `uₙ`-neighborhood of `s`, where `uₙ` tends to zero. Then each integral `∫ gₙ f` vanishes, -- and by dominated convergence these integrals converge to `∫ x in s, f`. obtain ⟨u, -, u_pos, u_lim⟩ : ∃ u, StrictAnti u ∧ (∀ (n : ℕ), u n ∈ Ioo 0 δ) ∧ Tendsto u atTop (𝓝 0) := exists_seq_strictAnti_tendsto' δpos let v : ℕ → Set M := fun n ↦ thickening (u n) s obtain ⟨K, K_compact, vK⟩ : ∃ K, IsCompact K ∧ ∀ n, v n ⊆ K := ⟨_, hδ, fun n ↦ thickening_subset_cthickening_of_le (u_pos n).2.le _⟩ have : ∀ n, ∃ (g : M → ℝ), support g = v n ∧ Smooth I 𝓘(ℝ) g ∧ Set.range g ⊆ Set.Icc 0 1 ∧ ∀ x ∈ s, g x = 1 := by intro n rcases exists_msmooth_support_eq_eq_one_iff I isOpen_thickening hs.isClosed (self_subset_thickening (u_pos n).1 s) with ⟨g, g_smooth, g_range, g_supp, hg⟩ exact ⟨g, g_supp, g_smooth, g_range, fun x hx ↦ (hg x).1 hx⟩ choose g g_supp g_diff g_range hg using this -- main fact: the integral of `∫ gₙ f` tends to `∫ x in s, f`. have L : Tendsto (fun n ↦ ∫ x, g n x • f x ∂μ) atTop (𝓝 (∫ x in s, f x ∂μ)) := by rw [← integral_indicator hs.measurableSet] let bound : M → ℝ := K.indicator (fun x ↦ ‖f x‖) have A : ∀ n, AEStronglyMeasurable (fun x ↦ g n x • f x) μ := fun n ↦ (g_diff n).continuous.aestronglyMeasurable.smul hf.aestronglyMeasurable have B : Integrable bound μ := by rw [integrable_indicator_iff K_compact.measurableSet] exact (hf.integrableOn_isCompact K_compact).norm have C : ∀ n, ∀ᵐ x ∂μ, ‖g n x • f x‖ ≤ bound x := by intro n filter_upwards with x rw [norm_smul] refine le_indicator_apply (fun _ ↦ ?_) (fun hxK ↦ ?_) · have : ‖g n x‖ ≤ 1 := by have := g_range n (mem_range_self (f := g n) x) rw [Real.norm_of_nonneg this.1] exact this.2 exact mul_le_of_le_one_left (norm_nonneg _) this · have : g n x = 0 := by rw [← nmem_support, g_supp]; contrapose! hxK; exact vK n hxK simp [this] have D : ∀ᵐ x ∂μ, Tendsto (fun n => g n x • f x) atTop (𝓝 (s.indicator f x)) := by filter_upwards with x by_cases hxs : x ∈ s · have : ∀ n, g n x = 1 := fun n ↦ hg n x hxs simp [this, indicator_of_mem hxs f] · simp_rw [indicator_of_not_mem hxs f] apply tendsto_const_nhds.congr' suffices H : ∀ᶠ n in atTop, g n x = 0 by filter_upwards [H] with n hn using by simp [hn] obtain ⟨ε, εpos, hε⟩ : ∃ ε, 0 < ε ∧ x ∉ thickening ε s := by rw [← hs.isClosed.closure_eq, closure_eq_iInter_thickening s] at hxs simpa using hxs filter_upwards [(tendsto_order.1 u_lim).2 _ εpos] with n hn rw [← nmem_support, g_supp] contrapose! hε exact thickening_mono hn.le s hε exact tendsto_integral_of_dominated_convergence bound A B C D -- deduce that `∫ x in s, f = 0` as each integral `∫ gₙ f` vanishes by assumption have : ∀ n, ∫ x, g n x • f x ∂μ = 0 := by refine fun n ↦ h _ (g_diff n) ?_ apply HasCompactSupport.of_support_subset_isCompact K_compact simpa [g_supp] using vK n simpa [this] using L /-- If a function `f` locally integrable on an open subset `U` of a finite-dimensional real manifold has zero integral when multiplied by any smooth function compactly supported in `U`, then `f` vanishes almost everywhere in `U`. -/ nonrec theorem IsOpen.ae_eq_zero_of_integral_smooth_smul_eq_zero' {U : Set M} (hU : IsOpen U) (hSig : IsSigmaCompact U) (hf : LocallyIntegrableOn f U μ) (h : ∀ g : M → ℝ, Smooth I 𝓘(ℝ) g → HasCompactSupport g → tsupport g ⊆ U → ∫ x, g x • f x ∂μ = 0) : ∀ᵐ x ∂μ, x ∈ U → f x = 0 := by have meas_U := hU.measurableSet rw [← ae_restrict_iff' meas_U, ae_restrict_iff_subtype meas_U] let U : Opens M := ⟨U, hU⟩ change ∀ᵐ (x : U) ∂_, _ haveI : SigmaCompactSpace U := isSigmaCompact_iff_sigmaCompactSpace.mp hSig refine ae_eq_zero_of_integral_smooth_smul_eq_zero I ?_ fun g g_smth g_supp ↦ ?_ · exact (locallyIntegrable_comap meas_U).mpr hf specialize h (Subtype.val.extend g 0) (g_smth.extend_zero g_supp) (g_supp.extend_zero continuous_subtype_val) ((g_supp.tsupport_extend_zero_subset continuous_subtype_val).trans <| Subtype.coe_image_subset _ _) rw [← setIntegral_eq_integral_of_forall_compl_eq_zero (s := U) fun x hx ↦ ?_] at h · rw [← integral_subtype_comap] at h · simp_rw [Subtype.val_injective.extend_apply] at h; exact h · exact meas_U rw [Function.extend_apply' _ _ _ (mt _ hx)] · apply zero_smul · rintro ⟨x, rfl⟩; exact x.2 theorem IsOpen.ae_eq_zero_of_integral_smooth_smul_eq_zero {U : Set M} (hU : IsOpen U) (hf : LocallyIntegrableOn f U μ) (h : ∀ g : M → ℝ, Smooth I 𝓘(ℝ) g → HasCompactSupport g → tsupport g ⊆ U → ∫ x, g x • f x ∂μ = 0) : ∀ᵐ x ∂μ, x ∈ U → f x = 0 := haveI := I.locallyCompactSpace haveI := ChartedSpace.locallyCompactSpace H M haveI := hU.locallyCompactSpace haveI := I.secondCountableTopology haveI := ChartedSpace.secondCountable_of_sigma_compact H M hU.ae_eq_zero_of_integral_smooth_smul_eq_zero' _ (isSigmaCompact_iff_sigmaCompactSpace.mpr inferInstance) hf h /-- If two locally integrable functions on a finite-dimensional real manifold have the same integral when multiplied by any smooth compactly supported function, then they coincide almost everywhere. -/ theorem ae_eq_of_integral_smooth_smul_eq (hf : LocallyIntegrable f μ) (hf' : LocallyIntegrable f' μ) (h : ∀ (g : M → ℝ), Smooth I 𝓘(ℝ) g → HasCompactSupport g → ∫ x, g x • f x ∂μ = ∫ x, g x • f' x ∂μ) : ∀ᵐ x ∂μ, f x = f' x := by have : ∀ᵐ x ∂μ, (f - f') x = 0 := by apply ae_eq_zero_of_integral_smooth_smul_eq_zero I (hf.sub hf') intro g g_diff g_supp simp only [Pi.sub_apply, smul_sub] rw [integral_sub, sub_eq_zero] · exact h g g_diff g_supp · exact hf.integrable_smul_left_of_hasCompactSupport g_diff.continuous g_supp · exact hf'.integrable_smul_left_of_hasCompactSupport g_diff.continuous g_supp filter_upwards [this] with x hx simpa [sub_eq_zero] using hx end Manifold section VectorSpace variable [MeasurableSpace E] [BorelSpace E] {f f' : E → F} {μ : Measure E} /-- If a locally integrable function `f` on a finite-dimensional real vector space has zero integral when multiplied by any smooth compactly supported function, then `f` vanishes almost everywhere. -/ theorem ae_eq_zero_of_integral_contDiff_smul_eq_zero (hf : LocallyIntegrable f μ) (h : ∀ (g : E → ℝ), ContDiff ℝ ⊤ g → HasCompactSupport g → ∫ x, g x • f x ∂μ = 0) : ∀ᵐ x ∂μ, f x = 0 := ae_eq_zero_of_integral_smooth_smul_eq_zero 𝓘(ℝ, E) hf (fun g g_diff g_supp ↦ h g g_diff.contDiff g_supp) /-- If two locally integrable functions on a finite-dimensional real vector space have the same integral when multiplied by any smooth compactly supported function, then they coincide almost everywhere. -/ theorem ae_eq_of_integral_contDiff_smul_eq (hf : LocallyIntegrable f μ) (hf' : LocallyIntegrable f' μ) (h : ∀ (g : E → ℝ), ContDiff ℝ ⊤ g → HasCompactSupport g → ∫ x, g x • f x ∂μ = ∫ x, g x • f' x ∂μ) : ∀ᵐ x ∂μ, f x = f' x := ae_eq_of_integral_smooth_smul_eq 𝓘(ℝ, E) hf hf' (fun g g_diff g_supp ↦ h g g_diff.contDiff g_supp) /-- If a function `f` locally integrable on an open subset `U` of a finite-dimensional real manifold has zero integral when multiplied by any smooth function compactly supported in an open set `U`, then `f` vanishes almost everywhere in `U`. -/ theorem IsOpen.ae_eq_zero_of_integral_contDiff_smul_eq_zero {U : Set E} (hU : IsOpen U) (hf : LocallyIntegrableOn f U μ) (h : ∀ (g : E → ℝ), ContDiff ℝ ⊤ g → HasCompactSupport g → tsupport g ⊆ U → ∫ x, g x • f x ∂μ = 0) : ∀ᵐ x ∂μ, x ∈ U → f x = 0 := hU.ae_eq_zero_of_integral_smooth_smul_eq_zero 𝓘(ℝ, E) hf (fun g g_diff g_supp ↦ h g g_diff.contDiff g_supp) end VectorSpace
Analysis\Distribution\FourierSchwartz.lean
/- Copyright (c) 2024 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Analysis.Distribution.SchwartzSpace import Mathlib.Analysis.Fourier.FourierTransformDeriv import Mathlib.Analysis.Fourier.Inversion /-! # Fourier transform on Schwartz functions This file constructs the Fourier transform as a continuous linear map acting on Schwartz functions, in `fourierTransformCLM`. It is also given as a continuous linear equiv, in `fourierTransformCLE`. -/ open Real MeasureTheory MeasureTheory.Measure open scoped FourierTransform namespace SchwartzMap variable (𝕜 : Type*) [RCLike 𝕜] {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] [NormedSpace 𝕜 E] [SMulCommClass ℂ 𝕜 E] {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] [FiniteDimensional ℝ V] [MeasurableSpace V] [BorelSpace V] /-- The Fourier transform on a real inner product space, as a continuous linear map on the Schwartz space. -/ noncomputable def fourierTransformCLM : 𝓢(V, E) →L[𝕜] 𝓢(V, E) := by refine mkCLM (fun (f : V → E) ↦ 𝓕 f) ?_ ?_ ?_ ?_ · intro f g x simp only [fourierIntegral_eq, Pi.add_apply, smul_add] rw [integral_add] · exact (fourierIntegral_convergent_iff _).2 f.integrable · exact (fourierIntegral_convergent_iff _).2 g.integrable · intro c f x simp only [fourierIntegral_eq, Pi.smul_apply, RingHom.id_apply, smul_comm _ c, integral_smul] · intro f exact Real.contDiff_fourierIntegral (fun n _ ↦ integrable_pow_mul volume f n) · rintro ⟨k, n⟩ refine ⟨Finset.range (n + integrablePower (volume : Measure V) + 1) ×ˢ Finset.range (k + 1), (2 * π) ^ n * (2 * ↑n + 2) ^ k * (Finset.range (n + 1) ×ˢ Finset.range (k + 1)).card * 2 ^ integrablePower (volume : Measure V) * (∫ (x : V), (1 + ‖x‖) ^ (- (integrablePower (volume : Measure V) : ℝ))) * 2, ⟨by positivity, fun f x ↦ ?_⟩⟩ apply (pow_mul_norm_iteratedFDeriv_fourierIntegral_le (f.smooth ⊤) (fun k n _hk _hn ↦ integrable_pow_mul_iteratedFDeriv _ f k n) le_top le_top x).trans simp only [mul_assoc] gcongr calc ∑ p in Finset.range (n + 1) ×ˢ Finset.range (k + 1), ∫ (v : V), ‖v‖ ^ p.1 * ‖iteratedFDeriv ℝ p.2 (⇑f) v‖ ≤ ∑ p in Finset.range (n + 1) ×ˢ Finset.range (k + 1), 2 ^ integrablePower (volume : Measure V) * (∫ (x : V), (1 + ‖x‖) ^ (- (integrablePower (volume : Measure V) : ℝ))) * 2 * ((Finset.range (n + integrablePower (volume : Measure V) + 1) ×ˢ Finset.range (k + 1)).sup (schwartzSeminormFamily 𝕜 V E)) f := by apply Finset.sum_le_sum (fun p hp ↦ ?_) simp only [Finset.mem_product, Finset.mem_range] at hp apply (f.integral_pow_mul_iteratedFDeriv_le 𝕜 _ _ _).trans simp only [mul_assoc] rw [two_mul] gcongr · apply Seminorm.le_def.1 have : (0, p.2) ∈ (Finset.range (n + integrablePower (volume : Measure V) + 1) ×ˢ Finset.range (k + 1)) := by simp [hp.2] apply Finset.le_sup this (f := fun p ↦ SchwartzMap.seminorm 𝕜 p.1 p.2 (E := V) (F := E)) · apply Seminorm.le_def.1 have : (p.1 + integrablePower (volume : Measure V), p.2) ∈ (Finset.range (n + integrablePower (volume : Measure V) + 1) ×ˢ Finset.range (k + 1)) := by simp [hp.2] linarith apply Finset.le_sup this (f := fun p ↦ SchwartzMap.seminorm 𝕜 p.1 p.2 (E := V) (F := E)) _ = _ := by simp [mul_assoc] @[simp] lemma fourierTransformCLM_apply (f : 𝓢(V, E)) : fourierTransformCLM 𝕜 f = 𝓕 f := rfl variable [CompleteSpace E] /-- The Fourier transform on a real inner product space, as a continuous linear equiv on the Schwartz space. -/ noncomputable def fourierTransformCLE : 𝓢(V, E) ≃L[𝕜] 𝓢(V, E) where __ := fourierTransformCLM 𝕜 invFun := (compCLMOfContinuousLinearEquiv 𝕜 (LinearIsometryEquiv.neg ℝ (E := V))) ∘L (fourierTransformCLM 𝕜) left_inv := by intro f ext x change 𝓕 (𝓕 f) (-x) = f x rw [← fourierIntegralInv_eq_fourierIntegral_neg, Continuous.fourier_inversion f.continuous f.integrable (fourierTransformCLM 𝕜 f).integrable] right_inv := by intro f ext x change 𝓕 (fun x ↦ (𝓕 f) (-x)) x = f x simp_rw [← fourierIntegralInv_eq_fourierIntegral_neg, Continuous.fourier_inversion_inv f.continuous f.integrable (fourierTransformCLM 𝕜 f).integrable] continuous_invFun := ContinuousLinearMap.continuous _ @[simp] lemma fourierTransformCLE_apply (f : 𝓢(V, E)) : fourierTransformCLE 𝕜 f = 𝓕 f := rfl @[simp] lemma fourierTransformCLE_symm_apply (f : 𝓢(V, E)) : (fourierTransformCLE 𝕜).symm f = 𝓕⁻ f := by ext x exact (fourierIntegralInv_eq_fourierIntegral_neg f x).symm end SchwartzMap
Analysis\Distribution\SchwartzSpace.lean
/- Copyright (c) 2022 Moritz Doll. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Moritz Doll -/ import Mathlib.Analysis.Calculus.ContDiff.Bounds import Mathlib.Analysis.Calculus.IteratedDeriv.Defs import Mathlib.Analysis.Calculus.LineDeriv.Basic import Mathlib.Analysis.LocallyConvex.WithSeminorms import Mathlib.Analysis.Normed.Group.ZeroAtInfty import Mathlib.Analysis.SpecialFunctions.Pow.Real import Mathlib.Analysis.SpecialFunctions.JapaneseBracket import Mathlib.Topology.Algebra.UniformFilterBasis import Mathlib.Tactic.MoveAdd /-! # Schwartz space This file defines the Schwartz space. Usually, the Schwartz space is defined as the set of smooth functions $f : ℝ^n → ℂ$ such that there exists $C_{αβ} > 0$ with $$|x^α ∂^β f(x)| < C_{αβ}$$ for all $x ∈ ℝ^n$ and for all multiindices $α, β$. In mathlib, we use a slightly different approach and define the Schwartz space as all smooth functions `f : E → F`, where `E` and `F` are real normed vector spaces such that for all natural numbers `k` and `n` we have uniform bounds `‖x‖^k * ‖iteratedFDeriv ℝ n f x‖ < C`. This approach completely avoids using partial derivatives as well as polynomials. We construct the topology on the Schwartz space by a family of seminorms, which are the best constants in the above estimates. The abstract theory of topological vector spaces developed in `SeminormFamily.moduleFilterBasis` and `WithSeminorms.toLocallyConvexSpace` turns the Schwartz space into a locally convex topological vector space. ## Main definitions * `SchwartzMap`: The Schwartz space is the space of smooth functions such that all derivatives decay faster than any power of `‖x‖`. * `SchwartzMap.seminorm`: The family of seminorms as described above * `SchwartzMap.fderivCLM`: The differential as a continuous linear map `𝓢(E, F) →L[𝕜] 𝓢(E, E →L[ℝ] F)` * `SchwartzMap.derivCLM`: The one-dimensional derivative as a continuous linear map `𝓢(ℝ, F) →L[𝕜] 𝓢(ℝ, F)` * `SchwartzMap.integralCLM`: Integration as a continuous linear map `𝓢(ℝ, F) →L[ℝ] F` ## Main statements * `SchwartzMap.instUniformAddGroup` and `SchwartzMap.instLocallyConvexSpace`: The Schwartz space is a locally convex topological vector space. * `SchwartzMap.one_add_le_sup_seminorm_apply`: For a Schwartz function `f` there is a uniform bound on `(1 + ‖x‖) ^ k * ‖iteratedFDeriv ℝ n f x‖`. ## Implementation details The implementation of the seminorms is taken almost literally from `ContinuousLinearMap.opNorm`. ## Notation * `𝓢(E, F)`: The Schwartz space `SchwartzMap E F` localized in `SchwartzSpace` ## Tags Schwartz space, tempered distributions -/ noncomputable section open scoped Nat NNReal variable {𝕜 𝕜' D E F G V : Type*} variable [NormedAddCommGroup E] [NormedSpace ℝ E] variable [NormedAddCommGroup F] [NormedSpace ℝ F] variable (E F) /-- A function is a Schwartz function if it is smooth and all derivatives decay faster than any power of `‖x‖`. -/ structure SchwartzMap where toFun : E → F smooth' : ContDiff ℝ ⊤ toFun decay' : ∀ k n : ℕ, ∃ C : ℝ, ∀ x, ‖x‖ ^ k * ‖iteratedFDeriv ℝ n toFun x‖ ≤ C /-- A function is a Schwartz function if it is smooth and all derivatives decay faster than any power of `‖x‖`. -/ scoped[SchwartzMap] notation "𝓢(" E ", " F ")" => SchwartzMap E F variable {E F} namespace SchwartzMap -- Porting note: removed -- instance : Coe 𝓢(E, F) (E → F) := ⟨toFun⟩ instance instFunLike : FunLike 𝓢(E, F) E F where coe f := f.toFun coe_injective' f g h := by cases f; cases g; congr /-- Helper instance for when there's too many metavariables to apply `DFunLike.hasCoeToFun`. -/ instance instCoeFun : CoeFun 𝓢(E, F) fun _ => E → F := DFunLike.hasCoeToFun /-- All derivatives of a Schwartz function are rapidly decaying. -/ theorem decay (f : 𝓢(E, F)) (k n : ℕ) : ∃ C : ℝ, 0 < C ∧ ∀ x, ‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖ ≤ C := by rcases f.decay' k n with ⟨C, hC⟩ exact ⟨max C 1, by positivity, fun x => (hC x).trans (le_max_left _ _)⟩ /-- Every Schwartz function is smooth. -/ theorem smooth (f : 𝓢(E, F)) (n : ℕ∞) : ContDiff ℝ n f := f.smooth'.of_le le_top /-- Every Schwartz function is continuous. -/ @[continuity] protected theorem continuous (f : 𝓢(E, F)) : Continuous f := (f.smooth 0).continuous instance instContinuousMapClass : ContinuousMapClass 𝓢(E, F) E F where map_continuous := SchwartzMap.continuous /-- Every Schwartz function is differentiable. -/ protected theorem differentiable (f : 𝓢(E, F)) : Differentiable ℝ f := (f.smooth 1).differentiable rfl.le /-- Every Schwartz function is differentiable at any point. -/ protected theorem differentiableAt (f : 𝓢(E, F)) {x : E} : DifferentiableAt ℝ f x := f.differentiable.differentiableAt @[ext] theorem ext {f g : 𝓢(E, F)} (h : ∀ x, (f : E → F) x = g x) : f = g := DFunLike.ext f g h section IsBigO open Asymptotics Filter variable (f : 𝓢(E, F)) /-- Auxiliary lemma, used in proving the more general result `isBigO_cocompact_rpow`. -/ theorem isBigO_cocompact_zpow_neg_nat (k : ℕ) : f =O[cocompact E] fun x => ‖x‖ ^ (-k : ℤ) := by obtain ⟨d, _, hd'⟩ := f.decay k 0 simp only [norm_iteratedFDeriv_zero] at hd' simp_rw [Asymptotics.IsBigO, Asymptotics.IsBigOWith] refine ⟨d, Filter.Eventually.filter_mono Filter.cocompact_le_cofinite ?_⟩ refine (Filter.eventually_cofinite_ne 0).mono fun x hx => ?_ rw [Real.norm_of_nonneg (zpow_nonneg (norm_nonneg _) _), zpow_neg, ← div_eq_mul_inv, le_div_iff'] exacts [hd' x, zpow_pos_of_pos (norm_pos_iff.mpr hx) _] theorem isBigO_cocompact_rpow [ProperSpace E] (s : ℝ) : f =O[cocompact E] fun x => ‖x‖ ^ s := by let k := ⌈-s⌉₊ have hk : -(k : ℝ) ≤ s := neg_le.mp (Nat.le_ceil (-s)) refine (isBigO_cocompact_zpow_neg_nat f k).trans ?_ suffices (fun x : ℝ => x ^ (-k : ℤ)) =O[atTop] fun x : ℝ => x ^ s from this.comp_tendsto tendsto_norm_cocompact_atTop simp_rw [Asymptotics.IsBigO, Asymptotics.IsBigOWith] refine ⟨1, (Filter.eventually_ge_atTop 1).mono fun x hx => ?_⟩ rw [one_mul, Real.norm_of_nonneg (Real.rpow_nonneg (zero_le_one.trans hx) _), Real.norm_of_nonneg (zpow_nonneg (zero_le_one.trans hx) _), ← Real.rpow_intCast, Int.cast_neg, Int.cast_natCast] exact Real.rpow_le_rpow_of_exponent_le hx hk theorem isBigO_cocompact_zpow [ProperSpace E] (k : ℤ) : f =O[cocompact E] fun x => ‖x‖ ^ k := by simpa only [Real.rpow_intCast] using isBigO_cocompact_rpow f k end IsBigO section Aux theorem bounds_nonempty (k n : ℕ) (f : 𝓢(E, F)) : ∃ c : ℝ, c ∈ { c : ℝ | 0 ≤ c ∧ ∀ x : E, ‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖ ≤ c } := let ⟨M, hMp, hMb⟩ := f.decay k n ⟨M, le_of_lt hMp, hMb⟩ theorem bounds_bddBelow (k n : ℕ) (f : 𝓢(E, F)) : BddBelow { c | 0 ≤ c ∧ ∀ x, ‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖ ≤ c } := ⟨0, fun _ ⟨hn, _⟩ => hn⟩ theorem decay_add_le_aux (k n : ℕ) (f g : 𝓢(E, F)) (x : E) : ‖x‖ ^ k * ‖iteratedFDeriv ℝ n ((f : E → F) + (g : E → F)) x‖ ≤ ‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖ + ‖x‖ ^ k * ‖iteratedFDeriv ℝ n g x‖ := by rw [← mul_add] refine mul_le_mul_of_nonneg_left ?_ (by positivity) rw [iteratedFDeriv_add_apply (f.smooth _) (g.smooth _)] exact norm_add_le _ _ theorem decay_neg_aux (k n : ℕ) (f : 𝓢(E, F)) (x : E) : ‖x‖ ^ k * ‖iteratedFDeriv ℝ n (-f : E → F) x‖ = ‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖ := by rw [iteratedFDeriv_neg_apply, norm_neg] variable [NormedField 𝕜] [NormedSpace 𝕜 F] [SMulCommClass ℝ 𝕜 F] theorem decay_smul_aux (k n : ℕ) (f : 𝓢(E, F)) (c : 𝕜) (x : E) : ‖x‖ ^ k * ‖iteratedFDeriv ℝ n (c • (f : E → F)) x‖ = ‖c‖ * ‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖ := by rw [mul_comm ‖c‖, mul_assoc, iteratedFDeriv_const_smul_apply (f.smooth _), norm_smul c (iteratedFDeriv ℝ n (⇑f) x)] end Aux section SeminormAux /-- Helper definition for the seminorms of the Schwartz space. -/ protected def seminormAux (k n : ℕ) (f : 𝓢(E, F)) : ℝ := sInf { c | 0 ≤ c ∧ ∀ x, ‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖ ≤ c } theorem seminormAux_nonneg (k n : ℕ) (f : 𝓢(E, F)) : 0 ≤ f.seminormAux k n := le_csInf (bounds_nonempty k n f) fun _ ⟨hx, _⟩ => hx theorem le_seminormAux (k n : ℕ) (f : 𝓢(E, F)) (x : E) : ‖x‖ ^ k * ‖iteratedFDeriv ℝ n (⇑f) x‖ ≤ f.seminormAux k n := le_csInf (bounds_nonempty k n f) fun _ ⟨_, h⟩ => h x /-- If one controls the norm of every `A x`, then one controls the norm of `A`. -/ theorem seminormAux_le_bound (k n : ℕ) (f : 𝓢(E, F)) {M : ℝ} (hMp : 0 ≤ M) (hM : ∀ x, ‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖ ≤ M) : f.seminormAux k n ≤ M := csInf_le (bounds_bddBelow k n f) ⟨hMp, hM⟩ end SeminormAux /-! ### Algebraic properties -/ section SMul variable [NormedField 𝕜] [NormedSpace 𝕜 F] [SMulCommClass ℝ 𝕜 F] [NormedField 𝕜'] [NormedSpace 𝕜' F] [SMulCommClass ℝ 𝕜' F] instance instSMul : SMul 𝕜 𝓢(E, F) := ⟨fun c f => { toFun := c • (f : E → F) smooth' := (f.smooth _).const_smul c decay' := fun k n => by refine ⟨f.seminormAux k n * (‖c‖ + 1), fun x => ?_⟩ have hc : 0 ≤ ‖c‖ := by positivity refine le_trans ?_ ((mul_le_mul_of_nonneg_right (f.le_seminormAux k n x) hc).trans ?_) · apply Eq.le rw [mul_comm _ ‖c‖, ← mul_assoc] exact decay_smul_aux k n f c x · apply mul_le_mul_of_nonneg_left _ (f.seminormAux_nonneg k n) linarith }⟩ @[simp] theorem smul_apply {f : 𝓢(E, F)} {c : 𝕜} {x : E} : (c • f) x = c • f x := rfl instance instIsScalarTower [SMul 𝕜 𝕜'] [IsScalarTower 𝕜 𝕜' F] : IsScalarTower 𝕜 𝕜' 𝓢(E, F) := ⟨fun a b f => ext fun x => smul_assoc a b (f x)⟩ instance instSMulCommClass [SMulCommClass 𝕜 𝕜' F] : SMulCommClass 𝕜 𝕜' 𝓢(E, F) := ⟨fun a b f => ext fun x => smul_comm a b (f x)⟩ theorem seminormAux_smul_le (k n : ℕ) (c : 𝕜) (f : 𝓢(E, F)) : (c • f).seminormAux k n ≤ ‖c‖ * f.seminormAux k n := by refine (c • f).seminormAux_le_bound k n (mul_nonneg (norm_nonneg _) (seminormAux_nonneg _ _ _)) fun x => (decay_smul_aux k n f c x).le.trans ?_ rw [mul_assoc] exact mul_le_mul_of_nonneg_left (f.le_seminormAux k n x) (norm_nonneg _) instance instNSMul : SMul ℕ 𝓢(E, F) := ⟨fun c f => { toFun := c • (f : E → F) smooth' := (f.smooth _).const_smul c decay' := by simpa [← Nat.cast_smul_eq_nsmul ℝ] using ((c : ℝ) • f).decay' }⟩ instance instZSMul : SMul ℤ 𝓢(E, F) := ⟨fun c f => { toFun := c • (f : E → F) smooth' := (f.smooth _).const_smul c decay' := by simpa [← Int.cast_smul_eq_zsmul ℝ] using ((c : ℝ) • f).decay' }⟩ end SMul section Zero instance instZero : Zero 𝓢(E, F) := ⟨{ toFun := fun _ => 0 smooth' := contDiff_const decay' := fun _ _ => ⟨1, fun _ => by simp⟩ }⟩ instance instInhabited : Inhabited 𝓢(E, F) := ⟨0⟩ theorem coe_zero : DFunLike.coe (0 : 𝓢(E, F)) = (0 : E → F) := rfl @[simp] theorem coeFn_zero : ⇑(0 : 𝓢(E, F)) = (0 : E → F) := rfl @[simp] theorem zero_apply {x : E} : (0 : 𝓢(E, F)) x = 0 := rfl theorem seminormAux_zero (k n : ℕ) : (0 : 𝓢(E, F)).seminormAux k n = 0 := le_antisymm (seminormAux_le_bound k n _ rfl.le fun _ => by simp [Pi.zero_def]) (seminormAux_nonneg _ _ _) end Zero section Neg instance instNeg : Neg 𝓢(E, F) := ⟨fun f => ⟨-f, (f.smooth _).neg, fun k n => ⟨f.seminormAux k n, fun x => (decay_neg_aux k n f x).le.trans (f.le_seminormAux k n x)⟩⟩⟩ end Neg section Add instance instAdd : Add 𝓢(E, F) := ⟨fun f g => ⟨f + g, (f.smooth _).add (g.smooth _), fun k n => ⟨f.seminormAux k n + g.seminormAux k n, fun x => (decay_add_le_aux k n f g x).trans (add_le_add (f.le_seminormAux k n x) (g.le_seminormAux k n x))⟩⟩⟩ @[simp] theorem add_apply {f g : 𝓢(E, F)} {x : E} : (f + g) x = f x + g x := rfl theorem seminormAux_add_le (k n : ℕ) (f g : 𝓢(E, F)) : (f + g).seminormAux k n ≤ f.seminormAux k n + g.seminormAux k n := (f + g).seminormAux_le_bound k n (add_nonneg (seminormAux_nonneg _ _ _) (seminormAux_nonneg _ _ _)) fun x => (decay_add_le_aux k n f g x).trans <| add_le_add (f.le_seminormAux k n x) (g.le_seminormAux k n x) end Add section Sub instance instSub : Sub 𝓢(E, F) := ⟨fun f g => ⟨f - g, (f.smooth _).sub (g.smooth _), by intro k n refine ⟨f.seminormAux k n + g.seminormAux k n, fun x => ?_⟩ refine le_trans ?_ (add_le_add (f.le_seminormAux k n x) (g.le_seminormAux k n x)) rw [sub_eq_add_neg] rw [← decay_neg_aux k n g x] convert decay_add_le_aux k n f (-g) x⟩⟩ -- exact fails with deterministic timeout @[simp] theorem sub_apply {f g : 𝓢(E, F)} {x : E} : (f - g) x = f x - g x := rfl end Sub section AddCommGroup instance instAddCommGroup : AddCommGroup 𝓢(E, F) := DFunLike.coe_injective.addCommGroup _ rfl (fun _ _ => rfl) (fun _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl) fun _ _ => rfl variable (E F) /-- Coercion as an additive homomorphism. -/ def coeHom : 𝓢(E, F) →+ E → F where toFun f := f map_zero' := coe_zero map_add' _ _ := rfl variable {E F} theorem coe_coeHom : (coeHom E F : 𝓢(E, F) → E → F) = DFunLike.coe := rfl theorem coeHom_injective : Function.Injective (coeHom E F) := by rw [coe_coeHom] exact DFunLike.coe_injective end AddCommGroup section Module variable [NormedField 𝕜] [NormedSpace 𝕜 F] [SMulCommClass ℝ 𝕜 F] instance instModule : Module 𝕜 𝓢(E, F) := coeHom_injective.module 𝕜 (coeHom E F) fun _ _ => rfl end Module section Seminorms /-! ### Seminorms on Schwartz space-/ variable [NormedField 𝕜] [NormedSpace 𝕜 F] [SMulCommClass ℝ 𝕜 F] variable (𝕜) /-- The seminorms of the Schwartz space given by the best constants in the definition of `𝓢(E, F)`. -/ protected def seminorm (k n : ℕ) : Seminorm 𝕜 𝓢(E, F) := Seminorm.ofSMulLE (SchwartzMap.seminormAux k n) (seminormAux_zero k n) (seminormAux_add_le k n) (seminormAux_smul_le k n) /-- If one controls the seminorm for every `x`, then one controls the seminorm. -/ theorem seminorm_le_bound (k n : ℕ) (f : 𝓢(E, F)) {M : ℝ} (hMp : 0 ≤ M) (hM : ∀ x, ‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖ ≤ M) : SchwartzMap.seminorm 𝕜 k n f ≤ M := f.seminormAux_le_bound k n hMp hM /-- If one controls the seminorm for every `x`, then one controls the seminorm. Variant for functions `𝓢(ℝ, F)`. -/ theorem seminorm_le_bound' (k n : ℕ) (f : 𝓢(ℝ, F)) {M : ℝ} (hMp : 0 ≤ M) (hM : ∀ x, |x| ^ k * ‖iteratedDeriv n f x‖ ≤ M) : SchwartzMap.seminorm 𝕜 k n f ≤ M := by refine seminorm_le_bound 𝕜 k n f hMp ?_ simpa only [Real.norm_eq_abs, norm_iteratedFDeriv_eq_norm_iteratedDeriv] /-- The seminorm controls the Schwartz estimate for any fixed `x`. -/ theorem le_seminorm (k n : ℕ) (f : 𝓢(E, F)) (x : E) : ‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖ ≤ SchwartzMap.seminorm 𝕜 k n f := f.le_seminormAux k n x /-- The seminorm controls the Schwartz estimate for any fixed `x`. Variant for functions `𝓢(ℝ, F)`. -/ theorem le_seminorm' (k n : ℕ) (f : 𝓢(ℝ, F)) (x : ℝ) : |x| ^ k * ‖iteratedDeriv n f x‖ ≤ SchwartzMap.seminorm 𝕜 k n f := by have := le_seminorm 𝕜 k n f x rwa [← Real.norm_eq_abs, ← norm_iteratedFDeriv_eq_norm_iteratedDeriv] theorem norm_iteratedFDeriv_le_seminorm (f : 𝓢(E, F)) (n : ℕ) (x₀ : E) : ‖iteratedFDeriv ℝ n f x₀‖ ≤ (SchwartzMap.seminorm 𝕜 0 n) f := by have := SchwartzMap.le_seminorm 𝕜 0 n f x₀ rwa [pow_zero, one_mul] at this theorem norm_pow_mul_le_seminorm (f : 𝓢(E, F)) (k : ℕ) (x₀ : E) : ‖x₀‖ ^ k * ‖f x₀‖ ≤ (SchwartzMap.seminorm 𝕜 k 0) f := by have := SchwartzMap.le_seminorm 𝕜 k 0 f x₀ rwa [norm_iteratedFDeriv_zero] at this theorem norm_le_seminorm (f : 𝓢(E, F)) (x₀ : E) : ‖f x₀‖ ≤ (SchwartzMap.seminorm 𝕜 0 0) f := by have := norm_pow_mul_le_seminorm 𝕜 f 0 x₀ rwa [pow_zero, one_mul] at this variable (E F) /-- The family of Schwartz seminorms. -/ def _root_.schwartzSeminormFamily : SeminormFamily 𝕜 𝓢(E, F) (ℕ × ℕ) := fun m => SchwartzMap.seminorm 𝕜 m.1 m.2 @[simp] theorem schwartzSeminormFamily_apply (n k : ℕ) : schwartzSeminormFamily 𝕜 E F (n, k) = SchwartzMap.seminorm 𝕜 n k := rfl @[simp] theorem schwartzSeminormFamily_apply_zero : schwartzSeminormFamily 𝕜 E F 0 = SchwartzMap.seminorm 𝕜 0 0 := rfl variable {𝕜 E F} /-- A more convenient version of `le_sup_seminorm_apply`. The set `Finset.Iic m` is the set of all pairs `(k', n')` with `k' ≤ m.1` and `n' ≤ m.2`. Note that the constant is far from optimal. -/ theorem one_add_le_sup_seminorm_apply {m : ℕ × ℕ} {k n : ℕ} (hk : k ≤ m.1) (hn : n ≤ m.2) (f : 𝓢(E, F)) (x : E) : (1 + ‖x‖) ^ k * ‖iteratedFDeriv ℝ n f x‖ ≤ 2 ^ m.1 * (Finset.Iic m).sup (fun m => SchwartzMap.seminorm 𝕜 m.1 m.2) f := by rw [add_comm, add_pow] simp only [one_pow, mul_one, Finset.sum_congr, Finset.sum_mul] norm_cast rw [← Nat.sum_range_choose m.1] push_cast rw [Finset.sum_mul] have hk' : Finset.range (k + 1) ⊆ Finset.range (m.1 + 1) := by rwa [Finset.range_subset, add_le_add_iff_right] refine le_trans (Finset.sum_le_sum_of_subset_of_nonneg hk' fun _ _ _ => by positivity) ?_ gcongr ∑ _i ∈ Finset.range (m.1 + 1), ?_ with i hi move_mul [(Nat.choose k i : ℝ), (Nat.choose m.1 i : ℝ)] gcongr · apply (le_seminorm 𝕜 i n f x).trans apply Seminorm.le_def.1 exact Finset.le_sup_of_le (Finset.mem_Iic.2 <| Prod.mk_le_mk.2 ⟨Finset.mem_range_succ_iff.mp hi, hn⟩) le_rfl · exact mod_cast Nat.choose_le_choose i hk end Seminorms section Topology /-! ### The topology on the Schwartz space-/ variable [NormedField 𝕜] [NormedSpace 𝕜 F] [SMulCommClass ℝ 𝕜 F] variable (𝕜 E F) instance instTopologicalSpace : TopologicalSpace 𝓢(E, F) := (schwartzSeminormFamily ℝ E F).moduleFilterBasis.topology' theorem _root_.schwartz_withSeminorms : WithSeminorms (schwartzSeminormFamily 𝕜 E F) := by have A : WithSeminorms (schwartzSeminormFamily ℝ E F) := ⟨rfl⟩ rw [SeminormFamily.withSeminorms_iff_nhds_eq_iInf] at A ⊢ rw [A] rfl variable {𝕜 E F} instance instContinuousSMul : ContinuousSMul 𝕜 𝓢(E, F) := by rw [(schwartz_withSeminorms 𝕜 E F).withSeminorms_eq] exact (schwartzSeminormFamily 𝕜 E F).moduleFilterBasis.continuousSMul instance instTopologicalAddGroup : TopologicalAddGroup 𝓢(E, F) := (schwartzSeminormFamily ℝ E F).addGroupFilterBasis.isTopologicalAddGroup instance instUniformSpace : UniformSpace 𝓢(E, F) := (schwartzSeminormFamily ℝ E F).addGroupFilterBasis.uniformSpace instance instUniformAddGroup : UniformAddGroup 𝓢(E, F) := (schwartzSeminormFamily ℝ E F).addGroupFilterBasis.uniformAddGroup instance instLocallyConvexSpace : LocallyConvexSpace ℝ 𝓢(E, F) := (schwartz_withSeminorms ℝ E F).toLocallyConvexSpace instance instFirstCountableTopology : FirstCountableTopology 𝓢(E, F) := (schwartz_withSeminorms ℝ E F).first_countable end Topology section TemperateGrowth /-! ### Functions of temperate growth -/ /-- A function is called of temperate growth if it is smooth and all iterated derivatives are polynomially bounded. -/ def _root_.Function.HasTemperateGrowth (f : E → F) : Prop := ContDiff ℝ ⊤ f ∧ ∀ n : ℕ, ∃ (k : ℕ) (C : ℝ), ∀ x, ‖iteratedFDeriv ℝ n f x‖ ≤ C * (1 + ‖x‖) ^ k theorem _root_.Function.HasTemperateGrowth.norm_iteratedFDeriv_le_uniform_aux {f : E → F} (hf_temperate : f.HasTemperateGrowth) (n : ℕ) : ∃ (k : ℕ) (C : ℝ), 0 ≤ C ∧ ∀ N ≤ n, ∀ x : E, ‖iteratedFDeriv ℝ N f x‖ ≤ C * (1 + ‖x‖) ^ k := by choose k C f using hf_temperate.2 use (Finset.range (n + 1)).sup k let C' := max (0 : ℝ) ((Finset.range (n + 1)).sup' (by simp) C) have hC' : 0 ≤ C' := by simp only [C', le_refl, Finset.le_sup'_iff, true_or_iff, le_max_iff] use C', hC' intro N hN x rw [← Finset.mem_range_succ_iff] at hN refine le_trans (f N x) (mul_le_mul ?_ ?_ (by positivity) hC') · simp only [C', Finset.le_sup'_iff, le_max_iff] right exact ⟨N, hN, rfl.le⟩ gcongr · simp exact Finset.le_sup hN lemma _root_.Function.HasTemperateGrowth.of_fderiv {f : E → F} (h'f : Function.HasTemperateGrowth (fderiv ℝ f)) (hf : Differentiable ℝ f) {k : ℕ} {C : ℝ} (h : ∀ x, ‖f x‖ ≤ C * (1 + ‖x‖) ^ k) : Function.HasTemperateGrowth f := by refine ⟨contDiff_top_iff_fderiv.2 ⟨hf, h'f.1⟩ , fun n ↦ ?_⟩ rcases n with rfl|m · exact ⟨k, C, fun x ↦ by simpa using h x⟩ · rcases h'f.2 m with ⟨k', C', h'⟩ refine ⟨k', C', ?_⟩ simpa [iteratedFDeriv_succ_eq_comp_right] using h' lemma _root_.Function.HasTemperateGrowth.zero : Function.HasTemperateGrowth (fun _ : E ↦ (0 : F)) := by refine ⟨contDiff_const, fun n ↦ ⟨0, 0, fun x ↦ ?_⟩⟩ simp only [iteratedFDeriv_zero_fun, Pi.zero_apply, norm_zero, forall_const] positivity lemma _root_.Function.HasTemperateGrowth.const (c : F) : Function.HasTemperateGrowth (fun _ : E ↦ c) := .of_fderiv (by simpa using .zero) (differentiable_const c) (k := 0) (C := ‖c‖) (fun x ↦ by simp) lemma _root_.ContinuousLinearMap.hasTemperateGrowth (f : E →L[ℝ] F) : Function.HasTemperateGrowth f := by apply Function.HasTemperateGrowth.of_fderiv ?_ f.differentiable (k := 1) (C := ‖f‖) (fun x ↦ ?_) · have : fderiv ℝ f = fun _ ↦ f := by ext1 v; simp only [ContinuousLinearMap.fderiv] simpa [this] using .const _ · exact (f.le_opNorm x).trans (by simp [mul_add]) variable [NormedAddCommGroup D] [NormedSpace ℝ D] variable [MeasurableSpace D] [BorelSpace D] [SecondCountableTopology D] [FiniteDimensional ℝ D] open MeasureTheory FiniteDimensional /-- A measure `μ` has temperate growth if there is an `n : ℕ` such that `(1 + ‖x‖) ^ (- n)` is `μ`-integrable. -/ class _root_.MeasureTheory.Measure.HasTemperateGrowth (μ : Measure D) : Prop := exists_integrable : ∃ (n : ℕ), Integrable (fun x ↦ (1 + ‖x‖) ^ (- (n : ℝ))) μ open Classical in /-- An integer exponent `l` such that `(1 + ‖x‖) ^ (-l)` is integrable if `μ` has temperate growth. -/ def _root_.MeasureTheory.Measure.integrablePower (μ : Measure D) : ℕ := if h : μ.HasTemperateGrowth then h.exists_integrable.choose else 0 lemma integrable_pow_neg_integrablePower (μ : Measure D) [h : μ.HasTemperateGrowth] : Integrable (fun x ↦ (1 + ‖x‖) ^ (- (μ.integrablePower : ℝ))) μ := by simpa [Measure.integrablePower, h] using h.exists_integrable.choose_spec instance _root_.MeasureTheory.Measure.IsFiniteMeasure.instHasTemperateGrowth {μ : Measure D} [h : IsFiniteMeasure μ] : μ.HasTemperateGrowth := ⟨⟨0, by simp⟩⟩ instance _root_.MeasureTheory.Measure.IsAddHaarMeasure.instHasTemperateGrowth {μ : Measure D} [h : μ.IsAddHaarMeasure] : μ.HasTemperateGrowth := ⟨⟨finrank ℝ D + 1, by apply integrable_one_add_norm; norm_num⟩⟩ /-- Pointwise inequality to control `x ^ k * f` in terms of `1 / (1 + x) ^ l` if one controls both `f` (with a bound `C₁`) and `x ^ (k + l) * f` (with a bound `C₂`). This will be used to check integrability of `x ^ k * f x` when `f` is a Schwartz function, and to control explicitly its integral in terms of suitable seminorms of `f`. -/ lemma pow_mul_le_of_le_of_pow_mul_le {C₁ C₂ : ℝ} {k l : ℕ} {x f : ℝ} (hx : 0 ≤ x) (hf : 0 ≤ f) (h₁ : f ≤ C₁) (h₂ : x ^ (k + l) * f ≤ C₂) : x ^ k * f ≤ 2 ^ l * (C₁ + C₂) * (1 + x) ^ (- (l : ℝ)) := by have : 0 ≤ C₂ := le_trans (by positivity) h₂ have : 2 ^ l * (C₁ + C₂) * (1 + x) ^ (- (l : ℝ)) = ((1 + x) / 2) ^ (-(l : ℝ)) * (C₁ + C₂) := by rw [Real.div_rpow (by linarith) zero_le_two] simp [div_eq_inv_mul, ← Real.rpow_neg_one, ← Real.rpow_mul] ring rw [this] rcases le_total x 1 with h'x|h'x · gcongr · apply (pow_le_one k hx h'x).trans apply Real.one_le_rpow_of_pos_of_le_one_of_nonpos · linarith · linarith · simp · linarith · calc x ^ k * f = x ^ (-(l : ℝ)) * (x ^ (k + l) * f) := by rw [← Real.rpow_natCast, ← Real.rpow_natCast, ← mul_assoc, ← Real.rpow_add (by linarith)] simp _ ≤ ((1 + x) / 2) ^ (-(l : ℝ)) * (C₁ + C₂) := by apply mul_le_mul _ _ (by positivity) (by positivity) · exact Real.rpow_le_rpow_of_nonpos (by linarith) (by linarith) (by simp) · exact h₂.trans (by linarith) /-- Given a function such that `f` and `x ^ (k + l) * f` are bounded for a suitable `l`, then `x ^ k * f` is integrable. The bounds are not relevant for the integrability conclusion, but they are relevant for bounding the integral in `integral_pow_mul_le_of_le_of_pow_mul_le`. We formulate the two lemmas with the same set of assumptions for ease of applications. -/ lemma integrable_of_le_of_pow_mul_le {μ : Measure D} [μ.HasTemperateGrowth] {f : D → E} {C₁ C₂ : ℝ} {k : ℕ} (hf : ∀ x, ‖f x‖ ≤ C₁) (h'f : ∀ x, ‖x‖ ^ (k + μ.integrablePower) * ‖f x‖ ≤ C₂) (h''f : AEStronglyMeasurable f μ) : Integrable (fun x ↦ ‖x‖ ^ k * ‖f x‖) μ := by apply ((integrable_pow_neg_integrablePower μ).const_mul (2 ^ μ.integrablePower * (C₁ + C₂))).mono' · exact AEStronglyMeasurable.mul (aestronglyMeasurable_id.norm.pow _) h''f.norm · filter_upwards with v simp only [norm_mul, norm_pow, norm_norm] apply pow_mul_le_of_le_of_pow_mul_le (norm_nonneg _) (norm_nonneg _) (hf v) (h'f v) /-- Given a function such that `f` and `x ^ (k + l) * f` are bounded for a suitable `l`, then one can bound explicitly the integral of `x ^ k * f`. -/ lemma integral_pow_mul_le_of_le_of_pow_mul_le {μ : Measure D} [μ.HasTemperateGrowth] {f : D → E} {C₁ C₂ : ℝ} {k : ℕ} (hf : ∀ x, ‖f x‖ ≤ C₁) (h'f : ∀ x, ‖x‖ ^ (k + μ.integrablePower) * ‖f x‖ ≤ C₂) : ∫ x, ‖x‖ ^ k * ‖f x‖ ∂μ ≤ 2 ^ μ.integrablePower * (∫ x, (1 + ‖x‖) ^ (- (μ.integrablePower : ℝ)) ∂μ) * (C₁ + C₂) := by rw [← integral_mul_left, ← integral_mul_right] apply integral_mono_of_nonneg · filter_upwards with v using by positivity · exact ((integrable_pow_neg_integrablePower μ).const_mul _).mul_const _ filter_upwards with v exact (pow_mul_le_of_le_of_pow_mul_le (norm_nonneg _) (norm_nonneg _) (hf v) (h'f v)).trans (le_of_eq (by ring)) end TemperateGrowth section CLM /-! ### Construction of continuous linear maps between Schwartz spaces -/ variable [NormedField 𝕜] [NormedField 𝕜'] variable [NormedAddCommGroup D] [NormedSpace ℝ D] variable [NormedSpace 𝕜 E] [SMulCommClass ℝ 𝕜 E] variable [NormedAddCommGroup G] [NormedSpace ℝ G] [NormedSpace 𝕜' G] [SMulCommClass ℝ 𝕜' G] variable {σ : 𝕜 →+* 𝕜'} /-- Create a semilinear map between Schwartz spaces. Note: This is a helper definition for `mkCLM`. -/ def mkLM (A : (D → E) → F → G) (hadd : ∀ (f g : 𝓢(D, E)) (x), A (f + g) x = A f x + A g x) (hsmul : ∀ (a : 𝕜) (f : 𝓢(D, E)) (x), A (a • f) x = σ a • A f x) (hsmooth : ∀ f : 𝓢(D, E), ContDiff ℝ ⊤ (A f)) (hbound : ∀ n : ℕ × ℕ, ∃ (s : Finset (ℕ × ℕ)) (C : ℝ), 0 ≤ C ∧ ∀ (f : 𝓢(D, E)) (x : F), ‖x‖ ^ n.fst * ‖iteratedFDeriv ℝ n.snd (A f) x‖ ≤ C * s.sup (schwartzSeminormFamily 𝕜 D E) f) : 𝓢(D, E) →ₛₗ[σ] 𝓢(F, G) where toFun f := { toFun := A f smooth' := hsmooth f decay' := by intro k n rcases hbound ⟨k, n⟩ with ⟨s, C, _, h⟩ exact ⟨C * (s.sup (schwartzSeminormFamily 𝕜 D E)) f, h f⟩ } map_add' f g := ext (hadd f g) map_smul' a f := ext (hsmul a f) /-- Create a continuous semilinear map between Schwartz spaces. For an example of using this definition, see `fderivCLM`. -/ def mkCLM [RingHomIsometric σ] (A : (D → E) → F → G) (hadd : ∀ (f g : 𝓢(D, E)) (x), A (f + g) x = A f x + A g x) (hsmul : ∀ (a : 𝕜) (f : 𝓢(D, E)) (x), A (a • f) x = σ a • A f x) (hsmooth : ∀ f : 𝓢(D, E), ContDiff ℝ ⊤ (A f)) (hbound : ∀ n : ℕ × ℕ, ∃ (s : Finset (ℕ × ℕ)) (C : ℝ), 0 ≤ C ∧ ∀ (f : 𝓢(D, E)) (x : F), ‖x‖ ^ n.fst * ‖iteratedFDeriv ℝ n.snd (A f) x‖ ≤ C * s.sup (schwartzSeminormFamily 𝕜 D E) f) : 𝓢(D, E) →SL[σ] 𝓢(F, G) where cont := by change Continuous (mkLM A hadd hsmul hsmooth hbound : 𝓢(D, E) →ₛₗ[σ] 𝓢(F, G)) refine Seminorm.continuous_from_bounded (schwartz_withSeminorms 𝕜 D E) (schwartz_withSeminorms 𝕜' F G) _ fun n => ?_ rcases hbound n with ⟨s, C, hC, h⟩ refine ⟨s, ⟨C, hC⟩, fun f => ?_⟩ exact (mkLM A hadd hsmul hsmooth hbound f).seminorm_le_bound 𝕜' n.1 n.2 (by positivity) (h f) toLinearMap := mkLM A hadd hsmul hsmooth hbound /-- Define a continuous semilinear map from Schwartz space to a normed space. -/ def mkCLMtoNormedSpace [RingHomIsometric σ] (A : 𝓢(D, E) → G) (hadd : ∀ (f g : 𝓢(D, E)), A (f + g) = A f + A g) (hsmul : ∀ (a : 𝕜) (f : 𝓢(D, E)), A (a • f) = σ a • A f) (hbound : ∃ (s : Finset (ℕ × ℕ)) (C : ℝ), 0 ≤ C ∧ ∀ (f : 𝓢(D, E)), ‖A f‖ ≤ C * s.sup (schwartzSeminormFamily 𝕜 D E) f) : 𝓢(D, E) →SL[σ] G where toLinearMap := { toFun := (A ·) map_add' := hadd map_smul' := hsmul } cont := by change Continuous (LinearMap.mk _ _) apply Seminorm.cont_withSeminorms_normedSpace G (schwartz_withSeminorms 𝕜 D E) rcases hbound with ⟨s, C, hC, h⟩ exact ⟨s, ⟨C, hC⟩, h⟩ end CLM section EvalCLM variable [NormedField 𝕜] [NormedSpace 𝕜 F] [SMulCommClass ℝ 𝕜 F] /-- The map applying a vector to Hom-valued Schwartz function as a continuous linear map. -/ protected def evalCLM (m : E) : 𝓢(E, E →L[ℝ] F) →L[𝕜] 𝓢(E, F) := mkCLM (fun f x => f x m) (fun _ _ _ => rfl) (fun _ _ _ => rfl) (fun f => ContDiff.clm_apply f.2 contDiff_const) (by rintro ⟨k, n⟩ use {(k, n)}, ‖m‖, norm_nonneg _ intro f x refine le_trans (mul_le_mul_of_nonneg_left (norm_iteratedFDeriv_clm_apply_const f.2 le_top) (by positivity)) ?_ move_mul [‖m‖] gcongr ?_ * ‖m‖ simp only [Finset.sup_singleton, schwartzSeminormFamily_apply, le_seminorm]) end EvalCLM section Multiplication variable [NormedAddCommGroup D] [NormedSpace ℝ D] variable [NormedAddCommGroup G] [NormedSpace ℝ G] /-- The map `f ↦ (x ↦ B (f x) (g x))` as a continuous `𝕜`-linear map on Schwartz space, where `B` is a continuous `𝕜`-linear map and `g` is a function of temperate growth. -/ def bilinLeftCLM (B : E →L[ℝ] F →L[ℝ] G) {g : D → F} (hg : g.HasTemperateGrowth) : 𝓢(D, E) →L[ℝ] 𝓢(D, G) := -- Todo (after port): generalize to `B : E →L[𝕜] F →L[𝕜] G` and `𝕜`-linear mkCLM (fun f x => B (f x) (g x)) (fun _ _ _ => by simp only [map_add, add_left_inj, Pi.add_apply, eq_self_iff_true, ContinuousLinearMap.add_apply]) (fun _ _ _ => by simp only [smul_apply, map_smul, ContinuousLinearMap.coe_smul', Pi.smul_apply, RingHom.id_apply]) (fun f => (B.isBoundedBilinearMap.contDiff.restrict_scalars ℝ).comp (f.smooth'.prod hg.1)) (by rintro ⟨k, n⟩ rcases hg.norm_iteratedFDeriv_le_uniform_aux n with ⟨l, C, hC, hgrowth⟩ use Finset.Iic (l + k, n), ‖B‖ * ((n : ℝ) + (1 : ℝ)) * n.choose (n / 2) * (C * 2 ^ (l + k)), by positivity intro f x have hxk : 0 ≤ ‖x‖ ^ k := by positivity have hnorm_mul := ContinuousLinearMap.norm_iteratedFDeriv_le_of_bilinear B f.smooth' hg.1 x (n := n) le_top refine le_trans (mul_le_mul_of_nonneg_left hnorm_mul hxk) ?_ move_mul [← ‖B‖] simp_rw [mul_assoc ‖B‖] gcongr _ * ?_ rw [Finset.mul_sum] have : (∑ _x ∈ Finset.range (n + 1), (1 : ℝ)) = n + 1 := by simp simp_rw [mul_assoc ((n : ℝ) + 1)] rw [← this, Finset.sum_mul] refine Finset.sum_le_sum fun i hi => ?_ simp only [one_mul] move_mul [(Nat.choose n i : ℝ), (Nat.choose n (n / 2) : ℝ)] gcongr ?_ * ?_ swap · norm_cast exact i.choose_le_middle n specialize hgrowth (n - i) (by simp only [tsub_le_self]) x refine le_trans (mul_le_mul_of_nonneg_left hgrowth (by positivity)) ?_ move_mul [C] gcongr ?_ * C rw [Finset.mem_range_succ_iff] at hi change i ≤ (l + k, n).snd at hi refine le_trans ?_ (one_add_le_sup_seminorm_apply le_rfl hi f x) rw [pow_add] move_mul [(1 + ‖x‖) ^ l] gcongr simp) end Multiplication section Comp variable (𝕜) variable [RCLike 𝕜] variable [NormedAddCommGroup D] [NormedSpace ℝ D] variable [NormedAddCommGroup G] [NormedSpace ℝ G] variable [NormedSpace 𝕜 F] [SMulCommClass ℝ 𝕜 F] variable [NormedSpace 𝕜 G] [SMulCommClass ℝ 𝕜 G] /-- Composition with a function on the right is a continuous linear map on Schwartz space provided that the function is temperate and growths polynomially near infinity. -/ def compCLM {g : D → E} (hg : g.HasTemperateGrowth) (hg_upper : ∃ (k : ℕ) (C : ℝ), ∀ x, ‖x‖ ≤ C * (1 + ‖g x‖) ^ k) : 𝓢(E, F) →L[𝕜] 𝓢(D, F) := mkCLM (fun f x => f (g x)) (fun _ _ _ => by simp only [add_left_inj, Pi.add_apply, eq_self_iff_true]) (fun _ _ _ => rfl) (fun f => f.smooth'.comp hg.1) (by rintro ⟨k, n⟩ rcases hg.norm_iteratedFDeriv_le_uniform_aux n with ⟨l, C, hC, hgrowth⟩ rcases hg_upper with ⟨kg, Cg, hg_upper'⟩ have hCg : 1 ≤ 1 + Cg := by refine le_add_of_nonneg_right ?_ specialize hg_upper' 0 rw [norm_zero] at hg_upper' exact nonneg_of_mul_nonneg_left hg_upper' (by positivity) let k' := kg * (k + l * n) use Finset.Iic (k', n), (1 + Cg) ^ (k + l * n) * ((C + 1) ^ n * n ! * 2 ^ k'), by positivity intro f x let seminorm_f := ((Finset.Iic (k', n)).sup (schwartzSeminormFamily 𝕜 _ _)) f have hg_upper'' : (1 + ‖x‖) ^ (k + l * n) ≤ (1 + Cg) ^ (k + l * n) * (1 + ‖g x‖) ^ k' := by rw [pow_mul, ← mul_pow] gcongr rw [add_mul] refine add_le_add ?_ (hg_upper' x) nth_rw 1 [← one_mul (1 : ℝ)] gcongr apply one_le_pow_of_one_le simp only [le_add_iff_nonneg_right, norm_nonneg] have hbound : ∀ i, i ≤ n → ‖iteratedFDeriv ℝ i f (g x)‖ ≤ 2 ^ k' * seminorm_f / (1 + ‖g x‖) ^ k' := by intro i hi have hpos : 0 < (1 + ‖g x‖) ^ k' := by positivity rw [le_div_iff' hpos] change i ≤ (k', n).snd at hi exact one_add_le_sup_seminorm_apply le_rfl hi _ _ have hgrowth' : ∀ N : ℕ, 1 ≤ N → N ≤ n → ‖iteratedFDeriv ℝ N g x‖ ≤ ((C + 1) * (1 + ‖x‖) ^ l) ^ N := by intro N hN₁ hN₂ refine (hgrowth N hN₂ x).trans ?_ rw [mul_pow] have hN₁' := (lt_of_lt_of_le zero_lt_one hN₁).ne' gcongr · exact le_trans (by simp [hC]) (le_self_pow (by simp [hC]) hN₁') · refine le_self_pow (one_le_pow_of_one_le ?_ l) hN₁' simp only [le_add_iff_nonneg_right, norm_nonneg] have := norm_iteratedFDeriv_comp_le f.smooth' hg.1 le_top x hbound hgrowth' have hxk : ‖x‖ ^ k ≤ (1 + ‖x‖) ^ k := pow_le_pow_left (norm_nonneg _) (by simp only [zero_le_one, le_add_iff_nonneg_left]) _ refine le_trans (mul_le_mul hxk this (by positivity) (by positivity)) ?_ have rearrange : (1 + ‖x‖) ^ k * (n ! * (2 ^ k' * seminorm_f / (1 + ‖g x‖) ^ k') * ((C + 1) * (1 + ‖x‖) ^ l) ^ n) = (1 + ‖x‖) ^ (k + l * n) / (1 + ‖g x‖) ^ k' * ((C + 1) ^ n * n ! * 2 ^ k' * seminorm_f) := by rw [mul_pow, pow_add, ← pow_mul] ring rw [rearrange] have hgxk' : 0 < (1 + ‖g x‖) ^ k' := by positivity rw [← div_le_iff hgxk'] at hg_upper'' have hpos : (0 : ℝ) ≤ (C + 1) ^ n * n ! * 2 ^ k' * seminorm_f := by have : 0 ≤ seminorm_f := apply_nonneg _ _ positivity refine le_trans (mul_le_mul_of_nonneg_right hg_upper'' hpos) ?_ rw [← mul_assoc]) @[simp] lemma compCLM_apply {g : D → E} (hg : g.HasTemperateGrowth) (hg_upper : ∃ (k : ℕ) (C : ℝ), ∀ x, ‖x‖ ≤ C * (1 + ‖g x‖) ^ k) (f : 𝓢(E, F)) : compCLM 𝕜 hg hg_upper f = f ∘ g := rfl /-- Composition with a function on the right is a continuous linear map on Schwartz space provided that the function is temperate and antilipschitz. -/ def compCLMOfAntilipschitz {K : ℝ≥0} {g : D → E} (hg : g.HasTemperateGrowth) (h'g : AntilipschitzWith K g) : 𝓢(E, F) →L[𝕜] 𝓢(D, F) := by refine compCLM 𝕜 hg ⟨1, K * max 1 ‖g 0‖, fun x ↦ ?_⟩ calc ‖x‖ ≤ K * ‖g x - g 0‖ := by rw [← dist_zero_right, ← dist_eq_norm] apply h'g.le_mul_dist _ ≤ K * (‖g x‖ + ‖g 0‖) := by gcongr exact norm_sub_le _ _ _ ≤ K * (‖g x‖ + max 1 ‖g 0‖) := by gcongr exact le_max_right _ _ _ ≤ (K * max 1 ‖g 0‖ : ℝ) * (1 + ‖g x‖) ^ 1 := by simp only [mul_add, add_comm (K * ‖g x‖), pow_one, mul_one, add_le_add_iff_left] gcongr exact le_mul_of_one_le_right (by positivity) (le_max_left _ _) @[simp] lemma compCLMOfAntilipschitz_apply {K : ℝ≥0} {g : D → E} (hg : g.HasTemperateGrowth) (h'g : AntilipschitzWith K g) (f : 𝓢(E, F)) : compCLMOfAntilipschitz 𝕜 hg h'g f = f ∘ g := rfl /-- Composition with a continuous linear equiv on the right is a continuous linear map on Schwartz space. -/ def compCLMOfContinuousLinearEquiv (g : D ≃L[ℝ] E) : 𝓢(E, F) →L[𝕜] 𝓢(D, F) := compCLMOfAntilipschitz 𝕜 (g.toContinuousLinearMap.hasTemperateGrowth) g.antilipschitz @[simp] lemma compCLMOfContinuousLinearEquiv_apply (g : D ≃L[ℝ] E) (f : 𝓢(E, F)) : compCLMOfContinuousLinearEquiv 𝕜 g f = f ∘ g := rfl end Comp section Derivatives /-! ### Derivatives of Schwartz functions -/ variable (𝕜) variable [RCLike 𝕜] [NormedSpace 𝕜 F] [SMulCommClass ℝ 𝕜 F] /-- The Fréchet derivative on Schwartz space as a continuous `𝕜`-linear map. -/ def fderivCLM : 𝓢(E, F) →L[𝕜] 𝓢(E, E →L[ℝ] F) := mkCLM (fderiv ℝ) (fun f g _ => fderiv_add f.differentiableAt g.differentiableAt) (fun a f _ => fderiv_const_smul f.differentiableAt a) (fun f => (contDiff_top_iff_fderiv.mp f.smooth').2) fun ⟨k, n⟩ => ⟨{⟨k, n + 1⟩}, 1, zero_le_one, fun f x => by simpa only [schwartzSeminormFamily_apply, Seminorm.comp_apply, Finset.sup_singleton, one_smul, norm_iteratedFDeriv_fderiv, one_mul] using f.le_seminorm 𝕜 k (n + 1) x⟩ @[simp] theorem fderivCLM_apply (f : 𝓢(E, F)) (x : E) : fderivCLM 𝕜 f x = fderiv ℝ f x := rfl /-- The 1-dimensional derivative on Schwartz space as a continuous `𝕜`-linear map. -/ def derivCLM : 𝓢(ℝ, F) →L[𝕜] 𝓢(ℝ, F) := mkCLM (fun f => deriv f) (fun f g _ => deriv_add f.differentiableAt g.differentiableAt) (fun a f _ => deriv_const_smul a f.differentiableAt) (fun f => (contDiff_top_iff_deriv.mp f.smooth').2) fun ⟨k, n⟩ => ⟨{⟨k, n + 1⟩}, 1, zero_le_one, fun f x => by simpa only [Real.norm_eq_abs, Finset.sup_singleton, schwartzSeminormFamily_apply, one_mul, norm_iteratedFDeriv_eq_norm_iteratedDeriv, ← iteratedDeriv_succ'] using f.le_seminorm' 𝕜 k (n + 1) x⟩ @[simp] theorem derivCLM_apply (f : 𝓢(ℝ, F)) (x : ℝ) : derivCLM 𝕜 f x = deriv f x := rfl /-- The partial derivative (or directional derivative) in the direction `m : E` as a continuous linear map on Schwartz space. -/ def pderivCLM (m : E) : 𝓢(E, F) →L[𝕜] 𝓢(E, F) := (SchwartzMap.evalCLM m).comp (fderivCLM 𝕜) @[simp] theorem pderivCLM_apply (m : E) (f : 𝓢(E, F)) (x : E) : pderivCLM 𝕜 m f x = fderiv ℝ f x m := rfl theorem pderivCLM_eq_lineDeriv (m : E) (f : 𝓢(E, F)) (x : E) : pderivCLM 𝕜 m f x = lineDeriv ℝ f x m := by simp only [pderivCLM_apply, f.differentiableAt.lineDeriv_eq_fderiv] /-- The iterated partial derivative (or directional derivative) as a continuous linear map on Schwartz space. -/ def iteratedPDeriv {n : ℕ} : (Fin n → E) → 𝓢(E, F) →L[𝕜] 𝓢(E, F) := Nat.recOn n (fun _ => ContinuousLinearMap.id 𝕜 _) fun _ rec x => (pderivCLM 𝕜 (x 0)).comp (rec (Fin.tail x)) @[simp] theorem iteratedPDeriv_zero (m : Fin 0 → E) (f : 𝓢(E, F)) : iteratedPDeriv 𝕜 m f = f := rfl @[simp] theorem iteratedPDeriv_one (m : Fin 1 → E) (f : 𝓢(E, F)) : iteratedPDeriv 𝕜 m f = pderivCLM 𝕜 (m 0) f := rfl theorem iteratedPDeriv_succ_left {n : ℕ} (m : Fin (n + 1) → E) (f : 𝓢(E, F)) : iteratedPDeriv 𝕜 m f = pderivCLM 𝕜 (m 0) (iteratedPDeriv 𝕜 (Fin.tail m) f) := rfl theorem iteratedPDeriv_succ_right {n : ℕ} (m : Fin (n + 1) → E) (f : 𝓢(E, F)) : iteratedPDeriv 𝕜 m f = iteratedPDeriv 𝕜 (Fin.init m) (pderivCLM 𝕜 (m (Fin.last n)) f) := by induction' n with n IH · rw [iteratedPDeriv_zero, iteratedPDeriv_one] rfl -- The proof is `∂^{n + 2} = ∂ ∂^{n + 1} = ∂ ∂^n ∂ = ∂^{n+1} ∂` have hmzero : Fin.init m 0 = m 0 := by simp only [Fin.init_def, Fin.castSucc_zero] have hmtail : Fin.tail m (Fin.last n) = m (Fin.last n.succ) := by simp only [Fin.tail_def, Fin.succ_last] calc _ = pderivCLM 𝕜 (m 0) (iteratedPDeriv 𝕜 _ f) := iteratedPDeriv_succ_left _ _ _ _ = pderivCLM 𝕜 (m 0) ((iteratedPDeriv 𝕜 _) ((pderivCLM 𝕜 _) f)) := by congr 1 exact IH _ _ = _ := by simp only [hmtail, iteratedPDeriv_succ_left, hmzero, Fin.tail_init_eq_init_tail] theorem iteratedPDeriv_eq_iteratedFDeriv {n : ℕ} {m : Fin n → E} {f : 𝓢(E, F)} {x : E} : iteratedPDeriv 𝕜 m f x = iteratedFDeriv ℝ n f x m := by induction n generalizing x with | zero => simp | succ n ih => simp only [iteratedPDeriv_succ_left, iteratedFDeriv_succ_apply_left] rw [← fderiv_continuousMultilinear_apply_const_apply] · simp [← ih] · exact f.smooth'.differentiable_iteratedFDeriv (WithTop.coe_lt_top n) _ end Derivatives section Integration /-! ### Integration -/ open Real Complex Filter MeasureTheory MeasureTheory.Measure FiniteDimensional variable [RCLike 𝕜] variable [NormedAddCommGroup D] [NormedSpace ℝ D] variable [NormedAddCommGroup V] [NormedSpace ℝ V] [NormedSpace 𝕜 V] variable [MeasurableSpace D] [BorelSpace D] [SecondCountableTopology D] variable {μ : Measure D} [hμ : HasTemperateGrowth μ] attribute [local instance 101] secondCountableTopologyEither_of_left variable (μ) in lemma integrable_pow_mul_iteratedFDeriv (f : 𝓢(D, V)) (k n : ℕ) : Integrable (fun x ↦ ‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖) μ := integrable_of_le_of_pow_mul_le (norm_iteratedFDeriv_le_seminorm ℝ _ _) (le_seminorm ℝ _ _ _) ((f.smooth ⊤).continuous_iteratedFDeriv le_top).aestronglyMeasurable variable (μ) in lemma integrable_pow_mul (f : 𝓢(D, V)) (k : ℕ) : Integrable (fun x ↦ ‖x‖ ^ k * ‖f x‖) μ := by convert integrable_pow_mul_iteratedFDeriv μ f k 0 with x simp variable (𝕜 μ) in lemma integral_pow_mul_iteratedFDeriv_le (f : 𝓢(D, V)) (k n : ℕ) : ∫ x, ‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖ ∂μ ≤ 2 ^ μ.integrablePower * (∫ x, (1 + ‖x‖) ^ (- (μ.integrablePower : ℝ)) ∂μ) * (SchwartzMap.seminorm 𝕜 0 n f + SchwartzMap.seminorm 𝕜 (k + μ.integrablePower) n f) := integral_pow_mul_le_of_le_of_pow_mul_le (norm_iteratedFDeriv_le_seminorm ℝ _ _) (le_seminorm ℝ _ _ _) lemma integrable (f : 𝓢(D, V)) : Integrable f μ := (f.integrable_pow_mul μ 0).mono f.continuous.aestronglyMeasurable (eventually_of_forall (fun _ ↦ by simp)) variable (𝕜 μ) in /-- The integral as a continuous linear map from Schwartz space to the codomain. -/ def integralCLM : 𝓢(D, V) →L[𝕜] V := mkCLMtoNormedSpace (∫ x, · x ∂μ) (fun f g ↦ by exact integral_add f.integrable g.integrable) (integral_smul · ·) (by rcases hμ.exists_integrable with ⟨n, h⟩ let m := (n, 0) use Finset.Iic m, 2 ^ n * ∫ x : D, (1 + ‖x‖) ^ (- (n : ℝ)) ∂μ refine ⟨by positivity, fun f ↦ (norm_integral_le_integral_norm f).trans ?_⟩ have h' : ∀ x, ‖f x‖ ≤ (1 + ‖x‖) ^ (-(n : ℝ)) * (2 ^ n * ((Finset.Iic m).sup (fun m' => SchwartzMap.seminorm 𝕜 m'.1 m'.2) f)) := by intro x rw [rpow_neg (by positivity), ← div_eq_inv_mul, le_div_iff' (by positivity), rpow_natCast] simpa using one_add_le_sup_seminorm_apply (m := m) (k := n) (n := 0) le_rfl le_rfl f x apply (integral_mono (by simpa using f.integrable_pow_mul μ 0) _ h').trans · rw [integral_mul_right, ← mul_assoc, mul_comm (2 ^ n)] rfl apply h.mul_const) variable (𝕜) in @[simp] lemma integralCLM_apply (f : 𝓢(D, V)) : integralCLM 𝕜 μ f = ∫ x, f x ∂μ := by rfl end Integration section BoundedContinuousFunction /-! ### Inclusion into the space of bounded continuous functions -/ open scoped BoundedContinuousFunction instance instBoundedContinuousMapClass : BoundedContinuousMapClass 𝓢(E, F) E F where __ := instContinuousMapClass map_bounded := fun f ↦ ⟨2 * (SchwartzMap.seminorm ℝ 0 0) f, (BoundedContinuousFunction.dist_le_two_norm' (norm_le_seminorm ℝ f))⟩ /-- Schwartz functions as bounded continuous functions -/ def toBoundedContinuousFunction (f : 𝓢(E, F)) : E →ᵇ F := BoundedContinuousFunction.ofNormedAddCommGroup f (SchwartzMap.continuous f) (SchwartzMap.seminorm ℝ 0 0 f) (norm_le_seminorm ℝ f) @[simp] theorem toBoundedContinuousFunction_apply (f : 𝓢(E, F)) (x : E) : f.toBoundedContinuousFunction x = f x := rfl /-- Schwartz functions as continuous functions -/ def toContinuousMap (f : 𝓢(E, F)) : C(E, F) := f.toBoundedContinuousFunction.toContinuousMap variable (𝕜 E F) variable [RCLike 𝕜] [NormedSpace 𝕜 F] [SMulCommClass ℝ 𝕜 F] /-- The inclusion map from Schwartz functions to bounded continuous functions as a continuous linear map. -/ def toBoundedContinuousFunctionCLM : 𝓢(E, F) →L[𝕜] E →ᵇ F := mkCLMtoNormedSpace toBoundedContinuousFunction (by intro f g; ext; exact add_apply) (by intro a f; ext; exact smul_apply) (⟨{0}, 1, zero_le_one, by simpa [BoundedContinuousFunction.norm_le (apply_nonneg _ _)] using norm_le_seminorm 𝕜 ⟩) @[simp] theorem toBoundedContinuousFunctionCLM_apply (f : 𝓢(E, F)) (x : E) : toBoundedContinuousFunctionCLM 𝕜 E F f x = f x := rfl variable {E} section DiracDelta /-- The Dirac delta distribution -/ def delta (x : E) : 𝓢(E, F) →L[𝕜] F := (BoundedContinuousFunction.evalCLM 𝕜 x).comp (toBoundedContinuousFunctionCLM 𝕜 E F) @[simp] theorem delta_apply (x₀ : E) (f : 𝓢(E, F)) : delta 𝕜 F x₀ f = f x₀ := rfl open MeasureTheory MeasureTheory.Measure variable [MeasurableSpace E] [BorelSpace E] [SecondCountableTopology E] [CompleteSpace F] /-- Integrating against the Dirac measure is equal to the delta distribution. -/ @[simp] theorem integralCLM_dirac_eq_delta (x : E) : integralCLM 𝕜 (dirac x) = delta 𝕜 F x := by aesop end DiracDelta end BoundedContinuousFunction section ZeroAtInfty open scoped ZeroAtInfty variable [ProperSpace E] instance instZeroAtInftyContinuousMapClass : ZeroAtInftyContinuousMapClass 𝓢(E, F) E F where __ := instContinuousMapClass zero_at_infty := by intro f apply zero_at_infty_of_norm_le intro ε hε use (SchwartzMap.seminorm ℝ 1 0) f / ε intro x hx rw [div_lt_iff hε] at hx have hxpos : 0 < ‖x‖ := by rw [norm_pos_iff'] intro hxzero simp only [hxzero, norm_zero, zero_mul, ← not_le] at hx exact hx (apply_nonneg (SchwartzMap.seminorm ℝ 1 0) f) have := norm_pow_mul_le_seminorm ℝ f 1 x rw [pow_one, ← le_div_iff' hxpos] at this apply lt_of_le_of_lt this rwa [div_lt_iff' hxpos] /-- Schwartz functions as continuous functions vanishing at infinity. -/ def toZeroAtInfty (f : 𝓢(E, F)) : C₀(E, F) where toFun := f zero_at_infty' := zero_at_infty f @[simp] theorem toZeroAtInfty_apply (f : 𝓢(E, F)) (x : E) : f.toZeroAtInfty x = f x := rfl @[simp] theorem toZeroAtInfty_toBCF (f : 𝓢(E, F)) : f.toZeroAtInfty.toBCF = f.toBoundedContinuousFunction := rfl variable (𝕜 E F) variable [RCLike 𝕜] [NormedSpace 𝕜 F] [SMulCommClass ℝ 𝕜 F] /-- The inclusion map from Schwartz functions to continuous functions vanishing at infinity as a continuous linear map. -/ def toZeroAtInftyCLM : 𝓢(E, F) →L[𝕜] C₀(E, F) := mkCLMtoNormedSpace toZeroAtInfty (by intro f g; ext; exact add_apply) (by intro a f; ext; exact smul_apply) (⟨{0}, 1, zero_le_one, by simpa [← ZeroAtInftyContinuousMap.norm_toBCF_eq_norm, BoundedContinuousFunction.norm_le (apply_nonneg _ _)] using norm_le_seminorm 𝕜 ⟩) @[simp] theorem toZeroAtInftyCLM_apply (f : 𝓢(E, F)) (x : E) : toZeroAtInftyCLM 𝕜 E F f x = f x := rfl end ZeroAtInfty end SchwartzMap
Analysis\Fourier\AddCircle.lean
/- Copyright (c) 2021 Heather Macbeth. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Heather Macbeth, David Loeffler -/ import Mathlib.Analysis.SpecialFunctions.ExpDeriv import Mathlib.Analysis.SpecialFunctions.Complex.Circle import Mathlib.Analysis.InnerProductSpace.l2Space import Mathlib.MeasureTheory.Function.ContinuousMapDense import Mathlib.MeasureTheory.Function.L2Space import Mathlib.MeasureTheory.Group.Integral import Mathlib.MeasureTheory.Integral.Periodic import Mathlib.Topology.ContinuousFunction.StoneWeierstrass import Mathlib.MeasureTheory.Integral.FundThmCalculus /-! # Fourier analysis on the additive circle This file contains basic results on Fourier series for functions on the additive circle `AddCircle T = ℝ / ℤ • T`. ## Main definitions * `haarAddCircle`, Haar measure on `AddCircle T`, normalized to have total measure `1`. (Note that this is not the same normalisation as the standard measure defined in `Integral.Periodic`, so we do not declare it as a `MeasureSpace` instance, to avoid confusion.) * for `n : ℤ`, `fourier n` is the monomial `fun x => exp (2 π i n x / T)`, bundled as a continuous map from `AddCircle T` to `ℂ`. * `fourierBasis` is the Hilbert basis of `Lp ℂ 2 haarAddCircle` given by the images of the monomials `fourier n`. * `fourierCoeff f n`, for `f : AddCircle T → E` (with `E` a complete normed `ℂ`-vector space), is the `n`-th Fourier coefficient of `f`, defined as an integral over `AddCircle T`. The lemma `fourierCoeff_eq_intervalIntegral` expresses this as an integral over `[a, a + T]` for any real `a`. * `fourierCoeffOn`, for `f : ℝ → E` and `a < b` reals, is the `n`-th Fourier coefficient of the unique periodic function of period `b - a` which agrees with `f` on `(a, b]`. The lemma `fourierCoeffOn_eq_integral` expresses this as an integral over `[a, b]`. ## Main statements The theorem `span_fourier_closure_eq_top` states that the span of the monomials `fourier n` is dense in `C(AddCircle T, ℂ)`, i.e. that its `Submodule.topologicalClosure` is `⊤`. This follows from the Stone-Weierstrass theorem after checking that the span is a subalgebra, is closed under conjugation, and separates points. Using this and general theory on approximation of Lᵖ functions by continuous functions, we deduce (`span_fourierLp_closure_eq_top`) that for any `1 ≤ p < ∞`, the span of the Fourier monomials is dense in the Lᵖ space of `AddCircle T`. For `p = 2` we show (`orthonormal_fourier`) that the monomials are also orthonormal, so they form a Hilbert basis for L², which is named as `fourierBasis`; in particular, for `L²` functions `f`, the Fourier series of `f` converges to `f` in the `L²` topology (`hasSum_fourier_series_L2`). Parseval's identity, `tsum_sq_fourierCoeff`, is a direct consequence. For continuous maps `f : AddCircle T → ℂ`, the theorem `hasSum_fourier_series_of_summable` states that if the sequence of Fourier coefficients of `f` is summable, then the Fourier series `∑ (i : ℤ), fourierCoeff f i * fourier i` converges to `f` in the uniform-convergence topology of `C(AddCircle T, ℂ)`. -/ noncomputable section open scoped ENNReal ComplexConjugate Real open TopologicalSpace ContinuousMap MeasureTheory MeasureTheory.Measure Algebra Submodule Set variable {T : ℝ} namespace AddCircle /-! ### Measure on `AddCircle T` In this file we use the Haar measure on `AddCircle T` normalised to have total measure 1 (which is **not** the same as the standard measure defined in `Topology.Instances.AddCircle`). -/ variable [hT : Fact (0 < T)] /-- Haar measure on the additive circle, normalised to have total measure 1. -/ def haarAddCircle : Measure (AddCircle T) := addHaarMeasure ⊤ -- Porting note: was `deriving IsAddHaarMeasure` on `haarAddCircle` instance : IsAddHaarMeasure (@haarAddCircle T _) := Measure.isAddHaarMeasure_addHaarMeasure ⊤ instance : IsProbabilityMeasure (@haarAddCircle T _) := IsProbabilityMeasure.mk addHaarMeasure_self theorem volume_eq_smul_haarAddCircle : (volume : Measure (AddCircle T)) = ENNReal.ofReal T • (@haarAddCircle T _) := rfl end AddCircle open AddCircle section Monomials /-- The family of exponential monomials `fun x => exp (2 π i n x / T)`, parametrized by `n : ℤ` and considered as bundled continuous maps from `ℝ / ℤ • T` to `ℂ`. -/ def fourier (n : ℤ) : C(AddCircle T, ℂ) where toFun x := toCircle (n • x :) continuous_toFun := continuous_induced_dom.comp <| continuous_toCircle.comp <| continuous_zsmul _ @[simp] theorem fourier_apply {n : ℤ} {x : AddCircle T} : fourier n x = toCircle (n • x :) := rfl -- @[simp] -- Porting note: simp normal form is `fourier_coe_apply'` theorem fourier_coe_apply {n : ℤ} {x : ℝ} : fourier n (x : AddCircle T) = Complex.exp (2 * π * Complex.I * n * x / T) := by rw [fourier_apply, ← QuotientAddGroup.mk_zsmul, toCircle, Function.Periodic.lift_coe, expMapCircle_apply, Complex.ofReal_mul, Complex.ofReal_div, Complex.ofReal_mul, zsmul_eq_mul, Complex.ofReal_mul, Complex.ofReal_intCast] norm_num congr 1; ring @[simp] theorem fourier_coe_apply' {n : ℤ} {x : ℝ} : toCircle (n • (x : AddCircle T) :) = Complex.exp (2 * π * Complex.I * n * x / T) := by rw [← fourier_apply]; exact fourier_coe_apply -- @[simp] -- Porting note: simp normal form is `fourier_zero'` theorem fourier_zero {x : AddCircle T} : fourier 0 x = 1 := by induction x using QuotientAddGroup.induction_on simp only [fourier_coe_apply] norm_num @[simp] theorem fourier_zero' {x : AddCircle T} : @toCircle T 0 = (1 : ℂ) := by have : fourier 0 x = @toCircle T 0 := by rw [fourier_apply, zero_smul] rw [← this]; exact fourier_zero -- @[simp] -- Porting note: simp normal form is *also* `fourier_zero'` theorem fourier_eval_zero (n : ℤ) : fourier n (0 : AddCircle T) = 1 := by rw [← QuotientAddGroup.mk_zero, fourier_coe_apply, Complex.ofReal_zero, mul_zero, zero_div, Complex.exp_zero] -- @[simp] -- Porting note (#10618): simp can prove this theorem fourier_one {x : AddCircle T} : fourier 1 x = toCircle x := by rw [fourier_apply, one_zsmul] -- @[simp] -- Porting note: simp normal form is `fourier_neg'` theorem fourier_neg {n : ℤ} {x : AddCircle T} : fourier (-n) x = conj (fourier n x) := by induction x using QuotientAddGroup.induction_on simp_rw [fourier_apply, toCircle] rw [← QuotientAddGroup.mk_zsmul, ← QuotientAddGroup.mk_zsmul] simp_rw [Function.Periodic.lift_coe, ← coe_inv_circle_eq_conj, ← expMapCircle_neg, neg_smul, mul_neg] @[simp] theorem fourier_neg' {n : ℤ} {x : AddCircle T} : @toCircle T (-(n • x)) = conj (fourier n x) := by rw [← neg_smul, ← fourier_apply]; exact fourier_neg -- @[simp] -- Porting note: simp normal form is `fourier_add'` theorem fourier_add {m n : ℤ} {x : AddCircle T} : fourier (m+n) x = fourier m x * fourier n x := by simp_rw [fourier_apply, add_zsmul, toCircle_add, coe_mul_unitSphere] @[simp] theorem fourier_add' {m n : ℤ} {x : AddCircle T} : toCircle ((m + n) • x :) = fourier m x * fourier n x := by rw [← fourier_apply]; exact fourier_add theorem fourier_norm [Fact (0 < T)] (n : ℤ) : ‖@fourier T n‖ = 1 := by rw [ContinuousMap.norm_eq_iSup_norm] have : ∀ x : AddCircle T, ‖fourier n x‖ = 1 := fun x => abs_coe_circle _ simp_rw [this] exact @ciSup_const _ _ _ Zero.instNonempty _ /-- For `n ≠ 0`, a translation by `T / 2 / n` negates the function `fourier n`. -/ theorem fourier_add_half_inv_index {n : ℤ} (hn : n ≠ 0) (hT : 0 < T) (x : AddCircle T) : @fourier T n (x + ↑(T / 2 / n)) = -fourier n x := by rw [fourier_apply, zsmul_add, ← QuotientAddGroup.mk_zsmul, toCircle_add, coe_mul_unitSphere] have : (n : ℂ) ≠ 0 := by simpa using hn have : (@toCircle T (n • (T / 2 / n) : ℝ) : ℂ) = -1 := by rw [zsmul_eq_mul, toCircle, Function.Periodic.lift_coe, expMapCircle_apply] replace hT := Complex.ofReal_ne_zero.mpr hT.ne' convert Complex.exp_pi_mul_I using 3 field_simp; ring rw [this]; simp /-- The star subalgebra of `C(AddCircle T, ℂ)` generated by `fourier n` for `n ∈ ℤ` . -/ def fourierSubalgebra : StarSubalgebra ℂ C(AddCircle T, ℂ) where toSubalgebra := Algebra.adjoin ℂ (range fourier) star_mem' := by show Algebra.adjoin ℂ (range (fourier (T := T))) ≤ star (Algebra.adjoin ℂ (range (fourier (T := T)))) refine adjoin_le ?_ rintro - ⟨n, rfl⟩ exact subset_adjoin ⟨-n, ext fun _ => fourier_neg⟩ /-- The star subalgebra of `C(AddCircle T, ℂ)` generated by `fourier n` for `n ∈ ℤ` is in fact the linear span of these functions. -/ theorem fourierSubalgebra_coe : Subalgebra.toSubmodule (@fourierSubalgebra T).toSubalgebra = span ℂ (range (@fourier T)) := by apply adjoin_eq_span_of_subset refine Subset.trans ?_ Submodule.subset_span intro x hx refine Submonoid.closure_induction hx (fun _ => id) ⟨0, ?_⟩ ?_ · ext1 z; exact fourier_zero · rintro _ _ ⟨m, rfl⟩ ⟨n, rfl⟩ refine ⟨m + n, ?_⟩ ext1 z exact fourier_add /- a post-port refactor made `fourierSubalgebra` into a `StarSubalgebra`, and eliminated `conjInvariantSubalgebra` entirely, making this lemma irrelevant. -/ variable [hT : Fact (0 < T)] /-- The subalgebra of `C(AddCircle T, ℂ)` generated by `fourier n` for `n ∈ ℤ` separates points. -/ theorem fourierSubalgebra_separatesPoints : (@fourierSubalgebra T).SeparatesPoints := by intro x y hxy refine ⟨_, ⟨fourier 1, subset_adjoin ⟨1, rfl⟩, rfl⟩, ?_⟩ dsimp only; rw [fourier_one, fourier_one] contrapose! hxy rw [Subtype.coe_inj] at hxy exact injective_toCircle hT.elim.ne' hxy /-- The subalgebra of `C(AddCircle T, ℂ)` generated by `fourier n` for `n ∈ ℤ` is dense. -/ theorem fourierSubalgebra_closure_eq_top : (@fourierSubalgebra T).topologicalClosure = ⊤ := ContinuousMap.starSubalgebra_topologicalClosure_eq_top_of_separatesPoints fourierSubalgebra fourierSubalgebra_separatesPoints /-- The linear span of the monomials `fourier n` is dense in `C(AddCircle T, ℂ)`. -/ theorem span_fourier_closure_eq_top : (span ℂ (range <| @fourier T)).topologicalClosure = ⊤ := by rw [← fourierSubalgebra_coe] exact congr_arg (Subalgebra.toSubmodule <| StarSubalgebra.toSubalgebra ·) fourierSubalgebra_closure_eq_top /-- The family of monomials `fourier n`, parametrized by `n : ℤ` and considered as elements of the `Lp` space of functions `AddCircle T → ℂ`. -/ abbrev fourierLp (p : ℝ≥0∞) [Fact (1 ≤ p)] (n : ℤ) : Lp ℂ p (@haarAddCircle T hT) := toLp (E := ℂ) p haarAddCircle ℂ (fourier n) theorem coeFn_fourierLp (p : ℝ≥0∞) [Fact (1 ≤ p)] (n : ℤ) : @fourierLp T hT p _ n =ᵐ[haarAddCircle] fourier n := coeFn_toLp haarAddCircle (fourier n) /-- For each `1 ≤ p < ∞`, the linear span of the monomials `fourier n` is dense in `Lp ℂ p haarAddCircle`. -/ theorem span_fourierLp_closure_eq_top {p : ℝ≥0∞} [Fact (1 ≤ p)] (hp : p ≠ ∞) : (span ℂ (range (@fourierLp T _ p _))).topologicalClosure = ⊤ := by convert (ContinuousMap.toLp_denseRange ℂ (@haarAddCircle T hT) hp ℂ).topologicalClosure_map_submodule span_fourier_closure_eq_top erw [map_span, range_comp] simp only [ContinuousLinearMap.coe_coe] /-- The monomials `fourier n` are an orthonormal set with respect to normalised Haar measure. -/ theorem orthonormal_fourier : Orthonormal ℂ (@fourierLp T _ 2 _) := by rw [orthonormal_iff_ite] intro i j rw [ContinuousMap.inner_toLp (@haarAddCircle T hT) (fourier i) (fourier j)] simp_rw [← fourier_neg, ← fourier_add] split_ifs with h · simp_rw [h, neg_add_self] have : ⇑(@fourier T 0) = (fun _ => 1 : AddCircle T → ℂ) := by ext1; exact fourier_zero rw [this, integral_const, measure_univ, ENNReal.one_toReal, Complex.real_smul, Complex.ofReal_one, mul_one] have hij : -i + j ≠ 0 := by rw [add_comm] exact sub_ne_zero.mpr (Ne.symm h) convert integral_eq_zero_of_add_right_eq_neg (μ := haarAddCircle) (fourier_add_half_inv_index hij hT.elim) end Monomials section ScopeHT -- everything from here on needs `0 < T` variable [hT : Fact (0 < T)] section fourierCoeff variable {E : Type} [NormedAddCommGroup E] [NormedSpace ℂ E] [CompleteSpace E] /-- The `n`-th Fourier coefficient of a function `AddCircle T → E`, for `E` a complete normed `ℂ`-vector space, defined as the integral over `AddCircle T` of `fourier (-n) t • f t`. -/ def fourierCoeff (f : AddCircle T → E) (n : ℤ) : E := ∫ t : AddCircle T, fourier (-n) t • f t ∂haarAddCircle /-- The Fourier coefficients of a function on `AddCircle T` can be computed as an integral over `[a, a + T]`, for any real `a`. -/ theorem fourierCoeff_eq_intervalIntegral (f : AddCircle T → E) (n : ℤ) (a : ℝ) : fourierCoeff f n = (1 / T) • ∫ x in a..a + T, @fourier T (-n) x • f x := by have : ∀ x : ℝ, @fourier T (-n) x • f x = (fun z : AddCircle T => @fourier T (-n) z • f z) x := by intro x; rfl -- After leanprover/lean4#3124, we need to add `singlePass := true` to avoid an infinite loop. simp_rw (config := {singlePass := true}) [this] rw [fourierCoeff, AddCircle.intervalIntegral_preimage T a (fun z => _ • _), volume_eq_smul_haarAddCircle, integral_smul_measure, ENNReal.toReal_ofReal hT.out.le, ← smul_assoc, smul_eq_mul, one_div_mul_cancel hT.out.ne', one_smul] theorem fourierCoeff.const_smul (f : AddCircle T → E) (c : ℂ) (n : ℤ) : fourierCoeff (c • f :) n = c • fourierCoeff f n := by simp_rw [fourierCoeff, Pi.smul_apply, ← smul_assoc, smul_eq_mul, mul_comm, ← smul_eq_mul, smul_assoc, integral_smul] theorem fourierCoeff.const_mul (f : AddCircle T → ℂ) (c : ℂ) (n : ℤ) : fourierCoeff (fun x => c * f x) n = c * fourierCoeff f n := fourierCoeff.const_smul f c n /-- For a function on `ℝ`, the Fourier coefficients of `f` on `[a, b]` are defined as the Fourier coefficients of the unique periodic function agreeing with `f` on `Ioc a b`. -/ def fourierCoeffOn {a b : ℝ} (hab : a < b) (f : ℝ → E) (n : ℤ) : E := haveI := Fact.mk (by linarith : 0 < b - a) fourierCoeff (AddCircle.liftIoc (b - a) a f) n theorem fourierCoeffOn_eq_integral {a b : ℝ} (f : ℝ → E) (n : ℤ) (hab : a < b) : fourierCoeffOn hab f n = (1 / (b - a)) • ∫ x in a..b, fourier (-n) (x : AddCircle (b - a)) • f x := by haveI := Fact.mk (by linarith : 0 < b - a) rw [fourierCoeffOn, fourierCoeff_eq_intervalIntegral _ _ a, add_sub, add_sub_cancel_left] congr 1 simp_rw [intervalIntegral.integral_of_le hab.le] refine setIntegral_congr measurableSet_Ioc fun x hx => ?_ rw [liftIoc_coe_apply] rwa [add_sub, add_sub_cancel_left] theorem fourierCoeffOn.const_smul {a b : ℝ} (f : ℝ → E) (c : ℂ) (n : ℤ) (hab : a < b) : fourierCoeffOn hab (c • f) n = c • fourierCoeffOn hab f n := by haveI := Fact.mk (by linarith : 0 < b - a) apply fourierCoeff.const_smul theorem fourierCoeffOn.const_mul {a b : ℝ} (f : ℝ → ℂ) (c : ℂ) (n : ℤ) (hab : a < b) : fourierCoeffOn hab (fun x => c * f x) n = c * fourierCoeffOn hab f n := fourierCoeffOn.const_smul _ _ _ _ theorem fourierCoeff_liftIoc_eq {a : ℝ} (f : ℝ → ℂ) (n : ℤ) : fourierCoeff (AddCircle.liftIoc T a f) n = fourierCoeffOn (lt_add_of_pos_right a hT.out) f n := by rw [fourierCoeffOn_eq_integral, fourierCoeff_eq_intervalIntegral, add_sub_cancel_left a T] · congr 1 refine intervalIntegral.integral_congr_ae (ae_of_all _ fun x hx => ?_) rw [liftIoc_coe_apply] rwa [uIoc_of_le (lt_add_of_pos_right a hT.out).le] at hx theorem fourierCoeff_liftIco_eq {a : ℝ} (f : ℝ → ℂ) (n : ℤ) : fourierCoeff (AddCircle.liftIco T a f) n = fourierCoeffOn (lt_add_of_pos_right a hT.out) f n := by rw [fourierCoeffOn_eq_integral, fourierCoeff_eq_intervalIntegral _ _ a, add_sub_cancel_left a T] congr 1 simp_rw [intervalIntegral.integral_of_le (lt_add_of_pos_right a hT.out).le] iterate 2 rw [integral_Ioc_eq_integral_Ioo] refine setIntegral_congr measurableSet_Ioo fun x hx => ?_ rw [liftIco_coe_apply (Ioo_subset_Ico_self hx)] end fourierCoeff section FourierL2 /-- We define `fourierBasis` to be a `ℤ`-indexed Hilbert basis for `Lp ℂ 2 haarAddCircle`, which by definition is an isometric isomorphism from `Lp ℂ 2 haarAddCircle` to `ℓ²(ℤ, ℂ)`. -/ def fourierBasis : HilbertBasis ℤ ℂ (Lp ℂ 2 <| @haarAddCircle T hT) := HilbertBasis.mk orthonormal_fourier (span_fourierLp_closure_eq_top (by norm_num)).ge /-- The elements of the Hilbert basis `fourierBasis` are the functions `fourierLp 2`, i.e. the monomials `fourier n` on the circle considered as elements of `L²`. -/ @[simp] theorem coe_fourierBasis : ⇑(@fourierBasis T hT) = @fourierLp T hT 2 _ := HilbertBasis.coe_mk _ _ /-- Under the isometric isomorphism `fourierBasis` from `Lp ℂ 2 haarAddCircle` to `ℓ²(ℤ, ℂ)`, the `i`-th coefficient is `fourierCoeff f i`, i.e., the integral over `AddCircle T` of `fun t => fourier (-i) t * f t` with respect to the Haar measure of total mass 1. -/ theorem fourierBasis_repr (f : Lp ℂ 2 <| @haarAddCircle T hT) (i : ℤ) : fourierBasis.repr f i = fourierCoeff f i := by trans ∫ t : AddCircle T, conj ((@fourierLp T hT 2 _ i : AddCircle T → ℂ) t) * f t ∂haarAddCircle · rw [fourierBasis.repr_apply_apply f i, MeasureTheory.L2.inner_def, coe_fourierBasis] simp only [RCLike.inner_apply] · apply integral_congr_ae filter_upwards [coeFn_fourierLp 2 i] with _ ht rw [ht, ← fourier_neg, smul_eq_mul] /-- The Fourier series of an `L2` function `f` sums to `f`, in the `L²` space of `AddCircle T`. -/ theorem hasSum_fourier_series_L2 (f : Lp ℂ 2 <| @haarAddCircle T hT) : HasSum (fun i => fourierCoeff f i • fourierLp 2 i) f := by simp_rw [← fourierBasis_repr]; rw [← coe_fourierBasis] exact HilbertBasis.hasSum_repr fourierBasis f /-- **Parseval's identity**: for an `L²` function `f` on `AddCircle T`, the sum of the squared norms of the Fourier coefficients equals the `L²` norm of `f`. -/ theorem tsum_sq_fourierCoeff (f : Lp ℂ 2 <| @haarAddCircle T hT) : ∑' i : ℤ, ‖fourierCoeff f i‖ ^ 2 = ∫ t : AddCircle T, ‖f t‖ ^ 2 ∂haarAddCircle := by simp_rw [← fourierBasis_repr] have H₁ : ‖fourierBasis.repr f‖ ^ 2 = ∑' i, ‖fourierBasis.repr f i‖ ^ 2 := by apply_mod_cast lp.norm_rpow_eq_tsum ?_ (fourierBasis.repr f) norm_num have H₂ : ‖fourierBasis.repr f‖ ^ 2 = ‖f‖ ^ 2 := by simp have H₃ := congr_arg RCLike.re (@L2.inner_def (AddCircle T) ℂ ℂ _ _ _ _ _ f f) rw [← integral_re] at H₃ · simp only [← norm_sq_eq_inner] at H₃ rw [← H₁, H₂, H₃] · exact L2.integrable_inner f f end FourierL2 section Convergence variable (f : C(AddCircle T, ℂ)) theorem fourierCoeff_toLp (n : ℤ) : fourierCoeff (toLp (E := ℂ) 2 haarAddCircle ℂ f) n = fourierCoeff f n := integral_congr_ae (Filter.EventuallyEq.mul (Filter.eventually_of_forall (by tauto)) (ContinuousMap.coeFn_toAEEqFun haarAddCircle f)) variable {f} /-- If the sequence of Fourier coefficients of `f` is summable, then the Fourier series converges uniformly to `f`. -/ theorem hasSum_fourier_series_of_summable (h : Summable (fourierCoeff f)) : HasSum (fun i => fourierCoeff f i • fourier i) f := by have sum_L2 := hasSum_fourier_series_L2 (toLp (E := ℂ) 2 haarAddCircle ℂ f) simp_rw [fourierCoeff_toLp] at sum_L2 refine ContinuousMap.hasSum_of_hasSum_Lp (.of_norm ?_) sum_L2 simp_rw [norm_smul, fourier_norm, mul_one] exact h.norm /-- If the sequence of Fourier coefficients of `f` is summable, then the Fourier series of `f` converges everywhere pointwise to `f`. -/ theorem has_pointwise_sum_fourier_series_of_summable (h : Summable (fourierCoeff f)) (x : AddCircle T) : HasSum (fun i => fourierCoeff f i • fourier i x) (f x) := by convert (ContinuousMap.evalCLM ℂ x).hasSum (hasSum_fourier_series_of_summable h) end Convergence end ScopeHT section deriv open Complex intervalIntegral open scoped Interval variable (T) theorem hasDerivAt_fourier (n : ℤ) (x : ℝ) : HasDerivAt (fun y : ℝ => fourier n (y : AddCircle T)) (2 * π * I * n / T * fourier n (x : AddCircle T)) x := by simp_rw [fourier_coe_apply] refine (?_ : HasDerivAt (fun y => exp (2 * π * I * n * y / T)) _ _).comp_ofReal rw [(fun α β => by ring : ∀ α β : ℂ, α * exp β = exp β * α)] refine (hasDerivAt_exp _).comp (x : ℂ) ?_ convert hasDerivAt_mul_const (2 * ↑π * I * ↑n / T) using 1 ext1 y; ring theorem hasDerivAt_fourier_neg (n : ℤ) (x : ℝ) : HasDerivAt (fun y : ℝ => fourier (-n) (y : AddCircle T)) (-2 * π * I * n / T * fourier (-n) (x : AddCircle T)) x := by simpa using hasDerivAt_fourier T (-n) x variable {T} theorem has_antideriv_at_fourier_neg (hT : Fact (0 < T)) {n : ℤ} (hn : n ≠ 0) (x : ℝ) : HasDerivAt (fun y : ℝ => (T : ℂ) / (-2 * π * I * n) * fourier (-n) (y : AddCircle T)) (fourier (-n) (x : AddCircle T)) x := by convert (hasDerivAt_fourier_neg T n x).div_const (-2 * π * I * n / T) using 1 · ext1 y; rw [div_div_eq_mul_div]; ring · simp [mul_div_cancel_left₀, hn, (Fact.out : 0 < T).ne', Real.pi_pos.ne'] /-- Express Fourier coefficients of `f` on an interval in terms of those of its derivative. -/ theorem fourierCoeffOn_of_hasDeriv_right {a b : ℝ} (hab : a < b) {f f' : ℝ → ℂ} {n : ℤ} (hn : n ≠ 0) (hf : ContinuousOn f [[a, b]]) (hff' : ∀ x, x ∈ Ioo (min a b) (max a b) → HasDerivWithinAt f (f' x) (Ioi x) x) (hf' : IntervalIntegrable f' volume a b) : fourierCoeffOn hab f n = 1 / (-2 * π * I * n) * (fourier (-n) (a : AddCircle (b - a)) * (f b - f a) - (b - a) * fourierCoeffOn hab f' n) := by rw [← ofReal_sub] have hT : Fact (0 < b - a) := ⟨by linarith⟩ simp_rw [fourierCoeffOn_eq_integral, smul_eq_mul, real_smul, ofReal_div, ofReal_one] conv => pattern (occs := 1 2 3) fourier _ _ * _ <;> (rw [mul_comm]) rw [integral_mul_deriv_eq_deriv_mul_of_hasDeriv_right hf (fun x _ ↦ has_antideriv_at_fourier_neg hT hn x |>.continuousAt |>.continuousWithinAt) hff' (fun x _ ↦ has_antideriv_at_fourier_neg hT hn x |>.hasDerivWithinAt) hf' (((map_continuous (fourier (-n))).comp (AddCircle.continuous_mk' _)).intervalIntegrable _ _)] have : ∀ u v w : ℂ, u * ((b - a : ℝ) / v * w) = (b - a : ℝ) / v * (u * w) := by intros; ring conv in intervalIntegral _ _ _ _ => congr; ext; rw [this] rw [(by ring : ((b - a : ℝ) : ℂ) / (-2 * π * I * n) = ((b - a : ℝ) : ℂ) * (1 / (-2 * π * I * n)))] have s2 : (b : AddCircle (b - a)) = (a : AddCircle (b - a)) := by simpa using coe_add_period (b - a) a rw [s2, integral_const_mul, ← sub_mul, mul_sub, mul_sub] congr 1 · conv_lhs => rw [mul_comm, mul_div, mul_one] rw [div_eq_iff (ofReal_ne_zero.mpr hT.out.ne')] ring · ring /-- Express Fourier coefficients of `f` on an interval in terms of those of its derivative. -/ theorem fourierCoeffOn_of_hasDerivAt_Ioo {a b : ℝ} (hab : a < b) {f f' : ℝ → ℂ} {n : ℤ} (hn : n ≠ 0) (hf : ContinuousOn f [[a, b]]) (hff' : ∀ x, x ∈ Ioo (min a b) (max a b) → HasDerivAt f (f' x) x) (hf' : IntervalIntegrable f' volume a b) : fourierCoeffOn hab f n = 1 / (-2 * π * I * n) * (fourier (-n) (a : AddCircle (b - a)) * (f b - f a) - (b - a) * fourierCoeffOn hab f' n) := fourierCoeffOn_of_hasDeriv_right hab hn hf (fun x hx ↦ hff' x hx |>.hasDerivWithinAt) hf' /-- Express Fourier coefficients of `f` on an interval in terms of those of its derivative. -/ theorem fourierCoeffOn_of_hasDerivAt {a b : ℝ} (hab : a < b) {f f' : ℝ → ℂ} {n : ℤ} (hn : n ≠ 0) (hf : ∀ x, x ∈ [[a, b]] → HasDerivAt f (f' x) x) (hf' : IntervalIntegrable f' volume a b) : fourierCoeffOn hab f n = 1 / (-2 * π * I * n) * (fourier (-n) (a : AddCircle (b - a)) * (f b - f a) - (b - a) * fourierCoeffOn hab f' n) := fourierCoeffOn_of_hasDerivAt_Ioo hab hn (fun x hx ↦ hf x hx |>.continuousAt.continuousWithinAt) (fun x hx ↦ hf x <| mem_Icc_of_Ioo hx) hf' end deriv
Analysis\Fourier\FourierTransform.lean
/- Copyright (c) 2023 David Loeffler. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: David Loeffler -/ import Mathlib.Analysis.Complex.Circle import Mathlib.MeasureTheory.Group.Integral import Mathlib.MeasureTheory.Integral.SetIntegral import Mathlib.MeasureTheory.Measure.Haar.OfBasis import Mathlib.MeasureTheory.Constructions.Prod.Integral import Mathlib.MeasureTheory.Measure.Haar.InnerProductSpace import Mathlib.Algebra.Group.AddChar /-! # The Fourier transform We set up the Fourier transform for complex-valued functions on finite-dimensional spaces. ## Design choices In namespace `VectorFourier`, we define the Fourier integral in the following context: * `𝕜` is a commutative ring. * `V` and `W` are `𝕜`-modules. * `e` is a unitary additive character of `𝕜`, i.e. an `AddChar 𝕜 circle`. * `μ` is a measure on `V`. * `L` is a `𝕜`-bilinear form `V × W → 𝕜`. * `E` is a complete normed `ℂ`-vector space. With these definitions, we define `fourierIntegral` to be the map from functions `V → E` to functions `W → E` that sends `f` to `fun w ↦ ∫ v in V, e (-L v w) • f v ∂μ`, This includes the cases `W` is the dual of `V` and `L` is the canonical pairing, or `W = V` and `L` is a bilinear form (e.g. an inner product). In namespace `Fourier`, we consider the more familiar special case when `V = W = 𝕜` and `L` is the multiplication map (but still allowing `𝕜` to be an arbitrary ring equipped with a measure). The most familiar case of all is when `V = W = 𝕜 = ℝ`, `L` is multiplication, `μ` is volume, and `e` is `Real.fourierChar`, i.e. the character `fun x ↦ exp ((2 * π * x) * I)` (for which we introduce the notation `𝐞` in the locale `FourierTransform`). Another familiar case (which generalizes the previous one) is when `V = W` is an inner product space over `ℝ` and `L` is the scalar product. We introduce two notations `𝓕` for the Fourier transform in this case and `𝓕⁻ f (v) = 𝓕 f (-v)` for the inverse Fourier transform. These notations make in particular sense for `V = W = ℝ`. ## Main results At present the only nontrivial lemma we prove is `fourierIntegral_continuous`, stating that the Fourier transform of an integrable function is continuous (under mild assumptions). -/ noncomputable section local notation "𝕊" => circle open MeasureTheory Filter open scoped Topology /-! ## Fourier theory for functions on general vector spaces -/ namespace VectorFourier variable {𝕜 : Type*} [CommRing 𝕜] {V : Type*} [AddCommGroup V] [Module 𝕜 V] [MeasurableSpace V] {W : Type*} [AddCommGroup W] [Module 𝕜 W] {E F G : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] [NormedAddCommGroup F] [NormedSpace ℂ F] [NormedAddCommGroup G] [NormedSpace ℂ G] section Defs /-- The Fourier transform integral for `f : V → E`, with respect to a bilinear form `L : V × W → 𝕜` and an additive character `e`. -/ def fourierIntegral (e : AddChar 𝕜 𝕊) (μ : Measure V) (L : V →ₗ[𝕜] W →ₗ[𝕜] 𝕜) (f : V → E) (w : W) : E := ∫ v, e (-L v w) • f v ∂μ theorem fourierIntegral_smul_const (e : AddChar 𝕜 𝕊) (μ : Measure V) (L : V →ₗ[𝕜] W →ₗ[𝕜] 𝕜) (f : V → E) (r : ℂ) : fourierIntegral e μ L (r • f) = r • fourierIntegral e μ L f := by ext1 w -- Porting note: was -- simp only [Pi.smul_apply, fourierIntegral, smul_comm _ r, integral_smul] simp only [Pi.smul_apply, fourierIntegral, ← integral_smul] congr 1 with v rw [smul_comm] /-- The uniform norm of the Fourier integral of `f` is bounded by the `L¹` norm of `f`. -/ theorem norm_fourierIntegral_le_integral_norm (e : AddChar 𝕜 𝕊) (μ : Measure V) (L : V →ₗ[𝕜] W →ₗ[𝕜] 𝕜) (f : V → E) (w : W) : ‖fourierIntegral e μ L f w‖ ≤ ∫ v : V, ‖f v‖ ∂μ := by refine (norm_integral_le_integral_norm _).trans (le_of_eq ?_) simp_rw [norm_circle_smul] /-- The Fourier integral converts right-translation into scalar multiplication by a phase factor. -/ theorem fourierIntegral_comp_add_right [MeasurableAdd V] (e : AddChar 𝕜 𝕊) (μ : Measure V) [μ.IsAddRightInvariant] (L : V →ₗ[𝕜] W →ₗ[𝕜] 𝕜) (f : V → E) (v₀ : V) : fourierIntegral e μ L (f ∘ fun v ↦ v + v₀) = fun w ↦ e (L v₀ w) • fourierIntegral e μ L f w := by ext1 w dsimp only [fourierIntegral, Function.comp_apply, Submonoid.smul_def] conv in L _ => rw [← add_sub_cancel_right v v₀] rw [integral_add_right_eq_self fun v : V ↦ (e (-L (v - v₀) w) : ℂ) • f v, ← integral_smul] congr 1 with v rw [← smul_assoc, smul_eq_mul, ← Submonoid.coe_mul, ← e.map_add_eq_mul, ← LinearMap.neg_apply, ← sub_eq_add_neg, ← LinearMap.sub_apply, LinearMap.map_sub, neg_sub] end Defs section Continuous /-! In this section we assume 𝕜, `V`, `W` have topologies, and `L`, `e` are continuous (but `f` needn't be). This is used to ensure that `e (-L v w)` is (a.e. strongly) measurable. We could get away with imposing only a measurable-space structure on 𝕜 (it doesn't have to be the Borel sigma-algebra of a topology); but it seems hard to imagine cases where this extra generality would be useful, and allowing it would complicate matters in the most important use cases. -/ variable [TopologicalSpace 𝕜] [TopologicalRing 𝕜] [TopologicalSpace V] [BorelSpace V] [TopologicalSpace W] {e : AddChar 𝕜 𝕊} {μ : Measure V} {L : V →ₗ[𝕜] W →ₗ[𝕜] 𝕜} /-- For any `w`, the Fourier integral is convergent iff `f` is integrable. -/ theorem fourierIntegral_convergent_iff (he : Continuous e) (hL : Continuous fun p : V × W ↦ L p.1 p.2) {f : V → E} (w : W) : Integrable (fun v : V ↦ e (-L v w) • f v) μ ↔ Integrable f μ := by -- first prove one-way implication have aux {g : V → E} (hg : Integrable g μ) (x : W) : Integrable (fun v : V ↦ e (-L v x) • g v) μ := by have c : Continuous fun v ↦ e (-L v x) := he.comp (hL.comp (continuous_prod_mk.mpr ⟨continuous_id, continuous_const⟩)).neg simp_rw [← integrable_norm_iff (c.aestronglyMeasurable.smul hg.1), norm_circle_smul] exact hg.norm -- then use it for both directions refine ⟨fun hf ↦ ?_, fun hf ↦ aux hf w⟩ have := aux hf (-w) simp_rw [← mul_smul (e _) (e _) (f _), ← e.map_add_eq_mul, LinearMap.map_neg, neg_add_self, e.map_zero_eq_one, one_smul] at this -- the `(e _)` speeds up elaboration considerably exact this @[deprecated (since := "2024-03-29")] alias fourier_integral_convergent_iff := VectorFourier.fourierIntegral_convergent_iff variable [CompleteSpace E] theorem fourierIntegral_add (he : Continuous e) (hL : Continuous fun p : V × W ↦ L p.1 p.2) {f g : V → E} (hf : Integrable f μ) (hg : Integrable g μ) : fourierIntegral e μ L f + fourierIntegral e μ L g = fourierIntegral e μ L (f + g) := by ext1 w dsimp only [Pi.add_apply, fourierIntegral] simp_rw [smul_add] rw [integral_add] · exact (fourierIntegral_convergent_iff he hL w).2 hf · exact (fourierIntegral_convergent_iff he hL w).2 hg /-- The Fourier integral of an `L^1` function is a continuous function. -/ theorem fourierIntegral_continuous [FirstCountableTopology W] (he : Continuous e) (hL : Continuous fun p : V × W ↦ L p.1 p.2) {f : V → E} (hf : Integrable f μ) : Continuous (fourierIntegral e μ L f) := by apply continuous_of_dominated · exact fun w ↦ ((fourierIntegral_convergent_iff he hL w).2 hf).1 · exact fun w ↦ ae_of_all _ fun v ↦ le_of_eq (norm_circle_smul _ _) · exact hf.norm · refine ae_of_all _ fun v ↦ (he.comp ?_).smul continuous_const exact (hL.comp (continuous_prod_mk.mpr ⟨continuous_const, continuous_id⟩)).neg end Continuous section Fubini variable [TopologicalSpace 𝕜] [TopologicalRing 𝕜] [TopologicalSpace V] [BorelSpace V] [TopologicalSpace W] [MeasurableSpace W] [BorelSpace W] {e : AddChar 𝕜 𝕊} {μ : Measure V} {L : V →ₗ[𝕜] W →ₗ[𝕜] 𝕜} {ν : Measure W} [SigmaFinite μ] [SigmaFinite ν] [SecondCountableTopology V] variable [CompleteSpace E] [CompleteSpace F] /-- The Fourier transform satisfies `∫ 𝓕 f * g = ∫ f * 𝓕 g`, i.e., it is self-adjoint. Version where the multiplication is replaced by a general bilinear form `M`. -/ theorem integral_bilin_fourierIntegral_eq_flip {f : V → E} {g : W → F} (M : E →L[ℂ] F →L[ℂ] G) (he : Continuous e) (hL : Continuous fun p : V × W ↦ L p.1 p.2) (hf : Integrable f μ) (hg : Integrable g ν) : ∫ ξ, M (fourierIntegral e μ L f ξ) (g ξ) ∂ν = ∫ x, M (f x) (fourierIntegral e ν L.flip g x) ∂μ := by by_cases hG : CompleteSpace G; swap; · simp [integral, hG] calc _ = ∫ ξ, M.flip (g ξ) (∫ x, e (-L x ξ) • f x ∂μ) ∂ν := rfl _ = ∫ ξ, (∫ x, M.flip (g ξ) (e (-L x ξ) • f x) ∂μ) ∂ν := by congr with ξ apply (ContinuousLinearMap.integral_comp_comm _ _).symm exact (fourierIntegral_convergent_iff he hL _).2 hf _ = ∫ x, (∫ ξ, M.flip (g ξ) (e (-L x ξ) • f x) ∂ν) ∂μ := by rw [integral_integral_swap] have : Integrable (fun (p : W × V) ↦ ‖M‖ * (‖g p.1‖ * ‖f p.2‖)) (ν.prod μ) := (hg.norm.prod_mul hf.norm).const_mul _ apply this.mono · -- This proof can be golfed but becomes very slow; breaking it up into steps -- speeds up compilation. change AEStronglyMeasurable (fun p : W × V ↦ (M (e (-(L p.2) p.1) • f p.2) (g p.1))) _ have A : AEStronglyMeasurable (fun (p : W × V) ↦ e (-L p.2 p.1) • f p.2) (ν.prod μ) := by refine (Continuous.aestronglyMeasurable ?_).smul hf.1.snd exact he.comp (hL.comp continuous_swap).neg have A' : AEStronglyMeasurable (fun p ↦ (g p.1, e (-(L p.2) p.1) • f p.2) : W × V → F × E) (Measure.prod ν μ) := hg.1.fst.prod_mk A have B : Continuous (fun q ↦ M q.2 q.1 : F × E → G) := M.flip.continuous₂ apply B.comp_aestronglyMeasurable A' -- `exact` works, but `apply` is 10x faster! · filter_upwards with ⟨ξ, x⟩ rw [Function.uncurry_apply_pair, Submonoid.smul_def, (M.flip (g ξ)).map_smul, ← Submonoid.smul_def, norm_circle_smul, ContinuousLinearMap.flip_apply, norm_mul, norm_norm M, norm_mul, norm_norm, norm_norm, mul_comm (‖g _‖), ← mul_assoc] exact M.le_opNorm₂ (f x) (g ξ) _ = ∫ x, (∫ ξ, M (f x) (e (-L.flip ξ x) • g ξ) ∂ν) ∂μ := by simp only [ContinuousLinearMap.flip_apply, ContinuousLinearMap.map_smul_of_tower, ContinuousLinearMap.coe_smul', Pi.smul_apply, LinearMap.flip_apply] _ = ∫ x, M (f x) (∫ ξ, e (-L.flip ξ x) • g ξ ∂ν) ∂μ := by congr with x apply ContinuousLinearMap.integral_comp_comm apply (fourierIntegral_convergent_iff he _ _).2 hg exact hL.comp continuous_swap /-- The Fourier transform satisfies `∫ 𝓕 f * g = ∫ f * 𝓕 g`, i.e., it is self-adjoint. -/ theorem integral_fourierIntegral_smul_eq_flip {f : V → ℂ} {g : W → F} (he : Continuous e) (hL : Continuous fun p : V × W ↦ L p.1 p.2) (hf : Integrable f μ) (hg : Integrable g ν) : ∫ ξ, (fourierIntegral e μ L f ξ) • (g ξ) ∂ν = ∫ x, (f x) • (fourierIntegral e ν L.flip g x) ∂μ := integral_bilin_fourierIntegral_eq_flip (ContinuousLinearMap.lsmul ℂ ℂ) he hL hf hg end Fubini end VectorFourier namespace VectorFourier variable {𝕜 ι E F V W : Type*} [Fintype ι] [NontriviallyNormedField 𝕜] [NormedAddCommGroup V] [NormedSpace 𝕜 V] [MeasurableSpace V] [BorelSpace V] [NormedAddCommGroup W] [NormedSpace 𝕜 W] [MeasurableSpace W] [BorelSpace W] {e : AddChar 𝕜 𝕊} {μ : Measure V} {L : V →L[𝕜] W →L[𝕜] 𝕜} [NormedAddCommGroup F] [NormedSpace ℝ F] [NormedAddCommGroup E] [NormedSpace ℂ E] {M : ι → Type*} [∀ i, NormedAddCommGroup (M i)] [∀ i, NormedSpace ℝ (M i)] theorem fourierIntegral_continuousLinearMap_apply {f : V → (F →L[ℝ] E)} {a : F} {w : W} (he : Continuous e) (hf : Integrable f μ) : fourierIntegral e μ L.toLinearMap₂ f w a = fourierIntegral e μ L.toLinearMap₂ (fun x ↦ f x a) w := by rw [fourierIntegral, ContinuousLinearMap.integral_apply] · rfl · apply (fourierIntegral_convergent_iff he _ _).2 hf exact L.continuous₂ theorem fourierIntegral_continuousMultilinearMap_apply {f : V → (ContinuousMultilinearMap ℝ M E)} {m : (i : ι) → M i} {w : W} (he : Continuous e) (hf : Integrable f μ) : fourierIntegral e μ L.toLinearMap₂ f w m = fourierIntegral e μ L.toLinearMap₂ (fun x ↦ f x m) w := by rw [fourierIntegral, ContinuousMultilinearMap.integral_apply] · rfl · apply (fourierIntegral_convergent_iff he _ _).2 hf exact L.continuous₂ end VectorFourier /-! ## Fourier theory for functions on `𝕜` -/ namespace Fourier variable {𝕜 : Type*} [CommRing 𝕜] [MeasurableSpace 𝕜] {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] section Defs variable [CompleteSpace E] /-- The Fourier transform integral for `f : 𝕜 → E`, with respect to the measure `μ` and additive character `e`. -/ def fourierIntegral (e : AddChar 𝕜 𝕊) (μ : Measure 𝕜) (f : 𝕜 → E) (w : 𝕜) : E := VectorFourier.fourierIntegral e μ (LinearMap.mul 𝕜 𝕜) f w theorem fourierIntegral_def (e : AddChar 𝕜 𝕊) (μ : Measure 𝕜) (f : 𝕜 → E) (w : 𝕜) : fourierIntegral e μ f w = ∫ v : 𝕜, e (-(v * w)) • f v ∂μ := rfl theorem fourierIntegral_smul_const (e : AddChar 𝕜 𝕊) (μ : Measure 𝕜) (f : 𝕜 → E) (r : ℂ) : fourierIntegral e μ (r • f) = r • fourierIntegral e μ f := VectorFourier.fourierIntegral_smul_const _ _ _ _ _ /-- The uniform norm of the Fourier transform of `f` is bounded by the `L¹` norm of `f`. -/ theorem norm_fourierIntegral_le_integral_norm (e : AddChar 𝕜 𝕊) (μ : Measure 𝕜) (f : 𝕜 → E) (w : 𝕜) : ‖fourierIntegral e μ f w‖ ≤ ∫ x : 𝕜, ‖f x‖ ∂μ := VectorFourier.norm_fourierIntegral_le_integral_norm _ _ _ _ _ /-- The Fourier transform converts right-translation into scalar multiplication by a phase factor. -/ theorem fourierIntegral_comp_add_right [MeasurableAdd 𝕜] (e : AddChar 𝕜 𝕊) (μ : Measure 𝕜) [μ.IsAddRightInvariant] (f : 𝕜 → E) (v₀ : 𝕜) : fourierIntegral e μ (f ∘ fun v ↦ v + v₀) = fun w ↦ e (v₀ * w) • fourierIntegral e μ f w := VectorFourier.fourierIntegral_comp_add_right _ _ _ _ _ end Defs end Fourier open scoped Real namespace Real /-- The standard additive character of `ℝ`, given by `fun x ↦ exp (2 * π * x * I)`. -/ def fourierChar : AddChar ℝ 𝕊 where toFun z := expMapCircle (2 * π * z) map_zero_eq_one' := by simp only; rw [mul_zero, expMapCircle_zero] map_add_eq_mul' x y := by simp only; rw [mul_add, expMapCircle_add] @[inherit_doc] scoped[FourierTransform] notation "𝐞" => Real.fourierChar open FourierTransform theorem fourierChar_apply (x : ℝ) : 𝐞 x = Complex.exp (↑(2 * π * x) * Complex.I) := rfl @[continuity] theorem continuous_fourierChar : Continuous 𝐞 := (map_continuous expMapCircle).comp (continuous_mul_left _) variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] theorem vector_fourierIntegral_eq_integral_exp_smul {V : Type*} [AddCommGroup V] [Module ℝ V] [MeasurableSpace V] {W : Type*} [AddCommGroup W] [Module ℝ W] (L : V →ₗ[ℝ] W →ₗ[ℝ] ℝ) (μ : Measure V) (f : V → E) (w : W) : VectorFourier.fourierIntegral fourierChar μ L f w = ∫ v : V, Complex.exp (↑(-2 * π * L v w) * Complex.I) • f v ∂μ := by simp_rw [VectorFourier.fourierIntegral, Submonoid.smul_def, Real.fourierChar_apply, mul_neg, neg_mul] /-- The Fourier integral is well defined iff the function is integrable. Version with a general continuous bilinear function `L`. For the specialization to the inner product in an inner product space, see `Real.fourierIntegral_convergent_iff`. -/ @[simp] theorem fourierIntegral_convergent_iff' {V W : Type*} [NormedAddCommGroup V] [NormedSpace ℝ V] [NormedAddCommGroup W] [NormedSpace ℝ W] [MeasurableSpace V] [BorelSpace V] {μ : Measure V} {f : V → E} (L : V →L[ℝ] W →L[ℝ] ℝ) (w : W) : Integrable (fun v : V ↦ 𝐞 (- L v w) • f v) μ ↔ Integrable f μ := VectorFourier.fourierIntegral_convergent_iff (E := E) (L := L.toLinearMap₂) continuous_fourierChar L.continuous₂ _ section Apply variable {ι F V W : Type*} [Fintype ι] [NormedAddCommGroup V] [NormedSpace ℝ V] [MeasurableSpace V] [BorelSpace V] [NormedAddCommGroup W] [NormedSpace ℝ W] [MeasurableSpace W] [BorelSpace W] {μ : Measure V} {L : V →L[ℝ] W →L[ℝ] ℝ} [NormedAddCommGroup F] [NormedSpace ℝ F] [NormedAddCommGroup E] [NormedSpace ℂ E] {M : ι → Type*} [∀ i, NormedAddCommGroup (M i)] [∀ i, NormedSpace ℝ (M i)] theorem fourierIntegral_continuousLinearMap_apply' {f : V → (F →L[ℝ] E)} {a : F} {w : W} (hf : Integrable f μ) : VectorFourier.fourierIntegral 𝐞 μ L.toLinearMap₂ f w a = VectorFourier.fourierIntegral 𝐞 μ L.toLinearMap₂ (fun x ↦ f x a) w := VectorFourier.fourierIntegral_continuousLinearMap_apply continuous_fourierChar hf theorem fourierIntegral_continuousMultilinearMap_apply' {f : V → ContinuousMultilinearMap ℝ M E} {m : (i : ι) → M i} {w : W} (hf : Integrable f μ) : VectorFourier.fourierIntegral 𝐞 μ L.toLinearMap₂ f w m = VectorFourier.fourierIntegral 𝐞 μ L.toLinearMap₂ (fun x ↦ f x m) w := VectorFourier.fourierIntegral_continuousMultilinearMap_apply continuous_fourierChar hf end Apply variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MeasurableSpace V] [BorelSpace V] [FiniteDimensional ℝ V] {W : Type*} [NormedAddCommGroup W] [InnerProductSpace ℝ W] [MeasurableSpace W] [BorelSpace W] [FiniteDimensional ℝ W] open scoped RealInnerProductSpace /-- The Fourier transform of a function on an inner product space, with respect to the standard additive character `ω ↦ exp (2 i π ω)`. -/ def fourierIntegral (f : V → E) (w : V) : E := VectorFourier.fourierIntegral 𝐞 volume (innerₗ V) f w /-- The inverse Fourier transform of a function on an inner product space, defined as the Fourier transform but with opposite sign in the exponential. -/ def fourierIntegralInv (f : V → E) (w : V) : E := VectorFourier.fourierIntegral 𝐞 volume (-innerₗ V) f w @[inherit_doc] scoped[FourierTransform] notation "𝓕" => Real.fourierIntegral @[inherit_doc] scoped[FourierTransform] notation "𝓕⁻" => Real.fourierIntegralInv lemma fourierIntegral_eq (f : V → E) (w : V) : 𝓕 f w = ∫ v, 𝐞 (-⟪v, w⟫) • f v := rfl lemma fourierIntegral_eq' (f : V → E) (w : V) : 𝓕 f w = ∫ v, Complex.exp ((↑(-2 * π * ⟪v, w⟫) * Complex.I)) • f v := by simp_rw [fourierIntegral_eq, Submonoid.smul_def, Real.fourierChar_apply, mul_neg, neg_mul] lemma fourierIntegralInv_eq (f : V → E) (w : V) : 𝓕⁻ f w = ∫ v, 𝐞 ⟪v, w⟫ • f v := by simp [fourierIntegralInv, VectorFourier.fourierIntegral] lemma fourierIntegralInv_eq' (f : V → E) (w : V) : 𝓕⁻ f w = ∫ v, Complex.exp ((↑(2 * π * ⟪v, w⟫) * Complex.I)) • f v := by simp_rw [fourierIntegralInv_eq, Submonoid.smul_def, Real.fourierChar_apply] lemma fourierIntegral_comp_linearIsometry (A : W ≃ₗᵢ[ℝ] V) (f : V → E) (w : W) : 𝓕 (f ∘ A) w = (𝓕 f) (A w) := by simp only [fourierIntegral_eq, ← A.inner_map_map, Function.comp_apply, ← MeasurePreserving.integral_comp A.measurePreserving A.toHomeomorph.measurableEmbedding] lemma fourierIntegralInv_eq_fourierIntegral_neg (f : V → E) (w : V) : 𝓕⁻ f w = 𝓕 f (-w) := by simp [fourierIntegral_eq, fourierIntegralInv_eq] lemma fourierIntegralInv_eq_fourierIntegral_comp_neg (f : V → E) : 𝓕⁻ f = 𝓕 (fun x ↦ f (-x)) := by ext y rw [fourierIntegralInv_eq_fourierIntegral_neg] change 𝓕 f (LinearIsometryEquiv.neg ℝ y) = 𝓕 (f ∘ LinearIsometryEquiv.neg ℝ) y exact (fourierIntegral_comp_linearIsometry _ _ _).symm lemma fourierIntegralInv_comm (f : V → E) : 𝓕 (𝓕⁻ f) = 𝓕⁻ (𝓕 f) := by conv_rhs => rw [fourierIntegralInv_eq_fourierIntegral_comp_neg] simp_rw [← fourierIntegralInv_eq_fourierIntegral_neg] lemma fourierIntegralInv_comp_linearIsometry (A : W ≃ₗᵢ[ℝ] V) (f : V → E) (w : W) : 𝓕⁻ (f ∘ A) w = (𝓕⁻ f) (A w) := by simp [fourierIntegralInv_eq_fourierIntegral_neg, fourierIntegral_comp_linearIsometry] theorem fourierIntegral_real_eq (f : ℝ → E) (w : ℝ) : fourierIntegral f w = ∫ v : ℝ, 𝐞 (-(v * w)) • f v := rfl @[deprecated (since := "2024-02-21")] alias fourierIntegral_def := fourierIntegral_real_eq theorem fourierIntegral_real_eq_integral_exp_smul (f : ℝ → E) (w : ℝ) : 𝓕 f w = ∫ v : ℝ, Complex.exp (↑(-2 * π * v * w) * Complex.I) • f v := by simp_rw [fourierIntegral_real_eq, Submonoid.smul_def, Real.fourierChar_apply, mul_neg, neg_mul, mul_assoc] @[deprecated (since := "2024-02-21")] alias fourierIntegral_eq_integral_exp_smul := fourierIntegral_real_eq_integral_exp_smul @[simp] theorem fourierIntegral_convergent_iff {μ : Measure V} {f : V → E} (w : V) : Integrable (fun v : V ↦ 𝐞 (- ⟪v, w⟫) • f v) μ ↔ Integrable f μ := fourierIntegral_convergent_iff' (innerSL ℝ) w theorem fourierIntegral_continuousLinearMap_apply {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] {f : V → (F →L[ℝ] E)} {a : F} {v : V} (hf : Integrable f) : 𝓕 f v a = 𝓕 (fun x ↦ f x a) v := fourierIntegral_continuousLinearMap_apply' (L := innerSL ℝ) hf theorem fourierIntegral_continuousMultilinearMap_apply {ι : Type*} [Fintype ι] {M : ι → Type*} [∀ i, NormedAddCommGroup (M i)] [∀ i, NormedSpace ℝ (M i)] {f : V → ContinuousMultilinearMap ℝ M E} {m : (i : ι) → M i} {v : V} (hf : Integrable f) : 𝓕 f v m = 𝓕 (fun x ↦ f x m) v := fourierIntegral_continuousMultilinearMap_apply' (L := innerSL ℝ) hf end Real
Analysis\Fourier\FourierTransformDeriv.lean
/- Copyright (c) 2024 David Loeffler. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Alex Kontorovich, David Loeffler, Heather Macbeth, Sébastien Gouëzel -/ import Mathlib.Analysis.Calculus.ParametricIntegral import Mathlib.Analysis.Fourier.AddCircle import Mathlib.Analysis.Fourier.FourierTransform import Mathlib.Analysis.Calculus.FDeriv.Analytic import Mathlib.Analysis.Calculus.LineDeriv.IntegrationByParts import Mathlib.Analysis.Calculus.ContDiff.Bounds /-! # Derivatives of the Fourier transform In this file we compute the Fréchet derivative of the Fourier transform of `f`, where `f` is a function such that both `f` and `v ↦ ‖v‖ * ‖f v‖` are integrable. Here the Fourier transform is understood as an operator `(V → E) → (W → E)`, where `V` and `W` are normed `ℝ`-vector spaces and the Fourier transform is taken with respect to a continuous `ℝ`-bilinear pairing `L : V × W → ℝ` and a given reference measure `μ`. We also investigate higher derivatives: Assuming that `‖v‖^n * ‖f v‖` is integrable, we show that the Fourier transform of `f` is `C^n`. We also study in a parallel way the Fourier transform of the derivative, which is obtained by tensoring the Fourier transform of the original function with the bilinear form. We also get results for iterated derivatives. A consequence of these results is that, if a function is smooth and all its derivatives are integrable when multiplied by `‖v‖^k`, then the same goes for its Fourier transform, with explicit bounds. We give specialized versions of these results on inner product spaces (where `L` is the scalar product) and on the real line, where we express the one-dimensional derivative in more concrete terms, as the Fourier transform of `-2πI x * f x` (or `(-2πI x)^n * f x` for higher derivatives). ## Main definitions and results We introduce two convenience definitions: * `VectorFourier.fourierSMulRight L f`: given `f : V → E` and `L` a bilinear pairing between `V` and `W`, then this is the function `fun v ↦ -(2 * π * I) (L v ⬝) • f v`, from `V` to `Hom (W, E)`. This is essentially `ContinousLinearMap.smulRight`, up to the factor `- 2πI` designed to make sure that the Fourier integral of `fourierSMulRight L f` is the derivative of the Fourier integral of `f`. * `VectorFourier.fourierPowSMulRight` is the higher order analogue for higher derivatives: `fourierPowSMulRight L f v n` is informally `(-(2 * π * I))^n (L v ⬝)^n • f v`, in the space of continuous multilinear maps `W [×n]→L[ℝ] E`. With these definitions, the statements read as follows, first in a general context (arbitrary `L` and `μ`): * `VectorFourier.hasFDerivAt_fourierIntegral`: the Fourier integral of `f` is differentiable, with derivative the Fourier integral of `fourierSMulRight L f`. * `VectorFourier.differentiable_fourierIntegral`: the Fourier integral of `f` is differentiable. * `VectorFourier.fderiv_fourierIntegral`: formula for the derivative of the Fourier integral of `f`. * `VectorFourier.fourierIntegral_fderiv`: formula for the Fourier integral of the derivative of `f`. * `VectorFourier.hasFTaylorSeriesUpTo_fourierIntegral`: under suitable integrability conditions, the Fourier integral of `f` has an explicit Taylor series up to order `N`, given by the Fourier integrals of `fun v ↦ fourierPowSMulRight L f v n`. * `VectorFourier.contDiff_fourierIntegral`: under suitable integrability conditions, the Fourier integral of `f` is `C^n`. * `VectorFourier.iteratedFDeriv_fourierIntegral`: under suitable integrability conditions, explicit formula for the `n`-th derivative of the Fourier integral of `f`, as the Fourier integral of `fun v ↦ fourierPowSMulRight L f v n`. * `VectorFourier.pow_mul_norm_iteratedFDeriv_fourierIntegral_le`: explicit bounds for the `n`-th derivative of the Fourier integral, multiplied by a power function, in terms of corresponding integrals for the original function. These statements are then specialized to the case of the usual Fourier transform on finite-dimensional inner product spaces with their canonical Lebesgue measure (covering in particular the case of the real line), replacing the namespace `VectorFourier` by the namespace `Real` in the above statements. We also give specialized versions of the one-dimensional real derivative (and iterated derivative) in `Real.deriv_fourierIntegral` and `Real.iteratedDeriv_fourierIntegral`. -/ noncomputable section open Real Complex MeasureTheory Filter TopologicalSpace open scoped FourierTransform Topology -- without this local instance, Lean tries first the instance -- `secondCountableTopologyEither_of_right` (whose priority is 100) and takes a very long time to -- fail. Since we only use the left instance in this file, we make sure it is tried first. attribute [local instance 101] secondCountableTopologyEither_of_left namespace Real lemma hasDerivAt_fourierChar (x : ℝ) : HasDerivAt (𝐞 · : ℝ → ℂ) (2 * π * I * 𝐞 x) x := by have h1 (y : ℝ) : 𝐞 y = fourier 1 (y : UnitAddCircle) := by rw [fourierChar_apply, fourier_coe_apply] push_cast ring_nf simpa only [h1, Int.cast_one, ofReal_one, div_one, mul_one] using hasDerivAt_fourier 1 1 x lemma differentiable_fourierChar : Differentiable ℝ (𝐞 · : ℝ → ℂ) := fun x ↦ (Real.hasDerivAt_fourierChar x).differentiableAt lemma deriv_fourierChar (x : ℝ) : deriv (𝐞 · : ℝ → ℂ) x = 2 * π * I * 𝐞 x := (Real.hasDerivAt_fourierChar x).deriv variable {V W : Type*} [NormedAddCommGroup V] [NormedSpace ℝ V] [NormedAddCommGroup W] [NormedSpace ℝ W] (L : V →L[ℝ] W →L[ℝ] ℝ) lemma hasFDerivAt_fourierChar_neg_bilinear_right (v : V) (w : W) : HasFDerivAt (fun w ↦ (𝐞 (-L v w) : ℂ)) ((-2 * π * I * 𝐞 (-L v w)) • (ofRealCLM ∘L (L v))) w := by have ha : HasFDerivAt (fun w' : W ↦ L v w') (L v) w := ContinuousLinearMap.hasFDerivAt (L v) convert (hasDerivAt_fourierChar (-L v w)).hasFDerivAt.comp w ha.neg using 1 ext y simp only [neg_mul, ContinuousLinearMap.coe_smul', ContinuousLinearMap.coe_comp', Pi.smul_apply, Function.comp_apply, ofRealCLM_apply, smul_eq_mul, ContinuousLinearMap.comp_neg, ContinuousLinearMap.neg_apply, ContinuousLinearMap.smulRight_apply, ContinuousLinearMap.one_apply, real_smul, neg_inj] ring lemma fderiv_fourierChar_neg_bilinear_right_apply (v : V) (w y : W) : fderiv ℝ (fun w ↦ (𝐞 (-L v w) : ℂ)) w y = -2 * π * I * L v y * 𝐞 (-L v w) := by simp only [(hasFDerivAt_fourierChar_neg_bilinear_right L v w).fderiv, neg_mul, ContinuousLinearMap.coe_smul', ContinuousLinearMap.coe_comp', Pi.smul_apply, Function.comp_apply, ofRealCLM_apply, smul_eq_mul, neg_inj] ring lemma differentiable_fourierChar_neg_bilinear_right (v : V) : Differentiable ℝ (fun w ↦ (𝐞 (-L v w) : ℂ)) := fun w ↦ (hasFDerivAt_fourierChar_neg_bilinear_right L v w).differentiableAt lemma hasFDerivAt_fourierChar_neg_bilinear_left (v : V) (w : W) : HasFDerivAt (fun v ↦ (𝐞 (-L v w) : ℂ)) ((-2 * π * I * 𝐞 (-L v w)) • (ofRealCLM ∘L (L.flip w))) v := hasFDerivAt_fourierChar_neg_bilinear_right L.flip w v lemma fderiv_fourierChar_neg_bilinear_left_apply (v y : V) (w : W) : fderiv ℝ (fun v ↦ (𝐞 (-L v w) : ℂ)) v y = -2 * π * I * L y w * 𝐞 (-L v w) := by simp only [(hasFDerivAt_fourierChar_neg_bilinear_left L v w).fderiv, neg_mul, ContinuousLinearMap.coe_smul', ContinuousLinearMap.coe_comp', Pi.smul_apply, Function.comp_apply, ContinuousLinearMap.flip_apply, ofRealCLM_apply, smul_eq_mul, neg_inj] ring lemma differentiable_fourierChar_neg_bilinear_left (w : W) : Differentiable ℝ (fun v ↦ (𝐞 (-L v w) : ℂ)) := fun v ↦ (hasFDerivAt_fourierChar_neg_bilinear_left L v w).differentiableAt end Real variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] namespace VectorFourier variable {V W : Type*} [NormedAddCommGroup V] [NormedSpace ℝ V] [NormedAddCommGroup W] [NormedSpace ℝ W] (L : V →L[ℝ] W →L[ℝ] ℝ) (f : V → E) /-- Send a function `f : V → E` to the function `f : V → Hom (W, E)` given by `v ↦ (w ↦ -2 * π * I * L (v, w) • f v)`. This is designed so that the Fourier transform of `fourierSMulRight L f` is the derivative of the Fourier transform of `f`. -/ def fourierSMulRight (v : V) : (W →L[ℝ] E) := -(2 * π * I) • (L v).smulRight (f v) @[simp] lemma fourierSMulRight_apply (v : V) (w : W) : fourierSMulRight L f v w = -(2 * π * I) • L v w • f v := rfl /-- The `w`-derivative of the Fourier transform integrand. -/ lemma hasFDerivAt_fourierChar_smul (v : V) (w : W) : HasFDerivAt (fun w' ↦ 𝐞 (-L v w') • f v) (𝐞 (-L v w) • fourierSMulRight L f v) w := by have ha : HasFDerivAt (fun w' : W ↦ L v w') (L v) w := ContinuousLinearMap.hasFDerivAt (L v) convert ((hasDerivAt_fourierChar (-L v w)).hasFDerivAt.comp w ha.neg).smul_const (f v) ext w' : 1 simp_rw [fourierSMulRight, ContinuousLinearMap.smul_apply, ContinuousLinearMap.smulRight_apply] rw [ContinuousLinearMap.comp_apply, ContinuousLinearMap.neg_apply, ContinuousLinearMap.smulRight_apply, ContinuousLinearMap.one_apply, ← smul_assoc, smul_comm, ← smul_assoc, real_smul, real_smul, Submonoid.smul_def, smul_eq_mul] push_cast ring_nf lemma norm_fourierSMulRight (L : V →L[ℝ] W →L[ℝ] ℝ) (f : V → E) (v : V) : ‖fourierSMulRight L f v‖ = (2 * π) * ‖L v‖ * ‖f v‖ := by rw [fourierSMulRight, norm_smul _ (ContinuousLinearMap.smulRight (L v) (f v)), norm_neg, norm_mul, norm_mul, norm_eq_abs I, abs_I, mul_one, norm_eq_abs ((_ : ℝ) : ℂ), Complex.abs_of_nonneg pi_pos.le, norm_eq_abs (2 : ℂ), Complex.abs_two, ContinuousLinearMap.norm_smulRight_apply, ← mul_assoc] lemma norm_fourierSMulRight_le (L : V →L[ℝ] W →L[ℝ] ℝ) (f : V → E) (v : V) : ‖fourierSMulRight L f v‖ ≤ 2 * π * ‖L‖ * ‖v‖ * ‖f v‖ := calc ‖fourierSMulRight L f v‖ = (2 * π) * ‖L v‖ * ‖f v‖ := norm_fourierSMulRight _ _ _ _ ≤ (2 * π) * (‖L‖ * ‖v‖) * ‖f v‖ := by gcongr; exact L.le_opNorm _ _ = 2 * π * ‖L‖ * ‖v‖ * ‖f v‖ := by ring lemma _root_.MeasureTheory.AEStronglyMeasurable.fourierSMulRight [SecondCountableTopologyEither V (W →L[ℝ] ℝ)] [MeasurableSpace V] [BorelSpace V] {L : V →L[ℝ] W →L[ℝ] ℝ} {f : V → E} {μ : Measure V} (hf : AEStronglyMeasurable f μ) : AEStronglyMeasurable (fun v ↦ fourierSMulRight L f v) μ := by apply AEStronglyMeasurable.const_smul' have aux0 : Continuous fun p : (W →L[ℝ] ℝ) × E ↦ p.1.smulRight p.2 := (ContinuousLinearMap.smulRightL ℝ W E).continuous₂ have aux1 : AEStronglyMeasurable (fun v ↦ (L v, f v)) μ := L.continuous.aestronglyMeasurable.prod_mk hf -- Elaboration without the expected type is faster here: exact (aux0.comp_aestronglyMeasurable aux1 : _) variable {f} /-- Main theorem of this section: if both `f` and `x ↦ ‖x‖ * ‖f x‖` are integrable, then the Fourier transform of `f` has a Fréchet derivative (everywhere in its domain) and its derivative is the Fourier transform of `smulRight L f`. -/ theorem hasFDerivAt_fourierIntegral [MeasurableSpace V] [BorelSpace V] [SecondCountableTopology V] {μ : Measure V} (hf : Integrable f μ) (hf' : Integrable (fun v : V ↦ ‖v‖ * ‖f v‖) μ) (w : W) : HasFDerivAt (fourierIntegral 𝐞 μ L.toLinearMap₂ f) (fourierIntegral 𝐞 μ L.toLinearMap₂ (fourierSMulRight L f) w) w := by let F : W → V → E := fun w' v ↦ 𝐞 (-L v w') • f v let F' : W → V → W →L[ℝ] E := fun w' v ↦ 𝐞 (-L v w') • fourierSMulRight L f v let B : V → ℝ := fun v ↦ 2 * π * ‖L‖ * ‖v‖ * ‖f v‖ have h0 (w' : W) : Integrable (F w') μ := (fourierIntegral_convergent_iff continuous_fourierChar (by apply L.continuous₂ : Continuous (fun p : V × W ↦ L.toLinearMap₂ p.1 p.2)) w').2 hf have h1 : ∀ᶠ w' in 𝓝 w, AEStronglyMeasurable (F w') μ := eventually_of_forall (fun w' ↦ (h0 w').aestronglyMeasurable) have h3 : AEStronglyMeasurable (F' w) μ := by refine .smul ?_ hf.1.fourierSMulRight refine (continuous_fourierChar.comp ?_).aestronglyMeasurable exact (L.continuous₂.comp (Continuous.Prod.mk_left w)).neg have h4 : (∀ᵐ v ∂μ, ∀ (w' : W), w' ∈ Metric.ball w 1 → ‖F' w' v‖ ≤ B v) := by filter_upwards with v w' _ rw [norm_circle_smul _ (fourierSMulRight L f v)] exact norm_fourierSMulRight_le L f v have h5 : Integrable B μ := by simpa only [← mul_assoc] using hf'.const_mul (2 * π * ‖L‖) have h6 : ∀ᵐ v ∂μ, ∀ w', w' ∈ Metric.ball w 1 → HasFDerivAt (fun x ↦ F x v) (F' w' v) w' := ae_of_all _ (fun v w' _ ↦ hasFDerivAt_fourierChar_smul L f v w') exact hasFDerivAt_integral_of_dominated_of_fderiv_le one_pos h1 (h0 w) h3 h4 h5 h6 lemma fderiv_fourierIntegral [MeasurableSpace V] [BorelSpace V] [SecondCountableTopology V] {μ : Measure V} (hf : Integrable f μ) (hf' : Integrable (fun v : V ↦ ‖v‖ * ‖f v‖) μ) : fderiv ℝ (fourierIntegral 𝐞 μ L.toLinearMap₂ f) = fourierIntegral 𝐞 μ L.toLinearMap₂ (fourierSMulRight L f) := by ext w : 1 exact (hasFDerivAt_fourierIntegral L hf hf' w).fderiv lemma differentiable_fourierIntegral [MeasurableSpace V] [BorelSpace V] [SecondCountableTopology V] {μ : Measure V} (hf : Integrable f μ) (hf' : Integrable (fun v : V ↦ ‖v‖ * ‖f v‖) μ) : Differentiable ℝ (fourierIntegral 𝐞 μ L.toLinearMap₂ f) := fun w ↦ (hasFDerivAt_fourierIntegral L hf hf' w).differentiableAt /-- The Fourier integral of the derivative of a function is obtained by multiplying the Fourier integral of the original function by `-L w v`. -/ theorem fourierIntegral_fderiv [MeasurableSpace V] [BorelSpace V] [FiniteDimensional ℝ V] {μ : Measure V} [Measure.IsAddHaarMeasure μ] (hf : Integrable f μ) (h'f : Differentiable ℝ f) (hf' : Integrable (fderiv ℝ f) μ) : fourierIntegral 𝐞 μ L.toLinearMap₂ (fderiv ℝ f) = fourierSMulRight (-L.flip) (fourierIntegral 𝐞 μ L.toLinearMap₂ f) := by ext w y let g (v : V) : ℂ := 𝐞 (-L v w) /- First rewrite things in a simplified form, without any real change. -/ suffices ∫ x, g x • fderiv ℝ f x y ∂μ = ∫ x, (2 * ↑π * I * L y w * g x) • f x ∂μ by rw [fourierIntegral_continuousLinearMap_apply' hf'] simpa only [fourierIntegral, ContinuousLinearMap.toLinearMap₂_apply, fourierSMulRight_apply, ContinuousLinearMap.neg_apply, ContinuousLinearMap.flip_apply, ← integral_smul, neg_smul, smul_neg, ← smul_smul, coe_smul, neg_neg] -- Key step: integrate by parts with respect to `y` to switch the derivative from `f` to `g`. have A x : fderiv ℝ g x y = - 2 * ↑π * I * L y w * g x := fderiv_fourierChar_neg_bilinear_left_apply _ _ _ _ rw [integral_smul_fderiv_eq_neg_fderiv_smul_of_integrable, ← integral_neg] · congr with x simp only [A, neg_mul, neg_smul, neg_neg] · have : Integrable (fun x ↦ (-(2 * ↑π * I * ↑((L y) w)) • ((g x : ℂ) • f x))) μ := ((fourierIntegral_convergent_iff' _ _).2 hf).smul _ convert this using 2 with x simp only [A, neg_mul, neg_smul, smul_smul] · exact (fourierIntegral_convergent_iff' _ _).2 (hf'.apply_continuousLinearMap _) · exact (fourierIntegral_convergent_iff' _ _).2 hf · exact differentiable_fourierChar_neg_bilinear_left _ _ · exact h'f /-- The formal multilinear series whose `n`-th term is `(w₁, ..., wₙ) ↦ (-2πI)^n * L v w₁ * ... * L v wₙ • f v`, as a continuous multilinear map in the space `W [×n]→L[ℝ] E`. This is designed so that the Fourier transform of `v ↦ fourierPowSMulRight L f v n` is the `n`-th derivative of the Fourier transform of `f`. -/ def fourierPowSMulRight (f : V → E) (v : V) : FormalMultilinearSeries ℝ W E := fun n ↦ (- (2 * π * I))^n • ((ContinuousMultilinearMap.mkPiRing ℝ (Fin n) (f v)).compContinuousLinearMap (fun _ ↦ L v)) /- Increase the priority to make sure that this lemma is used instead of `FormalMultilinearSeries.apply_eq_prod_smul_coeff` even in dimension 1. -/ @[simp 1100] lemma fourierPowSMulRight_apply {f : V → E} {v : V} {n : ℕ} {m : Fin n → W} : fourierPowSMulRight L f v n m = (- (2 * π * I))^n • (∏ i, L v (m i)) • f v := by simp [fourierPowSMulRight] open ContinuousMultilinearMap /-- Decomposing `fourierPowSMulRight L f v n` as a composition of continuous bilinear and multilinear maps, to deduce easily its continuity and differentiability properties. -/ lemma fourierPowSMulRight_eq_comp {f : V → E} {v : V} {n : ℕ} : fourierPowSMulRight L f v n = (- (2 * π * I))^n • smulRightL ℝ (fun (_ : Fin n) ↦ W) E (compContinuousLinearMapLRight (ContinuousMultilinearMap.mkPiAlgebra ℝ (Fin n) ℝ) (fun _ ↦ L v)) (f v) := rfl @[continuity, fun_prop] lemma _root_.Continuous.fourierPowSMulRight {f : V → E} (hf : Continuous f) (n : ℕ) : Continuous (fun v ↦ fourierPowSMulRight L f v n) := by simp_rw [fourierPowSMulRight_eq_comp] apply Continuous.const_smul apply (smulRightL ℝ (fun (_ : Fin n) ↦ W) E).continuous₂.comp₂ _ hf exact Continuous.comp (map_continuous _) (continuous_pi (fun _ ↦ L.continuous)) lemma _root_.ContDiff.fourierPowSMulRight {f : V → E} {k : ℕ∞} (hf : ContDiff ℝ k f) (n : ℕ) : ContDiff ℝ k (fun v ↦ fourierPowSMulRight L f v n) := by simp_rw [fourierPowSMulRight_eq_comp] apply ContDiff.const_smul apply (smulRightL ℝ (fun (_ : Fin n) ↦ W) E).isBoundedBilinearMap.contDiff.comp₂ _ hf apply (ContinuousMultilinearMap.contDiff _).comp exact contDiff_pi.2 (fun _ ↦ L.contDiff) lemma norm_fourierPowSMulRight_le (f : V → E) (v : V) (n : ℕ) : ‖fourierPowSMulRight L f v n‖ ≤ (2 * π * ‖L‖) ^ n * ‖v‖ ^ n * ‖f v‖ := by apply ContinuousMultilinearMap.opNorm_le_bound _ (by positivity) (fun m ↦ ?_) calc ‖fourierPowSMulRight L f v n m‖ = (2 * π) ^ n * ((∏ x : Fin n, |(L v) (m x)|) * ‖f v‖) := by simp [_root_.abs_of_nonneg pi_nonneg, norm_smul] _ ≤ (2 * π) ^ n * ((∏ x : Fin n, ‖L‖ * ‖v‖ * ‖m x‖) * ‖f v‖) := by gcongr with i _hi · exact fun i _hi ↦ abs_nonneg _ · exact L.le_opNorm₂ v (m i) _ = (2 * π * ‖L‖) ^ n * ‖v‖ ^ n * ‖f v‖ * ∏ i : Fin n, ‖m i‖ := by simp [Finset.prod_mul_distrib, mul_pow]; ring set_option maxSynthPendingDepth 2 in /-- The iterated derivative of a function multiplied by `(L v ⬝) ^ n` can be controlled in terms of the iterated derivatives of the initial function. -/ lemma norm_iteratedFDeriv_fourierPowSMulRight {f : V → E} {K : ℕ∞} {C : ℝ} (hf : ContDiff ℝ K f) {n : ℕ} {k : ℕ} (hk : k ≤ K) {v : V} (hv : ∀ i ≤ k, ∀ j ≤ n, ‖v‖ ^ j * ‖iteratedFDeriv ℝ i f v‖ ≤ C) : ‖iteratedFDeriv ℝ k (fun v ↦ fourierPowSMulRight L f v n) v‖ ≤ (2 * π) ^ n * (2 * n + 2) ^ k * ‖L‖ ^ n * C := by /- We write `fourierPowSMulRight L f v n` as a composition of bilinear and multilinear maps, thanks to `fourierPowSMulRight_eq_comp`, and then we control the iterated derivatives of these thanks to general bounds on derivatives of bilinear and multilinear maps. More precisely, `fourierPowSMulRight L f v n m = (- (2 * π * I))^n • (∏ i, L v (m i)) • f v`. Here, `(- (2 * π * I))^n` contributes `(2π)^n` to the bound. The second product is bilinear, so the iterated derivative is controlled as a weighted sum of those of `v ↦ ∏ i, L v (m i)` and of `f`. The harder part is to control the iterated derivatives of `v ↦ ∏ i, L v (m i)`. For this, one argues that this is multilinear in `v`, to apply general bounds for iterated derivatives of multilinear maps. More precisely, we write it as the composition of a multilinear map `T` (making the product operation) and the tuple of linear maps `v ↦ (L v ⬝, ..., L v ⬝)` -/ simp_rw [fourierPowSMulRight_eq_comp] -- first step: controlling the iterated derivatives of `v ↦ ∏ i, L v (m i)`, written below -- as `v ↦ T (fun _ ↦ L v)`, or `T ∘ (ContinuousLinearMap.pi (fun (_ : Fin n) ↦ L))`. let T : (W →L[ℝ] ℝ) [×n]→L[ℝ] (W [×n]→L[ℝ] ℝ) := compContinuousLinearMapLRight (ContinuousMultilinearMap.mkPiAlgebra ℝ (Fin n) ℝ) have I₁ m : ‖iteratedFDeriv ℝ m T (fun _ ↦ L v)‖ ≤ n.descFactorial m * 1 * (‖L‖ * ‖v‖) ^ (n - m) := by have : ‖T‖ ≤ 1 := by apply (norm_compContinuousLinearMapLRight_le _ _).trans simp only [norm_mkPiAlgebra, le_refl] apply (ContinuousMultilinearMap.norm_iteratedFDeriv_le _ _ _).trans simp only [Fintype.card_fin] gcongr refine (pi_norm_le_iff_of_nonneg (by positivity)).mpr (fun _ ↦ ?_) exact ContinuousLinearMap.le_opNorm _ _ have I₂ m : ‖iteratedFDeriv ℝ m (T ∘ (ContinuousLinearMap.pi (fun (_ : Fin n) ↦ L))) v‖ ≤ (n.descFactorial m * 1 * (‖L‖ * ‖v‖) ^ (n - m)) * ‖L‖ ^ m := by rw [ContinuousLinearMap.iteratedFDeriv_comp_right _ (ContinuousMultilinearMap.contDiff _) _ le_top] apply (norm_compContinuousLinearMap_le _ _).trans simp only [Finset.prod_const, Finset.card_fin] gcongr · exact I₁ m · exact ContinuousLinearMap.norm_pi_le_of_le (fun _ ↦ le_rfl) (norm_nonneg _) have I₃ m : ‖iteratedFDeriv ℝ m (T ∘ (ContinuousLinearMap.pi (fun (_ : Fin n) ↦ L))) v‖ ≤ n.descFactorial m * ‖L‖ ^ n * ‖v‖ ^ (n - m) := by apply (I₂ m).trans (le_of_eq _) rcases le_or_lt m n with hm | hm · rw [show ‖L‖ ^ n = ‖L‖ ^ (m + (n - m)) by rw [Nat.add_sub_cancel' hm], pow_add] ring · simp only [Nat.descFactorial_eq_zero_iff_lt.mpr hm, CharP.cast_eq_zero, mul_one, zero_mul] -- second step: factor out the `(2 * π) ^ n` factor, and cancel it on both sides. have A : ContDiff ℝ K (fun y ↦ T (fun _ ↦ L y)) := (ContinuousMultilinearMap.contDiff _).comp (contDiff_pi.2 fun _ ↦ L.contDiff) rw [iteratedFDeriv_const_smul_apply' (hf := (smulRightL ℝ (fun _ ↦ W) E).isBoundedBilinearMap.contDiff.comp₂ (A.of_le hk) (hf.of_le hk)), norm_smul (β := V [×k]→L[ℝ] (W [×n]→L[ℝ] E))] simp only [norm_pow, norm_neg, norm_mul, RCLike.norm_ofNat, Complex.norm_eq_abs, abs_ofReal, _root_.abs_of_nonneg pi_nonneg, abs_I, mul_one, mul_assoc] gcongr -- third step: argue that the scalar multiplication is bilinear to bound the iterated derivatives -- of `v ↦ (∏ i, L v (m i)) • f v` in terms of those of `v ↦ (∏ i, L v (m i))` and of `f`. -- The former are controlled by the first step, the latter by the assumptions. apply (ContinuousLinearMap.norm_iteratedFDeriv_le_of_bilinear_of_le_one _ A hf _ hk ContinuousMultilinearMap.norm_smulRightL_le).trans calc ∑ i in Finset.range (k + 1), k.choose i * ‖iteratedFDeriv ℝ i (fun (y : V) ↦ T (fun _ ↦ L y)) v‖ * ‖iteratedFDeriv ℝ (k - i) f v‖ ≤ ∑ i in Finset.range (k + 1), k.choose i * (n.descFactorial i * ‖L‖ ^ n * ‖v‖ ^ (n - i)) * ‖iteratedFDeriv ℝ (k - i) f v‖ := by gcongr with i _hi exact I₃ i _ = ∑ i in Finset.range (k + 1), (k.choose i * n.descFactorial i * ‖L‖ ^ n) * (‖v‖ ^ (n - i) * ‖iteratedFDeriv ℝ (k - i) f v‖) := by congr with i ring _ ≤ ∑ i in Finset.range (k + 1), (k.choose i * (n + 1 : ℕ) ^ k * ‖L‖ ^ n) * C := by gcongr with i hi · rw [← Nat.cast_pow, Nat.cast_le] calc n.descFactorial i ≤ n ^ i := Nat.descFactorial_le_pow _ _ _ ≤ (n + 1) ^ i := pow_le_pow_left (by omega) (by omega) i _ ≤ (n + 1) ^ k := pow_le_pow_right (by omega) (Finset.mem_range_succ_iff.mp hi) · exact hv _ (by omega) _ (by omega) _ = (2 * n + 2) ^ k * (‖L‖^n * C) := by simp only [← Finset.sum_mul, ← Nat.cast_sum, Nat.sum_range_choose, mul_one, ← mul_assoc, Nat.cast_pow, Nat.cast_ofNat, Nat.cast_add, Nat.cast_one, ← mul_pow, mul_add] variable [MeasurableSpace V] [BorelSpace V] {μ : Measure V} section SecondCountableTopology variable [SecondCountableTopology V] lemma _root_.MeasureTheory.AEStronglyMeasurable.fourierPowSMulRight (hf : AEStronglyMeasurable f μ) (n : ℕ) : AEStronglyMeasurable (fun v ↦ fourierPowSMulRight L f v n) μ := by simp_rw [fourierPowSMulRight_eq_comp] apply AEStronglyMeasurable.const_smul' apply (smulRightL ℝ (fun (_ : Fin n) ↦ W) E).continuous₂.comp_aestronglyMeasurable₂ _ hf apply Continuous.aestronglyMeasurable exact Continuous.comp (map_continuous _) (continuous_pi (fun _ ↦ L.continuous)) lemma integrable_fourierPowSMulRight {n : ℕ} (hf : Integrable (fun v ↦ ‖v‖ ^ n * ‖f v‖) μ) (h'f : AEStronglyMeasurable f μ) : Integrable (fun v ↦ fourierPowSMulRight L f v n) μ := by refine (hf.const_mul ((2 * π * ‖L‖) ^ n)).mono' (h'f.fourierPowSMulRight L n) ?_ filter_upwards with v exact (norm_fourierPowSMulRight_le L f v n).trans (le_of_eq (by ring)) lemma hasFTaylorSeriesUpTo_fourierIntegral {N : ℕ∞} (hf : ∀ (n : ℕ), n ≤ N → Integrable (fun v ↦ ‖v‖^n * ‖f v‖) μ) (h'f : AEStronglyMeasurable f μ) : HasFTaylorSeriesUpTo N (fourierIntegral 𝐞 μ L.toLinearMap₂ f) (fun w n ↦ fourierIntegral 𝐞 μ L.toLinearMap₂ (fun v ↦ fourierPowSMulRight L f v n) w) := by constructor · intro w rw [uncurry0_apply, Matrix.zero_empty, fourierIntegral_continuousMultilinearMap_apply' (integrable_fourierPowSMulRight L (hf 0 bot_le) h'f)] simp only [fourierPowSMulRight_apply, pow_zero, Finset.univ_eq_empty, Finset.prod_empty, one_smul] · intro n hn w have I₁ : Integrable (fun v ↦ fourierPowSMulRight L f v n) μ := integrable_fourierPowSMulRight L (hf n hn.le) h'f have I₂ : Integrable (fun v ↦ ‖v‖ * ‖fourierPowSMulRight L f v n‖) μ := by apply ((hf (n+1) (ENat.add_one_le_of_lt hn)).const_mul ((2 * π * ‖L‖) ^ n)).mono' (continuous_norm.aestronglyMeasurable.mul (h'f.fourierPowSMulRight L n).norm) filter_upwards with v simp only [Pi.mul_apply, norm_mul, norm_norm] calc ‖v‖ * ‖fourierPowSMulRight L f v n‖ ≤ ‖v‖ * ((2 * π * ‖L‖) ^ n * ‖v‖ ^ n * ‖f v‖) := by gcongr; apply norm_fourierPowSMulRight_le _ = (2 * π * ‖L‖) ^ n * (‖v‖ ^ (n + 1) * ‖f v‖) := by rw [pow_succ]; ring have I₃ : Integrable (fun v ↦ fourierPowSMulRight L f v (n + 1)) μ := integrable_fourierPowSMulRight L (hf (n + 1) (ENat.add_one_le_of_lt hn)) h'f have I₄ : Integrable (fun v ↦ fourierSMulRight L (fun v ↦ fourierPowSMulRight L f v n) v) μ := by apply (I₂.const_mul ((2 * π * ‖L‖))).mono' (h'f.fourierPowSMulRight L n).fourierSMulRight filter_upwards with v exact (norm_fourierSMulRight_le _ _ _).trans (le_of_eq (by ring)) have E : curryLeft (fourierIntegral 𝐞 μ L.toLinearMap₂ (fun v ↦ fourierPowSMulRight L f v (n + 1)) w) = fourierIntegral 𝐞 μ L.toLinearMap₂ (fourierSMulRight L fun v ↦ fourierPowSMulRight L f v n) w := by ext w' m rw [curryLeft_apply, fourierIntegral_continuousMultilinearMap_apply' I₃, fourierIntegral_continuousLinearMap_apply' I₄, fourierIntegral_continuousMultilinearMap_apply' (I₄.apply_continuousLinearMap _)] congr with v simp only [fourierPowSMulRight_apply, mul_comm, pow_succ, neg_mul, Fin.prod_univ_succ, Fin.cons_zero, Fin.cons_succ, neg_smul, fourierSMulRight_apply, neg_apply, smul_apply, smul_comm (M := ℝ) (N := ℂ) (α := E), smul_smul] exact E ▸ hasFDerivAt_fourierIntegral L I₁ I₂ w · intro n hn apply fourierIntegral_continuous Real.continuous_fourierChar (by apply L.continuous₂) exact integrable_fourierPowSMulRight L (hf n hn) h'f /-- If `‖v‖^n * ‖f v‖` is integrable for all `n ≤ N`, then the Fourier transform of `f` is `C^N`. -/ theorem contDiff_fourierIntegral {N : ℕ∞} (hf : ∀ (n : ℕ), n ≤ N → Integrable (fun v ↦ ‖v‖^n * ‖f v‖) μ) : ContDiff ℝ N (fourierIntegral 𝐞 μ L.toLinearMap₂ f) := by by_cases h'f : Integrable f μ · exact (hasFTaylorSeriesUpTo_fourierIntegral L hf h'f.1).contDiff · have : fourierIntegral 𝐞 μ L.toLinearMap₂ f = 0 := by ext w; simp [fourierIntegral, integral, h'f] simpa [this] using contDiff_const /-- If `‖v‖^n * ‖f v‖` is integrable for all `n ≤ N`, then the `n`-th derivative of the Fourier transform of `f` is the Fourier transform of `fourierPowSMulRight L f v n`, i.e., `(L v ⬝) ^ n • f v`. -/ lemma iteratedFDeriv_fourierIntegral {N : ℕ∞} (hf : ∀ (n : ℕ), n ≤ N → Integrable (fun v ↦ ‖v‖^n * ‖f v‖) μ) (h'f : AEStronglyMeasurable f μ) {n : ℕ} (hn : n ≤ N) : iteratedFDeriv ℝ n (fourierIntegral 𝐞 μ L.toLinearMap₂ f) = fourierIntegral 𝐞 μ L.toLinearMap₂ (fun v ↦ fourierPowSMulRight L f v n) := by ext w : 1 exact ((hasFTaylorSeriesUpTo_fourierIntegral L hf h'f).eq_iteratedFDeriv hn w).symm end SecondCountableTopology /-- The Fourier integral of the `n`-th derivative of a function is obtained by multiplying the Fourier integral of the original function by `(2πI L w ⬝ )^n`. -/ theorem fourierIntegral_iteratedFDeriv [FiniteDimensional ℝ V] {μ : Measure V} [Measure.IsAddHaarMeasure μ] {N : ℕ∞} (hf : ContDiff ℝ N f) (h'f : ∀ (n : ℕ), n ≤ N → Integrable (iteratedFDeriv ℝ n f) μ) {n : ℕ} (hn : n ≤ N) : fourierIntegral 𝐞 μ L.toLinearMap₂ (iteratedFDeriv ℝ n f) = (fun w ↦ fourierPowSMulRight (-L.flip) (fourierIntegral 𝐞 μ L.toLinearMap₂ f) w n) := by induction n with | zero => ext w m simp only [iteratedFDeriv_zero_apply, Nat.zero_eq, fourierPowSMulRight_apply, pow_zero, Finset.univ_eq_empty, ContinuousLinearMap.neg_apply, ContinuousLinearMap.flip_apply, Finset.prod_empty, one_smul, fourierIntegral_continuousMultilinearMap_apply' ((h'f 0 bot_le))] | succ n ih => ext w m have J : Integrable (fderiv ℝ (iteratedFDeriv ℝ n f)) μ := by specialize h'f (n + 1) hn rw [iteratedFDeriv_succ_eq_comp_left] at h'f exact (LinearIsometryEquiv.integrable_comp_iff _).1 h'f suffices H : (fourierIntegral 𝐞 μ L.toLinearMap₂ (fderiv ℝ (iteratedFDeriv ℝ n f)) w) (m 0) (Fin.tail m) = (-(2 * π * I)) ^ (n + 1) • (∏ x : Fin (n + 1), -L (m x) w) • ∫ v, 𝐞 (-L v w) • f v ∂μ by rw [fourierIntegral_continuousMultilinearMap_apply' (h'f _ hn)] simp only [iteratedFDeriv_succ_apply_left, fourierPowSMulRight_apply, ContinuousLinearMap.neg_apply, ContinuousLinearMap.flip_apply] rw [← fourierIntegral_continuousMultilinearMap_apply' ((J.apply_continuousLinearMap _)), ← fourierIntegral_continuousLinearMap_apply' J] exact H have h'n : n < N := (Nat.cast_lt.mpr n.lt_succ_self).trans_le hn rw [fourierIntegral_fderiv _ (h'f n h'n.le) (hf.differentiable_iteratedFDeriv h'n) J] simp only [ih h'n.le, fourierSMulRight_apply, ContinuousLinearMap.neg_apply, ContinuousLinearMap.flip_apply, neg_smul, smul_neg, neg_neg, smul_apply, fourierPowSMulRight_apply, ← coe_smul (E := E), smul_smul] congr 1 simp only [ofReal_prod, ofReal_neg, pow_succ, mul_neg, Fin.prod_univ_succ, neg_mul, ofReal_mul, neg_neg, Fin.tail_def] ring /-- The `k`-th derivative of the Fourier integral of `f`, multiplied by `(L v w) ^ n`, is the Fourier integral of the `n`-th derivative of `(L v w) ^ k * f`. -/ theorem fourierPowSMulRight_iteratedFDeriv_fourierIntegral [FiniteDimensional ℝ V] {μ : Measure V} [Measure.IsAddHaarMeasure μ] {K N : ℕ∞} (hf : ContDiff ℝ N f) (h'f : ∀ (k n : ℕ), k ≤ K → n ≤ N → Integrable (fun v ↦ ‖v‖^k * ‖iteratedFDeriv ℝ n f v‖) μ) {k n : ℕ} (hk : k ≤ K) (hn : n ≤ N) {w : W} : fourierPowSMulRight (-L.flip) (iteratedFDeriv ℝ k (fourierIntegral 𝐞 μ L.toLinearMap₂ f)) w n = fourierIntegral 𝐞 μ L.toLinearMap₂ (iteratedFDeriv ℝ n (fun v ↦ fourierPowSMulRight L f v k)) w := by rw [fourierIntegral_iteratedFDeriv (N := N) _ (hf.fourierPowSMulRight _ _) _ hn] · congr rw [iteratedFDeriv_fourierIntegral (N := K) _ _ hf.continuous.aestronglyMeasurable hk] intro k hk simpa only [norm_iteratedFDeriv_zero] using h'f k 0 hk bot_le · intro m hm have I : Integrable (fun v ↦ ∑ p in Finset.range (k + 1) ×ˢ Finset.range (m + 1), ‖v‖ ^ p.1 * ‖iteratedFDeriv ℝ p.2 f v‖) μ := by apply integrable_finset_sum _ (fun p hp ↦ ?_) simp only [Finset.mem_product, Finset.mem_range_succ_iff] at hp exact h'f _ _ ((Nat.cast_le.2 hp.1).trans hk) ((Nat.cast_le.2 hp.2).trans hm) apply (I.const_mul ((2 * π) ^ k * (2 * k + 2) ^ m * ‖L‖ ^ k)).mono' ((hf.fourierPowSMulRight L k).continuous_iteratedFDeriv hm).aestronglyMeasurable filter_upwards with v refine norm_iteratedFDeriv_fourierPowSMulRight _ hf hm (fun i hi j hj ↦ ?_) apply Finset.single_le_sum (f := fun p ↦ ‖v‖ ^ p.1 * ‖iteratedFDeriv ℝ p.2 f v‖) (a := (j, i)) · intro i _hi positivity · simpa only [Finset.mem_product, Finset.mem_range_succ_iff] using ⟨hj, hi⟩ /-- One can bound the `k`-th derivative of the Fourier integral of `f`, multiplied by `(L v w) ^ n`, in terms of integrals of iterated derivatives of `f` (of order up to `n`) multiplied by `‖v‖ ^ i` (for `i ≤ k`). Auxiliary version in terms of the operator norm of `fourierPowSMulRight (-L.flip) ⬝`. For a version in terms of `|L v w| ^ n * ⬝`, see `pow_mul_norm_iteratedFDeriv_fourierIntegral_le`. -/ theorem norm_fourierPowSMulRight_iteratedFDeriv_fourierIntegral_le [FiniteDimensional ℝ V] {μ : Measure V} [Measure.IsAddHaarMeasure μ] {K N : ℕ∞} (hf : ContDiff ℝ N f) (h'f : ∀ (k n : ℕ), k ≤ K → n ≤ N → Integrable (fun v ↦ ‖v‖^k * ‖iteratedFDeriv ℝ n f v‖) μ) {k n : ℕ} (hk : k ≤ K) (hn : n ≤ N) {w : W} : ‖fourierPowSMulRight (-L.flip) (iteratedFDeriv ℝ k (fourierIntegral 𝐞 μ L.toLinearMap₂ f)) w n‖ ≤ (2 * π) ^ k * (2 * k + 2) ^ n * ‖L‖ ^ k * ∑ p in Finset.range (k + 1) ×ˢ Finset.range (n + 1), ∫ v, ‖v‖ ^ p.1 * ‖iteratedFDeriv ℝ p.2 f v‖ ∂μ := by rw [fourierPowSMulRight_iteratedFDeriv_fourierIntegral L hf h'f hk hn] apply (norm_fourierIntegral_le_integral_norm _ _ _ _ _).trans have I p (hp : p ∈ Finset.range (k + 1) ×ˢ Finset.range (n + 1)) : Integrable (fun v ↦ ‖v‖ ^ p.1 * ‖iteratedFDeriv ℝ p.2 f v‖) μ := by simp only [Finset.mem_product, Finset.mem_range_succ_iff] at hp exact h'f _ _ (le_trans (by simpa using hp.1) hk) (le_trans (by simpa using hp.2) hn) rw [← integral_finset_sum _ I, ← integral_mul_left] apply integral_mono_of_nonneg · filter_upwards with v using norm_nonneg _ · exact (integrable_finset_sum _ I).const_mul _ · filter_upwards with v apply norm_iteratedFDeriv_fourierPowSMulRight _ hf hn _ intro i hi j hj apply Finset.single_le_sum (f := fun p ↦ ‖v‖ ^ p.1 * ‖iteratedFDeriv ℝ p.2 f v‖) (a := (j, i)) · intro i _hi positivity · simp only [Finset.mem_product, Finset.mem_range_succ_iff] exact ⟨hj, hi⟩ /-- One can bound the `k`-th derivative of the Fourier integral of `f`, multiplied by `(L v w) ^ n`, in terms of integrals of iterated derivatives of `f` (of order up to `n`) multiplied by `‖v‖ ^ i` (for `i ≤ k`). -/ lemma pow_mul_norm_iteratedFDeriv_fourierIntegral_le [FiniteDimensional ℝ V] {μ : Measure V} [Measure.IsAddHaarMeasure μ] {K N : ℕ∞} (hf : ContDiff ℝ N f) (h'f : ∀ (k n : ℕ), k ≤ K → n ≤ N → Integrable (fun v ↦ ‖v‖^k * ‖iteratedFDeriv ℝ n f v‖) μ) {k n : ℕ} (hk : k ≤ K) (hn : n ≤ N) (v : V) (w : W) : |L v w| ^ n * ‖(iteratedFDeriv ℝ k (fourierIntegral 𝐞 μ L.toLinearMap₂ f)) w‖ ≤ ‖v‖ ^ n * (2 * π * ‖L‖) ^ k * (2 * k + 2) ^ n * ∑ p in Finset.range (k + 1) ×ˢ Finset.range (n + 1), ∫ v, ‖v‖ ^ p.1 * ‖iteratedFDeriv ℝ p.2 f v‖ ∂μ := calc |L v w| ^ n * ‖(iteratedFDeriv ℝ k (fourierIntegral 𝐞 μ L.toLinearMap₂ f)) w‖ _ ≤ (2 * π) ^ n * (|L v w| ^ n * ‖iteratedFDeriv ℝ k (fourierIntegral 𝐞 μ L.toLinearMap₂ f) w‖) := by apply le_mul_of_one_le_left (by positivity) apply one_le_pow_of_one_le linarith [one_le_pi_div_two] _ = ‖fourierPowSMulRight (-L.flip) (iteratedFDeriv ℝ k (fourierIntegral 𝐞 μ L.toLinearMap₂ f)) w n (fun _ ↦ v)‖ := by simp [norm_smul, _root_.abs_of_nonneg pi_nonneg] _ ≤ ‖fourierPowSMulRight (-L.flip) (iteratedFDeriv ℝ k (fourierIntegral 𝐞 μ L.toLinearMap₂ f)) w n‖ * ∏ _ : Fin n, ‖v‖ := le_opNorm _ _ _ ≤ ((2 * π) ^ k * (2 * k + 2) ^ n * ‖L‖ ^ k * ∑ p in Finset.range (k + 1) ×ˢ Finset.range (n + 1), ∫ v, ‖v‖ ^ p.1 * ‖iteratedFDeriv ℝ p.2 f v‖ ∂μ) * ‖v‖ ^ n := by gcongr · apply norm_fourierPowSMulRight_iteratedFDeriv_fourierIntegral_le _ hf h'f hk hn · simp _ = ‖v‖ ^ n * (2 * π * ‖L‖) ^ k * (2 * k + 2) ^ n * ∑ p in Finset.range (k + 1) ×ˢ Finset.range (n + 1), ∫ v, ‖v‖ ^ p.1 * ‖iteratedFDeriv ℝ p.2 f v‖ ∂μ := by simp [mul_pow] ring end VectorFourier namespace Real open VectorFourier variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] [FiniteDimensional ℝ V] [MeasurableSpace V] [BorelSpace V] {f : V → E} /-- The Fréchet derivative of the Fourier transform of `f` is the Fourier transform of `fun v ↦ -2 * π * I ⟪v, ⬝⟫ f v`. -/ theorem hasFDerivAt_fourierIntegral (hf_int : Integrable f) (hvf_int : Integrable (fun v ↦ ‖v‖ * ‖f v‖)) (x : V) : HasFDerivAt (𝓕 f) (𝓕 (fourierSMulRight (innerSL ℝ) f) x) x := VectorFourier.hasFDerivAt_fourierIntegral (innerSL ℝ) hf_int hvf_int x /-- The Fréchet derivative of the Fourier transform of `f` is the Fourier transform of `fun v ↦ -2 * π * I ⟪v, ⬝⟫ f v`. -/ theorem fderiv_fourierIntegral (hf_int : Integrable f) (hvf_int : Integrable (fun v ↦ ‖v‖ * ‖f v‖)) : fderiv ℝ (𝓕 f) = 𝓕 (fourierSMulRight (innerSL ℝ) f) := VectorFourier.fderiv_fourierIntegral (innerSL ℝ) hf_int hvf_int theorem differentiable_fourierIntegral (hf_int : Integrable f) (hvf_int : Integrable (fun v ↦ ‖v‖ * ‖f v‖)) : Differentiable ℝ (𝓕 f) := VectorFourier.differentiable_fourierIntegral (innerSL ℝ) hf_int hvf_int /-- The Fourier integral of the Fréchet derivative of a function is obtained by multiplying the Fourier integral of the original function by `2πI ⟪v, w⟫`. -/ theorem fourierIntegral_fderiv (hf : Integrable f) (h'f : Differentiable ℝ f) (hf' : Integrable (fderiv ℝ f)) : 𝓕 (fderiv ℝ f) = fourierSMulRight (-innerSL ℝ) (𝓕 f) := by rw [← innerSL_real_flip V] exact VectorFourier.fourierIntegral_fderiv (innerSL ℝ) hf h'f hf' /-- If `‖v‖^n * ‖f v‖` is integrable, then the Fourier transform of `f` is `C^n`. -/ theorem contDiff_fourierIntegral {N : ℕ∞} (hf : ∀ (n : ℕ), n ≤ N → Integrable (fun v ↦ ‖v‖^n * ‖f v‖)) : ContDiff ℝ N (𝓕 f) := VectorFourier.contDiff_fourierIntegral (innerSL ℝ) hf /-- If `‖v‖^n * ‖f v‖` is integrable, then the `n`-th derivative of the Fourier transform of `f` is the Fourier transform of `fun v ↦ (-2 * π * I) ^ n ⟪v, ⬝⟫^n f v`. -/ theorem iteratedFDeriv_fourierIntegral {N : ℕ∞} (hf : ∀ (n : ℕ), n ≤ N → Integrable (fun v ↦ ‖v‖^n * ‖f v‖)) (h'f : AEStronglyMeasurable f) {n : ℕ} (hn : n ≤ N) : iteratedFDeriv ℝ n (𝓕 f) = 𝓕 (fun v ↦ fourierPowSMulRight (innerSL ℝ) f v n) := VectorFourier.iteratedFDeriv_fourierIntegral (innerSL ℝ) hf h'f hn /-- The Fourier integral of the `n`-th derivative of a function is obtained by multiplying the Fourier integral of the original function by `(2πI L w ⬝ )^n`. -/ theorem fourierIntegral_iteratedFDeriv {N : ℕ∞} (hf : ContDiff ℝ N f) (h'f : ∀ (n : ℕ), n ≤ N → Integrable (iteratedFDeriv ℝ n f)) {n : ℕ} (hn : n ≤ N) : 𝓕 (iteratedFDeriv ℝ n f) = (fun w ↦ fourierPowSMulRight (-innerSL ℝ) (𝓕 f) w n) := by rw [← innerSL_real_flip V] exact VectorFourier.fourierIntegral_iteratedFDeriv (innerSL ℝ) hf h'f hn /-- One can bound `‖w‖^n * ‖D^k (𝓕 f) w‖` in terms of integrals of the derivatives of `f` (or order at most `n`) multiplied by powers of `v` (of order at most `k`). -/ lemma pow_mul_norm_iteratedFDeriv_fourierIntegral_le {K N : ℕ∞} (hf : ContDiff ℝ N f) (h'f : ∀ (k n : ℕ), k ≤ K → n ≤ N → Integrable (fun v ↦ ‖v‖^k * ‖iteratedFDeriv ℝ n f v‖)) {k n : ℕ} (hk : k ≤ K) (hn : n ≤ N) (w : V) : ‖w‖ ^ n * ‖iteratedFDeriv ℝ k (𝓕 f) w‖ ≤ (2 * π) ^ k * (2 * k + 2) ^ n * ∑ p in Finset.range (k + 1) ×ˢ Finset.range (n + 1), ∫ v, ‖v‖ ^ p.1 * ‖iteratedFDeriv ℝ p.2 f v‖ := by have Z : ‖w‖ ^ n * (‖w‖ ^ n * ‖iteratedFDeriv ℝ k (𝓕 f) w‖) ≤ ‖w‖ ^ n * ((2 * (π * ‖innerSL (E := V) ℝ‖)) ^ k * ((2 * k + 2) ^ n * ∑ p ∈ Finset.range (k + 1) ×ˢ Finset.range (n + 1), ∫ (v : V), ‖v‖ ^ p.1 * ‖iteratedFDeriv ℝ p.2 f v‖ ∂volume)) := by have := VectorFourier.pow_mul_norm_iteratedFDeriv_fourierIntegral_le (innerSL ℝ) hf h'f hk hn w w simp only [innerSL_apply _ w w, real_inner_self_eq_norm_sq w, _root_.abs_pow, abs_norm, mul_assoc] at this rwa [pow_two, mul_pow, mul_assoc] at this rcases eq_or_ne n 0 with rfl | hn · simp only [pow_zero, one_mul, mul_one, zero_add, Finset.range_one, Finset.product_singleton, Finset.sum_map, Function.Embedding.coeFn_mk, norm_iteratedFDeriv_zero] at Z ⊢ apply Z.trans conv_rhs => rw [← mul_one π] gcongr exact norm_innerSL_le _ rcases eq_or_ne w 0 with rfl | hw · simp [hn] positivity rw [mul_le_mul_left (pow_pos (by simp [hw]) n)] at Z apply Z.trans conv_rhs => rw [← mul_one π] simp only [mul_assoc] gcongr exact norm_innerSL_le _ lemma hasDerivAt_fourierIntegral {f : ℝ → E} (hf : Integrable f) (hf' : Integrable (fun x : ℝ ↦ x • f x)) (w : ℝ) : HasDerivAt (𝓕 f) (𝓕 (fun x : ℝ ↦ (-2 * π * I * x) • f x) w) w := by have hf'' : Integrable (fun v : ℝ ↦ ‖v‖ * ‖f v‖) := by simpa only [norm_smul] using hf'.norm let L := ContinuousLinearMap.mul ℝ ℝ have h_int : Integrable fun v ↦ fourierSMulRight L f v := by suffices Integrable fun v ↦ ContinuousLinearMap.smulRight (L v) (f v) by simpa only [fourierSMulRight, neg_smul, neg_mul, Pi.smul_apply] using this.smul (-2 * π * I) convert ((ContinuousLinearMap.ring_lmap_equiv_self ℝ E).symm.toContinuousLinearEquiv.toContinuousLinearMap).integrable_comp hf' using 2 with v apply ContinuousLinearMap.ext_ring rw [ContinuousLinearMap.smulRight_apply, ContinuousLinearMap.mul_apply', mul_one, ContinuousLinearMap.map_smul] exact congr_arg (fun x ↦ v • x) (one_smul ℝ (f v)).symm rw [← VectorFourier.fourierIntegral_convergent_iff continuous_fourierChar L.continuous₂ w] at h_int convert (VectorFourier.hasFDerivAt_fourierIntegral L hf hf'' w).hasDerivAt using 1 erw [ContinuousLinearMap.integral_apply h_int] simp_rw [ContinuousLinearMap.smul_apply, fourierSMulRight, ContinuousLinearMap.smul_apply, ContinuousLinearMap.smulRight_apply, L, ContinuousLinearMap.mul_apply', mul_one, ← neg_mul, mul_smul] rfl theorem deriv_fourierIntegral {f : ℝ → E} (hf : Integrable f) (hf' : Integrable (fun x : ℝ ↦ x • f x)) : deriv (𝓕 f) = 𝓕 (fun x : ℝ ↦ (-2 * π * I * x) • f x) := by ext x exact (hasDerivAt_fourierIntegral hf hf' x).deriv /-- The Fourier integral of the Fréchet derivative of a function is obtained by multiplying the Fourier integral of the original function by `2πI x`. -/ theorem fourierIntegral_deriv {f : ℝ → E} (hf : Integrable f) (h'f : Differentiable ℝ f) (hf' : Integrable (deriv f)) : 𝓕 (deriv f) = fun (x : ℝ) ↦ (2 * π * I * x) • (𝓕 f x) := by ext x have I : Integrable (fun x ↦ fderiv ℝ f x) := by simpa only [← deriv_fderiv] using (ContinuousLinearMap.smulRightL ℝ ℝ E 1).integrable_comp hf' have : 𝓕 (deriv f) x = 𝓕 (fderiv ℝ f) x 1 := by simp only [fourierIntegral_continuousLinearMap_apply I, fderiv_deriv] rw [this, fourierIntegral_fderiv hf h'f I] simp only [fourierSMulRight_apply, ContinuousLinearMap.neg_apply, innerSL_apply, smul_smul, RCLike.inner_apply, conj_trivial, mul_one, neg_smul, smul_neg, neg_neg, neg_mul, ← coe_smul] theorem iteratedDeriv_fourierIntegral {f : ℝ → E} {N : ℕ∞} {n : ℕ} (hf : ∀ (n : ℕ), n ≤ N → Integrable (fun x ↦ x^n • f x)) (hn : n ≤ N) : iteratedDeriv n (𝓕 f) = 𝓕 (fun x : ℝ ↦ (-2 * π * I * x) ^ n • f x) := by ext x : 1 have A (n : ℕ) (hn : n ≤ N) : Integrable (fun v ↦ ‖v‖^n * ‖f v‖) := by convert (hf n hn).norm with x simp [norm_smul] have B : AEStronglyMeasurable f := by convert (hf 0 (zero_le _)).1 with x simp rw [iteratedDeriv, iteratedFDeriv_fourierIntegral A B hn, fourierIntegral_continuousMultilinearMap_apply (integrable_fourierPowSMulRight _ (A n hn) B), fourierIntegral_eq, fourierIntegral_eq] congr with y suffices (-(2 * π * I)) ^ n • y ^ n • f y = (-(2 * π * I * y)) ^ n • f y by simpa [innerSL_apply _] simp only [← neg_mul, ← coe_smul, smul_smul, mul_pow, ofReal_pow, mul_assoc] theorem fourierIntegral_iteratedDeriv {f : ℝ → E} {N : ℕ∞} {n : ℕ} (hf : ContDiff ℝ N f) (h'f : ∀ (n : ℕ), n ≤ N → Integrable (iteratedDeriv n f)) (hn : n ≤ N) : 𝓕 (iteratedDeriv n f) = fun (x : ℝ) ↦ (2 * π * I * x) ^ n • (𝓕 f x) := by ext x : 1 have A : ∀ (n : ℕ), n ≤ N → Integrable (iteratedFDeriv ℝ n f) := by intro n hn rw [iteratedFDeriv_eq_equiv_comp] exact (LinearIsometryEquiv.integrable_comp_iff _).2 (h'f n hn) change 𝓕 (fun x ↦ iteratedDeriv n f x) x = _ simp_rw [iteratedDeriv, ← fourierIntegral_continuousMultilinearMap_apply (A n hn), fourierIntegral_iteratedFDeriv hf A hn] simp [← coe_smul, smul_smul, ← mul_pow] end Real
Analysis\Fourier\Inversion.lean
/- Copyright (c) 2024 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.MeasureTheory.Integral.PeakFunction import Mathlib.Analysis.SpecialFunctions.Gaussian.FourierTransform /-! # Fourier inversion formula In a finite-dimensional real inner product space, we show the Fourier inversion formula, i.e., `𝓕⁻ (𝓕 f) v = f v` if `f` and `𝓕 f` are integrable, and `f` is continuous at `v`. This is proved in `MeasureTheory.Integrable.fourier_inversion`. See also `Continuous.fourier_inversion` giving `𝓕⁻ (𝓕 f) = f` under an additional continuity assumption for `f`. We use the following proof. A naïve computation gives `𝓕⁻ (𝓕 f) v = ∫_w exp (2 I π ⟪w, v⟫) 𝓕 f (w) dw = ∫_w exp (2 I π ⟪w, v⟫) ∫_x, exp (-2 I π ⟪w, x⟫) f x dx) dw = ∫_x (∫_ w, exp (2 I π ⟪w, v - x⟫ dw) f x dx ` However, the Fubini step does not make sense for lack of integrability, and the middle integral `∫_ w, exp (2 I π ⟪w, v - x⟫ dw` (which one would like to be a Dirac at `v - x`) is not defined. To gain integrability, one multiplies with a Gaussian function `exp (-c⁻¹ ‖w‖^2)`, with a large (but finite) `c`. As this function converges pointwise to `1` when `c → ∞`, we get `∫_w exp (2 I π ⟪w, v⟫) 𝓕 f (w) dw = lim_c ∫_w exp (-c⁻¹ ‖w‖^2 + 2 I π ⟪w, v⟫) 𝓕 f (w) dw`. One can perform Fubini on the right hand side for fixed `c`, writing the integral as `∫_x (∫_w exp (-c⁻¹‖w‖^2 + 2 I π ⟪w, v - x⟫ dw)) f x dx`. The middle factor is the Fourier transform of a more and more flat function (converging to the constant `1`), hence it becomes more and more concentrated, around the point `v`. (Morally, it converges to the Dirac at `v`). Moreover, it has integral one. Therefore, multiplying by `f` and integrating, one gets a term converging to `f v` as `c → ∞`. Since it also converges to `𝓕⁻ (𝓕 f) v`, this proves the result. To check the concentration property of the middle factor and the fact that it has integral one, we rely on the explicit computation of the Fourier transform of Gaussians. -/ open Filter MeasureTheory Complex FiniteDimensional Metric Real Bornology open scoped Topology FourierTransform RealInnerProductSpace Complex variable {V E : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MeasurableSpace V] [BorelSpace V] [FiniteDimensional ℝ V] [NormedAddCommGroup E] [NormedSpace ℂ E] {f : V → E} namespace Real lemma tendsto_integral_cexp_sq_smul (hf : Integrable f) : Tendsto (fun (c : ℝ) ↦ (∫ v : V, cexp (- c⁻¹ * ‖v‖^2) • f v)) atTop (𝓝 (∫ v : V, f v)) := by apply tendsto_integral_filter_of_dominated_convergence _ _ _ hf.norm · filter_upwards with v nth_rewrite 2 [show f v = cexp (- (0 : ℝ) * ‖v‖^2) • f v by simp] apply (Tendsto.cexp _).smul_const exact tendsto_inv_atTop_zero.ofReal.neg.mul_const _ · filter_upwards with c using AEStronglyMeasurable.smul (Continuous.aestronglyMeasurable (by fun_prop)) hf.1 · filter_upwards [Ici_mem_atTop (0 : ℝ)] with c (hc : 0 ≤ c) filter_upwards with v simp only [ofReal_inv, neg_mul, norm_smul, Complex.norm_eq_abs] norm_cast conv_rhs => rw [← one_mul (‖f v‖)] gcongr simp only [abs_exp, exp_le_one_iff, Left.neg_nonpos_iff] positivity variable [CompleteSpace E] lemma tendsto_integral_gaussian_smul (hf : Integrable f) (h'f : Integrable (𝓕 f)) (v : V) : Tendsto (fun (c : ℝ) ↦ ∫ w : V, ((π * c) ^ (finrank ℝ V / 2 : ℂ) * cexp (-π ^ 2 * c * ‖v - w‖ ^ 2)) • f w) atTop (𝓝 (𝓕⁻ (𝓕 f) v)) := by have A : Tendsto (fun (c : ℝ) ↦ (∫ w : V, cexp (- c⁻¹ * ‖w‖^2 + 2 * π * I * ⟪v, w⟫) • (𝓕 f) w)) atTop (𝓝 (𝓕⁻ (𝓕 f) v)) := by have : Integrable (fun w ↦ 𝐞 ⟪w, v⟫ • (𝓕 f) w) := by have B : Continuous fun p : V × V => (- innerₗ V) p.1 p.2 := continuous_inner.neg simpa using (VectorFourier.fourierIntegral_convergent_iff Real.continuous_fourierChar B v).2 h'f convert tendsto_integral_cexp_sq_smul this using 4 with c w · rw [Submonoid.smul_def, Real.fourierChar_apply, smul_smul, ← Complex.exp_add, real_inner_comm] congr 3 simp only [ofReal_mul, ofReal_ofNat] ring · simp [fourierIntegralInv_eq] have B : Tendsto (fun (c : ℝ) ↦ (∫ w : V, 𝓕 (fun w ↦ cexp (- c⁻¹ * ‖w‖^2 + 2 * π * I * ⟪v, w⟫)) w • f w)) atTop (𝓝 (𝓕⁻ (𝓕 f) v)) := by apply A.congr' filter_upwards [Ioi_mem_atTop 0] with c (hc : 0 < c) have J : Integrable (fun w ↦ cexp (- c⁻¹ * ‖w‖^2 + 2 * π * I * ⟪v, w⟫)) := GaussianFourier.integrable_cexp_neg_mul_sq_norm_add (by simpa) _ _ simpa using (VectorFourier.integral_fourierIntegral_smul_eq_flip (L := innerₗ V) Real.continuous_fourierChar continuous_inner J hf).symm apply B.congr' filter_upwards [Ioi_mem_atTop 0] with c (hc : 0 < c) congr with w rw [fourierIntegral_gaussian_innerProductSpace' (by simpa)] congr · simp · simp; ring lemma tendsto_integral_gaussian_smul' (hf : Integrable f) {v : V} (h'f : ContinuousAt f v) : Tendsto (fun (c : ℝ) ↦ ∫ w : V, ((π * c : ℂ) ^ (finrank ℝ V / 2 : ℂ) * cexp (-π ^ 2 * c * ‖v - w‖ ^ 2)) • f w) atTop (𝓝 (f v)) := by let φ : V → ℝ := fun w ↦ π ^ (finrank ℝ V / 2 : ℝ) * Real.exp (-π^2 * ‖w‖^2) have A : Tendsto (fun (c : ℝ) ↦ ∫ w : V, (c ^ finrank ℝ V * φ (c • (v - w))) • f w) atTop (𝓝 (f v)) := by apply tendsto_integral_comp_smul_smul_of_integrable' · exact fun x ↦ by positivity · rw [integral_mul_left, GaussianFourier.integral_rexp_neg_mul_sq_norm (by positivity)] nth_rewrite 2 [← pow_one π] rw [← rpow_natCast, ← rpow_natCast, ← rpow_sub pi_pos, ← rpow_mul pi_nonneg, ← rpow_add pi_pos] ring_nf exact rpow_zero _ · have A : Tendsto (fun (w : V) ↦ π^2 * ‖w‖^2) (cobounded V) atTop := by rw [tendsto_const_mul_atTop_of_pos (by positivity)] apply (tendsto_pow_atTop two_ne_zero).comp tendsto_norm_cobounded_atTop have B := tendsto_rpow_mul_exp_neg_mul_atTop_nhds_zero (finrank ℝ V / 2) 1 zero_lt_one |>.comp A |>.const_mul (π ^ (-finrank ℝ V / 2 : ℝ)) rw [mul_zero] at B convert B using 2 with x simp only [neg_mul, one_mul, Function.comp_apply, ← mul_assoc, ← rpow_natCast, φ] congr 1 rw [mul_rpow (by positivity) (by positivity), ← rpow_mul pi_nonneg, ← rpow_mul (norm_nonneg _), ← mul_assoc, ← rpow_add pi_pos, mul_comm] congr <;> ring · exact hf · exact h'f have B : Tendsto (fun (c : ℝ) ↦ ∫ w : V, ((c^(1/2 : ℝ)) ^ finrank ℝ V * φ ((c^(1/2 : ℝ)) • (v - w))) • f w) atTop (𝓝 (f v)) := A.comp (tendsto_rpow_atTop (by norm_num)) apply B.congr' filter_upwards [Ioi_mem_atTop 0] with c (hc : 0 < c) congr with w rw [← coe_smul] congr rw [ofReal_mul, ofReal_mul, ofReal_exp, ← mul_assoc] congr · rw [mul_cpow_ofReal_nonneg pi_nonneg hc.le, ← rpow_natCast, ← rpow_mul hc.le, mul_comm, ofReal_cpow pi_nonneg, ofReal_cpow hc.le] simp [div_eq_inv_mul] · norm_cast simp only [one_div, norm_smul, Real.norm_eq_abs, mul_pow, _root_.sq_abs, neg_mul, neg_inj, ← rpow_natCast, ← rpow_mul hc.le, mul_assoc] norm_num end Real variable [CompleteSpace E] /-- **Fourier inversion formula**: If a function `f` on a finite-dimensional real inner product space is integrable, and its Fourier transform `𝓕 f` is also integrable, then `𝓕⁻ (𝓕 f) = f` at continuity points of `f`. -/ theorem MeasureTheory.Integrable.fourier_inversion (hf : Integrable f) (h'f : Integrable (𝓕 f)) {v : V} (hv : ContinuousAt f v) : 𝓕⁻ (𝓕 f) v = f v := tendsto_nhds_unique (Real.tendsto_integral_gaussian_smul hf h'f v) (Real.tendsto_integral_gaussian_smul' hf hv) /-- **Fourier inversion formula**: If a function `f` on a finite-dimensional real inner product space is continuous, integrable, and its Fourier transform `𝓕 f` is also integrable, then `𝓕⁻ (𝓕 f) = f`. -/ theorem Continuous.fourier_inversion (h : Continuous f) (hf : Integrable f) (h'f : Integrable (𝓕 f)) : 𝓕⁻ (𝓕 f) = f := by ext v exact hf.fourier_inversion h'f h.continuousAt /-- **Fourier inversion formula**: If a function `f` on a finite-dimensional real inner product space is integrable, and its Fourier transform `𝓕 f` is also integrable, then `𝓕 (𝓕⁻ f) = f` at continuity points of `f`. -/ theorem MeasureTheory.Integrable.fourier_inversion_inv (hf : Integrable f) (h'f : Integrable (𝓕 f)) {v : V} (hv : ContinuousAt f v) : 𝓕 (𝓕⁻ f) v = f v := by rw [fourierIntegralInv_comm] exact fourier_inversion hf h'f hv /-- **Fourier inversion formula**: If a function `f` on a finite-dimensional real inner product space is continuous, integrable, and its Fourier transform `𝓕 f` is also integrable, then `𝓕 (𝓕⁻ f) = f`. -/ theorem Continuous.fourier_inversion_inv (h : Continuous f) (hf : Integrable f) (h'f : Integrable (𝓕 f)) : 𝓕 (𝓕⁻ f) = f := by ext v exact hf.fourier_inversion_inv h'f h.continuousAt
Analysis\Fourier\PoissonSummation.lean
/- Copyright (c) 2023 David Loeffler. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: David Loeffler -/ import Mathlib.Analysis.Fourier.AddCircle import Mathlib.Analysis.Fourier.FourierTransform import Mathlib.Analysis.PSeries import Mathlib.Analysis.Distribution.SchwartzSpace import Mathlib.MeasureTheory.Measure.Lebesgue.Integral /-! # Poisson's summation formula We prove Poisson's summation formula `∑ (n : ℤ), f n = ∑ (n : ℤ), 𝓕 f n`, where `𝓕 f` is the Fourier transform of `f`, under the following hypotheses: * `f` is a continuous function `ℝ → ℂ`. * The sum `∑ (n : ℤ), 𝓕 f n` is convergent. * For all compacts `K ⊂ ℝ`, the sum `∑ (n : ℤ), sup { ‖f(x + n)‖ | x ∈ K }` is convergent. See `Real.tsum_eq_tsum_fourierIntegral` for this formulation. These hypotheses are potentially a little awkward to apply, so we also provide the less general but easier-to-use result `Real.tsum_eq_tsum_fourierIntegral_of_rpow_decay`, in which we assume `f` and `𝓕 f` both decay as `|x| ^ (-b)` for some `b > 1`, and the even more specific result `SchwartzMap.tsum_eq_tsum_fourierIntegral`, where we assume that both `f` and `𝓕 f` are Schwartz functions. ## TODO At the moment `SchwartzMap.tsum_eq_tsum_fourierIntegral` requires separate proofs that both `f` and `𝓕 f` are Schwartz functions. In fact, `𝓕 f` is automatically Schwartz if `f` is; and once we have this lemma in the library, we should adjust the hypotheses here accordingly. -/ noncomputable section open Function hiding comp_apply open Set hiding restrict_apply open Complex hiding abs_of_nonneg open Real open TopologicalSpace Filter MeasureTheory Asymptotics open scoped Real Filter FourierTransform open ContinuousMap /-- The key lemma for Poisson summation: the `m`-th Fourier coefficient of the periodic function `∑' n : ℤ, f (x + n)` is the value at `m` of the Fourier transform of `f`. -/ theorem Real.fourierCoeff_tsum_comp_add {f : C(ℝ, ℂ)} (hf : ∀ K : Compacts ℝ, Summable fun n : ℤ => ‖(f.comp (ContinuousMap.addRight n)).restrict K‖) (m : ℤ) : fourierCoeff (Periodic.lift <| f.periodic_tsum_comp_add_zsmul 1) m = 𝓕 f m := by -- NB: This proof can be shortened somewhat by telescoping together some of the steps in the calc -- block, but I think it's more legible this way. We start with preliminaries about the integrand. let e : C(ℝ, ℂ) := (fourier (-m)).comp ⟨((↑) : ℝ → UnitAddCircle), continuous_quotient_mk'⟩ have neK : ∀ (K : Compacts ℝ) (g : C(ℝ, ℂ)), ‖(e * g).restrict K‖ = ‖g.restrict K‖ := by have (x : ℝ) : ‖e x‖ = 1 := abs_coe_circle (AddCircle.toCircle (-m • x)) intro K g simp_rw [norm_eq_iSup_norm, restrict_apply, mul_apply, norm_mul, this, one_mul] have eadd : ∀ (n : ℤ), e.comp (ContinuousMap.addRight n) = e := by intro n; ext1 x have : Periodic e 1 := Periodic.comp (fun x => AddCircle.coe_add_period 1 x) (fourier (-m)) simpa only [mul_one] using this.int_mul n x -- Now the main argument. First unwind some definitions. calc fourierCoeff (Periodic.lift <| f.periodic_tsum_comp_add_zsmul 1) m = ∫ x in (0 : ℝ)..1, e x * (∑' n : ℤ, f.comp (ContinuousMap.addRight n)) x := by simp_rw [fourierCoeff_eq_intervalIntegral _ m 0, div_one, one_smul, zero_add, e, comp_apply, coe_mk, Periodic.lift_coe, zsmul_one, smul_eq_mul] -- Transform sum in C(ℝ, ℂ) evaluated at x into pointwise sum of values. _ = ∫ x in (0 : ℝ)..1, ∑' n : ℤ, (e * f.comp (ContinuousMap.addRight n)) x := by simp_rw [coe_mul, Pi.mul_apply, ← ContinuousMap.tsum_apply (summable_of_locally_summable_norm hf), tsum_mul_left] -- Swap sum and integral. _ = ∑' n : ℤ, ∫ x in (0 : ℝ)..1, (e * f.comp (ContinuousMap.addRight n)) x := by refine (intervalIntegral.tsum_intervalIntegral_eq_of_summable_norm ?_).symm convert hf ⟨uIcc 0 1, isCompact_uIcc⟩ using 1 exact funext fun n => neK _ _ _ = ∑' n : ℤ, ∫ x in (0 : ℝ)..1, (e * f).comp (ContinuousMap.addRight n) x := by simp only [ContinuousMap.comp_apply, mul_comp] at eadd ⊢ simp_rw [eadd] -- Rearrange sum of interval integrals into an integral over `ℝ`. _ = ∫ x, e x * f x := by suffices Integrable (e * f) from this.hasSum_intervalIntegral_comp_add_int.tsum_eq apply integrable_of_summable_norm_Icc convert hf ⟨Icc 0 1, isCompact_Icc⟩ using 1 simp_rw [mul_comp] at eadd ⊢ simp_rw [eadd] exact funext fun n => neK ⟨Icc 0 1, isCompact_Icc⟩ _ -- Minor tidying to finish _ = 𝓕 f m := by rw [fourierIntegral_real_eq_integral_exp_smul] congr 1 with x : 1 rw [smul_eq_mul, comp_apply, coe_mk, coe_mk, ContinuousMap.toFun_eq_coe, fourier_coe_apply] congr 2 push_cast ring /-- **Poisson's summation formula**, most general form. -/ theorem Real.tsum_eq_tsum_fourierIntegral {f : C(ℝ, ℂ)} (h_norm : ∀ K : Compacts ℝ, Summable fun n : ℤ => ‖(f.comp <| ContinuousMap.addRight n).restrict K‖) (h_sum : Summable fun n : ℤ => 𝓕 f n) (x : ℝ) : ∑' n : ℤ, f (x + n) = ∑' n : ℤ, 𝓕 f n * fourier n (x : UnitAddCircle) := by let F : C(UnitAddCircle, ℂ) := ⟨(f.periodic_tsum_comp_add_zsmul 1).lift, continuous_coinduced_dom.mpr (map_continuous _)⟩ have : Summable (fourierCoeff F) := by convert h_sum exact Real.fourierCoeff_tsum_comp_add h_norm _ convert (has_pointwise_sum_fourier_series_of_summable this x).tsum_eq.symm using 1 · simpa only [F, coe_mk, ← QuotientAddGroup.mk_zero, Periodic.lift_coe, zsmul_one, comp_apply, coe_addRight, zero_add] using (hasSum_apply (summable_of_locally_summable_norm h_norm).hasSum x).tsum_eq · simp_rw [← Real.fourierCoeff_tsum_comp_add h_norm, smul_eq_mul, F, coe_mk] section RpowDecay variable {E : Type*} [NormedAddCommGroup E] /-- If `f` is `O(x ^ (-b))` at infinity, then so is the function `fun x ↦ ‖f.restrict (Icc (x + R) (x + S))‖` for any fixed `R` and `S`. -/ theorem isBigO_norm_Icc_restrict_atTop {f : C(ℝ, E)} {b : ℝ} (hb : 0 < b) (hf : f =O[atTop] fun x : ℝ => |x| ^ (-b)) (R S : ℝ) : (fun x : ℝ => ‖f.restrict (Icc (x + R) (x + S))‖) =O[atTop] fun x : ℝ => |x| ^ (-b) := by -- First establish an explicit estimate on decay of inverse powers. -- This is logically independent of the rest of the proof, but of no mathematical interest in -- itself, so it is proved in-line rather than being formulated as a separate lemma. have claim : ∀ x : ℝ, max 0 (-2 * R) < x → ∀ y : ℝ, x + R ≤ y → y ^ (-b) ≤ (1 / 2) ^ (-b) * x ^ (-b) := fun x hx y hy ↦ by rw [max_lt_iff] at hx obtain ⟨hx1, hx2⟩ := hx rw [← mul_rpow] <;> try positivity apply rpow_le_rpow_of_nonpos <;> linarith -- Now the main proof. obtain ⟨c, hc, hc'⟩ := hf.exists_pos simp only [IsBigO, IsBigOWith, eventually_atTop] at hc' ⊢ obtain ⟨d, hd⟩ := hc' refine ⟨c * (1 / 2) ^ (-b), ⟨max (1 + max 0 (-2 * R)) (d - R), fun x hx => ?_⟩⟩ rw [ge_iff_le, max_le_iff] at hx have hx' : max 0 (-2 * R) < x := by linarith rw [max_lt_iff] at hx' rw [norm_norm, ContinuousMap.norm_le _ (by positivity)] refine fun y => (hd y.1 (by linarith [hx.1, y.2.1])).trans ?_ have A : ∀ x : ℝ, 0 ≤ |x| ^ (-b) := fun x => by positivity rw [mul_assoc, mul_le_mul_left hc, norm_of_nonneg (A _), norm_of_nonneg (A _)] convert claim x (by linarith only [hx.1]) y.1 y.2.1 · apply abs_of_nonneg; linarith [y.2.1] · exact abs_of_pos hx'.1 theorem isBigO_norm_Icc_restrict_atBot {f : C(ℝ, E)} {b : ℝ} (hb : 0 < b) (hf : f =O[atBot] fun x : ℝ => |x| ^ (-b)) (R S : ℝ) : (fun x : ℝ => ‖f.restrict (Icc (x + R) (x + S))‖) =O[atBot] fun x : ℝ => |x| ^ (-b) := by have h1 : (f.comp (ContinuousMap.mk _ continuous_neg)) =O[atTop] fun x : ℝ => |x| ^ (-b) := by convert hf.comp_tendsto tendsto_neg_atTop_atBot using 1 ext1 x; simp only [Function.comp_apply, abs_neg] have h2 := (isBigO_norm_Icc_restrict_atTop hb h1 (-S) (-R)).comp_tendsto tendsto_neg_atBot_atTop have : (fun x : ℝ => |x| ^ (-b)) ∘ Neg.neg = fun x : ℝ => |x| ^ (-b) := by ext1 x; simp only [Function.comp_apply, abs_neg] rw [this] at h2 refine (isBigO_of_le _ fun x => ?_).trans h2 -- equality holds, but less work to prove `≤` alone rw [norm_norm, Function.comp_apply, norm_norm, ContinuousMap.norm_le _ (norm_nonneg _)] rintro ⟨x, hx⟩ rw [ContinuousMap.restrict_apply_mk] refine (le_of_eq ?_).trans (ContinuousMap.norm_coe_le_norm _ ⟨-x, ?_⟩) · rw [ContinuousMap.restrict_apply_mk, ContinuousMap.comp_apply, ContinuousMap.coe_mk, ContinuousMap.coe_mk, neg_neg] · exact ⟨by linarith [hx.2], by linarith [hx.1]⟩ theorem isBigO_norm_restrict_cocompact (f : C(ℝ, E)) {b : ℝ} (hb : 0 < b) (hf : f =O[cocompact ℝ] fun x : ℝ => |x| ^ (-b)) (K : Compacts ℝ) : (fun x => ‖(f.comp (ContinuousMap.addRight x)).restrict K‖) =O[cocompact ℝ] (|·| ^ (-b)) := by obtain ⟨r, hr⟩ := K.isCompact.isBounded.subset_closedBall 0 rw [closedBall_eq_Icc, zero_add, zero_sub] at hr have : ∀ x : ℝ, ‖(f.comp (ContinuousMap.addRight x)).restrict K‖ ≤ ‖f.restrict (Icc (x - r) (x + r))‖ := by intro x rw [ContinuousMap.norm_le _ (norm_nonneg _)] rintro ⟨y, hy⟩ refine (le_of_eq ?_).trans (ContinuousMap.norm_coe_le_norm _ ⟨y + x, ?_⟩) · simp_rw [ContinuousMap.restrict_apply, ContinuousMap.comp_apply, ContinuousMap.coe_addRight] · exact ⟨by linarith [(hr hy).1], by linarith [(hr hy).2]⟩ simp_rw [cocompact_eq_atBot_atTop, isBigO_sup] at hf ⊢ constructor · refine (isBigO_of_le atBot ?_).trans (isBigO_norm_Icc_restrict_atBot hb hf.1 (-r) r) simp_rw [norm_norm]; exact this · refine (isBigO_of_le atTop ?_).trans (isBigO_norm_Icc_restrict_atTop hb hf.2 (-r) r) simp_rw [norm_norm]; exact this /-- **Poisson's summation formula**, assuming that `f` decays as `|x| ^ (-b)` for some `1 < b` and its Fourier transform is summable. -/ theorem Real.tsum_eq_tsum_fourierIntegral_of_rpow_decay_of_summable {f : ℝ → ℂ} (hc : Continuous f) {b : ℝ} (hb : 1 < b) (hf : IsBigO (cocompact ℝ) f fun x : ℝ => |x| ^ (-b)) (hFf : Summable fun n : ℤ => 𝓕 f n) (x : ℝ) : ∑' n : ℤ, f (x + n) = ∑' n : ℤ, 𝓕 f n * fourier n (x : UnitAddCircle) := Real.tsum_eq_tsum_fourierIntegral (fun K => summable_of_isBigO (Real.summable_abs_int_rpow hb) ((isBigO_norm_restrict_cocompact ⟨_, hc⟩ (zero_lt_one.trans hb) hf K).comp_tendsto Int.tendsto_coe_cofinite)) hFf x /-- **Poisson's summation formula**, assuming that both `f` and its Fourier transform decay as `|x| ^ (-b)` for some `1 < b`. (This is the one-dimensional case of Corollary VII.2.6 of Stein and Weiss, *Introduction to Fourier analysis on Euclidean spaces*.) -/ theorem Real.tsum_eq_tsum_fourierIntegral_of_rpow_decay {f : ℝ → ℂ} (hc : Continuous f) {b : ℝ} (hb : 1 < b) (hf : f =O[cocompact ℝ] (|·| ^ (-b))) (hFf : (𝓕 f) =O[cocompact ℝ] (|·| ^ (-b))) (x : ℝ) : ∑' n : ℤ, f (x + n) = ∑' n : ℤ, 𝓕 f n * fourier n (x : UnitAddCircle) := Real.tsum_eq_tsum_fourierIntegral_of_rpow_decay_of_summable hc hb hf (summable_of_isBigO (Real.summable_abs_int_rpow hb) (hFf.comp_tendsto Int.tendsto_coe_cofinite)) x end RpowDecay section Schwartz /-- **Poisson's summation formula** for Schwartz functions. -/ theorem SchwartzMap.tsum_eq_tsum_fourierIntegral (f g : SchwartzMap ℝ ℂ) (hfg : 𝓕 ⇑f = ⇑g) (x : ℝ) : ∑' n : ℤ, f (x + n) = (∑' n : ℤ, g n * fourier n (x : UnitAddCircle)) := by -- We know that Schwartz functions are `O(‖x ^ (-b)‖)` for *every* `b`; for this argument we take -- `b = 2` and work with that. simp only [← hfg, Real.tsum_eq_tsum_fourierIntegral_of_rpow_decay f.continuous one_lt_two (f.isBigO_cocompact_rpow (-2)) (hfg ▸ g.isBigO_cocompact_rpow (-2))] end Schwartz
Analysis\Fourier\RiemannLebesgueLemma.lean
/- Copyright (c) 2022 David Loeffler. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: David Loeffler -/ import Mathlib.Analysis.Fourier.FourierTransform import Mathlib.Analysis.InnerProductSpace.Dual import Mathlib.Analysis.InnerProductSpace.EuclideanDist import Mathlib.MeasureTheory.Function.ContinuousMapDense import Mathlib.MeasureTheory.Group.Integral import Mathlib.MeasureTheory.Integral.SetIntegral import Mathlib.MeasureTheory.Measure.Haar.NormedSpace import Mathlib.Topology.EMetricSpace.Paracompact import Mathlib.MeasureTheory.Measure.Haar.Unique /-! # The Riemann-Lebesgue Lemma In this file we prove the Riemann-Lebesgue lemma, for functions on finite-dimensional real vector spaces `V`: if `f` is a function on `V` (valued in a complete normed space `E`), then the Fourier transform of `f`, viewed as a function on the dual space of `V`, tends to 0 along the cocompact filter. Here the Fourier transform is defined by `fun w : V →L[ℝ] ℝ ↦ ∫ (v : V), exp (↑(2 * π * w v) * I) • f v`. This is true for arbitrary functions, but is only interesting for `L¹` functions (if `f` is not integrable then the integral is zero for all `w`). This is proved first for continuous compactly-supported functions on inner-product spaces; then we pass to arbitrary functions using the density of continuous compactly-supported functions in `L¹` space. Finally we generalise from inner-product spaces to arbitrary finite-dimensional spaces, by choosing a continuous linear equivalence to an inner-product space. ## Main results - `tendsto_integral_exp_inner_smul_cocompact` : for `V` a finite-dimensional real inner product space and `f : V → E`, the function `fun w : V ↦ ∫ v : V, exp (2 * π * ⟪w, v⟫ * I) • f v` tends to 0 along `cocompact V`. - `tendsto_integral_exp_smul_cocompact` : for `V` a finite-dimensional real vector space (endowed with its unique Hausdorff topological vector space structure), and `W` the dual of `V`, the function `fun w : W ↦ ∫ v : V, exp (2 * π * w v * I) • f v` tends to along `cocompact W`. - `Real.tendsto_integral_exp_smul_cocompact`: special case of functions on `ℝ`. - `Real.zero_at_infty_fourierIntegral` and `Real.zero_at_infty_vector_fourierIntegral`: reformulations explicitly using the Fourier integral. -/ noncomputable section open MeasureTheory Filter Complex Set FiniteDimensional open scoped Filter Topology Real ENNReal FourierTransform RealInnerProductSpace NNReal variable {E V : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] {f : V → E} section InnerProductSpace variable [NormedAddCommGroup V] [MeasurableSpace V] [BorelSpace V] [InnerProductSpace ℝ V] [FiniteDimensional ℝ V] variable [CompleteSpace E] local notation3 "i" => fun (w : V) => (1 / (2 * ‖w‖ ^ 2) : ℝ) • w /-- Shifting `f` by `(1 / (2 * ‖w‖ ^ 2)) • w` negates the integral in the Riemann-Lebesgue lemma. -/ theorem fourierIntegral_half_period_translate {w : V} (hw : w ≠ 0) : (∫ v : V, 𝐞 (-⟪v, w⟫) • f (v + i w)) = -∫ v : V, 𝐞 (-⟪v, w⟫) • f v := by have hiw : ⟪i w, w⟫ = 1 / 2 := by rw [inner_smul_left, inner_self_eq_norm_sq_to_K, RCLike.ofReal_real_eq_id, id, RCLike.conj_to_real, ← div_div, div_mul_cancel₀] rwa [Ne, sq_eq_zero_iff, norm_eq_zero] have : (fun v : V => 𝐞 (-⟪v, w⟫) • f (v + i w)) = fun v : V => (fun x : V => -(𝐞 (-⟪x, w⟫) • f x)) (v + i w) := by ext1 v simp_rw [inner_add_left, hiw, Submonoid.smul_def, Real.fourierChar_apply, neg_add, mul_add, ofReal_add, add_mul, exp_add] have : 2 * π * -(1 / 2) = -π := by field_simp; ring rw [this, ofReal_neg, neg_mul, exp_neg, exp_pi_mul_I, inv_neg, inv_one, mul_neg_one, neg_smul, neg_neg] rw [this] -- Porting note: -- The next three lines had just been -- rw [integral_add_right_eq_self (fun (x : V) ↦ -(𝐞[-⟪x, w⟫]) • f x) -- ((fun w ↦ (1 / (2 * ‖w‖ ^ (2 : ℕ))) • w) w)] -- Unfortunately now we need to specify `volume`. have := integral_add_right_eq_self (μ := volume) (fun (x : V) ↦ -(𝐞 (-⟪x, w⟫) • f x)) ((fun w ↦ (1 / (2 * ‖w‖ ^ (2 : ℕ))) • w) w) rw [this] simp only [neg_smul, integral_neg] /-- Rewrite the Fourier integral in a form that allows us to use uniform continuity. -/ theorem fourierIntegral_eq_half_sub_half_period_translate {w : V} (hw : w ≠ 0) (hf : Integrable f) : ∫ v : V, 𝐞 (-⟪v, w⟫) • f v = (1 / (2 : ℂ)) • ∫ v : V, 𝐞 (-⟪v, w⟫) • (f v - f (v + i w)) := by simp_rw [smul_sub] rw [integral_sub, fourierIntegral_half_period_translate hw, sub_eq_add_neg, neg_neg, ← two_smul ℂ _, ← @smul_assoc _ _ _ _ _ _ (IsScalarTower.left ℂ), smul_eq_mul] · norm_num exacts [(Real.fourierIntegral_convergent_iff w).2 hf, (Real.fourierIntegral_convergent_iff w).2 (hf.comp_add_right _)] /-- Riemann-Lebesgue Lemma for continuous and compactly-supported functions: the integral `∫ v, exp (-2 * π * ⟪w, v⟫ * I) • f v` tends to 0 wrt `cocompact V`. Note that this is primarily of interest as a preparatory step for the more general result `tendsto_integral_exp_inner_smul_cocompact` in which `f` can be arbitrary. -/ theorem tendsto_integral_exp_inner_smul_cocompact_of_continuous_compact_support (hf1 : Continuous f) (hf2 : HasCompactSupport f) : Tendsto (fun w : V => ∫ v : V, 𝐞 (-⟪v, w⟫) • f v) (cocompact V) (𝓝 0) := by refine NormedAddCommGroup.tendsto_nhds_zero.mpr fun ε hε => ?_ suffices ∃ T : ℝ, ∀ w : V, T ≤ ‖w‖ → ‖∫ v : V, 𝐞 (-⟪v, w⟫) • f v‖ < ε by simp_rw [← comap_dist_left_atTop_eq_cocompact (0 : V), eventually_comap, eventually_atTop, dist_eq_norm', sub_zero] exact let ⟨T, hT⟩ := this ⟨T, fun b hb v hv => hT v (hv.symm ▸ hb)⟩ obtain ⟨R, -, hR_bd⟩ : ∃ R : ℝ, 0 < R ∧ ∀ x : V, R ≤ ‖x‖ → f x = 0 := hf2.exists_pos_le_norm let A := {v : V | ‖v‖ ≤ R + 1} have mA : MeasurableSet A := by suffices A = Metric.closedBall (0 : V) (R + 1) by rw [this] exact Metric.isClosed_ball.measurableSet simp_rw [Metric.closedBall, dist_eq_norm, sub_zero] obtain ⟨B, hB_pos, hB_vol⟩ : ∃ B : ℝ≥0, 0 < B ∧ volume A ≤ B := by have hc : IsCompact A := by simpa only [Metric.closedBall, dist_eq_norm, sub_zero] using isCompact_closedBall (0 : V) _ let B₀ := volume A replace hc : B₀ < ⊤ := hc.measure_lt_top refine ⟨B₀.toNNReal + 1, add_pos_of_nonneg_of_pos B₀.toNNReal.coe_nonneg one_pos, ?_⟩ rw [ENNReal.coe_add, ENNReal.coe_one, ENNReal.coe_toNNReal hc.ne] exact le_self_add --* Use uniform continuity to choose δ such that `‖x - y‖ < δ` implies `‖f x - f y‖ < ε / B`. obtain ⟨δ, hδ1, hδ2⟩ := Metric.uniformContinuous_iff.mp (hf2.uniformContinuous_of_continuous hf1) (ε / B) (div_pos hε hB_pos) refine ⟨1 / 2 + 1 / (2 * δ), fun w hw_bd => ?_⟩ have hw_ne : w ≠ 0 := by contrapose! hw_bd; rw [hw_bd, norm_zero] exact add_pos one_half_pos (one_div_pos.mpr <| mul_pos two_pos hδ1) have hw'_nm : ‖i w‖ = 1 / (2 * ‖w‖) := by rw [norm_smul, norm_div, Real.norm_of_nonneg (mul_nonneg two_pos.le <| sq_nonneg _), norm_one, sq, ← div_div, ← div_div, ← div_div, div_mul_cancel₀ _ (norm_eq_zero.not.mpr hw_ne)] --* Rewrite integral in terms of `f v - f (v + w')`. have : ‖(1 / 2 : ℂ)‖ = 2⁻¹ := by norm_num rw [fourierIntegral_eq_half_sub_half_period_translate hw_ne (hf1.integrable_of_hasCompactSupport hf2), norm_smul, this, inv_mul_eq_div, div_lt_iff' two_pos] refine lt_of_le_of_lt (norm_integral_le_integral_norm _) ?_ simp_rw [norm_circle_smul] --* Show integral can be taken over A only. have int_A : ∫ v : V, ‖f v - f (v + i w)‖ = ∫ v in A, ‖f v - f (v + i w)‖ := by refine (setIntegral_eq_integral_of_forall_compl_eq_zero fun v hv => ?_).symm dsimp only [A] at hv simp only [mem_setOf, not_le] at hv rw [hR_bd v _, hR_bd (v + i w) _, sub_zero, norm_zero] · rw [← sub_neg_eq_add] refine le_trans ?_ (norm_sub_norm_le _ _) rw [le_sub_iff_add_le, norm_neg] refine le_trans ?_ hv.le rw [add_le_add_iff_left, hw'_nm, ← div_div] refine (div_le_one <| norm_pos_iff.mpr hw_ne).mpr ?_ refine le_trans (le_add_of_nonneg_right <| one_div_nonneg.mpr <| ?_) hw_bd exact (mul_pos (zero_lt_two' ℝ) hδ1).le · exact (le_add_of_nonneg_right zero_le_one).trans hv.le rw [int_A]; clear int_A --* Bound integral using fact that `‖f v - f (v + w')‖` is small. have bdA : ∀ v : V, v ∈ A → ‖‖f v - f (v + i w)‖‖ ≤ ε / B := by simp_rw [norm_norm] simp_rw [dist_eq_norm] at hδ2 refine fun x _ => (hδ2 ?_).le rw [sub_add_cancel_left, norm_neg, hw'_nm, ← div_div, div_lt_iff (norm_pos_iff.mpr hw_ne), ← div_lt_iff' hδ1, div_div] exact (lt_add_of_pos_left _ one_half_pos).trans_le hw_bd have bdA2 := norm_setIntegral_le_of_norm_le_const (hB_vol.trans_lt ENNReal.coe_lt_top) bdA ?_ swap · apply Continuous.aestronglyMeasurable exact continuous_norm.comp <| Continuous.sub hf1 <| Continuous.comp hf1 <| continuous_id'.add continuous_const have : ‖_‖ = ∫ v : V in A, ‖f v - f (v + i w)‖ := Real.norm_of_nonneg (setIntegral_nonneg mA fun x _ => norm_nonneg _) rw [this] at bdA2 refine bdA2.trans_lt ?_ rw [div_mul_eq_mul_div, div_lt_iff (NNReal.coe_pos.mpr hB_pos), mul_comm (2 : ℝ), mul_assoc, mul_lt_mul_left hε] rw [← ENNReal.toReal_le_toReal] at hB_vol · refine hB_vol.trans_lt ?_ rw [(by rfl : (↑B : ENNReal).toReal = ↑B), two_mul] exact lt_add_of_pos_left _ hB_pos exacts [(hB_vol.trans_lt ENNReal.coe_lt_top).ne, ENNReal.coe_lt_top.ne] variable (f) /-- Riemann-Lebesgue lemma for functions on a real inner-product space: the integral `∫ v, exp (-2 * π * ⟪w, v⟫ * I) • f v` tends to 0 as `w → ∞`. -/ theorem tendsto_integral_exp_inner_smul_cocompact : Tendsto (fun w : V => ∫ v, 𝐞 (-⟪v, w⟫) • f v) (cocompact V) (𝓝 0) := by by_cases hfi : Integrable f; swap · convert tendsto_const_nhds (x := (0 : E)) with w apply integral_undef rwa [Real.fourierIntegral_convergent_iff] refine Metric.tendsto_nhds.mpr fun ε hε => ?_ obtain ⟨g, hg_supp, hfg, hg_cont, -⟩ := hfi.exists_hasCompactSupport_integral_sub_le (div_pos hε two_pos) refine ((Metric.tendsto_nhds.mp (tendsto_integral_exp_inner_smul_cocompact_of_continuous_compact_support hg_cont hg_supp)) _ (div_pos hε two_pos)).mp (eventually_of_forall fun w hI => ?_) rw [dist_eq_norm] at hI ⊢ have : ‖(∫ v, 𝐞 (-⟪v, w⟫) • f v) - ∫ v, 𝐞 (-⟪v, w⟫) • g v‖ ≤ ε / 2 := by refine le_trans ?_ hfg simp_rw [← integral_sub ((Real.fourierIntegral_convergent_iff w).2 hfi) ((Real.fourierIntegral_convergent_iff w).2 (hg_cont.integrable_of_hasCompactSupport hg_supp)), ← smul_sub, ← Pi.sub_apply] exact VectorFourier.norm_fourierIntegral_le_integral_norm 𝐞 _ bilinFormOfRealInner (f - g) w replace := add_lt_add_of_le_of_lt this hI rw [add_halves] at this refine ((le_of_eq ?_).trans (norm_add_le _ _)).trans_lt this simp only [sub_zero, sub_add_cancel] /-- The Riemann-Lebesgue lemma for functions on `ℝ`. -/ theorem Real.tendsto_integral_exp_smul_cocompact (f : ℝ → E) : Tendsto (fun w : ℝ => ∫ v : ℝ, 𝐞 (-(v * w)) • f v) (cocompact ℝ) (𝓝 0) := tendsto_integral_exp_inner_smul_cocompact f /-- The Riemann-Lebesgue lemma for functions on `ℝ`, formulated via `Real.fourierIntegral`. -/ theorem Real.zero_at_infty_fourierIntegral (f : ℝ → E) : Tendsto (𝓕 f) (cocompact ℝ) (𝓝 0) := tendsto_integral_exp_inner_smul_cocompact f /-- Riemann-Lebesgue lemma for functions on a finite-dimensional inner-product space, formulated via dual space. **Do not use** -- it is only a stepping stone to `tendsto_integral_exp_smul_cocompact` where the inner-product-space structure isn't required. -/ theorem tendsto_integral_exp_smul_cocompact_of_inner_product (μ : Measure V) [μ.IsAddHaarMeasure] : Tendsto (fun w : V →L[ℝ] ℝ => ∫ v, 𝐞 (-w v) • f v ∂μ) (cocompact (V →L[ℝ] ℝ)) (𝓝 0) := by rw [μ.isAddLeftInvariant_eq_smul volume] simp_rw [integral_smul_nnreal_measure] rw [← (smul_zero _ : Measure.addHaarScalarFactor μ volume • (0 : E) = 0)] apply Tendsto.const_smul let A := (InnerProductSpace.toDual ℝ V).symm have : (fun w : V →L[ℝ] ℝ ↦ ∫ v, 𝐞 (-w v) • f v) = (fun w : V ↦ ∫ v, 𝐞 (-⟪v, w⟫) • f v) ∘ A := by ext1 w congr 1 with v : 1 rw [← inner_conj_symm, RCLike.conj_to_real, InnerProductSpace.toDual_symm_apply] rw [this] exact (tendsto_integral_exp_inner_smul_cocompact f).comp A.toHomeomorph.toCocompactMap.cocompact_tendsto' end InnerProductSpace section NoInnerProduct variable (f) [AddCommGroup V] [TopologicalSpace V] [TopologicalAddGroup V] [T2Space V] [MeasurableSpace V] [BorelSpace V] [Module ℝ V] [ContinuousSMul ℝ V] [FiniteDimensional ℝ V] [CompleteSpace E] /-- Riemann-Lebesgue lemma for functions on a finite-dimensional real vector space, formulated via dual space. -/ theorem tendsto_integral_exp_smul_cocompact (μ : Measure V) [μ.IsAddHaarMeasure] : Tendsto (fun w : V →L[ℝ] ℝ => ∫ v, 𝐞 (-w v) • f v ∂μ) (cocompact (V →L[ℝ] ℝ)) (𝓝 0) := by -- We have already proved the result for inner-product spaces, formulated in a way which doesn't -- refer to the inner product. So we choose an arbitrary inner-product space isomorphic to V -- and port the result over from there. let V' := EuclideanSpace ℝ (Fin (finrank ℝ V)) have A : V ≃L[ℝ] V' := toEuclidean borelize V' -- various equivs derived from A let Aₘ : MeasurableEquiv V V' := A.toHomeomorph.toMeasurableEquiv -- isomorphism between duals derived from A -- need to do continuity as a separate step in order -- to apply `LinearMap.continuous_of_finiteDimensional`. let Adualₗ : (V →L[ℝ] ℝ) ≃ₗ[ℝ] V' →L[ℝ] ℝ := { toFun := fun t => t.comp A.symm.toContinuousLinearMap invFun := fun t => t.comp A.toContinuousLinearMap map_add' := by intro t s ext1 v simp only [ContinuousLinearMap.coe_comp', Function.comp_apply, ContinuousLinearMap.add_apply] map_smul' := by intro x f ext1 v simp only [RingHom.id_apply, ContinuousLinearMap.coe_comp', Function.comp_apply, ContinuousLinearMap.smul_apply] left_inv := by intro w ext1 v simp only [ContinuousLinearMap.coe_comp', ContinuousLinearEquiv.coe_coe, Function.comp_apply, ContinuousLinearEquiv.symm_apply_apply] right_inv := by intro w ext1 v simp only [ContinuousLinearMap.coe_comp', ContinuousLinearEquiv.coe_coe, Function.comp_apply, ContinuousLinearEquiv.apply_symm_apply] } let Adual : (V →L[ℝ] ℝ) ≃L[ℝ] V' →L[ℝ] ℝ := { Adualₗ with continuous_toFun := Adualₗ.toLinearMap.continuous_of_finiteDimensional continuous_invFun := Adualₗ.symm.toLinearMap.continuous_of_finiteDimensional } have : (μ.map Aₘ).IsAddHaarMeasure := Measure.MapContinuousLinearEquiv.isAddHaarMeasure _ A convert (tendsto_integral_exp_smul_cocompact_of_inner_product (f ∘ A.symm) (μ.map Aₘ)).comp Adual.toHomeomorph.toCocompactMap.cocompact_tendsto' with w rw [Function.comp_apply, integral_map_equiv] congr 1 with v : 1 congr · -- Porting note: added `congr_arg` apply congr_arg w exact (ContinuousLinearEquiv.symm_apply_apply A v).symm · exact (ContinuousLinearEquiv.symm_apply_apply A v).symm /-- The Riemann-Lebesgue lemma, formulated in terms of `VectorFourier.fourierIntegral` (with the pairing in the definition of `fourier_integral` taken to be the canonical pairing between `V` and its dual space). -/ theorem Real.zero_at_infty_vector_fourierIntegral (μ : Measure V) [μ.IsAddHaarMeasure] : Tendsto (VectorFourier.fourierIntegral 𝐞 μ (topDualPairing ℝ V).flip f) (cocompact (V →L[ℝ] ℝ)) (𝓝 0) := _root_.tendsto_integral_exp_smul_cocompact f μ end NoInnerProduct
Analysis\Fourier\ZMod.lean
/- Copyright (c) 2024 David Loeffler. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: David Loeffler -/ import Mathlib.Analysis.SpecialFunctions.Complex.CircleAddChar import Mathlib.Analysis.Fourier.FourierTransform import Mathlib.NumberTheory.DirichletCharacter.GaussSum /-! # Fourier theory on `ZMod N` Basic definitions and properties of the discrete Fourier transform for functions on `ZMod N`. ### Main definitions and results * `ZMod.dft`: the Fourier transform with respect to the standard additive character `ZMod.stdAddChar` (mapping `j mod N` to `exp (2 * π * I * j / N)`). The notation `𝓕`, scoped in namespace `ZMod`, is available for this. * `DirichletCharacter.fourierTransform_eq_inv_mul_gaussSum`: the discrete Fourier transform of a primitive Dirichlet character `χ` is a Gauss sum times `χ⁻¹`. -/ open scoped Real open MeasureTheory namespace ZMod variable {N : ℕ} [NeZero N] /-- The discrete Fourier transform on `ℤ / N ℤ` (with the counting measure) -/ noncomputable def dft (Φ : ZMod N → ℂ) (k : ZMod N) : ℂ := Fourier.fourierIntegral toCircle Measure.count Φ k @[inherit_doc] scoped notation "𝓕" => dft lemma dft_apply (Φ : ZMod N → ℂ) (k : ZMod N) : 𝓕 Φ k = ∑ j : ZMod N, toCircle (-(j * k)) • Φ j := by simp only [dft, Fourier.fourierIntegral_def, integral_countable' <| .of_finite .., Measure.count_singleton, ENNReal.one_toReal, one_smul, tsum_fintype] lemma dft_def (Φ : ZMod N → ℂ) : 𝓕 Φ = fun k ↦ ∑ j : ZMod N, toCircle (-(j * k)) • Φ j := funext (dft_apply Φ) end ZMod open ZMod namespace DirichletCharacter variable {N : ℕ} [NeZero N] (χ : DirichletCharacter ℂ N) lemma fourierTransform_eq_gaussSum_mulShift (k : ZMod N) : 𝓕 χ k = gaussSum χ (stdAddChar.mulShift (-k)) := by simp only [dft_def] congr 1 with j rw [AddChar.mulShift_apply, mul_comm j, Submonoid.smul_def, smul_eq_mul, neg_mul, stdAddChar_apply, mul_comm (χ _)] /-- For a primitive Dirichlet character `χ`, the Fourier transform of `χ` is a constant multiple of `χ⁻¹` (and the constant is essentially the Gauss sum). -/ lemma fourierTransform_eq_inv_mul_gaussSum (k : ZMod N) (hχ : IsPrimitive χ) : 𝓕 χ k = χ⁻¹ (-k) * gaussSum χ stdAddChar := by rw [fourierTransform_eq_gaussSum_mulShift, gaussSum_mulShift_of_isPrimitive _ hχ] end DirichletCharacter
Analysis\FunctionalSpaces\SobolevInequality.lean
/- Copyright (c) 2024 Floris van Doorn. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Floris van Doorn, Heather Macbeth -/ import Mathlib.Analysis.Calculus.Deriv.Pi import Mathlib.Analysis.InnerProductSpace.EuclideanDist import Mathlib.Analysis.InnerProductSpace.NormPow import Mathlib.Data.Finset.Interval import Mathlib.MeasureTheory.Integral.IntegralEqImproper /-! # Gagliardo-Nirenberg-Sobolev inequality In this file we prove the Gagliardo-Nirenberg-Sobolev inequality. This states that for compactly supported `C¹`-functions between finite dimensional vector spaces, we can bound the `L^p`-norm of `u` by the `L^q` norm of the derivative of `u`. The bound is up to a constant that is independent of the function `u`. Let `n` be the dimension of the domain. The main step in the proof, which we dubbed the "grid-lines lemma" below, is a complicated inductive argument that involves manipulating an `n+1`-fold iterated integral and a product of `n+2` factors. In each step, one pushes one of the integral inside (all but one of) the factors of the product using Hölder's inequality. The precise formulation of the induction hypothesis (`MeasureTheory.GridLines.T_insert_le_T_lmarginal_singleton`) is tricky, and none of the 5 sources we referenced stated it. In the formalization we use the operation `MeasureTheory.lmarginal` to work with the iterated integrals, and use `MeasureTheory.lmarginal_insert'` to conveniently push one of the integrals inside. The Hölder's inequality step is done using `ENNReal.lintegral_mul_prod_norm_pow_le`. The conclusions of the main results below are an estimation up to a constant multiple. We don't really care about this constant, other than that it only depends on some pieces of data, typically `E`, `μ`, `p` and sometimes also the codomain of `u` or the support of `u`. We state these constants as separate definitions. ## Main results * `MeasureTheory.eLpNorm_le_eLpNorm_fderiv_of_eq`: The bound holds for `1 ≤ p`, `0 < n` and `q⁻¹ = p⁻¹ - n⁻¹` * `MeasureTheory.eLpNorm_le_eLpNorm_fderiv_of_le`: The bound holds when `1 ≤ p < n`, `0 ≤ q` and `p⁻¹ - n⁻¹ ≤ q⁻¹`. Note that in this case the constant depends on the support of `u`. Potentially also useful: * `MeasureTheory.eLpNorm_le_eLpNorm_fderiv_one`: this is the inequality for `q = 1`. In this version, the codomain can be an arbitrary Banach space. * `MeasureTheory.eLpNorm_le_eLpNorm_fderiv_of_eq_inner`: in this version, the codomain is assumed to be a Hilbert space, without restrictions on its dimension. -/ open scoped ENNReal NNReal open Set Function Finset MeasureTheory Measure Filter noncomputable section variable {ι : Type*} local prefix:max "#" => Fintype.card /-! ## The grid-lines lemma -/ variable {A : ι → Type*} [∀ i, MeasurableSpace (A i)] (μ : ∀ i, Measure (A i)) namespace MeasureTheory section DecidableEq variable [DecidableEq ι] namespace GridLines /-- The "grid-lines operation" (not a standard name) which is central in the inductive proof of the Sobolev inequality. For a finite dependent product `Π i : ι, A i` of sigma-finite measure spaces, a finite set `s` of indices from `ι`, and a (later assumed nonnegative) real number `p`, this operation acts on a function `f` from `Π i, A i` into the extended nonnegative reals. The operation is to partially integrate, in the `s` co-ordinates, the function whose value at `x : Π i, A i` is obtained by multiplying a certain power of `f` with the product, for each co-ordinate `i` in `s`, of a certain power of the integral of `f` along the "grid line" in the `i` direction through `x`. We are most interested in this operation when the set `s` is the universe in `ι`, but as a proxy for "induction on dimension" we define it for a general set `s` of co-ordinates: the `s`-grid-lines operation on a function `f` which is constant along the co-ordinates in `sᶜ` is morally (that is, up to type-theoretic nonsense) the same thing as the universe-grid-lines operation on the associated function on the "lower-dimensional" space `Π i : s, A i`. -/ def T (p : ℝ) (f : (∀ i, A i) → ℝ≥0∞) (s : Finset ι) : (∀ i, A i) → ℝ≥0∞ := ∫⋯∫⁻_s, f ^ (1 - (s.card - 1 : ℝ) * p) * ∏ i in s, (∫⋯∫⁻_{i}, f ∂μ) ^ p ∂μ variable {p : ℝ} @[simp] lemma T_univ [Fintype ι] [∀ i, SigmaFinite (μ i)] (f : (∀ i, A i) → ℝ≥0∞) (x : ∀ i, A i) : T μ p f univ x = ∫⁻ (x : ∀ i, A i), (f x ^ (1 - (#ι - 1 : ℝ) * p) * ∏ i : ι, (∫⁻ t : A i, f (update x i t) ∂(μ i)) ^ p) ∂(.pi μ) := by simp [T, lmarginal_univ, lmarginal_singleton, card_univ] @[simp] lemma T_empty (f : (∀ i, A i) → ℝ≥0∞) (x : ∀ i, A i) : T μ p f ∅ x = f x ^ (1 + p) := by simp [T] /-- The main inductive step in the grid-lines lemma for the Gagliardo-Nirenberg-Sobolev inequality. The grid-lines operation `GridLines.T` on a nonnegative function on a finitary product type is less than or equal to the grid-lines operation of its partial integral in one co-ordinate (the latter intuitively considered as a function on a space "one dimension down"). -/ theorem T_insert_le_T_lmarginal_singleton [∀ i, SigmaFinite (μ i)] (hp₀ : 0 ≤ p) (s : Finset ι) (hp : (s.card : ℝ) * p ≤ 1) (i : ι) (hi : i ∉ s) {f : (∀ i, A i) → ℝ≥0∞} (hf : Measurable f) : T μ p f (insert i s) ≤ T μ p (∫⋯∫⁻_{i}, f ∂μ) s := by /- The proof is a tricky computation that relies on Hölder's inequality at its heart. The left-hand-side is an `|s|+1`-times iterated integral. Let `xᵢ` denote the `i`-th variable. We first push the integral over the `i`-th variable as the innermost integral. This is done in a single step with `MeasureTheory.lmarginal_insert'`, but in fact hides a repeated application of Fubini's theorem. The integrand is a product of `|s|+2` factors, in `|s|+1` of them we integrate over one additional variable. We split of the factor that integrates over `xᵢ`, and apply Hölder's inequality to the remaining factors (whose powers sum exactly to 1). After reordering factors, and combining two factors into one we obtain the right-hand side. -/ calc T μ p f (insert i s) = ∫⋯∫⁻_insert i s, f ^ (1 - (s.card : ℝ) * p) * ∏ j in (insert i s), (∫⋯∫⁻_{j}, f ∂μ) ^ p ∂μ := by -- unfold `T` and reformulate the exponents simp_rw [T, card_insert_of_not_mem hi] congr! push_cast ring _ = ∫⋯∫⁻_s, (fun x ↦ ∫⁻ (t : A i), (f (update x i t) ^ (1 - (s.card : ℝ) * p) * ∏ j in (insert i s), (∫⋯∫⁻_{j}, f ∂μ) (update x i t) ^ p) ∂ (μ i)) ∂μ := by -- pull out the integral over `xᵢ` rw [lmarginal_insert' _ _ hi] · congr! with x t simp only [Pi.mul_apply, Pi.pow_apply, Finset.prod_apply] · change Measurable (fun x ↦ _) simp only [Pi.mul_apply, Pi.pow_apply, Finset.prod_apply] refine (hf.pow_const _).mul <| Finset.measurable_prod _ ?_ exact fun _ _ ↦ hf.lmarginal μ |>.pow_const _ _ ≤ T μ p (∫⋯∫⁻_{i}, f ∂μ) s := lmarginal_mono (s := s) (fun x ↦ ?_) -- The remainder of the computation happens within an `|s|`-fold iterated integral simp only [Pi.mul_apply, Pi.pow_apply, Finset.prod_apply] set X := update x i have hF₁ : ∀ {j : ι}, Measurable fun t ↦ (∫⋯∫⁻_{j}, f ∂μ) (X t) := fun {_} ↦ hf.lmarginal μ |>.comp <| measurable_update _ have hF₀ : Measurable fun t ↦ f (X t) := hf.comp <| measurable_update _ let k : ℝ := s.card have hk' : 0 ≤ 1 - k * p := by linarith only [hp] calc ∫⁻ t, f (X t) ^ (1 - k * p) * ∏ j in (insert i s), (∫⋯∫⁻_{j}, f ∂μ) (X t) ^ p ∂ (μ i) = ∫⁻ t, (∫⋯∫⁻_{i}, f ∂μ) (X t) ^ p * (f (X t) ^ (1 - k * p) * ∏ j in s, ((∫⋯∫⁻_{j}, f ∂μ) (X t) ^ p)) ∂(μ i) := by -- rewrite integrand so that `(∫⋯∫⁻_insert i s, f ∂μ) ^ p` comes first clear_value X congr! 2 with t simp_rw [prod_insert hi] ring_nf _ = (∫⋯∫⁻_{i}, f ∂μ) x ^ p * ∫⁻ t, f (X t) ^ (1 - k * p) * ∏ j in s, ((∫⋯∫⁻_{j}, f ∂μ) (X t)) ^ p ∂(μ i) := by -- pull out this constant factor have : ∀ t, (∫⋯∫⁻_{i}, f ∂μ) (X t) = (∫⋯∫⁻_{i}, f ∂μ) x := by intro t rw [lmarginal_update_of_mem] exact Iff.mpr Finset.mem_singleton rfl simp_rw [this] rw [lintegral_const_mul] exact (hF₀.pow_const _).mul <| Finset.measurable_prod _ fun _ _ ↦ hF₁.pow_const _ _ ≤ (∫⋯∫⁻_{i}, f ∂μ) x ^ p * ((∫⁻ t, f (X t) ∂μ i) ^ (1 - k * p) * ∏ j in s, (∫⁻ t, (∫⋯∫⁻_{j}, f ∂μ) (X t) ∂μ i) ^ p) := by -- apply Hölder's inequality gcongr apply ENNReal.lintegral_mul_prod_norm_pow_le · exact hF₀.aemeasurable · intros exact hF₁.aemeasurable · simp only [sum_const, nsmul_eq_mul] ring · exact hk' · exact fun _ _ ↦ hp₀ _ = (∫⋯∫⁻_{i}, f ∂μ) x ^ p * ((∫⋯∫⁻_{i}, f ∂μ) x ^ (1 - k * p) * ∏ j in s, (∫⋯∫⁻_{i, j}, f ∂μ) x ^ p) := by -- absorb the newly-created integrals into `∫⋯∫` congr! 2 · rw [lmarginal_singleton] refine prod_congr rfl fun j hj => ?_ have hi' : i ∉ ({j} : Finset ι) := by simp only [Finset.mem_singleton, Finset.mem_insert, Finset.mem_compl] at hj ⊢ exact fun h ↦ hi (h ▸ hj) rw [lmarginal_insert _ hf hi'] _ = (∫⋯∫⁻_{i}, f ∂μ) x ^ (p + (1 - k * p)) * ∏ j in s, (∫⋯∫⁻_{i, j}, f ∂μ) x ^ p := by -- combine two `(∫⋯∫⁻_insert i s, f ∂μ) x` terms rw [ENNReal.rpow_add_of_nonneg] · ring · exact hp₀ · exact hk' _ ≤ (∫⋯∫⁻_{i}, f ∂μ) x ^ (1 - (s.card - 1 : ℝ) * p) * ∏ j in s, (∫⋯∫⁻_{j}, (∫⋯∫⁻_{i}, f ∂μ) ∂μ) x ^ p := by -- identify the result with the RHS integrand congr! 2 with j hj · ring_nf · congr! 1 rw [← lmarginal_union μ f hf] · congr rw [Finset.union_comm] rfl · rw [Finset.disjoint_singleton] simp only [Finset.mem_insert, Finset.mem_compl] at hj exact fun h ↦ hi (h ▸ hj) /-- Auxiliary result for the grid-lines lemma. Given a nonnegative function on a finitary product type indexed by `ι`, and a set `s` in `ι`, consider partially integrating over the variables in `sᶜ` and performing the "grid-lines operation" (see `GridLines.T`) to the resulting function in the variables `s`. This theorem states that this operation decreases as the number of grid-lines taken increases. -/ theorem T_lmarginal_antitone [Fintype ι] [∀ i, SigmaFinite (μ i)] (hp₀ : 0 ≤ p) (hp : (#ι - 1 : ℝ) * p ≤ 1) {f : (∀ i, A i) → ℝ≥0∞} (hf : Measurable f) : Antitone (fun s ↦ T μ p (∫⋯∫⁻_sᶜ, f ∂μ) s) := by -- Reformulate (by induction): a function is decreasing on `Finset ι` if it decreases under the -- insertion of any element to any set. rw [Finset.antitone_iff_forall_insert_le] intro s i hi -- apply the lemma designed to encapsulate the inductive step convert T_insert_le_T_lmarginal_singleton μ hp₀ s ?_ i hi (hf.lmarginal μ) using 2 · rw [← lmarginal_union μ f hf] · rw [← insert_compl_insert hi] rfl rw [Finset.disjoint_singleton_left, not_mem_compl] exact mem_insert_self i s · -- the main nontrivial point is to check that an exponent `p` satisfying `0 ≤ p` and -- `(#ι - 1) * p ≤ 1` is in the valid range for the inductive-step lemma refine le_trans ?_ hp gcongr suffices (s.card : ℝ) + 1 ≤ #ι by linarith rw [← card_add_card_compl s] norm_cast gcongr have hi' : sᶜ.Nonempty := ⟨i, by rwa [Finset.mem_compl]⟩ rwa [← card_pos] at hi' end GridLines /-- The "grid-lines lemma" (not a standard name), stated with a general parameter `p` as the exponent. Compare with `lintegral_prod_lintegral_pow_le`. For any finite dependent product `Π i : ι, A i` of sigma-finite measure spaces, for any nonnegative real number `p` such that `(#ι - 1) * p ≤ 1`, for any function `f` from `Π i, A i` into the extended nonnegative reals, we consider an associated "grid-lines quantity", the integral of an associated function from `Π i, A i` into the extended nonnegative reals. The value of this function at `x : Π i, A i` is obtained by multiplying a certain power of `f` with the product, for each co-ordinate `i`, of a certain power of the integral of `f` along the "grid line" in the `i` direction through `x`. This lemma bounds the Lebesgue integral of the grid-lines quantity by a power of the Lebesgue integral of `f`. -/ theorem lintegral_mul_prod_lintegral_pow_le [Fintype ι] [∀ i, SigmaFinite (μ i)] {p : ℝ} (hp₀ : 0 ≤ p) (hp : (#ι - 1 : ℝ) * p ≤ 1) {f : (∀ i : ι, A i) → ℝ≥0∞} (hf : Measurable f) : ∫⁻ x, f x ^ (1 - (#ι - 1 : ℝ) * p) * ∏ i, (∫⁻ xᵢ, f (update x i xᵢ) ∂μ i) ^ p ∂.pi μ ≤ (∫⁻ x, f x ∂.pi μ) ^ (1 + p) := by cases isEmpty_or_nonempty (∀ i, A i) · simp_rw [lintegral_of_isEmpty]; refine zero_le _ inhabit ∀ i, A i have H : (∅ : Finset ι) ≤ Finset.univ := Finset.empty_subset _ simpa [lmarginal_univ] using GridLines.T_lmarginal_antitone μ hp₀ hp hf H default /-- Special case of the grid-lines lemma `lintegral_mul_prod_lintegral_pow_le`, taking the extremal exponent `p = (#ι - 1)⁻¹`. -/ theorem lintegral_prod_lintegral_pow_le [Fintype ι] [∀ i, SigmaFinite (μ i)] {p : ℝ} (hp : Real.IsConjExponent #ι p) {f} (hf : Measurable f) : ∫⁻ x, ∏ i, (∫⁻ xᵢ, f (update x i xᵢ) ∂μ i) ^ ((1 : ℝ) / (#ι - 1 : ℝ)) ∂.pi μ ≤ (∫⁻ x, f x ∂.pi μ) ^ p := by have : Nontrivial ι := Fintype.one_lt_card_iff_nontrivial.mp (by exact_mod_cast hp.one_lt) have h0 : (1 : ℝ) < #ι := by norm_cast; exact Fintype.one_lt_card have h1 : (0 : ℝ) < #ι - 1 := by linarith have h2 : 0 ≤ ((1 : ℝ) / (#ι - 1 : ℝ)) := by positivity have h3 : (#ι - 1 : ℝ) * ((1 : ℝ) / (#ι - 1 : ℝ)) ≤ 1 := by field_simp have h4 : p = 1 + 1 / (↑#ι - 1) := by field_simp; rw [mul_comm, hp.sub_one_mul_conj] rw [h4] convert lintegral_mul_prod_lintegral_pow_le μ h2 h3 hf using 2 field_simp end DecidableEq /-! ## The Gagliardo-Nirenberg-Sobolev inequality -/ variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] /-- The **Gagliardo-Nirenberg-Sobolev inequality**. Let `u` be a continuously differentiable compactly-supported function `u` on `ℝⁿ`, for `n ≥ 2`. (More literally we encode `ℝⁿ` as `ι → ℝ` where `n := #ι` is finite and at least 2.) Then the Lebesgue integral of the pointwise expression `|u x| ^ (n / (n - 1))` is bounded above by the `n / (n - 1)`-th power of the Lebesgue integral of the Fréchet derivative of `u`. For a basis-free version, see `lintegral_pow_le_pow_lintegral_fderiv`. -/ theorem lintegral_pow_le_pow_lintegral_fderiv_aux [Fintype ι] {p : ℝ} (hp : Real.IsConjExponent #ι p) {u : (ι → ℝ) → F} (hu : ContDiff ℝ 1 u) (h2u : HasCompactSupport u) : ∫⁻ x, (‖u x‖₊ : ℝ≥0∞) ^ p ≤ (∫⁻ x, ‖fderiv ℝ u x‖₊) ^ p := by classical /- For a function `f` in one variable and `t ∈ ℝ` we have `|f(t)| = `|∫_{-∞}^t Df(s)∂s| ≤ ∫_ℝ |Df(s)| ∂s` where we use the fundamental theorem of calculus. For each `x ∈ ℝⁿ` we let `u` vary in one of the `n` coordinates and apply the inequality above. By taking the product over these `n` factors, raising them to the power `(n-1)⁻¹` and integrating, we get the inequality `∫ |u| ^ (n/(n-1)) ≤ ∫ x, ∏ i, (∫ xᵢ, |Du(update x i xᵢ)|)^(n-1)⁻¹`. The result then follows from the grid-lines lemma. -/ have : (1 : ℝ) ≤ ↑#ι - 1 := by have hι : (2 : ℝ) ≤ #ι := by exact_mod_cast hp.one_lt linarith calc ∫⁻ x, (‖u x‖₊ : ℝ≥0∞) ^ p = ∫⁻ x, ((‖u x‖₊ : ℝ≥0∞) ^ (1 / (#ι - 1 : ℝ))) ^ (#ι : ℝ) := by -- a little algebraic manipulation of the exponent congr! 2 with x rw [← ENNReal.rpow_mul, hp.conj_eq] field_simp _ = ∫⁻ x, ∏ _i : ι, (‖u x‖₊ : ℝ≥0∞) ^ (1 / (#ι - 1 : ℝ)) := by -- express the left-hand integrand as a product of identical factors congr! 2 with x simp_rw [prod_const, card_univ] norm_cast _ ≤ ∫⁻ x, ∏ i, (∫⁻ xᵢ, ‖fderiv ℝ u (update x i xᵢ)‖₊) ^ ((1 : ℝ) / (#ι - 1 : ℝ)) := ?_ _ ≤ (∫⁻ x, ‖fderiv ℝ u x‖₊) ^ p := by -- apply the grid-lines lemma apply lintegral_prod_lintegral_pow_le _ hp have : Continuous (fderiv ℝ u) := hu.continuous_fderiv le_rfl fun_prop -- we estimate |u x| using the fundamental theorem of calculus. gcongr with x i calc (‖u x‖₊ : ℝ≥0∞) _ ≤ ∫⁻ xᵢ in Iic (x i), ‖deriv (u ∘ update x i) xᵢ‖₊ := by apply le_trans (by simp) (HasCompactSupport.ennnorm_le_lintegral_Ici_deriv _ _ _) · exact hu.comp (by convert contDiff_update 1 x i) · exact h2u.comp_closedEmbedding (closedEmbedding_update x i) _ ≤ ∫⁻ xᵢ, (‖fderiv ℝ u (update x i xᵢ)‖₊ : ℝ≥0∞) := ?_ gcongr with y; swap · exact Measure.restrict_le_self -- bound the derivative which appears calc ‖deriv (u ∘ update x i) y‖₊ = ‖fderiv ℝ u (update x i y) (deriv (update x i) y)‖₊ := by rw [fderiv.comp_deriv _ (hu.differentiable le_rfl).differentiableAt (hasDerivAt_update x i y).differentiableAt] _ ≤ ‖fderiv ℝ u (update x i y)‖₊ * ‖deriv (update x i) y‖₊ := ContinuousLinearMap.le_opNNNorm .. _ ≤ ‖fderiv ℝ u (update x i y)‖₊ := by simp [deriv_update, Pi.nnnorm_single] variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [MeasurableSpace E] [BorelSpace E] [FiniteDimensional ℝ E] (μ : Measure E) [IsAddHaarMeasure μ] open FiniteDimensional /-- The constant factor occurring in the conclusion of `lintegral_pow_le_pow_lintegral_fderiv`. It only depends on `E`, `μ` and `p`. It is determined by the ratio of the measures on `E` and `ℝⁿ` and the operator norm of a chosen equivalence `E ≃ ℝⁿ` (raised to suitable powers involving `p`).-/ irreducible_def lintegralPowLePowLIntegralFDerivConst (p : ℝ) : ℝ≥0 := by let ι := Fin (finrank ℝ E) have : finrank ℝ E = finrank ℝ (ι → ℝ) := by rw [finrank_fintype_fun_eq_card, Fintype.card_fin (finrank ℝ E)] let e : E ≃L[ℝ] ι → ℝ := ContinuousLinearEquiv.ofFinrankEq this let c := addHaarScalarFactor μ ((volume : Measure (ι → ℝ)).map e.symm) exact (c * ‖(e.symm : (ι → ℝ) →L[ℝ] E)‖₊ ^ p) * (c ^ p)⁻¹ /-- The **Gagliardo-Nirenberg-Sobolev inequality**. Let `u` be a continuously differentiable compactly-supported function `u` on a normed space `E` of finite dimension `n ≥ 2`, equipped with Haar measure. Then the Lebesgue integral of the pointwise expression `|u x| ^ (n / (n - 1))` is bounded above by a constant times the `n / (n - 1)`-th power of the Lebesgue integral of the Fréchet derivative of `u`. -/ theorem lintegral_pow_le_pow_lintegral_fderiv {u : E → F} (hu : ContDiff ℝ 1 u) (h2u : HasCompactSupport u) {p : ℝ} (hp : Real.IsConjExponent (finrank ℝ E) p) : ∫⁻ x, (‖u x‖₊ : ℝ≥0∞) ^ p ∂μ ≤ lintegralPowLePowLIntegralFDerivConst μ p * (∫⁻ x, ‖fderiv ℝ u x‖₊ ∂μ) ^ p := by /- We reduce to the case where `E` is `ℝⁿ`, for which we have already proved the result using an explicit basis in `MeasureTheory.lintegral_pow_le_pow_lintegral_fderiv_aux`. This proof is not too hard, but takes quite some steps, reasoning about the equivalence `e : E ≃ ℝⁿ`, relating the measures on each sides of the equivalence, and estimating the derivative using the chain rule. -/ set C := lintegralPowLePowLIntegralFDerivConst μ p let ι := Fin (finrank ℝ E) have hιcard : #ι = finrank ℝ E := Fintype.card_fin (finrank ℝ E) have : finrank ℝ E = finrank ℝ (ι → ℝ) := by simp [hιcard] let e : E ≃L[ℝ] ι → ℝ := ContinuousLinearEquiv.ofFinrankEq this have : IsAddHaarMeasure ((volume : Measure (ι → ℝ)).map e.symm) := (e.symm : (ι → ℝ) ≃+ E).isAddHaarMeasure_map _ e.symm.continuous e.symm.symm.continuous have hp : Real.IsConjExponent #ι p := by rwa [hιcard] have h0p : 0 ≤ p := hp.symm.nonneg let c := addHaarScalarFactor μ ((volume : Measure (ι → ℝ)).map e.symm) have hc : 0 < c := addHaarScalarFactor_pos_of_isAddHaarMeasure .. have h2c : μ = c • ((volume : Measure (ι → ℝ)).map e.symm) := isAddLeftInvariant_eq_smul .. have h3c : (c : ℝ≥0∞) ≠ 0 := by simp_rw [ne_eq, ENNReal.coe_eq_zero, hc.ne', not_false_eq_true] have h0C : C = (c * ‖(e.symm : (ι → ℝ) →L[ℝ] E)‖₊ ^ p) * (c ^ p)⁻¹ := by simp_rw [C, lintegralPowLePowLIntegralFDerivConst] have hC : C * c ^ p = c * ‖(e.symm : (ι → ℝ) →L[ℝ] E)‖₊ ^ p := by rw [h0C, inv_mul_cancel_right₀ (NNReal.rpow_pos hc).ne'] rw [h2c, ENNReal.smul_def, lintegral_smul_measure, lintegral_smul_measure] let v : (ι → ℝ) → F := u ∘ e.symm have hv : ContDiff ℝ 1 v := hu.comp e.symm.contDiff have h2v : HasCompactSupport v := h2u.comp_homeomorph e.symm.toHomeomorph have := calc ∫⁻ x, (‖u x‖₊ : ℝ≥0∞) ^ p ∂(volume : Measure (ι → ℝ)).map e.symm = ∫⁻ y, (‖v y‖₊ : ℝ≥0∞) ^ p := by refine lintegral_map ?_ e.symm.continuous.measurable borelize F exact hu.continuous.measurable.nnnorm.coe_nnreal_ennreal.pow_const _ _ ≤ (∫⁻ y, ‖fderiv ℝ v y‖₊) ^ p := lintegral_pow_le_pow_lintegral_fderiv_aux hp hv h2v _ = (∫⁻ y, ‖(fderiv ℝ u (e.symm y)).comp (fderiv ℝ e.symm y)‖₊) ^ p := by congr! with y apply fderiv.comp _ (hu.differentiable le_rfl _) exact e.symm.differentiableAt _ ≤ (∫⁻ y, ‖fderiv ℝ u (e.symm y)‖₊ * ‖(e.symm : (ι → ℝ) →L[ℝ] E)‖₊) ^ p := by gcongr with y norm_cast rw [e.symm.fderiv] apply ContinuousLinearMap.opNNNorm_comp_le _ = (‖(e.symm : (ι → ℝ) →L[ℝ] E)‖₊ * ∫⁻ y, ‖fderiv ℝ u (e.symm y)‖₊) ^ p := by rw [lintegral_mul_const, mul_comm] refine (Continuous.nnnorm ?_).measurable.coe_nnreal_ennreal exact (hu.continuous_fderiv le_rfl).comp e.symm.continuous _ = (‖(e.symm : (ι → ℝ) →L[ℝ] E)‖₊ ^ p : ℝ≥0) * (∫⁻ y, ‖fderiv ℝ u (e.symm y)‖₊) ^ p := by rw [ENNReal.mul_rpow_of_nonneg _ _ h0p, ENNReal.coe_rpow_of_nonneg _ h0p] _ = (‖(e.symm : (ι → ℝ) →L[ℝ] E)‖₊ ^ p : ℝ≥0) * (∫⁻ x, ‖fderiv ℝ u x‖₊ ∂(volume : Measure (ι → ℝ)).map e.symm) ^ p := by congr rw [lintegral_map _ e.symm.continuous.measurable] have : Continuous (fderiv ℝ u) := hu.continuous_fderiv le_rfl fun_prop rw [← ENNReal.mul_le_mul_left h3c ENNReal.coe_ne_top, ← mul_assoc, ← ENNReal.coe_mul, ← hC, ENNReal.coe_mul] at this rw [ENNReal.mul_rpow_of_nonneg _ _ h0p, ← mul_assoc, ENNReal.coe_rpow_of_ne_zero hc.ne'] exact this /-- The constant factor occurring in the conclusion of `eLpNorm_le_eLpNorm_fderiv_one`. It only depends on `E`, `μ` and `p`. -/ irreducible_def eLpNormLESNormFDerivOneConst (p : ℝ) : ℝ≥0 := lintegralPowLePowLIntegralFDerivConst μ p ^ p⁻¹ /-- The **Gagliardo-Nirenberg-Sobolev inequality**. Let `u` be a continuously differentiable compactly-supported function `u` on a normed space `E` of finite dimension `n ≥ 2`, equipped with Haar measure. Then the `Lᵖ` norm of `u`, where `p := n / (n - 1)`, is bounded above by a constant times the `L¹` norm of the Fréchet derivative of `u`. -/ theorem eLpNorm_le_eLpNorm_fderiv_one {u : E → F} (hu : ContDiff ℝ 1 u) (h2u : HasCompactSupport u) {p : ℝ≥0} (hp : NNReal.IsConjExponent (finrank ℝ E) p) : eLpNorm u p μ ≤ eLpNormLESNormFDerivOneConst μ p * eLpNorm (fderiv ℝ u) 1 μ := by have h0p : 0 < (p : ℝ) := hp.coe.symm.pos rw [eLpNorm_one_eq_lintegral_nnnorm, ← ENNReal.rpow_le_rpow_iff h0p, ENNReal.mul_rpow_of_nonneg _ _ h0p.le, ENNReal.coe_rpow_of_nonneg _ h0p.le, eLpNormLESNormFDerivOneConst, ← NNReal.rpow_mul, eLpNorm_nnreal_pow_eq_lintegral hp.symm.pos.ne', inv_mul_cancel h0p.ne', NNReal.rpow_one] exact lintegral_pow_le_pow_lintegral_fderiv μ hu h2u hp.coe @[deprecated (since := "2024-07-27")] alias snorm_le_snorm_fderiv_one := eLpNorm_le_eLpNorm_fderiv_one /-- The constant factor occurring in the conclusion of `eLpNorm_le_eLpNorm_fderiv_of_eq_inner`. It only depends on `E`, `μ` and `p`. -/ def eLpNormLESNormFDerivOfEqInnerConst (p : ℝ) : ℝ≥0 := let n := finrank ℝ E eLpNormLESNormFDerivOneConst μ (NNReal.conjExponent n) * (p * (n - 1) / (n - p)).toNNReal variable {F' : Type*} [NormedAddCommGroup F'] [InnerProductSpace ℝ F'] [CompleteSpace F'] /-- The **Gagliardo-Nirenberg-Sobolev inequality**. Let `u` be a continuously differentiable compactly-supported function `u` on a normed space `E` of finite dimension `n`, equipped with Haar measure, let `1 ≤ p < n` and let `p'⁻¹ := p⁻¹ - n⁻¹`. Then the `Lᵖ'` norm of `u` is bounded above by a constant times the `Lᵖ` norm of the Fréchet derivative of `u`. Note: The codomain of `u` needs to be a Hilbert space. -/ theorem eLpNorm_le_eLpNorm_fderiv_of_eq_inner {u : E → F'} (hu : ContDiff ℝ 1 u) (h2u : HasCompactSupport u) {p p' : ℝ≥0} (hp : 1 ≤ p) (hn : 0 < finrank ℝ E) (hp' : (p' : ℝ)⁻¹ = p⁻¹ - (finrank ℝ E : ℝ)⁻¹) : eLpNorm u p' μ ≤ eLpNormLESNormFDerivOfEqInnerConst μ p * eLpNorm (fderiv ℝ u) p μ := by /- Here we derive the GNS-inequality for `p ≥ 1` from the version with `p = 1`. For `p > 1` we apply the previous version to the function `|u|^γ` for a suitably chosen `γ`. The proof requires that `x ↦ |x|^p` is smooth in the codomain, so we require that it is a Hilbert space. -/ by_cases hp'0 : p' = 0 · simp [hp'0] set n := finrank ℝ E let n' := NNReal.conjExponent n have h2p : (p : ℝ) < n := by have : 0 < p⁻¹ - (n : ℝ)⁻¹ := NNReal.coe_lt_coe.mpr (pos_iff_ne_zero.mpr (inv_ne_zero hp'0)) |>.trans_eq hp' rwa [NNReal.coe_inv, sub_pos, inv_lt_inv _ (zero_lt_one.trans_le (NNReal.coe_le_coe.mpr hp))] at this exact_mod_cast hn have h0n : 2 ≤ n := Nat.succ_le_of_lt <| Nat.one_lt_cast.mp <| hp.trans_lt h2p have hn : NNReal.IsConjExponent n n' := .conjExponent (by norm_cast) have h1n : 1 ≤ (n : ℝ≥0) := hn.one_le have h2n : (0 : ℝ) < n - 1 := by simp_rw [sub_pos]; exact hn.coe.one_lt have hnp : (0 : ℝ) < n - p := by simp_rw [sub_pos]; exact h2p rcases hp.eq_or_lt with rfl|hp -- the case `p = 1` · convert eLpNorm_le_eLpNorm_fderiv_one μ hu h2u hn using 2 · suffices (p' : ℝ) = n' by simpa using this rw [← inv_inj, hp'] field_simp [n', NNReal.conjExponent] · norm_cast simp_rw [eLpNormLESNormFDerivOfEqInnerConst] field_simp -- the case `p > 1` let q := Real.conjExponent p have hq : Real.IsConjExponent p q := .conjExponent hp have h0p : p ≠ 0 := zero_lt_one.trans hp |>.ne' have h1p : (p : ℝ) ≠ 1 := hq.one_lt.ne' have h3p : (p : ℝ) - 1 ≠ 0 := sub_ne_zero_of_ne h1p have h0p' : p' ≠ 0 := by suffices 0 < (p' : ℝ) from (show 0 < p' from this) |>.ne' rw [← inv_pos, hp', sub_pos] exact inv_lt_inv_of_lt hq.pos h2p have h2q : 1 / n' - 1 / q = 1 / p' := by simp_rw (config := {zeta := false}) [one_div, hp'] rw [← hq.one_sub_inv, ← hn.coe.one_sub_inv, sub_sub_sub_cancel_left] simp only [NNReal.coe_natCast, NNReal.coe_inv] let γ : ℝ≥0 := ⟨p * (n - 1) / (n - p), by positivity⟩ have h0γ : (γ : ℝ) = p * (n - 1) / (n - p) := rfl have h1γ : 1 < (γ : ℝ) := by rwa [h0γ, one_lt_div hnp, mul_sub, mul_one, sub_lt_sub_iff_right, lt_mul_iff_one_lt_left] exact hn.coe.pos have h2γ : γ * n' = p' := by rw [← NNReal.coe_inj, ← inv_inj, hp', NNReal.coe_mul, h0γ, hn.coe.conj_eq] field_simp; ring have h3γ : (γ - 1) * q = p' := by rw [← inv_inj, hp', h0γ, hq.conj_eq] have : (p : ℝ) * (n - 1) - (n - p) = n * (p - 1) := by ring field_simp [this]; ring have h4γ : (γ : ℝ) ≠ 0 := (zero_lt_one.trans h1γ).ne' by_cases h3u : ∫⁻ x, ‖u x‖₊ ^ (p' : ℝ) ∂μ = 0 · rw [eLpNorm_nnreal_eq_lintegral h0p', h3u, ENNReal.zero_rpow_of_pos] <;> positivity have h4u : ∫⁻ x, ‖u x‖₊ ^ (p' : ℝ) ∂μ ≠ ∞ := by refine lintegral_rpow_nnnorm_lt_top_of_eLpNorm'_lt_top (pos_iff_ne_zero.mpr h0p') ?_ |>.ne dsimp only rw [NNReal.val_eq_coe, ← eLpNorm_nnreal_eq_eLpNorm' h0p'] exact hu.continuous.memℒp_of_hasCompactSupport (μ := μ) h2u |>.eLpNorm_lt_top have h5u : (∫⁻ x, ‖u x‖₊ ^ (p' : ℝ) ∂μ) ^ (1 / q) ≠ 0 := ENNReal.rpow_pos (pos_iff_ne_zero.mpr h3u) h4u |>.ne' have h6u : (∫⁻ x, ‖u x‖₊ ^ (p' : ℝ) ∂μ) ^ (1 / q) ≠ ∞ := ENNReal.rpow_ne_top_of_nonneg (div_nonneg zero_le_one hq.symm.nonneg) h4u have h7u := hu.continuous -- for fun_prop have h8u := (hu.fderiv_right (m := 0) le_rfl).continuous -- for fun_prop let v : E → ℝ := fun x ↦ ‖u x‖ ^ (γ : ℝ) have hv : ContDiff ℝ 1 v := hu.norm_rpow h1γ have h2v : HasCompactSupport v := h2u.norm.rpow_const h4γ set C := eLpNormLESNormFDerivOneConst μ n' have := calc (∫⁻ x, ‖u x‖₊ ^ (p' : ℝ) ∂μ) ^ (1 / (n' : ℝ)) = eLpNorm v n' μ := by rw [← h2γ, eLpNorm_nnreal_eq_lintegral hn.symm.pos.ne'] simp (discharger := positivity) [v, Real.nnnorm_rpow_of_nonneg, ENNReal.rpow_mul, ENNReal.coe_rpow_of_nonneg] _ ≤ C * eLpNorm (fderiv ℝ v) 1 μ := eLpNorm_le_eLpNorm_fderiv_one μ hv h2v hn _ = C * ∫⁻ x, ‖fderiv ℝ v x‖₊ ∂μ := by rw [eLpNorm_one_eq_lintegral_nnnorm] _ ≤ C * γ * ∫⁻ x, ‖u x‖₊ ^ ((γ : ℝ) - 1) * ‖fderiv ℝ u x‖₊ ∂μ := by rw [mul_assoc, ← lintegral_const_mul γ] gcongr simp_rw [← mul_assoc, ENNReal.coe_rpow_of_nonneg _ (sub_nonneg.mpr h1γ.le)] exact ENNReal.coe_le_coe.mpr <| nnnorm_fderiv_norm_rpow_le (hu.differentiable le_rfl) h1γ fun_prop _ ≤ C * γ * ((∫⁻ x, ‖u x‖₊ ^ (p' : ℝ) ∂μ) ^ (1 / q) * (∫⁻ x, ‖fderiv ℝ u x‖₊ ^ (p : ℝ) ∂μ) ^ (1 / (p : ℝ))) := by gcongr convert ENNReal.lintegral_mul_le_Lp_mul_Lq μ (.symm <| .conjExponent <| show 1 < (p : ℝ) from hp) ?_ ?_ using 5 · simp_rw [← ENNReal.rpow_mul, ← h3γ] · borelize F' fun_prop · fun_prop _ = C * γ * (∫⁻ x, ‖fderiv ℝ u x‖₊ ^ (p : ℝ) ∂μ) ^ (1 / (p : ℝ)) * (∫⁻ x, ‖u x‖₊ ^ (p' : ℝ) ∂μ) ^ (1 / q) := by ring calc eLpNorm u p' μ = (∫⁻ x, ‖u x‖₊ ^ (p' : ℝ) ∂μ) ^ (1 / (p' : ℝ)) := eLpNorm_nnreal_eq_lintegral h0p' _ ≤ C * γ * (∫⁻ x, ‖fderiv ℝ u x‖₊ ^ (p : ℝ) ∂μ) ^ (1 / (p : ℝ)) := by rwa [← h2q, ENNReal.rpow_sub _ _ h3u h4u, ENNReal.div_le_iff h5u h6u] _ = eLpNormLESNormFDerivOfEqInnerConst μ p * eLpNorm (fderiv ℝ u) (↑p) μ := by suffices (C : ℝ) * γ = eLpNormLESNormFDerivOfEqInnerConst μ p by rw [eLpNorm_nnreal_eq_lintegral h0p] congr norm_cast at this ⊢ simp_rw [eLpNormLESNormFDerivOfEqInnerConst, γ] refold_let n n' C rw [NNReal.coe_mul, NNReal.coe_mk, Real.coe_toNNReal', mul_eq_mul_left_iff, eq_comm, max_eq_left_iff] left positivity @[deprecated (since := "2024-07-27")] alias snorm_le_snorm_fderiv_of_eq_inner := eLpNorm_le_eLpNorm_fderiv_of_eq_inner variable (F) in /-- The constant factor occurring in the conclusion of `eLpNorm_le_eLpNorm_fderiv_of_eq`. It only depends on `E`, `F`, `μ` and `p`. -/ irreducible_def SNormLESNormFDerivOfEqConst [FiniteDimensional ℝ F] (p : ℝ) : ℝ≥0 := let F' := EuclideanSpace ℝ <| Fin <| finrank ℝ F let e : F ≃L[ℝ] F' := toEuclidean ‖(e.symm : F' →L[ℝ] F)‖₊ * eLpNormLESNormFDerivOfEqInnerConst μ p * ‖(e : F →L[ℝ] F')‖₊ /-- The **Gagliardo-Nirenberg-Sobolev inequality**. Let `u` be a continuously differentiable compactly-supported function `u` on a normed space `E` of finite dimension `n`, equipped with Haar measure, let `1 < p < n` and let `p'⁻¹ := p⁻¹ - n⁻¹`. Then the `Lᵖ'` norm of `u` is bounded above by a constant times the `Lᵖ` norm of the Fréchet derivative of `u`. This is the version where the codomain of `u` is a finite dimensional normed space. -/ theorem eLpNorm_le_eLpNorm_fderiv_of_eq [FiniteDimensional ℝ F] {u : E → F} (hu : ContDiff ℝ 1 u) (h2u : HasCompactSupport u) {p p' : ℝ≥0} (hp : 1 ≤ p) (hn : 0 < finrank ℝ E) (hp' : (p' : ℝ)⁻¹ = p⁻¹ - (finrank ℝ E : ℝ)⁻¹) : eLpNorm u p' μ ≤ SNormLESNormFDerivOfEqConst F μ p * eLpNorm (fderiv ℝ u) p μ := by /- Here we reduce the GNS-inequality with a Hilbert space as codomain to the case with a finite-dimensional normed space as codomain, by transferring the result along the equivalence `F ≃ ℝᵐ`. -/ let F' := EuclideanSpace ℝ <| Fin <| finrank ℝ F let e : F ≃L[ℝ] F' := toEuclidean let C₁ : ℝ≥0 := ‖(e.symm : F' →L[ℝ] F)‖₊ let C : ℝ≥0 := eLpNormLESNormFDerivOfEqInnerConst μ p let C₂ : ℝ≥0 := ‖(e : F →L[ℝ] F')‖₊ let v := e ∘ u have hv : ContDiff ℝ 1 v := e.contDiff.comp hu have h2v : HasCompactSupport v := h2u.comp_left e.map_zero have := eLpNorm_le_eLpNorm_fderiv_of_eq_inner μ hv h2v hp hn hp' have h4v : ∀ x, ‖fderiv ℝ v x‖ ≤ C₂ * ‖fderiv ℝ u x‖ := fun x ↦ calc ‖fderiv ℝ v x‖ = ‖(fderiv ℝ e (u x)).comp (fderiv ℝ u x)‖ := by rw [fderiv.comp x e.differentiableAt (hu.differentiable le_rfl x)] _ ≤ ‖fderiv ℝ e (u x)‖ * ‖fderiv ℝ u x‖ := (fderiv ℝ e (u x)).opNorm_comp_le (fderiv ℝ u x) _ = C₂ * ‖fderiv ℝ u x‖ := by simp_rw [e.fderiv, C₂, coe_nnnorm] calc eLpNorm u p' μ = eLpNorm (e.symm ∘ v) p' μ := by simp_rw [v, Function.comp, e.symm_apply_apply] _ ≤ C₁ • eLpNorm v p' μ := by apply eLpNorm_le_nnreal_smul_eLpNorm_of_ae_le_mul exact eventually_of_forall (fun x ↦ (e.symm : F' →L[ℝ] F).le_opNNNorm _) _ = C₁ * eLpNorm v p' μ := rfl _ ≤ C₁ * C * eLpNorm (fderiv ℝ v) p μ := by rw [mul_assoc]; gcongr _ ≤ C₁ * C * (C₂ * eLpNorm (fderiv ℝ u) p μ) := by gcongr; exact eLpNorm_le_nnreal_smul_eLpNorm_of_ae_le_mul (eventually_of_forall h4v) p _ = SNormLESNormFDerivOfEqConst F μ p * eLpNorm (fderiv ℝ u) p μ := by simp_rw [SNormLESNormFDerivOfEqConst] push_cast simp_rw [mul_assoc] @[deprecated (since := "2024-07-27")] alias snorm_le_snorm_fderiv_of_eq := eLpNorm_le_eLpNorm_fderiv_of_eq variable (F) in /-- The constant factor occurring in the conclusion of `eLpNorm_le_eLpNorm_fderiv_of_le`. It only depends on `F`, `μ`, `s`, `p` and `q`. -/ irreducible_def eLpNormLESNormFDerivOfLeConst [FiniteDimensional ℝ F] (s : Set E) (p q : ℝ≥0) : ℝ≥0 := let p' : ℝ≥0 := (p⁻¹ - (finrank ℝ E : ℝ≥0)⁻¹)⁻¹ (μ s).toNNReal ^ (1 / q - 1 / p' : ℝ) * SNormLESNormFDerivOfEqConst F μ p /-- The **Gagliardo-Nirenberg-Sobolev inequality**. Let `u` be a continuously differentiable function `u` supported in a bounded set `s` in a normed space `E` of finite dimension `n`, equipped with Haar measure, and let `1 < p < n` and `0 < q ≤ (p⁻¹ - (finrank ℝ E : ℝ)⁻¹)⁻¹`. Then the `L^q` norm of `u` is bounded above by a constant times the `Lᵖ` norm of the Fréchet derivative of `u`. Note: The codomain of `u` needs to be a finite dimensional normed space. -/ theorem eLpNorm_le_eLpNorm_fderiv_of_le [FiniteDimensional ℝ F] {u : E → F} {s : Set E} (hu : ContDiff ℝ 1 u) (h2u : u.support ⊆ s) {p q : ℝ≥0} (hp : 1 ≤ p) (h2p : p < finrank ℝ E) (hpq : p⁻¹ - (finrank ℝ E : ℝ)⁻¹ ≤ (q : ℝ)⁻¹) (hs : Bornology.IsBounded s) : eLpNorm u q μ ≤ eLpNormLESNormFDerivOfLeConst F μ s p q * eLpNorm (fderiv ℝ u) p μ := by by_cases hq0 : q = 0 · simp [hq0] let p' : ℝ≥0 := (p⁻¹ - (finrank ℝ E : ℝ≥0)⁻¹)⁻¹ have hp' : p'⁻¹ = p⁻¹ - (finrank ℝ E : ℝ)⁻¹ := by rw [inv_inv, NNReal.coe_sub] · simp · gcongr have : (q : ℝ≥0∞) ≤ p' := by have H : (p' : ℝ)⁻¹ ≤ (↑q)⁻¹ := trans hp' hpq norm_cast at H ⊢ rwa [inv_le_inv] at H · dsimp have : 0 < p⁻¹ - (finrank ℝ E : ℝ≥0)⁻¹ := by simp only [tsub_pos_iff_lt] gcongr positivity · positivity set t := (μ s).toNNReal ^ (1 / q - 1 / p' : ℝ) let C := SNormLESNormFDerivOfEqConst F μ p calc eLpNorm u q μ = eLpNorm u q (μ.restrict s) := by rw [eLpNorm_restrict_eq_of_support_subset h2u] _ ≤ eLpNorm u p' (μ.restrict s) * t := by convert eLpNorm_le_eLpNorm_mul_rpow_measure_univ this hu.continuous.aestronglyMeasurable rw [← ENNReal.coe_rpow_of_nonneg] · simp [ENNReal.coe_toNNReal hs.measure_lt_top.ne] · rw [one_div, one_div] norm_cast rw [hp'] simpa using hpq _ = eLpNorm u p' μ * t := by rw [eLpNorm_restrict_eq_of_support_subset h2u] _ ≤ (C * eLpNorm (fderiv ℝ u) p μ) * t := by have h2u' : HasCompactSupport u := by apply HasCompactSupport.of_support_subset_isCompact hs.isCompact_closure exact h2u.trans subset_closure rel [eLpNorm_le_eLpNorm_fderiv_of_eq μ hu h2u' hp (mod_cast (zero_le p).trans_lt h2p) hp'] _ = eLpNormLESNormFDerivOfLeConst F μ s p q * eLpNorm (fderiv ℝ u) p μ := by simp_rw [eLpNormLESNormFDerivOfLeConst, ENNReal.coe_mul]; ring @[deprecated (since := "2024-07-27")] alias snorm_le_snorm_fderiv_of_le := eLpNorm_le_eLpNorm_fderiv_of_le /-- The **Gagliardo-Nirenberg-Sobolev inequality**. Let `u` be a continuously differentiable function `u` supported in a bounded set `s` in a normed space `E` of finite dimension `n`, equipped with Haar measure, and let `1 < p < n`. Then the `Lᵖ` norm of `u` is bounded above by a constant times the `Lᵖ` norm of the Fréchet derivative of `u`. Note: The codomain of `u` needs to be a finite dimensional normed space. -/ theorem eLpNorm_le_eLpNorm_fderiv [FiniteDimensional ℝ F] {u : E → F} {s : Set E} (hu : ContDiff ℝ 1 u) (h2u : u.support ⊆ s) {p : ℝ≥0} (hp : 1 ≤ p) (h2p : p < finrank ℝ E) (hs : Bornology.IsBounded s) : eLpNorm u p μ ≤ eLpNormLESNormFDerivOfLeConst F μ s p p * eLpNorm (fderiv ℝ u) p μ := by refine eLpNorm_le_eLpNorm_fderiv_of_le μ hu h2u hp h2p ?_ hs norm_cast simp only [tsub_le_iff_right, le_add_iff_nonneg_right] positivity @[deprecated (since := "2024-07-27")] alias snorm_le_snorm_fderiv := eLpNorm_le_eLpNorm_fderiv end MeasureTheory
Analysis\InnerProductSpace\Adjoint.lean
/- Copyright (c) 2021 Frédéric Dupuis. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Frédéric Dupuis, Heather Macbeth -/ import Mathlib.Analysis.InnerProductSpace.Dual import Mathlib.Analysis.InnerProductSpace.PiL2 /-! # Adjoint of operators on Hilbert spaces Given an operator `A : E →L[𝕜] F`, where `E` and `F` are Hilbert spaces, its adjoint `adjoint A : F →L[𝕜] E` is the unique operator such that `⟪x, A y⟫ = ⟪adjoint A x, y⟫` for all `x` and `y`. We then use this to put a C⋆-algebra structure on `E →L[𝕜] E` with the adjoint as the star operation. This construction is used to define an adjoint for linear maps (i.e. not continuous) between finite dimensional spaces. ## Main definitions * `ContinuousLinearMap.adjoint : (E →L[𝕜] F) ≃ₗᵢ⋆[𝕜] (F →L[𝕜] E)`: the adjoint of a continuous linear map, bundled as a conjugate-linear isometric equivalence. * `LinearMap.adjoint : (E →ₗ[𝕜] F) ≃ₗ⋆[𝕜] (F →ₗ[𝕜] E)`: the adjoint of a linear map between finite-dimensional spaces, this time only as a conjugate-linear equivalence, since there is no norm defined on these maps. ## Implementation notes * The continuous conjugate-linear version `adjointAux` is only an intermediate definition and is not meant to be used outside this file. ## Tags adjoint -/ noncomputable section open RCLike open scoped ComplexConjugate variable {𝕜 E F G : Type*} [RCLike 𝕜] variable [NormedAddCommGroup E] [NormedAddCommGroup F] [NormedAddCommGroup G] variable [InnerProductSpace 𝕜 E] [InnerProductSpace 𝕜 F] [InnerProductSpace 𝕜 G] local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y /-! ### Adjoint operator -/ open InnerProductSpace namespace ContinuousLinearMap variable [CompleteSpace E] [CompleteSpace G] -- Note: made noncomputable to stop excess compilation -- leanprover-community/mathlib4#7103 /-- The adjoint, as a continuous conjugate-linear map. This is only meant as an auxiliary definition for the main definition `adjoint`, where this is bundled as a conjugate-linear isometric equivalence. -/ noncomputable def adjointAux : (E →L[𝕜] F) →L⋆[𝕜] F →L[𝕜] E := (ContinuousLinearMap.compSL _ _ _ _ _ ((toDual 𝕜 E).symm : NormedSpace.Dual 𝕜 E →L⋆[𝕜] E)).comp (toSesqForm : (E →L[𝕜] F) →L[𝕜] F →L⋆[𝕜] NormedSpace.Dual 𝕜 E) @[simp] theorem adjointAux_apply (A : E →L[𝕜] F) (x : F) : adjointAux A x = ((toDual 𝕜 E).symm : NormedSpace.Dual 𝕜 E → E) ((toSesqForm A) x) := rfl theorem adjointAux_inner_left (A : E →L[𝕜] F) (x : E) (y : F) : ⟪adjointAux A y, x⟫ = ⟪y, A x⟫ := by rw [adjointAux_apply, toDual_symm_apply, toSesqForm_apply_coe, coe_comp', innerSL_apply_coe, Function.comp_apply] theorem adjointAux_inner_right (A : E →L[𝕜] F) (x : E) (y : F) : ⟪x, adjointAux A y⟫ = ⟪A x, y⟫ := by rw [← inner_conj_symm, adjointAux_inner_left, inner_conj_symm] variable [CompleteSpace F] theorem adjointAux_adjointAux (A : E →L[𝕜] F) : adjointAux (adjointAux A) = A := by ext v refine ext_inner_left 𝕜 fun w => ?_ rw [adjointAux_inner_right, adjointAux_inner_left] @[simp] theorem adjointAux_norm (A : E →L[𝕜] F) : ‖adjointAux A‖ = ‖A‖ := by refine le_antisymm ?_ ?_ · refine ContinuousLinearMap.opNorm_le_bound _ (norm_nonneg _) fun x => ?_ rw [adjointAux_apply, LinearIsometryEquiv.norm_map] exact toSesqForm_apply_norm_le · nth_rw 1 [← adjointAux_adjointAux A] refine ContinuousLinearMap.opNorm_le_bound _ (norm_nonneg _) fun x => ?_ rw [adjointAux_apply, LinearIsometryEquiv.norm_map] exact toSesqForm_apply_norm_le /-- The adjoint of a bounded operator from Hilbert space `E` to Hilbert space `F`. -/ def adjoint : (E →L[𝕜] F) ≃ₗᵢ⋆[𝕜] F →L[𝕜] E := LinearIsometryEquiv.ofSurjective { adjointAux with norm_map' := adjointAux_norm } fun A => ⟨adjointAux A, adjointAux_adjointAux A⟩ scoped[InnerProduct] postfix:1000 "†" => ContinuousLinearMap.adjoint open InnerProduct /-- The fundamental property of the adjoint. -/ theorem adjoint_inner_left (A : E →L[𝕜] F) (x : E) (y : F) : ⟪(A†) y, x⟫ = ⟪y, A x⟫ := adjointAux_inner_left A x y /-- The fundamental property of the adjoint. -/ theorem adjoint_inner_right (A : E →L[𝕜] F) (x : E) (y : F) : ⟪x, (A†) y⟫ = ⟪A x, y⟫ := adjointAux_inner_right A x y /-- The adjoint is involutive. -/ @[simp] theorem adjoint_adjoint (A : E →L[𝕜] F) : A†† = A := adjointAux_adjointAux A /-- The adjoint of the composition of two operators is the composition of the two adjoints in reverse order. -/ @[simp] theorem adjoint_comp (A : F →L[𝕜] G) (B : E →L[𝕜] F) : (A ∘L B)† = B† ∘L A† := by ext v refine ext_inner_left 𝕜 fun w => ?_ simp only [adjoint_inner_right, ContinuousLinearMap.coe_comp', Function.comp_apply] theorem apply_norm_sq_eq_inner_adjoint_left (A : E →L[𝕜] F) (x : E) : ‖A x‖ ^ 2 = re ⟪(A† ∘L A) x, x⟫ := by have h : ⟪(A† ∘L A) x, x⟫ = ⟪A x, A x⟫ := by rw [← adjoint_inner_left]; rfl rw [h, ← inner_self_eq_norm_sq (𝕜 := 𝕜) _] theorem apply_norm_eq_sqrt_inner_adjoint_left (A : E →L[𝕜] F) (x : E) : ‖A x‖ = √(re ⟪(A† ∘L A) x, x⟫) := by rw [← apply_norm_sq_eq_inner_adjoint_left, Real.sqrt_sq (norm_nonneg _)] theorem apply_norm_sq_eq_inner_adjoint_right (A : E →L[𝕜] F) (x : E) : ‖A x‖ ^ 2 = re ⟪x, (A† ∘L A) x⟫ := by have h : ⟪x, (A† ∘L A) x⟫ = ⟪A x, A x⟫ := by rw [← adjoint_inner_right]; rfl rw [h, ← inner_self_eq_norm_sq (𝕜 := 𝕜) _] theorem apply_norm_eq_sqrt_inner_adjoint_right (A : E →L[𝕜] F) (x : E) : ‖A x‖ = √(re ⟪x, (A† ∘L A) x⟫) := by rw [← apply_norm_sq_eq_inner_adjoint_right, Real.sqrt_sq (norm_nonneg _)] /-- The adjoint is unique: a map `A` is the adjoint of `B` iff it satisfies `⟪A x, y⟫ = ⟪x, B y⟫` for all `x` and `y`. -/ theorem eq_adjoint_iff (A : E →L[𝕜] F) (B : F →L[𝕜] E) : A = B† ↔ ∀ x y, ⟪A x, y⟫ = ⟪x, B y⟫ := by refine ⟨fun h x y => by rw [h, adjoint_inner_left], fun h => ?_⟩ ext x exact ext_inner_right 𝕜 fun y => by simp only [adjoint_inner_left, h x y] @[simp] theorem adjoint_id : ContinuousLinearMap.adjoint (ContinuousLinearMap.id 𝕜 E) = ContinuousLinearMap.id 𝕜 E := by refine Eq.symm ?_ rw [eq_adjoint_iff] simp theorem _root_.Submodule.adjoint_subtypeL (U : Submodule 𝕜 E) [CompleteSpace U] : U.subtypeL† = orthogonalProjection U := by symm rw [eq_adjoint_iff] intro x u rw [U.coe_inner, inner_orthogonalProjection_left_eq_right, orthogonalProjection_mem_subspace_eq_self] rfl theorem _root_.Submodule.adjoint_orthogonalProjection (U : Submodule 𝕜 E) [CompleteSpace U] : (orthogonalProjection U : E →L[𝕜] U)† = U.subtypeL := by rw [← U.adjoint_subtypeL, adjoint_adjoint] /-- `E →L[𝕜] E` is a star algebra with the adjoint as the star operation. -/ instance : Star (E →L[𝕜] E) := ⟨adjoint⟩ instance : InvolutiveStar (E →L[𝕜] E) := ⟨adjoint_adjoint⟩ instance : StarMul (E →L[𝕜] E) := ⟨adjoint_comp⟩ instance : StarRing (E →L[𝕜] E) := ⟨LinearIsometryEquiv.map_add adjoint⟩ instance : StarModule 𝕜 (E →L[𝕜] E) := ⟨LinearIsometryEquiv.map_smulₛₗ adjoint⟩ theorem star_eq_adjoint (A : E →L[𝕜] E) : star A = A† := rfl /-- A continuous linear operator is self-adjoint iff it is equal to its adjoint. -/ theorem isSelfAdjoint_iff' {A : E →L[𝕜] E} : IsSelfAdjoint A ↔ ContinuousLinearMap.adjoint A = A := Iff.rfl theorem norm_adjoint_comp_self (A : E →L[𝕜] F) : ‖ContinuousLinearMap.adjoint A ∘L A‖ = ‖A‖ * ‖A‖ := by refine le_antisymm ?_ ?_ · calc ‖A† ∘L A‖ ≤ ‖A†‖ * ‖A‖ := opNorm_comp_le _ _ _ = ‖A‖ * ‖A‖ := by rw [LinearIsometryEquiv.norm_map] · rw [← sq, ← Real.sqrt_le_sqrt_iff (norm_nonneg _), Real.sqrt_sq (norm_nonneg _)] refine opNorm_le_bound _ (Real.sqrt_nonneg _) fun x => ?_ have := calc re ⟪(A† ∘L A) x, x⟫ ≤ ‖(A† ∘L A) x‖ * ‖x‖ := re_inner_le_norm _ _ _ ≤ ‖A† ∘L A‖ * ‖x‖ * ‖x‖ := mul_le_mul_of_nonneg_right (le_opNorm _ _) (norm_nonneg _) calc ‖A x‖ = √(re ⟪(A† ∘L A) x, x⟫) := by rw [apply_norm_eq_sqrt_inner_adjoint_left] _ ≤ √(‖A† ∘L A‖ * ‖x‖ * ‖x‖) := Real.sqrt_le_sqrt this _ = √‖A† ∘L A‖ * ‖x‖ := by simp_rw [mul_assoc, Real.sqrt_mul (norm_nonneg _) (‖x‖ * ‖x‖), Real.sqrt_mul_self (norm_nonneg x)] instance : CStarRing (E →L[𝕜] E) where norm_mul_self_le x := le_of_eq <| Eq.symm <| norm_adjoint_comp_self x theorem isAdjointPair_inner (A : E →L[𝕜] F) : LinearMap.IsAdjointPair (sesqFormOfInner : E →ₗ[𝕜] E →ₗ⋆[𝕜] 𝕜) (sesqFormOfInner : F →ₗ[𝕜] F →ₗ⋆[𝕜] 𝕜) A (A†) := by intro x y simp only [sesqFormOfInner_apply_apply, adjoint_inner_left, coe_coe] end ContinuousLinearMap /-! ### Self-adjoint operators -/ namespace IsSelfAdjoint open ContinuousLinearMap variable [CompleteSpace E] [CompleteSpace F] theorem adjoint_eq {A : E →L[𝕜] E} (hA : IsSelfAdjoint A) : ContinuousLinearMap.adjoint A = A := hA /-- Every self-adjoint operator on an inner product space is symmetric. -/ theorem isSymmetric {A : E →L[𝕜] E} (hA : IsSelfAdjoint A) : (A : E →ₗ[𝕜] E).IsSymmetric := by intro x y rw_mod_cast [← A.adjoint_inner_right, hA.adjoint_eq] /-- Conjugating preserves self-adjointness. -/ theorem conj_adjoint {T : E →L[𝕜] E} (hT : IsSelfAdjoint T) (S : E →L[𝕜] F) : IsSelfAdjoint (S ∘L T ∘L ContinuousLinearMap.adjoint S) := by rw [isSelfAdjoint_iff'] at hT ⊢ simp only [hT, adjoint_comp, adjoint_adjoint] exact ContinuousLinearMap.comp_assoc _ _ _ /-- Conjugating preserves self-adjointness. -/ theorem adjoint_conj {T : E →L[𝕜] E} (hT : IsSelfAdjoint T) (S : F →L[𝕜] E) : IsSelfAdjoint (ContinuousLinearMap.adjoint S ∘L T ∘L S) := by rw [isSelfAdjoint_iff'] at hT ⊢ simp only [hT, adjoint_comp, adjoint_adjoint] exact ContinuousLinearMap.comp_assoc _ _ _ theorem _root_.ContinuousLinearMap.isSelfAdjoint_iff_isSymmetric {A : E →L[𝕜] E} : IsSelfAdjoint A ↔ (A : E →ₗ[𝕜] E).IsSymmetric := ⟨fun hA => hA.isSymmetric, fun hA => ext fun x => ext_inner_right 𝕜 fun y => (A.adjoint_inner_left y x).symm ▸ (hA x y).symm⟩ theorem _root_.LinearMap.IsSymmetric.isSelfAdjoint {A : E →L[𝕜] E} (hA : (A : E →ₗ[𝕜] E).IsSymmetric) : IsSelfAdjoint A := by rwa [← ContinuousLinearMap.isSelfAdjoint_iff_isSymmetric] at hA /-- The orthogonal projection is self-adjoint. -/ theorem _root_.orthogonalProjection_isSelfAdjoint (U : Submodule 𝕜 E) [CompleteSpace U] : IsSelfAdjoint (U.subtypeL ∘L orthogonalProjection U) := (orthogonalProjection_isSymmetric U).isSelfAdjoint theorem conj_orthogonalProjection {T : E →L[𝕜] E} (hT : IsSelfAdjoint T) (U : Submodule 𝕜 E) [CompleteSpace U] : IsSelfAdjoint (U.subtypeL ∘L orthogonalProjection U ∘L T ∘L U.subtypeL ∘L orthogonalProjection U) := by rw [← ContinuousLinearMap.comp_assoc] nth_rw 1 [← (orthogonalProjection_isSelfAdjoint U).adjoint_eq] exact hT.adjoint_conj _ end IsSelfAdjoint namespace LinearMap variable [CompleteSpace E] variable {T : E →ₗ[𝕜] E} /-- The **Hellinger--Toeplitz theorem**: Construct a self-adjoint operator from an everywhere defined symmetric operator. -/ def IsSymmetric.toSelfAdjoint (hT : IsSymmetric T) : selfAdjoint (E →L[𝕜] E) := ⟨⟨T, hT.continuous⟩, ContinuousLinearMap.isSelfAdjoint_iff_isSymmetric.mpr hT⟩ theorem IsSymmetric.coe_toSelfAdjoint (hT : IsSymmetric T) : (hT.toSelfAdjoint : E →ₗ[𝕜] E) = T := rfl theorem IsSymmetric.toSelfAdjoint_apply (hT : IsSymmetric T) {x : E} : (hT.toSelfAdjoint : E → E) x = T x := rfl end LinearMap namespace LinearMap variable [FiniteDimensional 𝕜 E] [FiniteDimensional 𝕜 F] [FiniteDimensional 𝕜 G] /- Porting note: Lean can't use `FiniteDimensional.complete` since it was generalized to topological vector spaces. Use local instances instead. -/ /-- The adjoint of an operator from the finite-dimensional inner product space `E` to the finite-dimensional inner product space `F`. -/ def adjoint : (E →ₗ[𝕜] F) ≃ₗ⋆[𝕜] F →ₗ[𝕜] E := have := FiniteDimensional.complete 𝕜 E have := FiniteDimensional.complete 𝕜 F /- Note: Instead of the two instances above, the following works: ``` have := FiniteDimensional.complete 𝕜 have := FiniteDimensional.complete 𝕜 ``` But removing one of the `have`s makes it fail. The reason is that `E` and `F` don't live in the same universe, so the first `have` can no longer be used for `F` after its universe metavariable has been assigned to that of `E`! -/ ((LinearMap.toContinuousLinearMap : (E →ₗ[𝕜] F) ≃ₗ[𝕜] E →L[𝕜] F).trans ContinuousLinearMap.adjoint.toLinearEquiv).trans LinearMap.toContinuousLinearMap.symm theorem adjoint_toContinuousLinearMap (A : E →ₗ[𝕜] F) : haveI := FiniteDimensional.complete 𝕜 E haveI := FiniteDimensional.complete 𝕜 F LinearMap.toContinuousLinearMap (LinearMap.adjoint A) = ContinuousLinearMap.adjoint (LinearMap.toContinuousLinearMap A) := rfl theorem adjoint_eq_toCLM_adjoint (A : E →ₗ[𝕜] F) : haveI := FiniteDimensional.complete 𝕜 E haveI := FiniteDimensional.complete 𝕜 F LinearMap.adjoint A = ContinuousLinearMap.adjoint (LinearMap.toContinuousLinearMap A) := rfl /-- The fundamental property of the adjoint. -/ theorem adjoint_inner_left (A : E →ₗ[𝕜] F) (x : E) (y : F) : ⟪adjoint A y, x⟫ = ⟪y, A x⟫ := by haveI := FiniteDimensional.complete 𝕜 E haveI := FiniteDimensional.complete 𝕜 F rw [← coe_toContinuousLinearMap A, adjoint_eq_toCLM_adjoint] exact ContinuousLinearMap.adjoint_inner_left _ x y /-- The fundamental property of the adjoint. -/ theorem adjoint_inner_right (A : E →ₗ[𝕜] F) (x : E) (y : F) : ⟪x, adjoint A y⟫ = ⟪A x, y⟫ := by haveI := FiniteDimensional.complete 𝕜 E haveI := FiniteDimensional.complete 𝕜 F rw [← coe_toContinuousLinearMap A, adjoint_eq_toCLM_adjoint] exact ContinuousLinearMap.adjoint_inner_right _ x y /-- The adjoint is involutive. -/ @[simp] theorem adjoint_adjoint (A : E →ₗ[𝕜] F) : LinearMap.adjoint (LinearMap.adjoint A) = A := by ext v refine ext_inner_left 𝕜 fun w => ?_ rw [adjoint_inner_right, adjoint_inner_left] /-- The adjoint of the composition of two operators is the composition of the two adjoints in reverse order. -/ @[simp] theorem adjoint_comp (A : F →ₗ[𝕜] G) (B : E →ₗ[𝕜] F) : LinearMap.adjoint (A ∘ₗ B) = LinearMap.adjoint B ∘ₗ LinearMap.adjoint A := by ext v refine ext_inner_left 𝕜 fun w => ?_ simp only [adjoint_inner_right, LinearMap.coe_comp, Function.comp_apply] /-- The adjoint is unique: a map `A` is the adjoint of `B` iff it satisfies `⟪A x, y⟫ = ⟪x, B y⟫` for all `x` and `y`. -/ theorem eq_adjoint_iff (A : E →ₗ[𝕜] F) (B : F →ₗ[𝕜] E) : A = LinearMap.adjoint B ↔ ∀ x y, ⟪A x, y⟫ = ⟪x, B y⟫ := by refine ⟨fun h x y => by rw [h, adjoint_inner_left], fun h => ?_⟩ ext x exact ext_inner_right 𝕜 fun y => by simp only [adjoint_inner_left, h x y] /-- The adjoint is unique: a map `A` is the adjoint of `B` iff it satisfies `⟪A x, y⟫ = ⟪x, B y⟫` for all basis vectors `x` and `y`. -/ theorem eq_adjoint_iff_basis {ι₁ : Type*} {ι₂ : Type*} (b₁ : Basis ι₁ 𝕜 E) (b₂ : Basis ι₂ 𝕜 F) (A : E →ₗ[𝕜] F) (B : F →ₗ[𝕜] E) : A = LinearMap.adjoint B ↔ ∀ (i₁ : ι₁) (i₂ : ι₂), ⟪A (b₁ i₁), b₂ i₂⟫ = ⟪b₁ i₁, B (b₂ i₂)⟫ := by refine ⟨fun h x y => by rw [h, adjoint_inner_left], fun h => ?_⟩ refine Basis.ext b₁ fun i₁ => ?_ exact ext_inner_right_basis b₂ fun i₂ => by simp only [adjoint_inner_left, h i₁ i₂] theorem eq_adjoint_iff_basis_left {ι : Type*} (b : Basis ι 𝕜 E) (A : E →ₗ[𝕜] F) (B : F →ₗ[𝕜] E) : A = LinearMap.adjoint B ↔ ∀ i y, ⟪A (b i), y⟫ = ⟪b i, B y⟫ := by refine ⟨fun h x y => by rw [h, adjoint_inner_left], fun h => Basis.ext b fun i => ?_⟩ exact ext_inner_right 𝕜 fun y => by simp only [h i, adjoint_inner_left] theorem eq_adjoint_iff_basis_right {ι : Type*} (b : Basis ι 𝕜 F) (A : E →ₗ[𝕜] F) (B : F →ₗ[𝕜] E) : A = LinearMap.adjoint B ↔ ∀ i x, ⟪A x, b i⟫ = ⟪x, B (b i)⟫ := by refine ⟨fun h x y => by rw [h, adjoint_inner_left], fun h => ?_⟩ ext x exact ext_inner_right_basis b fun i => by simp only [h i, adjoint_inner_left] /-- `E →ₗ[𝕜] E` is a star algebra with the adjoint as the star operation. -/ instance : Star (E →ₗ[𝕜] E) := ⟨adjoint⟩ instance : InvolutiveStar (E →ₗ[𝕜] E) := ⟨adjoint_adjoint⟩ instance : StarMul (E →ₗ[𝕜] E) := ⟨adjoint_comp⟩ instance : StarRing (E →ₗ[𝕜] E) := ⟨LinearEquiv.map_add adjoint⟩ instance : StarModule 𝕜 (E →ₗ[𝕜] E) := ⟨LinearEquiv.map_smulₛₗ adjoint⟩ theorem star_eq_adjoint (A : E →ₗ[𝕜] E) : star A = LinearMap.adjoint A := rfl /-- A continuous linear operator is self-adjoint iff it is equal to its adjoint. -/ theorem isSelfAdjoint_iff' {A : E →ₗ[𝕜] E} : IsSelfAdjoint A ↔ LinearMap.adjoint A = A := Iff.rfl theorem isSymmetric_iff_isSelfAdjoint (A : E →ₗ[𝕜] E) : IsSymmetric A ↔ IsSelfAdjoint A := by rw [isSelfAdjoint_iff', IsSymmetric, ← LinearMap.eq_adjoint_iff] exact eq_comm theorem isAdjointPair_inner (A : E →ₗ[𝕜] F) : IsAdjointPair (sesqFormOfInner : E →ₗ[𝕜] E →ₗ⋆[𝕜] 𝕜) (sesqFormOfInner : F →ₗ[𝕜] F →ₗ⋆[𝕜] 𝕜) A (LinearMap.adjoint A) := by intro x y simp only [sesqFormOfInner_apply_apply, adjoint_inner_left] /-- The Gram operator T†T is symmetric. -/ theorem isSymmetric_adjoint_mul_self (T : E →ₗ[𝕜] E) : IsSymmetric (LinearMap.adjoint T * T) := by intro x y simp only [mul_apply, adjoint_inner_left, adjoint_inner_right] /-- The Gram operator T†T is a positive operator. -/ theorem re_inner_adjoint_mul_self_nonneg (T : E →ₗ[𝕜] E) (x : E) : 0 ≤ re ⟪x, (LinearMap.adjoint T * T) x⟫ := by simp only [mul_apply, adjoint_inner_right, inner_self_eq_norm_sq_to_K] norm_cast exact sq_nonneg _ @[simp] theorem im_inner_adjoint_mul_self_eq_zero (T : E →ₗ[𝕜] E) (x : E) : im ⟪x, LinearMap.adjoint T (T x)⟫ = 0 := by simp only [mul_apply, adjoint_inner_right, inner_self_eq_norm_sq_to_K] norm_cast end LinearMap section Unitary variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace 𝕜 H] [CompleteSpace H] namespace ContinuousLinearMap variable {K : Type*} [NormedAddCommGroup K] [InnerProductSpace 𝕜 K] [CompleteSpace K] theorem inner_map_map_iff_adjoint_comp_self (u : H →L[𝕜] K) : (∀ x y : H, ⟪u x, u y⟫_𝕜 = ⟪x, y⟫_𝕜) ↔ adjoint u ∘L u = 1 := by refine ⟨fun h ↦ ext fun x ↦ ?_, fun h ↦ ?_⟩ · refine ext_inner_right 𝕜 fun y ↦ ?_ simpa [star_eq_adjoint, adjoint_inner_left] using h x y · simp [← adjoint_inner_left, ← comp_apply, h] theorem norm_map_iff_adjoint_comp_self (u : H →L[𝕜] K) : (∀ x : H, ‖u x‖ = ‖x‖) ↔ adjoint u ∘L u = 1 := by rw [LinearMap.norm_map_iff_inner_map_map u, u.inner_map_map_iff_adjoint_comp_self] @[simp] lemma _root_.LinearIsometryEquiv.adjoint_eq_symm (e : H ≃ₗᵢ[𝕜] K) : adjoint (e : H →L[𝕜] K) = e.symm := let e' := (e : H →L[𝕜] K) calc adjoint e' = adjoint e' ∘L (e' ∘L e.symm) := by convert (adjoint e').comp_id.symm ext simp [e'] _ = e.symm := by rw [← comp_assoc, norm_map_iff_adjoint_comp_self e' |>.mp e.norm_map] exact (e.symm : K →L[𝕜] H).id_comp @[simp] lemma _root_.LinearIsometryEquiv.star_eq_symm (e : H ≃ₗᵢ[𝕜] H) : star (e : H →L[𝕜] H) = e.symm := e.adjoint_eq_symm theorem norm_map_of_mem_unitary {u : H →L[𝕜] H} (hu : u ∈ unitary (H →L[𝕜] H)) (x : H) : ‖u x‖ = ‖x‖ := -- Elaborates faster with this broken out #11299 have := unitary.star_mul_self_of_mem hu u.norm_map_iff_adjoint_comp_self.mpr this x theorem inner_map_map_of_mem_unitary {u : H →L[𝕜] H} (hu : u ∈ unitary (H →L[𝕜] H)) (x y : H) : ⟪u x, u y⟫_𝕜 = ⟪x, y⟫_𝕜 := -- Elaborates faster with this broken out #11299 have := unitary.star_mul_self_of_mem hu u.inner_map_map_iff_adjoint_comp_self.mpr this x y end ContinuousLinearMap namespace unitary theorem norm_map (u : unitary (H →L[𝕜] H)) (x : H) : ‖(u : H →L[𝕜] H) x‖ = ‖x‖ := u.val.norm_map_of_mem_unitary u.property x theorem inner_map_map (u : unitary (H →L[𝕜] H)) (x y : H) : ⟪(u : H →L[𝕜] H) x, (u : H →L[𝕜] H) y⟫_𝕜 = ⟪x, y⟫_𝕜 := u.val.inner_map_map_of_mem_unitary u.property x y /-- The unitary elements of continuous linear maps on a Hilbert space coincide with the linear isometric equivalences on that Hilbert space. -/ noncomputable def linearIsometryEquiv : unitary (H →L[𝕜] H) ≃* (H ≃ₗᵢ[𝕜] H) where toFun u := { (u : H →L[𝕜] H) with norm_map' := norm_map u invFun := ↑(star u) left_inv := fun x ↦ congr($(star_mul_self u).val x) right_inv := fun x ↦ congr($(mul_star_self u).val x) } invFun e := { val := e property := by let e' : (H →L[𝕜] H)ˣ := { val := (e : H →L[𝕜] H) inv := (e.symm : H →L[𝕜] H) val_inv := by ext; simp inv_val := by ext; simp } exact IsUnit.mem_unitary_of_star_mul_self ⟨e', rfl⟩ <| (e : H →L[𝕜] H).norm_map_iff_adjoint_comp_self.mp e.norm_map } left_inv u := Subtype.ext rfl right_inv e := LinearIsometryEquiv.ext fun x ↦ rfl map_mul' u v := by ext; rfl @[simp] lemma linearIsometryEquiv_coe_apply (u : unitary (H →L[𝕜] H)) : linearIsometryEquiv u = (u : H →L[𝕜] H) := rfl @[simp] lemma linearIsometryEquiv_coe_symm_apply (e : H ≃ₗᵢ[𝕜] H) : linearIsometryEquiv.symm e = (e : H →L[𝕜] H) := rfl end unitary end Unitary section Matrix open Matrix LinearMap variable {m n : Type*} [Fintype m] [DecidableEq m] [Fintype n] [DecidableEq n] variable [FiniteDimensional 𝕜 E] [FiniteDimensional 𝕜 F] variable (v₁ : OrthonormalBasis n 𝕜 E) (v₂ : OrthonormalBasis m 𝕜 F) /-- The linear map associated to the conjugate transpose of a matrix corresponding to two orthonormal bases is the adjoint of the linear map associated to the matrix. -/ lemma Matrix.toLin_conjTranspose (A : Matrix m n 𝕜) : toLin v₂.toBasis v₁.toBasis Aᴴ = adjoint (toLin v₁.toBasis v₂.toBasis A) := by refine eq_adjoint_iff_basis v₂.toBasis v₁.toBasis _ _ |>.mpr fun i j ↦ ?_ simp_rw [toLin_self] simp [sum_inner, inner_smul_left, inner_sum, inner_smul_right, orthonormal_iff_ite.mp v₁.orthonormal, orthonormal_iff_ite.mp v₂.orthonormal] /-- The matrix associated to the adjoint of a linear map corresponding to two orthonormal bases is the conjugate tranpose of the matrix associated to the linear map. -/ lemma LinearMap.toMatrix_adjoint (f : E →ₗ[𝕜] F) : toMatrix v₂.toBasis v₁.toBasis (adjoint f) = (toMatrix v₁.toBasis v₂.toBasis f)ᴴ := toLin v₂.toBasis v₁.toBasis |>.injective <| by simp [toLin_conjTranspose] /-- The star algebra equivalence between the linear endomorphisms of finite-dimensional inner product space and square matrices induced by the choice of an orthonormal basis. -/ @[simps] def LinearMap.toMatrixOrthonormal : (E →ₗ[𝕜] E) ≃⋆ₐ[𝕜] Matrix n n 𝕜 := { LinearMap.toMatrix v₁.toBasis v₁.toBasis with map_mul' := LinearMap.toMatrix_mul v₁.toBasis map_star' := LinearMap.toMatrix_adjoint v₁ v₁ } open scoped ComplexConjugate /-- The adjoint of the linear map associated to a matrix is the linear map associated to the conjugate transpose of that matrix. -/ theorem Matrix.toEuclideanLin_conjTranspose_eq_adjoint (A : Matrix m n 𝕜) : Matrix.toEuclideanLin A.conjTranspose = LinearMap.adjoint (Matrix.toEuclideanLin A) := A.toLin_conjTranspose (EuclideanSpace.basisFun n 𝕜) (EuclideanSpace.basisFun m 𝕜) end Matrix
Analysis\InnerProductSpace\Basic.lean
/- Copyright (c) 2019 Zhouhang Zhou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Zhouhang Zhou, Sébastien Gouëzel, Frédéric Dupuis -/ import Mathlib.Algebra.DirectSum.Module import Mathlib.Algebra.Module.LinearMap.Basic import Mathlib.Algebra.QuadraticDiscriminant import Mathlib.Analysis.Complex.Basic import Mathlib.Analysis.Convex.Uniform import Mathlib.Analysis.Normed.Module.Completion import Mathlib.Analysis.Normed.Operator.BoundedLinearMaps /-! # Inner product space This file defines inner product spaces and proves the basic properties. We do not formally define Hilbert spaces, but they can be obtained using the set of assumptions `[NormedAddCommGroup E] [InnerProductSpace 𝕜 E] [CompleteSpace E]`. An inner product space is a vector space endowed with an inner product. It generalizes the notion of dot product in `ℝ^n` and provides the means of defining the length of a vector and the angle between two vectors. In particular vectors `x` and `y` are orthogonal if their inner product equals zero. We define both the real and complex cases at the same time using the `RCLike` typeclass. This file proves general results on inner product spaces. For the specific construction of an inner product structure on `n → 𝕜` for `𝕜 = ℝ` or `ℂ`, see `EuclideanSpace` in `Analysis.InnerProductSpace.PiL2`. ## Main results - We define the class `InnerProductSpace 𝕜 E` extending `NormedSpace 𝕜 E` with a number of basic properties, most notably the Cauchy-Schwarz inequality. Here `𝕜` is understood to be either `ℝ` or `ℂ`, through the `RCLike` typeclass. - We show that the inner product is continuous, `continuous_inner`, and bundle it as the continuous sesquilinear map `innerSL` (see also `innerₛₗ` for the non-continuous version). - We define `Orthonormal`, a predicate on a function `v : ι → E`, and prove the existence of a maximal orthonormal set, `exists_maximal_orthonormal`. Bessel's inequality, `Orthonormal.tsum_inner_products_le`, states that given an orthonormal set `v` and a vector `x`, the sum of the norm-squares of the inner products `⟪v i, x⟫` is no more than the norm-square of `x`. For the existence of orthonormal bases, Hilbert bases, etc., see the file `Analysis.InnerProductSpace.projection`. ## Notation We globally denote the real and complex inner products by `⟪·, ·⟫_ℝ` and `⟪·, ·⟫_ℂ` respectively. We also provide two notation namespaces: `RealInnerProductSpace`, `ComplexInnerProductSpace`, which respectively introduce the plain notation `⟪·, ·⟫` for the real and complex inner product. ## Implementation notes We choose the convention that inner products are conjugate linear in the first argument and linear in the second. ## Tags inner product space, Hilbert space, norm ## References * [Clément & Martin, *The Lax-Milgram Theorem. A detailed proof to be formalized in Coq*] * [Clément & Martin, *A Coq formal proof of the Lax–Milgram theorem*] The Coq code is available at the following address: <http://www.lri.fr/~sboldo/elfic/index.html> -/ noncomputable section open RCLike Real Filter open Topology ComplexConjugate open LinearMap (BilinForm) variable {𝕜 E F : Type*} [RCLike 𝕜] /-- Syntactic typeclass for types endowed with an inner product -/ class Inner (𝕜 E : Type*) where /-- The inner product function. -/ inner : E → E → 𝕜 export Inner (inner) /-- The inner product with values in `𝕜`. -/ notation3:max "⟪" x ", " y "⟫_" 𝕜:max => @inner 𝕜 _ _ x y section Notations /-- The inner product with values in `ℝ`. -/ scoped[RealInnerProductSpace] notation "⟪" x ", " y "⟫" => @inner ℝ _ _ x y /-- The inner product with values in `ℂ`. -/ scoped[ComplexInnerProductSpace] notation "⟪" x ", " y "⟫" => @inner ℂ _ _ x y end Notations /-- A (pre) inner product space is a vector space with an additional operation called inner product. The (semi)norm could be derived from the inner product, instead we require the existence of a seminorm and the fact that `‖x‖^2 = re ⟪x, x⟫` to be able to put instances on `𝕂` or product spaces. Note that `NormedSpace` does not assume that `‖x‖=0` implies `x=0` (it is rather a seminorm). To construct a seminorm from an inner product, see `PreInnerProductSpace.ofCore`. -/ class InnerProductSpace (𝕜 : Type*) (E : Type*) [RCLike 𝕜] [SeminormedAddCommGroup E] extends NormedSpace 𝕜 E, Inner 𝕜 E where /-- The inner product induces the norm. -/ norm_sq_eq_inner : ∀ x : E, ‖x‖ ^ 2 = re (inner x x) /-- The inner product is *hermitian*, taking the `conj` swaps the arguments. -/ conj_symm : ∀ x y, conj (inner y x) = inner x y /-- The inner product is additive in the first coordinate. -/ add_left : ∀ x y z, inner (x + y) z = inner x z + inner y z /-- The inner product is conjugate linear in the first coordinate. -/ smul_left : ∀ x y r, inner (r • x) y = conj r * inner x y /-! ### Constructing a normed space structure from an inner product In the definition of an inner product space, we require the existence of a norm, which is equal (but maybe not defeq) to the square root of the scalar product. This makes it possible to put an inner product space structure on spaces with a preexisting norm (for instance `ℝ`), with good properties. However, sometimes, one would like to define the norm starting only from a well-behaved scalar product. This is what we implement in this paragraph, starting from a structure `InnerProductSpace.Core` stating that we have a nice scalar product. Our goal here is not to develop a whole theory with all the supporting API, as this will be done below for `InnerProductSpace`. Instead, we implement the bare minimum to go as directly as possible to the construction of the norm and the proof of the triangular inequality. Warning: Do not use this `Core` structure if the space you are interested in already has a norm instance defined on it, otherwise this will create a second non-defeq norm instance! -/ /-- A structure requiring that a scalar product is positive semidefinite and symmetric. -/ structure PreInnerProductSpace.Core (𝕜 : Type*) (F : Type*) [RCLike 𝕜] [AddCommGroup F] [Module 𝕜 F] extends Inner 𝕜 F where /-- The inner product is *hermitian*, taking the `conj` swaps the arguments. -/ conj_symm : ∀ x y, conj (inner y x) = inner x y /-- The inner product is positive (semi)definite. -/ nonneg_re : ∀ x, 0 ≤ re (inner x x) /-- The inner product is positive definite. -/ add_left : ∀ x y z, inner (x + y) z = inner x z + inner y z /-- The inner product is conjugate linear in the first coordinate. -/ smul_left : ∀ x y r, inner (r • x) y = conj r * inner x y attribute [class] PreInnerProductSpace.Core /-- A structure requiring that a scalar product is positive definite. Some theorems that require this assumptions are put under section `InnerProductSpace.Core`. -/ -- @[nolint HasNonemptyInstance] porting note: I don't think we have this linter anymore structure InnerProductSpace.Core (𝕜 : Type*) (F : Type*) [RCLike 𝕜] [AddCommGroup F] [Module 𝕜 F] extends PreInnerProductSpace.Core 𝕜 F where /-- The inner product is positive definite. -/ definite : ∀ x, inner x x = 0 → x = 0 /- We set `InnerProductSpace.Core` to be a class as we will use it as such in the construction of the normed space structure that it produces. However, all the instances we will use will be local to this proof. -/ attribute [class] InnerProductSpace.Core instance (𝕜 : Type*) (F : Type*) [RCLike 𝕜] [AddCommGroup F] [Module 𝕜 F] [cd : InnerProductSpace.Core 𝕜 F] : PreInnerProductSpace.Core 𝕜 F where inner := cd.inner conj_symm := cd.conj_symm nonneg_re := cd.nonneg_re add_left := cd.add_left smul_left := cd.smul_left /-- Define `PreInnerProductSpace.Core` from `PreInnerProductSpace`. Defined to reuse lemmas about `PreInnerProductSpace.Core` for `PreInnerProductSpace`s. Note that the `Seminorm` instance provided by `PreInnerProductSpace.Core.norm` is propositionally but not definitionally equal to the original norm. -/ def PreInnerProductSpace.toCore [SeminormedAddCommGroup E] [c : InnerProductSpace 𝕜 E] : PreInnerProductSpace.Core 𝕜 E := { c with nonneg_re := fun x => by rw [← InnerProductSpace.norm_sq_eq_inner] apply sq_nonneg } /-- Define `InnerProductSpace.Core` from `InnerProductSpace`. Defined to reuse lemmas about `InnerProductSpace.Core` for `InnerProductSpace`s. Note that the `Norm` instance provided by `InnerProductSpace.Core.norm` is propositionally but not definitionally equal to the original norm. -/ def InnerProductSpace.toCore [NormedAddCommGroup E] [c : InnerProductSpace 𝕜 E] : InnerProductSpace.Core 𝕜 E := { c with nonneg_re := fun x => by rw [← InnerProductSpace.norm_sq_eq_inner] apply sq_nonneg definite := fun x hx => norm_eq_zero.1 <| pow_eq_zero (n := 2) <| by rw [InnerProductSpace.norm_sq_eq_inner (𝕜 := 𝕜) x, hx, map_zero] } namespace InnerProductSpace.Core section PreInnerProductSpace.Core variable [AddCommGroup F] [Module 𝕜 F] [c : PreInnerProductSpace.Core 𝕜 F] local notation "⟪" x ", " y "⟫" => @inner 𝕜 F _ x y local notation "normSqK" => @RCLike.normSq 𝕜 _ local notation "reK" => @RCLike.re 𝕜 _ local notation "ext_iff" => @RCLike.ext_iff 𝕜 _ local postfix:90 "†" => starRingEnd _ /-- Inner product defined by the `PreInnerProductSpace.Core` structure. We can't reuse `PreInnerProductSpace.Core.toInner` because it takes `PreInnerProductSpace.Core` as an explicit argument. -/ def toPreInner' : Inner 𝕜 F := c.toInner attribute [local instance] toPreInner' /-- The norm squared function for `PreInnerProductSpace.Core` structure. -/ def normSq (x : F) := reK ⟪x, x⟫ local notation "normSqF" => @normSq 𝕜 F _ _ _ _ theorem inner_conj_symm (x y : F) : ⟪y, x⟫† = ⟪x, y⟫ := c.conj_symm x y theorem inner_self_nonneg {x : F} : 0 ≤ re ⟪x, x⟫ := c.nonneg_re _ theorem inner_self_im (x : F) : im ⟪x, x⟫ = 0 := by rw [← @ofReal_inj 𝕜, im_eq_conj_sub] simp [inner_conj_symm] theorem inner_add_left (x y z : F) : ⟪x + y, z⟫ = ⟪x, z⟫ + ⟪y, z⟫ := c.add_left _ _ _ theorem inner_add_right (x y z : F) : ⟪x, y + z⟫ = ⟪x, y⟫ + ⟪x, z⟫ := by rw [← inner_conj_symm, inner_add_left, RingHom.map_add]; simp only [inner_conj_symm] theorem ofReal_normSq_eq_inner_self (x : F) : (normSqF x : 𝕜) = ⟪x, x⟫ := by rw [ext_iff] exact ⟨by simp only [ofReal_re]; rfl, by simp only [inner_self_im, ofReal_im]⟩ theorem inner_re_symm (x y : F) : re ⟪x, y⟫ = re ⟪y, x⟫ := by rw [← inner_conj_symm, conj_re] theorem inner_im_symm (x y : F) : im ⟪x, y⟫ = -im ⟪y, x⟫ := by rw [← inner_conj_symm, conj_im] theorem inner_smul_left (x y : F) {r : 𝕜} : ⟪r • x, y⟫ = r† * ⟪x, y⟫ := c.smul_left _ _ _ theorem inner_smul_right (x y : F) {r : 𝕜} : ⟪x, r • y⟫ = r * ⟪x, y⟫ := by rw [← inner_conj_symm, inner_smul_left] simp only [conj_conj, inner_conj_symm, RingHom.map_mul] theorem inner_zero_left (x : F) : ⟪0, x⟫ = 0 := by rw [← zero_smul 𝕜 (0 : F), inner_smul_left] simp only [zero_mul, RingHom.map_zero] theorem inner_zero_right (x : F) : ⟪x, 0⟫ = 0 := by rw [← inner_conj_symm, inner_zero_left]; simp only [RingHom.map_zero] theorem inner_self_of_eq_zero {x : F} : x = 0 → ⟪x, x⟫ = 0 := by rintro rfl exact inner_zero_left _ theorem normSq_eq_zero_of_eq_zero {x : F} : x = 0 → normSqF x = 0 := by rintro rfl simp [normSq, inner_self_of_eq_zero] theorem ne_zero_of_inner_self_ne_zero {x : F} : ⟪x, x⟫ ≠ 0 → x ≠ 0 := mt inner_self_of_eq_zero theorem inner_self_ofReal_re (x : F) : (re ⟪x, x⟫ : 𝕜) = ⟪x, x⟫ := by norm_num [ext_iff, inner_self_im] theorem norm_inner_symm (x y : F) : ‖⟪x, y⟫‖ = ‖⟪y, x⟫‖ := by rw [← inner_conj_symm, norm_conj] theorem inner_neg_left (x y : F) : ⟪-x, y⟫ = -⟪x, y⟫ := by rw [← neg_one_smul 𝕜 x, inner_smul_left] simp theorem inner_neg_right (x y : F) : ⟪x, -y⟫ = -⟪x, y⟫ := by rw [← inner_conj_symm, inner_neg_left]; simp only [RingHom.map_neg, inner_conj_symm] theorem inner_sub_left (x y z : F) : ⟪x - y, z⟫ = ⟪x, z⟫ - ⟪y, z⟫ := by simp [sub_eq_add_neg, inner_add_left, inner_neg_left] theorem inner_sub_right (x y z : F) : ⟪x, y - z⟫ = ⟪x, y⟫ - ⟪x, z⟫ := by simp [sub_eq_add_neg, inner_add_right, inner_neg_right] theorem inner_mul_symm_re_eq_norm (x y : F) : re (⟪x, y⟫ * ⟪y, x⟫) = ‖⟪x, y⟫ * ⟪y, x⟫‖ := by rw [← inner_conj_symm, mul_comm] exact re_eq_norm_of_mul_conj (inner y x) /-- Expand `inner (x + y) (x + y)` -/ theorem inner_add_add_self (x y : F) : ⟪x + y, x + y⟫ = ⟪x, x⟫ + ⟪x, y⟫ + ⟪y, x⟫ + ⟪y, y⟫ := by simp only [inner_add_left, inner_add_right]; ring -- Expand `inner (x - y) (x - y)` theorem inner_sub_sub_self (x y : F) : ⟪x - y, x - y⟫ = ⟪x, x⟫ - ⟪x, y⟫ - ⟪y, x⟫ + ⟪y, y⟫ := by simp only [inner_sub_left, inner_sub_right]; ring theorem inner_smul_ofReal_left (x y : F) {t : ℝ} : ⟪(t : 𝕜) • x, y⟫ = ⟪x, y⟫ * t := by rw [inner_smul_left, conj_ofReal, mul_comm] theorem inner_smul_ofReal_right (x y : F) {t : ℝ} : ⟪x, (t : 𝕜) • y⟫ = ⟪x, y⟫ * t := by rw [inner_smul_right, mul_comm] theorem re_inner_smul_ofReal_smul_self (x : F) {t : ℝ} : re ⟪(t : 𝕜) • x, (t : 𝕜) • x⟫ = normSqF x * t * t := by apply ofReal_injective (K := 𝕜) simp [inner_self_ofReal_re, inner_smul_ofReal_left, inner_smul_ofReal_right, normSq] /-- An auxiliary equality useful to prove the **Cauchy–Schwarz inequality**. Here we use the standard argument involving the discriminant of quadratic form. -/ lemma cauchy_schwarz_aux' (x y : F) (t : ℝ) : 0 ≤ normSqF x * t * t + 2 * re ⟪x, y⟫ * t + normSqF y := by calc 0 ≤ re ⟪(ofReal t : 𝕜) • x + y, (ofReal t : 𝕜) • x + y⟫ := inner_self_nonneg _ = re (⟪(ofReal t : 𝕜) • x, (ofReal t : 𝕜) • x⟫ + ⟪(ofReal t : 𝕜) • x, y⟫ + ⟪y, (ofReal t : 𝕜) • x⟫ + ⟪y, y⟫) := by rw [inner_add_add_self ((ofReal t : 𝕜) • x) y] _ = re ⟪(ofReal t : 𝕜) • x, (ofReal t : 𝕜) • x⟫ + re ⟪(ofReal t : 𝕜) • x, y⟫ + re ⟪y, (ofReal t : 𝕜) • x⟫ + re ⟪y, y⟫ := by simp only [map_add] _ = normSq x * t * t + re (⟪x, y⟫ * t) + re (⟪y, x⟫ * t) + re ⟪y, y⟫ := by rw [re_inner_smul_ofReal_smul_self, inner_smul_ofReal_left, inner_smul_ofReal_right] _ = normSq x * t * t + re ⟪x, y⟫ * t + re ⟪y, x⟫ * t + re ⟪y, y⟫ := by rw [mul_comm ⟪x,y⟫ _, RCLike.re_ofReal_mul, mul_comm t _, mul_comm ⟪y,x⟫ _, RCLike.re_ofReal_mul, mul_comm t _] _ = normSq x * t * t + re ⟪x, y⟫ * t + re ⟪y, x⟫ * t + normSq y := by exact rfl _ = normSq x * t * t + re ⟪x, y⟫ * t + re ⟪x, y⟫ * t + normSq y := by rw [inner_re_symm] _ = normSq x * t * t + 2 * re ⟪x, y⟫ * t + normSq y := by ring /-- Another auxiliary equality related with the **Cauchy–Schwarz inequality**: the square of the seminorm of `⟪x, y⟫ • x - ⟪x, x⟫ • y` is equal to `‖x‖ ^ 2 * (‖x‖ ^ 2 * ‖y‖ ^ 2 - ‖⟪x, y⟫‖ ^ 2)`. We use `InnerProductSpace.ofCore.normSq x` etc (defeq to `is_R_or_C.re ⟪x, x⟫`) instead of `‖x‖ ^ 2` etc to avoid extra rewrites when applying it to an `InnerProductSpace`. -/ theorem cauchy_schwarz_aux (x y : F) : normSqF (⟪x, y⟫ • x - ⟪x, x⟫ • y) = normSqF x * (normSqF x * normSqF y - ‖⟪x, y⟫‖ ^ 2) := by rw [← @ofReal_inj 𝕜, ofReal_normSq_eq_inner_self] simp only [inner_sub_sub_self, inner_smul_left, inner_smul_right, conj_ofReal, mul_sub, ← ofReal_normSq_eq_inner_self x, ← ofReal_normSq_eq_inner_self y] rw [← mul_assoc, mul_conj, RCLike.conj_mul, mul_left_comm, ← inner_conj_symm y, mul_conj] push_cast ring /-- **Cauchy–Schwarz inequality**. We need this for the `PreInnerProductSpace.Core` structure to prove the triangle inequality below when showing the core is a normed group and to take the quotient. -/ theorem inner_mul_inner_self_le (x y : F) : ‖⟪x, y⟫‖ * ‖⟪y, x⟫‖ ≤ re ⟪x, x⟫ * re ⟪y, y⟫ := by suffices discrim (normSqF x) (2 * ‖⟪x, y⟫_𝕜‖) (normSqF y) ≤ 0 by rw [norm_inner_symm y x] rw [discrim, normSq, normSq, sq] at this linarith refine discrim_le_zero fun t ↦ ?_ by_cases hzero : ⟪x, y⟫ = 0 · simp only [mul_assoc, ← sq, hzero, norm_zero, mul_zero, zero_mul, add_zero, ge_iff_le] obtain ⟨hx, hy⟩ : (0 ≤ normSqF x ∧ 0 ≤ normSqF y) := ⟨inner_self_nonneg, inner_self_nonneg⟩ positivity · have hzero' : ‖⟪x, y⟫‖ ≠ 0 := norm_ne_zero_iff.2 hzero convert cauchy_schwarz_aux' (𝕜 := 𝕜) (⟪x, y⟫ • x) y (t / ‖⟪x, y⟫‖) using 3 · field_simp rw [← sq, normSq, normSq, inner_smul_right, inner_smul_left, ← mul_assoc _ _ ⟪x, x⟫, mul_conj] nth_rw 2 [sq] rw [← ofReal_mul, re_ofReal_mul] ring · field_simp rw [inner_smul_left, mul_comm _ ⟪x, y⟫_𝕜, mul_conj, ← ofReal_pow, ofReal_re] ring /-- (Semi)norm constructed from an `PreInnerProductSpace.Core` structure, defined to be the square root of the scalar product. -/ def toNorm : Norm F where norm x := √(re ⟪x, x⟫) attribute [local instance] toNorm theorem norm_eq_sqrt_inner (x : F) : ‖x‖ = √(re ⟪x, x⟫) := rfl theorem inner_self_eq_norm_mul_norm (x : F) : re ⟪x, x⟫ = ‖x‖ * ‖x‖ := by rw [norm_eq_sqrt_inner, ← sqrt_mul inner_self_nonneg (re ⟪x, x⟫), sqrt_mul_self inner_self_nonneg] theorem sqrt_normSq_eq_norm (x : F) : √(normSqF x) = ‖x‖ := rfl /-- Cauchy–Schwarz inequality with norm -/ theorem norm_inner_le_norm (x y : F) : ‖⟪x, y⟫‖ ≤ ‖x‖ * ‖y‖ := nonneg_le_nonneg_of_sq_le_sq (mul_nonneg (sqrt_nonneg _) (sqrt_nonneg _)) <| calc ‖⟪x, y⟫‖ * ‖⟪x, y⟫‖ = ‖⟪x, y⟫‖ * ‖⟪y, x⟫‖ := by rw [norm_inner_symm] _ ≤ re ⟪x, x⟫ * re ⟪y, y⟫ := inner_mul_inner_self_le x y _ = ‖x‖ * ‖y‖ * (‖x‖ * ‖y‖) := by simp only [inner_self_eq_norm_mul_norm]; ring /-- Seminormed group structure constructed from an `PreInnerProductSpace.Core` structure -/ def toSeminormedAddCommGroup : SeminormedAddCommGroup F := AddGroupSeminorm.toSeminormedAddCommGroup { toFun := fun x => √(re ⟪x, x⟫) map_zero' := by simp only [sqrt_zero, inner_zero_right, map_zero] neg' := fun x => by simp only [inner_neg_left, neg_neg, inner_neg_right] add_le' := fun x y => by have h₁ : ‖⟪x, y⟫‖ ≤ ‖x‖ * ‖y‖ := norm_inner_le_norm _ _ have h₂ : re ⟪x, y⟫ ≤ ‖⟪x, y⟫‖ := re_le_norm _ have h₃ : re ⟪x, y⟫ ≤ ‖x‖ * ‖y‖ := h₂.trans h₁ have h₄ : re ⟪y, x⟫ ≤ ‖x‖ * ‖y‖ := by rwa [← inner_conj_symm, conj_re] have : ‖x + y‖ * ‖x + y‖ ≤ (‖x‖ + ‖y‖) * (‖x‖ + ‖y‖) := by simp only [← inner_self_eq_norm_mul_norm, inner_add_add_self, mul_add, mul_comm, map_add] linarith exact nonneg_le_nonneg_of_sq_le_sq (add_nonneg (sqrt_nonneg _) (sqrt_nonneg _)) this } attribute [local instance] toSeminormedAddCommGroup /-- Normed space (which is actually a seminorm) structure constructed from an `PreInnerProductSpace.Core` structure -/ def toSeminormedSpace : NormedSpace 𝕜 F where norm_smul_le r x := by rw [norm_eq_sqrt_inner, inner_smul_left, inner_smul_right, ← mul_assoc] rw [RCLike.conj_mul, ← ofReal_pow, re_ofReal_mul, sqrt_mul, ← ofReal_normSq_eq_inner_self, ofReal_re] · simp [sqrt_normSq_eq_norm, RCLike.sqrt_normSq_eq_norm] · positivity end PreInnerProductSpace.Core section InnerProductSpace.Core variable [AddCommGroup F] [Module 𝕜 F] [cd : InnerProductSpace.Core 𝕜 F] local notation "⟪" x ", " y "⟫" => @inner 𝕜 F _ x y local notation "normSqK" => @RCLike.normSq 𝕜 _ local notation "reK" => @RCLike.re 𝕜 _ local notation "ext_iff" => @RCLike.ext_iff 𝕜 _ local postfix:90 "†" => starRingEnd _ /-- Inner product defined by the `InnerProductSpace.Core` structure. We can't reuse `InnerProductSpace.Core.toInner` because it takes `InnerProductSpace.Core` as an explicit argument. -/ def toInner' : Inner 𝕜 F := cd.toInner attribute [local instance] toInner' local notation "normSqF" => @normSq 𝕜 F _ _ _ _ theorem inner_self_eq_zero {x : F} : ⟪x, x⟫ = 0 ↔ x = 0 := ⟨cd.definite _, inner_self_of_eq_zero⟩ theorem normSq_eq_zero {x : F} : normSqF x = 0 ↔ x = 0 := Iff.trans (by simp only [normSq, ext_iff, map_zero, inner_self_im, eq_self_iff_true, and_true_iff]) (@inner_self_eq_zero 𝕜 _ _ _ _ _ x) theorem inner_self_ne_zero {x : F} : ⟪x, x⟫ ≠ 0 ↔ x ≠ 0 := inner_self_eq_zero.not attribute [local instance] toNorm /-- Normed group structure constructed from an `InnerProductSpace.Core` structure -/ def toNormedAddCommGroup : NormedAddCommGroup F := AddGroupNorm.toNormedAddCommGroup { toFun := fun x => √(re ⟪x, x⟫) map_zero' := by simp only [sqrt_zero, inner_zero_right, map_zero] neg' := fun x => by simp only [inner_neg_left, neg_neg, inner_neg_right] add_le' := fun x y => by have h₁ : ‖⟪x, y⟫‖ ≤ ‖x‖ * ‖y‖ := norm_inner_le_norm _ _ have h₂ : re ⟪x, y⟫ ≤ ‖⟪x, y⟫‖ := re_le_norm _ have h₃ : re ⟪x, y⟫ ≤ ‖x‖ * ‖y‖ := h₂.trans h₁ have h₄ : re ⟪y, x⟫ ≤ ‖x‖ * ‖y‖ := by rwa [← inner_conj_symm, conj_re] have : ‖x + y‖ * ‖x + y‖ ≤ (‖x‖ + ‖y‖) * (‖x‖ + ‖y‖) := by simp only [← inner_self_eq_norm_mul_norm, inner_add_add_self, mul_add, mul_comm, map_add] linarith exact nonneg_le_nonneg_of_sq_le_sq (add_nonneg (sqrt_nonneg _) (sqrt_nonneg _)) this eq_zero_of_map_eq_zero' := fun x hx => normSq_eq_zero.1 <| (sqrt_eq_zero inner_self_nonneg).1 hx } attribute [local instance] toNormedAddCommGroup /-- Normed space structure constructed from an `InnerProductSpace.Core` structure -/ def toNormedSpace : NormedSpace 𝕜 F where norm_smul_le r x := by rw [norm_eq_sqrt_inner, inner_smul_left, inner_smul_right, ← mul_assoc] rw [RCLike.conj_mul, ← ofReal_pow, re_ofReal_mul, sqrt_mul, ← ofReal_normSq_eq_inner_self, ofReal_re] · simp [sqrt_normSq_eq_norm, RCLike.sqrt_normSq_eq_norm] · positivity end InnerProductSpace.Core end InnerProductSpace.Core section attribute [local instance] InnerProductSpace.Core.toNormedAddCommGroup /-- Given an `InnerProductSpace.Core` structure on a space, one can use it to turn the space into an inner product space. The `NormedAddCommGroup` structure is expected to already be defined with `InnerProductSpace.ofCore.toNormedAddCommGroup`. -/ def InnerProductSpace.ofCore [AddCommGroup F] [Module 𝕜 F] (cd : InnerProductSpace.Core 𝕜 F) : InnerProductSpace 𝕜 F := letI : NormedSpace 𝕜 F := @InnerProductSpace.Core.toNormedSpace 𝕜 F _ _ _ cd { cd with norm_sq_eq_inner := fun x => by have h₁ : ‖x‖ ^ 2 = √(re (cd.inner x x)) ^ 2 := rfl have h₂ : 0 ≤ re (cd.inner x x) := InnerProductSpace.Core.inner_self_nonneg simp [h₁, sq_sqrt, h₂] } end /-! ### Properties of inner product spaces -/ section BasicProperties_Seminormed variable [SeminormedAddCommGroup E] [InnerProductSpace 𝕜 E] variable [SeminormedAddCommGroup F] [InnerProductSpace ℝ F] local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y local notation "IK" => @RCLike.I 𝕜 _ local postfix:90 "†" => starRingEnd _ export InnerProductSpace (norm_sq_eq_inner) @[simp] theorem inner_conj_symm (x y : E) : ⟪y, x⟫† = ⟪x, y⟫ := InnerProductSpace.conj_symm _ _ theorem real_inner_comm (x y : F) : ⟪y, x⟫_ℝ = ⟪x, y⟫_ℝ := @inner_conj_symm ℝ _ _ _ _ x y theorem inner_eq_zero_symm {x y : E} : ⟪x, y⟫ = 0 ↔ ⟪y, x⟫ = 0 := by rw [← inner_conj_symm] exact star_eq_zero @[simp] theorem inner_self_im (x : E) : im ⟪x, x⟫ = 0 := by rw [← @ofReal_inj 𝕜, im_eq_conj_sub]; simp theorem inner_add_left (x y z : E) : ⟪x + y, z⟫ = ⟪x, z⟫ + ⟪y, z⟫ := InnerProductSpace.add_left _ _ _ theorem inner_add_right (x y z : E) : ⟪x, y + z⟫ = ⟪x, y⟫ + ⟪x, z⟫ := by rw [← inner_conj_symm, inner_add_left, RingHom.map_add] simp only [inner_conj_symm] theorem inner_re_symm (x y : E) : re ⟪x, y⟫ = re ⟪y, x⟫ := by rw [← inner_conj_symm, conj_re] theorem inner_im_symm (x y : E) : im ⟪x, y⟫ = -im ⟪y, x⟫ := by rw [← inner_conj_symm, conj_im] theorem inner_smul_left (x y : E) (r : 𝕜) : ⟪r • x, y⟫ = r† * ⟪x, y⟫ := InnerProductSpace.smul_left _ _ _ theorem real_inner_smul_left (x y : F) (r : ℝ) : ⟪r • x, y⟫_ℝ = r * ⟪x, y⟫_ℝ := inner_smul_left _ _ _ theorem inner_smul_real_left (x y : E) (r : ℝ) : ⟪(r : 𝕜) • x, y⟫ = r • ⟪x, y⟫ := by rw [inner_smul_left, conj_ofReal, Algebra.smul_def] theorem inner_smul_right (x y : E) (r : 𝕜) : ⟪x, r • y⟫ = r * ⟪x, y⟫ := by rw [← inner_conj_symm, inner_smul_left, RingHom.map_mul, conj_conj, inner_conj_symm] theorem real_inner_smul_right (x y : F) (r : ℝ) : ⟪x, r • y⟫_ℝ = r * ⟪x, y⟫_ℝ := inner_smul_right _ _ _ theorem inner_smul_real_right (x y : E) (r : ℝ) : ⟪x, (r : 𝕜) • y⟫ = r • ⟪x, y⟫ := by rw [inner_smul_right, Algebra.smul_def] /-- The inner product as a sesquilinear form. Note that in the case `𝕜 = ℝ` this is a bilinear form. -/ @[simps!] def sesqFormOfInner : E →ₗ[𝕜] E →ₗ⋆[𝕜] 𝕜 := LinearMap.mk₂'ₛₗ (RingHom.id 𝕜) (starRingEnd _) (fun x y => ⟪y, x⟫) (fun _x _y _z => inner_add_right _ _ _) (fun _r _x _y => inner_smul_right _ _ _) (fun _x _y _z => inner_add_left _ _ _) fun _r _x _y => inner_smul_left _ _ _ /-- The real inner product as a bilinear form. Note that unlike `sesqFormOfInner`, this does not reverse the order of the arguments. -/ @[simps!] def bilinFormOfRealInner : BilinForm ℝ F := sesqFormOfInner.flip /-- An inner product with a sum on the left. -/ theorem sum_inner {ι : Type*} (s : Finset ι) (f : ι → E) (x : E) : ⟪∑ i ∈ s, f i, x⟫ = ∑ i ∈ s, ⟪f i, x⟫ := map_sum (sesqFormOfInner (𝕜 := 𝕜) (E := E) x) _ _ /-- An inner product with a sum on the right. -/ theorem inner_sum {ι : Type*} (s : Finset ι) (f : ι → E) (x : E) : ⟪x, ∑ i ∈ s, f i⟫ = ∑ i ∈ s, ⟪x, f i⟫ := map_sum (LinearMap.flip sesqFormOfInner x) _ _ /-- An inner product with a sum on the left, `Finsupp` version. -/ theorem Finsupp.sum_inner {ι : Type*} (l : ι →₀ 𝕜) (v : ι → E) (x : E) : ⟪l.sum fun (i : ι) (a : 𝕜) => a • v i, x⟫ = l.sum fun (i : ι) (a : 𝕜) => conj a • ⟪v i, x⟫ := by convert _root_.sum_inner (𝕜 := 𝕜) l.support (fun a => l a • v a) x simp only [inner_smul_left, Finsupp.sum, smul_eq_mul] /-- An inner product with a sum on the right, `Finsupp` version. -/ theorem Finsupp.inner_sum {ι : Type*} (l : ι →₀ 𝕜) (v : ι → E) (x : E) : ⟪x, l.sum fun (i : ι) (a : 𝕜) => a • v i⟫ = l.sum fun (i : ι) (a : 𝕜) => a • ⟪x, v i⟫ := by convert _root_.inner_sum (𝕜 := 𝕜) l.support (fun a => l a • v a) x simp only [inner_smul_right, Finsupp.sum, smul_eq_mul] theorem DFinsupp.sum_inner {ι : Type*} [DecidableEq ι] {α : ι → Type*} [∀ i, AddZeroClass (α i)] [∀ (i) (x : α i), Decidable (x ≠ 0)] (f : ∀ i, α i → E) (l : Π₀ i, α i) (x : E) : ⟪l.sum f, x⟫ = l.sum fun i a => ⟪f i a, x⟫ := by simp (config := { contextual := true }) only [DFinsupp.sum, _root_.sum_inner, smul_eq_mul] theorem DFinsupp.inner_sum {ι : Type*} [DecidableEq ι] {α : ι → Type*} [∀ i, AddZeroClass (α i)] [∀ (i) (x : α i), Decidable (x ≠ 0)] (f : ∀ i, α i → E) (l : Π₀ i, α i) (x : E) : ⟪x, l.sum f⟫ = l.sum fun i a => ⟪x, f i a⟫ := by simp (config := { contextual := true }) only [DFinsupp.sum, _root_.inner_sum, smul_eq_mul] @[simp] theorem inner_zero_left (x : E) : ⟪0, x⟫ = 0 := by rw [← zero_smul 𝕜 (0 : E), inner_smul_left, RingHom.map_zero, zero_mul] theorem inner_re_zero_left (x : E) : re ⟪0, x⟫ = 0 := by simp only [inner_zero_left, AddMonoidHom.map_zero] @[simp] theorem inner_zero_right (x : E) : ⟪x, 0⟫ = 0 := by rw [← inner_conj_symm, inner_zero_left, RingHom.map_zero] theorem inner_re_zero_right (x : E) : re ⟪x, 0⟫ = 0 := by simp only [inner_zero_right, AddMonoidHom.map_zero] theorem inner_self_nonneg {x : E} : 0 ≤ re ⟪x, x⟫ := PreInnerProductSpace.toCore.nonneg_re x theorem real_inner_self_nonneg {x : F} : 0 ≤ ⟪x, x⟫_ℝ := @inner_self_nonneg ℝ F _ _ _ x @[simp] theorem inner_self_ofReal_re (x : E) : (re ⟪x, x⟫ : 𝕜) = ⟪x, x⟫ := ((RCLike.is_real_TFAE (⟪x, x⟫ : 𝕜)).out 2 3).2 (inner_self_im _) theorem inner_self_eq_norm_sq_to_K (x : E) : ⟪x, x⟫ = (‖x‖ : 𝕜) ^ 2 := by rw [← inner_self_ofReal_re, ← norm_sq_eq_inner, ofReal_pow] theorem inner_self_re_eq_norm (x : E) : re ⟪x, x⟫ = ‖⟪x, x⟫‖ := by conv_rhs => rw [← inner_self_ofReal_re] symm exact norm_of_nonneg inner_self_nonneg theorem inner_self_ofReal_norm (x : E) : (‖⟪x, x⟫‖ : 𝕜) = ⟪x, x⟫ := by rw [← inner_self_re_eq_norm] exact inner_self_ofReal_re _ theorem real_inner_self_abs (x : F) : |⟪x, x⟫_ℝ| = ⟪x, x⟫_ℝ := @inner_self_ofReal_norm ℝ F _ _ _ x theorem norm_inner_symm (x y : E) : ‖⟪x, y⟫‖ = ‖⟪y, x⟫‖ := by rw [← inner_conj_symm, norm_conj] @[simp] theorem inner_neg_left (x y : E) : ⟪-x, y⟫ = -⟪x, y⟫ := by rw [← neg_one_smul 𝕜 x, inner_smul_left] simp @[simp] theorem inner_neg_right (x y : E) : ⟪x, -y⟫ = -⟪x, y⟫ := by rw [← inner_conj_symm, inner_neg_left]; simp only [RingHom.map_neg, inner_conj_symm] theorem inner_neg_neg (x y : E) : ⟪-x, -y⟫ = ⟪x, y⟫ := by simp -- Porting note: removed `simp` because it can prove it using `inner_conj_symm` theorem inner_self_conj (x : E) : ⟪x, x⟫† = ⟪x, x⟫ := inner_conj_symm _ _ theorem inner_sub_left (x y z : E) : ⟪x - y, z⟫ = ⟪x, z⟫ - ⟪y, z⟫ := by simp [sub_eq_add_neg, inner_add_left] theorem inner_sub_right (x y z : E) : ⟪x, y - z⟫ = ⟪x, y⟫ - ⟪x, z⟫ := by simp [sub_eq_add_neg, inner_add_right] theorem inner_mul_symm_re_eq_norm (x y : E) : re (⟪x, y⟫ * ⟪y, x⟫) = ‖⟪x, y⟫ * ⟪y, x⟫‖ := by rw [← inner_conj_symm, mul_comm] exact re_eq_norm_of_mul_conj (inner y x) /-- Expand `⟪x + y, x + y⟫` -/ theorem inner_add_add_self (x y : E) : ⟪x + y, x + y⟫ = ⟪x, x⟫ + ⟪x, y⟫ + ⟪y, x⟫ + ⟪y, y⟫ := by simp only [inner_add_left, inner_add_right]; ring /-- Expand `⟪x + y, x + y⟫_ℝ` -/ theorem real_inner_add_add_self (x y : F) : ⟪x + y, x + y⟫_ℝ = ⟪x, x⟫_ℝ + 2 * ⟪x, y⟫_ℝ + ⟪y, y⟫_ℝ := by have : ⟪y, x⟫_ℝ = ⟪x, y⟫_ℝ := by rw [← inner_conj_symm]; rfl simp only [inner_add_add_self, this, add_left_inj] ring -- Expand `⟪x - y, x - y⟫` theorem inner_sub_sub_self (x y : E) : ⟪x - y, x - y⟫ = ⟪x, x⟫ - ⟪x, y⟫ - ⟪y, x⟫ + ⟪y, y⟫ := by simp only [inner_sub_left, inner_sub_right]; ring /-- Expand `⟪x - y, x - y⟫_ℝ` -/ theorem real_inner_sub_sub_self (x y : F) : ⟪x - y, x - y⟫_ℝ = ⟪x, x⟫_ℝ - 2 * ⟪x, y⟫_ℝ + ⟪y, y⟫_ℝ := by have : ⟪y, x⟫_ℝ = ⟪x, y⟫_ℝ := by rw [← inner_conj_symm]; rfl simp only [inner_sub_sub_self, this, add_left_inj] ring /-- Parallelogram law -/ theorem parallelogram_law {x y : E} : ⟪x + y, x + y⟫ + ⟪x - y, x - y⟫ = 2 * (⟪x, x⟫ + ⟪y, y⟫) := by simp only [inner_add_add_self, inner_sub_sub_self] ring /-- **Cauchy–Schwarz inequality**. -/ theorem inner_mul_inner_self_le (x y : E) : ‖⟪x, y⟫‖ * ‖⟪y, x⟫‖ ≤ re ⟪x, x⟫ * re ⟪y, y⟫ := letI cd : PreInnerProductSpace.Core 𝕜 E := PreInnerProductSpace.toCore InnerProductSpace.Core.inner_mul_inner_self_le x y /-- Cauchy–Schwarz inequality for real inner products. -/ theorem real_inner_mul_inner_self_le (x y : F) : ⟪x, y⟫_ℝ * ⟪x, y⟫_ℝ ≤ ⟪x, x⟫_ℝ * ⟪y, y⟫_ℝ := calc ⟪x, y⟫_ℝ * ⟪x, y⟫_ℝ ≤ ‖⟪x, y⟫_ℝ‖ * ‖⟪y, x⟫_ℝ‖ := by rw [real_inner_comm y, ← norm_mul] exact le_abs_self _ _ ≤ ⟪x, x⟫_ℝ * ⟪y, y⟫_ℝ := @inner_mul_inner_self_le ℝ _ _ _ _ x y end BasicProperties_Seminormed section BasicProperties variable [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] variable [NormedAddCommGroup F] [InnerProductSpace ℝ F] local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y local notation "IK" => @RCLike.I 𝕜 _ local postfix:90 "†" => starRingEnd _ export InnerProductSpace (norm_sq_eq_inner) @[simp] theorem inner_self_eq_zero {x : E} : ⟪x, x⟫ = 0 ↔ x = 0 := by rw [inner_self_eq_norm_sq_to_K, sq_eq_zero_iff, ofReal_eq_zero, norm_eq_zero] theorem inner_self_ne_zero {x : E} : ⟪x, x⟫ ≠ 0 ↔ x ≠ 0 := inner_self_eq_zero.not variable (𝕜) theorem ext_inner_left {x y : E} (h : ∀ v, ⟪v, x⟫ = ⟪v, y⟫) : x = y := by rw [← sub_eq_zero, ← @inner_self_eq_zero 𝕜, inner_sub_right, sub_eq_zero, h (x - y)] theorem ext_inner_right {x y : E} (h : ∀ v, ⟪x, v⟫ = ⟪y, v⟫) : x = y := by rw [← sub_eq_zero, ← @inner_self_eq_zero 𝕜, inner_sub_left, sub_eq_zero, h (x - y)] variable {𝕜} @[simp] theorem inner_self_nonpos {x : E} : re ⟪x, x⟫ ≤ 0 ↔ x = 0 := by rw [← norm_sq_eq_inner, (sq_nonneg _).le_iff_eq, sq_eq_zero_iff, norm_eq_zero] theorem real_inner_self_nonpos {x : F} : ⟪x, x⟫_ℝ ≤ 0 ↔ x = 0 := @inner_self_nonpos ℝ F _ _ _ x /-- A family of vectors is linearly independent if they are nonzero and orthogonal. -/ theorem linearIndependent_of_ne_zero_of_inner_eq_zero {ι : Type*} {v : ι → E} (hz : ∀ i, v i ≠ 0) (ho : Pairwise fun i j => ⟪v i, v j⟫ = 0) : LinearIndependent 𝕜 v := by rw [linearIndependent_iff'] intro s g hg i hi have h' : g i * inner (v i) (v i) = inner (v i) (∑ j ∈ s, g j • v j) := by rw [inner_sum] symm convert Finset.sum_eq_single (β := 𝕜) i ?_ ?_ · rw [inner_smul_right] · intro j _hj hji rw [inner_smul_right, ho hji.symm, mul_zero] · exact fun h => False.elim (h hi) simpa [hg, hz] using h' end BasicProperties section OrthonormalSets_Seminormed variable [SeminormedAddCommGroup E] [InnerProductSpace 𝕜 E] variable [SeminormedAddCommGroup F] [InnerProductSpace ℝ F] local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y local notation "IK" => @RCLike.I 𝕜 _ local postfix:90 "†" => starRingEnd _ variable {ι : Type*} (𝕜) /-- An orthonormal set of vectors in an `InnerProductSpace` -/ def Orthonormal (v : ι → E) : Prop := (∀ i, ‖v i‖ = 1) ∧ Pairwise fun i j => ⟪v i, v j⟫ = 0 variable {𝕜} /-- `if ... then ... else` characterization of an indexed set of vectors being orthonormal. (Inner product equals Kronecker delta.) -/ theorem orthonormal_iff_ite [DecidableEq ι] {v : ι → E} : Orthonormal 𝕜 v ↔ ∀ i j, ⟪v i, v j⟫ = if i = j then (1 : 𝕜) else (0 : 𝕜) := by constructor · intro hv i j split_ifs with h · simp [h, inner_self_eq_norm_sq_to_K, hv.1] · exact hv.2 h · intro h constructor · intro i have h' : ‖v i‖ ^ 2 = 1 ^ 2 := by simp [@norm_sq_eq_inner 𝕜, h i i] have h₁ : 0 ≤ ‖v i‖ := norm_nonneg _ have h₂ : (0 : ℝ) ≤ 1 := zero_le_one rwa [sq_eq_sq h₁ h₂] at h' · intro i j hij simpa [hij] using h i j /-- `if ... then ... else` characterization of a set of vectors being orthonormal. (Inner product equals Kronecker delta.) -/ theorem orthonormal_subtype_iff_ite [DecidableEq E] {s : Set E} : Orthonormal 𝕜 (Subtype.val : s → E) ↔ ∀ v ∈ s, ∀ w ∈ s, ⟪v, w⟫ = if v = w then 1 else 0 := by rw [orthonormal_iff_ite] constructor · intro h v hv w hw convert h ⟨v, hv⟩ ⟨w, hw⟩ using 1 simp · rintro h ⟨v, hv⟩ ⟨w, hw⟩ convert h v hv w hw using 1 simp /-- The inner product of a linear combination of a set of orthonormal vectors with one of those vectors picks out the coefficient of that vector. -/ theorem Orthonormal.inner_right_finsupp {v : ι → E} (hv : Orthonormal 𝕜 v) (l : ι →₀ 𝕜) (i : ι) : ⟪v i, Finsupp.total ι E 𝕜 v l⟫ = l i := by classical simpa [Finsupp.total_apply, Finsupp.inner_sum, orthonormal_iff_ite.mp hv] using Eq.symm /-- The inner product of a linear combination of a set of orthonormal vectors with one of those vectors picks out the coefficient of that vector. -/ theorem Orthonormal.inner_right_sum {v : ι → E} (hv : Orthonormal 𝕜 v) (l : ι → 𝕜) {s : Finset ι} {i : ι} (hi : i ∈ s) : ⟪v i, ∑ i ∈ s, l i • v i⟫ = l i := by classical simp [inner_sum, inner_smul_right, orthonormal_iff_ite.mp hv, hi] /-- The inner product of a linear combination of a set of orthonormal vectors with one of those vectors picks out the coefficient of that vector. -/ theorem Orthonormal.inner_right_fintype [Fintype ι] {v : ι → E} (hv : Orthonormal 𝕜 v) (l : ι → 𝕜) (i : ι) : ⟪v i, ∑ i : ι, l i • v i⟫ = l i := hv.inner_right_sum l (Finset.mem_univ _) /-- The inner product of a linear combination of a set of orthonormal vectors with one of those vectors picks out the coefficient of that vector. -/ theorem Orthonormal.inner_left_finsupp {v : ι → E} (hv : Orthonormal 𝕜 v) (l : ι →₀ 𝕜) (i : ι) : ⟪Finsupp.total ι E 𝕜 v l, v i⟫ = conj (l i) := by rw [← inner_conj_symm, hv.inner_right_finsupp] /-- The inner product of a linear combination of a set of orthonormal vectors with one of those vectors picks out the coefficient of that vector. -/ theorem Orthonormal.inner_left_sum {v : ι → E} (hv : Orthonormal 𝕜 v) (l : ι → 𝕜) {s : Finset ι} {i : ι} (hi : i ∈ s) : ⟪∑ i ∈ s, l i • v i, v i⟫ = conj (l i) := by classical simp only [sum_inner, inner_smul_left, orthonormal_iff_ite.mp hv, hi, mul_boole, Finset.sum_ite_eq', if_true] /-- The inner product of a linear combination of a set of orthonormal vectors with one of those vectors picks out the coefficient of that vector. -/ theorem Orthonormal.inner_left_fintype [Fintype ι] {v : ι → E} (hv : Orthonormal 𝕜 v) (l : ι → 𝕜) (i : ι) : ⟪∑ i : ι, l i • v i, v i⟫ = conj (l i) := hv.inner_left_sum l (Finset.mem_univ _) /-- The inner product of two linear combinations of a set of orthonormal vectors, expressed as a sum over the first `Finsupp`. -/ theorem Orthonormal.inner_finsupp_eq_sum_left {v : ι → E} (hv : Orthonormal 𝕜 v) (l₁ l₂ : ι →₀ 𝕜) : ⟪Finsupp.total ι E 𝕜 v l₁, Finsupp.total ι E 𝕜 v l₂⟫ = l₁.sum fun i y => conj y * l₂ i := by simp only [l₁.total_apply _, Finsupp.sum_inner, hv.inner_right_finsupp, smul_eq_mul] /-- The inner product of two linear combinations of a set of orthonormal vectors, expressed as a sum over the second `Finsupp`. -/ theorem Orthonormal.inner_finsupp_eq_sum_right {v : ι → E} (hv : Orthonormal 𝕜 v) (l₁ l₂ : ι →₀ 𝕜) : ⟪Finsupp.total ι E 𝕜 v l₁, Finsupp.total ι E 𝕜 v l₂⟫ = l₂.sum fun i y => conj (l₁ i) * y := by simp only [l₂.total_apply _, Finsupp.inner_sum, hv.inner_left_finsupp, mul_comm, smul_eq_mul] /-- The inner product of two linear combinations of a set of orthonormal vectors, expressed as a sum. -/ theorem Orthonormal.inner_sum {v : ι → E} (hv : Orthonormal 𝕜 v) (l₁ l₂ : ι → 𝕜) (s : Finset ι) : ⟪∑ i ∈ s, l₁ i • v i, ∑ i ∈ s, l₂ i • v i⟫ = ∑ i ∈ s, conj (l₁ i) * l₂ i := by simp_rw [sum_inner, inner_smul_left] refine Finset.sum_congr rfl fun i hi => ?_ rw [hv.inner_right_sum l₂ hi] /-- The double sum of weighted inner products of pairs of vectors from an orthonormal sequence is the sum of the weights. -/ theorem Orthonormal.inner_left_right_finset {s : Finset ι} {v : ι → E} (hv : Orthonormal 𝕜 v) {a : ι → ι → 𝕜} : (∑ i ∈ s, ∑ j ∈ s, a i j • ⟪v j, v i⟫) = ∑ k ∈ s, a k k := by classical simp [orthonormal_iff_ite.mp hv, Finset.sum_ite_of_true] /-- An orthonormal set is linearly independent. -/ theorem Orthonormal.linearIndependent {v : ι → E} (hv : Orthonormal 𝕜 v) : LinearIndependent 𝕜 v := by rw [linearIndependent_iff] intro l hl ext i have key : ⟪v i, Finsupp.total ι E 𝕜 v l⟫ = ⟪v i, 0⟫ := by rw [hl] simpa only [hv.inner_right_finsupp, inner_zero_right] using key /-- A subfamily of an orthonormal family (i.e., a composition with an injective map) is an orthonormal family. -/ theorem Orthonormal.comp {ι' : Type*} {v : ι → E} (hv : Orthonormal 𝕜 v) (f : ι' → ι) (hf : Function.Injective f) : Orthonormal 𝕜 (v ∘ f) := by classical rw [orthonormal_iff_ite] at hv ⊢ intro i j convert hv (f i) (f j) using 1 simp [hf.eq_iff] /-- An injective family `v : ι → E` is orthonormal if and only if `Subtype.val : (range v) → E` is orthonormal. -/ theorem orthonormal_subtype_range {v : ι → E} (hv : Function.Injective v) : Orthonormal 𝕜 (Subtype.val : Set.range v → E) ↔ Orthonormal 𝕜 v := by let f : ι ≃ Set.range v := Equiv.ofInjective v hv refine ⟨fun h => h.comp f f.injective, fun h => ?_⟩ rw [← Equiv.self_comp_ofInjective_symm hv] exact h.comp f.symm f.symm.injective /-- If `v : ι → E` is an orthonormal family, then `Subtype.val : (range v) → E` is an orthonormal family. -/ theorem Orthonormal.toSubtypeRange {v : ι → E} (hv : Orthonormal 𝕜 v) : Orthonormal 𝕜 (Subtype.val : Set.range v → E) := (orthonormal_subtype_range hv.linearIndependent.injective).2 hv /-- A linear combination of some subset of an orthonormal set is orthogonal to other members of the set. -/ theorem Orthonormal.inner_finsupp_eq_zero {v : ι → E} (hv : Orthonormal 𝕜 v) {s : Set ι} {i : ι} (hi : i ∉ s) {l : ι →₀ 𝕜} (hl : l ∈ Finsupp.supported 𝕜 𝕜 s) : ⟪Finsupp.total ι E 𝕜 v l, v i⟫ = 0 := by rw [Finsupp.mem_supported'] at hl simp only [hv.inner_left_finsupp, hl i hi, map_zero] /-- Given an orthonormal family, a second family of vectors is orthonormal if every vector equals the corresponding vector in the original family or its negation. -/ theorem Orthonormal.orthonormal_of_forall_eq_or_eq_neg {v w : ι → E} (hv : Orthonormal 𝕜 v) (hw : ∀ i, w i = v i ∨ w i = -v i) : Orthonormal 𝕜 w := by classical rw [orthonormal_iff_ite] at * intro i j cases' hw i with hi hi <;> cases' hw j with hj hj <;> replace hv := hv i j <;> split_ifs at hv ⊢ with h <;> simpa only [hi, hj, h, inner_neg_right, inner_neg_left, neg_neg, eq_self_iff_true, neg_eq_zero] using hv /- The material that follows, culminating in the existence of a maximal orthonormal subset, is adapted from the corresponding development of the theory of linearly independents sets. See `exists_linearIndependent` in particular. -/ variable (𝕜 E) theorem orthonormal_empty : Orthonormal 𝕜 (fun x => x : (∅ : Set E) → E) := by classical simp [orthonormal_subtype_iff_ite] variable {𝕜 E} theorem orthonormal_iUnion_of_directed {η : Type*} {s : η → Set E} (hs : Directed (· ⊆ ·) s) (h : ∀ i, Orthonormal 𝕜 (fun x => x : s i → E)) : Orthonormal 𝕜 (fun x => x : (⋃ i, s i) → E) := by classical rw [orthonormal_subtype_iff_ite] rintro x ⟨_, ⟨i, rfl⟩, hxi⟩ y ⟨_, ⟨j, rfl⟩, hyj⟩ obtain ⟨k, hik, hjk⟩ := hs i j have h_orth : Orthonormal 𝕜 (fun x => x : s k → E) := h k rw [orthonormal_subtype_iff_ite] at h_orth exact h_orth x (hik hxi) y (hjk hyj) theorem orthonormal_sUnion_of_directed {s : Set (Set E)} (hs : DirectedOn (· ⊆ ·) s) (h : ∀ a ∈ s, Orthonormal 𝕜 (fun x => ((x : a) : E))) : Orthonormal 𝕜 (fun x => x : ⋃₀ s → E) := by rw [Set.sUnion_eq_iUnion]; exact orthonormal_iUnion_of_directed hs.directed_val (by simpa using h) /-- Given an orthonormal set `v` of vectors in `E`, there exists a maximal orthonormal set containing it. -/ theorem exists_maximal_orthonormal {s : Set E} (hs : Orthonormal 𝕜 (Subtype.val : s → E)) : ∃ w ⊇ s, Orthonormal 𝕜 (Subtype.val : w → E) ∧ ∀ u ⊇ w, Orthonormal 𝕜 (Subtype.val : u → E) → u = w := by have := zorn_subset_nonempty { b | Orthonormal 𝕜 (Subtype.val : b → E) } ?_ _ hs · obtain ⟨b, bi, sb, h⟩ := this refine ⟨b, sb, bi, ?_⟩ exact fun u hus hu => h u hu hus · refine fun c hc cc _c0 => ⟨⋃₀ c, ?_, ?_⟩ · exact orthonormal_sUnion_of_directed cc.directedOn fun x xc => hc xc · exact fun _ => Set.subset_sUnion_of_mem open FiniteDimensional /-- A family of orthonormal vectors with the correct cardinality forms a basis. -/ def basisOfOrthonormalOfCardEqFinrank [Fintype ι] [Nonempty ι] {v : ι → E} (hv : Orthonormal 𝕜 v) (card_eq : Fintype.card ι = finrank 𝕜 E) : Basis ι 𝕜 E := basisOfLinearIndependentOfCardEqFinrank hv.linearIndependent card_eq @[simp] theorem coe_basisOfOrthonormalOfCardEqFinrank [Fintype ι] [Nonempty ι] {v : ι → E} (hv : Orthonormal 𝕜 v) (card_eq : Fintype.card ι = finrank 𝕜 E) : (basisOfOrthonormalOfCardEqFinrank hv card_eq : ι → E) = v := coe_basisOfLinearIndependentOfCardEqFinrank _ _ end OrthonormalSets_Seminormed section OrthonormalSets variable [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] variable [NormedAddCommGroup F] [InnerProductSpace ℝ F] variable {ι : Type*} local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y local notation "IK" => @RCLike.I 𝕜 _ local postfix:90 "†" => starRingEnd _ theorem Orthonormal.ne_zero {v : ι → E} (hv : Orthonormal 𝕜 v) (i : ι) : v i ≠ 0 := by have : ‖v i‖ ≠ 0 := by rw [hv.1 i] norm_num simpa using this end OrthonormalSets section Norm_Seminormed variable [SeminormedAddCommGroup E] [InnerProductSpace 𝕜 E] variable [SeminormedAddCommGroup F] [InnerProductSpace ℝ F] local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y local notation "IK" => @RCLike.I 𝕜 _ local postfix:90 "†" => starRingEnd _ theorem norm_eq_sqrt_inner (x : E) : ‖x‖ = √(re ⟪x, x⟫) := calc ‖x‖ = √(‖x‖ ^ 2) := (sqrt_sq (norm_nonneg _)).symm _ = √(re ⟪x, x⟫) := congr_arg _ (norm_sq_eq_inner _) theorem norm_eq_sqrt_real_inner (x : F) : ‖x‖ = √⟪x, x⟫_ℝ := @norm_eq_sqrt_inner ℝ _ _ _ _ x theorem inner_self_eq_norm_mul_norm (x : E) : re ⟪x, x⟫ = ‖x‖ * ‖x‖ := by rw [@norm_eq_sqrt_inner 𝕜, ← sqrt_mul inner_self_nonneg (re ⟪x, x⟫), sqrt_mul_self inner_self_nonneg] theorem inner_self_eq_norm_sq (x : E) : re ⟪x, x⟫ = ‖x‖ ^ 2 := by rw [pow_two, inner_self_eq_norm_mul_norm] theorem real_inner_self_eq_norm_mul_norm (x : F) : ⟪x, x⟫_ℝ = ‖x‖ * ‖x‖ := by have h := @inner_self_eq_norm_mul_norm ℝ F _ _ _ x simpa using h theorem real_inner_self_eq_norm_sq (x : F) : ⟪x, x⟫_ℝ = ‖x‖ ^ 2 := by rw [pow_two, real_inner_self_eq_norm_mul_norm] -- Porting note: this was present in mathlib3 but seemingly didn't do anything. -- variable (𝕜) /-- Expand the square -/ theorem norm_add_sq (x y : E) : ‖x + y‖ ^ 2 = ‖x‖ ^ 2 + 2 * re ⟪x, y⟫ + ‖y‖ ^ 2 := by repeat' rw [sq (M := ℝ), ← @inner_self_eq_norm_mul_norm 𝕜] rw [inner_add_add_self, two_mul] simp only [add_assoc, add_left_inj, add_right_inj, AddMonoidHom.map_add] rw [← inner_conj_symm, conj_re] alias norm_add_pow_two := norm_add_sq /-- Expand the square -/ theorem norm_add_sq_real (x y : F) : ‖x + y‖ ^ 2 = ‖x‖ ^ 2 + 2 * ⟪x, y⟫_ℝ + ‖y‖ ^ 2 := by have h := @norm_add_sq ℝ _ _ _ _ x y simpa using h alias norm_add_pow_two_real := norm_add_sq_real /-- Expand the square -/ theorem norm_add_mul_self (x y : E) : ‖x + y‖ * ‖x + y‖ = ‖x‖ * ‖x‖ + 2 * re ⟪x, y⟫ + ‖y‖ * ‖y‖ := by repeat' rw [← sq (M := ℝ)] exact norm_add_sq _ _ /-- Expand the square -/ theorem norm_add_mul_self_real (x y : F) : ‖x + y‖ * ‖x + y‖ = ‖x‖ * ‖x‖ + 2 * ⟪x, y⟫_ℝ + ‖y‖ * ‖y‖ := by have h := @norm_add_mul_self ℝ _ _ _ _ x y simpa using h /-- Expand the square -/ theorem norm_sub_sq (x y : E) : ‖x - y‖ ^ 2 = ‖x‖ ^ 2 - 2 * re ⟪x, y⟫ + ‖y‖ ^ 2 := by rw [sub_eq_add_neg, @norm_add_sq 𝕜 _ _ _ _ x (-y), norm_neg, inner_neg_right, map_neg, mul_neg, sub_eq_add_neg] alias norm_sub_pow_two := norm_sub_sq /-- Expand the square -/ theorem norm_sub_sq_real (x y : F) : ‖x - y‖ ^ 2 = ‖x‖ ^ 2 - 2 * ⟪x, y⟫_ℝ + ‖y‖ ^ 2 := @norm_sub_sq ℝ _ _ _ _ _ _ alias norm_sub_pow_two_real := norm_sub_sq_real /-- Expand the square -/ theorem norm_sub_mul_self (x y : E) : ‖x - y‖ * ‖x - y‖ = ‖x‖ * ‖x‖ - 2 * re ⟪x, y⟫ + ‖y‖ * ‖y‖ := by repeat' rw [← sq (M := ℝ)] exact norm_sub_sq _ _ /-- Expand the square -/ theorem norm_sub_mul_self_real (x y : F) : ‖x - y‖ * ‖x - y‖ = ‖x‖ * ‖x‖ - 2 * ⟪x, y⟫_ℝ + ‖y‖ * ‖y‖ := by have h := @norm_sub_mul_self ℝ _ _ _ _ x y simpa using h /-- Cauchy–Schwarz inequality with norm -/ theorem norm_inner_le_norm (x y : E) : ‖⟪x, y⟫‖ ≤ ‖x‖ * ‖y‖ := by rw [norm_eq_sqrt_inner (𝕜 := 𝕜) x, norm_eq_sqrt_inner (𝕜 := 𝕜) y] letI : PreInnerProductSpace.Core 𝕜 E := PreInnerProductSpace.toCore exact InnerProductSpace.Core.norm_inner_le_norm x y theorem nnnorm_inner_le_nnnorm (x y : E) : ‖⟪x, y⟫‖₊ ≤ ‖x‖₊ * ‖y‖₊ := norm_inner_le_norm x y theorem re_inner_le_norm (x y : E) : re ⟪x, y⟫ ≤ ‖x‖ * ‖y‖ := le_trans (re_le_norm (inner x y)) (norm_inner_le_norm x y) /-- Cauchy–Schwarz inequality with norm -/ theorem abs_real_inner_le_norm (x y : F) : |⟪x, y⟫_ℝ| ≤ ‖x‖ * ‖y‖ := (Real.norm_eq_abs _).ge.trans (norm_inner_le_norm x y) /-- Cauchy–Schwarz inequality with norm -/ theorem real_inner_le_norm (x y : F) : ⟪x, y⟫_ℝ ≤ ‖x‖ * ‖y‖ := le_trans (le_abs_self _) (abs_real_inner_le_norm _ _) variable (𝕜) theorem parallelogram_law_with_norm (x y : E) : ‖x + y‖ * ‖x + y‖ + ‖x - y‖ * ‖x - y‖ = 2 * (‖x‖ * ‖x‖ + ‖y‖ * ‖y‖) := by simp only [← @inner_self_eq_norm_mul_norm 𝕜] rw [← re.map_add, parallelogram_law, two_mul, two_mul] simp only [re.map_add] theorem parallelogram_law_with_nnnorm (x y : E) : ‖x + y‖₊ * ‖x + y‖₊ + ‖x - y‖₊ * ‖x - y‖₊ = 2 * (‖x‖₊ * ‖x‖₊ + ‖y‖₊ * ‖y‖₊) := Subtype.ext <| parallelogram_law_with_norm 𝕜 x y variable {𝕜} /-- Polarization identity: The real part of the inner product, in terms of the norm. -/ theorem re_inner_eq_norm_add_mul_self_sub_norm_mul_self_sub_norm_mul_self_div_two (x y : E) : re ⟪x, y⟫ = (‖x + y‖ * ‖x + y‖ - ‖x‖ * ‖x‖ - ‖y‖ * ‖y‖) / 2 := by rw [@norm_add_mul_self 𝕜] ring /-- Polarization identity: The real part of the inner product, in terms of the norm. -/ theorem re_inner_eq_norm_mul_self_add_norm_mul_self_sub_norm_sub_mul_self_div_two (x y : E) : re ⟪x, y⟫ = (‖x‖ * ‖x‖ + ‖y‖ * ‖y‖ - ‖x - y‖ * ‖x - y‖) / 2 := by rw [@norm_sub_mul_self 𝕜] ring /-- Polarization identity: The real part of the inner product, in terms of the norm. -/ theorem re_inner_eq_norm_add_mul_self_sub_norm_sub_mul_self_div_four (x y : E) : re ⟪x, y⟫ = (‖x + y‖ * ‖x + y‖ - ‖x - y‖ * ‖x - y‖) / 4 := by rw [@norm_add_mul_self 𝕜, @norm_sub_mul_self 𝕜] ring /-- Polarization identity: The imaginary part of the inner product, in terms of the norm. -/ theorem im_inner_eq_norm_sub_i_smul_mul_self_sub_norm_add_i_smul_mul_self_div_four (x y : E) : im ⟪x, y⟫ = (‖x - IK • y‖ * ‖x - IK • y‖ - ‖x + IK • y‖ * ‖x + IK • y‖) / 4 := by simp only [@norm_add_mul_self 𝕜, @norm_sub_mul_self 𝕜, inner_smul_right, I_mul_re] ring /-- Polarization identity: The inner product, in terms of the norm. -/ theorem inner_eq_sum_norm_sq_div_four (x y : E) : ⟪x, y⟫ = ((‖x + y‖ : 𝕜) ^ 2 - (‖x - y‖ : 𝕜) ^ 2 + ((‖x - IK • y‖ : 𝕜) ^ 2 - (‖x + IK • y‖ : 𝕜) ^ 2) * IK) / 4 := by rw [← re_add_im ⟪x, y⟫, re_inner_eq_norm_add_mul_self_sub_norm_sub_mul_self_div_four, im_inner_eq_norm_sub_i_smul_mul_self_sub_norm_add_i_smul_mul_self_div_four] push_cast simp only [sq, ← mul_div_right_comm, ← add_div] -- See note [lower instance priority] instance (priority := 100) InnerProductSpace.toUniformConvexSpace : UniformConvexSpace F := ⟨fun ε hε => by refine ⟨2 - √(4 - ε ^ 2), sub_pos_of_lt <| (sqrt_lt' zero_lt_two).2 ?_, fun x hx y hy hxy => ?_⟩ · norm_num exact pow_pos hε _ rw [sub_sub_cancel] refine le_sqrt_of_sq_le ?_ rw [sq, eq_sub_iff_add_eq.2 (parallelogram_law_with_norm ℝ x y), ← sq ‖x - y‖, hx, hy] ring_nf exact sub_le_sub_left (pow_le_pow_left hε.le hxy _) 4⟩ section Complex variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V] /-- A complex polarization identity, with a linear map -/ theorem inner_map_polarization (T : V →ₗ[ℂ] V) (x y : V) : ⟪T y, x⟫_ℂ = (⟪T (x + y), x + y⟫_ℂ - ⟪T (x - y), x - y⟫_ℂ + Complex.I * ⟪T (x + Complex.I • y), x + Complex.I • y⟫_ℂ - Complex.I * ⟪T (x - Complex.I • y), x - Complex.I • y⟫_ℂ) / 4 := by simp only [map_add, map_sub, inner_add_left, inner_add_right, LinearMap.map_smul, inner_smul_left, inner_smul_right, Complex.conj_I, ← pow_two, Complex.I_sq, inner_sub_left, inner_sub_right, mul_add, ← mul_assoc, mul_neg, neg_neg, sub_neg_eq_add, one_mul, neg_one_mul, mul_sub, sub_sub] ring theorem inner_map_polarization' (T : V →ₗ[ℂ] V) (x y : V) : ⟪T x, y⟫_ℂ = (⟪T (x + y), x + y⟫_ℂ - ⟪T (x - y), x - y⟫_ℂ - Complex.I * ⟪T (x + Complex.I • y), x + Complex.I • y⟫_ℂ + Complex.I * ⟪T (x - Complex.I • y), x - Complex.I • y⟫_ℂ) / 4 := by simp only [map_add, map_sub, inner_add_left, inner_add_right, LinearMap.map_smul, inner_smul_left, inner_smul_right, Complex.conj_I, ← pow_two, Complex.I_sq, inner_sub_left, inner_sub_right, mul_add, ← mul_assoc, mul_neg, neg_neg, sub_neg_eq_add, one_mul, neg_one_mul, mul_sub, sub_sub] ring /-- A linear map `T` is zero, if and only if the identity `⟪T x, x⟫_ℂ = 0` holds for all `x`. -/ theorem inner_map_self_eq_zero (T : V →ₗ[ℂ] V) : (∀ x : V, ⟪T x, x⟫_ℂ = 0) ↔ T = 0 := by constructor · intro hT ext x rw [LinearMap.zero_apply, ← @inner_self_eq_zero ℂ V, inner_map_polarization] simp only [hT] norm_num · rintro rfl x simp only [LinearMap.zero_apply, inner_zero_left] /-- Two linear maps `S` and `T` are equal, if and only if the identity `⟪S x, x⟫_ℂ = ⟪T x, x⟫_ℂ` holds for all `x`. -/ theorem ext_inner_map (S T : V →ₗ[ℂ] V) : (∀ x : V, ⟪S x, x⟫_ℂ = ⟪T x, x⟫_ℂ) ↔ S = T := by rw [← sub_eq_zero, ← inner_map_self_eq_zero] refine forall_congr' fun x => ?_ rw [LinearMap.sub_apply, inner_sub_left, sub_eq_zero] end Complex section variable {ι : Type*} {ι' : Type*} {ι'' : Type*} variable {E' : Type*} [SeminormedAddCommGroup E'] [InnerProductSpace 𝕜 E'] variable {E'' : Type*} [SeminormedAddCommGroup E''] [InnerProductSpace 𝕜 E''] /-- A linear isometry preserves the inner product. -/ @[simp] theorem LinearIsometry.inner_map_map (f : E →ₗᵢ[𝕜] E') (x y : E) : ⟪f x, f y⟫ = ⟪x, y⟫ := by simp [inner_eq_sum_norm_sq_div_four, ← f.norm_map] /-- A linear isometric equivalence preserves the inner product. -/ @[simp] theorem LinearIsometryEquiv.inner_map_map (f : E ≃ₗᵢ[𝕜] E') (x y : E) : ⟪f x, f y⟫ = ⟪x, y⟫ := f.toLinearIsometry.inner_map_map x y /-- The adjoint of a linear isometric equivalence is its inverse. -/ theorem LinearIsometryEquiv.inner_map_eq_flip (f : E ≃ₗᵢ[𝕜] E') (x : E) (y : E') : ⟪f x, y⟫_𝕜 = ⟪x, f.symm y⟫_𝕜 := by conv_lhs => rw [← f.apply_symm_apply y, f.inner_map_map] /-- A linear map that preserves the inner product is a linear isometry. -/ def LinearMap.isometryOfInner (f : E →ₗ[𝕜] E') (h : ∀ x y, ⟪f x, f y⟫ = ⟪x, y⟫) : E →ₗᵢ[𝕜] E' := ⟨f, fun x => by simp only [@norm_eq_sqrt_inner 𝕜, h]⟩ @[simp] theorem LinearMap.coe_isometryOfInner (f : E →ₗ[𝕜] E') (h) : ⇑(f.isometryOfInner h) = f := rfl @[simp] theorem LinearMap.isometryOfInner_toLinearMap (f : E →ₗ[𝕜] E') (h) : (f.isometryOfInner h).toLinearMap = f := rfl /-- A linear equivalence that preserves the inner product is a linear isometric equivalence. -/ def LinearEquiv.isometryOfInner (f : E ≃ₗ[𝕜] E') (h : ∀ x y, ⟪f x, f y⟫ = ⟪x, y⟫) : E ≃ₗᵢ[𝕜] E' := ⟨f, ((f : E →ₗ[𝕜] E').isometryOfInner h).norm_map⟩ @[simp] theorem LinearEquiv.coe_isometryOfInner (f : E ≃ₗ[𝕜] E') (h) : ⇑(f.isometryOfInner h) = f := rfl @[simp] theorem LinearEquiv.isometryOfInner_toLinearEquiv (f : E ≃ₗ[𝕜] E') (h) : (f.isometryOfInner h).toLinearEquiv = f := rfl /-- A linear map is an isometry if and it preserves the inner product. -/ theorem LinearMap.norm_map_iff_inner_map_map {F : Type*} [FunLike F E E'] [LinearMapClass F 𝕜 E E'] (f : F) : (∀ x, ‖f x‖ = ‖x‖) ↔ (∀ x y, ⟪f x, f y⟫_𝕜 = ⟪x, y⟫_𝕜) := ⟨({ toLinearMap := LinearMapClass.linearMap f, norm_map' := · : E →ₗᵢ[𝕜] E' }.inner_map_map), (LinearMapClass.linearMap f |>.isometryOfInner · |>.norm_map)⟩ /-- A linear isometry preserves the property of being orthonormal. -/ theorem LinearIsometry.orthonormal_comp_iff {v : ι → E} (f : E →ₗᵢ[𝕜] E') : Orthonormal 𝕜 (f ∘ v) ↔ Orthonormal 𝕜 v := by classical simp_rw [orthonormal_iff_ite, Function.comp_apply, LinearIsometry.inner_map_map] /-- A linear isometry preserves the property of being orthonormal. -/ theorem Orthonormal.comp_linearIsometry {v : ι → E} (hv : Orthonormal 𝕜 v) (f : E →ₗᵢ[𝕜] E') : Orthonormal 𝕜 (f ∘ v) := by rwa [f.orthonormal_comp_iff] /-- A linear isometric equivalence preserves the property of being orthonormal. -/ theorem Orthonormal.comp_linearIsometryEquiv {v : ι → E} (hv : Orthonormal 𝕜 v) (f : E ≃ₗᵢ[𝕜] E') : Orthonormal 𝕜 (f ∘ v) := hv.comp_linearIsometry f.toLinearIsometry /-- A linear isometric equivalence, applied with `Basis.map`, preserves the property of being orthonormal. -/ theorem Orthonormal.mapLinearIsometryEquiv {v : Basis ι 𝕜 E} (hv : Orthonormal 𝕜 v) (f : E ≃ₗᵢ[𝕜] E') : Orthonormal 𝕜 (v.map f.toLinearEquiv) := hv.comp_linearIsometryEquiv f /-- A linear map that sends an orthonormal basis to orthonormal vectors is a linear isometry. -/ def LinearMap.isometryOfOrthonormal (f : E →ₗ[𝕜] E') {v : Basis ι 𝕜 E} (hv : Orthonormal 𝕜 v) (hf : Orthonormal 𝕜 (f ∘ v)) : E →ₗᵢ[𝕜] E' := f.isometryOfInner fun x y => by classical rw [← v.total_repr x, ← v.total_repr y, Finsupp.apply_total, Finsupp.apply_total, hv.inner_finsupp_eq_sum_left, hf.inner_finsupp_eq_sum_left] @[simp] theorem LinearMap.coe_isometryOfOrthonormal (f : E →ₗ[𝕜] E') {v : Basis ι 𝕜 E} (hv : Orthonormal 𝕜 v) (hf : Orthonormal 𝕜 (f ∘ v)) : ⇑(f.isometryOfOrthonormal hv hf) = f := rfl @[simp] theorem LinearMap.isometryOfOrthonormal_toLinearMap (f : E →ₗ[𝕜] E') {v : Basis ι 𝕜 E} (hv : Orthonormal 𝕜 v) (hf : Orthonormal 𝕜 (f ∘ v)) : (f.isometryOfOrthonormal hv hf).toLinearMap = f := rfl /-- A linear equivalence that sends an orthonormal basis to orthonormal vectors is a linear isometric equivalence. -/ def LinearEquiv.isometryOfOrthonormal (f : E ≃ₗ[𝕜] E') {v : Basis ι 𝕜 E} (hv : Orthonormal 𝕜 v) (hf : Orthonormal 𝕜 (f ∘ v)) : E ≃ₗᵢ[𝕜] E' := f.isometryOfInner fun x y => by rw [← LinearEquiv.coe_coe] at hf classical rw [← v.total_repr x, ← v.total_repr y, ← LinearEquiv.coe_coe f, Finsupp.apply_total, Finsupp.apply_total, hv.inner_finsupp_eq_sum_left, hf.inner_finsupp_eq_sum_left] @[simp] theorem LinearEquiv.coe_isometryOfOrthonormal (f : E ≃ₗ[𝕜] E') {v : Basis ι 𝕜 E} (hv : Orthonormal 𝕜 v) (hf : Orthonormal 𝕜 (f ∘ v)) : ⇑(f.isometryOfOrthonormal hv hf) = f := rfl @[simp] theorem LinearEquiv.isometryOfOrthonormal_toLinearEquiv (f : E ≃ₗ[𝕜] E') {v : Basis ι 𝕜 E} (hv : Orthonormal 𝕜 v) (hf : Orthonormal 𝕜 (f ∘ v)) : (f.isometryOfOrthonormal hv hf).toLinearEquiv = f := rfl /-- A linear isometric equivalence that sends an orthonormal basis to a given orthonormal basis. -/ def Orthonormal.equiv {v : Basis ι 𝕜 E} (hv : Orthonormal 𝕜 v) {v' : Basis ι' 𝕜 E'} (hv' : Orthonormal 𝕜 v') (e : ι ≃ ι') : E ≃ₗᵢ[𝕜] E' := (v.equiv v' e).isometryOfOrthonormal hv (by have h : v.equiv v' e ∘ v = v' ∘ e := by ext i simp rw [h] classical exact hv'.comp _ e.injective) @[simp] theorem Orthonormal.equiv_toLinearEquiv {v : Basis ι 𝕜 E} (hv : Orthonormal 𝕜 v) {v' : Basis ι' 𝕜 E'} (hv' : Orthonormal 𝕜 v') (e : ι ≃ ι') : (hv.equiv hv' e).toLinearEquiv = v.equiv v' e := rfl @[simp] theorem Orthonormal.equiv_apply {ι' : Type*} {v : Basis ι 𝕜 E} (hv : Orthonormal 𝕜 v) {v' : Basis ι' 𝕜 E'} (hv' : Orthonormal 𝕜 v') (e : ι ≃ ι') (i : ι) : hv.equiv hv' e (v i) = v' (e i) := Basis.equiv_apply _ _ _ _ @[simp] theorem Orthonormal.equiv_trans {v : Basis ι 𝕜 E} (hv : Orthonormal 𝕜 v) {v' : Basis ι' 𝕜 E'} (hv' : Orthonormal 𝕜 v') (e : ι ≃ ι') {v'' : Basis ι'' 𝕜 E''} (hv'' : Orthonormal 𝕜 v'') (e' : ι' ≃ ι'') : (hv.equiv hv' e).trans (hv'.equiv hv'' e') = hv.equiv hv'' (e.trans e') := v.ext_linearIsometryEquiv fun i => by simp only [LinearIsometryEquiv.trans_apply, Orthonormal.equiv_apply, e.coe_trans, Function.comp_apply] theorem Orthonormal.map_equiv {v : Basis ι 𝕜 E} (hv : Orthonormal 𝕜 v) {v' : Basis ι' 𝕜 E'} (hv' : Orthonormal 𝕜 v') (e : ι ≃ ι') : v.map (hv.equiv hv' e).toLinearEquiv = v'.reindex e.symm := v.map_equiv _ _ end /-- Polarization identity: The real inner product, in terms of the norm. -/ theorem real_inner_eq_norm_add_mul_self_sub_norm_mul_self_sub_norm_mul_self_div_two (x y : F) : ⟪x, y⟫_ℝ = (‖x + y‖ * ‖x + y‖ - ‖x‖ * ‖x‖ - ‖y‖ * ‖y‖) / 2 := re_to_real.symm.trans <| re_inner_eq_norm_add_mul_self_sub_norm_mul_self_sub_norm_mul_self_div_two x y /-- Polarization identity: The real inner product, in terms of the norm. -/ theorem real_inner_eq_norm_mul_self_add_norm_mul_self_sub_norm_sub_mul_self_div_two (x y : F) : ⟪x, y⟫_ℝ = (‖x‖ * ‖x‖ + ‖y‖ * ‖y‖ - ‖x - y‖ * ‖x - y‖) / 2 := re_to_real.symm.trans <| re_inner_eq_norm_mul_self_add_norm_mul_self_sub_norm_sub_mul_self_div_two x y /-- Pythagorean theorem, if-and-only-if vector inner product form. -/ theorem norm_add_sq_eq_norm_sq_add_norm_sq_iff_real_inner_eq_zero (x y : F) : ‖x + y‖ * ‖x + y‖ = ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖ ↔ ⟪x, y⟫_ℝ = 0 := by rw [@norm_add_mul_self ℝ, add_right_cancel_iff, add_right_eq_self, mul_eq_zero] norm_num /-- Pythagorean theorem, if-and-if vector inner product form using square roots. -/ theorem norm_add_eq_sqrt_iff_real_inner_eq_zero {x y : F} : ‖x + y‖ = √(‖x‖ * ‖x‖ + ‖y‖ * ‖y‖) ↔ ⟪x, y⟫_ℝ = 0 := by rw [← norm_add_sq_eq_norm_sq_add_norm_sq_iff_real_inner_eq_zero, eq_comm, sqrt_eq_iff_mul_self_eq (add_nonneg (mul_self_nonneg _) (mul_self_nonneg _)) (norm_nonneg _)] /-- Pythagorean theorem, vector inner product form. -/ theorem norm_add_sq_eq_norm_sq_add_norm_sq_of_inner_eq_zero (x y : E) (h : ⟪x, y⟫ = 0) : ‖x + y‖ * ‖x + y‖ = ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖ := by rw [@norm_add_mul_self 𝕜, add_right_cancel_iff, add_right_eq_self, mul_eq_zero] apply Or.inr simp only [h, zero_re'] /-- Pythagorean theorem, vector inner product form. -/ theorem norm_add_sq_eq_norm_sq_add_norm_sq_real {x y : F} (h : ⟪x, y⟫_ℝ = 0) : ‖x + y‖ * ‖x + y‖ = ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖ := (norm_add_sq_eq_norm_sq_add_norm_sq_iff_real_inner_eq_zero x y).2 h /-- Pythagorean theorem, subtracting vectors, if-and-only-if vector inner product form. -/ theorem norm_sub_sq_eq_norm_sq_add_norm_sq_iff_real_inner_eq_zero (x y : F) : ‖x - y‖ * ‖x - y‖ = ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖ ↔ ⟪x, y⟫_ℝ = 0 := by rw [@norm_sub_mul_self ℝ, add_right_cancel_iff, sub_eq_add_neg, add_right_eq_self, neg_eq_zero, mul_eq_zero] norm_num /-- Pythagorean theorem, subtracting vectors, if-and-if vector inner product form using square roots. -/ theorem norm_sub_eq_sqrt_iff_real_inner_eq_zero {x y : F} : ‖x - y‖ = √(‖x‖ * ‖x‖ + ‖y‖ * ‖y‖) ↔ ⟪x, y⟫_ℝ = 0 := by rw [← norm_sub_sq_eq_norm_sq_add_norm_sq_iff_real_inner_eq_zero, eq_comm, sqrt_eq_iff_mul_self_eq (add_nonneg (mul_self_nonneg _) (mul_self_nonneg _)) (norm_nonneg _)] /-- Pythagorean theorem, subtracting vectors, vector inner product form. -/ theorem norm_sub_sq_eq_norm_sq_add_norm_sq_real {x y : F} (h : ⟪x, y⟫_ℝ = 0) : ‖x - y‖ * ‖x - y‖ = ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖ := (norm_sub_sq_eq_norm_sq_add_norm_sq_iff_real_inner_eq_zero x y).2 h /-- The sum and difference of two vectors are orthogonal if and only if they have the same norm. -/ theorem real_inner_add_sub_eq_zero_iff (x y : F) : ⟪x + y, x - y⟫_ℝ = 0 ↔ ‖x‖ = ‖y‖ := by conv_rhs => rw [← mul_self_inj_of_nonneg (norm_nonneg _) (norm_nonneg _)] simp only [← @inner_self_eq_norm_mul_norm ℝ, inner_add_left, inner_sub_right, real_inner_comm y x, sub_eq_zero, re_to_real] constructor · intro h rw [add_comm] at h linarith · intro h linarith /-- Given two orthogonal vectors, their sum and difference have equal norms. -/ theorem norm_sub_eq_norm_add {v w : E} (h : ⟪v, w⟫ = 0) : ‖w - v‖ = ‖w + v‖ := by rw [← mul_self_inj_of_nonneg (norm_nonneg _) (norm_nonneg _)] simp only [h, ← @inner_self_eq_norm_mul_norm 𝕜, sub_neg_eq_add, sub_zero, map_sub, zero_re', zero_sub, add_zero, map_add, inner_add_right, inner_sub_left, inner_sub_right, inner_re_symm, zero_add] /-- The real inner product of two vectors, divided by the product of their norms, has absolute value at most 1. -/ theorem abs_real_inner_div_norm_mul_norm_le_one (x y : F) : |⟪x, y⟫_ℝ / (‖x‖ * ‖y‖)| ≤ 1 := by rw [abs_div, abs_mul, abs_norm, abs_norm] exact div_le_one_of_le (abs_real_inner_le_norm x y) (by positivity) /-- The inner product of a vector with a multiple of itself. -/ theorem real_inner_smul_self_left (x : F) (r : ℝ) : ⟪r • x, x⟫_ℝ = r * (‖x‖ * ‖x‖) := by rw [real_inner_smul_left, ← real_inner_self_eq_norm_mul_norm] /-- The inner product of a vector with a multiple of itself. -/ theorem real_inner_smul_self_right (x : F) (r : ℝ) : ⟪x, r • x⟫_ℝ = r * (‖x‖ * ‖x‖) := by rw [inner_smul_right, ← real_inner_self_eq_norm_mul_norm] variable (𝕜) /-- The inner product as a sesquilinear map. -/ def innerₛₗ : E →ₗ⋆[𝕜] E →ₗ[𝕜] 𝕜 := LinearMap.mk₂'ₛₗ _ _ (fun v w => ⟪v, w⟫) inner_add_left (fun _ _ _ => inner_smul_left _ _ _) inner_add_right fun _ _ _ => inner_smul_right _ _ _ @[simp] theorem innerₛₗ_apply_coe (v : E) : ⇑(innerₛₗ 𝕜 v) = fun w => ⟪v, w⟫ := rfl @[simp] theorem innerₛₗ_apply (v w : E) : innerₛₗ 𝕜 v w = ⟪v, w⟫ := rfl variable (F) /-- The inner product as a bilinear map in the real case. -/ def innerₗ : F →ₗ[ℝ] F →ₗ[ℝ] ℝ := innerₛₗ ℝ @[simp] lemma flip_innerₗ : (innerₗ F).flip = innerₗ F := by ext v w exact real_inner_comm v w variable {F} @[simp] lemma innerₗ_apply (v w : F) : innerₗ F v w = ⟪v, w⟫_ℝ := rfl /-- The inner product as a continuous sesquilinear map. Note that `toDualMap` (resp. `toDual`) in `InnerProductSpace.Dual` is a version of this given as a linear isometry (resp. linear isometric equivalence). -/ def innerSL : E →L⋆[𝕜] E →L[𝕜] 𝕜 := LinearMap.mkContinuous₂ (innerₛₗ 𝕜) 1 fun x y => by simp only [norm_inner_le_norm, one_mul, innerₛₗ_apply] @[simp] theorem innerSL_apply_coe (v : E) : ⇑(innerSL 𝕜 v) = fun w => ⟪v, w⟫ := rfl @[simp] theorem innerSL_apply (v w : E) : innerSL 𝕜 v w = ⟪v, w⟫ := rfl /-- The inner product as a continuous sesquilinear map, with the two arguments flipped. -/ def innerSLFlip : E →L[𝕜] E →L⋆[𝕜] 𝕜 := @ContinuousLinearMap.flipₗᵢ' 𝕜 𝕜 𝕜 E E 𝕜 _ _ _ _ _ _ _ _ _ (RingHom.id 𝕜) (starRingEnd 𝕜) _ _ (innerSL 𝕜) @[simp] theorem innerSLFlip_apply (x y : E) : innerSLFlip 𝕜 x y = ⟪y, x⟫ := rfl variable (F) in @[simp] lemma innerSL_real_flip : (innerSL ℝ (E := F)).flip = innerSL ℝ := by ext v w exact real_inner_comm _ _ variable {𝕜} namespace ContinuousLinearMap variable {E' : Type*} [NormedAddCommGroup E'] [InnerProductSpace 𝕜 E'] -- Note: odd and expensive build behavior is explicitly turned off using `noncomputable` /-- Given `f : E →L[𝕜] E'`, construct the continuous sesquilinear form `fun x y ↦ ⟪x, A y⟫`, given as a continuous linear map. -/ noncomputable def toSesqForm : (E →L[𝕜] E') →L[𝕜] E' →L⋆[𝕜] E →L[𝕜] 𝕜 := (ContinuousLinearMap.flipₗᵢ' E E' 𝕜 (starRingEnd 𝕜) (RingHom.id 𝕜)).toContinuousLinearEquiv ∘L ContinuousLinearMap.compSL E E' (E' →L⋆[𝕜] 𝕜) (RingHom.id 𝕜) (RingHom.id 𝕜) (innerSLFlip 𝕜) @[simp] theorem toSesqForm_apply_coe (f : E →L[𝕜] E') (x : E') : toSesqForm f x = (innerSL 𝕜 x).comp f := rfl theorem toSesqForm_apply_norm_le {f : E →L[𝕜] E'} {v : E'} : ‖toSesqForm f v‖ ≤ ‖f‖ * ‖v‖ := by refine opNorm_le_bound _ (by positivity) fun x ↦ ?_ have h₁ : ‖f x‖ ≤ ‖f‖ * ‖x‖ := le_opNorm _ _ have h₂ := @norm_inner_le_norm 𝕜 E' _ _ _ v (f x) calc ‖⟪v, f x⟫‖ ≤ ‖v‖ * ‖f x‖ := h₂ _ ≤ ‖v‖ * (‖f‖ * ‖x‖) := mul_le_mul_of_nonneg_left h₁ (norm_nonneg v) _ = ‖f‖ * ‖v‖ * ‖x‖ := by ring end ContinuousLinearMap end Norm_Seminormed section Norm variable [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] variable [NormedAddCommGroup F] [InnerProductSpace ℝ F] variable {ι : Type*} {ι' : Type*} {ι'' : Type*} local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y local notation "IK" => @RCLike.I 𝕜 _ local postfix:90 "†" => starRingEnd _ /-- Formula for the distance between the images of two nonzero points under an inversion with center zero. See also `EuclideanGeometry.dist_inversion_inversion` for inversions around a general point. -/ theorem dist_div_norm_sq_smul {x y : F} (hx : x ≠ 0) (hy : y ≠ 0) (R : ℝ) : dist ((R / ‖x‖) ^ 2 • x) ((R / ‖y‖) ^ 2 • y) = R ^ 2 / (‖x‖ * ‖y‖) * dist x y := have hx' : ‖x‖ ≠ 0 := norm_ne_zero_iff.2 hx have hy' : ‖y‖ ≠ 0 := norm_ne_zero_iff.2 hy calc dist ((R / ‖x‖) ^ 2 • x) ((R / ‖y‖) ^ 2 • y) = √(‖(R / ‖x‖) ^ 2 • x - (R / ‖y‖) ^ 2 • y‖ ^ 2) := by rw [dist_eq_norm, sqrt_sq (norm_nonneg _)] _ = √((R ^ 2 / (‖x‖ * ‖y‖)) ^ 2 * ‖x - y‖ ^ 2) := congr_arg sqrt <| by field_simp [sq, norm_sub_mul_self_real, norm_smul, real_inner_smul_left, inner_smul_right, Real.norm_of_nonneg (mul_self_nonneg _)] ring _ = R ^ 2 / (‖x‖ * ‖y‖) * dist x y := by rw [sqrt_mul, sqrt_sq, sqrt_sq, dist_eq_norm] <;> positivity section variable {ι : Type*} {ι' : Type*} {ι'' : Type*} variable {E' : Type*} [NormedAddCommGroup E'] [InnerProductSpace 𝕜 E'] variable {E'' : Type*} [NormedAddCommGroup E''] [InnerProductSpace 𝕜 E''] @[simp] theorem Orthonormal.equiv_refl {v : Basis ι 𝕜 E} (hv : Orthonormal 𝕜 v) : hv.equiv hv (Equiv.refl ι) = LinearIsometryEquiv.refl 𝕜 E := v.ext_linearIsometryEquiv fun i => by simp only [Orthonormal.equiv_apply, Equiv.coe_refl, id, LinearIsometryEquiv.coe_refl] @[simp] theorem Orthonormal.equiv_symm {v : Basis ι 𝕜 E} (hv : Orthonormal 𝕜 v) {v' : Basis ι' 𝕜 E'} (hv' : Orthonormal 𝕜 v') (e : ι ≃ ι') : (hv.equiv hv' e).symm = hv'.equiv hv e.symm := v'.ext_linearIsometryEquiv fun i => (hv.equiv hv' e).injective <| by simp only [LinearIsometryEquiv.apply_symm_apply, Orthonormal.equiv_apply, e.apply_symm_apply] end /-- The inner product of a nonzero vector with a nonzero multiple of itself, divided by the product of their norms, has absolute value 1. -/ theorem norm_inner_div_norm_mul_norm_eq_one_of_ne_zero_of_ne_zero_mul {x : E} {r : 𝕜} (hx : x ≠ 0) (hr : r ≠ 0) : ‖⟪x, r • x⟫‖ / (‖x‖ * ‖r • x‖) = 1 := by have hx' : ‖x‖ ≠ 0 := by simp [hx] have hr' : ‖r‖ ≠ 0 := by simp [hr] rw [inner_smul_right, norm_mul, ← inner_self_re_eq_norm, inner_self_eq_norm_mul_norm, norm_smul] rw [← mul_assoc, ← div_div, mul_div_cancel_right₀ _ hx', ← div_div, mul_comm, mul_div_cancel_right₀ _ hr', div_self hx'] /-- The inner product of a nonzero vector with a nonzero multiple of itself, divided by the product of their norms, has absolute value 1. -/ theorem abs_real_inner_div_norm_mul_norm_eq_one_of_ne_zero_of_ne_zero_mul {x : F} {r : ℝ} (hx : x ≠ 0) (hr : r ≠ 0) : |⟪x, r • x⟫_ℝ| / (‖x‖ * ‖r • x‖) = 1 := norm_inner_div_norm_mul_norm_eq_one_of_ne_zero_of_ne_zero_mul hx hr /-- The inner product of a nonzero vector with a positive multiple of itself, divided by the product of their norms, has value 1. -/ theorem real_inner_div_norm_mul_norm_eq_one_of_ne_zero_of_pos_mul {x : F} {r : ℝ} (hx : x ≠ 0) (hr : 0 < r) : ⟪x, r • x⟫_ℝ / (‖x‖ * ‖r • x‖) = 1 := by rw [real_inner_smul_self_right, norm_smul, Real.norm_eq_abs, ← mul_assoc ‖x‖, mul_comm _ |r|, mul_assoc, abs_of_nonneg hr.le, div_self] exact mul_ne_zero hr.ne' (mul_self_ne_zero.2 (norm_ne_zero_iff.2 hx)) /-- The inner product of a nonzero vector with a negative multiple of itself, divided by the product of their norms, has value -1. -/ theorem real_inner_div_norm_mul_norm_eq_neg_one_of_ne_zero_of_neg_mul {x : F} {r : ℝ} (hx : x ≠ 0) (hr : r < 0) : ⟪x, r • x⟫_ℝ / (‖x‖ * ‖r • x‖) = -1 := by rw [real_inner_smul_self_right, norm_smul, Real.norm_eq_abs, ← mul_assoc ‖x‖, mul_comm _ |r|, mul_assoc, abs_of_neg hr, neg_mul, div_neg_eq_neg_div, div_self] exact mul_ne_zero hr.ne (mul_self_ne_zero.2 (norm_ne_zero_iff.2 hx)) theorem norm_inner_eq_norm_tfae (x y : E) : List.TFAE [‖⟪x, y⟫‖ = ‖x‖ * ‖y‖, x = 0 ∨ y = (⟪x, y⟫ / ⟪x, x⟫) • x, x = 0 ∨ ∃ r : 𝕜, y = r • x, x = 0 ∨ y ∈ 𝕜 ∙ x] := by tfae_have 1 → 2 · refine fun h => or_iff_not_imp_left.2 fun hx₀ => ?_ have : ‖x‖ ^ 2 ≠ 0 := pow_ne_zero _ (norm_ne_zero_iff.2 hx₀) rw [← sq_eq_sq, mul_pow, ← mul_right_inj' this, eq_comm, ← sub_eq_zero, ← mul_sub] at h <;> try positivity simp only [@norm_sq_eq_inner 𝕜] at h letI : InnerProductSpace.Core 𝕜 E := InnerProductSpace.toCore erw [← InnerProductSpace.Core.cauchy_schwarz_aux, InnerProductSpace.Core.normSq_eq_zero, sub_eq_zero] at h rw [div_eq_inv_mul, mul_smul, h, inv_smul_smul₀] rwa [inner_self_ne_zero] tfae_have 2 → 3 · exact fun h => h.imp_right fun h' => ⟨_, h'⟩ tfae_have 3 → 1 · rintro (rfl | ⟨r, rfl⟩) <;> simp [inner_smul_right, norm_smul, inner_self_eq_norm_sq_to_K, inner_self_eq_norm_mul_norm, sq, mul_left_comm] tfae_have 3 ↔ 4; · simp only [Submodule.mem_span_singleton, eq_comm] tfae_finish /-- If the inner product of two vectors is equal to the product of their norms, then the two vectors are multiples of each other. One form of the equality case for Cauchy-Schwarz. Compare `inner_eq_norm_mul_iff`, which takes the stronger hypothesis `⟪x, y⟫ = ‖x‖ * ‖y‖`. -/ theorem norm_inner_eq_norm_iff {x y : E} (hx₀ : x ≠ 0) (hy₀ : y ≠ 0) : ‖⟪x, y⟫‖ = ‖x‖ * ‖y‖ ↔ ∃ r : 𝕜, r ≠ 0 ∧ y = r • x := calc ‖⟪x, y⟫‖ = ‖x‖ * ‖y‖ ↔ x = 0 ∨ ∃ r : 𝕜, y = r • x := (@norm_inner_eq_norm_tfae 𝕜 _ _ _ _ x y).out 0 2 _ ↔ ∃ r : 𝕜, y = r • x := or_iff_right hx₀ _ ↔ ∃ r : 𝕜, r ≠ 0 ∧ y = r • x := ⟨fun ⟨r, h⟩ => ⟨r, fun hr₀ => hy₀ <| h.symm ▸ smul_eq_zero.2 <| Or.inl hr₀, h⟩, fun ⟨r, _hr₀, h⟩ => ⟨r, h⟩⟩ /-- The inner product of two vectors, divided by the product of their norms, has absolute value 1 if and only if they are nonzero and one is a multiple of the other. One form of equality case for Cauchy-Schwarz. -/ theorem norm_inner_div_norm_mul_norm_eq_one_iff (x y : E) : ‖⟪x, y⟫ / (‖x‖ * ‖y‖)‖ = 1 ↔ x ≠ 0 ∧ ∃ r : 𝕜, r ≠ 0 ∧ y = r • x := by constructor · intro h have hx₀ : x ≠ 0 := fun h₀ => by simp [h₀] at h have hy₀ : y ≠ 0 := fun h₀ => by simp [h₀] at h refine ⟨hx₀, (norm_inner_eq_norm_iff hx₀ hy₀).1 <| eq_of_div_eq_one ?_⟩ simpa using h · rintro ⟨hx, ⟨r, ⟨hr, rfl⟩⟩⟩ simp only [norm_div, norm_mul, norm_ofReal, abs_norm] exact norm_inner_div_norm_mul_norm_eq_one_of_ne_zero_of_ne_zero_mul hx hr /-- The inner product of two vectors, divided by the product of their norms, has absolute value 1 if and only if they are nonzero and one is a multiple of the other. One form of equality case for Cauchy-Schwarz. -/ theorem abs_real_inner_div_norm_mul_norm_eq_one_iff (x y : F) : |⟪x, y⟫_ℝ / (‖x‖ * ‖y‖)| = 1 ↔ x ≠ 0 ∧ ∃ r : ℝ, r ≠ 0 ∧ y = r • x := @norm_inner_div_norm_mul_norm_eq_one_iff ℝ F _ _ _ x y theorem inner_eq_norm_mul_iff_div {x y : E} (h₀ : x ≠ 0) : ⟪x, y⟫ = (‖x‖ : 𝕜) * ‖y‖ ↔ (‖y‖ / ‖x‖ : 𝕜) • x = y := by have h₀' := h₀ rw [← norm_ne_zero_iff, Ne, ← @ofReal_eq_zero 𝕜] at h₀' constructor <;> intro h · have : x = 0 ∨ y = (⟪x, y⟫ / ⟪x, x⟫ : 𝕜) • x := ((@norm_inner_eq_norm_tfae 𝕜 _ _ _ _ x y).out 0 1).1 (by simp [h]) rw [this.resolve_left h₀, h] simp [norm_smul, inner_self_ofReal_norm, mul_div_cancel_right₀ _ h₀'] · conv_lhs => rw [← h, inner_smul_right, inner_self_eq_norm_sq_to_K] field_simp [sq, mul_left_comm] /-- If the inner product of two vectors is equal to the product of their norms (i.e., `⟪x, y⟫ = ‖x‖ * ‖y‖`), then the two vectors are nonnegative real multiples of each other. One form of the equality case for Cauchy-Schwarz. Compare `norm_inner_eq_norm_iff`, which takes the weaker hypothesis `abs ⟪x, y⟫ = ‖x‖ * ‖y‖`. -/ theorem inner_eq_norm_mul_iff {x y : E} : ⟪x, y⟫ = (‖x‖ : 𝕜) * ‖y‖ ↔ (‖y‖ : 𝕜) • x = (‖x‖ : 𝕜) • y := by rcases eq_or_ne x 0 with (rfl | h₀) · simp · rw [inner_eq_norm_mul_iff_div h₀, div_eq_inv_mul, mul_smul, inv_smul_eq_iff₀] rwa [Ne, ofReal_eq_zero, norm_eq_zero] /-- If the inner product of two vectors is equal to the product of their norms (i.e., `⟪x, y⟫ = ‖x‖ * ‖y‖`), then the two vectors are nonnegative real multiples of each other. One form of the equality case for Cauchy-Schwarz. Compare `norm_inner_eq_norm_iff`, which takes the weaker hypothesis `abs ⟪x, y⟫ = ‖x‖ * ‖y‖`. -/ theorem inner_eq_norm_mul_iff_real {x y : F} : ⟪x, y⟫_ℝ = ‖x‖ * ‖y‖ ↔ ‖y‖ • x = ‖x‖ • y := inner_eq_norm_mul_iff /-- The inner product of two vectors, divided by the product of their norms, has value 1 if and only if they are nonzero and one is a positive multiple of the other. -/ theorem real_inner_div_norm_mul_norm_eq_one_iff (x y : F) : ⟪x, y⟫_ℝ / (‖x‖ * ‖y‖) = 1 ↔ x ≠ 0 ∧ ∃ r : ℝ, 0 < r ∧ y = r • x := by constructor · intro h have hx₀ : x ≠ 0 := fun h₀ => by simp [h₀] at h have hy₀ : y ≠ 0 := fun h₀ => by simp [h₀] at h refine ⟨hx₀, ‖y‖ / ‖x‖, div_pos (norm_pos_iff.2 hy₀) (norm_pos_iff.2 hx₀), ?_⟩ exact ((inner_eq_norm_mul_iff_div hx₀).1 (eq_of_div_eq_one h)).symm · rintro ⟨hx, ⟨r, ⟨hr, rfl⟩⟩⟩ exact real_inner_div_norm_mul_norm_eq_one_of_ne_zero_of_pos_mul hx hr /-- The inner product of two vectors, divided by the product of their norms, has value -1 if and only if they are nonzero and one is a negative multiple of the other. -/ theorem real_inner_div_norm_mul_norm_eq_neg_one_iff (x y : F) : ⟪x, y⟫_ℝ / (‖x‖ * ‖y‖) = -1 ↔ x ≠ 0 ∧ ∃ r : ℝ, r < 0 ∧ y = r • x := by rw [← neg_eq_iff_eq_neg, ← neg_div, ← inner_neg_right, ← norm_neg y, real_inner_div_norm_mul_norm_eq_one_iff, (@neg_surjective ℝ _).exists] refine Iff.rfl.and (exists_congr fun r => ?_) rw [neg_pos, neg_smul, neg_inj] /-- If the inner product of two unit vectors is `1`, then the two vectors are equal. One form of the equality case for Cauchy-Schwarz. -/ theorem inner_eq_one_iff_of_norm_one {x y : E} (hx : ‖x‖ = 1) (hy : ‖y‖ = 1) : ⟪x, y⟫ = 1 ↔ x = y := by convert inner_eq_norm_mul_iff (𝕜 := 𝕜) (E := E) using 2 <;> simp [hx, hy] theorem inner_lt_norm_mul_iff_real {x y : F} : ⟪x, y⟫_ℝ < ‖x‖ * ‖y‖ ↔ ‖y‖ • x ≠ ‖x‖ • y := calc ⟪x, y⟫_ℝ < ‖x‖ * ‖y‖ ↔ ⟪x, y⟫_ℝ ≠ ‖x‖ * ‖y‖ := ⟨ne_of_lt, lt_of_le_of_ne (real_inner_le_norm _ _)⟩ _ ↔ ‖y‖ • x ≠ ‖x‖ • y := not_congr inner_eq_norm_mul_iff_real /-- If the inner product of two unit vectors is strictly less than `1`, then the two vectors are distinct. One form of the equality case for Cauchy-Schwarz. -/ theorem inner_lt_one_iff_real_of_norm_one {x y : F} (hx : ‖x‖ = 1) (hy : ‖y‖ = 1) : ⟪x, y⟫_ℝ < 1 ↔ x ≠ y := by convert inner_lt_norm_mul_iff_real (F := F) <;> simp [hx, hy] /-- The sphere of radius `r = ‖y‖` is tangent to the plane `⟪x, y⟫ = ‖y‖ ^ 2` at `x = y`. -/ theorem eq_of_norm_le_re_inner_eq_norm_sq {x y : E} (hle : ‖x‖ ≤ ‖y‖) (h : re ⟪x, y⟫ = ‖y‖ ^ 2) : x = y := by suffices H : re ⟪x - y, x - y⟫ ≤ 0 by rwa [inner_self_nonpos, sub_eq_zero] at H have H₁ : ‖x‖ ^ 2 ≤ ‖y‖ ^ 2 := by gcongr have H₂ : re ⟪y, x⟫ = ‖y‖ ^ 2 := by rwa [← inner_conj_symm, conj_re] simpa [inner_sub_left, inner_sub_right, ← norm_sq_eq_inner, h, H₂] using H₁ /-- The inner product of two weighted sums, where the weights in each sum add to 0, in terms of the norms of pairwise differences. -/ theorem inner_sum_smul_sum_smul_of_sum_eq_zero {ι₁ : Type*} {s₁ : Finset ι₁} {w₁ : ι₁ → ℝ} (v₁ : ι₁ → F) (h₁ : ∑ i ∈ s₁, w₁ i = 0) {ι₂ : Type*} {s₂ : Finset ι₂} {w₂ : ι₂ → ℝ} (v₂ : ι₂ → F) (h₂ : ∑ i ∈ s₂, w₂ i = 0) : ⟪∑ i₁ ∈ s₁, w₁ i₁ • v₁ i₁, ∑ i₂ ∈ s₂, w₂ i₂ • v₂ i₂⟫_ℝ = (-∑ i₁ ∈ s₁, ∑ i₂ ∈ s₂, w₁ i₁ * w₂ i₂ * (‖v₁ i₁ - v₂ i₂‖ * ‖v₁ i₁ - v₂ i₂‖)) / 2 := by simp_rw [sum_inner, inner_sum, real_inner_smul_left, real_inner_smul_right, real_inner_eq_norm_mul_self_add_norm_mul_self_sub_norm_sub_mul_self_div_two, ← div_sub_div_same, ← div_add_div_same, mul_sub_left_distrib, left_distrib, Finset.sum_sub_distrib, Finset.sum_add_distrib, ← Finset.mul_sum, ← Finset.sum_mul, h₁, h₂, zero_mul, mul_zero, Finset.sum_const_zero, zero_add, zero_sub, Finset.mul_sum, neg_div, Finset.sum_div, mul_div_assoc, mul_assoc] variable (𝕜) /-- `innerSL` is an isometry. Note that the associated `LinearIsometry` is defined in `InnerProductSpace.Dual` as `toDualMap`. -/ @[simp] theorem innerSL_apply_norm (x : E) : ‖innerSL 𝕜 x‖ = ‖x‖ := by refine le_antisymm ((innerSL 𝕜 x).opNorm_le_bound (norm_nonneg _) fun y => norm_inner_le_norm _ _) ?_ rcases eq_or_ne x 0 with (rfl | h) · simp · refine (mul_le_mul_right (norm_pos_iff.2 h)).mp ?_ calc ‖x‖ * ‖x‖ = ‖(⟪x, x⟫ : 𝕜)‖ := by rw [← sq, inner_self_eq_norm_sq_to_K, norm_pow, norm_ofReal, abs_norm] _ ≤ ‖innerSL 𝕜 x‖ * ‖x‖ := (innerSL 𝕜 x).le_opNorm _ lemma norm_innerSL_le : ‖innerSL 𝕜 (E := E)‖ ≤ 1 := ContinuousLinearMap.opNorm_le_bound _ zero_le_one (by simp) variable {𝕜} /-- When an inner product space `E` over `𝕜` is considered as a real normed space, its inner product satisfies `IsBoundedBilinearMap`. In order to state these results, we need a `NormedSpace ℝ E` instance. We will later establish such an instance by restriction-of-scalars, `InnerProductSpace.rclikeToReal 𝕜 E`, but this instance may be not definitionally equal to some other “natural” instance. So, we assume `[NormedSpace ℝ E]`. -/ theorem _root_.isBoundedBilinearMap_inner [NormedSpace ℝ E] : IsBoundedBilinearMap ℝ fun p : E × E => ⟪p.1, p.2⟫ := { add_left := inner_add_left smul_left := fun r x y => by simp only [← algebraMap_smul 𝕜 r x, algebraMap_eq_ofReal, inner_smul_real_left] add_right := inner_add_right smul_right := fun r x y => by simp only [← algebraMap_smul 𝕜 r y, algebraMap_eq_ofReal, inner_smul_real_right] bound := ⟨1, zero_lt_one, fun x y => by rw [one_mul] exact norm_inner_le_norm x y⟩ } end Norm section BesselsInequality variable [SeminormedAddCommGroup E] [InnerProductSpace 𝕜 E] variable {ι : Type*} (x : E) {v : ι → E} local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y local notation "IK" => @RCLike.I 𝕜 _ local postfix:90 "†" => starRingEnd _ /-- Bessel's inequality for finite sums. -/ theorem Orthonormal.sum_inner_products_le {s : Finset ι} (hv : Orthonormal 𝕜 v) : ∑ i ∈ s, ‖⟪v i, x⟫‖ ^ 2 ≤ ‖x‖ ^ 2 := by have h₂ : (∑ i ∈ s, ∑ j ∈ s, ⟪v i, x⟫ * ⟪x, v j⟫ * ⟪v j, v i⟫) = (∑ k ∈ s, ⟪v k, x⟫ * ⟪x, v k⟫ : 𝕜) := by classical exact hv.inner_left_right_finset have h₃ : ∀ z : 𝕜, re (z * conj z) = ‖z‖ ^ 2 := by intro z simp only [mul_conj, normSq_eq_def'] norm_cast suffices hbf : ‖x - ∑ i ∈ s, ⟪v i, x⟫ • v i‖ ^ 2 = ‖x‖ ^ 2 - ∑ i ∈ s, ‖⟪v i, x⟫‖ ^ 2 by rw [← sub_nonneg, ← hbf] simp only [norm_nonneg, pow_nonneg] rw [@norm_sub_sq 𝕜, sub_add] simp only [@InnerProductSpace.norm_sq_eq_inner 𝕜, _root_.inner_sum, _root_.sum_inner] simp only [inner_smul_right, two_mul, inner_smul_left, inner_conj_symm, ← mul_assoc, h₂, add_sub_cancel_right, sub_right_inj] simp only [map_sum, ← inner_conj_symm x, ← h₃] /-- Bessel's inequality. -/ theorem Orthonormal.tsum_inner_products_le (hv : Orthonormal 𝕜 v) : ∑' i, ‖⟪v i, x⟫‖ ^ 2 ≤ ‖x‖ ^ 2 := by refine tsum_le_of_sum_le' ?_ fun s => hv.sum_inner_products_le x simp only [norm_nonneg, pow_nonneg] /-- The sum defined in Bessel's inequality is summable. -/ theorem Orthonormal.inner_products_summable (hv : Orthonormal 𝕜 v) : Summable fun i => ‖⟪v i, x⟫‖ ^ 2 := by use ⨆ s : Finset ι, ∑ i ∈ s, ‖⟪v i, x⟫‖ ^ 2 apply hasSum_of_isLUB_of_nonneg · intro b simp only [norm_nonneg, pow_nonneg] · refine isLUB_ciSup ?_ use ‖x‖ ^ 2 rintro y ⟨s, rfl⟩ exact hv.sum_inner_products_le x end BesselsInequality section RCLike local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y /-- A field `𝕜` satisfying `RCLike` is itself a `𝕜`-inner product space. -/ instance RCLike.innerProductSpace : InnerProductSpace 𝕜 𝕜 where inner x y := conj x * y norm_sq_eq_inner x := by simp only [inner, conj_mul, ← ofReal_pow, ofReal_re] conj_symm x y := by simp only [mul_comm, map_mul, starRingEnd_self_apply] add_left x y z := by simp only [add_mul, map_add] smul_left x y z := by simp only [mul_assoc, smul_eq_mul, map_mul] @[simp] theorem RCLike.inner_apply (x y : 𝕜) : ⟪x, y⟫ = conj x * y := rfl end RCLike section Submodule variable [SeminormedAddCommGroup E] [InnerProductSpace 𝕜 E] local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y local notation "IK" => @RCLike.I 𝕜 _ local postfix:90 "†" => starRingEnd _ /-! ### Inner product space structure on subspaces -/ /-- Induced inner product on a submodule. -/ instance Submodule.innerProductSpace (W : Submodule 𝕜 E) : InnerProductSpace 𝕜 W := { Submodule.normedSpace W with inner := fun x y => ⟪(x : E), (y : E)⟫ conj_symm := fun _ _ => inner_conj_symm _ _ norm_sq_eq_inner := fun x => norm_sq_eq_inner (x : E) add_left := fun _ _ _ => inner_add_left _ _ _ smul_left := fun _ _ _ => inner_smul_left _ _ _ } /-- The inner product on submodules is the same as on the ambient space. -/ @[simp] theorem Submodule.coe_inner (W : Submodule 𝕜 E) (x y : W) : ⟪x, y⟫ = ⟪(x : E), ↑y⟫ := rfl theorem Orthonormal.codRestrict {ι : Type*} {v : ι → E} (hv : Orthonormal 𝕜 v) (s : Submodule 𝕜 E) (hvs : ∀ i, v i ∈ s) : @Orthonormal 𝕜 s _ _ _ ι (Set.codRestrict v s hvs) := s.subtypeₗᵢ.orthonormal_comp_iff.mp hv theorem orthonormal_span {ι : Type*} {v : ι → E} (hv : Orthonormal 𝕜 v) : @Orthonormal 𝕜 (Submodule.span 𝕜 (Set.range v)) _ _ _ ι fun i : ι => ⟨v i, Submodule.subset_span (Set.mem_range_self i)⟩ := hv.codRestrict (Submodule.span 𝕜 (Set.range v)) fun i => Submodule.subset_span (Set.mem_range_self i) end Submodule /-! ### Families of mutually-orthogonal subspaces of an inner product space -/ section OrthogonalFamily_Seminormed variable [SeminormedAddCommGroup E] [InnerProductSpace 𝕜 E] local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y local notation "IK" => @RCLike.I 𝕜 _ local postfix:90 "†" => starRingEnd _ variable {ι : Type*} (𝕜) open DirectSum /-- An indexed family of mutually-orthogonal subspaces of an inner product space `E`. The simple way to express this concept would be as a condition on `V : ι → Submodule 𝕜 E`. We instead implement it as a condition on a family of inner product spaces each equipped with an isometric embedding into `E`, thus making it a property of morphisms rather than subobjects. The connection to the subobject spelling is shown in `orthogonalFamily_iff_pairwise`. This definition is less lightweight, but allows for better definitional properties when the inner product space structure on each of the submodules is important -- for example, when considering their Hilbert sum (`PiLp V 2`). For example, given an orthonormal set of vectors `v : ι → E`, we have an associated orthogonal family of one-dimensional subspaces of `E`, which it is convenient to be able to discuss using `ι → 𝕜` rather than `Π i : ι, span 𝕜 (v i)`. -/ def OrthogonalFamily (G : ι → Type*) [∀ i, SeminormedAddCommGroup (G i)] [∀ i, InnerProductSpace 𝕜 (G i)] (V : ∀ i, G i →ₗᵢ[𝕜] E) : Prop := Pairwise fun i j => ∀ v : G i, ∀ w : G j, ⟪V i v, V j w⟫ = 0 variable {𝕜} variable {G : ι → Type*} [∀ i, NormedAddCommGroup (G i)] [∀ i, InnerProductSpace 𝕜 (G i)] {V : ∀ i, G i →ₗᵢ[𝕜] E} (hV : OrthogonalFamily 𝕜 G V) [dec_V : ∀ (i) (x : G i), Decidable (x ≠ 0)] theorem Orthonormal.orthogonalFamily {v : ι → E} (hv : Orthonormal 𝕜 v) : OrthogonalFamily 𝕜 (fun _i : ι => 𝕜) fun i => LinearIsometry.toSpanSingleton 𝕜 E (hv.1 i) := fun i j hij a b => by simp [inner_smul_left, inner_smul_right, hv.2 hij] theorem OrthogonalFamily.eq_ite [DecidableEq ι] {i j : ι} (v : G i) (w : G j) : ⟪V i v, V j w⟫ = ite (i = j) ⟪V i v, V j w⟫ 0 := by split_ifs with h · rfl · exact hV h v w theorem OrthogonalFamily.inner_right_dfinsupp [DecidableEq ι] (l : ⨁ i, G i) (i : ι) (v : G i) : ⟪V i v, l.sum fun j => V j⟫ = ⟪v, l i⟫ := calc ⟪V i v, l.sum fun j => V j⟫ = l.sum fun j => fun w => ⟪V i v, V j w⟫ := DFinsupp.inner_sum (fun j => V j) l (V i v) _ = l.sum fun j => fun w => ite (i = j) ⟪V i v, V j w⟫ 0 := (congr_arg l.sum <| funext fun j => funext <| hV.eq_ite v) _ = ⟪v, l i⟫ := by simp only [DFinsupp.sum, Submodule.coe_inner, Finset.sum_ite_eq, ite_eq_left_iff, DFinsupp.mem_support_toFun] split_ifs with h · simp only [LinearIsometry.inner_map_map] · simp only [of_not_not h, inner_zero_right] theorem OrthogonalFamily.inner_right_fintype [Fintype ι] (l : ∀ i, G i) (i : ι) (v : G i) : ⟪V i v, ∑ j : ι, V j (l j)⟫ = ⟪v, l i⟫ := by classical calc ⟪V i v, ∑ j : ι, V j (l j)⟫ = ∑ j : ι, ⟪V i v, V j (l j)⟫ := by rw [inner_sum] _ = ∑ j, ite (i = j) ⟪V i v, V j (l j)⟫ 0 := (congr_arg (Finset.sum Finset.univ) <| funext fun j => hV.eq_ite v (l j)) _ = ⟪v, l i⟫ := by simp only [Finset.sum_ite_eq, Finset.mem_univ, (V i).inner_map_map, if_true] theorem OrthogonalFamily.inner_sum (l₁ l₂ : ∀ i, G i) (s : Finset ι) : ⟪∑ i ∈ s, V i (l₁ i), ∑ j ∈ s, V j (l₂ j)⟫ = ∑ i ∈ s, ⟪l₁ i, l₂ i⟫ := by classical calc ⟪∑ i ∈ s, V i (l₁ i), ∑ j ∈ s, V j (l₂ j)⟫ = ∑ j ∈ s, ∑ i ∈ s, ⟪V i (l₁ i), V j (l₂ j)⟫ := by simp only [_root_.sum_inner, _root_.inner_sum] _ = ∑ j ∈ s, ∑ i ∈ s, ite (i = j) ⟪V i (l₁ i), V j (l₂ j)⟫ 0 := by congr with i congr with j apply hV.eq_ite _ = ∑ i ∈ s, ⟪l₁ i, l₂ i⟫ := by simp only [Finset.sum_ite_of_true, Finset.sum_ite_eq', LinearIsometry.inner_map_map, imp_self, imp_true_iff] theorem OrthogonalFamily.norm_sum (l : ∀ i, G i) (s : Finset ι) : ‖∑ i ∈ s, V i (l i)‖ ^ 2 = ∑ i ∈ s, ‖l i‖ ^ 2 := by have : ((‖∑ i ∈ s, V i (l i)‖ : ℝ) : 𝕜) ^ 2 = ∑ i ∈ s, ((‖l i‖ : ℝ) : 𝕜) ^ 2 := by simp only [← inner_self_eq_norm_sq_to_K, hV.inner_sum] exact mod_cast this /-- The composition of an orthogonal family of subspaces with an injective function is also an orthogonal family. -/ theorem OrthogonalFamily.comp {γ : Type*} {f : γ → ι} (hf : Function.Injective f) : OrthogonalFamily 𝕜 (fun g => G (f g)) fun g => V (f g) := fun _i _j hij v w => hV (hf.ne hij) v w theorem OrthogonalFamily.orthonormal_sigma_orthonormal {α : ι → Type*} {v_family : ∀ i, α i → G i} (hv_family : ∀ i, Orthonormal 𝕜 (v_family i)) : Orthonormal 𝕜 fun a : Σi, α i => V a.1 (v_family a.1 a.2) := by constructor · rintro ⟨i, v⟩ simpa only [LinearIsometry.norm_map] using (hv_family i).left v rintro ⟨i, v⟩ ⟨j, w⟩ hvw by_cases hij : i = j · subst hij have : v ≠ w := fun h => by subst h exact hvw rfl simpa only [LinearIsometry.inner_map_map] using (hv_family i).2 this · exact hV hij (v_family i v) (v_family j w) theorem OrthogonalFamily.norm_sq_diff_sum [DecidableEq ι] (f : ∀ i, G i) (s₁ s₂ : Finset ι) : ‖(∑ i ∈ s₁, V i (f i)) - ∑ i ∈ s₂, V i (f i)‖ ^ 2 = (∑ i ∈ s₁ \ s₂, ‖f i‖ ^ 2) + ∑ i ∈ s₂ \ s₁, ‖f i‖ ^ 2 := by rw [← Finset.sum_sdiff_sub_sum_sdiff, sub_eq_add_neg, ← Finset.sum_neg_distrib] let F : ∀ i, G i := fun i => if i ∈ s₁ then f i else -f i have hF₁ : ∀ i ∈ s₁ \ s₂, F i = f i := fun i hi => if_pos (Finset.sdiff_subset hi) have hF₂ : ∀ i ∈ s₂ \ s₁, F i = -f i := fun i hi => if_neg (Finset.mem_sdiff.mp hi).2 have hF : ∀ i, ‖F i‖ = ‖f i‖ := by intro i dsimp only [F] split_ifs <;> simp only [eq_self_iff_true, norm_neg] have : ‖(∑ i ∈ s₁ \ s₂, V i (F i)) + ∑ i ∈ s₂ \ s₁, V i (F i)‖ ^ 2 = (∑ i ∈ s₁ \ s₂, ‖F i‖ ^ 2) + ∑ i ∈ s₂ \ s₁, ‖F i‖ ^ 2 := by have hs : Disjoint (s₁ \ s₂) (s₂ \ s₁) := disjoint_sdiff_sdiff simpa only [Finset.sum_union hs] using hV.norm_sum F (s₁ \ s₂ ∪ s₂ \ s₁) convert this using 4 · refine Finset.sum_congr rfl fun i hi => ?_ simp only [hF₁ i hi] · refine Finset.sum_congr rfl fun i hi => ?_ simp only [hF₂ i hi, LinearIsometry.map_neg] · simp only [hF] · simp only [hF] /-- A family `f` of mutually-orthogonal elements of `E` is summable, if and only if `(fun i ↦ ‖f i‖ ^ 2)` is summable. -/ theorem OrthogonalFamily.summable_iff_norm_sq_summable [CompleteSpace E] (f : ∀ i, G i) : (Summable fun i => V i (f i)) ↔ Summable fun i => ‖f i‖ ^ 2 := by classical simp only [summable_iff_cauchySeq_finset, NormedAddCommGroup.cauchySeq_iff, Real.norm_eq_abs] constructor · intro hf ε hε obtain ⟨a, H⟩ := hf _ (sqrt_pos.mpr hε) use a intro s₁ hs₁ s₂ hs₂ rw [← Finset.sum_sdiff_sub_sum_sdiff] refine (abs_sub _ _).trans_lt ?_ have : ∀ i, 0 ≤ ‖f i‖ ^ 2 := fun i : ι => sq_nonneg _ simp only [Finset.abs_sum_of_nonneg' this] have : ((∑ i ∈ s₁ \ s₂, ‖f i‖ ^ 2) + ∑ i ∈ s₂ \ s₁, ‖f i‖ ^ 2) < √ε ^ 2 := by rw [← hV.norm_sq_diff_sum, sq_lt_sq, abs_of_nonneg (sqrt_nonneg _), abs_of_nonneg (norm_nonneg _)] exact H s₁ hs₁ s₂ hs₂ have hη := sq_sqrt (le_of_lt hε) linarith · intro hf ε hε have hε' : 0 < ε ^ 2 / 2 := half_pos (sq_pos_of_pos hε) obtain ⟨a, H⟩ := hf _ hε' use a intro s₁ hs₁ s₂ hs₂ refine (abs_lt_of_sq_lt_sq' ?_ (le_of_lt hε)).2 have has : a ≤ s₁ ⊓ s₂ := le_inf hs₁ hs₂ rw [hV.norm_sq_diff_sum] have Hs₁ : ∑ x ∈ s₁ \ s₂, ‖f x‖ ^ 2 < ε ^ 2 / 2 := by convert H _ hs₁ _ has have : s₁ ⊓ s₂ ⊆ s₁ := Finset.inter_subset_left rw [← Finset.sum_sdiff this, add_tsub_cancel_right, Finset.abs_sum_of_nonneg'] · simp · exact fun i => sq_nonneg _ have Hs₂ : ∑ x ∈ s₂ \ s₁, ‖f x‖ ^ 2 < ε ^ 2 / 2 := by convert H _ hs₂ _ has have : s₁ ⊓ s₂ ⊆ s₂ := Finset.inter_subset_right rw [← Finset.sum_sdiff this, add_tsub_cancel_right, Finset.abs_sum_of_nonneg'] · simp · exact fun i => sq_nonneg _ linarith end OrthogonalFamily_Seminormed section OrthogonalFamily variable [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y local notation "IK" => @RCLike.I 𝕜 _ local postfix:90 "†" => starRingEnd _ variable {ι : Type*} variable {G : ι → Type*} [∀ i, NormedAddCommGroup (G i)] [∀ i, InnerProductSpace 𝕜 (G i)] {V : ∀ i, G i →ₗᵢ[𝕜] E} (hV : OrthogonalFamily 𝕜 G V) [dec_V : ∀ (i) (x : G i), Decidable (x ≠ 0)] /-- An orthogonal family forms an independent family of subspaces; that is, any collection of elements each from a different subspace in the family is linearly independent. In particular, the pairwise intersections of elements of the family are 0. -/ theorem OrthogonalFamily.independent {V : ι → Submodule 𝕜 E} (hV : OrthogonalFamily 𝕜 (fun i => V i) fun i => (V i).subtypeₗᵢ) : CompleteLattice.Independent V := by classical apply CompleteLattice.independent_of_dfinsupp_lsum_injective refine LinearMap.ker_eq_bot.mp ?_ rw [Submodule.eq_bot_iff] intro v hv rw [LinearMap.mem_ker] at hv ext i suffices ⟪(v i : E), v i⟫ = 0 by simpa only [inner_self_eq_zero] using this calc ⟪(v i : E), v i⟫ = ⟪(v i : E), DFinsupp.lsum ℕ (fun i => (V i).subtype) v⟫ := by simpa only [DFinsupp.sumAddHom_apply, DFinsupp.lsum_apply_apply] using (hV.inner_right_dfinsupp v i (v i)).symm _ = 0 := by simp only [hv, inner_zero_right] theorem DirectSum.IsInternal.collectedBasis_orthonormal [DecidableEq ι] {V : ι → Submodule 𝕜 E} (hV : OrthogonalFamily 𝕜 (fun i => V i) fun i => (V i).subtypeₗᵢ) (hV_sum : DirectSum.IsInternal fun i => V i) {α : ι → Type*} {v_family : ∀ i, Basis (α i) 𝕜 (V i)} (hv_family : ∀ i, Orthonormal 𝕜 (v_family i)) : Orthonormal 𝕜 (hV_sum.collectedBasis v_family) := by simpa only [hV_sum.collectedBasis_coe] using hV.orthonormal_sigma_orthonormal hv_family end OrthogonalFamily section RCLikeToReal variable {G : Type*} variable (𝕜 E) variable [SeminormedAddCommGroup E] [InnerProductSpace 𝕜 E] local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y local notation "IK" => @RCLike.I 𝕜 _ local postfix:90 "†" => starRingEnd _ /-- A general inner product implies a real inner product. This is not registered as an instance since it creates problems with the case `𝕜 = ℝ`. -/ def Inner.rclikeToReal : Inner ℝ E where inner x y := re ⟪x, y⟫ /-- A general inner product space structure implies a real inner product structure. This is not registered as an instance since it creates problems with the case `𝕜 = ℝ`, but in can be used in a proof to obtain a real inner product space structure from a given `𝕜`-inner product space structure. -/ def InnerProductSpace.rclikeToReal : InnerProductSpace ℝ E := { Inner.rclikeToReal 𝕜 E, NormedSpace.restrictScalars ℝ 𝕜 E with norm_sq_eq_inner := norm_sq_eq_inner conj_symm := fun x y => inner_re_symm _ _ add_left := fun x y z => by change re ⟪x + y, z⟫ = re ⟪x, z⟫ + re ⟪y, z⟫ simp only [inner_add_left, map_add] smul_left := fun x y r => by change re ⟪(r : 𝕜) • x, y⟫ = r * re ⟪x, y⟫ simp only [inner_smul_left, conj_ofReal, re_ofReal_mul] } variable {E} theorem real_inner_eq_re_inner (x y : E) : @Inner.inner ℝ E (Inner.rclikeToReal 𝕜 E) x y = re ⟪x, y⟫ := rfl theorem real_inner_I_smul_self (x : E) : @Inner.inner ℝ E (Inner.rclikeToReal 𝕜 E) x ((I : 𝕜) • x) = 0 := by simp [real_inner_eq_re_inner 𝕜, inner_smul_right] /-- A complex inner product implies a real inner product. This cannot be an instance since it creates a diamond with `PiLp.innerProductSpace` because `re (sum i, inner (x i) (y i))` and `sum i, re (inner (x i) (y i))` are not defeq. -/ def InnerProductSpace.complexToReal [SeminormedAddCommGroup G] [InnerProductSpace ℂ G] : InnerProductSpace ℝ G := InnerProductSpace.rclikeToReal ℂ G instance : InnerProductSpace ℝ ℂ := InnerProductSpace.complexToReal @[simp] protected theorem Complex.inner (w z : ℂ) : ⟪w, z⟫_ℝ = (conj w * z).re := rfl /-- The inner product on an inner product space of dimension 2 can be evaluated in terms of a complex-number representation of the space. -/ theorem inner_map_complex [SeminormedAddCommGroup G] [InnerProductSpace ℝ G] (f : G ≃ₗᵢ[ℝ] ℂ) (x y : G) : ⟪x, y⟫_ℝ = (conj (f x) * f y).re := by rw [← Complex.inner, f.inner_map_map] instance : InnerProductSpace ℝ ℂ := InnerProductSpace.complexToReal end RCLikeToReal section Continuous variable [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y local notation "IK" => @RCLike.I 𝕜 _ local postfix:90 "†" => starRingEnd _ /-! ### Continuity of the inner product -/ theorem continuous_inner : Continuous fun p : E × E => ⟪p.1, p.2⟫ := letI : InnerProductSpace ℝ E := InnerProductSpace.rclikeToReal 𝕜 E isBoundedBilinearMap_inner.continuous variable {α : Type*} theorem Filter.Tendsto.inner {f g : α → E} {l : Filter α} {x y : E} (hf : Tendsto f l (𝓝 x)) (hg : Tendsto g l (𝓝 y)) : Tendsto (fun t => ⟪f t, g t⟫) l (𝓝 ⟪x, y⟫) := (continuous_inner.tendsto _).comp (hf.prod_mk_nhds hg) variable [TopologicalSpace α] {f g : α → E} {x : α} {s : Set α} theorem ContinuousWithinAt.inner (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) : ContinuousWithinAt (fun t => ⟪f t, g t⟫) s x := Filter.Tendsto.inner hf hg theorem ContinuousAt.inner (hf : ContinuousAt f x) (hg : ContinuousAt g x) : ContinuousAt (fun t => ⟪f t, g t⟫) x := Filter.Tendsto.inner hf hg theorem ContinuousOn.inner (hf : ContinuousOn f s) (hg : ContinuousOn g s) : ContinuousOn (fun t => ⟪f t, g t⟫) s := fun x hx => (hf x hx).inner (hg x hx) @[continuity] theorem Continuous.inner (hf : Continuous f) (hg : Continuous g) : Continuous fun t => ⟪f t, g t⟫ := continuous_iff_continuousAt.2 fun _x => hf.continuousAt.inner hg.continuousAt end Continuous section ReApplyInnerSelf variable [SeminormedAddCommGroup E] [InnerProductSpace 𝕜 E] local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y local notation "IK" => @RCLike.I 𝕜 _ local postfix:90 "†" => starRingEnd _ /-- Extract a real bilinear form from an operator `T`, by taking the pairing `fun x ↦ re ⟪T x, x⟫`. -/ def ContinuousLinearMap.reApplyInnerSelf (T : E →L[𝕜] E) (x : E) : ℝ := re ⟪T x, x⟫ theorem ContinuousLinearMap.reApplyInnerSelf_apply (T : E →L[𝕜] E) (x : E) : T.reApplyInnerSelf x = re ⟪T x, x⟫ := rfl end ReApplyInnerSelf section ReApplyInnerSelf_Seminormed variable [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y local notation "IK" => @RCLike.I 𝕜 _ local postfix:90 "†" => starRingEnd _ theorem ContinuousLinearMap.reApplyInnerSelf_continuous (T : E →L[𝕜] E) : Continuous T.reApplyInnerSelf := reCLM.continuous.comp <| T.continuous.inner continuous_id theorem ContinuousLinearMap.reApplyInnerSelf_smul (T : E →L[𝕜] E) (x : E) {c : 𝕜} : T.reApplyInnerSelf (c • x) = ‖c‖ ^ 2 * T.reApplyInnerSelf x := by simp only [ContinuousLinearMap.map_smul, ContinuousLinearMap.reApplyInnerSelf_apply, inner_smul_left, inner_smul_right, ← mul_assoc, mul_conj, ← ofReal_pow, ← smul_re, Algebra.smul_def (‖c‖ ^ 2) ⟪T x, x⟫, algebraMap_eq_ofReal] end ReApplyInnerSelf_Seminormed section UniformSpace.Completion variable [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y local notation "IK" => @RCLike.I 𝕜 _ local postfix:90 "†" => starRingEnd _ namespace UniformSpace.Completion open UniformSpace Function instance toInner {𝕜' E' : Type*} [TopologicalSpace 𝕜'] [UniformSpace E'] [Inner 𝕜' E'] : Inner 𝕜' (Completion E') where inner := curry <| (denseInducing_coe.prod denseInducing_coe).extend (uncurry inner) @[simp] theorem inner_coe (a b : E) : inner (a : Completion E) (b : Completion E) = (inner a b : 𝕜) := (denseInducing_coe.prod denseInducing_coe).extend_eq (continuous_inner : Continuous (uncurry inner : E × E → 𝕜)) (a, b) protected theorem continuous_inner : Continuous (uncurry inner : Completion E × Completion E → 𝕜) := by let inner' : E →+ E →+ 𝕜 := { toFun := fun x => (innerₛₗ 𝕜 x).toAddMonoidHom map_zero' := by ext x; exact inner_zero_left _ map_add' := fun x y => by ext z; exact inner_add_left _ _ _ } have : Continuous fun p : E × E => inner' p.1 p.2 := continuous_inner rw [Completion.toInner, inner, uncurry_curry _] change Continuous (((denseInducing_toCompl E).prod (denseInducing_toCompl E)).extend fun p : E × E => inner' p.1 p.2) exact (denseInducing_toCompl E).extend_Z_bilin (denseInducing_toCompl E) this protected theorem Continuous.inner {α : Type*} [TopologicalSpace α] {f g : α → Completion E} (hf : Continuous f) (hg : Continuous g) : Continuous (fun x : α => inner (f x) (g x) : α → 𝕜) := UniformSpace.Completion.continuous_inner.comp (hf.prod_mk hg : _) instance innerProductSpace : InnerProductSpace 𝕜 (Completion E) where norm_sq_eq_inner x := Completion.induction_on x (isClosed_eq (continuous_norm.pow 2) (continuous_re.comp (Continuous.inner continuous_id' continuous_id'))) fun a => by simp only [norm_coe, inner_coe, inner_self_eq_norm_sq] conj_symm x y := Completion.induction_on₂ x y (isClosed_eq (continuous_conj.comp (Continuous.inner continuous_snd continuous_fst)) (Continuous.inner continuous_fst continuous_snd)) fun a b => by simp only [inner_coe, inner_conj_symm] add_left x y z := Completion.induction_on₃ x y z (isClosed_eq (Continuous.inner (continuous_fst.add (continuous_fst.comp continuous_snd)) (continuous_snd.comp continuous_snd)) ((Continuous.inner continuous_fst (continuous_snd.comp continuous_snd)).add (Continuous.inner (continuous_fst.comp continuous_snd) (continuous_snd.comp continuous_snd)))) fun a b c => by simp only [← coe_add, inner_coe, inner_add_left] smul_left x y c := Completion.induction_on₂ x y (isClosed_eq (Continuous.inner (continuous_fst.const_smul c) continuous_snd) ((continuous_mul_left _).comp (Continuous.inner continuous_fst continuous_snd))) fun a b => by simp only [← coe_smul c a, inner_coe, inner_smul_left] end UniformSpace.Completion end UniformSpace.Completion
Analysis\InnerProductSpace\Calculus.lean
/- Copyright (c) 2020 Yury Kudryashov. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yury Kudryashov -/ import Mathlib.Analysis.InnerProductSpace.PiL2 import Mathlib.Analysis.SpecialFunctions.Sqrt import Mathlib.Analysis.NormedSpace.HomeomorphBall /-! # Calculus in inner product spaces In this file we prove that the inner product and square of the norm in an inner space are infinitely `ℝ`-smooth. In order to state these results, we need a `NormedSpace ℝ E` instance. Though we can deduce this structure from `InnerProductSpace 𝕜 E`, this instance may be not definitionally equal to some other “natural” instance. So, we assume `[NormedSpace ℝ E]`. We also prove that functions to a `EuclideanSpace` are (higher) differentiable if and only if their components are. This follows from the corresponding fact for finite product of normed spaces, and from the equivalence of norms in finite dimensions. ## TODO The last part of the file should be generalized to `PiLp`. -/ noncomputable section open RCLike Real Filter section DerivInner variable {𝕜 E F : Type*} [RCLike 𝕜] variable [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] variable [NormedAddCommGroup F] [InnerProductSpace ℝ F] local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y variable (𝕜) [NormedSpace ℝ E] /-- Derivative of the inner product. -/ def fderivInnerCLM (p : E × E) : E × E →L[ℝ] 𝕜 := isBoundedBilinearMap_inner.deriv p @[simp] theorem fderivInnerCLM_apply (p x : E × E) : fderivInnerCLM 𝕜 p x = ⟪p.1, x.2⟫ + ⟪x.1, p.2⟫ := rfl variable {𝕜} -- Porting note: Lean 3 magically switches back to `{𝕜}` here theorem contDiff_inner {n} : ContDiff ℝ n fun p : E × E => ⟪p.1, p.2⟫ := isBoundedBilinearMap_inner.contDiff theorem contDiffAt_inner {p : E × E} {n} : ContDiffAt ℝ n (fun p : E × E => ⟪p.1, p.2⟫) p := ContDiff.contDiffAt contDiff_inner theorem differentiable_inner : Differentiable ℝ fun p : E × E => ⟪p.1, p.2⟫ := isBoundedBilinearMap_inner.differentiableAt variable (𝕜) variable {G : Type*} [NormedAddCommGroup G] [NormedSpace ℝ G] {f g : G → E} {f' g' : G →L[ℝ] E} {s : Set G} {x : G} {n : ℕ∞} theorem ContDiffWithinAt.inner (hf : ContDiffWithinAt ℝ n f s x) (hg : ContDiffWithinAt ℝ n g s x) : ContDiffWithinAt ℝ n (fun x => ⟪f x, g x⟫) s x := contDiffAt_inner.comp_contDiffWithinAt x (hf.prod hg) nonrec theorem ContDiffAt.inner (hf : ContDiffAt ℝ n f x) (hg : ContDiffAt ℝ n g x) : ContDiffAt ℝ n (fun x => ⟪f x, g x⟫) x := hf.inner 𝕜 hg theorem ContDiffOn.inner (hf : ContDiffOn ℝ n f s) (hg : ContDiffOn ℝ n g s) : ContDiffOn ℝ n (fun x => ⟪f x, g x⟫) s := fun x hx => (hf x hx).inner 𝕜 (hg x hx) theorem ContDiff.inner (hf : ContDiff ℝ n f) (hg : ContDiff ℝ n g) : ContDiff ℝ n fun x => ⟪f x, g x⟫ := contDiff_inner.comp (hf.prod hg) theorem HasFDerivWithinAt.inner (hf : HasFDerivWithinAt f f' s x) (hg : HasFDerivWithinAt g g' s x) : HasFDerivWithinAt (fun t => ⟪f t, g t⟫) ((fderivInnerCLM 𝕜 (f x, g x)).comp <| f'.prod g') s x := (isBoundedBilinearMap_inner.hasFDerivAt (f x, g x)).comp_hasFDerivWithinAt x (hf.prod hg) theorem HasStrictFDerivAt.inner (hf : HasStrictFDerivAt f f' x) (hg : HasStrictFDerivAt g g' x) : HasStrictFDerivAt (fun t => ⟪f t, g t⟫) ((fderivInnerCLM 𝕜 (f x, g x)).comp <| f'.prod g') x := (isBoundedBilinearMap_inner.hasStrictFDerivAt (f x, g x)).comp x (hf.prod hg) theorem HasFDerivAt.inner (hf : HasFDerivAt f f' x) (hg : HasFDerivAt g g' x) : HasFDerivAt (fun t => ⟪f t, g t⟫) ((fderivInnerCLM 𝕜 (f x, g x)).comp <| f'.prod g') x := (isBoundedBilinearMap_inner.hasFDerivAt (f x, g x)).comp x (hf.prod hg) theorem HasDerivWithinAt.inner {f g : ℝ → E} {f' g' : E} {s : Set ℝ} {x : ℝ} (hf : HasDerivWithinAt f f' s x) (hg : HasDerivWithinAt g g' s x) : HasDerivWithinAt (fun t => ⟪f t, g t⟫) (⟪f x, g'⟫ + ⟪f', g x⟫) s x := by simpa using (hf.hasFDerivWithinAt.inner 𝕜 hg.hasFDerivWithinAt).hasDerivWithinAt theorem HasDerivAt.inner {f g : ℝ → E} {f' g' : E} {x : ℝ} : HasDerivAt f f' x → HasDerivAt g g' x → HasDerivAt (fun t => ⟪f t, g t⟫) (⟪f x, g'⟫ + ⟪f', g x⟫) x := by simpa only [← hasDerivWithinAt_univ] using HasDerivWithinAt.inner 𝕜 theorem DifferentiableWithinAt.inner (hf : DifferentiableWithinAt ℝ f s x) (hg : DifferentiableWithinAt ℝ g s x) : DifferentiableWithinAt ℝ (fun x => ⟪f x, g x⟫) s x := ((differentiable_inner _).hasFDerivAt.comp_hasFDerivWithinAt x (hf.prod hg).hasFDerivWithinAt).differentiableWithinAt theorem DifferentiableAt.inner (hf : DifferentiableAt ℝ f x) (hg : DifferentiableAt ℝ g x) : DifferentiableAt ℝ (fun x => ⟪f x, g x⟫) x := (differentiable_inner _).comp x (hf.prod hg) theorem DifferentiableOn.inner (hf : DifferentiableOn ℝ f s) (hg : DifferentiableOn ℝ g s) : DifferentiableOn ℝ (fun x => ⟪f x, g x⟫) s := fun x hx => (hf x hx).inner 𝕜 (hg x hx) theorem Differentiable.inner (hf : Differentiable ℝ f) (hg : Differentiable ℝ g) : Differentiable ℝ fun x => ⟪f x, g x⟫ := fun x => (hf x).inner 𝕜 (hg x) theorem fderiv_inner_apply (hf : DifferentiableAt ℝ f x) (hg : DifferentiableAt ℝ g x) (y : G) : fderiv ℝ (fun t => ⟪f t, g t⟫) x y = ⟪f x, fderiv ℝ g x y⟫ + ⟪fderiv ℝ f x y, g x⟫ := by rw [(hf.hasFDerivAt.inner 𝕜 hg.hasFDerivAt).fderiv]; rfl theorem deriv_inner_apply {f g : ℝ → E} {x : ℝ} (hf : DifferentiableAt ℝ f x) (hg : DifferentiableAt ℝ g x) : deriv (fun t => ⟪f t, g t⟫) x = ⟪f x, deriv g x⟫ + ⟪deriv f x, g x⟫ := (hf.hasDerivAt.inner 𝕜 hg.hasDerivAt).deriv theorem contDiff_norm_sq : ContDiff ℝ n fun x : E => ‖x‖ ^ 2 := by convert (reCLM : 𝕜 →L[ℝ] ℝ).contDiff.comp ((contDiff_id (E := E)).inner 𝕜 (contDiff_id (E := E))) exact (inner_self_eq_norm_sq _).symm theorem ContDiff.norm_sq (hf : ContDiff ℝ n f) : ContDiff ℝ n fun x => ‖f x‖ ^ 2 := (contDiff_norm_sq 𝕜).comp hf theorem ContDiffWithinAt.norm_sq (hf : ContDiffWithinAt ℝ n f s x) : ContDiffWithinAt ℝ n (fun y => ‖f y‖ ^ 2) s x := (contDiff_norm_sq 𝕜).contDiffAt.comp_contDiffWithinAt x hf nonrec theorem ContDiffAt.norm_sq (hf : ContDiffAt ℝ n f x) : ContDiffAt ℝ n (‖f ·‖ ^ 2) x := hf.norm_sq 𝕜 theorem contDiffAt_norm {x : E} (hx : x ≠ 0) : ContDiffAt ℝ n norm x := by have : ‖id x‖ ^ 2 ≠ 0 := pow_ne_zero 2 (norm_pos_iff.2 hx).ne' simpa only [id, sqrt_sq, norm_nonneg] using (contDiffAt_id.norm_sq 𝕜).sqrt this theorem ContDiffAt.norm (hf : ContDiffAt ℝ n f x) (h0 : f x ≠ 0) : ContDiffAt ℝ n (fun y => ‖f y‖) x := (contDiffAt_norm 𝕜 h0).comp x hf theorem ContDiffAt.dist (hf : ContDiffAt ℝ n f x) (hg : ContDiffAt ℝ n g x) (hne : f x ≠ g x) : ContDiffAt ℝ n (fun y => dist (f y) (g y)) x := by simp only [dist_eq_norm] exact (hf.sub hg).norm 𝕜 (sub_ne_zero.2 hne) theorem ContDiffWithinAt.norm (hf : ContDiffWithinAt ℝ n f s x) (h0 : f x ≠ 0) : ContDiffWithinAt ℝ n (fun y => ‖f y‖) s x := (contDiffAt_norm 𝕜 h0).comp_contDiffWithinAt x hf theorem ContDiffWithinAt.dist (hf : ContDiffWithinAt ℝ n f s x) (hg : ContDiffWithinAt ℝ n g s x) (hne : f x ≠ g x) : ContDiffWithinAt ℝ n (fun y => dist (f y) (g y)) s x := by simp only [dist_eq_norm]; exact (hf.sub hg).norm 𝕜 (sub_ne_zero.2 hne) theorem ContDiffOn.norm_sq (hf : ContDiffOn ℝ n f s) : ContDiffOn ℝ n (fun y => ‖f y‖ ^ 2) s := fun x hx => (hf x hx).norm_sq 𝕜 theorem ContDiffOn.norm (hf : ContDiffOn ℝ n f s) (h0 : ∀ x ∈ s, f x ≠ 0) : ContDiffOn ℝ n (fun y => ‖f y‖) s := fun x hx => (hf x hx).norm 𝕜 (h0 x hx) theorem ContDiffOn.dist (hf : ContDiffOn ℝ n f s) (hg : ContDiffOn ℝ n g s) (hne : ∀ x ∈ s, f x ≠ g x) : ContDiffOn ℝ n (fun y => dist (f y) (g y)) s := fun x hx => (hf x hx).dist 𝕜 (hg x hx) (hne x hx) theorem ContDiff.norm (hf : ContDiff ℝ n f) (h0 : ∀ x, f x ≠ 0) : ContDiff ℝ n fun y => ‖f y‖ := contDiff_iff_contDiffAt.2 fun x => hf.contDiffAt.norm 𝕜 (h0 x) theorem ContDiff.dist (hf : ContDiff ℝ n f) (hg : ContDiff ℝ n g) (hne : ∀ x, f x ≠ g x) : ContDiff ℝ n fun y => dist (f y) (g y) := contDiff_iff_contDiffAt.2 fun x => hf.contDiffAt.dist 𝕜 hg.contDiffAt (hne x) -- Porting note: use `2 •` instead of `bit0` theorem hasStrictFDerivAt_norm_sq (x : F) : HasStrictFDerivAt (fun x => ‖x‖ ^ 2) (2 • (innerSL ℝ x)) x := by simp only [sq, ← @inner_self_eq_norm_mul_norm ℝ] convert (hasStrictFDerivAt_id x).inner ℝ (hasStrictFDerivAt_id x) ext y simp [two_smul, real_inner_comm] theorem HasFDerivAt.norm_sq {f : G → F} {f' : G →L[ℝ] F} (hf : HasFDerivAt f f' x) : HasFDerivAt (‖f ·‖ ^ 2) (2 • (innerSL ℝ (f x)).comp f') x := (hasStrictFDerivAt_norm_sq _).hasFDerivAt.comp x hf theorem HasDerivAt.norm_sq {f : ℝ → F} {f' : F} {x : ℝ} (hf : HasDerivAt f f' x) : HasDerivAt (‖f ·‖ ^ 2) (2 * Inner.inner (f x) f') x := by simpa using hf.hasFDerivAt.norm_sq.hasDerivAt theorem HasFDerivWithinAt.norm_sq {f : G → F} {f' : G →L[ℝ] F} (hf : HasFDerivWithinAt f f' s x) : HasFDerivWithinAt (‖f ·‖ ^ 2) (2 • (innerSL ℝ (f x)).comp f') s x := (hasStrictFDerivAt_norm_sq _).hasFDerivAt.comp_hasFDerivWithinAt x hf theorem HasDerivWithinAt.norm_sq {f : ℝ → F} {f' : F} {s : Set ℝ} {x : ℝ} (hf : HasDerivWithinAt f f' s x) : HasDerivWithinAt (‖f ·‖ ^ 2) (2 * Inner.inner (f x) f') s x := by simpa using hf.hasFDerivWithinAt.norm_sq.hasDerivWithinAt theorem DifferentiableAt.norm_sq (hf : DifferentiableAt ℝ f x) : DifferentiableAt ℝ (fun y => ‖f y‖ ^ 2) x := ((contDiffAt_id.norm_sq 𝕜).differentiableAt le_rfl).comp x hf theorem DifferentiableAt.norm (hf : DifferentiableAt ℝ f x) (h0 : f x ≠ 0) : DifferentiableAt ℝ (fun y => ‖f y‖) x := ((contDiffAt_norm 𝕜 h0).differentiableAt le_rfl).comp x hf theorem DifferentiableAt.dist (hf : DifferentiableAt ℝ f x) (hg : DifferentiableAt ℝ g x) (hne : f x ≠ g x) : DifferentiableAt ℝ (fun y => dist (f y) (g y)) x := by simp only [dist_eq_norm]; exact (hf.sub hg).norm 𝕜 (sub_ne_zero.2 hne) theorem Differentiable.norm_sq (hf : Differentiable ℝ f) : Differentiable ℝ fun y => ‖f y‖ ^ 2 := fun x => (hf x).norm_sq 𝕜 theorem Differentiable.norm (hf : Differentiable ℝ f) (h0 : ∀ x, f x ≠ 0) : Differentiable ℝ fun y => ‖f y‖ := fun x => (hf x).norm 𝕜 (h0 x) theorem Differentiable.dist (hf : Differentiable ℝ f) (hg : Differentiable ℝ g) (hne : ∀ x, f x ≠ g x) : Differentiable ℝ fun y => dist (f y) (g y) := fun x => (hf x).dist 𝕜 (hg x) (hne x) theorem DifferentiableWithinAt.norm_sq (hf : DifferentiableWithinAt ℝ f s x) : DifferentiableWithinAt ℝ (fun y => ‖f y‖ ^ 2) s x := ((contDiffAt_id.norm_sq 𝕜).differentiableAt le_rfl).comp_differentiableWithinAt x hf theorem DifferentiableWithinAt.norm (hf : DifferentiableWithinAt ℝ f s x) (h0 : f x ≠ 0) : DifferentiableWithinAt ℝ (fun y => ‖f y‖) s x := ((contDiffAt_id.norm 𝕜 h0).differentiableAt le_rfl).comp_differentiableWithinAt x hf theorem DifferentiableWithinAt.dist (hf : DifferentiableWithinAt ℝ f s x) (hg : DifferentiableWithinAt ℝ g s x) (hne : f x ≠ g x) : DifferentiableWithinAt ℝ (fun y => dist (f y) (g y)) s x := by simp only [dist_eq_norm] exact (hf.sub hg).norm 𝕜 (sub_ne_zero.2 hne) theorem DifferentiableOn.norm_sq (hf : DifferentiableOn ℝ f s) : DifferentiableOn ℝ (fun y => ‖f y‖ ^ 2) s := fun x hx => (hf x hx).norm_sq 𝕜 theorem DifferentiableOn.norm (hf : DifferentiableOn ℝ f s) (h0 : ∀ x ∈ s, f x ≠ 0) : DifferentiableOn ℝ (fun y => ‖f y‖) s := fun x hx => (hf x hx).norm 𝕜 (h0 x hx) theorem DifferentiableOn.dist (hf : DifferentiableOn ℝ f s) (hg : DifferentiableOn ℝ g s) (hne : ∀ x ∈ s, f x ≠ g x) : DifferentiableOn ℝ (fun y => dist (f y) (g y)) s := fun x hx => (hf x hx).dist 𝕜 (hg x hx) (hne x hx) end DerivInner section PiLike open ContinuousLinearMap variable {𝕜 ι H : Type*} [RCLike 𝕜] [NormedAddCommGroup H] [NormedSpace 𝕜 H] [Fintype ι] {f : H → EuclideanSpace 𝕜 ι} {f' : H →L[𝕜] EuclideanSpace 𝕜 ι} {t : Set H} {y : H} theorem differentiableWithinAt_euclidean : DifferentiableWithinAt 𝕜 f t y ↔ ∀ i, DifferentiableWithinAt 𝕜 (fun x => f x i) t y := by rw [← (EuclideanSpace.equiv ι 𝕜).comp_differentiableWithinAt_iff, differentiableWithinAt_pi] rfl theorem differentiableAt_euclidean : DifferentiableAt 𝕜 f y ↔ ∀ i, DifferentiableAt 𝕜 (fun x => f x i) y := by rw [← (EuclideanSpace.equiv ι 𝕜).comp_differentiableAt_iff, differentiableAt_pi] rfl theorem differentiableOn_euclidean : DifferentiableOn 𝕜 f t ↔ ∀ i, DifferentiableOn 𝕜 (fun x => f x i) t := by rw [← (EuclideanSpace.equiv ι 𝕜).comp_differentiableOn_iff, differentiableOn_pi] rfl theorem differentiable_euclidean : Differentiable 𝕜 f ↔ ∀ i, Differentiable 𝕜 fun x => f x i := by rw [← (EuclideanSpace.equiv ι 𝕜).comp_differentiable_iff, differentiable_pi] rfl theorem hasStrictFDerivAt_euclidean : HasStrictFDerivAt f f' y ↔ ∀ i, HasStrictFDerivAt (fun x => f x i) (EuclideanSpace.proj i ∘L f') y := by rw [← (EuclideanSpace.equiv ι 𝕜).comp_hasStrictFDerivAt_iff, hasStrictFDerivAt_pi'] rfl theorem hasFDerivWithinAt_euclidean : HasFDerivWithinAt f f' t y ↔ ∀ i, HasFDerivWithinAt (fun x => f x i) (EuclideanSpace.proj i ∘L f') t y := by rw [← (EuclideanSpace.equiv ι 𝕜).comp_hasFDerivWithinAt_iff, hasFDerivWithinAt_pi'] rfl theorem contDiffWithinAt_euclidean {n : ℕ∞} : ContDiffWithinAt 𝕜 n f t y ↔ ∀ i, ContDiffWithinAt 𝕜 n (fun x => f x i) t y := by rw [← (EuclideanSpace.equiv ι 𝕜).comp_contDiffWithinAt_iff, contDiffWithinAt_pi] rfl theorem contDiffAt_euclidean {n : ℕ∞} : ContDiffAt 𝕜 n f y ↔ ∀ i, ContDiffAt 𝕜 n (fun x => f x i) y := by rw [← (EuclideanSpace.equiv ι 𝕜).comp_contDiffAt_iff, contDiffAt_pi] rfl theorem contDiffOn_euclidean {n : ℕ∞} : ContDiffOn 𝕜 n f t ↔ ∀ i, ContDiffOn 𝕜 n (fun x => f x i) t := by rw [← (EuclideanSpace.equiv ι 𝕜).comp_contDiffOn_iff, contDiffOn_pi] rfl theorem contDiff_euclidean {n : ℕ∞} : ContDiff 𝕜 n f ↔ ∀ i, ContDiff 𝕜 n fun x => f x i := by rw [← (EuclideanSpace.equiv ι 𝕜).comp_contDiff_iff, contDiff_pi] rfl end PiLike section DiffeomorphUnitBall open Metric hiding mem_nhds_iff variable {n : ℕ∞} {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] theorem PartialHomeomorph.contDiff_univUnitBall : ContDiff ℝ n (univUnitBall : E → E) := by suffices ContDiff ℝ n fun x : E => (√(1 + ‖x‖ ^ 2 : ℝ))⁻¹ from this.smul contDiff_id have h : ∀ x : E, (0 : ℝ) < (1 : ℝ) + ‖x‖ ^ 2 := fun x => by positivity refine ContDiff.inv ?_ fun x => Real.sqrt_ne_zero'.mpr (h x) exact (contDiff_const.add <| contDiff_norm_sq ℝ).sqrt fun x => (h x).ne' theorem PartialHomeomorph.contDiffOn_univUnitBall_symm : ContDiffOn ℝ n univUnitBall.symm (ball (0 : E) 1) := fun y hy ↦ by apply ContDiffAt.contDiffWithinAt suffices ContDiffAt ℝ n (fun y : E => (√(1 - ‖y‖ ^ 2 : ℝ))⁻¹) y from this.smul contDiffAt_id have h : (0 : ℝ) < (1 : ℝ) - ‖(y : E)‖ ^ 2 := by rwa [mem_ball_zero_iff, ← _root_.abs_one, ← abs_norm, ← sq_lt_sq, one_pow, ← sub_pos] at hy refine ContDiffAt.inv ?_ (Real.sqrt_ne_zero'.mpr h) refine (contDiffAt_sqrt h.ne').comp y ?_ exact contDiffAt_const.sub (contDiff_norm_sq ℝ).contDiffAt theorem Homeomorph.contDiff_unitBall : ContDiff ℝ n fun x : E => (unitBall x : E) := PartialHomeomorph.contDiff_univUnitBall namespace PartialHomeomorph variable {c : E} {r : ℝ} theorem contDiff_unitBallBall (hr : 0 < r) : ContDiff ℝ n (unitBallBall c r hr) := (contDiff_id.const_smul _).add contDiff_const theorem contDiff_unitBallBall_symm (hr : 0 < r) : ContDiff ℝ n (unitBallBall c r hr).symm := (contDiff_id.sub contDiff_const).const_smul _ theorem contDiff_univBall : ContDiff ℝ n (univBall c r) := by unfold univBall; split_ifs with h · exact (contDiff_unitBallBall h).comp contDiff_univUnitBall · exact contDiff_id.add contDiff_const theorem contDiffOn_univBall_symm : ContDiffOn ℝ n (univBall c r).symm (ball c r) := by unfold univBall; split_ifs with h · refine contDiffOn_univUnitBall_symm.comp (contDiff_unitBallBall_symm h).contDiffOn ?_ rw [← unitBallBall_source c r h, ← unitBallBall_target c r h] apply PartialHomeomorph.symm_mapsTo · exact contDiffOn_id.sub contDiffOn_const end PartialHomeomorph end DiffeomorphUnitBall
Analysis\InnerProductSpace\ConformalLinearMap.lean
/- Copyright (c) 2021 Yourong Zang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yourong Zang -/ import Mathlib.Analysis.NormedSpace.ConformalLinearMap import Mathlib.Analysis.InnerProductSpace.Basic /-! # Conformal maps between inner product spaces In an inner product space, a map is conformal iff it preserves inner products up to a scalar factor. -/ variable {E F : Type*} variable [NormedAddCommGroup E] [NormedAddCommGroup F] variable [InnerProductSpace ℝ E] [InnerProductSpace ℝ F] open LinearIsometry ContinuousLinearMap open RealInnerProductSpace /-- A map between two inner product spaces is a conformal map if and only if it preserves inner products up to a scalar factor, i.e., there exists a positive `c : ℝ` such that `⟪f u, f v⟫ = c * ⟪u, v⟫` for all `u`, `v`. -/ theorem isConformalMap_iff (f : E →L[ℝ] F) : IsConformalMap f ↔ ∃ c : ℝ, 0 < c ∧ ∀ u v : E, ⟪f u, f v⟫ = c * ⟪u, v⟫ := by constructor · rintro ⟨c₁, hc₁, li, rfl⟩ refine ⟨c₁ * c₁, mul_self_pos.2 hc₁, fun u v => ?_⟩ simp only [real_inner_smul_left, real_inner_smul_right, mul_assoc, coe_smul', coe_toContinuousLinearMap, Pi.smul_apply, inner_map_map] · rintro ⟨c₁, hc₁, huv⟩ obtain ⟨c, hc, rfl⟩ : ∃ c : ℝ, 0 < c ∧ c₁ = c * c := ⟨√c₁, Real.sqrt_pos.2 hc₁, (Real.mul_self_sqrt hc₁.le).symm⟩ refine ⟨c, hc.ne', (c⁻¹ • f : E →ₗ[ℝ] F).isometryOfInner fun u v => ?_, ?_⟩ · simp only [real_inner_smul_left, real_inner_smul_right, huv, mul_assoc, coe_smul, inv_mul_cancel_left₀ hc.ne', LinearMap.smul_apply, ContinuousLinearMap.coe_coe] · ext1 x exact (smul_inv_smul₀ hc.ne' (f x)).symm
Analysis\InnerProductSpace\Dual.lean
/- Copyright (c) 2020 Frédéric Dupuis. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Frédéric Dupuis -/ import Mathlib.Analysis.InnerProductSpace.Projection import Mathlib.Analysis.Normed.Module.Dual /-! # The Fréchet-Riesz representation theorem We consider an inner product space `E` over `𝕜`, which is either `ℝ` or `ℂ`. We define `toDualMap`, a conjugate-linear isometric embedding of `E` into its dual, which maps an element `x` of the space to `fun y => ⟪x, y⟫`. Under the hypothesis of completeness (i.e., for Hilbert spaces), we upgrade this to `toDual`, a conjugate-linear isometric *equivalence* of `E` onto its dual; that is, we establish the surjectivity of `toDualMap`. This is the Fréchet-Riesz representation theorem: every element of the dual of a Hilbert space `E` has the form `fun u => ⟪x, u⟫` for some `x : E`. For a bounded sesquilinear form `B : E →L⋆[𝕜] E →L[𝕜] 𝕜`, we define a map `InnerProductSpace.continuousLinearMapOfBilin B : E →L[𝕜] E`, given by substituting `E →L[𝕜] 𝕜` with `E` using `toDual`. ## References * [M. Einsiedler and T. Ward, *Functional Analysis, Spectral Theory, and Applications*] [EinsiedlerWard2017] ## Tags dual, Fréchet-Riesz -/ noncomputable section open scoped Classical open ComplexConjugate universe u v namespace InnerProductSpace open RCLike ContinuousLinearMap variable (𝕜 : Type*) variable (E : Type*) [RCLike 𝕜] [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] local notation "⟪" x ", " y "⟫" => @inner 𝕜 E _ x y local postfix:90 "†" => starRingEnd _ /-- An element `x` of an inner product space `E` induces an element of the dual space `Dual 𝕜 E`, the map `fun y => ⟪x, y⟫`; moreover this operation is a conjugate-linear isometric embedding of `E` into `Dual 𝕜 E`. If `E` is complete, this operation is surjective, hence a conjugate-linear isometric equivalence; see `toDual`. -/ def toDualMap : E →ₗᵢ⋆[𝕜] NormedSpace.Dual 𝕜 E := { innerSL 𝕜 with norm_map' := innerSL_apply_norm _ } variable {E} @[simp] theorem toDualMap_apply {x y : E} : toDualMap 𝕜 E x y = ⟪x, y⟫ := rfl theorem innerSL_norm [Nontrivial E] : ‖(innerSL 𝕜 : E →L⋆[𝕜] E →L[𝕜] 𝕜)‖ = 1 := show ‖(toDualMap 𝕜 E).toContinuousLinearMap‖ = 1 from LinearIsometry.norm_toContinuousLinearMap _ variable {𝕜} theorem ext_inner_left_basis {ι : Type*} {x y : E} (b : Basis ι 𝕜 E) (h : ∀ i : ι, ⟪b i, x⟫ = ⟪b i, y⟫) : x = y := by apply (toDualMap 𝕜 E).map_eq_iff.mp refine (Function.Injective.eq_iff ContinuousLinearMap.coe_injective).mp (Basis.ext b ?_) intro i simp only [ContinuousLinearMap.coe_coe] rw [toDualMap_apply, toDualMap_apply] rw [← inner_conj_symm] conv_rhs => rw [← inner_conj_symm] exact congr_arg conj (h i) theorem ext_inner_right_basis {ι : Type*} {x y : E} (b : Basis ι 𝕜 E) (h : ∀ i : ι, ⟪x, b i⟫ = ⟪y, b i⟫) : x = y := by refine ext_inner_left_basis b fun i => ?_ rw [← inner_conj_symm] conv_rhs => rw [← inner_conj_symm] exact congr_arg conj (h i) variable (𝕜) (E) variable [CompleteSpace E] /-- Fréchet-Riesz representation: any `ℓ` in the dual of a Hilbert space `E` is of the form `fun u => ⟪y, u⟫` for some `y : E`, i.e. `toDualMap` is surjective. -/ def toDual : E ≃ₗᵢ⋆[𝕜] NormedSpace.Dual 𝕜 E := LinearIsometryEquiv.ofSurjective (toDualMap 𝕜 E) (by intro ℓ set Y := LinearMap.ker ℓ by_cases htriv : Y = ⊤ · have hℓ : ℓ = 0 := by have h' := LinearMap.ker_eq_top.mp htriv rw [← coe_zero] at h' apply coe_injective exact h' exact ⟨0, by simp [hℓ]⟩ · rw [← Submodule.orthogonal_eq_bot_iff] at htriv change Yᗮ ≠ ⊥ at htriv rw [Submodule.ne_bot_iff] at htriv obtain ⟨z : E, hz : z ∈ Yᗮ, z_ne_0 : z ≠ 0⟩ := htriv refine ⟨(starRingEnd (R := 𝕜) (ℓ z) / ⟪z, z⟫) • z, ?_⟩ apply ContinuousLinearMap.ext intro x have h₁ : ℓ z • x - ℓ x • z ∈ Y := by rw [LinearMap.mem_ker, map_sub, ContinuousLinearMap.map_smul, ContinuousLinearMap.map_smul, Algebra.id.smul_eq_mul, Algebra.id.smul_eq_mul, mul_comm] exact sub_self (ℓ x * ℓ z) have h₂ : ℓ z * ⟪z, x⟫ = ℓ x * ⟪z, z⟫ := haveI h₃ := calc 0 = ⟪z, ℓ z • x - ℓ x • z⟫ := by rw [(Y.mem_orthogonal' z).mp hz] exact h₁ _ = ⟪z, ℓ z • x⟫ - ⟪z, ℓ x • z⟫ := by rw [inner_sub_right] _ = ℓ z * ⟪z, x⟫ - ℓ x * ⟪z, z⟫ := by simp [inner_smul_right] sub_eq_zero.mp (Eq.symm h₃) have h₄ := calc ⟪(ℓ z† / ⟪z, z⟫) • z, x⟫ = ℓ z / ⟪z, z⟫ * ⟪z, x⟫ := by simp [inner_smul_left, conj_conj] _ = ℓ z * ⟪z, x⟫ / ⟪z, z⟫ := by rw [← div_mul_eq_mul_div] _ = ℓ x * ⟪z, z⟫ / ⟪z, z⟫ := by rw [h₂] _ = ℓ x := by field_simp [inner_self_ne_zero.2 z_ne_0] exact h₄) variable {𝕜} {E} @[simp] theorem toDual_apply {x y : E} : toDual 𝕜 E x y = ⟪x, y⟫ := rfl @[simp] theorem toDual_symm_apply {x : E} {y : NormedSpace.Dual 𝕜 E} : ⟪(toDual 𝕜 E).symm y, x⟫ = y x := by rw [← toDual_apply] simp only [LinearIsometryEquiv.apply_symm_apply] /-- Maps a bounded sesquilinear form to its continuous linear map, given by interpreting the form as a map `B : E →L⋆[𝕜] NormedSpace.Dual 𝕜 E` and dualizing the result using `toDual`. -/ def continuousLinearMapOfBilin (B : E →L⋆[𝕜] E →L[𝕜] 𝕜) : E →L[𝕜] E := comp (toDual 𝕜 E).symm.toContinuousLinearEquiv.toContinuousLinearMap B local postfix:1024 "♯" => continuousLinearMapOfBilin variable (B : E →L⋆[𝕜] E →L[𝕜] 𝕜) @[simp] theorem continuousLinearMapOfBilin_apply (v w : E) : ⟪B♯ v, w⟫ = B v w := by rw [continuousLinearMapOfBilin, coe_comp', ContinuousLinearEquiv.coe_coe, LinearIsometryEquiv.coe_toContinuousLinearEquiv, Function.comp_apply, toDual_symm_apply] theorem unique_continuousLinearMapOfBilin {v f : E} (is_lax_milgram : ∀ w, ⟪f, w⟫ = B v w) : f = B♯ v := by refine ext_inner_right 𝕜 ?_ intro w rw [continuousLinearMapOfBilin_apply] exact is_lax_milgram w end InnerProductSpace
Analysis\InnerProductSpace\EuclideanDist.lean
/- Copyright (c) 2021 Yury Kudryashov. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yury Kudryashov -/ import Mathlib.Analysis.InnerProductSpace.Calculus import Mathlib.Analysis.InnerProductSpace.PiL2 import Mathlib.Topology.MetricSpace.ProperSpace.Lemmas /-! # Euclidean distance on a finite dimensional space When we define a smooth bump function on a normed space, it is useful to have a smooth distance on the space. Since the default distance is not guaranteed to be smooth, we define `toEuclidean` to be an equivalence between a finite dimensional topological vector space and the standard Euclidean space of the same dimension. Then we define `Euclidean.dist x y = dist (toEuclidean x) (toEuclidean y)` and provide some definitions (`Euclidean.ball`, `Euclidean.closedBall`) and simple lemmas about this distance. This way we hide the usage of `toEuclidean` behind an API. -/ open scoped Topology open Set variable {E : Type*} [AddCommGroup E] [TopologicalSpace E] [TopologicalAddGroup E] [T2Space E] [Module ℝ E] [ContinuousSMul ℝ E] [FiniteDimensional ℝ E] noncomputable section open FiniteDimensional /-- If `E` is a finite dimensional space over `ℝ`, then `toEuclidean` is a continuous `ℝ`-linear equivalence between `E` and the Euclidean space of the same dimension. -/ def toEuclidean : E ≃L[ℝ] EuclideanSpace ℝ (Fin <| finrank ℝ E) := ContinuousLinearEquiv.ofFinrankEq finrank_euclideanSpace_fin.symm namespace Euclidean /-- If `x` and `y` are two points in a finite dimensional space over `ℝ`, then `Euclidean.dist x y` is the distance between these points in the metric defined by some inner product space structure on `E`. -/ nonrec def dist (x y : E) : ℝ := dist (toEuclidean x) (toEuclidean y) /-- Closed ball w.r.t. the euclidean distance. -/ def closedBall (x : E) (r : ℝ) : Set E := {y | dist y x ≤ r} /-- Open ball w.r.t. the euclidean distance. -/ def ball (x : E) (r : ℝ) : Set E := {y | dist y x < r} theorem ball_eq_preimage (x : E) (r : ℝ) : ball x r = toEuclidean ⁻¹' Metric.ball (toEuclidean x) r := rfl theorem closedBall_eq_preimage (x : E) (r : ℝ) : closedBall x r = toEuclidean ⁻¹' Metric.closedBall (toEuclidean x) r := rfl theorem ball_subset_closedBall {x : E} {r : ℝ} : ball x r ⊆ closedBall x r := fun _ (hy : _ < r) => le_of_lt hy theorem isOpen_ball {x : E} {r : ℝ} : IsOpen (ball x r) := Metric.isOpen_ball.preimage toEuclidean.continuous theorem mem_ball_self {x : E} {r : ℝ} (hr : 0 < r) : x ∈ ball x r := Metric.mem_ball_self hr theorem closedBall_eq_image (x : E) (r : ℝ) : closedBall x r = toEuclidean.symm '' Metric.closedBall (toEuclidean x) r := by rw [toEuclidean.image_symm_eq_preimage, closedBall_eq_preimage] nonrec theorem isCompact_closedBall {x : E} {r : ℝ} : IsCompact (closedBall x r) := by rw [closedBall_eq_image] exact (isCompact_closedBall _ _).image toEuclidean.symm.continuous theorem isClosed_closedBall {x : E} {r : ℝ} : IsClosed (closedBall x r) := isCompact_closedBall.isClosed nonrec theorem closure_ball (x : E) {r : ℝ} (h : r ≠ 0) : closure (ball x r) = closedBall x r := by rw [ball_eq_preimage, ← toEuclidean.preimage_closure, closure_ball (toEuclidean x) h, closedBall_eq_preimage] nonrec theorem exists_pos_lt_subset_ball {R : ℝ} {s : Set E} {x : E} (hR : 0 < R) (hs : IsClosed s) (h : s ⊆ ball x R) : ∃ r ∈ Ioo 0 R, s ⊆ ball x r := by rw [ball_eq_preimage, ← image_subset_iff] at h rcases exists_pos_lt_subset_ball hR (toEuclidean.isClosed_image.2 hs) h with ⟨r, hr, hsr⟩ exact ⟨r, hr, image_subset_iff.1 hsr⟩ theorem nhds_basis_closedBall {x : E} : (𝓝 x).HasBasis (fun r : ℝ => 0 < r) (closedBall x) := by rw [toEuclidean.toHomeomorph.nhds_eq_comap x] exact Metric.nhds_basis_closedBall.comap _ theorem closedBall_mem_nhds {x : E} {r : ℝ} (hr : 0 < r) : closedBall x r ∈ 𝓝 x := nhds_basis_closedBall.mem_of_mem hr theorem nhds_basis_ball {x : E} : (𝓝 x).HasBasis (fun r : ℝ => 0 < r) (ball x) := by rw [toEuclidean.toHomeomorph.nhds_eq_comap x] exact Metric.nhds_basis_ball.comap _ theorem ball_mem_nhds {x : E} {r : ℝ} (hr : 0 < r) : ball x r ∈ 𝓝 x := nhds_basis_ball.mem_of_mem hr end Euclidean variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] {G : Type*} [NormedAddCommGroup G] [NormedSpace ℝ G] [FiniteDimensional ℝ G] {f g : F → G} {n : ℕ∞} theorem ContDiff.euclidean_dist (hf : ContDiff ℝ n f) (hg : ContDiff ℝ n g) (h : ∀ x, f x ≠ g x) : ContDiff ℝ n fun x => Euclidean.dist (f x) (g x) := by simp only [Euclidean.dist] apply ContDiff.dist ℝ exacts [(toEuclidean (E := G)).contDiff.comp hf, (toEuclidean (E := G)).contDiff.comp hg, fun x => toEuclidean.injective.ne (h x)]
Analysis\InnerProductSpace\GramSchmidtOrtho.lean
/- Copyright (c) 2022 Jiale Miao. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Jiale Miao, Kevin Buzzard, Alexander Bentkamp -/ import Mathlib.Analysis.InnerProductSpace.PiL2 import Mathlib.LinearAlgebra.Matrix.Block /-! # Gram-Schmidt Orthogonalization and Orthonormalization In this file we introduce Gram-Schmidt Orthogonalization and Orthonormalization. The Gram-Schmidt process takes a set of vectors as input and outputs a set of orthogonal vectors which have the same span. ## Main results - `gramSchmidt` : the Gram-Schmidt process - `gramSchmidt_orthogonal` : `gramSchmidt` produces an orthogonal system of vectors. - `span_gramSchmidt` : `gramSchmidt` preserves span of vectors. - `gramSchmidt_ne_zero` : If the input vectors of `gramSchmidt` are linearly independent, then the output vectors are non-zero. - `gramSchmidt_basis` : The basis produced by the Gram-Schmidt process when given a basis as input. - `gramSchmidtNormed` : the normalized `gramSchmidt` (i.e each vector in `gramSchmidtNormed` has unit length.) - `gramSchmidt_orthonormal` : `gramSchmidtNormed` produces an orthornormal system of vectors. - `gramSchmidtOrthonormalBasis`: orthonormal basis constructed by the Gram-Schmidt process from an indexed set of vectors of the right size -/ open Finset Submodule FiniteDimensional variable (𝕜 : Type*) {E : Type*} [RCLike 𝕜] [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] variable {ι : Type*} [LinearOrder ι] [LocallyFiniteOrderBot ι] [IsWellOrder ι (· < ·)] attribute [local instance] IsWellOrder.toHasWellFounded local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y /-- The Gram-Schmidt process takes a set of vectors as input and outputs a set of orthogonal vectors which have the same span. -/ noncomputable def gramSchmidt [IsWellOrder ι (· < ·)] (f : ι → E) (n : ι) : E := f n - ∑ i : Iio n, orthogonalProjection (𝕜 ∙ gramSchmidt f i) (f n) termination_by n decreasing_by exact mem_Iio.1 i.2 /-- This lemma uses `∑ i in` instead of `∑ i :`. -/ theorem gramSchmidt_def (f : ι → E) (n : ι) : gramSchmidt 𝕜 f n = f n - ∑ i ∈ Iio n, orthogonalProjection (𝕜 ∙ gramSchmidt 𝕜 f i) (f n) := by rw [← sum_attach, attach_eq_univ, gramSchmidt] theorem gramSchmidt_def' (f : ι → E) (n : ι) : f n = gramSchmidt 𝕜 f n + ∑ i ∈ Iio n, orthogonalProjection (𝕜 ∙ gramSchmidt 𝕜 f i) (f n) := by rw [gramSchmidt_def, sub_add_cancel] theorem gramSchmidt_def'' (f : ι → E) (n : ι) : f n = gramSchmidt 𝕜 f n + ∑ i ∈ Iio n, (⟪gramSchmidt 𝕜 f i, f n⟫ / (‖gramSchmidt 𝕜 f i‖ : 𝕜) ^ 2) • gramSchmidt 𝕜 f i := by convert gramSchmidt_def' 𝕜 f n rw [orthogonalProjection_singleton, RCLike.ofReal_pow] @[simp] theorem gramSchmidt_zero {ι : Type*} [LinearOrder ι] [LocallyFiniteOrder ι] [OrderBot ι] [IsWellOrder ι (· < ·)] (f : ι → E) : gramSchmidt 𝕜 f ⊥ = f ⊥ := by rw [gramSchmidt_def, Iio_eq_Ico, Finset.Ico_self, Finset.sum_empty, sub_zero] /-- **Gram-Schmidt Orthogonalisation**: `gramSchmidt` produces an orthogonal system of vectors. -/ theorem gramSchmidt_orthogonal (f : ι → E) {a b : ι} (h₀ : a ≠ b) : ⟪gramSchmidt 𝕜 f a, gramSchmidt 𝕜 f b⟫ = 0 := by suffices ∀ a b : ι, a < b → ⟪gramSchmidt 𝕜 f a, gramSchmidt 𝕜 f b⟫ = 0 by cases' h₀.lt_or_lt with ha hb · exact this _ _ ha · rw [inner_eq_zero_symm] exact this _ _ hb clear h₀ a b intro a b h₀ revert a apply wellFounded_lt.induction b intro b ih a h₀ simp only [gramSchmidt_def 𝕜 f b, inner_sub_right, inner_sum, orthogonalProjection_singleton, inner_smul_right] rw [Finset.sum_eq_single_of_mem a (Finset.mem_Iio.mpr h₀)] · by_cases h : gramSchmidt 𝕜 f a = 0 · simp only [h, inner_zero_left, zero_div, zero_mul, sub_zero] · rw [RCLike.ofReal_pow, ← inner_self_eq_norm_sq_to_K, div_mul_cancel₀, sub_self] rwa [inner_self_ne_zero] intro i hi hia simp only [mul_eq_zero, div_eq_zero_iff, inner_self_eq_zero] right cases' hia.lt_or_lt with hia₁ hia₂ · rw [inner_eq_zero_symm] exact ih a h₀ i hia₁ · exact ih i (mem_Iio.1 hi) a hia₂ /-- This is another version of `gramSchmidt_orthogonal` using `Pairwise` instead. -/ theorem gramSchmidt_pairwise_orthogonal (f : ι → E) : Pairwise fun a b => ⟪gramSchmidt 𝕜 f a, gramSchmidt 𝕜 f b⟫ = 0 := fun _ _ => gramSchmidt_orthogonal 𝕜 f theorem gramSchmidt_inv_triangular (v : ι → E) {i j : ι} (hij : i < j) : ⟪gramSchmidt 𝕜 v j, v i⟫ = 0 := by rw [gramSchmidt_def'' 𝕜 v] simp only [inner_add_right, inner_sum, inner_smul_right] set b : ι → E := gramSchmidt 𝕜 v convert zero_add (0 : 𝕜) · exact gramSchmidt_orthogonal 𝕜 v hij.ne' apply Finset.sum_eq_zero rintro k hki' have hki : k < i := by simpa using hki' have : ⟪b j, b k⟫ = 0 := gramSchmidt_orthogonal 𝕜 v (hki.trans hij).ne' simp [this] open Submodule Set Order theorem mem_span_gramSchmidt (f : ι → E) {i j : ι} (hij : i ≤ j) : f i ∈ span 𝕜 (gramSchmidt 𝕜 f '' Set.Iic j) := by rw [gramSchmidt_def' 𝕜 f i] simp_rw [orthogonalProjection_singleton] exact Submodule.add_mem _ (subset_span <| mem_image_of_mem _ hij) (Submodule.sum_mem _ fun k hk => smul_mem (span 𝕜 (gramSchmidt 𝕜 f '' Set.Iic j)) _ <| subset_span <| mem_image_of_mem (gramSchmidt 𝕜 f) <| (Finset.mem_Iio.1 hk).le.trans hij) theorem gramSchmidt_mem_span (f : ι → E) : ∀ {j i}, i ≤ j → gramSchmidt 𝕜 f i ∈ span 𝕜 (f '' Set.Iic j) := by intro j i hij rw [gramSchmidt_def 𝕜 f i] simp_rw [orthogonalProjection_singleton] refine Submodule.sub_mem _ (subset_span (mem_image_of_mem _ hij)) (Submodule.sum_mem _ fun k hk => ?_) let hkj : k < j := (Finset.mem_Iio.1 hk).trans_le hij exact smul_mem _ _ (span_mono (image_subset f <| Iic_subset_Iic.2 hkj.le) <| gramSchmidt_mem_span _ le_rfl) termination_by j => j theorem span_gramSchmidt_Iic (f : ι → E) (c : ι) : span 𝕜 (gramSchmidt 𝕜 f '' Set.Iic c) = span 𝕜 (f '' Set.Iic c) := span_eq_span (Set.image_subset_iff.2 fun _ => gramSchmidt_mem_span _ _) <| Set.image_subset_iff.2 fun _ => mem_span_gramSchmidt _ _ theorem span_gramSchmidt_Iio (f : ι → E) (c : ι) : span 𝕜 (gramSchmidt 𝕜 f '' Set.Iio c) = span 𝕜 (f '' Set.Iio c) := span_eq_span (Set.image_subset_iff.2 fun _ hi => span_mono (image_subset _ <| Iic_subset_Iio.2 hi) <| gramSchmidt_mem_span _ _ le_rfl) <| Set.image_subset_iff.2 fun _ hi => span_mono (image_subset _ <| Iic_subset_Iio.2 hi) <| mem_span_gramSchmidt _ _ le_rfl /-- `gramSchmidt` preserves span of vectors. -/ theorem span_gramSchmidt (f : ι → E) : span 𝕜 (range (gramSchmidt 𝕜 f)) = span 𝕜 (range f) := span_eq_span (range_subset_iff.2 fun _ => span_mono (image_subset_range _ _) <| gramSchmidt_mem_span _ _ le_rfl) <| range_subset_iff.2 fun _ => span_mono (image_subset_range _ _) <| mem_span_gramSchmidt _ _ le_rfl theorem gramSchmidt_of_orthogonal {f : ι → E} (hf : Pairwise fun i j => ⟪f i, f j⟫ = 0) : gramSchmidt 𝕜 f = f := by ext i rw [gramSchmidt_def] trans f i - 0 · congr apply Finset.sum_eq_zero intro j hj rw [Submodule.coe_eq_zero] suffices span 𝕜 (f '' Set.Iic j) ⟂ 𝕜 ∙ f i by apply orthogonalProjection_mem_subspace_orthogonalComplement_eq_zero rw [mem_orthogonal_singleton_iff_inner_left] rw [← mem_orthogonal_singleton_iff_inner_right] exact this (gramSchmidt_mem_span 𝕜 f (le_refl j)) rw [isOrtho_span] rintro u ⟨k, hk, rfl⟩ v (rfl : v = f i) apply hf exact (lt_of_le_of_lt hk (Finset.mem_Iio.mp hj)).ne · simp variable {𝕜} theorem gramSchmidt_ne_zero_coe {f : ι → E} (n : ι) (h₀ : LinearIndependent 𝕜 (f ∘ ((↑) : Set.Iic n → ι))) : gramSchmidt 𝕜 f n ≠ 0 := by by_contra h have h₁ : f n ∈ span 𝕜 (f '' Set.Iio n) := by rw [← span_gramSchmidt_Iio 𝕜 f n, gramSchmidt_def' 𝕜 f, h, zero_add] apply Submodule.sum_mem _ _ intro a ha simp only [Set.mem_image, Set.mem_Iio, orthogonalProjection_singleton] apply Submodule.smul_mem _ _ _ rw [Finset.mem_Iio] at ha exact subset_span ⟨a, ha, by rfl⟩ have h₂ : (f ∘ ((↑) : Set.Iic n → ι)) ⟨n, le_refl n⟩ ∈ span 𝕜 (f ∘ ((↑) : Set.Iic n → ι) '' Set.Iio ⟨n, le_refl n⟩) := by rw [image_comp] simpa using h₁ apply LinearIndependent.not_mem_span_image h₀ _ h₂ simp only [Set.mem_Iio, lt_self_iff_false, not_false_iff] /-- If the input vectors of `gramSchmidt` are linearly independent, then the output vectors are non-zero. -/ theorem gramSchmidt_ne_zero {f : ι → E} (n : ι) (h₀ : LinearIndependent 𝕜 f) : gramSchmidt 𝕜 f n ≠ 0 := gramSchmidt_ne_zero_coe _ (LinearIndependent.comp h₀ _ Subtype.coe_injective) /-- `gramSchmidt` produces a triangular matrix of vectors when given a basis. -/ theorem gramSchmidt_triangular {i j : ι} (hij : i < j) (b : Basis ι 𝕜 E) : b.repr (gramSchmidt 𝕜 b i) j = 0 := by have : gramSchmidt 𝕜 b i ∈ span 𝕜 (gramSchmidt 𝕜 b '' Set.Iio j) := subset_span ((Set.mem_image _ _ _).2 ⟨i, hij, rfl⟩) have : gramSchmidt 𝕜 b i ∈ span 𝕜 (b '' Set.Iio j) := by rwa [← span_gramSchmidt_Iio 𝕜 b j] have : ↑(b.repr (gramSchmidt 𝕜 b i)).support ⊆ Set.Iio j := Basis.repr_support_subset_of_mem_span b (Set.Iio j) this exact (Finsupp.mem_supported' _ _).1 ((Finsupp.mem_supported 𝕜 _).2 this) j Set.not_mem_Iio_self /-- `gramSchmidt` produces linearly independent vectors when given linearly independent vectors. -/ theorem gramSchmidt_linearIndependent {f : ι → E} (h₀ : LinearIndependent 𝕜 f) : LinearIndependent 𝕜 (gramSchmidt 𝕜 f) := linearIndependent_of_ne_zero_of_inner_eq_zero (fun _ => gramSchmidt_ne_zero _ h₀) fun _ _ => gramSchmidt_orthogonal 𝕜 f /-- When given a basis, `gramSchmidt` produces a basis. -/ noncomputable def gramSchmidtBasis (b : Basis ι 𝕜 E) : Basis ι 𝕜 E := Basis.mk (gramSchmidt_linearIndependent b.linearIndependent) ((span_gramSchmidt 𝕜 b).trans b.span_eq).ge theorem coe_gramSchmidtBasis (b : Basis ι 𝕜 E) : (gramSchmidtBasis b : ι → E) = gramSchmidt 𝕜 b := Basis.coe_mk _ _ variable (𝕜) /-- the normalized `gramSchmidt` (i.e each vector in `gramSchmidtNormed` has unit length.) -/ noncomputable def gramSchmidtNormed (f : ι → E) (n : ι) : E := (‖gramSchmidt 𝕜 f n‖ : 𝕜)⁻¹ • gramSchmidt 𝕜 f n variable {𝕜} theorem gramSchmidtNormed_unit_length_coe {f : ι → E} (n : ι) (h₀ : LinearIndependent 𝕜 (f ∘ ((↑) : Set.Iic n → ι))) : ‖gramSchmidtNormed 𝕜 f n‖ = 1 := by simp only [gramSchmidt_ne_zero_coe n h₀, gramSchmidtNormed, norm_smul_inv_norm, Ne, not_false_iff] theorem gramSchmidtNormed_unit_length {f : ι → E} (n : ι) (h₀ : LinearIndependent 𝕜 f) : ‖gramSchmidtNormed 𝕜 f n‖ = 1 := gramSchmidtNormed_unit_length_coe _ (LinearIndependent.comp h₀ _ Subtype.coe_injective) theorem gramSchmidtNormed_unit_length' {f : ι → E} {n : ι} (hn : gramSchmidtNormed 𝕜 f n ≠ 0) : ‖gramSchmidtNormed 𝕜 f n‖ = 1 := by rw [gramSchmidtNormed] at * rw [norm_smul_inv_norm] simpa using hn /-- **Gram-Schmidt Orthonormalization**: `gramSchmidtNormed` applied to a linearly independent set of vectors produces an orthornormal system of vectors. -/ theorem gramSchmidt_orthonormal {f : ι → E} (h₀ : LinearIndependent 𝕜 f) : Orthonormal 𝕜 (gramSchmidtNormed 𝕜 f) := by unfold Orthonormal constructor · simp only [gramSchmidtNormed_unit_length, h₀, eq_self_iff_true, imp_true_iff] · intro i j hij simp only [gramSchmidtNormed, inner_smul_left, inner_smul_right, RCLike.conj_inv, RCLike.conj_ofReal, mul_eq_zero, inv_eq_zero, RCLike.ofReal_eq_zero, norm_eq_zero] repeat' right exact gramSchmidt_orthogonal 𝕜 f hij /-- **Gram-Schmidt Orthonormalization**: `gramSchmidtNormed` produces an orthornormal system of vectors after removing the vectors which become zero in the process. -/ theorem gramSchmidt_orthonormal' (f : ι → E) : Orthonormal 𝕜 fun i : { i | gramSchmidtNormed 𝕜 f i ≠ 0 } => gramSchmidtNormed 𝕜 f i := by refine ⟨fun i => gramSchmidtNormed_unit_length' i.prop, ?_⟩ rintro i j (hij : ¬_) rw [Subtype.ext_iff] at hij simp [gramSchmidtNormed, inner_smul_left, inner_smul_right, gramSchmidt_orthogonal 𝕜 f hij] theorem span_gramSchmidtNormed (f : ι → E) (s : Set ι) : span 𝕜 (gramSchmidtNormed 𝕜 f '' s) = span 𝕜 (gramSchmidt 𝕜 f '' s) := by refine span_eq_span (Set.image_subset_iff.2 fun i hi => smul_mem _ _ <| subset_span <| mem_image_of_mem _ hi) (Set.image_subset_iff.2 fun i hi => span_mono (image_subset _ <| singleton_subset_set_iff.2 hi) ?_) simp only [coe_singleton, Set.image_singleton] by_cases h : gramSchmidt 𝕜 f i = 0 · simp [h] · refine mem_span_singleton.2 ⟨‖gramSchmidt 𝕜 f i‖, smul_inv_smul₀ ?_ _⟩ exact mod_cast norm_ne_zero_iff.2 h theorem span_gramSchmidtNormed_range (f : ι → E) : span 𝕜 (range (gramSchmidtNormed 𝕜 f)) = span 𝕜 (range (gramSchmidt 𝕜 f)) := by simpa only [image_univ.symm] using span_gramSchmidtNormed f univ section OrthonormalBasis variable [Fintype ι] [FiniteDimensional 𝕜 E] (h : finrank 𝕜 E = Fintype.card ι) (f : ι → E) /-- Given an indexed family `f : ι → E` of vectors in an inner product space `E`, for which the size of the index set is the dimension of `E`, produce an orthonormal basis for `E` which agrees with the orthonormal set produced by the Gram-Schmidt orthonormalization process on the elements of `ι` for which this process gives a nonzero number. -/ noncomputable def gramSchmidtOrthonormalBasis : OrthonormalBasis ι 𝕜 E := ((gramSchmidt_orthonormal' f).exists_orthonormalBasis_extension_of_card_eq (v := gramSchmidtNormed 𝕜 f) h).choose theorem gramSchmidtOrthonormalBasis_apply {f : ι → E} {i : ι} (hi : gramSchmidtNormed 𝕜 f i ≠ 0) : gramSchmidtOrthonormalBasis h f i = gramSchmidtNormed 𝕜 f i := ((gramSchmidt_orthonormal' f).exists_orthonormalBasis_extension_of_card_eq (v := gramSchmidtNormed 𝕜 f) h).choose_spec i hi theorem gramSchmidtOrthonormalBasis_apply_of_orthogonal {f : ι → E} (hf : Pairwise fun i j => ⟪f i, f j⟫ = 0) {i : ι} (hi : f i ≠ 0) : gramSchmidtOrthonormalBasis h f i = (‖f i‖⁻¹ : 𝕜) • f i := by have H : gramSchmidtNormed 𝕜 f i = (‖f i‖⁻¹ : 𝕜) • f i := by rw [gramSchmidtNormed, gramSchmidt_of_orthogonal 𝕜 hf] rw [gramSchmidtOrthonormalBasis_apply h, H] simpa [H] using hi theorem inner_gramSchmidtOrthonormalBasis_eq_zero {f : ι → E} {i : ι} (hi : gramSchmidtNormed 𝕜 f i = 0) (j : ι) : ⟪gramSchmidtOrthonormalBasis h f i, f j⟫ = 0 := by rw [← mem_orthogonal_singleton_iff_inner_right] suffices span 𝕜 (gramSchmidtNormed 𝕜 f '' Set.Iic j) ⟂ 𝕜 ∙ gramSchmidtOrthonormalBasis h f i by apply this rw [span_gramSchmidtNormed] exact mem_span_gramSchmidt 𝕜 f le_rfl rw [isOrtho_span] rintro u ⟨k, _, rfl⟩ v (rfl : v = _) by_cases hk : gramSchmidtNormed 𝕜 f k = 0 · rw [hk, inner_zero_left] rw [← gramSchmidtOrthonormalBasis_apply h hk] have : k ≠ i := by rintro rfl exact hk hi exact (gramSchmidtOrthonormalBasis h f).orthonormal.2 this theorem gramSchmidtOrthonormalBasis_inv_triangular {i j : ι} (hij : i < j) : ⟪gramSchmidtOrthonormalBasis h f j, f i⟫ = 0 := by by_cases hi : gramSchmidtNormed 𝕜 f j = 0 · rw [inner_gramSchmidtOrthonormalBasis_eq_zero h hi] · simp [gramSchmidtOrthonormalBasis_apply h hi, gramSchmidtNormed, inner_smul_left, gramSchmidt_inv_triangular 𝕜 f hij] theorem gramSchmidtOrthonormalBasis_inv_triangular' {i j : ι} (hij : i < j) : (gramSchmidtOrthonormalBasis h f).repr (f i) j = 0 := by simpa [OrthonormalBasis.repr_apply_apply] using gramSchmidtOrthonormalBasis_inv_triangular h f hij /-- Given an indexed family `f : ι → E` of vectors in an inner product space `E`, for which the size of the index set is the dimension of `E`, the matrix of coefficients of `f` with respect to the orthonormal basis `gramSchmidtOrthonormalBasis` constructed from `f` is upper-triangular. -/ theorem gramSchmidtOrthonormalBasis_inv_blockTriangular : ((gramSchmidtOrthonormalBasis h f).toBasis.toMatrix f).BlockTriangular id := fun _ _ => gramSchmidtOrthonormalBasis_inv_triangular' h f -- Porting note: added a `DecidableEq` argument to help with timeouts in -- `Mathlib/Analysis/InnerProductSpace/Orientation.lean` theorem gramSchmidtOrthonormalBasis_det [DecidableEq ι] : (gramSchmidtOrthonormalBasis h f).toBasis.det f = ∏ i, ⟪gramSchmidtOrthonormalBasis h f i, f i⟫ := by convert Matrix.det_of_upperTriangular (gramSchmidtOrthonormalBasis_inv_blockTriangular h f) exact ((gramSchmidtOrthonormalBasis h f).repr_apply_apply (f _) _).symm end OrthonormalBasis
Analysis\InnerProductSpace\l2Space.lean
/- Copyright (c) 2022 Heather Macbeth. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Heather Macbeth -/ import Mathlib.Analysis.InnerProductSpace.Projection import Mathlib.Analysis.Normed.Lp.lpSpace import Mathlib.Analysis.InnerProductSpace.PiL2 /-! # Hilbert sum of a family of inner product spaces Given a family `(G : ι → Type*) [Π i, InnerProductSpace 𝕜 (G i)]` of inner product spaces, this file equips `lp G 2` with an inner product space structure, where `lp G 2` consists of those dependent functions `f : Π i, G i` for which `∑' i, ‖f i‖ ^ 2`, the sum of the norms-squared, is summable. This construction is sometimes called the *Hilbert sum* of the family `G`. By choosing `G` to be `ι → 𝕜`, the Hilbert space `ℓ²(ι, 𝕜)` may be seen as a special case of this construction. We also define a *predicate* `IsHilbertSum 𝕜 G V`, where `V : Π i, G i →ₗᵢ[𝕜] E`, expressing that `V` is an `OrthogonalFamily` and that the associated map `lp G 2 →ₗᵢ[𝕜] E` is surjective. ## Main definitions * `OrthogonalFamily.linearIsometry`: Given a Hilbert space `E`, a family `G` of inner product spaces and a family `V : Π i, G i →ₗᵢ[𝕜] E` of isometric embeddings of the `G i` into `E` with mutually-orthogonal images, there is an induced isometric embedding of the Hilbert sum of `G` into `E`. * `IsHilbertSum`: Given a Hilbert space `E`, a family `G` of inner product spaces and a family `V : Π i, G i →ₗᵢ[𝕜] E` of isometric embeddings of the `G i` into `E`, `IsHilbertSum 𝕜 G V` means that `V` is an `OrthogonalFamily` and that the above linear isometry is surjective. * `IsHilbertSum.linearIsometryEquiv`: If a Hilbert space `E` is a Hilbert sum of the inner product spaces `G i` with respect to the family `V : Π i, G i →ₗᵢ[𝕜] E`, then the corresponding `OrthogonalFamily.linearIsometry` can be upgraded to a `LinearIsometryEquiv`. * `HilbertBasis`: We define a *Hilbert basis* of a Hilbert space `E` to be a structure whose single field `HilbertBasis.repr` is an isometric isomorphism of `E` with `ℓ²(ι, 𝕜)` (i.e., the Hilbert sum of `ι` copies of `𝕜`). This parallels the definition of `Basis`, in `LinearAlgebra.Basis`, as an isomorphism of an `R`-module with `ι →₀ R`. * `HilbertBasis.instCoeFun`: More conventionally a Hilbert basis is thought of as a family `ι → E` of vectors in `E` satisfying certain properties (orthonormality, completeness). We obtain this interpretation of a Hilbert basis `b` by defining `⇑b`, of type `ι → E`, to be the image under `b.repr` of `lp.single 2 i (1:𝕜)`. This parallels the definition `Basis.coeFun` in `LinearAlgebra.Basis`. * `HilbertBasis.mk`: Make a Hilbert basis of `E` from an orthonormal family `v : ι → E` of vectors in `E` whose span is dense. This parallels the definition `Basis.mk` in `LinearAlgebra.Basis`. * `HilbertBasis.mkOfOrthogonalEqBot`: Make a Hilbert basis of `E` from an orthonormal family `v : ι → E` of vectors in `E` whose span has trivial orthogonal complement. ## Main results * `lp.instInnerProductSpace`: Construction of the inner product space instance on the Hilbert sum `lp G 2`. Note that from the file `Analysis.Normed.Lp.lpSpace`, the space `lp G 2` already held a normed space instance (`lp.normedSpace`), and if each `G i` is a Hilbert space (i.e., complete), then `lp G 2` was already known to be complete (`lp.completeSpace`). So the work here is to define the inner product and show it is compatible. * `OrthogonalFamily.range_linearIsometry`: Given a family `G` of inner product spaces and a family `V : Π i, G i →ₗᵢ[𝕜] E` of isometric embeddings of the `G i` into `E` with mutually-orthogonal images, the image of the embedding `OrthogonalFamily.linearIsometry` of the Hilbert sum of `G` into `E` is the closure of the span of the images of the `G i`. * `HilbertBasis.repr_apply_apply`: Given a Hilbert basis `b` of `E`, the entry `b.repr x i` of `x`'s representation in `ℓ²(ι, 𝕜)` is the inner product `⟪b i, x⟫`. * `HilbertBasis.hasSum_repr`: Given a Hilbert basis `b` of `E`, a vector `x` in `E` can be expressed as the "infinite linear combination" `∑' i, b.repr x i • b i` of the basis vectors `b i`, with coefficients given by the entries `b.repr x i` of `x`'s representation in `ℓ²(ι, 𝕜)`. * `exists_hilbertBasis`: A Hilbert space admits a Hilbert basis. ## Keywords Hilbert space, Hilbert sum, l2, Hilbert basis, unitary equivalence, isometric isomorphism -/ open RCLike Submodule Filter open scoped NNReal ENNReal ComplexConjugate Topology noncomputable section variable {ι 𝕜 : Type*} [RCLike 𝕜] {E : Type*} variable [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] [cplt : CompleteSpace E] variable {G : ι → Type*} [∀ i, NormedAddCommGroup (G i)] [∀ i, InnerProductSpace 𝕜 (G i)] local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y /-- `ℓ²(ι, 𝕜)` is the Hilbert space of square-summable functions `ι → 𝕜`, herein implemented as `lp (fun i : ι => 𝕜) 2`. -/ notation "ℓ²(" ι ", " 𝕜 ")" => lp (fun i : ι => 𝕜) 2 /-! ### Inner product space structure on `lp G 2` -/ namespace lp theorem summable_inner (f g : lp G 2) : Summable fun i => ⟪f i, g i⟫ := by -- Apply the Direct Comparison Test, comparing with ∑' i, ‖f i‖ * ‖g i‖ (summable by Hölder) refine .of_norm_bounded (fun i => ‖f i‖ * ‖g i‖) (lp.summable_mul ?_ f g) ?_ · rw [Real.isConjExponent_iff]; norm_num intro i -- Then apply Cauchy-Schwarz pointwise exact norm_inner_le_norm (𝕜 := 𝕜) _ _ instance instInnerProductSpace : InnerProductSpace 𝕜 (lp G 2) := { lp.normedAddCommGroup (E := G) (p := 2) with inner := fun f g => ∑' i, ⟪f i, g i⟫ norm_sq_eq_inner := fun f => by calc ‖f‖ ^ 2 = ‖f‖ ^ (2 : ℝ≥0∞).toReal := by norm_cast _ = ∑' i, ‖f i‖ ^ (2 : ℝ≥0∞).toReal := lp.norm_rpow_eq_tsum ?_ f _ = ∑' i, ‖f i‖ ^ (2 : ℕ) := by norm_cast _ = ∑' i, re ⟪f i, f i⟫ := by congr funext i rw [norm_sq_eq_inner (𝕜 := 𝕜)] -- Porting note: `simp` couldn't do this anymore _ = re (∑' i, ⟪f i, f i⟫) := (RCLike.reCLM.map_tsum ?_).symm · norm_num · exact summable_inner f f conj_symm := fun f g => by calc conj _ = conj (∑' i, ⟪g i, f i⟫) := by congr _ = ∑' i, conj ⟪g i, f i⟫ := RCLike.conjCLE.map_tsum _ = ∑' i, ⟪f i, g i⟫ := by simp only [inner_conj_symm] _ = _ := by congr add_left := fun f₁ f₂ g => by calc _ = ∑' i, ⟪(f₁ + f₂) i, g i⟫ := ?_ _ = ∑' i, (⟪f₁ i, g i⟫ + ⟪f₂ i, g i⟫) := by simp only [inner_add_left, Pi.add_apply, coeFn_add] _ = (∑' i, ⟪f₁ i, g i⟫) + ∑' i, ⟪f₂ i, g i⟫ := tsum_add ?_ ?_ _ = _ := by congr · congr · exact summable_inner f₁ g · exact summable_inner f₂ g smul_left := fun f g c => by calc _ = ∑' i, ⟪c • f i, g i⟫ := ?_ _ = ∑' i, conj c * ⟪f i, g i⟫ := by simp only [inner_smul_left] _ = conj c * ∑' i, ⟪f i, g i⟫ := tsum_mul_left _ = _ := ?_ · simp only [coeFn_smul, Pi.smul_apply] · congr } theorem inner_eq_tsum (f g : lp G 2) : ⟪f, g⟫ = ∑' i, ⟪f i, g i⟫ := rfl theorem hasSum_inner (f g : lp G 2) : HasSum (fun i => ⟪f i, g i⟫) ⟪f, g⟫ := (summable_inner f g).hasSum theorem inner_single_left [DecidableEq ι] (i : ι) (a : G i) (f : lp G 2) : ⟪lp.single 2 i a, f⟫ = ⟪a, f i⟫ := by refine (hasSum_inner (lp.single 2 i a) f).unique ?_ convert hasSum_ite_eq i ⟪a, f i⟫ using 1 ext j rw [lp.single_apply] split_ifs with h · subst h; rfl · simp theorem inner_single_right [DecidableEq ι] (i : ι) (a : G i) (f : lp G 2) : ⟪f, lp.single 2 i a⟫ = ⟪f i, a⟫ := by simpa [inner_conj_symm] using congr_arg conj (inner_single_left (𝕜 := 𝕜) i a f) end lp /-! ### Identification of a general Hilbert space `E` with a Hilbert sum -/ namespace OrthogonalFamily variable {V : ∀ i, G i →ₗᵢ[𝕜] E} (hV : OrthogonalFamily 𝕜 G V) protected theorem summable_of_lp (f : lp G 2) : Summable fun i => V i (f i) := by rw [hV.summable_iff_norm_sq_summable] convert (lp.memℓp f).summable _ · norm_cast · norm_num /-- A mutually orthogonal family of subspaces of `E` induce a linear isometry from `lp 2` of the subspaces into `E`. -/ protected def linearIsometry : lp G 2 →ₗᵢ[𝕜] E where toFun f := ∑' i, V i (f i) map_add' f g := by simp only [tsum_add (hV.summable_of_lp f) (hV.summable_of_lp g), lp.coeFn_add, Pi.add_apply, LinearIsometry.map_add] map_smul' c f := by simpa only [LinearIsometry.map_smul, Pi.smul_apply, lp.coeFn_smul] using tsum_const_smul c (hV.summable_of_lp f) norm_map' f := by classical -- needed for lattice instance on `Finset ι`, for `Filter.atTop_neBot` have H : 0 < (2 : ℝ≥0∞).toReal := by norm_num suffices ‖∑' i : ι, V i (f i)‖ ^ (2 : ℝ≥0∞).toReal = ‖f‖ ^ (2 : ℝ≥0∞).toReal by exact Real.rpow_left_injOn H.ne' (norm_nonneg _) (norm_nonneg _) this refine tendsto_nhds_unique ?_ (lp.hasSum_norm H f) convert (hV.summable_of_lp f).hasSum.norm.rpow_const (Or.inr H.le) using 1 ext s exact mod_cast (hV.norm_sum f s).symm protected theorem linearIsometry_apply (f : lp G 2) : hV.linearIsometry f = ∑' i, V i (f i) := rfl protected theorem hasSum_linearIsometry (f : lp G 2) : HasSum (fun i => V i (f i)) (hV.linearIsometry f) := (hV.summable_of_lp f).hasSum @[simp] protected theorem linearIsometry_apply_single [DecidableEq ι] {i : ι} (x : G i) : hV.linearIsometry (lp.single 2 i x) = V i x := by rw [hV.linearIsometry_apply, ← tsum_ite_eq i (V i x)] congr ext j rw [lp.single_apply] split_ifs with h · subst h; simp · simp [h] protected theorem linearIsometry_apply_dfinsupp_sum_single [DecidableEq ι] [∀ i, DecidableEq (G i)] (W₀ : Π₀ i : ι, G i) : hV.linearIsometry (W₀.sum (lp.single 2)) = W₀.sum fun i => V i := by simp /-- The canonical linear isometry from the `lp 2` of a mutually orthogonal family of subspaces of `E` into E, has range the closure of the span of the subspaces. -/ protected theorem range_linearIsometry [∀ i, CompleteSpace (G i)] : LinearMap.range hV.linearIsometry.toLinearMap = (⨆ i, LinearMap.range (V i).toLinearMap).topologicalClosure := by -- Porting note: dot notation broken classical refine le_antisymm ?_ ?_ · rintro x ⟨f, rfl⟩ refine mem_closure_of_tendsto (hV.hasSum_linearIsometry f) (eventually_of_forall ?_) intro s rw [SetLike.mem_coe] refine sum_mem ?_ intro i _ refine mem_iSup_of_mem i ?_ exact LinearMap.mem_range_self _ (f i) · apply topologicalClosure_minimal · refine iSup_le ?_ rintro i x ⟨x, rfl⟩ use lp.single 2 i x exact hV.linearIsometry_apply_single x exact hV.linearIsometry.isometry.uniformInducing.isComplete_range.isClosed end OrthogonalFamily section IsHilbertSum variable (𝕜 G) variable (V : ∀ i, G i →ₗᵢ[𝕜] E) (F : ι → Submodule 𝕜 E) /-- Given a family of Hilbert spaces `G : ι → Type*`, a Hilbert sum of `G` consists of a Hilbert space `E` and an orthogonal family `V : Π i, G i →ₗᵢ[𝕜] E` such that the induced isometry `Φ : lp G 2 → E` is surjective. Keeping in mind that `lp G 2` is "the" external Hilbert sum of `G : ι → Type*`, this is analogous to `DirectSum.IsInternal`, except that we don't express it in terms of actual submodules. -/ structure IsHilbertSum : Prop where ofSurjective :: /-- The orthogonal family constituting the summands in the Hilbert sum. -/ protected OrthogonalFamily : OrthogonalFamily 𝕜 G V /-- The isometry `lp G 2 → E` induced by the orthogonal family is surjective. -/ protected surjective_isometry : Function.Surjective OrthogonalFamily.linearIsometry variable {𝕜 G V} /-- If `V : Π i, G i →ₗᵢ[𝕜] E` is an orthogonal family such that the supremum of the ranges of `V i` is dense, then `(E, V)` is a Hilbert sum of `G`. -/ theorem IsHilbertSum.mk [∀ i, CompleteSpace <| G i] (hVortho : OrthogonalFamily 𝕜 G V) (hVtotal : ⊤ ≤ (⨆ i, LinearMap.range (V i).toLinearMap).topologicalClosure) : IsHilbertSum 𝕜 G V := { OrthogonalFamily := hVortho surjective_isometry := by rw [← LinearIsometry.coe_toLinearMap] exact LinearMap.range_eq_top.mp (eq_top_iff.mpr <| hVtotal.trans_eq hVortho.range_linearIsometry.symm) } /-- This is `Orthonormal.isHilbertSum` in the case of actual inclusions from subspaces. -/ theorem IsHilbertSum.mkInternal [∀ i, CompleteSpace <| F i] (hFortho : OrthogonalFamily 𝕜 (fun i => F i) fun i => (F i).subtypeₗᵢ) (hFtotal : ⊤ ≤ (⨆ i, F i).topologicalClosure) : IsHilbertSum 𝕜 (fun i => F i) fun i => (F i).subtypeₗᵢ := IsHilbertSum.mk hFortho (by simpa [subtypeₗᵢ_toLinearMap, range_subtype] using hFtotal) /-- *A* Hilbert sum `(E, V)` of `G` is canonically isomorphic to *the* Hilbert sum of `G`, i.e `lp G 2`. Note that this goes in the opposite direction from `OrthogonalFamily.linearIsometry`. -/ noncomputable def IsHilbertSum.linearIsometryEquiv (hV : IsHilbertSum 𝕜 G V) : E ≃ₗᵢ[𝕜] lp G 2 := LinearIsometryEquiv.symm <| LinearIsometryEquiv.ofSurjective hV.OrthogonalFamily.linearIsometry hV.surjective_isometry /-- In the canonical isometric isomorphism between a Hilbert sum `E` of `G` and `lp G 2`, a vector `w : lp G 2` is the image of the infinite sum of the associated elements in `E`. -/ protected theorem IsHilbertSum.linearIsometryEquiv_symm_apply (hV : IsHilbertSum 𝕜 G V) (w : lp G 2) : hV.linearIsometryEquiv.symm w = ∑' i, V i (w i) := by simp [IsHilbertSum.linearIsometryEquiv, OrthogonalFamily.linearIsometry_apply] /-- In the canonical isometric isomorphism between a Hilbert sum `E` of `G` and `lp G 2`, a vector `w : lp G 2` is the image of the infinite sum of the associated elements in `E`, and this sum indeed converges. -/ protected theorem IsHilbertSum.hasSum_linearIsometryEquiv_symm (hV : IsHilbertSum 𝕜 G V) (w : lp G 2) : HasSum (fun i => V i (w i)) (hV.linearIsometryEquiv.symm w) := by simp [IsHilbertSum.linearIsometryEquiv, OrthogonalFamily.hasSum_linearIsometry] /-- In the canonical isometric isomorphism between a Hilbert sum `E` of `G : ι → Type*` and `lp G 2`, an "elementary basis vector" in `lp G 2` supported at `i : ι` is the image of the associated element in `E`. -/ @[simp] protected theorem IsHilbertSum.linearIsometryEquiv_symm_apply_single [DecidableEq ι] (hV : IsHilbertSum 𝕜 G V) {i : ι} (x : G i) : hV.linearIsometryEquiv.symm (lp.single 2 i x) = V i x := by simp [IsHilbertSum.linearIsometryEquiv, OrthogonalFamily.linearIsometry_apply_single] /-- In the canonical isometric isomorphism between a Hilbert sum `E` of `G : ι → Type*` and `lp G 2`, a finitely-supported vector in `lp G 2` is the image of the associated finite sum of elements of `E`. -/ protected theorem IsHilbertSum.linearIsometryEquiv_symm_apply_dfinsupp_sum_single [DecidableEq ι] [∀ i, DecidableEq (G i)] (hV : IsHilbertSum 𝕜 G V) (W₀ : Π₀ i : ι, G i) : hV.linearIsometryEquiv.symm (W₀.sum (lp.single 2)) = W₀.sum fun i => V i := by simp only [map_dfinsupp_sum, IsHilbertSum.linearIsometryEquiv_symm_apply_single] /-- In the canonical isometric isomorphism between a Hilbert sum `E` of `G : ι → Type*` and `lp G 2`, a finitely-supported vector in `lp G 2` is the image of the associated finite sum of elements of `E`. -/ @[simp] protected theorem IsHilbertSum.linearIsometryEquiv_apply_dfinsupp_sum_single [DecidableEq ι] [∀ i, DecidableEq (G i)] (hV : IsHilbertSum 𝕜 G V) (W₀ : Π₀ i : ι, G i) : ((W₀.sum (γ := lp G 2) fun a b ↦ hV.linearIsometryEquiv (V a b)) : ∀ i, G i) = W₀ := by rw [← map_dfinsupp_sum] rw [← hV.linearIsometryEquiv_symm_apply_dfinsupp_sum_single] rw [LinearIsometryEquiv.apply_symm_apply] ext i simp (config := { contextual := true }) [DFinsupp.sum, lp.single_apply] /-- Given a total orthonormal family `v : ι → E`, `E` is a Hilbert sum of `fun i : ι => 𝕜` relative to the family of linear isometries `fun i k => k • v i`. -/ theorem Orthonormal.isHilbertSum {v : ι → E} (hv : Orthonormal 𝕜 v) (hsp : ⊤ ≤ (span 𝕜 (Set.range v)).topologicalClosure) : IsHilbertSum 𝕜 (fun _ : ι => 𝕜) fun i => LinearIsometry.toSpanSingleton 𝕜 E (hv.1 i) := IsHilbertSum.mk hv.orthogonalFamily (by convert hsp simp [← LinearMap.span_singleton_eq_range, ← Submodule.span_iUnion]) theorem Submodule.isHilbertSumOrthogonal (K : Submodule 𝕜 E) [hK : CompleteSpace K] : IsHilbertSum 𝕜 (fun b => ↥(cond b K Kᗮ)) fun b => (cond b K Kᗮ).subtypeₗᵢ := by have : ∀ b, CompleteSpace (↥(cond b K Kᗮ)) := by intro b cases b <;> first | exact instOrthogonalCompleteSpace K | assumption refine IsHilbertSum.mkInternal _ K.orthogonalFamily_self ?_ refine le_trans ?_ (Submodule.le_topologicalClosure _) rw [iSup_bool_eq, cond, cond] refine Codisjoint.top_le ?_ exact Submodule.isCompl_orthogonal_of_completeSpace.codisjoint end IsHilbertSum /-! ### Hilbert bases -/ section variable (ι) (𝕜) (E) /-- A Hilbert basis on `ι` for an inner product space `E` is an identification of `E` with the `lp` space `ℓ²(ι, 𝕜)`. -/ structure HilbertBasis where ofRepr :: /-- The linear isometric equivalence implementing identifying the Hilbert space with `ℓ²`. -/ repr : E ≃ₗᵢ[𝕜] ℓ²(ι, 𝕜) end namespace HilbertBasis instance {ι : Type*} : Inhabited (HilbertBasis ι 𝕜 ℓ²(ι, 𝕜)) := ⟨ofRepr (LinearIsometryEquiv.refl 𝕜 _)⟩ open Classical in /-- `b i` is the `i`th basis vector. -/ instance instCoeFun : CoeFun (HilbertBasis ι 𝕜 E) fun _ => ι → E where coe b i := b.repr.symm (lp.single 2 i (1 : 𝕜)) -- This is a bad `@[simp]` lemma: the RHS is a coercion containing the LHS. protected theorem repr_symm_single [DecidableEq ι] (b : HilbertBasis ι 𝕜 E) (i : ι) : b.repr.symm (lp.single 2 i (1 : 𝕜)) = b i := by convert rfl protected theorem repr_self [DecidableEq ι] (b : HilbertBasis ι 𝕜 E) (i : ι) : b.repr (b i) = lp.single 2 i (1 : 𝕜) := by simp only [LinearIsometryEquiv.apply_symm_apply] convert rfl protected theorem repr_apply_apply (b : HilbertBasis ι 𝕜 E) (v : E) (i : ι) : b.repr v i = ⟪b i, v⟫ := by classical rw [← b.repr.inner_map_map (b i) v, b.repr_self, lp.inner_single_left] simp @[simp] protected theorem orthonormal (b : HilbertBasis ι 𝕜 E) : Orthonormal 𝕜 b := by classical rw [orthonormal_iff_ite] intro i j rw [← b.repr.inner_map_map (b i) (b j), b.repr_self, b.repr_self, lp.inner_single_left, lp.single_apply] simp protected theorem hasSum_repr_symm (b : HilbertBasis ι 𝕜 E) (f : ℓ²(ι, 𝕜)) : HasSum (fun i => f i • b i) (b.repr.symm f) := by classical suffices H : (fun i : ι => f i • b i) = fun b_1 : ι => b.repr.symm.toContinuousLinearEquiv <| (fun i : ι => lp.single 2 i (f i) (E := (fun _ : ι => 𝕜))) b_1 by rw [H] have : HasSum (fun i : ι => lp.single 2 i (f i)) f := lp.hasSum_single ENNReal.two_ne_top f exact (↑b.repr.symm.toContinuousLinearEquiv : ℓ²(ι, 𝕜) →L[𝕜] E).hasSum this ext i apply b.repr.injective letI : NormedSpace 𝕜 (lp (fun _i : ι => 𝕜) 2) := by infer_instance have : lp.single (E := (fun _ : ι => 𝕜)) 2 i (f i * 1) = f i • lp.single 2 i 1 := lp.single_smul (E := (fun _ : ι => 𝕜)) 2 i (1 : 𝕜) (f i) rw [mul_one] at this rw [LinearIsometryEquiv.map_smul, b.repr_self, ← this, LinearIsometryEquiv.coe_toContinuousLinearEquiv] exact (b.repr.apply_symm_apply (lp.single 2 i (f i))).symm protected theorem hasSum_repr (b : HilbertBasis ι 𝕜 E) (x : E) : HasSum (fun i => b.repr x i • b i) x := by simpa using b.hasSum_repr_symm (b.repr x) @[simp] protected theorem dense_span (b : HilbertBasis ι 𝕜 E) : (span 𝕜 (Set.range b)).topologicalClosure = ⊤ := by classical rw [eq_top_iff] rintro x - refine mem_closure_of_tendsto (b.hasSum_repr x) (eventually_of_forall ?_) intro s simp only [SetLike.mem_coe] refine sum_mem ?_ rintro i - refine smul_mem _ _ ?_ exact subset_span ⟨i, rfl⟩ protected theorem hasSum_inner_mul_inner (b : HilbertBasis ι 𝕜 E) (x y : E) : HasSum (fun i => ⟪x, b i⟫ * ⟪b i, y⟫) ⟪x, y⟫ := by convert (b.hasSum_repr y).mapL (innerSL 𝕜 x) using 1 ext i rw [innerSL_apply, b.repr_apply_apply, inner_smul_right, mul_comm] protected theorem summable_inner_mul_inner (b : HilbertBasis ι 𝕜 E) (x y : E) : Summable fun i => ⟪x, b i⟫ * ⟪b i, y⟫ := (b.hasSum_inner_mul_inner x y).summable protected theorem tsum_inner_mul_inner (b : HilbertBasis ι 𝕜 E) (x y : E) : ∑' i, ⟪x, b i⟫ * ⟪b i, y⟫ = ⟪x, y⟫ := (b.hasSum_inner_mul_inner x y).tsum_eq -- Note: this should be `b.repr` composed with an identification of `lp (fun i : ι => 𝕜) p` with -- `PiLp p (fun i : ι => 𝕜)` (in this case with `p = 2`), but we don't have this yet (July 2022). /-- A finite Hilbert basis is an orthonormal basis. -/ protected def toOrthonormalBasis [Fintype ι] (b : HilbertBasis ι 𝕜 E) : OrthonormalBasis ι 𝕜 E := OrthonormalBasis.mk b.orthonormal (by refine Eq.ge ?_ classical have := (span 𝕜 (Finset.univ.image b : Set E)).closed_of_finiteDimensional simpa only [Finset.coe_image, Finset.coe_univ, Set.image_univ, HilbertBasis.dense_span] using this.submodule_topologicalClosure_eq.symm) @[simp] theorem coe_toOrthonormalBasis [Fintype ι] (b : HilbertBasis ι 𝕜 E) : (b.toOrthonormalBasis : ι → E) = b := OrthonormalBasis.coe_mk _ _ protected theorem hasSum_orthogonalProjection {U : Submodule 𝕜 E} [CompleteSpace U] (b : HilbertBasis ι 𝕜 U) (x : E) : HasSum (fun i => ⟪(b i : E), x⟫ • b i) (orthogonalProjection U x) := by simpa only [b.repr_apply_apply, inner_orthogonalProjection_eq_of_mem_left] using b.hasSum_repr (orthogonalProjection U x) theorem finite_spans_dense [DecidableEq E] (b : HilbertBasis ι 𝕜 E) : (⨆ J : Finset ι, span 𝕜 (J.image b : Set E)).topologicalClosure = ⊤ := eq_top_iff.mpr <| b.dense_span.ge.trans (by simp_rw [← Submodule.span_iUnion] exact topologicalClosure_mono (span_mono <| Set.range_subset_iff.mpr fun i => Set.mem_iUnion_of_mem {i} <| Finset.mem_coe.mpr <| Finset.mem_image_of_mem _ <| Finset.mem_singleton_self i)) variable {v : ι → E} (hv : Orthonormal 𝕜 v) /-- An orthonormal family of vectors whose span is dense in the whole module is a Hilbert basis. -/ protected def mk (hsp : ⊤ ≤ (span 𝕜 (Set.range v)).topologicalClosure) : HilbertBasis ι 𝕜 E := HilbertBasis.ofRepr <| (hv.isHilbertSum hsp).linearIsometryEquiv theorem _root_.Orthonormal.linearIsometryEquiv_symm_apply_single_one [DecidableEq ι] (h i) : (hv.isHilbertSum h).linearIsometryEquiv.symm (lp.single 2 i 1) = v i := by rw [IsHilbertSum.linearIsometryEquiv_symm_apply_single, LinearIsometry.toSpanSingleton_apply, one_smul] @[simp] protected theorem coe_mk (hsp : ⊤ ≤ (span 𝕜 (Set.range v)).topologicalClosure) : ⇑(HilbertBasis.mk hv hsp) = v := by classical apply funext <| Orthonormal.linearIsometryEquiv_symm_apply_single_one hv hsp /-- An orthonormal family of vectors whose span has trivial orthogonal complement is a Hilbert basis. -/ protected def mkOfOrthogonalEqBot (hsp : (span 𝕜 (Set.range v))ᗮ = ⊥) : HilbertBasis ι 𝕜 E := HilbertBasis.mk hv (by rw [← orthogonal_orthogonal_eq_closure, ← eq_top_iff, orthogonal_eq_top_iff, hsp]) @[simp] protected theorem coe_mkOfOrthogonalEqBot (hsp : (span 𝕜 (Set.range v))ᗮ = ⊥) : ⇑(HilbertBasis.mkOfOrthogonalEqBot hv hsp) = v := HilbertBasis.coe_mk hv _ -- Note : this should be `b.repr` composed with an identification of `lp (fun i : ι => 𝕜) p` with -- `PiLp p (fun i : ι => 𝕜)` (in this case with `p = 2`), but we don't have this yet (July 2022). /-- An orthonormal basis is a Hilbert basis. -/ protected def _root_.OrthonormalBasis.toHilbertBasis [Fintype ι] (b : OrthonormalBasis ι 𝕜 E) : HilbertBasis ι 𝕜 E := HilbertBasis.mk b.orthonormal <| by simpa only [← OrthonormalBasis.coe_toBasis, b.toBasis.span_eq, eq_top_iff] using @subset_closure E _ _ @[simp] theorem _root_.OrthonormalBasis.coe_toHilbertBasis [Fintype ι] (b : OrthonormalBasis ι 𝕜 E) : (b.toHilbertBasis : ι → E) = b := HilbertBasis.coe_mk _ _ /-- A Hilbert space admits a Hilbert basis extending a given orthonormal subset. -/ theorem _root_.Orthonormal.exists_hilbertBasis_extension {s : Set E} (hs : Orthonormal 𝕜 ((↑) : s → E)) : ∃ (w : Set E) (b : HilbertBasis w 𝕜 E), s ⊆ w ∧ ⇑b = ((↑) : w → E) := let ⟨w, hws, hw_ortho, hw_max⟩ := exists_maximal_orthonormal hs ⟨w, HilbertBasis.mkOfOrthogonalEqBot hw_ortho (by simpa only [Subtype.range_coe_subtype, Set.setOf_mem_eq, maximal_orthonormal_iff_orthogonalComplement_eq_bot hw_ortho] using hw_max), hws, HilbertBasis.coe_mkOfOrthogonalEqBot _ _⟩ variable (𝕜 E) /-- A Hilbert space admits a Hilbert basis. -/ theorem _root_.exists_hilbertBasis : ∃ (w : Set E) (b : HilbertBasis w 𝕜 E), ⇑b = ((↑) : w → E) := let ⟨w, hw, _, hw''⟩ := (orthonormal_empty 𝕜 E).exists_hilbertBasis_extension ⟨w, hw, hw''⟩ end HilbertBasis
Analysis\InnerProductSpace\LaxMilgram.lean
/- Copyright (c) 2022 Daniel Roca González. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Daniel Roca González -/ import Mathlib.Analysis.InnerProductSpace.Dual /-! # The Lax-Milgram Theorem We consider a Hilbert space `V` over `ℝ` equipped with a bounded bilinear form `B : V →L[ℝ] V →L[ℝ] ℝ`. Recall that a bilinear form `B : V →L[ℝ] V →L[ℝ] ℝ` is *coercive* iff `∃ C, (0 < C) ∧ ∀ u, C * ‖u‖ * ‖u‖ ≤ B u u`. Under the hypothesis that `B` is coercive we prove the Lax-Milgram theorem: that is, the map `InnerProductSpace.continuousLinearMapOfBilin` from `Analysis.InnerProductSpace.Dual` can be upgraded to a continuous equivalence `IsCoercive.continuousLinearEquivOfBilin : V ≃L[ℝ] V`. ## References * We follow the notes of Peter Howard's Spring 2020 *M612: Partial Differential Equations* lecture, see[howard] ## Tags dual, Lax-Milgram -/ noncomputable section open RCLike LinearMap ContinuousLinearMap InnerProductSpace open LinearMap (ker range) open RealInnerProductSpace NNReal universe u namespace IsCoercive variable {V : Type u} [NormedAddCommGroup V] [InnerProductSpace ℝ V] [CompleteSpace V] variable {B : V →L[ℝ] V →L[ℝ] ℝ} local postfix:1024 "♯" => @continuousLinearMapOfBilin ℝ V _ _ _ _ theorem bounded_below (coercive : IsCoercive B) : ∃ C, 0 < C ∧ ∀ v, C * ‖v‖ ≤ ‖B♯ v‖ := by rcases coercive with ⟨C, C_ge_0, coercivity⟩ refine ⟨C, C_ge_0, ?_⟩ intro v by_cases h : 0 < ‖v‖ · refine (mul_le_mul_right h).mp ?_ calc C * ‖v‖ * ‖v‖ ≤ B v v := coercivity v _ = ⟪B♯ v, v⟫_ℝ := (continuousLinearMapOfBilin_apply B v v).symm _ ≤ ‖B♯ v‖ * ‖v‖ := real_inner_le_norm (B♯ v) v · have : v = 0 := by simpa using h simp [this] theorem antilipschitz (coercive : IsCoercive B) : ∃ C : ℝ≥0, 0 < C ∧ AntilipschitzWith C B♯ := by rcases coercive.bounded_below with ⟨C, C_pos, below_bound⟩ refine ⟨C⁻¹.toNNReal, Real.toNNReal_pos.mpr (inv_pos.mpr C_pos), ?_⟩ refine ContinuousLinearMap.antilipschitz_of_bound B♯ ?_ simp_rw [Real.coe_toNNReal', max_eq_left_of_lt (inv_pos.mpr C_pos), ← inv_mul_le_iff (inv_pos.mpr C_pos)] simpa using below_bound theorem ker_eq_bot (coercive : IsCoercive B) : ker B♯ = ⊥ := by rw [LinearMapClass.ker_eq_bot] rcases coercive.antilipschitz with ⟨_, _, antilipschitz⟩ exact antilipschitz.injective theorem isClosed_range (coercive : IsCoercive B) : IsClosed (range B♯ : Set V) := by rcases coercive.antilipschitz with ⟨_, _, antilipschitz⟩ exact antilipschitz.isClosed_range B♯.uniformContinuous @[deprecated (since := "2024-03-19")] alias closed_range := isClosed_range theorem range_eq_top (coercive : IsCoercive B) : range B♯ = ⊤ := by haveI := coercive.isClosed_range.completeSpace_coe rw [← (range B♯).orthogonal_orthogonal] rw [Submodule.eq_top_iff'] intro v w mem_w_orthogonal rcases coercive with ⟨C, C_pos, coercivity⟩ obtain rfl : w = 0 := by rw [← norm_eq_zero, ← mul_self_eq_zero, ← mul_right_inj' C_pos.ne', mul_zero, ← mul_assoc] apply le_antisymm · calc C * ‖w‖ * ‖w‖ ≤ B w w := coercivity w _ = ⟪B♯ w, w⟫_ℝ := (continuousLinearMapOfBilin_apply B w w).symm _ = 0 := mem_w_orthogonal _ ⟨w, rfl⟩ · positivity exact inner_zero_left _ /-- The Lax-Milgram equivalence of a coercive bounded bilinear operator: for all `v : V`, `continuousLinearEquivOfBilin B v` is the unique element `V` such that `continuousLinearEquivOfBilin B v, w⟫ = B v w`. The Lax-Milgram theorem states that this is a continuous equivalence. -/ def continuousLinearEquivOfBilin (coercive : IsCoercive B) : V ≃L[ℝ] V := ContinuousLinearEquiv.ofBijective B♯ coercive.ker_eq_bot coercive.range_eq_top @[simp] theorem continuousLinearEquivOfBilin_apply (coercive : IsCoercive B) (v w : V) : ⟪coercive.continuousLinearEquivOfBilin v, w⟫_ℝ = B v w := continuousLinearMapOfBilin_apply B v w theorem unique_continuousLinearEquivOfBilin (coercive : IsCoercive B) {v f : V} (is_lax_milgram : ∀ w, ⟪f, w⟫_ℝ = B v w) : f = coercive.continuousLinearEquivOfBilin v := unique_continuousLinearMapOfBilin B is_lax_milgram end IsCoercive
Analysis\InnerProductSpace\LinearPMap.lean
/- Copyright (c) 2022 Moritz Doll. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Moritz Doll -/ import Mathlib.Analysis.InnerProductSpace.Adjoint import Mathlib.Topology.Algebra.Module.Basic /-! # Partially defined linear operators on Hilbert spaces We will develop the basics of the theory of unbounded operators on Hilbert spaces. ## Main definitions * `LinearPMap.IsFormalAdjoint`: An operator `T` is a formal adjoint of `S` if for all `x` in the domain of `T` and `y` in the domain of `S`, we have that `⟪T x, y⟫ = ⟪x, S y⟫`. * `LinearPMap.adjoint`: The adjoint of a map `E →ₗ.[𝕜] F` as a map `F →ₗ.[𝕜] E`. ## Main statements * `LinearPMap.adjoint_isFormalAdjoint`: The adjoint is a formal adjoint * `LinearPMap.IsFormalAdjoint.le_adjoint`: Every formal adjoint is contained in the adjoint * `ContinuousLinearMap.toPMap_adjoint_eq_adjoint_toPMap_of_dense`: The adjoint on `ContinuousLinearMap` and `LinearPMap` coincide. ## Notation * For `T : E →ₗ.[𝕜] F` the adjoint can be written as `T†`. This notation is localized in `LinearPMap`. ## Implementation notes We use the junk value pattern to define the adjoint for all `LinearPMap`s. In the case that `T : E →ₗ.[𝕜] F` is not densely defined the adjoint `T†` is the zero map from `T.adjoint.domain` to `E`. ## References * [J. Weidmann, *Linear Operators in Hilbert Spaces*][weidmann_linear] ## Tags Unbounded operators, closed operators -/ noncomputable section open RCLike open scoped ComplexConjugate Classical variable {𝕜 E F G : Type*} [RCLike 𝕜] variable [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] variable [NormedAddCommGroup F] [InnerProductSpace 𝕜 F] local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y namespace LinearPMap /-- An operator `T` is a formal adjoint of `S` if for all `x` in the domain of `T` and `y` in the domain of `S`, we have that `⟪T x, y⟫ = ⟪x, S y⟫`. -/ def IsFormalAdjoint (T : E →ₗ.[𝕜] F) (S : F →ₗ.[𝕜] E) : Prop := ∀ (x : T.domain) (y : S.domain), ⟪T x, y⟫ = ⟪(x : E), S y⟫ variable {T : E →ₗ.[𝕜] F} {S : F →ₗ.[𝕜] E} @[symm] protected theorem IsFormalAdjoint.symm (h : T.IsFormalAdjoint S) : S.IsFormalAdjoint T := fun y _ => by rw [← inner_conj_symm, ← inner_conj_symm (y : F), h] variable (T) /-- The domain of the adjoint operator. This definition is needed to construct the adjoint operator and the preferred version to use is `T.adjoint.domain` instead of `T.adjointDomain`. -/ def adjointDomain : Submodule 𝕜 F where carrier := {y | Continuous ((innerₛₗ 𝕜 y).comp T.toFun)} zero_mem' := by rw [Set.mem_setOf_eq, LinearMap.map_zero, LinearMap.zero_comp] exact continuous_zero add_mem' hx hy := by rw [Set.mem_setOf_eq, LinearMap.map_add] at *; exact hx.add hy smul_mem' a x hx := by rw [Set.mem_setOf_eq, LinearMap.map_smulₛₗ] at * exact hx.const_smul (conj a) /-- The operator `fun x ↦ ⟪y, T x⟫` considered as a continuous linear operator from `T.adjointDomain` to `𝕜`. -/ def adjointDomainMkCLM (y : T.adjointDomain) : T.domain →L[𝕜] 𝕜 := ⟨(innerₛₗ 𝕜 (y : F)).comp T.toFun, y.prop⟩ theorem adjointDomainMkCLM_apply (y : T.adjointDomain) (x : T.domain) : adjointDomainMkCLM T y x = ⟪(y : F), T x⟫ := rfl variable {T} variable (hT : Dense (T.domain : Set E)) /-- The unique continuous extension of the operator `adjointDomainMkCLM` to `E`. -/ def adjointDomainMkCLMExtend (y : T.adjointDomain) : E →L[𝕜] 𝕜 := (T.adjointDomainMkCLM y).extend (Submodule.subtypeL T.domain) hT.denseRange_val uniformEmbedding_subtype_val.toUniformInducing @[simp] theorem adjointDomainMkCLMExtend_apply (y : T.adjointDomain) (x : T.domain) : adjointDomainMkCLMExtend hT y (x : E) = ⟪(y : F), T x⟫ := ContinuousLinearMap.extend_eq _ _ _ _ _ variable [CompleteSpace E] /-- The adjoint as a linear map from its domain to `E`. This is an auxiliary definition needed to define the adjoint operator as a `LinearPMap` without the assumption that `T.domain` is dense. -/ def adjointAux : T.adjointDomain →ₗ[𝕜] E where toFun y := (InnerProductSpace.toDual 𝕜 E).symm (adjointDomainMkCLMExtend hT y) map_add' x y := hT.eq_of_inner_left fun _ => by simp only [inner_add_left, Submodule.coe_add, InnerProductSpace.toDual_symm_apply, adjointDomainMkCLMExtend_apply] map_smul' _ _ := hT.eq_of_inner_left fun _ => by simp only [inner_smul_left, Submodule.coe_smul_of_tower, RingHom.id_apply, InnerProductSpace.toDual_symm_apply, adjointDomainMkCLMExtend_apply] theorem adjointAux_inner (y : T.adjointDomain) (x : T.domain) : ⟪adjointAux hT y, x⟫ = ⟪(y : F), T x⟫ := by simp only [adjointAux, LinearMap.coe_mk, InnerProductSpace.toDual_symm_apply, adjointDomainMkCLMExtend_apply] -- Porting note(https://github.com/leanprover-community/mathlib4/issues/5026): -- mathlib3 was finished here simp only [AddHom.coe_mk, InnerProductSpace.toDual_symm_apply] rw [adjointDomainMkCLMExtend_apply] theorem adjointAux_unique (y : T.adjointDomain) {x₀ : E} (hx₀ : ∀ x : T.domain, ⟪x₀, x⟫ = ⟪(y : F), T x⟫) : adjointAux hT y = x₀ := hT.eq_of_inner_left fun v => (adjointAux_inner hT _ _).trans (hx₀ v).symm variable (T) /-- The adjoint operator as a partially defined linear operator. -/ def adjoint : F →ₗ.[𝕜] E where domain := T.adjointDomain toFun := if hT : Dense (T.domain : Set E) then adjointAux hT else 0 scoped postfix:1024 "†" => LinearPMap.adjoint theorem mem_adjoint_domain_iff (y : F) : y ∈ T†.domain ↔ Continuous ((innerₛₗ 𝕜 y).comp T.toFun) := Iff.rfl variable {T} theorem mem_adjoint_domain_of_exists (y : F) (h : ∃ w : E, ∀ x : T.domain, ⟪w, x⟫ = ⟪y, T x⟫) : y ∈ T†.domain := by cases' h with w hw rw [T.mem_adjoint_domain_iff] have : Continuous ((innerSL 𝕜 w).comp T.domain.subtypeL) := by fun_prop convert this using 1 exact funext fun x => (hw x).symm theorem adjoint_apply_of_not_dense (hT : ¬Dense (T.domain : Set E)) (y : T†.domain) : T† y = 0 := by change (if hT : Dense (T.domain : Set E) then adjointAux hT else 0) y = _ simp only [hT, not_false_iff, dif_neg, LinearMap.zero_apply] theorem adjoint_apply_of_dense (y : T†.domain) : T† y = adjointAux hT y := by change (if hT : Dense (T.domain : Set E) then adjointAux hT else 0) y = _ simp only [hT, dif_pos, LinearMap.coe_mk] theorem adjoint_apply_eq (y : T†.domain) {x₀ : E} (hx₀ : ∀ x : T.domain, ⟪x₀, x⟫ = ⟪(y : F), T x⟫) : T† y = x₀ := (adjoint_apply_of_dense hT y).symm ▸ adjointAux_unique hT _ hx₀ /-- The fundamental property of the adjoint. -/ theorem adjoint_isFormalAdjoint : T†.IsFormalAdjoint T := fun x => (adjoint_apply_of_dense hT x).symm ▸ adjointAux_inner hT x /-- The adjoint is maximal in the sense that it contains every formal adjoint. -/ theorem IsFormalAdjoint.le_adjoint (h : T.IsFormalAdjoint S) : S ≤ T† := ⟨-- Trivially, every `x : S.domain` is in `T.adjoint.domain` fun x hx => mem_adjoint_domain_of_exists _ ⟨S ⟨x, hx⟩, h.symm ⟨x, hx⟩⟩,-- Equality on `S.domain` follows from equality -- `⟪v, S x⟫ = ⟪v, T.adjoint y⟫` for all `v : T.domain`: fun _ _ hxy => (adjoint_apply_eq hT _ fun _ => by rw [h.symm, hxy]).symm⟩ end LinearPMap namespace ContinuousLinearMap variable [CompleteSpace E] [CompleteSpace F] variable (A : E →L[𝕜] F) {p : Submodule 𝕜 E} /-- Restricting `A` to a dense submodule and taking the `LinearPMap.adjoint` is the same as taking the `ContinuousLinearMap.adjoint` interpreted as a `LinearPMap`. -/ theorem toPMap_adjoint_eq_adjoint_toPMap_of_dense (hp : Dense (p : Set E)) : (A.toPMap p).adjoint = A.adjoint.toPMap ⊤ := by ext x y hxy · simp only [LinearMap.toPMap_domain, Submodule.mem_top, iff_true_iff, LinearPMap.mem_adjoint_domain_iff, LinearMap.coe_comp, innerₛₗ_apply_coe] exact ((innerSL 𝕜 x).comp <| A.comp <| Submodule.subtypeL _).cont refine LinearPMap.adjoint_apply_eq ?_ _ fun v => ?_ · -- Porting note: was simply `hp` as an argument above simpa using hp · simp only [adjoint_inner_left, hxy, LinearMap.toPMap_apply, coe_coe] end ContinuousLinearMap section Star namespace LinearPMap variable [CompleteSpace E] instance instStar : Star (E →ₗ.[𝕜] E) where star := fun A ↦ A.adjoint variable {A : E →ₗ.[𝕜] E} theorem isSelfAdjoint_def : IsSelfAdjoint A ↔ A† = A := Iff.rfl /-- Every self-adjoint `LinearPMap` has dense domain. This is not true by definition since we define the adjoint without the assumption that the domain is dense, but the choice of the junk value implies that a `LinearPMap` cannot be self-adjoint if it does not have dense domain. -/ theorem _root_.IsSelfAdjoint.dense_domain (hA : IsSelfAdjoint A) : Dense (A.domain : Set E) := by by_contra h rw [isSelfAdjoint_def] at hA have h' : A.domain = ⊤ := by rw [← hA, Submodule.eq_top_iff'] intro x rw [mem_adjoint_domain_iff, ← hA] refine (innerSL 𝕜 x).cont.comp ?_ simp only [adjoint, h] exact continuous_const simp [h'] at h end LinearPMap end Star
Analysis\InnerProductSpace\MeanErgodic.lean
/- Copyright (c) 2023 Yury Kudryashov. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yury Kudryashov -/ import Mathlib.Analysis.InnerProductSpace.Projection import Mathlib.Dynamics.BirkhoffSum.NormedSpace /-! # Von Neumann Mean Ergodic Theorem in a Hilbert Space In this file we prove the von Neumann Mean Ergodic Theorem for an operator in a Hilbert space. It says that for a contracting linear self-map `f : E →ₗ[𝕜] E` of a Hilbert space, the Birkhoff averages ``` birkhoffAverage 𝕜 f id N x = (N : 𝕜)⁻¹ • ∑ n ∈ Finset.range N, f^[n] x ``` converge to the orthogonal projection of `x` to the subspace of fixed points of `f`, see `ContinuousLinearMap.tendsto_birkhoffAverage_orthogonalProjection`. -/ open Filter Finset Function Bornology open scoped Topology variable {𝕜 E : Type*} [RCLike 𝕜] [NormedAddCommGroup E] /-- **Von Neumann Mean Ergodic Theorem**, a version for a normed space. Let `f : E → E` be a contracting linear self-map of a normed space. Let `S` be the subspace of fixed points of `f`. Let `g : E → S` be a continuous linear projection, `g|_S=id`. If the range of `f - id` is dense in the kernel of `g`, then for each `x`, the Birkhoff averages ``` birkhoffAverage 𝕜 f id N x = (N : 𝕜)⁻¹ • ∑ n ∈ Finset.range N, f^[n] x ``` converge to `g x` as `N → ∞`. Usually, this fact is not formulated as a separate lemma. I chose to do it in order to isolate parts of the proof that do not rely on the inner product space structure. -/ theorem LinearMap.tendsto_birkhoffAverage_of_ker_subset_closure [NormedSpace 𝕜 E] (f : E →ₗ[𝕜] E) (hf : LipschitzWith 1 f) (g : E →L[𝕜] LinearMap.eqLocus f 1) (hg_proj : ∀ x : LinearMap.eqLocus f 1, g x = x) (hg_ker : (LinearMap.ker g : Set E) ⊆ closure (LinearMap.range (f - 1))) (x : E) : Tendsto (birkhoffAverage 𝕜 f _root_.id · x) atTop (𝓝 (g x)) := by /- Any point can be represented as a sum of `y ∈ LinearMap.ker g` and a fixed point `z`. -/ obtain ⟨y, hy, z, hz, rfl⟩ : ∃ y, g y = 0 ∧ ∃ z, IsFixedPt f z ∧ x = y + z := ⟨x - g x, by simp [hg_proj], g x, (g x).2, by simp⟩ /- For a fixed point, the theorem is trivial, so it suffices to prove it for `y ∈ LinearMap.ker g`. -/ suffices Tendsto (birkhoffAverage 𝕜 f _root_.id · y) atTop (𝓝 0) by have hgz : g z = z := congr_arg Subtype.val (hg_proj ⟨z, hz⟩) simpa [hy, hgz, birkhoffAverage, birkhoffSum, Finset.sum_add_distrib, smul_add] using this.add (hz.tendsto_birkhoffAverage 𝕜 _root_.id) /- By continuity, it suffices to prove the theorem on a dense subset of `LinearMap.ker g`. By assumption, `LinearMap.range (f - 1)` is dense in the kernel of `g`, so it suffices to prove the theorem for `y = f x - x`. -/ have : IsClosed {x | Tendsto (birkhoffAverage 𝕜 f _root_.id · x) atTop (𝓝 0)} := isClosed_setOf_tendsto_birkhoffAverage 𝕜 hf uniformContinuous_id continuous_const refine closure_minimal (Set.forall_mem_range.2 fun x ↦ ?_) this (hg_ker hy) /- Finally, for `y = f x - x` the average is equal to the difference between averages along the orbits of `f x` and `x`, and most of the terms cancel. -/ have : IsBounded (Set.range (_root_.id <| f^[·] x)) := isBounded_iff_forall_norm_le.2 ⟨‖x‖, Set.forall_mem_range.2 fun n ↦ by have H : f^[n] 0 = 0 := iterate_map_zero (f : E →+ E) n simpa [H] using (hf.iterate n).dist_le_mul x 0⟩ have H : ∀ n x y, f^[n] (x - y) = f^[n] x - f^[n] y := iterate_map_sub (f : E →+ E) simpa [birkhoffAverage, birkhoffSum, Finset.sum_sub_distrib, smul_sub, H] using tendsto_birkhoffAverage_apply_sub_birkhoffAverage 𝕜 this variable [InnerProductSpace 𝕜 E] [CompleteSpace E] local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y /-- **Von Neumann Mean Ergodic Theorem** for an operator in a Hilbert space. For a contracting continuous linear self-map `f : E →L[𝕜] E` of a Hilbert space, `‖f‖ ≤ 1`, the Birkhoff averages ``` birkhoffAverage 𝕜 f id N x = (N : 𝕜)⁻¹ • ∑ n ∈ Finset.range N, f^[n] x ``` converge to the orthogonal projection of `x` to the subspace of fixed points of `f`. -/ theorem ContinuousLinearMap.tendsto_birkhoffAverage_orthogonalProjection (f : E →L[𝕜] E) (hf : ‖f‖ ≤ 1) (x : E) : Tendsto (birkhoffAverage 𝕜 f _root_.id · x) atTop (𝓝 <| orthogonalProjection (LinearMap.eqLocus f 1) x) := by /- Due to the previous theorem, it suffices to verify that the range of `f - 1` is dense in the orthogonal complement to the submodule of fixed points of `f`. -/ apply (f : E →ₗ[𝕜] E).tendsto_birkhoffAverage_of_ker_subset_closure (f.lipschitz.weaken hf) · exact orthogonalProjection_mem_subspace_eq_self (K := LinearMap.eqLocus f 1) · clear x /- In other words, we need to verify that any vector that is orthogonal to the range of `f - 1` is a fixed point of `f`. -/ rw [ker_orthogonalProjection, ← Submodule.topologicalClosure_coe, SetLike.coe_subset_coe, ← Submodule.orthogonal_orthogonal_eq_closure] /- To verify this, we verify `‖f x‖ ≤ ‖x‖` (because `‖f‖ ≤ 1`) and `⟪f x, x⟫ = ‖x‖²`. -/ refine Submodule.orthogonal_le fun x hx ↦ eq_of_norm_le_re_inner_eq_norm_sq (𝕜 := 𝕜) ?_ ?_ · simpa using f.le_of_opNorm_le hf x · have : ∀ y, ⟪f y, x⟫ = ⟪y, x⟫ := by simpa [Submodule.mem_orthogonal, inner_sub_left, sub_eq_zero] using hx simp [this, ← norm_sq_eq_inner]
Analysis\InnerProductSpace\NormPow.lean
/- Copyright (c) 2024 Floris van Doorn. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Floris van Doorn, Heather Macbeth -/ import Mathlib.Analysis.InnerProductSpace.Calculus import Mathlib.Analysis.Normed.Module.Dual import Mathlib.Analysis.SpecialFunctions.Pow.Deriv /-! # Properties about the powers of the norm In this file we prove that `x ↦ ‖x‖ ^ p` is continuously differentiable for an inner product space and for a real number `p > 1`. ## TODO * `x ↦ ‖x‖ ^ p` should be `C^n` for `p > n`. -/ section ContDiffNormPow open Asymptotics Real Topology open scoped NNReal variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] theorem hasFDerivAt_norm_rpow (x : E) {p : ℝ} (hp : 1 < p) : HasFDerivAt (fun x : E ↦ ‖x‖ ^ p) ((p * ‖x‖ ^ (p - 2)) • innerSL ℝ x) x := by by_cases hx : x = 0 · simp only [hx, norm_zero, map_zero, smul_zero] have h2p : 0 < p - 1 := sub_pos.mpr hp rw [HasFDerivAt, hasFDerivAtFilter_iff_isLittleO] calc (fun x : E ↦ ‖x‖ ^ p - ‖(0 : E)‖ ^ p - 0) = (fun x : E ↦ ‖x‖ ^ p) := by simp [zero_lt_one.trans hp |>.ne'] _ = (fun x : E ↦ ‖x‖ * ‖x‖ ^ (p - 1)) := by ext x rw [← rpow_one_add' (norm_nonneg x) (by positivity)] ring_nf _ =o[𝓝 0] (fun x : E ↦ ‖x‖ * 1) := by refine (isBigO_refl _ _).mul_isLittleO <| (isLittleO_const_iff <| by norm_num).mpr ?_ convert continuousAt_id.norm.rpow_const (.inr h2p.le) |>.tendsto simp [h2p.ne'] _ =O[𝓝 0] (fun (x : E) ↦ x - 0) := by simp_rw [mul_one, isBigO_norm_left (f' := fun x ↦ x), sub_zero, isBigO_refl] · apply HasStrictFDerivAt.hasFDerivAt convert (hasStrictFDerivAt_norm_sq x).rpow_const (p := p / 2) (by simp [hx]) using 0 simp_rw [← Real.rpow_natCast_mul (norm_nonneg _), ← Nat.cast_smul_eq_nsmul ℝ, smul_smul] ring_nf -- doesn't close the goal? congr! 2 ring theorem differentiable_norm_rpow {p : ℝ} (hp : 1 < p) : Differentiable ℝ (fun x : E ↦ ‖x‖ ^ p) := fun x ↦ hasFDerivAt_norm_rpow x hp |>.differentiableAt theorem hasDerivAt_norm_rpow (x : ℝ) {p : ℝ} (hp : 1 < p) : HasDerivAt (fun x : ℝ ↦ ‖x‖ ^ p) (p * ‖x‖ ^ (p - 2) * x) x := by convert hasFDerivAt_norm_rpow x hp |>.hasDerivAt using 1; simp theorem hasDerivAt_abs_rpow (x : ℝ) {p : ℝ} (hp : 1 < p) : HasDerivAt (fun x : ℝ ↦ |x| ^ p) (p * |x| ^ (p - 2) * x) x := by simpa using hasDerivAt_norm_rpow x hp theorem fderiv_norm_rpow (x : E) {p : ℝ} (hp : 1 < p) : fderiv ℝ (fun x ↦ ‖x‖ ^ p) x = (p * ‖x‖ ^ (p - 2)) • innerSL ℝ x := hasFDerivAt_norm_rpow x hp |>.fderiv theorem Differentiable.fderiv_norm_rpow {f : F → E} (hf : Differentiable ℝ f) {x : F} {p : ℝ} (hp : 1 < p) : fderiv ℝ (fun x ↦ ‖f x‖ ^ p) x = (p * ‖f x‖ ^ (p - 2)) • (innerSL ℝ (f x)).comp (fderiv ℝ f x) := hasFDerivAt_norm_rpow (f x) hp |>.comp x (hf x).hasFDerivAt |>.fderiv theorem norm_fderiv_norm_rpow_le {f : F → E} (hf : Differentiable ℝ f) {x : F} {p : ℝ} (hp : 1 < p) : ‖fderiv ℝ (fun x ↦ ‖f x‖ ^ p) x‖ ≤ p * ‖f x‖ ^ (p - 1) * ‖fderiv ℝ f x‖ := by rw [hf.fderiv_norm_rpow hp, norm_smul, norm_mul] simp_rw [norm_rpow_of_nonneg (norm_nonneg _), norm_norm, norm_eq_abs, abs_eq_self.mpr <| zero_le_one.trans hp.le, mul_assoc] gcongr _ * ?_ refine mul_le_mul_of_nonneg_left (ContinuousLinearMap.opNorm_comp_le ..) (by positivity) |>.trans_eq ?_ rw [innerSL_apply_norm, ← mul_assoc, ← Real.rpow_add_one' (by positivity) (by linarith)] ring_nf theorem norm_fderiv_norm_id_rpow (x : E) {p : ℝ} (hp : 1 < p) : ‖fderiv ℝ (fun x ↦ ‖x‖ ^ p) x‖ = p * ‖x‖ ^ (p - 1) := by rw [fderiv_norm_rpow x hp, norm_smul, norm_mul] simp_rw [norm_rpow_of_nonneg (norm_nonneg _), norm_norm, norm_eq_abs, abs_eq_self.mpr <| zero_le_one.trans hp.le, mul_assoc, innerSL_apply_norm] rw [← Real.rpow_add_one' (by positivity) (by linarith)] ring_nf theorem nnnorm_fderiv_norm_rpow_le {f : F → E} (hf : Differentiable ℝ f) {x : F} {p : ℝ≥0} (hp : 1 < p) : ‖fderiv ℝ (fun x ↦ ‖f x‖ ^ (p : ℝ)) x‖₊ ≤ p * ‖f x‖₊ ^ ((p : ℝ) - 1) * ‖fderiv ℝ f x‖₊ := norm_fderiv_norm_rpow_le hf hp theorem contDiff_norm_rpow {p : ℝ} (hp : 1 < p) : ContDiff ℝ 1 (fun x : E ↦ ‖x‖ ^ p) := by rw [contDiff_one_iff_fderiv] refine ⟨fun x ↦ hasFDerivAt_norm_rpow x hp |>.differentiableAt, ?_⟩ simp_rw [continuous_iff_continuousAt] intro x by_cases hx : x = 0 · simp_rw [hx, ContinuousAt, fderiv_norm_rpow (0 : E) hp, norm_zero, map_zero, smul_zero] rw [tendsto_zero_iff_norm_tendsto_zero] refine tendsto_of_tendsto_of_tendsto_of_le_of_le (tendsto_const_nhds) ?_ (fun _ ↦ norm_nonneg _) (fun _ ↦ norm_fderiv_norm_id_rpow _ hp |>.le) suffices ContinuousAt (fun x : E ↦ p * ‖x‖ ^ (p - 1)) 0 by simpa [ContinuousAt, sub_ne_zero_of_ne hp.ne'] using this fun_prop (discharger := simp [hp.le]) · simp_rw [funext fun x ↦ fderiv_norm_rpow (E := E) (x := x) hp] fun_prop (discharger := simp [hx]) theorem ContDiff.norm_rpow {f : F → E} (hf : ContDiff ℝ 1 f) {p : ℝ} (hp : 1 < p) : ContDiff ℝ 1 (fun x ↦ ‖f x‖ ^ p) := contDiff_norm_rpow hp |>.comp hf theorem Differentiable.norm_rpow {f : F → E} (hf : Differentiable ℝ f) {p : ℝ} (hp : 1 < p) : Differentiable ℝ (fun x ↦ ‖f x‖ ^ p) := contDiff_norm_rpow hp |>.differentiable le_rfl |>.comp hf end ContDiffNormPow
Analysis\InnerProductSpace\OfNorm.lean
/- Copyright (c) 2020 Heather Macbeth. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Heather Macbeth -/ import Mathlib.Topology.Algebra.Algebra import Mathlib.Analysis.InnerProductSpace.Basic /-! # Inner product space derived from a norm This file defines an `InnerProductSpace` instance from a norm that respects the parallellogram identity. The parallelogram identity is a way to express the inner product of `x` and `y` in terms of the norms of `x`, `y`, `x + y`, `x - y`. ## Main results - `InnerProductSpace.ofNorm`: a normed space whose norm respects the parallellogram identity, can be seen as an inner product space. ## Implementation notes We define `inner_` $$\langle x, y \rangle := \frac{1}{4} (‖x + y‖^2 - ‖x - y‖^2 + i ‖ix + y‖ ^ 2 - i ‖ix - y‖^2)$$ and use the parallelogram identity $$‖x + y‖^2 + ‖x - y‖^2 = 2 (‖x‖^2 + ‖y‖^2)$$ to prove it is an inner product, i.e., that it is conjugate-symmetric (`inner_.conj_symm`) and linear in the first argument. `add_left` is proved by judicious application of the parallelogram identity followed by tedious arithmetic. `smul_left` is proved step by step, first noting that $\langle λ x, y \rangle = λ \langle x, y \rangle$ for $λ ∈ ℕ$, $λ = -1$, hence $λ ∈ ℤ$ and $λ ∈ ℚ$ by arithmetic. Then by continuity and the fact that ℚ is dense in ℝ, the same is true for ℝ. The case of ℂ then follows by applying the result for ℝ and more arithmetic. ## TODO Move upstream to `Analysis.InnerProductSpace.Basic`. ## References - [Jordan, P. and von Neumann, J., *On inner products in linear, metric spaces*][Jordan1935] - https://math.stackexchange.com/questions/21792/norms-induced-by-inner-products-and-the-parallelogram-law - https://math.dartmouth.edu/archive/m113w10/public_html/jordan-vneumann-thm.pdf ## Tags inner product space, Hilbert space, norm -/ open RCLike open scoped ComplexConjugate variable {𝕜 : Type*} [RCLike 𝕜] (E : Type*) [NormedAddCommGroup E] /-- Predicate for the parallelogram identity to hold in a normed group. This is a scalar-less version of `InnerProductSpace`. If you have an `InnerProductSpaceable` assumption, you can locally upgrade that to `InnerProductSpace 𝕜 E` using `casesI nonempty_innerProductSpace 𝕜 E`. -/ class InnerProductSpaceable : Prop where parallelogram_identity : ∀ x y : E, ‖x + y‖ * ‖x + y‖ + ‖x - y‖ * ‖x - y‖ = 2 * (‖x‖ * ‖x‖ + ‖y‖ * ‖y‖) variable (𝕜) {E} theorem InnerProductSpace.toInnerProductSpaceable [InnerProductSpace 𝕜 E] : InnerProductSpaceable E := ⟨parallelogram_law_with_norm 𝕜⟩ -- See note [lower instance priority] instance (priority := 100) InnerProductSpace.toInnerProductSpaceable_ofReal [InnerProductSpace ℝ E] : InnerProductSpaceable E := ⟨parallelogram_law_with_norm ℝ⟩ variable [NormedSpace 𝕜 E] local notation "𝓚" => algebraMap ℝ 𝕜 /-- Auxiliary definition of the inner product derived from the norm. -/ private noncomputable def inner_ (x y : E) : 𝕜 := 4⁻¹ * (𝓚 ‖x + y‖ * 𝓚 ‖x + y‖ - 𝓚 ‖x - y‖ * 𝓚 ‖x - y‖ + (I : 𝕜) * 𝓚 ‖(I : 𝕜) • x + y‖ * 𝓚 ‖(I : 𝕜) • x + y‖ - (I : 𝕜) * 𝓚 ‖(I : 𝕜) • x - y‖ * 𝓚 ‖(I : 𝕜) • x - y‖) namespace InnerProductSpaceable variable {𝕜} (E) -- Porting note: prime added to avoid clashing with public `innerProp` /-- Auxiliary definition for the `add_left` property. -/ private def innerProp' (r : 𝕜) : Prop := ∀ x y : E, inner_ 𝕜 (r • x) y = conj r * inner_ 𝕜 x y variable {E} theorem innerProp_neg_one : innerProp' E ((-1 : ℤ) : 𝕜) := by intro x y simp only [inner_, neg_mul_eq_neg_mul, one_mul, Int.cast_one, one_smul, RingHom.map_one, map_neg, Int.cast_neg, neg_smul, neg_one_mul] rw [neg_mul_comm] congr 1 have h₁ : ‖-x - y‖ = ‖x + y‖ := by rw [← neg_add', norm_neg] have h₂ : ‖-x + y‖ = ‖x - y‖ := by rw [← neg_sub, norm_neg, sub_eq_neg_add] have h₃ : ‖(I : 𝕜) • -x + y‖ = ‖(I : 𝕜) • x - y‖ := by rw [← neg_sub, norm_neg, sub_eq_neg_add, ← smul_neg] have h₄ : ‖(I : 𝕜) • -x - y‖ = ‖(I : 𝕜) • x + y‖ := by rw [smul_neg, ← neg_add', norm_neg] rw [h₁, h₂, h₃, h₄] ring theorem _root_.Continuous.inner_ {f g : ℝ → E} (hf : Continuous f) (hg : Continuous g) : Continuous fun x => inner_ 𝕜 (f x) (g x) := by unfold inner_ fun_prop theorem inner_.norm_sq (x : E) : ‖x‖ ^ 2 = re (inner_ 𝕜 x x) := by simp only [inner_] have h₁ : RCLike.normSq (4 : 𝕜) = 16 := by have : ((4 : ℝ) : 𝕜) = (4 : 𝕜) := by norm_cast rw [← this, normSq_eq_def', RCLike.norm_of_nonneg (by norm_num : (0 : ℝ) ≤ 4)] norm_num have h₂ : ‖x + x‖ = 2 * ‖x‖ := by rw [← two_smul 𝕜, norm_smul, RCLike.norm_two] simp only [h₁, h₂, algebraMap_eq_ofReal, sub_self, norm_zero, mul_re, inv_re, ofNat_re, map_sub, map_add, ofReal_re, ofNat_im, ofReal_im, mul_im, I_re, inv_im] ring theorem inner_.conj_symm (x y : E) : conj (inner_ 𝕜 y x) = inner_ 𝕜 x y := by simp only [inner_] have h4 : conj (4⁻¹ : 𝕜) = 4⁻¹ := by norm_num rw [map_mul, h4] congr 1 simp only [map_sub, map_add, conj_ofReal, map_mul, conj_I] rw [add_comm y x, norm_sub_rev] by_cases hI : (I : 𝕜) = 0 · simp only [hI, neg_zero, zero_mul] -- Porting note: this replaces `norm_I_of_ne_zero` which does not exist in Lean 4 have : ‖(I : 𝕜)‖ = 1 := by rw [← mul_self_inj_of_nonneg (norm_nonneg I) zero_le_one, one_mul, ← norm_mul, I_mul_I_of_nonzero hI, norm_neg, norm_one] have h₁ : ‖(I : 𝕜) • y - x‖ = ‖(I : 𝕜) • x + y‖ := by trans ‖(I : 𝕜) • ((I : 𝕜) • y - x)‖ · rw [norm_smul, this, one_mul] · rw [smul_sub, smul_smul, I_mul_I_of_nonzero hI, neg_one_smul, ← neg_add', add_comm, norm_neg] have h₂ : ‖(I : 𝕜) • y + x‖ = ‖(I : 𝕜) • x - y‖ := by trans ‖(I : 𝕜) • ((I : 𝕜) • y + x)‖ · rw [norm_smul, this, one_mul] · rw [smul_add, smul_smul, I_mul_I_of_nonzero hI, neg_one_smul, ← neg_add_eq_sub] rw [h₁, h₂, ← sub_add_eq_add_sub] simp only [neg_mul, sub_eq_add_neg, neg_neg] variable [InnerProductSpaceable E] private theorem add_left_aux1 (x y z : E) : ‖x + y + z‖ * ‖x + y + z‖ = (‖2 • x + y‖ * ‖2 • x + y‖ + ‖2 • z + y‖ * ‖2 • z + y‖) / 2 - ‖x - z‖ * ‖x - z‖ := by rw [eq_sub_iff_add_eq, eq_div_iff (two_ne_zero' ℝ), mul_comm _ (2 : ℝ), eq_comm] convert parallelogram_identity (x + y + z) (x - z) using 4 <;> · rw [two_smul]; abel private theorem add_left_aux2 (x y z : E) : ‖x + y - z‖ * ‖x + y - z‖ = (‖2 • x + y‖ * ‖2 • x + y‖ + ‖y - 2 • z‖ * ‖y - 2 • z‖) / 2 - ‖x + z‖ * ‖x + z‖ := by rw [eq_sub_iff_add_eq, eq_div_iff (two_ne_zero' ℝ), mul_comm _ (2 : ℝ), eq_comm] have h₀ := parallelogram_identity (x + y - z) (x + z) convert h₀ using 4 <;> · rw [two_smul]; abel private theorem add_left_aux2' (x y z : E) : ‖x + y + z‖ * ‖x + y + z‖ - ‖x + y - z‖ * ‖x + y - z‖ = ‖x + z‖ * ‖x + z‖ - ‖x - z‖ * ‖x - z‖ + (‖2 • z + y‖ * ‖2 • z + y‖ - ‖y - 2 • z‖ * ‖y - 2 • z‖) / 2 := by rw [add_left_aux1, add_left_aux2]; ring private theorem add_left_aux3 (y z : E) : ‖2 • z + y‖ * ‖2 • z + y‖ = 2 * (‖y + z‖ * ‖y + z‖ + ‖z‖ * ‖z‖) - ‖y‖ * ‖y‖ := by apply eq_sub_of_add_eq convert parallelogram_identity (y + z) z using 4 <;> (try rw [two_smul]) <;> abel private theorem add_left_aux4 (y z : E) : ‖y - 2 • z‖ * ‖y - 2 • z‖ = 2 * (‖y - z‖ * ‖y - z‖ + ‖z‖ * ‖z‖) - ‖y‖ * ‖y‖ := by apply eq_sub_of_add_eq' have h₀ := parallelogram_identity (y - z) z convert h₀ using 4 <;> (try rw [two_smul]) <;> abel private theorem add_left_aux4' (y z : E) : (‖2 • z + y‖ * ‖2 • z + y‖ - ‖y - 2 • z‖ * ‖y - 2 • z‖) / 2 = ‖y + z‖ * ‖y + z‖ - ‖y - z‖ * ‖y - z‖ := by rw [add_left_aux3, add_left_aux4]; ring private theorem add_left_aux5 (x y z : E) : ‖(I : 𝕜) • (x + y) + z‖ * ‖(I : 𝕜) • (x + y) + z‖ = (‖(I : 𝕜) • (2 • x + y)‖ * ‖(I : 𝕜) • (2 • x + y)‖ + ‖(I : 𝕜) • y + 2 • z‖ * ‖(I : 𝕜) • y + 2 • z‖) / 2 - ‖(I : 𝕜) • x - z‖ * ‖(I : 𝕜) • x - z‖ := by rw [eq_sub_iff_add_eq, eq_div_iff (two_ne_zero' ℝ), mul_comm _ (2 : ℝ), eq_comm] have h₀ := parallelogram_identity ((I : 𝕜) • (x + y) + z) ((I : 𝕜) • x - z) convert h₀ using 4 <;> · try simp only [two_smul, smul_add]; abel private theorem add_left_aux6 (x y z : E) : ‖(I : 𝕜) • (x + y) - z‖ * ‖(I : 𝕜) • (x + y) - z‖ = (‖(I : 𝕜) • (2 • x + y)‖ * ‖(I : 𝕜) • (2 • x + y)‖ + ‖(I : 𝕜) • y - 2 • z‖ * ‖(I : 𝕜) • y - 2 • z‖) / 2 - ‖(I : 𝕜) • x + z‖ * ‖(I : 𝕜) • x + z‖ := by rw [eq_sub_iff_add_eq, eq_div_iff (two_ne_zero' ℝ), mul_comm _ (2 : ℝ), eq_comm] have h₀ := parallelogram_identity ((I : 𝕜) • (x + y) - z) ((I : 𝕜) • x + z) convert h₀ using 4 <;> · try simp only [two_smul, smul_add]; abel private theorem add_left_aux7 (y z : E) : ‖(I : 𝕜) • y + 2 • z‖ * ‖(I : 𝕜) • y + 2 • z‖ = 2 * (‖(I : 𝕜) • y + z‖ * ‖(I : 𝕜) • y + z‖ + ‖z‖ * ‖z‖) - ‖(I : 𝕜) • y‖ * ‖(I : 𝕜) • y‖ := by apply eq_sub_of_add_eq have h₀ := parallelogram_identity ((I : 𝕜) • y + z) z convert h₀ using 4 <;> · (try simp only [two_smul, smul_add]); abel private theorem add_left_aux8 (y z : E) : ‖(I : 𝕜) • y - 2 • z‖ * ‖(I : 𝕜) • y - 2 • z‖ = 2 * (‖(I : 𝕜) • y - z‖ * ‖(I : 𝕜) • y - z‖ + ‖z‖ * ‖z‖) - ‖(I : 𝕜) • y‖ * ‖(I : 𝕜) • y‖ := by apply eq_sub_of_add_eq' have h₀ := parallelogram_identity ((I : 𝕜) • y - z) z convert h₀ using 4 <;> · (try simp only [two_smul, smul_add]); abel theorem add_left (x y z : E) : inner_ 𝕜 (x + y) z = inner_ 𝕜 x z + inner_ 𝕜 y z := by simp only [inner_, ← mul_add] congr simp only [mul_assoc, ← map_mul, add_sub_assoc, ← mul_sub, ← map_sub] rw [add_add_add_comm] simp only [← map_add, ← mul_add] congr · rw [← add_sub_assoc, add_left_aux2', add_left_aux4'] · rw [add_left_aux5, add_left_aux6, add_left_aux7, add_left_aux8] simp only [map_sub, map_mul, map_add, div_eq_mul_inv] ring theorem nat (n : ℕ) (x y : E) : inner_ 𝕜 ((n : 𝕜) • x) y = (n : 𝕜) * inner_ 𝕜 x y := by induction' n with n ih · simp only [inner_, Nat.zero_eq, zero_sub, Nat.cast_zero, zero_mul, eq_self_iff_true, zero_smul, zero_add, mul_zero, sub_self, norm_neg, smul_zero] · simp only [Nat.cast_succ, add_smul, one_smul] rw [add_left, ih, add_mul, one_mul] private theorem nat_prop (r : ℕ) : innerProp' E (r : 𝕜) := fun x y => by simp only [map_natCast]; exact nat r x y private theorem int_prop (n : ℤ) : innerProp' E (n : 𝕜) := by intro x y rw [← n.sign_mul_natAbs] simp only [Int.cast_natCast, map_natCast, map_intCast, Int.cast_mul, map_mul, mul_smul] obtain hn | rfl | hn := lt_trichotomy n 0 · rw [Int.sign_eq_neg_one_of_neg hn, innerProp_neg_one ((n.natAbs : 𝕜) • x), nat] simp only [map_neg, neg_mul, one_mul, mul_eq_mul_left_iff, true_or_iff, Int.natAbs_eq_zero, eq_self_iff_true, Int.cast_one, map_one, neg_inj, Nat.cast_eq_zero, Int.cast_neg] · simp only [inner_, Int.cast_zero, zero_sub, Nat.cast_zero, zero_mul, eq_self_iff_true, Int.sign_zero, zero_smul, zero_add, mul_zero, smul_zero, sub_self, norm_neg, Int.natAbs_zero] · rw [Int.sign_eq_one_of_pos hn] simp only [one_mul, mul_eq_mul_left_iff, true_or_iff, Int.natAbs_eq_zero, eq_self_iff_true, Int.cast_one, one_smul, Nat.cast_eq_zero, nat] private theorem rat_prop (r : ℚ) : innerProp' E (r : 𝕜) := by intro x y have : (r.den : 𝕜) ≠ 0 := by haveI : CharZero 𝕜 := RCLike.charZero_rclike exact mod_cast r.pos.ne' rw [← r.num_div_den, ← mul_right_inj' this, ← nat r.den _ y, smul_smul, Rat.cast_div] simp only [map_natCast, Rat.cast_natCast, map_intCast, Rat.cast_intCast, map_div₀] rw [← mul_assoc, mul_div_cancel₀ _ this, int_prop _ x, map_intCast] private theorem real_prop (r : ℝ) : innerProp' E (r : 𝕜) := by intro x y revert r rw [← Function.funext_iff] refine Rat.denseEmbedding_coe_real.dense.equalizer ?_ ?_ (funext fun X => ?_) · exact (continuous_ofReal.smul continuous_const).inner_ continuous_const · exact (continuous_conj.comp continuous_ofReal).mul continuous_const · simp only [Function.comp_apply, RCLike.ofReal_ratCast, rat_prop _ _] private theorem I_prop : innerProp' E (I : 𝕜) := by by_cases hI : (I : 𝕜) = 0 · rw [hI, ← Nat.cast_zero]; exact nat_prop _ intro x y have hI' : (-I : 𝕜) * I = 1 := by rw [← inv_I, inv_mul_cancel hI] rw [conj_I, inner_, inner_, mul_left_comm] congr 1 rw [smul_smul, I_mul_I_of_nonzero hI, neg_one_smul] rw [mul_sub, mul_add, mul_sub, mul_assoc I (𝓚 ‖I • x - y‖), ← mul_assoc (-I) I, hI', one_mul, mul_assoc I (𝓚 ‖I • x + y‖), ← mul_assoc (-I) I, hI', one_mul] have h₁ : ‖-x - y‖ = ‖x + y‖ := by rw [← neg_add', norm_neg] have h₂ : ‖-x + y‖ = ‖x - y‖ := by rw [← neg_sub, norm_neg, sub_eq_neg_add] rw [h₁, h₂] simp only [sub_eq_add_neg, mul_assoc] rw [← neg_mul_eq_neg_mul, ← neg_mul_eq_neg_mul] abel theorem innerProp (r : 𝕜) : innerProp' E r := by intro x y rw [← re_add_im r, add_smul, add_left, real_prop _ x, ← smul_smul, real_prop _ _ y, I_prop, map_add, map_mul, conj_ofReal, conj_ofReal, conj_I] ring end InnerProductSpaceable open InnerProductSpaceable /-- **Fréchet–von Neumann–Jordan Theorem**. A normed space `E` whose norm satisfies the parallelogram identity can be given a compatible inner product. -/ noncomputable def InnerProductSpace.ofNorm (h : ∀ x y : E, ‖x + y‖ * ‖x + y‖ + ‖x - y‖ * ‖x - y‖ = 2 * (‖x‖ * ‖x‖ + ‖y‖ * ‖y‖)) : InnerProductSpace 𝕜 E := haveI : InnerProductSpaceable E := ⟨h⟩ { inner := inner_ 𝕜 norm_sq_eq_inner := inner_.norm_sq conj_symm := inner_.conj_symm add_left := InnerProductSpaceable.add_left smul_left := fun _ _ _ => innerProp _ _ _ } variable (E) variable [InnerProductSpaceable E] /-- **Fréchet–von Neumann–Jordan Theorem**. A normed space `E` whose norm satisfies the parallelogram identity can be given a compatible inner product. Do `casesI nonempty_innerProductSpace 𝕜 E` to locally upgrade `InnerProductSpaceable E` to `InnerProductSpace 𝕜 E`. -/ theorem nonempty_innerProductSpace : Nonempty (InnerProductSpace 𝕜 E) := ⟨{ inner := inner_ 𝕜 norm_sq_eq_inner := inner_.norm_sq conj_symm := inner_.conj_symm add_left := add_left smul_left := fun _ _ _ => innerProp _ _ _ }⟩ variable {𝕜 E} variable [NormedSpace ℝ E] -- TODO: Replace `InnerProductSpace.toUniformConvexSpace` -- See note [lower instance priority] instance (priority := 100) InnerProductSpaceable.to_uniformConvexSpace : UniformConvexSpace E := by cases nonempty_innerProductSpace ℝ E; infer_instance
Analysis\InnerProductSpace\Orientation.lean
/- Copyright (c) 2022 Joseph Myers. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joseph Myers, Heather Macbeth -/ import Mathlib.Analysis.InnerProductSpace.GramSchmidtOrtho import Mathlib.LinearAlgebra.Orientation /-! # Orientations of real inner product spaces. This file provides definitions and proves lemmas about orientations of real inner product spaces. ## Main definitions * `OrthonormalBasis.adjustToOrientation` takes an orthonormal basis and an orientation, and returns an orthonormal basis with that orientation: either the original orthonormal basis, or one constructed by negating a single (arbitrary) basis vector. * `Orientation.finOrthonormalBasis` is an orthonormal basis, indexed by `Fin n`, with the given orientation. * `Orientation.volumeForm` is a nonvanishing top-dimensional alternating form on an oriented real inner product space, uniquely defined by compatibility with the orientation and inner product structure. ## Main theorems * `Orientation.volumeForm_apply_le` states that the result of applying the volume form to a set of `n` vectors, where `n` is the dimension the inner product space, is bounded by the product of the lengths of the vectors. * `Orientation.abs_volumeForm_apply_of_pairwise_orthogonal` states that the result of applying the volume form to a set of `n` orthogonal vectors, where `n` is the dimension the inner product space, is equal up to sign to the product of the lengths of the vectors. -/ noncomputable section variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] open FiniteDimensional open scoped RealInnerProductSpace namespace OrthonormalBasis variable {ι : Type*} [Fintype ι] [DecidableEq ι] (e f : OrthonormalBasis ι ℝ E) (x : Orientation ℝ E ι) /-- The change-of-basis matrix between two orthonormal bases with the same orientation has determinant 1. -/ theorem det_to_matrix_orthonormalBasis_of_same_orientation (h : e.toBasis.orientation = f.toBasis.orientation) : e.toBasis.det f = 1 := by apply (e.det_to_matrix_orthonormalBasis_real f).resolve_right have : 0 < e.toBasis.det f := by rw [e.toBasis.orientation_eq_iff_det_pos] at h simpa using h linarith /-- The change-of-basis matrix between two orthonormal bases with the opposite orientations has determinant -1. -/ theorem det_to_matrix_orthonormalBasis_of_opposite_orientation (h : e.toBasis.orientation ≠ f.toBasis.orientation) : e.toBasis.det f = -1 := by contrapose! h simp [e.toBasis.orientation_eq_iff_det_pos, (e.det_to_matrix_orthonormalBasis_real f).resolve_right h] variable {e f} /-- Two orthonormal bases with the same orientation determine the same "determinant" top-dimensional form on `E`, and conversely. -/ theorem same_orientation_iff_det_eq_det : e.toBasis.det = f.toBasis.det ↔ e.toBasis.orientation = f.toBasis.orientation := by constructor · intro h dsimp [Basis.orientation] congr · intro h rw [e.toBasis.det.eq_smul_basis_det f.toBasis] simp [e.det_to_matrix_orthonormalBasis_of_same_orientation f h] variable (e f) /-- Two orthonormal bases with opposite orientations determine opposite "determinant" top-dimensional forms on `E`. -/ theorem det_eq_neg_det_of_opposite_orientation (h : e.toBasis.orientation ≠ f.toBasis.orientation) : e.toBasis.det = -f.toBasis.det := by rw [e.toBasis.det.eq_smul_basis_det f.toBasis] -- Porting note: added `neg_one_smul` with explicit type simp [e.det_to_matrix_orthonormalBasis_of_opposite_orientation f h, neg_one_smul ℝ (M := E [⋀^ι]→ₗ[ℝ] ℝ)] variable [Nonempty ι] section AdjustToOrientation /-- `OrthonormalBasis.adjustToOrientation`, applied to an orthonormal basis, preserves the property of orthonormality. -/ theorem orthonormal_adjustToOrientation : Orthonormal ℝ (e.toBasis.adjustToOrientation x) := by apply e.orthonormal.orthonormal_of_forall_eq_or_eq_neg simpa using e.toBasis.adjustToOrientation_apply_eq_or_eq_neg x /-- Given an orthonormal basis and an orientation, return an orthonormal basis giving that orientation: either the original basis, or one constructed by negating a single (arbitrary) basis vector. -/ def adjustToOrientation : OrthonormalBasis ι ℝ E := (e.toBasis.adjustToOrientation x).toOrthonormalBasis (e.orthonormal_adjustToOrientation x) theorem toBasis_adjustToOrientation : (e.adjustToOrientation x).toBasis = e.toBasis.adjustToOrientation x := (e.toBasis.adjustToOrientation x).toBasis_toOrthonormalBasis _ /-- `adjustToOrientation` gives an orthonormal basis with the required orientation. -/ @[simp] theorem orientation_adjustToOrientation : (e.adjustToOrientation x).toBasis.orientation = x := by rw [e.toBasis_adjustToOrientation] exact e.toBasis.orientation_adjustToOrientation x /-- Every basis vector from `adjustToOrientation` is either that from the original basis or its negation. -/ theorem adjustToOrientation_apply_eq_or_eq_neg (i : ι) : e.adjustToOrientation x i = e i ∨ e.adjustToOrientation x i = -e i := by simpa [← e.toBasis_adjustToOrientation] using e.toBasis.adjustToOrientation_apply_eq_or_eq_neg x i theorem det_adjustToOrientation : (e.adjustToOrientation x).toBasis.det = e.toBasis.det ∨ (e.adjustToOrientation x).toBasis.det = -e.toBasis.det := by simpa using e.toBasis.det_adjustToOrientation x theorem abs_det_adjustToOrientation (v : ι → E) : |(e.adjustToOrientation x).toBasis.det v| = |e.toBasis.det v| := by simp [toBasis_adjustToOrientation] end AdjustToOrientation end OrthonormalBasis namespace Orientation variable {n : ℕ} open OrthonormalBasis /-- An orthonormal basis, indexed by `Fin n`, with the given orientation. -/ protected def finOrthonormalBasis (hn : 0 < n) (h : finrank ℝ E = n) (x : Orientation ℝ E (Fin n)) : OrthonormalBasis (Fin n) ℝ E := by haveI := Fin.pos_iff_nonempty.1 hn haveI : FiniteDimensional ℝ E := .of_finrank_pos <| h.symm ▸ hn exact ((@stdOrthonormalBasis _ _ _ _ _ this).reindex <| finCongr h).adjustToOrientation x /-- `Orientation.finOrthonormalBasis` gives a basis with the required orientation. -/ @[simp] theorem finOrthonormalBasis_orientation (hn : 0 < n) (h : finrank ℝ E = n) (x : Orientation ℝ E (Fin n)) : (x.finOrthonormalBasis hn h).toBasis.orientation = x := by haveI := Fin.pos_iff_nonempty.1 hn haveI : FiniteDimensional ℝ E := .of_finrank_pos <| h.symm ▸ hn exact ((@stdOrthonormalBasis _ _ _ _ _ this).reindex <| finCongr h).orientation_adjustToOrientation x section VolumeForm variable [_i : Fact (finrank ℝ E = n)] (o : Orientation ℝ E (Fin n)) /-- The volume form on an oriented real inner product space, a nonvanishing top-dimensional alternating form uniquely defined by compatibility with the orientation and inner product structure. -/ irreducible_def volumeForm : E [⋀^Fin n]→ₗ[ℝ] ℝ := by classical cases' n with n · let opos : E [⋀^Fin 0]→ₗ[ℝ] ℝ := .constOfIsEmpty ℝ E (Fin 0) (1 : ℝ) exact o.eq_or_eq_neg_of_isEmpty.by_cases (fun _ => opos) fun _ => -opos · exact (o.finOrthonormalBasis n.succ_pos _i.out).toBasis.det @[simp] theorem volumeForm_zero_pos [_i : Fact (finrank ℝ E = 0)] : Orientation.volumeForm (positiveOrientation : Orientation ℝ E (Fin 0)) = AlternatingMap.constLinearEquivOfIsEmpty 1 := by simp [volumeForm, Or.by_cases, if_pos] theorem volumeForm_zero_neg [_i : Fact (finrank ℝ E = 0)] : Orientation.volumeForm (-positiveOrientation : Orientation ℝ E (Fin 0)) = -AlternatingMap.constLinearEquivOfIsEmpty 1 := by simp_rw [volumeForm, Or.by_cases, positiveOrientation] apply if_neg simp only [neg_rayOfNeZero] rw [ray_eq_iff, SameRay.sameRay_comm] intro h simpa using congr_arg AlternatingMap.constLinearEquivOfIsEmpty.symm (eq_zero_of_sameRay_self_neg h) /-- The volume form on an oriented real inner product space can be evaluated as the determinant with respect to any orthonormal basis of the space compatible with the orientation. -/ theorem volumeForm_robust (b : OrthonormalBasis (Fin n) ℝ E) (hb : b.toBasis.orientation = o) : o.volumeForm = b.toBasis.det := by cases n · classical have : o = positiveOrientation := hb.symm.trans b.toBasis.orientation_isEmpty simp_rw [volumeForm, Or.by_cases, dif_pos this, Nat.rec_zero, Basis.det_isEmpty] · simp_rw [volumeForm] rw [same_orientation_iff_det_eq_det, hb] exact o.finOrthonormalBasis_orientation _ _ /-- The volume form on an oriented real inner product space can be evaluated as the determinant with respect to any orthonormal basis of the space compatible with the orientation. -/ theorem volumeForm_robust_neg (b : OrthonormalBasis (Fin n) ℝ E) (hb : b.toBasis.orientation ≠ o) : o.volumeForm = -b.toBasis.det := by cases' n with n · classical have : positiveOrientation ≠ o := by rwa [b.toBasis.orientation_isEmpty] at hb simp_rw [volumeForm, Or.by_cases, dif_neg this.symm, Nat.rec_zero, Basis.det_isEmpty] let e : OrthonormalBasis (Fin n.succ) ℝ E := o.finOrthonormalBasis n.succ_pos Fact.out simp_rw [volumeForm] apply e.det_eq_neg_det_of_opposite_orientation b convert hb.symm exact o.finOrthonormalBasis_orientation _ _ @[simp] theorem volumeForm_neg_orientation : (-o).volumeForm = -o.volumeForm := by cases' n with n · refine o.eq_or_eq_neg_of_isEmpty.elim ?_ ?_ <;> rintro rfl · simp [volumeForm_zero_neg] · rw [neg_neg (positiveOrientation (R := ℝ))] -- Porting note: added simp [volumeForm_zero_neg] let e : OrthonormalBasis (Fin n.succ) ℝ E := o.finOrthonormalBasis n.succ_pos Fact.out have h₁ : e.toBasis.orientation = o := o.finOrthonormalBasis_orientation _ _ have h₂ : e.toBasis.orientation ≠ -o := by symm rw [e.toBasis.orientation_ne_iff_eq_neg, h₁] rw [o.volumeForm_robust e h₁, (-o).volumeForm_robust_neg e h₂] theorem volumeForm_robust' (b : OrthonormalBasis (Fin n) ℝ E) (v : Fin n → E) : |o.volumeForm v| = |b.toBasis.det v| := by cases n · refine o.eq_or_eq_neg_of_isEmpty.elim ?_ ?_ <;> rintro rfl <;> simp · rw [o.volumeForm_robust (b.adjustToOrientation o) (b.orientation_adjustToOrientation o), b.abs_det_adjustToOrientation] /-- Let `v` be an indexed family of `n` vectors in an oriented `n`-dimensional real inner product space `E`. The output of the volume form of `E` when evaluated on `v` is bounded in absolute value by the product of the norms of the vectors `v i`. -/ theorem abs_volumeForm_apply_le (v : Fin n → E) : |o.volumeForm v| ≤ ∏ i : Fin n, ‖v i‖ := by cases' n with n · refine o.eq_or_eq_neg_of_isEmpty.elim ?_ ?_ <;> rintro rfl <;> simp haveI : FiniteDimensional ℝ E := .of_fact_finrank_eq_succ n have : finrank ℝ E = Fintype.card (Fin n.succ) := by simpa using _i.out let b : OrthonormalBasis (Fin n.succ) ℝ E := gramSchmidtOrthonormalBasis this v have hb : b.toBasis.det v = ∏ i, ⟪b i, v i⟫ := gramSchmidtOrthonormalBasis_det this v rw [o.volumeForm_robust' b, hb, Finset.abs_prod] apply Finset.prod_le_prod · intro i _ positivity intro i _ convert abs_real_inner_le_norm (b i) (v i) simp [b.orthonormal.1 i] theorem volumeForm_apply_le (v : Fin n → E) : o.volumeForm v ≤ ∏ i : Fin n, ‖v i‖ := (le_abs_self _).trans (o.abs_volumeForm_apply_le v) /-- Let `v` be an indexed family of `n` orthogonal vectors in an oriented `n`-dimensional real inner product space `E`. The output of the volume form of `E` when evaluated on `v` is, up to sign, the product of the norms of the vectors `v i`. -/ theorem abs_volumeForm_apply_of_pairwise_orthogonal {v : Fin n → E} (hv : Pairwise fun i j => ⟪v i, v j⟫ = 0) : |o.volumeForm v| = ∏ i : Fin n, ‖v i‖ := by cases' n with n · refine o.eq_or_eq_neg_of_isEmpty.elim ?_ ?_ <;> rintro rfl <;> simp haveI : FiniteDimensional ℝ E := .of_fact_finrank_eq_succ n have hdim : finrank ℝ E = Fintype.card (Fin n.succ) := by simpa using _i.out let b : OrthonormalBasis (Fin n.succ) ℝ E := gramSchmidtOrthonormalBasis hdim v have hb : b.toBasis.det v = ∏ i, ⟪b i, v i⟫ := gramSchmidtOrthonormalBasis_det hdim v rw [o.volumeForm_robust' b, hb, Finset.abs_prod] by_cases h : ∃ i, v i = 0 · obtain ⟨i, hi⟩ := h rw [Finset.prod_eq_zero (Finset.mem_univ i), Finset.prod_eq_zero (Finset.mem_univ i)] <;> simp [hi] push_neg at h congr ext i have hb : b i = ‖v i‖⁻¹ • v i := gramSchmidtOrthonormalBasis_apply_of_orthogonal hdim hv (h i) simp only [hb, inner_smul_left, real_inner_self_eq_norm_mul_norm, RCLike.conj_to_real] rw [abs_of_nonneg] · field_simp · positivity /-- The output of the volume form of an oriented real inner product space `E` when evaluated on an orthonormal basis is ±1. -/ theorem abs_volumeForm_apply_of_orthonormal (v : OrthonormalBasis (Fin n) ℝ E) : |o.volumeForm v| = 1 := by simpa [o.volumeForm_robust' v v] using congr_arg abs v.toBasis.det_self theorem volumeForm_map {F : Type*} [NormedAddCommGroup F] [InnerProductSpace ℝ F] [Fact (finrank ℝ F = n)] (φ : E ≃ₗᵢ[ℝ] F) (x : Fin n → F) : (Orientation.map (Fin n) φ.toLinearEquiv o).volumeForm x = o.volumeForm (φ.symm ∘ x) := by cases' n with n · refine o.eq_or_eq_neg_of_isEmpty.elim ?_ ?_ <;> rintro rfl <;> simp let e : OrthonormalBasis (Fin n.succ) ℝ E := o.finOrthonormalBasis n.succ_pos Fact.out have he : e.toBasis.orientation = o := o.finOrthonormalBasis_orientation n.succ_pos Fact.out have heφ : (e.map φ).toBasis.orientation = Orientation.map (Fin n.succ) φ.toLinearEquiv o := by rw [← he] exact e.toBasis.orientation_map φ.toLinearEquiv rw [(Orientation.map (Fin n.succ) φ.toLinearEquiv o).volumeForm_robust (e.map φ) heφ] rw [o.volumeForm_robust e he] simp /-- The volume form is invariant under pullback by a positively-oriented isometric automorphism. -/ theorem volumeForm_comp_linearIsometryEquiv (φ : E ≃ₗᵢ[ℝ] E) (hφ : 0 < LinearMap.det (φ.toLinearEquiv : E →ₗ[ℝ] E)) (x : Fin n → E) : o.volumeForm (φ ∘ x) = o.volumeForm x := by cases' n with n -- Porting note: need to explicitly prove `FiniteDimensional ℝ E` · refine o.eq_or_eq_neg_of_isEmpty.elim ?_ ?_ <;> rintro rfl <;> simp haveI : FiniteDimensional ℝ E := .of_fact_finrank_eq_succ n convert o.volumeForm_map φ (φ ∘ x) · symm rwa [← o.map_eq_iff_det_pos φ.toLinearEquiv] at hφ rw [_i.out, Fintype.card_fin] · ext simp end VolumeForm end Orientation
Analysis\InnerProductSpace\Orthogonal.lean
/- Copyright (c) 2019 Zhouhang Zhou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Zhouhang Zhou, Sébastien Gouëzel, Frédéric Dupuis -/ import Mathlib.Analysis.InnerProductSpace.Basic import Mathlib.LinearAlgebra.SesquilinearForm /-! # Orthogonal complements of submodules In this file, the `orthogonal` complement of a submodule `K` is defined, and basic API established. Some of the more subtle results about the orthogonal complement are delayed to `Analysis.InnerProductSpace.Projection`. See also `BilinForm.orthogonal` for orthogonality with respect to a general bilinear form. ## Notation The orthogonal complement of a submodule `K` is denoted by `Kᗮ`. The proposition that two submodules are orthogonal, `Submodule.IsOrtho`, is denoted by `U ⟂ V`. Note this is not the same unicode symbol as `⊥` (`Bot`). -/ variable {𝕜 E F : Type*} [RCLike 𝕜] variable [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] variable [NormedAddCommGroup F] [InnerProductSpace 𝕜 F] local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y namespace Submodule variable (K : Submodule 𝕜 E) /-- The subspace of vectors orthogonal to a given subspace. -/ def orthogonal : Submodule 𝕜 E where carrier := { v | ∀ u ∈ K, ⟪u, v⟫ = 0 } zero_mem' _ _ := inner_zero_right _ add_mem' hx hy u hu := by rw [inner_add_right, hx u hu, hy u hu, add_zero] smul_mem' c x hx u hu := by rw [inner_smul_right, hx u hu, mul_zero] @[inherit_doc] notation:1200 K "ᗮ" => orthogonal K /-- When a vector is in `Kᗮ`. -/ theorem mem_orthogonal (v : E) : v ∈ Kᗮ ↔ ∀ u ∈ K, ⟪u, v⟫ = 0 := Iff.rfl /-- When a vector is in `Kᗮ`, with the inner product the other way round. -/ theorem mem_orthogonal' (v : E) : v ∈ Kᗮ ↔ ∀ u ∈ K, ⟪v, u⟫ = 0 := by simp_rw [mem_orthogonal, inner_eq_zero_symm] variable {K} /-- A vector in `K` is orthogonal to one in `Kᗮ`. -/ theorem inner_right_of_mem_orthogonal {u v : E} (hu : u ∈ K) (hv : v ∈ Kᗮ) : ⟪u, v⟫ = 0 := (K.mem_orthogonal v).1 hv u hu /-- A vector in `Kᗮ` is orthogonal to one in `K`. -/ theorem inner_left_of_mem_orthogonal {u v : E} (hu : u ∈ K) (hv : v ∈ Kᗮ) : ⟪v, u⟫ = 0 := by rw [inner_eq_zero_symm]; exact inner_right_of_mem_orthogonal hu hv /-- A vector is in `(𝕜 ∙ u)ᗮ` iff it is orthogonal to `u`. -/ theorem mem_orthogonal_singleton_iff_inner_right {u v : E} : v ∈ (𝕜 ∙ u)ᗮ ↔ ⟪u, v⟫ = 0 := by refine ⟨inner_right_of_mem_orthogonal (mem_span_singleton_self u), ?_⟩ intro hv w hw rw [mem_span_singleton] at hw obtain ⟨c, rfl⟩ := hw simp [inner_smul_left, hv] /-- A vector in `(𝕜 ∙ u)ᗮ` is orthogonal to `u`. -/ theorem mem_orthogonal_singleton_iff_inner_left {u v : E} : v ∈ (𝕜 ∙ u)ᗮ ↔ ⟪v, u⟫ = 0 := by rw [mem_orthogonal_singleton_iff_inner_right, inner_eq_zero_symm] theorem sub_mem_orthogonal_of_inner_left {x y : E} (h : ∀ v : K, ⟪x, v⟫ = ⟪y, v⟫) : x - y ∈ Kᗮ := by rw [mem_orthogonal'] intro u hu rw [inner_sub_left, sub_eq_zero] exact h ⟨u, hu⟩ theorem sub_mem_orthogonal_of_inner_right {x y : E} (h : ∀ v : K, ⟪(v : E), x⟫ = ⟪(v : E), y⟫) : x - y ∈ Kᗮ := by intro u hu rw [inner_sub_right, sub_eq_zero] exact h ⟨u, hu⟩ variable (K) /-- `K` and `Kᗮ` have trivial intersection. -/ theorem inf_orthogonal_eq_bot : K ⊓ Kᗮ = ⊥ := by rw [eq_bot_iff] intro x rw [mem_inf] exact fun ⟨hx, ho⟩ => inner_self_eq_zero.1 (ho x hx) /-- `K` and `Kᗮ` have trivial intersection. -/ theorem orthogonal_disjoint : Disjoint K Kᗮ := by simp [disjoint_iff, K.inf_orthogonal_eq_bot] /-- `Kᗮ` can be characterized as the intersection of the kernels of the operations of inner product with each of the elements of `K`. -/ theorem orthogonal_eq_inter : Kᗮ = ⨅ v : K, LinearMap.ker (innerSL 𝕜 (v : E)) := by apply le_antisymm · rw [le_iInf_iff] rintro ⟨v, hv⟩ w hw simpa using hw _ hv · intro v hv w hw simp only [mem_iInf] at hv exact hv ⟨w, hw⟩ /-- The orthogonal complement of any submodule `K` is closed. -/ theorem isClosed_orthogonal : IsClosed (Kᗮ : Set E) := by rw [orthogonal_eq_inter K] have := fun v : K => ContinuousLinearMap.isClosed_ker (innerSL 𝕜 (v : E)) convert isClosed_iInter this simp only [iInf_coe] /-- In a complete space, the orthogonal complement of any submodule `K` is complete. -/ instance instOrthogonalCompleteSpace [CompleteSpace E] : CompleteSpace Kᗮ := K.isClosed_orthogonal.completeSpace_coe variable (𝕜 E) /-- `orthogonal` gives a `GaloisConnection` between `Submodule 𝕜 E` and its `OrderDual`. -/ theorem orthogonal_gc : @GaloisConnection (Submodule 𝕜 E) (Submodule 𝕜 E)ᵒᵈ _ _ orthogonal orthogonal := fun _K₁ _K₂ => ⟨fun h _v hv _u hu => inner_left_of_mem_orthogonal hv (h hu), fun h _v hv _u hu => inner_left_of_mem_orthogonal hv (h hu)⟩ variable {𝕜 E} /-- `orthogonal` reverses the `≤` ordering of two subspaces. -/ theorem orthogonal_le {K₁ K₂ : Submodule 𝕜 E} (h : K₁ ≤ K₂) : K₂ᗮ ≤ K₁ᗮ := (orthogonal_gc 𝕜 E).monotone_l h /-- `orthogonal.orthogonal` preserves the `≤` ordering of two subspaces. -/ theorem orthogonal_orthogonal_monotone {K₁ K₂ : Submodule 𝕜 E} (h : K₁ ≤ K₂) : K₁ᗮᗮ ≤ K₂ᗮᗮ := orthogonal_le (orthogonal_le h) /-- `K` is contained in `Kᗮᗮ`. -/ theorem le_orthogonal_orthogonal : K ≤ Kᗮᗮ := (orthogonal_gc 𝕜 E).le_u_l _ /-- The inf of two orthogonal subspaces equals the subspace orthogonal to the sup. -/ theorem inf_orthogonal (K₁ K₂ : Submodule 𝕜 E) : K₁ᗮ ⊓ K₂ᗮ = (K₁ ⊔ K₂)ᗮ := (orthogonal_gc 𝕜 E).l_sup.symm /-- The inf of an indexed family of orthogonal subspaces equals the subspace orthogonal to the sup. -/ theorem iInf_orthogonal {ι : Type*} (K : ι → Submodule 𝕜 E) : ⨅ i, (K i)ᗮ = (iSup K)ᗮ := (orthogonal_gc 𝕜 E).l_iSup.symm /-- The inf of a set of orthogonal subspaces equals the subspace orthogonal to the sup. -/ theorem sInf_orthogonal (s : Set <| Submodule 𝕜 E) : ⨅ K ∈ s, Kᗮ = (sSup s)ᗮ := (orthogonal_gc 𝕜 E).l_sSup.symm @[simp] theorem top_orthogonal_eq_bot : (⊤ : Submodule 𝕜 E)ᗮ = ⊥ := by ext x rw [mem_bot, mem_orthogonal] exact ⟨fun h => inner_self_eq_zero.mp (h x mem_top), by rintro rfl simp⟩ @[simp] theorem bot_orthogonal_eq_top : (⊥ : Submodule 𝕜 E)ᗮ = ⊤ := by rw [← top_orthogonal_eq_bot, eq_top_iff] exact le_orthogonal_orthogonal ⊤ @[simp] theorem orthogonal_eq_top_iff : Kᗮ = ⊤ ↔ K = ⊥ := by refine ⟨?_, by rintro rfl exact bot_orthogonal_eq_top⟩ intro h have : K ⊓ Kᗮ = ⊥ := K.orthogonal_disjoint.eq_bot rwa [h, inf_comm, top_inf_eq] at this theorem orthogonalFamily_self : OrthogonalFamily 𝕜 (fun b => ↥(cond b K Kᗮ)) fun b => (cond b K Kᗮ).subtypeₗᵢ | true, true => absurd rfl | true, false => fun _ x y => inner_right_of_mem_orthogonal x.prop y.prop | false, true => fun _ x y => inner_left_of_mem_orthogonal y.prop x.prop | false, false => absurd rfl end Submodule @[simp] theorem bilinFormOfRealInner_orthogonal {E} [NormedAddCommGroup E] [InnerProductSpace ℝ E] (K : Submodule ℝ E) : K.orthogonalBilin bilinFormOfRealInner = Kᗮ := rfl /-! ### Orthogonality of submodules In this section we define `Submodule.IsOrtho U V`, with notation `U ⟂ V`. The API roughly matches that of `Disjoint`. -/ namespace Submodule /-- The proposition that two submodules are orthogonal. Has notation `U ⟂ V`. -/ def IsOrtho (U V : Submodule 𝕜 E) : Prop := U ≤ Vᗮ @[inherit_doc] infixl:50 " ⟂ " => Submodule.IsOrtho theorem isOrtho_iff_le {U V : Submodule 𝕜 E} : U ⟂ V ↔ U ≤ Vᗮ := Iff.rfl @[symm] theorem IsOrtho.symm {U V : Submodule 𝕜 E} (h : U ⟂ V) : V ⟂ U := (le_orthogonal_orthogonal _).trans (orthogonal_le h) theorem isOrtho_comm {U V : Submodule 𝕜 E} : U ⟂ V ↔ V ⟂ U := ⟨IsOrtho.symm, IsOrtho.symm⟩ theorem symmetric_isOrtho : Symmetric (IsOrtho : Submodule 𝕜 E → Submodule 𝕜 E → Prop) := fun _ _ => IsOrtho.symm theorem IsOrtho.inner_eq {U V : Submodule 𝕜 E} (h : U ⟂ V) {u v : E} (hu : u ∈ U) (hv : v ∈ V) : ⟪u, v⟫ = 0 := h.symm hv _ hu theorem isOrtho_iff_inner_eq {U V : Submodule 𝕜 E} : U ⟂ V ↔ ∀ u ∈ U, ∀ v ∈ V, ⟪u, v⟫ = 0 := forall₄_congr fun _u _hu _v _hv => inner_eq_zero_symm /- TODO: generalize `Submodule.map₂` to semilinear maps, so that we can state `U ⟂ V ↔ Submodule.map₂ (innerₛₗ 𝕜) U V ≤ ⊥`. -/ @[simp] theorem isOrtho_bot_left {V : Submodule 𝕜 E} : ⊥ ⟂ V := bot_le @[simp] theorem isOrtho_bot_right {U : Submodule 𝕜 E} : U ⟂ ⊥ := isOrtho_bot_left.symm theorem IsOrtho.mono_left {U₁ U₂ V : Submodule 𝕜 E} (hU : U₂ ≤ U₁) (h : U₁ ⟂ V) : U₂ ⟂ V := hU.trans h theorem IsOrtho.mono_right {U V₁ V₂ : Submodule 𝕜 E} (hV : V₂ ≤ V₁) (h : U ⟂ V₁) : U ⟂ V₂ := (h.symm.mono_left hV).symm theorem IsOrtho.mono {U₁ V₁ U₂ V₂ : Submodule 𝕜 E} (hU : U₂ ≤ U₁) (hV : V₂ ≤ V₁) (h : U₁ ⟂ V₁) : U₂ ⟂ V₂ := (h.mono_right hV).mono_left hU @[simp] theorem isOrtho_self {U : Submodule 𝕜 E} : U ⟂ U ↔ U = ⊥ := ⟨fun h => eq_bot_iff.mpr fun x hx => inner_self_eq_zero.mp (h hx x hx), fun h => h.symm ▸ isOrtho_bot_left⟩ @[simp] theorem isOrtho_orthogonal_right (U : Submodule 𝕜 E) : U ⟂ Uᗮ := le_orthogonal_orthogonal _ @[simp] theorem isOrtho_orthogonal_left (U : Submodule 𝕜 E) : Uᗮ ⟂ U := (isOrtho_orthogonal_right U).symm theorem IsOrtho.le {U V : Submodule 𝕜 E} (h : U ⟂ V) : U ≤ Vᗮ := h theorem IsOrtho.ge {U V : Submodule 𝕜 E} (h : U ⟂ V) : V ≤ Uᗮ := h.symm @[simp] theorem isOrtho_top_right {U : Submodule 𝕜 E} : U ⟂ ⊤ ↔ U = ⊥ := ⟨fun h => eq_bot_iff.mpr fun _x hx => inner_self_eq_zero.mp (h hx _ mem_top), fun h => h.symm ▸ isOrtho_bot_left⟩ @[simp] theorem isOrtho_top_left {V : Submodule 𝕜 E} : ⊤ ⟂ V ↔ V = ⊥ := isOrtho_comm.trans isOrtho_top_right /-- Orthogonal submodules are disjoint. -/ theorem IsOrtho.disjoint {U V : Submodule 𝕜 E} (h : U ⟂ V) : Disjoint U V := (Submodule.orthogonal_disjoint _).mono_right h.symm @[simp] theorem isOrtho_sup_left {U₁ U₂ V : Submodule 𝕜 E} : U₁ ⊔ U₂ ⟂ V ↔ U₁ ⟂ V ∧ U₂ ⟂ V := sup_le_iff @[simp] theorem isOrtho_sup_right {U V₁ V₂ : Submodule 𝕜 E} : U ⟂ V₁ ⊔ V₂ ↔ U ⟂ V₁ ∧ U ⟂ V₂ := isOrtho_comm.trans <| isOrtho_sup_left.trans <| isOrtho_comm.and isOrtho_comm @[simp] theorem isOrtho_sSup_left {U : Set (Submodule 𝕜 E)} {V : Submodule 𝕜 E} : sSup U ⟂ V ↔ ∀ Uᵢ ∈ U, Uᵢ ⟂ V := sSup_le_iff @[simp] theorem isOrtho_sSup_right {U : Submodule 𝕜 E} {V : Set (Submodule 𝕜 E)} : U ⟂ sSup V ↔ ∀ Vᵢ ∈ V, U ⟂ Vᵢ := isOrtho_comm.trans <| isOrtho_sSup_left.trans <| by simp_rw [isOrtho_comm] @[simp] theorem isOrtho_iSup_left {ι : Sort*} {U : ι → Submodule 𝕜 E} {V : Submodule 𝕜 E} : iSup U ⟂ V ↔ ∀ i, U i ⟂ V := iSup_le_iff @[simp] theorem isOrtho_iSup_right {ι : Sort*} {U : Submodule 𝕜 E} {V : ι → Submodule 𝕜 E} : U ⟂ iSup V ↔ ∀ i, U ⟂ V i := isOrtho_comm.trans <| isOrtho_iSup_left.trans <| by simp_rw [isOrtho_comm] @[simp] theorem isOrtho_span {s t : Set E} : span 𝕜 s ⟂ span 𝕜 t ↔ ∀ ⦃u⦄, u ∈ s → ∀ ⦃v⦄, v ∈ t → ⟪u, v⟫ = 0 := by simp_rw [span_eq_iSup_of_singleton_spans s, span_eq_iSup_of_singleton_spans t, isOrtho_iSup_left, isOrtho_iSup_right, isOrtho_iff_le, span_le, Set.subset_def, SetLike.mem_coe, mem_orthogonal_singleton_iff_inner_left, Set.mem_singleton_iff, forall_eq] theorem IsOrtho.map (f : E →ₗᵢ[𝕜] F) {U V : Submodule 𝕜 E} (h : U ⟂ V) : U.map f ⟂ V.map f := by rw [isOrtho_iff_inner_eq] at * simp_rw [mem_map, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂, LinearIsometry.inner_map_map] exact h theorem IsOrtho.comap (f : E →ₗᵢ[𝕜] F) {U V : Submodule 𝕜 F} (h : U ⟂ V) : U.comap f ⟂ V.comap f := by rw [isOrtho_iff_inner_eq] at * simp_rw [mem_comap, ← f.inner_map_map] intro u hu v hv exact h _ hu _ hv @[simp] theorem IsOrtho.map_iff (f : E ≃ₗᵢ[𝕜] F) {U V : Submodule 𝕜 E} : U.map f ⟂ V.map f ↔ U ⟂ V := ⟨fun h => by have hf : ∀ p : Submodule 𝕜 E, (p.map f).comap f.toLinearIsometry = p := comap_map_eq_of_injective f.injective simpa only [hf] using h.comap f.toLinearIsometry, IsOrtho.map f.toLinearIsometry⟩ @[simp] theorem IsOrtho.comap_iff (f : E ≃ₗᵢ[𝕜] F) {U V : Submodule 𝕜 F} : U.comap f ⟂ V.comap f ↔ U ⟂ V := ⟨fun h => by have hf : ∀ p : Submodule 𝕜 F, (p.comap f).map f.toLinearIsometry = p := map_comap_eq_of_surjective f.surjective simpa only [hf] using h.map f.toLinearIsometry, IsOrtho.comap f.toLinearIsometry⟩ end Submodule theorem orthogonalFamily_iff_pairwise {ι} {V : ι → Submodule 𝕜 E} : (OrthogonalFamily 𝕜 (fun i => V i) fun i => (V i).subtypeₗᵢ) ↔ Pairwise ((· ⟂ ·) on V) := forall₃_congr fun _i _j _hij => Subtype.forall.trans <| forall₂_congr fun _x _hx => Subtype.forall.trans <| forall₂_congr fun _y _hy => inner_eq_zero_symm alias ⟨OrthogonalFamily.pairwise, OrthogonalFamily.of_pairwise⟩ := orthogonalFamily_iff_pairwise /-- Two submodules in an orthogonal family with different indices are orthogonal. -/ theorem OrthogonalFamily.isOrtho {ι} {V : ι → Submodule 𝕜 E} (hV : OrthogonalFamily 𝕜 (fun i => V i) fun i => (V i).subtypeₗᵢ) {i j : ι} (hij : i ≠ j) : V i ⟂ V j := hV.pairwise hij
Analysis\InnerProductSpace\PiL2.lean
/- Copyright (c) 2020 Joseph Myers. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joseph Myers, Sébastien Gouëzel, Heather Macbeth -/ import Mathlib.Analysis.InnerProductSpace.Projection import Mathlib.Analysis.Normed.Lp.PiLp import Mathlib.LinearAlgebra.FiniteDimensional import Mathlib.LinearAlgebra.UnitaryGroup /-! # `L²` inner product space structure on finite products of inner product spaces The `L²` norm on a finite product of inner product spaces is compatible with an inner product $$ \langle x, y\rangle = \sum \langle x_i, y_i \rangle. $$ This is recorded in this file as an inner product space instance on `PiLp 2`. This file develops the notion of a finite dimensional Hilbert space over `𝕜 = ℂ, ℝ`, referred to as `E`. We define an `OrthonormalBasis 𝕜 ι E` as a linear isometric equivalence between `E` and `EuclideanSpace 𝕜 ι`. Then `stdOrthonormalBasis` shows that such an equivalence always exists if `E` is finite dimensional. We provide language for converting between a basis that is orthonormal and an orthonormal basis (e.g. `Basis.toOrthonormalBasis`). We show that orthonormal bases for each summand in a direct sum of spaces can be combined into an orthonormal basis for the whole sum in `DirectSum.IsInternal.subordinateOrthonormalBasis`. In the last section, various properties of matrices are explored. ## Main definitions - `EuclideanSpace 𝕜 n`: defined to be `PiLp 2 (n → 𝕜)` for any `Fintype n`, i.e., the space from functions to `n` to `𝕜` with the `L²` norm. We register several instances on it (notably that it is a finite-dimensional inner product space). - `OrthonormalBasis 𝕜 ι`: defined to be an isometry to Euclidean space from a given finite-dimensional inner product space, `E ≃ₗᵢ[𝕜] EuclideanSpace 𝕜 ι`. - `Basis.toOrthonormalBasis`: constructs an `OrthonormalBasis` for a finite-dimensional Euclidean space from a `Basis` which is `Orthonormal`. - `Orthonormal.exists_orthonormalBasis_extension`: provides an existential result of an `OrthonormalBasis` extending a given orthonormal set - `exists_orthonormalBasis`: provides an orthonormal basis on a finite dimensional vector space - `stdOrthonormalBasis`: provides an arbitrarily-chosen `OrthonormalBasis` of a given finite dimensional inner product space For consequences in infinite dimension (Hilbert bases, etc.), see the file `Analysis.InnerProductSpace.L2Space`. -/ open Real Set Filter RCLike Submodule Function Uniformity Topology NNReal ENNReal ComplexConjugate DirectSum noncomputable section variable {ι ι' 𝕜 : Type*} [RCLike 𝕜] variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] variable {E' : Type*} [NormedAddCommGroup E'] [InnerProductSpace 𝕜 E'] variable {F : Type*} [NormedAddCommGroup F] [InnerProductSpace ℝ F] variable {F' : Type*} [NormedAddCommGroup F'] [InnerProductSpace ℝ F'] local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y /- If `ι` is a finite type and each space `f i`, `i : ι`, is an inner product space, then `Π i, f i` is an inner product space as well. Since `Π i, f i` is endowed with the sup norm, we use instead `PiLp 2 f` for the product space, which is endowed with the `L^2` norm. -/ instance PiLp.innerProductSpace {ι : Type*} [Fintype ι] (f : ι → Type*) [∀ i, NormedAddCommGroup (f i)] [∀ i, InnerProductSpace 𝕜 (f i)] : InnerProductSpace 𝕜 (PiLp 2 f) where inner x y := ∑ i, inner (x i) (y i) norm_sq_eq_inner x := by simp only [PiLp.norm_sq_eq_of_L2, map_sum, ← norm_sq_eq_inner, one_div] conj_symm := by intro x y unfold inner rw [map_sum] apply Finset.sum_congr rfl rintro z - apply inner_conj_symm add_left x y z := show (∑ i, inner (x i + y i) (z i)) = (∑ i, inner (x i) (z i)) + ∑ i, inner (y i) (z i) by simp only [inner_add_left, Finset.sum_add_distrib] smul_left x y r := show (∑ i : ι, inner (r • x i) (y i)) = conj r * ∑ i, inner (x i) (y i) by simp only [Finset.mul_sum, inner_smul_left] @[simp] theorem PiLp.inner_apply {ι : Type*} [Fintype ι] {f : ι → Type*} [∀ i, NormedAddCommGroup (f i)] [∀ i, InnerProductSpace 𝕜 (f i)] (x y : PiLp 2 f) : ⟪x, y⟫ = ∑ i, ⟪x i, y i⟫ := rfl /-- The standard real/complex Euclidean space, functions on a finite type. For an `n`-dimensional space use `EuclideanSpace 𝕜 (Fin n)`. -/ abbrev EuclideanSpace (𝕜 : Type*) (n : Type*) : Type _ := PiLp 2 fun _ : n => 𝕜 theorem EuclideanSpace.nnnorm_eq {𝕜 : Type*} [RCLike 𝕜] {n : Type*} [Fintype n] (x : EuclideanSpace 𝕜 n) : ‖x‖₊ = NNReal.sqrt (∑ i, ‖x i‖₊ ^ 2) := PiLp.nnnorm_eq_of_L2 x theorem EuclideanSpace.norm_eq {𝕜 : Type*} [RCLike 𝕜] {n : Type*} [Fintype n] (x : EuclideanSpace 𝕜 n) : ‖x‖ = √(∑ i, ‖x i‖ ^ 2) := by simpa only [Real.coe_sqrt, NNReal.coe_sum] using congr_arg ((↑) : ℝ≥0 → ℝ) x.nnnorm_eq theorem EuclideanSpace.dist_eq {𝕜 : Type*} [RCLike 𝕜] {n : Type*} [Fintype n] (x y : EuclideanSpace 𝕜 n) : dist x y = √(∑ i, dist (x i) (y i) ^ 2) := PiLp.dist_eq_of_L2 x y theorem EuclideanSpace.nndist_eq {𝕜 : Type*} [RCLike 𝕜] {n : Type*} [Fintype n] (x y : EuclideanSpace 𝕜 n) : nndist x y = NNReal.sqrt (∑ i, nndist (x i) (y i) ^ 2) := PiLp.nndist_eq_of_L2 x y theorem EuclideanSpace.edist_eq {𝕜 : Type*} [RCLike 𝕜] {n : Type*} [Fintype n] (x y : EuclideanSpace 𝕜 n) : edist x y = (∑ i, edist (x i) (y i) ^ 2) ^ (1 / 2 : ℝ) := PiLp.edist_eq_of_L2 x y theorem EuclideanSpace.ball_zero_eq {n : Type*} [Fintype n] (r : ℝ) (hr : 0 ≤ r) : Metric.ball (0 : EuclideanSpace ℝ n) r = {x | ∑ i, x i ^ 2 < r ^ 2} := by ext x have : (0 : ℝ) ≤ ∑ i, x i ^ 2 := Finset.sum_nonneg fun _ _ => sq_nonneg _ simp_rw [mem_setOf, mem_ball_zero_iff, norm_eq, norm_eq_abs, sq_abs, sqrt_lt this hr] theorem EuclideanSpace.closedBall_zero_eq {n : Type*} [Fintype n] (r : ℝ) (hr : 0 ≤ r) : Metric.closedBall (0 : EuclideanSpace ℝ n) r = {x | ∑ i, x i ^ 2 ≤ r ^ 2} := by ext simp_rw [mem_setOf, mem_closedBall_zero_iff, norm_eq, norm_eq_abs, sq_abs, sqrt_le_left hr] theorem EuclideanSpace.sphere_zero_eq {n : Type*} [Fintype n] (r : ℝ) (hr : 0 ≤ r) : Metric.sphere (0 : EuclideanSpace ℝ n) r = {x | ∑ i, x i ^ 2 = r ^ 2} := by ext x have : (0 : ℝ) ≤ ∑ i, x i ^ 2 := Finset.sum_nonneg fun _ _ => sq_nonneg _ simp_rw [mem_setOf, mem_sphere_zero_iff_norm, norm_eq, norm_eq_abs, sq_abs, Real.sqrt_eq_iff_sq_eq this hr, eq_comm] section variable [Fintype ι] @[simp] theorem finrank_euclideanSpace : FiniteDimensional.finrank 𝕜 (EuclideanSpace 𝕜 ι) = Fintype.card ι := by simp [EuclideanSpace, PiLp, WithLp] theorem finrank_euclideanSpace_fin {n : ℕ} : FiniteDimensional.finrank 𝕜 (EuclideanSpace 𝕜 (Fin n)) = n := by simp theorem EuclideanSpace.inner_eq_star_dotProduct (x y : EuclideanSpace 𝕜 ι) : ⟪x, y⟫ = Matrix.dotProduct (star <| WithLp.equiv _ _ x) (WithLp.equiv _ _ y) := rfl theorem EuclideanSpace.inner_piLp_equiv_symm (x y : ι → 𝕜) : ⟪(WithLp.equiv 2 _).symm x, (WithLp.equiv 2 _).symm y⟫ = Matrix.dotProduct (star x) y := rfl /-- A finite, mutually orthogonal family of subspaces of `E`, which span `E`, induce an isometry from `E` to `PiLp 2` of the subspaces equipped with the `L2` inner product. -/ def DirectSum.IsInternal.isometryL2OfOrthogonalFamily [DecidableEq ι] {V : ι → Submodule 𝕜 E} (hV : DirectSum.IsInternal V) (hV' : OrthogonalFamily 𝕜 (fun i => V i) fun i => (V i).subtypeₗᵢ) : E ≃ₗᵢ[𝕜] PiLp 2 fun i => V i := by let e₁ := DirectSum.linearEquivFunOnFintype 𝕜 ι fun i => V i let e₂ := LinearEquiv.ofBijective (DirectSum.coeLinearMap V) hV refine LinearEquiv.isometryOfInner (e₂.symm.trans e₁) ?_ suffices ∀ (v w : PiLp 2 fun i => V i), ⟪v, w⟫ = ⟪e₂ (e₁.symm v), e₂ (e₁.symm w)⟫ by intro v₀ w₀ convert this (e₁ (e₂.symm v₀)) (e₁ (e₂.symm w₀)) <;> simp only [LinearEquiv.symm_apply_apply, LinearEquiv.apply_symm_apply] intro v w trans ⟪∑ i, (V i).subtypeₗᵢ (v i), ∑ i, (V i).subtypeₗᵢ (w i)⟫ · simp only [sum_inner, hV'.inner_right_fintype, PiLp.inner_apply] · congr <;> simp @[simp] theorem DirectSum.IsInternal.isometryL2OfOrthogonalFamily_symm_apply [DecidableEq ι] {V : ι → Submodule 𝕜 E} (hV : DirectSum.IsInternal V) (hV' : OrthogonalFamily 𝕜 (fun i => V i) fun i => (V i).subtypeₗᵢ) (w : PiLp 2 fun i => V i) : (hV.isometryL2OfOrthogonalFamily hV').symm w = ∑ i, (w i : E) := by classical let e₁ := DirectSum.linearEquivFunOnFintype 𝕜 ι fun i => V i let e₂ := LinearEquiv.ofBijective (DirectSum.coeLinearMap V) hV suffices ∀ v : ⨁ i, V i, e₂ v = ∑ i, e₁ v i by exact this (e₁.symm w) intro v -- Porting note: added `DFinsupp.lsum` simp [e₁, e₂, DirectSum.coeLinearMap, DirectSum.toModule, DFinsupp.lsum, DFinsupp.sumAddHom_apply] end variable (ι 𝕜) /-- A shorthand for `PiLp.continuousLinearEquiv`. -/ abbrev EuclideanSpace.equiv : EuclideanSpace 𝕜 ι ≃L[𝕜] ι → 𝕜 := PiLp.continuousLinearEquiv 2 𝕜 _ variable {ι 𝕜} -- TODO : This should be generalized to `PiLp`. /-- The projection on the `i`-th coordinate of `EuclideanSpace 𝕜 ι`, as a linear map. -/ @[simps!] def EuclideanSpace.projₗ (i : ι) : EuclideanSpace 𝕜 ι →ₗ[𝕜] 𝕜 := (LinearMap.proj i).comp (WithLp.linearEquiv 2 𝕜 (ι → 𝕜) : EuclideanSpace 𝕜 ι →ₗ[𝕜] ι → 𝕜) -- TODO : This should be generalized to `PiLp`. /-- The projection on the `i`-th coordinate of `EuclideanSpace 𝕜 ι`, as a continuous linear map. -/ @[simps! apply coe] def EuclideanSpace.proj (i : ι) : EuclideanSpace 𝕜 ι →L[𝕜] 𝕜 := ⟨EuclideanSpace.projₗ i, continuous_apply i⟩ section DecEq variable [DecidableEq ι] -- TODO : This should be generalized to `PiLp`. /-- The vector given in euclidean space by being `a : 𝕜` at coordinate `i : ι` and `0 : 𝕜` at all other coordinates. -/ def EuclideanSpace.single (i : ι) (a : 𝕜) : EuclideanSpace 𝕜 ι := (WithLp.equiv _ _).symm (Pi.single i a) @[simp] theorem WithLp.equiv_single (i : ι) (a : 𝕜) : WithLp.equiv _ _ (EuclideanSpace.single i a) = Pi.single i a := rfl @[simp] theorem WithLp.equiv_symm_single (i : ι) (a : 𝕜) : (WithLp.equiv _ _).symm (Pi.single i a) = EuclideanSpace.single i a := rfl @[simp] theorem EuclideanSpace.single_apply (i : ι) (a : 𝕜) (j : ι) : (EuclideanSpace.single i a) j = ite (j = i) a 0 := by rw [EuclideanSpace.single, WithLp.equiv_symm_pi_apply, ← Pi.single_apply i a j] variable [Fintype ι] theorem EuclideanSpace.inner_single_left (i : ι) (a : 𝕜) (v : EuclideanSpace 𝕜 ι) : ⟪EuclideanSpace.single i (a : 𝕜), v⟫ = conj a * v i := by simp [apply_ite conj] theorem EuclideanSpace.inner_single_right (i : ι) (a : 𝕜) (v : EuclideanSpace 𝕜 ι) : ⟪v, EuclideanSpace.single i (a : 𝕜)⟫ = a * conj (v i) := by simp [apply_ite conj, mul_comm] @[simp] theorem EuclideanSpace.norm_single (i : ι) (a : 𝕜) : ‖EuclideanSpace.single i (a : 𝕜)‖ = ‖a‖ := PiLp.norm_equiv_symm_single 2 (fun _ => 𝕜) i a @[simp] theorem EuclideanSpace.nnnorm_single (i : ι) (a : 𝕜) : ‖EuclideanSpace.single i (a : 𝕜)‖₊ = ‖a‖₊ := PiLp.nnnorm_equiv_symm_single 2 (fun _ => 𝕜) i a @[simp] theorem EuclideanSpace.dist_single_same (i : ι) (a b : 𝕜) : dist (EuclideanSpace.single i (a : 𝕜)) (EuclideanSpace.single i (b : 𝕜)) = dist a b := PiLp.dist_equiv_symm_single_same 2 (fun _ => 𝕜) i a b @[simp] theorem EuclideanSpace.nndist_single_same (i : ι) (a b : 𝕜) : nndist (EuclideanSpace.single i (a : 𝕜)) (EuclideanSpace.single i (b : 𝕜)) = nndist a b := PiLp.nndist_equiv_symm_single_same 2 (fun _ => 𝕜) i a b @[simp] theorem EuclideanSpace.edist_single_same (i : ι) (a b : 𝕜) : edist (EuclideanSpace.single i (a : 𝕜)) (EuclideanSpace.single i (b : 𝕜)) = edist a b := PiLp.edist_equiv_symm_single_same 2 (fun _ => 𝕜) i a b /-- `EuclideanSpace.single` forms an orthonormal family. -/ theorem EuclideanSpace.orthonormal_single : Orthonormal 𝕜 fun i : ι => EuclideanSpace.single i (1 : 𝕜) := by simp_rw [orthonormal_iff_ite, EuclideanSpace.inner_single_left, map_one, one_mul, EuclideanSpace.single_apply] intros trivial theorem EuclideanSpace.piLpCongrLeft_single {ι' : Type*} [Fintype ι'] [DecidableEq ι'] (e : ι' ≃ ι) (i' : ι') (v : 𝕜) : LinearIsometryEquiv.piLpCongrLeft 2 𝕜 𝕜 e (EuclideanSpace.single i' v) = EuclideanSpace.single (e i') v := LinearIsometryEquiv.piLpCongrLeft_single e i' _ end DecEq variable (ι 𝕜 E) variable [Fintype ι] /-- An orthonormal basis on E is an identification of `E` with its dimensional-matching `EuclideanSpace 𝕜 ι`. -/ structure OrthonormalBasis where ofRepr :: /-- Linear isometry between `E` and `EuclideanSpace 𝕜 ι` representing the orthonormal basis. -/ repr : E ≃ₗᵢ[𝕜] EuclideanSpace 𝕜 ι variable {ι 𝕜 E} namespace OrthonormalBasis theorem repr_injective : Injective (repr : OrthonormalBasis ι 𝕜 E → E ≃ₗᵢ[𝕜] EuclideanSpace 𝕜 ι) := fun f g h => by cases f cases g congr -- Porting note: `CoeFun` → `FunLike` /-- `b i` is the `i`th basis vector. -/ instance instFunLike : FunLike (OrthonormalBasis ι 𝕜 E) ι E where coe b i := by classical exact b.repr.symm (EuclideanSpace.single i (1 : 𝕜)) coe_injective' b b' h := repr_injective <| LinearIsometryEquiv.toLinearEquiv_injective <| LinearEquiv.symm_bijective.injective <| LinearEquiv.toLinearMap_injective <| by classical rw [← LinearMap.cancel_right (WithLp.linearEquiv 2 𝕜 (_ → 𝕜)).symm.surjective] simp only [LinearIsometryEquiv.toLinearEquiv_symm] refine LinearMap.pi_ext fun i k => ?_ have : k = k • (1 : 𝕜) := by rw [smul_eq_mul, mul_one] rw [this, Pi.single_smul] replace h := congr_fun h i simp only [LinearEquiv.comp_coe, map_smul, LinearEquiv.coe_coe, LinearEquiv.trans_apply, WithLp.linearEquiv_symm_apply, WithLp.equiv_symm_single, LinearIsometryEquiv.coe_toLinearEquiv] at h ⊢ rw [h] @[simp] theorem coe_ofRepr [DecidableEq ι] (e : E ≃ₗᵢ[𝕜] EuclideanSpace 𝕜 ι) : ⇑(OrthonormalBasis.ofRepr e) = fun i => e.symm (EuclideanSpace.single i (1 : 𝕜)) := by -- Porting note: simplified with `congr!` dsimp only [DFunLike.coe] funext congr! @[simp] protected theorem repr_symm_single [DecidableEq ι] (b : OrthonormalBasis ι 𝕜 E) (i : ι) : b.repr.symm (EuclideanSpace.single i (1 : 𝕜)) = b i := by -- Porting note: simplified with `congr!` dsimp only [DFunLike.coe] congr! @[simp] protected theorem repr_self [DecidableEq ι] (b : OrthonormalBasis ι 𝕜 E) (i : ι) : b.repr (b i) = EuclideanSpace.single i (1 : 𝕜) := by rw [← b.repr_symm_single i, LinearIsometryEquiv.apply_symm_apply] protected theorem repr_apply_apply (b : OrthonormalBasis ι 𝕜 E) (v : E) (i : ι) : b.repr v i = ⟪b i, v⟫ := by classical rw [← b.repr.inner_map_map (b i) v, b.repr_self i, EuclideanSpace.inner_single_left] simp only [one_mul, eq_self_iff_true, map_one] @[simp] protected theorem orthonormal (b : OrthonormalBasis ι 𝕜 E) : Orthonormal 𝕜 b := by classical rw [orthonormal_iff_ite] intro i j rw [← b.repr.inner_map_map (b i) (b j), b.repr_self i, b.repr_self j, EuclideanSpace.inner_single_left, EuclideanSpace.single_apply, map_one, one_mul] /-- The `Basis ι 𝕜 E` underlying the `OrthonormalBasis` -/ protected def toBasis (b : OrthonormalBasis ι 𝕜 E) : Basis ι 𝕜 E := Basis.ofEquivFun b.repr.toLinearEquiv @[simp] protected theorem coe_toBasis (b : OrthonormalBasis ι 𝕜 E) : (⇑b.toBasis : ι → E) = ⇑b := by rw [OrthonormalBasis.toBasis] -- Porting note: was `change` ext j classical rw [Basis.coe_ofEquivFun] congr @[simp] protected theorem coe_toBasis_repr (b : OrthonormalBasis ι 𝕜 E) : b.toBasis.equivFun = b.repr.toLinearEquiv := Basis.equivFun_ofEquivFun _ @[simp] protected theorem coe_toBasis_repr_apply (b : OrthonormalBasis ι 𝕜 E) (x : E) (i : ι) : b.toBasis.repr x i = b.repr x i := by rw [← Basis.equivFun_apply, OrthonormalBasis.coe_toBasis_repr] -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [LinearIsometryEquiv.coe_toLinearEquiv] protected theorem sum_repr (b : OrthonormalBasis ι 𝕜 E) (x : E) : ∑ i, b.repr x i • b i = x := by simp_rw [← b.coe_toBasis_repr_apply, ← b.coe_toBasis] exact b.toBasis.sum_repr x protected theorem sum_repr' (b : OrthonormalBasis ι 𝕜 E) (x : E) : ∑ i, ⟪b i, x⟫_𝕜 • b i = x := by nth_rw 2 [← (b.sum_repr x)] simp_rw [b.repr_apply_apply x] protected theorem sum_repr_symm (b : OrthonormalBasis ι 𝕜 E) (v : EuclideanSpace 𝕜 ι) : ∑ i, v i • b i = b.repr.symm v := by simpa using (b.toBasis.equivFun_symm_apply v).symm protected theorem sum_inner_mul_inner (b : OrthonormalBasis ι 𝕜 E) (x y : E) : ∑ i, ⟪x, b i⟫ * ⟪b i, y⟫ = ⟪x, y⟫ := by have := congr_arg (innerSL 𝕜 x) (b.sum_repr y) rw [map_sum] at this convert this rw [map_smul, b.repr_apply_apply, mul_comm] simp only [innerSL_apply, smul_eq_mul] -- Porting note: was `rfl` protected theorem orthogonalProjection_eq_sum {U : Submodule 𝕜 E} [CompleteSpace U] (b : OrthonormalBasis ι 𝕜 U) (x : E) : orthogonalProjection U x = ∑ i, ⟪(b i : E), x⟫ • b i := by simpa only [b.repr_apply_apply, inner_orthogonalProjection_eq_of_mem_left] using (b.sum_repr (orthogonalProjection U x)).symm /-- Mapping an orthonormal basis along a `LinearIsometryEquiv`. -/ protected def map {G : Type*} [NormedAddCommGroup G] [InnerProductSpace 𝕜 G] (b : OrthonormalBasis ι 𝕜 E) (L : E ≃ₗᵢ[𝕜] G) : OrthonormalBasis ι 𝕜 G where repr := L.symm.trans b.repr @[simp] protected theorem map_apply {G : Type*} [NormedAddCommGroup G] [InnerProductSpace 𝕜 G] (b : OrthonormalBasis ι 𝕜 E) (L : E ≃ₗᵢ[𝕜] G) (i : ι) : b.map L i = L (b i) := rfl @[simp] protected theorem toBasis_map {G : Type*} [NormedAddCommGroup G] [InnerProductSpace 𝕜 G] (b : OrthonormalBasis ι 𝕜 E) (L : E ≃ₗᵢ[𝕜] G) : (b.map L).toBasis = b.toBasis.map L.toLinearEquiv := rfl /-- A basis that is orthonormal is an orthonormal basis. -/ def _root_.Basis.toOrthonormalBasis (v : Basis ι 𝕜 E) (hv : Orthonormal 𝕜 v) : OrthonormalBasis ι 𝕜 E := OrthonormalBasis.ofRepr <| LinearEquiv.isometryOfInner v.equivFun (by intro x y let p : EuclideanSpace 𝕜 ι := v.equivFun x let q : EuclideanSpace 𝕜 ι := v.equivFun y have key : ⟪p, q⟫ = ⟪∑ i, p i • v i, ∑ i, q i • v i⟫ := by simp [sum_inner, inner_smul_left, hv.inner_right_fintype] convert key · rw [← v.equivFun.symm_apply_apply x, v.equivFun_symm_apply] · rw [← v.equivFun.symm_apply_apply y, v.equivFun_symm_apply]) @[simp] theorem _root_.Basis.coe_toOrthonormalBasis_repr (v : Basis ι 𝕜 E) (hv : Orthonormal 𝕜 v) : ((v.toOrthonormalBasis hv).repr : E → EuclideanSpace 𝕜 ι) = v.equivFun := rfl @[simp] theorem _root_.Basis.coe_toOrthonormalBasis_repr_symm (v : Basis ι 𝕜 E) (hv : Orthonormal 𝕜 v) : ((v.toOrthonormalBasis hv).repr.symm : EuclideanSpace 𝕜 ι → E) = v.equivFun.symm := rfl @[simp] theorem _root_.Basis.toBasis_toOrthonormalBasis (v : Basis ι 𝕜 E) (hv : Orthonormal 𝕜 v) : (v.toOrthonormalBasis hv).toBasis = v := by simp [Basis.toOrthonormalBasis, OrthonormalBasis.toBasis] @[simp] theorem _root_.Basis.coe_toOrthonormalBasis (v : Basis ι 𝕜 E) (hv : Orthonormal 𝕜 v) : (v.toOrthonormalBasis hv : ι → E) = (v : ι → E) := calc (v.toOrthonormalBasis hv : ι → E) = ((v.toOrthonormalBasis hv).toBasis : ι → E) := by classical rw [OrthonormalBasis.coe_toBasis] _ = (v : ι → E) := by simp /-- `Pi.orthonormalBasis (B : ∀ i, OrthonormalBasis (ι i) 𝕜 (E i))` is the `Σ i, ι i`-indexed orthonormal basis on `Π i, E i` given by `B i` on each component. -/ protected def _root_.Pi.orthonormalBasis {η : Type*} [Fintype η] {ι : η → Type*} [∀ i, Fintype (ι i)] {𝕜 : Type*} [RCLike 𝕜] {E : η → Type*} [∀ i, NormedAddCommGroup (E i)] [∀ i, InnerProductSpace 𝕜 (E i)] (B : ∀ i, OrthonormalBasis (ι i) 𝕜 (E i)) : OrthonormalBasis ((i : η) × ι i) 𝕜 (PiLp 2 E) where repr := .trans (.piLpCongrRight 2 fun i => (B i).repr) (.symm <| .piLpCurry 𝕜 2 fun _ _ => 𝕜) theorem _root_.Pi.orthonormalBasis.toBasis {η : Type*} [Fintype η] {ι : η → Type*} [∀ i, Fintype (ι i)] {𝕜 : Type*} [RCLike 𝕜] {E : η → Type*} [∀ i, NormedAddCommGroup (E i)] [∀ i, InnerProductSpace 𝕜 (E i)] (B : ∀ i, OrthonormalBasis (ι i) 𝕜 (E i)) : (Pi.orthonormalBasis B).toBasis = ((Pi.basis fun i : η ↦ (B i).toBasis).map (WithLp.linearEquiv 2 _ _).symm) := by ext; rfl @[simp] theorem _root_.Pi.orthonormalBasis_apply {η : Type*} [Fintype η] [DecidableEq η] {ι : η → Type*} [∀ i, Fintype (ι i)] {𝕜 : Type*} [RCLike 𝕜] {E : η → Type*} [∀ i, NormedAddCommGroup (E i)] [∀ i, InnerProductSpace 𝕜 (E i)] (B : ∀ i, OrthonormalBasis (ι i) 𝕜 (E i)) (j : (i : η) × (ι i)) : Pi.orthonormalBasis B j = (WithLp.equiv _ _).symm (Pi.single _ (B j.fst j.snd)) := by classical ext k obtain ⟨i, j⟩ := j simp only [Pi.orthonormalBasis, coe_ofRepr, LinearIsometryEquiv.symm_trans, LinearIsometryEquiv.symm_symm, LinearIsometryEquiv.piLpCongrRight_symm, LinearIsometryEquiv.trans_apply, LinearIsometryEquiv.piLpCongrRight_apply, LinearIsometryEquiv.piLpCurry_apply, WithLp.equiv_single, WithLp.equiv_symm_pi_apply, Sigma.curry_single (γ := fun _ _ => 𝕜)] obtain rfl | hi := Decidable.eq_or_ne i k · simp only [Pi.single_eq_same, WithLp.equiv_symm_single, OrthonormalBasis.repr_symm_single] · simp only [Pi.single_eq_of_ne' hi, WithLp.equiv_symm_zero, _root_.map_zero] @[simp] theorem _root_.Pi.orthonormalBasis_repr {η : Type*} [Fintype η] {ι : η → Type*} [∀ i, Fintype (ι i)] {𝕜 : Type*} [RCLike 𝕜] {E : η → Type*} [∀ i, NormedAddCommGroup (E i)] [∀ i, InnerProductSpace 𝕜 (E i)] (B : ∀ i, OrthonormalBasis (ι i) 𝕜 (E i)) (x : (i : η ) → E i) (j : (i : η) × (ι i)) : (Pi.orthonormalBasis B).repr x j = (B j.fst).repr (x j.fst) j.snd := rfl variable {v : ι → E} /-- A finite orthonormal set that spans is an orthonormal basis -/ protected def mk (hon : Orthonormal 𝕜 v) (hsp : ⊤ ≤ Submodule.span 𝕜 (Set.range v)) : OrthonormalBasis ι 𝕜 E := (Basis.mk (Orthonormal.linearIndependent hon) hsp).toOrthonormalBasis (by rwa [Basis.coe_mk]) @[simp] protected theorem coe_mk (hon : Orthonormal 𝕜 v) (hsp : ⊤ ≤ Submodule.span 𝕜 (Set.range v)) : ⇑(OrthonormalBasis.mk hon hsp) = v := by classical rw [OrthonormalBasis.mk, _root_.Basis.coe_toOrthonormalBasis, Basis.coe_mk] /-- Any finite subset of an orthonormal family is an `OrthonormalBasis` for its span. -/ protected def span [DecidableEq E] {v' : ι' → E} (h : Orthonormal 𝕜 v') (s : Finset ι') : OrthonormalBasis s 𝕜 (span 𝕜 (s.image v' : Set E)) := let e₀' : Basis s 𝕜 _ := Basis.span (h.linearIndependent.comp ((↑) : s → ι') Subtype.val_injective) let e₀ : OrthonormalBasis s 𝕜 _ := OrthonormalBasis.mk (by convert orthonormal_span (h.comp ((↑) : s → ι') Subtype.val_injective) simp [e₀', Basis.span_apply]) e₀'.span_eq.ge let φ : span 𝕜 (s.image v' : Set E) ≃ₗᵢ[𝕜] span 𝕜 (range (v' ∘ ((↑) : s → ι'))) := LinearIsometryEquiv.ofEq _ _ (by rw [Finset.coe_image, image_eq_range] rfl) e₀.map φ.symm @[simp] protected theorem span_apply [DecidableEq E] {v' : ι' → E} (h : Orthonormal 𝕜 v') (s : Finset ι') (i : s) : (OrthonormalBasis.span h s i : E) = v' i := by simp only [OrthonormalBasis.span, Basis.span_apply, LinearIsometryEquiv.ofEq_symm, OrthonormalBasis.map_apply, OrthonormalBasis.coe_mk, LinearIsometryEquiv.coe_ofEq_apply, comp_apply] open Submodule /-- A finite orthonormal family of vectors whose span has trivial orthogonal complement is an orthonormal basis. -/ protected def mkOfOrthogonalEqBot (hon : Orthonormal 𝕜 v) (hsp : (span 𝕜 (Set.range v))ᗮ = ⊥) : OrthonormalBasis ι 𝕜 E := OrthonormalBasis.mk hon (by refine Eq.ge ?_ haveI : FiniteDimensional 𝕜 (span 𝕜 (range v)) := FiniteDimensional.span_of_finite 𝕜 (finite_range v) haveI : CompleteSpace (span 𝕜 (range v)) := FiniteDimensional.complete 𝕜 _ rwa [orthogonal_eq_bot_iff] at hsp) @[simp] protected theorem coe_of_orthogonal_eq_bot_mk (hon : Orthonormal 𝕜 v) (hsp : (span 𝕜 (Set.range v))ᗮ = ⊥) : ⇑(OrthonormalBasis.mkOfOrthogonalEqBot hon hsp) = v := OrthonormalBasis.coe_mk hon _ variable [Fintype ι'] /-- `b.reindex (e : ι ≃ ι')` is an `OrthonormalBasis` indexed by `ι'` -/ def reindex (b : OrthonormalBasis ι 𝕜 E) (e : ι ≃ ι') : OrthonormalBasis ι' 𝕜 E := OrthonormalBasis.ofRepr (b.repr.trans (LinearIsometryEquiv.piLpCongrLeft 2 𝕜 𝕜 e)) protected theorem reindex_apply (b : OrthonormalBasis ι 𝕜 E) (e : ι ≃ ι') (i' : ι') : (b.reindex e) i' = b (e.symm i') := by classical dsimp [reindex] rw [coe_ofRepr] dsimp rw [← b.repr_symm_single, LinearIsometryEquiv.piLpCongrLeft_symm, EuclideanSpace.piLpCongrLeft_single] @[simp] theorem reindex_toBasis (b : OrthonormalBasis ι 𝕜 E) (e : ι ≃ ι') : (b.reindex e).toBasis = b.toBasis.reindex e := Basis.eq_ofRepr_eq_repr fun _ ↦ congr_fun rfl @[simp] protected theorem coe_reindex (b : OrthonormalBasis ι 𝕜 E) (e : ι ≃ ι') : ⇑(b.reindex e) = b ∘ e.symm := funext (b.reindex_apply e) @[simp] protected theorem repr_reindex (b : OrthonormalBasis ι 𝕜 E) (e : ι ≃ ι') (x : E) (i' : ι') : (b.reindex e).repr x i' = b.repr x (e.symm i') := by classical rw [OrthonormalBasis.repr_apply_apply, b.repr_apply_apply, OrthonormalBasis.coe_reindex, comp_apply] end OrthonormalBasis namespace EuclideanSpace variable (𝕜 ι) /-- The basis `Pi.basisFun`, bundled as an orthornormal basis of `EuclideanSpace 𝕜 ι`. -/ noncomputable def basisFun : OrthonormalBasis ι 𝕜 (EuclideanSpace 𝕜 ι) := ⟨LinearIsometryEquiv.refl _ _⟩ @[simp] theorem basisFun_apply [DecidableEq ι] (i : ι) : basisFun ι 𝕜 i = EuclideanSpace.single i 1 := PiLp.basisFun_apply _ _ _ _ @[simp] theorem basisFun_repr (x : EuclideanSpace 𝕜 ι) (i : ι) : (basisFun ι 𝕜).repr x i = x i := rfl theorem basisFun_toBasis : (basisFun ι 𝕜).toBasis = PiLp.basisFun _ 𝕜 ι := rfl end EuclideanSpace instance OrthonormalBasis.instInhabited : Inhabited (OrthonormalBasis ι 𝕜 (EuclideanSpace 𝕜 ι)) := ⟨EuclideanSpace.basisFun ι 𝕜⟩ section Complex /-- `![1, I]` is an orthonormal basis for `ℂ` considered as a real inner product space. -/ def Complex.orthonormalBasisOneI : OrthonormalBasis (Fin 2) ℝ ℂ := Complex.basisOneI.toOrthonormalBasis (by rw [orthonormal_iff_ite] intro i; fin_cases i <;> intro j <;> fin_cases j <;> simp [real_inner_eq_re_inner]) @[simp] theorem Complex.orthonormalBasisOneI_repr_apply (z : ℂ) : Complex.orthonormalBasisOneI.repr z = ![z.re, z.im] := rfl @[simp] theorem Complex.orthonormalBasisOneI_repr_symm_apply (x : EuclideanSpace ℝ (Fin 2)) : Complex.orthonormalBasisOneI.repr.symm x = x 0 + x 1 * I := rfl @[simp] theorem Complex.toBasis_orthonormalBasisOneI : Complex.orthonormalBasisOneI.toBasis = Complex.basisOneI := Basis.toBasis_toOrthonormalBasis _ _ @[simp] theorem Complex.coe_orthonormalBasisOneI : (Complex.orthonormalBasisOneI : Fin 2 → ℂ) = ![1, I] := by simp [Complex.orthonormalBasisOneI] /-- The isometry between `ℂ` and a two-dimensional real inner product space given by a basis. -/ def Complex.isometryOfOrthonormal (v : OrthonormalBasis (Fin 2) ℝ F) : ℂ ≃ₗᵢ[ℝ] F := Complex.orthonormalBasisOneI.repr.trans v.repr.symm @[simp] theorem Complex.map_isometryOfOrthonormal (v : OrthonormalBasis (Fin 2) ℝ F) (f : F ≃ₗᵢ[ℝ] F') : Complex.isometryOfOrthonormal (v.map f) = (Complex.isometryOfOrthonormal v).trans f := by simp only [isometryOfOrthonormal, OrthonormalBasis.map, LinearIsometryEquiv.symm_trans, LinearIsometryEquiv.symm_symm] -- Porting note: `LinearIsometryEquiv.trans_assoc` doesn't trigger in the `simp` above rw [LinearIsometryEquiv.trans_assoc] theorem Complex.isometryOfOrthonormal_symm_apply (v : OrthonormalBasis (Fin 2) ℝ F) (f : F) : (Complex.isometryOfOrthonormal v).symm f = (v.toBasis.coord 0 f : ℂ) + (v.toBasis.coord 1 f : ℂ) * I := by simp [Complex.isometryOfOrthonormal] theorem Complex.isometryOfOrthonormal_apply (v : OrthonormalBasis (Fin 2) ℝ F) (z : ℂ) : Complex.isometryOfOrthonormal v z = z.re • v 0 + z.im • v 1 := by -- Porting note: was -- simp [Complex.isometryOfOrthonormal, ← v.sum_repr_symm] rw [Complex.isometryOfOrthonormal, LinearIsometryEquiv.trans_apply] simp [← v.sum_repr_symm] end Complex open FiniteDimensional /-! ### Matrix representation of an orthonormal basis with respect to another -/ section ToMatrix variable [DecidableEq ι] section variable (a b : OrthonormalBasis ι 𝕜 E) /-- The change-of-basis matrix between two orthonormal bases `a`, `b` is a unitary matrix. -/ theorem OrthonormalBasis.toMatrix_orthonormalBasis_mem_unitary : a.toBasis.toMatrix b ∈ Matrix.unitaryGroup ι 𝕜 := by rw [Matrix.mem_unitaryGroup_iff'] ext i j convert a.repr.inner_map_map (b i) (b j) rw [orthonormal_iff_ite.mp b.orthonormal i j] rfl /-- The determinant of the change-of-basis matrix between two orthonormal bases `a`, `b` has unit length. -/ @[simp] theorem OrthonormalBasis.det_to_matrix_orthonormalBasis : ‖a.toBasis.det b‖ = 1 := by have := (Matrix.det_of_mem_unitary (a.toMatrix_orthonormalBasis_mem_unitary b)).2 rw [star_def, RCLike.mul_conj] at this norm_cast at this rwa [pow_eq_one_iff_of_nonneg (norm_nonneg _) two_ne_zero] at this end section Real variable (a b : OrthonormalBasis ι ℝ F) /-- The change-of-basis matrix between two orthonormal bases `a`, `b` is an orthogonal matrix. -/ theorem OrthonormalBasis.toMatrix_orthonormalBasis_mem_orthogonal : a.toBasis.toMatrix b ∈ Matrix.orthogonalGroup ι ℝ := a.toMatrix_orthonormalBasis_mem_unitary b /-- The determinant of the change-of-basis matrix between two orthonormal bases `a`, `b` is ±1. -/ theorem OrthonormalBasis.det_to_matrix_orthonormalBasis_real : a.toBasis.det b = 1 ∨ a.toBasis.det b = -1 := by rw [← sq_eq_one_iff] simpa [unitary, sq] using Matrix.det_of_mem_unitary (a.toMatrix_orthonormalBasis_mem_unitary b) end Real end ToMatrix /-! ### Existence of orthonormal basis, etc. -/ section FiniteDimensional variable {v : Set E} variable {A : ι → Submodule 𝕜 E} /-- Given an internal direct sum decomposition of a module `M`, and an orthonormal basis for each of the components of the direct sum, the disjoint union of these orthonormal bases is an orthonormal basis for `M`. -/ noncomputable def DirectSum.IsInternal.collectedOrthonormalBasis (hV : OrthogonalFamily 𝕜 (fun i => A i) fun i => (A i).subtypeₗᵢ) [DecidableEq ι] (hV_sum : DirectSum.IsInternal fun i => A i) {α : ι → Type*} [∀ i, Fintype (α i)] (v_family : ∀ i, OrthonormalBasis (α i) 𝕜 (A i)) : OrthonormalBasis (Σi, α i) 𝕜 E := (hV_sum.collectedBasis fun i => (v_family i).toBasis).toOrthonormalBasis <| by simpa using hV.orthonormal_sigma_orthonormal (show ∀ i, Orthonormal 𝕜 (v_family i).toBasis by simp) theorem DirectSum.IsInternal.collectedOrthonormalBasis_mem [DecidableEq ι] (h : DirectSum.IsInternal A) {α : ι → Type*} [∀ i, Fintype (α i)] (hV : OrthogonalFamily 𝕜 (fun i => A i) fun i => (A i).subtypeₗᵢ) (v : ∀ i, OrthonormalBasis (α i) 𝕜 (A i)) (a : Σi, α i) : h.collectedOrthonormalBasis hV v a ∈ A a.1 := by simp [DirectSum.IsInternal.collectedOrthonormalBasis] variable [FiniteDimensional 𝕜 E] /-- In a finite-dimensional `InnerProductSpace`, any orthonormal subset can be extended to an orthonormal basis. -/ theorem Orthonormal.exists_orthonormalBasis_extension (hv : Orthonormal 𝕜 ((↑) : v → E)) : ∃ (u : Finset E) (b : OrthonormalBasis u 𝕜 E), v ⊆ u ∧ ⇑b = ((↑) : u → E) := by obtain ⟨u₀, hu₀s, hu₀, hu₀_max⟩ := exists_maximal_orthonormal hv rw [maximal_orthonormal_iff_orthogonalComplement_eq_bot hu₀] at hu₀_max have hu₀_finite : u₀.Finite := hu₀.linearIndependent.setFinite let u : Finset E := hu₀_finite.toFinset let fu : ↥u ≃ ↥u₀ := hu₀_finite.subtypeEquivToFinset.symm have hu : Orthonormal 𝕜 ((↑) : u → E) := by simpa using hu₀.comp _ fu.injective refine ⟨u, OrthonormalBasis.mkOfOrthogonalEqBot hu ?_, ?_, ?_⟩ · simpa [u] using hu₀_max · simpa [u] using hu₀s · simp theorem Orthonormal.exists_orthonormalBasis_extension_of_card_eq {ι : Type*} [Fintype ι] (card_ι : finrank 𝕜 E = Fintype.card ι) {v : ι → E} {s : Set ι} (hv : Orthonormal 𝕜 (s.restrict v)) : ∃ b : OrthonormalBasis ι 𝕜 E, ∀ i ∈ s, b i = v i := by have hsv : Injective (s.restrict v) := hv.linearIndependent.injective have hX : Orthonormal 𝕜 ((↑) : Set.range (s.restrict v) → E) := by rwa [orthonormal_subtype_range hsv] obtain ⟨Y, b₀, hX, hb₀⟩ := hX.exists_orthonormalBasis_extension have hιY : Fintype.card ι = Y.card := by refine card_ι.symm.trans ?_ exact FiniteDimensional.finrank_eq_card_finset_basis b₀.toBasis have hvsY : s.MapsTo v Y := (s.mapsTo_image v).mono_right (by rwa [← range_restrict]) have hsv' : Set.InjOn v s := by rw [Set.injOn_iff_injective] exact hsv obtain ⟨g, hg⟩ := hvsY.exists_equiv_extend_of_card_eq hιY hsv' use b₀.reindex g.symm intro i hi simp [hb₀, hg i hi] variable (𝕜 E) /-- A finite-dimensional inner product space admits an orthonormal basis. -/ theorem _root_.exists_orthonormalBasis : ∃ (w : Finset E) (b : OrthonormalBasis w 𝕜 E), ⇑b = ((↑) : w → E) := let ⟨w, hw, _, hw''⟩ := (orthonormal_empty 𝕜 E).exists_orthonormalBasis_extension ⟨w, hw, hw''⟩ /-- A finite-dimensional `InnerProductSpace` has an orthonormal basis. -/ irreducible_def stdOrthonormalBasis : OrthonormalBasis (Fin (finrank 𝕜 E)) 𝕜 E := by let b := Classical.choose (Classical.choose_spec <| exists_orthonormalBasis 𝕜 E) rw [finrank_eq_card_basis b.toBasis] exact b.reindex (Fintype.equivFinOfCardEq rfl) /-- An orthonormal basis of `ℝ` is made either of the vector `1`, or of the vector `-1`. -/ theorem orthonormalBasis_one_dim (b : OrthonormalBasis ι ℝ ℝ) : (⇑b = fun _ => (1 : ℝ)) ∨ ⇑b = fun _ => (-1 : ℝ) := by have : Unique ι := b.toBasis.unique have : b default = 1 ∨ b default = -1 := by have : ‖b default‖ = 1 := b.orthonormal.1 _ rwa [Real.norm_eq_abs, abs_eq (zero_le_one' ℝ)] at this rw [eq_const_of_unique b] refine this.imp ?_ ?_ <;> (intro; ext; simp [*]) variable {𝕜 E} section SubordinateOrthonormalBasis open DirectSum variable {n : ℕ} (hn : finrank 𝕜 E = n) [DecidableEq ι] {V : ι → Submodule 𝕜 E} (hV : IsInternal V) /-- Exhibit a bijection between `Fin n` and the index set of a certain basis of an `n`-dimensional inner product space `E`. This should not be accessed directly, but only via the subsequent API. -/ irreducible_def DirectSum.IsInternal.sigmaOrthonormalBasisIndexEquiv (hV' : OrthogonalFamily 𝕜 (fun i => V i) fun i => (V i).subtypeₗᵢ) : (Σi, Fin (finrank 𝕜 (V i))) ≃ Fin n := let b := hV.collectedOrthonormalBasis hV' fun i => stdOrthonormalBasis 𝕜 (V i) Fintype.equivFinOfCardEq <| (FiniteDimensional.finrank_eq_card_basis b.toBasis).symm.trans hn /-- An `n`-dimensional `InnerProductSpace` equipped with a decomposition as an internal direct sum has an orthonormal basis indexed by `Fin n` and subordinate to that direct sum. -/ irreducible_def DirectSum.IsInternal.subordinateOrthonormalBasis (hV' : OrthogonalFamily 𝕜 (fun i => V i) fun i => (V i).subtypeₗᵢ) : OrthonormalBasis (Fin n) 𝕜 E := (hV.collectedOrthonormalBasis hV' fun i => stdOrthonormalBasis 𝕜 (V i)).reindex (hV.sigmaOrthonormalBasisIndexEquiv hn hV') /-- An `n`-dimensional `InnerProductSpace` equipped with a decomposition as an internal direct sum has an orthonormal basis indexed by `Fin n` and subordinate to that direct sum. This function provides the mapping by which it is subordinate. -/ irreducible_def DirectSum.IsInternal.subordinateOrthonormalBasisIndex (a : Fin n) (hV' : OrthogonalFamily 𝕜 (fun i => V i) fun i => (V i).subtypeₗᵢ) : ι := ((hV.sigmaOrthonormalBasisIndexEquiv hn hV').symm a).1 /-- The basis constructed in `DirectSum.IsInternal.subordinateOrthonormalBasis` is subordinate to the `OrthogonalFamily` in question. -/ theorem DirectSum.IsInternal.subordinateOrthonormalBasis_subordinate (a : Fin n) (hV' : OrthogonalFamily 𝕜 (fun i => V i) fun i => (V i).subtypeₗᵢ) : hV.subordinateOrthonormalBasis hn hV' a ∈ V (hV.subordinateOrthonormalBasisIndex hn a hV') := by simpa only [DirectSum.IsInternal.subordinateOrthonormalBasis, OrthonormalBasis.coe_reindex, DirectSum.IsInternal.subordinateOrthonormalBasisIndex] using hV.collectedOrthonormalBasis_mem hV' (fun i => stdOrthonormalBasis 𝕜 (V i)) ((hV.sigmaOrthonormalBasisIndexEquiv hn hV').symm a) end SubordinateOrthonormalBasis end FiniteDimensional /-- Given a natural number `n` one less than the `finrank` of a finite-dimensional inner product space, there exists an isometry from the orthogonal complement of a nonzero singleton to `EuclideanSpace 𝕜 (Fin n)`. -/ def OrthonormalBasis.fromOrthogonalSpanSingleton (n : ℕ) [Fact (finrank 𝕜 E = n + 1)] {v : E} (hv : v ≠ 0) : OrthonormalBasis (Fin n) 𝕜 (𝕜 ∙ v)ᗮ := -- Porting note: was `attribute [local instance] FiniteDimensional.of_fact_finrank_eq_succ` haveI : FiniteDimensional 𝕜 E := .of_fact_finrank_eq_succ (K := 𝕜) (V := E) n (stdOrthonormalBasis _ _).reindex <| finCongr <| finrank_orthogonal_span_singleton hv section LinearIsometry variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace 𝕜 V] [FiniteDimensional 𝕜 V] variable {S : Submodule 𝕜 V} {L : S →ₗᵢ[𝕜] V} open FiniteDimensional /-- Let `S` be a subspace of a finite-dimensional complex inner product space `V`. A linear isometry mapping `S` into `V` can be extended to a full isometry of `V`. TODO: The case when `S` is a finite-dimensional subspace of an infinite-dimensional `V`. -/ noncomputable def LinearIsometry.extend (L : S →ₗᵢ[𝕜] V) : V →ₗᵢ[𝕜] V := by -- Build an isometry from Sᗮ to L(S)ᗮ through `EuclideanSpace` let d := finrank 𝕜 Sᗮ let LS := LinearMap.range L.toLinearMap have E : Sᗮ ≃ₗᵢ[𝕜] LSᗮ := by have dim_LS_perp : finrank 𝕜 LSᗮ = d := calc finrank 𝕜 LSᗮ = finrank 𝕜 V - finrank 𝕜 LS := by simp only [← LS.finrank_add_finrank_orthogonal, add_tsub_cancel_left] _ = finrank 𝕜 V - finrank 𝕜 S := by simp only [LinearMap.finrank_range_of_inj L.injective] _ = finrank 𝕜 Sᗮ := by simp only [← S.finrank_add_finrank_orthogonal, add_tsub_cancel_left] exact (stdOrthonormalBasis 𝕜 Sᗮ).repr.trans ((stdOrthonormalBasis 𝕜 LSᗮ).reindex <| finCongr dim_LS_perp).repr.symm let L3 := LSᗮ.subtypeₗᵢ.comp E.toLinearIsometry -- Project onto S and Sᗮ haveI : CompleteSpace S := FiniteDimensional.complete 𝕜 S haveI : CompleteSpace V := FiniteDimensional.complete 𝕜 V let p1 := (orthogonalProjection S).toLinearMap let p2 := (orthogonalProjection Sᗮ).toLinearMap -- Build a linear map from the isometries on S and Sᗮ let M := L.toLinearMap.comp p1 + L3.toLinearMap.comp p2 -- Prove that M is an isometry have M_norm_map : ∀ x : V, ‖M x‖ = ‖x‖ := by intro x -- Apply M to the orthogonal decomposition of x have Mx_decomp : M x = L (p1 x) + L3 (p2 x) := by simp only [M, LinearMap.add_apply, LinearMap.comp_apply, LinearMap.comp_apply, LinearIsometry.coe_toLinearMap] -- Mx_decomp is the orthogonal decomposition of M x have Mx_orth : ⟪L (p1 x), L3 (p2 x)⟫ = 0 := by have Lp1x : L (p1 x) ∈ LinearMap.range L.toLinearMap := LinearMap.mem_range_self L.toLinearMap (p1 x) have Lp2x : L3 (p2 x) ∈ (LinearMap.range L.toLinearMap)ᗮ := by simp only [LinearIsometry.coe_comp, Function.comp_apply, Submodule.coe_subtypeₗᵢ, ← Submodule.range_subtype LSᗮ] apply LinearMap.mem_range_self apply Submodule.inner_right_of_mem_orthogonal Lp1x Lp2x -- Apply the Pythagorean theorem and simplify rw [← sq_eq_sq (norm_nonneg _) (norm_nonneg _), norm_sq_eq_add_norm_sq_projection x S] simp only [sq, Mx_decomp] rw [norm_add_sq_eq_norm_sq_add_norm_sq_of_inner_eq_zero (L (p1 x)) (L3 (p2 x)) Mx_orth] simp only [p1, p2, LinearIsometry.norm_map, _root_.add_left_inj, mul_eq_mul_left_iff, norm_eq_zero, true_or_iff, eq_self_iff_true, ContinuousLinearMap.coe_coe, Submodule.coe_norm, Submodule.coe_eq_zero] exact { toLinearMap := M norm_map' := M_norm_map } theorem LinearIsometry.extend_apply (L : S →ₗᵢ[𝕜] V) (s : S) : L.extend s = L s := by haveI : CompleteSpace S := FiniteDimensional.complete 𝕜 S simp only [LinearIsometry.extend, ← LinearIsometry.coe_toLinearMap] simp only [add_right_eq_self, LinearIsometry.coe_toLinearMap, LinearIsometryEquiv.coe_toLinearIsometry, LinearIsometry.coe_comp, Function.comp_apply, orthogonalProjection_mem_subspace_eq_self, LinearMap.coe_comp, ContinuousLinearMap.coe_coe, Submodule.coeSubtype, LinearMap.add_apply, Submodule.coe_eq_zero, LinearIsometryEquiv.map_eq_zero_iff, Submodule.coe_subtypeₗᵢ, orthogonalProjection_mem_subspace_orthogonalComplement_eq_zero, Submodule.orthogonal_orthogonal, Submodule.coe_mem] end LinearIsometry section Matrix open Matrix variable {m n : Type*} namespace Matrix variable [Fintype n] [DecidableEq n] /-- `Matrix.toLin'` adapted for `EuclideanSpace 𝕜 _`. -/ def toEuclideanLin : Matrix m n 𝕜 ≃ₗ[𝕜] EuclideanSpace 𝕜 n →ₗ[𝕜] EuclideanSpace 𝕜 m := Matrix.toLin' ≪≫ₗ LinearEquiv.arrowCongr (WithLp.linearEquiv _ 𝕜 (n → 𝕜)).symm (WithLp.linearEquiv _ 𝕜 (m → 𝕜)).symm @[simp] theorem toEuclideanLin_piLp_equiv_symm (A : Matrix m n 𝕜) (x : n → 𝕜) : Matrix.toEuclideanLin A ((WithLp.equiv _ _).symm x) = (WithLp.equiv _ _).symm (Matrix.toLin' A x) := rfl @[simp] theorem piLp_equiv_toEuclideanLin (A : Matrix m n 𝕜) (x : EuclideanSpace 𝕜 n) : WithLp.equiv _ _ (Matrix.toEuclideanLin A x) = Matrix.toLin' A (WithLp.equiv _ _ x) := rfl theorem toEuclideanLin_apply (M : Matrix m n 𝕜) (v : EuclideanSpace 𝕜 n) : toEuclideanLin M v = (WithLp.equiv 2 (m → 𝕜)).symm (M *ᵥ (WithLp.equiv 2 (n → 𝕜)) v) := rfl @[simp] theorem piLp_equiv_toEuclideanLin_apply (M : Matrix m n 𝕜) (v : EuclideanSpace 𝕜 n) : WithLp.equiv 2 (m → 𝕜) (toEuclideanLin M v) = M *ᵥ WithLp.equiv 2 (n → 𝕜) v := rfl @[simp] theorem toEuclideanLin_apply_piLp_equiv_symm (M : Matrix m n 𝕜) (v : n → 𝕜) : toEuclideanLin M ((WithLp.equiv 2 (n→ 𝕜)).symm v) = (WithLp.equiv 2 (m → 𝕜)).symm (M *ᵥ v) := rfl -- `Matrix.toEuclideanLin` is the same as `Matrix.toLin` applied to `PiLp.basisFun`, theorem toEuclideanLin_eq_toLin [Finite m] : (toEuclideanLin : Matrix m n 𝕜 ≃ₗ[𝕜] _) = Matrix.toLin (PiLp.basisFun _ _ _) (PiLp.basisFun _ _ _) := rfl open EuclideanSpace in lemma toEuclideanLin_eq_toLin_orthonormal [Fintype m] : toEuclideanLin = toLin (basisFun n 𝕜).toBasis (basisFun m 𝕜).toBasis := rfl end Matrix local notation "⟪" x ", " y "⟫ₑ" => @inner 𝕜 _ _ (Equiv.symm (WithLp.equiv 2 _) x) (Equiv.symm (WithLp.equiv 2 _) y) /-- The inner product of a row of `A` and a row of `B` is an entry of `B * Aᴴ`. -/ theorem inner_matrix_row_row [Fintype n] (A B : Matrix m n 𝕜) (i j : m) : ⟪A i, B j⟫ₑ = (B * Aᴴ) j i := by simp_rw [EuclideanSpace.inner_piLp_equiv_symm, Matrix.mul_apply', Matrix.dotProduct_comm, Matrix.conjTranspose_apply, Pi.star_def] /-- The inner product of a column of `A` and a column of `B` is an entry of `Aᴴ * B`. -/ theorem inner_matrix_col_col [Fintype m] (A B : Matrix m n 𝕜) (i j : n) : ⟪Aᵀ i, Bᵀ j⟫ₑ = (Aᴴ * B) i j := rfl end Matrix
Analysis\InnerProductSpace\Positive.lean
/- Copyright (c) 2022 Anatole Dedecker. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Anatole Dedecker -/ import Mathlib.Analysis.InnerProductSpace.Adjoint /-! # Positive operators In this file we define positive operators in a Hilbert space. We follow Bourbaki's choice of requiring self adjointness in the definition. ## Main definitions * `IsPositive` : a continuous linear map is positive if it is self adjoint and `∀ x, 0 ≤ re ⟪T x, x⟫` ## Main statements * `ContinuousLinearMap.IsPositive.conj_adjoint` : if `T : E →L[𝕜] E` is positive, then for any `S : E →L[𝕜] F`, `S ∘L T ∘L S†` is also positive. * `ContinuousLinearMap.isPositive_iff_complex` : in a ***complex*** Hilbert space, checking that `⟪T x, x⟫` is a nonnegative real number for all `x` suffices to prove that `T` is positive ## References * [Bourbaki, *Topological Vector Spaces*][bourbaki1987] ## Tags Positive operator -/ open InnerProductSpace RCLike ContinuousLinearMap open scoped InnerProduct ComplexConjugate namespace ContinuousLinearMap variable {𝕜 E F : Type*} [RCLike 𝕜] variable [NormedAddCommGroup E] [NormedAddCommGroup F] variable [InnerProductSpace 𝕜 E] [InnerProductSpace 𝕜 F] variable [CompleteSpace E] [CompleteSpace F] local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y /-- A continuous linear endomorphism `T` of a Hilbert space is **positive** if it is self adjoint and `∀ x, 0 ≤ re ⟪T x, x⟫`. -/ def IsPositive (T : E →L[𝕜] E) : Prop := IsSelfAdjoint T ∧ ∀ x, 0 ≤ T.reApplyInnerSelf x theorem IsPositive.isSelfAdjoint {T : E →L[𝕜] E} (hT : IsPositive T) : IsSelfAdjoint T := hT.1 theorem IsPositive.inner_nonneg_left {T : E →L[𝕜] E} (hT : IsPositive T) (x : E) : 0 ≤ re ⟪T x, x⟫ := hT.2 x theorem IsPositive.inner_nonneg_right {T : E →L[𝕜] E} (hT : IsPositive T) (x : E) : 0 ≤ re ⟪x, T x⟫ := by rw [inner_re_symm]; exact hT.inner_nonneg_left x theorem isPositive_zero : IsPositive (0 : E →L[𝕜] E) := by refine ⟨.zero _, fun x => ?_⟩ change 0 ≤ re ⟪_, _⟫ rw [zero_apply, inner_zero_left, ZeroHomClass.map_zero] theorem isPositive_one : IsPositive (1 : E →L[𝕜] E) := ⟨.one _, fun _ => inner_self_nonneg⟩ theorem IsPositive.add {T S : E →L[𝕜] E} (hT : T.IsPositive) (hS : S.IsPositive) : (T + S).IsPositive := by refine ⟨hT.isSelfAdjoint.add hS.isSelfAdjoint, fun x => ?_⟩ rw [reApplyInnerSelf, add_apply, inner_add_left, map_add] exact add_nonneg (hT.inner_nonneg_left x) (hS.inner_nonneg_left x) theorem IsPositive.conj_adjoint {T : E →L[𝕜] E} (hT : T.IsPositive) (S : E →L[𝕜] F) : (S ∘L T ∘L S†).IsPositive := by refine ⟨hT.isSelfAdjoint.conj_adjoint S, fun x => ?_⟩ rw [reApplyInnerSelf, comp_apply, ← adjoint_inner_right] exact hT.inner_nonneg_left _ theorem IsPositive.adjoint_conj {T : E →L[𝕜] E} (hT : T.IsPositive) (S : F →L[𝕜] E) : (S† ∘L T ∘L S).IsPositive := by convert hT.conj_adjoint (S†) rw [adjoint_adjoint] theorem IsPositive.conj_orthogonalProjection (U : Submodule 𝕜 E) {T : E →L[𝕜] E} (hT : T.IsPositive) [CompleteSpace U] : (U.subtypeL ∘L orthogonalProjection U ∘L T ∘L U.subtypeL ∘L orthogonalProjection U).IsPositive := by have := hT.conj_adjoint (U.subtypeL ∘L orthogonalProjection U) rwa [(orthogonalProjection_isSelfAdjoint U).adjoint_eq] at this theorem IsPositive.orthogonalProjection_comp {T : E →L[𝕜] E} (hT : T.IsPositive) (U : Submodule 𝕜 E) [CompleteSpace U] : (orthogonalProjection U ∘L T ∘L U.subtypeL).IsPositive := by have := hT.conj_adjoint (orthogonalProjection U : E →L[𝕜] U) rwa [U.adjoint_orthogonalProjection] at this section Complex variable {E' : Type*} [NormedAddCommGroup E'] [InnerProductSpace ℂ E'] [CompleteSpace E'] theorem isPositive_iff_complex (T : E' →L[ℂ] E') : IsPositive T ↔ ∀ x, (re ⟪T x, x⟫_ℂ : ℂ) = ⟪T x, x⟫_ℂ ∧ 0 ≤ re ⟪T x, x⟫_ℂ := by simp_rw [IsPositive, forall_and, isSelfAdjoint_iff_isSymmetric, LinearMap.isSymmetric_iff_inner_map_self_real, conj_eq_iff_re] rfl end Complex section PartialOrder /-- The (Loewner) partial order on continuous linear maps on a Hilbert space determined by `f ≤ g` if and only if `g - f` is a positive linear map (in the sense of `ContinuousLinearMap.IsPositive`). With this partial order, the continuous linear maps form a `StarOrderedRing`. -/ instance instLoewnerPartialOrder : PartialOrder (E →L[𝕜] E) where le f g := (g - f).IsPositive le_refl _ := by simpa using isPositive_zero le_trans _ _ _ h₁ h₂ := by simpa using h₁.add h₂ le_antisymm f₁ f₂ h₁ h₂ := by rw [← sub_eq_zero] have h_isSymm := isSelfAdjoint_iff_isSymmetric.mp h₂.isSelfAdjoint exact_mod_cast h_isSymm.inner_map_self_eq_zero.mp fun x ↦ by apply RCLike.ext · rw [map_zero] apply le_antisymm · rw [← neg_nonneg, ← map_neg, ← inner_neg_left] simpa using h₁.inner_nonneg_left _ · exact h₂.inner_nonneg_left _ · rw [coe_sub, LinearMap.sub_apply, coe_coe, coe_coe, map_zero, ← sub_apply, ← h_isSymm.coe_reApplyInnerSelf_apply (T := f₁ - f₂) x, RCLike.ofReal_im] lemma le_def (f g : E →L[𝕜] E) : f ≤ g ↔ (g - f).IsPositive := Iff.rfl lemma nonneg_iff_isPositive (f : E →L[𝕜] E) : 0 ≤ f ↔ f.IsPositive := by simpa using le_def 0 f end PartialOrder end ContinuousLinearMap
Analysis\InnerProductSpace\ProdL2.lean
/- Copyright (c) 2023 Moritz Doll. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Moritz Doll -/ import Mathlib.Analysis.InnerProductSpace.PiL2 import Mathlib.Analysis.Normed.Lp.ProdLp /-! # `L²` inner product space structure on products of inner product spaces The `L²` norm on product of two inner product spaces is compatible with an inner product $$ \langle x, y\rangle = \langle x_1, y_1 \rangle + \langle x_2, y_2 \rangle. $$ This is recorded in this file as an inner product space instance on `WithLp 2 (E × F)`. -/ variable {𝕜 ι₁ ι₂ E F : Type*} variable [RCLike 𝕜] [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] [NormedAddCommGroup F] [InnerProductSpace 𝕜 F] namespace WithLp variable (E F) noncomputable instance instProdInnerProductSpace : InnerProductSpace 𝕜 (WithLp 2 (E × F)) where inner x y := inner x.fst y.fst + inner x.snd y.snd norm_sq_eq_inner x := by simp [prod_norm_sq_eq_of_L2, ← norm_sq_eq_inner] conj_symm x y := by simp add_left x y z := by simp only [add_fst, add_snd, inner_add_left] ring smul_left x y r := by simp only [smul_fst, inner_smul_left, smul_snd] ring variable {E F} @[simp] theorem prod_inner_apply (x y : WithLp 2 (E × F)) : inner (𝕜 := 𝕜) x y = inner x.fst y.fst + inner x.snd y.snd := rfl end WithLp noncomputable section namespace OrthonormalBasis variable [Fintype ι₁] [Fintype ι₂] /-- The product of two orthonormal bases is a basis for the L2-product. -/ def prod (v : OrthonormalBasis ι₁ 𝕜 E) (w : OrthonormalBasis ι₂ 𝕜 F) : OrthonormalBasis (ι₁ ⊕ ι₂) 𝕜 (WithLp 2 (E × F)) := ((v.toBasis.prod w.toBasis).map (WithLp.linearEquiv 2 𝕜 (E × F)).symm).toOrthonormalBasis (by constructor · simp only [Sum.forall, norm_eq_sqrt_inner (𝕜 := 𝕜), Real.sqrt_eq_one] simp [← Real.sqrt_eq_one, ← norm_eq_sqrt_inner (𝕜 := 𝕜), v.orthonormal.1, w.orthonormal.1] · unfold Pairwise simp only [ne_eq, Basis.map_apply, Basis.prod_apply, LinearMap.coe_inl, OrthonormalBasis.coe_toBasis, LinearMap.coe_inr, WithLp.linearEquiv_symm_apply, WithLp.prod_inner_apply, WithLp.equiv_symm_fst, WithLp.equiv_symm_snd, Sum.forall, Sum.elim_inl, Function.comp_apply, inner_zero_right, add_zero, Sum.elim_inr, zero_add, Sum.inl.injEq, not_false_eq_true, inner_zero_left, forall_true_left, implies_true, and_true, Sum.inr.injEq, true_and] exact ⟨v.orthonormal.2, w.orthonormal.2⟩) @[simp] theorem prod_apply (v : OrthonormalBasis ι₁ 𝕜 E) (w : OrthonormalBasis ι₂ 𝕜 F) : ∀ i : ι₁ ⊕ ι₂, v.prod w i = Sum.elim ((LinearMap.inl 𝕜 E F) ∘ v) ((LinearMap.inr 𝕜 E F) ∘ w) i := by rw [Sum.forall] unfold OrthonormalBasis.prod aesop end OrthonormalBasis end
Analysis\InnerProductSpace\Projection.lean
/- Copyright (c) 2019 Zhouhang Zhou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Zhouhang Zhou, Frédéric Dupuis, Heather Macbeth -/ import Mathlib.Analysis.Convex.Basic import Mathlib.Analysis.InnerProductSpace.Orthogonal import Mathlib.Analysis.InnerProductSpace.Symmetric import Mathlib.Analysis.NormedSpace.RCLike import Mathlib.Analysis.RCLike.Lemmas import Mathlib.Algebra.DirectSum.Decomposition /-! # The orthogonal projection Given a nonempty complete subspace `K` of an inner product space `E`, this file constructs `orthogonalProjection K : E →L[𝕜] K`, the orthogonal projection of `E` onto `K`. This map satisfies: for any point `u` in `E`, the point `v = orthogonalProjection K u` in `K` minimizes the distance `‖u - v‖` to `u`. Also a linear isometry equivalence `reflection K : E ≃ₗᵢ[𝕜] E` is constructed, by choosing, for each `u : E`, the point `reflection K u` to satisfy `u + (reflection K u) = 2 • orthogonalProjection K u`. Basic API for `orthogonalProjection` and `reflection` is developed. Next, the orthogonal projection is used to prove a series of more subtle lemmas about the orthogonal complement of complete subspaces of `E` (the orthogonal complement itself was defined in `Analysis.InnerProductSpace.Orthogonal`); the lemma `Submodule.sup_orthogonal_of_completeSpace`, stating that for a complete subspace `K` of `E` we have `K ⊔ Kᗮ = ⊤`, is a typical example. ## References The orthogonal projection construction is adapted from * [Clément & Martin, *The Lax-Milgram Theorem. A detailed proof to be formalized in Coq*] * [Clément & Martin, *A Coq formal proof of the Lax–Milgram theorem*] The Coq code is available at the following address: <http://www.lri.fr/~sboldo/elfic/index.html> -/ noncomputable section open RCLike Real Filter open LinearMap (ker range) open Topology variable {𝕜 E F : Type*} [RCLike 𝕜] variable [NormedAddCommGroup E] [NormedAddCommGroup F] variable [InnerProductSpace 𝕜 E] [InnerProductSpace ℝ F] local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y local notation "absR" => abs /-! ### Orthogonal projection in inner product spaces -/ -- FIXME this monolithic proof causes a deterministic timeout with `-T50000` -- It should be broken in a sequence of more manageable pieces, -- perhaps with individual statements for the three steps below. /-- Existence of minimizers Let `u` be a point in a real inner product space, and let `K` be a nonempty complete convex subset. Then there exists a (unique) `v` in `K` that minimizes the distance `‖u - v‖` to `u`. -/ theorem exists_norm_eq_iInf_of_complete_convex {K : Set F} (ne : K.Nonempty) (h₁ : IsComplete K) (h₂ : Convex ℝ K) : ∀ u : F, ∃ v ∈ K, ‖u - v‖ = ⨅ w : K, ‖u - w‖ := fun u => by let δ := ⨅ w : K, ‖u - w‖ letI : Nonempty K := ne.to_subtype have zero_le_δ : 0 ≤ δ := le_ciInf fun _ => norm_nonneg _ have δ_le : ∀ w : K, δ ≤ ‖u - w‖ := ciInf_le ⟨0, Set.forall_mem_range.2 fun _ => norm_nonneg _⟩ have δ_le' : ∀ w ∈ K, δ ≤ ‖u - w‖ := fun w hw => δ_le ⟨w, hw⟩ -- Step 1: since `δ` is the infimum, can find a sequence `w : ℕ → K` in `K` -- such that `‖u - w n‖ < δ + 1 / (n + 1)` (which implies `‖u - w n‖ --> δ`); -- maybe this should be a separate lemma have exists_seq : ∃ w : ℕ → K, ∀ n, ‖u - w n‖ < δ + 1 / (n + 1) := by have hδ : ∀ n : ℕ, δ < δ + 1 / (n + 1) := fun n => lt_add_of_le_of_pos le_rfl Nat.one_div_pos_of_nat have h := fun n => exists_lt_of_ciInf_lt (hδ n) let w : ℕ → K := fun n => Classical.choose (h n) exact ⟨w, fun n => Classical.choose_spec (h n)⟩ rcases exists_seq with ⟨w, hw⟩ have norm_tendsto : Tendsto (fun n => ‖u - w n‖) atTop (𝓝 δ) := by have h : Tendsto (fun _ : ℕ => δ) atTop (𝓝 δ) := tendsto_const_nhds have h' : Tendsto (fun n : ℕ => δ + 1 / (n + 1)) atTop (𝓝 δ) := by convert h.add tendsto_one_div_add_atTop_nhds_zero_nat simp only [add_zero] exact tendsto_of_tendsto_of_tendsto_of_le_of_le h h' (fun x => δ_le _) fun x => le_of_lt (hw _) -- Step 2: Prove that the sequence `w : ℕ → K` is a Cauchy sequence have seq_is_cauchy : CauchySeq fun n => (w n : F) := by rw [cauchySeq_iff_le_tendsto_0] -- splits into three goals let b := fun n : ℕ => 8 * δ * (1 / (n + 1)) + 4 * (1 / (n + 1)) * (1 / (n + 1)) use fun n => √(b n) constructor -- first goal : `∀ (n : ℕ), 0 ≤ √(b n)` · intro n exact sqrt_nonneg _ constructor -- second goal : `∀ (n m N : ℕ), N ≤ n → N ≤ m → dist ↑(w n) ↑(w m) ≤ √(b N)` · intro p q N hp hq let wp := (w p : F) let wq := (w q : F) let a := u - wq let b := u - wp let half := 1 / (2 : ℝ) let div := 1 / ((N : ℝ) + 1) have : 4 * ‖u - half • (wq + wp)‖ * ‖u - half • (wq + wp)‖ + ‖wp - wq‖ * ‖wp - wq‖ = 2 * (‖a‖ * ‖a‖ + ‖b‖ * ‖b‖) := calc 4 * ‖u - half • (wq + wp)‖ * ‖u - half • (wq + wp)‖ + ‖wp - wq‖ * ‖wp - wq‖ = 2 * ‖u - half • (wq + wp)‖ * (2 * ‖u - half • (wq + wp)‖) + ‖wp - wq‖ * ‖wp - wq‖ := by ring _ = absR (2 : ℝ) * ‖u - half • (wq + wp)‖ * (absR (2 : ℝ) * ‖u - half • (wq + wp)‖) + ‖wp - wq‖ * ‖wp - wq‖ := by rw [_root_.abs_of_nonneg] exact zero_le_two _ = ‖(2 : ℝ) • (u - half • (wq + wp))‖ * ‖(2 : ℝ) • (u - half • (wq + wp))‖ + ‖wp - wq‖ * ‖wp - wq‖ := by simp [norm_smul] _ = ‖a + b‖ * ‖a + b‖ + ‖a - b‖ * ‖a - b‖ := by rw [smul_sub, smul_smul, mul_one_div_cancel (_root_.two_ne_zero : (2 : ℝ) ≠ 0), ← one_add_one_eq_two, add_smul] simp only [one_smul] have eq₁ : wp - wq = a - b := (sub_sub_sub_cancel_left _ _ _).symm have eq₂ : u + u - (wq + wp) = a + b := by show u + u - (wq + wp) = u - wq + (u - wp) abel rw [eq₁, eq₂] _ = 2 * (‖a‖ * ‖a‖ + ‖b‖ * ‖b‖) := parallelogram_law_with_norm ℝ _ _ have eq : δ ≤ ‖u - half • (wq + wp)‖ := by rw [smul_add] apply δ_le' apply h₂ repeat' exact Subtype.mem _ repeat' exact le_of_lt one_half_pos exact add_halves 1 have eq₁ : 4 * δ * δ ≤ 4 * ‖u - half • (wq + wp)‖ * ‖u - half • (wq + wp)‖ := by simp_rw [mul_assoc] gcongr have eq₂ : ‖a‖ ≤ δ + div := le_trans (le_of_lt <| hw q) (add_le_add_left (Nat.one_div_le_one_div hq) _) have eq₂' : ‖b‖ ≤ δ + div := le_trans (le_of_lt <| hw p) (add_le_add_left (Nat.one_div_le_one_div hp) _) rw [dist_eq_norm] apply nonneg_le_nonneg_of_sq_le_sq · exact sqrt_nonneg _ rw [mul_self_sqrt] · calc ‖wp - wq‖ * ‖wp - wq‖ = 2 * (‖a‖ * ‖a‖ + ‖b‖ * ‖b‖) - 4 * ‖u - half • (wq + wp)‖ * ‖u - half • (wq + wp)‖ := by simp [← this] _ ≤ 2 * (‖a‖ * ‖a‖ + ‖b‖ * ‖b‖) - 4 * δ * δ := by gcongr _ ≤ 2 * ((δ + div) * (δ + div) + (δ + div) * (δ + div)) - 4 * δ * δ := by gcongr _ = 8 * δ * div + 4 * div * div := by ring positivity -- third goal : `Tendsto (fun (n : ℕ) => √(b n)) atTop (𝓝 0)` suffices Tendsto (fun x ↦ √(8 * δ * x + 4 * x * x) : ℝ → ℝ) (𝓝 0) (𝓝 0) from this.comp tendsto_one_div_add_atTop_nhds_zero_nat exact Continuous.tendsto' (by fun_prop) _ _ (by simp) -- Step 3: By completeness of `K`, let `w : ℕ → K` converge to some `v : K`. -- Prove that it satisfies all requirements. rcases cauchySeq_tendsto_of_isComplete h₁ (fun n => Subtype.mem _) seq_is_cauchy with ⟨v, hv, w_tendsto⟩ use v use hv have h_cont : Continuous fun v => ‖u - v‖ := Continuous.comp continuous_norm (Continuous.sub continuous_const continuous_id) have : Tendsto (fun n => ‖u - w n‖) atTop (𝓝 ‖u - v‖) := by convert Tendsto.comp h_cont.continuousAt w_tendsto exact tendsto_nhds_unique this norm_tendsto /-- Characterization of minimizers for the projection on a convex set in a real inner product space. -/ theorem norm_eq_iInf_iff_real_inner_le_zero {K : Set F} (h : Convex ℝ K) {u : F} {v : F} (hv : v ∈ K) : (‖u - v‖ = ⨅ w : K, ‖u - w‖) ↔ ∀ w ∈ K, ⟪u - v, w - v⟫_ℝ ≤ 0 := by letI : Nonempty K := ⟨⟨v, hv⟩⟩ constructor · intro eq w hw let δ := ⨅ w : K, ‖u - w‖ let p := ⟪u - v, w - v⟫_ℝ let q := ‖w - v‖ ^ 2 have δ_le (w : K) : δ ≤ ‖u - w‖ := ciInf_le ⟨0, fun _ ⟨_, h⟩ => h ▸ norm_nonneg _⟩ _ have δ_le' (w) (hw : w ∈ K) : δ ≤ ‖u - w‖ := δ_le ⟨w, hw⟩ have (θ : ℝ) (hθ₁ : 0 < θ) (hθ₂ : θ ≤ 1) : 2 * p ≤ θ * q := by have : ‖u - v‖ ^ 2 ≤ ‖u - v‖ ^ 2 - 2 * θ * ⟪u - v, w - v⟫_ℝ + θ * θ * ‖w - v‖ ^ 2 := calc ‖u - v‖ ^ 2 _ ≤ ‖u - (θ • w + (1 - θ) • v)‖ ^ 2 := by simp only [sq]; apply mul_self_le_mul_self (norm_nonneg _) rw [eq]; apply δ_le' apply h hw hv exacts [le_of_lt hθ₁, sub_nonneg.2 hθ₂, add_sub_cancel _ _] _ = ‖u - v - θ • (w - v)‖ ^ 2 := by have : u - (θ • w + (1 - θ) • v) = u - v - θ • (w - v) := by rw [smul_sub, sub_smul, one_smul] simp only [sub_eq_add_neg, add_comm, add_left_comm, add_assoc, neg_add_rev] rw [this] _ = ‖u - v‖ ^ 2 - 2 * θ * inner (u - v) (w - v) + θ * θ * ‖w - v‖ ^ 2 := by rw [@norm_sub_sq ℝ, inner_smul_right, norm_smul] simp only [sq] show ‖u - v‖ * ‖u - v‖ - 2 * (θ * inner (u - v) (w - v)) + absR θ * ‖w - v‖ * (absR θ * ‖w - v‖) = ‖u - v‖ * ‖u - v‖ - 2 * θ * inner (u - v) (w - v) + θ * θ * (‖w - v‖ * ‖w - v‖) rw [abs_of_pos hθ₁]; ring have eq₁ : ‖u - v‖ ^ 2 - 2 * θ * inner (u - v) (w - v) + θ * θ * ‖w - v‖ ^ 2 = ‖u - v‖ ^ 2 + (θ * θ * ‖w - v‖ ^ 2 - 2 * θ * inner (u - v) (w - v)) := by abel rw [eq₁, le_add_iff_nonneg_right] at this have eq₂ : θ * θ * ‖w - v‖ ^ 2 - 2 * θ * inner (u - v) (w - v) = θ * (θ * ‖w - v‖ ^ 2 - 2 * inner (u - v) (w - v)) := by ring rw [eq₂] at this have := le_of_sub_nonneg (nonneg_of_mul_nonneg_right this hθ₁) exact this by_cases hq : q = 0 · rw [hq] at this have : p ≤ 0 := by have := this (1 : ℝ) (by norm_num) (by norm_num) linarith exact this · have q_pos : 0 < q := lt_of_le_of_ne (sq_nonneg _) fun h ↦ hq h.symm by_contra hp rw [not_le] at hp let θ := min (1 : ℝ) (p / q) have eq₁ : θ * q ≤ p := calc θ * q ≤ p / q * q := mul_le_mul_of_nonneg_right (min_le_right _ _) (sq_nonneg _) _ = p := div_mul_cancel₀ _ hq have : 2 * p ≤ p := calc 2 * p ≤ θ * q := by exact this θ (lt_min (by norm_num) (div_pos hp q_pos)) (by norm_num [θ]) _ ≤ p := eq₁ linarith · intro h apply le_antisymm · apply le_ciInf intro w apply nonneg_le_nonneg_of_sq_le_sq (norm_nonneg _) have := h w w.2 calc ‖u - v‖ * ‖u - v‖ ≤ ‖u - v‖ * ‖u - v‖ - 2 * inner (u - v) ((w : F) - v) := by linarith _ ≤ ‖u - v‖ ^ 2 - 2 * inner (u - v) ((w : F) - v) + ‖(w : F) - v‖ ^ 2 := by rw [sq] refine le_add_of_nonneg_right ?_ exact sq_nonneg _ _ = ‖u - v - (w - v)‖ ^ 2 := (@norm_sub_sq ℝ _ _ _ _ _ _).symm _ = ‖u - w‖ * ‖u - w‖ := by have : u - v - (w - v) = u - w := by abel rw [this, sq] · show ⨅ w : K, ‖u - w‖ ≤ (fun w : K => ‖u - w‖) ⟨v, hv⟩ apply ciInf_le use 0 rintro y ⟨z, rfl⟩ exact norm_nonneg _ variable (K : Submodule 𝕜 E) /-- Existence of projections on complete subspaces. Let `u` be a point in an inner product space, and let `K` be a nonempty complete subspace. Then there exists a (unique) `v` in `K` that minimizes the distance `‖u - v‖` to `u`. This point `v` is usually called the orthogonal projection of `u` onto `K`. -/ theorem exists_norm_eq_iInf_of_complete_subspace (h : IsComplete (↑K : Set E)) : ∀ u : E, ∃ v ∈ K, ‖u - v‖ = ⨅ w : (K : Set E), ‖u - w‖ := by letI : InnerProductSpace ℝ E := InnerProductSpace.rclikeToReal 𝕜 E letI : Module ℝ E := RestrictScalars.module ℝ 𝕜 E let K' : Submodule ℝ E := Submodule.restrictScalars ℝ K exact exists_norm_eq_iInf_of_complete_convex ⟨0, K'.zero_mem⟩ h K'.convex /-- Characterization of minimizers in the projection on a subspace, in the real case. Let `u` be a point in a real inner product space, and let `K` be a nonempty subspace. Then point `v` minimizes the distance `‖u - v‖` over points in `K` if and only if for all `w ∈ K`, `⟪u - v, w⟫ = 0` (i.e., `u - v` is orthogonal to the subspace `K`). This is superceded by `norm_eq_iInf_iff_inner_eq_zero` that gives the same conclusion over any `RCLike` field. -/ theorem norm_eq_iInf_iff_real_inner_eq_zero (K : Submodule ℝ F) {u : F} {v : F} (hv : v ∈ K) : (‖u - v‖ = ⨅ w : (↑K : Set F), ‖u - w‖) ↔ ∀ w ∈ K, ⟪u - v, w⟫_ℝ = 0 := Iff.intro (by intro h have h : ∀ w ∈ K, ⟪u - v, w - v⟫_ℝ ≤ 0 := by rwa [norm_eq_iInf_iff_real_inner_le_zero] at h exacts [K.convex, hv] intro w hw have le : ⟪u - v, w⟫_ℝ ≤ 0 := by let w' := w + v have : w' ∈ K := Submodule.add_mem _ hw hv have h₁ := h w' this have h₂ : w' - v = w := by simp only [w', add_neg_cancel_right, sub_eq_add_neg] rw [h₂] at h₁ exact h₁ have ge : ⟪u - v, w⟫_ℝ ≥ 0 := by let w'' := -w + v have : w'' ∈ K := Submodule.add_mem _ (Submodule.neg_mem _ hw) hv have h₁ := h w'' this have h₂ : w'' - v = -w := by simp only [w'', neg_inj, add_neg_cancel_right, sub_eq_add_neg] rw [h₂, inner_neg_right] at h₁ linarith exact le_antisymm le ge) (by intro h have : ∀ w ∈ K, ⟪u - v, w - v⟫_ℝ ≤ 0 := by intro w hw let w' := w - v have : w' ∈ K := Submodule.sub_mem _ hw hv have h₁ := h w' this exact le_of_eq h₁ rwa [norm_eq_iInf_iff_real_inner_le_zero] exacts [Submodule.convex _, hv]) /-- Characterization of minimizers in the projection on a subspace. Let `u` be a point in an inner product space, and let `K` be a nonempty subspace. Then point `v` minimizes the distance `‖u - v‖` over points in `K` if and only if for all `w ∈ K`, `⟪u - v, w⟫ = 0` (i.e., `u - v` is orthogonal to the subspace `K`) -/ theorem norm_eq_iInf_iff_inner_eq_zero {u : E} {v : E} (hv : v ∈ K) : (‖u - v‖ = ⨅ w : K, ‖u - w‖) ↔ ∀ w ∈ K, ⟪u - v, w⟫ = 0 := by letI : InnerProductSpace ℝ E := InnerProductSpace.rclikeToReal 𝕜 E letI : Module ℝ E := RestrictScalars.module ℝ 𝕜 E let K' : Submodule ℝ E := K.restrictScalars ℝ constructor · intro H have A : ∀ w ∈ K, re ⟪u - v, w⟫ = 0 := (norm_eq_iInf_iff_real_inner_eq_zero K' hv).1 H intro w hw apply ext · simp [A w hw] · symm calc im (0 : 𝕜) = 0 := im.map_zero _ = re ⟪u - v, (-I : 𝕜) • w⟫ := (A _ (K.smul_mem (-I) hw)).symm _ = re (-I * ⟪u - v, w⟫) := by rw [inner_smul_right] _ = im ⟪u - v, w⟫ := by simp · intro H have : ∀ w ∈ K', ⟪u - v, w⟫_ℝ = 0 := by intro w hw rw [real_inner_eq_re_inner, H w hw] exact zero_re' exact (norm_eq_iInf_iff_real_inner_eq_zero K' hv).2 this /-- A subspace `K : Submodule 𝕜 E` has an orthogonal projection if evey vector `v : E` admits an orthogonal projection to `K`. -/ class HasOrthogonalProjection (K : Submodule 𝕜 E) : Prop where exists_orthogonal (v : E) : ∃ w ∈ K, v - w ∈ Kᗮ instance (priority := 100) HasOrthogonalProjection.ofCompleteSpace [CompleteSpace K] : HasOrthogonalProjection K where exists_orthogonal v := by rcases exists_norm_eq_iInf_of_complete_subspace K (completeSpace_coe_iff_isComplete.mp ‹_›) v with ⟨w, hwK, hw⟩ refine ⟨w, hwK, (K.mem_orthogonal' _).2 ?_⟩ rwa [← norm_eq_iInf_iff_inner_eq_zero K hwK] instance [HasOrthogonalProjection K] : HasOrthogonalProjection Kᗮ where exists_orthogonal v := by rcases HasOrthogonalProjection.exists_orthogonal (K := K) v with ⟨w, hwK, hw⟩ refine ⟨_, hw, ?_⟩ rw [sub_sub_cancel] exact K.le_orthogonal_orthogonal hwK instance HasOrthogonalProjection.map_linearIsometryEquiv [HasOrthogonalProjection K] {E' : Type*} [NormedAddCommGroup E'] [InnerProductSpace 𝕜 E'] (f : E ≃ₗᵢ[𝕜] E') : HasOrthogonalProjection (K.map (f.toLinearEquiv : E →ₗ[𝕜] E')) where exists_orthogonal v := by rcases HasOrthogonalProjection.exists_orthogonal (K := K) (f.symm v) with ⟨w, hwK, hw⟩ refine ⟨f w, Submodule.mem_map_of_mem hwK, Set.forall_mem_image.2 fun u hu ↦ ?_⟩ erw [← f.symm.inner_map_map, f.symm_apply_apply, map_sub, f.symm_apply_apply, hw u hu] instance HasOrthogonalProjection.map_linearIsometryEquiv' [HasOrthogonalProjection K] {E' : Type*} [NormedAddCommGroup E'] [InnerProductSpace 𝕜 E'] (f : E ≃ₗᵢ[𝕜] E') : HasOrthogonalProjection (K.map f.toLinearIsometry) := HasOrthogonalProjection.map_linearIsometryEquiv K f instance : HasOrthogonalProjection (⊤ : Submodule 𝕜 E) := ⟨fun v ↦ ⟨v, trivial, by simp⟩⟩ section orthogonalProjection variable [HasOrthogonalProjection K] /-- The orthogonal projection onto a complete subspace, as an unbundled function. This definition is only intended for use in setting up the bundled version `orthogonalProjection` and should not be used once that is defined. -/ def orthogonalProjectionFn (v : E) := (HasOrthogonalProjection.exists_orthogonal (K := K) v).choose variable {K} /-- The unbundled orthogonal projection is in the given subspace. This lemma is only intended for use in setting up the bundled version and should not be used once that is defined. -/ theorem orthogonalProjectionFn_mem (v : E) : orthogonalProjectionFn K v ∈ K := (HasOrthogonalProjection.exists_orthogonal (K := K) v).choose_spec.left /-- The characterization of the unbundled orthogonal projection. This lemma is only intended for use in setting up the bundled version and should not be used once that is defined. -/ theorem orthogonalProjectionFn_inner_eq_zero (v : E) : ∀ w ∈ K, ⟪v - orthogonalProjectionFn K v, w⟫ = 0 := (K.mem_orthogonal' _).1 (HasOrthogonalProjection.exists_orthogonal (K := K) v).choose_spec.right /-- The unbundled orthogonal projection is the unique point in `K` with the orthogonality property. This lemma is only intended for use in setting up the bundled version and should not be used once that is defined. -/ theorem eq_orthogonalProjectionFn_of_mem_of_inner_eq_zero {u v : E} (hvm : v ∈ K) (hvo : ∀ w ∈ K, ⟪u - v, w⟫ = 0) : orthogonalProjectionFn K u = v := by rw [← sub_eq_zero, ← @inner_self_eq_zero 𝕜] have hvs : orthogonalProjectionFn K u - v ∈ K := Submodule.sub_mem K (orthogonalProjectionFn_mem u) hvm have huo : ⟪u - orthogonalProjectionFn K u, orthogonalProjectionFn K u - v⟫ = 0 := orthogonalProjectionFn_inner_eq_zero u _ hvs have huv : ⟪u - v, orthogonalProjectionFn K u - v⟫ = 0 := hvo _ hvs have houv : ⟪u - v - (u - orthogonalProjectionFn K u), orthogonalProjectionFn K u - v⟫ = 0 := by rw [inner_sub_left, huo, huv, sub_zero] rwa [sub_sub_sub_cancel_left] at houv variable (K) theorem orthogonalProjectionFn_norm_sq (v : E) : ‖v‖ * ‖v‖ = ‖v - orthogonalProjectionFn K v‖ * ‖v - orthogonalProjectionFn K v‖ + ‖orthogonalProjectionFn K v‖ * ‖orthogonalProjectionFn K v‖ := by set p := orthogonalProjectionFn K v have h' : ⟪v - p, p⟫ = 0 := orthogonalProjectionFn_inner_eq_zero _ _ (orthogonalProjectionFn_mem v) convert norm_add_sq_eq_norm_sq_add_norm_sq_of_inner_eq_zero (v - p) p h' using 2 <;> simp /-- The orthogonal projection onto a complete subspace. -/ def orthogonalProjection : E →L[𝕜] K := LinearMap.mkContinuous { toFun := fun v => ⟨orthogonalProjectionFn K v, orthogonalProjectionFn_mem v⟩ map_add' := fun x y => by have hm : orthogonalProjectionFn K x + orthogonalProjectionFn K y ∈ K := Submodule.add_mem K (orthogonalProjectionFn_mem x) (orthogonalProjectionFn_mem y) have ho : ∀ w ∈ K, ⟪x + y - (orthogonalProjectionFn K x + orthogonalProjectionFn K y), w⟫ = 0 := by intro w hw rw [add_sub_add_comm, inner_add_left, orthogonalProjectionFn_inner_eq_zero _ w hw, orthogonalProjectionFn_inner_eq_zero _ w hw, add_zero] ext simp [eq_orthogonalProjectionFn_of_mem_of_inner_eq_zero hm ho] map_smul' := fun c x => by have hm : c • orthogonalProjectionFn K x ∈ K := Submodule.smul_mem K _ (orthogonalProjectionFn_mem x) have ho : ∀ w ∈ K, ⟪c • x - c • orthogonalProjectionFn K x, w⟫ = 0 := by intro w hw rw [← smul_sub, inner_smul_left, orthogonalProjectionFn_inner_eq_zero _ w hw, mul_zero] ext simp [eq_orthogonalProjectionFn_of_mem_of_inner_eq_zero hm ho] } 1 fun x => by simp only [one_mul, LinearMap.coe_mk] refine le_of_pow_le_pow_left two_ne_zero (norm_nonneg _) ?_ change ‖orthogonalProjectionFn K x‖ ^ 2 ≤ ‖x‖ ^ 2 nlinarith [orthogonalProjectionFn_norm_sq K x] variable {K} @[simp] theorem orthogonalProjectionFn_eq (v : E) : orthogonalProjectionFn K v = (orthogonalProjection K v : E) := rfl /-- The characterization of the orthogonal projection. -/ @[simp] theorem orthogonalProjection_inner_eq_zero (v : E) : ∀ w ∈ K, ⟪v - orthogonalProjection K v, w⟫ = 0 := orthogonalProjectionFn_inner_eq_zero v /-- The difference of `v` from its orthogonal projection onto `K` is in `Kᗮ`. -/ @[simp] theorem sub_orthogonalProjection_mem_orthogonal (v : E) : v - orthogonalProjection K v ∈ Kᗮ := by intro w hw rw [inner_eq_zero_symm] exact orthogonalProjection_inner_eq_zero _ _ hw /-- The orthogonal projection is the unique point in `K` with the orthogonality property. -/ theorem eq_orthogonalProjection_of_mem_of_inner_eq_zero {u v : E} (hvm : v ∈ K) (hvo : ∀ w ∈ K, ⟪u - v, w⟫ = 0) : (orthogonalProjection K u : E) = v := eq_orthogonalProjectionFn_of_mem_of_inner_eq_zero hvm hvo /-- A point in `K` with the orthogonality property (here characterized in terms of `Kᗮ`) must be the orthogonal projection. -/ theorem eq_orthogonalProjection_of_mem_orthogonal {u v : E} (hv : v ∈ K) (hvo : u - v ∈ Kᗮ) : (orthogonalProjection K u : E) = v := eq_orthogonalProjectionFn_of_mem_of_inner_eq_zero hv <| (Submodule.mem_orthogonal' _ _).1 hvo /-- A point in `K` with the orthogonality property (here characterized in terms of `Kᗮ`) must be the orthogonal projection. -/ theorem eq_orthogonalProjection_of_mem_orthogonal' {u v z : E} (hv : v ∈ K) (hz : z ∈ Kᗮ) (hu : u = v + z) : (orthogonalProjection K u : E) = v := eq_orthogonalProjection_of_mem_orthogonal hv (by simpa [hu] ) @[simp] theorem orthogonalProjection_orthogonal_val (u : E) : (orthogonalProjection Kᗮ u : E) = u - orthogonalProjection K u := eq_orthogonalProjection_of_mem_orthogonal' (sub_orthogonalProjection_mem_orthogonal _) (K.le_orthogonal_orthogonal (orthogonalProjection K u).2) <| by simp theorem orthogonalProjection_orthogonal (u : E) : orthogonalProjection Kᗮ u = ⟨u - orthogonalProjection K u, sub_orthogonalProjection_mem_orthogonal _⟩ := Subtype.eq <| orthogonalProjection_orthogonal_val _ /-- The orthogonal projection of `y` on `U` minimizes the distance `‖y - x‖` for `x ∈ U`. -/ theorem orthogonalProjection_minimal {U : Submodule 𝕜 E} [HasOrthogonalProjection U] (y : E) : ‖y - orthogonalProjection U y‖ = ⨅ x : U, ‖y - x‖ := by rw [norm_eq_iInf_iff_inner_eq_zero _ (Submodule.coe_mem _)] exact orthogonalProjection_inner_eq_zero _ /-- The orthogonal projections onto equal subspaces are coerced back to the same point in `E`. -/ theorem eq_orthogonalProjection_of_eq_submodule {K' : Submodule 𝕜 E} [HasOrthogonalProjection K'] (h : K = K') (u : E) : (orthogonalProjection K u : E) = (orthogonalProjection K' u : E) := by subst h; rfl /-- The orthogonal projection sends elements of `K` to themselves. -/ @[simp] theorem orthogonalProjection_mem_subspace_eq_self (v : K) : orthogonalProjection K v = v := by ext apply eq_orthogonalProjection_of_mem_of_inner_eq_zero <;> simp /-- A point equals its orthogonal projection if and only if it lies in the subspace. -/ theorem orthogonalProjection_eq_self_iff {v : E} : (orthogonalProjection K v : E) = v ↔ v ∈ K := by refine ⟨fun h => ?_, fun h => eq_orthogonalProjection_of_mem_of_inner_eq_zero h ?_⟩ · rw [← h] simp · simp @[simp] theorem orthogonalProjection_eq_zero_iff {v : E} : orthogonalProjection K v = 0 ↔ v ∈ Kᗮ := by refine ⟨fun h ↦ ?_, fun h ↦ Subtype.eq <| eq_orthogonalProjection_of_mem_orthogonal (zero_mem _) ?_⟩ · simpa [h] using sub_orthogonalProjection_mem_orthogonal (K := K) v · simpa @[simp] theorem ker_orthogonalProjection : LinearMap.ker (orthogonalProjection K) = Kᗮ := by ext; exact orthogonalProjection_eq_zero_iff theorem LinearIsometry.map_orthogonalProjection {E E' : Type*} [NormedAddCommGroup E] [NormedAddCommGroup E'] [InnerProductSpace 𝕜 E] [InnerProductSpace 𝕜 E'] (f : E →ₗᵢ[𝕜] E') (p : Submodule 𝕜 E) [HasOrthogonalProjection p] [HasOrthogonalProjection (p.map f.toLinearMap)] (x : E) : f (orthogonalProjection p x) = orthogonalProjection (p.map f.toLinearMap) (f x) := by refine (eq_orthogonalProjection_of_mem_of_inner_eq_zero ?_ fun y hy => ?_).symm · refine Submodule.apply_coe_mem_map _ _ rcases hy with ⟨x', hx', rfl : f x' = y⟩ rw [← f.map_sub, f.inner_map_map, orthogonalProjection_inner_eq_zero x x' hx'] theorem LinearIsometry.map_orthogonalProjection' {E E' : Type*} [NormedAddCommGroup E] [NormedAddCommGroup E'] [InnerProductSpace 𝕜 E] [InnerProductSpace 𝕜 E'] (f : E →ₗᵢ[𝕜] E') (p : Submodule 𝕜 E) [HasOrthogonalProjection p] [HasOrthogonalProjection (p.map f)] (x : E) : f (orthogonalProjection p x) = orthogonalProjection (p.map f) (f x) := have : HasOrthogonalProjection (p.map f.toLinearMap) := ‹_› f.map_orthogonalProjection p x /-- Orthogonal projection onto the `Submodule.map` of a subspace. -/ theorem orthogonalProjection_map_apply {E E' : Type*} [NormedAddCommGroup E] [NormedAddCommGroup E'] [InnerProductSpace 𝕜 E] [InnerProductSpace 𝕜 E'] (f : E ≃ₗᵢ[𝕜] E') (p : Submodule 𝕜 E) [HasOrthogonalProjection p] (x : E') : (orthogonalProjection (p.map (f.toLinearEquiv : E →ₗ[𝕜] E')) x : E') = f (orthogonalProjection p (f.symm x)) := by simpa only [f.coe_toLinearIsometry, f.apply_symm_apply] using (f.toLinearIsometry.map_orthogonalProjection' p (f.symm x)).symm /-- The orthogonal projection onto the trivial submodule is the zero map. -/ @[simp] theorem orthogonalProjection_bot : orthogonalProjection (⊥ : Submodule 𝕜 E) = 0 := by ext variable (K) /-- The orthogonal projection has norm `≤ 1`. -/ theorem orthogonalProjection_norm_le : ‖orthogonalProjection K‖ ≤ 1 := LinearMap.mkContinuous_norm_le _ (by norm_num) _ variable (𝕜) theorem smul_orthogonalProjection_singleton {v : E} (w : E) : ((‖v‖ ^ 2 : ℝ) : 𝕜) • (orthogonalProjection (𝕜 ∙ v) w : E) = ⟪v, w⟫ • v := by suffices ((orthogonalProjection (𝕜 ∙ v) (((‖v‖ : 𝕜) ^ 2) • w)) : E) = ⟪v, w⟫ • v by simpa using this apply eq_orthogonalProjection_of_mem_of_inner_eq_zero · rw [Submodule.mem_span_singleton] use ⟪v, w⟫ · rw [← Submodule.mem_orthogonal', Submodule.mem_orthogonal_singleton_iff_inner_left] simp [inner_sub_left, inner_smul_left, inner_self_eq_norm_sq_to_K, mul_comm] /-- Formula for orthogonal projection onto a single vector. -/ theorem orthogonalProjection_singleton {v : E} (w : E) : (orthogonalProjection (𝕜 ∙ v) w : E) = (⟪v, w⟫ / ((‖v‖ ^ 2 : ℝ) : 𝕜)) • v := by by_cases hv : v = 0 · rw [hv, eq_orthogonalProjection_of_eq_submodule (Submodule.span_zero_singleton 𝕜)] simp have hv' : ‖v‖ ≠ 0 := ne_of_gt (norm_pos_iff.mpr hv) have key : (((‖v‖ ^ 2 : ℝ) : 𝕜)⁻¹ * ((‖v‖ ^ 2 : ℝ) : 𝕜)) • ((orthogonalProjection (𝕜 ∙ v) w) : E) = (((‖v‖ ^ 2 : ℝ) : 𝕜)⁻¹ * ⟪v, w⟫) • v := by simp [mul_smul, smul_orthogonalProjection_singleton 𝕜 w, -map_pow] convert key using 1 <;> field_simp [hv'] /-- Formula for orthogonal projection onto a single unit vector. -/ theorem orthogonalProjection_unit_singleton {v : E} (hv : ‖v‖ = 1) (w : E) : (orthogonalProjection (𝕜 ∙ v) w : E) = ⟪v, w⟫ • v := by rw [← smul_orthogonalProjection_singleton 𝕜 w] simp [hv] end orthogonalProjection section reflection variable [HasOrthogonalProjection K] -- Porting note: `bit0` is deprecated. /-- Auxiliary definition for `reflection`: the reflection as a linear equivalence. -/ def reflectionLinearEquiv : E ≃ₗ[𝕜] E := LinearEquiv.ofInvolutive (2 • (K.subtype.comp (orthogonalProjection K).toLinearMap) - LinearMap.id) fun x => by simp [two_smul] /-- Reflection in a complete subspace of an inner product space. The word "reflection" is sometimes understood to mean specifically reflection in a codimension-one subspace, and sometimes more generally to cover operations such as reflection in a point. The definition here, of reflection in a subspace, is a more general sense of the word that includes both those common cases. -/ def reflection : E ≃ₗᵢ[𝕜] E := { reflectionLinearEquiv K with norm_map' := by intro x dsimp only let w : K := orthogonalProjection K x let v := x - w have : ⟪v, w⟫ = 0 := orthogonalProjection_inner_eq_zero x w w.2 convert norm_sub_eq_norm_add this using 2 · rw [LinearEquiv.coe_mk, reflectionLinearEquiv, LinearEquiv.toFun_eq_coe, LinearEquiv.coe_ofInvolutive, LinearMap.sub_apply, LinearMap.id_apply, two_smul, LinearMap.add_apply, LinearMap.comp_apply, Submodule.subtype_apply, ContinuousLinearMap.coe_coe] dsimp [v] abel · simp only [v, add_sub_cancel, eq_self_iff_true] } variable {K} /-- The result of reflecting. -/ theorem reflection_apply (p : E) : reflection K p = 2 • (orthogonalProjection K p : E) - p := rfl /-- Reflection is its own inverse. -/ @[simp] theorem reflection_symm : (reflection K).symm = reflection K := rfl /-- Reflection is its own inverse. -/ @[simp] theorem reflection_inv : (reflection K)⁻¹ = reflection K := rfl variable (K) /-- Reflecting twice in the same subspace. -/ @[simp] theorem reflection_reflection (p : E) : reflection K (reflection K p) = p := (reflection K).left_inv p /-- Reflection is involutive. -/ theorem reflection_involutive : Function.Involutive (reflection K) := reflection_reflection K /-- Reflection is involutive. -/ @[simp] theorem reflection_trans_reflection : (reflection K).trans (reflection K) = LinearIsometryEquiv.refl 𝕜 E := LinearIsometryEquiv.ext <| reflection_involutive K /-- Reflection is involutive. -/ @[simp] theorem reflection_mul_reflection : reflection K * reflection K = 1 := reflection_trans_reflection _ theorem reflection_orthogonal_apply (v : E) : reflection Kᗮ v = -reflection K v := by simp [reflection_apply]; abel theorem reflection_orthogonal : reflection Kᗮ = .trans (reflection K) (.neg _) := by ext; apply reflection_orthogonal_apply variable {K} theorem reflection_singleton_apply (u v : E) : reflection (𝕜 ∙ u) v = 2 • (⟪u, v⟫ / ((‖u‖ : 𝕜) ^ 2)) • u - v := by rw [reflection_apply, orthogonalProjection_singleton, ofReal_pow] /-- A point is its own reflection if and only if it is in the subspace. -/ theorem reflection_eq_self_iff (x : E) : reflection K x = x ↔ x ∈ K := by rw [← orthogonalProjection_eq_self_iff, reflection_apply, sub_eq_iff_eq_add', ← two_smul 𝕜, two_smul ℕ, ← two_smul 𝕜] refine (smul_right_injective E ?_).eq_iff exact two_ne_zero theorem reflection_mem_subspace_eq_self {x : E} (hx : x ∈ K) : reflection K x = x := (reflection_eq_self_iff x).mpr hx /-- Reflection in the `Submodule.map` of a subspace. -/ theorem reflection_map_apply {E E' : Type*} [NormedAddCommGroup E] [NormedAddCommGroup E'] [InnerProductSpace 𝕜 E] [InnerProductSpace 𝕜 E'] (f : E ≃ₗᵢ[𝕜] E') (K : Submodule 𝕜 E) [HasOrthogonalProjection K] (x : E') : reflection (K.map (f.toLinearEquiv : E →ₗ[𝕜] E')) x = f (reflection K (f.symm x)) := by simp [two_smul, reflection_apply, orthogonalProjection_map_apply f K x] /-- Reflection in the `Submodule.map` of a subspace. -/ theorem reflection_map {E E' : Type*} [NormedAddCommGroup E] [NormedAddCommGroup E'] [InnerProductSpace 𝕜 E] [InnerProductSpace 𝕜 E'] (f : E ≃ₗᵢ[𝕜] E') (K : Submodule 𝕜 E) [HasOrthogonalProjection K] : reflection (K.map (f.toLinearEquiv : E →ₗ[𝕜] E')) = f.symm.trans ((reflection K).trans f) := LinearIsometryEquiv.ext <| reflection_map_apply f K /-- Reflection through the trivial subspace {0} is just negation. -/ @[simp] theorem reflection_bot : reflection (⊥ : Submodule 𝕜 E) = LinearIsometryEquiv.neg 𝕜 := by ext; simp [reflection_apply] end reflection section Orthogonal /-- If `K₁` is complete and contained in `K₂`, `K₁` and `K₁ᗮ ⊓ K₂` span `K₂`. -/ theorem Submodule.sup_orthogonal_inf_of_completeSpace {K₁ K₂ : Submodule 𝕜 E} (h : K₁ ≤ K₂) [HasOrthogonalProjection K₁] : K₁ ⊔ K₁ᗮ ⊓ K₂ = K₂ := by ext x rw [Submodule.mem_sup] let v : K₁ := orthogonalProjection K₁ x have hvm : x - v ∈ K₁ᗮ := sub_orthogonalProjection_mem_orthogonal x constructor · rintro ⟨y, hy, z, hz, rfl⟩ exact K₂.add_mem (h hy) hz.2 · exact fun hx => ⟨v, v.prop, x - v, ⟨hvm, K₂.sub_mem hx (h v.prop)⟩, add_sub_cancel _ _⟩ variable {K} /-- If `K` is complete, `K` and `Kᗮ` span the whole space. -/ theorem Submodule.sup_orthogonal_of_completeSpace [HasOrthogonalProjection K] : K ⊔ Kᗮ = ⊤ := by convert Submodule.sup_orthogonal_inf_of_completeSpace (le_top : K ≤ ⊤) using 2 simp variable (K) /-- If `K` is complete, any `v` in `E` can be expressed as a sum of elements of `K` and `Kᗮ`. -/ theorem Submodule.exists_add_mem_mem_orthogonal [HasOrthogonalProjection K] (v : E) : ∃ y ∈ K, ∃ z ∈ Kᗮ, v = y + z := ⟨orthogonalProjection K v, Subtype.coe_prop _, v - orthogonalProjection K v, sub_orthogonalProjection_mem_orthogonal _, by simp⟩ /-- If `K` admits an orthogonal projection, then the orthogonal complement of its orthogonal complement is itself. -/ @[simp] theorem Submodule.orthogonal_orthogonal [HasOrthogonalProjection K] : Kᗮᗮ = K := by ext v constructor · obtain ⟨y, hy, z, hz, rfl⟩ := K.exists_add_mem_mem_orthogonal v intro hv have hz' : z = 0 := by have hyz : ⟪z, y⟫ = 0 := by simp [hz y hy, inner_eq_zero_symm] simpa [inner_add_right, hyz] using hv z hz simp [hy, hz'] · intro hv w hw rw [inner_eq_zero_symm] exact hw v hv /-- In a Hilbert space, the orthogonal complement of the orthogonal complement of a subspace `K` is the topological closure of `K`. Note that the completeness assumption is necessary. Let `E` be the space `ℕ →₀ ℝ` with inner space structure inherited from `PiLp 2 (fun _ : ℕ ↦ ℝ)`. Let `K` be the subspace of sequences with the sum of all elements equal to zero. Then `Kᗮ = ⊥`, `Kᗮᗮ = ⊤`. -/ theorem Submodule.orthogonal_orthogonal_eq_closure [CompleteSpace E] : Kᗮᗮ = K.topologicalClosure := by refine le_antisymm ?_ ?_ · convert Submodule.orthogonal_orthogonal_monotone K.le_topologicalClosure using 1 rw [K.topologicalClosure.orthogonal_orthogonal] · exact K.topologicalClosure_minimal K.le_orthogonal_orthogonal Kᗮ.isClosed_orthogonal variable {K} /-- If `K` admits an orthogonal projection, `K` and `Kᗮ` are complements of each other. -/ theorem Submodule.isCompl_orthogonal_of_completeSpace [HasOrthogonalProjection K] : IsCompl K Kᗮ := ⟨K.orthogonal_disjoint, codisjoint_iff.2 Submodule.sup_orthogonal_of_completeSpace⟩ @[simp] theorem orthogonalComplement_eq_orthogonalComplement {L : Submodule 𝕜 E} [HasOrthogonalProjection K] [HasOrthogonalProjection L] : Kᗮ = Lᗮ ↔ K = L := ⟨fun h ↦ by simpa using congr(Submodule.orthogonal $(h)), fun h ↦ congr(Submodule.orthogonal $(h))⟩ @[simp] theorem Submodule.orthogonal_eq_bot_iff [HasOrthogonalProjection K] : Kᗮ = ⊥ ↔ K = ⊤ := by refine ⟨?_, fun h => by rw [h, Submodule.top_orthogonal_eq_bot]⟩ intro h have : K ⊔ Kᗮ = ⊤ := Submodule.sup_orthogonal_of_completeSpace rwa [h, sup_comm, bot_sup_eq] at this /-- The orthogonal projection onto `K` of an element of `Kᗮ` is zero. -/ theorem orthogonalProjection_mem_subspace_orthogonalComplement_eq_zero [HasOrthogonalProjection K] {v : E} (hv : v ∈ Kᗮ) : orthogonalProjection K v = 0 := by ext convert eq_orthogonalProjection_of_mem_orthogonal (K := K) _ _ <;> simp [hv] /-- The projection into `U` from an orthogonal submodule `V` is the zero map. -/ theorem Submodule.IsOrtho.orthogonalProjection_comp_subtypeL {U V : Submodule 𝕜 E} [HasOrthogonalProjection U] (h : U ⟂ V) : orthogonalProjection U ∘L V.subtypeL = 0 := ContinuousLinearMap.ext fun v => orthogonalProjection_mem_subspace_orthogonalComplement_eq_zero <| h.symm v.prop /-- The projection into `U` from `V` is the zero map if and only if `U` and `V` are orthogonal. -/ theorem orthogonalProjection_comp_subtypeL_eq_zero_iff {U V : Submodule 𝕜 E} [HasOrthogonalProjection U] : orthogonalProjection U ∘L V.subtypeL = 0 ↔ U ⟂ V := ⟨fun h u hu v hv => by convert orthogonalProjection_inner_eq_zero v u hu using 2 have : orthogonalProjection U v = 0 := DFunLike.congr_fun h (⟨_, hv⟩ : V) rw [this, Submodule.coe_zero, sub_zero], Submodule.IsOrtho.orthogonalProjection_comp_subtypeL⟩ theorem orthogonalProjection_eq_linear_proj [HasOrthogonalProjection K] (x : E) : orthogonalProjection K x = K.linearProjOfIsCompl _ Submodule.isCompl_orthogonal_of_completeSpace x := by have : IsCompl K Kᗮ := Submodule.isCompl_orthogonal_of_completeSpace conv_lhs => rw [← Submodule.linear_proj_add_linearProjOfIsCompl_eq_self this x] rw [map_add, orthogonalProjection_mem_subspace_eq_self, orthogonalProjection_mem_subspace_orthogonalComplement_eq_zero (Submodule.coe_mem _), add_zero] theorem orthogonalProjection_coe_linearMap_eq_linearProj [HasOrthogonalProjection K] : (orthogonalProjection K : E →ₗ[𝕜] K) = K.linearProjOfIsCompl _ Submodule.isCompl_orthogonal_of_completeSpace := LinearMap.ext <| orthogonalProjection_eq_linear_proj /-- The reflection in `K` of an element of `Kᗮ` is its negation. -/ theorem reflection_mem_subspace_orthogonalComplement_eq_neg [HasOrthogonalProjection K] {v : E} (hv : v ∈ Kᗮ) : reflection K v = -v := by simp [reflection_apply, orthogonalProjection_mem_subspace_orthogonalComplement_eq_zero hv] /-- The orthogonal projection onto `Kᗮ` of an element of `K` is zero. -/ theorem orthogonalProjection_mem_subspace_orthogonal_precomplement_eq_zero [HasOrthogonalProjection Kᗮ] {v : E} (hv : v ∈ K) : orthogonalProjection Kᗮ v = 0 := orthogonalProjection_mem_subspace_orthogonalComplement_eq_zero (K.le_orthogonal_orthogonal hv) /-- If `U ≤ V`, then projecting on `V` and then on `U` is the same as projecting on `U`. -/ theorem orthogonalProjection_orthogonalProjection_of_le {U V : Submodule 𝕜 E} [HasOrthogonalProjection U] [HasOrthogonalProjection V] (h : U ≤ V) (x : E) : orthogonalProjection U (orthogonalProjection V x) = orthogonalProjection U x := Eq.symm <| by simpa only [sub_eq_zero, map_sub] using orthogonalProjection_mem_subspace_orthogonalComplement_eq_zero (Submodule.orthogonal_le h (sub_orthogonalProjection_mem_orthogonal x)) /-- Given a monotone family `U` of complete submodules of `E` and a fixed `x : E`, the orthogonal projection of `x` on `U i` tends to the orthogonal projection of `x` on `(⨆ i, U i).topologicalClosure` along `atTop`. -/ theorem orthogonalProjection_tendsto_closure_iSup [CompleteSpace E] {ι : Type*} [SemilatticeSup ι] (U : ι → Submodule 𝕜 E) [∀ i, CompleteSpace (U i)] (hU : Monotone U) (x : E) : Filter.Tendsto (fun i => (orthogonalProjection (U i) x : E)) atTop (𝓝 (orthogonalProjection (⨆ i, U i).topologicalClosure x : E)) := by cases isEmpty_or_nonempty ι · exact tendsto_of_isEmpty let y := (orthogonalProjection (⨆ i, U i).topologicalClosure x : E) have proj_x : ∀ i, orthogonalProjection (U i) x = orthogonalProjection (U i) y := fun i => (orthogonalProjection_orthogonalProjection_of_le ((le_iSup U i).trans (iSup U).le_topologicalClosure) _).symm suffices ∀ ε > 0, ∃ I, ∀ i ≥ I, ‖(orthogonalProjection (U i) y : E) - y‖ < ε by simpa only [proj_x, NormedAddCommGroup.tendsto_atTop] using this intro ε hε obtain ⟨a, ha, hay⟩ : ∃ a ∈ ⨆ i, U i, dist y a < ε := by have y_mem : y ∈ (⨆ i, U i).topologicalClosure := Submodule.coe_mem _ rw [← SetLike.mem_coe, Submodule.topologicalClosure_coe, Metric.mem_closure_iff] at y_mem exact y_mem ε hε rw [dist_eq_norm] at hay obtain ⟨I, hI⟩ : ∃ I, a ∈ U I := by rwa [Submodule.mem_iSup_of_directed _ hU.directed_le] at ha refine ⟨I, fun i (hi : I ≤ i) => ?_⟩ rw [norm_sub_rev, orthogonalProjection_minimal] refine lt_of_le_of_lt ?_ hay change _ ≤ ‖y - (⟨a, hU hi hI⟩ : U i)‖ exact ciInf_le ⟨0, Set.forall_mem_range.mpr fun _ => norm_nonneg _⟩ _ /-- Given a monotone family `U` of complete submodules of `E` with dense span supremum, and a fixed `x : E`, the orthogonal projection of `x` on `U i` tends to `x` along `at_top`. -/ theorem orthogonalProjection_tendsto_self [CompleteSpace E] {ι : Type*} [SemilatticeSup ι] (U : ι → Submodule 𝕜 E) [∀ t, CompleteSpace (U t)] (hU : Monotone U) (x : E) (hU' : ⊤ ≤ (⨆ t, U t).topologicalClosure) : Filter.Tendsto (fun t => (orthogonalProjection (U t) x : E)) atTop (𝓝 x) := by rw [← eq_top_iff] at hU' convert orthogonalProjection_tendsto_closure_iSup U hU x rw [orthogonalProjection_eq_self_iff.mpr _] rw [hU'] trivial /-- The orthogonal complement satisfies `Kᗮᗮᗮ = Kᗮ`. -/ theorem Submodule.triorthogonal_eq_orthogonal [CompleteSpace E] : Kᗮᗮᗮ = Kᗮ := by rw [Kᗮ.orthogonal_orthogonal_eq_closure] exact K.isClosed_orthogonal.submodule_topologicalClosure_eq /-- The closure of `K` is the full space iff `Kᗮ` is trivial. -/ theorem Submodule.topologicalClosure_eq_top_iff [CompleteSpace E] : K.topologicalClosure = ⊤ ↔ Kᗮ = ⊥ := by rw [← Submodule.orthogonal_orthogonal_eq_closure] constructor <;> intro h · rw [← Submodule.triorthogonal_eq_orthogonal, h, Submodule.top_orthogonal_eq_bot] · rw [h, Submodule.bot_orthogonal_eq_top] namespace Dense /- Porting note: unneeded assumption `[CompleteSpace E]` was removed from all theorems in this section. TODO: Move to another file? -/ open Submodule variable {x y : E} theorem eq_zero_of_inner_left (hK : Dense (K : Set E)) (h : ∀ v : K, ⟪x, v⟫ = 0) : x = 0 := by have : (⟪x, ·⟫) = 0 := (continuous_const.inner continuous_id).ext_on hK continuous_const (Subtype.forall.1 h) simpa using congr_fun this x theorem eq_zero_of_mem_orthogonal (hK : Dense (K : Set E)) (h : x ∈ Kᗮ) : x = 0 := eq_zero_of_inner_left hK fun v ↦ (mem_orthogonal' _ _).1 h _ v.2 /-- If `S` is dense and `x - y ∈ Kᗮ`, then `x = y`. -/ theorem eq_of_sub_mem_orthogonal (hK : Dense (K : Set E)) (h : x - y ∈ Kᗮ) : x = y := sub_eq_zero.1 <| eq_zero_of_mem_orthogonal hK h theorem eq_of_inner_left (hK : Dense (K : Set E)) (h : ∀ v : K, ⟪x, v⟫ = ⟪y, v⟫) : x = y := hK.eq_of_sub_mem_orthogonal (Submodule.sub_mem_orthogonal_of_inner_left h) theorem eq_of_inner_right (hK : Dense (K : Set E)) (h : ∀ v : K, ⟪(v : E), x⟫ = ⟪(v : E), y⟫) : x = y := hK.eq_of_sub_mem_orthogonal (Submodule.sub_mem_orthogonal_of_inner_right h) theorem eq_zero_of_inner_right (hK : Dense (K : Set E)) (h : ∀ v : K, ⟪(v : E), x⟫ = 0) : x = 0 := hK.eq_of_inner_right fun v => by rw [inner_zero_right, h v] end Dense /-- The reflection in `Kᗮ` of an element of `K` is its negation. -/ theorem reflection_mem_subspace_orthogonal_precomplement_eq_neg [HasOrthogonalProjection K] {v : E} (hv : v ∈ K) : reflection Kᗮ v = -v := reflection_mem_subspace_orthogonalComplement_eq_neg (K.le_orthogonal_orthogonal hv) /-- The orthogonal projection onto `(𝕜 ∙ v)ᗮ` of `v` is zero. -/ theorem orthogonalProjection_orthogonalComplement_singleton_eq_zero (v : E) : orthogonalProjection (𝕜 ∙ v)ᗮ v = 0 := orthogonalProjection_mem_subspace_orthogonal_precomplement_eq_zero (Submodule.mem_span_singleton_self v) /-- The reflection in `(𝕜 ∙ v)ᗮ` of `v` is `-v`. -/ theorem reflection_orthogonalComplement_singleton_eq_neg (v : E) : reflection (𝕜 ∙ v)ᗮ v = -v := reflection_mem_subspace_orthogonal_precomplement_eq_neg (Submodule.mem_span_singleton_self v) theorem reflection_sub {v w : F} (h : ‖v‖ = ‖w‖) : reflection (ℝ ∙ (v - w))ᗮ v = w := by set R : F ≃ₗᵢ[ℝ] F := reflection (ℝ ∙ v - w)ᗮ suffices R v + R v = w + w by apply smul_right_injective F (by norm_num : (2 : ℝ) ≠ 0) simpa [two_smul] using this have h₁ : R (v - w) = -(v - w) := reflection_orthogonalComplement_singleton_eq_neg (v - w) have h₂ : R (v + w) = v + w := by apply reflection_mem_subspace_eq_self rw [Submodule.mem_orthogonal_singleton_iff_inner_left] rw [real_inner_add_sub_eq_zero_iff] exact h convert congr_arg₂ (· + ·) h₂ h₁ using 1 · simp · abel variable (K) -- Porting note: relax assumptions, swap LHS with RHS /-- If the orthogonal projection to `K` is well-defined, then a vector splits as the sum of its orthogonal projections onto a complete submodule `K` and onto the orthogonal complement of `K`. -/ theorem orthogonalProjection_add_orthogonalProjection_orthogonal [HasOrthogonalProjection K] (w : E) : (orthogonalProjection K w : E) + (orthogonalProjection Kᗮ w : E) = w := by simp /-- The Pythagorean theorem, for an orthogonal projection. -/ theorem norm_sq_eq_add_norm_sq_projection (x : E) (S : Submodule 𝕜 E) [HasOrthogonalProjection S] : ‖x‖ ^ 2 = ‖orthogonalProjection S x‖ ^ 2 + ‖orthogonalProjection Sᗮ x‖ ^ 2 := calc ‖x‖ ^ 2 = ‖(orthogonalProjection S x : E) + orthogonalProjection Sᗮ x‖ ^ 2 := by rw [orthogonalProjection_add_orthogonalProjection_orthogonal] _ = ‖orthogonalProjection S x‖ ^ 2 + ‖orthogonalProjection Sᗮ x‖ ^ 2 := by simp only [sq] exact norm_add_sq_eq_norm_sq_add_norm_sq_of_inner_eq_zero _ _ <| (S.mem_orthogonal _).1 (orthogonalProjection Sᗮ x).2 _ (orthogonalProjection S x).2 /-- In a complete space `E`, the projection maps onto a complete subspace `K` and its orthogonal complement sum to the identity. -/ theorem id_eq_sum_orthogonalProjection_self_orthogonalComplement [HasOrthogonalProjection K] : ContinuousLinearMap.id 𝕜 E = K.subtypeL.comp (orthogonalProjection K) + Kᗮ.subtypeL.comp (orthogonalProjection Kᗮ) := by ext w exact (orthogonalProjection_add_orthogonalProjection_orthogonal K w).symm -- Porting note: The priority should be higher than `Submodule.coe_inner`. @[simp high] theorem inner_orthogonalProjection_eq_of_mem_right [HasOrthogonalProjection K] (u : K) (v : E) : ⟪orthogonalProjection K v, u⟫ = ⟪v, u⟫ := calc ⟪orthogonalProjection K v, u⟫ = ⟪(orthogonalProjection K v : E), u⟫ := K.coe_inner _ _ _ = ⟪(orthogonalProjection K v : E), u⟫ + ⟪v - orthogonalProjection K v, u⟫ := by rw [orthogonalProjection_inner_eq_zero _ _ (Submodule.coe_mem _), add_zero] _ = ⟪v, u⟫ := by rw [← inner_add_left, add_sub_cancel] -- Porting note: The priority should be higher than `Submodule.coe_inner`. @[simp high] theorem inner_orthogonalProjection_eq_of_mem_left [HasOrthogonalProjection K] (u : K) (v : E) : ⟪u, orthogonalProjection K v⟫ = ⟪(u : E), v⟫ := by rw [← inner_conj_symm, ← inner_conj_symm (u : E), inner_orthogonalProjection_eq_of_mem_right] /-- The orthogonal projection is self-adjoint. -/ theorem inner_orthogonalProjection_left_eq_right [HasOrthogonalProjection K] (u v : E) : ⟪↑(orthogonalProjection K u), v⟫ = ⟪u, orthogonalProjection K v⟫ := by rw [← inner_orthogonalProjection_eq_of_mem_left, inner_orthogonalProjection_eq_of_mem_right] /-- The orthogonal projection is symmetric. -/ theorem orthogonalProjection_isSymmetric [HasOrthogonalProjection K] : (K.subtypeL ∘L orthogonalProjection K : E →ₗ[𝕜] E).IsSymmetric := inner_orthogonalProjection_left_eq_right K open FiniteDimensional /-- Given a finite-dimensional subspace `K₂`, and a subspace `K₁` contained in it, the dimensions of `K₁` and the intersection of its orthogonal subspace with `K₂` add to that of `K₂`. -/ theorem Submodule.finrank_add_inf_finrank_orthogonal {K₁ K₂ : Submodule 𝕜 E} [FiniteDimensional 𝕜 K₂] (h : K₁ ≤ K₂) : finrank 𝕜 K₁ + finrank 𝕜 (K₁ᗮ ⊓ K₂ : Submodule 𝕜 E) = finrank 𝕜 K₂ := by haveI : FiniteDimensional 𝕜 K₁ := Submodule.finiteDimensional_of_le h haveI := proper_rclike 𝕜 K₁ have hd := Submodule.finrank_sup_add_finrank_inf_eq K₁ (K₁ᗮ ⊓ K₂) rw [← inf_assoc, (Submodule.orthogonal_disjoint K₁).eq_bot, bot_inf_eq, finrank_bot, Submodule.sup_orthogonal_inf_of_completeSpace h] at hd rw [add_zero] at hd exact hd.symm /-- Given a finite-dimensional subspace `K₂`, and a subspace `K₁` contained in it, the dimensions of `K₁` and the intersection of its orthogonal subspace with `K₂` add to that of `K₂`. -/ theorem Submodule.finrank_add_inf_finrank_orthogonal' {K₁ K₂ : Submodule 𝕜 E} [FiniteDimensional 𝕜 K₂] (h : K₁ ≤ K₂) {n : ℕ} (h_dim : finrank 𝕜 K₁ + n = finrank 𝕜 K₂) : finrank 𝕜 (K₁ᗮ ⊓ K₂ : Submodule 𝕜 E) = n := by rw [← add_right_inj (finrank 𝕜 K₁)] simp [Submodule.finrank_add_inf_finrank_orthogonal h, h_dim] /-- Given a finite-dimensional space `E` and subspace `K`, the dimensions of `K` and `Kᗮ` add to that of `E`. -/ theorem Submodule.finrank_add_finrank_orthogonal [FiniteDimensional 𝕜 E] (K : Submodule 𝕜 E) : finrank 𝕜 K + finrank 𝕜 Kᗮ = finrank 𝕜 E := by convert Submodule.finrank_add_inf_finrank_orthogonal (le_top : K ≤ ⊤) using 1 · rw [inf_top_eq] · simp /-- Given a finite-dimensional space `E` and subspace `K`, the dimensions of `K` and `Kᗮ` add to that of `E`. -/ theorem Submodule.finrank_add_finrank_orthogonal' [FiniteDimensional 𝕜 E] {K : Submodule 𝕜 E} {n : ℕ} (h_dim : finrank 𝕜 K + n = finrank 𝕜 E) : finrank 𝕜 Kᗮ = n := by rw [← add_right_inj (finrank 𝕜 K)] simp [Submodule.finrank_add_finrank_orthogonal, h_dim] /-- In a finite-dimensional inner product space, the dimension of the orthogonal complement of the span of a nonzero vector is one less than the dimension of the space. -/ theorem finrank_orthogonal_span_singleton {n : ℕ} [_i : Fact (finrank 𝕜 E = n + 1)] {v : E} (hv : v ≠ 0) : finrank 𝕜 (𝕜 ∙ v)ᗮ = n := by haveI : FiniteDimensional 𝕜 E := .of_fact_finrank_eq_succ n exact Submodule.finrank_add_finrank_orthogonal' <| by simp [finrank_span_singleton hv, _i.elim, add_comm] /-- An element `φ` of the orthogonal group of `F` can be factored as a product of reflections, and specifically at most as many reflections as the dimension of the complement of the fixed subspace of `φ`. -/ theorem LinearIsometryEquiv.reflections_generate_dim_aux [FiniteDimensional ℝ F] {n : ℕ} (φ : F ≃ₗᵢ[ℝ] F) (hn : finrank ℝ (ker (ContinuousLinearMap.id ℝ F - φ))ᗮ ≤ n) : ∃ l : List F, l.length ≤ n ∧ φ = (l.map fun v => reflection (ℝ ∙ v)ᗮ).prod := by -- We prove this by strong induction on `n`, the dimension of the orthogonal complement of the -- fixed subspace of the endomorphism `φ` induction' n with n IH generalizing φ · -- Base case: `n = 0`, the fixed subspace is the whole space, so `φ = id` refine ⟨[], rfl.le, show φ = 1 from ?_⟩ have : ker (ContinuousLinearMap.id ℝ F - φ) = ⊤ := by rwa [le_zero_iff, Submodule.finrank_eq_zero, Submodule.orthogonal_eq_bot_iff] at hn symm ext x have := LinearMap.congr_fun (LinearMap.ker_eq_top.mp this) x simpa only [sub_eq_zero, ContinuousLinearMap.coe_sub, LinearMap.sub_apply, LinearMap.zero_apply] using this · -- Inductive step. Let `W` be the fixed subspace of `φ`. We suppose its complement to have -- dimension at most n + 1. let W := ker (ContinuousLinearMap.id ℝ F - φ) have hW : ∀ w ∈ W, φ w = w := fun w hw => (sub_eq_zero.mp hw).symm by_cases hn' : finrank ℝ Wᗮ ≤ n · obtain ⟨V, hV₁, hV₂⟩ := IH φ hn' exact ⟨V, hV₁.trans n.le_succ, hV₂⟩ -- Take a nonzero element `v` of the orthogonal complement of `W`. haveI : Nontrivial Wᗮ := nontrivial_of_finrank_pos (by omega : 0 < finrank ℝ Wᗮ) obtain ⟨v, hv⟩ := exists_ne (0 : Wᗮ) have hφv : φ v ∈ Wᗮ := by intro w hw rw [← hW w hw, LinearIsometryEquiv.inner_map_map] exact v.prop w hw have hv' : (v : F) ∉ W := by intro h exact hv ((Submodule.mem_left_iff_eq_zero_of_disjoint W.orthogonal_disjoint).mp h) -- Let `ρ` be the reflection in `v - φ v`; this is designed to swap `v` and `φ v` let x : F := v - φ v let ρ := reflection (ℝ ∙ x)ᗮ -- Notation: Let `V` be the fixed subspace of `φ.trans ρ` let V := ker (ContinuousLinearMap.id ℝ F - φ.trans ρ) have hV : ∀ w, ρ (φ w) = w → w ∈ V := by intro w hw change w - ρ (φ w) = 0 rw [sub_eq_zero, hw] -- Everything fixed by `φ` is fixed by `φ.trans ρ` have H₂V : W ≤ V := by intro w hw apply hV rw [hW w hw] refine reflection_mem_subspace_eq_self ?_ rw [Submodule.mem_orthogonal_singleton_iff_inner_left] exact Submodule.sub_mem _ v.prop hφv _ hw -- `v` is also fixed by `φ.trans ρ` have H₁V : (v : F) ∈ V := by apply hV have : ρ v = φ v := reflection_sub (φ.norm_map v).symm rw [← this] exact reflection_reflection _ _ -- By dimension-counting, the complement of the fixed subspace of `φ.trans ρ` has dimension at -- most `n` have : finrank ℝ Vᗮ ≤ n := by change finrank ℝ Wᗮ ≤ n + 1 at hn have : finrank ℝ W + 1 ≤ finrank ℝ V := Submodule.finrank_lt_finrank_of_lt (SetLike.lt_iff_le_and_exists.2 ⟨H₂V, v, H₁V, hv'⟩) have : finrank ℝ V + finrank ℝ Vᗮ = finrank ℝ F := V.finrank_add_finrank_orthogonal have : finrank ℝ W + finrank ℝ Wᗮ = finrank ℝ F := W.finrank_add_finrank_orthogonal omega -- So apply the inductive hypothesis to `φ.trans ρ` obtain ⟨l, hl, hφl⟩ := IH (ρ * φ) this -- Prepend `ρ` to the factorization into reflections obtained for `φ.trans ρ`; this gives a -- factorization into reflections for `φ`. refine ⟨x::l, Nat.succ_le_succ hl, ?_⟩ rw [List.map_cons, List.prod_cons] have := congr_arg (ρ * ·) hφl dsimp only at this rwa [← mul_assoc, reflection_mul_reflection, one_mul] at this /-- The orthogonal group of `F` is generated by reflections; specifically each element `φ` of the orthogonal group is a product of at most as many reflections as the dimension of `F`. Special case of the **Cartan–Dieudonné theorem**. -/ theorem LinearIsometryEquiv.reflections_generate_dim [FiniteDimensional ℝ F] (φ : F ≃ₗᵢ[ℝ] F) : ∃ l : List F, l.length ≤ finrank ℝ F ∧ φ = (l.map fun v => reflection (ℝ ∙ v)ᗮ).prod := let ⟨l, hl₁, hl₂⟩ := φ.reflections_generate_dim_aux le_rfl ⟨l, hl₁.trans (Submodule.finrank_le _), hl₂⟩ /-- The orthogonal group of `F` is generated by reflections. -/ theorem LinearIsometryEquiv.reflections_generate [FiniteDimensional ℝ F] : Subgroup.closure (Set.range fun v : F => reflection (ℝ ∙ v)ᗮ) = ⊤ := by rw [Subgroup.eq_top_iff'] intro φ rcases φ.reflections_generate_dim with ⟨l, _, rfl⟩ apply (Subgroup.closure _).list_prod_mem intro x hx rcases List.mem_map.mp hx with ⟨a, _, hax⟩ exact Subgroup.subset_closure ⟨a, hax⟩ end Orthogonal section OrthogonalFamily variable {ι : Type*} /-- An orthogonal family of subspaces of `E` satisfies `DirectSum.IsInternal` (that is, they provide an internal direct sum decomposition of `E`) if and only if their span has trivial orthogonal complement. -/ theorem OrthogonalFamily.isInternal_iff_of_isComplete [DecidableEq ι] {V : ι → Submodule 𝕜 E} (hV : OrthogonalFamily 𝕜 (fun i => V i) fun i => (V i).subtypeₗᵢ) (hc : IsComplete (↑(iSup V) : Set E)) : DirectSum.IsInternal V ↔ (iSup V)ᗮ = ⊥ := by haveI : CompleteSpace (↥(iSup V)) := hc.completeSpace_coe simp only [DirectSum.isInternal_submodule_iff_independent_and_iSup_eq_top, hV.independent, true_and_iff, Submodule.orthogonal_eq_bot_iff] /-- An orthogonal family of subspaces of `E` satisfies `DirectSum.IsInternal` (that is, they provide an internal direct sum decomposition of `E`) if and only if their span has trivial orthogonal complement. -/ theorem OrthogonalFamily.isInternal_iff [DecidableEq ι] [FiniteDimensional 𝕜 E] {V : ι → Submodule 𝕜 E} (hV : OrthogonalFamily 𝕜 (fun i => V i) fun i => (V i).subtypeₗᵢ) : DirectSum.IsInternal V ↔ (iSup V)ᗮ = ⊥ := haveI h := FiniteDimensional.proper_rclike 𝕜 (↥(iSup V)) hV.isInternal_iff_of_isComplete (completeSpace_coe_iff_isComplete.mp inferInstance) open DirectSum /-- If `x` lies within an orthogonal family `v`, it can be expressed as a sum of projections. -/ theorem OrthogonalFamily.sum_projection_of_mem_iSup [Fintype ι] {V : ι → Submodule 𝕜 E} [∀ i, CompleteSpace (V i)] (hV : OrthogonalFamily 𝕜 (fun i => V i) fun i => (V i).subtypeₗᵢ) (x : E) (hx : x ∈ iSup V) : (∑ i, (orthogonalProjection (V i) x : E)) = x := by -- Porting note: switch to the better `induction _ using`. Need the primed induction principle, -- the unprimed one doesn't work with `induction` (as it isn't as syntactically general) induction hx using Submodule.iSup_induction' with | mem i x hx => refine (Finset.sum_eq_single_of_mem i (Finset.mem_univ _) fun j _ hij => ?_).trans (orthogonalProjection_eq_self_iff.mpr hx) rw [orthogonalProjection_mem_subspace_orthogonalComplement_eq_zero, Submodule.coe_zero] exact hV.isOrtho hij.symm hx | zero => simp_rw [map_zero, Submodule.coe_zero, Finset.sum_const_zero] | add x y _ _ hx hy => simp_rw [map_add, Submodule.coe_add, Finset.sum_add_distrib] exact congr_arg₂ (· + ·) hx hy /-- If a family of submodules is orthogonal, then the `orthogonalProjection` on a direct sum is just the coefficient of that direct sum. -/ theorem OrthogonalFamily.projection_directSum_coeAddHom [DecidableEq ι] {V : ι → Submodule 𝕜 E} (hV : OrthogonalFamily 𝕜 (fun i => V i) fun i => (V i).subtypeₗᵢ) (x : ⨁ i, V i) (i : ι) [CompleteSpace (V i)] : orthogonalProjection (V i) (DirectSum.coeAddMonoidHom V x) = x i := by induction' x using DirectSum.induction_on with j x x y hx hy · simp · simp_rw [DirectSum.coeAddMonoidHom_of, DirectSum.of] -- Porting note: was in the previous `simp_rw`, no longer works -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [DFinsupp.singleAddHom_apply] obtain rfl | hij := Decidable.eq_or_ne i j · rw [orthogonalProjection_mem_subspace_eq_self, DFinsupp.single_eq_same] · rw [orthogonalProjection_mem_subspace_orthogonalComplement_eq_zero, DFinsupp.single_eq_of_ne hij.symm] exact hV.isOrtho hij.symm x.prop · simp_rw [map_add] exact congr_arg₂ (· + ·) hx hy /-- If a family of submodules is orthogonal and they span the whole space, then the orthogonal projection provides a means to decompose the space into its submodules. The projection function is `decompose V x i = orthogonalProjection (V i) x`. See note [reducible non-instances]. -/ abbrev OrthogonalFamily.decomposition [DecidableEq ι] [Fintype ι] {V : ι → Submodule 𝕜 E} [∀ i, CompleteSpace (V i)] (hV : OrthogonalFamily 𝕜 (fun i => V i) fun i => (V i).subtypeₗᵢ) (h : iSup V = ⊤) : DirectSum.Decomposition V where decompose' x := DFinsupp.equivFunOnFintype.symm fun i => orthogonalProjection (V i) x left_inv x := by dsimp only letI := fun i => Classical.decEq (V i) rw [DirectSum.coeAddMonoidHom, DirectSum.toAddMonoid, DFinsupp.liftAddHom_apply] -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [DFinsupp.sumAddHom_apply]; rw [DFinsupp.sum_eq_sum_fintype] · simp_rw [Equiv.apply_symm_apply, AddSubmonoidClass.coe_subtype] exact hV.sum_projection_of_mem_iSup _ ((h.ge : _) Submodule.mem_top) · intro i exact map_zero _ right_inv x := by dsimp only simp_rw [hV.projection_directSum_coeAddHom, DFinsupp.equivFunOnFintype_symm_coe] end OrthogonalFamily section OrthonormalBasis variable {v : Set E} open FiniteDimensional Submodule Set /-- An orthonormal set in an `InnerProductSpace` is maximal, if and only if the orthogonal complement of its span is empty. -/ theorem maximal_orthonormal_iff_orthogonalComplement_eq_bot (hv : Orthonormal 𝕜 ((↑) : v → E)) : (∀ u ⊇ v, Orthonormal 𝕜 ((↑) : u → E) → u = v) ↔ (span 𝕜 v)ᗮ = ⊥ := by rw [Submodule.eq_bot_iff] constructor · contrapose! -- ** direction 1: nonempty orthogonal complement implies nonmaximal rintro ⟨x, hx', hx⟩ -- take a nonzero vector and normalize it let e := (‖x‖⁻¹ : 𝕜) • x have he : ‖e‖ = 1 := by simp [norm_smul_inv_norm hx] have he' : e ∈ (span 𝕜 v)ᗮ := smul_mem' _ _ hx' have he'' : e ∉ v := by intro hev have : e = 0 := by have : e ∈ span 𝕜 v ⊓ (span 𝕜 v)ᗮ := ⟨subset_span hev, he'⟩ simpa [(span 𝕜 v).inf_orthogonal_eq_bot] using this have : e ≠ 0 := hv.ne_zero ⟨e, hev⟩ contradiction -- put this together with `v` to provide a candidate orthonormal basis for the whole space refine ⟨insert e v, v.subset_insert e, ⟨?_, ?_⟩, (ne_insert_of_not_mem v he'').symm⟩ · -- show that the elements of `insert e v` have unit length rintro ⟨a, ha'⟩ cases' eq_or_mem_of_mem_insert ha' with ha ha · simp [ha, he] · exact hv.1 ⟨a, ha⟩ · -- show that the elements of `insert e v` are orthogonal have h_end : ∀ a ∈ v, ⟪a, e⟫ = 0 := by intro a ha exact he' a (Submodule.subset_span ha) rintro ⟨a, ha'⟩ cases' eq_or_mem_of_mem_insert ha' with ha ha · rintro ⟨b, hb'⟩ hab' have hb : b ∈ v := by refine mem_of_mem_insert_of_ne hb' ?_ intro hbe' apply hab' simp [ha, hbe'] rw [inner_eq_zero_symm] simpa [ha] using h_end b hb rintro ⟨b, hb'⟩ hab' cases' eq_or_mem_of_mem_insert hb' with hb hb · simpa [hb] using h_end a ha have : (⟨a, ha⟩ : v) ≠ ⟨b, hb⟩ := by intro hab'' apply hab' simpa using hab'' exact hv.2 this · -- ** direction 2: empty orthogonal complement implies maximal simp only [Subset.antisymm_iff] rintro h u (huv : v ⊆ u) hu refine ⟨?_, huv⟩ intro x hxu refine ((mt (h x)) (hu.ne_zero ⟨x, hxu⟩)).imp_symm ?_ intro hxv y hy have hxv' : (⟨x, hxu⟩ : u) ∉ ((↑) ⁻¹' v : Set u) := by simp [huv, hxv] obtain ⟨l, hl, rfl⟩ : ∃ l ∈ Finsupp.supported 𝕜 𝕜 ((↑) ⁻¹' v : Set u), (Finsupp.total (↥u) E 𝕜 (↑)) l = y := by rw [← Finsupp.mem_span_image_iff_total] simp [huv, inter_eq_self_of_subset_right, hy] exact hu.inner_finsupp_eq_zero hxv' hl variable [FiniteDimensional 𝕜 E] /-- An orthonormal set in a finite-dimensional `InnerProductSpace` is maximal, if and only if it is a basis. -/ theorem maximal_orthonormal_iff_basis_of_finiteDimensional (hv : Orthonormal 𝕜 ((↑) : v → E)) : (∀ u ⊇ v, Orthonormal 𝕜 ((↑) : u → E) → u = v) ↔ ∃ b : Basis v 𝕜 E, ⇑b = ((↑) : v → E) := by haveI := proper_rclike 𝕜 (span 𝕜 v) rw [maximal_orthonormal_iff_orthogonalComplement_eq_bot hv] rw [Submodule.orthogonal_eq_bot_iff] have hv_coe : range ((↑) : v → E) = v := by simp constructor · refine fun h => ⟨Basis.mk hv.linearIndependent _, Basis.coe_mk _ ?_⟩ convert h.ge · rintro ⟨h, coe_h⟩ rw [← h.span_eq, coe_h, hv_coe] end OrthonormalBasis
Analysis\InnerProductSpace\Rayleigh.lean
/- Copyright (c) 2021 Heather Macbeth. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Heather Macbeth, Frédéric Dupuis -/ import Mathlib.Analysis.InnerProductSpace.Calculus import Mathlib.Analysis.InnerProductSpace.Dual import Mathlib.Analysis.InnerProductSpace.Adjoint import Mathlib.Analysis.Calculus.LagrangeMultipliers import Mathlib.LinearAlgebra.Eigenspace.Basic /-! # The Rayleigh quotient The Rayleigh quotient of a self-adjoint operator `T` on an inner product space `E` is the function `fun x ↦ ⟪T x, x⟫ / ‖x‖ ^ 2`. The main results of this file are `IsSelfAdjoint.hasEigenvector_of_isMaxOn` and `IsSelfAdjoint.hasEigenvector_of_isMinOn`, which state that if `E` is complete, and if the Rayleigh quotient attains its global maximum/minimum over some sphere at the point `x₀`, then `x₀` is an eigenvector of `T`, and the `iSup`/`iInf` of `fun x ↦ ⟪T x, x⟫ / ‖x‖ ^ 2` is the corresponding eigenvalue. The corollaries `LinearMap.IsSymmetric.hasEigenvalue_iSup_of_finiteDimensional` and `LinearMap.IsSymmetric.hasEigenvalue_iSup_of_finiteDimensional` state that if `E` is finite-dimensional and nontrivial, then `T` has some (nonzero) eigenvectors with eigenvalue the `iSup`/`iInf` of `fun x ↦ ⟪T x, x⟫ / ‖x‖ ^ 2`. ## TODO A slightly more elaborate corollary is that if `E` is complete and `T` is a compact operator, then `T` has some (nonzero) eigenvector with eigenvalue either `⨆ x, ⟪T x, x⟫ / ‖x‖ ^ 2` or `⨅ x, ⟪T x, x⟫ / ‖x‖ ^ 2` (not necessarily both). -/ variable {𝕜 : Type*} [RCLike 𝕜] variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y open scoped NNReal open Module.End Metric namespace ContinuousLinearMap variable (T : E →L[𝕜] E) /-- The *Rayleigh quotient* of a continuous linear map `T` (over `ℝ` or `ℂ`) at a vector `x` is the quantity `re ⟪T x, x⟫ / ‖x‖ ^ 2`. -/ noncomputable abbrev rayleighQuotient (x : E) := T.reApplyInnerSelf x / ‖(x : E)‖ ^ 2 theorem rayleigh_smul (x : E) {c : 𝕜} (hc : c ≠ 0) : rayleighQuotient T (c • x) = rayleighQuotient T x := by by_cases hx : x = 0 · simp [hx] have : ‖c‖ ≠ 0 := by simp [hc] have : ‖x‖ ≠ 0 := by simp [hx] field_simp [norm_smul, T.reApplyInnerSelf_smul] ring theorem image_rayleigh_eq_image_rayleigh_sphere {r : ℝ} (hr : 0 < r) : rayleighQuotient T '' {0}ᶜ = rayleighQuotient T '' sphere 0 r := by ext a constructor · rintro ⟨x, hx : x ≠ 0, hxT⟩ have : ‖x‖ ≠ 0 := by simp [hx] let c : 𝕜 := ↑‖x‖⁻¹ * r have : c ≠ 0 := by simp [c, hx, hr.ne'] refine ⟨c • x, ?_, ?_⟩ · field_simp [c, norm_smul, abs_of_pos hr] · rw [T.rayleigh_smul x this] exact hxT · rintro ⟨x, hx, hxT⟩ exact ⟨x, ne_zero_of_mem_sphere hr.ne' ⟨x, hx⟩, hxT⟩ theorem iSup_rayleigh_eq_iSup_rayleigh_sphere {r : ℝ} (hr : 0 < r) : ⨆ x : { x : E // x ≠ 0 }, rayleighQuotient T x = ⨆ x : sphere (0 : E) r, rayleighQuotient T x := show ⨆ x : ({0}ᶜ : Set E), rayleighQuotient T x = _ by simp only [← @sSup_image' _ _ _ _ (rayleighQuotient T), T.image_rayleigh_eq_image_rayleigh_sphere hr] theorem iInf_rayleigh_eq_iInf_rayleigh_sphere {r : ℝ} (hr : 0 < r) : ⨅ x : { x : E // x ≠ 0 }, rayleighQuotient T x = ⨅ x : sphere (0 : E) r, rayleighQuotient T x := show ⨅ x : ({0}ᶜ : Set E), rayleighQuotient T x = _ by simp only [← @sInf_image' _ _ _ _ (rayleighQuotient T), T.image_rayleigh_eq_image_rayleigh_sphere hr] end ContinuousLinearMap namespace IsSelfAdjoint section Real variable {F : Type*} [NormedAddCommGroup F] [InnerProductSpace ℝ F] theorem _root_.LinearMap.IsSymmetric.hasStrictFDerivAt_reApplyInnerSelf {T : F →L[ℝ] F} (hT : (T : F →ₗ[ℝ] F).IsSymmetric) (x₀ : F) : HasStrictFDerivAt T.reApplyInnerSelf (2 • (innerSL ℝ (T x₀))) x₀ := by convert T.hasStrictFDerivAt.inner ℝ (hasStrictFDerivAt_id x₀) using 1 ext y rw [ContinuousLinearMap.smul_apply, ContinuousLinearMap.comp_apply, fderivInnerCLM_apply, ContinuousLinearMap.prod_apply, innerSL_apply, id, ContinuousLinearMap.id_apply, hT.apply_clm x₀ y, real_inner_comm _ x₀, two_smul] variable [CompleteSpace F] {T : F →L[ℝ] F} theorem linearly_dependent_of_isLocalExtrOn (hT : IsSelfAdjoint T) {x₀ : F} (hextr : IsLocalExtrOn T.reApplyInnerSelf (sphere (0 : F) ‖x₀‖) x₀) : ∃ a b : ℝ, (a, b) ≠ 0 ∧ a • x₀ + b • T x₀ = 0 := by have H : IsLocalExtrOn T.reApplyInnerSelf {x : F | ‖x‖ ^ 2 = ‖x₀‖ ^ 2} x₀ := by convert hextr ext x simp [dist_eq_norm] -- find Lagrange multipliers for the function `T.re_apply_inner_self` and the -- hypersurface-defining function `fun x ↦ ‖x‖ ^ 2` obtain ⟨a, b, h₁, h₂⟩ := IsLocalExtrOn.exists_multipliers_of_hasStrictFDerivAt_1d H (hasStrictFDerivAt_norm_sq x₀) (hT.isSymmetric.hasStrictFDerivAt_reApplyInnerSelf x₀) refine ⟨a, b, h₁, ?_⟩ apply (InnerProductSpace.toDualMap ℝ F).injective simp only [LinearIsometry.map_add, LinearIsometry.map_smul, LinearIsometry.map_zero] -- Note: #8386 changed `map_smulₛₗ` into `map_smulₛₗ _` simp only [map_smulₛₗ _, RCLike.conj_to_real] change a • innerSL ℝ x₀ + b • innerSL ℝ (T x₀) = 0 apply smul_right_injective (F →L[ℝ] ℝ) (two_ne_zero : (2 : ℝ) ≠ 0) simpa only [two_smul, smul_add, add_smul, add_zero] using h₂ theorem eq_smul_self_of_isLocalExtrOn_real (hT : IsSelfAdjoint T) {x₀ : F} (hextr : IsLocalExtrOn T.reApplyInnerSelf (sphere (0 : F) ‖x₀‖) x₀) : T x₀ = T.rayleighQuotient x₀ • x₀ := by obtain ⟨a, b, h₁, h₂⟩ := hT.linearly_dependent_of_isLocalExtrOn hextr by_cases hx₀ : x₀ = 0 · simp [hx₀] by_cases hb : b = 0 · have : a ≠ 0 := by simpa [hb] using h₁ refine absurd ?_ hx₀ apply smul_right_injective F this simpa [hb] using h₂ let c : ℝ := -b⁻¹ * a have hc : T x₀ = c • x₀ := by have : b * (b⁻¹ * a) = a := by field_simp [mul_comm] apply smul_right_injective F hb simp [c, eq_neg_of_add_eq_zero_left h₂, ← mul_smul, this] convert hc have : ‖x₀‖ ≠ 0 := by simp [hx₀] have := congr_arg (fun x => ⟪x, x₀⟫_ℝ) hc field_simp [inner_smul_left, real_inner_self_eq_norm_mul_norm, sq] at this ⊢ exact this end Real section CompleteSpace variable [CompleteSpace E] {T : E →L[𝕜] E} theorem eq_smul_self_of_isLocalExtrOn (hT : IsSelfAdjoint T) {x₀ : E} (hextr : IsLocalExtrOn T.reApplyInnerSelf (sphere (0 : E) ‖x₀‖) x₀) : T x₀ = (↑(T.rayleighQuotient x₀) : 𝕜) • x₀ := by letI := InnerProductSpace.rclikeToReal 𝕜 E let hSA := hT.isSymmetric.restrictScalars.toSelfAdjoint.prop exact hSA.eq_smul_self_of_isLocalExtrOn_real hextr /-- For a self-adjoint operator `T`, a local extremum of the Rayleigh quotient of `T` on a sphere centred at the origin is an eigenvector of `T`. -/ theorem hasEigenvector_of_isLocalExtrOn (hT : IsSelfAdjoint T) {x₀ : E} (hx₀ : x₀ ≠ 0) (hextr : IsLocalExtrOn T.reApplyInnerSelf (sphere (0 : E) ‖x₀‖) x₀) : HasEigenvector (T : E →ₗ[𝕜] E) (↑(T.rayleighQuotient x₀)) x₀ := by refine ⟨?_, hx₀⟩ rw [Module.End.mem_eigenspace_iff] exact hT.eq_smul_self_of_isLocalExtrOn hextr /-- For a self-adjoint operator `T`, a maximum of the Rayleigh quotient of `T` on a sphere centred at the origin is an eigenvector of `T`, with eigenvalue the global supremum of the Rayleigh quotient. -/ theorem hasEigenvector_of_isMaxOn (hT : IsSelfAdjoint T) {x₀ : E} (hx₀ : x₀ ≠ 0) (hextr : IsMaxOn T.reApplyInnerSelf (sphere (0 : E) ‖x₀‖) x₀) : HasEigenvector (T : E →ₗ[𝕜] E) (↑(⨆ x : { x : E // x ≠ 0 }, T.rayleighQuotient x)) x₀ := by convert hT.hasEigenvector_of_isLocalExtrOn hx₀ (Or.inr hextr.localize) have hx₀' : 0 < ‖x₀‖ := by simp [hx₀] have hx₀'' : x₀ ∈ sphere (0 : E) ‖x₀‖ := by simp rw [T.iSup_rayleigh_eq_iSup_rayleigh_sphere hx₀'] refine IsMaxOn.iSup_eq hx₀'' ?_ intro x hx dsimp have : ‖x‖ = ‖x₀‖ := by simpa using hx simp only [ContinuousLinearMap.rayleighQuotient] rw [this] gcongr exact hextr hx /-- For a self-adjoint operator `T`, a minimum of the Rayleigh quotient of `T` on a sphere centred at the origin is an eigenvector of `T`, with eigenvalue the global infimum of the Rayleigh quotient. -/ theorem hasEigenvector_of_isMinOn (hT : IsSelfAdjoint T) {x₀ : E} (hx₀ : x₀ ≠ 0) (hextr : IsMinOn T.reApplyInnerSelf (sphere (0 : E) ‖x₀‖) x₀) : HasEigenvector (T : E →ₗ[𝕜] E) (↑(⨅ x : { x : E // x ≠ 0 }, T.rayleighQuotient x)) x₀ := by convert hT.hasEigenvector_of_isLocalExtrOn hx₀ (Or.inl hextr.localize) have hx₀' : 0 < ‖x₀‖ := by simp [hx₀] have hx₀'' : x₀ ∈ sphere (0 : E) ‖x₀‖ := by simp rw [T.iInf_rayleigh_eq_iInf_rayleigh_sphere hx₀'] refine IsMinOn.iInf_eq hx₀'' ?_ intro x hx dsimp have : ‖x‖ = ‖x₀‖ := by simpa using hx simp only [ContinuousLinearMap.rayleighQuotient] rw [this] gcongr exact hextr hx end CompleteSpace end IsSelfAdjoint section FiniteDimensional variable [FiniteDimensional 𝕜 E] [_i : Nontrivial E] {T : E →ₗ[𝕜] E} namespace LinearMap namespace IsSymmetric /-- The supremum of the Rayleigh quotient of a symmetric operator `T` on a nontrivial finite-dimensional vector space is an eigenvalue for that operator. -/ theorem hasEigenvalue_iSup_of_finiteDimensional (hT : T.IsSymmetric) : HasEigenvalue T ↑(⨆ x : { x : E // x ≠ 0 }, RCLike.re ⟪T x, x⟫ / ‖(x : E)‖ ^ 2 : ℝ) := by haveI := FiniteDimensional.proper_rclike 𝕜 E let T' := hT.toSelfAdjoint obtain ⟨x, hx⟩ : ∃ x : E, x ≠ 0 := exists_ne 0 have H₁ : IsCompact (sphere (0 : E) ‖x‖) := isCompact_sphere _ _ have H₂ : (sphere (0 : E) ‖x‖).Nonempty := ⟨x, by simp⟩ -- key point: in finite dimension, a continuous function on the sphere has a max obtain ⟨x₀, hx₀', hTx₀⟩ := H₁.exists_isMaxOn H₂ T'.val.reApplyInnerSelf_continuous.continuousOn have hx₀ : ‖x₀‖ = ‖x‖ := by simpa using hx₀' have : IsMaxOn T'.val.reApplyInnerSelf (sphere 0 ‖x₀‖) x₀ := by simpa only [← hx₀] using hTx₀ have hx₀_ne : x₀ ≠ 0 := by have : ‖x₀‖ ≠ 0 := by simp only [hx₀, norm_eq_zero, hx, Ne, not_false_iff] simpa [← norm_eq_zero, Ne] exact hasEigenvalue_of_hasEigenvector (T'.prop.hasEigenvector_of_isMaxOn hx₀_ne this) /-- The infimum of the Rayleigh quotient of a symmetric operator `T` on a nontrivial finite-dimensional vector space is an eigenvalue for that operator. -/ theorem hasEigenvalue_iInf_of_finiteDimensional (hT : T.IsSymmetric) : HasEigenvalue T ↑(⨅ x : { x : E // x ≠ 0 }, RCLike.re ⟪T x, x⟫ / ‖(x : E)‖ ^ 2 : ℝ) := by haveI := FiniteDimensional.proper_rclike 𝕜 E let T' := hT.toSelfAdjoint obtain ⟨x, hx⟩ : ∃ x : E, x ≠ 0 := exists_ne 0 have H₁ : IsCompact (sphere (0 : E) ‖x‖) := isCompact_sphere _ _ have H₂ : (sphere (0 : E) ‖x‖).Nonempty := ⟨x, by simp⟩ -- key point: in finite dimension, a continuous function on the sphere has a min obtain ⟨x₀, hx₀', hTx₀⟩ := H₁.exists_isMinOn H₂ T'.val.reApplyInnerSelf_continuous.continuousOn have hx₀ : ‖x₀‖ = ‖x‖ := by simpa using hx₀' have : IsMinOn T'.val.reApplyInnerSelf (sphere 0 ‖x₀‖) x₀ := by simpa only [← hx₀] using hTx₀ have hx₀_ne : x₀ ≠ 0 := by have : ‖x₀‖ ≠ 0 := by simp only [hx₀, norm_eq_zero, hx, Ne, not_false_iff] simpa [← norm_eq_zero, Ne] exact hasEigenvalue_of_hasEigenvector (T'.prop.hasEigenvector_of_isMinOn hx₀_ne this) theorem subsingleton_of_no_eigenvalue_finiteDimensional (hT : T.IsSymmetric) (hT' : ∀ μ : 𝕜, Module.End.eigenspace (T : E →ₗ[𝕜] E) μ = ⊥) : Subsingleton E := (subsingleton_or_nontrivial E).resolve_right fun _h => absurd (hT' _) hT.hasEigenvalue_iSup_of_finiteDimensional end IsSymmetric end LinearMap end FiniteDimensional
Analysis\InnerProductSpace\Spectrum.lean
/- Copyright (c) 2021 Heather Macbeth. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Heather Macbeth -/ import Mathlib.Analysis.InnerProductSpace.Rayleigh import Mathlib.Analysis.InnerProductSpace.PiL2 import Mathlib.Algebra.DirectSum.Decomposition import Mathlib.LinearAlgebra.Eigenspace.Minpoly /-! # Spectral theory of self-adjoint operators This file covers the spectral theory of self-adjoint operators on an inner product space. The first part of the file covers general properties, true without any condition on boundedness or compactness of the operator or finite-dimensionality of the underlying space, notably: * `LinearMap.IsSymmetric.conj_eigenvalue_eq_self`: the eigenvalues are real * `LinearMap.IsSymmetric.orthogonalFamily_eigenspaces`: the eigenspaces are orthogonal * `LinearMap.IsSymmetric.orthogonalComplement_iSup_eigenspaces`: the restriction of the operator to the mutual orthogonal complement of the eigenspaces has, itself, no eigenvectors The second part of the file covers properties of self-adjoint operators in finite dimension. Letting `T` be a self-adjoint operator on a finite-dimensional inner product space `T`, * The definition `LinearMap.IsSymmetric.diagonalization` provides a linear isometry equivalence `E` to the direct sum of the eigenspaces of `T`. The theorem `LinearMap.IsSymmetric.diagonalization_apply_self_apply` states that, when `T` is transferred via this equivalence to an operator on the direct sum, it acts diagonally. * The definition `LinearMap.IsSymmetric.eigenvectorBasis` provides an orthonormal basis for `E` consisting of eigenvectors of `T`, with `LinearMap.IsSymmetric.eigenvalues` giving the corresponding list of eigenvalues, as real numbers. The definition `LinearMap.IsSymmetric.eigenvectorBasis` gives the associated linear isometry equivalence from `E` to Euclidean space, and the theorem `LinearMap.IsSymmetric.eigenvectorBasis_apply_self_apply` states that, when `T` is transferred via this equivalence to an operator on Euclidean space, it acts diagonally. These are forms of the *diagonalization theorem* for self-adjoint operators on finite-dimensional inner product spaces. ## TODO Spectral theory for compact self-adjoint operators, bounded self-adjoint operators. ## Tags self-adjoint operator, spectral theorem, diagonalization theorem -/ variable {𝕜 : Type*} [RCLike 𝕜] variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] local notation "⟪" x ", " y "⟫" => @inner 𝕜 E _ x y open scoped ComplexConjugate open Module.End namespace LinearMap namespace IsSymmetric variable {T : E →ₗ[𝕜] E} /-- A self-adjoint operator preserves orthogonal complements of its eigenspaces. -/ theorem invariant_orthogonalComplement_eigenspace (hT : T.IsSymmetric) (μ : 𝕜) (v : E) (hv : v ∈ (eigenspace T μ)ᗮ) : T v ∈ (eigenspace T μ)ᗮ := by intro w hw have : T w = (μ : 𝕜) • w := by rwa [mem_eigenspace_iff] at hw simp [← hT w, this, inner_smul_left, hv w hw] /-- The eigenvalues of a self-adjoint operator are real. -/ theorem conj_eigenvalue_eq_self (hT : T.IsSymmetric) {μ : 𝕜} (hμ : HasEigenvalue T μ) : conj μ = μ := by obtain ⟨v, hv₁, hv₂⟩ := hμ.exists_hasEigenvector rw [mem_eigenspace_iff] at hv₁ simpa [hv₂, inner_smul_left, inner_smul_right, hv₁] using hT v v /-- The eigenspaces of a self-adjoint operator are mutually orthogonal. -/ theorem orthogonalFamily_eigenspaces (hT : T.IsSymmetric) : OrthogonalFamily 𝕜 (fun μ => eigenspace T μ) fun μ => (eigenspace T μ).subtypeₗᵢ := by rintro μ ν hμν ⟨v, hv⟩ ⟨w, hw⟩ by_cases hv' : v = 0 · simp [hv'] have H := hT.conj_eigenvalue_eq_self (hasEigenvalue_of_hasEigenvector ⟨hv, hv'⟩) rw [mem_eigenspace_iff] at hv hw refine Or.resolve_left ?_ hμν.symm simpa [inner_smul_left, inner_smul_right, hv, hw, H] using (hT v w).symm theorem orthogonalFamily_eigenspaces' (hT : T.IsSymmetric) : OrthogonalFamily 𝕜 (fun μ : Eigenvalues T => eigenspace T μ) fun μ => (eigenspace T μ).subtypeₗᵢ := hT.orthogonalFamily_eigenspaces.comp Subtype.coe_injective /-- The mutual orthogonal complement of the eigenspaces of a self-adjoint operator on an inner product space is an invariant subspace of the operator. -/ theorem orthogonalComplement_iSup_eigenspaces_invariant (hT : T.IsSymmetric) ⦃v : E⦄ (hv : v ∈ (⨆ μ, eigenspace T μ)ᗮ) : T v ∈ (⨆ μ, eigenspace T μ)ᗮ := by rw [← Submodule.iInf_orthogonal] at hv ⊢ exact T.iInf_invariant hT.invariant_orthogonalComplement_eigenspace v hv /-- The mutual orthogonal complement of the eigenspaces of a self-adjoint operator on an inner product space has no eigenvalues. -/ theorem orthogonalComplement_iSup_eigenspaces (hT : T.IsSymmetric) (μ : 𝕜) : eigenspace (T.restrict hT.orthogonalComplement_iSup_eigenspaces_invariant) μ = ⊥ := by set p : Submodule 𝕜 E := (⨆ μ, eigenspace T μ)ᗮ refine eigenspace_restrict_eq_bot hT.orthogonalComplement_iSup_eigenspaces_invariant ?_ have H₂ : eigenspace T μ ⟂ p := (Submodule.isOrtho_orthogonal_right _).mono_left (le_iSup _ _) exact H₂.disjoint /-! ### Finite-dimensional theory -/ variable [FiniteDimensional 𝕜 E] /-- The mutual orthogonal complement of the eigenspaces of a self-adjoint operator on a finite-dimensional inner product space is trivial. -/ theorem orthogonalComplement_iSup_eigenspaces_eq_bot (hT : T.IsSymmetric) : (⨆ μ, eigenspace T μ)ᗮ = ⊥ := by have hT' : IsSymmetric _ := hT.restrict_invariant hT.orthogonalComplement_iSup_eigenspaces_invariant -- a self-adjoint operator on a nontrivial inner product space has an eigenvalue haveI := hT'.subsingleton_of_no_eigenvalue_finiteDimensional hT.orthogonalComplement_iSup_eigenspaces exact Submodule.eq_bot_of_subsingleton theorem orthogonalComplement_iSup_eigenspaces_eq_bot' (hT : T.IsSymmetric) : (⨆ μ : Eigenvalues T, eigenspace T μ)ᗮ = ⊥ := show (⨆ μ : { μ // eigenspace T μ ≠ ⊥ }, eigenspace T μ)ᗮ = ⊥ by rw [iSup_ne_bot_subtype, hT.orthogonalComplement_iSup_eigenspaces_eq_bot] /-- The eigenspaces of a self-adjoint operator on a finite-dimensional inner product space `E` gives an internal direct sum decomposition of `E`. Note this takes `hT` as a `Fact` to allow it to be an instance. -/ noncomputable instance directSumDecomposition [hT : Fact T.IsSymmetric] : DirectSum.Decomposition fun μ : Eigenvalues T => eigenspace T μ := haveI h : ∀ μ : Eigenvalues T, CompleteSpace (eigenspace T μ) := fun μ => by infer_instance hT.out.orthogonalFamily_eigenspaces'.decomposition (Submodule.orthogonal_eq_bot_iff.mp hT.out.orthogonalComplement_iSup_eigenspaces_eq_bot') theorem directSum_decompose_apply [_hT : Fact T.IsSymmetric] (x : E) (μ : Eigenvalues T) : DirectSum.decompose (fun μ : Eigenvalues T => eigenspace T μ) x μ = orthogonalProjection (eigenspace T μ) x := rfl /-- The eigenspaces of a self-adjoint operator on a finite-dimensional inner product space `E` gives an internal direct sum decomposition of `E`. -/ theorem direct_sum_isInternal (hT : T.IsSymmetric) : DirectSum.IsInternal fun μ : Eigenvalues T => eigenspace T μ := hT.orthogonalFamily_eigenspaces'.isInternal_iff.mpr hT.orthogonalComplement_iSup_eigenspaces_eq_bot' variable (hT : T.IsSymmetric) section Version1 /-- Isometry from an inner product space `E` to the direct sum of the eigenspaces of some self-adjoint operator `T` on `E`. -/ noncomputable def diagonalization : E ≃ₗᵢ[𝕜] PiLp 2 fun μ : Eigenvalues T => eigenspace T μ := hT.direct_sum_isInternal.isometryL2OfOrthogonalFamily hT.orthogonalFamily_eigenspaces' @[simp] theorem diagonalization_symm_apply (w : PiLp 2 fun μ : Eigenvalues T => eigenspace T μ) : hT.diagonalization.symm w = ∑ μ, w μ := hT.direct_sum_isInternal.isometryL2OfOrthogonalFamily_symm_apply hT.orthogonalFamily_eigenspaces' w /-- *Diagonalization theorem*, *spectral theorem*; version 1: A self-adjoint operator `T` on a finite-dimensional inner product space `E` acts diagonally on the decomposition of `E` into the direct sum of the eigenspaces of `T`. -/ theorem diagonalization_apply_self_apply (v : E) (μ : Eigenvalues T) : hT.diagonalization (T v) μ = (μ : 𝕜) • hT.diagonalization v μ := by suffices ∀ w : PiLp 2 fun μ : Eigenvalues T => eigenspace T μ, T (hT.diagonalization.symm w) = hT.diagonalization.symm fun μ => (μ : 𝕜) • w μ by simpa only [LinearIsometryEquiv.symm_apply_apply, LinearIsometryEquiv.apply_symm_apply] using congr_arg (fun w => hT.diagonalization w μ) (this (hT.diagonalization v)) intro w have hwT : ∀ μ, T (w μ) = (μ : 𝕜) • w μ := fun μ => mem_eigenspace_iff.1 (w μ).2 simp only [hwT, diagonalization_symm_apply, map_sum, Submodule.coe_smul_of_tower] end Version1 section Version2 variable {n : ℕ} (hn : FiniteDimensional.finrank 𝕜 E = n) /-- A choice of orthonormal basis of eigenvectors for self-adjoint operator `T` on a finite-dimensional inner product space `E`. TODO Postcompose with a permutation so that these eigenvectors are listed in increasing order of eigenvalue. -/ noncomputable irreducible_def eigenvectorBasis : OrthonormalBasis (Fin n) 𝕜 E := hT.direct_sum_isInternal.subordinateOrthonormalBasis hn hT.orthogonalFamily_eigenspaces' /-- The sequence of real eigenvalues associated to the standard orthonormal basis of eigenvectors for a self-adjoint operator `T` on `E`. TODO Postcompose with a permutation so that these eigenvalues are listed in increasing order. -/ noncomputable irreducible_def eigenvalues (i : Fin n) : ℝ := @RCLike.re 𝕜 _ <| (hT.direct_sum_isInternal.subordinateOrthonormalBasisIndex hn i hT.orthogonalFamily_eigenspaces').val theorem hasEigenvector_eigenvectorBasis (i : Fin n) : HasEigenvector T (hT.eigenvalues hn i) (hT.eigenvectorBasis hn i) := by let v : E := hT.eigenvectorBasis hn i let μ : 𝕜 := (hT.direct_sum_isInternal.subordinateOrthonormalBasisIndex hn i hT.orthogonalFamily_eigenspaces').val simp_rw [eigenvalues] change HasEigenvector T (RCLike.re μ) v have key : HasEigenvector T μ v := by have H₁ : v ∈ eigenspace T μ := by simp_rw [v, eigenvectorBasis] exact hT.direct_sum_isInternal.subordinateOrthonormalBasis_subordinate hn i hT.orthogonalFamily_eigenspaces' have H₂ : v ≠ 0 := by simpa using (hT.eigenvectorBasis hn).toBasis.ne_zero i exact ⟨H₁, H₂⟩ have re_μ : ↑(RCLike.re μ) = μ := by rw [← RCLike.conj_eq_iff_re] exact hT.conj_eigenvalue_eq_self (hasEigenvalue_of_hasEigenvector key) simpa [re_μ] using key theorem hasEigenvalue_eigenvalues (i : Fin n) : HasEigenvalue T (hT.eigenvalues hn i) := Module.End.hasEigenvalue_of_hasEigenvector (hT.hasEigenvector_eigenvectorBasis hn i) @[simp] theorem apply_eigenvectorBasis (i : Fin n) : T (hT.eigenvectorBasis hn i) = (hT.eigenvalues hn i : 𝕜) • hT.eigenvectorBasis hn i := mem_eigenspace_iff.mp (hT.hasEigenvector_eigenvectorBasis hn i).1 /-- *Diagonalization theorem*, *spectral theorem*; version 2: A self-adjoint operator `T` on a finite-dimensional inner product space `E` acts diagonally on the identification of `E` with Euclidean space induced by an orthonormal basis of eigenvectors of `T`. -/ theorem eigenvectorBasis_apply_self_apply (v : E) (i : Fin n) : (hT.eigenvectorBasis hn).repr (T v) i = hT.eigenvalues hn i * (hT.eigenvectorBasis hn).repr v i := by suffices ∀ w : EuclideanSpace 𝕜 (Fin n), T ((hT.eigenvectorBasis hn).repr.symm w) = (hT.eigenvectorBasis hn).repr.symm fun i => hT.eigenvalues hn i * w i by simpa [OrthonormalBasis.sum_repr_symm] using congr_arg (fun v => (hT.eigenvectorBasis hn).repr v i) (this ((hT.eigenvectorBasis hn).repr v)) intro w simp_rw [← OrthonormalBasis.sum_repr_symm, map_sum, map_smul, apply_eigenvectorBasis] apply Fintype.sum_congr intro a rw [smul_smul, mul_comm] end Version2 end IsSymmetric end LinearMap section Nonneg @[simp] theorem inner_product_apply_eigenvector {μ : 𝕜} {v : E} {T : E →ₗ[𝕜] E} (h : v ∈ Module.End.eigenspace T μ) : ⟪v, T v⟫ = μ * (‖v‖ : 𝕜) ^ 2 := by simp only [mem_eigenspace_iff.mp h, inner_smul_right, inner_self_eq_norm_sq_to_K] theorem eigenvalue_nonneg_of_nonneg {μ : ℝ} {T : E →ₗ[𝕜] E} (hμ : HasEigenvalue T μ) (hnn : ∀ x : E, 0 ≤ RCLike.re ⟪x, T x⟫) : 0 ≤ μ := by obtain ⟨v, hv⟩ := hμ.exists_hasEigenvector have hpos : (0 : ℝ) < ‖v‖ ^ 2 := by simpa only [sq_pos_iff, norm_ne_zero_iff] using hv.2 have : RCLike.re ⟪v, T v⟫ = μ * ‖v‖ ^ 2 := by have := congr_arg RCLike.re (inner_product_apply_eigenvector hv.1) -- Porting note: why can't `exact_mod_cast` do this? These lemmas are marked `norm_cast` rw [← RCLike.ofReal_pow, ← RCLike.ofReal_mul] at this exact mod_cast this exact (mul_nonneg_iff_of_pos_right hpos).mp (this ▸ hnn v) theorem eigenvalue_pos_of_pos {μ : ℝ} {T : E →ₗ[𝕜] E} (hμ : HasEigenvalue T μ) (hnn : ∀ x : E, 0 < RCLike.re ⟪x, T x⟫) : 0 < μ := by obtain ⟨v, hv⟩ := hμ.exists_hasEigenvector have hpos : (0 : ℝ) < ‖v‖ ^ 2 := by simpa only [sq_pos_iff, norm_ne_zero_iff] using hv.2 have : RCLike.re ⟪v, T v⟫ = μ * ‖v‖ ^ 2 := by have := congr_arg RCLike.re (inner_product_apply_eigenvector hv.1) -- Porting note: why can't `exact_mod_cast` do this? These lemmas are marked `norm_cast` rw [← RCLike.ofReal_pow, ← RCLike.ofReal_mul] at this exact mod_cast this exact (mul_pos_iff_of_pos_right hpos).mp (this ▸ hnn v) end Nonneg
Analysis\InnerProductSpace\Symmetric.lean
/- Copyright (c) 2022 Anatole Dedecker. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Moritz Doll, Frédéric Dupuis, Heather Macbeth -/ import Mathlib.Analysis.InnerProductSpace.Basic import Mathlib.Analysis.Normed.Operator.Banach import Mathlib.LinearAlgebra.SesquilinearForm /-! # Symmetric linear maps in an inner product space This file defines and proves basic theorems about symmetric **not necessarily bounded** operators on an inner product space, i.e linear maps `T : E → E` such that `∀ x y, ⟪T x, y⟫ = ⟪x, T y⟫`. In comparison to `IsSelfAdjoint`, this definition works for non-continuous linear maps, and doesn't rely on the definition of the adjoint, which allows it to be stated in non-complete space. ## Main definitions * `LinearMap.IsSymmetric`: a (not necessarily bounded) operator on an inner product space is symmetric, if for all `x`, `y`, we have `⟪T x, y⟫ = ⟪x, T y⟫` ## Main statements * `IsSymmetric.continuous`: if a symmetric operator is defined on a complete space, then it is automatically continuous. ## Tags self-adjoint, symmetric -/ open RCLike open ComplexConjugate variable {𝕜 E E' F G : Type*} [RCLike 𝕜] variable [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] variable [NormedAddCommGroup F] [InnerProductSpace 𝕜 F] variable [NormedAddCommGroup G] [InnerProductSpace 𝕜 G] variable [NormedAddCommGroup E'] [InnerProductSpace ℝ E'] local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y namespace LinearMap /-! ### Symmetric operators -/ /-- A (not necessarily bounded) operator on an inner product space is symmetric, if for all `x`, `y`, we have `⟪T x, y⟫ = ⟪x, T y⟫`. -/ def IsSymmetric (T : E →ₗ[𝕜] E) : Prop := ∀ x y, ⟪T x, y⟫ = ⟪x, T y⟫ section Real /-- An operator `T` on an inner product space is symmetric if and only if it is `LinearMap.IsSelfAdjoint` with respect to the sesquilinear form given by the inner product. -/ theorem isSymmetric_iff_sesqForm (T : E →ₗ[𝕜] E) : T.IsSymmetric ↔ LinearMap.IsSelfAdjoint (R := 𝕜) (M := E) sesqFormOfInner T := ⟨fun h x y => (h y x).symm, fun h x y => (h y x).symm⟩ end Real theorem IsSymmetric.conj_inner_sym {T : E →ₗ[𝕜] E} (hT : IsSymmetric T) (x y : E) : conj ⟪T x, y⟫ = ⟪T y, x⟫ := by rw [hT x y, inner_conj_symm] @[simp] theorem IsSymmetric.apply_clm {T : E →L[𝕜] E} (hT : IsSymmetric (T : E →ₗ[𝕜] E)) (x y : E) : ⟪T x, y⟫ = ⟪x, T y⟫ := hT x y theorem isSymmetric_zero : (0 : E →ₗ[𝕜] E).IsSymmetric := fun x y => (inner_zero_right x : ⟪x, 0⟫ = 0).symm ▸ (inner_zero_left y : ⟪0, y⟫ = 0) theorem isSymmetric_id : (LinearMap.id : E →ₗ[𝕜] E).IsSymmetric := fun _ _ => rfl theorem IsSymmetric.add {T S : E →ₗ[𝕜] E} (hT : T.IsSymmetric) (hS : S.IsSymmetric) : (T + S).IsSymmetric := by intro x y rw [LinearMap.add_apply, inner_add_left, hT x y, hS x y, ← inner_add_right] rfl /-- The **Hellinger--Toeplitz theorem**: if a symmetric operator is defined on a complete space, then it is automatically continuous. -/ theorem IsSymmetric.continuous [CompleteSpace E] {T : E →ₗ[𝕜] E} (hT : IsSymmetric T) : Continuous T := by -- We prove it by using the closed graph theorem refine T.continuous_of_seq_closed_graph fun u x y hu hTu => ?_ rw [← sub_eq_zero, ← @inner_self_eq_zero 𝕜] have hlhs : ∀ k : ℕ, ⟪T (u k) - T x, y - T x⟫ = ⟪u k - x, T (y - T x)⟫ := by intro k rw [← T.map_sub, hT] refine tendsto_nhds_unique ((hTu.sub_const _).inner tendsto_const_nhds) ?_ simp_rw [Function.comp_apply, hlhs] rw [← inner_zero_left (T (y - T x))] refine Filter.Tendsto.inner ?_ tendsto_const_nhds rw [← sub_self x] exact hu.sub_const _ /-- For a symmetric operator `T`, the function `fun x ↦ ⟪T x, x⟫` is real-valued. -/ @[simp] theorem IsSymmetric.coe_reApplyInnerSelf_apply {T : E →L[𝕜] E} (hT : IsSymmetric (T : E →ₗ[𝕜] E)) (x : E) : (T.reApplyInnerSelf x : 𝕜) = ⟪T x, x⟫ := by rsuffices ⟨r, hr⟩ : ∃ r : ℝ, ⟪T x, x⟫ = r · simp [hr, T.reApplyInnerSelf_apply] rw [← conj_eq_iff_real] exact hT.conj_inner_sym x x /-- If a symmetric operator preserves a submodule, its restriction to that submodule is symmetric. -/ theorem IsSymmetric.restrict_invariant {T : E →ₗ[𝕜] E} (hT : IsSymmetric T) {V : Submodule 𝕜 E} (hV : ∀ v ∈ V, T v ∈ V) : IsSymmetric (T.restrict hV) := fun v w => hT v w theorem IsSymmetric.restrictScalars {T : E →ₗ[𝕜] E} (hT : T.IsSymmetric) : @LinearMap.IsSymmetric ℝ E _ _ (InnerProductSpace.rclikeToReal 𝕜 E) (@LinearMap.restrictScalars ℝ 𝕜 _ _ _ _ _ _ (InnerProductSpace.rclikeToReal 𝕜 E).toModule (InnerProductSpace.rclikeToReal 𝕜 E).toModule _ _ _ T) := fun x y => by simp [hT x y, real_inner_eq_re_inner, LinearMap.coe_restrictScalars ℝ] section Complex variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V] /-- A linear operator on a complex inner product space is symmetric precisely when `⟪T v, v⟫_ℂ` is real for all v. -/ theorem isSymmetric_iff_inner_map_self_real (T : V →ₗ[ℂ] V) : IsSymmetric T ↔ ∀ v : V, conj ⟪T v, v⟫_ℂ = ⟪T v, v⟫_ℂ := by constructor · intro hT v apply IsSymmetric.conj_inner_sym hT · intro h x y rw [← inner_conj_symm x (T y)] rw [inner_map_polarization T x y] simp only [starRingEnd_apply, star_div', star_sub, star_add, star_mul] simp only [← starRingEnd_apply] rw [h (x + y), h (x - y), h (x + Complex.I • y), h (x - Complex.I • y)] simp only [Complex.conj_I] rw [inner_map_polarization'] norm_num ring end Complex /-- Polarization identity for symmetric linear maps. See `inner_map_polarization` for the complex version without the symmetric assumption. -/ theorem IsSymmetric.inner_map_polarization {T : E →ₗ[𝕜] E} (hT : T.IsSymmetric) (x y : E) : ⟪T x, y⟫ = (⟪T (x + y), x + y⟫ - ⟪T (x - y), x - y⟫ - I * ⟪T (x + (I : 𝕜) • y), x + (I : 𝕜) • y⟫ + I * ⟪T (x - (I : 𝕜) • y), x - (I : 𝕜) • y⟫) / 4 := by rcases@I_mul_I_ax 𝕜 _ with (h | h) · simp_rw [h, zero_mul, sub_zero, add_zero, map_add, map_sub, inner_add_left, inner_add_right, inner_sub_left, inner_sub_right, hT x, ← inner_conj_symm x (T y)] suffices (re ⟪T y, x⟫ : 𝕜) = ⟪T y, x⟫ by rw [conj_eq_iff_re.mpr this] ring rw [← re_add_im ⟪T y, x⟫] simp_rw [h, mul_zero, add_zero] norm_cast · simp_rw [map_add, map_sub, inner_add_left, inner_add_right, inner_sub_left, inner_sub_right, LinearMap.map_smul, inner_smul_left, inner_smul_right, RCLike.conj_I, mul_add, mul_sub, sub_sub, ← mul_assoc, mul_neg, h, neg_neg, one_mul, neg_one_mul] ring /-- A symmetric linear map `T` is zero if and only if `⟪T x, x⟫_ℝ = 0` for all `x`. See `inner_map_self_eq_zero` for the complex version without the symmetric assumption. -/ theorem IsSymmetric.inner_map_self_eq_zero {T : E →ₗ[𝕜] E} (hT : T.IsSymmetric) : (∀ x, ⟪T x, x⟫ = 0) ↔ T = 0 := by simp_rw [LinearMap.ext_iff, zero_apply] refine ⟨fun h x => ?_, fun h => by simp_rw [h, inner_zero_left, forall_const]⟩ rw [← @inner_self_eq_zero 𝕜, hT.inner_map_polarization] simp_rw [h _] ring end LinearMap
Analysis\InnerProductSpace\TwoDim.lean
/- Copyright (c) 2022 Heather Macbeth. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Heather Macbeth -/ import Mathlib.Analysis.InnerProductSpace.Dual import Mathlib.Analysis.InnerProductSpace.Orientation import Mathlib.Data.Complex.FiniteDimensional import Mathlib.Data.Complex.Orientation import Mathlib.Tactic.LinearCombination /-! # Oriented two-dimensional real inner product spaces This file defines constructions specific to the geometry of an oriented two-dimensional real inner product space `E`. ## Main declarations * `Orientation.areaForm`: an antisymmetric bilinear form `E →ₗ[ℝ] E →ₗ[ℝ] ℝ` (usual notation `ω`). Morally, when `ω` is evaluated on two vectors, it gives the oriented area of the parallelogram they span. (But mathlib does not yet have a construction of oriented area, and in fact the construction of oriented area should pass through `ω`.) * `Orientation.rightAngleRotation`: an isometric automorphism `E ≃ₗᵢ[ℝ] E` (usual notation `J`). This automorphism squares to -1. In a later file, rotations (`Orientation.rotation`) are defined, in such a way that this automorphism is equal to rotation by 90 degrees. * `Orientation.basisRightAngleRotation`: for a nonzero vector `x` in `E`, the basis `![x, J x]` for `E`. * `Orientation.kahler`: a complex-valued real-bilinear map `E →ₗ[ℝ] E →ₗ[ℝ] ℂ`. Its real part is the inner product and its imaginary part is `Orientation.areaForm`. For vectors `x` and `y` in `E`, the complex number `o.kahler x y` has modulus `‖x‖ * ‖y‖`. In a later file, oriented angles (`Orientation.oangle`) are defined, in such a way that the argument of `o.kahler x y` is the oriented angle from `x` to `y`. ## Main results * `Orientation.rightAngleRotation_rightAngleRotation`: the identity `J (J x) = - x` * `Orientation.nonneg_inner_and_areaForm_eq_zero_iff_sameRay`: `x`, `y` are in the same ray, if and only if `0 ≤ ⟪x, y⟫` and `ω x y = 0` * `Orientation.kahler_mul`: the identity `o.kahler x a * o.kahler a y = ‖a‖ ^ 2 * o.kahler x y` * `Complex.areaForm`, `Complex.rightAngleRotation`, `Complex.kahler`: the concrete interpretations of `areaForm`, `rightAngleRotation`, `kahler` for the oriented real inner product space `ℂ` * `Orientation.areaForm_map_complex`, `Orientation.rightAngleRotation_map_complex`, `Orientation.kahler_map_complex`: given an orientation-preserving isometry from `E` to `ℂ`, expressions for `areaForm`, `rightAngleRotation`, `kahler` as the pullback of their concrete interpretations on `ℂ` ## Implementation notes Notation `ω` for `Orientation.areaForm` and `J` for `Orientation.rightAngleRotation` should be defined locally in each file which uses them, since otherwise one would need a more cumbersome notation which mentions the orientation explicitly (something like `ω[o]`). Write ``` local notation "ω" => o.areaForm local notation "J" => o.rightAngleRotation ``` -/ noncomputable section open scoped RealInnerProductSpace ComplexConjugate open FiniteDimensional lemma FiniteDimensional.of_fact_finrank_eq_two {K V : Type*} [DivisionRing K] [AddCommGroup V] [Module K V] [Fact (finrank K V = 2)] : FiniteDimensional K V := .of_fact_finrank_eq_succ 1 attribute [local instance] FiniteDimensional.of_fact_finrank_eq_two @[deprecated (since := "2024-02-02")] alias FiniteDimensional.finiteDimensional_of_fact_finrank_eq_two := FiniteDimensional.of_fact_finrank_eq_two variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [Fact (finrank ℝ E = 2)] (o : Orientation ℝ E (Fin 2)) namespace Orientation /-- An antisymmetric bilinear form on an oriented real inner product space of dimension 2 (usual notation `ω`). When evaluated on two vectors, it gives the oriented area of the parallelogram they span. -/ irreducible_def areaForm : E →ₗ[ℝ] E →ₗ[ℝ] ℝ := by let z : E [⋀^Fin 0]→ₗ[ℝ] ℝ ≃ₗ[ℝ] ℝ := AlternatingMap.constLinearEquivOfIsEmpty.symm let y : E [⋀^Fin 1]→ₗ[ℝ] ℝ →ₗ[ℝ] E →ₗ[ℝ] ℝ := LinearMap.llcomp ℝ E (E [⋀^Fin 0]→ₗ[ℝ] ℝ) ℝ z ∘ₗ AlternatingMap.curryLeftLinearMap exact y ∘ₗ AlternatingMap.curryLeftLinearMap (R' := ℝ) o.volumeForm local notation "ω" => o.areaForm theorem areaForm_to_volumeForm (x y : E) : ω x y = o.volumeForm ![x, y] := by simp [areaForm] @[simp] theorem areaForm_apply_self (x : E) : ω x x = 0 := by rw [areaForm_to_volumeForm] refine o.volumeForm.map_eq_zero_of_eq ![x, x] ?_ (?_ : (0 : Fin 2) ≠ 1) · simp · norm_num theorem areaForm_swap (x y : E) : ω x y = -ω y x := by simp only [areaForm_to_volumeForm] convert o.volumeForm.map_swap ![y, x] (_ : (0 : Fin 2) ≠ 1) · ext i fin_cases i <;> rfl · norm_num @[simp] theorem areaForm_neg_orientation : (-o).areaForm = -o.areaForm := by ext x y simp [areaForm_to_volumeForm] /-- Continuous linear map version of `Orientation.areaForm`, useful for calculus. -/ def areaForm' : E →L[ℝ] E →L[ℝ] ℝ := LinearMap.toContinuousLinearMap (↑(LinearMap.toContinuousLinearMap : (E →ₗ[ℝ] ℝ) ≃ₗ[ℝ] E →L[ℝ] ℝ) ∘ₗ o.areaForm) @[simp] theorem areaForm'_apply (x : E) : o.areaForm' x = LinearMap.toContinuousLinearMap (o.areaForm x) := rfl theorem abs_areaForm_le (x y : E) : |ω x y| ≤ ‖x‖ * ‖y‖ := by simpa [areaForm_to_volumeForm, Fin.prod_univ_succ] using o.abs_volumeForm_apply_le ![x, y] theorem areaForm_le (x y : E) : ω x y ≤ ‖x‖ * ‖y‖ := by simpa [areaForm_to_volumeForm, Fin.prod_univ_succ] using o.volumeForm_apply_le ![x, y] theorem abs_areaForm_of_orthogonal {x y : E} (h : ⟪x, y⟫ = 0) : |ω x y| = ‖x‖ * ‖y‖ := by rw [o.areaForm_to_volumeForm, o.abs_volumeForm_apply_of_pairwise_orthogonal] · simp [Fin.prod_univ_succ] intro i j hij fin_cases i <;> fin_cases j · simp_all · simpa using h · simpa [real_inner_comm] using h · simp_all theorem areaForm_map {F : Type*} [NormedAddCommGroup F] [InnerProductSpace ℝ F] [hF : Fact (finrank ℝ F = 2)] (φ : E ≃ₗᵢ[ℝ] F) (x y : F) : (Orientation.map (Fin 2) φ.toLinearEquiv o).areaForm x y = o.areaForm (φ.symm x) (φ.symm y) := by have : φ.symm ∘ ![x, y] = ![φ.symm x, φ.symm y] := by ext i fin_cases i <;> rfl simp [areaForm_to_volumeForm, volumeForm_map, this] /-- The area form is invariant under pullback by a positively-oriented isometric automorphism. -/ theorem areaForm_comp_linearIsometryEquiv (φ : E ≃ₗᵢ[ℝ] E) (hφ : 0 < LinearMap.det (φ.toLinearEquiv : E →ₗ[ℝ] E)) (x y : E) : o.areaForm (φ x) (φ y) = o.areaForm x y := by convert o.areaForm_map φ (φ x) (φ y) · symm rwa [← o.map_eq_iff_det_pos φ.toLinearEquiv] at hφ rw [@Fact.out (finrank ℝ E = 2), Fintype.card_fin] · simp · simp /-- Auxiliary construction for `Orientation.rightAngleRotation`, rotation by 90 degrees in an oriented real inner product space of dimension 2. -/ irreducible_def rightAngleRotationAux₁ : E →ₗ[ℝ] E := let to_dual : E ≃ₗ[ℝ] E →ₗ[ℝ] ℝ := (InnerProductSpace.toDual ℝ E).toLinearEquiv ≪≫ₗ LinearMap.toContinuousLinearMap.symm ↑to_dual.symm ∘ₗ ω @[simp] theorem inner_rightAngleRotationAux₁_left (x y : E) : ⟪o.rightAngleRotationAux₁ x, y⟫ = ω x y := by -- Porting note: split `simp only` for greater proof control simp only [rightAngleRotationAux₁, LinearEquiv.trans_symm, LinearIsometryEquiv.toLinearEquiv_symm, LinearMap.coe_comp, LinearEquiv.coe_coe, Function.comp_apply, LinearEquiv.trans_apply, LinearIsometryEquiv.coe_toLinearEquiv] rw [InnerProductSpace.toDual_symm_apply] norm_cast @[simp] theorem inner_rightAngleRotationAux₁_right (x y : E) : ⟪x, o.rightAngleRotationAux₁ y⟫ = -ω x y := by rw [real_inner_comm] simp [o.areaForm_swap y x] /-- Auxiliary construction for `Orientation.rightAngleRotation`, rotation by 90 degrees in an oriented real inner product space of dimension 2. -/ def rightAngleRotationAux₂ : E →ₗᵢ[ℝ] E := { o.rightAngleRotationAux₁ with norm_map' := fun x => by dsimp refine le_antisymm ?_ ?_ · cases' eq_or_lt_of_le (norm_nonneg (o.rightAngleRotationAux₁ x)) with h h · rw [← h] positivity refine le_of_mul_le_mul_right ?_ h rw [← real_inner_self_eq_norm_mul_norm, o.inner_rightAngleRotationAux₁_left] exact o.areaForm_le x (o.rightAngleRotationAux₁ x) · let K : Submodule ℝ E := ℝ ∙ x have : Nontrivial Kᗮ := by apply @FiniteDimensional.nontrivial_of_finrank_pos ℝ have : finrank ℝ K ≤ Finset.card {x} := by rw [← Set.toFinset_singleton] exact finrank_span_le_card ({x} : Set E) have : Finset.card {x} = 1 := Finset.card_singleton x have : finrank ℝ K + finrank ℝ Kᗮ = finrank ℝ E := K.finrank_add_finrank_orthogonal have : finrank ℝ E = 2 := Fact.out linarith obtain ⟨w, hw₀⟩ : ∃ w : Kᗮ, w ≠ 0 := exists_ne 0 have hw' : ⟪x, (w : E)⟫ = 0 := Submodule.mem_orthogonal_singleton_iff_inner_right.mp w.2 have hw : (w : E) ≠ 0 := fun h => hw₀ (Submodule.coe_eq_zero.mp h) refine le_of_mul_le_mul_right ?_ (by rwa [norm_pos_iff] : 0 < ‖(w : E)‖) rw [← o.abs_areaForm_of_orthogonal hw'] rw [← o.inner_rightAngleRotationAux₁_left x w] exact abs_real_inner_le_norm (o.rightAngleRotationAux₁ x) w } @[simp] theorem rightAngleRotationAux₁_rightAngleRotationAux₁ (x : E) : o.rightAngleRotationAux₁ (o.rightAngleRotationAux₁ x) = -x := by apply ext_inner_left ℝ intro y have : ⟪o.rightAngleRotationAux₁ y, o.rightAngleRotationAux₁ x⟫ = ⟪y, x⟫ := LinearIsometry.inner_map_map o.rightAngleRotationAux₂ y x rw [o.inner_rightAngleRotationAux₁_right, ← o.inner_rightAngleRotationAux₁_left, this, inner_neg_right] /-- An isometric automorphism of an oriented real inner product space of dimension 2 (usual notation `J`). This automorphism squares to -1. We will define rotations in such a way that this automorphism is equal to rotation by 90 degrees. -/ irreducible_def rightAngleRotation : E ≃ₗᵢ[ℝ] E := LinearIsometryEquiv.ofLinearIsometry o.rightAngleRotationAux₂ (-o.rightAngleRotationAux₁) (by ext; simp [rightAngleRotationAux₂]) (by ext; simp [rightAngleRotationAux₂]) local notation "J" => o.rightAngleRotation @[simp] theorem inner_rightAngleRotation_left (x y : E) : ⟪J x, y⟫ = ω x y := by rw [rightAngleRotation] exact o.inner_rightAngleRotationAux₁_left x y @[simp] theorem inner_rightAngleRotation_right (x y : E) : ⟪x, J y⟫ = -ω x y := by rw [rightAngleRotation] exact o.inner_rightAngleRotationAux₁_right x y @[simp] theorem rightAngleRotation_rightAngleRotation (x : E) : J (J x) = -x := by rw [rightAngleRotation] exact o.rightAngleRotationAux₁_rightAngleRotationAux₁ x @[simp] theorem rightAngleRotation_symm : LinearIsometryEquiv.symm J = LinearIsometryEquiv.trans J (LinearIsometryEquiv.neg ℝ) := by rw [rightAngleRotation] exact LinearIsometryEquiv.toLinearIsometry_injective rfl -- @[simp] -- Porting note (#10618): simp already proves this theorem inner_rightAngleRotation_self (x : E) : ⟪J x, x⟫ = 0 := by simp theorem inner_rightAngleRotation_swap (x y : E) : ⟪x, J y⟫ = -⟪J x, y⟫ := by simp theorem inner_rightAngleRotation_swap' (x y : E) : ⟪J x, y⟫ = -⟪x, J y⟫ := by simp [o.inner_rightAngleRotation_swap x y] theorem inner_comp_rightAngleRotation (x y : E) : ⟪J x, J y⟫ = ⟪x, y⟫ := LinearIsometryEquiv.inner_map_map J x y @[simp] theorem areaForm_rightAngleRotation_left (x y : E) : ω (J x) y = -⟪x, y⟫ := by rw [← o.inner_comp_rightAngleRotation, o.inner_rightAngleRotation_right, neg_neg] @[simp] theorem areaForm_rightAngleRotation_right (x y : E) : ω x (J y) = ⟪x, y⟫ := by rw [← o.inner_rightAngleRotation_left, o.inner_comp_rightAngleRotation] -- @[simp] -- Porting note (#10618): simp already proves this theorem areaForm_comp_rightAngleRotation (x y : E) : ω (J x) (J y) = ω x y := by simp @[simp] theorem rightAngleRotation_trans_rightAngleRotation : LinearIsometryEquiv.trans J J = LinearIsometryEquiv.neg ℝ := by ext; simp theorem rightAngleRotation_neg_orientation (x : E) : (-o).rightAngleRotation x = -o.rightAngleRotation x := by apply ext_inner_right ℝ intro y rw [inner_rightAngleRotation_left] simp @[simp] theorem rightAngleRotation_trans_neg_orientation : (-o).rightAngleRotation = o.rightAngleRotation.trans (LinearIsometryEquiv.neg ℝ) := LinearIsometryEquiv.ext <| o.rightAngleRotation_neg_orientation theorem rightAngleRotation_map {F : Type*} [NormedAddCommGroup F] [InnerProductSpace ℝ F] [hF : Fact (finrank ℝ F = 2)] (φ : E ≃ₗᵢ[ℝ] F) (x : F) : (Orientation.map (Fin 2) φ.toLinearEquiv o).rightAngleRotation x = φ (o.rightAngleRotation (φ.symm x)) := by apply ext_inner_right ℝ intro y rw [inner_rightAngleRotation_left] trans ⟪J (φ.symm x), φ.symm y⟫ · simp [o.areaForm_map] trans ⟪φ (J (φ.symm x)), φ (φ.symm y)⟫ · rw [φ.inner_map_map] · simp /-- `J` commutes with any positively-oriented isometric automorphism. -/ theorem linearIsometryEquiv_comp_rightAngleRotation (φ : E ≃ₗᵢ[ℝ] E) (hφ : 0 < LinearMap.det (φ.toLinearEquiv : E →ₗ[ℝ] E)) (x : E) : φ (J x) = J (φ x) := by convert (o.rightAngleRotation_map φ (φ x)).symm · simp · symm rwa [← o.map_eq_iff_det_pos φ.toLinearEquiv] at hφ rw [@Fact.out (finrank ℝ E = 2), Fintype.card_fin] theorem rightAngleRotation_map' {F : Type*} [NormedAddCommGroup F] [InnerProductSpace ℝ F] [Fact (finrank ℝ F = 2)] (φ : E ≃ₗᵢ[ℝ] F) : (Orientation.map (Fin 2) φ.toLinearEquiv o).rightAngleRotation = (φ.symm.trans o.rightAngleRotation).trans φ := LinearIsometryEquiv.ext <| o.rightAngleRotation_map φ /-- `J` commutes with any positively-oriented isometric automorphism. -/ theorem linearIsometryEquiv_comp_rightAngleRotation' (φ : E ≃ₗᵢ[ℝ] E) (hφ : 0 < LinearMap.det (φ.toLinearEquiv : E →ₗ[ℝ] E)) : LinearIsometryEquiv.trans J φ = φ.trans J := LinearIsometryEquiv.ext <| o.linearIsometryEquiv_comp_rightAngleRotation φ hφ /-- For a nonzero vector `x` in an oriented two-dimensional real inner product space `E`, `![x, J x]` forms an (orthogonal) basis for `E`. -/ def basisRightAngleRotation (x : E) (hx : x ≠ 0) : Basis (Fin 2) ℝ E := @basisOfLinearIndependentOfCardEqFinrank ℝ _ _ _ _ _ _ _ ![x, J x] (linearIndependent_of_ne_zero_of_inner_eq_zero (fun i => by fin_cases i <;> simp [hx]) (by intro i j hij fin_cases i <;> fin_cases j <;> simp_all)) (@Fact.out (finrank ℝ E = 2)).symm @[simp] theorem coe_basisRightAngleRotation (x : E) (hx : x ≠ 0) : ⇑(o.basisRightAngleRotation x hx) = ![x, J x] := coe_basisOfLinearIndependentOfCardEqFinrank _ _ /-- For vectors `a x y : E`, the identity `⟪a, x⟫ * ⟪a, y⟫ + ω a x * ω a y = ‖a‖ ^ 2 * ⟪x, y⟫`. (See `Orientation.inner_mul_inner_add_areaForm_mul_areaForm` for the "applied" form.)-/ theorem inner_mul_inner_add_areaForm_mul_areaForm' (a x : E) : ⟪a, x⟫ • innerₛₗ ℝ a + ω a x • ω a = ‖a‖ ^ 2 • innerₛₗ ℝ x := by by_cases ha : a = 0 · simp [ha] apply (o.basisRightAngleRotation a ha).ext intro i fin_cases i · simp only [Fin.mk_zero, coe_basisRightAngleRotation, Matrix.cons_val_zero, LinearMap.add_apply, LinearMap.smul_apply, innerₛₗ_apply, real_inner_self_eq_norm_sq, smul_eq_mul, areaForm_apply_self, mul_zero, add_zero, Real.rpow_two, real_inner_comm] ring · simp only [Fin.mk_one, coe_basisRightAngleRotation, Matrix.cons_val_one, Matrix.head_cons, LinearMap.add_apply, LinearMap.smul_apply, innerₛₗ_apply, inner_rightAngleRotation_right, areaForm_apply_self, neg_zero, smul_eq_mul, mul_zero, areaForm_rightAngleRotation_right, real_inner_self_eq_norm_sq, zero_add, Real.rpow_two, mul_neg] rw [o.areaForm_swap] ring /-- For vectors `a x y : E`, the identity `⟪a, x⟫ * ⟪a, y⟫ + ω a x * ω a y = ‖a‖ ^ 2 * ⟪x, y⟫`. -/ theorem inner_mul_inner_add_areaForm_mul_areaForm (a x y : E) : ⟪a, x⟫ * ⟪a, y⟫ + ω a x * ω a y = ‖a‖ ^ 2 * ⟪x, y⟫ := congr_arg (fun f : E →ₗ[ℝ] ℝ => f y) (o.inner_mul_inner_add_areaForm_mul_areaForm' a x) theorem inner_sq_add_areaForm_sq (a b : E) : ⟪a, b⟫ ^ 2 + ω a b ^ 2 = ‖a‖ ^ 2 * ‖b‖ ^ 2 := by simpa [sq, real_inner_self_eq_norm_sq] using o.inner_mul_inner_add_areaForm_mul_areaForm a b b /-- For vectors `a x y : E`, the identity `⟪a, x⟫ * ω a y - ω a x * ⟪a, y⟫ = ‖a‖ ^ 2 * ω x y`. (See `Orientation.inner_mul_areaForm_sub` for the "applied" form.) -/ theorem inner_mul_areaForm_sub' (a x : E) : ⟪a, x⟫ • ω a - ω a x • innerₛₗ ℝ a = ‖a‖ ^ 2 • ω x := by by_cases ha : a = 0 · simp [ha] apply (o.basisRightAngleRotation a ha).ext intro i fin_cases i · simp only [o.areaForm_swap a x, neg_smul, sub_neg_eq_add, Fin.mk_zero, coe_basisRightAngleRotation, Matrix.cons_val_zero, LinearMap.add_apply, LinearMap.smul_apply, areaForm_apply_self, smul_eq_mul, mul_zero, innerₛₗ_apply, real_inner_self_eq_norm_sq, zero_add, Real.rpow_two] ring · simp only [Fin.mk_one, coe_basisRightAngleRotation, Matrix.cons_val_one, Matrix.head_cons, LinearMap.sub_apply, LinearMap.smul_apply, areaForm_rightAngleRotation_right, real_inner_self_eq_norm_sq, smul_eq_mul, innerₛₗ_apply, inner_rightAngleRotation_right, areaForm_apply_self, neg_zero, mul_zero, sub_zero, Real.rpow_two, real_inner_comm] ring /-- For vectors `a x y : E`, the identity `⟪a, x⟫ * ω a y - ω a x * ⟪a, y⟫ = ‖a‖ ^ 2 * ω x y`. -/ theorem inner_mul_areaForm_sub (a x y : E) : ⟪a, x⟫ * ω a y - ω a x * ⟪a, y⟫ = ‖a‖ ^ 2 * ω x y := congr_arg (fun f : E →ₗ[ℝ] ℝ => f y) (o.inner_mul_areaForm_sub' a x) theorem nonneg_inner_and_areaForm_eq_zero_iff_sameRay (x y : E) : 0 ≤ ⟪x, y⟫ ∧ ω x y = 0 ↔ SameRay ℝ x y := by by_cases hx : x = 0 · simp [hx] constructor · let a : ℝ := (o.basisRightAngleRotation x hx).repr y 0 let b : ℝ := (o.basisRightAngleRotation x hx).repr y 1 suffices ↑0 ≤ a * ‖x‖ ^ 2 ∧ b * ‖x‖ ^ 2 = 0 → SameRay ℝ x (a • x + b • J x) by rw [← (o.basisRightAngleRotation x hx).sum_repr y] simp only [Fin.sum_univ_succ, coe_basisRightAngleRotation, Matrix.cons_val_zero, Fin.succ_zero_eq_one', Finset.univ_eq_empty, Finset.sum_empty, areaForm_apply_self, map_smul, map_add, real_inner_smul_right, inner_add_right, Matrix.cons_val_one, Matrix.head_cons, Algebra.id.smul_eq_mul, areaForm_rightAngleRotation_right, mul_zero, add_zero, zero_add, neg_zero, inner_rightAngleRotation_right, real_inner_self_eq_norm_sq, zero_smul, one_smul] exact this rintro ⟨ha, hb⟩ have hx' : 0 < ‖x‖ := by simpa using hx have ha' : 0 ≤ a := nonneg_of_mul_nonneg_left ha (by positivity) have hb' : b = 0 := eq_zero_of_ne_zero_of_mul_right_eq_zero (pow_ne_zero 2 hx'.ne') hb exact (SameRay.sameRay_nonneg_smul_right x ha').add_right $ by simp [hb'] · intro h obtain ⟨r, hr, rfl⟩ := h.exists_nonneg_left hx simp only [inner_smul_right, real_inner_self_eq_norm_sq, LinearMap.map_smulₛₗ, areaForm_apply_self, Algebra.id.smul_eq_mul, mul_zero, eq_self_iff_true, and_true_iff] positivity /-- A complex-valued real-bilinear map on an oriented real inner product space of dimension 2. Its real part is the inner product and its imaginary part is `Orientation.areaForm`. On `ℂ` with the standard orientation, `kahler w z = conj w * z`; see `Complex.kahler`. -/ def kahler : E →ₗ[ℝ] E →ₗ[ℝ] ℂ := LinearMap.llcomp ℝ E ℝ ℂ Complex.ofRealCLM ∘ₗ innerₛₗ ℝ + LinearMap.llcomp ℝ E ℝ ℂ ((LinearMap.lsmul ℝ ℂ).flip Complex.I) ∘ₗ ω theorem kahler_apply_apply (x y : E) : o.kahler x y = ⟪x, y⟫ + ω x y • Complex.I := rfl theorem kahler_swap (x y : E) : o.kahler x y = conj (o.kahler y x) := by simp only [kahler_apply_apply] rw [real_inner_comm, areaForm_swap] simp [Complex.conj_ofReal] @[simp] theorem kahler_apply_self (x : E) : o.kahler x x = ‖x‖ ^ 2 := by simp [kahler_apply_apply, real_inner_self_eq_norm_sq] @[simp] theorem kahler_rightAngleRotation_left (x y : E) : o.kahler (J x) y = -Complex.I * o.kahler x y := by simp only [o.areaForm_rightAngleRotation_left, o.inner_rightAngleRotation_left, o.kahler_apply_apply, Complex.ofReal_neg, Complex.real_smul] linear_combination ω x y * Complex.I_sq @[simp] theorem kahler_rightAngleRotation_right (x y : E) : o.kahler x (J y) = Complex.I * o.kahler x y := by simp only [o.areaForm_rightAngleRotation_right, o.inner_rightAngleRotation_right, o.kahler_apply_apply, Complex.ofReal_neg, Complex.real_smul] linear_combination -ω x y * Complex.I_sq -- @[simp] -- Porting note: simp normal form is `kahler_comp_rightAngleRotation'` theorem kahler_comp_rightAngleRotation (x y : E) : o.kahler (J x) (J y) = o.kahler x y := by simp only [kahler_rightAngleRotation_left, kahler_rightAngleRotation_right] linear_combination -o.kahler x y * Complex.I_sq theorem kahler_comp_rightAngleRotation' (x y : E) : -(Complex.I * (Complex.I * o.kahler x y)) = o.kahler x y := by linear_combination -o.kahler x y * Complex.I_sq @[simp] theorem kahler_neg_orientation (x y : E) : (-o).kahler x y = conj (o.kahler x y) := by simp [kahler_apply_apply, Complex.conj_ofReal] theorem kahler_mul (a x y : E) : o.kahler x a * o.kahler a y = ‖a‖ ^ 2 * o.kahler x y := by trans ((‖a‖ ^ 2 :) : ℂ) * o.kahler x y · apply Complex.ext · simp only [o.kahler_apply_apply, Complex.add_im, Complex.add_re, Complex.I_im, Complex.I_re, Complex.mul_im, Complex.mul_re, Complex.ofReal_im, Complex.ofReal_re, Complex.real_smul] rw [real_inner_comm a x, o.areaForm_swap x a] linear_combination o.inner_mul_inner_add_areaForm_mul_areaForm a x y · simp only [o.kahler_apply_apply, Complex.add_im, Complex.add_re, Complex.I_im, Complex.I_re, Complex.mul_im, Complex.mul_re, Complex.ofReal_im, Complex.ofReal_re, Complex.real_smul] rw [real_inner_comm a x, o.areaForm_swap x a] linear_combination o.inner_mul_areaForm_sub a x y · norm_cast theorem normSq_kahler (x y : E) : Complex.normSq (o.kahler x y) = ‖x‖ ^ 2 * ‖y‖ ^ 2 := by simpa [kahler_apply_apply, Complex.normSq, sq] using o.inner_sq_add_areaForm_sq x y theorem abs_kahler (x y : E) : Complex.abs (o.kahler x y) = ‖x‖ * ‖y‖ := by rw [← sq_eq_sq, Complex.sq_abs] · linear_combination o.normSq_kahler x y · positivity · positivity theorem norm_kahler (x y : E) : ‖o.kahler x y‖ = ‖x‖ * ‖y‖ := by simpa using o.abs_kahler x y theorem eq_zero_or_eq_zero_of_kahler_eq_zero {x y : E} (hx : o.kahler x y = 0) : x = 0 ∨ y = 0 := by have : ‖x‖ * ‖y‖ = 0 := by simpa [hx] using (o.norm_kahler x y).symm cases' eq_zero_or_eq_zero_of_mul_eq_zero this with h h · left simpa using h · right simpa using h theorem kahler_eq_zero_iff (x y : E) : o.kahler x y = 0 ↔ x = 0 ∨ y = 0 := by refine ⟨o.eq_zero_or_eq_zero_of_kahler_eq_zero, ?_⟩ rintro (rfl | rfl) <;> simp theorem kahler_ne_zero {x y : E} (hx : x ≠ 0) (hy : y ≠ 0) : o.kahler x y ≠ 0 := by apply mt o.eq_zero_or_eq_zero_of_kahler_eq_zero tauto theorem kahler_ne_zero_iff (x y : E) : o.kahler x y ≠ 0 ↔ x ≠ 0 ∧ y ≠ 0 := by refine ⟨?_, fun h => o.kahler_ne_zero h.1 h.2⟩ contrapose simp only [not_and_or, Classical.not_not, kahler_apply_apply, Complex.real_smul] rintro (rfl | rfl) <;> simp theorem kahler_map {F : Type*} [NormedAddCommGroup F] [InnerProductSpace ℝ F] [hF : Fact (finrank ℝ F = 2)] (φ : E ≃ₗᵢ[ℝ] F) (x y : F) : (Orientation.map (Fin 2) φ.toLinearEquiv o).kahler x y = o.kahler (φ.symm x) (φ.symm y) := by simp [kahler_apply_apply, areaForm_map] /-- The bilinear map `kahler` is invariant under pullback by a positively-oriented isometric automorphism. -/ theorem kahler_comp_linearIsometryEquiv (φ : E ≃ₗᵢ[ℝ] E) (hφ : 0 < LinearMap.det (φ.toLinearEquiv : E →ₗ[ℝ] E)) (x y : E) : o.kahler (φ x) (φ y) = o.kahler x y := by simp [kahler_apply_apply, o.areaForm_comp_linearIsometryEquiv φ hφ] end Orientation namespace Complex attribute [local instance] Complex.finrank_real_complex_fact @[simp] protected theorem areaForm (w z : ℂ) : Complex.orientation.areaForm w z = (conj w * z).im := by let o := Complex.orientation simp only [o.areaForm_to_volumeForm, o.volumeForm_robust Complex.orthonormalBasisOneI rfl, Basis.det_apply, Matrix.det_fin_two, Basis.toMatrix_apply, toBasis_orthonormalBasisOneI, Matrix.cons_val_zero, coe_basisOneI_repr, Matrix.cons_val_one, Matrix.head_cons, mul_im, conj_re, conj_im] ring @[simp] protected theorem rightAngleRotation (z : ℂ) : Complex.orientation.rightAngleRotation z = I * z := by apply ext_inner_right ℝ intro w rw [Orientation.inner_rightAngleRotation_left] simp only [Complex.areaForm, Complex.inner, mul_re, mul_im, conj_re, conj_im, map_mul, conj_I, neg_re, neg_im, I_re, I_im] ring @[simp] protected theorem kahler (w z : ℂ) : Complex.orientation.kahler w z = conj w * z := by rw [Orientation.kahler_apply_apply] apply Complex.ext <;> simp end Complex namespace Orientation local notation "ω" => o.areaForm local notation "J" => o.rightAngleRotation open Complex -- Porting note: The instance `finrank_real_complex_fact` cannot be found by synthesis for -- `areaForm_map`, `rightAngleRotation_map` and `kahler_map` in the three theorems below, -- so it has to be provided by unification (i.e. by naming the instance-implicit argument where -- it belongs and using `(hF := _)`). /-- The area form on an oriented real inner product space of dimension 2 can be evaluated in terms of a complex-number representation of the space. -/ theorem areaForm_map_complex (f : E ≃ₗᵢ[ℝ] ℂ) (hf : Orientation.map (Fin 2) f.toLinearEquiv o = Complex.orientation) (x y : E) : ω x y = (conj (f x) * f y).im := by rw [← Complex.areaForm, ← hf, areaForm_map (hF := _)] iterate 2 rw [LinearIsometryEquiv.symm_apply_apply] /-- The rotation by 90 degrees on an oriented real inner product space of dimension 2 can be evaluated in terms of a complex-number representation of the space. -/ theorem rightAngleRotation_map_complex (f : E ≃ₗᵢ[ℝ] ℂ) (hf : Orientation.map (Fin 2) f.toLinearEquiv o = Complex.orientation) (x : E) : f (J x) = I * f x := by rw [← Complex.rightAngleRotation, ← hf, rightAngleRotation_map (hF := _), LinearIsometryEquiv.symm_apply_apply] /-- The Kahler form on an oriented real inner product space of dimension 2 can be evaluated in terms of a complex-number representation of the space. -/ theorem kahler_map_complex (f : E ≃ₗᵢ[ℝ] ℂ) (hf : Orientation.map (Fin 2) f.toLinearEquiv o = Complex.orientation) (x y : E) : o.kahler x y = conj (f x) * f y := by rw [← Complex.kahler, ← hf, kahler_map (hF := _)] iterate 2 rw [LinearIsometryEquiv.symm_apply_apply] end Orientation
Analysis\InnerProductSpace\WeakOperatorTopology.lean
/- Copyright (c) 2024 Frédéric Dupuis. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Frédéric Dupuis -/ import Mathlib.Analysis.InnerProductSpace.Dual import Mathlib.Analysis.Normed.Operator.WeakOperatorTopology /-! # The weak operator topology in Hilbert spaces This file gives a few properties of the weak operator topology that are specific to operators on Hilbert spaces. This mostly involves using the Fréchet-Riesz representation to convert between applications of elements of the dual and inner products with vectors in the space. -/ open scoped Topology namespace ContinuousLinearMapWOT variable {𝕜 : Type*} {E : Type*} {F : Type*} [RCLike 𝕜] [AddCommGroup E] [TopologicalSpace E] [Module 𝕜 E] [NormedAddCommGroup F] [InnerProductSpace 𝕜 F] @[ext] lemma ext_inner {A B : E →WOT[𝕜] F} (h : ∀ x y, ⟪y, A x⟫_𝕜 = ⟪y, B x⟫_𝕜) : A = B := by rw [ext_iff] exact fun x => ext_inner_left 𝕜 fun y => h x y open Filter in /-- The defining property of the weak operator topology: a function `f` tends to `A : E →WOT[𝕜] F` along filter `l` iff `⟪y, (f a) x⟫` tends to `⟪y, A x⟫` along the same filter. -/ lemma tendsto_iff_forall_inner_apply_tendsto [CompleteSpace F] {α : Type*} {l : Filter α} {f : α → E →WOT[𝕜] F} {A : E →WOT[𝕜] F} : Tendsto f l (𝓝 A) ↔ ∀ x y, Tendsto (fun a => ⟪y, (f a) x⟫_𝕜) l (𝓝 ⟪y, A x⟫_𝕜) := by simp only [← InnerProductSpace.toDual_apply] refine ⟨fun h x y => ?_, fun h => ?_⟩ · exact (tendsto_iff_forall_dual_apply_tendsto.mp h) _ _ · have h' : ∀ (x : E) (y : NormedSpace.Dual 𝕜 F), Tendsto (fun a => y (f a x)) l (𝓝 (y (A x))) := by intro x y convert h x ((InnerProductSpace.toDual 𝕜 F).symm y) <;> simp exact tendsto_iff_forall_dual_apply_tendsto.mpr h' lemma le_nhds_iff_forall_inner_apply_le_nhds [CompleteSpace F] {l : Filter (E →WOT[𝕜] F)} {A : E →WOT[𝕜] F} : l ≤ 𝓝 A ↔ ∀ x y, l.map (fun T => ⟪y, T x⟫_𝕜) ≤ 𝓝 (⟪y, A x⟫_𝕜) := tendsto_iff_forall_inner_apply_tendsto (f := id) end ContinuousLinearMapWOT
Analysis\LocallyConvex\AbsConvex.lean
/- Copyright (c) 2022 Moritz Doll. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Moritz Doll -/ import Mathlib.Analysis.LocallyConvex.BalancedCoreHull import Mathlib.Analysis.LocallyConvex.WithSeminorms import Mathlib.Analysis.Convex.Gauge /-! # Absolutely convex sets A set is called absolutely convex or disked if it is convex and balanced. The importance of absolutely convex sets comes from the fact that every locally convex topological vector space has a basis consisting of absolutely convex sets. ## Main definitions * `gaugeSeminormFamily`: the seminorm family induced by all open absolutely convex neighborhoods of zero. ## Main statements * `with_gaugeSeminormFamily`: the topology of a locally convex space is induced by the family `gaugeSeminormFamily`. ## TODO * Define the disked hull ## Tags disks, convex, balanced -/ open NormedField Set open NNReal Pointwise Topology variable {𝕜 E F G ι : Type*} section NontriviallyNormedField variable (𝕜 E) {s : Set E} variable [NontriviallyNormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] variable [Module ℝ E] [SMulCommClass ℝ 𝕜 E] variable [TopologicalSpace E] [LocallyConvexSpace ℝ E] [ContinuousSMul 𝕜 E] theorem nhds_basis_abs_convex : (𝓝 (0 : E)).HasBasis (fun s : Set E => s ∈ 𝓝 (0 : E) ∧ Balanced 𝕜 s ∧ Convex ℝ s) id := by refine (LocallyConvexSpace.convex_basis_zero ℝ E).to_hasBasis (fun s hs => ?_) fun s hs => ⟨s, ⟨hs.1, hs.2.2⟩, rfl.subset⟩ refine ⟨convexHull ℝ (balancedCore 𝕜 s), ?_, convexHull_min (balancedCore_subset s) hs.2⟩ refine ⟨Filter.mem_of_superset (balancedCore_mem_nhds_zero hs.1) (subset_convexHull ℝ _), ?_⟩ refine ⟨(balancedCore_balanced s).convexHull, ?_⟩ exact convex_convexHull ℝ (balancedCore 𝕜 s) variable [ContinuousSMul ℝ E] [TopologicalAddGroup E] theorem nhds_basis_abs_convex_open : (𝓝 (0 : E)).HasBasis (fun s => (0 : E) ∈ s ∧ IsOpen s ∧ Balanced 𝕜 s ∧ Convex ℝ s) id := by refine (nhds_basis_abs_convex 𝕜 E).to_hasBasis ?_ ?_ · rintro s ⟨hs_nhds, hs_balanced, hs_convex⟩ refine ⟨interior s, ?_, interior_subset⟩ exact ⟨mem_interior_iff_mem_nhds.mpr hs_nhds, isOpen_interior, hs_balanced.interior (mem_interior_iff_mem_nhds.mpr hs_nhds), hs_convex.interior⟩ rintro s ⟨hs_zero, hs_open, hs_balanced, hs_convex⟩ exact ⟨s, ⟨hs_open.mem_nhds hs_zero, hs_balanced, hs_convex⟩, rfl.subset⟩ end NontriviallyNormedField section AbsolutelyConvexSets variable [TopologicalSpace E] [AddCommMonoid E] [Zero E] [SeminormedRing 𝕜] variable [SMul 𝕜 E] [SMul ℝ E] variable (𝕜 E) /-- The type of absolutely convex open sets. -/ def AbsConvexOpenSets := { s : Set E // (0 : E) ∈ s ∧ IsOpen s ∧ Balanced 𝕜 s ∧ Convex ℝ s } noncomputable instance AbsConvexOpenSets.instCoeTC : CoeTC (AbsConvexOpenSets 𝕜 E) (Set E) := ⟨Subtype.val⟩ namespace AbsConvexOpenSets variable {𝕜 E} theorem coe_zero_mem (s : AbsConvexOpenSets 𝕜 E) : (0 : E) ∈ (s : Set E) := s.2.1 theorem coe_isOpen (s : AbsConvexOpenSets 𝕜 E) : IsOpen (s : Set E) := s.2.2.1 theorem coe_nhds (s : AbsConvexOpenSets 𝕜 E) : (s : Set E) ∈ 𝓝 (0 : E) := s.coe_isOpen.mem_nhds s.coe_zero_mem theorem coe_balanced (s : AbsConvexOpenSets 𝕜 E) : Balanced 𝕜 (s : Set E) := s.2.2.2.1 theorem coe_convex (s : AbsConvexOpenSets 𝕜 E) : Convex ℝ (s : Set E) := s.2.2.2.2 end AbsConvexOpenSets instance AbsConvexOpenSets.instNonempty : Nonempty (AbsConvexOpenSets 𝕜 E) := by rw [← exists_true_iff_nonempty] dsimp only [AbsConvexOpenSets] rw [Subtype.exists] exact ⟨Set.univ, ⟨mem_univ 0, isOpen_univ, balanced_univ, convex_univ⟩, trivial⟩ end AbsolutelyConvexSets variable [RCLike 𝕜] variable [AddCommGroup E] [TopologicalSpace E] variable [Module 𝕜 E] [Module ℝ E] [IsScalarTower ℝ 𝕜 E] variable [ContinuousSMul ℝ E] variable (𝕜 E) /-- The family of seminorms defined by the gauges of absolute convex open sets. -/ noncomputable def gaugeSeminormFamily : SeminormFamily 𝕜 E (AbsConvexOpenSets 𝕜 E) := fun s => gaugeSeminorm s.coe_balanced s.coe_convex (absorbent_nhds_zero s.coe_nhds) variable {𝕜 E} theorem gaugeSeminormFamily_ball (s : AbsConvexOpenSets 𝕜 E) : (gaugeSeminormFamily 𝕜 E s).ball 0 1 = (s : Set E) := by dsimp only [gaugeSeminormFamily] rw [Seminorm.ball_zero_eq] simp_rw [gaugeSeminorm_toFun] exact gauge_lt_one_eq_self_of_isOpen s.coe_convex s.coe_zero_mem s.coe_isOpen variable [TopologicalAddGroup E] [ContinuousSMul 𝕜 E] variable [SMulCommClass ℝ 𝕜 E] [LocallyConvexSpace ℝ E] /-- The topology of a locally convex space is induced by the gauge seminorm family. -/ theorem with_gaugeSeminormFamily : WithSeminorms (gaugeSeminormFamily 𝕜 E) := by refine SeminormFamily.withSeminorms_of_hasBasis _ ?_ refine (nhds_basis_abs_convex_open 𝕜 E).to_hasBasis (fun s hs => ?_) fun s hs => ?_ · refine ⟨s, ⟨?_, rfl.subset⟩⟩ convert (gaugeSeminormFamily _ _).basisSets_singleton_mem ⟨s, hs⟩ one_pos rw [gaugeSeminormFamily_ball, Subtype.coe_mk] refine ⟨s, ⟨?_, rfl.subset⟩⟩ rw [SeminormFamily.basisSets_iff] at hs rcases hs with ⟨t, r, hr, rfl⟩ rw [Seminorm.ball_finset_sup_eq_iInter _ _ _ hr] -- We have to show that the intersection contains zero, is open, balanced, and convex refine ⟨mem_iInter₂.mpr fun _ _ => by simp [Seminorm.mem_ball_zero, hr], isOpen_biInter_finset fun S _ => ?_, balanced_iInter₂ fun _ _ => Seminorm.balanced_ball_zero _ _, convex_iInter₂ fun _ _ => Seminorm.convex_ball _ _ _⟩ -- The only nontrivial part is to show that the ball is open have hr' : r = ‖(r : 𝕜)‖ * 1 := by simp [abs_of_pos hr] have hr'' : (r : 𝕜) ≠ 0 := by simp [hr.ne'] rw [hr', ← Seminorm.smul_ball_zero hr'', gaugeSeminormFamily_ball] exact S.coe_isOpen.smul₀ hr''
Analysis\LocallyConvex\BalancedCoreHull.lean
/- Copyright (c) 2022 Moritz Doll. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Moritz Doll -/ import Mathlib.Analysis.LocallyConvex.Basic /-! # Balanced Core and Balanced Hull ## Main definitions * `balancedCore`: The largest balanced subset of a set `s`. * `balancedHull`: The smallest balanced superset of a set `s`. ## Main statements * `balancedCore_eq_iInter`: Characterization of the balanced core as an intersection over subsets. * `nhds_basis_closed_balanced`: The closed balanced sets form a basis of the neighborhood filter. ## Implementation details The balanced core and hull are implemented differently: for the core we take the obvious definition of the union over all balanced sets that are contained in `s`, whereas for the hull, we take the union over `r • s`, for `r` the scalars with `‖r‖ ≤ 1`. We show that `balancedHull` has the defining properties of a hull in `Balanced.balancedHull_subset_of_subset` and `subset_balancedHull`. For the core we need slightly stronger assumptions to obtain a characterization as an intersection, this is `balancedCore_eq_iInter`. ## References * [Bourbaki, *Topological Vector Spaces*][bourbaki1987] ## Tags balanced -/ open Set Pointwise Topology Filter variable {𝕜 E ι : Type*} section balancedHull section SeminormedRing variable [SeminormedRing 𝕜] section SMul variable (𝕜) [SMul 𝕜 E] {s t : Set E} {x : E} /-- The largest balanced subset of `s`. -/ def balancedCore (s : Set E) := ⋃₀ { t : Set E | Balanced 𝕜 t ∧ t ⊆ s } /-- Helper definition to prove `balanced_core_eq_iInter`-/ def balancedCoreAux (s : Set E) := ⋂ (r : 𝕜) (_ : 1 ≤ ‖r‖), r • s /-- The smallest balanced superset of `s`. -/ def balancedHull (s : Set E) := ⋃ (r : 𝕜) (_ : ‖r‖ ≤ 1), r • s variable {𝕜} theorem balancedCore_subset (s : Set E) : balancedCore 𝕜 s ⊆ s := sUnion_subset fun _ ht => ht.2 theorem balancedCore_empty : balancedCore 𝕜 (∅ : Set E) = ∅ := eq_empty_of_subset_empty (balancedCore_subset _) theorem mem_balancedCore_iff : x ∈ balancedCore 𝕜 s ↔ ∃ t, Balanced 𝕜 t ∧ t ⊆ s ∧ x ∈ t := by simp_rw [balancedCore, mem_sUnion, mem_setOf_eq, and_assoc] theorem smul_balancedCore_subset (s : Set E) {a : 𝕜} (ha : ‖a‖ ≤ 1) : a • balancedCore 𝕜 s ⊆ balancedCore 𝕜 s := by rintro x ⟨y, hy, rfl⟩ rw [mem_balancedCore_iff] at hy rcases hy with ⟨t, ht1, ht2, hy⟩ exact ⟨t, ⟨ht1, ht2⟩, ht1 a ha (smul_mem_smul_set hy)⟩ theorem balancedCore_balanced (s : Set E) : Balanced 𝕜 (balancedCore 𝕜 s) := fun _ => smul_balancedCore_subset s /-- The balanced core of `t` is maximal in the sense that it contains any balanced subset `s` of `t`. -/ theorem Balanced.subset_balancedCore_of_subset (hs : Balanced 𝕜 s) (h : s ⊆ t) : s ⊆ balancedCore 𝕜 t := subset_sUnion_of_mem ⟨hs, h⟩ theorem mem_balancedCoreAux_iff : x ∈ balancedCoreAux 𝕜 s ↔ ∀ r : 𝕜, 1 ≤ ‖r‖ → x ∈ r • s := mem_iInter₂ theorem mem_balancedHull_iff : x ∈ balancedHull 𝕜 s ↔ ∃ r : 𝕜, ‖r‖ ≤ 1 ∧ x ∈ r • s := by simp [balancedHull] /-- The balanced hull of `s` is minimal in the sense that it is contained in any balanced superset `t` of `s`. -/ theorem Balanced.balancedHull_subset_of_subset (ht : Balanced 𝕜 t) (h : s ⊆ t) : balancedHull 𝕜 s ⊆ t := by intros x hx obtain ⟨r, hr, y, hy, rfl⟩ := mem_balancedHull_iff.1 hx exact ht.smul_mem hr (h hy) end SMul section Module variable [AddCommGroup E] [Module 𝕜 E] {s : Set E} theorem balancedCore_zero_mem (hs : (0 : E) ∈ s) : (0 : E) ∈ balancedCore 𝕜 s := mem_balancedCore_iff.2 ⟨0, balanced_zero, zero_subset.2 hs, Set.zero_mem_zero⟩ theorem balancedCore_nonempty_iff : (balancedCore 𝕜 s).Nonempty ↔ (0 : E) ∈ s := ⟨fun h => zero_subset.1 <| (zero_smul_set h).superset.trans <| (balancedCore_balanced s (0 : 𝕜) <| norm_zero.trans_le zero_le_one).trans <| balancedCore_subset _, fun h => ⟨0, balancedCore_zero_mem h⟩⟩ variable (𝕜) theorem subset_balancedHull [NormOneClass 𝕜] {s : Set E} : s ⊆ balancedHull 𝕜 s := fun _ hx => mem_balancedHull_iff.2 ⟨1, norm_one.le, _, hx, one_smul _ _⟩ variable {𝕜} theorem balancedHull.balanced (s : Set E) : Balanced 𝕜 (balancedHull 𝕜 s) := by intro a ha simp_rw [balancedHull, smul_set_iUnion₂, subset_def, mem_iUnion₂] rintro x ⟨r, hr, hx⟩ rw [← smul_assoc] at hx exact ⟨a • r, (SeminormedRing.norm_mul _ _).trans (mul_le_one ha (norm_nonneg r) hr), hx⟩ end Module end SeminormedRing section NormedField variable [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] {s t : Set E} @[simp] theorem balancedCoreAux_empty : balancedCoreAux 𝕜 (∅ : Set E) = ∅ := by simp_rw [balancedCoreAux, iInter₂_eq_empty_iff, smul_set_empty] exact fun _ => ⟨1, norm_one.ge, not_mem_empty _⟩ theorem balancedCoreAux_subset (s : Set E) : balancedCoreAux 𝕜 s ⊆ s := fun x hx => by simpa only [one_smul] using mem_balancedCoreAux_iff.1 hx 1 norm_one.ge theorem balancedCoreAux_balanced (h0 : (0 : E) ∈ balancedCoreAux 𝕜 s) : Balanced 𝕜 (balancedCoreAux 𝕜 s) := by rintro a ha x ⟨y, hy, rfl⟩ obtain rfl | h := eq_or_ne a 0 · simp_rw [zero_smul, h0] rw [mem_balancedCoreAux_iff] at hy ⊢ intro r hr have h'' : 1 ≤ ‖a⁻¹ • r‖ := by rw [norm_smul, norm_inv] exact one_le_mul_of_one_le_of_one_le (one_le_inv (norm_pos_iff.mpr h) ha) hr have h' := hy (a⁻¹ • r) h'' rwa [smul_assoc, mem_inv_smul_set_iff₀ h] at h' theorem balancedCoreAux_maximal (h : t ⊆ s) (ht : Balanced 𝕜 t) : t ⊆ balancedCoreAux 𝕜 s := by refine fun x hx => mem_balancedCoreAux_iff.2 fun r hr => ?_ rw [mem_smul_set_iff_inv_smul_mem₀ (norm_pos_iff.mp <| zero_lt_one.trans_le hr)] refine h (ht.smul_mem ?_ hx) rw [norm_inv] exact inv_le_one hr theorem balancedCore_subset_balancedCoreAux : balancedCore 𝕜 s ⊆ balancedCoreAux 𝕜 s := balancedCoreAux_maximal (balancedCore_subset s) (balancedCore_balanced s) theorem balancedCore_eq_iInter (hs : (0 : E) ∈ s) : balancedCore 𝕜 s = ⋂ (r : 𝕜) (_ : 1 ≤ ‖r‖), r • s := by refine balancedCore_subset_balancedCoreAux.antisymm ?_ refine (balancedCoreAux_balanced ?_).subset_balancedCore_of_subset (balancedCoreAux_subset s) exact balancedCore_subset_balancedCoreAux (balancedCore_zero_mem hs) theorem subset_balancedCore (ht : (0 : E) ∈ t) (hst : ∀ a : 𝕜, ‖a‖ ≤ 1 → a • s ⊆ t) : s ⊆ balancedCore 𝕜 t := by rw [balancedCore_eq_iInter ht] refine subset_iInter₂ fun a ha => ?_ rw [← smul_inv_smul₀ (norm_pos_iff.mp <| zero_lt_one.trans_le ha) s] refine smul_set_mono (hst _ ?_) rw [norm_inv] exact inv_le_one ha end NormedField end balancedHull /-! ### Topological properties -/ section Topology variable [NontriviallyNormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] [ContinuousSMul 𝕜 E] {U : Set E} protected theorem IsClosed.balancedCore (hU : IsClosed U) : IsClosed (balancedCore 𝕜 U) := by by_cases h : (0 : E) ∈ U · rw [balancedCore_eq_iInter h] refine isClosed_iInter fun a => ?_ refine isClosed_iInter fun ha => ?_ have ha' := lt_of_lt_of_le zero_lt_one ha rw [norm_pos_iff] at ha' exact isClosedMap_smul_of_ne_zero ha' U hU · have : balancedCore 𝕜 U = ∅ := by contrapose! h exact balancedCore_nonempty_iff.mp h rw [this] exact isClosed_empty theorem balancedCore_mem_nhds_zero (hU : U ∈ 𝓝 (0 : E)) : balancedCore 𝕜 U ∈ 𝓝 (0 : E) := by -- Getting neighborhoods of the origin for `0 : 𝕜` and `0 : E` obtain ⟨r, V, hr, hV, hrVU⟩ : ∃ (r : ℝ) (V : Set E), 0 < r ∧ V ∈ 𝓝 (0 : E) ∧ ∀ (c : 𝕜) (y : E), ‖c‖ < r → y ∈ V → c • y ∈ U := by have h : Filter.Tendsto (fun x : 𝕜 × E => x.fst • x.snd) (𝓝 (0, 0)) (𝓝 0) := continuous_smul.tendsto' (0, 0) _ (smul_zero _) simpa only [← Prod.exists', ← Prod.forall', ← and_imp, ← and_assoc, exists_prop] using h.basis_left (NormedAddCommGroup.nhds_zero_basis_norm_lt.prod_nhds (𝓝 _).basis_sets) U hU rcases NormedField.exists_norm_lt 𝕜 hr with ⟨y, hy₀, hyr⟩ rw [norm_pos_iff] at hy₀ have : y • V ∈ 𝓝 (0 : E) := (set_smul_mem_nhds_zero_iff hy₀).mpr hV -- It remains to show that `y • V ⊆ balancedCore 𝕜 U` refine Filter.mem_of_superset this (subset_balancedCore (mem_of_mem_nhds hU) fun a ha => ?_) rw [smul_smul] rintro _ ⟨z, hz, rfl⟩ refine hrVU _ _ ?_ hz rw [norm_mul, ← one_mul r] exact mul_lt_mul' ha hyr (norm_nonneg y) one_pos variable (𝕜 E) theorem nhds_basis_balanced : (𝓝 (0 : E)).HasBasis (fun s : Set E => s ∈ 𝓝 (0 : E) ∧ Balanced 𝕜 s) id := Filter.hasBasis_self.mpr fun s hs => ⟨balancedCore 𝕜 s, balancedCore_mem_nhds_zero hs, balancedCore_balanced s, balancedCore_subset s⟩ theorem nhds_basis_closed_balanced [RegularSpace E] : (𝓝 (0 : E)).HasBasis (fun s : Set E => s ∈ 𝓝 (0 : E) ∧ IsClosed s ∧ Balanced 𝕜 s) id := by refine (closed_nhds_basis 0).to_hasBasis (fun s hs => ?_) fun s hs => ⟨s, ⟨hs.1, hs.2.1⟩, rfl.subset⟩ refine ⟨balancedCore 𝕜 s, ⟨balancedCore_mem_nhds_zero hs.1, ?_⟩, balancedCore_subset s⟩ exact ⟨hs.2.balancedCore, balancedCore_balanced s⟩ end Topology
Analysis\LocallyConvex\Barrelled.lean
/- Copyright (c) 2023 Anatole Dedecker. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Anatole Dedecker -/ import Mathlib.Analysis.LocallyConvex.WithSeminorms import Mathlib.Topology.Semicontinuous import Mathlib.Topology.Baire.Lemmas /-! # Barrelled spaces and the Banach-Steinhaus theorem / Uniform Boundedness Principle This files defines barrelled spaces over a `NontriviallyNormedField`, and proves the Banach-Steinhaus theorem for maps from a barrelled space to a space equipped with a family of seminorms generating the topology (i.e `WithSeminorms q` for some family of seminorms `q`). The more standard Banach-Steinhaus theorem for normed spaces is then deduced from that in `Mathlib.Analysis.Normed.Operator.BanachSteinhaus`. ## Main definitions * `BarrelledSpace`: a topological vector space `E` is said to be **barrelled** if all lower semicontinuous seminorms on `E` are actually continuous. See the implementation details below for more comments on this definition. * `WithSeminorms.continuousLinearMapOfTendsto`: fix `E` a barrelled space and `F` a TVS satisfying `WithSeminorms q` for some `q`. Given a sequence of continuous linear maps from `E` to `F` that converges pointwise to a function `f : E → F`, this bundles `f` as a continuous linear map using the Banach-Steinhaus theorem. ## Main theorems * `BaireSpace.instBarrelledSpace`: any TVS that is also a `BaireSpace` is barrelled. In particular, this applies to Banach spaces and Fréchet spaces. * `WithSeminorms.banach_steinhaus`: the **Banach-Steinhaus** theorem, also called **Uniform Boundedness Principle**. Fix `E` a barrelled space and `F` a TVS satisfying `WithSeminorms q` for some `q`. Any family `𝓕 : ι → E →L[𝕜] F` of continuous linear maps that is pointwise bounded is (uniformly) equicontinuous. Here, pointwise bounded means that for all `k` and `x`, the family of real numbers `i ↦ q k (𝓕 i x)` is bounded above, which is equivalent to requiring that `𝓕` is pointwise Von Neumann bounded (see `WithSeminorms.image_isVonNBounded_iff_seminorm_bounded`). ## Implementation details Barrelled spaces are defined in Bourbaki as locally convex spaces where barrels (aka closed balanced absorbing convex sets) are neighborhoods of zero. One can then show that barrels in a locally convex space are exactly closed unit balls of lower semicontinuous seminorms, hence that a locally convex space is barrelled iff any lower semicontinuous seminorm is continuous. The problem with this definition is the local convexity, which is essential to prove that the barrel definition is equivalent to the seminorm definition, because we can essentially only use `LocallyConvexSpace` over `ℝ` or `ℂ` (which is indeed the setup in which Bourbaki does most of the theory). Since we can easily prove the normed space version over any `NontriviallyNormedField`, this wouldn't make for a very satisfying "generalization". Fortunately, it turns out that using the seminorm definition directly solves all problems, since it is exactly what we need for the proof. One could then expect to need the barrel characterization to prove that Baire TVS are barrelled, but the proof is actually easier to do with the seminorm characterization! ## TODO * define barrels and prove that a locally convex space is barrelled iff all barrels are neighborhoods of zero. ## References * [N. Bourbaki, *Topological Vector Spaces*][bourbaki1987] ## Tags banach-steinhaus, uniform boundedness, equicontinuity -/ open Filter Topology Set ContinuousLinearMap section defs /-- A topological vector space `E` is said to be **barrelled** if all lower semicontinuous seminorms on `E` are actually continuous. This is not the usual definition for TVS over `ℝ` or `ℂ`, but this has the big advantage of working and giving sensible results over *any* `NontriviallyNormedField`. In particular, the Banach-Steinhaus theorem holds for maps between such a space and any space whose topology is generated by a family of seminorms. -/ class BarrelledSpace (𝕜 E : Type*) [SeminormedRing 𝕜] [AddGroup E] [SMul 𝕜 E] [TopologicalSpace E] : Prop where /-- In a barrelled space, all lower semicontinuous seminorms on `E` are actually continuous. -/ continuous_of_lowerSemicontinuous : ∀ p : Seminorm 𝕜 E, LowerSemicontinuous p → Continuous p theorem Seminorm.continuous_of_lowerSemicontinuous {𝕜 E : Type*} [AddGroup E] [SMul 𝕜 E] [SeminormedRing 𝕜] [TopologicalSpace E] [BarrelledSpace 𝕜 E] (p : Seminorm 𝕜 E) (hp : LowerSemicontinuous p) : Continuous p := BarrelledSpace.continuous_of_lowerSemicontinuous p hp theorem Seminorm.continuous_iSup {ι : Sort*} {𝕜 E : Type*} [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] [BarrelledSpace 𝕜 E] (p : ι → Seminorm 𝕜 E) (hp : ∀ i, Continuous (p i)) (bdd : BddAbove (range p)) : Continuous (⨆ i, p i) := by rw [← Seminorm.coe_iSup_eq bdd] refine Seminorm.continuous_of_lowerSemicontinuous _ ?_ rw [Seminorm.coe_iSup_eq bdd] rw [Seminorm.bddAbove_range_iff] at bdd convert lowerSemicontinuous_ciSup (f := fun i x ↦ p i x) bdd (fun i ↦ (hp i).lowerSemicontinuous) exact iSup_apply end defs section TVS_anyField variable {α ι κ 𝕜₁ 𝕜₂ E F : Type*} [Nonempty κ] [NontriviallyNormedField 𝕜₁] [NontriviallyNormedField 𝕜₂] {σ₁₂ : 𝕜₁ →+* 𝕜₂} [RingHomIsometric σ₁₂] [AddCommGroup E] [AddCommGroup F] [Module 𝕜₁ E] [Module 𝕜₂ F] /-- Any TVS over a `NontriviallyNormedField` that is also a Baire space is barrelled. In particular, this applies to Banach spaces and Fréchet spaces. -/ instance BaireSpace.instBarrelledSpace [TopologicalSpace E] [TopologicalAddGroup E] [ContinuousConstSMul 𝕜₁ E] [BaireSpace E] : BarrelledSpace 𝕜₁ E where continuous_of_lowerSemicontinuous := by -- Let `p` be a lower-semicontinuous seminorm on `E`. intro p hp -- Consider the family of all `p`-closed-balls with integer radius. -- By lower semicontinuity, each of these closed balls is indeed closed... have h₁ : ∀ n : ℕ, IsClosed (p.closedBall (0 : E) n) := fun n ↦ by simpa [p.closedBall_zero_eq] using hp.isClosed_preimage n -- ... and clearly they cover the whole space. have h₂ : (⋃ n : ℕ, p.closedBall (0 : E) n) = univ := eq_univ_of_forall fun x ↦ mem_iUnion.mpr (exists_nat_ge <| p (x - 0)) -- Hence, one of them has nonempty interior. Let `n : ℕ` be its radius, and fix `x` an -- interior point. rcases nonempty_interior_of_iUnion_of_closed h₁ h₂ with ⟨n, ⟨x, hxn⟩⟩ -- To show that `p` is continuous, we will show that the `p`-closed-ball of -- radius `2*n` is a neighborhood of zero. refine Seminorm.continuous' (r := n + n) ?_ rw [p.closedBall_zero_eq] at hxn ⊢ have hxn' : p x ≤ n := by convert interior_subset hxn -- By definition, we have `p x' ≤ n` for `x'` sufficiently close to `x`. -- In other words, `p (x + y) ≤ n` for `y` sufficiently close to `0`. rw [mem_interior_iff_mem_nhds, ← map_add_left_nhds_zero] at hxn -- Hence, for `y` sufficiently close to `0`, we have -- `p y = p (x + y - x) ≤ p (x + y) + p x ≤ 2*n` filter_upwards [hxn] with y hy calc p y = p (x + y - x) := by rw [add_sub_cancel_left] _ ≤ p (x + y) + p x := map_sub_le_add _ _ _ _ ≤ n + n := add_le_add hy hxn' namespace WithSeminorms variable [UniformSpace E] [UniformSpace F] [UniformAddGroup E] [UniformAddGroup F] [ContinuousSMul 𝕜₁ E] [ContinuousSMul 𝕜₂ F] [BarrelledSpace 𝕜₁ E] {𝓕 : ι → E →SL[σ₁₂] F} {q : SeminormFamily 𝕜₂ F κ} (hq : WithSeminorms q) /-- The **Banach-Steinhaus** theorem, or **Uniform Boundedness Principle**, for maps from a barrelled space to any space whose topology is generated by a family of seminorms. Use `WithSeminorms.equicontinuous_TFAE` and `Seminorm.bound_of_continuous` to get explicit bounds on the seminorms from equicontinuity. -/ protected theorem banach_steinhaus (H : ∀ k x, BddAbove (range fun i ↦ q k (𝓕 i x))) : UniformEquicontinuous ((↑) ∘ 𝓕) := by -- We just have to prove that `⊔ i, (q k) ∘ (𝓕 i)` is a (well-defined) continuous seminorm -- for all `k`. refine (hq.uniformEquicontinuous_iff_bddAbove_and_continuous_iSup (toLinearMap ∘ 𝓕)).mpr ?_ intro k -- By assumption the supremum `⊔ i, q k (𝓕 i x)` is well-defined for all `x`, hence the -- supremum `⊔ i, (q k) ∘ (𝓕 i)` is well defined in the lattice of seminorms. have : BddAbove (range fun i ↦ (q k).comp (𝓕 i).toLinearMap) := by rw [Seminorm.bddAbove_range_iff] exact H k -- By definition of the lattice structure on seminorms, `⊔ i, (q k) ∘ (𝓕 i)` is the *pointwise* -- supremum of the continuous seminorms `(q k) ∘ (𝓕 i)`. Since `E` is barrelled, this supremum -- is continuous. exact ⟨this, Seminorm.continuous_iSup _ (fun i ↦ (hq.continuous_seminorm k).comp (𝓕 i).continuous) this⟩ /-- Given a sequence of continuous linear maps which converges pointwise and for which the domain is barrelled, the Banach-Steinhaus theorem is used to guarantee that the limit map is a *continuous* linear map as well. This actually works for any *countably generated* filter instead of `atTop : Filter ℕ`, but the proof ultimately goes back to sequences. -/ protected def continuousLinearMapOfTendsto [T2Space F] {l : Filter α} [l.IsCountablyGenerated] [l.NeBot] (g : α → E →SL[σ₁₂] F) {f : E → F} (h : Tendsto (fun n x ↦ g n x) l (𝓝 f)) : E →SL[σ₁₂] F where toLinearMap := linearMapOfTendsto _ _ h cont := by -- Since the filter `l` is countably generated and nontrivial, we can find a sequence -- `u : ℕ → α` that tends to `l`. By considering `g ∘ u` instead of `g`, we can thus assume -- that `α = ℕ` and `l = atTop` rcases l.exists_seq_tendsto with ⟨u, hu⟩ -- We claim that the limit is continuous because it's a limit of an equicontinuous family. -- By the Banach-Steinhaus theorem, this equicontinuity will follow from pointwise boundedness. refine (h.comp hu).continuous_of_equicontinuous (hq.banach_steinhaus ?_).equicontinuous -- For `k` and `x` fixed, we need to show that `(i : ℕ) ↦ q k (g i x)` is bounded. intro k x -- This follows from the fact that this sequences converges (to `q k (f x)`) by hypothesis and -- continuity of `q k`. rw [tendsto_pi_nhds] at h exact (((hq.continuous_seminorm k).tendsto _).comp <| (h x).comp hu).bddAbove_range end WithSeminorms end TVS_anyField
Analysis\LocallyConvex\Basic.lean
/- Copyright (c) 2019 Jean Lo. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Jean Lo, Bhavik Mehta, Yaël Dillies -/ import Mathlib.Analysis.Convex.Basic import Mathlib.Analysis.Convex.Hull import Mathlib.Analysis.Normed.Module.Basic import Mathlib.Topology.Bornology.Absorbs /-! # Local convexity This file defines absorbent and balanced sets. An absorbent set is one that "surrounds" the origin. The idea is made precise by requiring that any point belongs to all large enough scalings of the set. This is the vector world analog of a topological neighborhood of the origin. A balanced set is one that is everywhere around the origin. This means that `a • s ⊆ s` for all `a` of norm less than `1`. ## Main declarations For a module over a normed ring: * `Absorbs`: A set `s` absorbs a set `t` if all large scalings of `s` contain `t`. * `Absorbent`: A set `s` is absorbent if every point eventually belongs to all large scalings of `s`. * `Balanced`: A set `s` is balanced if `a • s ⊆ s` for all `a` of norm less than `1`. ## References * [H. H. Schaefer, *Topological Vector Spaces*][schaefer1966] ## Tags absorbent, balanced, locally convex, LCTVS -/ open Set open Pointwise Topology variable {𝕜 𝕝 E : Type*} {ι : Sort*} {κ : ι → Sort*} section SeminormedRing variable [SeminormedRing 𝕜] section SMul variable [SMul 𝕜 E] {s t u v A B : Set E} variable (𝕜) /-- A set `A` is balanced if `a • A` is contained in `A` whenever `a` has norm at most `1`. -/ def Balanced (A : Set E) := ∀ a : 𝕜, ‖a‖ ≤ 1 → a • A ⊆ A variable {𝕜} lemma absorbs_iff_norm : Absorbs 𝕜 A B ↔ ∃ r, ∀ c : 𝕜, r ≤ ‖c‖ → B ⊆ c • A := Filter.atTop_basis.cobounded_of_norm.eventually_iff.trans <| by simp only [true_and]; rfl alias ⟨_, Absorbs.of_norm⟩ := absorbs_iff_norm lemma Absorbs.exists_pos (h : Absorbs 𝕜 A B) : ∃ r > 0, ∀ c : 𝕜, r ≤ ‖c‖ → B ⊆ c • A := let ⟨r, hr₁, hr⟩ := (Filter.atTop_basis' 1).cobounded_of_norm.eventually_iff.1 h ⟨r, one_pos.trans_le hr₁, hr⟩ theorem balanced_iff_smul_mem : Balanced 𝕜 s ↔ ∀ ⦃a : 𝕜⦄, ‖a‖ ≤ 1 → ∀ ⦃x : E⦄, x ∈ s → a • x ∈ s := forall₂_congr fun _a _ha => smul_set_subset_iff alias ⟨Balanced.smul_mem, _⟩ := balanced_iff_smul_mem theorem balanced_iff_closedBall_smul : Balanced 𝕜 s ↔ Metric.closedBall (0 : 𝕜) 1 • s ⊆ s := by simp [balanced_iff_smul_mem, smul_subset_iff] @[simp] theorem balanced_empty : Balanced 𝕜 (∅ : Set E) := fun _ _ => by rw [smul_set_empty] @[simp] theorem balanced_univ : Balanced 𝕜 (univ : Set E) := fun _a _ha => subset_univ _ theorem Balanced.union (hA : Balanced 𝕜 A) (hB : Balanced 𝕜 B) : Balanced 𝕜 (A ∪ B) := fun _a ha => smul_set_union.subset.trans <| union_subset_union (hA _ ha) <| hB _ ha theorem Balanced.inter (hA : Balanced 𝕜 A) (hB : Balanced 𝕜 B) : Balanced 𝕜 (A ∩ B) := fun _a ha => smul_set_inter_subset.trans <| inter_subset_inter (hA _ ha) <| hB _ ha theorem balanced_iUnion {f : ι → Set E} (h : ∀ i, Balanced 𝕜 (f i)) : Balanced 𝕜 (⋃ i, f i) := fun _a ha => (smul_set_iUnion _ _).subset.trans <| iUnion_mono fun _ => h _ _ ha theorem balanced_iUnion₂ {f : ∀ i, κ i → Set E} (h : ∀ i j, Balanced 𝕜 (f i j)) : Balanced 𝕜 (⋃ (i) (j), f i j) := balanced_iUnion fun _ => balanced_iUnion <| h _ theorem balanced_iInter {f : ι → Set E} (h : ∀ i, Balanced 𝕜 (f i)) : Balanced 𝕜 (⋂ i, f i) := fun _a ha => (smul_set_iInter_subset _ _).trans <| iInter_mono fun _ => h _ _ ha theorem balanced_iInter₂ {f : ∀ i, κ i → Set E} (h : ∀ i j, Balanced 𝕜 (f i j)) : Balanced 𝕜 (⋂ (i) (j), f i j) := balanced_iInter fun _ => balanced_iInter <| h _ variable [SMul 𝕝 E] [SMulCommClass 𝕜 𝕝 E] theorem Balanced.smul (a : 𝕝) (hs : Balanced 𝕜 s) : Balanced 𝕜 (a • s) := fun _b hb => (smul_comm _ _ _).subset.trans <| smul_set_mono <| hs _ hb end SMul section Module variable [AddCommGroup E] [Module 𝕜 E] {s s₁ s₂ t t₁ t₂ : Set E} theorem Balanced.neg : Balanced 𝕜 s → Balanced 𝕜 (-s) := forall₂_imp fun _ _ h => (smul_set_neg _ _).subset.trans <| neg_subset_neg.2 h @[simp] theorem balanced_neg : Balanced 𝕜 (-s) ↔ Balanced 𝕜 s := ⟨fun h ↦ neg_neg s ▸ h.neg, fun h ↦ h.neg⟩ theorem Balanced.neg_mem_iff [NormOneClass 𝕜] (h : Balanced 𝕜 s) {x : E} : -x ∈ s ↔ x ∈ s := ⟨fun hx ↦ by simpa using h.smul_mem (a := -1) (by simp) hx, fun hx ↦ by simpa using h.smul_mem (a := -1) (by simp) hx⟩ theorem Balanced.neg_eq [NormOneClass 𝕜] (h : Balanced 𝕜 s) : -s = s := Set.ext fun _ ↦ h.neg_mem_iff theorem Balanced.add (hs : Balanced 𝕜 s) (ht : Balanced 𝕜 t) : Balanced 𝕜 (s + t) := fun _a ha => (smul_add _ _ _).subset.trans <| add_subset_add (hs _ ha) <| ht _ ha theorem Balanced.sub (hs : Balanced 𝕜 s) (ht : Balanced 𝕜 t) : Balanced 𝕜 (s - t) := by simp_rw [sub_eq_add_neg] exact hs.add ht.neg theorem balanced_zero : Balanced 𝕜 (0 : Set E) := fun _a _ha => (smul_zero _).subset end Module end SeminormedRing section NormedDivisionRing variable [NormedDivisionRing 𝕜] [AddCommGroup E] [Module 𝕜 E] {s t : Set E} {x : E} {a b : 𝕜} theorem absorbs_iff_eventually_nhdsWithin_zero : Absorbs 𝕜 s t ↔ ∀ᶠ c : 𝕜 in 𝓝[≠] 0, MapsTo (c • ·) t s := by rw [absorbs_iff_eventually_cobounded_mapsTo, ← Filter.inv_cobounded₀]; rfl alias ⟨Absorbs.eventually_nhdsWithin_zero, _⟩ := absorbs_iff_eventually_nhdsWithin_zero theorem absorbent_iff_eventually_nhdsWithin_zero : Absorbent 𝕜 s ↔ ∀ x : E, ∀ᶠ c : 𝕜 in 𝓝[≠] 0, c • x ∈ s := forall_congr' fun x ↦ by simp only [absorbs_iff_eventually_nhdsWithin_zero, mapsTo_singleton] alias ⟨Absorbent.eventually_nhdsWithin_zero, _⟩ := absorbent_iff_eventually_nhdsWithin_zero theorem absorbs_iff_eventually_nhds_zero (h₀ : 0 ∈ s) : Absorbs 𝕜 s t ↔ ∀ᶠ c : 𝕜 in 𝓝 0, MapsTo (c • ·) t s := by rw [← nhdsWithin_compl_singleton_sup_pure, Filter.eventually_sup, Filter.eventually_pure, ← absorbs_iff_eventually_nhdsWithin_zero, and_iff_left] intro x _ simpa only [zero_smul] theorem Absorbs.eventually_nhds_zero (h : Absorbs 𝕜 s t) (h₀ : 0 ∈ s) : ∀ᶠ c : 𝕜 in 𝓝 0, MapsTo (c • ·) t s := (absorbs_iff_eventually_nhds_zero h₀).1 h end NormedDivisionRing section NormedField variable [NormedField 𝕜] [NormedRing 𝕝] [NormedSpace 𝕜 𝕝] [AddCommGroup E] [Module 𝕜 E] [SMulWithZero 𝕝 E] [IsScalarTower 𝕜 𝕝 E] {s t u v A B : Set E} {x : E} {a b : 𝕜} /-- Scalar multiplication (by possibly different types) of a balanced set is monotone. -/ theorem Balanced.smul_mono (hs : Balanced 𝕝 s) {a : 𝕝} {b : 𝕜} (h : ‖a‖ ≤ ‖b‖) : a • s ⊆ b • s := by obtain rfl | hb := eq_or_ne b 0 · rw [norm_zero, norm_le_zero_iff] at h simp only [h, ← image_smul, zero_smul, Subset.rfl] · calc a • s = b • (b⁻¹ • a) • s := by rw [smul_assoc, smul_inv_smul₀ hb] _ ⊆ b • s := smul_set_mono <| hs _ <| by rw [norm_smul, norm_inv, ← div_eq_inv_mul] exact div_le_one_of_le h (norm_nonneg _) theorem Balanced.smul_mem_mono [SMulCommClass 𝕝 𝕜 E] (hs : Balanced 𝕝 s) {a : 𝕜} {b : 𝕝} (ha : a • x ∈ s) (hba : ‖b‖ ≤ ‖a‖) : b • x ∈ s := by rcases eq_or_ne a 0 with rfl | ha₀ · simp_all · calc b • x = (a⁻¹ • b) • a • x := by rw [smul_comm, smul_assoc, smul_inv_smul₀ ha₀] _ ∈ s := by refine hs.smul_mem ?_ ha rw [norm_smul, norm_inv, ← div_eq_inv_mul] exact div_le_one_of_le hba (norm_nonneg _) theorem Balanced.subset_smul (hA : Balanced 𝕜 A) (ha : 1 ≤ ‖a‖) : A ⊆ a • A := by rw [← @norm_one 𝕜] at ha; simpa using hA.smul_mono ha theorem Balanced.smul_congr (hs : Balanced 𝕜 A) (h : ‖a‖ = ‖b‖) : a • A = b • A := (hs.smul_mono h.le).antisymm (hs.smul_mono h.ge) theorem Balanced.smul_eq (hA : Balanced 𝕜 A) (ha : ‖a‖ = 1) : a • A = A := (hA _ ha.le).antisymm <| hA.subset_smul ha.ge /-- A balanced set absorbs itself. -/ theorem Balanced.absorbs_self (hA : Balanced 𝕜 A) : Absorbs 𝕜 A A := .of_norm ⟨1, fun _ => hA.subset_smul⟩ theorem Balanced.smul_mem_iff (hs : Balanced 𝕜 s) (h : ‖a‖ = ‖b‖) : a • x ∈ s ↔ b • x ∈ s := ⟨(hs.smul_mem_mono · h.ge), (hs.smul_mem_mono · h.le)⟩ @[deprecated (since := "2024-02-02")] alias Balanced.mem_smul_iff := Balanced.smul_mem_iff variable [TopologicalSpace E] [ContinuousSMul 𝕜 E] /-- Every neighbourhood of the origin is absorbent. -/ theorem absorbent_nhds_zero (hA : A ∈ 𝓝 (0 : E)) : Absorbent 𝕜 A := absorbent_iff_inv_smul.2 fun x ↦ Filter.tendsto_inv₀_cobounded.smul tendsto_const_nhds <| by rwa [zero_smul] /-- The union of `{0}` with the interior of a balanced set is balanced. -/ theorem Balanced.zero_insert_interior (hA : Balanced 𝕜 A) : Balanced 𝕜 (insert 0 (interior A)) := by intro a ha obtain rfl | h := eq_or_ne a 0 · rw [zero_smul_set] exacts [subset_union_left, ⟨0, Or.inl rfl⟩] · rw [← image_smul, image_insert_eq, smul_zero] apply insert_subset_insert exact ((isOpenMap_smul₀ h).mapsTo_interior <| hA.smul_mem ha).image_subset @[deprecated Balanced.zero_insert_interior (since := "2024-02-03")] theorem balanced_zero_union_interior (hA : Balanced 𝕜 A) : Balanced 𝕜 ((0 : Set E) ∪ interior A) := hA.zero_insert_interior /-- The interior of a balanced set is balanced if it contains the origin. -/ protected theorem Balanced.interior (hA : Balanced 𝕜 A) (h : (0 : E) ∈ interior A) : Balanced 𝕜 (interior A) := by rw [← insert_eq_self.2 h] exact hA.zero_insert_interior protected theorem Balanced.closure (hA : Balanced 𝕜 A) : Balanced 𝕜 (closure A) := fun _a ha => (image_closure_subset_closure_image <| continuous_const_smul _).trans <| closure_mono <| hA _ ha end NormedField section NontriviallyNormedField variable [NontriviallyNormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] {s : Set E} @[deprecated Absorbent.zero_mem (since := "2024-02-02")] theorem Absorbent.zero_mem' (hs : Absorbent 𝕜 s) : (0 : E) ∈ s := hs.zero_mem variable [Module ℝ E] [SMulCommClass ℝ 𝕜 E] protected theorem Balanced.convexHull (hs : Balanced 𝕜 s) : Balanced 𝕜 (convexHull ℝ s) := by suffices Convex ℝ { x | ∀ a : 𝕜, ‖a‖ ≤ 1 → a • x ∈ convexHull ℝ s } by rw [balanced_iff_smul_mem] at hs ⊢ refine fun a ha x hx => convexHull_min ?_ this hx a ha exact fun y hy a ha => subset_convexHull ℝ s (hs ha hy) intro x hx y hy u v hu hv huv a ha simp only [smul_add, ← smul_comm] exact convex_convexHull ℝ s (hx a ha) (hy a ha) hu hv huv @[deprecated (since := "2024-02-02")] alias balanced_convexHull_of_balanced := Balanced.convexHull end NontriviallyNormedField section Real variable [AddCommGroup E] [Module ℝ E] {s : Set E} theorem balanced_iff_neg_mem (hs : Convex ℝ s) : Balanced ℝ s ↔ ∀ ⦃x⦄, x ∈ s → -x ∈ s := by refine ⟨fun h x => h.neg_mem_iff.2, fun h a ha => smul_set_subset_iff.2 fun x hx => ?_⟩ rw [Real.norm_eq_abs, abs_le] at ha rw [show a = -((1 - a) / 2) + (a - -1) / 2 by ring, add_smul, neg_smul, ← smul_neg] exact hs (h hx) hx (div_nonneg (sub_nonneg_of_le ha.2) zero_le_two) (div_nonneg (sub_nonneg_of_le ha.1) zero_le_two) (by ring) end Real
Analysis\LocallyConvex\Bounded.lean
/- Copyright (c) 2022 Moritz Doll. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Moritz Doll -/ import Mathlib.GroupTheory.GroupAction.Pointwise import Mathlib.Analysis.LocallyConvex.Basic import Mathlib.Analysis.LocallyConvex.BalancedCoreHull import Mathlib.Analysis.Seminorm import Mathlib.Topology.Bornology.Basic import Mathlib.Topology.Algebra.UniformGroup import Mathlib.Topology.UniformSpace.Cauchy import Mathlib.Topology.Algebra.Module.Basic /-! # Von Neumann Boundedness This file defines natural or von Neumann bounded sets and proves elementary properties. ## Main declarations * `Bornology.IsVonNBounded`: A set `s` is von Neumann-bounded if every neighborhood of zero absorbs `s`. * `Bornology.vonNBornology`: The bornology made of the von Neumann-bounded sets. ## Main results * `Bornology.IsVonNBounded.of_topologicalSpace_le`: A coarser topology admits more von Neumann-bounded sets. * `Bornology.IsVonNBounded.image`: A continuous linear image of a bounded set is bounded. * `Bornology.isVonNBounded_iff_smul_tendsto_zero`: Given any sequence `ε` of scalars which tends to `𝓝[≠] 0`, we have that a set `S` is bounded if and only if for any sequence `x : ℕ → S`, `ε • x` tends to 0. This shows that bounded sets are completely determined by sequences, which is the key fact for proving that sequential continuity implies continuity for linear maps defined on a bornological space ## References * [Bourbaki, *Topological Vector Spaces*][bourbaki1987] -/ variable {𝕜 𝕜' E E' F ι : Type*} open Set Filter Function open scoped Topology Pointwise namespace Bornology section SeminormedRing section Zero variable (𝕜) variable [SeminormedRing 𝕜] [SMul 𝕜 E] [Zero E] variable [TopologicalSpace E] /-- A set `s` is von Neumann bounded if every neighborhood of 0 absorbs `s`. -/ def IsVonNBounded (s : Set E) : Prop := ∀ ⦃V⦄, V ∈ 𝓝 (0 : E) → Absorbs 𝕜 V s variable (E) @[simp] theorem isVonNBounded_empty : IsVonNBounded 𝕜 (∅ : Set E) := fun _ _ => Absorbs.empty variable {𝕜 E} theorem isVonNBounded_iff (s : Set E) : IsVonNBounded 𝕜 s ↔ ∀ V ∈ 𝓝 (0 : E), Absorbs 𝕜 V s := Iff.rfl theorem _root_.Filter.HasBasis.isVonNBounded_iff {q : ι → Prop} {s : ι → Set E} {A : Set E} (h : (𝓝 (0 : E)).HasBasis q s) : IsVonNBounded 𝕜 A ↔ ∀ i, q i → Absorbs 𝕜 (s i) A := by refine ⟨fun hA i hi => hA (h.mem_of_mem hi), fun hA V hV => ?_⟩ rcases h.mem_iff.mp hV with ⟨i, hi, hV⟩ exact (hA i hi).mono_left hV @[deprecated (since := "2024-01-12")] alias _root_.Filter.HasBasis.isVonNBounded_basis_iff := Filter.HasBasis.isVonNBounded_iff /-- Subsets of bounded sets are bounded. -/ theorem IsVonNBounded.subset {s₁ s₂ : Set E} (h : s₁ ⊆ s₂) (hs₂ : IsVonNBounded 𝕜 s₂) : IsVonNBounded 𝕜 s₁ := fun _ hV => (hs₂ hV).mono_right h @[simp] theorem isVonNBounded_union {s t : Set E} : IsVonNBounded 𝕜 (s ∪ t) ↔ IsVonNBounded 𝕜 s ∧ IsVonNBounded 𝕜 t := by simp only [IsVonNBounded, absorbs_union, forall_and] /-- The union of two bounded sets is bounded. -/ theorem IsVonNBounded.union {s₁ s₂ : Set E} (hs₁ : IsVonNBounded 𝕜 s₁) (hs₂ : IsVonNBounded 𝕜 s₂) : IsVonNBounded 𝕜 (s₁ ∪ s₂) := isVonNBounded_union.2 ⟨hs₁, hs₂⟩ theorem IsVonNBounded.of_boundedSpace [BoundedSpace 𝕜] {s : Set E} : IsVonNBounded 𝕜 s := fun _ _ ↦ .of_boundedSpace @[simp] theorem isVonNBounded_iUnion {ι : Sort*} [Finite ι] {s : ι → Set E} : IsVonNBounded 𝕜 (⋃ i, s i) ↔ ∀ i, IsVonNBounded 𝕜 (s i) := by simp only [IsVonNBounded, absorbs_iUnion, @forall_swap ι] theorem isVonNBounded_biUnion {ι : Type*} {I : Set ι} (hI : I.Finite) {s : ι → Set E} : IsVonNBounded 𝕜 (⋃ i ∈ I, s i) ↔ ∀ i ∈ I, IsVonNBounded 𝕜 (s i) := by have _ := hI.to_subtype rw [biUnion_eq_iUnion, isVonNBounded_iUnion, Subtype.forall] theorem isVonNBounded_sUnion {S : Set (Set E)} (hS : S.Finite) : IsVonNBounded 𝕜 (⋃₀ S) ↔ ∀ s ∈ S, IsVonNBounded 𝕜 s := by rw [sUnion_eq_biUnion, isVonNBounded_biUnion hS] end Zero section ContinuousAdd variable [SeminormedRing 𝕜] [AddZeroClass E] [TopologicalSpace E] [ContinuousAdd E] [DistribSMul 𝕜 E] {s t : Set E} protected theorem IsVonNBounded.add (hs : IsVonNBounded 𝕜 s) (ht : IsVonNBounded 𝕜 t) : IsVonNBounded 𝕜 (s + t) := fun U hU ↦ by rcases exists_open_nhds_zero_add_subset hU with ⟨V, hVo, hV, hVU⟩ exact ((hs <| hVo.mem_nhds hV).add (ht <| hVo.mem_nhds hV)).mono_left hVU end ContinuousAdd section TopologicalAddGroup variable [SeminormedRing 𝕜] [AddGroup E] [TopologicalSpace E] [TopologicalAddGroup E] [DistribMulAction 𝕜 E] {s t : Set E} protected theorem IsVonNBounded.neg (hs : IsVonNBounded 𝕜 s) : IsVonNBounded 𝕜 (-s) := fun U hU ↦ by rw [← neg_neg U] exact (hs <| neg_mem_nhds_zero _ hU).neg_neg @[simp] theorem isVonNBounded_neg : IsVonNBounded 𝕜 (-s) ↔ IsVonNBounded 𝕜 s := ⟨fun h ↦ neg_neg s ▸ h.neg, fun h ↦ h.neg⟩ alias ⟨IsVonNBounded.of_neg, _⟩ := isVonNBounded_neg protected theorem IsVonNBounded.sub (hs : IsVonNBounded 𝕜 s) (ht : IsVonNBounded 𝕜 t) : IsVonNBounded 𝕜 (s - t) := by rw [sub_eq_add_neg] exact hs.add ht.neg end TopologicalAddGroup end SeminormedRing section MultipleTopologies variable [SeminormedRing 𝕜] [AddCommGroup E] [Module 𝕜 E] /-- If a topology `t'` is coarser than `t`, then any set `s` that is bounded with respect to `t` is bounded with respect to `t'`. -/ theorem IsVonNBounded.of_topologicalSpace_le {t t' : TopologicalSpace E} (h : t ≤ t') {s : Set E} (hs : @IsVonNBounded 𝕜 E _ _ _ t s) : @IsVonNBounded 𝕜 E _ _ _ t' s := fun _ hV => hs <| (le_iff_nhds t t').mp h 0 hV end MultipleTopologies lemma isVonNBounded_iff_tendsto_smallSets_nhds {𝕜 E : Type*} [NormedDivisionRing 𝕜] [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] {S : Set E} : IsVonNBounded 𝕜 S ↔ Tendsto (· • S : 𝕜 → Set E) (𝓝 0) (𝓝 0).smallSets := by rw [tendsto_smallSets_iff] refine forall₂_congr fun V hV ↦ ?_ simp only [absorbs_iff_eventually_nhds_zero (mem_of_mem_nhds hV), mapsTo', image_smul] alias ⟨IsVonNBounded.tendsto_smallSets_nhds, _⟩ := isVonNBounded_iff_tendsto_smallSets_nhds lemma isVonNBounded_pi_iff {𝕜 ι : Type*} {E : ι → Type*} [NormedDivisionRing 𝕜] [∀ i, AddCommGroup (E i)] [∀ i, Module 𝕜 (E i)] [∀ i, TopologicalSpace (E i)] {S : Set (∀ i, E i)} : IsVonNBounded 𝕜 S ↔ ∀ i, IsVonNBounded 𝕜 (eval i '' S) := by simp_rw [isVonNBounded_iff_tendsto_smallSets_nhds, nhds_pi, Filter.pi, smallSets_iInf, smallSets_comap_eq_comap_image, tendsto_iInf, tendsto_comap_iff, Function.comp, ← image_smul, image_image, eval, Pi.smul_apply, Pi.zero_apply] section Image variable {𝕜₁ 𝕜₂ : Type*} [NormedDivisionRing 𝕜₁] [NormedDivisionRing 𝕜₂] [AddCommGroup E] [Module 𝕜₁ E] [AddCommGroup F] [Module 𝕜₂ F] [TopologicalSpace E] [TopologicalSpace F] /-- A continuous linear image of a bounded set is bounded. -/ theorem IsVonNBounded.image {σ : 𝕜₁ →+* 𝕜₂} [RingHomSurjective σ] [RingHomIsometric σ] {s : Set E} (hs : IsVonNBounded 𝕜₁ s) (f : E →SL[σ] F) : IsVonNBounded 𝕜₂ (f '' s) := by have σ_iso : Isometry σ := AddMonoidHomClass.isometry_of_norm σ fun x => RingHomIsometric.is_iso have : map σ (𝓝 0) = 𝓝 0 := by rw [σ_iso.embedding.map_nhds_eq, σ.surjective.range_eq, nhdsWithin_univ, map_zero] have hf₀ : Tendsto f (𝓝 0) (𝓝 0) := f.continuous.tendsto' 0 0 (map_zero f) simp only [isVonNBounded_iff_tendsto_smallSets_nhds, ← this, tendsto_map'_iff] at hs ⊢ simpa only [comp_def, image_smul_setₛₗ _ _ σ f] using hf₀.image_smallSets.comp hs end Image section sequence theorem IsVonNBounded.smul_tendsto_zero [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] {S : Set E} {ε : ι → 𝕜} {x : ι → E} {l : Filter ι} (hS : IsVonNBounded 𝕜 S) (hxS : ∀ᶠ n in l, x n ∈ S) (hε : Tendsto ε l (𝓝 0)) : Tendsto (ε • x) l (𝓝 0) := (hS.tendsto_smallSets_nhds.comp hε).of_smallSets <| hxS.mono fun _ ↦ smul_mem_smul_set variable [NontriviallyNormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] [ContinuousSMul 𝕜 E] theorem isVonNBounded_of_smul_tendsto_zero {ε : ι → 𝕜} {l : Filter ι} [l.NeBot] (hε : ∀ᶠ n in l, ε n ≠ 0) {S : Set E} (H : ∀ x : ι → E, (∀ n, x n ∈ S) → Tendsto (ε • x) l (𝓝 0)) : IsVonNBounded 𝕜 S := by rw [(nhds_basis_balanced 𝕜 E).isVonNBounded_iff] by_contra! H' rcases H' with ⟨V, ⟨hV, hVb⟩, hVS⟩ have : ∀ᶠ n in l, ∃ x : S, ε n • (x : E) ∉ V := by filter_upwards [hε] with n hn rw [absorbs_iff_norm] at hVS push_neg at hVS rcases hVS ‖(ε n)⁻¹‖ with ⟨a, haε, haS⟩ rcases Set.not_subset.mp haS with ⟨x, hxS, hx⟩ refine ⟨⟨x, hxS⟩, fun hnx => ?_⟩ rw [← Set.mem_inv_smul_set_iff₀ hn] at hnx exact hx (hVb.smul_mono haε hnx) rcases this.choice with ⟨x, hx⟩ refine Filter.frequently_false l (Filter.Eventually.frequently ?_) filter_upwards [hx, (H (_ ∘ x) fun n => (x n).2).eventually (eventually_mem_set.mpr hV)] using fun n => id /-- Given any sequence `ε` of scalars which tends to `𝓝[≠] 0`, we have that a set `S` is bounded if and only if for any sequence `x : ℕ → S`, `ε • x` tends to 0. This actually works for any indexing type `ι`, but in the special case `ι = ℕ` we get the important fact that convergent sequences fully characterize bounded sets. -/ theorem isVonNBounded_iff_smul_tendsto_zero {ε : ι → 𝕜} {l : Filter ι} [l.NeBot] (hε : Tendsto ε l (𝓝[≠] 0)) {S : Set E} : IsVonNBounded 𝕜 S ↔ ∀ x : ι → E, (∀ n, x n ∈ S) → Tendsto (ε • x) l (𝓝 0) := ⟨fun hS x hxS => hS.smul_tendsto_zero (eventually_of_forall hxS) (le_trans hε nhdsWithin_le_nhds), isVonNBounded_of_smul_tendsto_zero (by exact hε self_mem_nhdsWithin)⟩ end sequence section NormedField variable [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] variable [TopologicalSpace E] [ContinuousSMul 𝕜 E] /-- Singletons are bounded. -/ theorem isVonNBounded_singleton (x : E) : IsVonNBounded 𝕜 ({x} : Set E) := fun _ hV => (absorbent_nhds_zero hV).absorbs @[simp] theorem isVonNBounded_insert (x : E) {s : Set E} : IsVonNBounded 𝕜 (insert x s) ↔ IsVonNBounded 𝕜 s := by simp only [← singleton_union, isVonNBounded_union, isVonNBounded_singleton, true_and] protected alias ⟨_, IsVonNBounded.insert⟩ := isVonNBounded_insert section ContinuousAdd variable [ContinuousAdd E] {s t : Set E} protected theorem IsVonNBounded.vadd (hs : IsVonNBounded 𝕜 s) (x : E) : IsVonNBounded 𝕜 (x +ᵥ s) := by rw [← singleton_vadd] -- TODO: dot notation timeouts in the next line exact IsVonNBounded.add (isVonNBounded_singleton x) hs @[simp] theorem isVonNBounded_vadd (x : E) : IsVonNBounded 𝕜 (x +ᵥ s) ↔ IsVonNBounded 𝕜 s := ⟨fun h ↦ by simpa using h.vadd (-x), fun h ↦ h.vadd x⟩ theorem IsVonNBounded.of_add_right (hst : IsVonNBounded 𝕜 (s + t)) (hs : s.Nonempty) : IsVonNBounded 𝕜 t := let ⟨x, hx⟩ := hs (isVonNBounded_vadd x).mp <| hst.subset <| image_subset_image2_right hx theorem IsVonNBounded.of_add_left (hst : IsVonNBounded 𝕜 (s + t)) (ht : t.Nonempty) : IsVonNBounded 𝕜 s := ((add_comm s t).subst hst).of_add_right ht theorem isVonNBounded_add_of_nonempty (hs : s.Nonempty) (ht : t.Nonempty) : IsVonNBounded 𝕜 (s + t) ↔ IsVonNBounded 𝕜 s ∧ IsVonNBounded 𝕜 t := ⟨fun h ↦ ⟨h.of_add_left ht, h.of_add_right hs⟩, and_imp.2 IsVonNBounded.add⟩ theorem isVonNBounded_add : IsVonNBounded 𝕜 (s + t) ↔ s = ∅ ∨ t = ∅ ∨ IsVonNBounded 𝕜 s ∧ IsVonNBounded 𝕜 t := by rcases s.eq_empty_or_nonempty with rfl | hs; · simp rcases t.eq_empty_or_nonempty with rfl | ht; · simp simp [hs.ne_empty, ht.ne_empty, isVonNBounded_add_of_nonempty hs ht] @[simp] theorem isVonNBounded_add_self : IsVonNBounded 𝕜 (s + s) ↔ IsVonNBounded 𝕜 s := by rcases s.eq_empty_or_nonempty with rfl | hs <;> simp [isVonNBounded_add_of_nonempty, *] theorem IsVonNBounded.of_sub_left (hst : IsVonNBounded 𝕜 (s - t)) (ht : t.Nonempty) : IsVonNBounded 𝕜 s := ((sub_eq_add_neg s t).subst hst).of_add_left ht.neg end ContinuousAdd section TopologicalAddGroup variable [TopologicalAddGroup E] {s t : Set E} theorem IsVonNBounded.of_sub_right (hst : IsVonNBounded 𝕜 (s - t)) (hs : s.Nonempty) : IsVonNBounded 𝕜 t := (((sub_eq_add_neg s t).subst hst).of_add_right hs).of_neg theorem isVonNBounded_sub_of_nonempty (hs : s.Nonempty) (ht : t.Nonempty) : IsVonNBounded 𝕜 (s - t) ↔ IsVonNBounded 𝕜 s ∧ IsVonNBounded 𝕜 t := by simp [sub_eq_add_neg, isVonNBounded_add_of_nonempty, hs, ht] theorem isVonNBounded_sub : IsVonNBounded 𝕜 (s - t) ↔ s = ∅ ∨ t = ∅ ∨ IsVonNBounded 𝕜 s ∧ IsVonNBounded 𝕜 t := by simp [sub_eq_add_neg, isVonNBounded_add] end TopologicalAddGroup /-- The union of all bounded set is the whole space. -/ theorem isVonNBounded_covers : ⋃₀ setOf (IsVonNBounded 𝕜) = (Set.univ : Set E) := Set.eq_univ_iff_forall.mpr fun x => Set.mem_sUnion.mpr ⟨{x}, isVonNBounded_singleton _, Set.mem_singleton _⟩ variable (𝕜 E) -- See note [reducible non-instances] /-- The von Neumann bornology defined by the von Neumann bounded sets. Note that this is not registered as an instance, in order to avoid diamonds with the metric bornology. -/ abbrev vonNBornology : Bornology E := Bornology.ofBounded (setOf (IsVonNBounded 𝕜)) (isVonNBounded_empty 𝕜 E) (fun _ hs _ ht => hs.subset ht) (fun _ hs _ => hs.union) isVonNBounded_singleton variable {E} @[simp] theorem isBounded_iff_isVonNBounded {s : Set E} : @IsBounded _ (vonNBornology 𝕜 E) s ↔ IsVonNBounded 𝕜 s := isBounded_ofBounded_iff _ end NormedField end Bornology section UniformAddGroup variable (𝕜) [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] variable [UniformSpace E] [UniformAddGroup E] [ContinuousSMul 𝕜 E] theorem TotallyBounded.isVonNBounded {s : Set E} (hs : TotallyBounded s) : Bornology.IsVonNBounded 𝕜 s := by if h : ∃ x : 𝕜, 1 < ‖x‖ then letI : NontriviallyNormedField 𝕜 := ⟨h⟩ rw [totallyBounded_iff_subset_finite_iUnion_nhds_zero] at hs intro U hU have h : Filter.Tendsto (fun x : E × E => x.fst + x.snd) (𝓝 0) (𝓝 0) := continuous_add.tendsto' _ _ (zero_add _) have h' := (nhds_basis_balanced 𝕜 E).prod (nhds_basis_balanced 𝕜 E) simp_rw [← nhds_prod_eq, id] at h' rcases h.basis_left h' U hU with ⟨x, hx, h''⟩ rcases hs x.snd hx.2.1 with ⟨t, ht, hs⟩ refine Absorbs.mono_right ?_ hs rw [ht.absorbs_biUnion] have hx_fstsnd : x.fst + x.snd ⊆ U := add_subset_iff.mpr fun z1 hz1 z2 hz2 ↦ h'' <| mk_mem_prod hz1 hz2 refine fun y _ => Absorbs.mono_left ?_ hx_fstsnd -- TODO: with dot notation, Lean timeouts on the next line. Why? exact Absorbent.vadd_absorbs (absorbent_nhds_zero hx.1.1) hx.2.2.absorbs_self else haveI : BoundedSpace 𝕜 := ⟨Metric.isBounded_iff.2 ⟨1, by simp_all [dist_eq_norm]⟩⟩ exact Bornology.IsVonNBounded.of_boundedSpace end UniformAddGroup variable (𝕜) in theorem Filter.Tendsto.isVonNBounded_range [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] [TopologicalAddGroup E] [ContinuousSMul 𝕜 E] {f : ℕ → E} {x : E} (hf : Tendsto f atTop (𝓝 x)) : Bornology.IsVonNBounded 𝕜 (range f) := letI := TopologicalAddGroup.toUniformSpace E haveI := comm_topologicalAddGroup_is_uniform (G := E) hf.cauchySeq.totallyBounded_range.isVonNBounded 𝕜 section VonNBornologyEqMetric namespace NormedSpace section NormedField variable (𝕜) variable [NormedField 𝕜] [SeminormedAddCommGroup E] [NormedSpace 𝕜 E] theorem isVonNBounded_of_isBounded {s : Set E} (h : Bornology.IsBounded s) : Bornology.IsVonNBounded 𝕜 s := by rcases h.subset_ball 0 with ⟨r, hr⟩ rw [Metric.nhds_basis_ball.isVonNBounded_iff] rw [← ball_normSeminorm 𝕜 E] at hr ⊢ exact fun ε hε ↦ ((normSeminorm 𝕜 E).ball_zero_absorbs_ball_zero hε).mono_right hr variable (E) theorem isVonNBounded_ball (r : ℝ) : Bornology.IsVonNBounded 𝕜 (Metric.ball (0 : E) r) := isVonNBounded_of_isBounded _ Metric.isBounded_ball theorem isVonNBounded_closedBall (r : ℝ) : Bornology.IsVonNBounded 𝕜 (Metric.closedBall (0 : E) r) := isVonNBounded_of_isBounded _ Metric.isBounded_closedBall end NormedField variable (𝕜) variable [NontriviallyNormedField 𝕜] [SeminormedAddCommGroup E] [NormedSpace 𝕜 E] theorem isVonNBounded_iff {s : Set E} : Bornology.IsVonNBounded 𝕜 s ↔ Bornology.IsBounded s := by refine ⟨fun h ↦ ?_, isVonNBounded_of_isBounded _⟩ rcases (h (Metric.ball_mem_nhds 0 zero_lt_one)).exists_pos with ⟨ρ, hρ, hρball⟩ rcases NormedField.exists_lt_norm 𝕜 ρ with ⟨a, ha⟩ specialize hρball a ha.le rw [← ball_normSeminorm 𝕜 E, Seminorm.smul_ball_zero (norm_pos_iff.1 <| hρ.trans ha), ball_normSeminorm] at hρball exact Metric.isBounded_ball.subset hρball theorem isVonNBounded_iff' {s : Set E} : Bornology.IsVonNBounded 𝕜 s ↔ ∃ r : ℝ, ∀ x ∈ s, ‖x‖ ≤ r := by rw [NormedSpace.isVonNBounded_iff, isBounded_iff_forall_norm_le] theorem image_isVonNBounded_iff {α : Type*} {f : α → E} {s : Set α} : Bornology.IsVonNBounded 𝕜 (f '' s) ↔ ∃ r : ℝ, ∀ x ∈ s, ‖f x‖ ≤ r := by simp_rw [isVonNBounded_iff', Set.forall_mem_image] /-- In a normed space, the von Neumann bornology (`Bornology.vonNBornology`) is equal to the metric bornology. -/ theorem vonNBornology_eq : Bornology.vonNBornology 𝕜 E = PseudoMetricSpace.toBornology := by rw [Bornology.ext_iff_isBounded] intro s rw [Bornology.isBounded_iff_isVonNBounded] exact isVonNBounded_iff _ theorem isBounded_iff_subset_smul_ball {s : Set E} : Bornology.IsBounded s ↔ ∃ a : 𝕜, s ⊆ a • Metric.ball (0 : E) 1 := by rw [← isVonNBounded_iff 𝕜] constructor · intro h rcases (h (Metric.ball_mem_nhds 0 zero_lt_one)).exists_pos with ⟨ρ, _, hρball⟩ rcases NormedField.exists_lt_norm 𝕜 ρ with ⟨a, ha⟩ exact ⟨a, hρball a ha.le⟩ · rintro ⟨a, ha⟩ exact ((isVonNBounded_ball 𝕜 E 1).image (a • (1 : E →L[𝕜] E))).subset ha theorem isBounded_iff_subset_smul_closedBall {s : Set E} : Bornology.IsBounded s ↔ ∃ a : 𝕜, s ⊆ a • Metric.closedBall (0 : E) 1 := by constructor · rw [isBounded_iff_subset_smul_ball 𝕜] exact Exists.imp fun a ha => ha.trans <| Set.smul_set_mono <| Metric.ball_subset_closedBall · rw [← isVonNBounded_iff 𝕜] rintro ⟨a, ha⟩ exact ((isVonNBounded_closedBall 𝕜 E 1).image (a • (1 : E →L[𝕜] E))).subset ha end NormedSpace end VonNBornologyEqMetric
Analysis\LocallyConvex\ContinuousOfBounded.lean
/- Copyright (c) 2022 Anatole Dedecker. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Moritz Doll -/ import Mathlib.Analysis.LocallyConvex.Bounded import Mathlib.Analysis.RCLike.Basic /-! # Continuity and Von Neumann boundedness This files proves that for `E` and `F` two topological vector spaces over `ℝ` or `ℂ`, if `E` is first countable, then every locally bounded linear map `E →ₛₗ[σ] F` is continuous (this is `LinearMap.continuous_of_locally_bounded`). We keep this file separate from `Analysis/LocallyConvex/Bounded` in order not to import `Analysis/NormedSpace/RCLike` there, because defining the strong topology on the space of continuous linear maps will require importing `Analysis/LocallyConvex/Bounded` in `Analysis/NormedSpace/OperatorNorm`. ## References * [Bourbaki, *Topological Vector Spaces*][bourbaki1987] -/ open TopologicalSpace Bornology Filter Topology Pointwise variable {𝕜 𝕜' E F : Type*} variable [AddCommGroup E] [UniformSpace E] [UniformAddGroup E] variable [AddCommGroup F] [UniformSpace F] section NontriviallyNormedField variable [UniformAddGroup F] variable [NontriviallyNormedField 𝕜] [Module 𝕜 E] [Module 𝕜 F] [ContinuousSMul 𝕜 E] /-- Construct a continuous linear map from a linear map `f : E →ₗ[𝕜] F` and the existence of a neighborhood of zero that gets mapped into a bounded set in `F`. -/ def LinearMap.clmOfExistsBoundedImage (f : E →ₗ[𝕜] F) (h : ∃ V ∈ 𝓝 (0 : E), Bornology.IsVonNBounded 𝕜 (f '' V)) : E →L[𝕜] F := ⟨f, by -- It suffices to show that `f` is continuous at `0`. refine continuous_of_continuousAt_zero f ?_ rw [continuousAt_def, f.map_zero] intro U hU -- Continuity means that `U ∈ 𝓝 0` implies that `f ⁻¹' U ∈ 𝓝 0`. rcases h with ⟨V, hV, h⟩ rcases (h hU).exists_pos with ⟨r, hr, h⟩ rcases NormedField.exists_lt_norm 𝕜 r with ⟨x, hx⟩ specialize h x hx.le -- After unfolding all the definitions, we know that `f '' V ⊆ x • U`. We use this to show the -- inclusion `x⁻¹ • V ⊆ f⁻¹' U`. have x_ne := norm_pos_iff.mp (hr.trans hx) have : x⁻¹ • V ⊆ f ⁻¹' U := calc x⁻¹ • V ⊆ x⁻¹ • f ⁻¹' (f '' V) := Set.smul_set_mono (Set.subset_preimage_image (⇑f) V) _ ⊆ x⁻¹ • f ⁻¹' (x • U) := Set.smul_set_mono (Set.preimage_mono h) _ = f ⁻¹' (x⁻¹ • x • U) := by ext simp only [Set.mem_inv_smul_set_iff₀ x_ne, Set.mem_preimage, LinearMap.map_smul] _ ⊆ f ⁻¹' U := by rw [inv_smul_smul₀ x_ne _] -- Using this inclusion, it suffices to show that `x⁻¹ • V` is in `𝓝 0`, which is trivial. refine mem_of_superset ?_ this convert set_smul_mem_nhds_smul hV (inv_ne_zero x_ne) exact (smul_zero _).symm⟩ theorem LinearMap.clmOfExistsBoundedImage_coe {f : E →ₗ[𝕜] F} {h : ∃ V ∈ 𝓝 (0 : E), Bornology.IsVonNBounded 𝕜 (f '' V)} : (f.clmOfExistsBoundedImage h : E →ₗ[𝕜] F) = f := rfl @[simp] theorem LinearMap.clmOfExistsBoundedImage_apply {f : E →ₗ[𝕜] F} {h : ∃ V ∈ 𝓝 (0 : E), Bornology.IsVonNBounded 𝕜 (f '' V)} {x : E} : f.clmOfExistsBoundedImage h x = f x := rfl end NontriviallyNormedField section RCLike open TopologicalSpace Bornology variable [FirstCountableTopology E] variable [RCLike 𝕜] [Module 𝕜 E] [ContinuousSMul 𝕜 E] variable [RCLike 𝕜'] [Module 𝕜' F] [ContinuousSMul 𝕜' F] variable {σ : 𝕜 →+* 𝕜'} theorem LinearMap.continuousAt_zero_of_locally_bounded (f : E →ₛₗ[σ] F) (hf : ∀ s, IsVonNBounded 𝕜 s → IsVonNBounded 𝕜' (f '' s)) : ContinuousAt f 0 := by -- Assume that f is not continuous at 0 by_contra h -- We use a decreasing balanced basis for 0 : E and a balanced basis for 0 : F -- and reformulate non-continuity in terms of these bases rcases (nhds_basis_balanced 𝕜 E).exists_antitone_subbasis with ⟨b, bE1, bE⟩ simp only [_root_.id] at bE have bE' : (𝓝 (0 : E)).HasBasis (fun x : ℕ => x ≠ 0) fun n : ℕ => (n : 𝕜)⁻¹ • b n := by refine bE.1.to_hasBasis ?_ ?_ · intro n _ use n + 1 simp only [Ne, Nat.succ_ne_zero, not_false_iff, Nat.cast_add, Nat.cast_one, true_and_iff] -- `b (n + 1) ⊆ b n` follows from `Antitone`. have h : b (n + 1) ⊆ b n := bE.2 (by simp) refine _root_.trans ?_ h rintro y ⟨x, hx, hy⟩ -- Since `b (n + 1)` is balanced `(n+1)⁻¹ b (n + 1) ⊆ b (n + 1)` rw [← hy] refine (bE1 (n + 1)).2.smul_mem ?_ hx have h' : 0 < (n : ℝ) + 1 := n.cast_add_one_pos rw [norm_inv, ← Nat.cast_one, ← Nat.cast_add, RCLike.norm_natCast, Nat.cast_add, Nat.cast_one, inv_le h' zero_lt_one] simp intro n hn -- The converse direction follows from continuity of the scalar multiplication have hcont : ContinuousAt (fun x : E => (n : 𝕜) • x) 0 := (continuous_const_smul (n : 𝕜)).continuousAt simp only [ContinuousAt, map_zero, smul_zero] at hcont rw [bE.1.tendsto_left_iff] at hcont rcases hcont (b n) (bE1 n).1 with ⟨i, _, hi⟩ refine ⟨i, trivial, fun x hx => ⟨(n : 𝕜) • x, hi hx, ?_⟩⟩ simp [← mul_smul, hn] rw [ContinuousAt, map_zero, bE'.tendsto_iff (nhds_basis_balanced 𝕜' F)] at h push_neg at h rcases h with ⟨V, ⟨hV, -⟩, h⟩ simp only [_root_.id, forall_true_left] at h -- There exists `u : ℕ → E` such that for all `n : ℕ` we have `u n ∈ n⁻¹ • b n` and `f (u n) ∉ V` choose! u hu hu' using h -- The sequence `(fun n ↦ n • u n)` converges to `0` have h_tendsto : Tendsto (fun n : ℕ => (n : 𝕜) • u n) atTop (𝓝 (0 : E)) := by apply bE.tendsto intro n by_cases h : n = 0 · rw [h, Nat.cast_zero, zero_smul] exact mem_of_mem_nhds (bE.1.mem_of_mem <| by trivial) rcases hu n h with ⟨y, hy, hu1⟩ convert hy rw [← hu1, ← mul_smul] simp only [h, mul_inv_cancel, Ne, Nat.cast_eq_zero, not_false_iff, one_smul] -- The image `(fun n ↦ n • u n)` is von Neumann bounded: have h_bounded : IsVonNBounded 𝕜 (Set.range fun n : ℕ => (n : 𝕜) • u n) := h_tendsto.cauchySeq.totallyBounded_range.isVonNBounded 𝕜 -- Since `range u` is bounded, `V` absorbs it rcases (hf _ h_bounded hV).exists_pos with ⟨r, hr, h'⟩ cases' exists_nat_gt r with n hn -- We now find a contradiction between `f (u n) ∉ V` and the absorbing property have h1 : r ≤ ‖(n : 𝕜')‖ := by rw [RCLike.norm_natCast] exact hn.le have hn' : 0 < ‖(n : 𝕜')‖ := lt_of_lt_of_le hr h1 rw [norm_pos_iff, Ne, Nat.cast_eq_zero] at hn' have h'' : f (u n) ∈ V := by simp only [Set.image_subset_iff] at h' specialize h' (n : 𝕜') h1 (Set.mem_range_self n) simp only [Set.mem_preimage, LinearMap.map_smulₛₗ, map_natCast] at h' rcases h' with ⟨y, hy, h'⟩ apply_fun fun y : F => (n : 𝕜')⁻¹ • y at h' simp only [hn', inv_smul_smul₀, Ne, Nat.cast_eq_zero, not_false_iff] at h' rwa [← h'] exact hu' n hn' h'' /-- If `E` is first countable, then every locally bounded linear map `E →ₛₗ[σ] F` is continuous. -/ theorem LinearMap.continuous_of_locally_bounded [UniformAddGroup F] (f : E →ₛₗ[σ] F) (hf : ∀ s, IsVonNBounded 𝕜 s → IsVonNBounded 𝕜' (f '' s)) : Continuous f := (uniformContinuous_of_continuousAt_zero f <| f.continuousAt_zero_of_locally_bounded hf).continuous end RCLike
Analysis\LocallyConvex\Polar.lean
/- Copyright (c) 2022 Moritz Doll. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Moritz Doll, Kalle Kytölä -/ import Mathlib.Analysis.Normed.Field.Basic import Mathlib.LinearAlgebra.SesquilinearForm import Mathlib.Topology.Algebra.Module.WeakDual /-! # Polar set In this file we define the polar set. There are different notions of the polar, we will define the *absolute polar*. The advantage over the real polar is that we can define the absolute polar for any bilinear form `B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜`, where `𝕜` is a normed commutative ring and `E` and `F` are modules over `𝕜`. ## Main definitions * `LinearMap.polar`: The polar of a bilinear form `B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜`. ## Main statements * `LinearMap.polar_eq_iInter`: The polar as an intersection. * `LinearMap.subset_bipolar`: The polar is a subset of the bipolar. * `LinearMap.polar_weak_closed`: The polar is closed in the weak topology induced by `B.flip`. ## References * [H. H. Schaefer, *Topological Vector Spaces*][schaefer1966] ## Tags polar -/ variable {𝕜 E F : Type*} open Topology namespace LinearMap section NormedRing variable [NormedCommRing 𝕜] [AddCommMonoid E] [AddCommMonoid F] variable [Module 𝕜 E] [Module 𝕜 F] variable (B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜) /-- The (absolute) polar of `s : Set E` is given by the set of all `y : F` such that `‖B x y‖ ≤ 1` for all `x ∈ s`. -/ def polar (s : Set E) : Set F := { y : F | ∀ x ∈ s, ‖B x y‖ ≤ 1 } theorem polar_mem_iff (s : Set E) (y : F) : y ∈ B.polar s ↔ ∀ x ∈ s, ‖B x y‖ ≤ 1 := Iff.rfl theorem polar_mem (s : Set E) (y : F) (hy : y ∈ B.polar s) : ∀ x ∈ s, ‖B x y‖ ≤ 1 := hy @[simp] theorem zero_mem_polar (s : Set E) : (0 : F) ∈ B.polar s := fun _ _ => by simp only [map_zero, norm_zero, zero_le_one] theorem polar_eq_iInter {s : Set E} : B.polar s = ⋂ x ∈ s, { y : F | ‖B x y‖ ≤ 1 } := by ext simp only [polar_mem_iff, Set.mem_iInter, Set.mem_setOf_eq] /-- The map `B.polar : Set E → Set F` forms an order-reversing Galois connection with `B.flip.polar : Set F → Set E`. We use `OrderDual.toDual` and `OrderDual.ofDual` to express that `polar` is order-reversing. -/ theorem polar_gc : GaloisConnection (OrderDual.toDual ∘ B.polar) (B.flip.polar ∘ OrderDual.ofDual) := fun _ _ => ⟨fun h _ hx _ hy => h hy _ hx, fun h _ hx _ hy => h hy _ hx⟩ @[simp] theorem polar_iUnion {ι} {s : ι → Set E} : B.polar (⋃ i, s i) = ⋂ i, B.polar (s i) := B.polar_gc.l_iSup @[simp] theorem polar_union {s t : Set E} : B.polar (s ∪ t) = B.polar s ∩ B.polar t := B.polar_gc.l_sup theorem polar_antitone : Antitone (B.polar : Set E → Set F) := B.polar_gc.monotone_l @[simp] theorem polar_empty : B.polar ∅ = Set.univ := B.polar_gc.l_bot @[simp] theorem polar_zero : B.polar ({0} : Set E) = Set.univ := by refine Set.eq_univ_iff_forall.mpr fun y x hx => ?_ rw [Set.mem_singleton_iff.mp hx, map_zero, LinearMap.zero_apply, norm_zero] exact zero_le_one theorem subset_bipolar (s : Set E) : s ⊆ B.flip.polar (B.polar s) := fun x hx y hy => by rw [B.flip_apply] exact hy x hx @[simp] theorem tripolar_eq_polar (s : Set E) : B.polar (B.flip.polar (B.polar s)) = B.polar s := (B.polar_antitone (B.subset_bipolar s)).antisymm (subset_bipolar B.flip (B.polar s)) /-- The polar set is closed in the weak topology induced by `B.flip`. -/ theorem polar_weak_closed (s : Set E) : IsClosed[WeakBilin.instTopologicalSpace B.flip] (B.polar s) := by rw [polar_eq_iInter] refine isClosed_iInter fun x => isClosed_iInter fun _ => ?_ exact isClosed_le (WeakBilin.eval_continuous B.flip x).norm continuous_const end NormedRing section NontriviallyNormedField variable [NontriviallyNormedField 𝕜] [AddCommMonoid E] [AddCommMonoid F] variable [Module 𝕜 E] [Module 𝕜 F] variable (B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜) theorem polar_univ (h : SeparatingRight B) : B.polar Set.univ = {(0 : F)} := by rw [Set.eq_singleton_iff_unique_mem] refine ⟨by simp only [zero_mem_polar], fun y hy => h _ fun x => ?_⟩ refine norm_le_zero_iff.mp (le_of_forall_le_of_dense fun ε hε => ?_) rcases NormedField.exists_norm_lt 𝕜 hε with ⟨c, hc, hcε⟩ calc ‖B x y‖ = ‖c‖ * ‖B (c⁻¹ • x) y‖ := by rw [B.map_smul, LinearMap.smul_apply, Algebra.id.smul_eq_mul, norm_mul, norm_inv, mul_inv_cancel_left₀ hc.ne'] _ ≤ ε * 1 := by gcongr; exact hy _ trivial _ = ε := mul_one _ theorem polar_subMulAction {S : Type*} [SetLike S E] [SMulMemClass S 𝕜 E] (m : S) : B.polar m = { y | ∀ x ∈ m, B x y = 0 } := by ext y constructor · intro hy x hx obtain ⟨r, hr⟩ := NormedField.exists_lt_norm 𝕜 ‖B x y‖⁻¹ contrapose! hr rw [← one_div, le_div_iff (norm_pos_iff.2 hr)] simpa using hy _ (SMulMemClass.smul_mem r hx) · intro h x hx simp [h x hx] /-- The polar of a set closed under scalar multiplication as a submodule -/ def polarSubmodule {S : Type*} [SetLike S E] [SMulMemClass S 𝕜 E] (m : S) : Submodule 𝕜 F := .copy (⨅ x ∈ m, LinearMap.ker (B x)) (B.polar m) <| by ext; simp [polar_subMulAction] end NontriviallyNormedField end LinearMap
Analysis\LocallyConvex\StrongTopology.lean
/- Copyright (c) 2022 Anatole Dedecker. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Anatole Dedecker -/ import Mathlib.Topology.Algebra.Module.StrongTopology import Mathlib.Topology.Algebra.Module.LocallyConvex /-! # Local convexity of the strong topology In this file we prove that the strong topology on `E →L[ℝ] F` is locally convex provided that `F` is locally convex. ## References * [N. Bourbaki, *Topological Vector Spaces*][bourbaki1987] ## TODO * Characterization in terms of seminorms ## Tags locally convex, bounded convergence -/ open Topology UniformConvergence variable {R 𝕜₁ 𝕜₂ E F : Type*} variable [AddCommGroup E] [TopologicalSpace E] [AddCommGroup F] [TopologicalSpace F] [TopologicalAddGroup F] section General namespace UniformConvergenceCLM variable (R) variable [OrderedSemiring R] variable [NormedField 𝕜₁] [NormedField 𝕜₂] [Module 𝕜₁ E] [Module 𝕜₂ F] {σ : 𝕜₁ →+* 𝕜₂} variable [Module R F] [ContinuousConstSMul R F] [LocallyConvexSpace R F] [SMulCommClass 𝕜₂ R F] theorem locallyConvexSpace (𝔖 : Set (Set E)) (h𝔖₁ : 𝔖.Nonempty) (h𝔖₂ : DirectedOn (· ⊆ ·) 𝔖) : LocallyConvexSpace R (UniformConvergenceCLM σ F 𝔖) := by apply LocallyConvexSpace.ofBasisZero _ _ _ _ (UniformConvergenceCLM.hasBasis_nhds_zero_of_basis _ _ _ h𝔖₁ h𝔖₂ (LocallyConvexSpace.convex_basis_zero R F)) _ rintro ⟨S, V⟩ ⟨_, _, hVconvex⟩ f hf g hg a b ha hb hab x hx exact hVconvex (hf x hx) (hg x hx) ha hb hab end UniformConvergenceCLM end General section BoundedSets namespace ContinuousLinearMap variable [OrderedSemiring R] variable [NormedField 𝕜₁] [NormedField 𝕜₂] [Module 𝕜₁ E] [Module 𝕜₂ F] {σ : 𝕜₁ →+* 𝕜₂} variable [Module R F] [ContinuousConstSMul R F] [LocallyConvexSpace R F] [SMulCommClass 𝕜₂ R F] instance instLocallyConvexSpace : LocallyConvexSpace R (E →SL[σ] F) := UniformConvergenceCLM.locallyConvexSpace R _ ⟨∅, Bornology.isVonNBounded_empty 𝕜₁ E⟩ (directedOn_of_sup_mem fun _ _ => Bornology.IsVonNBounded.union) end ContinuousLinearMap end BoundedSets
Analysis\LocallyConvex\WeakDual.lean
/- Copyright (c) 2022 Moritz Doll. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Moritz Doll -/ import Mathlib.Topology.Algebra.Module.WeakDual import Mathlib.Analysis.Normed.Field.Basic import Mathlib.Analysis.LocallyConvex.WithSeminorms /-! # Weak Dual in Topological Vector Spaces We prove that the weak topology induced by a bilinear form `B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜` is locally convex and we explicitly give a neighborhood basis in terms of the family of seminorms `fun x => ‖B x y‖` for `y : F`. ## Main definitions * `LinearMap.toSeminorm`: turn a linear form `f : E →ₗ[𝕜] 𝕜` into a seminorm `fun x => ‖f x‖`. * `LinearMap.toSeminormFamily`: turn a bilinear form `B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜` into a map `F → Seminorm 𝕜 E`. ## Main statements * `LinearMap.hasBasis_weakBilin`: the seminorm balls of `B.toSeminormFamily` form a neighborhood basis of `0` in the weak topology. * `LinearMap.toSeminormFamily.withSeminorms`: the topology of a weak space is induced by the family of seminorms `B.toSeminormFamily`. * `WeakBilin.locallyConvexSpace`: a space endowed with a weak topology is locally convex. ## References * [Bourbaki, *Topological Vector Spaces*][bourbaki1987] ## Tags weak dual, seminorm -/ variable {𝕜 E F ι : Type*} open Topology section BilinForm namespace LinearMap variable [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] [AddCommGroup F] [Module 𝕜 F] /-- Construct a seminorm from a linear form `f : E →ₗ[𝕜] 𝕜` over a normed field `𝕜` by `fun x => ‖f x‖` -/ def toSeminorm (f : E →ₗ[𝕜] 𝕜) : Seminorm 𝕜 E := (normSeminorm 𝕜 𝕜).comp f theorem coe_toSeminorm {f : E →ₗ[𝕜] 𝕜} : ⇑f.toSeminorm = fun x => ‖f x‖ := rfl @[simp] theorem toSeminorm_apply {f : E →ₗ[𝕜] 𝕜} {x : E} : f.toSeminorm x = ‖f x‖ := rfl theorem toSeminorm_ball_zero {f : E →ₗ[𝕜] 𝕜} {r : ℝ} : Seminorm.ball f.toSeminorm 0 r = { x : E | ‖f x‖ < r } := by simp only [Seminorm.ball_zero_eq, toSeminorm_apply] theorem toSeminorm_comp (f : F →ₗ[𝕜] 𝕜) (g : E →ₗ[𝕜] F) : f.toSeminorm.comp g = (f.comp g).toSeminorm := by ext simp only [Seminorm.comp_apply, toSeminorm_apply, coe_comp, Function.comp_apply] /-- Construct a family of seminorms from a bilinear form. -/ def toSeminormFamily (B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜) : SeminormFamily 𝕜 E F := fun y => (B.flip y).toSeminorm @[simp] theorem toSeminormFamily_apply {B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜} {x y} : (B.toSeminormFamily y) x = ‖B x y‖ := rfl end LinearMap end BilinForm section Topology variable [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] [AddCommGroup F] [Module 𝕜 F] variable [Nonempty ι] variable {B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜} theorem LinearMap.hasBasis_weakBilin (B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜) : (𝓝 (0 : WeakBilin B)).HasBasis B.toSeminormFamily.basisSets _root_.id := by let p := B.toSeminormFamily rw [nhds_induced, nhds_pi] simp only [map_zero, LinearMap.zero_apply] have h := @Metric.nhds_basis_ball 𝕜 _ 0 have h' := Filter.hasBasis_pi fun _ : F => h have h'' := Filter.HasBasis.comap (fun x y => B x y) h' refine h''.to_hasBasis ?_ ?_ · rintro (U : Set F × (F → ℝ)) hU cases' hU with hU₁ hU₂ simp only [_root_.id] let U' := hU₁.toFinset by_cases hU₃ : U.fst.Nonempty · have hU₃' : U'.Nonempty := hU₁.toFinset_nonempty.mpr hU₃ refine ⟨(U'.sup p).ball 0 <| U'.inf' hU₃' U.snd, p.basisSets_mem _ <| (Finset.lt_inf'_iff _).2 fun y hy => hU₂ y <| hU₁.mem_toFinset.mp hy, fun x hx y hy => ?_⟩ simp only [Set.mem_preimage, Set.mem_pi, mem_ball_zero_iff] rw [Seminorm.mem_ball_zero] at hx rw [← LinearMap.toSeminormFamily_apply] have hyU' : y ∈ U' := (Set.Finite.mem_toFinset hU₁).mpr hy have hp : p y ≤ U'.sup p := Finset.le_sup hyU' refine lt_of_le_of_lt (hp x) (lt_of_lt_of_le hx ?_) exact Finset.inf'_le _ hyU' rw [Set.not_nonempty_iff_eq_empty.mp hU₃] simp only [Set.empty_pi, Set.preimage_univ, Set.subset_univ, and_true_iff] exact Exists.intro ((p 0).ball 0 1) (p.basisSets_singleton_mem 0 one_pos) rintro U (hU : U ∈ p.basisSets) rw [SeminormFamily.basisSets_iff] at hU rcases hU with ⟨s, r, hr, hU⟩ rw [hU] refine ⟨(s, fun _ => r), ⟨by simp only [s.finite_toSet], fun y _ => hr⟩, fun x hx => ?_⟩ simp only [Set.mem_preimage, Set.mem_pi, Finset.mem_coe, mem_ball_zero_iff] at hx simp only [_root_.id, Seminorm.mem_ball, sub_zero] refine Seminorm.finset_sup_apply_lt hr fun y hy => ?_ rw [LinearMap.toSeminormFamily_apply] exact hx y hy theorem LinearMap.weakBilin_withSeminorms (B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜) : WithSeminorms (LinearMap.toSeminormFamily B : F → Seminorm 𝕜 (WeakBilin B)) := SeminormFamily.withSeminorms_of_hasBasis _ B.hasBasis_weakBilin end Topology section LocallyConvex variable [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] [AddCommGroup F] [Module 𝕜 F] variable [Nonempty ι] [NormedSpace ℝ 𝕜] [Module ℝ E] [IsScalarTower ℝ 𝕜 E] instance WeakBilin.locallyConvexSpace {B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜} : LocallyConvexSpace ℝ (WeakBilin B) := B.weakBilin_withSeminorms.toLocallyConvexSpace end LocallyConvex
Analysis\LocallyConvex\WithSeminorms.lean
/- Copyright (c) 2022 Moritz Doll. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Moritz Doll, Anatole Dedecker -/ import Mathlib.Analysis.LocallyConvex.Bounded import Mathlib.Analysis.Seminorm import Mathlib.Data.Real.Sqrt import Mathlib.Topology.Algebra.Equicontinuity import Mathlib.Topology.MetricSpace.Equicontinuity import Mathlib.Topology.Algebra.FilterBasis import Mathlib.Topology.Algebra.Module.LocallyConvex /-! # Topology induced by a family of seminorms ## Main definitions * `SeminormFamily.basisSets`: The set of open seminorm balls for a family of seminorms. * `SeminormFamily.moduleFilterBasis`: A module filter basis formed by the open balls. * `Seminorm.IsBounded`: A linear map `f : E →ₗ[𝕜] F` is bounded iff every seminorm in `F` can be bounded by a finite number of seminorms in `E`. ## Main statements * `WithSeminorms.toLocallyConvexSpace`: A space equipped with a family of seminorms is locally convex. * `WithSeminorms.firstCountable`: A space is first countable if it's topology is induced by a countable family of seminorms. ## Continuity of semilinear maps If `E` and `F` are topological vector space with the topology induced by a family of seminorms, then we have a direct method to prove that a linear map is continuous: * `Seminorm.continuous_from_bounded`: A bounded linear map `f : E →ₗ[𝕜] F` is continuous. If the topology of a space `E` is induced by a family of seminorms, then we can characterize von Neumann boundedness in terms of that seminorm family. Together with `LinearMap.continuous_of_locally_bounded` this gives general criterion for continuity. * `WithSeminorms.isVonNBounded_iff_finset_seminorm_bounded` * `WithSeminorms.isVonNBounded_iff_seminorm_bounded` * `WithSeminorms.image_isVonNBounded_iff_finset_seminorm_bounded` * `WithSeminorms.image_isVonNBounded_iff_seminorm_bounded` ## Tags seminorm, locally convex -/ open NormedField Set Seminorm TopologicalSpace Filter List open NNReal Pointwise Topology Uniformity variable {𝕜 𝕜₂ 𝕝 𝕝₂ E F G ι ι' : Type*} section FilterBasis variable [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] variable (𝕜 E ι) /-- An abbreviation for indexed families of seminorms. This is mainly to allow for dot-notation. -/ abbrev SeminormFamily := ι → Seminorm 𝕜 E variable {𝕜 E ι} namespace SeminormFamily /-- The sets of a filter basis for the neighborhood filter of 0. -/ def basisSets (p : SeminormFamily 𝕜 E ι) : Set (Set E) := ⋃ (s : Finset ι) (r) (_ : 0 < r), singleton (ball (s.sup p) (0 : E) r) variable (p : SeminormFamily 𝕜 E ι) theorem basisSets_iff {U : Set E} : U ∈ p.basisSets ↔ ∃ (i : Finset ι) (r : ℝ), 0 < r ∧ U = ball (i.sup p) 0 r := by simp only [basisSets, mem_iUnion, exists_prop, mem_singleton_iff] theorem basisSets_mem (i : Finset ι) {r : ℝ} (hr : 0 < r) : (i.sup p).ball 0 r ∈ p.basisSets := (basisSets_iff _).mpr ⟨i, _, hr, rfl⟩ theorem basisSets_singleton_mem (i : ι) {r : ℝ} (hr : 0 < r) : (p i).ball 0 r ∈ p.basisSets := (basisSets_iff _).mpr ⟨{i}, _, hr, by rw [Finset.sup_singleton]⟩ theorem basisSets_nonempty [Nonempty ι] : p.basisSets.Nonempty := by let i := Classical.arbitrary ι refine nonempty_def.mpr ⟨(p i).ball 0 1, ?_⟩ exact p.basisSets_singleton_mem i zero_lt_one theorem basisSets_intersect (U V : Set E) (hU : U ∈ p.basisSets) (hV : V ∈ p.basisSets) : ∃ z ∈ p.basisSets, z ⊆ U ∩ V := by classical rcases p.basisSets_iff.mp hU with ⟨s, r₁, hr₁, hU⟩ rcases p.basisSets_iff.mp hV with ⟨t, r₂, hr₂, hV⟩ use ((s ∪ t).sup p).ball 0 (min r₁ r₂) refine ⟨p.basisSets_mem (s ∪ t) (lt_min_iff.mpr ⟨hr₁, hr₂⟩), ?_⟩ rw [hU, hV, ball_finset_sup_eq_iInter _ _ _ (lt_min_iff.mpr ⟨hr₁, hr₂⟩), ball_finset_sup_eq_iInter _ _ _ hr₁, ball_finset_sup_eq_iInter _ _ _ hr₂] exact Set.subset_inter (Set.iInter₂_mono' fun i hi => ⟨i, Finset.subset_union_left hi, ball_mono <| min_le_left _ _⟩) (Set.iInter₂_mono' fun i hi => ⟨i, Finset.subset_union_right hi, ball_mono <| min_le_right _ _⟩) theorem basisSets_zero (U) (hU : U ∈ p.basisSets) : (0 : E) ∈ U := by rcases p.basisSets_iff.mp hU with ⟨ι', r, hr, hU⟩ rw [hU, mem_ball_zero, map_zero] exact hr theorem basisSets_add (U) (hU : U ∈ p.basisSets) : ∃ V ∈ p.basisSets, V + V ⊆ U := by rcases p.basisSets_iff.mp hU with ⟨s, r, hr, hU⟩ use (s.sup p).ball 0 (r / 2) refine ⟨p.basisSets_mem s (div_pos hr zero_lt_two), ?_⟩ refine Set.Subset.trans (ball_add_ball_subset (s.sup p) (r / 2) (r / 2) 0 0) ?_ rw [hU, add_zero, add_halves] theorem basisSets_neg (U) (hU' : U ∈ p.basisSets) : ∃ V ∈ p.basisSets, V ⊆ (fun x : E => -x) ⁻¹' U := by rcases p.basisSets_iff.mp hU' with ⟨s, r, _, hU⟩ rw [hU, neg_preimage, neg_ball (s.sup p), neg_zero] exact ⟨U, hU', Eq.subset hU⟩ /-- The `addGroupFilterBasis` induced by the filter basis `Seminorm.basisSets`. -/ protected def addGroupFilterBasis [Nonempty ι] : AddGroupFilterBasis E := addGroupFilterBasisOfComm p.basisSets p.basisSets_nonempty p.basisSets_intersect p.basisSets_zero p.basisSets_add p.basisSets_neg theorem basisSets_smul_right (v : E) (U : Set E) (hU : U ∈ p.basisSets) : ∀ᶠ x : 𝕜 in 𝓝 0, x • v ∈ U := by rcases p.basisSets_iff.mp hU with ⟨s, r, hr, hU⟩ rw [hU, Filter.eventually_iff] simp_rw [(s.sup p).mem_ball_zero, map_smul_eq_mul] by_cases h : 0 < (s.sup p) v · simp_rw [(lt_div_iff h).symm] rw [← _root_.ball_zero_eq] exact Metric.ball_mem_nhds 0 (div_pos hr h) simp_rw [le_antisymm (not_lt.mp h) (apply_nonneg _ v), mul_zero, hr] exact IsOpen.mem_nhds isOpen_univ (mem_univ 0) variable [Nonempty ι] theorem basisSets_smul (U) (hU : U ∈ p.basisSets) : ∃ V ∈ 𝓝 (0 : 𝕜), ∃ W ∈ p.addGroupFilterBasis.sets, V • W ⊆ U := by rcases p.basisSets_iff.mp hU with ⟨s, r, hr, hU⟩ refine ⟨Metric.ball 0 √r, Metric.ball_mem_nhds 0 (Real.sqrt_pos.mpr hr), ?_⟩ refine ⟨(s.sup p).ball 0 √r, p.basisSets_mem s (Real.sqrt_pos.mpr hr), ?_⟩ refine Set.Subset.trans (ball_smul_ball (s.sup p) √r √r) ?_ rw [hU, Real.mul_self_sqrt (le_of_lt hr)] theorem basisSets_smul_left (x : 𝕜) (U : Set E) (hU : U ∈ p.basisSets) : ∃ V ∈ p.addGroupFilterBasis.sets, V ⊆ (fun y : E => x • y) ⁻¹' U := by rcases p.basisSets_iff.mp hU with ⟨s, r, hr, hU⟩ rw [hU] by_cases h : x ≠ 0 · rw [(s.sup p).smul_ball_preimage 0 r x h, smul_zero] use (s.sup p).ball 0 (r / ‖x‖) exact ⟨p.basisSets_mem s (div_pos hr (norm_pos_iff.mpr h)), Subset.rfl⟩ refine ⟨(s.sup p).ball 0 r, p.basisSets_mem s hr, ?_⟩ simp only [not_ne_iff.mp h, Set.subset_def, mem_ball_zero, hr, mem_univ, map_zero, imp_true_iff, preimage_const_of_mem, zero_smul] /-- The `moduleFilterBasis` induced by the filter basis `Seminorm.basisSets`. -/ protected def moduleFilterBasis : ModuleFilterBasis 𝕜 E where toAddGroupFilterBasis := p.addGroupFilterBasis smul' := p.basisSets_smul _ smul_left' := p.basisSets_smul_left smul_right' := p.basisSets_smul_right theorem filter_eq_iInf (p : SeminormFamily 𝕜 E ι) : p.moduleFilterBasis.toFilterBasis.filter = ⨅ i, (𝓝 0).comap (p i) := by refine le_antisymm (le_iInf fun i => ?_) ?_ · rw [p.moduleFilterBasis.toFilterBasis.hasBasis.le_basis_iff (Metric.nhds_basis_ball.comap _)] intro ε hε refine ⟨(p i).ball 0 ε, ?_, ?_⟩ · rw [← (Finset.sup_singleton : _ = p i)] exact p.basisSets_mem {i} hε · rw [id, (p i).ball_zero_eq_preimage_ball] · rw [p.moduleFilterBasis.toFilterBasis.hasBasis.ge_iff] rintro U (hU : U ∈ p.basisSets) rcases p.basisSets_iff.mp hU with ⟨s, r, hr, rfl⟩ rw [id, Seminorm.ball_finset_sup_eq_iInter _ _ _ hr, s.iInter_mem_sets] exact fun i _ => Filter.mem_iInf_of_mem i ⟨Metric.ball 0 r, Metric.ball_mem_nhds 0 hr, Eq.subset (p i).ball_zero_eq_preimage_ball.symm⟩ /-- If a family of seminorms is continuous, then their basis sets are neighborhoods of zero. -/ lemma basisSets_mem_nhds {𝕜 E ι : Type*} [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] (p : SeminormFamily 𝕜 E ι) (hp : ∀ i, Continuous (p i)) (U : Set E) (hU : U ∈ p.basisSets) : U ∈ 𝓝 (0 : E) := by obtain ⟨s, r, hr, rfl⟩ := p.basisSets_iff.mp hU clear hU refine Seminorm.ball_mem_nhds ?_ hr classical induction s using Finset.induction_on case empty => simpa using continuous_zero case insert a s _ hs => simp only [Finset.sup_insert, coe_sup] exact Continuous.max (hp a) hs end SeminormFamily end FilterBasis section Bounded namespace Seminorm variable [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] variable [NormedField 𝕜₂] [AddCommGroup F] [Module 𝕜₂ F] variable {σ₁₂ : 𝕜 →+* 𝕜₂} [RingHomIsometric σ₁₂] -- Todo: This should be phrased entirely in terms of the von Neumann bornology. /-- The proposition that a linear map is bounded between spaces with families of seminorms. -/ def IsBounded (p : ι → Seminorm 𝕜 E) (q : ι' → Seminorm 𝕜₂ F) (f : E →ₛₗ[σ₁₂] F) : Prop := ∀ i, ∃ s : Finset ι, ∃ C : ℝ≥0, (q i).comp f ≤ C • s.sup p theorem isBounded_const (ι' : Type*) [Nonempty ι'] {p : ι → Seminorm 𝕜 E} {q : Seminorm 𝕜₂ F} (f : E →ₛₗ[σ₁₂] F) : IsBounded p (fun _ : ι' => q) f ↔ ∃ (s : Finset ι) (C : ℝ≥0), q.comp f ≤ C • s.sup p := by simp only [IsBounded, forall_const] theorem const_isBounded (ι : Type*) [Nonempty ι] {p : Seminorm 𝕜 E} {q : ι' → Seminorm 𝕜₂ F} (f : E →ₛₗ[σ₁₂] F) : IsBounded (fun _ : ι => p) q f ↔ ∀ i, ∃ C : ℝ≥0, (q i).comp f ≤ C • p := by constructor <;> intro h i · rcases h i with ⟨s, C, h⟩ exact ⟨C, le_trans h (smul_le_smul (Finset.sup_le fun _ _ => le_rfl) le_rfl)⟩ use {Classical.arbitrary ι} simp only [h, Finset.sup_singleton] theorem isBounded_sup {p : ι → Seminorm 𝕜 E} {q : ι' → Seminorm 𝕜₂ F} {f : E →ₛₗ[σ₁₂] F} (hf : IsBounded p q f) (s' : Finset ι') : ∃ (C : ℝ≥0) (s : Finset ι), (s'.sup q).comp f ≤ C • s.sup p := by classical obtain rfl | _ := s'.eq_empty_or_nonempty · exact ⟨1, ∅, by simp [Seminorm.bot_eq_zero]⟩ choose fₛ fC hf using hf use s'.card • s'.sup fC, Finset.biUnion s' fₛ have hs : ∀ i : ι', i ∈ s' → (q i).comp f ≤ s'.sup fC • (Finset.biUnion s' fₛ).sup p := by intro i hi refine (hf i).trans (smul_le_smul ?_ (Finset.le_sup hi)) exact Finset.sup_mono (Finset.subset_biUnion_of_mem fₛ hi) refine (comp_mono f (finset_sup_le_sum q s')).trans ?_ simp_rw [← pullback_apply, map_sum, pullback_apply] refine (Finset.sum_le_sum hs).trans ?_ rw [Finset.sum_const, smul_assoc] end Seminorm end Bounded section Topology variable [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] [Nonempty ι] /-- The proposition that the topology of `E` is induced by a family of seminorms `p`. -/ structure WithSeminorms (p : SeminormFamily 𝕜 E ι) [topology : TopologicalSpace E] : Prop where topology_eq_withSeminorms : topology = p.moduleFilterBasis.topology theorem WithSeminorms.withSeminorms_eq {p : SeminormFamily 𝕜 E ι} [t : TopologicalSpace E] (hp : WithSeminorms p) : t = p.moduleFilterBasis.topology := hp.1 variable [TopologicalSpace E] variable {p : SeminormFamily 𝕜 E ι} theorem WithSeminorms.topologicalAddGroup (hp : WithSeminorms p) : TopologicalAddGroup E := by rw [hp.withSeminorms_eq] exact AddGroupFilterBasis.isTopologicalAddGroup _ theorem WithSeminorms.continuousSMul (hp : WithSeminorms p) : ContinuousSMul 𝕜 E := by rw [hp.withSeminorms_eq] exact ModuleFilterBasis.continuousSMul _ theorem WithSeminorms.hasBasis (hp : WithSeminorms p) : (𝓝 (0 : E)).HasBasis (fun s : Set E => s ∈ p.basisSets) id := by rw [congr_fun (congr_arg (@nhds E) hp.1) 0] exact AddGroupFilterBasis.nhds_zero_hasBasis _ theorem WithSeminorms.hasBasis_zero_ball (hp : WithSeminorms p) : (𝓝 (0 : E)).HasBasis (fun sr : Finset ι × ℝ => 0 < sr.2) fun sr => (sr.1.sup p).ball 0 sr.2 := by refine ⟨fun V => ?_⟩ simp only [hp.hasBasis.mem_iff, SeminormFamily.basisSets_iff, Prod.exists] constructor · rintro ⟨-, ⟨s, r, hr, rfl⟩, hV⟩ exact ⟨s, r, hr, hV⟩ · rintro ⟨s, r, hr, hV⟩ exact ⟨_, ⟨s, r, hr, rfl⟩, hV⟩ theorem WithSeminorms.hasBasis_ball (hp : WithSeminorms p) {x : E} : (𝓝 (x : E)).HasBasis (fun sr : Finset ι × ℝ => 0 < sr.2) fun sr => (sr.1.sup p).ball x sr.2 := by have : TopologicalAddGroup E := hp.topologicalAddGroup rw [← map_add_left_nhds_zero] convert hp.hasBasis_zero_ball.map (x + ·) using 1 ext sr : 1 -- Porting note: extra type ascriptions needed on `0` have : (sr.fst.sup p).ball (x +ᵥ (0 : E)) sr.snd = x +ᵥ (sr.fst.sup p).ball 0 sr.snd := Eq.symm (Seminorm.vadd_ball (sr.fst.sup p)) rwa [vadd_eq_add, add_zero] at this /-- The `x`-neighbourhoods of a space whose topology is induced by a family of seminorms are exactly the sets which contain seminorm balls around `x`. -/ theorem WithSeminorms.mem_nhds_iff (hp : WithSeminorms p) (x : E) (U : Set E) : U ∈ 𝓝 x ↔ ∃ s : Finset ι, ∃ r > 0, (s.sup p).ball x r ⊆ U := by rw [hp.hasBasis_ball.mem_iff, Prod.exists] /-- The open sets of a space whose topology is induced by a family of seminorms are exactly the sets which contain seminorm balls around all of their points. -/ theorem WithSeminorms.isOpen_iff_mem_balls (hp : WithSeminorms p) (U : Set E) : IsOpen U ↔ ∀ x ∈ U, ∃ s : Finset ι, ∃ r > 0, (s.sup p).ball x r ⊆ U := by simp_rw [← WithSeminorms.mem_nhds_iff hp _ U, isOpen_iff_mem_nhds] /- Note that through the following lemmas, one also immediately has that separating families of seminorms induce T₂ and T₃ topologies by `TopologicalAddGroup.t2Space` and `TopologicalAddGroup.t3Space` -/ /-- A separating family of seminorms induces a T₁ topology. -/ theorem WithSeminorms.T1_of_separating (hp : WithSeminorms p) (h : ∀ x, x ≠ 0 → ∃ i, p i x ≠ 0) : T1Space E := by have := hp.topologicalAddGroup refine TopologicalAddGroup.t1Space _ ?_ rw [← isOpen_compl_iff, hp.isOpen_iff_mem_balls] rintro x (hx : x ≠ 0) cases' h x hx with i pi_nonzero refine ⟨{i}, p i x, by positivity, subset_compl_singleton_iff.mpr ?_⟩ rw [Finset.sup_singleton, mem_ball, zero_sub, map_neg_eq_map, not_lt] /-- A family of seminorms inducing a T₁ topology is separating. -/ theorem WithSeminorms.separating_of_T1 [T1Space E] (hp : WithSeminorms p) (x : E) (hx : x ≠ 0) : ∃ i, p i x ≠ 0 := by have := ((t1Space_TFAE E).out 0 9).mp (inferInstanceAs <| T1Space E) by_contra! h refine hx (this ?_) rw [hp.hasBasis_zero_ball.specializes_iff] rintro ⟨s, r⟩ (hr : 0 < r) simp only [ball_finset_sup_eq_iInter _ _ _ hr, mem_iInter₂, mem_ball_zero, h, hr, forall_true_iff] /-- A family of seminorms is separating iff it induces a T₁ topology. -/ theorem WithSeminorms.separating_iff_T1 (hp : WithSeminorms p) : (∀ x, x ≠ 0 → ∃ i, p i x ≠ 0) ↔ T1Space E := by refine ⟨WithSeminorms.T1_of_separating hp, ?_⟩ intro exact WithSeminorms.separating_of_T1 hp end Topology section Tendsto variable [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] [Nonempty ι] [TopologicalSpace E] variable {p : SeminormFamily 𝕜 E ι} /-- Convergence along filters for `WithSeminorms`. Variant with `Finset.sup`. -/ theorem WithSeminorms.tendsto_nhds' (hp : WithSeminorms p) (u : F → E) {f : Filter F} (y₀ : E) : Filter.Tendsto u f (𝓝 y₀) ↔ ∀ (s : Finset ι) (ε), 0 < ε → ∀ᶠ x in f, s.sup p (u x - y₀) < ε := by simp [hp.hasBasis_ball.tendsto_right_iff] /-- Convergence along filters for `WithSeminorms`. -/ theorem WithSeminorms.tendsto_nhds (hp : WithSeminorms p) (u : F → E) {f : Filter F} (y₀ : E) : Filter.Tendsto u f (𝓝 y₀) ↔ ∀ i ε, 0 < ε → ∀ᶠ x in f, p i (u x - y₀) < ε := by rw [hp.tendsto_nhds' u y₀] exact ⟨fun h i => by simpa only [Finset.sup_singleton] using h {i}, fun h s ε hε => (s.eventually_all.2 fun i _ => h i ε hε).mono fun _ => finset_sup_apply_lt hε⟩ variable [SemilatticeSup F] [Nonempty F] /-- Limit `→ ∞` for `WithSeminorms`. -/ theorem WithSeminorms.tendsto_nhds_atTop (hp : WithSeminorms p) (u : F → E) (y₀ : E) : Filter.Tendsto u Filter.atTop (𝓝 y₀) ↔ ∀ i ε, 0 < ε → ∃ x₀, ∀ x, x₀ ≤ x → p i (u x - y₀) < ε := by rw [hp.tendsto_nhds u y₀] exact forall₃_congr fun _ _ _ => Filter.eventually_atTop end Tendsto section TopologicalAddGroup variable [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] variable [Nonempty ι] section TopologicalSpace variable [t : TopologicalSpace E] theorem SeminormFamily.withSeminorms_of_nhds [TopologicalAddGroup E] (p : SeminormFamily 𝕜 E ι) (h : 𝓝 (0 : E) = p.moduleFilterBasis.toFilterBasis.filter) : WithSeminorms p := by refine ⟨TopologicalAddGroup.ext inferInstance p.addGroupFilterBasis.isTopologicalAddGroup ?_⟩ rw [AddGroupFilterBasis.nhds_zero_eq] exact h theorem SeminormFamily.withSeminorms_of_hasBasis [TopologicalAddGroup E] (p : SeminormFamily 𝕜 E ι) (h : (𝓝 (0 : E)).HasBasis (fun s : Set E => s ∈ p.basisSets) id) : WithSeminorms p := p.withSeminorms_of_nhds <| Filter.HasBasis.eq_of_same_basis h p.addGroupFilterBasis.toFilterBasis.hasBasis theorem SeminormFamily.withSeminorms_iff_nhds_eq_iInf [TopologicalAddGroup E] (p : SeminormFamily 𝕜 E ι) : WithSeminorms p ↔ (𝓝 (0 : E)) = ⨅ i, (𝓝 0).comap (p i) := by rw [← p.filter_eq_iInf] refine ⟨fun h => ?_, p.withSeminorms_of_nhds⟩ rw [h.topology_eq_withSeminorms] exact AddGroupFilterBasis.nhds_zero_eq _ /-- The topology induced by a family of seminorms is exactly the infimum of the ones induced by each seminorm individually. We express this as a characterization of `WithSeminorms p`. -/ theorem SeminormFamily.withSeminorms_iff_topologicalSpace_eq_iInf [TopologicalAddGroup E] (p : SeminormFamily 𝕜 E ι) : WithSeminorms p ↔ t = ⨅ i, (p i).toSeminormedAddCommGroup.toUniformSpace.toTopologicalSpace := by rw [p.withSeminorms_iff_nhds_eq_iInf, TopologicalAddGroup.ext_iff inferInstance (topologicalAddGroup_iInf fun i => inferInstance), nhds_iInf] congrm _ = ⨅ i, ?_ exact @comap_norm_nhds_zero _ (p i).toSeminormedAddGroup theorem WithSeminorms.continuous_seminorm {p : SeminormFamily 𝕜 E ι} (hp : WithSeminorms p) (i : ι) : Continuous (p i) := by have := hp.topologicalAddGroup rw [p.withSeminorms_iff_topologicalSpace_eq_iInf.mp hp] exact continuous_iInf_dom (@continuous_norm _ (p i).toSeminormedAddGroup) end TopologicalSpace /-- The uniform structure induced by a family of seminorms is exactly the infimum of the ones induced by each seminorm individually. We express this as a characterization of `WithSeminorms p`. -/ theorem SeminormFamily.withSeminorms_iff_uniformSpace_eq_iInf [u : UniformSpace E] [UniformAddGroup E] (p : SeminormFamily 𝕜 E ι) : WithSeminorms p ↔ u = ⨅ i, (p i).toSeminormedAddCommGroup.toUniformSpace := by rw [p.withSeminorms_iff_nhds_eq_iInf, UniformAddGroup.ext_iff inferInstance (uniformAddGroup_iInf fun i => inferInstance), UniformSpace.toTopologicalSpace_iInf, nhds_iInf] congrm _ = ⨅ i, ?_ exact @comap_norm_nhds_zero _ (p i).toAddGroupSeminorm.toSeminormedAddGroup end TopologicalAddGroup section NormedSpace /-- The topology of a `NormedSpace 𝕜 E` is induced by the seminorm `normSeminorm 𝕜 E`. -/ theorem norm_withSeminorms (𝕜 E) [NormedField 𝕜] [SeminormedAddCommGroup E] [NormedSpace 𝕜 E] : WithSeminorms fun _ : Fin 1 => normSeminorm 𝕜 E := by let p : SeminormFamily 𝕜 E (Fin 1) := fun _ => normSeminorm 𝕜 E refine ⟨SeminormedAddCommGroup.toTopologicalAddGroup.ext p.addGroupFilterBasis.isTopologicalAddGroup ?_⟩ refine Filter.HasBasis.eq_of_same_basis Metric.nhds_basis_ball ?_ rw [← ball_normSeminorm 𝕜 E] refine Filter.HasBasis.to_hasBasis p.addGroupFilterBasis.nhds_zero_hasBasis ?_ fun r hr => ⟨(normSeminorm 𝕜 E).ball 0 r, p.basisSets_singleton_mem 0 hr, rfl.subset⟩ rintro U (hU : U ∈ p.basisSets) rcases p.basisSets_iff.mp hU with ⟨s, r, hr, hU⟩ use r, hr rw [hU, id] by_cases h : s.Nonempty · rw [Finset.sup_const h] rw [Finset.not_nonempty_iff_eq_empty.mp h, Finset.sup_empty, ball_bot _ hr] exact Set.subset_univ _ end NormedSpace section NontriviallyNormedField variable [NontriviallyNormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] [Nonempty ι] variable {p : SeminormFamily 𝕜 E ι} variable [TopologicalSpace E] theorem WithSeminorms.isVonNBounded_iff_finset_seminorm_bounded {s : Set E} (hp : WithSeminorms p) : Bornology.IsVonNBounded 𝕜 s ↔ ∀ I : Finset ι, ∃ r > 0, ∀ x ∈ s, I.sup p x < r := by rw [hp.hasBasis.isVonNBounded_iff] constructor · intro h I simp only [id] at h specialize h ((I.sup p).ball 0 1) (p.basisSets_mem I zero_lt_one) rcases h.exists_pos with ⟨r, hr, h⟩ cases' NormedField.exists_lt_norm 𝕜 r with a ha specialize h a (le_of_lt ha) rw [Seminorm.smul_ball_zero (norm_pos_iff.1 <| hr.trans ha), mul_one] at h refine ⟨‖a‖, lt_trans hr ha, ?_⟩ intro x hx specialize h hx exact (Finset.sup I p).mem_ball_zero.mp h intro h s' hs' rcases p.basisSets_iff.mp hs' with ⟨I, r, hr, hs'⟩ rw [id, hs'] rcases h I with ⟨r', _, h'⟩ simp_rw [← (I.sup p).mem_ball_zero] at h' refine Absorbs.mono_right ?_ h' exact (Finset.sup I p).ball_zero_absorbs_ball_zero hr theorem WithSeminorms.image_isVonNBounded_iff_finset_seminorm_bounded (f : G → E) {s : Set G} (hp : WithSeminorms p) : Bornology.IsVonNBounded 𝕜 (f '' s) ↔ ∀ I : Finset ι, ∃ r > 0, ∀ x ∈ s, I.sup p (f x) < r := by simp_rw [hp.isVonNBounded_iff_finset_seminorm_bounded, Set.forall_mem_image] theorem WithSeminorms.isVonNBounded_iff_seminorm_bounded {s : Set E} (hp : WithSeminorms p) : Bornology.IsVonNBounded 𝕜 s ↔ ∀ i : ι, ∃ r > 0, ∀ x ∈ s, p i x < r := by rw [hp.isVonNBounded_iff_finset_seminorm_bounded] constructor · intro hI i convert hI {i} rw [Finset.sup_singleton] intro hi I by_cases hI : I.Nonempty · choose r hr h using hi have h' : 0 < I.sup' hI r := by rcases hI with ⟨i, hi⟩ exact lt_of_lt_of_le (hr i) (Finset.le_sup' r hi) refine ⟨I.sup' hI r, h', fun x hx => finset_sup_apply_lt h' fun i hi => ?_⟩ refine lt_of_lt_of_le (h i x hx) ?_ simp only [Finset.le_sup'_iff, exists_prop] exact ⟨i, hi, (Eq.refl _).le⟩ simp only [Finset.not_nonempty_iff_eq_empty.mp hI, Finset.sup_empty, coe_bot, Pi.zero_apply, exists_prop] exact ⟨1, zero_lt_one, fun _ _ => zero_lt_one⟩ theorem WithSeminorms.image_isVonNBounded_iff_seminorm_bounded (f : G → E) {s : Set G} (hp : WithSeminorms p) : Bornology.IsVonNBounded 𝕜 (f '' s) ↔ ∀ i : ι, ∃ r > 0, ∀ x ∈ s, p i (f x) < r := by simp_rw [hp.isVonNBounded_iff_seminorm_bounded, Set.forall_mem_image] end NontriviallyNormedField -- TODO: the names in this section are not very predictable section continuous_of_bounded namespace Seminorm variable [NontriviallyNormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] variable [NormedField 𝕝] [Module 𝕝 E] variable [NontriviallyNormedField 𝕜₂] [AddCommGroup F] [Module 𝕜₂ F] variable [NormedField 𝕝₂] [Module 𝕝₂ F] variable {σ₁₂ : 𝕜 →+* 𝕜₂} [RingHomIsometric σ₁₂] variable {τ₁₂ : 𝕝 →+* 𝕝₂} [RingHomIsometric τ₁₂] variable [Nonempty ι] [Nonempty ι'] theorem continuous_of_continuous_comp {q : SeminormFamily 𝕝₂ F ι'} [TopologicalSpace E] [TopologicalAddGroup E] [TopologicalSpace F] (hq : WithSeminorms q) (f : E →ₛₗ[τ₁₂] F) (hf : ∀ i, Continuous ((q i).comp f)) : Continuous f := by have : TopologicalAddGroup F := hq.topologicalAddGroup refine continuous_of_continuousAt_zero f ?_ simp_rw [ContinuousAt, f.map_zero, q.withSeminorms_iff_nhds_eq_iInf.mp hq, Filter.tendsto_iInf, Filter.tendsto_comap_iff] intro i convert (hf i).continuousAt.tendsto exact (map_zero _).symm theorem continuous_iff_continuous_comp {q : SeminormFamily 𝕜₂ F ι'} [TopologicalSpace E] [TopologicalAddGroup E] [TopologicalSpace F] (hq : WithSeminorms q) (f : E →ₛₗ[σ₁₂] F) : Continuous f ↔ ∀ i, Continuous ((q i).comp f) := -- Porting note: if we *don't* use dot notation for `Continuous.comp`, Lean tries to show -- continuity of `((q i).comp f) ∘ id` because it doesn't see that `((q i).comp f)` is -- actually a composition of functions. ⟨fun h i => (hq.continuous_seminorm i).comp h, continuous_of_continuous_comp hq f⟩ theorem continuous_from_bounded {p : SeminormFamily 𝕝 E ι} {q : SeminormFamily 𝕝₂ F ι'} {_ : TopologicalSpace E} (hp : WithSeminorms p) {_ : TopologicalSpace F} (hq : WithSeminorms q) (f : E →ₛₗ[τ₁₂] F) (hf : Seminorm.IsBounded p q f) : Continuous f := by have : TopologicalAddGroup E := hp.topologicalAddGroup refine continuous_of_continuous_comp hq _ fun i => ?_ rcases hf i with ⟨s, C, hC⟩ rw [← Seminorm.finset_sup_smul] at hC -- Note: we deduce continuouty of `s.sup (C • p)` from that of `∑ i ∈ s, C • p i`. -- The reason is that there is no `continuous_finset_sup`, and even if it were we couldn't -- really use it since `ℝ` is not an `OrderBot`. refine Seminorm.continuous_of_le ?_ (hC.trans <| Seminorm.finset_sup_le_sum _ _) change Continuous (fun x ↦ Seminorm.coeFnAddMonoidHom _ _ (∑ i ∈ s, C • p i) x) simp_rw [map_sum, Finset.sum_apply] exact (continuous_finset_sum _ fun i _ ↦ (hp.continuous_seminorm i).const_smul (C : ℝ)) theorem cont_withSeminorms_normedSpace (F) [SeminormedAddCommGroup F] [NormedSpace 𝕝₂ F] [TopologicalSpace E] {p : ι → Seminorm 𝕝 E} (hp : WithSeminorms p) (f : E →ₛₗ[τ₁₂] F) (hf : ∃ (s : Finset ι) (C : ℝ≥0), (normSeminorm 𝕝₂ F).comp f ≤ C • s.sup p) : Continuous f := by rw [← Seminorm.isBounded_const (Fin 1)] at hf exact continuous_from_bounded hp (norm_withSeminorms 𝕝₂ F) f hf theorem cont_normedSpace_to_withSeminorms (E) [SeminormedAddCommGroup E] [NormedSpace 𝕝 E] [TopologicalSpace F] {q : ι → Seminorm 𝕝₂ F} (hq : WithSeminorms q) (f : E →ₛₗ[τ₁₂] F) (hf : ∀ i : ι, ∃ C : ℝ≥0, (q i).comp f ≤ C • normSeminorm 𝕝 E) : Continuous f := by rw [← Seminorm.const_isBounded (Fin 1)] at hf exact continuous_from_bounded (norm_withSeminorms 𝕝 E) hq f hf /-- Let `E` and `F` be two topological vector spaces over a `NontriviallyNormedField`, and assume that the topology of `F` is generated by some family of seminorms `q`. For a family `f` of linear maps from `E` to `F`, the following are equivalent: * `f` is equicontinuous at `0`. * `f` is equicontinuous. * `f` is uniformly equicontinuous. * For each `q i`, the family of seminorms `k ↦ (q i) ∘ (f k)` is bounded by some continuous seminorm `p` on `E`. * For each `q i`, the seminorm `⊔ k, (q i) ∘ (f k)` is well-defined and continuous. In particular, if you can determine all continuous seminorms on `E`, that gives you a complete characterization of equicontinuity for linear maps from `E` to `F`. For example `E` and `F` are both normed spaces, you get `NormedSpace.equicontinuous_TFAE`. -/ protected theorem _root_.WithSeminorms.equicontinuous_TFAE {κ : Type*} {q : SeminormFamily 𝕜₂ F ι'} [UniformSpace E] [UniformAddGroup E] [u : UniformSpace F] [hu : UniformAddGroup F] (hq : WithSeminorms q) [ContinuousSMul 𝕜 E] (f : κ → E →ₛₗ[σ₁₂] F) : TFAE [ EquicontinuousAt ((↑) ∘ f) 0, Equicontinuous ((↑) ∘ f), UniformEquicontinuous ((↑) ∘ f), ∀ i, ∃ p : Seminorm 𝕜 E, Continuous p ∧ ∀ k, (q i).comp (f k) ≤ p, ∀ i, BddAbove (range fun k ↦ (q i).comp (f k)) ∧ Continuous (⨆ k, (q i).comp (f k)) ] := by -- We start by reducing to the case where the target is a seminormed space rw [q.withSeminorms_iff_uniformSpace_eq_iInf.mp hq, uniformEquicontinuous_iInf_rng, equicontinuous_iInf_rng, equicontinuousAt_iInf_rng] refine forall_tfae [_, _, _, _, _] fun i ↦ ?_ let _ : SeminormedAddCommGroup F := (q i).toSeminormedAddCommGroup clear u hu hq -- Now we can prove the equivalence in this setting simp only [List.map] tfae_have 1 → 3 · exact uniformEquicontinuous_of_equicontinuousAt_zero f tfae_have 3 → 2 · exact UniformEquicontinuous.equicontinuous tfae_have 2 → 1 · exact fun H ↦ H 0 tfae_have 3 → 5 · intro H have : ∀ᶠ x in 𝓝 0, ∀ k, q i (f k x) ≤ 1 := by filter_upwards [Metric.equicontinuousAt_iff_right.mp (H.equicontinuous 0) 1 one_pos] with x hx k simpa using (hx k).le have bdd : BddAbove (range fun k ↦ (q i).comp (f k)) := Seminorm.bddAbove_of_absorbent (absorbent_nhds_zero this) (fun x hx ↦ ⟨1, forall_mem_range.mpr hx⟩) rw [← Seminorm.coe_iSup_eq bdd] refine ⟨bdd, Seminorm.continuous' (r := 1) ?_⟩ filter_upwards [this] with x hx simpa only [closedBall_iSup bdd _ one_pos, mem_iInter, mem_closedBall_zero] using hx tfae_have 5 → 4 · exact fun H ↦ ⟨⨆ k, (q i).comp (f k), Seminorm.coe_iSup_eq H.1 ▸ H.2, le_ciSup H.1⟩ tfae_have 4 → 1 -- This would work over any `NormedField` · intro ⟨p, hp, hfp⟩ exact Metric.equicontinuousAt_of_continuity_modulus p (map_zero p ▸ hp.tendsto 0) _ <| eventually_of_forall fun x k ↦ by simpa using hfp k x tfae_finish theorem _root_.WithSeminorms.uniformEquicontinuous_iff_exists_continuous_seminorm {κ : Type*} {q : SeminormFamily 𝕜₂ F ι'} [UniformSpace E] [UniformAddGroup E] [u : UniformSpace F] [hu : UniformAddGroup F] (hq : WithSeminorms q) [ContinuousSMul 𝕜 E] (f : κ → E →ₛₗ[σ₁₂] F) : UniformEquicontinuous ((↑) ∘ f) ↔ ∀ i, ∃ p : Seminorm 𝕜 E, Continuous p ∧ ∀ k, (q i).comp (f k) ≤ p := (hq.equicontinuous_TFAE f).out 2 3 theorem _root_.WithSeminorms.uniformEquicontinuous_iff_bddAbove_and_continuous_iSup {κ : Type*} {q : SeminormFamily 𝕜₂ F ι'} [UniformSpace E] [UniformAddGroup E] [u : UniformSpace F] [hu : UniformAddGroup F] (hq : WithSeminorms q) [ContinuousSMul 𝕜 E] (f : κ → E →ₛₗ[σ₁₂] F) : UniformEquicontinuous ((↑) ∘ f) ↔ ∀ i, BddAbove (range fun k ↦ (q i).comp (f k)) ∧ Continuous (⨆ k, (q i).comp (f k)) := (hq.equicontinuous_TFAE f).out 2 4 end Seminorm section Congr namespace WithSeminorms variable [Nonempty ι] [Nonempty ι'] variable [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] variable [NormedField 𝕜₂] [AddCommGroup F] [Module 𝕜₂ F] variable {σ₁₂ : 𝕜 →+* 𝕜₂} [RingHomIsometric σ₁₂] /-- Two families of seminorms `p` and `q` on the same space generate the same topology if each `p i` is bounded by some `C • Finset.sup s q` and vice-versa. We formulate these boundedness assumptions as `Seminorm.IsBounded q p LinearMap.id` (and vice-versa) to reuse the API. Furthermore, we don't actually state it as an equality of topologies but as a way to deduce `WithSeminorms q` from `WithSeminorms p`, since this should be more useful in practice. -/ protected theorem congr {p : SeminormFamily 𝕜 E ι} {q : SeminormFamily 𝕜 E ι'} [t : TopologicalSpace E] (hp : WithSeminorms p) (hpq : Seminorm.IsBounded p q LinearMap.id) (hqp : Seminorm.IsBounded q p LinearMap.id) : WithSeminorms q := by constructor rw [hp.topology_eq_withSeminorms] clear hp t refine le_antisymm ?_ ?_ <;> rw [← continuous_id_iff_le] <;> refine continuous_from_bounded (.mk (topology := _) rfl) (.mk (topology := _) rfl) LinearMap.id (by assumption) protected theorem finset_sups {p : SeminormFamily 𝕜 E ι} [TopologicalSpace E] (hp : WithSeminorms p) : WithSeminorms (fun s : Finset ι ↦ s.sup p) := by refine hp.congr ?_ ?_ · intro s refine ⟨s, 1, ?_⟩ rw [one_smul] rfl · intro i refine ⟨{{i}}, 1, ?_⟩ rw [Finset.sup_singleton, Finset.sup_singleton, one_smul] rfl protected theorem partial_sups [Preorder ι] [LocallyFiniteOrderBot ι] {p : SeminormFamily 𝕜 E ι} [TopologicalSpace E] (hp : WithSeminorms p) : WithSeminorms (fun i ↦ (Finset.Iic i).sup p) := by refine hp.congr ?_ ?_ · intro i refine ⟨Finset.Iic i, 1, ?_⟩ rw [one_smul] rfl · intro i refine ⟨{i}, 1, ?_⟩ rw [Finset.sup_singleton, one_smul] exact (Finset.le_sup (Finset.mem_Iic.mpr le_rfl) : p i ≤ (Finset.Iic i).sup p) protected theorem congr_equiv {p : SeminormFamily 𝕜 E ι} [t : TopologicalSpace E] (hp : WithSeminorms p) (e : ι' ≃ ι) : WithSeminorms (p ∘ e) := by refine hp.congr ?_ ?_ <;> intro i <;> [use {e i}, 1; use {e.symm i}, 1] <;> simp end WithSeminorms end Congr end continuous_of_bounded section bounded_of_continuous namespace Seminorm variable [NontriviallyNormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] [SeminormedAddCommGroup F] [NormedSpace 𝕜 F] {p : SeminormFamily 𝕜 E ι} /-- In a semi-`NormedSpace`, a continuous seminorm is zero on elements of norm `0`. -/ lemma map_eq_zero_of_norm_zero (q : Seminorm 𝕜 F) (hq : Continuous q) {x : F} (hx : ‖x‖ = 0) : q x = 0 := (map_zero q) ▸ ((specializes_iff_mem_closure.mpr <| mem_closure_zero_iff_norm.mpr hx).map hq).eq.symm /-- Let `F` be a semi-`NormedSpace` over a `NontriviallyNormedField`, and let `q` be a seminorm on `F`. If `q` is continuous, then it is uniformly controlled by the norm, that is there is some `C > 0` such that `∀ x, q x ≤ C * ‖x‖`. The continuity ensures boundedness on a ball of some radius `ε`. The nontriviality of the norm is then used to rescale any element into an element of norm in `[ε/C, ε[`, thus with a controlled image by `q`. The control of `q` at the original element follows by rescaling. -/ lemma bound_of_continuous_normedSpace (q : Seminorm 𝕜 F) (hq : Continuous q) : ∃ C, 0 < C ∧ (∀ x : F, q x ≤ C * ‖x‖) := by have hq' : Tendsto q (𝓝 0) (𝓝 0) := map_zero q ▸ hq.tendsto 0 rcases NormedAddCommGroup.nhds_zero_basis_norm_lt.mem_iff.mp (hq' <| Iio_mem_nhds one_pos) with ⟨ε, ε_pos, hε⟩ rcases NormedField.exists_one_lt_norm 𝕜 with ⟨c, hc⟩ have : 0 < ‖c‖ / ε := by positivity refine ⟨‖c‖ / ε, this, fun x ↦ ?_⟩ by_cases hx : ‖x‖ = 0 · rw [hx, mul_zero] exact le_of_eq (map_eq_zero_of_norm_zero q hq hx) · refine (normSeminorm 𝕜 F).bound_of_shell q ε_pos hc (fun x hle hlt ↦ ?_) hx refine (le_of_lt <| show q x < _ from hε hlt).trans ?_ rwa [← div_le_iff' this, one_div_div] /-- Let `E` be a topological vector space (over a `NontriviallyNormedField`) whose topology is generated by some family of seminorms `p`, and let `q` be a seminorm on `E`. If `q` is continuous, then it is uniformly controlled by *finitely many* seminorms of `p`, that is there is some finset `s` of the index set and some `C > 0` such that `q ≤ C • s.sup p`. -/ lemma bound_of_continuous [Nonempty ι] [t : TopologicalSpace E] (hp : WithSeminorms p) (q : Seminorm 𝕜 E) (hq : Continuous q) : ∃ s : Finset ι, ∃ C : ℝ≥0, C ≠ 0 ∧ q ≤ C • s.sup p := by -- The continuity of `q` gives us a finset `s` and a real `ε > 0` -- such that `hε : (s.sup p).ball 0 ε ⊆ q.ball 0 1`. rcases hp.hasBasis.mem_iff.mp (ball_mem_nhds hq one_pos) with ⟨V, hV, hε⟩ rcases p.basisSets_iff.mp hV with ⟨s, ε, ε_pos, rfl⟩ -- Now forget that `E` already had a topology and view it as the (semi)normed space -- `(E, s.sup p)`. clear hp hq t let _ : SeminormedAddCommGroup E := (s.sup p).toSeminormedAddCommGroup let _ : NormedSpace 𝕜 E := { norm_smul_le := fun a b ↦ le_of_eq (map_smul_eq_mul (s.sup p) a b) } -- The inclusion `hε` tells us exactly that `q` is *still* continuous for this new topology have : Continuous q := Seminorm.continuous (r := 1) (mem_of_superset (Metric.ball_mem_nhds _ ε_pos) hε) -- Hence we can conclude by applying `bound_of_continuous_normedSpace`. rcases bound_of_continuous_normedSpace q this with ⟨C, C_pos, hC⟩ exact ⟨s, ⟨C, C_pos.le⟩, fun H ↦ C_pos.ne.symm (congr_arg NNReal.toReal H), hC⟩ -- Note that the key ingredient for this proof is that, by scaling arguments hidden in -- `Seminorm.continuous`, we only have to look at the `q`-ball of radius one, and the `s` we get -- from that will automatically work for all other radii. end Seminorm end bounded_of_continuous section LocallyConvexSpace open LocallyConvexSpace variable [Nonempty ι] [NormedField 𝕜] [NormedSpace ℝ 𝕜] [AddCommGroup E] [Module 𝕜 E] [Module ℝ E] [IsScalarTower ℝ 𝕜 E] [TopologicalSpace E] theorem WithSeminorms.toLocallyConvexSpace {p : SeminormFamily 𝕜 E ι} (hp : WithSeminorms p) : LocallyConvexSpace ℝ E := by have := hp.topologicalAddGroup apply ofBasisZero ℝ E id fun s => s ∈ p.basisSets · rw [hp.1, AddGroupFilterBasis.nhds_eq _, AddGroupFilterBasis.N_zero] exact FilterBasis.hasBasis _ · intro s hs change s ∈ Set.iUnion _ at hs simp_rw [Set.mem_iUnion, Set.mem_singleton_iff] at hs rcases hs with ⟨I, r, _, rfl⟩ exact convex_ball _ _ _ end LocallyConvexSpace section NormedSpace variable (𝕜) [NormedField 𝕜] [NormedSpace ℝ 𝕜] [SeminormedAddCommGroup E] /-- Not an instance since `𝕜` can't be inferred. See `NormedSpace.toLocallyConvexSpace` for a slightly weaker instance version. -/ theorem NormedSpace.toLocallyConvexSpace' [NormedSpace 𝕜 E] [Module ℝ E] [IsScalarTower ℝ 𝕜 E] : LocallyConvexSpace ℝ E := (norm_withSeminorms 𝕜 E).toLocallyConvexSpace /-- See `NormedSpace.toLocallyConvexSpace'` for a slightly stronger version which is not an instance. -/ instance NormedSpace.toLocallyConvexSpace [NormedSpace ℝ E] : LocallyConvexSpace ℝ E := NormedSpace.toLocallyConvexSpace' ℝ end NormedSpace section TopologicalConstructions variable [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] variable [NormedField 𝕜₂] [AddCommGroup F] [Module 𝕜₂ F] variable {σ₁₂ : 𝕜 →+* 𝕜₂} [RingHomIsometric σ₁₂] /-- The family of seminorms obtained by composing each seminorm by a linear map. -/ def SeminormFamily.comp (q : SeminormFamily 𝕜₂ F ι) (f : E →ₛₗ[σ₁₂] F) : SeminormFamily 𝕜 E ι := fun i => (q i).comp f theorem SeminormFamily.comp_apply (q : SeminormFamily 𝕜₂ F ι) (i : ι) (f : E →ₛₗ[σ₁₂] F) : q.comp f i = (q i).comp f := rfl theorem SeminormFamily.finset_sup_comp (q : SeminormFamily 𝕜₂ F ι) (s : Finset ι) (f : E →ₛₗ[σ₁₂] F) : (s.sup q).comp f = s.sup (q.comp f) := by ext x rw [Seminorm.comp_apply, Seminorm.finset_sup_apply, Seminorm.finset_sup_apply] rfl variable [TopologicalSpace F] theorem LinearMap.withSeminorms_induced [hι : Nonempty ι] {q : SeminormFamily 𝕜₂ F ι} (hq : WithSeminorms q) (f : E →ₛₗ[σ₁₂] F) : WithSeminorms (topology := induced f inferInstance) (q.comp f) := by have := hq.topologicalAddGroup let _ : TopologicalSpace E := induced f inferInstance have : TopologicalAddGroup E := topologicalAddGroup_induced f rw [(q.comp f).withSeminorms_iff_nhds_eq_iInf, nhds_induced, map_zero, q.withSeminorms_iff_nhds_eq_iInf.mp hq, Filter.comap_iInf] refine iInf_congr fun i => ?_ exact Filter.comap_comap theorem Inducing.withSeminorms [hι : Nonempty ι] {q : SeminormFamily 𝕜₂ F ι} (hq : WithSeminorms q) [TopologicalSpace E] {f : E →ₛₗ[σ₁₂] F} (hf : Inducing f) : WithSeminorms (q.comp f) := by rw [hf.induced] exact f.withSeminorms_induced hq /-- (Disjoint) union of seminorm families. -/ protected def SeminormFamily.sigma {κ : ι → Type*} (p : (i : ι) → SeminormFamily 𝕜 E (κ i)) : SeminormFamily 𝕜 E ((i : ι) × κ i) := fun ⟨i, k⟩ => p i k theorem withSeminorms_iInf {κ : ι → Type*} [Nonempty ((i : ι) × κ i)] [∀ i, Nonempty (κ i)] {p : (i : ι) → SeminormFamily 𝕜 E (κ i)} {t : ι → TopologicalSpace E} [∀ i, @TopologicalAddGroup E (t i) _] (hp : ∀ i, WithSeminorms (topology := t i) (p i)) : WithSeminorms (topology := ⨅ i, t i) (SeminormFamily.sigma p) := by have : @TopologicalAddGroup E (⨅ i, t i) _ := topologicalAddGroup_iInf (fun i ↦ inferInstance) simp_rw [@SeminormFamily.withSeminorms_iff_topologicalSpace_eq_iInf _ _ _ _ _ _ _ (_)] at hp ⊢ rw [iInf_sigma] exact iInf_congr hp end TopologicalConstructions section TopologicalProperties variable [NontriviallyNormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] [Nonempty ι] [Countable ι] variable {p : SeminormFamily 𝕜 E ι} variable [TopologicalSpace E] /-- If the topology of a space is induced by a countable family of seminorms, then the topology is first countable. -/ theorem WithSeminorms.first_countable (hp : WithSeminorms p) : FirstCountableTopology E := by have := hp.topologicalAddGroup let _ : UniformSpace E := TopologicalAddGroup.toUniformSpace E have : UniformAddGroup E := comm_topologicalAddGroup_is_uniform have : (𝓝 (0 : E)).IsCountablyGenerated := by rw [p.withSeminorms_iff_nhds_eq_iInf.mp hp] exact Filter.iInf.isCountablyGenerated _ have : (uniformity E).IsCountablyGenerated := UniformAddGroup.uniformity_countably_generated exact UniformSpace.firstCountableTopology E end TopologicalProperties
Analysis\Normed\MulAction.lean
/- Copyright (c) 2023 Eric Wieser. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Eric Wieser -/ import Mathlib.Topology.MetricSpace.Algebra import Mathlib.Analysis.Normed.Field.Basic /-! # Lemmas for `BoundedSMul` over normed additive groups Lemmas which hold only in `NormedSpace α β` are provided in another file. Notably we prove that `NonUnitalSeminormedRing`s have bounded actions by left- and right- multiplication. This allows downstream files to write general results about `BoundedSMul`, and then deduce `const_mul` and `mul_const` results as an immediate corollary. -/ variable {α β : Type*} section SeminormedAddGroup variable [SeminormedAddGroup α] [SeminormedAddGroup β] [SMulZeroClass α β] variable [BoundedSMul α β] @[bound] theorem norm_smul_le (r : α) (x : β) : ‖r • x‖ ≤ ‖r‖ * ‖x‖ := by simpa [smul_zero] using dist_smul_pair r 0 x @[bound] theorem nnnorm_smul_le (r : α) (x : β) : ‖r • x‖₊ ≤ ‖r‖₊ * ‖x‖₊ := norm_smul_le _ _ theorem dist_smul_le (s : α) (x y : β) : dist (s • x) (s • y) ≤ ‖s‖ * dist x y := by simpa only [dist_eq_norm, sub_zero] using dist_smul_pair s x y theorem nndist_smul_le (s : α) (x y : β) : nndist (s • x) (s • y) ≤ ‖s‖₊ * nndist x y := dist_smul_le s x y theorem lipschitzWith_smul (s : α) : LipschitzWith ‖s‖₊ (s • · : β → β) := lipschitzWith_iff_dist_le_mul.2 <| dist_smul_le _ theorem edist_smul_le (s : α) (x y : β) : edist (s • x) (s • y) ≤ ‖s‖₊ • edist x y := lipschitzWith_smul s x y end SeminormedAddGroup /-- Left multiplication is bounded. -/ instance NonUnitalSeminormedRing.to_boundedSMul [NonUnitalSeminormedRing α] : BoundedSMul α α where dist_smul_pair' x y₁ y₂ := by simpa [mul_sub, dist_eq_norm] using norm_mul_le x (y₁ - y₂) dist_pair_smul' x₁ x₂ y := by simpa [sub_mul, dist_eq_norm] using norm_mul_le (x₁ - x₂) y /-- Right multiplication is bounded. -/ instance NonUnitalSeminormedRing.to_has_bounded_op_smul [NonUnitalSeminormedRing α] : BoundedSMul αᵐᵒᵖ α where dist_smul_pair' x y₁ y₂ := by simpa [sub_mul, dist_eq_norm, mul_comm] using norm_mul_le (y₁ - y₂) x.unop dist_pair_smul' x₁ x₂ y := by simpa [mul_sub, dist_eq_norm, mul_comm] using norm_mul_le y (x₁ - x₂).unop section SeminormedRing variable [SeminormedRing α] [SeminormedAddCommGroup β] [Module α β] theorem BoundedSMul.of_norm_smul_le (h : ∀ (r : α) (x : β), ‖r • x‖ ≤ ‖r‖ * ‖x‖) : BoundedSMul α β := { dist_smul_pair' := fun a b₁ b₂ => by simpa [smul_sub, dist_eq_norm] using h a (b₁ - b₂) dist_pair_smul' := fun a₁ a₂ b => by simpa [sub_smul, dist_eq_norm] using h (a₁ - a₂) b } theorem BoundedSMul.of_nnnorm_smul_le (h : ∀ (r : α) (x : β), ‖r • x‖₊ ≤ ‖r‖₊ * ‖x‖₊) : BoundedSMul α β := .of_norm_smul_le h end SeminormedRing section NormedDivisionRing variable [NormedDivisionRing α] [SeminormedAddGroup β] variable [MulActionWithZero α β] [BoundedSMul α β] theorem norm_smul (r : α) (x : β) : ‖r • x‖ = ‖r‖ * ‖x‖ := by by_cases h : r = 0 · simp [h, zero_smul α x] · refine le_antisymm (norm_smul_le r x) ?_ calc ‖r‖ * ‖x‖ = ‖r‖ * ‖r⁻¹ • r • x‖ := by rw [inv_smul_smul₀ h] _ ≤ ‖r‖ * (‖r⁻¹‖ * ‖r • x‖) := by gcongr; apply norm_smul_le _ = ‖r • x‖ := by rw [norm_inv, ← mul_assoc, mul_inv_cancel (mt norm_eq_zero.1 h), one_mul] theorem nnnorm_smul (r : α) (x : β) : ‖r • x‖₊ = ‖r‖₊ * ‖x‖₊ := NNReal.eq <| norm_smul r x end NormedDivisionRing section NormedDivisionRingModule variable [NormedDivisionRing α] [SeminormedAddCommGroup β] variable [Module α β] [BoundedSMul α β] theorem dist_smul₀ (s : α) (x y : β) : dist (s • x) (s • y) = ‖s‖ * dist x y := by simp_rw [dist_eq_norm, (norm_smul s (x - y)).symm, smul_sub] theorem nndist_smul₀ (s : α) (x y : β) : nndist (s • x) (s • y) = ‖s‖₊ * nndist x y := NNReal.eq <| dist_smul₀ s x y theorem edist_smul₀ (s : α) (x y : β) : edist (s • x) (s • y) = ‖s‖₊ • edist x y := by simp only [edist_nndist, nndist_smul₀, ENNReal.coe_mul, ENNReal.smul_def, smul_eq_mul] end NormedDivisionRingModule
Analysis\Normed\Algebra\Basic.lean
/- Copyright (c) 2022 Frédéric Dupuis. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Frédéric Dupuis -/ import Mathlib.Topology.Algebra.Module.CharacterSpace import Mathlib.Analysis.Normed.Module.WeakDual import Mathlib.Analysis.Normed.Algebra.Spectrum /-! # Normed algebras This file contains basic facts about normed algebras. ## Main results * We show that the character space of a normed algebra is compact using the Banach-Alaoglu theorem. ## TODO * Show compactness for topological vector spaces; this requires the TVS version of Banach-Alaoglu. ## Tags normed algebra, character space, continuous functional calculus -/ variable {𝕜 : Type*} {A : Type*} namespace WeakDual namespace CharacterSpace variable [NontriviallyNormedField 𝕜] [NormedRing A] [NormedAlgebra 𝕜 A] [CompleteSpace A] theorem norm_le_norm_one (φ : characterSpace 𝕜 A) : ‖toNormedDual (φ : WeakDual 𝕜 A)‖ ≤ ‖(1 : A)‖ := ContinuousLinearMap.opNorm_le_bound _ (norm_nonneg (1 : A)) fun a => mul_comm ‖a‖ ‖(1 : A)‖ ▸ spectrum.norm_le_norm_mul_of_mem (apply_mem_spectrum φ a) instance [ProperSpace 𝕜] : CompactSpace (characterSpace 𝕜 A) := by rw [← isCompact_iff_compactSpace] have h : characterSpace 𝕜 A ⊆ toNormedDual ⁻¹' Metric.closedBall 0 ‖(1 : A)‖ := by intro φ hφ rw [Set.mem_preimage, mem_closedBall_zero_iff] exact (norm_le_norm_one ⟨φ, ⟨hφ.1, hφ.2⟩⟩ : _) exact (isCompact_closedBall 𝕜 0 _).of_isClosed_subset CharacterSpace.isClosed h end CharacterSpace end WeakDual
Analysis\Normed\Algebra\Exponential.lean
/- Copyright (c) 2021 Anatole Dedecker. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Anatole Dedecker, Eric Wieser -/ import Mathlib.Analysis.Analytic.Basic import Mathlib.Analysis.Complex.Basic import Mathlib.Analysis.Normed.Field.InfiniteSum import Mathlib.Data.Nat.Choose.Cast import Mathlib.Data.Finset.NoncommProd import Mathlib.Topology.Algebra.Algebra /-! # Exponential in a Banach algebra In this file, we define `NormedSpace.exp 𝕂 : 𝔸 → 𝔸`, the exponential map in a topological algebra `𝔸` over a field `𝕂`. While for most interesting results we need `𝔸` to be normed algebra, we do not require this in the definition in order to make `NormedSpace.exp` independent of a particular choice of norm. The definition also does not require that `𝔸` be complete, but we need to assume it for most results. We then prove some basic results, but we avoid importing derivatives here to minimize dependencies. Results involving derivatives and comparisons with `Real.exp` and `Complex.exp` can be found in `Analysis.SpecialFunctions.Exponential`. ## Main results We prove most result for an arbitrary field `𝕂`, and then specialize to `𝕂 = ℝ` or `𝕂 = ℂ`. ### General case - `NormedSpace.exp_add_of_commute_of_mem_ball` : if `𝕂` has characteristic zero, then given two commuting elements `x` and `y` in the disk of convergence, we have `NormedSpace.exp 𝕂 (x+y) = (NormedSpace.exp 𝕂 x) * (NormedSpace.exp 𝕂 y)` - `NormedSpace.exp_add_of_mem_ball` : if `𝕂` has characteristic zero and `𝔸` is commutative, then given two elements `x` and `y` in the disk of convergence, we have `NormedSpace.exp 𝕂 (x+y) = (NormedSpace.exp 𝕂 x) * (NormedSpace.exp 𝕂 y)` - `NormedSpace.exp_neg_of_mem_ball` : if `𝕂` has characteristic zero and `𝔸` is a division ring, then given an element `x` in the disk of convergence, we have `NormedSpace.exp 𝕂 (-x) = (NormedSpace.exp 𝕂 x)⁻¹`. ### `𝕂 = ℝ` or `𝕂 = ℂ` - `expSeries_radius_eq_top` : the `FormalMultilinearSeries` defining `NormedSpace.exp 𝕂` has infinite radius of convergence - `NormedSpace.exp_add_of_commute` : given two commuting elements `x` and `y`, we have `NormedSpace.exp 𝕂 (x+y) = (NormedSpace.exp 𝕂 x) * (NormedSpace.exp 𝕂 y)` - `NormedSpace.exp_add` : if `𝔸` is commutative, then we have `NormedSpace.exp 𝕂 (x+y) = (NormedSpace.exp 𝕂 x) * (NormedSpace.exp 𝕂 y)` for any `x` and `y` - `NormedSpace.exp_neg` : if `𝔸` is a division ring, then we have `NormedSpace.exp 𝕂 (-x) = (NormedSpace.exp 𝕂 x)⁻¹`. - `NormedSpace.exp_sum_of_commute` : the analogous result to `NormedSpace.exp_add_of_commute` for `Finset.sum`. - `NormedSpace.exp_sum` : the analogous result to `NormedSpace.exp_add` for `Finset.sum`. - `NormedSpace.exp_nsmul` : repeated addition in the domain corresponds to repeated multiplication in the codomain. - `NormedSpace.exp_zsmul` : repeated addition in the domain corresponds to repeated multiplication in the codomain. ### Other useful compatibility results - `NormedSpace.exp_eq_exp` : if `𝔸` is a normed algebra over two fields `𝕂` and `𝕂'`, then `NormedSpace.exp 𝕂 = NormedSpace.exp 𝕂' 𝔸` ### Notes We put nearly all the statements in this file in the `NormedSpace` namespace, to avoid collisions with the `Real` or `Complex` namespaces. As of 2023-11-16 due to bad instances in Mathlib ``` import Mathlib open Real #time example (x : ℝ) : 0 < exp x := exp_pos _ -- 250ms #time example (x : ℝ) : 0 < Real.exp x := exp_pos _ -- 2ms ``` This is because `exp x` tries the `NormedSpace.exp` function defined here, and generates a slow coercion search from `Real` to `Type`, to fit the first argument here. We will resolve this slow coercion separately, but we want to move `exp` out of the root namespace in any case to avoid this ambiguity. In the long term is may be possible to replace `Real.exp` and `Complex.exp` with this one. -/ namespace NormedSpace open Filter RCLike ContinuousMultilinearMap NormedField Asymptotics open scoped Nat Topology ENNReal section TopologicalAlgebra variable (𝕂 𝔸 : Type*) [Field 𝕂] [Ring 𝔸] [Algebra 𝕂 𝔸] [TopologicalSpace 𝔸] [TopologicalRing 𝔸] /-- `expSeries 𝕂 𝔸` is the `FormalMultilinearSeries` whose `n`-th term is the map `(xᵢ) : 𝔸ⁿ ↦ (1/n! : 𝕂) • ∏ xᵢ`. Its sum is the exponential map `NormedSpace.exp 𝕂 : 𝔸 → 𝔸`. -/ def expSeries : FormalMultilinearSeries 𝕂 𝔸 𝔸 := fun n => (n !⁻¹ : 𝕂) • ContinuousMultilinearMap.mkPiAlgebraFin 𝕂 n 𝔸 variable {𝔸} /-- `NormedSpace.exp 𝕂 : 𝔸 → 𝔸` is the exponential map determined by the action of `𝕂` on `𝔸`. It is defined as the sum of the `FormalMultilinearSeries` `expSeries 𝕂 𝔸`. Note that when `𝔸 = Matrix n n 𝕂`, this is the **Matrix Exponential**; see [`Analysis.Normed.Algebra.MatrixExponential`](./MatrixExponential) for lemmas specific to that case. -/ noncomputable def exp (x : 𝔸) : 𝔸 := (expSeries 𝕂 𝔸).sum x variable {𝕂} theorem expSeries_apply_eq (x : 𝔸) (n : ℕ) : (expSeries 𝕂 𝔸 n fun _ => x) = (n !⁻¹ : 𝕂) • x ^ n := by simp [expSeries] theorem expSeries_apply_eq' (x : 𝔸) : (fun n => expSeries 𝕂 𝔸 n fun _ => x) = fun n => (n !⁻¹ : 𝕂) • x ^ n := funext (expSeries_apply_eq x) theorem expSeries_sum_eq (x : 𝔸) : (expSeries 𝕂 𝔸).sum x = ∑' n : ℕ, (n !⁻¹ : 𝕂) • x ^ n := tsum_congr fun n => expSeries_apply_eq x n theorem exp_eq_tsum : exp 𝕂 = fun x : 𝔸 => ∑' n : ℕ, (n !⁻¹ : 𝕂) • x ^ n := funext expSeries_sum_eq theorem expSeries_apply_zero (n : ℕ) : (expSeries 𝕂 𝔸 n fun _ => (0 : 𝔸)) = Pi.single (f := fun _ => 𝔸) 0 1 n := by rw [expSeries_apply_eq] cases' n with n · rw [pow_zero, Nat.factorial_zero, Nat.cast_one, inv_one, one_smul, Pi.single_eq_same] · rw [zero_pow (Nat.succ_ne_zero _), smul_zero, Pi.single_eq_of_ne n.succ_ne_zero] @[simp] theorem exp_zero : exp 𝕂 (0 : 𝔸) = 1 := by simp_rw [exp_eq_tsum, ← expSeries_apply_eq, expSeries_apply_zero, tsum_pi_single] @[simp] theorem exp_op [T2Space 𝔸] (x : 𝔸) : exp 𝕂 (MulOpposite.op x) = MulOpposite.op (exp 𝕂 x) := by simp_rw [exp, expSeries_sum_eq, ← MulOpposite.op_pow, ← MulOpposite.op_smul, tsum_op] @[simp] theorem exp_unop [T2Space 𝔸] (x : 𝔸ᵐᵒᵖ) : exp 𝕂 (MulOpposite.unop x) = MulOpposite.unop (exp 𝕂 x) := by simp_rw [exp, expSeries_sum_eq, ← MulOpposite.unop_pow, ← MulOpposite.unop_smul, tsum_unop] theorem star_exp [T2Space 𝔸] [StarRing 𝔸] [ContinuousStar 𝔸] (x : 𝔸) : star (exp 𝕂 x) = exp 𝕂 (star x) := by simp_rw [exp_eq_tsum, ← star_pow, ← star_inv_natCast_smul, ← tsum_star] variable (𝕂) theorem _root_.IsSelfAdjoint.exp [T2Space 𝔸] [StarRing 𝔸] [ContinuousStar 𝔸] {x : 𝔸} (h : IsSelfAdjoint x) : IsSelfAdjoint (exp 𝕂 x) := (star_exp x).trans <| h.symm ▸ rfl theorem _root_.Commute.exp_right [T2Space 𝔸] {x y : 𝔸} (h : Commute x y) : Commute x (exp 𝕂 y) := by rw [exp_eq_tsum] exact Commute.tsum_right x fun n => (h.pow_right n).smul_right _ theorem _root_.Commute.exp_left [T2Space 𝔸] {x y : 𝔸} (h : Commute x y) : Commute (exp 𝕂 x) y := (h.symm.exp_right 𝕂).symm theorem _root_.Commute.exp [T2Space 𝔸] {x y : 𝔸} (h : Commute x y) : Commute (exp 𝕂 x) (exp 𝕂 y) := (h.exp_left _).exp_right _ end TopologicalAlgebra section TopologicalDivisionAlgebra variable {𝕂 𝔸 : Type*} [Field 𝕂] [DivisionRing 𝔸] [Algebra 𝕂 𝔸] [TopologicalSpace 𝔸] [TopologicalRing 𝔸] theorem expSeries_apply_eq_div (x : 𝔸) (n : ℕ) : (expSeries 𝕂 𝔸 n fun _ => x) = x ^ n / n ! := by rw [div_eq_mul_inv, ← (Nat.cast_commute n ! (x ^ n)).inv_left₀.eq, ← smul_eq_mul, expSeries_apply_eq, inv_natCast_smul_eq 𝕂 𝔸] theorem expSeries_apply_eq_div' (x : 𝔸) : (fun n => expSeries 𝕂 𝔸 n fun _ => x) = fun n => x ^ n / n ! := funext (expSeries_apply_eq_div x) theorem expSeries_sum_eq_div (x : 𝔸) : (expSeries 𝕂 𝔸).sum x = ∑' n : ℕ, x ^ n / n ! := tsum_congr (expSeries_apply_eq_div x) theorem exp_eq_tsum_div : exp 𝕂 = fun x : 𝔸 => ∑' n : ℕ, x ^ n / n ! := funext expSeries_sum_eq_div end TopologicalDivisionAlgebra section Normed section AnyFieldAnyAlgebra variable {𝕂 𝔸 𝔹 : Type*} [NontriviallyNormedField 𝕂] variable [NormedRing 𝔸] [NormedRing 𝔹] [NormedAlgebra 𝕂 𝔸] [NormedAlgebra 𝕂 𝔹] theorem norm_expSeries_summable_of_mem_ball (x : 𝔸) (hx : x ∈ EMetric.ball (0 : 𝔸) (expSeries 𝕂 𝔸).radius) : Summable fun n => ‖expSeries 𝕂 𝔸 n fun _ => x‖ := (expSeries 𝕂 𝔸).summable_norm_apply hx theorem norm_expSeries_summable_of_mem_ball' (x : 𝔸) (hx : x ∈ EMetric.ball (0 : 𝔸) (expSeries 𝕂 𝔸).radius) : Summable fun n => ‖(n !⁻¹ : 𝕂) • x ^ n‖ := by change Summable (norm ∘ _) rw [← expSeries_apply_eq'] exact norm_expSeries_summable_of_mem_ball x hx section CompleteAlgebra variable [CompleteSpace 𝔸] theorem expSeries_summable_of_mem_ball (x : 𝔸) (hx : x ∈ EMetric.ball (0 : 𝔸) (expSeries 𝕂 𝔸).radius) : Summable fun n => expSeries 𝕂 𝔸 n fun _ => x := (norm_expSeries_summable_of_mem_ball x hx).of_norm theorem expSeries_summable_of_mem_ball' (x : 𝔸) (hx : x ∈ EMetric.ball (0 : 𝔸) (expSeries 𝕂 𝔸).radius) : Summable fun n => (n !⁻¹ : 𝕂) • x ^ n := (norm_expSeries_summable_of_mem_ball' x hx).of_norm theorem expSeries_hasSum_exp_of_mem_ball (x : 𝔸) (hx : x ∈ EMetric.ball (0 : 𝔸) (expSeries 𝕂 𝔸).radius) : HasSum (fun n => expSeries 𝕂 𝔸 n fun _ => x) (exp 𝕂 x) := FormalMultilinearSeries.hasSum (expSeries 𝕂 𝔸) hx theorem expSeries_hasSum_exp_of_mem_ball' (x : 𝔸) (hx : x ∈ EMetric.ball (0 : 𝔸) (expSeries 𝕂 𝔸).radius) : HasSum (fun n => (n !⁻¹ : 𝕂) • x ^ n) (exp 𝕂 x) := by rw [← expSeries_apply_eq'] exact expSeries_hasSum_exp_of_mem_ball x hx theorem hasFPowerSeriesOnBall_exp_of_radius_pos (h : 0 < (expSeries 𝕂 𝔸).radius) : HasFPowerSeriesOnBall (exp 𝕂) (expSeries 𝕂 𝔸) 0 (expSeries 𝕂 𝔸).radius := (expSeries 𝕂 𝔸).hasFPowerSeriesOnBall h theorem hasFPowerSeriesAt_exp_zero_of_radius_pos (h : 0 < (expSeries 𝕂 𝔸).radius) : HasFPowerSeriesAt (exp 𝕂) (expSeries 𝕂 𝔸) 0 := (hasFPowerSeriesOnBall_exp_of_radius_pos h).hasFPowerSeriesAt theorem continuousOn_exp : ContinuousOn (exp 𝕂 : 𝔸 → 𝔸) (EMetric.ball 0 (expSeries 𝕂 𝔸).radius) := FormalMultilinearSeries.continuousOn theorem analyticAt_exp_of_mem_ball (x : 𝔸) (hx : x ∈ EMetric.ball (0 : 𝔸) (expSeries 𝕂 𝔸).radius) : AnalyticAt 𝕂 (exp 𝕂) x := by by_cases h : (expSeries 𝕂 𝔸).radius = 0 · rw [h] at hx; exact (ENNReal.not_lt_zero hx).elim · have h := pos_iff_ne_zero.mpr h exact (hasFPowerSeriesOnBall_exp_of_radius_pos h).analyticAt_of_mem hx /-- In a Banach-algebra `𝔸` over a normed field `𝕂` of characteristic zero, if `x` and `y` are in the disk of convergence and commute, then `NormedSpace.exp 𝕂 (x + y) = (NormedSpace.exp 𝕂 x) * (NormedSpace.exp 𝕂 y)`. -/ theorem exp_add_of_commute_of_mem_ball [CharZero 𝕂] {x y : 𝔸} (hxy : Commute x y) (hx : x ∈ EMetric.ball (0 : 𝔸) (expSeries 𝕂 𝔸).radius) (hy : y ∈ EMetric.ball (0 : 𝔸) (expSeries 𝕂 𝔸).radius) : exp 𝕂 (x + y) = exp 𝕂 x * exp 𝕂 y := by rw [exp_eq_tsum, tsum_mul_tsum_eq_tsum_sum_antidiagonal_of_summable_norm (norm_expSeries_summable_of_mem_ball' x hx) (norm_expSeries_summable_of_mem_ball' y hy)] dsimp only conv_lhs => congr ext rw [hxy.add_pow' _, Finset.smul_sum] refine tsum_congr fun n => Finset.sum_congr rfl fun kl hkl => ?_ rw [← Nat.cast_smul_eq_nsmul 𝕂, smul_smul, smul_mul_smul, ← Finset.mem_antidiagonal.mp hkl, Nat.cast_add_choose, Finset.mem_antidiagonal.mp hkl] congr 1 have : (n ! : 𝕂) ≠ 0 := Nat.cast_ne_zero.mpr n.factorial_ne_zero field_simp [this] /-- `NormedSpace.exp 𝕂 x` has explicit two-sided inverse `NormedSpace.exp 𝕂 (-x)`. -/ noncomputable def invertibleExpOfMemBall [CharZero 𝕂] {x : 𝔸} (hx : x ∈ EMetric.ball (0 : 𝔸) (expSeries 𝕂 𝔸).radius) : Invertible (exp 𝕂 x) where invOf := exp 𝕂 (-x) invOf_mul_self := by have hnx : -x ∈ EMetric.ball (0 : 𝔸) (expSeries 𝕂 𝔸).radius := by rw [EMetric.mem_ball, ← neg_zero, edist_neg_neg] exact hx rw [← exp_add_of_commute_of_mem_ball (Commute.neg_left <| Commute.refl x) hnx hx, neg_add_self, exp_zero] mul_invOf_self := by have hnx : -x ∈ EMetric.ball (0 : 𝔸) (expSeries 𝕂 𝔸).radius := by rw [EMetric.mem_ball, ← neg_zero, edist_neg_neg] exact hx rw [← exp_add_of_commute_of_mem_ball (Commute.neg_right <| Commute.refl x) hx hnx, add_neg_self, exp_zero] theorem isUnit_exp_of_mem_ball [CharZero 𝕂] {x : 𝔸} (hx : x ∈ EMetric.ball (0 : 𝔸) (expSeries 𝕂 𝔸).radius) : IsUnit (exp 𝕂 x) := @isUnit_of_invertible _ _ _ (invertibleExpOfMemBall hx) theorem invOf_exp_of_mem_ball [CharZero 𝕂] {x : 𝔸} (hx : x ∈ EMetric.ball (0 : 𝔸) (expSeries 𝕂 𝔸).radius) [Invertible (exp 𝕂 x)] : ⅟ (exp 𝕂 x) = exp 𝕂 (-x) := by letI := invertibleExpOfMemBall hx; convert (rfl : ⅟ (exp 𝕂 x) = _) /-- Any continuous ring homomorphism commutes with `NormedSpace.exp`. -/ theorem map_exp_of_mem_ball {F} [FunLike F 𝔸 𝔹] [RingHomClass F 𝔸 𝔹] (f : F) (hf : Continuous f) (x : 𝔸) (hx : x ∈ EMetric.ball (0 : 𝔸) (expSeries 𝕂 𝔸).radius) : f (exp 𝕂 x) = exp 𝕂 (f x) := by rw [exp_eq_tsum, exp_eq_tsum] refine ((expSeries_summable_of_mem_ball' _ hx).hasSum.map f hf).tsum_eq.symm.trans ?_ dsimp only [Function.comp_def] simp_rw [map_inv_natCast_smul f 𝕂 𝕂, map_pow] end CompleteAlgebra theorem algebraMap_exp_comm_of_mem_ball [CompleteSpace 𝕂] (x : 𝕂) (hx : x ∈ EMetric.ball (0 : 𝕂) (expSeries 𝕂 𝕂).radius) : algebraMap 𝕂 𝔸 (exp 𝕂 x) = exp 𝕂 (algebraMap 𝕂 𝔸 x) := map_exp_of_mem_ball _ (continuous_algebraMap 𝕂 𝔸) _ hx end AnyFieldAnyAlgebra section AnyFieldDivisionAlgebra variable {𝕂 𝔸 : Type*} [NontriviallyNormedField 𝕂] [NormedDivisionRing 𝔸] [NormedAlgebra 𝕂 𝔸] variable (𝕂) theorem norm_expSeries_div_summable_of_mem_ball (x : 𝔸) (hx : x ∈ EMetric.ball (0 : 𝔸) (expSeries 𝕂 𝔸).radius) : Summable fun n => ‖x ^ n / (n ! : 𝔸)‖ := by change Summable (norm ∘ _) rw [← expSeries_apply_eq_div' (𝕂 := 𝕂) x] exact norm_expSeries_summable_of_mem_ball x hx theorem expSeries_div_summable_of_mem_ball [CompleteSpace 𝔸] (x : 𝔸) (hx : x ∈ EMetric.ball (0 : 𝔸) (expSeries 𝕂 𝔸).radius) : Summable fun n => x ^ n / n ! := (norm_expSeries_div_summable_of_mem_ball 𝕂 x hx).of_norm theorem expSeries_div_hasSum_exp_of_mem_ball [CompleteSpace 𝔸] (x : 𝔸) (hx : x ∈ EMetric.ball (0 : 𝔸) (expSeries 𝕂 𝔸).radius) : HasSum (fun n => x ^ n / n !) (exp 𝕂 x) := by rw [← expSeries_apply_eq_div' (𝕂 := 𝕂) x] exact expSeries_hasSum_exp_of_mem_ball x hx variable {𝕂} theorem exp_neg_of_mem_ball [CharZero 𝕂] [CompleteSpace 𝔸] {x : 𝔸} (hx : x ∈ EMetric.ball (0 : 𝔸) (expSeries 𝕂 𝔸).radius) : exp 𝕂 (-x) = (exp 𝕂 x)⁻¹ := letI := invertibleExpOfMemBall hx invOf_eq_inv (exp 𝕂 x) end AnyFieldDivisionAlgebra section AnyFieldCommAlgebra variable {𝕂 𝔸 : Type*} [NontriviallyNormedField 𝕂] [NormedCommRing 𝔸] [NormedAlgebra 𝕂 𝔸] [CompleteSpace 𝔸] /-- In a commutative Banach-algebra `𝔸` over a normed field `𝕂` of characteristic zero, `NormedSpace.exp 𝕂 (x+y) = (NormedSpace.exp 𝕂 x) * (NormedSpace.exp 𝕂 y)` for all `x`, `y` in the disk of convergence. -/ theorem exp_add_of_mem_ball [CharZero 𝕂] {x y : 𝔸} (hx : x ∈ EMetric.ball (0 : 𝔸) (expSeries 𝕂 𝔸).radius) (hy : y ∈ EMetric.ball (0 : 𝔸) (expSeries 𝕂 𝔸).radius) : exp 𝕂 (x + y) = exp 𝕂 x * exp 𝕂 y := exp_add_of_commute_of_mem_ball (Commute.all x y) hx hy end AnyFieldCommAlgebra section RCLike section AnyAlgebra variable (𝕂 𝔸 𝔹 : Type*) [RCLike 𝕂] [NormedRing 𝔸] [NormedAlgebra 𝕂 𝔸] variable [NormedRing 𝔹] [NormedAlgebra 𝕂 𝔹] /-- In a normed algebra `𝔸` over `𝕂 = ℝ` or `𝕂 = ℂ`, the series defining the exponential map has an infinite radius of convergence. -/ theorem expSeries_radius_eq_top : (expSeries 𝕂 𝔸).radius = ∞ := by refine (expSeries 𝕂 𝔸).radius_eq_top_of_summable_norm fun r => ?_ refine .of_norm_bounded_eventually _ (Real.summable_pow_div_factorial r) ?_ filter_upwards [eventually_cofinite_ne 0] with n hn rw [norm_mul, norm_norm (expSeries 𝕂 𝔸 n), expSeries] rw [norm_smul (n ! : 𝕂)⁻¹ (ContinuousMultilinearMap.mkPiAlgebraFin 𝕂 n 𝔸)] -- Porting note: Lean needed this to be explicit for some reason rw [norm_inv, norm_pow, NNReal.norm_eq, norm_natCast, mul_comm, ← mul_assoc, ← div_eq_mul_inv] have : ‖ContinuousMultilinearMap.mkPiAlgebraFin 𝕂 n 𝔸‖ ≤ 1 := norm_mkPiAlgebraFin_le_of_pos (Nat.pos_of_ne_zero hn) exact mul_le_of_le_one_right (div_nonneg (pow_nonneg r.coe_nonneg n) n !.cast_nonneg) this theorem expSeries_radius_pos : 0 < (expSeries 𝕂 𝔸).radius := by rw [expSeries_radius_eq_top] exact WithTop.zero_lt_top variable {𝕂 𝔸 𝔹} theorem norm_expSeries_summable (x : 𝔸) : Summable fun n => ‖expSeries 𝕂 𝔸 n fun _ => x‖ := norm_expSeries_summable_of_mem_ball x ((expSeries_radius_eq_top 𝕂 𝔸).symm ▸ edist_lt_top _ _) theorem norm_expSeries_summable' (x : 𝔸) : Summable fun n => ‖(n !⁻¹ : 𝕂) • x ^ n‖ := norm_expSeries_summable_of_mem_ball' x ((expSeries_radius_eq_top 𝕂 𝔸).symm ▸ edist_lt_top _ _) section CompleteAlgebra variable [CompleteSpace 𝔸] theorem expSeries_summable (x : 𝔸) : Summable fun n => expSeries 𝕂 𝔸 n fun _ => x := (norm_expSeries_summable x).of_norm theorem expSeries_summable' (x : 𝔸) : Summable fun n => (n !⁻¹ : 𝕂) • x ^ n := (norm_expSeries_summable' x).of_norm theorem expSeries_hasSum_exp (x : 𝔸) : HasSum (fun n => expSeries 𝕂 𝔸 n fun _ => x) (exp 𝕂 x) := expSeries_hasSum_exp_of_mem_ball x ((expSeries_radius_eq_top 𝕂 𝔸).symm ▸ edist_lt_top _ _) theorem exp_series_hasSum_exp' (x : 𝔸) : HasSum (fun n => (n !⁻¹ : 𝕂) • x ^ n) (exp 𝕂 x) := expSeries_hasSum_exp_of_mem_ball' x ((expSeries_radius_eq_top 𝕂 𝔸).symm ▸ edist_lt_top _ _) theorem exp_hasFPowerSeriesOnBall : HasFPowerSeriesOnBall (exp 𝕂) (expSeries 𝕂 𝔸) 0 ∞ := expSeries_radius_eq_top 𝕂 𝔸 ▸ hasFPowerSeriesOnBall_exp_of_radius_pos (expSeries_radius_pos _ _) theorem exp_hasFPowerSeriesAt_zero : HasFPowerSeriesAt (exp 𝕂) (expSeries 𝕂 𝔸) 0 := exp_hasFPowerSeriesOnBall.hasFPowerSeriesAt @[continuity] theorem exp_continuous : Continuous (exp 𝕂 : 𝔸 → 𝔸) := by rw [continuous_iff_continuousOn_univ, ← Metric.eball_top_eq_univ (0 : 𝔸), ← expSeries_radius_eq_top 𝕂 𝔸] exact continuousOn_exp open Topology in lemma _root_.Filter.Tendsto.exp {α : Type*} {l : Filter α} {f : α → 𝔸} {a : 𝔸} (hf : Tendsto f l (𝓝 a)) : Tendsto (fun x => exp 𝕂 (f x)) l (𝓝 (exp 𝕂 a)) := (exp_continuous.tendsto _).comp hf theorem exp_analytic (x : 𝔸) : AnalyticAt 𝕂 (exp 𝕂) x := analyticAt_exp_of_mem_ball x ((expSeries_radius_eq_top 𝕂 𝔸).symm ▸ edist_lt_top _ _) /-- In a Banach-algebra `𝔸` over `𝕂 = ℝ` or `𝕂 = ℂ`, if `x` and `y` commute, then `NormedSpace.exp 𝕂 (x+y) = (NormedSpace.exp 𝕂 x) * (NormedSpace.exp 𝕂 y)`. -/ theorem exp_add_of_commute {x y : 𝔸} (hxy : Commute x y) : exp 𝕂 (x + y) = exp 𝕂 x * exp 𝕂 y := exp_add_of_commute_of_mem_ball hxy ((expSeries_radius_eq_top 𝕂 𝔸).symm ▸ edist_lt_top _ _) ((expSeries_radius_eq_top 𝕂 𝔸).symm ▸ edist_lt_top _ _) section variable (𝕂) /-- `NormedSpace.exp 𝕂 x` has explicit two-sided inverse `NormedSpace.exp 𝕂 (-x)`. -/ noncomputable def invertibleExp (x : 𝔸) : Invertible (exp 𝕂 x) := invertibleExpOfMemBall <| (expSeries_radius_eq_top 𝕂 𝔸).symm ▸ edist_lt_top _ _ theorem isUnit_exp (x : 𝔸) : IsUnit (exp 𝕂 x) := isUnit_exp_of_mem_ball <| (expSeries_radius_eq_top 𝕂 𝔸).symm ▸ edist_lt_top _ _ theorem invOf_exp (x : 𝔸) [Invertible (exp 𝕂 x)] : ⅟ (exp 𝕂 x) = exp 𝕂 (-x) := invOf_exp_of_mem_ball <| (expSeries_radius_eq_top 𝕂 𝔸).symm ▸ edist_lt_top _ _ theorem _root_.Ring.inverse_exp (x : 𝔸) : Ring.inverse (exp 𝕂 x) = exp 𝕂 (-x) := letI := invertibleExp 𝕂 x Ring.inverse_invertible _ theorem exp_mem_unitary_of_mem_skewAdjoint [StarRing 𝔸] [ContinuousStar 𝔸] {x : 𝔸} (h : x ∈ skewAdjoint 𝔸) : exp 𝕂 x ∈ unitary 𝔸 := by rw [unitary.mem_iff, star_exp, skewAdjoint.mem_iff.mp h, ← exp_add_of_commute (Commute.refl x).neg_left, ← exp_add_of_commute (Commute.refl x).neg_right, add_left_neg, add_right_neg, exp_zero, and_self_iff] end /-- In a Banach-algebra `𝔸` over `𝕂 = ℝ` or `𝕂 = ℂ`, if a family of elements `f i` mutually commute then `NormedSpace.exp 𝕂 (∑ i, f i) = ∏ i, NormedSpace.exp 𝕂 (f i)`. -/ theorem exp_sum_of_commute {ι} (s : Finset ι) (f : ι → 𝔸) (h : (s : Set ι).Pairwise fun i j => Commute (f i) (f j)) : exp 𝕂 (∑ i ∈ s, f i) = s.noncommProd (fun i => exp 𝕂 (f i)) fun i hi j hj _ => (h.of_refl hi hj).exp 𝕂 := by classical induction' s using Finset.induction_on with a s ha ih · simp rw [Finset.noncommProd_insert_of_not_mem _ _ _ _ ha, Finset.sum_insert ha, exp_add_of_commute, ih (h.mono <| Finset.subset_insert _ _)] refine Commute.sum_right _ _ _ fun i hi => ?_ exact h.of_refl (Finset.mem_insert_self _ _) (Finset.mem_insert_of_mem hi) theorem exp_nsmul (n : ℕ) (x : 𝔸) : exp 𝕂 (n • x) = exp 𝕂 x ^ n := by induction' n with n ih · rw [zero_smul, pow_zero, exp_zero] · rw [succ_nsmul, pow_succ, exp_add_of_commute ((Commute.refl x).smul_left n), ih] variable (𝕂) /-- Any continuous ring homomorphism commutes with `NormedSpace.exp`. -/ theorem map_exp {F} [FunLike F 𝔸 𝔹] [RingHomClass F 𝔸 𝔹] (f : F) (hf : Continuous f) (x : 𝔸) : f (exp 𝕂 x) = exp 𝕂 (f x) := map_exp_of_mem_ball f hf x <| (expSeries_radius_eq_top 𝕂 𝔸).symm ▸ edist_lt_top _ _ theorem exp_smul {G} [Monoid G] [MulSemiringAction G 𝔸] [ContinuousConstSMul G 𝔸] (g : G) (x : 𝔸) : exp 𝕂 (g • x) = g • exp 𝕂 x := (map_exp 𝕂 (MulSemiringAction.toRingHom G 𝔸 g) (continuous_const_smul g) x).symm theorem exp_units_conj (y : 𝔸ˣ) (x : 𝔸) : exp 𝕂 (y * x * ↑y⁻¹ : 𝔸) = y * exp 𝕂 x * ↑y⁻¹ := exp_smul _ (ConjAct.toConjAct y) x theorem exp_units_conj' (y : 𝔸ˣ) (x : 𝔸) : exp 𝕂 (↑y⁻¹ * x * y) = ↑y⁻¹ * exp 𝕂 x * y := exp_units_conj _ _ _ @[simp] theorem _root_.Prod.fst_exp [CompleteSpace 𝔹] (x : 𝔸 × 𝔹) : (exp 𝕂 x).fst = exp 𝕂 x.fst := map_exp _ (RingHom.fst 𝔸 𝔹) continuous_fst x @[simp] theorem _root_.Prod.snd_exp [CompleteSpace 𝔹] (x : 𝔸 × 𝔹) : (exp 𝕂 x).snd = exp 𝕂 x.snd := map_exp _ (RingHom.snd 𝔸 𝔹) continuous_snd x @[simp] theorem _root_.Pi.exp_apply {ι : Type*} {𝔸 : ι → Type*} [Finite ι] [∀ i, NormedRing (𝔸 i)] [∀ i, NormedAlgebra 𝕂 (𝔸 i)] [∀ i, CompleteSpace (𝔸 i)] (x : ∀ i, 𝔸 i) (i : ι) : exp 𝕂 x i = exp 𝕂 (x i) := let ⟨_⟩ := nonempty_fintype ι map_exp _ (Pi.evalRingHom 𝔸 i) (continuous_apply _) x theorem _root_.Pi.exp_def {ι : Type*} {𝔸 : ι → Type*} [Finite ι] [∀ i, NormedRing (𝔸 i)] [∀ i, NormedAlgebra 𝕂 (𝔸 i)] [∀ i, CompleteSpace (𝔸 i)] (x : ∀ i, 𝔸 i) : exp 𝕂 x = fun i => exp 𝕂 (x i) := funext <| Pi.exp_apply 𝕂 x theorem _root_.Function.update_exp {ι : Type*} {𝔸 : ι → Type*} [Finite ι] [DecidableEq ι] [∀ i, NormedRing (𝔸 i)] [∀ i, NormedAlgebra 𝕂 (𝔸 i)] [∀ i, CompleteSpace (𝔸 i)] (x : ∀ i, 𝔸 i) (j : ι) (xj : 𝔸 j) : Function.update (exp 𝕂 x) j (exp 𝕂 xj) = exp 𝕂 (Function.update x j xj) := by ext i simp_rw [Pi.exp_def] exact (Function.apply_update (fun i => exp 𝕂) x j xj i).symm end CompleteAlgebra theorem algebraMap_exp_comm (x : 𝕂) : algebraMap 𝕂 𝔸 (exp 𝕂 x) = exp 𝕂 (algebraMap 𝕂 𝔸 x) := algebraMap_exp_comm_of_mem_ball x <| (expSeries_radius_eq_top 𝕂 𝕂).symm ▸ edist_lt_top _ _ end AnyAlgebra section DivisionAlgebra variable {𝕂 𝔸 : Type*} [RCLike 𝕂] [NormedDivisionRing 𝔸] [NormedAlgebra 𝕂 𝔸] variable (𝕂) theorem norm_expSeries_div_summable (x : 𝔸) : Summable fun n => ‖(x ^ n / n ! : 𝔸)‖ := norm_expSeries_div_summable_of_mem_ball 𝕂 x ((expSeries_radius_eq_top 𝕂 𝔸).symm ▸ edist_lt_top _ _) variable [CompleteSpace 𝔸] theorem expSeries_div_summable (x : 𝔸) : Summable fun n => x ^ n / n ! := (norm_expSeries_div_summable 𝕂 x).of_norm theorem expSeries_div_hasSum_exp (x : 𝔸) : HasSum (fun n => x ^ n / n !) (exp 𝕂 x) := expSeries_div_hasSum_exp_of_mem_ball 𝕂 x ((expSeries_radius_eq_top 𝕂 𝔸).symm ▸ edist_lt_top _ _) variable {𝕂} theorem exp_neg (x : 𝔸) : exp 𝕂 (-x) = (exp 𝕂 x)⁻¹ := exp_neg_of_mem_ball <| (expSeries_radius_eq_top 𝕂 𝔸).symm ▸ edist_lt_top _ _ theorem exp_zsmul (z : ℤ) (x : 𝔸) : exp 𝕂 (z • x) = exp 𝕂 x ^ z := by obtain ⟨n, rfl | rfl⟩ := z.eq_nat_or_neg · rw [zpow_natCast, natCast_zsmul, exp_nsmul] · rw [zpow_neg, zpow_natCast, neg_smul, exp_neg, natCast_zsmul, exp_nsmul] theorem exp_conj (y : 𝔸) (x : 𝔸) (hy : y ≠ 0) : exp 𝕂 (y * x * y⁻¹) = y * exp 𝕂 x * y⁻¹ := exp_units_conj _ (Units.mk0 y hy) x theorem exp_conj' (y : 𝔸) (x : 𝔸) (hy : y ≠ 0) : exp 𝕂 (y⁻¹ * x * y) = y⁻¹ * exp 𝕂 x * y := exp_units_conj' _ (Units.mk0 y hy) x end DivisionAlgebra section CommAlgebra variable {𝕂 𝔸 : Type*} [RCLike 𝕂] [NormedCommRing 𝔸] [NormedAlgebra 𝕂 𝔸] [CompleteSpace 𝔸] /-- In a commutative Banach-algebra `𝔸` over `𝕂 = ℝ` or `𝕂 = ℂ`, `NormedSpace.exp 𝕂 (x+y) = (NormedSpace.exp 𝕂 x) * (NormedSpace.exp 𝕂 y)`. -/ theorem exp_add {x y : 𝔸} : exp 𝕂 (x + y) = exp 𝕂 x * exp 𝕂 y := exp_add_of_mem_ball ((expSeries_radius_eq_top 𝕂 𝔸).symm ▸ edist_lt_top _ _) ((expSeries_radius_eq_top 𝕂 𝔸).symm ▸ edist_lt_top _ _) /-- A version of `NormedSpace.exp_sum_of_commute` for a commutative Banach-algebra. -/ theorem exp_sum {ι} (s : Finset ι) (f : ι → 𝔸) : exp 𝕂 (∑ i ∈ s, f i) = ∏ i ∈ s, exp 𝕂 (f i) := by rw [exp_sum_of_commute, Finset.noncommProd_eq_prod] exact fun i _hi j _hj _ => Commute.all _ _ end CommAlgebra end RCLike end Normed section ScalarTower variable (𝕂 𝕂' 𝔸 : Type*) [Field 𝕂] [Field 𝕂'] [Ring 𝔸] [Algebra 𝕂 𝔸] [Algebra 𝕂' 𝔸] [TopologicalSpace 𝔸] [TopologicalRing 𝔸] /-- If a normed ring `𝔸` is a normed algebra over two fields, then they define the same `expSeries` on `𝔸`. -/ theorem expSeries_eq_expSeries (n : ℕ) (x : 𝔸) : (expSeries 𝕂 𝔸 n fun _ => x) = expSeries 𝕂' 𝔸 n fun _ => x := by rw [expSeries_apply_eq, expSeries_apply_eq, inv_natCast_smul_eq 𝕂 𝕂'] /-- If a normed ring `𝔸` is a normed algebra over two fields, then they define the same exponential function on `𝔸`. -/ theorem exp_eq_exp : (exp 𝕂 : 𝔸 → 𝔸) = exp 𝕂' := by ext x rw [exp, exp] refine tsum_congr fun n => ?_ rw [expSeries_eq_expSeries 𝕂 𝕂' 𝔸 n x] theorem exp_ℝ_ℂ_eq_exp_ℂ_ℂ : (exp ℝ : ℂ → ℂ) = exp ℂ := exp_eq_exp ℝ ℂ ℂ /-- A version of `Complex.ofReal_exp` for `NormedSpace.exp` instead of `Complex.exp` -/ @[simp, norm_cast] theorem of_real_exp_ℝ_ℝ (r : ℝ) : ↑(exp ℝ r) = exp ℂ (r : ℂ) := (map_exp ℝ (algebraMap ℝ ℂ) (continuous_algebraMap _ _) r).trans (congr_fun exp_ℝ_ℂ_eq_exp_ℂ_ℂ _) end ScalarTower end NormedSpace
Analysis\Normed\Algebra\MatrixExponential.lean
/- Copyright (c) 2022 Eric Wieser. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Eric Wieser -/ import Mathlib.Analysis.Normed.Algebra.Exponential import Mathlib.Analysis.Matrix import Mathlib.LinearAlgebra.Matrix.ZPow import Mathlib.LinearAlgebra.Matrix.Hermitian import Mathlib.LinearAlgebra.Matrix.Symmetric import Mathlib.Topology.UniformSpace.Matrix /-! # Lemmas about the matrix exponential In this file, we provide results about `NormedSpace.exp` on `Matrix`s over a topological or normed algebra. Note that generic results over all topological spaces such as `NormedSpace.exp_zero` can be used on matrices without issue, so are not repeated here. The topological results specific to matrices are: * `Matrix.exp_transpose` * `Matrix.exp_conjTranspose` * `Matrix.exp_diagonal` * `Matrix.exp_blockDiagonal` * `Matrix.exp_blockDiagonal'` Lemmas like `NormedSpace.exp_add_of_commute` require a canonical norm on the type; while there are multiple sensible choices for the norm of a `Matrix` (`Matrix.normedAddCommGroup`, `Matrix.frobeniusNormedAddCommGroup`, `Matrix.linftyOpNormedAddCommGroup`), none of them are canonical. In an application where a particular norm is chosen using `attribute [local instance]`, then the usual lemmas about `NormedSpace.exp` are fine. When choosing a norm is undesirable, the results in this file can be used. In this file, we copy across the lemmas about `NormedSpace.exp`, but hide the requirement for a norm inside the proof. * `Matrix.exp_add_of_commute` * `Matrix.exp_sum_of_commute` * `Matrix.exp_nsmul` * `Matrix.isUnit_exp` * `Matrix.exp_units_conj` * `Matrix.exp_units_conj'` Additionally, we prove some results about `matrix.has_inv` and `matrix.div_inv_monoid`, as the results for general rings are instead stated about `Ring.inverse`: * `Matrix.exp_neg` * `Matrix.exp_zsmul` * `Matrix.exp_conj` * `Matrix.exp_conj'` ## TODO * Show that `Matrix.det (NormedSpace.exp 𝕂 A) = NormedSpace.exp 𝕂 (Matrix.trace A)` ## References * https://en.wikipedia.org/wiki/Matrix_exponential -/ open scoped Matrix open NormedSpace -- For `exp`. variable (𝕂 : Type*) {m n p : Type*} {n' : m → Type*} {𝔸 : Type*} namespace Matrix section Topological section Ring variable [Fintype m] [DecidableEq m] [Fintype n] [DecidableEq n] [∀ i, Fintype (n' i)] [∀ i, DecidableEq (n' i)] [Field 𝕂] [Ring 𝔸] [TopologicalSpace 𝔸] [TopologicalRing 𝔸] [Algebra 𝕂 𝔸] [T2Space 𝔸] theorem exp_diagonal (v : m → 𝔸) : exp 𝕂 (diagonal v) = diagonal (exp 𝕂 v) := by simp_rw [exp_eq_tsum, diagonal_pow, ← diagonal_smul, ← diagonal_tsum] theorem exp_blockDiagonal (v : m → Matrix n n 𝔸) : exp 𝕂 (blockDiagonal v) = blockDiagonal (exp 𝕂 v) := by simp_rw [exp_eq_tsum, ← blockDiagonal_pow, ← blockDiagonal_smul, ← blockDiagonal_tsum] theorem exp_blockDiagonal' (v : ∀ i, Matrix (n' i) (n' i) 𝔸) : exp 𝕂 (blockDiagonal' v) = blockDiagonal' (exp 𝕂 v) := by simp_rw [exp_eq_tsum, ← blockDiagonal'_pow, ← blockDiagonal'_smul, ← blockDiagonal'_tsum] theorem exp_conjTranspose [StarRing 𝔸] [ContinuousStar 𝔸] (A : Matrix m m 𝔸) : exp 𝕂 Aᴴ = (exp 𝕂 A)ᴴ := (star_exp A).symm theorem IsHermitian.exp [StarRing 𝔸] [ContinuousStar 𝔸] {A : Matrix m m 𝔸} (h : A.IsHermitian) : (exp 𝕂 A).IsHermitian := (exp_conjTranspose _ _).symm.trans <| congr_arg _ h end Ring section CommRing variable [Fintype m] [DecidableEq m] [Field 𝕂] [CommRing 𝔸] [TopologicalSpace 𝔸] [TopologicalRing 𝔸] [Algebra 𝕂 𝔸] [T2Space 𝔸] theorem exp_transpose (A : Matrix m m 𝔸) : exp 𝕂 Aᵀ = (exp 𝕂 A)ᵀ := by simp_rw [exp_eq_tsum, transpose_tsum, transpose_smul, transpose_pow] theorem IsSymm.exp {A : Matrix m m 𝔸} (h : A.IsSymm) : (exp 𝕂 A).IsSymm := (exp_transpose _ _).symm.trans <| congr_arg _ h end CommRing end Topological section Normed variable [RCLike 𝕂] [Fintype m] [DecidableEq m] [Fintype n] [DecidableEq n] [∀ i, Fintype (n' i)] [∀ i, DecidableEq (n' i)] [NormedRing 𝔸] [NormedAlgebra 𝕂 𝔸] [CompleteSpace 𝔸] nonrec theorem exp_add_of_commute (A B : Matrix m m 𝔸) (h : Commute A B) : exp 𝕂 (A + B) = exp 𝕂 A * exp 𝕂 B := by letI : SeminormedRing (Matrix m m 𝔸) := Matrix.linftyOpSemiNormedRing letI : NormedRing (Matrix m m 𝔸) := Matrix.linftyOpNormedRing letI : NormedAlgebra 𝕂 (Matrix m m 𝔸) := Matrix.linftyOpNormedAlgebra exact exp_add_of_commute h nonrec theorem exp_sum_of_commute {ι} (s : Finset ι) (f : ι → Matrix m m 𝔸) (h : (s : Set ι).Pairwise fun i j => Commute (f i) (f j)) : exp 𝕂 (∑ i ∈ s, f i) = s.noncommProd (fun i => exp 𝕂 (f i)) fun i hi j hj _ => (h.of_refl hi hj).exp 𝕂 := by letI : SeminormedRing (Matrix m m 𝔸) := Matrix.linftyOpSemiNormedRing letI : NormedRing (Matrix m m 𝔸) := Matrix.linftyOpNormedRing letI : NormedAlgebra 𝕂 (Matrix m m 𝔸) := Matrix.linftyOpNormedAlgebra exact exp_sum_of_commute s f h nonrec theorem exp_nsmul (n : ℕ) (A : Matrix m m 𝔸) : exp 𝕂 (n • A) = exp 𝕂 A ^ n := by letI : SeminormedRing (Matrix m m 𝔸) := Matrix.linftyOpSemiNormedRing letI : NormedRing (Matrix m m 𝔸) := Matrix.linftyOpNormedRing letI : NormedAlgebra 𝕂 (Matrix m m 𝔸) := Matrix.linftyOpNormedAlgebra exact exp_nsmul n A nonrec theorem isUnit_exp (A : Matrix m m 𝔸) : IsUnit (exp 𝕂 A) := by letI : SeminormedRing (Matrix m m 𝔸) := Matrix.linftyOpSemiNormedRing letI : NormedRing (Matrix m m 𝔸) := Matrix.linftyOpNormedRing letI : NormedAlgebra 𝕂 (Matrix m m 𝔸) := Matrix.linftyOpNormedAlgebra exact isUnit_exp _ A -- TODO(mathlib4#6607): fix elaboration so `val` isn't needed nonrec theorem exp_units_conj (U : (Matrix m m 𝔸)ˣ) (A : Matrix m m 𝔸) : exp 𝕂 (U.val * A * (U⁻¹).val) = U.val * exp 𝕂 A * (U⁻¹).val := by letI : SeminormedRing (Matrix m m 𝔸) := Matrix.linftyOpSemiNormedRing letI : NormedRing (Matrix m m 𝔸) := Matrix.linftyOpNormedRing letI : NormedAlgebra 𝕂 (Matrix m m 𝔸) := Matrix.linftyOpNormedAlgebra exact exp_units_conj _ U A -- TODO(mathlib4#6607): fix elaboration so `val` isn't needed theorem exp_units_conj' (U : (Matrix m m 𝔸)ˣ) (A : Matrix m m 𝔸) : exp 𝕂 ((U⁻¹).val * A * U.val) = (U⁻¹).val * exp 𝕂 A * U.val := exp_units_conj 𝕂 U⁻¹ A end Normed section NormedComm variable [RCLike 𝕂] [Fintype m] [DecidableEq m] [Fintype n] [DecidableEq n] [∀ i, Fintype (n' i)] [∀ i, DecidableEq (n' i)] [NormedCommRing 𝔸] [NormedAlgebra 𝕂 𝔸] [CompleteSpace 𝔸] theorem exp_neg (A : Matrix m m 𝔸) : exp 𝕂 (-A) = (exp 𝕂 A)⁻¹ := by rw [nonsing_inv_eq_ring_inverse] letI : SeminormedRing (Matrix m m 𝔸) := Matrix.linftyOpSemiNormedRing letI : NormedRing (Matrix m m 𝔸) := Matrix.linftyOpNormedRing letI : NormedAlgebra 𝕂 (Matrix m m 𝔸) := Matrix.linftyOpNormedAlgebra exact (Ring.inverse_exp _ A).symm theorem exp_zsmul (z : ℤ) (A : Matrix m m 𝔸) : exp 𝕂 (z • A) = exp 𝕂 A ^ z := by obtain ⟨n, rfl | rfl⟩ := z.eq_nat_or_neg · rw [zpow_natCast, natCast_zsmul, exp_nsmul] · have : IsUnit (exp 𝕂 A).det := (Matrix.isUnit_iff_isUnit_det _).mp (isUnit_exp _ _) rw [Matrix.zpow_neg this, zpow_natCast, neg_smul, exp_neg, natCast_zsmul, exp_nsmul] theorem exp_conj (U : Matrix m m 𝔸) (A : Matrix m m 𝔸) (hy : IsUnit U) : exp 𝕂 (U * A * U⁻¹) = U * exp 𝕂 A * U⁻¹ := let ⟨u, hu⟩ := hy hu ▸ by simpa only [Matrix.coe_units_inv] using exp_units_conj 𝕂 u A theorem exp_conj' (U : Matrix m m 𝔸) (A : Matrix m m 𝔸) (hy : IsUnit U) : exp 𝕂 (U⁻¹ * A * U) = U⁻¹ * exp 𝕂 A * U := let ⟨u, hu⟩ := hy hu ▸ by simpa only [Matrix.coe_units_inv] using exp_units_conj' 𝕂 u A end NormedComm end Matrix
Analysis\Normed\Algebra\QuaternionExponential.lean
/- Copyright (c) 2023 Eric Wieser. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Eric Wieser -/ import Mathlib.Analysis.Quaternion import Mathlib.Analysis.Normed.Algebra.Exponential import Mathlib.Analysis.SpecialFunctions.Trigonometric.Series /-! # Lemmas about `NormedSpace.exp` on `Quaternion`s This file contains results about `NormedSpace.exp` on `Quaternion ℝ`. ## Main results * `Quaternion.exp_eq`: the general expansion of the quaternion exponential in terms of `Real.cos` and `Real.sin`. * `Quaternion.exp_of_re_eq_zero`: the special case when the quaternion has a zero real part. * `Quaternion.norm_exp`: the norm of the quaternion exponential is the norm of the exponential of the real part. -/ open scoped Quaternion Nat open NormedSpace namespace Quaternion @[simp, norm_cast] theorem exp_coe (r : ℝ) : exp ℝ (r : ℍ[ℝ]) = ↑(exp ℝ r) := (map_exp ℝ (algebraMap ℝ ℍ[ℝ]) (continuous_algebraMap _ _) _).symm /-- The even terms of `expSeries` are real, and correspond to the series for $\cos ‖q‖$. -/ theorem expSeries_even_of_imaginary {q : Quaternion ℝ} (hq : q.re = 0) (n : ℕ) : expSeries ℝ (Quaternion ℝ) (2 * n) (fun _ => q) = ↑((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n) / (2 * n)!) := by rw [expSeries_apply_eq] have hq2 : q ^ 2 = -normSq q := sq_eq_neg_normSq.mpr hq letI k : ℝ := ↑(2 * n)! calc k⁻¹ • q ^ (2 * n) = k⁻¹ • (-normSq q) ^ n := by rw [pow_mul, hq2] _ = k⁻¹ • ↑((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n)) := ?_ _ = ↑((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n) / k) := ?_ · congr 1 rw [neg_pow, normSq_eq_norm_mul_self, pow_mul, sq] push_cast rfl · rw [← coe_mul_eq_smul, div_eq_mul_inv] norm_cast ring_nf /-- The odd terms of `expSeries` are real, and correspond to the series for $\frac{q}{‖q‖} \sin ‖q‖$. -/ theorem expSeries_odd_of_imaginary {q : Quaternion ℝ} (hq : q.re = 0) (n : ℕ) : expSeries ℝ (Quaternion ℝ) (2 * n + 1) (fun _ => q) = (((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n + 1) / (2 * n + 1)!) / ‖q‖) • q := by rw [expSeries_apply_eq] obtain rfl | hq0 := eq_or_ne q 0 · simp have hq2 : q ^ 2 = -normSq q := sq_eq_neg_normSq.mpr hq have hqn := norm_ne_zero_iff.mpr hq0 let k : ℝ := ↑(2 * n + 1)! calc k⁻¹ • q ^ (2 * n + 1) = k⁻¹ • ((-normSq q) ^ n * q) := by rw [pow_succ, pow_mul, hq2] _ = k⁻¹ • ((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n)) • q := ?_ _ = ((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n + 1) / k / ‖q‖) • q := ?_ · congr 1 rw [neg_pow, normSq_eq_norm_mul_self, pow_mul, sq, ← coe_mul_eq_smul] norm_cast · rw [smul_smul] congr 1 simp_rw [pow_succ, mul_div_assoc, div_div_cancel_left' hqn] ring /-- Auxiliary result; if the power series corresponding to `Real.cos` and `Real.sin` evaluated at `‖q‖` tend to `c` and `s`, then the exponential series tends to `c + (s / ‖q‖)`. -/ theorem hasSum_expSeries_of_imaginary {q : Quaternion ℝ} (hq : q.re = 0) {c s : ℝ} (hc : HasSum (fun n => (-1 : ℝ) ^ n * ‖q‖ ^ (2 * n) / (2 * n)!) c) (hs : HasSum (fun n => (-1 : ℝ) ^ n * ‖q‖ ^ (2 * n + 1) / (2 * n + 1)!) s) : HasSum (fun n => expSeries ℝ (Quaternion ℝ) n fun _ => q) (↑c + (s / ‖q‖) • q) := by replace hc := hasSum_coe.mpr hc replace hs := (hs.div_const ‖q‖).smul_const q refine HasSum.even_add_odd ?_ ?_ · convert hc using 1 ext n : 1 rw [expSeries_even_of_imaginary hq] · convert hs using 1 ext n : 1 rw [expSeries_odd_of_imaginary hq] /-- The closed form for the quaternion exponential on imaginary quaternions. -/ theorem exp_of_re_eq_zero (q : Quaternion ℝ) (hq : q.re = 0) : exp ℝ q = ↑(Real.cos ‖q‖) + (Real.sin ‖q‖ / ‖q‖) • q := by rw [exp_eq_tsum] refine HasSum.tsum_eq ?_ simp_rw [← expSeries_apply_eq] exact hasSum_expSeries_of_imaginary hq (Real.hasSum_cos _) (Real.hasSum_sin _) /-- The closed form for the quaternion exponential on arbitrary quaternions. -/ theorem exp_eq (q : Quaternion ℝ) : exp ℝ q = exp ℝ q.re • (↑(Real.cos ‖q.im‖) + (Real.sin ‖q.im‖ / ‖q.im‖) • q.im) := by rw [← exp_of_re_eq_zero q.im q.im_re, ← coe_mul_eq_smul, ← exp_coe, ← exp_add_of_commute, re_add_im] exact Algebra.commutes q.re (_ : ℍ[ℝ]) theorem re_exp (q : ℍ[ℝ]) : (exp ℝ q).re = exp ℝ q.re * Real.cos ‖q - q.re‖ := by simp [exp_eq] theorem im_exp (q : ℍ[ℝ]) : (exp ℝ q).im = (exp ℝ q.re * (Real.sin ‖q.im‖ / ‖q.im‖)) • q.im := by simp [exp_eq, smul_smul] theorem normSq_exp (q : ℍ[ℝ]) : normSq (exp ℝ q) = exp ℝ q.re ^ 2 := calc normSq (exp ℝ q) = normSq (exp ℝ q.re • (↑(Real.cos ‖q.im‖) + (Real.sin ‖q.im‖ / ‖q.im‖) • q.im)) := by rw [exp_eq] _ = exp ℝ q.re ^ 2 * normSq (↑(Real.cos ‖q.im‖) + (Real.sin ‖q.im‖ / ‖q.im‖) • q.im) := by rw [normSq_smul] _ = exp ℝ q.re ^ 2 * (Real.cos ‖q.im‖ ^ 2 + Real.sin ‖q.im‖ ^ 2) := by congr 1 obtain hv | hv := eq_or_ne ‖q.im‖ 0 · simp [hv] rw [normSq_add, normSq_smul, star_smul, coe_mul_eq_smul, smul_re, smul_re, star_re, im_re, smul_zero, smul_zero, mul_zero, add_zero, div_pow, normSq_coe, normSq_eq_norm_mul_self, ← sq, div_mul_cancel₀ _ (pow_ne_zero _ hv)] _ = exp ℝ q.re ^ 2 := by rw [Real.cos_sq_add_sin_sq, mul_one] /-- Note that this implies that exponentials of pure imaginary quaternions are unit quaternions since in that case the RHS is `1` via `NormedSpace.exp_zero` and `norm_one`. -/ @[simp] theorem norm_exp (q : ℍ[ℝ]) : ‖exp ℝ q‖ = ‖exp ℝ q.re‖ := by rw [norm_eq_sqrt_real_inner (exp ℝ q), inner_self, normSq_exp, Real.sqrt_sq_eq_abs, Real.norm_eq_abs] end Quaternion
Analysis\Normed\Algebra\Spectrum.lean
/- Copyright (c) 2021 Jireh Loreaux. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Jireh Loreaux -/ import Mathlib.Algebra.Algebra.Quasispectrum import Mathlib.FieldTheory.IsAlgClosed.Spectrum import Mathlib.Analysis.Complex.Liouville import Mathlib.Analysis.Complex.Polynomial.Basic import Mathlib.Analysis.Analytic.RadiusLiminf import Mathlib.Topology.Algebra.Module.CharacterSpace import Mathlib.Analysis.Normed.Algebra.Exponential import Mathlib.Analysis.Normed.Algebra.UnitizationL1 import Mathlib.Tactic.ContinuousFunctionalCalculus /-! # The spectrum of elements in a complete normed algebra This file contains the basic theory for the resolvent and spectrum of a Banach algebra. ## Main definitions * `spectralRadius : ℝ≥0∞`: supremum of `‖k‖₊` for all `k ∈ spectrum 𝕜 a` * `NormedRing.algEquivComplexOfComplete`: **Gelfand-Mazur theorem** For a complex Banach division algebra, the natural `algebraMap ℂ A` is an algebra isomorphism whose inverse is given by selecting the (unique) element of `spectrum ℂ a` ## Main statements * `spectrum.isOpen_resolventSet`: the resolvent set is open. * `spectrum.isClosed`: the spectrum is closed. * `spectrum.subset_closedBall_norm`: the spectrum is a subset of closed disk of radius equal to the norm. * `spectrum.isCompact`: the spectrum is compact. * `spectrum.spectralRadius_le_nnnorm`: the spectral radius is bounded above by the norm. * `spectrum.hasDerivAt_resolvent`: the resolvent function is differentiable on the resolvent set. * `spectrum.pow_nnnorm_pow_one_div_tendsto_nhds_spectralRadius`: Gelfand's formula for the spectral radius in Banach algebras over `ℂ`. * `spectrum.nonempty`: the spectrum of any element in a complex Banach algebra is nonempty. ## TODO * compute all derivatives of `resolvent a`. -/ open scoped ENNReal NNReal open NormedSpace -- For `NormedSpace.exp`. /-- The *spectral radius* is the supremum of the `nnnorm` (`‖·‖₊`) of elements in the spectrum, coerced into an element of `ℝ≥0∞`. Note that it is possible for `spectrum 𝕜 a = ∅`. In this case, `spectralRadius a = 0`. It is also possible that `spectrum 𝕜 a` be unbounded (though not for Banach algebras, see `spectrum.isBounded`, below). In this case, `spectralRadius a = ∞`. -/ noncomputable def spectralRadius (𝕜 : Type*) {A : Type*} [NormedField 𝕜] [Ring A] [Algebra 𝕜 A] (a : A) : ℝ≥0∞ := ⨆ k ∈ spectrum 𝕜 a, ‖k‖₊ variable {𝕜 : Type*} {A : Type*} namespace spectrum section SpectrumCompact open Filter variable [NormedField 𝕜] [NormedRing A] [NormedAlgebra 𝕜 A] local notation "σ" => spectrum 𝕜 local notation "ρ" => resolventSet 𝕜 local notation "↑ₐ" => algebraMap 𝕜 A @[simp] theorem SpectralRadius.of_subsingleton [Subsingleton A] (a : A) : spectralRadius 𝕜 a = 0 := by simp [spectralRadius] @[simp] theorem spectralRadius_zero : spectralRadius 𝕜 (0 : A) = 0 := by nontriviality A simp [spectralRadius] theorem mem_resolventSet_of_spectralRadius_lt {a : A} {k : 𝕜} (h : spectralRadius 𝕜 a < ‖k‖₊) : k ∈ ρ a := Classical.not_not.mp fun hn => h.not_le <| le_iSup₂ (α := ℝ≥0∞) k hn variable [CompleteSpace A] theorem isOpen_resolventSet (a : A) : IsOpen (ρ a) := Units.isOpen.preimage ((continuous_algebraMap 𝕜 A).sub continuous_const) protected theorem isClosed (a : A) : IsClosed (σ a) := (isOpen_resolventSet a).isClosed_compl theorem mem_resolventSet_of_norm_lt_mul {a : A} {k : 𝕜} (h : ‖a‖ * ‖(1 : A)‖ < ‖k‖) : k ∈ ρ a := by rw [resolventSet, Set.mem_setOf_eq, Algebra.algebraMap_eq_smul_one] nontriviality A have hk : k ≠ 0 := ne_zero_of_norm_ne_zero ((mul_nonneg (norm_nonneg _) (norm_nonneg _)).trans_lt h).ne' letI ku := Units.map ↑ₐ.toMonoidHom (Units.mk0 k hk) rw [← inv_inv ‖(1 : A)‖, mul_inv_lt_iff (inv_pos.2 <| norm_pos_iff.2 (one_ne_zero : (1 : A) ≠ 0))] at h have hku : ‖-a‖ < ‖(↑ku⁻¹ : A)‖⁻¹ := by simpa [ku, norm_algebraMap] using h simpa [ku, sub_eq_add_neg, Algebra.algebraMap_eq_smul_one] using (ku.add (-a) hku).isUnit theorem mem_resolventSet_of_norm_lt [NormOneClass A] {a : A} {k : 𝕜} (h : ‖a‖ < ‖k‖) : k ∈ ρ a := mem_resolventSet_of_norm_lt_mul (by rwa [norm_one, mul_one]) theorem norm_le_norm_mul_of_mem {a : A} {k : 𝕜} (hk : k ∈ σ a) : ‖k‖ ≤ ‖a‖ * ‖(1 : A)‖ := le_of_not_lt <| mt mem_resolventSet_of_norm_lt_mul hk theorem norm_le_norm_of_mem [NormOneClass A] {a : A} {k : 𝕜} (hk : k ∈ σ a) : ‖k‖ ≤ ‖a‖ := le_of_not_lt <| mt mem_resolventSet_of_norm_lt hk theorem subset_closedBall_norm_mul (a : A) : σ a ⊆ Metric.closedBall (0 : 𝕜) (‖a‖ * ‖(1 : A)‖) := fun k hk => by simp [norm_le_norm_mul_of_mem hk] theorem subset_closedBall_norm [NormOneClass A] (a : A) : σ a ⊆ Metric.closedBall (0 : 𝕜) ‖a‖ := fun k hk => by simp [norm_le_norm_of_mem hk] theorem isBounded (a : A) : Bornology.IsBounded (σ a) := Metric.isBounded_closedBall.subset (subset_closedBall_norm_mul a) protected theorem isCompact [ProperSpace 𝕜] (a : A) : IsCompact (σ a) := Metric.isCompact_of_isClosed_isBounded (spectrum.isClosed a) (isBounded a) instance instCompactSpace [ProperSpace 𝕜] (a : A) : CompactSpace (spectrum 𝕜 a) := isCompact_iff_compactSpace.mp <| spectrum.isCompact a instance instCompactSpaceNNReal {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] (a : A) [CompactSpace (spectrum ℝ a)] : CompactSpace (spectrum ℝ≥0 a) := by rw [← isCompact_iff_compactSpace] at * rw [← preimage_algebraMap ℝ] exact closedEmbedding_subtype_val isClosed_nonneg |>.isCompact_preimage <| by assumption section QuasispectrumCompact variable {B : Type*} [NonUnitalNormedRing B] [NormedSpace 𝕜 B] [CompleteSpace B] variable [IsScalarTower 𝕜 B B] [SMulCommClass 𝕜 B B] [ProperSpace 𝕜] theorem _root_.quasispectrum.isCompact (a : B) : IsCompact (quasispectrum 𝕜 a) := by rw [Unitization.quasispectrum_eq_spectrum_inr' 𝕜 𝕜, ← AlgEquiv.spectrum_eq (WithLp.unitizationAlgEquiv 𝕜).symm (a : Unitization 𝕜 B)] exact spectrum.isCompact _ instance _root_.quasispectrum.instCompactSpace (a : B) : CompactSpace (quasispectrum 𝕜 a) := isCompact_iff_compactSpace.mp <| quasispectrum.isCompact a instance _root_.quasispectrum.instCompactSpaceNNReal [NormedSpace ℝ B] [IsScalarTower ℝ B B] [SMulCommClass ℝ B B] (a : B) [CompactSpace (quasispectrum ℝ a)] : CompactSpace (quasispectrum ℝ≥0 a) := by rw [← isCompact_iff_compactSpace] at * rw [← quasispectrum.preimage_algebraMap ℝ] exact closedEmbedding_subtype_val isClosed_nonneg |>.isCompact_preimage <| by assumption end QuasispectrumCompact theorem spectralRadius_le_nnnorm [NormOneClass A] (a : A) : spectralRadius 𝕜 a ≤ ‖a‖₊ := by refine iSup₂_le fun k hk => ?_ exact mod_cast norm_le_norm_of_mem hk theorem exists_nnnorm_eq_spectralRadius_of_nonempty [ProperSpace 𝕜] {a : A} (ha : (σ a).Nonempty) : ∃ k ∈ σ a, (‖k‖₊ : ℝ≥0∞) = spectralRadius 𝕜 a := by obtain ⟨k, hk, h⟩ := (spectrum.isCompact a).exists_isMaxOn ha continuous_nnnorm.continuousOn exact ⟨k, hk, le_antisymm (le_iSup₂ (α := ℝ≥0∞) k hk) (iSup₂_le <| mod_cast h)⟩ theorem spectralRadius_lt_of_forall_lt_of_nonempty [ProperSpace 𝕜] {a : A} (ha : (σ a).Nonempty) {r : ℝ≥0} (hr : ∀ k ∈ σ a, ‖k‖₊ < r) : spectralRadius 𝕜 a < r := sSup_image.symm.trans_lt <| ((spectrum.isCompact a).sSup_lt_iff_of_continuous ha (ENNReal.continuous_coe.comp continuous_nnnorm).continuousOn (r : ℝ≥0∞)).mpr (by dsimp only [(· ∘ ·)]; exact mod_cast hr) open ENNReal Polynomial variable (𝕜) theorem spectralRadius_le_pow_nnnorm_pow_one_div (a : A) (n : ℕ) : spectralRadius 𝕜 a ≤ (‖a ^ (n + 1)‖₊ : ℝ≥0∞) ^ (1 / (n + 1) : ℝ) * (‖(1 : A)‖₊ : ℝ≥0∞) ^ (1 / (n + 1) : ℝ) := by refine iSup₂_le fun k hk => ?_ -- apply easy direction of the spectral mapping theorem for polynomials have pow_mem : k ^ (n + 1) ∈ σ (a ^ (n + 1)) := by simpa only [one_mul, Algebra.algebraMap_eq_smul_one, one_smul, aeval_monomial, one_mul, eval_monomial] using subset_polynomial_aeval a (@monomial 𝕜 _ (n + 1) (1 : 𝕜)) ⟨k, hk, rfl⟩ -- power of the norm is bounded by norm of the power have nnnorm_pow_le : (↑(‖k‖₊ ^ (n + 1)) : ℝ≥0∞) ≤ ‖a ^ (n + 1)‖₊ * ‖(1 : A)‖₊ := by simpa only [Real.toNNReal_mul (norm_nonneg _), norm_toNNReal, nnnorm_pow k (n + 1), ENNReal.coe_mul] using coe_mono (Real.toNNReal_mono (norm_le_norm_mul_of_mem pow_mem)) -- take (n + 1)ᵗʰ roots and clean up the left-hand side have hn : 0 < ((n + 1 : ℕ) : ℝ) := mod_cast Nat.succ_pos' convert monotone_rpow_of_nonneg (one_div_pos.mpr hn).le nnnorm_pow_le using 1 all_goals dsimp · rw [one_div, pow_rpow_inv_natCast] positivity rw [Nat.cast_succ, ENNReal.coe_mul_rpow] theorem spectralRadius_le_liminf_pow_nnnorm_pow_one_div (a : A) : spectralRadius 𝕜 a ≤ atTop.liminf fun n : ℕ => (‖a ^ n‖₊ : ℝ≥0∞) ^ (1 / n : ℝ) := by refine ENNReal.le_of_forall_lt_one_mul_le fun ε hε => ?_ by_cases h : ε = 0 · simp only [h, zero_mul, zero_le'] have hε' : ε⁻¹ ≠ ∞ := fun h' => h (by simpa only [inv_inv, inv_top] using congr_arg (fun x : ℝ≥0∞ => x⁻¹) h') simp only [ENNReal.mul_le_iff_le_inv h (hε.trans_le le_top).ne, mul_comm ε⁻¹, liminf_eq_iSup_iInf_of_nat', ENNReal.iSup_mul] conv_rhs => arg 1; intro i; rw [ENNReal.iInf_mul hε'] rw [← ENNReal.inv_lt_inv, inv_one] at hε obtain ⟨N, hN⟩ := eventually_atTop.mp (ENNReal.eventually_pow_one_div_le (ENNReal.coe_ne_top : ↑‖(1 : A)‖₊ ≠ ∞) hε) refine le_trans ?_ (le_iSup _ (N + 1)) refine le_iInf fun n => ?_ simp only [← add_assoc] refine (spectralRadius_le_pow_nnnorm_pow_one_div 𝕜 a (n + N)).trans ?_ norm_cast exact mul_le_mul_left' (hN (n + N + 1) (by omega)) _ end SpectrumCompact section resolvent open Filter Asymptotics Bornology Topology variable [NontriviallyNormedField 𝕜] [NormedRing A] [NormedAlgebra 𝕜 A] [CompleteSpace A] local notation "ρ" => resolventSet 𝕜 local notation "↑ₐ" => algebraMap 𝕜 A theorem hasDerivAt_resolvent {a : A} {k : 𝕜} (hk : k ∈ ρ a) : HasDerivAt (resolvent a) (-resolvent a k ^ 2) k := by have H₁ : HasFDerivAt Ring.inverse _ (↑ₐ k - a) := hasFDerivAt_ring_inverse (𝕜 := 𝕜) hk.unit have H₂ : HasDerivAt (fun k => ↑ₐ k - a) 1 k := by simpa using (Algebra.linearMap 𝕜 A).hasDerivAt.sub_const a simpa [resolvent, sq, hk.unit_spec, ← Ring.inverse_unit hk.unit] using H₁.comp_hasDerivAt k H₂ -- refactored so this result was no longer necessary or useful theorem eventually_isUnit_resolvent (a : A) : ∀ᶠ z in cobounded 𝕜, IsUnit (resolvent a z) := by rw [atTop_basis_Ioi.cobounded_of_norm.eventually_iff] exact ⟨‖a‖ * ‖(1 : A)‖, trivial, fun _ ↦ isUnit_resolvent.mp ∘ mem_resolventSet_of_norm_lt_mul⟩ theorem resolvent_isBigO_inv (a : A) : resolvent a =O[cobounded 𝕜] Inv.inv := have h : (fun z ↦ resolvent (z⁻¹ • a) (1 : 𝕜)) =O[cobounded 𝕜] (fun _ ↦ (1 : ℝ)) := by simpa [Function.comp_def, resolvent] using (NormedRing.inverse_one_sub_norm (R := A)).comp_tendsto (by simpa using (tendsto_inv₀_cobounded (α := 𝕜)).smul_const a) calc resolvent a =ᶠ[cobounded 𝕜] fun z ↦ z⁻¹ • resolvent (z⁻¹ • a) (1 : 𝕜) := by filter_upwards [isBounded_singleton (x := 0)] with z hz lift z to 𝕜ˣ using Ne.isUnit hz simpa [Units.smul_def] using congr(z⁻¹ • $(units_smul_resolvent_self (r := z) (a := a))) _ =O[cobounded 𝕜] (· ⁻¹) := .of_norm_right <| by simpa using (isBigO_refl (· ⁻¹) (cobounded 𝕜)).norm_right.smul h theorem resolvent_tendsto_cobounded (a : A) : Tendsto (resolvent a) (cobounded 𝕜) (𝓝 0) := resolvent_isBigO_inv a |>.trans_tendsto tendsto_inv₀_cobounded end resolvent section OneSubSMul open ContinuousMultilinearMap ENNReal FormalMultilinearSeries open scoped NNReal ENNReal variable [NontriviallyNormedField 𝕜] [NormedRing A] [NormedAlgebra 𝕜 A] variable (𝕜) /-- In a Banach algebra `A` over a nontrivially normed field `𝕜`, for any `a : A` the power series with coefficients `a ^ n` represents the function `(1 - z • a)⁻¹` in a disk of radius `‖a‖₊⁻¹`. -/ theorem hasFPowerSeriesOnBall_inverse_one_sub_smul [CompleteSpace A] (a : A) : HasFPowerSeriesOnBall (fun z : 𝕜 => Ring.inverse (1 - z • a)) (fun n => ContinuousMultilinearMap.mkPiRing 𝕜 (Fin n) (a ^ n)) 0 ‖a‖₊⁻¹ := { r_le := by refine le_of_forall_nnreal_lt fun r hr => le_radius_of_bound_nnreal _ (max 1 ‖(1 : A)‖₊) fun n => ?_ rw [← norm_toNNReal, norm_mkPiRing, norm_toNNReal] cases' n with n · simp only [Nat.zero_eq, le_refl, mul_one, or_true_iff, le_max_iff, pow_zero] · refine le_trans (le_trans (mul_le_mul_right' (nnnorm_pow_le' a n.succ_pos) (r ^ n.succ)) ?_) (le_max_left _ _) by_cases h : ‖a‖₊ = 0 · simp only [h, zero_mul, zero_le', pow_succ'] · rw [← coe_inv h, coe_lt_coe, NNReal.lt_inv_iff_mul_lt h] at hr simpa only [← mul_pow, mul_comm] using pow_le_one' hr.le n.succ r_pos := ENNReal.inv_pos.mpr coe_ne_top hasSum := fun {y} hy => by have norm_lt : ‖y • a‖ < 1 := by by_cases h : ‖a‖₊ = 0 · simp only [nnnorm_eq_zero.mp h, norm_zero, zero_lt_one, smul_zero] · have nnnorm_lt : ‖y‖₊ < ‖a‖₊⁻¹ := by simpa only [← coe_inv h, mem_ball_zero_iff, Metric.emetric_ball_nnreal] using hy rwa [← coe_nnnorm, ← Real.lt_toNNReal_iff_coe_lt, Real.toNNReal_one, nnnorm_smul, ← NNReal.lt_inv_iff_mul_lt h] simpa [← smul_pow, (NormedRing.summable_geometric_of_norm_lt_one _ norm_lt).hasSum_iff] using (NormedRing.inverse_one_sub _ norm_lt).symm } variable {𝕜} theorem isUnit_one_sub_smul_of_lt_inv_radius {a : A} {z : 𝕜} (h : ↑‖z‖₊ < (spectralRadius 𝕜 a)⁻¹) : IsUnit (1 - z • a) := by by_cases hz : z = 0 · simp only [hz, isUnit_one, sub_zero, zero_smul] · let u := Units.mk0 z hz suffices hu : IsUnit (u⁻¹ • (1 : A) - a) by rwa [IsUnit.smul_sub_iff_sub_inv_smul, inv_inv u] at hu rw [Units.smul_def, ← Algebra.algebraMap_eq_smul_one, ← mem_resolventSet_iff] refine mem_resolventSet_of_spectralRadius_lt ?_ rwa [Units.val_inv_eq_inv_val, nnnorm_inv, coe_inv (nnnorm_ne_zero_iff.mpr (Units.val_mk0 hz ▸ hz : (u : 𝕜) ≠ 0)), lt_inv_iff_lt_inv] /-- In a Banach algebra `A` over `𝕜`, for `a : A` the function `fun z ↦ (1 - z • a)⁻¹` is differentiable on any closed ball centered at zero of radius `r < (spectralRadius 𝕜 a)⁻¹`. -/ theorem differentiableOn_inverse_one_sub_smul [CompleteSpace A] {a : A} {r : ℝ≥0} (hr : (r : ℝ≥0∞) < (spectralRadius 𝕜 a)⁻¹) : DifferentiableOn 𝕜 (fun z : 𝕜 => Ring.inverse (1 - z • a)) (Metric.closedBall 0 r) := by intro z z_mem apply DifferentiableAt.differentiableWithinAt have hu : IsUnit (1 - z • a) := by refine isUnit_one_sub_smul_of_lt_inv_radius (lt_of_le_of_lt (coe_mono ?_) hr) simpa only [norm_toNNReal, Real.toNNReal_coe] using Real.toNNReal_mono (mem_closedBall_zero_iff.mp z_mem) have H₁ : Differentiable 𝕜 fun w : 𝕜 => 1 - w • a := (differentiable_id.smul_const a).const_sub 1 exact DifferentiableAt.comp z (differentiableAt_inverse hu) H₁.differentiableAt end OneSubSMul section GelfandFormula open Filter ENNReal ContinuousMultilinearMap open scoped Topology variable [NormedRing A] [NormedAlgebra ℂ A] [CompleteSpace A] /-- The `limsup` relationship for the spectral radius used to prove `spectrum.gelfand_formula`. -/ theorem limsup_pow_nnnorm_pow_one_div_le_spectralRadius (a : A) : limsup (fun n : ℕ => (‖a ^ n‖₊ : ℝ≥0∞) ^ (1 / n : ℝ)) atTop ≤ spectralRadius ℂ a := by refine ENNReal.inv_le_inv.mp (le_of_forall_pos_nnreal_lt fun r r_pos r_lt => ?_) simp_rw [inv_limsup, ← one_div] let p : FormalMultilinearSeries ℂ ℂ A := fun n => ContinuousMultilinearMap.mkPiRing ℂ (Fin n) (a ^ n) suffices h : (r : ℝ≥0∞) ≤ p.radius by convert h simp only [p, p.radius_eq_liminf, ← norm_toNNReal, norm_mkPiRing] congr ext n rw [norm_toNNReal, ENNReal.coe_rpow_def ‖a ^ n‖₊ (1 / n : ℝ), if_neg] exact fun ha => (lt_self_iff_false _).mp (ha.2.trans_le (one_div_nonneg.mpr n.cast_nonneg : 0 ≤ (1 / n : ℝ))) have H₁ := (differentiableOn_inverse_one_sub_smul r_lt).hasFPowerSeriesOnBall r_pos exact ((hasFPowerSeriesOnBall_inverse_one_sub_smul ℂ a).exchange_radius H₁).r_le /-- **Gelfand's formula**: Given an element `a : A` of a complex Banach algebra, the `spectralRadius` of `a` is the limit of the sequence `‖a ^ n‖₊ ^ (1 / n)`. -/ theorem pow_nnnorm_pow_one_div_tendsto_nhds_spectralRadius (a : A) : Tendsto (fun n : ℕ => (‖a ^ n‖₊ : ℝ≥0∞) ^ (1 / n : ℝ)) atTop (𝓝 (spectralRadius ℂ a)) := tendsto_of_le_liminf_of_limsup_le (spectralRadius_le_liminf_pow_nnnorm_pow_one_div ℂ a) (limsup_pow_nnnorm_pow_one_div_le_spectralRadius a) /- This is the same as `pow_nnnorm_pow_one_div_tendsto_nhds_spectralRadius` but for `norm` instead of `nnnorm`. -/ /-- **Gelfand's formula**: Given an element `a : A` of a complex Banach algebra, the `spectralRadius` of `a` is the limit of the sequence `‖a ^ n‖₊ ^ (1 / n)`. -/ theorem pow_norm_pow_one_div_tendsto_nhds_spectralRadius (a : A) : Tendsto (fun n : ℕ => ENNReal.ofReal (‖a ^ n‖ ^ (1 / n : ℝ))) atTop (𝓝 (spectralRadius ℂ a)) := by convert pow_nnnorm_pow_one_div_tendsto_nhds_spectralRadius a using 1 ext1 rw [← ofReal_rpow_of_nonneg (norm_nonneg _) _, ← coe_nnnorm, coe_nnreal_eq] exact one_div_nonneg.mpr (mod_cast zero_le _) end GelfandFormula section NonemptySpectrum variable [NormedRing A] [NormedAlgebra ℂ A] [CompleteSpace A] [Nontrivial A] (a : A) /-- In a (nontrivial) complex Banach algebra, every element has nonempty spectrum. -/ protected theorem nonempty : (spectrum ℂ a).Nonempty := by /- Suppose `σ a = ∅`, then resolvent set is `ℂ`, any `(z • 1 - a)` is a unit, and `resolvent a` is differentiable on `ℂ`. -/ by_contra! h have H₀ : resolventSet ℂ a = Set.univ := by rwa [spectrum, Set.compl_empty_iff] at h have H₁ : Differentiable ℂ fun z : ℂ => resolvent a z := fun z => (hasDerivAt_resolvent (H₀.symm ▸ Set.mem_univ z : z ∈ resolventSet ℂ a)).differentiableAt /- Since `resolvent a` tends to zero at infinity, by Liouville's theorem `resolvent a = 0`, which contradicts that `resolvent a z` is invertible. -/ have H₃ := H₁.apply_eq_of_tendsto_cocompact 0 <| by simpa [Metric.cobounded_eq_cocompact] using resolvent_tendsto_cobounded a (𝕜 := ℂ) exact not_isUnit_zero <| H₃ ▸ (isUnit_resolvent.mp <| H₀.symm ▸ Set.mem_univ 0) /-- In a complex Banach algebra, the spectral radius is always attained by some element of the spectrum. -/ theorem exists_nnnorm_eq_spectralRadius : ∃ z ∈ spectrum ℂ a, (‖z‖₊ : ℝ≥0∞) = spectralRadius ℂ a := exists_nnnorm_eq_spectralRadius_of_nonempty (spectrum.nonempty a) /-- In a complex Banach algebra, if every element of the spectrum has norm strictly less than `r : ℝ≥0`, then the spectral radius is also strictly less than `r`. -/ theorem spectralRadius_lt_of_forall_lt {r : ℝ≥0} (hr : ∀ z ∈ spectrum ℂ a, ‖z‖₊ < r) : spectralRadius ℂ a < r := spectralRadius_lt_of_forall_lt_of_nonempty (spectrum.nonempty a) hr open scoped Polynomial open Polynomial /-- The **spectral mapping theorem** for polynomials in a Banach algebra over `ℂ`. -/ theorem map_polynomial_aeval (p : ℂ[X]) : spectrum ℂ (aeval a p) = (fun k => eval k p) '' spectrum ℂ a := map_polynomial_aeval_of_nonempty a p (spectrum.nonempty a) /-- A specialization of the spectral mapping theorem for polynomials in a Banach algebra over `ℂ` to monic monomials. -/ protected theorem map_pow (n : ℕ) : spectrum ℂ (a ^ n) = (· ^ n) '' spectrum ℂ a := by simpa only [aeval_X_pow, eval_pow, eval_X] using map_polynomial_aeval a (X ^ n) end NonemptySpectrum section GelfandMazurIsomorphism variable [NormedRing A] [NormedAlgebra ℂ A] (hA : ∀ {a : A}, IsUnit a ↔ a ≠ 0) local notation "σ" => spectrum ℂ theorem algebraMap_eq_of_mem {a : A} {z : ℂ} (h : z ∈ σ a) : algebraMap ℂ A z = a := by rwa [mem_iff, hA, Classical.not_not, sub_eq_zero] at h /-- **Gelfand-Mazur theorem**: For a complex Banach division algebra, the natural `algebraMap ℂ A` is an algebra isomorphism whose inverse is given by selecting the (unique) element of `spectrum ℂ a`. In addition, `algebraMap_isometry` guarantees this map is an isometry. Note: because `NormedDivisionRing` requires the field `norm_mul' : ∀ a b, ‖a * b‖ = ‖a‖ * ‖b‖`, we don't use this type class and instead opt for a `NormedRing` in which the nonzero elements are precisely the units. This allows for the application of this isomorphism in broader contexts, e.g., to the quotient of a complex Banach algebra by a maximal ideal. In the case when `A` is actually a `NormedDivisionRing`, one may fill in the argument `hA` with the lemma `isUnit_iff_ne_zero`. -/ @[simps] noncomputable def _root_.NormedRing.algEquivComplexOfComplete [CompleteSpace A] : ℂ ≃ₐ[ℂ] A := let nt : Nontrivial A := ⟨⟨1, 0, hA.mp ⟨⟨1, 1, mul_one _, mul_one _⟩, rfl⟩⟩⟩ { Algebra.ofId ℂ A with toFun := algebraMap ℂ A invFun := fun a => (@spectrum.nonempty _ _ _ _ nt a).some left_inv := fun z => by simpa only [@scalar_eq _ _ _ _ _ nt _] using (@spectrum.nonempty _ _ _ _ nt <| algebraMap ℂ A z).some_mem right_inv := fun a => algebraMap_eq_of_mem (@hA) (@spectrum.nonempty _ _ _ _ nt a).some_mem } end GelfandMazurIsomorphism section ExpMapping local notation "↑ₐ" => algebraMap 𝕜 A /-- For `𝕜 = ℝ` or `𝕜 = ℂ`, `exp 𝕜` maps the spectrum of `a` into the spectrum of `exp 𝕜 a`. -/ theorem exp_mem_exp [RCLike 𝕜] [NormedRing A] [NormedAlgebra 𝕜 A] [CompleteSpace A] (a : A) {z : 𝕜} (hz : z ∈ spectrum 𝕜 a) : exp 𝕜 z ∈ spectrum 𝕜 (exp 𝕜 a) := by have hexpmul : exp 𝕜 a = exp 𝕜 (a - ↑ₐ z) * ↑ₐ (exp 𝕜 z) := by rw [algebraMap_exp_comm z, ← exp_add_of_commute (Algebra.commutes z (a - ↑ₐ z)).symm, sub_add_cancel] let b := ∑' n : ℕ, ((n + 1).factorial⁻¹ : 𝕜) • (a - ↑ₐ z) ^ n have hb : Summable fun n : ℕ => ((n + 1).factorial⁻¹ : 𝕜) • (a - ↑ₐ z) ^ n := by refine .of_norm_bounded_eventually _ (Real.summable_pow_div_factorial ‖a - ↑ₐ z‖) ?_ filter_upwards [Filter.eventually_cofinite_ne 0] with n hn rw [norm_smul, mul_comm, norm_inv, RCLike.norm_natCast, ← div_eq_mul_inv] exact div_le_div (pow_nonneg (norm_nonneg _) n) (norm_pow_le' (a - ↑ₐ z) (zero_lt_iff.mpr hn)) (mod_cast Nat.factorial_pos n) (mod_cast Nat.factorial_le (lt_add_one n).le) have h₀ : (∑' n : ℕ, ((n + 1).factorial⁻¹ : 𝕜) • (a - ↑ₐ z) ^ (n + 1)) = (a - ↑ₐ z) * b := by simpa only [mul_smul_comm, pow_succ'] using hb.tsum_mul_left (a - ↑ₐ z) have h₁ : (∑' n : ℕ, ((n + 1).factorial⁻¹ : 𝕜) • (a - ↑ₐ z) ^ (n + 1)) = b * (a - ↑ₐ z) := by simpa only [pow_succ, Algebra.smul_mul_assoc] using hb.tsum_mul_right (a - ↑ₐ z) have h₃ : exp 𝕜 (a - ↑ₐ z) = 1 + (a - ↑ₐ z) * b := by rw [exp_eq_tsum] convert tsum_eq_zero_add (expSeries_summable' (𝕂 := 𝕜) (a - ↑ₐ z)) · simp only [Nat.factorial_zero, Nat.cast_one, inv_one, pow_zero, one_smul] · exact h₀.symm rw [spectrum.mem_iff, IsUnit.sub_iff, ← one_mul (↑ₐ (exp 𝕜 z)), hexpmul, ← _root_.sub_mul, Commute.isUnit_mul_iff (Algebra.commutes (exp 𝕜 z) (exp 𝕜 (a - ↑ₐ z) - 1)).symm, sub_eq_iff_eq_add'.mpr h₃, Commute.isUnit_mul_iff (h₀ ▸ h₁ : (a - ↑ₐ z) * b = b * (a - ↑ₐ z))] exact not_and_of_not_left _ (not_and_of_not_left _ ((not_iff_not.mpr IsUnit.sub_iff).mp hz)) end ExpMapping end spectrum namespace AlgHom section NormedField variable {F : Type*} [NormedField 𝕜] [NormedRing A] [NormedAlgebra 𝕜 A] [CompleteSpace A] local notation "↑ₐ" => algebraMap 𝕜 A instance (priority := 100) [FunLike F A 𝕜] [AlgHomClass F 𝕜 A 𝕜] : ContinuousLinearMapClass F 𝕜 A 𝕜 := { AlgHomClass.linearMapClass with map_continuous := fun φ => AddMonoidHomClass.continuous_of_bound φ ‖(1 : A)‖ fun a => mul_comm ‖a‖ ‖(1 : A)‖ ▸ spectrum.norm_le_norm_mul_of_mem (apply_mem_spectrum φ _) } /-- An algebra homomorphism into the base field, as a continuous linear map (since it is automatically bounded). -/ def toContinuousLinearMap (φ : A →ₐ[𝕜] 𝕜) : A →L[𝕜] 𝕜 := { φ.toLinearMap with cont := map_continuous φ } @[simp] theorem coe_toContinuousLinearMap (φ : A →ₐ[𝕜] 𝕜) : ⇑φ.toContinuousLinearMap = φ := rfl theorem norm_apply_le_self_mul_norm_one [FunLike F A 𝕜] [AlgHomClass F 𝕜 A 𝕜] (f : F) (a : A) : ‖f a‖ ≤ ‖a‖ * ‖(1 : A)‖ := spectrum.norm_le_norm_mul_of_mem (apply_mem_spectrum f _) theorem norm_apply_le_self [NormOneClass A] [FunLike F A 𝕜] [AlgHomClass F 𝕜 A 𝕜] (f : F) (a : A) : ‖f a‖ ≤ ‖a‖ := spectrum.norm_le_norm_of_mem (apply_mem_spectrum f _) end NormedField section NontriviallyNormedField variable [NontriviallyNormedField 𝕜] [NormedRing A] [NormedAlgebra 𝕜 A] [CompleteSpace A] local notation "↑ₐ" => algebraMap 𝕜 A @[simp] theorem toContinuousLinearMap_norm [NormOneClass A] (φ : A →ₐ[𝕜] 𝕜) : ‖φ.toContinuousLinearMap‖ = 1 := ContinuousLinearMap.opNorm_eq_of_bounds zero_le_one (fun a => (one_mul ‖a‖).symm ▸ spectrum.norm_le_norm_of_mem (apply_mem_spectrum φ _)) fun _ _ h => by simpa only [coe_toContinuousLinearMap, map_one, norm_one, mul_one] using h 1 end NontriviallyNormedField end AlgHom namespace WeakDual namespace CharacterSpace variable [NontriviallyNormedField 𝕜] [NormedRing A] [CompleteSpace A] variable [NormedAlgebra 𝕜 A] /-- The equivalence between characters and algebra homomorphisms into the base field. -/ def equivAlgHom : characterSpace 𝕜 A ≃ (A →ₐ[𝕜] 𝕜) where toFun := toAlgHom invFun f := { val := f.toContinuousLinearMap property := by rw [eq_set_map_one_map_mul]; exact ⟨map_one f, map_mul f⟩ } left_inv f := Subtype.ext <| ContinuousLinearMap.ext fun x => rfl right_inv f := AlgHom.ext fun x => rfl @[simp] theorem equivAlgHom_coe (f : characterSpace 𝕜 A) : ⇑(equivAlgHom f) = f := rfl @[simp] theorem equivAlgHom_symm_coe (f : A →ₐ[𝕜] 𝕜) : ⇑(equivAlgHom.symm f) = f := rfl end CharacterSpace end WeakDual namespace SpectrumRestricts open NNReal ENNReal /-- If `𝕜₁` is a normed field contained as subfield of a larger normed field `𝕜₂`, and if `a : A` is an element whose `𝕜₂` spectrum restricts to `𝕜₁`, then the spectral radii over each scalar field coincide. -/ lemma spectralRadius_eq {𝕜₁ 𝕜₂ A : Type*} [NormedField 𝕜₁] [NormedField 𝕜₂] [NormedRing A] [NormedAlgebra 𝕜₁ A] [NormedAlgebra 𝕜₂ A] [NormedAlgebra 𝕜₁ 𝕜₂] [IsScalarTower 𝕜₁ 𝕜₂ A] {f : 𝕜₂ → 𝕜₁} {a : A} (h : SpectrumRestricts a f) : spectralRadius 𝕜₁ a = spectralRadius 𝕜₂ a := by rw [spectralRadius, spectralRadius] have := algebraMap_isometry 𝕜₁ 𝕜₂ |>.nnnorm_map_of_map_zero (map_zero _) apply le_antisymm all_goals apply iSup₂_le fun x hx ↦ ?_ · refine congr_arg ((↑) : ℝ≥0 → ℝ≥0∞) (this x) |>.symm.trans_le <| le_iSup₂ (α := ℝ≥0∞) _ ?_ exact (spectrum.algebraMap_mem_iff _).mpr hx · have ⟨y, hy, hy'⟩ := h.algebraMap_image.symm ▸ hx subst hy' exact this y ▸ le_iSup₂ (α := ℝ≥0∞) y hy variable {A : Type*} [Ring A] lemma nnreal_iff [Algebra ℝ A] {a : A} : SpectrumRestricts a ContinuousMap.realToNNReal ↔ ∀ x ∈ spectrum ℝ a, 0 ≤ x := by refine ⟨fun h x hx ↦ ?_, fun h ↦ ?_⟩ · obtain ⟨x, -, rfl⟩ := h.algebraMap_image.symm ▸ hx exact coe_nonneg x · exact .of_subset_range_algebraMap (fun _ ↦ Real.toNNReal_coe) fun x hx ↦ ⟨⟨x, h x hx⟩, rfl⟩ lemma nnreal_of_nonneg {A : Type*} [Ring A] [PartialOrder A] [Algebra ℝ A] [NonnegSpectrumClass ℝ A] {a : A} (ha : 0 ≤ a) : SpectrumRestricts a ContinuousMap.realToNNReal := nnreal_iff.mpr <| spectrum_nonneg_of_nonneg ha lemma real_iff [Algebra ℂ A] {a : A} : SpectrumRestricts a Complex.reCLM ↔ ∀ x ∈ spectrum ℂ a, x = x.re := by refine ⟨fun h x hx ↦ ?_, fun h ↦ ?_⟩ · obtain ⟨x, -, rfl⟩ := h.algebraMap_image.symm ▸ hx simp · exact .of_subset_range_algebraMap Complex.ofReal_re fun x hx ↦ ⟨x.re, (h x hx).symm⟩ lemma nnreal_iff_spectralRadius_le [Algebra ℝ A] {a : A} {t : ℝ≥0} (ht : spectralRadius ℝ a ≤ t) : SpectrumRestricts a ContinuousMap.realToNNReal ↔ spectralRadius ℝ (algebraMap ℝ A t - a) ≤ t := by have : spectrum ℝ a ⊆ Set.Icc (-t) t := by intro x hx rw [Set.mem_Icc, ← abs_le, ← Real.norm_eq_abs, ← coe_nnnorm, NNReal.coe_le_coe, ← ENNReal.coe_le_coe] exact le_iSup₂ (α := ℝ≥0∞) x hx |>.trans ht rw [nnreal_iff] refine ⟨fun h ↦ iSup₂_le fun x hx ↦ ?_, fun h ↦ ?_⟩ · rw [← spectrum.singleton_sub_eq] at hx obtain ⟨y, hy, rfl⟩ : ∃ y ∈ spectrum ℝ a, ↑t - y = x := by simpa using hx obtain ⟨hty, hyt⟩ := Set.mem_Icc.mp <| this hy lift y to ℝ≥0 using h y hy rw [← NNReal.coe_sub (by exact_mod_cast hyt)] simp · replace h : ∀ x ∈ spectrum ℝ a, ‖t - x‖₊ ≤ t := by simpa [spectralRadius, iSup₂_le_iff, ← spectrum.singleton_sub_eq] using h peel h with x hx h_le rw [← NNReal.coe_le_coe, coe_nnnorm, Real.norm_eq_abs, abs_le] at h_le linarith [h_le.2] lemma _root_.NNReal.spectralRadius_mem_spectrum {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] [CompleteSpace A] {a : A} (ha : (spectrum ℝ a).Nonempty) (ha' : SpectrumRestricts a ContinuousMap.realToNNReal) : (spectralRadius ℝ a).toNNReal ∈ spectrum ℝ≥0 a := by obtain ⟨x, hx₁, hx₂⟩ := spectrum.exists_nnnorm_eq_spectralRadius_of_nonempty ha rw [← hx₂, ENNReal.toNNReal_coe, ← spectrum.algebraMap_mem_iff ℝ, NNReal.algebraMap_eq_coe] have : 0 ≤ x := ha'.rightInvOn hx₁ ▸ NNReal.zero_le_coe convert hx₁ simpa lemma _root_.Real.spectralRadius_mem_spectrum {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] [CompleteSpace A] {a : A} (ha : (spectrum ℝ a).Nonempty) (ha' : SpectrumRestricts a ContinuousMap.realToNNReal) : (spectralRadius ℝ a).toReal ∈ spectrum ℝ a := NNReal.spectralRadius_mem_spectrum ha ha' lemma _root_.Real.spectralRadius_mem_spectrum_or {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] [CompleteSpace A] {a : A} (ha : (spectrum ℝ a).Nonempty) : (spectralRadius ℝ a).toReal ∈ spectrum ℝ a ∨ -(spectralRadius ℝ a).toReal ∈ spectrum ℝ a := by obtain ⟨x, hx₁, hx₂⟩ := spectrum.exists_nnnorm_eq_spectralRadius_of_nonempty ha simp only [← hx₂, ENNReal.coe_toReal, coe_nnnorm, Real.norm_eq_abs] exact abs_choice x |>.imp (fun h ↦ by rwa [h]) (fun h ↦ by simpa [h]) end SpectrumRestricts namespace QuasispectrumRestricts open NNReal ENNReal local notation "σₙ" => quasispectrum lemma compactSpace {R S A : Type*} [Semifield R] [Field S] [NonUnitalRing A] [Algebra R S] [Module R A] [Module S A] [IsScalarTower S A A] [SMulCommClass S A A] [IsScalarTower R S A] [TopologicalSpace R] [TopologicalSpace S] {a : A} (f : C(S, R)) (h : QuasispectrumRestricts a f) [h_cpct : CompactSpace (σₙ S a)] : CompactSpace (σₙ R a) := by rw [← isCompact_iff_compactSpace] at h_cpct ⊢ exact h.image ▸ h_cpct.image (map_continuous f) variable {A : Type*} [NonUnitalRing A] lemma nnreal_iff [Module ℝ A] [IsScalarTower ℝ A A] [SMulCommClass ℝ A A] {a : A} : QuasispectrumRestricts a ContinuousMap.realToNNReal ↔ ∀ x ∈ σₙ ℝ a, 0 ≤ x := by rw [quasispectrumRestricts_iff_spectrumRestricts_inr, Unitization.quasispectrum_eq_spectrum_inr' _ ℝ, SpectrumRestricts.nnreal_iff] lemma nnreal_of_nonneg [Module ℝ A] [IsScalarTower ℝ A A] [SMulCommClass ℝ A A] [PartialOrder A] [NonnegSpectrumClass ℝ A] {a : A} (ha : 0 ≤ a) : QuasispectrumRestricts a ContinuousMap.realToNNReal := nnreal_iff.mpr <| quasispectrum_nonneg_of_nonneg _ ha lemma real_iff [Module ℂ A] [IsScalarTower ℂ A A] [SMulCommClass ℂ A A] {a : A} : QuasispectrumRestricts a Complex.reCLM ↔ ∀ x ∈ σₙ ℂ a, x = x.re := by rw [quasispectrumRestricts_iff_spectrumRestricts_inr, Unitization.quasispectrum_eq_spectrum_inr' _ ℂ, SpectrumRestricts.real_iff] end QuasispectrumRestricts variable {A : Type*} [TopologicalSpace A] [Ring A] [StarRing A] [PartialOrder A] lemma coe_mem_spectrum_real_of_nonneg [Algebra ℝ A] [NonnegSpectrumClass ℝ A] {a : A} {x : ℝ≥0} (ha : 0 ≤ a := by cfc_tac) : (x : ℝ) ∈ spectrum ℝ a ↔ x ∈ spectrum ℝ≥0 a := by simp [← (SpectrumRestricts.nnreal_of_nonneg ha).algebraMap_image, Set.mem_image, NNReal.algebraMap_eq_coe]
Analysis\Normed\Algebra\TrivSqZeroExt.lean
/- Copyright (c) 2023 Eric Wieser. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Eric Wieser -/ import Mathlib.Analysis.Normed.Algebra.Exponential import Mathlib.Analysis.Normed.Lp.ProdLp import Mathlib.Topology.Instances.TrivSqZeroExt /-! # Results on `TrivSqZeroExt R M` related to the norm This file contains results about `NormedSpace.exp` for `TrivSqZeroExt`. It also contains a definition of the $ℓ^1$ norm, which defines $\|r + m\| \coloneqq \|r\| + \|m\|$. This is not a particularly canonical choice of definition, but it is sufficient to provide a `NormedAlgebra` instance, and thus enables `NormedSpace.exp_add_of_commute` to be used on `TrivSqZeroExt`. If the non-canonicity becomes problematic in future, we could keep the collection of instances behind an `open scoped`. ## Main results * `TrivSqZeroExt.fst_exp` * `TrivSqZeroExt.snd_exp` * `TrivSqZeroExt.exp_inl` * `TrivSqZeroExt.exp_inr` * The $ℓ^1$ norm on `TrivSqZeroExt`: * `TrivSqZeroExt.instL1SeminormedAddCommGroup` * `TrivSqZeroExt.instL1SeminormedRing` * `TrivSqZeroExt.instL1SeminormedCommRing` * `TrivSqZeroExt.instL1BoundedSMul` * `TrivSqZeroExt.instL1NormedAddCommGroup` * `TrivSqZeroExt.instL1NormedRing` * `TrivSqZeroExt.instL1NormedCommRing` * `TrivSqZeroExt.instL1NormedSpace` * `TrivSqZeroExt.instL1NormedAlgebra` ## TODO * Generalize more of these results to non-commutative `R`. In principle, under sufficient conditions we should expect `(exp 𝕜 x).snd = ∫ t in 0..1, exp 𝕜 (t • x.fst) • op (exp 𝕜 ((1 - t) • x.fst)) • x.snd` ([Physics.SE](https://physics.stackexchange.com/a/41671/185147), and https://link.springer.com/chapter/10.1007/978-3-540-44953-9_2). -/ variable (𝕜 : Type*) {S R M : Type*} local notation "tsze" => TrivSqZeroExt open NormedSpace -- For `NormedSpace.exp`. namespace TrivSqZeroExt section Topology section not_charZero variable [Field 𝕜] [Ring R] [AddCommGroup M] [Algebra 𝕜 R] [Module 𝕜 M] [Module R M] [Module Rᵐᵒᵖ M] [SMulCommClass R Rᵐᵒᵖ M] [IsScalarTower 𝕜 R M] [IsScalarTower 𝕜 Rᵐᵒᵖ M] [TopologicalSpace R] [TopologicalSpace M] [TopologicalRing R] [TopologicalAddGroup M] [ContinuousSMul R M] [ContinuousSMul Rᵐᵒᵖ M] @[simp] theorem fst_expSeries (x : tsze R M) (n : ℕ) : fst (expSeries 𝕜 (tsze R M) n fun _ => x) = expSeries 𝕜 R n fun _ => x.fst := by simp [expSeries_apply_eq] end not_charZero section Ring variable [Field 𝕜] [CharZero 𝕜] [Ring R] [AddCommGroup M] [Algebra 𝕜 R] [Module 𝕜 M] [Module R M] [Module Rᵐᵒᵖ M] [SMulCommClass R Rᵐᵒᵖ M] [IsScalarTower 𝕜 R M] [IsScalarTower 𝕜 Rᵐᵒᵖ M] [TopologicalSpace R] [TopologicalSpace M] [TopologicalRing R] [TopologicalAddGroup M] [ContinuousSMul R M] [ContinuousSMul Rᵐᵒᵖ M] theorem snd_expSeries_of_smul_comm (x : tsze R M) (hx : MulOpposite.op x.fst • x.snd = x.fst • x.snd) (n : ℕ) : snd (expSeries 𝕜 (tsze R M) (n + 1) fun _ => x) = (expSeries 𝕜 R n fun _ => x.fst) • x.snd := by simp_rw [expSeries_apply_eq, snd_smul, snd_pow_of_smul_comm _ _ hx, ← Nat.cast_smul_eq_nsmul 𝕜 (n + 1), smul_smul, smul_assoc, Nat.factorial_succ, Nat.pred_succ, Nat.cast_mul, mul_inv_rev, inv_mul_cancel_right₀ ((Nat.cast_ne_zero (R := 𝕜)).mpr <| Nat.succ_ne_zero n)] /-- If `NormedSpace.exp R x.fst` converges to `e` then `(NormedSpace.exp R x).snd` converges to `e • x.snd`. -/ theorem hasSum_snd_expSeries_of_smul_comm (x : tsze R M) (hx : MulOpposite.op x.fst • x.snd = x.fst • x.snd) {e : R} (h : HasSum (fun n => expSeries 𝕜 R n fun _ => x.fst) e) : HasSum (fun n => snd (expSeries 𝕜 (tsze R M) n fun _ => x)) (e • x.snd) := by rw [← hasSum_nat_add_iff' 1] simp_rw [snd_expSeries_of_smul_comm _ _ hx] simp_rw [expSeries_apply_eq] at * rw [Finset.range_one, Finset.sum_singleton, Nat.factorial_zero, Nat.cast_one, pow_zero, inv_one, one_smul, snd_one, sub_zero] exact h.smul_const _ /-- If `NormedSpace.exp R x.fst` converges to `e` then `NormedSpace.exp R x` converges to `inl e + inr (e • x.snd)`. -/ theorem hasSum_expSeries_of_smul_comm (x : tsze R M) (hx : MulOpposite.op x.fst • x.snd = x.fst • x.snd) {e : R} (h : HasSum (fun n => expSeries 𝕜 R n fun _ => x.fst) e) : HasSum (fun n => expSeries 𝕜 (tsze R M) n fun _ => x) (inl e + inr (e • x.snd)) := by have : HasSum (fun n => fst (expSeries 𝕜 (tsze R M) n fun _ => x)) e := by simpa [fst_expSeries] using h simpa only [inl_fst_add_inr_snd_eq] using (hasSum_inl _ <| this).add (hasSum_inr _ <| hasSum_snd_expSeries_of_smul_comm 𝕜 x hx h) variable [T2Space R] [T2Space M] theorem exp_def_of_smul_comm (x : tsze R M) (hx : MulOpposite.op x.fst • x.snd = x.fst • x.snd) : exp 𝕜 x = inl (exp 𝕜 x.fst) + inr (exp 𝕜 x.fst • x.snd) := by simp_rw [exp, FormalMultilinearSeries.sum] by_cases h : Summable (fun (n : ℕ) => (expSeries 𝕜 R n) fun x_1 ↦ fst x) · refine (hasSum_expSeries_of_smul_comm 𝕜 x hx ?_).tsum_eq exact h.hasSum · rw [tsum_eq_zero_of_not_summable h, zero_smul, inr_zero, inl_zero, zero_add, tsum_eq_zero_of_not_summable] simp_rw [← fst_expSeries] at h refine mt ?_ h exact (Summable.map · (TrivSqZeroExt.fstHom 𝕜 R M).toLinearMap continuous_fst) @[simp] theorem exp_inl (x : R) : exp 𝕜 (inl x : tsze R M) = inl (exp 𝕜 x) := by rw [exp_def_of_smul_comm, snd_inl, fst_inl, smul_zero, inr_zero, add_zero] rw [snd_inl, fst_inl, smul_zero, smul_zero] @[simp] theorem exp_inr (m : M) : exp 𝕜 (inr m : tsze R M) = 1 + inr m := by rw [exp_def_of_smul_comm, snd_inr, fst_inr, exp_zero, one_smul, inl_one] rw [snd_inr, fst_inr, MulOpposite.op_zero, zero_smul, zero_smul] end Ring section CommRing variable [Field 𝕜] [CharZero 𝕜] [CommRing R] [AddCommGroup M] [Algebra 𝕜 R] [Module 𝕜 M] [Module R M] [Module Rᵐᵒᵖ M] [IsCentralScalar R M] [IsScalarTower 𝕜 R M] [TopologicalSpace R] [TopologicalSpace M] [TopologicalRing R] [TopologicalAddGroup M] [ContinuousSMul R M] [ContinuousSMul Rᵐᵒᵖ M] variable [T2Space R] [T2Space M] theorem exp_def (x : tsze R M) : exp 𝕜 x = inl (exp 𝕜 x.fst) + inr (exp 𝕜 x.fst • x.snd) := exp_def_of_smul_comm 𝕜 x (op_smul_eq_smul _ _) @[simp] theorem fst_exp (x : tsze R M) : fst (exp 𝕜 x) = exp 𝕜 x.fst := by rw [exp_def, fst_add, fst_inl, fst_inr, add_zero] @[simp] theorem snd_exp (x : tsze R M) : snd (exp 𝕜 x) = exp 𝕜 x.fst • x.snd := by rw [exp_def, snd_add, snd_inl, snd_inr, zero_add] /-- Polar form of trivial-square-zero extension. -/ theorem eq_smul_exp_of_invertible (x : tsze R M) [Invertible x.fst] : x = x.fst • exp 𝕜 (⅟ x.fst • inr x.snd) := by rw [← inr_smul, exp_inr, smul_add, ← inl_one, ← inl_smul, ← inr_smul, smul_eq_mul, mul_one, smul_smul, mul_invOf_self, one_smul, inl_fst_add_inr_snd_eq] end CommRing section Field variable [Field 𝕜] [CharZero 𝕜] [Field R] [AddCommGroup M] [Algebra 𝕜 R] [Module 𝕜 M] [Module R M] [Module Rᵐᵒᵖ M] [IsCentralScalar R M] [IsScalarTower 𝕜 R M] [TopologicalSpace R] [TopologicalSpace M] [TopologicalRing R] [TopologicalAddGroup M] [ContinuousSMul R M] [ContinuousSMul Rᵐᵒᵖ M] variable [T2Space R] [T2Space M] /-- More convenient version of `TrivSqZeroExt.eq_smul_exp_of_invertible` for when `R` is a field. -/ theorem eq_smul_exp_of_ne_zero (x : tsze R M) (hx : x.fst ≠ 0) : x = x.fst • exp 𝕜 (x.fst⁻¹ • inr x.snd) := letI : Invertible x.fst := invertibleOfNonzero hx eq_smul_exp_of_invertible _ _ end Field end Topology /-! ### The $ℓ^1$ norm on the trivial square zero extension -/ noncomputable section Seminormed section Ring variable [SeminormedCommRing S] [SeminormedRing R] [SeminormedAddCommGroup M] variable [Algebra S R] [Module S M] variable [BoundedSMul S R] [BoundedSMul S M] instance instL1SeminormedAddCommGroup : SeminormedAddCommGroup (tsze R M) := inferInstanceAs <| SeminormedAddCommGroup (WithLp 1 <| R × M) example : (TrivSqZeroExt.instUniformSpace : UniformSpace (tsze R M)) = PseudoMetricSpace.toUniformSpace := rfl theorem norm_def (x : tsze R M) : ‖x‖ = ‖fst x‖ + ‖snd x‖ := by rw [WithLp.prod_norm_eq_add (by norm_num)] simp only [ENNReal.one_toReal, Real.rpow_one, div_one] rfl theorem nnnorm_def (x : tsze R M) : ‖x‖₊ = ‖fst x‖₊ + ‖snd x‖₊ := by ext; simp [norm_def] @[simp] theorem norm_inl (r : R) : ‖(inl r : tsze R M)‖ = ‖r‖ := by simp [norm_def] @[simp] theorem norm_inr (m : M) : ‖(inr m : tsze R M)‖ = ‖m‖ := by simp [norm_def] @[simp] theorem nnnorm_inl (r : R) : ‖(inl r : tsze R M)‖₊ = ‖r‖₊ := by simp [nnnorm_def] @[simp] theorem nnnorm_inr (m : M) : ‖(inr m : tsze R M)‖₊ = ‖m‖₊ := by simp [nnnorm_def] variable [Module R M] [BoundedSMul R M] [Module Rᵐᵒᵖ M] [BoundedSMul Rᵐᵒᵖ M] [SMulCommClass R Rᵐᵒᵖ M] instance instL1SeminormedRing : SeminormedRing (tsze R M) where norm_mul | ⟨r₁, m₁⟩, ⟨r₂, m₂⟩ => by dsimp rw [norm_def, norm_def, norm_def, add_mul, mul_add, mul_add, snd_mul, fst_mul] dsimp [fst, snd] rw [add_assoc] gcongr · exact norm_mul_le _ _ refine (norm_add_le _ _).trans ?_ gcongr · exact norm_smul_le _ _ refine (_root_.norm_smul_le _ _).trans ?_ rw [mul_comm, MulOpposite.norm_op] exact le_add_of_nonneg_right <| by positivity __ : SeminormedAddCommGroup (tsze R M) := inferInstance __ : Ring (tsze R M) := inferInstance instance instL1BoundedSMul : BoundedSMul S (tsze R M) := inferInstanceAs <| BoundedSMul S (WithLp 1 <| R × M) instance [NormOneClass R] : NormOneClass (tsze R M) where norm_one := by rw [norm_def, fst_one, snd_one, norm_zero, norm_one, add_zero] end Ring section CommRing variable [SeminormedCommRing R] [SeminormedAddCommGroup M] variable [Module R M] [Module Rᵐᵒᵖ M] [IsCentralScalar R M] variable [BoundedSMul R M] instance instL1SeminormedCommRing : SeminormedCommRing (tsze R M) where __ : CommRing (tsze R M) := inferInstance __ : SeminormedRing (tsze R M) := inferInstance end CommRing end Seminormed noncomputable section Normed section Ring variable [NormedCommRing S] [NormedRing R] [NormedAddCommGroup M] variable [Algebra S R] [Module S M] [Module R M] [Module Rᵐᵒᵖ M] variable [BoundedSMul S R] [BoundedSMul S M] [BoundedSMul R M] [BoundedSMul Rᵐᵒᵖ M] variable [SMulCommClass R Rᵐᵒᵖ M] [IsScalarTower S R M] [IsScalarTower S Rᵐᵒᵖ M] instance instL1NormedAddCommGroup : NormedAddCommGroup (tsze R M) := inferInstanceAs <| NormedAddCommGroup (WithLp 1 <| R × M) instance instL1NormedRing : NormedRing (tsze R M) where __ : NormedAddCommGroup (tsze R M) := inferInstance __ : SeminormedRing (tsze R M) := inferInstance end Ring section CommRing variable [NormedCommRing R] [NormedAddCommGroup M] variable [Module R M] [Module Rᵐᵒᵖ M] [IsCentralScalar R M] variable [BoundedSMul R M] instance instL1NormedCommRing : NormedCommRing (tsze R M) where __ : CommRing (tsze R M) := inferInstance __ : NormedRing (tsze R M) := inferInstance end CommRing section Algebra variable [NormedField 𝕜] [NormedRing R] [NormedAddCommGroup M] variable [NormedAlgebra 𝕜 R] [NormedSpace 𝕜 M] [Module R M] [Module Rᵐᵒᵖ M] variable [BoundedSMul R M] [BoundedSMul Rᵐᵒᵖ M] [SMulCommClass R Rᵐᵒᵖ M] variable [IsScalarTower 𝕜 R M] [IsScalarTower 𝕜 Rᵐᵒᵖ M] instance instL1NormedSpace : NormedSpace 𝕜 (tsze R M) := inferInstanceAs <| NormedSpace 𝕜 (WithLp 1 <| R × M) instance instL1NormedAlgebra : NormedAlgebra 𝕜 (tsze R M) where norm_smul_le := _root_.norm_smul_le end Algebra end Normed section variable [RCLike 𝕜] [NormedRing R] [NormedAddCommGroup M] variable [NormedAlgebra 𝕜 R] [NormedSpace 𝕜 M] [Module R M] [Module Rᵐᵒᵖ M] variable [BoundedSMul R M] [BoundedSMul Rᵐᵒᵖ M] [SMulCommClass R Rᵐᵒᵖ M] variable [IsScalarTower 𝕜 R M] [IsScalarTower 𝕜 Rᵐᵒᵖ M] variable [CompleteSpace R] [CompleteSpace M] -- Evidence that we have sufficient instances on `tsze R N` -- to make `NormedSpace.exp_add_of_commute` usable example (a b : tsze R M) (h : Commute a b) : exp 𝕜 (a + b) = exp 𝕜 a * exp 𝕜 b := exp_add_of_commute h end end TrivSqZeroExt
Analysis\Normed\Algebra\Unitization.lean
/- Copyright (c) 2023 Jireh Loreaux. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Jireh Loreaux -/ import Mathlib.Algebra.Algebra.Unitization import Mathlib.Analysis.NormedSpace.OperatorNorm.Mul /-! # Unitization norms Given a not-necessarily-unital normed `𝕜`-algebra `A`, it is frequently of interest to equip its `Unitization` with a norm which simultaneously makes it into a normed algebra and also satisfies two properties: - `‖1‖ = 1` (i.e., `NormOneClass`) - The embedding of `A` in `Unitization 𝕜 A` is an isometry. (i.e., `Isometry Unitization.inr`) One way to do this is to pull back the norm from `WithLp 1 (𝕜 × A)`, that is, `‖(k, a)‖ = ‖k‖ + ‖a‖` using `Unitization.addEquiv` (i.e., the identity map). This is implemented for the type synonym `WithLp 1 (Unitization 𝕜 A)` in `WithLp.instUnitizationNormedAddCommGroup`, and it is shown there that this is a Banach algebra. However, when the norm on `A` is *regular* (i.e., `ContinuousLinearMap.mul` is an isometry), there is another natural choice: the pullback of the norm on `𝕜 × (A →L[𝕜] A)` under the map `(k, a) ↦ (k, k • 1 + ContinuousLinearMap.mul 𝕜 A a)`. It turns out that among all norms on the unitization satisfying the properties specified above, the norm inherited from `WithLp 1 (𝕜 × A)` is maximal, and the norm inherited from this pullback is minimal. Of course, this means that `WithLp.equiv : WithLp 1 (Unitization 𝕜 A) → Unitization 𝕜 A` can be upgraded to a continuous linear equivalence (when `𝕜` and `A` are complete). structure on `Unitization 𝕜 A` using the pullback described above. The reason for choosing this norm is that for a C⋆-algebra `A` its norm is always regular, and the pullback norm on `Unitization 𝕜 A` is then also a C⋆-norm. ## Main definitions - `Unitization.splitMul : Unitization 𝕜 A →ₐ[𝕜] (𝕜 × (A →L[𝕜] A))`: The first coordinate of this map is just `Unitization.fst` and the second is the `Unitization.lift` of the left regular representation of `A` (i.e., `NonUnitalAlgHom.Lmul`). We use this map to pull back the `NormedRing` and `NormedAlgebra` structures. ## Main statements - `Unitization.instNormedRing`, `Unitization.instNormedAlgebra`, `Unitization.instNormOneClass`, `Unitization.instCompleteSpace`: when `A` is a non-unital Banach `𝕜`-algebra with a regular norm, then `Unitization 𝕜 A` is a unital Banach `𝕜`-algebra with `‖1‖ = 1`. - `Unitization.norm_inr`, `Unitization.isometry_inr`: the natural inclusion `A → Unitization 𝕜 A` is an isometry, or in mathematical parlance, the norm on `A` extends to a norm on `Unitization 𝕜 A`. ## Implementation details We ensure that the uniform structure, and hence also the topological structure, is definitionally equal to the pullback of `instUniformSpaceProd` along `Unitization.addEquiv` (this is essentially viewing `Unitization 𝕜 A` as `𝕜 × A`) by means of forgetful inheritance. The same is true of the bornology. -/ suppress_compilation variable (𝕜 A : Type*) [NontriviallyNormedField 𝕜] [NonUnitalNormedRing A] variable [NormedSpace 𝕜 A] [IsScalarTower 𝕜 A A] [SMulCommClass 𝕜 A A] open ContinuousLinearMap namespace Unitization /-- Given `(k, a) : Unitization 𝕜 A`, the second coordinate of `Unitization.splitMul (k, a)` is the natural representation of `Unitization 𝕜 A` on `A` given by multiplication on the left in `A →L[𝕜] A`; note that this is not just `NonUnitalAlgHom.Lmul` for a few reasons: (a) that would either be `A` acting on `A`, or (b) `Unitization 𝕜 A` acting on `Unitization 𝕜 A`, and (c) that's a `NonUnitalAlgHom` but here we need an `AlgHom`. In addition, the first coordinate of `Unitization.splitMul (k, a)` should just be `k`. See `Unitization.splitMul_apply` also. -/ def splitMul : Unitization 𝕜 A →ₐ[𝕜] 𝕜 × (A →L[𝕜] A) := (lift 0).prod (lift <| NonUnitalAlgHom.Lmul 𝕜 A) variable {𝕜 A} @[simp] theorem splitMul_apply (x : Unitization 𝕜 A) : splitMul 𝕜 A x = (x.fst, algebraMap 𝕜 (A →L[𝕜] A) x.fst + mul 𝕜 A x.snd) := show (x.fst + 0, _) = (x.fst, _) by rw [add_zero]; rfl /-- this lemma establishes that if `ContinuousLinearMap.mul 𝕜 A` is injective, then so is `Unitization.splitMul 𝕜 A`. When `A` is a `RegularNormedAlgebra`, then `ContinuousLinearMap.mul 𝕜 A` is an isometry, and is therefore automatically injective. -/ theorem splitMul_injective_of_clm_mul_injective (h : Function.Injective (mul 𝕜 A)) : Function.Injective (splitMul 𝕜 A) := by rw [injective_iff_map_eq_zero] intro x hx induction x rw [map_add] at hx simp only [splitMul_apply, fst_inl, snd_inl, map_zero, add_zero, fst_inr, snd_inr, zero_add, Prod.mk_add_mk, Prod.mk_eq_zero] at hx obtain ⟨rfl, hx⟩ := hx simp only [map_zero, zero_add, inl_zero] at hx ⊢ rw [← map_zero (mul 𝕜 A)] at hx rw [h hx, inr_zero] variable [RegularNormedAlgebra 𝕜 A] variable (𝕜 A) /-- In a `RegularNormedAlgebra`, the map `Unitization.splitMul 𝕜 A` is injective. We will use this to pull back the norm from `𝕜 × (A →L[𝕜] A)` to `Unitization 𝕜 A`. -/ theorem splitMul_injective : Function.Injective (splitMul 𝕜 A) := splitMul_injective_of_clm_mul_injective (isometry_mul 𝕜 A).injective variable {𝕜 A} section Aux /-- Pull back the normed ring structure from `𝕜 × (A →L[𝕜] A)` to `Unitization 𝕜 A` using the algebra homomorphism `Unitization.splitMul 𝕜 A`. This does not give us the desired topology, uniformity or bornology on `Unitization 𝕜 A` (which we want to agree with `Prod`), so we only use it as a local instance to build the real one. -/ noncomputable abbrev normedRingAux : NormedRing (Unitization 𝕜 A) := NormedRing.induced (Unitization 𝕜 A) (𝕜 × (A →L[𝕜] A)) (splitMul 𝕜 A) (splitMul_injective 𝕜 A) attribute [local instance] Unitization.normedRingAux /-- Pull back the normed algebra structure from `𝕜 × (A →L[𝕜] A)` to `Unitization 𝕜 A` using the algebra homomorphism `Unitization.splitMul 𝕜 A`. This uses the wrong `NormedRing` instance (i.e., `Unitization.normedRingAux`), so we only use it as a local instance to build the real one. -/ noncomputable abbrev normedAlgebraAux : NormedAlgebra 𝕜 (Unitization 𝕜 A) := NormedAlgebra.induced 𝕜 (Unitization 𝕜 A) (𝕜 × (A →L[𝕜] A)) (splitMul 𝕜 A) attribute [local instance] Unitization.normedAlgebraAux theorem norm_def (x : Unitization 𝕜 A) : ‖x‖ = ‖splitMul 𝕜 A x‖ := rfl theorem nnnorm_def (x : Unitization 𝕜 A) : ‖x‖₊ = ‖splitMul 𝕜 A x‖₊ := rfl /-- This is often the more useful lemma to rewrite the norm as opposed to `Unitization.norm_def`. -/ theorem norm_eq_sup (x : Unitization 𝕜 A) : ‖x‖ = ‖x.fst‖ ⊔ ‖algebraMap 𝕜 (A →L[𝕜] A) x.fst + mul 𝕜 A x.snd‖ := by rw [norm_def, splitMul_apply, Prod.norm_def, sup_eq_max] /-- This is often the more useful lemma to rewrite the norm as opposed to `Unitization.nnnorm_def`. -/ theorem nnnorm_eq_sup (x : Unitization 𝕜 A) : ‖x‖₊ = ‖x.fst‖₊ ⊔ ‖algebraMap 𝕜 (A →L[𝕜] A) x.fst + mul 𝕜 A x.snd‖₊ := NNReal.eq <| norm_eq_sup x theorem lipschitzWith_addEquiv : LipschitzWith 2 (Unitization.addEquiv 𝕜 A) := by rw [← Real.toNNReal_ofNat] refine AddMonoidHomClass.lipschitz_of_bound (Unitization.addEquiv 𝕜 A) 2 fun x => ?_ rw [norm_eq_sup, Prod.norm_def] refine max_le ?_ ?_ · rw [sup_eq_max, mul_max_of_nonneg _ _ (zero_le_two : (0 : ℝ) ≤ 2)] exact le_max_of_le_left ((le_add_of_nonneg_left (norm_nonneg _)).trans_eq (two_mul _).symm) · nontriviality A rw [two_mul] calc ‖x.snd‖ = ‖mul 𝕜 A x.snd‖ := .symm <| (isometry_mul 𝕜 A).norm_map_of_map_zero (map_zero _) _ _ ≤ ‖algebraMap 𝕜 _ x.fst + mul 𝕜 A x.snd‖ + ‖x.fst‖ := by simpa only [add_comm _ (mul 𝕜 A x.snd), norm_algebraMap'] using norm_le_add_norm_add (mul 𝕜 A x.snd) (algebraMap 𝕜 _ x.fst) _ ≤ _ := add_le_add le_sup_right le_sup_left theorem antilipschitzWith_addEquiv : AntilipschitzWith 2 (addEquiv 𝕜 A) := by refine AddMonoidHomClass.antilipschitz_of_bound (addEquiv 𝕜 A) fun x => ?_ rw [norm_eq_sup, Prod.norm_def, NNReal.coe_two] refine max_le ?_ ?_ · rw [mul_max_of_nonneg _ _ (zero_le_two : (0 : ℝ) ≤ 2)] exact le_max_of_le_left ((le_add_of_nonneg_left (norm_nonneg _)).trans_eq (two_mul _).symm) · nontriviality A calc ‖algebraMap 𝕜 _ x.fst + mul 𝕜 A x.snd‖ ≤ ‖algebraMap 𝕜 _ x.fst‖ + ‖mul 𝕜 A x.snd‖ := norm_add_le _ _ _ = ‖x.fst‖ + ‖x.snd‖ := by rw [norm_algebraMap', (AddMonoidHomClass.isometry_iff_norm (mul 𝕜 A)).mp (isometry_mul 𝕜 A)] _ ≤ _ := (add_le_add (le_max_left _ _) (le_max_right _ _)).trans_eq (two_mul _).symm open Bornology Filter open scoped Uniformity Topology theorem uniformity_eq_aux : 𝓤[instUniformSpaceProd.comap <| addEquiv 𝕜 A] = 𝓤 (Unitization 𝕜 A) := by have key : UniformInducing (addEquiv 𝕜 A) := antilipschitzWith_addEquiv.uniformInducing lipschitzWith_addEquiv.uniformContinuous rw [← key.comap_uniformity] rfl theorem cobounded_eq_aux : @cobounded _ (Bornology.induced <| addEquiv 𝕜 A) = cobounded (Unitization 𝕜 A) := le_antisymm lipschitzWith_addEquiv.comap_cobounded_le antilipschitzWith_addEquiv.tendsto_cobounded.le_comap end Aux /-- The uniformity on `Unitization 𝕜 A` is inherited from `𝕜 × A`. -/ instance instUniformSpace : UniformSpace (Unitization 𝕜 A) := instUniformSpaceProd.comap (addEquiv 𝕜 A) /-- The natural equivalence between `Unitization 𝕜 A` and `𝕜 × A` as a uniform equivalence. -/ def uniformEquivProd : (Unitization 𝕜 A) ≃ᵤ (𝕜 × A) := Equiv.toUniformEquivOfUniformInducing (addEquiv 𝕜 A) ⟨rfl⟩ /-- The bornology on `Unitization 𝕜 A` is inherited from `𝕜 × A`. -/ instance instBornology : Bornology (Unitization 𝕜 A) := Bornology.induced <| addEquiv 𝕜 A theorem uniformEmbedding_addEquiv {𝕜} [NontriviallyNormedField 𝕜] : UniformEmbedding (addEquiv 𝕜 A) where comap_uniformity := rfl inj := (addEquiv 𝕜 A).injective /-- `Unitization 𝕜 A` is complete whenever `𝕜` and `A` are also. -/ instance instCompleteSpace [CompleteSpace 𝕜] [CompleteSpace A] : CompleteSpace (Unitization 𝕜 A) := (completeSpace_congr uniformEmbedding_addEquiv).mpr CompleteSpace.prod /-- Pull back the metric structure from `𝕜 × (A →L[𝕜] A)` to `Unitization 𝕜 A` using the algebra homomorphism `Unitization.splitMul 𝕜 A`, but replace the bornology and the uniformity so that they coincide with `𝕜 × A`. -/ noncomputable instance instMetricSpace : MetricSpace (Unitization 𝕜 A) := (normedRingAux.toMetricSpace.replaceUniformity uniformity_eq_aux).replaceBornology fun s => Filter.ext_iff.1 cobounded_eq_aux (sᶜ) /-- Pull back the normed ring structure from `𝕜 × (A →L[𝕜] A)` to `Unitization 𝕜 A` using the algebra homomorphism `Unitization.splitMul 𝕜 A`. -/ noncomputable instance instNormedRing : NormedRing (Unitization 𝕜 A) where dist_eq := normedRingAux.dist_eq norm_mul := normedRingAux.norm_mul norm := normedRingAux.norm /-- Pull back the normed algebra structure from `𝕜 × (A →L[𝕜] A)` to `Unitization 𝕜 A` using the algebra homomorphism `Unitization.splitMul 𝕜 A`. -/ instance instNormedAlgebra : NormedAlgebra 𝕜 (Unitization 𝕜 A) where norm_smul_le k x := by rw [norm_def, map_smul] -- Note: this used to be `rw [norm_smul, ← norm_def]` before #8386 exact (norm_smul k (splitMul 𝕜 A x)).le instance instNormOneClass : NormOneClass (Unitization 𝕜 A) where norm_one := by simpa only [norm_eq_sup, fst_one, norm_one, snd_one, map_one, map_zero, add_zero, sup_eq_left] using opNorm_le_bound _ zero_le_one fun x => by simp lemma norm_inr (a : A) : ‖(a : Unitization 𝕜 A)‖ = ‖a‖ := by simp [norm_eq_sup] lemma nnnorm_inr (a : A) : ‖(a : Unitization 𝕜 A)‖₊ = ‖a‖₊ := NNReal.eq <| norm_inr a lemma isometry_inr : Isometry ((↑) : A → Unitization 𝕜 A) := AddMonoidHomClass.isometry_of_norm (inrNonUnitalAlgHom 𝕜 A) norm_inr lemma dist_inr (a b : A) : dist (a : Unitization 𝕜 A) (b : Unitization 𝕜 A) = dist a b := isometry_inr.dist_eq a b lemma nndist_inr (a b : A) : nndist (a : Unitization 𝕜 A) (b : Unitization 𝕜 A) = nndist a b := isometry_inr.nndist_eq a b /- These examples verify that the bornology and uniformity (hence also the topology) are the correct ones. -/ example : (instNormedRing (𝕜 := 𝕜) (A := A)).toMetricSpace = instMetricSpace := rfl example : (instMetricSpace (𝕜 := 𝕜) (A := A)).toBornology = instBornology := rfl example : (instMetricSpace (𝕜 := 𝕜) (A := A)).toUniformSpace = instUniformSpace := rfl end Unitization
Analysis\Normed\Algebra\UnitizationL1.lean
/- Copyright (c) 2024 Jireh Loreaux. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Jireh Loreaux -/ import Mathlib.Algebra.Algebra.Unitization import Mathlib.Analysis.Normed.Lp.ProdLp /-! # Unitization equipped with the $L^1$ norm In another file, the `Unitization 𝕜 A` of a non-unital normed `𝕜`-algebra `A` is equipped with the norm inherited as the pullback via a map (closely related to) the left-regular representation of the algebra on itself (see `Unitization.instNormedRing`). However, this construction is only valid (and an isometry) when `A` is a `RegularNormedAlgebra`. Sometimes it is useful to consider the unitization of a non-unital algebra with the $L^1$ norm instead. This file provides that norm on the type synonym `WithLp 1 (Unitization 𝕜 A)`, along with the algebra isomomorphism between `Unitization 𝕜 A` and `WithLp 1 (Unitization 𝕜 A)`. Note that `TrivSqZeroExt` is also equipped with the $L^1$ norm in the analogous way, but it is registered as an instance without the type synonym. One application of this is a straightforward proof that the quasispectrum of an element in a non-unital Banach algebra is compact, which can be established by passing to the unitization. -/ variable (𝕜 A : Type*) [NormedField 𝕜] [NonUnitalNormedRing A] variable [NormedSpace 𝕜 A] namespace WithLp open Unitization /-- The natural map between `Unitization 𝕜 A` and `𝕜 × A`, transferred to their `WithLp 1` synonyms. -/ noncomputable def unitization_addEquiv_prod : WithLp 1 (Unitization 𝕜 A) ≃+ WithLp 1 (𝕜 × A) := (WithLp.linearEquiv 1 𝕜 (Unitization 𝕜 A)).toAddEquiv.trans <| (addEquiv 𝕜 A).trans (WithLp.linearEquiv 1 𝕜 (𝕜 × A)).symm.toAddEquiv noncomputable instance instUnitizationNormedAddCommGroup : NormedAddCommGroup (WithLp 1 (Unitization 𝕜 A)) := NormedAddCommGroup.induced (WithLp 1 (Unitization 𝕜 A)) (WithLp 1 (𝕜 × A)) (unitization_addEquiv_prod 𝕜 A) (AddEquiv.injective _) /-- Bundle `WithLp.unitization_addEquiv_prod` as a `UniformEquiv`. -/ noncomputable def uniformEquiv_unitization_addEquiv_prod : WithLp 1 (Unitization 𝕜 A) ≃ᵤ WithLp 1 (𝕜 × A) := { unitization_addEquiv_prod 𝕜 A with uniformContinuous_invFun := uniformContinuous_comap' uniformContinuous_id uniformContinuous_toFun := uniformContinuous_iff.mpr le_rfl } instance instCompleteSpace [CompleteSpace 𝕜] [CompleteSpace A] : CompleteSpace (WithLp 1 (Unitization 𝕜 A)) := completeSpace_congr (uniformEquiv_unitization_addEquiv_prod 𝕜 A).uniformEmbedding |>.mpr CompleteSpace.prod variable {𝕜 A} open ENNReal in lemma unitization_norm_def (x : WithLp 1 (Unitization 𝕜 A)) : ‖x‖ = ‖(WithLp.equiv 1 _ x).fst‖ + ‖(WithLp.equiv 1 _ x).snd‖ := calc ‖x‖ = (‖(WithLp.equiv 1 _ x).fst‖ ^ (1 : ℝ≥0∞).toReal + ‖(WithLp.equiv 1 _ x).snd‖ ^ (1 : ℝ≥0∞).toReal) ^ (1 / (1 : ℝ≥0∞).toReal) := WithLp.prod_norm_eq_add (by simp : 0 < (1 : ℝ≥0∞).toReal) _ _ = ‖(WithLp.equiv 1 _ x).fst‖ + ‖(WithLp.equiv 1 _ x).snd‖ := by simp lemma unitization_nnnorm_def (x : WithLp 1 (Unitization 𝕜 A)) : ‖x‖₊ = ‖(WithLp.equiv 1 _ x).fst‖₊ + ‖(WithLp.equiv 1 _ x).snd‖₊ := Subtype.ext <| unitization_norm_def x lemma unitization_norm_inr (x : A) : ‖(WithLp.equiv 1 (Unitization 𝕜 A)).symm x‖ = ‖x‖ := by simp [unitization_norm_def] lemma unitization_nnnorm_inr (x : A) : ‖(WithLp.equiv 1 (Unitization 𝕜 A)).symm x‖₊ = ‖x‖₊ := by simp [unitization_nnnorm_def] lemma unitization_isometry_inr : Isometry (fun x : A ↦ (WithLp.equiv 1 (Unitization 𝕜 A)).symm x) := AddMonoidHomClass.isometry_of_norm ((WithLp.linearEquiv 1 𝕜 (Unitization 𝕜 A)).symm.comp <| Unitization.inrHom 𝕜 A) unitization_norm_inr variable [IsScalarTower 𝕜 A A] [SMulCommClass 𝕜 A A] instance instUnitizationRing : Ring (WithLp 1 (Unitization 𝕜 A)) := inferInstanceAs (Ring (Unitization 𝕜 A)) @[simp] lemma unitization_mul (x y : WithLp 1 (Unitization 𝕜 A)) : WithLp.equiv 1 _ (x * y) = (WithLp.equiv 1 _ x) * (WithLp.equiv 1 _ y) := rfl instance {R : Type*} [CommSemiring R] [Algebra R 𝕜] [DistribMulAction R A] [IsScalarTower R 𝕜 A] : Algebra R (WithLp 1 (Unitization 𝕜 A)) := inferInstanceAs (Algebra R (Unitization 𝕜 A)) @[simp] lemma unitization_algebraMap (r : 𝕜) : WithLp.equiv 1 _ (algebraMap 𝕜 (WithLp 1 (Unitization 𝕜 A)) r) = algebraMap 𝕜 (Unitization 𝕜 A) r := rfl /-- `WithLp.equiv` bundled as an algebra isomorphism with `Unitization 𝕜 A`. -/ @[simps!] def unitizationAlgEquiv (R : Type*) [CommSemiring R] [Algebra R 𝕜] [DistribMulAction R A] [IsScalarTower R 𝕜 A] : WithLp 1 (Unitization 𝕜 A) ≃ₐ[R] Unitization 𝕜 A := { WithLp.equiv 1 (Unitization 𝕜 A) with map_mul' := fun _ _ ↦ rfl map_add' := fun _ _ ↦ rfl commutes' := fun _ ↦ rfl } noncomputable instance instUnitizationNormedRing : NormedRing (WithLp 1 (Unitization 𝕜 A)) where dist_eq := dist_eq_norm norm_mul x y := by simp_rw [unitization_norm_def, add_mul, mul_add, unitization_mul, fst_mul, snd_mul] rw [add_assoc, add_assoc] gcongr · exact norm_mul_le _ _ · apply (norm_add_le _ _).trans gcongr · simp [norm_smul] · apply (norm_add_le _ _).trans gcongr · simp [norm_smul, mul_comm] · exact norm_mul_le _ _ noncomputable instance instUnitizationNormedAlgebra : NormedAlgebra 𝕜 (WithLp 1 (Unitization 𝕜 A)) where norm_smul_le r x := by simp_rw [unitization_norm_def, equiv_smul, fst_smul, snd_smul, norm_smul, mul_add] exact le_rfl end WithLp
Analysis\Normed\Field\Basic.lean
/- Copyright (c) 2018 Patrick Massot. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Johannes Hölzl -/ import Mathlib.Algebra.Algebra.NonUnitalSubalgebra import Mathlib.Algebra.Algebra.Subalgebra.Basic import Mathlib.Algebra.Order.Ring.Finset import Mathlib.Analysis.Normed.Group.Bounded import Mathlib.Analysis.Normed.Group.Constructions import Mathlib.Analysis.Normed.Group.Rat import Mathlib.Analysis.Normed.Group.Submodule import Mathlib.Analysis.Normed.Group.Uniform import Mathlib.GroupTheory.OrderOfElement import Mathlib.Topology.Instances.NNReal import Mathlib.Topology.MetricSpace.DilationEquiv /-! # Normed fields In this file we define (semi)normed rings and fields. We also prove some theorems about these definitions. -/ variable {α : Type*} {β : Type*} {γ : Type*} {ι : Type*} open Filter Metric Bornology open scoped Topology NNReal ENNReal uniformity Pointwise /-- A non-unital seminormed ring is a not-necessarily-unital ring endowed with a seminorm which satisfies the inequality `‖x y‖ ≤ ‖x‖ ‖y‖`. -/ class NonUnitalSeminormedRing (α : Type*) extends Norm α, NonUnitalRing α, PseudoMetricSpace α where /-- The distance is induced by the norm. -/ dist_eq : ∀ x y, dist x y = norm (x - y) /-- The norm is submultiplicative. -/ norm_mul : ∀ a b, norm (a * b) ≤ norm a * norm b /-- A seminormed ring is a ring endowed with a seminorm which satisfies the inequality `‖x y‖ ≤ ‖x‖ ‖y‖`. -/ class SeminormedRing (α : Type*) extends Norm α, Ring α, PseudoMetricSpace α where /-- The distance is induced by the norm. -/ dist_eq : ∀ x y, dist x y = norm (x - y) /-- The norm is submultiplicative. -/ norm_mul : ∀ a b, norm (a * b) ≤ norm a * norm b -- see Note [lower instance priority] /-- A seminormed ring is a non-unital seminormed ring. -/ instance (priority := 100) SeminormedRing.toNonUnitalSeminormedRing [β : SeminormedRing α] : NonUnitalSeminormedRing α := { β with } /-- A non-unital normed ring is a not-necessarily-unital ring endowed with a norm which satisfies the inequality `‖x y‖ ≤ ‖x‖ ‖y‖`. -/ class NonUnitalNormedRing (α : Type*) extends Norm α, NonUnitalRing α, MetricSpace α where /-- The distance is induced by the norm. -/ dist_eq : ∀ x y, dist x y = norm (x - y) /-- The norm is submultiplicative. -/ norm_mul : ∀ a b, norm (a * b) ≤ norm a * norm b -- see Note [lower instance priority] /-- A non-unital normed ring is a non-unital seminormed ring. -/ instance (priority := 100) NonUnitalNormedRing.toNonUnitalSeminormedRing [β : NonUnitalNormedRing α] : NonUnitalSeminormedRing α := { β with } /-- A normed ring is a ring endowed with a norm which satisfies the inequality `‖x y‖ ≤ ‖x‖ ‖y‖`. -/ class NormedRing (α : Type*) extends Norm α, Ring α, MetricSpace α where /-- The distance is induced by the norm. -/ dist_eq : ∀ x y, dist x y = norm (x - y) /-- The norm is submultiplicative. -/ norm_mul : ∀ a b, norm (a * b) ≤ norm a * norm b /-- A normed division ring is a division ring endowed with a seminorm which satisfies the equality `‖x y‖ = ‖x‖ ‖y‖`. -/ class NormedDivisionRing (α : Type*) extends Norm α, DivisionRing α, MetricSpace α where /-- The distance is induced by the norm. -/ dist_eq : ∀ x y, dist x y = norm (x - y) /-- The norm is multiplicative. -/ norm_mul' : ∀ a b, norm (a * b) = norm a * norm b -- see Note [lower instance priority] /-- A normed division ring is a normed ring. -/ instance (priority := 100) NormedDivisionRing.toNormedRing [β : NormedDivisionRing α] : NormedRing α := { β with norm_mul := fun a b => (NormedDivisionRing.norm_mul' a b).le } -- see Note [lower instance priority] /-- A normed ring is a seminormed ring. -/ instance (priority := 100) NormedRing.toSeminormedRing [β : NormedRing α] : SeminormedRing α := { β with } -- see Note [lower instance priority] /-- A normed ring is a non-unital normed ring. -/ instance (priority := 100) NormedRing.toNonUnitalNormedRing [β : NormedRing α] : NonUnitalNormedRing α := { β with } /-- A non-unital seminormed commutative ring is a non-unital commutative ring endowed with a seminorm which satisfies the inequality `‖x y‖ ≤ ‖x‖ ‖y‖`. -/ class NonUnitalSeminormedCommRing (α : Type*) extends NonUnitalSeminormedRing α where /-- Multiplication is commutative. -/ mul_comm : ∀ x y : α, x * y = y * x /-- A non-unital normed commutative ring is a non-unital commutative ring endowed with a norm which satisfies the inequality `‖x y‖ ≤ ‖x‖ ‖y‖`. -/ class NonUnitalNormedCommRing (α : Type*) extends NonUnitalNormedRing α where /-- Multiplication is commutative. -/ mul_comm : ∀ x y : α, x * y = y * x -- see Note [lower instance priority] /-- A non-unital normed commutative ring is a non-unital seminormed commutative ring. -/ instance (priority := 100) NonUnitalNormedCommRing.toNonUnitalSeminormedCommRing [β : NonUnitalNormedCommRing α] : NonUnitalSeminormedCommRing α := { β with } /-- A seminormed commutative ring is a commutative ring endowed with a seminorm which satisfies the inequality `‖x y‖ ≤ ‖x‖ ‖y‖`. -/ class SeminormedCommRing (α : Type*) extends SeminormedRing α where /-- Multiplication is commutative. -/ mul_comm : ∀ x y : α, x * y = y * x /-- A normed commutative ring is a commutative ring endowed with a norm which satisfies the inequality `‖x y‖ ≤ ‖x‖ ‖y‖`. -/ class NormedCommRing (α : Type*) extends NormedRing α where /-- Multiplication is commutative. -/ mul_comm : ∀ x y : α, x * y = y * x -- see Note [lower instance priority] /-- A seminormed commutative ring is a non-unital seminormed commutative ring. -/ instance (priority := 100) SeminormedCommRing.toNonUnitalSeminormedCommRing [β : SeminormedCommRing α] : NonUnitalSeminormedCommRing α := { β with } -- see Note [lower instance priority] /-- A normed commutative ring is a non-unital normed commutative ring. -/ instance (priority := 100) NormedCommRing.toNonUnitalNormedCommRing [β : NormedCommRing α] : NonUnitalNormedCommRing α := { β with } -- see Note [lower instance priority] /-- A normed commutative ring is a seminormed commutative ring. -/ instance (priority := 100) NormedCommRing.toSeminormedCommRing [β : NormedCommRing α] : SeminormedCommRing α := { β with } instance PUnit.normedCommRing : NormedCommRing PUnit := { PUnit.normedAddCommGroup, PUnit.commRing with norm_mul := fun _ _ => by simp } /-- A mixin class with the axiom `‖1‖ = 1`. Many `NormedRing`s and all `NormedField`s satisfy this axiom. -/ class NormOneClass (α : Type*) [Norm α] [One α] : Prop where /-- The norm of the multiplicative identity is 1. -/ norm_one : ‖(1 : α)‖ = 1 export NormOneClass (norm_one) attribute [simp] norm_one @[simp] theorem nnnorm_one [SeminormedAddCommGroup α] [One α] [NormOneClass α] : ‖(1 : α)‖₊ = 1 := NNReal.eq norm_one theorem NormOneClass.nontrivial (α : Type*) [SeminormedAddCommGroup α] [One α] [NormOneClass α] : Nontrivial α := nontrivial_of_ne 0 1 <| ne_of_apply_ne norm <| by simp -- see Note [lower instance priority] instance (priority := 100) NonUnitalSeminormedCommRing.toNonUnitalCommRing [β : NonUnitalSeminormedCommRing α] : NonUnitalCommRing α := { β with } -- see Note [lower instance priority] instance (priority := 100) SeminormedCommRing.toCommRing [β : SeminormedCommRing α] : CommRing α := { β with } -- see Note [lower instance priority] instance (priority := 100) NonUnitalNormedRing.toNormedAddCommGroup [β : NonUnitalNormedRing α] : NormedAddCommGroup α := { β with } -- see Note [lower instance priority] instance (priority := 100) NonUnitalSeminormedRing.toSeminormedAddCommGroup [NonUnitalSeminormedRing α] : SeminormedAddCommGroup α := { ‹NonUnitalSeminormedRing α› with } instance ULift.normOneClass [SeminormedAddCommGroup α] [One α] [NormOneClass α] : NormOneClass (ULift α) := ⟨by simp [ULift.norm_def]⟩ instance Prod.normOneClass [SeminormedAddCommGroup α] [One α] [NormOneClass α] [SeminormedAddCommGroup β] [One β] [NormOneClass β] : NormOneClass (α × β) := ⟨by simp [Prod.norm_def]⟩ instance Pi.normOneClass {ι : Type*} {α : ι → Type*} [Nonempty ι] [Fintype ι] [∀ i, SeminormedAddCommGroup (α i)] [∀ i, One (α i)] [∀ i, NormOneClass (α i)] : NormOneClass (∀ i, α i) := ⟨by simpa [Pi.norm_def] using Finset.sup_const Finset.univ_nonempty 1⟩ instance MulOpposite.normOneClass [SeminormedAddCommGroup α] [One α] [NormOneClass α] : NormOneClass αᵐᵒᵖ := ⟨@norm_one α _ _ _⟩ section NonUnitalSeminormedRing variable [NonUnitalSeminormedRing α] theorem norm_mul_le (a b : α) : ‖a * b‖ ≤ ‖a‖ * ‖b‖ := NonUnitalSeminormedRing.norm_mul _ _ theorem nnnorm_mul_le (a b : α) : ‖a * b‖₊ ≤ ‖a‖₊ * ‖b‖₊ := by simpa only [← norm_toNNReal, ← Real.toNNReal_mul (norm_nonneg _)] using Real.toNNReal_mono (norm_mul_le _ _) theorem one_le_norm_one (β) [NormedRing β] [Nontrivial β] : 1 ≤ ‖(1 : β)‖ := (le_mul_iff_one_le_left <| norm_pos_iff.mpr (one_ne_zero : (1 : β) ≠ 0)).mp (by simpa only [mul_one] using norm_mul_le (1 : β) 1) theorem one_le_nnnorm_one (β) [NormedRing β] [Nontrivial β] : 1 ≤ ‖(1 : β)‖₊ := one_le_norm_one β theorem Filter.Tendsto.zero_mul_isBoundedUnder_le {f g : ι → α} {l : Filter ι} (hf : Tendsto f l (𝓝 0)) (hg : IsBoundedUnder (· ≤ ·) l ((‖·‖) ∘ g)) : Tendsto (fun x => f x * g x) l (𝓝 0) := hf.op_zero_isBoundedUnder_le hg (· * ·) norm_mul_le theorem Filter.isBoundedUnder_le_mul_tendsto_zero {f g : ι → α} {l : Filter ι} (hf : IsBoundedUnder (· ≤ ·) l (norm ∘ f)) (hg : Tendsto g l (𝓝 0)) : Tendsto (fun x => f x * g x) l (𝓝 0) := hg.op_zero_isBoundedUnder_le hf (flip (· * ·)) fun x y => (norm_mul_le y x).trans_eq (mul_comm _ _) /-- In a seminormed ring, the left-multiplication `AddMonoidHom` is bounded. -/ theorem mulLeft_bound (x : α) : ∀ y : α, ‖AddMonoidHom.mulLeft x y‖ ≤ ‖x‖ * ‖y‖ := norm_mul_le x /-- In a seminormed ring, the right-multiplication `AddMonoidHom` is bounded. -/ theorem mulRight_bound (x : α) : ∀ y : α, ‖AddMonoidHom.mulRight x y‖ ≤ ‖x‖ * ‖y‖ := fun y => by rw [mul_comm] exact norm_mul_le y x /-- A non-unital subalgebra of a non-unital seminormed ring is also a non-unital seminormed ring, with the restriction of the norm. -/ instance NonUnitalSubalgebra.nonUnitalSeminormedRing {𝕜 : Type*} [CommRing 𝕜] {E : Type*} [NonUnitalSeminormedRing E] [Module 𝕜 E] (s : NonUnitalSubalgebra 𝕜 E) : NonUnitalSeminormedRing s := { s.toSubmodule.seminormedAddCommGroup, s.toNonUnitalRing with norm_mul := fun a b => norm_mul_le a.1 b.1 } /-- A non-unital subalgebra of a non-unital seminormed ring is also a non-unital seminormed ring, with the restriction of the norm. -/ -- necessary to require `SMulMemClass S 𝕜 E` so that `𝕜` can be determined as an `outParam` @[nolint unusedArguments] instance (priority := 75) NonUnitalSubalgebraClass.nonUnitalSeminormedRing {S 𝕜 E : Type*} [CommRing 𝕜] [NonUnitalSeminormedRing E] [Module 𝕜 E] [SetLike S E] [NonUnitalSubringClass S E] [SMulMemClass S 𝕜 E] (s : S) : NonUnitalSeminormedRing s := { AddSubgroupClass.seminormedAddCommGroup s, NonUnitalSubringClass.toNonUnitalRing s with norm_mul := fun a b => norm_mul_le a.1 b.1 } /-- A non-unital subalgebra of a non-unital normed ring is also a non-unital normed ring, with the restriction of the norm. -/ instance NonUnitalSubalgebra.nonUnitalNormedRing {𝕜 : Type*} [CommRing 𝕜] {E : Type*} [NonUnitalNormedRing E] [Module 𝕜 E] (s : NonUnitalSubalgebra 𝕜 E) : NonUnitalNormedRing s := { s.nonUnitalSeminormedRing with eq_of_dist_eq_zero := eq_of_dist_eq_zero } /-- A non-unital subalgebra of a non-unital normed ring is also a non-unital normed ring, with the restriction of the norm. -/ instance (priority := 75) NonUnitalSubalgebraClass.nonUnitalNormedRing {S 𝕜 E : Type*} [CommRing 𝕜] [NonUnitalNormedRing E] [Module 𝕜 E] [SetLike S E] [NonUnitalSubringClass S E] [SMulMemClass S 𝕜 E] (s : S) : NonUnitalNormedRing s := { nonUnitalSeminormedRing s with eq_of_dist_eq_zero := eq_of_dist_eq_zero } instance ULift.nonUnitalSeminormedRing : NonUnitalSeminormedRing (ULift α) := { ULift.seminormedAddCommGroup, ULift.nonUnitalRing with norm_mul := fun x y => (norm_mul_le x.down y.down : _) } /-- Non-unital seminormed ring structure on the product of two non-unital seminormed rings, using the sup norm. -/ instance Prod.nonUnitalSeminormedRing [NonUnitalSeminormedRing β] : NonUnitalSeminormedRing (α × β) := { seminormedAddCommGroup, instNonUnitalRing with norm_mul := fun x y => calc ‖x * y‖ = ‖(x.1 * y.1, x.2 * y.2)‖ := rfl _ = max ‖x.1 * y.1‖ ‖x.2 * y.2‖ := rfl _ ≤ max (‖x.1‖ * ‖y.1‖) (‖x.2‖ * ‖y.2‖) := (max_le_max (norm_mul_le x.1 y.1) (norm_mul_le x.2 y.2)) _ = max (‖x.1‖ * ‖y.1‖) (‖y.2‖ * ‖x.2‖) := by simp [mul_comm] _ ≤ max ‖x.1‖ ‖x.2‖ * max ‖y.2‖ ‖y.1‖ := by apply max_mul_mul_le_max_mul_max <;> simp [norm_nonneg] _ = max ‖x.1‖ ‖x.2‖ * max ‖y.1‖ ‖y.2‖ := by simp [max_comm] _ = ‖x‖ * ‖y‖ := rfl } /-- Non-unital seminormed ring structure on the product of finitely many non-unital seminormed rings, using the sup norm. -/ instance Pi.nonUnitalSeminormedRing {π : ι → Type*} [Fintype ι] [∀ i, NonUnitalSeminormedRing (π i)] : NonUnitalSeminormedRing (∀ i, π i) := { Pi.seminormedAddCommGroup, Pi.nonUnitalRing with norm_mul := fun x y => NNReal.coe_mono <| calc (Finset.univ.sup fun i => ‖x i * y i‖₊) ≤ Finset.univ.sup ((fun i => ‖x i‖₊) * fun i => ‖y i‖₊) := Finset.sup_mono_fun fun _ _ => norm_mul_le _ _ _ ≤ (Finset.univ.sup fun i => ‖x i‖₊) * Finset.univ.sup fun i => ‖y i‖₊ := Finset.sup_mul_le_mul_sup_of_nonneg _ (fun _ _ => zero_le _) fun _ _ => zero_le _ } instance MulOpposite.instNonUnitalSeminormedRing : NonUnitalSeminormedRing αᵐᵒᵖ where __ := instNonUnitalRing __ := instSeminormedAddCommGroup norm_mul := MulOpposite.rec' fun x ↦ MulOpposite.rec' fun y ↦ (norm_mul_le y x).trans_eq (mul_comm _ _) end NonUnitalSeminormedRing section SeminormedRing variable [SeminormedRing α] /-- A subalgebra of a seminormed ring is also a seminormed ring, with the restriction of the norm. -/ instance Subalgebra.seminormedRing {𝕜 : Type*} [CommRing 𝕜] {E : Type*} [SeminormedRing E] [Algebra 𝕜 E] (s : Subalgebra 𝕜 E) : SeminormedRing s := { s.toSubmodule.seminormedAddCommGroup, s.toRing with norm_mul := fun a b => norm_mul_le a.1 b.1 } /-- A subalgebra of a seminormed ring is also a seminormed ring, with the restriction of the norm. -/ -- necessary to require `SMulMemClass S 𝕜 E` so that `𝕜` can be determined as an `outParam` @[nolint unusedArguments] instance (priority := 75) SubalgebraClass.seminormedRing {S 𝕜 E : Type*} [CommRing 𝕜] [SeminormedRing E] [Algebra 𝕜 E] [SetLike S E] [SubringClass S E] [SMulMemClass S 𝕜 E] (s : S) : SeminormedRing s := { AddSubgroupClass.seminormedAddCommGroup s, SubringClass.toRing s with norm_mul := fun a b => norm_mul_le a.1 b.1 } /-- A subalgebra of a normed ring is also a normed ring, with the restriction of the norm. -/ instance Subalgebra.normedRing {𝕜 : Type*} [CommRing 𝕜] {E : Type*} [NormedRing E] [Algebra 𝕜 E] (s : Subalgebra 𝕜 E) : NormedRing s := { s.seminormedRing with eq_of_dist_eq_zero := eq_of_dist_eq_zero } /-- A subalgebra of a normed ring is also a normed ring, with the restriction of the norm. -/ instance (priority := 75) SubalgebraClass.normedRing {S 𝕜 E : Type*} [CommRing 𝕜] [NormedRing E] [Algebra 𝕜 E] [SetLike S E] [SubringClass S E] [SMulMemClass S 𝕜 E] (s : S) : NormedRing s := { seminormedRing s with eq_of_dist_eq_zero := eq_of_dist_eq_zero } theorem Nat.norm_cast_le : ∀ n : ℕ, ‖(n : α)‖ ≤ n * ‖(1 : α)‖ | 0 => by simp | n + 1 => by rw [n.cast_succ, n.cast_succ, add_mul, one_mul] exact norm_add_le_of_le (Nat.norm_cast_le n) le_rfl theorem List.norm_prod_le' : ∀ {l : List α}, l ≠ [] → ‖l.prod‖ ≤ (l.map norm).prod | [], h => (h rfl).elim | [a], _ => by simp | a::b::l, _ => by rw [List.map_cons, List.prod_cons, @List.prod_cons _ _ _ ‖a‖] refine le_trans (norm_mul_le _ _) (mul_le_mul_of_nonneg_left ?_ (norm_nonneg _)) exact List.norm_prod_le' (List.cons_ne_nil b l) theorem List.nnnorm_prod_le' {l : List α} (hl : l ≠ []) : ‖l.prod‖₊ ≤ (l.map nnnorm).prod := (List.norm_prod_le' hl).trans_eq <| by simp [NNReal.coe_list_prod, List.map_map] theorem List.norm_prod_le [NormOneClass α] : ∀ l : List α, ‖l.prod‖ ≤ (l.map norm).prod | [] => by simp | a::l => List.norm_prod_le' (List.cons_ne_nil a l) theorem List.nnnorm_prod_le [NormOneClass α] (l : List α) : ‖l.prod‖₊ ≤ (l.map nnnorm).prod := l.norm_prod_le.trans_eq <| by simp [NNReal.coe_list_prod, List.map_map] theorem Finset.norm_prod_le' {α : Type*} [NormedCommRing α] (s : Finset ι) (hs : s.Nonempty) (f : ι → α) : ‖∏ i ∈ s, f i‖ ≤ ∏ i ∈ s, ‖f i‖ := by rcases s with ⟨⟨l⟩, hl⟩ have : l.map f ≠ [] := by simpa using hs simpa using List.norm_prod_le' this theorem Finset.nnnorm_prod_le' {α : Type*} [NormedCommRing α] (s : Finset ι) (hs : s.Nonempty) (f : ι → α) : ‖∏ i ∈ s, f i‖₊ ≤ ∏ i ∈ s, ‖f i‖₊ := (s.norm_prod_le' hs f).trans_eq <| by simp [NNReal.coe_prod] theorem Finset.norm_prod_le {α : Type*} [NormedCommRing α] [NormOneClass α] (s : Finset ι) (f : ι → α) : ‖∏ i ∈ s, f i‖ ≤ ∏ i ∈ s, ‖f i‖ := by rcases s with ⟨⟨l⟩, hl⟩ simpa using (l.map f).norm_prod_le theorem Finset.nnnorm_prod_le {α : Type*} [NormedCommRing α] [NormOneClass α] (s : Finset ι) (f : ι → α) : ‖∏ i ∈ s, f i‖₊ ≤ ∏ i ∈ s, ‖f i‖₊ := (s.norm_prod_le f).trans_eq <| by simp [NNReal.coe_prod] /-- If `α` is a seminormed ring, then `‖a ^ n‖₊ ≤ ‖a‖₊ ^ n` for `n > 0`. See also `nnnorm_pow_le`. -/ theorem nnnorm_pow_le' (a : α) : ∀ {n : ℕ}, 0 < n → ‖a ^ n‖₊ ≤ ‖a‖₊ ^ n | 1, _ => by simp only [pow_one, le_rfl] | n + 2, _ => by simpa only [pow_succ' _ (n + 1)] using le_trans (nnnorm_mul_le _ _) (mul_le_mul_left' (nnnorm_pow_le' a n.succ_pos) _) /-- If `α` is a seminormed ring with `‖1‖₊ = 1`, then `‖a ^ n‖₊ ≤ ‖a‖₊ ^ n`. See also `nnnorm_pow_le'`. -/ theorem nnnorm_pow_le [NormOneClass α] (a : α) (n : ℕ) : ‖a ^ n‖₊ ≤ ‖a‖₊ ^ n := Nat.recOn n (by simp only [Nat.zero_eq, pow_zero, nnnorm_one, le_rfl]) fun k _hk => nnnorm_pow_le' a k.succ_pos /-- If `α` is a seminormed ring, then `‖a ^ n‖ ≤ ‖a‖ ^ n` for `n > 0`. See also `norm_pow_le`. -/ theorem norm_pow_le' (a : α) {n : ℕ} (h : 0 < n) : ‖a ^ n‖ ≤ ‖a‖ ^ n := by simpa only [NNReal.coe_pow, coe_nnnorm] using NNReal.coe_mono (nnnorm_pow_le' a h) /-- If `α` is a seminormed ring with `‖1‖ = 1`, then `‖a ^ n‖ ≤ ‖a‖ ^ n`. See also `norm_pow_le'`. -/ theorem norm_pow_le [NormOneClass α] (a : α) (n : ℕ) : ‖a ^ n‖ ≤ ‖a‖ ^ n := Nat.recOn n (by simp only [Nat.zero_eq, pow_zero, norm_one, le_rfl]) fun n _hn => norm_pow_le' a n.succ_pos theorem eventually_norm_pow_le (a : α) : ∀ᶠ n : ℕ in atTop, ‖a ^ n‖ ≤ ‖a‖ ^ n := eventually_atTop.mpr ⟨1, fun _b h => norm_pow_le' a (Nat.succ_le_iff.mp h)⟩ instance ULift.seminormedRing : SeminormedRing (ULift α) := { ULift.nonUnitalSeminormedRing, ULift.ring with } /-- Seminormed ring structure on the product of two seminormed rings, using the sup norm. -/ instance Prod.seminormedRing [SeminormedRing β] : SeminormedRing (α × β) := { nonUnitalSeminormedRing, instRing with } /-- Seminormed ring structure on the product of finitely many seminormed rings, using the sup norm. -/ instance Pi.seminormedRing {π : ι → Type*} [Fintype ι] [∀ i, SeminormedRing (π i)] : SeminormedRing (∀ i, π i) := { Pi.nonUnitalSeminormedRing, Pi.ring with } instance MulOpposite.instSeminormedRing : SeminormedRing αᵐᵒᵖ where __ := instRing __ := instNonUnitalSeminormedRing end SeminormedRing section NonUnitalNormedRing variable [NonUnitalNormedRing α] instance ULift.nonUnitalNormedRing : NonUnitalNormedRing (ULift α) := { ULift.nonUnitalSeminormedRing, ULift.normedAddCommGroup with } /-- Non-unital normed ring structure on the product of two non-unital normed rings, using the sup norm. -/ instance Prod.nonUnitalNormedRing [NonUnitalNormedRing β] : NonUnitalNormedRing (α × β) := { Prod.nonUnitalSeminormedRing, Prod.normedAddCommGroup with } /-- Normed ring structure on the product of finitely many non-unital normed rings, using the sup norm. -/ instance Pi.nonUnitalNormedRing {π : ι → Type*} [Fintype ι] [∀ i, NonUnitalNormedRing (π i)] : NonUnitalNormedRing (∀ i, π i) := { Pi.nonUnitalSeminormedRing, Pi.normedAddCommGroup with } instance MulOpposite.instNonUnitalNormedRing : NonUnitalNormedRing αᵐᵒᵖ where __ := instNonUnitalRing __ := instNonUnitalSeminormedRing __ := instNormedAddCommGroup end NonUnitalNormedRing section NormedRing variable [NormedRing α] theorem Units.norm_pos [Nontrivial α] (x : αˣ) : 0 < ‖(x : α)‖ := norm_pos_iff.mpr (Units.ne_zero x) theorem Units.nnnorm_pos [Nontrivial α] (x : αˣ) : 0 < ‖(x : α)‖₊ := x.norm_pos instance ULift.normedRing : NormedRing (ULift α) := { ULift.seminormedRing, ULift.normedAddCommGroup with } /-- Normed ring structure on the product of two normed rings, using the sup norm. -/ instance Prod.normedRing [NormedRing β] : NormedRing (α × β) := { nonUnitalNormedRing, instRing with } /-- Normed ring structure on the product of finitely many normed rings, using the sup norm. -/ instance Pi.normedRing {π : ι → Type*} [Fintype ι] [∀ i, NormedRing (π i)] : NormedRing (∀ i, π i) := { Pi.seminormedRing, Pi.normedAddCommGroup with } instance MulOpposite.instNormedRing : NormedRing αᵐᵒᵖ where __ := instRing __ := instSeminormedRing __ := instNormedAddCommGroup end NormedRing section NonUnitalSeminormedCommRing variable [NonUnitalSeminormedCommRing α] instance ULift.nonUnitalSeminormedCommRing : NonUnitalSeminormedCommRing (ULift α) := { ULift.nonUnitalSeminormedRing, ULift.nonUnitalCommRing with } /-- Non-unital seminormed commutative ring structure on the product of two non-unital seminormed commutative rings, using the sup norm. -/ instance Prod.nonUnitalSeminormedCommRing [NonUnitalSeminormedCommRing β] : NonUnitalSeminormedCommRing (α × β) := { nonUnitalSeminormedRing, instNonUnitalCommRing with } /-- Non-unital seminormed commutative ring structure on the product of finitely many non-unital seminormed commutative rings, using the sup norm. -/ instance Pi.nonUnitalSeminormedCommRing {π : ι → Type*} [Fintype ι] [∀ i, NonUnitalSeminormedCommRing (π i)] : NonUnitalSeminormedCommRing (∀ i, π i) := { Pi.nonUnitalSeminormedRing, Pi.nonUnitalCommRing with } instance MulOpposite.instNonUnitalSeminormedCommRing : NonUnitalSeminormedCommRing αᵐᵒᵖ where __ := instNonUnitalSeminormedRing __ := instNonUnitalCommRing end NonUnitalSeminormedCommRing section NonUnitalNormedCommRing variable [NonUnitalNormedCommRing α] /-- A non-unital subalgebra of a non-unital seminormed commutative ring is also a non-unital seminormed commutative ring, with the restriction of the norm. -/ instance NonUnitalSubalgebra.nonUnitalSeminormedCommRing {𝕜 : Type*} [CommRing 𝕜] {E : Type*} [NonUnitalSeminormedCommRing E] [Module 𝕜 E] (s : NonUnitalSubalgebra 𝕜 E) : NonUnitalSeminormedCommRing s := { s.nonUnitalSeminormedRing, s.toNonUnitalCommRing with } /-- A non-unital subalgebra of a non-unital normed commutative ring is also a non-unital normed commutative ring, with the restriction of the norm. -/ instance NonUnitalSubalgebra.nonUnitalNormedCommRing {𝕜 : Type*} [CommRing 𝕜] {E : Type*} [NonUnitalNormedCommRing E] [Module 𝕜 E] (s : NonUnitalSubalgebra 𝕜 E) : NonUnitalNormedCommRing s := { s.nonUnitalSeminormedCommRing, s.nonUnitalNormedRing with } instance ULift.nonUnitalNormedCommRing : NonUnitalNormedCommRing (ULift α) := { ULift.nonUnitalSeminormedCommRing, ULift.normedAddCommGroup with } /-- Non-unital normed commutative ring structure on the product of two non-unital normed commutative rings, using the sup norm. -/ instance Prod.nonUnitalNormedCommRing [NonUnitalNormedCommRing β] : NonUnitalNormedCommRing (α × β) := { Prod.nonUnitalSeminormedCommRing, Prod.normedAddCommGroup with } /-- Normed commutative ring structure on the product of finitely many non-unital normed commutative rings, using the sup norm. -/ instance Pi.nonUnitalNormedCommRing {π : ι → Type*} [Fintype ι] [∀ i, NonUnitalNormedCommRing (π i)] : NonUnitalNormedCommRing (∀ i, π i) := { Pi.nonUnitalSeminormedCommRing, Pi.normedAddCommGroup with } instance MulOpposite.instNonUnitalNormedCommRing : NonUnitalNormedCommRing αᵐᵒᵖ where __ := instNonUnitalNormedRing __ := instNonUnitalSeminormedCommRing end NonUnitalNormedCommRing section SeminormedCommRing variable [SeminormedCommRing α] instance ULift.seminormedCommRing : SeminormedCommRing (ULift α) := { ULift.nonUnitalSeminormedRing, ULift.commRing with } /-- Seminormed commutative ring structure on the product of two seminormed commutative rings, using the sup norm. -/ instance Prod.seminormedCommRing [SeminormedCommRing β] : SeminormedCommRing (α × β) := { Prod.nonUnitalSeminormedCommRing, instCommRing with } /-- Seminormed commutative ring structure on the product of finitely many seminormed commutative rings, using the sup norm. -/ instance Pi.seminormedCommRing {π : ι → Type*} [Fintype ι] [∀ i, SeminormedCommRing (π i)] : SeminormedCommRing (∀ i, π i) := { Pi.nonUnitalSeminormedCommRing, Pi.ring with } instance MulOpposite.instSeminormedCommRing : SeminormedCommRing αᵐᵒᵖ where __ := instSeminormedRing __ := instNonUnitalSeminormedCommRing end SeminormedCommRing section NormedCommRing /-- A subalgebra of a seminormed commutative ring is also a seminormed commutative ring, with the restriction of the norm. -/ instance Subalgebra.seminormedCommRing {𝕜 : Type*} [CommRing 𝕜] {E : Type*} [SeminormedCommRing E] [Algebra 𝕜 E] (s : Subalgebra 𝕜 E) : SeminormedCommRing s := { s.seminormedRing, s.toCommRing with } /-- A subalgebra of a normed commutative ring is also a normed commutative ring, with the restriction of the norm. -/ instance Subalgebra.normedCommRing {𝕜 : Type*} [CommRing 𝕜] {E : Type*} [NormedCommRing E] [Algebra 𝕜 E] (s : Subalgebra 𝕜 E) : NormedCommRing s := { s.seminormedCommRing, s.normedRing with } variable [NormedCommRing α] instance ULift.normedCommRing : NormedCommRing (ULift α) := { ULift.normedRing (α := α), ULift.seminormedCommRing with } /-- Normed commutative ring structure on the product of two normed commutative rings, using the sup norm. -/ instance Prod.normedCommRing [NormedCommRing β] : NormedCommRing (α × β) := { nonUnitalNormedRing, instCommRing with } /-- Normed commutative ring structure on the product of finitely many normed commutative rings, using the sup norm. -/ instance Pi.normedCommutativeRing {π : ι → Type*} [Fintype ι] [∀ i, NormedCommRing (π i)] : NormedCommRing (∀ i, π i) := { Pi.seminormedCommRing, Pi.normedAddCommGroup with } instance MulOpposite.instNormedCommRing : NormedCommRing αᵐᵒᵖ where __ := instNormedRing __ := instSeminormedCommRing end NormedCommRing -- see Note [lower instance priority] instance (priority := 100) semi_normed_ring_top_monoid [NonUnitalSeminormedRing α] : ContinuousMul α := ⟨continuous_iff_continuousAt.2 fun x => tendsto_iff_norm_sub_tendsto_zero.2 <| by have : ∀ e : α × α, ‖e.1 * e.2 - x.1 * x.2‖ ≤ ‖e.1‖ * ‖e.2 - x.2‖ + ‖e.1 - x.1‖ * ‖x.2‖ := by intro e calc ‖e.1 * e.2 - x.1 * x.2‖ ≤ ‖e.1 * (e.2 - x.2) + (e.1 - x.1) * x.2‖ := by rw [_root_.mul_sub, _root_.sub_mul, sub_add_sub_cancel] -- Porting note: `ENNReal.{mul_sub, sub_mul}` should be protected _ ≤ ‖e.1‖ * ‖e.2 - x.2‖ + ‖e.1 - x.1‖ * ‖x.2‖ := norm_add_le_of_le (norm_mul_le _ _) (norm_mul_le _ _) refine squeeze_zero (fun e => norm_nonneg _) this ?_ convert ((continuous_fst.tendsto x).norm.mul ((continuous_snd.tendsto x).sub tendsto_const_nhds).norm).add (((continuous_fst.tendsto x).sub tendsto_const_nhds).norm.mul _) -- Porting note: `show` used to select a goal to work on rotate_right · show Tendsto _ _ _ exact tendsto_const_nhds · simp⟩ -- see Note [lower instance priority] /-- A seminormed ring is a topological ring. -/ instance (priority := 100) semi_normed_top_ring [NonUnitalSeminormedRing α] : TopologicalRing α where section NormedDivisionRing variable [NormedDivisionRing α] {a : α} @[simp] theorem norm_mul (a b : α) : ‖a * b‖ = ‖a‖ * ‖b‖ := NormedDivisionRing.norm_mul' a b instance (priority := 900) NormedDivisionRing.to_normOneClass : NormOneClass α := ⟨mul_left_cancel₀ (mt norm_eq_zero.1 (one_ne_zero' α)) <| by rw [← norm_mul, mul_one, mul_one]⟩ instance isAbsoluteValue_norm : IsAbsoluteValue (norm : α → ℝ) where abv_nonneg' := norm_nonneg abv_eq_zero' := norm_eq_zero abv_add' := norm_add_le abv_mul' := norm_mul @[simp] theorem nnnorm_mul (a b : α) : ‖a * b‖₊ = ‖a‖₊ * ‖b‖₊ := NNReal.eq <| norm_mul a b /-- `norm` as a `MonoidWithZeroHom`. -/ @[simps] def normHom : α →*₀ ℝ where toFun := (‖·‖) map_zero' := norm_zero map_one' := norm_one map_mul' := norm_mul /-- `nnnorm` as a `MonoidWithZeroHom`. -/ @[simps] def nnnormHom : α →*₀ ℝ≥0 where toFun := (‖·‖₊) map_zero' := nnnorm_zero map_one' := nnnorm_one map_mul' := nnnorm_mul @[simp] theorem norm_pow (a : α) : ∀ n : ℕ, ‖a ^ n‖ = ‖a‖ ^ n := (normHom.toMonoidHom : α →* ℝ).map_pow a @[simp] theorem nnnorm_pow (a : α) (n : ℕ) : ‖a ^ n‖₊ = ‖a‖₊ ^ n := (nnnormHom.toMonoidHom : α →* ℝ≥0).map_pow a n protected theorem List.norm_prod (l : List α) : ‖l.prod‖ = (l.map norm).prod := map_list_prod (normHom.toMonoidHom : α →* ℝ) _ protected theorem List.nnnorm_prod (l : List α) : ‖l.prod‖₊ = (l.map nnnorm).prod := map_list_prod (nnnormHom.toMonoidHom : α →* ℝ≥0) _ @[simp] theorem norm_div (a b : α) : ‖a / b‖ = ‖a‖ / ‖b‖ := map_div₀ (normHom : α →*₀ ℝ) a b @[simp] theorem nnnorm_div (a b : α) : ‖a / b‖₊ = ‖a‖₊ / ‖b‖₊ := map_div₀ (nnnormHom : α →*₀ ℝ≥0) a b @[simp] theorem norm_inv (a : α) : ‖a⁻¹‖ = ‖a‖⁻¹ := map_inv₀ (normHom : α →*₀ ℝ) a @[simp] theorem nnnorm_inv (a : α) : ‖a⁻¹‖₊ = ‖a‖₊⁻¹ := NNReal.eq <| by simp @[simp] theorem norm_zpow : ∀ (a : α) (n : ℤ), ‖a ^ n‖ = ‖a‖ ^ n := map_zpow₀ (normHom : α →*₀ ℝ) @[simp] theorem nnnorm_zpow : ∀ (a : α) (n : ℤ), ‖a ^ n‖₊ = ‖a‖₊ ^ n := map_zpow₀ (nnnormHom : α →*₀ ℝ≥0) theorem dist_inv_inv₀ {z w : α} (hz : z ≠ 0) (hw : w ≠ 0) : dist z⁻¹ w⁻¹ = dist z w / (‖z‖ * ‖w‖) := by rw [dist_eq_norm, inv_sub_inv' hz hw, norm_mul, norm_mul, norm_inv, norm_inv, mul_comm ‖z‖⁻¹, mul_assoc, dist_eq_norm', div_eq_mul_inv, mul_inv] theorem nndist_inv_inv₀ {z w : α} (hz : z ≠ 0) (hw : w ≠ 0) : nndist z⁻¹ w⁻¹ = nndist z w / (‖z‖₊ * ‖w‖₊) := NNReal.eq <| dist_inv_inv₀ hz hw lemma antilipschitzWith_mul_left {a : α} (ha : a ≠ 0) : AntilipschitzWith (‖a‖₊⁻¹) (a * ·) := AntilipschitzWith.of_le_mul_dist fun _ _ ↦ by simp [dist_eq_norm, ← _root_.mul_sub, ha] lemma antilipschitzWith_mul_right {a : α} (ha : a ≠ 0) : AntilipschitzWith (‖a‖₊⁻¹) (· * a) := AntilipschitzWith.of_le_mul_dist fun _ _ ↦ by simp [dist_eq_norm, ← _root_.sub_mul, ← mul_comm (‖a‖), ha] /-- Multiplication by a nonzero element `a` on the left as a `DilationEquiv` of a normed division ring. -/ @[simps!] def DilationEquiv.mulLeft (a : α) (ha : a ≠ 0) : α ≃ᵈ α where toEquiv := Equiv.mulLeft₀ a ha edist_eq' := ⟨‖a‖₊, nnnorm_ne_zero_iff.2 ha, fun x y ↦ by simp [edist_nndist, nndist_eq_nnnorm, ← mul_sub]⟩ /-- Multiplication by a nonzero element `a` on the right as a `DilationEquiv` of a normed division ring. -/ @[simps!] def DilationEquiv.mulRight (a : α) (ha : a ≠ 0) : α ≃ᵈ α where toEquiv := Equiv.mulRight₀ a ha edist_eq' := ⟨‖a‖₊, nnnorm_ne_zero_iff.2 ha, fun x y ↦ by simp [edist_nndist, nndist_eq_nnnorm, ← sub_mul, ← mul_comm (‖a‖₊)]⟩ namespace Filter @[simp] lemma comap_mul_left_cobounded {a : α} (ha : a ≠ 0) : comap (a * ·) (cobounded α) = cobounded α := Dilation.comap_cobounded (DilationEquiv.mulLeft a ha) @[simp] lemma map_mul_left_cobounded {a : α} (ha : a ≠ 0) : map (a * ·) (cobounded α) = cobounded α := DilationEquiv.map_cobounded (DilationEquiv.mulLeft a ha) @[simp] lemma comap_mul_right_cobounded {a : α} (ha : a ≠ 0) : comap (· * a) (cobounded α) = cobounded α := Dilation.comap_cobounded (DilationEquiv.mulRight a ha) @[simp] lemma map_mul_right_cobounded {a : α} (ha : a ≠ 0) : map (· * a) (cobounded α) = cobounded α := DilationEquiv.map_cobounded (DilationEquiv.mulRight a ha) /-- Multiplication on the left by a nonzero element of a normed division ring tends to infinity at infinity. -/ theorem tendsto_mul_left_cobounded {a : α} (ha : a ≠ 0) : Tendsto (a * ·) (cobounded α) (cobounded α) := (map_mul_left_cobounded ha).le /-- Multiplication on the right by a nonzero element of a normed division ring tends to infinity at infinity. -/ theorem tendsto_mul_right_cobounded {a : α} (ha : a ≠ 0) : Tendsto (· * a) (cobounded α) (cobounded α) := (map_mul_right_cobounded ha).le @[simp] lemma inv_cobounded₀ : (cobounded α)⁻¹ = 𝓝[≠] 0 := by rw [← comap_norm_atTop, ← Filter.comap_inv, ← comap_norm_nhdsWithin_Ioi_zero, ← inv_atTop₀, ← Filter.comap_inv] simp only [comap_comap, (· ∘ ·), norm_inv] @[simp] lemma inv_nhdsWithin_ne_zero : (𝓝[≠] (0 : α))⁻¹ = cobounded α := by rw [← inv_cobounded₀, inv_inv] lemma tendsto_inv₀_cobounded' : Tendsto Inv.inv (cobounded α) (𝓝[≠] 0) := inv_cobounded₀.le theorem tendsto_inv₀_cobounded : Tendsto Inv.inv (cobounded α) (𝓝 0) := tendsto_inv₀_cobounded'.mono_right inf_le_left lemma tendsto_inv₀_nhdsWithin_ne_zero : Tendsto Inv.inv (𝓝[≠] 0) (cobounded α) := inv_nhdsWithin_ne_zero.le end Filter -- see Note [lower instance priority] instance (priority := 100) NormedDivisionRing.to_hasContinuousInv₀ : HasContinuousInv₀ α := by refine ⟨fun r r0 => tendsto_iff_norm_sub_tendsto_zero.2 ?_⟩ have r0' : 0 < ‖r‖ := norm_pos_iff.2 r0 rcases exists_between r0' with ⟨ε, ε0, εr⟩ have : ∀ᶠ e in 𝓝 r, ‖e⁻¹ - r⁻¹‖ ≤ ‖r - e‖ / ‖r‖ / ε := by filter_upwards [(isOpen_lt continuous_const continuous_norm).eventually_mem εr] with e he have e0 : e ≠ 0 := norm_pos_iff.1 (ε0.trans he) calc ‖e⁻¹ - r⁻¹‖ = ‖r‖⁻¹ * ‖r - e‖ * ‖e‖⁻¹ := by rw [← norm_inv, ← norm_inv, ← norm_mul, ← norm_mul, _root_.mul_sub, _root_.sub_mul, mul_assoc _ e, inv_mul_cancel r0, mul_inv_cancel e0, one_mul, mul_one] -- Porting note: `ENNReal.{mul_sub, sub_mul}` should be `protected` _ = ‖r - e‖ / ‖r‖ / ‖e‖ := by field_simp [mul_comm] _ ≤ ‖r - e‖ / ‖r‖ / ε := by gcongr refine squeeze_zero' (eventually_of_forall fun _ => norm_nonneg _) this ?_ refine (((continuous_const.sub continuous_id).norm.div_const _).div_const _).tendsto' _ _ ?_ simp -- see Note [lower instance priority] /-- A normed division ring is a topological division ring. -/ instance (priority := 100) NormedDivisionRing.to_topologicalDivisionRing : TopologicalDivisionRing α where protected lemma IsOfFinOrder.norm_eq_one (ha : IsOfFinOrder a) : ‖a‖ = 1 := ((normHom : α →*₀ ℝ).toMonoidHom.isOfFinOrder ha).eq_one $ norm_nonneg _ example [Monoid β] (φ : β →* α) {x : β} {k : ℕ+} (h : x ^ (k : ℕ) = 1) : ‖φ x‖ = 1 := (φ.isOfFinOrder <| isOfFinOrder_iff_pow_eq_one.2 ⟨_, k.2, h⟩).norm_eq_one end NormedDivisionRing /-- A normed field is a field with a norm satisfying ‖x y‖ = ‖x‖ ‖y‖. -/ class NormedField (α : Type*) extends Norm α, Field α, MetricSpace α where /-- The distance is induced by the norm. -/ dist_eq : ∀ x y, dist x y = norm (x - y) /-- The norm is multiplicative. -/ norm_mul' : ∀ a b, norm (a * b) = norm a * norm b /-- A nontrivially normed field is a normed field in which there is an element of norm different from `0` and `1`. This makes it possible to bring any element arbitrarily close to `0` by multiplication by the powers of any element, and thus to relate algebra and topology. -/ class NontriviallyNormedField (α : Type*) extends NormedField α where /-- The norm attains a value exceeding 1. -/ non_trivial : ∃ x : α, 1 < ‖x‖ /-- A densely normed field is a normed field for which the image of the norm is dense in `ℝ≥0`, which means it is also nontrivially normed. However, not all nontrivally normed fields are densely normed; in particular, the `Padic`s exhibit this fact. -/ class DenselyNormedField (α : Type*) extends NormedField α where /-- The range of the norm is dense in the collection of nonnegative real numbers. -/ lt_norm_lt : ∀ x y : ℝ, 0 ≤ x → x < y → ∃ a : α, x < ‖a‖ ∧ ‖a‖ < y section NormedField /-- A densely normed field is always a nontrivially normed field. See note [lower instance priority]. -/ instance (priority := 100) DenselyNormedField.toNontriviallyNormedField [DenselyNormedField α] : NontriviallyNormedField α where non_trivial := let ⟨a, h, _⟩ := DenselyNormedField.lt_norm_lt 1 2 zero_le_one one_lt_two ⟨a, h⟩ variable [NormedField α] -- see Note [lower instance priority] instance (priority := 100) NormedField.toNormedDivisionRing : NormedDivisionRing α := { ‹NormedField α› with } -- see Note [lower instance priority] instance (priority := 100) NormedField.toNormedCommRing : NormedCommRing α := { ‹NormedField α› with norm_mul := fun a b => (norm_mul a b).le } @[simp] theorem norm_prod (s : Finset β) (f : β → α) : ‖∏ b ∈ s, f b‖ = ∏ b ∈ s, ‖f b‖ := map_prod normHom.toMonoidHom f s @[simp] theorem nnnorm_prod (s : Finset β) (f : β → α) : ‖∏ b ∈ s, f b‖₊ = ∏ b ∈ s, ‖f b‖₊ := map_prod nnnormHom.toMonoidHom f s end NormedField namespace NormedField section Nontrivially variable (α) [NontriviallyNormedField α] theorem exists_one_lt_norm : ∃ x : α, 1 < ‖x‖ := ‹NontriviallyNormedField α›.non_trivial theorem exists_lt_norm (r : ℝ) : ∃ x : α, r < ‖x‖ := let ⟨w, hw⟩ := exists_one_lt_norm α let ⟨n, hn⟩ := pow_unbounded_of_one_lt r hw ⟨w ^ n, by rwa [norm_pow]⟩ theorem exists_norm_lt {r : ℝ} (hr : 0 < r) : ∃ x : α, 0 < ‖x‖ ∧ ‖x‖ < r := let ⟨w, hw⟩ := exists_lt_norm α r⁻¹ ⟨w⁻¹, by rwa [← Set.mem_Ioo, norm_inv, ← Set.mem_inv, Set.inv_Ioo_0_left hr]⟩ theorem exists_norm_lt_one : ∃ x : α, 0 < ‖x‖ ∧ ‖x‖ < 1 := exists_norm_lt α one_pos variable {α} @[instance] theorem punctured_nhds_neBot (x : α) : NeBot (𝓝[≠] x) := by rw [← mem_closure_iff_nhdsWithin_neBot, Metric.mem_closure_iff] rintro ε ε0 rcases exists_norm_lt α ε0 with ⟨b, hb0, hbε⟩ refine ⟨x + b, mt (Set.mem_singleton_iff.trans add_right_eq_self).1 <| norm_pos_iff.1 hb0, ?_⟩ rwa [dist_comm, dist_eq_norm, add_sub_cancel_left] @[instance] theorem nhdsWithin_isUnit_neBot : NeBot (𝓝[{ x : α | IsUnit x }] 0) := by simpa only [isUnit_iff_ne_zero] using punctured_nhds_neBot (0 : α) end Nontrivially section Densely variable (α) [DenselyNormedField α] theorem exists_lt_norm_lt {r₁ r₂ : ℝ} (h₀ : 0 ≤ r₁) (h : r₁ < r₂) : ∃ x : α, r₁ < ‖x‖ ∧ ‖x‖ < r₂ := DenselyNormedField.lt_norm_lt r₁ r₂ h₀ h theorem exists_lt_nnnorm_lt {r₁ r₂ : ℝ≥0} (h : r₁ < r₂) : ∃ x : α, r₁ < ‖x‖₊ ∧ ‖x‖₊ < r₂ := mod_cast exists_lt_norm_lt α r₁.prop h instance denselyOrdered_range_norm : DenselyOrdered (Set.range (norm : α → ℝ)) where dense := by rintro ⟨-, x, rfl⟩ ⟨-, y, rfl⟩ hxy let ⟨z, h⟩ := exists_lt_norm_lt α (norm_nonneg _) hxy exact ⟨⟨‖z‖, z, rfl⟩, h⟩ instance denselyOrdered_range_nnnorm : DenselyOrdered (Set.range (nnnorm : α → ℝ≥0)) where dense := by rintro ⟨-, x, rfl⟩ ⟨-, y, rfl⟩ hxy let ⟨z, h⟩ := exists_lt_nnnorm_lt α hxy exact ⟨⟨‖z‖₊, z, rfl⟩, h⟩ theorem denseRange_nnnorm : DenseRange (nnnorm : α → ℝ≥0) := dense_of_exists_between fun _ _ hr => let ⟨x, h⟩ := exists_lt_nnnorm_lt α hr ⟨‖x‖₊, ⟨x, rfl⟩, h⟩ end Densely end NormedField /-- A normed field is nontrivially normed provided that the norm of some nonzero element is not one. -/ def NontriviallyNormedField.ofNormNeOne {𝕜 : Type*} [h' : NormedField 𝕜] (h : ∃ x : 𝕜, x ≠ 0 ∧ ‖x‖ ≠ 1) : NontriviallyNormedField 𝕜 where toNormedField := h' non_trivial := by rcases h with ⟨x, hx, hx1⟩ rcases hx1.lt_or_lt with hlt | hlt · use x⁻¹ rw [norm_inv] exact one_lt_inv (norm_pos_iff.2 hx) hlt · exact ⟨x, hlt⟩ instance Real.normedCommRing : NormedCommRing ℝ := { Real.normedAddCommGroup, Real.commRing with norm_mul := fun x y => (abs_mul x y).le } noncomputable instance Real.normedField : NormedField ℝ := { Real.normedAddCommGroup, Real.field with norm_mul' := abs_mul } noncomputable instance Real.denselyNormedField : DenselyNormedField ℝ where lt_norm_lt _ _ h₀ hr := let ⟨x, h⟩ := exists_between hr ⟨x, by rwa [Real.norm_eq_abs, abs_of_nonneg (h₀.trans h.1.le)]⟩ namespace Real theorem toNNReal_mul_nnnorm {x : ℝ} (y : ℝ) (hx : 0 ≤ x) : x.toNNReal * ‖y‖₊ = ‖x * y‖₊ := by ext simp only [NNReal.coe_mul, nnnorm_mul, coe_nnnorm, Real.toNNReal_of_nonneg, norm_of_nonneg, hx, NNReal.coe_mk] theorem nnnorm_mul_toNNReal (x : ℝ) {y : ℝ} (hy : 0 ≤ y) : ‖x‖₊ * y.toNNReal = ‖x * y‖₊ := by rw [mul_comm, mul_comm x, toNNReal_mul_nnnorm x hy] end Real namespace NNReal open NNReal -- porting note (#10618): removed `@[simp]` because `simp` can prove this theorem norm_eq (x : ℝ≥0) : ‖(x : ℝ)‖ = x := by rw [Real.norm_eq_abs, x.abs_eq] @[simp] theorem nnnorm_eq (x : ℝ≥0) : ‖(x : ℝ)‖₊ = x := NNReal.eq <| Real.norm_of_nonneg x.2 lemma lipschitzWith_sub : LipschitzWith 2 (fun (p : ℝ≥0 × ℝ≥0) ↦ p.1 - p.2) := by rw [← isometry_subtype_coe.lipschitzWith_iff] have : Isometry (Prod.map ((↑) : ℝ≥0 → ℝ) ((↑) : ℝ≥0 → ℝ)) := isometry_subtype_coe.prod_map isometry_subtype_coe convert (((LipschitzWith.prod_fst.comp this.lipschitz).sub (LipschitzWith.prod_snd.comp this.lipschitz)).max_const 0) norm_num end NNReal @[simp 1001] -- Porting note: increase priority so that the LHS doesn't simplify theorem norm_norm [SeminormedAddCommGroup α] (x : α) : ‖‖x‖‖ = ‖x‖ := Real.norm_of_nonneg (norm_nonneg _) @[simp] theorem nnnorm_norm [SeminormedAddCommGroup α] (a : α) : ‖‖a‖‖₊ = ‖a‖₊ := by rw [Real.nnnorm_of_nonneg (norm_nonneg a)]; rfl /-- A restatement of `MetricSpace.tendsto_atTop` in terms of the norm. -/ theorem NormedAddCommGroup.tendsto_atTop [Nonempty α] [SemilatticeSup α] {β : Type*} [SeminormedAddCommGroup β] {f : α → β} {b : β} : Tendsto f atTop (𝓝 b) ↔ ∀ ε, 0 < ε → ∃ N, ∀ n, N ≤ n → ‖f n - b‖ < ε := (atTop_basis.tendsto_iff Metric.nhds_basis_ball).trans (by simp [dist_eq_norm]) /-- A variant of `NormedAddCommGroup.tendsto_atTop` that uses `∃ N, ∀ n > N, ...` rather than `∃ N, ∀ n ≥ N, ...` -/ theorem NormedAddCommGroup.tendsto_atTop' [Nonempty α] [SemilatticeSup α] [NoMaxOrder α] {β : Type*} [SeminormedAddCommGroup β] {f : α → β} {b : β} : Tendsto f atTop (𝓝 b) ↔ ∀ ε, 0 < ε → ∃ N, ∀ n, N < n → ‖f n - b‖ < ε := (atTop_basis_Ioi.tendsto_iff Metric.nhds_basis_ball).trans (by simp [dist_eq_norm]) instance Int.instNormedCommRing : NormedCommRing ℤ where __ := instCommRing __ := instNormedAddCommGroup norm_mul m n := by simp only [norm, Int.cast_mul, abs_mul, le_rfl] instance Int.instNormOneClass : NormOneClass ℤ := ⟨by simp [← Int.norm_cast_real]⟩ instance Rat.instNormedField : NormedField ℚ where __ := instField __ := instNormedAddCommGroup norm_mul' a b := by simp only [norm, Rat.cast_mul, abs_mul] instance Rat.instDenselyNormedField : DenselyNormedField ℚ where lt_norm_lt r₁ r₂ h₀ hr := let ⟨q, h⟩ := exists_rat_btwn hr ⟨q, by rwa [← Rat.norm_cast_real, Real.norm_eq_abs, abs_of_pos (h₀.trans_lt h.1)]⟩ section RingHomIsometric variable {R₁ : Type*} {R₂ : Type*} {R₃ : Type*} /-- This class states that a ring homomorphism is isometric. This is a sufficient assumption for a continuous semilinear map to be bounded and this is the main use for this typeclass. -/ class RingHomIsometric [Semiring R₁] [Semiring R₂] [Norm R₁] [Norm R₂] (σ : R₁ →+* R₂) : Prop where /-- The ring homomorphism is an isometry. -/ is_iso : ∀ {x : R₁}, ‖σ x‖ = ‖x‖ attribute [simp] RingHomIsometric.is_iso variable [SeminormedRing R₁] [SeminormedRing R₂] [SeminormedRing R₃] instance RingHomIsometric.ids : RingHomIsometric (RingHom.id R₁) := ⟨rfl⟩ end RingHomIsometric /-! ### Induced normed structures -/ section Induced variable {F : Type*} (R S : Type*) variable [FunLike F R S] /-- A non-unital ring homomorphism from a `NonUnitalRing` to a `NonUnitalSeminormedRing` induces a `NonUnitalSeminormedRing` structure on the domain. See note [reducible non-instances] -/ abbrev NonUnitalSeminormedRing.induced [NonUnitalRing R] [NonUnitalSeminormedRing S] [NonUnitalRingHomClass F R S] (f : F) : NonUnitalSeminormedRing R := { SeminormedAddCommGroup.induced R S f, ‹NonUnitalRing R› with norm_mul := fun x y => by show ‖f (x * y)‖ ≤ ‖f x‖ * ‖f y‖ exact (map_mul f x y).symm ▸ norm_mul_le (f x) (f y) } /-- An injective non-unital ring homomorphism from a `NonUnitalRing` to a `NonUnitalNormedRing` induces a `NonUnitalNormedRing` structure on the domain. See note [reducible non-instances] -/ abbrev NonUnitalNormedRing.induced [NonUnitalRing R] [NonUnitalNormedRing S] [NonUnitalRingHomClass F R S] (f : F) (hf : Function.Injective f) : NonUnitalNormedRing R := { NonUnitalSeminormedRing.induced R S f, NormedAddCommGroup.induced R S f hf with } /-- A non-unital ring homomorphism from a `Ring` to a `SeminormedRing` induces a `SeminormedRing` structure on the domain. See note [reducible non-instances] -/ abbrev SeminormedRing.induced [Ring R] [SeminormedRing S] [NonUnitalRingHomClass F R S] (f : F) : SeminormedRing R := { NonUnitalSeminormedRing.induced R S f, SeminormedAddCommGroup.induced R S f, ‹Ring R› with } /-- An injective non-unital ring homomorphism from a `Ring` to a `NormedRing` induces a `NormedRing` structure on the domain. See note [reducible non-instances] -/ abbrev NormedRing.induced [Ring R] [NormedRing S] [NonUnitalRingHomClass F R S] (f : F) (hf : Function.Injective f) : NormedRing R := { NonUnitalSeminormedRing.induced R S f, NormedAddCommGroup.induced R S f hf, ‹Ring R› with } /-- A non-unital ring homomorphism from a `NonUnitalCommRing` to a `NonUnitalSeminormedCommRing` induces a `NonUnitalSeminormedCommRing` structure on the domain. See note [reducible non-instances] -/ abbrev NonUnitalSeminormedCommRing.induced [NonUnitalCommRing R] [NonUnitalSeminormedCommRing S] [NonUnitalRingHomClass F R S] (f : F) : NonUnitalSeminormedCommRing R := { NonUnitalSeminormedRing.induced R S f, ‹NonUnitalCommRing R› with } /-- An injective non-unital ring homomorphism from a `NonUnitalCommRing` to a `NonUnitalNormedCommRing` induces a `NonUnitalNormedCommRing` structure on the domain. See note [reducible non-instances] -/ abbrev NonUnitalNormedCommRing.induced [NonUnitalCommRing R] [NonUnitalNormedCommRing S] [NonUnitalRingHomClass F R S] (f : F) (hf : Function.Injective f) : NonUnitalNormedCommRing R := { NonUnitalNormedRing.induced R S f hf, ‹NonUnitalCommRing R› with } /-- A non-unital ring homomorphism from a `CommRing` to a `SeminormedRing` induces a `SeminormedCommRing` structure on the domain. See note [reducible non-instances] -/ abbrev SeminormedCommRing.induced [CommRing R] [SeminormedRing S] [NonUnitalRingHomClass F R S] (f : F) : SeminormedCommRing R := { NonUnitalSeminormedRing.induced R S f, SeminormedAddCommGroup.induced R S f, ‹CommRing R› with } /-- An injective non-unital ring homomorphism from a `CommRing` to a `NormedRing` induces a `NormedCommRing` structure on the domain. See note [reducible non-instances] -/ abbrev NormedCommRing.induced [CommRing R] [NormedRing S] [NonUnitalRingHomClass F R S] (f : F) (hf : Function.Injective f) : NormedCommRing R := { SeminormedCommRing.induced R S f, NormedAddCommGroup.induced R S f hf with } /-- An injective non-unital ring homomorphism from a `DivisionRing` to a `NormedRing` induces a `NormedDivisionRing` structure on the domain. See note [reducible non-instances] -/ abbrev NormedDivisionRing.induced [DivisionRing R] [NormedDivisionRing S] [NonUnitalRingHomClass F R S] (f : F) (hf : Function.Injective f) : NormedDivisionRing R := { NormedAddCommGroup.induced R S f hf, ‹DivisionRing R› with norm_mul' := fun x y => by show ‖f (x * y)‖ = ‖f x‖ * ‖f y‖ exact (map_mul f x y).symm ▸ norm_mul (f x) (f y) } /-- An injective non-unital ring homomorphism from a `Field` to a `NormedRing` induces a `NormedField` structure on the domain. See note [reducible non-instances] -/ abbrev NormedField.induced [Field R] [NormedField S] [NonUnitalRingHomClass F R S] (f : F) (hf : Function.Injective f) : NormedField R := { NormedDivisionRing.induced R S f hf with mul_comm := mul_comm } /-- A ring homomorphism from a `Ring R` to a `SeminormedRing S` which induces the norm structure `SeminormedRing.induced` makes `R` satisfy `‖(1 : R)‖ = 1` whenever `‖(1 : S)‖ = 1`. -/ theorem NormOneClass.induced {F : Type*} (R S : Type*) [Ring R] [SeminormedRing S] [NormOneClass S] [FunLike F R S] [RingHomClass F R S] (f : F) : @NormOneClass R (SeminormedRing.induced R S f).toNorm _ := -- Porting note: is this `let` a bad idea somehow? let _ : SeminormedRing R := SeminormedRing.induced R S f { norm_one := (congr_arg norm (map_one f)).trans norm_one } end Induced namespace SubringClass variable {S R : Type*} [SetLike S R] instance toSeminormedRing [SeminormedRing R] [SubringClass S R] (s : S) : SeminormedRing s := SeminormedRing.induced s R (SubringClass.subtype s) instance toNormedRing [NormedRing R] [SubringClass S R] (s : S) : NormedRing s := NormedRing.induced s R (SubringClass.subtype s) Subtype.val_injective instance toSeminormedCommRing [SeminormedCommRing R] [_h : SubringClass S R] (s : S) : SeminormedCommRing s := { SubringClass.toSeminormedRing s with mul_comm := mul_comm } instance toNormedCommRing [NormedCommRing R] [SubringClass S R] (s : S) : NormedCommRing s := { SubringClass.toNormedRing s with mul_comm := mul_comm } end SubringClass -- Guard against import creep. assert_not_exists RestrictScalars
Analysis\Normed\Field\InfiniteSum.lean
/- Copyright (c) 2021 Anatole Dedecker. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Anatole Dedecker -/ import Mathlib.Analysis.Normed.Field.Basic import Mathlib.Analysis.Normed.Group.InfiniteSum import Mathlib.Topology.Algebra.InfiniteSum.Real /-! # Multiplying two infinite sums in a normed ring In this file, we prove various results about `(∑' x : ι, f x) * (∑' y : ι', g y)` in a normed ring. There are similar results proven in `Mathlib.Topology.Algebra.InfiniteSum` (e.g `tsum_mul_tsum`), but in a normed ring we get summability results which aren't true in general. 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_of_summable_norm`). -/ variable {R : Type*} {ι : Type*} {ι' : Type*} [NormedRing R] open scoped Classical open Finset /-! ### Arbitrary index types -/ theorem Summable.mul_of_nonneg {f : ι → ℝ} {g : ι' → ℝ} (hf : Summable f) (hg : Summable g) (hf' : 0 ≤ f) (hg' : 0 ≤ g) : Summable fun x : ι × ι' => f x.1 * g x.2 := (summable_prod_of_nonneg fun _ ↦ mul_nonneg (hf' _) (hg' _)).2 ⟨fun x ↦ hg.mul_left (f x), by simpa only [hg.tsum_mul_left _] using hf.mul_right (∑' x, g x)⟩ theorem Summable.mul_norm {f : ι → R} {g : ι' → R} (hf : Summable fun x => ‖f x‖) (hg : Summable fun x => ‖g x‖) : Summable fun x : ι × ι' => ‖f x.1 * g x.2‖ := .of_nonneg_of_le (fun _ ↦ norm_nonneg _) (fun x => norm_mul_le (f x.1) (g x.2)) (hf.mul_of_nonneg hg (fun x => norm_nonneg <| f x) fun x => norm_nonneg <| g x : _) theorem summable_mul_of_summable_norm [CompleteSpace R] {f : ι → R} {g : ι' → R} (hf : Summable fun x => ‖f x‖) (hg : Summable fun x => ‖g x‖) : Summable fun x : ι × ι' => f x.1 * g x.2 := (hf.mul_norm hg).of_norm /-- Product of two infinites sums indexed by arbitrary types. See also `tsum_mul_tsum` if `f` and `g` are *not* absolutely summable. -/ theorem tsum_mul_tsum_of_summable_norm [CompleteSpace R] {f : ι → R} {g : ι' → R} (hf : Summable fun x => ‖f x‖) (hg : Summable fun x => ‖g x‖) : ((∑' x, f x) * ∑' y, g y) = ∑' z : ι × ι', f z.1 * g z.2 := tsum_mul_tsum hf.of_norm hg.of_norm (summable_mul_of_summable_norm hf hg) /-! ### `ℕ`-indexed families (Cauchy product) We prove two versions of the Cauchy product formula. The first one is `tsum_mul_tsum_eq_tsum_sum_range_of_summable_norm`, 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_of_summable_norm`, 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`. -/ section Nat open Finset.Nat theorem summable_norm_sum_mul_antidiagonal_of_summable_norm {f g : ℕ → R} (hf : Summable fun x => ‖f x‖) (hg : Summable fun x => ‖g x‖) : Summable fun n => ‖∑ kl ∈ antidiagonal n, f kl.1 * g kl.2‖ := by have := summable_sum_mul_antidiagonal_of_summable_mul (Summable.mul_of_nonneg hf hg (fun _ => norm_nonneg _) fun _ => norm_nonneg _) refine this.of_nonneg_of_le (fun _ => norm_nonneg _) (fun n ↦ ?_) calc ‖∑ kl ∈ antidiagonal n, f kl.1 * g kl.2‖ ≤ ∑ kl ∈ antidiagonal n, ‖f kl.1 * g kl.2‖ := norm_sum_le _ _ _ ≤ ∑ kl ∈ antidiagonal n, ‖f kl.1‖ * ‖g kl.2‖ := by gcongr; apply norm_mul_le /-- 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` if `f` and `g` are *not* absolutely summable. -/ theorem tsum_mul_tsum_eq_tsum_sum_antidiagonal_of_summable_norm [CompleteSpace R] {f g : ℕ → R} (hf : Summable fun x => ‖f x‖) (hg : Summable fun x => ‖g x‖) : ((∑' n, f n) * ∑' n, g n) = ∑' n, ∑ kl ∈ antidiagonal n, f kl.1 * g kl.2 := tsum_mul_tsum_eq_tsum_sum_antidiagonal hf.of_norm hg.of_norm (summable_mul_of_summable_norm hf hg) theorem summable_norm_sum_mul_range_of_summable_norm {f g : ℕ → R} (hf : Summable fun x => ‖f x‖) (hg : Summable fun x => ‖g x‖) : Summable fun n => ‖∑ k ∈ range (n + 1), f k * g (n - k)‖ := by simp_rw [← sum_antidiagonal_eq_sum_range_succ fun k l => f k * g l] exact summable_norm_sum_mul_antidiagonal_of_summable_norm hf hg /-- The Cauchy product formula for the product of two infinite sums indexed by `ℕ`, expressed by summing on `Finset.range`. See also `tsum_mul_tsum_eq_tsum_sum_range` if `f` and `g` are *not* absolutely summable. -/ theorem tsum_mul_tsum_eq_tsum_sum_range_of_summable_norm [CompleteSpace R] {f g : ℕ → R} (hf : Summable fun x => ‖f x‖) (hg : Summable fun x => ‖g x‖) : ((∑' n, f n) * ∑' n, g n) = ∑' n, ∑ k ∈ range (n + 1), f k * g (n - k) := by simp_rw [← sum_antidiagonal_eq_sum_range_succ fun k l => f k * g l] exact tsum_mul_tsum_eq_tsum_sum_antidiagonal_of_summable_norm hf hg end Nat
Analysis\Normed\Field\UnitBall.lean
/- Copyright (c) 2022 Yury Kudryashov. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yury Kudryashov, Heather Macbeth -/ import Mathlib.Analysis.Normed.Field.Basic import Mathlib.Analysis.Normed.Group.BallSphere /-! # Algebraic structures on unit balls and spheres In this file we define algebraic structures (`Semigroup`, `CommSemigroup`, `Monoid`, `CommMonoid`, `Group`, `CommGroup`) on `Metric.ball (0 : 𝕜) 1`, `Metric.closedBall (0 : 𝕜) 1`, and `Metric.sphere (0 : 𝕜) 1`. In each case we use the weakest possible typeclass assumption on `𝕜`, from `NonUnitalSeminormedRing` to `NormedField`. -/ open Set Metric variable {𝕜 : Type*} /-- Unit ball in a non unital semi normed ring as a bundled `Subsemigroup`. -/ def Subsemigroup.unitBall (𝕜 : Type*) [NonUnitalSeminormedRing 𝕜] : Subsemigroup 𝕜 where carrier := ball (0 : 𝕜) 1 mul_mem' hx hy := by rw [mem_ball_zero_iff] at * exact (norm_mul_le _ _).trans_lt (mul_lt_one_of_nonneg_of_lt_one_left (norm_nonneg _) hx hy.le) instance Metric.unitBall.semigroup [NonUnitalSeminormedRing 𝕜] : Semigroup (ball (0 : 𝕜) 1) := MulMemClass.toSemigroup (Subsemigroup.unitBall 𝕜) instance Metric.unitBall.continuousMul [NonUnitalSeminormedRing 𝕜] : ContinuousMul (ball (0 : 𝕜) 1) := (Subsemigroup.unitBall 𝕜).continuousMul instance Metric.unitBall.commSemigroup [SeminormedCommRing 𝕜] : CommSemigroup (ball (0 : 𝕜) 1) := MulMemClass.toCommSemigroup (Subsemigroup.unitBall 𝕜) instance Metric.unitBall.hasDistribNeg [NonUnitalSeminormedRing 𝕜] : HasDistribNeg (ball (0 : 𝕜) 1) := Subtype.coe_injective.hasDistribNeg ((↑) : ball (0 : 𝕜) 1 → 𝕜) (fun _ => rfl) fun _ _ => rfl @[simp, norm_cast] theorem coe_mul_unitBall [NonUnitalSeminormedRing 𝕜] (x y : ball (0 : 𝕜) 1) : ↑(x * y) = (x * y : 𝕜) := rfl /-- Closed unit ball in a non unital semi normed ring as a bundled `Subsemigroup`. -/ def Subsemigroup.unitClosedBall (𝕜 : Type*) [NonUnitalSeminormedRing 𝕜] : Subsemigroup 𝕜 where carrier := closedBall 0 1 mul_mem' hx hy := by rw [mem_closedBall_zero_iff] at * exact (norm_mul_le _ _).trans (mul_le_one hx (norm_nonneg _) hy) instance Metric.unitClosedBall.semigroup [NonUnitalSeminormedRing 𝕜] : Semigroup (closedBall (0 : 𝕜) 1) := MulMemClass.toSemigroup (Subsemigroup.unitClosedBall 𝕜) instance Metric.unitClosedBall.hasDistribNeg [NonUnitalSeminormedRing 𝕜] : HasDistribNeg (closedBall (0 : 𝕜) 1) := Subtype.coe_injective.hasDistribNeg ((↑) : closedBall (0 : 𝕜) 1 → 𝕜) (fun _ => rfl) fun _ _ => rfl instance Metric.unitClosedBall.continuousMul [NonUnitalSeminormedRing 𝕜] : ContinuousMul (closedBall (0 : 𝕜) 1) := (Subsemigroup.unitClosedBall 𝕜).continuousMul @[simp, norm_cast] theorem coe_mul_unitClosedBall [NonUnitalSeminormedRing 𝕜] (x y : closedBall (0 : 𝕜) 1) : ↑(x * y) = (x * y : 𝕜) := rfl /-- Closed unit ball in a semi normed ring as a bundled `Submonoid`. -/ def Submonoid.unitClosedBall (𝕜 : Type*) [SeminormedRing 𝕜] [NormOneClass 𝕜] : Submonoid 𝕜 := { Subsemigroup.unitClosedBall 𝕜 with carrier := closedBall 0 1 one_mem' := mem_closedBall_zero_iff.2 norm_one.le } instance Metric.unitClosedBall.monoid [SeminormedRing 𝕜] [NormOneClass 𝕜] : Monoid (closedBall (0 : 𝕜) 1) := SubmonoidClass.toMonoid (Submonoid.unitClosedBall 𝕜) instance Metric.unitClosedBall.commMonoid [SeminormedCommRing 𝕜] [NormOneClass 𝕜] : CommMonoid (closedBall (0 : 𝕜) 1) := SubmonoidClass.toCommMonoid (Submonoid.unitClosedBall 𝕜) @[simp, norm_cast] theorem coe_one_unitClosedBall [SeminormedRing 𝕜] [NormOneClass 𝕜] : ((1 : closedBall (0 : 𝕜) 1) : 𝕜) = 1 := rfl @[simp, norm_cast] theorem coe_pow_unitClosedBall [SeminormedRing 𝕜] [NormOneClass 𝕜] (x : closedBall (0 : 𝕜) 1) (n : ℕ) : ↑(x ^ n) = (x : 𝕜) ^ n := rfl /-- Unit sphere in a normed division ring as a bundled `Submonoid`. -/ def Submonoid.unitSphere (𝕜 : Type*) [NormedDivisionRing 𝕜] : Submonoid 𝕜 where carrier := sphere (0 : 𝕜) 1 mul_mem' hx hy := by rw [mem_sphere_zero_iff_norm] at * simp [*] one_mem' := mem_sphere_zero_iff_norm.2 norm_one instance Metric.unitSphere.inv [NormedDivisionRing 𝕜] : Inv (sphere (0 : 𝕜) 1) := ⟨fun x => ⟨x⁻¹, mem_sphere_zero_iff_norm.2 <| by rw [norm_inv, mem_sphere_zero_iff_norm.1 x.coe_prop, inv_one]⟩⟩ @[simp, norm_cast] theorem coe_inv_unitSphere [NormedDivisionRing 𝕜] (x : sphere (0 : 𝕜) 1) : ↑x⁻¹ = (x⁻¹ : 𝕜) := rfl instance Metric.unitSphere.div [NormedDivisionRing 𝕜] : Div (sphere (0 : 𝕜) 1) := ⟨fun x y => ⟨x / y, mem_sphere_zero_iff_norm.2 <| by rw [norm_div, mem_sphere_zero_iff_norm.1 x.coe_prop, mem_sphere_zero_iff_norm.1 y.coe_prop, div_one]⟩⟩ @[simp, norm_cast] theorem coe_div_unitSphere [NormedDivisionRing 𝕜] (x y : sphere (0 : 𝕜) 1) : ↑(x / y) = (x / y : 𝕜) := rfl instance Metric.unitSphere.pow [NormedDivisionRing 𝕜] : Pow (sphere (0 : 𝕜) 1) ℤ := ⟨fun x n => ⟨(x : 𝕜) ^ n, by rw [mem_sphere_zero_iff_norm, norm_zpow, mem_sphere_zero_iff_norm.1 x.coe_prop, one_zpow]⟩⟩ @[simp, norm_cast] theorem coe_zpow_unitSphere [NormedDivisionRing 𝕜] (x : sphere (0 : 𝕜) 1) (n : ℤ) : ↑(x ^ n) = (x : 𝕜) ^ n := rfl instance Metric.unitSphere.monoid [NormedDivisionRing 𝕜] : Monoid (sphere (0 : 𝕜) 1) := SubmonoidClass.toMonoid (Submonoid.unitSphere 𝕜) @[simp, norm_cast] theorem coe_one_unitSphere [NormedDivisionRing 𝕜] : ((1 : sphere (0 : 𝕜) 1) : 𝕜) = 1 := rfl @[simp, norm_cast] theorem coe_mul_unitSphere [NormedDivisionRing 𝕜] (x y : sphere (0 : 𝕜) 1) : ↑(x * y) = (x * y : 𝕜) := rfl @[simp, norm_cast] theorem coe_pow_unitSphere [NormedDivisionRing 𝕜] (x : sphere (0 : 𝕜) 1) (n : ℕ) : ↑(x ^ n) = (x : 𝕜) ^ n := rfl /-- Monoid homomorphism from the unit sphere to the group of units. -/ def unitSphereToUnits (𝕜 : Type*) [NormedDivisionRing 𝕜] : sphere (0 : 𝕜) 1 →* Units 𝕜 := Units.liftRight (Submonoid.unitSphere 𝕜).subtype (fun x => Units.mk0 x <| ne_zero_of_mem_unit_sphere _) fun _x => rfl @[simp] theorem unitSphereToUnits_apply_coe [NormedDivisionRing 𝕜] (x : sphere (0 : 𝕜) 1) : (unitSphereToUnits 𝕜 x : 𝕜) = x := rfl theorem unitSphereToUnits_injective [NormedDivisionRing 𝕜] : Function.Injective (unitSphereToUnits 𝕜) := fun x y h => Subtype.eq <| by convert congr_arg Units.val h instance Metric.sphere.group [NormedDivisionRing 𝕜] : Group (sphere (0 : 𝕜) 1) := unitSphereToUnits_injective.group (unitSphereToUnits 𝕜) (Units.ext rfl) (fun _x _y => Units.ext rfl) (fun _x => Units.ext rfl) (fun _x _y => Units.ext <| div_eq_mul_inv _ _) (fun x n => Units.ext (Units.val_pow_eq_pow_val (unitSphereToUnits 𝕜 x) n).symm) fun x n => Units.ext (Units.val_zpow_eq_zpow_val (unitSphereToUnits 𝕜 x) n).symm instance Metric.sphere.hasDistribNeg [NormedDivisionRing 𝕜] : HasDistribNeg (sphere (0 : 𝕜) 1) := Subtype.coe_injective.hasDistribNeg ((↑) : sphere (0 : 𝕜) 1 → 𝕜) (fun _ => rfl) fun _ _ => rfl instance Metric.sphere.topologicalGroup [NormedDivisionRing 𝕜] : TopologicalGroup (sphere (0 : 𝕜) 1) where toContinuousMul := (Submonoid.unitSphere 𝕜).continuousMul continuous_inv := (continuous_subtype_val.inv₀ ne_zero_of_mem_unit_sphere).subtype_mk _ instance Metric.sphere.commGroup [NormedField 𝕜] : CommGroup (sphere (0 : 𝕜) 1) := { Metric.sphere.group, Subtype.coe_injective.commMonoid (↑) rfl (fun _ _ => rfl) (fun _ _ => rfl) with } -- Porting note: Lean couldn't see past the type synonym into the subtype.
Analysis\Normed\Group\AddCircle.lean
/- Copyright (c) 2022 Oliver Nash. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Oliver Nash -/ import Mathlib.Analysis.Normed.Group.Quotient import Mathlib.Topology.Instances.AddCircle /-! # The additive circle as a normed group We define the normed group structure on `AddCircle p`, for `p : ℝ`. For example if `p = 1` then: `‖(x : AddCircle 1)‖ = |x - round x|` for any `x : ℝ` (see `UnitAddCircle.norm_eq`). ## Main definitions: * `AddCircle.norm_eq`: a characterisation of the norm on `AddCircle p` ## TODO * The fact `InnerProductGeometry.angle (Real.cos θ) (Real.sin θ) = ‖(θ : Real.Angle)‖` -/ noncomputable section open Set open Int hiding mem_zmultiples_iff open AddSubgroup namespace AddCircle variable (p : ℝ) instance : NormedAddCommGroup (AddCircle p) := AddSubgroup.normedAddCommGroupQuotient _ @[simp] theorem norm_coe_mul (x : ℝ) (t : ℝ) : ‖(↑(t * x) : AddCircle (t * p))‖ = |t| * ‖(x : AddCircle p)‖ := by have aux : ∀ {a b c : ℝ}, a ∈ zmultiples b → c * a ∈ zmultiples (c * b) := fun {a b c} h => by simp only [mem_zmultiples_iff] at h ⊢ obtain ⟨n, rfl⟩ := h exact ⟨n, (mul_smul_comm n c b).symm⟩ rcases eq_or_ne t 0 with (rfl | ht); · simp have ht' : |t| ≠ 0 := (not_congr abs_eq_zero).mpr ht simp only [quotient_norm_eq, Real.norm_eq_abs] conv_rhs => rw [← smul_eq_mul, ← Real.sInf_smul_of_nonneg (abs_nonneg t)] simp only [QuotientAddGroup.mk'_apply, QuotientAddGroup.eq_iff_sub_mem] congr 1 ext z rw [mem_smul_set_iff_inv_smul_mem₀ ht'] show (∃ y, y - t * x ∈ zmultiples (t * p) ∧ |y| = z) ↔ ∃ w, w - x ∈ zmultiples p ∧ |w| = |t|⁻¹ * z constructor · rintro ⟨y, hy, rfl⟩ refine ⟨t⁻¹ * y, ?_, by rw [abs_mul, abs_inv]⟩ rw [← inv_mul_cancel_left₀ ht x, ← inv_mul_cancel_left₀ ht p, ← mul_sub] exact aux hy · rintro ⟨w, hw, hw'⟩ refine ⟨t * w, ?_, by rw [← (eq_inv_mul_iff_mul_eq₀ ht').mp hw', abs_mul]⟩ rw [← mul_sub] exact aux hw theorem norm_neg_period (x : ℝ) : ‖(x : AddCircle (-p))‖ = ‖(x : AddCircle p)‖ := by suffices ‖(↑(-1 * x) : AddCircle (-1 * p))‖ = ‖(x : AddCircle p)‖ by rw [← this, neg_one_mul] simp simp only [norm_coe_mul, abs_neg, abs_one, one_mul] @[simp] theorem norm_eq_of_zero {x : ℝ} : ‖(x : AddCircle (0 : ℝ))‖ = |x| := by suffices { y : ℝ | (y : AddCircle (0 : ℝ)) = (x : AddCircle (0 : ℝ)) } = {x} by rw [quotient_norm_eq, this, image_singleton, Real.norm_eq_abs, csInf_singleton] ext y simp [QuotientAddGroup.eq_iff_sub_mem, mem_zmultiples_iff, sub_eq_zero] theorem norm_eq {x : ℝ} : ‖(x : AddCircle p)‖ = |x - round (p⁻¹ * x) * p| := by suffices ∀ x : ℝ, ‖(x : AddCircle (1 : ℝ))‖ = |x - round x| by rcases eq_or_ne p 0 with (rfl | hp) · simp have hx := norm_coe_mul p x p⁻¹ rw [abs_inv, eq_inv_mul_iff_mul_eq₀ ((not_congr abs_eq_zero).mpr hp)] at hx rw [← hx, inv_mul_cancel hp, this, ← abs_mul, mul_sub, mul_inv_cancel_left₀ hp, mul_comm p] clear! x p intros x rw [quotient_norm_eq, abs_sub_round_eq_min] have h₁ : BddBelow (abs '' { m : ℝ | (m : AddCircle (1 : ℝ)) = x }) := ⟨0, by simp [mem_lowerBounds]⟩ have h₂ : (abs '' { m : ℝ | (m : AddCircle (1 : ℝ)) = x }).Nonempty := ⟨|x|, ⟨x, rfl, rfl⟩⟩ apply le_antisymm · simp_rw [Real.norm_eq_abs, csInf_le_iff h₁ h₂, le_min_iff] intro b h refine ⟨mem_lowerBounds.1 h _ ⟨fract x, ?_, abs_fract⟩, mem_lowerBounds.1 h _ ⟨fract x - 1, ?_, by rw [abs_sub_comm, abs_one_sub_fract]⟩⟩ · simp only [mem_setOf, fract, sub_eq_self, QuotientAddGroup.mk_sub, QuotientAddGroup.eq_zero_iff, intCast_mem_zmultiples_one] · simp only [mem_setOf, fract, sub_eq_self, QuotientAddGroup.mk_sub, QuotientAddGroup.eq_zero_iff, intCast_mem_zmultiples_one, sub_sub, (by norm_cast : (⌊x⌋ : ℝ) + 1 = (↑(⌊x⌋ + 1) : ℝ))] · simp only [QuotientAddGroup.mk'_apply, Real.norm_eq_abs, le_csInf_iff h₁ h₂] rintro b' ⟨b, hb, rfl⟩ simp only [mem_setOf, QuotientAddGroup.eq_iff_sub_mem, mem_zmultiples_iff, smul_one_eq_cast] at hb obtain ⟨z, hz⟩ := hb rw [(by rw [hz]; abel : x = b - z), fract_sub_int, ← abs_sub_round_eq_min] convert round_le b 0 simp theorem norm_eq' (hp : 0 < p) {x : ℝ} : ‖(x : AddCircle p)‖ = p * |p⁻¹ * x - round (p⁻¹ * x)| := by conv_rhs => congr rw [← abs_eq_self.mpr hp.le] rw [← abs_mul, mul_sub, mul_inv_cancel_left₀ hp.ne.symm, norm_eq, mul_comm p] theorem norm_le_half_period {x : AddCircle p} (hp : p ≠ 0) : ‖x‖ ≤ |p| / 2 := by obtain ⟨x⟩ := x change ‖(x : AddCircle p)‖ ≤ |p| / 2 rw [norm_eq, ← mul_le_mul_left (abs_pos.mpr (inv_ne_zero hp)), ← abs_mul, mul_sub, mul_left_comm, ← mul_div_assoc, ← abs_mul, inv_mul_cancel hp, mul_one, abs_one] exact abs_sub_round (p⁻¹ * x) @[simp] theorem norm_half_period_eq : ‖(↑(p / 2) : AddCircle p)‖ = |p| / 2 := by rcases eq_or_ne p 0 with (rfl | hp); · simp rw [norm_eq, ← mul_div_assoc, inv_mul_cancel hp, one_div, round_two_inv, Int.cast_one, one_mul, (by linarith : p / 2 - p = -(p / 2)), abs_neg, abs_div, abs_two] theorem norm_coe_eq_abs_iff {x : ℝ} (hp : p ≠ 0) : ‖(x : AddCircle p)‖ = |x| ↔ |x| ≤ |p| / 2 := by refine ⟨fun hx => hx ▸ norm_le_half_period p hp, fun hx => ?_⟩ suffices ∀ p : ℝ, 0 < p → |x| ≤ p / 2 → ‖(x : AddCircle p)‖ = |x| by -- Porting note: replaced `lt_trichotomy` which had trouble substituting `p = 0`. rcases hp.symm.lt_or_lt with (hp | hp) · rw [abs_eq_self.mpr hp.le] at hx exact this p hp hx · rw [← norm_neg_period] rw [abs_eq_neg_self.mpr hp.le] at hx exact this (-p) (neg_pos.mpr hp) hx clear hx intro p hp hx rcases eq_or_ne x (p / (2 : ℝ)) with (rfl | hx') · simp [abs_div, abs_two] suffices round (p⁻¹ * x) = 0 by simp [norm_eq, this] rw [round_eq_zero_iff] obtain ⟨hx₁, hx₂⟩ := abs_le.mp hx replace hx₂ := Ne.lt_of_le hx' hx₂ constructor · rwa [← mul_le_mul_left hp, ← mul_assoc, mul_inv_cancel hp.ne.symm, one_mul, mul_neg, ← mul_div_assoc, mul_one] · rwa [← mul_lt_mul_left hp, ← mul_assoc, mul_inv_cancel hp.ne.symm, one_mul, ← mul_div_assoc, mul_one] open Metric theorem closedBall_eq_univ_of_half_period_le (hp : p ≠ 0) (x : AddCircle p) {ε : ℝ} (hε : |p| / 2 ≤ ε) : closedBall x ε = univ := eq_univ_iff_forall.mpr fun x => by simpa only [mem_closedBall, dist_eq_norm] using (norm_le_half_period p hp).trans hε @[simp] theorem coe_real_preimage_closedBall_period_zero (x ε : ℝ) : (↑) ⁻¹' closedBall (x : AddCircle (0 : ℝ)) ε = closedBall x ε := by ext y -- Porting note: squeezed the simp simp only [Set.mem_preimage, dist_eq_norm, AddCircle.norm_eq_of_zero, iff_self, ← QuotientAddGroup.mk_sub, Metric.mem_closedBall, Real.norm_eq_abs] theorem coe_real_preimage_closedBall_eq_iUnion (x ε : ℝ) : (↑) ⁻¹' closedBall (x : AddCircle p) ε = ⋃ z : ℤ, closedBall (x + z • p) ε := by rcases eq_or_ne p 0 with (rfl | hp) · simp [iUnion_const] ext y simp only [dist_eq_norm, mem_preimage, mem_closedBall, zsmul_eq_mul, mem_iUnion, Real.norm_eq_abs, ← QuotientAddGroup.mk_sub, norm_eq, ← sub_sub] refine ⟨fun h => ⟨round (p⁻¹ * (y - x)), h⟩, ?_⟩ rintro ⟨n, hn⟩ rw [← mul_le_mul_left (abs_pos.mpr <| inv_ne_zero hp), ← abs_mul, mul_sub, mul_comm _ p, inv_mul_cancel_left₀ hp] at hn ⊢ exact (round_le (p⁻¹ * (y - x)) n).trans hn theorem coe_real_preimage_closedBall_inter_eq {x ε : ℝ} (s : Set ℝ) (hs : s ⊆ closedBall x (|p| / 2)) : (↑) ⁻¹' closedBall (x : AddCircle p) ε ∩ s = if ε < |p| / 2 then closedBall x ε ∩ s else s := by rcases le_or_lt (|p| / 2) ε with hε | hε · rcases eq_or_ne p 0 with (rfl | hp) · simp only [abs_zero, zero_div] at hε simp only [not_lt.mpr hε, coe_real_preimage_closedBall_period_zero, abs_zero, zero_div, if_false, inter_eq_right] exact hs.trans (closedBall_subset_closedBall <| by simp [hε]) -- Porting note: was -- simp [closedBall_eq_univ_of_half_period_le p hp (↑x) hε, not_lt.mpr hε] simp only [not_lt.mpr hε, ite_false, inter_eq_right] rw [closedBall_eq_univ_of_half_period_le p hp (↑x : ℝ ⧸ zmultiples p) hε, preimage_univ] apply subset_univ · suffices ∀ z : ℤ, closedBall (x + z • p) ε ∩ s = if z = 0 then closedBall x ε ∩ s else ∅ by simp [-zsmul_eq_mul, ← QuotientAddGroup.mk_zero, coe_real_preimage_closedBall_eq_iUnion, iUnion_inter, iUnion_ite, this, hε] intro z simp only [Real.closedBall_eq_Icc, zero_sub, zero_add] at hs ⊢ rcases eq_or_ne z 0 with (rfl | hz) · simp simp only [hz, zsmul_eq_mul, if_false, eq_empty_iff_forall_not_mem] rintro y ⟨⟨hy₁, hy₂⟩, hy₀⟩ obtain ⟨hy₃, hy₄⟩ := hs hy₀ rcases lt_trichotomy 0 p with (hp | (rfl : 0 = p) | hp) · cases' Int.cast_le_neg_one_or_one_le_cast_of_ne_zero ℝ hz with hz' hz' · have : ↑z * p ≤ -p := by nlinarith linarith [abs_eq_self.mpr hp.le] · have : p ≤ ↑z * p := by nlinarith linarith [abs_eq_self.mpr hp.le] · simp only [mul_zero, add_zero, abs_zero, zero_div] at hy₁ hy₂ hε linarith · cases' Int.cast_le_neg_one_or_one_le_cast_of_ne_zero ℝ hz with hz' hz' · have : -p ≤ ↑z * p := by nlinarith linarith [abs_eq_neg_self.mpr hp.le] · have : ↑z * p ≤ p := by nlinarith linarith [abs_eq_neg_self.mpr hp.le] section FiniteOrderPoints variable {p} [hp : Fact (0 < p)] theorem norm_div_natCast {m n : ℕ} : ‖(↑(↑m / ↑n * p) : AddCircle p)‖ = p * (↑(min (m % n) (n - m % n)) / n) := by have : p⁻¹ * (↑m / ↑n * p) = ↑m / ↑n := by rw [mul_comm _ p, inv_mul_cancel_left₀ hp.out.ne.symm] rw [norm_eq' p hp.out, this, abs_sub_round_div_natCast_eq] @[deprecated (since := "2024-04-17")] alias norm_div_nat_cast := norm_div_natCast theorem exists_norm_eq_of_isOfFinAddOrder {u : AddCircle p} (hu : IsOfFinAddOrder u) : ∃ k : ℕ, ‖u‖ = p * (k / addOrderOf u) := by let n := addOrderOf u change ∃ k : ℕ, ‖u‖ = p * (k / n) obtain ⟨m, -, -, hm⟩ := exists_gcd_eq_one_of_isOfFinAddOrder hu refine ⟨min (m % n) (n - m % n), ?_⟩ rw [← hm, norm_div_natCast] theorem le_add_order_smul_norm_of_isOfFinAddOrder {u : AddCircle p} (hu : IsOfFinAddOrder u) (hu' : u ≠ 0) : p ≤ addOrderOf u • ‖u‖ := by obtain ⟨n, hn⟩ := exists_norm_eq_of_isOfFinAddOrder hu replace hu : (addOrderOf u : ℝ) ≠ 0 := by norm_cast exact (addOrderOf_pos_iff.mpr hu).ne' conv_lhs => rw [← mul_one p] rw [hn, nsmul_eq_mul, ← mul_assoc, mul_comm _ p, mul_assoc, mul_div_cancel₀ _ hu, mul_le_mul_left hp.out, Nat.one_le_cast, Nat.one_le_iff_ne_zero] contrapose! hu' simpa only [hu', Nat.cast_zero, zero_div, mul_zero, norm_eq_zero] using hn end FiniteOrderPoints end AddCircle namespace UnitAddCircle theorem norm_eq {x : ℝ} : ‖(x : UnitAddCircle)‖ = |x - round x| := by simp [AddCircle.norm_eq] end UnitAddCircle
Analysis\Normed\Group\AddTorsor.lean
/- Copyright (c) 2020 Joseph Myers. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joseph Myers, Yury Kudryashov -/ import Mathlib.Analysis.Normed.Group.Basic import Mathlib.Analysis.Normed.Group.Submodule import Mathlib.LinearAlgebra.AffineSpace.AffineSubspace import Mathlib.LinearAlgebra.AffineSpace.Midpoint import Mathlib.Topology.MetricSpace.IsometricSMul /-! # Torsors of additive normed group actions. This file defines torsors of additive normed group actions, with a metric space structure. The motivating case is Euclidean affine spaces. -/ noncomputable section open NNReal Topology open Filter /-- A `NormedAddTorsor V P` is a torsor of an additive seminormed group action by a `SeminormedAddCommGroup V` on points `P`. We bundle the pseudometric space structure and require the distance to be the same as results from the norm (which in fact implies the distance yields a pseudometric space, but bundling just the distance and using an instance for the pseudometric space results in type class problems). -/ class NormedAddTorsor (V : outParam Type*) (P : Type*) [SeminormedAddCommGroup V] [PseudoMetricSpace P] extends AddTorsor V P where dist_eq_norm' : ∀ x y : P, dist x y = ‖(x -ᵥ y : V)‖ /-- Shortcut instance to help typeclass inference out. -/ instance (priority := 100) NormedAddTorsor.toAddTorsor' {V P : Type*} [NormedAddCommGroup V] [MetricSpace P] [NormedAddTorsor V P] : AddTorsor V P := NormedAddTorsor.toAddTorsor variable {α V P W Q : Type*} [SeminormedAddCommGroup V] [PseudoMetricSpace P] [NormedAddTorsor V P] [NormedAddCommGroup W] [MetricSpace Q] [NormedAddTorsor W Q] instance (priority := 100) NormedAddTorsor.to_isometricVAdd : IsometricVAdd V P := ⟨fun c => Isometry.of_dist_eq fun x y => by -- porting note (#10745): was `simp [NormedAddTorsor.dist_eq_norm']` rw [NormedAddTorsor.dist_eq_norm', NormedAddTorsor.dist_eq_norm', vadd_vsub_vadd_cancel_left]⟩ /-- A `SeminormedAddCommGroup` is a `NormedAddTorsor` over itself. -/ instance (priority := 100) SeminormedAddCommGroup.toNormedAddTorsor : NormedAddTorsor V V where dist_eq_norm' := dist_eq_norm -- Because of the AddTorsor.nonempty instance. /-- A nonempty affine subspace of a `NormedAddTorsor` is itself a `NormedAddTorsor`. -/ instance AffineSubspace.toNormedAddTorsor {R : Type*} [Ring R] [Module R V] (s : AffineSubspace R P) [Nonempty s] : NormedAddTorsor s.direction s := { AffineSubspace.toAddTorsor s with dist_eq_norm' := fun x y => NormedAddTorsor.dist_eq_norm' x.val y.val } section variable (V W) /-- The distance equals the norm of subtracting two points. In this lemma, it is necessary to have `V` as an explicit argument; otherwise `rw dist_eq_norm_vsub` sometimes doesn't work. -/ theorem dist_eq_norm_vsub (x y : P) : dist x y = ‖x -ᵥ y‖ := NormedAddTorsor.dist_eq_norm' x y theorem nndist_eq_nnnorm_vsub (x y : P) : nndist x y = ‖x -ᵥ y‖₊ := NNReal.eq <| dist_eq_norm_vsub V x y /-- The distance equals the norm of subtracting two points. In this lemma, it is necessary to have `V` as an explicit argument; otherwise `rw dist_eq_norm_vsub'` sometimes doesn't work. -/ theorem dist_eq_norm_vsub' (x y : P) : dist x y = ‖y -ᵥ x‖ := (dist_comm _ _).trans (dist_eq_norm_vsub _ _ _) theorem nndist_eq_nnnorm_vsub' (x y : P) : nndist x y = ‖y -ᵥ x‖₊ := NNReal.eq <| dist_eq_norm_vsub' V x y end theorem dist_vadd_cancel_left (v : V) (x y : P) : dist (v +ᵥ x) (v +ᵥ y) = dist x y := dist_vadd _ _ _ theorem nndist_vadd_cancel_left (v : V) (x y : P) : nndist (v +ᵥ x) (v +ᵥ y) = nndist x y := NNReal.eq <| dist_vadd_cancel_left _ _ _ @[simp] theorem dist_vadd_cancel_right (v₁ v₂ : V) (x : P) : dist (v₁ +ᵥ x) (v₂ +ᵥ x) = dist v₁ v₂ := by rw [dist_eq_norm_vsub V, dist_eq_norm, vadd_vsub_vadd_cancel_right] @[simp] theorem nndist_vadd_cancel_right (v₁ v₂ : V) (x : P) : nndist (v₁ +ᵥ x) (v₂ +ᵥ x) = nndist v₁ v₂ := NNReal.eq <| dist_vadd_cancel_right _ _ _ @[simp] theorem dist_vadd_left (v : V) (x : P) : dist (v +ᵥ x) x = ‖v‖ := by -- porting note (#10745): was `simp [dist_eq_norm_vsub V _ x]` rw [dist_eq_norm_vsub V _ x, vadd_vsub] @[simp] theorem nndist_vadd_left (v : V) (x : P) : nndist (v +ᵥ x) x = ‖v‖₊ := NNReal.eq <| dist_vadd_left _ _ @[simp] theorem dist_vadd_right (v : V) (x : P) : dist x (v +ᵥ x) = ‖v‖ := by rw [dist_comm, dist_vadd_left] @[simp] theorem nndist_vadd_right (v : V) (x : P) : nndist x (v +ᵥ x) = ‖v‖₊ := NNReal.eq <| dist_vadd_right _ _ /-- Isometry between the tangent space `V` of a (semi)normed add torsor `P` and `P` given by addition/subtraction of `x : P`. -/ @[simps!] def IsometryEquiv.vaddConst (x : P) : V ≃ᵢ P where toEquiv := Equiv.vaddConst x isometry_toFun := Isometry.of_dist_eq fun _ _ => dist_vadd_cancel_right _ _ _ @[simp] theorem dist_vsub_cancel_left (x y z : P) : dist (x -ᵥ y) (x -ᵥ z) = dist y z := by rw [dist_eq_norm, vsub_sub_vsub_cancel_left, dist_comm, dist_eq_norm_vsub V] @[simp] theorem nndist_vsub_cancel_left (x y z : P) : nndist (x -ᵥ y) (x -ᵥ z) = nndist y z := NNReal.eq <| dist_vsub_cancel_left _ _ _ /-- Isometry between the tangent space `V` of a (semi)normed add torsor `P` and `P` given by subtraction from `x : P`. -/ @[simps!] def IsometryEquiv.constVSub (x : P) : P ≃ᵢ V where toEquiv := Equiv.constVSub x isometry_toFun := Isometry.of_dist_eq fun _ _ => dist_vsub_cancel_left _ _ _ @[simp] theorem dist_vsub_cancel_right (x y z : P) : dist (x -ᵥ z) (y -ᵥ z) = dist x y := (IsometryEquiv.vaddConst z).symm.dist_eq x y @[simp] theorem nndist_vsub_cancel_right (x y z : P) : nndist (x -ᵥ z) (y -ᵥ z) = nndist x y := NNReal.eq <| dist_vsub_cancel_right _ _ _ theorem dist_vadd_vadd_le (v v' : V) (p p' : P) : dist (v +ᵥ p) (v' +ᵥ p') ≤ dist v v' + dist p p' := by simpa using dist_triangle (v +ᵥ p) (v' +ᵥ p) (v' +ᵥ p') theorem nndist_vadd_vadd_le (v v' : V) (p p' : P) : nndist (v +ᵥ p) (v' +ᵥ p') ≤ nndist v v' + nndist p p' := dist_vadd_vadd_le _ _ _ _ theorem dist_vsub_vsub_le (p₁ p₂ p₃ p₄ : P) : dist (p₁ -ᵥ p₂) (p₃ -ᵥ p₄) ≤ dist p₁ p₃ + dist p₂ p₄ := by rw [dist_eq_norm, vsub_sub_vsub_comm, dist_eq_norm_vsub V, dist_eq_norm_vsub V] exact norm_sub_le _ _ theorem nndist_vsub_vsub_le (p₁ p₂ p₃ p₄ : P) : nndist (p₁ -ᵥ p₂) (p₃ -ᵥ p₄) ≤ nndist p₁ p₃ + nndist p₂ p₄ := by simp only [← NNReal.coe_le_coe, NNReal.coe_add, ← dist_nndist, dist_vsub_vsub_le] theorem edist_vadd_vadd_le (v v' : V) (p p' : P) : edist (v +ᵥ p) (v' +ᵥ p') ≤ edist v v' + edist p p' := by simp only [edist_nndist] norm_cast -- Porting note: was apply_mod_cast apply dist_vadd_vadd_le theorem edist_vsub_vsub_le (p₁ p₂ p₃ p₄ : P) : edist (p₁ -ᵥ p₂) (p₃ -ᵥ p₄) ≤ edist p₁ p₃ + edist p₂ p₄ := by simp only [edist_nndist] norm_cast -- Porting note: was apply_mod_cast apply dist_vsub_vsub_le /-- The pseudodistance defines a pseudometric space structure on the torsor. This is not an instance because it depends on `V` to define a `MetricSpace P`. -/ def pseudoMetricSpaceOfNormedAddCommGroupOfAddTorsor (V P : Type*) [SeminormedAddCommGroup V] [AddTorsor V P] : PseudoMetricSpace P where dist x y := ‖(x -ᵥ y : V)‖ dist_self x := by simp dist_comm x y := by simp only [← neg_vsub_eq_vsub_rev y x, norm_neg] dist_triangle x y z := by change ‖x -ᵥ z‖ ≤ ‖x -ᵥ y‖ + ‖y -ᵥ z‖ rw [← vsub_add_vsub_cancel] apply norm_add_le /-- The distance defines a metric space structure on the torsor. This is not an instance because it depends on `V` to define a `MetricSpace P`. -/ def metricSpaceOfNormedAddCommGroupOfAddTorsor (V P : Type*) [NormedAddCommGroup V] [AddTorsor V P] : MetricSpace P where dist x y := ‖(x -ᵥ y : V)‖ dist_self x := by simp eq_of_dist_eq_zero h := by simpa using h dist_comm x y := by simp only [← neg_vsub_eq_vsub_rev y x, norm_neg] dist_triangle x y z := by change ‖x -ᵥ z‖ ≤ ‖x -ᵥ y‖ + ‖y -ᵥ z‖ rw [← vsub_add_vsub_cancel] apply norm_add_le theorem LipschitzWith.vadd [PseudoEMetricSpace α] {f : α → V} {g : α → P} {Kf Kg : ℝ≥0} (hf : LipschitzWith Kf f) (hg : LipschitzWith Kg g) : LipschitzWith (Kf + Kg) (f +ᵥ g) := fun x y => calc edist (f x +ᵥ g x) (f y +ᵥ g y) ≤ edist (f x) (f y) + edist (g x) (g y) := edist_vadd_vadd_le _ _ _ _ _ ≤ Kf * edist x y + Kg * edist x y := add_le_add (hf x y) (hg x y) _ = (Kf + Kg) * edist x y := (add_mul _ _ _).symm theorem LipschitzWith.vsub [PseudoEMetricSpace α] {f g : α → P} {Kf Kg : ℝ≥0} (hf : LipschitzWith Kf f) (hg : LipschitzWith Kg g) : LipschitzWith (Kf + Kg) (f -ᵥ g) := fun x y => calc edist (f x -ᵥ g x) (f y -ᵥ g y) ≤ edist (f x) (f y) + edist (g x) (g y) := edist_vsub_vsub_le _ _ _ _ _ ≤ Kf * edist x y + Kg * edist x y := add_le_add (hf x y) (hg x y) _ = (Kf + Kg) * edist x y := (add_mul _ _ _).symm theorem uniformContinuous_vadd : UniformContinuous fun x : V × P => x.1 +ᵥ x.2 := (LipschitzWith.prod_fst.vadd LipschitzWith.prod_snd).uniformContinuous theorem uniformContinuous_vsub : UniformContinuous fun x : P × P => x.1 -ᵥ x.2 := (LipschitzWith.prod_fst.vsub LipschitzWith.prod_snd).uniformContinuous instance (priority := 100) NormedAddTorsor.to_continuousVAdd : ContinuousVAdd V P where continuous_vadd := uniformContinuous_vadd.continuous theorem continuous_vsub : Continuous fun x : P × P => x.1 -ᵥ x.2 := uniformContinuous_vsub.continuous 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.prod_mk_nhds hg) section variable [TopologicalSpace α] theorem Continuous.vsub {f g : α → P} (hf : Continuous f) (hg : Continuous g) : Continuous (f -ᵥ g) := continuous_vsub.comp (hf.prod_mk hg : _) nonrec theorem ContinuousAt.vsub {f g : α → P} {x : α} (hf : ContinuousAt f x) (hg : ContinuousAt g x) : ContinuousAt (f -ᵥ g) x := hf.vsub hg nonrec theorem ContinuousWithinAt.vsub {f g : α → P} {x : α} {s : Set α} (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) : ContinuousWithinAt (f -ᵥ g) s x := hf.vsub hg theorem ContinuousOn.vsub {f g : α → P} {s : Set α} (hf : ContinuousOn f s) (hg : ContinuousOn g s) : ContinuousOn (f -ᵥ g) s := fun x hx ↦ (hf x hx).vsub (hg x hx) end section variable {R : Type*} [Ring R] [TopologicalSpace R] [Module R V] [ContinuousSMul R V] theorem Filter.Tendsto.lineMap {l : Filter α} {f₁ f₂ : α → P} {g : α → R} {p₁ p₂ : P} {c : R} (h₁ : Tendsto f₁ l (𝓝 p₁)) (h₂ : Tendsto f₂ l (𝓝 p₂)) (hg : Tendsto g l (𝓝 c)) : Tendsto (fun x => AffineMap.lineMap (f₁ x) (f₂ x) (g x)) l (𝓝 <| AffineMap.lineMap p₁ p₂ c) := (hg.smul (h₂.vsub h₁)).vadd h₁ theorem Filter.Tendsto.midpoint [Invertible (2 : R)] {l : Filter α} {f₁ f₂ : α → P} {p₁ p₂ : P} (h₁ : Tendsto f₁ l (𝓝 p₁)) (h₂ : Tendsto f₂ l (𝓝 p₂)) : Tendsto (fun x => midpoint R (f₁ x) (f₂ x)) l (𝓝 <| midpoint R p₁ p₂) := h₁.lineMap h₂ tendsto_const_nhds end section Pointwise open Pointwise theorem IsClosed.vadd_right_of_isCompact {s : Set V} {t : Set P} (hs : IsClosed s) (ht : IsCompact t) : IsClosed (s +ᵥ t) := by -- This result is still true for any `AddTorsor` where `-ᵥ` is continuous, -- but we don't yet have a nice way to state it. refine IsSeqClosed.isClosed (fun u p husv hup ↦ ?_) choose! a ha v hv hav using husv rcases ht.isSeqCompact hv with ⟨q, hqt, φ, φ_mono, hφq⟩ refine ⟨p -ᵥ q, hs.mem_of_tendsto ((hup.comp φ_mono.tendsto_atTop).vsub hφq) (eventually_of_forall fun n ↦ ?_), q, hqt, vsub_vadd _ _⟩ convert ha (φ n) using 1 exact (eq_vadd_iff_vsub_eq _ _ _).mp (hav (φ n)).symm end Pointwise
Analysis\Normed\Group\BallSphere.lean
/- Copyright (c) 2022 Yury Kudryashov. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yury Kudryashov, Heather Macbeth -/ import Mathlib.Analysis.Normed.Group.Uniform /-! # Negation on spheres and balls In this file we define `InvolutiveNeg` and `ContinuousNeg` instances for spheres, open balls, and closed balls in a semi normed group. -/ open Metric Set variable {E : Type*} [i : SeminormedAddCommGroup E] {r : ℝ} /-- We equip the sphere, in a seminormed group, with a formal operation of negation, namely the antipodal map. -/ instance : InvolutiveNeg (sphere (0 : E) r) where neg := Subtype.map Neg.neg fun w => by simp neg_neg x := Subtype.ext <| neg_neg x.1 @[simp] theorem coe_neg_sphere {r : ℝ} (v : sphere (0 : E) r) : ↑(-v) = (-v : E) := rfl instance : ContinuousNeg (sphere (0 : E) r) := Inducing.continuousNeg inducing_subtype_val fun _ => rfl /-- We equip the ball, in a seminormed group, with a formal operation of negation, namely the antipodal map. -/ instance {r : ℝ} : InvolutiveNeg (ball (0 : E) r) where neg := Subtype.map Neg.neg fun w => by simp neg_neg x := Subtype.ext <| neg_neg x.1 @[simp] theorem coe_neg_ball {r : ℝ} (v : ball (0 : E) r) : ↑(-v) = (-v : E) := rfl instance : ContinuousNeg (ball (0 : E) r) := Inducing.continuousNeg inducing_subtype_val fun _ => rfl /-- We equip the closed ball, in a seminormed group, with a formal operation of negation, namely the antipodal map. -/ instance {r : ℝ} : InvolutiveNeg (closedBall (0 : E) r) where neg := Subtype.map Neg.neg fun w => by simp neg_neg x := Subtype.ext <| neg_neg x.1 @[simp] theorem coe_neg_closedBall {r : ℝ} (v : closedBall (0 : E) r) : ↑(-v) = (-v : E) := rfl instance : ContinuousNeg (closedBall (0 : E) r) := Inducing.continuousNeg inducing_subtype_val fun _ => rfl
Analysis\Normed\Group\Basic.lean
/- Copyright (c) 2018 Patrick Massot. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Johannes Hölzl, Yaël Dillies -/ import Mathlib.Algebra.CharP.Defs import Mathlib.Algebra.Group.Subgroup.Basic import Mathlib.Analysis.Normed.Group.Seminorm import Mathlib.Tactic.Bound.Attribute import Mathlib.Topology.Metrizable.Uniformity import Mathlib.Topology.Sequences /-! # Normed (semi)groups In this file we define 10 classes: * `Norm`, `NNNorm`: auxiliary classes endowing a type `α` with a function `norm : α → ℝ` (notation: `‖x‖`) and `nnnorm : α → ℝ≥0` (notation: `‖x‖₊`), respectively; * `Seminormed...Group`: A seminormed (additive) (commutative) group is an (additive) (commutative) group with a norm and a compatible pseudometric space structure: `∀ x y, dist x y = ‖x / y‖` or `∀ x y, dist x y = ‖x - y‖`, depending on the group operation. * `Normed...Group`: A normed (additive) (commutative) group is an (additive) (commutative) group with a norm and a compatible metric space structure. We also prove basic properties of (semi)normed groups and provide some instances. ## TODO This file is huge; move material into separate files, such as `Mathlib/Analysis/Normed/Group/Lemmas.lean`. ## Notes The current convention `dist x y = ‖x - y‖` means that the distance is invariant under right addition, but actions in mathlib are usually from the left. This means we might want to change it to `dist x y = ‖-x + y‖`. The normed group hierarchy would lend itself well to a mixin design (that is, having `SeminormedGroup` and `SeminormedAddGroup` not extend `Group` and `AddGroup`), but we choose not to for performance concerns. ## Tags normed group -/ variable {𝓕 𝕜 α ι κ E F G : Type*} open Filter Function Metric Bornology open ENNReal Filter NNReal Uniformity Pointwise Topology /-- Auxiliary class, endowing a type `E` with a function `norm : E → ℝ` with notation `‖x‖`. This class is designed to be extended in more interesting classes specifying the properties of the norm. -/ @[notation_class] class Norm (E : Type*) where /-- the `ℝ`-valued norm function. -/ norm : E → ℝ /-- Auxiliary class, endowing a type `α` with a function `nnnorm : α → ℝ≥0` with notation `‖x‖₊`. -/ @[notation_class] class NNNorm (E : Type*) where /-- the `ℝ≥0`-valued norm function. -/ nnnorm : E → ℝ≥0 export Norm (norm) export NNNorm (nnnorm) @[inherit_doc] notation "‖" e "‖" => norm e @[inherit_doc] notation "‖" e "‖₊" => nnnorm e /-- A seminormed group is an additive group endowed with a norm for which `dist x y = ‖x - y‖` defines a pseudometric space structure. -/ class SeminormedAddGroup (E : Type*) extends Norm E, AddGroup E, PseudoMetricSpace E where dist := fun x y => ‖x - y‖ /-- The distance function is induced by the norm. -/ dist_eq : ∀ x y, dist x y = ‖x - y‖ := by aesop /-- A seminormed group is a group endowed with a norm for which `dist x y = ‖x / y‖` defines a pseudometric space structure. -/ @[to_additive] class SeminormedGroup (E : Type*) extends Norm E, Group E, PseudoMetricSpace E where dist := fun x y => ‖x / y‖ /-- The distance function is induced by the norm. -/ dist_eq : ∀ x y, dist x y = ‖x / y‖ := by aesop /-- A normed group is an additive group endowed with a norm for which `dist x y = ‖x - y‖` defines a metric space structure. -/ class NormedAddGroup (E : Type*) extends Norm E, AddGroup E, MetricSpace E where dist := fun x y => ‖x - y‖ /-- The distance function is induced by the norm. -/ dist_eq : ∀ x y, dist x y = ‖x - y‖ := by aesop /-- A normed group is a group endowed with a norm for which `dist x y = ‖x / y‖` defines a metric space structure. -/ @[to_additive] class NormedGroup (E : Type*) extends Norm E, Group E, MetricSpace E where dist := fun x y => ‖x / y‖ /-- The distance function is induced by the norm. -/ dist_eq : ∀ x y, dist x y = ‖x / y‖ := by aesop /-- A seminormed group is an additive group endowed with a norm for which `dist x y = ‖x - y‖` defines a pseudometric space structure. -/ class SeminormedAddCommGroup (E : Type*) extends Norm E, AddCommGroup E, PseudoMetricSpace E where dist := fun x y => ‖x - y‖ /-- The distance function is induced by the norm. -/ dist_eq : ∀ x y, dist x y = ‖x - y‖ := by aesop /-- A seminormed group is a group endowed with a norm for which `dist x y = ‖x / y‖` defines a pseudometric space structure. -/ @[to_additive] class SeminormedCommGroup (E : Type*) extends Norm E, CommGroup E, PseudoMetricSpace E where dist := fun x y => ‖x / y‖ /-- The distance function is induced by the norm. -/ dist_eq : ∀ x y, dist x y = ‖x / y‖ := by aesop /-- A normed group is an additive group endowed with a norm for which `dist x y = ‖x - y‖` defines a metric space structure. -/ class NormedAddCommGroup (E : Type*) extends Norm E, AddCommGroup E, MetricSpace E where dist := fun x y => ‖x - y‖ /-- The distance function is induced by the norm. -/ dist_eq : ∀ x y, dist x y = ‖x - y‖ := by aesop /-- A normed group is a group endowed with a norm for which `dist x y = ‖x / y‖` defines a metric space structure. -/ @[to_additive] class NormedCommGroup (E : Type*) extends Norm E, CommGroup E, MetricSpace E where dist := fun x y => ‖x / y‖ /-- The distance function is induced by the norm. -/ dist_eq : ∀ x y, dist x y = ‖x / y‖ := by aesop -- See note [lower instance priority] @[to_additive] instance (priority := 100) NormedGroup.toSeminormedGroup [NormedGroup E] : SeminormedGroup E := { ‹NormedGroup E› with } -- See note [lower instance priority] @[to_additive] instance (priority := 100) NormedCommGroup.toSeminormedCommGroup [NormedCommGroup E] : SeminormedCommGroup E := { ‹NormedCommGroup E› with } -- See note [lower instance priority] @[to_additive] instance (priority := 100) SeminormedCommGroup.toSeminormedGroup [SeminormedCommGroup E] : SeminormedGroup E := { ‹SeminormedCommGroup E› with } -- See note [lower instance priority] @[to_additive] instance (priority := 100) NormedCommGroup.toNormedGroup [NormedCommGroup E] : NormedGroup E := { ‹NormedCommGroup E› with } -- See note [reducible non-instances] /-- Construct a `NormedGroup` from a `SeminormedGroup` satisfying `∀ x, ‖x‖ = 0 → x = 1`. This avoids having to go back to the `(Pseudo)MetricSpace` level when declaring a `NormedGroup` instance as a special case of a more general `SeminormedGroup` instance. -/ @[to_additive (attr := reducible) "Construct a `NormedAddGroup` from a `SeminormedAddGroup` satisfying `∀ x, ‖x‖ = 0 → x = 0`. This avoids having to go back to the `(Pseudo)MetricSpace` level when declaring a `NormedAddGroup` instance as a special case of a more general `SeminormedAddGroup` instance."] def NormedGroup.ofSeparation [SeminormedGroup E] (h : ∀ x : E, ‖x‖ = 0 → x = 1) : NormedGroup E where dist_eq := ‹SeminormedGroup E›.dist_eq toMetricSpace := { eq_of_dist_eq_zero := fun hxy => div_eq_one.1 <| h _ <| by exact (‹SeminormedGroup E›.dist_eq _ _).symm.trans hxy } -- Porting note: the `rwa` no longer worked, but it was easy enough to provide the term. -- however, notice that if you make `x` and `y` accessible, then the following does work: -- `have := ‹SeminormedGroup E›.dist_eq x y; rwa [← this]`, so I'm not sure why the `rwa` -- was broken. -- See note [reducible non-instances] /-- Construct a `NormedCommGroup` from a `SeminormedCommGroup` satisfying `∀ x, ‖x‖ = 0 → x = 1`. This avoids having to go back to the `(Pseudo)MetricSpace` level when declaring a `NormedCommGroup` instance as a special case of a more general `SeminormedCommGroup` instance. -/ @[to_additive (attr := reducible) "Construct a `NormedAddCommGroup` from a `SeminormedAddCommGroup` satisfying `∀ x, ‖x‖ = 0 → x = 0`. This avoids having to go back to the `(Pseudo)MetricSpace` level when declaring a `NormedAddCommGroup` instance as a special case of a more general `SeminormedAddCommGroup` instance."] def NormedCommGroup.ofSeparation [SeminormedCommGroup E] (h : ∀ x : E, ‖x‖ = 0 → x = 1) : NormedCommGroup E := { ‹SeminormedCommGroup E›, NormedGroup.ofSeparation h with } -- See note [reducible non-instances] /-- Construct a seminormed group from a multiplication-invariant distance. -/ @[to_additive (attr := reducible) "Construct a seminormed group from a translation-invariant distance."] def SeminormedGroup.ofMulDist [Norm E] [Group E] [PseudoMetricSpace E] (h₁ : ∀ x : E, ‖x‖ = dist x 1) (h₂ : ∀ x y z : E, dist x y ≤ dist (x * z) (y * z)) : SeminormedGroup E where dist_eq x y := by rw [h₁]; apply le_antisymm · simpa only [div_eq_mul_inv, ← mul_right_inv y] using h₂ _ _ _ · simpa only [div_mul_cancel, one_mul] using h₂ (x / y) 1 y -- See note [reducible non-instances] /-- Construct a seminormed group from a multiplication-invariant pseudodistance. -/ @[to_additive (attr := reducible) "Construct a seminormed group from a translation-invariant pseudodistance."] def SeminormedGroup.ofMulDist' [Norm E] [Group E] [PseudoMetricSpace E] (h₁ : ∀ x : E, ‖x‖ = dist x 1) (h₂ : ∀ x y z : E, dist (x * z) (y * z) ≤ dist x y) : SeminormedGroup E where dist_eq x y := by rw [h₁]; apply le_antisymm · simpa only [div_mul_cancel, one_mul] using h₂ (x / y) 1 y · simpa only [div_eq_mul_inv, ← mul_right_inv y] using h₂ _ _ _ -- See note [reducible non-instances] /-- Construct a seminormed group from a multiplication-invariant pseudodistance. -/ @[to_additive (attr := reducible) "Construct a seminormed group from a translation-invariant pseudodistance."] def SeminormedCommGroup.ofMulDist [Norm E] [CommGroup E] [PseudoMetricSpace E] (h₁ : ∀ x : E, ‖x‖ = dist x 1) (h₂ : ∀ x y z : E, dist x y ≤ dist (x * z) (y * z)) : SeminormedCommGroup E := { SeminormedGroup.ofMulDist h₁ h₂ with mul_comm := mul_comm } -- See note [reducible non-instances] /-- Construct a seminormed group from a multiplication-invariant pseudodistance. -/ @[to_additive (attr := reducible) "Construct a seminormed group from a translation-invariant pseudodistance."] def SeminormedCommGroup.ofMulDist' [Norm E] [CommGroup E] [PseudoMetricSpace E] (h₁ : ∀ x : E, ‖x‖ = dist x 1) (h₂ : ∀ x y z : E, dist (x * z) (y * z) ≤ dist x y) : SeminormedCommGroup E := { SeminormedGroup.ofMulDist' h₁ h₂ with mul_comm := mul_comm } -- See note [reducible non-instances] /-- Construct a normed group from a multiplication-invariant distance. -/ @[to_additive (attr := reducible) "Construct a normed group from a translation-invariant distance."] def NormedGroup.ofMulDist [Norm E] [Group E] [MetricSpace E] (h₁ : ∀ x : E, ‖x‖ = dist x 1) (h₂ : ∀ x y z : E, dist x y ≤ dist (x * z) (y * z)) : NormedGroup E := { SeminormedGroup.ofMulDist h₁ h₂ with eq_of_dist_eq_zero := eq_of_dist_eq_zero } -- See note [reducible non-instances] /-- Construct a normed group from a multiplication-invariant pseudodistance. -/ @[to_additive (attr := reducible) "Construct a normed group from a translation-invariant pseudodistance."] def NormedGroup.ofMulDist' [Norm E] [Group E] [MetricSpace E] (h₁ : ∀ x : E, ‖x‖ = dist x 1) (h₂ : ∀ x y z : E, dist (x * z) (y * z) ≤ dist x y) : NormedGroup E := { SeminormedGroup.ofMulDist' h₁ h₂ with eq_of_dist_eq_zero := eq_of_dist_eq_zero } -- See note [reducible non-instances] /-- Construct a normed group from a multiplication-invariant pseudodistance. -/ @[to_additive (attr := reducible) "Construct a normed group from a translation-invariant pseudodistance."] def NormedCommGroup.ofMulDist [Norm E] [CommGroup E] [MetricSpace E] (h₁ : ∀ x : E, ‖x‖ = dist x 1) (h₂ : ∀ x y z : E, dist x y ≤ dist (x * z) (y * z)) : NormedCommGroup E := { NormedGroup.ofMulDist h₁ h₂ with mul_comm := mul_comm } -- See note [reducible non-instances] /-- Construct a normed group from a multiplication-invariant pseudodistance. -/ @[to_additive (attr := reducible) "Construct a normed group from a translation-invariant pseudodistance."] def NormedCommGroup.ofMulDist' [Norm E] [CommGroup E] [MetricSpace E] (h₁ : ∀ x : E, ‖x‖ = dist x 1) (h₂ : ∀ x y z : E, dist (x * z) (y * z) ≤ dist x y) : NormedCommGroup E := { NormedGroup.ofMulDist' h₁ h₂ with mul_comm := mul_comm } -- See note [reducible non-instances] /-- Construct a seminormed group from a seminorm, i.e., registering the pseudodistance and the pseudometric space structure from the seminorm properties. Note that in most cases this instance creates bad definitional equalities (e.g., it does not take into account a possibly existing `UniformSpace` instance on `E`). -/ @[to_additive (attr := reducible) "Construct a seminormed group from a seminorm, i.e., registering the pseudodistance and the pseudometric space structure from the seminorm properties. Note that in most cases this instance creates bad definitional equalities (e.g., it does not take into account a possibly existing `UniformSpace` instance on `E`)."] def GroupSeminorm.toSeminormedGroup [Group E] (f : GroupSeminorm E) : SeminormedGroup E where dist x y := f (x / y) norm := f dist_eq x y := rfl dist_self x := by simp only [div_self', map_one_eq_zero] dist_triangle := le_map_div_add_map_div f dist_comm := map_div_rev f edist_dist x y := by exact ENNReal.coe_nnreal_eq _ -- Porting note: how did `mathlib3` solve this automatically? -- See note [reducible non-instances] /-- Construct a seminormed group from a seminorm, i.e., registering the pseudodistance and the pseudometric space structure from the seminorm properties. Note that in most cases this instance creates bad definitional equalities (e.g., it does not take into account a possibly existing `UniformSpace` instance on `E`). -/ @[to_additive (attr := reducible) "Construct a seminormed group from a seminorm, i.e., registering the pseudodistance and the pseudometric space structure from the seminorm properties. Note that in most cases this instance creates bad definitional equalities (e.g., it does not take into account a possibly existing `UniformSpace` instance on `E`)."] def GroupSeminorm.toSeminormedCommGroup [CommGroup E] (f : GroupSeminorm E) : SeminormedCommGroup E := { f.toSeminormedGroup with mul_comm := mul_comm } -- See note [reducible non-instances] /-- Construct a normed group from a norm, i.e., registering the distance and the metric space structure from the norm properties. Note that in most cases this instance creates bad definitional equalities (e.g., it does not take into account a possibly existing `UniformSpace` instance on `E`). -/ @[to_additive (attr := reducible) "Construct a normed group from a norm, i.e., registering the distance and the metric space structure from the norm properties. Note that in most cases this instance creates bad definitional equalities (e.g., it does not take into account a possibly existing `UniformSpace` instance on `E`)."] def GroupNorm.toNormedGroup [Group E] (f : GroupNorm E) : NormedGroup E := { f.toGroupSeminorm.toSeminormedGroup with eq_of_dist_eq_zero := fun h => div_eq_one.1 <| eq_one_of_map_eq_zero f h } -- See note [reducible non-instances] /-- Construct a normed group from a norm, i.e., registering the distance and the metric space structure from the norm properties. Note that in most cases this instance creates bad definitional equalities (e.g., it does not take into account a possibly existing `UniformSpace` instance on `E`). -/ @[to_additive (attr := reducible) "Construct a normed group from a norm, i.e., registering the distance and the metric space structure from the norm properties. Note that in most cases this instance creates bad definitional equalities (e.g., it does not take into account a possibly existing `UniformSpace` instance on `E`)."] def GroupNorm.toNormedCommGroup [CommGroup E] (f : GroupNorm E) : NormedCommGroup E := { f.toNormedGroup with mul_comm := mul_comm } section SeminormedGroup variable [SeminormedGroup E] [SeminormedGroup F] [SeminormedGroup G] {s : Set E} {a a₁ a₂ b b₁ b₂ : E} {r r₁ r₂ : ℝ} @[to_additive] theorem dist_eq_norm_div (a b : E) : dist a b = ‖a / b‖ := SeminormedGroup.dist_eq _ _ @[to_additive] theorem dist_eq_norm_div' (a b : E) : dist a b = ‖b / a‖ := by rw [dist_comm, dist_eq_norm_div] alias dist_eq_norm := dist_eq_norm_sub alias dist_eq_norm' := dist_eq_norm_sub' @[to_additive of_forall_le_norm] lemma DiscreteTopology.of_forall_le_norm' (hpos : 0 < r) (hr : ∀ x : E, x ≠ 1 → r ≤ ‖x‖) : DiscreteTopology E := .of_forall_le_dist hpos fun x y hne ↦ by simp only [dist_eq_norm_div] exact hr _ (div_ne_one.2 hne) @[to_additive (attr := simp)] theorem dist_one_right (a : E) : dist a 1 = ‖a‖ := by rw [dist_eq_norm_div, div_one] @[to_additive] theorem inseparable_one_iff_norm {a : E} : Inseparable a 1 ↔ ‖a‖ = 0 := by rw [Metric.inseparable_iff, dist_one_right] @[to_additive (attr := simp)] theorem dist_one_left : dist (1 : E) = norm := funext fun a => by rw [dist_comm, dist_one_right] @[to_additive] theorem norm_div_rev (a b : E) : ‖a / b‖ = ‖b / a‖ := by simpa only [dist_eq_norm_div] using dist_comm a b @[to_additive (attr := simp) norm_neg] theorem norm_inv' (a : E) : ‖a⁻¹‖ = ‖a‖ := by simpa using norm_div_rev 1 a open scoped symmDiff in @[to_additive] theorem dist_mulIndicator (s t : Set α) (f : α → E) (x : α) : dist (s.mulIndicator f x) (t.mulIndicator f x) = ‖(s ∆ t).mulIndicator f x‖ := by rw [dist_eq_norm_div, Set.apply_mulIndicator_symmDiff norm_inv'] /-- **Triangle inequality** for the norm. -/ @[to_additive norm_add_le "**Triangle inequality** for the norm."] theorem norm_mul_le' (a b : E) : ‖a * b‖ ≤ ‖a‖ + ‖b‖ := by simpa [dist_eq_norm_div] using dist_triangle a 1 b⁻¹ @[to_additive] theorem norm_mul_le_of_le (h₁ : ‖a₁‖ ≤ r₁) (h₂ : ‖a₂‖ ≤ r₂) : ‖a₁ * a₂‖ ≤ r₁ + r₂ := (norm_mul_le' a₁ a₂).trans <| add_le_add h₁ h₂ @[to_additive norm_add₃_le] theorem norm_mul₃_le (a b c : E) : ‖a * b * c‖ ≤ ‖a‖ + ‖b‖ + ‖c‖ := norm_mul_le_of_le (norm_mul_le' _ _) le_rfl @[to_additive] lemma norm_div_le_norm_div_add_norm_div (a b c : E) : ‖a / c‖ ≤ ‖a / b‖ + ‖b / c‖ := by simpa only [dist_eq_norm_div] using dist_triangle a b c @[to_additive (attr := simp) norm_nonneg] theorem norm_nonneg' (a : E) : 0 ≤ ‖a‖ := by rw [← dist_one_right] exact dist_nonneg attribute [bound] norm_nonneg @[to_additive (attr := simp) abs_norm] theorem abs_norm' (z : E) : |‖z‖| = ‖z‖ := abs_of_nonneg <| norm_nonneg' _ namespace Mathlib.Meta.Positivity open Lean Meta Qq Function /-- Extension for the `positivity` tactic: multiplicative norms are nonnegative, via `norm_nonneg'`. -/ @[positivity Norm.norm _] def evalMulNorm : PositivityExt where eval {u α} _zα _pα e := do match u, α, e with | 0, ~q(ℝ), ~q(@Norm.norm $β $instDist $a) => let _inst ← synthInstanceQ q(SeminormedGroup $β) assertInstancesCommute pure (.nonnegative q(norm_nonneg' $a)) | _, _, _ => throwError "not ‖ · ‖" /-- Extension for the `positivity` tactic: additive norms are nonnegative, via `norm_nonneg`. -/ @[positivity Norm.norm _] def evalAddNorm : PositivityExt where eval {u α} _zα _pα e := do match u, α, e with | 0, ~q(ℝ), ~q(@Norm.norm $β $instDist $a) => let _inst ← synthInstanceQ q(SeminormedAddGroup $β) assertInstancesCommute pure (.nonnegative q(norm_nonneg $a)) | _, _, _ => throwError "not ‖ · ‖" end Mathlib.Meta.Positivity @[to_additive (attr := simp) norm_zero] theorem norm_one' : ‖(1 : E)‖ = 0 := by rw [← dist_one_right, dist_self] @[to_additive] theorem ne_one_of_norm_ne_zero : ‖a‖ ≠ 0 → a ≠ 1 := mt <| by rintro rfl exact norm_one' @[to_additive (attr := nontriviality) norm_of_subsingleton] theorem norm_of_subsingleton' [Subsingleton E] (a : E) : ‖a‖ = 0 := by rw [Subsingleton.elim a 1, norm_one'] @[to_additive zero_lt_one_add_norm_sq] theorem zero_lt_one_add_norm_sq' (x : E) : 0 < 1 + ‖x‖ ^ 2 := by positivity @[to_additive] theorem norm_div_le (a b : E) : ‖a / b‖ ≤ ‖a‖ + ‖b‖ := by simpa [dist_eq_norm_div] using dist_triangle a 1 b attribute [bound] norm_sub_le @[to_additive] theorem norm_div_le_of_le {r₁ r₂ : ℝ} (H₁ : ‖a₁‖ ≤ r₁) (H₂ : ‖a₂‖ ≤ r₂) : ‖a₁ / a₂‖ ≤ r₁ + r₂ := (norm_div_le a₁ a₂).trans <| add_le_add H₁ H₂ @[to_additive dist_le_norm_add_norm] theorem dist_le_norm_add_norm' (a b : E) : dist a b ≤ ‖a‖ + ‖b‖ := by rw [dist_eq_norm_div] apply norm_div_le @[to_additive abs_norm_sub_norm_le] theorem abs_norm_sub_norm_le' (a b : E) : |‖a‖ - ‖b‖| ≤ ‖a / b‖ := by simpa [dist_eq_norm_div] using abs_dist_sub_le a b 1 @[to_additive norm_sub_norm_le] theorem norm_sub_norm_le' (a b : E) : ‖a‖ - ‖b‖ ≤ ‖a / b‖ := (le_abs_self _).trans (abs_norm_sub_norm_le' a b) @[to_additive dist_norm_norm_le] theorem dist_norm_norm_le' (a b : E) : dist ‖a‖ ‖b‖ ≤ ‖a / b‖ := abs_norm_sub_norm_le' a b @[to_additive] theorem norm_le_norm_add_norm_div' (u v : E) : ‖u‖ ≤ ‖v‖ + ‖u / v‖ := by rw [add_comm] refine (norm_mul_le' _ _).trans_eq' ?_ rw [div_mul_cancel] @[to_additive] theorem norm_le_norm_add_norm_div (u v : E) : ‖v‖ ≤ ‖u‖ + ‖u / v‖ := by rw [norm_div_rev] exact norm_le_norm_add_norm_div' v u alias norm_le_insert' := norm_le_norm_add_norm_sub' alias norm_le_insert := norm_le_norm_add_norm_sub @[to_additive] theorem norm_le_mul_norm_add (u v : E) : ‖u‖ ≤ ‖u * v‖ + ‖v‖ := calc ‖u‖ = ‖u * v / v‖ := by rw [mul_div_cancel_right] _ ≤ ‖u * v‖ + ‖v‖ := norm_div_le _ _ @[to_additive ball_eq] theorem ball_eq' (y : E) (ε : ℝ) : ball y ε = { x | ‖x / y‖ < ε } := Set.ext fun a => by simp [dist_eq_norm_div] @[to_additive] theorem ball_one_eq (r : ℝ) : ball (1 : E) r = { x | ‖x‖ < r } := Set.ext fun a => by simp @[to_additive mem_ball_iff_norm] theorem mem_ball_iff_norm'' : b ∈ ball a r ↔ ‖b / a‖ < r := by rw [mem_ball, dist_eq_norm_div] @[to_additive mem_ball_iff_norm'] theorem mem_ball_iff_norm''' : b ∈ ball a r ↔ ‖a / b‖ < r := by rw [mem_ball', dist_eq_norm_div] @[to_additive] -- Porting note (#10618): `simp` can prove it theorem mem_ball_one_iff : a ∈ ball (1 : E) r ↔ ‖a‖ < r := by rw [mem_ball, dist_one_right] @[to_additive mem_closedBall_iff_norm] theorem mem_closedBall_iff_norm'' : b ∈ closedBall a r ↔ ‖b / a‖ ≤ r := by rw [mem_closedBall, dist_eq_norm_div] @[to_additive] -- Porting note (#10618): `simp` can prove it theorem mem_closedBall_one_iff : a ∈ closedBall (1 : E) r ↔ ‖a‖ ≤ r := by rw [mem_closedBall, dist_one_right] @[to_additive mem_closedBall_iff_norm'] theorem mem_closedBall_iff_norm''' : b ∈ closedBall a r ↔ ‖a / b‖ ≤ r := by rw [mem_closedBall', dist_eq_norm_div] @[to_additive norm_le_of_mem_closedBall] theorem norm_le_of_mem_closedBall' (h : b ∈ closedBall a r) : ‖b‖ ≤ ‖a‖ + r := (norm_le_norm_add_norm_div' _ _).trans <| add_le_add_left (by rwa [← dist_eq_norm_div]) _ @[to_additive norm_le_norm_add_const_of_dist_le] theorem norm_le_norm_add_const_of_dist_le' : dist a b ≤ r → ‖a‖ ≤ ‖b‖ + r := norm_le_of_mem_closedBall' @[to_additive norm_lt_of_mem_ball] theorem norm_lt_of_mem_ball' (h : b ∈ ball a r) : ‖b‖ < ‖a‖ + r := (norm_le_norm_add_norm_div' _ _).trans_lt <| add_lt_add_left (by rwa [← dist_eq_norm_div]) _ @[to_additive] theorem norm_div_sub_norm_div_le_norm_div (u v w : E) : ‖u / w‖ - ‖v / w‖ ≤ ‖u / v‖ := by simpa only [div_div_div_cancel_right'] using norm_sub_norm_le' (u / w) (v / w) @[to_additive (attr := simp 1001) mem_sphere_iff_norm] -- Porting note: increase priority so the left-hand side doesn't reduce theorem mem_sphere_iff_norm' : b ∈ sphere a r ↔ ‖b / a‖ = r := by simp [dist_eq_norm_div] @[to_additive] -- `simp` can prove this theorem mem_sphere_one_iff_norm : a ∈ sphere (1 : E) r ↔ ‖a‖ = r := by simp [dist_eq_norm_div] @[to_additive (attr := simp) norm_eq_of_mem_sphere] theorem norm_eq_of_mem_sphere' (x : sphere (1 : E) r) : ‖(x : E)‖ = r := mem_sphere_one_iff_norm.mp x.2 @[to_additive] theorem ne_one_of_mem_sphere (hr : r ≠ 0) (x : sphere (1 : E) r) : (x : E) ≠ 1 := ne_one_of_norm_ne_zero <| by rwa [norm_eq_of_mem_sphere' x] @[to_additive ne_zero_of_mem_unit_sphere] theorem ne_one_of_mem_unit_sphere (x : sphere (1 : E) 1) : (x : E) ≠ 1 := ne_one_of_mem_sphere one_ne_zero _ variable (E) /-- The norm of a seminormed group as a group seminorm. -/ @[to_additive "The norm of a seminormed group as an additive group seminorm."] def normGroupSeminorm : GroupSeminorm E := ⟨norm, norm_one', norm_mul_le', norm_inv'⟩ @[to_additive (attr := simp)] theorem coe_normGroupSeminorm : ⇑(normGroupSeminorm E) = norm := rfl variable {E} @[to_additive] theorem NormedCommGroup.tendsto_nhds_one {f : α → E} {l : Filter α} : Tendsto f l (𝓝 1) ↔ ∀ ε > 0, ∀ᶠ x in l, ‖f x‖ < ε := Metric.tendsto_nhds.trans <| by simp only [dist_one_right] @[to_additive] theorem NormedCommGroup.tendsto_nhds_nhds {f : E → F} {x : E} {y : F} : Tendsto f (𝓝 x) (𝓝 y) ↔ ∀ ε > 0, ∃ δ > 0, ∀ x', ‖x' / x‖ < δ → ‖f x' / y‖ < ε := by simp_rw [Metric.tendsto_nhds_nhds, dist_eq_norm_div] @[to_additive] theorem NormedCommGroup.nhds_basis_norm_lt (x : E) : (𝓝 x).HasBasis (fun ε : ℝ => 0 < ε) fun ε => { y | ‖y / x‖ < ε } := by simp_rw [← ball_eq'] exact Metric.nhds_basis_ball @[to_additive] theorem NormedCommGroup.nhds_one_basis_norm_lt : (𝓝 (1 : E)).HasBasis (fun ε : ℝ => 0 < ε) fun ε => { y | ‖y‖ < ε } := by convert NormedCommGroup.nhds_basis_norm_lt (1 : E) simp @[to_additive] theorem NormedCommGroup.uniformity_basis_dist : (𝓤 E).HasBasis (fun ε : ℝ => 0 < ε) fun ε => { p : E × E | ‖p.fst / p.snd‖ < ε } := by convert Metric.uniformity_basis_dist (α := E) using 1 simp [dist_eq_norm_div] open Finset variable [FunLike 𝓕 E F] section NNNorm -- See note [lower instance priority] @[to_additive] instance (priority := 100) SeminormedGroup.toNNNorm : NNNorm E := ⟨fun a => ⟨‖a‖, norm_nonneg' a⟩⟩ @[to_additive (attr := simp, norm_cast) coe_nnnorm] theorem coe_nnnorm' (a : E) : (‖a‖₊ : ℝ) = ‖a‖ := rfl @[to_additive (attr := simp) coe_comp_nnnorm] theorem coe_comp_nnnorm' : (toReal : ℝ≥0 → ℝ) ∘ (nnnorm : E → ℝ≥0) = norm := rfl @[to_additive norm_toNNReal] theorem norm_toNNReal' : ‖a‖.toNNReal = ‖a‖₊ := @Real.toNNReal_coe ‖a‖₊ @[to_additive] theorem nndist_eq_nnnorm_div (a b : E) : nndist a b = ‖a / b‖₊ := NNReal.eq <| dist_eq_norm_div _ _ alias nndist_eq_nnnorm := nndist_eq_nnnorm_sub @[to_additive (attr := simp) nnnorm_zero] theorem nnnorm_one' : ‖(1 : E)‖₊ = 0 := NNReal.eq norm_one' @[to_additive] theorem ne_one_of_nnnorm_ne_zero {a : E} : ‖a‖₊ ≠ 0 → a ≠ 1 := mt <| by rintro rfl exact nnnorm_one' @[to_additive nnnorm_add_le] theorem nnnorm_mul_le' (a b : E) : ‖a * b‖₊ ≤ ‖a‖₊ + ‖b‖₊ := NNReal.coe_le_coe.1 <| norm_mul_le' a b @[to_additive (attr := simp) nnnorm_neg] theorem nnnorm_inv' (a : E) : ‖a⁻¹‖₊ = ‖a‖₊ := NNReal.eq <| norm_inv' a open scoped symmDiff in @[to_additive] theorem nndist_mulIndicator (s t : Set α) (f : α → E) (x : α) : nndist (s.mulIndicator f x) (t.mulIndicator f x) = ‖(s ∆ t).mulIndicator f x‖₊ := NNReal.eq <| dist_mulIndicator s t f x @[to_additive] theorem nnnorm_div_le (a b : E) : ‖a / b‖₊ ≤ ‖a‖₊ + ‖b‖₊ := NNReal.coe_le_coe.1 <| norm_div_le _ _ @[to_additive nndist_nnnorm_nnnorm_le] theorem nndist_nnnorm_nnnorm_le' (a b : E) : nndist ‖a‖₊ ‖b‖₊ ≤ ‖a / b‖₊ := NNReal.coe_le_coe.1 <| dist_norm_norm_le' a b @[to_additive] theorem nnnorm_le_nnnorm_add_nnnorm_div (a b : E) : ‖b‖₊ ≤ ‖a‖₊ + ‖a / b‖₊ := norm_le_norm_add_norm_div _ _ @[to_additive] theorem nnnorm_le_nnnorm_add_nnnorm_div' (a b : E) : ‖a‖₊ ≤ ‖b‖₊ + ‖a / b‖₊ := norm_le_norm_add_norm_div' _ _ alias nnnorm_le_insert' := nnnorm_le_nnnorm_add_nnnorm_sub' alias nnnorm_le_insert := nnnorm_le_nnnorm_add_nnnorm_sub @[to_additive] theorem nnnorm_le_mul_nnnorm_add (a b : E) : ‖a‖₊ ≤ ‖a * b‖₊ + ‖b‖₊ := norm_le_mul_norm_add _ _ @[to_additive ofReal_norm_eq_coe_nnnorm] theorem ofReal_norm_eq_coe_nnnorm' (a : E) : ENNReal.ofReal ‖a‖ = ‖a‖₊ := ENNReal.ofReal_eq_coe_nnreal _ /-- The non negative norm seen as an `ENNReal` and then as a `Real` is equal to the norm. -/ @[to_additive toReal_coe_nnnorm "The non negative norm seen as an `ENNReal` and then as a `Real` is equal to the norm."] theorem toReal_coe_nnnorm' (a : E) : (‖a‖₊ : ℝ≥0∞).toReal = ‖a‖ := rfl @[to_additive] theorem edist_eq_coe_nnnorm_div (a b : E) : edist a b = ‖a / b‖₊ := by rw [edist_dist, dist_eq_norm_div, ofReal_norm_eq_coe_nnnorm'] @[to_additive edist_eq_coe_nnnorm] theorem edist_eq_coe_nnnorm' (x : E) : edist x 1 = (‖x‖₊ : ℝ≥0∞) := by rw [edist_eq_coe_nnnorm_div, div_one] open scoped symmDiff in @[to_additive] theorem edist_mulIndicator (s t : Set α) (f : α → E) (x : α) : edist (s.mulIndicator f x) (t.mulIndicator f x) = ‖(s ∆ t).mulIndicator f x‖₊ := by rw [edist_nndist, nndist_mulIndicator] @[to_additive] theorem mem_emetric_ball_one_iff {r : ℝ≥0∞} : a ∈ EMetric.ball (1 : E) r ↔ ↑‖a‖₊ < r := by rw [EMetric.mem_ball, edist_eq_coe_nnnorm'] end NNNorm @[to_additive] theorem tendsto_iff_norm_div_tendsto_zero {f : α → E} {a : Filter α} {b : E} : Tendsto f a (𝓝 b) ↔ Tendsto (fun e => ‖f e / b‖) a (𝓝 0) := by simp only [← dist_eq_norm_div, ← tendsto_iff_dist_tendsto_zero] @[to_additive] theorem tendsto_one_iff_norm_tendsto_zero {f : α → E} {a : Filter α} : Tendsto f a (𝓝 1) ↔ Tendsto (‖f ·‖) a (𝓝 0) := tendsto_iff_norm_div_tendsto_zero.trans <| by simp only [div_one] @[to_additive] theorem comap_norm_nhds_one : comap norm (𝓝 0) = 𝓝 (1 : E) := by simpa only [dist_one_right] using nhds_comap_dist (1 : E) /-- Special case of the sandwich theorem: if the norm of `f` is eventually bounded by a real function `a` which tends to `0`, then `f` tends to `1` (neutral element of `SeminormedGroup`). In this pair of lemmas (`squeeze_one_norm'` and `squeeze_one_norm`), following a convention of similar lemmas in `Topology.MetricSpace.Basic` and `Topology.Algebra.Order`, the `'` version is phrased using "eventually" and the non-`'` version is phrased absolutely. -/ @[to_additive "Special case of the sandwich theorem: if the norm of `f` is eventually bounded by a real function `a` which tends to `0`, then `f` tends to `0`. In this pair of lemmas (`squeeze_zero_norm'` and `squeeze_zero_norm`), following a convention of similar lemmas in `Topology.MetricSpace.Pseudo.Defs` and `Topology.Algebra.Order`, the `'` version is phrased using \"eventually\" and the non-`'` version is phrased absolutely."] theorem squeeze_one_norm' {f : α → E} {a : α → ℝ} {t₀ : Filter α} (h : ∀ᶠ n in t₀, ‖f n‖ ≤ a n) (h' : Tendsto a t₀ (𝓝 0)) : Tendsto f t₀ (𝓝 1) := tendsto_one_iff_norm_tendsto_zero.2 <| squeeze_zero' (eventually_of_forall fun _n => norm_nonneg' _) h h' /-- Special case of the sandwich theorem: if the norm of `f` is bounded by a real function `a` which tends to `0`, then `f` tends to `1`. -/ @[to_additive "Special case of the sandwich theorem: if the norm of `f` is bounded by a real function `a` which tends to `0`, then `f` tends to `0`."] theorem squeeze_one_norm {f : α → E} {a : α → ℝ} {t₀ : Filter α} (h : ∀ n, ‖f n‖ ≤ a n) : Tendsto a t₀ (𝓝 0) → Tendsto f t₀ (𝓝 1) := squeeze_one_norm' <| eventually_of_forall h @[to_additive] theorem tendsto_norm_div_self (x : E) : Tendsto (fun a => ‖a / x‖) (𝓝 x) (𝓝 0) := by simpa [dist_eq_norm_div] using tendsto_id.dist (tendsto_const_nhds : Tendsto (fun _a => (x : E)) (𝓝 x) _) @[to_additive tendsto_norm] theorem tendsto_norm' {x : E} : Tendsto (fun a => ‖a‖) (𝓝 x) (𝓝 ‖x‖) := by simpa using tendsto_id.dist (tendsto_const_nhds : Tendsto (fun _a => (1 : E)) _ _) @[to_additive] theorem tendsto_norm_one : Tendsto (fun a : E => ‖a‖) (𝓝 1) (𝓝 0) := by simpa using tendsto_norm_div_self (1 : E) @[to_additive (attr := continuity) continuous_norm] theorem continuous_norm' : Continuous fun a : E => ‖a‖ := by simpa using continuous_id.dist (continuous_const : Continuous fun _a => (1 : E)) @[to_additive (attr := continuity) continuous_nnnorm] theorem continuous_nnnorm' : Continuous fun a : E => ‖a‖₊ := continuous_norm'.subtype_mk _ @[to_additive] theorem mem_closure_one_iff_norm {x : E} : x ∈ closure ({1} : Set E) ↔ ‖x‖ = 0 := by rw [← closedBall_zero', mem_closedBall_one_iff, (norm_nonneg' x).le_iff_eq] @[to_additive] theorem closure_one_eq : closure ({1} : Set E) = { x | ‖x‖ = 0 } := Set.ext fun _x => mem_closure_one_iff_norm section variable {l : Filter α} {f : α → E} @[to_additive Filter.Tendsto.norm] theorem Filter.Tendsto.norm' (h : Tendsto f l (𝓝 a)) : Tendsto (fun x => ‖f x‖) l (𝓝 ‖a‖) := tendsto_norm'.comp h @[to_additive Filter.Tendsto.nnnorm] theorem Filter.Tendsto.nnnorm' (h : Tendsto f l (𝓝 a)) : Tendsto (fun x => ‖f x‖₊) l (𝓝 ‖a‖₊) := Tendsto.comp continuous_nnnorm'.continuousAt h end section variable [TopologicalSpace α] {f : α → E} @[to_additive (attr := fun_prop) Continuous.norm] theorem Continuous.norm' : Continuous f → Continuous fun x => ‖f x‖ := continuous_norm'.comp @[to_additive (attr := fun_prop) Continuous.nnnorm] theorem Continuous.nnnorm' : Continuous f → Continuous fun x => ‖f x‖₊ := continuous_nnnorm'.comp @[to_additive (attr := fun_prop) ContinuousAt.norm] theorem ContinuousAt.norm' {a : α} (h : ContinuousAt f a) : ContinuousAt (fun x => ‖f x‖) a := Tendsto.norm' h @[to_additive (attr := fun_prop) ContinuousAt.nnnorm] theorem ContinuousAt.nnnorm' {a : α} (h : ContinuousAt f a) : ContinuousAt (fun x => ‖f x‖₊) a := Tendsto.nnnorm' h @[to_additive ContinuousWithinAt.norm] theorem ContinuousWithinAt.norm' {s : Set α} {a : α} (h : ContinuousWithinAt f s a) : ContinuousWithinAt (fun x => ‖f x‖) s a := Tendsto.norm' h @[to_additive ContinuousWithinAt.nnnorm] theorem ContinuousWithinAt.nnnorm' {s : Set α} {a : α} (h : ContinuousWithinAt f s a) : ContinuousWithinAt (fun x => ‖f x‖₊) s a := Tendsto.nnnorm' h @[to_additive (attr := fun_prop) ContinuousOn.norm] theorem ContinuousOn.norm' {s : Set α} (h : ContinuousOn f s) : ContinuousOn (fun x => ‖f x‖) s := fun x hx => (h x hx).norm' @[to_additive (attr := fun_prop) ContinuousOn.nnnorm] theorem ContinuousOn.nnnorm' {s : Set α} (h : ContinuousOn f s) : ContinuousOn (fun x => ‖f x‖₊) s := fun x hx => (h x hx).nnnorm' end /-- If `‖y‖ → ∞`, then we can assume `y ≠ x` for any fixed `x`. -/ @[to_additive eventually_ne_of_tendsto_norm_atTop "If `‖y‖→∞`, then we can assume `y≠x` for any fixed `x`"] theorem eventually_ne_of_tendsto_norm_atTop' {l : Filter α} {f : α → E} (h : Tendsto (fun y => ‖f y‖) l atTop) (x : E) : ∀ᶠ y in l, f y ≠ x := (h.eventually_ne_atTop _).mono fun _x => ne_of_apply_ne norm @[to_additive] theorem SeminormedCommGroup.mem_closure_iff : a ∈ closure s ↔ ∀ ε, 0 < ε → ∃ b ∈ s, ‖a / b‖ < ε := by simp [Metric.mem_closure_iff, dist_eq_norm_div] @[to_additive norm_le_zero_iff'] theorem norm_le_zero_iff''' [T0Space E] {a : E} : ‖a‖ ≤ 0 ↔ a = 1 := by letI : NormedGroup E := { ‹SeminormedGroup E› with toMetricSpace := MetricSpace.ofT0PseudoMetricSpace E } rw [← dist_one_right, dist_le_zero] @[to_additive norm_eq_zero'] theorem norm_eq_zero''' [T0Space E] {a : E} : ‖a‖ = 0 ↔ a = 1 := (norm_nonneg' a).le_iff_eq.symm.trans norm_le_zero_iff''' @[to_additive norm_pos_iff'] theorem norm_pos_iff''' [T0Space E] {a : E} : 0 < ‖a‖ ↔ a ≠ 1 := by rw [← not_le, norm_le_zero_iff'''] @[to_additive] theorem SeminormedGroup.tendstoUniformlyOn_one {f : ι → κ → G} {s : Set κ} {l : Filter ι} : TendstoUniformlyOn f 1 l s ↔ ∀ ε > 0, ∀ᶠ i in l, ∀ x ∈ s, ‖f i x‖ < ε := by #adaptation_note /-- nightly-2024-03-11. Originally this was `simp_rw` instead of `simp only`, but this creates a bad proof term with nested `OfNat.ofNat` that trips up `@[to_additive]`. -/ simp only [tendstoUniformlyOn_iff, Pi.one_apply, dist_one_left] @[to_additive] theorem SeminormedGroup.uniformCauchySeqOnFilter_iff_tendstoUniformlyOnFilter_one {f : ι → κ → G} {l : Filter ι} {l' : Filter κ} : UniformCauchySeqOnFilter f l l' ↔ TendstoUniformlyOnFilter (fun n : ι × ι => fun z => f n.fst z / f n.snd z) 1 (l ×ˢ l) l' := by refine ⟨fun hf u hu => ?_, fun hf u hu => ?_⟩ · obtain ⟨ε, hε, H⟩ := uniformity_basis_dist.mem_uniformity_iff.mp hu refine (hf { p : G × G | dist p.fst p.snd < ε } <| dist_mem_uniformity hε).mono fun x hx => H 1 (f x.fst.fst x.snd / f x.fst.snd x.snd) ?_ simpa [dist_eq_norm_div, norm_div_rev] using hx · obtain ⟨ε, hε, H⟩ := uniformity_basis_dist.mem_uniformity_iff.mp hu refine (hf { p : G × G | dist p.fst p.snd < ε } <| dist_mem_uniformity hε).mono fun x hx => H (f x.fst.fst x.snd) (f x.fst.snd x.snd) ?_ simpa [dist_eq_norm_div, norm_div_rev] using hx @[to_additive] theorem SeminormedGroup.uniformCauchySeqOn_iff_tendstoUniformlyOn_one {f : ι → κ → G} {s : Set κ} {l : Filter ι} : UniformCauchySeqOn f l s ↔ TendstoUniformlyOn (fun n : ι × ι => fun z => f n.fst z / f n.snd z) 1 (l ×ˢ l) s := by rw [tendstoUniformlyOn_iff_tendstoUniformlyOnFilter, uniformCauchySeqOn_iff_uniformCauchySeqOnFilter, SeminormedGroup.uniformCauchySeqOnFilter_iff_tendstoUniformlyOnFilter_one] end SeminormedGroup section Induced variable (E F) variable [FunLike 𝓕 E F] -- See note [reducible non-instances] /-- A group homomorphism from a `Group` to a `SeminormedGroup` induces a `SeminormedGroup` structure on the domain. -/ @[to_additive (attr := reducible) "A group homomorphism from an `AddGroup` to a `SeminormedAddGroup` induces a `SeminormedAddGroup` structure on the domain."] def SeminormedGroup.induced [Group E] [SeminormedGroup F] [MonoidHomClass 𝓕 E F] (f : 𝓕) : SeminormedGroup E := { PseudoMetricSpace.induced f toPseudoMetricSpace with -- Porting note: needed to add the instance explicitly, and `‹PseudoMetricSpace F›` failed norm := fun x => ‖f x‖ dist_eq := fun x y => by simp only [map_div, ← dist_eq_norm_div]; rfl } -- See note [reducible non-instances] /-- A group homomorphism from a `CommGroup` to a `SeminormedGroup` induces a `SeminormedCommGroup` structure on the domain. -/ @[to_additive (attr := reducible) "A group homomorphism from an `AddCommGroup` to a `SeminormedAddGroup` induces a `SeminormedAddCommGroup` structure on the domain."] def SeminormedCommGroup.induced [CommGroup E] [SeminormedGroup F] [MonoidHomClass 𝓕 E F] (f : 𝓕) : SeminormedCommGroup E := { SeminormedGroup.induced E F f with mul_comm := mul_comm } -- See note [reducible non-instances]. /-- An injective group homomorphism from a `Group` to a `NormedGroup` induces a `NormedGroup` structure on the domain. -/ @[to_additive (attr := reducible) "An injective group homomorphism from an `AddGroup` to a `NormedAddGroup` induces a `NormedAddGroup` structure on the domain."] def NormedGroup.induced [Group E] [NormedGroup F] [MonoidHomClass 𝓕 E F] (f : 𝓕) (h : Injective f) : NormedGroup E := { SeminormedGroup.induced E F f, MetricSpace.induced f h _ with } -- See note [reducible non-instances]. /-- An injective group homomorphism from a `CommGroup` to a `NormedGroup` induces a `NormedCommGroup` structure on the domain. -/ @[to_additive (attr := reducible) "An injective group homomorphism from a `CommGroup` to a `NormedCommGroup` induces a `NormedCommGroup` structure on the domain."] def NormedCommGroup.induced [CommGroup E] [NormedGroup F] [MonoidHomClass 𝓕 E F] (f : 𝓕) (h : Injective f) : NormedCommGroup E := { SeminormedGroup.induced E F f, MetricSpace.induced f h _ with mul_comm := mul_comm } end Induced section SeminormedCommGroup variable [SeminormedCommGroup E] [SeminormedCommGroup F] {a a₁ a₂ b b₁ b₂ : E} {r r₁ r₂ : ℝ} @[to_additive] theorem dist_inv (x y : E) : dist x⁻¹ y = dist x y⁻¹ := by simp_rw [dist_eq_norm_div, ← norm_inv' (x⁻¹ / y), inv_div, div_inv_eq_mul, mul_comm] theorem norm_multiset_sum_le {E} [SeminormedAddCommGroup E] (m : Multiset E) : ‖m.sum‖ ≤ (m.map fun x => ‖x‖).sum := m.le_sum_of_subadditive norm norm_zero norm_add_le @[to_additive existing] theorem norm_multiset_prod_le (m : Multiset E) : ‖m.prod‖ ≤ (m.map fun x => ‖x‖).sum := by rw [← Multiplicative.ofAdd_le, ofAdd_multiset_prod, Multiset.map_map] refine Multiset.le_prod_of_submultiplicative (Multiplicative.ofAdd ∘ norm) ?_ (fun x y => ?_) _ · simp only [comp_apply, norm_one', ofAdd_zero] · exact norm_mul_le' x y -- Porting note: had to add `ι` here because otherwise the universe order gets switched compared to -- `norm_prod_le` below @[bound] theorem norm_sum_le {ι E} [SeminormedAddCommGroup E] (s : Finset ι) (f : ι → E) : ‖∑ i ∈ s, f i‖ ≤ ∑ i ∈ s, ‖f i‖ := s.le_sum_of_subadditive norm norm_zero norm_add_le f @[to_additive existing] theorem norm_prod_le (s : Finset ι) (f : ι → E) : ‖∏ i ∈ s, f i‖ ≤ ∑ i ∈ s, ‖f i‖ := by rw [← Multiplicative.ofAdd_le, ofAdd_sum] refine Finset.le_prod_of_submultiplicative (Multiplicative.ofAdd ∘ norm) ?_ (fun x y => ?_) _ _ · simp only [comp_apply, norm_one', ofAdd_zero] · exact norm_mul_le' x y @[to_additive] theorem norm_prod_le_of_le (s : Finset ι) {f : ι → E} {n : ι → ℝ} (h : ∀ b ∈ s, ‖f b‖ ≤ n b) : ‖∏ b ∈ s, f b‖ ≤ ∑ b ∈ s, n b := (norm_prod_le s f).trans <| Finset.sum_le_sum h @[to_additive] theorem dist_prod_prod_le_of_le (s : Finset ι) {f a : ι → E} {d : ι → ℝ} (h : ∀ b ∈ s, dist (f b) (a b) ≤ d b) : dist (∏ b ∈ s, f b) (∏ b ∈ s, a b) ≤ ∑ b ∈ s, d b := by simp only [dist_eq_norm_div, ← Finset.prod_div_distrib] at * exact norm_prod_le_of_le s h @[to_additive] theorem dist_prod_prod_le (s : Finset ι) (f a : ι → E) : dist (∏ b ∈ s, f b) (∏ b ∈ s, a b) ≤ ∑ b ∈ s, dist (f b) (a b) := dist_prod_prod_le_of_le s fun _ _ => le_rfl @[to_additive] theorem mul_mem_ball_iff_norm : a * b ∈ ball a r ↔ ‖b‖ < r := by rw [mem_ball_iff_norm'', mul_div_cancel_left] @[to_additive] theorem mul_mem_closedBall_iff_norm : a * b ∈ closedBall a r ↔ ‖b‖ ≤ r := by rw [mem_closedBall_iff_norm'', mul_div_cancel_left] @[to_additive (attr := simp 1001)] -- Porting note: increase priority so that the left-hand side doesn't simplify theorem preimage_mul_ball (a b : E) (r : ℝ) : (b * ·) ⁻¹' ball a r = ball (a / b) r := by ext c simp only [dist_eq_norm_div, Set.mem_preimage, mem_ball, div_div_eq_mul_div, mul_comm] @[to_additive (attr := simp 1001)] -- Porting note: increase priority so that the left-hand side doesn't simplify theorem preimage_mul_closedBall (a b : E) (r : ℝ) : (b * ·) ⁻¹' closedBall a r = closedBall (a / b) r := by ext c simp only [dist_eq_norm_div, Set.mem_preimage, mem_closedBall, div_div_eq_mul_div, mul_comm] @[to_additive (attr := simp)] theorem preimage_mul_sphere (a b : E) (r : ℝ) : (b * ·) ⁻¹' sphere a r = sphere (a / b) r := by ext c simp only [Set.mem_preimage, mem_sphere_iff_norm', div_div_eq_mul_div, mul_comm] @[to_additive norm_nsmul_le] theorem norm_pow_le_mul_norm (n : ℕ) (a : E) : ‖a ^ n‖ ≤ n * ‖a‖ := by induction' n with n ih; · simp simpa only [pow_succ, Nat.cast_succ, add_mul, one_mul] using norm_mul_le_of_le ih le_rfl @[to_additive nnnorm_nsmul_le] theorem nnnorm_pow_le_mul_norm (n : ℕ) (a : E) : ‖a ^ n‖₊ ≤ n * ‖a‖₊ := by simpa only [← NNReal.coe_le_coe, NNReal.coe_mul, NNReal.coe_natCast] using norm_pow_le_mul_norm n a @[to_additive] theorem pow_mem_closedBall {n : ℕ} (h : a ∈ closedBall b r) : a ^ n ∈ closedBall (b ^ n) (n • r) := by simp only [mem_closedBall, dist_eq_norm_div, ← div_pow] at h ⊢ refine (norm_pow_le_mul_norm n (a / b)).trans ?_ simpa only [nsmul_eq_mul] using mul_le_mul_of_nonneg_left h n.cast_nonneg @[to_additive] theorem pow_mem_ball {n : ℕ} (hn : 0 < n) (h : a ∈ ball b r) : a ^ n ∈ ball (b ^ n) (n • r) := by simp only [mem_ball, dist_eq_norm_div, ← div_pow] at h ⊢ refine lt_of_le_of_lt (norm_pow_le_mul_norm n (a / b)) ?_ replace hn : 0 < (n : ℝ) := by norm_cast rw [nsmul_eq_mul] nlinarith @[to_additive] -- Porting note (#10618): `simp` can prove this theorem mul_mem_closedBall_mul_iff {c : E} : a * c ∈ closedBall (b * c) r ↔ a ∈ closedBall b r := by simp only [mem_closedBall, dist_eq_norm_div, mul_div_mul_right_eq_div] @[to_additive] -- Porting note (#10618): `simp` can prove this theorem mul_mem_ball_mul_iff {c : E} : a * c ∈ ball (b * c) r ↔ a ∈ ball b r := by simp only [mem_ball, dist_eq_norm_div, mul_div_mul_right_eq_div] @[to_additive] theorem smul_closedBall'' : a • closedBall b r = closedBall (a • b) r := by ext simp [mem_closedBall, Set.mem_smul_set, dist_eq_norm_div, _root_.div_eq_inv_mul, ← eq_inv_mul_iff_mul_eq, mul_assoc] -- Porting note: `ENNReal.div_eq_inv_mul` should be `protected`? @[to_additive] theorem smul_ball'' : a • ball b r = ball (a • b) r := by ext simp [mem_ball, Set.mem_smul_set, dist_eq_norm_div, _root_.div_eq_inv_mul, ← eq_inv_mul_iff_mul_eq, mul_assoc] open Finset @[to_additive] theorem controlled_prod_of_mem_closure {s : Subgroup E} (hg : a ∈ closure (s : Set E)) {b : ℕ → ℝ} (b_pos : ∀ n, 0 < b n) : ∃ v : ℕ → E, Tendsto (fun n => ∏ i ∈ range (n + 1), v i) atTop (𝓝 a) ∧ (∀ n, v n ∈ s) ∧ ‖v 0 / a‖ < b 0 ∧ ∀ n, 0 < n → ‖v n‖ < b n := by obtain ⟨u : ℕ → E, u_in : ∀ n, u n ∈ s, lim_u : Tendsto u atTop (𝓝 a)⟩ := mem_closure_iff_seq_limit.mp hg obtain ⟨n₀, hn₀⟩ : ∃ n₀, ∀ n ≥ n₀, ‖u n / a‖ < b 0 := haveI : { x | ‖x / a‖ < b 0 } ∈ 𝓝 a := by simp_rw [← dist_eq_norm_div] exact Metric.ball_mem_nhds _ (b_pos _) Filter.tendsto_atTop'.mp lim_u _ this set z : ℕ → E := fun n => u (n + n₀) have lim_z : Tendsto z atTop (𝓝 a) := lim_u.comp (tendsto_add_atTop_nat n₀) have mem_𝓤 : ∀ n, { p : E × E | ‖p.1 / p.2‖ < b (n + 1) } ∈ 𝓤 E := fun n => by simpa [← dist_eq_norm_div] using Metric.dist_mem_uniformity (b_pos <| n + 1) obtain ⟨φ : ℕ → ℕ, φ_extr : StrictMono φ, hφ : ∀ n, ‖z (φ <| n + 1) / z (φ n)‖ < b (n + 1)⟩ := lim_z.cauchySeq.subseq_mem mem_𝓤 set w : ℕ → E := z ∘ φ have hw : Tendsto w atTop (𝓝 a) := lim_z.comp φ_extr.tendsto_atTop set v : ℕ → E := fun i => if i = 0 then w 0 else w i / w (i - 1) refine ⟨v, Tendsto.congr (Finset.eq_prod_range_div' w) hw, ?_, hn₀ _ (n₀.le_add_left _), ?_⟩ · rintro ⟨⟩ · change w 0 ∈ s apply u_in · apply s.div_mem <;> apply u_in · intro l hl obtain ⟨k, rfl⟩ : ∃ k, l = k + 1 := Nat.exists_eq_succ_of_ne_zero hl.ne' apply hφ @[to_additive] theorem controlled_prod_of_mem_closure_range {j : E →* F} {b : F} (hb : b ∈ closure (j.range : Set F)) {f : ℕ → ℝ} (b_pos : ∀ n, 0 < f n) : ∃ a : ℕ → E, Tendsto (fun n => ∏ i ∈ range (n + 1), j (a i)) atTop (𝓝 b) ∧ ‖j (a 0) / b‖ < f 0 ∧ ∀ n, 0 < n → ‖j (a n)‖ < f n := by obtain ⟨v, sum_v, v_in, hv₀, hv_pos⟩ := controlled_prod_of_mem_closure hb b_pos choose g hg using v_in exact ⟨g, by simpa [← hg] using sum_v, by simpa [hg 0] using hv₀, fun n hn => by simpa [hg] using hv_pos n hn⟩ @[to_additive] theorem nnnorm_multiset_prod_le (m : Multiset E) : ‖m.prod‖₊ ≤ (m.map fun x => ‖x‖₊).sum := NNReal.coe_le_coe.1 <| by push_cast rw [Multiset.map_map] exact norm_multiset_prod_le _ @[to_additive] theorem nnnorm_prod_le (s : Finset ι) (f : ι → E) : ‖∏ a ∈ s, f a‖₊ ≤ ∑ a ∈ s, ‖f a‖₊ := NNReal.coe_le_coe.1 <| by push_cast exact norm_prod_le _ _ @[to_additive] theorem nnnorm_prod_le_of_le (s : Finset ι) {f : ι → E} {n : ι → ℝ≥0} (h : ∀ b ∈ s, ‖f b‖₊ ≤ n b) : ‖∏ b ∈ s, f b‖₊ ≤ ∑ b ∈ s, n b := (norm_prod_le_of_le s h).trans_eq NNReal.coe_sum.symm namespace Real instance norm : Norm ℝ where norm r := |r| @[simp] theorem norm_eq_abs (r : ℝ) : ‖r‖ = |r| := rfl instance normedAddCommGroup : NormedAddCommGroup ℝ := ⟨fun _r _y => rfl⟩ theorem norm_of_nonneg (hr : 0 ≤ r) : ‖r‖ = r := abs_of_nonneg hr theorem norm_of_nonpos (hr : r ≤ 0) : ‖r‖ = -r := abs_of_nonpos hr theorem le_norm_self (r : ℝ) : r ≤ ‖r‖ := le_abs_self r -- Porting note (#10618): `simp` can prove this theorem norm_natCast (n : ℕ) : ‖(n : ℝ)‖ = n := abs_of_nonneg n.cast_nonneg @[simp] theorem nnnorm_natCast (n : ℕ) : ‖(n : ℝ)‖₊ = n := NNReal.eq <| norm_natCast _ @[deprecated (since := "2024-04-05")] alias norm_coe_nat := norm_natCast @[deprecated (since := "2024-04-05")] alias nnnorm_coe_nat := nnnorm_natCast -- Porting note (#10618): `simp` can prove this theorem norm_two : ‖(2 : ℝ)‖ = 2 := abs_of_pos zero_lt_two @[simp] theorem nnnorm_two : ‖(2 : ℝ)‖₊ = 2 := NNReal.eq <| by simp theorem nnnorm_of_nonneg (hr : 0 ≤ r) : ‖r‖₊ = ⟨r, hr⟩ := NNReal.eq <| norm_of_nonneg hr @[simp] theorem nnnorm_abs (r : ℝ) : ‖|r|‖₊ = ‖r‖₊ := by simp [nnnorm] theorem ennnorm_eq_ofReal (hr : 0 ≤ r) : (‖r‖₊ : ℝ≥0∞) = ENNReal.ofReal r := by rw [← ofReal_norm_eq_coe_nnnorm, norm_of_nonneg hr] theorem ennnorm_eq_ofReal_abs (r : ℝ) : (‖r‖₊ : ℝ≥0∞) = ENNReal.ofReal |r| := by rw [← Real.nnnorm_abs r, Real.ennnorm_eq_ofReal (abs_nonneg _)] theorem toNNReal_eq_nnnorm_of_nonneg (hr : 0 ≤ r) : r.toNNReal = ‖r‖₊ := by rw [Real.toNNReal_of_nonneg hr] ext rw [coe_mk, coe_nnnorm r, Real.norm_eq_abs r, abs_of_nonneg hr] -- Porting note: this is due to the change from `Subtype.val` to `NNReal.toReal` for the coercion theorem ofReal_le_ennnorm (r : ℝ) : ENNReal.ofReal r ≤ ‖r‖₊ := by obtain hr | hr := le_total 0 r · exact (Real.ennnorm_eq_ofReal hr).ge · rw [ENNReal.ofReal_eq_zero.2 hr] exact bot_le -- Porting note: should this be renamed to `Real.ofReal_le_nnnorm`? end Real namespace NNReal instance : NNNorm ℝ≥0 where nnnorm x := x @[simp] lemma nnnorm_eq_self (x : ℝ≥0) : ‖x‖₊ = x := rfl end NNReal end SeminormedCommGroup section NormedGroup variable [NormedGroup E] [NormedGroup F] {a b : E} @[to_additive (attr := simp) norm_eq_zero] theorem norm_eq_zero'' : ‖a‖ = 0 ↔ a = 1 := norm_eq_zero''' @[to_additive norm_ne_zero_iff] theorem norm_ne_zero_iff' : ‖a‖ ≠ 0 ↔ a ≠ 1 := norm_eq_zero''.not @[to_additive (attr := simp) norm_pos_iff] theorem norm_pos_iff'' : 0 < ‖a‖ ↔ a ≠ 1 := norm_pos_iff''' @[to_additive (attr := simp) norm_le_zero_iff] theorem norm_le_zero_iff'' : ‖a‖ ≤ 0 ↔ a = 1 := norm_le_zero_iff''' @[to_additive] theorem norm_div_eq_zero_iff : ‖a / b‖ = 0 ↔ a = b := by rw [norm_eq_zero'', div_eq_one] @[to_additive] theorem norm_div_pos_iff : 0 < ‖a / b‖ ↔ a ≠ b := by rw [(norm_nonneg' _).lt_iff_ne, ne_comm] exact norm_div_eq_zero_iff.not @[to_additive eq_of_norm_sub_le_zero] theorem eq_of_norm_div_le_zero (h : ‖a / b‖ ≤ 0) : a = b := by rwa [← div_eq_one, ← norm_le_zero_iff''] alias ⟨eq_of_norm_div_eq_zero, _⟩ := norm_div_eq_zero_iff attribute [to_additive] eq_of_norm_div_eq_zero @[to_additive (attr := simp) nnnorm_eq_zero] theorem nnnorm_eq_zero' : ‖a‖₊ = 0 ↔ a = 1 := by rw [← NNReal.coe_eq_zero, coe_nnnorm', norm_eq_zero''] @[to_additive nnnorm_ne_zero_iff] theorem nnnorm_ne_zero_iff' : ‖a‖₊ ≠ 0 ↔ a ≠ 1 := nnnorm_eq_zero'.not @[to_additive (attr := simp) nnnorm_pos] lemma nnnorm_pos' : 0 < ‖a‖₊ ↔ a ≠ 1 := pos_iff_ne_zero.trans nnnorm_ne_zero_iff' @[to_additive] theorem tendsto_norm_div_self_punctured_nhds (a : E) : Tendsto (fun x => ‖x / a‖) (𝓝[≠] a) (𝓝[>] 0) := (tendsto_norm_div_self a).inf <| tendsto_principal_principal.2 fun _x hx => norm_pos_iff''.2 <| div_ne_one.2 hx @[to_additive] theorem tendsto_norm_nhdsWithin_one : Tendsto (norm : E → ℝ) (𝓝[≠] 1) (𝓝[>] 0) := tendsto_norm_one.inf <| tendsto_principal_principal.2 fun _x => norm_pos_iff''.2 variable (E) /-- The norm of a normed group as a group norm. -/ @[to_additive "The norm of a normed group as an additive group norm."] def normGroupNorm : GroupNorm E := { normGroupSeminorm _ with eq_one_of_map_eq_zero' := fun _ => norm_eq_zero''.1 } @[simp] theorem coe_normGroupNorm : ⇑(normGroupNorm E) = norm := rfl @[to_additive comap_norm_nhdsWithin_Ioi_zero] lemma comap_norm_nhdsWithin_Ioi_zero' : comap norm (𝓝[>] 0) = 𝓝[≠] (1 : E) := by simp [nhdsWithin, comap_norm_nhds_one, Set.preimage, Set.compl_def] end NormedGroup section NormedAddGroup variable [NormedAddGroup E] [TopologicalSpace α] {f : α → E} /-! Some relations with `HasCompactSupport` -/ theorem hasCompactSupport_norm_iff : (HasCompactSupport fun x => ‖f x‖) ↔ HasCompactSupport f := hasCompactSupport_comp_left norm_eq_zero alias ⟨_, HasCompactSupport.norm⟩ := hasCompactSupport_norm_iff end NormedAddGroup /-! ### Subgroups of normed groups -/ namespace Subgroup section SeminormedGroup variable [SeminormedGroup E] {s : Subgroup E} /-- A subgroup of a seminormed group is also a seminormed group, with the restriction of the norm. -/ @[to_additive "A subgroup of a seminormed group is also a seminormed group, with the restriction of the norm."] instance seminormedGroup : SeminormedGroup s := SeminormedGroup.induced _ _ s.subtype /-- If `x` is an element of a subgroup `s` of a seminormed group `E`, its norm in `s` is equal to its norm in `E`. -/ @[to_additive (attr := simp) "If `x` is an element of a subgroup `s` of a seminormed group `E`, its norm in `s` is equal to its norm in `E`."] theorem coe_norm (x : s) : ‖x‖ = ‖(x : E)‖ := rfl /-- If `x` is an element of a subgroup `s` of a seminormed group `E`, its norm in `s` is equal to its norm in `E`. This is a reversed version of the `simp` lemma `Subgroup.coe_norm` for use by `norm_cast`. -/ @[to_additive (attr := norm_cast) "If `x` is an element of a subgroup `s` of a seminormed group `E`, its norm in `s` is equal to its norm in `E`. This is a reversed version of the `simp` lemma `AddSubgroup.coe_norm` for use by `norm_cast`."] theorem norm_coe {s : Subgroup E} (x : s) : ‖(x : E)‖ = ‖x‖ := rfl end SeminormedGroup @[to_additive] instance seminormedCommGroup [SeminormedCommGroup E] {s : Subgroup E} : SeminormedCommGroup s := SeminormedCommGroup.induced _ _ s.subtype @[to_additive] instance normedGroup [NormedGroup E] {s : Subgroup E} : NormedGroup s := NormedGroup.induced _ _ s.subtype Subtype.coe_injective @[to_additive] instance normedCommGroup [NormedCommGroup E] {s : Subgroup E} : NormedCommGroup s := NormedCommGroup.induced _ _ s.subtype Subtype.coe_injective end Subgroup /-! ### Subgroup classes of normed groups -/ namespace SubgroupClass section SeminormedGroup variable [SeminormedGroup E] {S : Type*} [SetLike S E] [SubgroupClass S E] (s : S) /-- A subgroup of a seminormed group is also a seminormed group, with the restriction of the norm. -/ @[to_additive "A subgroup of a seminormed additive group is also a seminormed additive group, with the restriction of the norm."] instance (priority := 75) seminormedGroup : SeminormedGroup s := SeminormedGroup.induced _ _ (SubgroupClass.subtype s) /-- If `x` is an element of a subgroup `s` of a seminormed group `E`, its norm in `s` is equal to its norm in `E`. -/ @[to_additive (attr := simp) "If `x` is an element of an additive subgroup `s` of a seminormed additive group `E`, its norm in `s` is equal to its norm in `E`."] theorem coe_norm (x : s) : ‖x‖ = ‖(x : E)‖ := rfl end SeminormedGroup @[to_additive] instance (priority := 75) seminormedCommGroup [SeminormedCommGroup E] {S : Type*} [SetLike S E] [SubgroupClass S E] (s : S) : SeminormedCommGroup s := SeminormedCommGroup.induced _ _ (SubgroupClass.subtype s) @[to_additive] instance (priority := 75) normedGroup [NormedGroup E] {S : Type*} [SetLike S E] [SubgroupClass S E] (s : S) : NormedGroup s := NormedGroup.induced _ _ (SubgroupClass.subtype s) Subtype.coe_injective @[to_additive] instance (priority := 75) normedCommGroup [NormedCommGroup E] {S : Type*} [SetLike S E] [SubgroupClass S E] (s : S) : NormedCommGroup s := NormedCommGroup.induced _ _ (SubgroupClass.subtype s) Subtype.coe_injective end SubgroupClass
Analysis\Normed\Group\Bounded.lean
/- Copyright (c) 2018 Patrick Massot. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Johannes Hölzl, Yaël Dillies -/ import Mathlib.Analysis.Normed.Group.Basic import Mathlib.Topology.MetricSpace.Bounded import Mathlib.Order.Filter.Pointwise import Mathlib.Order.LiminfLimsup /-! # Boundedness in normed groups This file rephrases metric boundedness in terms of norms. ## Tags normed group -/ open Filter Metric Bornology open scoped Pointwise Topology variable {α ι E F G : Type*} section SeminormedGroup variable [SeminormedGroup E] [SeminormedGroup F] [SeminormedGroup G] {s : Set E} {a a₁ a₂ b b₁ b₂ : E} {r r₁ r₂ : ℝ} @[to_additive (attr := simp) comap_norm_atTop] lemma comap_norm_atTop' : comap norm atTop = cobounded E := by simpa only [dist_one_right] using comap_dist_right_atTop (1 : E) @[to_additive Filter.HasBasis.cobounded_of_norm] lemma Filter.HasBasis.cobounded_of_norm' {ι : Sort*} {p : ι → Prop} {s : ι → Set ℝ} (h : HasBasis atTop p s) : HasBasis (cobounded E) p fun i ↦ norm ⁻¹' s i := comap_norm_atTop' (E := E) ▸ h.comap _ @[to_additive Filter.hasBasis_cobounded_norm] lemma Filter.hasBasis_cobounded_norm' : HasBasis (cobounded E) (fun _ ↦ True) ({x | · ≤ ‖x‖}) := atTop_basis.cobounded_of_norm' @[to_additive (attr := simp) tendsto_norm_atTop_iff_cobounded] lemma tendsto_norm_atTop_iff_cobounded' {f : α → E} {l : Filter α} : Tendsto (‖f ·‖) l atTop ↔ Tendsto f l (cobounded E) := by rw [← comap_norm_atTop', tendsto_comap_iff]; rfl @[to_additive tendsto_norm_cobounded_atTop] lemma tendsto_norm_cobounded_atTop' : Tendsto norm (cobounded E) atTop := tendsto_norm_atTop_iff_cobounded'.2 tendsto_id @[to_additive eventually_cobounded_le_norm] lemma eventually_cobounded_le_norm' (a : ℝ) : ∀ᶠ x in cobounded E, a ≤ ‖x‖ := tendsto_norm_cobounded_atTop'.eventually_ge_atTop a @[to_additive tendsto_norm_cocompact_atTop] lemma tendsto_norm_cocompact_atTop' [ProperSpace E] : Tendsto norm (cocompact E) atTop := cobounded_eq_cocompact (α := E) ▸ tendsto_norm_cobounded_atTop' @[to_additive (attr := simp)] lemma Filter.inv_cobounded : (cobounded E)⁻¹ = cobounded E := by simp only [← comap_norm_atTop', ← Filter.comap_inv, comap_comap, (· ∘ ·), norm_inv'] /-- In a (semi)normed group, inversion `x ↦ x⁻¹` tends to infinity at infinity. -/ @[to_additive "In a (semi)normed group, negation `x ↦ -x` tends to infinity at infinity."] theorem Filter.tendsto_inv_cobounded : Tendsto Inv.inv (cobounded E) (cobounded E) := inv_cobounded.le @[to_additive isBounded_iff_forall_norm_le] lemma isBounded_iff_forall_norm_le' : Bornology.IsBounded s ↔ ∃ C, ∀ x ∈ s, ‖x‖ ≤ C := by simpa only [Set.subset_def, mem_closedBall_one_iff] using isBounded_iff_subset_closedBall (1 : E) alias ⟨Bornology.IsBounded.exists_norm_le', _⟩ := isBounded_iff_forall_norm_le' alias ⟨Bornology.IsBounded.exists_norm_le, _⟩ := isBounded_iff_forall_norm_le attribute [to_additive existing exists_norm_le] Bornology.IsBounded.exists_norm_le' @[to_additive exists_pos_norm_le] lemma Bornology.IsBounded.exists_pos_norm_le' (hs : IsBounded s) : ∃ R > 0, ∀ x ∈ s, ‖x‖ ≤ R := let ⟨R₀, hR₀⟩ := hs.exists_norm_le' ⟨max R₀ 1, by positivity, fun x hx => (hR₀ x hx).trans <| le_max_left _ _⟩ @[to_additive Bornology.IsBounded.exists_pos_norm_lt] lemma Bornology.IsBounded.exists_pos_norm_lt' (hs : IsBounded s) : ∃ R > 0, ∀ x ∈ s, ‖x‖ < R := let ⟨R, hR₀, hR⟩ := hs.exists_pos_norm_le' ⟨R + 1, by positivity, fun x hx ↦ (hR x hx).trans_lt (lt_add_one _)⟩ @[to_additive] lemma NormedCommGroup.cauchySeq_iff [Nonempty α] [SemilatticeSup α] {u : α → E} : CauchySeq u ↔ ∀ ε > 0, ∃ N, ∀ m, N ≤ m → ∀ n, N ≤ n → ‖u m / u n‖ < ε := by simp [Metric.cauchySeq_iff, dist_eq_norm_div] @[to_additive IsCompact.exists_bound_of_continuousOn] lemma IsCompact.exists_bound_of_continuousOn' [TopologicalSpace α] {s : Set α} (hs : IsCompact s) {f : α → E} (hf : ContinuousOn f s) : ∃ C, ∀ x ∈ s, ‖f x‖ ≤ C := (isBounded_iff_forall_norm_le'.1 (hs.image_of_continuousOn hf).isBounded).imp fun _C hC _x hx => hC _ <| Set.mem_image_of_mem _ hx @[to_additive] lemma HasCompactMulSupport.exists_bound_of_continuous [TopologicalSpace α] {f : α → E} (hf : HasCompactMulSupport f) (h'f : Continuous f) : ∃ C, ∀ x, ‖f x‖ ≤ C := by simpa using (hf.isCompact_range h'f).isBounded.exists_norm_le' /-- A helper lemma used to prove that the (scalar or usual) product of a function that tends to one and a bounded function tends to one. This lemma is formulated for any binary operation `op : E → F → G` with an estimate `‖op x y‖ ≤ A * ‖x‖ * ‖y‖` for some constant A instead of multiplication so that it can be applied to `(*)`, `flip (*)`, `(•)`, and `flip (•)`. -/ @[to_additive "A helper lemma used to prove that the (scalar or usual) product of a function that tends to zero and a bounded function tends to zero. This lemma is formulated for any binary operation `op : E → F → G` with an estimate `‖op x y‖ ≤ A * ‖x‖ * ‖y‖` for some constant A instead of multiplication so that it can be applied to `(*)`, `flip (*)`, `(•)`, and `flip (•)`."] lemma Filter.Tendsto.op_one_isBoundedUnder_le' {f : α → E} {g : α → F} {l : Filter α} (hf : Tendsto f l (𝓝 1)) (hg : IsBoundedUnder (· ≤ ·) l (Norm.norm ∘ g)) (op : E → F → G) (h_op : ∃ A, ∀ x y, ‖op x y‖ ≤ A * ‖x‖ * ‖y‖) : Tendsto (fun x => op (f x) (g x)) l (𝓝 1) := by cases' h_op with A h_op rcases hg with ⟨C, hC⟩; rw [eventually_map] at hC rw [NormedCommGroup.tendsto_nhds_one] at hf ⊢ intro ε ε₀ rcases exists_pos_mul_lt ε₀ (A * C) with ⟨δ, δ₀, hδ⟩ filter_upwards [hf δ δ₀, hC] with i hf hg refine (h_op _ _).trans_lt ?_ rcases le_total A 0 with hA | hA · exact (mul_nonpos_of_nonpos_of_nonneg (mul_nonpos_of_nonpos_of_nonneg hA <| norm_nonneg' _) <| norm_nonneg' _).trans_lt ε₀ calc A * ‖f i‖ * ‖g i‖ ≤ A * δ * C := by gcongr; exact hg _ = A * C * δ := mul_right_comm _ _ _ _ < ε := hδ /-- A helper lemma used to prove that the (scalar or usual) product of a function that tends to one and a bounded function tends to one. This lemma is formulated for any binary operation `op : E → F → G` with an estimate `‖op x y‖ ≤ ‖x‖ * ‖y‖` instead of multiplication so that it can be applied to `(*)`, `flip (*)`, `(•)`, and `flip (•)`. -/ @[to_additive "A helper lemma used to prove that the (scalar or usual) product of a function that tends to zero and a bounded function tends to zero. This lemma is formulated for any binary operation `op : E → F → G` with an estimate `‖op x y‖ ≤ ‖x‖ * ‖y‖` instead of multiplication so that it can be applied to `(*)`, `flip (*)`, `(•)`, and `flip (•)`."] theorem Filter.Tendsto.op_one_isBoundedUnder_le {f : α → E} {g : α → F} {l : Filter α} (hf : Tendsto f l (𝓝 1)) (hg : IsBoundedUnder (· ≤ ·) l (Norm.norm ∘ g)) (op : E → F → G) (h_op : ∀ x y, ‖op x y‖ ≤ ‖x‖ * ‖y‖) : Tendsto (fun x => op (f x) (g x)) l (𝓝 1) := hf.op_one_isBoundedUnder_le' hg op ⟨1, fun x y => (one_mul ‖x‖).symm ▸ h_op x y⟩ end SeminormedGroup section NormedAddGroup variable [NormedAddGroup E] [TopologicalSpace α] {f : α → E} lemma Continuous.bounded_above_of_compact_support (hf : Continuous f) (h : HasCompactSupport f) : ∃ C, ∀ x, ‖f x‖ ≤ C := by simpa [bddAbove_def] using hf.norm.bddAbove_range_of_hasCompactSupport h.norm end NormedAddGroup section NormedAddGroupSource variable [NormedAddGroup α] {f : α → E} @[to_additive] lemma HasCompactMulSupport.exists_pos_le_norm [One E] (hf : HasCompactMulSupport f) : ∃ R : ℝ, 0 < R ∧ ∀ x : α, R ≤ ‖x‖ → f x = 1 := by obtain ⟨K, ⟨hK1, hK2⟩⟩ := exists_compact_iff_hasCompactMulSupport.mpr hf obtain ⟨S, hS, hS'⟩ := hK1.isBounded.exists_pos_norm_le refine ⟨S + 1, by positivity, fun x hx => hK2 x ((mt <| hS' x) ?_)⟩ -- Porting note: `ENNReal.add_lt_add` should be `protected`? -- [context: we used `_root_.add_lt_add` in a previous version of this proof] contrapose! hx exact lt_add_of_le_of_pos hx zero_lt_one end NormedAddGroupSource
Analysis\Normed\Group\CocompactMap.lean
/- Copyright (c) 2024 Moritz Doll. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Moritz Doll -/ import Mathlib.Analysis.Normed.Group.Basic import Mathlib.Topology.ContinuousFunction.CocompactMap import Mathlib.Topology.MetricSpace.Bounded /-! # Cocompact maps in normed groups This file gives a characterization of cocompact maps in terms of norm estimates. ## Main statements * `CocompactMapClass.norm_le`: Every cocompact map satisfies a norm estimate * `ContinuousMapClass.toCocompactMapClass_of_norm`: Conversely, this norm estimate implies that a map is cocompact. -/ open Filter Metric variable {𝕜 E F 𝓕 : Type*} variable [NormedAddCommGroup E] [NormedAddCommGroup F] variable {f : 𝓕} theorem CocompactMapClass.norm_le [ProperSpace F] [FunLike 𝓕 E F] [CocompactMapClass 𝓕 E F] (ε : ℝ) : ∃ r : ℝ, ∀ x : E, r < ‖x‖ → ε < ‖f x‖ := by have h := cocompact_tendsto f rw [tendsto_def] at h specialize h (Metric.closedBall 0 ε)ᶜ (mem_cocompact_of_closedBall_compl_subset 0 ⟨ε, rfl.subset⟩) rcases closedBall_compl_subset_of_mem_cocompact h 0 with ⟨r, hr⟩ use r intro x hx suffices x ∈ f⁻¹' (Metric.closedBall 0 ε)ᶜ by aesop apply hr simp [hx] theorem Filter.tendsto_cocompact_cocompact_of_norm [ProperSpace E] {f : E → F} (h : ∀ ε : ℝ, ∃ r : ℝ, ∀ x : E, r < ‖x‖ → ε < ‖f x‖) : Tendsto f (cocompact E) (cocompact F) := by rw [tendsto_def] intro s hs rcases closedBall_compl_subset_of_mem_cocompact hs 0 with ⟨ε, hε⟩ rcases h ε with ⟨r, hr⟩ apply mem_cocompact_of_closedBall_compl_subset 0 use r intro x hx simp only [Set.mem_compl_iff, Metric.mem_closedBall, dist_zero_right, not_le] at hx apply hε simp [hr x hx] theorem ContinuousMapClass.toCocompactMapClass_of_norm [ProperSpace E] [FunLike 𝓕 E F] [ContinuousMapClass 𝓕 E F] (h : ∀ (f : 𝓕) (ε : ℝ), ∃ r : ℝ, ∀ x : E, r < ‖x‖ → ε < ‖f x‖) : CocompactMapClass 𝓕 E F where cocompact_tendsto := (tendsto_cocompact_cocompact_of_norm <| h ·)
Analysis\Normed\Group\Completeness.lean
/- Copyright (c) 2023 Frédéric Dupuis. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Frédéric Dupuis -/ import Mathlib.Analysis.Normed.Group.Uniform import Mathlib.Analysis.SpecificLimits.Basic /-! # Completeness of normed groups This file includes a completeness criterion for normed additive groups in terms of convergent series. ## Main results * `NormedAddCommGroup.completeSpace_of_summable_imp_tendsto`: A normed additive group is complete if any absolutely convergent series converges in the space. ## References * [bergh_lofstrom_1976] `NormedAddCommGroup.completeSpace_of_summable_imp_tendsto` and `NormedAddCommGroup.summable_imp_tendsto_of_complete` correspond to the two directions of Lemma 2.2.1. ## Tags CompleteSpace, CauchySeq -/ open scoped Topology open Filter Finset section Metric variable {α : Type*} [PseudoMetricSpace α] lemma Metric.exists_subseq_summable_dist_of_cauchySeq (u : ℕ → α) (hu : CauchySeq u) : ∃ f : ℕ → ℕ, StrictMono f ∧ Summable fun i => dist (u (f (i+1))) (u (f i)) := by obtain ⟨f, hf₁, hf₂⟩ := Metric.exists_subseq_bounded_of_cauchySeq u hu (fun n => (1 / (2 : ℝ))^n) (fun n => by positivity) refine ⟨f, hf₁, ?_⟩ refine Summable.of_nonneg_of_le (fun n => by positivity) ?_ summable_geometric_two exact fun n => le_of_lt <| hf₂ n (f (n+1)) <| hf₁.monotone (Nat.le_add_right n 1) end Metric section Normed variable {E : Type*} [NormedAddCommGroup E] /-- A normed additive group is complete if any absolutely convergent series converges in the space. -/ lemma NormedAddCommGroup.completeSpace_of_summable_imp_tendsto (h : ∀ u : ℕ → E, Summable (‖u ·‖) → ∃ a, Tendsto (fun n => ∑ i ∈ range n, u i) atTop (𝓝 a)) : CompleteSpace E := by apply Metric.complete_of_cauchySeq_tendsto intro u hu obtain ⟨f, hf₁, hf₂⟩ := Metric.exists_subseq_summable_dist_of_cauchySeq u hu simp only [dist_eq_norm] at hf₂ let v n := u (f (n+1)) - u (f n) have hv_sum : (fun n => (∑ i ∈ range n, v i)) = fun n => u (f n) - u (f 0) := by ext n exact sum_range_sub (u ∘ f) n obtain ⟨a, ha⟩ := h v hf₂ refine ⟨a + u (f 0), ?_⟩ refine tendsto_nhds_of_cauchySeq_of_subseq hu hf₁.tendsto_atTop ?_ rw [hv_sum] at ha have h₁ : Tendsto (fun n => u (f n) - u (f 0) + u (f 0)) atTop (𝓝 (a + u (f 0))) := Tendsto.add_const _ ha simpa only [sub_add_cancel] using h₁ /-- In a complete normed additive group, every absolutely convergent series converges in the space. -/ lemma NormedAddCommGroup.summable_imp_tendsto_of_complete [CompleteSpace E] (u : ℕ → E) (hu : Summable (‖u ·‖)) : ∃ a, Tendsto (fun n => ∑ i ∈ range n, u i) atTop (𝓝 a) := by refine cauchySeq_tendsto_of_complete <| cauchySeq_of_summable_dist ?_ simp [dist_eq_norm, sum_range_succ, hu] /-- In a normed additive group, every absolutely convergent series converges in the space iff the space is complete. -/ lemma NormedAddCommGroup.summable_imp_tendsto_iff_completeSpace : (∀ u : ℕ → E, Summable (‖u ·‖) → ∃ a, Tendsto (fun n => ∑ i ∈ range n, u i) atTop (𝓝 a)) ↔ CompleteSpace E := ⟨completeSpace_of_summable_imp_tendsto, fun _ u hu => summable_imp_tendsto_of_complete u hu⟩ end Normed
Analysis\Normed\Group\Completion.lean
/- Copyright (c) 2021 Johan Commelin. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johan Commelin -/ import Mathlib.Analysis.Normed.Group.Uniform import Mathlib.Topology.Algebra.GroupCompletion import Mathlib.Topology.MetricSpace.Completion /-! # Completion of a normed group In this file we prove that the completion of a (semi)normed group is a normed group. ## Tags normed group, completion -/ noncomputable section namespace UniformSpace namespace Completion variable (E : Type*) instance [UniformSpace E] [Norm E] : Norm (Completion E) where norm := Completion.extension Norm.norm @[simp] theorem norm_coe {E} [SeminormedAddCommGroup E] (x : E) : ‖(x : Completion E)‖ = ‖x‖ := Completion.extension_coe uniformContinuous_norm x instance [SeminormedAddCommGroup E] : NormedAddCommGroup (Completion E) where dist_eq x y := by induction x, y using Completion.induction_on₂ · refine isClosed_eq (Completion.uniformContinuous_extension₂ _).continuous ?_ exact Continuous.comp Completion.continuous_extension continuous_sub · rw [← Completion.coe_sub, norm_coe, Completion.dist_eq, dist_eq_norm] @[simp] theorem nnnorm_coe {E} [SeminormedAddCommGroup E] (x : E) : ‖(x : Completion E)‖₊ = ‖x‖₊ := by simp [nnnorm] end Completion end UniformSpace
Analysis\Normed\Group\Constructions.lean
/- Copyright (c) 2018 Patrick Massot. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Johannes Hölzl, Yaël Dillies -/ import Mathlib.Algebra.Group.ULift import Mathlib.Algebra.PUnitInstances.Algebra import Mathlib.Analysis.Normed.Group.Basic /-! # Product of normed groups and other constructions This file constructs the infinity norm on finite products of normed groups and provides instances for type synonyms. -/ open NNReal variable {ι E F : Type*} {π : ι → Type*} /-! ### `PUnit` -/ namespace PUnit instance normedAddCommGroup : NormedAddCommGroup PUnit where norm := Function.const _ 0 dist_eq _ _ := rfl @[simp] lemma norm_eq_zero (x : PUnit) : ‖x‖ = 0 := rfl end PUnit /-! ### `ULift` -/ namespace ULift section Norm variable [Norm E] instance norm : Norm (ULift E) where norm x := ‖x.down‖ lemma norm_def (x : ULift E) : ‖x‖ = ‖x.down‖ := rfl @[simp] lemma norm_up (x : E) : ‖ULift.up x‖ = ‖x‖ := rfl @[simp] lemma norm_down (x : ULift E) : ‖x.down‖ = ‖x‖ := rfl end Norm section NNNorm variable [NNNorm E] instance nnnorm : NNNorm (ULift E) where nnnorm x := ‖x.down‖₊ lemma nnnorm_def (x : ULift E) : ‖x‖₊ = ‖x.down‖₊ := rfl @[simp] lemma nnnorm_up (x : E) : ‖ULift.up x‖₊ = ‖x‖₊ := rfl @[simp] lemma nnnorm_down (x : ULift E) : ‖x.down‖₊ = ‖x‖₊ := rfl end NNNorm @[to_additive] instance seminormedGroup [SeminormedGroup E] : SeminormedGroup (ULift E) := SeminormedGroup.induced _ _ { toFun := ULift.down, map_one' := rfl, map_mul' := fun _ _ => rfl : ULift E →* E } @[to_additive] instance seminormedCommGroup [SeminormedCommGroup E] : SeminormedCommGroup (ULift E) := SeminormedCommGroup.induced _ _ { toFun := ULift.down, map_one' := rfl, map_mul' := fun _ _ => rfl : ULift E →* E } @[to_additive] instance normedGroup [NormedGroup E] : NormedGroup (ULift E) := NormedGroup.induced _ _ { toFun := ULift.down, map_one' := rfl, map_mul' := fun _ _ => rfl : ULift E →* E } down_injective @[to_additive] instance normedCommGroup [NormedCommGroup E] : NormedCommGroup (ULift E) := NormedCommGroup.induced _ _ { toFun := ULift.down, map_one' := rfl, map_mul' := fun _ _ => rfl : ULift E →* E } down_injective end ULift /-! ### `Additive`, `Multiplicative` -/ section AdditiveMultiplicative open Additive Multiplicative section Norm variable [Norm E] instance Additive.toNorm : Norm (Additive E) := ‹Norm E› instance Multiplicative.toNorm : Norm (Multiplicative E) := ‹Norm E› @[simp] lemma norm_toMul (x) : ‖(toMul x : E)‖ = ‖x‖ := rfl @[simp] lemma norm_ofMul (x : E) : ‖ofMul x‖ = ‖x‖ := rfl @[simp] lemma norm_toAdd (x) : ‖(toAdd x : E)‖ = ‖x‖ := rfl @[simp] lemma norm_ofAdd (x : E) : ‖ofAdd x‖ = ‖x‖ := rfl end Norm section NNNorm variable [NNNorm E] instance Additive.toNNNorm : NNNorm (Additive E) := ‹NNNorm E› instance Multiplicative.toNNNorm : NNNorm (Multiplicative E) := ‹NNNorm E› @[simp] lemma nnnorm_toMul (x) : ‖(toMul x : E)‖₊ = ‖x‖₊ := rfl @[simp] lemma nnnorm_ofMul (x : E) : ‖ofMul x‖₊ = ‖x‖₊ := rfl @[simp] lemma nnnorm_toAdd (x) : ‖(toAdd x : E)‖₊ = ‖x‖₊ := rfl @[simp] lemma nnnorm_ofAdd (x : E) : ‖ofAdd x‖₊ = ‖x‖₊ := rfl end NNNorm instance Additive.seminormedAddGroup [SeminormedGroup E] : SeminormedAddGroup (Additive E) where dist_eq x y := dist_eq_norm_div (toMul x) (toMul y) instance Multiplicative.seminormedGroup [SeminormedAddGroup E] : SeminormedGroup (Multiplicative E) where dist_eq x y := dist_eq_norm_sub (toMul x) (toMul y) instance Additive.seminormedCommGroup [SeminormedCommGroup E] : SeminormedAddCommGroup (Additive E) := { Additive.seminormedAddGroup with add_comm := add_comm } instance Multiplicative.seminormedAddCommGroup [SeminormedAddCommGroup E] : SeminormedCommGroup (Multiplicative E) := { Multiplicative.seminormedGroup with mul_comm := mul_comm } instance Additive.normedAddGroup [NormedGroup E] : NormedAddGroup (Additive E) := { Additive.seminormedAddGroup with eq_of_dist_eq_zero := eq_of_dist_eq_zero } instance Multiplicative.normedGroup [NormedAddGroup E] : NormedGroup (Multiplicative E) := { Multiplicative.seminormedGroup with eq_of_dist_eq_zero := eq_of_dist_eq_zero } instance Additive.normedAddCommGroup [NormedCommGroup E] : NormedAddCommGroup (Additive E) := { Additive.seminormedAddGroup with add_comm := add_comm eq_of_dist_eq_zero := eq_of_dist_eq_zero } instance Multiplicative.normedCommGroup [NormedAddCommGroup E] : NormedCommGroup (Multiplicative E) := { Multiplicative.seminormedGroup with mul_comm := mul_comm eq_of_dist_eq_zero := eq_of_dist_eq_zero } end AdditiveMultiplicative /-! ### Order dual -/ section OrderDual open OrderDual section Norm variable [Norm E] instance OrderDual.toNorm : Norm Eᵒᵈ := ‹Norm E› @[simp] lemma norm_toDual (x : E) : ‖toDual x‖ = ‖x‖ := rfl @[simp] lemma norm_ofDual (x : Eᵒᵈ) : ‖ofDual x‖ = ‖x‖ := rfl end Norm section NNNorm variable [NNNorm E] instance OrderDual.toNNNorm : NNNorm Eᵒᵈ := ‹NNNorm E› @[simp] lemma nnnorm_toDual (x : E) : ‖toDual x‖₊ = ‖x‖₊ := rfl @[simp] lemma nnnorm_ofDual (x : Eᵒᵈ) : ‖ofDual x‖₊ = ‖x‖₊ := rfl end NNNorm namespace OrderDual -- See note [lower instance priority] @[to_additive] instance (priority := 100) seminormedGroup [SeminormedGroup E] : SeminormedGroup Eᵒᵈ := ‹SeminormedGroup E› -- See note [lower instance priority] @[to_additive] instance (priority := 100) seminormedCommGroup [SeminormedCommGroup E] : SeminormedCommGroup Eᵒᵈ := ‹SeminormedCommGroup E› -- See note [lower instance priority] @[to_additive] instance (priority := 100) normedGroup [NormedGroup E] : NormedGroup Eᵒᵈ := ‹NormedGroup E› -- See note [lower instance priority] @[to_additive] instance (priority := 100) normedCommGroup [NormedCommGroup E] : NormedCommGroup Eᵒᵈ := ‹NormedCommGroup E› end OrderDual end OrderDual /-! ### Binary product of normed groups -/ section Norm variable [Norm E] [Norm F] {x : E × F} {r : ℝ} instance Prod.toNorm : Norm (E × F) where norm x := ‖x.1‖ ⊔ ‖x.2‖ lemma Prod.norm_def (x : E × F) : ‖x‖ = max ‖x.1‖ ‖x.2‖ := rfl lemma norm_fst_le (x : E × F) : ‖x.1‖ ≤ ‖x‖ := le_max_left _ _ lemma norm_snd_le (x : E × F) : ‖x.2‖ ≤ ‖x‖ := le_max_right _ _ lemma norm_prod_le_iff : ‖x‖ ≤ r ↔ ‖x.1‖ ≤ r ∧ ‖x.2‖ ≤ r := max_le_iff end Norm section SeminormedGroup variable [SeminormedGroup E] [SeminormedGroup F] /-- Product of seminormed groups, using the sup norm. -/ @[to_additive "Product of seminormed groups, using the sup norm."] instance Prod.seminormedGroup : SeminormedGroup (E × F) where dist_eq x y := by simp only [Prod.norm_def, Prod.dist_eq, dist_eq_norm_div, Prod.fst_div, Prod.snd_div] @[to_additive Prod.nnnorm_def'] lemma Prod.nnorm_def (x : E × F) : ‖x‖₊ = max ‖x.1‖₊ ‖x.2‖₊ := rfl end SeminormedGroup namespace Prod /-- Product of seminormed groups, using the sup norm. -/ @[to_additive "Product of seminormed groups, using the sup norm."] instance seminormedCommGroup [SeminormedCommGroup E] [SeminormedCommGroup F] : SeminormedCommGroup (E × F) := { Prod.seminormedGroup with mul_comm := mul_comm } /-- Product of normed groups, using the sup norm. -/ @[to_additive "Product of normed groups, using the sup norm."] instance normedGroup [NormedGroup E] [NormedGroup F] : NormedGroup (E × F) := { Prod.seminormedGroup with eq_of_dist_eq_zero := eq_of_dist_eq_zero } /-- Product of normed groups, using the sup norm. -/ @[to_additive "Product of normed groups, using the sup norm."] instance normedCommGroup [NormedCommGroup E] [NormedCommGroup F] : NormedCommGroup (E × F) := { Prod.seminormedGroup with mul_comm := mul_comm eq_of_dist_eq_zero := eq_of_dist_eq_zero } end Prod /-! ### Finite product of normed groups -/ section Pi variable [Fintype ι] section SeminormedGroup variable [∀ i, SeminormedGroup (π i)] [SeminormedGroup E] (f : ∀ i, π i) {x : ∀ i, π i} {r : ℝ} /-- Finite product of seminormed groups, using the sup norm. -/ @[to_additive "Finite product of seminormed groups, using the sup norm."] instance Pi.seminormedGroup : SeminormedGroup (∀ i, π i) where norm f := ↑(Finset.univ.sup fun b => ‖f b‖₊) dist_eq x y := congr_arg (toReal : ℝ≥0 → ℝ) <| congr_arg (Finset.sup Finset.univ) <| funext fun a => show nndist (x a) (y a) = ‖x a / y a‖₊ from nndist_eq_nnnorm_div (x a) (y a) @[to_additive Pi.norm_def] lemma Pi.norm_def' : ‖f‖ = ↑(Finset.univ.sup fun b => ‖f b‖₊) := rfl @[to_additive Pi.nnnorm_def] lemma Pi.nnnorm_def' : ‖f‖₊ = Finset.univ.sup fun b => ‖f b‖₊ := Subtype.eta _ _ /-- The seminorm of an element in a product space is `≤ r` if and only if the norm of each component is. -/ @[to_additive pi_norm_le_iff_of_nonneg "The seminorm of an element in a product space is `≤ r` if and only if the norm of each component is."] lemma pi_norm_le_iff_of_nonneg' (hr : 0 ≤ r) : ‖x‖ ≤ r ↔ ∀ i, ‖x i‖ ≤ r := by simp only [← dist_one_right, dist_pi_le_iff hr, Pi.one_apply] @[to_additive pi_nnnorm_le_iff] lemma pi_nnnorm_le_iff' {r : ℝ≥0} : ‖x‖₊ ≤ r ↔ ∀ i, ‖x i‖₊ ≤ r := pi_norm_le_iff_of_nonneg' r.coe_nonneg @[to_additive pi_norm_le_iff_of_nonempty] lemma pi_norm_le_iff_of_nonempty' [Nonempty ι] : ‖f‖ ≤ r ↔ ∀ b, ‖f b‖ ≤ r := by by_cases hr : 0 ≤ r · exact pi_norm_le_iff_of_nonneg' hr · exact iff_of_false (fun h => hr <| (norm_nonneg' _).trans h) fun h => hr <| (norm_nonneg' _).trans <| h <| Classical.arbitrary _ /-- The seminorm of an element in a product space is `< r` if and only if the norm of each component is. -/ @[to_additive pi_norm_lt_iff "The seminorm of an element in a product space is `< r` if and only if the norm of each component is."] lemma pi_norm_lt_iff' (hr : 0 < r) : ‖x‖ < r ↔ ∀ i, ‖x i‖ < r := by simp only [← dist_one_right, dist_pi_lt_iff hr, Pi.one_apply] @[to_additive pi_nnnorm_lt_iff] lemma pi_nnnorm_lt_iff' {r : ℝ≥0} (hr : 0 < r) : ‖x‖₊ < r ↔ ∀ i, ‖x i‖₊ < r := pi_norm_lt_iff' hr @[to_additive norm_le_pi_norm] lemma norm_le_pi_norm' (i : ι) : ‖f i‖ ≤ ‖f‖ := (pi_norm_le_iff_of_nonneg' <| norm_nonneg' _).1 le_rfl i @[to_additive nnnorm_le_pi_nnnorm] lemma nnnorm_le_pi_nnnorm' (i : ι) : ‖f i‖₊ ≤ ‖f‖₊ := norm_le_pi_norm' _ i @[to_additive pi_norm_const_le] lemma pi_norm_const_le' (a : E) : ‖fun _ : ι => a‖ ≤ ‖a‖ := (pi_norm_le_iff_of_nonneg' <| norm_nonneg' _).2 fun _ => le_rfl @[to_additive pi_nnnorm_const_le] lemma pi_nnnorm_const_le' (a : E) : ‖fun _ : ι => a‖₊ ≤ ‖a‖₊ := pi_norm_const_le' _ @[to_additive (attr := simp) pi_norm_const] lemma pi_norm_const' [Nonempty ι] (a : E) : ‖fun _i : ι => a‖ = ‖a‖ := by simpa only [← dist_one_right] using dist_pi_const a 1 @[to_additive (attr := simp) pi_nnnorm_const] lemma pi_nnnorm_const' [Nonempty ι] (a : E) : ‖fun _i : ι => a‖₊ = ‖a‖₊ := NNReal.eq <| pi_norm_const' a /-- The $L^1$ norm is less than the $L^\infty$ norm scaled by the cardinality. -/ @[to_additive Pi.sum_norm_apply_le_norm "The $L^1$ norm is less than the $L^\\infty$ norm scaled by the cardinality."] lemma Pi.sum_norm_apply_le_norm' : ∑ i, ‖f i‖ ≤ Fintype.card ι • ‖f‖ := Finset.sum_le_card_nsmul _ _ _ fun i _hi => norm_le_pi_norm' _ i /-- The $L^1$ norm is less than the $L^\infty$ norm scaled by the cardinality. -/ @[to_additive Pi.sum_nnnorm_apply_le_nnnorm "The $L^1$ norm is less than the $L^\\infty$ norm scaled by the cardinality."] lemma Pi.sum_nnnorm_apply_le_nnnorm' : ∑ i, ‖f i‖₊ ≤ Fintype.card ι • ‖f‖₊ := NNReal.coe_sum.trans_le <| Pi.sum_norm_apply_le_norm' _ end SeminormedGroup /-- Finite product of seminormed groups, using the sup norm. -/ @[to_additive "Finite product of seminormed groups, using the sup norm."] instance Pi.seminormedCommGroup [∀ i, SeminormedCommGroup (π i)] : SeminormedCommGroup (∀ i, π i) := { Pi.seminormedGroup with mul_comm := mul_comm } /-- Finite product of normed groups, using the sup norm. -/ @[to_additive "Finite product of seminormed groups, using the sup norm."] instance Pi.normedGroup [∀ i, NormedGroup (π i)] : NormedGroup (∀ i, π i) := { Pi.seminormedGroup with eq_of_dist_eq_zero := eq_of_dist_eq_zero } /-- Finite product of normed groups, using the sup norm. -/ @[to_additive "Finite product of seminormed groups, using the sup norm."] instance Pi.normedCommGroup [∀ i, NormedCommGroup (π i)] : NormedCommGroup (∀ i, π i) := { Pi.seminormedGroup with mul_comm := mul_comm eq_of_dist_eq_zero := eq_of_dist_eq_zero } theorem Pi.nnnorm_single [DecidableEq ι] [∀ i, NormedAddCommGroup (π i)] {i : ι} (y : π i) : ‖Pi.single i y‖₊ = ‖y‖₊ := by have H : ∀ b, ‖single i y b‖₊ = single (f := fun _ ↦ ℝ≥0) i ‖y‖₊ b := by intro b refine Pi.apply_single (fun i (x : π i) ↦ ‖x‖₊) ?_ i y b simp simp [Pi.nnnorm_def, H, Pi.single_apply, Finset.sup_ite, Finset.filter_eq'] theorem Pi.norm_single [DecidableEq ι] [∀ i, NormedAddCommGroup (π i)] {i : ι} (y : π i) : ‖Pi.single i y‖ = ‖y‖ := congr_arg Subtype.val <| Pi.nnnorm_single y end Pi /-! ### Multiplicative opposite -/ namespace MulOpposite /-- The (additive) norm on the multiplicative opposite is the same as the norm on the original type. Note that we do not provide this more generally as `Norm Eᵐᵒᵖ`, as this is not always a good choice of norm in the multiplicative `SeminormedGroup E` case. We could repeat this instance to provide a `[SeminormedGroup E] : SeminormedGroup Eᵃᵒᵖ` instance, but that case would likely never be used. -/ instance instSeminormedAddGroup [SeminormedAddGroup E] : SeminormedAddGroup Eᵐᵒᵖ where __ := instPseudoMetricSpace norm x := ‖x.unop‖ dist_eq _ _ := dist_eq_norm _ _ lemma norm_op [SeminormedAddGroup E] (a : E) : ‖MulOpposite.op a‖ = ‖a‖ := rfl lemma norm_unop [SeminormedAddGroup E] (a : Eᵐᵒᵖ) : ‖MulOpposite.unop a‖ = ‖a‖ := rfl lemma nnnorm_op [SeminormedAddGroup E] (a : E) : ‖MulOpposite.op a‖₊ = ‖a‖₊ := rfl lemma nnnorm_unop [SeminormedAddGroup E] (a : Eᵐᵒᵖ) : ‖MulOpposite.unop a‖₊ = ‖a‖₊ := rfl instance instNormedAddGroup [NormedAddGroup E] : NormedAddGroup Eᵐᵒᵖ where __ := instMetricSpace __ := instSeminormedAddGroup instance instSeminormedAddCommGroup [SeminormedAddCommGroup E] : SeminormedAddCommGroup Eᵐᵒᵖ where dist_eq _ _ := dist_eq_norm _ _ instance instNormedAddCommGroup [NormedAddCommGroup E] : NormedAddCommGroup Eᵐᵒᵖ where __ := instSeminormedAddCommGroup __ := instNormedAddGroup end MulOpposite
Analysis\Normed\Group\ControlledClosure.lean
/- Copyright (c) 2021 Patrick Massot. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot -/ import Mathlib.Analysis.Normed.Group.Hom import Mathlib.Analysis.SpecificLimits.Normed /-! # Extending a backward bound on a normed group homomorphism from a dense set Possible TODO (from the PR's review, https://github.com/leanprover-community/mathlib/pull/8498 ): "This feels a lot like the second step in the proof of the Banach open mapping theorem (`exists_preimage_norm_le`) ... wonder if it would be possible to refactor it using one of [the lemmas in this file]." -/ open Filter Finset open Topology variable {G : Type*} [NormedAddCommGroup G] [CompleteSpace G] variable {H : Type*} [NormedAddCommGroup H] /-- Given `f : NormedAddGroupHom G H` for some complete `G` and a subgroup `K` of `H`, if every element `x` of `K` has a preimage under `f` whose norm is at most `C*‖x‖` then the same holds for elements of the (topological) closure of `K` with constant `C+ε` instead of `C`, for any positive `ε`. -/ theorem controlled_closure_of_complete {f : NormedAddGroupHom G H} {K : AddSubgroup H} {C ε : ℝ} (hC : 0 < C) (hε : 0 < ε) (hyp : f.SurjectiveOnWith K C) : f.SurjectiveOnWith K.topologicalClosure (C + ε) := by rintro (h : H) (h_in : h ∈ K.topologicalClosure) -- We first get rid of the easy case where `h = 0`. by_cases hyp_h : h = 0 · rw [hyp_h] use 0 simp /- The desired preimage will be constructed as the sum of a series. Convergence of the series will be guaranteed by completeness of `G`. We first write `h` as the sum of a sequence `v` of elements of `K` which starts close to `h` and then quickly goes to zero. The sequence `b` below quantifies this. -/ set b : ℕ → ℝ := fun i => (1 / 2) ^ i * (ε * ‖h‖ / 2) / C have b_pos (i) : 0 < b i := by field_simp [b, hC, hyp_h] obtain ⟨v : ℕ → H, lim_v : Tendsto (fun n : ℕ => ∑ k ∈ range (n + 1), v k) atTop (𝓝 h), v_in : ∀ n, v n ∈ K, hv₀ : ‖v 0 - h‖ < b 0, hv : ∀ n > 0, ‖v n‖ < b n⟩ := controlled_sum_of_mem_closure h_in b_pos /- The controlled surjectivity assumption on `f` allows to build preimages `u n` for all elements `v n` of the `v` sequence. -/ have : ∀ n, ∃ m' : G, f m' = v n ∧ ‖m'‖ ≤ C * ‖v n‖ := fun n : ℕ => hyp (v n) (v_in n) choose u hu hnorm_u using this /- The desired series `s` is then obtained by summing `u`. We then check our choice of `b` ensures `s` is Cauchy. -/ set s : ℕ → G := fun n => ∑ k ∈ range (n + 1), u k have : CauchySeq s := by apply NormedAddCommGroup.cauchy_series_of_le_geometric'' (by norm_num) one_half_lt_one · rintro n (hn : n ≥ 1) calc ‖u n‖ ≤ C * ‖v n‖ := hnorm_u n _ ≤ C * b n := by gcongr; exact (hv _ <| Nat.succ_le_iff.mp hn).le _ = (1 / 2) ^ n * (ε * ‖h‖ / 2) := by simp [mul_div_cancel₀ _ hC.ne.symm] _ = ε * ‖h‖ / 2 * (1 / 2) ^ n := mul_comm _ _ -- We now show that the limit `g` of `s` is the desired preimage. obtain ⟨g : G, hg⟩ := cauchySeq_tendsto_of_complete this refine ⟨g, ?_, ?_⟩ · -- We indeed get a preimage. First note: have : f ∘ s = fun n => ∑ k ∈ range (n + 1), v k := by ext n simp [s, map_sum, hu] /- In the above equality, the left-hand-side converges to `f g` by continuity of `f` and definition of `g` while the right-hand-side converges to `h` by construction of `v` so `g` is indeed a preimage of `h`. -/ rw [← this] at lim_v exact tendsto_nhds_unique ((f.continuous.tendsto g).comp hg) lim_v · -- Then we need to estimate the norm of `g`, using our careful choice of `b`. suffices ∀ n, ‖s n‖ ≤ (C + ε) * ‖h‖ from le_of_tendsto' (continuous_norm.continuousAt.tendsto.comp hg) this intro n have hnorm₀ : ‖u 0‖ ≤ C * b 0 + C * ‖h‖ := by have := calc ‖v 0‖ ≤ ‖h‖ + ‖v 0 - h‖ := norm_le_insert' _ _ _ ≤ ‖h‖ + b 0 := by gcongr calc ‖u 0‖ ≤ C * ‖v 0‖ := hnorm_u 0 _ ≤ C * (‖h‖ + b 0) := by gcongr _ = C * b 0 + C * ‖h‖ := by rw [add_comm, mul_add] have : (∑ k ∈ range (n + 1), C * b k) ≤ ε * ‖h‖ := calc (∑ k ∈ range (n + 1), C * b k) _ = (∑ k ∈ range (n + 1), (1 / 2 : ℝ) ^ k) * (ε * ‖h‖ / 2) := by simp only [mul_div_cancel₀ _ hC.ne.symm, ← sum_mul] _ ≤ 2 * (ε * ‖h‖ / 2) := by gcongr; apply sum_geometric_two_le _ = ε * ‖h‖ := mul_div_cancel₀ _ two_ne_zero calc ‖s n‖ ≤ ∑ k ∈ range (n + 1), ‖u k‖ := norm_sum_le _ _ _ = (∑ k ∈ range n, ‖u (k + 1)‖) + ‖u 0‖ := sum_range_succ' _ _ _ ≤ (∑ k ∈ range n, C * ‖v (k + 1)‖) + ‖u 0‖ := by gcongr; apply hnorm_u _ ≤ (∑ k ∈ range n, C * b (k + 1)) + (C * b 0 + C * ‖h‖) := by gcongr with k; exact (hv _ k.succ_pos).le _ = (∑ k ∈ range (n + 1), C * b k) + C * ‖h‖ := by rw [← add_assoc, sum_range_succ'] _ ≤ (C + ε) * ‖h‖ := by rw [add_comm, add_mul] apply add_le_add_left this /-- Given `f : NormedAddGroupHom G H` for some complete `G`, if every element `x` of the image of an isometric immersion `j : NormedAddGroupHom K H` has a preimage under `f` whose norm is at most `C*‖x‖` then the same holds for elements of the (topological) closure of this image with constant `C+ε` instead of `C`, for any positive `ε`. This is useful in particular if `j` is the inclusion of a normed group into its completion (in this case the closure is the full target group). -/ theorem controlled_closure_range_of_complete {f : NormedAddGroupHom G H} {K : Type*} [SeminormedAddCommGroup K] {j : NormedAddGroupHom K H} (hj : ∀ x, ‖j x‖ = ‖x‖) {C ε : ℝ} (hC : 0 < C) (hε : 0 < ε) (hyp : ∀ k, ∃ g, f g = j k ∧ ‖g‖ ≤ C * ‖k‖) : f.SurjectiveOnWith j.range.topologicalClosure (C + ε) := by replace hyp : ∀ h ∈ j.range, ∃ g, f g = h ∧ ‖g‖ ≤ C * ‖h‖ := by intro h h_in rcases (j.mem_range _).mp h_in with ⟨k, rfl⟩ rw [hj] exact hyp k exact controlled_closure_of_complete hC hε hyp
Analysis\Normed\Group\Hom.lean
/- Copyright (c) 2021 Johan Commelin. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johan Commelin -/ import Mathlib.Analysis.Normed.Group.Int import Mathlib.Analysis.Normed.Group.Uniform /-! # Normed groups homomorphisms This file gathers definitions and elementary constructions about bounded group homomorphisms between normed (abelian) groups (abbreviated to "normed group homs"). The main lemmas relate the boundedness condition to continuity and Lipschitzness. The main construction is to endow the type of normed group homs between two given normed groups with a group structure and a norm, giving rise to a normed group structure. We provide several simple constructions for normed group homs, like kernel, range and equalizer. Some easy other constructions are related to subgroups of normed groups. Since a lot of elementary properties don't require `‖x‖ = 0 → x = 0` we start setting up the theory of `SeminormedAddGroupHom` and we specialize to `NormedAddGroupHom` when needed. -/ noncomputable section open NNReal -- TODO: migrate to the new morphism / morphism_class style /-- A morphism of seminormed abelian groups is a bounded group homomorphism. -/ structure NormedAddGroupHom (V W : Type*) [SeminormedAddCommGroup V] [SeminormedAddCommGroup W] where /-- The function underlying a `NormedAddGroupHom` -/ toFun : V → W /-- A `NormedAddGroupHom` is additive. -/ map_add' : ∀ v₁ v₂, toFun (v₁ + v₂) = toFun v₁ + toFun v₂ /-- A `NormedAddGroupHom` is bounded. -/ bound' : ∃ C, ∀ v, ‖toFun v‖ ≤ C * ‖v‖ namespace AddMonoidHom variable {V W : Type*} [SeminormedAddCommGroup V] [SeminormedAddCommGroup W] {f g : NormedAddGroupHom V W} /-- Associate to a group homomorphism a bounded group homomorphism under a norm control condition. See `AddMonoidHom.mkNormedAddGroupHom'` for a version that uses `ℝ≥0` for the bound. -/ def mkNormedAddGroupHom (f : V →+ W) (C : ℝ) (h : ∀ v, ‖f v‖ ≤ C * ‖v‖) : NormedAddGroupHom V W := { f with bound' := ⟨C, h⟩ } /-- Associate to a group homomorphism a bounded group homomorphism under a norm control condition. See `AddMonoidHom.mkNormedAddGroupHom` for a version that uses `ℝ` for the bound. -/ def mkNormedAddGroupHom' (f : V →+ W) (C : ℝ≥0) (hC : ∀ x, ‖f x‖₊ ≤ C * ‖x‖₊) : NormedAddGroupHom V W := { f with bound' := ⟨C, hC⟩ } end AddMonoidHom theorem exists_pos_bound_of_bound {V W : Type*} [SeminormedAddCommGroup V] [SeminormedAddCommGroup W] {f : V → W} (M : ℝ) (h : ∀ x, ‖f x‖ ≤ M * ‖x‖) : ∃ N, 0 < N ∧ ∀ x, ‖f x‖ ≤ N * ‖x‖ := ⟨max M 1, lt_of_lt_of_le zero_lt_one (le_max_right _ _), fun x => calc ‖f x‖ ≤ M * ‖x‖ := h x _ ≤ max M 1 * ‖x‖ := by gcongr; apply le_max_left ⟩ namespace NormedAddGroupHom variable {V V₁ V₂ V₃ : Type*} [SeminormedAddCommGroup V] [SeminormedAddCommGroup V₁] [SeminormedAddCommGroup V₂] [SeminormedAddCommGroup V₃] variable {f g : NormedAddGroupHom V₁ V₂} /-- A Lipschitz continuous additive homomorphism is a normed additive group homomorphism. -/ def ofLipschitz (f : V₁ →+ V₂) {K : ℝ≥0} (h : LipschitzWith K f) : NormedAddGroupHom V₁ V₂ := f.mkNormedAddGroupHom K fun x ↦ by simpa only [map_zero, dist_zero_right] using h.dist_le_mul x 0 instance funLike : FunLike (NormedAddGroupHom V₁ V₂) V₁ V₂ where coe := toFun coe_injective' := fun f g h => by cases f; cases g; congr -- Porting note: moved this declaration up so we could get a `FunLike` instance sooner. instance toAddMonoidHomClass : AddMonoidHomClass (NormedAddGroupHom V₁ V₂) V₁ V₂ where map_add f := f.map_add' map_zero f := (AddMonoidHom.mk' f.toFun f.map_add').map_zero initialize_simps_projections NormedAddGroupHom (toFun → apply) theorem coe_inj (H : (f : V₁ → V₂) = g) : f = g := by cases f; cases g; congr theorem coe_injective : @Function.Injective (NormedAddGroupHom V₁ V₂) (V₁ → V₂) toFun := by apply coe_inj theorem coe_inj_iff : f = g ↔ (f : V₁ → V₂) = g := ⟨congr_arg _, coe_inj⟩ @[ext] theorem ext (H : ∀ x, f x = g x) : f = g := coe_inj <| funext H variable (f g) @[simp] theorem toFun_eq_coe : f.toFun = f := rfl -- Porting note: removed `simp` because `simpNF` complains the LHS doesn't simplify. theorem coe_mk (f) (h₁) (h₂) (h₃) : ⇑(⟨f, h₁, h₂, h₃⟩ : NormedAddGroupHom V₁ V₂) = f := rfl @[simp] theorem coe_mkNormedAddGroupHom (f : V₁ →+ V₂) (C) (hC) : ⇑(f.mkNormedAddGroupHom C hC) = f := rfl @[simp] theorem coe_mkNormedAddGroupHom' (f : V₁ →+ V₂) (C) (hC) : ⇑(f.mkNormedAddGroupHom' C hC) = f := rfl /-- The group homomorphism underlying a bounded group homomorphism. -/ def toAddMonoidHom (f : NormedAddGroupHom V₁ V₂) : V₁ →+ V₂ := AddMonoidHom.mk' f f.map_add' @[simp] theorem coe_toAddMonoidHom : ⇑f.toAddMonoidHom = f := rfl theorem toAddMonoidHom_injective : Function.Injective (@NormedAddGroupHom.toAddMonoidHom V₁ V₂ _ _) := fun f g h => coe_inj <| by rw [← coe_toAddMonoidHom f, ← coe_toAddMonoidHom g, h] @[simp] theorem mk_toAddMonoidHom (f) (h₁) (h₂) : (⟨f, h₁, h₂⟩ : NormedAddGroupHom V₁ V₂).toAddMonoidHom = AddMonoidHom.mk' f h₁ := rfl theorem bound : ∃ C, 0 < C ∧ ∀ x, ‖f x‖ ≤ C * ‖x‖ := let ⟨_C, hC⟩ := f.bound' exists_pos_bound_of_bound _ hC theorem antilipschitz_of_norm_ge {K : ℝ≥0} (h : ∀ x, ‖x‖ ≤ K * ‖f x‖) : AntilipschitzWith K f := AntilipschitzWith.of_le_mul_dist fun x y => by simpa only [dist_eq_norm, map_sub] using h (x - y) /-- A normed group hom is surjective on the subgroup `K` with constant `C` if every element `x` of `K` has a preimage whose norm is bounded above by `C*‖x‖`. This is a more abstract version of `f` having a right inverse defined on `K` with operator norm at most `C`. -/ def SurjectiveOnWith (f : NormedAddGroupHom V₁ V₂) (K : AddSubgroup V₂) (C : ℝ) : Prop := ∀ h ∈ K, ∃ g, f g = h ∧ ‖g‖ ≤ C * ‖h‖ theorem SurjectiveOnWith.mono {f : NormedAddGroupHom V₁ V₂} {K : AddSubgroup V₂} {C C' : ℝ} (h : f.SurjectiveOnWith K C) (H : C ≤ C') : f.SurjectiveOnWith K C' := by intro k k_in rcases h k k_in with ⟨g, rfl, hg⟩ use g, rfl by_cases Hg : ‖f g‖ = 0 · simpa [Hg] using hg · exact hg.trans (by gcongr) theorem SurjectiveOnWith.exists_pos {f : NormedAddGroupHom V₁ V₂} {K : AddSubgroup V₂} {C : ℝ} (h : f.SurjectiveOnWith K C) : ∃ C' > 0, f.SurjectiveOnWith K C' := by refine ⟨|C| + 1, ?_, ?_⟩ · linarith [abs_nonneg C] · apply h.mono linarith [le_abs_self C] theorem SurjectiveOnWith.surjOn {f : NormedAddGroupHom V₁ V₂} {K : AddSubgroup V₂} {C : ℝ} (h : f.SurjectiveOnWith K C) : Set.SurjOn f Set.univ K := fun x hx => (h x hx).imp fun _a ⟨ha, _⟩ => ⟨Set.mem_univ _, ha⟩ /-! ### The operator norm -/ /-- The operator norm of a seminormed group homomorphism is the inf of all its bounds. -/ def opNorm (f : NormedAddGroupHom V₁ V₂) := sInf { c | 0 ≤ c ∧ ∀ x, ‖f x‖ ≤ c * ‖x‖ } instance hasOpNorm : Norm (NormedAddGroupHom V₁ V₂) := ⟨opNorm⟩ theorem norm_def : ‖f‖ = sInf { c | 0 ≤ c ∧ ∀ x, ‖f x‖ ≤ c * ‖x‖ } := rfl -- So that invocations of `le_csInf` make sense: we show that the set of -- bounds is nonempty and bounded below. theorem bounds_nonempty {f : NormedAddGroupHom V₁ V₂} : ∃ c, c ∈ { c | 0 ≤ c ∧ ∀ x, ‖f x‖ ≤ c * ‖x‖ } := let ⟨M, hMp, hMb⟩ := f.bound ⟨M, le_of_lt hMp, hMb⟩ theorem bounds_bddBelow {f : NormedAddGroupHom V₁ V₂} : BddBelow { c | 0 ≤ c ∧ ∀ x, ‖f x‖ ≤ c * ‖x‖ } := ⟨0, fun _ ⟨hn, _⟩ => hn⟩ theorem opNorm_nonneg : 0 ≤ ‖f‖ := le_csInf bounds_nonempty fun _ ⟨hx, _⟩ => hx /-- The fundamental property of the operator norm: `‖f x‖ ≤ ‖f‖ * ‖x‖`. -/ theorem le_opNorm (x : V₁) : ‖f x‖ ≤ ‖f‖ * ‖x‖ := by obtain ⟨C, _Cpos, hC⟩ := f.bound replace hC := hC x by_cases h : ‖x‖ = 0 · rwa [h, mul_zero] at hC ⊢ have hlt : 0 < ‖x‖ := lt_of_le_of_ne (norm_nonneg x) (Ne.symm h) exact (div_le_iff hlt).mp (le_csInf bounds_nonempty fun c ⟨_, hc⟩ => (div_le_iff hlt).mpr <| by apply hc) theorem le_opNorm_of_le {c : ℝ} {x} (h : ‖x‖ ≤ c) : ‖f x‖ ≤ ‖f‖ * c := le_trans (f.le_opNorm x) (by gcongr; exact f.opNorm_nonneg) theorem le_of_opNorm_le {c : ℝ} (h : ‖f‖ ≤ c) (x : V₁) : ‖f x‖ ≤ c * ‖x‖ := (f.le_opNorm x).trans (by gcongr) /-- continuous linear maps are Lipschitz continuous. -/ theorem lipschitz : LipschitzWith ⟨‖f‖, opNorm_nonneg f⟩ f := LipschitzWith.of_dist_le_mul fun x y => by rw [dist_eq_norm, dist_eq_norm, ← map_sub] apply le_opNorm protected theorem uniformContinuous (f : NormedAddGroupHom V₁ V₂) : UniformContinuous f := f.lipschitz.uniformContinuous @[continuity] protected theorem continuous (f : NormedAddGroupHom V₁ V₂) : Continuous f := f.uniformContinuous.continuous theorem ratio_le_opNorm (x : V₁) : ‖f x‖ / ‖x‖ ≤ ‖f‖ := div_le_of_nonneg_of_le_mul (norm_nonneg _) f.opNorm_nonneg (le_opNorm _ _) /-- If one controls the norm of every `f x`, then one controls the norm of `f`. -/ theorem opNorm_le_bound {M : ℝ} (hMp : 0 ≤ M) (hM : ∀ x, ‖f x‖ ≤ M * ‖x‖) : ‖f‖ ≤ M := csInf_le bounds_bddBelow ⟨hMp, hM⟩ theorem opNorm_eq_of_bounds {M : ℝ} (M_nonneg : 0 ≤ M) (h_above : ∀ x, ‖f x‖ ≤ M * ‖x‖) (h_below : ∀ N ≥ 0, (∀ x, ‖f x‖ ≤ N * ‖x‖) → M ≤ N) : ‖f‖ = M := le_antisymm (f.opNorm_le_bound M_nonneg h_above) ((le_csInf_iff NormedAddGroupHom.bounds_bddBelow ⟨M, M_nonneg, h_above⟩).mpr fun N ⟨N_nonneg, hN⟩ => h_below N N_nonneg hN) theorem opNorm_le_of_lipschitz {f : NormedAddGroupHom V₁ V₂} {K : ℝ≥0} (hf : LipschitzWith K f) : ‖f‖ ≤ K := f.opNorm_le_bound K.2 fun x => by simpa only [dist_zero_right, map_zero] using hf.dist_le_mul x 0 /-- If a bounded group homomorphism map is constructed from a group homomorphism via the constructor `AddMonoidHom.mkNormedAddGroupHom`, then its norm is bounded by the bound given to the constructor if it is nonnegative. -/ theorem mkNormedAddGroupHom_norm_le (f : V₁ →+ V₂) {C : ℝ} (hC : 0 ≤ C) (h : ∀ x, ‖f x‖ ≤ C * ‖x‖) : ‖f.mkNormedAddGroupHom C h‖ ≤ C := opNorm_le_bound _ hC h /-- If a bounded group homomorphism map is constructed from a group homomorphism via the constructor `NormedAddGroupHom.ofLipschitz`, then its norm is bounded by the bound given to the constructor. -/ theorem ofLipschitz_norm_le (f : V₁ →+ V₂) {K : ℝ≥0} (h : LipschitzWith K f) : ‖ofLipschitz f h‖ ≤ K := mkNormedAddGroupHom_norm_le f K.coe_nonneg _ /-- If a bounded group homomorphism map is constructed from a group homomorphism via the constructor `AddMonoidHom.mkNormedAddGroupHom`, then its norm is bounded by the bound given to the constructor or zero if this bound is negative. -/ theorem mkNormedAddGroupHom_norm_le' (f : V₁ →+ V₂) {C : ℝ} (h : ∀ x, ‖f x‖ ≤ C * ‖x‖) : ‖f.mkNormedAddGroupHom C h‖ ≤ max C 0 := opNorm_le_bound _ (le_max_right _ _) fun x => (h x).trans <| by gcongr; apply le_max_left alias _root_.AddMonoidHom.mkNormedAddGroupHom_norm_le := mkNormedAddGroupHom_norm_le alias _root_.AddMonoidHom.mkNormedAddGroupHom_norm_le' := mkNormedAddGroupHom_norm_le' /-! ### Addition of normed group homs -/ /-- Addition of normed group homs. -/ instance add : Add (NormedAddGroupHom V₁ V₂) := ⟨fun f g => (f.toAddMonoidHom + g.toAddMonoidHom).mkNormedAddGroupHom (‖f‖ + ‖g‖) fun v => calc ‖f v + g v‖ ≤ ‖f v‖ + ‖g v‖ := norm_add_le _ _ _ ≤ ‖f‖ * ‖v‖ + ‖g‖ * ‖v‖ := by gcongr <;> apply le_opNorm _ = (‖f‖ + ‖g‖) * ‖v‖ := by rw [add_mul] ⟩ /-- The operator norm satisfies the triangle inequality. -/ theorem opNorm_add_le : ‖f + g‖ ≤ ‖f‖ + ‖g‖ := mkNormedAddGroupHom_norm_le _ (add_nonneg (opNorm_nonneg _) (opNorm_nonneg _)) _ -- Porting note: this library note doesn't seem to apply anymore /- library_note "addition on function coercions"/-- Terms containing `@has_add.add (has_coe_to_fun.F ...) pi.has_add` seem to cause leanchecker to [crash due to an out-of-memory condition](https://github.com/leanprover-community/lean/issues/543). As a workaround, we add a type annotation: `(f + g : V₁ → V₂)` -/ -/ @[simp] theorem coe_add (f g : NormedAddGroupHom V₁ V₂) : ⇑(f + g) = f + g := rfl @[simp] theorem add_apply (f g : NormedAddGroupHom V₁ V₂) (v : V₁) : (f + g) v = f v + g v := rfl /-! ### The zero normed group hom -/ instance zero : Zero (NormedAddGroupHom V₁ V₂) := ⟨(0 : V₁ →+ V₂).mkNormedAddGroupHom 0 (by simp)⟩ instance inhabited : Inhabited (NormedAddGroupHom V₁ V₂) := ⟨0⟩ /-- The norm of the `0` operator is `0`. -/ theorem opNorm_zero : ‖(0 : NormedAddGroupHom V₁ V₂)‖ = 0 := le_antisymm (csInf_le bounds_bddBelow ⟨ge_of_eq rfl, fun _ => le_of_eq (by rw [zero_mul] exact norm_zero)⟩) (opNorm_nonneg _) /-- For normed groups, an operator is zero iff its norm vanishes. -/ theorem opNorm_zero_iff {V₁ V₂ : Type*} [NormedAddCommGroup V₁] [NormedAddCommGroup V₂] {f : NormedAddGroupHom V₁ V₂} : ‖f‖ = 0 ↔ f = 0 := Iff.intro (fun hn => ext fun x => norm_le_zero_iff.1 (calc _ ≤ ‖f‖ * ‖x‖ := le_opNorm _ _ _ = _ := by rw [hn, zero_mul] )) fun hf => by rw [hf, opNorm_zero] @[simp] theorem coe_zero : ⇑(0 : NormedAddGroupHom V₁ V₂) = 0 := rfl @[simp] theorem zero_apply (v : V₁) : (0 : NormedAddGroupHom V₁ V₂) v = 0 := rfl variable {f g} /-! ### The identity normed group hom -/ variable (V) /-- The identity as a continuous normed group hom. -/ @[simps!] def id : NormedAddGroupHom V V := (AddMonoidHom.id V).mkNormedAddGroupHom 1 (by simp [le_refl]) /-- The norm of the identity is at most `1`. It is in fact `1`, except when the norm of every element vanishes, where it is `0`. (Since we are working with seminorms this can happen even if the space is non-trivial.) It means that one can not do better than an inequality in general. -/ theorem norm_id_le : ‖(id V : NormedAddGroupHom V V)‖ ≤ 1 := opNorm_le_bound _ zero_le_one fun x => by simp /-- If there is an element with norm different from `0`, then the norm of the identity equals `1`. (Since we are working with seminorms supposing that the space is non-trivial is not enough.) -/ theorem norm_id_of_nontrivial_seminorm (h : ∃ x : V, ‖x‖ ≠ 0) : ‖id V‖ = 1 := le_antisymm (norm_id_le V) <| by let ⟨x, hx⟩ := h have := (id V).ratio_le_opNorm x rwa [id_apply, div_self hx] at this /-- If a normed space is non-trivial, then the norm of the identity equals `1`. -/ theorem norm_id {V : Type*} [NormedAddCommGroup V] [Nontrivial V] : ‖id V‖ = 1 := by refine norm_id_of_nontrivial_seminorm V ?_ obtain ⟨x, hx⟩ := exists_ne (0 : V) exact ⟨x, ne_of_gt (norm_pos_iff.2 hx)⟩ theorem coe_id : (NormedAddGroupHom.id V : V → V) = _root_.id := rfl /-! ### The negation of a normed group hom -/ /-- Opposite of a normed group hom. -/ instance neg : Neg (NormedAddGroupHom V₁ V₂) := ⟨fun f => (-f.toAddMonoidHom).mkNormedAddGroupHom ‖f‖ fun v => by simp [le_opNorm f v]⟩ @[simp] theorem coe_neg (f : NormedAddGroupHom V₁ V₂) : ⇑(-f) = -f := rfl @[simp] theorem neg_apply (f : NormedAddGroupHom V₁ V₂) (v : V₁) : (-f : NormedAddGroupHom V₁ V₂) v = -f v := rfl theorem opNorm_neg (f : NormedAddGroupHom V₁ V₂) : ‖-f‖ = ‖f‖ := by simp only [norm_def, coe_neg, norm_neg, Pi.neg_apply] /-! ### Subtraction of normed group homs -/ /-- Subtraction of normed group homs. -/ instance sub : Sub (NormedAddGroupHom V₁ V₂) := ⟨fun f g => { f.toAddMonoidHom - g.toAddMonoidHom with bound' := by simp only [AddMonoidHom.sub_apply, AddMonoidHom.toFun_eq_coe, sub_eq_add_neg] exact (f + -g).bound' }⟩ @[simp] theorem coe_sub (f g : NormedAddGroupHom V₁ V₂) : ⇑(f - g) = f - g := rfl @[simp] theorem sub_apply (f g : NormedAddGroupHom V₁ V₂) (v : V₁) : (f - g : NormedAddGroupHom V₁ V₂) v = f v - g v := rfl /-! ### Scalar actions on normed group homs -/ section SMul variable {R R' : Type*} [MonoidWithZero R] [DistribMulAction R V₂] [PseudoMetricSpace R] [BoundedSMul R V₂] [MonoidWithZero R'] [DistribMulAction R' V₂] [PseudoMetricSpace R'] [BoundedSMul R' V₂] instance smul : SMul R (NormedAddGroupHom V₁ V₂) where smul r f := { toFun := r • ⇑f map_add' := (r • f.toAddMonoidHom).map_add' bound' := let ⟨b, hb⟩ := f.bound' ⟨dist r 0 * b, fun x => by have := dist_smul_pair r (f x) (f 0) rw [map_zero, smul_zero, dist_zero_right, dist_zero_right] at this rw [mul_assoc] refine this.trans ?_ gcongr exact hb x⟩ } @[simp] theorem coe_smul (r : R) (f : NormedAddGroupHom V₁ V₂) : ⇑(r • f) = r • ⇑f := rfl @[simp] theorem smul_apply (r : R) (f : NormedAddGroupHom V₁ V₂) (v : V₁) : (r • f) v = r • f v := rfl instance smulCommClass [SMulCommClass R R' V₂] : SMulCommClass R R' (NormedAddGroupHom V₁ V₂) where smul_comm _ _ _ := ext fun _ => smul_comm _ _ _ instance isScalarTower [SMul R R'] [IsScalarTower R R' V₂] : IsScalarTower R R' (NormedAddGroupHom V₁ V₂) where smul_assoc _ _ _ := ext fun _ => smul_assoc _ _ _ instance isCentralScalar [DistribMulAction Rᵐᵒᵖ V₂] [IsCentralScalar R V₂] : IsCentralScalar R (NormedAddGroupHom V₁ V₂) where op_smul_eq_smul _ _ := ext fun _ => op_smul_eq_smul _ _ end SMul instance nsmul : SMul ℕ (NormedAddGroupHom V₁ V₂) where smul n f := { toFun := n • ⇑f map_add' := (n • f.toAddMonoidHom).map_add' bound' := let ⟨b, hb⟩ := f.bound' ⟨n • b, fun v => by rw [Pi.smul_apply, nsmul_eq_mul, mul_assoc] exact (norm_nsmul_le _ _).trans (by gcongr; apply hb)⟩ } @[simp] theorem coe_nsmul (r : ℕ) (f : NormedAddGroupHom V₁ V₂) : ⇑(r • f) = r • ⇑f := rfl @[simp] theorem nsmul_apply (r : ℕ) (f : NormedAddGroupHom V₁ V₂) (v : V₁) : (r • f) v = r • f v := rfl instance zsmul : SMul ℤ (NormedAddGroupHom V₁ V₂) where smul z f := { toFun := z • ⇑f map_add' := (z • f.toAddMonoidHom).map_add' bound' := let ⟨b, hb⟩ := f.bound' ⟨‖z‖ • b, fun v => by rw [Pi.smul_apply, smul_eq_mul, mul_assoc] exact (norm_zsmul_le _ _).trans (by gcongr; apply hb)⟩ } @[simp] theorem coe_zsmul (r : ℤ) (f : NormedAddGroupHom V₁ V₂) : ⇑(r • f) = r • ⇑f := rfl @[simp] theorem zsmul_apply (r : ℤ) (f : NormedAddGroupHom V₁ V₂) (v : V₁) : (r • f) v = r • f v := rfl /-! ### Normed group structure on normed group homs -/ /-- Homs between two given normed groups form a commutative additive group. -/ instance toAddCommGroup : AddCommGroup (NormedAddGroupHom V₁ V₂) := coe_injective.addCommGroup _ rfl (fun _ _ => rfl) (fun _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl) fun _ _ => rfl /-- Normed group homomorphisms themselves form a seminormed group with respect to the operator norm. -/ instance toSeminormedAddCommGroup : SeminormedAddCommGroup (NormedAddGroupHom V₁ V₂) := AddGroupSeminorm.toSeminormedAddCommGroup { toFun := opNorm map_zero' := opNorm_zero neg' := opNorm_neg add_le' := opNorm_add_le } /-- Normed group homomorphisms themselves form a normed group with respect to the operator norm. -/ instance toNormedAddCommGroup {V₁ V₂ : Type*} [NormedAddCommGroup V₁] [NormedAddCommGroup V₂] : NormedAddCommGroup (NormedAddGroupHom V₁ V₂) := AddGroupNorm.toNormedAddCommGroup { toFun := opNorm map_zero' := opNorm_zero neg' := opNorm_neg add_le' := opNorm_add_le eq_zero_of_map_eq_zero' := fun _f => opNorm_zero_iff.1 } /-- Coercion of a `NormedAddGroupHom` is an `AddMonoidHom`. Similar to `AddMonoidHom.coeFn`. -/ @[simps] def coeAddHom : NormedAddGroupHom V₁ V₂ →+ V₁ → V₂ where toFun := DFunLike.coe map_zero' := coe_zero map_add' := coe_add @[simp] theorem coe_sum {ι : Type*} (s : Finset ι) (f : ι → NormedAddGroupHom V₁ V₂) : ⇑(∑ i ∈ s, f i) = ∑ i ∈ s, (f i : V₁ → V₂) := map_sum coeAddHom f s theorem sum_apply {ι : Type*} (s : Finset ι) (f : ι → NormedAddGroupHom V₁ V₂) (v : V₁) : (∑ i ∈ s, f i) v = ∑ i ∈ s, f i v := by simp only [coe_sum, Finset.sum_apply] /-! ### Module structure on normed group homs -/ instance distribMulAction {R : Type*} [MonoidWithZero R] [DistribMulAction R V₂] [PseudoMetricSpace R] [BoundedSMul R V₂] : DistribMulAction R (NormedAddGroupHom V₁ V₂) := Function.Injective.distribMulAction coeAddHom coe_injective coe_smul instance module {R : Type*} [Semiring R] [Module R V₂] [PseudoMetricSpace R] [BoundedSMul R V₂] : Module R (NormedAddGroupHom V₁ V₂) := Function.Injective.module _ coeAddHom coe_injective coe_smul /-! ### Composition of normed group homs -/ /-- The composition of continuous normed group homs. -/ @[simps!] protected def comp (g : NormedAddGroupHom V₂ V₃) (f : NormedAddGroupHom V₁ V₂) : NormedAddGroupHom V₁ V₃ := (g.toAddMonoidHom.comp f.toAddMonoidHom).mkNormedAddGroupHom (‖g‖ * ‖f‖) fun v => calc ‖g (f v)‖ ≤ ‖g‖ * ‖f v‖ := le_opNorm _ _ _ ≤ ‖g‖ * (‖f‖ * ‖v‖) := by gcongr; apply le_opNorm _ = ‖g‖ * ‖f‖ * ‖v‖ := by rw [mul_assoc] theorem norm_comp_le (g : NormedAddGroupHom V₂ V₃) (f : NormedAddGroupHom V₁ V₂) : ‖g.comp f‖ ≤ ‖g‖ * ‖f‖ := mkNormedAddGroupHom_norm_le _ (mul_nonneg (opNorm_nonneg _) (opNorm_nonneg _)) _ theorem norm_comp_le_of_le {g : NormedAddGroupHom V₂ V₃} {C₁ C₂ : ℝ} (hg : ‖g‖ ≤ C₂) (hf : ‖f‖ ≤ C₁) : ‖g.comp f‖ ≤ C₂ * C₁ := le_trans (norm_comp_le g f) <| by gcongr; exact le_trans (norm_nonneg _) hg theorem norm_comp_le_of_le' {g : NormedAddGroupHom V₂ V₃} (C₁ C₂ C₃ : ℝ) (h : C₃ = C₂ * C₁) (hg : ‖g‖ ≤ C₂) (hf : ‖f‖ ≤ C₁) : ‖g.comp f‖ ≤ C₃ := by rw [h] exact norm_comp_le_of_le hg hf /-- Composition of normed groups hom as an additive group morphism. -/ def compHom : NormedAddGroupHom V₂ V₃ →+ NormedAddGroupHom V₁ V₂ →+ NormedAddGroupHom V₁ V₃ := AddMonoidHom.mk' (fun g => AddMonoidHom.mk' (fun f => g.comp f) (by intros ext exact map_add g _ _)) (by intros ext simp only [comp_apply, Pi.add_apply, Function.comp_apply, AddMonoidHom.add_apply, AddMonoidHom.mk'_apply, coe_add]) @[simp] theorem comp_zero (f : NormedAddGroupHom V₂ V₃) : f.comp (0 : NormedAddGroupHom V₁ V₂) = 0 := by ext exact map_zero f @[simp] theorem zero_comp (f : NormedAddGroupHom V₁ V₂) : (0 : NormedAddGroupHom V₂ V₃).comp f = 0 := by ext rfl theorem comp_assoc {V₄ : Type*} [SeminormedAddCommGroup V₄] (h : NormedAddGroupHom V₃ V₄) (g : NormedAddGroupHom V₂ V₃) (f : NormedAddGroupHom V₁ V₂) : (h.comp g).comp f = h.comp (g.comp f) := by ext rfl theorem coe_comp (f : NormedAddGroupHom V₁ V₂) (g : NormedAddGroupHom V₂ V₃) : (g.comp f : V₁ → V₃) = (g : V₂ → V₃) ∘ (f : V₁ → V₂) := rfl end NormedAddGroupHom namespace NormedAddGroupHom variable {V W V₁ V₂ V₃ : Type*} [SeminormedAddCommGroup V] [SeminormedAddCommGroup W] [SeminormedAddCommGroup V₁] [SeminormedAddCommGroup V₂] [SeminormedAddCommGroup V₃] /-- The inclusion of an `AddSubgroup`, as bounded group homomorphism. -/ @[simps!] def incl (s : AddSubgroup V) : NormedAddGroupHom s V where toFun := (Subtype.val : s → V) map_add' v w := AddSubgroup.coe_add _ _ _ bound' := ⟨1, fun v => by rw [one_mul, AddSubgroup.coe_norm]⟩ theorem norm_incl {V' : AddSubgroup V} (x : V') : ‖incl _ x‖ = ‖x‖ := rfl /-!### Kernel -/ section Kernels variable (f : NormedAddGroupHom V₁ V₂) (g : NormedAddGroupHom V₂ V₃) /-- The kernel of a bounded group homomorphism. Naturally endowed with a `SeminormedAddCommGroup` instance. -/ def ker : AddSubgroup V₁ := f.toAddMonoidHom.ker theorem mem_ker (v : V₁) : v ∈ f.ker ↔ f v = 0 := by erw [f.toAddMonoidHom.mem_ker, coe_toAddMonoidHom] /-- Given a normed group hom `f : V₁ → V₂` satisfying `g.comp f = 0` for some `g : V₂ → V₃`, the corestriction of `f` to the kernel of `g`. -/ @[simps] def ker.lift (h : g.comp f = 0) : NormedAddGroupHom V₁ g.ker where toFun v := ⟨f v, by rw [g.mem_ker, ← comp_apply g f, h, zero_apply]⟩ map_add' v w := by simp only [map_add, AddSubmonoid.mk_add_mk] bound' := f.bound' @[simp] theorem ker.incl_comp_lift (h : g.comp f = 0) : (incl g.ker).comp (ker.lift f g h) = f := by ext rfl @[simp] theorem ker_zero : (0 : NormedAddGroupHom V₁ V₂).ker = ⊤ := by ext simp [mem_ker] theorem coe_ker : (f.ker : Set V₁) = (f : V₁ → V₂) ⁻¹' {0} := rfl theorem isClosed_ker {V₂ : Type*} [NormedAddCommGroup V₂] (f : NormedAddGroupHom V₁ V₂) : IsClosed (f.ker : Set V₁) := f.coe_ker ▸ IsClosed.preimage f.continuous (T1Space.t1 0) end Kernels /-! ### Range -/ section Range variable (f : NormedAddGroupHom V₁ V₂) (g : NormedAddGroupHom V₂ V₃) /-- The image of a bounded group homomorphism. Naturally endowed with a `SeminormedAddCommGroup` instance. -/ def range : AddSubgroup V₂ := f.toAddMonoidHom.range theorem mem_range (v : V₂) : v ∈ f.range ↔ ∃ w, f w = v := Iff.rfl @[simp] theorem mem_range_self (v : V₁) : f v ∈ f.range := ⟨v, rfl⟩ theorem comp_range : (g.comp f).range = AddSubgroup.map g.toAddMonoidHom f.range := by erw [AddMonoidHom.map_range] rfl theorem incl_range (s : AddSubgroup V₁) : (incl s).range = s := by ext x exact ⟨fun ⟨y, hy⟩ => by rw [← hy]; simp, fun hx => ⟨⟨x, hx⟩, by simp⟩⟩ @[simp] theorem range_comp_incl_top : (f.comp (incl (⊤ : AddSubgroup V₁))).range = f.range := by simp [comp_range, incl_range, ← AddMonoidHom.range_eq_map]; rfl end Range variable {f : NormedAddGroupHom V W} /-- A `NormedAddGroupHom` is *norm-nonincreasing* if `‖f v‖ ≤ ‖v‖` for all `v`. -/ def NormNoninc (f : NormedAddGroupHom V W) : Prop := ∀ v, ‖f v‖ ≤ ‖v‖ namespace NormNoninc theorem normNoninc_iff_norm_le_one : f.NormNoninc ↔ ‖f‖ ≤ 1 := by refine ⟨fun h => ?_, fun h => fun v => ?_⟩ · refine opNorm_le_bound _ zero_le_one fun v => ?_ simpa [one_mul] using h v · simpa using le_of_opNorm_le f h v theorem zero : (0 : NormedAddGroupHom V₁ V₂).NormNoninc := fun v => by simp theorem id : (id V).NormNoninc := fun _v => le_rfl theorem comp {g : NormedAddGroupHom V₂ V₃} {f : NormedAddGroupHom V₁ V₂} (hg : g.NormNoninc) (hf : f.NormNoninc) : (g.comp f).NormNoninc := fun v => (hg (f v)).trans (hf v) @[simp] theorem neg_iff {f : NormedAddGroupHom V₁ V₂} : (-f).NormNoninc ↔ f.NormNoninc := ⟨fun h x => by simpa using h x, fun h x => (norm_neg (f x)).le.trans (h x)⟩ end NormNoninc section Isometry theorem norm_eq_of_isometry {f : NormedAddGroupHom V W} (hf : Isometry f) (v : V) : ‖f v‖ = ‖v‖ := (AddMonoidHomClass.isometry_iff_norm f).mp hf v theorem isometry_id : @Isometry V V _ _ (id V) := _root_.isometry_id theorem isometry_comp {g : NormedAddGroupHom V₂ V₃} {f : NormedAddGroupHom V₁ V₂} (hg : Isometry g) (hf : Isometry f) : Isometry (g.comp f) := hg.comp hf theorem normNoninc_of_isometry (hf : Isometry f) : f.NormNoninc := fun v => le_of_eq <| norm_eq_of_isometry hf v end Isometry variable {W₁ W₂ W₃ : Type*} [SeminormedAddCommGroup W₁] [SeminormedAddCommGroup W₂] [SeminormedAddCommGroup W₃] variable (f) (g : NormedAddGroupHom V W) variable {f₁ g₁ : NormedAddGroupHom V₁ W₁} variable {f₂ g₂ : NormedAddGroupHom V₂ W₂} variable {f₃ g₃ : NormedAddGroupHom V₃ W₃} /-- The equalizer of two morphisms `f g : NormedAddGroupHom V W`. -/ def equalizer := (f - g).ker namespace Equalizer /-- The inclusion of `f.equalizer g` as a `NormedAddGroupHom`. -/ def ι : NormedAddGroupHom (f.equalizer g) V := incl _ theorem comp_ι_eq : f.comp (ι f g) = g.comp (ι f g) := by ext x rw [comp_apply, comp_apply, ← sub_eq_zero, ← NormedAddGroupHom.sub_apply] exact x.2 variable {f g} /-- If `φ : NormedAddGroupHom V₁ V` is such that `f.comp φ = g.comp φ`, the induced morphism `NormedAddGroupHom V₁ (f.equalizer g)`. -/ @[simps] def lift (φ : NormedAddGroupHom V₁ V) (h : f.comp φ = g.comp φ) : NormedAddGroupHom V₁ (f.equalizer g) where toFun v := ⟨φ v, show (f - g) (φ v) = 0 by rw [NormedAddGroupHom.sub_apply, sub_eq_zero, ← comp_apply, h, comp_apply]⟩ map_add' v₁ v₂ := by ext simp only [map_add, AddSubgroup.coe_add, Subtype.coe_mk] bound' := by obtain ⟨C, _C_pos, hC⟩ := φ.bound exact ⟨C, hC⟩ @[simp] theorem ι_comp_lift (φ : NormedAddGroupHom V₁ V) (h : f.comp φ = g.comp φ) : (ι _ _).comp (lift φ h) = φ := by ext rfl /-- The lifting property of the equalizer as an equivalence. -/ @[simps] def liftEquiv : { φ : NormedAddGroupHom V₁ V // f.comp φ = g.comp φ } ≃ NormedAddGroupHom V₁ (f.equalizer g) where toFun φ := lift φ φ.prop invFun ψ := ⟨(ι f g).comp ψ, by rw [← comp_assoc, ← comp_assoc, comp_ι_eq]⟩ left_inv φ := by simp right_inv ψ := by ext rfl /-- Given `φ : NormedAddGroupHom V₁ V₂` and `ψ : NormedAddGroupHom W₁ W₂` such that `ψ.comp f₁ = f₂.comp φ` and `ψ.comp g₁ = g₂.comp φ`, the induced morphism `NormedAddGroupHom (f₁.equalizer g₁) (f₂.equalizer g₂)`. -/ def map (φ : NormedAddGroupHom V₁ V₂) (ψ : NormedAddGroupHom W₁ W₂) (hf : ψ.comp f₁ = f₂.comp φ) (hg : ψ.comp g₁ = g₂.comp φ) : NormedAddGroupHom (f₁.equalizer g₁) (f₂.equalizer g₂) := lift (φ.comp <| ι _ _) <| by simp only [← comp_assoc, ← hf, ← hg] simp only [comp_assoc, comp_ι_eq f₁ g₁] variable {φ : NormedAddGroupHom V₁ V₂} {ψ : NormedAddGroupHom W₁ W₂} variable {φ' : NormedAddGroupHom V₂ V₃} {ψ' : NormedAddGroupHom W₂ W₃} @[simp] theorem ι_comp_map (hf : ψ.comp f₁ = f₂.comp φ) (hg : ψ.comp g₁ = g₂.comp φ) : (ι f₂ g₂).comp (map φ ψ hf hg) = φ.comp (ι f₁ g₁) := ι_comp_lift _ _ @[simp] theorem map_id : map (f₂ := f₁) (g₂ := g₁) (id V₁) (id W₁) rfl rfl = id (f₁.equalizer g₁) := by ext rfl theorem comm_sq₂ (hf : ψ.comp f₁ = f₂.comp φ) (hf' : ψ'.comp f₂ = f₃.comp φ') : (ψ'.comp ψ).comp f₁ = f₃.comp (φ'.comp φ) := by rw [comp_assoc, hf, ← comp_assoc, hf', comp_assoc] theorem map_comp_map (hf : ψ.comp f₁ = f₂.comp φ) (hg : ψ.comp g₁ = g₂.comp φ) (hf' : ψ'.comp f₂ = f₃.comp φ') (hg' : ψ'.comp g₂ = g₃.comp φ') : (map φ' ψ' hf' hg').comp (map φ ψ hf hg) = map (φ'.comp φ) (ψ'.comp ψ) (comm_sq₂ hf hf') (comm_sq₂ hg hg') := by ext rfl theorem ι_normNoninc : (ι f g).NormNoninc := fun _v => le_rfl /-- The lifting of a norm nonincreasing morphism is norm nonincreasing. -/ theorem lift_normNoninc (φ : NormedAddGroupHom V₁ V) (h : f.comp φ = g.comp φ) (hφ : φ.NormNoninc) : (lift φ h).NormNoninc := hφ /-- If `φ` satisfies `‖φ‖ ≤ C`, then the same is true for the lifted morphism. -/ theorem norm_lift_le (φ : NormedAddGroupHom V₁ V) (h : f.comp φ = g.comp φ) (C : ℝ) (hφ : ‖φ‖ ≤ C) : ‖lift φ h‖ ≤ C := hφ theorem map_normNoninc (hf : ψ.comp f₁ = f₂.comp φ) (hg : ψ.comp g₁ = g₂.comp φ) (hφ : φ.NormNoninc) : (map φ ψ hf hg).NormNoninc := lift_normNoninc _ _ <| hφ.comp ι_normNoninc theorem norm_map_le (hf : ψ.comp f₁ = f₂.comp φ) (hg : ψ.comp g₁ = g₂.comp φ) (C : ℝ) (hφ : ‖φ.comp (ι f₁ g₁)‖ ≤ C) : ‖map φ ψ hf hg‖ ≤ C := norm_lift_le _ _ _ hφ end Equalizer end NormedAddGroupHom
Analysis\Normed\Group\HomCompletion.lean
/- Copyright (c) 2021 Patrick Massot. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot -/ import Mathlib.Analysis.Normed.Group.Hom import Mathlib.Analysis.Normed.Group.Completion /-! # Completion of normed group homs Given two (semi) normed groups `G` and `H` and a normed group hom `f : NormedAddGroupHom G H`, we build and study a normed group hom `f.completion : NormedAddGroupHom (completion G) (completion H)` such that the diagram ``` f G -----------> H | | | | | | V V completion G -----------> completion H f.completion ``` commutes. The map itself comes from the general theory of completion of uniform spaces, but here we want a normed group hom, study its operator norm and kernel. The vertical maps in the above diagrams are also normed group homs constructed in this file. ## Main definitions and results: * `NormedAddGroupHom.completion`: see the discussion above. * `NormedAddCommGroup.toCompl : NormedAddGroupHom G (completion G)`: the canonical map from `G` to its completion, as a normed group hom * `NormedAddGroupHom.completion_toCompl`: the above diagram indeed commutes. * `NormedAddGroupHom.norm_completion`: `‖f.completion‖ = ‖f‖` * `NormedAddGroupHom.ker_le_ker_completion`: the kernel of `f.completion` contains the image of the kernel of `f`. * `NormedAddGroupHom.ker_completion`: the kernel of `f.completion` is the closure of the image of the kernel of `f` under an assumption that `f` is quantitatively surjective onto its image. * `NormedAddGroupHom.extension` : if `H` is complete, the extension of `f : NormedAddGroupHom G H` to a `NormedAddGroupHom (completion G) H`. -/ noncomputable section open Set NormedAddGroupHom UniformSpace section Completion variable {G : Type*} [SeminormedAddCommGroup G] {H : Type*} [SeminormedAddCommGroup H] {K : Type*} [SeminormedAddCommGroup K] /-- The normed group hom induced between completions. -/ def NormedAddGroupHom.completion (f : NormedAddGroupHom G H) : NormedAddGroupHom (Completion G) (Completion H) := .ofLipschitz (f.toAddMonoidHom.completion f.continuous) f.lipschitz.completion_map theorem NormedAddGroupHom.completion_def (f : NormedAddGroupHom G H) (x : Completion G) : f.completion x = Completion.map f x := rfl @[simp] theorem NormedAddGroupHom.completion_coe_to_fun (f : NormedAddGroupHom G H) : (f.completion : Completion G → Completion H) = Completion.map f := rfl -- Porting note: `@[simp]` moved to the next lemma theorem NormedAddGroupHom.completion_coe (f : NormedAddGroupHom G H) (g : G) : f.completion g = f g := Completion.map_coe f.uniformContinuous _ @[simp] theorem NormedAddGroupHom.completion_coe' (f : NormedAddGroupHom G H) (g : G) : Completion.map f g = f g := f.completion_coe g /-- Completion of normed group homs as a normed group hom. -/ @[simps] def normedAddGroupHomCompletionHom : NormedAddGroupHom G H →+ NormedAddGroupHom (Completion G) (Completion H) where toFun := NormedAddGroupHom.completion map_zero' := toAddMonoidHom_injective AddMonoidHom.completion_zero map_add' f g := toAddMonoidHom_injective <| f.toAddMonoidHom.completion_add g.toAddMonoidHom f.continuous g.continuous @[simp] theorem NormedAddGroupHom.completion_id : (NormedAddGroupHom.id G).completion = NormedAddGroupHom.id (Completion G) := by ext x rw [NormedAddGroupHom.completion_def, NormedAddGroupHom.coe_id, Completion.map_id] rfl theorem NormedAddGroupHom.completion_comp (f : NormedAddGroupHom G H) (g : NormedAddGroupHom H K) : g.completion.comp f.completion = (g.comp f).completion := by ext x rw [NormedAddGroupHom.coe_comp, NormedAddGroupHom.completion_def, NormedAddGroupHom.completion_coe_to_fun, NormedAddGroupHom.completion_coe_to_fun, Completion.map_comp g.uniformContinuous f.uniformContinuous] rfl theorem NormedAddGroupHom.completion_neg (f : NormedAddGroupHom G H) : (-f).completion = -f.completion := map_neg (normedAddGroupHomCompletionHom : NormedAddGroupHom G H →+ _) f theorem NormedAddGroupHom.completion_add (f g : NormedAddGroupHom G H) : (f + g).completion = f.completion + g.completion := normedAddGroupHomCompletionHom.map_add f g theorem NormedAddGroupHom.completion_sub (f g : NormedAddGroupHom G H) : (f - g).completion = f.completion - g.completion := map_sub (normedAddGroupHomCompletionHom : NormedAddGroupHom G H →+ _) f g @[simp] theorem NormedAddGroupHom.zero_completion : (0 : NormedAddGroupHom G H).completion = 0 := normedAddGroupHomCompletionHom.map_zero /-- The map from a normed group to its completion, as a normed group hom. -/ @[simps] -- Porting note: added `@[simps]` def NormedAddCommGroup.toCompl : NormedAddGroupHom G (Completion G) where toFun := (↑) map_add' := Completion.toCompl.map_add bound' := ⟨1, by simp [le_refl]⟩ open NormedAddCommGroup theorem NormedAddCommGroup.norm_toCompl (x : G) : ‖toCompl x‖ = ‖x‖ := Completion.norm_coe x theorem NormedAddCommGroup.denseRange_toCompl : DenseRange (toCompl : G → Completion G) := Completion.denseInducing_coe.dense @[simp] theorem NormedAddGroupHom.completion_toCompl (f : NormedAddGroupHom G H) : f.completion.comp toCompl = toCompl.comp f := by ext x; simp @[simp] theorem NormedAddGroupHom.norm_completion (f : NormedAddGroupHom G H) : ‖f.completion‖ = ‖f‖ := le_antisymm (ofLipschitz_norm_le _ _) <| opNorm_le_bound _ (norm_nonneg _) fun x => by simpa using f.completion.le_opNorm x theorem NormedAddGroupHom.ker_le_ker_completion (f : NormedAddGroupHom G H) : (toCompl.comp <| incl f.ker).range ≤ f.completion.ker := by rintro _ ⟨⟨g, h₀ : f g = 0⟩, rfl⟩ simp [h₀, mem_ker, Completion.coe_zero] theorem NormedAddGroupHom.ker_completion {f : NormedAddGroupHom G H} {C : ℝ} (h : f.SurjectiveOnWith f.range C) : (f.completion.ker : Set <| Completion G) = closure (toCompl.comp <| incl f.ker).range := by refine le_antisymm ?_ (closure_minimal f.ker_le_ker_completion f.completion.isClosed_ker) rintro hatg (hatg_in : f.completion hatg = 0) rw [SeminormedAddCommGroup.mem_closure_iff] intro ε ε_pos rcases h.exists_pos with ⟨C', C'_pos, hC'⟩ rcases exists_pos_mul_lt ε_pos (1 + C' * ‖f‖) with ⟨δ, δ_pos, hδ⟩ obtain ⟨_, ⟨g : G, rfl⟩, hg : ‖hatg - g‖ < δ⟩ := SeminormedAddCommGroup.mem_closure_iff.mp (Completion.denseInducing_coe.dense hatg) δ δ_pos obtain ⟨g' : G, hgg' : f g' = f g, hfg : ‖g'‖ ≤ C' * ‖f g‖⟩ := hC' (f g) (mem_range_self _ g) have mem_ker : g - g' ∈ f.ker := by rw [f.mem_ker, map_sub, sub_eq_zero.mpr hgg'.symm] refine ⟨_, ⟨⟨g - g', mem_ker⟩, rfl⟩, ?_⟩ have : ‖f g‖ ≤ ‖f‖ * δ := calc ‖f g‖ ≤ ‖f‖ * ‖hatg - g‖ := by simpa [hatg_in] using f.completion.le_opNorm (hatg - g) _ ≤ ‖f‖ * δ := by gcongr calc ‖hatg - ↑(g - g')‖ = ‖hatg - g + g'‖ := by rw [Completion.coe_sub, sub_add] _ ≤ ‖hatg - g‖ + ‖(g' : Completion G)‖ := norm_add_le _ _ _ = ‖hatg - g‖ + ‖g'‖ := by rw [Completion.norm_coe] _ < δ + C' * ‖f g‖ := add_lt_add_of_lt_of_le hg hfg _ ≤ δ + C' * (‖f‖ * δ) := by gcongr _ < ε := by simpa only [add_mul, one_mul, mul_assoc] using hδ end Completion section Extension variable {G : Type*} [SeminormedAddCommGroup G] variable {H : Type*} [SeminormedAddCommGroup H] [T0Space H] [CompleteSpace H] /-- If `H` is complete, the extension of `f : NormedAddGroupHom G H` to a `NormedAddGroupHom (completion G) H`. -/ def NormedAddGroupHom.extension (f : NormedAddGroupHom G H) : NormedAddGroupHom (Completion G) H := .ofLipschitz (f.toAddMonoidHom.extension f.continuous) <| let _ := MetricSpace.ofT0PseudoMetricSpace H f.lipschitz.completion_extension theorem NormedAddGroupHom.extension_def (f : NormedAddGroupHom G H) (v : G) : f.extension v = Completion.extension f v := rfl @[simp] theorem NormedAddGroupHom.extension_coe (f : NormedAddGroupHom G H) (v : G) : f.extension v = f v := AddMonoidHom.extension_coe _ f.continuous _ theorem NormedAddGroupHom.extension_coe_to_fun (f : NormedAddGroupHom G H) : (f.extension : Completion G → H) = Completion.extension f := rfl theorem NormedAddGroupHom.extension_unique (f : NormedAddGroupHom G H) {g : NormedAddGroupHom (Completion G) H} (hg : ∀ v, f v = g v) : f.extension = g := by ext v rw [NormedAddGroupHom.extension_coe_to_fun, Completion.extension_unique f.uniformContinuous g.uniformContinuous fun a => hg a] end Extension
Analysis\Normed\Group\InfiniteSum.lean
/- Copyright (c) 2021 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel, Heather Macbeth, Johannes Hölzl, Yury Kudryashov -/ import Mathlib.Algebra.BigOperators.Intervals import Mathlib.Analysis.Normed.Group.Uniform import Mathlib.Topology.Instances.NNReal /-! # Infinite sums in (semi)normed groups In a complete (semi)normed group, - `summable_iff_vanishing_norm`: a series `∑' i, f i` is summable if and only if for any `ε > 0`, there exists a finite set `s` such that the sum `∑ i ∈ t, f i` over any finite set `t` disjoint with `s` has norm less than `ε`; - `Summable.of_norm_bounded`, `Summable.of_norm_bounded_eventually`: if `‖f i‖` is bounded above by a summable series `∑' i, g i`, then `∑' i, f i` is summable as well; the same is true if the inequality hold only off some finite set. - `tsum_of_norm_bounded`, `HasSum.norm_le_of_bounded`: if `‖f i‖ ≤ g i`, where `∑' i, g i` is a summable series, then `‖∑' i, f i‖ ≤ ∑' i, g i`. ## Tags infinite series, absolute convergence, normed group -/ open Topology NNReal open Finset Filter Metric variable {ι α E F : Type*} [SeminormedAddCommGroup E] [SeminormedAddCommGroup F] theorem cauchySeq_finset_iff_vanishing_norm {f : ι → E} : (CauchySeq fun s : Finset ι => ∑ i ∈ s, f i) ↔ ∀ ε > (0 : ℝ), ∃ s : Finset ι, ∀ t, Disjoint t s → ‖∑ i ∈ t, f i‖ < ε := by rw [cauchySeq_finset_iff_sum_vanishing, nhds_basis_ball.forall_iff] · simp only [ball_zero_eq, Set.mem_setOf_eq] · rintro s t hst ⟨s', hs'⟩ exact ⟨s', fun t' ht' => hst <| hs' _ ht'⟩ theorem summable_iff_vanishing_norm [CompleteSpace E] {f : ι → E} : Summable f ↔ ∀ ε > (0 : ℝ), ∃ s : Finset ι, ∀ t, Disjoint t s → ‖∑ i ∈ t, f i‖ < ε := by rw [summable_iff_cauchySeq_finset, cauchySeq_finset_iff_vanishing_norm] theorem cauchySeq_finset_of_norm_bounded_eventually {f : ι → E} {g : ι → ℝ} (hg : Summable g) (h : ∀ᶠ i in cofinite, ‖f i‖ ≤ g i) : CauchySeq fun s => ∑ i ∈ s, f i := by refine cauchySeq_finset_iff_vanishing_norm.2 fun ε hε => ?_ rcases summable_iff_vanishing_norm.1 hg ε hε with ⟨s, hs⟩ classical refine ⟨s ∪ h.toFinset, fun t ht => ?_⟩ have : ∀ i ∈ t, ‖f i‖ ≤ g i := by intro i hi simp only [disjoint_left, mem_union, not_or, h.mem_toFinset, Set.mem_compl_iff, Classical.not_not] at ht exact (ht hi).2 calc ‖∑ i ∈ t, f i‖ ≤ ∑ i ∈ t, g i := norm_sum_le_of_le _ this _ ≤ ‖∑ i ∈ t, g i‖ := le_abs_self _ _ < ε := hs _ (ht.mono_right le_sup_left) theorem cauchySeq_finset_of_norm_bounded {f : ι → E} (g : ι → ℝ) (hg : Summable g) (h : ∀ i, ‖f i‖ ≤ g i) : CauchySeq fun s : Finset ι => ∑ i ∈ s, f i := cauchySeq_finset_of_norm_bounded_eventually hg <| eventually_of_forall h /-- A version of the **direct comparison test** for conditionally convergent series. See `cauchySeq_finset_of_norm_bounded` for the same statement about absolutely convergent ones. -/ theorem cauchySeq_range_of_norm_bounded {f : ℕ → E} (g : ℕ → ℝ) (hg : CauchySeq fun n => ∑ i ∈ range n, g i) (hf : ∀ i, ‖f i‖ ≤ g i) : CauchySeq fun n => ∑ i ∈ range n, f i := by refine Metric.cauchySeq_iff'.2 fun ε hε => ?_ refine (Metric.cauchySeq_iff'.1 hg ε hε).imp fun N hg n hn => ?_ specialize hg n hn rw [dist_eq_norm, ← sum_Ico_eq_sub _ hn] at hg ⊢ calc ‖∑ k ∈ Ico N n, f k‖ ≤ ∑ k ∈ _, ‖f k‖ := norm_sum_le _ _ _ ≤ ∑ k ∈ _, g k := sum_le_sum fun x _ => hf x _ ≤ ‖∑ k ∈ _, g k‖ := le_abs_self _ _ < ε := hg theorem cauchySeq_finset_of_summable_norm {f : ι → E} (hf : Summable fun a => ‖f a‖) : CauchySeq fun s : Finset ι => ∑ a ∈ s, f a := cauchySeq_finset_of_norm_bounded _ hf fun _i => le_rfl /-- If a function `f` is summable in norm, and along some sequence of finsets exhausting the space its sum is converging to a limit `a`, then this holds along all finsets, i.e., `f` is summable with sum `a`. -/ theorem hasSum_of_subseq_of_summable {f : ι → E} (hf : Summable fun a => ‖f a‖) {s : α → Finset ι} {p : Filter α} [NeBot p] (hs : Tendsto s p atTop) {a : E} (ha : Tendsto (fun b => ∑ i ∈ s b, f i) p (𝓝 a)) : HasSum f a := tendsto_nhds_of_cauchySeq_of_subseq (cauchySeq_finset_of_summable_norm hf) hs ha theorem hasSum_iff_tendsto_nat_of_summable_norm {f : ℕ → E} {a : E} (hf : Summable fun i => ‖f i‖) : HasSum f a ↔ Tendsto (fun n : ℕ => ∑ i ∈ range n, f i) atTop (𝓝 a) := ⟨fun h => h.tendsto_sum_nat, fun h => hasSum_of_subseq_of_summable hf tendsto_finset_range h⟩ /-- The direct comparison test for series: if the norm of `f` is bounded by a real function `g` which is summable, then `f` is summable. -/ theorem Summable.of_norm_bounded [CompleteSpace E] {f : ι → E} (g : ι → ℝ) (hg : Summable g) (h : ∀ i, ‖f i‖ ≤ g i) : Summable f := by rw [summable_iff_cauchySeq_finset] exact cauchySeq_finset_of_norm_bounded g hg h theorem HasSum.norm_le_of_bounded {f : ι → E} {g : ι → ℝ} {a : E} {b : ℝ} (hf : HasSum f a) (hg : HasSum g b) (h : ∀ i, ‖f i‖ ≤ g i) : ‖a‖ ≤ b := by classical exact le_of_tendsto_of_tendsto' hf.norm hg fun _s ↦ norm_sum_le_of_le _ fun i _hi ↦ h i /-- Quantitative result associated to the direct comparison test for series: If `∑' i, g i` is summable, and for all `i`, `‖f i‖ ≤ g i`, then `‖∑' i, f i‖ ≤ ∑' i, g i`. Note that we do not assume that `∑' i, f i` is summable, and it might not be the case if `α` is not a complete space. -/ theorem tsum_of_norm_bounded {f : ι → E} {g : ι → ℝ} {a : ℝ} (hg : HasSum g a) (h : ∀ i, ‖f i‖ ≤ g i) : ‖∑' i : ι, f i‖ ≤ a := by by_cases hf : Summable f · exact hf.hasSum.norm_le_of_bounded hg h · rw [tsum_eq_zero_of_not_summable hf, norm_zero] classical exact ge_of_tendsto' hg fun s => sum_nonneg fun i _hi => (norm_nonneg _).trans (h i) /-- If `∑' i, ‖f i‖` is summable, then `‖∑' i, f i‖ ≤ (∑' i, ‖f i‖)`. Note that we do not assume that `∑' i, f i` is summable, and it might not be the case if `α` is not a complete space. -/ theorem norm_tsum_le_tsum_norm {f : ι → E} (hf : Summable fun i => ‖f i‖) : ‖∑' i, f i‖ ≤ ∑' i, ‖f i‖ := tsum_of_norm_bounded hf.hasSum fun _i => le_rfl /-- Quantitative result associated to the direct comparison test for series: If `∑' i, g i` is summable, and for all `i`, `‖f i‖₊ ≤ g i`, then `‖∑' i, f i‖₊ ≤ ∑' i, g i`. Note that we do not assume that `∑' i, f i` is summable, and it might not be the case if `α` is not a complete space. -/ theorem tsum_of_nnnorm_bounded {f : ι → E} {g : ι → ℝ≥0} {a : ℝ≥0} (hg : HasSum g a) (h : ∀ i, ‖f i‖₊ ≤ g i) : ‖∑' i : ι, f i‖₊ ≤ a := by simp only [← NNReal.coe_le_coe, ← NNReal.hasSum_coe, coe_nnnorm] at * exact tsum_of_norm_bounded hg h /-- If `∑' i, ‖f i‖₊` is summable, then `‖∑' i, f i‖₊ ≤ ∑' i, ‖f i‖₊`. Note that we do not assume that `∑' i, f i` is summable, and it might not be the case if `α` is not a complete space. -/ theorem nnnorm_tsum_le {f : ι → E} (hf : Summable fun i => ‖f i‖₊) : ‖∑' i, f i‖₊ ≤ ∑' i, ‖f i‖₊ := tsum_of_nnnorm_bounded hf.hasSum fun _i => le_rfl variable [CompleteSpace E] /-- Variant of the direct comparison test for series: if the norm of `f` is eventually bounded by a real function `g` which is summable, then `f` is summable. -/ theorem Summable.of_norm_bounded_eventually {f : ι → E} (g : ι → ℝ) (hg : Summable g) (h : ∀ᶠ i in cofinite, ‖f i‖ ≤ g i) : Summable f := summable_iff_cauchySeq_finset.2 <| cauchySeq_finset_of_norm_bounded_eventually hg h /-- Variant of the direct comparison test for series: if the norm of `f` is eventually bounded by a real function `g` which is summable, then `f` is summable. -/ theorem Summable.of_norm_bounded_eventually_nat {f : ℕ → E} (g : ℕ → ℝ) (hg : Summable g) (h : ∀ᶠ i in atTop, ‖f i‖ ≤ g i) : Summable f := .of_norm_bounded_eventually g hg <| Nat.cofinite_eq_atTop ▸ h theorem Summable.of_nnnorm_bounded {f : ι → E} (g : ι → ℝ≥0) (hg : Summable g) (h : ∀ i, ‖f i‖₊ ≤ g i) : Summable f := .of_norm_bounded (fun i => (g i : ℝ)) (NNReal.summable_coe.2 hg) h theorem Summable.of_norm {f : ι → E} (hf : Summable fun a => ‖f a‖) : Summable f := .of_norm_bounded _ hf fun _i => le_rfl theorem Summable.of_nnnorm {f : ι → E} (hf : Summable fun a => ‖f a‖₊) : Summable f := .of_nnnorm_bounded _ hf fun _i => le_rfl
Analysis\Normed\Group\Int.lean
/- Copyright (c) 2018 Patrick Massot. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Johannes Hölzl, Yaël Dillies -/ import Mathlib.Analysis.Normed.Group.Basic import Mathlib.Topology.Instances.Int /-! # ℤ as a normed group -/ open NNReal variable {α : Type*} namespace Int instance instNormedAddCommGroup : NormedAddCommGroup ℤ where norm n := ‖(n : ℝ)‖ dist_eq m n := by simp only [Int.dist_eq, norm, Int.cast_sub] @[norm_cast] theorem norm_cast_real (m : ℤ) : ‖(m : ℝ)‖ = ‖m‖ := rfl theorem norm_eq_abs (n : ℤ) : ‖n‖ = |(n : ℝ)| := rfl @[simp] theorem norm_natCast (n : ℕ) : ‖(n : ℤ)‖ = n := by simp [Int.norm_eq_abs] @[deprecated (since := "2024-04-05")] alias norm_coe_nat := norm_natCast theorem _root_.NNReal.natCast_natAbs (n : ℤ) : (n.natAbs : ℝ≥0) = ‖n‖₊ := NNReal.eq <| calc ((n.natAbs : ℝ≥0) : ℝ) = (n.natAbs : ℤ) := by simp only [Int.cast_natCast, NNReal.coe_natCast] _ = |(n : ℝ)| := by simp only [Int.natCast_natAbs, Int.cast_abs] _ = ‖n‖ := (norm_eq_abs n).symm theorem abs_le_floor_nnreal_iff (z : ℤ) (c : ℝ≥0) : |z| ≤ ⌊c⌋₊ ↔ ‖z‖₊ ≤ c := by rw [Int.abs_eq_natAbs, Int.ofNat_le, Nat.le_floor_iff (zero_le c), NNReal.natCast_natAbs z] end Int -- Now that we've installed the norm on `ℤ`, -- we can state some lemmas about `zsmul`. section variable [SeminormedCommGroup α] @[to_additive norm_zsmul_le] theorem norm_zpow_le_mul_norm (n : ℤ) (a : α) : ‖a ^ n‖ ≤ ‖n‖ * ‖a‖ := by rcases n.eq_nat_or_neg with ⟨n, rfl | rfl⟩ <;> simpa using norm_pow_le_mul_norm n a @[to_additive nnnorm_zsmul_le] theorem nnnorm_zpow_le_mul_norm (n : ℤ) (a : α) : ‖a ^ n‖₊ ≤ ‖n‖₊ * ‖a‖₊ := by simpa only [← NNReal.coe_le_coe, NNReal.coe_mul] using norm_zpow_le_mul_norm n a end
Analysis\Normed\Group\Lemmas.lean
/- Copyright (c) 2022 Patrick Massot. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot -/ import Mathlib.Analysis.Normed.Group.Uniform import Mathlib.Topology.Instances.NNReal /-! # Further lemmas about normed groups This file contains further lemmas about normed groups, requiring heavier imports than `Mathlib/Analysis/Normed/Group/Basic.lean`. ## TODO - Move lemmas from `Basic` to other places, including this file. -/ variable {E : Type*} [SeminormedAddCommGroup E] open NNReal Topology theorem eventually_nnnorm_sub_lt (x₀ : E) {ε : ℝ≥0} (ε_pos : 0 < ε) : ∀ᶠ x in 𝓝 x₀, ‖x - x₀‖₊ < ε := (continuousAt_id.sub continuousAt_const).nnnorm (gt_mem_nhds <| by simpa) theorem eventually_norm_sub_lt (x₀ : E) {ε : ℝ} (ε_pos : 0 < ε) : ∀ᶠ x in 𝓝 x₀, ‖x - x₀‖ < ε := (continuousAt_id.sub continuousAt_const).norm (gt_mem_nhds <| by simpa)
Analysis\Normed\Group\Pointwise.lean
/- Copyright (c) 2021 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel, Yaël Dillies -/ import Mathlib.Analysis.Normed.Group.Bounded import Mathlib.Analysis.Normed.Group.Uniform import Mathlib.Topology.MetricSpace.Thickening /-! # Properties of pointwise addition of sets in normed groups We explore the relationships between pointwise addition of sets in normed groups, and the norm. Notably, we show that the sum of bounded sets remain bounded. -/ open Metric Set Pointwise Topology variable {E : Type*} section SeminormedGroup variable [SeminormedGroup E] {ε δ : ℝ} {s t : Set E} {x y : E} -- note: we can't use `LipschitzOnWith.isBounded_image2` here without adding `[IsometricSMul E E]` @[to_additive] theorem Bornology.IsBounded.mul (hs : IsBounded s) (ht : IsBounded t) : IsBounded (s * t) := by obtain ⟨Rs, hRs⟩ : ∃ R, ∀ x ∈ s, ‖x‖ ≤ R := hs.exists_norm_le' obtain ⟨Rt, hRt⟩ : ∃ R, ∀ x ∈ t, ‖x‖ ≤ R := ht.exists_norm_le' refine isBounded_iff_forall_norm_le'.2 ⟨Rs + Rt, ?_⟩ rintro z ⟨x, hx, y, hy, rfl⟩ exact norm_mul_le_of_le (hRs x hx) (hRt y hy) @[to_additive] theorem Bornology.IsBounded.of_mul (hst : IsBounded (s * t)) : IsBounded s ∨ IsBounded t := AntilipschitzWith.isBounded_of_image2_left _ (fun x => (isometry_mul_right x).antilipschitz) hst @[to_additive] theorem Bornology.IsBounded.inv : IsBounded s → IsBounded s⁻¹ := by simp_rw [isBounded_iff_forall_norm_le', ← image_inv, forall_mem_image, norm_inv'] exact id @[to_additive] theorem Bornology.IsBounded.div (hs : IsBounded s) (ht : IsBounded t) : IsBounded (s / t) := div_eq_mul_inv s t ▸ hs.mul ht.inv end SeminormedGroup section SeminormedCommGroup variable [SeminormedCommGroup E] {ε δ : ℝ} {s t : Set E} {x y : E} section EMetric open EMetric @[to_additive (attr := simp)] theorem infEdist_inv_inv (x : E) (s : Set E) : infEdist x⁻¹ s⁻¹ = infEdist x s := by rw [← image_inv, infEdist_image isometry_inv] @[to_additive] theorem infEdist_inv (x : E) (s : Set E) : infEdist x⁻¹ s = infEdist x s⁻¹ := by rw [← infEdist_inv_inv, inv_inv] @[to_additive] theorem ediam_mul_le (x y : Set E) : EMetric.diam (x * y) ≤ EMetric.diam x + EMetric.diam y := (LipschitzOnWith.ediam_image2_le (· * ·) _ _ (fun _ _ => (isometry_mul_right _).lipschitz.lipschitzOnWith _) fun _ _ => (isometry_mul_left _).lipschitz.lipschitzOnWith _).trans_eq <| by simp only [ENNReal.coe_one, one_mul] end EMetric variable (ε δ s t x y) @[to_additive (attr := simp)] theorem inv_thickening : (thickening δ s)⁻¹ = thickening δ s⁻¹ := by simp_rw [thickening, ← infEdist_inv] rfl @[to_additive (attr := simp)] theorem inv_cthickening : (cthickening δ s)⁻¹ = cthickening δ s⁻¹ := by simp_rw [cthickening, ← infEdist_inv] rfl @[to_additive (attr := simp)] theorem inv_ball : (ball x δ)⁻¹ = ball x⁻¹ δ := (IsometryEquiv.inv E).preimage_ball x δ @[to_additive (attr := simp)] theorem inv_closedBall : (closedBall x δ)⁻¹ = closedBall x⁻¹ δ := (IsometryEquiv.inv E).preimage_closedBall x δ @[to_additive] theorem singleton_mul_ball : {x} * ball y δ = ball (x * y) δ := by simp only [preimage_mul_ball, image_mul_left, singleton_mul, div_inv_eq_mul, mul_comm y x] @[to_additive] theorem singleton_div_ball : {x} / ball y δ = ball (x / y) δ := by simp_rw [div_eq_mul_inv, inv_ball, singleton_mul_ball] @[to_additive] theorem ball_mul_singleton : ball x δ * {y} = ball (x * y) δ := by rw [mul_comm, singleton_mul_ball, mul_comm y] @[to_additive] theorem ball_div_singleton : ball x δ / {y} = ball (x / y) δ := by simp_rw [div_eq_mul_inv, inv_singleton, ball_mul_singleton] @[to_additive] theorem singleton_mul_ball_one : {x} * ball 1 δ = ball x δ := by simp @[to_additive] theorem singleton_div_ball_one : {x} / ball 1 δ = ball x δ := by rw [singleton_div_ball, div_one] @[to_additive] theorem ball_one_mul_singleton : ball 1 δ * {x} = ball x δ := by simp [ball_mul_singleton] @[to_additive] theorem ball_one_div_singleton : ball 1 δ / {x} = ball x⁻¹ δ := by rw [ball_div_singleton, one_div] @[to_additive] theorem smul_ball_one : x • ball (1 : E) δ = ball x δ := by rw [smul_ball, smul_eq_mul, mul_one] @[to_additive (attr := simp 1100)] theorem singleton_mul_closedBall : {x} * closedBall y δ = closedBall (x * y) δ := by simp_rw [singleton_mul, ← smul_eq_mul, image_smul, smul_closedBall] @[to_additive (attr := simp 1100)] theorem singleton_div_closedBall : {x} / closedBall y δ = closedBall (x / y) δ := by simp_rw [div_eq_mul_inv, inv_closedBall, singleton_mul_closedBall] @[to_additive (attr := simp 1100)] theorem closedBall_mul_singleton : closedBall x δ * {y} = closedBall (x * y) δ := by simp [mul_comm _ {y}, mul_comm y] @[to_additive (attr := simp 1100)] theorem closedBall_div_singleton : closedBall x δ / {y} = closedBall (x / y) δ := by simp [div_eq_mul_inv] @[to_additive] theorem singleton_mul_closedBall_one : {x} * closedBall 1 δ = closedBall x δ := by simp @[to_additive] theorem singleton_div_closedBall_one : {x} / closedBall 1 δ = closedBall x δ := by rw [singleton_div_closedBall, div_one] @[to_additive] theorem closedBall_one_mul_singleton : closedBall 1 δ * {x} = closedBall x δ := by simp @[to_additive] theorem closedBall_one_div_singleton : closedBall 1 δ / {x} = closedBall x⁻¹ δ := by simp @[to_additive (attr := simp 1100)] theorem smul_closedBall_one : x • closedBall (1 : E) δ = closedBall x δ := by simp @[to_additive] theorem mul_ball_one : s * ball 1 δ = thickening δ s := by rw [thickening_eq_biUnion_ball] convert iUnion₂_mul (fun x (_ : x ∈ s) => {x}) (ball (1 : E) δ) · exact s.biUnion_of_singleton.symm ext x simp_rw [singleton_mul_ball, mul_one] @[to_additive] theorem div_ball_one : s / ball 1 δ = thickening δ s := by simp [div_eq_mul_inv, mul_ball_one] @[to_additive] theorem ball_mul_one : ball 1 δ * s = thickening δ s := by rw [mul_comm, mul_ball_one] @[to_additive] theorem ball_div_one : ball 1 δ / s = thickening δ s⁻¹ := by simp [div_eq_mul_inv, ball_mul_one] @[to_additive (attr := simp)] theorem mul_ball : s * ball x δ = x • thickening δ s := by rw [← smul_ball_one, mul_smul_comm, mul_ball_one] @[to_additive (attr := simp)] theorem div_ball : s / ball x δ = x⁻¹ • thickening δ s := by simp [div_eq_mul_inv] @[to_additive (attr := simp)] theorem ball_mul : ball x δ * s = x • thickening δ s := by rw [mul_comm, mul_ball] @[to_additive (attr := simp)] theorem ball_div : ball x δ / s = x • thickening δ s⁻¹ := by simp [div_eq_mul_inv] variable {ε δ s t x y} @[to_additive] theorem IsCompact.mul_closedBall_one (hs : IsCompact s) (hδ : 0 ≤ δ) : s * closedBall (1 : E) δ = cthickening δ s := by rw [hs.cthickening_eq_biUnion_closedBall hδ] ext x simp only [mem_mul, dist_eq_norm_div, exists_prop, mem_iUnion, mem_closedBall, exists_and_left, mem_closedBall_one_iff, ← eq_div_iff_mul_eq'', div_one, exists_eq_right] @[to_additive] theorem IsCompact.div_closedBall_one (hs : IsCompact s) (hδ : 0 ≤ δ) : s / closedBall 1 δ = cthickening δ s := by simp [div_eq_mul_inv, hs.mul_closedBall_one hδ] @[to_additive] theorem IsCompact.closedBall_one_mul (hs : IsCompact s) (hδ : 0 ≤ δ) : closedBall 1 δ * s = cthickening δ s := by rw [mul_comm, hs.mul_closedBall_one hδ] @[to_additive] theorem IsCompact.closedBall_one_div (hs : IsCompact s) (hδ : 0 ≤ δ) : closedBall 1 δ / s = cthickening δ s⁻¹ := by simp [div_eq_mul_inv, mul_comm, hs.inv.mul_closedBall_one hδ] @[to_additive] theorem IsCompact.mul_closedBall (hs : IsCompact s) (hδ : 0 ≤ δ) (x : E) : s * closedBall x δ = x • cthickening δ s := by rw [← smul_closedBall_one, mul_smul_comm, hs.mul_closedBall_one hδ] @[to_additive] theorem IsCompact.div_closedBall (hs : IsCompact s) (hδ : 0 ≤ δ) (x : E) : s / closedBall x δ = x⁻¹ • cthickening δ s := by simp [div_eq_mul_inv, mul_comm, hs.mul_closedBall hδ] @[to_additive] theorem IsCompact.closedBall_mul (hs : IsCompact s) (hδ : 0 ≤ δ) (x : E) : closedBall x δ * s = x • cthickening δ s := by rw [mul_comm, hs.mul_closedBall hδ] @[to_additive] theorem IsCompact.closedBall_div (hs : IsCompact s) (hδ : 0 ≤ δ) (x : E) : closedBall x δ * s = x • cthickening δ s := by simp [div_eq_mul_inv, hs.closedBall_mul hδ] end SeminormedCommGroup
Analysis\Normed\Group\Quotient.lean
/- Copyright (c) 2021 Patrick Massot. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Riccardo Brasca -/ import Mathlib.Analysis.Normed.Module.Basic import Mathlib.Analysis.Normed.Group.Hom import Mathlib.RingTheory.Ideal.QuotientOperations import Mathlib.Topology.MetricSpace.HausdorffDistance /-! # Quotients of seminormed groups For any `SeminormedAddCommGroup M` and any `S : AddSubgroup M`, we provide a `SeminormedAddCommGroup`, the group quotient `M ⧸ S`. If `S` is closed, we provide `NormedAddCommGroup (M ⧸ S)` (regardless of whether `M` itself is separated). The two main properties of these structures are the underlying topology is the quotient topology and the projection is a normed group homomorphism which is norm non-increasing (better, it has operator norm exactly one unless `S` is dense in `M`). The corresponding universal property is that every normed group hom defined on `M` which vanishes on `S` descends to a normed group hom defined on `M ⧸ S`. This file also introduces a predicate `IsQuotient` characterizing normed group homs that are isomorphic to the canonical projection onto a normed group quotient. In addition, this file also provides normed structures for quotients of modules by submodules, and of (commutative) rings by ideals. The `SeminormedAddCommGroup` and `NormedAddCommGroup` instances described above are transferred directly, but we also define instances of `NormedSpace`, `SeminormedCommRing`, `NormedCommRing` and `NormedAlgebra` under appropriate type class assumptions on the original space. Moreover, while `QuotientAddGroup.completeSpace` works out-of-the-box for quotients of `NormedAddCommGroup`s by `AddSubgroup`s, we need to transfer this instance in `Submodule.Quotient.completeSpace` so that it applies to these other quotients. ## Main definitions We use `M` and `N` to denote seminormed groups and `S : AddSubgroup M`. All the following definitions are in the `AddSubgroup` namespace. Hence we can access `AddSubgroup.normedMk S` as `S.normedMk`. * `seminormedAddCommGroupQuotient` : The seminormed group structure on the quotient by an additive subgroup. This is an instance so there is no need to explicitly use it. * `normedAddCommGroupQuotient` : The normed group structure on the quotient by a closed additive subgroup. This is an instance so there is no need to explicitly use it. * `normedMk S` : the normed group hom from `M` to `M ⧸ S`. * `lift S f hf`: implements the universal property of `M ⧸ S`. Here `(f : NormedAddGroupHom M N)`, `(hf : ∀ s ∈ S, f s = 0)` and `lift S f hf : NormedAddGroupHom (M ⧸ S) N`. * `IsQuotient`: given `f : NormedAddGroupHom M N`, `IsQuotient f` means `N` is isomorphic to a quotient of `M` by a subgroup, with projection `f`. Technically it asserts `f` is surjective and the norm of `f x` is the infimum of the norms of `x + m` for `m` in `f.ker`. ## Main results * `norm_normedMk` : the operator norm of the projection is `1` if the subspace is not dense. * `IsQuotient.norm_lift`: Provided `f : normed_hom M N` satisfies `IsQuotient f`, for every `n : N` and positive `ε`, there exists `m` such that `f m = n ∧ ‖m‖ < ‖n‖ + ε`. ## Implementation details For any `SeminormedAddCommGroup M` and any `S : AddSubgroup M` we define a norm on `M ⧸ S` by `‖x‖ = sInf (norm '' {m | mk' S m = x})`. This formula is really an implementation detail, it shouldn't be needed outside of this file setting up the theory. Since `M ⧸ S` is automatically a topological space (as any quotient of a topological space), one needs to be careful while defining the `SeminormedAddCommGroup` instance to avoid having two different topologies on this quotient. This is not purely a technological issue. Mathematically there is something to prove. The main point is proved in the auxiliary lemma `quotient_nhd_basis` that has no use beyond this verification and states that zero in the quotient admits as basis of neighborhoods in the quotient topology the sets `{x | ‖x‖ < ε}` for positive `ε`. Once this mathematical point is settled, we have two topologies that are propositionally equal. This is not good enough for the type class system. As usual we ensure *definitional* equality using forgetful inheritance, see Note [forgetful inheritance]. A (semi)-normed group structure includes a uniform space structure which includes a topological space structure, together with propositional fields asserting compatibility conditions. The usual way to define a `SeminormedAddCommGroup` is to let Lean build a uniform space structure using the provided norm, and then trivially build a proof that the norm and uniform structure are compatible. Here the uniform structure is provided using `TopologicalAddGroup.toUniformSpace` which uses the topological structure and the group structure to build the uniform structure. This uniform structure induces the correct topological structure by construction, but the fact that it is compatible with the norm is not obvious; this is where the mathematical content explained in the previous paragraph kicks in. -/ noncomputable section open QuotientAddGroup Metric Set Topology NNReal variable {M N : Type*} [SeminormedAddCommGroup M] [SeminormedAddCommGroup N] /-- The definition of the norm on the quotient by an additive subgroup. -/ noncomputable instance normOnQuotient (S : AddSubgroup M) : Norm (M ⧸ S) where norm x := sInf (norm '' { m | mk' S m = x }) theorem AddSubgroup.quotient_norm_eq {S : AddSubgroup M} (x : M ⧸ S) : ‖x‖ = sInf (norm '' { m : M | (m : M ⧸ S) = x }) := rfl theorem QuotientAddGroup.norm_eq_infDist {S : AddSubgroup M} (x : M ⧸ S) : ‖x‖ = infDist 0 { m : M | (m : M ⧸ S) = x } := by simp only [AddSubgroup.quotient_norm_eq, infDist_eq_iInf, sInf_image', dist_zero_left] /-- An alternative definition of the norm on the quotient group: the norm of `((x : M) : M ⧸ S)` is equal to the distance from `x` to `S`. -/ theorem QuotientAddGroup.norm_mk {S : AddSubgroup M} (x : M) : ‖(x : M ⧸ S)‖ = infDist x S := by rw [norm_eq_infDist, ← infDist_image (IsometryEquiv.subLeft x).isometry, IsometryEquiv.subLeft_apply, sub_zero, ← IsometryEquiv.preimage_symm] congr 1 with y simp only [mem_preimage, IsometryEquiv.subLeft_symm_apply, mem_setOf_eq, QuotientAddGroup.eq, neg_add, neg_neg, neg_add_cancel_right, SetLike.mem_coe] theorem image_norm_nonempty {S : AddSubgroup M} (x : M ⧸ S) : (norm '' { m | mk' S m = x }).Nonempty := .image _ <| Quot.exists_rep x theorem bddBelow_image_norm (s : Set M) : BddBelow (norm '' s) := ⟨0, forall_mem_image.2 fun _ _ ↦ norm_nonneg _⟩ theorem isGLB_quotient_norm {S : AddSubgroup M} (x : M ⧸ S) : IsGLB (norm '' { m | mk' S m = x }) (‖x‖) := isGLB_csInf (image_norm_nonempty x) (bddBelow_image_norm _) /-- The norm on the quotient satisfies `‖-x‖ = ‖x‖`. -/ theorem quotient_norm_neg {S : AddSubgroup M} (x : M ⧸ S) : ‖-x‖ = ‖x‖ := by simp only [AddSubgroup.quotient_norm_eq] congr 1 with r constructor <;> { rintro ⟨m, hm, rfl⟩; use -m; simpa [neg_eq_iff_eq_neg] using hm } theorem quotient_norm_sub_rev {S : AddSubgroup M} (x y : M ⧸ S) : ‖x - y‖ = ‖y - x‖ := by rw [← neg_sub, quotient_norm_neg] /-- The norm of the projection is smaller or equal to the norm of the original element. -/ theorem quotient_norm_mk_le (S : AddSubgroup M) (m : M) : ‖mk' S m‖ ≤ ‖m‖ := csInf_le (bddBelow_image_norm _) <| Set.mem_image_of_mem _ rfl /-- The norm of the projection is smaller or equal to the norm of the original element. -/ theorem quotient_norm_mk_le' (S : AddSubgroup M) (m : M) : ‖(m : M ⧸ S)‖ ≤ ‖m‖ := quotient_norm_mk_le S m /-- The norm of the image under the natural morphism to the quotient. -/ theorem quotient_norm_mk_eq (S : AddSubgroup M) (m : M) : ‖mk' S m‖ = sInf ((‖m + ·‖) '' S) := by rw [mk'_apply, norm_mk, sInf_image', ← infDist_image isometry_neg, image_neg, neg_coe_set (H := S), infDist_eq_iInf] simp only [dist_eq_norm', sub_neg_eq_add, add_comm] /-- The quotient norm is nonnegative. -/ theorem quotient_norm_nonneg (S : AddSubgroup M) (x : M ⧸ S) : 0 ≤ ‖x‖ := Real.sInf_nonneg _ <| forall_mem_image.2 fun _ _ ↦ norm_nonneg _ /-- The quotient norm is nonnegative. -/ theorem norm_mk_nonneg (S : AddSubgroup M) (m : M) : 0 ≤ ‖mk' S m‖ := quotient_norm_nonneg S _ /-- The norm of the image of `m : M` in the quotient by `S` is zero if and only if `m` belongs to the closure of `S`. -/ theorem quotient_norm_eq_zero_iff (S : AddSubgroup M) (m : M) : ‖mk' S m‖ = 0 ↔ m ∈ closure (S : Set M) := by rw [mk'_apply, norm_mk, ← mem_closure_iff_infDist_zero] exact ⟨0, S.zero_mem⟩ theorem QuotientAddGroup.norm_lt_iff {S : AddSubgroup M} {x : M ⧸ S} {r : ℝ} : ‖x‖ < r ↔ ∃ m : M, ↑m = x ∧ ‖m‖ < r := by rw [isGLB_lt_iff (isGLB_quotient_norm _), exists_mem_image] rfl /-- For any `x : M ⧸ S` and any `0 < ε`, there is `m : M` such that `mk' S m = x` and `‖m‖ < ‖x‖ + ε`. -/ theorem norm_mk_lt {S : AddSubgroup M} (x : M ⧸ S) {ε : ℝ} (hε : 0 < ε) : ∃ m : M, mk' S m = x ∧ ‖m‖ < ‖x‖ + ε := norm_lt_iff.1 <| lt_add_of_pos_right _ hε /-- For any `m : M` and any `0 < ε`, there is `s ∈ S` such that `‖m + s‖ < ‖mk' S m‖ + ε`. -/ theorem norm_mk_lt' (S : AddSubgroup M) (m : M) {ε : ℝ} (hε : 0 < ε) : ∃ s ∈ S, ‖m + s‖ < ‖mk' S m‖ + ε := by obtain ⟨n : M, hn : mk' S n = mk' S m, hn' : ‖n‖ < ‖mk' S m‖ + ε⟩ := norm_mk_lt (QuotientAddGroup.mk' S m) hε erw [eq_comm, QuotientAddGroup.eq] at hn use -m + n, hn rwa [add_neg_cancel_left] /-- The quotient norm satisfies the triangle inequality. -/ theorem quotient_norm_add_le (S : AddSubgroup M) (x y : M ⧸ S) : ‖x + y‖ ≤ ‖x‖ + ‖y‖ := by rcases And.intro (mk_surjective x) (mk_surjective y) with ⟨⟨x, rfl⟩, ⟨y, rfl⟩⟩ simp only [← mk'_apply, ← map_add, quotient_norm_mk_eq, sInf_image'] refine le_ciInf_add_ciInf fun a b ↦ ?_ refine ciInf_le_of_le ⟨0, forall_mem_range.2 fun _ ↦ norm_nonneg _⟩ (a + b) ?_ exact (congr_arg norm (add_add_add_comm _ _ _ _)).trans_le (norm_add_le _ _) /-- The quotient norm of `0` is `0`. -/ theorem norm_mk_zero (S : AddSubgroup M) : ‖(0 : M ⧸ S)‖ = 0 := by erw [quotient_norm_eq_zero_iff] exact subset_closure S.zero_mem /-- If `(m : M)` has norm equal to `0` in `M ⧸ S` for a closed subgroup `S` of `M`, then `m ∈ S`. -/ theorem norm_mk_eq_zero (S : AddSubgroup M) (hS : IsClosed (S : Set M)) (m : M) (h : ‖mk' S m‖ = 0) : m ∈ S := by rwa [quotient_norm_eq_zero_iff, hS.closure_eq] at h theorem quotient_nhd_basis (S : AddSubgroup M) : (𝓝 (0 : M ⧸ S)).HasBasis (fun ε ↦ 0 < ε) fun ε ↦ { x | ‖x‖ < ε } := by have : ∀ ε : ℝ, mk '' ball (0 : M) ε = { x : M ⧸ S | ‖x‖ < ε } := by refine fun ε ↦ Set.ext <| forall_mk.2 fun x ↦ ?_ rw [ball_zero_eq, mem_setOf_eq, norm_lt_iff, mem_image] exact exists_congr fun _ ↦ and_comm rw [← mk_zero, nhds_eq, ← funext this] exact .map _ Metric.nhds_basis_ball /-- The seminormed group structure on the quotient by an additive subgroup. -/ noncomputable instance AddSubgroup.seminormedAddCommGroupQuotient (S : AddSubgroup M) : SeminormedAddCommGroup (M ⧸ S) where dist x y := ‖x - y‖ dist_self x := by simp only [norm_mk_zero, sub_self] dist_comm := quotient_norm_sub_rev dist_triangle x y z := by refine le_trans ?_ (quotient_norm_add_le _ _ _) exact (congr_arg norm (sub_add_sub_cancel _ _ _).symm).le edist_dist x y := by exact ENNReal.coe_nnreal_eq _ toUniformSpace := TopologicalAddGroup.toUniformSpace (M ⧸ S) uniformity_dist := by rw [uniformity_eq_comap_nhds_zero', ((quotient_nhd_basis S).comap _).eq_biInf] simp only [dist, quotient_norm_sub_rev (Prod.fst _), preimage_setOf_eq] -- This is a sanity check left here on purpose to ensure that potential refactors won't destroy -- this important property. example (S : AddSubgroup M) : (instTopologicalSpaceQuotient : TopologicalSpace <| M ⧸ S) = S.seminormedAddCommGroupQuotient.toUniformSpace.toTopologicalSpace := rfl /-- The quotient in the category of normed groups. -/ noncomputable instance AddSubgroup.normedAddCommGroupQuotient (S : AddSubgroup M) [IsClosed (S : Set M)] : NormedAddCommGroup (M ⧸ S) := { AddSubgroup.seminormedAddCommGroupQuotient S, MetricSpace.ofT0PseudoMetricSpace _ with } -- This is a sanity check left here on purpose to ensure that potential refactors won't destroy -- this important property. example (S : AddSubgroup M) [IsClosed (S : Set M)] : S.seminormedAddCommGroupQuotient = NormedAddCommGroup.toSeminormedAddCommGroup := rfl namespace AddSubgroup open NormedAddGroupHom /-- The morphism from a seminormed group to the quotient by a subgroup. -/ noncomputable def normedMk (S : AddSubgroup M) : NormedAddGroupHom M (M ⧸ S) := { QuotientAddGroup.mk' S with bound' := ⟨1, fun m => by simpa [one_mul] using quotient_norm_mk_le _ m⟩ } /-- `S.normedMk` agrees with `QuotientAddGroup.mk' S`. -/ @[simp] theorem normedMk.apply (S : AddSubgroup M) (m : M) : normedMk S m = QuotientAddGroup.mk' S m := rfl /-- `S.normedMk` is surjective. -/ theorem surjective_normedMk (S : AddSubgroup M) : Function.Surjective (normedMk S) := surjective_quot_mk _ /-- The kernel of `S.normedMk` is `S`. -/ theorem ker_normedMk (S : AddSubgroup M) : S.normedMk.ker = S := QuotientAddGroup.ker_mk' _ /-- The operator norm of the projection is at most `1`. -/ theorem norm_normedMk_le (S : AddSubgroup M) : ‖S.normedMk‖ ≤ 1 := NormedAddGroupHom.opNorm_le_bound _ zero_le_one fun m => by simp [quotient_norm_mk_le'] theorem _root_.QuotientAddGroup.norm_lift_apply_le {S : AddSubgroup M} (f : NormedAddGroupHom M N) (hf : ∀ x ∈ S, f x = 0) (x : M ⧸ S) : ‖lift S f.toAddMonoidHom hf x‖ ≤ ‖f‖ * ‖x‖ := by cases (norm_nonneg f).eq_or_gt with | inl h => rcases mk_surjective x with ⟨x, rfl⟩ simpa [h] using le_opNorm f x | inr h => rw [← not_lt, ← _root_.lt_div_iff' h, norm_lt_iff] rintro ⟨x, rfl, hx⟩ exact ((lt_div_iff' h).1 hx).not_le (le_opNorm f x) /-- The operator norm of the projection is `1` if the subspace is not dense. -/ theorem norm_normedMk (S : AddSubgroup M) (h : (S.topologicalClosure : Set M) ≠ univ) : ‖S.normedMk‖ = 1 := by refine le_antisymm (norm_normedMk_le S) ?_ obtain ⟨x, hx⟩ : ∃ x : M, 0 < ‖(x : M ⧸ S)‖ := by refine (Set.nonempty_compl.2 h).imp fun x hx ↦ ?_ exact (norm_nonneg _).lt_of_ne' <| mt (quotient_norm_eq_zero_iff S x).1 hx refine (le_mul_iff_one_le_left hx).1 ?_ exact norm_lift_apply_le S.normedMk (fun x ↦ (eq_zero_iff x).2) x /-- The operator norm of the projection is `0` if the subspace is dense. -/ theorem norm_trivial_quotient_mk (S : AddSubgroup M) (h : (S.topologicalClosure : Set M) = Set.univ) : ‖S.normedMk‖ = 0 := by refine le_antisymm (opNorm_le_bound _ le_rfl fun x => ?_) (norm_nonneg _) have hker : x ∈ S.normedMk.ker.topologicalClosure := by rw [S.ker_normedMk, ← SetLike.mem_coe, h] trivial rw [ker_normedMk] at hker simp only [(quotient_norm_eq_zero_iff S x).mpr hker, normedMk.apply, zero_mul, le_rfl] end AddSubgroup namespace NormedAddGroupHom /-- `IsQuotient f`, for `f : M ⟶ N` means that `N` is isomorphic to the quotient of `M` by the kernel of `f`. -/ structure IsQuotient (f : NormedAddGroupHom M N) : Prop where protected surjective : Function.Surjective f protected norm : ∀ x, ‖f x‖ = sInf ((fun m => ‖x + m‖) '' f.ker) /-- Given `f : NormedAddGroupHom M N` such that `f s = 0` for all `s ∈ S`, where, `S : AddSubgroup M` is closed, the induced morphism `NormedAddGroupHom (M ⧸ S) N`. -/ noncomputable def lift {N : Type*} [SeminormedAddCommGroup N] (S : AddSubgroup M) (f : NormedAddGroupHom M N) (hf : ∀ s ∈ S, f s = 0) : NormedAddGroupHom (M ⧸ S) N := { QuotientAddGroup.lift S f.toAddMonoidHom hf with bound' := ⟨‖f‖, norm_lift_apply_le f hf⟩ } theorem lift_mk {N : Type*} [SeminormedAddCommGroup N] (S : AddSubgroup M) (f : NormedAddGroupHom M N) (hf : ∀ s ∈ S, f s = 0) (m : M) : lift S f hf (S.normedMk m) = f m := rfl theorem lift_unique {N : Type*} [SeminormedAddCommGroup N] (S : AddSubgroup M) (f : NormedAddGroupHom M N) (hf : ∀ s ∈ S, f s = 0) (g : NormedAddGroupHom (M ⧸ S) N) (h : g.comp S.normedMk = f) : g = lift S f hf := by ext x rcases AddSubgroup.surjective_normedMk _ x with ⟨x, rfl⟩ change g.comp S.normedMk x = _ simp only [h] rfl /-- `S.normedMk` satisfies `IsQuotient`. -/ theorem isQuotientQuotient (S : AddSubgroup M) : IsQuotient S.normedMk := ⟨S.surjective_normedMk, fun m => by simpa [S.ker_normedMk] using quotient_norm_mk_eq _ m⟩ theorem IsQuotient.norm_lift {f : NormedAddGroupHom M N} (hquot : IsQuotient f) {ε : ℝ} (hε : 0 < ε) (n : N) : ∃ m : M, f m = n ∧ ‖m‖ < ‖n‖ + ε := by obtain ⟨m, rfl⟩ := hquot.surjective n have nonemp : ((fun m' => ‖m + m'‖) '' f.ker).Nonempty := by rw [Set.image_nonempty] exact ⟨0, f.ker.zero_mem⟩ rcases Real.lt_sInf_add_pos nonemp hε with ⟨_, ⟨⟨x, hx, rfl⟩, H : ‖m + x‖ < sInf ((fun m' : M => ‖m + m'‖) '' f.ker) + ε⟩⟩ exact ⟨m + x, by rw [map_add, (NormedAddGroupHom.mem_ker f x).mp hx, add_zero], by rwa [hquot.norm]⟩ theorem IsQuotient.norm_le {f : NormedAddGroupHom M N} (hquot : IsQuotient f) (m : M) : ‖f m‖ ≤ ‖m‖ := by rw [hquot.norm] apply csInf_le · use 0 rintro _ ⟨m', -, rfl⟩ apply norm_nonneg · exact ⟨0, f.ker.zero_mem, by simp⟩ theorem norm_lift_le {N : Type*} [SeminormedAddCommGroup N] (S : AddSubgroup M) (f : NormedAddGroupHom M N) (hf : ∀ s ∈ S, f s = 0) : ‖lift S f hf‖ ≤ ‖f‖ := opNorm_le_bound _ (norm_nonneg f) (norm_lift_apply_le f hf) -- Porting note (#11215): TODO: deprecate? theorem lift_norm_le {N : Type*} [SeminormedAddCommGroup N] (S : AddSubgroup M) (f : NormedAddGroupHom M N) (hf : ∀ s ∈ S, f s = 0) {c : ℝ≥0} (fb : ‖f‖ ≤ c) : ‖lift S f hf‖ ≤ c := (norm_lift_le S f hf).trans fb theorem lift_normNoninc {N : Type*} [SeminormedAddCommGroup N] (S : AddSubgroup M) (f : NormedAddGroupHom M N) (hf : ∀ s ∈ S, f s = 0) (fb : f.NormNoninc) : (lift S f hf).NormNoninc := fun x => by have fb' : ‖f‖ ≤ (1 : ℝ≥0) := NormNoninc.normNoninc_iff_norm_le_one.mp fb simpa using le_of_opNorm_le _ (f.lift_norm_le _ _ fb') _ end NormedAddGroupHom /-! ### Submodules and ideals In what follows, the norm structures created above for quotients of (semi)`NormedAddCommGroup`s by `AddSubgroup`s are transferred via definitional equality to quotients of modules by submodules, and of rings by ideals, thereby preserving the definitional equality for the topological group and uniform structures worked for above. Completeness is also transferred via this definitional equality. In addition, instances are constructed for `NormedSpace`, `SeminormedCommRing`, `NormedCommRing` and `NormedAlgebra` under the appropriate hypotheses. Currently, we do not have quotients of rings by two-sided ideals, hence the commutativity hypotheses are required. -/ section Submodule variable {R : Type*} [Ring R] [Module R M] (S : Submodule R M) instance Submodule.Quotient.seminormedAddCommGroup : SeminormedAddCommGroup (M ⧸ S) := AddSubgroup.seminormedAddCommGroupQuotient S.toAddSubgroup instance Submodule.Quotient.normedAddCommGroup [hS : IsClosed (S : Set M)] : NormedAddCommGroup (M ⧸ S) := @AddSubgroup.normedAddCommGroupQuotient _ _ S.toAddSubgroup hS instance Submodule.Quotient.completeSpace [CompleteSpace M] : CompleteSpace (M ⧸ S) := QuotientAddGroup.completeSpace M S.toAddSubgroup /-- For any `x : M ⧸ S` and any `0 < ε`, there is `m : M` such that `Submodule.Quotient.mk m = x` and `‖m‖ < ‖x‖ + ε`. -/ nonrec theorem Submodule.Quotient.norm_mk_lt {S : Submodule R M} (x : M ⧸ S) {ε : ℝ} (hε : 0 < ε) : ∃ m : M, Submodule.Quotient.mk m = x ∧ ‖m‖ < ‖x‖ + ε := norm_mk_lt x hε theorem Submodule.Quotient.norm_mk_le (m : M) : ‖(Submodule.Quotient.mk m : M ⧸ S)‖ ≤ ‖m‖ := quotient_norm_mk_le S.toAddSubgroup m instance Submodule.Quotient.instBoundedSMul (𝕜 : Type*) [SeminormedCommRing 𝕜] [Module 𝕜 M] [BoundedSMul 𝕜 M] [SMul 𝕜 R] [IsScalarTower 𝕜 R M] : BoundedSMul 𝕜 (M ⧸ S) := .of_norm_smul_le fun k x => -- Porting note: this is `QuotientAddGroup.norm_lift_apply_le` for `f : M → M ⧸ S` given by -- `x ↦ mk (k • x)`; todo: add scalar multiplication as `NormedAddGroupHom`, use it here _root_.le_of_forall_pos_le_add fun ε hε => by have := (nhds_basis_ball.tendsto_iff nhds_basis_ball).mp ((@Real.uniformContinuous_const_mul ‖k‖).continuous.tendsto ‖x‖) ε hε simp only [mem_ball, exists_prop, dist, abs_sub_lt_iff] at this rcases this with ⟨δ, hδ, h⟩ obtain ⟨a, rfl, ha⟩ := Submodule.Quotient.norm_mk_lt x hδ specialize h ‖a‖ ⟨by linarith, by linarith [Submodule.Quotient.norm_mk_le S a]⟩ calc _ ≤ ‖k‖ * ‖a‖ := (quotient_norm_mk_le S.toAddSubgroup (k • a)).trans (norm_smul_le k a) _ ≤ _ := (sub_lt_iff_lt_add'.mp h.1).le instance Submodule.Quotient.normedSpace (𝕜 : Type*) [NormedField 𝕜] [NormedSpace 𝕜 M] [SMul 𝕜 R] [IsScalarTower 𝕜 R M] : NormedSpace 𝕜 (M ⧸ S) where norm_smul_le := norm_smul_le end Submodule section Ideal variable {R : Type*} [SeminormedCommRing R] (I : Ideal R) nonrec theorem Ideal.Quotient.norm_mk_lt {I : Ideal R} (x : R ⧸ I) {ε : ℝ} (hε : 0 < ε) : ∃ r : R, Ideal.Quotient.mk I r = x ∧ ‖r‖ < ‖x‖ + ε := norm_mk_lt x hε theorem Ideal.Quotient.norm_mk_le (r : R) : ‖Ideal.Quotient.mk I r‖ ≤ ‖r‖ := quotient_norm_mk_le I.toAddSubgroup r instance Ideal.Quotient.semiNormedCommRing : SeminormedCommRing (R ⧸ I) where dist_eq := dist_eq_norm mul_comm := _root_.mul_comm norm_mul x y := le_of_forall_pos_le_add fun ε hε => by have := ((nhds_basis_ball.prod_nhds nhds_basis_ball).tendsto_iff nhds_basis_ball).mp (continuous_mul.tendsto (‖x‖, ‖y‖)) ε hε simp only [Set.mem_prod, mem_ball, and_imp, Prod.forall, exists_prop, Prod.exists] at this rcases this with ⟨ε₁, ε₂, ⟨h₁, h₂⟩, h⟩ obtain ⟨⟨a, rfl, ha⟩, ⟨b, rfl, hb⟩⟩ := Ideal.Quotient.norm_mk_lt x h₁, Ideal.Quotient.norm_mk_lt y h₂ simp only [dist, abs_sub_lt_iff] at h specialize h ‖a‖ ‖b‖ ⟨by linarith, by linarith [Ideal.Quotient.norm_mk_le I a]⟩ ⟨by linarith, by linarith [Ideal.Quotient.norm_mk_le I b]⟩ calc _ ≤ ‖a‖ * ‖b‖ := (Ideal.Quotient.norm_mk_le I (a * b)).trans (norm_mul_le a b) _ ≤ _ := (sub_lt_iff_lt_add'.mp h.1).le instance Ideal.Quotient.normedCommRing [IsClosed (I : Set R)] : NormedCommRing (R ⧸ I) := { Ideal.Quotient.semiNormedCommRing I, Submodule.Quotient.normedAddCommGroup I with } variable (𝕜 : Type*) [NormedField 𝕜] instance Ideal.Quotient.normedAlgebra [NormedAlgebra 𝕜 R] : NormedAlgebra 𝕜 (R ⧸ I) := { Submodule.Quotient.normedSpace I 𝕜, Ideal.Quotient.algebra 𝕜 with } end Ideal
Analysis\Normed\Group\Rat.lean
/- Copyright (c) 2018 Patrick Massot. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Johannes Hölzl, Yaël Dillies -/ import Mathlib.Analysis.Normed.Group.Int import Mathlib.Topology.Instances.Rat /-! # ℚ as a normed group -/ namespace Rat instance instNormedAddCommGroup : NormedAddCommGroup ℚ where norm r := ‖(r : ℝ)‖ dist_eq r₁ r₂ := by simp only [Rat.dist_eq, norm, Rat.cast_sub] @[norm_cast, simp 1001] -- Porting note: increase priority to prevent the left-hand side from simplifying theorem norm_cast_real (r : ℚ) : ‖(r : ℝ)‖ = ‖r‖ := rfl @[norm_cast, simp] theorem _root_.Int.norm_cast_rat (m : ℤ) : ‖(m : ℚ)‖ = ‖m‖ := by rw [← Rat.norm_cast_real, ← Int.norm_cast_real]; congr 1 end Rat
Analysis\Normed\Group\Seminorm.lean
/- Copyright (c) 2022 María Inés de Frutos-Fernández, Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: María Inés de Frutos-Fernández, Yaël Dillies -/ import Mathlib.Data.NNReal.Basic import Mathlib.Tactic.GCongr.Core /-! # Group seminorms This file defines norms and seminorms in a group. A group seminorm is a function to the reals which is positive-semidefinite and subadditive. A norm further only maps zero to zero. ## Main declarations * `AddGroupSeminorm`: A function `f` from an additive group `G` to the reals that preserves zero, takes nonnegative values, is subadditive and such that `f (-x) = f x` for all `x`. * `NonarchAddGroupSeminorm`: A function `f` from an additive group `G` to the reals that preserves zero, takes nonnegative values, is nonarchimedean and such that `f (-x) = f x` for all `x`. * `GroupSeminorm`: A function `f` from a group `G` to the reals that sends one to zero, takes nonnegative values, is submultiplicative and such that `f x⁻¹ = f x` for all `x`. * `AddGroupNorm`: A seminorm `f` such that `f x = 0 → x = 0` for all `x`. * `NonarchAddGroupNorm`: A nonarchimedean seminorm `f` such that `f x = 0 → x = 0` for all `x`. * `GroupNorm`: A seminorm `f` such that `f x = 0 → x = 1` for all `x`. ## Notes The corresponding hom classes are defined in `Analysis.Order.Hom.Basic` to be used by absolute values. We do not define `NonarchAddGroupSeminorm` as an extension of `AddGroupSeminorm` to avoid having a superfluous `add_le'` field in the resulting structure. The same applies to `NonarchAddGroupNorm`. ## References * [H. H. Schaefer, *Topological Vector Spaces*][schaefer1966] ## Tags norm, seminorm -/ open Set open NNReal variable {ι R R' E F G : Type*} /-- A seminorm on an additive group `G` is a function `f : G → ℝ` that preserves zero, is subadditive and such that `f (-x) = f x` for all `x`. -/ structure AddGroupSeminorm (G : Type*) [AddGroup G] where -- Porting note: can't extend `ZeroHom G ℝ` because otherwise `to_additive` won't work since -- we aren't using old structures /-- The bare function of an `AddGroupSeminorm`. -/ protected toFun : G → ℝ /-- The image of zero is zero. -/ protected map_zero' : toFun 0 = 0 /-- The seminorm is subadditive. -/ protected add_le' : ∀ r s, toFun (r + s) ≤ toFun r + toFun s /-- The seminorm is invariant under negation. -/ protected neg' : ∀ r, toFun (-r) = toFun r /-- A seminorm on a group `G` is a function `f : G → ℝ` that sends one to zero, is submultiplicative and such that `f x⁻¹ = f x` for all `x`. -/ @[to_additive] structure GroupSeminorm (G : Type*) [Group G] where /-- The bare function of a `GroupSeminorm`. -/ protected toFun : G → ℝ /-- The image of one is zero. -/ protected map_one' : toFun 1 = 0 /-- The seminorm applied to a product is dominated by the sum of the seminorm applied to the factors. -/ protected mul_le' : ∀ x y, toFun (x * y) ≤ toFun x + toFun y /-- The seminorm is invariant under inversion. -/ protected inv' : ∀ x, toFun x⁻¹ = toFun x /-- A nonarchimedean seminorm on an additive group `G` is a function `f : G → ℝ` that preserves zero, is nonarchimedean and such that `f (-x) = f x` for all `x`. -/ structure NonarchAddGroupSeminorm (G : Type*) [AddGroup G] extends ZeroHom G ℝ where /-- The seminorm applied to a sum is dominated by the maximum of the function applied to the addends. -/ protected add_le_max' : ∀ r s, toFun (r + s) ≤ max (toFun r) (toFun s) /-- The seminorm is invariant under negation. -/ protected neg' : ∀ r, toFun (-r) = toFun r /-! NOTE: We do not define `NonarchAddGroupSeminorm` as an extension of `AddGroupSeminorm` to avoid having a superfluous `add_le'` field in the resulting structure. The same applies to `NonarchAddGroupNorm` below. -/ /-- A norm on an additive group `G` is a function `f : G → ℝ` that preserves zero, is subadditive and such that `f (-x) = f x` and `f x = 0 → x = 0` for all `x`. -/ structure AddGroupNorm (G : Type*) [AddGroup G] extends AddGroupSeminorm G where /-- If the image under the seminorm is zero, then the argument is zero. -/ protected eq_zero_of_map_eq_zero' : ∀ x, toFun x = 0 → x = 0 /-- A seminorm on a group `G` is a function `f : G → ℝ` that sends one to zero, is submultiplicative and such that `f x⁻¹ = f x` and `f x = 0 → x = 1` for all `x`. -/ @[to_additive] structure GroupNorm (G : Type*) [Group G] extends GroupSeminorm G where /-- If the image under the norm is zero, then the argument is one. -/ protected eq_one_of_map_eq_zero' : ∀ x, toFun x = 0 → x = 1 /-- A nonarchimedean norm on an additive group `G` is a function `f : G → ℝ` that preserves zero, is nonarchimedean and such that `f (-x) = f x` and `f x = 0 → x = 0` for all `x`. -/ structure NonarchAddGroupNorm (G : Type*) [AddGroup G] extends NonarchAddGroupSeminorm G where /-- If the image under the norm is zero, then the argument is zero. -/ protected eq_zero_of_map_eq_zero' : ∀ x, toFun x = 0 → x = 0 /-- `NonarchAddGroupSeminormClass F α` states that `F` is a type of nonarchimedean seminorms on the additive group `α`. You should extend this class when you extend `NonarchAddGroupSeminorm`. -/ class NonarchAddGroupSeminormClass (F : Type*) (α : outParam Type*) [AddGroup α] [FunLike F α ℝ] extends NonarchimedeanHomClass F α ℝ : Prop where /-- The image of zero is zero. -/ protected map_zero (f : F) : f 0 = 0 /-- The seminorm is invariant under negation. -/ protected map_neg_eq_map' (f : F) (a : α) : f (-a) = f a /-- `NonarchAddGroupNormClass F α` states that `F` is a type of nonarchimedean norms on the additive group `α`. You should extend this class when you extend `NonarchAddGroupNorm`. -/ class NonarchAddGroupNormClass (F : Type*) (α : outParam Type*) [AddGroup α] [FunLike F α ℝ] extends NonarchAddGroupSeminormClass F α : Prop where /-- If the image under the norm is zero, then the argument is zero. -/ protected eq_zero_of_map_eq_zero (f : F) {a : α} : f a = 0 → a = 0 section NonarchAddGroupSeminormClass variable [AddGroup E] [FunLike F E ℝ] [NonarchAddGroupSeminormClass F E] (f : F) (x y : E) theorem map_sub_le_max : f (x - y) ≤ max (f x) (f y) := by rw [sub_eq_add_neg, ← NonarchAddGroupSeminormClass.map_neg_eq_map' f y] exact map_add_le_max _ _ _ end NonarchAddGroupSeminormClass -- See note [lower instance priority] instance (priority := 100) NonarchAddGroupSeminormClass.toAddGroupSeminormClass [FunLike F E ℝ] [AddGroup E] [NonarchAddGroupSeminormClass F E] : AddGroupSeminormClass F E ℝ := { ‹NonarchAddGroupSeminormClass F E› with map_add_le_add := fun f x y => haveI h_nonneg : ∀ a, 0 ≤ f a := by intro a rw [← NonarchAddGroupSeminormClass.map_zero f, ← sub_self a] exact le_trans (map_sub_le_max _ _ _) (by rw [max_self (f a)]) le_trans (map_add_le_max _ _ _) (max_le (le_add_of_nonneg_right (h_nonneg _)) (le_add_of_nonneg_left (h_nonneg _))) map_neg_eq_map := NonarchAddGroupSeminormClass.map_neg_eq_map' } -- See note [lower instance priority] instance (priority := 100) NonarchAddGroupNormClass.toAddGroupNormClass [FunLike F E ℝ] [AddGroup E] [NonarchAddGroupNormClass F E] : AddGroupNormClass F E ℝ := { ‹NonarchAddGroupNormClass F E› with map_add_le_add := map_add_le_add map_neg_eq_map := NonarchAddGroupSeminormClass.map_neg_eq_map' } /-! ### Seminorms -/ namespace GroupSeminorm section Group variable [Group E] [Group F] [Group G] {p q : GroupSeminorm E} @[to_additive] instance funLike : FunLike (GroupSeminorm E) E ℝ where coe f := f.toFun coe_injective' f g h := by cases f; cases g; congr @[to_additive] instance groupSeminormClass : GroupSeminormClass (GroupSeminorm E) E ℝ where map_one_eq_zero f := f.map_one' map_mul_le_add f := f.mul_le' map_inv_eq_map f := f.inv' /-- Helper instance for when there's too many metavariables to apply `DFunLike.hasCoeToFun`. -/ @[to_additive "Helper instance for when there's too many metavariables to apply `DFunLike.hasCoeToFun`. "] instance : CoeFun (GroupSeminorm E) fun _ => E → ℝ := ⟨DFunLike.coe⟩ @[to_additive (attr := simp)] theorem toFun_eq_coe : p.toFun = p := rfl @[to_additive (attr := ext)] theorem ext : (∀ x, p x = q x) → p = q := DFunLike.ext p q @[to_additive] instance : PartialOrder (GroupSeminorm E) := PartialOrder.lift _ DFunLike.coe_injective @[to_additive] theorem le_def : p ≤ q ↔ (p : E → ℝ) ≤ q := Iff.rfl @[to_additive] theorem lt_def : p < q ↔ (p : E → ℝ) < q := Iff.rfl @[to_additive (attr := simp, norm_cast)] theorem coe_le_coe : (p : E → ℝ) ≤ q ↔ p ≤ q := Iff.rfl @[to_additive (attr := simp, norm_cast)] theorem coe_lt_coe : (p : E → ℝ) < q ↔ p < q := Iff.rfl variable (p q) (f : F →* E) @[to_additive] instance instZeroGroupSeminorm : Zero (GroupSeminorm E) := ⟨{ toFun := 0 map_one' := Pi.zero_apply _ mul_le' := fun _ _ => (zero_add _).ge inv' := fun _ => rfl }⟩ @[to_additive (attr := simp, norm_cast)] theorem coe_zero : ⇑(0 : GroupSeminorm E) = 0 := rfl @[to_additive (attr := simp)] theorem zero_apply (x : E) : (0 : GroupSeminorm E) x = 0 := rfl @[to_additive] instance : Inhabited (GroupSeminorm E) := ⟨0⟩ @[to_additive] instance : Add (GroupSeminorm E) := ⟨fun p q => { toFun := fun x => p x + q x map_one' := by simp_rw [map_one_eq_zero p, map_one_eq_zero q, zero_add] mul_le' := fun _ _ => (add_le_add (map_mul_le_add p _ _) <| map_mul_le_add q _ _).trans_eq <| add_add_add_comm _ _ _ _ inv' := fun x => by simp_rw [map_inv_eq_map p, map_inv_eq_map q] }⟩ @[to_additive (attr := simp)] theorem coe_add : ⇑(p + q) = p + q := rfl @[to_additive (attr := simp)] theorem add_apply (x : E) : (p + q) x = p x + q x := rfl -- TODO: define `SupSet` too, from the skeleton at -- https://github.com/leanprover-community/mathlib/pull/11329#issuecomment-1008915345 @[to_additive] instance : Sup (GroupSeminorm E) := ⟨fun p q => { toFun := p ⊔ q map_one' := by rw [Pi.sup_apply, ← map_one_eq_zero p, sup_eq_left, map_one_eq_zero p, map_one_eq_zero q] mul_le' := fun x y => sup_le ((map_mul_le_add p x y).trans <| add_le_add le_sup_left le_sup_left) ((map_mul_le_add q x y).trans <| add_le_add le_sup_right le_sup_right) inv' := fun x => by rw [Pi.sup_apply, Pi.sup_apply, map_inv_eq_map p, map_inv_eq_map q] }⟩ @[to_additive (attr := simp, norm_cast)] theorem coe_sup : ⇑(p ⊔ q) = ⇑p ⊔ ⇑q := rfl @[to_additive (attr := simp)] theorem sup_apply (x : E) : (p ⊔ q) x = p x ⊔ q x := rfl @[to_additive] instance semilatticeSup : SemilatticeSup (GroupSeminorm E) := DFunLike.coe_injective.semilatticeSup _ coe_sup /-- Composition of a group seminorm with a monoid homomorphism as a group seminorm. -/ @[to_additive "Composition of an additive group seminorm with an additive monoid homomorphism as an additive group seminorm."] def comp (p : GroupSeminorm E) (f : F →* E) : GroupSeminorm F where toFun x := p (f x) map_one' := by simp_rw [f.map_one, map_one_eq_zero p] mul_le' _ _ := (congr_arg p <| f.map_mul _ _).trans_le <| map_mul_le_add p _ _ inv' x := by simp_rw [map_inv, map_inv_eq_map p] @[to_additive (attr := simp)] theorem coe_comp : ⇑(p.comp f) = p ∘ f := rfl @[to_additive (attr := simp)] theorem comp_apply (x : F) : (p.comp f) x = p (f x) := rfl @[to_additive (attr := simp)] theorem comp_id : p.comp (MonoidHom.id _) = p := ext fun _ => rfl @[to_additive (attr := simp)] theorem comp_zero : p.comp (1 : F →* E) = 0 := ext fun _ => map_one_eq_zero p @[to_additive (attr := simp)] theorem zero_comp : (0 : GroupSeminorm E).comp f = 0 := ext fun _ => rfl @[to_additive] theorem comp_assoc (g : F →* E) (f : G →* F) : p.comp (g.comp f) = (p.comp g).comp f := ext fun _ => rfl @[to_additive] theorem add_comp (f : F →* E) : (p + q).comp f = p.comp f + q.comp f := ext fun _ => rfl variable {p q} @[to_additive] theorem comp_mono (hp : p ≤ q) : p.comp f ≤ q.comp f := fun _ => hp _ end Group section CommGroup variable [CommGroup E] [CommGroup F] (p q : GroupSeminorm E) (x y : E) @[to_additive] theorem comp_mul_le (f g : F →* E) : p.comp (f * g) ≤ p.comp f + p.comp g := fun _ => map_mul_le_add p _ _ @[to_additive] theorem mul_bddBelow_range_add {p q : GroupSeminorm E} {x : E} : BddBelow (range fun y => p y + q (x / y)) := ⟨0, by rintro _ ⟨x, rfl⟩ dsimp positivity⟩ @[to_additive] noncomputable instance : Inf (GroupSeminorm E) := ⟨fun p q => { toFun := fun x => ⨅ y, p y + q (x / y) map_one' := ciInf_eq_of_forall_ge_of_forall_gt_exists_lt -- Porting note: replace `add_nonneg` with `positivity` once we have the extension (fun x => add_nonneg (apply_nonneg _ _) (apply_nonneg _ _)) fun r hr => ⟨1, by rwa [div_one, map_one_eq_zero p, map_one_eq_zero q, add_zero]⟩ mul_le' := fun x y => le_ciInf_add_ciInf fun u v => by refine ciInf_le_of_le mul_bddBelow_range_add (u * v) ?_ rw [mul_div_mul_comm, add_add_add_comm] exact add_le_add (map_mul_le_add p _ _) (map_mul_le_add q _ _) inv' := fun x => (inv_surjective.iInf_comp _).symm.trans <| by simp_rw [map_inv_eq_map p, ← inv_div', map_inv_eq_map q] }⟩ @[to_additive (attr := simp)] theorem inf_apply : (p ⊓ q) x = ⨅ y, p y + q (x / y) := rfl @[to_additive] noncomputable instance : Lattice (GroupSeminorm E) := { GroupSeminorm.semilatticeSup with inf := (· ⊓ ·) inf_le_left := fun p q x => ciInf_le_of_le mul_bddBelow_range_add x <| by rw [div_self', map_one_eq_zero q, add_zero] inf_le_right := fun p q x => ciInf_le_of_le mul_bddBelow_range_add (1 : E) <| by simpa only [div_one x, map_one_eq_zero p, zero_add (q x)] using le_rfl le_inf := fun a b c hb hc x => le_ciInf fun u => (le_map_add_map_div a _ _).trans <| add_le_add (hb _) (hc _) } end CommGroup end GroupSeminorm /- TODO: All the following ought to be automated using `to_additive`. The problem is that it doesn't see that `SMul R ℝ` should be fixed because `ℝ` is fixed. -/ namespace AddGroupSeminorm variable [AddGroup E] [SMul R ℝ] [SMul R ℝ≥0] [IsScalarTower R ℝ≥0 ℝ] (p : AddGroupSeminorm E) instance toOne [DecidableEq E] : One (AddGroupSeminorm E) := ⟨{ toFun := fun x => if x = 0 then 0 else 1 map_zero' := if_pos rfl add_le' := fun x y => by by_cases hx : x = 0 · simp only rw [if_pos hx, hx, zero_add, zero_add] · simp only rw [if_neg hx] refine le_add_of_le_of_nonneg ?_ ?_ <;> split_ifs <;> norm_num neg' := fun x => by simp_rw [neg_eq_zero] }⟩ @[simp] theorem apply_one [DecidableEq E] (x : E) : (1 : AddGroupSeminorm E) x = if x = 0 then 0 else 1 := rfl /-- Any action on `ℝ` which factors through `ℝ≥0` applies to an `AddGroupSeminorm`. -/ instance toSMul : SMul R (AddGroupSeminorm E) := ⟨fun r p => { toFun := fun x => r • p x map_zero' := by simp only [← smul_one_smul ℝ≥0 r (_ : ℝ), NNReal.smul_def, smul_eq_mul, map_zero, mul_zero] add_le' := fun _ _ => by simp only [← smul_one_smul ℝ≥0 r (_ : ℝ), NNReal.smul_def, smul_eq_mul, ← mul_add] gcongr apply map_add_le_add neg' := fun x => by simp_rw [map_neg_eq_map] }⟩ @[simp, norm_cast] theorem coe_smul (r : R) (p : AddGroupSeminorm E) : ⇑(r • p) = r • ⇑p := rfl @[simp] theorem smul_apply (r : R) (p : AddGroupSeminorm E) (x : E) : (r • p) x = r • p x := rfl instance isScalarTower [SMul R' ℝ] [SMul R' ℝ≥0] [IsScalarTower R' ℝ≥0 ℝ] [SMul R R'] [IsScalarTower R R' ℝ] : IsScalarTower R R' (AddGroupSeminorm E) := ⟨fun r a p => ext fun x => smul_assoc r a (p x)⟩ theorem smul_sup (r : R) (p q : AddGroupSeminorm E) : r • (p ⊔ q) = r • p ⊔ r • q := have Real.smul_max : ∀ x y : ℝ, r • max x y = max (r • x) (r • y) := fun x y => by simpa only [← smul_eq_mul, ← NNReal.smul_def, smul_one_smul ℝ≥0 r (_ : ℝ)] using mul_max_of_nonneg x y (r • (1 : ℝ≥0) : ℝ≥0).coe_nonneg ext fun x => Real.smul_max _ _ end AddGroupSeminorm namespace NonarchAddGroupSeminorm section AddGroup variable [AddGroup E] [AddGroup F] [AddGroup G] {p q : NonarchAddGroupSeminorm E} instance funLike : FunLike (NonarchAddGroupSeminorm E) E ℝ where coe f := f.toFun coe_injective' f g h := by obtain ⟨⟨_, _⟩, _, _⟩ := f; cases g; congr instance nonarchAddGroupSeminormClass : NonarchAddGroupSeminormClass (NonarchAddGroupSeminorm E) E where map_add_le_max f := f.add_le_max' map_zero f := f.map_zero' map_neg_eq_map' f := f.neg' /-- Helper instance for when there's too many metavariables to apply `DFunLike.hasCoeToFun`. -/ instance : CoeFun (NonarchAddGroupSeminorm E) fun _ => E → ℝ := ⟨DFunLike.coe⟩ -- Porting note: `simpNF` said the left hand side simplified to this @[simp] theorem toZeroHom_eq_coe : ⇑p.toZeroHom = p := by rfl @[ext] theorem ext : (∀ x, p x = q x) → p = q := DFunLike.ext p q noncomputable instance : PartialOrder (NonarchAddGroupSeminorm E) := PartialOrder.lift _ DFunLike.coe_injective theorem le_def : p ≤ q ↔ (p : E → ℝ) ≤ q := Iff.rfl theorem lt_def : p < q ↔ (p : E → ℝ) < q := Iff.rfl @[simp, norm_cast] theorem coe_le_coe : (p : E → ℝ) ≤ q ↔ p ≤ q := Iff.rfl @[simp, norm_cast] theorem coe_lt_coe : (p : E → ℝ) < q ↔ p < q := Iff.rfl variable (p q) (f : F →+ E) instance : Zero (NonarchAddGroupSeminorm E) := ⟨{ toFun := 0 map_zero' := Pi.zero_apply _ add_le_max' := fun r s => by simp only [Pi.zero_apply]; rw [max_eq_right]; rfl neg' := fun x => rfl }⟩ @[simp, norm_cast] theorem coe_zero : ⇑(0 : NonarchAddGroupSeminorm E) = 0 := rfl @[simp] theorem zero_apply (x : E) : (0 : NonarchAddGroupSeminorm E) x = 0 := rfl instance : Inhabited (NonarchAddGroupSeminorm E) := ⟨0⟩ -- TODO: define `SupSet` too, from the skeleton at -- https://github.com/leanprover-community/mathlib/pull/11329#issuecomment-1008915345 instance : Sup (NonarchAddGroupSeminorm E) := ⟨fun p q => { toFun := p ⊔ q map_zero' := by rw [Pi.sup_apply, ← map_zero p, sup_eq_left, map_zero p, map_zero q] add_le_max' := fun x y => sup_le ((map_add_le_max p x y).trans <| max_le_max le_sup_left le_sup_left) ((map_add_le_max q x y).trans <| max_le_max le_sup_right le_sup_right) neg' := fun x => by simp_rw [Pi.sup_apply, map_neg_eq_map p, map_neg_eq_map q]}⟩ @[simp, norm_cast] theorem coe_sup : ⇑(p ⊔ q) = ⇑p ⊔ ⇑q := rfl @[simp] theorem sup_apply (x : E) : (p ⊔ q) x = p x ⊔ q x := rfl noncomputable instance : SemilatticeSup (NonarchAddGroupSeminorm E) := DFunLike.coe_injective.semilatticeSup _ coe_sup end AddGroup section AddCommGroup variable [AddCommGroup E] [AddCommGroup F] (p q : NonarchAddGroupSeminorm E) (x y : E) theorem add_bddBelow_range_add {p q : NonarchAddGroupSeminorm E} {x : E} : BddBelow (range fun y => p y + q (x - y)) := ⟨0, by rintro _ ⟨x, rfl⟩ dsimp positivity⟩ end AddCommGroup end NonarchAddGroupSeminorm namespace GroupSeminorm variable [Group E] [SMul R ℝ] [SMul R ℝ≥0] [IsScalarTower R ℝ≥0 ℝ] @[to_additive existing AddGroupSeminorm.toOne] instance toOne [DecidableEq E] : One (GroupSeminorm E) := ⟨{ toFun := fun x => if x = 1 then 0 else 1 map_one' := if_pos rfl mul_le' := fun x y => by by_cases hx : x = 1 · simp only rw [if_pos hx, hx, one_mul, zero_add] · simp only rw [if_neg hx] refine le_add_of_le_of_nonneg ?_ ?_ <;> split_ifs <;> norm_num inv' := fun x => by simp_rw [inv_eq_one] }⟩ @[to_additive (attr := simp) existing AddGroupSeminorm.apply_one] theorem apply_one [DecidableEq E] (x : E) : (1 : GroupSeminorm E) x = if x = 1 then 0 else 1 := rfl /-- Any action on `ℝ` which factors through `ℝ≥0` applies to an `AddGroupSeminorm`. -/ @[to_additive existing AddGroupSeminorm.toSMul] instance : SMul R (GroupSeminorm E) := ⟨fun r p => { toFun := fun x => r • p x map_one' := by simp only [← smul_one_smul ℝ≥0 r (_ : ℝ), NNReal.smul_def, smul_eq_mul, map_one_eq_zero p, mul_zero] mul_le' := fun _ _ => by simp only [← smul_one_smul ℝ≥0 r (_ : ℝ), NNReal.smul_def, smul_eq_mul, ← mul_add] gcongr apply map_mul_le_add inv' := fun x => by simp_rw [map_inv_eq_map p] }⟩ @[to_additive existing AddGroupSeminorm.isScalarTower] instance [SMul R' ℝ] [SMul R' ℝ≥0] [IsScalarTower R' ℝ≥0 ℝ] [SMul R R'] [IsScalarTower R R' ℝ] : IsScalarTower R R' (GroupSeminorm E) := ⟨fun r a p => ext fun x => smul_assoc r a <| p x⟩ @[to_additive (attr := simp, norm_cast) existing AddGroupSeminorm.coe_smul] theorem coe_smul (r : R) (p : GroupSeminorm E) : ⇑(r • p) = r • ⇑p := rfl @[to_additive (attr := simp) existing AddGroupSeminorm.smul_apply] theorem smul_apply (r : R) (p : GroupSeminorm E) (x : E) : (r • p) x = r • p x := rfl @[to_additive existing AddGroupSeminorm.smul_sup] theorem smul_sup (r : R) (p q : GroupSeminorm E) : r • (p ⊔ q) = r • p ⊔ r • q := have Real.smul_max : ∀ x y : ℝ, r • max x y = max (r • x) (r • y) := fun x y => by simpa only [← smul_eq_mul, ← NNReal.smul_def, smul_one_smul ℝ≥0 r (_ : ℝ)] using mul_max_of_nonneg x y (r • (1 : ℝ≥0) : ℝ≥0).coe_nonneg ext fun x => Real.smul_max _ _ end GroupSeminorm namespace NonarchAddGroupSeminorm variable [AddGroup E] [SMul R ℝ] [SMul R ℝ≥0] [IsScalarTower R ℝ≥0 ℝ] instance [DecidableEq E] : One (NonarchAddGroupSeminorm E) := ⟨{ toFun := fun x => if x = 0 then 0 else 1 map_zero' := if_pos rfl add_le_max' := fun x y => by by_cases hx : x = 0 · simp_rw [if_pos hx, hx, zero_add] exact le_max_of_le_right (le_refl _) · simp_rw [if_neg hx] split_ifs <;> simp neg' := fun x => by simp_rw [neg_eq_zero] }⟩ @[simp] theorem apply_one [DecidableEq E] (x : E) : (1 : NonarchAddGroupSeminorm E) x = if x = 0 then 0 else 1 := rfl /-- Any action on `ℝ` which factors through `ℝ≥0` applies to a `NonarchAddGroupSeminorm`. -/ instance : SMul R (NonarchAddGroupSeminorm E) := ⟨fun r p => { toFun := fun x => r • p x map_zero' := by simp only [← smul_one_smul ℝ≥0 r (_ : ℝ), NNReal.smul_def, smul_eq_mul, map_zero p, mul_zero] add_le_max' := fun x y => by simp only [← smul_one_smul ℝ≥0 r (_ : ℝ), NNReal.smul_def, smul_eq_mul, ← mul_max_of_nonneg _ _ NNReal.zero_le_coe] gcongr apply map_add_le_max neg' := fun x => by simp_rw [map_neg_eq_map p] }⟩ instance [SMul R' ℝ] [SMul R' ℝ≥0] [IsScalarTower R' ℝ≥0 ℝ] [SMul R R'] [IsScalarTower R R' ℝ] : IsScalarTower R R' (NonarchAddGroupSeminorm E) := ⟨fun r a p => ext fun x => smul_assoc r a <| p x⟩ @[simp, norm_cast] theorem coe_smul (r : R) (p : NonarchAddGroupSeminorm E) : ⇑(r • p) = r • ⇑p := rfl @[simp] theorem smul_apply (r : R) (p : NonarchAddGroupSeminorm E) (x : E) : (r • p) x = r • p x := rfl theorem smul_sup (r : R) (p q : NonarchAddGroupSeminorm E) : r • (p ⊔ q) = r • p ⊔ r • q := have Real.smul_max : ∀ x y : ℝ, r • max x y = max (r • x) (r • y) := fun x y => by simpa only [← smul_eq_mul, ← NNReal.smul_def, smul_one_smul ℝ≥0 r (_ : ℝ)] using mul_max_of_nonneg x y (r • (1 : ℝ≥0) : ℝ≥0).coe_nonneg ext fun x => Real.smul_max _ _ end NonarchAddGroupSeminorm /-! ### Norms -/ namespace GroupNorm section Group variable [Group E] [Group F] [Group G] {p q : GroupNorm E} @[to_additive] instance funLike : FunLike (GroupNorm E) E ℝ where coe f := f.toFun coe_injective' f g h := by obtain ⟨⟨_, _, _, _⟩, _⟩ := f; cases g; congr @[to_additive] instance groupNormClass : GroupNormClass (GroupNorm E) E ℝ where map_one_eq_zero f := f.map_one' map_mul_le_add f := f.mul_le' map_inv_eq_map f := f.inv' eq_one_of_map_eq_zero f := f.eq_one_of_map_eq_zero' _ /-- Helper instance for when there's too many metavariables to apply `DFunLike.hasCoeToFun` directly. -/ @[to_additive "Helper instance for when there's too many metavariables to apply `DFunLike.hasCoeToFun` directly. "] instance : CoeFun (GroupNorm E) fun _ => E → ℝ := DFunLike.hasCoeToFun -- Porting note: `simpNF` told me the left-hand side simplified to this @[to_additive (attr := simp)] theorem toGroupSeminorm_eq_coe : ⇑p.toGroupSeminorm = p := rfl @[to_additive (attr := ext)] theorem ext : (∀ x, p x = q x) → p = q := DFunLike.ext p q @[to_additive] instance : PartialOrder (GroupNorm E) := PartialOrder.lift _ DFunLike.coe_injective @[to_additive] theorem le_def : p ≤ q ↔ (p : E → ℝ) ≤ q := Iff.rfl @[to_additive] theorem lt_def : p < q ↔ (p : E → ℝ) < q := Iff.rfl @[to_additive (attr := simp, norm_cast)] theorem coe_le_coe : (p : E → ℝ) ≤ q ↔ p ≤ q := Iff.rfl @[to_additive (attr := simp, norm_cast)] theorem coe_lt_coe : (p : E → ℝ) < q ↔ p < q := Iff.rfl variable (p q) (f : F →* E) @[to_additive] instance : Add (GroupNorm E) := ⟨fun p q => { p.toGroupSeminorm + q.toGroupSeminorm with eq_one_of_map_eq_zero' := fun _x hx => of_not_not fun h => hx.not_gt <| add_pos (map_pos_of_ne_one p h) (map_pos_of_ne_one q h) }⟩ @[to_additive (attr := simp)] theorem coe_add : ⇑(p + q) = p + q := rfl @[to_additive (attr := simp)] theorem add_apply (x : E) : (p + q) x = p x + q x := rfl -- TODO: define `SupSet` @[to_additive] instance : Sup (GroupNorm E) := ⟨fun p q => { p.toGroupSeminorm ⊔ q.toGroupSeminorm with eq_one_of_map_eq_zero' := fun _x hx => of_not_not fun h => hx.not_gt <| lt_sup_iff.2 <| Or.inl <| map_pos_of_ne_one p h }⟩ @[to_additive (attr := simp, norm_cast)] theorem coe_sup : ⇑(p ⊔ q) = ⇑p ⊔ ⇑q := rfl @[to_additive (attr := simp)] theorem sup_apply (x : E) : (p ⊔ q) x = p x ⊔ q x := rfl @[to_additive] instance : SemilatticeSup (GroupNorm E) := DFunLike.coe_injective.semilatticeSup _ coe_sup end Group end GroupNorm namespace AddGroupNorm variable [AddGroup E] [DecidableEq E] instance : One (AddGroupNorm E) := ⟨{ (1 : AddGroupSeminorm E) with eq_zero_of_map_eq_zero' := fun _x => zero_ne_one.ite_eq_left_iff.1 }⟩ @[simp] theorem apply_one (x : E) : (1 : AddGroupNorm E) x = if x = 0 then 0 else 1 := rfl instance : Inhabited (AddGroupNorm E) := ⟨1⟩ end AddGroupNorm namespace GroupNorm instance _root_.AddGroupNorm.toOne [AddGroup E] [DecidableEq E] : One (AddGroupNorm E) := ⟨{ (1 : AddGroupSeminorm E) with eq_zero_of_map_eq_zero' := fun _ => zero_ne_one.ite_eq_left_iff.1 }⟩ variable [Group E] [DecidableEq E] @[to_additive existing AddGroupNorm.toOne] instance toOne : One (GroupNorm E) := ⟨{ (1 : GroupSeminorm E) with eq_one_of_map_eq_zero' := fun _ => zero_ne_one.ite_eq_left_iff.1 }⟩ @[to_additive (attr := simp) existing AddGroupNorm.apply_one] theorem apply_one (x : E) : (1 : GroupNorm E) x = if x = 1 then 0 else 1 := rfl @[to_additive existing] instance : Inhabited (GroupNorm E) := ⟨1⟩ end GroupNorm namespace NonarchAddGroupNorm section AddGroup variable [AddGroup E] [AddGroup F] {p q : NonarchAddGroupNorm E} instance funLike : FunLike (NonarchAddGroupNorm E) E ℝ where coe f := f.toFun coe_injective' f g h := by obtain ⟨⟨⟨_, _⟩, _, _⟩, _⟩ := f; cases g; congr instance nonarchAddGroupNormClass : NonarchAddGroupNormClass (NonarchAddGroupNorm E) E where map_add_le_max f := f.add_le_max' map_zero f := f.map_zero' map_neg_eq_map' f := f.neg' eq_zero_of_map_eq_zero f := f.eq_zero_of_map_eq_zero' _ /-- Helper instance for when there's too many metavariables to apply `DFunLike.hasCoeToFun`. -/ noncomputable instance : CoeFun (NonarchAddGroupNorm E) fun _ => E → ℝ := DFunLike.hasCoeToFun -- Porting note: `simpNF` told me the left-hand side simplified to this @[simp] theorem toNonarchAddGroupSeminorm_eq_coe : ⇑p.toNonarchAddGroupSeminorm = p := rfl @[ext] theorem ext : (∀ x, p x = q x) → p = q := DFunLike.ext p q noncomputable instance : PartialOrder (NonarchAddGroupNorm E) := PartialOrder.lift _ DFunLike.coe_injective theorem le_def : p ≤ q ↔ (p : E → ℝ) ≤ q := Iff.rfl theorem lt_def : p < q ↔ (p : E → ℝ) < q := Iff.rfl @[simp, norm_cast] theorem coe_le_coe : (p : E → ℝ) ≤ q ↔ p ≤ q := Iff.rfl @[simp, norm_cast] theorem coe_lt_coe : (p : E → ℝ) < q ↔ p < q := Iff.rfl variable (p q) (f : F →+ E) instance : Sup (NonarchAddGroupNorm E) := ⟨fun p q => { p.toNonarchAddGroupSeminorm ⊔ q.toNonarchAddGroupSeminorm with eq_zero_of_map_eq_zero' := fun _x hx => of_not_not fun h => hx.not_gt <| lt_sup_iff.2 <| Or.inl <| map_pos_of_ne_zero p h }⟩ @[simp, norm_cast] theorem coe_sup : ⇑(p ⊔ q) = ⇑p ⊔ ⇑q := rfl @[simp] theorem sup_apply (x : E) : (p ⊔ q) x = p x ⊔ q x := rfl noncomputable instance : SemilatticeSup (NonarchAddGroupNorm E) := DFunLike.coe_injective.semilatticeSup _ coe_sup instance [DecidableEq E] : One (NonarchAddGroupNorm E) := ⟨{ (1 : NonarchAddGroupSeminorm E) with eq_zero_of_map_eq_zero' := fun _ => zero_ne_one.ite_eq_left_iff.1 }⟩ @[simp] theorem apply_one [DecidableEq E] (x : E) : (1 : NonarchAddGroupNorm E) x = if x = 0 then 0 else 1 := rfl instance [DecidableEq E] : Inhabited (NonarchAddGroupNorm E) := ⟨1⟩ end AddGroup end NonarchAddGroupNorm
Analysis\Normed\Group\SemiNormedGrp.lean
/- Copyright (c) 2021 Johan Commelin. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johan Commelin, Riccardo Brasca -/ import Mathlib.Analysis.Normed.Group.Constructions import Mathlib.Analysis.Normed.Group.Hom import Mathlib.CategoryTheory.Limits.Shapes.ZeroMorphisms import Mathlib.CategoryTheory.ConcreteCategory.BundledHom import Mathlib.CategoryTheory.Elementwise /-! # The category of seminormed groups We define `SemiNormedGrp`, the category of seminormed groups and normed group homs between them, as well as `SemiNormedGrp₁`, the subcategory of norm non-increasing morphisms. -/ noncomputable section universe u open CategoryTheory /-- The category of seminormed abelian groups and bounded group homomorphisms. -/ def SemiNormedGrp : Type (u + 1) := Bundled SeminormedAddCommGroup namespace SemiNormedGrp instance bundledHom : BundledHom @NormedAddGroupHom where toFun := @NormedAddGroupHom.toFun id := @NormedAddGroupHom.id comp := @NormedAddGroupHom.comp deriving instance LargeCategory for SemiNormedGrp -- Porting note: deriving fails for ConcreteCategory, adding instance manually. -- See https://github.com/leanprover-community/mathlib4/issues/5020 -- deriving instance LargeCategory, ConcreteCategory for SemiRingCat instance : ConcreteCategory SemiNormedGrp := by dsimp [SemiNormedGrp] infer_instance instance : CoeSort SemiNormedGrp Type* where coe X := X.α /-- Construct a bundled `SemiNormedGrp` from the underlying type and typeclass. -/ def of (M : Type u) [SeminormedAddCommGroup M] : SemiNormedGrp := Bundled.of M instance (M : SemiNormedGrp) : SeminormedAddCommGroup M := M.str -- Porting note (#10754): added instance instance funLike {V W : SemiNormedGrp} : FunLike (V ⟶ W) V W where coe := (forget SemiNormedGrp).map coe_injective' := fun f g h => by cases f; cases g; congr instance toAddMonoidHomClass {V W : SemiNormedGrp} : AddMonoidHomClass (V ⟶ W) V W where map_add f := f.map_add' map_zero f := (AddMonoidHom.mk' f.toFun f.map_add').map_zero -- Porting note (#10688): added to ease automation @[ext] lemma ext {M N : SemiNormedGrp} {f₁ f₂ : M ⟶ N} (h : ∀ (x : M), f₁ x = f₂ x) : f₁ = f₂ := DFunLike.ext _ _ h @[simp] theorem coe_of (V : Type u) [SeminormedAddCommGroup V] : (SemiNormedGrp.of V : Type u) = V := rfl -- Porting note: marked with high priority to short circuit simplifier's path @[simp (high)] theorem coe_id (V : SemiNormedGrp) : (𝟙 V : V → V) = id := rfl -- Porting note: marked with high priority to short circuit simplifier's path @[simp (high)] theorem coe_comp {M N K : SemiNormedGrp} (f : M ⟶ N) (g : N ⟶ K) : (f ≫ g : M → K) = g ∘ f := rfl instance : Inhabited SemiNormedGrp := ⟨of PUnit⟩ instance ofUnique (V : Type u) [SeminormedAddCommGroup V] [i : Unique V] : Unique (SemiNormedGrp.of V) := i instance {M N : SemiNormedGrp} : Zero (M ⟶ N) := NormedAddGroupHom.zero @[simp] theorem zero_apply {V W : SemiNormedGrp} (x : V) : (0 : V ⟶ W) x = 0 := rfl instance : Limits.HasZeroMorphisms.{u, u + 1} SemiNormedGrp where theorem isZero_of_subsingleton (V : SemiNormedGrp) [Subsingleton V] : Limits.IsZero V := by refine ⟨fun X => ⟨⟨⟨0⟩, fun f => ?_⟩⟩, fun X => ⟨⟨⟨0⟩, fun f => ?_⟩⟩⟩ · ext x; have : x = 0 := Subsingleton.elim _ _; simp only [this, map_zero] · ext; apply Subsingleton.elim instance hasZeroObject : Limits.HasZeroObject SemiNormedGrp.{u} := ⟨⟨of PUnit, isZero_of_subsingleton _⟩⟩ theorem iso_isometry_of_normNoninc {V W : SemiNormedGrp} (i : V ≅ W) (h1 : i.hom.NormNoninc) (h2 : i.inv.NormNoninc) : Isometry i.hom := by apply AddMonoidHomClass.isometry_of_norm intro v apply le_antisymm (h1 v) calc -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 ‖v‖ = ‖i.inv (i.hom v)‖ := by erw [Iso.hom_inv_id_apply] _ ≤ ‖i.hom v‖ := h2 _ end SemiNormedGrp /-- `SemiNormedGrp₁` is a type synonym for `SemiNormedGrp`, which we shall equip with the category structure consisting only of the norm non-increasing maps. -/ def SemiNormedGrp₁ : Type (u + 1) := Bundled SeminormedAddCommGroup namespace SemiNormedGrp₁ instance : CoeSort SemiNormedGrp₁ Type* where coe X := X.α instance : LargeCategory.{u} SemiNormedGrp₁ where Hom X Y := { f : NormedAddGroupHom X Y // f.NormNoninc } id X := ⟨NormedAddGroupHom.id X, NormedAddGroupHom.NormNoninc.id⟩ comp {X Y Z} f g := ⟨g.1.comp f.1, g.2.comp f.2⟩ -- Porting note (#10754): added instance instance instFunLike (X Y : SemiNormedGrp₁) : FunLike (X ⟶ Y) X Y where coe f := f.1.toFun coe_injective' _ _ h := Subtype.val_inj.mp (NormedAddGroupHom.coe_injective h) @[ext] theorem hom_ext {M N : SemiNormedGrp₁} (f g : M ⟶ N) (w : (f : M → N) = (g : M → N)) : f = g := Subtype.eq (NormedAddGroupHom.ext (congr_fun w)) instance : ConcreteCategory.{u} SemiNormedGrp₁ where forget := { obj := fun X => X map := fun f => f } forget_faithful := { } -- Porting note (#10754): added instance instance toAddMonoidHomClass {V W : SemiNormedGrp₁} : AddMonoidHomClass (V ⟶ W) V W where map_add f := f.1.map_add' map_zero f := (AddMonoidHom.mk' f.1 f.1.map_add').map_zero /-- Construct a bundled `SemiNormedGrp₁` from the underlying type and typeclass. -/ def of (M : Type u) [SeminormedAddCommGroup M] : SemiNormedGrp₁ := Bundled.of M instance (M : SemiNormedGrp₁) : SeminormedAddCommGroup M := M.str /-- Promote a morphism in `SemiNormedGrp` to a morphism in `SemiNormedGrp₁`. -/ def mkHom {M N : SemiNormedGrp} (f : M ⟶ N) (i : f.NormNoninc) : SemiNormedGrp₁.of M ⟶ SemiNormedGrp₁.of N := ⟨f, i⟩ -- @[simp] -- Porting note: simpNF linter claims LHS simplifies with `SemiNormedGrp₁.coe_of` theorem mkHom_apply {M N : SemiNormedGrp} (f : M ⟶ N) (i : f.NormNoninc) (x) : mkHom f i x = f x := rfl /-- Promote an isomorphism in `SemiNormedGrp` to an isomorphism in `SemiNormedGrp₁`. -/ @[simps] def mkIso {M N : SemiNormedGrp} (f : M ≅ N) (i : f.hom.NormNoninc) (i' : f.inv.NormNoninc) : SemiNormedGrp₁.of M ≅ SemiNormedGrp₁.of N where hom := mkHom f.hom i inv := mkHom f.inv i' hom_inv_id := by apply Subtype.eq; exact f.hom_inv_id inv_hom_id := by apply Subtype.eq; exact f.inv_hom_id instance : HasForget₂ SemiNormedGrp₁ SemiNormedGrp where forget₂ := { obj := fun X => X map := fun f => f.1 } @[simp] theorem coe_of (V : Type u) [SeminormedAddCommGroup V] : (SemiNormedGrp₁.of V : Type u) = V := rfl -- Porting note: marked with high priority to short circuit simplifier's path @[simp (high)] theorem coe_id (V : SemiNormedGrp₁) : ⇑(𝟙 V) = id := rfl -- Porting note: marked with high priority to short circuit simplifier's path @[simp (high)] theorem coe_comp {M N K : SemiNormedGrp₁} (f : M ⟶ N) (g : N ⟶ K) : (f ≫ g : M → K) = g ∘ f := rfl -- Porting note: deleted `coe_comp'`, as we no longer have the relevant coercion. instance : Inhabited SemiNormedGrp₁ := ⟨of PUnit⟩ instance ofUnique (V : Type u) [SeminormedAddCommGroup V] [i : Unique V] : Unique (SemiNormedGrp₁.of V) := i -- Porting note: extracted from `Limits.HasZeroMorphisms` instance below. instance (X Y : SemiNormedGrp₁) : Zero (X ⟶ Y) where zero := ⟨0, NormedAddGroupHom.NormNoninc.zero⟩ @[simp] theorem zero_apply {V W : SemiNormedGrp₁} (x : V) : (0 : V ⟶ W) x = 0 := rfl instance : Limits.HasZeroMorphisms.{u, u + 1} SemiNormedGrp₁ where theorem isZero_of_subsingleton (V : SemiNormedGrp₁) [Subsingleton V] : Limits.IsZero V := by refine ⟨fun X => ⟨⟨⟨0⟩, fun f => ?_⟩⟩, fun X => ⟨⟨⟨0⟩, fun f => ?_⟩⟩⟩ · ext x; have : x = 0 := Subsingleton.elim _ _; simp only [this, map_zero] · ext; apply Subsingleton.elim instance hasZeroObject : Limits.HasZeroObject SemiNormedGrp₁.{u} := ⟨⟨of PUnit, isZero_of_subsingleton _⟩⟩ theorem iso_isometry {V W : SemiNormedGrp₁} (i : V ≅ W) : Isometry i.hom := by change Isometry (⟨⟨i.hom, map_zero _⟩, fun _ _ => map_add _ _ _⟩ : V →+ W) refine AddMonoidHomClass.isometry_of_norm _ ?_ intro v apply le_antisymm (i.hom.2 v) calc -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 ‖v‖ = ‖i.inv (i.hom v)‖ := by erw [Iso.hom_inv_id_apply] _ ≤ ‖i.hom v‖ := i.inv.2 _ end SemiNormedGrp₁
Analysis\Normed\Group\Submodule.lean
/- Copyright (c) 2018 Patrick Massot. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Johannes Hölzl, Yaël Dillies -/ import Mathlib.Algebra.Module.Submodule.LinearMap import Mathlib.Analysis.Normed.Group.Basic /-! # Submodules of normed groups -/ variable {𝕜 E : Type*} namespace Submodule /-- A submodule of a seminormed group is also a seminormed group, with the restriction of the norm. -/ instance seminormedAddCommGroup [Ring 𝕜] [SeminormedAddCommGroup E] [Module 𝕜 E] (s : Submodule 𝕜 E) : SeminormedAddCommGroup s := SeminormedAddCommGroup.induced _ _ s.subtype.toAddMonoidHom /-- If `x` is an element of a submodule `s` of a normed group `E`, its norm in `s` is equal to its norm in `E`. -/ @[simp] theorem coe_norm [Ring 𝕜] [SeminormedAddCommGroup E] [Module 𝕜 E] {s : Submodule 𝕜 E} (x : s) : ‖x‖ = ‖(x : E)‖ := rfl /-- If `x` is an element of a submodule `s` of a normed group `E`, its norm in `E` is equal to its norm in `s`. This is a reversed version of the `simp` lemma `Submodule.coe_norm` for use by `norm_cast`. -/ @[norm_cast] theorem norm_coe [Ring 𝕜] [SeminormedAddCommGroup E] [Module 𝕜 E] {s : Submodule 𝕜 E} (x : s) : ‖(x : E)‖ = ‖x‖ := rfl /-- A submodule of a normed group is also a normed group, with the restriction of the norm. -/ instance normedAddCommGroup [Ring 𝕜] [NormedAddCommGroup E] [Module 𝕜 E] (s : Submodule 𝕜 E) : NormedAddCommGroup s := { Submodule.seminormedAddCommGroup s with eq_of_dist_eq_zero := eq_of_dist_eq_zero } end Submodule
Analysis\Normed\Group\Tannery.lean
/- Copyright (c) 2024 David Loeffler. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: David Loeffler -/ import Mathlib.Analysis.RCLike.Basic import Mathlib.Analysis.Normed.Group.InfiniteSum /-! # Tannery's theorem Tannery's theorem gives a sufficient criterion for the limit of an infinite sum (with respect to an auxiliary parameter) to equal the sum of the pointwise limits. See https://en.wikipedia.org/wiki/Tannery%27s_theorem. It is a special case of the dominated convergence theorem (with the measure chosen to be the counting measure); but we give here a direct proof, in order to avoid some unnecessary hypotheses that appear when specialising the general measure-theoretic result. -/ open Filter Topology /-- **Tannery's theorem**: topological sums commute with termwise limits, when the norms of the summands are eventually uniformly bounded by a summable function. (This is the special case of the Lebesgue dominated convergence theorem for the counting measure on a discrete set. However, we prove it under somewhat weaker assumptions than the general measure-theoretic result, e.g. `G` is not assumed to be an `ℝ`-vector space or second countable, and the limit is along an arbitrary filter rather than `atTop ℕ`.) See also: * `MeasureTheory.tendsto_integral_of_dominated_convergence` (for general integrals, but with more assumptions on `G`) * `continuous_tsum` (continuity of infinite sums in a parameter) -/ lemma tendsto_tsum_of_dominated_convergence {α β G : Type*} {𝓕 : Filter α} [NormedAddCommGroup G] [CompleteSpace G] {f : α → β → G} {g : β → G} {bound : β → ℝ} (h_sum : Summable bound) (hab : ∀ k : β, Tendsto (f · k) 𝓕 (𝓝 (g k))) (h_bound : ∀ᶠ n in 𝓕, ∀ k, ‖f n k‖ ≤ bound k) : Tendsto (∑' k, f · k) 𝓕 (𝓝 (∑' k, g k)) := by -- WLOG β is nonempty rcases isEmpty_or_nonempty β · simpa only [tsum_empty] using tendsto_const_nhds -- WLOG 𝓕 ≠ ⊥ rcases 𝓕.eq_or_neBot with rfl | _ · simp only [tendsto_bot] -- Auxiliary lemmas have h_g_le (k : β) : ‖g k‖ ≤ bound k := le_of_tendsto (tendsto_norm.comp (hab k)) <| h_bound.mono (fun n h => h k) have h_sumg : Summable (‖g ·‖) := h_sum.of_norm_bounded _ (fun k ↦ (norm_norm (g k)).symm ▸ h_g_le k) have h_suma : ∀ᶠ n in 𝓕, Summable (‖f n ·‖) := by filter_upwards [h_bound] with n h exact h_sum.of_norm_bounded _ <| by simpa only [norm_norm] using h -- Now main proof, by an `ε / 3` argument rw [Metric.tendsto_nhds] intro ε hε let ⟨S, hS⟩ := h_sum obtain ⟨T, hT⟩ : ∃ (T : Finset β), dist (∑ b ∈ T, bound b) S < ε / 3 := by rw [HasSum, Metric.tendsto_nhds] at hS classical exact Eventually.exists <| hS _ (by positivity) have h1 : ∑' (k : (Tᶜ : Set β)), bound k < ε / 3 := by calc _ ≤ ‖∑' (k : (Tᶜ : Set β)), bound k‖ := Real.le_norm_self _ _ = ‖S - ∑ b ∈ T, bound b‖ := congrArg _ ?_ _ < ε / 3 := by rwa [dist_eq_norm, norm_sub_rev] at hT simpa only [sum_add_tsum_compl h_sum, eq_sub_iff_add_eq'] using hS.tsum_eq have h2 : Tendsto (∑ k ∈ T, f · k) 𝓕 (𝓝 (T.sum g)) := tendsto_finset_sum _ (fun i _ ↦ hab i) rw [Metric.tendsto_nhds] at h2 filter_upwards [h2 (ε / 3) (by positivity), h_suma, h_bound] with n hn h_suma h_bound rw [dist_eq_norm, ← tsum_sub h_suma.of_norm h_sumg.of_norm, ← sum_add_tsum_compl (s := T) (h_suma.of_norm.sub h_sumg.of_norm), (by ring : ε = ε / 3 + (ε / 3 + ε / 3))] refine (norm_add_le _ _).trans_lt (add_lt_add ?_ ?_) · simpa only [dist_eq_norm, Finset.sum_sub_distrib] using hn · rw [tsum_sub (h_suma.subtype _).of_norm (h_sumg.subtype _).of_norm] refine (norm_sub_le _ _).trans_lt (add_lt_add ?_ ?_) · refine ((norm_tsum_le_tsum_norm (h_suma.subtype _)).trans ?_).trans_lt h1 exact tsum_le_tsum (h_bound ·) (h_suma.subtype _) (h_sum.subtype _) · refine ((norm_tsum_le_tsum_norm <| h_sumg.subtype _).trans ?_).trans_lt h1 exact tsum_le_tsum (h_g_le ·) (h_sumg.subtype _) (h_sum.subtype _)
Analysis\Normed\Group\Uniform.lean
/- Copyright (c) 2018 Patrick Massot. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Johannes Hölzl, Yaël Dillies -/ import Mathlib.Topology.Algebra.UniformGroup import Mathlib.Topology.MetricSpace.Algebra import Mathlib.Topology.MetricSpace.IsometricSMul import Mathlib.Analysis.Normed.Group.Basic /-! # Normed groups are uniform groups This file proves lipschitzness of normed group operations and shows that normed groups are uniform groups. -/ variable {𝓕 α E F : Type*} open Filter Function Metric Bornology open scoped ENNReal NNReal Uniformity Pointwise Topology section SeminormedGroup variable [SeminormedGroup E] [SeminormedGroup F] {s : Set E} {a a₁ a₂ b b₁ b₂ : E} {r r₁ r₂ : ℝ} @[to_additive] instance NormedGroup.to_isometricSMul_right : IsometricSMul Eᵐᵒᵖ E := ⟨fun a => Isometry.of_dist_eq fun b c => by simp [dist_eq_norm_div]⟩ @[to_additive] theorem Isometry.norm_map_of_map_one {f : E → F} (hi : Isometry f) (h₁ : f 1 = 1) (x : E) : ‖f x‖ = ‖x‖ := by rw [← dist_one_right, ← h₁, hi.dist_eq, dist_one_right] @[to_additive (attr := simp)] theorem dist_mul_self_right (a b : E) : dist b (a * b) = ‖a‖ := by rw [← dist_one_left, ← dist_mul_right 1 a b, one_mul] @[to_additive (attr := simp)] theorem dist_mul_self_left (a b : E) : dist (a * b) b = ‖a‖ := by rw [dist_comm, dist_mul_self_right] @[to_additive (attr := simp)] theorem dist_div_eq_dist_mul_left (a b c : E) : dist (a / b) c = dist a (c * b) := by rw [← dist_mul_right _ _ b, div_mul_cancel] @[to_additive (attr := simp)] theorem dist_div_eq_dist_mul_right (a b c : E) : dist a (b / c) = dist (a * c) b := by rw [← dist_mul_right _ _ c, div_mul_cancel] open Finset variable [FunLike 𝓕 E F] /-- A homomorphism `f` of seminormed groups is Lipschitz, if there exists a constant `C` such that for all `x`, one has `‖f x‖ ≤ C * ‖x‖`. The analogous condition for a linear map of (semi)normed spaces is in `Mathlib/Analysis/NormedSpace/OperatorNorm.lean`. -/ @[to_additive "A homomorphism `f` of seminormed groups is Lipschitz, if there exists a constant `C` such that for all `x`, one has `‖f x‖ ≤ C * ‖x‖`. The analogous condition for a linear map of (semi)normed spaces is in `Mathlib/Analysis/NormedSpace/OperatorNorm.lean`."] theorem MonoidHomClass.lipschitz_of_bound [MonoidHomClass 𝓕 E F] (f : 𝓕) (C : ℝ) (h : ∀ x, ‖f x‖ ≤ C * ‖x‖) : LipschitzWith (Real.toNNReal C) f := LipschitzWith.of_dist_le' fun x y => by simpa only [dist_eq_norm_div, map_div] using h (x / y) @[to_additive] theorem lipschitzOnWith_iff_norm_div_le {f : E → F} {C : ℝ≥0} : LipschitzOnWith C f s ↔ ∀ ⦃x⦄, x ∈ s → ∀ ⦃y⦄, y ∈ s → ‖f x / f y‖ ≤ C * ‖x / y‖ := by simp only [lipschitzOnWith_iff_dist_le_mul, dist_eq_norm_div] alias ⟨LipschitzOnWith.norm_div_le, _⟩ := lipschitzOnWith_iff_norm_div_le attribute [to_additive] LipschitzOnWith.norm_div_le @[to_additive] theorem LipschitzOnWith.norm_div_le_of_le {f : E → F} {C : ℝ≥0} (h : LipschitzOnWith C f s) (ha : a ∈ s) (hb : b ∈ s) (hr : ‖a / b‖ ≤ r) : ‖f a / f b‖ ≤ C * r := (h.norm_div_le ha hb).trans <| by gcongr @[to_additive] theorem lipschitzWith_iff_norm_div_le {f : E → F} {C : ℝ≥0} : LipschitzWith C f ↔ ∀ x y, ‖f x / f y‖ ≤ C * ‖x / y‖ := by simp only [lipschitzWith_iff_dist_le_mul, dist_eq_norm_div] alias ⟨LipschitzWith.norm_div_le, _⟩ := lipschitzWith_iff_norm_div_le attribute [to_additive] LipschitzWith.norm_div_le @[to_additive] theorem LipschitzWith.norm_div_le_of_le {f : E → F} {C : ℝ≥0} (h : LipschitzWith C f) (hr : ‖a / b‖ ≤ r) : ‖f a / f b‖ ≤ C * r := (h.norm_div_le _ _).trans <| by gcongr /-- A homomorphism `f` of seminormed groups is continuous, if there exists a constant `C` such that for all `x`, one has `‖f x‖ ≤ C * ‖x‖`. -/ @[to_additive "A homomorphism `f` of seminormed groups is continuous, if there exists a constant `C` such that for all `x`, one has `‖f x‖ ≤ C * ‖x‖`"] theorem MonoidHomClass.continuous_of_bound [MonoidHomClass 𝓕 E F] (f : 𝓕) (C : ℝ) (h : ∀ x, ‖f x‖ ≤ C * ‖x‖) : Continuous f := (MonoidHomClass.lipschitz_of_bound f C h).continuous @[to_additive] theorem MonoidHomClass.uniformContinuous_of_bound [MonoidHomClass 𝓕 E F] (f : 𝓕) (C : ℝ) (h : ∀ x, ‖f x‖ ≤ C * ‖x‖) : UniformContinuous f := (MonoidHomClass.lipschitz_of_bound f C h).uniformContinuous @[to_additive] theorem MonoidHomClass.isometry_iff_norm [MonoidHomClass 𝓕 E F] (f : 𝓕) : Isometry f ↔ ∀ x, ‖f x‖ = ‖x‖ := by simp only [isometry_iff_dist_eq, dist_eq_norm_div, ← map_div] refine ⟨fun h x => ?_, fun h x y => h _⟩ simpa using h x 1 alias ⟨_, MonoidHomClass.isometry_of_norm⟩ := MonoidHomClass.isometry_iff_norm attribute [to_additive] MonoidHomClass.isometry_of_norm section NNNorm @[to_additive] theorem MonoidHomClass.lipschitz_of_bound_nnnorm [MonoidHomClass 𝓕 E F] (f : 𝓕) (C : ℝ≥0) (h : ∀ x, ‖f x‖₊ ≤ C * ‖x‖₊) : LipschitzWith C f := @Real.toNNReal_coe C ▸ MonoidHomClass.lipschitz_of_bound f C h @[to_additive] theorem MonoidHomClass.antilipschitz_of_bound [MonoidHomClass 𝓕 E F] (f : 𝓕) {K : ℝ≥0} (h : ∀ x, ‖x‖ ≤ K * ‖f x‖) : AntilipschitzWith K f := AntilipschitzWith.of_le_mul_dist fun x y => by simpa only [dist_eq_norm_div, map_div] using h (x / y) @[to_additive LipschitzWith.norm_le_mul] theorem LipschitzWith.norm_le_mul' {f : E → F} {K : ℝ≥0} (h : LipschitzWith K f) (hf : f 1 = 1) (x) : ‖f x‖ ≤ K * ‖x‖ := by simpa only [dist_one_right, hf] using h.dist_le_mul x 1 @[to_additive LipschitzWith.nnorm_le_mul] theorem LipschitzWith.nnorm_le_mul' {f : E → F} {K : ℝ≥0} (h : LipschitzWith K f) (hf : f 1 = 1) (x) : ‖f x‖₊ ≤ K * ‖x‖₊ := h.norm_le_mul' hf x @[to_additive AntilipschitzWith.le_mul_norm] theorem AntilipschitzWith.le_mul_norm' {f : E → F} {K : ℝ≥0} (h : AntilipschitzWith K f) (hf : f 1 = 1) (x) : ‖x‖ ≤ K * ‖f x‖ := by simpa only [dist_one_right, hf] using h.le_mul_dist x 1 @[to_additive AntilipschitzWith.le_mul_nnnorm] theorem AntilipschitzWith.le_mul_nnnorm' {f : E → F} {K : ℝ≥0} (h : AntilipschitzWith K f) (hf : f 1 = 1) (x) : ‖x‖₊ ≤ K * ‖f x‖₊ := h.le_mul_norm' hf x @[to_additive] theorem OneHomClass.bound_of_antilipschitz [OneHomClass 𝓕 E F] (f : 𝓕) {K : ℝ≥0} (h : AntilipschitzWith K f) (x) : ‖x‖ ≤ K * ‖f x‖ := h.le_mul_nnnorm' (map_one f) x @[to_additive] theorem Isometry.nnnorm_map_of_map_one {f : E → F} (hi : Isometry f) (h₁ : f 1 = 1) (x : E) : ‖f x‖₊ = ‖x‖₊ := Subtype.ext <| hi.norm_map_of_map_one h₁ x end NNNorm @[to_additive lipschitzWith_one_norm] theorem lipschitzWith_one_norm' : LipschitzWith 1 (norm : E → ℝ) := by simpa only [dist_one_left] using LipschitzWith.dist_right (1 : E) @[to_additive lipschitzWith_one_nnnorm] theorem lipschitzWith_one_nnnorm' : LipschitzWith 1 (NNNorm.nnnorm : E → ℝ≥0) := lipschitzWith_one_norm' @[to_additive uniformContinuous_norm] theorem uniformContinuous_norm' : UniformContinuous (norm : E → ℝ) := lipschitzWith_one_norm'.uniformContinuous @[to_additive uniformContinuous_nnnorm] theorem uniformContinuous_nnnorm' : UniformContinuous fun a : E => ‖a‖₊ := uniformContinuous_norm'.subtype_mk _ end SeminormedGroup section SeminormedCommGroup variable [SeminormedCommGroup E] [SeminormedCommGroup F] {a a₁ a₂ b b₁ b₂ : E} {r r₁ r₂ : ℝ} @[to_additive] instance NormedGroup.to_isometricSMul_left : IsometricSMul E E := ⟨fun a => Isometry.of_dist_eq fun b c => by simp [dist_eq_norm_div]⟩ @[to_additive (attr := simp)] theorem dist_self_mul_right (a b : E) : dist a (a * b) = ‖b‖ := by rw [← dist_one_left, ← dist_mul_left a 1 b, mul_one] @[to_additive (attr := simp)] theorem dist_self_mul_left (a b : E) : dist (a * b) a = ‖b‖ := by rw [dist_comm, dist_self_mul_right] @[to_additive (attr := simp 1001)] -- porting note (#10618): increase priority because `simp` can prove this theorem dist_self_div_right (a b : E) : dist a (a / b) = ‖b‖ := by rw [div_eq_mul_inv, dist_self_mul_right, norm_inv'] @[to_additive (attr := simp 1001)] -- porting note (#10618): increase priority because `simp` can prove this theorem dist_self_div_left (a b : E) : dist (a / b) a = ‖b‖ := by rw [dist_comm, dist_self_div_right] @[to_additive] theorem dist_mul_mul_le (a₁ a₂ b₁ b₂ : E) : dist (a₁ * a₂) (b₁ * b₂) ≤ dist a₁ b₁ + dist a₂ b₂ := by simpa only [dist_mul_left, dist_mul_right] using dist_triangle (a₁ * a₂) (b₁ * a₂) (b₁ * b₂) @[to_additive] theorem dist_mul_mul_le_of_le (h₁ : dist a₁ b₁ ≤ r₁) (h₂ : dist a₂ b₂ ≤ r₂) : dist (a₁ * a₂) (b₁ * b₂) ≤ r₁ + r₂ := (dist_mul_mul_le a₁ a₂ b₁ b₂).trans <| add_le_add h₁ h₂ @[to_additive] theorem dist_div_div_le (a₁ a₂ b₁ b₂ : E) : dist (a₁ / a₂) (b₁ / b₂) ≤ dist a₁ b₁ + dist a₂ b₂ := by simpa only [div_eq_mul_inv, dist_inv_inv] using dist_mul_mul_le a₁ a₂⁻¹ b₁ b₂⁻¹ @[to_additive] theorem dist_div_div_le_of_le (h₁ : dist a₁ b₁ ≤ r₁) (h₂ : dist a₂ b₂ ≤ r₂) : dist (a₁ / a₂) (b₁ / b₂) ≤ r₁ + r₂ := (dist_div_div_le a₁ a₂ b₁ b₂).trans <| add_le_add h₁ h₂ @[to_additive] theorem abs_dist_sub_le_dist_mul_mul (a₁ a₂ b₁ b₂ : E) : |dist a₁ b₁ - dist a₂ b₂| ≤ dist (a₁ * a₂) (b₁ * b₂) := by simpa only [dist_mul_left, dist_mul_right, dist_comm b₂] using abs_dist_sub_le (a₁ * a₂) (b₁ * b₂) (b₁ * a₂) open Finset @[to_additive] theorem nndist_mul_mul_le (a₁ a₂ b₁ b₂ : E) : nndist (a₁ * a₂) (b₁ * b₂) ≤ nndist a₁ b₁ + nndist a₂ b₂ := NNReal.coe_le_coe.1 <| dist_mul_mul_le a₁ a₂ b₁ b₂ @[to_additive] theorem edist_mul_mul_le (a₁ a₂ b₁ b₂ : E) : edist (a₁ * a₂) (b₁ * b₂) ≤ edist a₁ b₁ + edist a₂ b₂ := by simp only [edist_nndist] norm_cast apply nndist_mul_mul_le section PseudoEMetricSpace variable {α E : Type*} [SeminormedCommGroup E] [PseudoEMetricSpace α] {K Kf Kg : ℝ≥0} {f g : α → E} {s : Set α} {x : α} @[to_additive (attr := simp)] lemma lipschitzWith_inv_iff : LipschitzWith K f⁻¹ ↔ LipschitzWith K f := by simp [LipschitzWith] @[to_additive (attr := simp)] lemma antilipschitzWith_inv_iff : AntilipschitzWith K f⁻¹ ↔ AntilipschitzWith K f := by simp [AntilipschitzWith] @[to_additive (attr := simp)] lemma lipschitzOnWith_inv_iff : LipschitzOnWith K f⁻¹ s ↔ LipschitzOnWith K f s := by simp [LipschitzOnWith] @[to_additive (attr := simp)] lemma locallyLipschitz_inv_iff : LocallyLipschitz f⁻¹ ↔ LocallyLipschitz f := by simp [LocallyLipschitz] @[to_additive] alias ⟨LipschitzWith.of_inv, LipschitzWith.inv⟩ := lipschitzWith_inv_iff @[to_additive] alias ⟨AntilipschitzWith.of_inv, AntilipschitzWith.inv⟩ := antilipschitzWith_inv_iff @[to_additive] alias ⟨LipschitzOnWith.of_inv, LipschitzOnWith.inv⟩ := lipschitzOnWith_inv_iff @[to_additive] alias ⟨LocallyLipschitz.of_inv, LocallyLipschitz.inv⟩ := locallyLipschitz_inv_iff namespace LipschitzWith @[to_additive add] theorem mul' (hf : LipschitzWith Kf f) (hg : LipschitzWith Kg g) : LipschitzWith (Kf + Kg) fun x => f x * g x := fun x y => calc edist (f x * g x) (f y * g y) ≤ edist (f x) (f y) + edist (g x) (g y) := edist_mul_mul_le _ _ _ _ _ ≤ Kf * edist x y + Kg * edist x y := add_le_add (hf x y) (hg x y) _ = (Kf + Kg) * edist x y := (add_mul _ _ _).symm @[to_additive] theorem div (hf : LipschitzWith Kf f) (hg : LipschitzWith Kg g) : LipschitzWith (Kf + Kg) fun x => f x / g x := by simpa only [div_eq_mul_inv] using hf.mul' hg.inv end LipschitzWith namespace AntilipschitzWith @[to_additive] theorem mul_lipschitzWith (hf : AntilipschitzWith Kf f) (hg : LipschitzWith Kg g) (hK : Kg < Kf⁻¹) : AntilipschitzWith (Kf⁻¹ - Kg)⁻¹ fun x => f x * g x := by letI : PseudoMetricSpace α := PseudoEMetricSpace.toPseudoMetricSpace hf.edist_ne_top refine AntilipschitzWith.of_le_mul_dist fun x y => ?_ rw [NNReal.coe_inv, ← _root_.div_eq_inv_mul] rw [le_div_iff (NNReal.coe_pos.2 <| tsub_pos_iff_lt.2 hK)] rw [mul_comm, NNReal.coe_sub hK.le, _root_.sub_mul] -- Porting note: `ENNReal.sub_mul` should be `protected`? calc ↑Kf⁻¹ * dist x y - Kg * dist x y ≤ dist (f x) (f y) - dist (g x) (g y) := sub_le_sub (hf.mul_le_dist x y) (hg.dist_le_mul x y) _ ≤ _ := le_trans (le_abs_self _) (abs_dist_sub_le_dist_mul_mul _ _ _ _) @[to_additive] theorem mul_div_lipschitzWith (hf : AntilipschitzWith Kf f) (hg : LipschitzWith Kg (g / f)) (hK : Kg < Kf⁻¹) : AntilipschitzWith (Kf⁻¹ - Kg)⁻¹ g := by simpa only [Pi.div_apply, mul_div_cancel] using hf.mul_lipschitzWith hg hK @[to_additive le_mul_norm_sub] theorem le_mul_norm_div {f : E → F} (hf : AntilipschitzWith K f) (x y : E) : ‖x / y‖ ≤ K * ‖f x / f y‖ := by simp [← dist_eq_norm_div, hf.le_mul_dist x y] end AntilipschitzWith end PseudoEMetricSpace -- See note [lower instance priority] @[to_additive] instance (priority := 100) SeminormedCommGroup.to_lipschitzMul : LipschitzMul E := ⟨⟨1 + 1, LipschitzWith.prod_fst.mul' LipschitzWith.prod_snd⟩⟩ -- See note [lower instance priority] /-- A seminormed group is a uniform group, i.e., multiplication and division are uniformly continuous. -/ @[to_additive "A seminormed group is a uniform additive group, i.e., addition and subtraction are uniformly continuous."] instance (priority := 100) SeminormedCommGroup.to_uniformGroup : UniformGroup E := ⟨(LipschitzWith.prod_fst.div LipschitzWith.prod_snd).uniformContinuous⟩ -- short-circuit type class inference -- See note [lower instance priority] @[to_additive] instance (priority := 100) SeminormedCommGroup.toTopologicalGroup : TopologicalGroup E := inferInstance @[to_additive] theorem cauchySeq_prod_of_eventually_eq {u v : ℕ → E} {N : ℕ} (huv : ∀ n ≥ N, u n = v n) (hv : CauchySeq fun n => ∏ k ∈ range (n + 1), v k) : CauchySeq fun n => ∏ k ∈ range (n + 1), u k := by let d : ℕ → E := fun n => ∏ k ∈ range (n + 1), u k / v k rw [show (fun n => ∏ k ∈ range (n + 1), u k) = d * fun n => ∏ k ∈ range (n + 1), v k by ext n; simp [d]] suffices ∀ n ≥ N, d n = d N from (tendsto_atTop_of_eventually_const this).cauchySeq.mul hv intro n hn dsimp [d] rw [eventually_constant_prod _ (add_le_add_right hn 1)] intro m hm simp [huv m (le_of_lt hm)] end SeminormedCommGroup
Analysis\Normed\Group\ZeroAtInfty.lean
/- Copyright (c) 2024 Moritz Doll. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Moritz Doll -/ import Mathlib.Topology.ContinuousFunction.ZeroAtInfty /-! # ZeroAtInftyContinuousMapClass in normed additive groups In this file we give a characterization of the predicate `zero_at_infty` from `ZeroAtInftyContinuousMapClass`. A continuous map `f` is zero at infinity if and only if for every `ε > 0` there exists a `r : ℝ` such that for all `x : E` with `r < ‖x‖` it holds that `‖f x‖ < ε`. -/ open Topology Filter variable {E F 𝓕 : Type*} variable [SeminormedAddGroup E] [SeminormedAddCommGroup F] variable [FunLike 𝓕 E F] [ZeroAtInftyContinuousMapClass 𝓕 E F] theorem ZeroAtInftyContinuousMapClass.norm_le (f : 𝓕) (ε : ℝ) (hε : 0 < ε) : ∃ (r : ℝ), ∀ (x : E) (_hx : r < ‖x‖), ‖f x‖ < ε := by have h := zero_at_infty f rw [tendsto_zero_iff_norm_tendsto_zero, tendsto_def] at h specialize h (Metric.ball 0 ε) (Metric.ball_mem_nhds 0 hε) rcases Metric.closedBall_compl_subset_of_mem_cocompact h 0 with ⟨r, hr⟩ use r intro x hr' suffices x ∈ (fun x ↦ ‖f x‖) ⁻¹' Metric.ball 0 ε by aesop apply hr aesop variable [ProperSpace E] theorem zero_at_infty_of_norm_le (f : E → F) (h : ∀ (ε : ℝ) (_hε : 0 < ε), ∃ (r : ℝ), ∀ (x : E) (_hx : r < ‖x‖), ‖f x‖ < ε) : Tendsto f (cocompact E) (𝓝 0) := by rw [tendsto_zero_iff_norm_tendsto_zero] intro s hs rw [mem_map, Metric.mem_cocompact_iff_closedBall_compl_subset 0] rw [Metric.mem_nhds_iff] at hs rcases hs with ⟨ε, hε, hs⟩ rcases h ε hε with ⟨r, hr⟩ use r intro aesop
Analysis\Normed\Group\SemiNormedGrp\Completion.lean
/- Copyright (c) 2021 Riccardo Brasca. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Riccardo Brasca, Johan Commelin -/ import Mathlib.Analysis.Normed.Group.SemiNormedGrp import Mathlib.CategoryTheory.Preadditive.AdditiveFunctor import Mathlib.Analysis.Normed.Group.HomCompletion /-! # Completions of normed groups This file contains an API for completions of seminormed groups (basic facts about objects and morphisms). ## Main definitions - `SemiNormedGrp.Completion : SemiNormedGrp ⥤ SemiNormedGrp` : the completion of a seminormed group (defined as a functor on `SemiNormedGrp` to itself). - `SemiNormedGrp.Completion.lift (f : V ⟶ W) : (Completion.obj V ⟶ W)` : a normed group hom from `V` to complete `W` extends ("lifts") to a seminormed group hom from the completion of `V` to `W`. ## Projects 1. Construct the category of complete seminormed groups, say `CompleteSemiNormedGrp` and promote the `Completion` functor below to a functor landing in this category. 2. Prove that the functor `Completion : SemiNormedGrp ⥤ CompleteSemiNormedGrp` is left adjoint to the forgetful functor. -/ noncomputable section universe u open UniformSpace MulOpposite CategoryTheory NormedAddGroupHom namespace SemiNormedGrp /-- The completion of a seminormed group, as an endofunctor on `SemiNormedGrp`. -/ @[simps] def completion : SemiNormedGrp.{u} ⥤ SemiNormedGrp.{u} where obj V := SemiNormedGrp.of (Completion V) map f := f.completion map_id _ := completion_id map_comp f g := (completion_comp f g).symm instance completion_completeSpace {V : SemiNormedGrp} : CompleteSpace (completion.obj V) := Completion.completeSpace _ /-- The canonical morphism from a seminormed group `V` to its completion. -/ @[simps] def completion.incl {V : SemiNormedGrp} : V ⟶ completion.obj V where toFun v := (v : Completion V) map_add' := Completion.coe_add bound' := ⟨1, fun v => by simp⟩ -- These lemmas have always been bad (#7657), but leanprover/lean4#2644 made `simp` start noticing attribute [nolint simpNF] SemiNormedGrp.completion.incl_apply theorem completion.norm_incl_eq {V : SemiNormedGrp} {v : V} : ‖completion.incl v‖ = ‖v‖ := UniformSpace.Completion.norm_coe _ theorem completion.map_normNoninc {V W : SemiNormedGrp} {f : V ⟶ W} (hf : f.NormNoninc) : (completion.map f).NormNoninc := NormedAddGroupHom.NormNoninc.normNoninc_iff_norm_le_one.2 <| (NormedAddGroupHom.norm_completion f).le.trans <| NormedAddGroupHom.NormNoninc.normNoninc_iff_norm_le_one.1 hf variable (V W : SemiNormedGrp) /-- Given a normed group hom `V ⟶ W`, this defines the associated morphism from the completion of `V` to the completion of `W`. The difference from the definition obtained from the functoriality of completion is in that the map sending a morphism `f` to the associated morphism of completions is itself additive. -/ def completion.mapHom (V W : SemiNormedGrp.{u}) : -- Porting note: cannot see instances through concrete cats have (V W : SemiNormedGrp.{u}) : AddGroup (V ⟶ W) := inferInstanceAs <| AddGroup <| NormedAddGroupHom V W (V ⟶ W) →+ (completion.obj V ⟶ completion.obj W) := @AddMonoidHom.mk' _ _ (_) (_) completion.map fun f g => f.completion_add g -- @[simp] -- Porting note: removed simp since LHS simplifies and is not used theorem completion.map_zero (V W : SemiNormedGrp) : completion.map (0 : V ⟶ W) = 0 := -- Porting note: cannot see instances through concrete cats @AddMonoidHom.map_zero _ _ (_) (_) (completion.mapHom V W) instance : Preadditive SemiNormedGrp.{u} where homGroup P Q := inferInstanceAs <| AddCommGroup <| NormedAddGroupHom P Q add_comp _ Q _ f f' g := by ext x -- Porting note: failing simps probably due to instance synthesis issues with concrete -- cats; see the gymnastics below for what used to be -- simp only [add_apply, comp_apply. map_add] -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 rw [NormedAddGroupHom.add_apply]; erw [CategoryTheory.comp_apply, CategoryTheory.comp_apply, CategoryTheory.comp_apply, @NormedAddGroupHom.add_apply _ _ (_) (_)] convert map_add g (f x) (f' x) comp_add _ _ _ _ _ _ := by ext -- Porting note: failing simps probably due to instance synthesis issues with concrete -- cats; see the gymnastics below for what used to be -- simp only [add_apply, comp_apply. map_add] rw [NormedAddGroupHom.add_apply] -- This used to be a single `rw`, but we need `erw` after leanprover/lean4#2644 erw [CategoryTheory.comp_apply, CategoryTheory.comp_apply, CategoryTheory.comp_apply, @NormedAddGroupHom.add_apply _ _ (_) (_)] rfl instance : Functor.Additive completion where map_add := NormedAddGroupHom.completion_add _ _ /-- Given a normed group hom `f : V → W` with `W` complete, this provides a lift of `f` to the completion of `V`. The lemmas `lift_unique` and `lift_comp_incl` provide the api for the universal property of the completion. -/ def completion.lift {V W : SemiNormedGrp} [CompleteSpace W] [T0Space W] (f : V ⟶ W) : completion.obj V ⟶ W where toFun := f.extension map_add' := f.extension.toAddMonoidHom.map_add' bound' := f.extension.bound' theorem completion.lift_comp_incl {V W : SemiNormedGrp} [CompleteSpace W] [T0Space W] (f : V ⟶ W) : completion.incl ≫ completion.lift f = f := ext <| NormedAddGroupHom.extension_coe _ theorem completion.lift_unique {V W : SemiNormedGrp} [CompleteSpace W] [T0Space W] (f : V ⟶ W) (g : completion.obj V ⟶ W) : completion.incl ≫ g = f → g = completion.lift f := fun h => (NormedAddGroupHom.extension_unique _ fun v => ((NormedAddGroupHom.ext_iff.1 h) v).symm).symm end SemiNormedGrp
Analysis\Normed\Group\SemiNormedGrp\Kernels.lean
/- Copyright (c) 2021 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Riccardo Brasca, Johan Commelin, Scott Morrison -/ import Mathlib.Analysis.Normed.Group.SemiNormedGrp import Mathlib.Analysis.Normed.Group.Quotient import Mathlib.CategoryTheory.Limits.Shapes.Kernels /-! # Kernels and cokernels in SemiNormedGrp₁ and SemiNormedGrp We show that `SemiNormedGrp₁` has cokernels (for which of course the `cokernel.π f` maps are norm non-increasing), as well as the easier result that `SemiNormedGrp` has cokernels. We also show that `SemiNormedGrp` has kernels. So far, I don't see a way to state nicely what we really want: `SemiNormedGrp` has cokernels, and `cokernel.π f` is norm non-increasing. The problem is that the limits API doesn't promise you any particular model of the cokernel, and in `SemiNormedGrp` one can always take a cokernel and rescale its norm (and hence making `cokernel.π f` arbitrarily large in norm), obtaining another categorical cokernel. -/ open CategoryTheory CategoryTheory.Limits universe u namespace SemiNormedGrp₁ noncomputable section /-- Auxiliary definition for `HasCokernels SemiNormedGrp₁`. -/ def cokernelCocone {X Y : SemiNormedGrp₁.{u}} (f : X ⟶ Y) : Cofork f 0 := Cofork.ofπ (@SemiNormedGrp₁.mkHom _ (SemiNormedGrp.of (Y ⧸ NormedAddGroupHom.range f.1)) f.1.range.normedMk (NormedAddGroupHom.isQuotientQuotient _).norm_le) (by ext x -- Porting note(https://github.com/leanprover-community/mathlib4/issues/5026): was -- simp only [comp_apply, Limits.zero_comp, NormedAddGroupHom.zero_apply, -- SemiNormedGrp₁.mkHom_apply, SemiNormedGrp₁.zero_apply, -- ← NormedAddGroupHom.mem_ker, f.1.range.ker_normedMk, f.1.mem_range] -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [Limits.zero_comp, comp_apply, SemiNormedGrp₁.mkHom_apply, SemiNormedGrp₁.zero_apply, ← NormedAddGroupHom.mem_ker, f.1.range.ker_normedMk, f.1.mem_range] use x rfl) /-- Auxiliary definition for `HasCokernels SemiNormedGrp₁`. -/ def cokernelLift {X Y : SemiNormedGrp₁.{u}} (f : X ⟶ Y) (s : CokernelCofork f) : (cokernelCocone f).pt ⟶ s.pt := by fconstructor -- The lift itself: · apply NormedAddGroupHom.lift _ s.π.1 rintro _ ⟨b, rfl⟩ change (f ≫ s.π) b = 0 simp -- This used to be the end of the proof before leanprover/lean4#2644 erw [zero_apply] -- The lift has norm at most one: exact NormedAddGroupHom.lift_normNoninc _ _ _ s.π.2 instance : HasCokernels SemiNormedGrp₁.{u} where has_colimit f := HasColimit.mk { cocone := cokernelCocone f isColimit := isColimitAux _ (cokernelLift f) (fun s => by ext apply NormedAddGroupHom.lift_mk f.1.range rintro _ ⟨b, rfl⟩ change (f ≫ s.π) b = 0 simp -- This used to be the end of the proof before leanprover/lean4#2644 erw [zero_apply]) fun s m w => Subtype.eq (NormedAddGroupHom.lift_unique f.1.range _ _ _ (congr_arg Subtype.val w : _)) } -- Sanity check example : HasCokernels SemiNormedGrp₁ := by infer_instance end end SemiNormedGrp₁ namespace SemiNormedGrp section EqualizersAndKernels -- Porting note: these weren't needed in Lean 3 instance {V W : SemiNormedGrp.{u}} : Sub (V ⟶ W) := (inferInstance : Sub (NormedAddGroupHom V W)) noncomputable instance {V W : SemiNormedGrp.{u}} : Norm (V ⟶ W) := (inferInstance : Norm (NormedAddGroupHom V W)) noncomputable instance {V W : SemiNormedGrp.{u}} : NNNorm (V ⟶ W) := (inferInstance : NNNorm (NormedAddGroupHom V W)) /-- The equalizer cone for a parallel pair of morphisms of seminormed groups. -/ def fork {V W : SemiNormedGrp.{u}} (f g : V ⟶ W) : Fork f g := @Fork.ofι _ _ _ _ _ _ (of (f - g : NormedAddGroupHom V W).ker) (NormedAddGroupHom.incl (f - g).ker) <| by -- Porting note: not needed in mathlib3 change NormedAddGroupHom V W at f g ext v have : v.1 ∈ (f - g).ker := v.2 simpa only [NormedAddGroupHom.incl_apply, Pi.zero_apply, coe_comp, NormedAddGroupHom.coe_zero, NormedAddGroupHom.mem_ker, NormedAddGroupHom.coe_sub, Pi.sub_apply, sub_eq_zero] using this instance hasLimit_parallelPair {V W : SemiNormedGrp.{u}} (f g : V ⟶ W) : HasLimit (parallelPair f g) where exists_limit := Nonempty.intro { cone := fork f g isLimit := Fork.IsLimit.mk _ (fun c => NormedAddGroupHom.ker.lift (Fork.ι c) _ <| show NormedAddGroupHom.compHom (f - g) c.ι = 0 by rw [AddMonoidHom.map_sub, AddMonoidHom.sub_apply, sub_eq_zero]; exact c.condition) (fun c => NormedAddGroupHom.ker.incl_comp_lift _ _ _) fun c g h => by -- Porting note: the `simp_rw` was was `rw [← h]` but motive is not type correct in mathlib4 ext x; dsimp; simp_rw [← h]; rfl} instance : Limits.HasEqualizers.{u, u + 1} SemiNormedGrp := @hasEqualizers_of_hasLimit_parallelPair SemiNormedGrp _ fun {_ _ f g} => SemiNormedGrp.hasLimit_parallelPair f g end EqualizersAndKernels section Cokernel -- PROJECT: can we reuse the work to construct cokernels in `SemiNormedGrp₁` here? -- I don't see a way to do this that is less work than just repeating the relevant parts. /-- Auxiliary definition for `HasCokernels SemiNormedGrp`. -/ noncomputable def cokernelCocone {X Y : SemiNormedGrp.{u}} (f : X ⟶ Y) : Cofork f 0 := @Cofork.ofπ _ _ _ _ _ _ (SemiNormedGrp.of (Y ⧸ NormedAddGroupHom.range f)) f.range.normedMk (by ext a simp only [comp_apply, Limits.zero_comp] -- Porting note: `simp` not firing on the below -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [comp_apply, NormedAddGroupHom.zero_apply] -- Porting note: Lean 3 didn't need this instance letI : SeminormedAddCommGroup ((forget SemiNormedGrp).obj Y) := (inferInstance : SeminormedAddCommGroup Y) -- Porting note: again simp doesn't seem to be firing in the below line -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [← NormedAddGroupHom.mem_ker, f.range.ker_normedMk, f.mem_range] -- This used to be `simp only [exists_apply_eq_apply]` before leanprover/lean4#2644 convert exists_apply_eq_apply f a) /-- Auxiliary definition for `HasCokernels SemiNormedGrp`. -/ noncomputable def cokernelLift {X Y : SemiNormedGrp.{u}} (f : X ⟶ Y) (s : CokernelCofork f) : (cokernelCocone f).pt ⟶ s.pt := NormedAddGroupHom.lift _ s.π (by rintro _ ⟨b, rfl⟩ change (f ≫ s.π) b = 0 simp -- This used to be the end of the proof before leanprover/lean4#2644 erw [zero_apply]) /-- Auxiliary definition for `HasCokernels SemiNormedGrp`. -/ noncomputable def isColimitCokernelCocone {X Y : SemiNormedGrp.{u}} (f : X ⟶ Y) : IsColimit (cokernelCocone f) := isColimitAux _ (cokernelLift f) (fun s => by ext apply NormedAddGroupHom.lift_mk f.range rintro _ ⟨b, rfl⟩ change (f ≫ s.π) b = 0 simp -- This used to be the end of the proof before leanprover/lean4#2644 erw [zero_apply]) fun s m w => NormedAddGroupHom.lift_unique f.range _ _ _ w instance : HasCokernels SemiNormedGrp.{u} where has_colimit f := HasColimit.mk { cocone := cokernelCocone f isColimit := isColimitCokernelCocone f } -- Sanity check example : HasCokernels SemiNormedGrp := by infer_instance section ExplicitCokernel /-- An explicit choice of cokernel, which has good properties with respect to the norm. -/ noncomputable def explicitCokernel {X Y : SemiNormedGrp.{u}} (f : X ⟶ Y) : SemiNormedGrp.{u} := (cokernelCocone f).pt /-- Descend to the explicit cokernel. -/ noncomputable def explicitCokernelDesc {X Y Z : SemiNormedGrp.{u}} {f : X ⟶ Y} {g : Y ⟶ Z} (w : f ≫ g = 0) : explicitCokernel f ⟶ Z := (isColimitCokernelCocone f).desc (Cofork.ofπ g (by simp [w])) /-- The projection from `Y` to the explicit cokernel of `X ⟶ Y`. -/ noncomputable def explicitCokernelπ {X Y : SemiNormedGrp.{u}} (f : X ⟶ Y) : Y ⟶ explicitCokernel f := (cokernelCocone f).ι.app WalkingParallelPair.one theorem explicitCokernelπ_surjective {X Y : SemiNormedGrp.{u}} {f : X ⟶ Y} : Function.Surjective (explicitCokernelπ f) := surjective_quot_mk _ @[simp, reassoc] theorem comp_explicitCokernelπ {X Y : SemiNormedGrp.{u}} (f : X ⟶ Y) : f ≫ explicitCokernelπ f = 0 := by convert (cokernelCocone f).w WalkingParallelPairHom.left simp -- Porting note: wasn't necessary in Lean 3. Is this a bug? attribute [simp] comp_explicitCokernelπ_assoc @[simp] theorem explicitCokernelπ_apply_dom_eq_zero {X Y : SemiNormedGrp.{u}} {f : X ⟶ Y} (x : X) : (explicitCokernelπ f) (f x) = 0 := show (f ≫ explicitCokernelπ f) x = 0 by rw [comp_explicitCokernelπ]; rfl @[simp, reassoc] theorem explicitCokernelπ_desc {X Y Z : SemiNormedGrp.{u}} {f : X ⟶ Y} {g : Y ⟶ Z} (w : f ≫ g = 0) : explicitCokernelπ f ≫ explicitCokernelDesc w = g := (isColimitCokernelCocone f).fac _ _ @[simp] theorem explicitCokernelπ_desc_apply {X Y Z : SemiNormedGrp.{u}} {f : X ⟶ Y} {g : Y ⟶ Z} {cond : f ≫ g = 0} (x : Y) : explicitCokernelDesc cond (explicitCokernelπ f x) = g x := show (explicitCokernelπ f ≫ explicitCokernelDesc cond) x = g x by rw [explicitCokernelπ_desc] theorem explicitCokernelDesc_unique {X Y Z : SemiNormedGrp.{u}} {f : X ⟶ Y} {g : Y ⟶ Z} (w : f ≫ g = 0) (e : explicitCokernel f ⟶ Z) (he : explicitCokernelπ f ≫ e = g) : e = explicitCokernelDesc w := by apply (isColimitCokernelCocone f).uniq (Cofork.ofπ g (by simp [w])) rintro (_ | _) · convert w.symm simp · exact he theorem explicitCokernelDesc_comp_eq_desc {X Y Z W : SemiNormedGrp.{u}} {f : X ⟶ Y} {g : Y ⟶ Z} -- Porting note: renamed `cond` to `cond'` to avoid -- failed to rewrite using equation theorems for 'cond' {h : Z ⟶ W} {cond' : f ≫ g = 0} : explicitCokernelDesc cond' ≫ h = explicitCokernelDesc (show f ≫ g ≫ h = 0 by rw [← CategoryTheory.Category.assoc, cond', Limits.zero_comp]) := by refine explicitCokernelDesc_unique _ _ ?_ rw [← CategoryTheory.Category.assoc, explicitCokernelπ_desc] @[simp] theorem explicitCokernelDesc_zero {X Y Z : SemiNormedGrp.{u}} {f : X ⟶ Y} : explicitCokernelDesc (show f ≫ (0 : Y ⟶ Z) = 0 from CategoryTheory.Limits.comp_zero) = 0 := Eq.symm <| explicitCokernelDesc_unique _ _ CategoryTheory.Limits.comp_zero @[ext] theorem explicitCokernel_hom_ext {X Y Z : SemiNormedGrp.{u}} {f : X ⟶ Y} (e₁ e₂ : explicitCokernel f ⟶ Z) (h : explicitCokernelπ f ≫ e₁ = explicitCokernelπ f ≫ e₂) : e₁ = e₂ := by let g : Y ⟶ Z := explicitCokernelπ f ≫ e₂ have w : f ≫ g = 0 := by simp [g] have : e₂ = explicitCokernelDesc w := by apply explicitCokernelDesc_unique; rfl rw [this] apply explicitCokernelDesc_unique exact h instance explicitCokernelπ.epi {X Y : SemiNormedGrp.{u}} {f : X ⟶ Y} : Epi (explicitCokernelπ f) := by constructor intro Z g h H ext x -- Porting note: no longer needed -- obtain ⟨x, hx⟩ := explicitCokernelπ_surjective (explicitCokernelπ f x) -- change (explicitCokernelπ f ≫ g) _ = _ rw [H] theorem isQuotient_explicitCokernelπ {X Y : SemiNormedGrp.{u}} (f : X ⟶ Y) : NormedAddGroupHom.IsQuotient (explicitCokernelπ f) := NormedAddGroupHom.isQuotientQuotient _ theorem normNoninc_explicitCokernelπ {X Y : SemiNormedGrp.{u}} (f : X ⟶ Y) : (explicitCokernelπ f).NormNoninc := (isQuotient_explicitCokernelπ f).norm_le open scoped NNReal theorem explicitCokernelDesc_norm_le_of_norm_le {X Y Z : SemiNormedGrp.{u}} {f : X ⟶ Y} {g : Y ⟶ Z} (w : f ≫ g = 0) (c : ℝ≥0) (h : ‖g‖ ≤ c) : ‖explicitCokernelDesc w‖ ≤ c := NormedAddGroupHom.lift_norm_le _ _ _ h theorem explicitCokernelDesc_normNoninc {X Y Z : SemiNormedGrp.{u}} {f : X ⟶ Y} {g : Y ⟶ Z} {cond : f ≫ g = 0} (hg : g.NormNoninc) : (explicitCokernelDesc cond).NormNoninc := by refine NormedAddGroupHom.NormNoninc.normNoninc_iff_norm_le_one.2 ?_ rw [← NNReal.coe_one] exact explicitCokernelDesc_norm_le_of_norm_le cond 1 (NormedAddGroupHom.NormNoninc.normNoninc_iff_norm_le_one.1 hg) theorem explicitCokernelDesc_comp_eq_zero {X Y Z W : SemiNormedGrp.{u}} {f : X ⟶ Y} {g : Y ⟶ Z} {h : Z ⟶ W} (cond : f ≫ g = 0) (cond2 : g ≫ h = 0) : explicitCokernelDesc cond ≫ h = 0 := by rw [← cancel_epi (explicitCokernelπ f), ← Category.assoc, explicitCokernelπ_desc] simp [cond2] theorem explicitCokernelDesc_norm_le {X Y Z : SemiNormedGrp.{u}} {f : X ⟶ Y} {g : Y ⟶ Z} (w : f ≫ g = 0) : ‖explicitCokernelDesc w‖ ≤ ‖g‖ := explicitCokernelDesc_norm_le_of_norm_le w ‖g‖₊ le_rfl /-- The explicit cokernel is isomorphic to the usual cokernel. -/ noncomputable def explicitCokernelIso {X Y : SemiNormedGrp.{u}} (f : X ⟶ Y) : explicitCokernel f ≅ cokernel f := (isColimitCokernelCocone f).coconePointUniqueUpToIso (colimit.isColimit _) @[simp] theorem explicitCokernelIso_hom_π {X Y : SemiNormedGrp.{u}} (f : X ⟶ Y) : explicitCokernelπ f ≫ (explicitCokernelIso f).hom = cokernel.π _ := by simp [explicitCokernelπ, explicitCokernelIso, IsColimit.coconePointUniqueUpToIso] @[simp] theorem explicitCokernelIso_inv_π {X Y : SemiNormedGrp.{u}} (f : X ⟶ Y) : cokernel.π f ≫ (explicitCokernelIso f).inv = explicitCokernelπ f := by simp [explicitCokernelπ, explicitCokernelIso] @[simp] theorem explicitCokernelIso_hom_desc {X Y Z : SemiNormedGrp.{u}} {f : X ⟶ Y} {g : Y ⟶ Z} (w : f ≫ g = 0) : (explicitCokernelIso f).hom ≫ cokernel.desc f g w = explicitCokernelDesc w := by ext1 simp [explicitCokernelDesc, explicitCokernelπ, explicitCokernelIso, IsColimit.coconePointUniqueUpToIso] /-- A special case of `CategoryTheory.Limits.cokernel.map` adapted to `explicitCokernel`. -/ noncomputable def explicitCokernel.map {A B C D : SemiNormedGrp.{u}} {fab : A ⟶ B} {fbd : B ⟶ D} {fac : A ⟶ C} {fcd : C ⟶ D} (h : fab ≫ fbd = fac ≫ fcd) : explicitCokernel fab ⟶ explicitCokernel fcd := @explicitCokernelDesc _ _ _ fab (fbd ≫ explicitCokernelπ _) <| by simp [reassoc_of% h] /-- A special case of `CategoryTheory.Limits.cokernel.map_desc` adapted to `explicitCokernel`. -/ theorem ExplicitCoker.map_desc {A B C D B' D' : SemiNormedGrp.{u}} {fab : A ⟶ B} {fbd : B ⟶ D} {fac : A ⟶ C} {fcd : C ⟶ D} {h : fab ≫ fbd = fac ≫ fcd} {fbb' : B ⟶ B'} {fdd' : D ⟶ D'} {condb : fab ≫ fbb' = 0} {condd : fcd ≫ fdd' = 0} {g : B' ⟶ D'} (h' : fbb' ≫ g = fbd ≫ fdd') : explicitCokernelDesc condb ≫ g = explicitCokernel.map h ≫ explicitCokernelDesc condd := by delta explicitCokernel.map simp [← cancel_epi (explicitCokernelπ fab), ← Category.assoc, Category.assoc, explicitCokernelπ_desc, h'] end ExplicitCokernel end Cokernel end SemiNormedGrp
Analysis\Normed\Lp\LpEquiv.lean
/- Copyright (c) 2022 Jireh Loreaux. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Jireh Loreaux -/ import Mathlib.Analysis.Normed.Lp.lpSpace import Mathlib.Analysis.Normed.Lp.PiLp import Mathlib.Topology.ContinuousFunction.Bounded /-! # Equivalences among $L^p$ spaces In this file we collect a variety of equivalences among various $L^p$ spaces. In particular, when `α` is a `Fintype`, given `E : α → Type u` and `p : ℝ≥0∞`, there is a natural linear isometric equivalence `lpPiLpₗᵢₓ : lp E p ≃ₗᵢ PiLp p E`. In addition, when `α` is a discrete topological space, the bounded continuous functions `α →ᵇ β` correspond exactly to `lp (fun _ ↦ β) ∞`. Here there can be more structure, including ring and algebra structures, and we implement these equivalences accordingly as well. We keep this as a separate file so that the various $L^p$ space files don't import the others. Recall that `PiLp` is just a type synonym for `Π i, E i` but given a different metric and norm structure, although the topological, uniform and bornological structures coincide definitionally. These structures are only defined on `PiLp` for `Fintype α`, so there are no issues of convergence to consider. While `PreLp` is also a type synonym for `Π i, E i`, it allows for infinite index types. On this type there is a predicate `Memℓp` which says that the relevant `p`-norm is finite and `lp E p` is the subtype of `PreLp` satisfying `Memℓp`. ## TODO * Equivalence between `lp` and `MeasureTheory.Lp`, for `f : α → E` (i.e., functions rather than pi-types) and the counting measure on `α` -/ open scoped ENNReal section LpPiLp variable {α : Type*} {E : α → Type*} [∀ i, NormedAddCommGroup (E i)] {p : ℝ≥0∞} section Finite variable [Finite α] /-- When `α` is `Finite`, every `f : PreLp E p` satisfies `Memℓp f p`. -/ theorem Memℓp.all (f : ∀ i, E i) : Memℓp f p := by rcases p.trichotomy with (rfl | rfl | _h) · exact memℓp_zero_iff.mpr { i : α | f i ≠ 0 }.toFinite · exact memℓp_infty_iff.mpr (Set.Finite.bddAbove (Set.range fun i : α ↦ ‖f i‖).toFinite) · cases nonempty_fintype α; exact memℓp_gen ⟨Finset.univ.sum _, hasSum_fintype _⟩ /-- The canonical `Equiv` between `lp E p ≃ PiLp p E` when `E : α → Type u` with `[Finite α]`. -/ def Equiv.lpPiLp : lp E p ≃ PiLp p E where toFun f := ⇑f invFun f := ⟨f, Memℓp.all f⟩ left_inv _f := rfl right_inv _f := rfl theorem coe_equiv_lpPiLp (f : lp E p) : Equiv.lpPiLp f = ⇑f := rfl theorem coe_equiv_lpPiLp_symm (f : PiLp p E) : (Equiv.lpPiLp.symm f : ∀ i, E i) = f := rfl /-- The canonical `AddEquiv` between `lp E p` and `PiLp p E` when `E : α → Type u` with `[Fintype α]`. -/ def AddEquiv.lpPiLp : lp E p ≃+ PiLp p E := { Equiv.lpPiLp with map_add' := fun _f _g ↦ rfl } theorem coe_addEquiv_lpPiLp (f : lp E p) : AddEquiv.lpPiLp f = ⇑f := rfl theorem coe_addEquiv_lpPiLp_symm (f : PiLp p E) : (AddEquiv.lpPiLp.symm f : ∀ i, E i) = f := rfl end Finite theorem equiv_lpPiLp_norm [Fintype α] (f : lp E p) : ‖Equiv.lpPiLp f‖ = ‖f‖ := by rcases p.trichotomy with (rfl | rfl | h) · simp [Equiv.lpPiLp, PiLp.norm_eq_card, lp.norm_eq_card_dsupport] · rw [PiLp.norm_eq_ciSup, lp.norm_eq_ciSup]; rfl · rw [PiLp.norm_eq_sum h, lp.norm_eq_tsum_rpow h, tsum_fintype]; rfl section Equivₗᵢ variable [Fintype α] (𝕜 : Type*) [NontriviallyNormedField 𝕜] [∀ i, NormedSpace 𝕜 (E i)] variable (E) /- porting note: Lean is unable to work with `lpPiLpₗᵢ` if `E` is implicit without annotating with `(E := E)` everywhere, so we just make it explicit. This file has no dependencies. -/ /-- The canonical `LinearIsometryEquiv` between `lp E p` and `PiLp p E` when `E : α → Type u` with `[Fintype α]` and `[Fact (1 ≤ p)]`. -/ noncomputable def lpPiLpₗᵢ [Fact (1 ≤ p)] : lp E p ≃ₗᵢ[𝕜] PiLp p E := { AddEquiv.lpPiLp with map_smul' := fun _k _f ↦ rfl norm_map' := equiv_lpPiLp_norm } variable {𝕜 E} theorem coe_lpPiLpₗᵢ [Fact (1 ≤ p)] (f : lp E p) : (lpPiLpₗᵢ E 𝕜 f : ∀ i, E i) = ⇑f := rfl theorem coe_lpPiLpₗᵢ_symm [Fact (1 ≤ p)] (f : PiLp p E) : ((lpPiLpₗᵢ E 𝕜).symm f : ∀ i, E i) = f := rfl end Equivₗᵢ end LpPiLp section LpBCF open scoped BoundedContinuousFunction open BoundedContinuousFunction -- note: `R` and `A` are explicit because otherwise Lean has elaboration problems variable {α E : Type*} (R A 𝕜 : Type*) [TopologicalSpace α] [DiscreteTopology α] variable [NormedRing A] [NormOneClass A] [NontriviallyNormedField 𝕜] [NormedAlgebra 𝕜 A] variable [NormedAddCommGroup E] [NormedSpace 𝕜 E] [NonUnitalNormedRing R] section NormedAddCommGroup /-- The canonical map between `lp (fun _ : α ↦ E) ∞` and `α →ᵇ E` as an `AddEquiv`. -/ noncomputable def AddEquiv.lpBCF : lp (fun _ : α ↦ E) ∞ ≃+ (α →ᵇ E) where toFun f := ofNormedAddCommGroupDiscrete f ‖f‖ <| le_ciSup (memℓp_infty_iff.mp f.prop) invFun f := ⟨⇑f, f.bddAbove_range_norm_comp⟩ left_inv _f := lp.ext rfl right_inv _f := rfl map_add' _f _g := rfl @[deprecated (since := "2024-03-16")] alias AddEquiv.lpBcf := AddEquiv.lpBCF theorem coe_addEquiv_lpBCF (f : lp (fun _ : α ↦ E) ∞) : (AddEquiv.lpBCF f : α → E) = f := rfl theorem coe_addEquiv_lpBCF_symm (f : α →ᵇ E) : (AddEquiv.lpBCF.symm f : α → E) = f := rfl variable (E) /- porting note: Lean is unable to work with `lpPiLpₗᵢ` if `E` is implicit without annotating with `(E := E)` everywhere, so we just make it explicit. This file has no dependencies. -/ /-- The canonical map between `lp (fun _ : α ↦ E) ∞` and `α →ᵇ E` as a `LinearIsometryEquiv`. -/ noncomputable def lpBCFₗᵢ : lp (fun _ : α ↦ E) ∞ ≃ₗᵢ[𝕜] α →ᵇ E := { AddEquiv.lpBCF with map_smul' := fun k f ↦ rfl norm_map' := fun f ↦ by simp only [norm_eq_iSup_norm, lp.norm_eq_ciSup]; rfl } @[deprecated (since := "2024-03-16")] alias lpBcfₗᵢ := lpBCFₗᵢ variable {𝕜 E} theorem coe_lpBCFₗᵢ (f : lp (fun _ : α ↦ E) ∞) : (lpBCFₗᵢ E 𝕜 f : α → E) = f := rfl theorem coe_lpBCFₗᵢ_symm (f : α →ᵇ E) : ((lpBCFₗᵢ E 𝕜).symm f : α → E) = f := rfl end NormedAddCommGroup section RingAlgebra /-- The canonical map between `lp (fun _ : α ↦ R) ∞` and `α →ᵇ R` as a `RingEquiv`. -/ noncomputable def RingEquiv.lpBCF : lp (fun _ : α ↦ R) ∞ ≃+* (α →ᵇ R) := { @AddEquiv.lpBCF _ R _ _ _ with map_mul' := fun _f _g => rfl } @[deprecated (since := "2024-03-16")] alias RingEquiv.lpBcf := RingEquiv.lpBCF variable {R} theorem coe_ringEquiv_lpBCF (f : lp (fun _ : α ↦ R) ∞) : (RingEquiv.lpBCF R f : α → R) = f := rfl theorem coe_ringEquiv_lpBCF_symm (f : α →ᵇ R) : ((RingEquiv.lpBCF R).symm f : α → R) = f := rfl variable (α) -- even `α` needs to be explicit here for elaboration -- the `NormOneClass A` shouldn't really be necessary, but currently it is for -- `one_memℓp_infty` to get the `Ring` instance on `lp`. /-- The canonical map between `lp (fun _ : α ↦ A) ∞` and `α →ᵇ A` as an `AlgEquiv`. -/ noncomputable def AlgEquiv.lpBCF : lp (fun _ : α ↦ A) ∞ ≃ₐ[𝕜] α →ᵇ A := { RingEquiv.lpBCF A with commutes' := fun _k ↦ rfl } @[deprecated (since := "2024-03-16")] alias AlgEquiv.lpBcf := AlgEquiv.lpBCF variable {α A 𝕜} theorem coe_algEquiv_lpBCF (f : lp (fun _ : α ↦ A) ∞) : (AlgEquiv.lpBCF α A 𝕜 f : α → A) = f := rfl theorem coe_algEquiv_lpBCF_symm (f : α →ᵇ A) : ((AlgEquiv.lpBCF α A 𝕜).symm f : α → A) = f := rfl end RingAlgebra end LpBCF
Analysis\Normed\Lp\lpSpace.lean
/- Copyright (c) 2021 Heather Macbeth. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Heather Macbeth -/ import Mathlib.Analysis.MeanInequalities import Mathlib.Analysis.MeanInequalitiesPow import Mathlib.Analysis.SpecialFunctions.Pow.Continuity import Mathlib.Data.Set.Image import Mathlib.Topology.Algebra.Order.LiminfLimsup /-! # ℓp space This file describes properties of elements `f` of a pi-type `∀ i, E i` with finite "norm", defined for `p : ℝ≥0∞` as the size of the support of `f` if `p=0`, `(∑' a, ‖f a‖^p) ^ (1/p)` for `0 < p < ∞` and `⨆ a, ‖f a‖` for `p=∞`. The Prop-valued `Memℓp f p` states that a function `f : ∀ i, E i` has finite norm according to the above definition; that is, `f` has finite support if `p = 0`, `Summable (fun a ↦ ‖f a‖^p)` if `0 < p < ∞`, and `BddAbove (norm '' (Set.range f))` if `p = ∞`. The space `lp E p` is the subtype of elements of `∀ i : α, E i` which satisfy `Memℓp f p`. For `1 ≤ p`, the "norm" is genuinely a norm and `lp` is a complete metric space. ## Main definitions * `Memℓp f p` : property that the function `f` satisfies, as appropriate, `f` finitely supported if `p = 0`, `Summable (fun a ↦ ‖f a‖^p)` if `0 < p < ∞`, and `BddAbove (norm '' (Set.range f))` if `p = ∞`. * `lp E p` : elements of `∀ i : α, E i` such that `Memℓp f p`. Defined as an `AddSubgroup` of a type synonym `PreLp` for `∀ i : α, E i`, and equipped with a `NormedAddCommGroup` structure. Under appropriate conditions, this is also equipped with the instances `lp.normedSpace`, `lp.completeSpace`. For `p=∞`, there is also `lp.inftyNormedRing`, `lp.inftyNormedAlgebra`, `lp.inftyStarRing` and `lp.inftyCStarRing`. ## Main results * `Memℓp.of_exponent_ge`: For `q ≤ p`, a function which is `Memℓp` for `q` is also `Memℓp` for `p`. * `lp.memℓp_of_tendsto`, `lp.norm_le_of_tendsto`: A pointwise limit of functions in `lp`, all with `lp` norm `≤ C`, is itself in `lp` and has `lp` norm `≤ C`. * `lp.tsum_mul_le_mul_norm`: basic form of Hölder's inequality ## Implementation Since `lp` is defined as an `AddSubgroup`, dot notation does not work. Use `lp.norm_neg f` to say that `‖-f‖ = ‖f‖`, instead of the non-working `f.norm_neg`. ## TODO * More versions of Hölder's inequality (for example: the case `p = 1`, `q = ∞`; a version for normed rings which has `‖∑' i, f i * g i‖` rather than `∑' i, ‖f i‖ * g i‖` on the RHS; a version for three exponents satisfying `1 / r = 1 / p + 1 / q`) -/ noncomputable section open scoped NNReal ENNReal Function variable {α : Type*} {E : α → Type*} {p q : ℝ≥0∞} [∀ i, NormedAddCommGroup (E i)] /-! ### `Memℓp` predicate -/ /-- The property that `f : ∀ i : α, E i` * is finitely supported, if `p = 0`, or * admits an upper bound for `Set.range (fun i ↦ ‖f i‖)`, if `p = ∞`, or * has the series `∑' i, ‖f i‖ ^ p` be summable, if `0 < p < ∞`. -/ def Memℓp (f : ∀ i, E i) (p : ℝ≥0∞) : Prop := if p = 0 then Set.Finite { i | f i ≠ 0 } else if p = ∞ then BddAbove (Set.range fun i => ‖f i‖) else Summable fun i => ‖f i‖ ^ p.toReal theorem memℓp_zero_iff {f : ∀ i, E i} : Memℓp f 0 ↔ Set.Finite { i | f i ≠ 0 } := by dsimp [Memℓp] rw [if_pos rfl] theorem memℓp_zero {f : ∀ i, E i} (hf : Set.Finite { i | f i ≠ 0 }) : Memℓp f 0 := memℓp_zero_iff.2 hf theorem memℓp_infty_iff {f : ∀ i, E i} : Memℓp f ∞ ↔ BddAbove (Set.range fun i => ‖f i‖) := by simp [Memℓp] theorem memℓp_infty {f : ∀ i, E i} (hf : BddAbove (Set.range fun i => ‖f i‖)) : Memℓp f ∞ := memℓp_infty_iff.2 hf theorem memℓp_gen_iff (hp : 0 < p.toReal) {f : ∀ i, E i} : Memℓp f p ↔ Summable fun i => ‖f i‖ ^ p.toReal := by rw [ENNReal.toReal_pos_iff] at hp dsimp [Memℓp] rw [if_neg hp.1.ne', if_neg hp.2.ne] theorem memℓp_gen {f : ∀ i, E i} (hf : Summable fun i => ‖f i‖ ^ p.toReal) : Memℓp f p := by rcases p.trichotomy with (rfl | rfl | hp) · apply memℓp_zero have H : Summable fun _ : α => (1 : ℝ) := by simpa using hf exact (Set.Finite.of_summable_const (by norm_num) H).subset (Set.subset_univ _) · apply memℓp_infty have H : Summable fun _ : α => (1 : ℝ) := by simpa using hf simpa using ((Set.Finite.of_summable_const (by norm_num) H).image fun i => ‖f i‖).bddAbove exact (memℓp_gen_iff hp).2 hf theorem memℓp_gen' {C : ℝ} {f : ∀ i, E i} (hf : ∀ s : Finset α, ∑ i ∈ s, ‖f i‖ ^ p.toReal ≤ C) : Memℓp f p := by apply memℓp_gen use ⨆ s : Finset α, ∑ i ∈ s, ‖f i‖ ^ p.toReal apply hasSum_of_isLUB_of_nonneg · intro b exact Real.rpow_nonneg (norm_nonneg _) _ apply isLUB_ciSup use C rintro - ⟨s, rfl⟩ exact hf s theorem zero_memℓp : Memℓp (0 : ∀ i, E i) p := by rcases p.trichotomy with (rfl | rfl | hp) · apply memℓp_zero simp · apply memℓp_infty simp only [norm_zero, Pi.zero_apply] exact bddAbove_singleton.mono Set.range_const_subset · apply memℓp_gen simp [Real.zero_rpow hp.ne', summable_zero] theorem zero_mem_ℓp' : Memℓp (fun i : α => (0 : E i)) p := zero_memℓp namespace Memℓp theorem finite_dsupport {f : ∀ i, E i} (hf : Memℓp f 0) : Set.Finite { i | f i ≠ 0 } := memℓp_zero_iff.1 hf theorem bddAbove {f : ∀ i, E i} (hf : Memℓp f ∞) : BddAbove (Set.range fun i => ‖f i‖) := memℓp_infty_iff.1 hf theorem summable (hp : 0 < p.toReal) {f : ∀ i, E i} (hf : Memℓp f p) : Summable fun i => ‖f i‖ ^ p.toReal := (memℓp_gen_iff hp).1 hf theorem neg {f : ∀ i, E i} (hf : Memℓp f p) : Memℓp (-f) p := by rcases p.trichotomy with (rfl | rfl | hp) · apply memℓp_zero simp [hf.finite_dsupport] · apply memℓp_infty simpa using hf.bddAbove · apply memℓp_gen simpa using hf.summable hp @[simp] theorem neg_iff {f : ∀ i, E i} : Memℓp (-f) p ↔ Memℓp f p := ⟨fun h => neg_neg f ▸ h.neg, Memℓp.neg⟩ theorem of_exponent_ge {p q : ℝ≥0∞} {f : ∀ i, E i} (hfq : Memℓp f q) (hpq : q ≤ p) : Memℓp f p := by rcases ENNReal.trichotomy₂ hpq with (⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ | ⟨rfl, hp⟩ | ⟨rfl, rfl⟩ | ⟨hq, rfl⟩ | ⟨hq, _, hpq'⟩) · exact hfq · apply memℓp_infty obtain ⟨C, hC⟩ := (hfq.finite_dsupport.image fun i => ‖f i‖).bddAbove use max 0 C rintro x ⟨i, rfl⟩ by_cases hi : f i = 0 · simp [hi] · exact (hC ⟨i, hi, rfl⟩).trans (le_max_right _ _) · apply memℓp_gen have : ∀ i ∉ hfq.finite_dsupport.toFinset, ‖f i‖ ^ p.toReal = 0 := by intro i hi have : f i = 0 := by simpa using hi simp [this, Real.zero_rpow hp.ne'] exact summable_of_ne_finset_zero this · exact hfq · apply memℓp_infty obtain ⟨A, hA⟩ := (hfq.summable hq).tendsto_cofinite_zero.bddAbove_range_of_cofinite use A ^ q.toReal⁻¹ rintro x ⟨i, rfl⟩ have : 0 ≤ ‖f i‖ ^ q.toReal := by positivity simpa [← Real.rpow_mul, mul_inv_cancel hq.ne'] using Real.rpow_le_rpow this (hA ⟨i, rfl⟩) (inv_nonneg.mpr hq.le) · apply memℓp_gen have hf' := hfq.summable hq refine .of_norm_bounded_eventually _ hf' (@Set.Finite.subset _ { i | 1 ≤ ‖f i‖ } ?_ _ ?_) · have H : { x : α | 1 ≤ ‖f x‖ ^ q.toReal }.Finite := by simpa using eventually_lt_of_tendsto_lt (by norm_num) hf'.tendsto_cofinite_zero exact H.subset fun i hi => Real.one_le_rpow hi hq.le · show ∀ i, ¬|‖f i‖ ^ p.toReal| ≤ ‖f i‖ ^ q.toReal → 1 ≤ ‖f i‖ intro i hi have : 0 ≤ ‖f i‖ ^ p.toReal := Real.rpow_nonneg (norm_nonneg _) p.toReal simp only [abs_of_nonneg, this] at hi contrapose! hi exact Real.rpow_le_rpow_of_exponent_ge' (norm_nonneg _) hi.le hq.le hpq' theorem add {f g : ∀ i, E i} (hf : Memℓp f p) (hg : Memℓp g p) : Memℓp (f + g) p := by rcases p.trichotomy with (rfl | rfl | hp) · apply memℓp_zero refine (hf.finite_dsupport.union hg.finite_dsupport).subset fun i => ?_ simp only [Pi.add_apply, Ne, Set.mem_union, Set.mem_setOf_eq] contrapose! rintro ⟨hf', hg'⟩ simp [hf', hg'] · apply memℓp_infty obtain ⟨A, hA⟩ := hf.bddAbove obtain ⟨B, hB⟩ := hg.bddAbove refine ⟨A + B, ?_⟩ rintro a ⟨i, rfl⟩ exact le_trans (norm_add_le _ _) (add_le_add (hA ⟨i, rfl⟩) (hB ⟨i, rfl⟩)) apply memℓp_gen let C : ℝ := if p.toReal < 1 then 1 else (2 : ℝ) ^ (p.toReal - 1) refine .of_nonneg_of_le ?_ (fun i => ?_) (((hf.summable hp).add (hg.summable hp)).mul_left C) · intro; positivity · refine (Real.rpow_le_rpow (norm_nonneg _) (norm_add_le _ _) hp.le).trans ?_ dsimp only [C] split_ifs with h · simpa using NNReal.coe_le_coe.2 (NNReal.rpow_add_le_add_rpow ‖f i‖₊ ‖g i‖₊ hp.le h.le) · let F : Fin 2 → ℝ≥0 := ![‖f i‖₊, ‖g i‖₊] simp only [not_lt] at h simpa [Fin.sum_univ_succ] using Real.rpow_sum_le_const_mul_sum_rpow_of_nonneg Finset.univ h fun i _ => (F i).coe_nonneg theorem sub {f g : ∀ i, E i} (hf : Memℓp f p) (hg : Memℓp g p) : Memℓp (f - g) p := by rw [sub_eq_add_neg]; exact hf.add hg.neg theorem finset_sum {ι} (s : Finset ι) {f : ι → ∀ i, E i} (hf : ∀ i ∈ s, Memℓp (f i) p) : Memℓp (fun a => ∑ i ∈ s, f i a) p := by haveI : DecidableEq ι := Classical.decEq _ revert hf refine Finset.induction_on s ?_ ?_ · simp only [zero_mem_ℓp', Finset.sum_empty, imp_true_iff] · intro i s his ih hf simp only [his, Finset.sum_insert, not_false_iff] exact (hf i (s.mem_insert_self i)).add (ih fun j hj => hf j (Finset.mem_insert_of_mem hj)) section BoundedSMul variable {𝕜 : Type*} [NormedRing 𝕜] [∀ i, Module 𝕜 (E i)] [∀ i, BoundedSMul 𝕜 (E i)] theorem const_smul {f : ∀ i, E i} (hf : Memℓp f p) (c : 𝕜) : Memℓp (c • f) p := by rcases p.trichotomy with (rfl | rfl | hp) · apply memℓp_zero refine hf.finite_dsupport.subset fun i => (?_ : ¬c • f i = 0 → ¬f i = 0) exact not_imp_not.mpr fun hf' => hf'.symm ▸ smul_zero c · obtain ⟨A, hA⟩ := hf.bddAbove refine memℓp_infty ⟨‖c‖ * A, ?_⟩ rintro a ⟨i, rfl⟩ dsimp only [Pi.smul_apply] refine (norm_smul_le _ _).trans ?_ gcongr exact hA ⟨i, rfl⟩ · apply memℓp_gen dsimp only [Pi.smul_apply] have := (hf.summable hp).mul_left (↑(‖c‖₊ ^ p.toReal) : ℝ) simp_rw [← coe_nnnorm, ← NNReal.coe_rpow, ← NNReal.coe_mul, NNReal.summable_coe, ← NNReal.mul_rpow] at this ⊢ refine NNReal.summable_of_le ?_ this intro i gcongr apply nnnorm_smul_le theorem const_mul {f : α → 𝕜} (hf : Memℓp f p) (c : 𝕜) : Memℓp (fun x => c * f x) p := @Memℓp.const_smul α (fun _ => 𝕜) _ _ 𝕜 _ _ (fun i => by infer_instance) _ hf c end BoundedSMul end Memℓp /-! ### lp space The space of elements of `∀ i, E i` satisfying the predicate `Memℓp`. -/ /-- We define `PreLp E` to be a type synonym for `∀ i, E i` which, importantly, does not inherit the `pi` topology on `∀ i, E i` (otherwise this topology would descend to `lp E p` and conflict with the normed group topology we will later equip it with.) We choose to deal with this issue by making a type synonym for `∀ i, E i` rather than for the `lp` subgroup itself, because this allows all the spaces `lp E p` (for varying `p`) to be subgroups of the same ambient group, which permits lemma statements like `lp.monotone` (below). -/ @[nolint unusedArguments] def PreLp (E : α → Type*) [∀ i, NormedAddCommGroup (E i)] : Type _ := ∀ i, E i --deriving AddCommGroup instance : AddCommGroup (PreLp E) := by unfold PreLp; infer_instance instance PreLp.unique [IsEmpty α] : Unique (PreLp E) := Pi.uniqueOfIsEmpty E /-- lp space -/ def lp (E : α → Type*) [∀ i, NormedAddCommGroup (E i)] (p : ℝ≥0∞) : AddSubgroup (PreLp E) where carrier := { f | Memℓp f p } zero_mem' := zero_memℓp add_mem' := Memℓp.add neg_mem' := Memℓp.neg @[inherit_doc] scoped[lp] notation "ℓ^∞(" ι ", " E ")" => lp (fun i : ι => E) ∞ @[inherit_doc] scoped[lp] notation "ℓ^∞(" ι ")" => lp (fun i : ι => ℝ) ∞ namespace lp -- Porting note: was `Coe` instance : CoeOut (lp E p) (∀ i, E i) := ⟨Subtype.val (α := ∀ i, E i)⟩ -- Porting note: Originally `coeSubtype` instance coeFun : CoeFun (lp E p) fun _ => ∀ i, E i := ⟨fun f => (f : ∀ i, E i)⟩ @[ext] theorem ext {f g : lp E p} (h : (f : ∀ i, E i) = g) : f = g := Subtype.ext h theorem eq_zero' [IsEmpty α] (f : lp E p) : f = 0 := Subsingleton.elim f 0 protected theorem monotone {p q : ℝ≥0∞} (hpq : q ≤ p) : lp E q ≤ lp E p := fun _ hf => Memℓp.of_exponent_ge hf hpq protected theorem memℓp (f : lp E p) : Memℓp f p := f.prop variable (E p) @[simp] theorem coeFn_zero : ⇑(0 : lp E p) = 0 := rfl variable {E p} @[simp] theorem coeFn_neg (f : lp E p) : ⇑(-f) = -f := rfl @[simp] theorem coeFn_add (f g : lp E p) : ⇑(f + g) = f + g := rfl -- porting note (#10618): removed `@[simp]` because `simp` can prove this theorem coeFn_sum {ι : Type*} (f : ι → lp E p) (s : Finset ι) : ⇑(∑ i ∈ s, f i) = ∑ i ∈ s, ⇑(f i) := by simp @[simp] theorem coeFn_sub (f g : lp E p) : ⇑(f - g) = f - g := rfl instance : Norm (lp E p) where norm f := if hp : p = 0 then by subst hp exact ((lp.memℓp f).finite_dsupport.toFinset.card : ℝ) else if p = ∞ then ⨆ i, ‖f i‖ else (∑' i, ‖f i‖ ^ p.toReal) ^ (1 / p.toReal) theorem norm_eq_card_dsupport (f : lp E 0) : ‖f‖ = (lp.memℓp f).finite_dsupport.toFinset.card := dif_pos rfl theorem norm_eq_ciSup (f : lp E ∞) : ‖f‖ = ⨆ i, ‖f i‖ := rfl theorem isLUB_norm [Nonempty α] (f : lp E ∞) : IsLUB (Set.range fun i => ‖f i‖) ‖f‖ := by rw [lp.norm_eq_ciSup] exact isLUB_ciSup (lp.memℓp f) theorem norm_eq_tsum_rpow (hp : 0 < p.toReal) (f : lp E p) : ‖f‖ = (∑' i, ‖f i‖ ^ p.toReal) ^ (1 / p.toReal) := by dsimp [norm] rw [ENNReal.toReal_pos_iff] at hp rw [dif_neg hp.1.ne', if_neg hp.2.ne] theorem norm_rpow_eq_tsum (hp : 0 < p.toReal) (f : lp E p) : ‖f‖ ^ p.toReal = ∑' i, ‖f i‖ ^ p.toReal := by rw [norm_eq_tsum_rpow hp, ← Real.rpow_mul] · field_simp apply tsum_nonneg intro i calc (0 : ℝ) = (0 : ℝ) ^ p.toReal := by rw [Real.zero_rpow hp.ne'] _ ≤ _ := by gcongr; apply norm_nonneg theorem hasSum_norm (hp : 0 < p.toReal) (f : lp E p) : HasSum (fun i => ‖f i‖ ^ p.toReal) (‖f‖ ^ p.toReal) := by rw [norm_rpow_eq_tsum hp] exact ((lp.memℓp f).summable hp).hasSum theorem norm_nonneg' (f : lp E p) : 0 ≤ ‖f‖ := by rcases p.trichotomy with (rfl | rfl | hp) · simp [lp.norm_eq_card_dsupport f] · cases' isEmpty_or_nonempty α with _i _i · rw [lp.norm_eq_ciSup] simp [Real.iSup_of_isEmpty] inhabit α exact (norm_nonneg (f default)).trans ((lp.isLUB_norm f).1 ⟨default, rfl⟩) · rw [lp.norm_eq_tsum_rpow hp f] refine Real.rpow_nonneg (tsum_nonneg ?_) _ exact fun i => Real.rpow_nonneg (norm_nonneg _) _ @[simp] theorem norm_zero : ‖(0 : lp E p)‖ = 0 := by rcases p.trichotomy with (rfl | rfl | hp) · simp [lp.norm_eq_card_dsupport] · simp [lp.norm_eq_ciSup] · rw [lp.norm_eq_tsum_rpow hp] have hp' : 1 / p.toReal ≠ 0 := one_div_ne_zero hp.ne' simpa [Real.zero_rpow hp.ne'] using Real.zero_rpow hp' theorem norm_eq_zero_iff {f : lp E p} : ‖f‖ = 0 ↔ f = 0 := by refine ⟨fun h => ?_, by rintro rfl; exact norm_zero⟩ rcases p.trichotomy with (rfl | rfl | hp) · ext i have : { i : α | ¬f i = 0 } = ∅ := by simpa [lp.norm_eq_card_dsupport f] using h have : (¬f i = 0) = False := congr_fun this i tauto · cases' isEmpty_or_nonempty α with _i _i · simp [eq_iff_true_of_subsingleton] have H : IsLUB (Set.range fun i => ‖f i‖) 0 := by simpa [h] using lp.isLUB_norm f ext i have : ‖f i‖ = 0 := le_antisymm (H.1 ⟨i, rfl⟩) (norm_nonneg _) simpa using this · have hf : HasSum (fun i : α => ‖f i‖ ^ p.toReal) 0 := by have := lp.hasSum_norm hp f rwa [h, Real.zero_rpow hp.ne'] at this have : ∀ i, 0 ≤ ‖f i‖ ^ p.toReal := fun i => Real.rpow_nonneg (norm_nonneg _) _ rw [hasSum_zero_iff_of_nonneg this] at hf ext i have : f i = 0 ∧ p.toReal ≠ 0 := by simpa [Real.rpow_eq_zero_iff_of_nonneg (norm_nonneg (f i))] using congr_fun hf i exact this.1 theorem eq_zero_iff_coeFn_eq_zero {f : lp E p} : f = 0 ↔ ⇑f = 0 := by rw [lp.ext_iff, coeFn_zero] -- porting note (#11083): this was very slow, so I squeezed the `simp` calls @[simp] theorem norm_neg ⦃f : lp E p⦄ : ‖-f‖ = ‖f‖ := by rcases p.trichotomy with (rfl | rfl | hp) · simp only [norm_eq_card_dsupport, coeFn_neg, Pi.neg_apply, ne_eq, neg_eq_zero] · cases isEmpty_or_nonempty α · simp only [lp.eq_zero' f, neg_zero, norm_zero] apply (lp.isLUB_norm (-f)).unique simpa only [coeFn_neg, Pi.neg_apply, norm_neg] using lp.isLUB_norm f · suffices ‖-f‖ ^ p.toReal = ‖f‖ ^ p.toReal by exact Real.rpow_left_injOn hp.ne' (norm_nonneg' _) (norm_nonneg' _) this apply (lp.hasSum_norm hp (-f)).unique simpa only [coeFn_neg, Pi.neg_apply, _root_.norm_neg] using lp.hasSum_norm hp f instance normedAddCommGroup [hp : Fact (1 ≤ p)] : NormedAddCommGroup (lp E p) := AddGroupNorm.toNormedAddCommGroup { toFun := norm map_zero' := norm_zero neg' := norm_neg add_le' := fun f g => by rcases p.dichotomy with (rfl | hp') · cases isEmpty_or_nonempty α · simp only [lp.eq_zero' f, zero_add, norm_zero, le_refl] refine (lp.isLUB_norm (f + g)).2 ?_ rintro x ⟨i, rfl⟩ refine le_trans ?_ (add_mem_upperBounds_add (lp.isLUB_norm f).1 (lp.isLUB_norm g).1 ⟨_, ⟨i, rfl⟩, _, ⟨i, rfl⟩, rfl⟩) exact norm_add_le (f i) (g i) · have hp'' : 0 < p.toReal := zero_lt_one.trans_le hp' have hf₁ : ∀ i, 0 ≤ ‖f i‖ := fun i => norm_nonneg _ have hg₁ : ∀ i, 0 ≤ ‖g i‖ := fun i => norm_nonneg _ have hf₂ := lp.hasSum_norm hp'' f have hg₂ := lp.hasSum_norm hp'' g -- apply Minkowski's inequality obtain ⟨C, hC₁, hC₂, hCfg⟩ := Real.Lp_add_le_hasSum_of_nonneg hp' hf₁ hg₁ (norm_nonneg' _) (norm_nonneg' _) hf₂ hg₂ refine le_trans ?_ hC₂ rw [← Real.rpow_le_rpow_iff (norm_nonneg' (f + g)) hC₁ hp''] refine hasSum_le ?_ (lp.hasSum_norm hp'' (f + g)) hCfg intro i gcongr apply norm_add_le eq_zero_of_map_eq_zero' := fun f => norm_eq_zero_iff.1 } -- TODO: define an `ENNReal` version of `IsConjExponent`, and then express this inequality -- in a better version which also covers the case `p = 1, q = ∞`. /-- Hölder inequality -/ protected theorem tsum_mul_le_mul_norm {p q : ℝ≥0∞} (hpq : p.toReal.IsConjExponent q.toReal) (f : lp E p) (g : lp E q) : (Summable fun i => ‖f i‖ * ‖g i‖) ∧ ∑' i, ‖f i‖ * ‖g i‖ ≤ ‖f‖ * ‖g‖ := by have hf₁ : ∀ i, 0 ≤ ‖f i‖ := fun i => norm_nonneg _ have hg₁ : ∀ i, 0 ≤ ‖g i‖ := fun i => norm_nonneg _ have hf₂ := lp.hasSum_norm hpq.pos f have hg₂ := lp.hasSum_norm hpq.symm.pos g obtain ⟨C, -, hC', hC⟩ := Real.inner_le_Lp_mul_Lq_hasSum_of_nonneg hpq (norm_nonneg' _) (norm_nonneg' _) hf₁ hg₁ hf₂ hg₂ rw [← hC.tsum_eq] at hC' exact ⟨hC.summable, hC'⟩ protected theorem summable_mul {p q : ℝ≥0∞} (hpq : p.toReal.IsConjExponent q.toReal) (f : lp E p) (g : lp E q) : Summable fun i => ‖f i‖ * ‖g i‖ := (lp.tsum_mul_le_mul_norm hpq f g).1 protected theorem tsum_mul_le_mul_norm' {p q : ℝ≥0∞} (hpq : p.toReal.IsConjExponent q.toReal) (f : lp E p) (g : lp E q) : ∑' i, ‖f i‖ * ‖g i‖ ≤ ‖f‖ * ‖g‖ := (lp.tsum_mul_le_mul_norm hpq f g).2 section ComparePointwise theorem norm_apply_le_norm (hp : p ≠ 0) (f : lp E p) (i : α) : ‖f i‖ ≤ ‖f‖ := by rcases eq_or_ne p ∞ with (rfl | hp') · haveI : Nonempty α := ⟨i⟩ exact (isLUB_norm f).1 ⟨i, rfl⟩ have hp'' : 0 < p.toReal := ENNReal.toReal_pos hp hp' have : ∀ i, 0 ≤ ‖f i‖ ^ p.toReal := fun i => Real.rpow_nonneg (norm_nonneg _) _ rw [← Real.rpow_le_rpow_iff (norm_nonneg _) (norm_nonneg' _) hp''] convert le_hasSum (hasSum_norm hp'' f) i fun i _ => this i theorem sum_rpow_le_norm_rpow (hp : 0 < p.toReal) (f : lp E p) (s : Finset α) : ∑ i ∈ s, ‖f i‖ ^ p.toReal ≤ ‖f‖ ^ p.toReal := by rw [lp.norm_rpow_eq_tsum hp f] have : ∀ i, 0 ≤ ‖f i‖ ^ p.toReal := fun i => Real.rpow_nonneg (norm_nonneg _) _ refine sum_le_tsum _ (fun i _ => this i) ?_ exact (lp.memℓp f).summable hp theorem norm_le_of_forall_le' [Nonempty α] {f : lp E ∞} (C : ℝ) (hCf : ∀ i, ‖f i‖ ≤ C) : ‖f‖ ≤ C := by refine (isLUB_norm f).2 ?_ rintro - ⟨i, rfl⟩ exact hCf i theorem norm_le_of_forall_le {f : lp E ∞} {C : ℝ} (hC : 0 ≤ C) (hCf : ∀ i, ‖f i‖ ≤ C) : ‖f‖ ≤ C := by cases isEmpty_or_nonempty α · simpa [eq_zero' f] using hC · exact norm_le_of_forall_le' C hCf theorem norm_le_of_tsum_le (hp : 0 < p.toReal) {C : ℝ} (hC : 0 ≤ C) {f : lp E p} (hf : ∑' i, ‖f i‖ ^ p.toReal ≤ C ^ p.toReal) : ‖f‖ ≤ C := by rw [← Real.rpow_le_rpow_iff (norm_nonneg' _) hC hp, norm_rpow_eq_tsum hp] exact hf theorem norm_le_of_forall_sum_le (hp : 0 < p.toReal) {C : ℝ} (hC : 0 ≤ C) {f : lp E p} (hf : ∀ s : Finset α, ∑ i ∈ s, ‖f i‖ ^ p.toReal ≤ C ^ p.toReal) : ‖f‖ ≤ C := norm_le_of_tsum_le hp hC (tsum_le_of_sum_le ((lp.memℓp f).summable hp) hf) end ComparePointwise section BoundedSMul variable {𝕜 : Type*} {𝕜' : Type*} variable [NormedRing 𝕜] [NormedRing 𝕜'] variable [∀ i, Module 𝕜 (E i)] [∀ i, Module 𝕜' (E i)] instance : Module 𝕜 (PreLp E) := Pi.module α E 𝕜 instance [∀ i, SMulCommClass 𝕜' 𝕜 (E i)] : SMulCommClass 𝕜' 𝕜 (PreLp E) := Pi.smulCommClass instance [SMul 𝕜' 𝕜] [∀ i, IsScalarTower 𝕜' 𝕜 (E i)] : IsScalarTower 𝕜' 𝕜 (PreLp E) := Pi.isScalarTower instance [∀ i, Module 𝕜ᵐᵒᵖ (E i)] [∀ i, IsCentralScalar 𝕜 (E i)] : IsCentralScalar 𝕜 (PreLp E) := Pi.isCentralScalar variable [∀ i, BoundedSMul 𝕜 (E i)] [∀ i, BoundedSMul 𝕜' (E i)] theorem mem_lp_const_smul (c : 𝕜) (f : lp E p) : c • (f : PreLp E) ∈ lp E p := (lp.memℓp f).const_smul c variable (E p 𝕜) /-- The `𝕜`-submodule of elements of `∀ i : α, E i` whose `lp` norm is finite. This is `lp E p`, with extra structure. -/ def _root_.lpSubmodule : Submodule 𝕜 (PreLp E) := { lp E p with smul_mem' := fun c f hf => by simpa using mem_lp_const_smul c ⟨f, hf⟩ } variable {E p 𝕜} theorem coe_lpSubmodule : (lpSubmodule E p 𝕜).toAddSubgroup = lp E p := rfl instance : Module 𝕜 (lp E p) := { (lpSubmodule E p 𝕜).module with } @[simp] theorem coeFn_smul (c : 𝕜) (f : lp E p) : ⇑(c • f) = c • ⇑f := rfl instance [∀ i, SMulCommClass 𝕜' 𝕜 (E i)] : SMulCommClass 𝕜' 𝕜 (lp E p) := ⟨fun _ _ _ => Subtype.ext <| smul_comm _ _ _⟩ instance [SMul 𝕜' 𝕜] [∀ i, IsScalarTower 𝕜' 𝕜 (E i)] : IsScalarTower 𝕜' 𝕜 (lp E p) := ⟨fun _ _ _ => Subtype.ext <| smul_assoc _ _ _⟩ instance [∀ i, Module 𝕜ᵐᵒᵖ (E i)] [∀ i, IsCentralScalar 𝕜 (E i)] : IsCentralScalar 𝕜 (lp E p) := ⟨fun _ _ => Subtype.ext <| op_smul_eq_smul _ _⟩ theorem norm_const_smul_le (hp : p ≠ 0) (c : 𝕜) (f : lp E p) : ‖c • f‖ ≤ ‖c‖ * ‖f‖ := by rcases p.trichotomy with (rfl | rfl | hp) · exact absurd rfl hp · cases isEmpty_or_nonempty α · simp [lp.eq_zero' f] have hcf := lp.isLUB_norm (c • f) have hfc := (lp.isLUB_norm f).mul_left (norm_nonneg c) simp_rw [← Set.range_comp, Function.comp] at hfc -- TODO: some `IsLUB` API should make it a one-liner from here. refine hcf.right ?_ have := hfc.left simp_rw [mem_upperBounds, Set.mem_range, forall_exists_index, forall_apply_eq_imp_iff] at this ⊢ intro a exact (norm_smul_le _ _).trans (this a) · letI inst : NNNorm (lp E p) := ⟨fun f => ⟨‖f‖, norm_nonneg' _⟩⟩ have coe_nnnorm : ∀ f : lp E p, ↑‖f‖₊ = ‖f‖ := fun _ => rfl suffices ‖c • f‖₊ ^ p.toReal ≤ (‖c‖₊ * ‖f‖₊) ^ p.toReal by rwa [NNReal.rpow_le_rpow_iff hp] at this clear_value inst rw [NNReal.mul_rpow] have hLHS := lp.hasSum_norm hp (c • f) have hRHS := (lp.hasSum_norm hp f).mul_left (‖c‖ ^ p.toReal) simp_rw [← coe_nnnorm, ← _root_.coe_nnnorm, ← NNReal.coe_rpow, ← NNReal.coe_mul, NNReal.hasSum_coe] at hRHS hLHS refine hasSum_mono hLHS hRHS fun i => ?_ dsimp only rw [← NNReal.mul_rpow] -- Porting note: added rw [lp.coeFn_smul, Pi.smul_apply] gcongr apply nnnorm_smul_le instance [Fact (1 ≤ p)] : BoundedSMul 𝕜 (lp E p) := BoundedSMul.of_norm_smul_le <| norm_const_smul_le (zero_lt_one.trans_le <| Fact.out).ne' end BoundedSMul section DivisionRing variable {𝕜 : Type*} variable [NormedDivisionRing 𝕜] [∀ i, Module 𝕜 (E i)] [∀ i, BoundedSMul 𝕜 (E i)] theorem norm_const_smul (hp : p ≠ 0) {c : 𝕜} (f : lp E p) : ‖c • f‖ = ‖c‖ * ‖f‖ := by obtain rfl | hc := eq_or_ne c 0 · simp refine le_antisymm (norm_const_smul_le hp c f) ?_ have := mul_le_mul_of_nonneg_left (norm_const_smul_le hp c⁻¹ (c • f)) (norm_nonneg c) rwa [inv_smul_smul₀ hc, norm_inv, mul_inv_cancel_left₀ (norm_ne_zero_iff.mpr hc)] at this end DivisionRing section NormedSpace variable {𝕜 : Type*} [NormedField 𝕜] [∀ i, NormedSpace 𝕜 (E i)] instance instNormedSpace [Fact (1 ≤ p)] : NormedSpace 𝕜 (lp E p) where norm_smul_le c f := norm_smul_le c f end NormedSpace section NormedStarGroup variable [∀ i, StarAddMonoid (E i)] [∀ i, NormedStarGroup (E i)] theorem _root_.Memℓp.star_mem {f : ∀ i, E i} (hf : Memℓp f p) : Memℓp (star f) p := by rcases p.trichotomy with (rfl | rfl | hp) · apply memℓp_zero simp [hf.finite_dsupport] · apply memℓp_infty simpa using hf.bddAbove · apply memℓp_gen simpa using hf.summable hp @[simp] theorem _root_.Memℓp.star_iff {f : ∀ i, E i} : Memℓp (star f) p ↔ Memℓp f p := ⟨fun h => star_star f ▸ Memℓp.star_mem h, Memℓp.star_mem⟩ instance : Star (lp E p) where star f := ⟨(star f : ∀ i, E i), f.property.star_mem⟩ @[simp] theorem coeFn_star (f : lp E p) : ⇑(star f) = star (⇑f) := rfl @[simp] protected theorem star_apply (f : lp E p) (i : α) : star f i = star (f i) := rfl instance instInvolutiveStar : InvolutiveStar (lp E p) where star_involutive x := by simp [star] instance instStarAddMonoid : StarAddMonoid (lp E p) where star_add _f _g := ext <| star_add (R := ∀ i, E i) _ _ instance [hp : Fact (1 ≤ p)] : NormedStarGroup (lp E p) where norm_star f := by rcases p.trichotomy with (rfl | rfl | h) · exfalso have := ENNReal.toReal_mono ENNReal.zero_ne_top hp.elim norm_num at this · simp only [lp.norm_eq_ciSup, lp.star_apply, norm_star] · simp only [lp.norm_eq_tsum_rpow h, lp.star_apply, norm_star] variable {𝕜 : Type*} [Star 𝕜] [NormedRing 𝕜] variable [∀ i, Module 𝕜 (E i)] [∀ i, BoundedSMul 𝕜 (E i)] [∀ i, StarModule 𝕜 (E i)] instance : StarModule 𝕜 (lp E p) where star_smul _r _f := ext <| star_smul (A := ∀ i, E i) _ _ end NormedStarGroup section NonUnitalNormedRing variable {I : Type*} {B : I → Type*} [∀ i, NonUnitalNormedRing (B i)] theorem _root_.Memℓp.infty_mul {f g : ∀ i, B i} (hf : Memℓp f ∞) (hg : Memℓp g ∞) : Memℓp (f * g) ∞ := by rw [memℓp_infty_iff] obtain ⟨⟨Cf, hCf⟩, ⟨Cg, hCg⟩⟩ := hf.bddAbove, hg.bddAbove refine ⟨Cf * Cg, ?_⟩ rintro _ ⟨i, rfl⟩ calc ‖(f * g) i‖ ≤ ‖f i‖ * ‖g i‖ := norm_mul_le (f i) (g i) _ ≤ Cf * Cg := mul_le_mul (hCf ⟨i, rfl⟩) (hCg ⟨i, rfl⟩) (norm_nonneg _) ((norm_nonneg _).trans (hCf ⟨i, rfl⟩)) instance : Mul (lp B ∞) where mul f g := ⟨HMul.hMul (α := ∀ i, B i) _ _ , f.property.infty_mul g.property⟩ @[simp] theorem infty_coeFn_mul (f g : lp B ∞) : ⇑(f * g) = ⇑f * ⇑g := rfl instance nonUnitalRing : NonUnitalRing (lp B ∞) := Function.Injective.nonUnitalRing lp.coeFun.coe Subtype.coe_injective (lp.coeFn_zero B ∞) lp.coeFn_add infty_coeFn_mul lp.coeFn_neg lp.coeFn_sub (fun _ _ => rfl) fun _ _ => rfl instance nonUnitalNormedRing : NonUnitalNormedRing (lp B ∞) := { lp.normedAddCommGroup, lp.nonUnitalRing with norm_mul := fun f g => lp.norm_le_of_forall_le (mul_nonneg (norm_nonneg f) (norm_nonneg g)) fun i => calc ‖(f * g) i‖ ≤ ‖f i‖ * ‖g i‖ := norm_mul_le _ _ _ ≤ ‖f‖ * ‖g‖ := mul_le_mul (lp.norm_apply_le_norm ENNReal.top_ne_zero f i) (lp.norm_apply_le_norm ENNReal.top_ne_zero g i) (norm_nonneg _) (norm_nonneg _) } -- we also want a `NonUnitalNormedCommRing` instance, but this has to wait for mathlib3 #13719 instance infty_isScalarTower {𝕜} [NormedRing 𝕜] [∀ i, Module 𝕜 (B i)] [∀ i, BoundedSMul 𝕜 (B i)] [∀ i, IsScalarTower 𝕜 (B i) (B i)] : IsScalarTower 𝕜 (lp B ∞) (lp B ∞) := ⟨fun r f g => lp.ext <| smul_assoc (N := ∀ i, B i) (α := ∀ i, B i) r (⇑f) (⇑g)⟩ instance infty_smulCommClass {𝕜} [NormedRing 𝕜] [∀ i, Module 𝕜 (B i)] [∀ i, BoundedSMul 𝕜 (B i)] [∀ i, SMulCommClass 𝕜 (B i) (B i)] : SMulCommClass 𝕜 (lp B ∞) (lp B ∞) := ⟨fun r f g => lp.ext <| smul_comm (N := ∀ i, B i) (α := ∀ i, B i) r (⇑f) (⇑g)⟩ section StarRing variable [∀ i, StarRing (B i)] [∀ i, NormedStarGroup (B i)] instance inftyStarRing : StarRing (lp B ∞) := { lp.instStarAddMonoid with star_mul := fun _f _g => ext <| star_mul (R := ∀ i, B i) _ _ } instance inftyCStarRing [∀ i, CStarRing (B i)] : CStarRing (lp B ∞) where norm_mul_self_le f := by rw [← sq, ← Real.le_sqrt (norm_nonneg _) (norm_nonneg _)] refine lp.norm_le_of_forall_le ‖star f * f‖.sqrt_nonneg fun i => ?_ rw [Real.le_sqrt (norm_nonneg _) (norm_nonneg _), sq, ← CStarRing.norm_star_mul_self] exact lp.norm_apply_le_norm ENNReal.top_ne_zero (star f * f) i end StarRing end NonUnitalNormedRing section NormedRing variable {I : Type*} {B : I → Type*} [∀ i, NormedRing (B i)] instance _root_.PreLp.ring : Ring (PreLp B) := Pi.ring variable [∀ i, NormOneClass (B i)] theorem _root_.one_memℓp_infty : Memℓp (1 : ∀ i, B i) ∞ := ⟨1, by rintro i ⟨i, rfl⟩; exact norm_one.le⟩ variable (B) /-- The `𝕜`-subring of elements of `∀ i : α, B i` whose `lp` norm is finite. This is `lp E ∞`, with extra structure. -/ def _root_.lpInftySubring : Subring (PreLp B) := { lp B ∞ with carrier := { f | Memℓp f ∞ } one_mem' := one_memℓp_infty mul_mem' := Memℓp.infty_mul } variable {B} instance inftyRing : Ring (lp B ∞) := (lpInftySubring B).toRing theorem _root_.Memℓp.infty_pow {f : ∀ i, B i} (hf : Memℓp f ∞) (n : ℕ) : Memℓp (f ^ n) ∞ := (lpInftySubring B).pow_mem hf n theorem _root_.natCast_memℓp_infty (n : ℕ) : Memℓp (n : ∀ i, B i) ∞ := natCast_mem (lpInftySubring B) n @[deprecated (since := "2024-04-17")] alias _root_.nat_cast_memℓp_infty := _root_.natCast_memℓp_infty theorem _root_.intCast_memℓp_infty (z : ℤ) : Memℓp (z : ∀ i, B i) ∞ := intCast_mem (lpInftySubring B) z @[deprecated (since := "2024-04-17")] alias _root_.int_cast_memℓp_infty := _root_.intCast_memℓp_infty @[simp] theorem infty_coeFn_one : ⇑(1 : lp B ∞) = 1 := rfl @[simp] theorem infty_coeFn_pow (f : lp B ∞) (n : ℕ) : ⇑(f ^ n) = (⇑f) ^ n := rfl @[simp] theorem infty_coeFn_natCast (n : ℕ) : ⇑(n : lp B ∞) = n := rfl @[deprecated (since := "2024-04-17")] alias infty_coeFn_nat_cast := infty_coeFn_natCast @[simp] theorem infty_coeFn_intCast (z : ℤ) : ⇑(z : lp B ∞) = z := rfl @[deprecated (since := "2024-04-17")] alias infty_coeFn_int_cast := infty_coeFn_intCast instance [Nonempty I] : NormOneClass (lp B ∞) where norm_one := by simp_rw [lp.norm_eq_ciSup, infty_coeFn_one, Pi.one_apply, norm_one, ciSup_const] instance inftyNormedRing : NormedRing (lp B ∞) := { lp.inftyRing, lp.nonUnitalNormedRing with } end NormedRing section NormedCommRing variable {I : Type*} {B : I → Type*} [∀ i, NormedCommRing (B i)] [∀ i, NormOneClass (B i)] instance inftyCommRing : CommRing (lp B ∞) := { lp.inftyRing with mul_comm := fun f g => by ext; simp only [lp.infty_coeFn_mul, Pi.mul_apply, mul_comm] } instance inftyNormedCommRing : NormedCommRing (lp B ∞) := { lp.inftyCommRing, lp.inftyNormedRing with } end NormedCommRing section Algebra variable {I : Type*} {𝕜 : Type*} {B : I → Type*} variable [NormedField 𝕜] [∀ i, NormedRing (B i)] [∀ i, NormedAlgebra 𝕜 (B i)] /-- A variant of `Pi.algebra` that lean can't find otherwise. -/ instance _root_.Pi.algebraOfNormedAlgebra : Algebra 𝕜 (∀ i, B i) := @Pi.algebra I 𝕜 B _ _ fun _ => NormedAlgebra.toAlgebra instance _root_.PreLp.algebra : Algebra 𝕜 (PreLp B) := Pi.algebraOfNormedAlgebra variable [∀ i, NormOneClass (B i)] theorem _root_.algebraMap_memℓp_infty (k : 𝕜) : Memℓp (algebraMap 𝕜 (∀ i, B i) k) ∞ := by rw [Algebra.algebraMap_eq_smul_one] exact (one_memℓp_infty.const_smul k : Memℓp (k • (1 : ∀ i, B i)) ∞) variable (𝕜 B) /-- The `𝕜`-subalgebra of elements of `∀ i : α, B i` whose `lp` norm is finite. This is `lp E ∞`, with extra structure. -/ def _root_.lpInftySubalgebra : Subalgebra 𝕜 (PreLp B) := { lpInftySubring B with carrier := { f | Memℓp f ∞ } algebraMap_mem' := algebraMap_memℓp_infty } variable {𝕜 B} instance inftyNormedAlgebra : NormedAlgebra 𝕜 (lp B ∞) := { (lpInftySubalgebra 𝕜 B).algebra, (lp.instNormedSpace : NormedSpace 𝕜 (lp B ∞)) with } end Algebra section Single variable {𝕜 : Type*} [NormedRing 𝕜] [∀ i, Module 𝕜 (E i)] [∀ i, BoundedSMul 𝕜 (E i)] variable [DecidableEq α] /-- The element of `lp E p` which is `a : E i` at the index `i`, and zero elsewhere. -/ protected def single (p) (i : α) (a : E i) : lp E p := ⟨fun j => if h : j = i then Eq.ndrec a h.symm else 0, by refine (memℓp_zero ?_).of_exponent_ge (zero_le p) refine (Set.finite_singleton i).subset ?_ intro j simp only [forall_exists_index, Set.mem_singleton_iff, Ne, dite_eq_right_iff, Set.mem_setOf_eq, not_forall] rintro rfl simp⟩ protected theorem single_apply (p) (i : α) (a : E i) (j : α) : lp.single p i a j = if h : j = i then Eq.ndrec a h.symm else 0 := rfl protected theorem single_apply_self (p) (i : α) (a : E i) : lp.single p i a i = a := by rw [lp.single_apply, dif_pos rfl] protected theorem single_apply_ne (p) (i : α) (a : E i) {j : α} (hij : j ≠ i) : lp.single p i a j = 0 := by rw [lp.single_apply, dif_neg hij] @[simp] protected theorem single_neg (p) (i : α) (a : E i) : lp.single p i (-a) = -lp.single p i a := by refine ext (funext (fun (j : α) => ?_)) by_cases hi : j = i · subst hi simp [lp.single_apply_self] · simp [lp.single_apply_ne p i _ hi] @[simp] protected theorem single_smul (p) (i : α) (a : E i) (c : 𝕜) : lp.single p i (c • a) = c • lp.single p i a := by refine ext (funext (fun (j : α) => ?_)) by_cases hi : j = i · subst hi dsimp simp [lp.single_apply_self] · dsimp simp [lp.single_apply_ne p i _ hi] protected theorem norm_sum_single (hp : 0 < p.toReal) (f : ∀ i, E i) (s : Finset α) : ‖∑ i ∈ s, lp.single p i (f i)‖ ^ p.toReal = ∑ i ∈ s, ‖f i‖ ^ p.toReal := by refine (hasSum_norm hp (∑ i ∈ s, lp.single p i (f i))).unique ?_ simp only [lp.single_apply, coeFn_sum, Finset.sum_apply, Finset.sum_dite_eq] have h : ∀ i ∉ s, ‖ite (i ∈ s) (f i) 0‖ ^ p.toReal = 0 := fun i hi ↦ by simp [if_neg hi, Real.zero_rpow hp.ne'] have h' : ∀ i ∈ s, ‖f i‖ ^ p.toReal = ‖ite (i ∈ s) (f i) 0‖ ^ p.toReal := by intro i hi rw [if_pos hi] simpa [Finset.sum_congr rfl h'] using hasSum_sum_of_ne_finset_zero h protected theorem norm_single (hp : 0 < p.toReal) (f : ∀ i, E i) (i : α) : ‖lp.single p i (f i)‖ = ‖f i‖ := by refine Real.rpow_left_injOn hp.ne' (norm_nonneg' _) (norm_nonneg _) ?_ simpa using lp.norm_sum_single hp f {i} protected theorem norm_sub_norm_compl_sub_single (hp : 0 < p.toReal) (f : lp E p) (s : Finset α) : ‖f‖ ^ p.toReal - ‖f - ∑ i ∈ s, lp.single p i (f i)‖ ^ p.toReal = ∑ i ∈ s, ‖f i‖ ^ p.toReal := by refine ((hasSum_norm hp f).sub (hasSum_norm hp (f - ∑ i ∈ s, lp.single p i (f i)))).unique ?_ let F : α → ℝ := fun i => ‖f i‖ ^ p.toReal - ‖(f - ∑ i ∈ s, lp.single p i (f i)) i‖ ^ p.toReal have hF : ∀ i ∉ s, F i = 0 := by intro i hi suffices ‖f i‖ ^ p.toReal - ‖f i - ite (i ∈ s) (f i) 0‖ ^ p.toReal = 0 by simpa only [F, coeFn_sum, lp.single_apply, coeFn_sub, Pi.sub_apply, Finset.sum_apply, Finset.sum_dite_eq] using this simp only [if_neg hi, sub_zero, sub_self] have hF' : ∀ i ∈ s, F i = ‖f i‖ ^ p.toReal := by intro i hi simp only [F, coeFn_sum, lp.single_apply, if_pos hi, sub_self, eq_self_iff_true, coeFn_sub, Pi.sub_apply, Finset.sum_apply, Finset.sum_dite_eq, sub_eq_self] simp [Real.zero_rpow hp.ne'] have : HasSum F (∑ i ∈ s, F i) := hasSum_sum_of_ne_finset_zero hF rwa [Finset.sum_congr rfl hF'] at this protected theorem norm_compl_sum_single (hp : 0 < p.toReal) (f : lp E p) (s : Finset α) : ‖f - ∑ i ∈ s, lp.single p i (f i)‖ ^ p.toReal = ‖f‖ ^ p.toReal - ∑ i ∈ s, ‖f i‖ ^ p.toReal := by linarith [lp.norm_sub_norm_compl_sub_single hp f s] /-- The canonical finitely-supported approximations to an element `f` of `lp` converge to it, in the `lp` topology. -/ protected theorem hasSum_single [Fact (1 ≤ p)] (hp : p ≠ ⊤) (f : lp E p) : HasSum (fun i : α => lp.single p i (f i : E i)) f := by have hp₀ : 0 < p := zero_lt_one.trans_le Fact.out have hp' : 0 < p.toReal := ENNReal.toReal_pos hp₀.ne' hp have := lp.hasSum_norm hp' f rw [HasSum, Metric.tendsto_nhds] at this ⊢ intro ε hε refine (this _ (Real.rpow_pos_of_pos hε p.toReal)).mono ?_ intro s hs rw [← Real.rpow_lt_rpow_iff dist_nonneg (le_of_lt hε) hp'] rw [dist_comm] at hs simp only [dist_eq_norm, Real.norm_eq_abs] at hs ⊢ have H : ‖(∑ i ∈ s, lp.single p i (f i : E i)) - f‖ ^ p.toReal = ‖f‖ ^ p.toReal - ∑ i ∈ s, ‖f i‖ ^ p.toReal := by simpa only [coeFn_neg, Pi.neg_apply, lp.single_neg, Finset.sum_neg_distrib, neg_sub_neg, norm_neg, _root_.norm_neg] using lp.norm_compl_sum_single hp' (-f) s rw [← H] at hs have : |‖(∑ i ∈ s, lp.single p i (f i : E i)) - f‖ ^ p.toReal| = ‖(∑ i ∈ s, lp.single p i (f i : E i)) - f‖ ^ p.toReal := by simp only [Real.abs_rpow_of_nonneg (norm_nonneg _), abs_norm] exact this ▸ hs end Single section Topology open Filter open scoped Topology uniformity /-- The coercion from `lp E p` to `∀ i, E i` is uniformly continuous. -/ theorem uniformContinuous_coe [_i : Fact (1 ≤ p)] : UniformContinuous (α := lp E p) ((↑) : lp E p → ∀ i, E i) := by have hp : p ≠ 0 := (zero_lt_one.trans_le _i.elim).ne' rw [uniformContinuous_pi] intro i rw [NormedAddCommGroup.uniformity_basis_dist.uniformContinuous_iff NormedAddCommGroup.uniformity_basis_dist] intro ε hε refine ⟨ε, hε, ?_⟩ rintro f g (hfg : ‖f - g‖ < ε) have : ‖f i - g i‖ ≤ ‖f - g‖ := norm_apply_le_norm hp (f - g) i exact this.trans_lt hfg variable {ι : Type*} {l : Filter ι} [Filter.NeBot l] theorem norm_apply_le_of_tendsto {C : ℝ} {F : ι → lp E ∞} (hCF : ∀ᶠ k in l, ‖F k‖ ≤ C) {f : ∀ a, E a} (hf : Tendsto (id fun i => F i : ι → ∀ a, E a) l (𝓝 f)) (a : α) : ‖f a‖ ≤ C := by have : Tendsto (fun k => ‖F k a‖) l (𝓝 ‖f a‖) := (Tendsto.comp (continuous_apply a).continuousAt hf).norm refine le_of_tendsto this (hCF.mono ?_) intro k hCFk exact (norm_apply_le_norm ENNReal.top_ne_zero (F k) a).trans hCFk variable [_i : Fact (1 ≤ p)] theorem sum_rpow_le_of_tendsto (hp : p ≠ ∞) {C : ℝ} {F : ι → lp E p} (hCF : ∀ᶠ k in l, ‖F k‖ ≤ C) {f : ∀ a, E a} (hf : Tendsto (id fun i => F i : ι → ∀ a, E a) l (𝓝 f)) (s : Finset α) : ∑ i ∈ s, ‖f i‖ ^ p.toReal ≤ C ^ p.toReal := by have hp' : p ≠ 0 := (zero_lt_one.trans_le _i.elim).ne' have hp'' : 0 < p.toReal := ENNReal.toReal_pos hp' hp let G : (∀ a, E a) → ℝ := fun f => ∑ a ∈ s, ‖f a‖ ^ p.toReal have hG : Continuous G := by refine continuous_finset_sum s ?_ intro a _ have : Continuous fun f : ∀ a, E a => f a := continuous_apply a exact this.norm.rpow_const fun _ => Or.inr hp''.le refine le_of_tendsto (hG.continuousAt.tendsto.comp hf) ?_ refine hCF.mono ?_ intro k hCFk refine (lp.sum_rpow_le_norm_rpow hp'' (F k) s).trans ?_ gcongr /-- "Semicontinuity of the `lp` norm": If all sufficiently large elements of a sequence in `lp E p` have `lp` norm `≤ C`, then the pointwise limit, if it exists, also has `lp` norm `≤ C`. -/ theorem norm_le_of_tendsto {C : ℝ} {F : ι → lp E p} (hCF : ∀ᶠ k in l, ‖F k‖ ≤ C) {f : lp E p} (hf : Tendsto (id fun i => F i : ι → ∀ a, E a) l (𝓝 f)) : ‖f‖ ≤ C := by obtain ⟨i, hi⟩ := hCF.exists have hC : 0 ≤ C := (norm_nonneg _).trans hi rcases eq_top_or_lt_top p with (rfl | hp) · apply norm_le_of_forall_le hC exact norm_apply_le_of_tendsto hCF hf · have : 0 < p := zero_lt_one.trans_le _i.elim have hp' : 0 < p.toReal := ENNReal.toReal_pos this.ne' hp.ne apply norm_le_of_forall_sum_le hp' hC exact sum_rpow_le_of_tendsto hp.ne hCF hf /-- If `f` is the pointwise limit of a bounded sequence in `lp E p`, then `f` is in `lp E p`. -/ theorem memℓp_of_tendsto {F : ι → lp E p} (hF : Bornology.IsBounded (Set.range F)) {f : ∀ a, E a} (hf : Tendsto (id fun i => F i : ι → ∀ a, E a) l (𝓝 f)) : Memℓp f p := by obtain ⟨C, hCF⟩ : ∃ C, ∀ k, ‖F k‖ ≤ C := hF.exists_norm_le.imp fun _ ↦ Set.forall_mem_range.1 rcases eq_top_or_lt_top p with (rfl | hp) · apply memℓp_infty use C rintro _ ⟨a, rfl⟩ exact norm_apply_le_of_tendsto (eventually_of_forall hCF) hf a · apply memℓp_gen' exact sum_rpow_le_of_tendsto hp.ne (eventually_of_forall hCF) hf /-- If a sequence is Cauchy in the `lp E p` topology and pointwise convergent to an element `f` of `lp E p`, then it converges to `f` in the `lp E p` topology. -/ theorem tendsto_lp_of_tendsto_pi {F : ℕ → lp E p} (hF : CauchySeq F) {f : lp E p} (hf : Tendsto (id fun i => F i : ℕ → ∀ a, E a) atTop (𝓝 f)) : Tendsto F atTop (𝓝 f) := by rw [Metric.nhds_basis_closedBall.tendsto_right_iff] intro ε hε have hε' : { p : lp E p × lp E p | ‖p.1 - p.2‖ < ε } ∈ uniformity (lp E p) := NormedAddCommGroup.uniformity_basis_dist.mem_of_mem hε refine (hF.eventually_eventually hε').mono ?_ rintro n (hn : ∀ᶠ l in atTop, ‖(fun f => F n - f) (F l)‖ < ε) refine norm_le_of_tendsto (hn.mono fun k hk => hk.le) ?_ rw [tendsto_pi_nhds] intro a exact (hf.apply_nhds a).const_sub (F n a) variable [∀ a, CompleteSpace (E a)] instance completeSpace : CompleteSpace (lp E p) := Metric.complete_of_cauchySeq_tendsto (by intro F hF -- A Cauchy sequence in `lp E p` is pointwise convergent; let `f` be the pointwise limit. obtain ⟨f, hf⟩ := cauchySeq_tendsto_of_complete ((uniformContinuous_coe (p := p)).comp_cauchySeq hF) -- Since the Cauchy sequence is bounded, its pointwise limit `f` is in `lp E p`. have hf' : Memℓp f p := memℓp_of_tendsto hF.isBounded_range hf -- And therefore `f` is its limit in the `lp E p` topology as well as pointwise. exact ⟨⟨f, hf'⟩, tendsto_lp_of_tendsto_pi hF hf⟩) end Topology end lp section Lipschitz open ENNReal lp variable {ι : Type*} lemma LipschitzWith.uniformly_bounded [PseudoMetricSpace α] (g : α → ι → ℝ) {K : ℝ≥0} (hg : ∀ i, LipschitzWith K (g · i)) (a₀ : α) (hga₀b : Memℓp (g a₀) ∞) (a : α) : Memℓp (g a) ∞ := by rcases hga₀b with ⟨M, hM⟩ use ↑K * dist a a₀ + M rintro - ⟨i, rfl⟩ calc |g a i| = |g a i - g a₀ i + g a₀ i| := by simp _ ≤ |g a i - g a₀ i| + |g a₀ i| := abs_add _ _ _ ≤ ↑K * dist a a₀ + M := by gcongr · exact lipschitzWith_iff_dist_le_mul.1 (hg i) a a₀ · exact hM ⟨i, rfl⟩ theorem LipschitzOnWith.coordinate [PseudoMetricSpace α] (f : α → ℓ^∞(ι)) (s : Set α) (K : ℝ≥0) : LipschitzOnWith K f s ↔ ∀ i : ι, LipschitzOnWith K (fun a : α ↦ f a i) s := by simp_rw [lipschitzOnWith_iff_dist_le_mul] constructor · intro hfl i x hx y hy calc dist (f x i) (f y i) ≤ dist (f x) (f y) := lp.norm_apply_le_norm top_ne_zero (f x - f y) i _ ≤ K * dist x y := hfl x hx y hy · intro hgl x hx y hy apply lp.norm_le_of_forall_le · positivity intro i apply hgl i x hx y hy theorem LipschitzWith.coordinate [PseudoMetricSpace α] {f : α → ℓ^∞(ι)} (K : ℝ≥0) : LipschitzWith K f ↔ ∀ i : ι, LipschitzWith K (fun a : α ↦ f a i) := by simp_rw [← lipschitzOnWith_univ] apply LipschitzOnWith.coordinate end Lipschitz
Analysis\Normed\Lp\PiLp.lean
/- Copyright (c) 2020 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel, Jireh Loreaux -/ import Mathlib.Analysis.MeanInequalities import Mathlib.Data.Fintype.Order import Mathlib.LinearAlgebra.Matrix.Basis import Mathlib.Analysis.Normed.Lp.WithLp /-! # `L^p` distance on finite products of metric spaces Given finitely many metric spaces, one can put the max distance on their product, but there is also a whole family of natural distances, indexed by a parameter `p : ℝ≥0∞`, that also induce the product topology. We define them in this file. For `0 < p < ∞`, the distance on `Π i, α i` is given by $$ d(x, y) = \left(\sum d(x_i, y_i)^p\right)^{1/p}. $$, whereas for `p = 0` it is the cardinality of the set ${i | d (x_i, y_i) ≠ 0}$. For `p = ∞` the distance is the supremum of the distances. We give instances of this construction for emetric spaces, metric spaces, normed groups and normed spaces. To avoid conflicting instances, all these are defined on a copy of the original Π-type, named `PiLp p α`. The assumption `[Fact (1 ≤ p)]` is required for the metric and normed space instances. We ensure that the topology, bornology and uniform structure on `PiLp p α` are (defeq to) the product topology, product bornology and product uniformity, to be able to use freely continuity statements for the coordinate functions, for instance. ## Implementation notes We only deal with the `L^p` distance on a product of finitely many metric spaces, which may be distinct. A closely related construction is `lp`, the `L^p` norm on a product of (possibly infinitely many) normed spaces, where the norm is $$ \left(\sum ‖f (x)‖^p \right)^{1/p}. $$ However, the topology induced by this construction is not the product topology, and some functions have infinite `L^p` norm. These subtleties are not present in the case of finitely many metric spaces, hence it is worth devoting a file to this specific case which is particularly well behaved. Another related construction is `MeasureTheory.Lp`, the `L^p` norm on the space of functions from a measure space to a normed space, where the norm is $$ \left(\int ‖f (x)‖^p dμ\right)^{1/p}. $$ This has all the same subtleties as `lp`, and the further subtlety that this only defines a seminorm (as almost everywhere zero functions have zero `L^p` norm). The construction `PiLp` corresponds to the special case of `MeasureTheory.Lp` in which the basis is a finite space equipped with the counting measure. To prove that the topology (and the uniform structure) on a finite product with the `L^p` distance are the same as those coming from the `L^∞` distance, we could argue that the `L^p` and `L^∞` norms are equivalent on `ℝ^n` for abstract (norm equivalence) reasons. Instead, we give a more explicit (easy) proof which provides a comparison between these two norms with explicit constants. We also set up the theory for `PseudoEMetricSpace` and `PseudoMetricSpace`. -/ open Real Set Filter RCLike Bornology Uniformity Topology NNReal ENNReal noncomputable section /-- A copy of a Pi type, on which we will put the `L^p` distance. Since the Pi type itself is already endowed with the `L^∞` distance, we need the type synonym to avoid confusing typeclass resolution. Also, we let it depend on `p`, to get a whole family of type on which we can put different distances. -/ abbrev PiLp (p : ℝ≥0∞) {ι : Type*} (α : ι → Type*) : Type _ := WithLp p (∀ i : ι, α i) /-The following should not be a `FunLike` instance because then the coercion `⇑` would get unfolded to `FunLike.coe` instead of `WithLp.equiv`. -/ instance (p : ℝ≥0∞) {ι : Type*} (α : ι → Type*) : CoeFun (PiLp p α) (fun _ ↦ (i : ι) → α i) where coe := WithLp.equiv p _ instance (p : ℝ≥0∞) {ι : Type*} (α : ι → Type*) [∀ i, Inhabited (α i)] : Inhabited (PiLp p α) := ⟨fun _ => default⟩ @[ext] protected theorem PiLp.ext {p : ℝ≥0∞} {ι : Type*} {α : ι → Type*} {x y : PiLp p α} (h : ∀ i, x i = y i) : x = y := funext h namespace PiLp variable (p : ℝ≥0∞) (𝕜 : Type*) {ι : Type*} (α : ι → Type*) (β : ι → Type*) section /- Register simplification lemmas for the applications of `PiLp` elements, as the usual lemmas for Pi types will not trigger. -/ variable {𝕜 p α} variable [SeminormedRing 𝕜] [∀ i, SeminormedAddCommGroup (β i)] variable [∀ i, Module 𝕜 (β i)] (c : 𝕜) variable (x y : PiLp p β) (i : ι) #adaptation_note /-- After https://github.com/leanprover/lean4/pull/4481 the `simpNF` linter incorrectly claims this lemma can't be applied by `simp`. (It appears to also be unused in Mathlib.) -/ @[simp, nolint simpNF] theorem zero_apply : (0 : PiLp p β) i = 0 := rfl @[simp] theorem add_apply : (x + y) i = x i + y i := rfl @[simp] theorem sub_apply : (x - y) i = x i - y i := rfl @[simp] theorem smul_apply : (c • x) i = c • x i := rfl @[simp] theorem neg_apply : (-x) i = -x i := rfl end /-! Note that the unapplied versions of these lemmas are deliberately omitted, as they break the use of the type synonym. -/ @[simp] theorem _root_.WithLp.equiv_pi_apply (x : PiLp p α) (i : ι) : WithLp.equiv p _ x i = x i := rfl @[simp] theorem _root_.WithLp.equiv_symm_pi_apply (x : ∀ i, α i) (i : ι) : (WithLp.equiv p _).symm x i = x i := rfl section DistNorm variable [Fintype ι] /-! ### Definition of `edist`, `dist` and `norm` on `PiLp` In this section we define the `edist`, `dist` and `norm` functions on `PiLp p α` without assuming `[Fact (1 ≤ p)]` or metric properties of the spaces `α i`. This allows us to provide the rewrite lemmas for each of three cases `p = 0`, `p = ∞` and `0 < p.to_real`. -/ section Edist variable [∀ i, EDist (β i)] /-- Endowing the space `PiLp p β` with the `L^p` edistance. We register this instance separate from `pi_Lp.pseudo_emetric` since the latter requires the type class hypothesis `[Fact (1 ≤ p)]` in order to prove the triangle inequality. Registering this separately allows for a future emetric-like structure on `PiLp p β` for `p < 1` satisfying a relaxed triangle inequality. The terminology for this varies throughout the literature, but it is sometimes called a *quasi-metric* or *semi-metric*. -/ instance : EDist (PiLp p β) where edist f g := if p = 0 then {i | edist (f i) (g i) ≠ 0}.toFinite.toFinset.card else if p = ∞ then ⨆ i, edist (f i) (g i) else (∑ i, edist (f i) (g i) ^ p.toReal) ^ (1 / p.toReal) variable {β} theorem edist_eq_card (f g : PiLp 0 β) : edist f g = {i | edist (f i) (g i) ≠ 0}.toFinite.toFinset.card := if_pos rfl theorem edist_eq_sum {p : ℝ≥0∞} (hp : 0 < p.toReal) (f g : PiLp p β) : edist f g = (∑ i, edist (f i) (g i) ^ p.toReal) ^ (1 / p.toReal) := let hp' := ENNReal.toReal_pos_iff.mp hp (if_neg hp'.1.ne').trans (if_neg hp'.2.ne) theorem edist_eq_iSup (f g : PiLp ∞ β) : edist f g = ⨆ i, edist (f i) (g i) := rfl end Edist section EdistProp variable {β} variable [∀ i, PseudoEMetricSpace (β i)] /-- This holds independent of `p` and does not require `[Fact (1 ≤ p)]`. We keep it separate from `pi_Lp.pseudo_emetric_space` so it can be used also for `p < 1`. -/ protected theorem edist_self (f : PiLp p β) : edist f f = 0 := by rcases p.trichotomy with (rfl | rfl | h) · simp [edist_eq_card] · simp [edist_eq_iSup] · simp [edist_eq_sum h, ENNReal.zero_rpow_of_pos h, ENNReal.zero_rpow_of_pos (inv_pos.2 <| h)] /-- This holds independent of `p` and does not require `[Fact (1 ≤ p)]`. We keep it separate from `pi_Lp.pseudo_emetric_space` so it can be used also for `p < 1`. -/ protected theorem edist_comm (f g : PiLp p β) : edist f g = edist g f := by rcases p.trichotomy with (rfl | rfl | h) · simp only [edist_eq_card, edist_comm] · simp only [edist_eq_iSup, edist_comm] · simp only [edist_eq_sum h, edist_comm] end EdistProp section Dist variable [∀ i, Dist (α i)] /-- Endowing the space `PiLp p β` with the `L^p` distance. We register this instance separate from `pi_Lp.pseudo_metric` since the latter requires the type class hypothesis `[Fact (1 ≤ p)]` in order to prove the triangle inequality. Registering this separately allows for a future metric-like structure on `PiLp p β` for `p < 1` satisfying a relaxed triangle inequality. The terminology for this varies throughout the literature, but it is sometimes called a *quasi-metric* or *semi-metric*. -/ instance : Dist (PiLp p α) where dist f g := if p = 0 then {i | dist (f i) (g i) ≠ 0}.toFinite.toFinset.card else if p = ∞ then ⨆ i, dist (f i) (g i) else (∑ i, dist (f i) (g i) ^ p.toReal) ^ (1 / p.toReal) variable {α} theorem dist_eq_card (f g : PiLp 0 α) : dist f g = {i | dist (f i) (g i) ≠ 0}.toFinite.toFinset.card := if_pos rfl theorem dist_eq_sum {p : ℝ≥0∞} (hp : 0 < p.toReal) (f g : PiLp p α) : dist f g = (∑ i, dist (f i) (g i) ^ p.toReal) ^ (1 / p.toReal) := let hp' := ENNReal.toReal_pos_iff.mp hp (if_neg hp'.1.ne').trans (if_neg hp'.2.ne) theorem dist_eq_iSup (f g : PiLp ∞ α) : dist f g = ⨆ i, dist (f i) (g i) := rfl end Dist section Norm variable [∀ i, Norm (β i)] /-- Endowing the space `PiLp p β` with the `L^p` norm. We register this instance separate from `PiLp.seminormedAddCommGroup` since the latter requires the type class hypothesis `[Fact (1 ≤ p)]` in order to prove the triangle inequality. Registering this separately allows for a future norm-like structure on `PiLp p β` for `p < 1` satisfying a relaxed triangle inequality. These are called *quasi-norms*. -/ instance instNorm : Norm (PiLp p β) where norm f := if p = 0 then {i | ‖f i‖ ≠ 0}.toFinite.toFinset.card else if p = ∞ then ⨆ i, ‖f i‖ else (∑ i, ‖f i‖ ^ p.toReal) ^ (1 / p.toReal) variable {p β} theorem norm_eq_card (f : PiLp 0 β) : ‖f‖ = {i | ‖f i‖ ≠ 0}.toFinite.toFinset.card := if_pos rfl theorem norm_eq_ciSup (f : PiLp ∞ β) : ‖f‖ = ⨆ i, ‖f i‖ := rfl theorem norm_eq_sum (hp : 0 < p.toReal) (f : PiLp p β) : ‖f‖ = (∑ i, ‖f i‖ ^ p.toReal) ^ (1 / p.toReal) := let hp' := ENNReal.toReal_pos_iff.mp hp (if_neg hp'.1.ne').trans (if_neg hp'.2.ne) end Norm end DistNorm section Aux /-! ### The uniformity on finite `L^p` products is the product uniformity In this section, we put the `L^p` edistance on `PiLp p α`, and we check that the uniformity coming from this edistance coincides with the product uniformity, by showing that the canonical map to the Pi type (with the `L^∞` distance) is a uniform embedding, as it is both Lipschitz and antiLipschitz. We only register this emetric space structure as a temporary instance, as the true instance (to be registered later) will have as uniformity exactly the product uniformity, instead of the one coming from the edistance (which is equal to it, but not defeq). See Note [forgetful inheritance] explaining why having definitionally the right uniformity is often important. -/ variable [Fact (1 ≤ p)] [∀ i, PseudoMetricSpace (α i)] [∀ i, PseudoEMetricSpace (β i)] variable [Fintype ι] /-- Endowing the space `PiLp p β` with the `L^p` pseudoemetric structure. This definition is not satisfactory, as it does not register the fact that the topology and the uniform structure coincide with the product one. Therefore, we do not register it as an instance. Using this as a temporary pseudoemetric space instance, we will show that the uniform structure is equal (but not defeq) to the product one, and then register an instance in which we replace the uniform structure by the product one using this pseudoemetric space and `PseudoEMetricSpace.replaceUniformity`. -/ def pseudoEmetricAux : PseudoEMetricSpace (PiLp p β) where edist_self := PiLp.edist_self p edist_comm := PiLp.edist_comm p edist_triangle f g h := by rcases p.dichotomy with (rfl | hp) · simp only [edist_eq_iSup] cases isEmpty_or_nonempty ι · simp only [ciSup_of_empty, ENNReal.bot_eq_zero, add_zero, nonpos_iff_eq_zero] -- Porting note: `le_iSup` needed some help refine iSup_le fun i => (edist_triangle _ (g i) _).trans <| add_le_add (le_iSup (fun k => edist (f k) (g k)) i) (le_iSup (fun k => edist (g k) (h k)) i) · simp only [edist_eq_sum (zero_lt_one.trans_le hp)] calc (∑ i, edist (f i) (h i) ^ p.toReal) ^ (1 / p.toReal) ≤ (∑ i, (edist (f i) (g i) + edist (g i) (h i)) ^ p.toReal) ^ (1 / p.toReal) := by gcongr apply edist_triangle _ ≤ (∑ i, edist (f i) (g i) ^ p.toReal) ^ (1 / p.toReal) + (∑ i, edist (g i) (h i) ^ p.toReal) ^ (1 / p.toReal) := ENNReal.Lp_add_le _ _ _ hp attribute [local instance] PiLp.pseudoEmetricAux /-- An auxiliary lemma used twice in the proof of `PiLp.pseudoMetricAux` below. Not intended for use outside this file. -/ theorem iSup_edist_ne_top_aux {ι : Type*} [Finite ι] {α : ι → Type*} [∀ i, PseudoMetricSpace (α i)] (f g : PiLp ∞ α) : (⨆ i, edist (f i) (g i)) ≠ ⊤ := by cases nonempty_fintype ι obtain ⟨M, hM⟩ := Finite.exists_le fun i => (⟨dist (f i) (g i), dist_nonneg⟩ : ℝ≥0) refine ne_of_lt ((iSup_le fun i => ?_).trans_lt (@ENNReal.coe_lt_top M)) simp only [edist, PseudoMetricSpace.edist_dist, ENNReal.ofReal_eq_coe_nnreal dist_nonneg] exact mod_cast hM i /-- Endowing the space `PiLp p α` with the `L^p` pseudometric structure. This definition is not satisfactory, as it does not register the fact that the topology, the uniform structure, and the bornology coincide with the product ones. Therefore, we do not register it as an instance. Using this as a temporary pseudoemetric space instance, we will show that the uniform structure is equal (but not defeq) to the product one, and then register an instance in which we replace the uniform structure and the bornology by the product ones using this pseudometric space, `PseudoMetricSpace.replaceUniformity`, and `PseudoMetricSpace.replaceBornology`. See note [reducible non-instances] -/ abbrev pseudoMetricAux : PseudoMetricSpace (PiLp p α) := PseudoEMetricSpace.toPseudoMetricSpaceOfDist dist (fun f g => by rcases p.dichotomy with (rfl | h) · exact iSup_edist_ne_top_aux f g · rw [edist_eq_sum (zero_lt_one.trans_le h)] exact ENNReal.rpow_ne_top_of_nonneg (one_div_nonneg.2 (zero_le_one.trans h)) (ne_of_lt <| ENNReal.sum_lt_top fun i hi => ENNReal.rpow_ne_top_of_nonneg (zero_le_one.trans h) (edist_ne_top _ _))) fun f g => by rcases p.dichotomy with (rfl | h) · rw [edist_eq_iSup, dist_eq_iSup] cases isEmpty_or_nonempty ι · simp only [Real.iSup_of_isEmpty, ciSup_of_empty, ENNReal.bot_eq_zero, ENNReal.zero_toReal] · refine le_antisymm (ciSup_le fun i => ?_) ?_ · rw [← ENNReal.ofReal_le_iff_le_toReal (iSup_edist_ne_top_aux f g), ← PseudoMetricSpace.edist_dist] -- Porting note: `le_iSup` needed some help exact le_iSup (fun k => edist (f k) (g k)) i · refine ENNReal.toReal_le_of_le_ofReal (Real.sSup_nonneg _ ?_) (iSup_le fun i => ?_) · rintro - ⟨i, rfl⟩ exact dist_nonneg · change PseudoMetricSpace.edist _ _ ≤ _ rw [PseudoMetricSpace.edist_dist] -- Porting note: `le_ciSup` needed some help exact ENNReal.ofReal_le_ofReal (le_ciSup (Finite.bddAbove_range (fun k => dist (f k) (g k))) i) · have A : ∀ i, edist (f i) (g i) ^ p.toReal ≠ ⊤ := fun i => ENNReal.rpow_ne_top_of_nonneg (zero_le_one.trans h) (edist_ne_top _ _) simp only [edist_eq_sum (zero_lt_one.trans_le h), dist_edist, ENNReal.toReal_rpow, dist_eq_sum (zero_lt_one.trans_le h), ← ENNReal.toReal_sum fun i _ => A i] attribute [local instance] PiLp.pseudoMetricAux theorem lipschitzWith_equiv_aux : LipschitzWith 1 (WithLp.equiv p (∀ i, β i)) := by intro x y simp_rw [ENNReal.coe_one, one_mul, edist_pi_def, Finset.sup_le_iff, Finset.mem_univ, forall_true_left, WithLp.equiv_pi_apply] rcases p.dichotomy with (rfl | h) · simpa only [edist_eq_iSup] using le_iSup fun i => edist (x i) (y i) · have cancel : p.toReal * (1 / p.toReal) = 1 := mul_div_cancel₀ 1 (zero_lt_one.trans_le h).ne' rw [edist_eq_sum (zero_lt_one.trans_le h)] intro i calc edist (x i) (y i) = (edist (x i) (y i) ^ p.toReal) ^ (1 / p.toReal) := by simp [← ENNReal.rpow_mul, cancel, -one_div] _ ≤ (∑ i, edist (x i) (y i) ^ p.toReal) ^ (1 / p.toReal) := by gcongr exact Finset.single_le_sum (fun i _ => (bot_le : (0 : ℝ≥0∞) ≤ _)) (Finset.mem_univ i) theorem antilipschitzWith_equiv_aux : AntilipschitzWith ((Fintype.card ι : ℝ≥0) ^ (1 / p).toReal) (WithLp.equiv p (∀ i, β i)) := by intro x y rcases p.dichotomy with (rfl | h) · simp only [edist_eq_iSup, ENNReal.div_top, ENNReal.zero_toReal, NNReal.rpow_zero, ENNReal.coe_one, one_mul, iSup_le_iff] -- Porting note: `Finset.le_sup` needed some help exact fun i => Finset.le_sup (f := fun i => edist (x i) (y i)) (Finset.mem_univ i) · have pos : 0 < p.toReal := zero_lt_one.trans_le h have nonneg : 0 ≤ 1 / p.toReal := one_div_nonneg.2 (le_of_lt pos) have cancel : p.toReal * (1 / p.toReal) = 1 := mul_div_cancel₀ 1 (ne_of_gt pos) rw [edist_eq_sum pos, ENNReal.toReal_div 1 p] simp only [edist, ← one_div, ENNReal.one_toReal] calc (∑ i, edist (x i) (y i) ^ p.toReal) ^ (1 / p.toReal) ≤ (∑ _i, edist (WithLp.equiv p _ x) (WithLp.equiv p _ y) ^ p.toReal) ^ (1 / p.toReal) := by gcongr with i exact Finset.le_sup (f := fun i => edist (x i) (y i)) (Finset.mem_univ i) _ = ((Fintype.card ι : ℝ≥0) ^ (1 / p.toReal) : ℝ≥0) * edist (WithLp.equiv p _ x) (WithLp.equiv p _ y) := by simp only [nsmul_eq_mul, Finset.card_univ, ENNReal.rpow_one, Finset.sum_const, ENNReal.mul_rpow_of_nonneg _ _ nonneg, ← ENNReal.rpow_mul, cancel] have : (Fintype.card ι : ℝ≥0∞) = (Fintype.card ι : ℝ≥0) := (ENNReal.coe_natCast (Fintype.card ι)).symm rw [this, ENNReal.coe_rpow_of_nonneg _ nonneg] theorem aux_uniformity_eq : 𝓤 (PiLp p β) = 𝓤[Pi.uniformSpace _] := by have A : UniformInducing (WithLp.equiv p (∀ i, β i)) := (antilipschitzWith_equiv_aux p β).uniformInducing (lipschitzWith_equiv_aux p β).uniformContinuous have : (fun x : PiLp p β × PiLp p β => (WithLp.equiv p _ x.fst, WithLp.equiv p _ x.snd)) = id := by ext i <;> rfl rw [← A.comap_uniformity, this, comap_id] theorem aux_cobounded_eq : cobounded (PiLp p α) = @cobounded _ Pi.instBornology := calc cobounded (PiLp p α) = comap (WithLp.equiv p (∀ i, α i)) (cobounded _) := le_antisymm (antilipschitzWith_equiv_aux p α).tendsto_cobounded.le_comap (lipschitzWith_equiv_aux p α).comap_cobounded_le _ = _ := comap_id end Aux /-! ### Instances on finite `L^p` products -/ instance uniformSpace [∀ i, UniformSpace (β i)] : UniformSpace (PiLp p β) := Pi.uniformSpace _ theorem uniformContinuous_equiv [∀ i, UniformSpace (β i)] : UniformContinuous (WithLp.equiv p (∀ i, β i)) := uniformContinuous_id theorem uniformContinuous_equiv_symm [∀ i, UniformSpace (β i)] : UniformContinuous (WithLp.equiv p (∀ i, β i)).symm := uniformContinuous_id @[continuity] theorem continuous_equiv [∀ i, UniformSpace (β i)] : Continuous (WithLp.equiv p (∀ i, β i)) := continuous_id @[continuity] theorem continuous_equiv_symm [∀ i, UniformSpace (β i)] : Continuous (WithLp.equiv p (∀ i, β i)).symm := continuous_id instance bornology [∀ i, Bornology (β i)] : Bornology (PiLp p β) := Pi.instBornology section Fintype variable [hp : Fact (1 ≤ p)] variable [Fintype ι] /-- pseudoemetric space instance on the product of finitely many pseudoemetric spaces, using the `L^p` pseudoedistance, and having as uniformity the product uniformity. -/ instance [∀ i, PseudoEMetricSpace (β i)] : PseudoEMetricSpace (PiLp p β) := (pseudoEmetricAux p β).replaceUniformity (aux_uniformity_eq p β).symm /-- emetric space instance on the product of finitely many emetric spaces, using the `L^p` edistance, and having as uniformity the product uniformity. -/ instance [∀ i, EMetricSpace (α i)] : EMetricSpace (PiLp p α) := @EMetricSpace.ofT0PseudoEMetricSpace (PiLp p α) _ Pi.instT0Space /-- pseudometric space instance on the product of finitely many pseudometric spaces, using the `L^p` distance, and having as uniformity the product uniformity. -/ instance [∀ i, PseudoMetricSpace (β i)] : PseudoMetricSpace (PiLp p β) := ((pseudoMetricAux p β).replaceUniformity (aux_uniformity_eq p β).symm).replaceBornology fun s => Filter.ext_iff.1 (aux_cobounded_eq p β).symm sᶜ /-- metric space instance on the product of finitely many metric spaces, using the `L^p` distance, and having as uniformity the product uniformity. -/ instance [∀ i, MetricSpace (α i)] : MetricSpace (PiLp p α) := MetricSpace.ofT0PseudoMetricSpace _ theorem nndist_eq_sum {p : ℝ≥0∞} [Fact (1 ≤ p)] {β : ι → Type*} [∀ i, PseudoMetricSpace (β i)] (hp : p ≠ ∞) (x y : PiLp p β) : nndist x y = (∑ i : ι, nndist (x i) (y i) ^ p.toReal) ^ (1 / p.toReal) := -- Porting note: was `Subtype.ext` NNReal.eq <| by push_cast exact dist_eq_sum (p.toReal_pos_iff_ne_top.mpr hp) _ _ theorem nndist_eq_iSup {β : ι → Type*} [∀ i, PseudoMetricSpace (β i)] (x y : PiLp ∞ β) : nndist x y = ⨆ i, nndist (x i) (y i) := -- Porting note: was `Subtype.ext` NNReal.eq <| by push_cast exact dist_eq_iSup _ _ theorem lipschitzWith_equiv [∀ i, PseudoEMetricSpace (β i)] : LipschitzWith 1 (WithLp.equiv p (∀ i, β i)) := lipschitzWith_equiv_aux p β theorem antilipschitzWith_equiv [∀ i, PseudoEMetricSpace (β i)] : AntilipschitzWith ((Fintype.card ι : ℝ≥0) ^ (1 / p).toReal) (WithLp.equiv p (∀ i, β i)) := antilipschitzWith_equiv_aux p β theorem infty_equiv_isometry [∀ i, PseudoEMetricSpace (β i)] : Isometry (WithLp.equiv ∞ (∀ i, β i)) := fun x y => le_antisymm (by simpa only [ENNReal.coe_one, one_mul] using lipschitzWith_equiv ∞ β x y) (by simpa only [ENNReal.div_top, ENNReal.zero_toReal, NNReal.rpow_zero, ENNReal.coe_one, one_mul] using antilipschitzWith_equiv ∞ β x y) /-- seminormed group instance on the product of finitely many normed groups, using the `L^p` norm. -/ instance seminormedAddCommGroup [∀ i, SeminormedAddCommGroup (β i)] : SeminormedAddCommGroup (PiLp p β) := { Pi.addCommGroup with dist_eq := fun x y => by rcases p.dichotomy with (rfl | h) · simp only [dist_eq_iSup, norm_eq_ciSup, dist_eq_norm, sub_apply] · have : p ≠ ∞ := by intro hp rw [hp, ENNReal.top_toReal] at h linarith simp only [dist_eq_sum (zero_lt_one.trans_le h), norm_eq_sum (zero_lt_one.trans_le h), dist_eq_norm, sub_apply] } /-- normed group instance on the product of finitely many normed groups, using the `L^p` norm. -/ instance normedAddCommGroup [∀ i, NormedAddCommGroup (α i)] : NormedAddCommGroup (PiLp p α) := { PiLp.seminormedAddCommGroup p α with eq_of_dist_eq_zero := eq_of_dist_eq_zero } theorem nnnorm_eq_sum {p : ℝ≥0∞} [Fact (1 ≤ p)] {β : ι → Type*} (hp : p ≠ ∞) [∀ i, SeminormedAddCommGroup (β i)] (f : PiLp p β) : ‖f‖₊ = (∑ i, ‖f i‖₊ ^ p.toReal) ^ (1 / p.toReal) := by ext simp [NNReal.coe_sum, norm_eq_sum (p.toReal_pos_iff_ne_top.mpr hp)] section Linfty variable {β} variable [∀ i, SeminormedAddCommGroup (β i)] theorem nnnorm_eq_ciSup (f : PiLp ∞ β) : ‖f‖₊ = ⨆ i, ‖f i‖₊ := by ext simp [NNReal.coe_iSup, norm_eq_ciSup] @[simp] theorem nnnorm_equiv (f : PiLp ∞ β) : ‖WithLp.equiv ⊤ _ f‖₊ = ‖f‖₊ := by rw [nnnorm_eq_ciSup, Pi.nnnorm_def, Finset.sup_univ_eq_ciSup] dsimp only [WithLp.equiv_pi_apply] @[simp] theorem nnnorm_equiv_symm (f : ∀ i, β i) : ‖(WithLp.equiv ⊤ _).symm f‖₊ = ‖f‖₊ := (nnnorm_equiv _).symm @[simp] theorem norm_equiv (f : PiLp ∞ β) : ‖WithLp.equiv ⊤ _ f‖ = ‖f‖ := congr_arg NNReal.toReal <| nnnorm_equiv f @[simp] theorem norm_equiv_symm (f : ∀ i, β i) : ‖(WithLp.equiv ⊤ _).symm f‖ = ‖f‖ := (norm_equiv _).symm end Linfty theorem norm_eq_of_nat {p : ℝ≥0∞} [Fact (1 ≤ p)] {β : ι → Type*} [∀ i, SeminormedAddCommGroup (β i)] (n : ℕ) (h : p = n) (f : PiLp p β) : ‖f‖ = (∑ i, ‖f i‖ ^ n) ^ (1 / (n : ℝ)) := by have := p.toReal_pos_iff_ne_top.mpr (ne_of_eq_of_ne h <| ENNReal.natCast_ne_top n) simp only [one_div, h, Real.rpow_natCast, ENNReal.toReal_nat, eq_self_iff_true, Finset.sum_congr, norm_eq_sum this] theorem norm_eq_of_L2 {β : ι → Type*} [∀ i, SeminormedAddCommGroup (β i)] (x : PiLp 2 β) : ‖x‖ = √(∑ i : ι, ‖x i‖ ^ 2) := by rw [norm_eq_of_nat 2 (by norm_cast) _] -- Porting note: was `convert` rw [Real.sqrt_eq_rpow] norm_cast theorem nnnorm_eq_of_L2 {β : ι → Type*} [∀ i, SeminormedAddCommGroup (β i)] (x : PiLp 2 β) : ‖x‖₊ = NNReal.sqrt (∑ i : ι, ‖x i‖₊ ^ 2) := -- Porting note: was `Subtype.ext` NNReal.eq <| by push_cast exact norm_eq_of_L2 x theorem norm_sq_eq_of_L2 (β : ι → Type*) [∀ i, SeminormedAddCommGroup (β i)] (x : PiLp 2 β) : ‖x‖ ^ 2 = ∑ i : ι, ‖x i‖ ^ 2 := by suffices ‖x‖₊ ^ 2 = ∑ i : ι, ‖x i‖₊ ^ 2 by simpa only [NNReal.coe_sum] using congr_arg ((↑) : ℝ≥0 → ℝ) this rw [nnnorm_eq_of_L2, NNReal.sq_sqrt] theorem dist_eq_of_L2 {β : ι → Type*} [∀ i, SeminormedAddCommGroup (β i)] (x y : PiLp 2 β) : dist x y = √(∑ i, dist (x i) (y i) ^ 2) := by simp_rw [dist_eq_norm, norm_eq_of_L2, sub_apply] theorem nndist_eq_of_L2 {β : ι → Type*} [∀ i, SeminormedAddCommGroup (β i)] (x y : PiLp 2 β) : nndist x y = NNReal.sqrt (∑ i, nndist (x i) (y i) ^ 2) := -- Porting note: was `Subtype.ext` NNReal.eq <| by push_cast exact dist_eq_of_L2 _ _ theorem edist_eq_of_L2 {β : ι → Type*} [∀ i, SeminormedAddCommGroup (β i)] (x y : PiLp 2 β) : edist x y = (∑ i, edist (x i) (y i) ^ 2) ^ (1 / 2 : ℝ) := by simp [PiLp.edist_eq_sum] instance instBoundedSMul [SeminormedRing 𝕜] [∀ i, SeminormedAddCommGroup (β i)] [∀ i, Module 𝕜 (β i)] [∀ i, BoundedSMul 𝕜 (β i)] : BoundedSMul 𝕜 (PiLp p β) := .of_nnnorm_smul_le fun c f => by rcases p.dichotomy with (rfl | hp) · rw [← nnnorm_equiv, ← nnnorm_equiv, WithLp.equiv_smul] exact nnnorm_smul_le c (WithLp.equiv ∞ (∀ i, β i) f) · have hp0 : 0 < p.toReal := zero_lt_one.trans_le hp have hpt : p ≠ ⊤ := p.toReal_pos_iff_ne_top.mp hp0 rw [nnnorm_eq_sum hpt, nnnorm_eq_sum hpt, one_div, NNReal.rpow_inv_le_iff hp0, NNReal.mul_rpow, ← NNReal.rpow_mul, inv_mul_cancel hp0.ne', NNReal.rpow_one, Finset.mul_sum] simp_rw [← NNReal.mul_rpow, smul_apply] exact Finset.sum_le_sum fun i _ => NNReal.rpow_le_rpow (nnnorm_smul_le _ _) hp0.le /-- The product of finitely many normed spaces is a normed space, with the `L^p` norm. -/ instance normedSpace [NormedField 𝕜] [∀ i, SeminormedAddCommGroup (β i)] [∀ i, NormedSpace 𝕜 (β i)] : NormedSpace 𝕜 (PiLp p β) where norm_smul_le := norm_smul_le variable {𝕜 p α} variable [Semiring 𝕜] [∀ i, SeminormedAddCommGroup (α i)] [∀ i, SeminormedAddCommGroup (β i)] variable [∀ i, Module 𝕜 (α i)] [∀ i, Module 𝕜 (β i)] (c : 𝕜) /-- The canonical map `WithLp.equiv` between `PiLp ∞ β` and `Π i, β i` as a linear isometric equivalence. -/ def equivₗᵢ : PiLp ∞ β ≃ₗᵢ[𝕜] ∀ i, β i := { WithLp.equiv ∞ (∀ i, β i) with map_add' := fun _f _g => rfl map_smul' := fun _c _f => rfl norm_map' := norm_equiv } section piLpCongrLeft variable {ι' : Type*} variable [Fintype ι'] variable (p 𝕜) variable (E : Type*) [SeminormedAddCommGroup E] [Module 𝕜 E] /-- An equivalence of finite domains induces a linearly isometric equivalence of finitely supported functions-/ def _root_.LinearIsometryEquiv.piLpCongrLeft (e : ι ≃ ι') : (PiLp p fun _ : ι => E) ≃ₗᵢ[𝕜] PiLp p fun _ : ι' => E where toLinearEquiv := LinearEquiv.piCongrLeft' 𝕜 (fun _ : ι => E) e norm_map' x' := by rcases p.dichotomy with (rfl | h) · simp_rw [norm_eq_ciSup] exact e.symm.iSup_congr fun _ => rfl · simp only [norm_eq_sum (zero_lt_one.trans_le h)] congr 1 exact Fintype.sum_equiv e.symm _ _ fun _ => rfl variable {p 𝕜 E} @[simp] theorem _root_.LinearIsometryEquiv.piLpCongrLeft_apply (e : ι ≃ ι') (v : PiLp p fun _ : ι => E) : LinearIsometryEquiv.piLpCongrLeft p 𝕜 E e v = Equiv.piCongrLeft' (fun _ : ι => E) e v := rfl @[simp] theorem _root_.LinearIsometryEquiv.piLpCongrLeft_symm (e : ι ≃ ι') : (LinearIsometryEquiv.piLpCongrLeft p 𝕜 E e).symm = LinearIsometryEquiv.piLpCongrLeft p 𝕜 E e.symm := LinearIsometryEquiv.ext fun z => by -- Porting note: was `rfl` simp only [LinearIsometryEquiv.piLpCongrLeft, LinearIsometryEquiv.symm, LinearIsometryEquiv.coe_mk] unfold PiLp WithLp ext simp only [LinearEquiv.piCongrLeft'_symm_apply, eq_rec_constant, LinearEquiv.piCongrLeft'_apply, Equiv.symm_symm_apply] @[simp high] theorem _root_.LinearIsometryEquiv.piLpCongrLeft_single [DecidableEq ι] [DecidableEq ι'] (e : ι ≃ ι') (i : ι) (v : E) : LinearIsometryEquiv.piLpCongrLeft p 𝕜 E e ((WithLp.equiv p (_ → E)).symm <| Pi.single i v) = (WithLp.equiv p (_ → E)).symm (Pi.single (e i) v) := by funext x simp [LinearIsometryEquiv.piLpCongrLeft_apply, LinearEquiv.piCongrLeft', Equiv.piCongrLeft', Pi.single, Function.update, Equiv.symm_apply_eq] end piLpCongrLeft section piLpCongrRight variable {β} variable (p) in /-- A family of linearly isometric equivalences in the codomain induces an isometric equivalence between Pi types with the Lp norm. This is the isometry version of `LinearEquiv.piCongrRight`. -/ protected def _root_.LinearIsometryEquiv.piLpCongrRight (e : ∀ i, α i ≃ₗᵢ[𝕜] β i) : PiLp p α ≃ₗᵢ[𝕜] PiLp p β where toLinearEquiv := WithLp.linearEquiv _ _ _ ≪≫ₗ (LinearEquiv.piCongrRight fun i => (e i).toLinearEquiv) ≪≫ₗ (WithLp.linearEquiv _ _ _).symm norm_map' := (WithLp.linearEquiv p 𝕜 _).symm.surjective.forall.2 fun x => by simp only [LinearEquiv.trans_apply, LinearEquiv.piCongrRight_apply, Equiv.apply_symm_apply, WithLp.linearEquiv_symm_apply, WithLp.linearEquiv_apply] obtain rfl | hp := p.dichotomy · simp_rw [PiLp.norm_equiv_symm, Pi.norm_def, LinearEquiv.piCongrRight_apply, LinearIsometryEquiv.coe_toLinearEquiv, LinearIsometryEquiv.nnnorm_map] · have : 0 < p.toReal := zero_lt_one.trans_le <| by norm_cast simp only [PiLp.norm_eq_sum this, WithLp.equiv_symm_pi_apply, LinearEquiv.piCongrRight_apply, LinearIsometryEquiv.coe_toLinearEquiv, LinearIsometryEquiv.norm_map] @[simp] theorem _root_.LinearIsometryEquiv.piLpCongrRight_apply (e : ∀ i, α i ≃ₗᵢ[𝕜] β i) (x : PiLp p α) : LinearIsometryEquiv.piLpCongrRight p e x = (WithLp.equiv p _).symm (fun i => e i (x i)) := rfl @[simp] theorem _root_.LinearIsometryEquiv.piLpCongrRight_refl : LinearIsometryEquiv.piLpCongrRight p (fun i => .refl 𝕜 (α i)) = .refl _ _ := rfl @[simp] theorem _root_.LinearIsometryEquiv.piLpCongrRight_symm (e : ∀ i, α i ≃ₗᵢ[𝕜] β i) : (LinearIsometryEquiv.piLpCongrRight p e).symm = LinearIsometryEquiv.piLpCongrRight p (fun i => (e i).symm) := rfl @[simp high] theorem _root_.LinearIsometryEquiv.piLpCongrRight_single (e : ∀ i, α i ≃ₗᵢ[𝕜] β i) [DecidableEq ι] (i : ι) (v : α i) : LinearIsometryEquiv.piLpCongrRight p e ((WithLp.equiv p (∀ i, α i)).symm <| Pi.single i v) = (WithLp.equiv p (∀ i, β i)).symm (Pi.single i (e _ v)) := funext <| Pi.apply_single (e ·) (fun _ => map_zero _) _ _ end piLpCongrRight section piLpCurry variable {ι : Type*} {κ : ι → Type*} (p : ℝ≥0∞) [Fact (1 ≤ p)] [Fintype ι] [∀ i, Fintype (κ i)] (α : ∀ i, κ i → Type*) [∀ i k, SeminormedAddCommGroup (α i k)] [∀ i k, Module 𝕜 (α i k)] variable (𝕜) in /-- `LinearEquiv.piCurry` for `PiLp`, as an isometry. -/ def _root_.LinearIsometryEquiv.piLpCurry : PiLp p (fun i : Sigma _ => α i.1 i.2) ≃ₗᵢ[𝕜] PiLp p (fun i => PiLp p (α i)) where toLinearEquiv := WithLp.linearEquiv _ _ _ ≪≫ₗ LinearEquiv.piCurry 𝕜 α ≪≫ₗ (LinearEquiv.piCongrRight fun i => (WithLp.linearEquiv _ _ _).symm) ≪≫ₗ (WithLp.linearEquiv _ _ _).symm norm_map' := (WithLp.equiv p _).symm.surjective.forall.2 fun x => by simp_rw [← coe_nnnorm, NNReal.coe_inj] obtain rfl | hp := eq_or_ne p ⊤ · simp_rw [← PiLp.nnnorm_equiv, Pi.nnnorm_def, ← PiLp.nnnorm_equiv, Pi.nnnorm_def] dsimp [Sigma.curry] rw [← Finset.univ_sigma_univ, Finset.sup_sigma] · have : 0 < p.toReal := (toReal_pos_iff_ne_top _).mpr hp simp_rw [PiLp.nnnorm_eq_sum hp, WithLp.equiv_symm_pi_apply] dsimp [Sigma.curry] simp_rw [one_div, NNReal.rpow_inv_rpow this.ne', ← Finset.univ_sigma_univ, Finset.sum_sigma] @[simp] theorem _root_.LinearIsometryEquiv.piLpCurry_apply (f : PiLp p (fun i : Sigma κ => α i.1 i.2)) : _root_.LinearIsometryEquiv.piLpCurry 𝕜 p α f = (WithLp.equiv _ _).symm (fun i => (WithLp.equiv _ _).symm <| Sigma.curry (WithLp.equiv _ _ f) i) := rfl @[simp] theorem _root_.LinearIsometryEquiv.piLpCurry_symm_apply (f : PiLp p (fun i => PiLp p (α i))) : (_root_.LinearIsometryEquiv.piLpCurry 𝕜 p α).symm f = (WithLp.equiv _ _).symm (Sigma.uncurry fun i j => f i j) := rfl end piLpCurry section Single variable (p) variable [DecidableEq ι] -- Porting note: added `hp` @[simp] theorem nnnorm_equiv_symm_single (i : ι) (b : β i) : ‖(WithLp.equiv p (∀ i, β i)).symm (Pi.single i b)‖₊ = ‖b‖₊ := by haveI : Nonempty ι := ⟨i⟩ induction p generalizing hp with | top => simp_rw [nnnorm_eq_ciSup, WithLp.equiv_symm_pi_apply] refine ciSup_eq_of_forall_le_of_forall_lt_exists_gt (fun j => ?_) fun n hn => ⟨i, hn.trans_eq ?_⟩ · obtain rfl | hij := Decidable.eq_or_ne i j · rw [Pi.single_eq_same] · rw [Pi.single_eq_of_ne' hij, nnnorm_zero] exact zero_le _ · rw [Pi.single_eq_same] | coe p => have hp0 : (p : ℝ) ≠ 0 := mod_cast (zero_lt_one.trans_le <| Fact.out (p := 1 ≤ (p : ℝ≥0∞))).ne' rw [nnnorm_eq_sum ENNReal.coe_ne_top, ENNReal.coe_toReal, Fintype.sum_eq_single i, WithLp.equiv_symm_pi_apply, Pi.single_eq_same, ← NNReal.rpow_mul, one_div, mul_inv_cancel hp0, NNReal.rpow_one] intro j hij rw [WithLp.equiv_symm_pi_apply, Pi.single_eq_of_ne hij, nnnorm_zero, NNReal.zero_rpow hp0] @[simp] theorem norm_equiv_symm_single (i : ι) (b : β i) : ‖(WithLp.equiv p (∀ i, β i)).symm (Pi.single i b)‖ = ‖b‖ := congr_arg ((↑) : ℝ≥0 → ℝ) <| nnnorm_equiv_symm_single p β i b @[simp] theorem nndist_equiv_symm_single_same (i : ι) (b₁ b₂ : β i) : nndist ((WithLp.equiv p (∀ i, β i)).symm (Pi.single i b₁)) ((WithLp.equiv p (∀ i, β i)).symm (Pi.single i b₂)) = nndist b₁ b₂ := by rw [nndist_eq_nnnorm, nndist_eq_nnnorm, ← WithLp.equiv_symm_sub, ← Pi.single_sub, nnnorm_equiv_symm_single] @[simp] theorem dist_equiv_symm_single_same (i : ι) (b₁ b₂ : β i) : dist ((WithLp.equiv p (∀ i, β i)).symm (Pi.single i b₁)) ((WithLp.equiv p (∀ i, β i)).symm (Pi.single i b₂)) = dist b₁ b₂ := congr_arg ((↑) : ℝ≥0 → ℝ) <| nndist_equiv_symm_single_same p β i b₁ b₂ @[simp] theorem edist_equiv_symm_single_same (i : ι) (b₁ b₂ : β i) : edist ((WithLp.equiv p (∀ i, β i)).symm (Pi.single i b₁)) ((WithLp.equiv p (∀ i, β i)).symm (Pi.single i b₂)) = edist b₁ b₂ := by -- Porting note: was `simpa using` simp only [edist_nndist, nndist_equiv_symm_single_same p β i b₁ b₂] end Single /-- When `p = ∞`, this lemma does not hold without the additional assumption `Nonempty ι` because the left-hand side simplifies to `0`, while the right-hand side simplifies to `‖b‖₊`. See `PiLp.nnnorm_equiv_symm_const'` for a version which exchanges the hypothesis `p ≠ ∞` for `Nonempty ι`. -/ theorem nnnorm_equiv_symm_const {β} [SeminormedAddCommGroup β] (hp : p ≠ ∞) (b : β) : ‖(WithLp.equiv p (ι → β)).symm (Function.const _ b)‖₊ = (Fintype.card ι : ℝ≥0) ^ (1 / p).toReal * ‖b‖₊ := by rcases p.dichotomy with (h | h) · exact False.elim (hp h) · have ne_zero : p.toReal ≠ 0 := (zero_lt_one.trans_le h).ne' simp_rw [nnnorm_eq_sum hp, WithLp.equiv_symm_pi_apply, Function.const_apply, Finset.sum_const, Finset.card_univ, nsmul_eq_mul, NNReal.mul_rpow, ← NNReal.rpow_mul, mul_one_div_cancel ne_zero, NNReal.rpow_one, ENNReal.toReal_div, ENNReal.one_toReal] /-- When `IsEmpty ι`, this lemma does not hold without the additional assumption `p ≠ ∞` because the left-hand side simplifies to `0`, while the right-hand side simplifies to `‖b‖₊`. See `PiLp.nnnorm_equiv_symm_const` for a version which exchanges the hypothesis `Nonempty ι`. for `p ≠ ∞`. -/ theorem nnnorm_equiv_symm_const' {β} [SeminormedAddCommGroup β] [Nonempty ι] (b : β) : ‖(WithLp.equiv p (ι → β)).symm (Function.const _ b)‖₊ = (Fintype.card ι : ℝ≥0) ^ (1 / p).toReal * ‖b‖₊ := by rcases em <| p = ∞ with (rfl | hp) · simp only [WithLp.equiv_symm_pi_apply, ENNReal.div_top, ENNReal.zero_toReal, NNReal.rpow_zero, one_mul, nnnorm_eq_ciSup, Function.const_apply, ciSup_const] · exact nnnorm_equiv_symm_const hp b /-- When `p = ∞`, this lemma does not hold without the additional assumption `Nonempty ι` because the left-hand side simplifies to `0`, while the right-hand side simplifies to `‖b‖₊`. See `PiLp.norm_equiv_symm_const'` for a version which exchanges the hypothesis `p ≠ ∞` for `Nonempty ι`. -/ theorem norm_equiv_symm_const {β} [SeminormedAddCommGroup β] (hp : p ≠ ∞) (b : β) : ‖(WithLp.equiv p (ι → β)).symm (Function.const _ b)‖ = (Fintype.card ι : ℝ≥0) ^ (1 / p).toReal * ‖b‖ := (congr_arg ((↑) : ℝ≥0 → ℝ) <| nnnorm_equiv_symm_const hp b).trans <| by simp /-- When `IsEmpty ι`, this lemma does not hold without the additional assumption `p ≠ ∞` because the left-hand side simplifies to `0`, while the right-hand side simplifies to `‖b‖₊`. See `PiLp.norm_equiv_symm_const` for a version which exchanges the hypothesis `Nonempty ι`. for `p ≠ ∞`. -/ theorem norm_equiv_symm_const' {β} [SeminormedAddCommGroup β] [Nonempty ι] (b : β) : ‖(WithLp.equiv p (ι → β)).symm (Function.const _ b)‖ = (Fintype.card ι : ℝ≥0) ^ (1 / p).toReal * ‖b‖ := (congr_arg ((↑) : ℝ≥0 → ℝ) <| nnnorm_equiv_symm_const' b).trans <| by simp theorem nnnorm_equiv_symm_one {β} [SeminormedAddCommGroup β] (hp : p ≠ ∞) [One β] : ‖(WithLp.equiv p (ι → β)).symm 1‖₊ = (Fintype.card ι : ℝ≥0) ^ (1 / p).toReal * ‖(1 : β)‖₊ := (nnnorm_equiv_symm_const hp (1 : β)).trans rfl theorem norm_equiv_symm_one {β} [SeminormedAddCommGroup β] (hp : p ≠ ∞) [One β] : ‖(WithLp.equiv p (ι → β)).symm 1‖ = (Fintype.card ι : ℝ≥0) ^ (1 / p).toReal * ‖(1 : β)‖ := (norm_equiv_symm_const hp (1 : β)).trans rfl variable (𝕜 p) /-- `WithLp.equiv` as a continuous linear equivalence. -/ @[simps! (config := .asFn) apply symm_apply] protected def continuousLinearEquiv : PiLp p β ≃L[𝕜] ∀ i, β i where toLinearEquiv := WithLp.linearEquiv _ _ _ continuous_toFun := continuous_equiv _ _ continuous_invFun := continuous_equiv_symm _ _ end Fintype section Basis variable [Finite ι] [Ring 𝕜] variable (ι) /-- A version of `Pi.basisFun` for `PiLp`. -/ def basisFun : Basis ι 𝕜 (PiLp p fun _ : ι => 𝕜) := Basis.ofEquivFun (WithLp.linearEquiv p 𝕜 (ι → 𝕜)) @[simp] theorem basisFun_apply [DecidableEq ι] (i) : basisFun p 𝕜 ι i = (WithLp.equiv p _).symm (Pi.single i 1) := by simp_rw [basisFun, Basis.coe_ofEquivFun, WithLp.linearEquiv_symm_apply, Pi.single] @[simp] theorem basisFun_repr (x : PiLp p fun _ : ι => 𝕜) (i : ι) : (basisFun p 𝕜 ι).repr x i = x i := rfl @[simp] theorem basisFun_equivFun : (basisFun p 𝕜 ι).equivFun = WithLp.linearEquiv p 𝕜 (ι → 𝕜) := Basis.equivFun_ofEquivFun _ theorem basisFun_eq_pi_basisFun : basisFun p 𝕜 ι = (Pi.basisFun 𝕜 ι).map (WithLp.linearEquiv p 𝕜 (ι → 𝕜)).symm := rfl @[simp] theorem basisFun_map : (basisFun p 𝕜 ι).map (WithLp.linearEquiv p 𝕜 (ι → 𝕜)) = Pi.basisFun 𝕜 ι := rfl end Basis open Matrix nonrec theorem basis_toMatrix_basisFun_mul [Fintype ι] {𝕜} [SeminormedCommRing 𝕜] (b : Basis ι 𝕜 (PiLp p fun _ : ι => 𝕜)) (A : Matrix ι ι 𝕜) : b.toMatrix (PiLp.basisFun _ _ _) * A = Matrix.of fun i j => b.repr ((WithLp.equiv _ _).symm (Aᵀ j)) i := by have := basis_toMatrix_basisFun_mul (b.map (WithLp.linearEquiv _ 𝕜 _)) A simp_rw [← PiLp.basisFun_map p, Basis.map_repr, LinearEquiv.trans_apply, WithLp.linearEquiv_symm_apply, Basis.toMatrix_map, Function.comp, Basis.map_apply, LinearEquiv.symm_apply_apply] at this exact this end PiLp
Analysis\Normed\Lp\ProdLp.lean
/- Copyright (c) 2023 Moritz Doll. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Moritz Doll, Sébastien Gouëzel, Jireh Loreaux -/ import Mathlib.Analysis.MeanInequalities import Mathlib.Analysis.Normed.Lp.WithLp /-! # `L^p` distance on products of two metric spaces Given two metric spaces, one can put the max distance on their product, but there is also a whole family of natural distances, indexed by a parameter `p : ℝ≥0∞`, that also induce the product topology. We define them in this file. For `0 < p < ∞`, the distance on `α × β` is given by $$ d(x, y) = \left(d(x_1, y_1)^p + d(x_2, y_2)^p\right)^{1/p}. $$ For `p = ∞` the distance is the supremum of the distances and `p = 0` the distance is the cardinality of the elements that are not equal. We give instances of this construction for emetric spaces, metric spaces, normed groups and normed spaces. To avoid conflicting instances, all these are defined on a copy of the original Prod-type, named `WithLp p (α × β)`. The assumption `[Fact (1 ≤ p)]` is required for the metric and normed space instances. We ensure that the topology, bornology and uniform structure on `WithLp p (α × β)` are (defeq to) the product topology, product bornology and product uniformity, to be able to use freely continuity statements for the coordinate functions, for instance. # Implementation notes This file is a straight-forward adaptation of `Mathlib.Analysis.Normed.Lp.PiLp`. -/ open Real Set Filter RCLike Bornology Uniformity Topology NNReal ENNReal noncomputable section variable (p : ℝ≥0∞) (𝕜 α β : Type*) namespace WithLp section algebra /- Register simplification lemmas for the applications of `WithLp p (α × β)` elements, as the usual lemmas for `Prod` will not trigger. -/ variable {p 𝕜 α β} variable [Semiring 𝕜] [AddCommGroup α] [AddCommGroup β] variable (x y : WithLp p (α × β)) (c : 𝕜) @[simp] theorem zero_fst : (0 : WithLp p (α × β)).fst = 0 := rfl @[simp] theorem zero_snd : (0 : WithLp p (α × β)).snd = 0 := rfl @[simp] theorem add_fst : (x + y).fst = x.fst + y.fst := rfl @[simp] theorem add_snd : (x + y).snd = x.snd + y.snd := rfl @[simp] theorem sub_fst : (x - y).fst = x.fst - y.fst := rfl @[simp] theorem sub_snd : (x - y).snd = x.snd - y.snd := rfl @[simp] theorem neg_fst : (-x).fst = -x.fst := rfl @[simp] theorem neg_snd : (-x).snd = -x.snd := rfl variable [Module 𝕜 α] [Module 𝕜 β] @[simp] theorem smul_fst : (c • x).fst = c • x.fst := rfl @[simp] theorem smul_snd : (c • x).snd = c • x.snd := rfl end algebra /-! Note that the unapplied versions of these lemmas are deliberately omitted, as they break the use of the type synonym. -/ section equiv variable {p α β} @[simp] theorem equiv_fst (x : WithLp p (α × β)) : (WithLp.equiv p (α × β) x).fst = x.fst := rfl @[simp] theorem equiv_snd (x : WithLp p (α × β)) : (WithLp.equiv p (α × β) x).snd = x.snd := rfl @[simp] theorem equiv_symm_fst (x : α × β) : ((WithLp.equiv p (α × β)).symm x).fst = x.fst := rfl @[simp] theorem equiv_symm_snd (x : α × β) : ((WithLp.equiv p (α × β)).symm x).snd = x.snd := rfl end equiv section DistNorm /-! ### Definition of `edist`, `dist` and `norm` on `WithLp p (α × β)` In this section we define the `edist`, `dist` and `norm` functions on `WithLp p (α × β)` without assuming `[Fact (1 ≤ p)]` or metric properties of the spaces `α` and `β`. This allows us to provide the rewrite lemmas for each of three cases `p = 0`, `p = ∞` and `0 < p.toReal`. -/ section EDist variable [EDist α] [EDist β] open scoped Classical in /-- Endowing the space `WithLp p (α × β)` with the `L^p` edistance. We register this instance separate from `WithLp.instProdPseudoEMetric` since the latter requires the type class hypothesis `[Fact (1 ≤ p)]` in order to prove the triangle inequality. Registering this separately allows for a future emetric-like structure on `WithLp p (α × β)` for `p < 1` satisfying a relaxed triangle inequality. The terminology for this varies throughout the literature, but it is sometimes called a *quasi-metric* or *semi-metric*. -/ instance instProdEDist : EDist (WithLp p (α × β)) where edist f g := if _hp : p = 0 then (if edist f.fst g.fst = 0 then 0 else 1) + (if edist f.snd g.snd = 0 then 0 else 1) else if p = ∞ then edist f.fst g.fst ⊔ edist f.snd g.snd else (edist f.fst g.fst ^ p.toReal + edist f.snd g.snd ^ p.toReal) ^ (1 / p.toReal) variable {p α β} variable (x y : WithLp p (α × β)) (x' : α × β) @[simp] theorem prod_edist_eq_card (f g : WithLp 0 (α × β)) : edist f g = (if edist f.fst g.fst = 0 then 0 else 1) + (if edist f.snd g.snd = 0 then 0 else 1) := by convert if_pos rfl theorem prod_edist_eq_add (hp : 0 < p.toReal) (f g : WithLp p (α × β)) : edist f g = (edist f.fst g.fst ^ p.toReal + edist f.snd g.snd ^ p.toReal) ^ (1 / p.toReal) := let hp' := ENNReal.toReal_pos_iff.mp hp (if_neg hp'.1.ne').trans (if_neg hp'.2.ne) theorem prod_edist_eq_sup (f g : WithLp ∞ (α × β)) : edist f g = edist f.fst g.fst ⊔ edist f.snd g.snd := rfl end EDist section EDistProp variable {α β} variable [PseudoEMetricSpace α] [PseudoEMetricSpace β] /-- The distance from one point to itself is always zero. This holds independent of `p` and does not require `[Fact (1 ≤ p)]`. We keep it separate from `WithLp.instProdPseudoEMetricSpace` so it can be used also for `p < 1`. -/ theorem prod_edist_self (f : WithLp p (α × β)) : edist f f = 0 := by rcases p.trichotomy with (rfl | rfl | h) · classical simp · simp [prod_edist_eq_sup] · simp [prod_edist_eq_add h, ENNReal.zero_rpow_of_pos h, ENNReal.zero_rpow_of_pos (inv_pos.2 <| h)] /-- The distance is symmetric. This holds independent of `p` and does not require `[Fact (1 ≤ p)]`. We keep it separate from `WithLp.instProdPseudoEMetricSpace` so it can be used also for `p < 1`. -/ theorem prod_edist_comm (f g : WithLp p (α × β)) : edist f g = edist g f := by classical rcases p.trichotomy with (rfl | rfl | h) · simp only [prod_edist_eq_card, edist_comm] · simp only [prod_edist_eq_sup, edist_comm] · simp only [prod_edist_eq_add h, edist_comm] end EDistProp section Dist variable [Dist α] [Dist β] open scoped Classical in /-- Endowing the space `WithLp p (α × β)` with the `L^p` distance. We register this instance separate from `WithLp.instProdPseudoMetricSpace` since the latter requires the type class hypothesis `[Fact (1 ≤ p)]` in order to prove the triangle inequality. Registering this separately allows for a future metric-like structure on `WithLp p (α × β)` for `p < 1` satisfying a relaxed triangle inequality. The terminology for this varies throughout the literature, but it is sometimes called a *quasi-metric* or *semi-metric*. -/ instance instProdDist : Dist (WithLp p (α × β)) where dist f g := if _hp : p = 0 then (if dist f.fst g.fst = 0 then 0 else 1) + (if dist f.snd g.snd = 0 then 0 else 1) else if p = ∞ then dist f.fst g.fst ⊔ dist f.snd g.snd else (dist f.fst g.fst ^ p.toReal + dist f.snd g.snd ^ p.toReal) ^ (1 / p.toReal) variable {p α β} theorem prod_dist_eq_card (f g : WithLp 0 (α × β)) : dist f g = (if dist f.fst g.fst = 0 then 0 else 1) + (if dist f.snd g.snd = 0 then 0 else 1) := by convert if_pos rfl theorem prod_dist_eq_add (hp : 0 < p.toReal) (f g : WithLp p (α × β)) : dist f g = (dist f.fst g.fst ^ p.toReal + dist f.snd g.snd ^ p.toReal) ^ (1 / p.toReal) := let hp' := ENNReal.toReal_pos_iff.mp hp (if_neg hp'.1.ne').trans (if_neg hp'.2.ne) theorem prod_dist_eq_sup (f g : WithLp ∞ (α × β)) : dist f g = dist f.fst g.fst ⊔ dist f.snd g.snd := rfl end Dist section Norm variable [Norm α] [Norm β] open scoped Classical in /-- Endowing the space `WithLp p (α × β)` with the `L^p` norm. We register this instance separate from `WithLp.instProdSeminormedAddCommGroup` since the latter requires the type class hypothesis `[Fact (1 ≤ p)]` in order to prove the triangle inequality. Registering this separately allows for a future norm-like structure on `WithLp p (α × β)` for `p < 1` satisfying a relaxed triangle inequality. These are called *quasi-norms*. -/ instance instProdNorm : Norm (WithLp p (α × β)) where norm f := if _hp : p = 0 then (if ‖f.fst‖ = 0 then 0 else 1) + (if ‖f.snd‖ = 0 then 0 else 1) else if p = ∞ then ‖f.fst‖ ⊔ ‖f.snd‖ else (‖f.fst‖ ^ p.toReal + ‖f.snd‖ ^ p.toReal) ^ (1 / p.toReal) variable {p α β} @[simp] theorem prod_norm_eq_card (f : WithLp 0 (α × β)) : ‖f‖ = (if ‖f.fst‖ = 0 then 0 else 1) + (if ‖f.snd‖ = 0 then 0 else 1) := by convert if_pos rfl theorem prod_norm_eq_sup (f : WithLp ∞ (α × β)) : ‖f‖ = ‖f.fst‖ ⊔ ‖f.snd‖ := rfl theorem prod_norm_eq_add (hp : 0 < p.toReal) (f : WithLp p (α × β)) : ‖f‖ = (‖f.fst‖ ^ p.toReal + ‖f.snd‖ ^ p.toReal) ^ (1 / p.toReal) := let hp' := ENNReal.toReal_pos_iff.mp hp (if_neg hp'.1.ne').trans (if_neg hp'.2.ne) end Norm end DistNorm section Aux /-! ### The uniformity on finite `L^p` products is the product uniformity In this section, we put the `L^p` edistance on `WithLp p (α × β)`, and we check that the uniformity coming from this edistance coincides with the product uniformity, by showing that the canonical map to the Prod type (with the `L^∞` distance) is a uniform embedding, as it is both Lipschitz and antiLipschitz. We only register this emetric space structure as a temporary instance, as the true instance (to be registered later) will have as uniformity exactly the product uniformity, instead of the one coming from the edistance (which is equal to it, but not defeq). See Note [forgetful inheritance] explaining why having definitionally the right uniformity is often important. -/ variable [hp : Fact (1 ≤ p)] /-- Endowing the space `WithLp p (α × β)` with the `L^p` pseudoemetric structure. This definition is not satisfactory, as it does not register the fact that the topology and the uniform structure coincide with the product one. Therefore, we do not register it as an instance. Using this as a temporary pseudoemetric space instance, we will show that the uniform structure is equal (but not defeq) to the product one, and then register an instance in which we replace the uniform structure by the product one using this pseudoemetric space and `PseudoEMetricSpace.replaceUniformity`. -/ def prodPseudoEMetricAux [PseudoEMetricSpace α] [PseudoEMetricSpace β] : PseudoEMetricSpace (WithLp p (α × β)) where edist_self := prod_edist_self p edist_comm := prod_edist_comm p edist_triangle f g h := by rcases p.dichotomy with (rfl | hp) · simp only [prod_edist_eq_sup] exact sup_le ((edist_triangle _ g.fst _).trans <| add_le_add le_sup_left le_sup_left) ((edist_triangle _ g.snd _).trans <| add_le_add le_sup_right le_sup_right) · simp only [prod_edist_eq_add (zero_lt_one.trans_le hp)] calc (edist f.fst h.fst ^ p.toReal + edist f.snd h.snd ^ p.toReal) ^ (1 / p.toReal) ≤ ((edist f.fst g.fst + edist g.fst h.fst) ^ p.toReal + (edist f.snd g.snd + edist g.snd h.snd) ^ p.toReal) ^ (1 / p.toReal) := by gcongr <;> apply edist_triangle _ ≤ (edist f.fst g.fst ^ p.toReal + edist f.snd g.snd ^ p.toReal) ^ (1 / p.toReal) + (edist g.fst h.fst ^ p.toReal + edist g.snd h.snd ^ p.toReal) ^ (1 / p.toReal) := by have := ENNReal.Lp_add_le {0, 1} (if · = 0 then edist f.fst g.fst else edist f.snd g.snd) (if · = 0 then edist g.fst h.fst else edist g.snd h.snd) hp simp only [Finset.mem_singleton, not_false_eq_true, Finset.sum_insert, Finset.sum_singleton] at this exact this attribute [local instance] WithLp.prodPseudoEMetricAux variable {α β} /-- An auxiliary lemma used twice in the proof of `WithLp.prodPseudoMetricAux` below. Not intended for use outside this file. -/ theorem prod_sup_edist_ne_top_aux [PseudoMetricSpace α] [PseudoMetricSpace β] (f g : WithLp ∞ (α × β)) : edist f.fst g.fst ⊔ edist f.snd g.snd ≠ ⊤ := ne_of_lt <| by simp [edist, PseudoMetricSpace.edist_dist] variable (α β) /-- Endowing the space `WithLp p (α × β)` with the `L^p` pseudometric structure. This definition is not satisfactory, as it does not register the fact that the topology, the uniform structure, and the bornology coincide with the product ones. Therefore, we do not register it as an instance. Using this as a temporary pseudoemetric space instance, we will show that the uniform structure is equal (but not defeq) to the product one, and then register an instance in which we replace the uniform structure and the bornology by the product ones using this pseudometric space, `PseudoMetricSpace.replaceUniformity`, and `PseudoMetricSpace.replaceBornology`. See note [reducible non-instances] -/ abbrev prodPseudoMetricAux [PseudoMetricSpace α] [PseudoMetricSpace β] : PseudoMetricSpace (WithLp p (α × β)) := PseudoEMetricSpace.toPseudoMetricSpaceOfDist dist (fun f g => by rcases p.dichotomy with (rfl | h) · exact prod_sup_edist_ne_top_aux f g · rw [prod_edist_eq_add (zero_lt_one.trans_le h)] refine ENNReal.rpow_ne_top_of_nonneg (by positivity) (ne_of_lt ?_) simp [ENNReal.add_lt_top, ENNReal.rpow_lt_top_of_nonneg, edist_ne_top] ) fun f g => by rcases p.dichotomy with (rfl | h) · rw [prod_edist_eq_sup, prod_dist_eq_sup] refine le_antisymm (sup_le ?_ ?_) ?_ · rw [← ENNReal.ofReal_le_iff_le_toReal (prod_sup_edist_ne_top_aux f g), ← PseudoMetricSpace.edist_dist] exact le_sup_left · rw [← ENNReal.ofReal_le_iff_le_toReal (prod_sup_edist_ne_top_aux f g), ← PseudoMetricSpace.edist_dist] exact le_sup_right · refine ENNReal.toReal_le_of_le_ofReal ?_ ?_ · simp only [le_sup_iff, dist_nonneg, or_self] · simp [edist, PseudoMetricSpace.edist_dist, ENNReal.ofReal_le_ofReal] · have h1 : edist f.fst g.fst ^ p.toReal ≠ ⊤ := ENNReal.rpow_ne_top_of_nonneg (zero_le_one.trans h) (edist_ne_top _ _) have h2 : edist f.snd g.snd ^ p.toReal ≠ ⊤ := ENNReal.rpow_ne_top_of_nonneg (zero_le_one.trans h) (edist_ne_top _ _) simp only [prod_edist_eq_add (zero_lt_one.trans_le h), dist_edist, ENNReal.toReal_rpow, prod_dist_eq_add (zero_lt_one.trans_le h), ← ENNReal.toReal_add h1 h2] attribute [local instance] WithLp.prodPseudoMetricAux theorem prod_lipschitzWith_equiv_aux [PseudoEMetricSpace α] [PseudoEMetricSpace β] : LipschitzWith 1 (WithLp.equiv p (α × β)) := by intro x y rcases p.dichotomy with (rfl | h) · simp [edist] · have cancel : p.toReal * (1 / p.toReal) = 1 := mul_div_cancel₀ 1 (zero_lt_one.trans_le h).ne' rw [prod_edist_eq_add (zero_lt_one.trans_le h)] simp only [edist, forall_prop_of_true, one_mul, ENNReal.coe_one, sup_le_iff] constructor · calc edist x.fst y.fst ≤ (edist x.fst y.fst ^ p.toReal) ^ (1 / p.toReal) := by simp only [← ENNReal.rpow_mul, cancel, ENNReal.rpow_one, le_refl] _ ≤ (edist x.fst y.fst ^ p.toReal + edist x.snd y.snd ^ p.toReal) ^ (1 / p.toReal) := by gcongr simp only [self_le_add_right] · calc edist x.snd y.snd ≤ (edist x.snd y.snd ^ p.toReal) ^ (1 / p.toReal) := by simp only [← ENNReal.rpow_mul, cancel, ENNReal.rpow_one, le_refl] _ ≤ (edist x.fst y.fst ^ p.toReal + edist x.snd y.snd ^ p.toReal) ^ (1 / p.toReal) := by gcongr simp only [self_le_add_left] theorem prod_antilipschitzWith_equiv_aux [PseudoEMetricSpace α] [PseudoEMetricSpace β] : AntilipschitzWith ((2 : ℝ≥0) ^ (1 / p).toReal) (WithLp.equiv p (α × β)) := by intro x y rcases p.dichotomy with (rfl | h) · simp [edist] · have pos : 0 < p.toReal := by positivity have nonneg : 0 ≤ 1 / p.toReal := by positivity have cancel : p.toReal * (1 / p.toReal) = 1 := mul_div_cancel₀ 1 (ne_of_gt pos) rw [prod_edist_eq_add pos, ENNReal.toReal_div 1 p] simp only [edist, ← one_div, ENNReal.one_toReal] calc (edist x.fst y.fst ^ p.toReal + edist x.snd y.snd ^ p.toReal) ^ (1 / p.toReal) ≤ (edist (WithLp.equiv p _ x) (WithLp.equiv p _ y) ^ p.toReal + edist (WithLp.equiv p _ x) (WithLp.equiv p _ y) ^ p.toReal) ^ (1 / p.toReal) := by gcongr <;> simp [edist] _ = (2 ^ (1 / p.toReal) : ℝ≥0) * edist (WithLp.equiv p _ x) (WithLp.equiv p _ y) := by simp only [← two_mul, ENNReal.mul_rpow_of_nonneg _ _ nonneg, ← ENNReal.rpow_mul, cancel, ENNReal.rpow_one, ← ENNReal.coe_rpow_of_nonneg _ nonneg, coe_ofNat] theorem prod_aux_uniformity_eq [PseudoEMetricSpace α] [PseudoEMetricSpace β] : 𝓤 (WithLp p (α × β)) = 𝓤[instUniformSpaceProd] := by have A : UniformInducing (WithLp.equiv p (α × β)) := (prod_antilipschitzWith_equiv_aux p α β).uniformInducing (prod_lipschitzWith_equiv_aux p α β).uniformContinuous have : (fun x : WithLp p (α × β) × WithLp p (α × β) => ((WithLp.equiv p (α × β)) x.fst, (WithLp.equiv p (α × β)) x.snd)) = id := by ext i <;> rfl rw [← A.comap_uniformity, this, comap_id] theorem prod_aux_cobounded_eq [PseudoMetricSpace α] [PseudoMetricSpace β] : cobounded (WithLp p (α × β)) = @cobounded _ Prod.instBornology := calc cobounded (WithLp p (α × β)) = comap (WithLp.equiv p (α × β)) (cobounded _) := le_antisymm (prod_antilipschitzWith_equiv_aux p α β).tendsto_cobounded.le_comap (prod_lipschitzWith_equiv_aux p α β).comap_cobounded_le _ = _ := comap_id end Aux /-! ### Instances on `L^p` products -/ section TopologicalSpace variable [TopologicalSpace α] [TopologicalSpace β] instance instProdTopologicalSpace : TopologicalSpace (WithLp p (α × β)) := instTopologicalSpaceProd @[continuity] theorem prod_continuous_equiv : Continuous (WithLp.equiv p (α × β)) := continuous_id @[continuity] theorem prod_continuous_equiv_symm : Continuous (WithLp.equiv p (α × β)).symm := continuous_id variable [T0Space α] [T0Space β] instance instProdT0Space : T0Space (WithLp p (α × β)) := Prod.instT0Space end TopologicalSpace section UniformSpace variable [UniformSpace α] [UniformSpace β] instance instProdUniformSpace : UniformSpace (WithLp p (α × β)) := instUniformSpaceProd theorem prod_uniformContinuous_equiv : UniformContinuous (WithLp.equiv p (α × β)) := uniformContinuous_id theorem prod_uniformContinuous_equiv_symm : UniformContinuous (WithLp.equiv p (α × β)).symm := uniformContinuous_id variable [CompleteSpace α] [CompleteSpace β] instance instProdCompleteSpace : CompleteSpace (WithLp p (α × β)) := CompleteSpace.prod end UniformSpace instance instProdBornology [Bornology α] [Bornology β] : Bornology (WithLp p (α × β)) := Prod.instBornology section ContinuousLinearEquiv variable [TopologicalSpace α] [TopologicalSpace β] variable [Semiring 𝕜] [AddCommGroup α] [AddCommGroup β] variable [Module 𝕜 α] [Module 𝕜 β] /-- `WithLp.equiv` as a continuous linear equivalence. -/ @[simps! (config := .asFn) apply symm_apply] protected def prodContinuousLinearEquiv : WithLp p (α × β) ≃L[𝕜] α × β where toLinearEquiv := WithLp.linearEquiv _ _ _ continuous_toFun := prod_continuous_equiv _ _ _ continuous_invFun := prod_continuous_equiv_symm _ _ _ end ContinuousLinearEquiv /-! Throughout the rest of the file, we assume `1 ≤ p` -/ variable [hp : Fact (1 ≤ p)] /-- `PseudoEMetricSpace` instance on the product of two pseudoemetric spaces, using the `L^p` pseudoedistance, and having as uniformity the product uniformity. -/ instance instProdPseudoEMetricSpace [PseudoEMetricSpace α] [PseudoEMetricSpace β] : PseudoEMetricSpace (WithLp p (α × β)) := (prodPseudoEMetricAux p α β).replaceUniformity (prod_aux_uniformity_eq p α β).symm /-- `EMetricSpace` instance on the product of two emetric spaces, using the `L^p` edistance, and having as uniformity the product uniformity. -/ instance instProdEMetricSpace [EMetricSpace α] [EMetricSpace β] : EMetricSpace (WithLp p (α × β)) := EMetricSpace.ofT0PseudoEMetricSpace (WithLp p (α × β)) /-- `PseudoMetricSpace` instance on the product of two pseudometric spaces, using the `L^p` distance, and having as uniformity the product uniformity. -/ instance instProdPseudoMetricSpace [PseudoMetricSpace α] [PseudoMetricSpace β] : PseudoMetricSpace (WithLp p (α × β)) := ((prodPseudoMetricAux p α β).replaceUniformity (prod_aux_uniformity_eq p α β).symm).replaceBornology fun s => Filter.ext_iff.1 (prod_aux_cobounded_eq p α β).symm sᶜ /-- `MetricSpace` instance on the product of two metric spaces, using the `L^p` distance, and having as uniformity the product uniformity. -/ instance instProdMetricSpace [MetricSpace α] [MetricSpace β] : MetricSpace (WithLp p (α × β)) := MetricSpace.ofT0PseudoMetricSpace _ variable {p α β} theorem prod_nndist_eq_add [PseudoMetricSpace α] [PseudoMetricSpace β] (hp : p ≠ ∞) (x y : WithLp p (α × β)) : nndist x y = (nndist x.fst y.fst ^ p.toReal + nndist x.snd y.snd ^ p.toReal) ^ (1 / p.toReal) := NNReal.eq <| by push_cast exact prod_dist_eq_add (p.toReal_pos_iff_ne_top.mpr hp) _ _ theorem prod_nndist_eq_sup [PseudoMetricSpace α] [PseudoMetricSpace β] (x y : WithLp ∞ (α × β)) : nndist x y = nndist x.fst y.fst ⊔ nndist x.snd y.snd := NNReal.eq <| by push_cast exact prod_dist_eq_sup _ _ variable (p α β) theorem prod_lipschitzWith_equiv [PseudoEMetricSpace α] [PseudoEMetricSpace β] : LipschitzWith 1 (WithLp.equiv p (α × β)) := prod_lipschitzWith_equiv_aux p α β theorem prod_antilipschitzWith_equiv [PseudoEMetricSpace α] [PseudoEMetricSpace β] : AntilipschitzWith ((2 : ℝ≥0) ^ (1 / p).toReal) (WithLp.equiv p (α × β)) := prod_antilipschitzWith_equiv_aux p α β theorem prod_infty_equiv_isometry [PseudoEMetricSpace α] [PseudoEMetricSpace β] : Isometry (WithLp.equiv ∞ (α × β)) := fun x y => le_antisymm (by simpa only [ENNReal.coe_one, one_mul] using prod_lipschitzWith_equiv ∞ α β x y) (by simpa only [ENNReal.div_top, ENNReal.zero_toReal, NNReal.rpow_zero, ENNReal.coe_one, one_mul] using prod_antilipschitzWith_equiv ∞ α β x y) /-- Seminormed group instance on the product of two normed groups, using the `L^p` norm. -/ instance instProdSeminormedAddCommGroup [SeminormedAddCommGroup α] [SeminormedAddCommGroup β] : SeminormedAddCommGroup (WithLp p (α × β)) where dist_eq x y := by rcases p.dichotomy with (rfl | h) · simp only [prod_dist_eq_sup, prod_norm_eq_sup, dist_eq_norm] rfl · simp only [prod_dist_eq_add (zero_lt_one.trans_le h), prod_norm_eq_add (zero_lt_one.trans_le h), dist_eq_norm] rfl /-- normed group instance on the product of two normed groups, using the `L^p` norm. -/ instance instProdNormedAddCommGroup [NormedAddCommGroup α] [NormedAddCommGroup β] : NormedAddCommGroup (WithLp p (α × β)) := { instProdSeminormedAddCommGroup p α β with eq_of_dist_eq_zero := eq_of_dist_eq_zero } example [NormedAddCommGroup α] [NormedAddCommGroup β] : (instProdNormedAddCommGroup p α β).toMetricSpace.toUniformSpace.toTopologicalSpace = instProdTopologicalSpace p α β := rfl example [NormedAddCommGroup α] [NormedAddCommGroup β] : (instProdNormedAddCommGroup p α β).toMetricSpace.toUniformSpace = instProdUniformSpace p α β := rfl example [NormedAddCommGroup α] [NormedAddCommGroup β] : (instProdNormedAddCommGroup p α β).toMetricSpace.toBornology = instProdBornology p α β := rfl section norm_of variable {p α β} theorem prod_norm_eq_of_nat [Norm α] [Norm β] (n : ℕ) (h : p = n) (f : WithLp p (α × β)) : ‖f‖ = (‖f.fst‖ ^ n + ‖f.snd‖ ^ n) ^ (1 / (n : ℝ)) := by have := p.toReal_pos_iff_ne_top.mpr (ne_of_eq_of_ne h <| ENNReal.natCast_ne_top n) simp only [one_div, h, Real.rpow_natCast, ENNReal.toReal_nat, eq_self_iff_true, Finset.sum_congr, prod_norm_eq_add this] variable [SeminormedAddCommGroup α] [SeminormedAddCommGroup β] theorem prod_nnnorm_eq_add (hp : p ≠ ∞) (f : WithLp p (α × β)) : ‖f‖₊ = (‖f.fst‖₊ ^ p.toReal + ‖f.snd‖₊ ^ p.toReal) ^ (1 / p.toReal) := by ext simp [prod_norm_eq_add (p.toReal_pos_iff_ne_top.mpr hp)] theorem prod_nnnorm_eq_sup (f : WithLp ∞ (α × β)) : ‖f‖₊ = ‖f.fst‖₊ ⊔ ‖f.snd‖₊ := by ext norm_cast @[simp] theorem prod_nnnorm_equiv (f : WithLp ∞ (α × β)) : ‖WithLp.equiv ⊤ _ f‖₊ = ‖f‖₊ := by rw [prod_nnnorm_eq_sup, Prod.nnnorm_def', _root_.sup_eq_max, equiv_fst, equiv_snd] @[simp] theorem prod_nnnorm_equiv_symm (f : α × β) : ‖(WithLp.equiv ⊤ _).symm f‖₊ = ‖f‖₊ := (prod_nnnorm_equiv _).symm @[simp] theorem prod_norm_equiv (f : WithLp ∞ (α × β)) : ‖WithLp.equiv ⊤ _ f‖ = ‖f‖ := congr_arg NNReal.toReal <| prod_nnnorm_equiv f @[simp] theorem prod_norm_equiv_symm (f : α × β) : ‖(WithLp.equiv ⊤ _).symm f‖ = ‖f‖ := (prod_norm_equiv _).symm theorem prod_norm_eq_of_L2 (x : WithLp 2 (α × β)) : ‖x‖ = √(‖x.fst‖ ^ 2 + ‖x.snd‖ ^ 2) := by rw [prod_norm_eq_of_nat 2 (by norm_cast) _, Real.sqrt_eq_rpow] norm_cast theorem prod_nnnorm_eq_of_L2 (x : WithLp 2 (α × β)) : ‖x‖₊ = NNReal.sqrt (‖x.fst‖₊ ^ 2 + ‖x.snd‖₊ ^ 2) := NNReal.eq <| by push_cast exact prod_norm_eq_of_L2 x theorem prod_norm_sq_eq_of_L2 (x : WithLp 2 (α × β)) : ‖x‖ ^ 2 = ‖x.fst‖ ^ 2 + ‖x.snd‖ ^ 2 := by suffices ‖x‖₊ ^ 2 = ‖x.fst‖₊ ^ 2 + ‖x.snd‖₊ ^ 2 by simpa only [NNReal.coe_sum] using congr_arg ((↑) : ℝ≥0 → ℝ) this rw [prod_nnnorm_eq_of_L2, NNReal.sq_sqrt] theorem prod_dist_eq_of_L2 (x y : WithLp 2 (α × β)) : dist x y = √(dist x.fst y.fst ^ 2 + dist x.snd y.snd ^ 2) := by simp_rw [dist_eq_norm, prod_norm_eq_of_L2] rfl theorem prod_nndist_eq_of_L2 (x y : WithLp 2 (α × β)) : nndist x y = NNReal.sqrt (nndist x.fst y.fst ^ 2 + nndist x.snd y.snd ^ 2) := NNReal.eq <| by push_cast exact prod_dist_eq_of_L2 _ _ theorem prod_edist_eq_of_L2 (x y : WithLp 2 (α × β)) : edist x y = (edist x.fst y.fst ^ 2 + edist x.snd y.snd ^ 2) ^ (1 / 2 : ℝ) := by simp [prod_edist_eq_add] end norm_of variable [SeminormedAddCommGroup α] [SeminormedAddCommGroup β] section Single @[simp] theorem nnnorm_equiv_symm_fst (x : α) : ‖(WithLp.equiv p (α × β)).symm (x, 0)‖₊ = ‖x‖₊ := by induction p generalizing hp with | top => simp [prod_nnnorm_eq_sup] | coe p => have hp0 : (p : ℝ) ≠ 0 := mod_cast (zero_lt_one.trans_le <| Fact.out (p := 1 ≤ (p : ℝ≥0∞))).ne' simp [prod_nnnorm_eq_add, NNReal.zero_rpow hp0, ← NNReal.rpow_mul, mul_inv_cancel hp0] @[simp] theorem nnnorm_equiv_symm_snd (y : β) : ‖(WithLp.equiv p (α × β)).symm (0, y)‖₊ = ‖y‖₊ := by induction p generalizing hp with | top => simp [prod_nnnorm_eq_sup] | coe p => have hp0 : (p : ℝ) ≠ 0 := mod_cast (zero_lt_one.trans_le <| Fact.out (p := 1 ≤ (p : ℝ≥0∞))).ne' simp [prod_nnnorm_eq_add, NNReal.zero_rpow hp0, ← NNReal.rpow_mul, mul_inv_cancel hp0] @[simp] theorem norm_equiv_symm_fst (x : α) : ‖(WithLp.equiv p (α × β)).symm (x, 0)‖ = ‖x‖ := congr_arg ((↑) : ℝ≥0 → ℝ) <| nnnorm_equiv_symm_fst p α β x @[simp] theorem norm_equiv_symm_snd (y : β) : ‖(WithLp.equiv p (α × β)).symm (0, y)‖ = ‖y‖ := congr_arg ((↑) : ℝ≥0 → ℝ) <| nnnorm_equiv_symm_snd p α β y @[simp] theorem nndist_equiv_symm_fst (x₁ x₂ : α) : nndist ((WithLp.equiv p (α × β)).symm (x₁, 0)) ((WithLp.equiv p (α × β)).symm (x₂, 0)) = nndist x₁ x₂ := by rw [nndist_eq_nnnorm, nndist_eq_nnnorm, ← WithLp.equiv_symm_sub, Prod.mk_sub_mk, sub_zero, nnnorm_equiv_symm_fst] @[simp] theorem nndist_equiv_symm_snd (y₁ y₂ : β) : nndist ((WithLp.equiv p (α × β)).symm (0, y₁)) ((WithLp.equiv p (α × β)).symm (0, y₂)) = nndist y₁ y₂ := by rw [nndist_eq_nnnorm, nndist_eq_nnnorm, ← WithLp.equiv_symm_sub, Prod.mk_sub_mk, sub_zero, nnnorm_equiv_symm_snd] @[simp] theorem dist_equiv_symm_fst (x₁ x₂ : α) : dist ((WithLp.equiv p (α × β)).symm (x₁, 0)) ((WithLp.equiv p (α × β)).symm (x₂, 0)) = dist x₁ x₂ := congr_arg ((↑) : ℝ≥0 → ℝ) <| nndist_equiv_symm_fst p α β x₁ x₂ @[simp] theorem dist_equiv_symm_snd (y₁ y₂ : β) : dist ((WithLp.equiv p (α × β)).symm (0, y₁)) ((WithLp.equiv p (α × β)).symm (0, y₂)) = dist y₁ y₂ := congr_arg ((↑) : ℝ≥0 → ℝ) <| nndist_equiv_symm_snd p α β y₁ y₂ @[simp] theorem edist_equiv_symm_fst (x₁ x₂ : α) : edist ((WithLp.equiv p (α × β)).symm (x₁, 0)) ((WithLp.equiv p (α × β)).symm (x₂, 0)) = edist x₁ x₂ := by simp only [edist_nndist, nndist_equiv_symm_fst p α β x₁ x₂] @[simp] theorem edist_equiv_symm_snd (y₁ y₂ : β) : edist ((WithLp.equiv p (α × β)).symm (0, y₁)) ((WithLp.equiv p (α × β)).symm (0, y₂)) = edist y₁ y₂ := by simp only [edist_nndist, nndist_equiv_symm_snd p α β y₁ y₂] end Single section BoundedSMul variable [SeminormedRing 𝕜] [Module 𝕜 α] [Module 𝕜 β] [BoundedSMul 𝕜 α] [BoundedSMul 𝕜 β] instance instProdBoundedSMul : BoundedSMul 𝕜 (WithLp p (α × β)) := .of_nnnorm_smul_le fun c f => by rcases p.dichotomy with (rfl | hp) · simp only [← prod_nnnorm_equiv, WithLp.equiv_smul] exact norm_smul_le _ _ · have hp0 : 0 < p.toReal := zero_lt_one.trans_le hp have hpt : p ≠ ⊤ := p.toReal_pos_iff_ne_top.mp hp0 rw [prod_nnnorm_eq_add hpt, prod_nnnorm_eq_add hpt, one_div, NNReal.rpow_inv_le_iff hp0, NNReal.mul_rpow, ← NNReal.rpow_mul, inv_mul_cancel hp0.ne', NNReal.rpow_one, mul_add, ← NNReal.mul_rpow, ← NNReal.mul_rpow] exact add_le_add (NNReal.rpow_le_rpow (nnnorm_smul_le _ _) hp0.le) (NNReal.rpow_le_rpow (nnnorm_smul_le _ _) hp0.le) variable {𝕜 p α β} /-- The canonical map `WithLp.equiv` between `WithLp ∞ (α × β)` and `α × β` as a linear isometric equivalence. -/ def prodEquivₗᵢ : WithLp ∞ (α × β) ≃ₗᵢ[𝕜] α × β where __ := WithLp.equiv ∞ (α × β) map_add' _f _g := rfl map_smul' _c _f := rfl norm_map' := prod_norm_equiv end BoundedSMul section NormedSpace /-- The product of two normed spaces is a normed space, with the `L^p` norm. -/ instance instProdNormedSpace [NormedField 𝕜] [NormedSpace 𝕜 α] [NormedSpace 𝕜 β] : NormedSpace 𝕜 (WithLp p (α × β)) where norm_smul_le := norm_smul_le end NormedSpace end WithLp
Analysis\Normed\Lp\WithLp.lean
/- Copyright (c) 2023 Eric Wieser. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Eric Wieser -/ import Mathlib.Data.ENNReal.Basic import Mathlib.RingTheory.Finiteness /-! # The `WithLp` type synonym `WithLp p V` is a copy of `V` with exactly the same vector space structure, but with the Lp norm instead of any existing norm on `V`; recall that by default `ι → R` and `R × R` are equipped with a norm defined as the supremum of the norms of their components. This file defines the vector space structure for all types `V`; the norm structure is built for different specializations of `V` in downstream files. Note that this should not be used for infinite products, as in these cases the "right" Lp spaces is not the same as the direct product of the spaces. See the docstring in `Mathlib/Analysis/PiLp` for more details. ## Main definitions * `WithLp p V`: a copy of `V` to be equipped with an L`p` norm. * `WithLp.equiv p V`: the canonical equivalence between `WithLp p V` and `V`. * `WithLp.linearEquiv p K V`: the canonical `K`-module isomorphism between `WithLp p V` and `V`. ## Implementation notes The pattern here is the same one as is used by `Lex` for order structures; it avoids having a separate synonym for each type (`ProdLp`, `PiLp`, etc), and allows all the structure-copying code to be shared. TODO: is it safe to copy across the topology and uniform space structure too for all reasonable choices of `V`? -/ open scoped ENNReal universe uK uK' uV /-- A type synonym for the given `V`, associated with the L`p` norm. Note that by default this just forgets the norm structure on `V`; it is up to downstream users to implement the L`p` norm (for instance, on `Prod` and finite `Pi` types). -/ @[nolint unusedArguments] def WithLp (_p : ℝ≥0∞) (V : Type uV) : Type uV := V variable (p : ℝ≥0∞) (K : Type uK) (K' : Type uK') (V : Type uV) namespace WithLp /-- The canonical equivalence between `WithLp p V` and `V`. This should always be used to convert back and forth between the representations. -/ protected def equiv : WithLp p V ≃ V := Equiv.refl _ instance instNontrivial [Nontrivial V] : Nontrivial (WithLp p V) := ‹Nontrivial V› instance instUnique [Unique V] : Unique (WithLp p V) := ‹Unique V› variable [Semiring K] [Semiring K'] [AddCommGroup V] /-! `WithLp p V` inherits various module-adjacent structures from `V`. -/ instance instAddCommGroup : AddCommGroup (WithLp p V) := ‹AddCommGroup V› instance instModule [Module K V] : Module K (WithLp p V) := ‹Module K V› instance instIsScalarTower [SMul K K'] [Module K V] [Module K' V] [IsScalarTower K K' V] : IsScalarTower K K' (WithLp p V) := ‹IsScalarTower K K' V› instance instSMulCommClass [Module K V] [Module K' V] [SMulCommClass K K' V] : SMulCommClass K K' (WithLp p V) := ‹SMulCommClass K K' V› instance instModuleFinite [Module K V] [Module.Finite K V] : Module.Finite K (WithLp p V) := ‹Module.Finite K V› variable {K V} variable [Module K V] variable (c : K) (x y : WithLp p V) (x' y' : V) /-! `WithLp.equiv` preserves the module structure. -/ @[simp] theorem equiv_zero : WithLp.equiv p V 0 = 0 := rfl @[simp] theorem equiv_symm_zero : (WithLp.equiv p V).symm 0 = 0 := rfl @[simp] theorem equiv_add : WithLp.equiv p V (x + y) = WithLp.equiv p V x + WithLp.equiv p V y := rfl @[simp] theorem equiv_symm_add : (WithLp.equiv p V).symm (x' + y') = (WithLp.equiv p V).symm x' + (WithLp.equiv p V).symm y' := rfl @[simp] theorem equiv_sub : WithLp.equiv p V (x - y) = WithLp.equiv p V x - WithLp.equiv p V y := rfl @[simp] theorem equiv_symm_sub : (WithLp.equiv p V).symm (x' - y') = (WithLp.equiv p V).symm x' - (WithLp.equiv p V).symm y' := rfl @[simp] theorem equiv_neg : WithLp.equiv p V (-x) = -WithLp.equiv p V x := rfl @[simp] theorem equiv_symm_neg : (WithLp.equiv p V).symm (-x') = -(WithLp.equiv p V).symm x' := rfl @[simp] theorem equiv_smul : WithLp.equiv p V (c • x) = c • WithLp.equiv p V x := rfl @[simp] theorem equiv_symm_smul : (WithLp.equiv p V).symm (c • x') = c • (WithLp.equiv p V).symm x' := rfl variable (K V) /-- `WithLp.equiv` as a linear equivalence. -/ @[simps (config := .asFn)] protected def linearEquiv : WithLp p V ≃ₗ[K] V := { LinearEquiv.refl _ _ with toFun := WithLp.equiv _ _ invFun := (WithLp.equiv _ _).symm } end WithLp
Analysis\Normed\Module\Basic.lean
/- Copyright (c) 2018 Patrick Massot. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Johannes Hölzl -/ import Mathlib.Algebra.Algebra.Pi import Mathlib.Algebra.Algebra.Prod import Mathlib.Algebra.Algebra.Rat import Mathlib.Algebra.Algebra.RestrictScalars import Mathlib.Algebra.Module.Rat import Mathlib.Analysis.Normed.Field.Basic import Mathlib.Analysis.Normed.MulAction /-! # Normed spaces In this file we define (semi)normed spaces and algebras. We also prove some theorems about these definitions. -/ variable {𝕜 𝕜' E F α : Type*} open Filter Metric Function Set Topology Bornology open scoped NNReal ENNReal uniformity section SeminormedAddCommGroup section Prio -- set_option extends_priority 920 -- Porting note: option unsupported -- Here, we set a rather high priority for the instance `[NormedSpace 𝕜 E] : Module 𝕜 E` -- to take precedence over `Semiring.toModule` as this leads to instance paths with better -- unification properties. /-- A normed space over a normed field is a vector space endowed with a norm which satisfies the equality `‖c • x‖ = ‖c‖ ‖x‖`. We require only `‖c • x‖ ≤ ‖c‖ ‖x‖` in the definition, then prove `‖c • x‖ = ‖c‖ ‖x‖` in `norm_smul`. Note that since this requires `SeminormedAddCommGroup` and not `NormedAddCommGroup`, this typeclass can be used for "semi normed spaces" too, just as `Module` can be used for "semi modules". -/ class NormedSpace (𝕜 : Type*) (E : Type*) [NormedField 𝕜] [SeminormedAddCommGroup E] extends Module 𝕜 E where norm_smul_le : ∀ (a : 𝕜) (b : E), ‖a • b‖ ≤ ‖a‖ * ‖b‖ attribute [inherit_doc NormedSpace] NormedSpace.norm_smul_le end Prio variable [NormedField 𝕜] [SeminormedAddCommGroup E] [SeminormedAddCommGroup F] variable [NormedSpace 𝕜 E] [NormedSpace 𝕜 F] -- see Note [lower instance priority] instance (priority := 100) NormedSpace.boundedSMul [NormedSpace 𝕜 E] : BoundedSMul 𝕜 E := BoundedSMul.of_norm_smul_le NormedSpace.norm_smul_le instance NormedField.toNormedSpace : NormedSpace 𝕜 𝕜 where norm_smul_le a b := norm_mul_le a b -- shortcut instance instance NormedField.to_boundedSMul : BoundedSMul 𝕜 𝕜 := NormedSpace.boundedSMul variable (𝕜) in theorem norm_zsmul [NormedSpace 𝕜 E] (n : ℤ) (x : E) : ‖n • x‖ = ‖(n : 𝕜)‖ * ‖x‖ := by rw [← norm_smul, ← Int.smul_one_eq_cast, smul_assoc, one_smul] theorem eventually_nhds_norm_smul_sub_lt (c : 𝕜) (x : E) {ε : ℝ} (h : 0 < ε) : ∀ᶠ y in 𝓝 x, ‖c • (y - x)‖ < ε := have : Tendsto (fun y ↦ ‖c • (y - x)‖) (𝓝 x) (𝓝 0) := Continuous.tendsto' (by fun_prop) _ _ (by simp) this.eventually (gt_mem_nhds h) theorem Filter.Tendsto.zero_smul_isBoundedUnder_le {f : α → 𝕜} {g : α → E} {l : Filter α} (hf : Tendsto f l (𝓝 0)) (hg : IsBoundedUnder (· ≤ ·) l (Norm.norm ∘ g)) : Tendsto (fun x => f x • g x) l (𝓝 0) := hf.op_zero_isBoundedUnder_le hg (· • ·) norm_smul_le theorem Filter.IsBoundedUnder.smul_tendsto_zero {f : α → 𝕜} {g : α → E} {l : Filter α} (hf : IsBoundedUnder (· ≤ ·) l (norm ∘ f)) (hg : Tendsto g l (𝓝 0)) : Tendsto (fun x => f x • g x) l (𝓝 0) := hg.op_zero_isBoundedUnder_le hf (flip (· • ·)) fun x y => (norm_smul_le y x).trans_eq (mul_comm _ _) instance NormedSpace.discreteTopology_zmultiples {E : Type*} [NormedAddCommGroup E] [NormedSpace ℚ E] (e : E) : DiscreteTopology <| AddSubgroup.zmultiples e := by rcases eq_or_ne e 0 with (rfl | he) · rw [AddSubgroup.zmultiples_zero_eq_bot] exact Subsingleton.discreteTopology (α := ↑(⊥ : Subspace ℚ E)) · rw [discreteTopology_iff_isOpen_singleton_zero, isOpen_induced_iff] refine ⟨Metric.ball 0 ‖e‖, Metric.isOpen_ball, ?_⟩ ext ⟨x, hx⟩ obtain ⟨k, rfl⟩ := AddSubgroup.mem_zmultiples_iff.mp hx rw [mem_preimage, mem_ball_zero_iff, AddSubgroup.coe_mk, mem_singleton_iff, Subtype.ext_iff, AddSubgroup.coe_mk, AddSubgroup.coe_zero, norm_zsmul ℚ k e, Int.norm_cast_rat, Int.norm_eq_abs, mul_lt_iff_lt_one_left (norm_pos_iff.mpr he), ← @Int.cast_one ℝ _, ← Int.cast_abs, Int.cast_lt, Int.abs_lt_one_iff, smul_eq_zero, or_iff_left he] open NormedField instance ULift.normedSpace : NormedSpace 𝕜 (ULift E) := { __ := ULift.seminormedAddCommGroup (E := E), __ := ULift.module' norm_smul_le := fun s x => (norm_smul_le s x.down : _) } /-- The product of two normed spaces is a normed space, with the sup norm. -/ instance Prod.normedSpace : NormedSpace 𝕜 (E × F) := { Prod.seminormedAddCommGroup (E := E) (F := F), Prod.instModule with norm_smul_le := fun s x => by simp only [norm_smul, Prod.norm_def, Prod.smul_snd, Prod.smul_fst, mul_max_of_nonneg, norm_nonneg, le_rfl] } /-- The product of finitely many normed spaces is a normed space, with the sup norm. -/ instance Pi.normedSpace {ι : Type*} {E : ι → Type*} [Fintype ι] [∀ i, SeminormedAddCommGroup (E i)] [∀ i, NormedSpace 𝕜 (E i)] : NormedSpace 𝕜 (∀ i, E i) where norm_smul_le a f := by simp_rw [← coe_nnnorm, ← NNReal.coe_mul, NNReal.coe_le_coe, Pi.nnnorm_def, NNReal.mul_finset_sup] exact Finset.sup_mono_fun fun _ _ => norm_smul_le a _ instance MulOpposite.instNormedSpace : NormedSpace 𝕜 Eᵐᵒᵖ where norm_smul_le _ x := norm_smul_le _ x.unop /-- A subspace of a normed space is also a normed space, with the restriction of the norm. -/ instance Submodule.normedSpace {𝕜 R : Type*} [SMul 𝕜 R] [NormedField 𝕜] [Ring R] {E : Type*} [SeminormedAddCommGroup E] [NormedSpace 𝕜 E] [Module R E] [IsScalarTower 𝕜 R E] (s : Submodule R E) : NormedSpace 𝕜 s where norm_smul_le c x := norm_smul_le c (x : E) variable {S 𝕜 R E : Type*} [SMul 𝕜 R] [NormedField 𝕜] [Ring R] [SeminormedAddCommGroup E] variable [NormedSpace 𝕜 E] [Module R E] [IsScalarTower 𝕜 R E] [SetLike S E] [AddSubgroupClass S E] variable [SMulMemClass S R E] (s : S) instance (priority := 75) SubmoduleClass.toNormedSpace : NormedSpace 𝕜 s where norm_smul_le c x := norm_smul_le c (x : E) end SeminormedAddCommGroup /-- A linear map from a `Module` to a `NormedSpace` induces a `NormedSpace` structure on the domain, using the `SeminormedAddCommGroup.induced` norm. See note [reducible non-instances] -/ abbrev NormedSpace.induced {F : Type*} (𝕜 E G : Type*) [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] [SeminormedAddCommGroup G] [NormedSpace 𝕜 G] [FunLike F E G] [LinearMapClass F 𝕜 E G] (f : F) : @NormedSpace 𝕜 E _ (SeminormedAddCommGroup.induced E G f) := let _ := SeminormedAddCommGroup.induced E G f ⟨fun a b ↦ by simpa only [← map_smul f a b] using norm_smul_le a (f b)⟩ section NormedAddCommGroup variable [NormedField 𝕜] variable [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable [NormedAddCommGroup F] [NormedSpace 𝕜 F] open NormedField /-- While this may appear identical to `NormedSpace.toModule`, it contains an implicit argument involving `NormedAddCommGroup.toSeminormedAddCommGroup` that typeclass inference has trouble inferring. Specifically, the following instance cannot be found without this `NormedSpace.toModule'`: ```lean example (𝕜 ι : Type*) (E : ι → Type*) [NormedField 𝕜] [Π i, NormedAddCommGroup (E i)] [Π i, NormedSpace 𝕜 (E i)] : Π i, Module 𝕜 (E i) := by infer_instance ``` [This Zulip thread](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/Typeclass.20resolution.20under.20binders/near/245151099) gives some more context. -/ instance (priority := 100) NormedSpace.toModule' : Module 𝕜 F := NormedSpace.toModule end NormedAddCommGroup section NontriviallyNormedSpace variable (𝕜 E) variable [NontriviallyNormedField 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E] [Nontrivial E] /-- If `E` is a nontrivial normed space over a nontrivially normed field `𝕜`, then `E` is unbounded: for any `c : ℝ`, there exists a vector `x : E` with norm strictly greater than `c`. -/ theorem NormedSpace.exists_lt_norm (c : ℝ) : ∃ x : E, c < ‖x‖ := by rcases exists_ne (0 : E) with ⟨x, hx⟩ rcases NormedField.exists_lt_norm 𝕜 (c / ‖x‖) with ⟨r, hr⟩ use r • x rwa [norm_smul, ← _root_.div_lt_iff] rwa [norm_pos_iff] protected theorem NormedSpace.unbounded_univ : ¬Bornology.IsBounded (univ : Set E) := fun h => let ⟨R, hR⟩ := isBounded_iff_forall_norm_le.1 h let ⟨x, hx⟩ := NormedSpace.exists_lt_norm 𝕜 E R hx.not_le (hR x trivial) protected lemma NormedSpace.cobounded_neBot : NeBot (cobounded E) := by rw [neBot_iff, Ne, cobounded_eq_bot_iff, ← isBounded_univ] exact NormedSpace.unbounded_univ 𝕜 E instance (priority := 100) NontriviallyNormedField.cobounded_neBot : NeBot (cobounded 𝕜) := NormedSpace.cobounded_neBot 𝕜 𝕜 instance (priority := 80) RealNormedSpace.cobounded_neBot [NormedSpace ℝ E] : NeBot (cobounded E) := NormedSpace.cobounded_neBot ℝ E instance (priority := 80) NontriviallyNormedField.infinite : Infinite 𝕜 := ⟨fun _ ↦ NormedSpace.unbounded_univ 𝕜 𝕜 (Set.toFinite _).isBounded⟩ end NontriviallyNormedSpace section NormedSpace variable (𝕜 E) variable [NormedField 𝕜] [Infinite 𝕜] [NormedAddCommGroup E] [Nontrivial E] [NormedSpace 𝕜 E] /-- A normed vector space over an infinite normed field is a noncompact space. This cannot be an instance because in order to apply it, Lean would have to search for `NormedSpace 𝕜 E` with unknown `𝕜`. We register this as an instance in two cases: `𝕜 = E` and `𝕜 = ℝ`. -/ protected theorem NormedSpace.noncompactSpace : NoncompactSpace E := by by_cases H : ∃ c : 𝕜, c ≠ 0 ∧ ‖c‖ ≠ 1 · letI := NontriviallyNormedField.ofNormNeOne H exact ⟨fun h ↦ NormedSpace.unbounded_univ 𝕜 E h.isBounded⟩ · push_neg at H rcases exists_ne (0 : E) with ⟨x, hx⟩ suffices ClosedEmbedding (Infinite.natEmbedding 𝕜 · • x) from this.noncompactSpace refine closedEmbedding_of_pairwise_le_dist (norm_pos_iff.2 hx) fun k n hne ↦ ?_ simp only [dist_eq_norm, ← sub_smul, norm_smul] rw [H, one_mul] rwa [sub_ne_zero, (Embedding.injective _).ne_iff] instance (priority := 100) NormedField.noncompactSpace : NoncompactSpace 𝕜 := NormedSpace.noncompactSpace 𝕜 𝕜 instance (priority := 100) RealNormedSpace.noncompactSpace [NormedSpace ℝ E] : NoncompactSpace E := NormedSpace.noncompactSpace ℝ E end NormedSpace section NormedAlgebra /-- A normed algebra `𝕜'` over `𝕜` is normed module that is also an algebra. See the implementation notes for `Algebra` for a discussion about non-unital algebras. Following the strategy there, a non-unital *normed* algebra can be written as: ```lean variable [NormedField 𝕜] [NonUnitalSeminormedRing 𝕜'] variable [NormedSpace 𝕜 𝕜'] [SMulCommClass 𝕜 𝕜' 𝕜'] [IsScalarTower 𝕜 𝕜' 𝕜'] ``` -/ class NormedAlgebra (𝕜 : Type*) (𝕜' : Type*) [NormedField 𝕜] [SeminormedRing 𝕜'] extends Algebra 𝕜 𝕜' where norm_smul_le : ∀ (r : 𝕜) (x : 𝕜'), ‖r • x‖ ≤ ‖r‖ * ‖x‖ attribute [inherit_doc NormedAlgebra] NormedAlgebra.norm_smul_le variable (𝕜') variable [NormedField 𝕜] [SeminormedRing 𝕜'] [NormedAlgebra 𝕜 𝕜'] instance (priority := 100) NormedAlgebra.toNormedSpace : NormedSpace 𝕜 𝕜' := -- Porting note: previous Lean could figure out what we were extending { NormedAlgebra.toAlgebra.toModule with norm_smul_le := NormedAlgebra.norm_smul_le } /-- While this may appear identical to `NormedAlgebra.toNormedSpace`, it contains an implicit argument involving `NormedRing.toSeminormedRing` that typeclass inference has trouble inferring. Specifically, the following instance cannot be found without this `NormedSpace.toModule'`: ```lean example (𝕜 ι : Type*) (E : ι → Type*) [NormedField 𝕜] [Π i, NormedRing (E i)] [Π i, NormedAlgebra 𝕜 (E i)] : Π i, Module 𝕜 (E i) := by infer_instance ``` See `NormedSpace.toModule'` for a similar situation. -/ instance (priority := 100) NormedAlgebra.toNormedSpace' {𝕜'} [NormedRing 𝕜'] [NormedAlgebra 𝕜 𝕜'] : NormedSpace 𝕜 𝕜' := by infer_instance theorem norm_algebraMap (x : 𝕜) : ‖algebraMap 𝕜 𝕜' x‖ = ‖x‖ * ‖(1 : 𝕜')‖ := by rw [Algebra.algebraMap_eq_smul_one] exact norm_smul _ _ theorem nnnorm_algebraMap (x : 𝕜) : ‖algebraMap 𝕜 𝕜' x‖₊ = ‖x‖₊ * ‖(1 : 𝕜')‖₊ := Subtype.ext <| norm_algebraMap 𝕜' x @[simp] theorem norm_algebraMap' [NormOneClass 𝕜'] (x : 𝕜) : ‖algebraMap 𝕜 𝕜' x‖ = ‖x‖ := by rw [norm_algebraMap, norm_one, mul_one] @[simp] theorem nnnorm_algebraMap' [NormOneClass 𝕜'] (x : 𝕜) : ‖algebraMap 𝕜 𝕜' x‖₊ = ‖x‖₊ := Subtype.ext <| norm_algebraMap' _ _ section NNReal variable [NormOneClass 𝕜'] [NormedAlgebra ℝ 𝕜'] @[simp] theorem norm_algebraMap_nnreal (x : ℝ≥0) : ‖algebraMap ℝ≥0 𝕜' x‖ = x := (norm_algebraMap' 𝕜' (x : ℝ)).symm ▸ Real.norm_of_nonneg x.prop @[simp] theorem nnnorm_algebraMap_nnreal (x : ℝ≥0) : ‖algebraMap ℝ≥0 𝕜' x‖₊ = x := Subtype.ext <| norm_algebraMap_nnreal 𝕜' x end NNReal variable (𝕜) /-- In a normed algebra, the inclusion of the base field in the extended field is an isometry. -/ theorem algebraMap_isometry [NormOneClass 𝕜'] : Isometry (algebraMap 𝕜 𝕜') := by refine Isometry.of_dist_eq fun x y => ?_ rw [dist_eq_norm, dist_eq_norm, ← RingHom.map_sub, norm_algebraMap'] instance NormedAlgebra.id : NormedAlgebra 𝕜 𝕜 := { NormedField.toNormedSpace, Algebra.id 𝕜 with } -- Porting note: cannot synth scalar tower ℚ ℝ k /-- Any normed characteristic-zero division ring that is a normed algebra over the reals is also a normed algebra over the rationals. Phrased another way, if `𝕜` is a normed algebra over the reals, then `AlgebraRat` respects that norm. -/ instance normedAlgebraRat {𝕜} [NormedDivisionRing 𝕜] [CharZero 𝕜] [NormedAlgebra ℝ 𝕜] : NormedAlgebra ℚ 𝕜 where norm_smul_le q x := by rw [← smul_one_smul ℝ q x, Rat.smul_one_eq_cast, norm_smul, Rat.norm_cast_real] instance PUnit.normedAlgebra : NormedAlgebra 𝕜 PUnit where norm_smul_le q _ := by simp only [norm_eq_zero, mul_zero, le_refl] instance : NormedAlgebra 𝕜 (ULift 𝕜') := { ULift.normedSpace, ULift.algebra with } /-- The product of two normed algebras is a normed algebra, with the sup norm. -/ instance Prod.normedAlgebra {E F : Type*} [SeminormedRing E] [SeminormedRing F] [NormedAlgebra 𝕜 E] [NormedAlgebra 𝕜 F] : NormedAlgebra 𝕜 (E × F) := { Prod.normedSpace, Prod.algebra 𝕜 E F with } -- Porting note: Lean 3 could synth the algebra instances for Pi Pr /-- The product of finitely many normed algebras is a normed algebra, with the sup norm. -/ instance Pi.normedAlgebra {ι : Type*} {E : ι → Type*} [Fintype ι] [∀ i, SeminormedRing (E i)] [∀ i, NormedAlgebra 𝕜 (E i)] : NormedAlgebra 𝕜 (∀ i, E i) := { Pi.normedSpace, Pi.algebra _ E with } variable [SeminormedRing E] [NormedAlgebra 𝕜 E] instance MulOpposite.instNormedAlgebra {E : Type*} [SeminormedRing E] [NormedAlgebra 𝕜 E] : NormedAlgebra 𝕜 Eᵐᵒᵖ where __ := instAlgebra __ := instNormedSpace end NormedAlgebra /-- A non-unital algebra homomorphism from an `Algebra` to a `NormedAlgebra` induces a `NormedAlgebra` structure on the domain, using the `SeminormedRing.induced` norm. See note [reducible non-instances] -/ abbrev NormedAlgebra.induced {F : Type*} (𝕜 R S : Type*) [NormedField 𝕜] [Ring R] [Algebra 𝕜 R] [SeminormedRing S] [NormedAlgebra 𝕜 S] [FunLike F R S] [NonUnitalAlgHomClass F 𝕜 R S] (f : F) : @NormedAlgebra 𝕜 R _ (SeminormedRing.induced R S f) := letI := SeminormedRing.induced R S f ⟨fun a b ↦ show ‖f (a • b)‖ ≤ ‖a‖ * ‖f b‖ from (map_smul f a b).symm ▸ norm_smul_le a (f b)⟩ -- Porting note: failed to synth NonunitalAlgHomClass instance Subalgebra.toNormedAlgebra {𝕜 A : Type*} [SeminormedRing A] [NormedField 𝕜] [NormedAlgebra 𝕜 A] (S : Subalgebra 𝕜 A) : NormedAlgebra 𝕜 S := NormedAlgebra.induced 𝕜 S A S.val section SubalgebraClass variable {S 𝕜 E : Type*} [NormedField 𝕜] [SeminormedRing E] [NormedAlgebra 𝕜 E] variable [SetLike S E] [SubringClass S E] [SMulMemClass S 𝕜 E] (s : S) instance (priority := 75) SubalgebraClass.toNormedAlgebra : NormedAlgebra 𝕜 s where norm_smul_le c x := norm_smul_le c (x : E) end SubalgebraClass section RestrictScalars section NormInstances instance [I : SeminormedAddCommGroup E] : SeminormedAddCommGroup (RestrictScalars 𝕜 𝕜' E) := I instance [I : NormedAddCommGroup E] : NormedAddCommGroup (RestrictScalars 𝕜 𝕜' E) := I instance [I : NonUnitalSeminormedRing E] : NonUnitalSeminormedRing (RestrictScalars 𝕜 𝕜' E) := I instance [I : NonUnitalNormedRing E] : NonUnitalNormedRing (RestrictScalars 𝕜 𝕜' E) := I instance [I : SeminormedRing E] : SeminormedRing (RestrictScalars 𝕜 𝕜' E) := I instance [I : NormedRing E] : NormedRing (RestrictScalars 𝕜 𝕜' E) := I instance [I : NonUnitalSeminormedCommRing E] : NonUnitalSeminormedCommRing (RestrictScalars 𝕜 𝕜' E) := I instance [I : NonUnitalNormedCommRing E] : NonUnitalNormedCommRing (RestrictScalars 𝕜 𝕜' E) := I instance [I : SeminormedCommRing E] : SeminormedCommRing (RestrictScalars 𝕜 𝕜' E) := I instance [I : NormedCommRing E] : NormedCommRing (RestrictScalars 𝕜 𝕜' E) := I end NormInstances section NormedSpace variable (𝕜 𝕜' E) variable [NormedField 𝕜] [NormedField 𝕜'] [NormedAlgebra 𝕜 𝕜'] [SeminormedAddCommGroup E] [NormedSpace 𝕜' E] /-- If `E` is a normed space over `𝕜'` and `𝕜` is a normed algebra over `𝕜'`, then `RestrictScalars.module` is additionally a `NormedSpace`. -/ instance RestrictScalars.normedSpace : NormedSpace 𝕜 (RestrictScalars 𝕜 𝕜' E) := { RestrictScalars.module 𝕜 𝕜' E with norm_smul_le := fun c x => (norm_smul_le (algebraMap 𝕜 𝕜' c) (_ : E)).trans_eq <| by rw [norm_algebraMap'] } -- If you think you need this, consider instead reproducing `RestrictScalars.lsmul` -- appropriately modified here. /-- The action of the original normed_field on `RestrictScalars 𝕜 𝕜' E`. This is not an instance as it would be contrary to the purpose of `RestrictScalars`. -/ def Module.RestrictScalars.normedSpaceOrig {𝕜 : Type*} {𝕜' : Type*} {E : Type*} [NormedField 𝕜'] [SeminormedAddCommGroup E] [I : NormedSpace 𝕜' E] : NormedSpace 𝕜' (RestrictScalars 𝕜 𝕜' E) := I /-- Warning: This declaration should be used judiciously. Please consider using `IsScalarTower` and/or `RestrictScalars 𝕜 𝕜' E` instead. This definition allows the `RestrictScalars.normedSpace` instance to be put directly on `E` rather on `RestrictScalars 𝕜 𝕜' E`. This would be a very bad instance; both because `𝕜'` cannot be inferred, and because it is likely to create instance diamonds. -/ def NormedSpace.restrictScalars : NormedSpace 𝕜 E := RestrictScalars.normedSpace _ 𝕜' E end NormedSpace section NormedAlgebra variable (𝕜 𝕜' E) variable [NormedField 𝕜] [NormedField 𝕜'] [NormedAlgebra 𝕜 𝕜'] [SeminormedRing E] [NormedAlgebra 𝕜' E] /-- If `E` is a normed algebra over `𝕜'` and `𝕜` is a normed algebra over `𝕜'`, then `RestrictScalars.module` is additionally a `NormedAlgebra`. -/ instance RestrictScalars.normedAlgebra : NormedAlgebra 𝕜 (RestrictScalars 𝕜 𝕜' E) := { RestrictScalars.algebra 𝕜 𝕜' E with norm_smul_le := norm_smul_le } -- If you think you need this, consider instead reproducing `RestrictScalars.lsmul` -- appropriately modified here. /-- The action of the original normed_field on `RestrictScalars 𝕜 𝕜' E`. This is not an instance as it would be contrary to the purpose of `RestrictScalars`. -/ def Module.RestrictScalars.normedAlgebraOrig {𝕜 : Type*} {𝕜' : Type*} {E : Type*} [NormedField 𝕜'] [SeminormedRing E] [I : NormedAlgebra 𝕜' E] : NormedAlgebra 𝕜' (RestrictScalars 𝕜 𝕜' E) := I /-- Warning: This declaration should be used judiciously. Please consider using `IsScalarTower` and/or `RestrictScalars 𝕜 𝕜' E` instead. This definition allows the `RestrictScalars.normedAlgebra` instance to be put directly on `E` rather on `RestrictScalars 𝕜 𝕜' E`. This would be a very bad instance; both because `𝕜'` cannot be inferred, and because it is likely to create instance diamonds. -/ def NormedAlgebra.restrictScalars : NormedAlgebra 𝕜 E := RestrictScalars.normedAlgebra _ 𝕜' _ end NormedAlgebra end RestrictScalars section Core /-! ### Structures for constructing new normed spaces This section contains tools meant for constructing new normed spaces. These allow one to easily construct all the relevant instances (distances measures, etc) while proving only a minimal set of axioms. Furthermore, tools are provided to add a norm structure to a type that already has a preexisting uniformity or bornology: in such cases, it is necessary to keep the preexisting instances, while ensuring that the norm induces the same uniformity/bornology. -/ open scoped Uniformity Bornology /-- A structure encapsulating minimal axioms needed to defined a seminormed vector space, as found in textbooks. This is meant to be used to easily define `SeminormedAddCommGroup E` instances from scratch on a type with no preexisting distance or topology. -/ structure SeminormedAddCommGroup.Core (𝕜 : Type*) (E : Type*) [NormedField 𝕜] [AddCommGroup E] [Norm E] [Module 𝕜 E] : Prop where norm_nonneg (x : E) : 0 ≤ ‖x‖ norm_smul (c : 𝕜) (x : E) : ‖c • x‖ = ‖c‖ * ‖x‖ norm_triangle (x y : E) : ‖x + y‖ ≤ ‖x‖ + ‖y‖ /-- Produces a `PseudoMetricSpace E` instance from a `SeminormedAddCommGroup.Core`. Note that if this is used to define an instance on a type, it also provides a new uniformity and topology on the type. See note [reducible non-instances]. -/ abbrev PseudoMetricSpace.ofSeminormedAddCommGroupCore {𝕜 E : Type*} [NormedField 𝕜] [AddCommGroup E] [Norm E] [Module 𝕜 E] (core : SeminormedAddCommGroup.Core 𝕜 E) : PseudoMetricSpace E where dist x y := ‖x - y‖ dist_self x := by show ‖x - x‖ = 0 simp only [sub_self] have : (0 : E) = (0 : 𝕜) • (0 : E) := by simp rw [this, core.norm_smul] simp dist_comm x y := by show ‖x - y‖ = ‖y - x‖ have : y - x = (-1 : 𝕜) • (x - y) := by simp rw [this, core.norm_smul] simp dist_triangle x y z := by show ‖x - z‖ ≤ ‖x - y‖ + ‖y - z‖ have : x - z = (x - y) + (y - z) := by abel rw [this] exact core.norm_triangle _ _ edist_dist x y := by exact (ENNReal.ofReal_eq_coe_nnreal _).symm /-- Produces a `PseudoEMetricSpace E` instance from a `SeminormedAddCommGroup.Core`. Note that if this is used to define an instance on a type, it also provides a new uniformity and topology on the type. See note [reducible non-instances]. -/ abbrev PseudoEMetricSpace.ofSeminormedAddCommGroupCore {𝕜 E : Type*} [NormedField 𝕜] [AddCommGroup E] [Norm E] [Module 𝕜 E] (core : SeminormedAddCommGroup.Core 𝕜 E) : PseudoEMetricSpace E := (PseudoMetricSpace.ofSeminormedAddCommGroupCore core).toPseudoEMetricSpace /-- Produces a `PseudoEMetricSpace E` instance from a `SeminormedAddCommGroup.Core` on a type that already has an existing uniform space structure. This requires a proof that the uniformity induced by the norm is equal to the preexisting uniformity. See note [reducible non-instances]. -/ abbrev PseudoMetricSpace.ofSeminormedAddCommGroupCoreReplaceUniformity {𝕜 E : Type*} [NormedField 𝕜] [AddCommGroup E] [Norm E] [Module 𝕜 E] [U : UniformSpace E] (core : SeminormedAddCommGroup.Core 𝕜 E) (H : 𝓤[U] = 𝓤[PseudoEMetricSpace.toUniformSpace (self := PseudoEMetricSpace.ofSeminormedAddCommGroupCore core)]) : PseudoMetricSpace E := .replaceUniformity (.ofSeminormedAddCommGroupCore core) H open Bornology in /-- Produces a `PseudoEMetricSpace E` instance from a `SeminormedAddCommGroup.Core` on a type that already has a preexisting uniform space structure and a preexisting bornology. This requires proofs that the uniformity induced by the norm is equal to the preexisting uniformity, and likewise for the bornology. See note [reducible non-instances]. -/ abbrev PseudoMetricSpace.ofSeminormedAddCommGroupCoreReplaceAll {𝕜 E : Type*} [NormedField 𝕜] [AddCommGroup E] [Norm E] [Module 𝕜 E] [U : UniformSpace E] [B : Bornology E] (core : SeminormedAddCommGroup.Core 𝕜 E) (HU : 𝓤[U] = 𝓤[PseudoEMetricSpace.toUniformSpace (self := PseudoEMetricSpace.ofSeminormedAddCommGroupCore core)]) (HB : ∀ s : Set E, @IsBounded _ B s ↔ @IsBounded _ (PseudoMetricSpace.ofSeminormedAddCommGroupCore core).toBornology s) : PseudoMetricSpace E := .replaceBornology (.replaceUniformity (.ofSeminormedAddCommGroupCore core) HU) HB /-- Produces a `SeminormedAddCommGroup E` instance from a `SeminormedAddCommGroup.Core`. Note that if this is used to define an instance on a type, it also provides a new distance measure from the norm. it must therefore not be used on a type with a preexisting distance measure or topology. See note [reducible non-instances]. -/ abbrev SeminormedAddCommGroup.ofCore {𝕜 : Type*} {E : Type*} [NormedField 𝕜] [AddCommGroup E] [Norm E] [Module 𝕜 E] (core : SeminormedAddCommGroup.Core 𝕜 E) : SeminormedAddCommGroup E := { PseudoMetricSpace.ofSeminormedAddCommGroupCore core with } /-- Produces a `SeminormedAddCommGroup E` instance from a `SeminormedAddCommGroup.Core` on a type that already has an existing uniform space structure. This requires a proof that the uniformity induced by the norm is equal to the preexisting uniformity. See note [reducible non-instances]. -/ abbrev SeminormedAddCommGroup.ofCoreReplaceUniformity {𝕜 : Type*} {E : Type*} [NormedField 𝕜] [AddCommGroup E] [Norm E] [Module 𝕜 E] [U : UniformSpace E] (core : SeminormedAddCommGroup.Core 𝕜 E) (H : 𝓤[U] = 𝓤[PseudoEMetricSpace.toUniformSpace (self := PseudoEMetricSpace.ofSeminormedAddCommGroupCore core)]) : SeminormedAddCommGroup E := { PseudoMetricSpace.ofSeminormedAddCommGroupCoreReplaceUniformity core H with } open Bornology in /-- Produces a `SeminormedAddCommGroup E` instance from a `SeminormedAddCommGroup.Core` on a type that already has a preexisting uniform space structure and a preexisting bornology. This requires proofs that the uniformity induced by the norm is equal to the preexisting uniformity, and likewise for the bornology. See note [reducible non-instances]. -/ abbrev SeminormedAddCommGroup.ofCoreReplaceAll {𝕜 : Type*} {E : Type*} [NormedField 𝕜] [AddCommGroup E] [Norm E] [Module 𝕜 E] [U : UniformSpace E] [B : Bornology E] (core : SeminormedAddCommGroup.Core 𝕜 E) (HU : 𝓤[U] = 𝓤[PseudoEMetricSpace.toUniformSpace (self := PseudoEMetricSpace.ofSeminormedAddCommGroupCore core)]) (HB : ∀ s : Set E, @IsBounded _ B s ↔ @IsBounded _ (PseudoMetricSpace.ofSeminormedAddCommGroupCore core).toBornology s) : SeminormedAddCommGroup E := { PseudoMetricSpace.ofSeminormedAddCommGroupCoreReplaceAll core HU HB with } /-- A structure encapsulating minimal axioms needed to defined a normed vector space, as found in textbooks. This is meant to be used to easily define `NormedAddCommGroup E` and `NormedSpace E` instances from scratch on a type with no preexisting distance or topology. -/ structure NormedSpace.Core (𝕜 : Type*) (E : Type*) [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] [Norm E] extends SeminormedAddCommGroup.Core 𝕜 E : Prop where norm_eq_zero_iff (x : E) : ‖x‖ = 0 ↔ x = 0 variable {𝕜 : Type*} {E : Type*} [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] [Norm E] /-- Produces a `NormedAddCommGroup E` instance from a `NormedSpace.Core`. Note that if this is used to define an instance on a type, it also provides a new distance measure from the norm. it must therefore not be used on a type with a preexisting distance measure. See note [reducible non-instances]. -/ abbrev NormedAddCommGroup.ofCore (core : NormedSpace.Core 𝕜 E) : NormedAddCommGroup E := { SeminormedAddCommGroup.ofCore core.toCore with eq_of_dist_eq_zero := by intro x y h rw [← sub_eq_zero, ← core.norm_eq_zero_iff] exact h } /-- Produces a `NormedAddCommGroup E` instance from a `NormedAddCommGroup.Core` on a type that already has an existing uniform space structure. This requires a proof that the uniformity induced by the norm is equal to the preexisting uniformity. See note [reducible non-instances]. -/ abbrev NormedAddCommGroup.ofCoreReplaceUniformity [U : UniformSpace E] (core : NormedSpace.Core 𝕜 E) (H : 𝓤[U] = 𝓤[PseudoEMetricSpace.toUniformSpace (self := PseudoEMetricSpace.ofSeminormedAddCommGroupCore core.toCore)]) : NormedAddCommGroup E := { SeminormedAddCommGroup.ofCoreReplaceUniformity core.toCore H with eq_of_dist_eq_zero := by intro x y h rw [← sub_eq_zero, ← core.norm_eq_zero_iff] exact h } open Bornology in /-- Produces a `NormedAddCommGroup E` instance from a `NormedAddCommGroup.Core` on a type that already has a preexisting uniform space structure and a preexisting bornology. This requires proofs that the uniformity induced by the norm is equal to the preexisting uniformity, and likewise for the bornology. See note [reducible non-instances]. -/ abbrev NormedAddCommGroup.ofCoreReplaceAll [U : UniformSpace E] [B : Bornology E] (core : NormedSpace.Core 𝕜 E) (HU : 𝓤[U] = 𝓤[PseudoEMetricSpace.toUniformSpace (self := PseudoEMetricSpace.ofSeminormedAddCommGroupCore core.toCore)]) (HB : ∀ s : Set E, @IsBounded _ B s ↔ @IsBounded _ (PseudoMetricSpace.ofSeminormedAddCommGroupCore core.toCore).toBornology s) : NormedAddCommGroup E := { SeminormedAddCommGroup.ofCoreReplaceAll core.toCore HU HB with eq_of_dist_eq_zero := by intro x y h rw [← sub_eq_zero, ← core.norm_eq_zero_iff] exact h } /-- Produces a `NormedSpace 𝕜 E` instance from a `NormedSpace.Core`. This is meant to be used on types where the `NormedAddCommGroup E` instance has also been defined using `core`. See note [reducible non-instances]. -/ abbrev NormedSpace.ofCore {𝕜 : Type*} {E : Type*} [NormedField 𝕜] [SeminormedAddCommGroup E] [Module 𝕜 E] (core : NormedSpace.Core 𝕜 E) : NormedSpace 𝕜 E where norm_smul_le r x := by rw [core.norm_smul r x] end Core
Analysis\Normed\Module\Complemented.lean
/- Copyright (c) 2020 Yury Kudryashov. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yury Kudryashov -/ import Mathlib.Analysis.Normed.Operator.Banach import Mathlib.Topology.Algebra.Module.FiniteDimension /-! # Complemented subspaces of normed vector spaces A submodule `p` of a topological module `E` over `R` is called *complemented* if there exists a continuous linear projection `f : E →ₗ[R] p`, `∀ x : p, f x = x`. We prove that for a closed subspace of a normed space this condition is equivalent to existence of a closed subspace `q` such that `p ⊓ q = ⊥`, `p ⊔ q = ⊤`. We also prove that a subspace of finite codimension is always a complemented subspace. ## Tags complemented subspace, normed vector space -/ variable {𝕜 E F G : Type*} [NontriviallyNormedField 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E] [NormedAddCommGroup F] [NormedSpace 𝕜 F] [NormedAddCommGroup G] [NormedSpace 𝕜 G] noncomputable section open LinearMap (ker range) namespace ContinuousLinearMap section variable [CompleteSpace 𝕜] theorem ker_closedComplemented_of_finiteDimensional_range (f : E →L[𝕜] F) [FiniteDimensional 𝕜 (range f)] : (ker f).ClosedComplemented := by set f' : E →L[𝕜] range f := f.codRestrict _ (LinearMap.mem_range_self (f : E →ₗ[𝕜] F)) rcases f'.exists_right_inverse_of_surjective (f : E →ₗ[𝕜] F).range_rangeRestrict with ⟨g, hg⟩ simpa only [f', ker_codRestrict] using f'.closedComplemented_ker_of_rightInverse g (ContinuousLinearMap.ext_iff.1 hg) end variable [CompleteSpace E] [CompleteSpace (F × G)] /-- If `f : E →L[R] F` and `g : E →L[R] G` are two surjective linear maps and their kernels are complement of each other, then `x ↦ (f x, g x)` defines a linear equivalence `E ≃L[R] F × G`. -/ nonrec def equivProdOfSurjectiveOfIsCompl (f : E →L[𝕜] F) (g : E →L[𝕜] G) (hf : range f = ⊤) (hg : range g = ⊤) (hfg : IsCompl (ker f) (ker g)) : E ≃L[𝕜] F × G := (f.equivProdOfSurjectiveOfIsCompl (g : E →ₗ[𝕜] G) hf hg hfg).toContinuousLinearEquivOfContinuous (f.continuous.prod_mk g.continuous) @[simp] theorem coe_equivProdOfSurjectiveOfIsCompl {f : E →L[𝕜] F} {g : E →L[𝕜] G} (hf : range f = ⊤) (hg : range g = ⊤) (hfg : IsCompl (ker f) (ker g)) : (equivProdOfSurjectiveOfIsCompl f g hf hg hfg : E →ₗ[𝕜] F × G) = f.prod g := rfl @[simp] theorem equivProdOfSurjectiveOfIsCompl_toLinearEquiv {f : E →L[𝕜] F} {g : E →L[𝕜] G} (hf : range f = ⊤) (hg : range g = ⊤) (hfg : IsCompl (ker f) (ker g)) : (equivProdOfSurjectiveOfIsCompl f g hf hg hfg).toLinearEquiv = LinearMap.equivProdOfSurjectiveOfIsCompl f g hf hg hfg := rfl @[simp] theorem equivProdOfSurjectiveOfIsCompl_apply {f : E →L[𝕜] F} {g : E →L[𝕜] G} (hf : range f = ⊤) (hg : range g = ⊤) (hfg : IsCompl (ker f) (ker g)) (x : E) : equivProdOfSurjectiveOfIsCompl f g hf hg hfg x = (f x, g x) := rfl end ContinuousLinearMap namespace Submodule variable [CompleteSpace E] (p q : Subspace 𝕜 E) /-- If `q` is a closed complement of a closed subspace `p`, then `p × q` is continuously isomorphic to `E`. -/ def prodEquivOfClosedCompl (h : IsCompl p q) (hp : IsClosed (p : Set E)) (hq : IsClosed (q : Set E)) : (p × q) ≃L[𝕜] E := by haveI := hp.completeSpace_coe; haveI := hq.completeSpace_coe refine (p.prodEquivOfIsCompl q h).toContinuousLinearEquivOfContinuous ?_ exact (p.subtypeL.coprod q.subtypeL).continuous /-- Projection to a closed submodule along a closed complement. -/ def linearProjOfClosedCompl (h : IsCompl p q) (hp : IsClosed (p : Set E)) (hq : IsClosed (q : Set E)) : E →L[𝕜] p := ContinuousLinearMap.fst 𝕜 p q ∘L ↑(prodEquivOfClosedCompl p q h hp hq).symm variable {p q} @[simp] theorem coe_prodEquivOfClosedCompl (h : IsCompl p q) (hp : IsClosed (p : Set E)) (hq : IsClosed (q : Set E)) : ⇑(p.prodEquivOfClosedCompl q h hp hq) = p.prodEquivOfIsCompl q h := rfl @[simp] theorem coe_prodEquivOfClosedCompl_symm (h : IsCompl p q) (hp : IsClosed (p : Set E)) (hq : IsClosed (q : Set E)) : ⇑(p.prodEquivOfClosedCompl q h hp hq).symm = (p.prodEquivOfIsCompl q h).symm := rfl @[simp] theorem coe_continuous_linearProjOfClosedCompl (h : IsCompl p q) (hp : IsClosed (p : Set E)) (hq : IsClosed (q : Set E)) : (p.linearProjOfClosedCompl q h hp hq : E →ₗ[𝕜] p) = p.linearProjOfIsCompl q h := rfl @[simp] theorem coe_continuous_linearProjOfClosedCompl' (h : IsCompl p q) (hp : IsClosed (p : Set E)) (hq : IsClosed (q : Set E)) : ⇑(p.linearProjOfClosedCompl q h hp hq) = p.linearProjOfIsCompl q h := rfl theorem ClosedComplemented.of_isCompl_isClosed (h : IsCompl p q) (hp : IsClosed (p : Set E)) (hq : IsClosed (q : Set E)) : p.ClosedComplemented := ⟨p.linearProjOfClosedCompl q h hp hq, Submodule.linearProjOfIsCompl_apply_left h⟩ alias IsCompl.closedComplemented_of_isClosed := ClosedComplemented.of_isCompl_isClosed theorem closedComplemented_iff_isClosed_exists_isClosed_isCompl : p.ClosedComplemented ↔ IsClosed (p : Set E) ∧ ∃ q : Submodule 𝕜 E, IsClosed (q : Set E) ∧ IsCompl p q := ⟨fun h => ⟨h.isClosed, h.exists_isClosed_isCompl⟩, fun ⟨hp, ⟨_, hq, hpq⟩⟩ => .of_isCompl_isClosed hpq hp hq⟩ theorem ClosedComplemented.of_quotient_finiteDimensional [CompleteSpace 𝕜] [FiniteDimensional 𝕜 (E ⧸ p)] (hp : IsClosed (p : Set E)) : p.ClosedComplemented := by obtain ⟨q, hq⟩ : ∃ q, IsCompl p q := p.exists_isCompl haveI : FiniteDimensional 𝕜 q := (p.quotientEquivOfIsCompl q hq).finiteDimensional exact .of_isCompl_isClosed hq hp q.closed_of_finiteDimensional end Submodule
Analysis\Normed\Module\Completion.lean
/- Copyright (c) 2022 Yury G. Kudryashov. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yury G. Kudryashov -/ import Mathlib.Analysis.Normed.Group.Completion import Mathlib.Analysis.NormedSpace.OperatorNorm.NormedSpace import Mathlib.Topology.Algebra.UniformRing /-! # Normed space structure on the completion of a normed space If `E` is a normed space over `𝕜`, then so is `UniformSpace.Completion E`. In this file we provide necessary instances and define `UniformSpace.Completion.toComplₗᵢ` - coercion `E → UniformSpace.Completion E` as a bundled linear isometry. We also show that if `A` is a normed algebra over `𝕜`, then so is `UniformSpace.Completion A`. TODO: Generalise the results here from the concrete `completion` to any `AbstractCompletion`. -/ noncomputable section namespace UniformSpace namespace Completion variable (𝕜 E : Type*) [NormedField 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E] instance (priority := 100) NormedSpace.to_uniformContinuousConstSMul : UniformContinuousConstSMul 𝕜 E := ⟨fun c => (lipschitzWith_smul c).uniformContinuous⟩ instance : NormedSpace 𝕜 (Completion E) := { Completion.instModule with norm_smul_le := fun c x => induction_on x (isClosed_le (continuous_const_smul _).norm (continuous_const.mul continuous_norm)) fun y => by simp only [← coe_smul, norm_coe, norm_smul, le_rfl] } variable {𝕜 E} /-- Embedding of a normed space to its completion as a linear isometry. -/ def toComplₗᵢ : E →ₗᵢ[𝕜] Completion E := { toCompl with toFun := (↑) map_smul' := coe_smul norm_map' := norm_coe } @[simp] theorem coe_toComplₗᵢ : ⇑(toComplₗᵢ : E →ₗᵢ[𝕜] Completion E) = ((↑) : E → Completion E) := rfl /-- Embedding of a normed space to its completion as a continuous linear map. -/ def toComplL : E →L[𝕜] Completion E := toComplₗᵢ.toContinuousLinearMap @[simp] theorem coe_toComplL : ⇑(toComplL : E →L[𝕜] Completion E) = ((↑) : E → Completion E) := rfl @[simp] theorem norm_toComplL {𝕜 E : Type*} [NontriviallyNormedField 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E] [Nontrivial E] : ‖(toComplL : E →L[𝕜] Completion E)‖ = 1 := (toComplₗᵢ : E →ₗᵢ[𝕜] Completion E).norm_toContinuousLinearMap section Algebra variable (𝕜) (A : Type*) instance [SeminormedRing A] : NormedRing (Completion A) := { Completion.ring, Completion.instMetricSpace with dist_eq := fun x y => by refine Completion.induction_on₂ x y ?_ ?_ <;> clear x y · refine isClosed_eq (Completion.uniformContinuous_extension₂ _).continuous ?_ exact Continuous.comp Completion.continuous_extension continuous_sub · intro x y rw [← Completion.coe_sub, norm_coe, Completion.dist_eq, dist_eq_norm] norm_mul := fun x y => by refine Completion.induction_on₂ x y ?_ ?_ <;> clear x y · exact isClosed_le (Continuous.comp continuous_norm continuous_mul) (Continuous.comp _root_.continuous_mul (Continuous.prod_map continuous_norm continuous_norm)) · intro x y simp only [← coe_mul, norm_coe] exact norm_mul_le x y } instance [SeminormedCommRing A] [NormedAlgebra 𝕜 A] [UniformContinuousConstSMul 𝕜 A] : NormedAlgebra 𝕜 (Completion A) := { Completion.algebra A 𝕜 with norm_smul_le := fun r x => by refine Completion.induction_on x ?_ ?_ <;> clear x · exact isClosed_le (Continuous.comp continuous_norm (continuous_const_smul r)) (Continuous.comp (continuous_mul_left _) continuous_norm) · intro x simp only [← coe_smul, norm_coe] exact norm_smul_le r x } end Algebra end Completion end UniformSpace
Analysis\Normed\Module\Dual.lean
/- Copyright (c) 2020 Heather Macbeth. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Heather Macbeth -/ import Mathlib.Analysis.NormedSpace.HahnBanach.Extension import Mathlib.Analysis.NormedSpace.RCLike import Mathlib.Analysis.LocallyConvex.Polar /-! # The topological dual of a normed space In this file we define the topological dual `NormedSpace.Dual` of a normed space, and the continuous linear map `NormedSpace.inclusionInDoubleDual` from a normed space into its double dual. For base field `𝕜 = ℝ` or `𝕜 = ℂ`, this map is actually an isometric embedding; we provide a version `NormedSpace.inclusionInDoubleDualLi` of the map which is of type a bundled linear isometric embedding, `E →ₗᵢ[𝕜] (Dual 𝕜 (Dual 𝕜 E))`. Since a lot of elementary properties don't require `eq_of_dist_eq_zero` we start setting up the theory for `SeminormedAddCommGroup` and we specialize to `NormedAddCommGroup` when needed. ## Main definitions * `inclusionInDoubleDual` and `inclusionInDoubleDualLi` are the inclusion of a normed space in its double dual, considered as a bounded linear map and as a linear isometry, respectively. * `polar 𝕜 s` is the subset of `Dual 𝕜 E` consisting of those functionals `x'` for which `‖x' z‖ ≤ 1` for every `z ∈ s`. ## Tags dual -/ noncomputable section open scoped Classical open Topology Bornology universe u v namespace NormedSpace section General variable (𝕜 : Type*) [NontriviallyNormedField 𝕜] variable (E : Type*) [SeminormedAddCommGroup E] [NormedSpace 𝕜 E] variable (F : Type*) [NormedAddCommGroup F] [NormedSpace 𝕜 F] /-- The topological dual of a seminormed space `E`. -/ abbrev Dual : Type _ := E →L[𝕜] 𝕜 -- TODO: helper instance for elaboration of inclusionInDoubleDual_norm_eq until -- leanprover/lean4#2522 is resolved; remove once fixed instance : NormedSpace 𝕜 (Dual 𝕜 E) := inferInstance -- TODO: helper instance for elaboration of inclusionInDoubleDual_norm_le until -- leanprover/lean4#2522 is resolved; remove once fixed instance : SeminormedAddCommGroup (Dual 𝕜 E) := inferInstance /-- The inclusion of a normed space in its double (topological) dual, considered as a bounded linear map. -/ def inclusionInDoubleDual : E →L[𝕜] Dual 𝕜 (Dual 𝕜 E) := ContinuousLinearMap.apply 𝕜 𝕜 @[simp] theorem dual_def (x : E) (f : Dual 𝕜 E) : inclusionInDoubleDual 𝕜 E x f = f x := rfl theorem inclusionInDoubleDual_norm_eq : ‖inclusionInDoubleDual 𝕜 E‖ = ‖ContinuousLinearMap.id 𝕜 (Dual 𝕜 E)‖ := ContinuousLinearMap.opNorm_flip _ theorem inclusionInDoubleDual_norm_le : ‖inclusionInDoubleDual 𝕜 E‖ ≤ 1 := by rw [inclusionInDoubleDual_norm_eq] exact ContinuousLinearMap.norm_id_le theorem double_dual_bound (x : E) : ‖(inclusionInDoubleDual 𝕜 E) x‖ ≤ ‖x‖ := by simpa using ContinuousLinearMap.le_of_opNorm_le _ (inclusionInDoubleDual_norm_le 𝕜 E) x /-- The dual pairing as a bilinear form. -/ def dualPairing : Dual 𝕜 E →ₗ[𝕜] E →ₗ[𝕜] 𝕜 := ContinuousLinearMap.coeLM 𝕜 @[simp] theorem dualPairing_apply {v : Dual 𝕜 E} {x : E} : dualPairing 𝕜 E v x = v x := rfl theorem dualPairing_separatingLeft : (dualPairing 𝕜 E).SeparatingLeft := by rw [LinearMap.separatingLeft_iff_ker_eq_bot, LinearMap.ker_eq_bot] exact ContinuousLinearMap.coe_injective end General section BidualIsometry variable (𝕜 : Type v) [RCLike 𝕜] {E : Type u} [NormedAddCommGroup E] [NormedSpace 𝕜 E] /-- If one controls the norm of every `f x`, then one controls the norm of `x`. Compare `ContinuousLinearMap.opNorm_le_bound`. -/ theorem norm_le_dual_bound (x : E) {M : ℝ} (hMp : 0 ≤ M) (hM : ∀ f : Dual 𝕜 E, ‖f x‖ ≤ M * ‖f‖) : ‖x‖ ≤ M := by classical by_cases h : x = 0 · simp only [h, hMp, norm_zero] · obtain ⟨f, hf₁, hfx⟩ : ∃ f : E →L[𝕜] 𝕜, ‖f‖ = 1 ∧ f x = ‖x‖ := exists_dual_vector 𝕜 x h calc ‖x‖ = ‖(‖x‖ : 𝕜)‖ := RCLike.norm_coe_norm.symm _ = ‖f x‖ := by rw [hfx] _ ≤ M * ‖f‖ := hM f _ = M := by rw [hf₁, mul_one] theorem eq_zero_of_forall_dual_eq_zero {x : E} (h : ∀ f : Dual 𝕜 E, f x = (0 : 𝕜)) : x = 0 := norm_le_zero_iff.mp (norm_le_dual_bound 𝕜 x le_rfl fun f => by simp [h f]) theorem eq_zero_iff_forall_dual_eq_zero (x : E) : x = 0 ↔ ∀ g : Dual 𝕜 E, g x = 0 := ⟨fun hx => by simp [hx], fun h => eq_zero_of_forall_dual_eq_zero 𝕜 h⟩ /-- See also `geometric_hahn_banach_point_point`. -/ theorem eq_iff_forall_dual_eq {x y : E} : x = y ↔ ∀ g : Dual 𝕜 E, g x = g y := by rw [← sub_eq_zero, eq_zero_iff_forall_dual_eq_zero 𝕜 (x - y)] simp [sub_eq_zero] /-- The inclusion of a normed space in its double dual is an isometry onto its image. -/ def inclusionInDoubleDualLi : E →ₗᵢ[𝕜] Dual 𝕜 (Dual 𝕜 E) := { inclusionInDoubleDual 𝕜 E with norm_map' := by intro x apply le_antisymm · exact double_dual_bound 𝕜 E x rw [ContinuousLinearMap.norm_def] refine le_csInf ContinuousLinearMap.bounds_nonempty ?_ rintro c ⟨hc1, hc2⟩ exact norm_le_dual_bound 𝕜 x hc1 hc2 } end BidualIsometry section PolarSets open Metric Set NormedSpace /-- Given a subset `s` in a normed space `E` (over a field `𝕜`), the polar `polar 𝕜 s` is the subset of `Dual 𝕜 E` consisting of those functionals which evaluate to something of norm at most one at all points `z ∈ s`. -/ def polar (𝕜 : Type*) [NontriviallyNormedField 𝕜] {E : Type*} [SeminormedAddCommGroup E] [NormedSpace 𝕜 E] : Set E → Set (Dual 𝕜 E) := (dualPairing 𝕜 E).flip.polar variable (𝕜 : Type*) [NontriviallyNormedField 𝕜] variable {E : Type*} [SeminormedAddCommGroup E] [NormedSpace 𝕜 E] theorem mem_polar_iff {x' : Dual 𝕜 E} (s : Set E) : x' ∈ polar 𝕜 s ↔ ∀ z ∈ s, ‖x' z‖ ≤ 1 := Iff.rfl @[simp] theorem polar_univ : polar 𝕜 (univ : Set E) = {(0 : Dual 𝕜 E)} := (dualPairing 𝕜 E).flip.polar_univ (LinearMap.flip_separatingRight.mpr (dualPairing_separatingLeft 𝕜 E)) theorem isClosed_polar (s : Set E) : IsClosed (polar 𝕜 s) := by dsimp only [NormedSpace.polar] simp only [LinearMap.polar_eq_iInter, LinearMap.flip_apply] refine isClosed_biInter fun z _ => ?_ exact isClosed_Iic.preimage (ContinuousLinearMap.apply 𝕜 𝕜 z).continuous.norm @[simp] theorem polar_closure (s : Set E) : polar 𝕜 (closure s) = polar 𝕜 s := ((dualPairing 𝕜 E).flip.polar_antitone subset_closure).antisymm <| (dualPairing 𝕜 E).flip.polar_gc.l_le <| closure_minimal ((dualPairing 𝕜 E).flip.polar_gc.le_u_l s) <| by simpa [LinearMap.flip_flip] using (isClosed_polar _ _).preimage (inclusionInDoubleDual 𝕜 E).continuous variable {𝕜} /-- If `x'` is a dual element such that the norms `‖x' z‖` are bounded for `z ∈ s`, then a small scalar multiple of `x'` is in `polar 𝕜 s`. -/ theorem smul_mem_polar {s : Set E} {x' : Dual 𝕜 E} {c : 𝕜} (hc : ∀ z, z ∈ s → ‖x' z‖ ≤ ‖c‖) : c⁻¹ • x' ∈ polar 𝕜 s := by by_cases c_zero : c = 0 · simp only [c_zero, inv_zero, zero_smul] exact (dualPairing 𝕜 E).flip.zero_mem_polar _ have eq : ∀ z, ‖c⁻¹ • x' z‖ = ‖c⁻¹‖ * ‖x' z‖ := fun z => norm_smul c⁻¹ _ have le : ∀ z, z ∈ s → ‖c⁻¹ • x' z‖ ≤ ‖c⁻¹‖ * ‖c‖ := by intro z hzs rw [eq z] apply mul_le_mul (le_of_eq rfl) (hc z hzs) (norm_nonneg _) (norm_nonneg _) have cancel : ‖c⁻¹‖ * ‖c‖ = 1 := by simp only [c_zero, norm_eq_zero, Ne, not_false_iff, inv_mul_cancel, norm_inv] rwa [cancel] at le theorem polar_ball_subset_closedBall_div {c : 𝕜} (hc : 1 < ‖c‖) {r : ℝ} (hr : 0 < r) : polar 𝕜 (ball (0 : E) r) ⊆ closedBall (0 : Dual 𝕜 E) (‖c‖ / r) := by intro x' hx' rw [mem_polar_iff] at hx' simp only [polar, mem_setOf, mem_closedBall_zero_iff, mem_ball_zero_iff] at * have hcr : 0 < ‖c‖ / r := div_pos (zero_lt_one.trans hc) hr refine ContinuousLinearMap.opNorm_le_of_shell hr hcr.le hc fun x h₁ h₂ => ?_ calc ‖x' x‖ ≤ 1 := hx' _ h₂ _ ≤ ‖c‖ / r * ‖x‖ := (inv_pos_le_iff_one_le_mul' hcr).1 (by rwa [inv_div]) variable (𝕜) theorem closedBall_inv_subset_polar_closedBall {r : ℝ} : closedBall (0 : Dual 𝕜 E) r⁻¹ ⊆ polar 𝕜 (closedBall (0 : E) r) := fun x' hx' x hx => calc ‖x' x‖ ≤ ‖x'‖ * ‖x‖ := x'.le_opNorm x _ ≤ r⁻¹ * r := (mul_le_mul (mem_closedBall_zero_iff.1 hx') (mem_closedBall_zero_iff.1 hx) (norm_nonneg _) (dist_nonneg.trans hx')) _ = r / r := inv_mul_eq_div _ _ _ ≤ 1 := div_self_le_one r /-- The `polar` of closed ball in a normed space `E` is the closed ball of the dual with inverse radius. -/ theorem polar_closedBall {𝕜 E : Type*} [RCLike 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E] {r : ℝ} (hr : 0 < r) : polar 𝕜 (closedBall (0 : E) r) = closedBall (0 : Dual 𝕜 E) r⁻¹ := by refine Subset.antisymm ?_ (closedBall_inv_subset_polar_closedBall 𝕜) intro x' h simp only [mem_closedBall_zero_iff] refine ContinuousLinearMap.opNorm_le_of_ball hr (inv_nonneg.mpr hr.le) fun z _ => ?_ simpa only [one_div] using LinearMap.bound_of_ball_bound' hr 1 x'.toLinearMap h z /-- Given a neighborhood `s` of the origin in a normed space `E`, the dual norms of all elements of the polar `polar 𝕜 s` are bounded by a constant. -/ theorem isBounded_polar_of_mem_nhds_zero {s : Set E} (s_nhd : s ∈ 𝓝 (0 : E)) : IsBounded (polar 𝕜 s) := by obtain ⟨a, ha⟩ : ∃ a : 𝕜, 1 < ‖a‖ := NormedField.exists_one_lt_norm 𝕜 obtain ⟨r, r_pos, r_ball⟩ : ∃ r : ℝ, 0 < r ∧ ball 0 r ⊆ s := Metric.mem_nhds_iff.1 s_nhd exact isBounded_closedBall.subset (((dualPairing 𝕜 E).flip.polar_antitone r_ball).trans <| polar_ball_subset_closedBall_div ha r_pos) end PolarSets end NormedSpace
Analysis\Normed\Module\FiniteDimension.lean
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Analysis.Asymptotics.AsymptoticEquivalent import Mathlib.Analysis.Normed.Group.Lemmas import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.AffineIsometry import Mathlib.Analysis.NormedSpace.OperatorNorm.NormedSpace import Mathlib.Analysis.NormedSpace.RieszLemma import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Topology.Algebra.Module.FiniteDimension import Mathlib.Topology.Algebra.InfiniteSum.Module import Mathlib.Topology.Instances.Matrix /-! # Finite dimensional normed spaces over complete fields Over a complete nontrivially normed field, in finite dimension, all norms are equivalent and all linear maps are continuous. Moreover, a finite-dimensional subspace is always complete and closed. ## Main results: * `FiniteDimensional.complete` : a finite-dimensional space over a complete field is complete. This is not registered as an instance, as the field would be an unknown metavariable in typeclass resolution. * `Submodule.closed_of_finiteDimensional` : a finite-dimensional subspace over a complete field is closed * `FiniteDimensional.proper` : a finite-dimensional space over a proper field is proper. This is not registered as an instance, as the field would be an unknown metavariable in typeclass resolution. It is however registered as an instance for `𝕜 = ℝ` and `𝕜 = ℂ`. As properness implies completeness, there is no need to also register `FiniteDimensional.complete` on `ℝ` or `ℂ`. * `FiniteDimensional.of_isCompact_closedBall`: Riesz' theorem: if the closed unit ball is compact, then the space is finite-dimensional. ## Implementation notes The fact that all norms are equivalent is not written explicitly, as it would mean having two norms on a single space, which is not the way type classes work. However, if one has a finite-dimensional vector space `E` with a norm, and a copy `E'` of this type with another norm, then the identities from `E` to `E'` and from `E'`to `E` are continuous thanks to `LinearMap.continuous_of_finiteDimensional`. This gives the desired norm equivalence. -/ universe u v w x noncomputable section open Set FiniteDimensional TopologicalSpace Filter Asymptotics Topology NNReal Metric namespace LinearIsometry open LinearMap variable {R : Type*} [Semiring R] variable {F E₁ : Type*} [SeminormedAddCommGroup F] [NormedAddCommGroup E₁] [Module R E₁] variable {R₁ : Type*} [Field R₁] [Module R₁ E₁] [Module R₁ F] [FiniteDimensional R₁ E₁] [FiniteDimensional R₁ F] /-- A linear isometry between finite dimensional spaces of equal dimension can be upgraded to a linear isometry equivalence. -/ def toLinearIsometryEquiv (li : E₁ →ₗᵢ[R₁] F) (h : finrank R₁ E₁ = finrank R₁ F) : E₁ ≃ₗᵢ[R₁] F where toLinearEquiv := li.toLinearMap.linearEquivOfInjective li.injective h norm_map' := li.norm_map' @[simp] theorem coe_toLinearIsometryEquiv (li : E₁ →ₗᵢ[R₁] F) (h : finrank R₁ E₁ = finrank R₁ F) : (li.toLinearIsometryEquiv h : E₁ → F) = li := rfl @[simp] theorem toLinearIsometryEquiv_apply (li : E₁ →ₗᵢ[R₁] F) (h : finrank R₁ E₁ = finrank R₁ F) (x : E₁) : (li.toLinearIsometryEquiv h) x = li x := rfl end LinearIsometry namespace AffineIsometry open AffineMap variable {𝕜 : Type*} {V₁ V₂ : Type*} {P₁ P₂ : Type*} [NormedField 𝕜] [NormedAddCommGroup V₁] [SeminormedAddCommGroup V₂] [NormedSpace 𝕜 V₁] [NormedSpace 𝕜 V₂] [MetricSpace P₁] [PseudoMetricSpace P₂] [NormedAddTorsor V₁ P₁] [NormedAddTorsor V₂ P₂] variable [FiniteDimensional 𝕜 V₁] [FiniteDimensional 𝕜 V₂] /-- An affine isometry between finite dimensional spaces of equal dimension can be upgraded to an affine isometry equivalence. -/ def toAffineIsometryEquiv [Inhabited P₁] (li : P₁ →ᵃⁱ[𝕜] P₂) (h : finrank 𝕜 V₁ = finrank 𝕜 V₂) : P₁ ≃ᵃⁱ[𝕜] P₂ := AffineIsometryEquiv.mk' li (li.linearIsometry.toLinearIsometryEquiv h) (Inhabited.default (α := P₁)) fun p => by simp @[simp] theorem coe_toAffineIsometryEquiv [Inhabited P₁] (li : P₁ →ᵃⁱ[𝕜] P₂) (h : finrank 𝕜 V₁ = finrank 𝕜 V₂) : (li.toAffineIsometryEquiv h : P₁ → P₂) = li := rfl @[simp] theorem toAffineIsometryEquiv_apply [Inhabited P₁] (li : P₁ →ᵃⁱ[𝕜] P₂) (h : finrank 𝕜 V₁ = finrank 𝕜 V₂) (x : P₁) : (li.toAffineIsometryEquiv h) x = li x := rfl end AffineIsometry section CompleteField variable {𝕜 : Type u} [NontriviallyNormedField 𝕜] {E : Type v} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {F : Type w} [NormedAddCommGroup F] [NormedSpace 𝕜 F] {F' : Type x} [AddCommGroup F'] [Module 𝕜 F'] [TopologicalSpace F'] [TopologicalAddGroup F'] [ContinuousSMul 𝕜 F'] [CompleteSpace 𝕜] section Affine variable {PE PF : Type*} [MetricSpace PE] [NormedAddTorsor E PE] [MetricSpace PF] [NormedAddTorsor F PF] [FiniteDimensional 𝕜 E] theorem AffineMap.continuous_of_finiteDimensional (f : PE →ᵃ[𝕜] PF) : Continuous f := AffineMap.continuous_linear_iff.1 f.linear.continuous_of_finiteDimensional theorem AffineEquiv.continuous_of_finiteDimensional (f : PE ≃ᵃ[𝕜] PF) : Continuous f := f.toAffineMap.continuous_of_finiteDimensional /-- Reinterpret an affine equivalence as a homeomorphism. -/ def AffineEquiv.toHomeomorphOfFiniteDimensional (f : PE ≃ᵃ[𝕜] PF) : PE ≃ₜ PF where toEquiv := f.toEquiv continuous_toFun := f.continuous_of_finiteDimensional continuous_invFun := haveI : FiniteDimensional 𝕜 F := f.linear.finiteDimensional f.symm.continuous_of_finiteDimensional @[simp] theorem AffineEquiv.coe_toHomeomorphOfFiniteDimensional (f : PE ≃ᵃ[𝕜] PF) : ⇑f.toHomeomorphOfFiniteDimensional = f := rfl @[simp] theorem AffineEquiv.coe_toHomeomorphOfFiniteDimensional_symm (f : PE ≃ᵃ[𝕜] PF) : ⇑f.toHomeomorphOfFiniteDimensional.symm = f.symm := rfl end Affine theorem ContinuousLinearMap.continuous_det : Continuous fun f : E →L[𝕜] E => f.det := by change Continuous fun f : E →L[𝕜] E => LinearMap.det (f : E →ₗ[𝕜] E) -- Porting note: this could be easier with `det_cases` by_cases h : ∃ s : Finset E, Nonempty (Basis (↥s) 𝕜 E) · rcases h with ⟨s, ⟨b⟩⟩ haveI : FiniteDimensional 𝕜 E := FiniteDimensional.of_fintype_basis b classical simp_rw [LinearMap.det_eq_det_toMatrix_of_finset b] refine Continuous.matrix_det ?_ exact ((LinearMap.toMatrix b b).toLinearMap.comp (ContinuousLinearMap.coeLM 𝕜)).continuous_of_finiteDimensional · -- Porting note: was `unfold LinearMap.det` rw [LinearMap.det_def] simpa only [h, MonoidHom.one_apply, dif_neg, not_false_iff] using continuous_const /-- Any `K`-Lipschitz map from a subset `s` of a metric space `α` to a finite-dimensional real vector space `E'` can be extended to a Lipschitz map on the whole space `α`, with a slightly worse constant `C * K` where `C` only depends on `E'`. We record a working value for this constant `C` as `lipschitzExtensionConstant E'`. -/ irreducible_def lipschitzExtensionConstant (E' : Type*) [NormedAddCommGroup E'] [NormedSpace ℝ E'] [FiniteDimensional ℝ E'] : ℝ≥0 := let A := (Basis.ofVectorSpace ℝ E').equivFun.toContinuousLinearEquiv max (‖A.symm.toContinuousLinearMap‖₊ * ‖A.toContinuousLinearMap‖₊) 1 theorem lipschitzExtensionConstant_pos (E' : Type*) [NormedAddCommGroup E'] [NormedSpace ℝ E'] [FiniteDimensional ℝ E'] : 0 < lipschitzExtensionConstant E' := by rw [lipschitzExtensionConstant] exact zero_lt_one.trans_le (le_max_right _ _) /-- Any `K`-Lipschitz map from a subset `s` of a metric space `α` to a finite-dimensional real vector space `E'` can be extended to a Lipschitz map on the whole space `α`, with a slightly worse constant `lipschitzExtensionConstant E' * K`. -/ theorem LipschitzOnWith.extend_finite_dimension {α : Type*} [PseudoMetricSpace α] {E' : Type*} [NormedAddCommGroup E'] [NormedSpace ℝ E'] [FiniteDimensional ℝ E'] {s : Set α} {f : α → E'} {K : ℝ≥0} (hf : LipschitzOnWith K f s) : ∃ g : α → E', LipschitzWith (lipschitzExtensionConstant E' * K) g ∧ EqOn f g s := by /- This result is already known for spaces `ι → ℝ`. We use a continuous linear equiv between `E'` and such a space to transfer the result to `E'`. -/ let ι : Type _ := Basis.ofVectorSpaceIndex ℝ E' let A := (Basis.ofVectorSpace ℝ E').equivFun.toContinuousLinearEquiv have LA : LipschitzWith ‖A.toContinuousLinearMap‖₊ A := by apply A.lipschitz have L : LipschitzOnWith (‖A.toContinuousLinearMap‖₊ * K) (A ∘ f) s := LA.comp_lipschitzOnWith hf obtain ⟨g, hg, gs⟩ : ∃ g : α → ι → ℝ, LipschitzWith (‖A.toContinuousLinearMap‖₊ * K) g ∧ EqOn (A ∘ f) g s := L.extend_pi refine ⟨A.symm ∘ g, ?_, ?_⟩ · have LAsymm : LipschitzWith ‖A.symm.toContinuousLinearMap‖₊ A.symm := by apply A.symm.lipschitz apply (LAsymm.comp hg).weaken rw [lipschitzExtensionConstant, ← mul_assoc] exact mul_le_mul' (le_max_left _ _) le_rfl · intro x hx have : A (f x) = g x := gs hx simp only [(· ∘ ·), ← this, A.symm_apply_apply] theorem LinearMap.exists_antilipschitzWith [FiniteDimensional 𝕜 E] (f : E →ₗ[𝕜] F) (hf : LinearMap.ker f = ⊥) : ∃ K > 0, AntilipschitzWith K f := by cases subsingleton_or_nontrivial E · exact ⟨1, zero_lt_one, AntilipschitzWith.of_subsingleton⟩ · rw [LinearMap.ker_eq_bot] at hf let e : E ≃L[𝕜] LinearMap.range f := (LinearEquiv.ofInjective f hf).toContinuousLinearEquiv exact ⟨_, e.nnnorm_symm_pos, e.antilipschitz⟩ open Function in /-- A `LinearMap` on a finite-dimensional space over a complete field is injective iff it is anti-Lipschitz. -/ theorem LinearMap.injective_iff_antilipschitz [FiniteDimensional 𝕜 E] (f : E →ₗ[𝕜] F) : Injective f ↔ ∃ K > 0, AntilipschitzWith K f := by constructor · rw [← LinearMap.ker_eq_bot] exact f.exists_antilipschitzWith · rintro ⟨K, -, H⟩ exact H.injective open Function in /-- The set of injective continuous linear maps `E → F` is open, if `E` is finite-dimensional over a complete field. -/ theorem ContinuousLinearMap.isOpen_injective [FiniteDimensional 𝕜 E] : IsOpen { L : E →L[𝕜] F | Injective L } := by rw [isOpen_iff_eventually] rintro φ₀ hφ₀ rcases φ₀.injective_iff_antilipschitz.mp hφ₀ with ⟨K, K_pos, H⟩ have : ∀ᶠ φ in 𝓝 φ₀, ‖φ - φ₀‖₊ < K⁻¹ := eventually_nnnorm_sub_lt _ <| inv_pos_of_pos K_pos filter_upwards [this] with φ hφ apply φ.injective_iff_antilipschitz.mpr exact ⟨(K⁻¹ - ‖φ - φ₀‖₊)⁻¹, inv_pos_of_pos (tsub_pos_of_lt hφ), H.add_sub_lipschitzWith (φ - φ₀).lipschitz hφ⟩ protected theorem LinearIndependent.eventually {ι} [Finite ι] {f : ι → E} (hf : LinearIndependent 𝕜 f) : ∀ᶠ g in 𝓝 f, LinearIndependent 𝕜 g := by cases nonempty_fintype ι classical simp only [Fintype.linearIndependent_iff'] at hf ⊢ rcases LinearMap.exists_antilipschitzWith _ hf with ⟨K, K0, hK⟩ have : Tendsto (fun g : ι → E => ∑ i, ‖g i - f i‖) (𝓝 f) (𝓝 <| ∑ i, ‖f i - f i‖) := tendsto_finset_sum _ fun i _ => Tendsto.norm <| ((continuous_apply i).tendsto _).sub tendsto_const_nhds simp only [sub_self, norm_zero, Finset.sum_const_zero] at this refine (this.eventually (gt_mem_nhds <| inv_pos.2 K0)).mono fun g hg => ?_ replace hg : ∑ i, ‖g i - f i‖₊ < K⁻¹ := by rw [← NNReal.coe_lt_coe] push_cast exact hg rw [LinearMap.ker_eq_bot] refine (hK.add_sub_lipschitzWith (LipschitzWith.of_dist_le_mul fun v u => ?_) hg).injective simp only [dist_eq_norm, LinearMap.lsum_apply, Pi.sub_apply, LinearMap.sum_apply, LinearMap.comp_apply, LinearMap.proj_apply, LinearMap.smulRight_apply, LinearMap.id_apply, ← Finset.sum_sub_distrib, ← smul_sub, ← sub_smul, NNReal.coe_sum, coe_nnnorm, Finset.sum_mul] refine norm_sum_le_of_le _ fun i _ => ?_ rw [norm_smul, mul_comm] gcongr exact norm_le_pi_norm (v - u) i theorem isOpen_setOf_linearIndependent {ι : Type*} [Finite ι] : IsOpen { f : ι → E | LinearIndependent 𝕜 f } := isOpen_iff_mem_nhds.2 fun _ => LinearIndependent.eventually theorem isOpen_setOf_nat_le_rank (n : ℕ) : IsOpen { f : E →L[𝕜] F | ↑n ≤ (f : E →ₗ[𝕜] F).rank } := by simp only [LinearMap.le_rank_iff_exists_linearIndependent_finset, setOf_exists, ← exists_prop] refine isOpen_biUnion fun t _ => ?_ have : Continuous fun f : E →L[𝕜] F => fun x : (t : Set E) => f x := continuous_pi fun x => (ContinuousLinearMap.apply 𝕜 F (x : E)).continuous exact isOpen_setOf_linearIndependent.preimage this theorem Basis.opNNNorm_le {ι : Type*} [Fintype ι] (v : Basis ι 𝕜 E) {u : E →L[𝕜] F} (M : ℝ≥0) (hu : ∀ i, ‖u (v i)‖₊ ≤ M) : ‖u‖₊ ≤ Fintype.card ι • ‖v.equivFunL.toContinuousLinearMap‖₊ * M := u.opNNNorm_le_bound _ fun e => by set φ := v.equivFunL.toContinuousLinearMap calc ‖u e‖₊ = ‖u (∑ i, v.equivFun e i • v i)‖₊ := by rw [v.sum_equivFun] _ = ‖∑ i, v.equivFun e i • (u <| v i)‖₊ := by simp [map_sum, LinearMap.map_smul] _ ≤ ∑ i, ‖v.equivFun e i • (u <| v i)‖₊ := nnnorm_sum_le _ _ _ = ∑ i, ‖v.equivFun e i‖₊ * ‖u (v i)‖₊ := by simp only [nnnorm_smul] _ ≤ ∑ i, ‖v.equivFun e i‖₊ * M := by gcongr; apply hu _ = (∑ i, ‖v.equivFun e i‖₊) * M := by rw [Finset.sum_mul] _ ≤ Fintype.card ι • (‖φ‖₊ * ‖e‖₊) * M := by gcongr calc ∑ i, ‖v.equivFun e i‖₊ ≤ Fintype.card ι • ‖φ e‖₊ := Pi.sum_nnnorm_apply_le_nnnorm _ _ ≤ Fintype.card ι • (‖φ‖₊ * ‖e‖₊) := nsmul_le_nsmul_right (φ.le_opNNNorm e) _ _ = Fintype.card ι • ‖φ‖₊ * M * ‖e‖₊ := by simp only [smul_mul_assoc, mul_right_comm] @[deprecated (since := "2024-02-02")] alias Basis.op_nnnorm_le := Basis.opNNNorm_le theorem Basis.opNorm_le {ι : Type*} [Fintype ι] (v : Basis ι 𝕜 E) {u : E →L[𝕜] F} {M : ℝ} (hM : 0 ≤ M) (hu : ∀ i, ‖u (v i)‖ ≤ M) : ‖u‖ ≤ Fintype.card ι • ‖v.equivFunL.toContinuousLinearMap‖ * M := by simpa using NNReal.coe_le_coe.mpr (v.opNNNorm_le ⟨M, hM⟩ hu) @[deprecated (since := "2024-02-02")] alias Basis.op_norm_le := Basis.opNorm_le /-- A weaker version of `Basis.opNNNorm_le` that abstracts away the value of `C`. -/ theorem Basis.exists_opNNNorm_le {ι : Type*} [Finite ι] (v : Basis ι 𝕜 E) : ∃ C > (0 : ℝ≥0), ∀ {u : E →L[𝕜] F} (M : ℝ≥0), (∀ i, ‖u (v i)‖₊ ≤ M) → ‖u‖₊ ≤ C * M := by cases nonempty_fintype ι exact ⟨max (Fintype.card ι • ‖v.equivFunL.toContinuousLinearMap‖₊) 1, zero_lt_one.trans_le (le_max_right _ _), fun {u} M hu => (v.opNNNorm_le M hu).trans <| mul_le_mul_of_nonneg_right (le_max_left _ _) (zero_le M)⟩ @[deprecated (since := "2024-02-02")] alias Basis.exists_op_nnnorm_le := Basis.exists_opNNNorm_le /-- A weaker version of `Basis.opNorm_le` that abstracts away the value of `C`. -/ theorem Basis.exists_opNorm_le {ι : Type*} [Finite ι] (v : Basis ι 𝕜 E) : ∃ C > (0 : ℝ), ∀ {u : E →L[𝕜] F} {M : ℝ}, 0 ≤ M → (∀ i, ‖u (v i)‖ ≤ M) → ‖u‖ ≤ C * M := by obtain ⟨C, hC, h⟩ := v.exists_opNNNorm_le (F := F) -- Porting note: used `Subtype.forall'` below refine ⟨C, hC, ?_⟩ intro u M hM H simpa using h ⟨M, hM⟩ H @[deprecated (since := "2024-02-02")] alias Basis.exists_op_norm_le := Basis.exists_opNorm_le instance [FiniteDimensional 𝕜 E] [SecondCountableTopology F] : SecondCountableTopology (E →L[𝕜] F) := by set d := FiniteDimensional.finrank 𝕜 E suffices ∀ ε > (0 : ℝ), ∃ n : (E →L[𝕜] F) → Fin d → ℕ, ∀ f g : E →L[𝕜] F, n f = n g → dist f g ≤ ε from Metric.secondCountable_of_countable_discretization fun ε ε_pos => ⟨Fin d → ℕ, by infer_instance, this ε ε_pos⟩ intro ε ε_pos obtain ⟨u : ℕ → F, hu : DenseRange u⟩ := exists_dense_seq F let v := FiniteDimensional.finBasis 𝕜 E obtain ⟨C : ℝ, C_pos : 0 < C, hC : ∀ {φ : E →L[𝕜] F} {M : ℝ}, 0 ≤ M → (∀ i, ‖φ (v i)‖ ≤ M) → ‖φ‖ ≤ C * M⟩ := v.exists_opNorm_le (E := E) (F := F) have h_2C : 0 < 2 * C := mul_pos zero_lt_two C_pos have hε2C : 0 < ε / (2 * C) := div_pos ε_pos h_2C have : ∀ φ : E →L[𝕜] F, ∃ n : Fin d → ℕ, ‖φ - (v.constrL <| u ∘ n)‖ ≤ ε / 2 := by intro φ have : ∀ i, ∃ n, ‖φ (v i) - u n‖ ≤ ε / (2 * C) := by simp only [norm_sub_rev] intro i have : φ (v i) ∈ closure (range u) := hu _ obtain ⟨n, hn⟩ : ∃ n, ‖u n - φ (v i)‖ < ε / (2 * C) := by rw [mem_closure_iff_nhds_basis Metric.nhds_basis_ball] at this specialize this (ε / (2 * C)) hε2C simpa [dist_eq_norm] exact ⟨n, le_of_lt hn⟩ choose n hn using this use n replace hn : ∀ i : Fin d, ‖(φ - (v.constrL <| u ∘ n)) (v i)‖ ≤ ε / (2 * C) := by simp [hn] have : C * (ε / (2 * C)) = ε / 2 := by rw [eq_div_iff (two_ne_zero : (2 : ℝ) ≠ 0), mul_comm, ← mul_assoc, mul_div_cancel₀ _ (ne_of_gt h_2C)] specialize hC (le_of_lt hε2C) hn rwa [this] at hC choose n hn using this set Φ := fun φ : E →L[𝕜] F => v.constrL <| u ∘ n φ change ∀ z, dist z (Φ z) ≤ ε / 2 at hn use n intro x y hxy calc dist x y ≤ dist x (Φ x) + dist (Φ x) y := dist_triangle _ _ _ _ = dist x (Φ x) + dist y (Φ y) := by simp [Φ, hxy, dist_comm] _ ≤ ε := by linarith [hn x, hn y] theorem AffineSubspace.closed_of_finiteDimensional {P : Type*} [MetricSpace P] [NormedAddTorsor E P] (s : AffineSubspace 𝕜 P) [FiniteDimensional 𝕜 s.direction] : IsClosed (s : Set P) := s.isClosed_direction_iff.mp s.direction.closed_of_finiteDimensional section Riesz /-- In an infinite dimensional space, given a finite number of points, one may find a point with norm at most `R` which is at distance at least `1` of all these points. -/ theorem exists_norm_le_le_norm_sub_of_finset {c : 𝕜} (hc : 1 < ‖c‖) {R : ℝ} (hR : ‖c‖ < R) (h : ¬FiniteDimensional 𝕜 E) (s : Finset E) : ∃ x : E, ‖x‖ ≤ R ∧ ∀ y ∈ s, 1 ≤ ‖y - x‖ := by let F := Submodule.span 𝕜 (s : Set E) haveI : FiniteDimensional 𝕜 F := Module.finite_def.2 ((Submodule.fg_top _).2 (Submodule.fg_def.2 ⟨s, Finset.finite_toSet _, rfl⟩)) have Fclosed : IsClosed (F : Set E) := Submodule.closed_of_finiteDimensional _ have : ∃ x, x ∉ F := by contrapose! h have : (⊤ : Submodule 𝕜 E) = F := by ext x simp [h] have : FiniteDimensional 𝕜 (⊤ : Submodule 𝕜 E) := by rwa [this] exact Module.finite_def.2 ((Submodule.fg_top _).1 (Module.finite_def.1 this)) obtain ⟨x, xR, hx⟩ : ∃ x : E, ‖x‖ ≤ R ∧ ∀ y : E, y ∈ F → 1 ≤ ‖x - y‖ := riesz_lemma_of_norm_lt hc hR Fclosed this have hx' : ∀ y : E, y ∈ F → 1 ≤ ‖y - x‖ := by intro y hy rw [← norm_neg] simpa using hx y hy exact ⟨x, xR, fun y hy => hx' _ (Submodule.subset_span hy)⟩ /-- In an infinite-dimensional normed space, there exists a sequence of points which are all bounded by `R` and at distance at least `1`. For a version not assuming `c` and `R`, see `exists_seq_norm_le_one_le_norm_sub`. -/ theorem exists_seq_norm_le_one_le_norm_sub' {c : 𝕜} (hc : 1 < ‖c‖) {R : ℝ} (hR : ‖c‖ < R) (h : ¬FiniteDimensional 𝕜 E) : ∃ f : ℕ → E, (∀ n, ‖f n‖ ≤ R) ∧ Pairwise fun m n => 1 ≤ ‖f m - f n‖ := by have : IsSymm E fun x y : E => 1 ≤ ‖x - y‖ := by constructor intro x y hxy rw [← norm_neg] simpa apply exists_seq_of_forall_finset_exists' (fun x : E => ‖x‖ ≤ R) fun (x : E) (y : E) => 1 ≤ ‖x - y‖ rintro s - exact exists_norm_le_le_norm_sub_of_finset hc hR h s theorem exists_seq_norm_le_one_le_norm_sub (h : ¬FiniteDimensional 𝕜 E) : ∃ (R : ℝ) (f : ℕ → E), 1 < R ∧ (∀ n, ‖f n‖ ≤ R) ∧ Pairwise fun m n => 1 ≤ ‖f m - f n‖ := by obtain ⟨c, hc⟩ : ∃ c : 𝕜, 1 < ‖c‖ := NormedField.exists_one_lt_norm 𝕜 have A : ‖c‖ < ‖c‖ + 1 := by linarith rcases exists_seq_norm_le_one_le_norm_sub' hc A h with ⟨f, hf⟩ exact ⟨‖c‖ + 1, f, hc.trans A, hf.1, hf.2⟩ variable (𝕜) /-- **Riesz's theorem**: if a closed ball with center zero of positive radius is compact in a vector space, then the space is finite-dimensional. -/ theorem FiniteDimensional.of_isCompact_closedBall₀ {r : ℝ} (rpos : 0 < r) (h : IsCompact (Metric.closedBall (0 : E) r)) : FiniteDimensional 𝕜 E := by by_contra hfin obtain ⟨R, f, Rgt, fle, lef⟩ : ∃ (R : ℝ) (f : ℕ → E), 1 < R ∧ (∀ n, ‖f n‖ ≤ R) ∧ Pairwise fun m n => 1 ≤ ‖f m - f n‖ := exists_seq_norm_le_one_le_norm_sub hfin have rRpos : 0 < r / R := div_pos rpos (zero_lt_one.trans Rgt) obtain ⟨c, hc⟩ : ∃ c : 𝕜, 0 < ‖c‖ ∧ ‖c‖ < r / R := NormedField.exists_norm_lt _ rRpos let g := fun n : ℕ => c • f n have A : ∀ n, g n ∈ Metric.closedBall (0 : E) r := by intro n simp only [g, norm_smul, dist_zero_right, Metric.mem_closedBall] calc ‖c‖ * ‖f n‖ ≤ r / R * R := by gcongr · exact hc.2.le · apply fle _ = r := by field_simp [(zero_lt_one.trans Rgt).ne'] -- Porting note: moved type ascriptions because of exists_prop changes obtain ⟨x : E, _ : x ∈ Metric.closedBall (0 : E) r, φ : ℕ → ℕ, φmono : StrictMono φ, φlim : Tendsto (g ∘ φ) atTop (𝓝 x)⟩ := h.tendsto_subseq A have B : CauchySeq (g ∘ φ) := φlim.cauchySeq obtain ⟨N, hN⟩ : ∃ N : ℕ, ∀ n : ℕ, N ≤ n → dist ((g ∘ φ) n) ((g ∘ φ) N) < ‖c‖ := Metric.cauchySeq_iff'.1 B ‖c‖ hc.1 apply lt_irrefl ‖c‖ calc ‖c‖ ≤ dist (g (φ (N + 1))) (g (φ N)) := by conv_lhs => rw [← mul_one ‖c‖] simp only [g, dist_eq_norm, ← smul_sub, norm_smul] gcongr apply lef (ne_of_gt _) exact φmono (Nat.lt_succ_self N) _ < ‖c‖ := hN (N + 1) (Nat.le_succ N) @[deprecated (since := "2024-02-02")] alias finiteDimensional_of_isCompact_closedBall₀ := FiniteDimensional.of_isCompact_closedBall₀ /-- **Riesz's theorem**: if a closed ball of positive radius is compact in a vector space, then the space is finite-dimensional. -/ theorem FiniteDimensional.of_isCompact_closedBall {r : ℝ} (rpos : 0 < r) {c : E} (h : IsCompact (Metric.closedBall c r)) : FiniteDimensional 𝕜 E := .of_isCompact_closedBall₀ 𝕜 rpos <| by simpa using h.vadd (-c) @[deprecated (since := "2024-02-02")] alias finiteDimensional_of_isCompact_closedBall := FiniteDimensional.of_isCompact_closedBall /-- **Riesz's theorem**: a locally compact normed vector space is finite-dimensional. -/ theorem FiniteDimensional.of_locallyCompactSpace [LocallyCompactSpace E] : FiniteDimensional 𝕜 E := let ⟨_r, rpos, hr⟩ := exists_isCompact_closedBall (0 : E) .of_isCompact_closedBall₀ 𝕜 rpos hr @[deprecated (since := "2024-02-02")] alias finiteDimensional_of_locallyCompactSpace := FiniteDimensional.of_locallyCompactSpace /-- If a function has compact support, then either the function is trivial or the space is finite-dimensional. -/ theorem HasCompactSupport.eq_zero_or_finiteDimensional {X : Type*} [TopologicalSpace X] [Zero X] [T1Space X] {f : E → X} (hf : HasCompactSupport f) (h'f : Continuous f) : f = 0 ∨ FiniteDimensional 𝕜 E := (HasCompactSupport.eq_zero_or_locallyCompactSpace_of_addGroup hf h'f).imp_right fun h ↦ -- TODO: Lean doesn't find the instance without this `have` have : LocallyCompactSpace E := h; .of_locallyCompactSpace 𝕜 /-- If a function has compact multiplicative support, then either the function is trivial or the space is finite-dimensional. -/ @[to_additive existing] theorem HasCompactMulSupport.eq_one_or_finiteDimensional {X : Type*} [TopologicalSpace X] [One X] [T1Space X] {f : E → X} (hf : HasCompactMulSupport f) (h'f : Continuous f) : f = 1 ∨ FiniteDimensional 𝕜 E := have : T1Space (Additive X) := ‹_› HasCompactSupport.eq_zero_or_finiteDimensional (X := Additive X) 𝕜 hf h'f /-- A locally compact normed vector space is proper. -/ lemma ProperSpace.of_locallyCompactSpace (𝕜 : Type*) [NontriviallyNormedField 𝕜] {E : Type*} [SeminormedAddCommGroup E] [NormedSpace 𝕜 E] [LocallyCompactSpace E] : ProperSpace E := by rcases exists_isCompact_closedBall (0 : E) with ⟨r, rpos, hr⟩ rcases NormedField.exists_one_lt_norm 𝕜 with ⟨c, hc⟩ have hC : ∀ n, IsCompact (closedBall (0 : E) (‖c‖^n * r)) := fun n ↦ by have : c ^ n ≠ 0 := pow_ne_zero _ <| fun h ↦ by simp [h, zero_le_one.not_lt] at hc simpa [_root_.smul_closedBall' this] using hr.smul (c ^ n) have hTop : Tendsto (fun n ↦ ‖c‖^n * r) atTop atTop := Tendsto.atTop_mul_const rpos (tendsto_pow_atTop_atTop_of_one_lt hc) exact .of_seq_closedBall hTop (eventually_of_forall hC) @[deprecated (since := "2024-01-31")] alias properSpace_of_locallyCompactSpace := ProperSpace.of_locallyCompactSpace variable (E) lemma ProperSpace.of_locallyCompact_module [Nontrivial E] [LocallyCompactSpace E] : ProperSpace 𝕜 := have : LocallyCompactSpace 𝕜 := by obtain ⟨v, hv⟩ : ∃ v : E, v ≠ 0 := exists_ne 0 let L : 𝕜 → E := fun t ↦ t • v have : ClosedEmbedding L := closedEmbedding_smul_left hv apply ClosedEmbedding.locallyCompactSpace this .of_locallyCompactSpace 𝕜 @[deprecated (since := "2024-01-31")] alias properSpace_of_locallyCompact_module := ProperSpace.of_locallyCompact_module end Riesz open ContinuousLinearMap /-- Continuous linear equivalence between continuous linear functions `𝕜ⁿ → E` and `Eⁿ`. The spaces `𝕜ⁿ` and `Eⁿ` are represented as `ι → 𝕜` and `ι → E`, respectively, where `ι` is a finite type. -/ def ContinuousLinearEquiv.piRing (ι : Type*) [Fintype ι] [DecidableEq ι] : ((ι → 𝕜) →L[𝕜] E) ≃L[𝕜] ι → E := { LinearMap.toContinuousLinearMap.symm.trans (LinearEquiv.piRing 𝕜 E ι 𝕜) with continuous_toFun := by refine continuous_pi fun i => ?_ exact (ContinuousLinearMap.apply 𝕜 E (Pi.single i 1)).continuous continuous_invFun := by simp_rw [LinearEquiv.invFun_eq_symm, LinearEquiv.trans_symm, LinearEquiv.symm_symm] -- Note: added explicit type and removed `change` that tried to achieve the same refine AddMonoidHomClass.continuous_of_bound (LinearMap.toContinuousLinearMap.toLinearMap.comp (LinearEquiv.piRing 𝕜 E ι 𝕜).symm.toLinearMap) (Fintype.card ι : ℝ) fun g => ?_ rw [← nsmul_eq_mul] refine opNorm_le_bound _ (nsmul_nonneg (norm_nonneg g) (Fintype.card ι)) fun t => ?_ simp_rw [LinearMap.coe_comp, LinearEquiv.coe_toLinearMap, Function.comp_apply, LinearMap.coe_toContinuousLinearMap', LinearEquiv.piRing_symm_apply] apply le_trans (norm_sum_le _ _) rw [smul_mul_assoc] refine Finset.sum_le_card_nsmul _ _ _ fun i _ => ?_ rw [norm_smul, mul_comm] gcongr <;> apply norm_le_pi_norm } /-- A family of continuous linear maps is continuous on `s` if all its applications are. -/ theorem continuousOn_clm_apply {X : Type*} [TopologicalSpace X] [FiniteDimensional 𝕜 E] {f : X → E →L[𝕜] F} {s : Set X} : ContinuousOn f s ↔ ∀ y, ContinuousOn (fun x => f x y) s := by refine ⟨fun h y => (ContinuousLinearMap.apply 𝕜 F y).continuous.comp_continuousOn h, fun h => ?_⟩ let d := finrank 𝕜 E have hd : d = finrank 𝕜 (Fin d → 𝕜) := (finrank_fin_fun 𝕜).symm let e₁ : E ≃L[𝕜] Fin d → 𝕜 := ContinuousLinearEquiv.ofFinrankEq hd let e₂ : (E →L[𝕜] F) ≃L[𝕜] Fin d → F := (e₁.arrowCongr (1 : F ≃L[𝕜] F)).trans (ContinuousLinearEquiv.piRing (Fin d)) rw [← f.id_comp, ← e₂.symm_comp_self] exact e₂.symm.continuous.comp_continuousOn (continuousOn_pi.mpr fun i => h _) theorem continuous_clm_apply {X : Type*} [TopologicalSpace X] [FiniteDimensional 𝕜 E] {f : X → E →L[𝕜] F} : Continuous f ↔ ∀ y, Continuous (f · y) := by simp_rw [continuous_iff_continuousOn_univ, continuousOn_clm_apply] end CompleteField section LocallyCompactField variable (𝕜 : Type u) [NontriviallyNormedField 𝕜] (E : Type v) [NormedAddCommGroup E] [NormedSpace 𝕜 E] [LocallyCompactSpace 𝕜] /-- Any finite-dimensional vector space over a locally compact field is proper. We do not register this as an instance to avoid an instance loop when trying to prove the properness of `𝕜`, and the search for `𝕜` as an unknown metavariable. Declare the instance explicitly when needed. -/ theorem FiniteDimensional.proper [FiniteDimensional 𝕜 E] : ProperSpace E := by have : ProperSpace 𝕜 := .of_locallyCompactSpace 𝕜 set e := ContinuousLinearEquiv.ofFinrankEq (@finrank_fin_fun 𝕜 _ _ (finrank 𝕜 E)).symm exact e.symm.antilipschitz.properSpace e.symm.continuous e.symm.surjective end LocallyCompactField /- Over the real numbers, we can register the previous statement as an instance as it will not cause problems in instance resolution since the properness of `ℝ` is already known. -/ instance (priority := 900) FiniteDimensional.proper_real (E : Type u) [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] : ProperSpace E := FiniteDimensional.proper ℝ E /-- A submodule of a locally compact space over a complete field is also locally compact (and even proper). -/ instance {𝕜 E : Type*} [NontriviallyNormedField 𝕜] [CompleteSpace 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E] [LocallyCompactSpace E] (S : Submodule 𝕜 E) : ProperSpace S := by nontriviality E have : ProperSpace 𝕜 := .of_locallyCompact_module 𝕜 E have : FiniteDimensional 𝕜 E := .of_locallyCompactSpace 𝕜 exact FiniteDimensional.proper 𝕜 S /-- If `E` is a finite dimensional normed real vector space, `x : E`, and `s` is a neighborhood of `x` that is not equal to the whole space, then there exists a point `y ∈ frontier s` at distance `Metric.infDist x sᶜ` from `x`. See also `IsCompact.exists_mem_frontier_infDist_compl_eq_dist`. -/ theorem exists_mem_frontier_infDist_compl_eq_dist {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] {x : E} {s : Set E} (hx : x ∈ s) (hs : s ≠ univ) : ∃ y ∈ frontier s, Metric.infDist x sᶜ = dist x y := by rcases Metric.exists_mem_closure_infDist_eq_dist (nonempty_compl.2 hs) x with ⟨y, hys, hyd⟩ rw [closure_compl] at hys refine ⟨y, ⟨Metric.closedBall_infDist_compl_subset_closure hx <| Metric.mem_closedBall.2 <| ge_of_eq ?_, hys⟩, hyd⟩ rwa [dist_comm] /-- If `K` is a compact set in a nontrivial real normed space and `x ∈ K`, then there exists a point `y` of the boundary of `K` at distance `Metric.infDist x Kᶜ` from `x`. See also `exists_mem_frontier_infDist_compl_eq_dist`. -/ nonrec theorem IsCompact.exists_mem_frontier_infDist_compl_eq_dist {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [Nontrivial E] {x : E} {K : Set E} (hK : IsCompact K) (hx : x ∈ K) : ∃ y ∈ frontier K, Metric.infDist x Kᶜ = dist x y := by obtain hx' | hx' : x ∈ interior K ∪ frontier K := by rw [← closure_eq_interior_union_frontier] exact subset_closure hx · rw [mem_interior_iff_mem_nhds, Metric.nhds_basis_closedBall.mem_iff] at hx' rcases hx' with ⟨r, hr₀, hrK⟩ have : FiniteDimensional ℝ E := .of_isCompact_closedBall ℝ hr₀ (hK.of_isClosed_subset Metric.isClosed_ball hrK) exact exists_mem_frontier_infDist_compl_eq_dist hx hK.ne_univ · refine ⟨x, hx', ?_⟩ rw [frontier_eq_closure_inter_closure] at hx' rw [Metric.infDist_zero_of_mem_closure hx'.2, dist_self] /-- In a finite dimensional vector space over `ℝ`, the series `∑ x, ‖f x‖` is unconditionally summable if and only if the series `∑ x, f x` is unconditionally summable. One implication holds in any complete normed space, while the other holds only in finite dimensional spaces. -/ theorem summable_norm_iff {α E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] {f : α → E} : (Summable fun x => ‖f x‖) ↔ Summable f := by refine ⟨Summable.of_norm, fun hf ↦ ?_⟩ -- First we use a finite basis to reduce the problem to the case `E = Fin N → ℝ` suffices ∀ {N : ℕ} {g : α → Fin N → ℝ}, Summable g → Summable fun x => ‖g x‖ by obtain v := finBasis ℝ E set e := v.equivFunL have H : Summable fun x => ‖e (f x)‖ := this (e.summable.2 hf) refine .of_norm_bounded _ (H.mul_left ↑‖(e.symm : (Fin (finrank ℝ E) → ℝ) →L[ℝ] E)‖₊) fun i ↦ ?_ simpa using (e.symm : (Fin (finrank ℝ E) → ℝ) →L[ℝ] E).le_opNorm (e <| f i) clear! E -- Now we deal with `g : α → Fin N → ℝ` intro N g hg have : ∀ i, Summable fun x => ‖g x i‖ := fun i => (Pi.summable.1 hg i).abs refine .of_norm_bounded _ (summable_sum fun i (_ : i ∈ Finset.univ) => this i) fun x => ?_ rw [norm_norm, pi_norm_le_iff_of_nonneg] · refine fun i => Finset.single_le_sum (f := fun i => ‖g x i‖) (fun i _ => ?_) (Finset.mem_univ i) exact norm_nonneg (g x i) · exact Finset.sum_nonneg fun _ _ => norm_nonneg _ alias ⟨_, Summable.norm⟩ := summable_norm_iff theorem summable_of_isBigO' {ι E F : Type*} [NormedAddCommGroup E] [CompleteSpace E] [NormedAddCommGroup F] [NormedSpace ℝ F] [FiniteDimensional ℝ F] {f : ι → E} {g : ι → F} (hg : Summable g) (h : f =O[cofinite] g) : Summable f := summable_of_isBigO hg.norm h.norm_right lemma Asymptotics.IsBigO.comp_summable {ι E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] [NormedAddCommGroup F] [CompleteSpace F] {f : E → F} (hf : f =O[𝓝 0] id) {g : ι → E} (hg : Summable g) : Summable (f ∘ g) := .of_norm <| hf.comp_summable_norm hg.norm theorem summable_of_isBigO_nat' {E F : Type*} [NormedAddCommGroup E] [CompleteSpace E] [NormedAddCommGroup F] [NormedSpace ℝ F] [FiniteDimensional ℝ F] {f : ℕ → E} {g : ℕ → F} (hg : Summable g) (h : f =O[atTop] g) : Summable f := summable_of_isBigO_nat hg.norm h.norm_right theorem summable_of_isEquivalent {ι E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] {f : ι → E} {g : ι → E} (hg : Summable g) (h : f ~[cofinite] g) : Summable f := hg.trans_sub (summable_of_isBigO' hg h.isLittleO.isBigO) theorem summable_of_isEquivalent_nat {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] {f : ℕ → E} {g : ℕ → E} (hg : Summable g) (h : f ~[atTop] g) : Summable f := hg.trans_sub (summable_of_isBigO_nat' hg h.isLittleO.isBigO) theorem IsEquivalent.summable_iff {ι E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] {f : ι → E} {g : ι → E} (h : f ~[cofinite] g) : Summable f ↔ Summable g := ⟨fun hf => summable_of_isEquivalent hf h.symm, fun hg => summable_of_isEquivalent hg h⟩ theorem IsEquivalent.summable_iff_nat {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] {f : ℕ → E} {g : ℕ → E} (h : f ~[atTop] g) : Summable f ↔ Summable g := ⟨fun hf => summable_of_isEquivalent_nat hf h.symm, fun hg => summable_of_isEquivalent_nat hg h⟩
Analysis\Normed\Module\Ray.lean
/- Copyright (c) 2022 Yury Kudryashov. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yury Kudryashov, Yaël Dillies -/ import Mathlib.LinearAlgebra.Ray import Mathlib.Analysis.NormedSpace.Real /-! # Rays in a real normed vector space In this file we prove some lemmas about the `SameRay` predicate in case of a real normed space. In this case, for two vectors `x y` in the same ray, the norm of their sum is equal to the sum of their norms and `‖y‖ • x = ‖x‖ • y`. -/ open Real variable {E : Type*} [SeminormedAddCommGroup E] [NormedSpace ℝ E] {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] namespace SameRay variable {x y : E} /-- If `x` and `y` are on the same ray, then the triangle inequality becomes the equality: the norm of `x + y` is the sum of the norms of `x` and `y`. The converse is true for a strictly convex space. -/ theorem norm_add (h : SameRay ℝ x y) : ‖x + y‖ = ‖x‖ + ‖y‖ := by rcases h.exists_eq_smul with ⟨u, a, b, ha, hb, -, rfl, rfl⟩ rw [← add_smul, norm_smul_of_nonneg (add_nonneg ha hb), norm_smul_of_nonneg ha, norm_smul_of_nonneg hb, add_mul] theorem norm_sub (h : SameRay ℝ x y) : ‖x - y‖ = |‖x‖ - ‖y‖| := by rcases h.exists_eq_smul with ⟨u, a, b, ha, hb, -, rfl, rfl⟩ wlog hab : b ≤ a generalizing a b with H · rw [SameRay.sameRay_comm] at h rw [norm_sub_rev, abs_sub_comm] exact H b a hb ha h (le_of_not_le hab) rw [← sub_nonneg] at hab rw [← sub_smul, norm_smul_of_nonneg hab, norm_smul_of_nonneg ha, norm_smul_of_nonneg hb, ← sub_mul, abs_of_nonneg (mul_nonneg hab (norm_nonneg _))] theorem norm_smul_eq (h : SameRay ℝ x y) : ‖x‖ • y = ‖y‖ • x := by rcases h.exists_eq_smul with ⟨u, a, b, ha, hb, -, rfl, rfl⟩ simp only [norm_smul_of_nonneg, *, mul_smul] rw [smul_comm, smul_comm b, smul_comm a b u] end SameRay variable {x y : F} theorem norm_injOn_ray_left (hx : x ≠ 0) : { y | SameRay ℝ x y }.InjOn norm := by rintro y hy z hz h rcases hy.exists_nonneg_left hx with ⟨r, hr, rfl⟩ rcases hz.exists_nonneg_left hx with ⟨s, hs, rfl⟩ rw [norm_smul, norm_smul, mul_left_inj' (norm_ne_zero_iff.2 hx), norm_of_nonneg hr, norm_of_nonneg hs] at h rw [h] theorem norm_injOn_ray_right (hy : y ≠ 0) : { x | SameRay ℝ x y }.InjOn norm := by simpa only [SameRay.sameRay_comm] using norm_injOn_ray_left hy theorem sameRay_iff_norm_smul_eq : SameRay ℝ x y ↔ ‖x‖ • y = ‖y‖ • x := ⟨SameRay.norm_smul_eq, fun h => or_iff_not_imp_left.2 fun hx => or_iff_not_imp_left.2 fun hy => ⟨‖y‖, ‖x‖, norm_pos_iff.2 hy, norm_pos_iff.2 hx, h.symm⟩⟩ /-- Two nonzero vectors `x y` in a real normed space are on the same ray if and only if the unit vectors `‖x‖⁻¹ • x` and `‖y‖⁻¹ • y` are equal. -/ theorem sameRay_iff_inv_norm_smul_eq_of_ne (hx : x ≠ 0) (hy : y ≠ 0) : SameRay ℝ x y ↔ ‖x‖⁻¹ • x = ‖y‖⁻¹ • y := by rw [inv_smul_eq_iff₀, smul_comm, eq_comm, inv_smul_eq_iff₀, sameRay_iff_norm_smul_eq] <;> rwa [norm_ne_zero_iff] alias ⟨SameRay.inv_norm_smul_eq, _⟩ := sameRay_iff_inv_norm_smul_eq_of_ne /-- Two vectors `x y` in a real normed space are on the ray if and only if one of them is zero or the unit vectors `‖x‖⁻¹ • x` and `‖y‖⁻¹ • y` are equal. -/ theorem sameRay_iff_inv_norm_smul_eq : SameRay ℝ x y ↔ x = 0 ∨ y = 0 ∨ ‖x‖⁻¹ • x = ‖y‖⁻¹ • y := by rcases eq_or_ne x 0 with (rfl | hx); · simp [SameRay.zero_left] rcases eq_or_ne y 0 with (rfl | hy); · simp [SameRay.zero_right] simp only [sameRay_iff_inv_norm_smul_eq_of_ne hx hy, *, false_or_iff] /-- Two vectors of the same norm are on the same ray if and only if they are equal. -/ theorem sameRay_iff_of_norm_eq (h : ‖x‖ = ‖y‖) : SameRay ℝ x y ↔ x = y := by obtain rfl | hy := eq_or_ne y 0 · rw [norm_zero, norm_eq_zero] at h exact iff_of_true (SameRay.zero_right _) h · exact ⟨fun hxy => norm_injOn_ray_right hy hxy SameRay.rfl h, fun hxy => hxy ▸ SameRay.rfl⟩ theorem not_sameRay_iff_of_norm_eq (h : ‖x‖ = ‖y‖) : ¬SameRay ℝ x y ↔ x ≠ y := (sameRay_iff_of_norm_eq h).not /-- If two points on the same ray have the same norm, then they are equal. -/ theorem SameRay.eq_of_norm_eq (h : SameRay ℝ x y) (hn : ‖x‖ = ‖y‖) : x = y := (sameRay_iff_of_norm_eq hn).mp h /-- The norms of two vectors on the same ray are equal if and only if they are equal. -/ theorem SameRay.norm_eq_iff (h : SameRay ℝ x y) : ‖x‖ = ‖y‖ ↔ x = y := ⟨h.eq_of_norm_eq, fun h => h ▸ rfl⟩
Analysis\Normed\Module\Span.lean
/- Copyright (c) 2024 Moritz Doll. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Moritz Doll -/ import Mathlib.Analysis.Normed.Operator.LinearIsometry import Mathlib.Analysis.Normed.Operator.ContinuousLinearMap import Mathlib.Analysis.Normed.Module.Basic /-! # The span of a single vector The equivalence of `𝕜` and `𝕜 • x` for `x ≠ 0` are defined as continuous linear equivalence and isometry. ## Main definitions * `ContinuousLinearEquiv.toSpanNonzeroSingleton`: The continuous linear equivalence between `𝕜` and `𝕜 • x` for `x ≠ 0`. * `LinearIsometryEquiv.toSpanUnitSingleton`: For `‖x‖ = 1` the continuous linear equivalence is a linear isometry equivalence. -/ variable {𝕜 E : Type*} namespace LinearMap variable (𝕜) section Seminormed variable [NormedDivisionRing 𝕜] [SeminormedAddCommGroup E] [Module 𝕜 E] [BoundedSMul 𝕜 E] theorem toSpanSingleton_homothety (x : E) (c : 𝕜) : ‖LinearMap.toSpanSingleton 𝕜 E x c‖ = ‖x‖ * ‖c‖ := by rw [mul_comm] exact norm_smul _ _ end Seminormed end LinearMap namespace ContinuousLinearEquiv variable (𝕜) section Seminormed variable [NormedDivisionRing 𝕜] [SeminormedAddCommGroup E] [Module 𝕜 E] [BoundedSMul 𝕜 E] theorem _root_.LinearEquiv.toSpanNonzeroSingleton_homothety (x : E) (h : x ≠ 0) (c : 𝕜) : ‖LinearEquiv.toSpanNonzeroSingleton 𝕜 E x h c‖ = ‖x‖ * ‖c‖ := LinearMap.toSpanSingleton_homothety _ _ _ end Seminormed section Normed variable [NormedField 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E] /-- Given a nonzero element `x` of a normed space `E₁` over a field `𝕜`, the natural continuous linear equivalence from `E₁` to the span of `x`. -/ noncomputable def toSpanNonzeroSingleton (x : E) (h : x ≠ 0) : 𝕜 ≃L[𝕜] 𝕜 ∙ x := ofHomothety (LinearEquiv.toSpanNonzeroSingleton 𝕜 E x h) ‖x‖ (norm_pos_iff.mpr h) (LinearEquiv.toSpanNonzeroSingleton_homothety 𝕜 x h) /-- Given a nonzero element `x` of a normed space `E₁` over a field `𝕜`, the natural continuous linear map from the span of `x` to `𝕜`. -/ noncomputable def coord (x : E) (h : x ≠ 0) : (𝕜 ∙ x) →L[𝕜] 𝕜 := (toSpanNonzeroSingleton 𝕜 x h).symm @[simp] theorem coe_toSpanNonzeroSingleton_symm {x : E} (h : x ≠ 0) : ⇑(toSpanNonzeroSingleton 𝕜 x h).symm = coord 𝕜 x h := rfl @[simp] theorem coord_toSpanNonzeroSingleton {x : E} (h : x ≠ 0) (c : 𝕜) : coord 𝕜 x h (toSpanNonzeroSingleton 𝕜 x h c) = c := (toSpanNonzeroSingleton 𝕜 x h).symm_apply_apply c @[simp] theorem toSpanNonzeroSingleton_coord {x : E} (h : x ≠ 0) (y : 𝕜 ∙ x) : toSpanNonzeroSingleton 𝕜 x h (coord 𝕜 x h y) = y := (toSpanNonzeroSingleton 𝕜 x h).apply_symm_apply y @[simp] theorem coord_self (x : E) (h : x ≠ 0) : (coord 𝕜 x h) (⟨x, Submodule.mem_span_singleton_self x⟩ : 𝕜 ∙ x) = 1 := LinearEquiv.coord_self 𝕜 E x h end Normed end ContinuousLinearEquiv namespace LinearIsometryEquiv variable [NormedDivisionRing 𝕜] [SeminormedAddCommGroup E] [Module 𝕜 E] [BoundedSMul 𝕜 E] /-- Given a unit element `x` of a normed space `E` over a field `𝕜`, the natural linear isometry equivalence from `E` to the span of `x`. -/ noncomputable def toSpanUnitSingleton (x : E) (hx : ‖x‖ = 1) : 𝕜 ≃ₗᵢ[𝕜] 𝕜 ∙ x where toLinearEquiv := LinearEquiv.toSpanNonzeroSingleton 𝕜 E x (by aesop) norm_map' := by intro rw [LinearEquiv.toSpanNonzeroSingleton_homothety, hx, one_mul] @[simp] theorem toSpanUnitSingleton_apply (x : E) (hx : ‖x‖ = 1) (r : 𝕜) : toSpanUnitSingleton x hx r = (⟨r • x, by aesop⟩ : 𝕜 ∙ x) := by rfl end LinearIsometryEquiv
Analysis\Normed\Module\WeakDual.lean
/- Copyright (c) 2021 Kalle Kytölä. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kalle Kytölä, Yury Kudryashov -/ import Mathlib.Analysis.Normed.Module.Dual import Mathlib.Analysis.NormedSpace.OperatorNorm.Completeness /-! # Weak dual of normed space Let `E` be a normed space over a field `𝕜`. This file is concerned with properties of the weak-* topology on the dual of `E`. By the dual, we mean either of the type synonyms `NormedSpace.Dual 𝕜 E` or `WeakDual 𝕜 E`, depending on whether it is viewed as equipped with its usual operator norm topology or the weak-* topology. It is shown that the canonical mapping `NormedSpace.Dual 𝕜 E → WeakDual 𝕜 E` is continuous, and as a consequence the weak-* topology is coarser than the topology obtained from the operator norm (dual norm). In this file, we also establish the Banach-Alaoglu theorem about the compactness of closed balls in the dual of `E` (as well as sets of somewhat more general form) with respect to the weak-* topology. ## Main definitions The main definitions concern the canonical mapping `Dual 𝕜 E → WeakDual 𝕜 E`. * `NormedSpace.Dual.toWeakDual` and `WeakDual.toNormedDual`: Linear equivalences from `dual 𝕜 E` to `WeakDual 𝕜 E` and in the converse direction. * `NormedSpace.Dual.continuousLinearMapToWeakDual`: A continuous linear mapping from `Dual 𝕜 E` to `WeakDual 𝕜 E` (same as `NormedSpace.Dual.toWeakDual` but different bundled data). ## Main results The first main result concerns the comparison of the operator norm topology on `dual 𝕜 E` and the weak-* topology on (its type synonym) `WeakDual 𝕜 E`: * `dual_norm_topology_le_weak_dual_topology`: The weak-* topology on the dual of a normed space is coarser (not necessarily strictly) than the operator norm topology. * `WeakDual.isCompact_polar` (a version of the Banach-Alaoglu theorem): The polar set of a neighborhood of the origin in a normed space `E` over `𝕜` is compact in `WeakDual _ E`, if the nontrivially normed field `𝕜` is proper as a topological space. * `WeakDual.isCompact_closedBall` (the most common special case of the Banach-Alaoglu theorem): Closed balls in the dual of a normed space `E` over `ℝ` or `ℂ` are compact in the weak-star topology. ## TODO * Add that in finite dimensions, the weak-* topology and the dual norm topology coincide. * Add that in infinite dimensions, the weak-* topology is strictly coarser than the dual norm topology. * Add metrizability of the dual unit ball (more generally weak-star compact subsets) of `WeakDual 𝕜 E` under the assumption of separability of `E`. * Add the sequential Banach-Alaoglu theorem: the dual unit ball of a separable normed space `E` is sequentially compact in the weak-star topology. This would follow from the metrizability above. ## Notations No new notation is introduced. ## Implementation notes Weak-* topology is defined generally in the file `Topology.Algebra.Module.WeakDual`. When `E` is a normed space, the duals `Dual 𝕜 E` and `WeakDual 𝕜 E` are type synonyms with different topology instances. For the proof of Banach-Alaoglu theorem, the weak dual of `E` is embedded in the space of functions `E → 𝕜` with the topology of pointwise convergence. The polar set `polar 𝕜 s` of a subset `s` of `E` is originally defined as a subset of the dual `Dual 𝕜 E`. We care about properties of these w.r.t. weak-* topology, and for this purpose give the definition `WeakDual.polar 𝕜 s` for the "same" subset viewed as a subset of `WeakDual 𝕜 E` (a type synonym of the dual but with a different topology instance). ## References * https://en.wikipedia.org/wiki/Weak_topology#Weak-*_topology * https://en.wikipedia.org/wiki/Banach%E2%80%93Alaoglu_theorem ## Tags weak-star, weak dual -/ noncomputable section open Filter Function Bornology Metric Set open Topology Filter /-! ### Weak star topology on duals of normed spaces In this section, we prove properties about the weak-* topology on duals of normed spaces. We prove in particular that the canonical mapping `Dual 𝕜 E → WeakDual 𝕜 E` is continuous, i.e., that the weak-* topology is coarser (not necessarily strictly) than the topology given by the dual-norm (i.e. the operator-norm). -/ variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] variable {E : Type*} [SeminormedAddCommGroup E] [NormedSpace 𝕜 E] namespace NormedSpace namespace Dual /-- For normed spaces `E`, there is a canonical map `Dual 𝕜 E → WeakDual 𝕜 E` (the "identity" mapping). It is a linear equivalence. -/ def toWeakDual : Dual 𝕜 E ≃ₗ[𝕜] WeakDual 𝕜 E := LinearEquiv.refl 𝕜 (E →L[𝕜] 𝕜) @[simp] theorem coe_toWeakDual (x' : Dual 𝕜 E) : toWeakDual x' = x' := rfl @[simp] theorem toWeakDual_eq_iff (x' y' : Dual 𝕜 E) : toWeakDual x' = toWeakDual y' ↔ x' = y' := Function.Injective.eq_iff <| LinearEquiv.injective toWeakDual theorem toWeakDual_continuous : Continuous fun x' : Dual 𝕜 E => toWeakDual x' := WeakBilin.continuous_of_continuous_eval _ fun z => (inclusionInDoubleDual 𝕜 E z).continuous /-- For a normed space `E`, according to `toWeakDual_continuous` the "identity mapping" `Dual 𝕜 E → WeakDual 𝕜 E` is continuous. This definition implements it as a continuous linear map. -/ def continuousLinearMapToWeakDual : Dual 𝕜 E →L[𝕜] WeakDual 𝕜 E := { toWeakDual with cont := toWeakDual_continuous } /-- The weak-star topology is coarser than the dual-norm topology. -/ theorem dual_norm_topology_le_weak_dual_topology : (UniformSpace.toTopologicalSpace : TopologicalSpace (Dual 𝕜 E)) ≤ (WeakDual.instTopologicalSpace : TopologicalSpace (WeakDual 𝕜 E)) := by convert (@toWeakDual_continuous _ _ _ _ (by assumption)).le_induced exact induced_id.symm end Dual end NormedSpace namespace WeakDual open NormedSpace /-- For normed spaces `E`, there is a canonical map `WeakDual 𝕜 E → Dual 𝕜 E` (the "identity" mapping). It is a linear equivalence. Here it is implemented as the inverse of the linear equivalence `NormedSpace.Dual.toWeakDual` in the other direction. -/ def toNormedDual : WeakDual 𝕜 E ≃ₗ[𝕜] Dual 𝕜 E := NormedSpace.Dual.toWeakDual.symm theorem toNormedDual_apply (x : WeakDual 𝕜 E) (y : E) : (toNormedDual x) y = x y := rfl @[simp] theorem coe_toNormedDual (x' : WeakDual 𝕜 E) : toNormedDual x' = x' := rfl @[simp] theorem toNormedDual_eq_iff (x' y' : WeakDual 𝕜 E) : toNormedDual x' = toNormedDual y' ↔ x' = y' := Function.Injective.eq_iff <| LinearEquiv.injective toNormedDual theorem isClosed_closedBall (x' : Dual 𝕜 E) (r : ℝ) : IsClosed (toNormedDual ⁻¹' closedBall x' r) := isClosed_induced_iff'.2 (ContinuousLinearMap.is_weak_closed_closedBall x' r) /-! ### Polar sets in the weak dual space -/ variable (𝕜) /-- The polar set `polar 𝕜 s` of `s : Set E` seen as a subset of the dual of `E` with the weak-star topology is `WeakDual.polar 𝕜 s`. -/ def polar (s : Set E) : Set (WeakDual 𝕜 E) := toNormedDual ⁻¹' (NormedSpace.polar 𝕜) s theorem polar_def (s : Set E) : polar 𝕜 s = { f : WeakDual 𝕜 E | ∀ x ∈ s, ‖f x‖ ≤ 1 } := rfl /-- The polar `polar 𝕜 s` of a set `s : E` is a closed subset when the weak star topology is used. -/ theorem isClosed_polar (s : Set E) : IsClosed (polar 𝕜 s) := by simp only [polar_def, setOf_forall] exact isClosed_biInter fun x hx => isClosed_Iic.preimage (WeakBilin.eval_continuous _ _).norm variable {𝕜} /-- While the coercion `↑ : WeakDual 𝕜 E → (E → 𝕜)` is not a closed map, it sends *bounded* closed sets to closed sets. -/ theorem isClosed_image_coe_of_bounded_of_closed {s : Set (WeakDual 𝕜 E)} (hb : IsBounded (Dual.toWeakDual ⁻¹' s)) (hc : IsClosed s) : IsClosed (((↑) : WeakDual 𝕜 E → E → 𝕜) '' s) := ContinuousLinearMap.isClosed_image_coe_of_bounded_of_weak_closed hb (isClosed_induced_iff'.1 hc) theorem isCompact_of_bounded_of_closed [ProperSpace 𝕜] {s : Set (WeakDual 𝕜 E)} (hb : IsBounded (Dual.toWeakDual ⁻¹' s)) (hc : IsClosed s) : IsCompact s := (Embedding.isCompact_iff DFunLike.coe_injective.embedding_induced).mpr <| ContinuousLinearMap.isCompact_image_coe_of_bounded_of_closed_image hb <| isClosed_image_coe_of_bounded_of_closed hb hc variable (𝕜) /-- The image under `↑ : WeakDual 𝕜 E → (E → 𝕜)` of a polar `WeakDual.polar 𝕜 s` of a neighborhood `s` of the origin is a closed set. -/ theorem isClosed_image_polar_of_mem_nhds {s : Set E} (s_nhd : s ∈ 𝓝 (0 : E)) : IsClosed (((↑) : WeakDual 𝕜 E → E → 𝕜) '' polar 𝕜 s) := isClosed_image_coe_of_bounded_of_closed (isBounded_polar_of_mem_nhds_zero 𝕜 s_nhd) (isClosed_polar _ _) /-- The image under `↑ : NormedSpace.Dual 𝕜 E → (E → 𝕜)` of a polar `polar 𝕜 s` of a neighborhood `s` of the origin is a closed set. -/ theorem _root_.NormedSpace.Dual.isClosed_image_polar_of_mem_nhds {s : Set E} (s_nhd : s ∈ 𝓝 (0 : E)) : IsClosed (((↑) : Dual 𝕜 E → E → 𝕜) '' NormedSpace.polar 𝕜 s) := WeakDual.isClosed_image_polar_of_mem_nhds 𝕜 s_nhd /-- The **Banach-Alaoglu theorem**: the polar set of a neighborhood `s` of the origin in a normed space `E` is a compact subset of `WeakDual 𝕜 E`. -/ theorem isCompact_polar [ProperSpace 𝕜] {s : Set E} (s_nhd : s ∈ 𝓝 (0 : E)) : IsCompact (polar 𝕜 s) := isCompact_of_bounded_of_closed (isBounded_polar_of_mem_nhds_zero 𝕜 s_nhd) (isClosed_polar _ _) /-- The **Banach-Alaoglu theorem**: closed balls of the dual of a normed space `E` are compact in the weak-star topology. -/ theorem isCompact_closedBall [ProperSpace 𝕜] (x' : Dual 𝕜 E) (r : ℝ) : IsCompact (toNormedDual ⁻¹' closedBall x' r) := isCompact_of_bounded_of_closed isBounded_closedBall (isClosed_closedBall x' r) end WeakDual
Analysis\Normed\Operator\Banach.lean
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Topology.Baire.Lemmas import Mathlib.Topology.Baire.CompleteMetrizable import Mathlib.Analysis.NormedSpace.OperatorNorm.NormedSpace import Mathlib.Analysis.NormedSpace.AffineIsometry import Mathlib.Analysis.Normed.Group.InfiniteSum /-! # Banach open mapping theorem This file contains the Banach open mapping theorem, i.e., the fact that a bijective bounded linear map between Banach spaces has a bounded inverse. -/ open scoped Classical open Function Metric Set Filter Finset Topology NNReal open LinearMap (range ker) variable {𝕜 𝕜' : Type*} [NontriviallyNormedField 𝕜] [NontriviallyNormedField 𝕜'] {σ : 𝕜 →+* 𝕜'} {σ' : 𝕜' →+* 𝕜} [RingHomInvPair σ σ'] [RingHomInvPair σ' σ] [RingHomIsometric σ] [RingHomIsometric σ'] variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜' F] (f : E →SL[σ] F) namespace ContinuousLinearMap /-- A (possibly nonlinear) right inverse to a continuous linear map, which doesn't have to be linear itself but which satisfies a bound `‖inverse x‖ ≤ C * ‖x‖`. A surjective continuous linear map doesn't always have a continuous linear right inverse, but it always has a nonlinear inverse in this sense, by Banach's open mapping theorem. -/ structure NonlinearRightInverse where toFun : F → E nnnorm : ℝ≥0 bound' : ∀ y, ‖toFun y‖ ≤ nnnorm * ‖y‖ right_inv' : ∀ y, f (toFun y) = y instance : CoeFun (NonlinearRightInverse f) fun _ => F → E := ⟨fun fsymm => fsymm.toFun⟩ @[simp] theorem NonlinearRightInverse.right_inv {f : E →SL[σ] F} (fsymm : NonlinearRightInverse f) (y : F) : f (fsymm y) = y := fsymm.right_inv' y theorem NonlinearRightInverse.bound {f : E →SL[σ] F} (fsymm : NonlinearRightInverse f) (y : F) : ‖fsymm y‖ ≤ fsymm.nnnorm * ‖y‖ := fsymm.bound' y end ContinuousLinearMap /-- Given a continuous linear equivalence, the inverse is in particular an instance of `ContinuousLinearMap.NonlinearRightInverse` (which turns out to be linear). -/ noncomputable def ContinuousLinearEquiv.toNonlinearRightInverse (f : E ≃SL[σ] F) : ContinuousLinearMap.NonlinearRightInverse (f : E →SL[σ] F) where toFun := f.invFun nnnorm := ‖(f.symm : F →SL[σ'] E)‖₊ bound' _ := ContinuousLinearMap.le_opNorm (f.symm : F →SL[σ'] E) _ right_inv' := f.apply_symm_apply noncomputable instance (f : E ≃SL[σ] F) : Inhabited (ContinuousLinearMap.NonlinearRightInverse (f : E →SL[σ] F)) := ⟨f.toNonlinearRightInverse⟩ /-! ### Proof of the Banach open mapping theorem -/ variable [CompleteSpace F] namespace ContinuousLinearMap /-- First step of the proof of the Banach open mapping theorem (using completeness of `F`): by Baire's theorem, there exists a ball in `E` whose image closure has nonempty interior. Rescaling everything, it follows that any `y ∈ F` is arbitrarily well approached by images of elements of norm at most `C * ‖y‖`. For further use, we will only need such an element whose image is within distance `‖y‖/2` of `y`, to apply an iterative process. -/ theorem exists_approx_preimage_norm_le (surj : Surjective f) : ∃ C ≥ 0, ∀ y, ∃ x, dist (f x) y ≤ 1 / 2 * ‖y‖ ∧ ‖x‖ ≤ C * ‖y‖ := by have A : ⋃ n : ℕ, closure (f '' ball 0 n) = Set.univ := by refine Subset.antisymm (subset_univ _) fun y _ => ?_ rcases surj y with ⟨x, hx⟩ rcases exists_nat_gt ‖x‖ with ⟨n, hn⟩ refine mem_iUnion.2 ⟨n, subset_closure ?_⟩ refine (mem_image _ _ _).2 ⟨x, ⟨?_, hx⟩⟩ rwa [mem_ball, dist_eq_norm, sub_zero] have : ∃ (n : ℕ) (x : _), x ∈ interior (closure (f '' ball 0 n)) := nonempty_interior_of_iUnion_of_closed (fun n => isClosed_closure) A simp only [mem_interior_iff_mem_nhds, Metric.mem_nhds_iff] at this rcases this with ⟨n, a, ε, ⟨εpos, H⟩⟩ rcases NormedField.exists_one_lt_norm 𝕜 with ⟨c, hc⟩ refine ⟨(ε / 2)⁻¹ * ‖c‖ * 2 * n, by positivity, fun y => ?_⟩ rcases eq_or_ne y 0 with rfl | hy · use 0 simp · have hc' : 1 < ‖σ c‖ := by simp only [RingHomIsometric.is_iso, hc] rcases rescale_to_shell hc' (half_pos εpos) hy with ⟨d, hd, ydlt, -, dinv⟩ let δ := ‖d‖ * ‖y‖ / 4 have δpos : 0 < δ := div_pos (mul_pos (norm_pos_iff.2 hd) (norm_pos_iff.2 hy)) (by norm_num) have : a + d • y ∈ ball a ε := by simp [dist_eq_norm, lt_of_le_of_lt ydlt.le (half_lt_self εpos)] rcases Metric.mem_closure_iff.1 (H this) _ δpos with ⟨z₁, z₁im, h₁⟩ rcases (mem_image _ _ _).1 z₁im with ⟨x₁, hx₁, xz₁⟩ rw [← xz₁] at h₁ rw [mem_ball, dist_eq_norm, sub_zero] at hx₁ have : a ∈ ball a ε := by simp only [mem_ball, dist_self] exact εpos rcases Metric.mem_closure_iff.1 (H this) _ δpos with ⟨z₂, z₂im, h₂⟩ rcases (mem_image _ _ _).1 z₂im with ⟨x₂, hx₂, xz₂⟩ rw [← xz₂] at h₂ rw [mem_ball, dist_eq_norm, sub_zero] at hx₂ let x := x₁ - x₂ have I : ‖f x - d • y‖ ≤ 2 * δ := calc ‖f x - d • y‖ = ‖f x₁ - (a + d • y) - (f x₂ - a)‖ := by congr 1 simp only [f.map_sub] abel _ ≤ ‖f x₁ - (a + d • y)‖ + ‖f x₂ - a‖ := norm_sub_le _ _ _ ≤ δ + δ := by rw [dist_eq_norm'] at h₁ h₂; gcongr _ = 2 * δ := (two_mul _).symm have J : ‖f (σ' d⁻¹ • x) - y‖ ≤ 1 / 2 * ‖y‖ := calc ‖f (σ' d⁻¹ • x) - y‖ = ‖d⁻¹ • f x - (d⁻¹ * d) • y‖ := by rwa [f.map_smulₛₗ _, inv_mul_cancel, one_smul, map_inv₀, map_inv₀, RingHomCompTriple.comp_apply, RingHom.id_apply] _ = ‖d⁻¹ • (f x - d • y)‖ := by rw [mul_smul, smul_sub] _ = ‖d‖⁻¹ * ‖f x - d • y‖ := by rw [norm_smul, norm_inv] _ ≤ ‖d‖⁻¹ * (2 * δ) := by gcongr _ = ‖d‖⁻¹ * ‖d‖ * ‖y‖ / 2 := by simp only [δ] ring _ = ‖y‖ / 2 := by rw [inv_mul_cancel, one_mul] simp [norm_eq_zero, hd] _ = 1 / 2 * ‖y‖ := by ring rw [← dist_eq_norm] at J have K : ‖σ' d⁻¹ • x‖ ≤ (ε / 2)⁻¹ * ‖c‖ * 2 * ↑n * ‖y‖ := calc ‖σ' d⁻¹ • x‖ = ‖d‖⁻¹ * ‖x₁ - x₂‖ := by rw [norm_smul, RingHomIsometric.is_iso, norm_inv] _ ≤ (ε / 2)⁻¹ * ‖c‖ * ‖y‖ * (n + n) := by gcongr · simpa using dinv · exact le_trans (norm_sub_le _ _) (by gcongr) _ = (ε / 2)⁻¹ * ‖c‖ * 2 * ↑n * ‖y‖ := by ring exact ⟨σ' d⁻¹ • x, J, K⟩ variable [CompleteSpace E] /-- The Banach open mapping theorem: if a bounded linear map between Banach spaces is onto, then any point has a preimage with controlled norm. -/ theorem exists_preimage_norm_le (surj : Surjective f) : ∃ C > 0, ∀ y, ∃ x, f x = y ∧ ‖x‖ ≤ C * ‖y‖ := by obtain ⟨C, C0, hC⟩ := exists_approx_preimage_norm_le f surj /- Second step of the proof: starting from `y`, we want an exact preimage of `y`. Let `g y` be the approximate preimage of `y` given by the first step, and `h y = y - f(g y)` the part that has no preimage yet. We will iterate this process, taking the approximate preimage of `h y`, leaving only `h^2 y` without preimage yet, and so on. Let `u n` be the approximate preimage of `h^n y`. Then `u` is a converging series, and by design the sum of the series is a preimage of `y`. This uses completeness of `E`. -/ choose g hg using hC let h y := y - f (g y) have hle : ∀ y, ‖h y‖ ≤ 1 / 2 * ‖y‖ := by intro y rw [← dist_eq_norm, dist_comm] exact (hg y).1 refine ⟨2 * C + 1, by linarith, fun y => ?_⟩ have hnle : ∀ n : ℕ, ‖h^[n] y‖ ≤ (1 / 2) ^ n * ‖y‖ := by intro n induction' n with n IH · simp only [one_div, Nat.zero_eq, one_mul, iterate_zero_apply, pow_zero, le_rfl] · rw [iterate_succ'] apply le_trans (hle _) _ rw [pow_succ', mul_assoc] gcongr let u n := g (h^[n] y) have ule : ∀ n, ‖u n‖ ≤ (1 / 2) ^ n * (C * ‖y‖) := fun n ↦ by apply le_trans (hg _).2 calc C * ‖h^[n] y‖ ≤ C * ((1 / 2) ^ n * ‖y‖) := mul_le_mul_of_nonneg_left (hnle n) C0 _ = (1 / 2) ^ n * (C * ‖y‖) := by ring have sNu : Summable fun n => ‖u n‖ := by refine .of_nonneg_of_le (fun n => norm_nonneg _) ule ?_ exact Summable.mul_right _ (summable_geometric_of_lt_one (by norm_num) (by norm_num)) have su : Summable u := sNu.of_norm let x := tsum u have x_ineq : ‖x‖ ≤ (2 * C + 1) * ‖y‖ := calc ‖x‖ ≤ ∑' n, ‖u n‖ := norm_tsum_le_tsum_norm sNu _ ≤ ∑' n, (1 / 2) ^ n * (C * ‖y‖) := tsum_le_tsum ule sNu (Summable.mul_right _ summable_geometric_two) _ = (∑' n, (1 / 2) ^ n) * (C * ‖y‖) := tsum_mul_right _ = 2 * C * ‖y‖ := by rw [tsum_geometric_two, mul_assoc] _ ≤ 2 * C * ‖y‖ + ‖y‖ := le_add_of_nonneg_right (norm_nonneg y) _ = (2 * C + 1) * ‖y‖ := by ring have fsumeq : ∀ n : ℕ, f (∑ i ∈ Finset.range n, u i) = y - h^[n] y := by intro n induction' n with n IH · simp [f.map_zero] · rw [sum_range_succ, f.map_add, IH, iterate_succ_apply', sub_add] have : Tendsto (fun n => ∑ i ∈ Finset.range n, u i) atTop (𝓝 x) := su.hasSum.tendsto_sum_nat have L₁ : Tendsto (fun n => f (∑ i ∈ Finset.range n, u i)) atTop (𝓝 (f x)) := (f.continuous.tendsto _).comp this simp only [fsumeq] at L₁ have L₂ : Tendsto (fun n => y - h^[n] y) atTop (𝓝 (y - 0)) := by refine tendsto_const_nhds.sub ?_ rw [tendsto_iff_norm_sub_tendsto_zero] simp only [sub_zero] refine squeeze_zero (fun _ => norm_nonneg _) hnle ?_ rw [← zero_mul ‖y‖] refine (_root_.tendsto_pow_atTop_nhds_zero_of_lt_one ?_ ?_).mul tendsto_const_nhds <;> norm_num have feq : f x = y - 0 := tendsto_nhds_unique L₁ L₂ rw [sub_zero] at feq exact ⟨x, feq, x_ineq⟩ /-- The Banach open mapping theorem: a surjective bounded linear map between Banach spaces is open. -/ protected theorem isOpenMap (surj : Surjective f) : IsOpenMap f := by intro s hs rcases exists_preimage_norm_le f surj with ⟨C, Cpos, hC⟩ refine isOpen_iff.2 fun y yfs => ?_ rcases yfs with ⟨x, xs, fxy⟩ rcases isOpen_iff.1 hs x xs with ⟨ε, εpos, hε⟩ refine ⟨ε / C, div_pos εpos Cpos, fun z hz => ?_⟩ rcases hC (z - y) with ⟨w, wim, wnorm⟩ have : f (x + w) = z := by rw [f.map_add, wim, fxy, add_sub_cancel] rw [← this] have : x + w ∈ ball x ε := calc dist (x + w) x = ‖w‖ := by rw [dist_eq_norm] simp _ ≤ C * ‖z - y‖ := wnorm _ < C * (ε / C) := by apply mul_lt_mul_of_pos_left _ Cpos rwa [mem_ball, dist_eq_norm] at hz _ = ε := mul_div_cancel₀ _ (ne_of_gt Cpos) exact Set.mem_image_of_mem _ (hε this) protected theorem quotientMap (surj : Surjective f) : QuotientMap f := (f.isOpenMap surj).to_quotientMap f.continuous surj theorem _root_.AffineMap.isOpenMap {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] [CompleteSpace F] {P Q : Type*} [MetricSpace P] [NormedAddTorsor E P] [MetricSpace Q] [NormedAddTorsor F Q] (f : P →ᵃ[𝕜] Q) (hf : Continuous f) (surj : Surjective f) : IsOpenMap f := AffineMap.isOpenMap_linear_iff.mp <| ContinuousLinearMap.isOpenMap { f.linear with cont := AffineMap.continuous_linear_iff.mpr hf } (f.linear_surjective_iff.mpr surj) /-! ### Applications of the Banach open mapping theorem -/ theorem interior_preimage (hsurj : Surjective f) (s : Set F) : interior (f ⁻¹' s) = f ⁻¹' interior s := ((f.isOpenMap hsurj).preimage_interior_eq_interior_preimage f.continuous s).symm theorem closure_preimage (hsurj : Surjective f) (s : Set F) : closure (f ⁻¹' s) = f ⁻¹' closure s := ((f.isOpenMap hsurj).preimage_closure_eq_closure_preimage f.continuous s).symm theorem frontier_preimage (hsurj : Surjective f) (s : Set F) : frontier (f ⁻¹' s) = f ⁻¹' frontier s := ((f.isOpenMap hsurj).preimage_frontier_eq_frontier_preimage f.continuous s).symm theorem exists_nonlinearRightInverse_of_surjective (f : E →SL[σ] F) (hsurj : LinearMap.range f = ⊤) : ∃ fsymm : NonlinearRightInverse f, 0 < fsymm.nnnorm := by choose C hC fsymm h using exists_preimage_norm_le _ (LinearMap.range_eq_top.mp hsurj) use { toFun := fsymm nnnorm := ⟨C, hC.lt.le⟩ bound' := fun y => (h y).2 right_inv' := fun y => (h y).1 } exact hC /-- A surjective continuous linear map between Banach spaces admits a (possibly nonlinear) controlled right inverse. In general, it is not possible to ensure that such a right inverse is linear (take for instance the map from `E` to `E/F` where `F` is a closed subspace of `E` without a closed complement. Then it doesn't have a continuous linear right inverse.) -/ noncomputable irreducible_def nonlinearRightInverseOfSurjective (f : E →SL[σ] F) (hsurj : LinearMap.range f = ⊤) : NonlinearRightInverse f := Classical.choose (exists_nonlinearRightInverse_of_surjective f hsurj) theorem nonlinearRightInverseOfSurjective_nnnorm_pos (f : E →SL[σ] F) (hsurj : LinearMap.range f = ⊤) : 0 < (nonlinearRightInverseOfSurjective f hsurj).nnnorm := by rw [nonlinearRightInverseOfSurjective] exact Classical.choose_spec (exists_nonlinearRightInverse_of_surjective f hsurj) end ContinuousLinearMap namespace LinearEquiv variable [CompleteSpace E] /-- If a bounded linear map is a bijection, then its inverse is also a bounded linear map. -/ @[continuity] theorem continuous_symm (e : E ≃ₛₗ[σ] F) (h : Continuous e) : Continuous e.symm := by rw [continuous_def] intro s hs rw [← e.image_eq_preimage] rw [← e.coe_coe] at h ⊢ exact ContinuousLinearMap.isOpenMap (σ := σ) ⟨↑e, h⟩ e.surjective s hs /-- Associating to a linear equivalence between Banach spaces a continuous linear equivalence when the direct map is continuous, thanks to the Banach open mapping theorem that ensures that the inverse map is also continuous. -/ def toContinuousLinearEquivOfContinuous (e : E ≃ₛₗ[σ] F) (h : Continuous e) : E ≃SL[σ] F := { e with continuous_toFun := h continuous_invFun := e.continuous_symm h } @[simp] theorem coeFn_toContinuousLinearEquivOfContinuous (e : E ≃ₛₗ[σ] F) (h : Continuous e) : ⇑(e.toContinuousLinearEquivOfContinuous h) = e := rfl @[simp] theorem coeFn_toContinuousLinearEquivOfContinuous_symm (e : E ≃ₛₗ[σ] F) (h : Continuous e) : ⇑(e.toContinuousLinearEquivOfContinuous h).symm = e.symm := rfl end LinearEquiv namespace ContinuousLinearMap variable [CompleteSpace E] /-- An injective continuous linear map with a closed range defines a continuous linear equivalence between its domain and its range. -/ noncomputable def equivRange (f : E →SL[σ] F) (hinj : Injective f) (hclo : IsClosed (range f)) : E ≃SL[σ] LinearMap.range f := have : CompleteSpace (LinearMap.range f) := hclo.completeSpace_coe LinearEquiv.toContinuousLinearEquivOfContinuous (LinearEquiv.ofInjective f.toLinearMap hinj) <| (f.continuous.codRestrict fun x ↦ LinearMap.mem_range_self f x).congr fun _ ↦ rfl @[simp] theorem coe_linearMap_equivRange (f : E →SL[σ] F) (hinj : Injective f) (hclo : IsClosed (range f)) : f.equivRange hinj hclo = f.rangeRestrict := rfl @[simp] theorem coe_equivRange (f : E →SL[σ] F) (hinj : Injective f) (hclo : IsClosed (range f)) : (f.equivRange hinj hclo : E → LinearMap.range f) = f.rangeRestrict := rfl end ContinuousLinearMap namespace ContinuousLinearEquiv variable [CompleteSpace E] /-- Convert a bijective continuous linear map `f : E →SL[σ] F` from a Banach space to a normed space to a continuous linear equivalence. -/ noncomputable def ofBijective (f : E →SL[σ] F) (hinj : ker f = ⊥) (hsurj : LinearMap.range f = ⊤) : E ≃SL[σ] F := (LinearEquiv.ofBijective ↑f ⟨LinearMap.ker_eq_bot.mp hinj, LinearMap.range_eq_top.mp hsurj⟩).toContinuousLinearEquivOfContinuous -- Porting note: added `by convert` (by convert f.continuous) @[simp] theorem coeFn_ofBijective (f : E →SL[σ] F) (hinj : ker f = ⊥) (hsurj : LinearMap.range f = ⊤) : ⇑(ofBijective f hinj hsurj) = f := rfl theorem coe_ofBijective (f : E →SL[σ] F) (hinj : ker f = ⊥) (hsurj : LinearMap.range f = ⊤) : ↑(ofBijective f hinj hsurj) = f := by ext rfl @[simp] theorem ofBijective_symm_apply_apply (f : E →SL[σ] F) (hinj : ker f = ⊥) (hsurj : LinearMap.range f = ⊤) (x : E) : (ofBijective f hinj hsurj).symm (f x) = x := (ofBijective f hinj hsurj).symm_apply_apply x @[simp] theorem ofBijective_apply_symm_apply (f : E →SL[σ] F) (hinj : ker f = ⊥) (hsurj : LinearMap.range f = ⊤) (y : F) : f ((ofBijective f hinj hsurj).symm y) = y := (ofBijective f hinj hsurj).apply_symm_apply y lemma _root_.ContinuousLinearMap.isUnit_iff_bijective {f : E →L[𝕜] E} : IsUnit f ↔ Bijective f := by constructor · rintro ⟨f, rfl⟩ exact ofUnit f |>.bijective · refine fun h ↦ ⟨toUnit <| .ofBijective f ?_ ?_, rfl⟩ <;> simp only [LinearMap.range_eq_top, LinearMapClass.ker_eq_bot, h.1, h.2] end ContinuousLinearEquiv namespace ContinuousLinearMap variable [CompleteSpace E] /-- Intermediate definition used to show `ContinuousLinearMap.closed_complemented_range_of_isCompl_of_ker_eq_bot`. This is `f.coprod G.subtypeL` as a `ContinuousLinearEquiv`. -/ noncomputable def coprodSubtypeLEquivOfIsCompl {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] [CompleteSpace F] (f : E →L[𝕜] F) {G : Submodule 𝕜 F} (h : IsCompl (LinearMap.range f) G) [CompleteSpace G] (hker : ker f = ⊥) : (E × G) ≃L[𝕜] F := ContinuousLinearEquiv.ofBijective (f.coprod G.subtypeL) (by rw [ker_coprod_of_disjoint_range] · rw [hker, Submodule.ker_subtypeL, Submodule.prod_bot] · rw [Submodule.range_subtypeL] exact h.disjoint) (by simp only [range_coprod, Submodule.range_subtypeL, h.sup_eq_top]) theorem range_eq_map_coprodSubtypeLEquivOfIsCompl {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] [CompleteSpace F] (f : E →L[𝕜] F) {G : Submodule 𝕜 F} (h : IsCompl (LinearMap.range f) G) [CompleteSpace G] (hker : ker f = ⊥) : LinearMap.range f = ((⊤ : Submodule 𝕜 E).prod (⊥ : Submodule 𝕜 G)).map (f.coprodSubtypeLEquivOfIsCompl h hker : E × G →ₗ[𝕜] F) := by rw [coprodSubtypeLEquivOfIsCompl, ContinuousLinearEquiv.coe_ofBijective, coe_coprod, LinearMap.coprod_map_prod, Submodule.map_bot, sup_bot_eq, Submodule.map_top] rfl /- TODO: remove the assumption `f.ker = ⊥` in the next lemma, by using the map induced by `f` on `E / f.ker`, once we have quotient normed spaces. -/ theorem closed_complemented_range_of_isCompl_of_ker_eq_bot {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] [CompleteSpace F] (f : E →L[𝕜] F) (G : Submodule 𝕜 F) (h : IsCompl (LinearMap.range f) G) (hG : IsClosed (G : Set F)) (hker : ker f = ⊥) : IsClosed (LinearMap.range f : Set F) := by haveI : CompleteSpace G := hG.completeSpace_coe let g := coprodSubtypeLEquivOfIsCompl f h hker -- Porting note: was `rw [congr_arg coe ...]` rw [range_eq_map_coprodSubtypeLEquivOfIsCompl f h hker] apply g.toHomeomorph.isClosed_image.2 exact isClosed_univ.prod isClosed_singleton end ContinuousLinearMap section ClosedGraphThm variable [CompleteSpace E] variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] [CompleteSpace F] (g : E →ₗ[𝕜] F) /-- The **closed graph theorem** : a linear map between two Banach spaces whose graph is closed is continuous. -/ theorem LinearMap.continuous_of_isClosed_graph (hg : IsClosed (g.graph : Set <| E × F)) : Continuous g := by letI : CompleteSpace g.graph := completeSpace_coe_iff_isComplete.mpr hg.isComplete let φ₀ : E →ₗ[𝕜] E × F := LinearMap.id.prod g have : Function.LeftInverse Prod.fst φ₀ := fun x => rfl let φ : E ≃ₗ[𝕜] g.graph := (LinearEquiv.ofLeftInverse this).trans (LinearEquiv.ofEq _ _ g.graph_eq_range_prod.symm) let ψ : g.graph ≃L[𝕜] E := φ.symm.toContinuousLinearEquivOfContinuous continuous_subtype_val.fst exact (continuous_subtype_val.comp ψ.symm.continuous).snd /-- A useful form of the **closed graph theorem** : let `f` be a linear map between two Banach spaces. To show that `f` is continuous, it suffices to show that for any convergent sequence `uₙ ⟶ x`, if `f(uₙ) ⟶ y` then `y = f(x)`. -/ theorem LinearMap.continuous_of_seq_closed_graph (hg : ∀ (u : ℕ → E) (x y), Tendsto u atTop (𝓝 x) → Tendsto (g ∘ u) atTop (𝓝 y) → y = g x) : Continuous g := by refine g.continuous_of_isClosed_graph (IsSeqClosed.isClosed ?_) rintro φ ⟨x, y⟩ hφg hφ refine hg (Prod.fst ∘ φ) x y ((continuous_fst.tendsto _).comp hφ) ?_ have : g ∘ Prod.fst ∘ φ = Prod.snd ∘ φ := by ext n exact (hφg n).symm rw [this] exact (continuous_snd.tendsto _).comp hφ variable {g} namespace ContinuousLinearMap /-- Upgrade a `LinearMap` to a `ContinuousLinearMap` using the **closed graph theorem**. -/ def ofIsClosedGraph (hg : IsClosed (g.graph : Set <| E × F)) : E →L[𝕜] F where toLinearMap := g cont := g.continuous_of_isClosed_graph hg @[simp] theorem coeFn_ofIsClosedGraph (hg : IsClosed (g.graph : Set <| E × F)) : ⇑(ContinuousLinearMap.ofIsClosedGraph hg) = g := rfl theorem coe_ofIsClosedGraph (hg : IsClosed (g.graph : Set <| E × F)) : ↑(ContinuousLinearMap.ofIsClosedGraph hg) = g := by ext rfl /-- Upgrade a `LinearMap` to a `ContinuousLinearMap` using a variation on the **closed graph theorem**. -/ def ofSeqClosedGraph (hg : ∀ (u : ℕ → E) (x y), Tendsto u atTop (𝓝 x) → Tendsto (g ∘ u) atTop (𝓝 y) → y = g x) : E →L[𝕜] F where toLinearMap := g cont := g.continuous_of_seq_closed_graph hg @[simp] theorem coeFn_ofSeqClosedGraph (hg : ∀ (u : ℕ → E) (x y), Tendsto u atTop (𝓝 x) → Tendsto (g ∘ u) atTop (𝓝 y) → y = g x) : ⇑(ContinuousLinearMap.ofSeqClosedGraph hg) = g := rfl theorem coe_ofSeqClosedGraph (hg : ∀ (u : ℕ → E) (x y), Tendsto u atTop (𝓝 x) → Tendsto (g ∘ u) atTop (𝓝 y) → y = g x) : ↑(ContinuousLinearMap.ofSeqClosedGraph hg) = g := by ext rfl end ContinuousLinearMap end ClosedGraphThm section BijectivityCriteria namespace ContinuousLinearMap variable [CompleteSpace E] lemma closed_range_of_antilipschitz {f : E →SL[σ] F} {c : ℝ≥0} (hf : AntilipschitzWith c f) : (LinearMap.range f).topologicalClosure = LinearMap.range f := SetLike.ext'_iff.mpr <| (hf.isClosed_range f.uniformContinuous).closure_eq open Function lemma bijective_iff_dense_range_and_antilipschitz (f : E →SL[σ] F) : Bijective f ↔ (LinearMap.range f).topologicalClosure = ⊤ ∧ ∃ c, AntilipschitzWith c f := by refine ⟨fun h ↦ ⟨?eq_top, ?anti⟩, fun ⟨hd, c, hf⟩ ↦ ⟨hf.injective, ?surj⟩⟩ case eq_top => simpa [SetLike.ext'_iff] using h.2.denseRange.closure_eq case anti => refine ⟨_, ContinuousLinearEquiv.ofBijective f ?_ ?_ |>.antilipschitz⟩ <;> simp only [LinearMap.range_eq_top, LinearMapClass.ker_eq_bot, h.1, h.2] case surj => rwa [← LinearMap.range_eq_top, ← closed_range_of_antilipschitz hf] lemma _root_.AntilipschitzWith.completeSpace_range_clm {f : E →SL[σ] F} {c : ℝ≥0} (hf : AntilipschitzWith c f) : CompleteSpace (LinearMap.range f) := IsClosed.completeSpace_coe <| hf.isClosed_range f.uniformContinuous end ContinuousLinearMap end BijectivityCriteria
Analysis\Normed\Operator\BanachSteinhaus.lean
/- Copyright (c) 2021 Jireh Loreaux. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Jireh Loreaux -/ import Mathlib.Analysis.NormedSpace.OperatorNorm.NormedSpace import Mathlib.Analysis.LocallyConvex.Barrelled import Mathlib.Topology.Baire.CompleteMetrizable /-! # The Banach-Steinhaus theorem: Uniform Boundedness Principle Herein we prove the Banach-Steinhaus theorem for normed spaces: any collection of bounded linear maps from a Banach space into a normed space which is pointwise bounded is uniformly bounded. Note that we prove the more general version about barrelled spaces in `Analysis.LocallyConvex.Barrelled`, and the usual version below is indeed deduced from the more general setup. -/ open Set variable {E F 𝕜 𝕜₂ : Type*} [SeminormedAddCommGroup E] [SeminormedAddCommGroup F] [NontriviallyNormedField 𝕜] [NontriviallyNormedField 𝕜₂] [NormedSpace 𝕜 E] [NormedSpace 𝕜₂ F] {σ₁₂ : 𝕜 →+* 𝕜₂} [RingHomIsometric σ₁₂] /-- This is the standard Banach-Steinhaus theorem, or Uniform Boundedness Principle. If a family of continuous linear maps from a Banach space into a normed space is pointwise bounded, then the norms of these linear maps are uniformly bounded. See also `WithSeminorms.banach_steinhaus` for the general statement in barrelled spaces. -/ theorem banach_steinhaus {ι : Type*} [CompleteSpace E] {g : ι → E →SL[σ₁₂] F} (h : ∀ x, ∃ C, ∀ i, ‖g i x‖ ≤ C) : ∃ C', ∀ i, ‖g i‖ ≤ C' := by rw [show (∃ C, ∀ i, ‖g i‖ ≤ C) ↔ _ from (NormedSpace.equicontinuous_TFAE g).out 5 2] refine (norm_withSeminorms 𝕜₂ F).banach_steinhaus (fun _ x ↦ ?_) simpa [bddAbove_def, forall_mem_range] using h x open ENNReal open ENNReal /-- This version of Banach-Steinhaus is stated in terms of suprema of `↑‖·‖₊ : ℝ≥0∞` for convenience. -/ theorem banach_steinhaus_iSup_nnnorm {ι : Type*} [CompleteSpace E] {g : ι → E →SL[σ₁₂] F} (h : ∀ x, (⨆ i, ↑‖g i x‖₊) < ∞) : (⨆ i, ↑‖g i‖₊) < ∞ := by rw [show ((⨆ i, ↑‖g i‖₊) < ∞) ↔ _ from (NormedSpace.equicontinuous_TFAE g).out 8 2] refine (norm_withSeminorms 𝕜₂ F).banach_steinhaus (fun _ x ↦ ?_) simpa [← NNReal.bddAbove_coe, ← Set.range_comp] using ENNReal.iSup_coe_lt_top.1 (h x) open Topology open Filter /-- Given a *sequence* of continuous linear maps which converges pointwise and for which the domain is complete, the Banach-Steinhaus theorem is used to guarantee that the limit map is a *continuous* linear map as well. -/ abbrev continuousLinearMapOfTendsto {α : Type*} [CompleteSpace E] [T2Space F] {l : Filter α} [l.IsCountablyGenerated] [l.NeBot] (g : α → E →SL[σ₁₂] F) {f : E → F} (h : Tendsto (fun n x ↦ g n x) l (𝓝 f)) : E →SL[σ₁₂] F := (norm_withSeminorms 𝕜₂ F).continuousLinearMapOfTendsto g h