source stringlengths 17 118 | lean4 stringlengths 0 335k |
|---|---|
.lake/packages/mathlib/Mathlib/Analysis/Normed/Lp/PiLp.lean | import Mathlib.Analysis.MeanInequalities
import Mathlib.Data.Fintype.Order
import Mathlib.LinearAlgebra.Matrix.Basis
import Mathlib.Analysis.Normed.Lp.ProdLp
/-!
# `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.
If you wish to endow a type synonym of `Π i, α i` with the `L^p` distance, you can use
`pseudoMetricSpaceToPi` and the declarations below that one.
## 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`.
## TODO
TODO: the results about uniformity and bornology in the `Aux` section should be using the tools in
`Mathlib.Topology.MetricSpace.Bilipschitz`, so that they can be inlined in the next section and
the only remaining results are about `Lipschitz` and `Antilipschitz`.
-/
open Module Real Set Filter RCLike Bornology Uniformity Topology NNReal ENNReal WithLp
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 := ofLp
instance (p : ℝ≥0∞) {ι : Type*} (α : ι → Type*) [∀ i, Inhabited (α i)] : Inhabited (PiLp p α) :=
⟨toLp p fun _ => default⟩
@[ext]
protected theorem PiLp.ext {p : ℝ≥0∞} {ι : Type*} {α : ι → Type*} {x y : PiLp p α}
(h : ∀ i, x i = y i) : x = y := ofLp_injective p <| 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 [Semiring 𝕜] [∀ i, SeminormedAddCommGroup (β i)]
variable [∀ i, Module 𝕜 (β i)] (c : 𝕜)
variable (x y : PiLp p β) (i : ι)
@[simp]
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
variable (p) in
/-- The projection on the `i`-th coordinate of `WithLp p (∀ i, α i)`, as a linear map. -/
@[simps!]
def projₗ (i : ι) : PiLp p β →ₗ[𝕜] β i :=
(LinearMap.proj i : (∀ i, β i) →ₗ[𝕜] β i) ∘ₗ (WithLp.linearEquiv p 𝕜 (∀ i, β i)).toLinearMap
end
lemma toLp_apply (x : ∀ i, α i) (i : ι) : toLp p 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.
TODO: the results about uniformity and bornology should be using the tools in
`Mathlib.Topology.MetricSpace.Bilipschitz`, so that they can be inlined in the next section and
the only remaining results are about `Lipschitz` and `Antilipschitz`.
-/
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)
· simp only [dist, top_ne_zero, ↓reduceIte]
exact Real.iSup_nonneg fun i ↦ dist_nonneg
· simp only [dist]
split_ifs with hp
· linarith
· exact Real.iSup_nonneg fun i ↦ dist_nonneg
· exact rpow_nonneg (Fintype.sum_nonneg fun i ↦ by positivity) (1 / p.toReal))
fun f g => by
rcases p.dichotomy with (rfl | h)
· rw [edist_eq_iSup, dist_eq_iSup]
cases isEmpty_or_nonempty ι
· simp
· refine ENNReal.eq_of_forall_le_nnreal_iff fun r ↦ ?_
have : BddAbove <| .range fun i ↦ dist (f i) (g i) := Finite.bddAbove_range _
simp [ciSup_le_iff this]
· have : 0 < p.toReal := by rw [ENNReal.toReal_pos_iff_ne_top]; rintro rfl; norm_num at h
simp only [edist_eq_sum, edist_dist, dist_eq_sum, this]
rw [← ENNReal.ofReal_rpow_of_nonneg (by simp [Finset.sum_nonneg, Real.rpow_nonneg]) (by simp)]
simp [Real.rpow_nonneg, ENNReal.ofReal_sum_of_nonneg, ← ENNReal.ofReal_rpow_of_nonneg]
attribute [local instance] PiLp.pseudoMetricAux
variable {p β} in
private theorem edist_apply_le_edist_aux (x y : PiLp p β) (i : ι) :
edist (x i) (y i) ≤ edist x y := by
rcases p.dichotomy with (rfl | h)
· simpa only [edist_eq_iSup] using le_iSup (fun i => edist (x i) (y i)) 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)]
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)
private lemma lipschitzWith_ofLp_aux : LipschitzWith 1 (@ofLp p (∀ i, β i)) :=
.of_edist_le fun x y => by
simp_rw [edist_pi_def, Finset.sup_le_iff, Finset.mem_univ, forall_true_left]
exact edist_apply_le_edist_aux _ _
private lemma antilipschitzWith_ofLp_aux :
AntilipschitzWith ((Fintype.card ι : ℝ≥0) ^ (1 / p).toReal) (@ofLp p (∀ i, β i)) := by
intro x y
rcases p.dichotomy with (rfl | h)
· simp only [edist_eq_iSup, ENNReal.div_top, ENNReal.toReal_zero, 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, ENNReal.toReal_one]
calc
(∑ i, edist (x i) (y i) ^ p.toReal) ^ (1 / p.toReal) ≤
(∑ _i, edist (ofLp x) (ofLp 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 (ofLp x) (ofLp 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]
private lemma isUniformInducing_ofLp_aux : IsUniformInducing (@ofLp p (∀ i, β i)) :=
(antilipschitzWith_ofLp_aux p β).isUniformInducing
(lipschitzWith_ofLp_aux p β).uniformContinuous
private lemma uniformity_aux : 𝓤 (PiLp p β) = 𝓤[UniformSpace.comap ofLp inferInstance] := by
rw [← (isUniformInducing_ofLp_aux p β).comap_uniformity]
rfl
instance bornology (p : ℝ≥0∞) (β : ι → Type*) [∀ i, Bornology (β i)] :
Bornology (PiLp p β) := Bornology.induced ofLp
private lemma cobounded_aux : @cobounded _ PseudoMetricSpace.toBornology = cobounded (PiLp p α) :=
le_antisymm (antilipschitzWith_ofLp_aux p α).tendsto_cobounded.le_comap
(lipschitzWith_ofLp_aux p α).comap_cobounded_le
end Aux
/-! ### Instances on finite `L^p` products -/
instance topologicalSpace [∀ i, TopologicalSpace (β i)] : TopologicalSpace (PiLp p β) :=
Pi.topologicalSpace.induced ofLp
@[fun_prop, continuity]
theorem continuous_ofLp [∀ i, TopologicalSpace (β i)] : Continuous (@ofLp p (∀ i, β i)) :=
continuous_induced_dom
@[fun_prop, continuity]
protected lemma continuous_apply [∀ i, TopologicalSpace (β i)] (i : ι) :
Continuous (fun f : PiLp p β ↦ f i) := (continuous_apply i).comp (continuous_ofLp p β)
@[fun_prop, continuity]
theorem continuous_toLp [∀ i, TopologicalSpace (β i)] : Continuous (@toLp p (∀ i, β i)) :=
continuous_induced_rng.2 continuous_id
/-- `WithLp.equiv` as a homeomorphism. -/
def homeomorph [∀ i, TopologicalSpace (β i)] : PiLp p β ≃ₜ (Π i, β i) where
toEquiv := WithLp.equiv p (Π i, β i)
continuous_toFun := continuous_ofLp p β
continuous_invFun := continuous_toLp p β
@[simp]
lemma toEquiv_homeomorph [∀ i, TopologicalSpace (β i)] :
(homeomorph p β).toEquiv = WithLp.equiv p (Π i, β i) := rfl
lemma isOpenMap_apply [∀ i, TopologicalSpace (β i)] (i : ι) :
IsOpenMap (fun f : PiLp p β ↦ f i) := (isOpenMap_eval i).comp (homeomorph p β).isOpenMap
instance instProdT0Space [∀ i, TopologicalSpace (β i)] [∀ i, T0Space (β i)] :
T0Space (PiLp p β) :=
(homeomorph p β).symm.t0Space
instance secondCountableTopology [Countable ι] [∀ i, TopologicalSpace (β i)]
[∀ i, SecondCountableTopology (β i)] : SecondCountableTopology (PiLp p β) :=
(homeomorph p β).secondCountableTopology
instance uniformSpace [∀ i, UniformSpace (β i)] : UniformSpace (PiLp p β) :=
(Pi.uniformSpace β).comap ofLp
lemma uniformContinuous_ofLp [∀ i, UniformSpace (β i)] :
UniformContinuous (@ofLp p (∀ i, β i)) :=
uniformContinuous_comap
lemma uniformContinuous_toLp [∀ i, UniformSpace (β i)] :
UniformContinuous (@toLp p (∀ i, β i)) :=
uniformContinuous_comap' uniformContinuous_id
/-- `WithLp.equiv` as a uniform isomorphism. -/
def uniformEquiv [∀ i, UniformSpace (β i)] : PiLp p β ≃ᵤ (Π i, β i) where
toEquiv := WithLp.equiv p (Π i, β i)
uniformContinuous_toFun := uniformContinuous_ofLp p β
uniformContinuous_invFun := uniformContinuous_toLp p β
@[simp]
lemma toHomeomorph_uniformEquiv [∀ i, UniformSpace (β i)] :
(uniformEquiv p β).toHomeomorph = homeomorph p β := rfl
@[simp]
lemma toEquiv_uniformEquiv [∀ i, UniformSpace (β i)] :
(uniformEquiv p β).toEquiv = WithLp.equiv p (Π i, β i) := rfl
instance completeSpace [∀ i, UniformSpace (β i)] [∀ i, CompleteSpace (β i)] :
CompleteSpace (PiLp p β) :=
(uniformEquiv p β).completeSpace_iff.2 inferInstance
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 (uniformity_aux 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 α)
/-- 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 (uniformity_aux p β).symm).replaceBornology fun s =>
Filter.ext_iff.1 (cobounded_aux 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) :=
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) :=
NNReal.eq <| by
push_cast
exact dist_eq_iSup _ _
section
variable {β p}
theorem edist_apply_le [∀ i, PseudoEMetricSpace (β i)] (x y : PiLp p β) (i : ι) :
edist (x i) (y i) ≤ edist x y :=
edist_apply_le_edist_aux x y i
theorem nndist_apply_le [∀ i, PseudoMetricSpace (β i)] (x y : PiLp p β) (i : ι) :
nndist (x i) (y i) ≤ nndist x y := by
simpa [← coe_nnreal_ennreal_nndist] using edist_apply_le x y i
theorem dist_apply_le [∀ i, PseudoMetricSpace (β i)] (x y : PiLp p β) (i : ι) :
dist (x i) (y i) ≤ dist x y :=
nndist_apply_le x y i
end
lemma lipschitzWith_ofLp [∀ i, PseudoEMetricSpace (β i)] :
LipschitzWith 1 (@ofLp p (∀ i, β i)) :=
lipschitzWith_ofLp_aux p β
lemma antilipschitzWith_toLp [∀ i, PseudoEMetricSpace (β i)] :
AntilipschitzWith 1 (@toLp p (∀ i, β i)) :=
(lipschitzWith_ofLp p β).to_rightInverse (ofLp_toLp p)
theorem antilipschitzWith_ofLp [∀ i, PseudoEMetricSpace (β i)] :
AntilipschitzWith ((Fintype.card ι : ℝ≥0) ^ (1 / p).toReal) (@ofLp p (∀ i, β i)) :=
antilipschitzWith_ofLp_aux p β
lemma lipschitzWith_toLp [∀ i, PseudoEMetricSpace (β i)] :
LipschitzWith ((Fintype.card ι : ℝ≥0) ^ (1 / p).toReal) (@toLp p (∀ i, β i)) :=
(antilipschitzWith_ofLp p β).to_rightInverse (ofLp_toLp p)
lemma isometry_ofLp_infty [∀ i, PseudoEMetricSpace (β i)] :
Isometry (@ofLp ∞ (∀ i, β i)) :=
fun x y =>
le_antisymm (by simpa only [ENNReal.coe_one, one_mul] using lipschitzWith_ofLp ∞ β x y)
(by simpa only [ENNReal.div_top, ENNReal.toReal_zero, NNReal.rpow_zero, ENNReal.coe_one,
one_mul] using antilipschitzWith_ofLp ∞ β 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 β) where
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.toReal_top] 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]
lemma isUniformInducing_toLp [∀ i, PseudoEMetricSpace (β i)] :
IsUniformInducing (@toLp p (Π i, β i)) :=
(antilipschitzWith_toLp p β).isUniformInducing
(lipschitzWith_toLp p β).uniformContinuous
section
variable {β p}
theorem enorm_apply_le [∀ i, SeminormedAddCommGroup (β i)] (x : PiLp p β) (i : ι) :
‖x i‖ₑ ≤ ‖x‖ₑ := by
simpa using edist_apply_le x 0 i
theorem nnnorm_apply_le [∀ i, SeminormedAddCommGroup (β i)] (x : PiLp p β) (i : ι) :
‖x i‖₊ ≤ ‖x‖₊ := by
simpa using nndist_apply_le x 0 i
theorem norm_apply_le [∀ i, SeminormedAddCommGroup (β i)] (x : PiLp p β) (i : ι) :
‖x i‖ ≤ ‖x‖ := by
simpa using dist_apply_le x 0 i
end
/-- 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] lemma nnnorm_ofLp (f : PiLp ∞ β) : ‖ofLp f‖₊ = ‖f‖₊ := by
rw [nnnorm_eq_ciSup, Pi.nnnorm_def, Finset.sup_univ_eq_ciSup]
@[simp] lemma nnnorm_toLp (f : ∀ i, β i) : ‖toLp ∞ f‖₊ = ‖f‖₊ := (nnnorm_ofLp _).symm
@[simp] lemma norm_ofLp (f : PiLp ∞ β) : ‖ofLp f‖ = ‖f‖ := congr_arg NNReal.toReal <| nnnorm_ofLp f
@[simp] lemma norm_toLp (f : ∀ i, β i) : ‖toLp ∞ f‖ = ‖f‖ := (norm_ofLp _).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_natCast,
norm_eq_sum this]
section L1
variable {β} [∀ i, SeminormedAddCommGroup (β i)]
theorem norm_eq_of_L1 (x : PiLp 1 β) : ‖x‖ = ∑ i : ι, ‖x i‖ := by
simp [norm_eq_sum]
theorem nnnorm_eq_of_L1 (x : PiLp 1 β) : ‖x‖₊ = ∑ i : ι, ‖x i‖₊ :=
NNReal.eq <| by push_cast; exact norm_eq_of_L1 x
theorem dist_eq_of_L1 (x y : PiLp 1 β) : dist x y = ∑ i, dist (x i) (y i) := by
simp_rw [dist_eq_norm, norm_eq_of_L1, sub_apply]
theorem nndist_eq_of_L1 (x y : PiLp 1 β) : nndist x y = ∑ i, nndist (x i) (y i) :=
NNReal.eq <| by push_cast; exact dist_eq_of_L1 _ _
theorem edist_eq_of_L1 (x y : PiLp 1 β) : edist x y = ∑ i, edist (x i) (y i) := by
simp [PiLp.edist_eq_sum]
end L1
section L2
variable {β} [∀ i, SeminormedAddCommGroup (β i)]
theorem norm_eq_of_L2 (x : PiLp 2 β) :
‖x‖ = √(∑ i : ι, ‖x i‖ ^ 2) := by
rw [norm_eq_of_nat 2 (by norm_cast) _]
rw [Real.sqrt_eq_rpow]
norm_cast
theorem nnnorm_eq_of_L2 (x : PiLp 2 β) :
‖x‖₊ = NNReal.sqrt (∑ i : ι, ‖x i‖₊ ^ 2) :=
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 (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 dist_sq_eq_of_L2 (x y : PiLp 2 β) :
dist x y ^ 2 = ∑ i, dist (x i) (y i) ^ 2 := by
simp_rw [dist_eq_norm, norm_sq_eq_of_L2, sub_apply]
theorem nndist_eq_of_L2 (x y : PiLp 2 β) :
nndist x y = NNReal.sqrt (∑ i, nndist (x i) (y i) ^ 2) :=
NNReal.eq <| by
push_cast
exact dist_eq_of_L2 _ _
theorem edist_eq_of_L2 (x y : PiLp 2 β) :
edist x y = (∑ i, edist (x i) (y i) ^ 2) ^ (1 / 2 : ℝ) := by simp [PiLp.edist_eq_sum]
end L2
instance instIsBoundedSMul [SeminormedRing 𝕜] [∀ i, SeminormedAddCommGroup (β i)]
[∀ i, Module 𝕜 (β i)] [∀ i, IsBoundedSMul 𝕜 (β i)] :
IsBoundedSMul 𝕜 (PiLp p β) :=
.of_nnnorm_smul_le fun c f => by
rcases p.dichotomy with (rfl | hp)
· rw [← nnnorm_ofLp, ← nnnorm_ofLp, ofLp_smul]
exact nnnorm_smul_le c (ofLp 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]
gcongr
apply nnnorm_smul_le
instance instNormSMulClass [SeminormedRing 𝕜] [∀ i, SeminormedAddCommGroup (β i)]
[∀ i, Module 𝕜 (β i)] [∀ i, NormSMulClass 𝕜 (β i)] :
NormSMulClass 𝕜 (PiLp p β) :=
.of_nnnorm_smul fun c f => by
rcases p.dichotomy with (rfl | hp)
· rw [← nnnorm_ofLp, ← nnnorm_ofLp, WithLp.ofLp_smul, nnnorm_smul]
· 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_eq_iff hp0.ne',
NNReal.mul_rpow, ← NNReal.rpow_mul, inv_mul_cancel₀ hp0.ne', NNReal.rpow_one,
Finset.mul_sum]
simp_rw [← NNReal.mul_rpow, smul_apply, nnnorm_smul]
/-- 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) where
__ := WithLp.linearEquiv ∞ 𝕜 _
norm_map' := norm_ofLp
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 := (WithLp.linearEquiv p 𝕜 (ι → E)).trans
((LinearEquiv.piCongrLeft' 𝕜 (fun _ : ι => E) e).trans (WithLp.linearEquiv p 𝕜 (ι' → E)).symm)
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 := by
ext
simp [LinearIsometryEquiv.piLpCongrLeft, LinearIsometryEquiv.symm]
@[simp high]
theorem _root_.LinearIsometryEquiv.piLpCongrLeft_single [DecidableEq ι] [DecidableEq ι']
(e : ι ≃ ι') (i : ι) (v : E) :
LinearIsometryEquiv.piLpCongrLeft p 𝕜 E e (toLp p <| Pi.single i v) =
toLp p (Pi.single (e i) v) := by
ext x
simp [LinearIsometryEquiv.piLpCongrLeft_apply, 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, WithLp.linearEquiv_symm_apply, WithLp.linearEquiv_apply]
obtain rfl | hp := p.dichotomy
· simp_rw [PiLp.norm_toLp, 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, LinearEquiv.piCongrRight_apply,
LinearIsometryEquiv.coe_toLinearEquiv, LinearIsometryEquiv.norm_map, one_div]
@[simp]
theorem _root_.LinearIsometryEquiv.piLpCongrRight_apply (e : ∀ i, α i ≃ₗᵢ[𝕜] β i) (x : PiLp p α) :
LinearIsometryEquiv.piLpCongrRight p e x = toLp p 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 (toLp p <| Pi.single i v) =
toLp p (Pi.single i (e _ v)) :=
PiLp.ext <| 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 _ => (WithLp.linearEquiv _ _ _).symm)
≪≫ₗ (WithLp.linearEquiv _ _ _).symm
norm_map' := (WithLp.linearEquiv p 𝕜 _).symm.surjective.forall.2 fun x => by
simp_rw [← coe_nnnorm, NNReal.coe_inj]
dsimp only [WithLp.linearEquiv_symm_apply]
obtain rfl | hp := eq_or_ne p ⊤
· simp_rw [← PiLp.nnnorm_ofLp, Pi.nnnorm_def, ← PiLp.nnnorm_ofLp, 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]
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 =
toLp p (fun i => (toLp p) <| Sigma.curry (ofLp f) i) :=
rfl
@[simp] theorem _root_.LinearIsometryEquiv.piLpCurry_symm_apply
(f : PiLp p (fun i => PiLp p (α i))) :
(_root_.LinearIsometryEquiv.piLpCurry 𝕜 p α).symm f =
toLp p (Sigma.uncurry fun i j => f i j) :=
rfl
end piLpCurry
section sumPiLpEquivProdLpPiLp
variable {ι κ : Type*} (p : ℝ≥0∞) (α : ι ⊕ κ → Type*) [Fintype ι] [Fintype κ] [Fact (1 ≤ p)]
variable [∀ i, SeminormedAddCommGroup (α i)] [∀ i, Module 𝕜 (α i)]
/-- `LinearEquiv.sumPiEquivProdPi` for `PiLp`, as an isometry. -/
@[simps! +simpRhs]
def sumPiLpEquivProdLpPiLp :
WithLp p (Π i, α i) ≃ₗᵢ[𝕜]
WithLp p (WithLp p (Π i, α (.inl i)) × WithLp p (Π i, α (.inr i))) where
toLinearEquiv :=
WithLp.linearEquiv p _ _
≪≫ₗ LinearEquiv.sumPiEquivProdPi _ _ _ α
≪≫ₗ LinearEquiv.prodCongr (WithLp.linearEquiv p _ _).symm
(WithLp.linearEquiv _ _ _).symm
≪≫ₗ (WithLp.linearEquiv p _ _).symm
norm_map' := (WithLp.linearEquiv p 𝕜 _).symm.surjective.forall.2 fun x => by
obtain rfl | hp := p.dichotomy
· simp [← Finset.univ_disjSum_univ, Finset.sup_disjSum, Pi.norm_def]
· have : 0 < p.toReal := by positivity
have hpt : p ≠ ⊤ := (toReal_pos_iff_ne_top p).mp this
simp_rw [← coe_nnnorm]; congr 1 -- convert to nnnorm to avoid needing positivity arguments
simp [nnnorm_eq_sum hpt, WithLp.prod_nnnorm_eq_add hpt, NNReal.rpow_inv_rpow this.ne']
end sumPiLpEquivProdLpPiLp
section Single
variable (p)
variable [DecidableEq ι]
@[simp]
theorem nnnorm_toLp_single (i : ι) (b : β i) :
‖toLp p (Pi.single i b)‖₊ = ‖b‖₊ := by
haveI : Nonempty ι := ⟨i⟩
induction p generalizing hp with
| top =>
simp_rw [nnnorm_eq_ciSup]
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,
toLp_apply, Pi.single_eq_same, ← NNReal.rpow_mul, one_div,
mul_inv_cancel₀ hp0, NNReal.rpow_one]
intro j hij
rw [toLp_apply, Pi.single_eq_of_ne hij, nnnorm_zero, NNReal.zero_rpow hp0]
@[simp]
lemma norm_toLp_single (i : ι) (b : β i) : ‖toLp p (Pi.single i b)‖ = ‖b‖ :=
congr_arg ((↑) : ℝ≥0 → ℝ) <| nnnorm_toLp_single p β i b
@[simp]
lemma nndist_toLp_single_same (i : ι) (b₁ b₂ : β i) :
nndist (toLp p (Pi.single i b₁)) (toLp p (Pi.single i b₂)) = nndist b₁ b₂ := by
rw [nndist_eq_nnnorm, nndist_eq_nnnorm, ← toLp_sub, ← Pi.single_sub, nnnorm_toLp_single]
@[simp]
lemma dist_toLp_single_same (i : ι) (b₁ b₂ : β i) :
dist (toLp p (Pi.single i b₁)) (toLp p (Pi.single i b₂)) = dist b₁ b₂ :=
congr_arg ((↑) : ℝ≥0 → ℝ) <| nndist_toLp_single_same p β i b₁ b₂
@[simp]
lemma edist_toLp_single_same (i : ι) (b₁ b₂ : β i) :
edist (toLp p (Pi.single i b₁)) (toLp p (Pi.single i b₂)) = edist b₁ b₂ := by
simp only [edist_nndist, nndist_toLp_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 ι`. -/
lemma nnnorm_toLp_const {β} [SeminormedAddCommGroup β] (hp : p ≠ ∞) (b : β) :
‖toLp p (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, 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.toReal_one]
/-- 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_toLp_const` for a version which exchanges the hypothesis `Nonempty ι`.
for `p ≠ ∞`. -/
lemma nnnorm_toLp_const' {β} [SeminormedAddCommGroup β] [Nonempty ι] (b : β) :
‖toLp p (Function.const ι b)‖₊ =
(Fintype.card ι : ℝ≥0) ^ (1 / p).toReal * ‖b‖₊ := by
rcases em <| p = ∞ with (rfl | hp)
· simp only [ENNReal.div_top, ENNReal.toReal_zero, NNReal.rpow_zero,
one_mul, nnnorm_eq_ciSup, Function.const_apply, ciSup_const]
· exact nnnorm_toLp_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_toLp_const'` for a version which exchanges the hypothesis `p ≠ ∞` for
`Nonempty ι`. -/
lemma norm_toLp_const {β} [SeminormedAddCommGroup β] (hp : p ≠ ∞) (b : β) :
‖toLp p (Function.const ι b)‖ =
(Fintype.card ι : ℝ≥0) ^ (1 / p).toReal * ‖b‖ :=
(congr_arg ((↑) : ℝ≥0 → ℝ) <| nnnorm_toLp_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 ≠ ∞`. -/
lemma norm_toLp_const' {β} [SeminormedAddCommGroup β] [Nonempty ι] (b : β) :
‖toLp p (Function.const ι b)‖ =
(Fintype.card ι : ℝ≥0) ^ (1 / p).toReal * ‖b‖ :=
(congr_arg ((↑) : ℝ≥0 → ℝ) <| nnnorm_toLp_const' b).trans <| by simp
lemma nnnorm_toLp_one {β} [SeminormedAddCommGroup β] (hp : p ≠ ∞) [One β] :
‖toLp p (1 : ι → β)‖₊ = (Fintype.card ι : ℝ≥0) ^ (1 / p).toReal * ‖(1 : β)‖₊ :=
(nnnorm_toLp_const hp (1 : β)).trans rfl
lemma norm_toLp_one {β} [SeminormedAddCommGroup β] (hp : p ≠ ∞) [One β] :
‖toLp p (1 : ι → β)‖ = (Fintype.card ι : ℝ≥0) ^ (1 / p).toReal * ‖(1 : β)‖ :=
(norm_toLp_const hp (1 : β)).trans rfl
variable (𝕜 p)
/-- `WithLp.linearEquiv` as a continuous linear equivalence. -/
@[simps! -fullyApplied apply symm_apply]
def continuousLinearEquiv : PiLp p β ≃L[𝕜] ∀ i, β i where
toLinearEquiv := WithLp.linearEquiv _ _ _
continuous_toFun := continuous_ofLp _ _
continuous_invFun := continuous_toLp p _
variable {𝕜} in
/-- The projection on the `i`-th coordinate of `PiLp p β`, as a continuous linear map. -/
@[simps!]
def proj (i : ι) : PiLp p β →L[𝕜] β i where
__ := projₗ p β i
cont := PiLp.continuous_apply ..
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 = toLp p (Pi.single i 1) := by
simp_rw [basisFun, Basis.coe_ofEquivFun, WithLp.linearEquiv_symm_apply]
@[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 (toLp p (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_def, Basis.map_apply,
LinearEquiv.symm_apply_apply] at this
exact this
section toPi
/-!
### `L^p` distance on a product space
In this section we define a pseudometric space structure on `Π i, α i`, as well as a seminormed
group structure. These are meant to be used to put the desired instances on type synonyms
of `Π i, α i`. See for instance `Matrix.frobeniusSeminormedAddCommGroup`.
-/
variable [Fact (1 ≤ p)] [Fintype ι]
/-- This definition allows to endow `Π i, α i` with the Lp distance with the uniformity and
bornology being defeq to the product ones. It is useful to endow a type synonym of `Π i, α i` with
the Lp distance. -/
abbrev pseudoMetricSpaceToPi [∀ i, PseudoMetricSpace (α i)] :
PseudoMetricSpace (Π i, α i) :=
(isUniformInducing_toLp p α).comapPseudoMetricSpace.replaceBornology
fun s => Filter.ext_iff.1
(le_antisymm (antilipschitzWith_toLp p α).tendsto_cobounded.le_comap
(lipschitzWith_toLp p α).comap_cobounded_le) sᶜ
lemma dist_pseudoMetricSpaceToPi [∀ i, PseudoMetricSpace (α i)] (x y : Π i, α i) :
@dist _ (pseudoMetricSpaceToPi p α).toDist x y = dist (toLp p x) (toLp p y) := rfl
/-- This definition allows to endow `Π i, α i` with the Lp norm with the uniformity and bornology
being defeq to the product ones. It is useful to endow a type synonym of `Π i, α i` with the
Lp norm. -/
abbrev seminormedAddCommGroupToPi [∀ i, SeminormedAddCommGroup (α i)] :
SeminormedAddCommGroup (Π i, α i) where
norm x := ‖toLp p x‖
toPseudoMetricSpace := pseudoMetricSpaceToPi p α
dist_eq x y := by
rw [dist_pseudoMetricSpaceToPi, SeminormedAddCommGroup.dist_eq, toLp_sub]
lemma norm_seminormedAddCommGroupToPi [∀ i, SeminormedAddCommGroup (α i)] (x : Π i, α i) :
@Norm.norm _ (seminormedAddCommGroupToPi p α).toNorm x = ‖toLp p x‖ := rfl
lemma nnnorm_seminormedAddCommGroupToPi [∀ i, SeminormedAddCommGroup (α i)] (x : Π i, α i) :
@NNNorm.nnnorm _ (seminormedAddCommGroupToPi p α).toSeminormedAddGroup.toNNNorm x =
‖toLp p x‖₊ := rfl
instance isBoundedSMulSeminormedAddCommGroupToPi
[∀ i, SeminormedAddCommGroup (α i)] {R : Type*} [SeminormedRing R]
[∀ i, Module R (α i)] [∀ i, IsBoundedSMul R (α i)] :
letI := pseudoMetricSpaceToPi p α
IsBoundedSMul R (Π i, α i) := by
letI := pseudoMetricSpaceToPi p α
refine ⟨fun x y z ↦ ?_, fun x y z ↦ ?_⟩
· simpa [dist_pseudoMetricSpaceToPi] using dist_smul_pair x (toLp p y) (toLp p z)
· simpa [dist_pseudoMetricSpaceToPi] using dist_pair_smul x y (toLp p z)
instance normSMulClassSeminormedAddCommGroupToPi
[∀ i, SeminormedAddCommGroup (α i)] {R : Type*} [SeminormedRing R]
[∀ i, Module R (α i)] [∀ i, NormSMulClass R (α i)] :
letI := seminormedAddCommGroupToPi p α
NormSMulClass R (Π i, α i) := by
letI := seminormedAddCommGroupToPi p α
refine ⟨fun x y ↦ ?_⟩
simp [norm_seminormedAddCommGroupToPi, norm_smul]
instance normedSpaceSeminormedAddCommGroupToPi
[∀ i, SeminormedAddCommGroup (α i)] {R : Type*} [NormedField R]
[∀ i, NormedSpace R (α i)] :
letI := seminormedAddCommGroupToPi p α
NormedSpace R (Π i, α i) := by
letI := seminormedAddCommGroupToPi p α
refine ⟨fun x y ↦ ?_⟩
simp [norm_seminormedAddCommGroupToPi, norm_smul]
/-- This definition allows to endow `Π i, α i` with the Lp norm with the uniformity and bornology
being defeq to the product ones. It is useful to endow a type synonym of `Π i, α i` with the
Lp norm. -/
abbrev normedAddCommGroupToPi [∀ i, NormedAddCommGroup (α i)] :
NormedAddCommGroup (Π i, α i) where
norm x := ‖toLp p x‖
toPseudoMetricSpace := pseudoMetricSpaceToPi p α
dist_eq x y := by
rw [dist_pseudoMetricSpaceToPi, SeminormedAddCommGroup.dist_eq, toLp_sub]
eq_of_dist_eq_zero {x y} h := by
rw [dist_pseudoMetricSpaceToPi] at h
apply eq_of_dist_eq_zero at h
exact WithLp.toLp_injective p h
end toPi
end PiLp |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Lp/MeasurableSpace.lean | import Mathlib.Analysis.Normed.Lp.PiLp
import Mathlib.MeasureTheory.Constructions.BorelSpace.Basic
/-!
# Measurable space structure on `WithLp`
If `X` is a measurable space, we set the measurable space structure on `WithLp p X` to be the
same as the one on `X`.
-/
open scoped ENNReal
variable (p : ℝ≥0∞) (X : Type*) [MeasurableSpace X]
namespace WithLp
instance measurableSpace : MeasurableSpace (WithLp p X) :=
MeasurableSpace.comap ofLp inferInstance
@[fun_prop, measurability]
lemma measurable_ofLp : Measurable (@ofLp p X) := comap_measurable _
@[fun_prop, measurability]
lemma measurable_toLp : Measurable (@toLp p X) := fun s hs ↦ by
obtain ⟨t, ht, rfl⟩ := hs
simpa [Set.preimage_preimage]
variable (Y : Type*) [MeasurableSpace Y] [TopologicalSpace X] [TopologicalSpace Y]
[BorelSpace X] [BorelSpace Y] [SecondCountableTopologyEither X Y]
instance borelSpace : BorelSpace (WithLp p (X × Y)) where
measurable_eq := by
rw [instProdTopologicalSpace, borel_comap, measurableSpace,
BorelSpace.measurable_eq (α := X × Y)]
end WithLp
namespace PiLp
variable {ι : Type*} {X : ι → Type*} [Countable ι] [∀ i, MeasurableSpace (X i)]
[∀ i, TopologicalSpace (X i)] [∀ i, BorelSpace (X i)] [∀ i, SecondCountableTopology (X i)]
instance borelSpace : BorelSpace (PiLp p X) where
measurable_eq := by
rw [topologicalSpace, borel_comap, WithLp.measurableSpace,
BorelSpace.measurable_eq (α := Π i, X i)]
end PiLp
namespace MeasurableEquiv
/-- The map from `X` to `WithLp p X` as a measurable equivalence. -/
protected def toLp : X ≃ᵐ (WithLp p X) where
toEquiv := (WithLp.equiv p X).symm
measurable_toFun := WithLp.measurable_toLp p X
measurable_invFun := WithLp.measurable_ofLp p X
lemma coe_toLp : ⇑(MeasurableEquiv.toLp p X) = WithLp.toLp p := rfl
lemma coe_toLp_symm : ⇑(MeasurableEquiv.toLp p X).symm = WithLp.ofLp := rfl
@[simp]
lemma toLp_apply (x : X) : MeasurableEquiv.toLp p X x = WithLp.toLp p x := rfl
@[simp]
lemma toLp_symm_apply (x : WithLp p X) :
(MeasurableEquiv.toLp p X).symm x = WithLp.ofLp x := rfl
end MeasurableEquiv |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Lp/LpEquiv.lean | import Mathlib.Analysis.Normed.Lp.PiLp
import Mathlib.Analysis.Normed.Lp.lpSpace
import Mathlib.Topology.ContinuousMap.Bounded.Normed
/-!
# 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 WithLp
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 := toLp p ⇑f
invFun f := ⟨ofLp f, Memℓp.all f⟩
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)
/-- 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⟩
map_add' _f _g := rfl
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)
/-- 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 _ _ ↦ rfl
norm_map' := fun f ↦ by simp only [norm_eq_iSup_norm, lp.norm_eq_ciSup]; rfl }
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 }
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 }
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 |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Lp/lpSpace.lean | import Mathlib.Analysis.MeanInequalities
import Mathlib.Analysis.MeanInequalitiesPow
import Mathlib.Analysis.SpecialFunctions.Pow.Continuity
import Mathlib.Data.Set.Image
import Mathlib.Topology.Algebra.ContinuousMonoidHom
/-!
# ℓ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*} {α : 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 simp) 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 simp) 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 hf'.tendsto_cofinite_zero.eventually_lt_const (by simp)
exact H.subset fun i hi => Real.one_le_rpow hi hq.le
· change ∀ 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 IsBoundedSMul
variable [NormedRing 𝕜] [∀ i, Module 𝕜 (E i)] [∀ i, IsBoundedSMul 𝕜 (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 :=
hf.const_smul c
end IsBoundedSMul
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
The `p=∞` case has notation `ℓ^∞(ι, E)` resp. `ℓ^∞(ι)` (for `E = ℝ`) in the `lp` namespace. -/
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
instance : CoeOut (lp E p) (∀ i, E i) :=
⟨Subtype.val (α := ∀ i, E i)⟩
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
variable (p E) in
/-- Coercion to function as an `AddMonoidHom`. -/
def coeFnAddMonoidHom : lp E p →+ (∀ i, E i) where
toFun := (⇑)
__ := AddSubgroup.subtype _
@[simp]
theorem coeFnAddMonoidHom_apply (x : lp E p) : coeFnAddMonoidHom E p x = ⇑x := rfl
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
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]
· rcases 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
· rcases 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]
@[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 _ => norm_eq_zero_iff.1 }
-- TODO: define an `ENNReal` version of `HolderConjugate`, 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.HolderConjugate 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.HolderConjugate 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.HolderConjugate 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 Summable.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 (((lp.memℓp f).summable hp).tsum_le_of_sum_le hf)
end ComparePointwise
section IsBoundedSMul
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, IsBoundedSMul 𝕜 (E i)] [∀ i, IsBoundedSMul 𝕜' (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_def] 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, lp.coeFn_smul, Pi.smul_apply]
gcongr
apply nnnorm_smul_le
instance [Fact (1 ≤ p)] : IsBoundedSMul 𝕜 (lp E p) :=
IsBoundedSMul.of_norm_smul_le <| norm_const_smul_le (zero_lt_one.trans_le <| Fact.out).ne'
end IsBoundedSMul
section DivisionRing
variable [NormedDivisionRing 𝕜] [∀ i, Module 𝕜 (E i)] [∀ i, IsBoundedSMul 𝕜 (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 [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_le f := le_of_eq <| 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 [Star 𝕜] [NormedRing 𝕜]
variable [∀ i, Module 𝕜 (E i)] [∀ i, IsBoundedSMul 𝕜 (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_le f g := lp.norm_le_of_forall_le (by positivity) 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 _) }
instance nonUnitalNormedCommRing {B : I → Type*} [∀ i, NonUnitalNormedCommRing (B i)] :
NonUnitalNormedCommRing (lp B ∞) where
mul_comm _ _ := ext <| mul_comm ..
-- we also want a `NonUnitalNormedCommRing` instance, but this has to wait for https://github.com/leanprover-community/mathlib3/pull/13719
instance infty_isScalarTower {𝕜} [NormedRing 𝕜] [∀ i, Module 𝕜 (B i)] [∀ i, IsBoundedSMul 𝕜 (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, IsBoundedSMul 𝕜 (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) in
/-- 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 }
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
theorem _root_.intCast_memℓp_infty (z : ℤ) : Memℓp (z : ∀ i, B i) ∞ :=
intCast_mem (lpInftySubring B) z
@[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
@[simp]
theorem infty_coeFn_intCast (z : ℤ) : ⇑(z : lp B ∞) = z :=
rfl
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 inftyNormedCommRing : NormedCommRing (lp B ∞) where
mul_comm := mul_comm
end NormedCommRing
section Algebra
variable {I : 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 [NormedRing 𝕜] [∀ i, Module 𝕜 (E i)] [∀ i, IsBoundedSMul 𝕜 (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 :=
⟨Pi.single i a, by
refine (memℓp_zero ?_).of_exponent_ge (zero_le p)
refine (Set.finite_singleton i).subset ?_
intro j
simp only [Set.mem_singleton_iff, Ne,
Set.mem_setOf_eq]
rw [not_imp_comm]
intro h
exact Pi.single_eq_of_ne h _⟩
@[norm_cast]
protected theorem coeFn_single (p) (i : α) (a : E i) :
⇑(lp.single p i a) = Pi.single i a := rfl
@[simp]
protected theorem single_apply (p) (i : α) (a : E i) (j : α) :
lp.single p i a j = Pi.single i a j :=
rfl
protected theorem single_apply_self (p) (i : α) (a : E i) : lp.single p i a i = a :=
Pi.single_eq_same _ _
protected theorem single_apply_ne (p) (i : α) (a : E i) {j : α} (hij : j ≠ i) :
lp.single p i a j = 0 :=
Pi.single_eq_of_ne hij _
@[simp]
protected theorem single_zero (p) (i : α) :
lp.single p i (0 : E i) = 0 :=
ext <| Pi.single_zero _
@[simp]
protected theorem single_add (p) (i : α) (a b : E i) :
lp.single p i (a + b) = lp.single p i a + lp.single p i b :=
ext <| Pi.single_add _ _ _
/-- `single` as an `AddMonoidHom`. -/
@[simps]
def singleAddMonoidHom (p) (i : α) : E i →+ lp E p where
toFun := lp.single p i
map_zero' := lp.single_zero _ _
map_add' := lp.single_add _ _
@[simp]
protected theorem single_neg (p) (i : α) (a : E i) : lp.single p i (-a) = -lp.single p i a :=
ext <| Pi.single_neg _ _
@[simp]
protected theorem single_sub (p) (i : α) (a b : E i) :
lp.single p i (a - b) = lp.single p i a - lp.single p i b :=
ext <| Pi.single_sub _ _ _
@[simp]
protected theorem single_smul (p) (i : α) (c : 𝕜) (a : E i) :
lp.single p i (c • a) = c • lp.single p i a :=
ext <| Pi.single_smul _ _ _
/-- `single` as a `LinearMap`. -/
@[simps]
def lsingle (p) (i : α) : E i →ₗ[𝕜] lp E p where
toFun := lp.single p i
__ := singleAddMonoidHom p i
map_smul' := lp.single_smul p i
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.coeFn_single, coeFn_sum, Finset.sum_apply, Finset.sum_pi_single]
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
@[simp]
protected theorem norm_single (hp : 0 < p) (i : α) (x : E i) : ‖lp.single p i x‖ = ‖x‖ := by
haveI : Nonempty α := ⟨i⟩
induction p with
| top =>
simp only [norm_eq_ciSup, lp.coeFn_single]
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, _root_.norm_zero]
exact norm_nonneg _
· rw [Pi.single_eq_same]
| coe p =>
have : 0 < (p : ℝ≥0∞).toReal := by simpa using hp
rw [norm_eq_tsum_rpow this, tsum_eq_single i, lp.coeFn_single, one_div,
Real.rpow_rpow_inv _ this.ne', Pi.single_eq_same]
· exact norm_nonneg _
· intro j hji
rw [lp.coeFn_single, Pi.single_eq_of_ne hji, _root_.norm_zero, Real.zero_rpow this.ne']
theorem isometry_single [Fact (1 ≤ p)] (i : α) : Isometry (lp.single (E := E) p i) :=
AddMonoidHomClass.isometry_of_norm (lp.singleAddMonoidHom (E := E) p i) fun _ ↦
lp.norm_single (zero_lt_one.trans_le Fact.out) _ _
variable (p E) in
/-- `lp.single` as a continuous morphism of additive monoids. -/
def singleContinuousAddMonoidHom [Fact (1 ≤ p)] (i : α) :
ContinuousAddMonoidHom (E i) (lp E p) where
__ := singleAddMonoidHom p i
continuous_toFun := isometry_single i |>.continuous
@[simp]
theorem singleContinuousAddMonoidHom_apply [Fact (1 ≤ p)] (i : α) (x : E i) :
singleContinuousAddMonoidHom E p i x = lp.single p i x :=
rfl
variable (𝕜 p E) in
/-- `lp.single` as a continuous linear map. -/
def singleContinuousLinearMap [Fact (1 ≤ p)] (i : α) : E i →L[𝕜] lp E p where
__ := lsingle p i
cont := isometry_single i |>.continuous
@[simp]
theorem singleContinuousLinearMap_apply [Fact (1 ≤ p)] (i : α) (x : E i) :
singleContinuousLinearMap 𝕜 E p i x = lp.single p i x :=
rfl
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 [coeFn_sub, coeFn_sum, lp.coeFn_single, Pi.sub_apply, Finset.sum_apply,
Finset.sum_pi_single, F] 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, coeFn_sub,
Pi.sub_apply, Finset.sum_apply, Finset.sum_pi_single, 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
/-- Two continuous additive maps from `lp E p` agree if they agree on `lp.single`.
See note [partially-applied ext lemmas]. -/
@[local ext] -- not globally `ext` due to `hp`
theorem ext_continuousAddMonoidHom
{F : Type*} [AddCommMonoid F] [TopologicalSpace F] [T2Space F]
[Fact (1 ≤ p)] (hp : p ≠ ⊤) ⦃f g : ContinuousAddMonoidHom (lp E p) F⦄
(h : ∀ i,
f.comp (singleContinuousAddMonoidHom E p i) = g.comp (singleContinuousAddMonoidHom E p i)) :
f = g := by
ext x
classical
have := lp.hasSum_single hp x
rw [← (this.map f f.continuous).tsum_eq, ← (this.map g g.continuous).tsum_eq]
congr! 2 with i
exact DFunLike.congr_fun (h i) (x i)
/-- Two continuous linear maps from `lp E p` agree if they agree on `lp.single`.
See note [partially-applied ext lemmas]. -/
@[local ext] -- not globally `ext` due to `hp`
theorem ext_continuousLinearMap
{F : Type*} [AddCommMonoid F] [Module 𝕜 F] [TopologicalSpace F] [T2Space F]
[Fact (1 ≤ p)] (hp : p ≠ ⊤) ⦃f g : lp E p →L[𝕜] F⦄
(h : ∀ i,
f.comp (singleContinuousLinearMap 𝕜 E p i) = g.comp (singleContinuousLinearMap 𝕜 E p i)) :
f = g :=
ContinuousLinearMap.toContinuousAddMonoidHom_injective <|
ext_continuousAddMonoidHom hp fun i => ContinuousLinearMap.toContinuousAddMonoidHom_inj.2 (h i)
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_le _ _
_ ≤ ↑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 |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Lp/ProdLp.lean | 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.
If you wish to endow a type synonym of `α × β` with the `L^p` distance, you can use
`pseudoMetricSpaceToProd` and the declarations below that one.
## Implementation notes
This file is a straight-forward adaptation of `Mathlib/Analysis/Normed/Lp/PiLp.lean`.
## TODO
TODO: the results about uniformity and bornology in the `Aux` section should be using the tools in
`Mathlib.Topology.MetricSpace.Bilipschitz`, so that they can be inlined in the next section and
the only remaining results are about `Lipschitz` and `Antilipschitz`.
-/
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 : 𝕜)
/-- The projection on the first coordinate in `WithLp`. -/
protected def fst (x : WithLp p (α × β)) : α := (ofLp x).fst
/-- The projection on the second coordinate in `WithLp`. -/
protected def snd (x : WithLp p (α × β)) : β := (ofLp x).snd
@[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] lemma toLp_fst (x : α × β) : (toLp p x).fst = x.fst := rfl
@[simp] lemma toLp_snd (x : α × β) : (toLp p x).snd = x.snd := rfl
@[simp] lemma ofLp_fst (x : WithLp p (α × β)) : (ofLp x).fst = x.fst := rfl
@[simp] lemma ofLp_snd (x : WithLp p (α × β)) : (ofLp 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 α β}
@[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.
TODO: the results about uniformity and bornology should be using the tools in
`Mathlib.Topology.MetricSpace.Bilipschitz`, so that they can be inlined in the next section and
the only remaining results are about `Lipschitz` and `Antilipschitz`.
-/
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, reduceCtorEq] 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)
· simp [prod_dist_eq_sup]
· simp only [dist, one_div, dite_eq_ite]
split_ifs with hp' <;> positivity)
fun f g => by
rcases p.dichotomy with (rfl | h)
· refine ENNReal.eq_of_forall_le_nnreal_iff fun r ↦ ?_
simp [prod_edist_eq_sup, prod_dist_eq_sup]
· have : 0 < p.toReal := by rw [ENNReal.toReal_pos_iff_ne_top]; rintro rfl; norm_num at h
simp only [prod_edist_eq_add, edist_dist, one_div, prod_dist_eq_add, this]
rw [← ENNReal.ofReal_rpow_of_nonneg, ENNReal.ofReal_add, ← ENNReal.ofReal_rpow_of_nonneg,
← ENNReal.ofReal_rpow_of_nonneg] <;> simp [Real.rpow_nonneg, add_nonneg]
attribute [local instance] WithLp.prodPseudoMetricAux
variable {α β} in
private theorem edist_proj_le_edist_aux [PseudoEMetricSpace α] [PseudoEMetricSpace β]
(x y : WithLp p (α × β)) :
edist x.fst y.fst ≤ edist x y ∧ edist x.snd y.snd ≤ edist x y := by
rcases p.dichotomy with (rfl | h)
· simp [prod_edist_eq_sup]
· 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)]
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]
private lemma prod_lipschitzWith_ofLp_aux [PseudoEMetricSpace α] [PseudoEMetricSpace β] :
LipschitzWith 1 (@ofLp p (α × β)) := by
intro x y
change max _ _ ≤ _
rw [ENNReal.coe_one, one_mul, sup_le_iff]
exact edist_proj_le_edist_aux p x y
private lemma prod_antilipschitzWith_ofLp_aux [PseudoEMetricSpace α] [PseudoEMetricSpace β] :
AntilipschitzWith ((2 : ℝ≥0) ^ (1 / p).toReal) (@ofLp 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, ENNReal.toReal_one]
calc
(edist x.fst y.fst ^ p.toReal + edist x.snd y.snd ^ p.toReal) ^ (1 / p.toReal) ≤
(edist (ofLp x) (ofLp y) ^ p.toReal +
edist (ofLp x) (ofLp y) ^ p.toReal) ^ (1 / p.toReal) := by
gcongr <;> simp [edist]
_ = (2 ^ (1 / p.toReal) : ℝ≥0) * edist (ofLp x) (ofLp 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]
private lemma isUniformInducing_ofLp_aux [PseudoEMetricSpace α] [PseudoEMetricSpace β] :
IsUniformInducing (@ofLp p (α × β)) :=
(prod_antilipschitzWith_ofLp_aux p α β).isUniformInducing
(prod_lipschitzWith_ofLp_aux p α β).uniformContinuous
private lemma prod_uniformity_aux [PseudoEMetricSpace α] [PseudoEMetricSpace β] :
𝓤 (WithLp p (α × β)) = 𝓤[UniformSpace.comap ofLp inferInstance] := by
rw [← (isUniformInducing_ofLp_aux p α β).comap_uniformity]
rfl
instance instProdBornology (p : ℝ≥0∞) (α β : Type*) [Bornology α] [Bornology β] :
Bornology (WithLp p (α × β)) := Bornology.induced ofLp
private lemma prod_cobounded_aux [PseudoMetricSpace α] [PseudoMetricSpace β] :
@cobounded _ PseudoMetricSpace.toBornology = cobounded (WithLp p (α × β)) :=
le_antisymm (prod_antilipschitzWith_ofLp_aux p α β).tendsto_cobounded.le_comap
(prod_lipschitzWith_ofLp_aux p α β).comap_cobounded_le
end Aux
/-! ### Instances on `L^p` products -/
section TopologicalSpace
variable [TopologicalSpace α] [TopologicalSpace β]
instance instProdTopologicalSpace : TopologicalSpace (WithLp p (α × β)) :=
instTopologicalSpaceProd.induced ofLp
@[continuity, fun_prop]
lemma prod_continuous_toLp : Continuous (@toLp p (α × β)) :=
continuous_induced_rng.2 continuous_id
@[continuity, fun_prop]
lemma prod_continuous_ofLp : Continuous (@ofLp p (α × β)) := continuous_induced_dom
/-- `WithLp.equiv` as a homeomorphism. -/
def homeomorphProd : WithLp p (α × β) ≃ₜ α × β where
toEquiv := WithLp.equiv p (α × β)
continuous_toFun := prod_continuous_ofLp p α β
continuous_invFun := prod_continuous_toLp p α β
@[simp]
lemma toEquiv_homeomorphProd : (homeomorphProd p α β).toEquiv = WithLp.equiv p (α × β) := rfl
variable [T0Space α] [T0Space β]
instance instProdT0Space : T0Space (WithLp p (α × β)) :=
(homeomorphProd p α β).symm.t0Space
variable [SecondCountableTopology α] [SecondCountableTopology β]
instance secondCountableTopology : SecondCountableTopology (WithLp p (α × β)) :=
(homeomorphProd p α β).secondCountableTopology
end TopologicalSpace
section UniformSpace
variable [UniformSpace α] [UniformSpace β]
instance instProdUniformSpace : UniformSpace (WithLp p (α × β)) :=
instUniformSpaceProd.comap ofLp
lemma prod_uniformContinuous_toLp : UniformContinuous (@toLp p (α × β)) :=
uniformContinuous_comap' uniformContinuous_id
lemma prod_uniformContinuous_ofLp : UniformContinuous (@ofLp p (α × β)) :=
uniformContinuous_comap
/-- `WithLp.equiv` as a uniform isomorphism. -/
def uniformEquivProd : WithLp p (α × β) ≃ᵤ α × β where
toEquiv := WithLp.equiv p (α × β)
uniformContinuous_toFun := prod_uniformContinuous_ofLp p α β
uniformContinuous_invFun := prod_uniformContinuous_toLp p α β
@[simp]
lemma toHomeomorph_uniformEquivProd :
(uniformEquivProd p α β).toHomeomorph = homeomorphProd p α β := rfl
@[simp]
lemma toEquiv_uniformEquivProd : (uniformEquivProd p α β).toEquiv = WithLp.equiv p (α × β) := rfl
variable [CompleteSpace α] [CompleteSpace β]
instance instProdCompleteSpace : CompleteSpace (WithLp p (α × β)) :=
(uniformEquivProd p α β).completeSpace_iff.2 inferInstance
end UniformSpace
section ContinuousLinearEquiv
variable [TopologicalSpace α] [TopologicalSpace β]
variable [Semiring 𝕜] [AddCommGroup α] [AddCommGroup β]
variable [Module 𝕜 α] [Module 𝕜 β]
/-- `WithLp.equiv` as a continuous linear equivalence. -/
-- This is not specific to products and should be generalised!
@[simps!]
def prodContinuousLinearEquiv : WithLp p (α × β) ≃L[𝕜] α × β where
toLinearEquiv := WithLp.linearEquiv _ _ _
continuous_toFun := prod_continuous_ofLp p α β
continuous_invFun := prod_continuous_toLp p α β
@[simp]
lemma prodContinuousLinearEquiv_symm_apply (x : α × β) :
(prodContinuousLinearEquiv p 𝕜 α β).symm x = toLp p x := rfl
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_uniformity_aux 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_uniformity_aux p α β).symm).replaceBornology
fun s => Filter.ext_iff.1 (prod_cobounded_aux 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 _ _
theorem edist_fst_le [PseudoEMetricSpace α] [PseudoEMetricSpace β] (x y : WithLp p (α × β)) :
edist x.fst y.fst ≤ edist x y :=
(edist_proj_le_edist_aux p x y).1
theorem edist_snd_le [PseudoEMetricSpace α] [PseudoEMetricSpace β] (x y : WithLp p (α × β)) :
edist x.snd y.snd ≤ edist x y :=
(edist_proj_le_edist_aux p x y).2
theorem nndist_fst_le [PseudoMetricSpace α] [PseudoMetricSpace β] (x y : WithLp p (α × β)) :
nndist x.fst y.fst ≤ nndist x y := by
simpa [← coe_nnreal_ennreal_nndist] using edist_fst_le x y
theorem nndist_snd_le [PseudoMetricSpace α] [PseudoMetricSpace β] (x y : WithLp p (α × β)) :
nndist x.snd y.snd ≤ nndist x y := by
simpa [← coe_nnreal_ennreal_nndist] using edist_snd_le x y
theorem dist_fst_le [PseudoMetricSpace α] [PseudoMetricSpace β] (x y : WithLp p (α × β)) :
dist x.fst y.fst ≤ dist x y :=
nndist_fst_le x y
theorem dist_snd_le [PseudoMetricSpace α] [PseudoMetricSpace β] (x y : WithLp p (α × β)) :
dist x.snd y.snd ≤ dist x y :=
nndist_snd_le x y
variable (p α β)
lemma prod_lipschitzWith_ofLp [PseudoEMetricSpace α] [PseudoEMetricSpace β] :
LipschitzWith 1 (@ofLp p (α × β)) :=
prod_lipschitzWith_ofLp_aux p α β
lemma prod_antilipschitzWith_toLp [PseudoEMetricSpace α] [PseudoEMetricSpace β] :
AntilipschitzWith 1 (@toLp p (α × β)) :=
(prod_lipschitzWith_ofLp p α β).to_rightInverse (ofLp_toLp p)
lemma prod_antilipschitzWith_ofLp [PseudoEMetricSpace α] [PseudoEMetricSpace β] :
AntilipschitzWith ((2 : ℝ≥0) ^ (1 / p).toReal) (@ofLp p (α × β)) :=
prod_antilipschitzWith_ofLp_aux p α β
lemma prod_lipschitzWith_toLp [PseudoEMetricSpace α] [PseudoEMetricSpace β] :
LipschitzWith ((2 : ℝ≥0) ^ (1 / p).toReal) (@toLp p (α × β)) :=
(prod_antilipschitzWith_ofLp p α β).to_rightInverse (ofLp_toLp p)
lemma prod_isometry_ofLp_infty [PseudoEMetricSpace α] [PseudoEMetricSpace β] :
Isometry (@ofLp ∞ (α × β)) :=
fun x y =>
le_antisymm (by simpa only [ENNReal.coe_one, one_mul] using prod_lipschitzWith_ofLp ∞ α β x y)
(by
simpa only [ENNReal.div_top, ENNReal.toReal_zero, NNReal.rpow_zero, ENNReal.coe_one,
one_mul] using prod_antilipschitzWith_ofLp ∞ α β 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
lemma isUniformInducing_toLp [PseudoEMetricSpace α] [PseudoEMetricSpace β] :
IsUniformInducing (@toLp p (α × β)) :=
(prod_antilipschitzWith_toLp p α β).isUniformInducing
(prod_lipschitzWith_toLp p α β).uniformContinuous
section
variable {β p}
theorem enorm_fst_le [SeminormedAddCommGroup α] [SeminormedAddCommGroup β] (x : WithLp p (α × β)) :
‖x.fst‖ₑ ≤ ‖x‖ₑ := by
simpa using edist_fst_le x 0
theorem enorm_snd_le [SeminormedAddCommGroup α] [SeminormedAddCommGroup β] (x : WithLp p (α × β)) :
‖x.snd‖ₑ ≤ ‖x‖ₑ := by
simpa using edist_snd_le x 0
theorem nnnorm_fst_le [SeminormedAddCommGroup α] [SeminormedAddCommGroup β] (x : WithLp p (α × β)) :
‖x.fst‖₊ ≤ ‖x‖₊ := by
simpa using nndist_fst_le x 0
theorem nnnorm_snd_le [SeminormedAddCommGroup α] [SeminormedAddCommGroup β] (x : WithLp p (α × β)) :
‖x.snd‖₊ ≤ ‖x‖₊ := by
simpa using nndist_snd_le x 0
theorem norm_fst_le [SeminormedAddCommGroup α] [SeminormedAddCommGroup β] (x : WithLp p (α × β)) :
‖x.fst‖ ≤ ‖x‖ := by
simpa using dist_fst_le x 0
theorem norm_snd_le [SeminormedAddCommGroup α] [SeminormedAddCommGroup β] (x : WithLp p (α × β)) :
‖x.snd‖ ≤ ‖x‖ := by
simpa using dist_snd_le x 0
end
/-- 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_natCast,
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] lemma prod_nnnorm_ofLp (f : WithLp ∞ (α × β)) : ‖ofLp f‖₊ = ‖f‖₊ := by
rw [prod_nnnorm_eq_sup, Prod.nnnorm_def, ofLp_fst, ofLp_snd]
@[simp] lemma prod_nnnorm_toLp (f : α × β) : ‖toLp ⊤ f‖₊ = ‖f‖₊ :=
(prod_nnnorm_ofLp _).symm
@[simp] lemma prod_norm_ofLp (f : WithLp ∞ (α × β)) : ‖ofLp f‖ = ‖f‖ :=
congr_arg NNReal.toReal <| prod_nnnorm_ofLp f
@[simp] lemma prod_norm_toLp (f : α × β) : ‖toLp ⊤ f‖ = ‖f‖ :=
(prod_norm_ofLp _).symm
section L1
theorem prod_norm_eq_of_L1 (x : WithLp 1 (α × β)) :
‖x‖ = ‖x.fst‖ + ‖x.snd‖ := by
simp [prod_norm_eq_add]
theorem prod_nnnorm_eq_of_L1 (x : WithLp 1 (α × β)) :
‖x‖₊ = ‖x.fst‖₊ + ‖x.snd‖₊ :=
NNReal.eq <| by
push_cast
exact prod_norm_eq_of_L1 x
theorem prod_dist_eq_of_L1 (x y : WithLp 1 (α × β)) :
dist x y = dist x.fst y.fst + dist x.snd y.snd := by
simp_rw [dist_eq_norm, prod_norm_eq_of_L1, sub_fst, sub_snd]
theorem prod_nndist_eq_of_L1 (x y : WithLp 1 (α × β)) :
nndist x y = nndist x.fst y.fst + nndist x.snd y.snd :=
NNReal.eq <| by
push_cast
exact prod_dist_eq_of_L1 _ _
theorem prod_edist_eq_of_L1 (x y : WithLp 1 (α × β)) :
edist x y = edist x.fst y.fst + edist x.snd y.snd := by
simp [prod_edist_eq_add]
end L1
section L2
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, sub_fst, sub_snd]
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 L2
end norm_of
variable [SeminormedAddCommGroup α] [SeminormedAddCommGroup β]
section Single
@[simp] lemma nnnorm_toLp_inl (x : α) : ‖toLp p (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] lemma nnnorm_toLp_inr (y : β) : ‖toLp p ((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]
lemma norm_toLp_fst (x : α) : ‖toLp p (x, (0 : β))‖ = ‖x‖ :=
congr_arg ((↑) : ℝ≥0 → ℝ) <| nnnorm_toLp_inl p α β x
@[simp]
lemma norm_toLp_snd (y : β) : ‖toLp p ((0 : α), y)‖ = ‖y‖ :=
congr_arg ((↑) : ℝ≥0 → ℝ) <| nnnorm_toLp_inr p α β y
@[simp]
lemma nndist_toLp_fst (x₁ x₂ : α) :
nndist (toLp p (x₁, (0 : β))) (toLp p (x₂, 0)) = nndist x₁ x₂ := by
rw [nndist_eq_nnnorm, nndist_eq_nnnorm, ← toLp_sub, Prod.mk_sub_mk, sub_zero,
nnnorm_toLp_inl]
@[simp]
lemma nndist_toLp_snd (y₁ y₂ : β) :
nndist (toLp p ((0 : α), y₁)) (toLp p (0, y₂)) = nndist y₁ y₂ := by
rw [nndist_eq_nnnorm, nndist_eq_nnnorm, ← toLp_sub, Prod.mk_sub_mk, sub_zero,
nnnorm_toLp_inr]
@[simp]
lemma dist_toLp_fst (x₁ x₂ : α) : dist (toLp p (x₁, (0 : β))) (toLp p (x₂, 0)) = dist x₁ x₂ :=
congr_arg ((↑) : ℝ≥0 → ℝ) <| nndist_toLp_fst p α β x₁ x₂
@[simp]
lemma dist_toLp_snd (y₁ y₂ : β) :
dist (toLp p ((0 : α), y₁)) (toLp p (0, y₂)) = dist y₁ y₂ :=
congr_arg ((↑) : ℝ≥0 → ℝ) <| nndist_toLp_snd p α β y₁ y₂
@[simp]
lemma edist_toLp_fst (x₁ x₂ : α) : edist (toLp p (x₁, (0 : β))) (toLp p (x₂, 0)) = edist x₁ x₂ := by
simp only [edist_nndist, nndist_toLp_fst p α β x₁ x₂]
@[simp]
lemma edist_toLp_snd (y₁ y₂ : β) :
edist (toLp p ((0 : α), y₁)) (toLp p (0, y₂)) = edist y₁ y₂ := by
simp only [edist_nndist, nndist_toLp_snd p α β y₁ y₂]
end Single
section IsBoundedSMul
variable [SeminormedRing 𝕜] [Module 𝕜 α] [Module 𝕜 β] [IsBoundedSMul 𝕜 α] [IsBoundedSMul 𝕜 β]
instance instProdIsBoundedSMul : IsBoundedSMul 𝕜 (WithLp p (α × β)) :=
.of_nnnorm_smul_le fun c f => by
rcases p.dichotomy with (rfl | hp)
· simp only [← prod_nnnorm_ofLp, ofLp_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' x := prod_norm_toLp (ofLp x)
end IsBoundedSMul
instance instProdNormSMulClass [SeminormedRing 𝕜] [Module 𝕜 α] [Module 𝕜 β]
[NormSMulClass 𝕜 α] [NormSMulClass 𝕜 β] : NormSMulClass 𝕜 (WithLp p (α × β)) :=
.of_nnnorm_smul fun c f => by
rcases p.dichotomy with (rfl | hp)
· simp only [← prod_nnnorm_ofLp, WithLp.ofLp_smul, nnnorm_smul]
· 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_eq_iff hp0.ne',
NNReal.mul_rpow, ← NNReal.rpow_mul, inv_mul_cancel₀ hp0.ne', NNReal.rpow_one, mul_add,
← NNReal.mul_rpow, ← NNReal.mul_rpow, smul_fst, smul_snd, nnnorm_smul, nnnorm_smul]
section SeminormedAddCommGroup
open ENNReal
variable {p : ℝ≥0∞} {α β}
/-- Projection on `WithLp p (α × β)` with range `α` and kernel `β` -/
def idemFst : AddMonoid.End (WithLp p (α × β)) where
toFun x := toLp p (x.fst, 0)
map_zero' := by simp
map_add' := by simp [← toLp_add]
/-- Projection on `WithLp p (α × β)` with range `β` and kernel `α` -/
def idemSnd : AddMonoid.End (WithLp p (α × β)) where
toFun x := toLp p (0, x.snd)
map_zero' := by simp
map_add' := by simp [← toLp_add]
lemma idemFst_apply (x : WithLp p (α × β)) : idemFst x = toLp p (x.fst, 0) := rfl
lemma idemSnd_apply (x : WithLp p (α × β)) : idemSnd x = toLp p (0, x.snd) := rfl
@[simp]
lemma idemFst_add_idemSnd :
idemFst + idemSnd = (1 : AddMonoid.End (WithLp p (α × β))) := AddMonoidHom.ext
fun x => by
rw [AddMonoidHom.add_apply, idemFst_apply, idemSnd_apply, AddMonoid.End.coe_one, id_eq,
← toLp_add, Prod.mk_add_mk, zero_add, add_zero]
rfl
lemma idemFst_compl : (1 : AddMonoid.End (WithLp p (α × β))) - idemFst = idemSnd := by
rw [← idemFst_add_idemSnd, add_sub_cancel_left]
lemma idemSnd_compl : (1 : AddMonoid.End (WithLp p (α × β))) - idemSnd = idemFst := by
rw [← idemFst_add_idemSnd, add_sub_cancel_right]
theorem prod_norm_eq_idemFst_sup_idemSnd (x : WithLp ∞ (α × β)) :
‖x‖ = max ‖idemFst x‖ ‖idemSnd x‖ := by
rw [WithLp.prod_norm_eq_sup, ← WithLp.norm_toLp_fst ∞ α β x.fst,
← WithLp.norm_toLp_snd ∞ α β x.snd]
rfl
lemma prod_norm_eq_add_idemFst [Fact (1 ≤ p)] (hp : 0 < p.toReal) (x : WithLp p (α × β)) :
‖x‖ = (‖idemFst x‖ ^ p.toReal + ‖idemSnd x‖ ^ p.toReal) ^ (1 / p.toReal) := by
rw [WithLp.prod_norm_eq_add hp, ← WithLp.norm_toLp_fst p α β x.fst,
← WithLp.norm_toLp_snd p α β x.snd]
rfl
lemma prod_norm_eq_idemFst_of_L1 (x : WithLp 1 (α × β)) : ‖x‖ = ‖idemFst x‖ + ‖idemSnd x‖ := by
rw [prod_norm_eq_add_idemFst (lt_of_lt_of_eq zero_lt_one toReal_one.symm)]
simp only [toReal_one, Real.rpow_one, ne_eq, one_ne_zero, not_false_eq_true, div_self]
end SeminormedAddCommGroup
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
section toProd
/-!
### `L^p` distance on a product space
In this section we define a pseudometric space structure on `α × β`, as well as a seminormed
group structure. These are meant to be used to put the desired instances on type synonyms
of `α × β`. See for instance `TrivSqZeroExt.instL1SeminormedAddCommGroup`.
-/
variable (α β : Type*)
/-- This definition allows to endow `α × β` with the Lp distance with the uniformity and bornology
being defeq to the product ones. It is useful to endow a type synonym of `a × β` with the
Lp distance. -/
abbrev pseudoMetricSpaceToProd [PseudoMetricSpace α] [PseudoMetricSpace β] :
PseudoMetricSpace (α × β) :=
(isUniformInducing_toLp p α β).comapPseudoMetricSpace.replaceBornology
fun s => Filter.ext_iff.1
(le_antisymm (prod_antilipschitzWith_toLp p α β).tendsto_cobounded.le_comap
(prod_lipschitzWith_toLp p α β).comap_cobounded_le) sᶜ
lemma dist_pseudoMetricSpaceToProd [PseudoMetricSpace α] [PseudoMetricSpace β] (x y : α × β) :
@dist _ (pseudoMetricSpaceToProd p α β).toDist x y = dist (toLp p x) (toLp p y) := rfl
/-- This definition allows to endow `α × β` with the Lp norm with the uniformity and bornology
being defeq to the product ones. It is useful to endow a type synonym of `a × β` with the
Lp norm. -/
abbrev seminormedAddCommGroupToProd [SeminormedAddCommGroup α] [SeminormedAddCommGroup β] :
SeminormedAddCommGroup (α × β) where
norm x := ‖toLp p x‖
toPseudoMetricSpace := pseudoMetricSpaceToProd p α β
dist_eq x y := by
rw [dist_pseudoMetricSpaceToProd, SeminormedAddCommGroup.dist_eq, toLp_sub]
lemma norm_seminormedAddCommGroupToProd [SeminormedAddCommGroup α] [SeminormedAddCommGroup β]
(x : α × β) :
@Norm.norm _ (seminormedAddCommGroupToProd p α β).toNorm x = ‖toLp p x‖ := rfl
lemma nnnorm_seminormedAddCommGroupToProd [SeminormedAddCommGroup α] [SeminormedAddCommGroup β]
(x : α × β) :
@NNNorm.nnnorm _ (seminormedAddCommGroupToProd p α β).toSeminormedAddGroup.toNNNorm x =
‖toLp p x‖₊ := rfl
instance isBoundedSMulSeminormedAddCommGroupToProd
[SeminormedAddCommGroup α] [SeminormedAddCommGroup β] {R : Type*} [SeminormedRing R]
[Module R α] [Module R β] [IsBoundedSMul R α] [IsBoundedSMul R β] :
letI := pseudoMetricSpaceToProd p α β
IsBoundedSMul R (α × β) := by
letI := pseudoMetricSpaceToProd p α β
refine ⟨fun x y z ↦ ?_, fun x y z ↦ ?_⟩
· simpa [dist_pseudoMetricSpaceToProd] using dist_smul_pair x (toLp p y) (toLp p z)
· simpa [dist_pseudoMetricSpaceToProd] using dist_pair_smul x y (toLp p z)
instance normSMulClassSeminormedAddCommGroupToProd
[SeminormedAddCommGroup α] [SeminormedAddCommGroup β] {R : Type*} [SeminormedRing R]
[Module R α] [Module R β] [NormSMulClass R α] [NormSMulClass R β] :
letI := seminormedAddCommGroupToProd p α β
NormSMulClass R (α × β) := by
letI := seminormedAddCommGroupToProd p α β
refine ⟨fun x y ↦ ?_⟩
rw [norm_smul]
instance normedSpaceSeminormedAddCommGroupToProd
[SeminormedAddCommGroup α] [SeminormedAddCommGroup β] {R : Type*} [NormedField R]
[NormedSpace R α] [NormedSpace R β] :
letI := seminormedAddCommGroupToProd p α β
NormedSpace R (α × β) := by
letI := seminormedAddCommGroupToProd p α β
refine ⟨fun x y ↦ ?_⟩
simp [norm_seminormedAddCommGroupToProd, norm_smul]
/-- This definition allows to endow `α × β` with the Lp norm with the uniformity and bornology
being defeq to the product ones. It is useful to endow a type synonym of `α × β` with the
Lp norm. -/
abbrev normedAddCommGroupToProd [NormedAddCommGroup α] [NormedAddCommGroup β] :
NormedAddCommGroup (α × β) where
norm x := ‖toLp p x‖
toPseudoMetricSpace := pseudoMetricSpaceToProd p α β
dist_eq x y := by
rw [dist_pseudoMetricSpaceToProd, SeminormedAddCommGroup.dist_eq, toLp_sub]
eq_of_dist_eq_zero {x y} h := by
rw [dist_pseudoMetricSpaceToProd] at h
exact toLp_injective p (eq_of_dist_eq_zero h)
end toProd
end WithLp |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Lp/WithLp.lean | import Mathlib.Algebra.Module.TransferInstance
import Mathlib.Data.ENNReal.Basic
import Mathlib.RingTheory.Finiteness.Basic
/-! # 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.toLp`: the canonical inclusion from `V` to `WithLp p V`.
* `WithLp.ofLp`: the canonical inclusion from `WithLp p V` to `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). -/
structure WithLp (p : ℝ≥0∞) (V : Type uV) : Type uV where
/-- Converts an element of `V` to an element of `WithLp p V`. -/
toLp (p) ::
/-- Converts an element of `WithLp p V` to an element of `V`. -/
ofLp : V
section Notation
open Lean.PrettyPrinter.Delaborator
/-- This prevents `toLp p x` being printed as `{ ofLp := x }` by `delabStructureInstance`. -/
@[app_delab WithLp.toLp]
def WithLp.delabToLp : Delab := delabApp
end Notation
variable (p : ℝ≥0∞) (K : Type uK) (K' : Type uK') (V : Type uV)
namespace WithLp
/-- `WithLp.ofLp` and `WithLp.toLp` as an equivalence. -/
@[simps]
protected def equiv : WithLp p V ≃ V where
toFun := ofLp
invFun := toLp p
left_inv _ := rfl
right_inv _ := rfl
@[simp]
lemma equiv_symm_apply : ⇑(WithLp.equiv p V).symm = toLp p := rfl
/-! `WithLp p V` inherits various module-adjacent structures from `V`. -/
instance instNontrivial [Nontrivial V] : Nontrivial (WithLp p V) := (WithLp.equiv p V).nontrivial
instance instUnique [Unique V] : Unique (WithLp p V) := (WithLp.equiv p V).unique
instance instDecidableEq [DecidableEq V] : DecidableEq (WithLp p V) :=
(WithLp.equiv p V).decidableEq
instance instAddCommGroup [AddCommGroup V] : AddCommGroup (WithLp p V) :=
(WithLp.equiv p V).addCommGroup
@[to_additive] instance instSMul [SMul K V] : SMul K (WithLp p V) :=
(WithLp.equiv p V).smul K
@[to_additive] instance instMulAction [Monoid K] [MulAction K V] : MulAction K (WithLp p V) :=
fast_instance% (WithLp.equiv p V).mulAction K
instance instDistribMulAction [Monoid K] [AddCommGroup V] [DistribMulAction K V] :
DistribMulAction K (WithLp p V) := fast_instance% (WithLp.equiv p V).distribMulAction K
instance instModule [Semiring K] [AddCommGroup V] [Module K V] : Module K (WithLp p V) :=
fast_instance% (WithLp.equiv p V).module K
variable {K V}
lemma ofLp_toLp (x : V) : ofLp (toLp p x) = x := rfl
@[simp] lemma toLp_ofLp (x : WithLp p V) : toLp p (ofLp x) = x := rfl
lemma ofLp_surjective : Function.Surjective (@ofLp p V) :=
Function.RightInverse.surjective <| ofLp_toLp _
lemma toLp_surjective : Function.Surjective (@toLp p V) :=
Function.RightInverse.surjective <| toLp_ofLp _
lemma ofLp_injective : Function.Injective (@ofLp p V) :=
Function.LeftInverse.injective <| toLp_ofLp _
lemma toLp_injective : Function.Injective (@toLp p V) :=
Function.LeftInverse.injective <| ofLp_toLp _
lemma ofLp_bijective : Function.Bijective (@ofLp p V) :=
⟨ofLp_injective p, ofLp_surjective p⟩
lemma toLp_bijective : Function.Bijective (@toLp p V) :=
⟨toLp_injective p, toLp_surjective p⟩
section AddCommGroup
variable [AddCommGroup V]
@[simp] lemma toLp_zero : toLp p (0 : V) = 0 := rfl
@[simp] lemma ofLp_zero : ofLp (0 : WithLp p V) = 0 := rfl
@[simp] lemma toLp_add (x y : V) : toLp p (x + y) = toLp p x + toLp p y := rfl
@[simp] lemma ofLp_add (x y : WithLp p V) : ofLp (x + y) = ofLp x + ofLp y := rfl
@[simp] lemma toLp_sub (x y : V) : toLp p (x - y) = toLp p x - toLp p y := rfl
@[simp] lemma ofLp_sub (x y : WithLp p V) : ofLp (x - y) = ofLp x - ofLp y := rfl
@[simp] lemma toLp_neg (x : V) : toLp p (-x) = -toLp p x := rfl
@[simp] lemma ofLp_neg (x : WithLp p V) : ofLp (-x) = -ofLp x := rfl
@[simp] lemma toLp_eq_zero {x : V} : toLp p x = 0 ↔ x = 0 := (toLp_injective p).eq_iff
@[simp] lemma ofLp_eq_zero {x : WithLp p V} : ofLp x = 0 ↔ x = 0 := (ofLp_injective p).eq_iff
end AddCommGroup
@[simp] lemma toLp_smul [SMul K V] (c : K) (x : V) : toLp p (c • x) = c • (toLp p x) := rfl
@[simp] lemma ofLp_smul [SMul K V] (c : K) (x : WithLp p V) : ofLp (c • x) = c • ofLp x := rfl
@[to_additive]
instance instIsScalarTower [SMul K K'] [SMul K V] [SMul K' V] [IsScalarTower K K' V] :
IsScalarTower K K' (WithLp p V) where
smul_assoc x y z := by
change toLp p ((x • y) • (ofLp z)) = toLp p (x • y • ofLp z)
simp
@[to_additive]
instance instSMulCommClass [SMul K V] [SMul K' V] [SMulCommClass K K' V] :
SMulCommClass K K' (WithLp p V) where
smul_comm x y z := by
change toLp p (x • y • ofLp z) = toLp p (y • x • ofLp z)
rw [smul_comm]
section equiv
@[deprecated ofLp_zero (since := "2025-06-08")]
theorem equiv_zero [AddCommGroup V] : WithLp.equiv p V 0 = 0 :=
rfl
@[deprecated toLp_zero (since := "2025-06-08")]
theorem equiv_symm_zero [AddCommGroup V] : (WithLp.equiv p V).symm 0 = 0 :=
rfl
@[deprecated toLp_eq_zero (since := "2025-06-08")]
theorem equiv_symm_eq_zero_iff [AddCommGroup V] {x : V} :
(WithLp.equiv p V).symm x = 0 ↔ x = 0 := toLp_eq_zero p
@[deprecated ofLp_eq_zero (since := "2025-06-08")]
theorem equiv_eq_zero_iff [AddCommGroup V] {x : WithLp p V} :
WithLp.equiv p V x = 0 ↔ x = 0 := ofLp_eq_zero p
@[deprecated ofLp_add (since := "2025-06-08")]
theorem equiv_add [AddCommGroup V] (x y : WithLp p V) :
WithLp.equiv p V (x + y) = WithLp.equiv p V x + WithLp.equiv p V y :=
rfl
@[deprecated toLp_add (since := "2025-06-08")]
theorem equiv_symm_add [AddCommGroup V] (x' y' : V) :
(WithLp.equiv p V).symm (x' + y') = (WithLp.equiv p V).symm x' + (WithLp.equiv p V).symm y' :=
rfl
@[deprecated ofLp_sub (since := "2025-06-08")]
theorem equiv_sub [AddCommGroup V] (x y : WithLp p V) :
WithLp.equiv p V (x - y) = WithLp.equiv p V x - WithLp.equiv p V y :=
rfl
@[deprecated toLp_sub (since := "2025-06-08")]
theorem equiv_symm_sub [AddCommGroup V] (x' y' : V) :
(WithLp.equiv p V).symm (x' - y') = (WithLp.equiv p V).symm x' - (WithLp.equiv p V).symm y' :=
rfl
@[deprecated ofLp_neg (since := "2025-06-08")]
theorem equiv_neg [AddCommGroup V] (x : WithLp p V) : WithLp.equiv p V (-x) = -WithLp.equiv p V x :=
rfl
@[deprecated toLp_neg (since := "2025-06-08")]
theorem equiv_symm_neg [AddCommGroup V] (x' : V) :
(WithLp.equiv p V).symm (-x') = -(WithLp.equiv p V).symm x' :=
rfl
@[deprecated ofLp_smul (since := "2025-06-08")]
theorem equiv_smul [SMul K V] (c : K) (x : WithLp p V) :
WithLp.equiv p V (c • x) = c • WithLp.equiv p V x :=
rfl
@[deprecated toLp_smul (since := "2025-06-08")]
theorem equiv_symm_smul [SMul K V] (c : K) (x' : V) :
(WithLp.equiv p V).symm (c • x') = c • (WithLp.equiv p V).symm x' :=
rfl
end equiv
variable (K V)
/-- `WithLp.equiv` as a linear equivalence. -/
@[simps -fullyApplied apply symm_apply]
protected def linearEquiv [Semiring K] [AddCommGroup V] [Module K V] : WithLp p V ≃ₗ[K] V where
toFun := WithLp.ofLp
invFun := WithLp.toLp p
map_add' _ _ := rfl
map_smul' _ _ := rfl
instance instModuleFinite
[Semiring K] [AddCommGroup V] [Module K V] [Module.Finite K V] :
Module.Finite K (WithLp p V) :=
Module.Finite.equiv (WithLp.linearEquiv p K V).symm
end WithLp |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Field/ProperSpace.lean | import Mathlib.Analysis.Normed.Field.Lemmas
import Mathlib.Analysis.SpecificLimits.Basic
import Mathlib.Topology.MetricSpace.ProperSpace
/-!
# Proper nontrivially normed fields
Nontrivially normed fields are `ProperSpaces` when they are `WeaklyLocallyCompact`.
## Main results
* `ProperSpace.of_nontriviallyNormedField_of_weaklyLocallyCompactSpace`
## Implementation details
This is a special case of `ProperSpace.of_locallyCompactSpace` from
`Mathlib/Analysis/Normed/Module/FiniteDimension.lean`, specialized to be on the field itself
with a proof that requires fewer imports.
-/
assert_not_exists FiniteDimensional
open Metric Filter
/-- A weakly locally compact normed field is proper.
This is a specialization of `ProperSpace.of_locallyCompactSpace`
which holds for `NormedSpace`s but requires more imports. -/
lemma ProperSpace.of_nontriviallyNormedField_of_weaklyLocallyCompactSpace
(𝕜 : Type*) [NontriviallyNormedField 𝕜] [WeaklyLocallyCompactSpace 𝕜] :
ProperSpace 𝕜 := by
rcases exists_isCompact_closedBall (0 : 𝕜) with ⟨r, rpos, hr⟩
rcases NormedField.exists_one_lt_norm 𝕜 with ⟨c, hc⟩
have hC n : IsCompact (closedBall (0 : 𝕜) (‖c‖^n * r)) := by
have : c ^ n ≠ 0 := pow_ne_zero _ <| fun h ↦ by simp [h, zero_le_one.not_gt] at hc
convert hr.smul (c ^ n)
ext
simp only [mem_closedBall, dist_zero_right, Set.mem_smul_set_iff_inv_smul_mem₀ this,
smul_eq_mul, norm_mul, norm_inv, norm_pow,
inv_mul_le_iff₀ (by simpa only [norm_pow] using norm_pos_iff.mpr this)]
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) |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Field/Instances.lean | import Mathlib.Analysis.Normed.Field.Basic
import Mathlib.Analysis.Normed.Ring.Lemmas
import Mathlib.Order.Filter.IsBounded
import Mathlib.Topology.Algebra.UniformField
/-!
# A normed field is a completable topological field
-/
open SeminormedAddGroup IsUniformAddGroup Filter
variable {F : Type*} [NormedField F]
instance NormedField.instCompletableTopField : CompletableTopField F where
t0 := (inferInstanceAs <| T0Space _).t0
nice f hc hn := by
obtain ⟨δ, δ_pos, hδ⟩ := (disjoint_nhds_zero ..).mp <| disjoint_iff.mpr hn
have f_bdd : f.IsBoundedUnder (· ≤ ·) (‖·⁻¹‖) :=
⟨δ⁻¹, hδ.mono fun y hy ↦ le_inv_of_le_inv₀ δ_pos (by simpa using hy)⟩
have h₀ : ∀ᶠ y in f, y ≠ 0 := hδ.mono fun y hy ↦ by simpa using δ_pos.trans_le hy
have : ∀ᶠ p in f ×ˢ f, p.1⁻¹ - p.2⁻¹ = p.1⁻¹ * (p.2 - p.1) * p.2⁻¹ :=
h₀.prod_mk h₀ |>.mono fun ⟨x, y⟩ ⟨hx, hy⟩ ↦ by simp [mul_sub, sub_mul, hx, hy]
rw [cauchy_iff_tendsto_swapped] at hc
rw [cauchy_map_iff_tendsto, tendsto_congr' this]
refine ⟨hc.1, .zero_mul_isBoundedUnder_le ?_ <| tendsto_snd.isBoundedUnder_comp f_bdd⟩
exact isBoundedUnder_le_mul_tendsto_zero (tendsto_fst.isBoundedUnder_comp f_bdd) hc.2 |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Field/Lemmas.lean | import Mathlib.Analysis.Normed.Field.Basic
import Mathlib.Analysis.Normed.Group.Rat
import Mathlib.Analysis.Normed.Ring.Lemmas
import Mathlib.Topology.MetricSpace.DilationEquiv
/-!
# Normed fields
In this file we continue building the theory of normed division rings and fields.
Some useful results that relate the topology of the normed field to the discrete topology include:
* `discreteTopology_or_nontriviallyNormedField`
* `discreteTopology_of_bddAbove_range_norm`
-/
-- Guard against import creep.
assert_not_exists RestrictScalars
variable {α β ι : Type*}
open Filter Bornology
open scoped Topology NNReal Pointwise
section NormedDivisionRing
variable [NormedDivisionRing α]
/-- 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
__ := Dilation.mulLeft a ha
toEquiv := Equiv.mulLeft₀ a ha
/-- 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
__ := Dilation.mulRight a ha
toEquiv := Equiv.mulRight₀ a ha
namespace Filter
@[simp]
lemma map_mul_left_cobounded {a : α} (ha : a ≠ 0) :
map (a * ·) (cobounded α) = cobounded α :=
DilationEquiv.map_cobounded (DilationEquiv.mulLeft 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_nhdsGT_zero, ← inv_atTop₀,
← Filter.comap_inv]
simp only [comap_comap, Function.comp_def, 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_continuousInv₀ : ContinuousInv₀ α := 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, mul_sub, sub_mul,
mul_assoc _ e, inv_mul_cancel₀ r0, mul_inv_cancel₀ e0, one_mul, mul_one]
_ = ‖r - e‖ / ‖r‖ / ‖e‖ := by ring
_ ≤ ‖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
@[deprecated (since := "2025-09-01")] alias NormedDivisionRing.to_hasContinuousInv₀ :=
NormedDivisionRing.to_continuousInv₀
-- see Note [lower instance priority]
/-- A normed division ring is a topological division ring. -/
instance (priority := 100) NormedDivisionRing.to_isTopologicalDivisionRing :
IsTopologicalDivisionRing α where
lemma NormedField.tendsto_norm_inv_nhdsNE_zero_atTop : Tendsto (fun x : α ↦ ‖x⁻¹‖) (𝓝[≠] 0) atTop :=
(tendsto_inv_nhdsGT_zero.comp tendsto_norm_nhdsNE_zero).congr fun x ↦ (norm_inv x).symm
lemma NormedField.tendsto_norm_zpow_nhdsNE_zero_atTop {m : ℤ} (hm : m < 0) :
Tendsto (fun x : α ↦ ‖x ^ m‖) (𝓝[≠] 0) atTop := by
obtain ⟨m, rfl⟩ := neg_surjective m
rw [neg_lt_zero] at hm
lift m to ℕ using hm.le
rw [Int.natCast_pos] at hm
simp only [norm_pow, zpow_neg, zpow_natCast, ← inv_pow]
exact (tendsto_pow_atTop hm.ne').comp NormedField.tendsto_norm_inv_nhdsNE_zero_atTop
end NormedDivisionRing
namespace NormedField
/-- A normed field is either nontrivially normed or has a discrete topology.
In the discrete topology case, all the norms are 1, by `norm_eq_one_iff_ne_zero_of_discrete`.
The nontrivially normed field instance is provided by a subtype with a proof that the
forgetful inheritance to the existing `NormedField` instance is definitionally true.
This allows one to have the new `NontriviallyNormedField` instance without data clashes. -/
lemma discreteTopology_or_nontriviallyNormedField (𝕜 : Type*) [h : NormedField 𝕜] :
DiscreteTopology 𝕜 ∨ Nonempty ({h' : NontriviallyNormedField 𝕜 // h'.toNormedField = h}) := by
by_cases H : ∃ x : 𝕜, x ≠ 0 ∧ ‖x‖ ≠ 1
· exact Or.inr ⟨(⟨NontriviallyNormedField.ofNormNeOne H, rfl⟩)⟩
· simp_rw [discreteTopology_iff_isOpen_singleton_zero, Metric.isOpen_singleton_iff, dist_eq_norm,
sub_zero]
refine Or.inl ⟨1, zero_lt_one, ?_⟩
contrapose! H
refine H.imp ?_
-- contextual to reuse the `a ≠ 0` hypothesis in the proof of `a ≠ 0 ∧ ‖a‖ ≠ 1`
simp +contextual [ne_of_lt]
lemma discreteTopology_of_bddAbove_range_norm {𝕜 : Type*} [NormedField 𝕜]
(h : BddAbove (Set.range fun k : 𝕜 ↦ ‖k‖)) :
DiscreteTopology 𝕜 := by
refine (NormedField.discreteTopology_or_nontriviallyNormedField _).resolve_right ?_
rintro ⟨_, rfl⟩
obtain ⟨x, h⟩ := h
obtain ⟨k, hk⟩ := NormedField.exists_lt_norm 𝕜 x
exact hk.not_ge (h (Set.mem_range_self k))
section Densely
variable (α) [DenselyNormedField α]
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
section NontriviallyNormedField
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {n : ℤ} {x : 𝕜}
@[simp]
protected lemma continuousAt_zpow : ContinuousAt (fun x ↦ x ^ n) x ↔ x ≠ 0 ∨ 0 ≤ n := by
refine ⟨?_, continuousAt_zpow₀ _ _⟩
contrapose!
rintro ⟨rfl, hm⟩ hc
exact not_tendsto_atTop_of_tendsto_nhds (hc.tendsto.mono_left nhdsWithin_le_nhds).norm
(NormedField.tendsto_norm_zpow_nhdsNE_zero_atTop hm)
@[simp]
protected lemma continuousAt_inv : ContinuousAt Inv.inv x ↔ x ≠ 0 := by
simpa using NormedField.continuousAt_zpow (n := -1) (x := x)
end NontriviallyNormedField
end NormedField
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 Complete
lemma NormedField.completeSpace_iff_isComplete_closedBall {K : Type*} [NormedField K] :
CompleteSpace K ↔ IsComplete (Metric.closedBall 0 1 : Set K) := by
constructor <;> intro h
· exact Metric.isClosed_closedBall.isComplete
rcases NormedField.discreteTopology_or_nontriviallyNormedField K with _ | ⟨_, rfl⟩
· rwa [completeSpace_iff_isComplete_univ,
← NormedDivisionRing.unitClosedBall_eq_univ_of_discrete]
refine Metric.complete_of_cauchySeq_tendsto fun u hu ↦ ?_
obtain ⟨k, hk⟩ := hu.norm_bddAbove
have kpos : 0 ≤ k := (_root_.norm_nonneg (u 0)).trans (hk (by simp))
obtain ⟨x, hx⟩ := NormedField.exists_lt_norm K k
have hu' : CauchySeq ((· / x) ∘ u) := (uniformContinuous_div_const' x).comp_cauchySeq hu
have hb : ∀ n, ((· / x) ∘ u) n ∈ Metric.closedBall 0 1 := by
intro
simp only [Function.comp_apply, Metric.mem_closedBall, dist_zero_right, norm_div]
rw [div_le_one (kpos.trans_lt hx)]
exact hx.le.trans' (hk (by simp))
obtain ⟨a, -, ha'⟩ := cauchySeq_tendsto_of_isComplete h hb hu'
refine ⟨a * x, (((continuous_mul_right x).tendsto a).comp ha').congr ?_⟩
have hx' : x ≠ 0 := by
contrapose! hx
simp [hx, kpos]
simp [div_mul_cancel₀ _ hx']
end Complete |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Field/Ultra.lean | import Mathlib.Analysis.Normed.Field.Basic
import Mathlib.Analysis.Normed.Ring.Ultra
import Mathlib.Data.Nat.Choose.Sum
/-!
## Conditions to have an ultrametric norm on a division ring
This file provides ways of constructing an instance of `IsUltrametricDist` based on
facts about the existing norm.
## Main results
* `isUltrametricDist_of_forall_norm_natCast_le_one`: a norm in a division ring is ultrametric
if the norm of the image of a natural is less than or equal to one
* `isUltrametricDist_iff_forall_norm_natCast_le_one`: a norm in a division ring is ultrametric
if and only if the norm of the image of a natural is less than or equal to one
## Implementation details
The proof relies on a bounded-from-above argument. The main result has a longer proof
to be able to be applied in noncommutative division rings.
## Tags
ultrametric, nonarchimedean
-/
open Metric NNReal
namespace IsUltrametricDist
section sufficient
variable {R : Type*} [NormedDivisionRing R]
lemma isUltrametricDist_of_forall_norm_add_one_le_max_norm_one
(h : ∀ x : R, ‖x + 1‖ ≤ max ‖x‖ 1) : IsUltrametricDist R := by
refine isUltrametricDist_of_forall_norm_add_le_max_norm (fun x y ↦ ?_)
rcases eq_or_ne y 0 with rfl | hy
· simpa only [add_zero] using le_max_left _ _
· have p : 0 < ‖y‖ := norm_pos_iff.mpr hy
simpa only [div_add_one hy, norm_div, div_le_iff₀ p, max_mul_of_nonneg _ _ p.le, one_mul,
div_mul_cancel₀ _ p.ne'] using h (x / y)
lemma isUltrametricDist_of_forall_norm_add_one_of_norm_le_one
(h : ∀ x : R, ‖x‖ ≤ 1 → ‖x + 1‖ ≤ 1) : IsUltrametricDist R := by
refine isUltrametricDist_of_forall_norm_add_one_le_max_norm_one fun x ↦ ?_
rcases le_or_gt ‖x‖ 1 with H|H
· exact (h _ H).trans (le_max_right _ _)
· suffices ‖x + 1‖ ≤ ‖x‖ from this.trans (le_max_left _ _)
rw [← div_le_one (by positivity), ← norm_div, add_div,
div_self (by simpa using H.trans' zero_lt_one), add_comm]
apply h
simp [inv_le_one_iff₀, H.le]
lemma isUltrametricDist_of_forall_norm_sub_one_of_norm_le_one
(h : ∀ x : R, ‖x‖ ≤ 1 → ‖x - 1‖ ≤ 1) : IsUltrametricDist R := by
have (x : R) (hx : ‖x‖ ≤ 1) : ‖x + 1‖ ≤ 1 := by
simpa only [← neg_add', norm_neg] using h (-x) (norm_neg x ▸ hx)
exact isUltrametricDist_of_forall_norm_add_one_of_norm_le_one this
/-- This technical lemma is used in the proof of
`isUltrametricDist_of_forall_norm_natCast_le_one`. -/
lemma isUltrametricDist_of_forall_pow_norm_le_nsmul_pow_max_one_norm
(h : ∀ (x : R) (m : ℕ), ‖x + 1‖ ^ m ≤ (m + 1) • max 1 (‖x‖ ^ m)) :
IsUltrametricDist R := by
-- it will suffice to prove that `‖x + 1‖ ≤ max 1 ‖x‖`
refine isUltrametricDist_of_forall_norm_add_one_le_max_norm_one fun x ↦ ?_
-- Morally, we want to deduce this from the hypothesis `h` by taking an `m`-th root and showing
-- that `(m + 1) ^ (1 / m)` gets arbitrarily close to 1, although we will formalise this in a way
-- that avoids explicitly mentioning `m`-th roots.
-- First note it suffices to show that `‖x + 1‖ ≤ a` for all `a : ℝ` with `max ‖x‖ 1 < a`.
rw [max_comm]
refine le_of_forall_gt_imp_ge_of_dense fun a ha ↦ ?_
have ha' : 1 < a := (max_lt_iff.mp ha).left
-- `max 1 ‖x‖ < a`, so there must be some `m : ℕ` such that `m + 1 < (a / max 1 ‖x‖) ^ m`
-- by the virtue of exponential growth being faster than linear growth
obtain ⟨m, hm⟩ : ∃ m : ℕ, ((m + 1) : ℕ) < (a / (max 1 ‖x‖)) ^ m := by
apply_mod_cast Real.exists_natCast_add_one_lt_pow_of_one_lt
rwa [one_lt_div (by positivity)]
-- and we rearrange again to get `(m + 1) • max 1 ‖x‖ ^ m < a ^ m`
rw [div_pow, lt_div_iff₀ (by positivity), ← nsmul_eq_mul] at hm
-- which squeezes down to get our `‖x + 1‖ ≤ a` using our to-be-proven hypothesis of
-- `‖x + 1‖ ^ m ≤ (m + 1) • max 1 ‖x‖ ^ m`, so we're done
-- we can distribute powers into the right term of `max`
have hp : max 1 ‖x‖ ^ m = max 1 (‖x‖ ^ m) := by
rw [pow_left_monotoneOn.map_max (by simp [zero_le_one]) (norm_nonneg x), one_pow]
rw [hp] at hm
refine le_of_pow_le_pow_left₀ (fun h ↦ ?_) (zero_lt_one.trans ha').le ((h _ _).trans hm.le)
simp only [h, zero_add, pow_zero, max_self, one_smul, lt_self_iff_false] at hm
/-- To prove that a normed division ring is nonarchimedean, it suffices to prove that the norm
of the image of any natural is less than or equal to one. -/
lemma isUltrametricDist_of_forall_norm_natCast_le_one
(h : ∀ n : ℕ, ‖(n : R)‖ ≤ 1) : IsUltrametricDist R := by
-- from a previous lemma, suffices to prove that for all `m`, we have
-- `‖x + 1‖ ^ m ≤ (m + 1) • max 1 ‖x‖ ^ m`
refine isUltrametricDist_of_forall_pow_norm_le_nsmul_pow_max_one_norm (fun x m ↦ ?_)
-- we first use our hypothesis about the norm of naturals to have that multiplication by
-- naturals keeps the norm small
replace h (x : R) (n : ℕ) : ‖n • x‖ ≤ ‖x‖ := by
rw [nsmul_eq_mul, norm_mul]
rcases (norm_nonneg x).eq_or_lt with hx | hx
· simp only [← hx, mul_zero, le_refl]
· simpa only [mul_le_iff_le_one_left hx] using h _
-- we expand the LHS using the binomial theorem, and apply the hypothesis to bound each term by
-- a power of ‖x‖
transitivity ∑ k ∈ Finset.range (m + 1), ‖x‖ ^ k
· simpa only [← norm_pow, (Commute.one_right x).add_pow, one_pow, mul_one, nsmul_eq_mul,
Nat.cast_comm] using (norm_sum_le _ _).trans (Finset.sum_le_sum fun _ _ ↦ h _ _)
-- the nature of the norm means that one of `1` and `‖x‖ ^ m` is the largest of the two, so the
-- other terms in the binomial expansion are bounded by the max of these, and the number of terms
-- in the sum is precisely `m + 1`
rw [← Finset.card_range (m + 1), ← Finset.sum_const, Finset.card_range]
rcases max_cases 1 (‖x‖ ^ m) with (⟨hm, hx⟩|⟨hm, hx⟩) <;> rw [hm] <;>
-- which we show by comparing the terms in the sum one by one
gcongr with i hi
· rcases eq_or_ne m 0 with rfl | hm
· simp only [pow_zero, le_refl,
show i = 0 by simpa only [zero_add, Finset.range_one, Finset.mem_singleton] using hi]
· rw [pow_le_one_iff_of_nonneg (norm_nonneg _) hm] at hx
exact pow_le_one₀ (norm_nonneg _) hx
· contrapose! hx
exact pow_le_one₀ (norm_nonneg _) hx.le
· simpa [Nat.lt_succ_iff] using hi
end sufficient
end IsUltrametricDist
theorem isUltrametricDist_iff_forall_norm_natCast_le_one {R : Type*}
[NormedDivisionRing R] : IsUltrametricDist R ↔ ∀ n : ℕ, ‖(n : R)‖ ≤ 1 :=
⟨fun _ => IsUltrametricDist.norm_natCast_le_one R,
IsUltrametricDist.isUltrametricDist_of_forall_norm_natCast_le_one⟩ |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Field/Basic.lean | import Mathlib.Algebra.Field.Subfield.Defs
import Mathlib.Algebra.Order.Group.Pointwise.Interval
import Mathlib.Analysis.Normed.Ring.Basic
/-!
# Normed division rings and fields
In this file we define normed fields, and (more generally) normed division rings. We also prove
some theorems about these definitions.
Some useful results that relate the topology of the normed field to the discrete topology include:
* `norm_eq_one_iff_ne_zero_of_discrete`
Methods for constructing a normed field instance from a given real absolute value on a field are
given in:
* AbsoluteValue.toNormedField
-/
-- Guard against import creep.
assert_not_exists AddChar comap_norm_atTop DilationEquiv Finset.sup_mul_le_mul_sup_of_nonneg
IsOfFinOrder Isometry.norm_map_of_map_one NNReal.isOpen_Ico_zero Rat.norm_cast_real
RestrictScalars
variable {G α β ι : Type*}
open Filter
open scoped Topology NNReal ENNReal
/-- 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. -/
protected 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_le a b := (NormedDivisionRing.norm_mul a b).le }
-- see Note [lower instance priority]
/-- The norm on a normed division ring is strictly multiplicative. -/
instance (priority := 100) NormedDivisionRing.toNormMulClass [NormedDivisionRing α] :
NormMulClass α where
norm_mul := NormedDivisionRing.norm_mul
section NormedDivisionRing
variable [NormedDivisionRing α] {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]⟩
@[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]
lemma enorm_inv {a : α} (ha : a ≠ 0) : ‖a⁻¹‖ₑ = ‖a‖ₑ⁻¹ := by simp [enorm, ENNReal.coe_inv, ha]
@[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 norm_commutator_sub_one_le (ha : a ≠ 0) (hb : b ≠ 0) :
‖a * b * a⁻¹ * b⁻¹ - 1‖ ≤ 2 * ‖a‖⁻¹ * ‖b‖⁻¹ * ‖a - 1‖ * ‖b - 1‖ := by
simpa using norm_commutator_units_sub_one_le (.mk0 a ha) (.mk0 b hb)
lemma nnnorm_commutator_sub_one_le (ha : a ≠ 0) (hb : b ≠ 0) :
‖a * b * a⁻¹ * b⁻¹ - 1‖₊ ≤ 2 * ‖a‖₊⁻¹ * ‖b‖₊⁻¹ * ‖a - 1‖₊ * ‖b - 1‖₊ := by
simpa using nnnorm_commutator_units_sub_one_le (.mk0 a ha) (.mk0 b hb)
namespace NormedDivisionRing
section Discrete
variable {𝕜 : Type*} [NormedDivisionRing 𝕜] [DiscreteTopology 𝕜]
lemma norm_eq_one_iff_ne_zero_of_discrete {x : 𝕜} : ‖x‖ = 1 ↔ x ≠ 0 := by
constructor <;> intro hx
· contrapose! hx
simp [hx]
· have : IsOpen {(0 : 𝕜)} := isOpen_discrete {0}
simp_rw [Metric.isOpen_singleton_iff, dist_eq_norm, sub_zero] at this
obtain ⟨ε, εpos, h'⟩ := this
wlog h : ‖x‖ < 1 generalizing 𝕜 with H
· push_neg at h
rcases h.eq_or_lt with h|h
· rw [h]
replace h := norm_inv x ▸ inv_lt_one_of_one_lt₀ h
rw [← inv_inj, inv_one, ← norm_inv]
exact H (by simpa) h' h
obtain ⟨k, hk⟩ : ∃ k : ℕ, ‖x‖ ^ k < ε := exists_pow_lt_of_lt_one εpos h
rw [← norm_pow] at hk
specialize h' _ hk
simp [hx] at h'
@[simp]
lemma norm_le_one_of_discrete
(x : 𝕜) : ‖x‖ ≤ 1 := by
rcases eq_or_ne x 0 with rfl | hx
· simp
· simp [norm_eq_one_iff_ne_zero_of_discrete.mpr hx]
lemma unitClosedBall_eq_univ_of_discrete : (Metric.closedBall 0 1 : Set 𝕜) = Set.univ := by
ext
simp
end Discrete
end NormedDivisionRing
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. -/
protected 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 nontrivially 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_le a b := (norm_mul a b).le }
end NormedField
namespace NormedField
section Nontrivially
variable (α) [NontriviallyNormedField α]
theorem exists_one_lt_norm : ∃ x : α, 1 < ‖x‖ :=
‹NontriviallyNormedField α›.non_trivial
theorem exists_one_lt_nnnorm : ∃ x : α, 1 < ‖x‖₊ := exists_one_lt_norm α
theorem exists_one_lt_enorm : ∃ x : α, 1 < ‖x‖ₑ :=
exists_one_lt_nnnorm α |>.imp fun _ => ENNReal.coe_lt_coe.mpr
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_lt_nnnorm (r : ℝ≥0) : ∃ x : α, r < ‖x‖₊ := exists_lt_norm α r
theorem exists_lt_enorm {r : ℝ≥0∞} (hr : r ≠ ∞) : ∃ x : α, r < ‖x‖ₑ := by
lift r to ℝ≥0 using hr
exact mod_cast exists_lt_nnnorm α r
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_nnnorm_lt {r : ℝ≥0} (hr : 0 < r) : ∃ x : α, 0 < ‖x‖₊ ∧ ‖x‖₊ < r :=
exists_norm_lt α hr
/-- TODO: merge with `_root_.exists_enorm_lt`. -/
theorem exists_enorm_lt {r : ℝ≥0∞} (hr : 0 < r) : ∃ x : α, 0 < ‖x‖ₑ ∧ ‖x‖ₑ < r :=
match r with
| ∞ => exists_one_lt_enorm α |>.imp fun _ hx => ⟨zero_le_one.trans_lt hx, ENNReal.coe_lt_top⟩
| (r : ℝ≥0) => exists_nnnorm_lt α (ENNReal.coe_pos.mp hr) |>.imp fun _ =>
And.imp ENNReal.coe_pos.mpr ENNReal.coe_lt_coe.mpr
theorem exists_norm_lt_one : ∃ x : α, 0 < ‖x‖ ∧ ‖x‖ < 1 :=
exists_norm_lt α one_pos
theorem exists_nnnorm_lt_one : ∃ x : α, 0 < ‖x‖₊ ∧ ‖x‖₊ < 1 := exists_norm_lt_one _
theorem exists_enorm_lt_one : ∃ x : α, 0 < ‖x‖ₑ ∧ ‖x‖ₑ < 1 := exists_enorm_lt _ one_pos
variable {α}
@[instance]
theorem nhdsNE_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_eq_left).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 nhdsNE_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⟩
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_gt with hlt | hlt
· use x⁻¹
rw [norm_inv]
exact (one_lt_inv₀ (norm_pos_iff.2 hx)).2 hlt
· exact ⟨x, hlt⟩
noncomputable instance Real.normedField : NormedField ℝ :=
{ Real.normedAddCommGroup, Real.instField 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
/-! ### Induced normed structures -/
section Induced
variable {F : Type*} (R S : Type*) [FunLike F R S]
/-- 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 x y := show ‖f _‖ = _ from (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 }
end Induced
namespace SubfieldClass
variable {S F : Type*} [SetLike S F]
/--
If `s` is a subfield of a normed field `F`, then `s` is equipped with an induced normed
field structure.
-/
instance toNormedField [NormedField F] [SubfieldClass S F] (s : S) : NormedField s :=
NormedField.induced s F (SubringClass.subtype s) Subtype.val_injective
end SubfieldClass
namespace AbsoluteValue
/-- A real absolute value on a field determines a `NormedField` structure. -/
noncomputable def toNormedField {K : Type*} [Field K] (v : AbsoluteValue K ℝ) : NormedField K where
toField := inferInstanceAs (Field K)
__ := v.toNormedRing
norm_mul := v.map_mul
end AbsoluteValue |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Field/WithAbs.lean | import Mathlib.Analysis.Normed.Module.Completion
import Mathlib.Analysis.Normed.Ring.WithAbs
import Mathlib.FieldTheory.Separable
/-!
# WithAbs for fields
This extends the `WithAbs` mechanism to fields, providing a type synonym for a field which depends
on an absolute value. This is useful when dealing with several absolute values on the same field.
In particular this allows us to define the completion of a field at a given absolute value.
-/
open Topology
noncomputable section
variable {R S : Type*} [Semiring S] [PartialOrder S] [IsOrderedRing S]
namespace WithAbs
section more_instances
variable {R' : Type*} [Field R] [Field R']
instance instField (v : AbsoluteValue R S) : Field (WithAbs v) := ‹Field R›
instance normedField (v : AbsoluteValue R ℝ) : NormedField (WithAbs v) :=
v.toNormedField
instance [Module R R'] [FiniteDimensional R R'] (v : AbsoluteValue R S) :
FiniteDimensional (WithAbs v) R' :=
‹FiniteDimensional R R'›
instance [Algebra R R'] [Algebra.IsSeparable R R'] (v : AbsoluteValue R S) :
Algebra.IsSeparable (WithAbs v) R' :=
‹Algebra.IsSeparable R R'›
end more_instances
/-!
### The completion of a field at an absolute value.
-/
variable {K : Type*} [Field K] {v : AbsoluteValue K ℝ}
{L : Type*} [NormedField L] {f : WithAbs v →+* L}
/-- If the absolute value `v` factors through an embedding `f` into a normed field, then
`f` is an isometry. -/
theorem isometry_of_comp (h : ∀ x, ‖f x‖ = v x) : Isometry f :=
Isometry.of_dist_eq <| fun x y => by simp only [‹NormedField L›.dist_eq, ← f.map_sub, h]; rfl
/-- If the absolute value `v` factors through an embedding `f` into a normed field, then
the pseudometric space associated to the absolute value is the same as the pseudometric space
induced by `f`. -/
theorem pseudoMetricSpace_induced_of_comp (h : ∀ x, ‖f x‖ = v x) :
PseudoMetricSpace.induced f inferInstance = (normedField v).toPseudoMetricSpace := by
ext; exact isometry_of_comp h |>.dist_eq _ _
/-- If the absolute value `v` factors through an embedding `f` into a normed field, then
the uniform structure associated to the absolute value is the same as the uniform structure
induced by `f`. -/
theorem uniformSpace_comap_eq_of_comp (h : ∀ x, ‖f x‖ = v x) :
UniformSpace.comap f inferInstance = (normedField v).toUniformSpace := by
simp only [← pseudoMetricSpace_induced_of_comp h, PseudoMetricSpace.toUniformSpace]
/-- If the absolute value `v` factors through an embedding `f` into a normed field, then
`f` is uniform inducing. -/
theorem isUniformInducing_of_comp (h : ∀ x, ‖f x‖ = v x) : IsUniformInducing f :=
isUniformInducing_iff_uniformSpace.2 <| uniformSpace_comap_eq_of_comp h
end WithAbs
namespace AbsoluteValue
open WithAbs
variable {K : Type*} [Field K] (v : AbsoluteValue K ℝ)
/-- The completion of a field with respect to a real absolute value. -/
abbrev Completion := UniformSpace.Completion (WithAbs v)
namespace Completion
instance : Coe K v.Completion :=
inferInstanceAs <| Coe (WithAbs v) (UniformSpace.Completion (WithAbs v))
variable {L : Type*} [NormedField L] [CompleteSpace L] {f : WithAbs v →+* L} {v}
/-- If the absolute value of a normed field factors through an embedding into another normed field
`L`, then we can extend that embedding to an embedding on the completion `v.Completion →+* L`. -/
abbrev extensionEmbedding_of_comp (h : ∀ x, ‖f x‖ = v x) : v.Completion →+* L :=
UniformSpace.Completion.extensionHom _
(WithAbs.isUniformInducing_of_comp h).uniformContinuous.continuous
theorem extensionEmbedding_of_comp_coe (h : ∀ x, ‖f x‖ = v x) (x : K) :
extensionEmbedding_of_comp h x = f x := by
rw [← UniformSpace.Completion.extensionHom_coe f
(WithAbs.isUniformInducing_of_comp h).uniformContinuous.continuous]
/-- If the absolute value of a normed field factors through an embedding into another normed field,
then the extended embedding `v.Completion →+* L` preserves distances. -/
theorem extensionEmbedding_dist_eq_of_comp (h : ∀ x, ‖f x‖ = v x) (x y : v.Completion) :
dist (extensionEmbedding_of_comp h x) (extensionEmbedding_of_comp h y) =
dist x y := by
refine UniformSpace.Completion.induction_on₂ x y ?_ (fun x y => ?_)
· refine isClosed_eq ?_ continuous_dist
exact continuous_iff_continuous_dist.1 UniformSpace.Completion.continuous_extension
· simp only [extensionEmbedding_of_comp_coe]
exact UniformSpace.Completion.dist_eq x y ▸ (WithAbs.isometry_of_comp h).dist_eq _ _
/-- If the absolute value of a normed field factors through an embedding into another normed field,
then the extended embedding `v.Completion →+* L` is an isometry. -/
theorem isometry_extensionEmbedding_of_comp (h : ∀ x, ‖f x‖ = v x) :
Isometry (extensionEmbedding_of_comp h) :=
Isometry.of_dist_eq <| extensionEmbedding_dist_eq_of_comp h
/-- If the absolute value of a normed field factors through an embedding into another normed field,
then the extended embedding `v.Completion →+* L` is a closed embedding. -/
theorem isClosedEmbedding_extensionEmbedding_of_comp (h : ∀ x, ‖f x‖ = v x) :
IsClosedEmbedding (extensionEmbedding_of_comp h) :=
(isometry_extensionEmbedding_of_comp h).isClosedEmbedding
/-- If the absolute value of a normed field factors through an embedding into another normed field
that is locally compact, then the completion of the first normed field is also locally compact. -/
theorem locallyCompactSpace [LocallyCompactSpace L] (h : ∀ x, ‖f x‖ = v x) :
LocallyCompactSpace (v.Completion) :=
(isClosedEmbedding_extensionEmbedding_of_comp h).locallyCompactSpace
end AbsoluteValue.Completion |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Field/UnitBall.lean | import Mathlib.Analysis.Normed.Field.Lemmas
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*}
/-!
### Algebraic structures on `Metric.ball 0 1`
-/
/-- Unit ball in a non-unital seminormed 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.instSemigroup [NonUnitalSeminormedRing 𝕜] : Semigroup (ball (0 : 𝕜) 1) :=
MulMemClass.toSemigroup (Subsemigroup.unitBall 𝕜)
instance Metric.unitBall.instContinuousMul [NonUnitalSeminormedRing 𝕜] :
ContinuousMul (ball (0 : 𝕜) 1) :=
(Subsemigroup.unitBall 𝕜).continuousMul
instance Metric.unitBall.instCommSemigroup [SeminormedCommRing 𝕜] :
CommSemigroup (ball (0 : 𝕜) 1) :=
MulMemClass.toCommSemigroup (Subsemigroup.unitBall 𝕜)
instance Metric.unitBall.instHasDistribNeg [NonUnitalSeminormedRing 𝕜] :
HasDistribNeg (ball (0 : 𝕜) 1) :=
Subtype.coe_injective.hasDistribNeg ((↑) : ball (0 : 𝕜) 1 → 𝕜) (fun _ => rfl) fun _ _ => rfl
@[simp, norm_cast]
protected theorem Metric.unitBall.coe_mul [NonUnitalSeminormedRing 𝕜] (x y : ball (0 : 𝕜) 1) :
↑(x * y) = (x * y : 𝕜) :=
rfl
instance Metric.unitBall.instZero [Zero 𝕜] [PseudoMetricSpace 𝕜] : Zero (ball (0 : 𝕜) 1) :=
⟨⟨0, by simp⟩⟩
@[simp, norm_cast]
protected theorem Metric.unitBall.coe_zero [Zero 𝕜] [PseudoMetricSpace 𝕜] :
((0 : ball (0 : 𝕜) 1) : 𝕜) = 0 :=
rfl
@[simp, norm_cast]
protected theorem Metric.unitBall.coe_eq_zero [Zero 𝕜] [PseudoMetricSpace 𝕜] {a : ball (0 : 𝕜) 1} :
(a : 𝕜) = 0 ↔ a = 0 :=
Subtype.val_injective.eq_iff' unitBall.coe_zero
instance Metric.unitBall.instSemigroupWithZero [NonUnitalSeminormedRing 𝕜] :
SemigroupWithZero (ball (0 : 𝕜) 1) where
zero_mul _ := Subtype.eq <| zero_mul _
mul_zero _ := Subtype.eq <| mul_zero _
instance Metric.unitBall.instIsLeftCancelMulZero [NonUnitalSeminormedRing 𝕜]
[IsLeftCancelMulZero 𝕜] : IsLeftCancelMulZero (ball (0 : 𝕜) 1) :=
Subtype.val_injective.isLeftCancelMulZero _ rfl fun _ _ ↦ rfl
instance Metric.unitBall.instIsRightCancelMulZero [NonUnitalSeminormedRing 𝕜]
[IsRightCancelMulZero 𝕜] : IsRightCancelMulZero (ball (0 : 𝕜) 1) :=
Subtype.val_injective.isRightCancelMulZero _ rfl fun _ _ ↦ rfl
instance Metric.unitBall.instIsCancelMulZero [NonUnitalSeminormedRing 𝕜]
[IsCancelMulZero 𝕜] : IsCancelMulZero (ball (0 : 𝕜) 1) where
/-!
### Algebraic instances for `Metric.closedBall 0 1`
-/
/-- Closed unit ball in a non-unital seminormed 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.instSemigroup [NonUnitalSeminormedRing 𝕜] :
Semigroup (closedBall (0 : 𝕜) 1) :=
MulMemClass.toSemigroup (Subsemigroup.unitClosedBall 𝕜)
instance Metric.unitClosedBall.instHasDistribNeg [NonUnitalSeminormedRing 𝕜] :
HasDistribNeg (closedBall (0 : 𝕜) 1) :=
Subtype.coe_injective.hasDistribNeg ((↑) : closedBall (0 : 𝕜) 1 → 𝕜) (fun _ => rfl) fun _ _ => rfl
instance Metric.unitClosedBall.instContinuousMul [NonUnitalSeminormedRing 𝕜] :
ContinuousMul (closedBall (0 : 𝕜) 1) :=
(Subsemigroup.unitClosedBall 𝕜).continuousMul
@[simp, norm_cast]
protected theorem Metric.unitClosedBall.coe_mul [NonUnitalSeminormedRing 𝕜]
(x y : closedBall (0 : 𝕜) 1) : ↑(x * y) = (x * y : 𝕜) :=
rfl
instance Metric.unitClosedBall.instZero [Zero 𝕜] [PseudoMetricSpace 𝕜] :
Zero (closedBall (0 : 𝕜) 1) where
zero := ⟨0, by simp⟩
@[simp, norm_cast]
protected lemma Metric.unitClosedBall.coe_zero [Zero 𝕜] [PseudoMetricSpace 𝕜] :
((0 : closedBall (0 : 𝕜) 1) : 𝕜) = 0 :=
rfl
@[simp, norm_cast]
protected lemma Metric.unitClosedBall.coe_eq_zero [Zero 𝕜] [PseudoMetricSpace 𝕜]
{a : closedBall (0 : 𝕜) 1} : (a : 𝕜) = 0 ↔ a = 0 :=
Subtype.val_injective.eq_iff' unitClosedBall.coe_zero
instance Metric.unitClosedBall.instSemigroupWithZero [NonUnitalSeminormedRing 𝕜] :
SemigroupWithZero (closedBall (0 : 𝕜) 1) where
zero_mul _ := Subtype.eq <| zero_mul _
mul_zero _ := Subtype.eq <| mul_zero _
/-- Closed unit ball in a seminormed 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.instMonoid [SeminormedRing 𝕜] [NormOneClass 𝕜] :
Monoid (closedBall (0 : 𝕜) 1) :=
SubmonoidClass.toMonoid (Submonoid.unitClosedBall 𝕜)
instance Metric.unitClosedBall.instCommMonoid [SeminormedCommRing 𝕜] [NormOneClass 𝕜] :
CommMonoid (closedBall (0 : 𝕜) 1) :=
SubmonoidClass.toCommMonoid (Submonoid.unitClosedBall 𝕜)
@[simp, norm_cast]
protected theorem Metric.unitClosedBall.coe_one [SeminormedRing 𝕜] [NormOneClass 𝕜] :
((1 : closedBall (0 : 𝕜) 1) : 𝕜) = 1 :=
rfl
@[simp, norm_cast]
protected theorem Metric.unitClosedBall.coe_eq_one [SeminormedRing 𝕜] [NormOneClass 𝕜]
{a : closedBall (0 : 𝕜) 1} : (a : 𝕜) = 1 ↔ a = 1 :=
Subtype.val_injective.eq_iff' unitClosedBall.coe_one
@[simp, norm_cast]
protected theorem Metric.unitClosedBall.coe_pow [SeminormedRing 𝕜] [NormOneClass 𝕜]
(x : closedBall (0 : 𝕜) 1) (n : ℕ) : ↑(x ^ n) = (x : 𝕜) ^ n :=
rfl
instance Metric.unitClosedBall.instMonoidWithZero [SeminormedRing 𝕜] [NormOneClass 𝕜] :
MonoidWithZero (closedBall (0 : 𝕜) 1) where
instance Metric.unitClosedBall.instCancelMonoidWithZero [SeminormedRing 𝕜] [IsCancelMulZero 𝕜]
[NormOneClass 𝕜] : CancelMonoidWithZero (closedBall (0 : 𝕜) 1) where
toIsCancelMulZero := Subtype.val_injective.isCancelMulZero _ rfl fun _ _ ↦ rfl
/-!
### Algebraic instances on the unit sphere
-/
/-- Unit sphere in a seminormed ring (with strictly multiplicative norm) as a bundled
`Submonoid`. -/
@[simps]
def Submonoid.unitSphere (𝕜 : Type*) [SeminormedRing 𝕜] [NormMulClass 𝕜] [NormOneClass 𝕜] :
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.instInv [NormedDivisionRing 𝕜] : Inv (sphere (0 : 𝕜) 1) where
inv 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 Metric.unitSphere.coe_inv [NormedDivisionRing 𝕜] (x : sphere (0 : 𝕜) 1) :
↑x⁻¹ = (x⁻¹ : 𝕜) :=
rfl
instance Metric.unitSphere.instDiv [NormedDivisionRing 𝕜] : Div (sphere (0 : 𝕜) 1) where
div x y := .mk (x / y) <| mem_sphere_zero_iff_norm.2 <| by
rw [norm_div, mem_sphere_zero_iff_norm.1 x.2, mem_sphere_zero_iff_norm.1 y.coe_prop, div_one]
@[simp, norm_cast]
protected theorem Metric.unitSphere.coe_div [NormedDivisionRing 𝕜] (x y : sphere (0 : 𝕜) 1) :
↑(x / y) = (x / y : 𝕜) :=
rfl
instance Metric.unitSphere.instZPow [NormedDivisionRing 𝕜] : Pow (sphere (0 : 𝕜) 1) ℤ where
pow x n := .mk ((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 Metric.unitSphere.coe_zpow [NormedDivisionRing 𝕜] (x : sphere (0 : 𝕜) 1) (n : ℤ) :
↑(x ^ n) = (x : 𝕜) ^ n :=
rfl
instance Metric.unitSphere.instMonoid [SeminormedRing 𝕜] [NormMulClass 𝕜] [NormOneClass 𝕜] :
Monoid (sphere (0 : 𝕜) 1) :=
SubmonoidClass.toMonoid (Submonoid.unitSphere 𝕜)
instance Metric.unitSphere.instCommMonoid [SeminormedCommRing 𝕜] [NormMulClass 𝕜] [NormOneClass 𝕜] :
CommMonoid (sphere (0 : 𝕜) 1) :=
SubmonoidClass.toCommMonoid (Submonoid.unitSphere 𝕜)
@[simp, norm_cast]
protected theorem Metric.unitSphere.coe_one [SeminormedRing 𝕜] [NormMulClass 𝕜] [NormOneClass 𝕜] :
((1 : sphere (0 : 𝕜) 1) : 𝕜) = 1 :=
rfl
@[simp, norm_cast]
theorem Metric.unitSphere.coe_mul [SeminormedRing 𝕜] [NormMulClass 𝕜] [NormOneClass 𝕜]
(x y : sphere (0 : 𝕜) 1) : ↑(x * y) = (x * y : 𝕜) :=
rfl
@[simp, norm_cast]
theorem Metric.unitSphere.coe_pow [SeminormedRing 𝕜] [NormMulClass 𝕜] [NormOneClass 𝕜]
(x : sphere (0 : 𝕜) 1) (n : ℕ) : ↑(x ^ n) = (x : 𝕜) ^ n :=
rfl
/-- Monoid homomorphism from the unit sphere in a normed division ring 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.unitSphere.instGroup [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.instHasDistribNeg [SeminormedRing 𝕜] [NormMulClass 𝕜] [NormOneClass 𝕜] :
HasDistribNeg (sphere (0 : 𝕜) 1) :=
Subtype.coe_injective.hasDistribNeg ((↑) : sphere (0 : 𝕜) 1 → 𝕜) (fun _ => rfl) fun _ _ => rfl
instance Metric.sphere.instContinuousMul [SeminormedRing 𝕜] [NormMulClass 𝕜] [NormOneClass 𝕜] :
ContinuousMul (sphere (0 : 𝕜) 1) :=
(Submonoid.unitSphere 𝕜).continuousMul
instance Metric.sphere.instIsTopologicalGroup [NormedDivisionRing 𝕜] :
IsTopologicalGroup (sphere (0 : 𝕜) 1) where
continuous_inv := (continuous_subtype_val.inv₀ ne_zero_of_mem_unit_sphere).subtype_mk _
instance Metric.sphere.instCommGroup [NormedField 𝕜] : CommGroup (sphere (0 : 𝕜) 1) where |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Affine/Convex.lean | import Mathlib.Analysis.Convex.Between
import Mathlib.Analysis.Normed.Affine.AddTorsor
import Mathlib.Analysis.Normed.Affine.AddTorsorBases
import Mathlib.Analysis.Normed.Module.Convex
/-!
# Simplices in normed affine spaces
We prove the following facts:
* `exists_mem_interior_convexHull_affineBasis` : We can intercalate a simplex between a point and
one of its neighborhoods.
* `Convex.exists_subset_interior_convexHull_finset_of_isCompact`: We can intercalate a convex
polytope between a compact convex set and one of its neighborhoods.
-/
variable {E P : Type*}
open AffineBasis Module Metric Set
open scoped Convex Pointwise Topology
section SeminormedAddCommGroup
variable [SeminormedAddCommGroup E] [NormedSpace ℝ E] [PseudoMetricSpace P] [NormedAddTorsor E P]
variable {s : Set E}
theorem Wbtw.dist_add_dist {x y z : P} (h : Wbtw ℝ x y z) :
dist x y + dist y z = dist x z := by
obtain ⟨a, ⟨ha₀, ha₁⟩, rfl⟩ := h
simp [abs_of_nonneg, ha₀, ha₁, sub_mul]
theorem dist_add_dist_of_mem_segment {x y z : E} (h : y ∈ [x -[ℝ] z]) :
dist x y + dist y z = dist x z :=
(mem_segment_iff_wbtw.1 h).dist_add_dist
end SeminormedAddCommGroup
section NormedAddCommGroup
variable [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] {s t : Set E} {x : E}
/-- We can intercalate a simplex between a point and one of its neighborhoods. -/
lemma exists_mem_interior_convexHull_affineBasis (hs : s ∈ 𝓝 x) :
∃ b : AffineBasis (Fin (finrank ℝ E + 1)) ℝ E,
x ∈ interior (convexHull ℝ (range b)) ∧ convexHull ℝ (range b) ⊆ s := by
classical
-- By translating, WLOG `x` is the origin.
wlog hx : x = 0
· obtain ⟨b, hb⟩ := this (s := -x +ᵥ s) (by simpa using vadd_mem_nhds_vadd (-x) hs) rfl
use x +ᵥ b
simpa [subset_vadd_set_iff, mem_vadd_set_iff_neg_vadd_mem, convexHull_vadd, interior_vadd,
Pi.vadd_def, -vadd_eq_add, vadd_eq_add (a := -x), ← Set.vadd_set_range] using hb
subst hx
-- The strategy is now to find an arbitrary maximal spanning simplex (aka an affine basis)...
obtain ⟨b⟩ := exists_affineBasis_of_finiteDimensional
(ι := Fin (finrank ℝ E + 1)) (k := ℝ) (P := E) (by simp)
-- ... translate it to contain the origin...
set c : AffineBasis (Fin (finrank ℝ E + 1)) ℝ E := -Finset.univ.centroid ℝ b +ᵥ b
have hc₀ : 0 ∈ interior (convexHull ℝ (range c) : Set E) := by
simpa [c, convexHull_vadd, interior_vadd, range_add, Pi.vadd_def, mem_vadd_set_iff_neg_vadd_mem]
using b.centroid_mem_interior_convexHull
set cnorm := Finset.univ.sup' Finset.univ_nonempty (fun i ↦ ‖c i‖)
have hcnorm : range c ⊆ closedBall 0 (cnorm + 1) := by
simpa only [cnorm, subset_def, Finset.mem_coe, mem_closedBall, dist_zero_right,
← sub_le_iff_le_add, Finset.le_sup'_iff, forall_mem_range] using fun i ↦ ⟨i, by simp⟩
-- ... and finally scale it to fit inside the neighborhood `s`.
obtain ⟨ε, hε, hεs⟩ := Metric.mem_nhds_iff.1 hs
set ε' : ℝ := ε / 2 / (cnorm + 1)
have hc' : 0 < cnorm + 1 := by
have : 0 ≤ cnorm := Finset.le_sup'_of_le _ (Finset.mem_univ 0) (norm_nonneg _)
positivity
have hε' : 0 < ε' := by positivity
set d : AffineBasis (Fin (finrank ℝ E + 1)) ℝ E := Units.mk0 ε' hε'.ne' • c
have hε₀ : 0 < ε / 2 := by positivity
have hdnorm : (range d : Set E) ⊆ closedBall 0 (ε / 2) := by
simp [d, abs_of_nonneg hε'.le, range_subset_iff, norm_smul]
simpa [ε', hε₀.ne', range_subset_iff, ← mul_div_right_comm (ε / 2), div_le_iff₀ hc', hε₀]
using hcnorm
refine ⟨d, ?_, ?_⟩
· simpa [d, Pi.smul_def, range_smul, interior_smul₀, convexHull_smul, zero_mem_smul_set_iff,
hε'.ne']
· calc
convexHull ℝ (range d) ⊆ closedBall 0 (ε / 2) := convexHull_min hdnorm (convex_closedBall ..)
_ ⊆ ball 0 ε := closedBall_subset_ball (by linarith)
_ ⊆ s := hεs
/-- We can intercalate a convex polytope between a compact convex set and one of its neighborhoods.
-/
theorem Convex.exists_subset_interior_convexHull_finset_of_isCompact
(hs₁ : Convex ℝ s) (hs₂ : IsCompact s) (ht : t ∈ 𝓝ˢ s) :
∃ u : Finset E, s ⊆ interior (convexHull ℝ u) ∧ convexHull ℝ u ⊆ t := by
classical
rcases mem_nhdsSet_iff_exists.1 ht with ⟨U, hU₁, hU₂, hU₃⟩
rcases compact_open_separated_add_left hs₂ hU₁ hU₂ with ⟨V, hV₁, hV₂⟩
rcases exists_mem_interior_convexHull_affineBasis hV₁ with ⟨b, hb₁, hb₂⟩
rcases hs₂.elim_finite_subcover_image (b := s)
(c := fun x => interior (convexHull ℝ (Set.range b)) + {x})
(fun _ _ => isOpen_interior.add_right)
(fun x hx => Set.mem_iUnion₂_of_mem hx <| by simpa using hb₁)
with ⟨u, hu₁, hu₂, hu₃⟩
lift u to Finset E using hu₂
refine ⟨Finset.univ.image b + u, ?_, ?_⟩
all_goals rw [Finset.coe_add, Finset.coe_image, Finset.coe_univ, Set.image_univ, convexHull_add]
· grw [hu₃, ← subset_interior_add_left, Set.iUnion₂_subset_iff, ← subset_convexHull _ (u : Set E)]
intros
gcongr
simpa
· grw [hu₁, hs₁.convexHull_eq, hb₂, hV₂, hU₃]
end NormedAddCommGroup |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Affine/AddTorsor.lean | import Mathlib.Algebra.CharP.Invertible
import Mathlib.Analysis.Normed.Module.Basic
import Mathlib.Analysis.Normed.Group.AddTorsor
import Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic
import Mathlib.LinearAlgebra.AffineSpace.Midpoint
import Mathlib.Topology.Instances.RealVectorSpace
/-!
# Torsors of normed space actions.
This file contains lemmas about normed additive torsors over normed spaces.
-/
noncomputable section
open NNReal Topology
open Filter
variable {V P W Q : Type*} [SeminormedAddCommGroup V] [PseudoMetricSpace P] [NormedAddTorsor V P]
[NormedAddCommGroup W] [MetricSpace Q] [NormedAddTorsor W Q]
section NormedSpace
variable {𝕜 : Type*} [NormedField 𝕜] [NormedSpace 𝕜 V] [NormedSpace 𝕜 W]
open AffineMap
@[simp]
theorem dist_center_homothety (p₁ p₂ : P) (c : 𝕜) :
dist p₁ (homothety p₁ c p₂) = ‖c‖ * dist p₁ p₂ := by
simp [homothety_def, norm_smul, ← dist_eq_norm_vsub, dist_comm]
@[simp]
theorem nndist_center_homothety (p₁ p₂ : P) (c : 𝕜) :
nndist p₁ (homothety p₁ c p₂) = ‖c‖₊ * nndist p₁ p₂ :=
NNReal.eq <| dist_center_homothety _ _ _
@[simp]
theorem dist_homothety_center (p₁ p₂ : P) (c : 𝕜) :
dist (homothety p₁ c p₂) p₁ = ‖c‖ * dist p₁ p₂ := by rw [dist_comm, dist_center_homothety]
@[simp]
theorem nndist_homothety_center (p₁ p₂ : P) (c : 𝕜) :
nndist (homothety p₁ c p₂) p₁ = ‖c‖₊ * nndist p₁ p₂ :=
NNReal.eq <| dist_homothety_center _ _ _
@[simp]
theorem dist_lineMap_lineMap (p₁ p₂ : P) (c₁ c₂ : 𝕜) :
dist (lineMap p₁ p₂ c₁) (lineMap p₁ p₂ c₂) = dist c₁ c₂ * dist p₁ p₂ := by
rw [dist_comm p₁ p₂]
simp only [lineMap_apply, dist_eq_norm_vsub, vadd_vsub_vadd_cancel_right,
← sub_smul, norm_smul, vsub_eq_sub]
@[simp]
theorem nndist_lineMap_lineMap (p₁ p₂ : P) (c₁ c₂ : 𝕜) :
nndist (lineMap p₁ p₂ c₁) (lineMap p₁ p₂ c₂) = nndist c₁ c₂ * nndist p₁ p₂ :=
NNReal.eq <| dist_lineMap_lineMap _ _ _ _
theorem lipschitzWith_lineMap (p₁ p₂ : P) : LipschitzWith (nndist p₁ p₂) (lineMap p₁ p₂ : 𝕜 → P) :=
LipschitzWith.of_dist_le_mul fun c₁ c₂ =>
((dist_lineMap_lineMap p₁ p₂ c₁ c₂).trans (mul_comm _ _)).le
@[simp]
theorem dist_lineMap_left (p₁ p₂ : P) (c : 𝕜) : dist (lineMap p₁ p₂ c) p₁ = ‖c‖ * dist p₁ p₂ := by
simpa only [lineMap_apply_zero, dist_zero_right] using dist_lineMap_lineMap p₁ p₂ c 0
@[simp]
theorem nndist_lineMap_left (p₁ p₂ : P) (c : 𝕜) :
nndist (lineMap p₁ p₂ c) p₁ = ‖c‖₊ * nndist p₁ p₂ :=
NNReal.eq <| dist_lineMap_left _ _ _
@[simp]
theorem dist_left_lineMap (p₁ p₂ : P) (c : 𝕜) : dist p₁ (lineMap p₁ p₂ c) = ‖c‖ * dist p₁ p₂ :=
(dist_comm _ _).trans (dist_lineMap_left _ _ _)
@[simp]
theorem nndist_left_lineMap (p₁ p₂ : P) (c : 𝕜) :
nndist p₁ (lineMap p₁ p₂ c) = ‖c‖₊ * nndist p₁ p₂ :=
NNReal.eq <| dist_left_lineMap _ _ _
@[simp]
theorem dist_lineMap_right (p₁ p₂ : P) (c : 𝕜) :
dist (lineMap p₁ p₂ c) p₂ = ‖1 - c‖ * dist p₁ p₂ := by
simpa only [lineMap_apply_one, dist_eq_norm'] using dist_lineMap_lineMap p₁ p₂ c 1
@[simp]
theorem nndist_lineMap_right (p₁ p₂ : P) (c : 𝕜) :
nndist (lineMap p₁ p₂ c) p₂ = ‖1 - c‖₊ * nndist p₁ p₂ :=
NNReal.eq <| dist_lineMap_right _ _ _
@[simp]
theorem dist_right_lineMap (p₁ p₂ : P) (c : 𝕜) : dist p₂ (lineMap p₁ p₂ c) = ‖1 - c‖ * dist p₁ p₂ :=
(dist_comm _ _).trans (dist_lineMap_right _ _ _)
@[simp]
theorem nndist_right_lineMap (p₁ p₂ : P) (c : 𝕜) :
nndist p₂ (lineMap p₁ p₂ c) = ‖1 - c‖₊ * nndist p₁ p₂ :=
NNReal.eq <| dist_right_lineMap _ _ _
@[simp]
theorem dist_homothety_self (p₁ p₂ : P) (c : 𝕜) :
dist (homothety p₁ c p₂) p₂ = ‖1 - c‖ * dist p₁ p₂ := by
rw [homothety_eq_lineMap, dist_lineMap_right]
@[simp]
theorem nndist_homothety_self (p₁ p₂ : P) (c : 𝕜) :
nndist (homothety p₁ c p₂) p₂ = ‖1 - c‖₊ * nndist p₁ p₂ :=
NNReal.eq <| dist_homothety_self _ _ _
@[simp]
theorem dist_self_homothety (p₁ p₂ : P) (c : 𝕜) :
dist p₂ (homothety p₁ c p₂) = ‖1 - c‖ * dist p₁ p₂ := by rw [dist_comm, dist_homothety_self]
@[simp]
theorem nndist_self_homothety (p₁ p₂ : P) (c : 𝕜) :
nndist p₂ (homothety p₁ c p₂) = ‖1 - c‖₊ * nndist p₁ p₂ :=
NNReal.eq <| dist_self_homothety _ _ _
section invertibleTwo
variable [Invertible (2 : 𝕜)]
@[simp]
theorem dist_left_midpoint (p₁ p₂ : P) : dist p₁ (midpoint 𝕜 p₁ p₂) = ‖(2 : 𝕜)‖⁻¹ * dist p₁ p₂ := by
rw [midpoint, dist_comm, dist_lineMap_left, invOf_eq_inv, ← norm_inv]
@[simp]
theorem nndist_left_midpoint (p₁ p₂ : P) :
nndist p₁ (midpoint 𝕜 p₁ p₂) = ‖(2 : 𝕜)‖₊⁻¹ * nndist p₁ p₂ :=
NNReal.eq <| dist_left_midpoint _ _
@[simp]
theorem dist_midpoint_left (p₁ p₂ : P) : dist (midpoint 𝕜 p₁ p₂) p₁ = ‖(2 : 𝕜)‖⁻¹ * dist p₁ p₂ := by
rw [dist_comm, dist_left_midpoint]
@[simp]
theorem nndist_midpoint_left (p₁ p₂ : P) :
nndist (midpoint 𝕜 p₁ p₂) p₁ = ‖(2 : 𝕜)‖₊⁻¹ * nndist p₁ p₂ :=
NNReal.eq <| dist_midpoint_left _ _
@[simp]
theorem dist_midpoint_right (p₁ p₂ : P) :
dist (midpoint 𝕜 p₁ p₂) p₂ = ‖(2 : 𝕜)‖⁻¹ * dist p₁ p₂ := by
rw [midpoint_comm, dist_midpoint_left, dist_comm]
@[simp]
theorem nndist_midpoint_right (p₁ p₂ : P) :
nndist (midpoint 𝕜 p₁ p₂) p₂ = ‖(2 : 𝕜)‖₊⁻¹ * nndist p₁ p₂ :=
NNReal.eq <| dist_midpoint_right _ _
@[simp]
theorem dist_right_midpoint (p₁ p₂ : P) :
dist p₂ (midpoint 𝕜 p₁ p₂) = ‖(2 : 𝕜)‖⁻¹ * dist p₁ p₂ := by
rw [dist_comm, dist_midpoint_right]
@[simp]
theorem nndist_right_midpoint (p₁ p₂ : P) :
nndist p₂ (midpoint 𝕜 p₁ p₂) = ‖(2 : 𝕜)‖₊⁻¹ * nndist p₁ p₂ :=
NNReal.eq <| dist_right_midpoint _ _
/-- The midpoint of the segment AB is the same distance from A as it is from B. -/
theorem dist_left_midpoint_eq_dist_right_midpoint (p₁ p₂ : P) :
dist p₁ (midpoint 𝕜 p₁ p₂) = dist p₂ (midpoint 𝕜 p₁ p₂) := by
rw [dist_left_midpoint p₁ p₂, dist_right_midpoint p₁ p₂]
theorem dist_midpoint_midpoint_le' (p₁ p₂ p₃ p₄ : P) :
dist (midpoint 𝕜 p₁ p₂) (midpoint 𝕜 p₃ p₄) ≤ (dist p₁ p₃ + dist p₂ p₄) / ‖(2 : 𝕜)‖ := by
rw [dist_eq_norm_vsub V, dist_eq_norm_vsub V, dist_eq_norm_vsub V, midpoint_vsub_midpoint]
rw [midpoint_eq_smul_add, norm_smul, invOf_eq_inv, norm_inv, ← div_eq_inv_mul]
grw [norm_add_le]
theorem nndist_midpoint_midpoint_le' (p₁ p₂ p₃ p₄ : P) :
nndist (midpoint 𝕜 p₁ p₂) (midpoint 𝕜 p₃ p₄) ≤ (nndist p₁ p₃ + nndist p₂ p₄) / ‖(2 : 𝕜)‖₊ :=
dist_midpoint_midpoint_le' _ _ _ _
end invertibleTwo
@[simp] theorem dist_pointReflection_left (p q : P) :
dist (Equiv.pointReflection p q) p = dist p q := by
simp [dist_eq_norm_vsub V, Equiv.pointReflection_vsub_left (G := V)]
@[simp] theorem dist_left_pointReflection (p q : P) :
dist p (Equiv.pointReflection p q) = dist p q :=
(dist_comm _ _).trans (dist_pointReflection_left _ _)
variable (𝕜) in
theorem dist_pointReflection_right (p q : P) :
dist (Equiv.pointReflection p q) q = ‖(2 : 𝕜)‖ * dist p q := by
simp [dist_eq_norm_vsub V, Equiv.pointReflection_vsub_right (G := V), ← Nat.cast_smul_eq_nsmul 𝕜,
norm_smul]
variable (𝕜) in
theorem dist_right_pointReflection (p q : P) :
dist q (Equiv.pointReflection p q) = ‖(2 : 𝕜)‖ * dist p q :=
(dist_comm _ _).trans (dist_pointReflection_right 𝕜 _ _)
theorem antilipschitzWith_lineMap {p₁ p₂ : Q} (h : p₁ ≠ p₂) :
AntilipschitzWith (nndist p₁ p₂)⁻¹ (lineMap p₁ p₂ : 𝕜 → Q) :=
AntilipschitzWith.of_le_mul_dist fun c₁ c₂ => by
rw [dist_lineMap_lineMap, NNReal.coe_inv, ← dist_nndist, mul_left_comm,
inv_mul_cancel₀ (dist_ne_zero.2 h), mul_one]
end NormedSpace
variable [NormedSpace ℝ V] [NormedSpace ℝ W]
theorem dist_midpoint_midpoint_le (p₁ p₂ p₃ p₄ : V) :
dist (midpoint ℝ p₁ p₂) (midpoint ℝ p₃ p₄) ≤ (dist p₁ p₃ + dist p₂ p₄) / 2 := by
simpa using dist_midpoint_midpoint_le' (𝕜 := ℝ) p₁ p₂ p₃ p₄
theorem nndist_midpoint_midpoint_le (p₁ p₂ p₃ p₄ : V) :
nndist (midpoint ℝ p₁ p₂) (midpoint ℝ p₃ p₄) ≤ (nndist p₁ p₃ + nndist p₂ p₄) / 2 :=
dist_midpoint_midpoint_le _ _ _ _
/-- A continuous map between two normed affine spaces is an affine map provided that
it sends midpoints to midpoints. -/
def AffineMap.ofMapMidpoint (f : P → Q) (h : ∀ x y, f (midpoint ℝ x y) = midpoint ℝ (f x) (f y))
(hfc : Continuous f) : P →ᵃ[ℝ] Q :=
let c := Classical.arbitrary P
AffineMap.mk' f (↑((AddMonoidHom.ofMapMidpoint ℝ ℝ
((AffineEquiv.vaddConst ℝ (f <| c)).symm ∘ f ∘ AffineEquiv.vaddConst ℝ c) (by simp)
fun x y => by simp [h]).toRealLinearMap <| by
apply_rules [Continuous.vadd, Continuous.vsub, continuous_const, hfc.comp, continuous_id]))
c fun p => by simp
end
section
open Dilation
variable {𝕜 E : Type*} [NormedDivisionRing 𝕜] [SeminormedAddCommGroup E]
variable [Module 𝕜 E] [NormSMulClass 𝕜 E] {P : Type*} [PseudoMetricSpace P] [NormedAddTorsor E P]
-- TODO: reimplement this as a `ContinuousAffineEquiv`.
/-- Scaling by an element `k` of the scalar ring as a `DilationEquiv` with ratio `‖k‖₊`, mapping
from a normed space to a normed torsor over that space sending `0` to `c`. -/
@[simps]
def DilationEquiv.smulTorsor (c : P) {k : 𝕜} (hk : k ≠ 0) : E ≃ᵈ P where
toFun := (k • · +ᵥ c)
invFun := k⁻¹ • (· -ᵥ c)
left_inv x := by simp [inv_smul_smul₀ hk]
right_inv p := by simp [smul_inv_smul₀ hk]
edist_eq' := ⟨‖k‖₊, nnnorm_ne_zero_iff.mpr hk, fun x y ↦ by
rw [show edist (k • x +ᵥ c) (k • y +ᵥ c) = _ from (IsometryEquiv.vaddConst c).isometry ..]
exact edist_smul₀ ..⟩
-- Cannot be @[simp] because `x` and `y` cannot be inferred by `simp`.
lemma DilationEquiv.smulTorsor_ratio {c : P} {k : 𝕜} (hk : k ≠ 0) {x y : E}
(h : dist x y ≠ 0) : ratio (smulTorsor c hk) = ‖k‖₊ :=
Eq.symm <| ratio_unique_of_dist_ne_zero h <| by simp [dist_eq_norm, ← smul_sub, norm_smul]
@[simp]
lemma DilationEquiv.smulTorsor_preimage_ball {c : P} {k : 𝕜} (hk : k ≠ 0) :
smulTorsor c hk ⁻¹' (Metric.ball c ‖k‖) = Metric.ball (0 : E) 1 := by
aesop (add simp norm_smul)
end |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Affine/Simplex.lean | import Mathlib.Analysis.Normed.Group.AddTorsor
import Mathlib.LinearAlgebra.AffineSpace.Simplex.Basic
/-!
# Simplices in torsors over normed spaces.
This file defines properties of simplices in a `NormedAddTorsor`.
## Main definitions
* `Affine.Simplex.Scalene`
* `Affine.Simplex.Equilateral`
* `Affine.Simplex.Regular`
-/
namespace Affine
open Function
variable {R V P : Type*} [Ring R] [SeminormedAddCommGroup V] [PseudoMetricSpace P] [Module R V]
variable [NormedAddTorsor V P]
namespace Simplex
variable {m n : ℕ}
/-- A simplex is scalene if all the edge lengths are different. -/
def Scalene (s : Simplex R P n) : Prop :=
Injective fun i : {x : Fin (n + 1) × Fin (n + 1) // x.1 < x.2} ↦
dist (s.points i.val.1) (s.points i.val.2)
lemma Scalene.dist_ne {s : Simplex R P n} (hs : s.Scalene) {i₁ i₂ i₃ i₄ : Fin (n + 1)}
(h₁₂ : i₁ ≠ i₂) (h₃₄ : i₃ ≠ i₄) (h₁₂₃₄ : ¬(i₁ = i₃ ∧ i₂ = i₄)) (h₁₂₄₃ : ¬(i₁ = i₄ ∧ i₂ = i₃)) :
dist (s.points i₁) (s.points i₂) ≠ dist (s.points i₃) (s.points i₄) := by
rw [Classical.not_and_iff_not_or_not] at h₁₂₃₄ h₁₂₄₃
rcases h₁₂.lt_or_gt with h₁₂lt | h₂₁lt <;> rcases h₃₄.lt_or_gt with h₃₄lt | h₄₃lt
· apply hs.ne (a₁ := ⟨(i₁, i₂), h₁₂lt⟩) (a₂ := ⟨(i₃, i₄), h₃₄lt⟩)
cases h₁₂₃₄ <;> simp [*]
· nth_rw 2 [dist_comm]
apply hs.ne (a₁ := ⟨(i₁, i₂), h₁₂lt⟩) (a₂ := ⟨(i₄, i₃), h₄₃lt⟩)
cases h₁₂₄₃ <;> simp [*]
· rw [dist_comm]
apply hs.ne (a₁ := ⟨(i₂, i₁), h₂₁lt⟩) (a₂ := ⟨(i₃, i₄), h₃₄lt⟩)
cases h₁₂₄₃ <;> simp [*]
· rw [dist_comm]
nth_rw 2 [dist_comm]
apply hs.ne (a₁ := ⟨(i₂, i₁), h₂₁lt⟩) (a₂ := ⟨(i₄, i₃), h₄₃lt⟩)
cases h₁₂₃₄ <;> simp [*]
@[simp] lemma scalene_reindex_iff {s : Simplex R P m} (e : Fin (m + 1) ≃ Fin (n + 1)) :
(s.reindex e).Scalene ↔ s.Scalene := by
let f : {x : Fin (m + 1) × Fin (m + 1) // x.1 < x.2} ≃
{y : Fin (n + 1) × Fin (n + 1) // y.1 < y.2} :=
⟨fun x ↦ if h : e x.val.1 < e x.val.2 then ⟨(e x.val.1, e x.val.2), h⟩ else
⟨(e x.val.2, e x.val.1), Ne.lt_of_le (e.injective.ne x.property.ne') (not_lt.1 h)⟩,
fun y ↦ if h : e.symm y.val.1 < e.symm y.val.2 then ⟨(e.symm y.val.1, e.symm y.val.2), h⟩ else
⟨(e.symm y.val.2, e.symm y.val.1),
Ne.lt_of_le (e.symm.injective.ne y.property.ne') (not_lt.1 h)⟩,
by
simp only [LeftInverse, Subtype.forall, Prod.forall]
intro i j h
split_ifs with h₁ h₂ h₃
· simp
· simp [h] at h₂
· simp [h, lt_asymm] at h₃
· simp,
by
simp only [RightInverse, LeftInverse, Subtype.forall, Prod.forall]
intro i j h
split_ifs with h₁ h₂ h₃
· simp
· simp [h] at h₂
· simp [h, lt_asymm] at h₃
· simp⟩
simp_rw [Scalene]
convert (Injective.of_comp_iff' _ (Equiv.bijective f)).symm
simp only [reindex_points, comp_apply, Equiv.coe_fn_mk, f]
split_ifs with h
· simp
· simp [dist_comm]
/-- A simplex is equilateral if all the edge lengths are equal. -/
def Equilateral (s : Simplex R P n) : Prop :=
∃ r : ℝ, ∀ i j, i ≠ j → dist (s.points i) (s.points j) = r
lemma Equilateral.dist_eq {s : Simplex R P n} (he : s.Equilateral) {i₁ i₂ i₃ i₄ : Fin (n + 1)}
(h₁₂ : i₁ ≠ i₂) (h₃₄ : i₃ ≠ i₄) :
dist (s.points i₁) (s.points i₂) = dist (s.points i₃) (s.points i₄) := by
rcases he with ⟨r, hr⟩
rw [hr _ _ h₁₂, hr _ _ h₃₄]
@[simp] lemma equilateral_reindex_iff {s : Simplex R P m} (e : Fin (m + 1) ≃ Fin (n + 1)) :
(s.reindex e).Equilateral ↔ s.Equilateral := by
refine ⟨fun ⟨r, hr⟩ ↦ ⟨r, fun i j hij ↦ ?_⟩, fun ⟨r, hr⟩ ↦ ⟨r, fun i j hij ↦ ?_⟩⟩
· convert hr (e i) (e j) (e.injective.ne hij) using 2 <;> simp
· convert hr (e.symm i) (e.symm j) (e.symm.injective.ne hij) using 2
/-- A simplex is regular if it is equivalent under an isometry to any reindexing. -/
def Regular (s : Simplex R P n) : Prop :=
∀ σ : Equiv.Perm (Fin (n + 1)), ∃ x : P ≃ᵢ P, s.points ∘ σ = x ∘ s.points
@[simp] lemma regular_reindex_iff {s : Simplex R P m} (e : Fin (m + 1) ≃ Fin (n + 1)) :
(s.reindex e).Regular ↔ s.Regular := by
refine ⟨fun h σ ↦ ?_, fun h σ ↦ ?_⟩
· rcases h ((e.symm.trans σ).trans e) with ⟨x, hx⟩
refine ⟨x, ?_⟩
ext i
simpa using congrFun hx (e i)
· rcases h ((e.trans σ).trans e.symm) with ⟨x, hx⟩
refine ⟨x, ?_⟩
ext i
simpa using congrFun hx (e.symm i)
lemma Regular.equilateral {s : Simplex R P n} (hr : s.Regular) : s.Equilateral := by
refine ⟨dist (s.points 0) (s.points 1), fun i j hij ↦ ?_⟩
have hn : n ≠ 0 := by omega
by_cases hi : i = 1
· rw [hi, dist_comm]
rcases hr (Equiv.swap 0 j) with ⟨x, hx⟩
nth_rw 2 [← x.dist_eq]
simp_rw [← Function.comp_apply (f := x), ← hx]
simp only [comp_apply, Equiv.swap_apply_left]
convert rfl
rw [Equiv.swap_apply_of_ne_of_ne (by simp [hn]) (by cutsat)]
· rcases hr ((Equiv.swap 0 i).trans (Equiv.swap 1 j)) with ⟨x, hx⟩
nth_rw 2 [← x.dist_eq]
simp_rw [← Function.comp_apply (f := x), ← hx]
simp only [Equiv.coe_trans, comp_apply, Equiv.swap_apply_left]
convert rfl
· exact Equiv.swap_apply_of_ne_of_ne hi hij
· rw [Equiv.swap_apply_of_ne_of_ne (by simp [hn]) (Ne.symm hi)]
simp
end Simplex
namespace Triangle
lemma scalene_iff_dist_ne_and_dist_ne_and_dist_ne {t : Triangle R P} :
t.Scalene ↔ dist (t.points 0) (t.points 1) ≠ dist (t.points 0) (t.points 2) ∧
dist (t.points 0) (t.points 1) ≠ dist (t.points 1) (t.points 2) ∧
dist (t.points 0) (t.points 2) ≠ dist (t.points 1) (t.points 2) := by
refine ⟨fun h ↦
⟨h.dist_ne (by decide : (0 : Fin 3) ≠ 1) (by decide : (0 : Fin 3) ≠ 2) (by decide) (by decide),
h.dist_ne (by decide : (0 : Fin 3) ≠ 1) (by decide : (1 : Fin 3) ≠ 2) (by decide) (by decide),
h.dist_ne (by decide : (0 : Fin 3) ≠ 2) (by decide : (1 : Fin 3) ≠ 2) (by decide) (by decide)⟩,
fun ⟨h₁, h₂, h₃⟩ ↦ ?_⟩
intro ⟨⟨x₁, x₂⟩, hx⟩ ⟨⟨y₁, y₂⟩, hy⟩ hxy
simp only at hx hy hxy
simp only [Subtype.mk.injEq, Prod.mk.injEq]
fin_cases x₁ <;> fin_cases x₂ <;> simp +decide only at hx <;>
fin_cases y₁ <;> fin_cases y₂ <;> simp +decide only at hy <;>
simp [h₁, h₂, h₃, h₁.symm, h₂.symm, h₃.symm] at hxy ⊢
lemma equilateral_iff_dist_eq_and_dist_eq {t : Triangle R P} {i₁ i₂ i₃ : Fin 3} (h₁₂ : i₁ ≠ i₂)
(h₁₃ : i₁ ≠ i₃) (h₂₃ : i₂ ≠ i₃) :
t.Equilateral ↔ dist (t.points i₁) (t.points i₂) = dist (t.points i₁) (t.points i₃) ∧
dist (t.points i₁) (t.points i₂) = dist (t.points i₂) (t.points i₃) := by
refine ⟨fun ⟨r, hr⟩ ↦ ?_, fun h ↦ ?_⟩
· simp [hr _ _ h₁₂, hr _ _ h₁₃, hr _ _ h₂₃]
· refine ⟨dist (t.points i₁) (t.points i₂), ?_⟩
intro i j hij
have hi : (i = i₁ ∧ j = i₂) ∨ (i = i₂ ∧ j = i₁) ∨ (i = i₁ ∧ j = i₃) ∨
(i = i₃ ∧ j = i₁) ∨ (i = i₂ ∧ j = i₃) ∨ (i = i₃ ∧ j = i₂) := by
clear h
decide +revert
rcases h with ⟨h₁, h₂⟩
rcases hi with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩| ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩
· rfl
· exact dist_comm _ _
· exact h₁.symm
· rw [h₁, dist_comm]
· rw [h₂, dist_comm]
· rw [h₂, dist_comm]
lemma equilateral_iff_dist_01_eq_02_and_dist_01_eq_12 {t : Triangle R P} :
t.Equilateral ↔ dist (t.points 0) (t.points 1) = dist (t.points 0) (t.points 2) ∧
dist (t.points 0) (t.points 1) = dist (t.points 1) (t.points 2) :=
equilateral_iff_dist_eq_and_dist_eq (by decide) (by decide) (by decide)
end Triangle
end Affine |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Affine/Isometry.lean | import Mathlib.Algebra.CharP.Invertible
import Mathlib.Analysis.Normed.Operator.LinearIsometry
import Mathlib.Analysis.Normed.Group.AddTorsor
import Mathlib.Analysis.Normed.Module.Basic
import Mathlib.LinearAlgebra.AffineSpace.Midpoint
import Mathlib.LinearAlgebra.AffineSpace.Restrict
import Mathlib.Tactic.FailIfNoProgress
/-!
# Affine isometries
In this file we define `AffineIsometry 𝕜 P P₂` to be an affine isometric embedding of normed
add-torsors `P` into `P₂` over normed `𝕜`-spaces and `AffineIsometryEquiv` to be an affine
isometric equivalence between `P` and `P₂`.
We also prove basic lemmas and provide convenience constructors. The choice of these lemmas and
constructors is closely modelled on those for the `LinearIsometry` and `AffineMap` theories.
Since many elementary properties don't require `‖x‖ = 0 → x = 0` we initially set up the theory for
`SeminormedAddCommGroup` and specialize to `NormedAddCommGroup` only when needed.
## Notation
We introduce the notation `P →ᵃⁱ[𝕜] P₂` for `AffineIsometry 𝕜 P P₂`, and `P ≃ᵃⁱ[𝕜] P₂` for
`AffineIsometryEquiv 𝕜 P P₂`. In contrast with the notation `→ₗᵢ` for linear isometries, `≃ᵢ`
for isometric equivalences, etc., the "i" here is a superscript. This is for aesthetic reasons to
match the superscript "a" (note that in mathlib `→ᵃ` is an affine map, since `→ₐ` has been taken by
algebra-homomorphisms.)
-/
open Function Set
variable (𝕜 : Type*) {V V₁ V₁' V₂ V₃ V₄ : Type*} {P₁ P₁' : Type*} (P P₂ : Type*) {P₃ P₄ : Type*}
[NormedField 𝕜]
[SeminormedAddCommGroup V] [NormedSpace 𝕜 V] [PseudoMetricSpace P] [NormedAddTorsor V P]
[SeminormedAddCommGroup V₁] [NormedSpace 𝕜 V₁] [PseudoMetricSpace P₁] [NormedAddTorsor V₁ P₁]
[SeminormedAddCommGroup V₁'] [NormedSpace 𝕜 V₁'] [MetricSpace P₁'] [NormedAddTorsor V₁' P₁']
[SeminormedAddCommGroup V₂] [NormedSpace 𝕜 V₂] [PseudoMetricSpace P₂] [NormedAddTorsor V₂ P₂]
[SeminormedAddCommGroup V₃] [NormedSpace 𝕜 V₃] [PseudoMetricSpace P₃] [NormedAddTorsor V₃ P₃]
[SeminormedAddCommGroup V₄] [NormedSpace 𝕜 V₄] [PseudoMetricSpace P₄] [NormedAddTorsor V₄ P₄]
/-- A `𝕜`-affine isometric embedding of one normed add-torsor over a normed `𝕜`-space into
another, denoted as `f : P →ᵃⁱ[𝕜] P₂`. -/
structure AffineIsometry extends P →ᵃ[𝕜] P₂ where
norm_map : ∀ x : V, ‖linear x‖ = ‖x‖
variable {𝕜 P P₂}
@[inherit_doc]
notation:25 -- `→ᵃᵢ` would be more consistent with the linear isometry notation, but it is uglier
P " →ᵃⁱ[" 𝕜:25 "] " P₂:0 => AffineIsometry 𝕜 P P₂
namespace AffineIsometry
variable (f : P →ᵃⁱ[𝕜] P₂)
/-- The underlying linear map of an affine isometry is in fact a linear isometry. -/
protected def linearIsometry : V →ₗᵢ[𝕜] V₂ :=
{ f.linear with norm_map' := f.norm_map }
@[simp]
theorem linear_eq_linearIsometry : f.linear = f.linearIsometry.toLinearMap := by
ext
rfl
instance : FunLike (P →ᵃⁱ[𝕜] P₂) P P₂ where
coe f := f.toFun
coe_injective' f g := by cases f; cases g; simp
@[simp]
theorem coe_toAffineMap : ⇑f.toAffineMap = f := by
rfl
theorem toAffineMap_injective : Injective (toAffineMap : (P →ᵃⁱ[𝕜] P₂) → P →ᵃ[𝕜] P₂) := by
rintro ⟨f, _⟩ ⟨g, _⟩ rfl
rfl
theorem coeFn_injective : @Injective (P →ᵃⁱ[𝕜] P₂) (P → P₂) (↑) :=
AffineMap.coeFn_injective.comp toAffineMap_injective
@[ext]
theorem ext {f g : P →ᵃⁱ[𝕜] P₂} (h : ∀ x, f x = g x) : f = g :=
coeFn_injective <| funext h
end AffineIsometry
namespace LinearIsometry
variable (f : V →ₗᵢ[𝕜] V₂)
/-- Reinterpret a linear isometry as an affine isometry. -/
def toAffineIsometry : V →ᵃⁱ[𝕜] V₂ :=
{ f.toLinearMap.toAffineMap with norm_map := f.norm_map }
@[simp]
theorem coe_toAffineIsometry : ⇑(f.toAffineIsometry : V →ᵃⁱ[𝕜] V₂) = f :=
rfl
@[simp]
theorem toAffineIsometry_linearIsometry : f.toAffineIsometry.linearIsometry = f := by
ext
rfl
-- somewhat arbitrary choice of simp direction
@[simp]
theorem toAffineIsometry_toAffineMap : f.toAffineIsometry.toAffineMap = f.toLinearMap.toAffineMap :=
rfl
end LinearIsometry
namespace AffineIsometry
variable (f : P →ᵃⁱ[𝕜] P₂) (f₁ : P₁' →ᵃⁱ[𝕜] P₂)
@[simp]
theorem map_vadd (p : P) (v : V) : f (v +ᵥ p) = f.linearIsometry v +ᵥ f p :=
f.toAffineMap.map_vadd p v
@[simp]
theorem map_vsub (p1 p2 : P) : f.linearIsometry (p1 -ᵥ p2) = f p1 -ᵥ f p2 :=
f.toAffineMap.linearMap_vsub p1 p2
@[simp]
theorem dist_map (x y : P) : dist (f x) (f y) = dist x y := by
rw [dist_eq_norm_vsub V₂, dist_eq_norm_vsub V, ← map_vsub, f.linearIsometry.norm_map]
@[simp]
theorem nndist_map (x y : P) : nndist (f x) (f y) = nndist x y := by simp [nndist_dist]
@[simp]
theorem edist_map (x y : P) : edist (f x) (f y) = edist x y := by simp [edist_dist]
protected theorem isometry : Isometry f :=
f.edist_map
protected theorem injective : Injective f₁ :=
f₁.isometry.injective
@[simp]
theorem map_eq_iff {x y : P₁'} : f₁ x = f₁ y ↔ x = y :=
f₁.injective.eq_iff
theorem map_ne {x y : P₁'} (h : x ≠ y) : f₁ x ≠ f₁ y :=
f₁.injective.ne h
protected theorem lipschitz : LipschitzWith 1 f :=
f.isometry.lipschitz
protected theorem antilipschitz : AntilipschitzWith 1 f :=
f.isometry.antilipschitz
@[continuity]
protected theorem continuous : Continuous f :=
f.isometry.continuous
theorem ediam_image (s : Set P) : EMetric.diam (f '' s) = EMetric.diam s :=
f.isometry.ediam_image s
theorem ediam_range : EMetric.diam (range f) = EMetric.diam (univ : Set P) :=
f.isometry.ediam_range
theorem diam_image (s : Set P) : Metric.diam (f '' s) = Metric.diam s :=
f.isometry.diam_image s
theorem diam_range : Metric.diam (range f) = Metric.diam (univ : Set P) :=
f.isometry.diam_range
@[simp]
theorem comp_continuous_iff {α : Type*} [TopologicalSpace α] {g : α → P} :
Continuous (f ∘ g) ↔ Continuous g :=
f.isometry.comp_continuous_iff
/-- The identity affine isometry. -/
def id : P →ᵃⁱ[𝕜] P :=
⟨AffineMap.id 𝕜 P, fun _ => rfl⟩
@[simp, norm_cast]
theorem coe_id : ⇑(id : P →ᵃⁱ[𝕜] P) = _root_.id :=
rfl
@[simp]
theorem id_apply (x : P) : (AffineIsometry.id : P →ᵃⁱ[𝕜] P) x = x :=
rfl
@[simp]
theorem id_toAffineMap : (id.toAffineMap : P →ᵃ[𝕜] P) = AffineMap.id 𝕜 P :=
rfl
instance : Inhabited (P →ᵃⁱ[𝕜] P) :=
⟨id⟩
/-- Composition of affine isometries. -/
def comp (g : P₂ →ᵃⁱ[𝕜] P₃) (f : P →ᵃⁱ[𝕜] P₂) : P →ᵃⁱ[𝕜] P₃ :=
⟨g.toAffineMap.comp f.toAffineMap, fun _ => (g.norm_map _).trans (f.norm_map _)⟩
@[simp]
theorem coe_comp (g : P₂ →ᵃⁱ[𝕜] P₃) (f : P →ᵃⁱ[𝕜] P₂) : ⇑(g.comp f) = g ∘ f :=
rfl
@[simp]
theorem id_comp : (id : P₂ →ᵃⁱ[𝕜] P₂).comp f = f :=
ext fun _ => rfl
@[simp]
theorem comp_id : f.comp id = f :=
ext fun _ => rfl
theorem comp_assoc (f : P₃ →ᵃⁱ[𝕜] P₄) (g : P₂ →ᵃⁱ[𝕜] P₃) (h : P →ᵃⁱ[𝕜] P₂) :
(f.comp g).comp h = f.comp (g.comp h) :=
rfl
instance : Monoid (P →ᵃⁱ[𝕜] P) where
one := id
mul := comp
mul_assoc := comp_assoc
one_mul := id_comp
mul_one := comp_id
@[simp]
theorem coe_one : ⇑(1 : P →ᵃⁱ[𝕜] P) = _root_.id :=
rfl
@[simp]
theorem coe_mul (f g : P →ᵃⁱ[𝕜] P) : ⇑(f * g) = f ∘ g :=
rfl
end AffineIsometry
namespace AffineSubspace
/-- `AffineSubspace.subtype` as an `AffineIsometry`. -/
def subtypeₐᵢ (s : AffineSubspace 𝕜 P) [Nonempty s] : s →ᵃⁱ[𝕜] P :=
{ s.subtype with norm_map := s.direction.subtypeₗᵢ.norm_map }
theorem subtypeₐᵢ_linear (s : AffineSubspace 𝕜 P) [Nonempty s] :
s.subtypeₐᵢ.linear = s.direction.subtype :=
rfl
@[simp]
theorem subtypeₐᵢ_linearIsometry (s : AffineSubspace 𝕜 P) [Nonempty s] :
s.subtypeₐᵢ.linearIsometry = s.direction.subtypeₗᵢ :=
rfl
@[simp]
theorem coe_subtypeₐᵢ (s : AffineSubspace 𝕜 P) [Nonempty s] : ⇑s.subtypeₐᵢ = s.subtype :=
rfl
@[simp]
theorem subtypeₐᵢ_toAffineMap (s : AffineSubspace 𝕜 P) [Nonempty s] :
s.subtypeₐᵢ.toAffineMap = s.subtype :=
rfl
end AffineSubspace
variable (𝕜 P P₂)
/-- An affine isometric equivalence between two normed vector spaces,
denoted `f : P ≃ᵃⁱ[𝕜] P₂`. -/
structure AffineIsometryEquiv extends P ≃ᵃ[𝕜] P₂ where
norm_map : ∀ x, ‖linear x‖ = ‖x‖
variable {𝕜 P P₂}
-- `≃ᵃᵢ` would be more consistent with the linear isometry equiv notation, but it is uglier
@[inherit_doc] notation:25 P " ≃ᵃⁱ[" 𝕜:25 "] " P₂:0 => AffineIsometryEquiv 𝕜 P P₂
namespace AffineIsometryEquiv
variable (e : P ≃ᵃⁱ[𝕜] P₂)
/-- The underlying linear equiv of an affine isometry equiv is in fact a linear isometry equiv. -/
protected def linearIsometryEquiv : V ≃ₗᵢ[𝕜] V₂ :=
{ e.linear with norm_map' := e.norm_map }
@[simp]
theorem linear_eq_linear_isometry : e.linear = e.linearIsometryEquiv.toLinearEquiv := by
ext
rfl
instance : EquivLike (P ≃ᵃⁱ[𝕜] P₂) P P₂ where
coe f := f.toFun
inv f := f.invFun
left_inv f := f.left_inv
right_inv f := f.right_inv
coe_injective' f g h _ := by
cases f
cases g
congr
simpa [DFunLike.coe_injective.eq_iff] using h
@[simp]
theorem coe_mk (e : P ≃ᵃ[𝕜] P₂) (he : ∀ x, ‖e.linear x‖ = ‖x‖) : ⇑(mk e he) = e :=
rfl
@[simp]
theorem coe_toAffineEquiv (e : P ≃ᵃⁱ[𝕜] P₂) : ⇑e.toAffineEquiv = e :=
rfl
theorem toAffineEquiv_injective : Injective (toAffineEquiv : (P ≃ᵃⁱ[𝕜] P₂) → P ≃ᵃ[𝕜] P₂)
| ⟨_, _⟩, ⟨_, _⟩, rfl => rfl
@[ext]
theorem ext {e e' : P ≃ᵃⁱ[𝕜] P₂} (h : ∀ x, e x = e' x) : e = e' :=
toAffineEquiv_injective <| AffineEquiv.ext h
/-- Reinterpret an `AffineIsometryEquiv` as an `AffineIsometry`. -/
def toAffineIsometry : P →ᵃⁱ[𝕜] P₂ :=
⟨e.1.toAffineMap, e.2⟩
@[simp]
theorem coe_toAffineIsometry : ⇑e.toAffineIsometry = e :=
rfl
/-- Construct an affine isometry equivalence by verifying the relation between the map and its
linear part at one base point. Namely, this function takes a map `e : P₁ → P₂`, a linear isometry
equivalence `e' : V₁ ≃ᵢₗ[k] V₂`, and a point `p` such that for any other point `p'` we have
`e p' = e' (p' -ᵥ p) +ᵥ e p`. -/
def mk' (e : P₁ → P₂) (e' : V₁ ≃ₗᵢ[𝕜] V₂) (p : P₁) (h : ∀ p' : P₁, e p' = e' (p' -ᵥ p) +ᵥ e p) :
P₁ ≃ᵃⁱ[𝕜] P₂ :=
{ AffineEquiv.mk' e e'.toLinearEquiv p h with norm_map := e'.norm_map }
@[simp]
theorem coe_mk' (e : P₁ → P₂) (e' : V₁ ≃ₗᵢ[𝕜] V₂) (p h) : ⇑(mk' e e' p h) = e :=
rfl
@[simp]
theorem linearIsometryEquiv_mk' (e : P₁ → P₂) (e' : V₁ ≃ₗᵢ[𝕜] V₂) (p h) :
(mk' e e' p h).linearIsometryEquiv = e' := by
ext
rfl
end AffineIsometryEquiv
namespace LinearIsometryEquiv
variable (e : V ≃ₗᵢ[𝕜] V₂)
/-- Reinterpret a linear isometry equiv as an affine isometry equiv. -/
def toAffineIsometryEquiv : V ≃ᵃⁱ[𝕜] V₂ :=
{ e.toLinearEquiv.toAffineEquiv with norm_map := e.norm_map }
@[simp]
theorem coe_toAffineIsometryEquiv : ⇑(e.toAffineIsometryEquiv : V ≃ᵃⁱ[𝕜] V₂) = e := by
rfl
@[simp]
theorem toAffineIsometryEquiv_linearIsometryEquiv :
e.toAffineIsometryEquiv.linearIsometryEquiv = e := by
ext
rfl
-- somewhat arbitrary choice of simp direction
@[simp]
theorem toAffineIsometryEquiv_toAffineEquiv :
e.toAffineIsometryEquiv.toAffineEquiv = e.toLinearEquiv.toAffineEquiv :=
rfl
-- somewhat arbitrary choice of simp direction
@[simp]
theorem toAffineIsometryEquiv_toAffineIsometry :
e.toAffineIsometryEquiv.toAffineIsometry = e.toLinearIsometry.toAffineIsometry :=
rfl
end LinearIsometryEquiv
namespace AffineIsometryEquiv
variable (e : P ≃ᵃⁱ[𝕜] P₂)
protected theorem isometry : Isometry e :=
e.toAffineIsometry.isometry
/-- Reinterpret an `AffineIsometryEquiv` as an `IsometryEquiv`. -/
def toIsometryEquiv : P ≃ᵢ P₂ :=
⟨e.toAffineEquiv.toEquiv, e.isometry⟩
@[simp]
theorem coe_toIsometryEquiv : ⇑e.toIsometryEquiv = e :=
rfl
theorem range_eq_univ (e : P ≃ᵃⁱ[𝕜] P₂) : Set.range e = Set.univ := by
rw [← coe_toIsometryEquiv]
exact IsometryEquiv.range_eq_univ _
/-- Reinterpret an `AffineIsometryEquiv` as a `Homeomorph`. -/
def toHomeomorph : P ≃ₜ P₂ :=
e.toIsometryEquiv.toHomeomorph
@[simp]
theorem coe_toHomeomorph : ⇑e.toHomeomorph = e :=
rfl
protected theorem continuous : Continuous e :=
e.isometry.continuous
protected theorem continuousAt {x} : ContinuousAt e x :=
e.continuous.continuousAt
protected theorem continuousOn {s} : ContinuousOn e s :=
e.continuous.continuousOn
protected theorem continuousWithinAt {s x} : ContinuousWithinAt e s x :=
e.continuous.continuousWithinAt
variable (𝕜 P)
/-- Identity map as an `AffineIsometryEquiv`. -/
def refl : P ≃ᵃⁱ[𝕜] P :=
⟨AffineEquiv.refl 𝕜 P, fun _ => rfl⟩
variable {𝕜 P}
instance : Inhabited (P ≃ᵃⁱ[𝕜] P) :=
⟨refl 𝕜 P⟩
@[simp]
theorem coe_refl : ⇑(refl 𝕜 P) = id :=
rfl
@[simp]
theorem toAffineEquiv_refl : (refl 𝕜 P).toAffineEquiv = AffineEquiv.refl 𝕜 P :=
rfl
@[simp]
theorem toIsometryEquiv_refl : (refl 𝕜 P).toIsometryEquiv = IsometryEquiv.refl P :=
rfl
@[simp]
theorem toHomeomorph_refl : (refl 𝕜 P).toHomeomorph = Homeomorph.refl P :=
rfl
/-- The inverse `AffineIsometryEquiv`. -/
def symm : P₂ ≃ᵃⁱ[𝕜] P :=
{ e.toAffineEquiv.symm with norm_map := e.linearIsometryEquiv.symm.norm_map }
@[simp]
theorem apply_symm_apply (x : P₂) : e (e.symm x) = x :=
e.toAffineEquiv.apply_symm_apply x
@[simp]
theorem symm_apply_apply (x : P) : e.symm (e x) = x :=
e.toAffineEquiv.symm_apply_apply x
@[simp]
theorem symm_symm : e.symm.symm = e := rfl
theorem symm_bijective : Bijective (AffineIsometryEquiv.symm : (P₂ ≃ᵃⁱ[𝕜] P) → _) :=
Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩
@[simp]
theorem toAffineEquiv_symm : e.symm.toAffineEquiv = e.toAffineEquiv.symm :=
rfl
@[simp]
theorem coe_symm_toAffineEquiv : ⇑e.toAffineEquiv.symm = e.symm :=
rfl
@[simp]
theorem toIsometryEquiv_symm : e.symm.toIsometryEquiv = e.toIsometryEquiv.symm :=
rfl
@[simp]
theorem coe_symm_toIsometryEquiv : ⇑e.toIsometryEquiv.symm = e.symm :=
rfl
@[simp]
theorem toHomeomorph_symm : e.symm.toHomeomorph = e.toHomeomorph.symm :=
rfl
@[simp]
theorem coe_symm_toHomeomorph : ⇑e.toHomeomorph.symm = e.symm :=
rfl
/-- Composition of `AffineIsometryEquiv`s as an `AffineIsometryEquiv`. -/
def trans (e' : P₂ ≃ᵃⁱ[𝕜] P₃) : P ≃ᵃⁱ[𝕜] P₃ :=
⟨e.toAffineEquiv.trans e'.toAffineEquiv, fun _ => (e'.norm_map _).trans (e.norm_map _)⟩
@[simp]
theorem coe_trans (e₁ : P ≃ᵃⁱ[𝕜] P₂) (e₂ : P₂ ≃ᵃⁱ[𝕜] P₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=
rfl
@[simp]
theorem trans_refl : e.trans (refl 𝕜 P₂) = e :=
ext fun _ => rfl
@[simp]
theorem refl_trans : (refl 𝕜 P).trans e = e :=
ext fun _ => rfl
@[simp]
theorem self_trans_symm : e.trans e.symm = refl 𝕜 P :=
ext e.symm_apply_apply
@[simp]
theorem symm_trans_self : e.symm.trans e = refl 𝕜 P₂ :=
ext e.apply_symm_apply
@[simp]
theorem coe_symm_trans (e₁ : P ≃ᵃⁱ[𝕜] P₂) (e₂ : P₂ ≃ᵃⁱ[𝕜] P₃) :
⇑(e₁.trans e₂).symm = e₁.symm ∘ e₂.symm :=
rfl
theorem trans_assoc (ePP₂ : P ≃ᵃⁱ[𝕜] P₂) (eP₂G : P₂ ≃ᵃⁱ[𝕜] P₃) (eGG' : P₃ ≃ᵃⁱ[𝕜] P₄) :
ePP₂.trans (eP₂G.trans eGG') = (ePP₂.trans eP₂G).trans eGG' :=
rfl
/-- The group of affine isometries of a `NormedAddTorsor`, `P`. -/
instance instGroup : Group (P ≃ᵃⁱ[𝕜] P) where
mul e₁ e₂ := e₂.trans e₁
one := refl _ _
inv := symm
one_mul := trans_refl
mul_one := refl_trans
mul_assoc _ _ _ := trans_assoc _ _ _
inv_mul_cancel := self_trans_symm
@[simp]
theorem coe_one : ⇑(1 : P ≃ᵃⁱ[𝕜] P) = id :=
rfl
@[simp]
theorem coe_mul (e e' : P ≃ᵃⁱ[𝕜] P) : ⇑(e * e') = e ∘ e' :=
rfl
@[simp]
theorem coe_inv (e : P ≃ᵃⁱ[𝕜] P) : ⇑e⁻¹ = e.symm :=
rfl
@[simp]
theorem map_vadd (p : P) (v : V) : e (v +ᵥ p) = e.linearIsometryEquiv v +ᵥ e p :=
e.toAffineIsometry.map_vadd p v
@[simp]
theorem map_vsub (p1 p2 : P) : e.linearIsometryEquiv (p1 -ᵥ p2) = e p1 -ᵥ e p2 :=
e.toAffineIsometry.map_vsub p1 p2
@[simp]
theorem dist_map (x y : P) : dist (e x) (e y) = dist x y :=
e.toAffineIsometry.dist_map x y
@[simp]
theorem edist_map (x y : P) : edist (e x) (e y) = edist x y :=
e.toAffineIsometry.edist_map x y
protected theorem bijective : Bijective e :=
e.1.bijective
protected theorem injective : Injective e :=
e.1.injective
protected theorem surjective : Surjective e :=
e.1.surjective
theorem map_eq_iff {x y : P} : e x = e y ↔ x = y :=
e.injective.eq_iff
theorem map_ne {x y : P} (h : x ≠ y) : e x ≠ e y :=
e.injective.ne h
protected theorem lipschitz : LipschitzWith 1 e :=
e.isometry.lipschitz
protected theorem antilipschitz : AntilipschitzWith 1 e :=
e.isometry.antilipschitz
@[simp]
theorem ediam_image (s : Set P) : EMetric.diam (e '' s) = EMetric.diam s :=
e.isometry.ediam_image s
@[simp]
theorem diam_image (s : Set P) : Metric.diam (e '' s) = Metric.diam s :=
e.isometry.diam_image s
variable {α : Type*} [TopologicalSpace α]
@[simp]
theorem comp_continuousOn_iff {f : α → P} {s : Set α} : ContinuousOn (e ∘ f) s ↔ ContinuousOn f s :=
e.isometry.comp_continuousOn_iff
@[simp]
theorem comp_continuous_iff {f : α → P} : Continuous (e ∘ f) ↔ Continuous f :=
e.isometry.comp_continuous_iff
section Constructions
variable (s₁ s₂ : AffineSubspace 𝕜 P) [Nonempty s₁] [Nonempty s₂]
/-- The identity equivalence of an affine subspace equal to `⊤` to the whole space. -/
def ofTop (h : s₁ = ⊤) : s₁ ≃ᵃⁱ[𝕜] P :=
{ (AffineEquiv.ofEq s₁ ⊤ h).trans (AffineSubspace.topEquiv 𝕜 V P) with norm_map := fun _ ↦ rfl }
variable {s₁}
@[simp]
lemma ofTop_apply (h : s₁ = ⊤) (x : s₁) : (ofTop s₁ h x : P) = x :=
rfl
@[simp]
lemma ofTop_symm_apply_coe (h : s₁ = ⊤) (x : P) : (ofTop s₁ h).symm x = x :=
rfl
variable (s₁)
/-- `AffineEquiv.ofEq` as an `AffineIsometryEquiv`. -/
def ofEq (h : s₁ = s₂) : s₁ ≃ᵃⁱ[𝕜] s₂ :=
{ AffineEquiv.ofEq s₁ s₂ h with norm_map := fun _ ↦ rfl }
variable {s₁ s₂}
@[simp]
lemma coe_ofEq_apply (h : s₁ = s₂) (x : s₁) : (ofEq s₁ s₂ h x : P) = x :=
rfl
@[simp]
lemma ofEq_symm (h : s₁ = s₂) : (ofEq s₁ s₂ h).symm = ofEq s₂ s₁ h.symm :=
rfl
@[simp]
lemma ofEq_rfl : ofEq s₁ s₁ rfl = refl 𝕜 s₁ :=
rfl
variable (𝕜) in
/-- The map `v ↦ v +ᵥ p` as an affine isometric equivalence between `V` and `P`. -/
def vaddConst (p : P) : V ≃ᵃⁱ[𝕜] P :=
{ AffineEquiv.vaddConst 𝕜 p with norm_map := fun _ => rfl }
@[simp]
theorem coe_vaddConst (p : P) : ⇑(vaddConst 𝕜 p) = fun v => v +ᵥ p :=
rfl
@[simp]
theorem coe_vaddConst' (p : P) : ↑(AffineEquiv.vaddConst 𝕜 p) = fun v => v +ᵥ p :=
rfl
@[simp]
theorem coe_vaddConst_symm (p : P) : ⇑(vaddConst 𝕜 p).symm = fun p' => p' -ᵥ p :=
rfl
@[simp]
theorem vaddConst_toAffineEquiv (p : P) :
(vaddConst 𝕜 p).toAffineEquiv = AffineEquiv.vaddConst 𝕜 p :=
rfl
variable (𝕜) in
/-- `p' ↦ p -ᵥ p'` as an affine isometric equivalence. -/
def constVSub (p : P) : P ≃ᵃⁱ[𝕜] V :=
{ AffineEquiv.constVSub 𝕜 p with norm_map := norm_neg }
@[simp]
theorem coe_constVSub (p : P) : ⇑(constVSub 𝕜 p) = (p -ᵥ ·) :=
rfl
@[simp]
theorem symm_constVSub (p : P) :
(constVSub 𝕜 p).symm =
(LinearIsometryEquiv.neg 𝕜).toAffineIsometryEquiv.trans (vaddConst 𝕜 p) := by
ext
rfl
variable (𝕜 P) in
/-- Translation by `v` (that is, the map `p ↦ v +ᵥ p`) as an affine isometric automorphism of `P`.
-/
def constVAdd (v : V) : P ≃ᵃⁱ[𝕜] P :=
{ AffineEquiv.constVAdd 𝕜 P v with norm_map := fun _ => rfl }
@[simp]
theorem coe_constVAdd (v : V) : ⇑(constVAdd 𝕜 P v : P ≃ᵃⁱ[𝕜] P) = (v +ᵥ ·) :=
rfl
@[simp]
theorem constVAdd_zero : constVAdd 𝕜 P (0 : V) = refl 𝕜 P :=
ext <| zero_vadd V
include 𝕜 in
/-- The map `g` from `V` to `V₂` corresponding to a map `f` from `P` to `P₂`, at a base point `p`,
is an isometry if `f` is one. -/
theorem vadd_vsub {f : P → P₂} (hf : Isometry f) {p : P} {g : V → V₂}
(hg : ∀ v, g v = f (v +ᵥ p) -ᵥ f p) : Isometry g := by
convert (vaddConst 𝕜 (f p)).symm.isometry.comp (hf.comp (vaddConst 𝕜 p).isometry)
exact funext hg
variable (𝕜) in
/-- Point reflection in `x` as an affine isometric automorphism. -/
def pointReflection (x : P) : P ≃ᵃⁱ[𝕜] P :=
(constVSub 𝕜 x).trans (vaddConst 𝕜 x)
theorem pointReflection_apply (x y : P) : (pointReflection 𝕜 x) y = (x -ᵥ y) +ᵥ x :=
rfl
@[simp]
theorem pointReflection_toAffineEquiv (x : P) :
(pointReflection 𝕜 x).toAffineEquiv = AffineEquiv.pointReflection 𝕜 x :=
rfl
@[simp]
theorem pointReflection_self (x : P) : pointReflection 𝕜 x x = x :=
AffineEquiv.pointReflection_self 𝕜 x
theorem pointReflection_involutive (x : P) : Function.Involutive (pointReflection 𝕜 x) :=
Equiv.pointReflection_involutive x
@[simp]
theorem pointReflection_symm (x : P) : (pointReflection 𝕜 x).symm = pointReflection 𝕜 x :=
toAffineEquiv_injective <| AffineEquiv.pointReflection_symm 𝕜 x
@[simp]
theorem dist_pointReflection_fixed (x y : P) : dist (pointReflection 𝕜 x y) x = dist y x := by
rw [← (pointReflection 𝕜 x).dist_map y x, pointReflection_self]
theorem dist_pointReflection_self' (x y : P) :
dist (pointReflection 𝕜 x y) y = ‖2 • (x -ᵥ y)‖ := by
rw [pointReflection_apply, dist_eq_norm_vsub V, vadd_vsub_assoc, two_nsmul]
theorem dist_pointReflection_self (x y : P) :
dist (pointReflection 𝕜 x y) y = ‖(2 : 𝕜)‖ * dist x y := by
rw [dist_pointReflection_self', two_nsmul, ← two_smul 𝕜, norm_smul, ← dist_eq_norm_vsub V]
theorem pointReflection_fixed_iff [Invertible (2 : 𝕜)] {x y : P} :
pointReflection 𝕜 x y = y ↔ y = x :=
AffineEquiv.pointReflection_fixed_iff_of_module 𝕜
variable [NormedSpace ℝ V]
theorem dist_pointReflection_self_real (x y : P) :
dist (pointReflection ℝ x y) y = 2 * dist x y := by
rw [dist_pointReflection_self, Real.norm_two]
@[simp]
theorem pointReflection_midpoint_left (x y : P) : pointReflection ℝ (midpoint ℝ x y) x = y :=
AffineEquiv.pointReflection_midpoint_left x y
@[simp]
theorem pointReflection_midpoint_right (x y : P) : pointReflection ℝ (midpoint ℝ x y) y = x :=
AffineEquiv.pointReflection_midpoint_right x y
end Constructions
end AffineIsometryEquiv
namespace AffineSubspace
/-- An affine subspace is isomorphic to its image under an injective affine map.
This is the affine version of `Submodule.equivMapOfInjective`.
-/
@[simps linear, simps! toFun]
noncomputable def equivMapOfInjective (E : AffineSubspace 𝕜 P₁) [Nonempty E] (φ : P₁ →ᵃ[𝕜] P₂)
(hφ : Function.Injective φ) : E ≃ᵃ[𝕜] E.map φ :=
{ Equiv.Set.image _ (E : Set P₁) hφ with
linear :=
(E.direction.equivMapOfInjective φ.linear (φ.linear_injective_iff.mpr hφ)).trans
(LinearEquiv.ofEq _ _ (AffineSubspace.map_direction _ _).symm)
map_vadd' := fun p v => Subtype.ext <| φ.map_vadd p v }
/-- Restricts an affine isometry to an affine isometry equivalence between a nonempty affine
subspace `E` and its image.
This is an isometry version of `AffineSubspace.equivMap`, having a stronger premise and a stronger
conclusion.
-/
noncomputable def isometryEquivMap (φ : P₁' →ᵃⁱ[𝕜] P₂) (E : AffineSubspace 𝕜 P₁') [Nonempty E] :
E ≃ᵃⁱ[𝕜] E.map φ.toAffineMap :=
⟨E.equivMapOfInjective φ.toAffineMap φ.injective, fun _ => φ.norm_map _⟩
@[simp]
theorem isometryEquivMap.apply_symm_apply {E : AffineSubspace 𝕜 P₁'} [Nonempty E]
{φ : P₁' →ᵃⁱ[𝕜] P₂} (x : E.map φ.toAffineMap) : φ ((E.isometryEquivMap φ).symm x) = x :=
congr_arg Subtype.val <| (E.isometryEquivMap φ).apply_symm_apply _
@[simp]
theorem isometryEquivMap.coe_apply (φ : P₁' →ᵃⁱ[𝕜] P₂) (E : AffineSubspace 𝕜 P₁') [Nonempty E]
(g : E) : ↑(E.isometryEquivMap φ g) = φ g :=
rfl
@[simp]
theorem isometryEquivMap.toAffineMap_eq (φ : P₁' →ᵃⁱ[𝕜] P₂) (E : AffineSubspace 𝕜 P₁')
[Nonempty E] :
(E.isometryEquivMap φ).toAffineMap = E.equivMapOfInjective φ.toAffineMap φ.injective :=
rfl
end AffineSubspace |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Affine/MazurUlam.lean | import Mathlib.Topology.Instances.RealVectorSpace
import Mathlib.Analysis.Normed.Affine.Isometry
/-!
# Mazur-Ulam Theorem
Mazur-Ulam theorem states that an isometric bijection between two normed affine spaces over `ℝ` is
affine. We formalize it in three definitions:
* `IsometryEquiv.toRealLinearIsometryEquivOfMapZero` : given `E ≃ᵢ F` sending `0` to `0`,
returns `E ≃ₗᵢ[ℝ] F` with the same `toFun` and `invFun`;
* `IsometryEquiv.toRealLinearIsometryEquiv` : given `f : E ≃ᵢ F`, returns a linear isometry
equivalence `g : E ≃ₗᵢ[ℝ] F` with `g x = f x - f 0`.
* `IsometryEquiv.toRealAffineIsometryEquiv` : given `f : PE ≃ᵢ PF`, returns an affine isometry
equivalence `g : PE ≃ᵃⁱ[ℝ] PF` whose underlying `IsometryEquiv` is `f`
The formalization is based on [Jussi Väisälä, *A Proof of the Mazur-Ulam Theorem*][Vaisala_2003].
## Tags
isometry, affine map, linear map
-/
variable {E PE F PF : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [MetricSpace PE]
[NormedAddTorsor E PE] [NormedAddCommGroup F] [NormedSpace ℝ F] [MetricSpace PF]
[NormedAddTorsor F PF]
open Set AffineMap AffineIsometryEquiv
noncomputable section
namespace IsometryEquiv
/-- If an isometric self-homeomorphism of a normed vector space over `ℝ` fixes `x` and `y`,
then it fixes the midpoint of `[x, y]`. This is a lemma for a more general Mazur-Ulam theorem,
see below. -/
theorem midpoint_fixed {x y : PE} :
∀ e : PE ≃ᵢ PE, e x = x → e y = y → e (midpoint ℝ x y) = midpoint ℝ x y := by
set z := midpoint ℝ x y
-- Consider the set of `e : E ≃ᵢ E` such that `e x = x` and `e y = y`
set s := { e : PE ≃ᵢ PE | e x = x ∧ e y = y }
haveI : Nonempty s := ⟨⟨IsometryEquiv.refl PE, rfl, rfl⟩⟩
-- On the one hand, `e` cannot send the midpoint `z` of `[x, y]` too far
have h_bdd : BddAbove (range fun e : s => dist ((e : PE ≃ᵢ PE) z) z) := by
refine ⟨dist x z + dist x z, forall_mem_range.2 <| Subtype.forall.2 ?_⟩
rintro e ⟨hx, _⟩
calc
dist (e z) z ≤ dist (e z) x + dist x z := dist_triangle (e z) x z
_ = dist (e x) (e z) + dist x z := by rw [hx, dist_comm]
_ = dist x z + dist x z := by rw [e.dist_eq x z]
-- On the other hand, consider the map `f : (E ≃ᵢ E) → (E ≃ᵢ E)`
-- sending each `e` to `R ∘ e⁻¹ ∘ R ∘ e`, where `R` is the point reflection in the
-- midpoint `z` of `[x, y]`.
set R : PE ≃ᵢ PE := (pointReflection ℝ z).toIsometryEquiv
set f : PE ≃ᵢ PE → PE ≃ᵢ PE := fun e => ((e.trans R).trans e.symm).trans R
-- Note that `f` doubles the value of `dist (e z) z`
have hf_dist : ∀ e, dist (f e z) z = 2 * dist (e z) z := by
intro e
dsimp only [trans_apply, coe_toIsometryEquiv, f, R]
rw [dist_pointReflection_fixed, ← e.dist_eq, e.apply_symm_apply,
dist_pointReflection_self_real, dist_comm]
-- Also note that `f` maps `s` to itself
have hf_maps_to : MapsTo f s s := by
rintro e ⟨hx, hy⟩
constructor <;> simp [f, R, z, hx, hy, e.symm_apply_eq.2 hx.symm, e.symm_apply_eq.2 hy.symm]
-- Therefore, `dist (e z) z = 0` for all `e ∈ s`.
set c := ⨆ e : s, dist ((e : PE ≃ᵢ PE) z) z
have : c ≤ c / 2 := by
apply ciSup_le
rintro ⟨e, he⟩
simp only [le_div_iff₀' (zero_lt_two' ℝ), ← hf_dist]
exact le_ciSup h_bdd ⟨f e, hf_maps_to he⟩
replace : c ≤ 0 := by linarith
refine fun e hx hy => dist_le_zero.1 (le_trans ?_ this)
exact le_ciSup h_bdd ⟨e, hx, hy⟩
/-- A bijective isometry sends midpoints to midpoints. -/
theorem map_midpoint (f : PE ≃ᵢ PF) (x y : PE) : f (midpoint ℝ x y) = midpoint ℝ (f x) (f y) := by
set e : PE ≃ᵢ PE :=
((f.trans <| (pointReflection ℝ <| midpoint ℝ (f x) (f y)).toIsometryEquiv).trans f.symm).trans
(pointReflection ℝ <| midpoint ℝ x y).toIsometryEquiv
have hx : e x = x := by simp [e]
have hy : e y = y := by simp [e]
have hm := e.midpoint_fixed hx hy
simp only [e, trans_apply] at hm
rwa [← eq_symm_apply, ← toIsometryEquiv_symm, pointReflection_symm, coe_toIsometryEquiv,
coe_toIsometryEquiv, pointReflection_self, symm_apply_eq, @pointReflection_fixed_iff] at hm
/-!
Since `f : PE ≃ᵢ PF` sends midpoints to midpoints, it is an affine map.
We define a conversion to a `ContinuousLinearEquiv` first, then a conversion to an `AffineMap`.
-/
/-- **Mazur-Ulam Theorem**: if `f` is an isometric bijection between two normed vector spaces
over `ℝ` and `f 0 = 0`, then `f` is a linear isometry equivalence. -/
def toRealLinearIsometryEquivOfMapZero (f : E ≃ᵢ F) (h0 : f 0 = 0) : E ≃ₗᵢ[ℝ] F :=
{ (AddMonoidHom.ofMapMidpoint ℝ ℝ f h0 f.map_midpoint).toRealLinearMap f.continuous, f with
norm_map' := fun x => show ‖f x‖ = ‖x‖ by simp only [← dist_zero_right, ← h0, f.dist_eq] }
@[simp]
theorem coe_toRealLinearIsometryEquivOfMapZero (f : E ≃ᵢ F) (h0 : f 0 = 0) :
⇑(f.toRealLinearIsometryEquivOfMapZero h0) = f :=
rfl
@[simp]
theorem coe_toRealLinearIsometryEquivOfMapZero_symm (f : E ≃ᵢ F) (h0 : f 0 = 0) :
⇑(f.toRealLinearIsometryEquivOfMapZero h0).symm = f.symm :=
rfl
/-- **Mazur-Ulam Theorem**: if `f` is an isometric bijection between two normed vector spaces
over `ℝ`, then `x ↦ f x - f 0` is a linear isometry equivalence. -/
def toRealLinearIsometryEquiv (f : E ≃ᵢ F) : E ≃ₗᵢ[ℝ] F :=
(f.trans (IsometryEquiv.addRight (f 0)).symm).toRealLinearIsometryEquivOfMapZero
(by simpa only [sub_eq_add_neg] using sub_self (f 0))
@[simp]
theorem toRealLinearIsometryEquiv_apply (f : E ≃ᵢ F) (x : E) :
(f.toRealLinearIsometryEquiv : E → F) x = f x - f 0 :=
(sub_eq_add_neg (f x) (f 0)).symm
@[simp]
theorem toRealLinearIsometryEquiv_symm_apply (f : E ≃ᵢ F) (y : F) :
(f.toRealLinearIsometryEquiv.symm : F → E) y = f.symm (y + f 0) :=
rfl
/-- **Mazur-Ulam Theorem**: if `f` is an isometric bijection between two normed add-torsors over
normed vector spaces over `ℝ`, then `f` is an affine isometry equivalence. -/
def toRealAffineIsometryEquiv (f : PE ≃ᵢ PF) : PE ≃ᵃⁱ[ℝ] PF :=
AffineIsometryEquiv.mk' f
((vaddConst (Classical.arbitrary PE)).trans <|
f.trans (vaddConst (f <| Classical.arbitrary PE)).symm).toRealLinearIsometryEquiv
(Classical.arbitrary PE) fun p => by simp
@[simp]
theorem coeFn_toRealAffineIsometryEquiv (f : PE ≃ᵢ PF) : ⇑f.toRealAffineIsometryEquiv = f :=
rfl
@[simp]
theorem coe_toRealAffineIsometryEquiv (f : PE ≃ᵢ PF) :
f.toRealAffineIsometryEquiv.toIsometryEquiv = f := by
ext
rfl
end IsometryEquiv |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Affine/AddTorsorBases.lean | import Mathlib.Analysis.Normed.Module.FiniteDimension
import Mathlib.LinearAlgebra.AffineSpace.FiniteDimensional
/-!
# Bases in normed affine spaces.
This file contains results about bases in normed affine spaces.
## Main definitions:
* `continuous_barycentric_coord`
* `isOpenMap_barycentric_coord`
* `AffineBasis.interior_convexHull`
* `IsOpen.exists_subset_affineIndependent_span_eq_top`
* `interior_convexHull_nonempty_iff_affineSpan_eq_top`
-/
assert_not_exists HasFDerivAt
section Barycentric
variable {ι 𝕜 E P : Type*} [NontriviallyNormedField 𝕜] [CompleteSpace 𝕜]
variable [NormedAddCommGroup E] [NormedSpace 𝕜 E]
variable [MetricSpace P] [NormedAddTorsor E P]
theorem isOpenMap_barycentric_coord [Nontrivial ι] (b : AffineBasis ι 𝕜 P) (i : ι) :
IsOpenMap (b.coord i) :=
AffineMap.isOpenMap_linear_iff.mp <|
(b.coord i).linear.isOpenMap_of_finiteDimensional <|
(b.coord i).linear_surjective_iff.mpr (b.surjective_coord i)
variable [FiniteDimensional 𝕜 E] (b : AffineBasis ι 𝕜 P)
@[continuity]
theorem continuous_barycentric_coord (i : ι) : Continuous (b.coord i) :=
(b.coord i).continuous_of_finiteDimensional
end Barycentric
open Set
/-- Given a finite-dimensional normed real vector space, the interior of the convex hull of an
affine basis is the set of points whose barycentric coordinates are strictly positive with respect
to this basis.
TODO Restate this result for affine spaces (instead of vector spaces) once the definition of
convexity is generalised to this setting. -/
theorem AffineBasis.interior_convexHull {ι E : Type*} [Finite ι] [NormedAddCommGroup E]
[NormedSpace ℝ E] (b : AffineBasis ι ℝ E) :
interior (convexHull ℝ (range b)) = {x | ∀ i, 0 < b.coord i x} := by
cases subsingleton_or_nontrivial ι
· -- The zero-dimensional case.
have : range b = univ :=
AffineSubspace.eq_univ_of_subsingleton_span_eq_top (subsingleton_range _) b.tot
simp [this]
· -- The positive-dimensional case.
haveI : FiniteDimensional ℝ E := b.finiteDimensional
have : convexHull ℝ (range b) = ⋂ i, b.coord i ⁻¹' Ici 0 := by
rw [b.convexHull_eq_nonneg_coord, setOf_forall]; rfl
ext
simp only [this, interior_iInter_of_finite, ←
IsOpenMap.preimage_interior_eq_interior_preimage (isOpenMap_barycentric_coord b _)
(continuous_barycentric_coord b _),
interior_Ici, mem_iInter, mem_setOf_eq, mem_Ioi, mem_preimage]
variable {V P : Type*} [NormedAddCommGroup V] [NormedSpace ℝ V] [MetricSpace P]
[NormedAddTorsor V P]
open AffineMap
/-- Given a set `s` of affine-independent points belonging to an open set `u`, we may extend `s` to
an affine basis, all of whose elements belong to `u`. -/
theorem IsOpen.exists_between_affineIndependent_span_eq_top {s u : Set P} (hu : IsOpen u)
(hsu : s ⊆ u) (hne : s.Nonempty) (h : AffineIndependent ℝ ((↑) : s → P)) :
∃ t : Set P, s ⊆ t ∧ t ⊆ u ∧ AffineIndependent ℝ ((↑) : t → P) ∧ affineSpan ℝ t = ⊤ := by
obtain ⟨q, hq⟩ := hne
obtain ⟨ε, ε0, hεu⟩ := Metric.nhds_basis_closedBall.mem_iff.1 (hu.mem_nhds <| hsu hq)
obtain ⟨t, ht₁, ht₂, ht₃⟩ := exists_subset_affineIndependent_affineSpan_eq_top h
let f : P → P := fun y => lineMap q y (ε / dist y q)
have hf : ∀ y, f y ∈ u := by
refine fun y => hεu ?_
simp only [f]
rw [Metric.mem_closedBall, lineMap_apply, dist_vadd_left, norm_smul, Real.norm_eq_abs,
dist_eq_norm_vsub V y q, abs_div, abs_of_pos ε0, abs_of_nonneg (norm_nonneg _), div_mul_comm]
exact mul_le_of_le_one_left ε0.le (div_self_le_one _)
have hεyq : ∀ y ∉ s, ε / dist y q ≠ 0 := fun y hy =>
div_ne_zero ε0.ne' (dist_ne_zero.2 (ne_of_mem_of_not_mem hq hy).symm)
classical
let w : t → ℝˣ := fun p => if hp : (p : P) ∈ s then 1 else Units.mk0 _ (hεyq (↑p) hp)
refine ⟨Set.range fun p : t => lineMap q p (w p : ℝ), ?_, ?_, ?_, ?_⟩
· intro p hp; use ⟨p, ht₁ hp⟩; simp [w, hp]
· rintro y ⟨⟨p, hp⟩, rfl⟩
by_cases hps : p ∈ s <;>
simp only [w, hps, lineMap_apply_one, Units.val_mk0, dif_neg, dif_pos, not_false_iff,
Units.val_one] <;>
[exact hsu hps; exact hf p]
· exact (ht₂.units_lineMap ⟨q, ht₁ hq⟩ w).range
· rw [affineSpan_eq_affineSpan_lineMap_units (ht₁ hq) w, ht₃]
theorem IsOpen.exists_subset_affineIndependent_span_eq_top {u : Set P} (hu : IsOpen u)
(hne : u.Nonempty) : ∃ s ⊆ u, AffineIndependent ℝ ((↑) : s → P) ∧ affineSpan ℝ s = ⊤ := by
rcases hne with ⟨x, hx⟩
rcases hu.exists_between_affineIndependent_span_eq_top (singleton_subset_iff.mpr hx)
(singleton_nonempty _) (affineIndependent_of_subsingleton _ _) with ⟨s, -, hsu, hs⟩
exact ⟨s, hsu, hs⟩
/-- The affine span of a nonempty open set is `⊤`. -/
theorem IsOpen.affineSpan_eq_top {u : Set P} (hu : IsOpen u) (hne : u.Nonempty) :
affineSpan ℝ u = ⊤ :=
let ⟨_, hsu, _, hs'⟩ := hu.exists_subset_affineIndependent_span_eq_top hne
top_unique <| hs' ▸ affineSpan_mono _ hsu
theorem affineSpan_eq_top_of_nonempty_interior {s : Set V}
(hs : (interior <| convexHull ℝ s).Nonempty) : affineSpan ℝ s = ⊤ :=
top_unique <| isOpen_interior.affineSpan_eq_top hs ▸
(affineSpan_mono _ interior_subset).trans_eq (affineSpan_convexHull _)
theorem AffineBasis.centroid_mem_interior_convexHull {ι} [Fintype ι] (b : AffineBasis ι ℝ V) :
Finset.univ.centroid ℝ b ∈ interior (convexHull ℝ (range b)) := by
haveI := b.nonempty
simp only [b.interior_convexHull, mem_setOf_eq, b.coord_apply_centroid (Finset.mem_univ _),
inv_pos, Nat.cast_pos, Finset.card_pos, Finset.univ_nonempty, forall_true_iff]
theorem interior_convexHull_nonempty_iff_affineSpan_eq_top [FiniteDimensional ℝ V] {s : Set V} :
(interior (convexHull ℝ s)).Nonempty ↔ affineSpan ℝ s = ⊤ := by
refine ⟨affineSpan_eq_top_of_nonempty_interior, fun h => ?_⟩
obtain ⟨t, hts, b, hb⟩ := AffineBasis.exists_affine_subbasis h
suffices (interior (convexHull ℝ (range b))).Nonempty by
rw [hb, Subtype.range_coe_subtype, setOf_mem_eq] at this
refine this.mono (by gcongr)
lift t to Finset V using b.finite_set
exact ⟨_, b.centroid_mem_interior_convexHull⟩
theorem Convex.interior_nonempty_iff_affineSpan_eq_top [FiniteDimensional ℝ V] {s : Set V}
(hs : Convex ℝ s) : (interior s).Nonempty ↔ affineSpan ℝ s = ⊤ := by
rw [← interior_convexHull_nonempty_iff_affineSpan_eq_top, hs.convexHull_eq] |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Affine/AsymptoticCone.lean | import Mathlib.Analysis.Normed.Module.FiniteDimension
import Mathlib.Topology.Algebra.AsymptoticCone
/-!
# Asymptotic cones in normed spaces
In this file, we prove that the asymptotic cone of a set is non-trivial if and only if the set is
unbounded.
-/
open AffineSpace Bornology Filter Topology
variable
{V P : Type*} [NormedAddCommGroup V] [NormedSpace ℝ V] [MetricSpace P] [NormedAddTorsor V P]
theorem AffineSpace.asymptoticNhds_le_cobounded {v : V} (hv : v ≠ 0) :
asymptoticNhds ℝ P v ≤ cobounded P := by
have ⟨p⟩ : Nonempty P := inferInstance
rw [← tendsto_id', ← Metric.tendsto_dist_right_atTop_iff p,
asymptoticNhds_eq_smul_vadd v p, vadd_pure, ← map₂_smul, ← map_prod_eq_map₂, map_map,
tendsto_map'_iff]
change Tendsto (fun x : ℝ × V => dist (x.1 • x.2 +ᵥ p) p) (atTop ×ˢ 𝓝 v) atTop
simp_rw [dist_vadd_left, norm_smul]
exact Tendsto.atTop_mul_pos (norm_pos_iff.mpr hv)
(tendsto_norm_atTop_atTop.comp tendsto_id.fst)
tendsto_snd.norm
theorem asymptoticCone_subset_singleton_of_bounded {s : Set P} (hs : IsBounded s) :
asymptoticCone ℝ s ⊆ {0} := by
intro v h
by_contra! hv
exact h (asymptoticNhds_le_cobounded hv hs)
variable [FiniteDimensional ℝ V]
theorem AffineSpace.cobounded_eq_iSup_sphere_asymptoticNhds :
cobounded P = ⨆ v ∈ Metric.sphere 0 1, asymptoticNhds ℝ P v := by
refine le_antisymm ?_ <| iSup₂_le fun _ h => asymptoticNhds_le_cobounded <|
Metric.ne_of_mem_sphere h one_ne_zero
intro s hs
have ⟨p⟩ : Nonempty P := inferInstance
simp_rw [mem_iSup, asymptoticNhds_eq_smul_vadd _ p, vadd_pure] at hs
choose! t ht u hu smul_subset_s using hs
have ⟨cover, h₁, h₂⟩ := (isCompact_sphere 0 1).elim_nhds_subcover u hu
rw [← Metric.comap_dist_left_atTop p]
refine ⟨Set.Ioi 0 ∩ ⋂ x ∈ cover, t x, inter_mem (Ioi_mem_atTop 0)
(cover.iInter_mem_sets.mpr fun x hx => ht x (h₁ x hx)), fun x hx => ?_⟩
rw [Set.mem_preimage, dist_eq_norm_vsub'] at hx
let x' := ‖x -ᵥ p‖⁻¹ • (x -ᵥ p)
have x'_mem : x' ∈ Metric.sphere 0 1 := by
rw [mem_sphere_zero_iff_norm, norm_smul, norm_inv, norm_norm, inv_mul_cancel₀ hx.1.ne']
have ⟨y, y_mem, hy⟩ := Set.mem_iUnion₂.mp (h₂ x'_mem)
rw [← vsub_vadd x p, ← show ‖x -ᵥ p‖ • x' = x -ᵥ p from smul_inv_smul₀ hx.1.ne' (x -ᵥ p)]
exact smul_subset_s y (h₁ y y_mem) <| Set.smul_mem_smul (Set.biInter_subset_of_mem y_mem hx.2) hy
/-- In a finite dimensional normed affine space over `ℝ`, a set is bounded if and only if its
asymptotic cone is trivial. -/
theorem isBounded_iff_asymptoticCone_subset_singleton {s : Set P} :
IsBounded s ↔ asymptoticCone ℝ s ⊆ {0} := by
refine ⟨asymptoticCone_subset_singleton_of_bounded, fun h => ?_⟩
simp_rw [isBounded_def, cobounded_eq_iSup_sphere_asymptoticNhds, mem_iSup]
intro v hv
by_contra h'
exact Metric.ne_of_mem_sphere hv one_ne_zero (h h')
/-- In a finite dimensional normed affine space over `ℝ`, a set is unbounded if and only if its
asymptotic cone contains a nonzero vector. -/
theorem not_bounded_iff_exists_ne_zero_mem_asymptoticCone {s : Set P} :
¬ IsBounded s ↔ ∃ v ≠ 0, v ∈ asymptoticCone ℝ s := by
rw [isBounded_iff_asymptoticCone_subset_singleton, Set.subset_singleton_iff, not_forall]
tauto |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Affine/ContinuousAffineMap.lean | import Mathlib.Topology.Algebra.ContinuousAffineMap
import Mathlib.Analysis.Normed.Operator.NormedSpace
import Mathlib.Analysis.Normed.Group.AddTorsor
/-!
# Norm on the continuous affine maps between normed vector spaces.
We define a norm on the space of continuous affine maps between normed vector spaces by defining the
norm of `f : V →ᴬ[𝕜] W` to be `‖f‖ = max ‖f 0‖ ‖f.cont_linear‖`. This is chosen so that we have a
linear isometry: `(V →ᴬ[𝕜] W) ≃ₗᵢ[𝕜] W × (V →L[𝕜] W)`.
The abstract picture is that for an affine space `P` modelled on a vector space `V`, together with
a vector space `W`, there is an exact sequence of `𝕜`-modules: `0 → C → A → L → 0` where `C`, `A`
are the spaces of constant and affine maps `P → W` and `L` is the space of linear maps `V → W`.
Any choice of a base point in `P` corresponds to a splitting of this sequence so in particular if we
take `P = V`, using `0 : V` as the base point provides a splitting, and we prove this is an
isometric decomposition.
On the other hand, choosing a base point breaks the affine invariance so the norm fails to be
submultiplicative: for a composition of maps, we have only `‖f.comp g‖ ≤ ‖f‖ * ‖g‖ + ‖f 0‖`.
## Main definitions:
* `ContinuousAffineMap.hasNorm`
* `ContinuousAffineMap.norm_comp_le`
* `ContinuousAffineMap.toConstProdContinuousLinearMap`
-/
namespace ContinuousAffineMap
variable {𝕜 V W W₂ : Type*}
variable [NormedAddCommGroup V] [NormedAddCommGroup W] [NormedAddCommGroup W₂]
variable [NontriviallyNormedField 𝕜] [NormedSpace 𝕜 V] [NormedSpace 𝕜 W] [NormedSpace 𝕜 W₂]
section NormedSpaceStructure
variable (f : V →ᴬ[𝕜] W)
/-- Note that unlike the operator norm for linear maps, this norm is _not_ submultiplicative:
we do _not_ necessarily have `‖f.comp g‖ ≤ ‖f‖ * ‖g‖`. See `norm_comp_le` for what we can say. -/
noncomputable instance hasNorm : Norm (V →ᴬ[𝕜] W) :=
⟨fun f => max ‖f 0‖ ‖f.contLinear‖⟩
theorem norm_def : ‖f‖ = max ‖f 0‖ ‖f.contLinear‖ :=
rfl
theorem norm_contLinear_le : ‖f.contLinear‖ ≤ ‖f‖ :=
le_max_right _ _
theorem norm_image_zero_le : ‖f 0‖ ≤ ‖f‖ :=
le_max_left _ _
@[simp]
theorem norm_eq (h : f 0 = 0) : ‖f‖ = ‖f.contLinear‖ :=
calc
‖f‖ = max ‖f 0‖ ‖f.contLinear‖ := by rw [norm_def]
_ = max 0 ‖f.contLinear‖ := by rw [h, norm_zero]
_ = ‖f.contLinear‖ := max_eq_right (norm_nonneg _)
noncomputable instance : NormedAddCommGroup (V →ᴬ[𝕜] W) :=
AddGroupNorm.toNormedAddCommGroup
{ toFun := fun f => max ‖f 0‖ ‖f.contLinear‖
map_zero' := by simp [(ContinuousAffineMap.zero_apply)]
neg' := fun f => by
simp [(ContinuousAffineMap.neg_apply)]
add_le' := fun f g => by
simp only [coe_add, max_le_iff, Pi.add_apply, add_contLinear]
exact
⟨(norm_add_le _ _).trans (add_le_add (le_max_left _ _) (le_max_left _ _)),
(norm_add_le _ _).trans (add_le_add (le_max_right _ _) (le_max_right _ _))⟩
eq_zero_of_map_eq_zero' := fun f h₀ => by
rcases max_eq_iff.mp h₀ with (⟨h₁, h₂⟩ | ⟨h₁, h₂⟩) <;> rw [h₁] at h₂
· rw [norm_le_zero_iff, contLinear_eq_zero_iff_exists_const] at h₂
obtain ⟨q, rfl⟩ := h₂
simp only [norm_eq_zero, coe_const, Function.const_apply] at h₁
rw [h₁]
rfl
· rw [norm_eq_zero, contLinear_eq_zero_iff_exists_const] at h₁
obtain ⟨q, rfl⟩ := h₁
simp only [norm_le_zero_iff, coe_const, Function.const_apply] at h₂
rw [h₂]
rfl }
noncomputable instance : NormedSpace 𝕜 (V →ᴬ[𝕜] W) where
norm_smul_le t f := by
simp only [norm_def, coe_smul, Pi.smul_apply, norm_smul, smul_contLinear,
← mul_max_of_nonneg _ _ (norm_nonneg t), le_refl]
theorem norm_comp_le (g : W₂ →ᴬ[𝕜] V) : ‖f.comp g‖ ≤ ‖f‖ * ‖g‖ + ‖f 0‖ := by
rw [norm_def, max_le_iff]
constructor
· calc
‖f.comp g 0‖ = ‖f (g 0)‖ := by simp
_ = ‖f.contLinear (g 0) + f 0‖ := by rw [f.decomp]; simp
_ ≤ ‖f.contLinear‖ * ‖g 0‖ + ‖f 0‖ := by grw [norm_add_le, f.contLinear.le_opNorm]
_ ≤ ‖f‖ * ‖g‖ + ‖f 0‖ := by grw [f.norm_contLinear_le, g.norm_image_zero_le]
· calc
‖(f.comp g).contLinear‖ ≤ ‖f.contLinear‖ * ‖g.contLinear‖ :=
(g.comp_contLinear f).symm ▸ f.contLinear.opNorm_comp_le _
_ ≤ ‖f‖ * ‖g‖ := by grw [f.norm_contLinear_le, g.norm_contLinear_le]
_ ≤ ‖f‖ * ‖g‖ + ‖f 0‖ := by rw [le_add_iff_nonneg_right]; apply norm_nonneg
variable (𝕜 V W)
/-- The space of affine maps between two normed spaces is linearly isometric to the product of the
codomain with the space of linear maps, by taking the value of the affine map at `(0 : V)` and the
linear part. -/
noncomputable def toConstProdContinuousLinearMap : (V →ᴬ[𝕜] W) ≃ₗᵢ[𝕜] W × (V →L[𝕜] W) where
toFun f := ⟨f 0, f.contLinear⟩
invFun p := p.2.toContinuousAffineMap + const 𝕜 V p.1
left_inv f := by
ext
rw [f.decomp]
simp only [coe_add, ContinuousLinearMap.coe_toContinuousAffineMap, Pi.add_apply, coe_const]
right_inv := by rintro ⟨v, f⟩; ext <;> simp
map_add' _ _ := rfl
map_smul' _ _ := rfl
norm_map' _ := rfl
@[simp]
theorem toConstProdContinuousLinearMap_fst (f : V →ᴬ[𝕜] W) :
(toConstProdContinuousLinearMap 𝕜 V W f).fst = f 0 :=
rfl
@[simp]
theorem toConstProdContinuousLinearMap_snd (f : V →ᴬ[𝕜] W) :
(toConstProdContinuousLinearMap 𝕜 V W f).snd = f.contLinear :=
rfl
end NormedSpaceStructure
end ContinuousAffineMap |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Ring/Finite.lean | import Mathlib.GroupTheory.OrderOfElement
import Mathlib.Algebra.Group.AddChar
import Mathlib.Algebra.Group.TypeTags.Finite
import Mathlib.Analysis.Normed.Ring.Basic
/-!
# Finite order elements in normed rings.
A finite order element in a normed ring has norm 1.
The values of additive characters on finite cancellative monoids have norm 1.
-/
variable {α β : Type*}
section NormedRing
variable [NormedRing α] [NormMulClass α] [NormOneClass α] {a : α}
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
@[simp] lemma AddChar.norm_apply {G : Type*} [AddLeftCancelMonoid G] [Finite G] (ψ : AddChar G α)
(x : G) : ‖ψ x‖ = 1 := (ψ.toMonoidHom.isOfFinOrder <| isOfFinOrder_of_finite _).norm_eq_one
end NormedRing |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Ring/Int.lean | import Mathlib.Analysis.Normed.Ring.Lemmas
/-!
# The integers as normed ring
This file contains basic facts about the integers as normed ring.
Recall that `‖n‖` denotes the norm of `n` as real number.
This norm is always nonnegative, so we can bundle the norm together with this fact,
to obtain a term of type `NNReal` (the nonnegative real numbers).
The resulting nonnegative real number is denoted by `‖n‖₊`.
-/
namespace Int
theorem nnnorm_coe_units (e : ℤˣ) : ‖(e : ℤ)‖₊ = 1 := by
obtain rfl | rfl := units_eq_one_or e <;>
simp only [Units.coe_neg_one, Units.val_one, nnnorm_neg, nnnorm_one]
theorem norm_coe_units (e : ℤˣ) : ‖(e : ℤ)‖ = 1 := by
rw [← coe_nnnorm, nnnorm_coe_units, NNReal.coe_one]
@[simp]
theorem nnnorm_natCast (n : ℕ) : ‖(n : ℤ)‖₊ = n :=
Real.nnnorm_natCast _
@[simp] lemma enorm_natCast (n : ℕ) : ‖(n : ℤ)‖ₑ = n := Real.enorm_natCast _
@[simp]
theorem toNat_add_toNat_neg_eq_nnnorm (n : ℤ) : ↑n.toNat + ↑(-n).toNat = ‖n‖₊ := by
rw [← Nat.cast_add, toNat_add_toNat_neg_eq_natAbs, NNReal.natCast_natAbs]
@[simp]
theorem toNat_add_toNat_neg_eq_norm (n : ℤ) : ↑n.toNat + ↑(-n).toNat = ‖n‖ := by
simpa only [NNReal.coe_natCast, NNReal.coe_add] using
congrArg NNReal.toReal (toNat_add_toNat_neg_eq_nnnorm n)
end Int |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Ring/Lemmas.lean | import Mathlib.Algebra.Order.GroupWithZero.Finset
import Mathlib.Analysis.Normed.Group.Bounded
import Mathlib.Analysis.Normed.Group.Int
import Mathlib.Analysis.Normed.Group.Uniform
import Mathlib.Analysis.Normed.Ring.Basic
import Mathlib.Topology.MetricSpace.Dilation
/-!
# Normed rings
In this file we continue building the theory of (semi)normed rings.
-/
variable {α : Type*} {β : Type*} {ι : Type*}
open Filter Bornology
open scoped Topology NNReal Pointwise
section NonUnitalSeminormedRing
variable [NonUnitalSeminormedRing α]
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 _ _)
open Finset in
/-- Non-unital seminormed ring structure on the product of finitely many non-unital seminormed
rings, using the sup norm. -/
instance Pi.nonUnitalSeminormedRing {R : ι → Type*} [Fintype ι]
[∀ i, NonUnitalSeminormedRing (R i)] : NonUnitalSeminormedRing (∀ i, R i) :=
{ seminormedAddCommGroup, nonUnitalRing with
norm_mul_le x y := NNReal.coe_mono <| calc
(univ.sup fun i ↦ ‖x i * y i‖₊) ≤ univ.sup ((‖x ·‖₊) * (‖y ·‖₊)) :=
sup_mono_fun fun _ _ ↦ nnnorm_mul_le _ _
_ ≤ (univ.sup (‖x ·‖₊)) * univ.sup (‖y ·‖₊) :=
sup_mul_le_mul_sup_of_nonneg (fun _ _ ↦ zero_le _) fun _ _ ↦ zero_le _}
end NonUnitalSeminormedRing
section SeminormedRing
variable [SeminormedRing α]
/-- Seminormed ring structure on the product of finitely many seminormed rings,
using the sup norm. -/
instance Pi.seminormedRing {R : ι → Type*} [Fintype ι] [∀ i, SeminormedRing (R i)] :
SeminormedRing (∀ i, R i) :=
{ Pi.nonUnitalSeminormedRing, Pi.ring with }
lemma RingHom.isometry {𝕜₁ 𝕜₂ : Type*} [SeminormedRing 𝕜₁] [SeminormedRing 𝕜₂]
(σ : 𝕜₁ →+* 𝕜₂) [RingHomIsometric σ] :
Isometry σ := AddMonoidHomClass.isometry_of_norm _ fun _ => RingHomIsometric.norm_map
/-- If `σ` and `σ'` are mutually inverse, then one is `RingHomIsometric` if the other is. Not an
instance, as it would cause loops. -/
lemma RingHomIsometric.inv {𝕜₁ 𝕜₂ : Type*} [SeminormedRing 𝕜₁] [SeminormedRing 𝕜₂]
(σ : 𝕜₁ →+* 𝕜₂) {σ' : 𝕜₂ →+* 𝕜₁} [RingHomInvPair σ σ'] [RingHomIsometric σ] :
RingHomIsometric σ' :=
⟨fun {x} ↦ by rw [← RingHomIsometric.norm_map (σ := σ), RingHomInvPair.comp_apply_eq₂]⟩
end SeminormedRing
section NonUnitalNormedRing
variable [NonUnitalNormedRing α]
/-- Normed ring structure on the product of finitely many non-unital normed rings, using the sup
norm. -/
instance Pi.nonUnitalNormedRing {R : ι → Type*} [Fintype ι] [∀ i, NonUnitalNormedRing (R i)] :
NonUnitalNormedRing (∀ i, R i) :=
{ Pi.nonUnitalSeminormedRing, Pi.normedAddCommGroup with }
end NonUnitalNormedRing
section NormedRing
variable [NormedRing α]
/-- Normed ring structure on the product of finitely many normed rings, using the sup norm. -/
instance Pi.normedRing {R : ι → Type*} [Fintype ι] [∀ i, NormedRing (R i)] :
NormedRing (∀ i, R i) :=
{ Pi.seminormedRing, Pi.normedAddCommGroup with }
end NormedRing
section NonUnitalSeminormedCommRing
variable [NonUnitalSeminormedCommRing α]
/-- Non-unital seminormed commutative ring structure on the product of finitely many non-unital
seminormed commutative rings, using the sup norm. -/
instance Pi.nonUnitalSeminormedCommRing {R : ι → Type*} [Fintype ι]
[∀ i, NonUnitalSeminormedCommRing (R i)] : NonUnitalSeminormedCommRing (∀ i, R i) :=
{ Pi.nonUnitalSeminormedRing, Pi.nonUnitalCommRing with }
end NonUnitalSeminormedCommRing
section NonUnitalNormedCommRing
variable [NonUnitalNormedCommRing α]
/-- Normed commutative ring structure on the product of finitely many non-unital normed
commutative rings, using the sup norm. -/
instance Pi.nonUnitalNormedCommRing {R : ι → Type*} [Fintype ι]
[∀ i, NonUnitalNormedCommRing (R i)] : NonUnitalNormedCommRing (∀ i, R i) :=
{ Pi.nonUnitalSeminormedCommRing, Pi.normedAddCommGroup with }
end NonUnitalNormedCommRing
section SeminormedCommRing
variable [SeminormedCommRing α]
/-- Seminormed commutative ring structure on the product of finitely many seminormed commutative
rings, using the sup norm. -/
instance Pi.seminormedCommRing {R : ι → Type*} [Fintype ι] [∀ i, SeminormedCommRing (R i)] :
SeminormedCommRing (∀ i, R i) :=
{ Pi.nonUnitalSeminormedCommRing, Pi.ring with }
end SeminormedCommRing
section NormedCommRing
variable [NormedCommRing α]
/-- Normed commutative ring structure on the product of finitely many normed commutative rings,
using the sup norm. -/
instance Pi.normedCommutativeRing {R : ι → Type*} [Fintype ι] [∀ i, NormedCommRing (R i)] :
NormedCommRing (∀ i, R i) :=
{ Pi.seminormedCommRing, Pi.normedAddCommGroup with }
end NormedCommRing
-- see Note [lower instance priority]
instance (priority := 100) NonUnitalSeminormedRing.toContinuousMul [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 [mul_sub, sub_mul, sub_add_sub_cancel]
_ ≤ ‖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 tendsto_const_nhds)
simp⟩
-- see Note [lower instance priority]
/-- A seminormed ring is a topological ring. -/
instance (priority := 100) NonUnitalSeminormedRing.toIsTopologicalRing [NonUnitalSeminormedRing α] :
IsTopologicalRing α where
namespace SeparationQuotient
instance [NonUnitalSeminormedRing α] : NonUnitalNormedRing (SeparationQuotient α) where
__ : NonUnitalRing (SeparationQuotient α) := inferInstance
__ : NormedAddCommGroup (SeparationQuotient α) := inferInstance
norm_mul_le := Quotient.ind₂ norm_mul_le
instance [NonUnitalSeminormedCommRing α] : NonUnitalNormedCommRing (SeparationQuotient α) where
__ : NonUnitalCommRing (SeparationQuotient α) := inferInstance
__ : NormedAddCommGroup (SeparationQuotient α) := inferInstance
norm_mul_le := Quotient.ind₂ norm_mul_le
instance [SeminormedRing α] : NormedRing (SeparationQuotient α) where
__ : Ring (SeparationQuotient α) := inferInstance
__ : NormedAddCommGroup (SeparationQuotient α) := inferInstance
norm_mul_le := Quotient.ind₂ norm_mul_le
instance [SeminormedCommRing α] : NormedCommRing (SeparationQuotient α) where
__ : CommRing (SeparationQuotient α) := inferInstance
__ : NormedAddCommGroup (SeparationQuotient α) := inferInstance
norm_mul_le := Quotient.ind₂ norm_mul_le
instance [SeminormedAddCommGroup α] [One α] [NormOneClass α] :
NormOneClass (SeparationQuotient α) where
norm_one := norm_one (α := α)
end SeparationQuotient
namespace NNReal
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.prodMap isometry_subtype_coe
convert (((LipschitzWith.prod_fst.comp this.lipschitz).sub
(LipschitzWith.prod_snd.comp this.lipschitz)).max_const 0)
norm_num
end NNReal
instance Int.instNormedCommRing : NormedCommRing ℤ where
__ := instCommRing
__ := instNormedAddCommGroup
norm_mul_le m n := by simp only [norm, Int.cast_mul, abs_mul, le_rfl]
instance Int.instNormOneClass : NormOneClass ℤ :=
⟨by simp [← Int.norm_cast_real]⟩
instance Int.instNormMulClass : NormMulClass ℤ :=
⟨fun a b ↦ by simp [← Int.norm_cast_real, abs_mul]⟩
section NonUnitalNormedRing
variable [NonUnitalNormedRing α] [NormMulClass α] {a : α}
lemma antilipschitzWith_mul_left {a : α} (ha : a ≠ 0) : AntilipschitzWith (‖a‖₊⁻¹) (a * ·) :=
AntilipschitzWith.of_le_mul_dist fun _ _ ↦ by simp [dist_eq_norm, ← 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, ← sub_mul, mul_comm, ha]
/-- Multiplication by a nonzero element `a` on the left, as a `Dilation` of a ring with a strictly
multiplicative norm. -/
@[simps!]
def Dilation.mulLeft (a : α) (ha : a ≠ 0) : α →ᵈ α where
toFun b := a * b
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 `Dilation` of a ring with a strictly
multiplicative norm. -/
@[simps!]
def Dilation.mulRight (a : α) (ha : a ≠ 0) : α →ᵈ α where
toFun b := b * a
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 (Dilation.mulLeft a ha)
@[simp]
lemma comap_mul_right_cobounded {a : α} (ha : a ≠ 0) :
comap (· * a) (cobounded α) = cobounded α :=
Dilation.comap_cobounded (Dilation.mulRight a ha)
end Filter
end NonUnitalNormedRing |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Ring/InfiniteSum.lean | import Mathlib.Analysis.Normed.Group.InfiniteSum
import Mathlib.Topology.Algebra.InfiniteSum.Real
import Mathlib.Analysis.Normed.Ring.Lemmas
/-! # 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.lean` (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 Topology
open Finset Filter
/-! ### 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
theorem summable_mul_of_summable_norm' {f : ι → R} {g : ι' → R}
(hf : Summable fun x => ‖f x‖) (h'f : Summable f)
(hg : Summable fun x => ‖g x‖) (h'g : Summable g) :
Summable fun x : ι × ι' => f x.1 * g x.2 := by
classical
suffices HasSum (fun x : ι × ι' => f x.1 * g x.2) ((∑' i, f i) * (∑' j, g j)) from this.summable
let s : Finset ι × Finset ι' → Finset (ι × ι') := fun p ↦ p.1 ×ˢ p.2
apply hasSum_of_subseq_of_summable (hf.mul_norm hg) tendsto_finset_prod_atTop
rw [← prod_atTop_atTop_eq]
have := Tendsto.prodMap h'f.hasSum h'g.hasSum
rw [← nhds_prod_eq] at this
convert ((continuous_mul (M := R)).continuousAt
(x := (∑' (i : ι), f i, ∑' (j : ι'), g j))).tendsto.comp this with p
simp [sum_product, ← mul_sum, ← sum_mul]
/-- Product of two infinite sums indexed by arbitrary types.
See also `tsum_mul_tsum` if `f` and `g` are *not* absolutely summable, and
`tsum_mul_tsum_of_summable_norm'` when the space is not complete. -/
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 :=
hf.of_norm.tsum_mul_tsum hg.of_norm (summable_mul_of_summable_norm hf hg)
theorem tsum_mul_tsum_of_summable_norm' {f : ι → R} {g : ι' → R}
(hf : Summable fun x => ‖f x‖) (h'f : Summable f)
(hg : Summable fun x => ‖g x‖) (h'g : Summable g) :
((∑' x, f x) * ∑' y, g y) = ∑' z : ι × ι', f z.1 * g z.2 :=
h'f.tsum_mul_tsum h'g (summable_mul_of_summable_norm' hf h'f hg h'g)
/-! ### `ℕ`-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
theorem summable_sum_mul_antidiagonal_of_summable_norm' {f g : ℕ → R}
(hf : Summable fun x => ‖f x‖) (h'f : Summable f)
(hg : Summable fun x => ‖g x‖) (h'g : Summable g) :
Summable fun n => ∑ kl ∈ antidiagonal n, f kl.1 * g kl.2 :=
summable_sum_mul_antidiagonal_of_summable_mul (summable_mul_of_summable_norm' hf h'f hg h'g)
/-- 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, and `tsum_mul_tsum_eq_tsum_sum_antidiagonal_of_summable_norm'`
when the space is not complete. -/
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 :=
hf.of_norm.tsum_mul_tsum_eq_tsum_sum_antidiagonal hg.of_norm (summable_mul_of_summable_norm hf hg)
theorem tsum_mul_tsum_eq_tsum_sum_antidiagonal_of_summable_norm' {f g : ℕ → R}
(hf : Summable fun x => ‖f x‖) (h'f : Summable f)
(hg : Summable fun x => ‖g x‖) (h'g : Summable g) :
((∑' n, f n) * ∑' n, g n) = ∑' n, ∑ kl ∈ antidiagonal n, f kl.1 * g kl.2 :=
h'f.tsum_mul_tsum_eq_tsum_sum_antidiagonal h'g (summable_mul_of_summable_norm' hf h'f hg h'g)
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
theorem summable_sum_mul_range_of_summable_norm' {f g : ℕ → R}
(hf : Summable fun x => ‖f x‖) (h'f : Summable f)
(hg : Summable fun x => ‖g x‖) (h'g : Summable g) :
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_sum_mul_antidiagonal_of_summable_norm' hf h'f hg h'g
/-- 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, and `tsum_mul_tsum_eq_tsum_sum_range_of_summable_norm'` when the
space is not complete. -/
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
theorem hasSum_sum_range_mul_of_summable_norm [CompleteSpace R] {f g : ℕ → R}
(hf : Summable fun x => ‖f x‖) (hg : Summable fun x => ‖g x‖) :
HasSum (fun n ↦ ∑ k ∈ range (n + 1), f k * g (n - k)) ((∑' n, f n) * ∑' n, g n) := by
convert (summable_norm_sum_mul_range_of_summable_norm hf hg).of_norm.hasSum
exact tsum_mul_tsum_eq_tsum_sum_range_of_summable_norm hf hg
theorem tsum_mul_tsum_eq_tsum_sum_range_of_summable_norm' {f g : ℕ → R}
(hf : Summable fun x => ‖f x‖) (h'f : Summable f)
(hg : Summable fun x => ‖g x‖) (h'g : Summable g) :
((∑' 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 h'f hg h'g
theorem hasSum_sum_range_mul_of_summable_norm' {f g : ℕ → R}
(hf : Summable fun x => ‖f x‖) (h'f : Summable f)
(hg : Summable fun x => ‖g x‖) (h'g : Summable g) :
HasSum (fun n ↦ ∑ k ∈ range (n + 1), f k * g (n - k)) ((∑' n, f n) * ∑' n, g n) := by
convert (summable_sum_mul_range_of_summable_norm' hf h'f hg h'g).hasSum
exact tsum_mul_tsum_eq_tsum_sum_range_of_summable_norm' hf h'f hg h'g
end Nat
lemma summable_of_absolute_convergence_real {f : ℕ → ℝ} :
(∃ r, Tendsto (fun n ↦ ∑ i ∈ range n, |f i|) atTop (𝓝 r)) → Summable f
| ⟨r, hr⟩ => by
refine .of_norm ⟨r, (hasSum_iff_tendsto_nat_of_nonneg ?_ _).2 ?_⟩
· exact fun i ↦ norm_nonneg _
· simpa only using hr |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Ring/Ultra.lean | import Mathlib.Analysis.Normed.Ring.Basic
import Mathlib.Analysis.Normed.Group.Ultra
/-!
# Ultrametric norms on rings where the norm of one is one
This file contains results on the behavior of norms in ultrametric normed rings.
The norm must send one to one.
## Main results
* `norm_intCast_le_one`:
the norm of the image of an integer in the ring is always less than or equal to one
## Implementation details
A `[NormedRing R]` only assumes a submultiplicative norm and does not have `[NormOneClass R]`.
The weakest ring-like structure that has a bundled norm such that `‖1‖ = 1` is
`[NormedDivisionRing K]`.
Since the statements below hold in any context, we can state them
in an unbundled fashion using `[NormOneClass R]`.
In fact one can actually prove all these lemmas only assuming
`{R : Type*} [SeminormedAddGroup R] [One R] [NormOneClass R] [IsUltrametricDist R]`.
But one has to give the typeclass machinery a little help in order to get it to recognise that there
is a coercion from `ℕ` or `ℤ` to `R`.
Instead, we use weakest pre-existing typeclass that implies both
`[SeminormedAddGroup R]` and `[AddGroupWithOne R]`, which is `[SeminormedRing R]`.
## Tags
ultrametric, nonarchimedean
-/
open Metric NNReal
namespace IsUltrametricDist
section NormOneClass
variable {R : Type*} [SeminormedRing R] [NormOneClass R] [IsUltrametricDist R]
lemma norm_add_one_le_max_norm_one (x : R) :
‖x + 1‖ ≤ max ‖x‖ 1 := by
simpa only [le_max_iff, norm_one] using norm_add_le_max x 1
lemma nnnorm_add_one_le_max_nnnorm_one (x : R) :
‖x + 1‖₊ ≤ max ‖x‖₊ 1 :=
norm_add_one_le_max_norm_one _
variable (R)
lemma nnnorm_natCast_le_one (n : ℕ) :
‖(n : R)‖₊ ≤ 1 := by
induction n with
| zero => simp only [Nat.cast_zero, nnnorm_zero, zero_le]
| succ n hn => simpa only [Nat.cast_add, Nat.cast_one, hn, max_eq_right] using
nnnorm_add_one_le_max_nnnorm_one (n : R)
lemma norm_natCast_le_one (n : ℕ) :
‖(n : R)‖ ≤ 1 :=
nnnorm_natCast_le_one R n
lemma nnnorm_intCast_le_one (z : ℤ) :
‖(z : R)‖₊ ≤ 1 := by
cases z <;>
simpa only [Int.ofNat_eq_coe, Int.cast_natCast, Int.cast_negSucc, Nat.cast_one, nnnorm_neg]
using nnnorm_natCast_le_one _ _
lemma norm_intCast_le_one (z : ℤ) :
‖(z : R)‖ ≤ 1 :=
nnnorm_intCast_le_one _ z
end NormOneClass
end IsUltrametricDist |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Ring/Basic.lean | import Mathlib.Algebra.Algebra.Subalgebra.Basic
import Mathlib.Analysis.Normed.Group.Constructions
import Mathlib.Analysis.Normed.Group.Subgroup
import Mathlib.Analysis.Normed.Group.Submodule
/-!
# Normed rings
In this file we define (semi)normed rings. We also prove some theorems about these definitions.
A normed ring instance can be constructed from a given real absolute value on a ring via
`AbsoluteValue.toNormedRing`.
-/
-- Guard against import creep.
assert_not_exists AddChar comap_norm_atTop DilationEquiv Finset.sup_mul_le_mul_sup_of_nonneg
IsOfFinOrder Isometry.norm_map_of_map_one NNReal.isOpen_Ico_zero Rat.norm_cast_real
RestrictScalars
variable {G α β ι : Type*}
open Filter
open scoped Topology NNReal
/-- 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. -/
protected norm_mul_le : ∀ 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_le : ∀ 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_le : ∀ 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_le : ∀ a b, norm (a * b) ≤ norm a * norm b
-- 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 α, NonUnitalCommRing α where
-- see Note [lower instance priority]
attribute [instance 100] NonUnitalSeminormedCommRing.toNonUnitalCommRing
/-- 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 α, NonUnitalCommRing α where
-- see Note [lower instance priority]
attribute [instance 100] NonUnitalNormedCommRing.toNonUnitalCommRing
-- 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 α, CommRing α where
-- see Note [lower instance priority]
attribute [instance 100] SeminormedCommRing.toCommRing
/-- 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 α, CommRing α where
-- see Note [lower instance priority]
attribute [instance 100] NormedCommRing.toCommRing
-- 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_le _ _ := by simp }
section NormOneClass
/-- 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
section SeminormedAddCommGroup
variable [SeminormedAddCommGroup G] [One G] [NormOneClass G]
@[simp] lemma nnnorm_one : ‖(1 : G)‖₊ = 1 := NNReal.eq norm_one
@[simp] lemma enorm_one : ‖(1 : G)‖ₑ = 1 := by simp [enorm]
theorem NormOneClass.nontrivial : Nontrivial G :=
nontrivial_of_ne 0 1 <| ne_of_apply_ne norm <| by simp
end SeminormedAddCommGroup
end NormOneClass
-- 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 α] {a a₁ a₂ b c : α}
/-- The norm is submultiplicative. -/
theorem norm_mul_le (a b : α) : ‖a * b‖ ≤ ‖a‖ * ‖b‖ :=
NonUnitalSeminormedRing.norm_mul_le a b
theorem nnnorm_mul_le (a b : α) : ‖a * b‖₊ ≤ ‖a‖₊ * ‖b‖₊ := norm_mul_le a b
lemma norm_mul_le_of_le {r₁ r₂ : ℝ} (h₁ : ‖a₁‖ ≤ r₁) (h₂ : ‖a₂‖ ≤ r₂) : ‖a₁ * a₂‖ ≤ r₁ * r₂ :=
(norm_mul_le ..).trans <| mul_le_mul h₁ h₂ (norm_nonneg _) ((norm_nonneg _).trans h₁)
lemma nnnorm_mul_le_of_le {r₁ r₂ : ℝ≥0} (h₁ : ‖a₁‖₊ ≤ r₁) (h₂ : ‖a₂‖₊ ≤ r₂) :
‖a₁ * a₂‖₊ ≤ r₁ * r₂ := (nnnorm_mul_le ..).trans <| mul_le_mul' h₁ h₂
lemma norm_mul₃_le : ‖a * b * c‖ ≤ ‖a‖ * ‖b‖ * ‖c‖ := norm_mul_le_of_le (norm_mul_le ..) le_rfl
lemma nnnorm_mul₃_le : ‖a * b * c‖₊ ≤ ‖a‖₊ * ‖b‖₊ * ‖c‖₊ :=
nnnorm_mul_le_of_le (norm_mul_le ..) le_rfl
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 β
/-- 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_le 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_le 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_le 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_le 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 }
instance MulOpposite.instNonUnitalSeminormedRing : NonUnitalSeminormedRing αᵐᵒᵖ where
__ := instNonUnitalRing
__ := instSeminormedAddCommGroup
norm_mul_le := MulOpposite.rec' fun x ↦ MulOpposite.rec' fun y ↦
(norm_mul_le y x).trans_eq (mul_comm _ _)
end NonUnitalSeminormedRing
section SeminormedRing
variable [SeminormedRing α] {a b c : α}
/-- 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_le 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_le 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 := ‖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]
lemma norm_natAbs (z : ℤ) :
‖(z.natAbs : α)‖ = ‖(z : α)‖ := by
rcases z.natAbs_eq with hz | hz
· rw [← Int.cast_natCast, ← hz]
· rw [← Int.cast_natCast, ← norm_neg, ← Int.cast_neg, ← hz]
lemma nnnorm_natAbs (z : ℤ) :
‖(z.natAbs : α)‖₊ = ‖(z : α)‖₊ := by
simp [← NNReal.coe_inj, - Nat.cast_natAbs, norm_natAbs]
@[simp] lemma norm_intCast_abs (z : ℤ) :
‖((|z| : ℤ) : α)‖ = ‖(z : α)‖ := by
simp [← norm_natAbs]
@[simp] lemma nnnorm_intCast_abs (z : ℤ) :
‖((|z| : ℤ) : α)‖₊ = ‖(z : α)‖₊ := by
simp [← nnnorm_natAbs]
/-- 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 [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 [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 }
instance MulOpposite.instSeminormedRing : SeminormedRing αᵐᵒᵖ where
__ := instRing
__ := instNonUnitalSeminormedRing
/-- This inequality is particularly useful when `c = 1` and `‖a‖ = ‖b‖ = 1` as it then shows that
chord length is a metric on the unit complex numbers. -/
lemma norm_sub_mul_le (ha : ‖a‖ ≤ 1) : ‖c - a * b‖ ≤ ‖c - a‖ + ‖1 - b‖ :=
calc
_ ≤ ‖c - a‖ + ‖a * (1 - b)‖ := by
simpa [mul_one_sub] using norm_sub_le_norm_sub_add_norm_sub c a (a * b)
_ ≤ ‖c - a‖ + ‖a‖ * ‖1 - b‖ := by gcongr; exact norm_mul_le ..
_ ≤ ‖c - a‖ + 1 * ‖1 - b‖ := by gcongr
_ = ‖c - a‖ + ‖1 - b‖ := by simp
/-- This inequality is particularly useful when `c = 1` and `‖a‖ = ‖b‖ = 1` as it then shows that
chord length is a metric on the unit complex numbers. -/
lemma norm_sub_mul_le' (hb : ‖b‖ ≤ 1) : ‖c - a * b‖ ≤ ‖1 - a‖ + ‖c - b‖ := by
rw [add_comm]; exact norm_sub_mul_le (α := αᵐᵒᵖ) hb
/-- This inequality is particularly useful when `c = 1` and `‖a‖ = ‖b‖ = 1` as it then shows that
chord length is a metric on the unit complex numbers. -/
lemma nnnorm_sub_mul_le (ha : ‖a‖₊ ≤ 1) : ‖c - a * b‖₊ ≤ ‖c - a‖₊ + ‖1 - b‖₊ := norm_sub_mul_le ha
/-- This inequality is particularly useful when `c = 1` and `‖a‖ = ‖b‖ = 1` as it then shows that
chord length is a metric on the unit complex numbers. -/
lemma nnnorm_sub_mul_le' (hb : ‖b‖₊ ≤ 1) : ‖c - a * b‖₊ ≤ ‖1 - a‖₊ + ‖c - b‖₊ := norm_sub_mul_le' hb
lemma norm_commutator_units_sub_one_le (a b : αˣ) :
‖(a * b * a⁻¹ * b⁻¹).val - 1‖ ≤ 2 * ‖a⁻¹.val‖ * ‖b⁻¹.val‖ * ‖a.val - 1‖ * ‖b.val - 1‖ :=
calc
‖(a * b * a⁻¹ * b⁻¹).val - 1‖ = ‖(a * b - b * a) * a⁻¹.val * b⁻¹.val‖ := by simp [sub_mul, *]
_ ≤ ‖(a * b - b * a : α)‖ * ‖a⁻¹.val‖ * ‖b⁻¹.val‖ := norm_mul₃_le
_ = ‖(a - 1 : α) * (b - 1) - (b - 1) * (a - 1)‖ * ‖a⁻¹.val‖ * ‖b⁻¹.val‖ := by
simp_rw [sub_one_mul, mul_sub_one]; abel_nf
_ ≤ (‖(a - 1 : α) * (b - 1)‖ + ‖(b - 1 : α) * (a - 1)‖) * ‖a⁻¹.val‖ * ‖b⁻¹.val‖ := by
gcongr; exact norm_sub_le ..
_ ≤ (‖a.val - 1‖ * ‖b.val - 1‖ + ‖b.val - 1‖ * ‖a.val - 1‖) * ‖a⁻¹.val‖ * ‖b⁻¹.val‖ := by
gcongr <;> exact norm_mul_le ..
_ = 2 * ‖a⁻¹.val‖ * ‖b⁻¹.val‖ * ‖a.val - 1‖ * ‖b.val - 1‖ := by ring
lemma nnnorm_commutator_units_sub_one_le (a b : αˣ) :
‖(a * b * a⁻¹ * b⁻¹).val - 1‖₊ ≤ 2 * ‖a⁻¹.val‖₊ * ‖b⁻¹.val‖₊ * ‖a.val - 1‖₊ * ‖b.val - 1‖₊ := by
simpa using norm_commutator_units_sub_one_le a b
/-- A homomorphism `f` between semi_normed_rings is bounded if there exists a positive
constant `C` such that for all `x` in `α`, `norm (f x) ≤ C * norm x`. -/
def RingHom.IsBounded {α : Type*} [SeminormedRing α] {β : Type*} [SeminormedRing β]
(f : α →+* β) : Prop :=
∃ C : ℝ, 0 < C ∧ ∀ x : α, norm (f x) ≤ C * norm x
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 }
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 }
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 }
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 }
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 }
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 }
instance MulOpposite.instNormedCommRing : NormedCommRing αᵐᵒᵖ where
__ := instNormedRing
__ := instSeminormedCommRing
/-- The restriction of a power-multiplicative function to a subalgebra is power-multiplicative. -/
theorem IsPowMul.restriction {R S : Type*} [CommRing R] [Ring S] [Algebra R S]
(A : Subalgebra R S) {f : S → ℝ} (hf_pm : IsPowMul f) :
IsPowMul fun x : A => f x.val := fun x n hn => by
simpa using hf_pm (↑x) hn
end NormedCommRing
instance Real.normedCommRing : NormedCommRing ℝ :=
{ Real.normedAddCommGroup, Real.commRing with norm_mul_le x y := (abs_mul x y).le }
namespace NNReal
open NNReal
theorem norm_eq (x : ℝ≥0) : ‖(x : ℝ)‖ = x := by rw [Real.norm_eq_abs, x.abs_eq]
@[simp] lemma nnnorm_eq (x : ℝ≥0) : ‖(x : ℝ)‖₊ = x := by ext; simp [nnnorm]
@[simp] lemma enorm_eq (x : ℝ≥0) : ‖(x : ℝ)‖ₑ = x := by simp [enorm]
end NNReal
/-- A restatement of `MetricSpace.tendsto_atTop` in terms of the norm. -/
theorem NormedAddCommGroup.tendsto_atTop [Nonempty α] [Preorder α] [IsDirected α (· ≤ ·)]
{β : 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 α] [Preorder α] [IsDirected α (· ≤ ·)]
[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])
section RingHomIsometric
variable {R₁ 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. -/
norm_map : ∀ {x : R₁}, ‖σ x‖ = ‖x‖
@[deprecated (since := "2025-08-03")] alias RingHomIsometric.is_iso := RingHomIsometric.norm_map
attribute [simp] RingHomIsometric.norm_map
@[simp]
theorem RingHomIsometric.nnnorm_map [SeminormedRing R₁] [SeminormedRing R₂] (σ : R₁ →+* R₂)
[RingHomIsometric σ] (x : R₁) : ‖σ x‖₊ = ‖x‖₊ :=
NNReal.eq norm_map
@[simp]
theorem RingHomIsometric.enorm_map [SeminormedRing R₁] [SeminormedRing R₂] (σ : R₁ →+* R₂)
[RingHomIsometric σ] (x : R₁) : ‖σ x‖ₑ = ‖x‖ₑ :=
congrArg ENNReal.ofNNReal <| nnnorm_map σ x
variable [SeminormedRing R₁]
instance RingHomIsometric.ids : RingHomIsometric (RingHom.id R₁) :=
⟨rfl⟩
end RingHomIsometric
section NormMulClass
/-- A mixin class for strict multiplicativity of the norm, `‖a * b‖ = ‖a‖ * ‖b‖` (rather than
`≤` as in the definition of `NormedRing`). Many `NormedRing`s satisfy this stronger property,
including all `NormedDivisionRing`s and `NormedField`s. -/
class NormMulClass (α : Type*) [Norm α] [Mul α] : Prop where
/-- The norm is multiplicative. -/
protected norm_mul : ∀ (a b : α), ‖a * b‖ = ‖a‖ * ‖b‖
@[simp] lemma norm_mul [Norm α] [Mul α] [NormMulClass α] (a b : α) :
‖a * b‖ = ‖a‖ * ‖b‖ :=
NormMulClass.norm_mul a b
section SeminormedAddCommGroup
variable [SeminormedAddCommGroup α] [Mul α] [NormMulClass α] (a b : α)
@[simp] lemma nnnorm_mul : ‖a * b‖₊ = ‖a‖₊ * ‖b‖₊ := NNReal.eq <| norm_mul a b
@[simp] lemma enorm_mul : ‖a * b‖ₑ = ‖a‖ₑ * ‖b‖ₑ := by simp [enorm]
end SeminormedAddCommGroup
section SeminormedRing
variable [SeminormedRing α] [NormOneClass α] [NormMulClass α]
/-- `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
@[simp] lemma enorm_pow (a : α) (n : ℕ) : ‖a ^ n‖ₑ = ‖a‖ₑ ^ n := by simp [enorm]
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) _
end SeminormedRing
section SeminormedCommRing
variable [SeminormedCommRing α] [NormMulClass α] [NormOneClass α]
@[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 SeminormedCommRing
section NormedAddCommGroup
variable [NormedAddCommGroup α] [MulOneClass α] [NormMulClass α] [Nontrivial α]
/-- Deduce `NormOneClass` from `NormMulClass` under a suitable nontriviality hypothesis. Not
an instance, in order to avoid loops with `NormOneClass.nontrivial`. -/
lemma NormMulClass.toNormOneClass : NormOneClass α where
norm_one := by
obtain ⟨u, hu⟩ := exists_ne (0 : α)
simpa [mul_eq_left₀ (norm_ne_zero_iff.mpr hu)] using (norm_mul u 1).symm
end NormedAddCommGroup
section NormedRing
variable [NormedRing α] [NormMulClass α]
instance NormMulClass.isAbsoluteValue_norm : IsAbsoluteValue (norm : α → ℝ) where
abv_nonneg' := norm_nonneg
abv_eq_zero' := norm_eq_zero
abv_add' := norm_add_le
abv_mul' := norm_mul
instance NormMulClass.toNoZeroDivisors : NoZeroDivisors α where
eq_zero_or_eq_zero_of_mul_eq_zero h := by
simpa only [← norm_eq_zero (E := α), norm_mul, mul_eq_zero] using h
end NormedRing
end NormMulClass
/-! ### Induced normed structures -/
section Induced
variable {F : Type*} (R S : Type*) [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_le x y := show ‖f _‖ ≤ _ from (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 }
/-- 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 _ :=
let _ : SeminormedRing R := SeminormedRing.induced R S f
{ norm_one := (congr_arg norm (map_one f)).trans norm_one }
/-- 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 NormMulClass.induced {F : Type*} (R S : Type*) [Ring R] [SeminormedRing S]
[NormMulClass S] [FunLike F R S] [RingHomClass F R S] (f : F) :
@NormMulClass R (SeminormedRing.induced R S f).toNorm _ :=
let _ : SeminormedRing R := SeminormedRing.induced R S f
{ norm_mul x y := (congr_arg norm (map_mul f x y)).trans <| norm_mul _ _ }
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 }
instance toNormOneClass [SeminormedRing R] [NormOneClass R] [SubringClass S R] (s : S) :
NormOneClass s :=
.induced s R <| SubringClass.subtype _
instance toNormMulClass [SeminormedRing R] [NormMulClass R] [SubringClass S R] (s : S) :
NormMulClass s :=
.induced s R <| SubringClass.subtype _
end SubringClass
namespace AbsoluteValue
/-- A real absolute value on a ring determines a `NormedRing` structure. -/
noncomputable def toNormedRing {R : Type*} [Ring R] (v : AbsoluteValue R ℝ) : NormedRing R where
norm := v
dist x y := v (x - y)
dist_eq _ _ := rfl
dist_self x := by simp only [sub_self, map_zero]
dist_comm := v.map_sub
dist_triangle := v.sub_le
edist_dist x y := rfl
norm_mul_le x y := (v.map_mul x y).le
eq_of_dist_eq_zero := by simp only [AbsoluteValue.map_sub_eq_zero_iff, imp_self, implies_true]
end AbsoluteValue |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Ring/WithAbs.lean | import Mathlib.Analysis.Normed.Ring.Basic
import Mathlib.Topology.Algebra.Ring.Basic
/-!
# WithAbs
`WithAbs v` is a type synonym for a semiring `R` which depends on an absolute value. The point of
this is to allow the type class inference system to handle multiple sources of instances that
arise from absolute values.
## Main definitions
- `WithAbs` : type synonym for a semiring which depends on an absolute value. This is
a function that takes an absolute value on a semiring and returns the semiring. This can be used
to assign and infer instances on a semiring that depend on absolute values.
- `WithAbs.equiv v` : the canonical (type) equivalence between `WithAbs v` and `R`.
- `WithAbs.ringEquiv v` : The canonical ring equivalence between `WithAbs v` and `R`.
-/
open Topology
noncomputable section
variable {R S : Type*} [Semiring S] [PartialOrder S]
/-- Type synonym for a semiring which depends on an absolute value. This is a function that takes
an absolute value on a semiring and returns the semiring. We use this to assign and infer instances
on a semiring that depend on absolute values.
This is also helpful when dealing with several absolute values on the same semiring. -/
@[nolint unusedArguments]
def WithAbs [Semiring R] : AbsoluteValue R S → Type _ := fun _ => R
namespace WithAbs
section semiring
variable [Semiring R] (v : AbsoluteValue R S)
instance instNontrivial [Nontrivial R] : Nontrivial (WithAbs v) := inferInstanceAs (Nontrivial R)
instance instUnique [Unique R] : Unique (WithAbs v) := inferInstanceAs (Unique R)
instance instSemiring : Semiring (WithAbs v) := inferInstanceAs (Semiring R)
instance instInhabited : Inhabited (WithAbs v) := ⟨0⟩
/-- The canonical (semiring) equivalence between `WithAbs v` and `R`. -/
def equiv : WithAbs v ≃+* R := RingEquiv.refl _
/-- The canonical (semiring) equivalence between `WithAbs v` and `WithAbs w`, for any two
absolute values `v` and `w` on `R`. -/
def equivWithAbs (v w : AbsoluteValue R S) : WithAbs v ≃+* WithAbs w :=
(WithAbs.equiv v).trans <| (WithAbs.equiv w).symm
theorem equivWithAbs_symm (v w : AbsoluteValue R S) :
(equivWithAbs v w).symm = equivWithAbs w v := rfl
@[simp]
theorem equiv_equivWithAbs_symm_apply {v w : AbsoluteValue R S} {x : WithAbs w} :
equiv v ((equivWithAbs v w).symm x) = equiv w x := rfl
@[simp]
theorem equivWithAbs_equiv_symm_apply {v w : AbsoluteValue R S} {x : R} :
equivWithAbs v w ((equiv v).symm x) = (equiv w).symm x := rfl
@[simp]
theorem equivWithAbs_symm_equiv_symm_apply {v w : AbsoluteValue R S} {x : R} :
(equivWithAbs v w).symm ((equiv w).symm x) = (equiv v).symm x := rfl
end semiring
section more_instances
instance instCommSemiring [CommSemiring R] (v : AbsoluteValue R S) : CommSemiring (WithAbs v) :=
inferInstanceAs (CommSemiring R)
instance instRing [Ring R] (v : AbsoluteValue R S) : Ring (WithAbs v) := inferInstanceAs (Ring R)
instance instCommRing [CommRing R] (v : AbsoluteValue R S) : CommRing (WithAbs v) :=
inferInstanceAs (CommRing R)
instance normedRing [Ring R] (v : AbsoluteValue R ℝ) : NormedRing (WithAbs v) :=
v.toNormedRing
lemma norm_eq_abv [Ring R] (v : AbsoluteValue R ℝ) (x : WithAbs v) :
‖x‖ = v (WithAbs.equiv v x) := rfl
end more_instances
section module
variable {R' : Type*} [Semiring R]
instance instModule_left [AddCommGroup R'] [Module R R'] (v : AbsoluteValue R S) :
Module (WithAbs v) R' :=
inferInstanceAs <| Module R R'
instance instModule_right [Semiring R'] [Module R R'] (v : AbsoluteValue R' S) :
Module R (WithAbs v) :=
inferInstanceAs <| Module R R'
end module
section algebra
variable {R' : Type*} [CommSemiring R] [Semiring R'] [Algebra R R']
instance instAlgebra_left (v : AbsoluteValue R S) : Algebra (WithAbs v) R' :=
inferInstanceAs <| Algebra R R'
theorem algebraMap_left_apply (v : AbsoluteValue R S) (x : WithAbs v) :
algebraMap (WithAbs v) R' x = algebraMap R R' (WithAbs.equiv v x) := rfl
instance instAlgebra_right (v : AbsoluteValue R' S) : Algebra R (WithAbs v) :=
inferInstanceAs <| Algebra R R'
theorem algebraMap_right_apply (v : AbsoluteValue R' S) (x : R) :
algebraMap R (WithAbs v) x = WithAbs.equiv v (algebraMap R R' x) := rfl
theorem equiv_algebraMap_apply (v : AbsoluteValue R S) (w : AbsoluteValue R' S) (x : WithAbs v) :
equiv w (algebraMap (WithAbs v) (WithAbs w) x) = algebraMap R R' (equiv v x) := rfl
/-- The canonical algebra isomorphism from an `R`-algebra `R'` with an absolute value `v`
to `R'`. -/
def algEquiv (v : AbsoluteValue R' S) : (WithAbs v) ≃ₐ[R] R' := AlgEquiv.refl (A₁ := R')
end algebra
end WithAbs
namespace AbsoluteValue
variable {K L S : Type*} [CommRing K] [IsSimpleRing K] [CommRing L] [Algebra K L] [PartialOrder S]
[Nontrivial L] [Semiring S] (w : AbsoluteValue L S) (v : AbsoluteValue K S)
/-- An absolute value `w` of `L / K` lies over the absolute value `v` of `K` if `v` is the
restriction of `w` to `K`. -/
class LiesOver : Prop where
comp_eq' : w.comp (algebraMap K L).injective = v
variable [w.LiesOver v]
theorem LiesOver.comp_eq : w.comp (algebraMap K L).injective = v := LiesOver.comp_eq'
end AbsoluteValue |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Ring/Units.lean | import Mathlib.Analysis.SpecificLimits.Normed
import Mathlib.Topology.Algebra.Ring.Ideal
import Mathlib.RingTheory.Ideal.Nonunits
/-!
# The group of units of a complete normed ring
This file contains the basic theory for the group of units (invertible elements) of a complete
normed ring (Banach algebras being a notable special case).
## Main results
The constructions `Units.add` and `Units.ofNearby` (based on `Units.oneSub` defined elsewhere)
state, in varying forms, that perturbations of a unit are units. They are not stated
in their optimal form; more precise versions would use the spectral radius.
The first main result is `Units.isOpen`: the group of units of a normed ring with summable
geometric series is an open subset of the ring.
The function `Ring.inverse` (defined elsewhere), for a ring `R`, sends `a : R` to `a⁻¹` if `a` is a
unit and `0` if not. The other major results of this file (notably `NormedRing.inverse_add`,
`NormedRing.inverse_add_norm` and `NormedRing.inverse_add_norm_diff_nth_order`) cover the asymptotic
properties of `Ring.inverse (x + t)` as `t → 0`.
-/
noncomputable section
open Topology
variable {R : Type*} [NormedRing R] [HasSummableGeomSeries R]
namespace Units
/-- In a normed ring with summable geometric series, a perturbation of a unit `x` by an
element `t` of distance less than `‖x⁻¹‖⁻¹` from `x` is a unit.
Here we construct its `Units` structure. -/
@[simps! val]
def add (x : Rˣ) (t : R) (h : ‖t‖ < ‖(↑x⁻¹ : R)‖⁻¹) : Rˣ :=
Units.copy -- to make `add_val` true definitionally, for convenience
(x * Units.oneSub (-((x⁻¹).1 * t)) (by
nontriviality R using zero_lt_one
have hpos : 0 < ‖(↑x⁻¹ : R)‖ := Units.norm_pos x⁻¹
calc
‖-(↑x⁻¹ * t)‖ = ‖↑x⁻¹ * t‖ := by rw [norm_neg]
_ ≤ ‖(↑x⁻¹ : R)‖ * ‖t‖ := norm_mul_le (x⁻¹).1 _
_ < ‖(↑x⁻¹ : R)‖ * ‖(↑x⁻¹ : R)‖⁻¹ := by nlinarith only [h, hpos]
_ = 1 := mul_inv_cancel₀ (ne_of_gt hpos)))
(x + t) (by simp [mul_add]) _ rfl
/-- In a normed ring with summable geometric series, an element `y` of distance less
than `‖x⁻¹‖⁻¹` from `x` is a unit. Here we construct its `Units` structure. -/
@[simps! val]
def ofNearby (x : Rˣ) (y : R) (h : ‖y - x‖ < ‖(↑x⁻¹ : R)‖⁻¹) : Rˣ :=
(x.add (y - x : R) h).copy y (by simp) _ rfl
/-- The group of units of a normed ring with summable geometric series is an open subset
of the ring. -/
protected theorem isOpen : IsOpen { x : R | IsUnit x } := by
nontriviality R
rw [Metric.isOpen_iff]
rintro _ ⟨x, rfl⟩
refine ⟨‖(↑x⁻¹ : R)‖⁻¹, _root_.inv_pos.mpr (Units.norm_pos x⁻¹), fun y hy ↦ ?_⟩
rw [mem_ball_iff_norm] at hy
exact (x.ofNearby y hy).isUnit
protected theorem nhds (x : Rˣ) : { x : R | IsUnit x } ∈ 𝓝 (x : R) :=
IsOpen.mem_nhds Units.isOpen x.isUnit
end Units
namespace nonunits
/-- The `nonunits` in a normed ring with summable geometric series are contained in the
complement of the ball of radius `1` centered at `1 : R`. -/
theorem subset_compl_ball : nonunits R ⊆ (Metric.ball (1 : R) 1)ᶜ := fun x hx h₁ ↦ hx <|
sub_sub_self 1 x ▸ (Units.oneSub (1 - x) (by rwa [mem_ball_iff_norm'] at h₁)).isUnit
-- The `nonunits` in a normed ring with summable geometric series are a closed set
protected theorem isClosed : IsClosed (nonunits R) :=
Units.isOpen.isClosed_compl
end nonunits
namespace NormedRing
open Asymptotics Filter Metric Finset Ring
theorem inverse_one_sub (t : R) (h : ‖t‖ < 1) : inverse (1 - t) = ↑(Units.oneSub t h)⁻¹ := by
rw [← inverse_unit (Units.oneSub t h), Units.val_oneSub]
/-- The formula `Ring.inverse (x + t) = Ring.inverse (1 + x⁻¹ * t) * x⁻¹` holds for `t` sufficiently
small. -/
theorem inverse_add (x : Rˣ) :
∀ᶠ t in 𝓝 0, inverse ((x : R) + t) = inverse (1 + ↑x⁻¹ * t) * ↑x⁻¹ := by
nontriviality R
rw [Metric.eventually_nhds_iff]
refine ⟨‖(↑x⁻¹ : R)‖⁻¹, by cancel_denoms, fun t ht ↦ ?_⟩
rw [dist_zero_right] at ht
rw [← x.val_add t ht, inverse_unit, Units.add, Units.copy_eq, mul_inv_rev, Units.val_mul,
← inverse_unit, Units.val_oneSub, sub_neg_eq_add]
theorem inverse_one_sub_nth_order' (n : ℕ) {t : R} (ht : ‖t‖ < 1) :
inverse ((1 : R) - t) = (∑ i ∈ range n, t ^ i) + t ^ n * inverse (1 - t) :=
have := _root_.summable_geometric_of_norm_lt_one ht
calc inverse (1 - t) = ∑' i : ℕ, t ^ i := inverse_one_sub t ht
_ = ∑ i ∈ range n, t ^ i + ∑' i : ℕ, t ^ (i + n) := (this.sum_add_tsum_nat_add _).symm
_ = (∑ i ∈ range n, t ^ i) + t ^ n * inverse (1 - t) := by
simp only [inverse_one_sub t ht, add_comm _ n, pow_add, this.tsum_mul_left]; rfl
theorem inverse_one_sub_nth_order (n : ℕ) :
∀ᶠ t in 𝓝 0, inverse ((1 : R) - t) = (∑ i ∈ range n, t ^ i) + t ^ n * inverse (1 - t) :=
Metric.eventually_nhds_iff.2 ⟨1, one_pos, fun t ht ↦ inverse_one_sub_nth_order' n <| by
rwa [← dist_zero_right]⟩
/-- The formula
`Ring.inverse (x + t) =
(∑ i ∈ Finset.range n, (- x⁻¹ * t) ^ i) * x⁻¹ + (- x⁻¹ * t) ^ n * Ring.inverse (x + t)`
holds for `t` sufficiently small. -/
theorem inverse_add_nth_order (x : Rˣ) (n : ℕ) :
∀ᶠ t in 𝓝 0, inverse ((x : R) + t) =
(∑ i ∈ range n, (-↑x⁻¹ * t) ^ i) * ↑x⁻¹ + (-↑x⁻¹ * t) ^ n * inverse (x + t) := by
have hzero : Tendsto (-(↑x⁻¹ : R) * ·) (𝓝 0) (𝓝 0) :=
(mulLeft_continuous _).tendsto' _ _ <| mul_zero _
filter_upwards [inverse_add x, hzero.eventually (inverse_one_sub_nth_order n)] with t ht ht'
rw [neg_mul, sub_neg_eq_add] at ht'
conv_lhs => rw [ht, ht', add_mul, ← neg_mul, mul_assoc]
rw [ht]
theorem inverse_one_sub_norm : (fun t : R => inverse (1 - t)) =O[𝓝 0] (fun _t => 1 : R → ℝ) := by
simp only [IsBigO, IsBigOWith, Metric.eventually_nhds_iff]
refine ⟨‖(1 : R)‖ + 1, (2 : ℝ)⁻¹, by simp, fun t ht ↦ ?_⟩
rw [dist_zero_right] at ht
have ht' : ‖t‖ < 1 := by linarith
simp only [inverse_one_sub t ht', norm_one, mul_one]
change ‖∑' n : ℕ, t ^ n‖ ≤ _
have := tsum_geometric_le_of_norm_lt_one t ht'
have : (1 - ‖t‖)⁻¹ ≤ 2 := inv_le_of_inv_le₀ (by simp) (by linarith)
linarith
/-- The function `fun t ↦ inverse (x + t)` is O(1) as `t → 0`. -/
theorem inverse_add_norm (x : Rˣ) : (fun t : R => inverse (↑x + t)) =O[𝓝 0] fun _t => (1 : ℝ) := by
refine EventuallyEq.trans_isBigO (inverse_add x) (one_mul (1 : ℝ) ▸ ?_)
simp only [← sub_neg_eq_add, ← neg_mul]
have hzero : Tendsto (-(↑x⁻¹ : R) * ·) (𝓝 0) (𝓝 0) :=
(mulLeft_continuous _).tendsto' _ _ <| mul_zero _
exact (inverse_one_sub_norm.comp_tendsto hzero).mul (isBigO_const_const _ one_ne_zero _)
/-- The function
`fun t ↦ Ring.inverse (x + t) - (∑ i ∈ Finset.range n, (- x⁻¹ * t) ^ i) * x⁻¹`
is `O(t ^ n)` as `t → 0`. -/
theorem inverse_add_norm_diff_nth_order (x : Rˣ) (n : ℕ) :
(fun t : R => inverse (↑x + t) - (∑ i ∈ range n, (-↑x⁻¹ * t) ^ i) * ↑x⁻¹) =O[𝓝 (0 : R)]
fun t => ‖t‖ ^ n := by
refine EventuallyEq.trans_isBigO (.fun_sub (inverse_add_nth_order x n) (.refl _ _)) ?_
simp only [add_sub_cancel_left]
refine ((isBigO_refl _ _).norm_right.mul (inverse_add_norm x)).trans ?_
simp only [mul_one, isBigO_norm_left]
exact ((isBigO_refl _ _).norm_right.const_mul_left _).pow _
/-- The function `fun t ↦ Ring.inverse (x + t) - x⁻¹` is `O(t)` as `t → 0`. -/
theorem inverse_add_norm_diff_first_order (x : Rˣ) :
(fun t : R => inverse (↑x + t) - ↑x⁻¹) =O[𝓝 0] fun t => ‖t‖ := by
simpa using inverse_add_norm_diff_nth_order x 1
/-- The function `fun t ↦ Ring.inverse (x + t) - x⁻¹ + x⁻¹ * t * x⁻¹` is `O(t ^ 2)` as `t → 0`. -/
theorem inverse_add_norm_diff_second_order (x : Rˣ) :
(fun t : R => inverse (↑x + t) - ↑x⁻¹ + ↑x⁻¹ * t * ↑x⁻¹) =O[𝓝 0] fun t => ‖t‖ ^ 2 := by
convert inverse_add_norm_diff_nth_order x 2 using 2
simp only [sum_range_succ, sum_range_zero, zero_add, pow_zero, pow_one, add_mul, one_mul,
← sub_sub, neg_mul, sub_neg_eq_add]
/-- The function `Ring.inverse` is continuous at each unit of `R`. -/
theorem inverse_continuousAt (x : Rˣ) : ContinuousAt inverse (x : R) := by
have h_is_o : (fun t : R => inverse (↑x + t) - ↑x⁻¹) =o[𝓝 0] (fun _ => 1 : R → ℝ) :=
(inverse_add_norm_diff_first_order x).trans_isLittleO (isLittleO_id_const one_ne_zero).norm_left
have h_lim : Tendsto (fun y : R => y - x) (𝓝 x) (𝓝 0) := by
refine tendsto_zero_iff_norm_tendsto_zero.mpr ?_
exact tendsto_iff_norm_sub_tendsto_zero.mp tendsto_id
rw [ContinuousAt, tendsto_iff_norm_sub_tendsto_zero, inverse_unit]
simpa [Function.comp_def] using h_is_o.norm_left.tendsto_div_nhds_zero.comp h_lim
end NormedRing
namespace Units
open MulOpposite Filter NormedRing
/-- In a normed ring with summable geometric series, the coercion from `Rˣ` (equipped with the
induced topology from the embedding in `R × R`) to `R` is an open embedding. -/
theorem isOpenEmbedding_val : IsOpenEmbedding (val : Rˣ → R) where
toIsEmbedding := isEmbedding_val_mk'
(fun _ ⟨u, hu⟩ ↦ hu ▸ (inverse_continuousAt u).continuousWithinAt) Ring.inverse_unit
isOpen_range := Units.isOpen
/-- In a normed ring with summable geometric series, the coercion from `Rˣ` (equipped with the
induced topology from the embedding in `R × R`) to `R` is an open map. -/
theorem isOpenMap_val : IsOpenMap (val : Rˣ → R) :=
isOpenEmbedding_val.isOpenMap
end Units
namespace Ideal
/-- An ideal which contains an element within `1` of `1 : R` is the unit ideal. -/
theorem eq_top_of_norm_lt_one (I : Ideal R) {x : R} (hxI : x ∈ I) (hx : ‖1 - x‖ < 1) : I = ⊤ :=
let u := Units.oneSub (1 - x) hx
I.eq_top_iff_one.mpr <| by
simpa only [show u.inv * x = 1 by simp [u]] using I.mul_mem_left u.inv hxI
/-- The `Ideal.closure` of a proper ideal in a normed ring with summable
geometric series is proper. -/
theorem closure_ne_top (I : Ideal R) (hI : I ≠ ⊤) : I.closure ≠ ⊤ := by
have h := closure_minimal (coe_subset_nonunits hI) nonunits.isClosed
simpa only [I.closure.eq_top_iff_one, Ne] using mt (@h 1) one_notMem_nonunits
/-- The `Ideal.closure` of a maximal ideal in a normed ring with summable
geometric series is the ideal itself. -/
theorem IsMaximal.closure_eq {I : Ideal R} (hI : I.IsMaximal) : I.closure = I :=
(hI.eq_of_le (I.closure_ne_top hI.ne_top) subset_closure).symm
/-- Maximal ideals in normed rings with summable geometric series are closed. -/
instance IsMaximal.isClosed {I : Ideal R} [hI : I.IsMaximal] : IsClosed (I : Set R) :=
isClosed_of_closure_subset <| Eq.subset <| congr_arg ((↑) : Ideal R → Set R) hI.closure_eq
end Ideal |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Unbundled/SeminormFromConst.lean | import Mathlib.Analysis.Normed.Unbundled.RingSeminorm
/-!
# SeminormFromConst
In this file, we prove [BGR, Proposition 1.3.2/2][bosch-guntzer-remmert] : starting from a
power-multiplicative seminorm on a commutative ring `R` and a nonzero `c : R`, we create a new
power-multiplicative seminorm for which `c` is multiplicative.
## Main Definitions
* `seminormFromConst'` : the real-valued function sending `x ∈ R` to the limit of
`(f (x * c^n))/((f c)^n)`.
* `seminormFromConst` : the function `seminormFromConst'` as a `RingSeminorm` on `R`.
## Main Results
* `seminormFromConst_isNonarchimedean` : the function `seminormFromConst' hf1 hc hpm`
is nonarchimedean when f is nonarchimedean.
* `seminormFromConst_isPowMul` : the function `seminormFromConst' hf1 hc hpm`
is power-multiplicative.
* `seminormFromConst_const_mul` : for every `x : R`, `seminormFromConst' hf1 hc hpm (c * x)`
equals the product `seminormFromConst' hf1 hc hpm c * SeminormFromConst' hf1 hc hpm x`.
## References
* [S. Bosch, U. Güntzer, R. Remmert, *Non-Archimedean Analysis*][bosch-guntzer-remmert]
## Tags
SeminormFromConst, Seminorm, Nonarchimedean
-/
noncomputable section
open Filter
open scoped Topology
section Ring
variable {R : Type*} [CommRing R] (c : R) (f : RingSeminorm R)
/-- For a ring seminorm `f` on `R` and `c ∈ R`, the sequence given by `(f (x * c^n))/((f c)^n)`. -/
def seminormFromConst_seq (x : R) : ℕ → ℝ := fun n ↦ f (x * c ^ n) / f c ^ n
lemma seminormFromConst_seq_def (x : R) :
seminormFromConst_seq c f x = fun n ↦ f (x * c ^ n) / f c ^ n := rfl
/-- The terms in the sequence `seminormFromConst_seq c f x` are nonnegative. -/
theorem seminormFromConst_seq_nonneg (x : R) : 0 ≤ seminormFromConst_seq c f x :=
fun n ↦ div_nonneg (apply_nonneg f (x * c ^ n)) (pow_nonneg (apply_nonneg f c) n)
/-- The image of `seminormFromConst_seq c f x` is bounded below by zero. -/
theorem seminormFromConst_bddBelow (x : R) :
BddBelow (Set.range (seminormFromConst_seq c f x)) := by
use 0
rintro r ⟨n, rfl⟩
exact seminormFromConst_seq_nonneg c f x n
variable {f}
/-- `seminormFromConst_seq c f 0` is the constant sequence zero. -/
theorem seminormFromConst_seq_zero (hf : f 0 = 0) : seminormFromConst_seq c f 0 = 0 := by
rw [seminormFromConst_seq_def]
ext n
rw [zero_mul, hf, zero_div, Pi.zero_apply]
variable {c}
variable (hf1 : f 1 ≤ 1) (hc : f c ≠ 0) (hpm : IsPowMul f)
include hpm hc
/-- If `1 ≤ n`, then `seminormFromConst_seq c f 1 n = 1`. -/
theorem seminormFromConst_seq_one (n : ℕ) (hn : 1 ≤ n) : seminormFromConst_seq c f 1 n = 1 := by
simp only [seminormFromConst_seq]
rw [one_mul, hpm _ hn, div_self (pow_ne_zero n hc)]
include hf1
/-- `seminormFromConst_seq c f x` is antitone. -/
theorem seminormFromConst_seq_antitone (x : R) : Antitone (seminormFromConst_seq c f x) := by
intro m n hmn
simp only [seminormFromConst_seq]
nth_rw 1 [← Nat.add_sub_of_le hmn]
rw [pow_add, ← mul_assoc]
have hc_pos : 0 < f c := lt_of_le_of_ne (apply_nonneg f _) hc.symm
apply le_trans ((div_le_div_iff_of_pos_right (pow_pos hc_pos _)).mpr (map_mul_le_mul f _ _))
cases hmn.eq_or_lt with
| inl heq =>
have hnm : n - m = 0 := by rw [heq, Nat.sub_self n]
rw [hnm, heq, div_le_div_iff_of_pos_right (pow_pos hc_pos _), pow_zero]
conv_rhs => rw [← mul_one (f (x * c ^ n))]
exact mul_le_mul_of_nonneg_left hf1 (apply_nonneg f _)
| inr hlt =>
have h1 : 1 ≤ n - m := by
rw [Nat.one_le_iff_ne_zero]
exact Nat.sub_ne_zero_of_lt hlt
rw [hpm c h1, mul_div_assoc, div_eq_mul_inv, pow_sub₀ _ hc hmn, mul_assoc, mul_comm (f c ^ m)⁻¹,
← mul_assoc (f c ^ n), mul_inv_cancel₀ (pow_ne_zero n hc), one_mul, div_eq_mul_inv]
/-- The real-valued function sending `x ∈ R` to the limit of `(f (x * c^n))/((f c)^n)`. -/
def seminormFromConst' (x : R) : ℝ :=
(Real.tendsto_of_bddBelow_antitone (seminormFromConst_bddBelow c f x)
(seminormFromConst_seq_antitone hf1 hc hpm x)).choose
/-- We prove that `seminormFromConst' hf1 hc hpm x` is the limit of the sequence
`seminormFromConst_seq c f x` as `n` tends to infinity. -/
theorem seminormFromConst_isLimit (x : R) :
Tendsto (seminormFromConst_seq c f x) atTop (𝓝 (seminormFromConst' hf1 hc hpm x)) :=
(Real.tendsto_of_bddBelow_antitone (seminormFromConst_bddBelow c f x)
(seminormFromConst_seq_antitone hf1 hc hpm x)).choose_spec
/-- `seminormFromConst' hf1 hc hpm 1 = 1`. -/
theorem seminormFromConst_one : seminormFromConst' hf1 hc hpm 1 = 1 := by
apply tendsto_nhds_unique_of_eventuallyEq (seminormFromConst_isLimit hf1 hc hpm 1)
tendsto_const_nhds
simp only [EventuallyEq, eventually_atTop, ge_iff_le]
exact ⟨1, seminormFromConst_seq_one hc hpm⟩
/-- The function `seminormFromConst` is a `RingSeminorm` on `R`. -/
def seminormFromConst : RingSeminorm R where
toFun := seminormFromConst' hf1 hc hpm
map_zero' := tendsto_nhds_unique (seminormFromConst_isLimit hf1 hc hpm 0)
(by simpa [seminormFromConst_seq_zero c (map_zero _)] using tendsto_const_nhds)
add_le' x y := by
apply le_of_tendsto_of_tendsto' (seminormFromConst_isLimit hf1 hc hpm (x + y))
((seminormFromConst_isLimit hf1 hc hpm x).add (seminormFromConst_isLimit hf1 hc hpm y))
intro n
have h_add : f ((x + y) * c ^ n) ≤ f (x * c ^ n) + f (y * c ^ n) := by
simp only [add_mul, map_add_le_add f _ _]
simp only [seminormFromConst_seq, ← add_div]
gcongr
neg' x := by
apply tendsto_nhds_unique_of_eventuallyEq (seminormFromConst_isLimit hf1 hc hpm (-x))
(seminormFromConst_isLimit hf1 hc hpm x)
simp only [EventuallyEq, eventually_atTop]
use 0
simp only [seminormFromConst_seq, neg_mul, map_neg_eq_map, zero_le, implies_true]
mul_le' x y := by
have hlim : Tendsto (fun n ↦ seminormFromConst_seq c f (x * y) (2 * n)) atTop
(𝓝 (seminormFromConst' hf1 hc hpm (x * y))) := by
apply (seminormFromConst_isLimit hf1 hc hpm (x * y)).comp
(tendsto_atTop_atTop_of_monotone (fun _ _ hnm ↦ by
simp only [mul_le_mul_iff_right₀, Nat.succ_pos', hnm]) _)
· rintro n; use n; omega
refine le_of_tendsto_of_tendsto' hlim ((seminormFromConst_isLimit hf1 hc hpm x).mul
(seminormFromConst_isLimit hf1 hc hpm y)) (fun n ↦ ?_)
simp only [seminormFromConst_seq]
rw [div_mul_div_comm, ← pow_add, two_mul,
div_le_div_iff_of_pos_right (pow_pos (lt_of_le_of_ne (apply_nonneg f _) hc.symm) _), pow_add,
← mul_assoc, mul_comm (x * y), ← mul_assoc, mul_assoc, mul_comm (c ^ n)]
exact map_mul_le_mul f (x * c ^ n) (y * c ^ n)
theorem seminormFromConst_def (x : R) :
seminormFromConst hf1 hc hpm x = seminormFromConst' hf1 hc hpm x :=
rfl
/-- `seminormFromConst' hf1 hc hpm 1 ≤ 1`. -/
theorem seminormFromConst_one_le : seminormFromConst' hf1 hc hpm 1 ≤ 1 :=
le_of_eq (seminormFromConst_one hf1 hc hpm)
/-- The function `seminormFromConst' hf1 hc hpm` is nonarchimedean. -/
theorem seminormFromConst_isNonarchimedean (hna : IsNonarchimedean f) :
IsNonarchimedean (seminormFromConst' hf1 hc hpm) := fun x y ↦ by
apply le_of_tendsto_of_tendsto' (seminormFromConst_isLimit hf1 hc hpm (x + y))
((seminormFromConst_isLimit hf1 hc hpm x).max (seminormFromConst_isLimit hf1 hc hpm y))
intro n
have hmax : f ((x + y) * c ^ n) ≤ max (f (x * c ^ n)) (f (y * c ^ n)) := by
simp only [add_mul, hna _ _]
rw [le_max_iff] at hmax ⊢
unfold seminormFromConst_seq
apply hmax.imp <;> intro <;> gcongr
/-- The function `seminormFromConst' hf1 hc hpm` is power-multiplicative. -/
theorem seminormFromConst_isPowMul : IsPowMul (seminormFromConst' hf1 hc hpm) := fun x m hm ↦ by
simp only [seminormFromConst']
have hlim : Tendsto (fun n ↦ seminormFromConst_seq c f (x ^ m) (m * n)) atTop
(𝓝 (seminormFromConst' hf1 hc hpm (x ^ m))) := by
apply (seminormFromConst_isLimit hf1 hc hpm (x ^ m)).comp
(tendsto_atTop_atTop_of_monotone (fun _ _ hnk ↦ mul_le_mul_left' hnk m) _)
rintro n; use n; exact le_mul_of_one_le_left' hm
apply tendsto_nhds_unique hlim
convert (seminormFromConst_isLimit hf1 hc hpm x).pow m using 1
ext n
simp only [seminormFromConst_seq, div_pow, ← hpm _ hm, ← pow_mul, mul_pow, mul_comm m n]
/-- The function `seminormFromConst' hf1 hc hpm` is bounded above by `f`. -/
theorem seminormFromConst_le_seminorm (x : R) : seminormFromConst' hf1 hc hpm x ≤ f x := by
apply le_of_tendsto (seminormFromConst_isLimit hf1 hc hpm x)
simp only [eventually_atTop, ge_iff_le]
use 1
intro n hn
rw [seminormFromConst_seq, div_le_iff₀ (by positivity), ← hpm c hn]
exact map_mul_le_mul ..
/-- If `x : R` is multiplicative for `f`, then `seminormFromConst' hf1 hc hpm x = f x`. -/
theorem seminormFromConst_apply_of_isMul {x : R} (hx : ∀ y : R, f (x * y) = f x * f y) :
seminormFromConst' hf1 hc hpm x = f x :=
have hlim : Tendsto (seminormFromConst_seq c f x) atTop (𝓝 (f x)) := by
have hseq : seminormFromConst_seq c f x = fun _n ↦ f x := by
ext n
by_cases hn : n = 0
· simp only [seminormFromConst_seq, hn, pow_zero, mul_one, div_one]
· simp only [seminormFromConst_seq, hx (c ^ n), hpm _ (Nat.one_le_iff_ne_zero.mpr hn),
mul_div_assoc, div_self (pow_ne_zero n hc), mul_one]
rw [hseq]
exact tendsto_const_nhds
tendsto_nhds_unique (seminormFromConst_isLimit hf1 hc hpm x) hlim
/-- If `x : R` is multiplicative for `f`, then it is multiplicative for
`seminormFromConst' hf1 hc hpm`. -/
theorem seminormFromConst_isMul_of_isMul {x : R} (hx : ∀ y : R, f (x * y) = f x * f y) (y : R) :
seminormFromConst' hf1 hc hpm (x * y) =
seminormFromConst' hf1 hc hpm x * seminormFromConst' hf1 hc hpm y :=
have hlim : Tendsto (seminormFromConst_seq c f (x * y)) atTop
(𝓝 (seminormFromConst' hf1 hc hpm x * seminormFromConst' hf1 hc hpm y)) := by
rw [seminormFromConst_apply_of_isMul hf1 hc hpm hx]
have hseq : seminormFromConst_seq c f (x * y) =
fun n ↦ f x * seminormFromConst_seq c f y n := by
ext n
simp only [seminormFromConst_seq, mul_assoc, hx, mul_div_assoc]
simpa [hseq] using (seminormFromConst_isLimit hf1 hc hpm y).const_mul _
tendsto_nhds_unique (seminormFromConst_isLimit hf1 hc hpm (x * y)) hlim
/-- `seminormFromConst' hf1 hc hpm c = f c`. -/
theorem seminormFromConst_apply_c : seminormFromConst' hf1 hc hpm c = f c :=
have hlim : Tendsto (seminormFromConst_seq c f c) atTop (𝓝 (f c)) := by
have hseq : seminormFromConst_seq c f c = fun _n ↦ f c := by
ext n
simp only [seminormFromConst_seq]
rw [mul_comm, ← pow_succ, hpm _ le_add_self, pow_succ, mul_comm, mul_div_assoc,
div_self (pow_ne_zero n hc), mul_one]
rw [hseq]
exact tendsto_const_nhds
tendsto_nhds_unique (seminormFromConst_isLimit hf1 hc hpm c) hlim
/-- For every `x : R`, `seminormFromConst' hf1 hc hpm (c * x)` equals the product
`seminormFromConst' hf1 hc hpm c * SeminormFromConst' hf1 hc hpm x`. -/
theorem seminormFromConst_const_mul (x : R) :
seminormFromConst' hf1 hc hpm (c * x) =
seminormFromConst' hf1 hc hpm c * seminormFromConst' hf1 hc hpm x := by
have hlim : Tendsto (fun n ↦ seminormFromConst_seq c f x (n + 1)) atTop
(𝓝 (seminormFromConst' hf1 hc hpm x)) := by
apply (seminormFromConst_isLimit hf1 hc hpm x).comp
(tendsto_atTop_atTop_of_monotone add_left_mono _)
rintro n; use n; omega
rw [seminormFromConst_apply_c hf1 hc hpm]
apply tendsto_nhds_unique (seminormFromConst_isLimit hf1 hc hpm (c * x))
have hterm : seminormFromConst_seq c f (c * x) =
fun n ↦ f c * seminormFromConst_seq c f x (n + 1) := by
simp only [seminormFromConst_seq_def]
ext n
ring_nf
rw [mul_assoc _ (f c), mul_inv_cancel₀ hc, mul_one]
simpa [hterm] using tendsto_const_nhds.mul hlim
end Ring
section Field
variable {K : Type*} [Field K]
/-- If `K` is a field, the function `seminormFromConst` is a `RingNorm` on `K`. -/
def normFromConst {k : K} {g : RingSeminorm K} (hg1 : g 1 ≤ 1) (hg_k : g k ≠ 0)
(hg_pm : IsPowMul g) : RingNorm K :=
(seminormFromConst hg1 hg_k hg_pm).toRingNorm (RingSeminorm.ne_zero_iff.mpr
⟨k, by simpa [seminormFromConst_def, seminormFromConst_apply_c] using hg_k⟩)
theorem seminormFromConstRingNormOfField_def {k : K} {g : RingSeminorm K} (hg1 : g 1 ≤ 1)
(hg_k : g k ≠ 0) (hg_pm : IsPowMul g) (x : K) :
normFromConst hg1 hg_k hg_pm x = seminormFromConst' hg1 hg_k hg_pm x := rfl
end Field |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Unbundled/InvariantExtension.lean | import Mathlib.Analysis.Normed.Group.Ultra
import Mathlib.Analysis.Normed.Unbundled.FiniteExtension
import Mathlib.LinearAlgebra.FreeModule.Finite.Matrix
/-!
# algNormOfAlgEquiv and invariantExtension
Let `K` be a nonarchimedean normed field and `L/K` be a finite algebraic extension. In the comments,
`‖ ⬝ ‖` denotes any power-multiplicative `K`-algebra norm on `L` extending the norm on `K`.
## Main Definitions
* `IsUltrametricDist.algNormOfAlgEquiv` : given `σ : L ≃ₐ[K] L`, the function `L → ℝ` sending
`x : L` to `‖ σ x ‖` is a `K`-algebra norm on `L`.
* `IsUltrametricDist.invariantExtension` : the function `L → ℝ` sending `x : L` to the maximum of
`‖ σ x ‖` over all `σ : L ≃ₐ[K] L` is a `K`-algebra norm on `L`.
## Main Results
* `IsUltrametricDist.isPowMul_algNormOfAlgEquiv` : `algNormOfAlgEquiv` is power-multiplicative.
* `IsUltrametricDist.isNonarchimedean_algNormOfAlgEquiv` : `algNormOfAlgEquiv` is nonarchimedean.
* `IsUltrametricDist.algNormOfAlgEquiv_extends` : `algNormOfAlgEquiv` extends the norm on `K`.
* `IsUltrametricDist.isPowMul_invariantExtension` : `invariantExtension` is power-multiplicative.
* `IsUltrametricDist.isNonarchimedean_invariantExtension` : `invariantExtension` is nonarchimedean.
* `IsUltrametricDist.invariantExtension_extends` : `invariantExtension` extends the norm on `K`.
## References
* [S. Bosch, U. Güntzer, R. Remmert, *Non-Archimedean Analysis*][bosch-guntzer-remmert]
## Tags
algNormOfAlgEquiv, invariantExtension, norm, nonarchimedean
-/
open scoped NNReal
noncomputable section
variable {K : Type*} [NormedField K] {L : Type*} [Field L] [Algebra K L]
[h_fin : FiniteDimensional K L] [hu : IsUltrametricDist K]
namespace IsUltrametricDist
section algNormOfAlgEquiv
/-- Given a normed field `K`, a finite algebraic extension `L/K` and `σ : L ≃ₐ[K] L`, the function
`L → ℝ` sending `x : L` to `‖ σ x ‖`, where `‖ ⬝ ‖` is any power-multiplicative algebra norm on `L`
extending the norm on `K`, is an algebra norm on `K`. -/
def algNormOfAlgEquiv (σ : L ≃ₐ[K] L) :
AlgebraNorm K L where
toFun x := Classical.choose (exists_nonarchimedean_pow_mul_seminorm_of_finiteDimensional
h_fin hu.isNonarchimedean_norm) (σ x)
map_zero' := by simp
add_le' x y := by simp [map_add σ, map_add_le_add]
neg' x := by simp [map_neg σ, map_neg_eq_map]
mul_le' x y := by simp [map_mul σ, map_mul_le_mul]
smul' x y := by simp [map_smul σ, map_smul_eq_mul]
eq_zero_of_map_eq_zero' x hx := EmbeddingLike.map_eq_zero_iff.mp (eq_zero_of_map_eq_zero _ hx)
theorem algNormOfAlgEquiv_apply (σ : L ≃ₐ[K] L) (x : L) :
algNormOfAlgEquiv σ x =
Classical.choose (exists_nonarchimedean_pow_mul_seminorm_of_finiteDimensional h_fin
hu.isNonarchimedean_norm) (σ x) := rfl
/-- The algebra norm `algNormOfAlgEquiv` is power-multiplicative. -/
theorem isPowMul_algNormOfAlgEquiv (σ : L ≃ₐ[K] L) :
IsPowMul (algNormOfAlgEquiv σ) := by
intro x n hn
simp only [algNormOfAlgEquiv_apply, map_pow σ x n]
exact (Classical.choose_spec (exists_nonarchimedean_pow_mul_seminorm_of_finiteDimensional
h_fin hu.isNonarchimedean_norm)).1 _ hn
/-- The algebra norm `algNormOfAlgEquiv` is nonarchimedean. -/
theorem isNonarchimedean_algNormOfAlgEquiv (σ : L ≃ₐ[K] L) :
IsNonarchimedean (algNormOfAlgEquiv σ) := by
intro x y
simp only [algNormOfAlgEquiv_apply, map_add σ]
exact (Classical.choose_spec (exists_nonarchimedean_pow_mul_seminorm_of_finiteDimensional
h_fin hu.isNonarchimedean_norm)).2.2 _ _
/-- The algebra norm `algNormOfAlgEquiv` extends the norm on `K`. -/
theorem algNormOfAlgEquiv_extends (σ : L ≃ₐ[K] L) (x : K) :
(algNormOfAlgEquiv σ) ((algebraMap K L) x) = ‖x‖ := by
simp only [algNormOfAlgEquiv_apply, AlgEquiv.commutes]
exact (Classical.choose_spec (exists_nonarchimedean_pow_mul_seminorm_of_finiteDimensional
h_fin hu.isNonarchimedean_norm)).2.1 _
end algNormOfAlgEquiv
section invariantExtension
variable (K L)
/-- The function `L → ℝ` sending `x : L` to the maximum of `algNormOfAlgEquiv hna σ` over
all `σ : L ≃ₐ[K] L` is an algebra norm on `L`. -/
def invariantExtension : AlgebraNorm K L where
toFun x := iSup fun σ : L ≃ₐ[K] L ↦ algNormOfAlgEquiv σ x
map_zero' := by simp only [map_zero, ciSup_const]
add_le' x y := ciSup_le fun σ ↦ le_trans (map_add_le_add (algNormOfAlgEquiv σ) x y)
(add_le_add (le_ciSup_of_le (Set.finite_range _).bddAbove σ (le_refl _))
(le_ciSup_of_le (Set.finite_range _).bddAbove σ (le_refl _)))
neg' x := by simp only [map_neg_eq_map]
mul_le' x y := ciSup_le fun σ ↦ le_trans (map_mul_le_mul (algNormOfAlgEquiv σ) x y)
(mul_le_mul (le_ciSup_of_le (Set.finite_range _).bddAbove σ (le_refl _))
(le_ciSup_of_le (Set.finite_range _).bddAbove σ (le_refl _)) (apply_nonneg _ _)
(le_ciSup_of_le (Set.finite_range _).bddAbove σ (apply_nonneg _ _)))
eq_zero_of_map_eq_zero' x := by
contrapose!
exact fun hx ↦ ne_of_gt (lt_of_lt_of_le (map_pos_of_ne_zero _ hx)
(le_ciSup (Set.range fun σ : L ≃ₐ[K] L ↦ algNormOfAlgEquiv σ x).toFinite.bddAbove
AlgEquiv.refl))
smul' r x := by
simp only [AlgebraNormClass.map_smul_eq_mul,
Real.mul_iSup_of_nonneg (norm_nonneg _)]
@[simp]
theorem invariantExtension_apply (x : L) :
invariantExtension K L x = iSup fun σ : L ≃ₐ[K] L ↦ algNormOfAlgEquiv σ x :=
rfl
/-- The algebra norm `invariantExtension` is power-multiplicative. -/
theorem isPowMul_invariantExtension :
IsPowMul (invariantExtension K L) := by
intro x n hn
rw [invariantExtension_apply, invariantExtension_apply, Real.iSup_pow
(fun σ ↦ apply_nonneg (algNormOfAlgEquiv σ) x)]
exact iSup_congr fun σ ↦ isPowMul_algNormOfAlgEquiv σ _ hn
/-- The algebra norm `invariantExtension` is nonarchimedean. -/
theorem isNonarchimedean_invariantExtension :
IsNonarchimedean (invariantExtension K L) := fun x y ↦
ciSup_le fun σ ↦ le_trans (isNonarchimedean_algNormOfAlgEquiv σ x y)
(max_le_max (le_ciSup_of_le (Set.finite_range _).bddAbove σ (le_refl _))
(le_ciSup_of_le (Set.finite_range _).bddAbove σ (le_refl _)))
/-- The algebra norm `invariantExtension` extends the norm on `K`. -/
theorem invariantExtension_extends (x : K) :
(invariantExtension K L) (algebraMap K L x) = ‖x‖ := by
simp [algNormOfAlgEquiv_extends _ x, ciSup_const]
end invariantExtension
end IsUltrametricDist |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Unbundled/SmoothingSeminorm.lean | import Mathlib.Algebra.Order.GroupWithZero.Bounds
import Mathlib.Analysis.Normed.Unbundled.RingSeminorm
import Mathlib.Analysis.SpecialFunctions.Pow.Continuity
import Mathlib.Topology.MetricSpace.Sequences
import Mathlib.Topology.UnitInterval
import Mathlib.Topology.Algebra.Order.LiminfLimsup
/-!
# smoothingSeminorm
In this file, we prove [BGR, Proposition 1.3.2/1][bosch-guntzer-remmert]: if `μ` is a
nonarchimedean seminorm on a commutative ring `R`, then
`iInf (fun (n : PNat), (μ(x ^ (n : ℕ))) ^ (1 / (n : ℝ)))` is a power-multiplicative nonarchimedean
seminorm on `R`.
## Main Definitions
* `smoothingSeminormSeq` : the `ℝ`-valued sequence sending `n` to `((f( (x ^ n)) ^ (1 / n : ℝ)`.
* `smoothingFun` : the iInf of the sequence `n ↦ f(x ^ (n : ℕ))) ^ (1 / (n : ℝ)`.
* `smoothingSeminorm` : if `μ 1 ≤ 1` and `μ` is nonarchimedean, then `smoothingFun`
is a ring seminorm.
## Main Results
* `tendsto_smoothingFun_of_map_one_le_one` : if `μ 1 ≤ 1`, then `smoothingFun μ x` is the limit
of `smoothingSeminormSeq μ x` as `n` tends to infinity.
* `isNonarchimedean_smoothingFun` : if `μ 1 ≤ 1` and `μ` is nonarchimedean, then
`smoothingFun` is nonarchimedean.
* `isPowMul_smoothingFun` : if `μ 1 ≤ 1` and `μ` is nonarchimedean, then
`smoothingFun μ` is power-multiplicative.
## References
* [S. Bosch, U. Güntzer, R. Remmert, *Non-Archimedean Analysis*][bosch-guntzer-remmert]
## Tags
smoothingSeminorm, seminorm, nonarchimedean
-/
noncomputable section
open Filter Nat Real
open scoped Topology NNReal
variable {R : Type*} [CommRing R] (μ : RingSeminorm R)
section smoothingSeminorm
/-- The `ℝ`-valued sequence sending `n` to `(μ (x ^ n))^(1/n : ℝ)`. -/
abbrev smoothingSeminormSeq (x : R) : ℕ → ℝ := fun n => μ (x ^ n) ^ (1 / n : ℝ)
/-- For any positive `ε`, there exists a positive natural number `m` such that
`μ (x ^ (m : ℕ)) ^ (1 / m : ℝ) < iInf (fun (n : PNat), (μ(x ^(n : ℕ)))^(1/(n : ℝ))) + ε/2`. -/
private theorem smoothingSeminormSeq_exists_pnat (x : R) {ε : ℝ} (hε : 0 < ε) :
∃ m : PNat, μ (x ^ (m : ℕ)) ^ (1 / m : ℝ) <
(iInf fun n : PNat => μ (x ^ (n : ℕ)) ^ (1 / (n : ℝ))) + ε / 2 :=
exists_lt_of_ciInf_lt (lt_add_of_le_of_pos (le_refl _) (half_pos hε))
private theorem smoothingSeminormSeq_tendsto_aux {L : ℝ} (hL : 0 ≤ L) {ε : ℝ} (hε : 0 < ε)
{m1 : ℕ} (hm1 : 0 < m1) {x : R} (hx : μ x ≠ 0) :
Tendsto
(fun n : ℕ => (L + ε) ^ (-(((n % m1 : ℕ) : ℝ) / (n : ℝ))) * (μ x ^ (n % m1)) ^ (1 / (n : ℝ)))
atTop (𝓝 1) := by
rw [← mul_one (1 : ℝ)]
have h_exp : Tendsto (fun n : ℕ => ((n % m1 : ℕ) : ℝ) / (n : ℝ)) atTop (𝓝 0) :=
tendsto_mod_div_atTop_nhds_zero_nat hm1
apply Tendsto.mul
· have h0 : Tendsto (fun t : ℕ => -(((t % m1 : ℕ) : ℝ) / (t : ℝ))) atTop (𝓝 0) := by
rw [← neg_zero]
exact Tendsto.neg h_exp
rw [← rpow_zero (L + ε)]
apply Tendsto.rpow tendsto_const_nhds h0
rw [ne_eq, add_eq_zero_iff_of_nonneg hL (le_of_lt hε)]
exact Or.inl (not_and_of_not_right _ (ne_of_gt hε))
· simp_rw [mul_one, ← rpow_natCast, ← rpow_mul (apply_nonneg μ x), ← mul_div_assoc, mul_one,
← rpow_zero (μ x)]
exact Tendsto.rpow tendsto_const_nhds h_exp (Or.inl hx)
/-- `0` is a lower bound of `smoothingSeminormSeq`. -/
theorem zero_mem_lowerBounds_smoothingSeminormSeq_range (x : R) :
0 ∈ lowerBounds (Set.range fun n : ℕ+ => μ (x ^ (n : ℕ)) ^ (1 / (n : ℝ))) := by
rintro y ⟨n, rfl⟩
exact rpow_nonneg (apply_nonneg μ _) _
/-- `smoothingSeminormSeq` is bounded below (by zero). -/
theorem smoothingSeminormSeq_bddBelow (x : R) :
BddBelow (Set.range fun n : ℕ+ => μ (x ^ (n : ℕ)) ^ (1 / (n : ℝ))) :=
⟨0, zero_mem_lowerBounds_smoothingSeminormSeq_range μ x⟩
/-- The iInf of the sequence `n ↦ μ(x ^ (n : ℕ)))^(1 / (n : ℝ)`. -/
abbrev smoothingFun (x : R) : ℝ :=
iInf fun n : PNat => μ (x ^ (n : ℕ)) ^ (1 / (n : ℝ))
/-- If `μ x = 0`, then `smoothingFun μ x` is the limit of `smoothingSeminormSeq μ x`. -/
theorem tendsto_smoothingFun_of_eq_zero {x : R} (hx : μ x = 0) :
Tendsto (smoothingSeminormSeq μ x) atTop (𝓝 (smoothingFun μ x)) := by
have h0 (n : ℕ) (hn : 1 ≤ n) : μ (x ^ n) ^ (1 / (n : ℝ)) = 0 := by
have hμn : μ (x ^ n) = 0 := by
apply le_antisymm _ (apply_nonneg μ _)
rw [← zero_pow (pos_iff_ne_zero.mp hn), ← hx]
exact map_pow_le_pow _ x (one_le_iff_ne_zero.mp hn)
rw [hμn, zero_rpow (one_div_cast_ne_zero (one_le_iff_ne_zero.mp hn))]
have hL0 : (iInf fun n : PNat => μ (x ^ (n : ℕ)) ^ (1 / (n : ℝ))) = 0 :=
le_antisymm
(ciInf_le_of_le (smoothingSeminormSeq_bddBelow μ x) (1 : PNat) (le_of_eq (h0 1 (le_refl _))))
(le_ciInf fun n => rpow_nonneg (apply_nonneg μ _) _)
simpa only [hL0] using tendsto_atTop_of_eventually_const h0
/-- If `μ 1 ≤ 1` and `μ x ≠ 0`, then `smoothingFun μ x` is the limit of
`smoothingSeminormSeq μ x`. -/
theorem tendsto_smoothingFun_of_ne_zero (hμ1 : μ 1 ≤ 1) {x : R} (hx : μ x ≠ 0) :
Tendsto (smoothingSeminormSeq μ x) atTop (𝓝 (smoothingFun μ x)) := by
let L := iInf fun n : PNat => μ (x ^ (n : ℕ)) ^ (1 / (n : ℝ))
have hL0 : 0 ≤ L := le_ciInf fun x => rpow_nonneg (apply_nonneg _ _) _
rw [Metric.tendsto_atTop]
intro ε hε
/- For each `ε > 0`, we can find a positive natural number `m1` such that
`μ x ^ (1 / m1) < L + ε/2`. -/
obtain ⟨m1, hm1⟩ := smoothingSeminormSeq_exists_pnat μ x hε
/- For `n` large enough, we have that
`(L + ε / 2) ^ (-(n % m1) / n)) * (μ x ^ (n % m1)) ^ (1 / n) - 1 ≤ ε / (2 * (L + ε / 2))`. -/
obtain ⟨m2, hm2⟩ : ∃ m : ℕ, ∀ n ≥ m,
(L + ε / 2) ^ (-(((n % m1 : ℕ) : ℝ) / (n : ℝ))) * (μ x ^ (n % m1)) ^ (1 / (n : ℝ)) - 1 ≤
ε / (2 * (L + ε / 2)) := by
have hε2 : 0 < ε / 2 := half_pos hε
have hL2 := smoothingSeminormSeq_tendsto_aux μ hL0 hε2 (PNat.pos m1) hx
rw [Metric.tendsto_atTop] at hL2
set δ : ℝ := ε / (2 * (L + ε / 2)) with hδ_def
have hδ : 0 < δ := by
rw [hδ_def, div_mul_eq_div_mul_one_div]
exact mul_pos hε2
((one_div (L + ε / 2)).symm ▸ inv_pos_of_pos (add_pos_of_nonneg_of_pos hL0 hε2))
obtain ⟨N, hN⟩ := hL2 δ hδ
use N
intro n hn
specialize hN n hn
rw [Real.dist_eq, abs_lt] at hN
exact le_of_lt hN.right
/- We now show that for all `n ≥ max m1 m2`, we have
`dist (smoothingSeminormSeq μ x n) (smoothingFun μ x) < ε`. -/
use max (m1 : ℕ) m2
intro n hn
have hn0 : 0 < n := lt_of_lt_of_le (lt_of_lt_of_le (PNat.pos m1) (le_max_left (m1 : ℕ) m2)) hn
rw [Real.dist_eq, abs_lt]
have hL_le : L ≤ smoothingSeminormSeq μ x n := by
rw [← PNat.mk_coe n hn0]
apply ciInf_le (smoothingSeminormSeq_bddBelow μ x)
refine ⟨lt_of_lt_of_le (neg_lt_zero.mpr hε) (sub_nonneg.mpr hL_le), ?_⟩
-- It is enough to show that `smoothingSeminormSeq μ x n < L + ε`, that is,
-- `μ (x ^ n) ^ (1 / ↑n) < L + ε`.
suffices h : smoothingSeminormSeq μ x n < L + ε by rwa [tsub_lt_iff_left hL_le]
by_cases hxn : μ (x ^ (n % m1)) = 0
· /- If `μ (x ^ (n % m1)) = 0`, this reduces to showing that
`μ (x ^ (↑m1 * (n / ↑m1)) * x ^ (n % ↑m1)) ^ (1 / ↑n) ≤
(μ (x ^ (↑m1 * (n / ↑m1))) * μ (x ^ (n % ↑m1))) ^ (1 / ↑n)`, which follows from the
submultiplicativity of `μ`. -/
simp only [smoothingSeminormSeq]
nth_rw 1 [← div_add_mod n m1]
have hLε : 0 < L + ε := add_pos_of_nonneg_of_pos hL0 hε
apply lt_of_le_of_lt _ hLε
rw [pow_add, ← MulZeroClass.mul_zero (μ (x ^ ((m1 : ℕ) * (n / (m1 : ℕ)))) ^ (1 / (n : ℝ))),
← zero_rpow (one_div_cast_ne_zero (pos_iff_ne_zero.mp hn0)), ← hxn,
← mul_rpow (apply_nonneg μ _) (apply_nonneg μ _)]
exact rpow_le_rpow (apply_nonneg μ _) (map_mul_le_mul μ _ _) (one_div_cast_nonneg _)
· --Otherwise, we have `0 < μ (x ^ (n % ↑m1))`.
have hxn' : 0 < μ (x ^ (n % ↑m1)) := lt_of_le_of_ne (apply_nonneg _ _) (Ne.symm hxn)
simp only [smoothingSeminormSeq]
nth_rw 1 [← div_add_mod n m1]
/- We use the submultiplicativity of `μ` to deduce
`μ (x ^ (m1 * (n / m1)) ^ (1 / n) ≤ (μ (x ^ m1) ^ (n / m1)) ^ (1 / n)`. -/
have h : μ (x ^ ((m1 : ℕ) * (n / (m1 : ℕ)))) ^ (1 / (n : ℝ)) ≤
(μ (x ^ (m1 : ℕ)) ^ (n / (m1 : ℕ))) ^ (1 / (n : ℝ)) := by
apply rpow_le_rpow (apply_nonneg μ _) _ (one_div_cast_nonneg _)
rw [pow_mul]
exact map_pow_le_pow μ (x^(m1 : ℕ))
(pos_iff_ne_zero.mp (Nat.div_pos (le_trans (le_max_left (m1 : ℕ) m2) hn) (PNat.pos m1)))
have hL0' : 0 < L + ε / 2 := add_pos_of_nonneg_of_pos hL0 (half_pos hε)
/- We show that `(μ (x ^ (m1 : ℕ)) ^ (n / (m1 : ℕ))) ^ (1 / (n : ℝ)) <
(L + ε / 2) ^ (1 - (((n % m1 : ℕ) : ℝ) / (n : ℝ)))`. -/
have h1 : (μ (x ^ (m1 : ℕ)) ^ (n / (m1 : ℕ))) ^ (1 / (n : ℝ)) <
(L + ε / 2) * (L + ε / 2) ^ (-(((n % m1 : ℕ) : ℝ) / (n : ℝ))) := by
have hm10 : (m1 : ℝ) ≠ 0 := cast_ne_zero.mpr (_root_.ne_of_gt (PNat.pos m1))
rw [← rpow_lt_rpow_iff (rpow_nonneg (apply_nonneg μ _) _) (le_of_lt hL0')
(cast_pos.mpr (PNat.pos m1)), ← rpow_mul (apply_nonneg μ _), one_div_mul_cancel hm10,
rpow_one] at hm1
nth_rw 1 [← rpow_one (L + ε / 2)]
have : (n : ℝ) / n = (1 : ℝ) := div_self (cast_ne_zero.mpr (_root_.ne_of_gt hn0))
nth_rw 2 [← this]; clear this
nth_rw 3 [← div_add_mod n m1]
have h_lt : 0 < ((n / m1 : ℕ) : ℝ) / (n : ℝ) :=
div_pos (cast_pos.mpr (Nat.div_pos (le_trans (le_max_left _ _) hn) (PNat.pos m1)))
(cast_pos.mpr hn0)
rw [← rpow_natCast, ← rpow_add hL0', ← neg_div, ← add_div, Nat.cast_add,
add_neg_cancel_right, Nat.cast_mul, ← rpow_mul (apply_nonneg μ _), mul_one_div,
mul_div_assoc, rpow_mul (le_of_lt hL0')]
exact rpow_lt_rpow (apply_nonneg μ _) hm1 h_lt
/- We again use the submultiplicativity of `μ` to deduce
`μ (x ^ (n % m1)) ^ (1 / n) ≤ (μ x ^ (n % m1)) ^ (1 / n)`. -/
have h2 : μ (x ^ (n % m1)) ^ (1 / (n : ℝ)) ≤ (μ x ^ (n % m1)) ^ (1 / (n : ℝ)) := by
by_cases hnm1 : n % m1 = 0
· simpa [hnm1, pow_zero] using rpow_le_rpow (apply_nonneg μ _) hμ1 (one_div_cast_nonneg _)
· exact rpow_le_rpow (apply_nonneg μ _) (map_pow_le_pow μ _ hnm1) (one_div_cast_nonneg _)
/- We bound `(L + ε / 2) ^ (1 -n % m1) / n) * (μ x ^ (n % m1)) ^ (1 / n)` by `L + ε`. -/
have h3 : (L + ε / 2) * (L + ε / 2) ^ (-(((n % m1 : ℕ) : ℝ) / (n : ℝ))) *
(μ x ^ (n % m1)) ^ (1 / (n : ℝ)) ≤ L + ε := by
have heq : L + ε = L + ε / 2 + ε / 2 := by rw [add_assoc, add_halves]
rw [heq, ← tsub_le_iff_left]
nth_rw 3 [← mul_one (L + ε / 2)]
rw [mul_assoc, ← mul_sub, mul_comm, ← le_div_iff₀ hL0', div_div]
exact hm2 n (le_trans (le_max_right (m1 : ℕ) m2) hn)
have h4 : 0 < μ (x ^ (n % ↑m1)) ^ (1 / (n : ℝ)) := rpow_pos_of_pos hxn' _
have h5 : 0 < (L + ε / 2) * (L + ε / 2) ^ (-(↑(n % ↑m1) / (n : ℝ))) :=
mul_pos hL0' (rpow_pos_of_pos hL0' _)
/- We combine the previous steps to deduce that
`μ (x ^ (↑m1 * (n / ↑m1) + n % ↑m1)) ^ (1 / ↑n) < L + ε`. -/
calc μ (x ^ ((m1 : ℕ) * (n / (m1 : ℕ)) + n % m1)) ^ (1 / (n : ℝ)) =
μ (x ^ ((m1 : ℕ) * (n / (m1 : ℕ))) * x ^ (n % m1)) ^ (1 / (n : ℝ)) := by rw [pow_add]
_ ≤ (μ (x ^ ((m1 : ℕ) * (n / (m1 : ℕ)))) * μ (x ^ (n % m1))) ^ (1 / (n : ℝ)) :=
(rpow_le_rpow (apply_nonneg μ _) (map_mul_le_mul μ _ _) (one_div_cast_nonneg _))
_ = μ (x ^ ((m1 : ℕ) * (n / (m1 : ℕ)))) ^ (1 / (n : ℝ)) *
μ (x ^ (n % m1)) ^ (1 / (n : ℝ)) :=
(mul_rpow (apply_nonneg μ _) (apply_nonneg μ _))
_ ≤ (μ (x ^ (m1 : ℕ)) ^ (n / (m1 : ℕ))) ^ (1 / (n : ℝ)) *
μ (x ^ (n % m1)) ^ (1 / (n : ℝ)) := by gcongr
_ < (L + ε / 2) * (L + ε / 2) ^ (-(((n % m1 : ℕ) : ℝ) / (n : ℝ))) *
μ (x ^ (n % m1)) ^ (1 / (n : ℝ)) := by gcongr
_ ≤ (L + ε / 2) * (L + ε / 2) ^ (-(((n % m1 : ℕ) : ℝ) / (n : ℝ))) *
(μ x ^ (n % m1)) ^ (1 / (n : ℝ)) := by gcongr
_ ≤ L + ε := h3
/-- If `μ 1 ≤ 1`, then `smoothingFun μ x` is the limit of `smoothingSeminormSeq μ x`
as `n` tends to infinity. -/
theorem tendsto_smoothingFun_of_map_one_le_one (hμ1 : μ 1 ≤ 1) (x : R) :
Tendsto (smoothingSeminormSeq μ x) atTop (𝓝 (smoothingFun μ x)) := by
by_cases hx : μ x = 0
· exact tendsto_smoothingFun_of_eq_zero μ hx
· exact tendsto_smoothingFun_of_ne_zero μ hμ1 hx
/-- If `μ 1 ≤ 1`, then `smoothingFun μ x` is nonnegative. -/
theorem smoothingFun_nonneg (hμ1 : μ 1 ≤ 1) (x : R) : 0 ≤ smoothingFun μ x := by
apply ge_of_tendsto (tendsto_smoothingFun_of_map_one_le_one μ hμ1 x)
simpa [eventually_atTop, ge_iff_le] using ⟨1, fun _ _ ↦ rpow_nonneg (apply_nonneg μ _) _⟩
/-- If `μ 1 ≤ 1`, then `smoothingFun μ 1 ≤ 1`. -/
theorem smoothingFun_one_le (hμ1 : μ 1 ≤ 1) : smoothingFun μ 1 ≤ 1 := by
apply le_of_tendsto (tendsto_smoothingFun_of_map_one_le_one μ hμ1 (1 : R))
simp only [eventually_atTop, ge_iff_le]
use 1
rintro n hn
simp only [smoothingSeminormSeq]
rw [one_pow]
conv_rhs => rw [← one_rpow (1 / n : ℝ)]
have hn1 : 0 < (1 / n : ℝ) := by
apply _root_.div_pos zero_lt_one
rw [← cast_zero, cast_lt]
exact succ_le_iff.mp hn
exact (rpow_le_rpow_iff (apply_nonneg μ _) zero_le_one hn1).mpr hμ1
/-- For any `x` and any positive `n`, `smoothingFun μ x ≤ μ (x ^ (n : ℕ))^(1 / n : ℝ)`. -/
theorem smoothingFun_le (x : R) (n : PNat) :
smoothingFun μ x ≤ μ (x ^ (n : ℕ)) ^ (1 / n : ℝ) :=
ciInf_le (smoothingSeminormSeq_bddBelow μ x) _
/-- For all `x : R`, `smoothingFun μ x ≤ μ x`. -/
theorem smoothingFun_le_self (x : R) : smoothingFun μ x ≤ μ x := by
apply (smoothingFun_le μ x 1).trans
rw [PNat.one_coe, pow_one, cast_one, div_one, rpow_one]
/- In this section, we prove that if `μ` is nonarchimedean, then `smoothingFun μ` is
nonarchimedean. -/
section IsNonarchimedean
variable {x y : R} (hn : ∀ n : ℕ, ∃ m < n + 1, μ ((x + y) ^ (n : ℕ)) ^ (1 / (n : ℝ)) ≤
(μ (x ^ m) * μ (y ^ (n - m : ℕ))) ^ (1 / (n : ℝ)))
/-- Auxiliary sequence for the proof that `smoothingFun` is nonarchimedean. -/
private def mu : ℕ → ℕ := fun n => Classical.choose (hn n)
private theorem mu_property (n : ℕ) : μ ((x + y) ^ (n : ℕ)) ^ (1 / (n : ℝ)) ≤
(μ (x ^ mu μ hn n) * μ (y ^ (n - mu μ hn n : ℕ))) ^ (1 / (n : ℝ)) :=
(Classical.choose_spec (hn n)).2
private theorem mu_le (n : ℕ) : mu μ hn n ≤ n := by
simpa [mu, ← Nat.lt_succ_iff] using (Classical.choose_spec (hn n)).1
private theorem mu_bdd (n : ℕ) : (mu μ hn n : ℝ) / n ∈ Set.Icc (0 : ℝ) 1 := by
refine Set.mem_Icc.mpr ⟨div_nonneg (cast_nonneg (mu μ hn n)) (cast_nonneg n), ?_⟩
by_cases hn0 : n = 0
· rw [hn0, cast_zero, div_zero]; exact zero_le_one
· rw [div_le_one (cast_pos.mpr (Nat.pos_of_ne_zero hn0)), cast_le]
exact mu_le _ _ _
private theorem μ_bddBelow (s : ℕ → ℕ) {x : R} (ψ : ℕ → ℕ) :
BddBelow {a : ℝ |
∀ᶠ n : ℝ in map (fun n : ℕ => μ x ^ (↑(s (ψ n)) * (1 / (ψ n : ℝ)))) atTop, n ≤ a} := by
use 0
simp only [mem_lowerBounds, eventually_map, eventually_atTop, ge_iff_le, Set.mem_setOf_eq,
forall_exists_index]
intro r m hm
exact le_trans (rpow_nonneg (apply_nonneg μ _) _) (hm m (le_refl _))
private theorem μ_bddAbove (hμ1 : μ 1 ≤ 1) {s : ℕ → ℕ} (hs : ∀ n : ℕ, s n ≤ n) (x : R)
(ψ : ℕ → ℕ) : BddAbove (Set.range fun n : ℕ => μ (x ^ s (ψ n)) ^ (1 / (ψ n : ℝ))) := by
have hψ : ∀ n, 0 ≤ 1 / (ψ n : ℝ) := fun _ ↦ by simp only [one_div, inv_nonneg, cast_nonneg]
by_cases! hx : μ x ≤ 1
· use 1
simp only [mem_upperBounds, Set.mem_range, forall_exists_index]
rintro _ n rfl
apply le_trans (rpow_le_rpow (apply_nonneg _ _) (map_pow_le_pow' hμ1 _ _) (hψ n))
rw [← rpow_natCast, ← rpow_mul (apply_nonneg _ _), mul_one_div]
exact rpow_le_one (apply_nonneg _ _) hx (div_nonneg (cast_nonneg _) (cast_nonneg _))
· use μ x
simp only [mem_upperBounds, Set.mem_range, forall_exists_index]
rintro _ n rfl
apply le_trans (rpow_le_rpow (apply_nonneg _ _) (map_pow_le_pow' hμ1 _ _) (hψ n))
rw [← rpow_natCast, ← rpow_mul (apply_nonneg _ _), mul_one_div]
conv_rhs => rw [← rpow_one (μ x)]
rw [rpow_le_rpow_left_iff hx]
exact div_le_one_of_le₀ (cast_le.mpr (hs (ψ n))) (cast_nonneg _)
private theorem μ_bddAbove' (hμ1 : μ 1 ≤ 1) {s : ℕ → ℕ} (hs : ∀ n : ℕ, s n ≤ n) (x : R)
(ψ : ℕ → ℕ) : BddAbove ((fun n : ℕ => μ (x ^ s (ψ n)) ^ (1 / (ψ n : ℝ))) '' Set.univ) := by
rw [Set.image_eq_range]
convert μ_bddAbove μ hμ1 hs x ψ
ext
simp [one_div, Set.mem_range, Subtype.exists, Set.mem_univ, exists_const]
private theorem μ_nonempty {s : ℕ → ℕ} (hs_le : ∀ n : ℕ, s n ≤ n) {x : R} (ψ : ℕ → ℕ) :
{a : ℝ | ∀ᶠ n : ℝ in map (fun n : ℕ => μ x ^ (↑(s (ψ n)) * (1 / (ψ n : ℝ)))) atTop,
n ≤ a}.Nonempty := by
by_cases hμx : μ x < 1
· use 1
simp only [eventually_map, eventually_atTop, ge_iff_le, Set.mem_setOf_eq]
exact ⟨0, fun _ _ ↦ rpow_le_one (apply_nonneg _ _) (le_of_lt hμx)
(mul_nonneg (cast_nonneg _) (one_div_nonneg.mpr (cast_nonneg _)))⟩
· use μ x
simp only [eventually_map, eventually_atTop, ge_iff_le, Set.mem_setOf_eq]
use 0
intro b _
nth_rw 2 [← rpow_one (μ x)]
apply rpow_le_rpow_of_exponent_le (not_lt.mp hμx)
rw [mul_one_div]
exact div_le_one_of_le₀ (cast_le.mpr (hs_le (ψ b))) (cast_nonneg _)
private theorem μ_limsup_le_one {s : ℕ → ℕ} (hs_le : ∀ n : ℕ, s n ≤ n) {x : R} {ψ : ℕ → ℕ}
(hψ_lim : Tendsto ((fun n : ℕ => ↑(s n) / (n : ℝ)) ∘ ψ) atTop (𝓝 0)) :
limsup (fun n : ℕ => μ x ^ ((s (ψ n) : ℝ) * (1 / (ψ n : ℝ)))) atTop ≤ 1 := by
simp only [limsup, limsSup]
rw [csInf_le_iff (μ_bddBelow μ s ψ) (μ_nonempty μ hs_le ψ)]
· intro c hc_bd
simp only [mem_lowerBounds, eventually_map, eventually_atTop, ge_iff_le, Set.mem_setOf_eq,
forall_exists_index] at hc_bd
by_cases hμx : μ x < 1
· apply hc_bd (1 : ℝ) 0
intro b _
exact rpow_le_one (apply_nonneg _ _) (le_of_lt hμx)
(mul_nonneg (cast_nonneg _) (one_div_nonneg.mpr (cast_nonneg _)))
· have hμ_lim : Tendsto (fun n : ℕ => μ x ^ (↑(s (ψ n)) * (1 / (ψ n : ℝ)))) atTop (𝓝 1) := by
nth_rw 1 [← rpow_zero (μ x)]
convert Tendsto.rpow tendsto_const_nhds hψ_lim
(Or.inl (ne_of_gt (lt_of_lt_of_le zero_lt_one (not_lt.mp hμx))))
· simp only [rpow_zero, mul_one_div, Function.comp_apply]
· rw [rpow_zero]
rw [tendsto_atTop_nhds] at hμ_lim
apply le_of_forall_pos_le_add
intro ε hε
have h1 : (1 : ℝ) ∈ Set.Ioo 0 (1 + ε) := by
simp only [Set.mem_Ioo, zero_lt_one, lt_add_iff_pos_right, hε, and_self]
obtain ⟨k, hk⟩ := hμ_lim (Set.Ioo (0 : ℝ) (1 + ε)) h1 isOpen_Ioo
exact hc_bd (1 + ε) k fun b hb => le_of_lt (Set.mem_Ioo.mp (hk b hb)).2
private theorem limsup_mu_le (hμ1 : μ 1 ≤ 1) {s : ℕ → ℕ} (hs_le : ∀ n : ℕ, s n ≤ n) {x : R}
{a : ℝ} (a_in : a ∈ Set.Icc (0 : ℝ) 1) {ψ : ℕ → ℕ} (hψ_mono : StrictMono ψ)
(hψ_lim : Tendsto ((fun n : ℕ => (s n : ℝ) / ↑n) ∘ ψ) atTop (𝓝 a)) :
limsup (fun n : ℕ => μ (x ^ s (ψ n)) ^ (1 / (ψ n : ℝ))) atTop ≤ smoothingFun μ x ^ a := by
by_cases ha : a = 0
· rw [ha] at hψ_lim
calc limsup (fun n : ℕ => μ (x ^ s (ψ n)) ^ (1 / (ψ n : ℝ))) atTop ≤
limsup (fun n : ℕ => μ x ^ ((s (ψ n) : ℝ) * (1 / (ψ n : ℝ)))) atTop := by
apply csInf_le_csInf _ (μ_nonempty μ hs_le ψ)
· intro b hb
simp only [eventually_map, eventually_atTop, ge_iff_le, Set.mem_setOf_eq] at hb ⊢
obtain ⟨m, hm⟩ := hb
use m
intro k hkm
apply le_trans _ (hm k hkm)
rw [rpow_mul (apply_nonneg μ x), rpow_natCast]
exact rpow_le_rpow (apply_nonneg μ _) (map_pow_le_pow' hμ1 x _)
(one_div_nonneg.mpr (cast_nonneg _))
· use 0
simp only [mem_lowerBounds, eventually_map, eventually_atTop, ge_iff_le,
Set.mem_setOf_eq, forall_exists_index]
exact fun _ m hm ↦ le_trans (rpow_nonneg (apply_nonneg μ _) _) (hm m (le_refl _))
_ ≤ 1 := (μ_limsup_le_one μ hs_le hψ_lim)
_ = smoothingFun μ x ^ a := by rw [ha, rpow_zero]
· have ha_pos : 0 < a := lt_of_le_of_ne a_in.1 (Ne.symm ha)
have h_eq : (fun n : ℕ =>
(μ (x ^ s (ψ n)) ^ (1 / (s (ψ n) : ℝ))) ^ ((s (ψ n) : ℝ) / (ψ n : ℝ))) =ᶠ[atTop]
fun n : ℕ => μ (x ^ s (ψ n)) ^ (1 / (ψ n : ℝ)) := by
have h : (fun n : ℕ => (1 : ℝ) / (s (ψ n) : ℝ) * (s (ψ n) : ℝ)) =ᶠ[atTop] 1 := by
apply Filter.EventuallyEq.div_mul_cancel_atTop
exact (tendsto_natCast_atTop_atTop.comp hψ_mono.tendsto_atTop).num ha_pos hψ_lim
simp_rw [← rpow_mul (apply_nonneg μ _), mul_div]
exact EventuallyEq.comp₂ EventuallyEq.rfl HPow.hPow (h.div EventuallyEq.rfl)
exact ((tendsto_smoothingFun_of_map_one_le_one μ hμ1 x |>.comp <|
tendsto_natCast_atTop_iff.mp <| (tendsto_natCast_atTop_atTop.comp
hψ_mono.tendsto_atTop).num ha_pos hψ_lim).rpow
hψ_lim <| .inr ha_pos).congr' h_eq |>.limsup_eq.le
theorem tendsto_smoothingFun_comp (hμ1 : μ 1 ≤ 1) (x : R) {ψ : ℕ → ℕ}
(hψ_mono : StrictMono ψ) :
Tendsto (fun n : ℕ => μ (x ^ ψ n) ^ (1 / ψ n : ℝ)) atTop (𝓝 (smoothingFun μ x)) :=
have hψ_lim' : Tendsto ψ atTop atTop := StrictMono.tendsto_atTop hψ_mono
(tendsto_smoothingFun_of_map_one_le_one μ hμ1 x).comp hψ_lim'
/-- If `μ 1 ≤ 1` and `μ` is nonarchimedean, then `smoothingFun μ` is nonarchimedean. -/
theorem isNonarchimedean_smoothingFun (hμ1 : μ 1 ≤ 1) (hna : IsNonarchimedean μ) :
IsNonarchimedean (smoothingFun μ) := by
-- Fix `x, y : R`.
intro x y
have hn : ∀ n : ℕ, ∃ m < n + 1,
μ ((x + y) ^ (n : ℕ)) ^ (1 / (n : ℝ)) ≤ (μ (x ^ m) * μ (y ^ (n - m : ℕ))) ^ (1 / (n : ℝ)) :=
fun n => RingSeminorm.exists_index_pow_le μ hna x y n
/- For each `n : ℕ`, we find `mu n` and `nu n` such that `mu n + nu n = n` and
`μ ((x + y) ^ n) ^ (1 / n) ≤ (μ (x ^ (mu n)) * μ (y ^ (nu n))) ^ (1 / n)`. -/
let mu : ℕ → ℕ := fun n => mu μ hn n
set nu : ℕ → ℕ := fun n => n - mu n with hnu
have hmu_le : ∀ n : ℕ, mu n ≤ n := fun n => mu_le μ hn n
have hmu_bdd : ∀ n : ℕ, (mu n : ℝ) / n ∈ Set.Icc (0 : ℝ) 1 := fun n => mu_bdd μ hn n
have hs : Bornology.IsBounded (Set.Icc (0 : ℝ) 1) := Metric.isBounded_Icc 0 1
/- Since `0 ≤ (mu n) / n ≤ 1` for all `n`, we can find a subsequence `(ψ n) ⊆ ℕ` such that the
limit of `mu (ψ n) / ψ n` as `n` tends to infinity exists. We denote this limit by `a`. -/
obtain ⟨a, a_in, ψ, hψ_mono, hψ_lim⟩ := tendsto_subseq_of_bounded hs hmu_bdd
rw [closure_Icc] at a_in
/- The limit of `nu (ψ n) / ψ n` as `n` tends to infinity also exists, and it is equal to
`b := 1 - a` -/
set b := 1 - a with hb
have hb_lim : Tendsto ((fun n : ℕ => (nu n : ℝ) / ↑n) ∘ ψ) atTop (𝓝 b) := by
apply Tendsto.congr' _ (Tendsto.const_sub 1 hψ_lim)
simp only [EventuallyEq, Function.comp_apply, eventually_atTop, ge_iff_le]
use 1
intro m hm
have h0 : (ψ m : ℝ) ≠ 0 := cast_ne_zero.mpr (_root_.ne_of_gt (lt_of_le_of_lt (_root_.zero_le _)
(hψ_mono (Nat.pos_of_ne_zero (one_le_iff_ne_zero.mp hm)))))
rw [← div_self h0, ← sub_div, cast_sub (hmu_le _)]
have b_in : b ∈ Set.Icc (0 : ℝ) 1 := Set.Icc.mem_iff_one_sub_mem.mp a_in
have hnu_le : ∀ n : ℕ, nu n ≤ n := fun n => by simp only [hnu, tsub_le_self]
have hx : limsup (fun n : ℕ => μ (x ^ mu (ψ n)) ^ (1 / (ψ n : ℝ))) atTop ≤
smoothingFun μ x ^ a := limsup_mu_le μ hμ1 hmu_le a_in hψ_mono hψ_lim
have hy : limsup (fun n : ℕ => μ (y ^ nu (ψ n)) ^ (1 / (ψ n : ℝ))) atTop ≤
smoothingFun μ y ^ b :=
limsup_mu_le μ hμ1 hnu_le b_in hψ_mono hb_lim
have hxy : limsup
(fun n => μ (x ^ mu (ψ n)) ^ (1 / (ψ n : ℝ)) * μ (y ^ nu (ψ n)) ^ (1 / (ψ n : ℝ))) atTop ≤
smoothingFun μ x ^ a * smoothingFun μ y ^ b := by
have hxy' :
limsup (fun n : ℕ => μ (x ^ mu (ψ n)) ^ (1 / (ψ n : ℝ)) * μ (y ^ nu (ψ n)) ^ (1 / (ψ n : ℝ)))
atTop ≤ limsup (fun n : ℕ => μ (x ^ mu (ψ n)) ^ (1 / (ψ n : ℝ))) atTop *
limsup (fun n : ℕ => μ (y ^ nu (ψ n)) ^ (1 / (ψ n : ℝ))) atTop :=
limsup_mul_le (Frequently.of_forall (fun n => rpow_nonneg (apply_nonneg _ _) _))
(μ_bddAbove μ hμ1 hmu_le x ψ).isBoundedUnder_of_range
(Eventually.of_forall (fun n => rpow_nonneg (apply_nonneg _ _) _))
(μ_bddAbove μ hμ1 hnu_le y ψ).isBoundedUnder_of_range
have h_bdd : IsBoundedUnder LE.le atTop fun n : ℕ => μ (y ^ nu (ψ n)) ^ (1 / (ψ n : ℝ)) :=
RingSeminorm.isBoundedUnder μ hμ1 hnu_le ψ
apply le_trans hxy' (mul_le_mul hx hy (le_limsup_of_frequently_le (Frequently.of_forall
(fun n ↦ rpow_nonneg (apply_nonneg μ _) _)) h_bdd)
(rpow_nonneg (smoothingFun_nonneg μ hμ1 x) _))
apply le_of_forall_sub_le
/- Fix `ε > 0`. We first show that `smoothingFun μ x ^ a * smoothingFun μ y ^ b + ε ≤
max (smoothingFun μ x) (smoothingFun μ y) + ε`. -/
intro ε hε
rw [sub_le_iff_le_add]
have h_mul : smoothingFun μ x ^ a * smoothingFun μ y ^ b + ε ≤
max (smoothingFun μ x) (smoothingFun μ y) + ε := by
rw [max_def]
split_ifs with h
· rw [add_le_add_iff_right]
apply le_trans (mul_le_mul_of_nonneg_right
(rpow_le_rpow (smoothingFun_nonneg μ hμ1 _) h a_in.1)
(rpow_nonneg (smoothingFun_nonneg μ hμ1 _) _))
rw [hb, ← rpow_add_of_nonneg (smoothingFun_nonneg μ hμ1 _) a_in.1
(sub_nonneg.mpr a_in.2), add_sub, add_sub_cancel_left, rpow_one]
· rw [add_le_add_iff_right]
apply le_trans (mul_le_mul_of_nonneg_left
(rpow_le_rpow (smoothingFun_nonneg μ hμ1 _) (le_of_lt (not_le.mp h)) b_in.1)
(rpow_nonneg (smoothingFun_nonneg μ hμ1 _) _))
rw [hb, ← rpow_add_of_nonneg (smoothingFun_nonneg μ hμ1 _) a_in.1
(sub_nonneg.mpr a_in.2), add_sub, add_sub_cancel_left, rpow_one]
apply le_trans _ h_mul
/- We then show that there exists some natural number `N` such that
`μ (x ^ mu (ψ n)) ^ (1 / (ψ n : ℝ)) * μ (y ^ nu (ψ n)) ^ (1 / (ψ n : ℝ)) <
smoothingFun μ x ^ a * smoothingFun μ y ^ b + ε`. -/
have hex : ∃ n : PNat, μ (x ^ mu (ψ n)) ^ (1 / (ψ n : ℝ)) * μ (y ^ nu (ψ n)) ^ (1 / (ψ n : ℝ)) <
smoothingFun μ x ^ a * smoothingFun μ y ^ b + ε :=
Filter.exists_lt_of_limsup_le (bddAbove_range_mul (μ_bddAbove μ hμ1 hmu_le _ _)
(fun n => rpow_nonneg (apply_nonneg _ _) _) (μ_bddAbove μ hμ1 hnu_le _ _)
fun n => rpow_nonneg (apply_nonneg _ _) _).isBoundedUnder_of_range hxy hε
obtain ⟨N, hN⟩ := hex
/- By definition of `smoothingFun`, and applying the inequality `hN`, it suffices to show that
`μ ((x + y) ^ ψ N) ^ (1 / ψ N) ≤ μ (x ^ mu (ψ N)) ^ (1 / ψ N) * μ (y ^ nu ψ N) ^ (1 / ψ N)`. -/
apply le_trans (ciInf_le (smoothingSeminormSeq_bddBelow μ _)
⟨ψ N, lt_of_le_of_lt (_root_.zero_le (ψ 0)) (hψ_mono.lt_iff_lt.mpr N.pos)⟩)
apply le_trans _ hN.le
simpa [PNat.mk_coe, hnu, ← mul_rpow (apply_nonneg μ _) (apply_nonneg μ _)] using
mu_property μ hn (ψ N)
end IsNonarchimedean
/-- If `μ 1 ≤ 1` and `μ` is nonarchimedean, then `smoothingFun` is a ring seminorm. -/
def smoothingSeminorm (hμ1 : μ 1 ≤ 1) (hna : IsNonarchimedean μ) : RingSeminorm R where
toFun := smoothingFun μ
map_zero' := by
apply tendsto_nhds_unique_of_eventuallyEq (tendsto_smoothingFun_of_map_one_le_one μ hμ1 0)
tendsto_const_nhds
simp only [EventuallyEq, eventually_atTop, ge_iff_le]
use 1
intro n hn
simp only [smoothingSeminormSeq]
rw [zero_pow (pos_iff_ne_zero.mp hn), map_zero, zero_rpow]
exact one_div_ne_zero (cast_ne_zero.mpr (one_le_iff_ne_zero.mp hn))
add_le' _ _ := (isNonarchimedean_smoothingFun μ hμ1 hna).add_le (smoothingFun_nonneg μ hμ1)
neg' n := by
simp only [smoothingFun]
congr
ext n
rw [neg_pow]
rcases neg_one_pow_eq_or R n with hpos | hneg
· rw [hpos, one_mul]
· rw [hneg, neg_one_mul, map_neg_eq_map μ]
mul_le' x y := by
apply le_of_tendsto_of_tendsto' (tendsto_smoothingFun_of_map_one_le_one μ hμ1 (x * y))
(Tendsto.mul (tendsto_smoothingFun_of_map_one_le_one μ hμ1 x)
(tendsto_smoothingFun_of_map_one_le_one μ hμ1 y))
intro n
have hn : 0 ≤ 1 / (n : ℝ) := by simp only [one_div, inv_nonneg, cast_nonneg]
simp only [smoothingSeminormSeq]
rw [← mul_rpow (apply_nonneg μ _) (apply_nonneg μ _), mul_pow]
exact rpow_le_rpow (apply_nonneg μ _) (map_mul_le_mul μ _ _) hn
/-- If `μ 1 ≤ 1` and `μ` is nonarchimedean, then `smoothingSeminorm μ 1 ≤ 1`. -/
theorem smoothingSeminorm_map_one_le_one (hμ1 : μ 1 ≤ 1)
(hna : IsNonarchimedean μ) : smoothingSeminorm μ hμ1 hna 1 ≤ 1 :=
smoothingFun_one_le μ hμ1
/-- If `μ 1 ≤ 1` and `μ` is nonarchimedean, then `smoothingFun μ` is
power-multiplicative. -/
theorem isPowMul_smoothingFun (hμ1 : μ 1 ≤ 1) : IsPowMul (smoothingFun μ) := by
intro x m hm
have hlim : Tendsto (fun n => smoothingSeminormSeq μ x (m * n)) atTop
(𝓝 (smoothingFun μ x)) :=
Tendsto.comp (tendsto_smoothingFun_of_map_one_le_one μ hμ1 x) (tendsto_atTop_atTop_of_monotone
(fun n k hnk ↦ mul_le_mul_left' hnk m) (fun n ↦ ⟨n, le_mul_of_one_le_left' hm⟩))
apply tendsto_nhds_unique _ (Tendsto.pow hlim m)
have h_eq (n : ℕ) : smoothingSeminormSeq μ x (m * n) ^ m = smoothingSeminormSeq μ (x ^ m) n := by
have hm' : (m : ℝ) ≠ 0 := cast_ne_zero.mpr (_root_.ne_of_gt (lt_of_lt_of_le zero_lt_one hm))
simp only [smoothingSeminormSeq]
rw [pow_mul, ← rpow_natCast, ← rpow_mul (apply_nonneg μ _), cast_mul, ← one_div_mul_one_div,
mul_comm (1 / (m : ℝ)), mul_assoc, one_div_mul_cancel hm', mul_one]
simpa [h_eq] using tendsto_smoothingFun_of_map_one_le_one μ hμ1 _
/-- If `μ 1 ≤ 1` and `∀ (1 ≤ n), μ (x ^ n) = μ x ^ n`, then `smoothingFun μ x = μ x`. -/
theorem smoothingFun_of_powMul (hμ1 : μ 1 ≤ 1) {x : R}
(hx : ∀ (n : ℕ) (_hn : 1 ≤ n), μ (x ^ n) = μ x ^ n) : smoothingFun μ x = μ x := by
apply tendsto_nhds_unique_of_eventuallyEq (tendsto_smoothingFun_of_map_one_le_one μ hμ1 x)
tendsto_const_nhds
simp only [EventuallyEq, eventually_atTop, ge_iff_le]
use 1
intro n hn
simp only [smoothingSeminormSeq]
have hn0 : (n : ℝ) ≠ 0 := cast_ne_zero.mpr (one_le_iff_ne_zero.mp hn)
rw [hx n hn, ← rpow_natCast, ← rpow_mul (apply_nonneg μ _), mul_one_div_cancel hn0, rpow_one]
/-- If `μ 1 ≤ 1` and `∀ y : R, μ (x * y) = μ x * μ y`, then `smoothingFun μ x = μ x`. -/
theorem smoothingFun_apply_of_map_mul_eq_mul (hμ1 : μ 1 ≤ 1) {x : R}
(hx : ∀ y : R, μ (x * y) = μ x * μ y) : smoothingFun μ x = μ x := by
apply tendsto_nhds_unique_of_eventuallyEq (tendsto_smoothingFun_of_map_one_le_one μ hμ1 x)
tendsto_const_nhds
simp only [EventuallyEq, eventually_atTop, ge_iff_le]
use 1
intro n hn
simp only [smoothingSeminormSeq]
by_cases hx0 : μ x = 0
· have hxn : μ (x ^ n) = 0 := by
apply le_antisymm _ (apply_nonneg μ _)
apply le_trans (map_pow_le_pow μ x (one_le_iff_ne_zero.mp hn))
rw [hx0, zero_pow (pos_iff_ne_zero.mp hn)]
rw [hx0, hxn, zero_rpow (one_div_cast_ne_zero (one_le_iff_ne_zero.mp hn))]
· have h1 : μ 1 = 1 := by rw [← mul_right_inj' hx0, ← hx 1, mul_one, mul_one]
have hn0 : (n : ℝ) ≠ 0 := cast_ne_zero.mpr (_root_.ne_of_gt (lt_of_lt_of_le zero_lt_one hn))
rw [← mul_one (x ^ n), pow_mul_apply_eq_pow_mul μ hx, ← rpow_natCast, h1, mul_one,
← rpow_mul (apply_nonneg μ _), mul_one_div_cancel hn0, rpow_one]
/-- If `μ 1 ≤ 1`, `μ` is nonarchimedean, and `∀ y : R, μ (x * y) = μ x * μ y`, then
`smoothingSeminorm μ x = μ x`. -/
theorem smoothingSeminorm_apply_of_map_mul_eq_mul (hμ1 : μ 1 ≤ 1) (hna : IsNonarchimedean μ) {x : R}
(hx : ∀ y : R, μ (x * y) = μ x * μ y) : smoothingSeminorm μ hμ1 hna x = μ x :=
smoothingFun_apply_of_map_mul_eq_mul μ hμ1 hx
/-- If `μ 1 ≤ 1`, and `x` is multiplicative for `μ`, then it is multiplicative for
`smoothingFun`. -/
theorem smoothingFun_of_map_mul_eq_mul (hμ1 : μ 1 ≤ 1) {x : R} (hx : ∀ y : R, μ (x * y) = μ x * μ y)
(y : R) : smoothingFun μ (x * y) = smoothingFun μ x * smoothingFun μ y := by
have hlim : Tendsto (fun n => μ x * smoothingSeminormSeq μ y n) atTop
(𝓝 (smoothingFun μ x * smoothingFun μ y)) := by
rw [smoothingFun_apply_of_map_mul_eq_mul μ hμ1 hx]
exact Tendsto.const_mul _ (tendsto_smoothingFun_of_map_one_le_one μ hμ1 y)
apply tendsto_nhds_unique_of_eventuallyEq (tendsto_smoothingFun_of_map_one_le_one μ hμ1 (x * y))
hlim
simp only [EventuallyEq, eventually_atTop, ge_iff_le]
use 1
intro n hn1
have hn0 : (n : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr (_root_.ne_of_gt (lt_of_lt_of_le zero_lt_one hn1))
simp only [smoothingSeminormSeq]
rw [mul_pow, pow_mul_apply_eq_pow_mul μ hx, mul_rpow (pow_nonneg (apply_nonneg μ _) _)
(apply_nonneg μ _), ← rpow_natCast, ← rpow_mul (apply_nonneg μ _), mul_one_div_cancel hn0,
rpow_one]
/-- If `μ 1 ≤ 1`, `μ` is nonarchimedean, and `x` is multiplicative for `μ`, then `x` is
multiplicative for `smoothingSeminorm`. -/
theorem smoothingSeminorm_of_mul (hμ1 : μ 1 ≤ 1) (hna : IsNonarchimedean μ) {x : R}
(hx : ∀ y : R, μ (x * y) = μ x * μ y) (y : R) :
smoothingSeminorm μ hμ1 hna (x * y) =
smoothingSeminorm μ hμ1 hna x * smoothingSeminorm μ hμ1 hna y :=
smoothingFun_of_map_mul_eq_mul μ hμ1 hx y
end smoothingSeminorm |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Unbundled/IsPowMulFaithful.lean | import Mathlib.Analysis.Normed.Unbundled.AlgebraNorm
import Mathlib.Analysis.SpecialFunctions.Pow.Continuity
/-!
# Equivalent power-multiplicative norms
In this file, we prove [BGR, Proposition 3.1.5/1][bosch-guntzer-remmert]: if `R` is a normed
commutative ring and `f₁` and `f₂` are two power-multiplicative `R`-algebra norms on `S`, then if
`f₁` and `f₂` are equivalent on every subring `R[y]` for `y : S`, it follows that `f₁ = f₂`.
## Main Results
* `eq_of_powMul_faithful` : the proof of [BGR, Proposition 3.1.5/1][bosch-guntzer-remmert].
## References
* [S. Bosch, U. Güntzer, R. Remmert, *Non-Archimedean Analysis*][bosch-guntzer-remmert]
## Tags
norm, equivalent, power-multiplicative
-/
open Filter Real
open scoped Topology
/-- If `f : α →+* β` is bounded with respect to a ring seminorm `nα` on `α` and a
power-multiplicative function `nβ : β → ℝ`, then `∀ x : α, nβ (f x) ≤ nα x`. -/
theorem contraction_of_isPowMul_of_boundedWrt {F : Type*} {α : outParam (Type*)} [Ring α]
[FunLike F α ℝ] [RingSeminormClass F α ℝ] {β : Type*} [Ring β] (nα : F) {nβ : β → ℝ}
(hβ : IsPowMul nβ) {f : α →+* β} (hf : f.IsBoundedWrt nα nβ) (x : α) : nβ (f x) ≤ nα x := by
obtain ⟨C, hC0, hC⟩ := hf
have hlim : Tendsto (fun n : ℕ => C ^ (1 / (n : ℝ)) * nα x) atTop (𝓝 (nα x)) := by
nth_rewrite 2 [← one_mul (nα x)]
exact ((rpow_zero C ▸ ContinuousAt.tendsto (continuousAt_const_rpow (ne_of_gt hC0))).comp
(tendsto_const_div_atTop_nhds_zero_nat 1)).mul tendsto_const_nhds
apply ge_of_tendsto hlim
simp only [eventually_atTop, ge_iff_le]
use 1
intro n hn
have h : (C ^ (1 / n : ℝ)) ^ n = C := by
have hn0 : (n : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr (ne_of_gt hn)
rw [← rpow_natCast, ← rpow_mul (le_of_lt hC0), one_div, inv_mul_cancel₀ hn0, rpow_one]
apply le_of_pow_le_pow_left₀ (ne_of_gt hn)
(mul_nonneg (rpow_nonneg (le_of_lt hC0) _) (apply_nonneg _ _))
· rw [mul_pow, h, ← hβ _ hn, ← RingHom.map_pow]
apply le_trans (hC (x ^ n))
rw [mul_le_mul_iff_right₀ hC0]
exact map_pow_le_pow _ _ (Nat.one_le_iff_ne_zero.mp hn)
/-- Given a bounded `f : α →+* β` between seminormed rings, is the seminorm on `β` is
power-multiplicative, then `f` is a contraction. -/
theorem contraction_of_isPowMul {α β : Type*} [SeminormedRing α] [SeminormedRing β]
(hβ : IsPowMul (norm : β → ℝ)) {f : α →+* β} (hf : f.IsBounded) (x : α) : norm (f x) ≤ norm x :=
contraction_of_isPowMul_of_boundedWrt (SeminormedRing.toRingSeminorm α) hβ hf x
/-- Given two power-multiplicative ring seminorms `f, g` on `α`, if `f` is bounded by a positive
multiple of `g` and vice versa, then `f = g`. -/
theorem eq_seminorms {F : Type*} {α : outParam (Type*)} [Ring α] [FunLike F α ℝ]
[RingSeminormClass F α ℝ] {f g : F} (hfpm : IsPowMul f) (hgpm : IsPowMul g)
(hfg : ∃ (r : ℝ) (_ : 0 < r), ∀ a : α, f a ≤ r * g a)
(hgf : ∃ (r : ℝ) (_ : 0 < r), ∀ a : α, g a ≤ r * f a) : f = g := by
obtain ⟨r, hr0, hr⟩ := hfg
obtain ⟨s, hs0, hs⟩ := hgf
have hle : RingHom.IsBoundedWrt f g (RingHom.id _) := ⟨s, hs0, hs⟩
have hge : RingHom.IsBoundedWrt g f (RingHom.id _) := ⟨r, hr0, hr⟩
rw [← Function.Injective.eq_iff DFunLike.coe_injective']
ext x
exact le_antisymm (contraction_of_isPowMul_of_boundedWrt g hfpm hge x)
(contraction_of_isPowMul_of_boundedWrt f hgpm hle x)
variable {R S : Type*} [NormedCommRing R] [CommRing S] [Algebra R S]
/-- If `R` is a normed commutative ring and `f₁` and `f₂` are two power-multiplicative `R`-algebra
norms on `S`, then if `f₁` and `f₂` are equivalent on every subring `R[y]` for `y : S`, it
follows that `f₁ = f₂` [BGR, Proposition 3.1.5/1][bosch-guntzer-remmert]. -/
theorem eq_of_powMul_faithful (f₁ : AlgebraNorm R S) (hf₁_pm : IsPowMul f₁) (f₂ : AlgebraNorm R S)
(hf₂_pm : IsPowMul f₂)
(h_eq : ∀ y : S, ∃ (C₁ C₂ : ℝ) (_ : 0 < C₁) (_ : 0 < C₂),
∀ x : Algebra.adjoin R {y}, f₁ x.val ≤ C₁ * f₂ x.val ∧ f₂ x.val ≤ C₂ * f₁ x.val) :
f₁ = f₂ := by
ext x
set g₁ : AlgebraNorm R (Algebra.adjoin R ({x} : Set S)) := AlgebraNorm.restriction _ f₁
set g₂ : AlgebraNorm R (Algebra.adjoin R ({x} : Set S)) := AlgebraNorm.restriction _ f₂
have hg₁_pm : IsPowMul g₁ := IsPowMul.restriction _ hf₁_pm
have hg₂_pm : IsPowMul g₂ := IsPowMul.restriction _ hf₂_pm
let y : Algebra.adjoin R ({x} : Set S) := ⟨x, Algebra.self_mem_adjoin_singleton R x⟩
have hy : x = y.val := rfl
have h1 : f₁ y.val = g₁ y := rfl
have h2 : f₂ y.val = g₂ y := rfl
obtain ⟨C₁, C₂, hC₁_pos, hC₂_pos, hC⟩ := h_eq x
obtain ⟨hC₁, hC₂⟩ := forall_and.mp hC
rw [hy, h1, h2, eq_seminorms hg₁_pm hg₂_pm ⟨C₁, hC₁_pos, hC₁⟩ ⟨C₂, hC₂_pos, hC₂⟩] |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Unbundled/SpectralNorm.lean | import Mathlib.Analysis.Normed.Operator.BoundedLinearMaps
import Mathlib.Analysis.Normed.Unbundled.InvariantExtension
import Mathlib.Analysis.Normed.Unbundled.IsPowMulFaithful
import Mathlib.Analysis.Normed.Unbundled.SeminormFromConst
import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure
import Mathlib.FieldTheory.Normal.Closure
import Mathlib.RingTheory.Polynomial.Vieta
import Mathlib.Topology.Algebra.Module.FiniteDimension
/-!
# The spectral norm and the norm extension theorem
This file shows that if `K` is a nonarchimedean normed field and `L/K` is an algebraic extension,
then there is a natural extension of the norm on `K` to a `K`-algebra norm on `L`, the so-called
*spectral norm*. The spectral norm of an element of `L` only depends on its minimal polynomial
over `K`, so for `K ⊆ L ⊆ M` are two extensions of `K`, the spectral norm on `M` restricts to the
spectral norm on `L`. This work can be used to uniquely extend the `p`-adic norm on `ℚ_[p]` to an
algebraic closure of `ℚ_[p]`, for example.
## Details
We define the spectral value and the spectral norm. We prove the norm extension theorem
[S. Bosch, U. Güntzer, R. Remmert, *Non-Archimedean Analysis* (Theorem 3.2.1/2)]
[bosch-guntzer-remmert] : given a nonarchimedean normed field `K` and an algebraic
extension `L/K`, the spectral norm is a power-multiplicative `K`-algebra norm on `L` extending
the norm on `K`. All `K`-algebra automorphisms of `L` are isometries with respect to this norm.
If `L/K` is finite, we get a formula relating the spectral norm on `L` with any other
power-multiplicative norm on `L` extending the norm on `K`.
Moreover, we also prove the unique norm extension theorem: if `K` is a field complete with respect
to a nontrivial nonarchimedean multiplicative norm and `L/K` is an algebraic extension, then the
spectral norm on `L` is a nonarchimedean multiplicative norm, and any power-multiplicative
`K`-algebra norm on `L` coincides with the spectral norm. More over, if `L/K` is finite, then `L`
is a complete space. This result is [S. Bosch, U. Güntzer, R. Remmert, *Non-Archimedean Analysis*
(Theorem 3.2.4/2)][bosch-guntzer-remmert].
As a prerequisite, we formalize the proof of [S. Bosch, U. Güntzer, R. Remmert,
*Non-Archimedean Analysis* (Proposition 3.1.2/1)][bosch-guntzer-remmert].
## Main Definitions
* `spectralValue` : the spectral value of a polynomial in `R[X]`.
* `spectralNorm` : the spectral norm `|y|_sp` is the spectral value of the minimal polynomial
of `y : L` over `K`.
* `spectralAlgNorm` : the spectral norm is a `K`-algebra norm on `L`.
* `spectralMulAlgNorm` : the spectral norm is a multiplicative `K`-algebra norm on `L`.
## Main Results
* `norm_le_spectralNorm` : if `f` is a power-multiplicative `K`-algebra norm on `L`, then `f` is
bounded above by `spectralNorm K L`.
* `spectralNorm_eq_of_equiv` : the `K`-algebra automorphisms of `L` are isometries with respect to
the spectral norm.
* `spectralNorm_eq_iSup_of_finiteDimensional_normal` : if `L/K` is finite and normal, then
`spectralNorm K L x = iSup (fun (σ : Gal(L/K)) ↦ f (σ x))`.
* `isPowMul_spectralNorm` : the spectral norm is power-multiplicative.
* `isNonarchimedean_spectralNorm` : the spectral norm is nonarchimedean.
* `spectralNorm_extends` : the spectral norm extends the norm on `K`.
* `spectralNorm_unique` : any power-multiplicative `K`-algebra norm on `L` coincides with the
spectral norm.
* `spectralAlgNorm_mul` : the spectral norm on `L` is multiplicative.
* `spectralNorm.completeSpace` : if `L/K` is finite dimensional, then `L` is a complete space
with respect to topology induced by the spectral norm.
## References
* [S. Bosch, U. Güntzer, R. Remmert, *Non-Archimedean Analysis*][bosch-guntzer-remmert]
## Tags
spectral, spectral norm, spectral value, seminorm, norm, nonarchimedean
-/
open Polynomial
open scoped Polynomial
noncomputable section
variable {R : Type*}
section spectralValue
open Nat Real
section Seminormed
variable [SeminormedRing R]
/-- The function `ℕ → ℝ` sending `n` to `‖ p.coeff n ‖^(1/(p.natDegree - n : ℝ))`, if
`n < p.natDegree`, or to `0` otherwise. -/
def spectralValueTerms (p : R[X]) : ℕ → ℝ := fun n : ℕ ↦
if n < p.natDegree then ‖p.coeff n‖ ^ (1 / (p.natDegree - n : ℝ)) else 0
theorem spectralValueTerms_of_lt_natDegree (p : R[X]) {n : ℕ} (hn : n < p.natDegree) :
spectralValueTerms p n = ‖p.coeff n‖ ^ (1 / (p.natDegree - n : ℝ)) := by
simp [spectralValueTerms, if_pos hn]
theorem spectralValueTerms_of_natDegree_le (p : R[X]) {n : ℕ} (hn : p.natDegree ≤ n) :
spectralValueTerms p n = 0 := by simp only [spectralValueTerms, if_neg (not_lt.mpr hn)]
/-- The spectral value of a polynomial in `R[X]`, where `R` is a seminormed ring. One motivation
for the spectral value: if the norm on `R` is nonarchimedean, and if a monic polynomial
splits into linear factors, then its spectral value is the norm of its largest root.
See `max_norm_root_eq_spectralValue`. -/
def spectralValue (p : R[X]) : ℝ := iSup (spectralValueTerms p)
/-- The range of `spectralValue_terms p` is a finite set. -/
theorem spectralValueTerms_finite_range (p : R[X]) : (Set.range (spectralValueTerms p)).Finite :=
Set.Finite.subset (Set.Finite.union (Set.finite_singleton 0) <|
(Set.finite_Iio p.natDegree).image (fun n ↦ ‖p.coeff n‖ ^ (1 / (p.natDegree - n : ℝ)))) <| by
aesop (add simp [Set.range_subset_iff, spectralValueTerms])
open List in
/-- The sequence `spectralValue_terms p` is bounded above. -/
theorem spectralValueTerms_bddAbove (p : R[X]) : BddAbove (Set.range (spectralValueTerms p)) :=
(spectralValueTerms_finite_range p).bddAbove
/-- The sequence `spectralValue_terms p` is nonnegative. -/
theorem spectralValueTerms_nonneg (p : R[X]) (n : ℕ) : 0 ≤ spectralValueTerms p n := by
simp only [spectralValueTerms]
split_ifs with h
· exact rpow_nonneg (norm_nonneg _) _
· exact le_refl _
/-- The spectral value of a polynomial is nonnegative. -/
theorem spectralValue_nonneg (p : R[X]) : 0 ≤ spectralValue p :=
iSup_nonneg (spectralValueTerms_nonneg p)
variable [Nontrivial R]
/-- The polynomial `X - r` has spectral value `‖ r ‖`. -/
theorem spectralValue_X_sub_C (r : R) : spectralValue (X - C r) = ‖r‖ := by
rw [spectralValue]
unfold spectralValueTerms
simp only [natDegree_X_sub_C, lt_one_iff, coeff_sub, cast_one, one_div]
suffices (⨆ n : ℕ, ite (n = 0) ‖r‖ 0) = ‖r‖ by
rw [← this]
apply congr_arg
ext n
by_cases hn : n = 0
· rw [if_pos hn, if_pos hn, hn, cast_zero, sub_zero, coeff_X_zero, coeff_C_zero, zero_sub,
norm_neg, inv_one, rpow_one]
· rw [if_neg hn, if_neg hn]
· apply ciSup_eq_of_forall_le_of_forall_lt_exists_gt (fun n ↦ ?_)
(fun _ hx ↦ ⟨0, by simp only [if_true, hx]⟩)
split_ifs
· exact le_refl _
· exact norm_nonneg _
/-- The polynomial `X ^ n` has spectral value `0`. -/
theorem spectralValue_X_pow (n : ℕ) : spectralValue (X ^ n : R[X]) = 0 := by
rw [spectralValue]
unfold spectralValueTerms
simp_rw [coeff_X_pow n, natDegree_X_pow]
convert ciSup_const using 2
· ext m
by_cases hmn : m < n
· rw [if_pos hmn, rpow_eq_zero_iff_of_nonneg (norm_nonneg _), if_neg (_root_.ne_of_lt hmn),
norm_zero, one_div, ne_eq, inv_eq_zero, ← cast_sub (le_of_lt hmn), cast_eq_zero,
Nat.sub_eq_zero_iff_le]
exact ⟨Eq.refl _, not_le_of_gt hmn⟩
· rw [if_neg hmn]
· infer_instance
end Seminormed
section Normed
variable [NormedRing R]
/-- The spectral value of `p` equals zero if and only if `p` is of the form `X ^ n`. -/
theorem spectralValue_eq_zero_iff [Nontrivial R] {p : R[X]} (hp : p.Monic) :
spectralValue p = 0 ↔ p = X ^ p.natDegree := by
refine ⟨fun h ↦ ?_, fun h ↦ h ▸ spectralValue_X_pow p.natDegree⟩
rw [spectralValue] at h
ext n
rw [coeff_X_pow]
split_ifs with hn
· rw [hn, coeff_natDegree]; exact hp
· by_cases hn' : n < p.natDegree
· have h_le : iSup (spectralValueTerms p) ≤ 0 := h.le
have h_exp : 0 < 1 / ((p.natDegree : ℝ) - n) := by
rw [one_div_pos, ← cast_sub (le_of_lt hn'), cast_pos]
exact Nat.sub_pos_of_lt hn'
have h0 : (0 : ℝ) = 0 ^ (1 / ((p.natDegree : ℝ) - n)) := by rw [zero_rpow (ne_of_gt h_exp)]
rw [iSup, csSup_le_iff (spectralValueTerms_bddAbove p) (Set.range_nonempty _)] at h_le
specialize h_le (spectralValueTerms p n) ⟨n, rfl⟩
simp only [spectralValueTerms, if_pos hn'] at h_le
rw [h0, rpow_le_rpow_iff (norm_nonneg _) (le_refl _) h_exp] at h_le
exact norm_eq_zero.mp (le_antisymm h_le (norm_nonneg _))
· exact coeff_eq_zero_of_natDegree_lt (lt_of_le_of_ne (le_of_not_gt hn') (ne_comm.mpr hn))
end Normed
section NormedDivisionRing
variable [NormedDivisionRing R]
/-- The spectral value of a monic polynomial `P` is less than or equal to one if and only
if all of its coefficients have norm less than or equal to 1. -/
theorem spectralValue_le_one_iff {P : R[X]} (hP : Monic P) :
spectralValue P ≤ 1 ↔ ∀ n : ℕ, ‖P.coeff n‖ ≤ 1 := by
rw [spectralValue]
refine ⟨fun h n ↦ ?_, fun h ↦ ?_⟩
· obtain hPn | hPn | hPn := lt_trichotomy P.natDegree n
· simp [coeff_eq_zero_of_natDegree_lt hPn]
· rw [← hPn, hP.coeff_natDegree, norm_one]
· have : spectralValueTerms P n ≤ 1 := le_ciSup (spectralValueTerms_bddAbove P) n |>.trans h
contrapose! this
simp only [spectralValueTerms_of_lt_natDegree _ hPn]
exact Real.one_lt_rpow this (by simp [hPn])
· apply ciSup_le (fun n ↦ ?_)
rw [spectralValueTerms]
split_ifs with hn
· apply Real.rpow_le_one (norm_nonneg _) (h n)
rw [one_div_nonneg, sub_nonneg, Nat.cast_le]
exact le_of_lt hn
· exact zero_le_one
end NormedDivisionRing
end spectralValue
/- In this section we prove [S. Bosch, U. Güntzer, R. Remmert,
*Non-Archimedean Analysis* (Proposition 3.1.2/1)][bosch-guntzer-remmert]. -/
section BddBySpectralValue
open Real
variable {K : Type*} [NormedField K] {L : Type*} [Field L] [Algebra K L]
open Nat in
/-- The norm of any root of `p` is bounded by the spectral value of `p`. See
[S. Bosch, U. Güntzer, R. Remmert, *Non-Archimedean Analysis* (Proposition 3.1.2/1(1))]
[bosch-guntzer-remmert]. -/
theorem norm_root_le_spectralValue {f : AlgebraNorm K L} (hf_pm : IsPowMul f)
(hf_na : IsNonarchimedean f) {p : K[X]} (hp : p.Monic) {x : L} (hx : aeval x p = 0) :
f x ≤ spectralValue p := by
by_cases hx0 : f x = 0
· rw [hx0]; exact spectralValue_nonneg p
· by_contra h_ge
have hn_lt (n : ℕ) (hn : n < p.natDegree) : ‖p.coeff n‖ < f x ^ (p.natDegree - n) := by
have hexp : (‖p.coeff n‖ ^ (1 / (p.natDegree - n : ℝ))) ^ (p.natDegree - n) =
‖p.coeff n‖ := by
rw [← rpow_natCast, ← rpow_mul (norm_nonneg _), mul_comm, rpow_mul (norm_nonneg _),
rpow_natCast, ← cast_sub (le_of_lt hn), one_div,
pow_rpow_inv_natCast (norm_nonneg _) (_root_.ne_of_gt (tsub_pos_of_lt hn))]
have h_base : ‖p.coeff n‖ ^ (1 / (p.natDegree - n : ℝ)) < f x := by
rw [spectralValue, iSup, not_le, Set.Finite.csSup_lt_iff (spectralValueTerms_finite_range p)
(Set.range_nonempty (spectralValueTerms p))] at h_ge
have h_rg : ‖p.coeff n‖ ^ (1 / (p.natDegree - n : ℝ)) ∈
Set.range (spectralValueTerms p) := by use n; simp only [spectralValueTerms, if_pos hn]
exact h_ge (‖p.coeff n‖₊ ^ (1 / (p.natDegree - n : ℝ))) h_rg
rw [← hexp, ← rpow_natCast, ← rpow_natCast]
exact rpow_lt_rpow (rpow_nonneg (norm_nonneg _) _) h_base (cast_pos.mpr (tsub_pos_of_lt hn))
have h_deg : 0 < p.natDegree := natDegree_pos_of_monic_of_aeval_eq_zero hp hx
have h_lt : f ((Finset.range p.natDegree).sum fun i : ℕ ↦ p.coeff i • x ^ i) <
f (x ^ p.natDegree) := by
have hn' (n : ℕ) (hn : n < p.natDegree) : f (p.coeff n • x ^ n) < f (x ^ p.natDegree) := by
by_cases hn0 : n = 0
· rw [hn0, pow_zero, map_smul_eq_mul, hf_pm _ (succ_le_iff.mpr h_deg),
← Nat.sub_zero p.natDegree, ← hn0]
exact (mul_le_of_le_one_right (norm_nonneg _) hf_pm.map_one_le_one).trans_lt (hn_lt n hn)
· have : p.natDegree = p.natDegree - n + n := by rw [Nat.sub_add_cancel (le_of_lt hn)]
rw [map_smul_eq_mul, hf_pm _ (succ_le_iff.mp (pos_iff_ne_zero.mpr hn0)),
hf_pm _ (succ_le_iff.mpr h_deg), this, pow_add]
gcongr
exact hn_lt n hn
set g := fun i : ℕ ↦ p.coeff i • x ^ i
obtain ⟨m, hm_in, hm⟩ : ∃ (m : ℕ) (_ : 0 < p.natDegree → m < p.natDegree),
f ((Finset.range p.natDegree).sum g) ≤ f (g m) := by
obtain ⟨m, hm, h⟩ := IsNonarchimedean.finset_image_add hf_na g (Finset.range p.natDegree)
rw [Finset.nonempty_range_iff, ← zero_lt_iff, Finset.mem_range] at hm
exact ⟨m, hm, h⟩
exact lt_of_le_of_lt hm (hn' m (hm_in h_deg))
have h0 : f 0 ≠ 0 := by
have h_eq : f 0 = f (x ^ p.natDegree) := by
rw [← hx, aeval_eq_sum_range, Finset.sum_range_succ, add_comm, hp.coeff_natDegree,
one_smul, ← max_eq_left_of_lt h_lt]
exact IsNonarchimedean.add_eq_max_of_ne hf_na (ne_of_gt h_lt)
exact h_eq ▸ ne_of_gt (lt_of_le_of_lt (apply_nonneg _ _) h_lt)
exact h0 (map_zero _)
open Multiset
/-- If `f` is a nonarchimedean, power-multiplicative `K`-algebra norm on `L`, then the spectral
value of a polynomial `p : K[X]` that decomposes into linear factors in `L` is equal to the
maximum of the norms of the roots. See [S. Bosch, U. Güntzer, R. Remmert, *Non-Archimedean Analysis*
(Proposition 3.1.2/1(2))][bosch-guntzer-remmert]. -/
theorem max_norm_root_eq_spectralValue [DecidableEq L] {f : AlgebraNorm K L} (hf_pm : IsPowMul f)
(hf_na : IsNonarchimedean f) (hf1 : f 1 = 1) (p : K[X]) (s : Multiset L)
(hp : mapAlg K L p = (map (fun a : L ↦ X - C a) s).prod) :
(⨆ x : L, if x ∈ s then f x else 0) = spectralValue p := by
have h_le : 0 ≤ ⨆ x : L, ite (x ∈ s) (f x) 0 := by
apply iSup_nonneg (fun _ ↦ ?_)
split_ifs
exacts [apply_nonneg _ _, le_refl _]
apply le_antisymm
· apply ciSup_le (fun x ↦ ?_)
by_cases hx : x ∈ s
· have hx0 : aeval x p = 0 := aeval_root_of_mapAlg_eq_multiset_prod_X_sub_C s hx hp
rw [if_pos hx]
exact norm_root_le_spectralValue hf_pm hf_na
(monic_of_monic_mapAlg (hp ▸ monic_multisetProd_X_sub_C s)) hx0
· simp only [if_neg hx, spectralValue_nonneg _]
· apply ciSup_le (fun m ↦ ?_)
by_cases hm : m < p.natDegree
· rw [spectralValueTerms_of_lt_natDegree _ hm]
have h : 0 < (p.natDegree - m : ℝ) := by rw [sub_pos, Nat.cast_lt]; exact hm
rw [← rpow_le_rpow_iff (rpow_nonneg (norm_nonneg _) _) h_le h, ← rpow_mul (norm_nonneg _),
one_div_mul_cancel (ne_of_gt h), rpow_one, ← Nat.cast_sub (le_of_lt hm), rpow_natCast]
have hps : card s = p.natDegree := by
rw [← natDegree_map (algebraMap K L), ← mapAlg_eq_map, hp,
natDegree_multiset_prod_X_sub_C_eq_card]
have hc : ‖p.coeff m‖ = f (((mapAlg K L) p).coeff m) := by
rw [← AlgebraNorm.extends_norm hf1, mapAlg_eq_map, coeff_map]
rw [hc, hp, prod_X_sub_C_coeff s (hps ▸ le_of_lt hm)]
have h : f ((-1) ^ (card s - m) * s.esymm (card s - m)) = f (s.esymm (card s - m)) := by
rcases neg_one_pow_eq_or L (card s - m) with h1 | hn1
· rw [h1, one_mul]
· rw [hn1, neg_mul, one_mul, map_neg_eq_map]
rw [h, esymm]
obtain ⟨t, ht_card, hts, ht_ge⟩ : ∃ t : Multiset L, card t = card s - m ∧
(∀ x : L, x ∈ t → x ∈ s) ∧ f (map prod (powersetCard (card s - m) s)).sum ≤ f t.prod :=
hf_na.multiset_powerset_image_add s m
apply le_trans ht_ge
have h_pr : f t.prod ≤ (t.map f).prod := le_prod_of_submultiplicative_of_nonneg f
(apply_nonneg _) (le_of_eq hf1) (map_mul_le_mul _) t
apply le_trans h_pr
have hs_ne : s ≠ 0 :=
have hpos : 0 < s.toFinset.card := by
have hs0 : 0 < s.card := hps ▸ lt_of_le_of_lt (zero_le _) hm
obtain ⟨x, hx⟩ := card_pos_iff_exists_mem.mp hs0
exact Finset.card_pos.mpr ⟨x, mem_toFinset.mpr hx⟩
toFinset_nonempty.mp (Finset.card_pos.mp hpos)
obtain ⟨y, hyx, hy_max⟩ : ∃ y : L, y ∈ s ∧ ∀ z : L, z ∈ s → f z ≤ f y :=
exists_max_image f hs_ne
have : (map f t).prod ≤ f y ^ (p.natDegree - m) := by
set g : L → NNReal := fun x ↦ ⟨f x, apply_nonneg f x⟩
have h_card : p.natDegree - m = card (t.map g) := by rw [card_map, ht_card, ← hps]
have hx_le : ∀ x : NNReal, x ∈ map g t → x ≤ g y := by
intro r hr
obtain ⟨_, hzt, hzr⟩ := mem_map.mp hr
exact hzr ▸ hy_max _ (hts _ hzt)
have : (map g t).prod ≤ g y ^ (p.natDegree - m) := h_card ▸ prod_le_pow_card _ _ hx_le
simpa [g, ← NNReal.coe_le_coe, NNReal.coe_pow, NNReal.coe_mk, NNReal.coe_multiset_prod,
map_map, Function.comp_apply, NNReal.coe_mk] using this
have h_bdd : BddAbove (Set.range fun x : L ↦ ite (x ∈ s) (f x) 0) := by
use f y
intro r hr
obtain ⟨z, hz⟩ := Set.mem_range.mpr hr
simp only at hz
rw [← hz]
split_ifs with h
· exact hy_max _ h
· exact apply_nonneg _ _
exact le_trans this (pow_le_pow_left₀ (apply_nonneg _ _)
(le_trans (by rw [if_pos hyx]) (le_ciSup h_bdd y)) _)
· simp only [spectralValueTerms, if_neg hm, h_le]
end BddBySpectralValue
section spectralNorm
section NormedField
/- In this section we prove [S. Bosch, U. Güntzer, R. Remmert, *Non-Archimedean Analysis*
(Theorem 3.2.1/2)][bosch-guntzer-remmert]. -/
open IntermediateField
variable (K : Type*) [NormedField K] (L : Type*) [Field L] [Algebra K L]
/-- If `L` is an algebraic extension of a normed field `K` and `y : L` then the spectral norm
`spectralNorm K y : ℝ` of `y` (written `|y|_sp` in the textbooks) is the spectral value of the
minimal polynomial of `y` over `K`. -/
def spectralNorm (y : L) : ℝ := spectralValue (minpoly K y)
variable {K L}
/-- If `L/E/K` is a tower of fields, then the spectral norm of `x : E` equals its spectral norm
when regarding `x` as an element of `L`. -/
theorem spectralNorm.eq_of_tower {E : Type*} [Field E] [Algebra K E] [Algebra E L]
[IsScalarTower K E L] (x : E) :
spectralNorm K E x = spectralNorm K L (algebraMap E L x) := by
have hx : minpoly K (algebraMap E L x) = minpoly K x :=
minpoly.algebraMap_eq (algebraMap E L).injective x
simp only [spectralNorm, hx]
variable (E : IntermediateField K L)
/-- If `L/E/K` is a tower of fields, then the spectral norm of `x : E` when regarded as an element
of the normal closure of `E` equals its spectral norm when regarding `x` as an element of `L`. -/
theorem spectralNorm.eq_of_normalClosure' (x : E) :
spectralNorm K (normalClosure K E (AlgebraicClosure E))
(algebraMap E (normalClosure K E (AlgebraicClosure E)) x) =
spectralNorm K L (algebraMap E L x) := by
simp only [spectralNorm, spectralValue]
have h_min : minpoly K (algebraMap (↥E) (↥(normalClosure K (↥E) (AlgebraicClosure ↥E))) x) =
minpoly K (algebraMap (↥E) L x) := by
rw [minpoly.algebraMap_eq (algebraMap (↥E) ↥(normalClosure K E (AlgebraicClosure E))).injective
x, ← minpoly.algebraMap_eq (algebraMap (↥E) L).injective x]
simp_rw [h_min]
/-- If `L/E/K` is a tower of fields and `x = algebraMap E L g`, then the spectral norm
of `g : E` when regarded as an element of the normal closure of `E` equals the spectral norm
of `x : L`. -/
theorem spectralNorm.eq_of_normalClosure {E : IntermediateField K L} {x : L} (g : E)
(h_map : algebraMap E L g = x) :
spectralNorm K (normalClosure K E (AlgebraicClosure E))
(algebraMap E (normalClosure K E (AlgebraicClosure E)) g) =
spectralNorm K L x :=
h_map ▸ spectralNorm.eq_of_normalClosure' E g
variable (y : L)
open Real
/-- `spectralNorm K L (0 : L) = 0`. -/
theorem spectralNorm_zero : spectralNorm K L (0 : L) = 0 := by
unfold spectralNorm
rw [minpoly.zero, ← pow_one X, spectralValue_X_pow 1]
/-- `spectralNorm K L y` is nonnegative. -/
theorem spectralNorm_nonneg (y : L) : 0 ≤ spectralNorm K L y :=
le_ciSup_of_le (spectralValueTerms_bddAbove (minpoly K y)) 0 (spectralValueTerms_nonneg _ 0)
/-- `spectralNorm K L y` is positive if `y ≠ 0`. -/
theorem spectralNorm_zero_lt {y : L} (hy : y ≠ 0) (hy_alg : IsAlgebraic K y) :
0 < spectralNorm K L y := by
apply lt_of_le_of_ne (spectralNorm_nonneg _)
rw [spectralNorm, ne_eq, eq_comm, spectralValue_eq_zero_iff (minpoly.monic hy_alg.isIntegral)]
intro h
apply minpoly.coeff_zero_ne_zero hy_alg.isIntegral hy
rw [h, coeff_X_pow, if_neg (ne_of_lt (minpoly.natDegree_pos hy_alg.isIntegral))]
/-- If `spectralNorm K L x = 0`, then `x = 0`. -/
theorem eq_zero_of_map_spectralNorm_eq_zero {x : L} (hx : spectralNorm K L x = 0)
(hx_alg : IsAlgebraic K x) : x = 0 := by
by_contra h0
exact (ne_of_gt (spectralNorm_zero_lt h0 hx_alg)) hx
/-- If `f` is a power-multiplicative `K`-algebra norm on `L`, then `f`
is bounded above by `spectralNorm K L`. -/
theorem norm_le_spectralNorm {f : AlgebraNorm K L} (hf_pm : IsPowMul f)
(hf_na : IsNonarchimedean f) {x : L} (hx_alg : IsAlgebraic K x) :
f x ≤ spectralNorm K L x :=
norm_root_le_spectralValue hf_pm hf_na (minpoly.monic hx_alg.isIntegral)
(by rw [minpoly.aeval])
/-- The `K`-algebra automorphisms of `L` are isometries with respect to the spectral norm. -/
theorem spectralNorm_eq_of_equiv (σ : Gal(L/K)) (x : L) :
spectralNorm K L x = spectralNorm K L (σ x) := by
simp only [spectralNorm, minpoly.algEquiv_eq]
-- We first assume that the extension is finite and normal
section FiniteNormal
variable (K L) [h_fin : FiniteDimensional K L] [hn : Normal K L]
/--
If `L/K` is finite and normal, then `spectralNorm K L x = supr (λ (σ : Gal(L/K)), f (σ x))`. -/
theorem spectralNorm_eq_iSup_of_finiteDimensional_normal
{f : AlgebraNorm K L} (hf_pm : IsPowMul f) (hf_na : IsNonarchimedean f)
(hf_ext : ∀ (x : K), f (algebraMap K L x) = ‖x‖) (x : L) :
spectralNorm K L x = ⨆ σ : Gal(L/K), f (σ x) := by
classical
have hf1 : f 1 = 1 := by
rw [← (algebraMap K L).map_one, hf_ext]
simp
refine le_antisymm ?_ (ciSup_le fun σ ↦
norm_root_le_spectralValue hf_pm hf_na
(minpoly.monic (hn.isIntegral x)) (minpoly.aeval_algHom _ σ.toAlgHom _))
· set p := minpoly K x
have hp_sp : Splits (algebraMap K L) (minpoly K x) := hn.splits x
obtain ⟨s, hs⟩ := (splits_iff_exists_multiset _).mp hp_sp
have h_lc : (algebraMap K L) (minpoly K x).leadingCoeff = 1 := by
rw [minpoly.monic (hn.isIntegral x), map_one]
rw [h_lc, map_one, one_mul] at hs
simp only [spectralNorm]
rw [← max_norm_root_eq_spectralValue hf_pm hf_na hf1 _ _ hs]
apply ciSup_le
intro y
split_ifs with h
· obtain ⟨σ, hσ⟩ : ∃ σ : Gal(L/K), σ x = y := minpoly.exists_algEquiv_of_root'
(Algebra.IsAlgebraic.isAlgebraic x) (aeval_root_of_mapAlg_eq_multiset_prod_X_sub_C s h hs)
rw [← hσ]
convert le_ciSup (Finite.bddAbove_range _) σ
· rfl
· exact instNonemptyOfInhabited
· exact SemilatticeSup.to_isDirected_le
· exact iSup_nonneg fun σ ↦ apply_nonneg _ _
open IsUltrametricDist
/-- If `L/K` is finite and normal, then `spectralNorm K L = invariantExtension K L`. -/
theorem spectralNorm_eq_invariantExtension [hu : IsUltrametricDist K] :
spectralNorm K L = invariantExtension K L := by
ext x
have hna := hu.isNonarchimedean_norm
set f := Classical.choose (exists_nonarchimedean_pow_mul_seminorm_of_finiteDimensional h_fin hna)
with hf
have hf_pow : IsPowMul f := (Classical.choose_spec
(exists_nonarchimedean_pow_mul_seminorm_of_finiteDimensional h_fin hna)).1
have hf_ext : ∀ (x : K), f (algebraMap K L x) = ‖x‖ := (Classical.choose_spec
(exists_nonarchimedean_pow_mul_seminorm_of_finiteDimensional h_fin hna)).2.1
have hf_na : IsNonarchimedean f := (Classical.choose_spec
(exists_nonarchimedean_pow_mul_seminorm_of_finiteDimensional h_fin hna)).2.2
rw [spectralNorm_eq_iSup_of_finiteDimensional_normal K L hf_pow hf_na hf_ext]
simp only [invariantExtension_apply, algNormOfAlgEquiv_apply, hf]
/- Note that the main results below are reproved without the finite dimensionality and normality
assumptions later on in this file. -/
/-- If `L/K` is finite and normal, then `spectralNorm K L` is power-multiplicative.
See also the more general result `isPowMul_spectralNorm`. -/
theorem isPowMul_spectralNorm_of_finiteDimensional_normal [IsUltrametricDist K] :
IsPowMul (spectralNorm K L) := by
rw [spectralNorm_eq_invariantExtension K L]
exact isPowMul_invariantExtension K L
/-- The spectral norm is a `K`-algebra norm on `L` when `L/K` is finite and normal.
See also `spectralAlgNorm` for a more general construction. -/
def spectralAlgNorm_of_finiteDimensional_normal [IsUltrametricDist K] : AlgebraNorm K L where
toFun := spectralNorm K L
map_zero' := by rw [spectralNorm_eq_invariantExtension K L, map_zero]
add_le' := by rw [spectralNorm_eq_invariantExtension]; exact map_add_le_add _
neg' := by rw [spectralNorm_eq_invariantExtension]; exact map_neg_eq_map _
mul_le' := by
simp only [spectralNorm_eq_invariantExtension]
exact map_mul_le_mul (invariantExtension K L)
smul' := by
simp [spectralNorm_eq_invariantExtension, AlgebraNormClass.map_smul_eq_mul _]
eq_zero_of_map_eq_zero' x := by
simp only [spectralNorm_eq_invariantExtension]
exact eq_zero_of_map_eq_zero _
theorem spectralAlgNorm_of_finiteDimensional_normal_def [IsUltrametricDist K] (x : L) :
spectralAlgNorm_of_finiteDimensional_normal K L x = spectralNorm K L x := rfl
/-- The spectral norm is nonarchimedean when `L/K` is finite and normal.
See also `isNonarchimedean_spectralNorm` for a more general result. -/
theorem isNonarchimedean_spectralNorm_of_finiteDimensional_normal
[IsUltrametricDist K] : IsNonarchimedean (spectralNorm K L) := by
rw [spectralNorm_eq_invariantExtension]
exact isNonarchimedean_invariantExtension K L
/-- The spectral norm extends the norm on `K` when `L/K` is finite and normal.
See also `spectralNorm_extends` for a more general result. -/
theorem spectralNorm_extends_of_finiteDimensional [IsUltrametricDist K] (x : K) :
spectralNorm K L (algebraMap K L x) = ‖x‖ := by
rw [spectralNorm_eq_invariantExtension, invariantExtension_extends K L x]
/-- If `L/K` is finite and normal, and `f` is a power-multiplicative `K`-algebra norm on `L`
extending the norm on `K`, then `f = spectralNorm K L`. -/
theorem spectralNorm_unique_of_finiteDimensional_normal {f : AlgebraNorm K L}
(hf_pm : IsPowMul f) (hf_na : IsNonarchimedean f)
(hf_ext : ∀ (x : K), f (algebraMap K L x) = ‖x‖₊)
(hf_iso : ∀ (σ : Gal(L/K)) (x : L), f x = f (σ x)) (x : L) : f x = spectralNorm K L x := by
have h_sup : (⨆ σ : Gal(L/K), f (σ x)) = f x := by
rw [← @ciSup_const _ Gal(L/K) _ _ (f x)]
exact iSup_congr fun σ ↦ by rw [hf_iso σ x]
rw [spectralNorm_eq_iSup_of_finiteDimensional_normal K L hf_pm hf_na hf_ext, h_sup]
end FiniteNormal
-- Now we let `L/K` be any algebraic extension.
open scoped IntermediateField
instance : SeminormClass (AlgebraNorm K ↥(normalClosure K (↥E) (AlgebraicClosure ↥E))) K
↥(normalClosure K (↥E) (AlgebraicClosure ↥E)) := AlgebraNormClass.toSeminormClass
/-- The spectral norm extends the norm on `K`. -/
theorem spectralNorm_extends (k : K) : spectralNorm K L (algebraMap K L k) = ‖k‖ := by
simp_rw [spectralNorm, minpoly.eq_X_sub_C_of_algebraMap_inj _ (algebraMap K L).injective]
exact spectralValue_X_sub_C k
theorem spectralNorm_one : spectralNorm K L 1 = 1 := by
have h1 : (1 : L) = algebraMap K L 1 := by rw [map_one]
rw [h1, spectralNorm_extends, norm_one]
variable [IsUltrametricDist K]
/-- `spectralNorm K L (-y) = spectralNorm K L y` . -/
theorem spectralNorm_neg {y : L} (hy : IsAlgebraic K y) :
spectralNorm K L (-y) = spectralNorm K L y := by
set E := K⟮y⟯
haveI h_finiteDimensional_E : FiniteDimensional K E :=
IntermediateField.adjoin.finiteDimensional hy.isIntegral
set g := IntermediateField.AdjoinSimple.gen K y
have hy : -y = (algebraMap K⟮y⟯ L) (-g) := rfl
rw [← spectralNorm.eq_of_normalClosure g (IntermediateField.AdjoinSimple.algebraMap_gen K y), hy,
← spectralNorm.eq_of_normalClosure (-g) hy, RingHom.map_neg,
← spectralAlgNorm_of_finiteDimensional_normal_def]
exact map_neg_eq_map _ _
/-- The spectral norm is compatible with the action of `K`. -/
theorem spectralNorm_smul (k : K) {y : L} (hy : IsAlgebraic K y) :
spectralNorm K L (k • y) = ‖k‖₊ * spectralNorm K L y := by
set E := K⟮y⟯
haveI h_finiteDimensional_E : FiniteDimensional K E :=
IntermediateField.adjoin.finiteDimensional hy.isIntegral
set g := IntermediateField.AdjoinSimple.gen K y
have hgy : k • y = (algebraMap (↥K⟮y⟯) L) (k • g) := rfl
have h : algebraMap K⟮y⟯ (normalClosure K K⟮y⟯ (AlgebraicClosure K⟮y⟯)) (k • g) =
k • algebraMap K⟮y⟯ (normalClosure K K⟮y⟯ (AlgebraicClosure K⟮y⟯)) g := by
rw [Algebra.algebraMap_eq_smul_one, Algebra.algebraMap_eq_smul_one, smul_assoc]
rw [← spectralNorm.eq_of_normalClosure g (IntermediateField.AdjoinSimple.algebraMap_gen K y), hgy,
← spectralNorm.eq_of_normalClosure (k • g) rfl, h]
rw [← spectralAlgNorm_of_finiteDimensional_normal_def]
apply map_smul_eq_mul
/-- The spectral norm is submultiplicative. -/
theorem spectralNorm_mul {x y : L} (hx : IsAlgebraic K x) (hy : IsAlgebraic K y) :
spectralNorm K L (x * y) ≤ spectralNorm K L x * spectralNorm K L y := by
set E := K⟮x, y⟯
haveI h_finiteDimensional_E : FiniteDimensional K E :=
IntermediateField.finiteDimensional_adjoin_pair hx.isIntegral hy.isIntegral
set gx := IntermediateField.AdjoinPair.gen₁ K x y
set gy := IntermediateField.AdjoinPair.gen₂ K x y
have hxy : x * y = (algebraMap K⟮x, y⟯ L) (gx * gy) := rfl
rw [hxy, ← spectralNorm.eq_of_normalClosure (gx * gy) hxy,
← spectralNorm.eq_of_normalClosure gx (IntermediateField.AdjoinPair.algebraMap_gen₁ K x y),
← spectralNorm.eq_of_normalClosure gy (IntermediateField.AdjoinPair.algebraMap_gen₂ K x y),
map_mul, ← spectralAlgNorm_of_finiteDimensional_normal_def]
exact map_mul_le_mul _ _ _
section IsAlgebraic
variable [h_alg : Algebra.IsAlgebraic K L]
/-- The spectral norm is power-multiplicative. -/
theorem isPowMul_spectralNorm : IsPowMul (spectralNorm K L) := by
intro x n hn
set E := K⟮x⟯
haveI h_finiteDimensional_E : FiniteDimensional K E :=
IntermediateField.adjoin.finiteDimensional (h_alg.isAlgebraic x).isIntegral
set g := IntermediateField.AdjoinSimple.gen K x with hg
have h_map : algebraMap E L g ^ n = x ^ n := rfl
rw [← spectralNorm.eq_of_normalClosure _ (IntermediateField.AdjoinSimple.algebraMap_gen K x),
← spectralNorm.eq_of_normalClosure (g ^ n) h_map, map_pow, ← hg]
exact isPowMul_spectralNorm_of_finiteDimensional_normal _ _
((algebraMap ↥K⟮x⟯ ↥(normalClosure K (↥K⟮x⟯) (AlgebraicClosure ↥K⟮x⟯))) g) hn
/-- The spectral norm is nonarchimedean. -/
theorem isNonarchimedean_spectralNorm : IsNonarchimedean (spectralNorm K L) := by
intro x y
set E := K⟮x, y⟯
haveI h_finiteDimensional_E : FiniteDimensional K E :=
IntermediateField.finiteDimensional_adjoin_pair (h_alg.isAlgebraic x).isIntegral
(h_alg.isAlgebraic y).isIntegral
set gx := IntermediateField.AdjoinPair.gen₁ K x y
set gy := IntermediateField.AdjoinPair.gen₂ K x y
have hxy : x + y = (algebraMap K⟮x, y⟯ L) (gx + gy) := rfl
rw [hxy, ← spectralNorm.eq_of_normalClosure (gx + gy) hxy,
← spectralNorm.eq_of_normalClosure gx (IntermediateField.AdjoinPair.algebraMap_gen₁ K x y),
← spectralNorm.eq_of_normalClosure gy (IntermediateField.AdjoinPair.algebraMap_gen₂ K x y),
_root_.map_add]
apply isNonarchimedean_spectralNorm_of_finiteDimensional_normal
variable (K L) in
/-- The spectral norm is a `K`-algebra norm on `L`. -/
def spectralAlgNorm : AlgebraNorm K L where
toFun := spectralNorm K L
map_zero' := spectralNorm_zero
add_le' _ _ := IsNonarchimedean.add_le spectralNorm_nonneg isNonarchimedean_spectralNorm
mul_le' x y := spectralNorm_mul (h_alg.isAlgebraic x) (h_alg.isAlgebraic y)
smul' k x := spectralNorm_smul k (h_alg.isAlgebraic x)
neg' x := spectralNorm_neg (h_alg.isAlgebraic x)
eq_zero_of_map_eq_zero' x hx := eq_zero_of_map_spectralNorm_eq_zero hx (h_alg.isAlgebraic x)
theorem spectralAlgNorm_def (x : L) : spectralAlgNorm K L x = spectralNorm K L x := rfl
theorem spectralAlgNorm_extends (k : K) : spectralAlgNorm K L (algebraMap K L k) = ‖k‖ :=
spectralNorm_extends k
theorem spectralAlgNorm_one : spectralAlgNorm K L (1 : L) = 1 := spectralNorm_one
theorem spectralAlgNorm_isPowMul : IsPowMul (spectralAlgNorm K L) := isPowMul_spectralNorm
end IsAlgebraic
end NormedField
section NontriviallyNormedField
open IntermediateField
universe u v
variable {K : Type u} [NontriviallyNormedField K] {L : Type v} [Field L] [Algebra K L]
[Algebra.IsAlgebraic K L] [hu : IsUltrametricDist K]
/-- If `K` is a field complete with respect to a nontrivial nonarchimedean multiplicative norm and
`L/K` is an algebraic extension, then any power-multiplicative `K`-algebra norm on `L` coincides
with the spectral norm. -/
theorem spectralNorm_unique [CompleteSpace K] {f : AlgebraNorm K L} (hf_pm : IsPowMul f) :
f = spectralAlgNorm K L := by
apply eq_of_powMul_faithful f hf_pm _ spectralAlgNorm_isPowMul
intro x
set E : Type v := id K⟮x⟯
letI hE : Field E := inferInstanceAs (Field K⟮x⟯)
letI : Algebra K E := inferInstanceAs (Algebra K K⟮x⟯)
let id1 : K⟮x⟯ →ₗ[K] E := LinearMap.id
let id2 : E →ₗ[K] K⟮x⟯ := LinearMap.id
set hs_norm : RingNorm E :=
{ toFun y := spectralNorm K L (id2 y : L)
map_zero' := by simp [map_zero, spectralNorm_zero, ZeroMemClass.coe_zero]
add_le' a b := by
simp only [← spectralAlgNorm_def]
exact map_add_le_add _ _ _
neg' a := by simp [map_neg, NegMemClass.coe_neg, ← spectralAlgNorm_def, map_neg_eq_map]
mul_le' a b := by
simp only [← spectralAlgNorm_def]
exact map_mul_le_mul _ _ _
eq_zero_of_map_eq_zero' a ha := by
simpa [id_eq, eq_mpr_eq_cast, cast_eq, LinearMap.coe_mk, ← spectralAlgNorm_def,
map_eq_zero_iff_eq_zero, ZeroMemClass.coe_eq_zero] using ha }
letI n1 : NormedRing E := RingNorm.toNormedRing hs_norm
letI N1 : NormedSpace K E :=
{ one_smul e := by simp [one_smul]
mul_smul k1 k2 e := by simp [mul_smul]
smul_zero e := by simp
smul_add k e_1 e_ := by simp [smul_add]
add_smul k1 k2 e := by simp [add_smul]
zero_smul e := by simp [zero_smul]
norm_smul_le k y := by
change (spectralAlgNorm K L (id2 (k • y) : L) : ℝ) ≤
‖k‖ * spectralAlgNorm K L (id2 y : L)
rw [map_smul, IntermediateField.coe_smul, map_smul_eq_mul] }
set hf_norm : RingNorm K⟮x⟯ :=
{ toFun y := f ((algebraMap K⟮x⟯ L) y)
map_zero' := map_zero _
add_le' a b := map_add_le_add _ _ _
neg' y := by simp [(algebraMap K⟮x⟯ L).map_neg y]
mul_le' a b := map_mul_le_mul _ _ _
eq_zero_of_map_eq_zero' a ha := by
simpa [map_eq_zero_iff_eq_zero, map_eq_zero] using ha }
letI n2 : NormedRing K⟮x⟯ := RingNorm.toNormedRing hf_norm
letI N2 : NormedSpace K K⟮x⟯ :=
{ one_smul e := by simp [one_smul]
mul_smul k1 k2 e := by simp [mul_smul]
smul_zero e := by simp
smul_add k e1 e2 := by simp [smul_add]
add_smul k1 k2 e := by simp [add_smul]
zero_smul e := by simp [zero_smul]
norm_smul_le k y := by
change (f ((algebraMap K⟮x⟯ L) (k • y)) : ℝ) ≤ ‖k‖ * f (algebraMap K⟮x⟯ L y)
have : (algebraMap (↥K⟮x⟯) L) (k • y) = k • algebraMap (↥K⟮x⟯) L y := by
simp [IntermediateField.algebraMap_apply]
rw [this, map_smul_eq_mul] }
haveI hKx_fin : FiniteDimensional K ↥K⟮x⟯ :=
IntermediateField.adjoin.finiteDimensional (Algebra.IsAlgebraic.isAlgebraic x).isIntegral
haveI : FiniteDimensional K E := hKx_fin
set Id1 : K⟮x⟯ →L[K] E := ⟨id1, id1.continuous_of_finiteDimensional⟩
set Id2 : E →L[K] K⟮x⟯ := ⟨id2, id2.continuous_of_finiteDimensional⟩
obtain ⟨C1, hC1_pos, hC1⟩ : ∃ C1 : ℝ, 0 < C1 ∧ ∀ y : K⟮x⟯, ‖id1 y‖ ≤ C1 * ‖y‖ :=
Id1.isBoundedLinearMap.bound
obtain ⟨C2, hC2_pos, hC2⟩ : ∃ C2 : ℝ, 0 < C2 ∧ ∀ y : E, ‖id2 y‖ ≤ C2 * ‖y‖ :=
Id2.isBoundedLinearMap.bound
exact ⟨ C2, C1, hC2_pos, hC1_pos,
forall_and.mpr ⟨fun y ↦ hC2 ⟨y, (IntermediateField.algebra_adjoin_le_adjoin K _) y.2⟩,
fun y ↦ hC1 ⟨y, (IntermediateField.algebra_adjoin_le_adjoin K _) y.2⟩⟩⟩
/-- If `K` is a field complete with respect to a nontrivial nonarchimedean multiplicative norm and
`L/K` is an algebraic extension, then any multiplicative ring norm on `L` extending the norm on
`K` coincides with the spectral norm. -/
theorem spectralNorm_unique_field_norm_ext [CompleteSpace K]
{f : AbsoluteValue L ℝ} (hf_ext : ∀ (x : K), f (algebraMap K L x) = ‖x‖) (x : L) :
f x = spectralNorm K L x := by
set g : AlgebraNorm K L :=
{ MulRingNorm.mulRingNormEquivAbsoluteValue.invFun f with
smul' k x := by
simp only [AddGroupSeminorm.toFun_eq_coe, MulRingSeminorm.toFun_eq_coe]
rw [Algebra.smul_def, map_mul]
congr
rw [← hf_ext k]
rfl
mul_le' x y := by simp [AddGroupSeminorm.toFun_eq_coe, MulRingSeminorm.toFun_eq_coe] }
have hg_pow : IsPowMul g := MulRingNorm.isPowMul _
have hgx : f x = g x := rfl
rw [hgx, spectralNorm_unique hg_pow, spectralAlgNorm_def]
/-- Given a nonzero `x : L`, and assuming that `(spectralAlgNorm h_alg hna) 1 ≤ 1`, this is
the real-valued function sending `y ∈ L` to the limit of `(f (y * x^n))/((f x)^n)`,
regarded as an algebra norm. -/
def algNormFromConst (h1 : (spectralAlgNorm K L).toRingSeminorm 1 ≤ 1) {x : L} (hx : x ≠ 0) :
AlgebraNorm K L :=
have hx' : spectralAlgNorm K L x ≠ 0 :=
ne_of_gt (spectralNorm_zero_lt hx (Algebra.IsAlgebraic.isAlgebraic x))
{ normFromConst h1 hx' spectralAlgNorm_isPowMul with
smul' k y := by
have h_mul : ∀ y : L, spectralNorm K L (algebraMap K L k * y) =
spectralNorm K L (algebraMap K L k) * spectralNorm K L y := fun y ↦ by
rw [spectralNorm_extends, ← Algebra.smul_def, ← spectralAlgNorm_def,
map_smul_eq_mul _ _ _, spectralAlgNorm_def]
have h : spectralNorm K L (algebraMap K L k) =
seminormFromConst' h1 hx' isPowMul_spectralNorm (algebraMap K L k) := by
rw [seminormFromConst_apply_of_isMul h1 hx' _ h_mul]; rfl
rw [← @spectralNorm_extends K _ L _ _ k, Algebra.smul_def, h]
exact seminormFromConst_isMul_of_isMul _ _ _ h_mul _ }
theorem algNormFromConst_def (h1 : (spectralAlgNorm K L).toRingSeminorm 1 ≤ 1) {x y : L}
(hx : x ≠ 0) :
algNormFromConst h1 hx y =
seminormFromConst h1 (ne_of_gt (spectralNorm_zero_lt hx (Algebra.IsAlgebraic.isAlgebraic x)))
isPowMul_spectralNorm y := rfl
section CompleteSpace
variable [CompleteSpace K]
/-- If `K` is a field complete with respect to a nontrivial nonarchimedean multiplicative norm and
`L/K` is an algebraic extension, then the spectral norm on `L` is multiplicative. -/
theorem spectralAlgNorm_mul (x y : L) :
spectralAlgNorm K L (x * y) = spectralAlgNorm K L x * spectralAlgNorm K L y := by
by_cases hx : x = 0
· simp [hx, zero_mul, map_zero]
· have hx' : spectralAlgNorm K L x ≠ 0 :=
ne_of_gt (spectralNorm_zero_lt hx (Algebra.IsAlgebraic.isAlgebraic x))
have hf1 : (spectralAlgNorm K L) 1 ≤ 1 := le_of_eq spectralAlgNorm_one
set f : AlgebraNorm K L := algNormFromConst hf1 hx with hf
have hf_pow : IsPowMul f := seminormFromConst_isPowMul hf1 hx' isPowMul_spectralNorm
rw [← spectralNorm_unique hf_pow, hf]
exact seminormFromConst_const_mul hf1 hx' isPowMul_spectralNorm _
variable (K L) in
/-- The spectral norm is a multiplicative `K`-algebra norm on `L`. -/
def spectralMulAlgNorm : MulAlgebraNorm K L :=
{ spectralAlgNorm K L with
map_one' := spectralAlgNorm_one
map_mul' := spectralAlgNorm_mul }
theorem spectralMulAlgNorm_def (x : L) : spectralMulAlgNorm K L x = spectralNorm K L x := rfl
namespace spectralNorm
variable (K L)
/-- `L` with the spectral norm is a `NormedField`. -/
def normedField : NormedField L :=
{ (inferInstance : Field L) with
norm x := (spectralNorm K L x : ℝ)
dist x y := (spectralNorm K L (x - y) : ℝ)
dist_self x := by simp [sub_self, spectralNorm_zero]
dist_comm x y := by rw [← neg_sub, spectralNorm_neg (Algebra.IsAlgebraic.isAlgebraic _)]
dist_triangle x y z :=
sub_add_sub_cancel x y z ▸ isNonarchimedean_spectralNorm.add_le spectralNorm_nonneg
eq_of_dist_eq_zero hxy := by
rw [← sub_eq_zero]
exact (map_eq_zero_iff_eq_zero (spectralMulAlgNorm K L)).mp hxy
dist_eq x y := rfl
norm_mul x y := by simp [← spectralMulAlgNorm_def, map_mul]
edist_dist x y := by rw [ENNReal.ofReal_eq_coe_nnreal] }
/-- `L` with the spectral norm is a `NontriviallyNormedField`. -/
def nontriviallyNormedField [CompleteSpace K] : NontriviallyNormedField L where
__ := spectralNorm.normedField K L
non_trivial :=
let ⟨x, hx⟩ := NontriviallyNormedField.non_trivial (α := K)
⟨algebraMap K L x, hx.trans_eq <| (spectralNorm_extends _).symm⟩
/-- `L` with the spectral norm is a `normed_add_comm_group`. -/
def normedAddCommGroup : NormedAddCommGroup L := by
haveI : NormedField L := normedField K L
infer_instance
/-- `L` with the spectral norm is a `seminormed_add_comm_group`. -/
def seminormedAddCommGroup : SeminormedAddCommGroup L := by
have : NormedField L := normedField K L
infer_instance
/-- `L` with the spectral norm is a `normed_space` over `K`. -/
def normedSpace : @NormedSpace K L _ (seminormedAddCommGroup K L) :=
letI _ := seminormedAddCommGroup K L
{(inferInstance : Module K L) with
norm_smul_le r x := by
change spectralAlgNorm K L (r • x) ≤ ‖r‖ * spectralAlgNorm K L x
exact le_of_eq (map_smul_eq_mul _ _ _)}
/-- The metric space structure on `L` induced by the spectral norm. -/
def metricSpace : MetricSpace L := (normedField K L).toMetricSpace
/-- The uniform space structure on `L` induced by the spectral norm. -/
def uniformSpace : UniformSpace L := (metricSpace K L).toUniformSpace
/-- If `L/K` is finite dimensional, then `L` is a complete space with respect to topology induced
by the spectral norm. -/
instance (priority := 100) completeSpace [h_fin : FiniteDimensional K L] :
@CompleteSpace L (uniformSpace K L) := by
letI := (normedAddCommGroup K L)
letI := (normedSpace K L)
exact FiniteDimensional.complete K L
omit [Algebra.IsAlgebraic K L] in
lemma spectralMulAlgNorm_eq_of_mem_roots (x : L) {E : Type*} [Field E] [Algebra K E] [Algebra L E]
[IsScalarTower K L E] [Algebra.IsAlgebraic K E] {a : E}
(ha : a ∈ ((mapAlg K E) (minpoly K x)).roots) :
(spectralMulAlgNorm K E) a = (spectralMulAlgNorm K E) ((algebraMap L E) x) := by
simp only [spectralMulAlgNorm_def, spectralNorm]
have : (aeval a) (minpoly K ((algebraMap L E) x)) = 0 := by
simp only [mem_roots', IsRoot.def] at ha
rw [← ha.2, mapAlg_eq_map, minpoly.algebraMap_eq (algebraMap L E).injective, aeval_def,
eval_map]
rw [← minpoly.eq_of_root (Algebra.IsAlgebraic.isAlgebraic ((algebraMap L E) x)) this]
omit [Algebra.IsAlgebraic K L] in
/-- Given an algebraic tower of fields `E/L/K` and an element `x : L` whose minimal polynomial `f`
over `K` splits into linear factors over `E`, the `degree(f)`th power of the spectral norm of `x`,
considered as an element of `E`, is equal to the spectral norm of the product of the `E`-valued
roots of `f`. -/
theorem spectralNorm_pow_natDegree_eq_prod_roots (x : L) {E : Type*} [Field E] [Algebra K E]
[Algebra L E] [IsScalarTower K L E] [IsSplittingField L E (mapAlg K L (minpoly K x))]
[Algebra.IsAlgebraic K E] :
(spectralMulAlgNorm K E) ((algebraMap L E) x) ^ (minpoly K x).natDegree =
(spectralMulAlgNorm K E) ((mapAlg K E) (minpoly K x)).roots.prod := by
have h_deg : (minpoly K x).natDegree = Multiset.card ((mapAlg K E) (minpoly K x)).roots := by
trans (mapAlg K E (minpoly K x)).natDegree
· rw [mapAlg_eq_map, natDegree_map]
· rw [eq_comm, ← splits_iff_card_roots]
exact IsSplittingField.IsScalarTower.splits (K := L) E (minpoly K x)
rw [map_multiset_prod, ← Multiset.prod_replicate]
apply congr_arg
ext r
rw [Multiset.count_replicate]
split_ifs with hr
· have h : ∀ s ∈ Multiset.map (spectralMulAlgNorm K E) ((mapAlg K E) (minpoly K x)).roots,
r = s := by
intro s hs
obtain ⟨a, ha, has⟩ := Multiset.mem_map.mp hs
rw [← hr, ← has, spectralMulAlgNorm_eq_of_mem_roots K L x ha]
rwa [Multiset.count_eq_card.mpr h, Multiset.card_map]
· rw [Multiset.count_eq_zero_of_notMem]
intro hr_mem
obtain ⟨e, he, her⟩ := Multiset.mem_map.mp hr_mem
rw [spectralMulAlgNorm_eq_of_mem_roots K L x he] at her
exact hr her
/-- For `x : L` with minimal polynomial `f(X) := X^n + a_{n-1}X^{n-1} + ... + a_0` over `K`,
the spectral norm of `x` is equal to `‖a_0‖^(1/(degree(f(X))))`. -/
theorem spectralNorm_eq_norm_coeff_zero_rpow (x : L) :
spectralNorm K L x = ‖(minpoly K x).coeff 0‖ ^ (1 / (minpoly K x).natDegree : ℝ) := by
set E := (mapAlg K L (minpoly K x)).SplittingField
have hspl : Splits (RingHom.id E) (mapAlg K E (minpoly K x)) :=
IsSplittingField.IsScalarTower.splits (K := L) E (minpoly K x)
have : Algebra.IsAlgebraic L E :=
IsSplittingField.IsScalarTower.isAlgebraic E (mapAlg K L (minpoly K x))
have : Algebra.IsAlgebraic K E := Algebra.IsAlgebraic.trans K L E
rw [one_div, Real.eq_rpow_inv (spectralNorm_nonneg x) (norm_nonneg ((minpoly K x).coeff 0)),
Real.rpow_natCast, @spectralNorm.eq_of_tower K _ E,
← @spectralNorm_extends K _ L _ _ ((minpoly K x).coeff 0),
@spectralNorm.eq_of_tower K _ E _ _ L, ← spectralMulAlgNorm_def,
← spectralMulAlgNorm_def, Polynomial.coeff_zero_of_isScalarTower,
Polynomial.coeff_zero_eq_prod_roots_of_monic_of_splits _ hspl, map_mul, map_pow,
map_neg_eq_map, map_one, one_pow, one_mul, spectralNorm_pow_natDegree_eq_prod_roots _ _ x]
· simp [monic_mapAlg_iff, minpoly.monic (Algebra.IsAlgebraic.isAlgebraic x).isIntegral]
· exact_mod_cast (minpoly.natDegree_pos (Algebra.IsIntegral.isIntegral x)).ne'
end spectralNorm
end CompleteSpace
end NontriviallyNormedField
end spectralNorm |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Unbundled/AlgebraNorm.lean | import Mathlib.Analysis.Normed.Unbundled.RingSeminorm
import Mathlib.Analysis.Seminorm
/-!
# Algebra norms
We define algebra norms and multiplicative algebra norms.
## Main Definitions
* `AlgebraNorm` : an algebra norm on an `R`-algebra `S` is a ring norm on `S` compatible with
the action of `R`.
* `MulAlgebraNorm` : a multiplicative algebra norm on an `R`-algebra `S` is a multiplicative
ring norm on `S` compatible with the action of `R`.
## Tags
norm, algebra norm
-/
/-- An algebra norm on an `R`-algebra `S` is a ring norm on `S` compatible with the
action of `R`. -/
structure AlgebraNorm (R : Type*) [SeminormedCommRing R] (S : Type*) [Ring S] [Algebra R S] extends
RingNorm S, Seminorm R S
attribute [nolint docBlame] AlgebraNorm.toSeminorm AlgebraNorm.toRingNorm
instance (K : Type*) [NormedField K] : Inhabited (AlgebraNorm K K) :=
⟨{ toFun := norm
map_zero' := norm_zero
add_le' := norm_add_le
neg' := norm_neg
smul' := norm_mul
mul_le' := norm_mul_le
eq_zero_of_map_eq_zero' := fun _ => norm_eq_zero.mp }⟩
/-- `AlgebraNormClass F R S` states that `F` is a type of `R`-algebra norms on the ring `S`.
You should extend this class when you extend `AlgebraNorm`. -/
class AlgebraNormClass (F : Type*) (R : outParam <| Type*) [SeminormedCommRing R]
(S : outParam <| Type*) [Ring S] [Algebra R S] [FunLike F S ℝ] : Prop
extends RingNormClass F S ℝ, SeminormClass F R S
namespace AlgebraNorm
variable {R : Type*} [SeminormedCommRing R] {S : Type*} [Ring S] [Algebra R S] {f : AlgebraNorm R S}
/-- The ring seminorm underlying an algebra norm. -/
def toRingSeminorm' (f : AlgebraNorm R S) : RingSeminorm S :=
f.toRingNorm.toRingSeminorm
instance : FunLike (AlgebraNorm R S) S ℝ where
coe f := f.toFun
coe_injective' f f' h := by
simp only [AddGroupSeminorm.toFun_eq_coe, RingSeminorm.toFun_eq_coe] at h
cases f; cases f'; congr
simp only at h
ext s
erw [h]
rfl
instance algebraNormClass : AlgebraNormClass (AlgebraNorm R S) R S where
map_zero f := f.map_zero'
map_add_le_add f := f.add_le'
map_mul_le_mul f := f.mul_le'
map_neg_eq_map f := f.neg'
eq_zero_of_map_eq_zero f := f.eq_zero_of_map_eq_zero' _
map_smul_eq_mul f := f.smul'
theorem toFun_eq_coe (p : AlgebraNorm R S) : p.toFun = p := rfl
@[ext]
theorem ext {p q : AlgebraNorm R S} : (∀ x, p x = q x) → p = q :=
DFunLike.ext p q
/-- An `R`-algebra norm such that `f 1 = 1` extends the norm on `R`. -/
theorem extends_norm' (hf1 : f 1 = 1) (a : R) : f (a • (1 : S)) = ‖a‖ := by
rw [← mul_one ‖a‖, ← hf1]; exact f.smul' _ _
/-- An `R`-algebra norm such that `f 1 = 1` extends the norm on `R`. -/
theorem extends_norm (hf1 : f 1 = 1) (a : R) : f (algebraMap R S a) = ‖a‖ := by
rw [Algebra.algebraMap_eq_smul_one]; exact extends_norm' hf1 _
/-- The restriction of an algebra norm to a subalgebra. -/
def restriction (A : Subalgebra R S) (f : AlgebraNorm R S) : AlgebraNorm R A where
toFun x := f x.val
map_zero' := map_zero f
add_le' x y := map_add_le_add _ _ _
neg' x := map_neg_eq_map _ _
mul_le' x y := map_mul_le_mul _ _ _
eq_zero_of_map_eq_zero' x hx := by
rw [← ZeroMemClass.coe_eq_zero]; exact eq_zero_of_map_eq_zero f hx
smul' r x := map_smul_eq_mul _ _ _
/-- The restriction of an algebra norm in a scalar tower. -/
def isScalarTower_restriction {A : Type*} [CommRing A] [Algebra R A] [Algebra A S]
[IsScalarTower R A S] (hinj : Function.Injective (algebraMap A S)) (f : AlgebraNorm R S) :
AlgebraNorm R A where
toFun x := f (algebraMap A S x)
map_zero' := by simp only [map_zero]
add_le' x y := by simp only [map_add, map_add_le_add]
neg' x := by simp only [map_neg, map_neg_eq_map]
mul_le' x y := by simp only [map_mul, map_mul_le_mul]
eq_zero_of_map_eq_zero' x hx := by
rw [← map_eq_zero_iff (algebraMap A S) hinj]
exact eq_zero_of_map_eq_zero f hx
smul' r x := by
simp only [Algebra.smul_def, map_mul, ← IsScalarTower.algebraMap_apply]
simp only [← smul_eq_mul, algebraMap_smul, map_smul_eq_mul]
end AlgebraNorm
/-- A multiplicative algebra norm on an `R`-algebra norm `S` is a multiplicative ring norm on `S`
compatible with the action of `R`. -/
structure MulAlgebraNorm (R : Type*) [SeminormedCommRing R] (S : Type*) [Ring S] [Algebra R S]
extends MulRingNorm S, Seminorm R S
attribute [nolint docBlame] MulAlgebraNorm.toSeminorm MulAlgebraNorm.toMulRingNorm
instance (K : Type*) [NormedField K] : Inhabited (MulAlgebraNorm K K) :=
⟨{ toFun := norm
map_zero' := norm_zero
add_le' := norm_add_le
neg' := norm_neg
smul' := norm_mul
map_one' := norm_one
map_mul' := norm_mul
eq_zero_of_map_eq_zero' := fun _ => norm_eq_zero.mp }⟩
/-- `MulAlgebraNormClass F R S` states that `F` is a type of multiplicative `R`-algebra norms on
the ring `S`. You should extend this class when you extend `MulAlgebraNorm`. -/
class MulAlgebraNormClass (F : Type*) (R : outParam <| Type*) [SeminormedCommRing R]
(S : outParam <| Type*) [Ring S] [Algebra R S] [FunLike F S ℝ] : Prop
extends MulRingNormClass F S ℝ, SeminormClass F R S
namespace MulAlgebraNorm
variable {R S : outParam <| Type*} [SeminormedCommRing R] [Ring S] [Algebra R S]
{f : AlgebraNorm R S}
instance : FunLike (MulAlgebraNorm R S) S ℝ where
coe f := f.toFun
coe_injective' f f' h:= by
simp only [AddGroupSeminorm.toFun_eq_coe, MulRingSeminorm.toFun_eq_coe, DFunLike.coe_fn_eq] at h
obtain ⟨⟨_, _⟩, _⟩ := f; obtain ⟨⟨_, _⟩, _⟩ := f'; congr
instance mulAlgebraNormClass : MulAlgebraNormClass (MulAlgebraNorm R S) R S where
map_zero f := f.map_zero'
map_add_le_add f := f.add_le'
map_one f := f.map_one'
map_mul f := f.map_mul'
map_neg_eq_map f := f.neg'
eq_zero_of_map_eq_zero f := f.eq_zero_of_map_eq_zero' _
map_smul_eq_mul f := f.smul'
theorem toFun_eq_coe (p : MulAlgebraNorm R S) : p.toFun = p := rfl
@[ext]
theorem ext {p q : MulAlgebraNorm R S} : (∀ x, p x = q x) → p = q :=
DFunLike.ext p q
/-- A multiplicative `R`-algebra norm extends the norm on `R`. -/
theorem extends_norm' (f : MulAlgebraNorm R S) (a : R) : f (a • (1 : S)) = ‖a‖ := by
rw [← mul_one ‖a‖, ← f.map_one', ← f.smul', toFun_eq_coe]
/-- A multiplicative `R`-algebra norm extends the norm on `R`. -/
theorem extends_norm (f : MulAlgebraNorm R S) (a : R) : f (algebraMap R S a) = ‖a‖ := by
rw [Algebra.algebraMap_eq_smul_one]; exact extends_norm' _ _
end MulAlgebraNorm
namespace MulRingNorm
variable {R : Type*} [NonAssocRing R]
/-- The ring norm underlying a multiplicative ring norm. -/
def toRingNorm (f : MulRingNorm R) : RingNorm R where
toFun := f
map_zero' := f.map_zero'
add_le' := f.add_le'
neg' := f.neg'
mul_le' x y := le_of_eq (f.map_mul' x y)
eq_zero_of_map_eq_zero' := f.eq_zero_of_map_eq_zero'
/-- A multiplicative ring norm is power-multiplicative. -/
theorem isPowMul {A : Type*} [Ring A] (f : MulRingNorm A) : IsPowMul f := fun x n hn => by
cases n
· cutsat
· rw [map_pow]
end MulRingNorm |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Unbundled/FiniteExtension.lean | import Mathlib.Analysis.Normed.Unbundled.AlgebraNorm
import Mathlib.Analysis.Normed.Unbundled.SeminormFromBounded
import Mathlib.Analysis.Normed.Unbundled.SmoothingSeminorm
import Mathlib.LinearAlgebra.FiniteDimensional.Defs
import Mathlib.LinearAlgebra.Finsupp.VectorSpace
/-!
# Basis.norm
In this file, we prove [BGR, Lemma 3.2.1./3][bosch-guntzer-remmert] : if `K` is a normed field
with a nonarchimedean power-multiplicative norm and `L/K` is a finite extension, then there exists
at least one power-multiplicative `K`-algebra norm on `L` extending the norm on `K`.
## Main Definitions
* `Basis.norm` : the function sending an element `x : L` to the maximum of the norms of its
coefficients with respect to the `K`-basis `B` of `L`.
## Main Results
* `norm_mul_le_const_mul_norm` : For any `K`-basis of `L`, `B.norm` is bounded with respect to
multiplication. That is, `∃ (c : ℝ), c > 0` such that
` ∀ (x y : L), B.norm (x * y) ≤ c * B.norm x * B.norm y`.
* `exists_nonarchimedean_pow_mul_seminorm_of_finiteDimensional` : if `K` is a normed field with a
nonarchimedean power-multiplicative norm and `L/K` is a finite extension, then there exists at
least one power-multiplicative `K`-algebra norm on `L` extending the norm on `K`. This is
[BGR, Lemma 3.2.1./3].
## References
* [S. Bosch, U. Güntzer, R. Remmert, *Non-Archimedean Analysis*][bosch-guntzer-remmert]
## Tags
Basis.norm, nonarchimedean
-/
noncomputable section
open Finset Module
section Ring
variable {K L : Type*} [NormedField K] [Ring L] [Algebra K L]
namespace Module.Basis
variable {ι : Type*} [Fintype ι] [Nonempty ι] (B : Basis ι K L)
/-- The function sending an element `x : L` to the maximum of the norms of its coefficients
with respect to the `K`-basis `B` of `L`. -/
def norm (x : L) : ℝ :=
Finset.sup' univ univ_nonempty (fun i : ι ↦ ‖B.repr x i‖)
/-- The norm of a coefficient `x_i` is less than or equal to the norm of `x`. -/
theorem norm_repr_le_norm {x : L} (i : ι) : ‖B.repr x i‖ ≤ B.norm x :=
Finset.le_sup' (fun i : ι ↦ ‖B.repr x i‖) (mem_univ i)
/-- For any `K`-basis of `L`, we have `B.norm 0 = 0`. -/
protected theorem norm_zero : B.norm 0 = 0 := by
simp [norm, map_zero, norm_zero]
/-- For any `K`-basis of `L`, and any `x : L`, we have `B.norm (-x) = B.norm x`. -/
protected theorem norm_neg (x : L) : B.norm (-x) = B.norm x := by
simp [norm, map_neg, Pi.neg_apply, _root_.norm_neg]
/-- For any `K`-basis of `L`, and any `x : L`, we have `0 ≤ B.norm x`. -/
protected theorem norm_nonneg (x : L) : 0 ≤ B.norm x := by
simp only [norm, le_sup'_iff, mem_univ, norm_nonneg, and_self, exists_const]
variable {B}
/-- For any `K`-basis `B` of `L` containing `1`, `B.norm` extends the norm on `K`. -/
theorem norm_extends {i : ι} (hBi : B i = (1 : L)) (x : K) :
B.norm ((algebraMap K L) x) = ‖x‖ := by
classical
simp only [norm, repr_algebraMap hBi, Finsupp.single_apply]
apply le_antisymm
· aesop
· exact le_sup'_of_le _ (mem_univ i) (by simp)
/-- For any `K`-basis of `L`, if the norm on `K` is nonarchimedean, then so is `B.norm`. -/
theorem norm_isNonarchimedean (hna : IsNonarchimedean (Norm.norm : K → ℝ)) :
IsNonarchimedean B.norm := fun x y ↦ by
obtain ⟨ixy, _, hixy⟩ := exists_mem_eq_sup' univ_nonempty (fun i ↦ ‖(B.repr (x + y)) i‖)
have hxy : ‖B.repr (x + y) ixy‖ ≤ max ‖B.repr x ixy‖ ‖B.repr y ixy‖ := by
rw [LinearEquiv.map_add, Finsupp.coe_add, Pi.add_apply]; exact hna _ _
rw [Basis.norm, hixy]
rcases le_max_iff.mp hxy with (hx | hy)
· exact le_max_of_le_left (le_trans hx (norm_repr_le_norm B ixy))
· exact le_max_of_le_right (le_trans hy (norm_repr_le_norm B ixy))
/-- For any `K`-basis of `L`, `B.norm` is bounded with respect to multiplication. That is,
`∃ (c : ℝ), c > 0` such that ` ∀ (x y : L), B.norm (x * y) ≤ c * B.norm x * B.norm y`. -/
theorem norm_mul_le_const_mul_norm {i : ι} (hBi : B i = (1 : L))
(hna : IsNonarchimedean (Norm.norm : K → ℝ)) :
∃ (c : ℝ) (_ : 0 < c), ∀ x y : L, B.norm (x * y) ≤ c * B.norm x * B.norm y := by
-- The bounding constant `c` will be the maximum of the products `B.norm (B i * B j)`.
obtain ⟨c, _, hc⟩ := exists_mem_eq_sup' univ_nonempty (fun i : ι × ι ↦ B.norm (B i.1 * B i.2))
use B.norm (B c.1 * B c.2)
constructor
-- ∀ (x y : L), B.norm (x * y) ≤ B.norm (⇑B c.fst * ⇑B c.snd) * B.norm x * B.norm y
· intro x y
-- `ixy` is an index for which `‖B.repr (x*y) i‖` is maximum.
obtain ⟨ixy, _, hixy_def⟩ := exists_mem_eq_sup' univ_nonempty (fun i ↦ ‖(B.repr (x * y)) i‖)
-- We rewrite the LHS using `ixy`.
conv_lhs => simp only [Basis.norm]; rw [hixy_def, ← Basis.sum_repr B x, ← Basis.sum_repr B y]
rw [sum_mul, map_finset_sum]
simp_rw [smul_mul_assoc, LinearEquiv.map_smul, mul_sum, map_finset_sum,
mul_smul_comm, LinearEquiv.map_smul]
have hna' : IsNonarchimedean (NormedField.toMulRingNorm K) := hna
/- Since the norm is nonarchimidean, the norm of a finite sum is bounded by the maximum of the
norms of the summands. -/
obtain ⟨k, -, (hk : ‖∑ i : ι, (B.repr x i • ∑ i_1 : ι,
B.repr y i_1 • B.repr (B i * B i_1)) ixy‖ ≤
‖(B.repr x k • ∑ j : ι, B.repr y j • B.repr (B k * B j)) ixy‖)⟩ :=
IsNonarchimedean.finset_image_add hna'
(fun i ↦ (B.repr x i • ∑ i_1 : ι, B.repr y i_1 • B.repr (B i * B i_1)) ixy)
(univ : Finset ι)
simp only [Finsupp.coe_smul, Finsupp.coe_finset_sum, Pi.smul_apply, sum_apply, smul_eq_mul,
norm_mul] at hk ⊢
apply le_trans hk
-- We use the above property again.
obtain ⟨k', hk'⟩ : ∃ (k' : ι),
‖∑ j : ι, B.repr y j • B.repr (B k * B j) ixy‖ ≤
‖B.repr y k' • B.repr (B k * B k') ixy‖ := by
obtain ⟨k, hk0, hk⟩ := IsNonarchimedean.finset_image_add hna'
(fun i ↦ B.repr y i • B.repr (B k * B i) ixy) (univ : Finset ι)
exact ⟨k, hk⟩
apply le_trans (mul_le_mul_of_nonneg_left hk' (norm_nonneg _))
-- Now an easy computation leads to the desired conclusion.
rw [norm_smul, mul_assoc, mul_comm (B.norm (B c.fst * B c.snd)), ← mul_assoc]
exact mul_le_mul (mul_le_mul (B.norm_repr_le_norm _) (B.norm_repr_le_norm _)
(norm_nonneg _) (B.norm_nonneg _)) (le_trans (B.norm_repr_le_norm _)
(hc ▸ Finset.le_sup' (fun i : ι × ι ↦ B.norm (B i.1 * B i.2)) (mem_univ (k, k'))))
(norm_nonneg _) (mul_nonneg (B.norm_nonneg _) (B.norm_nonneg _))
-- `B c.1 * B c.2` is positive.
· have h_pos : (0 : ℝ) < B.norm (B i * B i) := by
have h1 : (1 : L) = (algebraMap K L) 1 := by rw [map_one]
rw [hBi, mul_one, h1, Basis.norm_extends hBi]
simp [norm_one, zero_lt_one]
exact lt_of_lt_of_le h_pos
(hc ▸ Finset.le_sup' (fun i : ι × ι ↦ B.norm (B i.1 * B i.2)) (mem_univ (i, i)))
/-- For any `k : K`, `y : L`, we have
`B.norm ((algebra_map K L) k * y) = B.norm ((algebra_map K L) k) * B.norm y`. -/
theorem norm_smul {ι : Type*} [Fintype ι] [Nonempty ι] {B : Basis ι K L} {i : ι}
(hBi : B i = (1 : L)) (k : K) (y : L) :
B.norm ((algebraMap K L) k * y) = B.norm ((algebraMap K L) k) * B.norm y := by
by_cases hk : k = 0
· rw [hk, map_zero, zero_mul, B.norm_zero, zero_mul]
· rw [norm_extends hBi]
obtain ⟨i, _, hi⟩ := exists_mem_eq_sup' univ_nonempty (fun i ↦ ‖B.repr y i‖)
obtain ⟨j, _, hj⟩ := exists_mem_eq_sup' univ_nonempty
(fun i ↦ ‖B.repr ((algebraMap K L) k * y) i‖)
have hij : ‖B.repr y i‖ = ‖B.repr y j‖ := by
rw [← hi]
apply le_antisymm _ (norm_repr_le_norm B j)
have hj' := Finset.le_sup' (fun i ↦ ‖B.repr ((algebraMap K L) k * y) i‖) (mem_univ i)
simp only [repr_smul', norm_mul, ← hi] at hj hj'
exact (mul_le_mul_iff_right₀ (lt_of_le_of_ne (norm_nonneg _)
(Ne.symm (norm_ne_zero_iff.mpr hk)))).mp (hj ▸ hj')
simp only [norm, hj]
rw [repr_smul', norm_mul, hi, hij]
end Module.Basis
end Ring
section Field
variable {K L : Type*} [NormedField K] [Field L] [Algebra K L]
/-- If `K` is a nonarchimedean normed field `L/K` is a finite extension, then there exists a
power-multiplicative nonarchimedean `K`-algebra norm on `L` extending the norm on `K`. -/
theorem exists_nonarchimedean_pow_mul_seminorm_of_finiteDimensional (hfd : FiniteDimensional K L)
(hna : IsNonarchimedean (norm : K → ℝ)) :
∃ f : AlgebraNorm K L, IsPowMul f ∧ (∀ (x : K), f ((algebraMap K L) x) = ‖x‖) ∧
IsNonarchimedean f := by
-- Choose a basis B = {1, e2,..., en} of the K-vector space L
have h1 : LinearIndepOn K id ({1} : Set L) := .singleton one_ne_zero
set ι := { x // x ∈ LinearIndepOn.extend h1 (Set.subset_univ ({1} : Set L)) }
set B : Basis ι K L := Basis.extend h1
letI hfin : Fintype ι := FiniteDimensional.fintypeBasisIndex B
haveI hem : Nonempty ι := B.index_nonempty
have h1L : (1 : L) ∈ LinearIndepOn.extend h1 _ :=
Basis.subset_extend _ (Set.mem_singleton (1 : L))
have hB1 : B ⟨1, h1L⟩ = (1 : L) := by rw [Basis.coe_extend, Subtype.coe_mk]
-- Define a function g : L → ℝ by setting g (∑ki • ei) = maxᵢ ‖ ki ‖
set g : L → ℝ := B.norm
-- g 0 = 0seminormFromBounded
have hg0 : g 0 = 0 := B.norm_zero
-- g takes nonnegative values
have hg_nonneg : ∀ x : L, 0 ≤ g x := fun x ↦ by simp only [g, Basis.norm]; simp
-- g extends the norm on K
have hg_ext : ∀ (x : K), g ((algebraMap K L) x) = ‖x‖ := Basis.norm_extends hB1
-- g is nonarchimedean
have hg_na : IsNonarchimedean g := Basis.norm_isNonarchimedean hna
-- g satisfies the triangle inequality
have hg_add : ∀ a b : L, g (a + b) ≤ g a + g b :=
fun _ _ ↦ IsNonarchimedean.add_le hg_nonneg hg_na
-- g (-a) = g a
have hg_neg : ∀ a : L, g (-a) = g a := B.norm_neg
-- g is multiplicatively bounded
obtain ⟨_, _, hg_bdd⟩ := Basis.norm_mul_le_const_mul_norm hB1 hna
-- g is a K-module norm
have hg_mul : ∀ (k : K) (y : L), g ((algebraMap K L) k * y) = g ((algebraMap K L) k) * g y :=
fun k y ↦ Basis.norm_smul hB1 k y
-- Using BGR Prop. 1.2.1/2, we can smooth g to a ring norm f on L that extends the norm on K.
set f := seminormFromBounded hg0 hg_nonneg hg_bdd hg_add hg_neg
have hf_na : IsNonarchimedean f := seminormFromBounded_isNonarchimedean hg_nonneg hg_bdd hg_na
have hf_1 : f 1 ≤ 1 := seminormFromBounded_one_le hg_nonneg hg_bdd
have hf_ext : ∀ (x : K), f ((algebraMap K L) x) = ‖x‖ :=
fun k ↦ hg_ext k ▸ seminormFromBounded_of_mul_apply hg_nonneg hg_bdd (hg_mul k)
-- Using BGR Prop. 1.3.2/1, we obtain from f a power multiplicative K-algebra norm on L
-- extending the norm on K.
set F' := smoothingSeminorm f hf_1 hf_na with hF'
have hF'_ext : ∀ k : K, F' ((algebraMap K L) k) = ‖k‖ := by
intro k
rw [← hf_ext _]
exact smoothingSeminorm_apply_of_map_mul_eq_mul f hf_1 hf_na
(seminormFromBounded_of_mul_is_mul hg_nonneg hg_bdd (hg_mul k))
have hF'_1 : F' 1 = 1 := by
have h1 : (1 : L) = (algebraMap K L) 1 := by rw [map_one]
simp only [h1, hF'_ext (1 : K), norm_one]
have hF'_0 : F' ≠ 0 := DFunLike.ne_iff.mpr ⟨(1 : L), by rw [hF'_1]; exact one_ne_zero⟩
set F : AlgebraNorm K L :=
{ RingSeminorm.toRingNorm F' hF'_0 with
smul' := fun k y ↦ by
have hk : ∀ y : L, f (algebraMap K L k * y) = f (algebraMap K L k) * f y :=
seminormFromBounded_of_mul_is_mul hg_nonneg hg_bdd (hg_mul k)
have hfk : ‖k‖ = (smoothingSeminorm f hf_1 hf_na) ((algebraMap K L) k) := by
rw [← hf_ext k, eq_comm, smoothingSeminorm_apply_of_map_mul_eq_mul f hf_1 hf_na hk]
simp only [hfk, hF']
-- TODO: There are missing `simp` lemmas here, that should be able to convert
-- `((smoothingSeminorm f hf_1 hf_na).toRingNorm ⋯).toRingSeminorm y` to
-- `(smoothingSeminorm f hf_1 hf_na y)`, after which the `erw` would work as a `rw`.
erw [← smoothingSeminorm_of_mul f hf_1 hf_na hk y]
rw [Algebra.smul_def]
rfl }
have hF_ext (k : K) : F ((algebraMap K L) k) = ‖k‖ := by
rw [← hf_ext]
exact smoothingSeminorm_apply_of_map_mul_eq_mul f hf_1 hf_na
(seminormFromBounded_of_mul_is_mul hg_nonneg hg_bdd (hg_mul k))
exact ⟨F, isPowMul_smoothingFun f hf_1, hF_ext, isNonarchimedean_smoothingFun f hf_1 hf_na⟩
end Field |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Unbundled/SeminormFromBounded.lean | import Mathlib.Analysis.Normed.Unbundled.RingSeminorm
/-!
# seminormFromBounded
In this file, we prove [BGR, Proposition 1.2.1/2][bosch-guntzer-remmert] : given a nonzero
additive group seminorm on a commutative ring `R` such that for some `c : ℝ` and every `x y : R`,
the inequality `f (x * y) ≤ c * f x * f y)` is satisfied, we create a ring seminorm on `R`.
In the file comments, we will use the expression `f is multiplicatively bounded` to indicate that
this condition holds.
## Main Definitions
* `seminormFromBounded'` : the real-valued function sending `x ∈ R` to the supremum of
`f(x*y)/f(y)`, where `y` runs over the elements of `R`.
* `seminormFromBounded` : the function `seminormFromBounded'` as a `RingSeminorm` on `R`.
* `normFromBounded` :`seminormFromBounded' f` as a `RingNorm` on `R`, provided that `f` is
nonnegative, multiplicatively bounded and subadditive, that it preserves `0` and negation, and
that `f` has trivial kernel.
## Main Results
* `seminormFromBounded_isNonarchimedean` : if `f : R → ℝ` is a nonnegative, multiplicatively
bounded, nonarchimedean function, then `seminormFromBounded' f` is nonarchimedean.
* `seminormFromBounded_of_mul_is_mul` : if `f : R → ℝ` is a nonnegative, multiplicatively bounded
function and `x : R` is multiplicative for `f`, then `x` is multiplicative for
`seminormFromBounded' f`.
## References
* [S. Bosch, U. Güntzer, R. Remmert, *Non-Archimedean Analysis*][bosch-guntzer-remmert]
## Tags
seminormFromBounded, RingSeminorm, Nonarchimedean
-/
noncomputable section
open scoped Topology NNReal
variable {R : Type _} [CommRing R] (f : R → ℝ) {c : ℝ}
section seminormFromBounded
/-- The real-valued function sending `x ∈ R` to the supremum of `f(x*y)/f(y)`, where `y` runs over
the elements of `R`. -/
def seminormFromBounded' : R → ℝ := fun x ↦ iSup fun y : R ↦ f (x * y) / f y
variable {f}
/-- If `f : R → ℝ` is a nonzero, nonnegative, multiplicatively bounded function, then `f 1 ≠ 0`. -/
theorem map_one_ne_zero (f_ne_zero : f ≠ 0) (f_nonneg : 0 ≤ f)
(f_mul : ∀ x y : R, f (x * y) ≤ c * f x * f y) : f 1 ≠ 0 := by
intro h1
specialize f_mul 1
simp_rw [h1, one_mul, mul_zero, zero_mul] at f_mul
obtain ⟨z, hz⟩ := Function.ne_iff.mp f_ne_zero
exact hz <| (f_mul z).antisymm (f_nonneg z)
/-- If `f : R → ℝ` is a nonnegative multiplicatively bounded function and `x : R` is a unit with
`f x ≠ 0`, then for every `n : ℕ`, we have `f (x ^ n) ≠ 0`. -/
theorem map_pow_ne_zero (f_nonneg : 0 ≤ f) {x : R} (hx : IsUnit x) (hfx : f x ≠ 0) (n : ℕ)
(f_mul : ∀ x y : R, f (x * y) ≤ c * f x * f y) : f (x ^ n) ≠ 0 := by
have h1 : f 1 ≠ 0 := map_one_ne_zero (Function.ne_iff.mpr ⟨x, hfx⟩) f_nonneg f_mul
intro hxn
have : f 1 ≤ 0 := by simpa [← mul_pow, hxn] using f_mul (x ^ n) (hx.unit⁻¹ ^ n)
exact h1 <| this.antisymm (f_nonneg 1)
/-- If `f : R → ℝ` is a nonnegative, multiplicatively bounded function, then given `x y : R` with
`f x = 0`, we have `f (x * y) = 0`. -/
theorem map_mul_zero_of_map_zero (f_nonneg : 0 ≤ f)
(f_mul : ∀ x y : R, f (x * y) ≤ c * f x * f y) {x : R} (hx : f x = 0)
(y : R) : f (x * y) = 0 := by
replace f_mul : f (x * y) ≤ 0 := by simpa [hx] using f_mul x y
exact le_antisymm f_mul (f_nonneg _)
/-- `seminormFromBounded' f` preserves `0`. -/
theorem seminormFromBounded_zero (f_zero : f 0 = 0) : seminormFromBounded' f (0 : R) = 0 := by
simp_rw [seminormFromBounded', zero_mul, f_zero, zero_div, ciSup_const]
theorem seminormFromBounded_aux (f_nonneg : 0 ≤ f)
(f_mul : ∀ x y : R, f (x * y) ≤ c * f x * f y) (x : R) : 0 ≤ c * f x := by
rcases (f_nonneg x).eq_or_lt' with hx | hx
· simp [hx]
· change 0 < f x at hx
have hc : 0 ≤ c := by
specialize f_mul x 1
rw [mul_one, show c * f x * f 1 = c * f 1 * f x by ring, le_mul_iff_one_le_left hx] at f_mul
replace f_nonneg : 0 ≤ f 1 := f_nonneg 1
rcases f_nonneg.eq_or_lt' with h1 | h1
· linarith [show (1 : ℝ) ≤ 0 by simpa [h1] using f_mul]
· rw [← div_le_iff₀ h1] at f_mul
linarith [one_div_pos.mpr h1]
positivity
/-- If `f : R → ℝ` is a nonnegative, multiplicatively bounded function, then for every `x : R`,
the image of `y ↦ f (x * y) / f y` is bounded above. -/
theorem seminormFromBounded_bddAbove_range (f_nonneg : 0 ≤ f)
(f_mul : ∀ x y : R, f (x * y) ≤ c * f x * f y) (x : R) :
BddAbove (Set.range fun y ↦ f (x * y) / f y) := by
use c * f x
rintro r ⟨y, rfl⟩
rcases (f_nonneg y).eq_or_lt' with hy0 | hy0
· simpa [hy0] using seminormFromBounded_aux f_nonneg f_mul x
· simpa [div_le_iff₀ hy0] using f_mul x y
/-- If `f : R → ℝ` is a nonnegative, multiplicatively bounded function, then for every `x : R`,
`seminormFromBounded' f x` is bounded above by some multiple of `f x`. -/
theorem seminormFromBounded_le (f_nonneg : 0 ≤ f)
(f_mul : ∀ x y : R, f (x * y) ≤ c * f x * f y) (x : R) :
seminormFromBounded' f x ≤ c * f x := by
refine ciSup_le (fun y ↦ ?_)
rcases (f_nonneg y).eq_or_lt' with hy | hy
· simpa [hy] using seminormFromBounded_aux f_nonneg f_mul x
· rw [div_le_iff₀ hy]
apply f_mul
/-- If `f : R → ℝ` is a nonnegative, multiplicatively bounded function, then for every `x : R`,
`f x ≤ f 1 * seminormFromBounded' f x`. -/
theorem seminormFromBounded_ge (f_nonneg : 0 ≤ f)
(f_mul : ∀ x y : R, f (x * y) ≤ c * f x * f y) (x : R) :
f x ≤ f 1 * seminormFromBounded' f x := by
by_cases h1 : f 1 = 0
· specialize f_mul x 1
rw [mul_one, h1, mul_zero] at f_mul
have hx0 : f x = 0 := f_mul.antisymm (f_nonneg _)
rw [hx0, h1, zero_mul]
· rw [mul_comm, ← div_le_iff₀ (lt_of_le_of_ne' (f_nonneg _) h1)]
conv_lhs => rw [← mul_one x]
exact le_ciSup (seminormFromBounded_bddAbove_range f_nonneg f_mul x) (1 : R)
/-- If `f : R → ℝ` is a nonnegative, multiplicatively bounded function, then
`seminormFromBounded' f` is nonnegative. -/
theorem seminormFromBounded_nonneg (f_nonneg : 0 ≤ f)
(f_mul : ∀ x y : R, f (x * y) ≤ c * f x * f y) :
0 ≤ seminormFromBounded' f := fun x ↦
le_csSup_of_le (seminormFromBounded_bddAbove_range f_nonneg f_mul x) ⟨1, rfl⟩
(div_nonneg (f_nonneg _) (f_nonneg _))
/-- If `f : R → ℝ` is a nonnegative, multiplicatively bounded function, then
`seminormFromBounded' f x = 0` if and only if `f x = 0`. -/
theorem seminormFromBounded_eq_zero_iff (f_nonneg : 0 ≤ f)
(f_mul : ∀ x y : R, f (x * y) ≤ c * f x * f y) (x : R) :
seminormFromBounded' f x = 0 ↔ f x = 0 := by
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· have hf := seminormFromBounded_ge f_nonneg f_mul x
rw [h, mul_zero] at hf
exact hf.antisymm (f_nonneg _)
· have hf : seminormFromBounded' f x ≤ c * f x :=
seminormFromBounded_le f_nonneg f_mul x
rw [h, mul_zero] at hf
exact hf.antisymm (seminormFromBounded_nonneg f_nonneg f_mul x)
/-- If `f` is invariant under negation of `x`, then so is `seminormFromBounded'`. -/
theorem seminormFromBounded_neg (f_neg : ∀ x : R, f (-x) = f x) (x : R) :
seminormFromBounded' f (-x) = seminormFromBounded' f x := by
suffices ⨆ y, f (-x * y) / f y = ⨆ y, f (x * y) / f y by simpa only [seminormFromBounded']
congr
ext y
rw [neg_mul, f_neg]
/-- If `f : R → ℝ` is a nonnegative, multiplicatively bounded function, then
`seminormFromBounded' f` is submultiplicative. -/
theorem seminormFromBounded_mul (f_nonneg : 0 ≤ f)
(f_mul : ∀ x y : R, f (x * y) ≤ c * f x * f y) (x y : R) :
seminormFromBounded' f (x * y) ≤ seminormFromBounded' f x * seminormFromBounded' f y := by
apply ciSup_le
by_cases hy : seminormFromBounded' f y = 0
· rw [seminormFromBounded_eq_zero_iff f_nonneg f_mul] at hy
intro z
rw [mul_comm x y, mul_assoc, map_mul_zero_of_map_zero f_nonneg f_mul hy (x * z), zero_div]
exact mul_nonneg (seminormFromBounded_nonneg f_nonneg f_mul x)
(seminormFromBounded_nonneg f_nonneg f_mul y)
· intro z
rw [← div_le_iff₀ (lt_of_le_of_ne' (seminormFromBounded_nonneg f_nonneg f_mul _) hy)]
apply le_ciSup_of_le (seminormFromBounded_bddAbove_range f_nonneg f_mul x) z
rw [div_le_iff₀ (lt_of_le_of_ne' (seminormFromBounded_nonneg f_nonneg f_mul _) hy),
div_mul_eq_mul_div]
by_cases hz : f z = 0
· have hxyz : f (z * (x * y)) = 0 := map_mul_zero_of_map_zero f_nonneg f_mul hz _
simp_rw [mul_comm, hxyz, zero_div]
exact div_nonneg (mul_nonneg (seminormFromBounded_nonneg f_nonneg f_mul y) (f_nonneg _))
(f_nonneg _)
· rw [div_le_div_iff_of_pos_right (lt_of_le_of_ne' (f_nonneg _) hz), mul_comm (f (x * z))]
by_cases hxz : f (x * z) = 0
· rw [mul_comm x y, mul_assoc, mul_comm y, map_mul_zero_of_map_zero f_nonneg f_mul hxz y]
exact mul_nonneg (seminormFromBounded_nonneg f_nonneg f_mul y) (f_nonneg _)
· rw [← div_le_iff₀ (lt_of_le_of_ne' (f_nonneg _) hxz)]
apply le_ciSup_of_le (seminormFromBounded_bddAbove_range f_nonneg f_mul y) (x * z)
rw [div_le_div_iff_of_pos_right (lt_of_le_of_ne' (f_nonneg _) hxz), mul_comm x y, mul_assoc]
/-- If `f : R → ℝ` is a nonzero, nonnegative, multiplicatively bounded function, then
`seminormFromBounded' f 1 = 1`. -/
theorem seminormFromBounded_one (f_ne_zero : f ≠ 0) (f_nonneg : 0 ≤ f)
(f_mul : ∀ x y : R, f (x * y) ≤ c * f x * f y) :
seminormFromBounded' f 1 = 1 := by
simp_rw [seminormFromBounded', one_mul]
apply le_antisymm
· refine ciSup_le (fun x ↦ ?_)
by_cases hx : f x = 0
· rw [hx, div_zero]; exact zero_le_one
· rw [div_self hx]
· rw [← div_self (map_one_ne_zero f_ne_zero f_nonneg f_mul)]
have h_bdd : BddAbove (Set.range fun y ↦ f y / f y) := by
use (1 : ℝ)
rintro r ⟨y, rfl⟩
by_cases hy : f y = 0
· simp only [hy, div_zero, zero_le_one]
· simp only [div_self hy, le_refl]
exact le_ciSup h_bdd (1 : R)
/-- If `f : R → ℝ` is a nonnegative, multiplicatively bounded function, then
`seminormFromBounded' f 1 ≤ 1`. -/
theorem seminormFromBounded_one_le (f_nonneg : 0 ≤ f)
(f_mul : ∀ x y : R, f (x * y) ≤ c * f x * f y) :
seminormFromBounded' f 1 ≤ 1 := by
by_cases! f_ne_zero : f ≠ 0
· exact le_of_eq (seminormFromBounded_one f_ne_zero f_nonneg f_mul)
· simp_rw [seminormFromBounded', one_mul]
refine ciSup_le (fun _ ↦ ?_)
simp only [f_ne_zero, Pi.zero_apply, div_zero, zero_le_one]
/-- If `f : R → ℝ` is a nonnegative, multiplicatively bounded, subadditive function, then
`seminormFromBounded' f` is subadditive. -/
theorem seminormFromBounded_add (f_nonneg : 0 ≤ f)
(f_mul : ∀ x y : R, f (x * y) ≤ c * f x * f y)
(f_add : ∀ a b, f (a + b) ≤ f a + f b) (x y : R) :
seminormFromBounded' f (x + y) ≤ seminormFromBounded' f x + seminormFromBounded' f y := by
refine ciSup_le (fun z ↦ ?_)
suffices hf : f ((x + y) * z) / f z ≤ f (x * z) / f z + f (y * z) / f z by
exact le_trans hf (add_le_add
(le_ciSup_of_le (seminormFromBounded_bddAbove_range f_nonneg f_mul x) z (le_refl _))
(le_ciSup_of_le (seminormFromBounded_bddAbove_range f_nonneg f_mul y) z (le_refl _)))
by_cases hz : f z = 0
· simp only [hz, div_zero, zero_add, le_refl]
· rw [← add_div, div_le_div_iff_of_pos_right (lt_of_le_of_ne' (f_nonneg _) hz), add_mul]
exact f_add _ _
/-- `seminormFromBounded'` is a ring seminorm on `R`. -/
def seminormFromBounded (f_zero : f 0 = 0) (f_nonneg : 0 ≤ f)
(f_mul : ∀ x y : R, f (x * y) ≤ c * f x * f y)
(f_add : ∀ a b, f (a + b) ≤ f a + f b) (f_neg : ∀ x : R, f (-x) = f x) : RingSeminorm R where
toFun := seminormFromBounded' f
map_zero' := seminormFromBounded_zero f_zero
add_le' := seminormFromBounded_add f_nonneg f_mul f_add
mul_le' := seminormFromBounded_mul f_nonneg f_mul
neg' := seminormFromBounded_neg f_neg
/-- If `f : R → ℝ` is a nonnegative, multiplicatively bounded, nonarchimedean function, then
`seminormFromBounded' f` is nonarchimedean. -/
theorem seminormFromBounded_isNonarchimedean (f_nonneg : 0 ≤ f)
(f_mul : ∀ x y : R, f (x * y) ≤ c * f x * f y)
(hna : IsNonarchimedean f) : IsNonarchimedean (seminormFromBounded' f) := by
refine fun x y ↦ ciSup_le (fun z ↦ ?_)
rw [le_max_iff]
suffices hf : f ((x + y) * z) / f z ≤ f (x * z) / f z ∨ f ((x + y) * z) / f z ≤ f (y * z) / f z by
rcases hf with hfx | hfy
· exact Or.inl <| le_ciSup_of_le (seminormFromBounded_bddAbove_range f_nonneg f_mul x) z hfx
· exact Or.inr <| le_ciSup_of_le (seminormFromBounded_bddAbove_range f_nonneg f_mul y) z hfy
by_cases hz : f z = 0
· simp only [hz, div_zero, le_refl, or_self_iff]
· rw [div_le_div_iff_of_pos_right (lt_of_le_of_ne' (f_nonneg _) hz),
div_le_div_iff_of_pos_right (lt_of_le_of_ne' (f_nonneg _) hz), add_mul, ← le_max_iff]
exact hna _ _
/-- If `f : R → ℝ` is a nonnegative, multiplicatively bounded function and `x : R` is
multiplicative for `f`, then `seminormFromBounded' f x = f x`. -/
theorem seminormFromBounded_of_mul_apply (f_nonneg : 0 ≤ f)
(f_mul : ∀ x y : R, f (x * y) ≤ c * f x * f y) {x : R}
(hx : ∀ y : R, f (x * y) = f x * f y) : seminormFromBounded' f x = f x := by
simp_rw [seminormFromBounded', hx, ← mul_div_assoc']
apply le_antisymm
· refine ciSup_le (fun x ↦ ?_)
by_cases hx : f x = 0
· rw [hx, div_zero, mul_zero]; exact f_nonneg _
· rw [div_self hx, mul_one]
· by_cases! f_ne_zero : f ≠ 0
· conv_lhs => rw [← mul_one (f x)]
rw [← div_self (map_one_ne_zero f_ne_zero f_nonneg f_mul)]
have h_bdd : BddAbove (Set.range fun y ↦ f x * (f y / f y)) := by
use f x
rintro r ⟨y, rfl⟩
by_cases hy0 : f y = 0
· simp only [hy0, div_zero, mul_zero]; exact f_nonneg _
· simp only [div_self hy0, mul_one, le_refl]
exact le_ciSup h_bdd (1 : R)
· simp_rw [f_ne_zero, Pi.zero_apply, zero_div, zero_mul, ciSup_const]; rfl
/-- If `f : R → ℝ` is a nonnegative function and `x : R` is submultiplicative for `f`, then
`seminormFromBounded' f x = f x`. -/
theorem seminormFromBounded_of_mul_le (f_nonneg : 0 ≤ f) {x : R}
(hx : ∀ y : R, f (x * y) ≤ f x * f y) (h_one : f 1 ≤ 1) : seminormFromBounded' f x = f x := by
simp_rw [seminormFromBounded']
apply le_antisymm
· refine ciSup_le (fun y ↦ ?_)
by_cases hy : f y = 0
· rw [hy, div_zero]; exact f_nonneg _
· rw [div_le_iff₀ (lt_of_le_of_ne' (f_nonneg _) hy)]; exact hx _
· have h_bdd : BddAbove (Set.range fun y ↦ f (x * y) / f y) := by
use f x
rintro r ⟨y, rfl⟩
by_cases hy0 : f y = 0
· simp only [hy0, div_zero]
exact f_nonneg _
· rw [← mul_one (f x), ← div_self hy0, ← mul_div_assoc,
div_le_iff₀ (lt_of_le_of_ne' (f_nonneg _) hy0), mul_div_assoc, div_self hy0, mul_one]
exact hx y
convert le_ciSup h_bdd (1 : R)
by_cases h0 : f x = 0
· rw [mul_one, h0, zero_div]
· have heq : f 1 = 1 := by
apply h_one.antisymm
specialize hx 1
rw [mul_one, le_mul_iff_one_le_right (lt_of_le_of_ne (f_nonneg _) (Ne.symm h0))] at hx
exact hx
rw [heq, mul_one, div_one]
/-- If `f : R → ℝ` is a nonzero, nonnegative, multiplicatively bounded function, then
`seminormFromBounded' f` is nonzero. -/
theorem seminormFromBounded_nonzero (f_ne_zero : f ≠ 0) (f_nonneg : 0 ≤ f)
(f_mul : ∀ x y : R, f (x * y) ≤ c * f x * f y) :
seminormFromBounded' f ≠ 0 := by
obtain ⟨x, hx⟩ := Function.ne_iff.mp f_ne_zero
rw [Function.ne_iff]
use x
rw [ne_eq, Pi.zero_apply, seminormFromBounded_eq_zero_iff f_nonneg f_mul x]
exact hx
/-- If `f : R → ℝ` is a nonnegative, multiplicatively bounded function, then the kernel of
`seminormFromBounded' f` equals the kernel of `f`. -/
theorem seminormFromBounded_ker (f_nonneg : 0 ≤ f)
(f_mul : ∀ x y : R, f (x * y) ≤ c * f x * f y) :
seminormFromBounded' f ⁻¹' {0} = f ⁻¹' {0} := by
ext x
exact seminormFromBounded_eq_zero_iff f_nonneg f_mul x
/-- If `f : R → ℝ` is a nonnegative, multiplicatively bounded, subadditive function that preserves
zero and negation, then `seminormFromBounded' f` is a norm if and only if `f⁻¹' {0} = {0}`. -/
theorem seminormFromBounded_is_norm_iff (f_zero : f 0 = 0) (f_nonneg : 0 ≤ f)
(f_mul : ∀ x y : R, f (x * y) ≤ c * f x * f y)
(f_add : ∀ a b, f (a + b) ≤ f a + f b) (f_neg : ∀ x : R, f (-x) = f x) :
(∀ x : R, (seminormFromBounded f_zero f_nonneg f_mul f_add f_neg).toFun x = 0 → x = 0) ↔
f ⁻¹' {0} = {0} := by
refine ⟨fun h0 ↦ ?_, fun h_ker x hx ↦ ?_⟩
· rw [← seminormFromBounded_ker f_nonneg f_mul]
ext x
simp only [Set.mem_preimage, Set.mem_singleton_iff]
exact ⟨fun h ↦ h0 x h, fun h ↦ by rw [h]; exact seminormFromBounded_zero f_zero⟩
· rw [← Set.mem_singleton_iff, ← h_ker, Set.mem_preimage, Set.mem_singleton_iff,
← seminormFromBounded_eq_zero_iff f_nonneg f_mul x]
exact hx
/-- `seminormFromBounded' f` as a `RingNorm` on `R`, provided that `f` is nonnegative,
multiplicatively bounded and subadditive, that it preserves `0` and negation, and that `f` has
trivial kernel. -/
def normFromBounded (f_zero : f 0 = 0) (f_nonneg : 0 ≤ f)
(f_mul : ∀ x y : R, f (x * y) ≤ c * f x * f y)
(f_add : ∀ a b, f (a + b) ≤ f a + f b) (f_neg : ∀ x : R, f (-x) = f x)
(f_ker : f ⁻¹' {0} = {0}) : RingNorm R :=
{ seminormFromBounded f_zero f_nonneg f_mul f_add f_neg with
eq_zero_of_map_eq_zero' :=
(seminormFromBounded_is_norm_iff f_zero f_nonneg f_mul f_add f_neg).mpr f_ker }
/-- If `f : R → ℝ` is a nonnegative, multiplicatively bounded function and `x : R` is
multiplicative for `f`, then `x` is multiplicative for `seminormFromBounded' f`. -/
theorem seminormFromBounded_of_mul_is_mul (f_nonneg : 0 ≤ f)
(f_mul : ∀ x y : R, f (x * y) ≤ c * f x * f y) {x : R}
(hx : ∀ y : R, f (x * y) = f x * f y) (y : R) :
seminormFromBounded' f (x * y) = seminormFromBounded' f x * seminormFromBounded' f y := by
rw [seminormFromBounded_of_mul_apply f_nonneg f_mul hx]
simp only [seminormFromBounded', mul_assoc, hx, mul_div_assoc,
Real.mul_iSup_of_nonneg (f_nonneg _)]
end seminormFromBounded |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Unbundled/RingSeminorm.lean | import Mathlib.Algebra.Order.Ring.IsNonarchimedean
import Mathlib.Analysis.Normed.Field.Lemmas
import Mathlib.Analysis.SpecialFunctions.Pow.Real
/-!
# Seminorms and norms on rings
This file defines seminorms and norms on rings. These definitions are useful when one needs to
consider multiple (semi)norms on a given ring.
## Main declarations
For a ring `R`:
* `RingSeminorm`: A seminorm on a ring `R` is a function `f : R → ℝ` that preserves zero, takes
nonnegative values, is subadditive and submultiplicative and such that `f (-x) = f x` for all
`x ∈ R`.
* `RingNorm`: A seminorm `f` is a norm if `f x = 0` if and only if `x = 0`.
* `MulRingSeminorm`: A multiplicative seminorm on a ring `R` is a ring seminorm that preserves
multiplication.
* `MulRingNorm`: A multiplicative norm on a ring `R` is a ring norm that preserves multiplication.
`MulRingNorm R` is essentially the same as `AbsoluteValue R ℝ`, and it is recommended to
use the latter instead to avoid duplicating results.
## Notes
The corresponding hom classes are defined in `Mathlib/Analysis/Order/Hom/Basic.lean` to be used by
absolute values.
## References
* [S. Bosch, U. Güntzer, R. Remmert, *Non-Archimedean Analysis*][bosch-guntzer-remmert]
## Tags
ring_seminorm, ring_norm
-/
open NNReal
variable {R : Type*}
/-- A seminorm on a ring `R` is a function `f : R → ℝ` that preserves zero, takes nonnegative
values, is subadditive and submultiplicative and such that `f (-x) = f x` for all `x ∈ R`. -/
structure RingSeminorm (R : Type*) [NonUnitalNonAssocRing R] extends AddGroupSeminorm R where
/-- The property of a `RingSeminorm` that for all `x` and `y` in the ring, the norm of `x * y` is
less than the norm of `x` times the norm of `y`. -/
mul_le' : ∀ x y : R, toFun (x * y) ≤ toFun x * toFun y
/-- A function `f : R → ℝ` is a norm on a (nonunital) ring if it is a seminorm and `f x = 0`
implies `x = 0`. -/
structure RingNorm (R : Type*) [NonUnitalNonAssocRing R] extends RingSeminorm R, AddGroupNorm R
/-- A multiplicative seminorm on a ring `R` is a function `f : R → ℝ` that preserves zero and
multiplication, takes nonnegative values, is subadditive and such that `f (-x) = f x` for all `x`.
-/
structure MulRingSeminorm (R : Type*) [NonAssocRing R] extends AddGroupSeminorm R,
MonoidWithZeroHom R ℝ
/-- A multiplicative norm on a ring `R` is a multiplicative ring seminorm such that `f x = 0`
implies `x = 0`.
It is recommended to use `AbsoluteValue R ℝ` instead (which works for `Semiring R`
and is equivalent to `MulRingNorm R` for a nontrivial `Ring R`). -/
structure MulRingNorm (R : Type*) [NonAssocRing R] extends MulRingSeminorm R, AddGroupNorm R
attribute [nolint docBlame]
RingSeminorm.toAddGroupSeminorm RingNorm.toAddGroupNorm RingNorm.toRingSeminorm
MulRingSeminorm.toAddGroupSeminorm MulRingSeminorm.toMonoidWithZeroHom
MulRingNorm.toAddGroupNorm MulRingNorm.toMulRingSeminorm
namespace RingSeminorm
section NonUnitalRing
variable [NonUnitalRing R]
instance funLike : FunLike (RingSeminorm R) R ℝ where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
ext x
exact congr_fun h x
instance ringSeminormClass : RingSeminormClass (RingSeminorm R) R ℝ where
map_zero f := f.map_zero'
map_add_le_add f := f.add_le'
map_mul_le_mul f := f.mul_le'
map_neg_eq_map f := f.neg'
@[simp]
theorem toFun_eq_coe (p : RingSeminorm R) : (p.toAddGroupSeminorm : R → ℝ) = p :=
rfl
@[ext]
theorem ext {p q : RingSeminorm R} : (∀ x, p x = q x) → p = q :=
DFunLike.ext p q
instance : Zero (RingSeminorm R) :=
⟨{ AddGroupSeminorm.instZeroAddGroupSeminorm.zero with mul_le' :=
fun _ _ => (zero_mul _).ge }⟩
theorem eq_zero_iff {p : RingSeminorm R} : p = 0 ↔ ∀ x, p x = 0 :=
DFunLike.ext_iff
theorem ne_zero_iff {p : RingSeminorm R} : p ≠ 0 ↔ ∃ x, p x ≠ 0 := by simp [eq_zero_iff]
instance : Inhabited (RingSeminorm R) :=
⟨0⟩
/-- The trivial seminorm on a ring `R` is the `RingSeminorm` taking value `0` at `0` and `1` at
every other element. -/
instance [DecidableEq R] : One (RingSeminorm R) :=
⟨{ (1 : AddGroupSeminorm R) with
mul_le' := fun x y => by
by_cases h : x * y = 0
· refine (if_pos h).trans_le (mul_nonneg ?_ ?_) <;>
· change _ ≤ ite _ _ _
split_ifs
exacts [le_rfl, zero_le_one]
· change ite _ _ _ ≤ ite _ _ _ * ite _ _ _
simp only [if_false, h, left_ne_zero_of_mul h, right_ne_zero_of_mul h, mul_one,
le_refl] }⟩
@[simp]
theorem apply_one [DecidableEq R] (x : R) : (1 : RingSeminorm R) x = if x = 0 then 0 else 1 :=
rfl
end NonUnitalRing
section Ring
variable [Ring R] (p : RingSeminorm R)
theorem seminorm_one_eq_one_iff_ne_zero (hp : p 1 ≤ 1) : p 1 = 1 ↔ p ≠ 0 := by
refine
⟨fun h => ne_zero_iff.mpr ⟨1, by rw [h]; exact one_ne_zero⟩,
fun h => ?_⟩
obtain hp0 | hp0 := (apply_nonneg p (1 : R)).eq_or_lt'
· exfalso
refine h (ext fun x => (apply_nonneg _ _).antisymm' ?_)
simpa only [hp0, mul_one, mul_zero] using map_mul_le_mul p x 1
· refine hp.antisymm ((le_mul_iff_one_le_left hp0).1 ?_)
simpa only [one_mul] using map_mul_le_mul p (1 : R) _
end Ring
section CommRing
variable [CommRing R] (p : RingSeminorm R)
theorem exists_index_pow_le (hna : IsNonarchimedean p) (x y : R) (n : ℕ) :
∃ (m : ℕ), m < n + 1 ∧ p ((x + y) ^ (n : ℕ)) ^ (1 / (n : ℝ)) ≤
(p (x ^ m) * p (y ^ (n - m : ℕ))) ^ (1 / (n : ℝ)) := by
obtain ⟨m, hm_lt, hm⟩ := IsNonarchimedean.add_pow_le hna n x y
exact ⟨m, hm_lt, by gcongr⟩
end CommRing
end RingSeminorm
/-- If `f` is a ring seminorm on `a`, then `∀ {n : ℕ}, n ≠ 0 → f (a ^ n) ≤ f a ^ n`. -/
theorem map_pow_le_pow {F α : Type*} [Ring α] [FunLike F α ℝ] [RingSeminormClass F α ℝ] (f : F)
(a : α) : ∀ {n : ℕ}, n ≠ 0 → f (a ^ n) ≤ f a ^ n
| 0, h => absurd rfl h
| 1, _ => by simp only [pow_one, le_refl]
| n + 2, _ => by
simp only [pow_succ _ (n + 1)]
grw [map_mul_le_mul, map_pow_le_pow _ _ n.succ_ne_zero]
/-- If `f` is a ring seminorm on `a` with `f 1 ≤ 1`, then `∀ (n : ℕ), f (a ^ n) ≤ f a ^ n`. -/
theorem map_pow_le_pow' {F α : Type*} [Ring α] [FunLike F α ℝ] [RingSeminormClass F α ℝ] {f : F}
(hf1 : f 1 ≤ 1) (a : α) : ∀ n : ℕ, f (a ^ n) ≤ f a ^ n
| 0 => by simp only [pow_zero, hf1]
| n + 1 => map_pow_le_pow _ _ n.succ_ne_zero
/-- The norm of a `NonUnitalSeminormedRing` as a `RingSeminorm`. -/
def normRingSeminorm (R : Type*) [NonUnitalSeminormedRing R] : RingSeminorm R :=
{ normAddGroupSeminorm R with
toFun := norm
mul_le' := norm_mul_le }
namespace RingSeminorm
variable [Ring R] (p : RingSeminorm R)
open Filter Nat Real
/-- If `f` is a ring seminorm on `R` with `f 1 ≤ 1` and `s : ℕ → ℕ` is bounded by `n`, then
`f (x ^ s (ψ n)) ^ (1 / (ψ n : ℝ))` is eventually bounded. -/
theorem isBoundedUnder (hp : p 1 ≤ 1) {s : ℕ → ℕ} (hs_le : ∀ n : ℕ, s n ≤ n) {x : R} (ψ : ℕ → ℕ) :
IsBoundedUnder LE.le atTop fun n : ℕ => p (x ^ s (ψ n)) ^ (1 / (ψ n : ℝ)) := by
have h_le : ∀ m : ℕ, p (x ^ s (ψ m)) ^ (1 / (ψ m : ℝ)) ≤ p x ^ ((s (ψ m) : ℝ) / (ψ m : ℝ)) := by
intro m
rw [← mul_one_div (s (ψ m) : ℝ), rpow_mul (apply_nonneg p x), rpow_natCast]
grw [map_pow_le_pow' hp x]
apply isBoundedUnder_of
cases le_or_gt (p x) 1 with
| inl hfx =>
use 1, fun m ↦ le_trans (h_le m) (rpow_le_one (by positivity) hfx (by positivity))
| inr hfx =>
use p x
refine fun m ↦ le_trans (h_le m) <| rpow_le_self_of_one_le hfx.le ?_
exact div_le_one_of_le₀ (mod_cast hs_le _) (cast_nonneg _)
end RingSeminorm
namespace RingNorm
section NonUnitalRing
variable [NonUnitalRing R]
instance funLike : FunLike (RingNorm R) R ℝ where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
ext x
exact congr_fun h x
instance ringNormClass : RingNormClass (RingNorm R) R ℝ where
map_zero f := f.map_zero'
map_add_le_add f := f.add_le'
map_mul_le_mul f := f.mul_le'
map_neg_eq_map f := f.neg'
eq_zero_of_map_eq_zero f := f.eq_zero_of_map_eq_zero' _
theorem toFun_eq_coe (p : RingNorm R) : p.toFun = p := rfl
@[ext]
theorem ext {p q : RingNorm R} : (∀ x, p x = q x) → p = q :=
DFunLike.ext p q
variable (R)
/-- The trivial norm on a ring `R` is the `RingNorm` taking value `0` at `0` and `1` at every
other element. -/
instance [DecidableEq R] : One (RingNorm R) :=
⟨{ (1 : RingSeminorm R), (1 : AddGroupNorm R) with }⟩
@[simp]
theorem apply_one [DecidableEq R] (x : R) : (1 : RingNorm R) x = if x = 0 then 0 else 1 :=
rfl
instance [DecidableEq R] : Inhabited (RingNorm R) :=
⟨1⟩
end NonUnitalRing
/-- The `NormedRing` structure on a ring `R` determined by a `RingNorm` -/
-- See note |reducible non-instances]
abbrev toNormedRing [Ring R] (f : RingNorm R) : NormedRing R where
__ := ‹Ring R›
__ := f.toAddGroupNorm.toNormedAddCommGroup
norm_mul_le := map_mul_le_mul f
end RingNorm
namespace MulRingSeminorm
variable [NonAssocRing R]
instance funLike : FunLike (MulRingSeminorm R) R ℝ where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
ext x
exact congr_fun h x
instance mulRingSeminormClass : MulRingSeminormClass (MulRingSeminorm R) R ℝ where
map_zero f := f.map_zero'
map_one f := f.map_one'
map_add_le_add f := f.add_le'
map_mul f := f.map_mul'
map_neg_eq_map f := f.neg'
@[simp]
theorem toFun_eq_coe (p : MulRingSeminorm R) : (p.toAddGroupSeminorm : R → ℝ) = p :=
rfl
@[ext]
theorem ext {p q : MulRingSeminorm R} : (∀ x, p x = q x) → p = q :=
DFunLike.ext p q
variable [DecidableEq R] [NoZeroDivisors R] [Nontrivial R]
/-- The trivial seminorm on a ring `R` is the `MulRingSeminorm` taking value `0` at `0` and `1` at
every other element. -/
instance : One (MulRingSeminorm R) :=
⟨{ (1 : AddGroupSeminorm R) with
map_one' := if_neg one_ne_zero
map_mul' := fun x y => by
obtain rfl | hx := eq_or_ne x 0
· simp
obtain rfl | hy := eq_or_ne y 0
· simp
· simp [hx, hy] }⟩
@[simp]
theorem apply_one (x : R) : (1 : MulRingSeminorm R) x = if x = 0 then 0 else 1 :=
rfl
instance : Inhabited (MulRingSeminorm R) :=
⟨1⟩
end MulRingSeminorm
namespace MulRingNorm
variable [NonAssocRing R]
instance funLike : FunLike (MulRingNorm R) R ℝ where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
ext x
exact congr_fun h x
instance mulRingNormClass : MulRingNormClass (MulRingNorm R) R ℝ where
map_zero f := f.map_zero'
map_one f := f.map_one'
map_add_le_add f := f.add_le'
map_mul f := f.map_mul'
map_neg_eq_map f := f.neg'
eq_zero_of_map_eq_zero f := f.eq_zero_of_map_eq_zero' _
theorem toFun_eq_coe (p : MulRingNorm R) : p.toFun = p := rfl
@[ext]
theorem ext {p q : MulRingNorm R} : (∀ x, p x = q x) → p = q :=
DFunLike.ext p q
variable (R)
variable [DecidableEq R] [NoZeroDivisors R] [Nontrivial R]
/-- The trivial norm on a ring `R` is the `MulRingNorm` taking value `0` at `0` and `1` at every
other element. -/
instance : One (MulRingNorm R) :=
⟨{ (1 : MulRingSeminorm R), (1 : AddGroupNorm R) with }⟩
@[simp]
theorem apply_one (x : R) : (1 : MulRingNorm R) x = if x = 0 then 0 else 1 :=
rfl
instance : Inhabited (MulRingNorm R) :=
⟨1⟩
section MulRingNorm_equiv_AbsoluteValue
variable {R : Type*} [Ring R] [Nontrivial R]
/-- The equivalence of `MulRingNorm R` and `AbsoluteValue R ℝ` when `R` is a nontrivial ring. -/
def mulRingNormEquivAbsoluteValue : MulRingNorm R ≃ AbsoluteValue R ℝ where
toFun N := {
toFun := N.toFun
map_mul' := N.map_mul'
nonneg' := apply_nonneg N
eq_zero' x := ⟨N.eq_zero_of_map_eq_zero' x, fun h ↦ h ▸ N.map_zero'⟩
add_le' := N.add_le'
}
invFun v := {
toFun := v.toFun
map_zero' := (v.eq_zero' 0).mpr rfl
add_le' := v.add_le'
neg' := v.map_neg
map_one' := v.map_one
map_mul' := v.map_mul'
eq_zero_of_map_eq_zero' x := (v.eq_zero' x).mp
}
left_inv N := by constructor
right_inv v := by ext1 x; simp
lemma mulRingNormEquivAbsoluteValue_apply (N : MulRingNorm R) (x : R) :
mulRingNormEquivAbsoluteValue N x = N x := rfl
lemma mulRingNormEquivAbsoluteValue_symm_apply (v : AbsoluteValue R ℝ) (x : R) :
mulRingNormEquivAbsoluteValue.symm v x = v x := rfl
end MulRingNorm_equiv_AbsoluteValue
end MulRingNorm
/-- A nonzero ring seminorm on a field `K` is a ring norm. -/
def RingSeminorm.toRingNorm {K : Type*} [Field K] (f : RingSeminorm K) (hnt : f ≠ 0) :
RingNorm K :=
{ f with
eq_zero_of_map_eq_zero' := fun x hx => by
obtain ⟨c, hc⟩ := RingSeminorm.ne_zero_iff.mp hnt
by_contra hn0
have hc0 : f c = 0 := by
rw [← mul_one c, ← mul_inv_cancel₀ hn0, ← mul_assoc, mul_comm c, mul_assoc]
exact
le_antisymm
(le_trans (map_mul_le_mul f _ _)
(by rw [← RingSeminorm.toFun_eq_coe, ← AddGroupSeminorm.toFun_eq_coe, hx,
zero_mul]))
(apply_nonneg f _)
exact hc hc0 }
/-- The norm of a `NonUnitalNormedRing` as a `RingNorm`. -/
@[simps!]
def normRingNorm (R : Type*) [NonUnitalNormedRing R] : RingNorm R :=
{ normAddGroupNorm R, normRingSeminorm R with }
open Int
/-- The seminorm on a `SeminormedRing`, as a `RingSeminorm`. -/
def SeminormedRing.toRingSeminorm (R : Type*) [SeminormedRing R] : RingSeminorm R where
toFun := norm
map_zero' := norm_zero
add_le' := norm_add_le
mul_le' := norm_mul_le
neg' := norm_neg
/-- The norm on a `NormedRing`, as a `RingNorm`. -/
@[simps]
def NormedRing.toRingNorm (R : Type*) [NormedRing R] : RingNorm R where
toFun := norm
map_zero' := norm_zero
add_le' := norm_add_le
mul_le' := norm_mul_le
neg' := norm_neg
eq_zero_of_map_eq_zero' x hx := by rw [← norm_eq_zero]; exact hx
@[simp]
theorem NormedRing.toRingNorm_apply (R : Type*) [NormedRing R] (x : R) :
(NormedRing.toRingNorm R) x = ‖x‖ :=
rfl
/-- The norm on a `NormedField`, as a `MulRingNorm`. -/
def NormedField.toMulRingNorm (R : Type*) [NormedField R] : MulRingNorm R where
toFun := norm
map_zero' := norm_zero
map_one' := norm_one
add_le' := norm_add_le
map_mul' := norm_mul
neg' := norm_neg
eq_zero_of_map_eq_zero' x hx := by rw [← norm_eq_zero]; exact hx
/-- The norm on a `NormedField`, as an `AbsoluteValue`. -/
def NormedField.toAbsoluteValue (R : Type*) [NormedField R] : AbsoluteValue R ℝ where
toFun := norm
map_mul' := norm_mul
nonneg' := norm_nonneg
eq_zero' _ := norm_eq_zero
add_le' := norm_add_le |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Operator/ContinuousLinearMap.lean | import Mathlib.Analysis.Normed.Group.Uniform
import Mathlib.Analysis.Normed.MulAction
import Mathlib.LinearAlgebra.DFinsupp
import Mathlib.Topology.Algebra.Module.Equiv
/-! # Constructions of continuous linear maps between (semi-)normed spaces
A fundamental fact about (semi-)linear maps between normed spaces over sensible fields is that
continuity and boundedness are equivalent conditions. That is, for normed spaces `E`, `F`, a
`LinearMap` `f : E →ₛₗ[σ] F` is the coercion of some `ContinuousLinearMap` `f' : E →SL[σ] F`, if
and only if there exists a bound `C` such that for all `x`, `‖f x‖ ≤ C * ‖x‖`.
We prove one direction in this file: `LinearMap.mkContinuous`, boundedness implies continuity. The
other direction, `ContinuousLinearMap.bound`, is deferred to a later file, where the
strong operator topology on `E →SL[σ] F` is available, because it is natural to use
`ContinuousLinearMap.bound` to define a norm `⨆ x, ‖f x‖ / ‖x‖` on `E →SL[σ] F` and to show that
this is compatible with the strong operator topology.
This file also contains several corollaries of `LinearMap.mkContinuous`: other "easy"
constructions of continuous linear maps between normed spaces.
This file is meant to be lightweight (it is imported by much of the analysis library); think twice
before adding imports!
-/
open Metric ContinuousLinearMap
open Set Real
open NNReal
variable {𝕜 𝕜₂ E F G : Type*}
/-! ## General constructions -/
section SeminormedAddCommGroup
variable [Ring 𝕜] [Ring 𝕜₂]
variable [SeminormedAddCommGroup E] [SeminormedAddCommGroup F] [SeminormedAddCommGroup G]
variable [Module 𝕜 E] [Module 𝕜₂ F] [Module 𝕜 G]
variable {σ : 𝕜 →+* 𝕜₂} (f : E →ₛₗ[σ] F)
/-- Construct a continuous linear map from a linear map and a bound on this linear map.
The fact that the norm of the continuous linear map is then controlled is given in
`LinearMap.mkContinuous_norm_le`. -/
def LinearMap.mkContinuous (C : ℝ) (h : ∀ x, ‖f x‖ ≤ C * ‖x‖) : E →SL[σ] F :=
⟨f, AddMonoidHomClass.continuous_of_bound f C h⟩
/-- Construct a continuous linear map from a linear map and the existence of a bound on this linear
map. If you have an explicit bound, use `LinearMap.mkContinuous` instead, as a norm estimate will
follow automatically in `LinearMap.mkContinuous_norm_le`. -/
def LinearMap.mkContinuousOfExistsBound (h : ∃ C, ∀ x, ‖f x‖ ≤ C * ‖x‖) : E →SL[σ] F :=
⟨f,
let ⟨C, hC⟩ := h
AddMonoidHomClass.continuous_of_bound f C hC⟩
theorem continuous_of_linear_of_boundₛₗ {f : E → F} (h_add : ∀ x y, f (x + y) = f x + f y)
(h_smul : ∀ (c : 𝕜) (x), f (c • x) = σ c • f x) {C : ℝ} (h_bound : ∀ x, ‖f x‖ ≤ C * ‖x‖) :
Continuous f :=
let φ : E →ₛₗ[σ] F :=
{ toFun := f
map_add' := h_add
map_smul' := h_smul }
AddMonoidHomClass.continuous_of_bound φ C h_bound
theorem continuous_of_linear_of_bound {f : E → G} (h_add : ∀ x y, f (x + y) = f x + f y)
(h_smul : ∀ (c : 𝕜) (x), f (c • x) = c • f x) {C : ℝ} (h_bound : ∀ x, ‖f x‖ ≤ C * ‖x‖) :
Continuous f :=
let φ : E →ₗ[𝕜] G :=
{ toFun := f
map_add' := h_add
map_smul' := h_smul }
AddMonoidHomClass.continuous_of_bound φ C h_bound
@[simp, norm_cast]
theorem LinearMap.mkContinuous_coe (C : ℝ) (h : ∀ x, ‖f x‖ ≤ C * ‖x‖) :
(f.mkContinuous C h : E →ₛₗ[σ] F) = f :=
rfl
@[simp]
theorem LinearMap.mkContinuous_apply (C : ℝ) (h : ∀ x, ‖f x‖ ≤ C * ‖x‖) (x : E) :
f.mkContinuous C h x = f x :=
rfl
@[simp, norm_cast]
theorem LinearMap.mkContinuousOfExistsBound_coe (h : ∃ C, ∀ x, ‖f x‖ ≤ C * ‖x‖) :
(f.mkContinuousOfExistsBound h : E →ₛₗ[σ] F) = f :=
rfl
@[simp]
theorem LinearMap.mkContinuousOfExistsBound_apply (h : ∃ C, ∀ x, ‖f x‖ ≤ C * ‖x‖) (x : E) :
f.mkContinuousOfExistsBound h x = f x :=
rfl
namespace ContinuousLinearMap
theorem antilipschitz_of_bound (f : E →SL[σ] F) {K : ℝ≥0} (h : ∀ x, ‖x‖ ≤ K * ‖f x‖) :
AntilipschitzWith K f :=
AddMonoidHomClass.antilipschitz_of_bound _ h
theorem bound_of_antilipschitz (f : E →SL[σ] F) {K : ℝ≥0} (h : AntilipschitzWith K f) (x) :
‖x‖ ≤ K * ‖f x‖ :=
ZeroHomClass.bound_of_antilipschitz _ h x
end ContinuousLinearMap
section
variable {σ₂₁ : 𝕜₂ →+* 𝕜} [RingHomInvPair σ σ₂₁] [RingHomInvPair σ₂₁ σ]
/-- Construct a continuous linear equivalence from a linear equivalence together with
bounds in both directions. -/
def LinearEquiv.toContinuousLinearEquivOfBounds (e : E ≃ₛₗ[σ] F) (C_to C_inv : ℝ)
(h_to : ∀ x, ‖e x‖ ≤ C_to * ‖x‖) (h_inv : ∀ x : F, ‖e.symm x‖ ≤ C_inv * ‖x‖) : E ≃SL[σ] F where
toLinearEquiv := e
continuous_toFun := AddMonoidHomClass.continuous_of_bound e C_to h_to
continuous_invFun := AddMonoidHomClass.continuous_of_bound e.symm C_inv h_inv
end
end SeminormedAddCommGroup
section SeminormedBounded
variable [SeminormedRing 𝕜] [Ring 𝕜₂] [SeminormedAddCommGroup E]
variable [Module 𝕜 E] [IsBoundedSMul 𝕜 E]
/-- Reinterpret a linear map `𝕜 →ₗ[𝕜] E` as a continuous linear map. This construction
is generalized to the case of any finite-dimensional domain
in `LinearMap.toContinuousLinearMap`. -/
def LinearMap.toContinuousLinearMap₁ (f : 𝕜 →ₗ[𝕜] E) : 𝕜 →L[𝕜] E :=
f.mkContinuous ‖f 1‖ fun x => by
conv_lhs => rw [← mul_one x]
rw [← smul_eq_mul, f.map_smul, mul_comm]; exact norm_smul_le _ _
@[simp]
theorem LinearMap.toContinuousLinearMap₁_coe (f : 𝕜 →ₗ[𝕜] E) :
(f.toContinuousLinearMap₁ : 𝕜 →ₗ[𝕜] E) = f :=
rfl
@[simp]
theorem LinearMap.toContinuousLinearMap₁_apply (f : 𝕜 →ₗ[𝕜] E) (x) :
f.toContinuousLinearMap₁ x = f x :=
rfl
end SeminormedBounded
section Normed
variable [Ring 𝕜] [Ring 𝕜₂]
variable [NormedAddCommGroup E] [NormedAddCommGroup F] [Module 𝕜 E] [Module 𝕜₂ F]
variable {σ : 𝕜 →+* 𝕜₂} (f g : E →SL[σ] F) (x y z : E)
theorem ContinuousLinearMap.isUniformEmbedding_of_bound {K : ℝ≥0} (hf : ∀ x, ‖x‖ ≤ K * ‖f x‖) :
IsUniformEmbedding f :=
(AddMonoidHomClass.antilipschitz_of_bound f hf).isUniformEmbedding f.uniformContinuous
end Normed
/-! ## Homotheties -/
section Seminormed
variable [Ring 𝕜] [Ring 𝕜₂]
variable [SeminormedAddCommGroup E] [SeminormedAddCommGroup F]
variable [Module 𝕜 E] [Module 𝕜₂ F]
variable {σ : 𝕜 →+* 𝕜₂} (f : E →ₛₗ[σ] F)
/-- A (semi-)linear map which is a homothety is a continuous linear map.
Since the field `𝕜` need not have `ℝ` as a subfield, this theorem is not directly deducible from
the corresponding theorem about isometries plus a theorem about scalar multiplication. Likewise
for the other theorems about homotheties in this file.
-/
def ContinuousLinearMap.ofHomothety (f : E →ₛₗ[σ] F) (a : ℝ) (hf : ∀ x, ‖f x‖ = a * ‖x‖) :
E →SL[σ] F :=
f.mkContinuous a fun x => le_of_eq (hf x)
variable {σ₂₁ : 𝕜₂ →+* 𝕜} [RingHomInvPair σ σ₂₁] [RingHomInvPair σ₂₁ σ]
theorem ContinuousLinearEquiv.homothety_inverse (a : ℝ) (ha : 0 < a) (f : E ≃ₛₗ[σ] F) :
(∀ x : E, ‖f x‖ = a * ‖x‖) → ∀ y : F, ‖f.symm y‖ = a⁻¹ * ‖y‖ := by
intro hf y
calc
‖f.symm y‖ = a⁻¹ * (a * ‖f.symm y‖) := by
rw [← mul_assoc, inv_mul_cancel₀ (ne_of_lt ha).symm, one_mul]
_ = a⁻¹ * ‖f (f.symm y)‖ := by rw [hf]
_ = a⁻¹ * ‖y‖ := by simp
/-- A linear equivalence which is a homothety is a continuous linear equivalence. -/
noncomputable def ContinuousLinearEquiv.ofHomothety (f : E ≃ₛₗ[σ] F) (a : ℝ) (ha : 0 < a)
(hf : ∀ x, ‖f x‖ = a * ‖x‖) : E ≃SL[σ] F :=
LinearEquiv.toContinuousLinearEquivOfBounds f a a⁻¹ (fun x => (hf x).le) fun x =>
(ContinuousLinearEquiv.homothety_inverse a ha f hf x).le
end Seminormed |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Operator/Bilinear.lean | import Mathlib.Analysis.Normed.Operator.Basic
import Mathlib.Analysis.Normed.Operator.LinearIsometry
import Mathlib.Analysis.Normed.Operator.ContinuousLinearMap
/-!
# Operator norm: bilinear maps
This file contains lemmas concerning operator norm as applied to bilinear maps `E × F → G`,
interpreted as linear maps `E → F → G` as usual (and similarly for semilinear variants).
-/
suppress_compilation
open Bornology
open Filter hiding map_smul
open scoped NNReal Topology Uniformity
-- the `ₗ` subscript variables are for special cases about linear (as opposed to semilinear) maps
variable {𝕜 𝕜₂ 𝕜₃ E Eₗ F Fₗ G Gₗ 𝓕 : Type*}
section SemiNormed
open Metric ContinuousLinearMap
variable [SeminormedAddCommGroup E] [SeminormedAddCommGroup Eₗ] [SeminormedAddCommGroup F]
[SeminormedAddCommGroup Fₗ] [SeminormedAddCommGroup G] [SeminormedAddCommGroup Gₗ]
variable [NontriviallyNormedField 𝕜] [NontriviallyNormedField 𝕜₂] [NontriviallyNormedField 𝕜₃]
[NormedSpace 𝕜 E] [NormedSpace 𝕜 Eₗ] [NormedSpace 𝕜₂ F] [NormedSpace 𝕜 Fₗ] [NormedSpace 𝕜₃ G]
[NormedSpace 𝕜 Gₗ] {σ₁₂ : 𝕜 →+* 𝕜₂} {σ₂₃ : 𝕜₂ →+* 𝕜₃} {σ₁₃ : 𝕜 →+* 𝕜₃}
[RingHomCompTriple σ₁₂ σ₂₃ σ₁₃]
variable [FunLike 𝓕 E F]
namespace ContinuousLinearMap
section OpNorm
open Set Real
theorem opNorm_ext [RingHomIsometric σ₁₃] (f : E →SL[σ₁₂] F) (g : E →SL[σ₁₃] G)
(h : ∀ x, ‖f x‖ = ‖g x‖) : ‖f‖ = ‖g‖ :=
opNorm_eq_of_bounds (norm_nonneg _)
(fun x => by
rw [h x]
exact le_opNorm _ _)
fun c hc h₂ =>
opNorm_le_bound _ hc fun z => by
rw [← h z]
exact h₂ z
variable [RingHomIsometric σ₂₃]
theorem opNorm_le_bound₂ (f : E →SL[σ₁₃] F →SL[σ₂₃] G) {C : ℝ} (h0 : 0 ≤ C)
(hC : ∀ x y, ‖f x y‖ ≤ C * ‖x‖ * ‖y‖) : ‖f‖ ≤ C :=
f.opNorm_le_bound h0 fun x => (f x).opNorm_le_bound (by positivity) <| hC x
theorem le_opNorm₂ [RingHomIsometric σ₁₃] (f : E →SL[σ₁₃] F →SL[σ₂₃] G) (x : E) (y : F) :
‖f x y‖ ≤ ‖f‖ * ‖x‖ * ‖y‖ :=
(f x).le_of_opNorm_le (f.le_opNorm x) y
theorem le_of_opNorm₂_le_of_le [RingHomIsometric σ₁₃] (f : E →SL[σ₁₃] F →SL[σ₂₃] G) {x : E} {y : F}
{a b c : ℝ} (hf : ‖f‖ ≤ a) (hx : ‖x‖ ≤ b) (hy : ‖y‖ ≤ c) :
‖f x y‖ ≤ a * b * c :=
(f x).le_of_opNorm_le_of_le (f.le_of_opNorm_le_of_le hf hx) hy
end OpNorm
end ContinuousLinearMap
namespace LinearMap
lemma norm_mkContinuous₂_aux (f : E →ₛₗ[σ₁₃] F →ₛₗ[σ₂₃] G) (C : ℝ)
(h : ∀ x y, ‖f x y‖ ≤ C * ‖x‖ * ‖y‖) (x : E) :
‖(f x).mkContinuous (C * ‖x‖) (h x)‖ ≤ max C 0 * ‖x‖ :=
(mkContinuous_norm_le' (f x) (h x)).trans_eq <| by
rw [max_mul_of_nonneg _ _ (norm_nonneg x), zero_mul]
variable [RingHomIsometric σ₂₃]
/-- Create a bilinear map (represented as a map `E →L[𝕜] F →L[𝕜] G`) from the corresponding linear
map and existence of a bound on the norm of the image. The linear map can be constructed using
`LinearMap.mk₂`.
If you have an explicit bound, use `LinearMap.mkContinuous₂` instead, as a norm estimate will
follow automatically in `LinearMap.mkContinuous₂_norm_le`. -/
def mkContinuousOfExistsBound₂ (f : E →ₛₗ[σ₁₃] F →ₛₗ[σ₂₃] G)
(h : ∃ C, ∀ x y, ‖f x y‖ ≤ C * ‖x‖ * ‖y‖) : E →SL[σ₁₃] F →SL[σ₂₃] G :=
LinearMap.mkContinuousOfExistsBound
{ toFun := fun x => (f x).mkContinuousOfExistsBound <| let ⟨C, hC⟩ := h; ⟨C * ‖x‖, hC x⟩
map_add' := fun x y => by
ext z
simp
map_smul' := fun c x => by
ext z
simp } <|
let ⟨C, hC⟩ := h; ⟨max C 0, norm_mkContinuous₂_aux f C hC⟩
/-- Create a bilinear map (represented as a map `E →L[𝕜] F →L[𝕜] G`) from the corresponding linear
map and a bound on the norm of the image. The linear map can be constructed using
`LinearMap.mk₂`. Lemmas `LinearMap.mkContinuous₂_norm_le'` and `LinearMap.mkContinuous₂_norm_le`
provide estimates on the norm of an operator constructed using this function. -/
def mkContinuous₂ (f : E →ₛₗ[σ₁₃] F →ₛₗ[σ₂₃] G) (C : ℝ) (hC : ∀ x y, ‖f x y‖ ≤ C * ‖x‖ * ‖y‖) :
E →SL[σ₁₃] F →SL[σ₂₃] G :=
mkContinuousOfExistsBound₂ f ⟨C, hC⟩
@[simp]
theorem mkContinuous₂_apply (f : E →ₛₗ[σ₁₃] F →ₛₗ[σ₂₃] G) {C : ℝ}
(hC : ∀ x y, ‖f x y‖ ≤ C * ‖x‖ * ‖y‖) (x : E) (y : F) : f.mkContinuous₂ C hC x y = f x y :=
rfl
theorem mkContinuous₂_norm_le' (f : E →ₛₗ[σ₁₃] F →ₛₗ[σ₂₃] G) {C : ℝ}
(hC : ∀ x y, ‖f x y‖ ≤ C * ‖x‖ * ‖y‖) : ‖f.mkContinuous₂ C hC‖ ≤ max C 0 :=
mkContinuous_norm_le _ (le_max_iff.2 <| Or.inr le_rfl) (norm_mkContinuous₂_aux f C hC)
theorem mkContinuous₂_norm_le (f : E →ₛₗ[σ₁₃] F →ₛₗ[σ₂₃] G) {C : ℝ} (h0 : 0 ≤ C)
(hC : ∀ x y, ‖f x y‖ ≤ C * ‖x‖ * ‖y‖) : ‖f.mkContinuous₂ C hC‖ ≤ C :=
(f.mkContinuous₂_norm_le' hC).trans_eq <| max_eq_left h0
end LinearMap
namespace ContinuousLinearMap
variable [RingHomIsometric σ₂₃] [RingHomIsometric σ₁₃]
/-- Flip the order of arguments of a continuous bilinear map.
For a version bundled as `LinearIsometryEquiv`, see
`ContinuousLinearMap.flipL`. -/
def flip (f : E →SL[σ₁₃] F →SL[σ₂₃] G) : F →SL[σ₂₃] E →SL[σ₁₃] G :=
LinearMap.mkContinuous₂
(LinearMap.mk₂'ₛₗ σ₂₃ σ₁₃ (fun y x => f x y) (fun x y z => (f z).map_add x y)
(fun c y x => (f x).map_smulₛₗ c y) (fun z x y => by simp only [f.map_add, add_apply])
(fun c y x => by simp only [f.map_smulₛₗ, smul_apply]))
‖f‖ fun y x => (f.le_opNorm₂ x y).trans_eq <| by simp only [mul_right_comm]
private theorem le_norm_flip (f : E →SL[σ₁₃] F →SL[σ₂₃] G) : ‖f‖ ≤ ‖flip f‖ :=
f.opNorm_le_bound₂ (norm_nonneg f.flip) fun x y => by
rw [mul_right_comm]
exact (flip f).le_opNorm₂ y x
@[simp]
theorem flip_apply (f : E →SL[σ₁₃] F →SL[σ₂₃] G) (x : E) (y : F) : f.flip y x = f x y :=
rfl
@[simp]
theorem flip_flip (f : E →SL[σ₁₃] F →SL[σ₂₃] G) : f.flip.flip = f := by
ext
rfl
@[simp]
theorem opNorm_flip (f : E →SL[σ₁₃] F →SL[σ₂₃] G) : ‖f.flip‖ = ‖f‖ :=
le_antisymm (by simpa only [flip_flip] using le_norm_flip f.flip) (le_norm_flip f)
@[simp]
lemma flip_zero : flip (0 : E →SL[σ₁₃] F →SL[σ₂₃] G) = 0 := rfl
@[simp]
theorem flip_add (f g : E →SL[σ₁₃] F →SL[σ₂₃] G) : (f + g).flip = f.flip + g.flip :=
rfl
@[simp]
theorem flip_smul (c : 𝕜₃) (f : E →SL[σ₁₃] F →SL[σ₂₃] G) : (c • f).flip = c • f.flip :=
rfl
variable (E F G σ₁₃ σ₂₃)
/-- Flip the order of arguments of a continuous bilinear map.
This is a version bundled as a `LinearIsometryEquiv`.
For an unbundled version see `ContinuousLinearMap.flip`. -/
def flipₗᵢ' : (E →SL[σ₁₃] F →SL[σ₂₃] G) ≃ₗᵢ[𝕜₃] F →SL[σ₂₃] E →SL[σ₁₃] G where
toFun := flip
invFun := flip
map_add' := flip_add
map_smul' := flip_smul
left_inv := flip_flip
right_inv := flip_flip
norm_map' := opNorm_flip
variable {E F G σ₁₃ σ₂₃}
@[simp]
theorem flipₗᵢ'_symm : (flipₗᵢ' E F G σ₂₃ σ₁₃).symm = flipₗᵢ' F E G σ₁₃ σ₂₃ :=
rfl
@[simp]
theorem coe_flipₗᵢ' : ⇑(flipₗᵢ' E F G σ₂₃ σ₁₃) = flip :=
rfl
variable (𝕜 E Fₗ Gₗ)
/-- Flip the order of arguments of a continuous bilinear map.
This is a version bundled as a `LinearIsometryEquiv`.
For an unbundled version see `ContinuousLinearMap.flip`. -/
def flipₗᵢ : (E →L[𝕜] Fₗ →L[𝕜] Gₗ) ≃ₗᵢ[𝕜] Fₗ →L[𝕜] E →L[𝕜] Gₗ where
toFun := flip
invFun := flip
map_add' := flip_add
map_smul' := flip_smul
left_inv := flip_flip
right_inv := flip_flip
norm_map' := opNorm_flip
variable {𝕜 E Fₗ Gₗ}
@[simp]
theorem flipₗᵢ_symm : (flipₗᵢ 𝕜 E Fₗ Gₗ).symm = flipₗᵢ 𝕜 Fₗ E Gₗ :=
rfl
@[simp]
theorem coe_flipₗᵢ : ⇑(flipₗᵢ 𝕜 E Fₗ Gₗ) = flip :=
rfl
variable (F σ₁₂)
variable [RingHomIsometric σ₁₂]
/-- The continuous semilinear map obtained by applying a continuous semilinear map at a given
vector.
This is the continuous version of `LinearMap.applyₗ`. -/
def apply' : E →SL[σ₁₂] (E →SL[σ₁₂] F) →L[𝕜₂] F :=
flip (.id 𝕜₂ (E →SL[σ₁₂] F))
variable {F σ₁₂}
@[simp]
theorem apply_apply' (v : E) (f : E →SL[σ₁₂] F) : apply' F σ₁₂ v f = f v :=
rfl
variable (𝕜 Fₗ)
/-- The continuous semilinear map obtained by applying a continuous semilinear map at a given
vector.
This is the continuous version of `LinearMap.applyₗ`. -/
def apply : E →L[𝕜] (E →L[𝕜] Fₗ) →L[𝕜] Fₗ :=
flip (.id 𝕜 (E →L[𝕜] Fₗ))
variable {𝕜 Fₗ}
@[simp]
theorem apply_apply (v : E) (f : E →L[𝕜] Fₗ) : apply 𝕜 Fₗ v f = f v :=
rfl
variable (σ₁₂ σ₂₃ E F G)
/-- Composition of continuous semilinear maps as a continuous semibilinear map. -/
def compSL : (F →SL[σ₂₃] G) →L[𝕜₃] (E →SL[σ₁₂] F) →SL[σ₂₃] E →SL[σ₁₃] G :=
LinearMap.mkContinuous₂
(LinearMap.mk₂'ₛₗ (RingHom.id 𝕜₃) σ₂₃ comp add_comp smul_comp comp_add fun c f g => by
ext
simp only [ContinuousLinearMap.map_smulₛₗ, coe_smul', coe_comp', Function.comp_apply,
Pi.smul_apply])
1 fun f g => by simpa only [one_mul] using opNorm_comp_le f g
theorem norm_compSL_le : ‖compSL E F G σ₁₂ σ₂₃‖ ≤ 1 :=
LinearMap.mkContinuous₂_norm_le _ zero_le_one _
variable {σ₁₂ σ₂₃ E F G}
@[simp]
theorem compSL_apply (f : F →SL[σ₂₃] G) (g : E →SL[σ₁₂] F) : compSL E F G σ₁₂ σ₂₃ f g = f.comp g :=
rfl
theorem _root_.Continuous.const_clm_comp {X} [TopologicalSpace X] {f : X → E →SL[σ₁₂] F}
(hf : Continuous f) (g : F →SL[σ₂₃] G) :
Continuous (fun x => g.comp (f x) : X → E →SL[σ₁₃] G) :=
(compSL E F G σ₁₂ σ₂₃ g).continuous.comp hf
-- Giving the implicit argument speeds up elaboration significantly
theorem _root_.Continuous.clm_comp_const {X} [TopologicalSpace X] {g : X → F →SL[σ₂₃] G}
(hg : Continuous g) (f : E →SL[σ₁₂] F) :
Continuous (fun x => (g x).comp f : X → E →SL[σ₁₃] G) :=
(@ContinuousLinearMap.flip _ _ _ _ _ (E →SL[σ₁₃] G) _ _ _ _ _ _ _ _ _ _ _ _ _
(compSL E F G σ₁₂ σ₂₃) f).continuous.comp hg
variable (𝕜 σ₁₂ σ₂₃ E Fₗ Gₗ)
/-- Composition of continuous linear maps as a continuous bilinear map. -/
def compL : (Fₗ →L[𝕜] Gₗ) →L[𝕜] (E →L[𝕜] Fₗ) →L[𝕜] E →L[𝕜] Gₗ :=
compSL E Fₗ Gₗ (RingHom.id 𝕜) (RingHom.id 𝕜)
theorem norm_compL_le : ‖compL 𝕜 E Fₗ Gₗ‖ ≤ 1 :=
norm_compSL_le _ _ _ _ _
@[simp]
theorem compL_apply (f : Fₗ →L[𝕜] Gₗ) (g : E →L[𝕜] Fₗ) : compL 𝕜 E Fₗ Gₗ f g = f.comp g :=
rfl
variable (Eₗ) {𝕜 E Fₗ Gₗ}
/-- Apply `L(x,-)` pointwise to bilinear maps, as a continuous bilinear map -/
@[simps! apply]
def precompR (L : E →L[𝕜] Fₗ →L[𝕜] Gₗ) : E →L[𝕜] (Eₗ →L[𝕜] Fₗ) →L[𝕜] Eₗ →L[𝕜] Gₗ :=
compL 𝕜 Eₗ Fₗ Gₗ ∘L L
/-- Apply `L(-,y)` pointwise to bilinear maps, as a continuous bilinear map -/
def precompL (L : E →L[𝕜] Fₗ →L[𝕜] Gₗ) : (Eₗ →L[𝕜] E) →L[𝕜] Fₗ →L[𝕜] Eₗ →L[𝕜] Gₗ :=
(precompR Eₗ (flip L)).flip
@[simp] lemma precompL_apply (L : E →L[𝕜] Fₗ →L[𝕜] Gₗ) (u : Eₗ →L[𝕜] E) (f : Fₗ) (g : Eₗ) :
precompL Eₗ L u f g = L (u g) f := rfl
theorem norm_precompR_le (L : E →L[𝕜] Fₗ →L[𝕜] Gₗ) : ‖precompR Eₗ L‖ ≤ ‖L‖ :=
calc
‖precompR Eₗ L‖ ≤ ‖compL 𝕜 Eₗ Fₗ Gₗ‖ * ‖L‖ := opNorm_comp_le _ _
_ ≤ 1 * ‖L‖ := by gcongr; apply norm_compL_le
_ = ‖L‖ := by rw [one_mul]
theorem norm_precompL_le (L : E →L[𝕜] Fₗ →L[𝕜] Gₗ) : ‖precompL Eₗ L‖ ≤ ‖L‖ := by
rw [precompL, opNorm_flip, ← opNorm_flip L]
exact norm_precompR_le _ L.flip
end ContinuousLinearMap
variable {σ₂₁ : 𝕜₂ →+* 𝕜} [RingHomInvPair σ₁₂ σ₂₁] [RingHomInvPair σ₂₁ σ₁₂]
namespace ContinuousLinearMap
variable {E' F' : Type*} [SeminormedAddCommGroup E'] [SeminormedAddCommGroup F']
variable {𝕜₁' : Type*} {𝕜₂' : Type*} [NontriviallyNormedField 𝕜₁'] [NontriviallyNormedField 𝕜₂']
[NormedSpace 𝕜₁' E'] [NormedSpace 𝕜₂' F'] {σ₁' : 𝕜₁' →+* 𝕜} {σ₁₃' : 𝕜₁' →+* 𝕜₃} {σ₂' : 𝕜₂' →+* 𝕜₂}
{σ₂₃' : 𝕜₂' →+* 𝕜₃} [RingHomCompTriple σ₁' σ₁₃ σ₁₃'] [RingHomCompTriple σ₂' σ₂₃ σ₂₃']
[RingHomIsometric σ₂₃] [RingHomIsometric σ₁₃'] [RingHomIsometric σ₂₃']
/-- Compose a bilinear map `E →SL[σ₁₃] F →SL[σ₂₃] G` with two linear maps
`E' →SL[σ₁'] E` and `F' →SL[σ₂'] F`. -/
def bilinearComp (f : E →SL[σ₁₃] F →SL[σ₂₃] G) (gE : E' →SL[σ₁'] E) (gF : F' →SL[σ₂'] F) :
E' →SL[σ₁₃'] F' →SL[σ₂₃'] G :=
((f.comp gE).flip.comp gF).flip
@[simp]
theorem bilinearComp_apply (f : E →SL[σ₁₃] F →SL[σ₂₃] G) (gE : E' →SL[σ₁'] E) (gF : F' →SL[σ₂'] F)
(x : E') (y : F') : f.bilinearComp gE gF x y = f (gE x) (gF y) :=
rfl
@[simp]
lemma bilinearComp_zero {gE : E' →SL[σ₁'] E} {gF : F' →SL[σ₂'] F} :
bilinearComp (0 : E →SL[σ₁₃] F →SL[σ₂₃] G) gE gF = 0 := rfl
@[simp]
lemma bilinearComp_zero_left {f : E →SL[σ₁₃] F →SL[σ₂₃] G} {gF : F' →SL[σ₂'] F} :
bilinearComp f (0 : E' →SL[σ₁'] E) gF = 0 := by ext; simp
@[simp]
lemma bilinearComp_zero_right {f : E →SL[σ₁₃] F →SL[σ₂₃] G} {gE : E' →SL[σ₁'] E} :
bilinearComp f gE (0 : F' →SL[σ₂'] F) = 0 := by ext; simp
variable [RingHomIsometric σ₁₃] [RingHomIsometric σ₁'] [RingHomIsometric σ₂']
/-- Derivative of a continuous bilinear map `f : E →L[𝕜] F →L[𝕜] G` interpreted as a map `E × F → G`
at point `p : E × F` evaluated at `q : E × F`, as a continuous bilinear map. -/
def deriv₂ (f : E →L[𝕜] Fₗ →L[𝕜] Gₗ) : E × Fₗ →L[𝕜] E × Fₗ →L[𝕜] Gₗ :=
f.bilinearComp (fst _ _ _) (snd _ _ _) + f.flip.bilinearComp (snd _ _ _) (fst _ _ _)
@[simp]
theorem coe_deriv₂ (f : E →L[𝕜] Fₗ →L[𝕜] Gₗ) (p : E × Fₗ) :
⇑(f.deriv₂ p) = fun q : E × Fₗ => f p.1 q.2 + f q.1 p.2 :=
rfl
theorem map_add_add (f : E →L[𝕜] Fₗ →L[𝕜] Gₗ) (x x' : E) (y y' : Fₗ) :
f (x + x') (y + y') = f x y + f.deriv₂ (x, y) (x', y') + f x' y' := by
simp only [map_add, add_apply, coe_deriv₂, add_assoc]
abel
/-- The norm of the tensor product of a scalar linear map and of an element of a normed space
is the product of the norms. -/
@[simp]
theorem norm_smulRight_apply (c : StrongDual 𝕜 E) (f : Fₗ) : ‖smulRight c f‖ = ‖c‖ * ‖f‖ := by
refine le_antisymm ?_ ?_
· refine opNorm_le_bound _ (by positivity) fun x => ?_
calc
‖c x • f‖ = ‖c x‖ * ‖f‖ := norm_smul _ _
_ ≤ ‖c‖ * ‖x‖ * ‖f‖ := by gcongr; apply le_opNorm
_ = ‖c‖ * ‖f‖ * ‖x‖ := by ring
· obtain hf | hf := (norm_nonneg f).eq_or_lt'
· simp [hf]
· rw [← le_div_iff₀ hf]
refine opNorm_le_bound _ (by positivity) fun x => ?_
rw [div_mul_eq_mul_div, le_div_iff₀ hf]
calc
‖c x‖ * ‖f‖ = ‖c x • f‖ := (norm_smul _ _).symm
_ = ‖smulRight c f x‖ := rfl
_ ≤ ‖smulRight c f‖ * ‖x‖ := le_opNorm _ _
/-- The non-negative norm of the tensor product of a scalar linear map and of an element of a normed
space is the product of the non-negative norms. -/
@[simp]
theorem nnnorm_smulRight_apply (c : StrongDual 𝕜 E) (f : Fₗ) : ‖smulRight c f‖₊ = ‖c‖₊ * ‖f‖₊ :=
NNReal.eq <| c.norm_smulRight_apply f
variable (𝕜 E Fₗ) in
/-- `ContinuousLinearMap.smulRight` as a continuous trilinear map:
`smulRightL (c : StrongDual 𝕜 E) (f : F) (x : E) = c x • f`. -/
def smulRightL : StrongDual 𝕜 E →L[𝕜] Fₗ →L[𝕜] E →L[𝕜] Fₗ :=
LinearMap.mkContinuous₂
{ toFun := smulRightₗ
map_add' := fun c₁ c₂ => by
ext x
simp only [add_smul, coe_smulRightₗ, add_apply, smulRight_apply, LinearMap.add_apply]
map_smul' := fun m c => by
ext x
dsimp
rw [smul_smul] }
1 fun c x => by
simp only [coe_smulRightₗ, one_mul, norm_smulRight_apply, LinearMap.coe_mk, AddHom.coe_mk,
le_refl]
@[simp]
theorem norm_smulRightL_apply (c : StrongDual 𝕜 E) (f : Fₗ) : ‖smulRightL 𝕜 E Fₗ c f‖ = ‖c‖ * ‖f‖ :=
norm_smulRight_apply c f
end ContinuousLinearMap
end SemiNormed
section Restrict
namespace ContinuousLinearMap
variable {𝕜' : Type*} [NontriviallyNormedField 𝕜] [NontriviallyNormedField 𝕜'] [NormedAlgebra 𝕜 𝕜']
[SeminormedAddCommGroup E] [NormedSpace 𝕜 E] [NormedSpace 𝕜' E] [IsScalarTower 𝕜 𝕜' E]
[SeminormedAddCommGroup F] [NormedSpace 𝕜 F] [NormedSpace 𝕜' F] [IsScalarTower 𝕜 𝕜' F]
[SeminormedAddCommGroup G] [NormedSpace 𝕜 G] [NormedSpace 𝕜' G] [IsScalarTower 𝕜 𝕜' G]
variable (𝕜) in
/-- Convenience function for restricting the linearity of a bilinear map. -/
def bilinearRestrictScalars (B : E →L[𝕜'] F →L[𝕜'] G) : E →L[𝕜] F →L[𝕜] G :=
(restrictScalarsL 𝕜' F G 𝕜 𝕜).comp (B.restrictScalars 𝕜)
variable (B : E →L[𝕜'] F →L[𝕜'] G) (x : E) (y : F)
theorem bilinearRestrictScalars_eq_restrictScalarsL_comp_restrictScalars :
B.bilinearRestrictScalars 𝕜 = (restrictScalarsL 𝕜' F G 𝕜 𝕜).comp (B.restrictScalars 𝕜) := rfl
theorem bilinearRestrictScalars_eq_restrictScalars_restrictScalarsL_comp :
B.bilinearRestrictScalars 𝕜 = restrictScalars 𝕜 ((restrictScalarsL 𝕜' F G 𝕜 𝕜').comp B) := rfl
variable (𝕜) in
@[simp]
theorem bilinearRestrictScalars_apply_apply : (B.bilinearRestrictScalars 𝕜) x y = B x y := rfl
@[simp]
theorem norm_bilinearRestrictScalars : ‖B.bilinearRestrictScalars 𝕜‖ = ‖B‖ := rfl
end ContinuousLinearMap
end Restrict |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Operator/Asymptotics.lean | import Mathlib.Analysis.Normed.Operator.Basic
import Mathlib.Analysis.Asymptotics.Defs
/-!
# Asymptotic statements about the operator norm
This file contains lemmas about how operator norm on continuous linear maps interacts with `IsBigO`.
-/
open Asymptotics
variable {𝕜 𝕜₂ 𝕜₃ E F G : Type*}
variable [SeminormedAddCommGroup E] [SeminormedAddCommGroup F] [SeminormedAddCommGroup G]
variable [NontriviallyNormedField 𝕜] [NontriviallyNormedField 𝕜₂] [NontriviallyNormedField 𝕜₃]
[NormedSpace 𝕜 E] [NormedSpace 𝕜₂ F] [NormedSpace 𝕜₃ G] {σ₁₂ : 𝕜 →+* 𝕜₂} {σ₂₃ : 𝕜₂ →+* 𝕜₃}
namespace ContinuousLinearMap
variable [RingHomIsometric σ₁₂] (f : E →SL[σ₁₂] F) (l : Filter E)
theorem isBigOWith_id : IsBigOWith ‖f‖ l f fun x => x :=
isBigOWith_of_le' _ f.le_opNorm
theorem isBigO_id : f =O[l] fun x => x :=
(f.isBigOWith_id l).isBigO
theorem isBigOWith_comp [RingHomIsometric σ₂₃] {α : Type*} (g : F →SL[σ₂₃] G) (f : α → F)
(l : Filter α) : IsBigOWith ‖g‖ l (fun x' => g (f x')) f :=
(g.isBigOWith_id ⊤).comp_tendsto le_top
theorem isBigO_comp [RingHomIsometric σ₂₃] {α : Type*} (g : F →SL[σ₂₃] G) (f : α → F)
(l : Filter α) : (fun x' => g (f x')) =O[l] f :=
(g.isBigOWith_comp f l).isBigO
theorem isBigOWith_sub (x : E) :
IsBigOWith ‖f‖ l (fun x' => f (x' - x)) fun x' => x' - x :=
f.isBigOWith_comp _ l
theorem isBigO_sub (x : E) :
(fun x' => f (x' - x)) =O[l] fun x' => x' - x :=
f.isBigO_comp _ l
end ContinuousLinearMap
namespace ContinuousLinearEquiv
variable {σ₂₁ : 𝕜₂ →+* 𝕜} [RingHomInvPair σ₁₂ σ₂₁] [RingHomInvPair σ₂₁ σ₁₂] (e : E ≃SL[σ₁₂] F)
section
variable [RingHomIsometric σ₁₂]
theorem isBigO_comp {α : Type*} (f : α → E) (l : Filter α) : (fun x' => e (f x')) =O[l] f :=
(e : E →SL[σ₁₂] F).isBigO_comp f l
theorem isBigO_sub (l : Filter E) (x : E) : (fun x' => e (x' - x)) =O[l] fun x' => x' - x :=
(e : E →SL[σ₁₂] F).isBigO_sub l x
end
section
variable [RingHomIsometric σ₂₁]
theorem isBigO_comp_rev {α : Type*} (f : α → E) (l : Filter α) : f =O[l] fun x' => e (f x') :=
(e.symm.isBigO_comp _ l).congr_left fun _ => e.symm_apply_apply _
theorem isBigO_sub_rev (l : Filter E) (x : E) : (fun x' => x' - x) =O[l] fun x' => e (x' - x) :=
e.isBigO_comp_rev _ _
end
end ContinuousLinearEquiv |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Operator/Compact.lean | import Mathlib.Analysis.LocallyConvex.Bounded
import Mathlib.Topology.Algebra.Module.StrongTopology
/-!
# Compact operators
In this file we define compact linear operators between two topological vector spaces (TVS).
## Main definitions
* `IsCompactOperator` : predicate for compact operators
## Main statements
* `isCompactOperator_iff_isCompact_closure_image_ball` : the usual characterization of
compact operators from a normed space to a T2 TVS.
* `IsCompactOperator.comp_clm` : precomposing a compact operator by a continuous linear map gives
a compact operator
* `IsCompactOperator.clm_comp` : postcomposing a compact operator by a continuous linear map
gives a compact operator
* `IsCompactOperator.continuous` : compact operators are automatically continuous
* `isClosed_setOf_isCompactOperator` : the set of compact operators is closed for the operator
norm
## Implementation details
We define `IsCompactOperator` as a predicate, because the space of compact operators inherits all
of its structure from the space of continuous linear maps (e.g we want to have the usual operator
norm on compact operators).
The two natural options then would be to make it a predicate over linear maps or continuous linear
maps. Instead we define it as a predicate over bare functions, although it really only makes sense
for linear functions, because Lean is really good at finding coercions to bare functions (whereas
coercing from continuous linear maps to linear maps often needs type ascriptions).
## References
* [N. Bourbaki, *Théories Spectrales*, Chapitre 3][bourbaki2023]
## Tags
Compact operator
-/
open Function Set Filter Bornology Metric Pointwise Topology
/-- A compact operator between two topological vector spaces. This definition is usually
given as "there exists a neighborhood of zero whose image is contained in a compact set",
but we choose a definition which involves fewer existential quantifiers and replaces images
with preimages.
We prove the equivalence in `isCompactOperator_iff_exists_mem_nhds_image_subset_compact`. -/
def IsCompactOperator {M₁ M₂ : Type*} [Zero M₁] [TopologicalSpace M₁] [TopologicalSpace M₂]
(f : M₁ → M₂) : Prop :=
∃ K, IsCompact K ∧ f ⁻¹' K ∈ (𝓝 0 : Filter M₁)
theorem isCompactOperator_zero {M₁ M₂ : Type*} [Zero M₁] [TopologicalSpace M₁]
[TopologicalSpace M₂] [Zero M₂] : IsCompactOperator (0 : M₁ → M₂) :=
⟨{0}, isCompact_singleton, mem_of_superset univ_mem fun _ _ => rfl⟩
section Characterizations
section
variable {R₁ : Type*} [Semiring R₁] {M₁ M₂ : Type*}
[TopologicalSpace M₁] [AddCommMonoid M₁] [TopologicalSpace M₂]
theorem isCompactOperator_iff_exists_mem_nhds_image_subset_compact (f : M₁ → M₂) :
IsCompactOperator f ↔ ∃ V ∈ (𝓝 0 : Filter M₁), ∃ K : Set M₂, IsCompact K ∧ f '' V ⊆ K :=
⟨fun ⟨K, hK, hKf⟩ => ⟨f ⁻¹' K, hKf, K, hK, image_preimage_subset _ _⟩, fun ⟨_, hV, K, hK, hVK⟩ =>
⟨K, hK, mem_of_superset hV (image_subset_iff.mp hVK)⟩⟩
theorem isCompactOperator_iff_exists_mem_nhds_isCompact_closure_image [T2Space M₂] (f : M₁ → M₂) :
IsCompactOperator f ↔ ∃ V ∈ (𝓝 0 : Filter M₁), IsCompact (closure <| f '' V) := by
rw [isCompactOperator_iff_exists_mem_nhds_image_subset_compact]
exact
⟨fun ⟨V, hV, K, hK, hKV⟩ => ⟨V, hV, hK.closure_of_subset hKV⟩,
fun ⟨V, hV, hVc⟩ => ⟨V, hV, closure (f '' V), hVc, subset_closure⟩⟩
end
section Bounded
variable {𝕜₁ 𝕜₂ : Type*} [NontriviallyNormedField 𝕜₁] [SeminormedRing 𝕜₂] {σ₁₂ : 𝕜₁ →+* 𝕜₂}
{M₁ M₂ : Type*} [TopologicalSpace M₁] [AddCommMonoid M₁] [TopologicalSpace M₂] [AddCommMonoid M₂]
[Module 𝕜₁ M₁] [Module 𝕜₂ M₂] [ContinuousConstSMul 𝕜₂ M₂]
theorem IsCompactOperator.image_subset_compact_of_isVonNBounded {f : M₁ →ₛₗ[σ₁₂] M₂}
(hf : IsCompactOperator f) {S : Set M₁} (hS : IsVonNBounded 𝕜₁ S) :
∃ K : Set M₂, IsCompact K ∧ f '' S ⊆ K :=
let ⟨K, hK, hKf⟩ := hf
let ⟨r, hr, hrS⟩ := (hS hKf).exists_pos
let ⟨c, hc⟩ := NormedField.exists_lt_norm 𝕜₁ r
let this := ne_zero_of_norm_ne_zero (hr.trans hc).ne.symm
⟨σ₁₂ c • K, hK.image <| continuous_id.const_smul (σ₁₂ c), by
rw [image_subset_iff, this.isUnit.preimage_smul_setₛₗ σ₁₂]; exact hrS c hc.le⟩
theorem IsCompactOperator.isCompact_closure_image_of_isVonNBounded [T2Space M₂] {f : M₁ →ₛₗ[σ₁₂] M₂}
(hf : IsCompactOperator f) {S : Set M₁} (hS : IsVonNBounded 𝕜₁ S) :
IsCompact (closure <| f '' S) :=
let ⟨_, hK, hKf⟩ := hf.image_subset_compact_of_isVonNBounded hS
hK.closure_of_subset hKf
end Bounded
section NormedSpace
variable {𝕜₁ 𝕜₂ : Type*} [NontriviallyNormedField 𝕜₁] [SeminormedRing 𝕜₂] {σ₁₂ : 𝕜₁ →+* 𝕜₂}
{M₁ M₂ : Type*} [SeminormedAddCommGroup M₁] [TopologicalSpace M₂] [AddCommMonoid M₂]
[NormedSpace 𝕜₁ M₁] [Module 𝕜₂ M₂]
theorem IsCompactOperator.image_subset_compact_of_bounded [ContinuousConstSMul 𝕜₂ M₂]
{f : M₁ →ₛₗ[σ₁₂] M₂} (hf : IsCompactOperator f) {S : Set M₁} (hS : Bornology.IsBounded S) :
∃ K : Set M₂, IsCompact K ∧ f '' S ⊆ K :=
hf.image_subset_compact_of_isVonNBounded <| by rwa [NormedSpace.isVonNBounded_iff]
theorem IsCompactOperator.isCompact_closure_image_of_bounded [ContinuousConstSMul 𝕜₂ M₂]
[T2Space M₂] {f : M₁ →ₛₗ[σ₁₂] M₂} (hf : IsCompactOperator f) {S : Set M₁}
(hS : Bornology.IsBounded S) : IsCompact (closure <| f '' S) :=
hf.isCompact_closure_image_of_isVonNBounded <| by rwa [NormedSpace.isVonNBounded_iff]
theorem IsCompactOperator.image_ball_subset_compact [ContinuousConstSMul 𝕜₂ M₂] {f : M₁ →ₛₗ[σ₁₂] M₂}
(hf : IsCompactOperator f) (r : ℝ) : ∃ K : Set M₂, IsCompact K ∧ f '' Metric.ball 0 r ⊆ K :=
hf.image_subset_compact_of_isVonNBounded (NormedSpace.isVonNBounded_ball 𝕜₁ M₁ r)
theorem IsCompactOperator.image_closedBall_subset_compact [ContinuousConstSMul 𝕜₂ M₂]
{f : M₁ →ₛₗ[σ₁₂] M₂} (hf : IsCompactOperator f) (r : ℝ) :
∃ K : Set M₂, IsCompact K ∧ f '' Metric.closedBall 0 r ⊆ K :=
hf.image_subset_compact_of_isVonNBounded (NormedSpace.isVonNBounded_closedBall 𝕜₁ M₁ r)
theorem IsCompactOperator.isCompact_closure_image_ball [ContinuousConstSMul 𝕜₂ M₂] [T2Space M₂]
{f : M₁ →ₛₗ[σ₁₂] M₂} (hf : IsCompactOperator f) (r : ℝ) :
IsCompact (closure <| f '' Metric.ball 0 r) :=
hf.isCompact_closure_image_of_isVonNBounded (NormedSpace.isVonNBounded_ball 𝕜₁ M₁ r)
theorem IsCompactOperator.isCompact_closure_image_closedBall [ContinuousConstSMul 𝕜₂ M₂]
[T2Space M₂] {f : M₁ →ₛₗ[σ₁₂] M₂} (hf : IsCompactOperator f) (r : ℝ) :
IsCompact (closure <| f '' Metric.closedBall 0 r) :=
hf.isCompact_closure_image_of_isVonNBounded (NormedSpace.isVonNBounded_closedBall 𝕜₁ M₁ r)
theorem isCompactOperator_iff_image_ball_subset_compact [ContinuousConstSMul 𝕜₂ M₂]
(f : M₁ →ₛₗ[σ₁₂] M₂) {r : ℝ} (hr : 0 < r) :
IsCompactOperator f ↔ ∃ K : Set M₂, IsCompact K ∧ f '' Metric.ball 0 r ⊆ K :=
⟨fun hf => hf.image_ball_subset_compact r, fun ⟨K, hK, hKr⟩ =>
(isCompactOperator_iff_exists_mem_nhds_image_subset_compact f).mpr
⟨Metric.ball 0 r, ball_mem_nhds _ hr, K, hK, hKr⟩⟩
theorem isCompactOperator_iff_image_closedBall_subset_compact [ContinuousConstSMul 𝕜₂ M₂]
(f : M₁ →ₛₗ[σ₁₂] M₂) {r : ℝ} (hr : 0 < r) :
IsCompactOperator f ↔ ∃ K : Set M₂, IsCompact K ∧ f '' Metric.closedBall 0 r ⊆ K :=
⟨fun hf => hf.image_closedBall_subset_compact r, fun ⟨K, hK, hKr⟩ =>
(isCompactOperator_iff_exists_mem_nhds_image_subset_compact f).mpr
⟨Metric.closedBall 0 r, closedBall_mem_nhds _ hr, K, hK, hKr⟩⟩
theorem isCompactOperator_iff_isCompact_closure_image_ball [ContinuousConstSMul 𝕜₂ M₂] [T2Space M₂]
(f : M₁ →ₛₗ[σ₁₂] M₂) {r : ℝ} (hr : 0 < r) :
IsCompactOperator f ↔ IsCompact (closure <| f '' Metric.ball 0 r) :=
⟨fun hf => hf.isCompact_closure_image_ball r, fun hf =>
(isCompactOperator_iff_exists_mem_nhds_isCompact_closure_image f).mpr
⟨Metric.ball 0 r, ball_mem_nhds _ hr, hf⟩⟩
theorem isCompactOperator_iff_isCompact_closure_image_closedBall [ContinuousConstSMul 𝕜₂ M₂]
[T2Space M₂] (f : M₁ →ₛₗ[σ₁₂] M₂) {r : ℝ} (hr : 0 < r) :
IsCompactOperator f ↔ IsCompact (closure <| f '' Metric.closedBall 0 r) :=
⟨fun hf => hf.isCompact_closure_image_closedBall r, fun hf =>
(isCompactOperator_iff_exists_mem_nhds_isCompact_closure_image f).mpr
⟨Metric.closedBall 0 r, closedBall_mem_nhds _ hr, hf⟩⟩
end NormedSpace
end Characterizations
section Operations
variable {R₁ R₄ : Type*} [Semiring R₁] [CommSemiring R₄]
{σ₁₄ : R₁ →+* R₄} {M₁ M₂ M₄ : Type*} [TopologicalSpace M₁]
[AddCommMonoid M₁] [TopologicalSpace M₂] [AddCommMonoid M₂]
[TopologicalSpace M₄] [AddCommGroup M₄]
theorem IsCompactOperator.smul {S : Type*} [Monoid S] [DistribMulAction S M₂]
[ContinuousConstSMul S M₂] {f : M₁ → M₂} (hf : IsCompactOperator f) (c : S) :
IsCompactOperator (c • f) :=
let ⟨K, hK, hKf⟩ := hf
⟨c • K, hK.image <| continuous_id.const_smul c,
mem_of_superset hKf fun _ hx => smul_mem_smul_set hx⟩
theorem IsCompactOperator.add [ContinuousAdd M₂] {f g : M₁ → M₂} (hf : IsCompactOperator f)
(hg : IsCompactOperator g) : IsCompactOperator (f + g) :=
let ⟨A, hA, hAf⟩ := hf
let ⟨B, hB, hBg⟩ := hg
⟨A + B, hA.add hB,
mem_of_superset (inter_mem hAf hBg) fun _ ⟨hxA, hxB⟩ => Set.add_mem_add hxA hxB⟩
theorem IsCompactOperator.neg [ContinuousNeg M₄] {f : M₁ → M₄} (hf : IsCompactOperator f) :
IsCompactOperator (-f) :=
let ⟨K, hK, hKf⟩ := hf
⟨-K, hK.neg, mem_of_superset hKf fun x (hx : f x ∈ K) => Set.neg_mem_neg.mpr hx⟩
theorem IsCompactOperator.sub [IsTopologicalAddGroup M₄] {f g : M₁ → M₄} (hf : IsCompactOperator f)
(hg : IsCompactOperator g) : IsCompactOperator (f - g) := by
rw [sub_eq_add_neg]; exact hf.add hg.neg
variable (σ₁₄ M₁ M₄)
/-- The submodule of compact continuous linear maps. -/
def compactOperator [Module R₁ M₁] [Module R₄ M₄] [ContinuousConstSMul R₄ M₄]
[IsTopologicalAddGroup M₄] : Submodule R₄ (M₁ →SL[σ₁₄] M₄) where
carrier := { f | IsCompactOperator f }
add_mem' hf hg := hf.add hg
zero_mem' := isCompactOperator_zero
smul_mem' c _ hf := hf.smul c
end Operations
section Comp
variable {R₁ R₂ R₃ : Type*} [Semiring R₁] [Semiring R₂] [Semiring R₃] {σ₁₂ : R₁ →+* R₂}
{σ₂₃ : R₂ →+* R₃} {M₁ M₂ M₃ : Type*} [TopologicalSpace M₁] [TopologicalSpace M₂]
[TopologicalSpace M₃] [AddCommMonoid M₁] [Module R₁ M₁]
theorem IsCompactOperator.comp_clm [AddCommMonoid M₂] [Module R₂ M₂] {f : M₂ → M₃}
(hf : IsCompactOperator f) (g : M₁ →SL[σ₁₂] M₂) : IsCompactOperator (f ∘ g) := by
have := g.continuous.tendsto 0
rw [map_zero] at this
rcases hf with ⟨K, hK, hKf⟩
exact ⟨K, hK, this hKf⟩
theorem IsCompactOperator.continuous_comp {f : M₁ → M₂} (hf : IsCompactOperator f) {g : M₂ → M₃}
(hg : Continuous g) : IsCompactOperator (g ∘ f) := by
rcases hf with ⟨K, hK, hKf⟩
refine ⟨g '' K, hK.image hg, mem_of_superset hKf ?_⟩
rw [preimage_comp]
exact preimage_mono (subset_preimage_image _ _)
theorem IsCompactOperator.clm_comp [AddCommMonoid M₂] [Module R₂ M₂] [AddCommMonoid M₃]
[Module R₃ M₃] {f : M₁ → M₂} (hf : IsCompactOperator f) (g : M₂ →SL[σ₂₃] M₃) :
IsCompactOperator (g ∘ f) :=
hf.continuous_comp g.continuous
end Comp
section CodRestrict
variable {R₂ : Type*} [Semiring R₂] {M₁ M₂ : Type*}
[TopologicalSpace M₁] [TopologicalSpace M₂] [AddCommMonoid M₁] [AddCommMonoid M₂]
[Module R₂ M₂]
theorem IsCompactOperator.codRestrict {f : M₁ → M₂} (hf : IsCompactOperator f) {V : Submodule R₂ M₂}
(hV : ∀ x, f x ∈ V) (h_closed : IsClosed (V : Set M₂)) :
IsCompactOperator (Set.codRestrict f V hV) :=
let ⟨_, hK, hKf⟩ := hf
⟨_, h_closed.isClosedEmbedding_subtypeVal.isCompact_preimage hK, hKf⟩
end CodRestrict
section Restrict
variable {R₁ R₂ : Type*} [Semiring R₁] [Semiring R₂] {σ₁₂ : R₁ →+* R₂}
{M₁ M₂ : Type*} [TopologicalSpace M₁] [UniformSpace M₂]
[AddCommMonoid M₁] [AddCommMonoid M₂] [Module R₁ M₁]
[Module R₂ M₂]
/-- If a compact operator preserves a closed submodule, its restriction to that submodule is
compact.
Note that, following mathlib's convention in linear algebra, `restrict` designates the restriction
of an endomorphism `f : E →ₗ E` to an endomorphism `f' : ↥V →ₗ ↥V`. To prove that the restriction
`f' : ↥U →ₛₗ ↥V` of a compact operator `f : E →ₛₗ F` is compact, apply
`IsCompactOperator.codRestrict` to `f ∘ U.subtypeL`, which is compact by
`IsCompactOperator.comp_clm`. -/
theorem IsCompactOperator.restrict {f : M₁ →ₗ[R₁] M₁} (hf : IsCompactOperator f)
{V : Submodule R₁ M₁} (hV : ∀ v ∈ V, f v ∈ V) (h_closed : IsClosed (V : Set M₁)) :
IsCompactOperator (f.restrict hV) :=
(hf.comp_clm V.subtypeL).codRestrict (SetLike.forall.2 hV) h_closed
/-- If a compact operator preserves a complete submodule, its restriction to that submodule is
compact.
Note that, following mathlib's convention in linear algebra, `restrict` designates the restriction
of an endomorphism `f : E →ₗ E` to an endomorphism `f' : ↥V →ₗ ↥V`. To prove that the restriction
`f' : ↥U →ₛₗ ↥V` of a compact operator `f : E →ₛₗ F` is compact, apply
`IsCompactOperator.codRestrict` to `f ∘ U.subtypeL`, which is compact by
`IsCompactOperator.comp_clm`. -/
theorem IsCompactOperator.restrict' [T0Space M₂] {f : M₂ →ₗ[R₂] M₂}
(hf : IsCompactOperator f) {V : Submodule R₂ M₂} (hV : ∀ v ∈ V, f v ∈ V)
[hcomplete : CompleteSpace V] : IsCompactOperator (f.restrict hV) :=
hf.restrict hV (completeSpace_coe_iff_isComplete.mp hcomplete).isClosed
end Restrict
section Continuous
variable {𝕜₁ 𝕜₂ : Type*} [NontriviallyNormedField 𝕜₁] [NontriviallyNormedField 𝕜₂]
{σ₁₂ : 𝕜₁ →+* 𝕜₂} [RingHomIsometric σ₁₂] {M₁ M₂ : Type*} [TopologicalSpace M₁] [AddCommGroup M₁]
[TopologicalSpace M₂] [AddCommGroup M₂] [Module 𝕜₁ M₁] [Module 𝕜₂ M₂] [IsTopologicalAddGroup M₁]
[ContinuousConstSMul 𝕜₁ M₁] [IsTopologicalAddGroup M₂] [ContinuousSMul 𝕜₂ M₂]
@[continuity]
theorem IsCompactOperator.continuous {f : M₁ →ₛₗ[σ₁₂] M₂} (hf : IsCompactOperator f) :
Continuous f := by
letI : UniformSpace M₂ := IsTopologicalAddGroup.rightUniformSpace _
haveI : IsUniformAddGroup M₂ := isUniformAddGroup_of_addCommGroup
-- Since `f` is linear, we only need to show that it is continuous at zero.
-- Let `U` be a neighborhood of `0` in `M₂`.
refine continuous_of_continuousAt_zero f fun U hU => ?_
rw [map_zero] at hU
-- The compactness of `f` gives us a compact set `K : Set M₂` such that `f ⁻¹' K` is a
-- neighborhood of `0` in `M₁`.
rcases hf with ⟨K, hK, hKf⟩
-- But any compact set is totally bounded, hence Von-Neumann bounded. Thus, `K` absorbs `U`.
-- This gives `r > 0` such that `∀ a : 𝕜₂, r ≤ ‖a‖ → K ⊆ a • U`.
rcases (hK.totallyBounded.isVonNBounded 𝕜₂ hU).exists_pos with ⟨r, hr, hrU⟩
-- Choose `c : 𝕜₂` with `r < ‖c‖`.
rcases NormedField.exists_lt_norm 𝕜₁ r with ⟨c, hc⟩
have hcnz : c ≠ 0 := ne_zero_of_norm_ne_zero (hr.trans hc).ne.symm
-- We have `f ⁻¹' ((σ₁₂ c⁻¹) • K) = c⁻¹ • f ⁻¹' K ∈ 𝓝 0`. Thus, showing that
-- `(σ₁₂ c⁻¹) • K ⊆ U` is enough to deduce that `f ⁻¹' U ∈ 𝓝 0`.
suffices (σ₁₂ <| c⁻¹) • K ⊆ U by
refine mem_of_superset ?_ this
have : IsUnit c⁻¹ := hcnz.isUnit.inv
rwa [mem_map, this.preimage_smul_setₛₗ σ₁₂, set_smul_mem_nhds_zero_iff (inv_ne_zero hcnz)]
-- Since `σ₁₂ c⁻¹` = `(σ₁₂ c)⁻¹`, we have to prove that `K ⊆ σ₁₂ c • U`.
rw [map_inv₀, ← subset_smul_set_iff₀ ((map_ne_zero σ₁₂).mpr hcnz)]
-- But `σ₁₂` is isometric, so `‖σ₁₂ c‖ = ‖c‖ > r`, which concludes the argument since
-- `∀ a : 𝕜₂, r ≤ ‖a‖ → K ⊆ a • U`.
refine hrU (σ₁₂ c) ?_
rw [RingHomIsometric.norm_map]
exact hc.le
/-- Upgrade a compact `LinearMap` to a `ContinuousLinearMap`. -/
def ContinuousLinearMap.mkOfIsCompactOperator {f : M₁ →ₛₗ[σ₁₂] M₂} (hf : IsCompactOperator f) :
M₁ →SL[σ₁₂] M₂ :=
⟨f, hf.continuous⟩
@[simp]
theorem ContinuousLinearMap.mkOfIsCompactOperator_to_linearMap {f : M₁ →ₛₗ[σ₁₂] M₂}
(hf : IsCompactOperator f) :
(ContinuousLinearMap.mkOfIsCompactOperator hf : M₁ →ₛₗ[σ₁₂] M₂) = f :=
rfl
@[simp]
theorem ContinuousLinearMap.coe_mkOfIsCompactOperator {f : M₁ →ₛₗ[σ₁₂] M₂}
(hf : IsCompactOperator f) : (ContinuousLinearMap.mkOfIsCompactOperator hf : M₁ → M₂) = f :=
rfl
theorem ContinuousLinearMap.mkOfIsCompactOperator_mem_compactOperator {f : M₁ →ₛₗ[σ₁₂] M₂}
(hf : IsCompactOperator f) :
ContinuousLinearMap.mkOfIsCompactOperator hf ∈ compactOperator σ₁₂ M₁ M₂ :=
hf
end Continuous
/-- The set of compact operators from a normed space to a complete topological vector space is
closed. -/
theorem isClosed_setOf_isCompactOperator {𝕜₁ 𝕜₂ : Type*} [NontriviallyNormedField 𝕜₁]
[NormedField 𝕜₂] {σ₁₂ : 𝕜₁ →+* 𝕜₂} {M₁ M₂ : Type*} [SeminormedAddCommGroup M₁]
[AddCommGroup M₂] [NormedSpace 𝕜₁ M₁] [Module 𝕜₂ M₂] [UniformSpace M₂] [IsUniformAddGroup M₂]
[ContinuousConstSMul 𝕜₂ M₂] [T2Space M₂] [CompleteSpace M₂] :
IsClosed { f : M₁ →SL[σ₁₂] M₂ | IsCompactOperator f } := by
refine isClosed_of_closure_subset ?_
rintro u hu
rw [mem_closure_iff_nhds_zero] at hu
suffices TotallyBounded (u '' Metric.closedBall 0 1) by
change IsCompactOperator (u : M₁ →ₛₗ[σ₁₂] M₂)
rw [isCompactOperator_iff_isCompact_closure_image_closedBall (u : M₁ →ₛₗ[σ₁₂] M₂) zero_lt_one]
exact this.closure.isCompact_of_isClosed isClosed_closure
rw [totallyBounded_iff_subset_finite_iUnion_nhds_zero]
intro U hU
rcases exists_nhds_zero_half hU with ⟨V, hV, hVU⟩
let SV : Set M₁ × Set M₂ := ⟨closedBall 0 1, -V⟩
rcases hu { f | ∀ x ∈ SV.1, f x ∈ SV.2 }
(ContinuousLinearMap.hasBasis_nhds_zero.mem_of_mem
⟨NormedSpace.isVonNBounded_closedBall _ _ _, neg_mem_nhds_zero M₂ hV⟩) with
⟨v, hv, huv⟩
rcases totallyBounded_iff_subset_finite_iUnion_nhds_zero.mp
(hv.isCompact_closure_image_closedBall 1).totallyBounded V hV with
⟨T, hT, hTv⟩
have hTv : v '' closedBall 0 1 ⊆ _ := subset_closure.trans hTv
refine ⟨T, hT, ?_⟩
rw [image_subset_iff, preimage_iUnion₂] at hTv ⊢
intro x hx
specialize hTv hx
rw [mem_iUnion₂] at hTv ⊢
rcases hTv with ⟨t, ht, htx⟩
refine ⟨t, ht, ?_⟩
rw [mem_preimage, mem_vadd_set_iff_neg_vadd_mem, vadd_eq_add, neg_add_eq_sub] at htx ⊢
convert hVU _ htx _ (huv x hx) using 1
rw [ContinuousLinearMap.sub_apply]
abel
theorem compactOperator_topologicalClosure {𝕜₁ 𝕜₂ : Type*} [NontriviallyNormedField 𝕜₁]
[NormedField 𝕜₂] {σ₁₂ : 𝕜₁ →+* 𝕜₂} {M₁ M₂ : Type*} [SeminormedAddCommGroup M₁]
[AddCommGroup M₂] [NormedSpace 𝕜₁ M₁] [Module 𝕜₂ M₂] [UniformSpace M₂] [IsUniformAddGroup M₂]
[ContinuousConstSMul 𝕜₂ M₂] [T2Space M₂] [CompleteSpace M₂] :
(compactOperator σ₁₂ M₁ M₂).topologicalClosure = compactOperator σ₁₂ M₁ M₂ :=
SetLike.ext' isClosed_setOf_isCompactOperator.closure_eq
theorem isCompactOperator_of_tendsto {ι 𝕜₁ 𝕜₂ : Type*} [NontriviallyNormedField 𝕜₁]
[NormedField 𝕜₂] {σ₁₂ : 𝕜₁ →+* 𝕜₂} {M₁ M₂ : Type*} [SeminormedAddCommGroup M₁]
[AddCommGroup M₂] [NormedSpace 𝕜₁ M₁] [Module 𝕜₂ M₂] [UniformSpace M₂] [IsUniformAddGroup M₂]
[ContinuousConstSMul 𝕜₂ M₂] [T2Space M₂] [CompleteSpace M₂] {l : Filter ι} [l.NeBot]
{F : ι → M₁ →SL[σ₁₂] M₂} {f : M₁ →SL[σ₁₂] M₂} (hf : Tendsto F l (𝓝 f))
(hF : ∀ᶠ i in l, IsCompactOperator (F i)) : IsCompactOperator f :=
isClosed_setOf_isCompactOperator.mem_of_tendsto hf hF |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Operator/Prod.lean | import Mathlib.Analysis.Normed.Operator.Bilinear
/-!
# Operator norm: Cartesian products
Interaction of operator norm with Cartesian products.
-/
variable {𝕜 E F G : Type*} [NontriviallyNormedField 𝕜]
open Set Real Metric ContinuousLinearMap
section SemiNormed
variable [SeminormedAddCommGroup E] [SeminormedAddCommGroup F] [SeminormedAddCommGroup G]
variable [NormedSpace 𝕜 E] [NormedSpace 𝕜 F] [NormedSpace 𝕜 G]
namespace ContinuousLinearMap
section FirstSecond
variable (𝕜 E F)
/-- The operator norm of the first projection `E × F → E` is at most 1. (It is 0 if `E` is zero, so
the inequality cannot be improved without further assumptions.) -/
lemma norm_fst_le : ‖fst 𝕜 E F‖ ≤ 1 :=
opNorm_le_bound _ zero_le_one (fun ⟨e, f⟩ ↦ by simpa only [one_mul] using le_max_left ‖e‖ ‖f‖)
/-- The operator norm of the second projection `E × F → F` is at most 1. (It is 0 if `F` is zero, so
the inequality cannot be improved without further assumptions.) -/
lemma norm_snd_le : ‖snd 𝕜 E F‖ ≤ 1 :=
opNorm_le_bound _ zero_le_one (fun ⟨e, f⟩ ↦ by simpa only [one_mul] using le_max_right ‖e‖ ‖f‖)
end FirstSecond
section OpNorm
@[simp]
theorem opNorm_prod (f : E →L[𝕜] F) (g : E →L[𝕜] G) : ‖f.prod g‖ = ‖(f, g)‖ :=
le_antisymm
(opNorm_le_bound _ (norm_nonneg _) fun x => by
simpa only [prod_apply, Prod.norm_def, max_mul_of_nonneg, norm_nonneg] using
max_le_max (le_opNorm f x) (le_opNorm g x)) <|
max_le
(opNorm_le_bound _ (norm_nonneg _) fun x =>
(le_max_left _ _).trans ((f.prod g).le_opNorm x))
(opNorm_le_bound _ (norm_nonneg _) fun x =>
(le_max_right _ _).trans ((f.prod g).le_opNorm x))
@[simp]
theorem opNNNorm_prod (f : E →L[𝕜] F) (g : E →L[𝕜] G) : ‖f.prod g‖₊ = ‖(f, g)‖₊ :=
Subtype.ext <| opNorm_prod f g
/-- `ContinuousLinearMap.prod` as a `LinearIsometryEquiv`. -/
noncomputable def prodₗᵢ (R : Type*)
[Semiring R] [Module R F] [Module R G] [ContinuousConstSMul R F]
[ContinuousConstSMul R G] [SMulCommClass 𝕜 R F] [SMulCommClass 𝕜 R G] :
(E →L[𝕜] F) × (E →L[𝕜] G) ≃ₗᵢ[R] E →L[𝕜] F × G :=
⟨prodₗ R, fun ⟨f, g⟩ => opNorm_prod f g⟩
end OpNorm
section Prod
variable (𝕜)
variable (M₁ M₂ M₃ M₄ : Type*)
[SeminormedAddCommGroup M₁] [NormedSpace 𝕜 M₁]
[SeminormedAddCommGroup M₂] [NormedSpace 𝕜 M₂]
[SeminormedAddCommGroup M₃] [NormedSpace 𝕜 M₃]
[SeminormedAddCommGroup M₄] [NormedSpace 𝕜 M₄]
/-- `ContinuousLinearMap.prodMap` as a continuous linear map. -/
noncomputable def prodMapL : (M₁ →L[𝕜] M₂) × (M₃ →L[𝕜] M₄) →L[𝕜] M₁ × M₃ →L[𝕜] M₂ × M₄ :=
ContinuousLinearMap.copy
(have Φ₁ : (M₁ →L[𝕜] M₂) →L[𝕜] M₁ →L[𝕜] M₂ × M₄ :=
ContinuousLinearMap.compL 𝕜 M₁ M₂ (M₂ × M₄) (ContinuousLinearMap.inl 𝕜 M₂ M₄)
have Φ₂ : (M₃ →L[𝕜] M₄) →L[𝕜] M₃ →L[𝕜] M₂ × M₄ :=
ContinuousLinearMap.compL 𝕜 M₃ M₄ (M₂ × M₄) (ContinuousLinearMap.inr 𝕜 M₂ M₄)
have Φ₁' :=
(ContinuousLinearMap.compL 𝕜 (M₁ × M₃) M₁ (M₂ × M₄)).flip (ContinuousLinearMap.fst 𝕜 M₁ M₃)
have Φ₂' :=
(ContinuousLinearMap.compL 𝕜 (M₁ × M₃) M₃ (M₂ × M₄)).flip (ContinuousLinearMap.snd 𝕜 M₁ M₃)
have Ψ₁ : (M₁ →L[𝕜] M₂) × (M₃ →L[𝕜] M₄) →L[𝕜] M₁ →L[𝕜] M₂ :=
ContinuousLinearMap.fst 𝕜 (M₁ →L[𝕜] M₂) (M₃ →L[𝕜] M₄)
have Ψ₂ : (M₁ →L[𝕜] M₂) × (M₃ →L[𝕜] M₄) →L[𝕜] M₃ →L[𝕜] M₄ :=
ContinuousLinearMap.snd 𝕜 (M₁ →L[𝕜] M₂) (M₃ →L[𝕜] M₄)
Φ₁' ∘L Φ₁ ∘L Ψ₁ + Φ₂' ∘L Φ₂ ∘L Ψ₂)
(fun p : (M₁ →L[𝕜] M₂) × (M₃ →L[𝕜] M₄) => p.1.prodMap p.2) (by
apply funext
rintro ⟨φ, ψ⟩
refine ContinuousLinearMap.ext fun ⟨x₁, x₂⟩ => ?_
simp)
variable {M₁ M₂ M₃ M₄}
@[simp]
theorem prodMapL_apply (p : (M₁ →L[𝕜] M₂) × (M₃ →L[𝕜] M₄)) :
ContinuousLinearMap.prodMapL 𝕜 M₁ M₂ M₃ M₄ p = p.1.prodMap p.2 :=
rfl
variable {X : Type*} [TopologicalSpace X]
theorem _root_.Continuous.prod_mapL {f : X → M₁ →L[𝕜] M₂} {g : X → M₃ →L[𝕜] M₄} (hf : Continuous f)
(hg : Continuous g) : Continuous fun x => (f x).prodMap (g x) :=
(prodMapL 𝕜 M₁ M₂ M₃ M₄).continuous.comp (hf.prodMk hg)
theorem _root_.Continuous.prod_map_equivL {f : X → M₁ ≃L[𝕜] M₂} {g : X → M₃ ≃L[𝕜] M₄}
(hf : Continuous fun x => (f x : M₁ →L[𝕜] M₂)) (hg : Continuous fun x => (g x : M₃ →L[𝕜] M₄)) :
Continuous fun x => ((f x).prodCongr (g x) : M₁ × M₃ →L[𝕜] M₂ × M₄) :=
(prodMapL 𝕜 M₁ M₂ M₃ M₄).continuous.comp (hf.prodMk hg)
theorem _root_.ContinuousOn.prod_mapL {f : X → M₁ →L[𝕜] M₂} {g : X → M₃ →L[𝕜] M₄} {s : Set X}
(hf : ContinuousOn f s) (hg : ContinuousOn g s) :
ContinuousOn (fun x => (f x).prodMap (g x)) s :=
((prodMapL 𝕜 M₁ M₂ M₃ M₄).continuous.comp_continuousOn (hf.prodMk hg) :)
theorem _root_.ContinuousOn.prod_map_equivL {f : X → M₁ ≃L[𝕜] M₂} {g : X → M₃ ≃L[𝕜] M₄} {s : Set X}
(hf : ContinuousOn (fun x => (f x : M₁ →L[𝕜] M₂)) s)
(hg : ContinuousOn (fun x => (g x : M₃ →L[𝕜] M₄)) s) :
ContinuousOn (fun x => ((f x).prodCongr (g x) : M₁ × M₃ →L[𝕜] M₂ × M₄)) s :=
hf.prod_mapL _ hg
end Prod
end ContinuousLinearMap
end SemiNormed
section Normed
namespace ContinuousLinearMap
section FirstSecond
variable (𝕜 E F)
/-- The operator norm of the first projection `E × F → E` is exactly 1 if `E` is nontrivial. -/
@[simp] lemma norm_fst [NormedAddCommGroup E] [NormedSpace 𝕜 E]
[SeminormedAddCommGroup F] [NormedSpace 𝕜 F] [Nontrivial E] :
‖fst 𝕜 E F‖ = 1 := by
refine le_antisymm (norm_fst_le ..) ?_
let ⟨e, he⟩ := exists_ne (0 : E)
have : ‖e‖ ≤ _ * max ‖e‖ ‖(0 : F)‖ := (fst 𝕜 E F).le_opNorm (e, 0)
rw [norm_zero, max_eq_left (norm_nonneg e)] at this
rwa [← mul_le_mul_iff_of_pos_right (norm_pos_iff.mpr he), one_mul]
/-- The operator norm of the second projection `E × F → F` is exactly 1 if `F` is nontrivial. -/
@[simp] lemma norm_snd [SeminormedAddCommGroup E] [NormedSpace 𝕜 E]
[NormedAddCommGroup F] [NormedSpace 𝕜 F] [Nontrivial F] :
‖snd 𝕜 E F‖ = 1 := by
refine le_antisymm (norm_snd_le ..) ?_
let ⟨f, hf⟩ := exists_ne (0 : F)
have : ‖f‖ ≤ _ * max ‖(0 : E)‖ ‖f‖ := (snd 𝕜 E F).le_opNorm (0, f)
rw [norm_zero, max_eq_right (norm_nonneg f)] at this
rwa [← mul_le_mul_iff_of_pos_right (norm_pos_iff.mpr hf), one_mul]
end FirstSecond
end ContinuousLinearMap
end Normed |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Operator/CompleteCodomain.lean | import Mathlib.Algebra.Central.Defs
import Mathlib.Analysis.LocallyConvex.SeparatingDual
import Mathlib.Analysis.NormedSpace.Multilinear.Basic
import Mathlib.LinearAlgebra.Dual.Lemmas
/-! # Completeness of spaces of linear and multilinear maps
If `E` is a nontrivial normed space over a nontrivially normed field `𝕜`, and `E` has a
separating dual, then for any normed space `F`, the completeness of the space of continuous
linear maps from `E` to `F` is equivalent to the completeness of `F`.
A similar statement holds for spaces of continuous multilinear maps
-/
open Filter
open scoped Topology
namespace SeparatingDual
variable (𝕜 E F : Type*) [NontriviallyNormedField 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E]
[NormedAddCommGroup F] [NormedSpace 𝕜 F] [SeparatingDual 𝕜 E] [Nontrivial E]
/-- If a space of linear maps from `E` to `F` is complete, and `E` is nontrivial, then `F` is
complete. -/
lemma completeSpace_of_completeSpace_continuousLinearMap [CompleteSpace (E →L[𝕜] F)] :
CompleteSpace F := by
refine Metric.complete_of_cauchySeq_tendsto fun f hf => ?_
obtain ⟨v, hv⟩ : ∃ (v : E), v ≠ 0 := exists_ne 0
obtain ⟨φ, hφ⟩ : ∃ φ : StrongDual 𝕜 E, φ v = 1 := exists_eq_one hv
let g : ℕ → (E →L[𝕜] F) := fun n ↦ ContinuousLinearMap.smulRightL 𝕜 E F φ (f n)
have : CauchySeq g := (ContinuousLinearMap.smulRightL 𝕜 E F φ).lipschitz.cauchySeq_comp hf
obtain ⟨a, ha⟩ : ∃ a, Tendsto g atTop (𝓝 a) := cauchy_iff_exists_le_nhds.mp this
refine ⟨a v, ?_⟩
have : Tendsto (fun n ↦ g n v) atTop (𝓝 (a v)) := by
have : Continuous (fun (i : E →L[𝕜] F) ↦ i v) := by fun_prop
exact (this.tendsto _).comp ha
simpa [g, ContinuousLinearMap.smulRightL, hφ]
lemma completeSpace_continuousLinearMap_iff :
CompleteSpace (E →L[𝕜] F) ↔ CompleteSpace F :=
⟨fun _h ↦ completeSpace_of_completeSpace_continuousLinearMap 𝕜 E F, fun _h ↦ inferInstance⟩
open ContinuousMultilinearMap
variable {ι : Type*} [Finite ι] {M : ι → Type*} [∀ i, NormedAddCommGroup (M i)]
[∀ i, NormedSpace 𝕜 (M i)] [∀ i, SeparatingDual 𝕜 (M i)]
/-- If a space of multilinear maps from `Π i, E i` to `F` is complete, and each `E i` has a nonzero
element, then `F` is complete. -/
lemma completeSpace_of_completeSpace_continuousMultilinearMap
[CompleteSpace (ContinuousMultilinearMap 𝕜 M F)]
{m : ∀ i, M i} (hm : ∀ i, m i ≠ 0) : CompleteSpace F := by
refine Metric.complete_of_cauchySeq_tendsto fun f hf => ?_
have : ∀ i, ∃ φ : StrongDual 𝕜 (M i), φ (m i) = 1 := fun i ↦ exists_eq_one (hm i)
choose φ hφ using this
cases nonempty_fintype ι
let g : ℕ → (ContinuousMultilinearMap 𝕜 M F) := fun n ↦
compContinuousLinearMapL φ
(ContinuousMultilinearMap.smulRightL 𝕜 _ F ((ContinuousMultilinearMap.mkPiAlgebra 𝕜 ι 𝕜)) (f n))
have : CauchySeq g := by
refine (ContinuousLinearMap.lipschitz _).cauchySeq_comp ?_
exact (ContinuousLinearMap.lipschitz _).cauchySeq_comp hf
obtain ⟨a, ha⟩ : ∃ a, Tendsto g atTop (𝓝 a) := cauchy_iff_exists_le_nhds.mp this
refine ⟨a m, ?_⟩
have : Tendsto (fun n ↦ g n m) atTop (𝓝 (a m)) := ((continuous_eval_const _).tendsto _).comp ha
simpa [g, hφ]
lemma completeSpace_continuousMultilinearMap_iff {m : ∀ i, M i} (hm : ∀ i, m i ≠ 0) :
CompleteSpace (ContinuousMultilinearMap 𝕜 M F) ↔ CompleteSpace F :=
⟨fun _h ↦ completeSpace_of_completeSpace_continuousMultilinearMap 𝕜 F hm, fun _h ↦ inferInstance⟩
end SeparatingDual |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Operator/NNNorm.lean | import Mathlib.Analysis.Normed.Operator.Basic
import Mathlib.Analysis.Normed.Module.RCLike.Real
/-!
# Operator norm as an `NNNorm`
Operator norm as an `NNNorm`, i.e. taking values in non-negative reals.
-/
suppress_compilation
open Bornology
open Filter hiding map_smul
open scoped NNReal Topology Uniformity
open Metric ContinuousLinearMap
open Set Real
variable {𝕜 𝕜₂ 𝕜₃ E F G : Type*}
section NontriviallySemiNormed
variable [NontriviallyNormedField 𝕜] [NontriviallyNormedField 𝕜₂] [NontriviallyNormedField 𝕜₃]
variable [SeminormedAddCommGroup E] [SeminormedAddCommGroup F] [SeminormedAddCommGroup G]
variable [NormedSpace 𝕜 E] [NormedSpace 𝕜₂ F] [NormedSpace 𝕜₃ G]
variable {σ₁₂ : 𝕜 →+* 𝕜₂} {σ₂₃ : 𝕜₂ →+* 𝕜₃} {σ₁₃ : 𝕜 →+* 𝕜₃} [RingHomCompTriple σ₁₂ σ₂₃ σ₁₃]
variable [RingHomIsometric σ₁₂] [RingHomIsometric σ₂₃] [RingHomIsometric σ₁₃]
namespace ContinuousLinearMap
theorem nnnorm_def (f : E →SL[σ₁₂] F) : ‖f‖₊ = sInf { c | ∀ x, ‖f x‖₊ ≤ c * ‖x‖₊ } := by
ext
rw [NNReal.coe_sInf, coe_nnnorm, norm_def, NNReal.coe_image]
simp_rw [← NNReal.coe_le_coe, NNReal.coe_mul, coe_nnnorm, mem_setOf_eq, NNReal.coe_mk,
exists_prop]
@[simp, nontriviality]
theorem opNNNorm_subsingleton [Subsingleton E] (f : E →SL[σ₁₂] F) : ‖f‖₊ = 0 :=
NNReal.eq <| f.opNorm_subsingleton
/-- If one controls the norm of every `A x`, then one controls the norm of `A`. -/
theorem opNNNorm_le_bound (f : E →SL[σ₁₂] F) (M : ℝ≥0) (hM : ∀ x, ‖f x‖₊ ≤ M * ‖x‖₊) : ‖f‖₊ ≤ M :=
opNorm_le_bound f (zero_le M) hM
/-- If one controls the norm of every `A x`, `‖x‖₊ ≠ 0`, then one controls the norm of `A`. -/
theorem opNNNorm_le_bound' (f : E →SL[σ₁₂] F) (M : ℝ≥0) (hM : ∀ x, ‖x‖₊ ≠ 0 → ‖f x‖₊ ≤ M * ‖x‖₊) :
‖f‖₊ ≤ M :=
opNorm_le_bound' f (zero_le M) fun x hx => hM x <| by rwa [← NNReal.coe_ne_zero]
/-- For a continuous real linear map `f`, if one controls the norm of every `f x`, `‖x‖₊ = 1`, then
one controls the norm of `f`. -/
theorem opNNNorm_le_of_unit_nnnorm [NormedAlgebra ℝ 𝕜] {f : E →SL[σ₁₂] F} {C : ℝ≥0}
(hf : ∀ x, ‖x‖₊ = 1 → ‖f x‖₊ ≤ C) : ‖f‖₊ ≤ C :=
opNorm_le_of_unit_norm C.coe_nonneg fun x hx => hf x <| by rwa [← NNReal.coe_eq_one]
theorem opNNNorm_le_of_lipschitz {f : E →SL[σ₁₂] F} {K : ℝ≥0} (hf : LipschitzWith K f) :
‖f‖₊ ≤ K :=
opNorm_le_of_lipschitz hf
theorem opNNNorm_eq_of_bounds {φ : E →SL[σ₁₂] F} (M : ℝ≥0) (h_above : ∀ x, ‖φ x‖₊ ≤ M * ‖x‖₊)
(h_below : ∀ N, (∀ x, ‖φ x‖₊ ≤ N * ‖x‖₊) → M ≤ N) : ‖φ‖₊ = M :=
Subtype.ext <| opNorm_eq_of_bounds (zero_le M) h_above <| Subtype.forall'.mpr h_below
theorem opNNNorm_le_iff {f : E →SL[σ₁₂] F} {C : ℝ≥0} : ‖f‖₊ ≤ C ↔ ∀ x, ‖f x‖₊ ≤ C * ‖x‖₊ :=
opNorm_le_iff C.2
theorem isLeast_opNNNorm (f : E →SL[σ₁₂] F) : IsLeast {C : ℝ≥0 | ∀ x, ‖f x‖₊ ≤ C * ‖x‖₊} ‖f‖₊ := by
simpa only [← opNNNorm_le_iff] using isLeast_Ici
theorem opNNNorm_comp_le (h : F →SL[σ₂₃] G) (f : E →SL[σ₁₂] F) : ‖h.comp f‖₊ ≤ ‖h‖₊ * ‖f‖₊ :=
opNorm_comp_le h f
lemma opENorm_comp_le (h : F →SL[σ₂₃] G) (f : E →SL[σ₁₂] F) : ‖h.comp f‖ₑ ≤ ‖h‖ₑ * ‖f‖ₑ := by
simpa [enorm, ← ENNReal.coe_mul] using opNNNorm_comp_le h f
theorem le_opNNNorm (f : E →SL[σ₁₂] F) (x : E) : ‖f x‖₊ ≤ ‖f‖₊ * ‖x‖₊ :=
f.le_opNorm x
lemma le_opENorm (f : E →SL[σ₁₂] F) (x : E) : ‖f x‖ₑ ≤ ‖f‖ₑ * ‖x‖ₑ := by
dsimp [enorm]; exact mod_cast le_opNNNorm ..
theorem nndist_le_opNNNorm (f : E →SL[σ₁₂] F) (x y : E) : nndist (f x) (f y) ≤ ‖f‖₊ * nndist x y :=
dist_le_opNorm f x y
/-- continuous linear maps are Lipschitz continuous. -/
theorem lipschitz (f : E →SL[σ₁₂] F) : LipschitzWith ‖f‖₊ f :=
AddMonoidHomClass.lipschitz_of_bound_nnnorm f _ f.le_opNNNorm
/-- Evaluation of a continuous linear map `f` at a point is Lipschitz continuous in `f`. -/
theorem lipschitz_apply (x : E) : LipschitzWith ‖x‖₊ fun f : E →SL[σ₁₂] F => f x :=
lipschitzWith_iff_norm_sub_le.2 fun f g => ((f - g).le_opNorm x).trans_eq (mul_comm _ _)
theorem exists_mul_lt_apply_of_lt_opNNNorm (f : E →SL[σ₁₂] F) {r : ℝ≥0} (hr : r < ‖f‖₊) :
∃ x, r * ‖x‖₊ < ‖f x‖₊ := by
simpa only [not_forall, not_le, Set.mem_setOf] using
notMem_of_lt_csInf (nnnorm_def f ▸ hr : r < sInf { c : ℝ≥0 | ∀ x, ‖f x‖₊ ≤ c * ‖x‖₊ })
(OrderBot.bddBelow _)
theorem exists_mul_lt_of_lt_opNorm (f : E →SL[σ₁₂] F) {r : ℝ} (hr₀ : 0 ≤ r) (hr : r < ‖f‖) :
∃ x, r * ‖x‖ < ‖f x‖ := by
lift r to ℝ≥0 using hr₀
exact f.exists_mul_lt_apply_of_lt_opNNNorm hr
end ContinuousLinearMap
namespace ContinuousLinearEquiv
variable {σ₂₁ : 𝕜₂ →+* 𝕜} [RingHomInvPair σ₁₂ σ₂₁] [RingHomInvPair σ₂₁ σ₁₂]
protected theorem lipschitz (e : E ≃SL[σ₁₂] F) : LipschitzWith ‖(e : E →SL[σ₁₂] F)‖₊ e :=
(e : E →SL[σ₁₂] F).lipschitz
end ContinuousLinearEquiv
end NontriviallySemiNormed
section DenselyNormedDomain
variable [NormedAddCommGroup E] [SeminormedAddCommGroup F]
variable [DenselyNormedField 𝕜] [NontriviallyNormedField 𝕜₂]
variable [NormedSpace 𝕜 E] [NormedSpace 𝕜₂ F] {σ₁₂ : 𝕜 →+* 𝕜₂} [RingHomIsometric σ₁₂]
namespace ContinuousLinearMap
theorem exists_lt_apply_of_lt_opNNNorm (f : E →SL[σ₁₂] F) {r : ℝ≥0}
(hr : r < ‖f‖₊) : ∃ x : E, ‖x‖₊ < 1 ∧ r < ‖f x‖₊ := by
obtain ⟨y, hy⟩ := f.exists_mul_lt_apply_of_lt_opNNNorm hr
have hy' : ‖y‖₊ ≠ 0 :=
nnnorm_ne_zero_iff.2 fun heq => by
simp [heq, nnnorm_zero, map_zero] at hy
have hfy : ‖f y‖₊ ≠ 0 := (zero_le'.trans_lt hy).ne'
rw [← inv_inv ‖f y‖₊, NNReal.lt_inv_iff_mul_lt (inv_ne_zero hfy), mul_assoc, mul_comm ‖y‖₊, ←
mul_assoc, ← NNReal.lt_inv_iff_mul_lt hy'] at hy
obtain ⟨k, hk₁, hk₂⟩ := NormedField.exists_lt_nnnorm_lt 𝕜 hy
refine ⟨k • y, (nnnorm_smul k y).symm ▸ (NNReal.lt_inv_iff_mul_lt hy').1 hk₂, ?_⟩
rwa [map_smulₛₗ f, nnnorm_smul, ← div_lt_iff₀ hfy.bot_lt, div_eq_mul_inv,
RingHomIsometric.nnnorm_map]
theorem exists_lt_apply_of_lt_opNorm (f : E →SL[σ₁₂] F) {r : ℝ}
(hr : r < ‖f‖) : ∃ x : E, ‖x‖ < 1 ∧ r < ‖f x‖ := by
by_cases hr₀ : r < 0
· exact ⟨0, by simpa using hr₀⟩
· lift r to ℝ≥0 using not_lt.1 hr₀
exact f.exists_lt_apply_of_lt_opNNNorm hr
theorem sSup_unit_ball_eq_nnnorm (f : E →SL[σ₁₂] F) :
sSup ((fun x => ‖f x‖₊) '' ball 0 1) = ‖f‖₊ := by
refine csSup_eq_of_forall_le_of_forall_lt_exists_gt ((nonempty_ball.mpr zero_lt_one).image _) ?_
fun ub hub => ?_
· rintro - ⟨x, hx, rfl⟩
simpa only [mul_one] using f.le_opNorm_of_le (mem_ball_zero_iff.1 hx).le
· obtain ⟨x, hx, hxf⟩ := f.exists_lt_apply_of_lt_opNNNorm hub
exact ⟨_, ⟨x, mem_ball_zero_iff.2 hx, rfl⟩, hxf⟩
theorem sSup_unit_ball_eq_norm (f : E →SL[σ₁₂] F) :
sSup ((fun x => ‖f x‖) '' ball 0 1) = ‖f‖ := by
simpa only [NNReal.coe_sSup, Set.image_image] using NNReal.coe_inj.2 f.sSup_unit_ball_eq_nnnorm
theorem sSup_unitClosedBall_eq_nnnorm (f : E →SL[σ₁₂] F) :
sSup ((fun x => ‖f x‖₊) '' closedBall 0 1) = ‖f‖₊ := by
have hbdd : ∀ y ∈ (fun x => ‖f x‖₊) '' closedBall 0 1, y ≤ ‖f‖₊ := by
rintro - ⟨x, hx, rfl⟩
exact f.unit_le_opNorm x (mem_closedBall_zero_iff.1 hx)
refine le_antisymm (csSup_le ((nonempty_closedBall.mpr zero_le_one).image _) hbdd) ?_
rw [← sSup_unit_ball_eq_nnnorm]
gcongr
exacts [⟨‖f‖₊, hbdd⟩, ball_subset_closedBall]
theorem sSup_unitClosedBall_eq_norm (f : E →SL[σ₁₂] F) :
sSup ((fun x => ‖f x‖) '' closedBall 0 1) = ‖f‖ := by
simpa only [NNReal.coe_sSup, Set.image_image] using
NNReal.coe_inj.2 f.sSup_unitClosedBall_eq_nnnorm
theorem exists_nnnorm_eq_one_lt_apply_of_lt_opNNNorm [NormedAlgebra ℝ 𝕜]
(f : E →SL[σ₁₂] F) {r : ℝ≥0} (hr : r < ‖f‖₊) :
∃ x : E, ‖x‖₊ = 1 ∧ r < ‖f x‖₊ := by
obtain ⟨x, hlt, hr⟩ := exists_lt_apply_of_lt_opNNNorm f hr
obtain rfl | hx0 := eq_zero_or_nnnorm_pos x
· simp at hr
use algebraMap ℝ 𝕜 ‖x‖⁻¹ • x
suffices r < ‖x‖₊⁻¹ * ‖f x‖₊ by simpa [nnnorm_smul, inv_mul_cancel₀ hx0.ne'] using this
calc
r < 1⁻¹ * ‖f x‖₊ := by simpa
_ < ‖x‖₊⁻¹ * ‖f x‖₊ := by gcongr; exact (zero_le r).trans_lt hr
/-- When the domain is a real normed space, `ContinuousLinearMap.sSup_unitClosedBall_eq_nnnorm` can
be tightened to take the supremum over only the `Metric.sphere`. -/
theorem sSup_sphere_eq_nnnorm [NormedAlgebra ℝ 𝕜] (f : E →SL[σ₁₂] F) :
sSup ((fun x => ‖f x‖₊) '' Metric.sphere 0 1) = ‖f‖₊ := by
cases subsingleton_or_nontrivial E
· simp [sphere_eq_empty_of_subsingleton one_ne_zero]
have : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ 𝕜 E
refine csSup_eq_of_forall_le_of_forall_lt_exists_gt
((NormedSpace.sphere_nonempty.mpr zero_le_one).image _) ?_ fun ub hub => ?_
· rintro - ⟨x, hx, rfl⟩
simpa only [mul_one] using f.le_opNorm_of_le (mem_sphere_zero_iff_norm.1 hx).le
· obtain ⟨x, hx, hxf⟩ := f.exists_nnnorm_eq_one_lt_apply_of_lt_opNNNorm hub
exact ⟨_, ⟨x, by simpa using congrArg NNReal.toReal hx, rfl⟩, hxf⟩
/-- When the domain is a real normed space, `ContinuousLinearMap.sSup_unitClosedBall_eq_norm` can be
tightened to take the supremum over only the `Metric.sphere`. -/
theorem sSup_sphere_eq_norm [NormedAlgebra ℝ 𝕜] (f : E →SL[σ₁₂] F) :
sSup ((fun x => ‖f x‖) '' Metric.sphere 0 1) = ‖f‖ := by
simpa only [NNReal.coe_sSup, Set.image_image] using NNReal.coe_inj.2 f.sSup_sphere_eq_nnnorm
end ContinuousLinearMap
end DenselyNormedDomain |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Operator/Mul.lean | import Mathlib.Algebra.Algebra.Bilinear
import Mathlib.Analysis.Normed.Operator.NormedSpace
/-!
# Results about operator norms in normed algebras
This file (split off from `OperatorNorm.lean`) contains results about the operator norm
of multiplication and scalar-multiplication operations in normed algebras and normed modules.
-/
suppress_compilation
open Metric
open scoped NNReal Topology Uniformity
variable {𝕜 E : Type*} [NontriviallyNormedField 𝕜]
section SemiNormed
variable [SeminormedAddCommGroup E] [NormedSpace 𝕜 E]
namespace ContinuousLinearMap
section MultiplicationLinear
section NonUnital
variable (𝕜) (R : Type*) [NonUnitalSeminormedRing R]
variable [NormedSpace 𝕜 R] [IsScalarTower 𝕜 R R] [SMulCommClass 𝕜 R R]
/-- Multiplication in a non-unital normed algebra as a continuous bilinear map. -/
def mul : R →L[𝕜] R →L[𝕜] R :=
(LinearMap.mul 𝕜 R).mkContinuous₂ 1 fun x y => by simpa using norm_mul_le x y
@[simp]
theorem mul_apply' (x y : R) : mul 𝕜 R x y = x * y :=
rfl
@[simp]
theorem opNorm_mul_apply_le (x : R) : ‖mul 𝕜 R x‖ ≤ ‖x‖ :=
opNorm_le_bound _ (norm_nonneg x) (norm_mul_le x)
theorem opNorm_mul_le : ‖mul 𝕜 R‖ ≤ 1 :=
LinearMap.mkContinuous₂_norm_le _ zero_le_one _
/-- Multiplication on the left in a non-unital normed algebra `R` as a non-unital algebra
homomorphism into the algebra of *continuous* linear maps. This is the left regular representation
of `A` acting on itself.
This has more algebraic structure than `ContinuousLinearMap.mul`, but there is no longer continuity
bundled in the first coordinate. An alternative viewpoint is that this upgrades
`NonUnitalAlgHom.lmul` from a homomorphism into linear maps to a homomorphism into *continuous*
linear maps. -/
def _root_.NonUnitalAlgHom.Lmul : R →ₙₐ[𝕜] R →L[𝕜] R :=
{ mul 𝕜 R with
map_mul' := fun _ _ ↦ ext fun _ ↦ mul_assoc _ _ _
map_zero' := ext fun _ ↦ zero_mul _ }
variable {𝕜 R} in
@[simp]
theorem _root_.NonUnitalAlgHom.coe_Lmul : ⇑(NonUnitalAlgHom.Lmul 𝕜 R) = mul 𝕜 R :=
rfl
/-- Simultaneous left- and right-multiplication in a non-unital normed algebra, considered as a
continuous trilinear map. This is akin to its non-continuous version `LinearMap.mulLeftRight`,
but there is a minor difference: `LinearMap.mulLeftRight` is uncurried. -/
def mulLeftRight : R →L[𝕜] R →L[𝕜] R →L[𝕜] R :=
((compL 𝕜 R R R).comp (mul 𝕜 R).flip).flip.comp (mul 𝕜 R)
@[simp]
theorem mulLeftRight_apply (x y z : R) : mulLeftRight 𝕜 R x y z = x * z * y :=
rfl
theorem opNorm_mulLeftRight_apply_apply_le (x y : R) : ‖mulLeftRight 𝕜 R x y‖ ≤ ‖x‖ * ‖y‖ :=
(opNorm_comp_le _ _).trans <|
(mul_comm _ _).trans_le <|
mul_le_mul (opNorm_mul_apply_le _ _ _)
(opNorm_le_bound _ (norm_nonneg _) fun _ => (norm_mul_le _ _).trans_eq (mul_comm _ _))
(norm_nonneg _) (norm_nonneg _)
theorem opNorm_mulLeftRight_apply_le (x : R) : ‖mulLeftRight 𝕜 R x‖ ≤ ‖x‖ :=
opNorm_le_bound _ (norm_nonneg x) (opNorm_mulLeftRight_apply_apply_le 𝕜 R x)
theorem opNorm_mulLeftRight_le :
‖mulLeftRight 𝕜 R‖ ≤ 1 :=
opNorm_le_bound _ zero_le_one fun x => (one_mul ‖x‖).symm ▸ opNorm_mulLeftRight_apply_le 𝕜 R x
/-- This is a mixin class for non-unital normed algebras which states that the left-regular
representation of the algebra on itself is isometric. Every unital normed algebra with `‖1‖ = 1` is
a regular normed algebra (see `NormedAlgebra.instRegularNormedAlgebra`). In addition, so is every
C⋆-algebra, non-unital included (see `CStarRing.instRegularNormedAlgebra`), but there are yet other
examples. Any algebra with an approximate identity (e.g., $$L^1$$) is also regular.
This is a useful class because it gives rise to a nice norm on the unitization; in particular it is
a C⋆-norm when the norm on `A` is a C⋆-norm. -/
class _root_.RegularNormedAlgebra : Prop where
/-- The left regular representation of the algebra on itself is an isometry. -/
isometry_mul' : Isometry (mul 𝕜 R)
/-- Every (unital) normed algebra such that `‖1‖ = 1` is a `RegularNormedAlgebra`. -/
instance _root_.NormedAlgebra.instRegularNormedAlgebra {𝕜 R : Type*} [NontriviallyNormedField 𝕜]
[SeminormedRing R] [NormedAlgebra 𝕜 R] [NormOneClass R] : RegularNormedAlgebra 𝕜 R where
isometry_mul' := AddMonoidHomClass.isometry_of_norm (mul 𝕜 R) <|
fun x => le_antisymm (opNorm_mul_apply_le _ _ _) <| by
convert ratio_le_opNorm ((mul 𝕜 R) x) (1 : R)
simp [norm_one]
variable [RegularNormedAlgebra 𝕜 R]
lemma isometry_mul : Isometry (mul 𝕜 R) :=
RegularNormedAlgebra.isometry_mul'
@[simp]
lemma opNorm_mul_apply (x : R) : ‖mul 𝕜 R x‖ = ‖x‖ :=
(AddMonoidHomClass.isometry_iff_norm (mul 𝕜 R)).mp (isometry_mul 𝕜 R) x
@[simp]
lemma opNNNorm_mul_apply (x : R) : ‖mul 𝕜 R x‖₊ = ‖x‖₊ :=
Subtype.ext <| opNorm_mul_apply 𝕜 R x
/-- Multiplication in a normed algebra as a linear isometry to the space of
continuous linear maps. -/
def mulₗᵢ : R →ₗᵢ[𝕜] R →L[𝕜] R where
toLinearMap := mul 𝕜 R
norm_map' x := opNorm_mul_apply 𝕜 R x
@[simp]
theorem coe_mulₗᵢ : ⇑(mulₗᵢ 𝕜 R) = mul 𝕜 R :=
rfl
end NonUnital
section NonUnitalSeminormedCommRing
variable {R : Type*} [NonUnitalSeminormedCommRing R] [NormedSpace 𝕜 R] [IsScalarTower 𝕜 R R]
[SMulCommClass 𝕜 R R]
@[simp] lemma flip_mul : (ContinuousLinearMap.mul 𝕜 R).flip = .mul 𝕜 R := by ext; simp [mul_comm]
end NonUnitalSeminormedCommRing
section RingEquiv
variable (𝕜 E)
/-- If `M` is a normed space over `𝕜`, then the space of maps `𝕜 →L[𝕜] M` is linearly equivalent
to `M`. (See `ring_lmap_equiv_self` for a stronger statement.) -/
def ring_lmap_equiv_selfₗ : (𝕜 →L[𝕜] E) ≃ₗ[𝕜] E where
toFun := fun f ↦ f 1
invFun := (ContinuousLinearMap.id 𝕜 𝕜).smulRight
map_smul' := fun a f ↦ by simp only [coe_smul', Pi.smul_apply, RingHom.id_apply]
map_add' := fun f g ↦ by simp only [add_apply]
left_inv := fun f ↦ by ext; simp only [smulRight_apply, coe_id', _root_.id, one_smul]
right_inv := fun m ↦ by simp only [smulRight_apply, id_apply, one_smul]
/-- If `M` is a normed space over `𝕜`, then the space of maps `𝕜 →L[𝕜] M` is linearly isometrically
equivalent to `M`. -/
def ring_lmap_equiv_self : (𝕜 →L[𝕜] E) ≃ₗᵢ[𝕜] E where
toLinearEquiv := ring_lmap_equiv_selfₗ 𝕜 E
norm_map' := by
refine fun f ↦ le_antisymm ?_ ?_
· simpa only [norm_one, mul_one] using le_opNorm f 1
· refine opNorm_le_bound' f (norm_nonneg <| f 1) (fun x _ ↦ ?_)
rw [(by rw [smul_eq_mul, mul_one] : f x = f (x • 1)), ContinuousLinearMap.map_smul,
norm_smul, mul_comm, (by rfl : ring_lmap_equiv_selfₗ 𝕜 E f = f 1)]
end RingEquiv
end MultiplicationLinear
section SMulLinear
variable (𝕜) (R : Type*) [NormedField R]
variable [NormedAlgebra 𝕜 R] [NormedSpace R E] [IsScalarTower 𝕜 R E]
/-- Scalar multiplication as a continuous bilinear map. -/
def lsmul : R →L[𝕜] E →L[𝕜] E :=
((Algebra.lsmul 𝕜 𝕜 E).toLinearMap : R →ₗ[𝕜] E →ₗ[𝕜] E).mkContinuous₂ 1 fun c x => by
simpa only [one_mul] using norm_smul_le c x
@[simp]
theorem lsmul_apply (c : R) (x : E) : lsmul 𝕜 R c x = c • x :=
rfl
variable {𝕜} in
@[simp]
theorem lsmul_flip_apply (x : E) :
(lsmul 𝕜 𝕜).flip x = toSpanSingleton 𝕜 x :=
rfl
@[deprecated (since := "29-08-2025")] alias comp_lsmul_flip_apply := comp_toSpanSingleton
variable {𝕜} in
theorem lsmul_flip_inj {x y : E} :
(lsmul 𝕜 R).flip x = (lsmul 𝕜 R).flip y ↔ x = y :=
⟨fun h => by simpa using congr($h 1), fun h => h ▸ rfl⟩
variable {R}
theorem norm_toSpanSingleton (x : E) : ‖toSpanSingleton 𝕜 x‖ = ‖x‖ := by
refine opNorm_eq_of_bounds (norm_nonneg _) (fun x => ?_) fun N _ h => ?_
· rw [toSpanSingleton_apply, norm_smul, mul_comm]
· simpa [toSpanSingleton_apply, norm_smul] using h 1
variable {𝕜}
theorem opNorm_lsmul_apply_le (x : R) : ‖(lsmul 𝕜 R x : E →L[𝕜] E)‖ ≤ ‖x‖ :=
ContinuousLinearMap.opNorm_le_bound _ (norm_nonneg x) fun y => norm_smul_le x y
/-- The norm of `lsmul` is at most 1 in any semi-normed group. -/
theorem opNorm_lsmul_le : ‖(lsmul 𝕜 R : R →L[𝕜] E →L[𝕜] E)‖ ≤ 1 := by
refine ContinuousLinearMap.opNorm_le_bound _ zero_le_one fun x => ?_
simp_rw [one_mul]
exact opNorm_lsmul_apply_le _
end SMulLinear
end ContinuousLinearMap
end SemiNormed
section Normed
namespace ContinuousLinearMap
variable [NormedAddCommGroup E] [NormedSpace 𝕜 E]
variable (𝕜) (R : Type*)
section
variable [NonUnitalNormedRing R] [NormedSpace 𝕜 R] [IsScalarTower 𝕜 R R]
variable [SMulCommClass 𝕜 R R] [RegularNormedAlgebra 𝕜 R] [Nontrivial R]
@[simp]
theorem opNorm_mul : ‖mul 𝕜 R‖ = 1 :=
(mulₗᵢ 𝕜 R).norm_toContinuousLinearMap
@[simp]
theorem opNNNorm_mul : ‖mul 𝕜 R‖₊ = 1 :=
Subtype.ext <| opNorm_mul 𝕜 R
end
/-- The norm of `lsmul` equals 1 in any nontrivial normed group.
This is `ContinuousLinearMap.opNorm_lsmul_le` as an equality. -/
@[simp]
theorem opNorm_lsmul [NormedField R] [NormedAlgebra 𝕜 R] [NormedSpace R E]
[IsScalarTower 𝕜 R E] [Nontrivial E] : ‖(lsmul 𝕜 R : R →L[𝕜] E →L[𝕜] E)‖ = 1 := by
refine ContinuousLinearMap.opNorm_eq_of_bounds zero_le_one (fun x => ?_) fun N _ h => ?_
· rw [one_mul]
apply opNorm_lsmul_apply_le
obtain ⟨y, hy⟩ := exists_ne (0 : E)
refine le_of_mul_le_mul_right ?_ (norm_pos_iff.mpr hy)
simpa using le_of_opNorm_le _ (h 1) y
end ContinuousLinearMap
end Normed |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Operator/Basic.lean | import Mathlib.Algebra.Algebra.Tower
import Mathlib.Analysis.LocallyConvex.WithSeminorms
import Mathlib.Analysis.Normed.Module.Convex
import Mathlib.Topology.Algebra.Module.StrongTopology
import Mathlib.Analysis.Normed.Operator.LinearIsometry
import Mathlib.Analysis.Normed.Operator.ContinuousLinearMap
import Mathlib.Tactic.SuppressCompilation
/-!
# Operator norm on the space of continuous linear maps
Define the operator (semi)-norm on the space of continuous (semi)linear maps between (semi)-normed
spaces, and prove its basic properties. In particular, show that this space is itself a semi-normed
space.
Since a lot of elementary properties don't require `‖x‖ = 0 → x = 0` we start setting up the
theory for `SeminormedAddCommGroup`. Later we will specialize to `NormedAddCommGroup` in the
file `NormedSpace.lean`.
Note that most of statements that apply to semilinear maps only hold when the ring homomorphism
is isometric, as expressed by the typeclass `[RingHomIsometric σ]`.
## Main Results
* `ball_subset_range_iff_surjective` (and its variants) shows that a semi-linear map between normed
spaces is surjective if and only if it contains a ball.
-/
suppress_compilation
open Bornology Metric
open Filter hiding map_smul
open scoped NNReal Topology Uniformity
-- the `ₗ` subscript variables are for special cases about linear (as opposed to semilinear) maps
variable {𝕜 𝕜₂ 𝕜₃ E F Fₗ G 𝓕 : Type*}
section SemiNormed
variable [SeminormedAddCommGroup E] [SeminormedAddCommGroup F] [SeminormedAddCommGroup Fₗ]
[SeminormedAddCommGroup G]
variable [NontriviallyNormedField 𝕜] [NontriviallyNormedField 𝕜₂] [NontriviallyNormedField 𝕜₃]
[NormedSpace 𝕜 E] [NormedSpace 𝕜₂ F] [NormedSpace 𝕜 Fₗ] [NormedSpace 𝕜₃ G]
{σ₁₂ : 𝕜 →+* 𝕜₂} {σ₂₃ : 𝕜₂ →+* 𝕜₃} {σ₁₃ : 𝕜 →+* 𝕜₃} [RingHomCompTriple σ₁₂ σ₂₃ σ₁₃]
variable [FunLike 𝓕 E F]
section
variable [SemilinearMapClass 𝓕 σ₁₂ E F]
theorem ball_zero_subset_range_iff_surjective [RingHomSurjective σ₁₂] {f : 𝓕} {r : ℝ}
(hr : 0 < r) : ball 0 r ⊆ Set.range f ↔ (⇑f).Surjective :=
absorbent_ball (by simpa)|>.subset_range_iff_surjective
theorem ball_subset_range_iff_surjective [RingHomSurjective σ₁₂] {f : 𝓕} {x : F} {r : ℝ}
(hr : 0 < r) : ball x r ⊆ Set.range f ↔ (⇑f).Surjective := by
refine ⟨fun h ↦ ?_, by simp_all⟩
suffices ball 0 r ⊆ Set.range f from (ball_zero_subset_range_iff_surjective hr).mp this
intro _ _
change _ ∈ LinearMap.range f --this can be avoided by replacing `rw` with `erw` in the next line
rw [← Submodule.add_mem_iff_left (p := LinearMap.range f) (h <| mem_ball_self hr)]
apply h
simp_all
theorem closedBall_subset_range_iff_surjective [RingHomSurjective σ₁₂] {f : 𝓕} (x : F) {r : ℝ}
(hr : 0 < r) : closedBall (x : F) r ⊆ Set.range f ↔ (⇑f).Surjective :=
⟨fun h ↦ (ball_subset_range_iff_surjective hr).mp <| subset_trans ball_subset_closedBall h,
by simp_all⟩
variable {F' 𝓕' : Type*} [NormedAddCommGroup F'] [NormedSpace ℝ F'] [Nontrivial F']
{τ : 𝕜 →+* ℝ} [FunLike 𝓕' E F'] [SemilinearMapClass 𝓕' τ E F']
theorem sphere_subset_range_iff_surjective [RingHomSurjective τ] {f : 𝓕'} {x : F'} {r : ℝ}
(hr : 0 < r) : sphere x r ⊆ Set.range f ↔ (⇑f).Surjective := by
refine ⟨fun h ↦ ?_, by simp_all⟩
grw [← (closedBall_subset_range_iff_surjective x hr), ← convexHull_sphere_eq_closedBall x
(le_of_lt hr), convexHull_mono h, (convexHull_eq_self (𝕜 := ℝ) (s := Set.range ↑f)).mpr]
exact Submodule.Convex.semilinear_range (E := F') (F' := E) (σ := τ) f
end
/-- If `‖x‖ = 0` and `f` is continuous then `‖f x‖ = 0`. -/
theorem norm_image_of_norm_eq_zero [SemilinearMapClass 𝓕 σ₁₂ E F] (f : 𝓕) (hf : Continuous f)
{x : E} (hx : ‖x‖ = 0) : ‖f x‖ = 0 := by
rw [← mem_closure_zero_iff_norm, ← specializes_iff_mem_closure, ← map_zero f] at *
exact hx.map hf
@[deprecated (since := "2025-11-15")] alias norm_image_of_norm_zero := norm_image_of_norm_eq_zero
section
variable [RingHomIsometric σ₁₂]
theorem SemilinearMapClass.bound_of_shell_semi_normed [SemilinearMapClass 𝓕 σ₁₂ E F] (f : 𝓕)
{ε C : ℝ} (ε_pos : 0 < ε) {c : 𝕜} (hc : 1 < ‖c‖)
(hf : ∀ x, ε / ‖c‖ ≤ ‖x‖ → ‖x‖ < ε → ‖f x‖ ≤ C * ‖x‖) {x : E} (hx : ‖x‖ ≠ 0) :
‖f x‖ ≤ C * ‖x‖ :=
(normSeminorm 𝕜 E).bound_of_shell ((normSeminorm 𝕜₂ F).comp ⟨⟨f, map_add f⟩, map_smulₛₗ f⟩)
ε_pos hc hf hx
/-- A continuous linear map between seminormed spaces is bounded when the field is nontrivially
normed. 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, ε]`, whose image has a
controlled norm. The norm control for the original element follows by rescaling. -/
theorem SemilinearMapClass.bound_of_continuous [SemilinearMapClass 𝓕 σ₁₂ E F] (f : 𝓕)
(hf : Continuous f) : ∃ C, 0 < C ∧ ∀ x : E, ‖f x‖ ≤ C * ‖x‖ :=
let φ : E →ₛₗ[σ₁₂] F := ⟨⟨f, map_add f⟩, map_smulₛₗ f⟩
((normSeminorm 𝕜₂ F).comp φ).bound_of_continuous_normedSpace (continuous_norm.comp hf)
theorem SemilinearMapClass.nnbound_of_continuous [SemilinearMapClass 𝓕 σ₁₂ E F] (f : 𝓕)
(hf : Continuous f) : ∃ C : ℝ≥0, 0 < C ∧ ∀ x : E, ‖f x‖₊ ≤ C * ‖x‖₊ :=
let ⟨c, hc, hcf⟩ := SemilinearMapClass.bound_of_continuous f hf; ⟨⟨c, hc.le⟩, hc, hcf⟩
theorem SemilinearMapClass.ebound_of_continuous [SemilinearMapClass 𝓕 σ₁₂ E F] (f : 𝓕)
(hf : Continuous f) : ∃ C : ℝ≥0, 0 < C ∧ ∀ x : E, ‖f x‖ₑ ≤ C * ‖x‖ₑ :=
let ⟨c, hc, hcf⟩ := SemilinearMapClass.nnbound_of_continuous f hf
⟨c, hc, fun x => ENNReal.coe_mono <| hcf x⟩
end
namespace ContinuousLinearMap
theorem bound [RingHomIsometric σ₁₂] (f : E →SL[σ₁₂] F) : ∃ C, 0 < C ∧ ∀ x : E, ‖f x‖ ≤ C * ‖x‖ :=
SemilinearMapClass.bound_of_continuous f f.2
theorem nnbound [RingHomIsometric σ₁₂] (f : E →SL[σ₁₂] F) :
∃ C : ℝ≥0, 0 < C ∧ ∀ x : E, ‖f x‖₊ ≤ C * ‖x‖₊ :=
SemilinearMapClass.nnbound_of_continuous f f.2
theorem ebound [RingHomIsometric σ₁₂] (f : E →SL[σ₁₂] F) :
∃ C : ℝ≥0, 0 < C ∧ ∀ x : E, ‖f x‖ₑ ≤ C * ‖x‖ₑ :=
SemilinearMapClass.ebound_of_continuous f f.2
section
open Filter
variable (𝕜 E)
/-- Given a unit-length element `x` of a normed space `E` over a field `𝕜`, the natural linear
isometry map from `𝕜` to `E` by taking multiples of `x`. -/
def _root_.LinearIsometry.toSpanSingleton {v : E} (hv : ‖v‖ = 1) : 𝕜 →ₗᵢ[𝕜] E :=
{ LinearMap.toSpanSingleton 𝕜 E v with norm_map' := fun x => by simp [norm_smul, hv] }
variable {𝕜 E}
@[simp]
theorem _root_.LinearIsometry.toSpanSingleton_apply {v : E} (hv : ‖v‖ = 1) (a : 𝕜) :
LinearIsometry.toSpanSingleton 𝕜 E hv a = a • v :=
rfl
@[simp]
theorem _root_.LinearIsometry.coe_toSpanSingleton {v : E} (hv : ‖v‖ = 1) :
(LinearIsometry.toSpanSingleton 𝕜 E hv).toLinearMap = LinearMap.toSpanSingleton 𝕜 E v :=
rfl
end
section OpNorm
open Set Real
/-- The operator norm of a continuous linear map is the inf of all its bounds. -/
def opNorm (f : E →SL[σ₁₂] F) :=
sInf { c | 0 ≤ c ∧ ∀ x, ‖f x‖ ≤ c * ‖x‖ }
instance hasOpNorm : Norm (E →SL[σ₁₂] F) :=
⟨opNorm⟩
theorem norm_def (f : E →SL[σ₁₂] F) : ‖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 [RingHomIsometric σ₁₂] {f : E →SL[σ₁₂] F} :
∃ 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 : E →SL[σ₁₂] F} : BddBelow { c | 0 ≤ c ∧ ∀ x, ‖f x‖ ≤ c * ‖x‖ } :=
⟨0, fun _ ⟨hn, _⟩ => hn⟩
theorem isLeast_opNorm [RingHomIsometric σ₁₂] (f : E →SL[σ₁₂] F) :
IsLeast {c | 0 ≤ c ∧ ∀ x, ‖f x‖ ≤ c * ‖x‖} ‖f‖ := by
refine IsClosed.isLeast_csInf ?_ bounds_nonempty bounds_bddBelow
simp only [setOf_and, setOf_forall]
refine isClosed_Ici.inter <| isClosed_iInter fun _ ↦ isClosed_le ?_ ?_ <;> continuity
/-- If one controls the norm of every `A x`, then one controls the norm of `A`. -/
theorem opNorm_le_bound (f : E →SL[σ₁₂] F) {M : ℝ} (hMp : 0 ≤ M) (hM : ∀ x, ‖f x‖ ≤ M * ‖x‖) :
‖f‖ ≤ M :=
csInf_le bounds_bddBelow ⟨hMp, hM⟩
/-- If one controls the norm of every `A x`, `‖x‖ ≠ 0`, then one controls the norm of `A`. -/
theorem opNorm_le_bound' (f : E →SL[σ₁₂] F) {M : ℝ} (hMp : 0 ≤ M)
(hM : ∀ x, ‖x‖ ≠ 0 → ‖f x‖ ≤ M * ‖x‖) : ‖f‖ ≤ M :=
opNorm_le_bound f hMp fun x =>
(ne_or_eq ‖x‖ 0).elim (hM x) fun h => by
simp only [h, mul_zero, norm_image_of_norm_eq_zero f f.2 h, le_refl]
theorem opNorm_eq_of_bounds {φ : E →SL[σ₁₂] F} {M : ℝ} (M_nonneg : 0 ≤ M)
(h_above : ∀ x, ‖φ x‖ ≤ M * ‖x‖) (h_below : ∀ N ≥ 0, (∀ x, ‖φ x‖ ≤ N * ‖x‖) → M ≤ N) :
‖φ‖ = M :=
le_antisymm (φ.opNorm_le_bound M_nonneg h_above)
((le_csInf_iff ContinuousLinearMap.bounds_bddBelow ⟨M, M_nonneg, h_above⟩).mpr
fun N ⟨N_nonneg, hN⟩ => h_below N N_nonneg hN)
theorem opNorm_neg (f : E →SL[σ₁₂] F) : ‖-f‖ = ‖f‖ := by simp only [norm_def, neg_apply, norm_neg]
theorem opNorm_nonneg (f : E →SL[σ₁₂] F) : 0 ≤ ‖f‖ :=
Real.sInf_nonneg fun _ ↦ And.left
/-- The norm of the `0` operator is `0`. -/
theorem opNorm_zero : ‖(0 : E →SL[σ₁₂] F)‖ = 0 :=
le_antisymm (opNorm_le_bound _ le_rfl fun _ ↦ by simp) (opNorm_nonneg _)
/-- The norm of the identity is at most `1`. It is in fact `1`, except when the space is trivial
where it is `0`. It means that one cannot do better than an inequality in general. -/
theorem norm_id_le : ‖ContinuousLinearMap.id 𝕜 E‖ ≤ 1 :=
opNorm_le_bound _ zero_le_one fun x => by simp
section
variable [RingHomIsometric σ₁₂] [RingHomIsometric σ₂₃] (f g : E →SL[σ₁₂] F) (h : F →SL[σ₂₃] G)
(x : E)
/-- The fundamental property of the operator norm: `‖f x‖ ≤ ‖f‖ * ‖x‖`. -/
theorem le_opNorm : ‖f x‖ ≤ ‖f‖ * ‖x‖ := (isLeast_opNorm f).1.2 x
theorem dist_le_opNorm (x y : E) : dist (f x) (f y) ≤ ‖f‖ * dist x y := by
simp_rw [dist_eq_norm, ← map_sub, f.le_opNorm]
theorem le_of_opNorm_le_of_le {x} {a b : ℝ} (hf : ‖f‖ ≤ a) (hx : ‖x‖ ≤ b) :
‖f x‖ ≤ a * b :=
(f.le_opNorm x).trans <| by gcongr; exact (opNorm_nonneg f).trans hf
theorem le_opNorm_of_le {c : ℝ} {x} (h : ‖x‖ ≤ c) : ‖f x‖ ≤ ‖f‖ * c :=
f.le_of_opNorm_le_of_le le_rfl h
theorem le_of_opNorm_le {c : ℝ} (h : ‖f‖ ≤ c) (x : E) : ‖f x‖ ≤ c * ‖x‖ :=
f.le_of_opNorm_le_of_le h le_rfl
theorem opNorm_le_iff {f : E →SL[σ₁₂] F} {M : ℝ} (hMp : 0 ≤ M) :
‖f‖ ≤ M ↔ ∀ x, ‖f x‖ ≤ M * ‖x‖ :=
⟨f.le_of_opNorm_le, opNorm_le_bound f hMp⟩
theorem ratio_le_opNorm : ‖f x‖ / ‖x‖ ≤ ‖f‖ :=
div_le_of_le_mul₀ (norm_nonneg _) f.opNorm_nonneg (le_opNorm _ _)
/-- The image of the unit ball under a continuous linear map is bounded. -/
theorem unit_le_opNorm : ‖x‖ ≤ 1 → ‖f x‖ ≤ ‖f‖ :=
mul_one ‖f‖ ▸ f.le_opNorm_of_le
theorem opNorm_le_of_shell {f : E →SL[σ₁₂] F} {ε C : ℝ} (ε_pos : 0 < ε) (hC : 0 ≤ C) {c : 𝕜}
(hc : 1 < ‖c‖) (hf : ∀ x, ε / ‖c‖ ≤ ‖x‖ → ‖x‖ < ε → ‖f x‖ ≤ C * ‖x‖) : ‖f‖ ≤ C :=
f.opNorm_le_bound' hC fun _ hx => SemilinearMapClass.bound_of_shell_semi_normed f ε_pos hc hf hx
theorem opNorm_le_of_ball {f : E →SL[σ₁₂] F} {ε : ℝ} {C : ℝ} (ε_pos : 0 < ε) (hC : 0 ≤ C)
(hf : ∀ x ∈ ball (0 : E) ε, ‖f x‖ ≤ C * ‖x‖) : ‖f‖ ≤ C := by
rcases NormedField.exists_one_lt_norm 𝕜 with ⟨c, hc⟩
refine opNorm_le_of_shell ε_pos hC hc fun x _ hx => hf x ?_
rwa [ball_zero_eq]
theorem opNorm_le_of_nhds_zero {f : E →SL[σ₁₂] F} {C : ℝ} (hC : 0 ≤ C)
(hf : ∀ᶠ x in 𝓝 (0 : E), ‖f x‖ ≤ C * ‖x‖) : ‖f‖ ≤ C :=
let ⟨_, ε0, hε⟩ := Metric.eventually_nhds_iff_ball.1 hf
opNorm_le_of_ball ε0 hC hε
theorem opNorm_le_of_shell' {f : E →SL[σ₁₂] F} {ε C : ℝ} (ε_pos : 0 < ε) (hC : 0 ≤ C) {c : 𝕜}
(hc : ‖c‖ < 1) (hf : ∀ x, ε * ‖c‖ ≤ ‖x‖ → ‖x‖ < ε → ‖f x‖ ≤ C * ‖x‖) : ‖f‖ ≤ C := by
by_cases h0 : c = 0
· refine opNorm_le_of_ball ε_pos hC fun x hx => hf x ?_ ?_
· simp [h0]
· rwa [ball_zero_eq] at hx
· rw [← inv_inv c, norm_inv, inv_lt_one₀ (norm_pos_iff.2 <| inv_ne_zero h0)] at hc
refine opNorm_le_of_shell ε_pos hC hc ?_
rwa [norm_inv, div_eq_mul_inv, inv_inv]
/-- For a continuous real linear map `f`, if one controls the norm of every `f x`, `‖x‖ = 1`, then
one controls the norm of `f`. -/
theorem opNorm_le_of_unit_norm [NormedAlgebra ℝ 𝕜] {f : E →SL[σ₁₂] F} {C : ℝ}
(hC : 0 ≤ C) (hf : ∀ x, ‖x‖ = 1 → ‖f x‖ ≤ C) : ‖f‖ ≤ C := by
refine opNorm_le_bound' f hC fun x hx => ?_
have H₁ : ‖algebraMap _ 𝕜 ‖x‖⁻¹ • x‖ = 1 := by simp [norm_smul, inv_mul_cancel₀ hx]
have H₂ : ‖x‖⁻¹ * ‖f x‖ ≤ C := by simpa [norm_smul] using hf _ H₁
rwa [← div_eq_inv_mul, div_le_iff₀] at H₂
exact (norm_nonneg x).lt_of_ne' hx
/-- The operator norm satisfies the triangle inequality. -/
theorem opNorm_add_le : ‖f + g‖ ≤ ‖f‖ + ‖g‖ :=
(f + g).opNorm_le_bound (add_nonneg f.opNorm_nonneg g.opNorm_nonneg) fun x =>
(norm_add_le_of_le (f.le_opNorm x) (g.le_opNorm x)).trans_eq (add_mul _ _ _).symm
/-- 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 : E, ‖x‖ ≠ 0) : ‖ContinuousLinearMap.id 𝕜 E‖ = 1 :=
le_antisymm norm_id_le <| by
let ⟨x, hx⟩ := h
have := (ContinuousLinearMap.id 𝕜 E).ratio_le_opNorm x
rwa [id_apply, div_self hx] at this
theorem opNorm_smul_le {𝕜' : Type*} [NormedField 𝕜'] [NormedSpace 𝕜' F] [SMulCommClass 𝕜₂ 𝕜' F]
(c : 𝕜') (f : E →SL[σ₁₂] F) : ‖c • f‖ ≤ ‖c‖ * ‖f‖ :=
(c • f).opNorm_le_bound (mul_nonneg (norm_nonneg _) (opNorm_nonneg _)) fun _ => by
rw [smul_apply, norm_smul, mul_assoc]
gcongr
apply le_opNorm
theorem opNorm_le_iff_lipschitz {f : E →SL[σ₁₂] F} {K : ℝ≥0} :
‖f‖ ≤ K ↔ LipschitzWith K f :=
⟨fun h ↦ by simpa using AddMonoidHomClass.lipschitz_of_bound f K <| le_of_opNorm_le f h,
fun hf ↦ f.opNorm_le_bound K.2 <| hf.norm_le_mul (map_zero f)⟩
alias ⟨lipschitzWith_of_opNorm_le, opNorm_le_of_lipschitz⟩ := opNorm_le_iff_lipschitz
/-- Operator seminorm on the space of continuous (semi)linear maps, as `Seminorm`.
We use this seminorm to define a `SeminormedGroup` structure on `E →SL[σ] F`,
but we have to override the projection `UniformSpace`
so that it is definitionally equal to the one coming from the topologies on `E` and `F`. -/
protected noncomputable def seminorm : Seminorm 𝕜₂ (E →SL[σ₁₂] F) :=
.ofSMulLE norm opNorm_zero opNorm_add_le opNorm_smul_le
private lemma uniformity_eq_seminorm :
𝓤 (E →SL[σ₁₂] F) = ⨅ r > 0, 𝓟 {f | ‖f.1 - f.2‖ < r} := by
refine ContinuousLinearMap.seminorm (σ₁₂ := σ₁₂) (E := E) (F := F) |>.uniformity_eq_of_hasBasis
(ContinuousLinearMap.hasBasis_nhds_zero_of_basis Metric.nhds_basis_closedBall)
?_ fun (s, r) ⟨hs, hr⟩ ↦ ?_
· rcases NormedField.exists_lt_norm 𝕜 1 with ⟨c, hc⟩
refine ⟨‖c‖, ContinuousLinearMap.hasBasis_nhds_zero.mem_iff.2
⟨(closedBall 0 1, closedBall 0 1), ?_⟩⟩
suffices ∀ f : E →SL[σ₁₂] F, (∀ x, ‖x‖ ≤ 1 → ‖f x‖ ≤ 1) → ‖f‖ ≤ ‖c‖ by
simpa [NormedSpace.isVonNBounded_closedBall, closedBall_mem_nhds, subset_def] using this
intro f hf
refine opNorm_le_of_shell (f := f) one_pos (norm_nonneg c) hc fun x hcx hx ↦ ?_
exact (hf x hx.le).trans ((div_le_iff₀' <| one_pos.trans hc).1 hcx)
· rcases (NormedSpace.isVonNBounded_iff' _).1 hs with ⟨ε, hε⟩
rcases exists_pos_mul_lt hr ε with ⟨δ, hδ₀, hδ⟩
refine ⟨δ, hδ₀, fun f hf x hx ↦ ?_⟩
simp only [Seminorm.mem_ball_zero, mem_closedBall_zero_iff] at hf ⊢
rw [mul_comm] at hδ
exact le_trans (le_of_opNorm_le_of_le _ hf.le (hε _ hx)) hδ.le
instance toPseudoMetricSpace : PseudoMetricSpace (E →SL[σ₁₂] F) := .replaceUniformity
ContinuousLinearMap.seminorm.toSeminormedAddCommGroup.toPseudoMetricSpace uniformity_eq_seminorm
/-- Continuous linear maps themselves form a seminormed space with respect to the operator norm. -/
instance toSeminormedAddCommGroup : SeminormedAddCommGroup (E →SL[σ₁₂] F) where
instance toNormedSpace {𝕜' : Type*} [NormedField 𝕜'] [NormedSpace 𝕜' F] [SMulCommClass 𝕜₂ 𝕜' F] :
NormedSpace 𝕜' (E →SL[σ₁₂] F) :=
⟨opNorm_smul_le⟩
/-- The operator norm is submultiplicative. -/
theorem opNorm_comp_le (f : E →SL[σ₁₂] F) : ‖h.comp f‖ ≤ ‖h‖ * ‖f‖ :=
csInf_le bounds_bddBelow ⟨by positivity, fun x => by
rw [mul_assoc]
exact h.le_opNorm_of_le (f.le_opNorm x)⟩
/-- Continuous linear maps form a seminormed ring with respect to the operator norm. -/
instance toSeminormedRing : SeminormedRing (E →L[𝕜] E) :=
{ toSeminormedAddCommGroup, ring with norm_mul_le := opNorm_comp_le }
/-- For a normed space `E`, continuous linear endomorphisms form a normed algebra with
respect to the operator norm. -/
instance toNormedAlgebra : NormedAlgebra 𝕜 (E →L[𝕜] E) := { toNormedSpace, algebra with }
end
variable [RingHomIsometric σ₁₂] (f : E →SL[σ₁₂] F)
@[simp, nontriviality]
theorem opNorm_subsingleton [Subsingleton E] : ‖f‖ = 0 := norm_of_subsingleton f
/-- The fundamental property of the operator norm, expressed with extended norms:
`‖f x‖ₑ ≤ ‖f‖ₑ * ‖x‖ₑ`. -/
lemma le_opNorm_enorm (x : E) : ‖f x‖ₑ ≤ ‖f‖ₑ * ‖x‖ₑ := by
simp_rw [← ofReal_norm]
rw [← ENNReal.ofReal_mul (by positivity)]
gcongr
exact f.le_opNorm x
end OpNorm
section RestrictScalars
variable {𝕜' : Type*} [NontriviallyNormedField 𝕜'] [NormedAlgebra 𝕜' 𝕜]
variable [NormedSpace 𝕜' E] [IsScalarTower 𝕜' 𝕜 E]
variable [NormedSpace 𝕜' Fₗ] [IsScalarTower 𝕜' 𝕜 Fₗ]
@[simp]
theorem norm_restrictScalars (f : E →L[𝕜] Fₗ) : ‖f.restrictScalars 𝕜'‖ = ‖f‖ :=
le_antisymm (opNorm_le_bound _ (norm_nonneg _) fun x => f.le_opNorm x)
(opNorm_le_bound _ (norm_nonneg _) fun x => f.le_opNorm x)
variable (𝕜 E Fₗ 𝕜') (𝕜'' : Type*) [Ring 𝕜'']
variable [Module 𝕜'' Fₗ] [ContinuousConstSMul 𝕜'' Fₗ]
[SMulCommClass 𝕜 𝕜'' Fₗ] [SMulCommClass 𝕜' 𝕜'' Fₗ]
/-- `ContinuousLinearMap.restrictScalars` as a `LinearIsometry`. -/
def restrictScalarsIsometry : (E →L[𝕜] Fₗ) →ₗᵢ[𝕜''] E →L[𝕜'] Fₗ :=
⟨restrictScalarsₗ 𝕜 E Fₗ 𝕜' 𝕜'', norm_restrictScalars⟩
variable {𝕜''}
@[simp]
theorem coe_restrictScalarsIsometry :
⇑(restrictScalarsIsometry 𝕜 E Fₗ 𝕜' 𝕜'') = restrictScalars 𝕜' :=
rfl
@[simp]
theorem restrictScalarsIsometry_toLinearMap :
(restrictScalarsIsometry 𝕜 E Fₗ 𝕜' 𝕜'').toLinearMap = restrictScalarsₗ 𝕜 E Fₗ 𝕜' 𝕜'' :=
rfl
end RestrictScalars
lemma norm_pi_le_of_le {ι : Type*} [Fintype ι]
{M : ι → Type*} [∀ i, SeminormedAddCommGroup (M i)] [∀ i, NormedSpace 𝕜 (M i)] {C : ℝ}
{L : (i : ι) → (E →L[𝕜] M i)} (hL : ∀ i, ‖L i‖ ≤ C) (hC : 0 ≤ C) :
‖pi L‖ ≤ C := by
refine opNorm_le_bound _ hC (fun x ↦ ?_)
refine (pi_norm_le_iff_of_nonneg (by positivity)).mpr (fun i ↦ ?_)
exact (L i).le_of_opNorm_le (hL i) _
end ContinuousLinearMap
namespace LinearMap
/-- If a continuous linear map is constructed from a linear map via the constructor `mkContinuous`,
then its norm is bounded by the bound given to the constructor if it is nonnegative. -/
theorem mkContinuous_norm_le (f : E →ₛₗ[σ₁₂] F) {C : ℝ} (hC : 0 ≤ C) (h : ∀ x, ‖f x‖ ≤ C * ‖x‖) :
‖f.mkContinuous C h‖ ≤ C :=
ContinuousLinearMap.opNorm_le_bound _ hC h
/-- If a continuous linear map is constructed from a linear map via the constructor `mkContinuous`,
then its norm is bounded by the bound or zero if bound is negative. -/
theorem mkContinuous_norm_le' (f : E →ₛₗ[σ₁₂] F) {C : ℝ} (h : ∀ x, ‖f x‖ ≤ C * ‖x‖) :
‖f.mkContinuous C h‖ ≤ max C 0 :=
ContinuousLinearMap.opNorm_le_bound _ (le_max_right _ _) fun x => (h x).trans <| by
gcongr; apply le_max_left
end LinearMap
namespace LinearIsometry
theorem norm_toContinuousLinearMap_le (f : E →ₛₗᵢ[σ₁₂] F) : ‖f.toContinuousLinearMap‖ ≤ 1 :=
f.toContinuousLinearMap.opNorm_le_bound zero_le_one fun x => by simp
end LinearIsometry
namespace Submodule
theorem norm_subtypeL_le (K : Submodule 𝕜 E) : ‖K.subtypeL‖ ≤ 1 :=
K.subtypeₗᵢ.norm_toContinuousLinearMap_le
end Submodule
end SemiNormed |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Operator/Completeness.lean | import Mathlib.Analysis.Normed.Operator.Bilinear
import Mathlib.Analysis.Normed.Operator.NNNorm
/-!
# Operators on complete normed spaces
This file contains statements about norms of operators on complete normed spaces, such as a
version of the Banach-Alaoglu theorem (`ContinuousLinearMap.isCompact_image_coe_closedBall`).
-/
suppress_compilation
open Bornology Metric Set Real
open Filter hiding map_smul
open scoped NNReal Topology Uniformity
-- the `ₗ` subscript variables are for special cases about linear (as opposed to semilinear) maps
variable {𝕜 𝕜₂ E F Fₗ : Type*}
variable [NormedAddCommGroup E] [NormedAddCommGroup F] [NormedAddCommGroup Fₗ]
variable [NontriviallyNormedField 𝕜] [NontriviallyNormedField 𝕜₂]
[NormedSpace 𝕜 E] [NormedSpace 𝕜₂ F] [NormedSpace 𝕜 Fₗ]
{σ₁₂ : 𝕜 →+* 𝕜₂} (f g : E →SL[σ₁₂] F)
namespace ContinuousLinearMap
section Completeness
variable {E' : Type*} [SeminormedAddCommGroup E'] [NormedSpace 𝕜 E'] [RingHomIsometric σ₁₂]
/-- Construct a bundled continuous (semi)linear map from a map `f : E → F` and a proof of the fact
that it belongs to the closure of the image of a bounded set `s : Set (E →SL[σ₁₂] F)` under coercion
to function. Coercion to function of the result is definitionally equal to `f`. -/
@[simps! -fullyApplied apply]
def ofMemClosureImageCoeBounded (f : E' → F) {s : Set (E' →SL[σ₁₂] F)} (hs : IsBounded s)
(hf : f ∈ closure (((↑) : (E' →SL[σ₁₂] F) → E' → F) '' s)) : E' →SL[σ₁₂] F := by
-- `f` is a linear map due to `linearMapOfMemClosureRangeCoe`
refine (linearMapOfMemClosureRangeCoe f ?_).mkContinuousOfExistsBound ?_
· refine closure_mono (image_subset_iff.2 fun g _ => ?_) hf
exact ⟨g, rfl⟩
· -- We need to show that `f` has bounded norm. Choose `C` such that `‖g‖ ≤ C` for all `g ∈ s`.
rcases isBounded_iff_forall_norm_le.1 hs with ⟨C, hC⟩
-- Then `‖g x‖ ≤ C * ‖x‖` for all `g ∈ s`, `x : E`, hence `‖f x‖ ≤ C * ‖x‖` for all `x`.
have : ∀ x, IsClosed { g : E' → F | ‖g x‖ ≤ C * ‖x‖ } := fun x =>
isClosed_Iic.preimage (@continuous_apply E' (fun _ => F) _ x).norm
refine ⟨C, fun x => (this x).closure_subset_iff.2 (image_subset_iff.2 fun g hg => ?_) hf⟩
exact g.le_of_opNorm_le (hC _ hg) _
/-- Let `f : E → F` be a map, let `g : α → E →SL[σ₁₂] F` be a family of continuous (semi)linear maps
that takes values in a bounded set and converges to `f` pointwise along a nontrivial filter. Then
`f` is a continuous (semi)linear map. -/
@[simps! -fullyApplied apply]
def ofTendstoOfBoundedRange {α : Type*} {l : Filter α} [l.NeBot] (f : E' → F)
(g : α → E' →SL[σ₁₂] F) (hf : Tendsto (fun a x => g a x) l (𝓝 f))
(hg : IsBounded (Set.range g)) : E' →SL[σ₁₂] F :=
ofMemClosureImageCoeBounded f hg <| mem_closure_of_tendsto hf <|
Eventually.of_forall fun _ => mem_image_of_mem _ <| Set.mem_range_self _
/-- If a Cauchy sequence of continuous linear map converges to a continuous linear map pointwise,
then it converges to the same map in norm. This lemma is used to prove that the space of continuous
linear maps is complete provided that the codomain is a complete space. -/
theorem tendsto_of_tendsto_pointwise_of_cauchySeq {f : ℕ → E' →SL[σ₁₂] F} {g : E' →SL[σ₁₂] F}
(hg : Tendsto (fun n x => f n x) atTop (𝓝 g)) (hf : CauchySeq f) : Tendsto f atTop (𝓝 g) := by
/- Since `f` is a Cauchy sequence, there exists `b → 0` such that `‖f n - f m‖ ≤ b N` for any
`m, n ≥ N`. -/
rcases cauchySeq_iff_le_tendsto_0.1 hf with ⟨b, hb₀, hfb, hb_lim⟩
-- Since `b → 0`, it suffices to show that `‖f n x - g x‖ ≤ b n * ‖x‖` for all `n` and `x`.
suffices ∀ n x, ‖f n x - g x‖ ≤ b n * ‖x‖ from
tendsto_iff_norm_sub_tendsto_zero.2
(squeeze_zero (fun n => norm_nonneg _) (fun n => opNorm_le_bound _ (hb₀ n) (this n)) hb_lim)
intro n x
-- Note that `f m x → g x`, hence `‖f n x - f m x‖ → ‖f n x - g x‖` as `m → ∞`
have : Tendsto (fun m => ‖f n x - f m x‖) atTop (𝓝 ‖f n x - g x‖) :=
(tendsto_const_nhds.sub <| tendsto_pi_nhds.1 hg _).norm
-- Thus it suffices to verify `‖f n x - f m x‖ ≤ b n * ‖x‖` for `m ≥ n`.
refine le_of_tendsto this (eventually_atTop.2 ⟨n, fun m hm => ?_⟩)
-- This inequality follows from `‖f n - f m‖ ≤ b n`.
exact (f n - f m).le_of_opNorm_le (hfb _ _ _ le_rfl hm) _
/-- Let `s` be a bounded set in the space of continuous (semi)linear maps `E →SL[σ] F` taking values
in a proper space. Then `s` interpreted as a set in the space of maps `E → F` with topology of
pointwise convergence is precompact: its closure is a compact set. -/
theorem isCompact_closure_image_coe_of_bounded [ProperSpace F] {s : Set (E' →SL[σ₁₂] F)}
(hb : IsBounded s) : IsCompact (closure (((↑) : (E' →SL[σ₁₂] F) → E' → F) '' s)) :=
have : ∀ x, IsCompact (closure (apply' F σ₁₂ x '' s)) := fun x =>
((apply' F σ₁₂ x).lipschitz.isBounded_image hb).isCompact_closure
(isCompact_pi_infinite this).closure_of_subset
(image_subset_iff.2 fun _ hg _ => subset_closure <| mem_image_of_mem _ hg)
/-- Let `s` be a bounded set in the space of continuous (semi)linear maps `E →SL[σ] F` taking values
in a proper space. If `s` interpreted as a set in the space of maps `E → F` with topology of
pointwise convergence is closed, then it is compact.
TODO: reformulate this in terms of a type synonym with the right topology. -/
theorem isCompact_image_coe_of_bounded_of_closed_image [ProperSpace F] {s : Set (E' →SL[σ₁₂] F)}
(hb : IsBounded s) (hc : IsClosed (((↑) : (E' →SL[σ₁₂] F) → E' → F) '' s)) :
IsCompact (((↑) : (E' →SL[σ₁₂] F) → E' → F) '' s) :=
hc.closure_eq ▸ isCompact_closure_image_coe_of_bounded hb
/-- If a set `s` of semilinear functions is bounded and is closed in the weak-* topology, then its
image under coercion to functions `E → F` is a closed set. We don't have a name for `E →SL[σ] F`
with weak-* topology in `mathlib`, so we use an equivalent condition (see `isClosed_induced_iff'`).
TODO: reformulate this in terms of a type synonym with the right topology. -/
theorem isClosed_image_coe_of_bounded_of_weak_closed {s : Set (E' →SL[σ₁₂] F)} (hb : IsBounded s)
(hc : ∀ f : E' →SL[σ₁₂] F,
(⇑f : E' → F) ∈ closure (((↑) : (E' →SL[σ₁₂] F) → E' → F) '' s) → f ∈ s) :
IsClosed (((↑) : (E' →SL[σ₁₂] F) → E' → F) '' s) :=
isClosed_of_closure_subset fun f hf =>
⟨ofMemClosureImageCoeBounded f hb hf, hc (ofMemClosureImageCoeBounded f hb hf) hf, rfl⟩
/-- If a set `s` of semilinear functions is bounded and is closed in the weak-* topology, then its
image under coercion to functions `E → F` is a compact set. We don't have a name for `E →SL[σ] F`
with weak-* topology in `mathlib`, so we use an equivalent condition (see `isClosed_induced_iff'`).
-/
theorem isCompact_image_coe_of_bounded_of_weak_closed [ProperSpace F] {s : Set (E' →SL[σ₁₂] F)}
(hb : IsBounded s) (hc : ∀ f : E' →SL[σ₁₂] F,
(⇑f : E' → F) ∈ closure (((↑) : (E' →SL[σ₁₂] F) → E' → F) '' s) → f ∈ s) :
IsCompact (((↑) : (E' →SL[σ₁₂] F) → E' → F) '' s) :=
isCompact_image_coe_of_bounded_of_closed_image hb <|
isClosed_image_coe_of_bounded_of_weak_closed hb hc
/-- A closed ball is closed in the weak-* topology. We don't have a name for `E →SL[σ] F` with
weak-* topology in `mathlib`, so we use an equivalent condition (see `isClosed_induced_iff'`). -/
theorem is_weak_closed_closedBall (f₀ : E' →SL[σ₁₂] F) (r : ℝ) ⦃f : E' →SL[σ₁₂] F⦄
(hf : ⇑f ∈ closure (((↑) : (E' →SL[σ₁₂] F) → E' → F) '' closedBall f₀ r)) :
f ∈ closedBall f₀ r := by
have hr : 0 ≤ r := nonempty_closedBall.1 (closure_nonempty_iff.1 ⟨_, hf⟩).of_image
refine mem_closedBall_iff_norm.2 (opNorm_le_bound _ hr fun x => ?_)
have : IsClosed { g : E' → F | ‖g x - f₀ x‖ ≤ r * ‖x‖ } :=
isClosed_Iic.preimage ((@continuous_apply E' (fun _ => F) _ x).sub continuous_const).norm
refine this.closure_subset_iff.2 (image_subset_iff.2 fun g hg => ?_) hf
exact (g - f₀).le_of_opNorm_le (mem_closedBall_iff_norm.1 hg) _
/-- The set of functions `f : E → F` that represent continuous linear maps `f : E →SL[σ₁₂] F`
at distance `≤ r` from `f₀ : E →SL[σ₁₂] F` is closed in the topology of pointwise convergence.
This is one of the key steps in the proof of the **Banach-Alaoglu** theorem. -/
theorem isClosed_image_coe_closedBall (f₀ : E →SL[σ₁₂] F) (r : ℝ) :
IsClosed (((↑) : (E →SL[σ₁₂] F) → E → F) '' closedBall f₀ r) :=
isClosed_image_coe_of_bounded_of_weak_closed isBounded_closedBall (is_weak_closed_closedBall f₀ r)
/-- **Banach-Alaoglu** theorem. The set of functions `f : E → F` that represent continuous linear
maps `f : E →SL[σ₁₂] F` at distance `≤ r` from `f₀ : E →SL[σ₁₂] F` is compact in the topology of
pointwise convergence. Other versions of this theorem can be found in
`Analysis.Normed.Module.WeakDual`. -/
theorem isCompact_image_coe_closedBall [ProperSpace F] (f₀ : E →SL[σ₁₂] F) (r : ℝ) :
IsCompact (((↑) : (E →SL[σ₁₂] F) → E → F) '' closedBall f₀ r) :=
isCompact_image_coe_of_bounded_of_weak_closed isBounded_closedBall <|
is_weak_closed_closedBall f₀ r
end Completeness
end ContinuousLinearMap |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Operator/Banach.lean | import Mathlib.Topology.Baire.Lemmas
import Mathlib.Topology.Baire.CompleteMetrizable
import Mathlib.Analysis.Normed.Operator.NormedSpace
import Mathlib.Analysis.Normed.Group.InfiniteSum
import Mathlib.Analysis.Normed.Group.AddTorsor
/-!
# 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 Function Metric Set Filter Finset Topology NNReal
open LinearMap (range ker)
variable {𝕜 𝕜' : Type*} [NontriviallyNormedField 𝕜] [NontriviallyNormedField 𝕜'] {σ : 𝕜 →+* 𝕜'}
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
/-- The underlying function.
Do NOT use directly. Use the coercion instead. -/
toFun : F → E
/-- The bound `C` so that `‖inverse x‖ ≤ C * ‖x‖` for all `x`. -/
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
variable {σ' : 𝕜' →+* 𝕜} [RingHomInvPair σ σ'] [RingHomIsometric σ] [RingHomIsometric σ']
/-- 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
[RingHomInvPair σ' σ] (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 [RingHomInvPair σ' σ] (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
include σ' in
/-- 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
· simp
· have hc' : 1 < ‖σ c‖ := by simp only [RingHomIsometric.norm_map, hc]
rcases rescale_to_shell hc' (half_pos εpos) hy with ⟨d, hd, ydlt, -, dinv⟩
let δ := ‖d‖ * ‖y‖ / 4
have δpos : 0 < δ := by positivity
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 [x, f.map_sub]
abel
_ ≤ ‖f x₁ - (a + d • y)‖ + ‖f x₂ - a‖ := norm_sub_le _ _
_ ≤ 2 * δ := by grind [dist_eq_norm']
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
_ = 1 / 2 * ‖y‖ := by simpa [δ, field] using by norm_num
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.norm_map, 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]
section
include σ'
/-- 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
| zero => simp only [one_div, one_mul, iterate_zero_apply, pow_zero, le_rfl]
| succ n IH =>
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 simp) (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‖) :=
sNu.tsum_le_tsum ule <| 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
| zero => simp [f.map_zero]
| succ n IH => 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
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)
theorem isQuotientMap (surj : Surjective f) : IsQuotientMap f :=
(f.isOpenMap surj).isQuotientMap f.continuous surj
end
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 -/
section
include σ'
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.1 hsurj)
use {
toFun := fsymm
nnnorm := ⟨C, hC.lt.le⟩
bound' := fun y => (h y).2
right_inv' := fun y => (h y).1 }
exact hC
end
/-- 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] [RingHomInvPair σ' σ]
/-- 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_symm]
rw [← e.coe_coe] at h ⊢
exact ContinuousLinearMap.isOpenMap (σ := σ) ⟨_, 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] [RingHomInvPair σ' σ] {f : E →SL[σ] F}
/-- An injective continuous linear map with a closed range defines a continuous linear equivalence
between its domain and its range. -/
noncomputable def equivRange (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 (hinj : Injective f) (hclo : IsClosed (range f)) :
f.equivRange hinj hclo = f.rangeRestrict :=
rfl
@[simp]
theorem coe_equivRange (hinj : Injective f) (hclo : IsClosed (range f)) :
(f.equivRange hinj hclo : E → LinearMap.range f) = f.rangeRestrict :=
rfl
@[simp]
lemma equivRange_symm_toLinearEquiv (hinj : Injective f) (hclo : IsClosed (range f)) :
(f.equivRange hinj hclo).toLinearEquiv.symm =
(LinearEquiv.ofInjective f.toLinearMap hinj).symm := rfl
@[simp]
lemma equivRange_symm_apply (hinj : Injective f) (hclo : IsClosed (range f))
(x : E) : (f.equivRange hinj hclo).symm ⟨f x, by simp⟩ = x := by
suffices f ((f.equivRange hinj hclo).symm ⟨f x, by simp⟩) = f x from hinj this
trans f ((f.equivRange hinj hclo).symm.toLinearEquiv ⟨f x, by simp⟩)
· rfl -- is there an API lemma for this already?
simp only [ContinuousLinearEquiv.toLinearEquiv_symm, equivRange_symm_toLinearEquiv]
set x' : LinearMap.range f := ⟨f x, by simp⟩
set f' : E →ₛₗ[σ] F := ↑f
change f' ((LinearEquiv.ofInjective f' hinj).symm x') = _
rw [LinearEquiv.ofInjective_symm_apply (f := f') (h := hinj) x']
section
variable {E F : Type*}
[NormedAddCommGroup E] [NormedSpace 𝕜 E] [NormedAddCommGroup F] [NormedSpace 𝕜 F]
[CompleteSpace E] [CompleteSpace F]
-- TODO: once mathlib has Fredholm operators, generalise the next two lemmas accordingly
/-- If `f : E →L[𝕜] F` is injective with closed range (and `E` and `F` are Banach spaces),
`f` is anti-Lipschitz. -/
lemma antilipschitz_of_injective_of_isClosed_range (f : E →L[𝕜] F)
(hf : Injective f) (hf' : IsClosed (Set.range f)) : ∃ K, AntilipschitzWith K f := by
let S : (LinearMap.range f) →L[𝕜] E := (f.equivRange hf hf').symm
use ⟨S.opNorm, S.opNorm_nonneg⟩
apply ContinuousLinearMap.antilipschitz_of_bound
intro x
calc ‖x‖
_ = ‖S ⟨f x, by simp⟩‖ := by simp [S]
_ ≤ S.opNorm * ‖f x‖ := le_opNorm S ⟨f x, by simp⟩
/-- An injective bounded linear operator between Banach spaces has closed range
iff it is anti-Lipschitz. -/
lemma isClosed_range_iff_antilipschitz_of_injective (f : E →L[𝕜] F)
(hf : Injective f) : IsClosed (Set.range f) ↔ ∃ K, AntilipschitzWith K f := by
refine ⟨fun h ↦ f.antilipschitz_of_injective_of_isClosed_range hf h, fun h ↦ ?_⟩
choose K hf' using h
exact hf'.isClosed_range f.uniformContinuous
end
end ContinuousLinearMap
namespace ContinuousLinearEquiv
variable [CompleteSpace E] [RingHomInvPair σ' σ]
/-- 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: `by exact` was not previously needed. Why is it needed now?
(by exact 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
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 {σ : 𝕜 →+* 𝕜'} {σ' : 𝕜' →+* 𝕜} [RingHomInvPair σ σ']
variable {F : Type u_4} [NormedAddCommGroup F] [NormedSpace 𝕜' F]
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
variable [CompleteSpace F]
lemma _root_.AntilipschitzWith.completeSpace_range_clm {f : E →SL[σ] F} {c : ℝ≥0}
(hf : AntilipschitzWith c f) : CompleteSpace (LinearMap.range f) :=
IsClosed.completeSpace_coe (hs := hf.isClosed_range f.uniformContinuous)
variable [RingHomInvPair σ' σ] [RingHomIsometric σ] [RingHomIsometric σ']
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]
end ContinuousLinearMap
end BijectivityCriteria |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Operator/Conformal.lean | import Mathlib.Analysis.Normed.Module.Basic
import Mathlib.Analysis.Normed.Operator.LinearIsometry
import Mathlib.LinearAlgebra.Basis.VectorSpace
/-!
# Conformal Linear Maps
A continuous linear map between `R`-normed spaces `X` and `Y` `IsConformalMap` if it is
a nonzero multiple of a linear isometry.
## Main definitions
* `IsConformalMap`: the main definition of conformal linear maps
## Main results
* The conformality of the composition of two conformal linear maps, the identity map
and multiplications by nonzero constants as continuous linear maps
* `isConformalMap_of_subsingleton`: all continuous linear maps on singleton spaces are conformal
See `Analysis.InnerProductSpace.ConformalLinearMap` for
* `isConformalMap_iff`: a map between inner product spaces is conformal
iff it preserves inner products up to a fixed scalar factor.
## Tags
conformal
## Warning
The definition of conformality in this file does NOT require the maps to be orientation-preserving.
-/
noncomputable section
open Function LinearIsometry ContinuousLinearMap
/-- A continuous linear map `f'` is said to be conformal if it's
a nonzero multiple of a linear isometry. -/
def IsConformalMap {R : Type*} {X Y : Type*} [NormedField R] [SeminormedAddCommGroup X]
[SeminormedAddCommGroup Y] [NormedSpace R X] [NormedSpace R Y] (f' : X →L[R] Y) :=
∃ c ≠ (0 : R), ∃ li : X →ₗᵢ[R] Y, f' = c • li.toContinuousLinearMap
variable {R M N G M' : Type*} [NormedField R] [SeminormedAddCommGroup M] [SeminormedAddCommGroup N]
[SeminormedAddCommGroup G] [NormedSpace R M] [NormedSpace R N] [NormedSpace R G]
[NormedAddCommGroup M'] [NormedSpace R M'] {f : M →L[R] N} {g : N →L[R] G} {c : R}
theorem isConformalMap_id : IsConformalMap (.id R M) :=
⟨1, one_ne_zero, id, by simp⟩
theorem IsConformalMap.smul (hf : IsConformalMap f) {c : R} (hc : c ≠ 0) :
IsConformalMap (c • f) := by
rcases hf with ⟨c', hc', li, rfl⟩
exact ⟨c * c', mul_ne_zero hc hc', li, smul_smul _ _ _⟩
theorem isConformalMap_const_smul (hc : c ≠ 0) : IsConformalMap (c • .id R M) :=
isConformalMap_id.smul hc
protected theorem LinearIsometry.isConformalMap (f' : M →ₗᵢ[R] N) :
IsConformalMap f'.toContinuousLinearMap :=
⟨1, one_ne_zero, f', (one_smul _ _).symm⟩
@[nontriviality]
theorem isConformalMap_of_subsingleton [Subsingleton M] (f' : M →L[R] N) : IsConformalMap f' :=
⟨1, one_ne_zero, ⟨0, fun x => by simp [Subsingleton.elim x 0]⟩, Subsingleton.elim _ _⟩
namespace IsConformalMap
theorem comp (hg : IsConformalMap g) (hf : IsConformalMap f) : IsConformalMap (g.comp f) := by
rcases hf with ⟨cf, hcf, lif, rfl⟩
rcases hg with ⟨cg, hcg, lig, rfl⟩
refine ⟨cg * cf, mul_ne_zero hcg hcf, lig.comp lif, ?_⟩
rw [smul_comp, comp_smul, mul_smul]
rfl
protected theorem injective {f : M' →L[R] N} (h : IsConformalMap f) : Function.Injective f := by
rcases h with ⟨c, hc, li, rfl⟩
exact (smul_right_injective _ hc).comp li.injective
theorem ne_zero [Nontrivial M'] {f' : M' →L[R] N} (hf' : IsConformalMap f') : f' ≠ 0 := by
rintro rfl
rcases exists_ne (0 : M') with ⟨a, ha⟩
exact ha (hf'.injective rfl)
end IsConformalMap |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Operator/NormedSpace.lean | import Mathlib.Analysis.Normed.Module.Span
import Mathlib.Analysis.Normed.Operator.Bilinear
import Mathlib.Analysis.Normed.Operator.NNNorm
/-!
# Operator norm for maps on normed spaces
This file contains statements about operator norm for which it really matters that the
underlying space has a norm (rather than just a seminorm).
-/
suppress_compilation
open Topology
open scoped NNReal
-- the `ₗ` subscript variables are for special cases about linear (as opposed to semilinear) maps
variable {𝕜 𝕜₂ 𝕜₃ E F Fₗ G : Type*}
section Normed
variable [NormedAddCommGroup E] [NormedAddCommGroup F] [NormedAddCommGroup G]
[NormedAddCommGroup Fₗ]
open Metric ContinuousLinearMap
section
variable [NontriviallyNormedField 𝕜] [NontriviallyNormedField 𝕜₂] [NontriviallyNormedField 𝕜₃]
[NormedSpace 𝕜 E] [NormedSpace 𝕜₂ F] [NormedSpace 𝕜₃ G] [NormedSpace 𝕜 Fₗ]
{σ₁₂ : 𝕜 →+* 𝕜₂} {σ₂₃ : 𝕜₂ →+* 𝕜₃} (f : E →SL[σ₁₂] F)
namespace LinearMap
theorem bound_of_shell [RingHomIsometric σ₁₂] (f : E →ₛₗ[σ₁₂] F) {ε C : ℝ} (ε_pos : 0 < ε) {c : 𝕜}
(hc : 1 < ‖c‖) (hf : ∀ x, ε / ‖c‖ ≤ ‖x‖ → ‖x‖ < ε → ‖f x‖ ≤ C * ‖x‖) (x : E) :
‖f x‖ ≤ C * ‖x‖ := by
by_cases hx : x = 0; · simp [hx]
exact SemilinearMapClass.bound_of_shell_semi_normed f ε_pos hc hf (norm_ne_zero_iff.2 hx)
/-- `LinearMap.bound_of_ball_bound'` is a version of this lemma over a field satisfying `RCLike`
that produces a concrete bound.
-/
theorem bound_of_ball_bound {r : ℝ} (r_pos : 0 < r) (c : ℝ) (f : E →ₗ[𝕜] Fₗ)
(h : ∀ z ∈ Metric.ball (0 : E) r, ‖f z‖ ≤ c) : ∃ C, ∀ z : E, ‖f z‖ ≤ C * ‖z‖ := by
obtain ⟨k, hk⟩ := @NontriviallyNormedField.non_trivial 𝕜 _
use c * (‖k‖ / r)
intro z
refine bound_of_shell _ r_pos hk (fun x hko hxo => ?_) _
calc
‖f x‖ ≤ c := h _ (mem_ball_zero_iff.mpr hxo)
_ ≤ c * (‖x‖ * ‖k‖ / r) := le_mul_of_one_le_right ?_ ?_
_ = _ := by ring
· exact le_trans (norm_nonneg _) (h 0 (by simp [r_pos]))
· rw [div_le_iff₀ (zero_lt_one.trans hk)] at hko
exact (one_le_div r_pos).mpr hko
theorem antilipschitz_of_comap_nhds_le [h : RingHomIsometric σ₁₂] (f : E →ₛₗ[σ₁₂] F)
(hf : (𝓝 0).comap f ≤ 𝓝 0) : ∃ K, AntilipschitzWith K f := by
rcases ((nhds_basis_ball.comap _).le_basis_iff nhds_basis_ball).1 hf 1 one_pos with ⟨ε, ε0, hε⟩
simp only [Set.subset_def, Set.mem_preimage, mem_ball_zero_iff] at hε
lift ε to ℝ≥0 using ε0.le
rcases NormedField.exists_one_lt_norm 𝕜 with ⟨c, hc⟩
refine ⟨ε⁻¹ * ‖c‖₊, AddMonoidHomClass.antilipschitz_of_bound f fun x => ?_⟩
by_cases hx : f x = 0
· rw [← hx] at hf
obtain rfl : x = 0 := Specializes.eq (specializes_iff_pure.2 <|
((Filter.tendsto_pure_pure _ _).mono_right (pure_le_nhds _)).le_comap.trans hf)
exact norm_zero.trans_le (mul_nonneg (NNReal.coe_nonneg _) (norm_nonneg _))
have hc₀ : c ≠ 0 := norm_pos_iff.1 (one_pos.trans hc)
rw [← h.1] at hc
rcases rescale_to_shell_zpow hc ε0 hx with ⟨n, -, hlt, -, hle⟩
simp only [← map_zpow₀, h.1, ← map_smulₛₗ] at hlt hle
calc
‖x‖ = ‖c ^ n‖⁻¹ * ‖c ^ n • x‖ := by
rwa [← norm_inv, ← norm_smul, inv_smul_smul₀ (zpow_ne_zero _ _)]
_ ≤ ‖c ^ n‖⁻¹ * 1 := by gcongr; exact (hε _ hlt).le
_ ≤ ε⁻¹ * ‖c‖ * ‖f x‖ := by rwa [mul_one]
end LinearMap
namespace ContinuousLinearMap
section OpNorm
open Set Real
/-- An operator is zero iff its norm vanishes. -/
theorem opNorm_zero_iff [RingHomIsometric σ₁₂] : ‖f‖ = 0 ↔ f = 0 :=
Iff.intro
(fun hn => ContinuousLinearMap.ext fun x => norm_le_zero_iff.1
(calc
_ ≤ ‖f‖ * ‖x‖ := le_opNorm _ _
_ = _ := by rw [hn, zero_mul]))
(by
rintro rfl
exact opNorm_zero)
/-- If a normed space is non-trivial, then the norm of the identity equals `1`. -/
@[simp]
theorem norm_id [Nontrivial E] : ‖ContinuousLinearMap.id 𝕜 E‖ = 1 := by
refine norm_id_of_nontrivial_seminorm ?_
obtain ⟨x, hx⟩ := exists_ne (0 : E)
exact ⟨x, ne_of_gt (norm_pos_iff.2 hx)⟩
@[simp]
lemma nnnorm_id [Nontrivial E] : ‖ContinuousLinearMap.id 𝕜 E‖₊ = 1 := NNReal.eq norm_id
instance normOneClass [Nontrivial E] : NormOneClass (E →L[𝕜] E) :=
⟨norm_id⟩
/-- Continuous linear maps themselves form a normed space with respect to the operator norm. -/
instance toNormedAddCommGroup [RingHomIsometric σ₁₂] : NormedAddCommGroup (E →SL[σ₁₂] F) :=
NormedAddCommGroup.ofSeparation fun f => (opNorm_zero_iff f).mp
/-- Continuous linear maps form a normed ring with respect to the operator norm. -/
instance toNormedRing : NormedRing (E →L[𝕜] E) where
__ := toNormedAddCommGroup
__ := toSeminormedRing
variable {f} in
theorem homothety_norm [RingHomIsometric σ₁₂] [Nontrivial E] (f : E →SL[σ₁₂] F) {a : ℝ}
(hf : ∀ x, ‖f x‖ = a * ‖x‖) : ‖f‖ = a := by
obtain ⟨x, hx⟩ : ∃ x : E, x ≠ 0 := exists_ne 0
rw [← norm_pos_iff] at hx
have ha : 0 ≤ a := by simpa only [hf, hx, mul_nonneg_iff_of_pos_right] using norm_nonneg (f x)
apply le_antisymm (f.opNorm_le_bound ha fun y => le_of_eq (hf y))
simpa only [hf, hx, mul_le_mul_iff_left₀] using f.le_opNorm x
/-- If a continuous linear map is a topology embedding, then it is expands the distances
by a positive factor. -/
theorem antilipschitz_of_isEmbedding (f : E →L[𝕜] Fₗ) (hf : IsEmbedding f) :
∃ K, AntilipschitzWith K f :=
f.toLinearMap.antilipschitz_of_comap_nhds_le <| map_zero f ▸ (hf.nhds_eq_comap 0).ge
end OpNorm
end ContinuousLinearMap
namespace LinearIsometry
@[simp]
theorem norm_toContinuousLinearMap [Nontrivial E] [RingHomIsometric σ₁₂] (f : E →ₛₗᵢ[σ₁₂] F) :
‖f.toContinuousLinearMap‖ = 1 :=
f.toContinuousLinearMap.homothety_norm <| by simp
@[simp]
theorem nnnorm_toContinuousLinearMap [Nontrivial E] [RingHomIsometric σ₁₂] (f : E →ₛₗᵢ[σ₁₂] F) :
‖f.toContinuousLinearMap‖₊ = 1 :=
Subtype.ext f.norm_toContinuousLinearMap
@[simp]
theorem enorm_toContinuousLinearMap [Nontrivial E] [RingHomIsometric σ₁₂] (f : E →ₛₗᵢ[σ₁₂] F) :
‖f.toContinuousLinearMap‖ₑ = 1 :=
congrArg _ f.nnnorm_toContinuousLinearMap
variable {σ₁₃ : 𝕜 →+* 𝕜₃} [RingHomCompTriple σ₁₂ σ₂₃ σ₁₃]
/-- Postcomposition of a continuous linear map with a linear isometry preserves
the operator norm. -/
theorem norm_toContinuousLinearMap_comp [RingHomIsometric σ₁₂] (f : F →ₛₗᵢ[σ₂₃] G)
{g : E →SL[σ₁₂] F} : ‖f.toContinuousLinearMap.comp g‖ = ‖g‖ :=
opNorm_ext (f.toContinuousLinearMap.comp g) g fun x => by
simp only [norm_map, coe_toContinuousLinearMap, coe_comp', Function.comp_apply]
/-- Composing on the left with a linear isometry gives a linear isometry between spaces of
continuous linear maps. -/
def postcomp [RingHomIsometric σ₁₂] [RingHomIsometric σ₁₃] (a : F →ₛₗᵢ[σ₂₃] G) :
(E →SL[σ₁₂] F) →ₛₗᵢ[σ₂₃] (E →SL[σ₁₃] G) where
toFun f := a.toContinuousLinearMap.comp f
map_add' f g := by simp
map_smul' c f := by simp
norm_map' f := by simp [a.norm_toContinuousLinearMap_comp]
end LinearIsometry
end
namespace ContinuousLinearMap
variable [NontriviallyNormedField 𝕜] [NontriviallyNormedField 𝕜₂] [NontriviallyNormedField 𝕜₃]
[NormedSpace 𝕜 E] [NormedSpace 𝕜₂ F] [NormedSpace 𝕜₃ G] [NormedSpace 𝕜 Fₗ]
{σ₂₃ : 𝕜₂ →+* 𝕜₃}
variable {𝕜₂' : Type*} [NontriviallyNormedField 𝕜₂'] {F' : Type*} [NormedAddCommGroup F']
[NormedSpace 𝕜₂' F'] {σ₂' : 𝕜₂' →+* 𝕜₂} {σ₂'' : 𝕜₂ →+* 𝕜₂'} {σ₂₃' : 𝕜₂' →+* 𝕜₃}
[RingHomInvPair σ₂' σ₂''] [RingHomInvPair σ₂'' σ₂'] [RingHomCompTriple σ₂' σ₂₃ σ₂₃']
[RingHomCompTriple σ₂'' σ₂₃' σ₂₃] [RingHomIsometric σ₂₃] [RingHomIsometric σ₂']
[RingHomIsometric σ₂''] [RingHomIsometric σ₂₃']
/-- Precomposition with a linear isometry preserves the operator norm. -/
theorem opNorm_comp_linearIsometryEquiv (f : F →SL[σ₂₃] G) (g : F' ≃ₛₗᵢ[σ₂'] F) :
‖f.comp g.toLinearIsometry.toContinuousLinearMap‖ = ‖f‖ := by
cases subsingleton_or_nontrivial F'
· haveI := g.symm.toLinearEquiv.toEquiv.subsingleton
simp
refine le_antisymm ?_ ?_
· convert f.opNorm_comp_le g.toLinearIsometry.toContinuousLinearMap
simp [g.toLinearIsometry.norm_toContinuousLinearMap]
· convert (f.comp g.toLinearIsometry.toContinuousLinearMap).opNorm_comp_le
g.symm.toLinearIsometry.toContinuousLinearMap
· ext
simp
haveI := g.symm.surjective.nontrivial
simp [g.symm.toLinearIsometry.norm_toContinuousLinearMap]
@[simp]
theorem norm_smulRightL (c : StrongDual 𝕜 E) [Nontrivial Fₗ] : ‖smulRightL 𝕜 E Fₗ c‖ = ‖c‖ :=
ContinuousLinearMap.homothety_norm _ c.norm_smulRight_apply
lemma norm_smulRightL_le : ‖smulRightL 𝕜 E Fₗ‖ ≤ 1 :=
LinearMap.mkContinuous₂_norm_le _ zero_le_one _
end ContinuousLinearMap
namespace Submodule
variable [NontriviallyNormedField 𝕜] [NormedSpace 𝕜 E]
theorem norm_subtypeL (K : Submodule 𝕜 E) [Nontrivial K] : ‖K.subtypeL‖ = 1 :=
K.subtypeₗᵢ.norm_toContinuousLinearMap
end Submodule
namespace ContinuousLinearEquiv
variable [NontriviallyNormedField 𝕜] [NontriviallyNormedField 𝕜₂]
[NormedSpace 𝕜 E] [NormedSpace 𝕜₂ F] {σ₁₂ : 𝕜 →+* 𝕜₂} {σ₂₁ : 𝕜₂ →+* 𝕜} [RingHomInvPair σ₁₂ σ₂₁]
[RingHomInvPair σ₂₁ σ₁₂]
section
variable [RingHomIsometric σ₂₁]
protected theorem antilipschitz (e : E ≃SL[σ₁₂] F) :
AntilipschitzWith ‖(e.symm : F →SL[σ₂₁] E)‖₊ e :=
e.symm.lipschitz.to_rightInverse e.left_inv
theorem one_le_norm_mul_norm_symm [RingHomIsometric σ₁₂] [Nontrivial E] (e : E ≃SL[σ₁₂] F) :
1 ≤ ‖(e : E →SL[σ₁₂] F)‖ * ‖(e.symm : F →SL[σ₂₁] E)‖ := by
rw [mul_comm]
convert (e.symm : F →SL[σ₂₁] E).opNorm_comp_le (e : E →SL[σ₁₂] F)
rw [e.coe_symm_comp_coe, ContinuousLinearMap.norm_id]
theorem norm_pos [RingHomIsometric σ₁₂] [Nontrivial E] (e : E ≃SL[σ₁₂] F) :
0 < ‖(e : E →SL[σ₁₂] F)‖ :=
pos_of_mul_pos_left (lt_of_lt_of_le zero_lt_one e.one_le_norm_mul_norm_symm) (norm_nonneg _)
theorem norm_symm_pos [RingHomIsometric σ₁₂] [Nontrivial E] (e : E ≃SL[σ₁₂] F) :
0 < ‖(e.symm : F →SL[σ₂₁] E)‖ :=
pos_of_mul_pos_right (zero_lt_one.trans_le e.one_le_norm_mul_norm_symm) (norm_nonneg _)
theorem nnnorm_symm_pos [RingHomIsometric σ₁₂] [Nontrivial E] (e : E ≃SL[σ₁₂] F) :
0 < ‖(e.symm : F →SL[σ₂₁] E)‖₊ :=
e.norm_symm_pos
theorem subsingleton_or_norm_symm_pos [RingHomIsometric σ₁₂] (e : E ≃SL[σ₁₂] F) :
Subsingleton E ∨ 0 < ‖(e.symm : F →SL[σ₂₁] E)‖ := by
rcases subsingleton_or_nontrivial E with (_i | _i)
· left
infer_instance
· right
exact e.norm_symm_pos
theorem subsingleton_or_nnnorm_symm_pos [RingHomIsometric σ₁₂] (e : E ≃SL[σ₁₂] F) :
Subsingleton E ∨ 0 < ‖(e.symm : F →SL[σ₂₁] E)‖₊ :=
subsingleton_or_norm_symm_pos e
variable (𝕜)
@[simp]
theorem coord_norm (x : E) (h : x ≠ 0) : ‖coord 𝕜 x h‖ = ‖x‖⁻¹ := by
have hx : 0 < ‖x‖ := norm_pos_iff.mpr h
haveI : Nontrivial (𝕜 ∙ x) := Submodule.nontrivial_span_singleton h
exact ContinuousLinearMap.homothety_norm _ fun y =>
homothety_inverse _ hx _ (LinearEquiv.toSpanNonzeroSingleton_homothety 𝕜 x h) _
end
end ContinuousLinearEquiv
end Normed
/-- A bounded bilinear form `B` in a real normed space is *coercive*
if there is some positive constant C such that `C * ‖u‖ * ‖u‖ ≤ B u u`.
-/
def IsCoercive [NormedAddCommGroup E] [NormedSpace ℝ E] (B : E →L[ℝ] E →L[ℝ] ℝ) : Prop :=
∃ C, 0 < C ∧ ∀ u, C * ‖u‖ * ‖u‖ ≤ B u u
section Equicontinuous
variable {ι : Type*} [NontriviallyNormedField 𝕜] [NontriviallyNormedField 𝕜₂] {σ₁₂ : 𝕜 →+* 𝕜₂}
[RingHomIsometric σ₁₂] [SeminormedAddCommGroup E] [SeminormedAddCommGroup F]
[NormedSpace 𝕜 E] [NormedSpace 𝕜₂ F] (f : ι → E →SL[σ₁₂] F)
/-- Equivalent characterizations for equicontinuity of a family of continuous linear maps
between normed spaces. See also `WithSeminorms.equicontinuous_TFAE` for similar characterizations
between spaces satisfying `WithSeminorms`. -/
protected theorem NormedSpace.equicontinuous_TFAE : List.TFAE
[ EquicontinuousAt ((↑) ∘ f) 0,
Equicontinuous ((↑) ∘ f),
UniformEquicontinuous ((↑) ∘ f),
∃ C, ∀ i x, ‖f i x‖ ≤ C * ‖x‖,
∃ C ≥ 0, ∀ i x, ‖f i x‖ ≤ C * ‖x‖,
∃ C, ∀ i, ‖f i‖ ≤ C,
∃ C ≥ 0, ∀ i, ‖f i‖ ≤ C,
BddAbove (Set.range (‖f ·‖)),
(⨆ i, (‖f i‖₊ : ENNReal)) < ⊤ ] := by
-- `1 ↔ 2 ↔ 3` follows from `uniformEquicontinuous_of_equicontinuousAt_zero`
tfae_have 1 → 3 := uniformEquicontinuous_of_equicontinuousAt_zero f
tfae_have 3 → 2 := UniformEquicontinuous.equicontinuous
tfae_have 2 → 1 := fun H ↦ H 0
-- `4 ↔ 5 ↔ 6 ↔ 7 ↔ 8 ↔ 9` is morally trivial, we just have to use a lot of rewriting
-- and `congr` lemmas
tfae_have 4 ↔ 5 := by
rw [exists_ge_and_iff_exists]
exact fun C₁ C₂ hC ↦ forall₂_imp fun i x ↦ le_trans' <| by gcongr
tfae_have 5 ↔ 7 := by
refine exists_congr (fun C ↦ and_congr_right fun hC ↦ forall_congr' fun i ↦ ?_)
rw [ContinuousLinearMap.opNorm_le_iff hC]
tfae_have 7 ↔ 8 := by
simp_rw [bddAbove_iff_exists_ge (0 : ℝ), Set.forall_mem_range]
tfae_have 6 ↔ 8 := by
simp_rw [bddAbove_def, Set.forall_mem_range]
tfae_have 8 ↔ 9 := by
rw [ENNReal.iSup_coe_lt_top, ← NNReal.bddAbove_coe, ← Set.range_comp]
rfl
-- `3 ↔ 4` is the interesting part of the result. It is essentially a combination of
-- `WithSeminorms.uniformEquicontinuous_iff_exists_continuous_seminorm` which turns
-- equicontinuity into existence of some continuous seminorm and
-- `Seminorm.bound_of_continuous_normedSpace` which characterize such seminorms.
tfae_have 3 ↔ 4 := by
refine ((norm_withSeminorms 𝕜₂ F).uniformEquicontinuous_iff_exists_continuous_seminorm _).trans
?_
rw [forall_const]
constructor
· intro ⟨p, hp, hpf⟩
rcases p.bound_of_continuous_normedSpace hp with ⟨C, -, hC⟩
exact ⟨C, fun i x ↦ (hpf i x).trans (hC x)⟩
· intro ⟨C, hC⟩
refine ⟨C.toNNReal • normSeminorm 𝕜 E,
((norm_withSeminorms 𝕜 E).continuous_seminorm 0).const_smul C.toNNReal, fun i x ↦ ?_⟩
exact (hC i x).trans (mul_le_mul_of_nonneg_right (C.le_coe_toNNReal) (norm_nonneg x))
tfae_finish
end Equicontinuous
section single
variable {ι : Type*} [Fintype ι] [DecidableEq ι]
(𝕜 : Type*) [NontriviallyNormedField 𝕜] (E : ι → Type*)
/-- The injection `x ↦ Pi.single i x` as a linear isometry. -/
protected def LinearIsometry.single [∀ i, SeminormedAddCommGroup (E i)] [∀ i, NormedSpace 𝕜 (E i)]
(i : ι) : E i →ₗᵢ[𝕜] Π j, E j :=
(LinearMap.single 𝕜 E i).toLinearIsometry (.single i)
lemma ContinuousLinearMap.norm_single_le_one [∀ i, SeminormedAddCommGroup (E i)]
[∀ i, NormedSpace 𝕜 (E i)] (i : ι) :
‖ContinuousLinearMap.single 𝕜 E i‖ ≤ 1 :=
(LinearIsometry.single 𝕜 E i).norm_toContinuousLinearMap_le
lemma ContinuousLinearMap.norm_single [∀ i, NormedAddCommGroup (E i)] [∀ i, NormedSpace 𝕜 (E i)]
(i : ι) [Nontrivial (E i)] :
‖ContinuousLinearMap.single 𝕜 E i‖ = 1 :=
(LinearIsometry.single 𝕜 E i).norm_toContinuousLinearMap
end single |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Operator/BanachSteinhaus.lean | import Mathlib.Analysis.Normed.Operator.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
/-- 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 |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Operator/Extend.lean | import Mathlib.Analysis.Normed.Operator.Basic
/-!
# Extension of continuous linear maps on Banach spaces
In this file we provide two different ways to extend a continuous linear map defined on a dense
subspace to the entire Banach space.
* `ContinuousLinearMap.extend`: Extend from a dense subspace using `IsUniformInducing`
* `ContinuousLinearMap.extendOfNorm`: Extend from a continuous linear map that is a dense
injection into the domain and using a norm estimate.
-/
suppress_compilation
open scoped NNReal
variable {𝕜 𝕜₂ E Eₗ F Fₗ : Type*}
namespace ContinuousLinearMap
section Extend
section Ring
variable [AddCommGroup E] [UniformSpace E] [IsUniformAddGroup E]
[AddCommGroup F] [UniformSpace F] [IsUniformAddGroup F] [T0Space F]
[AddCommMonoid Eₗ] [UniformSpace Eₗ] [ContinuousAdd Eₗ]
[Semiring 𝕜] [Semiring 𝕜₂] [Module 𝕜 E] [Module 𝕜₂ F] [Module 𝕜 Eₗ]
[ContinuousConstSMul 𝕜 Eₗ] [ContinuousConstSMul 𝕜₂ F]
{σ₁₂ : 𝕜 →+* 𝕜₂} (f g : E →SL[σ₁₂] F) [CompleteSpace F] (e : E →L[𝕜] Eₗ)
variable (h_dense : DenseRange e) (h_e : IsUniformInducing e)
/-- Extension of a continuous linear map `f : E →SL[σ₁₂] F`, with `E` a normed space and `F` a
complete normed space, along a uniform and dense embedding `e : E →L[𝕜] Eₗ`. -/
def extend : Eₗ →SL[σ₁₂] F :=
-- extension of `f` is continuous
have cont := (uniformContinuous_uniformly_extend h_e h_dense f.uniformContinuous).continuous
-- extension of `f` agrees with `f` on the domain of the embedding `e`
have eq := uniformly_extend_of_ind h_e h_dense f.uniformContinuous
{ toFun := (h_e.isDenseInducing h_dense).extend f
map_add' := by
refine h_dense.induction_on₂ ?_ ?_
· exact isClosed_eq (cont.comp continuous_add)
((cont.comp continuous_fst).add (cont.comp continuous_snd))
· intro x y
simp only [eq, ← e.map_add]
exact f.map_add _ _
map_smul' := fun k => by
refine fun b => h_dense.induction_on b ?_ ?_
· exact isClosed_eq (cont.comp (continuous_const_smul _))
((continuous_const_smul _).comp cont)
· intro x
rw [← map_smul]
simp only [eq]
exact ContinuousLinearMap.map_smulₛₗ _ _ _
cont }
@[simp]
theorem extend_eq (x : E) : extend f e h_dense h_e (e x) = f x :=
IsDenseInducing.extend_eq (h_e.isDenseInducing h_dense) f.cont _
theorem extend_unique (g : Eₗ →SL[σ₁₂] F) (H : g.comp e = f) : extend f e h_dense h_e = g :=
ContinuousLinearMap.coeFn_injective <|
uniformly_extend_unique h_e h_dense (ContinuousLinearMap.ext_iff.1 H) g.continuous
@[simp]
theorem extend_zero : extend (0 : E →SL[σ₁₂] F) e h_dense h_e = 0 :=
extend_unique _ _ _ _ _ (zero_comp _)
end Ring
section NormedField
variable [NontriviallyNormedField 𝕜] [NontriviallyNormedField 𝕜₂] {σ₁₂ : 𝕜 →+* 𝕜₂}
[NormedAddCommGroup E] [NormedAddCommGroup Eₗ] [NormedAddCommGroup F] [NormedAddCommGroup Fₗ]
[NormedSpace 𝕜 E] [NormedSpace 𝕜 Eₗ] [NormedSpace 𝕜₂ F] [NormedSpace 𝕜₂ Fₗ] [CompleteSpace F]
(f g : E →SL[σ₁₂] F) (e : E →L[𝕜] Eₗ)
variable (h_dense : DenseRange e) (h_e : IsUniformInducing e)
variable {N : ℝ≥0} (h_e : ∀ x, ‖x‖ ≤ N * ‖e x‖) [RingHomIsometric σ₁₂]
/-- If a dense embedding `e : E →L[𝕜] G` expands the norm by a constant factor `N⁻¹`, then the
norm of the extension of `f` along `e` is bounded by `N * ‖f‖`. -/
theorem opNorm_extend_le :
‖f.extend e h_dense (isUniformEmbedding_of_bound _ h_e).isUniformInducing‖ ≤ N * ‖f‖ := by
-- Add `opNorm_le_of_dense`?
refine opNorm_le_bound _ ?_ (isClosed_property h_dense (isClosed_le ?_ ?_) fun x ↦ ?_)
· cases le_total 0 N with
| inl hN => exact mul_nonneg hN (norm_nonneg _)
| inr hN =>
have : Unique E := ⟨⟨0⟩, fun x ↦ norm_le_zero_iff.mp <|
(h_e x).trans (mul_nonpos_of_nonpos_of_nonneg hN (norm_nonneg _))⟩
obtain rfl : f = 0 := Subsingleton.elim ..
simp
· exact (cont _).norm
· exact continuous_const.mul continuous_norm
· rw [extend_eq]
calc
‖f x‖ ≤ ‖f‖ * ‖x‖ := le_opNorm _ _
_ ≤ ‖f‖ * (N * ‖e x‖) := mul_le_mul_of_nonneg_left (h_e x) (norm_nonneg _)
_ ≤ N * ‖f‖ * ‖e x‖ := by rw [mul_comm ↑N ‖f‖, mul_assoc]
end NormedField
end Extend
end ContinuousLinearMap |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Operator/BoundedLinearMaps.lean | import Mathlib.Analysis.NormedSpace.Multilinear.Basic
import Mathlib.Analysis.Normed.Ring.Units
import Mathlib.Analysis.Normed.Operator.Mul
/-!
# Bounded linear maps
This file defines a class stating that a map between normed vector spaces is (bi)linear and
continuous.
Instead of asking for continuity, the definition takes the equivalent condition (because the space
is normed) that `‖f x‖` is bounded by a multiple of `‖x‖`. Hence the "bounded" in the name refers to
`‖f x‖/‖x‖` rather than `‖f x‖` itself.
## Main definitions
* `IsBoundedLinearMap`: Class stating that a map `f : E → F` is linear and has `‖f x‖` bounded
by a multiple of `‖x‖`.
* `IsBoundedBilinearMap`: Class stating that a map `f : E × F → G` is bilinear and continuous,
but through the simpler to provide statement that `‖f (x, y)‖` is bounded by a multiple of
`‖x‖ * ‖y‖`
* `IsBoundedBilinearMap.linearDeriv`: Derivative of a continuous bilinear map as a linear map.
* `IsBoundedBilinearMap.deriv`: Derivative of a continuous bilinear map as a continuous linear
map. The proof that it is indeed the derivative is `IsBoundedBilinearMap.hasFDerivAt` in
`Analysis.Calculus.FDeriv`.
## Main theorems
* `IsBoundedBilinearMap.continuous`: A bounded bilinear map is continuous.
* `ContinuousLinearEquiv.isOpen`: The continuous linear equivalences are an open subset of the
set of continuous linear maps between a pair of Banach spaces. Placed in this file because its
proof uses `IsBoundedBilinearMap.continuous`.
## Notes
The main use of this file is `IsBoundedBilinearMap`.
The file `Analysis.NormedSpace.Multilinear.Basic`
already expounds the theory of multilinear maps,
but the `2`-variables case is sufficiently simpler to currently deserve its own treatment.
`IsBoundedLinearMap` is effectively an unbundled version of `ContinuousLinearMap` (defined
in `Topology.Algebra.Module.Basic`, theory over normed spaces developed in
`Analysis.NormedSpace.OperatorNorm`), albeit the name disparity. A bundled
`ContinuousLinearMap` is to be preferred over an `IsBoundedLinearMap` hypothesis. Historical
artifact, really.
-/
noncomputable section
open Topology
open Filter (Tendsto)
open Metric ContinuousLinearMap
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [SeminormedAddCommGroup E]
[NormedSpace 𝕜 E] {F : Type*} [SeminormedAddCommGroup F] [NormedSpace 𝕜 F] {G : Type*}
[SeminormedAddCommGroup G] [NormedSpace 𝕜 G]
/-- A function `f` satisfies `IsBoundedLinearMap 𝕜 f` if it is linear and satisfies the
inequality `‖f x‖ ≤ M * ‖x‖` for some positive constant `M`. -/
structure IsBoundedLinearMap (𝕜 : Type*) [NormedField 𝕜] {E : Type*} [SeminormedAddCommGroup E]
[NormedSpace 𝕜 E] {F : Type*} [SeminormedAddCommGroup F] [NormedSpace 𝕜 F] (f : E → F) : Prop
extends IsLinearMap 𝕜 f where
bound : ∃ M, 0 < M ∧ ∀ x : E, ‖f x‖ ≤ M * ‖x‖
lemma isBoundedLinearMap_iff {f : E → F} :
IsBoundedLinearMap 𝕜 f ↔ IsLinearMap 𝕜 f ∧ ∃ M, 0 < M ∧ ∀ x : E, ‖f x‖ ≤ M * ‖x‖ :=
⟨fun hf ↦ ⟨hf.toIsLinearMap, hf.bound⟩, fun ⟨hl, hm⟩ ↦ ⟨hl, hm⟩⟩
theorem IsLinearMap.with_bound {f : E → F} (hf : IsLinearMap 𝕜 f) (M : ℝ)
(h : ∀ x : E, ‖f x‖ ≤ M * ‖x‖) : IsBoundedLinearMap 𝕜 f :=
⟨hf,
by_cases
(fun (this : M ≤ 0) =>
⟨1, zero_lt_one, fun x =>
(h x).trans <| mul_le_mul_of_nonneg_right (this.trans zero_le_one) (norm_nonneg x)⟩)
fun (this : ¬M ≤ 0) => ⟨M, lt_of_not_ge this, h⟩⟩
/-- A continuous linear map satisfies `IsBoundedLinearMap` -/
theorem ContinuousLinearMap.isBoundedLinearMap (f : E →L[𝕜] F) : IsBoundedLinearMap 𝕜 f :=
{ f.toLinearMap.isLinear with bound := f.bound }
namespace IsBoundedLinearMap
/-- Construct a linear map from a function `f` satisfying `IsBoundedLinearMap 𝕜 f`. -/
def toLinearMap (f : E → F) (h : IsBoundedLinearMap 𝕜 f) : E →ₗ[𝕜] F :=
IsLinearMap.mk' _ h.toIsLinearMap
/-- Construct a continuous linear map from `IsBoundedLinearMap`. -/
def toContinuousLinearMap {f : E → F} (hf : IsBoundedLinearMap 𝕜 f) : E →L[𝕜] F :=
{ toLinearMap f hf with
cont :=
let ⟨C, _, hC⟩ := hf.bound
AddMonoidHomClass.continuous_of_bound (toLinearMap f hf) C hC }
theorem zero : IsBoundedLinearMap 𝕜 fun _ : E => (0 : F) :=
(0 : E →ₗ[𝕜] F).isLinear.with_bound 0 <| by simp [le_refl]
theorem id : IsBoundedLinearMap 𝕜 fun x : E => x :=
LinearMap.id.isLinear.with_bound 1 <| by simp [le_refl]
theorem fst : IsBoundedLinearMap 𝕜 fun x : E × F => x.1 := by
refine (LinearMap.fst 𝕜 E F).isLinear.with_bound 1 fun x => ?_
rw [one_mul]
exact le_max_left _ _
theorem snd : IsBoundedLinearMap 𝕜 fun x : E × F => x.2 := by
refine (LinearMap.snd 𝕜 E F).isLinear.with_bound 1 fun x => ?_
rw [one_mul]
exact le_max_right _ _
variable {f g : E → F}
theorem smul (c : 𝕜) (hf : IsBoundedLinearMap 𝕜 f) : IsBoundedLinearMap 𝕜 (c • f) :=
let ⟨hlf, M, _, hM⟩ := hf
(c • hlf.mk' f).isLinear.with_bound (‖c‖ * M) fun x =>
calc
‖c • f x‖ = ‖c‖ * ‖f x‖ := norm_smul c (f x)
_ ≤ ‖c‖ * (M * ‖x‖) := by grw [hM]
_ = ‖c‖ * M * ‖x‖ := (mul_assoc _ _ _).symm
theorem neg (hf : IsBoundedLinearMap 𝕜 f) : IsBoundedLinearMap 𝕜 fun e => -f e := by
rw [show (fun e => -f e) = fun e => (-1 : 𝕜) • f e by simp]
exact smul (-1) hf
theorem add (hf : IsBoundedLinearMap 𝕜 f) (hg : IsBoundedLinearMap 𝕜 g) :
IsBoundedLinearMap 𝕜 fun e => f e + g e :=
let ⟨hlf, Mf, _, hMf⟩ := hf
let ⟨hlg, Mg, _, hMg⟩ := hg
(hlf.mk' _ + hlg.mk' _).isLinear.with_bound (Mf + Mg) fun x =>
calc
‖f x + g x‖ ≤ Mf * ‖x‖ + Mg * ‖x‖ := norm_add_le_of_le (hMf x) (hMg x)
_ ≤ (Mf + Mg) * ‖x‖ := by rw [add_mul]
theorem sub (hf : IsBoundedLinearMap 𝕜 f) (hg : IsBoundedLinearMap 𝕜 g) :
IsBoundedLinearMap 𝕜 fun e => f e - g e := by simpa [sub_eq_add_neg] using add hf (neg hg)
theorem comp {g : F → G} (hg : IsBoundedLinearMap 𝕜 g) (hf : IsBoundedLinearMap 𝕜 f) :
IsBoundedLinearMap 𝕜 (g ∘ f) :=
(hg.toContinuousLinearMap.comp hf.toContinuousLinearMap).isBoundedLinearMap
protected theorem tendsto (x : E) (hf : IsBoundedLinearMap 𝕜 f) : Tendsto f (𝓝 x) (𝓝 (f x)) :=
let ⟨hf, M, _, hM⟩ := hf
tendsto_iff_norm_sub_tendsto_zero.2 <|
squeeze_zero (fun _ => norm_nonneg _)
(fun e =>
calc
‖f e - f x‖ = ‖hf.mk' f (e - x)‖ := by rw [(hf.mk' _).map_sub e x]; rfl
_ ≤ M * ‖e - x‖ := hM (e - x)
)
(suffices Tendsto (fun e : E => M * ‖e - x‖) (𝓝 x) (𝓝 (M * 0)) by simpa
tendsto_const_nhds.mul (tendsto_norm_sub_self _))
theorem continuous (hf : IsBoundedLinearMap 𝕜 f) : Continuous f :=
continuous_iff_continuousAt.2 fun _ => hf.tendsto _
/-- A map between normed spaces is linear and continuous if and only if it is bounded. -/
theorem isLinearMap_and_continuous_iff_isBoundedLinearMap (f : E → F) :
IsLinearMap 𝕜 f ∧ Continuous f ↔ IsBoundedLinearMap 𝕜 f :=
⟨fun ⟨hlin, hcont⟩ ↦ ContinuousLinearMap.isBoundedLinearMap
⟨⟨⟨f, IsLinearMap.map_add hlin⟩, IsLinearMap.map_smul hlin⟩, hcont⟩,
fun h_bdd ↦ ⟨h_bdd.toIsLinearMap, h_bdd.continuous⟩⟩
theorem lim_zero_bounded_linear_map (hf : IsBoundedLinearMap 𝕜 f) : Tendsto f (𝓝 0) (𝓝 0) :=
(hf.1.mk' _).map_zero ▸ continuous_iff_continuousAt.1 hf.continuous 0
section
open Asymptotics Filter
theorem isBigO_id {f : E → F} (h : IsBoundedLinearMap 𝕜 f) (l : Filter E) : f =O[l] fun x => x :=
let ⟨_, _, hM⟩ := h.bound
IsBigO.of_bound _ (mem_of_superset univ_mem fun x _ => hM x)
theorem isBigO_comp {E : Type*} {g : F → G} (hg : IsBoundedLinearMap 𝕜 g) {f : E → F}
(l : Filter E) : (fun x' => g (f x')) =O[l] f :=
(hg.isBigO_id ⊤).comp_tendsto le_top
theorem isBigO_sub {f : E → F} (h : IsBoundedLinearMap 𝕜 f) (l : Filter E) (x : E) :
(fun x' => f (x' - x)) =O[l] fun x' => x' - x :=
isBigO_comp h l
end
end IsBoundedLinearMap
section
variable {ι : Type*} [Fintype ι]
/-- Taking the Cartesian product of two continuous multilinear maps is a bounded linear
operation. -/
theorem isBoundedLinearMap_prod_multilinear {E : ι → Type*} [∀ i, SeminormedAddCommGroup (E i)]
[∀ i, NormedSpace 𝕜 (E i)] :
IsBoundedLinearMap 𝕜 fun p : ContinuousMultilinearMap 𝕜 E F × ContinuousMultilinearMap 𝕜 E G =>
p.1.prod p.2 :=
(ContinuousMultilinearMap.prodL 𝕜 E F G).toContinuousLinearEquiv
|>.toContinuousLinearMap.isBoundedLinearMap
/-- Given a fixed continuous linear map `g`, associating to a continuous multilinear map `f` the
continuous multilinear map `f (g m₁, ..., g mₙ)` is a bounded linear operation. -/
theorem isBoundedLinearMap_continuousMultilinearMap_comp_linear (g : G →L[𝕜] E) :
IsBoundedLinearMap 𝕜 fun f : ContinuousMultilinearMap 𝕜 (fun _ : ι => E) F =>
f.compContinuousLinearMap fun _ => g :=
(ContinuousMultilinearMap.compContinuousLinearMapL (ι := ι) (G := F) (fun _ ↦ g))
|>.isBoundedLinearMap
end
section BilinearMap
namespace ContinuousLinearMap
/-! We prove some computation rules for continuous (semi-)bilinear maps in their first argument.
If `f` is a continuous bilinear map, to use the corresponding rules for the second argument, use
`(f _).map_add` and similar.
We have to assume that `F` and `G` are normed spaces in this section, to use
`ContinuousLinearMap.toNormedAddCommGroup`, but we don't need to assume this for the first
argument of `f`.
-/
variable {R : Type*}
variable {𝕜₂ 𝕜' : Type*} [NontriviallyNormedField 𝕜'] [NontriviallyNormedField 𝕜₂]
variable {M : Type*} [TopologicalSpace M]
variable {σ₁₂ : 𝕜 →+* 𝕜₂}
variable {G' : Type*} [SeminormedAddCommGroup G'] [NormedSpace 𝕜₂ G'] [NormedSpace 𝕜' G']
variable [SMulCommClass 𝕜₂ 𝕜' G']
section Semiring
variable [Semiring R] [AddCommMonoid M] [Module R M] {ρ₁₂ : R →+* 𝕜'}
theorem map_add₂ (f : M →SL[ρ₁₂] F →SL[σ₁₂] G') (x x' : M) (y : F) :
f (x + x') y = f x y + f x' y := by rw [f.map_add, add_apply]
theorem map_zero₂ (f : M →SL[ρ₁₂] F →SL[σ₁₂] G') (y : F) : f 0 y = 0 := by
rw [f.map_zero, zero_apply]
theorem map_smulₛₗ₂ (f : M →SL[ρ₁₂] F →SL[σ₁₂] G') (c : R) (x : M) (y : F) :
f (c • x) y = ρ₁₂ c • f x y := by rw [f.map_smulₛₗ, smul_apply]
end Semiring
section Ring
variable [Ring R] [AddCommGroup M] [Module R M] {ρ₁₂ : R →+* 𝕜'}
theorem map_sub₂ (f : M →SL[ρ₁₂] F →SL[σ₁₂] G') (x x' : M) (y : F) :
f (x - x') y = f x y - f x' y := by rw [f.map_sub, sub_apply]
theorem map_neg₂ (f : M →SL[ρ₁₂] F →SL[σ₁₂] G') (x : M) (y : F) : f (-x) y = -f x y := by
rw [f.map_neg, neg_apply]
end Ring
theorem map_smul₂ (f : E →L[𝕜] F →L[𝕜] G) (c : 𝕜) (x : E) (y : F) : f (c • x) y = c • f x y := by
rw [f.map_smul, smul_apply]
end ContinuousLinearMap
variable (𝕜) in
/-- A map `f : E × F → G` satisfies `IsBoundedBilinearMap 𝕜 f` if it is bilinear and
continuous. -/
structure IsBoundedBilinearMap (f : E × F → G) : Prop where
add_left : ∀ (x₁ x₂ : E) (y : F), f (x₁ + x₂, y) = f (x₁, y) + f (x₂, y)
smul_left : ∀ (c : 𝕜) (x : E) (y : F), f (c • x, y) = c • f (x, y)
add_right : ∀ (x : E) (y₁ y₂ : F), f (x, y₁ + y₂) = f (x, y₁) + f (x, y₂)
smul_right : ∀ (c : 𝕜) (x : E) (y : F), f (x, c • y) = c • f (x, y)
bound : ∃ C > 0, ∀ (x : E) (y : F), ‖f (x, y)‖ ≤ C * ‖x‖ * ‖y‖
variable {f : E × F → G}
lemma IsBoundedBilinearMap.symm (h : IsBoundedBilinearMap 𝕜 f) :
IsBoundedBilinearMap 𝕜 (fun p ↦ f (p.2, p.1)) where
add_left x₁ x₂ y := h.add_right _ _ _
smul_left c x y := h.smul_right _ _ _
add_right x y₁ y₂ := h.add_left _ _ _
smul_right c x y := h.smul_left _ _ _
bound := by
obtain ⟨C, hC_pos, hC⟩ := h.bound
exact ⟨C, hC_pos, fun x y ↦ (hC y x).trans_eq (by ring)⟩
theorem ContinuousLinearMap.isBoundedBilinearMap (f : E →L[𝕜] F →L[𝕜] G) :
IsBoundedBilinearMap 𝕜 fun x : E × F => f x.1 x.2 :=
{ add_left := f.map_add₂
smul_left := f.map_smul₂
add_right := fun x => (f x).map_add
smul_right := fun c x => (f x).map_smul c
bound :=
⟨max ‖f‖ 1, zero_lt_one.trans_le (le_max_right _ _), fun x y =>
(f.le_opNorm₂ x y).trans <| by
apply_rules [mul_le_mul_of_nonneg_right, norm_nonneg, le_max_left] ⟩ }
/-- A bounded bilinear map `f : E × F → G` defines a continuous linear map
`f : E →L[𝕜] F →L[𝕜] G`. -/
def IsBoundedBilinearMap.toContinuousLinearMap (hf : IsBoundedBilinearMap 𝕜 f) :
E →L[𝕜] F →L[𝕜] G :=
LinearMap.mkContinuousOfExistsBound₂
(LinearMap.mk₂ _ f.curry hf.add_left hf.smul_left hf.add_right hf.smul_right) <|
hf.bound.imp fun _ ↦ And.right
@[simp]
lemma IsBoundedBilinearMap.toContinuousLinearMap_apply (hf : IsBoundedBilinearMap 𝕜 f)
(x : E) (y : F) : hf.toContinuousLinearMap x y = f (x, y) := rfl
protected theorem IsBoundedBilinearMap.isBigO (h : IsBoundedBilinearMap 𝕜 f) :
f =O[⊤] fun p : E × F => ‖p.1‖ * ‖p.2‖ :=
let ⟨C, _, hC⟩ := h.bound
Asymptotics.IsBigO.of_bound C <|
Filter.Eventually.of_forall fun ⟨x, y⟩ => by simpa [mul_assoc] using hC x y
theorem IsBoundedBilinearMap.isBigO_comp {α : Type*} (H : IsBoundedBilinearMap 𝕜 f) {g : α → E}
{h : α → F} {l : Filter α} : (fun x => f (g x, h x)) =O[l] fun x => ‖g x‖ * ‖h x‖ :=
H.isBigO.comp_tendsto le_top
protected theorem IsBoundedBilinearMap.isBigO' (h : IsBoundedBilinearMap 𝕜 f) :
f =O[⊤] fun p : E × F => ‖p‖ * ‖p‖ :=
h.isBigO.trans <|
(@Asymptotics.isBigO_fst_prod' _ E F _ _ _ _).norm_norm.mul
(@Asymptotics.isBigO_snd_prod' _ E F _ _ _ _).norm_norm
theorem IsBoundedBilinearMap.map_sub_left (h : IsBoundedBilinearMap 𝕜 f) {x y : E} {z : F} :
f (x - y, z) = f (x, z) - f (y, z) :=
(h.toContinuousLinearMap.flip z).map_sub x y
theorem IsBoundedBilinearMap.map_sub_right (h : IsBoundedBilinearMap 𝕜 f) {x : E} {y z : F} :
f (x, y - z) = f (x, y) - f (x, z) :=
(h.toContinuousLinearMap x).map_sub y z
open Asymptotics in
/-- Useful to use together with `Continuous.comp₂`. -/
theorem IsBoundedBilinearMap.continuous (h : IsBoundedBilinearMap 𝕜 f) : Continuous f := by
refine continuous_iff_continuousAt.2 fun x ↦ tendsto_sub_nhds_zero_iff.1 ?_
suffices Tendsto (fun y : E × F ↦ f (y.1 - x.1, y.2) + f (x.1, y.2 - x.2)) (𝓝 x) (𝓝 (0 + 0)) by
simpa only [h.map_sub_left, h.map_sub_right, sub_add_sub_cancel, zero_add] using this
apply Tendsto.add
· rw [← isLittleO_one_iff ℝ, ← one_mul 1]
refine h.isBigO_comp.trans_isLittleO ?_
refine (IsLittleO.norm_left ?_).mul_isBigO (IsBigO.norm_left ?_)
· exact (isLittleO_one_iff _).2 (tendsto_sub_nhds_zero_iff.2 (continuous_fst.tendsto _))
· exact (continuous_snd.tendsto _).isBigO_one ℝ
· refine Continuous.tendsto' ?_ _ _ (by rw [h.map_sub_right, sub_self])
exact ((h.toContinuousLinearMap x.1).continuous).comp (continuous_snd.sub continuous_const)
theorem IsBoundedBilinearMap.continuous_left (h : IsBoundedBilinearMap 𝕜 f) {e₂ : F} :
Continuous fun e₁ => f (e₁, e₂) :=
h.continuous.comp (continuous_id.prodMk continuous_const)
theorem IsBoundedBilinearMap.continuous_right (h : IsBoundedBilinearMap 𝕜 f) {e₁ : E} :
Continuous fun e₂ => f (e₁, e₂) :=
h.continuous.comp (continuous_const.prodMk continuous_id)
/-- Useful to use together with `Continuous.comp₂`. -/
theorem ContinuousLinearMap.continuous₂ (f : E →L[𝕜] F →L[𝕜] G) :
Continuous (Function.uncurry fun x y => f x y) :=
f.isBoundedBilinearMap.continuous
theorem IsBoundedBilinearMap.isBoundedLinearMap_left (h : IsBoundedBilinearMap 𝕜 f) (y : F) :
IsBoundedLinearMap 𝕜 fun x => f (x, y) :=
(h.toContinuousLinearMap.flip y).isBoundedLinearMap
theorem IsBoundedBilinearMap.isBoundedLinearMap_right (h : IsBoundedBilinearMap 𝕜 f) (x : E) :
IsBoundedLinearMap 𝕜 fun y => f (x, y) :=
(h.toContinuousLinearMap x).isBoundedLinearMap
theorem isBoundedBilinearMap_smul {𝕜' : Type*} [NormedField 𝕜'] [NormedAlgebra 𝕜 𝕜'] {E : Type*}
[SeminormedAddCommGroup E] [NormedSpace 𝕜 E] [NormedSpace 𝕜' E] [IsScalarTower 𝕜 𝕜' E] :
IsBoundedBilinearMap 𝕜 fun p : 𝕜' × E => p.1 • p.2 :=
(lsmul 𝕜 𝕜' : 𝕜' →L[𝕜] E →L[𝕜] E).isBoundedBilinearMap
theorem isBoundedBilinearMap_mul : IsBoundedBilinearMap 𝕜 fun p : 𝕜 × 𝕜 => p.1 * p.2 := by
simp_rw [← smul_eq_mul]
exact isBoundedBilinearMap_smul
theorem isBoundedBilinearMap_comp :
IsBoundedBilinearMap 𝕜 fun p : (F →L[𝕜] G) × (E →L[𝕜] F) => p.1.comp p.2 :=
(compL 𝕜 E F G).isBoundedBilinearMap
theorem ContinuousLinearMap.isBoundedLinearMap_comp_left (g : F →L[𝕜] G) :
IsBoundedLinearMap 𝕜 fun f : E →L[𝕜] F => ContinuousLinearMap.comp g f :=
isBoundedBilinearMap_comp.isBoundedLinearMap_right _
theorem ContinuousLinearMap.isBoundedLinearMap_comp_right (f : E →L[𝕜] F) :
IsBoundedLinearMap 𝕜 fun g : F →L[𝕜] G => ContinuousLinearMap.comp g f :=
isBoundedBilinearMap_comp.isBoundedLinearMap_left _
theorem isBoundedBilinearMap_apply : IsBoundedBilinearMap 𝕜 fun p : (E →L[𝕜] F) × E => p.1 p.2 :=
(ContinuousLinearMap.flip (apply 𝕜 F : E →L[𝕜] (E →L[𝕜] F) →L[𝕜] F)).isBoundedBilinearMap
/-- The function `ContinuousLinearMap.smulRight`, associating to a continuous linear map
`f : E → 𝕜` and a scalar `c : F` the tensor product `f ⊗ c` as a continuous linear map from `E` to
`F`, is a bounded bilinear map. -/
theorem isBoundedBilinearMap_smulRight :
IsBoundedBilinearMap 𝕜 fun p =>
(ContinuousLinearMap.smulRight : StrongDual 𝕜 E → F → E →L[𝕜] F) p.1 p.2 :=
(smulRightL 𝕜 E F).isBoundedBilinearMap
/-- The composition of a continuous linear map with a continuous multilinear map is a bounded
bilinear operation. -/
theorem isBoundedBilinearMap_compMultilinear {ι : Type*} {E : ι → Type*} [Fintype ι]
[∀ i, NormedAddCommGroup (E i)] [∀ i, NormedSpace 𝕜 (E i)] :
IsBoundedBilinearMap 𝕜 fun p : (F →L[𝕜] G) × ContinuousMultilinearMap 𝕜 E F =>
p.1.compContinuousMultilinearMap p.2 :=
(compContinuousMultilinearMapL 𝕜 E F G).isBoundedBilinearMap
/-- Definition of the derivative of a bilinear map `f`, given at a point `p` by
`q ↦ f(p.1, q.2) + f(q.1, p.2)` as in the standard formula for the derivative of a product.
We define this function here as a linear map `E × F →ₗ[𝕜] G`, then `IsBoundedBilinearMap.deriv`
strengthens it to a continuous linear map `E × F →L[𝕜] G`.
-/
def IsBoundedBilinearMap.linearDeriv (h : IsBoundedBilinearMap 𝕜 f) (p : E × F) : E × F →ₗ[𝕜] G :=
(h.toContinuousLinearMap.deriv₂ p).toLinearMap
/-- The derivative of a bounded bilinear map at a point `p : E × F`, as a continuous linear map
from `E × F` to `G`. The statement that this is indeed the derivative of `f` is
`IsBoundedBilinearMap.hasFDerivAt` in `Analysis.Calculus.FDeriv`. -/
def IsBoundedBilinearMap.deriv (h : IsBoundedBilinearMap 𝕜 f) (p : E × F) : E × F →L[𝕜] G :=
h.toContinuousLinearMap.deriv₂ p
@[simp]
theorem IsBoundedBilinearMap.deriv_apply (h : IsBoundedBilinearMap 𝕜 f) (p q : E × F) :
h.deriv p q = f (p.1, q.2) + f (q.1, p.2) :=
rfl
variable (𝕜) in
/-- The function `ContinuousLinearMap.mulLeftRight : 𝕜' × 𝕜' → (𝕜' →L[𝕜] 𝕜')` is a bounded
bilinear map. -/
theorem ContinuousLinearMap.mulLeftRight_isBoundedBilinear (𝕜' : Type*) [SeminormedRing 𝕜']
[NormedAlgebra 𝕜 𝕜'] :
IsBoundedBilinearMap 𝕜 fun p : 𝕜' × 𝕜' => ContinuousLinearMap.mulLeftRight 𝕜 𝕜' p.1 p.2 :=
(ContinuousLinearMap.mulLeftRight 𝕜 𝕜').isBoundedBilinearMap
/-- Given a bounded bilinear map `f`, the map associating to a point `p` the derivative of `f` at
`p` is itself a bounded linear map. -/
theorem IsBoundedBilinearMap.isBoundedLinearMap_deriv (h : IsBoundedBilinearMap 𝕜 f) :
IsBoundedLinearMap 𝕜 fun p : E × F => h.deriv p :=
h.toContinuousLinearMap.deriv₂.isBoundedLinearMap
end BilinearMap
variable {X : Type*} [TopologicalSpace X]
@[continuity, fun_prop]
theorem Continuous.clm_comp {g : X → F →L[𝕜] G} {f : X → E →L[𝕜] F}
(hg : Continuous g) (hf : Continuous f) : Continuous fun x => (g x).comp (f x) :=
(compL 𝕜 E F G).continuous₂.comp₂ hg hf
theorem ContinuousOn.clm_comp {g : X → F →L[𝕜] G} {f : X → E →L[𝕜] F}
{s : Set X} (hg : ContinuousOn g s) (hf : ContinuousOn f s) :
ContinuousOn (fun x => (g x).comp (f x)) s :=
(compL 𝕜 E F G).continuous₂.comp_continuousOn (hg.prodMk hf)
@[continuity, fun_prop]
theorem Continuous.clm_apply {f : X → E →L[𝕜] F} {g : X → E}
(hf : Continuous f) (hg : Continuous g) : Continuous (fun x ↦ f x (g x)) :=
isBoundedBilinearMap_apply.continuous.comp₂ hf hg
theorem ContinuousOn.clm_apply {f : X → E →L[𝕜] F} {g : X → E}
{s : Set X} (hf : ContinuousOn f s) (hg : ContinuousOn g s) :
ContinuousOn (fun x ↦ f x (g x)) s :=
isBoundedBilinearMap_apply.continuous.comp_continuousOn (hf.prodMk hg)
@[continuity, fun_prop]
theorem ContinuousAt.clm_apply {X} [TopologicalSpace X] {f : X → E →L[𝕜] F} {g : X → E} {x : X}
(hf : ContinuousAt f x) (hg : ContinuousAt g x) : ContinuousAt (fun x ↦ f x (g x)) x :=
isBoundedBilinearMap_apply.continuous.continuousAt.comp₂ hf hg
@[continuity, fun_prop]
theorem ContinuousWithinAt.clm_apply {X} [TopologicalSpace X] {f : X → E →L[𝕜] F} {g : X → E}
{s : Set X} {x : X} (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) :
ContinuousWithinAt (fun x ↦ f x (g x)) s x :=
isBoundedBilinearMap_apply.continuous.continuousAt.comp_continuousWithinAt (hf.prodMk hg)
theorem ContinuousOn.continuousLinearMapCoprod
{f : X → E →L[𝕜] G} {g : X → F →L[𝕜] G} {s : Set X}
(hf : ContinuousOn f s) (hg : ContinuousOn g s) :
ContinuousOn (fun x => (f x).coprod (g x)) s := by
simp only [← comp_fst_add_comp_snd]
exact (hf.clm_comp continuousOn_const).add (hg.clm_comp continuousOn_const)
theorem Continuous.continuousLinearMapCoprod
{f : X → E →L[𝕜] G} {g : X → F →L[𝕜] G}
(hf : Continuous f) (hg : Continuous g) :
Continuous (fun x => (f x).coprod (g x)) := by
apply continuousOn_univ.mp
exact hf.continuousOn.continuousLinearMapCoprod hg.continuousOn
end
namespace ContinuousLinearEquiv
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜]
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E]
variable {F : Type*} [SeminormedAddCommGroup F] [NormedSpace 𝕜 F]
open Set
open scoped Topology
/-!
### The set of continuous linear equivalences between two Banach spaces is open
In this section we establish that the set of continuous linear equivalences between two Banach
spaces is an open subset of the space of linear maps between them.
-/
protected theorem isOpen [CompleteSpace E] : IsOpen (range ((↑) : (E ≃L[𝕜] F) → E →L[𝕜] F)) := by
rw [isOpen_iff_mem_nhds, forall_mem_range]
refine fun e => IsOpen.mem_nhds ?_ (mem_range_self _)
let O : (E →L[𝕜] F) → E →L[𝕜] E := fun f => (e.symm : F →L[𝕜] E).comp f
have h_O : Continuous O := isBoundedBilinearMap_comp.continuous_right
convert show IsOpen (O ⁻¹' { x | IsUnit x }) from Units.isOpen.preimage h_O using 1
ext f'
constructor
· rintro ⟨e', rfl⟩
exact ⟨(e'.trans e.symm).toUnit, rfl⟩
· rintro ⟨w, hw⟩
use (unitsEquiv 𝕜 E w).trans e
ext x
simp [O, hw]
protected theorem nhds [CompleteSpace E] (e : E ≃L[𝕜] F) :
range ((↑) : (E ≃L[𝕜] F) → E →L[𝕜] F) ∈ 𝓝 (e : E →L[𝕜] F) :=
IsOpen.mem_nhds ContinuousLinearEquiv.isOpen (by simp)
end ContinuousLinearEquiv |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Operator/LinearIsometry.lean | import Mathlib.Algebra.Star.Basic
import Mathlib.Analysis.Normed.Group.Constructions
import Mathlib.Analysis.Normed.Group.Submodule
import Mathlib.Analysis.Normed.Group.Uniform
import Mathlib.LinearAlgebra.Basis.Defs
import Mathlib.LinearAlgebra.DFinsupp
import Mathlib.Topology.Algebra.Module.Equiv
/-!
# (Semi-)linear isometries
In this file we define `LinearIsometry σ₁₂ E E₂` (notation: `E →ₛₗᵢ[σ₁₂] E₂`) to be a semilinear
isometric embedding of `E` into `E₂` and `LinearIsometryEquiv` (notation: `E ≃ₛₗᵢ[σ₁₂] E₂`) to be
a semilinear isometric equivalence between `E` and `E₂`. The notation for the associated purely
linear concepts is `E →ₗᵢ[R] E₂`, `E ≃ₗᵢ[R] E₂`, and `E →ₗᵢ⋆[R] E₂`, `E ≃ₗᵢ⋆[R] E₂` for
the star-linear versions.
We also prove some trivial lemmas and provide convenience constructors.
Since a lot of elementary properties don't require `‖x‖ = 0 → x = 0` we start setting up the
theory for `SeminormedAddCommGroup` and we specialize to `NormedAddCommGroup` when needed.
-/
open Function Set Topology
variable {R R₂ R₃ R₄ E E₂ E₃ E₄ F 𝓕 : Type*} [Semiring R] [Semiring R₂] [Semiring R₃] [Semiring R₄]
{σ₁₂ : R →+* R₂} {σ₂₁ : R₂ →+* R} {σ₁₃ : R →+* R₃} {σ₃₁ : R₃ →+* R} {σ₁₄ : R →+* R₄}
{σ₄₁ : R₄ →+* R} {σ₂₃ : R₂ →+* R₃} {σ₃₂ : R₃ →+* R₂} {σ₂₄ : R₂ →+* R₄} {σ₄₂ : R₄ →+* R₂}
{σ₃₄ : R₃ →+* R₄} {σ₄₃ : R₄ →+* R₃} [RingHomInvPair σ₁₂ σ₂₁] [RingHomInvPair σ₂₁ σ₁₂]
[RingHomInvPair σ₁₃ σ₃₁] [RingHomInvPair σ₃₁ σ₁₃] [RingHomInvPair σ₂₃ σ₃₂]
[RingHomInvPair σ₃₂ σ₂₃] [RingHomInvPair σ₁₄ σ₄₁] [RingHomInvPair σ₄₁ σ₁₄]
[RingHomInvPair σ₂₄ σ₄₂] [RingHomInvPair σ₄₂ σ₂₄] [RingHomInvPair σ₃₄ σ₄₃]
[RingHomInvPair σ₄₃ σ₃₄] [RingHomCompTriple σ₁₂ σ₂₃ σ₁₃] [RingHomCompTriple σ₁₂ σ₂₄ σ₁₄]
[RingHomCompTriple σ₂₃ σ₃₄ σ₂₄] [RingHomCompTriple σ₁₃ σ₃₄ σ₁₄] [RingHomCompTriple σ₃₂ σ₂₁ σ₃₁]
[RingHomCompTriple σ₄₂ σ₂₁ σ₄₁] [RingHomCompTriple σ₄₃ σ₃₂ σ₄₂] [RingHomCompTriple σ₄₃ σ₃₁ σ₄₁]
[SeminormedAddCommGroup E] [SeminormedAddCommGroup E₂] [SeminormedAddCommGroup E₃]
[SeminormedAddCommGroup E₄] [Module R E] [Module R₂ E₂] [Module R₃ E₃] [Module R₄ E₄]
[NormedAddCommGroup F] [Module R F]
/-- A `σ₁₂`-semilinear isometric embedding of a normed `R`-module into an `R₂`-module,
denoted as `f : E →ₛₗᵢ[σ₁₂] E₂`. -/
structure LinearIsometry (σ₁₂ : R →+* R₂) (E E₂ : Type*) [SeminormedAddCommGroup E]
[SeminormedAddCommGroup E₂] [Module R E] [Module R₂ E₂] extends E →ₛₗ[σ₁₂] E₂ where
norm_map' : ∀ x, ‖toLinearMap x‖ = ‖x‖
@[inherit_doc]
notation:25 E " →ₛₗᵢ[" σ₁₂:25 "] " E₂:0 => LinearIsometry σ₁₂ E E₂
/-- A linear isometric embedding of a normed `R`-module into another one. -/
notation:25 E " →ₗᵢ[" R:25 "] " E₂:0 => LinearIsometry (RingHom.id R) E E₂
/-- An antilinear isometric embedding of a normed `R`-module into another one. -/
notation:25 E " →ₗᵢ⋆[" R:25 "] " E₂:0 => LinearIsometry (starRingEnd R) E E₂
/-- `SemilinearIsometryClass F σ E E₂` asserts `F` is a type of bundled `σ`-semilinear isometries
`E → E₂`.
See also `LinearIsometryClass F R E E₂` for the case where `σ` is the identity map on `R`.
A map `f` between an `R`-module and an `S`-module over a ring homomorphism `σ : R →+* S`
is semilinear if it satisfies the two properties `f (x + y) = f x + f y` and
`f (c • x) = (σ c) • f x`. -/
class SemilinearIsometryClass (𝓕 : Type*) {R R₂ : outParam Type*} [Semiring R] [Semiring R₂]
(σ₁₂ : outParam <| R →+* R₂) (E E₂ : outParam Type*) [SeminormedAddCommGroup E]
[SeminormedAddCommGroup E₂] [Module R E] [Module R₂ E₂] [FunLike 𝓕 E E₂] : Prop
extends SemilinearMapClass 𝓕 σ₁₂ E E₂ where
norm_map : ∀ (f : 𝓕) (x : E), ‖f x‖ = ‖x‖
/-- `LinearIsometryClass F R E E₂` asserts `F` is a type of bundled `R`-linear isometries
`M → M₂`.
This is an abbreviation for `SemilinearIsometryClass F (RingHom.id R) E E₂`.
-/
abbrev LinearIsometryClass (𝓕 : Type*) (R E E₂ : outParam Type*) [Semiring R]
[SeminormedAddCommGroup E] [SeminormedAddCommGroup E₂] [Module R E] [Module R E₂]
[FunLike 𝓕 E E₂] :=
SemilinearIsometryClass 𝓕 (RingHom.id R) E E₂
namespace SemilinearIsometryClass
variable [FunLike 𝓕 E E₂]
protected theorem isometry [SemilinearIsometryClass 𝓕 σ₁₂ E E₂] (f : 𝓕) : Isometry f :=
AddMonoidHomClass.isometry_of_norm _ (norm_map _)
@[continuity]
protected theorem continuous [SemilinearIsometryClass 𝓕 σ₁₂ E E₂] (f : 𝓕) : Continuous f :=
(SemilinearIsometryClass.isometry f).continuous
-- Should be `@[simp]` but it doesn't fire due to https://github.com/leanprover/lean4/issues/3107.
theorem nnnorm_map [SemilinearIsometryClass 𝓕 σ₁₂ E E₂] (f : 𝓕) (x : E) : ‖f x‖₊ = ‖x‖₊ :=
NNReal.eq <| norm_map f x
protected theorem lipschitz [SemilinearIsometryClass 𝓕 σ₁₂ E E₂] (f : 𝓕) : LipschitzWith 1 f :=
(SemilinearIsometryClass.isometry f).lipschitz
protected theorem antilipschitz [SemilinearIsometryClass 𝓕 σ₁₂ E E₂] (f : 𝓕) :
AntilipschitzWith 1 f :=
(SemilinearIsometryClass.isometry f).antilipschitz
theorem ediam_image [SemilinearIsometryClass 𝓕 σ₁₂ E E₂] (f : 𝓕) (s : Set E) :
EMetric.diam (f '' s) = EMetric.diam s :=
(SemilinearIsometryClass.isometry f).ediam_image s
theorem ediam_range [SemilinearIsometryClass 𝓕 σ₁₂ E E₂] (f : 𝓕) :
EMetric.diam (range f) = EMetric.diam (univ : Set E) :=
(SemilinearIsometryClass.isometry f).ediam_range
theorem diam_image [SemilinearIsometryClass 𝓕 σ₁₂ E E₂] (f : 𝓕) (s : Set E) :
Metric.diam (f '' s) = Metric.diam s :=
(SemilinearIsometryClass.isometry f).diam_image s
theorem diam_range [SemilinearIsometryClass 𝓕 σ₁₂ E E₂] (f : 𝓕) :
Metric.diam (range f) = Metric.diam (univ : Set E) :=
(SemilinearIsometryClass.isometry f).diam_range
instance (priority := 100) toContinuousSemilinearMapClass
[SemilinearIsometryClass 𝓕 σ₁₂ E E₂] : ContinuousSemilinearMapClass 𝓕 σ₁₂ E E₂ where
map_continuous := SemilinearIsometryClass.continuous
end SemilinearIsometryClass
namespace LinearIsometry
variable (f : E →ₛₗᵢ[σ₁₂] E₂) (f₁ : F →ₛₗᵢ[σ₁₂] E₂)
theorem toLinearMap_injective : Injective (toLinearMap : (E →ₛₗᵢ[σ₁₂] E₂) → E →ₛₗ[σ₁₂] E₂)
| ⟨_, _⟩, ⟨_, _⟩, rfl => rfl
@[simp]
theorem toLinearMap_inj {f g : E →ₛₗᵢ[σ₁₂] E₂} : f.toLinearMap = g.toLinearMap ↔ f = g :=
toLinearMap_injective.eq_iff
instance instFunLike : FunLike (E →ₛₗᵢ[σ₁₂] E₂) E E₂ where
coe f := f.toFun
coe_injective' _ _ h := toLinearMap_injective (DFunLike.coe_injective h)
instance instSemilinearIsometryClass : SemilinearIsometryClass (E →ₛₗᵢ[σ₁₂] E₂) σ₁₂ E E₂ where
map_add f := map_add f.toLinearMap
map_smulₛₗ f := map_smulₛₗ f.toLinearMap
norm_map f := f.norm_map'
@[simp]
theorem coe_toLinearMap : ⇑f.toLinearMap = f :=
rfl
@[simp]
theorem coe_mk (f : E →ₛₗ[σ₁₂] E₂) (hf) : ⇑(mk f hf) = f :=
rfl
theorem coe_injective : @Injective (E →ₛₗᵢ[σ₁₂] E₂) (E → E₂) (fun f => f) := by
rintro ⟨_⟩ ⟨_⟩
simp
/-- See Note [custom simps projection]. We need to specify this projection explicitly in this case,
because it is a composition of multiple projections. -/
def Simps.apply (σ₁₂ : R →+* R₂) (E E₂ : Type*) [SeminormedAddCommGroup E]
[SeminormedAddCommGroup E₂] [Module R E] [Module R₂ E₂] (h : E →ₛₗᵢ[σ₁₂] E₂) : E → E₂ :=
h
initialize_simps_projections LinearIsometry (toFun → apply)
@[ext]
theorem ext {f g : E →ₛₗᵢ[σ₁₂] E₂} (h : ∀ x, f x = g x) : f = g :=
coe_injective <| funext h
variable [FunLike 𝓕 E E₂]
protected theorem map_zero : f 0 = 0 :=
f.toLinearMap.map_zero
protected theorem map_add (x y : E) : f (x + y) = f x + f y :=
f.toLinearMap.map_add x y
protected theorem map_neg (x : E) : f (-x) = -f x :=
f.toLinearMap.map_neg x
protected theorem map_sub (x y : E) : f (x - y) = f x - f y :=
f.toLinearMap.map_sub x y
protected theorem map_smulₛₗ (c : R) (x : E) : f (c • x) = σ₁₂ c • f x :=
f.toLinearMap.map_smulₛₗ c x
protected theorem map_smul [Module R E₂] (f : E →ₗᵢ[R] E₂) (c : R) (x : E) : f (c • x) = c • f x :=
f.toLinearMap.map_smul c x
@[simp]
theorem norm_map (x : E) : ‖f x‖ = ‖x‖ :=
SemilinearIsometryClass.norm_map f x
@[simp] -- Should be replaced with `SemilinearIsometryClass.nnorm_map` when https://github.com/leanprover/lean4/issues/3107 is fixed.
theorem nnnorm_map (x : E) : ‖f x‖₊ = ‖x‖₊ :=
NNReal.eq <| norm_map f x
@[simp] -- Should be replaced with `SemilinearIsometryClass.enorm_map` when https://github.com/leanprover/lean4/issues/3107 is fixed.
theorem enorm_map (x : E) : ‖f x‖ₑ = ‖x‖ₑ := by
simp [enorm]
protected theorem isometry : Isometry f :=
AddMonoidHomClass.isometry_of_norm f.toLinearMap (norm_map _)
lemma isEmbedding (f : F →ₛₗᵢ[σ₁₂] E₂) : IsEmbedding f := f.isometry.isEmbedding
-- Should be `@[simp]` but it doesn't fire due to https://github.com/leanprover/lean4/issues/3107.
theorem isComplete_image_iff [SemilinearIsometryClass 𝓕 σ₁₂ E E₂] (f : 𝓕) {s : Set E} :
IsComplete (f '' s) ↔ IsComplete s :=
_root_.isComplete_image_iff (SemilinearIsometryClass.isometry f).isUniformInducing
@[simp] -- Should be replaced with `LinearIsometry.isComplete_image_iff` when https://github.com/leanprover/lean4/issues/3107 is fixed.
theorem isComplete_image_iff' (f : LinearIsometry σ₁₂ E E₂) {s : Set E} :
IsComplete (f '' s) ↔ IsComplete s :=
LinearIsometry.isComplete_image_iff _
theorem isComplete_map_iff [RingHomSurjective σ₁₂] {p : Submodule R E} :
IsComplete (p.map f.toLinearMap : Set E₂) ↔ IsComplete (p : Set E) :=
isComplete_image_iff f
theorem isComplete_map_iff' [SemilinearIsometryClass 𝓕 σ₁₂ E E₂] (f : 𝓕) [RingHomSurjective σ₁₂]
{p : Submodule R E} : IsComplete (p.map f : Set E₂) ↔ IsComplete (p : Set E) :=
isComplete_image_iff f
instance completeSpace_map [SemilinearIsometryClass 𝓕 σ₁₂ E E₂] (f : 𝓕) [RingHomSurjective σ₁₂]
(p : Submodule R E) [CompleteSpace p] : CompleteSpace (p.map f) :=
((isComplete_map_iff' f).2 <| completeSpace_coe_iff_isComplete.1 ‹_›).completeSpace_coe
instance completeSpace_map' [RingHomSurjective σ₁₂] (p : Submodule R E) [CompleteSpace p] :
CompleteSpace (p.map f.toLinearMap) :=
(f.isComplete_map_iff.2 <| completeSpace_coe_iff_isComplete.1 ‹_›).completeSpace_coe
@[simp]
theorem dist_map (x y : E) : dist (f x) (f y) = dist x y :=
f.isometry.dist_eq x y
@[simp]
theorem edist_map (x y : E) : edist (f x) (f y) = edist x y :=
f.isometry.edist_eq x y
protected theorem injective : Injective f₁ :=
Isometry.injective (LinearIsometry.isometry f₁)
@[simp]
theorem map_eq_iff {x y : F} : f₁ x = f₁ y ↔ x = y :=
f₁.injective.eq_iff
theorem map_ne {x y : F} (h : x ≠ y) : f₁ x ≠ f₁ y :=
f₁.injective.ne h
protected theorem lipschitz : LipschitzWith 1 f :=
f.isometry.lipschitz
protected theorem antilipschitz : AntilipschitzWith 1 f :=
f.isometry.antilipschitz
@[continuity]
protected theorem continuous : Continuous f :=
f.isometry.continuous
@[simp]
theorem preimage_ball (x : E) (r : ℝ) : f ⁻¹' Metric.ball (f x) r = Metric.ball x r :=
f.isometry.preimage_ball x r
@[simp]
theorem preimage_sphere (x : E) (r : ℝ) : f ⁻¹' Metric.sphere (f x) r = Metric.sphere x r :=
f.isometry.preimage_sphere x r
@[simp]
theorem preimage_closedBall (x : E) (r : ℝ) :
f ⁻¹' Metric.closedBall (f x) r = Metric.closedBall x r :=
f.isometry.preimage_closedBall x r
theorem ediam_image (s : Set E) : EMetric.diam (f '' s) = EMetric.diam s :=
f.isometry.ediam_image s
theorem ediam_range : EMetric.diam (range f) = EMetric.diam (univ : Set E) :=
f.isometry.ediam_range
theorem diam_image (s : Set E) : Metric.diam (f '' s) = Metric.diam s :=
Isometry.diam_image (LinearIsometry.isometry f) s
theorem diam_range : Metric.diam (range f) = Metric.diam (univ : Set E) :=
Isometry.diam_range (LinearIsometry.isometry f)
/-- Interpret a linear isometry as a continuous linear map. -/
def toContinuousLinearMap : E →SL[σ₁₂] E₂ :=
⟨f.toLinearMap, f.continuous⟩
theorem toContinuousLinearMap_injective :
Function.Injective (toContinuousLinearMap : _ → E →SL[σ₁₂] E₂) := fun x _ h =>
coe_injective (congr_arg _ h : ⇑x.toContinuousLinearMap = _)
@[simp]
theorem toContinuousLinearMap_inj {f g : E →ₛₗᵢ[σ₁₂] E₂} :
f.toContinuousLinearMap = g.toContinuousLinearMap ↔ f = g :=
toContinuousLinearMap_injective.eq_iff
@[simp]
theorem coe_toContinuousLinearMap : ⇑f.toContinuousLinearMap = f :=
rfl
@[simp]
theorem comp_continuous_iff {α : Type*} [TopologicalSpace α] {g : α → E} :
Continuous (f ∘ g) ↔ Continuous g :=
f.isometry.comp_continuous_iff
/-- The identity linear isometry. -/
def id : E →ₗᵢ[R] E :=
⟨LinearMap.id, fun _ => rfl⟩
@[simp, norm_cast]
theorem coe_id : ((id : E →ₗᵢ[R] E) : E → E) = _root_.id :=
rfl
@[simp]
theorem id_apply (x : E) : (id : E →ₗᵢ[R] E) x = x :=
rfl
@[simp]
theorem id_toLinearMap : (id.toLinearMap : E →ₗ[R] E) = LinearMap.id :=
rfl
@[simp]
theorem id_toContinuousLinearMap : id.toContinuousLinearMap = ContinuousLinearMap.id R E :=
rfl
instance instInhabited : Inhabited (E →ₗᵢ[R] E) := ⟨id⟩
/-- Composition of linear isometries. -/
def comp (g : E₂ →ₛₗᵢ[σ₂₃] E₃) (f : E →ₛₗᵢ[σ₁₂] E₂) : E →ₛₗᵢ[σ₁₃] E₃ :=
⟨g.toLinearMap.comp f.toLinearMap, fun _ => (norm_map g _).trans (norm_map f _)⟩
@[simp]
theorem coe_comp (g : E₂ →ₛₗᵢ[σ₂₃] E₃) (f : E →ₛₗᵢ[σ₁₂] E₂) : ⇑(g.comp f) = g ∘ f :=
rfl
@[simp]
theorem id_comp : (id : E₂ →ₗᵢ[R₂] E₂).comp f = f :=
ext fun _ => rfl
@[simp]
theorem comp_id : f.comp id = f :=
ext fun _ => rfl
theorem comp_assoc (f : E₃ →ₛₗᵢ[σ₃₄] E₄) (g : E₂ →ₛₗᵢ[σ₂₃] E₃) (h : E →ₛₗᵢ[σ₁₂] E₂) :
(f.comp g).comp h = f.comp (g.comp h) :=
rfl
instance instMonoid : Monoid (E →ₗᵢ[R] E) where
one := id
mul := comp
mul_assoc := comp_assoc
one_mul := id_comp
mul_one := comp_id
@[simp]
theorem coe_one : ((1 : E →ₗᵢ[R] E) : E → E) = _root_.id :=
rfl
@[simp]
theorem coe_mul (f g : E →ₗᵢ[R] E) : ⇑(f * g) = f ∘ g :=
rfl
theorem one_def : (1 : E →ₗᵢ[R] E) = id :=
rfl
theorem mul_def (f g : E →ₗᵢ[R] E) : (f * g : E →ₗᵢ[R] E) = f.comp g :=
rfl
theorem coe_pow (f : E →ₗᵢ[R] E) (n : ℕ) : ⇑(f ^ n) = f^[n] :=
hom_coe_pow _ rfl (fun _ _ ↦ rfl) _ _
section submoduleMap
variable {R R₁ R₂ M M₁ : Type*}
variable [Ring R] [SeminormedAddCommGroup M] [SeminormedAddCommGroup M₁]
variable [Module R M] [Module R M₁]
/-- A linear isometry between two modules restricts to a linear isometry
from any submodule `p` of the domain onto the image of that submodule.
This is a version of `LinearMap.submoduleMap` extended to linear isometries. -/
@[simps!]
def submoduleMap (p : Submodule R M) (e : M →ₗᵢ[R] M₁) :
p →ₗᵢ[R] (Submodule.map e p) :=
{ e.toLinearMap.submoduleMap p with norm_map' x := e.norm_map' x }
end submoduleMap
end LinearIsometry
/-- Construct a `LinearIsometry` from a `LinearMap` satisfying `Isometry`. -/
def LinearMap.toLinearIsometry (f : E →ₛₗ[σ₁₂] E₂) (hf : Isometry f) : E →ₛₗᵢ[σ₁₂] E₂ :=
{ f with
norm_map' := by
simp_rw [← dist_zero_right]
simpa using (hf.dist_eq · 0) }
namespace Submodule
variable {R' : Type*} [Ring R'] [Module R' E] (p : Submodule R' E)
/-- `Submodule.subtype` as a `LinearIsometry`. -/
def subtypeₗᵢ : p →ₗᵢ[R'] E :=
⟨p.subtype, fun _ => rfl⟩
@[simp]
theorem coe_subtypeₗᵢ : ⇑p.subtypeₗᵢ = p.subtype :=
rfl
@[simp]
theorem subtypeₗᵢ_toLinearMap : p.subtypeₗᵢ.toLinearMap = p.subtype :=
rfl
@[simp]
theorem subtypeₗᵢ_toContinuousLinearMap : p.subtypeₗᵢ.toContinuousLinearMap = p.subtypeL :=
rfl
end Submodule
/-- A semilinear isometric equivalence between two normed vector spaces,
denoted as `f : E ≃ₛₗᵢ[σ₁₂] E₂`. -/
structure LinearIsometryEquiv (σ₁₂ : R →+* R₂) {σ₂₁ : R₂ →+* R} [RingHomInvPair σ₁₂ σ₂₁]
[RingHomInvPair σ₂₁ σ₁₂] (E E₂ : Type*) [SeminormedAddCommGroup E] [SeminormedAddCommGroup E₂]
[Module R E] [Module R₂ E₂] extends E ≃ₛₗ[σ₁₂] E₂ where
norm_map' : ∀ x, ‖toLinearEquiv x‖ = ‖x‖
@[inherit_doc]
notation:25 E " ≃ₛₗᵢ[" σ₁₂:25 "] " E₂:0 => LinearIsometryEquiv σ₁₂ E E₂
/-- A linear isometric equivalence between two normed vector spaces. -/
notation:25 E " ≃ₗᵢ[" R:25 "] " E₂:0 => LinearIsometryEquiv (RingHom.id R) E E₂
/-- An antilinear isometric equivalence between two normed vector spaces. -/
notation:25 E " ≃ₗᵢ⋆[" R:25 "] " E₂:0 => LinearIsometryEquiv (starRingEnd R) E E₂
/-- `SemilinearIsometryEquivClass F σ E E₂` asserts `F` is a type of bundled `σ`-semilinear
isometric equivs `E → E₂`.
See also `LinearIsometryEquivClass F R E E₂` for the case where `σ` is the identity map on `R`.
A map `f` between an `R`-module and an `S`-module over a ring homomorphism `σ : R →+* S`
is semilinear if it satisfies the two properties `f (x + y) = f x + f y` and
`f (c • x) = (σ c) • f x`. -/
class SemilinearIsometryEquivClass (𝓕 : Type*) {R R₂ : outParam Type*} [Semiring R]
[Semiring R₂] (σ₁₂ : outParam <| R →+* R₂) {σ₂₁ : outParam <| R₂ →+* R} [RingHomInvPair σ₁₂ σ₂₁]
[RingHomInvPair σ₂₁ σ₁₂] (E E₂ : outParam Type*) [SeminormedAddCommGroup E]
[SeminormedAddCommGroup E₂] [Module R E] [Module R₂ E₂] [EquivLike 𝓕 E E₂] : Prop
extends SemilinearEquivClass 𝓕 σ₁₂ E E₂ where
norm_map : ∀ (f : 𝓕) (x : E), ‖f x‖ = ‖x‖
/-- `LinearIsometryEquivClass F R E E₂` asserts `F` is a type of bundled `R`-linear isometries
`M → M₂`.
This is an abbreviation for `SemilinearIsometryEquivClass F (RingHom.id R) E E₂`.
-/
abbrev LinearIsometryEquivClass (𝓕 : Type*) (R E E₂ : outParam Type*) [Semiring R]
[SeminormedAddCommGroup E] [SeminormedAddCommGroup E₂] [Module R E] [Module R E₂]
[EquivLike 𝓕 E E₂] :=
SemilinearIsometryEquivClass 𝓕 (RingHom.id R) E E₂
namespace SemilinearIsometryEquivClass
variable (𝓕)
-- `σ₂₁` becomes a metavariable, but it's OK since it's an outparam
instance (priority := 100) toSemilinearIsometryClass [EquivLike 𝓕 E E₂]
[s : SemilinearIsometryEquivClass 𝓕 σ₁₂ E E₂] : SemilinearIsometryClass 𝓕 σ₁₂ E E₂ :=
{ s with }
end SemilinearIsometryEquivClass
namespace LinearIsometryEquiv
variable (e : E ≃ₛₗᵢ[σ₁₂] E₂)
theorem toLinearEquiv_injective : Injective (toLinearEquiv : (E ≃ₛₗᵢ[σ₁₂] E₂) → E ≃ₛₗ[σ₁₂] E₂)
| ⟨_, _⟩, ⟨_, _⟩, rfl => rfl
@[simp]
theorem toLinearEquiv_inj {f g : E ≃ₛₗᵢ[σ₁₂] E₂} : f.toLinearEquiv = g.toLinearEquiv ↔ f = g :=
toLinearEquiv_injective.eq_iff
instance instEquivLike : EquivLike (E ≃ₛₗᵢ[σ₁₂] E₂) E E₂ where
coe e := e.toFun
inv e := e.invFun
coe_injective' f g h₁ h₂ := by
obtain ⟨f', _⟩ := f
obtain ⟨g', _⟩ := g
cases f'
cases g'
simp only [AddHom.toFun_eq_coe, LinearMap.coe_toAddHom, DFunLike.coe_fn_eq] at h₁
congr
left_inv e := e.left_inv
right_inv e := e.right_inv
instance instSemilinearIsometryEquivClass :
SemilinearIsometryEquivClass (E ≃ₛₗᵢ[σ₁₂] E₂) σ₁₂ E E₂ where
map_add f := map_add f.toLinearEquiv
map_smulₛₗ e := map_smulₛₗ e.toLinearEquiv
norm_map e := e.norm_map'
/-- Shortcut instance, saving 8.5% of compilation time in
`Mathlib/Analysis/InnerProductSpace/Adjoint.lean`.
(This instance was pinpointed by benchmarks; we didn't do an in depth investigation why it is
specifically needed.)
-/
instance instCoeFun : CoeFun (E ≃ₛₗᵢ[σ₁₂] E₂) fun _ ↦ E → E₂ := ⟨DFunLike.coe⟩
theorem coe_injective : @Function.Injective (E ≃ₛₗᵢ[σ₁₂] E₂) (E → E₂) (↑) :=
DFunLike.coe_injective
@[simp]
theorem coe_mk (e : E ≃ₛₗ[σ₁₂] E₂) (he : ∀ x, ‖e x‖ = ‖x‖) : ⇑(mk e he) = e :=
rfl
@[simp]
theorem coe_toLinearEquiv (e : E ≃ₛₗᵢ[σ₁₂] E₂) : ⇑e.toLinearEquiv = e :=
rfl
@[ext]
theorem ext {e e' : E ≃ₛₗᵢ[σ₁₂] E₂} (h : ∀ x, e x = e' x) : e = e' :=
toLinearEquiv_injective <| LinearEquiv.ext h
protected theorem congr_arg {f : E ≃ₛₗᵢ[σ₁₂] E₂} : ∀ {x x' : E}, x = x' → f x = f x'
| _, _, rfl => rfl
protected theorem congr_fun {f g : E ≃ₛₗᵢ[σ₁₂] E₂} (h : f = g) (x : E) : f x = g x :=
h ▸ rfl
/-- Construct a `LinearIsometryEquiv` from a `LinearEquiv` and two inequalities:
`∀ x, ‖e x‖ ≤ ‖x‖` and `∀ y, ‖e.symm y‖ ≤ ‖y‖`. -/
def ofBounds (e : E ≃ₛₗ[σ₁₂] E₂) (h₁ : ∀ x, ‖e x‖ ≤ ‖x‖) (h₂ : ∀ y, ‖e.symm y‖ ≤ ‖y‖) :
E ≃ₛₗᵢ[σ₁₂] E₂ :=
⟨e, fun x => le_antisymm (h₁ x) <| by simpa only [e.symm_apply_apply] using h₂ (e x)⟩
@[simp]
theorem norm_map (x : E) : ‖e x‖ = ‖x‖ :=
e.norm_map' x
/-- Reinterpret a `LinearIsometryEquiv` as a `LinearIsometry`. -/
def toLinearIsometry : E →ₛₗᵢ[σ₁₂] E₂ :=
⟨e.1, e.2⟩
theorem toLinearIsometry_injective : Function.Injective (toLinearIsometry : _ → E →ₛₗᵢ[σ₁₂] E₂) :=
fun x _ h => coe_injective (congr_arg _ h : ⇑x.toLinearIsometry = _)
@[simp]
theorem toLinearIsometry_inj {f g : E ≃ₛₗᵢ[σ₁₂] E₂} :
f.toLinearIsometry = g.toLinearIsometry ↔ f = g :=
toLinearIsometry_injective.eq_iff
@[simp]
theorem coe_toLinearIsometry : ⇑e.toLinearIsometry = e :=
rfl
protected theorem isometry : Isometry e :=
e.toLinearIsometry.isometry
/-- Reinterpret a `LinearIsometryEquiv` as an `IsometryEquiv`. -/
def toIsometryEquiv : E ≃ᵢ E₂ :=
⟨e.toLinearEquiv.toEquiv, e.isometry⟩
theorem toIsometryEquiv_injective :
Function.Injective (toIsometryEquiv : (E ≃ₛₗᵢ[σ₁₂] E₂) → E ≃ᵢ E₂) := fun x _ h =>
coe_injective (congr_arg _ h : ⇑x.toIsometryEquiv = _)
@[simp]
theorem toIsometryEquiv_inj {f g : E ≃ₛₗᵢ[σ₁₂] E₂} :
f.toIsometryEquiv = g.toIsometryEquiv ↔ f = g :=
toIsometryEquiv_injective.eq_iff
@[simp]
theorem coe_toIsometryEquiv : ⇑e.toIsometryEquiv = e :=
rfl
theorem range_eq_univ (e : E ≃ₛₗᵢ[σ₁₂] E₂) : Set.range e = Set.univ := by
rw [← coe_toIsometryEquiv]
exact IsometryEquiv.range_eq_univ _
/-- Reinterpret a `LinearIsometryEquiv` as a `Homeomorph`. -/
def toHomeomorph : E ≃ₜ E₂ :=
e.toIsometryEquiv.toHomeomorph
theorem toHomeomorph_injective : Function.Injective (toHomeomorph : (E ≃ₛₗᵢ[σ₁₂] E₂) → E ≃ₜ E₂) :=
fun x _ h => coe_injective (congr_arg _ h : ⇑x.toHomeomorph = _)
@[simp]
theorem toHomeomorph_inj {f g : E ≃ₛₗᵢ[σ₁₂] E₂} : f.toHomeomorph = g.toHomeomorph ↔ f = g :=
toHomeomorph_injective.eq_iff
@[simp]
theorem coe_toHomeomorph : ⇑e.toHomeomorph = e :=
rfl
protected theorem continuous : Continuous e :=
e.isometry.continuous
protected theorem continuousAt {x} : ContinuousAt e x :=
e.continuous.continuousAt
protected theorem continuousOn {s} : ContinuousOn e s :=
e.continuous.continuousOn
protected theorem continuousWithinAt {s x} : ContinuousWithinAt e s x :=
e.continuous.continuousWithinAt
/-- Interpret a `LinearIsometryEquiv` as a `ContinuousLinearEquiv`. -/
def toContinuousLinearEquiv : E ≃SL[σ₁₂] E₂ :=
{ e.toLinearIsometry.toContinuousLinearMap, e.toHomeomorph with }
theorem toContinuousLinearEquiv_injective :
Function.Injective (toContinuousLinearEquiv : _ → E ≃SL[σ₁₂] E₂) := fun x _ h =>
coe_injective (congr_arg _ h : ⇑x.toContinuousLinearEquiv = _)
@[simp]
theorem toContinuousLinearEquiv_inj {f g : E ≃ₛₗᵢ[σ₁₂] E₂} :
f.toContinuousLinearEquiv = g.toContinuousLinearEquiv ↔ f = g :=
toContinuousLinearEquiv_injective.eq_iff
@[simp]
theorem coe_toContinuousLinearEquiv : ⇑e.toContinuousLinearEquiv = e :=
rfl
variable (R E)
/-- Identity map as a `LinearIsometryEquiv`. -/
def refl : E ≃ₗᵢ[R] E :=
⟨LinearEquiv.refl R E, fun _ => rfl⟩
/-- Linear isometry equiv between a space and its lift to another universe. -/
def ulift : ULift E ≃ₗᵢ[R] E :=
{ ContinuousLinearEquiv.ulift with norm_map' := fun _ => rfl }
variable {R E}
instance instInhabited : Inhabited (E ≃ₗᵢ[R] E) := ⟨refl R E⟩
@[simp]
theorem coe_refl : ⇑(refl R E) = id :=
rfl
/-- The inverse `LinearIsometryEquiv`. -/
def symm : E₂ ≃ₛₗᵢ[σ₂₁] E :=
⟨e.toLinearEquiv.symm, fun x =>
(e.norm_map _).symm.trans <| congr_arg norm <| e.toLinearEquiv.apply_symm_apply x⟩
@[simp]
theorem apply_symm_apply (x : E₂) : e (e.symm x) = x :=
e.toLinearEquiv.apply_symm_apply x
@[simp]
theorem symm_apply_apply (x : E) : e.symm (e x) = x :=
e.toLinearEquiv.symm_apply_apply x
theorem map_eq_zero_iff {x : E} : e x = 0 ↔ x = 0 :=
e.toLinearEquiv.map_eq_zero_iff
@[simp]
theorem symm_symm : e.symm.symm = e := rfl
theorem symm_bijective : Function.Bijective (symm : (E₂ ≃ₛₗᵢ[σ₂₁] E) → _) :=
Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩
@[simp]
theorem toLinearEquiv_symm : e.symm.toLinearEquiv = e.toLinearEquiv.symm :=
rfl
@[simp]
theorem coe_symm_toLinearEquiv : ⇑e.toLinearEquiv.symm = e.symm := rfl
@[simp]
theorem toContinuousLinearEquiv_symm :
e.symm.toContinuousLinearEquiv = e.toContinuousLinearEquiv.symm := rfl
@[simp]
theorem coe_symm_toContinuousLinearEquiv : ⇑e.toContinuousLinearEquiv.symm = e.symm :=
rfl
@[simp]
theorem toIsometryEquiv_symm : e.symm.toIsometryEquiv = e.toIsometryEquiv.symm :=
rfl
@[simp]
theorem coe_symm_toIsometryEquiv : ⇑e.toIsometryEquiv.symm = e.symm := rfl
@[simp]
theorem toHomeomorph_symm : e.symm.toHomeomorph = e.toHomeomorph.symm :=
rfl
@[simp]
theorem coe_symm_toHomeomorph : ⇑e.toHomeomorph.symm = e.symm := rfl
/-- See Note [custom simps projection]. We need to specify this projection explicitly in this case,
because it is a composition of multiple projections. -/
def Simps.apply (σ₁₂ : R →+* R₂) {σ₂₁ : R₂ →+* R} [RingHomInvPair σ₁₂ σ₂₁] [RingHomInvPair σ₂₁ σ₁₂]
(E E₂ : Type*) [SeminormedAddCommGroup E] [SeminormedAddCommGroup E₂] [Module R E]
[Module R₂ E₂] (h : E ≃ₛₗᵢ[σ₁₂] E₂) : E → E₂ :=
h
/-- See Note [custom simps projection] -/
def Simps.symm_apply (σ₁₂ : R →+* R₂) {σ₂₁ : R₂ →+* R} [RingHomInvPair σ₁₂ σ₂₁]
[RingHomInvPair σ₂₁ σ₁₂] (E E₂ : Type*) [SeminormedAddCommGroup E] [SeminormedAddCommGroup E₂]
[Module R E] [Module R₂ E₂] (h : E ≃ₛₗᵢ[σ₁₂] E₂) : E₂ → E :=
h.symm
initialize_simps_projections LinearIsometryEquiv (toFun → apply, invFun → symm_apply)
/-- Composition of `LinearIsometryEquiv`s as a `LinearIsometryEquiv`. -/
def trans (e' : E₂ ≃ₛₗᵢ[σ₂₃] E₃) : E ≃ₛₗᵢ[σ₁₃] E₃ :=
⟨e.toLinearEquiv.trans e'.toLinearEquiv, fun _ => (e'.norm_map _).trans (e.norm_map _)⟩
@[simp]
theorem coe_trans (e₁ : E ≃ₛₗᵢ[σ₁₂] E₂) (e₂ : E₂ ≃ₛₗᵢ[σ₂₃] E₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=
rfl
@[simp]
theorem trans_apply (e₁ : E ≃ₛₗᵢ[σ₁₂] E₂) (e₂ : E₂ ≃ₛₗᵢ[σ₂₃] E₃) (c : E) :
(e₁.trans e₂ : E ≃ₛₗᵢ[σ₁₃] E₃) c = e₂ (e₁ c) :=
rfl
@[simp]
theorem toLinearEquiv_trans (e' : E₂ ≃ₛₗᵢ[σ₂₃] E₃) :
(e.trans e').toLinearEquiv = e.toLinearEquiv.trans e'.toLinearEquiv :=
rfl
@[simp]
theorem toIsometryEquiv_trans (e' : E₂ ≃ₛₗᵢ[σ₂₃] E₃) :
(e.trans e').toIsometryEquiv = e.toIsometryEquiv.trans e'.toIsometryEquiv :=
rfl
@[simp]
theorem toHomeomorph_trans (e' : E₂ ≃ₛₗᵢ[σ₂₃] E₃) :
(e.trans e').toHomeomorph = e.toHomeomorph.trans e'.toHomeomorph :=
rfl
@[simp]
theorem trans_refl : e.trans (refl R₂ E₂) = e :=
ext fun _ => rfl
@[simp]
theorem refl_trans : (refl R E).trans e = e :=
ext fun _ => rfl
@[simp]
theorem self_trans_symm : e.trans e.symm = refl R E :=
ext e.symm_apply_apply
@[simp]
theorem symm_trans_self : e.symm.trans e = refl R₂ E₂ :=
ext e.apply_symm_apply
@[simp]
theorem symm_comp_self : e.symm ∘ e = id :=
funext e.symm_apply_apply
@[simp]
theorem self_comp_symm : e ∘ e.symm = id :=
e.symm.symm_comp_self
@[simp]
theorem symm_trans (e₁ : E ≃ₛₗᵢ[σ₁₂] E₂) (e₂ : E₂ ≃ₛₗᵢ[σ₂₃] E₃) :
(e₁.trans e₂).symm = e₂.symm.trans e₁.symm :=
rfl
theorem coe_symm_trans (e₁ : E ≃ₛₗᵢ[σ₁₂] E₂) (e₂ : E₂ ≃ₛₗᵢ[σ₂₃] E₃) :
⇑(e₁.trans e₂).symm = e₁.symm ∘ e₂.symm :=
rfl
theorem trans_assoc (eEE₂ : E ≃ₛₗᵢ[σ₁₂] E₂) (eE₂E₃ : E₂ ≃ₛₗᵢ[σ₂₃] E₃) (eE₃E₄ : E₃ ≃ₛₗᵢ[σ₃₄] E₄) :
eEE₂.trans (eE₂E₃.trans eE₃E₄) = (eEE₂.trans eE₂E₃).trans eE₃E₄ :=
rfl
instance instGroup : Group (E ≃ₗᵢ[R] E) where
mul e₁ e₂ := e₂.trans e₁
one := refl _ _
inv := symm
one_mul := trans_refl
mul_one := refl_trans
mul_assoc _ _ _ := trans_assoc _ _ _
inv_mul_cancel := self_trans_symm
@[simp]
theorem coe_one : ⇑(1 : E ≃ₗᵢ[R] E) = id :=
rfl
@[simp]
theorem coe_mul (e e' : E ≃ₗᵢ[R] E) : ⇑(e * e') = e ∘ e' :=
rfl
@[simp]
theorem coe_inv (e : E ≃ₗᵢ[R] E) : ⇑e⁻¹ = e.symm :=
rfl
theorem one_def : (1 : E ≃ₗᵢ[R] E) = refl _ _ :=
rfl
theorem mul_def (e e' : E ≃ₗᵢ[R] E) : (e * e' : E ≃ₗᵢ[R] E) = e'.trans e :=
rfl
theorem inv_def (e : E ≃ₗᵢ[R] E) : (e⁻¹ : E ≃ₗᵢ[R] E) = e.symm :=
rfl
/-! Lemmas about mixing the group structure with definitions. Because we have multiple ways to
express `LinearIsometryEquiv.refl`, `LinearIsometryEquiv.symm`, and
`LinearIsometryEquiv.trans`, we want simp lemmas for every combination.
The assumption made here is that if you're using the group structure, you want to preserve it
after simp.
This copies the approach used by the lemmas near `Equiv.Perm.trans_one`. -/
@[simp]
theorem trans_one : e.trans (1 : E₂ ≃ₗᵢ[R₂] E₂) = e :=
trans_refl _
@[simp]
theorem one_trans : (1 : E ≃ₗᵢ[R] E).trans e = e :=
refl_trans _
@[simp]
theorem refl_mul (e : E ≃ₗᵢ[R] E) : refl _ _ * e = e :=
trans_refl _
@[simp]
theorem mul_refl (e : E ≃ₗᵢ[R] E) : e * refl _ _ = e :=
refl_trans _
/-- Reinterpret a `LinearIsometryEquiv` as a `ContinuousLinearEquiv`. -/
instance instCoeTCContinuousLinearEquiv : CoeTC (E ≃ₛₗᵢ[σ₁₂] E₂) (E ≃SL[σ₁₂] E₂) :=
⟨fun e => ⟨e.toLinearEquiv, e.continuous, e.toIsometryEquiv.symm.continuous⟩⟩
instance instCoeTCContinuousLinearMap : CoeTC (E ≃ₛₗᵢ[σ₁₂] E₂) (E →SL[σ₁₂] E₂) :=
⟨fun e => ↑(e : E ≃SL[σ₁₂] E₂)⟩
@[simp]
theorem coe_coe : ⇑(e : E ≃SL[σ₁₂] E₂) = e :=
rfl
@[simp]
theorem coe_coe'' : ⇑(e : E →SL[σ₁₂] E₂) = e :=
rfl
theorem map_zero : e 0 = 0 :=
e.1.map_zero
theorem map_add (x y : E) : e (x + y) = e x + e y :=
e.1.map_add x y
theorem map_sub (x y : E) : e (x - y) = e x - e y :=
e.1.map_sub x y
theorem map_smulₛₗ (c : R) (x : E) : e (c • x) = σ₁₂ c • e x :=
e.1.map_smulₛₗ c x
theorem map_smul [Module R E₂] {e : E ≃ₗᵢ[R] E₂} (c : R) (x : E) : e (c • x) = c • e x :=
e.1.map_smul c x
@[simp] -- Should be replaced with `SemilinearIsometryClass.nnorm_map` when https://github.com/leanprover/lean4/issues/3107 is fixed.
theorem nnnorm_map (x : E) : ‖e x‖₊ = ‖x‖₊ :=
SemilinearIsometryClass.nnnorm_map e x
@[simp]
theorem dist_map (x y : E) : dist (e x) (e y) = dist x y :=
e.toLinearIsometry.dist_map x y
@[simp]
theorem edist_map (x y : E) : edist (e x) (e y) = edist x y :=
e.toLinearIsometry.edist_map x y
protected theorem bijective : Bijective e :=
e.1.bijective
protected theorem injective : Injective e :=
e.1.injective
protected theorem surjective : Surjective e :=
e.1.surjective
theorem map_eq_iff {x y : E} : e x = e y ↔ x = y :=
e.injective.eq_iff
theorem map_ne {x y : E} (h : x ≠ y) : e x ≠ e y :=
e.injective.ne h
protected theorem lipschitz : LipschitzWith 1 e :=
e.isometry.lipschitz
protected theorem antilipschitz : AntilipschitzWith 1 e :=
e.isometry.antilipschitz
theorem image_eq_preimage_symm (s : Set E) : e '' s = e.symm ⁻¹' s :=
e.toLinearEquiv.image_eq_preimage_symm s
@[simp]
theorem ediam_image (s : Set E) : EMetric.diam (e '' s) = EMetric.diam s :=
e.isometry.ediam_image s
@[simp]
theorem diam_image (s : Set E) : Metric.diam (e '' s) = Metric.diam s :=
e.isometry.diam_image s
@[simp]
theorem preimage_ball (x : E₂) (r : ℝ) : e ⁻¹' Metric.ball x r = Metric.ball (e.symm x) r :=
e.toIsometryEquiv.preimage_ball x r
@[simp]
theorem preimage_sphere (x : E₂) (r : ℝ) : e ⁻¹' Metric.sphere x r = Metric.sphere (e.symm x) r :=
e.toIsometryEquiv.preimage_sphere x r
@[simp]
theorem preimage_closedBall (x : E₂) (r : ℝ) :
e ⁻¹' Metric.closedBall x r = Metric.closedBall (e.symm x) r :=
e.toIsometryEquiv.preimage_closedBall x r
@[simp]
theorem image_ball (x : E) (r : ℝ) : e '' Metric.ball x r = Metric.ball (e x) r :=
e.toIsometryEquiv.image_ball x r
@[simp]
theorem image_sphere (x : E) (r : ℝ) : e '' Metric.sphere x r = Metric.sphere (e x) r :=
e.toIsometryEquiv.image_sphere x r
@[simp]
theorem image_closedBall (x : E) (r : ℝ) : e '' Metric.closedBall x r = Metric.closedBall (e x) r :=
e.toIsometryEquiv.image_closedBall x r
variable {α : Type*} [TopologicalSpace α]
@[simp]
theorem comp_continuousOn_iff {f : α → E} {s : Set α} : ContinuousOn (e ∘ f) s ↔ ContinuousOn f s :=
e.isometry.comp_continuousOn_iff
@[simp]
theorem comp_continuous_iff {f : α → E} : Continuous (e ∘ f) ↔ Continuous f :=
e.isometry.comp_continuous_iff
instance completeSpace_map (p : Submodule R E) [CompleteSpace p] :
CompleteSpace (p.map (e.toLinearEquiv : E →ₛₗ[σ₁₂] E₂)) :=
e.toLinearIsometry.completeSpace_map' p
/-- Construct a linear isometry equiv from a surjective linear isometry. -/
noncomputable def ofSurjective (f : F →ₛₗᵢ[σ₁₂] E₂) (hfr : Function.Surjective f) :
F ≃ₛₗᵢ[σ₁₂] E₂ :=
{ LinearEquiv.ofBijective f.toLinearMap ⟨f.injective, hfr⟩ with norm_map' := f.norm_map }
@[simp]
theorem coe_ofSurjective (f : F →ₛₗᵢ[σ₁₂] E₂) (hfr : Function.Surjective f) :
⇑(LinearIsometryEquiv.ofSurjective f hfr) = f := by
ext
rfl
/-- If a linear isometry has an inverse, it is a linear isometric equivalence. -/
def ofLinearIsometry (f : E →ₛₗᵢ[σ₁₂] E₂) (g : E₂ →ₛₗ[σ₂₁] E)
(h₁ : f.toLinearMap.comp g = LinearMap.id) (h₂ : g.comp f.toLinearMap = LinearMap.id) :
E ≃ₛₗᵢ[σ₁₂] E₂ :=
{ toLinearEquiv := LinearEquiv.ofLinear f.toLinearMap g h₁ h₂
norm_map' := fun x => f.norm_map x }
@[simp]
theorem coe_ofLinearIsometry (f : E →ₛₗᵢ[σ₁₂] E₂) (g : E₂ →ₛₗ[σ₂₁] E)
(h₁ : f.toLinearMap.comp g = LinearMap.id) (h₂ : g.comp f.toLinearMap = LinearMap.id) :
(ofLinearIsometry f g h₁ h₂ : E → E₂) = (f : E → E₂) :=
rfl
@[simp]
theorem coe_ofLinearIsometry_symm (f : E →ₛₗᵢ[σ₁₂] E₂) (g : E₂ →ₛₗ[σ₂₁] E)
(h₁ : f.toLinearMap.comp g = LinearMap.id) (h₂ : g.comp f.toLinearMap = LinearMap.id) :
((ofLinearIsometry f g h₁ h₂).symm : E₂ → E) = (g : E₂ → E) :=
rfl
variable (R) in
/-- The negation operation on a normed space `E`, considered as a linear isometry equivalence. -/
def neg : E ≃ₗᵢ[R] E :=
{ LinearEquiv.neg R with norm_map' := norm_neg }
@[simp]
theorem coe_neg : (neg R : E → E) = fun x => -x :=
rfl
@[simp]
theorem symm_neg : (neg R : E ≃ₗᵢ[R] E).symm = neg R :=
rfl
variable (R E E₂)
/-- The natural equivalence `E × E₂ ≃ E₂ × E` is a linear isometry. -/
@[simps!]
def prodComm [Module R E₂] : E × E₂ ≃ₗᵢ[R] E₂ × E :=
⟨LinearEquiv.prodComm R E E₂, by intro; simp [norm, sup_comm]⟩
@[simp]
theorem symm_prodComm [Module R E₂] : (prodComm R E E₂).symm = prodComm R E₂ E :=
rfl
variable (E₃)
/-- The natural equivalence `(E × E₂) × E₃ ≃ E × (E₂ × E₃)` is a linear isometry. -/
def prodAssoc [Module R E₂] [Module R E₃] : (E × E₂) × E₃ ≃ₗᵢ[R] E × E₂ × E₃ :=
{ LinearEquiv.prodAssoc R E E₂ E₃ with
norm_map' := by
rintro ⟨⟨e, f⟩, g⟩
simp only [LinearEquiv.prodAssoc_apply, AddEquiv.toEquiv_eq_coe,
Equiv.toFun_as_coe, EquivLike.coe_coe, AddEquiv.coe_prodAssoc,
Equiv.prodAssoc_apply, Prod.norm_def, max_assoc] }
@[simp]
theorem coe_prodAssoc [Module R E₂] [Module R E₃] :
(prodAssoc R E E₂ E₃ : (E × E₂) × E₃ → E × E₂ × E₃) = Equiv.prodAssoc E E₂ E₃ :=
rfl
@[simp]
theorem coe_prodAssoc_symm [Module R E₂] [Module R E₃] :
((prodAssoc R E E₂ E₃).symm : E × E₂ × E₃ → (E × E₂) × E₃) = (Equiv.prodAssoc E E₂ E₃).symm :=
rfl
/-- If `p` is a submodule that is equal to `⊤`, then `LinearIsometryEquiv.ofTop p hp` is the
"identity" equivalence between `p` and `E`. -/
@[simps! toLinearEquiv apply symm_apply_coe]
def ofTop {R : Type*} [Ring R] [Module R E] (p : Submodule R E) (hp : p = ⊤) : p ≃ₗᵢ[R] E :=
{ p.subtypeₗᵢ with toLinearEquiv := LinearEquiv.ofTop p hp }
variable {R E E₂ E₃} {R' : Type*} [Ring R']
variable [Module R' E] (p q : Submodule R' E)
/-- `LinearEquiv.ofEq` as a `LinearIsometryEquiv`. -/
def ofEq (hpq : p = q) : p ≃ₗᵢ[R'] q :=
{ LinearEquiv.ofEq p q hpq with norm_map' := fun _ => rfl }
variable {p q}
@[simp]
theorem coe_ofEq_apply (h : p = q) (x : p) : (ofEq p q h x : E) = x :=
rfl
@[simp]
theorem ofEq_symm (h : p = q) : (ofEq p q h).symm = ofEq q p h.symm :=
rfl
@[simp]
theorem ofEq_rfl : ofEq p p rfl = LinearIsometryEquiv.refl R' p := rfl
section submoduleMap
variable {R R₁ R₂ M M₂ : Type*}
variable [Ring R] [Ring R₂] [SeminormedAddCommGroup M] [SeminormedAddCommGroup M₂]
variable [Module R M] [Module R₂ M₂] {σ₁₂ : R →+* R₂} {σ₂₁ : R₂ →+* R}
variable {re₁₂ : RingHomInvPair σ₁₂ σ₂₁} {re₂₁ : RingHomInvPair σ₂₁ σ₁₂}
/-- A linear isometry equivalence between two modules restricts to a
linear isometry equivalence from any submodule `p` of the domain onto
the image of that submodule.
This is a version of `LinearEquiv.submoduleMap` extended to linear isometry equivalences. -/
@[simps!]
def submoduleMap (p : Submodule R M) (e : M ≃ₛₗᵢ[σ₁₂] M₂) :
p ≃ₛₗᵢ[σ₁₂] (Submodule.map e p) :=
{ e.toLinearEquiv.submoduleMap p with norm_map' x := e.norm_map' x }
end submoduleMap
end LinearIsometryEquiv
/-- Two linear isometries are equal if they are equal on basis vectors. -/
theorem Module.Basis.ext_linearIsometry {ι : Type*} (b : Basis ι R E) {f₁ f₂ : E →ₛₗᵢ[σ₁₂] E₂}
(h : ∀ i, f₁ (b i) = f₂ (b i)) : f₁ = f₂ :=
LinearIsometry.toLinearMap_injective <| b.ext h
/-- Two linear isometric equivalences are equal if they are equal on basis vectors. -/
theorem Module.Basis.ext_linearIsometryEquiv {ι : Type*} (b : Basis ι R E) {f₁ f₂ : E ≃ₛₗᵢ[σ₁₂] E₂}
(h : ∀ i, f₁ (b i) = f₂ (b i)) : f₁ = f₂ :=
LinearIsometryEquiv.toLinearEquiv_injective <| b.ext' h
/-- Reinterpret a `LinearIsometry` as a `LinearIsometryEquiv` to the range. -/
@[simps! apply_coe]
noncomputable def LinearIsometry.equivRange {R S : Type*} [Semiring R] [Ring S] [Module S E]
[Module R F] {σ₁₂ : R →+* S} {σ₂₁ : S →+* R} [RingHomInvPair σ₁₂ σ₂₁] [RingHomInvPair σ₂₁ σ₁₂]
(f : F →ₛₗᵢ[σ₁₂] E) : F ≃ₛₗᵢ[σ₁₂] (LinearMap.range f.toLinearMap) :=
{ f with toLinearEquiv := LinearEquiv.ofInjective f.toLinearMap f.injective }
namespace MulOpposite
variable {R H : Type*} [Semiring R] [SeminormedAddCommGroup H] [Module R H]
theorem isometry_opLinearEquiv : Isometry (opLinearEquiv R (M := H)) := fun _ _ => rfl
variable (R H) in
/-- The linear isometry equivalence version of the function `op`. -/
@[simps!]
def opLinearIsometryEquiv : H ≃ₗᵢ[R] Hᵐᵒᵖ where
toLinearEquiv := opLinearEquiv R
norm_map' _ := rfl
@[simp]
theorem toLinearEquiv_opLinearIsometryEquiv :
(opLinearIsometryEquiv R H).toLinearEquiv = opLinearEquiv R := rfl
@[simp]
theorem toContinuousLinearEquiv_opLinearIsometryEquiv :
(opLinearIsometryEquiv R H).toContinuousLinearEquiv = opContinuousLinearEquiv R := rfl
end MulOpposite |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Algebra/MatrixExponential.lean | import Mathlib.Analysis.Normed.Algebra.Exponential
import Mathlib.Analysis.Matrix.Normed
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 : 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 𝔸] [IsTopologicalRing 𝔸]
[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 𝔸]
[IsTopologicalRing 𝔸] [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]
[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 :=
open scoped Norms.Operator in exp_add_of_commute h
open scoped Function in -- required for scoped `on` notation
nonrec theorem exp_sum_of_commute {ι} (s : Finset ι) (f : ι → Matrix m m 𝔸)
(h : (s : Set ι).Pairwise (Commute on f)) :
exp 𝕂 (∑ i ∈ s, f i) =
s.noncommProd (fun i => exp 𝕂 (f i)) fun _ hi _ hj _ => (h.of_refl hi hj).exp 𝕂 :=
open scoped Norms.Operator in exp_sum_of_commute s f h
nonrec theorem exp_nsmul (n : ℕ) (A : Matrix m m 𝔸) : exp 𝕂 (n • A) = exp 𝕂 A ^ n :=
open scoped Norms.Operator in exp_nsmul n A
nonrec theorem isUnit_exp (A : Matrix m m 𝔸) : IsUnit (exp 𝕂 A) :=
open scoped Norms.Operator in isUnit_exp _ A
-- TODO: without disabling this instance we get a timeout, see lean4#10414:
-- https://github.com/leanprover/lean4/issues/10414
-- and zulip discussion at
-- https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/Coercion.20instance.20problems.20with.20matrix.20exponential/with/539770030
attribute [-instance] Matrix.SpecialLinearGroup.hasCoeToGeneralLinearGroup in
nonrec theorem exp_units_conj (U : (Matrix m m 𝔸)ˣ) (A : Matrix m m 𝔸) :
exp 𝕂 (U * A * U⁻¹) = U * exp 𝕂 A * U⁻¹ :=
open scoped Norms.Operator in exp_units_conj _ U A
-- TODO: without disabling this instance we get a timeout, see lean4#10414:
-- https://github.com/leanprover/lean4/issues/10414
-- and zulip discussion at
-- https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/Coercion.20instance.20problems.20with.20matrix.20exponential/with/539770030
attribute [-instance] Matrix.SpecialLinearGroup.hasCoeToGeneralLinearGroup in
theorem exp_units_conj' (U : (Matrix m m 𝔸)ˣ) (A : Matrix m m 𝔸) :
exp 𝕂 (U⁻¹ * A * U) = U⁻¹ * exp 𝕂 A * U :=
exp_units_conj 𝕂 U⁻¹ A
end Normed
section NormedComm
variable [RCLike 𝕂] [Fintype m] [DecidableEq m]
[NormedCommRing 𝔸] [NormedAlgebra 𝕂 𝔸] [CompleteSpace 𝔸]
theorem exp_neg (A : Matrix m m 𝔸) : exp 𝕂 (-A) = (exp 𝕂 A)⁻¹ := by
rw [nonsing_inv_eq_ringInverse]
open scoped Norms.Operator in 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 |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Algebra/Ultra.lean | import Mathlib.Analysis.Normed.Field.Ultra
import Mathlib.Analysis.Normed.Module.Basic
/-!
# Normed algebra preserves ultrametricity
This file contains the proof that a normed division ring over an ultrametric field is ultrametric.
-/
variable {K L : Type*} [NormedField K]
variable (L) in
/--
The other direction of `IsUltrametricDist.of_normedAlgebra`.
Let `K` be a normed field. If a seminormed ring `L` is a normed `K`-algebra, and `‖1‖ = 1` in `L`,
then `K` is ultrametric (i.e. the norm on `L` is nonarchimedean) if `F` is.
This can be further generalized to the case where `‖1‖ ≠ 0` in `L`.
-/
theorem IsUltrametricDist.of_normedAlgebra' [SeminormedRing L] [NormOneClass L] [NormedAlgebra K L]
[h : IsUltrametricDist L] : IsUltrametricDist K :=
⟨fun x y z => by
simpa using h.dist_triangle_max (algebraMap K L x) (algebraMap K L y) (algebraMap K L z)⟩
variable (K) in
/--
Let `K` be a normed field. If a normed division ring `L` is a normed `K`-algebra,
then `L` is ultrametric (i.e. the norm on `L` is nonarchimedean) if `K` is.
-/
theorem IsUltrametricDist.of_normedAlgebra [NormedDivisionRing L] [NormedAlgebra K L]
[h : IsUltrametricDist K] : IsUltrametricDist L := by
rw [isUltrametricDist_iff_forall_norm_natCast_le_one] at h ⊢
exact fun n => (algebraMap.coe_natCast (R := K) (A := L) n) ▸ norm_algebraMap' L (n : K) ▸ h n
variable (K L) in
/--
Let `K` be a normed field. If a normed division ring `L` is a normed `K`-algebra,
then `L` is ultrametric (i.e. the norm on `L` is nonarchimedean) if and only if `K` is.
-/
theorem IsUltrametricDist.normedAlgebra_iff [NormedDivisionRing L] [NormedAlgebra K L] :
IsUltrametricDist L ↔ IsUltrametricDist K :=
⟨fun _ => IsUltrametricDist.of_normedAlgebra' L, fun _ => IsUltrametricDist.of_normedAlgebra K⟩ |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Algebra/UnitizationL1.lean | import Mathlib.Algebra.Algebra.TransferInstance
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).isUniformEmbedding |>.mpr
inferInstance
variable {𝕜 A}
open ENNReal in
lemma unitization_norm_def (x : WithLp 1 (Unitization 𝕜 A)) :
‖x‖ = ‖(ofLp x).fst‖ + ‖(ofLp x).snd‖ := calc
‖x‖ = (‖(ofLp x).fst‖ ^ (1 : ℝ≥0∞).toReal +
‖(ofLp x).snd‖ ^ (1 : ℝ≥0∞).toReal) ^ (1 / (1 : ℝ≥0∞).toReal) :=
prod_norm_eq_add (by simp : 0 < (1 : ℝ≥0∞).toReal) _
_ = ‖(ofLp x).fst‖ + ‖(ofLp x).snd‖ := by simp
lemma unitization_nnnorm_def (x : WithLp 1 (Unitization 𝕜 A)) :
‖x‖₊ = ‖(ofLp x).fst‖₊ + ‖(ofLp x).snd‖₊ :=
Subtype.ext <| unitization_norm_def x
lemma unitization_norm_inr (x : A) : ‖toLp 1 (x : Unitization 𝕜 A)‖ = ‖x‖ := by
simp [unitization_norm_def]
lemma unitization_nnnorm_inr (x : A) : ‖toLp 1 (x : Unitization 𝕜 A)‖₊ = ‖x‖₊ := by
simp [unitization_nnnorm_def]
lemma unitization_isometry_inr : Isometry fun x : A ↦ toLp 1 (x : Unitization 𝕜 A) :=
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)) :=
(WithLp.equiv 1 (Unitization 𝕜 A)).ring
@[simp]
lemma unitization_mul (x y : WithLp 1 (Unitization 𝕜 A)) : ofLp (x * y) = ofLp x * ofLp y := rfl
instance {R : Type*} [CommSemiring R] [Algebra R 𝕜] [DistribMulAction R A] [IsScalarTower R 𝕜 A] :
Algebra R (WithLp 1 (Unitization 𝕜 A)) :=
(WithLp.equiv 1 (Unitization 𝕜 A)).algebra R
@[simp]
lemma unitization_algebraMap (r : 𝕜) :
ofLp (algebraMap 𝕜 (WithLp 1 (Unitization 𝕜 A)) r) = algebraMap 𝕜 (Unitization 𝕜 A) r := rfl
/-- `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 where
__ := WithLp.linearEquiv _ R _
map_mul' _ _ := rfl
map_add' _ _ := rfl
commutes' _ := rfl
noncomputable instance instUnitizationNormedRing : NormedRing (WithLp 1 (Unitization 𝕜 A)) where
dist_eq := dist_eq_norm
norm_mul_le 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, ofLp_smul, fst_smul, snd_smul, norm_smul, mul_add]
exact le_rfl
end WithLp |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Algebra/Exponential.lean | import Mathlib.Algebra.Ring.Action.ConjAct
import Mathlib.Analysis.Analytic.ChangeOrigin
import Mathlib.Analysis.Complex.Basic
import Mathlib.Data.Nat.Choose.Cast
import Mathlib.Analysis.Analytic.OfScalars
/-!
# 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 FormalMultilinearSeries
open scoped Nat Topology ENNReal
section TopologicalAlgebra
variable (𝕂 𝔸 : Type*) [Field 𝕂] [Ring 𝔸] [Algebra 𝕂 𝔸] [TopologicalSpace 𝔸] [IsTopologicalRing 𝔸]
/-- `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 𝔸
/-- The exponential series as an `ofScalars` series. -/
theorem expSeries_eq_ofScalars : expSeries 𝕂 𝔸 = ofScalars 𝔸 fun n ↦ (n !⁻¹ : 𝕂) := by
simp_rw [FormalMultilinearSeries.ext_iff, expSeries, ofScalars, implies_true]
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
[`MatrixExponential`](./Mathlib/Analysis/Normed/Algebra/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
/-- The exponential sum as an `ofScalarsSum`. -/
theorem exp_eq_ofScalarsSum : exp 𝕂 = ofScalarsSum (E := 𝔸) fun n ↦ (n !⁻¹ : 𝕂) := by
rw [exp_eq_tsum, ofScalarsSum_eq_tsum]
theorem expSeries_apply_zero (n : ℕ) :
expSeries 𝕂 𝔸 n (fun _ => (0 : 𝔸)) = Pi.single (M := fun _ => 𝔸) 0 1 n := by
rw [expSeries_apply_eq]
rcases 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 (𝕂)
@[aesop safe apply]
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 𝔸]
[IsTopologicalRing 𝔸]
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_comm, ← Finset.mem_antidiagonal.mp hkl,
Nat.cast_add_choose, Finset.mem_antidiagonal.mp hkl]
field_simp [n.factorial_ne_zero]
/-- `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_cancel, 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_cancel, 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
have {n : ℕ} : (Nat.factorial n : 𝕂) ≠ 0 := Nat.cast_ne_zero.mpr (Nat.factorial_ne_zero n)
apply expSeries_eq_ofScalars 𝕂 𝔸 ▸
ofScalars_radius_eq_top_of_tendsto 𝔸 _ (Eventually.of_forall fun n => ?_)
· simp_rw [← norm_div, Nat.factorial_succ, Nat.cast_mul, mul_inv_rev, mul_div_right_comm,
inv_div_inv, norm_mul, div_self this, norm_one, one_mul]
apply norm_zero (E := 𝕂) ▸ Filter.Tendsto.norm
apply (Filter.tendsto_add_atTop_iff_nat (f := fun n => (n : 𝕂)⁻¹) 1).mpr
exact tendsto_inv_atTop_nhds_zero_nat
· simp [this]
theorem expSeries_radius_pos : 0 < (expSeries 𝕂 𝔸).radius := by
rw [expSeries_radius_eq_top]
exact WithTop.top_pos
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, fun_prop]
theorem exp_continuous : Continuous (exp 𝕂 : 𝔸 → 𝔸) := by
rw [← 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,
neg_add_cancel, add_neg_cancel, exp_zero, and_self_iff]
end
open scoped Function in -- required for scoped `on` notation
/-- 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 (Commute on f)) :
exp 𝕂 (∑ i ∈ s, f i) =
s.noncommProd (fun i => exp 𝕂 (f i)) fun _ hi _ hj _ => (h.of_refl hi hj).exp 𝕂 := by
classical
induction s using Finset.induction_on with
| empty => simp
| insert a s ha ih =>
rw [Finset.noncommProd_insert_of_notMem _ _ _ _ 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
| zero => rw [zero_smul, pow_zero, exp_zero]
| succ n ih => 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.coe_exp {ι : 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.coe_exp 𝕂 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 (𝕂)
include 𝕂
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 𝔸] [IsTopologicalRing 𝔸]
/-- 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 |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Algebra/GelfandMazur.lean | import Mathlib.Analysis.Polynomial.Factorization
/-!
# A (new?) proof of the Gelfand-Mazur Theorem
We provide a formalization of proofs of the following versions of the *Gelfand-Mazur Theorem*.
* `NormedAlgebra.Complex.algEquivOfNormMul`: if `F` is a nontrivial normed `ℂ`-algebra
with multiplicative norm, then we obtain a `ℂ`-algebra equivalence with `ℂ`.
This differs from `NormedRing.algEquivComplexOfComplete` in the assumptions: there,
* `F` is assumed to be complete,
* `F` is assumed to be a (nontrivial) division ring,
* but the norm is only required to be submultiplicative.
* `NormedAlgebra.Complex.nonempty_algEquiv`: A nontrivial normed `ℂ`-algebra
with multiplicative norm is isomorphic to `ℂ` as a `ℂ`-algebra.
* `NormedAlgebra.Real.nonempty_algEquiv_or`: if a field `F` is a normed `ℝ`-algebra,
then `F` is isomorphic as an `ℝ`-algebra either to `ℝ` or to `ℂ`.
With some additional work (TODO), this implies a
[Theorem of Ostrowski](https://en.wikipedia.org/wiki/Ostrowski%27s_theorem#Another_Ostrowski's_theorem),
which says that any field that is complete with respect to an archimedean absolute value
is isomorphic to either `ℝ` or `ℂ` as a field with absolute value. The additional input needed
for this is to show that any such field is in fact a normed `ℝ`-algebra.
### The complex case
The proof we use here is a variant of a proof for the complex case (any normed `ℂ`-algebra
is isomorphic to `ℂ`) that is originally due to Ostrowski
[A. Ostrowski, *Über einige Lösungen der Funktionalgleichung φ(x)⋅φ(y)=φ(xy)*
(Section 7)][ostrowski1916].
See also the concise version provided by Peter Scholze on
[Math Overflow](https://mathoverflow.net/questions/10535/ways-to-prove-the-fundamental-theorem-of-algebra/420803#420803).
(In the following, we write `a • 1` instead of `algebraMap _ F a` for easier reading.
In the code, we use `algebraMap`.)
This proof goes as follows. Let `x : F` be arbitrary; we need to show that `x = z • 1`
for some `z : ℂ`. We consider the function `z ↦ ‖x - z • 1‖`. It has a minimum `M`,
which it attains at some point `z₀`, which (upon replacing `x` by `x - z₀ • 1`) we can
assume to be zero. If `M = 0`, we are done, so assume not. For `n : ℕ`,
a primitive `n`th root of unity `ζ : ℂ`, and `z : ℂ` with `|z| < M = ‖x‖` we then have that
`M ≤ ‖x - z • 1‖ = ‖x ^ n - z ^ n • 1‖ / ∏ 0 < k < n, ‖x - (ζ ^ k * z) • 1‖`,
which is bounded by `(M ^ n + |z| ^ n) / M ^ (n - 1) = M * (1 + (|z| / M) ^ n)`.
Letting `n` tend to infinity then shows that `‖x - z • 1‖ = M`
(see `NormedAlgebra.norm_eq_of_isMinOn_of_forall_le`).
This implies that the set of `z` such that `‖x - z • 1‖ = M` is closed and open
(and nonempty), so it is all of `ℂ`, which contradicts `‖x - z • 1‖ ≥ |z| - M`
when `|z|` is sufficiently large.
### The real case
The usual proof for the real case is "either `F` contains a square root of `-1`;
then `F` is in fact a normed `ℂ`-agebra and we can use the result above, or else
we adjoin a square root of `-1` to `F` to obtain a normed `ℂ`-agebra `F'` and
apply the result to `F'`". The difficulty with formalizing this is that (as of October 2025)
Mathlib does not provide a normed `ℂ`-algebra instance for `F'` (neither for
`F' := AdjoinRoot (X ^ 2 + 1 : F[X])` nor for `F' := TensorProduct ℝ ℂ F`),
and it is not so straight-forward to set this up. So we take inspiration from the
proof sketched above for the complex case to obtain a direct proof.
An additional benefit is that this approach minimizes imports.
Since irreducible polynomials over `ℝ` have degree at most `2`, it must be the case
that each element is annihilated by a monic polynomial of degree `2`.
We fix `x : F` in the following.
The space `ℝ × ℝ` of monic polynomials of degree `2` is complete and locally compact
and hence `‖aeval x p‖` gets large when `p` has large coefficients.
This is actually slightly subtle. It is certainly true for `‖x - r • 1‖` with `r : ℝ`.
If the minimum of this is zero, then the minimum for monic polynomials of degree `2`
will also be zero (and is attained on a one-dimensional subset). Otherwise, one can
indeed show that a bound on `‖x ^ 2 - a • x + b • 1‖` implies bounds on `|a|` and `|b|`.
By the first sentence of the previous paragraph, there will be some `p₀`
such that `‖aeval x p₀‖` attains a minimum (see `NormedAlgebra.Real.exists_isMinOn_norm_φ`).
We assume that this is positive and derive a contradiction. Let `M := ‖aeval x p₀‖ > 0`
be the minimal value.
Since every monic polynomial `f : ℝ[X]` of even degree can be written as a product
of monic polynomials of degree `2`
(see `Polynomial.IsMonicOfDegree.eq_isMonicOfDegree_two_mul_isMonicOfDegree`),
it follows that `‖aeval x f‖ ≥ M ^ (f.natDegree / 2)`.
The goal is now to show that when `a` and `b` achieve the minimum `M` of `‖x ^ 2 - a • x + b • 1‖`
and `M > 0`, then we can find some neighborhood `U` of `(a, b)` in `ℝ × ℝ`
such that `‖x ^ 2 - a' • x + b' • 1‖ = M` for all `(a', b') ∈ U`
Then the set `S = {(a', b') | ‖x ^ 2 - a' • x + b' • 1‖ = M}` must be all of `ℝ × ℝ` (as it is
closed, open, and nonempty). (see `NormedAlgebra.Real.norm_φ_eq_norm_φ_of_isMinOn`).
This will lead to a contradiction with the growth of `‖x ^ 2 - a • x‖` as `|a|` gets large.
To get there, the idea is, similarly to the complex case, to use the fact that
`X ^ 2 - a' * X + b'` divides the difference
`(X ^ 2 - a * X + b) ^ n - ((a' - a) * X - (b' - b)) ^ n`;
this gives us a monic polynomial `p` of degree `2 * (n - 1)` such that `(X ^ 2 - a' * X + b') * p`
equals this difference. By the above, `‖aeval x p‖ ≥ M ^ (n - 1)`.
Since `(a', b') ↦ x ^ 2 - a' • x + b' • 1` is continuous, there will be a neighborhood `U`
of `(a, b)` such that
`‖(a' - a) • x - (b' - b) • 1‖ = ‖(x ^ 2 - a • x + b • 1) - (x ^ 2 -a' • x + b' • 1)‖`
is less than `M` for `(a', b') ∈ U`. For such `(a', b')`, it follows that
`‖x ^ 2 - a' • x + b' • 1‖ ≤ ‖(x ^ 2 - a • x + b • 1) ^ n - ((a' - a) • x - (b' - b) • 1) ^ n‖ /`
`‖aeval x p‖`,
which is bounded by `(M ^ n + c ^ n) / M ^ (n - 1) = M * (1 + (c / M) ^ n)`, where
`c = ‖(a' - a) • x - (b' - b) • 1‖ < M`. So, letting `n` tend to infinity, we obtain that
`M ≤ ‖x ^ 2 - a' • x + b' • 1‖ ≤ M`, as desired.
-/
/-!
### Auxiliary results used in both cases
-/
open Polynomial
namespace NormedAlgebra
open Filter Topology Set in
/- The key step: show that the norm of a suitable function is constant if the norm takes
a positive minimum and condition `H` below is satisfied. -/
private lemma norm_eq_of_isMinOn_of_forall_le {X E : Type*} [TopologicalSpace X]
[PreconnectedSpace X] [SeminormedAddCommGroup E] {f : X → E} {M : ℝ} {x : X} (hM : 0 < M)
(hx : ‖f x‖ = M) (h : IsMinOn (‖f ·‖) univ x) (hf : Continuous f)
(H : ∀ {y} z, ‖f y‖ = M → ∀ n > 0, ‖f z‖ ≤ M * (1 + (‖f z - f y‖ / M) ^ n)) (y : X) :
‖f y‖ = M := by
suffices {y | ‖f y‖ = M} = univ by simpa only [← this, hx] using mem_univ y
refine IsClopen.eq_univ ⟨isClosed_eq (by fun_prop) (by fun_prop), ?_⟩ <| nonempty_of_mem hx
rw [isOpen_iff_eventually]
intro w hw
filter_upwards [mem_map.mp <| hf.tendsto w (Metric.ball_mem_nhds (f w) hM)] with u hu
simp only [mem_preimage, Metric.mem_ball, dist_eq_norm, ← div_lt_one₀ hM] at hu
refine le_antisymm ?_ (hx ▸ isMinOn_univ_iff.mp h u)
suffices Tendsto (fun n : ℕ ↦ M * (1 + (‖f u - f w‖ / M) ^ n)) atTop (𝓝 (M * (1 + 0))) by
refine ge_of_tendsto (by simpa) ?_
filter_upwards [Ioi_mem_atTop 0] with n hn
exact H u hw n hn
exact tendsto_pow_atTop_nhds_zero_of_lt_one (by positivity) hu |>.const_add 1 |>.const_mul M
open Filter Bornology Set in
/-- In a normed algebra `F` over a normed field `𝕜` that is a proper space, the function
`z : 𝕜 ↦ ‖x - algebraMap 𝕜 F z‖` achieves a global minimum for every `x : F`. -/
lemma exists_isMinOn_norm_sub_smul (𝕜 : Type*) {F : Type*} [NormedField 𝕜] [ProperSpace 𝕜]
[SeminormedRing F] [NormedAlgebra 𝕜 F] [NormOneClass F] (x : F) :
∃ z : 𝕜, IsMinOn (‖x - algebraMap 𝕜 F ·‖) univ z := by
have : Tendsto (‖x - algebraMap 𝕜 F ·‖) (cobounded 𝕜) atTop := by
exact tendsto_norm_cobounded_atTop |>.comp <| tendsto_const_sub_cobounded x |>.comp <| by simp
simp only [isMinOn_univ_iff]
refine (show Continuous fun z : 𝕜 ↦ ‖x - algebraMap 𝕜 F z‖ by fun_prop)
|>.exists_forall_le_of_isBounded 0 ?_
simpa [isBounded_def, compl_setOf, Ioi] using this (Ioi_mem_atTop ‖x - (0 : 𝕜) • 1‖)
/-!
### The complex case
-/
namespace Complex
variable {F : Type*} [NormedRing F] [NormOneClass F] [NormMulClass F] [NormedAlgebra ℂ F]
/- If the norm of every monic linear polynomial over `ℂ`, evaluated at some `x : F`,
is bounded below by `M`, then the norm of the value at `x - algebraMap ℂ F c` of a monic polynomial
of degree `n` is bounded below by `M ^ n`. This follows by induction from the fact that
every monic polynomial over `ℂ` factors as a product of monic linear polynomials. -/
private lemma le_aeval_of_isMonicOfDegree (x : F) {M : ℝ} (hM : 0 ≤ M)
(h : ∀ z' : ℂ, M ≤ ‖x - algebraMap ℂ F z'‖) {p : ℂ[X]} {n : ℕ} (hp : IsMonicOfDegree p n)
(c : ℂ) :
M ^ n ≤ ‖aeval (x - algebraMap ℂ F c) p‖ := by
induction n generalizing p with
| zero => simp [isMonicOfDegree_zero_iff.mp hp]
| succ n ih =>
obtain ⟨f₁, f₂, hf₁, hf₂, H⟩ := hp.eq_isMonicOfDegree_one_mul_isMonicOfDegree
obtain ⟨r, rfl⟩ := isMonicOfDegree_one_iff.mp hf₁
have H' (y : F) : aeval y (X + C r) = y + algebraMap ℂ F r := by simp
simpa only [pow_succ, mul_comm, H, aeval_mul, H', sub_add, ← map_sub, norm_mul]
using mul_le_mul (ih hf₂) (h (c - r)) hM (norm_nonneg _)
open Set in
/- We show that when `z ↦ ‖x - algebraMap ℂ F z‖` is never zero (and attains a minimum), then
it is constant. This uses the auxiliary result `norm_eq_of_isMinOn_of_forall_le`. -/
private lemma norm_sub_eq_norm_sub_of_isMinOn {x : F} {z : ℂ}
(hz : IsMinOn (‖x - algebraMap ℂ F ·‖) univ z) (H : ∀ z' : ℂ, ‖x - algebraMap ℂ F z'‖ ≠ 0)
(c : ℂ) :
‖x - algebraMap ℂ F c‖ = ‖x - algebraMap ℂ F z‖ := by
set M := ‖x - algebraMap ℂ F z‖ with hMdef
have hM₀ : 0 < M := by have := H z; positivity
refine norm_eq_of_isMinOn_of_forall_le (f := (x - algebraMap ℂ F ·)) hM₀ hMdef.symm hz
(by fun_prop) (fun {y} w hy n hn ↦ ?_) c
dsimp only at hy ⊢
-- show
-- `‖x - algebraMap ℂ F w‖ ≤ M * (1 + (‖x - algebraMap ℂ F w - (x - algebraMap ℂ F y)‖ / M) ^ n)`
rw [sub_sub_sub_cancel_left, ← map_sub, norm_algebraMap, norm_sub_rev y w, norm_one, mul_one,
show M * (1 + (‖w - y‖ / M) ^ n) = (M ^ n + ‖w - y‖ ^ n) / M ^ (n - 1) by
simp only [field, div_pow, ← pow_succ', Nat.sub_add_cancel hn],
le_div_iff₀ (by positivity)]
obtain ⟨p, hp, hrel⟩ :=
(isMonicOfDegree_X_pow ℂ n).of_dvd_sub (by grind)
(isMonicOfDegree_X_sub_one (w - y)) (by compute_degree!) <| sub_dvd_pow_sub_pow X _ n
grw [le_aeval_of_isMonicOfDegree x hM₀.le (isMinOn_univ_iff.mp hz) hp y]
rw [eq_comm, ← eq_sub_iff_add_eq, mul_comm] at hrel
apply_fun (‖aeval (x - algebraMap ℂ F y) ·‖) at hrel
simp only [map_sub, map_mul, aeval_X, aeval_C, sub_sub_sub_cancel_right, norm_mul, map_pow]
at hrel
rw [hrel]
exact (norm_sub_le ..).trans <| by simp [hy, ← map_sub]
/-- If `F` is a normed `ℂ`-algebra and `x : F`, then there is a complex number `z` such that
`‖x - algebraMap ℂ F z‖ = 0` (whence `x = algebraMap ℂ F z`). -/
lemma exists_norm_sub_smul_one_eq_zero (x : F) :
∃ z : ℂ, ‖x - algebraMap ℂ F z‖ = 0 := by
-- there is a minimizing `z : ℂ`; get it.
obtain ⟨z, hz⟩ := exists_isMinOn_norm_sub_smul ℂ x
set M := ‖x - algebraMap ℂ F z‖ with hM
rcases eq_or_lt_of_le (show 0 ≤ M from norm_nonneg _) with hM₀ | hM₀
-- minimum is zero: nothing to do
· exact ⟨z, hM₀.symm⟩
-- otherwise, use the result from above that `z ↦ ‖x - algebraMap ℂ F z‖` is constant
-- to derive a contradiction.
by_contra! H
have key := norm_sub_eq_norm_sub_of_isMinOn hz H (‖x‖ + M + 1)
rw [← hM, norm_sub_rev] at key
replace key := (norm_sub_norm_le ..).trans_eq key
rw [norm_algebraMap, norm_one, mul_one] at key
norm_cast at key
rw [Real.norm_eq_abs, abs_of_nonneg (by positivity)] at key
linarith only [key]
variable (F) [Nontrivial F]
open Algebra in
/-- A version of the **Gelfand-Mazur Theorem**.
If `F` is a nontrivial normed `ℂ`-algebra with multiplicative norm, then we obtain a
`ℂ`-algebra equivalence with `ℂ`. -/
noncomputable
def algEquivOfNormMul : ℂ ≃ₐ[ℂ] F :=
.ofBijective (ofId ℂ F) <| by
refine ⟨FaithfulSMul.algebraMap_injective ℂ F, fun x ↦ ?_⟩
obtain ⟨z, hz⟩ := exists_norm_sub_smul_one_eq_zero x
refine ⟨z, ?_⟩
rwa [norm_eq_zero, sub_eq_zero, eq_comm, ← ofId_apply] at hz
/-- A version of the **Gelfand-Mazur Theorem** for nontrivial normed `ℂ`-algebras `F`
with multiplicative norm: any such `F` is isomorphic to `ℂ` as a `ℂ`-algebra. -/
theorem nonempty_algEquiv : Nonempty (ℂ ≃ₐ[ℂ] F) := ⟨algEquivOfNormMul F⟩
end Complex
/-!
### The real case
-/
namespace Real
variable {F : Type*} [NormedRing F] [NormedAlgebra ℝ F]
/- A (private) abbreviation introduced for conciseness below.
We will show that for every `x : F`, `φ x` takes the value zero. -/
private abbrev φ (x : F) (u : ℝ × ℝ) : F := x ^ 2 - u.1 • x + algebraMap ℝ F u.2
private lemma continuous_φ (x : F) : Continuous (φ x) := by fun_prop
private lemma aeval_eq_φ (x : F) (u : ℝ × ℝ) : aeval x (X ^ 2 - C u.1 * X + C u.2) = φ x u := by
simp [Algebra.smul_def]
variable [NormOneClass F] [NormMulClass F]
/- If, for some `x : F`, `‖φ x ·‖` is bounded below by `M`, then the value at `x` of any monic
polynomial over `ℝ` of degree `2 * n` has norm bounded below by `M ^ n`. This follows by
induction from the fact that a real monic polynomial of even degree is a product of monic
polynomials of degree `2`. -/
private lemma le_aeval_of_isMonicOfDegree {x : F} {M : ℝ} (hM : 0 ≤ M)
(h : ∀ z : ℝ × ℝ, M ≤ ‖φ x z‖) {p : ℝ[X]} {n : ℕ} (hp : IsMonicOfDegree p (2 * n)) :
M ^ n ≤ ‖aeval x p‖ := by
induction n generalizing p with
| zero => simp_all
| succ n ih =>
rw [mul_add, mul_one] at hp
obtain ⟨f₁, f₂, hf₁, hf₂, H⟩ := hp.eq_isMonicOfDegree_two_mul_isMonicOfDegree
obtain ⟨a, b, hab⟩ := isMonicOfDegree_two_iff'.mp hf₁
rw [H, aeval_mul, norm_mul, mul_comm, pow_succ, hab, aeval_eq_φ x (a, b)]
exact mul_le_mul (ih hf₂) (h (a, b)) hM (norm_nonneg _)
/- The key step in the proof: if `a` and `b` are real numbers minimizing `‖φ x (a, b)‖`,
and the minimal value is strictly positive, then the function `(s, t) ↦ ‖φ x (s, t)‖`
is constant. -/
private lemma norm_φ_eq_norm_φ_of_isMinOn {x : F} {z : ℝ × ℝ} (h : IsMinOn (‖φ x ·‖) Set.univ z)
(H : ‖φ x z‖ ≠ 0) (w : ℝ × ℝ) :
‖φ x w‖ = ‖φ x z‖ := by
set M : ℝ := ‖φ x z‖ with hM
have hM₀ : 0 < M := by positivity
-- we use the key result `norm_eq_of_isMinOn_of_forall_le`
refine norm_eq_of_isMinOn_of_forall_le hM₀ hM.symm h (continuous_φ x) (fun {w} u hw n hn ↦ ?_) w
-- show `‖φ x u‖ ≤ M * (1 + (‖φ x u - φ x w‖ / M) ^ n)`
have HH : M * (1 + (‖φ x u - φ x w‖ / M) ^ n) = (M ^ n + ‖φ x u - φ x w‖ ^ n) / M ^ (n - 1) := by
simp only [field, div_pow, ← pow_succ', Nat.sub_add_cancel hn]
rw [HH, le_div_iff₀ (by positivity)]; clear HH
-- show `‖φ x u‖ * M ^ (n - 1) ≤ M ^ n + ‖φ x u - φ x w‖ ^ n`
let q (y : ℝ × ℝ) : ℝ[X] := X ^ 2 - C y.1 * X + C y.2
have hq (y : ℝ × ℝ) : IsMonicOfDegree (q y) 2 := isMonicOfDegree_sub_add_two ..
have hsub : q w - q u = (C u.1 - C w.1) * X + C w.2 - C u.2 := by simp only [q]; ring
have hdvd : q u ∣ q w ^ n - (q w - q u) ^ n := by
nth_rewrite 1 [← sub_sub_self (q w) (q u)]
exact sub_dvd_pow_sub_pow ..
have H' : ((q w - q u) ^ n).natDegree < 2 * n := by rw [hsub]; compute_degree; grind
-- write `q w ^ n = p * q u + (q w - q u) ^ n` with a monic polynomial `p` of deg. `2 * (n - 1)`,
-- where `aeval x (q u) = φ x u` (*).
obtain ⟨p, hp, hrel⟩ := ((hq w).pow n).of_dvd_sub (by grind) (hq u) H' hdvd; clear H' hdvd hsub
rw [show 2 * n - 2 = 2 * (n - 1) by grind] at hp
-- use that `‖aeval p x‖ ≥ M ^ (n - 1)`.
grw [le_aeval_of_isMonicOfDegree hM₀.le (isMinOn_univ_iff.mp h) hp]
-- from (*) above, deduce
-- `‖φ x u‖ * ‖(aeval x) p‖ = ‖(aeval x) (q w ^ n) - (aeval x) ((q w - q u) ^ n)‖`
-- and use that.
rw [← sub_eq_iff_eq_add, eq_comm, mul_comm] at hrel
apply_fun (‖aeval x ·‖) at hrel
rw [map_mul, norm_mul, map_sub, aeval_eq_φ x u] at hrel
rw [hrel, norm_sub_rev (φ ..)]
exact (norm_sub_le ..).trans <| by simp [q, aeval_eq_φ, hw]
open Filter Topology Bornology in
/- Assuming that `‖x - algebraMap ℝ F ·‖` is bounded below by a positive constant, we show that
`φ x w` grows unboundedly as `w : ℝ × ℝ` does. We will use this to obtain a contradiction
when `φ x` does not attain the value zero. -/
private lemma tendsto_φ_cobounded {x : F} {c : ℝ} (hc₀ : 0 < c)
(hbd : ∀ r : ℝ, c ≤ ‖x - algebraMap ℝ F r‖) :
Tendsto (φ x ·) (cobounded (ℝ × ℝ)) (cobounded F) := by
simp_rw [φ, sub_add]
refine tendsto_const_sub_cobounded _ |>.comp ?_
rw [← tendsto_norm_atTop_iff_cobounded]
-- split into statements involving each of the two components separately.
refine Tendsto.coprod_of_prod_top_right (α := ℝ) (fun s hs ↦ ?_) ?_
-- the first component is bounded and the second one is unbounded
· rw [← isCobounded_def, ← isBounded_compl_iff] at hs
obtain ⟨M, hM_pos, hM⟩ : ∃ M > 0, ∀ y ∈ sᶜ, ‖y‖ ≤ M := hs.exists_pos_norm_le
suffices Tendsto (‖algebraMap ℝ F ·.2‖ - M * ‖x‖) (𝓟 sᶜ ×ˢ cobounded ℝ) atTop by
refine tendsto_atTop_mono' _ ?_ this
filter_upwards [prod_mem_prod (mem_principal_self sᶜ) univ_mem] with w hw
rw [norm_sub_rev]
refine le_trans ?_ (norm_sub_norm_le ..)
specialize hM _ (Set.mem_prod.mp hw).1
simp only [norm_algebraMap', norm_smul]
gcongr
simp only [norm_algebraMap', sub_eq_add_neg]
exact tendsto_atTop_add_const_right _ _ <| tendsto_norm_atTop_iff_cobounded.mpr tendsto_snd
-- the first component is unbounded and the second one is arbitrary
· suffices Tendsto (fun y : ℝ × ℝ ↦ ‖y.1‖ * c) (cobounded ℝ ×ˢ ⊤) atTop by
refine tendsto_atTop_mono' _ ?_ this
filter_upwards [prod_mem_prod (isBounded_singleton (x := 0)) univ_mem] with y hy
calc ‖y.1‖ * c
_ ≤ ‖y.1‖ * ‖x - algebraMap ℝ F (y.1⁻¹ * y.2)‖ := by gcongr; exact hbd _
_ = ‖y.1 • x - algebraMap ℝ F y.2‖ := by
simp only [← norm_smul, smul_sub, smul_smul, Algebra.algebraMap_eq_smul_one]
simp_all
rw [tendsto_mul_const_atTop_of_pos hc₀, tendsto_norm_atTop_iff_cobounded]
exact tendsto_fst
open Bornology Filter Set in
/- The norm of `‖φ x ·‖` attains a minimum on `ℝ × ℝ`. -/
private lemma exists_isMinOn_norm_φ (x : F) : ∃ z : ℝ × ℝ, IsMinOn (‖φ x ·‖) univ z := by
-- use that `‖x - algebraMap ℝ F ·‖` has a minimum.
obtain ⟨u, hu⟩ := exists_isMinOn_norm_sub_smul ℝ x
rcases eq_or_lt_of_le (norm_nonneg (x - algebraMap ℝ F u)) with hc₀ | hc₀
-- if this minimum is zero, use `(u, 0)`.
· rw [eq_comm, norm_eq_zero, sub_eq_zero] at hc₀
exact ⟨(u, 0), fun _ ↦ by simp [φ, hc₀, sq, Algebra.smul_def]⟩
-- otherwise, use `tendsto_φ_cobounded`.
simp only [isMinOn_univ_iff] at hu ⊢
refine (continuous_φ x).norm.exists_forall_le_of_isBounded (0, 0) ?_
simpa [isBounded_def, compl_setOf, Ioi]
using tendsto_norm_cobounded_atTop.comp (tendsto_φ_cobounded hc₀ hu) (Ioi_mem_atTop _)
open Algebra in
/-- If `F` is a normed `ℝ`-algebra with a multiplicative norm (and such that `‖1‖ = 1`),
e.g., a normed division ring, then every `x : F` is the root of a monic quadratic polynomial
with real coefficients. -/
lemma exists_isMonicOfDegree_two_and_aeval_eq_zero (x : F) :
∃ p : ℝ[X], IsMonicOfDegree p 2 ∧ aeval x p = 0 := by
-- take the minimizer of `‖φ x ·‖` ...
obtain ⟨z, h⟩ := exists_isMinOn_norm_φ x
-- ... and show that the minimum is zero.
suffices φ x z = 0 from ⟨_, isMonicOfDegree_sub_add_two z.1 z.2, by rwa [aeval_eq_φ]⟩
by_contra! H
set M := ‖φ x z‖
-- use that `‖φ x ·‖` is constant *and* is unbounded to produce a contradiction.
have h' (r : ℝ) : √M ≤ ‖x - algebraMap ℝ F r‖ := by
rw [← sq_le_sq₀ M.sqrt_nonneg (norm_nonneg _), Real.sq_sqrt (norm_nonneg _), ← norm_pow,
Commute.sub_sq <| algebraMap_eq_smul_one (A := F) r ▸ commute_algebraMap_right r x]
convert isMinOn_univ_iff.mp h (2 * r, r ^ 2) using 4 <;>
simp [two_mul, add_mul, ← commutes, smul_def, mul_add]
have := tendsto_norm_atTop_iff_cobounded.mpr <| tendsto_φ_cobounded (by positivity) h'
simp only [norm_φ_eq_norm_φ_of_isMinOn h (norm_ne_zero_iff.mpr H)] at this
exact Filter.not_tendsto_const_atTop _ _ this
/-- A version of the **Gelfand-Mazur Theorem** over `ℝ`.
If a field `F` is a normed `ℝ`-algebra, then `F` is isomorphic as an `ℝ`-algebra
either to `ℝ` or to `ℂ`. -/
theorem nonempty_algEquiv_or (F : Type*) [NormedField F] [NormedAlgebra ℝ F] :
Nonempty (F ≃ₐ[ℝ] ℝ) ∨ Nonempty (F ≃ₐ[ℝ] ℂ) := by
have : Algebra.IsAlgebraic ℝ F := by
refine ⟨fun x ↦ ?_⟩
obtain ⟨f, hf, hfx⟩ := exists_isMonicOfDegree_two_and_aeval_eq_zero x
exact ⟨f, hf.ne_zero, hfx⟩
exact _root_.Real.nonempty_algEquiv_or F
end Real
end NormedAlgebra |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Algebra/Basic.lean | 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) : ‖toStrongDual (φ : 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 ⊆ toStrongDual ⁻¹' 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 |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Algebra/GelfandFormula.lean | import Mathlib.Analysis.Analytic.RadiusLiminf
import Mathlib.Analysis.Complex.Liouville
import Mathlib.Analysis.Complex.Polynomial.Basic
import Mathlib.Analysis.Normed.Algebra.Spectrum
/-!
# Gelfand's formula and other results on the spectrum in complex Banach algebras
This file contains results on the spectrum of elements in a complex Banach algebra, including
**Gelfand's formula** and the **Gelfand-Mazur theorem** and the fact that every element in a
complex Banach algebra has nonempty spectrum.
## Main results
* `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.
* `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`
-/
variable {𝕜 A : Type*}
open scoped NNReal Topology
open Filter ENNReal
namespace spectrum
theorem hasDerivAt_resolvent [NontriviallyNormedField 𝕜] [NormedRing A] [NormedAlgebra 𝕜 A]
[CompleteSpace A] {a : A} {k : 𝕜} (hk : k ∈ resolventSet 𝕜 a) :
HasDerivAt (resolvent a) (-resolvent a k ^ 2) k := by
have H₁ : HasFDerivAt Ring.inverse _ (algebraMap 𝕜 A k - a) :=
hasFDerivAt_ringInverse (𝕜 := 𝕜) hk.unit
have H₂ : HasDerivAt (fun k => algebraMap 𝕜 A 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₂
open ENNReal in
/-- 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 [NontriviallyNormedField 𝕜] [NormedRing A]
[NormedAlgebra 𝕜 A] [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
section Complex
variable [NormedRing A] [NormedAlgebra ℂ A] [CompleteSpace A]
open ContinuousMultilinearMap in
/-- 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)
alias gelfand_formula := pow_nnnorm_pow_one_div_tendsto_nhds_spectralRadius
/- 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 _)
section Nontrivial
variable [Nontrivial A]
/-- In a (nontrivial) complex Banach algebra, every element has nonempty spectrum. -/
protected theorem nonempty (a : A) : (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 (a : A) :
∃ 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 (a : A) {r : ℝ≥0}
(hr : ∀ z ∈ spectrum ℂ a, ‖z‖₊ < r) : spectralRadius ℂ a < r :=
spectralRadius_lt_of_forall_lt_of_nonempty (spectrum.nonempty a) hr
open Polynomial in
/-- The **spectral mapping theorem** for polynomials in a Banach algebra over `ℂ`. -/
theorem map_polynomial_aeval (a : A) (p : ℂ[X]) :
spectrum ℂ (aeval a p) = (fun k => eval k p) '' spectrum ℂ a :=
map_polynomial_aeval_of_nonempty a p (spectrum.nonempty a)
open Polynomial in
/-- A specialization of the spectral mapping theorem for polynomials in a Banach algebra over `ℂ`
to monic monomials. -/
protected theorem map_pow (a : A) (n : ℕ) :
spectrum ℂ (a ^ n) = (· ^ n) '' spectrum ℂ a := by
simpa only [aeval_X_pow, eval_X_pow] using map_polynomial_aeval a (X ^ n)
end Nontrivial
omit [CompleteSpace A] in
theorem algebraMap_eq_of_mem (hA : ∀ {a : A}, IsUnit a ↔ a ≠ 0) {a : A} {z : ℂ}
(h : z ∈ spectrum ℂ 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 (hA : ∀ {a : A}, IsUnit a ↔ a ≠ 0)
[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 Complex
end spectrum |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Algebra/QuaternionExponential.lean | 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.re_im, ← 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, re_smul, re_smul, re_star, re_im,
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 |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Algebra/Unitization.lean | import Mathlib.Algebra.Algebra.Unitization
import Mathlib.Analysis.Normed.Operator.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]
/-- 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 [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 : IsUniformInducing (addEquiv 𝕜 A) :=
antilipschitzWith_addEquiv.isUniformInducing 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.toUniformEquivOfIsUniformInducing (addEquiv 𝕜 A) ⟨rfl⟩
/-- The bornology on `Unitization 𝕜 A` is inherited from `𝕜 × A`. -/
instance instBornology : Bornology (Unitization 𝕜 A) :=
Bornology.induced <| addEquiv 𝕜 A
theorem isUniformEmbedding_addEquiv {𝕜} [NontriviallyNormedField 𝕜] :
IsUniformEmbedding (addEquiv 𝕜 A) where
comap_uniformity := rfl
injective := (addEquiv 𝕜 A).injective
/-- `Unitization 𝕜 A` is complete whenever `𝕜` and `A` are also. -/
instance instCompleteSpace [CompleteSpace 𝕜] [CompleteSpace A] :
CompleteSpace (Unitization 𝕜 A) :=
uniformEquivProd.completeSpace_iff.2 .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_le := normedRingAux.norm_mul_le
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 https://github.com/leanprover-community/mathlib4/pull/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
@[fun_prop]
theorem continuous_inr : Continuous (inr : A → Unitization 𝕜 A) :=
isometry_inr.continuous
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 |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Algebra/TrivSqZeroExt.lean | 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.instL1IsBoundedSMul`
* `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]
[IsTopologicalRing R] [IsTopologicalAddGroup 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]
[IsTopologicalRing R] [IsTopologicalAddGroup 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 _ ↦ 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]
[IsTopologicalRing R] [IsTopologicalAddGroup 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]
[IsTopologicalRing R] [IsTopologicalAddGroup 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 [IsBoundedSMul S R] [IsBoundedSMul S M]
instance instL1SeminormedAddCommGroup : SeminormedAddCommGroup (tsze R M) :=
WithLp.seminormedAddCommGroupToProd 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.norm_seminormedAddCommGroupToProd, WithLp.prod_norm_eq_add (by norm_num)]
simp only [WithLp.toLp_fst, ENNReal.toReal_one, Real.rpow_one, WithLp.toLp_snd, ne_eq,
one_ne_zero, not_false_eq_true, div_self, fst, snd]
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] [IsBoundedSMul R M] [Module Rᵐᵒᵖ M] [IsBoundedSMul Rᵐᵒᵖ M]
[SMulCommClass R Rᵐᵒᵖ M]
instance instL1SeminormedRing : SeminormedRing (tsze R M) where
norm_mul_le
| ⟨r₁, m₁⟩, ⟨r₂, m₂⟩ => by
simp_rw [norm_def]
calc ‖r₁ * r₂‖ + ‖r₁ • m₂ + MulOpposite.op r₂ • m₁‖
_ ≤ ‖r₁‖ * ‖r₂‖ + (‖r₁‖ * ‖m₂‖ + ‖r₂‖ * ‖m₁‖) := by
gcongr
· apply norm_mul_le
· refine norm_add_le_of_le ?_ ?_ <;>
apply norm_smul_le
_ ≤ ‖r₁‖ * ‖r₂‖ + (‖r₁‖ * ‖m₂‖ + ‖r₂‖ * ‖m₁‖) + (‖m₁‖ * ‖m₂‖) := by
apply le_add_of_nonneg_right
positivity
_ = (‖r₁‖ + ‖m₁‖) * (‖r₂‖ + ‖m₂‖) := by ring
__ : SeminormedAddCommGroup (tsze R M) := inferInstance
__ : Ring (tsze R M) := inferInstance
instance instL1IsBoundedSMul : IsBoundedSMul S (tsze R M) :=
WithLp.isBoundedSMulSeminormedAddCommGroupToProd 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 [IsBoundedSMul 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 [NormedRing R] [NormedAddCommGroup M] [Module R M] [Module Rᵐᵒᵖ M]
variable [IsBoundedSMul R M] [IsBoundedSMul Rᵐᵒᵖ M] [SMulCommClass R Rᵐᵒᵖ M]
instance instL1NormedAddCommGroup : NormedAddCommGroup (tsze R M) :=
WithLp.normedAddCommGroupToProd 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 [IsBoundedSMul 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 [IsBoundedSMul R M] [IsBoundedSMul Rᵐᵒᵖ M] [SMulCommClass R Rᵐᵒᵖ M]
variable [IsScalarTower 𝕜 R M] [IsScalarTower 𝕜 Rᵐᵒᵖ M]
instance instL1NormedSpace : NormedSpace 𝕜 (tsze R M) :=
WithLp.normedSpaceSeminormedAddCommGroupToProd 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 [IsBoundedSMul R M] [IsBoundedSMul 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 |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Algebra/DualNumber.lean | import Mathlib.Algebra.DualNumber
import Mathlib.Analysis.Normed.Algebra.TrivSqZeroExt
/-!
# Results on `DualNumber R` related to the norm
These are just restatements of similar statements about `TrivSqZeroExt R M`.
## Main results
* `exp_eps`
-/
open NormedSpace -- For `NormedSpace.exp`.
namespace DualNumber
open TrivSqZeroExt
variable (𝕜 : Type*) {R : Type*}
variable [Field 𝕜] [CharZero 𝕜] [CommRing R] [Algebra 𝕜 R]
variable [UniformSpace R] [IsTopologicalRing R] [T2Space R]
@[simp]
theorem exp_eps : exp 𝕜 (eps : DualNumber R) = 1 + eps :=
exp_inr _ _
@[simp]
theorem exp_smul_eps (r : R) : exp 𝕜 (r • eps : DualNumber R) = 1 + r • eps := by
rw [eps, ← inr_smul, exp_inr]
end DualNumber |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Algebra/Spectrum.lean | import Mathlib.Algebra.Algebra.Spectrum.Quasispectrum
import Mathlib.Analysis.Real.Spectrum
import Mathlib.Analysis.Normed.Algebra.Exponential
import Mathlib.Analysis.Normed.Algebra.UnitizationL1
import Mathlib.Analysis.Normed.Ring.Units
import Mathlib.Analysis.SpecialFunctions.Pow.Continuity
import Mathlib.FieldTheory.IsAlgClosed.Spectrum
import Mathlib.Topology.Algebra.Module.CharacterSpace
/-!
# The spectrum of elements in a complete normed algebra
This file contains the basic theory for the resolvent and spectrum of a Banach algebra.
Theorems specific to *complex* Banach algebras, such as *Gelfand's formula* can be found in
`Mathlib/Analysis/Normed/Algebra/GelfandFormula.lean`.
## Main definitions
* `spectralRadius : ℝ≥0∞`: supremum of `‖k‖₊` for all `k ∈ 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.
-/
assert_not_exists ProbabilityTheory.cond
assert_not_exists HasFDerivAt
open NormedSpace Topology -- For `NormedSpace.exp`.
open scoped ENNReal NNReal
/-- 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 𝕜]
local notation "σ" => spectrum 𝕜
local notation "ρ" => resolventSet 𝕜
local notation "↑ₐ" => algebraMap 𝕜 A
section Algebra
variable [Ring A] [Algebra 𝕜 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]
@[simp]
theorem spectralRadius_one [Nontrivial A] :
spectralRadius 𝕜 (1 : A) = 1 := by
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_ge <| le_iSup₂ (α := ℝ≥0∞) k hn
lemma spectralRadius_pow_le (a : A) (n : ℕ) (hn : n ≠ 0) :
(spectralRadius 𝕜 a) ^ n ≤ spectralRadius 𝕜 (a ^ n) := by
simp only [spectralRadius, ENNReal.iSup₂_pow_of_ne_zero _ hn]
refine iSup₂_le fun x hx ↦ ?_
apply le_iSup₂_of_le (x ^ n) (spectrum.pow_mem_pow a n hx)
simp
lemma spectralRadius_pow_le' [Nontrivial A] (a : A) (n : ℕ) :
(spectralRadius 𝕜 a) ^ n ≤ spectralRadius 𝕜 (a ^ n) := by
cases n
· simp
· exact spectralRadius_pow_le a _ (by simp)
end Algebra
variable [NormedRing A] [NormedAlgebra 𝕜 A] [CompleteSpace A]
theorem isOpen_resolventSet (a : A) : IsOpen (ρ a) :=
Units.isOpen.preimage ((continuous_algebraMap 𝕜 A).sub continuous_const)
@[simp]
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_gt <| 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_gt <| 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]
@[simp]
theorem isBounded (a : A) : Bornology.IsBounded (σ a) :=
Metric.isBounded_closedBall.subset (subset_closedBall_norm_mul a)
@[simp]
protected theorem isCompact [ProperSpace 𝕜] (a : A) : IsCompact (σ a) :=
Metric.isCompact_of_isClosed_isBounded (spectrum.isClosed a) (isBounded a)
grind_pattern spectrum.isCompact => IsCompact (spectrum 𝕜 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 isClosed_nonneg.isClosedEmbedding_subtypeVal.isCompact_preimage <| by assumption
@[simp]
theorem isCompact_nnreal {A : Type*} [NormedRing A] [NormedAlgebra ℝ A]
(a : A) [CompactSpace (spectrum ℝ a)] : IsCompact (spectrum ℝ≥0 a) := by
rw [isCompact_iff_compactSpace]
infer_instance
grind_pattern isCompact_nnreal => IsCompact (spectrum ℝ≥0 a)
section QuasispectrumCompact
variable {B : Type*} [NonUnitalNormedRing B] [NormedSpace 𝕜 B] [CompleteSpace B]
variable [IsScalarTower 𝕜 B B] [SMulCommClass 𝕜 B B] [ProperSpace 𝕜]
@[simp]
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 _
grind_pattern quasispectrum.isCompact => IsCompact (quasispectrum 𝕜 a)
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 isClosed_nonneg.isClosedEmbedding_subtypeVal.isCompact_preimage <| by assumption
omit [CompleteSpace B] in
@[simp]
theorem _root_.quasispectrum.isCompact_nnreal [NormedSpace ℝ B] [IsScalarTower ℝ B B]
[SMulCommClass ℝ B B] (a : B) [CompactSpace (quasispectrum ℝ a)] :
IsCompact (quasispectrum ℝ≥0 a) := by
rw [isCompact_iff_compactSpace]
infer_instance
grind_pattern quasispectrum.isCompact_nnreal => IsCompact (quasispectrum ℝ≥0 a)
end QuasispectrumCompact
section NNReal
open NNReal
variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] [CompleteSpace A] [NormOneClass A]
theorem le_nnnorm_of_mem {a : A} {r : ℝ≥0} (hr : r ∈ spectrum ℝ≥0 a) :
r ≤ ‖a‖₊ := calc
r ≤ ‖(r : ℝ)‖ := Real.le_norm_self _
_ ≤ ‖a‖ := norm_le_norm_of_mem hr
theorem coe_le_norm_of_mem {a : A} {r : ℝ≥0} (hr : r ∈ spectrum ℝ≥0 a) :
r ≤ ‖a‖ :=
coe_mono <| le_nnnorm_of_mem hr
end NNReal
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
continuous_enorm.continuousOn (r : ℝ≥0∞)).mpr (by simpa using 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']
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 (by simp [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
grw [hN (n + N + 1) (by cutsat)]
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 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
/-- 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 [HasSummableGeomSeries 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]
rcases n with - | n
· simp only [le_refl, mul_one, or_true, le_max_iff, pow_zero]
· grw [nnnorm_pow_le' a n.succ_pos, ← 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, (summable_geometric_of_norm_lt_one norm_lt).hasSum_iff] using
(NormedRing.inverse_one_sub _ norm_lt).symm }
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]
end OneSubSMul
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]
gcongr
· exact norm_pow_le' _ (pos_iff_ne_zero.mpr hn)
· exact n.le_succ
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 (expSeries_summable' (𝕂 := 𝕜) (a - ↑ₐ z)).tsum_eq_zero_add
· 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 →ₐ[𝕜] 𝕜) : StrongDual 𝕜 A :=
{ φ.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⟩ }
@[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
section BoundarySpectrum
local notation "σ" => spectrum
variable {𝕜 A SA : Type*} [NormedRing A] [CompleteSpace A] [SetLike SA A] [SubringClass SA A]
open Topology Filter Set
section NormedField
variable [NormedField 𝕜] [NormedAlgebra 𝕜 A] [instSMulMem : SMulMemClass SA 𝕜 A]
variable (S : SA) [hS : IsClosed (S : Set A)] (x : S)
open SubalgebraClass in
include instSMulMem in
/-- Let `S` be a closed subalgebra of a Banach algebra `A`. If `a : S` is invertible in `A`,
and for all `x : S` sufficiently close to `a` within some filter `l`, `x` is invertible in `S`,
then `a` is invertible in `S` as well. -/
lemma _root_.Subalgebra.isUnit_of_isUnit_val_of_eventually {l : Filter S} {a : S}
(ha : IsUnit (a : A)) (hla : l ≤ 𝓝 a) (hl : ∀ᶠ x in l, IsUnit x) (hl' : l.NeBot) :
IsUnit a := by
have hla₂ : Tendsto Ring.inverse (map (val S) l) (𝓝 (↑ha.unit⁻¹ : A)) := by
rw [← Ring.inverse_unit]
exact (NormedRing.inverse_continuousAt _).tendsto.comp <|
continuousAt_subtype_val.tendsto.comp <| map_mono hla
suffices mem : (↑ha.unit⁻¹ : A) ∈ S by
refine ⟨⟨a, ⟨(↑ha.unit⁻¹ : A), mem⟩, ?_, ?_⟩, rfl⟩
all_goals ext; simp
apply hS.mem_of_tendsto hla₂
rw [Filter.eventually_map]
apply hl.mono fun x hx ↦ ?_
suffices Ring.inverse (val S x) = (val S ↑hx.unit⁻¹) from this ▸ Subtype.property _
rw [← (hx.map (val S)).unit_spec, Ring.inverse_unit (hx.map (val S)).unit, val]
apply Units.mul_eq_one_iff_inv_eq.mp
simpa [-IsUnit.mul_val_inv] using congr(($hx.mul_val_inv : A))
/-- If `S : Subalgebra 𝕜 A` is a closed subalgebra of a Banach algebra `A`, then for any
`x : S`, the boundary of the spectrum of `x` relative to `S` is a subset of the spectrum of
`↑x : A` relative to `A`. -/
lemma _root_.Subalgebra.frontier_spectrum : frontier (σ 𝕜 x) ⊆ σ 𝕜 (x : A) := by
have : CompleteSpace S := hS.completeSpace_coe
intro μ hμ
by_contra h
rw [spectrum.notMem_iff] at h
rw [← frontier_compl, (spectrum.isClosed _).isOpen_compl.frontier_eq, mem_diff] at hμ
obtain ⟨hμ₁, hμ₂⟩ := hμ
rw [mem_closure_iff_clusterPt] at hμ₁
apply hμ₂
rw [mem_compl_iff, spectrum.notMem_iff]
refine Subalgebra.isUnit_of_isUnit_val_of_eventually S h ?_ ?_ <| .map hμ₁ (algebraMap 𝕜 S · - x)
· calc
_ ≤ map _ (𝓝 μ) := map_mono (by simp)
_ ≤ _ := by rw [← Filter.Tendsto, ← ContinuousAt]; fun_prop
· rw [eventually_map]
apply Eventually.filter_mono inf_le_right
simp [spectrum.notMem_iff]
/-- If `S` is a closed subalgebra of a Banach algebra `A`, then for any `x : S`, the boundary of
the spectrum of `x` relative to `S` is a subset of the boundary of the spectrum of `↑x : A`
relative to `A`. -/
lemma Subalgebra.frontier_subset_frontier :
frontier (σ 𝕜 x) ⊆ frontier (σ 𝕜 (x : A)) := by
rw [frontier_eq_closure_inter_closure (s := σ 𝕜 (x : A)),
(spectrum.isClosed (x : A)).closure_eq]
apply subset_inter (frontier_spectrum S x)
rw [frontier_eq_closure_inter_closure]
exact inter_subset_right |>.trans <|
closure_mono <| compl_subset_compl.mpr <| spectrum.subset_subalgebra x
open Set Notation
/-- If `S` is a closed subalgebra of a Banach algebra `A`, then for any `x : S`, the spectrum of `x`
is the spectrum of `↑x : A` along with the connected components of the complement of the spectrum of
`↑x : A` which contain an element of the spectrum of `x : S`. -/
lemma Subalgebra.spectrum_sUnion_connectedComponentIn :
σ 𝕜 x = σ 𝕜 (x : A) ∪ (⋃ z ∈ (σ 𝕜 x \ σ 𝕜 (x : A)), connectedComponentIn (σ 𝕜 (x : A))ᶜ z) := by
suffices IsClopen ((σ 𝕜 (x : A))ᶜ ↓∩ (σ 𝕜 x \ σ 𝕜 (x : A))) by
rw [← this.biUnion_connectedComponentIn (diff_subset_compl _ _),
union_diff_cancel (spectrum.subset_subalgebra x)]
have : CompleteSpace S := hS.completeSpace_coe
have h_open : IsOpen (σ 𝕜 x \ σ 𝕜 (x : A)) := by
rw [← (spectrum.isClosed (𝕜 := 𝕜) x).closure_eq, closure_eq_interior_union_frontier,
union_diff_distrib, diff_eq_empty.mpr (frontier_spectrum S x),
diff_eq_compl_inter, union_empty]
exact (spectrum.isClosed _).isOpen_compl.inter isOpen_interior
apply isClopen_preimage_val h_open
suffices h_frontier : frontier (σ 𝕜 x \ σ 𝕜 (x : A)) ⊆ frontier (σ 𝕜 (x : A)) from
disjoint_of_subset_left h_frontier <| disjoint_compl_right.frontier_left
(spectrum.isClosed _).isOpen_compl
rw [diff_eq_compl_inter]
apply (frontier_inter_subset _ _).trans
rw [frontier_compl]
apply union_subset <| inter_subset_left
refine inter_subset_inter_right _ ?_ |>.trans <| inter_subset_right
exact frontier_subset_frontier S x
/-- Let `S` be a closed subalgebra of a Banach algebra `A`, and let `x : S`. If `z` is in the
spectrum of `x`, then the connected component of `z` in the complement of the spectrum of `↑x : A`
is bounded (or else `z` actually belongs to the spectrum of `↑x : A`). -/
lemma Subalgebra.spectrum_isBounded_connectedComponentIn {z : 𝕜} (hz : z ∈ σ 𝕜 x) :
Bornology.IsBounded (connectedComponentIn (σ 𝕜 (x : A))ᶜ z) := by
by_cases hz' : z ∈ σ 𝕜 (x : A)
· simp [connectedComponentIn_eq_empty (show z ∉ (σ 𝕜 (x : A))ᶜ from not_not.mpr hz')]
· have : CompleteSpace S := hS.completeSpace_coe
suffices connectedComponentIn (σ 𝕜 (x : A))ᶜ z ⊆ σ 𝕜 x from spectrum.isBounded x |>.subset this
rw [spectrum_sUnion_connectedComponentIn S]
exact subset_biUnion_of_mem (mem_diff_of_mem hz hz') |>.trans subset_union_right
end NormedField
variable [NontriviallyNormedField 𝕜] [NormedAlgebra 𝕜 A] [SMulMemClass SA 𝕜 A]
variable (S : SA) [hS : IsClosed (S : Set A)] (x : S)
/-- Let `S` be a closed subalgebra of a Banach algebra `A`. If for `x : S` the complement of the
spectrum of `↑x : A` is connected, then `spectrum 𝕜 x = spectrum 𝕜 (x : A)`. -/
lemma Subalgebra.spectrum_eq_of_isPreconnected_compl (h : IsPreconnected (σ 𝕜 (x : A))ᶜ) :
σ 𝕜 x = σ 𝕜 (x : A) := by
nontriviality A
suffices σ 𝕜 x \ σ 𝕜 (x : A) = ∅ by
rw [spectrum_sUnion_connectedComponentIn, this]
simp
refine eq_empty_of_forall_notMem fun z hz ↦ NormedSpace.unbounded_univ 𝕜 𝕜 ?_
obtain ⟨hz, hz'⟩ := mem_diff _ |>.mp hz
have := (spectrum.isBounded (x : A)).union <|
h.connectedComponentIn hz' ▸ spectrum_isBounded_connectedComponentIn S x hz
simpa
end BoundarySpectrum
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_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)
end QuasispectrumRestricts |
.lake/packages/mathlib/Mathlib/Analysis/Polynomial/Basic.lean | import Mathlib.Algebra.Polynomial.Roots
import Mathlib.Analysis.Asymptotics.AsymptoticEquivalent
import Mathlib.Analysis.Asymptotics.SpecificAsymptotics
/-!
# Limits related to polynomial and rational functions
This file proves basic facts about limits of polynomial and rational functions.
The main result is `Polynomial.isEquivalent_atTop_lead`, which states that for
any polynomial `P` of degree `n` with leading coefficient `a`, the corresponding
polynomial function is equivalent to `a * x^n` as `x` goes to +∞.
We can then use this result to prove various limits for polynomial and rational
functions, depending on the degrees and leading coefficients of the considered
polynomials.
-/
open Filter Finset Asymptotics
open Asymptotics Polynomial Topology
namespace Polynomial
variable {𝕜 : Type*} [NormedField 𝕜] [LinearOrder 𝕜] [IsStrictOrderedRing 𝕜] (P Q : 𝕜[X])
theorem eventually_no_roots (hP : P ≠ 0) : ∀ᶠ x in atTop, ¬P.IsRoot x :=
atTop_le_cofinite <| (finite_setOf_isRoot hP).compl_mem_cofinite
variable [OrderTopology 𝕜]
section PolynomialAtTop
theorem isEquivalent_atTop_lead :
(fun x => eval x P) ~[atTop] fun x => P.leadingCoeff * x ^ P.natDegree := by
by_cases h : P = 0
· simp [h, IsEquivalent.refl]
· simp only [Polynomial.eval_eq_sum_range, sum_range_succ]
exact
IsLittleO.add_isEquivalent
(IsLittleO.sum fun i hi =>
IsLittleO.const_mul_left
((IsLittleO.const_mul_right fun hz => h <| leadingCoeff_eq_zero.mp hz) <|
isLittleO_pow_pow_atTop_of_lt (mem_range.mp hi))
_)
IsEquivalent.refl
theorem tendsto_atTop_of_leadingCoeff_nonneg (hdeg : 0 < P.degree) (hnng : 0 ≤ P.leadingCoeff) :
Tendsto (fun x => eval x P) atTop atTop :=
P.isEquivalent_atTop_lead.symm.tendsto_atTop <|
tendsto_const_mul_pow_atTop (natDegree_pos_iff_degree_pos.2 hdeg).ne' <|
hnng.lt_of_ne' <| leadingCoeff_ne_zero.mpr <| ne_zero_of_degree_gt hdeg
theorem tendsto_atTop_iff_leadingCoeff_nonneg :
Tendsto (fun x => eval x P) atTop atTop ↔ 0 < P.degree ∧ 0 ≤ P.leadingCoeff := by
refine ⟨fun h => ?_, fun h => tendsto_atTop_of_leadingCoeff_nonneg P h.1 h.2⟩
have : Tendsto (fun x => P.leadingCoeff * x ^ P.natDegree) atTop atTop :=
(isEquivalent_atTop_lead P).tendsto_atTop h
rw [tendsto_const_mul_pow_atTop_iff, ← pos_iff_ne_zero, natDegree_pos_iff_degree_pos] at this
exact ⟨this.1, this.2.le⟩
theorem tendsto_atBot_iff_leadingCoeff_nonpos :
Tendsto (fun x => eval x P) atTop atBot ↔ 0 < P.degree ∧ P.leadingCoeff ≤ 0 := by
simp only [← tendsto_neg_atTop_iff, ← eval_neg, tendsto_atTop_iff_leadingCoeff_nonneg,
degree_neg, leadingCoeff_neg, neg_nonneg]
theorem tendsto_atBot_of_leadingCoeff_nonpos (hdeg : 0 < P.degree) (hnps : P.leadingCoeff ≤ 0) :
Tendsto (fun x => eval x P) atTop atBot :=
P.tendsto_atBot_iff_leadingCoeff_nonpos.2 ⟨hdeg, hnps⟩
theorem abs_tendsto_atTop (hdeg : 0 < P.degree) :
Tendsto (fun x => abs <| eval x P) atTop atTop := by
rcases le_total 0 P.leadingCoeff with hP | hP
· exact tendsto_abs_atTop_atTop.comp (P.tendsto_atTop_of_leadingCoeff_nonneg hdeg hP)
· exact tendsto_abs_atBot_atTop.comp (P.tendsto_atBot_of_leadingCoeff_nonpos hdeg hP)
theorem abs_isBoundedUnder_iff :
(IsBoundedUnder (· ≤ ·) atTop fun x => |eval x P|) ↔ P.degree ≤ 0 := by
refine ⟨fun h => ?_, fun h => ⟨|P.coeff 0|, eventually_map.mpr (Eventually.of_forall
(forall_imp (fun _ => le_of_eq) fun x => congr_arg abs <| _root_.trans (congr_arg (eval x)
(eq_C_of_degree_le_zero h)) eval_C))⟩⟩
contrapose! h
exact not_isBoundedUnder_of_tendsto_atTop (abs_tendsto_atTop P h)
theorem abs_tendsto_atTop_iff : Tendsto (fun x => abs <| eval x P) atTop atTop ↔ 0 < P.degree :=
⟨fun h => not_le.mp (mt (abs_isBoundedUnder_iff P).mpr (not_isBoundedUnder_of_tendsto_atTop h)),
abs_tendsto_atTop P⟩
theorem tendsto_nhds_iff {c : 𝕜} :
Tendsto (fun x => eval x P) atTop (𝓝 c) ↔ P.leadingCoeff = c ∧ P.degree ≤ 0 := by
refine ⟨fun h => ?_, fun h => ?_⟩
· have := P.isEquivalent_atTop_lead.tendsto_nhds h
by_cases hP : P.leadingCoeff = 0
· simp only [hP, zero_mul, tendsto_const_nhds_iff] at this
exact ⟨_root_.trans hP this, by simp [leadingCoeff_eq_zero.1 hP]⟩
· rw [tendsto_const_mul_pow_nhds_iff hP, natDegree_eq_zero_iff_degree_le_zero] at this
exact this.symm
· refine P.isEquivalent_atTop_lead.symm.tendsto_nhds ?_
have : P.natDegree = 0 := natDegree_eq_zero_iff_degree_le_zero.2 h.2
simp only [h.1, this, pow_zero, mul_one]
exact tendsto_const_nhds
end PolynomialAtTop
section PolynomialDivAtTop
theorem isEquivalent_atTop_div :
(fun x => eval x P / eval x Q) ~[atTop] fun x =>
P.leadingCoeff / Q.leadingCoeff * x ^ (P.natDegree - Q.natDegree : ℤ) := by
by_cases hP : P = 0
· simp [hP, IsEquivalent.refl]
by_cases hQ : Q = 0
· simp [hQ, IsEquivalent.refl]
refine
(P.isEquivalent_atTop_lead.symm.div Q.isEquivalent_atTop_lead.symm).symm.trans
(EventuallyEq.isEquivalent ((eventually_gt_atTop 0).mono fun x hx => ?_))
simp [← div_mul_div_comm, zpow_sub₀ hx.ne.symm]
theorem div_tendsto_zero_of_degree_lt (hdeg : P.degree < Q.degree) :
Tendsto (fun x => eval x P / eval x Q) atTop (𝓝 0) := by
by_cases hP : P = 0
· simp [hP]
rw [← natDegree_lt_natDegree_iff hP] at hdeg
refine (isEquivalent_atTop_div P Q).symm.tendsto_nhds ?_
rw [← mul_zero]
refine (tendsto_zpow_atTop_zero ?_).const_mul _
cutsat
theorem div_tendsto_zero_iff_degree_lt (hQ : Q ≠ 0) :
Tendsto (fun x => eval x P / eval x Q) atTop (𝓝 0) ↔ P.degree < Q.degree := by
refine ⟨fun h => ?_, div_tendsto_zero_of_degree_lt P Q⟩
by_cases hPQ : P.leadingCoeff / Q.leadingCoeff = 0
· simp only [div_eq_mul_inv, inv_eq_zero, mul_eq_zero] at hPQ
rcases hPQ with hP0 | hQ0
· rw [leadingCoeff_eq_zero.1 hP0, degree_zero]
exact bot_lt_iff_ne_bot.2 fun hQ' => hQ (degree_eq_bot.1 hQ')
· exact absurd (leadingCoeff_eq_zero.1 hQ0) hQ
· have := (isEquivalent_atTop_div P Q).tendsto_nhds h
rw [tendsto_const_mul_zpow_atTop_nhds_iff hPQ] at this
rcases this with h | h
· exact absurd h.2 hPQ
· rw [sub_lt_iff_lt_add, zero_add, Int.ofNat_lt] at h
exact degree_lt_degree h.1
theorem div_tendsto_leadingCoeff_div_of_degree_eq (hdeg : P.degree = Q.degree) :
Tendsto (fun x => eval x P / eval x Q) atTop (𝓝 <| P.leadingCoeff / Q.leadingCoeff) := by
refine (isEquivalent_atTop_div P Q).symm.tendsto_nhds ?_
rw [show (P.natDegree : ℤ) = Q.natDegree by simp [hdeg, natDegree]]
simp
theorem div_tendsto_atTop_of_degree_gt' (hdeg : Q.degree < P.degree)
(hpos : 0 < P.leadingCoeff / Q.leadingCoeff) :
Tendsto (fun x => eval x P / eval x Q) atTop atTop := by
have hQ : Q ≠ 0 := fun h => by
simp only [h, div_zero, leadingCoeff_zero] at hpos
exact hpos.false
rw [← natDegree_lt_natDegree_iff hQ] at hdeg
refine (isEquivalent_atTop_div P Q).symm.tendsto_atTop ?_
apply Tendsto.const_mul_atTop hpos
apply tendsto_zpow_atTop_atTop
cutsat
theorem div_tendsto_atTop_of_degree_gt (hdeg : Q.degree < P.degree) (hQ : Q ≠ 0)
(hnng : 0 ≤ P.leadingCoeff / Q.leadingCoeff) :
Tendsto (fun x => eval x P / eval x Q) atTop atTop :=
have ratio_pos : 0 < P.leadingCoeff / Q.leadingCoeff :=
lt_of_le_of_ne hnng
(div_ne_zero (fun h => ne_zero_of_degree_gt hdeg <| leadingCoeff_eq_zero.mp h) fun h =>
hQ <| leadingCoeff_eq_zero.mp h).symm
div_tendsto_atTop_of_degree_gt' P Q hdeg ratio_pos
theorem div_tendsto_atBot_of_degree_gt' (hdeg : Q.degree < P.degree)
(hneg : P.leadingCoeff / Q.leadingCoeff < 0) :
Tendsto (fun x => eval x P / eval x Q) atTop atBot := by
have hQ : Q ≠ 0 := fun h => by
simp only [h, div_zero, leadingCoeff_zero] at hneg
exact hneg.false
rw [← natDegree_lt_natDegree_iff hQ] at hdeg
refine (isEquivalent_atTop_div P Q).symm.tendsto_atBot ?_
apply Tendsto.const_mul_atTop_of_neg hneg
apply tendsto_zpow_atTop_atTop
cutsat
theorem div_tendsto_atBot_of_degree_gt (hdeg : Q.degree < P.degree) (hQ : Q ≠ 0)
(hnps : P.leadingCoeff / Q.leadingCoeff ≤ 0) :
Tendsto (fun x => eval x P / eval x Q) atTop atBot :=
have ratio_neg : P.leadingCoeff / Q.leadingCoeff < 0 :=
lt_of_le_of_ne hnps
(div_ne_zero (fun h => ne_zero_of_degree_gt hdeg <| leadingCoeff_eq_zero.mp h) fun h =>
hQ <| leadingCoeff_eq_zero.mp h)
div_tendsto_atBot_of_degree_gt' P Q hdeg ratio_neg
theorem abs_div_tendsto_atTop_of_degree_gt (hdeg : Q.degree < P.degree) (hQ : Q ≠ 0) :
Tendsto (fun x => |eval x P / eval x Q|) atTop atTop := by
by_cases! h : 0 ≤ P.leadingCoeff / Q.leadingCoeff
· exact tendsto_abs_atTop_atTop.comp (P.div_tendsto_atTop_of_degree_gt Q hdeg hQ h)
· exact tendsto_abs_atBot_atTop.comp (P.div_tendsto_atBot_of_degree_gt Q hdeg hQ h.le)
end PolynomialDivAtTop
theorem isBigO_of_degree_le (h : P.degree ≤ Q.degree) :
(fun x => eval x P) =O[atTop] fun x => eval x Q := by
by_cases hp : P = 0
· simpa [hp] using isBigO_zero (fun x => eval x Q) atTop
· have hq : Q ≠ 0 := ne_zero_of_degree_ge_degree h hp
have hPQ : ∀ᶠ x : 𝕜 in atTop, eval x Q = 0 → eval x P = 0 :=
Filter.mem_of_superset (Polynomial.eventually_no_roots Q hq) fun x h h' => absurd h' h
rcases le_iff_lt_or_eq.mp h with h | h
· exact isBigO_of_div_tendsto_nhds hPQ 0 (div_tendsto_zero_of_degree_lt P Q h)
· exact isBigO_of_div_tendsto_nhds hPQ _ (div_tendsto_leadingCoeff_div_of_degree_eq P Q h)
end Polynomial |
.lake/packages/mathlib/Mathlib/Analysis/Polynomial/Factorization.lean | import Mathlib.Algebra.Polynomial.Degree.IsMonicOfDegree
import Mathlib.Analysis.Complex.Polynomial.Basic
/-!
# Factorization of monic polynomials of given degree
This file contains two main results:
* `Polynomial.IsMonicOfDegree.eq_mul_isMonicOfDegree_one_isMonicOfDegree`
shows that a monic polynomial of positive degree over an algebraically closed field
can be written as a monic polynomial of degree 1 times another monic factor.
* `Polynomial.IsMonicOfDegree.eq_mul_isMonicOfDegree_two_isMonicOfDegree`
shows that a monic polynomial of degree at least two over `ℝ` can be written as
a monic polynomial of degree two times another monic factor.
-/
namespace Polynomial.IsMonicOfDegree
/-- If `f : F[X]` is monic of degree `≥ 1` and `F` is an algebraically closed field,
then `f = f₁ * f₂` with `f₁` monic of degree `1` and `f₂` monic of degree `f.natDegree - 1`. -/
lemma eq_isMonicOfDegree_one_mul_isMonicOfDegree {F : Type*} [Field F]
[IsAlgClosed F] {f : F[X]} {n : ℕ} (hf : IsMonicOfDegree f (n + 1)) :
∃ f₁ f₂ : F[X], IsMonicOfDegree f₁ 1 ∧ IsMonicOfDegree f₂ n ∧ f = f₁ * f₂ := by
obtain ⟨f₁, hf₁m, hf₁i, f₂, hf₂⟩ :=
exists_monic_irreducible_factor f <| not_isUnit_of_natDegree_pos f <|
by grind [IsMonicOfDegree.natDegree_eq]
rw [hf₂, add_comm] at hf
have hf₁ : IsMonicOfDegree f₁ 1 :=
⟨natDegree_eq_of_degree_eq_some <| IsAlgClosed.degree_eq_one_of_irreducible F hf₁i, hf₁m⟩
exact ⟨f₁, f₂, hf₁, hf₁.of_mul_left hf, hf₂⟩
/-- If `f : ℝ[X]` is monic of positive degree, then `f = f₁ * f₂` with `f₁` monic
of degree `1` or `2`.
This relies on the fact that irreducible polynomials over `ℝ` have degree at most `2`. -/
-- TODO: generalize to real closed fields when they are available.
lemma eq_isMonicOfDegree_one_or_two_mul {f : ℝ[X]} {n : ℕ}
(hf : IsMonicOfDegree f (n + 1)) :
∃ f₁ f₂ : ℝ[X], (IsMonicOfDegree f₁ 1 ∨ IsMonicOfDegree f₁ 2) ∧ f = f₁ * f₂ := by
obtain ⟨f₁, hm, hirr, f₂, hf₂⟩ :=
exists_monic_irreducible_factor f <| not_isUnit_of_natDegree_pos f <|
by grind [IsMonicOfDegree.natDegree_eq]
refine ⟨f₁, f₂, ?_, hf₂⟩
have help {P : ℕ → Prop} {m : ℕ} (hm₀ : 0 < m) (hm₂ : m ≤ 2) (h : P m) : P 1 ∨ P 2 := by
interval_cases m <;> tauto
exact help hirr.natDegree_pos hirr.natDegree_le_two <| IsMonicOfDegree.mk rfl hm
/-- If `f : ℝ[X]` is monic of degree `≥ 2`, then `f = f₁ * f₂` with `f₁` monic of degree `2`
and `f₂` monic of degree `f.natDegree - 2`.
This relies on the fact that irreducible polynomials over `ℝ` have degree at most `2`. -/
-- TODO: generalize to real closed fields when they are available.
lemma eq_isMonicOfDegree_two_mul_isMonicOfDegree {f : ℝ[X]} {n : ℕ}
(hf : IsMonicOfDegree f (n + 2)) :
∃ f₁ f₂ : ℝ[X], IsMonicOfDegree f₁ 2 ∧ IsMonicOfDegree f₂ n ∧ f = f₁ * f₂ := by
obtain ⟨g₁, g₂, hd₁ | hd₂, h⟩ := hf.eq_isMonicOfDegree_one_or_two_mul
all_goals rw [h, add_comm] at hf
· have hg₂ := of_mul_left hd₁ <| (show 2 + n = 1 + (n + 1) by cutsat) ▸ hf
obtain ⟨p₁, p₂, hp₁ | hp₂, h'⟩ := hg₂.eq_isMonicOfDegree_one_or_two_mul
· rw [h', ← mul_assoc] at h hf
exact ⟨g₁ * p₁, p₂, hd₁.mul hp₁, (hd₁.mul hp₁).of_mul_left hf, h⟩
· rw [h', mul_left_comm] at h hf
exact ⟨p₁, g₁ * p₂, hp₂, of_mul_left hp₂ hf, h⟩
· exact ⟨g₁, g₂, hd₂, of_mul_left hd₂ hf, h⟩
end Polynomial.IsMonicOfDegree |
.lake/packages/mathlib/Mathlib/Analysis/Polynomial/MahlerMeasure.lean | import Mathlib.Analysis.Analytic.Polynomial
import Mathlib.Analysis.CStarAlgebra.Classes
import Mathlib.Analysis.SpecialFunctions.Integrability.LogMeromorphic
import Mathlib.MeasureTheory.Integral.CircleAverage
/-!
# Mahler measure of complex polynomials
In this file we define the Mahler measure of a polynomial over `ℂ[X]` and prove some basic
properties.
## Main definitions
- `Polynomial.logMahlerMeasure p`: the logarithmic Mahler measure of a polynomial `p` defined as
`(2 * π)⁻¹ * ∫ x ∈ (0, 2 * π), log ‖p (e ^ (i * x))‖`.
- `Polynomial.mahlerMeasure p`: the (exponential) Mahler measure of a polynomial `p`, which is equal
to `e ^ p.logMahlerMeasure` if `p` is nonzero, and `0` otherwise.
## Main results
- `Polynomial.mahlerMeasure_mul`: the Mahler measure of the product of two polynomials is the
product of their Mahler measures.
-/
namespace Polynomial
open Real
variable (p : ℂ[X])
/-- The logarithmic Mahler measure of a polynomial `p` defined as
`(2 * π)⁻¹ * ∫ x ∈ (0, 2 * π), log ‖p (e ^ (i * x))‖` -/
noncomputable def logMahlerMeasure : ℝ := circleAverage (fun x ↦ log ‖eval x p‖) 0 1
theorem logMahlerMeasure_def : p.logMahlerMeasure = circleAverage (fun x ↦ log ‖eval x p‖) 0 1 :=
rfl
@[simp]
theorem logMahlerMeasure_zero : (0 : ℂ[X]).logMahlerMeasure = 0 := by
simp [logMahlerMeasure_def, circleAverage_def]
@[simp]
theorem logMahlerMeasure_one : (1 : ℂ[X]).logMahlerMeasure = 0 := by
simp [logMahlerMeasure_def, circleAverage_def]
@[simp]
theorem logMahlerMeasure_const (z : ℂ) : (C z).logMahlerMeasure = log ‖z‖ := by
simp [logMahlerMeasure_def, circleAverage_def, mul_assoc]
@[simp]
theorem logMahlerMeasure_X : (X : ℂ[X]).logMahlerMeasure = 0 := by
simp [logMahlerMeasure_def, circleAverage_def]
@[simp]
theorem logMahlerMeasure_monomial (n : ℕ) (z : ℂ) : (monomial n z).logMahlerMeasure = log ‖z‖ := by
simp [logMahlerMeasure_def, circleAverage_def, mul_assoc]
/-- The Mahler measure of a polynomial `p` defined as `e ^ (logMahlerMeasure p)` if `p` is nonzero
and `0` otherwise -/
noncomputable def mahlerMeasure : ℝ := if p ≠ 0 then exp (p.logMahlerMeasure) else 0
variable {p} in
theorem mahlerMeasure_def_of_ne_zero (hp : p ≠ 0) : p.mahlerMeasure =
exp ((2 * π)⁻¹ * ∫ (x : ℝ) in (0)..(2 * π), log ‖eval (circleMap 0 1 x) p‖) := by
simp [mahlerMeasure, hp, logMahlerMeasure_def, circleAverage_def]
variable {p} in
theorem logMahlerMeasure_eq_log_MahlerMeasure : p.logMahlerMeasure = log p.mahlerMeasure := by
rw [mahlerMeasure]
split_ifs <;> simp_all [logMahlerMeasure_def, circleAverage_def]
@[simp]
theorem mahlerMeasure_zero : (0 : ℂ[X]).mahlerMeasure = 0 := by simp [mahlerMeasure]
@[simp]
theorem mahlerMeasure_one : (1 : ℂ[X]).mahlerMeasure = 1 := by simp [mahlerMeasure]
@[simp]
theorem mahlerMeasure_const (z : ℂ) : (C z).mahlerMeasure = ‖z‖ := by
simp only [mahlerMeasure, ne_eq, map_eq_zero, logMahlerMeasure_const, ite_not]
split_ifs with h
· simp [h]
· simp [h, exp_log]
theorem mahlerMeasure_nonneg : 0 ≤ p.mahlerMeasure := by
by_cases hp : p = 0 <;> simp [hp, mahlerMeasure_def_of_ne_zero, exp_nonneg]
variable {p} in
theorem mahlerMeasure_pos_of_ne_zero (hp : p ≠ 0) : 0 < p.mahlerMeasure := by
grind [exp_pos, mahlerMeasure_def_of_ne_zero]
@[simp]
theorem mahlerMeasure_eq_zero_iff : p.mahlerMeasure = 0 ↔ p = 0 := by
refine ⟨?_, by simp_all [mahlerMeasure_zero]⟩
contrapose
exact fun h ↦ by simp [mahlerMeasure_def_of_ne_zero h]
lemma intervalIntegrable_mahlerMeasure :
IntervalIntegrable (fun x ↦ log ‖p.eval (circleMap 0 1 x)‖) MeasureTheory.volume 0 (2 * π) := by
rw [← circleIntegrable_def fun z ↦ log ‖p.eval z‖]
exact circleIntegrable_log_norm_meromorphicOn
<| (analyticOnNhd_id.aeval_polynomial p).meromorphicOn
/-! The Mahler measure of the product of two polynomials is the product of their Mahler measures -/
open intervalIntegral in
theorem mahlerMeasure_mul (p q : ℂ[X]) :
(p * q).mahlerMeasure = p.mahlerMeasure * q.mahlerMeasure := by
by_cases hpq : p * q = 0
· simpa [hpq, mahlerMeasure_zero] using mul_eq_zero.mp hpq
rw [mul_eq_zero, not_or] at hpq
simp only [mahlerMeasure, ne_eq, mul_eq_zero, hpq, or_self, not_false_eq_true, ↓reduceIte,
logMahlerMeasure, eval_mul, Complex.norm_mul, circleAverage_def, mul_inv_rev, smul_eq_mul]
rw [← exp_add, ← left_distrib]
congr
rw [← integral_add p.intervalIntegrable_mahlerMeasure q.intervalIntegrable_mahlerMeasure]
apply integral_congr_ae
rw [MeasureTheory.ae_iff]
apply Set.Finite.measure_zero _ MeasureTheory.volume
simp only [_root_.not_imp]
apply Set.Finite.of_finite_image (f := circleMap 0 1) _ <|
(injOn_circleMap_of_abs_sub_le one_ne_zero (by simp [le_of_eq, pi_nonneg])).mono (fun _ h ↦ h.1)
apply (p * q).roots.finite_toSet.subset
rintro _ ⟨_, ⟨_, h⟩, _⟩
contrapose h
simp_all [log_mul]
@[simp]
theorem prod_mahlerMeasure_eq_mahlerMeasure_prod (s : Multiset ℂ[X]) :
(s.prod).mahlerMeasure = (s.map (fun p ↦ p.mahlerMeasure)).prod := by
induction s using Multiset.induction_on with
| empty => simp
| cons _ _ ih => simp [mahlerMeasure_mul, ih]
theorem logMahlerMeasure_mul_eq_add_logMahelerMeasure {p q : ℂ[X]} (hpq : p * q ≠ 0) :
(p * q).logMahlerMeasure = p.logMahlerMeasure + q.logMahlerMeasure := by
simp_all [logMahlerMeasure_eq_log_MahlerMeasure, mahlerMeasure_mul, log_mul]
end Polynomial |
.lake/packages/mathlib/Mathlib/Analysis/Polynomial/CauchyBound.lean | import Mathlib.Algebra.Order.Field.GeomSum
import Mathlib.Algebra.Polynomial.Monic
import Mathlib.Analysis.Normed.Field.Basic
/-!
# Cauchy's bound on polynomial roots.
The bound is given by `Polynomial.cauchyBound`, which for `a_n x^n + a_(n-1) x^(n - 1) + ⋯ + a_0` is
`1 + max_(0 ≤ i < n) a_i / a_n`.
The theorem that this gives a bound to polynomial roots is `Polynomial.IsRoot.norm_lt_cauchyBound`.
-/
variable {K : Type*} [NormedDivisionRing K]
namespace Polynomial
open Finset NNReal
/--
Cauchy's bound on the roots of a given polynomial.
See `IsRoot.norm_lt_cauchyBound` for the proof that the roots satisfy this bound.
-/
noncomputable def cauchyBound (p : K[X]) : ℝ≥0 :=
sup (range p.natDegree) (‖p.coeff ·‖₊) / ‖p.leadingCoeff‖₊ + 1
@[simp]
lemma one_le_cauchyBound (p : K[X]) : 1 ≤ cauchyBound p := by
simp [cauchyBound]
@[simp]
lemma cauchyBound_zero : cauchyBound (0 : K[X]) = 1 := by
simp [cauchyBound]
@[simp]
lemma cauchyBound_C (x : K) : cauchyBound (C x) = 1 := by
simp [cauchyBound]
@[simp]
lemma cauchyBound_one : cauchyBound (1 : K[X]) = 1 := cauchyBound_C 1
@[simp]
lemma cauchyBound_X : cauchyBound (X : K[X]) = 1 := by
simp [cauchyBound]
@[simp]
lemma cauchyBound_X_add_C (x : K) : cauchyBound (X + C x) = ‖x‖₊ + 1 := by
simp [cauchyBound]
@[simp]
lemma cauchyBound_X_sub_C (x : K) : cauchyBound (X - C x) = ‖x‖₊ + 1 := by
simp [cauchyBound]
@[simp]
lemma cauchyBound_smul {x : K} (hx : x ≠ 0) (p : K[X]) : cauchyBound (x • p) = cauchyBound p := by
simp only [cauchyBound, (isRegular_of_ne_zero hx).left.isSMulRegular,
natDegree_smul_of_smul_regular, coeff_smul, smul_eq_mul, nnnorm_mul, ← mul_finset_sup,
leadingCoeff_smul_of_smul_regular, add_left_inj]
apply mul_div_mul_left
simpa
/--
`cauchyBound` is a bound on the norm of polynomial roots.
-/
theorem IsRoot.norm_lt_cauchyBound {p : K[X]} (hp : p ≠ 0) {a : K} (h : p.IsRoot a) :
‖a‖₊ < cauchyBound p := by
rw [IsRoot.def, eval_eq_sum_range, range_add_one] at h
simp only [mem_range, lt_self_iff_false, not_false_eq_true, sum_insert, coeff_natDegree,
add_eq_zero_iff_eq_neg] at h
apply_fun nnnorm at h
simp only [nnnorm_mul, nnnorm_pow, nnnorm_neg] at h
suffices ‖a‖₊ ^ p.natDegree ≤ (cauchyBound p - 1) * ∑ x ∈ range p.natDegree, ‖a‖₊ ^ x by
rcases eq_or_ne ‖a‖₊ 1 with ha | ha
· simp only [ha, one_pow, sum_const, card_range, nsmul_eq_mul, mul_one, gt_iff_lt] at this ⊢
apply lt_of_le_of_ne (by simp)
intro nh
simp [← nh, tsub_self] at this
rcases lt_or_gt_of_ne ha with ha | ha
· apply ha.trans_le
simp
· rw [geom_sum_of_one_lt ha] at this
calc
‖a‖₊ = ‖a‖₊ - 1 + 1 := (tsub_add_cancel_of_le ha.le).symm
_ = ‖a‖₊ ^ p.natDegree * (‖a‖₊ - 1) / ‖a‖₊ ^ p.natDegree + 1 := by field
_ ≤ (cauchyBound p - 1) * ((‖a‖₊ ^ p.natDegree - 1) / (‖a‖₊ - 1)) * (‖a‖₊ - 1)
/ ‖a‖₊ ^ p.natDegree + 1 := by gcongr
_ = (cauchyBound p - 1) * (‖a‖₊ ^ p.natDegree - 1) / ‖a‖₊ ^ p.natDegree + 1 := by
congr 2
have : ‖a‖₊ - 1 ≠ 0 := fun nh ↦ (ha.trans_le (tsub_eq_zero_iff_le.mp nh)).false
field
_ < (cauchyBound p - 1) * ‖a‖₊ ^ p.natDegree / ‖a‖₊ ^ p.natDegree + 1 := by
gcongr
· apply lt_of_le_of_ne (by simp)
contrapose! this
simp only [← this, zero_mul]
apply pow_pos
exact zero_lt_one.trans ha
simp [zero_lt_one.trans ha]
_ = cauchyBound p := by simp [field, tsub_add_cancel_of_le]
apply le_of_eq at h
have pld : ‖p.leadingCoeff‖₊ ≠ 0 := by simpa
calc ‖a‖₊ ^ p.natDegree
_ = ‖p.leadingCoeff‖₊ * ‖a‖₊ ^ p.natDegree / ‖p.leadingCoeff‖₊ := by
rw [mul_div_cancel_left₀]
simpa
_ ≤ ‖∑ x ∈ range p.natDegree, p.coeff x * a ^ x‖₊ / ‖p.leadingCoeff‖₊ := by gcongr
_ ≤ (∑ x ∈ range p.natDegree, ‖p.coeff x * a ^ x‖₊) / ‖p.leadingCoeff‖₊ := by
gcongr
apply nnnorm_sum_le
_ = (∑ x ∈ range p.natDegree, ‖p.coeff x‖₊ * ‖a‖₊ ^ x) / ‖p.leadingCoeff‖₊ := by simp
_ ≤ (∑ x ∈ range p.natDegree, ‖p.leadingCoeff‖₊ * (cauchyBound p - 1) * ‖a‖₊ ^ x) /
‖p.leadingCoeff‖₊ := by
gcongr (∑ x ∈ _, ?_ * _) / _
rw [cauchyBound, add_tsub_cancel_right]
field_simp
apply le_sup (f := (‖p.coeff ·‖₊)) ‹_›
_ = (cauchyBound p - 1) * ∑ x ∈ range p.natDegree, ‖a‖₊ ^ x := by
simp only [← mul_sum]
field
end Polynomial |
.lake/packages/mathlib/Mathlib/Analysis/Matrix/Normed.lean | import Mathlib.Analysis.InnerProductSpace.PiL2
/-!
# Matrices as a normed space
In this file we provide the following non-instances for norms on matrices:
* The elementwise norm (with `open scoped Matrix.Norms.Elementwise`):
* `Matrix.seminormedAddCommGroup`
* `Matrix.normedAddCommGroup`
* `Matrix.normedSpace`
* `Matrix.isBoundedSMul`
* `Matrix.normSMulClass`
* The Frobenius norm (with `open scoped Matrix.Norms.Frobenius`):
* `Matrix.frobeniusSeminormedAddCommGroup`
* `Matrix.frobeniusNormedAddCommGroup`
* `Matrix.frobeniusNormedSpace`
* `Matrix.frobeniusNormedRing`
* `Matrix.frobeniusNormedAlgebra`
* `Matrix.frobeniusIsBoundedSMul`
* `Matrix.frobeniusNormSMulClass`
* The $L^\infty$ operator norm (with `open scoped Matrix.Norms.Operator`):
* `Matrix.linftyOpSeminormedAddCommGroup`
* `Matrix.linftyOpNormedAddCommGroup`
* `Matrix.linftyOpNormedSpace`
* `Matrix.linftyOpIsBoundedSMul`
* `Matrix.linftyOpNormSMulClass`
* `Matrix.linftyOpNonUnitalSemiNormedRing`
* `Matrix.linftyOpSemiNormedRing`
* `Matrix.linftyOpNonUnitalNormedRing`
* `Matrix.linftyOpNormedRing`
* `Matrix.linftyOpNormedAlgebra`
These are not declared as instances because there are several natural choices for defining the norm
of a matrix.
The norm induced by the identification of `Matrix m n 𝕜` with
`EuclideanSpace n 𝕜 →L[𝕜] EuclideanSpace m 𝕜` (i.e., the ℓ² operator norm) can be found in
`Mathlib/Analysis/CStarAlgebra/Matrix.lean` and `open scoped Matrix.Norms.L2Operator`.
It is separated to avoid extraneous imports in this file.
-/
noncomputable section
open WithLp
open scoped NNReal Matrix
namespace Matrix
variable {R l m n α β ι : Type*} [Fintype l] [Fintype m] [Fintype n] [Unique ι]
/-! ### The elementwise supremum norm -/
section LinfLinf
section SeminormedAddCommGroup
variable [SeminormedAddCommGroup α] [SeminormedAddCommGroup β]
/-- Seminormed group instance (using sup norm of sup norm) for matrices over a seminormed group. Not
declared as an instance because there are several natural choices for defining the norm of a
matrix. -/
protected def seminormedAddCommGroup : SeminormedAddCommGroup (Matrix m n α) :=
Pi.seminormedAddCommGroup
attribute [local instance] Matrix.seminormedAddCommGroup
theorem norm_def (A : Matrix m n α) : ‖A‖ = ‖fun i j => A i j‖ := rfl
/-- The norm of a matrix is the sup of the sup of the nnnorm of the entries -/
lemma norm_eq_sup_sup_nnnorm (A : Matrix m n α) :
‖A‖ = Finset.sup Finset.univ fun i ↦ Finset.sup Finset.univ fun j ↦ ‖A i j‖₊ := by
simp_rw [Matrix.norm_def, Pi.norm_def, Pi.nnnorm_def]
theorem nnnorm_def (A : Matrix m n α) : ‖A‖₊ = ‖fun i j => A i j‖₊ := rfl
theorem norm_le_iff {r : ℝ} (hr : 0 ≤ r) {A : Matrix m n α} : ‖A‖ ≤ r ↔ ∀ i j, ‖A i j‖ ≤ r := by
simp_rw [norm_def, pi_norm_le_iff_of_nonneg hr]
theorem nnnorm_le_iff {r : ℝ≥0} {A : Matrix m n α} : ‖A‖₊ ≤ r ↔ ∀ i j, ‖A i j‖₊ ≤ r := by
simp_rw [nnnorm_def, pi_nnnorm_le_iff]
theorem norm_lt_iff {r : ℝ} (hr : 0 < r) {A : Matrix m n α} : ‖A‖ < r ↔ ∀ i j, ‖A i j‖ < r := by
simp_rw [norm_def, pi_norm_lt_iff hr]
theorem nnnorm_lt_iff {r : ℝ≥0} (hr : 0 < r) {A : Matrix m n α} :
‖A‖₊ < r ↔ ∀ i j, ‖A i j‖₊ < r := by
simp_rw [nnnorm_def, pi_nnnorm_lt_iff hr]
theorem norm_entry_le_entrywise_sup_norm (A : Matrix m n α) {i : m} {j : n} : ‖A i j‖ ≤ ‖A‖ :=
(norm_le_pi_norm (A i) j).trans (norm_le_pi_norm A i)
theorem nnnorm_entry_le_entrywise_sup_nnnorm (A : Matrix m n α) {i : m} {j : n} : ‖A i j‖₊ ≤ ‖A‖₊ :=
(nnnorm_le_pi_nnnorm (A i) j).trans (nnnorm_le_pi_nnnorm A i)
@[simp]
theorem nnnorm_map_eq (A : Matrix m n α) (f : α → β) (hf : ∀ a, ‖f a‖₊ = ‖a‖₊) :
‖A.map f‖₊ = ‖A‖₊ := by
simp only [nnnorm_def, Pi.nnnorm_def, Matrix.map_apply, hf]
@[simp]
theorem norm_map_eq (A : Matrix m n α) (f : α → β) (hf : ∀ a, ‖f a‖ = ‖a‖) : ‖A.map f‖ = ‖A‖ :=
(congr_arg ((↑) : ℝ≥0 → ℝ) <| nnnorm_map_eq A f fun a => Subtype.ext <| hf a :)
@[simp]
theorem nnnorm_transpose (A : Matrix m n α) : ‖Aᵀ‖₊ = ‖A‖₊ :=
Finset.sup_comm _ _ _
@[simp]
theorem norm_transpose (A : Matrix m n α) : ‖Aᵀ‖ = ‖A‖ :=
congr_arg ((↑) : ℝ≥0 → ℝ) <| nnnorm_transpose A
@[simp]
theorem nnnorm_conjTranspose [StarAddMonoid α] [NormedStarGroup α] (A : Matrix m n α) :
‖Aᴴ‖₊ = ‖A‖₊ :=
(nnnorm_map_eq _ _ nnnorm_star).trans A.nnnorm_transpose
@[simp]
theorem norm_conjTranspose [StarAddMonoid α] [NormedStarGroup α] (A : Matrix m n α) : ‖Aᴴ‖ = ‖A‖ :=
congr_arg ((↑) : ℝ≥0 → ℝ) <| nnnorm_conjTranspose A
instance [StarAddMonoid α] [NormedStarGroup α] : NormedStarGroup (Matrix m m α) :=
⟨(le_of_eq <| norm_conjTranspose ·)⟩
@[simp]
theorem nnnorm_replicateCol (v : m → α) : ‖replicateCol ι v‖₊ = ‖v‖₊ := by
simp [nnnorm_def, Pi.nnnorm_def]
@[simp]
theorem norm_replicateCol (v : m → α) : ‖replicateCol ι v‖ = ‖v‖ :=
congr_arg ((↑) : ℝ≥0 → ℝ) <| nnnorm_replicateCol v
@[simp]
theorem nnnorm_replicateRow (v : n → α) : ‖replicateRow ι v‖₊ = ‖v‖₊ := by
simp [nnnorm_def, Pi.nnnorm_def]
@[simp]
theorem norm_replicateRow (v : n → α) : ‖replicateRow ι v‖ = ‖v‖ :=
congr_arg ((↑) : ℝ≥0 → ℝ) <| nnnorm_replicateRow v
@[simp]
theorem nnnorm_diagonal [DecidableEq n] (v : n → α) : ‖diagonal v‖₊ = ‖v‖₊ := by
simp_rw [nnnorm_def, Pi.nnnorm_def]
congr 1 with i : 1
refine le_antisymm (Finset.sup_le fun j hj => ?_) ?_
· obtain rfl | hij := eq_or_ne i j
· rw [diagonal_apply_eq]
· rw [diagonal_apply_ne _ hij, nnnorm_zero]
exact zero_le _
· refine Eq.trans_le ?_ (Finset.le_sup (Finset.mem_univ i))
rw [diagonal_apply_eq]
@[simp]
theorem norm_diagonal [DecidableEq n] (v : n → α) : ‖diagonal v‖ = ‖v‖ :=
congr_arg ((↑) : ℝ≥0 → ℝ) <| nnnorm_diagonal v
/-- Note this is safe as an instance as it carries no data. -/
instance [Nonempty n] [DecidableEq n] [One α] [NormOneClass α] : NormOneClass (Matrix n n α) :=
⟨(norm_diagonal _).trans <| norm_one⟩
end SeminormedAddCommGroup
/-- Normed group instance (using sup norm of sup norm) for matrices over a normed group. Not
declared as an instance because there are several natural choices for defining the norm of a
matrix. -/
protected def normedAddCommGroup [NormedAddCommGroup α] : NormedAddCommGroup (Matrix m n α) :=
Pi.normedAddCommGroup
section NormedSpace
attribute [local instance] Matrix.seminormedAddCommGroup
/-- This applies to the sup norm of sup norm. -/
protected theorem isBoundedSMul [SeminormedRing R] [SeminormedAddCommGroup α] [Module R α]
[IsBoundedSMul R α] : IsBoundedSMul R (Matrix m n α) :=
Pi.instIsBoundedSMul
/-- This applies to the sup norm of sup norm. -/
protected theorem normSMulClass [SeminormedRing R] [SeminormedAddCommGroup α] [Module R α]
[NormSMulClass R α] : NormSMulClass R (Matrix m n α) :=
Pi.instNormSMulClass
variable [NormedField R] [SeminormedAddCommGroup α] [NormedSpace R α]
/-- Normed space instance (using sup norm of sup norm) for matrices over a normed space. Not
declared as an instance because there are several natural choices for defining the norm of a
matrix. -/
protected def normedSpace : NormedSpace R (Matrix m n α) :=
Pi.normedSpace
namespace Norms.Elementwise
attribute [scoped instance]
Matrix.seminormedAddCommGroup
Matrix.normedAddCommGroup
Matrix.normedSpace
Matrix.isBoundedSMul
Matrix.normSMulClass
end Norms.Elementwise
end NormedSpace
end LinfLinf
/-! ### The $L_\infty$ operator norm
This section defines the matrix norm $\|A\|_\infty = \operatorname{sup}_i (\sum_j \|A_{ij}\|)$.
Note that this is equivalent to the operator norm, considering $A$ as a linear map between two
$L^\infty$ spaces.
-/
section LinftyOp
/-- Seminormed group instance (using sup norm of L1 norm) for matrices over a seminormed group. Not
declared as an instance because there are several natural choices for defining the norm of a
matrix. -/
@[local instance]
protected def linftyOpSeminormedAddCommGroup [SeminormedAddCommGroup α] :
SeminormedAddCommGroup (Matrix m n α) :=
@Pi.seminormedAddCommGroup m _ _ (fun _ ↦ PiLp.seminormedAddCommGroupToPi 1 (fun _ : n ↦ α))
/-- Normed group instance (using sup norm of L1 norm) for matrices over a normed ring. Not
declared as an instance because there are several natural choices for defining the norm of a
matrix. -/
@[local instance]
protected def linftyOpNormedAddCommGroup [NormedAddCommGroup α] :
NormedAddCommGroup (Matrix m n α) :=
@Pi.normedAddCommGroup m _ _ (fun _ ↦ PiLp.normedAddCommGroupToPi 1 (fun _ : n ↦ α))
/-- This applies to the sup norm of L1 norm. -/
@[local instance]
protected theorem linftyOpIsBoundedSMul
[SeminormedRing R] [SeminormedAddCommGroup α] [Module R α] [IsBoundedSMul R α] :
IsBoundedSMul R (Matrix m n α) :=
letI := PiLp.pseudoMetricSpaceToPi 1 (fun _ : n ↦ α)
inferInstanceAs (IsBoundedSMul R (m → n → α))
/-- This applies to the sup norm of L1 norm. -/
@[local instance]
protected theorem linftyOpNormSMulClass
[SeminormedRing R] [SeminormedAddCommGroup α] [Module R α] [NormSMulClass R α] :
NormSMulClass R (Matrix m n α) :=
letI := PiLp.seminormedAddCommGroupToPi 1 (fun _ : n ↦ α)
inferInstanceAs (NormSMulClass R (m → n → α))
/-- Normed space instance (using sup norm of L1 norm) for matrices over a normed space. Not
declared as an instance because there are several natural choices for defining the norm of a
matrix. -/
@[local instance]
protected def linftyOpNormedSpace [NormedField R] [SeminormedAddCommGroup α] [NormedSpace R α] :
NormedSpace R (Matrix m n α) :=
letI := PiLp.seminormedAddCommGroupToPi 1 (fun _ : n ↦ α)
inferInstanceAs (NormedSpace R (m → n → α))
section SeminormedAddCommGroup
variable [SeminormedAddCommGroup α]
theorem linfty_opNorm_def (A : Matrix m n α) :
‖A‖ = ((Finset.univ : Finset m).sup fun i : m => ∑ j : n, ‖A i j‖₊ : ℝ≥0) := by
change ‖fun i => toLp 1 (A i)‖ = _
simp [Pi.norm_def, PiLp.nnnorm_eq_of_L1]
theorem linfty_opNNNorm_def (A : Matrix m n α) :
‖A‖₊ = (Finset.univ : Finset m).sup fun i : m => ∑ j : n, ‖A i j‖₊ :=
Subtype.ext <| linfty_opNorm_def A
@[simp]
theorem linfty_opNNNorm_replicateCol (v : m → α) : ‖replicateCol ι v‖₊ = ‖v‖₊ := by
rw [linfty_opNNNorm_def, Pi.nnnorm_def]
simp
@[simp]
theorem linfty_opNorm_replicateCol (v : m → α) : ‖replicateCol ι v‖ = ‖v‖ :=
congr_arg ((↑) : ℝ≥0 → ℝ) <| linfty_opNNNorm_replicateCol v
@[simp]
theorem linfty_opNNNorm_replicateRow (v : n → α) : ‖replicateRow ι v‖₊ = ∑ i, ‖v i‖₊ := by
simp [linfty_opNNNorm_def]
@[simp]
theorem linfty_opNorm_replicateRow (v : n → α) : ‖replicateRow ι v‖ = ∑ i, ‖v i‖ :=
(congr_arg ((↑) : ℝ≥0 → ℝ) <| linfty_opNNNorm_replicateRow v).trans <| by simp [NNReal.coe_sum]
@[simp]
theorem linfty_opNNNorm_diagonal [DecidableEq m] (v : m → α) : ‖diagonal v‖₊ = ‖v‖₊ := by
rw [linfty_opNNNorm_def, Pi.nnnorm_def]
congr 1 with i : 1
refine (Finset.sum_eq_single_of_mem _ (Finset.mem_univ i) fun j _hj hij => ?_).trans ?_
· rw [diagonal_apply_ne' _ hij, nnnorm_zero]
· rw [diagonal_apply_eq]
@[simp]
theorem linfty_opNorm_diagonal [DecidableEq m] (v : m → α) : ‖diagonal v‖ = ‖v‖ :=
congr_arg ((↑) : ℝ≥0 → ℝ) <| linfty_opNNNorm_diagonal v
end SeminormedAddCommGroup
section NonUnitalSeminormedRing
variable [NonUnitalSeminormedRing α]
theorem linfty_opNNNorm_mul (A : Matrix l m α) (B : Matrix m n α) : ‖A * B‖₊ ≤ ‖A‖₊ * ‖B‖₊ := by
simp_rw [linfty_opNNNorm_def, Matrix.mul_apply]
calc
(Finset.univ.sup fun i => ∑ k, ‖∑ j, A i j * B j k‖₊) ≤
Finset.univ.sup fun i => ∑ k, ∑ j, ‖A i j‖₊ * ‖B j k‖₊ :=
Finset.sup_mono_fun fun i _hi =>
Finset.sum_le_sum fun k _hk => nnnorm_sum_le_of_le _ fun j _hj => nnnorm_mul_le _ _
_ = Finset.univ.sup fun i => ∑ j, ‖A i j‖₊ * ∑ k, ‖B j k‖₊ := by
simp_rw [@Finset.sum_comm m, Finset.mul_sum]
_ ≤ Finset.univ.sup fun i => ∑ j, ‖A i j‖₊ * Finset.univ.sup fun i => ∑ j, ‖B i j‖₊ := by
refine Finset.sup_mono_fun fun i _hi => ?_
gcongr with j hj
exact Finset.le_sup (f := fun i ↦ ∑ k : n, ‖B i k‖₊) hj
_ ≤ (Finset.univ.sup fun i => ∑ j, ‖A i j‖₊) * Finset.univ.sup fun i => ∑ j, ‖B i j‖₊ := by
simp_rw [← Finset.sum_mul, ← NNReal.finset_sup_mul]
rfl
theorem linfty_opNorm_mul (A : Matrix l m α) (B : Matrix m n α) : ‖A * B‖ ≤ ‖A‖ * ‖B‖ :=
linfty_opNNNorm_mul _ _
theorem linfty_opNNNorm_mulVec (A : Matrix l m α) (v : m → α) : ‖A *ᵥ v‖₊ ≤ ‖A‖₊ * ‖v‖₊ := by
rw [← linfty_opNNNorm_replicateCol (ι := Fin 1) (A *ᵥ v),
← linfty_opNNNorm_replicateCol v (ι := Fin 1)]
exact linfty_opNNNorm_mul A (replicateCol (Fin 1) v)
theorem linfty_opNorm_mulVec (A : Matrix l m α) (v : m → α) : ‖A *ᵥ v‖ ≤ ‖A‖ * ‖v‖ :=
linfty_opNNNorm_mulVec _ _
end NonUnitalSeminormedRing
/-- Seminormed non-unital ring instance (using sup norm of L1 norm) for matrices over a seminormed
non-unital ring. Not declared as an instance because there are several natural choices for defining
the norm of a matrix. -/
@[local instance]
protected def linftyOpNonUnitalSemiNormedRing [NonUnitalSeminormedRing α] :
NonUnitalSeminormedRing (Matrix n n α) :=
{ Matrix.linftyOpSeminormedAddCommGroup, Matrix.instNonUnitalRing with
norm_mul_le := linfty_opNorm_mul }
/-- The `L₁-L∞` norm preserves one on non-empty matrices. Note this is safe as an instance, as it
carries no data. -/
instance linfty_opNormOneClass [SeminormedRing α] [NormOneClass α] [DecidableEq n] [Nonempty n] :
NormOneClass (Matrix n n α) where norm_one := (linfty_opNorm_diagonal _).trans norm_one
/-- Seminormed ring instance (using sup norm of L1 norm) for matrices over a seminormed ring. Not
declared as an instance because there are several natural choices for defining the norm of a
matrix. -/
@[local instance]
protected def linftyOpSemiNormedRing [SeminormedRing α] [DecidableEq n] :
SeminormedRing (Matrix n n α) :=
{ Matrix.linftyOpNonUnitalSemiNormedRing, Matrix.instRing with }
/-- Normed non-unital ring instance (using sup norm of L1 norm) for matrices over a normed
non-unital ring. Not declared as an instance because there are several natural choices for defining
the norm of a matrix. -/
@[local instance]
protected def linftyOpNonUnitalNormedRing [NonUnitalNormedRing α] :
NonUnitalNormedRing (Matrix n n α) :=
{ Matrix.linftyOpNonUnitalSemiNormedRing with
eq_of_dist_eq_zero := eq_of_dist_eq_zero }
/-- Normed ring instance (using sup norm of L1 norm) for matrices over a normed ring. Not
declared as an instance because there are several natural choices for defining the norm of a
matrix. -/
@[local instance]
protected def linftyOpNormedRing [NormedRing α] [DecidableEq n] : NormedRing (Matrix n n α) :=
{ Matrix.linftyOpSemiNormedRing with
eq_of_dist_eq_zero := eq_of_dist_eq_zero }
/-- Normed algebra instance (using sup norm of L1 norm) for matrices over a normed algebra. Not
declared as an instance because there are several natural choices for defining the norm of a
matrix. -/
@[local instance]
protected def linftyOpNormedAlgebra [NormedField R] [SeminormedRing α] [NormedAlgebra R α]
[DecidableEq n] : NormedAlgebra R (Matrix n n α) :=
{ Matrix.linftyOpNormedSpace, Matrix.instAlgebra with }
section
variable [NormedDivisionRing α] [NormedAlgebra ℝ α]
/-- Auxiliary construction; an element of norm 1 such that `a * unitOf a = ‖a‖`. -/
private def unitOf (a : α) : α := by classical exact if a = 0 then 1 else ‖a‖ • a⁻¹
private theorem norm_unitOf (a : α) : ‖unitOf a‖₊ = 1 := by
rw [unitOf]
split_ifs with h
· simp
· rw [← nnnorm_eq_zero] at h
rw [nnnorm_smul, nnnorm_inv, nnnorm_norm, mul_inv_cancel₀ h]
private theorem mul_unitOf (a : α) : a * unitOf a = algebraMap _ _ (‖a‖₊ : ℝ) := by
simp only [unitOf, coe_nnnorm]
split_ifs with h
· simp [h]
· rw [mul_smul_comm, mul_inv_cancel₀ h, Algebra.algebraMap_eq_smul_one]
end
/-!
For a matrix over a field, the norm defined in this section agrees with the operator norm on
`ContinuousLinearMap`s between function types (which have the infinity norm).
-/
section
variable [NontriviallyNormedField α] [NormedAlgebra ℝ α]
lemma linfty_opNNNorm_eq_opNNNorm (A : Matrix m n α) :
‖A‖₊ = ‖ContinuousLinearMap.mk (Matrix.mulVecLin A)‖₊ := by
rw [ContinuousLinearMap.opNNNorm_eq_of_bounds _ (linfty_opNNNorm_mulVec _) fun N hN => ?_]
rw [linfty_opNNNorm_def]
refine Finset.sup_le fun i _ => ?_
cases isEmpty_or_nonempty n
· simp
classical
let x : n → α := fun j => unitOf (A i j)
have hxn : ‖x‖₊ = 1 := by
simp_rw [x, Pi.nnnorm_def, norm_unitOf, Finset.sup_const Finset.univ_nonempty]
specialize hN x
rw [hxn, mul_one, Pi.nnnorm_def, Finset.sup_le_iff] at hN
replace hN := hN i (Finset.mem_univ _)
dsimp [mulVec, dotProduct] at hN
simp_rw [x, mul_unitOf, ← map_sum, nnnorm_algebraMap, ← NNReal.coe_sum, NNReal.nnnorm_eq,
nnnorm_one, mul_one] at hN
exact hN
lemma linfty_opNorm_eq_opNorm (A : Matrix m n α) :
‖A‖ = ‖ContinuousLinearMap.mk (Matrix.mulVecLin A)‖ :=
congr_arg NNReal.toReal (linfty_opNNNorm_eq_opNNNorm A)
variable [DecidableEq n]
@[simp] lemma linfty_opNNNorm_toMatrix (f : (n → α) →L[α] (m → α)) :
‖LinearMap.toMatrix' (↑f : (n → α) →ₗ[α] (m → α))‖₊ = ‖f‖₊ := by
rw [linfty_opNNNorm_eq_opNNNorm]
simp only [← toLin'_apply', toLin'_toMatrix']
@[simp] lemma linfty_opNorm_toMatrix (f : (n → α) →L[α] (m → α)) :
‖LinearMap.toMatrix' (↑f : (n → α) →ₗ[α] (m → α))‖ = ‖f‖ :=
congr_arg NNReal.toReal (linfty_opNNNorm_toMatrix f)
end
namespace Norms.Operator
attribute [scoped instance]
Matrix.linftyOpSeminormedAddCommGroup
Matrix.linftyOpNormedAddCommGroup
Matrix.linftyOpNormedSpace
Matrix.linftyOpIsBoundedSMul
Matrix.linftyOpNormSMulClass
Matrix.linftyOpNonUnitalSemiNormedRing
Matrix.linftyOpSemiNormedRing
Matrix.linftyOpNonUnitalNormedRing
Matrix.linftyOpNormedRing
Matrix.linftyOpNormedAlgebra
end Norms.Operator
end LinftyOp
/-! ### The Frobenius norm
This is defined as $\|A\| = \sqrt{\sum_{i,j} \|A_{ij}\|^2}$.
When the matrix is over the real or complex numbers, this norm is submultiplicative.
-/
section frobenius
open scoped Matrix
/-- Seminormed group instance (using the Frobenius norm) for matrices over a seminormed group. Not
declared as an instance because there are several natural choices for defining the norm of a
matrix. -/
@[local instance]
def frobeniusSeminormedAddCommGroup [SeminormedAddCommGroup α] :
SeminormedAddCommGroup (Matrix m n α) :=
@PiLp.seminormedAddCommGroupToPi 2 _ _ _ _ (fun _ ↦ PiLp.seminormedAddCommGroupToPi 2 _)
/-- Normed group instance (using the Frobenius norm) for matrices over a normed group. Not
declared as an instance because there are several natural choices for defining the norm of a
matrix. -/
@[local instance]
def frobeniusNormedAddCommGroup [NormedAddCommGroup α] : NormedAddCommGroup (Matrix m n α) :=
@PiLp.normedAddCommGroupToPi 2 _ _ _ _ (fun _ ↦ PiLp.normedAddCommGroupToPi 2 _)
/-- This applies to the Frobenius norm. -/
@[local instance]
theorem frobeniusIsBoundedSMul [SeminormedRing R] [SeminormedAddCommGroup α] [Module R α]
[IsBoundedSMul R α] :
IsBoundedSMul R (Matrix m n α) :=
letI := PiLp.seminormedAddCommGroupToPi 2 (fun _ : n ↦ α)
PiLp.isBoundedSMulSeminormedAddCommGroupToPi 2 _
/-- This applies to the Frobenius norm. -/
@[local instance]
theorem frobeniusNormSMulClass [SeminormedRing R] [SeminormedAddCommGroup α] [Module R α]
[NormSMulClass R α] :
NormSMulClass R (Matrix m n α) :=
letI := PiLp.seminormedAddCommGroupToPi 2 (fun _ : n ↦ α)
PiLp.normSMulClassSeminormedAddCommGroupToPi 2 _
/-- Normed space instance (using the Frobenius norm) for matrices over a normed space. Not
declared as an instance because there are several natural choices for defining the norm of a
matrix. -/
@[local instance]
def frobeniusNormedSpace [NormedField R] [SeminormedAddCommGroup α] [NormedSpace R α] :
NormedSpace R (Matrix m n α) :=
letI := PiLp.seminormedAddCommGroupToPi 2 (fun _ : n ↦ α)
PiLp.normedSpaceSeminormedAddCommGroupToPi 2 _
section SeminormedAddCommGroup
variable [SeminormedAddCommGroup α] [SeminormedAddCommGroup β]
theorem frobenius_nnnorm_def (A : Matrix m n α) :
‖A‖₊ = (∑ i, ∑ j, ‖A i j‖₊ ^ (2 : ℝ)) ^ (1 / 2 : ℝ) := by
change ‖toLp 2 fun i => toLp 2 fun j => A i j‖₊ = _
simp_rw [PiLp.nnnorm_eq_of_L2, NNReal.sq_sqrt, NNReal.sqrt_eq_rpow, NNReal.rpow_two]
theorem frobenius_norm_def (A : Matrix m n α) :
‖A‖ = (∑ i, ∑ j, ‖A i j‖ ^ (2 : ℝ)) ^ (1 / 2 : ℝ) :=
(congr_arg ((↑) : ℝ≥0 → ℝ) (frobenius_nnnorm_def A)).trans <| by simp [NNReal.coe_sum]
@[simp]
theorem frobenius_nnnorm_map_eq (A : Matrix m n α) (f : α → β) (hf : ∀ a, ‖f a‖₊ = ‖a‖₊) :
‖A.map f‖₊ = ‖A‖₊ := by simp_rw [frobenius_nnnorm_def, Matrix.map_apply, hf]
@[simp]
theorem frobenius_norm_map_eq (A : Matrix m n α) (f : α → β) (hf : ∀ a, ‖f a‖ = ‖a‖) :
‖A.map f‖ = ‖A‖ :=
(congr_arg ((↑) : ℝ≥0 → ℝ) <| frobenius_nnnorm_map_eq A f fun a => Subtype.ext <| hf a :)
@[simp]
theorem frobenius_nnnorm_transpose (A : Matrix m n α) : ‖Aᵀ‖₊ = ‖A‖₊ := by
rw [frobenius_nnnorm_def, frobenius_nnnorm_def, Finset.sum_comm]
simp_rw [Matrix.transpose_apply]
@[simp]
theorem frobenius_norm_transpose (A : Matrix m n α) : ‖Aᵀ‖ = ‖A‖ :=
congr_arg ((↑) : ℝ≥0 → ℝ) <| frobenius_nnnorm_transpose A
@[simp]
theorem frobenius_nnnorm_conjTranspose [StarAddMonoid α] [NormedStarGroup α] (A : Matrix m n α) :
‖Aᴴ‖₊ = ‖A‖₊ :=
(frobenius_nnnorm_map_eq _ _ nnnorm_star).trans A.frobenius_nnnorm_transpose
@[simp]
theorem frobenius_norm_conjTranspose [StarAddMonoid α] [NormedStarGroup α] (A : Matrix m n α) :
‖Aᴴ‖ = ‖A‖ :=
congr_arg ((↑) : ℝ≥0 → ℝ) <| frobenius_nnnorm_conjTranspose A
instance frobenius_normedStarGroup [StarAddMonoid α] [NormedStarGroup α] :
NormedStarGroup (Matrix m m α) :=
⟨(le_of_eq <| frobenius_norm_conjTranspose ·)⟩
@[simp]
lemma frobenius_norm_replicateRow (v : m → α) : ‖replicateRow ι v‖ = ‖toLp 2 v‖ := by
rw [frobenius_norm_def, Fintype.sum_unique, PiLp.norm_eq_of_L2, Real.sqrt_eq_rpow]
simp only [replicateRow_apply, Real.rpow_two]
@[simp]
lemma frobenius_nnnorm_replicateRow (v : m → α) : ‖replicateRow ι v‖₊ = ‖toLp 2 v‖₊ :=
Subtype.ext <| frobenius_norm_replicateRow v
@[simp]
lemma frobenius_norm_replicateCol (v : n → α) : ‖replicateCol ι v‖ = ‖toLp 2 v‖ := by
simp [frobenius_norm_def, PiLp.norm_eq_of_L2, Real.sqrt_eq_rpow]
@[simp]
lemma frobenius_nnnorm_replicateCol (v : n → α) : ‖replicateCol ι v‖₊ = ‖toLp 2 v‖₊ :=
Subtype.ext <| frobenius_norm_replicateCol v
@[simp]
lemma frobenius_nnnorm_diagonal [DecidableEq n] (v : n → α) : ‖diagonal v‖₊ = ‖toLp 2 v‖₊ := by
simp_rw [frobenius_nnnorm_def, ← Finset.sum_product', Finset.univ_product_univ,
PiLp.nnnorm_eq_of_L2]
let s := (Finset.univ : Finset n).map ⟨fun i : n => (i, i), fun i j h => congr_arg Prod.fst h⟩
rw [← Finset.sum_subset (Finset.subset_univ s) fun i _hi his => ?_]
· rw [Finset.sum_map, NNReal.sqrt_eq_rpow]
dsimp
simp_rw [diagonal_apply_eq, NNReal.rpow_two]
· suffices i.1 ≠ i.2 by rw [diagonal_apply_ne _ this, nnnorm_zero, NNReal.zero_rpow two_ne_zero]
intro h
exact Finset.mem_map.not.mp his ⟨i.1, Finset.mem_univ _, Prod.ext rfl h⟩
@[simp]
lemma frobenius_norm_diagonal [DecidableEq n] (v : n → α) : ‖diagonal v‖ = ‖toLp 2 v‖ :=
(congr_arg ((↑) : ℝ≥0 → ℝ) <| frobenius_nnnorm_diagonal v :).trans rfl
end SeminormedAddCommGroup
theorem frobenius_nnnorm_one [DecidableEq n] [SeminormedAddCommGroup α] [One α] :
‖(1 : Matrix n n α)‖₊ = .sqrt (Fintype.card n) * ‖(1 : α)‖₊ := by
calc
‖(diagonal 1 : Matrix n n α)‖₊
_ = ‖toLp 2 (Function.const _ 1)‖₊ := frobenius_nnnorm_diagonal _
_ = .sqrt (Fintype.card n) * ‖(1 : α)‖₊ := by
rw [PiLp.nnnorm_toLp_const (ENNReal.ofNat_ne_top (n := 2))]
simp [NNReal.sqrt_eq_rpow]
section RCLike
variable [RCLike α]
theorem frobenius_nnnorm_mul (A : Matrix l m α) (B : Matrix m n α) : ‖A * B‖₊ ≤ ‖A‖₊ * ‖B‖₊ := by
simp_rw [frobenius_nnnorm_def, Matrix.mul_apply]
rw [← NNReal.mul_rpow, @Finset.sum_comm _ _ m, Finset.sum_mul_sum]
gcongr with i _ j
rw [← NNReal.rpow_le_rpow_iff one_half_pos, ← NNReal.rpow_mul,
mul_div_cancel₀ (1 : ℝ) two_ne_zero, NNReal.rpow_one, NNReal.mul_rpow]
simpa only [PiLp.toLp_apply, PiLp.inner_apply, RCLike.inner_apply', starRingEnd_apply,
Pi.nnnorm_def, PiLp.nnnorm_eq_of_L2, star_star, nnnorm_star, NNReal.sqrt_eq_rpow,
NNReal.rpow_two] using nnnorm_inner_le_nnnorm (𝕜 := α) (toLp 2 (star <| A i ·)) (toLp 2 (B · j))
theorem frobenius_norm_mul (A : Matrix l m α) (B : Matrix m n α) : ‖A * B‖ ≤ ‖A‖ * ‖B‖ :=
frobenius_nnnorm_mul A B
/-- Normed ring instance (using the Frobenius norm) for matrices over `ℝ` or `ℂ`. Not
declared as an instance because there are several natural choices for defining the norm of a
matrix. -/
@[local instance]
def frobeniusNormedRing [DecidableEq m] : NormedRing (Matrix m m α) :=
{ Matrix.frobeniusSeminormedAddCommGroup, Matrix.instRing with
norm_mul_le := frobenius_norm_mul
eq_of_dist_eq_zero := eq_of_dist_eq_zero }
/-- Normed algebra instance (using the Frobenius norm) for matrices over `ℝ` or `ℂ`. Not
declared as an instance because there are several natural choices for defining the norm of a
matrix. -/
@[local instance]
def frobeniusNormedAlgebra [DecidableEq m] [NormedField R] [NormedAlgebra R α] :
NormedAlgebra R (Matrix m m α) :=
{ Matrix.frobeniusNormedSpace, Matrix.instAlgebra with }
end RCLike
end frobenius
namespace Norms.Frobenius
attribute [scoped instance]
Matrix.frobeniusSeminormedAddCommGroup
Matrix.frobeniusNormedAddCommGroup
Matrix.frobeniusNormedSpace
Matrix.frobeniusNormedRing
Matrix.frobeniusNormedAlgebra
Matrix.frobeniusIsBoundedSMul
Matrix.frobeniusNormSMulClass
end Norms.Frobenius
end Matrix |
.lake/packages/mathlib/Mathlib/Analysis/Matrix/PosDef.lean | import Mathlib.Analysis.Matrix.Spectrum
import Mathlib.LinearAlgebra.Matrix.PosDef
/-!
# Spectrum of positive definite matrices
This file proves that eigenvalues of positive (semi)definite matrices are (nonnegative) positive.
-/
open WithLp Matrix Unitary
open scoped ComplexOrder
namespace Matrix
variable {m n 𝕜 : Type*} [Fintype m] [Fintype n] [RCLike 𝕜]
/-! ### Positive semidefinite matrices -/
/-- A Hermitian matrix is positive semi-definite if and only if its eigenvalues are non-negative. -/
lemma IsHermitian.posSemidef_iff_eigenvalues_nonneg [DecidableEq n] {A : Matrix n n 𝕜}
(hA : IsHermitian A) : PosSemidef A ↔ 0 ≤ hA.eigenvalues := by
conv_lhs => rw [hA.spectral_theorem]
simp [isUnit_coe.posSemidef_star_right_conjugate_iff, posSemidef_diagonal_iff, Pi.le_def]
@[deprecated (since := "2025-08-17")] alias ⟨_, IsHermitian.posSemidef_of_eigenvalues_nonneg⟩ :=
IsHermitian.posSemidef_iff_eigenvalues_nonneg
namespace PosSemidef
/-- The eigenvalues of a positive semi-definite matrix are non-negative -/
lemma eigenvalues_nonneg [DecidableEq n] {A : Matrix n n 𝕜}
(hA : Matrix.PosSemidef A) (i : n) : 0 ≤ hA.1.eigenvalues i :=
hA.isHermitian.posSemidef_iff_eigenvalues_nonneg.mp hA _
lemma det_nonneg [DecidableEq n] {M : Matrix n n 𝕜} (hM : M.PosSemidef) :
0 ≤ M.det := by
rw [hM.isHermitian.det_eq_prod_eigenvalues]
exact Finset.prod_nonneg fun i _ ↦ by simpa using hM.eigenvalues_nonneg i
lemma trace_eq_zero_iff {A : Matrix n n 𝕜} (hA : A.PosSemidef) :
A.trace = 0 ↔ A = 0 := by
classical
conv_lhs => rw [hA.1.spectral_theorem, conjStarAlgAut_apply, trace_mul_cycle, coe_star_mul_self,
one_mul, trace_diagonal, Finset.sum_eq_zero_iff_of_nonneg (by simp [hA.eigenvalues_nonneg])]
simp [← hA.isHermitian.eigenvalues_eq_zero_iff, funext_iff]
end PosSemidef
lemma eigenvalues_conjTranspose_mul_self_nonneg (A : Matrix m n 𝕜) [DecidableEq n] (i : n) :
0 ≤ (isHermitian_conjTranspose_mul_self A).eigenvalues i :=
(posSemidef_conjTranspose_mul_self _).eigenvalues_nonneg _
lemma eigenvalues_self_mul_conjTranspose_nonneg (A : Matrix m n 𝕜) [DecidableEq m] (i : m) :
0 ≤ (isHermitian_mul_conjTranspose_self A).eigenvalues i :=
(posSemidef_self_mul_conjTranspose _).eigenvalues_nonneg _
/-! ### Positive definite matrices -/
/-- A Hermitian matrix is positive-definite if and only if its eigenvalues are positive. -/
lemma IsHermitian.posDef_iff_eigenvalues_pos [DecidableEq n] {A : Matrix n n 𝕜}
(hA : A.IsHermitian) : A.PosDef ↔ ∀ i, 0 < hA.eigenvalues i := by
conv_lhs => rw [hA.spectral_theorem]
simp [isUnit_coe.posDef_star_right_conjugate_iff]
namespace PosDef
/-- The eigenvalues of a positive definite matrix are positive. -/
lemma eigenvalues_pos [DecidableEq n] {A : Matrix n n 𝕜}
(hA : Matrix.PosDef A) (i : n) : 0 < hA.1.eigenvalues i :=
hA.isHermitian.posDef_iff_eigenvalues_pos.mp hA i
lemma det_pos [DecidableEq n] {M : Matrix n n 𝕜} (hM : M.PosDef) : 0 < det M := by
rw [hM.isHermitian.det_eq_prod_eigenvalues]
apply Finset.prod_pos
intro i _
simpa using hM.eigenvalues_pos i
end PosDef
end Matrix |
.lake/packages/mathlib/Mathlib/Analysis/Matrix/Order.lean | import Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Instances
import Mathlib.Analysis.Matrix.HermitianFunctionalCalculus
import Mathlib.Analysis.Matrix.PosDef
import Mathlib.Analysis.SpecialFunctions.ContinuousFunctionalCalculus.Rpow.Basic
/-!
# The partial order on matrices
This file constructs the partial order and star ordered instances on matrices on `𝕜`.
This allows us to use more general results from C⋆-algebras, like `CFC.sqrt`.
## Main results
* `Matrix.instPartialOrder`: the partial order on matrices given by `x ≤ y := (y - x).PosSemidef`.
* `Matrix.PosSemidef.dotProduct_mulVec_zero_iff`: for a positive semi-definite matrix `A`,
we have `x⋆ A x = 0` iff `A x = 0`.
* `Matrix.PosDef.matrixInnerProductSpace`: the inner product on matrices induced by a
positive definite matrix `M`: `⟪x, y⟫ = (y * M * xᴴ).trace`.
## Implementation notes
Note that the partial order instance is scoped to `MatrixOrder`.
Please `open scoped MatrixOrder` to use this.
-/
variable {𝕜 n : Type*} [RCLike 𝕜] [Fintype n]
open scoped ComplexOrder
open Matrix
namespace Matrix
section PartialOrder
/-- The preorder on matrices given by `A ≤ B := (B - A).PosSemidef`. -/
abbrev instPreOrder : Preorder (Matrix n n 𝕜) where
le A B := (B - A).PosSemidef
le_refl A := sub_self A ▸ PosSemidef.zero
le_trans A B C h₁ h₂ := sub_add_sub_cancel C B A ▸ h₂.add h₁
scoped[MatrixOrder] attribute [instance] Matrix.instPreOrder
open MatrixOrder
lemma le_iff {A B : Matrix n n 𝕜} : A ≤ B ↔ (B - A).PosSemidef := Iff.rfl
lemma nonneg_iff_posSemidef {A : Matrix n n 𝕜} : 0 ≤ A ↔ A.PosSemidef := by rw [le_iff, sub_zero]
protected alias ⟨LE.le.posSemidef, PosSemidef.nonneg⟩ := nonneg_iff_posSemidef
attribute [aesop safe forward (rule_sets := [CStarAlgebra])] PosSemidef.nonneg
/-- The partial order on matrices given by `A ≤ B := (B - A).PosSemidef`. -/
abbrev instPartialOrder : PartialOrder (Matrix n n 𝕜) where
le_antisymm A B h₁ h₂ := by
rw [← sub_eq_zero, ← h₂.trace_eq_zero_iff]
have := neg_nonneg.mp <| trace_neg (A - B) ▸ neg_sub A B ▸ h₁.trace_nonneg
exact le_antisymm this h₂.trace_nonneg
scoped[MatrixOrder] attribute [instance] Matrix.instPartialOrder
lemma instIsOrderedAddMonoid : IsOrderedAddMonoid (Matrix n n 𝕜) where
add_le_add_left _ _ _ _ := by rwa [le_iff, add_sub_add_left_eq_sub]
scoped[MatrixOrder] attribute [instance] Matrix.instIsOrderedAddMonoid
lemma instNonnegSpectrumClass : NonnegSpectrumClass ℝ (Matrix n n 𝕜) where
quasispectrum_nonneg_of_nonneg A hA := by
classical
simp only [quasispectrum_eq_spectrum_union_zero ℝ A, Set.union_singleton, Set.mem_insert_iff,
forall_eq_or_imp, le_refl, true_and]
intro x hx
obtain ⟨i, rfl⟩ := Set.ext_iff.mp
hA.posSemidef.1.spectrum_real_eq_range_eigenvalues x |>.mp hx
exact hA.posSemidef.eigenvalues_nonneg _
scoped[MatrixOrder] attribute [instance] instNonnegSpectrumClass
lemma instStarOrderedRing : StarOrderedRing (Matrix n n 𝕜) :=
.of_nonneg_iff' add_le_add_left fun A ↦
⟨fun hA ↦ by
classical
obtain ⟨X, hX, -, rfl⟩ :=
sub_zero A ▸ CFC.exists_sqrt_of_isSelfAdjoint_of_quasispectrumRestricts hA.isHermitian
(QuasispectrumRestricts.nnreal_of_nonneg hA.nonneg)
exact ⟨X, hX.star_eq.symm ▸ rfl⟩,
fun ⟨A, hA⟩ => hA ▸ (posSemidef_conjTranspose_mul_self A).nonneg⟩
scoped[MatrixOrder] attribute [instance] instStarOrderedRing
end PartialOrder
open scoped MatrixOrder
namespace PosSemidef
section sqrtDeprecated
variable [DecidableEq n] {A : Matrix n n 𝕜} (hA : PosSemidef A)
/-- The positive semidefinite square root of a positive semidefinite matrix -/
@[deprecated CFC.sqrt (since := "2025-09-22")]
noncomputable def sqrt : Matrix n n 𝕜 :=
hA.1.eigenvectorUnitary.1 * diagonal ((↑) ∘ (√·) ∘ hA.1.eigenvalues) *
(star hA.1.eigenvectorUnitary : Matrix n n 𝕜)
@[deprecated CFC.sqrt_nonneg (since := "2025-09-22")]
lemma posSemidef_sqrt : PosSemidef (CFC.sqrt A) := CFC.sqrt_nonneg A |>.posSemidef
include hA
@[deprecated CFC.sq_sqrt (since := "2025-09-22")]
lemma sq_sqrt : (CFC.sqrt A) ^ 2 = A := CFC.sq_sqrt A
@[deprecated CFC.sqrt_mul_sqrt_self (since := "2025-09-22")]
lemma sqrt_mul_self : CFC.sqrt A * CFC.sqrt A = A := CFC.sqrt_mul_sqrt_self A
@[deprecated CFC.sq_eq_sq_iff (since := "2025-09-24")]
lemma sq_eq_sq_iff {B : Matrix n n 𝕜} (hB : PosSemidef B) : A ^ 2 = B ^ 2 ↔ A = B :=
CFC.sq_eq_sq_iff A B
@[deprecated (since := "2025-09-24")] alias ⟨eq_of_sq_eq_sq, _⟩ := CFC.sq_eq_sq_iff
@[deprecated CFC.sqrt_sq (since := "2025-09-22")]
lemma sqrt_sq : CFC.sqrt (A ^ 2) = A := CFC.sqrt_sq A
@[deprecated CFC.sqrt_eq_iff (since := "2025-09-23")]
lemma eq_sqrt_iff_sq_eq {B : Matrix n n 𝕜} (hB : PosSemidef B) : A = CFC.sqrt B ↔ A ^ 2 = B := by
rw [eq_comm, CFC.sqrt_eq_iff B A hB.nonneg hA.nonneg, sq]
@[deprecated CFC.sqrt_eq_iff (since := "2025-09-23")]
lemma sqrt_eq_iff_eq_sq {B : Matrix n n 𝕜} (hB : PosSemidef B) : CFC.sqrt A = B ↔ A = B ^ 2 := by
simpa [eq_comm, sq] using CFC.sqrt_eq_iff A B hA.nonneg hB.nonneg
@[deprecated CFC.sqrt_eq_zero_iff (since := "2025-09-22")]
lemma sqrt_eq_zero_iff : CFC.sqrt A = 0 ↔ A = 0 := CFC.sqrt_eq_zero_iff A
@[deprecated CFC.sqrt_eq_one_iff (since := "2025-09-23")]
lemma sqrt_eq_one_iff : CFC.sqrt A = 1 ↔ A = 1 := CFC.sqrt_eq_one_iff A
@[deprecated CFC.isUnit_sqrt_iff (since := "2025-09-22")]
lemma isUnit_sqrt_iff : IsUnit (CFC.sqrt A) ↔ IsUnit A := CFC.isUnit_sqrt_iff A
lemma inv_sqrt : (CFC.sqrt A)⁻¹ = CFC.sqrt A⁻¹ := by
rw [eq_comm, CFC.sqrt_eq_iff _ _ hA.inv.nonneg (CFC.sqrt_nonneg A).posSemidef.inv.nonneg, ← sq,
inv_pow', CFC.sq_sqrt A]
end sqrtDeprecated
/-- For `A` positive semidefinite, we have `x⋆ A x = 0` iff `A x = 0`. -/
theorem dotProduct_mulVec_zero_iff {A : Matrix n n 𝕜} (hA : PosSemidef A) (x : n → 𝕜) :
star x ⬝ᵥ A *ᵥ x = 0 ↔ A *ᵥ x = 0 := by
classical
refine ⟨fun h ↦ ?_, fun h ↦ h ▸ dotProduct_zero _⟩
obtain ⟨B, rfl⟩ := CStarAlgebra.nonneg_iff_eq_star_mul_self.mp hA.nonneg
simp_rw [← Matrix.mulVec_mulVec, dotProduct_mulVec _ _ (B *ᵥ x), star_eq_conjTranspose,
vecMul_conjTranspose, star_star, dotProduct_star_self_eq_zero] at h ⊢
rw [h, mulVec_zero]
/-- For `A` positive semidefinite, we have `x⋆ A x = 0` iff `A x = 0` (linear maps version). -/
theorem toLinearMap₂'_zero_iff [DecidableEq n]
{A : Matrix n n 𝕜} (hA : PosSemidef A) (x : n → 𝕜) :
Matrix.toLinearMap₂' 𝕜 A (star x) x = 0 ↔ A *ᵥ x = 0 := by
simpa only [toLinearMap₂'_apply'] using hA.dotProduct_mulVec_zero_iff x
end PosSemidef
/-- A matrix is positive semidefinite if and only if it has the form `Bᴴ * B` for some `B`. -/
@[deprecated CStarAlgebra.nonneg_iff_eq_star_mul_self (since := "2025-09-22")]
lemma posSemidef_iff_eq_conjTranspose_mul_self {A : Matrix n n 𝕜} :
PosSemidef A ↔ ∃ (B : Matrix n n 𝕜), A = Bᴴ * B := by
classical
exact nonneg_iff_posSemidef (A := A) |>.eq ▸ CStarAlgebra.nonneg_iff_eq_star_mul_self
@[deprecated (since := "2025-05-07")]
alias posSemidef_iff_eq_transpose_mul_self := CStarAlgebra.nonneg_iff_eq_star_mul_self
theorem posSemidef_iff_isHermitian_and_spectrum_nonneg [DecidableEq n] {A : Matrix n n 𝕜} :
A.PosSemidef ↔ A.IsHermitian ∧ spectrum 𝕜 A ⊆ {a : 𝕜 | 0 ≤ a} := by
refine ⟨fun h => ⟨h.isHermitian, fun a => ?_⟩, fun ⟨h1, h2⟩ => ?_⟩
· simp only [h.isHermitian.spectrum_eq_image_range, Set.mem_image, Set.mem_range,
exists_exists_eq_and, Set.mem_setOf_eq, forall_exists_index]
rintro i rfl
exact_mod_cast h.eigenvalues_nonneg _
· rw [h1.posSemidef_iff_eigenvalues_nonneg]
intro i
simpa [h1.spectrum_eq_image_range] using @h2 (h1.eigenvalues i)
@[deprecated commute_iff_mul_nonneg (since := "2025-09-23")]
theorem PosSemidef.commute_iff {A B : Matrix n n 𝕜} (hA : A.PosSemidef) (hB : B.PosSemidef) :
Commute A B ↔ (A * B).PosSemidef := by
classical
exact nonneg_iff_posSemidef (A := A * B).eq ▸ commute_iff_mul_nonneg hA.nonneg hB.nonneg
/-- A positive semi-definite matrix is positive definite if and only if it is invertible. -/
@[grind =]
theorem PosSemidef.posDef_iff_isUnit [DecidableEq n] {x : Matrix n n 𝕜}
(hx : x.PosSemidef) : x.PosDef ↔ IsUnit x := by
refine ⟨fun h => h.isUnit, fun h => ⟨hx.1, fun v hv => ?_⟩⟩
obtain ⟨y, rfl⟩ := CStarAlgebra.nonneg_iff_eq_star_mul_self.mp hx.nonneg
simp_rw [dotProduct_mulVec, ← vecMul_vecMul, star_eq_conjTranspose, ← star_mulVec,
← dotProduct_mulVec, dotProduct_star_self_pos_iff]
contrapose! hv
rw [← map_eq_zero_iff (f := (yᴴ * y).mulVecLin) (mulVec_injective_iff_isUnit.mpr h),
mulVecLin_apply, ← mulVec_mulVec, hv, mulVec_zero]
theorem isStrictlyPositive_iff_posDef [DecidableEq n] {x : Matrix n n 𝕜} :
IsStrictlyPositive x ↔ x.PosDef :=
⟨fun h => h.nonneg.posSemidef.posDef_iff_isUnit.mpr h.isUnit,
fun h => h.isUnit.isStrictlyPositive h.posSemidef.nonneg⟩
alias ⟨IsStrictlyPositive.posDef, PosDef.isStrictlyPositive⟩ := isStrictlyPositive_iff_posDef
attribute [aesop safe forward (rule_sets := [CStarAlgebra])] PosDef.isStrictlyPositive
@[deprecated IsStrictlyPositive.commute_iff (since := "2025-09-26")]
theorem PosDef.commute_iff {A B : Matrix n n 𝕜} (hA : A.PosDef) (hB : B.PosDef) :
Commute A B ↔ (A * B).PosDef := by
classical
rw [hA.isStrictlyPositive.commute_iff hB.isStrictlyPositive, isStrictlyPositive_iff_posDef]
@[deprecated IsStrictlyPositive.sqrt (since := "2025-09-26")]
lemma PosDef.posDef_sqrt [DecidableEq n] {M : Matrix n n 𝕜} (hM : M.PosDef) :
PosDef (CFC.sqrt M) := hM.isStrictlyPositive.sqrt.posDef
section kronecker
variable {m : Type*} [Fintype m]
open scoped Kronecker
/-- The kronecker product of two positive semi-definite matrices is positive semi-definite. -/
theorem PosSemidef.kronecker {x : Matrix n n 𝕜} {y : Matrix m m 𝕜}
(hx : x.PosSemidef) (hy : y.PosSemidef) : (x ⊗ₖ y).PosSemidef := by
classical
obtain ⟨a, rfl⟩ := CStarAlgebra.nonneg_iff_eq_star_mul_self.mp hx.nonneg
obtain ⟨b, rfl⟩ := CStarAlgebra.nonneg_iff_eq_star_mul_self.mp hy.nonneg
simpa [mul_kronecker_mul, ← conjTranspose_kronecker, star_eq_conjTranspose] using
posSemidef_conjTranspose_mul_self _
open Matrix in
/-- The kronecker of two positive definite matrices is positive definite. -/
theorem PosDef.kronecker {x : Matrix n n 𝕜} {y : Matrix m m 𝕜}
(hx : x.PosDef) (hy : y.PosDef) : (x ⊗ₖ y).PosDef := by
classical
exact hx.posSemidef.kronecker hy.posSemidef |>.posDef_iff_isUnit.mpr <|
hx.isUnit.kronecker hy.isUnit
end kronecker
/--
A matrix is positive definite if and only if it has the form `Bᴴ * B` for some invertible `B`.
-/
@[deprecated CStarAlgebra.isStrictlyPositive_iff_eq_star_mul_self (since := "2025-09-28")]
lemma posDef_iff_eq_conjTranspose_mul_self [DecidableEq n] {A : Matrix n n 𝕜} :
PosDef A ↔ ∃ B : Matrix n n 𝕜, IsUnit B ∧ A = Bᴴ * B :=
isStrictlyPositive_iff_posDef.symm.trans CStarAlgebra.isStrictlyPositive_iff_eq_star_mul_self
@[deprecated (since := "2025-08-07")] alias PosDef.posDef_iff_eq_conjTranspose_mul_self :=
CStarAlgebra.isStrictlyPositive_iff_eq_star_mul_self
/-- A positive definite matrix `M` induces a norm on `Matrix n n 𝕜`:
`‖x‖ = sqrt (x * M * xᴴ).trace`. -/
noncomputable def PosDef.matrixNormedAddCommGroup {M : Matrix n n 𝕜} (hM : M.PosDef) :
NormedAddCommGroup (Matrix n n 𝕜) :=
letI : InnerProductSpace.Core 𝕜 (Matrix n n 𝕜) :=
{ inner x y := (y * M * xᴴ).trace
conj_inner_symm _ _ := by
simp only [mul_assoc, starRingEnd_apply, ← trace_conjTranspose, conjTranspose_mul,
conjTranspose_conjTranspose, hM.isHermitian.eq]
re_inner_nonneg x := RCLike.nonneg_iff.mp
(hM.posSemidef.mul_mul_conjTranspose_same x).trace_nonneg |>.1
add_left := by simp [mul_add]
smul_left := by simp
definite x hx := by
classical
obtain ⟨y, hy, rfl⟩ := CStarAlgebra.isStrictlyPositive_iff_eq_star_mul_self.mp
hM.isStrictlyPositive
rw [← mul_assoc, ← conjTranspose_conjTranspose x, star_eq_conjTranspose, ← conjTranspose_mul,
conjTranspose_conjTranspose, mul_assoc, trace_conjTranspose_mul_self_eq_zero_iff] at hx
lift y to (Matrix n n 𝕜)ˣ using hy
simpa [← mul_assoc] using congr(y⁻¹ * $hx) }
this.toNormedAddCommGroup
/-- A positive definite matrix `M` induces an inner product on `Matrix n n 𝕜`:
`⟪x, y⟫ = (y * M * xᴴ).trace`. -/
def PosDef.matrixInnerProductSpace {M : Matrix n n 𝕜} (hM : M.PosDef) :
letI : NormedAddCommGroup (Matrix n n 𝕜) := hM.matrixNormedAddCommGroup
InnerProductSpace 𝕜 (Matrix n n 𝕜) :=
InnerProductSpace.ofCore _
end Matrix |
.lake/packages/mathlib/Mathlib/Analysis/Matrix/HermitianFunctionalCalculus.lean | import Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unique
import Mathlib.Analysis.Matrix.Spectrum
import Mathlib.Topology.ContinuousMap.Units
/-!
# Continuous Functional Calculus for Hermitian Matrices
This file defines an instance of the continuous functional calculus for Hermitian matrices over an
`RCLike` field `𝕜`.
## Main Results
- `Matrix.IsHermitian.cfc` : Realization of the functional calculus for a Hermitian matrix
as the triple product `U * diagonal (RCLike.ofReal ∘ f ∘ hA.eigenvalues) * star U` with
`U = eigenvectorUnitary hA`.
- `cfc_eq` : Proof that the above agrees with the continuous functional calculus.
- `Matrix.IsHermitian.instContinuousFunctionalCalculus` : Instance of the continuous functional
calculus for a Hermitian matrix `A` over `𝕜`.
## Tags
spectral theorem, diagonalization theorem, continuous functional calculus
-/
open Topology Unitary
namespace Matrix
variable {n 𝕜 : Type*} [RCLike 𝕜] [Fintype n] [DecidableEq n] {A : Matrix n n 𝕜}
namespace IsHermitian
variable (hA : IsHermitian A)
/-- The star algebra homomorphism underlying the instance of the continuous functional
calculus of a Hermitian matrix. This is an auxiliary definition and is not intended
for use outside of this file. -/
@[simps]
noncomputable def cfcAux : C(spectrum ℝ A, ℝ) →⋆ₐ[ℝ] (Matrix n n 𝕜) where
toFun := fun g => conjStarAlgAut ℝ _ hA.eigenvectorUnitary <|
diagonal (RCLike.ofReal ∘ g ∘ (fun i ↦ ⟨hA.eigenvalues i, hA.eigenvalues_mem_spectrum_real i⟩))
map_zero' := by simp [Pi.zero_def, Function.comp_def]
map_one' := by simp [Pi.one_def, Function.comp_def]
map_mul' f g := by
simp only [ContinuousMap.coe_mul, ← map_mul, diagonal_mul_diagonal, Function.comp_apply]
rfl
map_add' f g := by
simp only [ContinuousMap.coe_add, ← map_add, diagonal_add, Function.comp_apply]
rfl
commutes' r := by
simp only [Function.comp_def, algebraMap_apply, smul_eq_mul, mul_one]
rw [← mul_one (algebraMap _ _ _), ← coe_mul_star_self hA.eigenvectorUnitary,
← Algebra.left_comm, coe_star, ← mul_assoc, conjStarAlgAut_apply]
rfl
map_star' f := by
simp only [star_trivial, ← map_star, star_eq_conjTranspose, diagonal_conjTranspose, Pi.star_def,
Function.comp_apply, RCLike.star_def, RCLike.conj_ofReal]
rfl
lemma isClosedEmbedding_cfcAux : IsClosedEmbedding hA.cfcAux := by
have h0 : FiniteDimensional ℝ C(spectrum ℝ A, ℝ) :=
FiniteDimensional.of_injective (ContinuousMap.coeFnLinearMap ℝ (M := ℝ)) DFunLike.coe_injective
refine LinearMap.isClosedEmbedding_of_injective (𝕜 := ℝ) (E := C(spectrum ℝ A, ℝ))
(F := Matrix n n 𝕜) (f := hA.cfcAux) <| LinearMap.ker_eq_bot'.mpr fun f hf ↦ ?_
have h2 :
diagonal (RCLike.ofReal ∘ f ∘ fun i ↦ ⟨hA.eigenvalues i, hA.eigenvalues_mem_spectrum_real i⟩)
= (0 : Matrix n n 𝕜) := by
simp only [LinearMap.coe_coe, cfcAux_apply, conjStarAlgAut_apply] at hf
replace hf := congr($hf * (hA.eigenvectorUnitary : Matrix n n 𝕜))
simp only [mul_assoc, SetLike.coe_mem, Unitary.star_mul_self_of_mem, mul_one, zero_mul] at hf
simpa [← mul_assoc] using congr((star hA.eigenvectorUnitary : Matrix n n 𝕜) * $hf)
ext x
simp only [ContinuousMap.zero_apply]
obtain ⟨x, hx⟩ := x
obtain ⟨i, rfl⟩ := hA.spectrum_real_eq_range_eigenvalues ▸ hx
rw [← diagonal_zero] at h2
have := (diagonal_eq_diagonal_iff).mp h2
exact RCLike.ofReal_eq_zero.mp (this i)
lemma cfcAux_id : hA.cfcAux (.restrict (spectrum ℝ A) (.id ℝ)) = A := by
conv_rhs => rw [hA.spectral_theorem]
rfl
/-- Instance of the continuous functional calculus for a Hermitian matrix over `𝕜` with
`RCLike 𝕜`. -/
instance instContinuousFunctionalCalculus :
ContinuousFunctionalCalculus ℝ (Matrix n n 𝕜) IsSelfAdjoint where
exists_cfc_of_predicate a ha := by
replace ha : IsHermitian a := ha
refine ⟨ha.cfcAux, ha.isClosedEmbedding_cfcAux, ha.cfcAux_id, fun f ↦ ?map_spec,
fun f ↦ ?hermitian⟩
case map_spec =>
apply Set.eq_of_subset_of_subset
· rw [← ContinuousMap.spectrum_eq_range f]
apply AlgHom.spectrum_apply_subset
· rw [cfcAux_apply, conjStarAlgAut_apply, Unitary.spectrum_star_right_conjugate]
rintro - ⟨x, rfl⟩
apply spectrum.of_algebraMap_mem 𝕜
simp only [Function.comp_apply, Set.mem_range, spectrum_diagonal]
obtain ⟨x, hx⟩ := x
obtain ⟨i, rfl⟩ := ha.spectrum_real_eq_range_eigenvalues ▸ hx
exact ⟨i, rfl⟩
case hermitian =>
simp only [isSelfAdjoint_iff, cfcAux_apply, ← map_star]
rw [star_eq_conjTranspose, diagonal_conjTranspose]
congr!
simp [Pi.star_def, Function.comp_def]
spectrum_nonempty a ha := by
obtain (h | h) := isEmpty_or_nonempty n
· obtain ⟨x, y, hxy⟩ := exists_pair_ne (Matrix n n 𝕜)
exact False.elim <| Matrix.of.symm.injective.ne hxy <| Subsingleton.elim _ _
· exact spectrum_real_eq_range_eigenvalues ha ▸ Set.range_nonempty _
predicate_zero := .zero _
/-- The continuous functional calculus of a Hermitian matrix as a triple product using the
spectral theorem. Note that this actually operates on bare functions since every function is
continuous on the spectrum of a matrix, since the spectrum is finite. This is shown to be equal to
the generic continuous functional calculus API in `Matrix.IsHermitian.cfc_eq`. In general, users
should prefer the generic API, especially because it will make rewriting easier. -/
protected noncomputable def cfc (f : ℝ → ℝ) : Matrix n n 𝕜 :=
conjStarAlgAut ℝ _ hA.eigenvectorUnitary (diagonal (RCLike.ofReal ∘ f ∘ hA.eigenvalues))
lemma cfc_eq (f : ℝ → ℝ) : cfc f A = hA.cfc f := by
have hA' : IsSelfAdjoint A := hA
have := cfcHom_eq_of_continuous_of_map_id hA' hA.cfcAux hA.isClosedEmbedding_cfcAux.continuous
hA.cfcAux_id
rw [cfc_apply f A hA' (by rw [continuousOn_iff_continuous_restrict]; fun_prop), this]
simp only [cfcAux_apply, ContinuousMap.coe_mk, Function.comp_def, Set.restrict_apply,
IsHermitian.cfc]
open Polynomial in
lemma charpoly_cfc_eq (f : ℝ → ℝ) :
(cfc f A).charpoly = ∏ i, (X - C (f (hA.eigenvalues i) : 𝕜)) := by
rw [cfc_eq hA f, IsHermitian.cfc, conjStarAlgAut_apply, charpoly_mul_comm, ← mul_assoc]
simp [charpoly_diagonal]
end IsHermitian
end Matrix |
.lake/packages/mathlib/Mathlib/Analysis/Matrix/Spectrum.lean | import Mathlib.Algebra.Star.UnitaryStarAlgAut
import Mathlib.Analysis.InnerProductSpace.Spectrum
import Mathlib.LinearAlgebra.Eigenspace.Matrix
import Mathlib.LinearAlgebra.Matrix.Charpoly.Eigs
import Mathlib.LinearAlgebra.Matrix.Diagonal
import Mathlib.LinearAlgebra.Matrix.Hermitian
import Mathlib.LinearAlgebra.Matrix.Rank
import Mathlib.Topology.Algebra.Module.FiniteDimension
/-! # Spectral theory of Hermitian matrices
This file proves the spectral theorem for matrices. The proof of the spectral theorem is based on
the spectral theorem for linear maps (`LinearMap.IsSymmetric.eigenvectorBasis_apply_self_apply`).
## Tags
spectral theorem, diagonalization theorem -/
open WithLp
namespace Matrix
variable {𝕜 : Type*} [RCLike 𝕜] {n : Type*} [Fintype n]
variable {A B : Matrix n n 𝕜}
lemma finite_real_spectrum [DecidableEq n] : (spectrum ℝ A).Finite := by
rw [← spectrum.preimage_algebraMap 𝕜]
exact A.finite_spectrum.preimage (FaithfulSMul.algebraMap_injective ℝ 𝕜).injOn
instance [DecidableEq n] : Finite (spectrum ℝ A) := A.finite_real_spectrum
/-- The spectrum of a matrix `A` coincides with the spectrum of `toEuclideanLin A`. -/
theorem spectrum_toEuclideanLin [DecidableEq n] : spectrum 𝕜 (toEuclideanLin A) = spectrum 𝕜 A :=
AlgEquiv.spectrum_eq (Matrix.toLinAlgEquiv (PiLp.basisFun 2 𝕜 n)) _
@[deprecated (since := "13-08-2025")] alias IsHermitian.spectrum_toEuclideanLin :=
spectrum_toEuclideanLin
namespace IsHermitian
section DecidableEq
variable [DecidableEq n]
variable (hA : A.IsHermitian) (hB : B.IsHermitian)
/-- The eigenvalues of a Hermitian matrix, indexed by `Fin (Fintype.card n)` where `n` is the index
type of the matrix. -/
noncomputable def eigenvalues₀ : Fin (Fintype.card n) → ℝ :=
(isHermitian_iff_isSymmetric.1 hA).eigenvalues finrank_euclideanSpace
lemma eigenvalues₀_antitone : Antitone hA.eigenvalues₀ :=
LinearMap.IsSymmetric.eigenvalues_antitone ..
/-- The eigenvalues of a Hermitian matrix, reusing the index `n` of the matrix entries. -/
noncomputable def eigenvalues : n → ℝ := fun i =>
hA.eigenvalues₀ <| (Fintype.equivOfCardEq (Fintype.card_fin _)).symm i
/-- A choice of an orthonormal basis of eigenvectors of a Hermitian matrix. -/
noncomputable def eigenvectorBasis : OrthonormalBasis n 𝕜 (EuclideanSpace 𝕜 n) :=
((isHermitian_iff_isSymmetric.1 hA).eigenvectorBasis finrank_euclideanSpace).reindex
(Fintype.equivOfCardEq (Fintype.card_fin _))
lemma mulVec_eigenvectorBasis (j : n) :
A *ᵥ ⇑(hA.eigenvectorBasis j) = (hA.eigenvalues j) • ⇑(hA.eigenvectorBasis j) := by
simpa only [eigenvectorBasis, OrthonormalBasis.reindex_apply, toEuclideanLin_apply,
RCLike.real_smul_eq_coe_smul (K := 𝕜)] using
congr(⇑$((isHermitian_iff_isSymmetric.1 hA).apply_eigenvectorBasis
finrank_euclideanSpace ((Fintype.equivOfCardEq (Fintype.card_fin _)).symm j)))
/-- Eigenvalues of a Hermitian matrix A are in the ℝ spectrum of A. -/
theorem eigenvalues_mem_spectrum_real (i : n) : hA.eigenvalues i ∈ spectrum ℝ A := by
apply spectrum.of_algebraMap_mem 𝕜
rw [← Matrix.spectrum_toEuclideanLin]
exact LinearMap.IsSymmetric.hasEigenvalue_eigenvalues _ _ _ |>.mem_spectrum
/-- Unitary matrix whose columns are `Matrix.IsHermitian.eigenvectorBasis`. -/
noncomputable def eigenvectorUnitary {𝕜 : Type*} [RCLike 𝕜] {n : Type*}
[Fintype n] {A : Matrix n n 𝕜} [DecidableEq n] (hA : Matrix.IsHermitian A) :
Matrix.unitaryGroup n 𝕜 :=
⟨(EuclideanSpace.basisFun n 𝕜).toBasis.toMatrix (hA.eigenvectorBasis).toBasis,
(EuclideanSpace.basisFun n 𝕜).toMatrix_orthonormalBasis_mem_unitary (eigenvectorBasis hA)⟩
lemma eigenvectorUnitary_coe {𝕜 : Type*} [RCLike 𝕜] {n : Type*} [Fintype n]
{A : Matrix n n 𝕜} [DecidableEq n] (hA : Matrix.IsHermitian A) :
eigenvectorUnitary hA =
(EuclideanSpace.basisFun n 𝕜).toBasis.toMatrix (hA.eigenvectorBasis).toBasis :=
rfl
@[simp]
theorem eigenvectorUnitary_transpose_apply (j : n) :
(eigenvectorUnitary hA)ᵀ j = ⇑(hA.eigenvectorBasis j) :=
rfl
@[simp]
theorem eigenvectorUnitary_col_eq (j : n) :
Matrix.col (eigenvectorUnitary hA) j = ⇑(hA.eigenvectorBasis j) :=
rfl
@[simp]
theorem eigenvectorUnitary_apply (i j : n) :
eigenvectorUnitary hA i j = ⇑(hA.eigenvectorBasis j) i :=
rfl
theorem eigenvectorUnitary_mulVec (j : n) :
eigenvectorUnitary hA *ᵥ Pi.single j 1 = ⇑(hA.eigenvectorBasis j) := by
simp_rw [mulVec_single_one, eigenvectorUnitary_col_eq]
theorem star_eigenvectorUnitary_mulVec (j : n) :
(star (eigenvectorUnitary hA : Matrix n n 𝕜)) *ᵥ ⇑(hA.eigenvectorBasis j) = Pi.single j 1 := by
rw [← eigenvectorUnitary_mulVec, mulVec_mulVec, Unitary.coe_star_mul_self, one_mulVec]
open Unitary
/-- Unitary diagonalization of a Hermitian matrix. -/
theorem conjStarAlgAut_star_eigenvectorUnitary :
conjStarAlgAut 𝕜 _ (star hA.eigenvectorUnitary) A =
diagonal (RCLike.ofReal ∘ hA.eigenvalues) := by
apply Matrix.toEuclideanLin.injective <| (EuclideanSpace.basisFun n 𝕜).toBasis.ext fun i ↦ ?_
simp only [conjStarAlgAut_star_apply, toEuclideanLin_apply, OrthonormalBasis.coe_toBasis,
EuclideanSpace.basisFun_apply, EuclideanSpace.ofLp_single, ← mulVec_mulVec,
eigenvectorUnitary_mulVec, ← mulVec_mulVec, mulVec_eigenvectorBasis,
Matrix.diagonal_mulVec_single, mulVec_smul, star_eigenvectorUnitary_mulVec,
RCLike.real_smul_eq_coe_smul (K := 𝕜), WithLp.toLp_smul, EuclideanSpace.toLp_single,
Function.comp_apply, mul_one]
apply PiLp.ext fun j ↦ ?_
simp only [PiLp.smul_apply, EuclideanSpace.single_apply, smul_eq_mul, mul_ite, mul_one, mul_zero]
@[deprecated (since := "2025-11-06")] alias star_mul_self_mul_eq_diagonal :=
conjStarAlgAut_star_eigenvectorUnitary
/-- **Diagonalization theorem**, **spectral theorem** for matrices; A Hermitian matrix can be
diagonalized by a change of basis. For the spectral theorem on linear maps, see
`LinearMap.IsSymmetric.eigenvectorBasis_apply_self_apply`. -/
theorem spectral_theorem :
A = conjStarAlgAut 𝕜 _ hA.eigenvectorUnitary (diagonal (RCLike.ofReal ∘ hA.eigenvalues)) := by
rw [← conjStarAlgAut_star_eigenvectorUnitary, ← conjStarAlgAut_mul_apply]
simp
theorem eigenvalues_eq (i : n) :
(hA.eigenvalues i) = RCLike.re (dotProduct (star ⇑(hA.eigenvectorBasis i))
(A *ᵥ ⇑(hA.eigenvectorBasis i))) := by
rw [dotProduct_comm]
simp only [mulVec_eigenvectorBasis, smul_dotProduct, ← EuclideanSpace.inner_eq_star_dotProduct,
inner_self_eq_norm_sq_to_K, RCLike.smul_re, hA.eigenvectorBasis.orthonormal.1 i,
mul_one, algebraMap.coe_one, one_pow, RCLike.one_re]
open Polynomial in
lemma charpoly_eq : A.charpoly = ∏ i, (X - C (hA.eigenvalues i : 𝕜)) := by
conv_lhs => rw [hA.spectral_theorem, conjStarAlgAut_apply, charpoly_mul_comm, ← mul_assoc]
simp [charpoly_diagonal]
lemma roots_charpoly_eq_eigenvalues :
A.charpoly.roots = Multiset.map (RCLike.ofReal ∘ hA.eigenvalues) Finset.univ.val := by
rw [hA.charpoly_eq, Polynomial.roots_prod]
· simp
· simp [Finset.prod_ne_zero_iff, Polynomial.X_sub_C_ne_zero]
lemma roots_charpoly_eq_eigenvalues₀ :
A.charpoly.roots = Multiset.map (RCLike.ofReal ∘ hA.eigenvalues₀) Finset.univ.val := by
rw [hA.roots_charpoly_eq_eigenvalues]
simp only [← Multiset.map_map, eigenvalues, ← Function.comp_apply (f := hA.eigenvalues₀)]
simp
lemma sort_roots_charpoly_eq_eigenvalues₀ :
(A.charpoly.roots.map RCLike.re).sort (· ≥ ·) = List.ofFn hA.eigenvalues₀ := by
simp_rw [hA.roots_charpoly_eq_eigenvalues₀, Fin.univ_val_map, Multiset.map_coe, List.map_ofFn,
Function.comp_def, RCLike.ofReal_re, Multiset.coe_sort]
rw [List.mergeSort_of_sorted]
simpa [List.Sorted] using (eigenvalues₀_antitone hA).ofFn_sorted
lemma eigenvalues_eq_eigenvalues_iff :
hA.eigenvalues = hB.eigenvalues ↔ A.charpoly = B.charpoly := by
constructor <;> intro h
· rw [hA.charpoly_eq, hB.charpoly_eq, h]
· suffices hA.eigenvalues₀ = hB.eigenvalues₀ by unfold eigenvalues; rw [this]
simp_rw [← List.ofFn_inj, ← sort_roots_charpoly_eq_eigenvalues₀, h]
theorem splits_charpoly (hA : A.IsHermitian) : A.charpoly.Splits (RingHom.id 𝕜) :=
Polynomial.splits_iff_card_roots.mpr (by simp [hA.roots_charpoly_eq_eigenvalues])
/-- The determinant of a Hermitian matrix is the product of its eigenvalues. -/
theorem det_eq_prod_eigenvalues : det A = ∏ i, (hA.eigenvalues i : 𝕜) := by
simp [det_eq_prod_roots_charpoly_of_splits hA.splits_charpoly, hA.roots_charpoly_eq_eigenvalues]
/-- rank of a Hermitian matrix is the rank of after diagonalization by the eigenvector unitary -/
lemma rank_eq_rank_diagonal : A.rank = (diagonal hA.eigenvalues).rank := by
conv_lhs => rw [hA.spectral_theorem, conjStarAlgAut_apply, ← coe_star]
simp [-isUnit_iff_ne_zero, -coe_star, rank_diagonal]
/-- rank of a Hermitian matrix is the number of nonzero eigenvalues of the Hermitian matrix -/
lemma rank_eq_card_non_zero_eigs : A.rank = Fintype.card {i // hA.eigenvalues i ≠ 0} := by
rw [rank_eq_rank_diagonal hA, Matrix.rank_diagonal]
/-- The spectrum of a Hermitian matrix is the range of its eigenvalues under `RCLike.ofReal`. -/
theorem spectrum_eq_image_range :
spectrum 𝕜 A = RCLike.ofReal '' Set.range hA.eigenvalues := Set.ext fun x => by
conv_lhs => rw [hA.spectral_theorem]
simp
/-- The `ℝ`-spectrum of a Hermitian matrix over `RCLike` field is the range of the eigenvalue
function. -/
theorem spectrum_real_eq_range_eigenvalues :
spectrum ℝ A = Set.range hA.eigenvalues := Set.ext fun x => by
conv_lhs => rw [hA.spectral_theorem, ← spectrum.algebraMap_mem_iff 𝕜]
simp
@[deprecated (since := "2025-08-14")]
alias eigenvalues_eq_spectrum_real := spectrum_real_eq_range_eigenvalues
/-- The eigenvalues of a Hermitian matrix `A` are all zero iff `A = 0`. -/
theorem eigenvalues_eq_zero_iff :
hA.eigenvalues = 0 ↔ A = 0 := by
refine ⟨fun h ↦ ?_, fun h ↦ by ext; simp [h, eigenvalues_eq]⟩
rw [hA.spectral_theorem, h, Pi.comp_zero, RCLike.ofReal_zero, Function.const_zero,
Pi.zero_def, diagonal_zero, map_zero]
end DecidableEq
/-- A nonzero Hermitian matrix has an eigenvector with nonzero eigenvalue. -/
lemma exists_eigenvector_of_ne_zero (hA : IsHermitian A) (h_ne : A ≠ 0) :
∃ (v : n → 𝕜) (t : ℝ), t ≠ 0 ∧ v ≠ 0 ∧ A *ᵥ v = t • v := by
classical
have : hA.eigenvalues ≠ 0 := by
contrapose! h_ne
have := hA.spectral_theorem
rwa [h_ne, Pi.comp_zero, RCLike.ofReal_zero, (by rfl : Function.const n (0 : 𝕜) = fun _ ↦ 0),
diagonal_zero, map_zero] at this
obtain ⟨i, hi⟩ := Function.ne_iff.mp this
exact ⟨_, _, hi, (ofLp_eq_zero 2).ne.2 <| hA.eigenvectorBasis.orthonormal.ne_zero i,
hA.mulVec_eigenvectorBasis i⟩
theorem trace_eq_sum_eigenvalues [DecidableEq n] (hA : A.IsHermitian) :
A.trace = ∑ i, (hA.eigenvalues i : 𝕜) := by
simp [trace_eq_sum_roots_charpoly_of_splits hA.splits_charpoly, hA.roots_charpoly_eq_eigenvalues]
end IsHermitian
end Matrix |
.lake/packages/mathlib/Mathlib/Analysis/Analytic/RadiusLiminf.lean | import Mathlib.Analysis.Analytic.ConvergenceRadius
import Mathlib.Analysis.SpecialFunctions.Pow.NNReal
/-!
# Representation of `FormalMultilinearSeries.radius` as a `liminf`
In this file we prove that the radius of convergence of a `FormalMultilinearSeries` is equal to
$\liminf_{n\to\infty} \frac{1}{\sqrt[n]{‖p n‖}}$. This lemma can't go to `Analysis.Analytic.Basic`
because this would create a circular dependency once we redefine `exp` using
`FormalMultilinearSeries`.
-/
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
[NormedSpace 𝕜 E] {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
open scoped Topology NNReal ENNReal
open Filter Asymptotics
namespace FormalMultilinearSeries
variable (p : FormalMultilinearSeries 𝕜 E F)
/-- The radius of a formal multilinear series is equal to
$\liminf_{n\to\infty} \frac{1}{\sqrt[n]{‖p n‖}}$. The actual statement uses `ℝ≥0` and some
coercions. -/
theorem radius_eq_liminf :
p.radius = liminf (fun n => (1 / (‖p n‖₊ ^ (1 / (n : ℝ)) : ℝ≥0) : ℝ≥0∞)) atTop := by
have :
∀ (r : ℝ≥0) {n},
0 < n → ((r : ℝ≥0∞) ≤ 1 / ↑(‖p n‖₊ ^ (1 / (n : ℝ))) ↔ ‖p n‖₊ * r ^ n ≤ 1) := by
intro r n hn
have : 0 < (n : ℝ) := Nat.cast_pos.2 hn
conv_lhs =>
rw [one_div, ENNReal.le_inv_iff_mul_le, ← ENNReal.coe_mul, ENNReal.coe_le_one_iff, one_div, ←
NNReal.rpow_one r, ← mul_inv_cancel₀ this.ne', NNReal.rpow_mul, ← NNReal.mul_rpow, ←
NNReal.one_rpow n⁻¹, NNReal.rpow_le_rpow_iff (inv_pos.2 this), mul_comm,
NNReal.rpow_natCast]
apply le_antisymm <;> refine ENNReal.le_of_forall_nnreal_lt fun r hr => ?_
· have := ((TFAE_exists_lt_isLittleO_pow (fun n => ‖p n‖ * r ^ n) 1).out 1 7).1
(p.isLittleO_of_lt_radius hr)
obtain ⟨a, ha, H⟩ := this
apply le_liminf_of_le
· infer_param
· rw [← eventually_map]
refine
H.mp ((eventually_gt_atTop 0).mono fun n hn₀ hn => (this _ hn₀).2 (NNReal.coe_le_coe.1 ?_))
push_cast
exact (le_abs_self _).trans (hn.trans (pow_le_one₀ ha.1.le ha.2.le))
· refine p.le_radius_of_isBigO <| .of_norm_eventuallyLE ?_
filter_upwards [eventually_lt_of_lt_liminf hr, eventually_gt_atTop 0] with n hn hn₀
simpa using NNReal.coe_le_coe.2 ((this _ hn₀).1 hn.le)
/-- The **Cauchy-Hadamard theorem** for formal multilinear series: The inverse of the radius
is equal to $\limsup_{n\to\infty} \sqrt[n]{‖p n‖}$. -/
theorem radius_inv_eq_limsup :
p.radius⁻¹ = limsup (fun n ↦ ((‖p n‖₊ ^ (1 / (n : ℝ)) : ℝ≥0) : ℝ≥0∞)) atTop := by
simpa [ENNReal.inv_liminf] using congr($(p.radius_eq_liminf)⁻¹)
end FormalMultilinearSeries |
.lake/packages/mathlib/Mathlib/Analysis/Analytic/Inverse.lean | import Mathlib.Analysis.Analytic.Composition
import Mathlib.Analysis.Analytic.Linear
import Mathlib.Tactic.Positivity
/-!
# Inverse of analytic functions
We construct the left and right inverse of a formal multilinear series with invertible linear term,
we prove that they coincide and study their properties (notably convergence). We deduce that the
inverse of an analytic open partial homeomorphism is analytic.
## Main statements
* `p.leftInv i x`: the formal left inverse of the formal multilinear series `p`, with constant
coefficient `x`, for `i : E ≃L[𝕜] F` which coincides with `p₁`.
* `p.rightInv i x`: the formal right inverse of the formal multilinear series `p`, with constant
coefficient `x`, for `i : E ≃L[𝕜] F` which coincides with `p₁`.
* `p.leftInv_comp` says that `p.leftInv i x` is indeed a left inverse to `p` when `p₁ = i`.
* `p.rightInv_comp` says that `p.rightInv i x` is indeed a right inverse to `p` when `p₁ = i`.
* `p.leftInv_eq_rightInv`: the two inverses coincide.
* `p.radius_rightInv_pos_of_radius_pos`: if a power series has a positive radius of convergence,
then so does its inverse.
* `OpenPartialHomeomorph.hasFPowerSeriesAt_symm` shows that, if an open partial homeomorph has a
power series `p` at a point, with invertible linear part, then the inverse also has a power series
at the image point, given by `p.leftInv`.
-/
open scoped Topology ENNReal
open Finset Filter
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜]
{E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E]
{F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
{G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G]
namespace FormalMultilinearSeries
/-! ### The left inverse of a formal multilinear series -/
/-- The left inverse of a formal multilinear series, where the `n`-th term is defined inductively
in terms of the previous ones to make sure that `(leftInv p i) ∘ p = id`. For this, the linear term
`p₁` in `p` should be invertible. In the definition, `i` is a linear isomorphism that should
coincide with `p₁`, so that one can use its inverse in the construction. The definition does not
use that `i = p₁`, but proofs that the definition is well-behaved do.
The `n`-th term in `q ∘ p` is `∑ qₖ (p_{j₁}, ..., p_{jₖ})` over `j₁ + ... + jₖ = n`. In this
expression, `qₙ` appears only once, in `qₙ (p₁, ..., p₁)`. We adjust the definition so that this
term compensates the rest of the sum, using `i⁻¹` as an inverse to `p₁`.
These formulas only make sense when the constant term `p₀` vanishes. The definition we give is
general, but it ignores the value of `p₀`.
-/
noncomputable def leftInv (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) (x : E) :
FormalMultilinearSeries 𝕜 F E
| 0 => ContinuousMultilinearMap.uncurry0 𝕜 _ x
| 1 => (continuousMultilinearCurryFin1 𝕜 F E).symm i.symm
| n + 2 =>
-∑ c : { c : Composition (n + 2) // c.length < n + 2 },
(leftInv p i x (c : Composition (n + 2)).length).compAlongComposition
(p.compContinuousLinearMap i.symm) c
@[simp]
theorem leftInv_coeff_zero (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) (x : E) :
p.leftInv i x 0 = ContinuousMultilinearMap.uncurry0 𝕜 _ x := by rw [leftInv]
@[simp]
theorem leftInv_coeff_one (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) (x : E) :
p.leftInv i x 1 = (continuousMultilinearCurryFin1 𝕜 F E).symm i.symm := by rw [leftInv]
/-- The left inverse does not depend on the zeroth coefficient of a formal multilinear
series. -/
theorem leftInv_removeZero (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) (x : E) :
p.removeZero.leftInv i x = p.leftInv i x := by
ext1 n
induction n using Nat.strongRec' with | _ n IH
match n with
| 0 => simp -- if one replaces `simp` with `refl`, the proof times out in the kernel.
| 1 => simp -- TODO: why?
| n + 2 =>
simp only [leftInv, neg_inj]
refine Finset.sum_congr rfl fun c cuniv => ?_
rcases c with ⟨c, hc⟩
ext v
simp [IH _ hc]
/-- The left inverse to a formal multilinear series is indeed a left inverse, provided its linear
term is invertible. -/
theorem leftInv_comp (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) (x : E)
(h : p 1 = (continuousMultilinearCurryFin1 𝕜 E F).symm i) :
(leftInv p i x).comp p = id 𝕜 E x := by
ext n v
classical
match n with
| 0 =>
simp only [comp_coeff_zero', leftInv_coeff_zero, ContinuousMultilinearMap.uncurry0_apply,
id_apply_zero]
| 1 =>
simp only [leftInv_coeff_one, comp_coeff_one, h, id_apply_one, ContinuousLinearEquiv.coe_apply,
ContinuousLinearEquiv.symm_apply_apply, continuousMultilinearCurryFin1_symm_apply]
| n + 2 =>
have A :
(Finset.univ : Finset (Composition (n + 2))) =
{c | Composition.length c < n + 2}.toFinset ∪ {Composition.ones (n + 2)} := by
refine Subset.antisymm (fun c _ => ?_) (subset_univ _)
by_cases! h : c.length < n + 2
· simp [h]
· simp [Composition.eq_ones_iff_le_length.2 h]
have B :
Disjoint ({c | Composition.length c < n + 2} : Set (Composition (n + 2))).toFinset
{Composition.ones (n + 2)} := by
simp
have C :
((p.leftInv i x (Composition.ones (n + 2)).length)
fun j : Fin (Composition.ones n.succ.succ).length =>
p 1 fun _ => v ((Fin.castLE (Composition.length_le _)) j)) =
p.leftInv i x (n + 2) fun j : Fin (n + 2) => p 1 fun _ => v j := by
apply FormalMultilinearSeries.congr _ (Composition.ones_length _) fun j hj1 hj2 => ?_
exact FormalMultilinearSeries.congr _ rfl fun k _ _ => by congr
have D :
(p.leftInv i x (n + 2) fun j : Fin (n + 2) => p 1 fun _ => v j) =
-∑ c ∈ {c : Composition (n + 2) | c.length < n + 2}.toFinset,
(p.leftInv i x c.length) (p.applyComposition c v) := by
simp only [leftInv, ContinuousMultilinearMap.neg_apply, neg_inj,
ContinuousMultilinearMap.sum_apply]
convert
(sum_toFinset_eq_subtype
(fun c : Composition (n + 2) => c.length < n + 2)
(fun c : Composition (n + 2) =>
(ContinuousMultilinearMap.compAlongComposition
(p.compContinuousLinearMap (i.symm : F →L[𝕜] E)) c (p.leftInv i x c.length))
fun j : Fin (n + 2) => p 1 fun _ : Fin 1 => v j)).symm.trans
_
simp only [compContinuousLinearMap_applyComposition,
ContinuousMultilinearMap.compAlongComposition_apply]
congr
ext c
congr
ext k
simp [h]
simp [FormalMultilinearSeries.comp, A, Finset.sum_union B,
applyComposition_ones, C, D, -Set.toFinset_setOf, -Finset.union_singleton]
/-! ### The right inverse of a formal multilinear series -/
/-- The right inverse of a formal multilinear series, where the `n`-th term is defined inductively
in terms of the previous ones to make sure that `p ∘ (rightInv p i) = id`. For this, the linear
term `p₁` in `p` should be invertible. In the definition, `i` is a linear isomorphism that should
coincide with `p₁`, so that one can use its inverse in the construction. The definition does not
use that `i = p₁`, but proofs that the definition is well-behaved do.
The `n`-th term in `p ∘ q` is `∑ pₖ (q_{j₁}, ..., q_{jₖ})` over `j₁ + ... + jₖ = n`. In this
expression, `qₙ` appears only once, in `p₁ (qₙ)`. We adjust the definition of `qₙ` so that this
term compensates the rest of the sum, using `i⁻¹` as an inverse to `p₁`.
These formulas only make sense when the constant term `p₀` vanishes. The definition we give is
general, but it ignores the value of `p₀`.
-/
noncomputable def rightInv (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) (x : E) :
FormalMultilinearSeries 𝕜 F E
| 0 => ContinuousMultilinearMap.uncurry0 𝕜 _ x
| 1 => (continuousMultilinearCurryFin1 𝕜 F E).symm i.symm
| n + 2 =>
let q : FormalMultilinearSeries 𝕜 F E := fun k => if k < n + 2 then rightInv p i x k else 0;
-(i.symm : F →L[𝕜] E).compContinuousMultilinearMap ((p.comp q) (n + 2))
@[simp]
theorem rightInv_coeff_zero (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) (x : E) :
p.rightInv i x 0 = ContinuousMultilinearMap.uncurry0 𝕜 _ x := by rw [rightInv]
@[simp]
theorem rightInv_coeff_one (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) (x : E) :
p.rightInv i x 1 = (continuousMultilinearCurryFin1 𝕜 F E).symm i.symm := by rw [rightInv]
/-- The right inverse does not depend on the zeroth coefficient of a formal multilinear
series. -/
theorem rightInv_removeZero (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) (x : E) :
p.removeZero.rightInv i x = p.rightInv i x := by
ext1 n
induction n using Nat.strongRec' with | _ n IH
match n with
| 0 => simp only [rightInv_coeff_zero]
| 1 => simp only [rightInv_coeff_one]
| n + 2 =>
simp only [rightInv, neg_inj]
rw [removeZero_comp_of_pos _ _ (add_pos_of_nonneg_of_pos n.zero_le zero_lt_two)]
congr (config := { closePost := false }) 2 with k
by_cases hk : k < n + 2 <;> simp [hk, IH]
theorem comp_rightInv_aux1 {n : ℕ} (hn : 0 < n) (p : FormalMultilinearSeries 𝕜 E F)
(q : FormalMultilinearSeries 𝕜 F E) (v : Fin n → F) :
p.comp q n v =
∑ c ∈ {c : Composition n | 1 < c.length}.toFinset,
p c.length (q.applyComposition c v) + p 1 fun _ => q n v := by
classical
have A :
(Finset.univ : Finset (Composition n)) =
{c | 1 < Composition.length c}.toFinset ∪ {Composition.single n hn} := by
refine Subset.antisymm (fun c _ => ?_) (subset_univ _)
by_cases h : 1 < c.length
· simp [h]
· have : c.length = 1 := by
refine (eq_iff_le_not_lt.2 ⟨?_, h⟩).symm; exact c.length_pos_of_pos hn
rw [← Composition.eq_single_iff_length hn] at this
simp [this]
have B :
Disjoint ({c | 1 < Composition.length c} : Set (Composition n)).toFinset
{Composition.single n hn} := by
simp
have C :
p (Composition.single n hn).length (q.applyComposition (Composition.single n hn) v) =
p 1 fun _ : Fin 1 => q n v := by
apply p.congr (Composition.single_length hn) fun j hj1 _ => ?_
simp [applyComposition_single]
simp [FormalMultilinearSeries.comp, A, Finset.sum_union B, C, -Set.toFinset_setOf,
-add_right_inj, -Composition.single_length, -Finset.union_singleton]
theorem comp_rightInv_aux2 (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) (x : E) (n : ℕ)
(v : Fin (n + 2) → F) :
∑ c ∈ {c : Composition (n + 2) | 1 < c.length}.toFinset,
p c.length (applyComposition (fun k : ℕ => ite (k < n + 2) (p.rightInv i x k) 0) c v) =
∑ c ∈ {c : Composition (n + 2) | 1 < c.length}.toFinset,
p c.length ((p.rightInv i x).applyComposition c v) := by
have N : 0 < n + 2 := by simp
refine sum_congr rfl fun c hc => p.congr rfl fun j hj1 hj2 => ?_
have : ∀ k, c.blocksFun k < n + 2 := by
simp only [Set.mem_toFinset (s := {c : Composition (n + 2) | 1 < c.length}),
Set.mem_setOf_eq] at hc
simp [← Composition.ne_single_iff N, Composition.eq_single_iff_length, ne_of_gt hc]
simp [applyComposition, this]
/-- The right inverse to a formal multilinear series is indeed a right inverse, provided its linear
term is invertible and its constant term vanishes. -/
theorem comp_rightInv (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) (x : E)
(h : p 1 = (continuousMultilinearCurryFin1 𝕜 E F).symm i) :
p.comp (rightInv p i x) = id 𝕜 F (p 0 0) := by
ext (n v)
match n with
| 0 =>
simp only [comp_coeff_zero', Matrix.zero_empty, id_apply_zero]
congr
ext i
exact i.elim0
| 1 =>
simp only [comp_coeff_one, h, rightInv_coeff_one, ContinuousLinearEquiv.apply_symm_apply,
id_apply_one, ContinuousLinearEquiv.coe_apply, continuousMultilinearCurryFin1_symm_apply]
| n + 2 =>
have N : 0 < n + 2 := by simp
simp [comp_rightInv_aux1 N, h, rightInv, comp_rightInv_aux2, -Set.toFinset_setOf]
theorem rightInv_coeff (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) (x : E)
(n : ℕ) (hn : 2 ≤ n) :
p.rightInv i x n =
-(i.symm : F →L[𝕜] E).compContinuousMultilinearMap
(∑ c ∈ ({c | 1 < Composition.length c}.toFinset : Finset (Composition n)),
p.compAlongComposition (p.rightInv i x) c) := by
match n with
| 0 => exact False.elim (zero_lt_two.not_ge hn)
| 1 => exact False.elim (one_lt_two.not_ge hn)
| n + 2 =>
simp only [rightInv, neg_inj]
congr (config := { closePost := false }) 1
ext v
have N : 0 < n + 2 := by simp
have : ((p 1) fun _ : Fin 1 => 0) = 0 := ContinuousMultilinearMap.map_zero _
simp [comp_rightInv_aux1 N, this, comp_rightInv_aux2, -Set.toFinset_setOf]
/-! ### Coincidence of the left and the right inverse -/
theorem leftInv_eq_rightInv (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) (x : E)
(h : p 1 = (continuousMultilinearCurryFin1 𝕜 E F).symm i) :
leftInv p i x = rightInv p i x :=
calc
leftInv p i x = (leftInv p i x).comp (id 𝕜 F (p 0 0)) := by simp
_ = (leftInv p i x).comp (p.comp (rightInv p i x)) := by rw [comp_rightInv p i _ h]
_ = ((leftInv p i x).comp p).comp (rightInv p i x) := by rw [comp_assoc]
_ = (id 𝕜 E x).comp (rightInv p i x) := by rw [leftInv_comp p i _ h]
_ = rightInv p i x := by simp [id_comp' _ _ 0]
/-!
### Convergence of the inverse of a power series
Assume that `p` is a convergent multilinear series, and let `q` be its (left or right) inverse.
Using the left-inverse formula gives
$$
q_n = - (p_1)^{-n} \sum_{k=0}^{n-1} \sum_{i_1 + \dotsc + i_k = n} q_k (p_{i_1}, \dotsc, p_{i_k}).
$$
Assume for simplicity that we are in dimension `1` and `p₁ = 1`. In the formula for `qₙ`, the term
`q_{n-1}` appears with a multiplicity of `n-1` (choosing the index `i_j` for which `i_j = 2` while
all the other indices are equal to `1`), which indicates that `qₙ` might grow like `n!`. This is
bad for summability properties.
It turns out that the right-inverse formula is better behaved, and should instead be used for this
kind of estimate. It reads
$$
q_n = - (p_1)^{-1} \sum_{k=2}^n \sum_{i_1 + \dotsc + i_k = n} p_k (q_{i_1}, \dotsc, q_{i_k}).
$$
Here, `q_{n-1}` can only appear in the term with `k = 2`, and it only appears twice, so there is
hope this formula can lead to an at most geometric behavior.
Let `Qₙ = ‖qₙ‖`. Bounding `‖pₖ‖` with `C r^k` gives an inequality
$$
Q_n ≤ C' \sum_{k=2}^n r^k \sum_{i_1 + \dotsc + i_k = n} Q_{i_1} \dotsm Q_{i_k}.
$$
This formula is not enough to prove by naive induction on `n` a bound of the form `Qₙ ≤ D R^n`.
However, assuming that the inequality above were an equality, one could get a formula for the
generating series of the `Qₙ`:
$$
\begin{align}
Q(z) & := \sum Q_n z^n = Q_1 z + C' \sum_{2 \leq k \leq n} \sum_{i_1 + \dotsc + i_k = n}
(r z^{i_1} Q_{i_1}) \dotsm (r z^{i_k} Q_{i_k})
\\ & = Q_1 z + C' \sum_{k = 2}^\infty (\sum_{i_1 \geq 1} r z^{i_1} Q_{i_1})
\dotsm (\sum_{i_k \geq 1} r z^{i_k} Q_{i_k})
\\ & = Q_1 z + C' \sum_{k = 2}^\infty (r Q(z))^k
= Q_1 z + C' (r Q(z))^2 / (1 - r Q(z)).
\end{align}
$$
One can solve this formula explicitly. The solution is analytic in a neighborhood of `0` in `ℂ`,
hence its coefficients grow at most geometrically (by a contour integral argument), and therefore
the original `Qₙ`, which are bounded by these ones, are also at most geometric.
This classical argument is not really satisfactory, as it requires an a priori bound on a complex
analytic function. Another option would be to compute explicitly its terms (with binomial
coefficients) to obtain an explicit geometric bound, but this would be very painful.
Instead, we will use the above intuition, but in a slightly different form, with finite sums and an
induction. I learnt this trick in [poeschel2017siegelsternberg]. Let
$S_n = \sum_{k=1}^n Q_k a^k$ (where `a` is a positive real parameter to be chosen suitably small).
The above computation but with finite sums shows that
$$
S_n \leq Q_1 a + C' \sum_{k=2}^n (r S_{n-1})^k.
$$
In particular, $S_n \leq Q_1 a + C' (r S_{n-1})^2 / (1- r S_{n-1})$.
Assume that $S_{n-1} \leq K a$, where `K > Q₁` is fixed and `a` is small enough so that
`r K a ≤ 1/2` (to control the denominator). Then this equation gives a bound
$S_n \leq Q_1 a + 2 C' r^2 K^2 a^2$.
If `a` is small enough, this is bounded by `K a` as the second term is quadratic in `a`, and
therefore negligible.
By induction, we deduce `Sₙ ≤ K a` for all `n`, which gives in particular the fact that `aⁿ Qₙ`
remains bounded.
-/
/-- First technical lemma to control the growth of coefficients of the inverse. Bound the explicit
expression for `∑_{k<n+1} aᵏ Qₖ` in terms of a sum of powers of the same sum one step before,
in a general abstract setup. -/
theorem radius_right_inv_pos_of_radius_pos_aux1 (n : ℕ) (p : ℕ → ℝ) (hp : ∀ k, 0 ≤ p k) {r a : ℝ}
(hr : 0 ≤ r) (ha : 0 ≤ a) :
∑ k ∈ Ico 2 (n + 1),
a ^ k *
∑ c ∈ ({c | 1 < Composition.length c}.toFinset : Finset (Composition k)),
r ^ c.length * ∏ j, p (c.blocksFun j) ≤
∑ j ∈ Ico 2 (n + 1), r ^ j * (∑ k ∈ Ico 1 n, a ^ k * p k) ^ j :=
calc
∑ k ∈ Ico 2 (n + 1),
a ^ k *
∑ c ∈ ({c | 1 < Composition.length c}.toFinset : Finset (Composition k)),
r ^ c.length * ∏ j, p (c.blocksFun j) =
∑ k ∈ Ico 2 (n + 1),
∑ c ∈ ({c | 1 < Composition.length c}.toFinset : Finset (Composition k)),
∏ j, r * (a ^ c.blocksFun j * p (c.blocksFun j)) := by
simp_rw [mul_sum]
congr! with k _ c
rw [prod_mul_distrib, prod_mul_distrib, prod_pow_eq_pow_sum, Composition.sum_blocksFun,
prod_const, card_fin]
ring
_ ≤
∑ d ∈ compPartialSumTarget 2 (n + 1) n,
∏ j : Fin d.2.length, r * (a ^ d.2.blocksFun j * p (d.2.blocksFun j)) := by
rw [sum_sigma']
gcongr
· intro x _ _
exact prod_nonneg fun j _ => mul_nonneg hr (mul_nonneg (pow_nonneg ha _) (hp _))
rintro ⟨k, c⟩ hd
simp only [Set.mem_toFinset (s := {c | 1 < Composition.length c}), mem_Ico, mem_sigma,
Set.mem_setOf_eq] at hd
simp only [mem_compPartialSumTarget_iff]
refine ⟨hd.2, c.length_le.trans_lt hd.1.2, fun j => ?_⟩
have : c ≠ Composition.single k (zero_lt_two.trans_le hd.1.1) := by
simp [Composition.eq_single_iff_length, ne_of_gt hd.2]
rw [Composition.ne_single_iff] at this
exact (this j).trans_le (Nat.lt_succ_iff.mp hd.1.2)
_ = ∑ e ∈ compPartialSumSource 2 (n + 1) n, ∏ j : Fin e.1, r * (a ^ e.2 j * p (e.2 j)) := by
symm
apply compChangeOfVariables_sum
rintro ⟨k, blocksFun⟩ H
have K : (compChangeOfVariables 2 (n + 1) n ⟨k, blocksFun⟩ H).snd.length = k := by simp
congr 2 <;> try rw [K]
rw [Fin.heq_fun_iff K.symm]
intro j
rw [compChangeOfVariables_blocksFun]
_ = ∑ j ∈ Ico 2 (n + 1), r ^ j * (∑ k ∈ Ico 1 n, a ^ k * p k) ^ j := by
rw [compPartialSumSource,
← sum_sigma' (Ico 2 (n + 1))
(fun k : ℕ => (Fintype.piFinset fun _ : Fin k => Ico 1 n : Finset (Fin k → ℕ)))
(fun n e => ∏ j : Fin n, r * (a ^ e j * p (e j)))]
congr! with j
simp only [← @MultilinearMap.mkPiAlgebra_apply ℝ (Fin j) _ ℝ]
simp only [←
MultilinearMap.map_sum_finset (MultilinearMap.mkPiAlgebra ℝ (Fin j) ℝ) fun _ (m : ℕ) =>
r * (a ^ m * p m)]
simp only [MultilinearMap.mkPiAlgebra_apply]
simp [prod_const, ← mul_sum, mul_pow]
/-- Second technical lemma to control the growth of coefficients of the inverse. Bound the explicit
expression for `∑_{k<n+1} aᵏ Qₖ` in terms of a sum of powers of the same sum one step before,
in the specific setup we are interesting in, by reducing to the general bound in
`radius_rightInv_pos_of_radius_pos_aux1`. -/
theorem radius_rightInv_pos_of_radius_pos_aux2 {x : E} {n : ℕ} (hn : 2 ≤ n + 1)
(p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) {r a C : ℝ} (hr : 0 ≤ r) (ha : 0 ≤ a)
(hC : 0 ≤ C) (hp : ∀ n, ‖p n‖ ≤ C * r ^ n) :
∑ k ∈ Ico 1 (n + 1), a ^ k * ‖p.rightInv i x k‖ ≤
‖(i.symm : F →L[𝕜] E)‖ * a +
‖(i.symm : F →L[𝕜] E)‖ * C *
∑ k ∈ Ico 2 (n + 1), (r * ∑ j ∈ Ico 1 n, a ^ j * ‖p.rightInv i x j‖) ^ k :=
let I := ‖(i.symm : F →L[𝕜] E)‖
calc
∑ k ∈ Ico 1 (n + 1), a ^ k * ‖p.rightInv i x k‖ =
a * I + ∑ k ∈ Ico 2 (n + 1), a ^ k * ‖p.rightInv i x k‖ := by
simp only [I, LinearIsometryEquiv.norm_map, pow_one, rightInv_coeff_one,
show Ico (1 : ℕ) 2 = {1} from Nat.Ico_succ_singleton 1,
sum_singleton, ← sum_Ico_consecutive _ one_le_two hn]
_ =
a * I +
∑ k ∈ Ico 2 (n + 1),
a ^ k *
‖(i.symm : F →L[𝕜] E).compContinuousMultilinearMap
(∑ c ∈ ({c | 1 < Composition.length c}.toFinset : Finset (Composition k)),
p.compAlongComposition (p.rightInv i x) c)‖ := by
congr! 2 with j hj
rw [rightInv_coeff _ _ _ _ (mem_Ico.1 hj).1, norm_neg]
_ ≤
a * ‖(i.symm : F →L[𝕜] E)‖ +
∑ k ∈ Ico 2 (n + 1),
a ^ k *
(I *
∑ c ∈ ({c | 1 < Composition.length c}.toFinset : Finset (Composition k)),
C * r ^ c.length * ∏ j, ‖p.rightInv i x (c.blocksFun j)‖) := by
gcongr with j
apply (ContinuousLinearMap.norm_compContinuousMultilinearMap_le _ _).trans
gcongr
apply (norm_sum_le _ _).trans
gcongr
apply (compAlongComposition_norm _ _ _).trans
gcongr
apply hp
_ = I * a + I * C * ∑ k ∈ Ico 2 (n + 1), a ^ k *
∑ c ∈ ({c | 1 < Composition.length c}.toFinset : Finset (Composition k)),
r ^ c.length * ∏ j, ‖p.rightInv i x (c.blocksFun j)‖ := by
simp_rw [I, mul_assoc C, ← mul_sum, ← mul_assoc, mul_comm _ ‖(i.symm : F →L[𝕜] E)‖,
mul_assoc, ← mul_sum, ← mul_assoc, mul_comm _ C, mul_assoc, ← mul_sum]
ring
_ ≤ I * a + I * C *
∑ k ∈ Ico 2 (n + 1), (r * ∑ j ∈ Ico 1 n, a ^ j * ‖p.rightInv i x j‖) ^ k := by
gcongr _ + _ * _ * ?_
simp_rw [mul_pow]
apply
radius_right_inv_pos_of_radius_pos_aux1 n (fun k => ‖p.rightInv i x k‖)
(fun k => norm_nonneg _) hr ha
/-- If a a formal multilinear series has a positive radius of convergence, then its right inverse
also has a positive radius of convergence. -/
theorem radius_rightInv_pos_of_radius_pos
{p : FormalMultilinearSeries 𝕜 E F} {i : E ≃L[𝕜] F} {x : E}
(hp : 0 < p.radius) : 0 < (p.rightInv i x).radius := by
obtain ⟨C, r, Cpos, rpos, ple⟩ :
∃ (C r : _) (_ : 0 < C) (_ : 0 < r), ∀ n : ℕ, ‖p n‖ ≤ C * r ^ n :=
le_mul_pow_of_radius_pos p hp
let I := ‖(i.symm : F →L[𝕜] E)‖
-- choose `a` small enough to make sure that `∑_{k ≤ n} aᵏ Qₖ` will be controllable by
-- induction
obtain ⟨a, apos, ha1, ha2⟩ :
∃ (a : _) (apos : 0 < a),
2 * I * C * r ^ 2 * (I + 1) ^ 2 * a ≤ 1 ∧ r * (I + 1) * a ≤ 1 / 2 := by
have :
Tendsto (fun a => 2 * I * C * r ^ 2 * (I + 1) ^ 2 * a) (𝓝 0)
(𝓝 (2 * I * C * r ^ 2 * (I + 1) ^ 2 * 0)) :=
tendsto_const_nhds.mul tendsto_id
have A : ∀ᶠ a in 𝓝 0, 2 * I * C * r ^ 2 * (I + 1) ^ 2 * a < 1 := by
apply (tendsto_order.1 this).2; simp [zero_lt_one]
have : Tendsto (fun a => r * (I + 1) * a) (𝓝 0) (𝓝 (r * (I + 1) * 0)) :=
tendsto_const_nhds.mul tendsto_id
have B : ∀ᶠ a in 𝓝 0, r * (I + 1) * a < 1 / 2 := by
apply (tendsto_order.1 this).2; simp
have C : ∀ᶠ a in 𝓝[>] (0 : ℝ), (0 : ℝ) < a := by
filter_upwards [self_mem_nhdsWithin] with _ ha using ha
rcases (C.and ((A.and B).filter_mono inf_le_left)).exists with ⟨a, ha⟩
exact ⟨a, ha.1, ha.2.1.le, ha.2.2.le⟩
-- check by induction that the partial sums are suitably bounded, using the choice of `a` and the
-- inductive control from Lemma `radius_rightInv_pos_of_radius_pos_aux2`.
let S n := ∑ k ∈ Ico 1 n, a ^ k * ‖p.rightInv i x k‖
have IRec : ∀ n, 1 ≤ n → S n ≤ (I + 1) * a := by
apply Nat.le_induction
· simp only [S]
rw [Ico_eq_empty_of_le (le_refl 1), sum_empty]
exact mul_nonneg (add_nonneg (norm_nonneg _) zero_le_one) apos.le
· intro n one_le_n hn
have In : 2 ≤ n + 1 := by omega
have rSn : r * S n ≤ 1 / 2 :=
calc
r * S n ≤ r * ((I + 1) * a) := by gcongr
_ ≤ 1 / 2 := by rwa [← mul_assoc]
calc
S (n + 1) ≤ I * a + I * C * ∑ k ∈ Ico 2 (n + 1), (r * S n) ^ k :=
radius_rightInv_pos_of_radius_pos_aux2 In p i rpos.le apos.le Cpos.le ple
_ = I * a + I * C * (((r * S n) ^ 2 - (r * S n) ^ (n + 1)) / (1 - r * S n)) := by
rw [geom_sum_Ico' _ In]; exact ne_of_lt (rSn.trans_lt (by norm_num))
_ ≤ I * a + I * C * ((r * S n) ^ 2 / (1 / 2)) := by
gcongr
· simp only [sub_le_self_iff]
positivity
· linarith only [rSn]
_ = I * a + 2 * I * C * (r * S n) ^ 2 := by ring
_ ≤ I * a + 2 * I * C * (r * ((I + 1) * a)) ^ 2 := by gcongr
_ = (I + 2 * I * C * r ^ 2 * (I + 1) ^ 2 * a) * a := by ring
_ ≤ (I + 1) * a := by gcongr
-- conclude that all coefficients satisfy `aⁿ Qₙ ≤ (I + 1) a`.
let a' : NNReal := ⟨a, apos.le⟩
suffices H : (a' : ENNReal) ≤ (p.rightInv i x).radius by
apply lt_of_lt_of_le _ H
-- Prior to https://github.com/leanprover/lean4/pull/2734, this was `exact_mod_cast apos`.
simpa only [ENNReal.coe_pos]
apply le_radius_of_eventually_le _ ((I + 1) * a)
filter_upwards [Ici_mem_atTop 1] with n (hn : 1 ≤ n)
calc
‖p.rightInv i x n‖ * (a' : ℝ) ^ n = a ^ n * ‖p.rightInv i x n‖ := mul_comm _ _
_ ≤ ∑ k ∈ Ico 1 (n + 1), a ^ k * ‖p.rightInv i x k‖ :=
(haveI : ∀ k ∈ Ico 1 (n + 1), 0 ≤ a ^ k * ‖p.rightInv i x k‖ := fun k _ => by positivity
single_le_sum this (by simp [hn]))
_ ≤ (I + 1) * a := IRec (n + 1) (by simp)
/-- If a a formal multilinear series has a positive radius of convergence, then its left inverse
also has a positive radius of convergence. -/
theorem radius_leftInv_pos_of_radius_pos
{p : FormalMultilinearSeries 𝕜 E F} {i : E ≃L[𝕜] F} {x : E}
(hp : 0 < p.radius) (h : p 1 = (continuousMultilinearCurryFin1 𝕜 E F).symm i) :
0 < (p.leftInv i x).radius := by
rw [leftInv_eq_rightInv _ _ _ h]
exact radius_rightInv_pos_of_radius_pos hp
end FormalMultilinearSeries
/-!
### The inverse of an analytic open partial homeomorphism is analytic
-/
open FormalMultilinearSeries List
lemma HasFPowerSeriesAt.tendsto_partialSum_prod_of_comp
{f : E → G} {q : FormalMultilinearSeries 𝕜 F G}
{p : FormalMultilinearSeries 𝕜 E F} {x : E}
(hf : HasFPowerSeriesAt f (q.comp p) x) (hq : 0 < q.radius) (hp : 0 < p.radius) :
∀ᶠ y in 𝓝 0, Tendsto (fun (a : ℕ × ℕ) ↦ q.partialSum a.1 (p.partialSum a.2 y
- p 0 (fun _ ↦ 0))) atTop (𝓝 (f (x + y))) := by
rcases hf with ⟨r0, h0⟩
rcases q.comp_summable_nnreal p hq hp with ⟨r1, r1_pos : 0 < r1, hr1⟩
let r : ℝ≥0∞ := min r0 r1
have : EMetric.ball (0 : E) r ∈ 𝓝 0 :=
EMetric.ball_mem_nhds 0 (lt_min h0.r_pos (by exact_mod_cast r1_pos))
filter_upwards [this] with y hy
have hy0 : y ∈ EMetric.ball 0 r0 := EMetric.ball_subset_ball (min_le_left _ _) hy
have A : HasSum (fun i : Σ n, Composition n => q.compAlongComposition p i.2 fun _j => y)
(f (x + y)) := by
have cau : CauchySeq fun s : Finset (Σ n, Composition n) =>
∑ i ∈ s, q.compAlongComposition p i.2 fun _j => y := by
apply cauchySeq_finset_of_norm_bounded (NNReal.summable_coe.2 hr1) _
simp only [coe_nnnorm, NNReal.coe_mul, NNReal.coe_pow]
rintro ⟨n, c⟩
calc
‖(compAlongComposition q p c) fun _j : Fin n => y‖ ≤
‖compAlongComposition q p c‖ * ∏ _j : Fin n, ‖y‖ := by
apply ContinuousMultilinearMap.le_opNorm
_ ≤ ‖compAlongComposition q p c‖ * (r1 : ℝ) ^ n := by
apply mul_le_mul_of_nonneg_left _ (norm_nonneg _)
rw [Finset.prod_const, Finset.card_fin]
gcongr
rw [EMetric.mem_ball, edist_zero_eq_enorm] at hy
have := le_trans (le_of_lt hy) (min_le_right _ _)
rwa [enorm_le_coe, ← NNReal.coe_le_coe, coe_nnnorm] at this
apply HasSum.of_sigma (fun b ↦ hasSum_fintype _) ?_ cau
simpa [FormalMultilinearSeries.comp] using h0.hasSum hy0
have B : Tendsto (fun (n : ℕ × ℕ) => ∑ i ∈ compPartialSumTarget 0 n.1 n.2,
q.compAlongComposition p i.2 fun _j => y) atTop (𝓝 (f (x + y))) := by
apply Tendsto.comp A compPartialSumTarget_tendsto_prod_atTop
have C : Tendsto (fun (n : ℕ × ℕ) => q.partialSum n.1 (∑ a ∈ Finset.Ico 1 n.2, p a fun _b ↦ y))
atTop (𝓝 (f (x + y))) := by simpa [comp_partialSum] using B
apply C.congr'
filter_upwards [Ici_mem_atTop (0, 1)]
rintro ⟨-, n⟩ ⟨-, (hn : 1 ≤ n)⟩
congr
rw [partialSum, eq_sub_iff_add_eq', Finset.range_eq_Ico,
Finset.sum_eq_sum_Ico_succ_bot hn]
congr with i
exact i.elim0
lemma HasFPowerSeriesAt.eventually_hasSum_of_comp {f : E → F} {g : F → G}
{q : FormalMultilinearSeries 𝕜 F G} {p : FormalMultilinearSeries 𝕜 E F} {x : E}
(hgf : HasFPowerSeriesAt (g ∘ f) (q.comp p) x) (hf : HasFPowerSeriesAt f p x)
(hq : 0 < q.radius) :
∀ᶠ y in 𝓝 0, HasSum (fun n : ℕ => q n fun _ : Fin n => (f (x + y) - f x)) (g (f (x + y))) := by
have : ∀ᶠ y in 𝓝 (0 : E), f (x + y) - f x ∈ EMetric.ball 0 q.radius := by
have A : ContinuousAt (fun y ↦ f (x + y) - f x) 0 := by
apply ContinuousAt.sub _ continuousAt_const
exact hf.continuousAt.comp_of_eq (continuous_add_left x).continuousAt (by simp)
have B : EMetric.ball 0 q.radius ∈ 𝓝 (f (x + 0) - f x) := by
simpa using EMetric.ball_mem_nhds _ hq
exact A.preimage_mem_nhds B
filter_upwards [hgf.tendsto_partialSum_prod_of_comp hq (hf.radius_pos),
hf.tendsto_partialSum, this] with y hy h'y h''y
have L : Tendsto (fun n ↦ q.partialSum n (f (x + y) - f x)) atTop (𝓝 (g (f (x + y)))) := by
apply (closed_nhds_basis (g (f (x + y)))).tendsto_right_iff.2
rintro u ⟨hu, u_closed⟩
simp only [id_eq, eventually_atTop, ge_iff_le]
rcases mem_nhds_iff.1 hu with ⟨v, vu, v_open, hv⟩
obtain ⟨a₀, b₀, hab⟩ : ∃ a₀ b₀, ∀ (a b : ℕ), a₀ ≤ a → b₀ ≤ b →
q.partialSum a (p.partialSum b y - (p 0) fun _ ↦ 0) ∈ v := by
simpa using hy (v_open.mem_nhds hv)
refine ⟨a₀, fun a ha ↦ ?_⟩
have : Tendsto (fun b ↦ q.partialSum a (p.partialSum b y - (p 0) fun _ ↦ 0)) atTop
(𝓝 (q.partialSum a (f (x + y) - f x))) := by
have : ContinuousAt (q.partialSum a) (f (x + y) - f x) :=
(partialSum_continuous q a).continuousAt
apply this.tendsto.comp
apply Tendsto.sub h'y
convert tendsto_const_nhds
exact (HasFPowerSeriesAt.coeff_zero hf fun _ ↦ 0).symm
apply u_closed.mem_of_tendsto this
filter_upwards [Ici_mem_atTop b₀] with b hb using vu (hab _ _ ha hb)
have C : CauchySeq (fun (s : Finset ℕ) ↦ ∑ n ∈ s, q n fun _ : Fin n => (f (x + y) - f x)) := by
have Z := q.summable_norm_apply (x := f (x + y) - f x) h''y
exact cauchySeq_finset_of_norm_bounded Z (fun i ↦ le_rfl)
exact tendsto_nhds_of_cauchySeq_of_subseq C tendsto_finset_range L
/-- If an open partial homeomorphism `f` is defined at `a` and has a power series expansion there
with invertible linear term, then `f.symm` has a power series expansion at `f a`, given by the
inverse of the initial power series. -/
theorem OpenPartialHomeomorph.hasFPowerSeriesAt_symm (f : OpenPartialHomeomorph E F) {a : E}
{i : E ≃L[𝕜] F} (h0 : a ∈ f.source) {p : FormalMultilinearSeries 𝕜 E F}
(h : HasFPowerSeriesAt f p a) (hp : p 1 = (continuousMultilinearCurryFin1 𝕜 E F).symm i) :
HasFPowerSeriesAt f.symm (p.leftInv i a) (f a) := by
have A : HasFPowerSeriesAt (f.symm ∘ f) ((p.leftInv i a).comp p) a := by
have : HasFPowerSeriesAt (ContinuousLinearMap.id 𝕜 E) ((p.leftInv i a).comp p) a := by
rw [leftInv_comp _ _ _ hp]
exact (ContinuousLinearMap.id 𝕜 E).hasFPowerSeriesAt a
apply this.congr
filter_upwards [f.open_source.mem_nhds h0] with x hx using by simp [hx]
have B : ∀ᶠ (y : E) in 𝓝 0, HasSum (fun n ↦ (p.leftInv i a n) fun _ ↦ f (a + y) - f a)
(f.symm (f (a + y))) := by
simpa using A.eventually_hasSum_of_comp h (radius_leftInv_pos_of_radius_pos h.radius_pos hp)
have C : ∀ᶠ (y : E) in 𝓝 a, HasSum (fun n ↦ (p.leftInv i a n) fun _ ↦ f y - f a)
(f.symm (f y)) := by
rw [← sub_eq_zero_of_eq (a := a) rfl] at B
have : ContinuousAt (fun x ↦ x - a) a := by fun_prop
simpa using this.preimage_mem_nhds B
have D : ∀ᶠ (y : E) in 𝓝 (f.symm (f a)),
HasSum (fun n ↦ (p.leftInv i a n) fun _ ↦ f y - f a) y := by
simp only [h0, OpenPartialHomeomorph.left_inv]
filter_upwards [C, f.open_source.mem_nhds h0] with x hx h'x
simpa [h'x] using hx
have E : ∀ᶠ z in 𝓝 (f a), HasSum (fun n ↦ (p.leftInv i a n) fun _ ↦ f (f.symm z) - f a)
(f.symm z) := by
have : ContinuousAt f.symm (f a) := f.continuousAt_symm (f.map_source h0)
exact this D
have F : ∀ᶠ z in 𝓝 (f a), HasSum (fun n ↦ (p.leftInv i a n) fun _ ↦ z - f a) (f.symm z) := by
filter_upwards [f.open_target.mem_nhds (f.map_source h0), E] with z hz h'z
simpa [hz] using h'z
rcases EMetric.mem_nhds_iff.1 F with ⟨r, r_pos, hr⟩
refine ⟨min r (p.leftInv i a).radius, min_le_right _ _,
lt_min r_pos (radius_leftInv_pos_of_radius_pos h.radius_pos hp), fun {y} hy ↦ ?_⟩
have : y + f a ∈ EMetric.ball (f a) r := by
simp only [EMetric.mem_ball, edist_eq_enorm_sub, sub_zero, lt_min_iff,
add_sub_cancel_right] at hy ⊢
exact hy.1
simpa [add_comm] using hr this |
.lake/packages/mathlib/Mathlib/Analysis/Analytic/ConvergenceRadius.lean | import Mathlib.Analysis.Calculus.FormalMultilinearSeries
import Mathlib.Analysis.SpecificLimits.Normed
/-!
# Radius of convergence of a power series
This file introduces the notion of the radius of convergence of a power series.
## Main definitions
Let `p` be a formal multilinear series from `E` to `F`, i.e., `p n` is a multilinear map on `E^n`
for `n : ℕ`.
* `p.radius`: the largest `r : ℝ≥0∞` such that `‖p n‖ * r^n` grows subexponentially.
* `p.le_radius_of_bound`, `p.le_radius_of_bound_nnreal`, `p.le_radius_of_isBigO`: if `‖p n‖ * r ^ n`
is bounded above, then `r ≤ p.radius`;
* `p.isLittleO_of_lt_radius`, `p.norm_mul_pow_le_mul_pow_of_lt_radius`,
`p.isLittleO_one_of_lt_radius`,
`p.norm_mul_pow_le_of_lt_radius`, `p.nnnorm_mul_pow_le_of_lt_radius`: if `r < p.radius`, then
`‖p n‖ * r ^ n` tends to zero exponentially;
* `p.lt_radius_of_isBigO`: if `r ≠ 0` and `‖p n‖ * r ^ n = O(a ^ n)` for some `-1 < a < 1`, then
`r < p.radius`;
* `p.partialSum n x`: the sum `∑_{i = 0}^{n-1} pᵢ xⁱ`.
* `p.sum x`: the sum `∑'_{i = 0}^{∞} pᵢ xⁱ`.
## Implementation details
We only introduce the radius of convergence of a power series, as `p.radius`.
For a power series in finitely many dimensions, there is a finer (directional, coordinate-dependent)
notion, describing the polydisk of convergence. This notion is more specific, and not necessary to
build the general theory. We do not define it here.
-/
noncomputable section
variable {𝕜 E F G : Type*}
open Topology NNReal Filter ENNReal Set Asymptotics
open scoped Pointwise
namespace FormalMultilinearSeries
variable [Semiring 𝕜] [AddCommMonoid E] [AddCommMonoid F] [Module 𝕜 E] [Module 𝕜 F]
variable [TopologicalSpace E] [TopologicalSpace F]
variable [ContinuousAdd E] [ContinuousAdd F]
variable [ContinuousConstSMul 𝕜 E] [ContinuousConstSMul 𝕜 F]
/-- Given a formal multilinear series `p` and a vector `x`, then `p.sum x` is the sum `Σ pₙ xⁿ`. A
priori, it only behaves well when `‖x‖ < p.radius`. -/
protected def sum (p : FormalMultilinearSeries 𝕜 E F) (x : E) : F :=
∑' n : ℕ, p n fun _ => x
/-- Given a formal multilinear series `p` and a vector `x`, then `p.partialSum n x` is the sum
`Σ pₖ xᵏ` for `k ∈ {0,..., n-1}`. -/
def partialSum (p : FormalMultilinearSeries 𝕜 E F) (n : ℕ) (x : E) : F :=
∑ k ∈ Finset.range n, p k fun _ : Fin k => x
/-- The partial sums of a formal multilinear series are continuous. -/
theorem partialSum_continuous (p : FormalMultilinearSeries 𝕜 E F) (n : ℕ) :
Continuous (p.partialSum n) := by
unfold partialSum
fun_prop
end FormalMultilinearSeries
/-! ### The radius of a formal multilinear series -/
variable [NontriviallyNormedField 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E] [NormedAddCommGroup F]
[NormedSpace 𝕜 F] [NormedAddCommGroup G] [NormedSpace 𝕜 G]
namespace FormalMultilinearSeries
variable (p : FormalMultilinearSeries 𝕜 E F) {r : ℝ≥0}
/-- The radius of a formal multilinear series is the largest `r` such that the sum `Σ ‖pₙ‖ ‖y‖ⁿ`
converges for all `‖y‖ < r`. This implies that `Σ pₙ yⁿ` converges for all `‖y‖ < r`, but these
definitions are *not* equivalent in general. -/
def radius (p : FormalMultilinearSeries 𝕜 E F) : ℝ≥0∞ :=
⨆ (r : ℝ≥0) (C : ℝ) (_ : ∀ n, ‖p n‖ * (r : ℝ) ^ n ≤ C), (r : ℝ≥0∞)
/-- If `‖pₙ‖ rⁿ` is bounded in `n`, then the radius of `p` is at least `r`. -/
theorem le_radius_of_bound (C : ℝ) {r : ℝ≥0} (h : ∀ n : ℕ, ‖p n‖ * (r : ℝ) ^ n ≤ C) :
(r : ℝ≥0∞) ≤ p.radius :=
le_iSup_of_le r <| le_iSup_of_le C <| le_iSup (fun _ => (r : ℝ≥0∞)) h
/-- If `‖pₙ‖ rⁿ` is bounded in `n`, then the radius of `p` is at least `r`. -/
theorem le_radius_of_bound_nnreal (C : ℝ≥0) {r : ℝ≥0} (h : ∀ n : ℕ, ‖p n‖₊ * r ^ n ≤ C) :
(r : ℝ≥0∞) ≤ p.radius :=
p.le_radius_of_bound C fun n => mod_cast h n
/-- If `‖pₙ‖ rⁿ = O(1)`, as `n → ∞`, then the radius of `p` is at least `r`. -/
theorem le_radius_of_isBigO (h : (fun n => ‖p n‖ * (r : ℝ) ^ n) =O[atTop] fun _ => (1 : ℝ)) :
↑r ≤ p.radius :=
Exists.elim (isBigO_one_nat_atTop_iff.1 h) fun C hC =>
p.le_radius_of_bound C fun n => (le_abs_self _).trans (hC n)
theorem le_radius_of_eventually_le (C) (h : ∀ᶠ n in atTop, ‖p n‖ * (r : ℝ) ^ n ≤ C) :
↑r ≤ p.radius :=
p.le_radius_of_isBigO <| IsBigO.of_bound C <| h.mono fun n hn => by simpa
theorem le_radius_of_summable_nnnorm (h : Summable fun n => ‖p n‖₊ * r ^ n) : ↑r ≤ p.radius :=
p.le_radius_of_bound_nnreal (∑' n, ‖p n‖₊ * r ^ n) fun _ => h.le_tsum' _
theorem le_radius_of_summable (h : Summable fun n => ‖p n‖ * (r : ℝ) ^ n) : ↑r ≤ p.radius :=
p.le_radius_of_summable_nnnorm <| by
simp only [← coe_nnnorm] at h
exact mod_cast h
theorem radius_eq_top_of_forall_nnreal_isBigO
(h : ∀ r : ℝ≥0, (fun n => ‖p n‖ * (r : ℝ) ^ n) =O[atTop] fun _ => (1 : ℝ)) : p.radius = ∞ :=
ENNReal.eq_top_of_forall_nnreal_le fun r => p.le_radius_of_isBigO (h r)
theorem radius_eq_top_of_eventually_eq_zero (h : ∀ᶠ n in atTop, p n = 0) : p.radius = ∞ :=
p.radius_eq_top_of_forall_nnreal_isBigO fun r =>
(isBigO_zero _ _).congr' (h.mono fun n hn => by simp [hn]) EventuallyEq.rfl
theorem radius_eq_top_of_forall_image_add_eq_zero (n : ℕ) (hn : ∀ m, p (m + n) = 0) :
p.radius = ∞ :=
p.radius_eq_top_of_eventually_eq_zero <|
mem_atTop_sets.2 ⟨n, fun _ hk => tsub_add_cancel_of_le hk ▸ hn _⟩
@[simp]
theorem constFormalMultilinearSeries_radius {v : F} :
(constFormalMultilinearSeries 𝕜 E v).radius = ⊤ :=
(constFormalMultilinearSeries 𝕜 E v).radius_eq_top_of_forall_image_add_eq_zero 1
(by simp [constFormalMultilinearSeries])
/-- `0` has infinite radius of convergence -/
@[simp] lemma zero_radius : (0 : FormalMultilinearSeries 𝕜 E F).radius = ∞ := by
rw [← constFormalMultilinearSeries_zero]
exact constFormalMultilinearSeries_radius
/-- For `r` strictly smaller than the radius of `p`, then `‖pₙ‖ rⁿ` tends to zero exponentially:
for some `0 < a < 1`, `‖p n‖ rⁿ = o(aⁿ)`. -/
theorem isLittleO_of_lt_radius (h : ↑r < p.radius) :
∃ a ∈ Ioo (0 : ℝ) 1, (fun n => ‖p n‖ * (r : ℝ) ^ n) =o[atTop] (a ^ ·) := by
have := (TFAE_exists_lt_isLittleO_pow (fun n => ‖p n‖ * (r : ℝ) ^ n) 1).out 1 4
rw [this]
-- Porting note: was
-- rw [(TFAE_exists_lt_isLittleO_pow (fun n => ‖p n‖ * (r : ℝ) ^ n) 1).out 1 4]
simp only [radius, lt_iSup_iff] at h
rcases h with ⟨t, C, hC, rt⟩
rw [ENNReal.coe_lt_coe, ← NNReal.coe_lt_coe] at rt
have : 0 < (t : ℝ) := r.coe_nonneg.trans_lt rt
rw [← div_lt_one this] at rt
refine ⟨_, rt, C, Or.inr zero_lt_one, fun n => ?_⟩
calc
|‖p n‖ * (r : ℝ) ^ n| = ‖p n‖ * (t : ℝ) ^ n * (r / t : ℝ) ^ n := by
simp [field, abs_mul, div_pow]
_ ≤ C * (r / t : ℝ) ^ n := by gcongr; apply hC
/-- For `r` strictly smaller than the radius of `p`, then `‖pₙ‖ rⁿ = o(1)`. -/
theorem isLittleO_one_of_lt_radius (h : ↑r < p.radius) :
(fun n => ‖p n‖ * (r : ℝ) ^ n) =o[atTop] (fun _ => 1 : ℕ → ℝ) :=
let ⟨_, ha, hp⟩ := p.isLittleO_of_lt_radius h
hp.trans <| (isLittleO_pow_pow_of_lt_left ha.1.le ha.2).congr (fun _ => rfl) one_pow
/-- For `r` strictly smaller than the radius of `p`, then `‖pₙ‖ rⁿ` tends to zero exponentially:
for some `0 < a < 1` and `C > 0`, `‖p n‖ * r ^ n ≤ C * a ^ n`. -/
theorem norm_mul_pow_le_mul_pow_of_lt_radius (h : ↑r < p.radius) :
∃ a ∈ Ioo (0 : ℝ) 1, ∃ C > 0, ∀ n, ‖p n‖ * (r : ℝ) ^ n ≤ C * a ^ n := by
have := ((TFAE_exists_lt_isLittleO_pow (fun n => ‖p n‖ * (r : ℝ) ^ n) 1).out 1 5).mp
(p.isLittleO_of_lt_radius h)
rcases this with ⟨a, ha, C, hC, H⟩
exact ⟨a, ha, C, hC, fun n => (le_abs_self _).trans (H n)⟩
/-- If `r ≠ 0` and `‖pₙ‖ rⁿ = O(aⁿ)` for some `-1 < a < 1`, then `r < p.radius`. -/
theorem lt_radius_of_isBigO (h₀ : r ≠ 0) {a : ℝ} (ha : a ∈ Ioo (-1 : ℝ) 1)
(hp : (fun n => ‖p n‖ * (r : ℝ) ^ n) =O[atTop] (a ^ ·)) : ↑r < p.radius := by
have := ((TFAE_exists_lt_isLittleO_pow (fun n => ‖p n‖ * (r : ℝ) ^ n) 1).out 2 5)
rcases this.mp ⟨a, ha, hp⟩ with ⟨a, ha, C, hC, hp⟩
rw [← pos_iff_ne_zero, ← NNReal.coe_pos] at h₀
lift a to ℝ≥0 using ha.1.le
have : (r : ℝ) < r / a := by
simpa only [div_one] using (div_lt_div_iff_of_pos_left h₀ zero_lt_one ha.1).2 ha.2
norm_cast at this
rw [← ENNReal.coe_lt_coe] at this
refine this.trans_le (p.le_radius_of_bound C fun n => ?_)
rw [NNReal.coe_div, div_pow, ← mul_div_assoc, div_le_iff₀ (pow_pos ha.1 n)]
exact (le_abs_self _).trans (hp n)
/-- For `r` strictly smaller than the radius of `p`, then `‖pₙ‖ rⁿ` is bounded. -/
theorem norm_mul_pow_le_of_lt_radius (p : FormalMultilinearSeries 𝕜 E F) {r : ℝ≥0}
(h : (r : ℝ≥0∞) < p.radius) : ∃ C > 0, ∀ n, ‖p n‖ * (r : ℝ) ^ n ≤ C :=
let ⟨_, ha, C, hC, h⟩ := p.norm_mul_pow_le_mul_pow_of_lt_radius h
⟨C, hC, fun n => (h n).trans <| mul_le_of_le_one_right hC.lt.le (pow_le_one₀ ha.1.le ha.2.le)⟩
/-- For `r` strictly smaller than the radius of `p`, then `‖pₙ‖ rⁿ` is bounded. -/
theorem norm_le_div_pow_of_pos_of_lt_radius (p : FormalMultilinearSeries 𝕜 E F) {r : ℝ≥0}
(h0 : 0 < r) (h : (r : ℝ≥0∞) < p.radius) : ∃ C > 0, ∀ n, ‖p n‖ ≤ C / (r : ℝ) ^ n :=
let ⟨C, hC, hp⟩ := p.norm_mul_pow_le_of_lt_radius h
⟨C, hC, fun n => Iff.mpr (le_div_iff₀ (pow_pos h0 _)) (hp n)⟩
/-- For `r` strictly smaller than the radius of `p`, then `‖pₙ‖ rⁿ` is bounded. -/
theorem nnnorm_mul_pow_le_of_lt_radius (p : FormalMultilinearSeries 𝕜 E F) {r : ℝ≥0}
(h : (r : ℝ≥0∞) < p.radius) : ∃ C > 0, ∀ n, ‖p n‖₊ * r ^ n ≤ C :=
let ⟨C, hC, hp⟩ := p.norm_mul_pow_le_of_lt_radius h
⟨⟨C, hC.lt.le⟩, hC, mod_cast hp⟩
theorem le_radius_of_tendsto (p : FormalMultilinearSeries 𝕜 E F) {l : ℝ}
(h : Tendsto (fun n => ‖p n‖ * (r : ℝ) ^ n) atTop (𝓝 l)) : ↑r ≤ p.radius :=
p.le_radius_of_isBigO (h.isBigO_one _)
theorem le_radius_of_summable_norm (p : FormalMultilinearSeries 𝕜 E F)
(hs : Summable fun n => ‖p n‖ * (r : ℝ) ^ n) : ↑r ≤ p.radius :=
p.le_radius_of_tendsto hs.tendsto_atTop_zero
theorem not_summable_norm_of_radius_lt_nnnorm (p : FormalMultilinearSeries 𝕜 E F) {x : E}
(h : p.radius < ‖x‖₊) : ¬Summable fun n => ‖p n‖ * ‖x‖ ^ n :=
fun hs => not_le_of_gt h (p.le_radius_of_summable_norm hs)
theorem summable_norm_mul_pow (p : FormalMultilinearSeries 𝕜 E F) {r : ℝ≥0} (h : ↑r < p.radius) :
Summable fun n : ℕ => ‖p n‖ * (r : ℝ) ^ n := by
obtain ⟨a, ha : a ∈ Ioo (0 : ℝ) 1, C, - : 0 < C, hp⟩ := p.norm_mul_pow_le_mul_pow_of_lt_radius h
exact .of_nonneg_of_le (fun _ ↦ by positivity)
hp ((summable_geometric_of_lt_one ha.1.le ha.2).mul_left _)
theorem summable_norm_apply (p : FormalMultilinearSeries 𝕜 E F) {x : E}
(hx : x ∈ EMetric.ball (0 : E) p.radius) : Summable fun n : ℕ => ‖p n fun _ => x‖ := by
rw [mem_emetric_ball_zero_iff] at hx
refine .of_nonneg_of_le
(fun _ ↦ norm_nonneg _) (fun n ↦ ((p n).le_opNorm _).trans_eq ?_) (p.summable_norm_mul_pow hx)
simp
theorem summable_nnnorm_mul_pow (p : FormalMultilinearSeries 𝕜 E F) {r : ℝ≥0} (h : ↑r < p.radius) :
Summable fun n : ℕ => ‖p n‖₊ * r ^ n := by
rw [← NNReal.summable_coe]
push_cast
exact p.summable_norm_mul_pow h
protected theorem summable [CompleteSpace F] (p : FormalMultilinearSeries 𝕜 E F) {x : E}
(hx : x ∈ EMetric.ball (0 : E) p.radius) : Summable fun n : ℕ => p n fun _ => x :=
(p.summable_norm_apply hx).of_norm
theorem radius_eq_top_of_summable_norm (p : FormalMultilinearSeries 𝕜 E F)
(hs : ∀ r : ℝ≥0, Summable fun n => ‖p n‖ * (r : ℝ) ^ n) : p.radius = ∞ :=
ENNReal.eq_top_of_forall_nnreal_le fun r => p.le_radius_of_summable_norm (hs r)
theorem radius_eq_top_iff_summable_norm (p : FormalMultilinearSeries 𝕜 E F) :
p.radius = ∞ ↔ ∀ r : ℝ≥0, Summable fun n => ‖p n‖ * (r : ℝ) ^ n := by
constructor
· intro h r
obtain ⟨a, ha : a ∈ Ioo (0 : ℝ) 1, C, - : 0 < C, hp⟩ := p.norm_mul_pow_le_mul_pow_of_lt_radius
(show (r : ℝ≥0∞) < p.radius from h.symm ▸ ENNReal.coe_lt_top)
refine .of_norm_bounded
(g := fun n ↦ (C : ℝ) * a ^ n) ((summable_geometric_of_lt_one ha.1.le ha.2).mul_left _)
fun n ↦ ?_
specialize hp n
rwa [Real.norm_of_nonneg (by positivity)]
· exact p.radius_eq_top_of_summable_norm
/-- If the radius of `p` is positive, then `‖pₙ‖` grows at most geometrically. -/
theorem le_mul_pow_of_radius_pos (p : FormalMultilinearSeries 𝕜 E F) (h : 0 < p.radius) :
∃ (C r : _) (_ : 0 < C) (_ : 0 < r), ∀ n, ‖p n‖ ≤ C * r ^ n := by
rcases ENNReal.lt_iff_exists_nnreal_btwn.1 h with ⟨r, r0, rlt⟩
have rpos : 0 < (r : ℝ) := by simp [ENNReal.coe_pos.1 r0]
rcases norm_le_div_pow_of_pos_of_lt_radius p rpos rlt with ⟨C, Cpos, hCp⟩
refine ⟨C, r⁻¹, Cpos, by simp only [inv_pos, rpos], fun n => ?_⟩
rw [inv_pow, ← div_eq_mul_inv]
exact hCp n
lemma radius_le_of_le {𝕜' E' F' : Type*}
[NontriviallyNormedField 𝕜'] [NormedAddCommGroup E'] [NormedSpace 𝕜' E']
[NormedAddCommGroup F'] [NormedSpace 𝕜' F']
{p : FormalMultilinearSeries 𝕜 E F} {q : FormalMultilinearSeries 𝕜' E' F'}
(h : ∀ n, ‖p n‖ ≤ ‖q n‖) : q.radius ≤ p.radius := by
apply le_of_forall_nnreal_lt (fun r hr ↦ ?_)
rcases norm_mul_pow_le_of_lt_radius _ hr with ⟨C, -, hC⟩
apply le_radius_of_bound _ C (fun n ↦ ?_)
apply le_trans _ (hC n)
gcongr
exact h n
/-- The radius of the sum of two formal series is at least the minimum of their two radii. -/
theorem min_radius_le_radius_add (p q : FormalMultilinearSeries 𝕜 E F) :
min p.radius q.radius ≤ (p + q).radius := by
refine ENNReal.le_of_forall_nnreal_lt fun r hr => ?_
rw [lt_min_iff] at hr
have := ((p.isLittleO_one_of_lt_radius hr.1).add (q.isLittleO_one_of_lt_radius hr.2)).isBigO
refine (p + q).le_radius_of_isBigO ((isBigO_of_le _ fun n => ?_).trans this)
rw [← add_mul, norm_mul, norm_mul, norm_norm]
gcongr
exact (norm_add_le _ _).trans (le_abs_self _)
@[simp]
theorem radius_neg (p : FormalMultilinearSeries 𝕜 E F) : (-p).radius = p.radius := by
simp only [radius, neg_apply, norm_neg]
theorem radius_le_smul {p : FormalMultilinearSeries 𝕜 E F} {c : 𝕜} : p.radius ≤ (c • p).radius := by
simp only [radius, smul_apply]
refine iSup_mono fun r ↦ iSup_mono' fun C ↦ ⟨‖c‖ * C, iSup_mono' fun h ↦ ?_⟩
simp only [le_refl, exists_prop, and_true]
intro n
rw [norm_smul c (p n), mul_assoc]
gcongr
exact h n
theorem radius_smul_eq (p : FormalMultilinearSeries 𝕜 E F) {c : 𝕜} (hc : c ≠ 0) :
(c • p).radius = p.radius := by
apply eq_of_le_of_ge _ radius_le_smul
exact radius_le_smul.trans_eq (congr_arg _ <| inv_smul_smul₀ hc p)
lemma norm_compContinuousLinearMap_le (p : FormalMultilinearSeries 𝕜 F G) (u : E →L[𝕜] F) (n : ℕ) :
‖p.compContinuousLinearMap u n‖ ≤ ‖p n‖ * ‖u‖ ^ n := by
simp only [compContinuousLinearMap]
apply le_trans (ContinuousMultilinearMap.norm_compContinuousLinearMap_le _ _)
simp
lemma enorm_compContinuousLinearMap_le (p : FormalMultilinearSeries 𝕜 F G)
(u : E →L[𝕜] F) (n : ℕ) : ‖p.compContinuousLinearMap u n‖ₑ ≤ ‖p n‖ₑ * ‖u‖ₑ ^ n := by
rw [← ofReal_norm, ← ofReal_norm, ← ofReal_norm,
← ENNReal.ofReal_pow (by simp), ← ENNReal.ofReal_mul (by simp)]
gcongr
apply norm_compContinuousLinearMap_le
lemma nnnorm_compContinuousLinearMap_le (p : FormalMultilinearSeries 𝕜 F G)
(u : E →L[𝕜] F) (n : ℕ) : ‖p.compContinuousLinearMap u n‖₊ ≤ ‖p n‖₊ * ‖u‖₊ ^ n :=
norm_compContinuousLinearMap_le p u n
theorem div_le_radius_compContinuousLinearMap (p : FormalMultilinearSeries 𝕜 F G) (u : E →L[𝕜] F) :
p.radius / ‖u‖ₑ ≤ (p.compContinuousLinearMap u).radius := by
obtain (rfl | h_zero) := eq_zero_or_nnnorm_pos u
· simp
rw [ENNReal.div_le_iff (by simpa using h_zero) (by simp)]
refine le_of_forall_nnreal_lt fun r hr ↦ ?_
rw [← ENNReal.div_le_iff (by simpa using h_zero) (by simp), enorm_eq_nnnorm, ← coe_div h_zero.ne']
obtain ⟨C, hC_pos, hC⟩ := p.norm_mul_pow_le_of_lt_radius hr
refine le_radius_of_bound _ C fun n ↦ ?_
calc
‖p.compContinuousLinearMap u n‖ * ↑(r / ‖u‖₊) ^ n ≤ ‖p n‖ * ‖u‖ ^ n * ↑(r / ‖u‖₊) ^ n := by
gcongr
exact nnnorm_compContinuousLinearMap_le p u n
_ = ‖p n‖ * r ^ n := by
simp only [NNReal.coe_div, coe_nnnorm, div_pow, mul_assoc]
rw [mul_div_cancel₀]
rw [← NNReal.coe_pos] at h_zero
positivity
_ ≤ C := hC n
theorem le_radius_compContinuousLinearMap (p : FormalMultilinearSeries 𝕜 F G) (u : E →ₗᵢ[𝕜] F) :
p.radius ≤ (p.compContinuousLinearMap u.toContinuousLinearMap).radius := by
obtain (h | h) := subsingleton_or_nontrivial E
· simp [Subsingleton.elim u.toContinuousLinearMap 0]
· simpa [u.norm_toContinuousLinearMap]
using div_le_radius_compContinuousLinearMap p u.toContinuousLinearMap
theorem radius_compContinuousLinearMap_le [Nontrivial F]
(p : FormalMultilinearSeries 𝕜 F G) (u : E ≃L[𝕜] F) :
(p.compContinuousLinearMap u.toContinuousLinearMap).radius ≤
‖u.symm.toContinuousLinearMap‖ₑ * p.radius := by
have := (p.compContinuousLinearMap u.toContinuousLinearMap).div_le_radius_compContinuousLinearMap
u.symm.toContinuousLinearMap
simp only [compContinuousLinearMap_comp, ContinuousLinearEquiv.coe_comp_coe_symm,
compContinuousLinearMap_id] at this
rwa [ENNReal.div_le_iff' (by simpa [DFunLike.ext_iff] using exists_ne 0) (by simp)] at this
@[simp]
theorem radius_compContinuousLinearMap_linearIsometryEquiv_eq [Nontrivial E]
(p : FormalMultilinearSeries 𝕜 F G) (u : E ≃ₗᵢ[𝕜] F) :
(p.compContinuousLinearMap u.toLinearIsometry.toContinuousLinearMap).radius = p.radius := by
refine le_antisymm ?_ <| le_radius_compContinuousLinearMap _ _
have _ : Nontrivial F := u.symm.toEquiv.nontrivial
convert radius_compContinuousLinearMap_le p u.toContinuousLinearEquiv
have : u.toContinuousLinearEquiv.symm.toContinuousLinearMap =
u.symm.toLinearIsometry.toContinuousLinearMap := rfl
simp [this]
/-- This is a version of `radius_compContinuousLinearMap_linearIsometryEquiv_eq` with better
opportunity for unification, at the cost of manually supplying some hypotheses. -/
theorem radius_compContinuousLinearMap_eq [Nontrivial E]
(p : FormalMultilinearSeries 𝕜 F G) (u : E →L[𝕜] F) (hu_iso : Isometry u)
(hu_surj : Function.Surjective u) :
(p.compContinuousLinearMap u).radius = p.radius :=
let v : E ≃ₗᵢ[𝕜] F :=
{ LinearEquiv.ofBijective u.toLinearMap ⟨hu_iso.injective, hu_surj⟩ with
norm_map' := hu_iso.norm_map_of_map_zero (map_zero u) }
radius_compContinuousLinearMap_linearIsometryEquiv_eq p v
@[simp]
theorem radius_compNeg [Nontrivial E] (p : FormalMultilinearSeries 𝕜 E F) :
(p.compContinuousLinearMap (-(.id _ _))).radius = p.radius :=
radius_compContinuousLinearMap_linearIsometryEquiv_eq _ (.neg 𝕜)
@[simp]
theorem radius_shift (p : FormalMultilinearSeries 𝕜 E F) : p.shift.radius = p.radius := by
simp only [radius, shift, Nat.succ_eq_add_one, ContinuousMultilinearMap.curryRight_norm]
congr
ext r
apply eq_of_le_of_ge
· apply iSup_mono'
intro C
use ‖p 0‖ ⊔ (C * r)
apply iSup_mono'
intro h
simp only [le_refl, le_sup_iff, exists_prop, and_true]
intro n
rcases n with - | m
· simp
right
rw [pow_succ, ← mul_assoc]
gcongr; apply h
· apply iSup_mono'
intro C
use ‖p 1‖ ⊔ C / r
apply iSup_mono'
intro h
simp only [le_refl, le_sup_iff, exists_prop, and_true]
intro n
cases eq_zero_or_pos r with
| inl hr =>
rw [hr]
cases n <;> simp
| inr hr =>
right
rw [← NNReal.coe_pos] at hr
specialize h (n + 1)
rw [le_div_iff₀ hr]
rwa [pow_succ, ← mul_assoc] at h
@[simp]
theorem radius_unshift (p : FormalMultilinearSeries 𝕜 E (E →L[𝕜] F)) (z : F) :
(p.unshift z).radius = p.radius := by
rw [← radius_shift, unshift_shift]
protected theorem hasSum [CompleteSpace F] (p : FormalMultilinearSeries 𝕜 E F) {x : E}
(hx : x ∈ EMetric.ball (0 : E) p.radius) : HasSum (fun n : ℕ => p n fun _ => x) (p.sum x) :=
(p.summable hx).hasSum
theorem radius_le_radius_continuousLinearMap_comp (p : FormalMultilinearSeries 𝕜 E F)
(f : F →L[𝕜] G) : p.radius ≤ (f.compFormalMultilinearSeries p).radius := by
refine ENNReal.le_of_forall_nnreal_lt fun r hr => ?_
apply le_radius_of_isBigO
apply (IsBigO.trans_isLittleO _ (p.isLittleO_one_of_lt_radius hr)).isBigO
refine IsBigO.mul (@IsBigOWith.isBigO _ _ _ _ _ ‖f‖ _ _ _ ?_) (isBigO_refl _ _)
refine IsBigOWith.of_bound (Eventually.of_forall fun n => ?_)
simpa only [norm_norm] using f.norm_compContinuousMultilinearMap_le (p n)
end FormalMultilinearSeries |
.lake/packages/mathlib/Mathlib/Analysis/Analytic/Composition.lean | import Mathlib.Analysis.Analytic.Basic
import Mathlib.Analysis.Analytic.CPolynomialDef
import Mathlib.Combinatorics.Enumerative.Composition
/-!
# Composition of analytic functions
In this file we prove that the composition of analytic functions is analytic.
The argument is the following. Assume `g z = ∑' qₙ (z, ..., z)` and `f y = ∑' pₖ (y, ..., y)`. Then
`g (f y) = ∑' qₙ (∑' pₖ (y, ..., y), ..., ∑' pₖ (y, ..., y))
= ∑' qₙ (p_{i₁} (y, ..., y), ..., p_{iₙ} (y, ..., y))`.
For each `n` and `i₁, ..., iₙ`, define a `i₁ + ... + iₙ` multilinear function mapping
`(y₀, ..., y_{i₁ + ... + iₙ - 1})` to
`qₙ (p_{i₁} (y₀, ..., y_{i₁-1}), p_{i₂} (y_{i₁}, ..., y_{i₁ + i₂ - 1}), ..., p_{iₙ} (....)))`.
Then `g ∘ f` is obtained by summing all these multilinear functions.
To formalize this, we use compositions of an integer `N`, i.e., its decompositions into
a sum `i₁ + ... + iₙ` of positive integers. Given such a composition `c` and two formal
multilinear series `q` and `p`, let `q.compAlongComposition p c` be the above multilinear
function. Then the `N`-th coefficient in the power series expansion of `g ∘ f` is the sum of these
terms over all `c : Composition N`.
To complete the proof, we need to show that this power series has a positive radius of convergence.
This follows from the fact that `Composition N` has cardinality `2^(N-1)` and estimates on
the norm of `qₙ` and `pₖ`, which give summability. We also need to show that it indeed converges to
`g ∘ f`. For this, we note that the composition of partial sums converges to `g ∘ f`, and that it
corresponds to a part of the whole sum, on a subset that increases to the whole space. By
summability of the norms, this implies the overall convergence.
## Main results
* `q.comp p` is the formal composition of the formal multilinear series `q` and `p`.
* `HasFPowerSeriesAt.comp` states that if two functions `g` and `f` admit power series expansions
`q` and `p`, then `g ∘ f` admits a power series expansion given by `q.comp p`.
* `AnalyticAt.comp` states that the composition of analytic functions is analytic.
* `FormalMultilinearSeries.comp_assoc` states that composition is associative on formal
multilinear series.
## Implementation details
The main technical difficulty is to write down things. In particular, we need to define precisely
`q.compAlongComposition p c` and to show that it is indeed a continuous multilinear
function. This requires a whole interface built on the class `Composition`. Once this is set,
the main difficulty is to reorder the sums, writing the composition of the partial sums as a sum
over some subset of `Σ n, Composition n`. We need to check that the reordering is a bijection,
running over difficulties due to the dependent nature of the types under consideration, that are
controlled thanks to the interface for `Composition`.
The associativity of composition on formal multilinear series is a nontrivial result: it does not
follow from the associativity of composition of analytic functions, as there is no uniqueness for
the formal multilinear series representing a function (and also, it holds even when the radius of
convergence of the series is `0`). Instead, we give a direct proof, which amounts to reordering
double sums in a careful way. The change of variables is a canonical (combinatorial) bijection
`Composition.sigmaEquivSigmaPi` between `(Σ (a : Composition n), Composition a.length)` and
`(Σ (c : Composition n), Π (i : Fin c.length), Composition (c.blocksFun i))`, and is described
in more details below in the paragraph on associativity.
-/
noncomputable section
variable {𝕜 : Type*} {E F G H : Type*}
open Filter List
open scoped Topology NNReal ENNReal
section Topological
variable [CommRing 𝕜] [AddCommGroup E] [AddCommGroup F] [AddCommGroup G]
variable [Module 𝕜 E] [Module 𝕜 F] [Module 𝕜 G]
variable [TopologicalSpace E] [TopologicalSpace F] [TopologicalSpace G]
/-! ### Composing formal multilinear series -/
namespace FormalMultilinearSeries
variable [IsTopologicalAddGroup E] [ContinuousConstSMul 𝕜 E]
variable [IsTopologicalAddGroup F] [ContinuousConstSMul 𝕜 F]
variable [IsTopologicalAddGroup G] [ContinuousConstSMul 𝕜 G]
/-!
In this paragraph, we define the composition of formal multilinear series, by summing over all
possible compositions of `n`.
-/
/-- Given a formal multilinear series `p`, a composition `c` of `n` and the index `i` of a
block of `c`, we may define a function on `Fin n → E` by picking the variables in the `i`-th block
of `n`, and applying the corresponding coefficient of `p` to these variables. This function is
called `p.applyComposition c v i` for `v : Fin n → E` and `i : Fin c.length`. -/
def applyComposition (p : FormalMultilinearSeries 𝕜 E F) {n : ℕ} (c : Composition n) :
(Fin n → E) → Fin c.length → F := fun v i => p (c.blocksFun i) (v ∘ c.embedding i)
theorem applyComposition_ones (p : FormalMultilinearSeries 𝕜 E F) (n : ℕ) :
p.applyComposition (Composition.ones n) = fun v i =>
p 1 fun _ => v (Fin.castLE (Composition.length_le _) i) := by
funext v i
apply p.congr (Composition.ones_blocksFun _ _)
intro j hjn hj1
obtain rfl : j = 0 := by cutsat
refine congr_arg v ?_
rw [Fin.ext_iff, Fin.coe_castLE, Composition.ones_embedding, Fin.val_mk]
theorem applyComposition_single (p : FormalMultilinearSeries 𝕜 E F) {n : ℕ} (hn : 0 < n)
(v : Fin n → E) : p.applyComposition (Composition.single n hn) v = fun _j => p n v := by
ext j
refine p.congr (by simp) fun i hi1 hi2 => ?_
dsimp
congr 1
convert Composition.single_embedding hn ⟨i, hi2⟩ using 1
obtain ⟨j_val, j_property⟩ := j
have : j_val = 0 := le_bot_iff.1 (Nat.lt_succ_iff.1 j_property)
congr!
simp
@[simp]
theorem removeZero_applyComposition (p : FormalMultilinearSeries 𝕜 E F) {n : ℕ}
(c : Composition n) : p.removeZero.applyComposition c = p.applyComposition c := by
ext v i
simp [applyComposition, zero_lt_one.trans_le (c.one_le_blocksFun i), removeZero_of_pos]
/-- Technical lemma stating how `p.applyComposition` commutes with updating variables. This
will be the key point to show that functions constructed from `applyComposition` retain
multilinearity. -/
theorem applyComposition_update (p : FormalMultilinearSeries 𝕜 E F) {n : ℕ} (c : Composition n)
(j : Fin n) (v : Fin n → E) (z : E) :
p.applyComposition c (Function.update v j z) =
Function.update (p.applyComposition c v) (c.index j)
(p (c.blocksFun (c.index j))
(Function.update (v ∘ c.embedding (c.index j)) (c.invEmbedding j) z)) := by
ext k
by_cases h : k = c.index j
· rw [h]
let r : Fin (c.blocksFun (c.index j)) → Fin n := c.embedding (c.index j)
simp only [Function.update_self]
change p (c.blocksFun (c.index j)) (Function.update v j z ∘ r) = _
let j' := c.invEmbedding j
suffices B : Function.update v j z ∘ r = Function.update (v ∘ r) j' z by rw [B]
suffices C : Function.update v (r j') z ∘ r = Function.update (v ∘ r) j' z by
convert C; exact (c.embedding_comp_inv j).symm
exact Function.update_comp_eq_of_injective _ (c.embedding _).injective _ _
· simp only [h, Function.update_of_ne, Ne, not_false_iff]
let r : Fin (c.blocksFun k) → Fin n := c.embedding k
change p (c.blocksFun k) (Function.update v j z ∘ r) = p (c.blocksFun k) (v ∘ r)
suffices B : Function.update v j z ∘ r = v ∘ r by rw [B]
apply Function.update_comp_eq_of_notMem_range
rwa [c.mem_range_embedding_iff']
@[simp]
theorem compContinuousLinearMap_applyComposition {n : ℕ} (p : FormalMultilinearSeries 𝕜 F G)
(f : E →L[𝕜] F) (c : Composition n) (v : Fin n → E) :
(p.compContinuousLinearMap f).applyComposition c v = p.applyComposition c (f ∘ v) := by
ext
simp [applyComposition, Function.comp_def]
end FormalMultilinearSeries
namespace ContinuousMultilinearMap
open FormalMultilinearSeries
variable [IsTopologicalAddGroup E] [ContinuousConstSMul 𝕜 E]
variable [IsTopologicalAddGroup F] [ContinuousConstSMul 𝕜 F]
/-- Given a formal multilinear series `p`, a composition `c` of `n` and a continuous multilinear
map `f` in `c.length` variables, one may form a continuous multilinear map in `n` variables by
applying the right coefficient of `p` to each block of the composition, and then applying `f` to
the resulting vector. It is called `f.compAlongComposition p c`. -/
def compAlongComposition {n : ℕ} (p : FormalMultilinearSeries 𝕜 E F) (c : Composition n)
(f : F [×c.length]→L[𝕜] G) : E [×n]→L[𝕜] G where
toMultilinearMap :=
MultilinearMap.mk' (fun v ↦ f (p.applyComposition c v))
(fun v i x y ↦ by simp only [applyComposition_update, map_update_add])
(fun v i c x ↦ by simp only [applyComposition_update, map_update_smul])
cont :=
f.cont.comp <|
continuous_pi fun _ => (coe_continuous _).comp <| continuous_pi fun _ => continuous_apply _
@[simp]
theorem compAlongComposition_apply {n : ℕ} (p : FormalMultilinearSeries 𝕜 E F) (c : Composition n)
(f : F [×c.length]→L[𝕜] G) (v : Fin n → E) :
(f.compAlongComposition p c) v = f (p.applyComposition c v) :=
rfl
end ContinuousMultilinearMap
namespace FormalMultilinearSeries
variable [IsTopologicalAddGroup E] [ContinuousConstSMul 𝕜 E]
variable [IsTopologicalAddGroup F] [ContinuousConstSMul 𝕜 F]
variable [IsTopologicalAddGroup G] [ContinuousConstSMul 𝕜 G]
/-- Given two formal multilinear series `q` and `p` and a composition `c` of `n`, one may
form a continuous multilinear map in `n` variables by applying the right coefficient of `p` to each
block of the composition, and then applying `q c.length` to the resulting vector. It is
called `q.compAlongComposition p c`. -/
def compAlongComposition {n : ℕ} (q : FormalMultilinearSeries 𝕜 F G)
(p : FormalMultilinearSeries 𝕜 E F) (c : Composition n) : (E [×n]→L[𝕜] G) :=
(q c.length).compAlongComposition p c
@[simp]
theorem compAlongComposition_apply {n : ℕ} (q : FormalMultilinearSeries 𝕜 F G)
(p : FormalMultilinearSeries 𝕜 E F) (c : Composition n) (v : Fin n → E) :
(q.compAlongComposition p c) v = q c.length (p.applyComposition c v) :=
rfl
/-- Formal composition of two formal multilinear series. The `n`-th coefficient in the composition
is defined to be the sum of `q.compAlongComposition p c` over all compositions of
`n`. In other words, this term (as a multilinear function applied to `v_0, ..., v_{n-1}`) is
`∑'_{k} ∑'_{i₁ + ... + iₖ = n} qₖ (p_{i_1} (...), ..., p_{i_k} (...))`, where one puts all variables
`v_0, ..., v_{n-1}` in increasing order in the dots.
In general, the composition `q ∘ p` only makes sense when the constant coefficient of `p` vanishes.
We give a general formula but which ignores the value of `p 0` instead.
-/
protected def comp (q : FormalMultilinearSeries 𝕜 F G) (p : FormalMultilinearSeries 𝕜 E F) :
FormalMultilinearSeries 𝕜 E G := fun n => ∑ c : Composition n, q.compAlongComposition p c
/-- The `0`-th coefficient of `q.comp p` is `q 0`. Since these maps are multilinear maps in zero
variables, but on different spaces, we cannot state this directly, so we state it when applied to
arbitrary vectors (which have to be the zero vector). -/
theorem comp_coeff_zero (q : FormalMultilinearSeries 𝕜 F G) (p : FormalMultilinearSeries 𝕜 E F)
(v : Fin 0 → E) (v' : Fin 0 → F) : (q.comp p) 0 v = q 0 v' := by
let c : Composition 0 := Composition.ones 0
dsimp [FormalMultilinearSeries.comp]
have : {c} = (Finset.univ : Finset (Composition 0)) := by
apply Finset.eq_of_subset_of_card_le <;> simp [Finset.card_univ, composition_card 0]
rw [← this, Finset.sum_singleton, compAlongComposition_apply]
symm; congr!
@[simp]
theorem comp_coeff_zero' (q : FormalMultilinearSeries 𝕜 F G) (p : FormalMultilinearSeries 𝕜 E F)
(v : Fin 0 → E) : (q.comp p) 0 v = q 0 fun _i => 0 :=
q.comp_coeff_zero p v _
/-- The `0`-th coefficient of `q.comp p` is `q 0`. When `p` goes from `E` to `E`, this can be
expressed as a direct equality -/
theorem comp_coeff_zero'' (q : FormalMultilinearSeries 𝕜 E F) (p : FormalMultilinearSeries 𝕜 E E) :
(q.comp p) 0 = q 0 := by ext v; exact q.comp_coeff_zero p _ _
/-- The first coefficient of a composition of formal multilinear series is the composition of the
first coefficients seen as continuous linear maps. -/
theorem comp_coeff_one (q : FormalMultilinearSeries 𝕜 F G) (p : FormalMultilinearSeries 𝕜 E F)
(v : Fin 1 → E) : (q.comp p) 1 v = q 1 fun _i => p 1 v := by
have : {Composition.ones 1} = (Finset.univ : Finset (Composition 1)) :=
Finset.eq_univ_of_card _ (by simp [composition_card])
simp only [FormalMultilinearSeries.comp, compAlongComposition_apply, ← this,
Finset.sum_singleton]
refine q.congr (by simp) fun i hi1 hi2 => ?_
simp only [applyComposition_ones]
exact p.congr rfl fun j _hj1 hj2 => by congr!
/-- Only `0`-th coefficient of `q.comp p` depends on `q 0`. -/
theorem removeZero_comp_of_pos (q : FormalMultilinearSeries 𝕜 F G)
(p : FormalMultilinearSeries 𝕜 E F) {n : ℕ} (hn : 0 < n) :
q.removeZero.comp p n = q.comp p n := by
ext v
simp only [FormalMultilinearSeries.comp, compAlongComposition,
ContinuousMultilinearMap.compAlongComposition_apply, ContinuousMultilinearMap.sum_apply]
refine Finset.sum_congr rfl fun c _hc => ?_
rw [removeZero_of_pos _ (c.length_pos_of_pos hn)]
@[simp]
theorem comp_removeZero (q : FormalMultilinearSeries 𝕜 F G) (p : FormalMultilinearSeries 𝕜 E F) :
q.comp p.removeZero = q.comp p := by ext n; simp [FormalMultilinearSeries.comp]
end FormalMultilinearSeries
end Topological
variable [NontriviallyNormedField 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E] [NormedAddCommGroup F]
[NormedSpace 𝕜 F] [NormedAddCommGroup G] [NormedSpace 𝕜 G] [NormedAddCommGroup H]
[NormedSpace 𝕜 H]
namespace FormalMultilinearSeries
/-- The norm of `f.compAlongComposition p c` is controlled by the product of
the norms of the relevant bits of `f` and `p`. -/
theorem compAlongComposition_bound {n : ℕ} (p : FormalMultilinearSeries 𝕜 E F) (c : Composition n)
(f : F [×c.length]→L[𝕜] G) (v : Fin n → E) :
‖f.compAlongComposition p c v‖ ≤ (‖f‖ * ∏ i, ‖p (c.blocksFun i)‖) * ∏ i : Fin n, ‖v i‖ :=
calc
‖f.compAlongComposition p c v‖ = ‖f (p.applyComposition c v)‖ := rfl
_ ≤ ‖f‖ * ∏ i, ‖p.applyComposition c v i‖ := ContinuousMultilinearMap.le_opNorm _ _
_ ≤ ‖f‖ * ∏ i, ‖p (c.blocksFun i)‖ * ∏ j : Fin (c.blocksFun i), ‖(v ∘ c.embedding i) j‖ := by
gcongr with i
apply ContinuousMultilinearMap.le_opNorm
_ = (‖f‖ * ∏ i, ‖p (c.blocksFun i)‖) *
∏ i, ∏ j : Fin (c.blocksFun i), ‖(v ∘ c.embedding i) j‖ := by
rw [Finset.prod_mul_distrib, mul_assoc]
_ = (‖f‖ * ∏ i, ‖p (c.blocksFun i)‖) * ∏ i : Fin n, ‖v i‖ := by
rw [← c.blocksFinEquiv.prod_comp, ← Finset.univ_sigma_univ, Finset.prod_sigma]
congr
/-- The norm of `q.compAlongComposition p c` is controlled by the product of
the norms of the relevant bits of `q` and `p`. -/
theorem compAlongComposition_norm {n : ℕ} (q : FormalMultilinearSeries 𝕜 F G)
(p : FormalMultilinearSeries 𝕜 E F) (c : Composition n) :
‖q.compAlongComposition p c‖ ≤ ‖q c.length‖ * ∏ i, ‖p (c.blocksFun i)‖ :=
ContinuousMultilinearMap.opNorm_le_bound (by positivity) (compAlongComposition_bound _ _ _)
theorem compAlongComposition_nnnorm {n : ℕ} (q : FormalMultilinearSeries 𝕜 F G)
(p : FormalMultilinearSeries 𝕜 E F) (c : Composition n) :
‖q.compAlongComposition p c‖₊ ≤ ‖q c.length‖₊ * ∏ i, ‖p (c.blocksFun i)‖₊ := by
rw [← NNReal.coe_le_coe]; push_cast; exact q.compAlongComposition_norm p c
/-!
### The identity formal power series
We will now define the identity power series, and show that it is a neutral element for left and
right composition.
-/
section
variable (𝕜 E)
/-- The identity formal multilinear series, with all coefficients equal to `0` except for `n = 1`
where it is (the continuous multilinear version of) the identity. We allow an arbitrary
constant coefficient `x`. -/
def id (x : E) : FormalMultilinearSeries 𝕜 E E
| 0 => ContinuousMultilinearMap.uncurry0 𝕜 _ x
| 1 => (continuousMultilinearCurryFin1 𝕜 E E).symm (ContinuousLinearMap.id 𝕜 E)
| _ => 0
@[simp] theorem id_apply_zero (x : E) (v : Fin 0 → E) :
(FormalMultilinearSeries.id 𝕜 E x) 0 v = x := rfl
/-- The first coefficient of `id 𝕜 E` is the identity. -/
@[simp]
theorem id_apply_one (x : E) (v : Fin 1 → E) : (FormalMultilinearSeries.id 𝕜 E x) 1 v = v 0 :=
rfl
/-- The `n`th coefficient of `id 𝕜 E` is the identity when `n = 1`. We state this in a dependent
way, as it will often appear in this form. -/
theorem id_apply_one' (x : E) {n : ℕ} (h : n = 1) (v : Fin n → E) :
(id 𝕜 E x) n v = v ⟨0, h.symm ▸ zero_lt_one⟩ := by
subst n
apply id_apply_one
/-- For `n ≠ 1`, the `n`-th coefficient of `id 𝕜 E` is zero, by definition. -/
@[simp]
theorem id_apply_of_one_lt (x : E) {n : ℕ} (h : 1 < n) :
(FormalMultilinearSeries.id 𝕜 E x) n = 0 := by
match n with
| 0 => contradiction
| 1 => contradiction
| n + 2 => rfl
end
@[simp]
theorem comp_id (p : FormalMultilinearSeries 𝕜 E F) (x : E) : p.comp (id 𝕜 E x) = p := by
ext1 n
dsimp [FormalMultilinearSeries.comp]
rw [Finset.sum_eq_single (Composition.ones n)]
· show compAlongComposition p (id 𝕜 E x) (Composition.ones n) = p n
ext v
rw [compAlongComposition_apply]
apply p.congr (Composition.ones_length n)
intros
rw [applyComposition_ones]
refine congr_arg v ?_
rw [Fin.ext_iff, Fin.coe_castLE, Fin.val_mk]
· change
∀ b : Composition n,
b ∈ Finset.univ → b ≠ Composition.ones n → compAlongComposition p (id 𝕜 E x) b = 0
intro b _ hb
obtain ⟨k, hk, lt_k⟩ : ∃ (k : ℕ), k ∈ Composition.blocks b ∧ 1 < k :=
Composition.ne_ones_iff.1 hb
obtain ⟨i, hi⟩ : ∃ (i : Fin b.blocks.length), b.blocks[i] = k :=
List.get_of_mem hk
let j : Fin b.length := ⟨i.val, b.blocks_length ▸ i.prop⟩
have A : 1 < b.blocksFun j := by convert lt_k
ext v
rw [compAlongComposition_apply, ContinuousMultilinearMap.zero_apply]
apply ContinuousMultilinearMap.map_coord_zero _ j
dsimp [applyComposition]
rw [id_apply_of_one_lt _ _ _ A, ContinuousMultilinearMap.zero_apply]
· simp
@[simp]
theorem id_comp (p : FormalMultilinearSeries 𝕜 E F) (v0 : Fin 0 → E) :
(id 𝕜 F (p 0 v0)).comp p = p := by
ext1 n
obtain rfl | n_pos := n.eq_zero_or_pos
· ext v
simp only [comp_coeff_zero', id_apply_zero]
congr with i
exact i.elim0
· dsimp [FormalMultilinearSeries.comp]
rw [Finset.sum_eq_single (Composition.single n n_pos)]
· show compAlongComposition (id 𝕜 F (p 0 v0)) p (Composition.single n n_pos) = p n
ext v
rw [compAlongComposition_apply, id_apply_one' _ _ _ (Composition.single_length n_pos)]
dsimp [applyComposition]
refine p.congr rfl fun i him hin => congr_arg v <| ?_
ext; simp
· change
∀ b : Composition n, b ∈ Finset.univ → b ≠ Composition.single n n_pos →
compAlongComposition (id 𝕜 F (p 0 v0)) p b = 0
intro b _ hb
have A : 1 < b.length := by
have : b.length ≠ 1 := by simpa [Composition.eq_single_iff_length] using hb
have : 0 < b.length := Composition.length_pos_of_pos b n_pos
omega
ext v
rw [compAlongComposition_apply, id_apply_of_one_lt _ _ _ A,
ContinuousMultilinearMap.zero_apply, ContinuousMultilinearMap.zero_apply]
· simp
/-- Variant of `id_comp` in which the zero coefficient is given by an equality hypothesis instead
of a definitional equality. Useful for rewriting or simplifying out in some situations. -/
theorem id_comp' (p : FormalMultilinearSeries 𝕜 E F) (x : F) (v0 : Fin 0 → E) (h : x = p 0 v0) :
(id 𝕜 F x).comp p = p := by
simp [h]
/-! ### Summability properties of the composition of formal power series -/
section
/-- If two formal multilinear series have positive radius of convergence, then the terms appearing
in the definition of their composition are also summable (when multiplied by a suitable positive
geometric term). -/
theorem comp_summable_nnreal (q : FormalMultilinearSeries 𝕜 F G) (p : FormalMultilinearSeries 𝕜 E F)
(hq : 0 < q.radius) (hp : 0 < p.radius) :
∃ r > (0 : ℝ≥0),
Summable fun i : Σ n, Composition n => ‖q.compAlongComposition p i.2‖₊ * r ^ i.1 := by
/- This follows from the fact that the growth rate of `‖qₙ‖` and `‖pₙ‖` is at most geometric,
giving a geometric bound on each `‖q.compAlongComposition p op‖`, together with the
fact that there are `2^(n-1)` compositions of `n`, giving at most a geometric loss. -/
rcases ENNReal.lt_iff_exists_nnreal_btwn.1 (lt_min zero_lt_one hq) with ⟨rq, rq_pos, hrq⟩
rcases ENNReal.lt_iff_exists_nnreal_btwn.1 (lt_min zero_lt_one hp) with ⟨rp, rp_pos, hrp⟩
simp only [lt_min_iff, ENNReal.coe_lt_one_iff, ENNReal.coe_pos] at hrp hrq rp_pos rq_pos
obtain ⟨Cq, _hCq0, hCq⟩ : ∃ Cq > 0, ∀ n, ‖q n‖₊ * rq ^ n ≤ Cq :=
q.nnnorm_mul_pow_le_of_lt_radius hrq.2
obtain ⟨Cp, hCp1, hCp⟩ : ∃ Cp ≥ 1, ∀ n, ‖p n‖₊ * rp ^ n ≤ Cp := by
rcases p.nnnorm_mul_pow_le_of_lt_radius hrp.2 with ⟨Cp, -, hCp⟩
exact ⟨max Cp 1, le_max_right _ _, fun n => (hCp n).trans (le_max_left _ _)⟩
let r0 : ℝ≥0 := (4 * Cp)⁻¹
have r0_pos : 0 < r0 := inv_pos.2 (mul_pos zero_lt_four (zero_lt_one.trans_le hCp1))
set r : ℝ≥0 := rp * rq * r0
have r_pos : 0 < r := mul_pos (mul_pos rp_pos rq_pos) r0_pos
have I :
∀ i : Σ n : ℕ, Composition n, ‖q.compAlongComposition p i.2‖₊ * r ^ i.1 ≤ Cq / 4 ^ i.1 := by
rintro ⟨n, c⟩
have A := calc
‖q c.length‖₊ * rq ^ n ≤ ‖q c.length‖₊ * rq ^ c.length :=
mul_le_mul' le_rfl (pow_le_pow_of_le_one rq.2 hrq.1.le c.length_le)
_ ≤ Cq := hCq _
have B := calc
(∏ i, ‖p (c.blocksFun i)‖₊) * rp ^ n = ∏ i, ‖p (c.blocksFun i)‖₊ * rp ^ c.blocksFun i := by
simp only [Finset.prod_mul_distrib, Finset.prod_pow_eq_pow_sum, c.sum_blocksFun]
_ ≤ ∏ _i : Fin c.length, Cp := Finset.prod_le_prod' fun i _ => hCp _
_ = Cp ^ c.length := by simp
_ ≤ Cp ^ n := pow_right_mono₀ hCp1 c.length_le
calc
‖q.compAlongComposition p c‖₊ * r ^ n ≤
(‖q c.length‖₊ * ∏ i, ‖p (c.blocksFun i)‖₊) * r ^ n := by
grw [q.compAlongComposition_nnnorm p c]
_ = ‖q c.length‖₊ * rq ^ n * ((∏ i, ‖p (c.blocksFun i)‖₊) * rp ^ n) * r0 ^ n := by
ring
_ ≤ Cq * Cp ^ n * r0 ^ n := mul_le_mul' (mul_le_mul' A B) le_rfl
_ = Cq / 4 ^ n := by
simp only [r0]
simp [field, mul_pow]
refine ⟨r, r_pos, NNReal.summable_of_le I ?_⟩
simp_rw [div_eq_mul_inv]
refine Summable.mul_left _ ?_
have : ∀ n : ℕ, HasSum (fun c : Composition n => (4 ^ n : ℝ≥0)⁻¹) (2 ^ (n - 1) / 4 ^ n) := by
intro n
convert hasSum_fintype fun c : Composition n => (4 ^ n : ℝ≥0)⁻¹
simp [Finset.card_univ, composition_card, div_eq_mul_inv]
refine NNReal.summable_sigma.2 ⟨fun n => (this n).summable, (NNReal.summable_nat_add_iff 1).1 ?_⟩
convert (NNReal.summable_geometric (NNReal.div_lt_one_of_lt one_lt_two)).mul_left (1 / 4) using 1
ext1 n
rw [(this _).tsum_eq, add_tsub_cancel_right]
simp [field, pow_succ, mul_pow, show (4 : ℝ≥0) = 2 * 2 by norm_num]
end
/-- Bounding below the radius of the composition of two formal multilinear series assuming
summability over all compositions. -/
theorem le_comp_radius_of_summable (q : FormalMultilinearSeries 𝕜 F G)
(p : FormalMultilinearSeries 𝕜 E F) (r : ℝ≥0)
(hr : Summable fun i : Σ n, Composition n => ‖q.compAlongComposition p i.2‖₊ * r ^ i.1) :
(r : ℝ≥0∞) ≤ (q.comp p).radius := by
refine
le_radius_of_bound_nnreal _
(∑' i : Σ n, Composition n, ‖compAlongComposition q p i.snd‖₊ * r ^ i.fst) fun n => ?_
calc
‖FormalMultilinearSeries.comp q p n‖₊ * r ^ n ≤
∑' c : Composition n, ‖compAlongComposition q p c‖₊ * r ^ n := by
rw [tsum_fintype, ← Finset.sum_mul]
exact mul_le_mul' (nnnorm_sum_le _ _) le_rfl
_ ≤ ∑' i : Σ n : ℕ, Composition n, ‖compAlongComposition q p i.snd‖₊ * r ^ i.fst :=
NNReal.tsum_comp_le_tsum_of_inj hr sigma_mk_injective
/-!
### Composing analytic functions
Now, we will prove that the composition of the partial sums of `q` and `p` up to order `N` is
given by a sum over some large subset of `Σ n, Composition n` of `q.compAlongComposition p`, to
deduce that the series for `q.comp p` indeed converges to `g ∘ f` when `q` is a power series for
`g` and `p` is a power series for `f`.
This proof is a big reindexing argument of a sum. Since it is a bit involved, we define first
the source of the change of variables (`compPartialSumSource`), its target
(`compPartialSumTarget`) and the change of variables itself (`compChangeOfVariables`) before
giving the main statement in `comp_partialSum`. -/
/-- Source set in the change of variables to compute the composition of partial sums of formal
power series.
See also `comp_partialSum`. -/
def compPartialSumSource (m M N : ℕ) : Finset (Σ n, Fin n → ℕ) :=
Finset.sigma (Finset.Ico m M) (fun n : ℕ => Fintype.piFinset fun _i : Fin n => Finset.Ico 1 N :)
@[simp]
theorem mem_compPartialSumSource_iff (m M N : ℕ) (i : Σ n, Fin n → ℕ) :
i ∈ compPartialSumSource m M N ↔
(m ≤ i.1 ∧ i.1 < M) ∧ ∀ a : Fin i.1, 1 ≤ i.2 a ∧ i.2 a < N := by
simp only [compPartialSumSource, Finset.mem_Ico, Fintype.mem_piFinset, Finset.mem_sigma]
/-- Change of variables appearing to compute the composition of partial sums of formal
power series -/
def compChangeOfVariables (m M N : ℕ) (i : Σ n, Fin n → ℕ) (hi : i ∈ compPartialSumSource m M N) :
Σ n, Composition n := by
rcases i with ⟨n, f⟩
rw [mem_compPartialSumSource_iff] at hi
refine ⟨∑ j, f j, ofFn fun a => f a, fun {i} hi' => ?_, by simp [sum_ofFn]⟩
obtain ⟨j, rfl⟩ : ∃ j : Fin n, f j = i := by rwa [mem_ofFn', Set.mem_range] at hi'
exact (hi.2 j).1
@[simp]
theorem compChangeOfVariables_length (m M N : ℕ) {i : Σ n, Fin n → ℕ}
(hi : i ∈ compPartialSumSource m M N) :
Composition.length (compChangeOfVariables m M N i hi).2 = i.1 := by
rcases i with ⟨k, blocks_fun⟩
dsimp [compChangeOfVariables]
simp only [Composition.length, length_ofFn]
theorem compChangeOfVariables_blocksFun (m M N : ℕ) {i : Σ n, Fin n → ℕ}
(hi : i ∈ compPartialSumSource m M N) (j : Fin i.1) :
(compChangeOfVariables m M N i hi).2.blocksFun
⟨j, (compChangeOfVariables_length m M N hi).symm ▸ j.2⟩ =
i.2 j := by
rcases i with ⟨n, f⟩
dsimp [Composition.blocksFun, Composition.blocks, compChangeOfVariables]
simp only [List.getElem_ofFn]
/-- Target set in the change of variables to compute the composition of partial sums of formal
power series, here given a a set. -/
def compPartialSumTargetSet (m M N : ℕ) : Set (Σ n, Composition n) :=
{i | m ≤ i.2.length ∧ i.2.length < M ∧ ∀ j : Fin i.2.length, i.2.blocksFun j < N}
theorem compPartialSumTargetSet_image_compPartialSumSource (m M N : ℕ)
(i : Σ n, Composition n) (hi : i ∈ compPartialSumTargetSet m M N) :
∃ (j : _) (hj : j ∈ compPartialSumSource m M N), compChangeOfVariables m M N j hj = i := by
rcases i with ⟨n, c⟩
refine ⟨⟨c.length, c.blocksFun⟩, ?_, ?_⟩
· simp only [compPartialSumTargetSet, Set.mem_setOf_eq] at hi
simp only [mem_compPartialSumSource_iff, hi.left, hi.right, true_and, and_true]
exact fun a => c.one_le_blocks' _
· dsimp [compChangeOfVariables]
rw [Composition.sigma_eq_iff_blocks_eq]
simp only [Composition.blocksFun]
conv_rhs => rw [← List.ofFn_get c.blocks]
/-- Target set in the change of variables to compute the composition of partial sums of formal
power series, here given a a finset.
See also `comp_partialSum`. -/
def compPartialSumTarget (m M N : ℕ) : Finset (Σ n, Composition n) :=
Set.Finite.toFinset <|
((Finset.finite_toSet _).dependent_image _).subset <|
compPartialSumTargetSet_image_compPartialSumSource m M N
@[simp]
theorem mem_compPartialSumTarget_iff {m M N : ℕ} {a : Σ n, Composition n} :
a ∈ compPartialSumTarget m M N ↔
m ≤ a.2.length ∧ a.2.length < M ∧ ∀ j : Fin a.2.length, a.2.blocksFun j < N := by
simp [compPartialSumTarget, compPartialSumTargetSet]
/-- `compChangeOfVariables m M N` is a bijection between `compPartialSumSource m M N`
and `compPartialSumTarget m M N`, yielding equal sums for functions that correspond to each
other under the bijection. As `compChangeOfVariables m M N` is a dependent function, stating
that it is a bijection is not directly possible, but the consequence on sums can be stated
more easily. -/
theorem compChangeOfVariables_sum {α : Type*} [AddCommMonoid α] (m M N : ℕ)
(f : (Σ n : ℕ, Fin n → ℕ) → α) (g : (Σ n, Composition n) → α)
(h : ∀ (e) (he : e ∈ compPartialSumSource m M N), f e = g (compChangeOfVariables m M N e he)) :
∑ e ∈ compPartialSumSource m M N, f e = ∑ e ∈ compPartialSumTarget m M N, g e := by
apply Finset.sum_bij (compChangeOfVariables m M N)
-- We should show that the correspondence we have set up is indeed a bijection
-- between the index sets of the two sums.
-- 1 - show that the image belongs to `compPartialSumTarget m N N`
· rintro ⟨k, blocks_fun⟩ H
rw [mem_compPartialSumSource_iff] at H
simp only [mem_compPartialSumTarget_iff, Composition.length, H.left,
length_ofFn, true_and, compChangeOfVariables]
intro j
simp only [Composition.blocksFun, (H.right _).right, List.get_ofFn]
-- 2 - show that the map is injective
· rintro ⟨k, blocks_fun⟩ H ⟨k', blocks_fun'⟩ H' heq
obtain rfl : k = k' := by
have := (compChangeOfVariables_length m M N H).symm
rwa [heq, compChangeOfVariables_length] at this
congr
funext i
calc
blocks_fun i = (compChangeOfVariables m M N _ H).2.blocksFun _ :=
(compChangeOfVariables_blocksFun m M N H i).symm
_ = (compChangeOfVariables m M N _ H').2.blocksFun _ := by
grind
_ = blocks_fun' i := compChangeOfVariables_blocksFun m M N H' i
-- 3 - show that the map is surjective
· intro i hi
apply compPartialSumTargetSet_image_compPartialSumSource m M N i
simpa [compPartialSumTarget] using hi
-- 4 - show that the composition gives the `compAlongComposition` application
· assumption
/-- The auxiliary set corresponding to the composition of partial sums asymptotically contains
all possible compositions. -/
theorem compPartialSumTarget_tendsto_prod_atTop :
Tendsto (fun (p : ℕ × ℕ) => compPartialSumTarget 0 p.1 p.2) atTop atTop := by
apply Monotone.tendsto_atTop_finset
· intro m n hmn a ha
have : ∀ i, i < m.1 → i < n.1 := fun i hi => lt_of_lt_of_le hi hmn.1
have : ∀ i, i < m.2 → i < n.2 := fun i hi => lt_of_lt_of_le hi hmn.2
simp_all
· rintro ⟨n, c⟩
simp only [mem_compPartialSumTarget_iff]
obtain ⟨n, hn⟩ : BddAbove ((Finset.univ.image fun i : Fin c.length => c.blocksFun i) : Set ℕ) :=
Finset.bddAbove _
refine
⟨max n c.length + 1, bot_le, lt_of_le_of_lt (le_max_right n c.length) (lt_add_one _), fun j =>
lt_of_le_of_lt (le_trans ?_ (le_max_left _ _)) (lt_add_one _)⟩
apply hn
simp only [Finset.mem_image_of_mem, Finset.mem_coe, Finset.mem_univ]
/-- The auxiliary set corresponding to the composition of partial sums asymptotically contains
all possible compositions. -/
theorem compPartialSumTarget_tendsto_atTop :
Tendsto (fun N => compPartialSumTarget 0 N N) atTop atTop := by
apply Tendsto.comp compPartialSumTarget_tendsto_prod_atTop tendsto_atTop_diagonal
/-- Composing the partial sums of two multilinear series coincides with the sum over all
compositions in `compPartialSumTarget 0 N N`. This is precisely the motivation for the
definition of `compPartialSumTarget`. -/
theorem comp_partialSum (q : FormalMultilinearSeries 𝕜 F G) (p : FormalMultilinearSeries 𝕜 E F)
(M N : ℕ) (z : E) :
q.partialSum M (∑ i ∈ Finset.Ico 1 N, p i fun _j => z) =
∑ i ∈ compPartialSumTarget 0 M N, q.compAlongComposition p i.2 fun _j => z := by
-- we expand the composition, using the multilinearity of `q` to expand along each coordinate.
suffices H :
(∑ n ∈ Finset.range M,
∑ r ∈ Fintype.piFinset fun i : Fin n => Finset.Ico 1 N,
q n fun i : Fin n => p (r i) fun _j => z) =
∑ i ∈ compPartialSumTarget 0 M N, q.compAlongComposition p i.2 fun _j => z by
simpa only [FormalMultilinearSeries.partialSum, ContinuousMultilinearMap.map_sum_finset] using H
-- rewrite the first sum as a big sum over a sigma type, in the finset
-- `compPartialSumTarget 0 N N`
rw [Finset.range_eq_Ico, Finset.sum_sigma']
-- use `compChangeOfVariables_sum`, saying that this change of variables respects sums
apply compChangeOfVariables_sum 0 M N
rintro ⟨k, blocks_fun⟩ H
apply congr _ (compChangeOfVariables_length 0 M N H).symm
intros
rw [← compChangeOfVariables_blocksFun 0 M N H, applyComposition, Function.comp_def]
end FormalMultilinearSeries
open FormalMultilinearSeries
/-- If two functions `g` and `f` have power series `q` and `p` respectively at `f x` and `x`, within
two sets `s` and `t` such that `f` maps `s` to `t`, then `g ∘ f` admits the power
series `q.comp p` at `x` within `s`. -/
theorem HasFPowerSeriesWithinAt.comp {g : F → G} {f : E → F} {q : FormalMultilinearSeries 𝕜 F G}
{p : FormalMultilinearSeries 𝕜 E F} {x : E} {t : Set F} {s : Set E}
(hg : HasFPowerSeriesWithinAt g q t (f x)) (hf : HasFPowerSeriesWithinAt f p s x)
(hs : Set.MapsTo f s t) : HasFPowerSeriesWithinAt (g ∘ f) (q.comp p) s x := by
/- Consider `rf` and `rg` such that `f` and `g` have power series expansion on the disks
of radius `rf` and `rg`. -/
rcases hg with ⟨rg, Hg⟩
rcases hf with ⟨rf, Hf⟩
-- The terms defining `q.comp p` are geometrically summable in a disk of some radius `r`.
rcases q.comp_summable_nnreal p Hg.radius_pos Hf.radius_pos with ⟨r, r_pos : 0 < r, hr⟩
/- We will consider `y` which is smaller than `r` and `rf`, and also small enough that
`f (x + y)` is close enough to `f x` to be in the disk where `g` is well behaved. Let
`min (r, rf, δ)` be this new radius. -/
obtain ⟨δ, δpos, hδ⟩ :
∃ δ : ℝ≥0∞, 0 < δ ∧ ∀ {z : E}, z ∈ insert x s ∩ EMetric.ball x δ
→ f z ∈ insert (f x) t ∩ EMetric.ball (f x) rg := by
have : insert (f x) t ∩ EMetric.ball (f x) rg ∈ 𝓝[insert (f x) t] (f x) := by
apply inter_mem_nhdsWithin
exact EMetric.ball_mem_nhds _ Hg.r_pos
have := Hf.analyticWithinAt.continuousWithinAt_insert.tendsto_nhdsWithin (hs.insert x) this
rcases EMetric.mem_nhdsWithin_iff.1 this with ⟨δ, δpos, Hδ⟩
exact ⟨δ, δpos, fun {z} hz => Hδ (by rwa [Set.inter_comm])⟩
let rf' := min rf δ
have min_pos : 0 < min rf' r := by
simp only [rf', r_pos, Hf.r_pos, δpos, lt_min_iff, ENNReal.coe_pos, and_self_iff]
/- We will show that `g ∘ f` admits the power series `q.comp p` in the disk of
radius `min (r, rf', δ)`. -/
refine ⟨min rf' r, ?_⟩
refine
⟨le_trans (min_le_right rf' r) (FormalMultilinearSeries.le_comp_radius_of_summable q p r hr),
min_pos, fun {y} h'y hy ↦ ?_⟩
/- Let `y` satisfy `‖y‖ < min (r, rf', δ)`. We want to show that `g (f (x + y))` is the sum of
`q.comp p` applied to `y`. -/
-- First, check that `y` is small enough so that estimates for `f` and `g` apply.
have y_mem : y ∈ EMetric.ball (0 : E) rf :=
(EMetric.ball_subset_ball (le_trans (min_le_left _ _) (min_le_left _ _))) hy
have fy_mem : f (x + y) ∈ insert (f x) t ∩ EMetric.ball (f x) rg := by
apply hδ
have : y ∈ EMetric.ball (0 : E) δ :=
(EMetric.ball_subset_ball (le_trans (min_le_left _ _) (min_le_right _ _))) hy
simpa [-Set.mem_insert_iff, edist_eq_enorm_sub, h'y]
/- Now the proof starts. To show that the sum of `q.comp p` at `y` is `g (f (x + y))`,
we will write `q.comp p` applied to `y` as a big sum over all compositions.
Since the sum is summable, to get its convergence it suffices to get
the convergence along some increasing sequence of sets.
We will use the sequence of sets `compPartialSumTarget 0 n n`,
along which the sum is exactly the composition of the partial sums of `q` and `p`, by design.
To show that it converges to `g (f (x + y))`, pointwise convergence would not be enough,
but we have uniform convergence to save the day. -/
-- First step: the partial sum of `p` converges to `f (x + y)`.
have A : Tendsto (fun n ↦ (n, ∑ a ∈ Finset.Ico 1 n, p a fun _ ↦ y))
atTop (atTop ×ˢ 𝓝 (f (x + y) - f x)) := by
apply Tendsto.prodMk tendsto_id
have L : ∀ᶠ n in atTop, (∑ a ∈ Finset.range n, p a fun _b ↦ y) - f x
= ∑ a ∈ Finset.Ico 1 n, p a fun _b ↦ y := by
rw [eventually_atTop]
refine ⟨1, fun n hn => ?_⟩
symm
rw [eq_sub_iff_add_eq', Finset.range_eq_Ico, ← Hf.coeff_zero fun _i => y,
Finset.sum_eq_sum_Ico_succ_bot hn]
have :
Tendsto (fun n => (∑ a ∈ Finset.range n, p a fun _b => y) - f x) atTop
(𝓝 (f (x + y) - f x)) :=
(Hf.hasSum h'y y_mem).tendsto_sum_nat.sub tendsto_const_nhds
exact Tendsto.congr' L this
-- Second step: the composition of the partial sums of `q` and `p` converges to `g (f (x + y))`.
have B : Tendsto (fun n => q.partialSum n (∑ a ∈ Finset.Ico 1 n, p a fun _b ↦ y)) atTop
(𝓝 (g (f (x + y)))) := by
-- we use the fact that the partial sums of `q` converge to `g (f (x + y))`, uniformly on a
-- neighborhood of `f (x + y)`.
have : Tendsto (fun (z : ℕ × F) ↦ q.partialSum z.1 z.2)
(atTop ×ˢ 𝓝 (f (x + y) - f x)) (𝓝 (g (f x + (f (x + y) - f x)))) := by
apply Hg.tendsto_partialSum_prod (y := f (x + y) - f x)
· simpa [edist_eq_enorm_sub] using fy_mem.2
· simpa using fy_mem.1
simpa using this.comp A
-- Third step: the sum over all compositions in `compPartialSumTarget 0 n n` converges to
-- `g (f (x + y))`. As this sum is exactly the composition of the partial sum, this is a direct
-- consequence of the second step
have C :
Tendsto
(fun n => ∑ i ∈ compPartialSumTarget 0 n n, q.compAlongComposition p i.2 fun _j => y)
atTop (𝓝 (g (f (x + y)))) := by
simpa [comp_partialSum] using B
-- Fourth step: the sum over all compositions is `g (f (x + y))`. This follows from the
-- convergence along a subsequence proved in the third step, and the fact that the sum is Cauchy
-- thanks to the summability properties.
have D :
HasSum (fun i : Σ n, Composition n => q.compAlongComposition p i.2 fun _j => y)
(g (f (x + y))) :=
haveI cau :
CauchySeq fun s : Finset (Σ n, Composition n) =>
∑ i ∈ s, q.compAlongComposition p i.2 fun _j => y := by
apply cauchySeq_finset_of_norm_bounded (NNReal.summable_coe.2 hr) _
simp only [coe_nnnorm, NNReal.coe_mul, NNReal.coe_pow]
rintro ⟨n, c⟩
calc
‖(compAlongComposition q p c) fun _j : Fin n => y‖ ≤
‖compAlongComposition q p c‖ * ∏ _j : Fin n, ‖y‖ := by
apply ContinuousMultilinearMap.le_opNorm
_ ≤ ‖compAlongComposition q p c‖ * (r : ℝ) ^ n := by
rw [Finset.prod_const, Finset.card_fin]
gcongr
rw [EMetric.mem_ball, edist_zero_eq_enorm] at hy
have := le_trans (le_of_lt hy) (min_le_right _ _)
rwa [enorm_le_coe, ← NNReal.coe_le_coe, coe_nnnorm] at this
tendsto_nhds_of_cauchySeq_of_subseq cau compPartialSumTarget_tendsto_atTop C
-- Fifth step: the sum over `n` of `q.comp p n` can be expressed as a particular resummation of
-- the sum over all compositions, by grouping together the compositions of the same
-- integer `n`. The convergence of the whole sum therefore implies the converence of the sum
-- of `q.comp p n`
have E : HasSum (fun n => (q.comp p) n fun _j => y) (g (f (x + y))) := by
apply D.sigma
intro n
simp only [compAlongComposition_apply, FormalMultilinearSeries.comp,
ContinuousMultilinearMap.sum_apply]
exact hasSum_fintype _
rw [Function.comp_apply]
exact E
/-- If two functions `g` and `f` have power series `q` and `p` respectively at `f x` and `x`,
then `g ∘ f` admits the power series `q.comp p` at `x`. -/
theorem HasFPowerSeriesAt.comp {g : F → G} {f : E → F} {q : FormalMultilinearSeries 𝕜 F G}
{p : FormalMultilinearSeries 𝕜 E F} {x : E}
(hg : HasFPowerSeriesAt g q (f x)) (hf : HasFPowerSeriesAt f p x) :
HasFPowerSeriesAt (g ∘ f) (q.comp p) x := by
rw [← hasFPowerSeriesWithinAt_univ] at hf hg ⊢
apply hg.comp hf (by simp)
/-- If two functions `g` and `f` are analytic respectively at `f x` and `x`, within
two sets `s` and `t` such that `f` maps `s` to `t`, then `g ∘ f` is analytic at `x` within `s`. -/
theorem AnalyticWithinAt.comp {g : F → G} {f : E → F} {x : E} {t : Set F} {s : Set E}
(hg : AnalyticWithinAt 𝕜 g t (f x)) (hf : AnalyticWithinAt 𝕜 f s x) (h : Set.MapsTo f s t) :
AnalyticWithinAt 𝕜 (g ∘ f) s x := by
let ⟨_q, hq⟩ := hg
let ⟨_p, hp⟩ := hf
exact (hq.comp hp h).analyticWithinAt
/-- Version of `AnalyticWithinAt.comp` where point equality is a separate hypothesis. -/
theorem AnalyticWithinAt.comp_of_eq {g : F → G} {f : E → F} {y : F} {x : E} {t : Set F} {s : Set E}
(hg : AnalyticWithinAt 𝕜 g t y) (hf : AnalyticWithinAt 𝕜 f s x) (h : Set.MapsTo f s t)
(hy : f x = y) :
AnalyticWithinAt 𝕜 (g ∘ f) s x := by
rw [← hy] at hg
exact hg.comp hf h
lemma AnalyticOn.comp {f : F → G} {g : E → F} {s : Set F}
{t : Set E} (hf : AnalyticOn 𝕜 f s) (hg : AnalyticOn 𝕜 g t) (h : Set.MapsTo g t s) :
AnalyticOn 𝕜 (f ∘ g) t :=
fun x m ↦ (hf _ (h m)).comp (hg x m) h
/-- If two functions `g` and `f` are analytic respectively at `f x` and `x`, then `g ∘ f` is
analytic at `x`. -/
@[fun_prop]
theorem AnalyticAt.comp {g : F → G} {f : E → F} {x : E} (hg : AnalyticAt 𝕜 g (f x))
(hf : AnalyticAt 𝕜 f x) : AnalyticAt 𝕜 (g ∘ f) x := by
rw [← analyticWithinAt_univ] at hg hf ⊢
apply hg.comp hf (by simp)
/-- If two functions `g` and `f` are analytic respectively at `f x` and `x`, then `g ∘ f` is
analytic at `x`. -/
@[fun_prop]
theorem AnalyticAt.comp' {g : F → G} {f : E → F} {x : E} (hg : AnalyticAt 𝕜 g (f x))
(hf : AnalyticAt 𝕜 f x) : AnalyticAt 𝕜 (fun z ↦ g (f z)) x :=
hg.comp hf
/-- Version of `AnalyticAt.comp` where point equality is a separate hypothesis. -/
theorem AnalyticAt.comp_of_eq {g : F → G} {f : E → F} {y : F} {x : E} (hg : AnalyticAt 𝕜 g y)
(hf : AnalyticAt 𝕜 f x) (hy : f x = y) : AnalyticAt 𝕜 (g ∘ f) x := by
rw [← hy] at hg
exact hg.comp hf
/-- Version of `AnalyticAt.comp` where point equality is a separate hypothesis. -/
theorem AnalyticAt.comp_of_eq' {g : F → G} {f : E → F} {y : F} {x : E} (hg : AnalyticAt 𝕜 g y)
(hf : AnalyticAt 𝕜 f x) (hy : f x = y) : AnalyticAt 𝕜 (fun z ↦ g (f z)) x := by
apply hg.comp_of_eq hf hy
theorem AnalyticAt.comp_analyticWithinAt {g : F → G} {f : E → F} {x : E} {s : Set E}
(hg : AnalyticAt 𝕜 g (f x)) (hf : AnalyticWithinAt 𝕜 f s x) :
AnalyticWithinAt 𝕜 (g ∘ f) s x := by
rw [← analyticWithinAt_univ] at hg
exact hg.comp hf (Set.mapsTo_univ _ _)
theorem AnalyticAt.comp_analyticWithinAt_of_eq {g : F → G} {f : E → F} {x : E} {y : F} {s : Set E}
(hg : AnalyticAt 𝕜 g y) (hf : AnalyticWithinAt 𝕜 f s x) (h : f x = y) :
AnalyticWithinAt 𝕜 (g ∘ f) s x := by
rw [← h] at hg
exact hg.comp_analyticWithinAt hf
/-- If two functions `g` and `f` are analytic respectively on `s.image f` and `s`, then `g ∘ f` is
analytic on `s`. -/
theorem AnalyticOnNhd.comp' {s : Set E} {g : F → G} {f : E → F} (hg : AnalyticOnNhd 𝕜 g (s.image f))
(hf : AnalyticOnNhd 𝕜 f s) : AnalyticOnNhd 𝕜 (g ∘ f) s :=
fun z hz => (hg (f z) (Set.mem_image_of_mem f hz)).comp (hf z hz)
theorem AnalyticOnNhd.comp {s : Set E} {t : Set F} {g : F → G} {f : E → F}
(hg : AnalyticOnNhd 𝕜 g t) (hf : AnalyticOnNhd 𝕜 f s) (st : Set.MapsTo f s t) :
AnalyticOnNhd 𝕜 (g ∘ f) s :=
comp' (mono hg (Set.mapsTo_iff_image_subset.mp st)) hf
lemma AnalyticOnNhd.comp_analyticOn {f : F → G} {g : E → F} {s : Set F}
{t : Set E} (hf : AnalyticOnNhd 𝕜 f s) (hg : AnalyticOn 𝕜 g t) (h : Set.MapsTo g t s) :
AnalyticOn 𝕜 (f ∘ g) t :=
fun x m ↦ (hf _ (h m)).comp_analyticWithinAt (hg x m)
/-- If two functions `g` and `f` have finite power series `q` and `p` respectively at `f x` and `x`,
then `g ∘ f` admits the finite power series `q.comp p` at `x`. -/
theorem HasFiniteFPowerSeriesAt.comp {m n : ℕ} {g : F → G} {f : E → F}
{q : FormalMultilinearSeries 𝕜 F G} {p : FormalMultilinearSeries 𝕜 E F} {x : E}
(hg : HasFiniteFPowerSeriesAt g q (f x) m) (hf : HasFiniteFPowerSeriesAt f p x n) (hn : 0 < n) :
HasFiniteFPowerSeriesAt (g ∘ f) (q.comp p) x (m * n) := by
rcases hg.hasFPowerSeriesAt.comp hf.hasFPowerSeriesAt with ⟨r, hr⟩
refine ⟨r, hr, fun i hi ↦ ?_⟩
apply Finset.sum_eq_zero
rintro c -
ext v
simp only [compAlongComposition_apply, ContinuousMultilinearMap.zero_apply]
rcases le_or_gt m c.length with hc | hc
· simp [hg.finite _ hc]
obtain ⟨j, hj⟩ : ∃ j, n ≤ c.blocksFun j := by
contrapose! hi
rw [← c.sum_blocksFun]
rcases eq_zero_or_pos c.length with h'c | h'c
· have : ∑ j : Fin c.length, c.blocksFun j = 0 := by
apply Finset.sum_eq_zero (fun j hj ↦ ?_)
have := j.2
grind
rw [this]
exact mul_pos (by grind) hn
· calc ∑ j : Fin c.length, c.blocksFun j
_ < ∑ j : Fin c.length, n := by
apply Finset.sum_lt_sum (fun j hj ↦ (hi j).le)
exact ⟨⟨0, h'c⟩, Finset.mem_univ _, hi _⟩
_ = c.length * n := by simp
_ ≤ m * n := by gcongr
apply ContinuousMultilinearMap.map_coord_zero _ j
simp [applyComposition, hf.finite _ hj]
/-- If two functions `g` and `f` are continuously polynomial respectively at `f x` and `x`,
then `g ∘ f` is continuously polynomial at `x`. -/
theorem CPolynomialAt.comp {g : F → G} {f : E → F} {x : E}
(hg : CPolynomialAt 𝕜 g (f x)) (hf : CPolynomialAt 𝕜 f x) :
CPolynomialAt 𝕜 (g ∘ f) x := by
rcases hg with ⟨q, m, hm⟩
rcases hf with ⟨p, n, hn⟩
refine ⟨q.comp p, m * (n + 1), ?_⟩
exact hm.comp (hn.of_le (Nat.le_succ n)) (Nat.zero_lt_succ n)
/-- If two functions `g` and `f` are continuously polynomial respectively at `f x` and `x`,
then `g ∘ f` is continuously polynomial at `x`. -/
theorem CPolynomialAt.fun_comp {g : F → G} {f : E → F} {x : E}
(hg : CPolynomialAt 𝕜 g (f x)) (hf : CPolynomialAt 𝕜 f x) :
CPolynomialAt 𝕜 (fun z ↦ g (f z)) x :=
hg.comp hf
/-- Version of `CPolynomialAt.comp` where point equality is a separate hypothesis. -/
theorem CPolynomialAt.comp_of_eq {g : F → G} {f : E → F} {y : F} {x : E} (hg : CPolynomialAt 𝕜 g y)
(hf : CPolynomialAt 𝕜 f x) (hy : f x = y) : CPolynomialAt 𝕜 (g ∘ f) x := by
rw [← hy] at hg
exact hg.comp hf
/-- Version of `CPolynomialAt.comp` where point equality is a separate hypothesis. -/
theorem CPolynomialAt.fun_comp_of_eq {g : F → G} {f : E → F} {y : F} {x : E}
(hg : CPolynomialAt 𝕜 g y) (hf : CPolynomialAt 𝕜 f x) (hy : f x = y) :
CPolynomialAt 𝕜 (fun z ↦ g (f z)) x :=
hg.comp_of_eq hf hy
/-- If two functions `g` and `f` are continuously polynomial respectively on `s.image f` and `s`,
then `g ∘ f` is continuously polynomial on `s`. -/
theorem CPolynomialOn.comp' {s : Set E} {g : F → G} {f : E → F} (hg : CPolynomialOn 𝕜 g (s.image f))
(hf : CPolynomialOn 𝕜 f s) : CPolynomialOn 𝕜 (g ∘ f) s :=
fun z hz => (hg (f z) (Set.mem_image_of_mem f hz)).comp (hf z hz)
theorem CPolynomialOn.comp {s : Set E} {t : Set F} {g : F → G} {f : E → F}
(hg : CPolynomialOn 𝕜 g t) (hf : CPolynomialOn 𝕜 f s) (st : Set.MapsTo f s t) :
CPolynomialOn 𝕜 (g ∘ f) s :=
comp' (mono hg (Set.mapsTo_iff_image_subset.mp st)) hf
/-!
### Associativity of the composition of formal multilinear series
In this paragraph, we prove the associativity of the composition of formal power series.
By definition,
```
(r.comp q).comp p n v
= ∑_{i₁ + ... + iₖ = n} (r.comp q)ₖ (p_{i₁} (v₀, ..., v_{i₁ -1}), p_{i₂} (...), ..., p_{iₖ}(...))
= ∑_{a : Composition n} (r.comp q) a.length (applyComposition p a v)
```
decomposing `r.comp q` in the same way, we get
```
(r.comp q).comp p n v
= ∑_{a : Composition n} ∑_{b : Composition a.length}
r b.length (applyComposition q b (applyComposition p a v))
```
On the other hand,
```
r.comp (q.comp p) n v = ∑_{c : Composition n} r c.length (applyComposition (q.comp p) c v)
```
Here, `applyComposition (q.comp p) c v` is a vector of length `c.length`, whose `i`-th term is
given by `(q.comp p) (c.blocksFun i) (v_l, v_{l+1}, ..., v_{m-1})` where `{l, ..., m-1}` is the
`i`-th block in the composition `c`, of length `c.blocksFun i` by definition. To compute this term,
we expand it as `∑_{dᵢ : Composition (c.blocksFun i)} q dᵢ.length (applyComposition p dᵢ v')`,
where `v' = (v_l, v_{l+1}, ..., v_{m-1})`. Therefore, we get
```
r.comp (q.comp p) n v =
∑_{c : Composition n} ∑_{d₀ : Composition (c.blocksFun 0),
..., d_{c.length - 1} : Composition (c.blocksFun (c.length - 1))}
r c.length (fun i ↦ q dᵢ.length (applyComposition p dᵢ v'ᵢ))
```
To show that these terms coincide, we need to explain how to reindex the sums to put them in
bijection (and then the terms we are summing will correspond to each other). Suppose we have a
composition `a` of `n`, and a composition `b` of `a.length`. Then `b` indicates how to group
together some blocks of `a`, giving altogether `b.length` blocks of blocks. These blocks of blocks
can be called `d₀, ..., d_{a.length - 1}`, and one obtains a composition `c` of `n` by saying that
each `dᵢ` is one single block. Conversely, if one starts from `c` and the `dᵢ`s, one can concatenate
the `dᵢ`s to obtain a composition `a` of `n`, and register the lengths of the `dᵢ`s in a composition
`b` of `a.length`.
An example might be enlightening. Suppose `a = [2, 2, 3, 4, 2]`. It is a composition of
length 5 of 13. The content of the blocks may be represented as `0011222333344`.
Now take `b = [2, 3]` as a composition of `a.length = 5`. It says that the first 2 blocks of `a`
should be merged, and the last 3 blocks of `a` should be merged, giving a new composition of `13`
made of two blocks of length `4` and `9`, i.e., `c = [4, 9]`. But one can also remember that
the new first block was initially made of two blocks of size `2`, so `d₀ = [2, 2]`, and the new
second block was initially made of three blocks of size `3`, `4` and `2`, so `d₁ = [3, 4, 2]`.
This equivalence is called `Composition.sigmaEquivSigmaPi n` below.
We start with preliminary results on compositions, of a very specialized nature, then define the
equivalence `Composition.sigmaEquivSigmaPi n`, and we deduce finally the associativity of
composition of formal multilinear series in `FormalMultilinearSeries.comp_assoc`.
-/
namespace Composition
variable {n : ℕ}
/-- Rewriting equality in the dependent type `Σ (a : Composition n), Composition a.length)` in
non-dependent terms with lists, requiring that the blocks coincide. -/
theorem sigma_composition_eq_iff (i j : Σ a : Composition n, Composition a.length) :
i = j ↔ i.1.blocks = j.1.blocks ∧ i.2.blocks = j.2.blocks := by
refine ⟨by rintro rfl; exact ⟨rfl, rfl⟩, ?_⟩
rcases i with ⟨a, b⟩
rcases j with ⟨a', b'⟩
rintro ⟨h, h'⟩
obtain rfl : a = a' := by ext1; exact h
obtain rfl : b = b' := by ext1; exact h'
rfl
/-- Rewriting equality in the dependent type
`Σ (c : Composition n), Π (i : Fin c.length), Composition (c.blocksFun i)` in
non-dependent terms with lists, requiring that the lists of blocks coincide. -/
theorem sigma_pi_composition_eq_iff
(u v : Σ c : Composition n, ∀ i : Fin c.length, Composition (c.blocksFun i)) :
u = v ↔ (ofFn fun i => (u.2 i).blocks) = ofFn fun i => (v.2 i).blocks := by
refine ⟨fun H => by rw [H], fun H => ?_⟩
rcases u with ⟨a, b⟩
rcases v with ⟨a', b'⟩
dsimp at H
obtain rfl : a = a' := by
ext1
have :
map List.sum (ofFn fun i : Fin (Composition.length a) => (b i).blocks) =
map List.sum (ofFn fun i : Fin (Composition.length a') => (b' i).blocks) := by
rw [H]
simp only [map_ofFn] at this
change
(ofFn fun i : Fin (Composition.length a) => (b i).blocks.sum) =
ofFn fun i : Fin (Composition.length a') => (b' i).blocks.sum at this
simpa [Composition.blocks_sum, Composition.ofFn_blocksFun] using this
ext1
· rfl
· simp only [heq_eq_eq, ofFn_inj] at H ⊢
ext1 i
ext1
exact congrFun H i
/-- When `a` is a composition of `n` and `b` is a composition of `a.length`, `a.gather b` is the
composition of `n` obtained by gathering all the blocks of `a` corresponding to a block of `b`.
For instance, if `a = [6, 5, 3, 5, 2]` and `b = [2, 3]`, one should gather together
the first two blocks of `a` and its last three blocks, giving `a.gather b = [11, 10]`. -/
def gather (a : Composition n) (b : Composition a.length) : Composition n where
blocks := (a.blocks.splitWrtComposition b).map sum
blocks_pos := by
rw [forall_mem_map]
intro j hj
suffices H : ∀ i ∈ j, 1 ≤ i from calc
0 < j.length := length_pos_of_mem_splitWrtComposition hj
_ ≤ j.sum := length_le_sum_of_one_le _ H
intro i hi
apply a.one_le_blocks
rw [← a.blocks.flatten_splitWrtComposition b]
exact mem_flatten_of_mem hj hi
blocks_sum := by rw [← sum_flatten, flatten_splitWrtComposition, a.blocks_sum]
theorem length_gather (a : Composition n) (b : Composition a.length) :
length (a.gather b) = b.length :=
show (map List.sum (a.blocks.splitWrtComposition b)).length = b.blocks.length by
rw [length_map, length_splitWrtComposition]
/-- An auxiliary function used in the definition of `sigmaEquivSigmaPi` below, associating to
two compositions `a` of `n` and `b` of `a.length`, and an index `i` bounded by the length of
`a.gather b`, the subcomposition of `a` made of those blocks belonging to the `i`-th block of
`a.gather b`. -/
def sigmaCompositionAux (a : Composition n) (b : Composition a.length)
(i : Fin (a.gather b).length) : Composition ((a.gather b).blocksFun i) where
blocks :=
(a.blocks.splitWrtComposition b)[i.val]'(by
rw [length_splitWrtComposition, ← length_gather]; exact i.2)
blocks_pos {i} hi :=
a.blocks_pos
(by
rw [← a.blocks.flatten_splitWrtComposition b]
exact mem_flatten_of_mem (List.getElem_mem _) hi)
blocks_sum := by simp [Composition.blocksFun, getElem_map, Composition.gather]
theorem length_sigmaCompositionAux (a : Composition n) (b : Composition a.length)
(i : Fin b.length) :
Composition.length (Composition.sigmaCompositionAux a b ⟨i, (length_gather a b).symm ▸ i.2⟩) =
Composition.blocksFun b i :=
show List.length ((splitWrtComposition a.blocks b)[i.1]) = blocksFun b i by
rw [getElem_map_rev List.length, getElem_of_eq (map_length_splitWrtComposition _ _), blocksFun,
get_eq_getElem]
theorem blocksFun_sigmaCompositionAux (a : Composition n) (b : Composition a.length)
(i : Fin b.length) (j : Fin (blocksFun b i)) :
blocksFun (sigmaCompositionAux a b ⟨i, (length_gather a b).symm ▸ i.2⟩)
⟨j, (length_sigmaCompositionAux a b i).symm ▸ j.2⟩ =
blocksFun a (embedding b i j) := by
unfold sigmaCompositionAux
rw [blocksFun, get_eq_getElem, getElem_of_eq (getElem_splitWrtComposition _ _ _ _),
getElem_drop, getElem_take]; rfl
/-- Auxiliary lemma to prove that the composition of formal multilinear series is associative.
Consider a composition `a` of `n` and a composition `b` of `a.length`. Grouping together some
blocks of `a` according to `b` as in `a.gather b`, one can compute the total size of the blocks
of `a` up to an index `sizeUpTo b i + j` (where the `j` corresponds to a set of blocks of `a`
that do not fill a whole block of `a.gather b`). The first part corresponds to a sum of blocks
in `a.gather b`, and the second one to a sum of blocks in the next block of
`sigmaCompositionAux a b`. This is the content of this lemma. -/
theorem sizeUpTo_sizeUpTo_add (a : Composition n) (b : Composition a.length) {i j : ℕ}
(hi : i < b.length) (hj : j < blocksFun b ⟨i, hi⟩) :
sizeUpTo a (sizeUpTo b i + j) =
sizeUpTo (a.gather b) i +
sizeUpTo (sigmaCompositionAux a b ⟨i, (length_gather a b).symm ▸ hi⟩) j := by
induction j with
| zero =>
change
sum (take (b.blocks.take i).sum a.blocks) =
sum (take i (map sum (splitWrtComposition a.blocks b)))
induction i with
| zero => rfl
| succ i IH =>
have A : i < b.length := Nat.lt_of_succ_lt hi
have B : i < List.length (map List.sum (splitWrtComposition a.blocks b)) := by simp [A]
have C : 0 < blocksFun b ⟨i, A⟩ := Composition.blocks_pos' _ _ _
rw [sum_take_succ _ _ B, ← IH A C]
have :
take (sum (take i b.blocks)) a.blocks =
take (sum (take i b.blocks)) (take (sum (take (i + 1) b.blocks)) a.blocks) := by
rw [take_take, min_eq_left]
apply monotone_sum_take _ (Nat.le_succ _)
rw [this, getElem_map, getElem_splitWrtComposition, ←
take_append_drop (sum (take i b.blocks)) (take (sum (take (Nat.succ i) b.blocks)) a.blocks),
sum_append]
congr
rw [take_append_drop]
| succ j IHj =>
have A : j < blocksFun b ⟨i, hi⟩ := lt_trans (lt_add_one j) hj
have B : j < length (sigmaCompositionAux a b ⟨i, (length_gather a b).symm ▸ hi⟩) := by
convert A; rw [← length_sigmaCompositionAux]
have C : sizeUpTo b i + j < sizeUpTo b (i + 1) := by
simp only [sizeUpTo_succ b hi, add_lt_add_iff_left]
exact A
have D : sizeUpTo b i + j < length a := lt_of_lt_of_le C (b.sizeUpTo_le _)
have : sizeUpTo b i + Nat.succ j = (sizeUpTo b i + j).succ := rfl
rw [this, sizeUpTo_succ _ D, IHj A, sizeUpTo_succ _ B]
simp only [sigmaCompositionAux, add_assoc]
rw [getElem_of_eq (getElem_splitWrtComposition _ _ _ _), getElem_drop, getElem_take]
/-- Natural equivalence between `(Σ (a : Composition n), Composition a.length)` and
`(Σ (c : Composition n), Π (i : Fin c.length), Composition (c.blocksFun i))`, that shows up as a
change of variables in the proof that composition of formal multilinear series is associative.
Consider a composition `a` of `n` and a composition `b` of `a.length`. Then `b` indicates how to
group together some blocks of `a`, giving altogether `b.length` blocks of blocks. These blocks of
blocks can be called `d₀, ..., d_{a.length - 1}`, and one obtains a composition `c` of `n` by
saying that each `dᵢ` is one single block. The map `⟨a, b⟩ → ⟨c, (d₀, ..., d_{a.length - 1})⟩` is
the direct map in the equiv.
Conversely, if one starts from `c` and the `dᵢ`s, one can join the `dᵢ`s to obtain a composition
`a` of `n`, and register the lengths of the `dᵢ`s in a composition `b` of `a.length`. This is the
inverse map of the equiv.
-/
def sigmaEquivSigmaPi (n : ℕ) :
(Σ a : Composition n, Composition a.length) ≃
Σ c : Composition n, ∀ i : Fin c.length, Composition (c.blocksFun i) where
toFun i := ⟨i.1.gather i.2, i.1.sigmaCompositionAux i.2⟩
invFun i :=
⟨{ blocks := (ofFn fun j => (i.2 j).blocks).flatten
blocks_pos := by
simp only [and_imp, List.mem_flatten, exists_imp, forall_mem_ofFn_iff]
exact fun {i} j hj => Composition.blocks_pos _ hj
blocks_sum := by simp [sum_ofFn, Composition.blocks_sum, Composition.sum_blocksFun] },
{ blocks := ofFn fun j => (i.2 j).length
blocks_pos := by
intro k hk
refine ((forall_mem_ofFn_iff (P := fun i => 0 < i)).2 fun j => ?_) k hk
exact Composition.length_pos_of_pos _ (Composition.blocks_pos' _ _ _)
blocks_sum := by dsimp only [Composition.length]; simp [sum_ofFn] }⟩
left_inv := by
-- the fact that we have a left inverse is essentially `join_splitWrtComposition`,
-- but we need to massage it to take care of the dependent setting.
rintro ⟨a, b⟩
rw [sigma_composition_eq_iff]
dsimp
constructor
· conv_rhs =>
rw [← flatten_splitWrtComposition a.blocks b, ← ofFn_get (splitWrtComposition a.blocks b)]
have A : length (gather a b) = List.length (splitWrtComposition a.blocks b) := by
simp only [length, gather, length_map, length_splitWrtComposition]
congr! 2
exact (Fin.heq_fun_iff A (α := List ℕ)).2 fun i => rfl
· have B : Composition.length (Composition.gather a b) = List.length b.blocks :=
Composition.length_gather _ _
conv_rhs => rw [← ofFn_getElem b.blocks]
congr 1
refine (Fin.heq_fun_iff B).2 fun i => ?_
rw [sigmaCompositionAux, Composition.length, List.getElem_map_rev List.length,
List.getElem_of_eq (map_length_splitWrtComposition _ _)]
right_inv := by
-- the fact that we have a right inverse is essentially `splitWrtComposition_join`,
-- but we need to massage it to take care of the dependent setting.
rintro ⟨c, d⟩
have : map List.sum (ofFn fun i : Fin (Composition.length c) => (d i).blocks) = c.blocks := by
simp [map_ofFn, Function.comp_def, Composition.blocks_sum, Composition.ofFn_blocksFun]
rw [sigma_pi_composition_eq_iff]
dsimp
congr! 1
· congr
ext1
dsimp [Composition.gather]
rwa [splitWrtComposition_flatten]
simp only [map_ofFn, Function.comp_def]
· rw [Fin.heq_fun_iff]
· intro i
dsimp [Composition.sigmaCompositionAux]
rw [getElem_of_eq (splitWrtComposition_flatten _ _ _)]
· simp only [List.getElem_ofFn]
· simp only [map_ofFn, Function.comp_def]
· congr
end Composition
namespace FormalMultilinearSeries
open Composition
theorem comp_assoc (r : FormalMultilinearSeries 𝕜 G H) (q : FormalMultilinearSeries 𝕜 F G)
(p : FormalMultilinearSeries 𝕜 E F) : (r.comp q).comp p = r.comp (q.comp p) := by
ext n v
/- First, rewrite the two compositions appearing in the theorem as two sums over complicated
sigma types, as in the description of the proof above. -/
let f : (Σ a : Composition n, Composition a.length) → H := fun c =>
r c.2.length (applyComposition q c.2 (applyComposition p c.1 v))
let g : (Σ c : Composition n, ∀ i : Fin c.length, Composition (c.blocksFun i)) → H := fun c =>
r c.1.length fun i : Fin c.1.length =>
q (c.2 i).length (applyComposition p (c.2 i) (v ∘ c.1.embedding i))
suffices ∑ c, f c = ∑ c, g c by
simpa +unfoldPartialApp only [FormalMultilinearSeries.comp,
ContinuousMultilinearMap.sum_apply, compAlongComposition_apply, Finset.sum_sigma',
applyComposition, ContinuousMultilinearMap.map_sum]
/- Now, we use `Composition.sigmaEquivSigmaPi n` to change
variables in the second sum, and check that we get exactly the same sums. -/
rw [← (sigmaEquivSigmaPi n).sum_comp]
/- To check that we have the same terms, we should check that we apply the same component of
`r`, and the same component of `q`, and the same component of `p`, to the same coordinate of
`v`. This is true by definition, but at each step one needs to convince Lean that the types
one considers are the same, using a suitable congruence lemma to avoid dependent type issues.
This dance has to be done three times, one for `r`, one for `q` and one for `p`. -/
apply Finset.sum_congr rfl
rintro ⟨a, b⟩ _
dsimp [sigmaEquivSigmaPi]
-- check that the `r` components are the same. Based on `Composition.length_gather`
apply r.congr (Composition.length_gather a b).symm
intro i hi1 hi2
-- check that the `q` components are the same. Based on `length_sigmaCompositionAux`
apply q.congr (length_sigmaCompositionAux a b _).symm
intro j hj1 hj2
-- check that the `p` components are the same. Based on `blocksFun_sigmaCompositionAux`
apply p.congr (blocksFun_sigmaCompositionAux a b _ _).symm
intro k hk1 hk2
-- finally, check that the coordinates of `v` one is using are the same. Based on
-- `sizeUpTo_sizeUpTo_add`.
refine congr_arg v (Fin.ext ?_)
dsimp [Composition.embedding]
rw [sizeUpTo_sizeUpTo_add _ _ hi1 hj1, add_assoc]
end FormalMultilinearSeries |
.lake/packages/mathlib/Mathlib/Analysis/Analytic/Linear.lean | import Mathlib.Analysis.Analytic.Basic
import Mathlib.Analysis.Analytic.CPolynomialDef
/-!
# Linear functions are analytic
In this file we prove that a `ContinuousLinearMap` defines an analytic function with
the formal power series `f x = f a + f (x - a)`. We also prove similar results for bilinear maps.
We deduce this fact from the stronger result that continuous linear maps are continuously
polynomial, i.e., they admit a finite power series.
-/
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
[NormedSpace 𝕜 E] {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] {G : Type*}
[NormedAddCommGroup G] [NormedSpace 𝕜 G]
open scoped Topology NNReal ENNReal
open Set Filter Asymptotics
noncomputable section
namespace ContinuousLinearMap
@[simp]
theorem fpowerSeries_radius (f : E →L[𝕜] F) (x : E) : (f.fpowerSeries x).radius = ∞ :=
(f.fpowerSeries x).radius_eq_top_of_forall_image_add_eq_zero 2 fun _ => rfl
protected theorem hasFiniteFPowerSeriesOnBall (f : E →L[𝕜] F) (x : E) :
HasFiniteFPowerSeriesOnBall f (f.fpowerSeries x) x 2 ∞ where
r_le := by simp
r_pos := ENNReal.coe_lt_top
hasSum := fun _ => (hasSum_nat_add_iff' 2).1 <| by
simp [Finset.sum_range_succ, hasSum_zero, fpowerSeries]
finite := by
intro m hm
match m with
| 0 | 1 => linarith
| n + 2 => simp [fpowerSeries]
protected theorem hasFPowerSeriesOnBall (f : E →L[𝕜] F) (x : E) :
HasFPowerSeriesOnBall f (f.fpowerSeries x) x ∞ :=
(f.hasFiniteFPowerSeriesOnBall x).toHasFPowerSeriesOnBall
protected theorem hasFPowerSeriesAt (f : E →L[𝕜] F) (x : E) :
HasFPowerSeriesAt f (f.fpowerSeries x) x :=
⟨∞, f.hasFPowerSeriesOnBall x⟩
protected theorem cpolynomialAt (f : E →L[𝕜] F) (x : E) : CPolynomialAt 𝕜 f x :=
(f.hasFiniteFPowerSeriesOnBall x).cpolynomialAt
protected theorem analyticAt (f : E →L[𝕜] F) (x : E) : AnalyticAt 𝕜 f x :=
(f.hasFPowerSeriesAt x).analyticAt
protected theorem cpolynomialOn (f : E →L[𝕜] F) (s : Set E) : CPolynomialOn 𝕜 f s :=
fun x _ ↦ f.cpolynomialAt x
protected theorem analyticOnNhd (f : E →L[𝕜] F) (s : Set E) : AnalyticOnNhd 𝕜 f s :=
fun x _ ↦ f.analyticAt x
protected theorem analyticWithinAt (f : E →L[𝕜] F) (s : Set E) (x : E) : AnalyticWithinAt 𝕜 f s x :=
(f.analyticAt x).analyticWithinAt
protected theorem analyticOn (f : E →L[𝕜] F) (s : Set E) : AnalyticOn 𝕜 f s :=
fun x _ ↦ f.analyticWithinAt _ x
/-- Reinterpret a bilinear map `f : E →L[𝕜] F →L[𝕜] G` as a multilinear map
`(E × F) [×2]→L[𝕜] G`. This multilinear map is the second term in the formal
multilinear series expansion of `uncurry f`. It is given by
`f.uncurryBilinear ![(x, y), (x', y')] = f x y'`. -/
def uncurryBilinear (f : E →L[𝕜] F →L[𝕜] G) : E × F[×2]→L[𝕜] G :=
@ContinuousLinearMap.uncurryLeft 𝕜 1 (fun _ => E × F) G _ _ _ _ _ <|
(↑(continuousMultilinearCurryFin1 𝕜 (E × F) G).symm : (E × F →L[𝕜] G) →L[𝕜] _).comp <|
f.bilinearComp (fst _ _ _) (snd _ _ _)
@[simp]
theorem uncurryBilinear_apply (f : E →L[𝕜] F →L[𝕜] G) (m : Fin 2 → E × F) :
f.uncurryBilinear m = f (m 0).1 (m 1).2 :=
rfl
/-- Formal multilinear series expansion of a bilinear function `f : E →L[𝕜] F →L[𝕜] G`. -/
def fpowerSeriesBilinear (f : E →L[𝕜] F →L[𝕜] G) (x : E × F) : FormalMultilinearSeries 𝕜 (E × F) G
| 0 => ContinuousMultilinearMap.uncurry0 𝕜 _ (f x.1 x.2)
| 1 => (continuousMultilinearCurryFin1 𝕜 (E × F) G).symm (f.deriv₂ x)
| 2 => f.uncurryBilinear
| _ => 0
@[simp]
theorem fpowerSeriesBilinear_apply_zero (f : E →L[𝕜] F →L[𝕜] G) (x : E × F) :
fpowerSeriesBilinear f x 0 = ContinuousMultilinearMap.uncurry0 𝕜 _ (f x.1 x.2) :=
rfl
@[simp]
theorem fpowerSeriesBilinear_apply_one (f : E →L[𝕜] F →L[𝕜] G) (x : E × F) :
fpowerSeriesBilinear f x 1 = (continuousMultilinearCurryFin1 𝕜 (E × F) G).symm (f.deriv₂ x) :=
rfl
@[simp]
theorem fpowerSeriesBilinear_apply_two (f : E →L[𝕜] F →L[𝕜] G) (x : E × F) :
fpowerSeriesBilinear f x 2 = f.uncurryBilinear :=
rfl
@[simp]
theorem fpowerSeriesBilinear_apply_add_three (f : E →L[𝕜] F →L[𝕜] G) (x : E × F) (n) :
fpowerSeriesBilinear f x (n + 3) = 0 :=
rfl
@[simp]
theorem fpowerSeriesBilinear_radius (f : E →L[𝕜] F →L[𝕜] G) (x : E × F) :
(f.fpowerSeriesBilinear x).radius = ∞ :=
(f.fpowerSeriesBilinear x).radius_eq_top_of_forall_image_add_eq_zero 3 fun _ => rfl
protected theorem hasFPowerSeriesOnBall_bilinear (f : E →L[𝕜] F →L[𝕜] G) (x : E × F) :
HasFPowerSeriesOnBall (fun x : E × F => f x.1 x.2) (f.fpowerSeriesBilinear x) x ∞ :=
{ r_le := by simp
r_pos := ENNReal.coe_lt_top
hasSum := fun _ =>
(hasSum_nat_add_iff' 3).1 <| by
simp only [Finset.sum_range_succ, Prod.fst_add, Prod.snd_add, f.map_add_add]
simp [fpowerSeriesBilinear, hasSum_zero] }
protected theorem hasFPowerSeriesAt_bilinear (f : E →L[𝕜] F →L[𝕜] G) (x : E × F) :
HasFPowerSeriesAt (fun x : E × F => f x.1 x.2) (f.fpowerSeriesBilinear x) x :=
⟨∞, f.hasFPowerSeriesOnBall_bilinear x⟩
protected theorem analyticAt_bilinear (f : E →L[𝕜] F →L[𝕜] G) (x : E × F) :
AnalyticAt 𝕜 (fun x : E × F => f x.1 x.2) x :=
(f.hasFPowerSeriesAt_bilinear x).analyticAt
protected theorem analyticWithinAt_bilinear (f : E →L[𝕜] F →L[𝕜] G) (s : Set (E × F)) (x : E × F) :
AnalyticWithinAt 𝕜 (fun x : E × F => f x.1 x.2) s x :=
(f.analyticAt_bilinear x).analyticWithinAt
protected theorem analyticOnNhd_bilinear (f : E →L[𝕜] F →L[𝕜] G) (s : Set (E × F)) :
AnalyticOnNhd 𝕜 (fun x : E × F => f x.1 x.2) s :=
fun x _ ↦ f.analyticAt_bilinear x
protected theorem analyticOn_bilinear (f : E →L[𝕜] F →L[𝕜] G) (s : Set (E × F)) :
AnalyticOn 𝕜 (fun x : E × F => f x.1 x.2) s :=
(f.analyticOnNhd_bilinear s).analyticOn
end ContinuousLinearMap
variable {s : Set E} {z : E} {t : Set (E × F)} {p : E × F}
@[fun_prop]
lemma analyticAt_id : AnalyticAt 𝕜 (id : E → E) z :=
(ContinuousLinearMap.id 𝕜 E).analyticAt z
lemma analyticWithinAt_id : AnalyticWithinAt 𝕜 (id : E → E) s z :=
analyticAt_id.analyticWithinAt
/-- `id` is entire -/
theorem analyticOnNhd_id : AnalyticOnNhd 𝕜 (fun x : E ↦ x) s :=
fun _ _ ↦ analyticAt_id
theorem analyticOn_id : AnalyticOn 𝕜 (fun x : E ↦ x) s :=
fun _ _ ↦ analyticWithinAt_id
/-- `fst` is analytic -/
theorem analyticAt_fst : AnalyticAt 𝕜 (fun p : E × F ↦ p.fst) p :=
(ContinuousLinearMap.fst 𝕜 E F).analyticAt p
theorem analyticWithinAt_fst : AnalyticWithinAt 𝕜 (fun p : E × F ↦ p.fst) t p :=
analyticAt_fst.analyticWithinAt
/-- `snd` is analytic -/
theorem analyticAt_snd : AnalyticAt 𝕜 (fun p : E × F ↦ p.snd) p :=
(ContinuousLinearMap.snd 𝕜 E F).analyticAt p
theorem analyticWithinAt_snd : AnalyticWithinAt 𝕜 (fun p : E × F ↦ p.snd) t p :=
analyticAt_snd.analyticWithinAt
/-- `fst` is entire -/
theorem analyticOnNhd_fst : AnalyticOnNhd 𝕜 (fun p : E × F ↦ p.fst) t :=
fun _ _ ↦ analyticAt_fst
theorem analyticOn_fst : AnalyticOn 𝕜 (fun p : E × F ↦ p.fst) t :=
fun _ _ ↦ analyticWithinAt_fst
/-- `snd` is entire -/
theorem analyticOnNhd_snd : AnalyticOnNhd 𝕜 (fun p : E × F ↦ p.snd) t :=
fun _ _ ↦ analyticAt_snd
theorem analyticOn_snd : AnalyticOn 𝕜 (fun p : E × F ↦ p.snd) t :=
fun _ _ ↦ analyticWithinAt_snd
namespace ContinuousLinearEquiv
variable (f : E ≃L[𝕜] F) (s : Set E) (x : E)
protected theorem analyticAt : AnalyticAt 𝕜 f x :=
((f : E →L[𝕜] F).hasFPowerSeriesAt x).analyticAt
protected theorem analyticOnNhd : AnalyticOnNhd 𝕜 f s :=
fun x _ ↦ f.analyticAt x
protected theorem analyticWithinAt : AnalyticWithinAt 𝕜 f s x :=
(f.analyticAt x).analyticWithinAt
protected theorem analyticOn : AnalyticOn 𝕜 f s :=
fun x _ ↦ f.analyticWithinAt _ x
end ContinuousLinearEquiv
namespace LinearIsometryEquiv
variable (f : E ≃ₗᵢ[𝕜] F) (s : Set E) (x : E)
protected theorem analyticAt : AnalyticAt 𝕜 f x :=
((f : E →L[𝕜] F).hasFPowerSeriesAt x).analyticAt
protected theorem analyticOnNhd : AnalyticOnNhd 𝕜 f s :=
fun x _ ↦ f.analyticAt x
protected theorem analyticWithinAt : AnalyticWithinAt 𝕜 f s x :=
(f.analyticAt x).analyticWithinAt
protected theorem analyticOn : AnalyticOn 𝕜 f s :=
fun x _ ↦ f.analyticWithinAt _ x
end LinearIsometryEquiv |
.lake/packages/mathlib/Mathlib/Analysis/Analytic/Uniqueness.lean | import Mathlib.Analysis.Analytic.Linear
import Mathlib.Analysis.Analytic.Composition
import Mathlib.Analysis.Analytic.Constructions
import Mathlib.Analysis.Normed.Module.Completion
import Mathlib.Analysis.Analytic.ChangeOrigin
/-!
# Uniqueness principle for analytic functions
We show that two analytic functions which coincide around a point coincide on whole connected sets,
in `AnalyticOnNhd.eqOn_of_preconnected_of_eventuallyEq`.
-/
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
[NormedSpace 𝕜 E] {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
open Set
open scoped Topology ENNReal NNReal
/-!
### Uniqueness of power series
If a function `f : E → F` has two representations as power series at a point `x : E`, corresponding
to formal multilinear series `p₁` and `p₂`, then these representations agree term-by-term. That is,
for any `n : ℕ` and `y : E`, `p₁ n (fun i ↦ y) = p₂ n (fun i ↦ y)`. In the one-dimensional case,
when `f : 𝕜 → E`, the continuous multilinear maps `p₁ n` and `p₂ n` are given by
`ContinuousMultilinearMap.mkPiRing`, and hence are determined completely by the value of
`p₁ n (fun i ↦ 1)`, so `p₁ = p₂`. Consequently, the radius of convergence for one series can be
transferred to the other.
-/
section Uniqueness
open ContinuousMultilinearMap
theorem Asymptotics.IsBigO.continuousMultilinearMap_apply_eq_zero {n : ℕ} {p : E [×n]→L[𝕜] F}
(h : (fun y => p fun _ => y) =O[𝓝 0] fun y => ‖y‖ ^ (n + 1)) (y : E) : (p fun _ => y) = 0 := by
obtain ⟨c, c_pos, hc⟩ := h.exists_pos
obtain ⟨t, ht, t_open, z_mem⟩ := eventually_nhds_iff.mp (isBigOWith_iff.mp hc)
obtain ⟨δ, δ_pos, δε⟩ := (Metric.isOpen_iff.mp t_open) 0 z_mem
clear h hc z_mem
rcases n with - | n
· exact norm_eq_zero.mp (by
simpa only [fin0_apply_norm, norm_eq_zero, norm_zero, zero_add, pow_one,
mul_zero, norm_le_zero_iff] using ht 0 (δε (Metric.mem_ball_self δ_pos)))
· refine Or.elim (Classical.em (y = 0))
(fun hy => by simpa only [hy] using p.map_zero) fun hy => ?_
replace hy := norm_pos_iff.mpr hy
refine norm_eq_zero.mp (le_antisymm (le_of_forall_pos_le_add fun ε ε_pos => ?_) (norm_nonneg _))
have h₀ := _root_.mul_pos c_pos (pow_pos hy (n.succ + 1))
obtain ⟨k, k_pos, k_norm⟩ := NormedField.exists_norm_lt 𝕜
(lt_min (mul_pos δ_pos (inv_pos.mpr hy)) (mul_pos ε_pos (inv_pos.mpr h₀)))
have h₁ : ‖k • y‖ < δ := by
rw [norm_smul]
exact inv_mul_cancel_right₀ hy.ne.symm δ ▸
mul_lt_mul_of_pos_right (lt_of_lt_of_le k_norm (min_le_left _ _)) hy
have h₂ :=
calc
‖p fun _ => k • y‖ ≤ c * ‖k • y‖ ^ (n.succ + 1) := by
simpa only [norm_pow, _root_.norm_norm] using ht (k • y) (δε (mem_ball_zero_iff.mpr h₁))
_ = ‖k‖ ^ n.succ * (‖k‖ * (c * ‖y‖ ^ (n.succ + 1))) := by
simp only [norm_smul, mul_pow]
ring
have h₃ : ‖k‖ * (c * ‖y‖ ^ (n.succ + 1)) < ε :=
inv_mul_cancel_right₀ h₀.ne.symm ε ▸
mul_lt_mul_of_pos_right (lt_of_lt_of_le k_norm (min_le_right _ _)) h₀
calc
‖p fun _ => y‖ = ‖k⁻¹ ^ n.succ‖ * ‖p fun _ => k • y‖ := by
simpa only [inv_smul_smul₀ (norm_pos_iff.mp k_pos), norm_smul, Finset.prod_const,
Finset.card_fin] using
congr_arg norm (p.map_smul_univ (fun _ : Fin n.succ => k⁻¹) fun _ : Fin n.succ => k • y)
_ ≤ ‖k⁻¹ ^ n.succ‖ * (‖k‖ ^ n.succ * (‖k‖ * (c * ‖y‖ ^ (n.succ + 1)))) := by gcongr
_ = ‖(k⁻¹ * k) ^ n.succ‖ * (‖k‖ * (c * ‖y‖ ^ (n.succ + 1))) := by
rw [← mul_assoc]
simp [norm_mul, mul_pow]
_ ≤ 0 + ε := by
rw [inv_mul_cancel₀ (norm_pos_iff.mp k_pos)]
simpa using h₃.le
/-- If a formal multilinear series `p` represents the zero function at `x : E`, then the
terms `p n (fun i ↦ y)` appearing in the sum are zero for any `n : ℕ`, `y : E`. -/
theorem HasFPowerSeriesAt.apply_eq_zero {p : FormalMultilinearSeries 𝕜 E F} {x : E}
(h : HasFPowerSeriesAt 0 p x) (n : ℕ) : ∀ y : E, (p n fun _ => y) = 0 := by
refine Nat.strong_induction_on n fun k hk => ?_
have psum_eq : p.partialSum (k + 1) = fun y => p k fun _ => y := by
funext z
refine Finset.sum_eq_single _ (fun b hb hnb => ?_) fun hn => ?_
· have := Finset.mem_range_succ_iff.mp hb
simp only [hk b (this.lt_of_ne hnb)]
· exact False.elim (hn (Finset.mem_range.mpr (lt_add_one k)))
replace h := h.isBigO_sub_partialSum_pow k.succ
simp only [psum_eq, zero_sub, Pi.zero_apply, Asymptotics.isBigO_neg_left] at h
exact h.continuousMultilinearMap_apply_eq_zero
/-- A one-dimensional formal multilinear series representing the zero function is zero. -/
theorem HasFPowerSeriesAt.eq_zero {p : FormalMultilinearSeries 𝕜 𝕜 E} {x : 𝕜}
(h : HasFPowerSeriesAt 0 p x) : p = 0 := by
ext n
rw [← mkPiRing_apply_one_eq_self (p n)]
simp [h.apply_eq_zero n 1]
/-- One-dimensional formal multilinear series representing the same function are equal. -/
theorem HasFPowerSeriesAt.eq_formalMultilinearSeries {p₁ p₂ : FormalMultilinearSeries 𝕜 𝕜 E}
{f : 𝕜 → E} {x : 𝕜} (h₁ : HasFPowerSeriesAt f p₁ x) (h₂ : HasFPowerSeriesAt f p₂ x) : p₁ = p₂ :=
sub_eq_zero.mp (HasFPowerSeriesAt.eq_zero (x := x) (by simpa only [sub_self] using h₁.sub h₂))
theorem HasFPowerSeriesAt.eq_formalMultilinearSeries_of_eventually
{p q : FormalMultilinearSeries 𝕜 𝕜 E} {f g : 𝕜 → E} {x : 𝕜} (hp : HasFPowerSeriesAt f p x)
(hq : HasFPowerSeriesAt g q x) (heq : ∀ᶠ z in 𝓝 x, f z = g z) : p = q :=
(hp.congr heq).eq_formalMultilinearSeries hq
/-- A one-dimensional formal multilinear series representing a locally zero function is zero. -/
theorem HasFPowerSeriesAt.eq_zero_of_eventually {p : FormalMultilinearSeries 𝕜 𝕜 E} {f : 𝕜 → E}
{x : 𝕜} (hp : HasFPowerSeriesAt f p x) (hf : f =ᶠ[𝓝 x] 0) : p = 0 :=
(hp.congr hf).eq_zero
/-- If a function `f : 𝕜 → E` has two power series representations at `x`, then the given radii in
which convergence is guaranteed may be interchanged. This can be useful when the formal multilinear
series in one representation has a particularly nice form, but the other has a larger radius. -/
theorem HasFPowerSeriesOnBall.exchange_radius {p₁ p₂ : FormalMultilinearSeries 𝕜 𝕜 E} {f : 𝕜 → E}
{r₁ r₂ : ℝ≥0∞} {x : 𝕜} (h₁ : HasFPowerSeriesOnBall f p₁ x r₁)
(h₂ : HasFPowerSeriesOnBall f p₂ x r₂) : HasFPowerSeriesOnBall f p₁ x r₂ :=
h₂.hasFPowerSeriesAt.eq_formalMultilinearSeries h₁.hasFPowerSeriesAt ▸ h₂
/-- If a function `f : 𝕜 → E` has power series representation `p` on a ball of some radius and for
each positive radius it has some power series representation, then `p` converges to `f` on the whole
`𝕜`. -/
theorem HasFPowerSeriesOnBall.r_eq_top_of_exists {f : 𝕜 → E} {r : ℝ≥0∞} {x : 𝕜}
{p : FormalMultilinearSeries 𝕜 𝕜 E} (h : HasFPowerSeriesOnBall f p x r)
(h' : ∀ (r' : ℝ≥0) (_ : 0 < r'), ∃ p' : FormalMultilinearSeries 𝕜 𝕜 E,
HasFPowerSeriesOnBall f p' x r') :
HasFPowerSeriesOnBall f p x ∞ :=
{ r_le := ENNReal.le_of_forall_pos_nnreal_lt fun r hr _ =>
let ⟨_, hp'⟩ := h' r hr
(h.exchange_radius hp').r_le
r_pos := ENNReal.coe_lt_top
hasSum := fun {y} _ =>
let ⟨r', hr'⟩ := exists_gt ‖y‖₊
let ⟨_, hp'⟩ := h' r' hr'.ne_bot.bot_lt
(h.exchange_radius hp').hasSum <| mem_emetric_ball_zero_iff.mpr (ENNReal.coe_lt_coe.2 hr') }
end Uniqueness
namespace AnalyticOnNhd
/-- If an analytic function vanishes around a point, then it is uniformly zero along
a connected set. Superseded by `AnalyticOnNhd.eqOn_zero_of_preconnected_of_eventuallyEq_zero` which
does not assume completeness of the target space. -/
theorem eqOn_zero_of_preconnected_of_eventuallyEq_zero_aux [CompleteSpace F] {f : E → F} {U : Set E}
(hf : AnalyticOnNhd 𝕜 f U) (hU : IsPreconnected U)
{z₀ : E} (h₀ : z₀ ∈ U) (hfz₀ : f =ᶠ[𝓝 z₀] 0) :
EqOn f 0 U := by
/- Let `u` be the set of points around which `f` vanishes. It is clearly open. We have to show
that its limit points in `U` still belong to it, from which the inclusion `U ⊆ u` will follow
by connectedness. -/
let u := {x | f =ᶠ[𝓝 x] 0}
suffices main : closure u ∩ U ⊆ u by
have Uu : U ⊆ u :=
hU.subset_of_closure_inter_subset isOpen_setOf_eventually_nhds ⟨z₀, h₀, hfz₀⟩ main
intro z hz
simpa using mem_of_mem_nhds (Uu hz)
/- Take a limit point `x`, then a ball `B (x, r)` on which it has a power series expansion, and
then `y ∈ B (x, r/2) ∩ u`. Then `f` has a power series expansion on `B (y, r/2)` as it is
contained in `B (x, r)`. All the coefficients in this series expansion vanish, as `f` is zero
on a neighborhood of `y`. Therefore, `f` is zero on `B (y, r/2)`. As this ball contains `x`,
it follows that `f` vanishes on a neighborhood of `x`, proving the claim. -/
rintro x ⟨xu, xU⟩
rcases hf x xU with ⟨p, r, hp⟩
obtain ⟨y, yu, hxy⟩ : ∃ y ∈ u, edist x y < r / 2 :=
EMetric.mem_closure_iff.1 xu (r / 2) (ENNReal.half_pos hp.r_pos.ne')
let q := p.changeOrigin (y - x)
have has_series : HasFPowerSeriesOnBall f q y (r / 2) := by
have A : (‖y - x‖₊ : ℝ≥0∞) < r / 2 := by rwa [edist_comm, edist_eq_enorm_sub] at hxy
have := hp.changeOrigin (A.trans_le ENNReal.half_le_self)
simp only [add_sub_cancel] at this
apply this.mono (ENNReal.half_pos hp.r_pos.ne')
apply ENNReal.le_sub_of_add_le_left ENNReal.coe_ne_top
apply (add_le_add A.le (le_refl (r / 2))).trans (le_of_eq _)
exact ENNReal.add_halves _
have M : EMetric.ball y (r / 2) ∈ 𝓝 x := EMetric.isOpen_ball.mem_nhds hxy
filter_upwards [M] with z hz
have A : HasSum (fun n : ℕ => q n fun _ : Fin n => z - y) (f z) := has_series.hasSum_sub hz
have B : HasSum (fun n : ℕ => q n fun _ : Fin n => z - y) 0 := by
have : HasFPowerSeriesAt 0 q y := has_series.hasFPowerSeriesAt.congr yu
convert hasSum_zero (α := F) using 1
ext n
exact this.apply_eq_zero n _
exact HasSum.unique A B
/-- The *identity principle* for analytic functions: If an analytic function vanishes in a whole
neighborhood of a point `z₀`, then it is uniformly zero along a connected set. For a one-dimensional
version assuming only that the function vanishes at some points arbitrarily close to `z₀`, see
`AnalyticOnNhd.eqOn_zero_of_preconnected_of_frequently_eq_zero`. -/
theorem eqOn_zero_of_preconnected_of_eventuallyEq_zero {f : E → F} {U : Set E}
(hf : AnalyticOnNhd 𝕜 f U) (hU : IsPreconnected U)
{z₀ : E} (h₀ : z₀ ∈ U) (hfz₀ : f =ᶠ[𝓝 z₀] 0) :
EqOn f 0 U := by
let F' := UniformSpace.Completion F
set e : F →L[𝕜] F' := UniformSpace.Completion.toComplL
have : AnalyticOnNhd 𝕜 (e ∘ f) U := fun x hx => (e.analyticAt _).comp (hf x hx)
have A : EqOn (e ∘ f) 0 U := by
apply eqOn_zero_of_preconnected_of_eventuallyEq_zero_aux this hU h₀
filter_upwards [hfz₀] with x hx
simp only [hx, Function.comp_apply, Pi.zero_apply, map_zero]
intro z hz
have : e (f z) = e 0 := by simpa only using A hz
exact UniformSpace.Completion.coe_injective F this
/-- The *identity principle* for analytic functions: If two analytic functions coincide in a whole
neighborhood of a point `z₀`, then they coincide globally along a connected set.
For a one-dimensional version assuming only that the functions coincide at some points
arbitrarily close to `z₀`, see `AnalyticOnNhd.eqOn_of_preconnected_of_frequently_eq`. -/
theorem eqOn_of_preconnected_of_eventuallyEq {f g : E → F} {U : Set E} (hf : AnalyticOnNhd 𝕜 f U)
(hg : AnalyticOnNhd 𝕜 g U) (hU : IsPreconnected U) {z₀ : E} (h₀ : z₀ ∈ U) (hfg : f =ᶠ[𝓝 z₀] g) :
EqOn f g U := by
have hfg' : f - g =ᶠ[𝓝 z₀] 0 := hfg.mono fun z h => by simp [h]
simpa [sub_eq_zero] using fun z hz =>
(hf.sub hg).eqOn_zero_of_preconnected_of_eventuallyEq_zero hU h₀ hfg' hz
/-- The *identity principle* for analytic functions: If two analytic functions on a normed space
coincide in a neighborhood of a point `z₀`, then they coincide everywhere.
For a one-dimensional version assuming only that the functions coincide at some points
arbitrarily close to `z₀`, see `AnalyticOnNhd.eq_of_frequently_eq`. -/
theorem eq_of_eventuallyEq {f g : E → F} [PreconnectedSpace E] (hf : AnalyticOnNhd 𝕜 f univ)
(hg : AnalyticOnNhd 𝕜 g univ) {z₀ : E} (hfg : f =ᶠ[𝓝 z₀] g) : f = g :=
funext fun x =>
eqOn_of_preconnected_of_eventuallyEq hf hg isPreconnected_univ (mem_univ z₀) hfg (mem_univ x)
end AnalyticOnNhd |
.lake/packages/mathlib/Mathlib/Analysis/Analytic/Order.lean | import Mathlib.Analysis.Analytic.IsolatedZeros
/-!
# Vanishing Order of Analytic Functions
This file defines the order of vanishing of an analytic function `f` at a point `z₀`, as an element
of `ℕ∞`.
## TODO
Uniformize API between analytic and meromorphic functions
-/
open Filter Set
open scoped Topology
variable {𝕜 E : Type*} [NontriviallyNormedField 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E]
/-!
## Vanishing Order at a Point: Definition and Characterization
-/
section NormedSpace
variable {f g : 𝕜 → E} {n : ℕ} {z₀ : 𝕜}
open scoped Classical in
/-- The order of vanishing of `f` at `z₀`, as an element of `ℕ∞`.
The order is defined to be `∞` if `f` is identically 0 on a neighbourhood of `z₀`, and otherwise the
unique `n` such that `f` can locally be written as `f z = (z - z₀) ^ n • g z`, where `g` is analytic
and does not vanish at `z₀`. See `AnalyticAt.analyticOrderAt_eq_top` and
`AnalyticAt.analyticOrderAt_eq_natCast` for these equivalences.
If `f` isn't analytic at `z₀`, then `analyticOrderAt f z₀` returns a junk value of `0`. -/
noncomputable def analyticOrderAt (f : 𝕜 → E) (z₀ : 𝕜) : ℕ∞ :=
if hf : AnalyticAt 𝕜 f z₀ then
if h : ∀ᶠ z in 𝓝 z₀, f z = 0 then ⊤
else ↑(hf.exists_eventuallyEq_pow_smul_nonzero_iff.mpr h).choose
else 0
@[deprecated (since := "2025-05-02")] alias AnalyticAt.order := analyticOrderAt
/-- The order of vanishing of `f` at `z₀`, as an element of `ℕ`.
The order is defined to be `0` if `f` is identically zero on a neighbourhood of `z₀`,
and is otherwise the unique `n` such that `f` can locally be written as `f z = (z - z₀) ^ n • g z`,
where `g` is analytic and does not vanish at `z₀`. See `AnalyticAt.analyticOrderAt_eq_top` and
`AnalyticAt.analyticOrderAt_eq_natCast` for these equivalences.
If `f` isn't analytic at `z₀`, then `analyticOrderNatAt f z₀` returns a junk value of `0`. -/
noncomputable def analyticOrderNatAt (f : 𝕜 → E) (z₀ : 𝕜) : ℕ := (analyticOrderAt f z₀).toNat
@[simp]
lemma analyticOrderAt_of_not_analyticAt (hf : ¬ AnalyticAt 𝕜 f z₀) : analyticOrderAt f z₀ = 0 :=
dif_neg hf
@[simp]
lemma analyticOrderNatAt_of_not_analyticAt (hf : ¬ AnalyticAt 𝕜 f z₀) :
analyticOrderNatAt f z₀ = 0 := by simp [analyticOrderNatAt, hf]
@[simp] lemma Nat.cast_analyticOrderNatAt (hf : analyticOrderAt f z₀ ≠ ⊤) :
analyticOrderNatAt f z₀ = analyticOrderAt f z₀ := ENat.coe_toNat hf
/-- The order of a function `f` at a `z₀` is infinity iff `f` vanishes locally around `z₀`. -/
lemma analyticOrderAt_eq_top : analyticOrderAt f z₀ = ⊤ ↔ ∀ᶠ z in 𝓝 z₀, f z = 0 where
mp hf := by unfold analyticOrderAt at hf; split_ifs at hf with h <;> simp [*] at *
mpr hf := by unfold analyticOrderAt; simp [hf, analyticAt_congr hf, analyticAt_const]
@[deprecated (since := "2025-05-03")] alias AnalyticAt.order_eq_top_iff := analyticOrderAt_eq_top
/-- The order of an analytic function `f` at `z₀` equals a natural number `n` iff `f` can locally
be written as `f z = (z - z₀) ^ n • g z`, where `g` is analytic and does not vanish at `z₀`. -/
lemma AnalyticAt.analyticOrderAt_eq_natCast (hf : AnalyticAt 𝕜 f z₀) :
analyticOrderAt f z₀ = n ↔
∃ (g : 𝕜 → E), AnalyticAt 𝕜 g z₀ ∧ g z₀ ≠ 0 ∧ ∀ᶠ z in 𝓝 z₀, f z = (z - z₀) ^ n • g z := by
unfold analyticOrderAt
split_ifs with h
· simp only [ENat.top_ne_coe, false_iff]
contrapose! h
rw [← hf.exists_eventuallyEq_pow_smul_nonzero_iff]
exact ⟨n, h⟩
· rw [← hf.exists_eventuallyEq_pow_smul_nonzero_iff] at h
refine ⟨fun hn ↦ (WithTop.coe_inj.mp hn : h.choose = n) ▸ h.choose_spec, fun h' ↦ ?_⟩
rw [AnalyticAt.unique_eventuallyEq_pow_smul_nonzero h.choose_spec h']
@[deprecated (since := "2025-05-03")]
alias AnalyticAt.order_eq_nat_iff := AnalyticAt.analyticOrderAt_eq_natCast
/-- The order of an analytic function `f` at `z₀` equals a natural number `n` iff `f` can locally
be written as `f z = (z - z₀) ^ n • g z`, where `g` is analytic and does not vanish at `z₀`. -/
lemma AnalyticAt.analyticOrderNatAt_eq_iff (hf : AnalyticAt 𝕜 f z₀) (hf' : analyticOrderAt f z₀ ≠ ⊤)
{n : ℕ} :
analyticOrderNatAt f z₀ = n ↔
∃ (g : 𝕜 → E), AnalyticAt 𝕜 g z₀ ∧ g z₀ ≠ 0 ∧ ∀ᶠ z in 𝓝 z₀, f z = (z - z₀) ^ n • g z := by
simp [← Nat.cast_inj (R := ℕ∞), Nat.cast_analyticOrderNatAt hf', hf.analyticOrderAt_eq_natCast]
/-- The order of an analytic function `f` at `z₀` is finite iff `f` can locally be written as `f z =
(z - z₀) ^ analyticOrderNatAt f z₀ • g z`, where `g` is analytic and does not vanish at `z₀`.
See `MeromorphicNFAt.order_eq_zero_iff` for an analogous statement about meromorphic functions in
normal form.
-/
lemma AnalyticAt.analyticOrderAt_ne_top (hf : AnalyticAt 𝕜 f z₀) :
analyticOrderAt f z₀ ≠ ⊤ ↔
∃ (g : 𝕜 → E), AnalyticAt 𝕜 g z₀ ∧ g z₀ ≠ 0 ∧
f =ᶠ[𝓝 z₀] fun z ↦ (z - z₀) ^ analyticOrderNatAt f z₀ • g z := by
simp only [← ENat.coe_toNat_eq_self, Eq.comm, EventuallyEq, ← hf.analyticOrderAt_eq_natCast,
analyticOrderNatAt]
@[deprecated (since := "2025-05-03")]
alias AnalyticAt.order_ne_top_iff := AnalyticAt.analyticOrderAt_ne_top
lemma analyticOrderAt_eq_zero : analyticOrderAt f z₀ = 0 ↔ ¬ AnalyticAt 𝕜 f z₀ ∨ f z₀ ≠ 0 := by
by_cases hf : AnalyticAt 𝕜 f z₀
· rw [← ENat.coe_zero, hf.analyticOrderAt_eq_natCast]
constructor
· intro ⟨g, _, _, hg⟩
simpa [hf, hg.self_of_nhds]
· exact fun hz ↦ ⟨f, hf, hz.resolve_left <| not_not_intro hf, by simp⟩
· simp [hf]
lemma analyticOrderAt_ne_zero : analyticOrderAt f z₀ ≠ 0 ↔ AnalyticAt 𝕜 f z₀ ∧ f z₀ = 0 := by
simp [analyticOrderAt_eq_zero]
/-- The order of an analytic function `f` at `z₀` is zero iff `f` does not vanish at `z₀`. -/
protected lemma AnalyticAt.analyticOrderAt_eq_zero (hf : AnalyticAt 𝕜 f z₀) :
analyticOrderAt f z₀ = 0 ↔ f z₀ ≠ 0 := by simp [hf, analyticOrderAt_eq_zero]
@[deprecated (since := "2025-05-03")]
alias AnalyticAt.order_eq_zero_iff := AnalyticAt.analyticOrderAt_eq_zero
/-- The order of an analytic function `f` at `z₀` is zero iff `f` does not vanish at `z₀`. -/
protected lemma AnalyticAt.analyticOrderAt_ne_zero (hf : AnalyticAt 𝕜 f z₀) :
analyticOrderAt f z₀ ≠ 0 ↔ f z₀ = 0 := hf.analyticOrderAt_eq_zero.not_left
/-- A function vanishes at a point if its analytic order is nonzero in `ℕ∞`. -/
lemma apply_eq_zero_of_analyticOrderAt_ne_zero (hf : analyticOrderAt f z₀ ≠ 0) :
f z₀ = 0 := by
by_cases hf' : AnalyticAt 𝕜 f z₀ <;> simp_all [analyticOrderAt_eq_zero]
/-- A function vanishes at a point if its analytic order is nonzero when converted to ℕ. -/
lemma apply_eq_zero_of_analyticOrderNatAt_ne_zero (hf : analyticOrderNatAt f z₀ ≠ 0) :
f z₀ = 0 := by
by_cases hf' : AnalyticAt 𝕜 f z₀ <;> simp_all [analyticOrderNatAt, analyticOrderAt_eq_zero]
@[deprecated (since := "2025-05-03")]
alias AnalyticAt.apply_eq_zero_of_order_toNat_ne_zero := apply_eq_zero_of_analyticOrderNatAt_ne_zero
/-- Characterization of which natural numbers are `≤ hf.order`. Useful for avoiding case splits,
since it applies whether or not the order is `∞`. -/
lemma natCast_le_analyticOrderAt (hf : AnalyticAt 𝕜 f z₀) {n : ℕ} :
n ≤ analyticOrderAt f z₀ ↔
∃ g, AnalyticAt 𝕜 g z₀ ∧ ∀ᶠ z in 𝓝 z₀, f z = (z - z₀) ^ n • g z := by
unfold analyticOrderAt
split_ifs with h
· simpa using ⟨0, analyticAt_const .., by simpa⟩
· let m := (hf.exists_eventuallyEq_pow_smul_nonzero_iff.mpr h).choose
obtain ⟨g, hg, hg_ne, hm⟩ := (hf.exists_eventuallyEq_pow_smul_nonzero_iff.mpr h).choose_spec
rw [ENat.coe_le_coe]
refine ⟨fun hmn ↦ ⟨fun z ↦ (z - z₀) ^ (m - n) • g z, by fun_prop, ?_⟩, fun ⟨h, hh, hfh⟩ ↦ ?_⟩
· filter_upwards [hm] with z hz using by rwa [← mul_smul, ← pow_add, Nat.add_sub_of_le hmn]
· contrapose! hg_ne
have : ContinuousAt (fun z ↦ (z - z₀) ^ (n - m) • h z) z₀ := by fun_prop
rw [tendsto_nhds_unique_of_eventuallyEq (l := 𝓝[≠] z₀)
hg.continuousAt.continuousWithinAt this.continuousWithinAt ?_]
· simp [m, Nat.sub_ne_zero_of_lt hg_ne]
· filter_upwards [self_mem_nhdsWithin, hm.filter_mono nhdsWithin_le_nhds,
hfh.filter_mono nhdsWithin_le_nhds] with z hz hf' hf''
rw [← inv_smul_eq_iff₀ (pow_ne_zero _ <| sub_ne_zero_of_ne hz), hf'', smul_comm,
← mul_smul] at hf'
rw [pow_sub₀ _ (sub_ne_zero_of_ne hz) (by cutsat), ← hf']
@[deprecated (since := "2025-05-03")] alias natCast_le_order_iff := natCast_le_analyticOrderAt
/-- If two functions agree in a neighborhood of `z₀`, then their orders at `z₀` agree. -/
lemma analyticOrderAt_congr (hfg : f =ᶠ[𝓝 z₀] g) :
analyticOrderAt f z₀ = analyticOrderAt g z₀ := by
by_cases hf : AnalyticAt 𝕜 f z₀
· refine ENat.eq_of_forall_natCast_le_iff fun n ↦ ?_
simp only [natCast_le_analyticOrderAt, hf, hf.congr hfg]
congr! 3
exact hfg.congr_left
· rw [analyticOrderAt_of_not_analyticAt hf,
analyticOrderAt_of_not_analyticAt fun hg ↦ hf <| hg.congr hfg.symm]
@[deprecated (since := "2025-05-03")] alias AnalyticAt.order_congr := analyticOrderAt_congr
@[simp] lemma analyticOrderAt_neg : analyticOrderAt (-f) z₀ = analyticOrderAt f z₀ := by
by_cases hf : AnalyticAt 𝕜 f z₀
· refine ENat.eq_of_forall_natCast_le_iff fun n ↦ ?_
simp only [ natCast_le_analyticOrderAt, hf, hf.neg]
exact (Equiv.neg _).exists_congr <| by simp [neg_eq_iff_eq_neg]
· rw [analyticOrderAt_of_not_analyticAt hf,
analyticOrderAt_of_not_analyticAt <| analyticAt_neg.not.2 hf]
/-- The order of a sum is at least the minimum of the orders of the summands. -/
theorem le_analyticOrderAt_add :
min (analyticOrderAt f z₀) (analyticOrderAt g z₀) ≤ analyticOrderAt (f + g) z₀ := by
by_cases hf : AnalyticAt 𝕜 f z₀
· by_cases hg : AnalyticAt 𝕜 g z₀
· refine ENat.forall_natCast_le_iff_le.mp fun n ↦ ?_
simp only [le_min_iff, natCast_le_analyticOrderAt, hf, hg, hf.add hg]
refine fun ⟨⟨F, hF, hF'⟩, ⟨G, hG, hG'⟩⟩ ↦ ⟨F + G, hF.add hG, ?_⟩
filter_upwards [hF', hG'] with z using by simp +contextual
· simp [*]
· simp [*]
@[deprecated (since := "2025-05-03")] alias AnalyticAt.order_add := le_analyticOrderAt_add
lemma le_analyticOrderAt_sub :
min (analyticOrderAt f z₀) (analyticOrderAt g z₀) ≤ analyticOrderAt (f - g) z₀ := by
simpa [sub_eq_add_neg] using le_analyticOrderAt_add (f := f) (g := -g)
lemma analyticOrderAt_add_eq_left_of_lt (hfg : analyticOrderAt f z₀ < analyticOrderAt g z₀) :
analyticOrderAt (f + g) z₀ = analyticOrderAt f z₀ :=
le_antisymm (by simpa [hfg.not_ge] using le_analyticOrderAt_sub (f := f + g) (g := g) (z₀ := z₀))
(by simpa [hfg.le] using le_analyticOrderAt_add (f := f) (g := g) (z₀ := z₀))
lemma analyticOrderAt_add_eq_right_of_lt (hgf : analyticOrderAt g z₀ < analyticOrderAt f z₀) :
analyticOrderAt (f + g) z₀ = analyticOrderAt g z₀ := by
rw [add_comm, analyticOrderAt_add_eq_left_of_lt hgf]
@[deprecated (since := "2025-05-03")] alias order_add_of_order_lt_order := le_analyticOrderAt_add
/-- If two functions have unequal orders, then the order of their sum is exactly the minimum
of the orders of the summands. -/
lemma analyticOrderAt_add_of_ne (hfg : analyticOrderAt f z₀ ≠ analyticOrderAt g z₀) :
analyticOrderAt (f + g) z₀ = min (analyticOrderAt f z₀) (analyticOrderAt g z₀) := by
obtain hfg | hgf := hfg.lt_or_gt
· simpa [hfg.le] using analyticOrderAt_add_eq_left_of_lt hfg
· simpa [hgf.le] using analyticOrderAt_add_eq_right_of_lt hgf
@[deprecated (since := "2025-05-03")]
alias AnalyticAt.order_add_of_order_ne_order := analyticOrderAt_add_of_ne
lemma analyticOrderAt_smul_eq_top_of_left {f : 𝕜 → 𝕜} (hf : analyticOrderAt f z₀ = ⊤) :
analyticOrderAt (f • g) z₀ = ⊤ := by
rw [analyticOrderAt_eq_top, eventually_nhds_iff] at *
obtain ⟨t, h₁t, h₂t, h₃t⟩ := hf
exact ⟨t, fun y hy ↦ by simp [h₁t y hy], h₂t, h₃t⟩
lemma analyticOrderAt_smul_eq_top_of_right {f : 𝕜 → 𝕜} (hg : analyticOrderAt g z₀ = ⊤) :
analyticOrderAt (f • g) z₀ = ⊤ := by
rw [analyticOrderAt_eq_top, eventually_nhds_iff] at *
obtain ⟨t, h₁t, h₂t, h₃t⟩ := hg
exact ⟨t, fun y hy ↦ by simp [h₁t y hy], h₂t, h₃t⟩
/-- The order is additive when scalar multiplying analytic functions. -/
lemma analyticOrderAt_smul {f : 𝕜 → 𝕜} (hf : AnalyticAt 𝕜 f z₀) (hg : AnalyticAt 𝕜 g z₀) :
analyticOrderAt (f • g) z₀ = analyticOrderAt f z₀ + analyticOrderAt g z₀ := by
-- Trivial cases: one of the functions vanishes around z₀
by_cases hf' : analyticOrderAt f z₀ = ⊤
· simp [analyticOrderAt_smul_eq_top_of_left, *]
by_cases hg' : analyticOrderAt g z₀ = ⊤
· simp [analyticOrderAt_smul_eq_top_of_right, *]
-- Non-trivial case: both functions do not vanish around z₀
obtain ⟨f', h₁f', h₂f', h₃f'⟩ := hf.analyticOrderAt_ne_top.1 hf'
obtain ⟨g', h₁g', h₂g', h₃g'⟩ := hg.analyticOrderAt_ne_top.1 hg'
rw [← Nat.cast_analyticOrderNatAt hf', ← Nat.cast_analyticOrderNatAt hg', ← ENat.coe_add,
(hf.smul hg).analyticOrderAt_eq_natCast]
refine ⟨f' • g', h₁f'.smul h₁g', ?_, ?_⟩
· simp
tauto
· obtain ⟨t, h₁t, h₂t, h₃t⟩ := eventually_nhds_iff.1 h₃f'
obtain ⟨s, h₁s, h₂s, h₃s⟩ := eventually_nhds_iff.1 h₃g'
exact eventually_nhds_iff.2
⟨t ∩ s, fun y hy ↦ (by simp [h₁t y hy.1, h₁s y hy.2]; module), h₂t.inter h₂s, h₃t, h₃s⟩
end NormedSpace
/-!
## Vanishing Order at a Point: Elementary Computations
-/
/-- Simplifier lemma for the order of a centered monomial -/
@[simp]
lemma analyticOrderAt_centeredMonomial {z₀ : 𝕜} {n : ℕ} :
analyticOrderAt ((· - z₀) ^ n) z₀ = n := by
rw [AnalyticAt.analyticOrderAt_eq_natCast (by fun_prop)]
exact ⟨1, by simp [Pi.one_def, analyticAt_const]⟩
@[deprecated (since := "2025-05-03")]
alias analyticAt_order_centeredMonomial := analyticOrderAt_centeredMonomial
section NontriviallyNormedField
variable {f g : 𝕜 → 𝕜} {z₀ : 𝕜}
lemma analyticOrderAt_mul_eq_top_of_left (hf : analyticOrderAt f z₀ = ⊤) :
analyticOrderAt (f * g) z₀ = ⊤ := analyticOrderAt_smul_eq_top_of_left hf
@[deprecated (since := "2025-05-03")]
alias AnalyticAt.order_mul_of_order_eq_top := analyticOrderAt_mul_eq_top_of_left
lemma analyticOrderAt_mul_eq_top_of_right (hg : analyticOrderAt g z₀ = ⊤) :
analyticOrderAt (f * g) z₀ = ⊤ := analyticOrderAt_smul_eq_top_of_right hg
/-- The order is additive when multiplying analytic functions. -/
theorem analyticOrderAt_mul (hf : AnalyticAt 𝕜 f z₀) (hg : AnalyticAt 𝕜 g z₀) :
analyticOrderAt (f * g) z₀ = analyticOrderAt f z₀ + analyticOrderAt g z₀ :=
analyticOrderAt_smul hf hg
@[deprecated (since := "2025-05-03")] alias AnalyticAt.order_mul := analyticOrderAt_mul
/-- The order is additive when multiplying analytic functions. -/
theorem analyticOrderNatAt_mul (hf : AnalyticAt 𝕜 f z₀) (hg : AnalyticAt 𝕜 g z₀)
(hf' : analyticOrderAt f z₀ ≠ ⊤) (hg' : analyticOrderAt g z₀ ≠ ⊤) :
analyticOrderNatAt (f * g) z₀ = analyticOrderNatAt f z₀ + analyticOrderNatAt g z₀ := by
simp [analyticOrderNatAt, analyticOrderAt_mul, ENat.toNat_add, *]
/-- The order multiplies by `n` when taking an analytic function to its `n`th power. -/
theorem analyticOrderAt_pow (hf : AnalyticAt 𝕜 f z₀) :
∀ n, analyticOrderAt (f ^ n) z₀ = n • analyticOrderAt f z₀
| 0 => by simp [analyticOrderAt_eq_zero]
| n + 1 => by simp [add_mul, pow_add, analyticOrderAt_mul (hf.pow n), analyticOrderAt_pow, hf]
@[deprecated (since := "2025-05-03")] alias AnalyticAt.order_pow := analyticOrderAt_pow
/-- The order multiplies by `n` when taking an analytic function to its `n`th power. -/
theorem analyticOrderNatAt_pow (hf : AnalyticAt 𝕜 f z₀) (n : ℕ) :
analyticOrderNatAt (f ^ n) z₀ = n • analyticOrderNatAt f z₀ := by
simp [analyticOrderNatAt, analyticOrderAt_pow, hf]
end NontriviallyNormedField
/-!
## Level Sets of the Order Function
-/
namespace AnalyticOnNhd
variable {U : Set 𝕜} {f : 𝕜 → E}
/-- The set where an analytic function has infinite order is clopen in its domain of analyticity. -/
theorem isClopen_setOf_analyticOrderAt_eq_top (hf : AnalyticOnNhd 𝕜 f U) :
IsClopen {u : U | analyticOrderAt f u = ⊤} := by
constructor
· rw [← isOpen_compl_iff, isOpen_iff_forall_mem_open]
intro z hz
rcases (hf z.1 z.2).eventually_eq_zero_or_eventually_ne_zero with h | h
· -- Case: f is locally zero in a punctured neighborhood of z
rw [← analyticOrderAt_eq_top] at h
tauto
· -- Case: f is locally nonzero in a punctured neighborhood of z
obtain ⟨t', h₁t', h₂t', h₃t'⟩ := eventually_nhds_iff.1 (eventually_nhdsWithin_iff.1 h)
use Subtype.val ⁻¹' t'
constructor
· intro w hw
simp only [mem_compl_iff, mem_setOf_eq]
by_cases h₁w : w = z
· rwa [h₁w]
· rw [(hf _ w.2).analyticOrderAt_eq_zero.2 ((h₁t' w hw) (Subtype.coe_ne_coe.mpr h₁w))]
exact ENat.zero_ne_top
· exact ⟨isOpen_induced h₂t', h₃t'⟩
· apply isOpen_iff_forall_mem_open.mpr
intro z hz
conv =>
arg 1; intro; left; right; arg 1; intro
rw [analyticOrderAt_eq_top, eventually_nhds_iff]
simp only [mem_setOf_eq] at hz
rw [analyticOrderAt_eq_top, eventually_nhds_iff] at hz
obtain ⟨t', h₁t', h₂t', h₃t'⟩ := hz
use Subtype.val ⁻¹' t'
simp only [isOpen_induced h₂t', mem_preimage, h₃t', and_self, and_true]
intro w hw
simp only [mem_setOf_eq]
grind
/-- On a connected set, there exists a point where a meromorphic function `f` has finite order iff
`f` has finite order at every point. -/
theorem exists_analyticOrderAt_ne_top_iff_forall (hf : AnalyticOnNhd 𝕜 f U) (hU : IsConnected U) :
(∃ u : U, analyticOrderAt f u ≠ ⊤) ↔ (∀ u : U, analyticOrderAt f u ≠ ⊤) := by
have : ConnectedSpace U := Subtype.connectedSpace hU
obtain ⟨v⟩ : Nonempty U := inferInstance
suffices (∀ (u : U), analyticOrderAt f u ≠ ⊤) ∨ ∀ (u : U), analyticOrderAt f u = ⊤ by tauto
simpa [Set.eq_empty_iff_forall_notMem, Set.eq_univ_iff_forall] using
isClopen_iff.1 hf.isClopen_setOf_analyticOrderAt_eq_top
/-- On a preconnected set, a meromorphic function has finite order at one point if it has finite
order at another point. -/
theorem analyticOrderAt_ne_top_of_isPreconnected {x y : 𝕜} (hf : AnalyticOnNhd 𝕜 f U)
(hU : IsPreconnected U) (h₁x : x ∈ U) (hy : y ∈ U) (h₂x : analyticOrderAt f x ≠ ⊤) :
analyticOrderAt f y ≠ ⊤ :=
(hf.exists_analyticOrderAt_ne_top_iff_forall ⟨nonempty_of_mem h₁x, hU⟩).1 (by use ⟨x, h₁x⟩)
⟨y, hy⟩
/-- The set where an analytic function has zero or infinite order is discrete within its domain of
analyticity. -/
theorem codiscrete_setOf_analyticOrderAt_eq_zero_or_top (hf : AnalyticOnNhd 𝕜 f U) :
{u : U | analyticOrderAt f u = 0 ∨ analyticOrderAt f u = ⊤} ∈ Filter.codiscrete U := by
simp_rw [mem_codiscrete_subtype_iff_mem_codiscreteWithin, mem_codiscreteWithin,
disjoint_principal_right]
intro x hx
rcases (hf x hx).eventually_eq_zero_or_eventually_ne_zero with h₁f | h₁f
· filter_upwards [eventually_nhdsWithin_of_eventually_nhds h₁f.eventually_nhds] with a ha
simp [analyticOrderAt_eq_top, ha]
· filter_upwards [h₁f] with a ha
simp +contextual [(hf a _).analyticOrderAt_eq_zero, ha]
/--
The set where an analytic function has zero or infinite order is discrete within its domain of
analyticity.
-/
theorem codiscreteWithin_setOf_analyticOrderAt_eq_zero_or_top (hf : AnalyticOnNhd 𝕜 f U) :
{u : 𝕜 | analyticOrderAt f u = 0 ∨ analyticOrderAt f u = ⊤} ∈ codiscreteWithin U := by
simp_rw [mem_codiscreteWithin, disjoint_principal_right]
intro x hx
rcases (hf x hx).eventually_eq_zero_or_eventually_ne_zero with h₁f | h₁f
· filter_upwards [eventually_nhdsWithin_of_eventually_nhds h₁f.eventually_nhds] with a ha
simp [analyticOrderAt_eq_top, ha]
· filter_upwards [h₁f] with a ha
simp +contextual [(hf a _).analyticOrderAt_eq_zero, ha]
/--
If an analytic function `f` is not constantly zero on a connected set `U`, then its set of zeros is
codiscrete within `U`.
See `AnalyticOnNhd.preimage_mem_codiscreteWithin` for a more general statement in preimages of
codiscrete sets.
-/
theorem preimage_zero_mem_codiscreteWithin {x : 𝕜} (h₁f : AnalyticOnNhd 𝕜 f U) (h₂f : f x ≠ 0)
(hx : x ∈ U) (hU : IsConnected U) :
f ⁻¹' {0}ᶜ ∈ codiscreteWithin U := by
filter_upwards [h₁f.codiscreteWithin_setOf_analyticOrderAt_eq_zero_or_top,
self_mem_codiscreteWithin U] with a ha h₂a
rw [← (h₁f x hx).analyticOrderAt_eq_zero] at h₂f
have {u : U} : analyticOrderAt f u ≠ ⊤ := by
apply (h₁f.exists_analyticOrderAt_ne_top_iff_forall hU).1
use ⟨x, hx⟩
simp_all
simp_all [(h₁f a h₂a).analyticOrderAt_eq_zero]
/--
If an analytic function `f` is not constantly zero on `𝕜`, then its set of zeros is codiscrete.
See `AnalyticOnNhd.preimage_mem_codiscreteWithin` for a more general statement in preimages of
codiscrete sets.
-/
theorem preimage_zero_mem_codiscrete [ConnectedSpace 𝕜] {x : 𝕜} (hf : AnalyticOnNhd 𝕜 f Set.univ)
(hx : f x ≠ 0) :
f ⁻¹' {0}ᶜ ∈ codiscrete 𝕜 :=
hf.preimage_zero_mem_codiscreteWithin hx trivial isConnected_univ
end AnalyticOnNhd |
.lake/packages/mathlib/Mathlib/Analysis/Analytic/Basic.lean | import Mathlib.Analysis.Analytic.ConvergenceRadius
import Mathlib.Topology.Algebra.InfiniteSum.Module
/-!
# Analytic functions
A function is analytic in one dimension around `0` if it can be written as a converging power series
`Σ pₙ zⁿ`. This definition can be extended to any dimension (even in infinite dimension) by
requiring that `pₙ` is a continuous `n`-multilinear map. In general, `pₙ` is not unique (in two
dimensions, taking `p₂ (x, y) (x', y') = x y'` or `y x'` gives the same map when applied to a
vector `(x, y) (x, y)`). A way to guarantee uniqueness is to take a symmetric `pₙ`, but this is not
always possible in nonzero characteristic (in characteristic 2, the previous example has no
symmetric representative). Therefore, we do not insist on symmetry or uniqueness in the definition,
and we only require the existence of a converging series.
The general framework is important to say that the exponential map on bounded operators on a Banach
space is analytic, as well as the inverse on invertible operators.
## Main definitions
Let `p` be a formal multilinear series from `E` to `F`, i.e., `p n` is a multilinear map on `E^n`
for `n : ℕ`.
* `HasFPowerSeriesOnBall f p x r`: on the ball of center `x` with radius `r`,
`f (x + y) = ∑'_n pₙ yⁿ`.
* `HasFPowerSeriesAt f p x`: on some ball of center `x` with positive radius, holds
`HasFPowerSeriesOnBall f p x r`.
* `AnalyticAt 𝕜 f x`: there exists a power series `p` such that holds `HasFPowerSeriesAt f p x`.
* `AnalyticOnNhd 𝕜 f s`: the function `f` is analytic at every point of `s`.
We also define versions of `HasFPowerSeriesOnBall`, `AnalyticAt`, and `AnalyticOnNhd` restricted to
a set, similar to `ContinuousWithinAt`.
See `Mathlib/Analysis/Analytic/Within.lean` for basic properties.
* `AnalyticWithinAt 𝕜 f s x` means a power series at `x` converges to `f` on `𝓝[s ∪ {x}] x`.
* `AnalyticOn 𝕜 f s t` means `∀ x ∈ t, AnalyticWithinAt 𝕜 f s x`.
We develop the basic properties of these notions, notably:
* If a function admits a power series, it is continuous (see
`HasFPowerSeriesOnBall.continuousOn` and `HasFPowerSeriesAt.continuousAt` and
`AnalyticAt.continuousAt`).
* In a complete space, the sum of a formal power series with positive radius is well defined on the
disk of convergence, see `FormalMultilinearSeries.hasFPowerSeriesOnBall`.
-/
variable {𝕜 E F G : Type*}
variable [NontriviallyNormedField 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E]
[NormedAddCommGroup F] [NormedSpace 𝕜 F] [NormedAddCommGroup G] [NormedSpace 𝕜 G]
open Topology NNReal Filter ENNReal Set Asymptotics
open scoped Pointwise
/-! ### Expanding a function as a power series -/
section
variable {f g : E → F} {p pf : FormalMultilinearSeries 𝕜 E F} {s t : Set E} {x : E} {r r' : ℝ≥0∞}
/-- Given a function `f : E → F` and a formal multilinear series `p`, we say that `f` has `p` as
a power series on the ball of radius `r > 0` around `x` if `f (x + y) = ∑' pₙ yⁿ` for all `‖y‖ < r`.
-/
structure HasFPowerSeriesOnBall (f : E → F) (p : FormalMultilinearSeries 𝕜 E F) (x : E) (r : ℝ≥0∞) :
Prop where
r_le : r ≤ p.radius
r_pos : 0 < r
hasSum :
∀ {y}, y ∈ EMetric.ball (0 : E) r → HasSum (fun n : ℕ => p n fun _ : Fin n => y) (f (x + y))
/-- Analogue of `HasFPowerSeriesOnBall` where convergence is required only on a set `s`. We also
require convergence at `x` as the behavior of this notion is very bad otherwise. -/
structure HasFPowerSeriesWithinOnBall (f : E → F) (p : FormalMultilinearSeries 𝕜 E F) (s : Set E)
(x : E) (r : ℝ≥0∞) : Prop where
/-- `p` converges on `ball 0 r` -/
r_le : r ≤ p.radius
/-- The radius of convergence is positive -/
r_pos : 0 < r
/-- `p converges to f` within `s` -/
hasSum : ∀ {y}, x + y ∈ insert x s → y ∈ EMetric.ball (0 : E) r →
HasSum (fun n : ℕ => p n fun _ : Fin n => y) (f (x + y))
/-- Given a function `f : E → F` and a formal multilinear series `p`, we say that `f` has `p` as
a power series around `x` if `f (x + y) = ∑' pₙ yⁿ` for all `y` in a neighborhood of `0`. -/
def HasFPowerSeriesAt (f : E → F) (p : FormalMultilinearSeries 𝕜 E F) (x : E) :=
∃ r, HasFPowerSeriesOnBall f p x r
/-- Analogue of `HasFPowerSeriesAt` where convergence is required only on a set `s`. -/
def HasFPowerSeriesWithinAt (f : E → F) (p : FormalMultilinearSeries 𝕜 E F) (s : Set E) (x : E) :=
∃ r, HasFPowerSeriesWithinOnBall f p s x r
-- Teach the `bound` tactic that power series have positive radius
attribute [bound_forward] HasFPowerSeriesOnBall.r_pos HasFPowerSeriesWithinOnBall.r_pos
variable (𝕜)
/-- Given a function `f : E → F`, we say that `f` is analytic at `x` if it admits a convergent power
series expansion around `x`. -/
@[fun_prop]
def AnalyticAt (f : E → F) (x : E) :=
∃ p : FormalMultilinearSeries 𝕜 E F, HasFPowerSeriesAt f p x
/-- `f` is analytic within `s` at `x` if it has a power series at `x` that converges on `𝓝[s] x` -/
def AnalyticWithinAt (f : E → F) (s : Set E) (x : E) : Prop :=
∃ p : FormalMultilinearSeries 𝕜 E F, HasFPowerSeriesWithinAt f p s x
/-- Given a function `f : E → F`, we say that `f` is analytic on a set `s` if it is analytic around
every point of `s`. -/
def AnalyticOnNhd (f : E → F) (s : Set E) :=
∀ x, x ∈ s → AnalyticAt 𝕜 f x
/-- `f` is analytic within `s` if it is analytic within `s` at each point of `s`. Note that
this is weaker than `AnalyticOnNhd 𝕜 f s`, as `f` is allowed to be arbitrary outside `s`. -/
def AnalyticOn (f : E → F) (s : Set E) : Prop :=
∀ x ∈ s, AnalyticWithinAt 𝕜 f s x
/-!
### `HasFPowerSeriesOnBall` and `HasFPowerSeriesWithinOnBall`
-/
variable {𝕜}
theorem HasFPowerSeriesOnBall.hasFPowerSeriesAt (hf : HasFPowerSeriesOnBall f p x r) :
HasFPowerSeriesAt f p x :=
⟨r, hf⟩
theorem HasFPowerSeriesAt.analyticAt (hf : HasFPowerSeriesAt f p x) : AnalyticAt 𝕜 f x :=
⟨p, hf⟩
theorem HasFPowerSeriesOnBall.analyticAt (hf : HasFPowerSeriesOnBall f p x r) : AnalyticAt 𝕜 f x :=
hf.hasFPowerSeriesAt.analyticAt
theorem HasFPowerSeriesWithinOnBall.hasFPowerSeriesWithinAt
(hf : HasFPowerSeriesWithinOnBall f p s x r) : HasFPowerSeriesWithinAt f p s x :=
⟨r, hf⟩
theorem HasFPowerSeriesWithinAt.analyticWithinAt (hf : HasFPowerSeriesWithinAt f p s x) :
AnalyticWithinAt 𝕜 f s x := ⟨p, hf⟩
theorem HasFPowerSeriesWithinOnBall.analyticWithinAt (hf : HasFPowerSeriesWithinOnBall f p s x r) :
AnalyticWithinAt 𝕜 f s x :=
hf.hasFPowerSeriesWithinAt.analyticWithinAt
/-- If a function `f` has a power series `p` around `x`, then the function `z ↦ f (z - y)` has the
same power series around `x + y`. -/
theorem HasFPowerSeriesOnBall.comp_sub (hf : HasFPowerSeriesOnBall f p x r) (y : E) :
HasFPowerSeriesOnBall (fun z => f (z - y)) p (x + y) r :=
{ r_le := hf.r_le
r_pos := hf.r_pos
hasSum := fun {z} hz => by
convert hf.hasSum hz using 2
abel }
theorem HasFPowerSeriesWithinOnBall.comp_sub (hf : HasFPowerSeriesWithinOnBall f p s x r) (y : E) :
HasFPowerSeriesWithinOnBall (fun z ↦ f (z - y)) p (s + {y}) (x + y) r where
r_le := hf.r_le
r_pos := hf.r_pos
hasSum {z} hz1 hz2 := by
have : x + z ∈ insert x s := by
simp only [add_singleton, image_add_right, mem_insert_iff, add_eq_left, mem_preimage] at hz1 ⊢
abel_nf at hz1
assumption
convert hf.hasSum this hz2 using 2
abel
theorem HasFPowerSeriesAt.comp_sub (hf : HasFPowerSeriesAt f p x) (y : E) :
HasFPowerSeriesAt (fun z ↦ f (z - y)) p (x + y) := by
obtain ⟨r, hf⟩ := hf
exact ⟨r, hf.comp_sub _⟩
theorem HasFPowerSeriesWithinAt.comp_sub (hf : HasFPowerSeriesWithinAt f p s x) (y : E) :
HasFPowerSeriesWithinAt (fun z ↦ f (z - y)) p (s + {y}) (x + y) := by
obtain ⟨r, hf⟩ := hf
exact ⟨r, hf.comp_sub _⟩
theorem AnalyticAt.comp_sub (hf : AnalyticAt 𝕜 f x) (y : E) :
AnalyticAt 𝕜 (fun z ↦ f (z - y)) (x + y) := by
obtain ⟨p, hf⟩ := hf
exact ⟨p, hf.comp_sub _⟩
theorem AnalyticOnNhd.comp_sub (hf : AnalyticOnNhd 𝕜 f s) (y : E) :
AnalyticOnNhd 𝕜 (fun z ↦ f (z - y)) (s + {y}) := by
intro x hx
simp only [add_singleton, image_add_right, mem_preimage] at hx
rw [show x = (x - y) + y by abel]
apply (hf (x - y) (by convert hx using 1; abel)).comp_sub
theorem AnalyticWithinAt.comp_sub (hf : AnalyticWithinAt 𝕜 f s x) (y : E) :
AnalyticWithinAt 𝕜 (fun z ↦ f (z - y)) (s + {y}) (x + y) := by
obtain ⟨p, hf⟩ := hf
exact ⟨p, hf.comp_sub _⟩
theorem AnalyticOn.comp_sub (hf : AnalyticOn 𝕜 f s) (y : E) :
AnalyticOn 𝕜 (fun z ↦ f (z - y)) (s + {y}) := by
intro x hx
simp only [add_singleton, image_add_right, mem_preimage] at hx
rw [show x = (x - y) + y by abel]
apply (hf (x - y) (by convert hx using 1; abel)).comp_sub
theorem HasFPowerSeriesWithinOnBall.hasSum_sub (hf : HasFPowerSeriesWithinOnBall f p s x r) {y : E}
(hy : y ∈ (insert x s) ∩ EMetric.ball x r) :
HasSum (fun n : ℕ => p n fun _ => y - x) (f y) := by
have : y - x ∈ EMetric.ball 0 r := by simpa [edist_eq_enorm_sub] using hy.2
simpa only [add_sub_cancel] using hf.hasSum (by simpa only [add_sub_cancel] using hy.1) this
theorem HasFPowerSeriesOnBall.hasSum_sub (hf : HasFPowerSeriesOnBall f p x r) {y : E}
(hy : y ∈ EMetric.ball x r) : HasSum (fun n : ℕ => p n fun _ => y - x) (f y) := by
have : y - x ∈ EMetric.ball 0 r := by simpa [edist_eq_enorm_sub] using hy
simpa only [add_sub_cancel] using hf.hasSum this
theorem HasFPowerSeriesOnBall.radius_pos (hf : HasFPowerSeriesOnBall f p x r) : 0 < p.radius :=
lt_of_lt_of_le hf.r_pos hf.r_le
theorem HasFPowerSeriesWithinOnBall.radius_pos (hf : HasFPowerSeriesWithinOnBall f p s x r) :
0 < p.radius :=
lt_of_lt_of_le hf.r_pos hf.r_le
theorem HasFPowerSeriesAt.radius_pos (hf : HasFPowerSeriesAt f p x) : 0 < p.radius :=
let ⟨_, hr⟩ := hf
hr.radius_pos
theorem HasFPowerSeriesWithinOnBall.of_le
(hf : HasFPowerSeriesWithinOnBall f p s x r) (r'_pos : 0 < r') (hr : r' ≤ r) :
HasFPowerSeriesWithinOnBall f p s x r' :=
⟨le_trans hr hf.1, r'_pos, fun hy h'y => hf.hasSum hy (EMetric.ball_subset_ball hr h'y)⟩
theorem HasFPowerSeriesOnBall.mono (hf : HasFPowerSeriesOnBall f p x r) (r'_pos : 0 < r')
(hr : r' ≤ r) : HasFPowerSeriesOnBall f p x r' :=
⟨le_trans hr hf.1, r'_pos, fun hy => hf.hasSum (EMetric.ball_subset_ball hr hy)⟩
lemma HasFPowerSeriesWithinOnBall.congr {f g : E → F} {p : FormalMultilinearSeries 𝕜 E F}
{s : Set E} {x : E} {r : ℝ≥0∞} (h : HasFPowerSeriesWithinOnBall f p s x r)
(h' : EqOn g f (s ∩ EMetric.ball x r)) (h'' : g x = f x) :
HasFPowerSeriesWithinOnBall g p s x r := by
refine ⟨h.r_le, h.r_pos, ?_⟩
intro y hy h'y
convert h.hasSum hy h'y using 1
simp only [mem_insert_iff, add_eq_left] at hy
rcases hy with rfl | hy
· simpa using h''
· apply h'
refine ⟨hy, ?_⟩
simpa [edist_eq_enorm_sub] using h'y
/-- Variant of `HasFPowerSeriesWithinOnBall.congr` in which one requests equality on `insert x s`
instead of separating `x` and `s`. -/
lemma HasFPowerSeriesWithinOnBall.congr' {f g : E → F} {p : FormalMultilinearSeries 𝕜 E F}
{s : Set E} {x : E} {r : ℝ≥0∞} (h : HasFPowerSeriesWithinOnBall f p s x r)
(h' : EqOn g f (insert x s ∩ EMetric.ball x r)) :
HasFPowerSeriesWithinOnBall g p s x r := by
refine ⟨h.r_le, h.r_pos, fun {y} hy h'y ↦ ?_⟩
convert h.hasSum hy h'y using 1
exact h' ⟨hy, by simpa [edist_eq_enorm_sub] using h'y⟩
lemma HasFPowerSeriesWithinAt.congr {f g : E → F} {p : FormalMultilinearSeries 𝕜 E F} {s : Set E}
{x : E} (h : HasFPowerSeriesWithinAt f p s x) (h' : g =ᶠ[𝓝[s] x] f) (h'' : g x = f x) :
HasFPowerSeriesWithinAt g p s x := by
rcases h with ⟨r, hr⟩
obtain ⟨ε, εpos, hε⟩ : ∃ ε > 0, EMetric.ball x ε ∩ s ⊆ {y | g y = f y} :=
EMetric.mem_nhdsWithin_iff.1 h'
let r' := min r ε
refine ⟨r', ?_⟩
have := hr.of_le (r' := r') (by simp [r', εpos, hr.r_pos]) (min_le_left _ _)
apply this.congr _ h''
intro z hz
exact hε ⟨EMetric.ball_subset_ball (min_le_right _ _) hz.2, hz.1⟩
theorem HasFPowerSeriesOnBall.congr (hf : HasFPowerSeriesOnBall f p x r)
(hg : EqOn f g (EMetric.ball x r)) : HasFPowerSeriesOnBall g p x r :=
{ r_le := hf.r_le
r_pos := hf.r_pos
hasSum := fun {y} hy => by
convert hf.hasSum hy using 1
apply hg.symm
simpa [edist_eq_enorm_sub] using hy }
theorem HasFPowerSeriesAt.congr (hf : HasFPowerSeriesAt f p x) (hg : f =ᶠ[𝓝 x] g) :
HasFPowerSeriesAt g p x := by
rcases hf with ⟨r₁, h₁⟩
rcases EMetric.mem_nhds_iff.mp hg with ⟨r₂, h₂pos, h₂⟩
exact ⟨min r₁ r₂,
(h₁.mono (lt_min h₁.r_pos h₂pos) inf_le_left).congr
fun y hy => h₂ (EMetric.ball_subset_ball inf_le_right hy)⟩
theorem HasFPowerSeriesWithinOnBall.unique (hf : HasFPowerSeriesWithinOnBall f p s x r)
(hg : HasFPowerSeriesWithinOnBall g p s x r) :
(insert x s ∩ EMetric.ball x r).EqOn f g := fun _ hy ↦
(hf.hasSum_sub hy).unique (hg.hasSum_sub hy)
theorem HasFPowerSeriesOnBall.unique (hf : HasFPowerSeriesOnBall f p x r)
(hg : HasFPowerSeriesOnBall g p x r) : (EMetric.ball x r).EqOn f g := fun _ hy ↦
(hf.hasSum_sub hy).unique (hg.hasSum_sub hy)
protected theorem HasFPowerSeriesWithinAt.eventually (hf : HasFPowerSeriesWithinAt f p s x) :
∀ᶠ r : ℝ≥0∞ in 𝓝[>] 0, HasFPowerSeriesWithinOnBall f p s x r :=
let ⟨_, hr⟩ := hf
mem_of_superset (Ioo_mem_nhdsGT hr.r_pos) fun _ hr' => hr.of_le hr'.1 hr'.2.le
protected theorem HasFPowerSeriesAt.eventually (hf : HasFPowerSeriesAt f p x) :
∀ᶠ r : ℝ≥0∞ in 𝓝[>] 0, HasFPowerSeriesOnBall f p x r :=
let ⟨_, hr⟩ := hf
mem_of_superset (Ioo_mem_nhdsGT hr.r_pos) fun _ hr' => hr.mono hr'.1 hr'.2.le
theorem HasFPowerSeriesOnBall.eventually_hasSum (hf : HasFPowerSeriesOnBall f p x r) :
∀ᶠ y in 𝓝 0, HasSum (fun n : ℕ => p n fun _ : Fin n => y) (f (x + y)) := by
filter_upwards [EMetric.ball_mem_nhds (0 : E) hf.r_pos] using fun _ => hf.hasSum
theorem HasFPowerSeriesAt.eventually_hasSum (hf : HasFPowerSeriesAt f p x) :
∀ᶠ y in 𝓝 0, HasSum (fun n : ℕ => p n fun _ : Fin n => y) (f (x + y)) :=
let ⟨_, hr⟩ := hf
hr.eventually_hasSum
theorem HasFPowerSeriesOnBall.eventually_hasSum_sub (hf : HasFPowerSeriesOnBall f p x r) :
∀ᶠ y in 𝓝 x, HasSum (fun n : ℕ => p n fun _ : Fin n => y - x) (f y) := by
filter_upwards [EMetric.ball_mem_nhds x hf.r_pos] with y using hf.hasSum_sub
theorem HasFPowerSeriesAt.eventually_hasSum_sub (hf : HasFPowerSeriesAt f p x) :
∀ᶠ y in 𝓝 x, HasSum (fun n : ℕ => p n fun _ : Fin n => y - x) (f y) :=
let ⟨_, hr⟩ := hf
hr.eventually_hasSum_sub
theorem HasFPowerSeriesOnBall.eventually_eq_zero
(hf : HasFPowerSeriesOnBall f (0 : FormalMultilinearSeries 𝕜 E F) x r) :
∀ᶠ z in 𝓝 x, f z = 0 := by
filter_upwards [hf.eventually_hasSum_sub] with z hz using hz.unique hasSum_zero
theorem HasFPowerSeriesAt.eventually_eq_zero
(hf : HasFPowerSeriesAt f (0 : FormalMultilinearSeries 𝕜 E F) x) : ∀ᶠ z in 𝓝 x, f z = 0 :=
let ⟨_, hr⟩ := hf
hr.eventually_eq_zero
@[simp] lemma hasFPowerSeriesWithinOnBall_univ :
HasFPowerSeriesWithinOnBall f p univ x r ↔ HasFPowerSeriesOnBall f p x r := by
constructor
· intro h
refine ⟨h.r_le, h.r_pos, fun {y} m ↦ h.hasSum (by simp) m⟩
· intro h
exact ⟨h.r_le, h.r_pos, fun {y} _ m => h.hasSum m⟩
@[simp] lemma hasFPowerSeriesWithinAt_univ :
HasFPowerSeriesWithinAt f p univ x ↔ HasFPowerSeriesAt f p x := by
simp only [HasFPowerSeriesWithinAt, hasFPowerSeriesWithinOnBall_univ, HasFPowerSeriesAt]
lemma HasFPowerSeriesWithinOnBall.mono (hf : HasFPowerSeriesWithinOnBall f p s x r) (h : t ⊆ s) :
HasFPowerSeriesWithinOnBall f p t x r where
r_le := hf.r_le
r_pos := hf.r_pos
hasSum hy h'y := hf.hasSum (insert_subset_insert h hy) h'y
lemma HasFPowerSeriesOnBall.hasFPowerSeriesWithinOnBall (hf : HasFPowerSeriesOnBall f p x r) :
HasFPowerSeriesWithinOnBall f p s x r := by
rw [← hasFPowerSeriesWithinOnBall_univ] at hf
exact hf.mono (subset_univ _)
lemma HasFPowerSeriesWithinAt.mono (hf : HasFPowerSeriesWithinAt f p s x) (h : t ⊆ s) :
HasFPowerSeriesWithinAt f p t x := by
obtain ⟨r, hp⟩ := hf
exact ⟨r, hp.mono h⟩
lemma HasFPowerSeriesAt.hasFPowerSeriesWithinAt (hf : HasFPowerSeriesAt f p x) :
HasFPowerSeriesWithinAt f p s x := by
rw [← hasFPowerSeriesWithinAt_univ] at hf
apply hf.mono (subset_univ _)
theorem HasFPowerSeriesWithinAt.mono_of_mem_nhdsWithin
(h : HasFPowerSeriesWithinAt f p s x) (hst : s ∈ 𝓝[t] x) :
HasFPowerSeriesWithinAt f p t x := by
rcases h with ⟨r, hr⟩
rcases EMetric.mem_nhdsWithin_iff.1 hst with ⟨r', r'_pos, hr'⟩
refine ⟨min r r', ?_⟩
have Z := hr.of_le (by simp [r'_pos, hr.r_pos]) (min_le_left r r')
refine ⟨Z.r_le, Z.r_pos, fun {y} hy h'y ↦ ?_⟩
apply Z.hasSum ?_ h'y
simp only [mem_insert_iff, add_eq_left] at hy
rcases hy with rfl | hy
· simp
apply mem_insert_of_mem _ (hr' ?_)
simp only [EMetric.mem_ball, edist_eq_enorm_sub, sub_zero, lt_min_iff, mem_inter_iff,
add_sub_cancel_left, hy, and_true] at h'y ⊢
exact h'y.2
@[simp] lemma hasFPowerSeriesWithinOnBall_insert_self :
HasFPowerSeriesWithinOnBall f p (insert x s) x r ↔ HasFPowerSeriesWithinOnBall f p s x r := by
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩ <;>
exact ⟨h.r_le, h.r_pos, fun {y} ↦ by simpa only [insert_idem] using h.hasSum (y := y)⟩
@[simp] theorem hasFPowerSeriesWithinAt_insert {y : E} :
HasFPowerSeriesWithinAt f p (insert y s) x ↔ HasFPowerSeriesWithinAt f p s x := by
rcases eq_or_ne x y with rfl | hy
· simp [HasFPowerSeriesWithinAt]
· refine ⟨fun h ↦ h.mono (subset_insert _ _), fun h ↦ ?_⟩
apply HasFPowerSeriesWithinAt.mono_of_mem_nhdsWithin h
rw [nhdsWithin_insert_of_ne hy]
exact self_mem_nhdsWithin
theorem HasFPowerSeriesWithinOnBall.coeff_zero (hf : HasFPowerSeriesWithinOnBall f pf s x r)
(v : Fin 0 → E) : pf 0 v = f x := by
have v_eq : v = fun i => 0 := Subsingleton.elim _ _
have zero_mem : (0 : E) ∈ EMetric.ball (0 : E) r := by simp [hf.r_pos]
have : ∀ i, i ≠ 0 → (pf i fun _ => 0) = 0 := by
intro i hi
have : 0 < i := pos_iff_ne_zero.2 hi
exact ContinuousMultilinearMap.map_coord_zero _ (⟨0, this⟩ : Fin i) rfl
have A := (hf.hasSum (by simp) zero_mem).unique (hasSum_single _ this)
simpa [v_eq] using A.symm
theorem HasFPowerSeriesOnBall.coeff_zero (hf : HasFPowerSeriesOnBall f pf x r)
(v : Fin 0 → E) : pf 0 v = f x := by
rw [← hasFPowerSeriesWithinOnBall_univ] at hf
exact hf.coeff_zero v
theorem HasFPowerSeriesWithinAt.coeff_zero (hf : HasFPowerSeriesWithinAt f pf s x) (v : Fin 0 → E) :
pf 0 v = f x :=
let ⟨_, hrf⟩ := hf
hrf.coeff_zero v
theorem HasFPowerSeriesAt.coeff_zero (hf : HasFPowerSeriesAt f pf x) (v : Fin 0 → E) :
pf 0 v = f x :=
let ⟨_, hrf⟩ := hf
hrf.coeff_zero v
/-!
### Analytic functions
-/
@[simp] theorem analyticOn_empty : AnalyticOn 𝕜 f ∅ := by intro; simp
@[simp] theorem analyticOnNhd_empty : AnalyticOnNhd 𝕜 f ∅ := by intro; simp
@[simp] lemma analyticWithinAt_univ :
AnalyticWithinAt 𝕜 f univ x ↔ AnalyticAt 𝕜 f x := by
simp [AnalyticWithinAt, AnalyticAt]
@[simp] lemma analyticOn_univ {f : E → F} :
AnalyticOn 𝕜 f univ ↔ AnalyticOnNhd 𝕜 f univ := by
simp only [AnalyticOn, analyticWithinAt_univ, AnalyticOnNhd]
lemma AnalyticWithinAt.mono (hf : AnalyticWithinAt 𝕜 f s x) (h : t ⊆ s) :
AnalyticWithinAt 𝕜 f t x := by
obtain ⟨p, hp⟩ := hf
exact ⟨p, hp.mono h⟩
lemma AnalyticAt.analyticWithinAt (hf : AnalyticAt 𝕜 f x) : AnalyticWithinAt 𝕜 f s x := by
rw [← analyticWithinAt_univ] at hf
apply hf.mono (subset_univ _)
lemma AnalyticOnNhd.analyticOn (hf : AnalyticOnNhd 𝕜 f s) : AnalyticOn 𝕜 f s :=
fun x hx ↦ (hf x hx).analyticWithinAt
lemma AnalyticWithinAt.congr_of_eventuallyEq {f g : E → F} {s : Set E} {x : E}
(hf : AnalyticWithinAt 𝕜 f s x) (hs : g =ᶠ[𝓝[s] x] f) (hx : g x = f x) :
AnalyticWithinAt 𝕜 g s x := by
rcases hf with ⟨p, hp⟩
exact ⟨p, hp.congr hs hx⟩
lemma AnalyticWithinAt.congr_of_eventuallyEq_insert {f g : E → F} {s : Set E} {x : E}
(hf : AnalyticWithinAt 𝕜 f s x) (hs : g =ᶠ[𝓝[insert x s] x] f) :
AnalyticWithinAt 𝕜 g s x := by
apply hf.congr_of_eventuallyEq (nhdsWithin_mono x (subset_insert x s) hs)
apply mem_of_mem_nhdsWithin (mem_insert x s) hs
lemma AnalyticWithinAt.congr {f g : E → F} {s : Set E} {x : E}
(hf : AnalyticWithinAt 𝕜 f s x) (hs : EqOn g f s) (hx : g x = f x) :
AnalyticWithinAt 𝕜 g s x :=
hf.congr_of_eventuallyEq hs.eventuallyEq_nhdsWithin hx
lemma AnalyticOn.congr {f g : E → F} {s : Set E}
(hf : AnalyticOn 𝕜 f s) (hs : EqOn g f s) :
AnalyticOn 𝕜 g s :=
fun x m ↦ (hf x m).congr hs (hs m)
theorem AnalyticAt.congr (hf : AnalyticAt 𝕜 f x) (hg : f =ᶠ[𝓝 x] g) : AnalyticAt 𝕜 g x :=
let ⟨_, hpf⟩ := hf
(hpf.congr hg).analyticAt
theorem analyticAt_congr (h : f =ᶠ[𝓝 x] g) : AnalyticAt 𝕜 f x ↔ AnalyticAt 𝕜 g x :=
⟨fun hf ↦ hf.congr h, fun hg ↦ hg.congr h.symm⟩
theorem AnalyticOnNhd.mono {s t : Set E} (hf : AnalyticOnNhd 𝕜 f t) (hst : s ⊆ t) :
AnalyticOnNhd 𝕜 f s :=
fun z hz => hf z (hst hz)
theorem AnalyticOnNhd.congr' (hf : AnalyticOnNhd 𝕜 f s) (hg : f =ᶠ[𝓝ˢ s] g) :
AnalyticOnNhd 𝕜 g s :=
fun z hz => (hf z hz).congr (mem_nhdsSet_iff_forall.mp hg z hz)
theorem analyticOnNhd_congr' (h : f =ᶠ[𝓝ˢ s] g) : AnalyticOnNhd 𝕜 f s ↔ AnalyticOnNhd 𝕜 g s :=
⟨fun hf => hf.congr' h, fun hg => hg.congr' h.symm⟩
theorem AnalyticOnNhd.congr (hs : IsOpen s) (hf : AnalyticOnNhd 𝕜 f s) (hg : s.EqOn f g) :
AnalyticOnNhd 𝕜 g s :=
hf.congr' <| mem_nhdsSet_iff_forall.mpr
(fun _ hz => eventuallyEq_iff_exists_mem.mpr ⟨s, hs.mem_nhds hz, hg⟩)
theorem analyticOnNhd_congr (hs : IsOpen s) (h : s.EqOn f g) : AnalyticOnNhd 𝕜 f s ↔
AnalyticOnNhd 𝕜 g s := ⟨fun hf => hf.congr hs h, fun hg => hg.congr hs h.symm⟩
theorem AnalyticWithinAt.mono_of_mem_nhdsWithin
(h : AnalyticWithinAt 𝕜 f s x) (hst : s ∈ 𝓝[t] x) : AnalyticWithinAt 𝕜 f t x := by
rcases h with ⟨p, hp⟩
exact ⟨p, hp.mono_of_mem_nhdsWithin hst⟩
theorem AnalyticWithinAt.congr_set (h : AnalyticWithinAt 𝕜 f s x) (hst : s =ᶠ[𝓝 x] t) :
AnalyticWithinAt 𝕜 f t x := by
refine h.mono_of_mem_nhdsWithin ?_
simp [← nhdsWithin_eq_iff_eventuallyEq.mpr hst, self_mem_nhdsWithin]
lemma AnalyticOn.mono {f : E → F} {s t : Set E} (h : AnalyticOn 𝕜 f t)
(hs : s ⊆ t) : AnalyticOn 𝕜 f s :=
fun _ m ↦ (h _ (hs m)).mono hs
@[simp] theorem analyticWithinAt_insert {f : E → F} {s : Set E} {x y : E} :
AnalyticWithinAt 𝕜 f (insert y s) x ↔ AnalyticWithinAt 𝕜 f s x := by
simp [AnalyticWithinAt]
/-!
### Composition with linear maps
-/
/-- If a function `f` has a power series `p` on a ball within a set and `g` is linear,
then `g ∘ f` has the power series `g ∘ p` on the same ball. -/
theorem ContinuousLinearMap.comp_hasFPowerSeriesWithinOnBall (g : F →L[𝕜] G)
(h : HasFPowerSeriesWithinOnBall f p s x r) :
HasFPowerSeriesWithinOnBall (g ∘ f) (g.compFormalMultilinearSeries p) s x r where
r_le := h.r_le.trans (p.radius_le_radius_continuousLinearMap_comp _)
r_pos := h.r_pos
hasSum hy h'y := by
simpa only [ContinuousLinearMap.compFormalMultilinearSeries_apply,
ContinuousLinearMap.compContinuousMultilinearMap_coe, Function.comp_apply] using
g.hasSum (h.hasSum hy h'y)
/-- If a function `f` has a power series `p` on a ball and `g` is linear, then `g ∘ f` has the
power series `g ∘ p` on the same ball. -/
theorem ContinuousLinearMap.comp_hasFPowerSeriesOnBall (g : F →L[𝕜] G)
(h : HasFPowerSeriesOnBall f p x r) :
HasFPowerSeriesOnBall (g ∘ f) (g.compFormalMultilinearSeries p) x r := by
rw [← hasFPowerSeriesWithinOnBall_univ] at h ⊢
exact g.comp_hasFPowerSeriesWithinOnBall h
/-- If a function `f` is analytic on a set `s` and `g` is linear, then `g ∘ f` is analytic
on `s`. -/
theorem ContinuousLinearMap.comp_analyticOn (g : F →L[𝕜] G) (h : AnalyticOn 𝕜 f s) :
AnalyticOn 𝕜 (g ∘ f) s := by
rintro x hx
rcases h x hx with ⟨p, r, hp⟩
exact ⟨g.compFormalMultilinearSeries p, r, g.comp_hasFPowerSeriesWithinOnBall hp⟩
/-- If a function `f` is analytic on a set `s` and `g` is linear, then `g ∘ f` is analytic
on `s`. -/
theorem ContinuousLinearMap.comp_analyticOnNhd
{s : Set E} (g : F →L[𝕜] G) (h : AnalyticOnNhd 𝕜 f s) :
AnalyticOnNhd 𝕜 (g ∘ f) s := by
rintro x hx
rcases h x hx with ⟨p, r, hp⟩
exact ⟨g.compFormalMultilinearSeries p, r, g.comp_hasFPowerSeriesOnBall hp⟩
/-!
### Relation between analytic function and the partial sums of its power series
-/
theorem HasFPowerSeriesWithinOnBall.tendsto_partialSum
(hf : HasFPowerSeriesWithinOnBall f p s x r) {y : E} (hy : y ∈ EMetric.ball (0 : E) r)
(h'y : x + y ∈ insert x s) :
Tendsto (fun n => p.partialSum n y) atTop (𝓝 (f (x + y))) :=
(hf.hasSum h'y hy).tendsto_sum_nat
theorem HasFPowerSeriesOnBall.tendsto_partialSum
(hf : HasFPowerSeriesOnBall f p x r) {y : E} (hy : y ∈ EMetric.ball (0 : E) r) :
Tendsto (fun n => p.partialSum n y) atTop (𝓝 (f (x + y))) :=
(hf.hasSum hy).tendsto_sum_nat
theorem HasFPowerSeriesAt.tendsto_partialSum
(hf : HasFPowerSeriesAt f p x) :
∀ᶠ y in 𝓝 0, Tendsto (fun n => p.partialSum n y) atTop (𝓝 (f (x + y))) := by
rcases hf with ⟨r, hr⟩
filter_upwards [EMetric.ball_mem_nhds (0 : E) hr.r_pos] with y hy
exact hr.tendsto_partialSum hy
open Finset in
/-- If a function admits a power series expansion within a ball, then the partial sums
`p.partialSum n z` converge to `f (x + y)` as `n → ∞` and `z → y`. Note that `x + z` doesn't need
to belong to the set where the power series expansion holds. -/
theorem HasFPowerSeriesWithinOnBall.tendsto_partialSum_prod {y : E}
(hf : HasFPowerSeriesWithinOnBall f p s x r) (hy : y ∈ EMetric.ball (0 : E) r)
(h'y : x + y ∈ insert x s) :
Tendsto (fun (z : ℕ × E) ↦ p.partialSum z.1 z.2) (atTop ×ˢ 𝓝 y) (𝓝 (f (x + y))) := by
have A : Tendsto (fun (z : ℕ × E) ↦ p.partialSum z.1 y) (atTop ×ˢ 𝓝 y) (𝓝 (f (x + y))) := by
apply (hf.tendsto_partialSum hy h'y).comp tendsto_fst
suffices Tendsto (fun (z : ℕ × E) ↦ p.partialSum z.1 z.2 - p.partialSum z.1 y)
(atTop ×ˢ 𝓝 y) (𝓝 0) by simpa using A.add this
apply Metric.tendsto_nhds.2 (fun ε εpos ↦ ?_)
obtain ⟨r', yr', r'r⟩ : ∃ (r' : ℝ≥0), ‖y‖₊ < r' ∧ r' < r := by
simp at hy
simpa using ENNReal.lt_iff_exists_nnreal_btwn.1 hy
have yr'_2 : ‖y‖ < r' := by simpa [← coe_nnnorm] using yr'
have S : Summable fun n ↦ ‖p n‖ * ↑r' ^ n := p.summable_norm_mul_pow (r'r.trans_le hf.r_le)
obtain ⟨k, hk⟩ : ∃ k, ∑' (n : ℕ), ‖p (n + k)‖ * ↑r' ^ (n + k) < ε / 4 := by
have : Tendsto (fun k ↦ ∑' n, ‖p (n + k)‖ * ↑r' ^ (n + k)) atTop (𝓝 0) := by
apply _root_.tendsto_sum_nat_add (f := fun n ↦ ‖p n‖ * ↑r' ^ n)
exact ((tendsto_order.1 this).2 _ (by linarith)).exists
have A : ∀ᶠ (z : ℕ × E) in atTop ×ˢ 𝓝 y,
dist (p.partialSum k z.2) (p.partialSum k y) < ε / 4 := by
have : ContinuousAt (fun z ↦ p.partialSum k z) y := (p.partialSum_continuous k).continuousAt
exact tendsto_snd (Metric.tendsto_nhds.1 this.tendsto (ε / 4) (by linarith))
have B : ∀ᶠ (z : ℕ × E) in atTop ×ˢ 𝓝 y, ‖z.2‖₊ < r' := by
suffices ∀ᶠ (z : E) in 𝓝 y, ‖z‖₊ < r' from tendsto_snd this
have : Metric.ball 0 r' ∈ 𝓝 y := Metric.isOpen_ball.mem_nhds (by simpa using yr'_2)
filter_upwards [this] with a ha using by simpa [← coe_nnnorm] using ha
have C : ∀ᶠ (z : ℕ × E) in atTop ×ˢ 𝓝 y, k ≤ z.1 := tendsto_fst (Ici_mem_atTop _)
filter_upwards [A, B, C]
rintro ⟨n, z⟩ hz h'z hkn
simp only [dist_eq_norm, sub_zero] at hz ⊢
have I (w : E) (hw : ‖w‖₊ < r') : ‖∑ i ∈ Ico k n, p i (fun _ ↦ w)‖ ≤ ε / 4 := calc
‖∑ i ∈ Ico k n, p i (fun _ ↦ w)‖
_ = ‖∑ i ∈ range (n - k), p (i + k) (fun _ ↦ w)‖ := by
rw [sum_Ico_eq_sum_range]
congr with i
rw [add_comm k]
_ ≤ ∑ i ∈ range (n - k), ‖p (i + k) (fun _ ↦ w)‖ := norm_sum_le _ _
_ ≤ ∑ i ∈ range (n - k), ‖p (i + k)‖ * ‖w‖ ^ (i + k) := by
gcongr with i _hi; exact ((p (i + k)).le_opNorm _).trans_eq (by simp)
_ ≤ ∑ i ∈ range (n - k), ‖p (i + k)‖ * ↑r' ^ (i + k) := by
gcongr with i _hi; simpa [← coe_nnnorm] using hw.le
_ ≤ ∑' i, ‖p (i + k)‖ * ↑r' ^ (i + k) := by
apply Summable.sum_le_tsum _ (fun i _hi ↦ by positivity)
apply ((_root_.summable_nat_add_iff k).2 S)
_ ≤ ε / 4 := hk.le
calc
‖p.partialSum n z - p.partialSum n y‖
_ = ‖∑ i ∈ range n, p i (fun _ ↦ z) - ∑ i ∈ range n, p i (fun _ ↦ y)‖ := rfl
_ = ‖(∑ i ∈ range k, p i (fun _ ↦ z) + ∑ i ∈ Ico k n, p i (fun _ ↦ z))
- (∑ i ∈ range k, p i (fun _ ↦ y) + ∑ i ∈ Ico k n, p i (fun _ ↦ y))‖ := by
simp [sum_range_add_sum_Ico _ hkn]
_ = ‖(p.partialSum k z - p.partialSum k y) + (∑ i ∈ Ico k n, p i (fun _ ↦ z))
+ (- ∑ i ∈ Ico k n, p i (fun _ ↦ y))‖ := by
congr 1
simp only [FormalMultilinearSeries.partialSum]
abel
_ ≤ ‖p.partialSum k z - p.partialSum k y‖ + ‖∑ i ∈ Ico k n, p i (fun _ ↦ z)‖
+ ‖- ∑ i ∈ Ico k n, p i (fun _ ↦ y)‖ := norm_add₃_le
_ ≤ ε / 4 + ε / 4 + ε / 4 := by
gcongr
· exact I _ h'z
· simp only [norm_neg]; exact I _ yr'
_ < ε := by linarith
/-- If a function admits a power series on a ball, then the partial sums
`p.partialSum n z` converges to `f (x + y)` as `n → ∞` and `z → y`. -/
theorem HasFPowerSeriesOnBall.tendsto_partialSum_prod {y : E}
(hf : HasFPowerSeriesOnBall f p x r) (hy : y ∈ EMetric.ball (0 : E) r) :
Tendsto (fun (z : ℕ × E) ↦ p.partialSum z.1 z.2) (atTop ×ˢ 𝓝 y) (𝓝 (f (x + y))) :=
(hf.hasFPowerSeriesWithinOnBall (s := univ)).tendsto_partialSum_prod hy (by simp)
/-- If a function admits a power series expansion, then it is exponentially close to the partial
sums of this power series on strict subdisks of the disk of convergence.
This version provides an upper estimate that decreases both in `‖y‖` and `n`. See also
`HasFPowerSeriesWithinOnBall.uniform_geometric_approx` for a weaker version. -/
theorem HasFPowerSeriesWithinOnBall.uniform_geometric_approx' {r' : ℝ≥0}
(hf : HasFPowerSeriesWithinOnBall f p s x r) (h : (r' : ℝ≥0∞) < r) :
∃ a ∈ Ioo (0 : ℝ) 1, ∃ C > 0, ∀ y ∈ Metric.ball (0 : E) r', ∀ n, x + y ∈ insert x s →
‖f (x + y) - p.partialSum n y‖ ≤ C * (a * (‖y‖ / r')) ^ n := by
obtain ⟨a, ha, C, hC, hp⟩ : ∃ a ∈ Ioo (0 : ℝ) 1, ∃ C > 0, ∀ n, ‖p n‖ * (r' : ℝ) ^ n ≤ C * a ^ n :=
p.norm_mul_pow_le_mul_pow_of_lt_radius (h.trans_le hf.r_le)
refine ⟨a, ha, C / (1 - a), div_pos hC (sub_pos.2 ha.2), fun y hy n ys => ?_⟩
have yr' : ‖y‖ < r' := by
rw [ball_zero_eq] at hy
exact hy
have hr'0 : 0 < (r' : ℝ) := (norm_nonneg _).trans_lt yr'
have : y ∈ EMetric.ball (0 : E) r := by
refine mem_emetric_ball_zero_iff.2 (lt_trans ?_ h)
simpa [enorm] using yr'
rw [norm_sub_rev, ← mul_div_right_comm]
have ya : a * (‖y‖ / ↑r') ≤ a :=
mul_le_of_le_one_right ha.1.le (div_le_one_of_le₀ yr'.le r'.coe_nonneg)
suffices ‖p.partialSum n y - f (x + y)‖ ≤ C * (a * (‖y‖ / r')) ^ n / (1 - a * (‖y‖ / r')) by
refine this.trans ?_
have : 0 < a := ha.1
gcongr
apply_rules [sub_pos.2, ha.2]
apply norm_sub_le_of_geometric_bound_of_hasSum (ya.trans_lt ha.2) _ (hf.hasSum ys this)
intro n
calc
‖(p n) fun _ : Fin n => y‖
_ ≤ ‖p n‖ * ∏ _i : Fin n, ‖y‖ := ContinuousMultilinearMap.le_opNorm _ _
_ = ‖p n‖ * (r' : ℝ) ^ n * (‖y‖ / r') ^ n := by simp [field, div_pow]
_ ≤ C * a ^ n * (‖y‖ / r') ^ n := by gcongr ?_ * _; apply hp
_ ≤ C * (a * (‖y‖ / r')) ^ n := by rw [mul_pow, mul_assoc]
/-- If a function admits a power series expansion, then it is exponentially close to the partial
sums of this power series on strict subdisks of the disk of convergence.
This version provides an upper estimate that decreases both in `‖y‖` and `n`. See also
`HasFPowerSeriesOnBall.uniform_geometric_approx` for a weaker version. -/
theorem HasFPowerSeriesOnBall.uniform_geometric_approx' {r' : ℝ≥0}
(hf : HasFPowerSeriesOnBall f p x r) (h : (r' : ℝ≥0∞) < r) :
∃ a ∈ Ioo (0 : ℝ) 1, ∃ C > 0, ∀ y ∈ Metric.ball (0 : E) r', ∀ n,
‖f (x + y) - p.partialSum n y‖ ≤ C * (a * (‖y‖ / r')) ^ n := by
rw [← hasFPowerSeriesWithinOnBall_univ] at hf
simpa using hf.uniform_geometric_approx' h
/-- If a function admits a power series expansion within a set in a ball, then it is exponentially
close to the partial sums of this power series on strict subdisks of the disk of convergence. -/
theorem HasFPowerSeriesWithinOnBall.uniform_geometric_approx {r' : ℝ≥0}
(hf : HasFPowerSeriesWithinOnBall f p s x r) (h : (r' : ℝ≥0∞) < r) :
∃ a ∈ Ioo (0 : ℝ) 1,
∃ C > 0, ∀ y ∈ Metric.ball (0 : E) r', ∀ n, x + y ∈ insert x s →
‖f (x + y) - p.partialSum n y‖ ≤ C * a ^ n := by
obtain ⟨a, ha, C, hC, hp⟩ : ∃ a ∈ Ioo (0 : ℝ) 1, ∃ C > 0, ∀ y ∈ Metric.ball (0 : E) r', ∀ n,
x + y ∈ insert x s → ‖f (x + y) - p.partialSum n y‖ ≤ C * (a * (‖y‖ / r')) ^ n :=
hf.uniform_geometric_approx' h
refine ⟨a, ha, C, hC, fun y hy n ys => (hp y hy n ys).trans ?_⟩
have yr' : ‖y‖ < r' := by rwa [ball_zero_eq] at hy
have := ha.1.le -- needed to discharge a side goal on the next line
gcongr
exact mul_le_of_le_one_right ha.1.le (div_le_one_of_le₀ yr'.le r'.coe_nonneg)
/-- If a function admits a power series expansion, then it is exponentially close to the partial
sums of this power series on strict subdisks of the disk of convergence. -/
theorem HasFPowerSeriesOnBall.uniform_geometric_approx {r' : ℝ≥0}
(hf : HasFPowerSeriesOnBall f p x r) (h : (r' : ℝ≥0∞) < r) :
∃ a ∈ Ioo (0 : ℝ) 1,
∃ C > 0, ∀ y ∈ Metric.ball (0 : E) r', ∀ n,
‖f (x + y) - p.partialSum n y‖ ≤ C * a ^ n := by
rw [← hasFPowerSeriesWithinOnBall_univ] at hf
simpa using hf.uniform_geometric_approx h
/-- Taylor formula for an analytic function within a set, `IsBigO` version. -/
theorem HasFPowerSeriesWithinAt.isBigO_sub_partialSum_pow
(hf : HasFPowerSeriesWithinAt f p s x) (n : ℕ) :
(fun y : E => f (x + y) - p.partialSum n y)
=O[𝓝[(x + ·)⁻¹' insert x s] 0] fun y => ‖y‖ ^ n := by
rcases hf with ⟨r, hf⟩
rcases ENNReal.lt_iff_exists_nnreal_btwn.1 hf.r_pos with ⟨r', r'0, h⟩
obtain ⟨a, -, C, -, hp⟩ : ∃ a ∈ Ioo (0 : ℝ) 1, ∃ C > 0, ∀ y ∈ Metric.ball (0 : E) r', ∀ n,
x + y ∈ insert x s → ‖f (x + y) - p.partialSum n y‖ ≤ C * (a * (‖y‖ / r')) ^ n :=
hf.uniform_geometric_approx' h
refine isBigO_iff.2 ⟨C * (a / r') ^ n, ?_⟩
replace r'0 : 0 < (r' : ℝ) := mod_cast r'0
filter_upwards [inter_mem_nhdsWithin _ (Metric.ball_mem_nhds (0 : E) r'0)] with y hy
simpa [mul_pow, mul_div_assoc, mul_assoc, div_mul_eq_mul_div, div_pow]
using hp y hy.2 n (by simpa using hy.1)
/-- Taylor formula for an analytic function, `IsBigO` version. -/
theorem HasFPowerSeriesAt.isBigO_sub_partialSum_pow
(hf : HasFPowerSeriesAt f p x) (n : ℕ) :
(fun y : E => f (x + y) - p.partialSum n y) =O[𝓝 0] fun y => ‖y‖ ^ n := by
rw [← hasFPowerSeriesWithinAt_univ] at hf
simpa using hf.isBigO_sub_partialSum_pow n
/-- If `f` has formal power series `∑ n, pₙ` in a set, within a ball of radius `r`, then
for `y, z` in any smaller ball, the norm of the difference `f y - f z - p 1 (fun _ ↦ y - z)` is
bounded above by `C * (max ‖y - x‖ ‖z - x‖) * ‖y - z‖`. This lemma formulates this property
using `IsBigO` and `Filter.principal` on `E × E`. -/
theorem HasFPowerSeriesWithinOnBall.isBigO_image_sub_image_sub_deriv_principal
(hf : HasFPowerSeriesWithinOnBall f p s x r) (hr : r' < r) :
(fun y : E × E => f y.1 - f y.2 - p 1 fun _ => y.1 - y.2)
=O[𝓟 (EMetric.ball (x, x) r' ∩ ((insert x s) ×ˢ (insert x s)))]
fun y => ‖y - (x, x)‖ * ‖y.1 - y.2‖ := by
lift r' to ℝ≥0 using ne_top_of_lt hr
rcases (zero_le r').eq_or_lt with (rfl | hr'0)
· simp only [ENNReal.coe_zero, EMetric.ball_zero, empty_inter, principal_empty, isBigO_bot]
obtain ⟨a, ha, C, hC : 0 < C, hp⟩ :
∃ a ∈ Ioo (0 : ℝ) 1, ∃ C > 0, ∀ n : ℕ, ‖p n‖ * (r' : ℝ) ^ n ≤ C * a ^ n :=
p.norm_mul_pow_le_mul_pow_of_lt_radius (hr.trans_le hf.r_le)
simp only [← le_div_iff₀ (pow_pos (NNReal.coe_pos.2 hr'0) _)] at hp
set L : E × E → ℝ := fun y =>
C * (a / r') ^ 2 * (‖y - (x, x)‖ * ‖y.1 - y.2‖) * (a / (1 - a) ^ 2 + 2 / (1 - a))
have hL : ∀ y ∈ EMetric.ball (x, x) r' ∩ ((insert x s) ×ˢ (insert x s)),
‖f y.1 - f y.2 - p 1 fun _ => y.1 - y.2‖ ≤ L y := by
intro y ⟨hy', ys⟩
have hy : y ∈ EMetric.ball x r ×ˢ EMetric.ball x r := by
rw [EMetric.ball_prod_same]
exact EMetric.ball_subset_ball hr.le hy'
set A : ℕ → F := fun n => (p n fun _ => y.1 - x) - p n fun _ => y.2 - x
have hA : HasSum (fun n => A (n + 2)) (f y.1 - f y.2 - p 1 fun _ => y.1 - y.2) := by
convert (hasSum_nat_add_iff' 2).2
((hf.hasSum_sub ⟨ys.1, hy.1⟩).sub (hf.hasSum_sub ⟨ys.2, hy.2⟩)) using 1
rw [Finset.sum_range_succ, Finset.sum_range_one, hf.coeff_zero, hf.coeff_zero, sub_self,
zero_add, ← Subsingleton.pi_single_eq (0 : Fin 1) (y.1 - x), Pi.single,
← Subsingleton.pi_single_eq (0 : Fin 1) (y.2 - x), Pi.single, ← (p 1).map_update_sub,
← Pi.single, Subsingleton.pi_single_eq, sub_sub_sub_cancel_right]
rw [EMetric.mem_ball, edist_eq_enorm_sub, enorm_lt_coe] at hy'
set B : ℕ → ℝ := fun n => C * (a / r') ^ 2 * (‖y - (x, x)‖ * ‖y.1 - y.2‖) * ((n + 2) * a ^ n)
have hAB : ∀ n, ‖A (n + 2)‖ ≤ B n := fun n =>
calc
‖A (n + 2)‖ ≤ ‖p (n + 2)‖ * ↑(n + 2) * ‖y - (x, x)‖ ^ (n + 1) * ‖y.1 - y.2‖ := by
simpa only [Fintype.card_fin, pi_norm_const, Prod.norm_def, Pi.sub_def,
Prod.fst_sub, Prod.snd_sub, sub_sub_sub_cancel_right] using
(p <| n + 2).norm_image_sub_le (fun _ => y.1 - x) fun _ => y.2 - x
_ = ‖p (n + 2)‖ * ‖y - (x, x)‖ ^ n * (↑(n + 2) * ‖y - (x, x)‖ * ‖y.1 - y.2‖) := by
rw [pow_succ ‖y - (x, x)‖]
ring
_ ≤ C * a ^ (n + 2) / r' ^ (n + 2)
* r' ^ n * (↑(n + 2) * ‖y - (x, x)‖ * ‖y.1 - y.2‖) := by
have : 0 < a := ha.1
gcongr
· apply hp
· apply hy'.le
_ = B n := by
simp [field, B, pow_succ]
have hBL : HasSum B (L y) := by
apply HasSum.mul_left
simp only [add_mul]
have : ‖a‖ < 1 := by simp only [Real.norm_eq_abs, abs_of_pos ha.1, ha.2]
rw [div_eq_mul_inv, div_eq_mul_inv]
exact (hasSum_coe_mul_geometric_of_norm_lt_one this).add
((hasSum_geometric_of_norm_lt_one this).mul_left 2)
exact hA.norm_le_of_bounded hBL hAB
suffices L =O[𝓟 (EMetric.ball (x, x) r' ∩ ((insert x s) ×ˢ (insert x s)))]
fun y => ‖y - (x, x)‖ * ‖y.1 - y.2‖ from
.trans (.of_norm_eventuallyLE (eventually_principal.2 hL)) this
simp_rw [L, mul_right_comm _ (_ * _)]
exact (isBigO_refl _ _).const_mul_left _
/-- If `f` has formal power series `∑ n, pₙ` on a ball of radius `r`, then for `y, z` in any smaller
ball, the norm of the difference `f y - f z - p 1 (fun _ ↦ y - z)` is bounded above by
`C * (max ‖y - x‖ ‖z - x‖) * ‖y - z‖`. This lemma formulates this property using `IsBigO` and
`Filter.principal` on `E × E`. -/
theorem HasFPowerSeriesOnBall.isBigO_image_sub_image_sub_deriv_principal
(hf : HasFPowerSeriesOnBall f p x r) (hr : r' < r) :
(fun y : E × E => f y.1 - f y.2 - p 1 fun _ => y.1 - y.2)
=O[𝓟 (EMetric.ball (x, x) r')] fun y => ‖y - (x, x)‖ * ‖y.1 - y.2‖ := by
rw [← hasFPowerSeriesWithinOnBall_univ] at hf
simpa using hf.isBigO_image_sub_image_sub_deriv_principal hr
/-- If `f` has formal power series `∑ n, pₙ` within a set, on a ball of radius `r`, then for `y, z`
in any smaller ball, the norm of the difference `f y - f z - p 1 (fun _ ↦ y - z)` is bounded above
by `C * (max ‖y - x‖ ‖z - x‖) * ‖y - z‖`. -/
theorem HasFPowerSeriesWithinOnBall.image_sub_sub_deriv_le
(hf : HasFPowerSeriesWithinOnBall f p s x r) (hr : r' < r) :
∃ C, ∀ᵉ (y ∈ insert x s ∩ EMetric.ball x r') (z ∈ insert x s ∩ EMetric.ball x r'),
‖f y - f z - p 1 fun _ => y - z‖ ≤ C * max ‖y - x‖ ‖z - x‖ * ‖y - z‖ := by
have := hf.isBigO_image_sub_image_sub_deriv_principal hr
simp only [isBigO_principal, mem_inter_iff, EMetric.mem_ball, Prod.edist_eq, max_lt_iff, mem_prod,
norm_mul, Real.norm_eq_abs, abs_norm, and_imp, Prod.forall, mul_assoc] at this ⊢
rcases this with ⟨C, hC⟩
exact ⟨C, fun y ys hy z zs hz ↦ hC y z hy hz ys zs⟩
/-- If `f` has formal power series `∑ n, pₙ` on a ball of radius `r`, then for `y, z` in any smaller
ball, the norm of the difference `f y - f z - p 1 (fun _ ↦ y - z)` is bounded above by
`C * (max ‖y - x‖ ‖z - x‖) * ‖y - z‖`. -/
theorem HasFPowerSeriesOnBall.image_sub_sub_deriv_le
(hf : HasFPowerSeriesOnBall f p x r) (hr : r' < r) :
∃ C, ∀ᵉ (y ∈ EMetric.ball x r') (z ∈ EMetric.ball x r'),
‖f y - f z - p 1 fun _ => y - z‖ ≤ C * max ‖y - x‖ ‖z - x‖ * ‖y - z‖ := by
rw [← hasFPowerSeriesWithinOnBall_univ] at hf
simpa only [mem_univ, insert_eq_of_mem, univ_inter] using hf.image_sub_sub_deriv_le hr
/-- If `f` has formal power series `∑ n, pₙ` at `x` within a set `s`, then
`f y - f z - p 1 (fun _ ↦ y - z) = O(‖(y, z) - (x, x)‖ * ‖y - z‖)` as `(y, z) → (x, x)`
within `s × s`. -/
theorem HasFPowerSeriesWithinAt.isBigO_image_sub_norm_mul_norm_sub
(hf : HasFPowerSeriesWithinAt f p s x) :
(fun y : E × E => f y.1 - f y.2 - p 1 fun _ => y.1 - y.2)
=O[𝓝[(insert x s) ×ˢ (insert x s)] (x, x)] fun y => ‖y - (x, x)‖ * ‖y.1 - y.2‖ := by
rcases hf with ⟨r, hf⟩
rcases ENNReal.lt_iff_exists_nnreal_btwn.1 hf.r_pos with ⟨r', r'0, h⟩
refine (hf.isBigO_image_sub_image_sub_deriv_principal h).mono ?_
rw [inter_comm]
exact le_principal_iff.2 (inter_mem_nhdsWithin _ (EMetric.ball_mem_nhds _ r'0))
/-- If `f` has formal power series `∑ n, pₙ` at `x`, then
`f y - f z - p 1 (fun _ ↦ y - z) = O(‖(y, z) - (x, x)‖ * ‖y - z‖)` as `(y, z) → (x, x)`.
In particular, `f` is strictly differentiable at `x`. -/
theorem HasFPowerSeriesAt.isBigO_image_sub_norm_mul_norm_sub (hf : HasFPowerSeriesAt f p x) :
(fun y : E × E => f y.1 - f y.2 - p 1 fun _ => y.1 - y.2) =O[𝓝 (x, x)] fun y =>
‖y - (x, x)‖ * ‖y.1 - y.2‖ := by
rw [← hasFPowerSeriesWithinAt_univ] at hf
simpa using hf.isBigO_image_sub_norm_mul_norm_sub
/-- If a function admits a power series expansion within a set at `x`, then it is the uniform limit
of the partial sums of this power series on strict subdisks of the disk of convergence, i.e.,
`f (x + y)` is the uniform limit of `p.partialSum n y` there. -/
theorem HasFPowerSeriesWithinOnBall.tendstoUniformlyOn {r' : ℝ≥0}
(hf : HasFPowerSeriesWithinOnBall f p s x r) (h : (r' : ℝ≥0∞) < r) :
TendstoUniformlyOn (fun n y => p.partialSum n y) (fun y => f (x + y)) atTop
((x + ·)⁻¹' (insert x s) ∩ Metric.ball (0 : E) r') := by
obtain ⟨a, ha, C, -, hp⟩ : ∃ a ∈ Ioo (0 : ℝ) 1, ∃ C > 0, ∀ y ∈ Metric.ball (0 : E) r', ∀ n,
x + y ∈ insert x s → ‖f (x + y) - p.partialSum n y‖ ≤ C * a ^ n := hf.uniform_geometric_approx h
refine Metric.tendstoUniformlyOn_iff.2 fun ε εpos => ?_
have L : Tendsto (fun n => (C : ℝ) * a ^ n) atTop (𝓝 ((C : ℝ) * 0)) :=
tendsto_const_nhds.mul (tendsto_pow_atTop_nhds_zero_of_lt_one ha.1.le ha.2)
rw [mul_zero] at L
refine (L.eventually (gt_mem_nhds εpos)).mono fun n hn y hy => ?_
rw [dist_eq_norm]
exact (hp y hy.2 n hy.1).trans_lt hn
/-- If a function admits a power series expansion at `x`, then it is the uniform limit of the
partial sums of this power series on strict subdisks of the disk of convergence, i.e., `f (x + y)`
is the uniform limit of `p.partialSum n y` there. -/
theorem HasFPowerSeriesOnBall.tendstoUniformlyOn {r' : ℝ≥0} (hf : HasFPowerSeriesOnBall f p x r)
(h : (r' : ℝ≥0∞) < r) :
TendstoUniformlyOn (fun n y => p.partialSum n y) (fun y => f (x + y)) atTop
(Metric.ball (0 : E) r') := by
rw [← hasFPowerSeriesWithinOnBall_univ] at hf
simpa using hf.tendstoUniformlyOn h
/-- If a function admits a power series expansion within a set at `x`, then it is the locally
uniform limit of the partial sums of this power series on the disk of convergence, i.e., `f (x + y)`
is the locally uniform limit of `p.partialSum n y` there. -/
theorem HasFPowerSeriesWithinOnBall.tendstoLocallyUniformlyOn
(hf : HasFPowerSeriesWithinOnBall f p s x r) :
TendstoLocallyUniformlyOn (fun n y => p.partialSum n y) (fun y => f (x + y)) atTop
((x + ·)⁻¹' (insert x s) ∩ EMetric.ball (0 : E) r) := by
intro u hu y hy
rcases ENNReal.lt_iff_exists_nnreal_btwn.1 hy.2 with ⟨r', yr', hr'⟩
have : EMetric.ball (0 : E) r' ∈ 𝓝 y := IsOpen.mem_nhds EMetric.isOpen_ball yr'
refine ⟨(x + ·)⁻¹' (insert x s) ∩ EMetric.ball (0 : E) r', ?_, ?_⟩
· rw [nhdsWithin_inter_of_mem']
· exact inter_mem_nhdsWithin _ this
· apply mem_nhdsWithin_of_mem_nhds
apply Filter.mem_of_superset this (EMetric.ball_subset_ball hr'.le)
· simpa [Metric.emetric_ball_nnreal] using hf.tendstoUniformlyOn hr' u hu
/-- If a function admits a power series expansion at `x`, then it is the locally uniform limit of
the partial sums of this power series on the disk of convergence, i.e., `f (x + y)`
is the locally uniform limit of `p.partialSum n y` there. -/
theorem HasFPowerSeriesOnBall.tendstoLocallyUniformlyOn (hf : HasFPowerSeriesOnBall f p x r) :
TendstoLocallyUniformlyOn (fun n y => p.partialSum n y) (fun y => f (x + y)) atTop
(EMetric.ball (0 : E) r) := by
rw [← hasFPowerSeriesWithinOnBall_univ] at hf
simpa using hf.tendstoLocallyUniformlyOn
/-- If a function admits a power series expansion within a set at `x`, then it is the uniform limit
of the partial sums of this power series on strict subdisks of the disk of convergence, i.e., `f y`
is the uniform limit of `p.partialSum n (y - x)` there. -/
theorem HasFPowerSeriesWithinOnBall.tendstoUniformlyOn' {r' : ℝ≥0}
(hf : HasFPowerSeriesWithinOnBall f p s x r) (h : (r' : ℝ≥0∞) < r) :
TendstoUniformlyOn (fun n y => p.partialSum n (y - x)) f atTop
(insert x s ∩ Metric.ball (x : E) r') := by
convert (hf.tendstoUniformlyOn h).comp fun y => y - x using 1
· simp [Function.comp_def]
· ext z
simp [dist_eq_norm]
/-- If a function admits a power series expansion at `x`, then it is the uniform limit of the
partial sums of this power series on strict subdisks of the disk of convergence, i.e., `f y`
is the uniform limit of `p.partialSum n (y - x)` there. -/
theorem HasFPowerSeriesOnBall.tendstoUniformlyOn' {r' : ℝ≥0} (hf : HasFPowerSeriesOnBall f p x r)
(h : (r' : ℝ≥0∞) < r) :
TendstoUniformlyOn (fun n y => p.partialSum n (y - x)) f atTop (Metric.ball (x : E) r') := by
rw [← hasFPowerSeriesWithinOnBall_univ] at hf
simpa using hf.tendstoUniformlyOn' h
/-- If a function admits a power series expansion within a set at `x`, then it is the locally
uniform limit of the partial sums of this power series on the disk of convergence, i.e., `f y`
is the locally uniform limit of `p.partialSum n (y - x)` there. -/
theorem HasFPowerSeriesWithinOnBall.tendstoLocallyUniformlyOn'
(hf : HasFPowerSeriesWithinOnBall f p s x r) :
TendstoLocallyUniformlyOn (fun n y => p.partialSum n (y - x)) f atTop
(insert x s ∩ EMetric.ball (x : E) r) := by
have A : ContinuousOn (fun y : E => y - x) (insert x s ∩ EMetric.ball (x : E) r) :=
(continuous_id.sub continuous_const).continuousOn
convert hf.tendstoLocallyUniformlyOn.comp (fun y : E => y - x) _ A using 1
· ext z
simp
· intro z
simp [edist_eq_enorm_sub]
/-- If a function admits a power series expansion at `x`, then it is the locally uniform limit of
the partial sums of this power series on the disk of convergence, i.e., `f y`
is the locally uniform limit of `p.partialSum n (y - x)` there. -/
theorem HasFPowerSeriesOnBall.tendstoLocallyUniformlyOn' (hf : HasFPowerSeriesOnBall f p x r) :
TendstoLocallyUniformlyOn (fun n y => p.partialSum n (y - x)) f atTop
(EMetric.ball (x : E) r) := by
rw [← hasFPowerSeriesWithinOnBall_univ] at hf
simpa using hf.tendstoLocallyUniformlyOn'
/-- If a function admits a power series expansion within a set on a ball, then it is
continuous there. -/
protected theorem HasFPowerSeriesWithinOnBall.continuousOn
(hf : HasFPowerSeriesWithinOnBall f p s x r) :
ContinuousOn f (insert x s ∩ EMetric.ball x r) :=
hf.tendstoLocallyUniformlyOn'.continuousOn <|
Eventually.of_forall fun n =>
((p.partialSum_continuous n).comp (continuous_id.sub continuous_const)).continuousOn
/-- If a function admits a power series expansion on a ball, then it is continuous there. -/
protected theorem HasFPowerSeriesOnBall.continuousOn (hf : HasFPowerSeriesOnBall f p x r) :
ContinuousOn f (EMetric.ball x r) := by
rw [← hasFPowerSeriesWithinOnBall_univ] at hf
simpa using hf.continuousOn
protected theorem HasFPowerSeriesWithinOnBall.continuousWithinAt_insert
(hf : HasFPowerSeriesWithinOnBall f p s x r) :
ContinuousWithinAt f (insert x s) x := by
apply (hf.continuousOn.continuousWithinAt (x := x) (by simp [hf.r_pos])).mono_of_mem_nhdsWithin
exact inter_mem_nhdsWithin _ (EMetric.ball_mem_nhds x hf.r_pos)
protected theorem HasFPowerSeriesWithinOnBall.continuousWithinAt
(hf : HasFPowerSeriesWithinOnBall f p s x r) :
ContinuousWithinAt f s x :=
hf.continuousWithinAt_insert.mono (subset_insert x s)
protected theorem HasFPowerSeriesWithinAt.continuousWithinAt_insert
(hf : HasFPowerSeriesWithinAt f p s x) :
ContinuousWithinAt f (insert x s) x := by
rcases hf with ⟨r, hr⟩
apply hr.continuousWithinAt_insert
protected theorem HasFPowerSeriesWithinAt.continuousWithinAt
(hf : HasFPowerSeriesWithinAt f p s x) :
ContinuousWithinAt f s x :=
hf.continuousWithinAt_insert.mono (subset_insert x s)
protected theorem HasFPowerSeriesAt.continuousAt (hf : HasFPowerSeriesAt f p x) :
ContinuousAt f x :=
let ⟨_, hr⟩ := hf
hr.continuousOn.continuousAt (EMetric.ball_mem_nhds x hr.r_pos)
protected theorem AnalyticWithinAt.continuousWithinAt_insert (hf : AnalyticWithinAt 𝕜 f s x) :
ContinuousWithinAt f (insert x s) x :=
let ⟨_, hp⟩ := hf
hp.continuousWithinAt_insert
protected theorem AnalyticWithinAt.continuousWithinAt (hf : AnalyticWithinAt 𝕜 f s x) :
ContinuousWithinAt f s x :=
hf.continuousWithinAt_insert.mono (subset_insert x s)
@[fun_prop]
protected theorem AnalyticAt.continuousAt (hf : AnalyticAt 𝕜 f x) : ContinuousAt f x :=
let ⟨_, hp⟩ := hf
hp.continuousAt
protected theorem AnalyticAt.eventually_continuousAt (hf : AnalyticAt 𝕜 f x) :
∀ᶠ y in 𝓝 x, ContinuousAt f y := by
rcases hf with ⟨g, r, hg⟩
have : EMetric.ball x r ∈ 𝓝 x := EMetric.ball_mem_nhds _ hg.r_pos
filter_upwards [this] with y hy
apply hg.continuousOn.continuousAt
exact EMetric.isOpen_ball.mem_nhds hy
protected theorem AnalyticOnNhd.continuousOn {s : Set E} (hf : AnalyticOnNhd 𝕜 f s) :
ContinuousOn f s :=
fun x hx => (hf x hx).continuousAt.continuousWithinAt
protected lemma AnalyticOn.continuousOn {f : E → F} {s : Set E} (h : AnalyticOn 𝕜 f s) :
ContinuousOn f s :=
fun x m ↦ (h x m).continuousWithinAt
/-- Analytic everywhere implies continuous -/
theorem AnalyticOnNhd.continuous {f : E → F} (fa : AnalyticOnNhd 𝕜 f univ) : Continuous f := by
rw [← continuousOn_univ]; exact fa.continuousOn
/-- In a complete space, the sum of a converging power series `p` admits `p` as a power series.
This is not totally obvious as we need to check the convergence of the series. -/
protected theorem FormalMultilinearSeries.hasFPowerSeriesOnBall [CompleteSpace F]
(p : FormalMultilinearSeries 𝕜 E F) (h : 0 < p.radius) :
HasFPowerSeriesOnBall p.sum p 0 p.radius :=
{ r_le := le_rfl
r_pos := h
hasSum := fun hy => by
rw [zero_add]
exact p.hasSum hy }
theorem HasFPowerSeriesWithinOnBall.sum (h : HasFPowerSeriesWithinOnBall f p s x r) {y : E}
(h'y : x + y ∈ insert x s) (hy : y ∈ EMetric.ball (0 : E) r) : f (x + y) = p.sum y :=
(h.hasSum h'y hy).tsum_eq.symm
theorem HasFPowerSeriesOnBall.sum (h : HasFPowerSeriesOnBall f p x r) {y : E}
(hy : y ∈ EMetric.ball (0 : E) r) : f (x + y) = p.sum y :=
(h.hasSum hy).tsum_eq.symm
/-- The sum of a converging power series is continuous in its disk of convergence. -/
protected theorem FormalMultilinearSeries.continuousOn [CompleteSpace F] :
ContinuousOn p.sum (EMetric.ball 0 p.radius) := by
rcases (zero_le p.radius).eq_or_lt with h | h
· simp [← h, continuousOn_empty]
· exact (p.hasFPowerSeriesOnBall h).continuousOn
end
section
open FormalMultilinearSeries
variable {p : FormalMultilinearSeries 𝕜 𝕜 E} {f : 𝕜 → E} {z₀ : 𝕜}
/-- A function `f : 𝕜 → E` has `p` as power series expansion at a point `z₀` iff it is the sum of
`p` in a neighborhood of `z₀`. This makes some proofs easier by hiding the fact that
`HasFPowerSeriesAt` depends on `p.radius`. -/
theorem hasFPowerSeriesAt_iff :
HasFPowerSeriesAt f p z₀ ↔ ∀ᶠ z in 𝓝 0, HasSum (fun n => z ^ n • p.coeff n) (f (z₀ + z)) := by
refine ⟨fun ⟨r, _, r_pos, h⟩ =>
eventually_of_mem (EMetric.ball_mem_nhds 0 r_pos) fun _ => by simpa using h, ?_⟩
simp only [Metric.eventually_nhds_iff]
rintro ⟨r, r_pos, h⟩
refine ⟨p.radius ⊓ r.toNNReal, by simp, ?_, ?_⟩
· simp only [r_pos.lt, lt_inf_iff, ENNReal.coe_pos, Real.toNNReal_pos, and_true]
obtain ⟨z, z_pos, le_z⟩ := NormedField.exists_norm_lt 𝕜 r_pos.lt
have : (‖z‖₊ : ENNReal) ≤ p.radius := by
simp only [dist_zero_right] at h
apply FormalMultilinearSeries.le_radius_of_tendsto
convert tendsto_norm.comp (h le_z).summable.tendsto_atTop_zero
simp [norm_smul, mul_comm]
refine lt_of_lt_of_le ?_ this
simp only [ENNReal.coe_pos]
exact zero_lt_iff.mpr (nnnorm_ne_zero_iff.mpr (norm_pos_iff.mp z_pos))
· simp only [EMetric.mem_ball, lt_inf_iff, edist_lt_coe, apply_eq_pow_smul_coeff, and_imp,
dist_zero_right] at h ⊢
refine fun {y} _ hyr => h ?_
simpa [nndist_eq_nnnorm, Real.lt_toNNReal_iff_coe_lt] using hyr
theorem hasFPowerSeriesAt_iff' :
HasFPowerSeriesAt f p z₀ ↔ ∀ᶠ z in 𝓝 z₀, HasSum (fun n => (z - z₀) ^ n • p.coeff n) (f z) := by
rw [← map_add_left_nhds_zero, eventually_map, hasFPowerSeriesAt_iff]
simp_rw [add_sub_cancel_left]
end |
.lake/packages/mathlib/Mathlib/Analysis/Analytic/IteratedFDeriv.lean | import Mathlib.Analysis.Calculus.ContDiff.Operations
import Mathlib.Analysis.Calculus.ContDiff.CPolynomial
import Mathlib.Data.Fintype.Perm
/-!
# The iterated derivative of an analytic function
If a function is analytic, written as `f (x + y) = ∑ pₙ (y, ..., y)` then its `n`-th iterated
derivative at `x` is given by `(v₁, ..., vₙ) ↦ ∑ pₙ (v_{σ (1)}, ..., v_{σ (n)})` where the sum
is over all permutations of `{1, ..., n}`. In particular, it is symmetric.
This generalizes the result of `HasFPowerSeriesOnBall.factorial_smul` giving
`D^n f (v, ..., v) = n! * pₙ (v, ..., v)`.
## Main result
* `HasFPowerSeriesOnBall.iteratedFDeriv_eq_sum` shows that
`iteratedFDeriv 𝕜 n f x v = ∑ σ : Perm (Fin n), p n (fun i ↦ v (σ i))`,
when `f` has `p` as power series within the set `s` on the ball `B (x, r)`.
* `ContDiffAt.iteratedFDeriv_comp_perm` proves the symmetry of the iterated derivative of an
analytic function, in the form `iteratedFDeriv 𝕜 n f x (v ∘ σ) = iteratedFDeriv 𝕜 n f x v`
for any permutation `σ` of `Fin n`.
Versions within sets are also given.
## Implementation
To prove the formula for the iterated derivative, we decompose an analytic function as
the sum of `fun y ↦ pₙ (y, ..., y)` and the rest. For the former, its iterated derivative follows
from the formula for iterated derivatives of multilinear maps
(see `ContinuousMultilinearMap.iteratedFDeriv_comp_diagonal`). For the latter, we show by
induction on `n` that if the `n`-th term in a power series is zero, then the `n`-th iterated
derivative vanishes (see `HasFPowerSeriesWithinOnBall.iteratedFDerivWithin_eq_zero`).
All these results are proved assuming additionally that the function is analytic on the relevant
set (which does not follow from the fact that the function has a power series, if the target space
is not complete). This makes it possible to avoid all completeness assumptions in the final
statements. When needed, we give versions of some statements assuming completeness and dropping
analyticity, for ease of use.
-/
open scoped ENNReal Topology ContDiff
open Equiv Set
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜]
{E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E]
{F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
{f : E → F} {p : FormalMultilinearSeries 𝕜 E F} {s : Set E} {x : E} {r : ℝ≥0∞}
/-- Formal multilinear series associated to the iterated derivative, defined by iterating
`p ↦ p.derivSeries` and currying suitably. It is defined so that, if a function has `p` as a power
series, then its iterated derivative of order `k` has `p.iteratedFDerivSeries k` as a power
series. -/
noncomputable def FormalMultilinearSeries.iteratedFDerivSeries
(p : FormalMultilinearSeries 𝕜 E F) (k : ℕ) :
FormalMultilinearSeries 𝕜 E (E [×k]→L[𝕜] F) :=
match k with
| 0 => (continuousMultilinearCurryFin0 𝕜 E F).symm
|>.toContinuousLinearEquiv.toContinuousLinearMap.compFormalMultilinearSeries p
| (k + 1) => (continuousMultilinearCurryLeftEquiv 𝕜 (fun _ : Fin (k + 1) ↦ E) F).symm
|>.toContinuousLinearEquiv.toContinuousLinearMap.compFormalMultilinearSeries
(p.iteratedFDerivSeries k).derivSeries
/-- If a function has a power series on a ball, then so do its iterated derivatives. -/
protected theorem HasFPowerSeriesWithinOnBall.iteratedFDerivWithin
(h : HasFPowerSeriesWithinOnBall f p s x r) (h' : AnalyticOn 𝕜 f s)
(k : ℕ) (hs : UniqueDiffOn 𝕜 s) (hx : x ∈ s) :
HasFPowerSeriesWithinOnBall (iteratedFDerivWithin 𝕜 k f s)
(p.iteratedFDerivSeries k) s x r := by
induction k with
| zero =>
exact (continuousMultilinearCurryFin0 𝕜 E F).symm
|>.toContinuousLinearEquiv.toContinuousLinearMap.comp_hasFPowerSeriesWithinOnBall h
| succ k ih =>
rw [iteratedFDerivWithin_succ_eq_comp_left]
apply (continuousMultilinearCurryLeftEquiv 𝕜 (fun _ : Fin (k + 1) ↦ E) F).symm
|>.toContinuousLinearEquiv.toContinuousLinearMap.comp_hasFPowerSeriesWithinOnBall
(ih.fderivWithin_of_mem_of_analyticOn (h'.iteratedFDerivWithin hs _) hs hx)
lemma FormalMultilinearSeries.iteratedFDerivSeries_eq_zero {k n : ℕ}
(h : p (n + k) = 0) : p.iteratedFDerivSeries k n = 0 := by
induction k generalizing n with
| zero =>
ext
have : p n = 0 := p.congr_zero rfl h
simp [FormalMultilinearSeries.iteratedFDerivSeries, this]
| succ k ih =>
ext
simp only [iteratedFDerivSeries, Nat.succ_eq_add_one,
ContinuousLinearMap.compFormalMultilinearSeries_apply,
ContinuousLinearMap.compContinuousMultilinearMap_coe, ContinuousLinearEquiv.coe_coe,
LinearIsometryEquiv.coe_toContinuousLinearEquiv, Function.comp_apply,
continuousMultilinearCurryLeftEquiv_symm_apply, ContinuousMultilinearMap.zero_apply,
ContinuousLinearMap.zero_apply,
derivSeries_eq_zero _ (ih (p.congr_zero (Nat.succ_add_eq_add_succ _ _).symm h))]
/-- If the `n`-th term in a power series is zero, then the `n`-th derivative of the corresponding
function vanishes. -/
lemma HasFPowerSeriesWithinOnBall.iteratedFDerivWithin_eq_zero
(h : HasFPowerSeriesWithinOnBall f p s x r) (h' : AnalyticOn 𝕜 f s)
(hu : UniqueDiffOn 𝕜 s) (hx : x ∈ s) {n : ℕ} (hn : p n = 0) :
iteratedFDerivWithin 𝕜 n f s x = 0 := by
have : iteratedFDerivWithin 𝕜 n f s x = p.iteratedFDerivSeries n 0 (fun _ ↦ 0) :=
((h.iteratedFDerivWithin h' n hu hx).coeff_zero _).symm
rw [this, p.iteratedFDerivSeries_eq_zero (p.congr_zero (Nat.zero_add n).symm hn),
ContinuousMultilinearMap.zero_apply]
lemma ContinuousMultilinearMap.iteratedFDeriv_comp_diagonal
{n : ℕ} (f : E [×n]→L[𝕜] F) (x : E) (v : Fin n → E) :
iteratedFDeriv 𝕜 n (fun x ↦ f (fun _ ↦ x)) x v = ∑ σ : Perm (Fin n), f (fun i ↦ v (σ i)) := by
rw [← sum_comp (Equiv.inv (Perm (Fin n)))]
let g : E →L[𝕜] (Fin n → E) := ContinuousLinearMap.pi (fun i ↦ ContinuousLinearMap.id 𝕜 E)
change iteratedFDeriv 𝕜 n (f ∘ g) x v = _
rw [ContinuousLinearMap.iteratedFDeriv_comp_right _ f.contDiff _ le_rfl, f.iteratedFDeriv_eq]
simp only [ContinuousMultilinearMap.iteratedFDeriv,
ContinuousMultilinearMap.compContinuousLinearMap_apply, ContinuousMultilinearMap.sum_apply,
ContinuousMultilinearMap.iteratedFDerivComponent_apply, Set.mem_range, Pi.compRightL_apply]
rw [← sum_comp (Equiv.embeddingEquivOfFinite (Fin n))]
congr with σ
congr with i
have A : ∃ y, σ y = i := by
have : Function.Bijective σ := (Fintype.bijective_iff_injective_and_card _).2 ⟨σ.injective, rfl⟩
exact this.surjective i
rcases A with ⟨y, rfl⟩
simp only [EmbeddingLike.apply_eq_iff_eq, exists_eq, ↓reduceDIte,
Function.Embedding.toEquivRange_symm_apply_self, ContinuousLinearMap.coe_pi',
ContinuousLinearMap.coe_id', id_eq, g]
congr 1
symm
simp [inv_apply, Perm.inv_def,
ofBijective_symm_apply_apply, Function.Embedding.equivOfFiniteSelfEmbedding]
private lemma HasFPowerSeriesWithinOnBall.iteratedFDerivWithin_eq_sum_of_subset
(h : HasFPowerSeriesWithinOnBall f p s x r) (h' : AnalyticOn 𝕜 f s)
(hs : UniqueDiffOn 𝕜 s) (hx : x ∈ s)
{n : ℕ} (v : Fin n → E) (h's : s ⊆ EMetric.ball x r) :
iteratedFDerivWithin 𝕜 n f s x v = ∑ σ : Perm (Fin n), p n (fun i ↦ v (σ i)) := by
have I : insert x s ∩ EMetric.ball x r = s := by
rw [Set.insert_eq_of_mem hx]
exact Set.inter_eq_left.2 h's
have fcont : ContDiffOn 𝕜 (↑n) f s := by
apply AnalyticOn.contDiffOn _ hs
simpa [I] using h'
let g : E → F := fun z ↦ p n (fun _ ↦ z - x)
have gcont : ContDiff 𝕜 ω g := by
apply (p n).contDiff.comp
exact contDiff_pi.2 (fun i ↦ contDiff_id.sub contDiff_const)
let q : FormalMultilinearSeries 𝕜 E F := fun k ↦ if h : n = k then (h ▸ p n) else 0
have A : HasFiniteFPowerSeriesOnBall g q x (n + 1) r := by
apply HasFiniteFPowerSeriesOnBall.mk' _ h.r_pos
· intro y hy
rw [Finset.sum_eq_single_of_mem n]
· simp [q, g]
· simp
· intro i hi h'i
simp [q, h'i.symm]
· intro m hm
have : n ≠ m := by omega
simp [q, this]
have B : HasFPowerSeriesWithinOnBall g q s x r :=
A.toHasFPowerSeriesOnBall.hasFPowerSeriesWithinOnBall
have J1 : iteratedFDerivWithin 𝕜 n f s x =
iteratedFDerivWithin 𝕜 n g s x + iteratedFDerivWithin 𝕜 n (f - g) s x := by
have : f = g + (f - g) := by abel
nth_rewrite 1 [this]
rw [iteratedFDerivWithin_add_apply (gcont.of_le le_top).contDiffWithinAt
(by exact (fcont _ hx).sub (gcont.of_le le_top).contDiffWithinAt) hs hx]
have J2 : iteratedFDerivWithin 𝕜 n (f - g) s x = 0 := by
apply (h.sub B).iteratedFDerivWithin_eq_zero (h'.sub ?_) hs hx
· simp [q]
· apply gcont.contDiffOn.analyticOn
have J3 : iteratedFDerivWithin 𝕜 n g s x = iteratedFDeriv 𝕜 n g x :=
iteratedFDerivWithin_eq_iteratedFDeriv hs (gcont.of_le le_top).contDiffAt hx
simp only [J1, J3, J2, add_zero]
let g' : E → F := fun z ↦ p n (fun _ ↦ z)
have : g = fun z ↦ g' (z - x) := rfl
rw [this, iteratedFDeriv_comp_sub]
exact (p n).iteratedFDeriv_comp_diagonal _ v
/-- If a function has a power series in a ball, then its `n`-th iterated derivative is given by
`(v₁, ..., vₙ) ↦ ∑ pₙ (v_{σ (1)}, ..., v_{σ (n)})` where the sum is over all
permutations of `{1, ..., n}`. -/
theorem HasFPowerSeriesWithinOnBall.iteratedFDerivWithin_eq_sum
(h : HasFPowerSeriesWithinOnBall f p s x r) (h' : AnalyticOn 𝕜 f s)
(hs : UniqueDiffOn 𝕜 s) (hx : x ∈ s) {n : ℕ} (v : Fin n → E) :
iteratedFDerivWithin 𝕜 n f s x v = ∑ σ : Perm (Fin n), p n (fun i ↦ v (σ i)) := by
have : iteratedFDerivWithin 𝕜 n f s x
= iteratedFDerivWithin 𝕜 n f (s ∩ EMetric.ball x r) x :=
(iteratedFDerivWithin_inter_open EMetric.isOpen_ball (EMetric.mem_ball_self h.r_pos)).symm
rw [this]
apply HasFPowerSeriesWithinOnBall.iteratedFDerivWithin_eq_sum_of_subset
· exact h.mono inter_subset_left
· exact h'.mono inter_subset_left
· exact hs.inter EMetric.isOpen_ball
· exact ⟨hx, EMetric.mem_ball_self h.r_pos⟩
· exact inter_subset_right
/-- If a function has a power series in a ball, then its `n`-th iterated derivative is given by
`(v₁, ..., vₙ) ↦ ∑ pₙ (v_{σ (1)}, ..., v_{σ (n)})` where the sum is over all
permutations of `{1, ..., n}`. -/
theorem HasFPowerSeriesOnBall.iteratedFDeriv_eq_sum
(h : HasFPowerSeriesOnBall f p x r) (h' : AnalyticOn 𝕜 f univ) {n : ℕ} (v : Fin n → E) :
iteratedFDeriv 𝕜 n f x v = ∑ σ : Perm (Fin n), p n (fun i ↦ v (σ i)) := by
simp only [← iteratedFDerivWithin_univ, ← hasFPowerSeriesWithinOnBall_univ] at h ⊢
exact h.iteratedFDerivWithin_eq_sum h' uniqueDiffOn_univ (mem_univ x) v
/-- If a function has a power series in a ball, then its `n`-th iterated derivative is given by
`(v₁, ..., vₙ) ↦ ∑ pₙ (v_{σ (1)}, ..., v_{σ (n)})` where the sum is over all
permutations of `{1, ..., n}`. -/
theorem HasFPowerSeriesWithinOnBall.iteratedFDerivWithin_eq_sum_of_completeSpace [CompleteSpace F]
(h : HasFPowerSeriesWithinOnBall f p s x r)
(hs : UniqueDiffOn 𝕜 s) (hx : x ∈ s) {n : ℕ} (v : Fin n → E) :
iteratedFDerivWithin 𝕜 n f s x v = ∑ σ : Perm (Fin n), p n (fun i ↦ v (σ i)) := by
have : iteratedFDerivWithin 𝕜 n f s x
= iteratedFDerivWithin 𝕜 n f (s ∩ EMetric.ball x r) x :=
(iteratedFDerivWithin_inter_open EMetric.isOpen_ball (EMetric.mem_ball_self h.r_pos)).symm
rw [this]
apply HasFPowerSeriesWithinOnBall.iteratedFDerivWithin_eq_sum_of_subset
· exact h.mono inter_subset_left
· apply h.analyticOn.mono
rw [insert_eq_of_mem hx]
· exact hs.inter EMetric.isOpen_ball
· exact ⟨hx, EMetric.mem_ball_self h.r_pos⟩
· exact inter_subset_right
/-- If a function has a power series in a ball, then its `n`-th iterated derivative is given by
`(v₁, ..., vₙ) ↦ ∑ pₙ (v_{σ (1)}, ..., v_{σ (n)})` where the sum is over all
permutations of `{1, ..., n}`. -/
theorem HasFPowerSeriesOnBall.iteratedFDeriv_eq_sum_of_completeSpace [CompleteSpace F]
(h : HasFPowerSeriesOnBall f p x r) {n : ℕ} (v : Fin n → E) :
iteratedFDeriv 𝕜 n f x v = ∑ σ : Perm (Fin n), p n (fun i ↦ v (σ i)) := by
simp only [← iteratedFDerivWithin_univ, ← hasFPowerSeriesWithinOnBall_univ] at h ⊢
exact h.iteratedFDerivWithin_eq_sum_of_completeSpace uniqueDiffOn_univ (mem_univ _) v
/-- The `n`-th iterated derivative of an analytic function on a set is symmetric. -/
theorem AnalyticOn.iteratedFDerivWithin_comp_perm
(h : AnalyticOn 𝕜 f s) (hs : UniqueDiffOn 𝕜 s) (hx : x ∈ s) {n : ℕ} (v : Fin n → E)
(σ : Perm (Fin n)) :
iteratedFDerivWithin 𝕜 n f s x (v ∘ σ) = iteratedFDerivWithin 𝕜 n f s x v := by
rcases h x hx with ⟨p, r, hp⟩
rw [hp.iteratedFDerivWithin_eq_sum h hs hx, hp.iteratedFDerivWithin_eq_sum h hs hx]
conv_rhs => rw [← Equiv.sum_comp (Equiv.mulLeft σ)]
simp only [coe_mulLeft, Perm.coe_mul, Function.comp_apply]
theorem AnalyticOn.domDomCongr_iteratedFDerivWithin
(h : AnalyticOn 𝕜 f s) (hs : UniqueDiffOn 𝕜 s) (hx : x ∈ s) {n : ℕ} (σ : Perm (Fin n)) :
(iteratedFDerivWithin 𝕜 n f s x).domDomCongr σ = iteratedFDerivWithin 𝕜 n f s x := by
ext
exact h.iteratedFDerivWithin_comp_perm hs hx _ _
/-- The `n`-th iterated derivative of an analytic function on a set is symmetric. -/
theorem ContDiffWithinAt.iteratedFDerivWithin_comp_perm
(h : ContDiffWithinAt 𝕜 ω f s x) (hs : UniqueDiffOn 𝕜 s) (hx : x ∈ s) {n : ℕ} (v : Fin n → E)
(σ : Perm (Fin n)) :
iteratedFDerivWithin 𝕜 n f s x (v ∘ σ) = iteratedFDerivWithin 𝕜 n f s x v := by
rcases h.contDiffOn' le_rfl (by simp) with ⟨u, u_open, xu, hu⟩
rw [insert_eq_of_mem hx] at hu
have : iteratedFDerivWithin 𝕜 n f (s ∩ u) x = iteratedFDerivWithin 𝕜 n f s x :=
iteratedFDerivWithin_inter_open u_open xu
rw [← this]
exact AnalyticOn.iteratedFDerivWithin_comp_perm hu.analyticOn (hs.inter u_open) ⟨hx, xu⟩ _ _
theorem ContDiffWithinAt.domDomCongr_iteratedFDerivWithin
(h : ContDiffWithinAt 𝕜 ω f s x) (hs : UniqueDiffOn 𝕜 s) (hx : x ∈ s) {n : ℕ}
(σ : Perm (Fin n)) :
(iteratedFDerivWithin 𝕜 n f s x).domDomCongr σ = iteratedFDerivWithin 𝕜 n f s x := by
ext
exact h.iteratedFDerivWithin_comp_perm hs hx _ _
/-- The `n`-th iterated derivative of an analytic function is symmetric. -/
theorem AnalyticOn.iteratedFDeriv_comp_perm
(h : AnalyticOn 𝕜 f univ) {n : ℕ} (v : Fin n → E) (σ : Perm (Fin n)) :
iteratedFDeriv 𝕜 n f x (v ∘ σ) = iteratedFDeriv 𝕜 n f x v := by
rw [← iteratedFDerivWithin_univ]
exact h.iteratedFDerivWithin_comp_perm uniqueDiffOn_univ (mem_univ x) _ _
theorem AnalyticOn.domDomCongr_iteratedFDeriv (h : AnalyticOn 𝕜 f univ) {n : ℕ} (σ : Perm (Fin n)) :
(iteratedFDeriv 𝕜 n f x).domDomCongr σ = iteratedFDeriv 𝕜 n f x := by
rw [← iteratedFDerivWithin_univ]
exact h.domDomCongr_iteratedFDerivWithin uniqueDiffOn_univ (mem_univ x) _
/-- The `n`-th iterated derivative of an analytic function is symmetric. -/
theorem ContDiffAt.iteratedFDeriv_comp_perm
(h : ContDiffAt 𝕜 ω f x) {n : ℕ} (v : Fin n → E) (σ : Perm (Fin n)) :
iteratedFDeriv 𝕜 n f x (v ∘ σ) = iteratedFDeriv 𝕜 n f x v := by
rw [← iteratedFDerivWithin_univ]
exact h.iteratedFDerivWithin_comp_perm uniqueDiffOn_univ (mem_univ x) _ _
theorem ContDiffAt.domDomCongr_iteratedFDeriv (h : ContDiffAt 𝕜 ω f x) {n : ℕ} (σ : Perm (Fin n)) :
(iteratedFDeriv 𝕜 n f x).domDomCongr σ = iteratedFDeriv 𝕜 n f x := by
rw [← iteratedFDerivWithin_univ]
exact h.domDomCongr_iteratedFDerivWithin uniqueDiffOn_univ (mem_univ x) _ |
.lake/packages/mathlib/Mathlib/Analysis/Analytic/Constructions.lean | import Mathlib.Analysis.Analytic.Composition
import Mathlib.Analysis.Analytic.Linear
import Mathlib.Analysis.Normed.Operator.Mul
import Mathlib.Analysis.Normed.Ring.Units
import Mathlib.Analysis.Analytic.OfScalars
/-!
# Various ways to combine analytic functions
We show that the following are analytic:
1. Cartesian products of analytic functions
2. Arithmetic on analytic functions: `mul`, `smul`, `inv`, `div`
3. Finite sums and products: `Finset.sum`, `Finset.prod`
-/
noncomputable section
open scoped Topology
open Filter Asymptotics ENNReal NNReal
variable {α : Type*}
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜]
variable {E F G H : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] [NormedAddCommGroup F]
[NormedSpace 𝕜 F] [NormedAddCommGroup G] [NormedSpace 𝕜 G] [NormedAddCommGroup H]
[NormedSpace 𝕜 H]
variable {𝕝 : Type*} [NontriviallyNormedField 𝕝] [NormedAlgebra 𝕜 𝕝]
variable {A : Type*} [NormedRing A] [NormedAlgebra 𝕜 A]
/-!
### Constants are analytic
-/
theorem hasFPowerSeriesOnBall_const {c : F} {e : E} :
HasFPowerSeriesOnBall (fun _ => c) (constFormalMultilinearSeries 𝕜 E c) e ⊤ := by
refine ⟨by simp, WithTop.top_pos, fun _ => hasSum_single 0 fun n hn => ?_⟩
simp [constFormalMultilinearSeries_apply_of_nonzero hn]
theorem hasFPowerSeriesAt_const {c : F} {e : E} :
HasFPowerSeriesAt (fun _ => c) (constFormalMultilinearSeries 𝕜 E c) e :=
⟨⊤, hasFPowerSeriesOnBall_const⟩
@[fun_prop]
theorem analyticAt_const {v : F} {x : E} : AnalyticAt 𝕜 (fun _ => v) x :=
⟨constFormalMultilinearSeries 𝕜 E v, hasFPowerSeriesAt_const⟩
theorem analyticOnNhd_const {v : F} {s : Set E} : AnalyticOnNhd 𝕜 (fun _ => v) s :=
fun _ _ => analyticAt_const
theorem analyticWithinAt_const {v : F} {s : Set E} {x : E} : AnalyticWithinAt 𝕜 (fun _ => v) s x :=
analyticAt_const.analyticWithinAt
theorem analyticOn_const {v : F} {s : Set E} : AnalyticOn 𝕜 (fun _ => v) s :=
analyticOnNhd_const.analyticOn
/-!
### Addition, negation, subtraction, scalar multiplication
-/
section
variable {f g : E → F} {pf pg : FormalMultilinearSeries 𝕜 E F} {s : Set E} {x : E} {r : ℝ≥0∞}
{c : 𝕜}
theorem HasFPowerSeriesWithinOnBall.add (hf : HasFPowerSeriesWithinOnBall f pf s x r)
(hg : HasFPowerSeriesWithinOnBall g pg s x r) :
HasFPowerSeriesWithinOnBall (f + g) (pf + pg) s x r :=
{ r_le := le_trans (le_min_iff.2 ⟨hf.r_le, hg.r_le⟩) (pf.min_radius_le_radius_add pg)
r_pos := hf.r_pos
hasSum := fun hy h'y => (hf.hasSum hy h'y).add (hg.hasSum hy h'y) }
theorem HasFPowerSeriesOnBall.add (hf : HasFPowerSeriesOnBall f pf x r)
(hg : HasFPowerSeriesOnBall g pg x r) : HasFPowerSeriesOnBall (f + g) (pf + pg) x r :=
{ r_le := le_trans (le_min_iff.2 ⟨hf.r_le, hg.r_le⟩) (pf.min_radius_le_radius_add pg)
r_pos := hf.r_pos
hasSum := fun hy => (hf.hasSum hy).add (hg.hasSum hy) }
theorem HasFPowerSeriesWithinAt.add
(hf : HasFPowerSeriesWithinAt f pf s x) (hg : HasFPowerSeriesWithinAt g pg s x) :
HasFPowerSeriesWithinAt (f + g) (pf + pg) s x := by
rcases (hf.eventually.and hg.eventually).exists with ⟨r, hr⟩
exact ⟨r, hr.1.add hr.2⟩
theorem HasFPowerSeriesAt.add (hf : HasFPowerSeriesAt f pf x) (hg : HasFPowerSeriesAt g pg x) :
HasFPowerSeriesAt (f + g) (pf + pg) x := by
rcases (hf.eventually.and hg.eventually).exists with ⟨r, hr⟩
exact ⟨r, hr.1.add hr.2⟩
theorem AnalyticWithinAt.add (hf : AnalyticWithinAt 𝕜 f s x) (hg : AnalyticWithinAt 𝕜 g s x) :
AnalyticWithinAt 𝕜 (f + g) s x :=
let ⟨_, hpf⟩ := hf
let ⟨_, hqf⟩ := hg
(hpf.add hqf).analyticWithinAt
@[fun_prop]
theorem AnalyticAt.fun_add (hf : AnalyticAt 𝕜 f x) (hg : AnalyticAt 𝕜 g x) :
AnalyticAt 𝕜 (fun z ↦ f z + g z) x :=
let ⟨_, hpf⟩ := hf
let ⟨_, hqf⟩ := hg
(hpf.add hqf).analyticAt
@[fun_prop]
theorem AnalyticAt.add (hf : AnalyticAt 𝕜 f x) (hg : AnalyticAt 𝕜 g x) : AnalyticAt 𝕜 (f + g) x :=
hf.fun_add hg
theorem HasFPowerSeriesWithinOnBall.neg (hf : HasFPowerSeriesWithinOnBall f pf s x r) :
HasFPowerSeriesWithinOnBall (-f) (-pf) s x r :=
{ r_le := by
rw [pf.radius_neg]
exact hf.r_le
r_pos := hf.r_pos
hasSum := fun hy h'y => (hf.hasSum hy h'y).neg }
theorem HasFPowerSeriesOnBall.neg (hf : HasFPowerSeriesOnBall f pf x r) :
HasFPowerSeriesOnBall (-f) (-pf) x r :=
{ r_le := by
rw [pf.radius_neg]
exact hf.r_le
r_pos := hf.r_pos
hasSum := fun hy => (hf.hasSum hy).neg }
theorem HasFPowerSeriesWithinAt.neg (hf : HasFPowerSeriesWithinAt f pf s x) :
HasFPowerSeriesWithinAt (-f) (-pf) s x :=
let ⟨_, hrf⟩ := hf
hrf.neg.hasFPowerSeriesWithinAt
theorem HasFPowerSeriesAt.neg (hf : HasFPowerSeriesAt f pf x) : HasFPowerSeriesAt (-f) (-pf) x :=
let ⟨_, hrf⟩ := hf
hrf.neg.hasFPowerSeriesAt
theorem AnalyticWithinAt.neg (hf : AnalyticWithinAt 𝕜 f s x) : AnalyticWithinAt 𝕜 (-f) s x :=
let ⟨_, hpf⟩ := hf
hpf.neg.analyticWithinAt
@[fun_prop]
theorem AnalyticAt.fun_neg (hf : AnalyticAt 𝕜 f x) : AnalyticAt 𝕜 (fun z ↦ -f z) x :=
let ⟨_, hpf⟩ := hf
hpf.neg.analyticAt
@[fun_prop]
theorem AnalyticAt.neg (hf : AnalyticAt 𝕜 f x) : AnalyticAt 𝕜 (-f) x :=
hf.fun_neg
@[simp] lemma analyticAt_neg : AnalyticAt 𝕜 (-f) x ↔ AnalyticAt 𝕜 f x where
mp hf := by simpa using hf.neg
mpr := .neg
theorem HasFPowerSeriesWithinOnBall.sub (hf : HasFPowerSeriesWithinOnBall f pf s x r)
(hg : HasFPowerSeriesWithinOnBall g pg s x r) :
HasFPowerSeriesWithinOnBall (f - g) (pf - pg) s x r := by
simpa only [sub_eq_add_neg] using hf.add hg.neg
theorem HasFPowerSeriesOnBall.sub (hf : HasFPowerSeriesOnBall f pf x r)
(hg : HasFPowerSeriesOnBall g pg x r) : HasFPowerSeriesOnBall (f - g) (pf - pg) x r := by
simpa only [sub_eq_add_neg] using hf.add hg.neg
theorem HasFPowerSeriesWithinAt.sub
(hf : HasFPowerSeriesWithinAt f pf s x) (hg : HasFPowerSeriesWithinAt g pg s x) :
HasFPowerSeriesWithinAt (f - g) (pf - pg) s x := by
simpa only [sub_eq_add_neg] using hf.add hg.neg
theorem HasFPowerSeriesAt.sub (hf : HasFPowerSeriesAt f pf x) (hg : HasFPowerSeriesAt g pg x) :
HasFPowerSeriesAt (f - g) (pf - pg) x := by
simpa only [sub_eq_add_neg] using hf.add hg.neg
theorem AnalyticWithinAt.sub (hf : AnalyticWithinAt 𝕜 f s x) (hg : AnalyticWithinAt 𝕜 g s x) :
AnalyticWithinAt 𝕜 (f - g) s x := by
simpa only [sub_eq_add_neg] using hf.add hg.neg
@[fun_prop]
theorem AnalyticAt.fun_sub (hf : AnalyticAt 𝕜 f x) (hg : AnalyticAt 𝕜 g x) :
AnalyticAt 𝕜 (fun z ↦ f z - g z) x := by
simpa only [sub_eq_add_neg] using hf.add hg.neg
@[fun_prop]
theorem AnalyticAt.sub (hf : AnalyticAt 𝕜 f x) (hg : AnalyticAt 𝕜 g x) :
AnalyticAt 𝕜 (f - g) x :=
hf.fun_sub hg
theorem HasFPowerSeriesWithinOnBall.const_smul (hf : HasFPowerSeriesWithinOnBall f pf s x r) :
HasFPowerSeriesWithinOnBall (c • f) (c • pf) s x r where
r_le := le_trans hf.r_le pf.radius_le_smul
r_pos := hf.r_pos
hasSum := fun hy h'y => (hf.hasSum hy h'y).const_smul _
theorem HasFPowerSeriesOnBall.const_smul (hf : HasFPowerSeriesOnBall f pf x r) :
HasFPowerSeriesOnBall (c • f) (c • pf) x r where
r_le := le_trans hf.r_le pf.radius_le_smul
r_pos := hf.r_pos
hasSum := fun hy => (hf.hasSum hy).const_smul _
theorem HasFPowerSeriesWithinAt.const_smul (hf : HasFPowerSeriesWithinAt f pf s x) :
HasFPowerSeriesWithinAt (c • f) (c • pf) s x :=
let ⟨_, hrf⟩ := hf
hrf.const_smul.hasFPowerSeriesWithinAt
theorem HasFPowerSeriesAt.const_smul (hf : HasFPowerSeriesAt f pf x) :
HasFPowerSeriesAt (c • f) (c • pf) x :=
let ⟨_, hrf⟩ := hf
hrf.const_smul.hasFPowerSeriesAt
theorem AnalyticWithinAt.const_smul (hf : AnalyticWithinAt 𝕜 f s x) :
AnalyticWithinAt 𝕜 (c • f) s x :=
let ⟨_, hpf⟩ := hf
hpf.const_smul.analyticWithinAt
@[fun_prop]
theorem AnalyticAt.fun_const_smul (hf : AnalyticAt 𝕜 f x) : AnalyticAt 𝕜 (fun z ↦ c • f z) x :=
let ⟨_, hpf⟩ := hf
hpf.const_smul.analyticAt
@[fun_prop]
theorem AnalyticAt.const_smul (hf : AnalyticAt 𝕜 f x) : AnalyticAt 𝕜 (c • f) x :=
hf.fun_const_smul
theorem AnalyticOn.add (hf : AnalyticOn 𝕜 f s) (hg : AnalyticOn 𝕜 g s) :
AnalyticOn 𝕜 (f + g) s :=
fun z hz => (hf z hz).add (hg z hz)
theorem AnalyticOnNhd.add (hf : AnalyticOnNhd 𝕜 f s) (hg : AnalyticOnNhd 𝕜 g s) :
AnalyticOnNhd 𝕜 (f + g) s :=
fun z hz => (hf z hz).add (hg z hz)
theorem AnalyticOn.neg (hf : AnalyticOn 𝕜 f s) : AnalyticOn 𝕜 (-f) s :=
fun z hz ↦ (hf z hz).neg
theorem AnalyticOnNhd.neg (hf : AnalyticOnNhd 𝕜 f s) : AnalyticOnNhd 𝕜 (-f) s :=
fun z hz ↦ (hf z hz).neg
theorem AnalyticOn.sub (hf : AnalyticOn 𝕜 f s) (hg : AnalyticOn 𝕜 g s) :
AnalyticOn 𝕜 (f - g) s :=
fun z hz => (hf z hz).sub (hg z hz)
theorem AnalyticOnNhd.sub (hf : AnalyticOnNhd 𝕜 f s) (hg : AnalyticOnNhd 𝕜 g s) :
AnalyticOnNhd 𝕜 (f - g) s :=
fun z hz => (hf z hz).sub (hg z hz)
end
/-!
### Cartesian products are analytic
-/
/-- The radius of the Cartesian product of two formal series is the minimum of their radii. -/
lemma FormalMultilinearSeries.radius_prod_eq_min
(p : FormalMultilinearSeries 𝕜 E F) (q : FormalMultilinearSeries 𝕜 E G) :
(p.prod q).radius = min p.radius q.radius := by
apply le_antisymm
· refine ENNReal.le_of_forall_nnreal_lt fun r hr => ?_
rw [le_min_iff]
have := (p.prod q).isLittleO_one_of_lt_radius hr
constructor
all_goals
apply FormalMultilinearSeries.le_radius_of_isBigO
refine (isBigO_of_le _ fun n ↦ ?_).trans this.isBigO
rw [norm_mul, norm_norm, norm_mul, norm_norm]
refine mul_le_mul_of_nonneg_right ?_ (norm_nonneg _)
rw [FormalMultilinearSeries.prod, ContinuousMultilinearMap.opNorm_prod]
· apply le_max_left
· apply le_max_right
· refine ENNReal.le_of_forall_nnreal_lt fun r hr => ?_
rw [lt_min_iff] at hr
have := ((p.isLittleO_one_of_lt_radius hr.1).add
(q.isLittleO_one_of_lt_radius hr.2)).isBigO
refine (p.prod q).le_radius_of_isBigO ((isBigO_of_le _ fun n ↦ ?_).trans this)
rw [norm_mul, norm_norm, ← add_mul, norm_mul]
refine mul_le_mul_of_nonneg_right ?_ (norm_nonneg _)
rw [FormalMultilinearSeries.prod, ContinuousMultilinearMap.opNorm_prod]
refine (max_le_add_of_nonneg (norm_nonneg _) (norm_nonneg _)).trans ?_
apply Real.le_norm_self
lemma HasFPowerSeriesWithinOnBall.prod {e : E} {f : E → F} {g : E → G} {r s : ℝ≥0∞} {t : Set E}
{p : FormalMultilinearSeries 𝕜 E F} {q : FormalMultilinearSeries 𝕜 E G}
(hf : HasFPowerSeriesWithinOnBall f p t e r) (hg : HasFPowerSeriesWithinOnBall g q t e s) :
HasFPowerSeriesWithinOnBall (fun x ↦ (f x, g x)) (p.prod q) t e (min r s) where
r_le := by
rw [p.radius_prod_eq_min]
exact min_le_min hf.r_le hg.r_le
r_pos := lt_min hf.r_pos hg.r_pos
hasSum := by
intro y h'y hy
simp_rw [FormalMultilinearSeries.prod, ContinuousMultilinearMap.prod_apply]
refine (hf.hasSum h'y ?_).prodMk (hg.hasSum h'y ?_)
· exact EMetric.mem_ball.mpr (lt_of_lt_of_le hy (min_le_left _ _))
· exact EMetric.mem_ball.mpr (lt_of_lt_of_le hy (min_le_right _ _))
lemma HasFPowerSeriesOnBall.prod {e : E} {f : E → F} {g : E → G} {r s : ℝ≥0∞}
{p : FormalMultilinearSeries 𝕜 E F} {q : FormalMultilinearSeries 𝕜 E G}
(hf : HasFPowerSeriesOnBall f p e r) (hg : HasFPowerSeriesOnBall g q e s) :
HasFPowerSeriesOnBall (fun x ↦ (f x, g x)) (p.prod q) e (min r s) := by
rw [← hasFPowerSeriesWithinOnBall_univ] at hf hg ⊢
exact hf.prod hg
lemma HasFPowerSeriesWithinAt.prod {e : E} {f : E → F} {g : E → G} {s : Set E}
{p : FormalMultilinearSeries 𝕜 E F} {q : FormalMultilinearSeries 𝕜 E G}
(hf : HasFPowerSeriesWithinAt f p s e) (hg : HasFPowerSeriesWithinAt g q s e) :
HasFPowerSeriesWithinAt (fun x ↦ (f x, g x)) (p.prod q) s e := by
rcases hf with ⟨_, hf⟩
rcases hg with ⟨_, hg⟩
exact ⟨_, hf.prod hg⟩
lemma HasFPowerSeriesAt.prod {e : E} {f : E → F} {g : E → G}
{p : FormalMultilinearSeries 𝕜 E F} {q : FormalMultilinearSeries 𝕜 E G}
(hf : HasFPowerSeriesAt f p e) (hg : HasFPowerSeriesAt g q e) :
HasFPowerSeriesAt (fun x ↦ (f x, g x)) (p.prod q) e := by
rcases hf with ⟨_, hf⟩
rcases hg with ⟨_, hg⟩
exact ⟨_, hf.prod hg⟩
/-- The Cartesian product of analytic functions is analytic. -/
lemma AnalyticWithinAt.prod {e : E} {f : E → F} {g : E → G} {s : Set E}
(hf : AnalyticWithinAt 𝕜 f s e) (hg : AnalyticWithinAt 𝕜 g s e) :
AnalyticWithinAt 𝕜 (fun x ↦ (f x, g x)) s e := by
rcases hf with ⟨_, hf⟩
rcases hg with ⟨_, hg⟩
exact ⟨_, hf.prod hg⟩
/-- The Cartesian product of analytic functions is analytic. -/
@[fun_prop]
lemma AnalyticAt.prod {e : E} {f : E → F} {g : E → G}
(hf : AnalyticAt 𝕜 f e) (hg : AnalyticAt 𝕜 g e) :
AnalyticAt 𝕜 (fun x ↦ (f x, g x)) e := by
rcases hf with ⟨_, hf⟩
rcases hg with ⟨_, hg⟩
exact ⟨_, hf.prod hg⟩
/-- The Cartesian product of analytic functions within a set is analytic. -/
lemma AnalyticOn.prod {f : E → F} {g : E → G} {s : Set E}
(hf : AnalyticOn 𝕜 f s) (hg : AnalyticOn 𝕜 g s) :
AnalyticOn 𝕜 (fun x ↦ (f x, g x)) s :=
fun x hx ↦ (hf x hx).prod (hg x hx)
/-- The Cartesian product of analytic functions is analytic. -/
lemma AnalyticOnNhd.prod {f : E → F} {g : E → G} {s : Set E}
(hf : AnalyticOnNhd 𝕜 f s) (hg : AnalyticOnNhd 𝕜 g s) :
AnalyticOnNhd 𝕜 (fun x ↦ (f x, g x)) s :=
fun x hx ↦ (hf x hx).prod (hg x hx)
/-- `AnalyticAt.comp` for functions on product spaces -/
theorem AnalyticAt.comp₂ {h : F × G → H} {f : E → F} {g : E → G} {x : E}
(ha : AnalyticAt 𝕜 h (f x, g x)) (fa : AnalyticAt 𝕜 f x)
(ga : AnalyticAt 𝕜 g x) :
AnalyticAt 𝕜 (fun x ↦ h (f x, g x)) x :=
AnalyticAt.comp ha (fa.prod ga)
/-- `AnalyticWithinAt.comp` for functions on product spaces -/
theorem AnalyticWithinAt.comp₂ {h : F × G → H} {f : E → F} {g : E → G} {s : Set (F × G)}
{t : Set E} {x : E}
(ha : AnalyticWithinAt 𝕜 h s (f x, g x)) (fa : AnalyticWithinAt 𝕜 f t x)
(ga : AnalyticWithinAt 𝕜 g t x) (hf : Set.MapsTo (fun y ↦ (f y, g y)) t s) :
AnalyticWithinAt 𝕜 (fun x ↦ h (f x, g x)) t x :=
AnalyticWithinAt.comp ha (fa.prod ga) hf
/-- `AnalyticAt.comp_analyticWithinAt` for functions on product spaces -/
theorem AnalyticAt.comp₂_analyticWithinAt
{h : F × G → H} {f : E → F} {g : E → G} {x : E} {s : Set E}
(ha : AnalyticAt 𝕜 h (f x, g x)) (fa : AnalyticWithinAt 𝕜 f s x)
(ga : AnalyticWithinAt 𝕜 g s x) :
AnalyticWithinAt 𝕜 (fun x ↦ h (f x, g x)) s x :=
AnalyticAt.comp_analyticWithinAt ha (fa.prod ga)
/-- `AnalyticOnNhd.comp` for functions on product spaces -/
theorem AnalyticOnNhd.comp₂ {h : F × G → H} {f : E → F} {g : E → G} {s : Set (F × G)} {t : Set E}
(ha : AnalyticOnNhd 𝕜 h s) (fa : AnalyticOnNhd 𝕜 f t) (ga : AnalyticOnNhd 𝕜 g t)
(m : ∀ x, x ∈ t → (f x, g x) ∈ s) : AnalyticOnNhd 𝕜 (fun x ↦ h (f x, g x)) t :=
fun _ xt ↦ (ha _ (m _ xt)).comp₂ (fa _ xt) (ga _ xt)
/-- `AnalyticOn.comp` for functions on product spaces -/
theorem AnalyticOn.comp₂ {h : F × G → H} {f : E → F} {g : E → G} {s : Set (F × G)}
{t : Set E}
(ha : AnalyticOn 𝕜 h s) (fa : AnalyticOn 𝕜 f t)
(ga : AnalyticOn 𝕜 g t) (m : Set.MapsTo (fun y ↦ (f y, g y)) t s) :
AnalyticOn 𝕜 (fun x ↦ h (f x, g x)) t :=
fun x hx ↦ (ha _ (m hx)).comp₂ (fa x hx) (ga x hx) m
/-- Analytic functions on products are analytic in the first coordinate -/
theorem AnalyticAt.curry_left {f : E × F → G} {p : E × F} (fa : AnalyticAt 𝕜 f p) :
AnalyticAt 𝕜 (fun x ↦ f (x, p.2)) p.1 :=
AnalyticAt.comp₂ fa analyticAt_id analyticAt_const
alias AnalyticAt.along_fst := AnalyticAt.curry_left
theorem AnalyticWithinAt.curry_left
{f : E × F → G} {s : Set (E × F)} {p : E × F} (fa : AnalyticWithinAt 𝕜 f s p) :
AnalyticWithinAt 𝕜 (fun x ↦ f (x, p.2)) {x | (x, p.2) ∈ s} p.1 :=
AnalyticWithinAt.comp₂ fa analyticWithinAt_id analyticWithinAt_const (fun _ hx ↦ hx)
/-- Analytic functions on products are analytic in the second coordinate -/
theorem AnalyticAt.curry_right {f : E × F → G} {p : E × F} (fa : AnalyticAt 𝕜 f p) :
AnalyticAt 𝕜 (fun y ↦ f (p.1, y)) p.2 :=
AnalyticAt.comp₂ fa analyticAt_const analyticAt_id
alias AnalyticAt.along_snd := AnalyticAt.curry_right
theorem AnalyticWithinAt.curry_right
{f : E × F → G} {s : Set (E × F)} {p : E × F} (fa : AnalyticWithinAt 𝕜 f s p) :
AnalyticWithinAt 𝕜 (fun y ↦ f (p.1, y)) {y | (p.1, y) ∈ s} p.2 :=
AnalyticWithinAt.comp₂ fa analyticWithinAt_const analyticWithinAt_id (fun _ hx ↦ hx)
/-- Analytic functions on products are analytic in the first coordinate -/
theorem AnalyticOnNhd.curry_left {f : E × F → G} {s : Set (E × F)} {y : F}
(fa : AnalyticOnNhd 𝕜 f s) :
AnalyticOnNhd 𝕜 (fun x ↦ f (x, y)) {x | (x, y) ∈ s} :=
fun x m ↦ (fa (x, y) m).curry_left
alias AnalyticOnNhd.along_fst := AnalyticOnNhd.curry_left
theorem AnalyticOn.curry_left
{f : E × F → G} {s : Set (E × F)} {y : F} (fa : AnalyticOn 𝕜 f s) :
AnalyticOn 𝕜 (fun x ↦ f (x, y)) {x | (x, y) ∈ s} :=
fun x m ↦ (fa (x, y) m).curry_left
/-- Analytic functions on products are analytic in the second coordinate -/
theorem AnalyticOnNhd.curry_right {f : E × F → G} {x : E} {s : Set (E × F)}
(fa : AnalyticOnNhd 𝕜 f s) :
AnalyticOnNhd 𝕜 (fun y ↦ f (x, y)) {y | (x, y) ∈ s} :=
fun y m ↦ (fa (x, y) m).curry_right
alias AnalyticOnNhd.along_snd := AnalyticOnNhd.curry_right
theorem AnalyticOn.curry_right
{f : E × F → G} {x : E} {s : Set (E × F)} (fa : AnalyticOn 𝕜 f s) :
AnalyticOn 𝕜 (fun y ↦ f (x, y)) {y | (x, y) ∈ s} :=
fun y m ↦ (fa (x, y) m).curry_right
/-!
### Analyticity in Pi spaces
In this section, `f : Π i, E → Fm i` is a family of functions, i.e., each `f i` is a function,
from `E` to a space `Fm i`. We discuss whether the family as a whole is analytic as a function
of `x : E`, i.e., whether `x ↦ (f 1 x, ..., f n x)` is analytic from `E` to the product space
`Π i, Fm i`. This function is denoted either by `fun x ↦ (fun i ↦ f i x)`, or `fun x i ↦ f i x`,
or `fun x ↦ (f ⬝ x)`. We use the latter spelling in the statements, for readability purposes.
-/
section
variable {ι : Type*} [Fintype ι] {e : E} {Fm : ι → Type*}
[∀ i, NormedAddCommGroup (Fm i)] [∀ i, NormedSpace 𝕜 (Fm i)]
{f : Π i, E → Fm i} {s : Set E} {r : ℝ≥0∞}
{p : Π i, FormalMultilinearSeries 𝕜 E (Fm i)}
lemma FormalMultilinearSeries.radius_pi_le (p : Π i, FormalMultilinearSeries 𝕜 E (Fm i)) (i : ι) :
(FormalMultilinearSeries.pi p).radius ≤ (p i).radius := by
apply le_of_forall_nnreal_lt (fun r' hr' ↦ ?_)
obtain ⟨C, -, hC⟩ : ∃ C > 0, ∀ n, ‖pi p n‖ * ↑r' ^ n ≤ C := norm_mul_pow_le_of_lt_radius _ hr'
apply le_radius_of_bound _ C (fun n ↦ ?_)
apply le_trans _ (hC n)
gcongr
rw [pi, ContinuousMultilinearMap.opNorm_pi]
exact norm_le_pi_norm (fun i ↦ p i n) i
lemma FormalMultilinearSeries.le_radius_pi (h : ∀ i, r ≤ (p i).radius) :
r ≤ (FormalMultilinearSeries.pi p).radius := by
apply le_of_forall_nnreal_lt (fun r' hr' ↦ ?_)
have I i : ∃ C > 0, ∀ n, ‖p i n‖ * (r' : ℝ) ^ n ≤ C :=
norm_mul_pow_le_of_lt_radius _ (hr'.trans_le (h i))
choose C C_pos hC using I
obtain ⟨D, D_nonneg, hD⟩ : ∃ D ≥ 0, ∀ i, C i ≤ D :=
⟨∑ i, C i, Finset.sum_nonneg (fun i _ ↦ (C_pos i).le),
fun i ↦ Finset.single_le_sum (fun j _ ↦ (C_pos j).le) (Finset.mem_univ _)⟩
apply le_radius_of_bound _ D (fun n ↦ ?_)
rcases le_or_gt ((r' : ℝ)^n) 0 with hr' | hr'
· exact le_trans (mul_nonpos_of_nonneg_of_nonpos (by positivity) hr') D_nonneg
· simp only [pi]
rw [← le_div_iff₀ hr', ContinuousMultilinearMap.opNorm_pi,
pi_norm_le_iff_of_nonneg (by positivity)]
intro i
exact (le_div_iff₀ hr').2 ((hC i n).trans (hD i))
lemma FormalMultilinearSeries.radius_pi_eq_iInf :
(FormalMultilinearSeries.pi p).radius = ⨅ i, (p i).radius := by
refine le_antisymm (by simp [radius_pi_le]) ?_
apply le_of_forall_nnreal_lt (fun r' hr' ↦ ?_)
exact le_radius_pi (fun i ↦ le_iInf_iff.1 hr'.le i)
/-- If each function in a finite family has a power series within a ball, then so does the
family as a whole. Note that the positivity assumption on the radius is only needed when
the family is empty. -/
lemma HasFPowerSeriesWithinOnBall.pi
(hf : ∀ i, HasFPowerSeriesWithinOnBall (f i) (p i) s e r) (hr : 0 < r) :
HasFPowerSeriesWithinOnBall (fun x ↦ (f · x)) (FormalMultilinearSeries.pi p) s e r where
r_le := by
apply FormalMultilinearSeries.le_radius_pi (fun i ↦ ?_)
exact (hf i).r_le
r_pos := hr
hasSum {_} m hy := Pi.hasSum.2 (fun i ↦ (hf i).hasSum m hy)
lemma hasFPowerSeriesWithinOnBall_pi_iff (hr : 0 < r) :
HasFPowerSeriesWithinOnBall (fun x ↦ (f · x)) (FormalMultilinearSeries.pi p) s e r ↔
∀ i, HasFPowerSeriesWithinOnBall (f i) (p i) s e r where
mp h i :=
⟨h.r_le.trans (FormalMultilinearSeries.radius_pi_le _ _), hr,
fun m hy ↦ Pi.hasSum.1 (h.hasSum m hy) i⟩
mpr h := .pi h hr
lemma HasFPowerSeriesOnBall.pi
(hf : ∀ i, HasFPowerSeriesOnBall (f i) (p i) e r) (hr : 0 < r) :
HasFPowerSeriesOnBall (fun x ↦ (f · x)) (FormalMultilinearSeries.pi p) e r := by
simp_rw [← hasFPowerSeriesWithinOnBall_univ] at hf ⊢
exact HasFPowerSeriesWithinOnBall.pi hf hr
lemma hasFPowerSeriesOnBall_pi_iff (hr : 0 < r) :
HasFPowerSeriesOnBall (fun x ↦ (f · x)) (FormalMultilinearSeries.pi p) e r ↔
∀ i, HasFPowerSeriesOnBall (f i) (p i) e r := by
simp_rw [← hasFPowerSeriesWithinOnBall_univ]
exact hasFPowerSeriesWithinOnBall_pi_iff hr
lemma HasFPowerSeriesWithinAt.pi
(hf : ∀ i, HasFPowerSeriesWithinAt (f i) (p i) s e) :
HasFPowerSeriesWithinAt (fun x ↦ (f · x)) (FormalMultilinearSeries.pi p) s e := by
have : ∀ᶠ r in 𝓝[>] 0, ∀ i, HasFPowerSeriesWithinOnBall (f i) (p i) s e r :=
eventually_all.mpr (fun i ↦ (hf i).eventually)
obtain ⟨r, hr, r_pos⟩ := (this.and self_mem_nhdsWithin).exists
exact ⟨r, HasFPowerSeriesWithinOnBall.pi hr r_pos⟩
lemma hasFPowerSeriesWithinAt_pi_iff :
HasFPowerSeriesWithinAt (fun x ↦ (f · x)) (FormalMultilinearSeries.pi p) s e ↔
∀ i, HasFPowerSeriesWithinAt (f i) (p i) s e := by
refine ⟨fun h i ↦ ?_, fun h ↦ .pi h⟩
obtain ⟨r, hr⟩ := h
exact ⟨r, (hasFPowerSeriesWithinOnBall_pi_iff hr.r_pos).1 hr i⟩
lemma HasFPowerSeriesAt.pi
(hf : ∀ i, HasFPowerSeriesAt (f i) (p i) e) :
HasFPowerSeriesAt (fun x ↦ (f · x)) (FormalMultilinearSeries.pi p) e := by
simp_rw [← hasFPowerSeriesWithinAt_univ] at hf ⊢
exact HasFPowerSeriesWithinAt.pi hf
lemma hasFPowerSeriesAt_pi_iff :
HasFPowerSeriesAt (fun x ↦ (f · x)) (FormalMultilinearSeries.pi p) e ↔
∀ i, HasFPowerSeriesAt (f i) (p i) e := by
simp_rw [← hasFPowerSeriesWithinAt_univ]
exact hasFPowerSeriesWithinAt_pi_iff
lemma AnalyticWithinAt.pi (hf : ∀ i, AnalyticWithinAt 𝕜 (f i) s e) :
AnalyticWithinAt 𝕜 (fun x ↦ (f · x)) s e := by
choose p hp using hf
exact ⟨FormalMultilinearSeries.pi p, HasFPowerSeriesWithinAt.pi hp⟩
lemma analyticWithinAt_pi_iff :
AnalyticWithinAt 𝕜 (fun x ↦ (f · x)) s e ↔ ∀ i, AnalyticWithinAt 𝕜 (f i) s e := by
refine ⟨fun h i ↦ ?_, fun h ↦ .pi h⟩
exact ((ContinuousLinearMap.proj (R := 𝕜) i).analyticAt _).comp_analyticWithinAt h
lemma AnalyticAt.pi (hf : ∀ i, AnalyticAt 𝕜 (f i) e) :
AnalyticAt 𝕜 (fun x ↦ (f · x)) e := by
simp_rw [← analyticWithinAt_univ] at hf ⊢
exact AnalyticWithinAt.pi hf
lemma analyticAt_pi_iff :
AnalyticAt 𝕜 (fun x ↦ (f · x)) e ↔ ∀ i, AnalyticAt 𝕜 (f i) e := by
simp_rw [← analyticWithinAt_univ]
exact analyticWithinAt_pi_iff
lemma AnalyticOn.pi (hf : ∀ i, AnalyticOn 𝕜 (f i) s) :
AnalyticOn 𝕜 (fun x ↦ (f · x)) s :=
fun x hx ↦ AnalyticWithinAt.pi (fun i ↦ hf i x hx)
lemma analyticOn_pi_iff :
AnalyticOn 𝕜 (fun x ↦ (f · x)) s ↔ ∀ i, AnalyticOn 𝕜 (f i) s :=
⟨fun h i x hx ↦ analyticWithinAt_pi_iff.1 (h x hx) i, fun h ↦ .pi h⟩
lemma AnalyticOnNhd.pi (hf : ∀ i, AnalyticOnNhd 𝕜 (f i) s) :
AnalyticOnNhd 𝕜 (fun x ↦ (f · x)) s :=
fun x hx ↦ AnalyticAt.pi (fun i ↦ hf i x hx)
lemma analyticOnNhd_pi_iff :
AnalyticOnNhd 𝕜 (fun x ↦ (f · x)) s ↔ ∀ i, AnalyticOnNhd 𝕜 (f i) s :=
⟨fun h i x hx ↦ analyticAt_pi_iff.1 (h x hx) i, fun h ↦ .pi h⟩
end
/-!
### Arithmetic on analytic functions
-/
/-- Scalar multiplication is analytic (jointly in both variables). The statement is a little
pedantic to allow towers of field extensions.
TODO: can we replace `𝕜'` with a "normed module" in such a way that `analyticAt_mul` is a special
case of this? -/
@[fun_prop]
lemma analyticAt_smul [NormedSpace 𝕝 E] [IsScalarTower 𝕜 𝕝 E] (z : 𝕝 × E) :
AnalyticAt 𝕜 (fun x : 𝕝 × E ↦ x.1 • x.2) z :=
(ContinuousLinearMap.lsmul 𝕜 𝕝).analyticAt_bilinear z
/-- Multiplication in a normed algebra over `𝕜` is analytic. -/
@[fun_prop]
lemma analyticAt_mul (z : A × A) : AnalyticAt 𝕜 (fun x : A × A ↦ x.1 * x.2) z :=
(ContinuousLinearMap.mul 𝕜 A).analyticAt_bilinear z
/-- Scalar multiplication of one analytic function by another. -/
lemma AnalyticWithinAt.smul [NormedSpace 𝕝 F] [IsScalarTower 𝕜 𝕝 F]
{f : E → 𝕝} {g : E → F} {s : Set E} {z : E}
(hf : AnalyticWithinAt 𝕜 f s z) (hg : AnalyticWithinAt 𝕜 g s z) :
AnalyticWithinAt 𝕜 (fun x ↦ f x • g x) s z :=
(analyticAt_smul _).comp₂_analyticWithinAt hf hg
/-- Scalar multiplication of one analytic function by another. -/
@[fun_prop]
lemma AnalyticAt.fun_smul [NormedSpace 𝕝 F] [IsScalarTower 𝕜 𝕝 F] {f : E → 𝕝} {g : E → F} {z : E}
(hf : AnalyticAt 𝕜 f z) (hg : AnalyticAt 𝕜 g z) :
AnalyticAt 𝕜 (fun x ↦ f x • g x) z :=
(analyticAt_smul _).comp₂ hf hg
/-- Scalar multiplication of one analytic function by another. -/
@[fun_prop]
lemma AnalyticAt.smul [NormedSpace 𝕝 F] [IsScalarTower 𝕜 𝕝 F] {f : E → 𝕝} {g : E → F} {z : E}
(hf : AnalyticAt 𝕜 f z) (hg : AnalyticAt 𝕜 g z) :
AnalyticAt 𝕜 (f • g) z :=
hf.fun_smul hg
/-- Scalar multiplication of one analytic function by another. -/
lemma AnalyticOn.smul [NormedSpace 𝕝 F] [IsScalarTower 𝕜 𝕝 F]
{f : E → 𝕝} {g : E → F} {s : Set E}
(hf : AnalyticOn 𝕜 f s) (hg : AnalyticOn 𝕜 g s) :
AnalyticOn 𝕜 (fun x ↦ f x • g x) s :=
fun _ m ↦ (hf _ m).smul (hg _ m)
/-- Scalar multiplication of one analytic function by another. -/
lemma AnalyticOnNhd.smul [NormedSpace 𝕝 F] [IsScalarTower 𝕜 𝕝 F] {f : E → 𝕝} {g : E → F} {s : Set E}
(hf : AnalyticOnNhd 𝕜 f s) (hg : AnalyticOnNhd 𝕜 g s) :
AnalyticOnNhd 𝕜 (fun x ↦ f x • g x) s :=
fun _ m ↦ (hf _ m).smul (hg _ m)
/-- Multiplication of analytic functions (valued in a normed `𝕜`-algebra) is analytic. -/
lemma AnalyticWithinAt.mul {f g : E → A} {s : Set E} {z : E}
(hf : AnalyticWithinAt 𝕜 f s z) (hg : AnalyticWithinAt 𝕜 g s z) :
AnalyticWithinAt 𝕜 (fun x ↦ f x * g x) s z :=
(analyticAt_mul _).comp₂_analyticWithinAt hf hg
/-- Multiplication of analytic functions (valued in a normed `𝕜`-algebra) is analytic. -/
@[fun_prop]
lemma AnalyticAt.fun_mul {f g : E → A} {z : E} (hf : AnalyticAt 𝕜 f z) (hg : AnalyticAt 𝕜 g z) :
AnalyticAt 𝕜 (fun x ↦ f x * g x) z :=
(analyticAt_mul _).comp₂ hf hg
/-- Multiplication of analytic functions (valued in a normed `𝕜`-algebra) is analytic. -/
@[fun_prop]
lemma AnalyticAt.mul {f g : E → A} {z : E} (hf : AnalyticAt 𝕜 f z) (hg : AnalyticAt 𝕜 g z) :
AnalyticAt 𝕜 (f * g) z :=
hf.fun_mul hg
/-- Multiplication of analytic functions (valued in a normed `𝕜`-algebra) is analytic. -/
lemma AnalyticOn.mul {f g : E → A} {s : Set E}
(hf : AnalyticOn 𝕜 f s) (hg : AnalyticOn 𝕜 g s) :
AnalyticOn 𝕜 (fun x ↦ f x * g x) s :=
fun _ m ↦ (hf _ m).mul (hg _ m)
/-- Multiplication of analytic functions (valued in a normed `𝕜`-algebra) is analytic. -/
lemma AnalyticOnNhd.mul {f g : E → A} {s : Set E}
(hf : AnalyticOnNhd 𝕜 f s) (hg : AnalyticOnNhd 𝕜 g s) :
AnalyticOnNhd 𝕜 (fun x ↦ f x * g x) s :=
fun _ m ↦ (hf _ m).mul (hg _ m)
/-- Powers of analytic functions (into a normed `𝕜`-algebra) are analytic. -/
lemma AnalyticWithinAt.fun_pow {f : E → A} {z : E} {s : Set E} (hf : AnalyticWithinAt 𝕜 f s z)
(n : ℕ) :
AnalyticWithinAt 𝕜 (fun x ↦ f x ^ n) s z := by
induction n with
| zero =>
simp only [pow_zero]
apply analyticWithinAt_const
| succ m hm =>
simp only [pow_succ]
exact hm.mul hf
/-- Powers of analytic functions (into a normed `𝕜`-algebra) are analytic. -/
lemma AnalyticWithinAt.pow {f : E → A} {z : E} {s : Set E} (hf : AnalyticWithinAt 𝕜 f s z)
(n : ℕ) :
AnalyticWithinAt 𝕜 (f ^ n) s z :=
AnalyticWithinAt.fun_pow hf n
/-- Powers of analytic functions (into a normed `𝕜`-algebra) are analytic. -/
@[fun_prop]
lemma AnalyticAt.fun_pow {f : E → A} {z : E} (hf : AnalyticAt 𝕜 f z) (n : ℕ) :
AnalyticAt 𝕜 (fun x ↦ f x ^ n) z := by
rw [← analyticWithinAt_univ] at hf ⊢
exact hf.pow n
/-- Powers of analytic functions (into a normed `𝕜`-algebra) are analytic. -/
@[fun_prop]
lemma AnalyticAt.pow {f : E → A} {z : E} (hf : AnalyticAt 𝕜 f z) (n : ℕ) :
AnalyticAt 𝕜 (f ^ n) z :=
AnalyticAt.fun_pow hf n
/-- Powers of analytic functions (into a normed `𝕜`-algebra) are analytic. -/
lemma AnalyticOn.fun_pow {f : E → A} {s : Set E} (hf : AnalyticOn 𝕜 f s) (n : ℕ) :
AnalyticOn 𝕜 (fun x ↦ f x ^ n) s :=
fun _ m ↦ (hf _ m).pow n
/-- Powers of analytic functions (into a normed `𝕜`-algebra) are analytic. -/
lemma AnalyticOn.pow {f : E → A} {s : Set E} (hf : AnalyticOn 𝕜 f s) (n : ℕ) :
AnalyticOn 𝕜 (f ^ n) s :=
fun _ m ↦ (hf _ m).pow n
/-- Powers of analytic functions (into a normed `𝕜`-algebra) are analytic. -/
lemma AnalyticOnNhd.fun_pow {f : E → A} {s : Set E} (hf : AnalyticOnNhd 𝕜 f s) (n : ℕ) :
AnalyticOnNhd 𝕜 (fun x ↦ f x ^ n) s :=
fun _ m ↦ (hf _ m).pow n
/-- Powers of analytic functions (into a normed `𝕜`-algebra) are analytic. -/
lemma AnalyticOnNhd.pow {f : E → A} {s : Set E} (hf : AnalyticOnNhd 𝕜 f s) (n : ℕ) :
AnalyticOnNhd 𝕜 (f ^ n) s :=
AnalyticOnNhd.fun_pow hf n
/-- ZPowers of analytic functions (into a normed field over `𝕜`) are analytic if the exponent is
nonnegative. -/
lemma AnalyticWithinAt.fun_zpow_nonneg {f : E → 𝕝} {z : E} {s : Set E} {n : ℤ}
(hf : AnalyticWithinAt 𝕜 f s z) (hn : 0 ≤ n) :
AnalyticWithinAt 𝕜 (fun x ↦ f x ^ n) s z := by
simpa [← zpow_natCast, hn] using hf.pow n.toNat
/-- ZPowers of analytic functions (into a normed field over `𝕜`) are analytic if the exponent is
nonnegative. -/
lemma AnalyticWithinAt.zpow_nonneg {f : E → 𝕝} {z : E} {s : Set E} {n : ℤ}
(hf : AnalyticWithinAt 𝕜 f s z) (hn : 0 ≤ n) :
AnalyticWithinAt 𝕜 (f ^ n) s z :=
fun_zpow_nonneg hf hn
/-- ZPowers of analytic functions (into a normed field over `𝕜`) are analytic if the exponent is
nonnegative. -/
lemma AnalyticAt.fun_zpow_nonneg {f : E → 𝕝} {z : E} {n : ℤ} (hf : AnalyticAt 𝕜 f z) (hn : 0 ≤ n) :
AnalyticAt 𝕜 (fun x ↦ f x ^ n) z := by
simpa [← zpow_natCast, hn] using hf.pow n.toNat
/-- ZPowers of analytic functions (into a normed field over `𝕜`) are analytic if the exponent is
nonnegative. -/
lemma AnalyticAt.zpow_nonneg {f : E → 𝕝} {z : E} {n : ℤ} (hf : AnalyticAt 𝕜 f z) (hn : 0 ≤ n) :
AnalyticAt 𝕜 (f ^ n) z :=
fun_zpow_nonneg hf hn
/-- ZPowers of analytic functions (into a normed field over `𝕜`) are analytic if the exponent is
nonnegative. -/
lemma AnalyticOn.fun_zpow_nonneg {f : E → 𝕝} {s : Set E} {n : ℤ} (hf : AnalyticOn 𝕜 f s)
(hn : 0 ≤ n) :
AnalyticOn 𝕜 (fun x ↦ f x ^ n) s := by
simpa [← zpow_natCast, hn] using hf.pow n.toNat
/-- ZPowers of analytic functions (into a normed field over `𝕜`) are analytic if the exponent is
nonnegative. -/
lemma AnalyticOn.zpow_nonneg {f : E → 𝕝} {s : Set E} {n : ℤ} (hf : AnalyticOn 𝕜 f s)
(hn : 0 ≤ n) :
AnalyticOn 𝕜 (f ^ n) s :=
fun_zpow_nonneg hf hn
/-- ZPowers of analytic functions (into a normed field over `𝕜`) are analytic if the exponent is
nonnegative. -/
lemma AnalyticOnNhd.fun_zpow_nonneg {f : E → 𝕝} {s : Set E} {n : ℤ} (hf : AnalyticOnNhd 𝕜 f s)
(hn : 0 ≤ n) :
AnalyticOnNhd 𝕜 (fun x ↦ f x ^ n) s := by
simp_rw [(Eq.symm (Int.toNat_of_nonneg hn) : n = OfNat.ofNat n.toNat), zpow_ofNat]
apply pow hf
/-- ZPowers of analytic functions (into a normed field over `𝕜`) are analytic if the exponent is
nonnegative. -/
lemma AnalyticOnNhd.zpow_nonneg {f : E → 𝕝} {s : Set E} {n : ℤ} (hf : AnalyticOnNhd 𝕜 f s)
(hn : 0 ≤ n) :
AnalyticOnNhd 𝕜 (f ^ n) s :=
fun_zpow_nonneg hf hn
/-!
### Restriction of scalars
-/
section
variable {𝕜' : Type*} [NontriviallyNormedField 𝕜'] [NormedAlgebra 𝕜 𝕜']
[NormedSpace 𝕜' E] [IsScalarTower 𝕜 𝕜' E]
[NormedSpace 𝕜' F] [IsScalarTower 𝕜 𝕜' F]
{f : E → F} {p : FormalMultilinearSeries 𝕜' E F} {x : E} {s : Set E} {r : ℝ≥0∞}
lemma HasFPowerSeriesWithinOnBall.restrictScalars (hf : HasFPowerSeriesWithinOnBall f p s x r) :
HasFPowerSeriesWithinOnBall f (p.restrictScalars 𝕜) s x r :=
⟨hf.r_le.trans (FormalMultilinearSeries.radius_le_of_le (fun n ↦ by simp)), hf.r_pos, hf.hasSum⟩
lemma HasFPowerSeriesOnBall.restrictScalars (hf : HasFPowerSeriesOnBall f p x r) :
HasFPowerSeriesOnBall f (p.restrictScalars 𝕜) x r :=
⟨hf.r_le.trans (FormalMultilinearSeries.radius_le_of_le (fun n ↦ by simp)), hf.r_pos, hf.hasSum⟩
lemma HasFPowerSeriesWithinAt.restrictScalars (hf : HasFPowerSeriesWithinAt f p s x) :
HasFPowerSeriesWithinAt f (p.restrictScalars 𝕜) s x := by
rcases hf with ⟨r, hr⟩
exact ⟨r, hr.restrictScalars⟩
lemma HasFPowerSeriesAt.restrictScalars (hf : HasFPowerSeriesAt f p x) :
HasFPowerSeriesAt f (p.restrictScalars 𝕜) x := by
rcases hf with ⟨r, hr⟩
exact ⟨r, hr.restrictScalars⟩
lemma AnalyticWithinAt.restrictScalars (hf : AnalyticWithinAt 𝕜' f s x) :
AnalyticWithinAt 𝕜 f s x := by
rcases hf with ⟨p, hp⟩
exact ⟨p.restrictScalars 𝕜, hp.restrictScalars⟩
lemma AnalyticAt.restrictScalars (hf : AnalyticAt 𝕜' f x) :
AnalyticAt 𝕜 f x := by
rcases hf with ⟨p, hp⟩
exact ⟨p.restrictScalars 𝕜, hp.restrictScalars⟩
lemma AnalyticOn.restrictScalars (hf : AnalyticOn 𝕜' f s) :
AnalyticOn 𝕜 f s :=
fun x hx ↦ (hf x hx).restrictScalars
lemma AnalyticOnNhd.restrictScalars (hf : AnalyticOnNhd 𝕜' f s) :
AnalyticOnNhd 𝕜 f s :=
fun x hx ↦ (hf x hx).restrictScalars
end
/-!
### Inversion is analytic
-/
section Geometric
variable (𝕜 A : Type*) [NontriviallyNormedField 𝕜] [NormedRing A] [NormedAlgebra 𝕜 A]
/-- The geometric series `1 + x + x ^ 2 + ...` as a `FormalMultilinearSeries`. -/
def formalMultilinearSeries_geometric : FormalMultilinearSeries 𝕜 A A :=
fun n ↦ ContinuousMultilinearMap.mkPiAlgebraFin 𝕜 n A
/-- The geometric series as an `ofScalars` series. -/
theorem formalMultilinearSeries_geometric_eq_ofScalars :
formalMultilinearSeries_geometric 𝕜 A =
FormalMultilinearSeries.ofScalars A fun _ ↦ (1 : 𝕜) := by
simp_rw [FormalMultilinearSeries.ext_iff, FormalMultilinearSeries.ofScalars,
formalMultilinearSeries_geometric, one_smul, implies_true]
lemma formalMultilinearSeries_geometric_apply_norm_le (n : ℕ) :
‖formalMultilinearSeries_geometric 𝕜 A n‖ ≤ max 1 ‖(1 : A)‖ :=
ContinuousMultilinearMap.norm_mkPiAlgebraFin_le
lemma formalMultilinearSeries_geometric_apply_norm [NormOneClass A] (n : ℕ) :
‖formalMultilinearSeries_geometric 𝕜 A n‖ = 1 :=
ContinuousMultilinearMap.norm_mkPiAlgebraFin
end Geometric
lemma one_le_formalMultilinearSeries_geometric_radius (𝕜 : Type*) [NontriviallyNormedField 𝕜]
(A : Type*) [NormedRing A] [NormedAlgebra 𝕜 A] :
1 ≤ (formalMultilinearSeries_geometric 𝕜 A).radius := by
convert formalMultilinearSeries_geometric_eq_ofScalars 𝕜 A ▸
FormalMultilinearSeries.ofScalars_radius_ge_inv_of_tendsto A _ one_ne_zero (by simp) |>.le
simp
lemma formalMultilinearSeries_geometric_radius (𝕜 : Type*) [NontriviallyNormedField 𝕜]
(A : Type*) [NormedRing A] [NormOneClass A] [NormedAlgebra 𝕜 A] :
(formalMultilinearSeries_geometric 𝕜 A).radius = 1 :=
formalMultilinearSeries_geometric_eq_ofScalars 𝕜 A ▸
FormalMultilinearSeries.ofScalars_radius_eq_of_tendsto A _ one_ne_zero (by simp)
lemma hasFPowerSeriesOnBall_inverse_one_sub
(𝕜 : Type*) [NontriviallyNormedField 𝕜]
(A : Type*) [NormedRing A] [NormedAlgebra 𝕜 A] [HasSummableGeomSeries A] :
HasFPowerSeriesOnBall (fun x : A ↦ Ring.inverse (1 - x))
(formalMultilinearSeries_geometric 𝕜 A) 0 1 := by
constructor
· exact one_le_formalMultilinearSeries_geometric_radius 𝕜 A
· exact one_pos
· intro y hy
simp only [EMetric.mem_ball, edist_dist, dist_zero_right, ofReal_lt_one] at hy
simp only [zero_add, NormedRing.inverse_one_sub _ hy, Units.oneSub, Units.inv_mk,
formalMultilinearSeries_geometric, ContinuousMultilinearMap.mkPiAlgebraFin_apply,
List.ofFn_const, List.prod_replicate]
exact (summable_geometric_of_norm_lt_one hy).hasSum
@[fun_prop]
lemma analyticAt_inverse_one_sub (𝕜 : Type*) [NontriviallyNormedField 𝕜]
(A : Type*) [NormedRing A] [NormedAlgebra 𝕜 A] [HasSummableGeomSeries A] :
AnalyticAt 𝕜 (fun x : A ↦ Ring.inverse (1 - x)) 0 :=
⟨_, ⟨_, hasFPowerSeriesOnBall_inverse_one_sub 𝕜 A⟩⟩
/-- If `A` is a normed algebra over `𝕜` with summable geometric series, then inversion on `A` is
analytic at any unit. -/
@[fun_prop]
lemma analyticAt_inverse {𝕜 : Type*} [NontriviallyNormedField 𝕜]
{A : Type*} [NormedRing A] [NormedAlgebra 𝕜 A] [HasSummableGeomSeries A] (z : Aˣ) :
AnalyticAt 𝕜 Ring.inverse (z : A) := by
rcases subsingleton_or_nontrivial A with hA|hA
· convert analyticAt_const (v := (0 : A))
· let f1 : A → A := fun a ↦ a * z.inv
let f2 : A → A := fun b ↦ Ring.inverse (1 - b)
let f3 : A → A := fun c ↦ 1 - z.inv * c
have feq : ∀ᶠ y in 𝓝 (z : A), (f1 ∘ f2 ∘ f3) y = Ring.inverse y := by
have : Metric.ball (z : A) (‖(↑z⁻¹ : A)‖⁻¹) ∈ 𝓝 (z : A) := by
apply Metric.ball_mem_nhds
simp
filter_upwards [this] with y hy
simp only [Metric.mem_ball, dist_eq_norm] at hy
have : y = Units.ofNearby z y hy := rfl
rw [this, Eq.comm]
simp only [Ring.inverse_unit, Function.comp_apply]
simp [Units.ofNearby, f1, f2, f3, Units.add, _root_.mul_sub]
rw [← Ring.inverse_unit]
congr
simp
apply AnalyticAt.congr _ feq
apply (analyticAt_id.mul analyticAt_const).comp
apply AnalyticAt.comp
· simp only [Units.inv_eq_val_inv, Units.inv_mul, sub_self, f2, f3]
exact analyticAt_inverse_one_sub 𝕜 A
· exact analyticAt_const.sub (analyticAt_const.mul analyticAt_id)
lemma analyticOnNhd_inverse {𝕜 : Type*} [NontriviallyNormedField 𝕜]
{A : Type*} [NormedRing A] [NormedAlgebra 𝕜 A] [HasSummableGeomSeries A] :
AnalyticOnNhd 𝕜 Ring.inverse {x : A | IsUnit x} :=
fun _ hx ↦ analyticAt_inverse (IsUnit.unit hx)
lemma hasFPowerSeriesOnBall_inv_one_sub
(𝕜 𝕝 : Type*) [NontriviallyNormedField 𝕜] [NontriviallyNormedField 𝕝] [NormedAlgebra 𝕜 𝕝] :
HasFPowerSeriesOnBall (fun x : 𝕝 ↦ (1 - x)⁻¹) (formalMultilinearSeries_geometric 𝕜 𝕝) 0 1 := by
convert hasFPowerSeriesOnBall_inverse_one_sub 𝕜 𝕝
exact Ring.inverse_eq_inv'.symm
@[fun_prop]
lemma analyticAt_inv_one_sub (𝕝 : Type*) [NontriviallyNormedField 𝕝] [NormedAlgebra 𝕜 𝕝] :
AnalyticAt 𝕜 (fun x : 𝕝 ↦ (1 - x)⁻¹) 0 :=
⟨_, ⟨_, hasFPowerSeriesOnBall_inv_one_sub 𝕜 𝕝⟩⟩
/-- If `𝕝` is a normed field extension of `𝕜`, then the inverse map `𝕝 → 𝕝` is `𝕜`-analytic
away from 0. -/
@[fun_prop]
lemma analyticAt_inv {z : 𝕝} (hz : z ≠ 0) : AnalyticAt 𝕜 Inv.inv z := by
convert analyticAt_inverse (𝕜 := 𝕜) (Units.mk0 _ hz)
exact Ring.inverse_eq_inv'.symm
/-- `x⁻¹` is analytic away from zero -/
lemma analyticOnNhd_inv : AnalyticOnNhd 𝕜 (fun z ↦ z⁻¹) {z : 𝕝 | z ≠ 0} := by
intro z m; exact analyticAt_inv m
lemma analyticOn_inv : AnalyticOn 𝕜 (fun z ↦ z⁻¹) {z : 𝕝 | z ≠ 0} :=
analyticOnNhd_inv.analyticOn
/-- `(f x)⁻¹` is analytic away from `f x = 0` -/
theorem AnalyticWithinAt.fun_inv {f : E → 𝕝} {x : E} {s : Set E} (fa : AnalyticWithinAt 𝕜 f s x)
(f0 : f x ≠ 0) :
AnalyticWithinAt 𝕜 (fun x ↦ (f x)⁻¹) s x :=
(analyticAt_inv f0).comp_analyticWithinAt fa
/-- `(f x)⁻¹` is analytic away from `f x = 0` -/
theorem AnalyticWithinAt.inv {f : E → 𝕝} {x : E} {s : Set E} (fa : AnalyticWithinAt 𝕜 f s x)
(f0 : f x ≠ 0) :
AnalyticWithinAt 𝕜 f⁻¹ s x :=
fun_inv fa f0
/-- `(f x)⁻¹` is analytic away from `f x = 0` -/
@[fun_prop]
theorem AnalyticAt.fun_inv {f : E → 𝕝} {x : E} (fa : AnalyticAt 𝕜 f x) (f0 : f x ≠ 0) :
AnalyticAt 𝕜 (fun x ↦ (f x)⁻¹) x :=
(analyticAt_inv f0).comp fa
/-- `(f x)⁻¹` is analytic away from `f x = 0` -/
@[fun_prop]
theorem AnalyticAt.inv {f : E → 𝕝} {x : E} (fa : AnalyticAt 𝕜 f x) (f0 : f x ≠ 0) :
AnalyticAt 𝕜 f⁻¹ x :=
fa.fun_inv f0
/-- `(f x)⁻¹` is analytic away from `f x = 0` -/
theorem AnalyticOn.fun_inv {f : E → 𝕝} {s : Set E} (fa : AnalyticOn 𝕜 f s) (f0 : ∀ x ∈ s, f x ≠ 0) :
AnalyticOn 𝕜 (fun x ↦ (f x)⁻¹) s :=
fun x m ↦ (fa x m).inv (f0 x m)
/-- `(f x)⁻¹` is analytic away from `f x = 0` -/
theorem AnalyticOn.inv {f : E → 𝕝} {s : Set E} (fa : AnalyticOn 𝕜 f s) (f0 : ∀ x ∈ s, f x ≠ 0) :
AnalyticOn 𝕜 f⁻¹ s :=
fun_inv fa f0
/-- `(f x)⁻¹` is analytic away from `f x = 0` -/
theorem AnalyticOnNhd.fun_inv {f : E → 𝕝} {s : Set E} (fa : AnalyticOnNhd 𝕜 f s)
(f0 : ∀ x ∈ s, f x ≠ 0) :
AnalyticOnNhd 𝕜 (fun x ↦ (f x)⁻¹) s :=
fun x m ↦ (fa x m).inv (f0 x m)
/-- `(f x)⁻¹` is analytic away from `f x = 0` -/
theorem AnalyticOnNhd.inv {f : E → 𝕝} {s : Set E} (fa : AnalyticOnNhd 𝕜 f s)
(f0 : ∀ x ∈ s, f x ≠ 0) :
AnalyticOnNhd 𝕜 f⁻¹ s :=
fun_inv fa f0
/-- ZPowers of analytic functions (into a normed field over `𝕜`) are analytic away from the zeros.
-/
lemma AnalyticWithinAt.fun_zpow {f : E → 𝕝} {z : E} {s : Set E} {n : ℤ}
(h₁f : AnalyticWithinAt 𝕜 f s z) (h₂f : f z ≠ 0) :
AnalyticWithinAt 𝕜 (fun x ↦ f x ^ n) s z := by
by_cases hn : 0 ≤ n
· exact zpow_nonneg h₁f hn
· rw [(Int.eq_neg_comm.mp rfl : n = - (- n))]
conv => arg 2; intro x; rw [zpow_neg]
exact (h₁f.zpow_nonneg (by linarith)).inv (zpow_ne_zero (-n) h₂f)
/-- ZPowers of analytic functions (into a normed field over `𝕜`) are analytic away from the zeros.
-/
lemma AnalyticWithinAt.zpow {f : E → 𝕝} {z : E} {s : Set E} {n : ℤ}
(h₁f : AnalyticWithinAt 𝕜 f s z) (h₂f : f z ≠ 0) :
AnalyticWithinAt 𝕜 (f ^ n) s z :=
fun_zpow h₁f h₂f
/-- ZPowers of analytic functions (into a normed field over `𝕜`) are analytic away from the zeros.
-/
lemma AnalyticAt.fun_zpow {f : E → 𝕝} {z : E} {n : ℤ} (h₁f : AnalyticAt 𝕜 f z) (h₂f : f z ≠ 0) :
AnalyticAt 𝕜 (fun x ↦ f x ^ n) z := by
by_cases hn : 0 ≤ n
· exact zpow_nonneg h₁f hn
· rw [(Int.eq_neg_comm.mp rfl : n = - (- n))]
conv => arg 2; intro x; rw [zpow_neg]
exact (h₁f.zpow_nonneg (by linarith)).inv (zpow_ne_zero (-n) h₂f)
/-- ZPowers of analytic functions (into a normed field over `𝕜`) are analytic away from the zeros.
-/
lemma AnalyticAt.zpow {f : E → 𝕝} {z : E} {n : ℤ} (h₁f : AnalyticAt 𝕜 f z) (h₂f : f z ≠ 0) :
AnalyticAt 𝕜 (f ^ n) z := by
exact fun_zpow h₁f h₂f
/-- ZPowers of analytic functions (into a normed field over `𝕜`) are analytic away from the zeros.
-/
lemma AnalyticOn.fun_zpow {f : E → 𝕝} {s : Set E} {n : ℤ} (h₁f : AnalyticOn 𝕜 f s)
(h₂f : ∀ z ∈ s, f z ≠ 0) :
AnalyticOn 𝕜 (fun x ↦ f x ^ n) s :=
fun z hz ↦ (h₁f z hz).zpow (h₂f z hz)
/-- ZPowers of analytic functions (into a normed field over `𝕜`) are analytic away from the zeros.
-/
lemma AnalyticOn.zpow {f : E → 𝕝} {s : Set E} {n : ℤ} (h₁f : AnalyticOn 𝕜 f s)
(h₂f : ∀ z ∈ s, f z ≠ 0) :
AnalyticOn 𝕜 (f ^ n) s := by
exact fun_zpow h₁f h₂f
/-- ZPowers of analytic functions (into a normed field over `𝕜`) are analytic away from the zeros.
-/
lemma AnalyticOnNhd.fun_zpow {f : E → 𝕝} {s : Set E} {n : ℤ} (h₁f : AnalyticOnNhd 𝕜 f s)
(h₂f : ∀ z ∈ s, f z ≠ 0) :
AnalyticOnNhd 𝕜 (fun x ↦ f x ^ n) s :=
fun z hz ↦ (h₁f z hz).zpow (h₂f z hz)
/-- ZPowers of analytic functions (into a normed field over `𝕜`) are analytic away from the zeros.
-/
lemma AnalyticOnNhd.zpow {f : E → 𝕝} {s : Set E} {n : ℤ} (h₁f : AnalyticOnNhd 𝕜 f s)
(h₂f : ∀ z ∈ s, f z ≠ 0) :
AnalyticOnNhd 𝕜 (f ^ n) s :=
fun_zpow h₁f h₂f
/- A function is analytic at a point iff it is analytic after scalar
multiplication with a non-vanishing analytic function. -/
theorem analyticAt_iff_analytic_fun_smul [NormedSpace 𝕝 F] [IsScalarTower 𝕜 𝕝 F] {f : E → 𝕝}
{g : E → F} {z : E} (h₁f : AnalyticAt 𝕜 f z) (h₂f : f z ≠ 0) :
AnalyticAt 𝕜 g z ↔ AnalyticAt 𝕜 (fun z ↦ f z • g z) z := by
constructor
· exact fun a ↦ h₁f.smul a
· intro hprod
rw [analyticAt_congr (g := (f⁻¹ • f) • g), smul_assoc]
· exact (h₁f.inv h₂f).fun_smul hprod
· filter_upwards [h₁f.continuousAt.preimage_mem_nhds (compl_singleton_mem_nhds_iff.2 h₂f)]
intro y hy
rw [Set.preimage_compl, Set.mem_compl_iff, Set.mem_preimage, Set.mem_singleton_iff] at hy
simp [hy]
/- A function is analytic at a point iff it is analytic after scalar
multiplication with a non-vanishing analytic function. -/
theorem analyticAt_iff_analytic_smul [NormedSpace 𝕝 F] [IsScalarTower 𝕜 𝕝 F] {f : E → 𝕝}
{g : E → F} {z : E} (h₁f : AnalyticAt 𝕜 f z) (h₂f : f z ≠ 0) :
AnalyticAt 𝕜 g z ↔ AnalyticAt 𝕜 (f • g) z :=
analyticAt_iff_analytic_fun_smul h₁f h₂f
/- A function is analytic at a point iff it is analytic after multiplication
with a non-vanishing analytic function. -/
theorem analyticAt_iff_analytic_fun_mul {f g : E → 𝕝} {z : E} (h₁f : AnalyticAt 𝕜 f z)
(h₂f : f z ≠ 0) :
AnalyticAt 𝕜 g z ↔ AnalyticAt 𝕜 (fun z ↦ f z * g z) z := by
simp_rw [← smul_eq_mul]
exact analyticAt_iff_analytic_smul h₁f h₂f
/- A function is analytic at a point iff it is analytic after multiplication
with a non-vanishing analytic function. -/
theorem analyticAt_iff_analytic_mul {f g : E → 𝕝} {z : E} (h₁f : AnalyticAt 𝕜 f z)
(h₂f : f z ≠ 0) :
AnalyticAt 𝕜 g z ↔ AnalyticAt 𝕜 (f * g) z :=
analyticAt_iff_analytic_fun_mul h₁f h₂f
/-- `f x / g x` is analytic away from `g x = 0` -/
theorem AnalyticWithinAt.div {f g : E → 𝕝} {s : Set E} {x : E}
(fa : AnalyticWithinAt 𝕜 f s x) (ga : AnalyticWithinAt 𝕜 g s x) (g0 : g x ≠ 0) :
AnalyticWithinAt 𝕜 (fun x ↦ f x / g x) s x := by
simp_rw [div_eq_mul_inv]; exact fa.mul (ga.inv g0)
/-- `f x / g x` is analytic away from `g x = 0` -/
@[fun_prop]
theorem AnalyticAt.fun_div {f g : E → 𝕝} {x : E}
(fa : AnalyticAt 𝕜 f x) (ga : AnalyticAt 𝕜 g x) (g0 : g x ≠ 0) :
AnalyticAt 𝕜 (fun x ↦ f x / g x) x := by
simp_rw [div_eq_mul_inv]; exact fa.mul (ga.inv g0)
@[fun_prop]
theorem AnalyticAt.div {f g : E → 𝕝} {x : E}
(fa : AnalyticAt 𝕜 f x) (ga : AnalyticAt 𝕜 g x) (g0 : g x ≠ 0) :
AnalyticAt 𝕜 (f / g) x :=
fa.fun_div ga g0
/-- `f x / g x` is analytic away from `g x = 0` -/
theorem AnalyticOn.div {f g : E → 𝕝} {s : Set E}
(fa : AnalyticOn 𝕜 f s) (ga : AnalyticOn 𝕜 g s) (g0 : ∀ x ∈ s, g x ≠ 0) :
AnalyticOn 𝕜 (fun x ↦ f x / g x) s := fun x m ↦
(fa x m).div (ga x m) (g0 x m)
/-- `f x / g x` is analytic away from `g x = 0` -/
theorem AnalyticOnNhd.div {f g : E → 𝕝} {s : Set E}
(fa : AnalyticOnNhd 𝕜 f s) (ga : AnalyticOnNhd 𝕜 g s) (g0 : ∀ x ∈ s, g x ≠ 0) :
AnalyticOnNhd 𝕜 (fun x ↦ f x / g x) s := fun x m ↦
(fa x m).div (ga x m) (g0 x m)
/-!
### Finite sums and products of analytic functions
-/
/-- Finite sums of analytic functions are analytic -/
theorem Finset.analyticWithinAt_fun_sum {f : α → E → F} {c : E} {s : Set E}
(N : Finset α) (h : ∀ n ∈ N, AnalyticWithinAt 𝕜 (f n) s c) :
AnalyticWithinAt 𝕜 (fun z ↦ ∑ n ∈ N, f n z) s c := by
classical
induction N using Finset.induction with
| empty =>
simp only [Finset.sum_empty]
exact analyticWithinAt_const
| insert a B aB hB =>
simp_rw [Finset.sum_insert aB]
simp only [Finset.mem_insert] at h
exact (h a (Or.inl rfl)).add (hB fun b m ↦ h b (Or.inr m))
/-- Finite sums of analytic functions are analytic -/
theorem Finset.analyticWithinAt_sum {f : α → E → F} {c : E} {s : Set E}
(N : Finset α) (h : ∀ n ∈ N, AnalyticWithinAt 𝕜 (f n) s c) :
AnalyticWithinAt 𝕜 (∑ n ∈ N, f n) s c := by
convert N.analyticWithinAt_fun_sum h
simp
/-- Finite sums of analytic functions are analytic -/
@[fun_prop]
theorem Finset.analyticAt_fun_sum {f : α → E → F} {c : E}
(N : Finset α) (h : ∀ n ∈ N, AnalyticAt 𝕜 (f n) c) :
AnalyticAt 𝕜 (fun z ↦ ∑ n ∈ N, f n z) c := by
simp_rw [← analyticWithinAt_univ] at h ⊢
exact N.analyticWithinAt_fun_sum h
/-- Finite sums of analytic functions are analytic -/
@[fun_prop]
theorem Finset.analyticAt_sum {f : α → E → F} {c : E}
(N : Finset α) (h : ∀ n ∈ N, AnalyticAt 𝕜 (f n) c) :
AnalyticAt 𝕜 (∑ n ∈ N, f n) c := by
convert N.analyticAt_fun_sum h
simp
/-- Finite sums of analytic functions are analytic -/
theorem Finset.analyticOn_fun_sum {f : α → E → F} {s : Set E}
(N : Finset α) (h : ∀ n ∈ N, AnalyticOn 𝕜 (f n) s) :
AnalyticOn 𝕜 (fun z ↦ ∑ n ∈ N, f n z) s :=
fun z zs ↦ N.analyticWithinAt_fun_sum (fun n m ↦ h n m z zs)
/-- Finite sums of analytic functions are analytic -/
theorem Finset.analyticOn_sum {f : α → E → F} {s : Set E}
(N : Finset α) (h : ∀ n ∈ N, AnalyticOn 𝕜 (f n) s) :
AnalyticOn 𝕜 (∑ n ∈ N, f n) s :=
fun z zs ↦ N.analyticWithinAt_sum (fun n m ↦ h n m z zs)
/-- Finite sums of analytic functions are analytic -/
theorem Finset.analyticOnNhd_fun_sum {f : α → E → F} {s : Set E}
(N : Finset α) (h : ∀ n ∈ N, AnalyticOnNhd 𝕜 (f n) s) :
AnalyticOnNhd 𝕜 (fun z ↦ ∑ n ∈ N, f n z) s :=
fun z zs ↦ N.analyticAt_fun_sum (fun n m ↦ h n m z zs)
/-- Finite sums of analytic functions are analytic -/
theorem Finset.analyticOnNhd_sum {f : α → E → F} {s : Set E}
(N : Finset α) (h : ∀ n ∈ N, AnalyticOnNhd 𝕜 (f n) s) :
AnalyticOnNhd 𝕜 (∑ n ∈ N, f n) s :=
fun z zs ↦ N.analyticAt_sum (fun n m ↦ h n m z zs)
/-- Finite products of analytic functions are analytic -/
theorem Finset.analyticWithinAt_fun_prod {A : Type*} [NormedCommRing A] [NormedAlgebra 𝕜 A]
{f : α → E → A} {c : E} {s : Set E} (N : Finset α) (h : ∀ n ∈ N, AnalyticWithinAt 𝕜 (f n) s c) :
AnalyticWithinAt 𝕜 (fun z ↦ ∏ n ∈ N, f n z) s c := by
classical
induction N using Finset.induction with
| empty =>
simp only [Finset.prod_empty]
exact analyticWithinAt_const
| insert a B aB hB =>
simp_rw [Finset.prod_insert aB]
simp only [Finset.mem_insert] at h
exact (h a (Or.inl rfl)).mul (hB fun b m ↦ h b (Or.inr m))
/-- Finite products of analytic functions are analytic -/
theorem Finset.analyticWithinAt_prod {A : Type*} [NormedCommRing A] [NormedAlgebra 𝕜 A]
{f : α → E → A} {c : E} {s : Set E} (N : Finset α) (h : ∀ n ∈ N, AnalyticWithinAt 𝕜 (f n) s c) :
AnalyticWithinAt 𝕜 (∏ n ∈ N, f n) s c := by
convert N.analyticWithinAt_fun_prod h
simp
/-- Finite products of analytic functions are analytic -/
@[fun_prop]
theorem Finset.analyticAt_fun_prod {A : Type*} [NormedCommRing A] [NormedAlgebra 𝕜 A]
{f : α → E → A} {c : E} (N : Finset α) (h : ∀ n ∈ N, AnalyticAt 𝕜 (f n) c) :
AnalyticAt 𝕜 (fun z ↦ ∏ n ∈ N, f n z) c := by
simp_rw [← analyticWithinAt_univ] at h ⊢
exact N.analyticWithinAt_fun_prod h
/-- Finite products of analytic functions are analytic -/
@[fun_prop]
theorem Finset.analyticAt_prod {α : Type*} {A : Type*} [NormedCommRing A] [NormedAlgebra 𝕜 A]
{f : α → E → A} {c : E} (N : Finset α) (h : ∀ n ∈ N, AnalyticAt 𝕜 (f n) c) :
AnalyticAt 𝕜 (∏ n ∈ N, f n) c := by
convert N.analyticAt_fun_prod h
simp
/-- Finite products of analytic functions are analytic -/
theorem Finset.analyticOn_fun_prod {A : Type*} [NormedCommRing A] [NormedAlgebra 𝕜 A]
{f : α → E → A} {s : Set E} (N : Finset α) (h : ∀ n ∈ N, AnalyticOn 𝕜 (f n) s) :
AnalyticOn 𝕜 (fun z ↦ ∏ n ∈ N, f n z) s :=
fun z zs ↦ N.analyticWithinAt_fun_prod (fun n m ↦ h n m z zs)
/-- Finite products of analytic functions are analytic -/
theorem Finset.analyticOn_prod {A : Type*} [NormedCommRing A] [NormedAlgebra 𝕜 A]
{f : α → E → A} {s : Set E} (N : Finset α) (h : ∀ n ∈ N, AnalyticOn 𝕜 (f n) s) :
AnalyticOn 𝕜 (∏ n ∈ N, f n) s :=
fun z zs ↦ N.analyticWithinAt_prod (fun n m ↦ h n m z zs)
/-- Finite products of analytic functions are analytic -/
theorem Finset.analyticOnNhd_fun_prod {A : Type*} [NormedCommRing A] [NormedAlgebra 𝕜 A]
{f : α → E → A} {s : Set E} (N : Finset α) (h : ∀ n ∈ N, AnalyticOnNhd 𝕜 (f n) s) :
AnalyticOnNhd 𝕜 (fun z ↦ ∏ n ∈ N, f n z) s :=
fun z zs ↦ N.analyticAt_fun_prod (fun n m ↦ h n m z zs)
/-- Finite products of analytic functions are analytic -/
theorem Finset.analyticOnNhd_prod {A : Type*} [NormedCommRing A] [NormedAlgebra 𝕜 A]
{f : α → E → A} {s : Set E} (N : Finset α) (h : ∀ n ∈ N, AnalyticOnNhd 𝕜 (f n) s) :
AnalyticOnNhd 𝕜 (∏ n ∈ N, f n) s :=
fun z zs ↦ N.analyticAt_prod (fun n m ↦ h n m z zs)
/-- Finproducts of analytic functions are analytic -/
@[fun_prop]
theorem analyticAt_finprod {α : Type*} {A : Type*} [NormedCommRing A] [NormedAlgebra 𝕜 A]
{f : α → E → A} {c : E} (h : ∀ a, AnalyticAt 𝕜 (f a) c) :
AnalyticAt 𝕜 (∏ᶠ n, f n) c := by
by_cases hf : (Function.mulSupport f).Finite
· simp_all [finprod_eq_prod _ hf, Finset.analyticAt_prod]
· rw [finprod_of_infinite_mulSupport hf]
apply analyticAt_const
/-!
### Unshifting
-/
section
variable {f : E → (E →L[𝕜] F)} {pf : FormalMultilinearSeries 𝕜 E (E →L[𝕜] F)} {s : Set E} {x : E}
{r : ℝ≥0∞} {z : F}
theorem HasFPowerSeriesWithinOnBall.unshift (hf : HasFPowerSeriesWithinOnBall f pf s x r) :
HasFPowerSeriesWithinOnBall (fun y ↦ z + f y (y - x)) (pf.unshift z) s x r where
r_le := by
rw [FormalMultilinearSeries.radius_unshift]
exact hf.r_le
r_pos := hf.r_pos
hasSum := by
intro y hy h'y
apply HasSum.zero_add
simp only [FormalMultilinearSeries.unshift, Nat.succ_eq_add_one,
continuousMultilinearCurryRightEquiv_symm_apply', add_sub_cancel_left]
exact (ContinuousLinearMap.apply 𝕜 F y).hasSum (hf.hasSum hy h'y)
theorem HasFPowerSeriesOnBall.unshift (hf : HasFPowerSeriesOnBall f pf x r) :
HasFPowerSeriesOnBall (fun y ↦ z + f y (y - x)) (pf.unshift z) x r where
r_le := by
rw [FormalMultilinearSeries.radius_unshift]
exact hf.r_le
r_pos := hf.r_pos
hasSum := by
intro y hy
apply HasSum.zero_add
simp only [FormalMultilinearSeries.unshift, Nat.succ_eq_add_one,
continuousMultilinearCurryRightEquiv_symm_apply', add_sub_cancel_left]
exact (ContinuousLinearMap.apply 𝕜 F y).hasSum (hf.hasSum hy)
theorem HasFPowerSeriesWithinAt.unshift (hf : HasFPowerSeriesWithinAt f pf s x) :
HasFPowerSeriesWithinAt (fun y ↦ z + f y (y - x)) (pf.unshift z) s x :=
let ⟨_, hrf⟩ := hf
hrf.unshift.hasFPowerSeriesWithinAt
end
/-!
### Composition with a linear map
-/
section compContinuousLinearMap
variable {u : E →L[𝕜] F} {f : F → G} {pf : FormalMultilinearSeries 𝕜 F G} {s : Set F} {x : E}
{r : ℝ≥0∞}
theorem HasFPowerSeriesWithinOnBall.compContinuousLinearMap
(hf : HasFPowerSeriesWithinOnBall f pf s (u x) r) :
HasFPowerSeriesWithinOnBall (f ∘ u) (pf.compContinuousLinearMap u) (u ⁻¹' s) x (r / ‖u‖ₑ) where
r_le := by
calc
_ ≤ pf.radius / ‖u‖ₑ := by
gcongr
exact hf.r_le
_ ≤ _ := pf.div_le_radius_compContinuousLinearMap _
r_pos := by
simp only [ENNReal.div_pos_iff, ne_eq, enorm_ne_top, not_false_eq_true, and_true]
exact pos_iff_ne_zero.mp hf.r_pos
hasSum hy1 hy2 := by
convert hf.hasSum _ _
· simp
· simp only [Set.mem_insert_iff, add_eq_left, Set.mem_preimage, map_add] at hy1 ⊢
rcases hy1 with (hy1 | hy1) <;> simp [hy1]
· simp only [EMetric.ball, edist_zero_right, Set.mem_setOf_eq] at hy2 ⊢
exact lt_of_le_of_lt (ContinuousLinearMap.le_opNorm_enorm _ _) (mul_lt_of_lt_div' hy2)
theorem HasFPowerSeriesOnBall.compContinuousLinearMap (hf : HasFPowerSeriesOnBall f pf (u x) r) :
HasFPowerSeriesOnBall (f ∘ u) (pf.compContinuousLinearMap u) x (r / ‖u‖ₑ) := by
rw [← hasFPowerSeriesWithinOnBall_univ] at hf ⊢
exact hf.compContinuousLinearMap
theorem HasFPowerSeriesAt.compContinuousLinearMap (hf : HasFPowerSeriesAt f pf (u x)) :
HasFPowerSeriesAt (f ∘ u) (pf.compContinuousLinearMap u) x :=
let ⟨r, hr⟩ := hf
⟨r / ‖u‖ₑ, hr.compContinuousLinearMap⟩
theorem HasFPowerSeriesWithinAt.compContinuousLinearMap
(hf : HasFPowerSeriesWithinAt f pf s (u x)) :
HasFPowerSeriesWithinAt (f ∘ u) (pf.compContinuousLinearMap u) (u ⁻¹' s) x :=
let ⟨r, hr⟩ := hf
⟨r / ‖u‖ₑ, hr.compContinuousLinearMap⟩
theorem AnalyticAt.compContinuousLinearMap (hf : AnalyticAt 𝕜 f (u x)) :
AnalyticAt 𝕜 (f ∘ u) x :=
let ⟨p, hp⟩ := hf
⟨p.compContinuousLinearMap u, hp.compContinuousLinearMap⟩
theorem AnalyticAtWithin.compContinuousLinearMap (hf : AnalyticWithinAt 𝕜 f s (u x)) :
AnalyticWithinAt 𝕜 (f ∘ u) (u ⁻¹' s) x :=
let ⟨p, hp⟩ := hf
⟨p.compContinuousLinearMap u, hp.compContinuousLinearMap⟩
theorem AnalyticOn.compContinuousLinearMap (hf : AnalyticOn 𝕜 f s) :
AnalyticOn 𝕜 (f ∘ u) (u ⁻¹' s) := fun x hx =>
AnalyticAtWithin.compContinuousLinearMap (hf (u x) hx)
theorem AnalyticOnNhd.compContinuousLinearMap (hf : AnalyticOnNhd 𝕜 f s) :
AnalyticOnNhd 𝕜 (f ∘ u) (u ⁻¹' s) := fun x hx =>
AnalyticAt.compContinuousLinearMap (hf (u x) hx)
end compContinuousLinearMap |
.lake/packages/mathlib/Mathlib/Analysis/Analytic/OfScalars.lean | import Mathlib.Analysis.Analytic.ConvergenceRadius
/-!
# Scalar series
This file contains API for analytic functions `∑ cᵢ • xⁱ` defined in terms of scalars
`c₀, c₁, c₂, …`.
## Main definitions / results:
* `FormalMultilinearSeries.ofScalars`: the formal power series `∑ cᵢ • xⁱ`.
* `FormalMultilinearSeries.ofScalarsSum`: the sum of such a power series, if it exists, and zero
otherwise.
* `FormalMultilinearSeries.ofScalars_radius_eq_(zero/inv/top)_of_tendsto`:
the ratio test for an analytic function defined in terms of a formal power series `∑ cᵢ • xⁱ`.
* `FormalMultilinearSeries.ofScalars_radius_eq_inv_of_tendsto_ENNReal`:
the ratio test for an analytic function using `ENNReal` division for all values `ℝ≥0∞`.
-/
namespace FormalMultilinearSeries
section Field
open ContinuousMultilinearMap
variable {𝕜 : Type*} (E : Type*) [Field 𝕜] [Ring E] [Algebra 𝕜 E] [TopologicalSpace E]
[IsTopologicalRing E] {c : ℕ → 𝕜}
/-- Formal power series of `∑ cᵢ • xⁱ` for some scalar field `𝕜` and ring algebra `E` -/
def ofScalars (c : ℕ → 𝕜) : FormalMultilinearSeries 𝕜 E E :=
fun n ↦ c n • ContinuousMultilinearMap.mkPiAlgebraFin 𝕜 n E
@[simp]
theorem ofScalars_eq_zero [Nontrivial E] (n : ℕ) : ofScalars E c n = 0 ↔ c n = 0 := by
rw [ofScalars, smul_eq_zero (c := c n) (x := ContinuousMultilinearMap.mkPiAlgebraFin 𝕜 n E)]
refine or_iff_left (ContinuousMultilinearMap.ext_iff.1.mt <| not_forall_of_exists_not ?_)
use fun _ ↦ 1
simp
@[simp]
theorem ofScalars_eq_zero_of_scalar_zero {n : ℕ} (hc : c n = 0) : ofScalars E c n = 0 := by
rw [ofScalars, hc, zero_smul 𝕜 (ContinuousMultilinearMap.mkPiAlgebraFin 𝕜 n E)]
@[simp]
theorem ofScalars_series_eq_zero [Nontrivial E] : ofScalars E c = 0 ↔ c = 0 := by
simp [FormalMultilinearSeries.ext_iff, funext_iff]
variable (𝕜) in
@[simp]
theorem ofScalars_series_eq_zero_of_scalar_zero : ofScalars E (0 : ℕ → 𝕜) = 0 := by
simp [FormalMultilinearSeries.ext_iff]
@[simp]
theorem ofScalars_series_of_subsingleton [Subsingleton E] : ofScalars E c = 0 := by
simp_rw [FormalMultilinearSeries.ext_iff, ofScalars, ContinuousMultilinearMap.ext_iff]
exact fun _ _ ↦ Subsingleton.allEq _ _
variable (𝕜) in
theorem ofScalars_series_injective [Nontrivial E] : Function.Injective (ofScalars E (𝕜 := 𝕜)) := by
intro _ _
refine Function.mtr fun h ↦ ?_
simp_rw [FormalMultilinearSeries.ext_iff, ofScalars, ContinuousMultilinearMap.ext_iff,
ContinuousMultilinearMap.smul_apply]
push_neg
obtain ⟨n, hn⟩ := Function.ne_iff.1 h
refine ⟨n, fun _ ↦ 1, ?_⟩
simp only [mkPiAlgebraFin_apply, List.ofFn_const, List.prod_replicate, one_pow, ne_eq]
exact (smul_left_injective 𝕜 one_ne_zero).ne hn
variable (c)
@[simp]
theorem ofScalars_series_eq_iff [Nontrivial E] (c' : ℕ → 𝕜) :
ofScalars E c = ofScalars E c' ↔ c = c' :=
⟨fun e => ofScalars_series_injective 𝕜 E e, _root_.congrArg _⟩
theorem ofScalars_apply_zero (n : ℕ) :
ofScalars E c n (fun _ => 0) = Pi.single (M := fun _ => E) 0 (c 0 • 1) n := by
rw [ofScalars]
cases n <;> simp
@[simp]
lemma coeff_ofScalars {𝕜 : Type*} [NontriviallyNormedField 𝕜] {p : ℕ → 𝕜} {n : ℕ} :
(FormalMultilinearSeries.ofScalars 𝕜 p).coeff n = p n := by
simp [FormalMultilinearSeries.coeff, FormalMultilinearSeries.ofScalars, List.prod_ofFn]
theorem ofScalars_add (c' : ℕ → 𝕜) : ofScalars E (c + c') = ofScalars E c + ofScalars E c' := by
unfold ofScalars
simp_rw [Pi.add_apply, Pi.add_def _ _]
exact funext fun n ↦ Module.add_smul (c n) (c' n) (ContinuousMultilinearMap.mkPiAlgebraFin 𝕜 n E)
theorem ofScalars_smul (x : 𝕜) : ofScalars E (x • c) = x • ofScalars E c := by
unfold ofScalars
simp [Pi.smul_def x _, smul_smul]
theorem ofScalars_comp_neg_id :
(ofScalars E c).compContinuousLinearMap (-ContinuousLinearMap.id _ _) =
(ofScalars E (fun k ↦ (-1) ^ k * c k)) := by
ext n
rcases n.even_or_odd with (h | h) <;>
simp [ofScalars, show ((-ContinuousLinearMap.id 𝕜 E : _) : E → E) = Neg.neg by rfl,
← List.map_ofFn, h.neg_one_pow]
theorem ofScalars_comp_neg (f : E →L[𝕜] E) :
(ofScalars E c).compContinuousLinearMap (-f) =
(ofScalars E (fun k ↦ (-1) ^ k * c k)).compContinuousLinearMap f := by
conv => lhs; rw [← ContinuousLinearMap.id_comp f, ← ContinuousLinearMap.neg_comp]
rw [← FormalMultilinearSeries.compContinuousLinearMap_comp, ofScalars_comp_neg_id]
variable (𝕜) in
/-- The submodule generated by scalar series on `FormalMultilinearSeries 𝕜 E E`. -/
def ofScalarsSubmodule : Submodule 𝕜 (FormalMultilinearSeries 𝕜 E E) where
carrier := {ofScalars E f | f}
add_mem' := fun ⟨c, hc⟩ ⟨c', hc'⟩ ↦ ⟨c + c', hc' ▸ hc ▸ ofScalars_add E c c'⟩
zero_mem' := ⟨0, ofScalars_series_eq_zero_of_scalar_zero 𝕜 E⟩
smul_mem' := fun x _ ⟨c, hc⟩ ↦ ⟨x • c, hc ▸ ofScalars_smul E c x⟩
variable {E}
theorem ofScalars_apply_eq (x : E) (n : ℕ) :
ofScalars E c n (fun _ ↦ x) = c n • x ^ n := by
simp [ofScalars]
/-- This naming follows the convention of `NormedSpace.expSeries_apply_eq'`. -/
theorem ofScalars_apply_eq' (x : E) :
(fun n ↦ ofScalars E c n (fun _ ↦ x)) = fun n ↦ c n • x ^ n := by
simp [ofScalars]
/-- The sum of the formal power series. Takes the value `0` outside the radius of convergence. -/
noncomputable def ofScalarsSum := (ofScalars E c).sum
theorem ofScalars_sum_eq (x : E) : ofScalarsSum c x =
∑' n, c n • x ^ n := tsum_congr fun n => ofScalars_apply_eq c x n
theorem ofScalarsSum_eq_tsum : ofScalarsSum c =
fun (x : E) => ∑' n : ℕ, c n • x ^ n := funext (ofScalars_sum_eq c)
@[simp]
theorem ofScalarsSum_zero : ofScalarsSum c (0 : E) = c 0 • 1 := by
simp [ofScalarsSum_eq_tsum, ← ofScalars_apply_eq, ofScalars_apply_zero]
@[simp]
theorem ofScalarsSum_of_subsingleton [Subsingleton E] {x : E} : ofScalarsSum c x = 0 := by
simp [Subsingleton.eq_zero x, Subsingleton.eq_zero (1 : E)]
@[simp]
theorem ofScalarsSum_op [T2Space E] (x : E) :
ofScalarsSum c (MulOpposite.op x) = MulOpposite.op (ofScalarsSum c x) := by
simp [ofScalars_sum_eq, ← MulOpposite.op_pow, ← MulOpposite.op_smul, tsum_op]
@[simp]
theorem ofScalarsSum_unop [T2Space E] (x : Eᵐᵒᵖ) :
ofScalarsSum c (MulOpposite.unop x) = MulOpposite.unop (ofScalarsSum c x) := by
simp [ofScalars_sum_eq, ← MulOpposite.unop_pow, ← MulOpposite.unop_smul, tsum_unop]
end Field
section Seminormed
open Filter ENNReal
open scoped Topology NNReal
variable {𝕜 : Type*} (E : Type*) [NontriviallyNormedField 𝕜] [SeminormedRing E]
[NormedAlgebra 𝕜 E] (c : ℕ → 𝕜) (n : ℕ)
theorem ofScalars_norm_eq_mul :
‖ofScalars E c n‖ = ‖c n‖ * ‖ContinuousMultilinearMap.mkPiAlgebraFin 𝕜 n E‖ := by
rw [ofScalars, norm_smul]
theorem ofScalars_norm_le (hn : n > 0) : ‖ofScalars E c n‖ ≤ ‖c n‖ := by
simp only [ofScalars_norm_eq_mul]
exact (mul_le_of_le_one_right (norm_nonneg _)
(ContinuousMultilinearMap.norm_mkPiAlgebraFin_le_of_pos hn))
@[simp]
theorem ofScalars_norm [NormOneClass E] : ‖ofScalars E c n‖ = ‖c n‖ := by
simp [ofScalars_norm_eq_mul]
end Seminormed
section Normed
open Filter ENNReal
open scoped Topology NNReal
variable {𝕜 : Type*} (E : Type*) [NontriviallyNormedField 𝕜] [NormedRing E]
[NormedAlgebra 𝕜 E] (c : ℕ → 𝕜) (n : ℕ)
private theorem tendsto_succ_norm_div_norm {r r' : ℝ≥0} (hr' : r' ≠ 0)
(hc : Tendsto (fun n ↦ ‖c n.succ‖ / ‖c n‖) atTop (𝓝 r)) :
Tendsto (fun n ↦ ‖‖c (n + 1)‖ * r' ^ (n + 1)‖ /
‖‖c n‖ * r' ^ n‖) atTop (𝓝 ↑(r' * r)) := by
simp_rw [norm_mul, norm_norm, mul_div_mul_comm, ← norm_div, pow_succ, mul_div_right_comm,
div_self (pow_ne_zero _ (NNReal.coe_ne_zero.mpr hr')), one_mul, norm_div, NNReal.norm_eq]
exact mul_comm r' r ▸ hc.mul tendsto_const_nhds
theorem ofScalars_radius_ge_inv_of_tendsto {r : ℝ≥0} (hr : r ≠ 0)
(hc : Tendsto (fun n ↦ ‖c n.succ‖ / ‖c n‖) atTop (𝓝 r)) :
(ofScalars E c).radius ≥ ofNNReal r⁻¹ := by
refine le_of_forall_nnreal_lt (fun r' hr' ↦ ?_)
rw [coe_lt_coe, NNReal.lt_inv_iff_mul_lt hr] at hr'
by_cases hrz : r' = 0
· simp [hrz]
apply FormalMultilinearSeries.le_radius_of_summable_norm
refine Summable.of_norm_bounded_eventually (g := fun n ↦ ‖‖c n‖ * r' ^ n‖) ?_ ?_
· refine summable_of_ratio_test_tendsto_lt_one hr' ?_ ?_
· refine (hc.eventually_ne (NNReal.coe_ne_zero.mpr hr)).mp (Eventually.of_forall ?_)
simp_all
· simp_rw [norm_norm]
exact tendsto_succ_norm_div_norm c hrz hc
· filter_upwards [eventually_cofinite_ne 0] with n hn
simp only [norm_mul, norm_norm, norm_pow, NNReal.norm_eq]
gcongr
exact ofScalars_norm_le E c n (Nat.pos_iff_ne_zero.mpr hn)
/-- The radius of convergence of a scalar series is the inverse of the non-zero limit
`fun n ↦ ‖c n.succ‖ / ‖c n‖`. -/
theorem ofScalars_radius_eq_inv_of_tendsto [NormOneClass E] {r : ℝ≥0} (hr : r ≠ 0)
(hc : Tendsto (fun n ↦ ‖c n.succ‖ / ‖c n‖) atTop (𝓝 r)) :
(ofScalars E c).radius = ofNNReal r⁻¹ := by
refine le_antisymm ?_ (ofScalars_radius_ge_inv_of_tendsto E c hr hc)
refine le_of_forall_nnreal_lt (fun r' hr' ↦ ?_)
rw [coe_le_coe, NNReal.le_inv_iff_mul_le hr]
have := FormalMultilinearSeries.summable_norm_mul_pow _ hr'
contrapose! this
apply not_summable_of_ratio_test_tendsto_gt_one this
simp_rw [ofScalars_norm]
exact tendsto_succ_norm_div_norm c (by aesop) hc
/-- A convenience lemma restating the result of `ofScalars_radius_eq_inv_of_tendsto` under
the inverse ratio. -/
theorem ofScalars_radius_eq_of_tendsto [NormOneClass E] {r : NNReal} (hr : r ≠ 0)
(hc : Tendsto (fun n ↦ ‖c n‖ / ‖c n.succ‖) atTop (𝓝 r)) :
(ofScalars E c).radius = ofNNReal r := by
suffices Tendsto (fun n ↦ ‖c n.succ‖ / ‖c n‖) atTop (𝓝 r⁻¹) by
convert ofScalars_radius_eq_inv_of_tendsto E c (inv_ne_zero hr) this
simp
convert hc.inv₀ (NNReal.coe_ne_zero.mpr hr) using 1
simp
/-- The ratio test stating that if `‖c n.succ‖ / ‖c n‖` tends to zero, the radius is unbounded.
This requires that the coefficients are eventually non-zero as
`‖c n.succ‖ / 0 = 0` by convention. -/
theorem ofScalars_radius_eq_top_of_tendsto (hc : ∀ᶠ n in atTop, c n ≠ 0)
(hc' : Tendsto (fun n ↦ ‖c n.succ‖ / ‖c n‖) atTop (𝓝 0)) : (ofScalars E c).radius = ⊤ := by
refine radius_eq_top_of_summable_norm _ fun r' ↦ ?_
by_cases hrz : r' = 0
· apply Summable.comp_nat_add (k := 1)
simpa [hrz] using (summable_const_iff 0).mpr rfl
· refine Summable.of_norm_bounded_eventually (g := fun n ↦ ‖‖c n‖ * r' ^ n‖) ?_ ?_
· apply summable_of_ratio_test_tendsto_lt_one zero_lt_one (hc.mp (Eventually.of_forall ?_))
· simp only [norm_norm]
exact mul_zero (_ : ℝ) ▸ tendsto_succ_norm_div_norm _ hrz (NNReal.coe_zero ▸ hc')
· simp_all
· filter_upwards [eventually_cofinite_ne 0] with n hn
simp only [norm_mul, norm_norm, norm_pow, NNReal.norm_eq]
gcongr
exact ofScalars_norm_le E c n (Nat.pos_iff_ne_zero.mpr hn)
/-- If `‖c n.succ‖ / ‖c n‖` is unbounded, then the radius of convergence is zero. -/
theorem ofScalars_radius_eq_zero_of_tendsto [NormOneClass E]
(hc : Tendsto (fun n ↦ ‖c n.succ‖ / ‖c n‖) atTop atTop) : (ofScalars E c).radius = 0 := by
suffices (ofScalars E c).radius ≤ 0 by simp_all
refine le_of_forall_nnreal_lt (fun r hr ↦ ?_)
rw [← coe_zero, coe_le_coe]
have := FormalMultilinearSeries.summable_norm_mul_pow _ hr
contrapose! this
refine not_summable_of_ratio_norm_eventually_ge (r := 2) (by simp) ?_ ?_
· contrapose! hc
apply not_tendsto_atTop_of_tendsto_nhds (a:=0)
rw [not_frequently] at hc
apply Tendsto.congr' ?_ tendsto_const_nhds
filter_upwards [hc] with n hc'
rw [ofScalars_norm, norm_mul, norm_norm, not_ne_iff, mul_eq_zero] at hc'
cases hc' <;> aesop
· filter_upwards [hc.eventually_ge_atTop (2*r⁻¹), eventually_ne_atTop 0] with n hc hn
simp only [ofScalars_norm, norm_mul, norm_norm, norm_pow, NNReal.norm_eq]
rw [mul_comm ‖c n‖, ← mul_assoc, ← div_le_div_iff₀, mul_div_assoc]
· convert hc
rw [pow_succ, div_mul_cancel_left₀, NNReal.coe_inv]
aesop
· simp_all
· refine Ne.lt_of_le (fun hr' ↦ Not.elim ?_ hc) (norm_nonneg _)
rw [← hr']
simp [this]
/-- This theorem combines the results of the special cases above, using `ENNReal` division to remove
the requirement that the ratio is eventually non-zero. -/
theorem ofScalars_radius_eq_inv_of_tendsto_ENNReal [NormOneClass E] {r : ℝ≥0∞}
(hc' : Tendsto (fun n ↦ ENNReal.ofReal ‖c n.succ‖ / ENNReal.ofReal ‖c n‖) atTop (𝓝 r)) :
(ofScalars E c).radius = r⁻¹ := by
rcases ENNReal.trichotomy r with (hr | hr | hr)
· simp_rw [hr, inv_zero] at hc' ⊢
by_cases h : (∀ᶠ (n : ℕ) in atTop, c n ≠ 0)
· apply ofScalars_radius_eq_top_of_tendsto E c h ?_
refine Tendsto.congr' ?_ <| (tendsto_toReal zero_ne_top).comp hc'
filter_upwards [h]
simp
· apply (ofScalars E c).radius_eq_top_of_eventually_eq_zero
simp only [eventually_atTop, not_exists, not_forall, not_not] at h ⊢
obtain ⟨ti, hti⟩ := eventually_atTop.mp (hc'.eventually_ne zero_ne_top)
obtain ⟨zi, hzi, z⟩ := h ti
refine ⟨zi, Nat.le_induction (ofScalars_eq_zero_of_scalar_zero E z) fun n hmn a ↦ ?_⟩
nontriviality E
simp only [ofScalars_eq_zero] at a ⊢
contrapose! hti
exact ⟨n, hzi.trans hmn, ENNReal.div_eq_top.mpr (by simp [a, hti])⟩
· simp_rw [hr, inv_top] at hc' ⊢
apply ofScalars_radius_eq_zero_of_tendsto E c ((tendsto_add_atTop_iff_nat 1).mp ?_)
refine tendsto_ofReal_nhds_top.mp (Tendsto.congr' ?_ ((tendsto_add_atTop_iff_nat 1).mpr hc'))
filter_upwards [hc'.eventually_ne top_ne_zero] with n hn
apply (ofReal_div_of_pos (Ne.lt_of_le (Ne.symm ?_) (norm_nonneg _))).symm
simp_all
· have hr' := toReal_ne_zero.mp hr.ne.symm
have hr'' := toNNReal_ne_zero.mpr hr' -- this result could go in ENNReal
convert ofScalars_radius_eq_inv_of_tendsto E c hr'' ?_
· simp [ENNReal.coe_inv hr'', ENNReal.coe_toNNReal (toReal_ne_zero.mp hr.ne.symm).2]
· simp_rw [ENNReal.coe_toNNReal_eq_toReal]
refine Tendsto.congr' ?_ <| (tendsto_toReal hr'.2).comp hc'
filter_upwards [hc'.eventually_ne hr'.1, hc'.eventually_ne hr'.2]
simp
end Normed
end FormalMultilinearSeries |
.lake/packages/mathlib/Mathlib/Analysis/Analytic/ChangeOrigin.lean | import Mathlib.Analysis.Analytic.Basic
/-!
# Changing origin in a power series
If a function is analytic in a disk `D(x, R)`, then it is analytic in any disk contained in that
one. Indeed, one can write
$$
f (x + y + z) = \sum_{n} p_n (y + z)^n = \sum_{n, k} \binom{n}{k} p_n y^{n-k} z^k
= \sum_{k} \Bigl(\sum_{n} \binom{n}{k} p_n y^{n-k}\Bigr) z^k.
$$
The corresponding power series has thus a `k`-th coefficient equal to
$\sum_{n} \binom{n}{k} p_n y^{n-k}$. In the general case where `pₙ` is a multilinear map, this has
to be interpreted suitably: instead of having a binomial coefficient, one should sum over all
possible subsets `s` of `Fin n` of cardinality `k`, and attribute `z` to the indices in `s` and
`y` to the indices outside of `s`.
In this file, we implement this. The new power series is called `p.changeOrigin y`. Then, we
check its convergence and the fact that its sum coincides with the original sum. The outcome of this
discussion is that the set of points where a function is analytic is open. All these arguments
require the target space to be complete, as otherwise the series might not converge.
### Main results
In a complete space, if a function admits a power series in a ball, then it is analytic at any
point `y` of this ball, and the power series there can be expressed in terms of the initial power
series `p` as `p.changeOrigin y`. See `HasFPowerSeriesOnBall.changeOrigin`. It follows in particular
that the set of points at which a given function is analytic is open, see `isOpen_analyticAt`.
-/
noncomputable section
open scoped NNReal ENNReal Topology
open Filter Set
variable {𝕜 E F : Type*} [NontriviallyNormedField 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E]
[NormedAddCommGroup F] [NormedSpace 𝕜 F]
namespace FormalMultilinearSeries
section
variable (p : FormalMultilinearSeries 𝕜 E F) {x y : E} {r : ℝ≥0}
/-- A term of `FormalMultilinearSeries.changeOriginSeries`.
Given a formal multilinear series `p` and a point `x` in its ball of convergence,
`p.changeOrigin x` is a formal multilinear series such that
`p.sum (x+y) = (p.changeOrigin x).sum y` when this makes sense. Each term of `p.changeOrigin x`
is itself an analytic function of `x` given by the series `p.changeOriginSeries`. Each term in
`changeOriginSeries` is the sum of `changeOriginSeriesTerm`'s over all `s` of cardinality `l`.
The definition is such that `p.changeOriginSeriesTerm k l s hs (fun _ ↦ x) (fun _ ↦ y) =
p (k + l) (s.piecewise (fun _ ↦ x) (fun _ ↦ y))`
-/
def changeOriginSeriesTerm (k l : ℕ) (s : Finset (Fin (k + l))) (hs : s.card = l) :
E[×l]→L[𝕜] E[×k]→L[𝕜] F :=
let a := ContinuousMultilinearMap.curryFinFinset 𝕜 E F hs
(by rw [Finset.card_compl, Fintype.card_fin, hs, add_tsub_cancel_right])
a (p (k + l))
theorem changeOriginSeriesTerm_apply (k l : ℕ) (s : Finset (Fin (k + l))) (hs : s.card = l)
(x y : E) :
(p.changeOriginSeriesTerm k l s hs (fun _ => x) fun _ => y) =
p (k + l) (s.piecewise (fun _ => x) fun _ => y) :=
ContinuousMultilinearMap.curryFinFinset_apply_const _ _ _ _ _
@[simp]
theorem norm_changeOriginSeriesTerm (k l : ℕ) (s : Finset (Fin (k + l))) (hs : s.card = l) :
‖p.changeOriginSeriesTerm k l s hs‖ = ‖p (k + l)‖ := by
simp only [changeOriginSeriesTerm, LinearIsometryEquiv.norm_map]
@[simp]
theorem nnnorm_changeOriginSeriesTerm (k l : ℕ) (s : Finset (Fin (k + l))) (hs : s.card = l) :
‖p.changeOriginSeriesTerm k l s hs‖₊ = ‖p (k + l)‖₊ := by
simp only [changeOriginSeriesTerm, LinearIsometryEquiv.nnnorm_map]
theorem nnnorm_changeOriginSeriesTerm_apply_le (k l : ℕ) (s : Finset (Fin (k + l)))
(hs : s.card = l) (x y : E) :
‖p.changeOriginSeriesTerm k l s hs (fun _ => x) fun _ => y‖₊ ≤
‖p (k + l)‖₊ * ‖x‖₊ ^ l * ‖y‖₊ ^ k := by
rw [← p.nnnorm_changeOriginSeriesTerm k l s hs, ← Fin.prod_const, ← Fin.prod_const]
apply ContinuousMultilinearMap.le_of_opNNNorm_le
apply ContinuousMultilinearMap.le_opNNNorm
/-- The power series for `f.changeOrigin k`.
Given a formal multilinear series `p` and a point `x` in its ball of convergence,
`p.changeOrigin x` is a formal multilinear series such that
`p.sum (x+y) = (p.changeOrigin x).sum y` when this makes sense. Its `k`-th term is the sum of
the series `p.changeOriginSeries k`. -/
def changeOriginSeries (k : ℕ) : FormalMultilinearSeries 𝕜 E (E[×k]→L[𝕜] F) := fun l =>
∑ s : { s : Finset (Fin (k + l)) // Finset.card s = l }, p.changeOriginSeriesTerm k l s s.2
theorem nnnorm_changeOriginSeries_le_tsum (k l : ℕ) :
‖p.changeOriginSeries k l‖₊ ≤
∑' _ : { s : Finset (Fin (k + l)) // s.card = l }, ‖p (k + l)‖₊ :=
(nnnorm_sum_le _ (fun t => changeOriginSeriesTerm p k l (Subtype.val t) t.prop)).trans_eq <| by
simp_rw [tsum_fintype, nnnorm_changeOriginSeriesTerm (p := p) (k := k) (l := l)]
theorem nnnorm_changeOriginSeries_apply_le_tsum (k l : ℕ) (x : E) :
‖p.changeOriginSeries k l fun _ => x‖₊ ≤
∑' _ : { s : Finset (Fin (k + l)) // s.card = l }, ‖p (k + l)‖₊ * ‖x‖₊ ^ l := by
rw [NNReal.tsum_mul_right, ← Fin.prod_const]
exact (p.changeOriginSeries k l).le_of_opNNNorm_le (p.nnnorm_changeOriginSeries_le_tsum _ _) _
/-- Changing the origin of a formal multilinear series `p`, so that
`p.sum (x+y) = (p.changeOrigin x).sum y` when this makes sense.
-/
def changeOrigin (x : E) : FormalMultilinearSeries 𝕜 E F :=
fun k => (p.changeOriginSeries k).sum x
/-- An auxiliary equivalence useful in the proofs about
`FormalMultilinearSeries.changeOriginSeries`: the set of triples `(k, l, s)`, where `s` is a
`Finset (Fin (k + l))` of cardinality `l` is equivalent to the set of pairs `(n, s)`, where `s` is a
`Finset (Fin n)`.
The forward map sends `(k, l, s)` to `(k + l, s)` and the inverse map sends `(n, s)` to
`(n - Finset.card s, Finset.card s, s)`. The actual definition is less readable because of problems
with non-definitional equalities. -/
@[simps]
def changeOriginIndexEquiv :
(Σ k l : ℕ, { s : Finset (Fin (k + l)) // s.card = l }) ≃ Σ n : ℕ, Finset (Fin n) where
toFun s := ⟨s.1 + s.2.1, s.2.2⟩
invFun s :=
⟨s.1 - s.2.card, s.2.card,
⟨s.2.map
(finCongr <| (tsub_add_cancel_of_le <| card_finset_fin_le s.2).symm).toEmbedding,
Finset.card_map _⟩⟩
left_inv := by
rintro ⟨k, l, ⟨s : Finset (Fin <| k + l), hs : s.card = l⟩⟩
dsimp only [Subtype.coe_mk]
-- Lean can't automatically generalize `k' = k + l - s.card`, `l' = s.card`, so we explicitly
-- formulate the generalized goal
suffices ∀ k' l', k' = k → l' = l → ∀ (hkl : k + l = k' + l') (hs'),
(⟨k', l', ⟨s.map (finCongr hkl).toEmbedding, hs'⟩⟩ :
Σ k l : ℕ, { s : Finset (Fin (k + l)) // s.card = l }) = ⟨k, l, ⟨s, hs⟩⟩ by
apply this <;> simp only [hs, add_tsub_cancel_right]
simp
right_inv := by
rintro ⟨n, s⟩
simp [tsub_add_cancel_of_le (card_finset_fin_le s), finCongr_eq_equivCast]
lemma changeOriginSeriesTerm_changeOriginIndexEquiv_symm (n t) :
let s := changeOriginIndexEquiv.symm ⟨n, t⟩
p.changeOriginSeriesTerm s.1 s.2.1 s.2.2 s.2.2.2 (fun _ ↦ x) (fun _ ↦ y) =
p n (t.piecewise (fun _ ↦ x) fun _ ↦ y) := by
have : ∀ (m) (hm : n = m), p n (t.piecewise (fun _ ↦ x) fun _ ↦ y) =
p m ((t.map (finCongr hm).toEmbedding).piecewise (fun _ ↦ x) fun _ ↦ y) := by
rintro m rfl
simp +unfoldPartialApp [Finset.piecewise]
simp_rw [changeOriginSeriesTerm_apply, eq_comm]; apply this
theorem changeOriginSeries_summable_aux₁ {r r' : ℝ≥0} (hr : (r + r' : ℝ≥0∞) < p.radius) :
Summable fun s : Σ k l : ℕ, { s : Finset (Fin (k + l)) // s.card = l } =>
‖p (s.1 + s.2.1)‖₊ * r ^ s.2.1 * r' ^ s.1 := by
rw [← changeOriginIndexEquiv.symm.summable_iff]
dsimp only [Function.comp_def, changeOriginIndexEquiv_symm_apply_fst,
changeOriginIndexEquiv_symm_apply_snd_fst]
have : ∀ n : ℕ,
HasSum (fun s : Finset (Fin n) => ‖p (n - s.card + s.card)‖₊ * r ^ s.card * r' ^ (n - s.card))
(‖p n‖₊ * (r + r') ^ n) := by
intro n
-- TODO: why `simp only [tsub_add_cancel_of_le (card_finset_fin_le _)]` fails?
convert_to HasSum (fun s : Finset (Fin n) => ‖p n‖₊ * (r ^ s.card * r' ^ (n - s.card))) _
· ext1 s
rw [tsub_add_cancel_of_le (card_finset_fin_le _), mul_assoc]
rw [← Fin.sum_pow_mul_eq_add_pow]
exact (hasSum_fintype _).mul_left _
refine NNReal.summable_sigma.2 ⟨fun n => (this n).summable, ?_⟩
simp only [(this _).tsum_eq]
exact p.summable_nnnorm_mul_pow hr
theorem changeOriginSeries_summable_aux₂ (hr : (r : ℝ≥0∞) < p.radius) (k : ℕ) :
Summable fun s : Σ l : ℕ, { s : Finset (Fin (k + l)) // s.card = l } =>
‖p (k + s.1)‖₊ * r ^ s.1 := by
rcases ENNReal.lt_iff_exists_add_pos_lt.1 hr with ⟨r', h0, hr'⟩
simpa only [mul_inv_cancel_right₀ (pow_pos h0 _).ne'] using
((NNReal.summable_sigma.1 (p.changeOriginSeries_summable_aux₁ hr')).1 k).mul_right (r' ^ k)⁻¹
theorem changeOriginSeries_summable_aux₃ {r : ℝ≥0} (hr : ↑r < p.radius) (k : ℕ) :
Summable fun l : ℕ => ‖p.changeOriginSeries k l‖₊ * r ^ l := by
refine NNReal.summable_of_le
(fun n => ?_) (NNReal.summable_sigma.1 <| p.changeOriginSeries_summable_aux₂ hr k).2
simp only [NNReal.tsum_mul_right]
gcongr
apply p.nnnorm_changeOriginSeries_le_tsum
theorem le_changeOriginSeries_radius (k : ℕ) : p.radius ≤ (p.changeOriginSeries k).radius :=
ENNReal.le_of_forall_nnreal_lt fun _r hr =>
le_radius_of_summable_nnnorm _ (p.changeOriginSeries_summable_aux₃ hr k)
theorem nnnorm_changeOrigin_le (k : ℕ) (h : (‖x‖₊ : ℝ≥0∞) < p.radius) :
‖p.changeOrigin x k‖₊ ≤
∑' s : Σ l : ℕ, { s : Finset (Fin (k + l)) // s.card = l }, ‖p (k + s.1)‖₊ * ‖x‖₊ ^ s.1 := by
refine tsum_of_nnnorm_bounded ?_ fun l => p.nnnorm_changeOriginSeries_apply_le_tsum k l x
have := p.changeOriginSeries_summable_aux₂ h k
refine HasSum.sigma this.hasSum fun l => ?_
exact ((NNReal.summable_sigma.1 this).1 l).hasSum
/-- The radius of convergence of `p.changeOrigin x` is at least `p.radius - ‖x‖`. In other words,
`p.changeOrigin x` is well defined on the largest ball contained in the original ball of
convergence. -/
theorem changeOrigin_radius : p.radius - ‖x‖₊ ≤ (p.changeOrigin x).radius := by
refine ENNReal.le_of_forall_pos_nnreal_lt fun r _h0 hr => ?_
rw [lt_tsub_iff_right, add_comm] at hr
have hr' : (‖x‖₊ : ℝ≥0∞) < p.radius := (le_add_right le_rfl).trans_lt hr
apply le_radius_of_summable_nnnorm
have (k : ℕ) :
‖p.changeOrigin x k‖₊ * r ^ k ≤
(∑' s : Σ l : ℕ, { s : Finset (Fin (k + l)) // s.card = l }, ‖p (k + s.1)‖₊ * ‖x‖₊ ^ s.1) *
r ^ k := by
gcongr; exact p.nnnorm_changeOrigin_le k hr'
refine NNReal.summable_of_le this ?_
simpa only [← NNReal.tsum_mul_right] using
(NNReal.summable_sigma.1 (p.changeOriginSeries_summable_aux₁ hr)).2
/-- `derivSeries p` is a power series for `fderiv 𝕜 f` if `p` is a power series for `f`,
see `HasFPowerSeriesOnBall.fderiv`. -/
def derivSeries : FormalMultilinearSeries 𝕜 E (E →L[𝕜] F) :=
(continuousMultilinearCurryFin1 𝕜 E F : (E[×1]→L[𝕜] F) →L[𝕜] E →L[𝕜] F)
|>.compFormalMultilinearSeries (p.changeOriginSeries 1)
theorem radius_le_radius_derivSeries : p.radius ≤ p.derivSeries.radius := by
apply (p.le_changeOriginSeries_radius 1).trans (radius_le_of_le (fun n ↦ ?_))
apply (ContinuousLinearMap.norm_compContinuousMultilinearMap_le _ _).trans
apply mul_le_of_le_one_left (norm_nonneg _)
exact ContinuousLinearMap.opNorm_le_bound _ zero_le_one (by simp)
theorem derivSeries_eq_zero {n : ℕ} (hp : p (n + 1) = 0) : p.derivSeries n = 0 := by
suffices p.changeOriginSeries 1 n = 0 by ext v; simp [derivSeries, this]
apply Finset.sum_eq_zero (fun s hs ↦ ?_)
ext v
have : p (1 + n) = 0 := p.congr_zero (by abel) hp
simp [changeOriginSeriesTerm, ContinuousMultilinearMap.zero_apply, this]
end
-- From this point on, assume that the space is complete, to make sure that series that converge
-- in norm also converge in `F`.
variable [CompleteSpace F] (p : FormalMultilinearSeries 𝕜 E F) {x y : E}
theorem hasFPowerSeriesOnBall_changeOrigin (k : ℕ) (hr : 0 < p.radius) :
HasFPowerSeriesOnBall (fun x => p.changeOrigin x k) (p.changeOriginSeries k) 0 p.radius :=
have := p.le_changeOriginSeries_radius k
((p.changeOriginSeries k).hasFPowerSeriesOnBall (hr.trans_le this)).mono hr this
/-- Summing the series `p.changeOrigin x` at a point `y` gives back `p (x + y)`. -/
theorem changeOrigin_eval (h : (‖x‖₊ + ‖y‖₊ : ℝ≥0∞) < p.radius) :
(p.changeOrigin x).sum y = p.sum (x + y) := by
have radius_pos : 0 < p.radius := lt_of_le_of_lt (zero_le _) h
have x_mem_ball : x ∈ EMetric.ball (0 : E) p.radius :=
mem_emetric_ball_zero_iff.2 ((le_add_right le_rfl).trans_lt h)
have y_mem_ball : y ∈ EMetric.ball (0 : E) (p.changeOrigin x).radius := by
refine mem_emetric_ball_zero_iff.2 (lt_of_lt_of_le ?_ p.changeOrigin_radius)
rwa [lt_tsub_iff_right, add_comm]
have x_add_y_mem_ball : x + y ∈ EMetric.ball (0 : E) p.radius := by
refine mem_emetric_ball_zero_iff.2 (lt_of_le_of_lt ?_ h)
exact mod_cast nnnorm_add_le x y
set f : (Σ k l : ℕ, { s : Finset (Fin (k + l)) // s.card = l }) → F := fun s =>
p.changeOriginSeriesTerm s.1 s.2.1 s.2.2 s.2.2.2 (fun _ => x) fun _ => y
have hsf : Summable f := by
refine .of_nnnorm_bounded (p.changeOriginSeries_summable_aux₁ h) ?_
rintro ⟨k, l, s, hs⟩
dsimp only [Subtype.coe_mk]
exact p.nnnorm_changeOriginSeriesTerm_apply_le _ _ _ _ _ _
have hf : HasSum f ((p.changeOrigin x).sum y) := by
refine HasSum.sigma_of_hasSum ((p.changeOrigin x).summable y_mem_ball).hasSum (fun k => ?_) hsf
· dsimp only [f]
refine ContinuousMultilinearMap.hasSum_eval ?_ _
have := (p.hasFPowerSeriesOnBall_changeOrigin k radius_pos).hasSum x_mem_ball
rw [zero_add] at this
refine HasSum.sigma_of_hasSum this (fun l => ?_) ?_
· simp only [changeOriginSeries, ContinuousMultilinearMap.sum_apply]
apply hasSum_fintype
· refine .of_nnnorm_bounded
(p.changeOriginSeries_summable_aux₂ (mem_emetric_ball_zero_iff.1 x_mem_ball) k)
fun s => ?_
refine (ContinuousMultilinearMap.le_opNNNorm _ _).trans_eq ?_
simp
refine hf.unique (changeOriginIndexEquiv.symm.hasSum_iff.1 ?_)
refine HasSum.sigma_of_hasSum
(p.hasSum x_add_y_mem_ball) (fun n => ?_) (changeOriginIndexEquiv.symm.summable_iff.2 hsf)
rw [← Pi.add_def, (p n).map_add_univ (fun _ => x) fun _ => y]
simp_rw [← changeOriginSeriesTerm_changeOriginIndexEquiv_symm]
exact hasSum_fintype (fun c => f (changeOriginIndexEquiv.symm ⟨n, c⟩))
/-- Power series terms are analytic as we vary the origin -/
theorem analyticAt_changeOrigin (p : FormalMultilinearSeries 𝕜 E F) (rp : p.radius > 0) (n : ℕ) :
AnalyticAt 𝕜 (fun x ↦ p.changeOrigin x n) 0 :=
(FormalMultilinearSeries.hasFPowerSeriesOnBall_changeOrigin p n rp).analyticAt
end FormalMultilinearSeries
section
variable [CompleteSpace F] {f : E → F} {p : FormalMultilinearSeries 𝕜 E F} {s : Set E}
{x y : E} {r : ℝ≥0∞}
/-- If a function admits a power series expansion `p` within a set `s` on a ball `B (x, r)`, then
it also admits a power series on any subball of this ball (even with a different center provided
it belongs to `s`), given by `p.changeOrigin`. -/
theorem HasFPowerSeriesWithinOnBall.changeOrigin (hf : HasFPowerSeriesWithinOnBall f p s x r)
(h : ‖y‖ₑ < r) (hy : x + y ∈ insert x s) :
HasFPowerSeriesWithinOnBall f (p.changeOrigin y) s (x + y) (r - ‖y‖ₑ) where
r_le := by
apply le_trans _ p.changeOrigin_radius
exact tsub_le_tsub hf.r_le le_rfl
r_pos := by simp [h]
hasSum {z} h'z hz := by
have : f (x + y + z) =
FormalMultilinearSeries.sum (FormalMultilinearSeries.changeOrigin p y) z := by
rw [mem_emetric_ball_zero_iff, lt_tsub_iff_right, add_comm] at hz
rw [p.changeOrigin_eval (hz.trans_le hf.r_le), add_assoc, hf.sum]
· have : insert (x + y) s ⊆ insert (x + y) (insert x s) := by
apply insert_subset_insert (subset_insert _ _)
rw [insert_eq_of_mem hy] at this
apply this
simpa [add_assoc] using h'z
exact mem_emetric_ball_zero_iff.2 (lt_of_le_of_lt (enorm_add_le _ _) hz)
rw [this]
apply (p.changeOrigin y).hasSum
refine EMetric.ball_subset_ball (le_trans ?_ p.changeOrigin_radius) hz
exact tsub_le_tsub hf.r_le le_rfl
/-- If a function admits a power series expansion `p` on a ball `B (x, r)`, then it also admits a
power series on any subball of this ball (even with a different center), given by `p.changeOrigin`.
-/
theorem HasFPowerSeriesOnBall.changeOrigin (hf : HasFPowerSeriesOnBall f p x r)
(h : (‖y‖₊ : ℝ≥0∞) < r) : HasFPowerSeriesOnBall f (p.changeOrigin y) (x + y) (r - ‖y‖₊) := by
rw [← hasFPowerSeriesWithinOnBall_univ] at hf ⊢
exact hf.changeOrigin h (by simp)
/-- If a function admits a power series expansion `p` on an open ball `B (x, r)`, then
it is analytic at every point of this ball. -/
theorem HasFPowerSeriesWithinOnBall.analyticWithinAt_of_mem
(hf : HasFPowerSeriesWithinOnBall f p s x r)
(h : y ∈ insert x s ∩ EMetric.ball x r) : AnalyticWithinAt 𝕜 f s y := by
have : (‖y - x‖₊ : ℝ≥0∞) < r := by simpa [edist_eq_enorm_sub] using h.2
have := hf.changeOrigin this (by simpa using h.1)
rw [add_sub_cancel] at this
exact this.analyticWithinAt
/-- If a function admits a power series expansion `p` on an open ball `B (x, r)`, then
it is analytic at every point of this ball. -/
theorem HasFPowerSeriesOnBall.analyticAt_of_mem (hf : HasFPowerSeriesOnBall f p x r)
(h : y ∈ EMetric.ball x r) : AnalyticAt 𝕜 f y := by
rw [← hasFPowerSeriesWithinOnBall_univ] at hf
rw [← analyticWithinAt_univ]
exact hf.analyticWithinAt_of_mem (by simpa using h)
theorem HasFPowerSeriesWithinOnBall.analyticOn (hf : HasFPowerSeriesWithinOnBall f p s x r) :
AnalyticOn 𝕜 f (insert x s ∩ EMetric.ball x r) :=
fun _ hy ↦ ((analyticWithinAt_insert (y := x)).2 (hf.analyticWithinAt_of_mem hy)).mono
inter_subset_left
theorem HasFPowerSeriesOnBall.analyticOnNhd (hf : HasFPowerSeriesOnBall f p x r) :
AnalyticOnNhd 𝕜 f (EMetric.ball x r) :=
fun _y hy => hf.analyticAt_of_mem hy
variable (𝕜 f) in
/-- For any function `f` from a normed vector space to a Banach space, the set of points `x` such
that `f` is analytic at `x` is open. -/
theorem isOpen_analyticAt : IsOpen { x | AnalyticAt 𝕜 f x } := by
rw [isOpen_iff_mem_nhds]
rintro x ⟨p, r, hr⟩
exact mem_of_superset (EMetric.ball_mem_nhds _ hr.r_pos) fun y hy => hr.analyticAt_of_mem hy
theorem AnalyticAt.eventually_analyticAt (h : AnalyticAt 𝕜 f x) :
∀ᶠ y in 𝓝 x, AnalyticAt 𝕜 f y :=
(isOpen_analyticAt 𝕜 f).mem_nhds h
theorem AnalyticAt.exists_mem_nhds_analyticOnNhd (h : AnalyticAt 𝕜 f x) :
∃ s ∈ 𝓝 x, AnalyticOnNhd 𝕜 f s :=
h.eventually_analyticAt.exists_mem
/-- If we're analytic at a point, we're analytic in a nonempty ball -/
theorem AnalyticAt.exists_ball_analyticOnNhd (h : AnalyticAt 𝕜 f x) :
∃ r : ℝ, 0 < r ∧ AnalyticOnNhd 𝕜 f (Metric.ball x r) :=
Metric.isOpen_iff.mp (isOpen_analyticAt _ _) _ h
/-- Sum of series is analytic on its ball of convergence. -/
protected theorem FormalMultilinearSeries.analyticOnNhd :
AnalyticOnNhd 𝕜 p.sum (EMetric.ball 0 p.radius) := by
by_cases hr : p.radius = 0
· simp [hr]
exact (FormalMultilinearSeries.hasFPowerSeriesOnBall _ (pos_of_ne_zero hr)).analyticOnNhd
end |
.lake/packages/mathlib/Mathlib/Analysis/Analytic/CPolynomialDef.lean | import Mathlib.Analysis.Analytic.ChangeOrigin
/-! We specialize the theory of analytic functions to the case of functions that admit a
development given by a *finite* formal multilinear series. We call them "continuously polynomial",
which is abbreviated to `CPolynomial`. One reason to do that is that we no longer need a
completeness assumption on the target space `F` to make the series converge, so some of the results
are more general. The class of continuously polynomial functions includes functions defined by
polynomials on a normed `𝕜`-algebra and continuous multilinear maps.
## Main definitions
Let `p` be a formal multilinear series from `E` to `F`, i.e., `p n` is a multilinear map on `E^n`
for `n : ℕ`, and let `f` be a function from `E` to `F`.
* `HasFiniteFPowerSeriesOnBall f p x n r`: on the ball of center `x` with radius `r`,
`f (x + y) = ∑'_n pₘ yᵐ`, and moreover `pₘ = 0` if `n ≤ m`.
* `HasFiniteFPowerSeriesAt f p x n`: on some ball of center `x` with positive radius, holds
`HasFiniteFPowerSeriesOnBall f p x n r`.
* `CPolynomialAt 𝕜 f x`: there exists a power series `p` and a natural number `n` such that
holds `HasFPowerSeriesAt f p x n`.
* `CPolynomialOn 𝕜 f s`: the function `f` is analytic at every point of `s`.
In this file, we develop the basic properties of these notions, notably:
* If a function is continuously polynomial, then it is analytic, see
`HasFiniteFPowerSeriesOnBall.hasFPowerSeriesOnBall`, `HasFiniteFPowerSeriesAt.hasFPowerSeriesAt`,
`CPolynomialAt.analyticAt` and `CPolynomialOn.analyticOnNhd`.
* The sum of a finite formal power series with positive radius is well defined on the whole space,
see `FormalMultilinearSeries.hasFiniteFPowerSeriesOnBall_of_finite`.
* If a function admits a finite power series in a ball, then it is continuously polynomial at
any point `y` of this ball, and the power series there can be expressed in terms of the initial
power series `p` as `p.changeOrigin y`, which is finite (with the same bound as `p`) by
`changeOrigin_finite_of_finite`. See `HasFiniteFPowerSeriesOnBall.changeOrigin`. It follows in
particular that the set of points at which a given function is continuously polynomial is open,
see `isOpen_cpolynomialAt`.
More API is available in the file `Mathlib/Analysis/Analytic/CPolynomial.lean`, with heavier
imports.
-/
variable {𝕜 E F G : Type*} [NontriviallyNormedField 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E]
[NormedAddCommGroup F] [NormedSpace 𝕜 F] [NormedAddCommGroup G] [NormedSpace 𝕜 G]
open scoped Topology
open Set Filter Asymptotics NNReal ENNReal
variable {f g : E → F} {p pf pg : FormalMultilinearSeries 𝕜 E F} {x : E} {r r' : ℝ≥0∞} {n m : ℕ}
section FiniteFPowerSeries
/-- Given a function `f : E → F`, a formal multilinear series `p` and `n : ℕ`, we say that
`f` has `p` as a finite power series on the ball of radius `r > 0` around `x` if
`f (x + y) = ∑' pₘ yᵐ` for all `‖y‖ < r` and `pₙ = 0` for `n ≤ m`. -/
structure HasFiniteFPowerSeriesOnBall (f : E → F) (p : FormalMultilinearSeries 𝕜 E F) (x : E)
(n : ℕ) (r : ℝ≥0∞) : Prop extends HasFPowerSeriesOnBall f p x r where
finite : ∀ (m : ℕ), n ≤ m → p m = 0
theorem HasFiniteFPowerSeriesOnBall.mk' {f : E → F} {p : FormalMultilinearSeries 𝕜 E F} {x : E}
{n : ℕ} {r : ℝ≥0∞} (finite : ∀ (m : ℕ), n ≤ m → p m = 0) (pos : 0 < r)
(sum_eq : ∀ y ∈ EMetric.ball 0 r, (∑ i ∈ Finset.range n, p i fun _ ↦ y) = f (x + y)) :
HasFiniteFPowerSeriesOnBall f p x n r where
r_le := p.radius_eq_top_of_eventually_eq_zero (Filter.eventually_atTop.mpr ⟨n, finite⟩) ▸ le_top
r_pos := pos
hasSum hy := sum_eq _ hy ▸ hasSum_sum_of_ne_finset_zero fun m hm ↦ by
rw [Finset.mem_range, not_lt] at hm; rw [finite m hm]; rfl
finite := finite
/-- Given a function `f : E → F`, a formal multilinear series `p` and `n : ℕ`, we say that
`f` has `p` as a finite power series around `x` if `f (x + y) = ∑' pₙ yⁿ` for all `y` in a
neighborhood of `0` and `pₙ = 0` for `n ≤ m`. -/
def HasFiniteFPowerSeriesAt (f : E → F) (p : FormalMultilinearSeries 𝕜 E F) (x : E) (n : ℕ) :=
∃ r, HasFiniteFPowerSeriesOnBall f p x n r
theorem HasFiniteFPowerSeriesAt.hasFPowerSeriesAt
(hf : HasFiniteFPowerSeriesAt f p x n) : HasFPowerSeriesAt f p x :=
let ⟨r, hf⟩ := hf
⟨r, hf.toHasFPowerSeriesOnBall⟩
theorem HasFiniteFPowerSeriesAt.finite (hf : HasFiniteFPowerSeriesAt f p x n) :
∀ m : ℕ, n ≤ m → p m = 0 := let ⟨_, hf⟩ := hf; hf.finite
variable (𝕜)
/-- Given a function `f : E → F`, we say that `f` is continuously polynomial (cpolynomial)
at `x` if it admits a finite power series expansion around `x`. -/
def CPolynomialAt (f : E → F) (x : E) :=
∃ (p : FormalMultilinearSeries 𝕜 E F) (n : ℕ), HasFiniteFPowerSeriesAt f p x n
/-- Given a function `f : E → F`, we say that `f` is continuously polynomial on a set `s`
if it is continuously polynomial around every point of `s`. -/
def CPolynomialOn (f : E → F) (s : Set E) :=
∀ x, x ∈ s → CPolynomialAt 𝕜 f x
variable {𝕜}
theorem HasFiniteFPowerSeriesOnBall.hasFiniteFPowerSeriesAt
(hf : HasFiniteFPowerSeriesOnBall f p x n r) :
HasFiniteFPowerSeriesAt f p x n :=
⟨r, hf⟩
theorem HasFiniteFPowerSeriesAt.cpolynomialAt (hf : HasFiniteFPowerSeriesAt f p x n) :
CPolynomialAt 𝕜 f x :=
⟨p, n, hf⟩
theorem HasFiniteFPowerSeriesOnBall.cpolynomialAt (hf : HasFiniteFPowerSeriesOnBall f p x n r) :
CPolynomialAt 𝕜 f x :=
hf.hasFiniteFPowerSeriesAt.cpolynomialAt
theorem CPolynomialAt.analyticAt (hf : CPolynomialAt 𝕜 f x) : AnalyticAt 𝕜 f x :=
let ⟨p, _, hp⟩ := hf
⟨p, hp.hasFPowerSeriesAt⟩
theorem CPolynomialAt.analyticWithinAt {s : Set E} (hf : CPolynomialAt 𝕜 f x) :
AnalyticWithinAt 𝕜 f s x :=
hf.analyticAt.analyticWithinAt
theorem CPolynomialOn.analyticOnNhd {s : Set E} (hf : CPolynomialOn 𝕜 f s) : AnalyticOnNhd 𝕜 f s :=
fun x hx ↦ (hf x hx).analyticAt
theorem CPolynomialOn.analyticOn {s : Set E} (hf : CPolynomialOn 𝕜 f s) : AnalyticOn 𝕜 f s :=
hf.analyticOnNhd.analyticOn
theorem HasFiniteFPowerSeriesOnBall.congr (hf : HasFiniteFPowerSeriesOnBall f p x n r)
(hg : EqOn f g (EMetric.ball x r)) : HasFiniteFPowerSeriesOnBall g p x n r :=
⟨hf.1.congr hg, hf.finite⟩
theorem HasFiniteFPowerSeriesOnBall.of_le {m n : ℕ}
(h : HasFiniteFPowerSeriesOnBall f p x n r) (hmn : n ≤ m) :
HasFiniteFPowerSeriesOnBall f p x m r :=
⟨h.toHasFPowerSeriesOnBall, fun i hi ↦ h.finite i (hmn.trans hi)⟩
theorem HasFiniteFPowerSeriesAt.of_le {m n : ℕ}
(h : HasFiniteFPowerSeriesAt f p x n) (hmn : n ≤ m) :
HasFiniteFPowerSeriesAt f p x m := by
rcases h with ⟨r, hr⟩
exact ⟨r, hr.of_le hmn⟩
/-- If a function `f` has a finite power series `p` around `x`, then the function
`z ↦ f (z - y)` has the same finite power series around `x + y`. -/
theorem HasFiniteFPowerSeriesOnBall.comp_sub (hf : HasFiniteFPowerSeriesOnBall f p x n r) (y : E) :
HasFiniteFPowerSeriesOnBall (fun z => f (z - y)) p (x + y) n r :=
⟨hf.1.comp_sub y, hf.finite⟩
theorem HasFiniteFPowerSeriesOnBall.mono (hf : HasFiniteFPowerSeriesOnBall f p x n r)
(r'_pos : 0 < r') (hr : r' ≤ r) : HasFiniteFPowerSeriesOnBall f p x n r' :=
⟨hf.1.mono r'_pos hr, hf.finite⟩
theorem HasFiniteFPowerSeriesAt.congr (hf : HasFiniteFPowerSeriesAt f p x n) (hg : f =ᶠ[𝓝 x] g) :
HasFiniteFPowerSeriesAt g p x n :=
Exists.imp (fun _ hg ↦ ⟨hg, hf.finite⟩) (hf.hasFPowerSeriesAt.congr hg)
protected theorem HasFiniteFPowerSeriesAt.eventually (hf : HasFiniteFPowerSeriesAt f p x n) :
∀ᶠ r : ℝ≥0∞ in 𝓝[>] 0, HasFiniteFPowerSeriesOnBall f p x n r :=
hf.hasFPowerSeriesAt.eventually.mono fun _ h ↦ ⟨h, hf.finite⟩
theorem CPolynomialAt.congr (hf : CPolynomialAt 𝕜 f x) (hg : f =ᶠ[𝓝 x] g) : CPolynomialAt 𝕜 g x :=
let ⟨_, _, hpf⟩ := hf
(hpf.congr hg).cpolynomialAt
theorem CPolynomialAt_congr (h : f =ᶠ[𝓝 x] g) : CPolynomialAt 𝕜 f x ↔ CPolynomialAt 𝕜 g x :=
⟨fun hf ↦ hf.congr h, fun hg ↦ hg.congr h.symm⟩
theorem CPolynomialOn.mono {s t : Set E} (hf : CPolynomialOn 𝕜 f t) (hst : s ⊆ t) :
CPolynomialOn 𝕜 f s :=
fun z hz => hf z (hst hz)
theorem CPolynomialOn.congr' {s : Set E} (hf : CPolynomialOn 𝕜 f s) (hg : f =ᶠ[𝓝ˢ s] g) :
CPolynomialOn 𝕜 g s :=
fun z hz => (hf z hz).congr (mem_nhdsSet_iff_forall.mp hg z hz)
theorem CPolynomialOn_congr' {s : Set E} (h : f =ᶠ[𝓝ˢ s] g) :
CPolynomialOn 𝕜 f s ↔ CPolynomialOn 𝕜 g s :=
⟨fun hf => hf.congr' h, fun hg => hg.congr' h.symm⟩
theorem CPolynomialOn.congr {s : Set E} (hs : IsOpen s) (hf : CPolynomialOn 𝕜 f s)
(hg : s.EqOn f g) : CPolynomialOn 𝕜 g s :=
hf.congr' <| mem_nhdsSet_iff_forall.mpr
(fun _ hz => eventuallyEq_iff_exists_mem.mpr ⟨s, hs.mem_nhds hz, hg⟩)
theorem CPolynomialOn_congr {s : Set E} (hs : IsOpen s) (h : s.EqOn f g) :
CPolynomialOn 𝕜 f s ↔ CPolynomialOn 𝕜 g s :=
⟨fun hf => hf.congr hs h, fun hg => hg.congr hs h.symm⟩
/-- If a function `f` has a finite power series `p` on a ball and `g` is a continuous linear map,
then `g ∘ f` has the finite power series `g ∘ p` on the same ball. -/
theorem ContinuousLinearMap.comp_hasFiniteFPowerSeriesOnBall (g : F →L[𝕜] G)
(h : HasFiniteFPowerSeriesOnBall f p x n r) :
HasFiniteFPowerSeriesOnBall (g ∘ f) (g.compFormalMultilinearSeries p) x n r :=
⟨g.comp_hasFPowerSeriesOnBall h.1, fun m hm ↦ by
rw [compFormalMultilinearSeries_apply, h.finite m hm]
ext; exact map_zero g⟩
/-- If a function `f` is continuously polynomial on a set `s` and `g` is a continuous linear map,
then `g ∘ f` is continuously polynomial on `s`. -/
theorem ContinuousLinearMap.comp_cpolynomialOn {s : Set E} (g : F →L[𝕜] G)
(h : CPolynomialOn 𝕜 f s) : CPolynomialOn 𝕜 (g ∘ f) s := by
rintro x hx
rcases h x hx with ⟨p, n, r, hp⟩
exact ⟨g.compFormalMultilinearSeries p, n, r, g.comp_hasFiniteFPowerSeriesOnBall hp⟩
/-- If a function admits a finite power series expansion bounded by `n`, then it is equal to
the `m`th partial sums of this power series at every point of the disk for `n ≤ m`. -/
theorem HasFiniteFPowerSeriesOnBall.eq_partialSum
(hf : HasFiniteFPowerSeriesOnBall f p x n r) :
∀ y ∈ EMetric.ball (0 : E) r, ∀ m, n ≤ m →
f (x + y) = p.partialSum m y :=
fun y hy m hm ↦ (hf.hasSum hy).unique (hasSum_sum_of_ne_finset_zero
(f := fun m => p m (fun _ => y)) (s := Finset.range m)
(fun N hN => by simp only; simp only [Finset.mem_range, not_lt] at hN
rw [hf.finite _ (le_trans hm hN), ContinuousMultilinearMap.zero_apply]))
/-- Variant of the previous result with the variable expressed as `y` instead of `x + y`. -/
theorem HasFiniteFPowerSeriesOnBall.eq_partialSum'
(hf : HasFiniteFPowerSeriesOnBall f p x n r) :
∀ y ∈ EMetric.ball x r, ∀ m, n ≤ m →
f y = p.partialSum m (y - x) := by
intro y hy m hm
rw [EMetric.mem_ball, edist_eq_enorm_sub, ← mem_emetric_ball_zero_iff] at hy
rw [← (HasFiniteFPowerSeriesOnBall.eq_partialSum hf _ hy m hm), add_sub_cancel]
/-! The particular cases where `f` has a finite power series bounded by `0` or `1`. -/
/-- If `f` has a formal power series on a ball bounded by `0`, then `f` is equal to `0` on
the ball. -/
theorem HasFiniteFPowerSeriesOnBall.eq_zero_of_bound_zero
(hf : HasFiniteFPowerSeriesOnBall f pf x 0 r) : ∀ y ∈ EMetric.ball x r, f y = 0 := by
intro y hy
rw [hf.eq_partialSum' y hy 0 le_rfl, FormalMultilinearSeries.partialSum]
simp only [Finset.range_zero, Finset.sum_empty]
theorem HasFiniteFPowerSeriesOnBall.bound_zero_of_eq_zero (hf : ∀ y ∈ EMetric.ball x r, f y = 0)
(r_pos : 0 < r) (hp : ∀ n, p n = 0) : HasFiniteFPowerSeriesOnBall f p x 0 r := by
refine ⟨⟨?_, r_pos, ?_⟩, fun n _ ↦ hp n⟩
· rw [p.radius_eq_top_of_forall_image_add_eq_zero 0 (fun n ↦ by rw [add_zero]; exact hp n)]
exact le_top
· intro y hy
rw [hf (x + y)]
· convert hasSum_zero
rw [hp, ContinuousMultilinearMap.zero_apply]
· rwa [EMetric.mem_ball, edist_eq_enorm_sub, add_comm, add_sub_cancel_right,
← edist_zero_eq_enorm, ← EMetric.mem_ball]
/-- If `f` has a formal power series at `x` bounded by `0`, then `f` is equal to `0` in a
neighborhood of `x`. -/
theorem HasFiniteFPowerSeriesAt.eventually_zero_of_bound_zero
(hf : HasFiniteFPowerSeriesAt f pf x 0) : f =ᶠ[𝓝 x] 0 :=
Filter.eventuallyEq_iff_exists_mem.mpr (let ⟨r, hf⟩ := hf; ⟨EMetric.ball x r,
EMetric.ball_mem_nhds x hf.r_pos, fun y hy ↦ hf.eq_zero_of_bound_zero y hy⟩)
/-- If `f` has a formal power series on a ball bounded by `1`, then `f` is constant equal
to `f x` on the ball. -/
theorem HasFiniteFPowerSeriesOnBall.eq_const_of_bound_one
(hf : HasFiniteFPowerSeriesOnBall f pf x 1 r) : ∀ y ∈ EMetric.ball x r, f y = f x := by
intro y hy
rw [hf.eq_partialSum' y hy 1 le_rfl, hf.eq_partialSum' x
(by rw [EMetric.mem_ball, edist_self]; exact hf.r_pos) 1 le_rfl]
simp only [FormalMultilinearSeries.partialSum, Finset.range_one, Finset.sum_singleton]
congr
apply funext
simp only [IsEmpty.forall_iff]
/-- If `f` has a formal power series at x bounded by `1`, then `f` is constant equal
to `f x` in a neighborhood of `x`. -/
theorem HasFiniteFPowerSeriesAt.eventually_const_of_bound_one
(hf : HasFiniteFPowerSeriesAt f pf x 1) : f =ᶠ[𝓝 x] (fun _ => f x) :=
Filter.eventuallyEq_iff_exists_mem.mpr (let ⟨r, hf⟩ := hf; ⟨EMetric.ball x r,
EMetric.ball_mem_nhds x hf.r_pos, fun y hy ↦ hf.eq_const_of_bound_one y hy⟩)
/-- If a function admits a finite power series expansion on a disk, then it is continuous there. -/
protected theorem HasFiniteFPowerSeriesOnBall.continuousOn
(hf : HasFiniteFPowerSeriesOnBall f p x n r) :
ContinuousOn f (EMetric.ball x r) := hf.1.continuousOn
protected theorem HasFiniteFPowerSeriesAt.continuousAt (hf : HasFiniteFPowerSeriesAt f p x n) :
ContinuousAt f x := hf.hasFPowerSeriesAt.continuousAt
protected theorem CPolynomialAt.continuousAt (hf : CPolynomialAt 𝕜 f x) : ContinuousAt f x :=
hf.analyticAt.continuousAt
protected theorem CPolynomialOn.continuousOn {s : Set E} (hf : CPolynomialOn 𝕜 f s) :
ContinuousOn f s :=
hf.analyticOnNhd.continuousOn
/-- Continuously polynomial everywhere implies continuous -/
theorem CPolynomialOn.continuous {f : E → F} (fa : CPolynomialOn 𝕜 f univ) : Continuous f := by
rw [← continuousOn_univ]; exact fa.continuousOn
protected theorem FormalMultilinearSeries.sum_of_finite (p : FormalMultilinearSeries 𝕜 E F)
{n : ℕ} (hn : ∀ m, n ≤ m → p m = 0) (x : E) :
p.sum x = p.partialSum n x :=
tsum_eq_sum fun m hm ↦ by rw [Finset.mem_range, not_lt] at hm; rw [hn m hm]; rfl
/-- A finite formal multilinear series sums to its sum at every point. -/
protected theorem FormalMultilinearSeries.hasSum_of_finite (p : FormalMultilinearSeries 𝕜 E F)
{n : ℕ} (hn : ∀ m, n ≤ m → p m = 0) (x : E) :
HasSum (fun n : ℕ => p n fun _ => x) (p.sum x) :=
summable_of_ne_finset_zero (s := .range n)
(fun m hm ↦ by rw [Finset.mem_range, not_lt] at hm; rw [hn m hm]; rfl)
|>.hasSum
/-- The sum of a finite power series `p` admits `p` as a power series. -/
protected theorem FormalMultilinearSeries.hasFiniteFPowerSeriesOnBall_of_finite
(p : FormalMultilinearSeries 𝕜 E F) {n : ℕ} (hn : ∀ m, n ≤ m → p m = 0) :
HasFiniteFPowerSeriesOnBall p.sum p 0 n ⊤ where
r_le := by rw [radius_eq_top_of_forall_image_add_eq_zero p n fun _ => hn _ (Nat.le_add_left _ _)]
r_pos := zero_lt_top
finite := hn
hasSum {y} _ := by rw [zero_add]; exact p.hasSum_of_finite hn y
theorem HasFiniteFPowerSeriesOnBall.sum (h : HasFiniteFPowerSeriesOnBall f p x n r) {y : E}
(hy : y ∈ EMetric.ball (0 : E) r) : f (x + y) = p.sum y :=
(h.hasSum hy).tsum_eq.symm
/-- The sum of a finite power series is continuous. -/
protected theorem FormalMultilinearSeries.continuousOn_of_finite
(p : FormalMultilinearSeries 𝕜 E F) {n : ℕ} (hn : ∀ m, n ≤ m → p m = 0) :
Continuous p.sum := by
rw [← continuousOn_univ, ← Metric.emetric_ball_top]
exact (p.hasFiniteFPowerSeriesOnBall_of_finite hn).continuousOn
end FiniteFPowerSeries
namespace FormalMultilinearSeries
section
/-! We study what happens when we change the origin of a finite formal multilinear series `p`. The
main point is that the new series `p.changeOrigin x` is still finite, with the same bound. -/
/-- If `p` is a formal multilinear series such that `p m = 0` for `n ≤ m`, then
`p.changeOriginSeriesTerm k l = 0` for `n ≤ k + l`. -/
lemma changeOriginSeriesTerm_bound (p : FormalMultilinearSeries 𝕜 E F) {n : ℕ}
(hn : ∀ (m : ℕ), n ≤ m → p m = 0) (k l : ℕ) {s : Finset (Fin (k + l))}
(hs : s.card = l) (hkl : n ≤ k + l) :
p.changeOriginSeriesTerm k l s hs = 0 := by
rw [changeOriginSeriesTerm, hn _ hkl, map_zero]
/-- If `p` is a finite formal multilinear series, then so is `p.changeOriginSeries k` for every
`k` in `ℕ`. More precisely, if `p m = 0` for `n ≤ m`, then `p.changeOriginSeries k m = 0` for
`n ≤ k + m`. -/
lemma changeOriginSeries_finite_of_finite (p : FormalMultilinearSeries 𝕜 E F) {n : ℕ}
(hn : ∀ (m : ℕ), n ≤ m → p m = 0) (k : ℕ) : ∀ {m : ℕ}, n ≤ k + m →
p.changeOriginSeries k m = 0 := by
intro m hm
rw [changeOriginSeries]
exact Finset.sum_eq_zero (fun _ _ => p.changeOriginSeriesTerm_bound hn _ _ _ hm)
lemma changeOriginSeries_sum_eq_partialSum_of_finite (p : FormalMultilinearSeries 𝕜 E F) {n : ℕ}
(hn : ∀ (m : ℕ), n ≤ m → p m = 0) (k : ℕ) :
(p.changeOriginSeries k).sum = (p.changeOriginSeries k).partialSum (n - k) := by
ext x
rw [partialSum, FormalMultilinearSeries.sum,
tsum_eq_sum (f := fun m => p.changeOriginSeries k m (fun _ => x)) (s := Finset.range (n - k))]
intro m hm
rw [Finset.mem_range, not_lt] at hm
rw [p.changeOriginSeries_finite_of_finite hn k (by rw [add_comm]; exact Nat.le_add_of_sub_le hm),
ContinuousMultilinearMap.zero_apply]
/-- If `p` is a formal multilinear series such that `p m = 0` for `n ≤ m`, then
`p.changeOrigin x k = 0` for `n ≤ k`. -/
lemma changeOrigin_finite_of_finite (p : FormalMultilinearSeries 𝕜 E F) {n : ℕ}
(hn : ∀ (m : ℕ), n ≤ m → p m = 0) {k : ℕ} (hk : n ≤ k) :
p.changeOrigin x k = 0 := by
rw [changeOrigin, p.changeOriginSeries_sum_eq_partialSum_of_finite hn]
apply Finset.sum_eq_zero
intro m hm
rw [Finset.mem_range] at hm
rw [p.changeOriginSeries_finite_of_finite hn k (le_add_of_le_left hk),
ContinuousMultilinearMap.zero_apply]
theorem hasFiniteFPowerSeriesOnBall_changeOrigin (p : FormalMultilinearSeries 𝕜 E F) {n : ℕ}
(k : ℕ) (hn : ∀ (m : ℕ), n + k ≤ m → p m = 0) :
HasFiniteFPowerSeriesOnBall (p.changeOrigin · k) (p.changeOriginSeries k) 0 n ⊤ :=
(p.changeOriginSeries k).hasFiniteFPowerSeriesOnBall_of_finite
fun _ hm => p.changeOriginSeries_finite_of_finite hn k <| by grw [hm, add_comm]
theorem changeOrigin_eval_of_finite (p : FormalMultilinearSeries 𝕜 E F) {n : ℕ}
(hn : ∀ (m : ℕ), n ≤ m → p m = 0) (x y : E) :
(p.changeOrigin x).sum y = p.sum (x + y) := by
let f (s : Σ k l : ℕ, { s : Finset (Fin (k + l)) // s.card = l }) : F :=
p.changeOriginSeriesTerm s.1 s.2.1 s.2.2 s.2.2.2 (fun _ ↦ x) fun _ ↦ y
have finsupp : f.support.Finite := by
apply Set.Finite.subset (s := changeOriginIndexEquiv ⁻¹' (Sigma.fst ⁻¹' {m | m < n}))
· apply Set.Finite.preimage (Equiv.injective _).injOn
simp_rw [← {m | m < n}.iUnion_of_singleton_coe, preimage_iUnion, ← range_sigmaMk]
exact finite_iUnion fun _ ↦ finite_range _
· refine fun s ↦ Not.imp_symm fun hs ↦ ?_
simp only [preimage_setOf_eq, changeOriginIndexEquiv_apply_fst, mem_setOf, not_lt] at hs
dsimp only [f]
rw [changeOriginSeriesTerm_bound p hn _ _ _ hs, ContinuousMultilinearMap.zero_apply,
ContinuousMultilinearMap.zero_apply]
have hfkl k l : HasSum (f ⟨k, l, ·⟩) (changeOriginSeries p k l (fun _ ↦ x) fun _ ↦ y) := by
simp_rw [changeOriginSeries, ContinuousMultilinearMap.sum_apply]; apply hasSum_fintype
have hfk k : HasSum (f ⟨k, ·⟩) (changeOrigin p x k fun _ ↦ y) := by
have (m) (hm : m ∉ Finset.range n) : changeOriginSeries p k m (fun _ ↦ x) = 0 := by
rw [Finset.mem_range, not_lt] at hm
rw [changeOriginSeries_finite_of_finite _ hn _ (le_add_of_le_right hm),
ContinuousMultilinearMap.zero_apply]
rw [changeOrigin, FormalMultilinearSeries.sum,
ContinuousMultilinearMap.tsum_eval (summable_of_ne_finset_zero this)]
refine (summable_of_ne_finset_zero (s := Finset.range n) fun m hm ↦ ?_).hasSum.sigma_of_hasSum
(hfkl k) (summable_of_finite_support <| finsupp.preimage sigma_mk_injective.injOn)
rw [this m hm, ContinuousMultilinearMap.zero_apply]
have hf : HasSum f ((p.changeOrigin x).sum y) :=
((p.changeOrigin x).hasSum_of_finite (fun _ ↦ changeOrigin_finite_of_finite p hn) _)
|>.sigma_of_hasSum hfk (summable_of_finite_support finsupp)
refine hf.unique (changeOriginIndexEquiv.symm.hasSum_iff.1 ?_)
refine (p.hasSum_of_finite hn (x + y)).sigma_of_hasSum (fun n ↦ ?_)
(changeOriginIndexEquiv.symm.summable_iff.2 hf.summable)
rw [← Pi.add_def, (p n).map_add_univ (fun _ ↦ x) fun _ ↦ y]
simp_rw [← changeOriginSeriesTerm_changeOriginIndexEquiv_symm]
exact hasSum_fintype fun c ↦ f (changeOriginIndexEquiv.symm ⟨n, c⟩)
/-- The terms of the formal multilinear series `p.changeOrigin` are continuously polynomial
as we vary the origin -/
theorem cpolynomialAt_changeOrigin_of_finite (p : FormalMultilinearSeries 𝕜 E F)
{n : ℕ} (hn : ∀ (m : ℕ), n ≤ m → p m = 0) (k : ℕ) :
CPolynomialAt 𝕜 (p.changeOrigin · k) 0 :=
(p.hasFiniteFPowerSeriesOnBall_changeOrigin k fun _ h ↦ hn _ (le_self_add.trans h)).cpolynomialAt
end
end FormalMultilinearSeries
section
variable {x y : E}
theorem HasFiniteFPowerSeriesOnBall.changeOrigin (hf : HasFiniteFPowerSeriesOnBall f p x n r)
(h : (‖y‖₊ : ℝ≥0∞) < r) :
HasFiniteFPowerSeriesOnBall f (p.changeOrigin y) (x + y) n (r - ‖y‖₊) where
r_le := (tsub_le_tsub_right hf.r_le _).trans p.changeOrigin_radius
r_pos := by simp [h]
finite _ hm := p.changeOrigin_finite_of_finite hf.finite hm
hasSum {z} hz := by
have : f (x + y + z) =
FormalMultilinearSeries.sum (FormalMultilinearSeries.changeOrigin p y) z := by
rw [mem_emetric_ball_zero_iff, lt_tsub_iff_right, add_comm] at hz
rw [p.changeOrigin_eval_of_finite hf.finite, add_assoc, hf.sum]
exact mem_emetric_ball_zero_iff.2 ((enorm_add_le _ _).trans_lt hz)
rw [this]
apply (p.changeOrigin y).hasSum_of_finite fun _ => p.changeOrigin_finite_of_finite hf.finite
/-- If a function admits a finite power series expansion `p` on an open ball `B (x, r)`, then
it is continuously polynomial at every point of this ball. -/
theorem HasFiniteFPowerSeriesOnBall.cpolynomialAt_of_mem
(hf : HasFiniteFPowerSeriesOnBall f p x n r) (h : y ∈ EMetric.ball x r) :
CPolynomialAt 𝕜 f y := by
have : (‖y - x‖₊ : ℝ≥0∞) < r := by simpa [edist_eq_enorm_sub] using h
have := hf.changeOrigin this
rw [add_sub_cancel] at this
exact this.cpolynomialAt
theorem HasFiniteFPowerSeriesOnBall.cpolynomialOn (hf : HasFiniteFPowerSeriesOnBall f p x n r) :
CPolynomialOn 𝕜 f (EMetric.ball x r) :=
fun _y hy => hf.cpolynomialAt_of_mem hy
variable (𝕜 f)
/-- For any function `f` from a normed vector space to a normed vector space, the set of points
`x` such that `f` is continuously polynomial at `x` is open. -/
theorem isOpen_cpolynomialAt : IsOpen { x | CPolynomialAt 𝕜 f x } := by
rw [isOpen_iff_mem_nhds]
rintro x ⟨p, n, r, hr⟩
exact mem_of_superset (EMetric.ball_mem_nhds _ hr.r_pos) fun y hy => hr.cpolynomialAt_of_mem hy
variable {𝕜}
theorem CPolynomialAt.eventually_cpolynomialAt {f : E → F} {x : E} (h : CPolynomialAt 𝕜 f x) :
∀ᶠ y in 𝓝 x, CPolynomialAt 𝕜 f y :=
(isOpen_cpolynomialAt 𝕜 f).mem_nhds h
theorem CPolynomialAt.exists_mem_nhds_cpolynomialOn {f : E → F} {x : E} (h : CPolynomialAt 𝕜 f x) :
∃ s ∈ 𝓝 x, CPolynomialOn 𝕜 f s :=
h.eventually_cpolynomialAt.exists_mem
/-- If `f` is continuously polynomial at a point, then it is continuously polynomial in a
nonempty ball around that point. -/
theorem CPolynomialAt.exists_ball_cpolynomialOn {f : E → F} {x : E} (h : CPolynomialAt 𝕜 f x) :
∃ r : ℝ, 0 < r ∧ CPolynomialOn 𝕜 f (Metric.ball x r) :=
Metric.isOpen_iff.mp (isOpen_cpolynomialAt _ _) _ h
end |
.lake/packages/mathlib/Mathlib/Analysis/Analytic/WithLp.lean | import Mathlib.Analysis.Analytic.Linear
import Mathlib.Analysis.Normed.Lp.PiLp
/-!
# Analyticity on `WithLp`
-/
open WithLp
open scoped ENNReal
namespace WithLp
variable {𝕜 E F : Type*} [NontriviallyNormedField 𝕜] [NormedAddCommGroup E] [NormedAddCommGroup F]
[NormedSpace 𝕜 E] [NormedSpace 𝕜 F] (p : ℝ≥0∞) [Fact (1 ≤ p)]
lemma analyticOn_ofLp (s : Set (WithLp p (E × F))) : AnalyticOn 𝕜 ofLp s :=
(prodContinuousLinearEquiv p 𝕜 E F).analyticOn s
lemma analyticOn_toLp (s : Set (E × F)) : AnalyticOn 𝕜 (toLp p) s :=
(prodContinuousLinearEquiv p 𝕜 E F).symm.analyticOn s
end WithLp
namespace PiLp
variable {𝕜 ι : Type*} [Fintype ι] {E : ι → Type*} [NontriviallyNormedField 𝕜]
[∀ i, NormedAddCommGroup (E i)] [∀ i, NormedSpace 𝕜 (E i)] (p : ℝ≥0∞) [Fact (1 ≤ p)]
lemma analyticOn_ofLp (s : Set (PiLp p E)) : AnalyticOn 𝕜 ofLp s :=
(continuousLinearEquiv p 𝕜 E).analyticOn s
lemma analyticOn_toLp (s : Set (Π i, E i)) : AnalyticOn 𝕜 (toLp p) s :=
(continuousLinearEquiv p 𝕜 E).symm.analyticOn s
end PiLp |
.lake/packages/mathlib/Mathlib/Analysis/Analytic/Polynomial.lean | import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Algebra.MvPolynomial.Eval
import Mathlib.Analysis.Analytic.Constructions
import Mathlib.Topology.Algebra.Module.FiniteDimension
/-!
# Polynomials are analytic
This file combines the analysis and algebra libraries and shows that evaluation of a polynomial
is an analytic function.
-/
variable {𝕜 E A B : Type*} [NontriviallyNormedField 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E]
[CommSemiring A] {z : E} {s : Set E}
section Polynomial
open Polynomial
variable [NormedRing B] [NormedAlgebra 𝕜 B] [Algebra A B] {f : E → B}
theorem AnalyticWithinAt.aeval_polynomial (hf : AnalyticWithinAt 𝕜 f s z) (p : A[X]) :
AnalyticWithinAt 𝕜 (fun x ↦ aeval (f x) p) s z := by
refine p.induction_on (fun k ↦ ?_) (fun p q hp hq ↦ ?_) fun p i hp ↦ ?_
· simp_rw [aeval_C]; apply analyticWithinAt_const
· simp_rw [aeval_add]; exact hp.add hq
· convert hp.mul hf
simp_rw [pow_succ, aeval_mul, ← mul_assoc, aeval_X]
theorem AnalyticAt.aeval_polynomial (hf : AnalyticAt 𝕜 f z) (p : A[X]) :
AnalyticAt 𝕜 (fun x ↦ aeval (f x) p) z := by
rw [← analyticWithinAt_univ] at hf ⊢
exact hf.aeval_polynomial p
theorem AnalyticOnNhd.aeval_polynomial (hf : AnalyticOnNhd 𝕜 f s) (p : A[X]) :
AnalyticOnNhd 𝕜 (fun x ↦ aeval (f x) p) s := fun x hx ↦ (hf x hx).aeval_polynomial p
theorem AnalyticOn.aeval_polynomial (hf : AnalyticOn 𝕜 f s) (p : A[X]) :
AnalyticOn 𝕜 (fun x ↦ aeval (f x) p) s := fun x hx ↦ (hf x hx).aeval_polynomial p
theorem AnalyticOnNhd.eval_polynomial {A} [NormedCommRing A] [NormedAlgebra 𝕜 A] (p : A[X]) :
AnalyticOnNhd 𝕜 (eval · p) Set.univ := analyticOnNhd_id.aeval_polynomial p
theorem AnalyticOn.eval_polynomial {A} [NormedCommRing A] [NormedAlgebra 𝕜 A] (p : A[X]) :
AnalyticOn 𝕜 (eval · p) Set.univ := analyticOn_id.aeval_polynomial p
end Polynomial
section MvPolynomial
open MvPolynomial
variable [NormedCommRing B] [NormedAlgebra 𝕜 B] [Algebra A B] {σ : Type*} {f : E → σ → B}
theorem AnalyticAt.aeval_mvPolynomial (hf : ∀ i, AnalyticAt 𝕜 (f · i) z) (p : MvPolynomial σ A) :
AnalyticAt 𝕜 (fun x ↦ aeval (f x) p) z := by
apply p.induction_on (fun k ↦ ?_) (fun p q hp hq ↦ ?_) fun p i hp ↦ ?_ -- `refine` doesn't work
· simp_rw [aeval_C]; apply analyticAt_const
· simp_rw [map_add]; exact hp.add hq
· simp_rw [map_mul, aeval_X]; exact hp.mul (hf i)
theorem AnalyticOnNhd.aeval_mvPolynomial
(hf : ∀ i, AnalyticOnNhd 𝕜 (f · i) s) (p : MvPolynomial σ A) :
AnalyticOnNhd 𝕜 (fun x ↦ aeval (f x) p) s := fun x hx ↦ .aeval_mvPolynomial (hf · x hx) p
theorem AnalyticOnNhd.eval_continuousLinearMap (f : E →L[𝕜] σ → B) (p : MvPolynomial σ B) :
AnalyticOnNhd 𝕜 (fun x ↦ eval (f x) p) Set.univ :=
fun x _ ↦ .aeval_mvPolynomial (fun i ↦ ((ContinuousLinearMap.proj i).comp f).analyticAt x) p
theorem AnalyticOnNhd.eval_continuousLinearMap' (f : σ → E →L[𝕜] B) (p : MvPolynomial σ B) :
AnalyticOnNhd 𝕜 (fun x ↦ eval (f · x) p) Set.univ :=
fun x _ ↦ .aeval_mvPolynomial (fun i ↦ (f i).analyticAt x) p
variable [CompleteSpace 𝕜] [T2Space E] [FiniteDimensional 𝕜 E]
theorem AnalyticOnNhd.eval_linearMap (f : E →ₗ[𝕜] σ → B) (p : MvPolynomial σ B) :
AnalyticOnNhd 𝕜 (fun x ↦ eval (f x) p) Set.univ :=
AnalyticOnNhd.eval_continuousLinearMap { f with cont := f.continuous_of_finiteDimensional } p
theorem AnalyticOnNhd.eval_linearMap' (f : σ → E →ₗ[𝕜] B) (p : MvPolynomial σ B) :
AnalyticOnNhd 𝕜 (fun x ↦ eval (f · x) p) Set.univ := AnalyticOnNhd.eval_linearMap (.pi f) p
theorem AnalyticOnNhd.eval_mvPolynomial [Fintype σ] (p : MvPolynomial σ 𝕜) :
AnalyticOnNhd 𝕜 (eval · p) Set.univ :=
AnalyticOnNhd.eval_linearMap (.id (R := 𝕜) (M := σ → 𝕜)) p
end MvPolynomial |
.lake/packages/mathlib/Mathlib/Analysis/Analytic/Within.lean | import Mathlib.Analysis.Analytic.Constructions
import Mathlib.Analysis.Analytic.ChangeOrigin
/-!
# Properties of analyticity restricted to a set
From `Mathlib/Analysis/Analytic/Basic.lean`, we have the definitions
1. `AnalyticWithinAt 𝕜 f s x` means a power series at `x` converges to `f` on `𝓝[insert x s] x`.
2. `AnalyticOn 𝕜 f s t` means `∀ x ∈ t, AnalyticWithinAt 𝕜 f s x`.
This means there exists an extension of `f` which is analytic and agrees with `f` on `s ∪ {x}`, but
`f` is allowed to be arbitrary elsewhere.
Here we prove basic properties of these definitions. Where convenient we assume completeness of the
ambient space, which allows us to relate `AnalyticWithinAt` to analyticity of a local extension.
-/
noncomputable section
open Topology Filter ENNReal
open Set Filter
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜]
variable {E F : Type*}
[NormedAddCommGroup E] [NormedSpace 𝕜 E] [NormedAddCommGroup F] [NormedSpace 𝕜 F]
/-!
### Basic properties
-/
/-- `AnalyticWithinAt` is trivial if `{x} ∈ 𝓝[s] x` -/
lemma analyticWithinAt_of_singleton_mem {f : E → F} {s : Set E} {x : E} (h : {x} ∈ 𝓝[s] x) :
AnalyticWithinAt 𝕜 f s x := by
rcases mem_nhdsWithin.mp h with ⟨t, ot, xt, st⟩
rcases Metric.mem_nhds_iff.mp (ot.mem_nhds xt) with ⟨r, r0, rt⟩
exact ⟨constFormalMultilinearSeries 𝕜 E (f x), .ofReal r,
{ r_le := by simp only [FormalMultilinearSeries.constFormalMultilinearSeries_radius, le_top]
r_pos := by positivity
hasSum := by
intro y ys yr
simp only [subset_singleton_iff, mem_inter_iff, and_imp] at st
simp only [mem_insert_iff, add_eq_left] at ys
have : x + y = x := by
rcases ys with rfl | ys
· simp
· exact st (x + y) (rt (by simpa using yr)) ys
simp only [this]
apply (hasFPowerSeriesOnBall_const (e := 0)).hasSum
simp only [Metric.emetric_ball_top, mem_univ] }⟩
/-- If `f` is `AnalyticOn` near each point in a set, it is `AnalyticOn` the set -/
lemma analyticOn_of_locally_analyticOn {f : E → F} {s : Set E}
(h : ∀ x ∈ s, ∃ u, IsOpen u ∧ x ∈ u ∧ AnalyticOn 𝕜 f (s ∩ u)) :
AnalyticOn 𝕜 f s := by
intro x m
rcases h x m with ⟨u, ou, xu, fu⟩
rcases Metric.mem_nhds_iff.mp (ou.mem_nhds xu) with ⟨r, r0, ru⟩
rcases fu x ⟨m, xu⟩ with ⟨p, t, fp⟩
exact ⟨p, min (.ofReal r) t,
{ r_pos := lt_min (by positivity) fp.r_pos
r_le := min_le_of_right_le fp.r_le
hasSum := by
intro y ys yr
simp only [EMetric.mem_ball, lt_min_iff, edist_lt_ofReal, dist_zero_right] at yr
apply fp.hasSum
· simp only [mem_insert_iff, add_eq_left] at ys
rcases ys with rfl | ys
· simp
· simp only [mem_insert_iff, add_eq_left, mem_inter_iff, ys, true_and]
apply Or.inr (ru ?_)
simp only [Metric.mem_ball, dist_self_add_left, yr]
· simp only [EMetric.mem_ball, yr] }⟩
/-- On open sets, `AnalyticOnNhd` and `AnalyticOn` coincide -/
lemma IsOpen.analyticOn_iff_analyticOnNhd {f : E → F} {s : Set E} (hs : IsOpen s) :
AnalyticOn 𝕜 f s ↔ AnalyticOnNhd 𝕜 f s := by
refine ⟨?_, AnalyticOnNhd.analyticOn⟩
intro hf x m
rcases Metric.mem_nhds_iff.mp (hs.mem_nhds m) with ⟨r, r0, rs⟩
rcases hf x m with ⟨p, t, fp⟩
exact ⟨p, min (.ofReal r) t,
{ r_pos := lt_min (by positivity) fp.r_pos
r_le := min_le_of_right_le fp.r_le
hasSum := by
intro y ym
simp only [EMetric.mem_ball, lt_min_iff, edist_lt_ofReal, dist_zero_right] at ym
refine fp.hasSum ?_ ym.2
apply mem_insert_of_mem
apply rs
simp only [Metric.mem_ball, dist_self_add_left, ym.1] }⟩
/-!
### Equivalence to analyticity of a local extension
We show that `HasFPowerSeriesWithinOnBall`, `HasFPowerSeriesWithinAt`, and `AnalyticWithinAt` are
equivalent to the existence of a local extension with full analyticity. We do not yet show a
result for `AnalyticOn`, as this requires a bit more work to show that local extensions can
be stitched together.
-/
set_option linter.style.multiGoal false in
/-- `f` has power series `p` at `x` iff some local extension of `f` has that series -/
lemma hasFPowerSeriesWithinOnBall_iff_exists_hasFPowerSeriesOnBall [CompleteSpace F] {f : E → F}
{p : FormalMultilinearSeries 𝕜 E F} {s : Set E} {x : E} {r : ℝ≥0∞} :
HasFPowerSeriesWithinOnBall f p s x r ↔
∃ g, EqOn f g (insert x s ∩ EMetric.ball x r) ∧
HasFPowerSeriesOnBall g p x r := by
constructor
· intro h
refine ⟨fun y ↦ p.sum (y - x), ?_, ?_⟩
· intro y ⟨ys,yb⟩
simp only [EMetric.mem_ball, edist_eq_enorm_sub] at yb
have e0 := p.hasSum (x := y - x) ?_
have e1 := (h.hasSum (y := y - x) ?_ ?_)
· simp only [add_sub_cancel] at e1
exact e1.unique e0
· simpa only [add_sub_cancel]
· simpa only [EMetric.mem_ball, edist_zero_eq_enorm]
· simp only [EMetric.mem_ball, edist_zero_eq_enorm]
exact lt_of_lt_of_le yb h.r_le
· refine ⟨h.r_le, h.r_pos, ?_⟩
intro y lt
simp only [add_sub_cancel_left]
apply p.hasSum
simp only [EMetric.mem_ball] at lt ⊢
exact lt_of_lt_of_le lt h.r_le
· intro ⟨g, hfg, hg⟩
refine ⟨hg.r_le, hg.r_pos, ?_⟩
intro y ys lt
rw [hfg]
· exact hg.hasSum lt
· refine ⟨ys, ?_⟩
simpa only [EMetric.mem_ball, edist_eq_enorm_sub, add_sub_cancel_left, sub_zero] using lt
/-- `f` has power series `p` at `x` iff some local extension of `f` has that series -/
lemma hasFPowerSeriesWithinAt_iff_exists_hasFPowerSeriesAt [CompleteSpace F] {f : E → F}
{p : FormalMultilinearSeries 𝕜 E F} {s : Set E} {x : E} :
HasFPowerSeriesWithinAt f p s x ↔
∃ g, f =ᶠ[𝓝[insert x s] x] g ∧ HasFPowerSeriesAt g p x := by
constructor
· intro ⟨r, h⟩
rcases hasFPowerSeriesWithinOnBall_iff_exists_hasFPowerSeriesOnBall.mp h with ⟨g, e, h⟩
refine ⟨g, ?_, ⟨r, h⟩⟩
refine Filter.eventuallyEq_iff_exists_mem.mpr ⟨_, ?_, e⟩
exact inter_mem_nhdsWithin _ (EMetric.ball_mem_nhds _ h.r_pos)
· intro ⟨g, hfg, ⟨r, hg⟩⟩
simp only [eventuallyEq_nhdsWithin_iff, Metric.eventually_nhds_iff] at hfg
rcases hfg with ⟨e, e0, hfg⟩
refine ⟨min r (.ofReal e), ?_⟩
refine hasFPowerSeriesWithinOnBall_iff_exists_hasFPowerSeriesOnBall.mpr ⟨g, ?_, ?_⟩
· intro y ⟨ys, xy⟩
refine hfg ?_ ys
simp only [EMetric.mem_ball, lt_min_iff, edist_lt_ofReal] at xy
exact xy.2
· exact hg.mono (lt_min hg.r_pos (by positivity)) (min_le_left _ _)
/-- `f` is analytic within `s` at `x` iff some local extension of `f` is analytic at `x` -/
lemma analyticWithinAt_iff_exists_analyticAt [CompleteSpace F] {f : E → F} {s : Set E} {x : E} :
AnalyticWithinAt 𝕜 f s x ↔
∃ g, f =ᶠ[𝓝[insert x s] x] g ∧ AnalyticAt 𝕜 g x := by
simp only [AnalyticWithinAt, AnalyticAt, hasFPowerSeriesWithinAt_iff_exists_hasFPowerSeriesAt]
tauto
/-- `f` is analytic within `s` at `x` iff some local extension of `f` is analytic at `x`. In this
version, we make sure that the extension coincides with `f` on all of `insert x s`. -/
lemma analyticWithinAt_iff_exists_analyticAt' [CompleteSpace F] {f : E → F} {s : Set E} {x : E} :
AnalyticWithinAt 𝕜 f s x ↔
∃ g, f x = g x ∧ EqOn f g (insert x s) ∧ AnalyticAt 𝕜 g x := by
classical
simp only [analyticWithinAt_iff_exists_analyticAt]
refine ⟨?_, ?_⟩
· rintro ⟨g, hf, hg⟩
rcases mem_nhdsWithin.1 hf with ⟨u, u_open, xu, hu⟩
let g' := Set.piecewise u g f
refine ⟨g', ?_, ?_, ?_⟩
· have : x ∈ u ∩ insert x s := ⟨xu, by simp⟩
simpa [g', xu, this] using hu this
· intro y hy
by_cases h'y : y ∈ u
· have : y ∈ u ∩ insert x s := ⟨h'y, hy⟩
simpa [g', h'y, this] using hu this
· simp [g', h'y]
· apply hg.congr
filter_upwards [u_open.mem_nhds xu] with y hy using by simp [g', hy]
· rintro ⟨g, -, hf, hg⟩
exact ⟨g, by filter_upwards [self_mem_nhdsWithin] using hf, hg⟩
alias ⟨AnalyticWithinAt.exists_analyticAt, _⟩ := analyticWithinAt_iff_exists_analyticAt'
lemma AnalyticWithinAt.exists_mem_nhdsWithin_analyticOn
[CompleteSpace F] {f : E → F} {s : Set E} {x : E} (h : AnalyticWithinAt 𝕜 f s x) :
∃ u ∈ 𝓝[insert x s] x, AnalyticOn 𝕜 f u := by
obtain ⟨g, -, h'g, hg⟩ : ∃ g, f x = g x ∧ EqOn f g (insert x s) ∧ AnalyticAt 𝕜 g x :=
h.exists_analyticAt
let u := insert x s ∩ {y | AnalyticAt 𝕜 g y}
refine ⟨u, ?_, ?_⟩
· exact inter_mem_nhdsWithin _ ((isOpen_analyticAt 𝕜 g).mem_nhds hg)
· intro y hy
have : AnalyticWithinAt 𝕜 g u y := hy.2.analyticWithinAt
exact this.congr (h'g.mono (inter_subset_left)) (h'g (inter_subset_left hy))
theorem AnalyticWithinAt.eventually_analyticWithinAt
[CompleteSpace F] {f : E → F} {s : Set E} {x : E}
(hf : AnalyticWithinAt 𝕜 f s x) : ∀ᶠ y in 𝓝[s] x, AnalyticWithinAt 𝕜 f s y := by
obtain ⟨g, hfg, hga⟩ := analyticWithinAt_iff_exists_analyticAt.mp hf
simp only [Filter.EventuallyEq, eventually_nhdsWithin_iff] at hfg ⊢
filter_upwards [hfg.eventually_nhds, hga.eventually_analyticAt] with z hfgz hgaz hz
refine analyticWithinAt_iff_exists_analyticAt.mpr ⟨g, ?_, hgaz⟩
exact (eventually_nhdsWithin_iff.mpr hfgz).filter_mono <| nhdsWithin_mono _ (by simp [hz]) |
.lake/packages/mathlib/Mathlib/Analysis/Analytic/CPolynomial.lean | import Mathlib.Analysis.Analytic.Constructions
import Mathlib.Analysis.Analytic.CPolynomialDef
/-! # Properties of continuously polynomial functions
We expand the API around continuously polynomial functions. Notably, we show that this class is
stable under the usual operations (addition, subtraction, negation).
We also prove that continuous multilinear maps are continuously polynomial, and so
are continuous linear maps into continuous multilinear maps. In particular, such maps are
analytic.
-/
variable {𝕜 E F G : Type*} [NontriviallyNormedField 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E]
[NormedAddCommGroup F] [NormedSpace 𝕜 F] [NormedAddCommGroup G] [NormedSpace 𝕜 G]
open scoped Topology
open Set Filter Asymptotics NNReal ENNReal
variable {f g : E → F} {p pf pg : FormalMultilinearSeries 𝕜 E F} {x : E} {r r' : ℝ≥0∞} {n m : ℕ}
theorem hasFiniteFPowerSeriesOnBall_const {c : F} {e : E} :
HasFiniteFPowerSeriesOnBall (fun _ => c) (constFormalMultilinearSeries 𝕜 E c) e 1 ⊤ :=
⟨hasFPowerSeriesOnBall_const,
fun _ hn ↦ constFormalMultilinearSeries_apply_of_nonzero (Nat.ne_zero_of_lt hn)⟩
theorem hasFiniteFPowerSeriesAt_const {c : F} {e : E} :
HasFiniteFPowerSeriesAt (fun _ => c) (constFormalMultilinearSeries 𝕜 E c) e 1 :=
⟨⊤, hasFiniteFPowerSeriesOnBall_const⟩
theorem CPolynomialAt_const {v : F} : CPolynomialAt 𝕜 (fun _ => v) x :=
⟨constFormalMultilinearSeries 𝕜 E v, 1, hasFiniteFPowerSeriesAt_const⟩
theorem CPolynomialOn_const {v : F} {s : Set E} : CPolynomialOn 𝕜 (fun _ => v) s :=
fun _ _ => CPolynomialAt_const
theorem HasFiniteFPowerSeriesOnBall.add (hf : HasFiniteFPowerSeriesOnBall f pf x n r)
(hg : HasFiniteFPowerSeriesOnBall g pg x m r) :
HasFiniteFPowerSeriesOnBall (f + g) (pf + pg) x (max n m) r :=
⟨hf.1.add hg.1, fun N hN ↦ by
rw [Pi.add_apply, hf.finite _ ((le_max_left n m).trans hN),
hg.finite _ ((le_max_right n m).trans hN), zero_add]⟩
theorem HasFiniteFPowerSeriesAt.add (hf : HasFiniteFPowerSeriesAt f pf x n)
(hg : HasFiniteFPowerSeriesAt g pg x m) :
HasFiniteFPowerSeriesAt (f + g) (pf + pg) x (max n m) := by
rcases (hf.eventually.and hg.eventually).exists with ⟨r, hr⟩
exact ⟨r, hr.1.add hr.2⟩
theorem CPolynomialAt.add (hf : CPolynomialAt 𝕜 f x) (hg : CPolynomialAt 𝕜 g x) :
CPolynomialAt 𝕜 (f + g) x :=
let ⟨_, _, hpf⟩ := hf
let ⟨_, _, hqf⟩ := hg
(hpf.add hqf).cpolynomialAt
theorem HasFiniteFPowerSeriesOnBall.neg (hf : HasFiniteFPowerSeriesOnBall f pf x n r) :
HasFiniteFPowerSeriesOnBall (-f) (-pf) x n r :=
⟨hf.1.neg, fun m hm ↦ by rw [Pi.neg_apply, hf.finite m hm, neg_zero]⟩
theorem HasFiniteFPowerSeriesAt.neg (hf : HasFiniteFPowerSeriesAt f pf x n) :
HasFiniteFPowerSeriesAt (-f) (-pf) x n :=
let ⟨_, hrf⟩ := hf
hrf.neg.hasFiniteFPowerSeriesAt
theorem CPolynomialAt.neg (hf : CPolynomialAt 𝕜 f x) : CPolynomialAt 𝕜 (-f) x :=
let ⟨_, _, hpf⟩ := hf
hpf.neg.cpolynomialAt
theorem HasFiniteFPowerSeriesOnBall.sub (hf : HasFiniteFPowerSeriesOnBall f pf x n r)
(hg : HasFiniteFPowerSeriesOnBall g pg x m r) :
HasFiniteFPowerSeriesOnBall (f - g) (pf - pg) x (max n m) r := by
simpa only [sub_eq_add_neg] using hf.add hg.neg
theorem HasFiniteFPowerSeriesAt.sub (hf : HasFiniteFPowerSeriesAt f pf x n)
(hg : HasFiniteFPowerSeriesAt g pg x m) :
HasFiniteFPowerSeriesAt (f - g) (pf - pg) x (max n m) := by
simpa only [sub_eq_add_neg] using hf.add hg.neg
theorem CPolynomialAt.sub (hf : CPolynomialAt 𝕜 f x) (hg : CPolynomialAt 𝕜 g x) :
CPolynomialAt 𝕜 (f - g) x := by
simpa only [sub_eq_add_neg] using hf.add hg.neg
theorem CPolynomialOn.add {s : Set E} (hf : CPolynomialOn 𝕜 f s) (hg : CPolynomialOn 𝕜 g s) :
CPolynomialOn 𝕜 (f + g) s :=
fun z hz => (hf z hz).add (hg z hz)
theorem CPolynomialOn.sub {s : Set E} (hf : CPolynomialOn 𝕜 f s) (hg : CPolynomialOn 𝕜 g s) :
CPolynomialOn 𝕜 (f - g) s :=
fun z hz => (hf z hz).sub (hg z hz)
/-!
### Continuous multilinear maps
We show that continuous multilinear maps are continuously polynomial, and therefore analytic.
-/
namespace ContinuousMultilinearMap
variable {ι : Type*} {Em : ι → Type*} [∀ i, NormedAddCommGroup (Em i)] [∀ i, NormedSpace 𝕜 (Em i)]
[Fintype ι] (f : ContinuousMultilinearMap 𝕜 Em F) {x : Π i, Em i} {s : Set (Π i, Em i)}
open FormalMultilinearSeries
protected theorem hasFiniteFPowerSeriesOnBall :
HasFiniteFPowerSeriesOnBall f f.toFormalMultilinearSeries 0 (Fintype.card ι + 1) ⊤ :=
.mk' (fun _ hm ↦ dif_neg (Nat.succ_le_iff.mp hm).ne) ENNReal.zero_lt_top fun y _ ↦ by
rw [Finset.sum_eq_single_of_mem _ (Finset.self_mem_range_succ _), zero_add]
· rw [toFormalMultilinearSeries, dif_pos rfl]; rfl
· intro m _ ne; rw [toFormalMultilinearSeries, dif_neg ne.symm]; rfl
lemma cpolynomialAt : CPolynomialAt 𝕜 f x :=
f.hasFiniteFPowerSeriesOnBall.cpolynomialAt_of_mem
(by simp only [Metric.emetric_ball_top, Set.mem_univ])
lemma cpolynomialOn : CPolynomialOn 𝕜 f s := fun _ _ ↦ f.cpolynomialAt
lemma analyticOnNhd : AnalyticOnNhd 𝕜 f s := f.cpolynomialOn.analyticOnNhd
lemma analyticOn : AnalyticOn 𝕜 f s := f.analyticOnNhd.analyticOn
lemma analyticAt : AnalyticAt 𝕜 f x := f.cpolynomialAt.analyticAt
lemma analyticWithinAt : AnalyticWithinAt 𝕜 f s x := f.analyticAt.analyticWithinAt
end ContinuousMultilinearMap
/-!
### Continuous linear maps into continuous multilinear maps
We show that a continuous linear map into continuous multilinear maps is continuously polynomial
(as a function of two variables, i.e., uncurried). Therefore, it is also analytic.
-/
namespace ContinuousLinearMap
variable {ι : Type*} {Em : ι → Type*} [∀ i, NormedAddCommGroup (Em i)] [∀ i, NormedSpace 𝕜 (Em i)]
[Fintype ι] (f : G →L[𝕜] ContinuousMultilinearMap 𝕜 Em F)
{s : Set (G × (Π i, Em i))} {x : G × (Π i, Em i)}
/-- Formal multilinear series associated to a linear map into multilinear maps. -/
noncomputable def toFormalMultilinearSeriesOfMultilinear :
FormalMultilinearSeries 𝕜 (G × (Π i, Em i)) F :=
fun n ↦ if h : Fintype.card (Option ι) = n then
(f.continuousMultilinearMapOption).domDomCongr (Fintype.equivFinOfCardEq h)
else 0
protected theorem hasFiniteFPowerSeriesOnBall_uncurry_of_multilinear :
HasFiniteFPowerSeriesOnBall (fun (p : G × (Π i, Em i)) ↦ f p.1 p.2)
f.toFormalMultilinearSeriesOfMultilinear 0 (Fintype.card (Option ι) + 1) ⊤ := by
apply HasFiniteFPowerSeriesOnBall.mk' ?_ ENNReal.zero_lt_top ?_
· intro m hm
apply dif_neg
exact Nat.ne_of_lt hm
· intro y _
rw [Finset.sum_eq_single_of_mem _ (Finset.self_mem_range_succ _), zero_add]
· rw [toFormalMultilinearSeriesOfMultilinear, dif_pos rfl]; rfl
· intro m _ ne; rw [toFormalMultilinearSeriesOfMultilinear, dif_neg ne.symm]; rfl
lemma cpolynomialAt_uncurry_of_multilinear :
CPolynomialAt 𝕜 (fun (p : G × (Π i, Em i)) ↦ f p.1 p.2) x :=
f.hasFiniteFPowerSeriesOnBall_uncurry_of_multilinear.cpolynomialAt_of_mem
(by simp only [Metric.emetric_ball_top, Set.mem_univ])
lemma cpolynomialOn_uncurry_of_multilinear :
CPolynomialOn 𝕜 (fun (p : G × (Π i, Em i)) ↦ f p.1 p.2) s :=
fun _ _ ↦ f.cpolynomialAt_uncurry_of_multilinear
@[deprecated (since := "2025-09-15")]
alias cpolyomialOn_uncurry_of_multilinear := cpolynomialOn_uncurry_of_multilinear
lemma analyticOnNhd_uncurry_of_multilinear :
AnalyticOnNhd 𝕜 (fun (p : G × (Π i, Em i)) ↦ f p.1 p.2) s :=
f.cpolynomialOn_uncurry_of_multilinear.analyticOnNhd
lemma analyticOn_uncurry_of_multilinear :
AnalyticOn 𝕜 (fun (p : G × (Π i, Em i)) ↦ f p.1 p.2) s :=
f.analyticOnNhd_uncurry_of_multilinear.analyticOn
lemma analyticAt_uncurry_of_multilinear : AnalyticAt 𝕜 (fun (p : G × (Π i, Em i)) ↦ f p.1 p.2) x :=
f.cpolynomialAt_uncurry_of_multilinear.analyticAt
lemma analyticWithinAt_uncurry_of_multilinear :
AnalyticWithinAt 𝕜 (fun (p : G × (Π i, Em i)) ↦ f p.1 p.2) s x :=
f.analyticAt_uncurry_of_multilinear.analyticWithinAt
end ContinuousLinearMap
namespace ContinuousMultilinearMap
variable {ι : Type*} {Em Fm : ι → Type*}
[∀ i, NormedAddCommGroup (Em i)] [∀ i, NormedSpace 𝕜 (Em i)]
[∀ i, NormedAddCommGroup (Fm i)] [∀ i, NormedSpace 𝕜 (Fm i)]
[Fintype ι] (f : ContinuousMultilinearMap 𝕜 Em (G →L[𝕜] F))
{s : Set ((Π i, Em i) × G)} {x : (Π i, Em i) × G}
lemma cpolynomialAt_uncurry_of_linear :
CPolynomialAt 𝕜 (fun (p : (Π i, Em i) × G) ↦ f p.1 p.2) x := by
have : CPolynomialAt 𝕜 (ContinuousLinearEquiv.prodComm 𝕜 (Π i, Em i) G).toContinuousLinearMap x :=
ContinuousLinearMap.cpolynomialAt _ _
exact f.flipLinear.cpolynomialAt_uncurry_of_multilinear.comp this
lemma cpolyomialOn_uncurry_of_linear :
CPolynomialOn 𝕜 (fun (p : (Π i, Em i) × G) ↦ f p.1 p.2) s :=
fun _ _ ↦ f.cpolynomialAt_uncurry_of_linear
lemma analyticOnNhd_uncurry_of_linear :
AnalyticOnNhd 𝕜 (fun (p : (Π i, Em i) × G) ↦ f p.1 p.2) s :=
f.cpolyomialOn_uncurry_of_linear.analyticOnNhd
lemma analyticOn_uncurry_of_linear :
AnalyticOn 𝕜 (fun (p : (Π i, Em i) × G) ↦ f p.1 p.2) s :=
f.analyticOnNhd_uncurry_of_linear.analyticOn
lemma analyticAt_uncurry_of_linear : AnalyticAt 𝕜 (fun (p : (Π i, Em i) × G) ↦ f p.1 p.2) x :=
f.cpolynomialAt_uncurry_of_linear.analyticAt
lemma analyticWithinAt_uncurry_of_linear :
AnalyticWithinAt 𝕜 (fun (p : (Π i, Em i) × G) ↦ f p.1 p.2) s x :=
f.analyticAt_uncurry_of_linear.analyticWithinAt
variable {t : Set ((Π i, Fm i →L[𝕜] Em i) × (ContinuousMultilinearMap 𝕜 Em G))}
{q : (Π i, Fm i →L[𝕜] Em i) × (ContinuousMultilinearMap 𝕜 Em G)}
lemma cpolynomialAt_uncurry_compContinuousLinearMap :
CPolynomialAt 𝕜 (fun (p : (Π i, Fm i →L[𝕜] Em i) × (ContinuousMultilinearMap 𝕜 Em G))
↦ p.2.compContinuousLinearMap p.1) q :=
cpolynomialAt_uncurry_of_linear
(ContinuousMultilinearMap.compContinuousLinearMapContinuousMultilinear 𝕜 Fm Em G)
lemma cpolynomialOn_uncurry_compContinuousLinearMap :
CPolynomialOn 𝕜 (fun (p : (Π i, Fm i →L[𝕜] Em i) × (ContinuousMultilinearMap 𝕜 Em G))
↦ p.2.compContinuousLinearMap p.1) t :=
cpolyomialOn_uncurry_of_linear
(ContinuousMultilinearMap.compContinuousLinearMapContinuousMultilinear 𝕜 Fm Em G)
lemma analyticOnNhd_uncurry_compContinuousLinearMap :
AnalyticOnNhd 𝕜 (fun (p : (Π i, Fm i →L[𝕜] Em i) × (ContinuousMultilinearMap 𝕜 Em G))
↦ p.2.compContinuousLinearMap p.1) t :=
analyticOnNhd_uncurry_of_linear
(ContinuousMultilinearMap.compContinuousLinearMapContinuousMultilinear 𝕜 Fm Em G)
lemma analyticOn_uncurry_compContinuousLinearMap :
AnalyticOn 𝕜 (fun (p : (Π i, Fm i →L[𝕜] Em i) × (ContinuousMultilinearMap 𝕜 Em G))
↦ p.2.compContinuousLinearMap p.1) t :=
analyticOn_uncurry_of_linear
(ContinuousMultilinearMap.compContinuousLinearMapContinuousMultilinear 𝕜 Fm Em G)
lemma analyticAt_uncurry_compContinuousLinearMap :
AnalyticAt 𝕜 (fun (p : (Π i, Fm i →L[𝕜] Em i) × (ContinuousMultilinearMap 𝕜 Em G))
↦ p.2.compContinuousLinearMap p.1) q :=
analyticAt_uncurry_of_linear
(ContinuousMultilinearMap.compContinuousLinearMapContinuousMultilinear 𝕜 Fm Em G)
lemma analyticWithinAt_uncurry_compContinuousLinearMap :
AnalyticWithinAt 𝕜 (fun (p : (Π i, Fm i →L[𝕜] Em i) × (ContinuousMultilinearMap 𝕜 Em G))
↦ p.2.compContinuousLinearMap p.1) t q :=
analyticWithinAt_uncurry_of_linear
(ContinuousMultilinearMap.compContinuousLinearMapContinuousMultilinear 𝕜 Fm Em G)
end ContinuousMultilinearMap |
.lake/packages/mathlib/Mathlib/Analysis/Analytic/Binomial.lean | import Mathlib.Analysis.Calculus.IteratedDeriv.ConvergenceOnBall
import Mathlib.Analysis.Complex.OperatorNorm
import Mathlib.Analysis.SpecialFunctions.Complex.Analytic
import Mathlib.Analysis.SpecialFunctions.OrdinaryHypergeometric
import Mathlib.Analysis.SpecialFunctions.Pow.Deriv
import Mathlib.RingTheory.Binomial
/-!
# Binomial Series
This file introduces the binomial series:
$$
\sum_{k=0}^{\infty} \; \binom{a}{k} \; x^k = 1 + a x + \frac{a(a-1)}{2!} x^2 +
\frac{a(a-1)(a-2)}{3!} x^3 + \cdots
$$
where $a$ is an element of a normed field $\mathbb{K}$,
and $x$ is an element of a normed algebra over $\mathbb{K}$.
## Main Statements
* `binomialSeries_radius_eq_one`: The radius of convergence of the binomial series is `1` when `a`
is not a natural number.
* `binomialSeries_radius_eq_top_of_nat`: In case `a` is natural, the series converges everywhere,
since it is finite.
-/
open scoped Nat
universe u v
@[norm_cast]
lemma Complex.ofReal_choose (a : ℝ) (n : ℕ) :
↑(Ring.choose a n) = Ring.choose (a : ℂ) n :=
Ring.map_choose (algebraMap ℝ ℂ) _ _
/-- **Binomial series**: the (scalar) formal multilinear series with coefficients given
by `Ring.choose a`. The sum of this series is `fun x ↦ (1 + x) ^ a` within the radius
of convergence. -/
noncomputable def binomialSeries {𝕂 : Type u} [Field 𝕂] [CharZero 𝕂] (𝔸 : Type v)
[Ring 𝔸] [Algebra 𝕂 𝔸] [TopologicalSpace 𝔸] [IsTopologicalRing 𝔸] (a : 𝕂) :
FormalMultilinearSeries 𝕂 𝔸 𝔸 :=
.ofScalars 𝔸 (Ring.choose a ·)
@[simp]
theorem binomialSeries_apply {𝕂 : Type u} [Field 𝕂] [CharZero 𝕂] (𝔸 : Type v)
[Ring 𝔸] [Algebra 𝕂 𝔸] [TopologicalSpace 𝔸] [IsTopologicalRing 𝔸] (a : 𝕂) {n} (v : Fin n → 𝔸) :
binomialSeries 𝔸 a n v = Ring.choose a n • (List.ofFn v).prod := by
simp [binomialSeries, FormalMultilinearSeries.ofScalars]
theorem binomialSeries_eq_ordinaryHypergeometricSeries {𝕂 : Type u} [Field 𝕂] [CharZero 𝕂]
{𝔸 : Type v} [Ring 𝔸] [Algebra 𝕂 𝔸] [TopologicalSpace 𝔸] [IsTopologicalRing 𝔸] {a b : 𝕂}
(h : ∀ (k : ℕ), (k : 𝕂) ≠ -b) :
binomialSeries 𝔸 a =
(ordinaryHypergeometricSeries 𝔸 (-a) b b).compContinuousLinearMap (-(.id _ _)) := by
simp only [binomialSeries, ordinaryHypergeometricSeries,
FormalMultilinearSeries.ofScalars_comp_neg_id]
congr! with n
rw [ordinaryHypergeometricCoefficient,
mul_inv_cancel_right₀ (by simp [ascPochhammer_eval_eq_zero_iff]; grind)]
simp only [Ring.choose_eq_smul, Polynomial.descPochhammer_smeval_eq_ascPochhammer,
Polynomial.ascPochhammer_smeval_cast, Polynomial.ascPochhammer_smeval_eq_eval,
ascPochhammer_eval_neg_eq_descPochhammer, descPochhammer_eval_eq_ascPochhammer]
ring_nf
simp
/-- The radius of convergence of `binomialSeries 𝔸 a` is `⊤` for natural `a`. -/
theorem binomialSeries_radius_eq_top_of_nat {𝕂 : Type v} [RCLike 𝕂] {𝔸 : Type u}
[NormedDivisionRing 𝔸] [NormedAlgebra 𝕂 𝔸] {a : ℕ} :
(binomialSeries 𝔸 (a : 𝕂)).radius = ⊤ := by
simp [binomialSeries_eq_ordinaryHypergeometricSeries (b := (1 : 𝕂)) (by norm_cast; simp),
ordinaryHypergeometric_radius_top_of_neg_nat₁]
/-- The radius of convergence of `binomialSeries 𝔸 a` is `1`, when `a` is not natural. -/
theorem binomialSeries_radius_eq_one {𝕂 : Type v} [RCLike 𝕂] {𝔸 : Type u} [NormedDivisionRing 𝔸]
[NormedAlgebra 𝕂 𝔸] {a : 𝕂} (ha : ∀ (k : ℕ), a ≠ k) : (binomialSeries 𝔸 a).radius = 1 := by
simp only [binomialSeries_eq_ordinaryHypergeometricSeries (b := (1 : 𝕂)) (by norm_cast; simp),
FormalMultilinearSeries.radius_compNeg]
conv at ha => ext; rw [ne_comm]
exact ordinaryHypergeometricSeries_radius_eq_one _ _ _ _ (by norm_cast; grind)
theorem binomialSeries_radius_ge_one {𝕂 : Type*} [RCLike 𝕂] {𝔸 : Type*} [NormedDivisionRing 𝔸]
[NormedAlgebra 𝕂 𝔸] {a : 𝕂} :
1 ≤ (binomialSeries 𝔸 a).radius := by
by_cases ha : ∀ (k : ℕ), a ≠ k
· rw [binomialSeries_radius_eq_one ha]
· push_neg at ha
rcases ha with ⟨k, rfl⟩
simp [binomialSeries_radius_eq_top_of_nat]
theorem one_add_cpow_hasFPowerSeriesOnBall_zero {a : ℂ} :
HasFPowerSeriesOnBall (fun x ↦ (1 + x) ^ a) (binomialSeries ℂ a) 0 1 := by
suffices (binomialSeries ℂ a = FormalMultilinearSeries.ofScalars ℂ
fun n ↦ iteratedDeriv n (fun (x : ℂ) ↦ (1 + x) ^ a) 0 / n !) by
convert AnalyticOn.hasFPowerSeriesOnSubball _ _ _
· norm_num
· -- TODO: use `fun_prop` for this subgoal
apply AnalyticOn.cpow (analyticOn_const.add analyticOn_id) analyticOn_const
intro z hz
apply Complex.mem_slitPlane_of_norm_lt_one
rw [← ENNReal.ofReal_one, Metric.emetric_ball] at hz
simpa using hz
· rw [← this]
exact binomialSeries_radius_ge_one
simp only [binomialSeries, FormalMultilinearSeries.ofScalars_series_eq_iff]
ext n
rw [eq_div_iff_mul_eq (by simp [Nat.factorial_ne_zero]), ← nsmul_eq_mul',
← Ring.descPochhammer_eq_factorial_smul_choose]
let B := Metric.ball (0 : ℂ) 1
suffices Set.EqOn (iteratedDerivWithin n (fun x ↦ (1 + x) ^ a) B)
(fun x ↦ (descPochhammer ℤ n).smeval a * (1 + x) ^ (a - n)) B by
specialize this (show 0 ∈ _ by simp [B])
rw [iteratedDerivWithin_of_isOpen Metric.isOpen_ball (by simp)] at this
symm
simpa using this
induction n with
| zero => simp [Set.EqOn]
| succ n ih =>
have : iteratedDerivWithin (n + 1) (fun (x : ℂ) ↦ (1 + x) ^ a) B =
derivWithin (iteratedDerivWithin n (fun x ↦ (1 + x) ^ a) B) B := by
ext z
rw [iteratedDerivWithin_succ]
rw [this]
have : Set.EqOn (derivWithin (iteratedDerivWithin n (fun (x : ℂ) ↦ (1 + x) ^ a) B) B)
(derivWithin (fun x ↦ (descPochhammer ℤ n).smeval a * (1 + x) ^ (a - ↑n)) B) B := by
intro z hz
rw [derivWithin_congr (fun _ hz ↦ ih hz) (ih hz)]
apply Set.EqOn.trans this
intro z hz
simp only [Nat.cast_add, Nat.cast_one, B, derivWithin_of_isOpen Metric.isOpen_ball hz,
deriv_const_mul_field']
rw [deriv_cpow_const (by fun_prop), deriv_const_add', deriv_id'', mul_one,
show a - (n + 1) = a - n - 1 by ring, ← mul_assoc]
· congr
simp [descPochhammer_succ_right, Polynomial.smeval_mul, Polynomial.smeval_natCast]
· apply Complex.mem_slitPlane_of_norm_lt_one
simpa [B] using hz
theorem one_add_cpow_hasFPowerSeriesAt_zero {a : ℂ} :
HasFPowerSeriesAt (fun x ↦ (1 + x) ^ a) (binomialSeries ℂ a) 0 :=
one_add_cpow_hasFPowerSeriesOnBall_zero.hasFPowerSeriesAt
attribute [local simp← ] Complex.ofReal_choose in
attribute [-simp] FormalMultilinearSeries.apply_eq_prod_smul_coeff in
theorem one_add_rpow_hasFPowerSeriesOnBall_zero {a : ℝ} :
HasFPowerSeriesOnBall (fun x ↦ (1 + x) ^ a) (binomialSeries ℝ a) 0 1 := by
have : binomialSeries ℂ a = (binomialSeries ℂ (a : ℂ)).restrictScalars (𝕜 := ℝ) := by aesop
have : HasFPowerSeriesOnBall (fun x ↦ (1 + x) ^ (a : ℂ)) (binomialSeries ℂ a) (.ofRealCLM 0) 1 :=
Complex.ofRealCLM.map_zero ▸ this ▸ one_add_cpow_hasFPowerSeriesOnBall_zero.restrictScalars
convert (Complex.reCLM.comp_hasFPowerSeriesOnBall this.compContinuousLinearMap).congr ?_
· ext; simp [Function.comp_def]
· simp
· intro x hx; simp_all; norm_cast
theorem one_add_rpow_hasFPowerSeriesAt_zero {a : ℝ} :
HasFPowerSeriesAt (fun x ↦ (1 + x) ^ a) (binomialSeries ℝ a) 0 :=
one_add_rpow_hasFPowerSeriesOnBall_zero.hasFPowerSeriesAt |
.lake/packages/mathlib/Mathlib/Analysis/Analytic/IsolatedZeros.lean | import Mathlib.Analysis.Analytic.Constructions
import Mathlib.Analysis.Calculus.DSlope
import Mathlib.Analysis.Calculus.FDeriv.Analytic
import Mathlib.Analysis.Analytic.Uniqueness
import Mathlib.Order.Filter.EventuallyConst
import Mathlib.Topology.Perfect
/-!
# Principle of isolated zeros
This file proves the fact that the zeros of a non-constant analytic function of one variable are
isolated. It also introduces a little bit of API in the `HasFPowerSeriesAt` namespace that is useful
in this setup.
## Main results
* `AnalyticAt.eventually_eq_zero_or_eventually_ne_zero` is the main statement that if a function is
analytic at `z₀`, then either it is identically zero in a neighborhood of `z₀`, or it does not
vanish in a punctured neighborhood of `z₀`.
* `AnalyticOnNhd.eqOn_of_preconnected_of_frequently_eq` is the identity theorem for analytic
functions: if a function `f` is analytic on a connected set `U` and is zero on a set with an
accumulation point in `U` then `f` is identically `0` on `U`.
## Applications
* Vanishing of products of analytic functions, `eq_zero_or_eq_zero_of_smul_eq_zero`: If `f, g` are
analytic on a neighbourhood of the preconnected open set `U`, and `f • g = 0` on `U`, then either
`f = 0` on `U` or `g = 0` on `U`.
* Preimages of codiscrete sets, `AnalyticOnNhd.preimage_mem_codiscreteWithin`: if `f` is analytic
on a neighbourhood of `U` and not locally constant, then the preimage of any subset codiscrete
within `f '' U` is codiscrete within `U`.
-/
open Filter Function Nat FormalMultilinearSeries EMetric Set
open scoped Topology
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
[NormedSpace 𝕜 E] {s : E} {p q : FormalMultilinearSeries 𝕜 𝕜 E} {f g : 𝕜 → E} {n : ℕ} {z z₀ : 𝕜}
namespace HasSum
variable {a : ℕ → E}
theorem hasSum_at_zero (a : ℕ → E) : HasSum (fun n => (0 : 𝕜) ^ n • a n) (a 0) := by
convert hasSum_single (α := E) 0 fun b h ↦ _ <;> simp [*]
theorem exists_hasSum_smul_of_apply_eq_zero (hs : HasSum (fun m => z ^ m • a m) s)
(ha : ∀ k < n, a k = 0) : ∃ t : E, z ^ n • t = s ∧ HasSum (fun m => z ^ m • a (m + n)) t := by
obtain rfl | hn := n.eq_zero_or_pos
· simpa
by_cases h : z = 0
· have : s = 0 := hs.unique (by simpa [ha 0 hn, h] using hasSum_at_zero a)
exact ⟨a n, by simp [h, hn.ne', this], by simpa [h] using hasSum_at_zero fun m => a (m + n)⟩
· refine ⟨(z ^ n)⁻¹ • s, by match_scalars; field, ?_⟩
have h1 : ∑ i ∈ Finset.range n, z ^ i • a i = 0 :=
Finset.sum_eq_zero fun k hk => by simp [ha k (Finset.mem_range.mp hk)]
have h2 : HasSum (fun m => z ^ (m + n) • a (m + n)) s := by
simpa [h1] using (hasSum_nat_add_iff' n).mpr hs
convert h2.const_smul (z⁻¹ ^ n) using 2 with x
· match_scalars
simp [field, pow_add]
· simp only [inv_pow]
end HasSum
namespace HasFPowerSeriesAt
theorem has_fpower_series_dslope_fslope (hp : HasFPowerSeriesAt f p z₀) :
HasFPowerSeriesAt (dslope f z₀) p.fslope z₀ := by
have hpd : deriv f z₀ = p.coeff 1 := hp.deriv
have hp0 : p.coeff 0 = f z₀ := hp.coeff_zero 1
simp only [hasFPowerSeriesAt_iff, coeff_fslope] at hp ⊢
refine hp.mono fun x hx => ?_
by_cases h : x = 0
· convert hasSum_single (α := E) 0 _ <;> intros <;> simp [*]
· have hxx : ∀ n : ℕ, x⁻¹ * x ^ (n + 1) = x ^ n := fun n => by simp [field, _root_.pow_succ]
suffices HasSum (fun n => x⁻¹ • x ^ (n + 1) • p.coeff (n + 1)) (x⁻¹ • (f (z₀ + x) - f z₀)) by
simpa [dslope, slope, h, smul_smul, hxx] using this
simpa [hp0] using ((hasSum_nat_add_iff' 1).mpr hx).const_smul x⁻¹
theorem has_fpower_series_iterate_dslope_fslope (n : ℕ) (hp : HasFPowerSeriesAt f p z₀) :
HasFPowerSeriesAt ((swap dslope z₀)^[n] f) (fslope^[n] p) z₀ := by
induction n generalizing f p with
| zero => exact hp
| succ n ih => simpa using ih (has_fpower_series_dslope_fslope hp)
theorem iterate_dslope_fslope_ne_zero (hp : HasFPowerSeriesAt f p z₀) (h : p ≠ 0) :
(swap dslope z₀)^[p.order] f z₀ ≠ 0 := by
rw [← coeff_zero (has_fpower_series_iterate_dslope_fslope p.order hp) 1]
simpa [coeff_eq_zero] using apply_order_ne_zero h
theorem eq_pow_order_mul_iterate_dslope (hp : HasFPowerSeriesAt f p z₀) :
∀ᶠ z in 𝓝 z₀, f z = (z - z₀) ^ p.order • (swap dslope z₀)^[p.order] f z := by
have hq := hasFPowerSeriesAt_iff'.mp (has_fpower_series_iterate_dslope_fslope p.order hp)
filter_upwards [hq, hasFPowerSeriesAt_iff'.mp hp] with x hx1 hx2
have : ∀ k < p.order, p.coeff k = 0 := fun k hk => by
simpa [coeff_eq_zero] using apply_eq_zero_of_lt_order hk
obtain ⟨s, hs1, hs2⟩ := HasSum.exists_hasSum_smul_of_apply_eq_zero hx2 this
convert hs1.symm
simp only [coeff_iterate_fslope] at hx1
exact hx1.unique hs2
theorem locally_ne_zero (hp : HasFPowerSeriesAt f p z₀) (h : p ≠ 0) : ∀ᶠ z in 𝓝[≠] z₀, f z ≠ 0 := by
rw [eventually_nhdsWithin_iff]
have h2 := (has_fpower_series_iterate_dslope_fslope p.order hp).continuousAt
have h3 := h2.eventually_ne (iterate_dslope_fslope_ne_zero hp h)
filter_upwards [eq_pow_order_mul_iterate_dslope hp, h3] with z e1 e2 e3
simpa [e1, e2, e3] using pow_ne_zero p.order (sub_ne_zero.mpr e3)
theorem locally_zero_iff (hp : HasFPowerSeriesAt f p z₀) : (∀ᶠ z in 𝓝 z₀, f z = 0) ↔ p = 0 :=
⟨fun hf => hp.eq_zero_of_eventually hf, fun h => eventually_eq_zero (𝕜 := 𝕜) (by rwa [h] at hp)⟩
end HasFPowerSeriesAt
namespace AnalyticAt
/-- The *principle of isolated zeros* for an analytic function, local version: if a function is
analytic at `z₀`, then either it is identically zero in a neighborhood of `z₀`, or it does not
vanish in a punctured neighborhood of `z₀`. -/
theorem eventually_eq_zero_or_eventually_ne_zero (hf : AnalyticAt 𝕜 f z₀) :
(∀ᶠ z in 𝓝 z₀, f z = 0) ∨ ∀ᶠ z in 𝓝[≠] z₀, f z ≠ 0 := by
rcases hf with ⟨p, hp⟩
by_cases h : p = 0
· exact Or.inl (HasFPowerSeriesAt.eventually_eq_zero (by rwa [h] at hp))
· exact Or.inr (hp.locally_ne_zero h)
theorem eventually_eq_or_eventually_ne (hf : AnalyticAt 𝕜 f z₀) (hg : AnalyticAt 𝕜 g z₀) :
(∀ᶠ z in 𝓝 z₀, f z = g z) ∨ ∀ᶠ z in 𝓝[≠] z₀, f z ≠ g z := by
simpa [sub_eq_zero] using (hf.sub hg).eventually_eq_zero_or_eventually_ne_zero
theorem frequently_zero_iff_eventually_zero {f : 𝕜 → E} {w : 𝕜} (hf : AnalyticAt 𝕜 f w) :
(∃ᶠ z in 𝓝[≠] w, f z = 0) ↔ ∀ᶠ z in 𝓝 w, f z = 0 :=
⟨hf.eventually_eq_zero_or_eventually_ne_zero.resolve_right, fun h =>
(h.filter_mono nhdsWithin_le_nhds).frequently⟩
theorem frequently_eq_iff_eventually_eq (hf : AnalyticAt 𝕜 f z₀) (hg : AnalyticAt 𝕜 g z₀) :
(∃ᶠ z in 𝓝[≠] z₀, f z = g z) ↔ ∀ᶠ z in 𝓝 z₀, f z = g z := by
simpa [sub_eq_zero] using frequently_zero_iff_eventually_zero (hf.sub hg)
/-- For a function `f` on `𝕜`, and `z₀ ∈ 𝕜`, there exists at most one `n` such that on a punctured
neighbourhood of `z₀` we have `f z = (z - z₀) ^ n • g z`, with `g` analytic and nonvanishing at
`z₀`. We formulate this with `n : ℤ`, and deduce the case `n : ℕ` later, for applications to
meromorphic functions. -/
lemma unique_eventuallyEq_zpow_smul_nonzero {m n : ℤ}
(hm : ∃ g, AnalyticAt 𝕜 g z₀ ∧ g z₀ ≠ 0 ∧ ∀ᶠ z in 𝓝[≠] z₀, f z = (z - z₀) ^ m • g z)
(hn : ∃ g, AnalyticAt 𝕜 g z₀ ∧ g z₀ ≠ 0 ∧ ∀ᶠ z in 𝓝[≠] z₀, f z = (z - z₀) ^ n • g z) :
m = n := by
wlog h_le : n ≤ m generalizing m n
· exact ((this hn hm) (not_le.mp h_le).le).symm
let ⟨g, hg_an, _, hg_eq⟩ := hm
let ⟨j, hj_an, hj_ne, hj_eq⟩ := hn
contrapose! hj_ne
have : ∃ᶠ z in 𝓝[≠] z₀, j z = (z - z₀) ^ (m - n) • g z := by
apply Filter.Eventually.frequently
rw [eventually_nhdsWithin_iff] at hg_eq hj_eq ⊢
filter_upwards [hg_eq, hj_eq] with z hfz hfz' hz
rw [← add_sub_cancel_left n m, add_sub_assoc, zpow_add₀ <| sub_ne_zero.mpr hz, mul_smul,
hfz' hz, smul_right_inj <| zpow_ne_zero _ <| sub_ne_zero.mpr hz] at hfz
exact hfz hz
rw [frequently_eq_iff_eventually_eq hj_an] at this
· rw [EventuallyEq.eq_of_nhds this, sub_self, zero_zpow _ (sub_ne_zero.mpr hj_ne), zero_smul]
conv => enter [2, z, 1]; rw [← Int.toNat_sub_of_le h_le, zpow_natCast]
exact ((analyticAt_id.sub analyticAt_const).pow _).smul hg_an
/-- For a function `f` on `𝕜`, and `z₀ ∈ 𝕜`, there exists at most one `n` such that on a
neighbourhood of `z₀` we have `f z = (z - z₀) ^ n • g z`, with `g` analytic and nonvanishing at
`z₀`. -/
lemma unique_eventuallyEq_pow_smul_nonzero {m n : ℕ}
(hm : ∃ g, AnalyticAt 𝕜 g z₀ ∧ g z₀ ≠ 0 ∧ ∀ᶠ z in 𝓝 z₀, f z = (z - z₀) ^ m • g z)
(hn : ∃ g, AnalyticAt 𝕜 g z₀ ∧ g z₀ ≠ 0 ∧ ∀ᶠ z in 𝓝 z₀, f z = (z - z₀) ^ n • g z) :
m = n := by
simp_rw [← zpow_natCast] at hm hn
exact Int.ofNat_inj.mp <| unique_eventuallyEq_zpow_smul_nonzero
(let ⟨g, h₁, h₂, h₃⟩ := hm; ⟨g, h₁, h₂, h₃.filter_mono nhdsWithin_le_nhds⟩)
(let ⟨g, h₁, h₂, h₃⟩ := hn; ⟨g, h₁, h₂, h₃.filter_mono nhdsWithin_le_nhds⟩)
/-- If `f` is analytic at `z₀`, then exactly one of the following two possibilities occurs: either
`f` vanishes identically near `z₀`, or locally around `z₀` it has the form `z ↦ (z - z₀) ^ n • g z`
for some `n` and some `g` which is analytic and non-vanishing at `z₀`. -/
theorem exists_eventuallyEq_pow_smul_nonzero_iff (hf : AnalyticAt 𝕜 f z₀) :
(∃ (n : ℕ), ∃ (g : 𝕜 → E), AnalyticAt 𝕜 g z₀ ∧ g z₀ ≠ 0 ∧
∀ᶠ z in 𝓝 z₀, f z = (z - z₀) ^ n • g z) ↔ (¬∀ᶠ z in 𝓝 z₀, f z = 0) := by
constructor
· rintro ⟨n, g, hg_an, hg_ne, hg_eq⟩
contrapose! hg_ne
apply EventuallyEq.eq_of_nhds
rw [EventuallyEq, ← AnalyticAt.frequently_eq_iff_eventually_eq hg_an analyticAt_const]
refine (eventually_nhdsWithin_iff.mpr ?_).frequently
filter_upwards [hg_eq, hg_ne] with z hf_eq hf0 hz
rwa [hf0, eq_comm, smul_eq_zero_iff_right] at hf_eq
exact pow_ne_zero _ (sub_ne_zero.mpr hz)
· intro hf_ne
rcases hf with ⟨p, hp⟩
exact ⟨p.order, _, ⟨_, hp.has_fpower_series_iterate_dslope_fslope p.order⟩,
hp.iterate_dslope_fslope_ne_zero (hf_ne.imp hp.locally_zero_iff.mpr),
hp.eq_pow_order_mul_iterate_dslope⟩
end AnalyticAt
namespace AnalyticOnNhd
variable {U : Set 𝕜}
/-- The *principle of isolated zeros* for an analytic function, global version: if a function is
analytic on a connected set `U` and vanishes in arbitrary neighborhoods of a point `z₀ ∈ U`, then
it is identically zero in `U`.
For higher-dimensional versions requiring that the function vanishes in a neighborhood of `z₀`,
see `AnalyticOnNhd.eqOn_zero_of_preconnected_of_eventuallyEq_zero`. -/
theorem eqOn_zero_of_preconnected_of_frequently_eq_zero (hf : AnalyticOnNhd 𝕜 f U)
(hU : IsPreconnected U) (h₀ : z₀ ∈ U) (hfw : ∃ᶠ z in 𝓝[≠] z₀, f z = 0) : EqOn f 0 U :=
hf.eqOn_zero_of_preconnected_of_eventuallyEq_zero hU h₀
((hf z₀ h₀).frequently_zero_iff_eventually_zero.1 hfw)
theorem eqOn_zero_or_eventually_ne_zero_of_preconnected (hf : AnalyticOnNhd 𝕜 f U)
(hU : IsPreconnected U) : EqOn f 0 U ∨ ∀ᶠ x in codiscreteWithin U, f x ≠ 0 := by
simp only [or_iff_not_imp_right, ne_eq, eventually_iff, mem_codiscreteWithin,
disjoint_principal_right, not_forall]
rintro ⟨x, hx, hx2⟩
refine hf.eqOn_zero_of_preconnected_of_frequently_eq_zero hU hx fun nh ↦ hx2 ?_
filter_upwards [nh] with a ha
simp_all
theorem eqOn_zero_of_preconnected_of_mem_closure (hf : AnalyticOnNhd 𝕜 f U) (hU : IsPreconnected U)
(h₀ : z₀ ∈ U) (hfz₀ : z₀ ∈ closure ({z | f z = 0} \ {z₀})) : EqOn f 0 U :=
hf.eqOn_zero_of_preconnected_of_frequently_eq_zero hU h₀
(mem_closure_ne_iff_frequently_within.mp hfz₀)
/-- The *identity principle* for analytic functions, global version: if two functions are
analytic on a connected set `U` and coincide at points which accumulate to a point `z₀ ∈ U`, then
they coincide globally in `U`.
For higher-dimensional versions requiring that the functions coincide in a neighborhood of `z₀`,
see `AnalyticOnNhd.eqOn_of_preconnected_of_eventuallyEq`. -/
theorem eqOn_of_preconnected_of_frequently_eq (hf : AnalyticOnNhd 𝕜 f U) (hg : AnalyticOnNhd 𝕜 g U)
(hU : IsPreconnected U) (h₀ : z₀ ∈ U) (hfg : ∃ᶠ z in 𝓝[≠] z₀, f z = g z) : EqOn f g U := by
have hfg' : ∃ᶠ z in 𝓝[≠] z₀, (f - g) z = 0 :=
hfg.mono fun z h => by rw [Pi.sub_apply, h, sub_self]
simpa [sub_eq_zero] using fun z hz =>
(hf.sub hg).eqOn_zero_of_preconnected_of_frequently_eq_zero hU h₀ hfg' hz
theorem eqOn_or_eventually_ne_of_preconnected (hf : AnalyticOnNhd 𝕜 f U) (hg : AnalyticOnNhd 𝕜 g U)
(hU : IsPreconnected U) : EqOn f g U ∨ ∀ᶠ x in codiscreteWithin U, f x ≠ g x :=
(eqOn_zero_or_eventually_ne_zero_of_preconnected (hf.sub hg) hU).imp
(fun h _ hx ↦ eq_of_sub_eq_zero (h hx))
(by simp only [Pi.sub_apply, ne_eq, sub_eq_zero, imp_self])
theorem eqOn_of_preconnected_of_mem_closure (hf : AnalyticOnNhd 𝕜 f U) (hg : AnalyticOnNhd 𝕜 g U)
(hU : IsPreconnected U) (h₀ : z₀ ∈ U) (hfg : z₀ ∈ closure ({z | f z = g z} \ {z₀})) :
EqOn f g U :=
hf.eqOn_of_preconnected_of_frequently_eq hg hU h₀ (mem_closure_ne_iff_frequently_within.mp hfg)
/-- The *identity principle* for analytic functions, global version: if two functions on a normed
field `𝕜` are analytic everywhere and coincide at points which accumulate to a point `z₀`, then
they coincide globally.
For higher-dimensional versions requiring that the functions coincide in a neighborhood of `z₀`,
see `AnalyticOnNhd.eq_of_eventuallyEq`. -/
theorem eq_of_frequently_eq [ConnectedSpace 𝕜] (hf : AnalyticOnNhd 𝕜 f univ)
(hg : AnalyticOnNhd 𝕜 g univ) (hfg : ∃ᶠ z in 𝓝[≠] z₀, f z = g z) : f = g :=
funext fun x =>
eqOn_of_preconnected_of_frequently_eq hf hg isPreconnected_univ (mem_univ z₀) hfg (mem_univ x)
section Mul
/-!
### Vanishing of products of analytic functions
-/
variable {A : Type*} [NormedRing A] [NormedAlgebra 𝕜 A]
{B : Type*} [NormedAddCommGroup B] [NormedSpace 𝕜 B] [Module A B]
/-- If `f, g` are analytic on a neighbourhood of the preconnected open set `U`, and `f • g = 0`
on `U`, then either `f = 0` on `U` or `g = 0` on `U`. -/
lemma eq_zero_or_eq_zero_of_smul_eq_zero [NoZeroSMulDivisors A B]
{f : 𝕜 → A} {g : 𝕜 → B} (hf : AnalyticOnNhd 𝕜 f U) (hg : AnalyticOnNhd 𝕜 g U)
(hfg : ∀ z ∈ U, f z • g z = 0) (hU : IsPreconnected U) :
(∀ z ∈ U, f z = 0) ∨ (∀ z ∈ U, g z = 0) := by
-- We want to apply `IsPreconnected.preperfect_of_nontrivial` which requires `U` to have at least
-- two elements. So we need to dispose of the cases `#U = 0` and `#U = 1` first.
by_cases hU' : U = ∅
· simp [hU']
obtain ⟨z, hz⟩ : ∃ z, z ∈ U := nonempty_iff_ne_empty.mpr hU'
by_cases hU'' : U = {z}
· simpa [hU''] using hfg z hz
apply (nontrivial_iff_ne_singleton hz).mpr at hU''
-- Now connectedness implies that `z` is an accumulation point of `U`, so at least one of
-- `f` and `g` must vanish frequently in a neighbourhood of `z`.
have : ∃ᶠ w in 𝓝[≠] z, w ∈ U :=
frequently_mem_iff_neBot.mpr <| hU.preperfect_of_nontrivial hU'' z hz
have : ∃ᶠ w in 𝓝[≠] z, f w = 0 ∨ g w = 0 :=
this.mp <| by filter_upwards with w hw using smul_eq_zero.mp (hfg w hw)
cases frequently_or_distrib.mp this with
| inl h => exact Or.inl <| hf.eqOn_zero_of_preconnected_of_frequently_eq_zero hU hz h
| inr h => exact Or.inr <| hg.eqOn_zero_of_preconnected_of_frequently_eq_zero hU hz h
/-- If `f, g` are analytic on a neighbourhood of the preconnected open set `U`, and `f * g = 0`
on `U`, then either `f = 0` on `U` or `g = 0` on `U`. -/
lemma eq_zero_or_eq_zero_of_mul_eq_zero [NoZeroDivisors A]
{f g : 𝕜 → A} (hf : AnalyticOnNhd 𝕜 f U) (hg : AnalyticOnNhd 𝕜 g U)
(hfg : ∀ z ∈ U, f z * g z = 0) (hU : IsPreconnected U) :
(∀ z ∈ U, f z = 0) ∨ (∀ z ∈ U, g z = 0) :=
eq_zero_or_eq_zero_of_smul_eq_zero hf hg hfg hU
end Mul
end AnalyticOnNhd
/-!
### Preimages of codiscrete sets
-/
section PreimgCodiscrete
/-- Preimages of codiscrete sets, local version: if `f` is analytic at `x` and not locally constant,
then the preimage of any punctured neighbourhood of `f x` is a punctured neighbourhood of `x`. -/
theorem AnalyticAt.preimage_of_nhdsNE {x : 𝕜} {f : 𝕜 → E} {s : Set E} (hfx : AnalyticAt 𝕜 f x)
(h₂f : ¬EventuallyConst f (𝓝 x)) (hs : s ∈ 𝓝[≠] f x) :
f ⁻¹' s ∈ 𝓝[≠] x := by
have : ∀ᶠ (z : 𝕜) in 𝓝 x, f z ∈ insert (f x) s := by
filter_upwards [hfx.continuousAt.preimage_mem_nhds (insert_mem_nhds_iff.2 hs)]
tauto
contrapose! h₂f with h
rw [eventuallyConst_iff_exists_eventuallyEq]
use f x
rw [EventuallyEq, ← hfx.frequently_eq_iff_eventually_eq analyticAt_const]
apply ((frequently_imp_distrib_right.2 h).and_eventually
(eventually_nhdsWithin_of_eventually_nhds this)).mono
intro z ⟨h₁z, h₂z⟩
rw [Set.mem_insert_iff] at h₂z
tauto
/-- Preimages of codiscrete sets, local filter version: if `f` is analytic at `x` and not locally
constant, then the push-forward of the punctured neighbourhood filter `𝓝[≠] x` is less than or
equal to the punctured neighbourhood filter `𝓝[≠] f x`. -/
theorem AnalyticAt.map_nhdsNE {x : 𝕜} {f : 𝕜 → E} (hfx : AnalyticAt 𝕜 f x)
(h₂f : ¬EventuallyConst f (𝓝 x)) :
(𝓝[≠] x).map f ≤ (𝓝[≠] f x) := fun _ hs ↦ mem_map.1 (preimage_of_nhdsNE hfx h₂f hs)
/--
Preimages of codiscrete sets: if `f` is analytic on a neighbourhood of `U` and not locally constant,
then the preimage of any subset codiscrete within `f '' U` is codiscrete within `U`.
See `AnalyticOnNhd.preimage_zero_mem_codiscreteWithin` for the special case that `s` is the
complement of zero. Applications might want to use the theorem `Filter.codiscreteWithin.mono`.
-/
theorem AnalyticOnNhd.preimage_mem_codiscreteWithin {U : Set 𝕜} {s : Set E} {f : 𝕜 → E}
(hfU : AnalyticOnNhd 𝕜 f U) (h₂f : ∀ x ∈ U, ¬EventuallyConst f (𝓝 x))
(hs : s ∈ codiscreteWithin (f '' U)) :
f ⁻¹' s ∈ codiscreteWithin U := by
simp_rw [mem_codiscreteWithin, disjoint_principal_right, Set.compl_diff] at *
intro x hx
apply mem_of_superset ((hfU x hx).preimage_of_nhdsNE (h₂f x hx) (hs (f x) (by tauto)))
rw [preimage_union, preimage_compl]
apply union_subset_union_right (f ⁻¹' s)
intro x hx
simp only [mem_compl_iff, mem_preimage, mem_image, not_exists, not_and] at hx ⊢
tauto
/-- Preimages of codiscrete sets, filter version: if `f` is analytic on a neighbourhood of `U` and
not locally constant, then the push-forward of the filter of sets codiscrete within `U` is less
than or equal to the filter of sets codiscrete within `f '' U`.
Applications might want to use the theorem `Filter.codiscreteWithin.mono`.
-/
theorem AnalyticOnNhd.map_codiscreteWithin {U : Set 𝕜} {f : 𝕜 → E}
(hfU : AnalyticOnNhd 𝕜 f U) (h₂f : ∀ x ∈ U, ¬EventuallyConst f (𝓝 x)) :
map f (codiscreteWithin U) ≤ (codiscreteWithin (f '' U)) :=
fun _ hs ↦ mem_map.1 (preimage_mem_codiscreteWithin hfU h₂f hs)
end PreimgCodiscrete |
.lake/packages/mathlib/Mathlib/Probability/BorelCantelli.lean | import Mathlib.Probability.Martingale.BorelCantelli
import Mathlib.Probability.ConditionalExpectation
import Mathlib.Probability.Independence.Basic
/-!
# The second Borel-Cantelli lemma
This file contains the *second Borel-Cantelli lemma* which states that, given a sequence of
independent sets `(sₙ)` in a probability space, if `∑ n, μ sₙ = ∞`, then the limsup of `sₙ` has
measure 1. We employ a proof using Lévy's generalized Borel-Cantelli by choosing an appropriate
filtration.
## Main result
- `ProbabilityTheory.measure_limsup_eq_one`: the second Borel-Cantelli lemma.
**Note**: for the *first Borel-Cantelli lemma*, which holds in general measure spaces (not only
in probability spaces), see `MeasureTheory.measure_limsup_atTop_eq_zero`.
-/
open scoped ENNReal Topology
open MeasureTheory
namespace ProbabilityTheory
variable {Ω : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω}
section BorelCantelli
variable {ι β : Type*} [LinearOrder ι] [mβ : MeasurableSpace β] [NormedAddCommGroup β]
[BorelSpace β] {f : ι → Ω → β} {i j : ι} {s : ι → Set Ω}
theorem iIndepFun.indep_comap_natural_of_lt (hf : ∀ i, StronglyMeasurable (f i))
(hfi : iIndepFun f μ) (hij : i < j) :
Indep (MeasurableSpace.comap (f j) mβ) (Filtration.natural f hf i) μ := by
suffices Indep (⨆ k ∈ ({j} : Set ι), MeasurableSpace.comap (f k) mβ)
(⨆ k ∈ {k | k ≤ i}, MeasurableSpace.comap (f k) mβ) μ by rwa [iSup_singleton] at this
exact indep_iSup_of_disjoint (fun k => (hf k).measurable.comap_le) hfi (by simpa)
theorem iIndepFun.condExp_natural_ae_eq_of_lt [SecondCountableTopology β] [CompleteSpace β]
[NormedSpace ℝ β] (hf : ∀ i, StronglyMeasurable (f i)) (hfi : iIndepFun f μ)
(hij : i < j) : μ[f j|Filtration.natural f hf i] =ᵐ[μ] fun _ => μ[f j] := by
have : IsProbabilityMeasure μ := hfi.isProbabilityMeasure
exact condExp_indep_eq (hf j).measurable.comap_le (Filtration.le _ _)
(comap_measurable <| f j).stronglyMeasurable (hfi.indep_comap_natural_of_lt hf hij)
theorem iIndepSet.condExp_indicator_filtrationOfSet_ae_eq (hsm : ∀ n, MeasurableSet (s n))
(hs : iIndepSet s μ) (hij : i < j) :
μ[(s j).indicator (fun _ => 1 : Ω → ℝ)|filtrationOfSet hsm i] =ᵐ[μ]
fun _ => μ.real (s j) := by
rw [Filtration.filtrationOfSet_eq_natural (β := fun _ ↦ ℝ) hsm]
refine (iIndepFun.condExp_natural_ae_eq_of_lt _ hs.iIndepFun_indicator hij).trans ?_
simp only [integral_indicator_const _ (hsm _), Algebra.id.smul_eq_mul, mul_one]; rfl
open Filter
/-- **The second Borel-Cantelli lemma**: Given a sequence of independent sets `(sₙ)` such that
`∑ n, μ sₙ = ∞`, `limsup sₙ` has measure 1. -/
theorem measure_limsup_eq_one {s : ℕ → Set Ω} (hsm : ∀ n, MeasurableSet (s n)) (hs : iIndepSet s μ)
(hs' : (∑' n, μ (s n)) = ∞) : μ (limsup s atTop) = 1 := by
have : IsProbabilityMeasure μ := hs.isProbabilityMeasure
rw [measure_congr (eventuallyEq_set.2 (ae_mem_limsup_atTop_iff μ <|
measurableSet_filtrationOfSet' hsm) : (limsup s atTop : Set Ω) =ᵐ[μ]
{ω | Tendsto (fun n => ∑ k ∈ Finset.range n,
(μ[(s (k + 1)).indicator (1 : Ω → ℝ)|filtrationOfSet hsm k]) ω) atTop atTop})]
suffices {ω | Tendsto (fun n => ∑ k ∈ Finset.range n,
(μ[(s (k + 1)).indicator (1 : Ω → ℝ)|filtrationOfSet hsm k]) ω) atTop atTop} =ᵐ[μ] Set.univ by
rw [measure_congr this, measure_univ]
have : ∀ᵐ ω ∂μ, ∀ n, (μ[(s (n + 1)).indicator (1 : Ω → ℝ)|filtrationOfSet hsm n]) ω = _ :=
ae_all_iff.2 fun n => hs.condExp_indicator_filtrationOfSet_ae_eq hsm n.lt_succ_self
filter_upwards [this] with ω hω
refine eq_true (?_ : Tendsto _ _ _)
simp_rw [hω]
have htends : Tendsto (fun n => ∑ k ∈ Finset.range n, μ (s (k + 1))) atTop (𝓝 ∞) := by
rw [← ENNReal.tsum_add_one_eq_top hs' (measure_ne_top _ _)]
exact ENNReal.tendsto_nat_tsum _
rw [ENNReal.tendsto_nhds_top_iff_nnreal] at htends
refine tendsto_atTop_atTop_of_monotone' ?_ ?_
· refine monotone_nat_of_le_succ fun n => ?_
rw [← sub_nonneg, Finset.sum_range_succ_sub_sum]
exact ENNReal.toReal_nonneg
· rintro ⟨B, hB⟩
refine not_eventually.2 (Frequently.of_forall fun n => ?_) (htends B.toNNReal)
rw [mem_upperBounds] at hB
specialize hB (∑ k ∈ Finset.range n, μ (s (k + 1))).toReal _
· refine ⟨n, ?_⟩
rw [ENNReal.toReal_sum (by finiteness)]
rfl
· rwa [not_lt, ENNReal.ofNNReal_toNNReal, ENNReal.le_ofReal_iff_toReal_le]
· simp
· exact le_trans (by positivity) hB
end BorelCantelli
end ProbabilityTheory |
.lake/packages/mathlib/Mathlib/Probability/HasLaw.lean | import Mathlib.Probability.Density
import Mathlib.Probability.Moments.Variance
/-!
# Law of a random variable
We introduce a predicate `HasLaw X μ P` stating that the random variable `X` has law `μ` under
the measure `P`. This is expressed as `P.map X = μ`. We also require `X` to be `P`-almost-everywhere
measurable. Indeed, if `X` is not almost-everywhere measurable then `P.map X` is defined to be `0`,
so that `HasLaw X 0 P` would be true. The measurability hypothesis ensures nice interactions with
operations on the codomain of `X`.
See for instance `HasLaw.comp`, `IndepFun.hasLaw_mul` and `IndepFun.hasLaw_add`.
-/
open MeasureTheory Measure
open scoped ENNReal
namespace ProbabilityTheory
variable {Ω 𝓧 : Type*} {mΩ : MeasurableSpace Ω} {m𝓧 : MeasurableSpace 𝓧} (X : Ω → 𝓧)
(μ : Measure 𝓧)
/-- The predicate `HasLaw X μ P` registers the fact that the random variable `X` has law `μ` under
the measure `P`, in other words that `P.map X = μ`. We also require `X` to be `AEMeasurable`,
to allow for nice interactions with operations on the codomain of `X`. See for instance
`HasLaw.comp`, `IndepFun.hasLaw_mul` and `IndepFun.hasLaw_add`. -/
@[fun_prop]
structure HasLaw (P : Measure Ω := by volume_tac) : Prop where
protected aemeasurable : AEMeasurable X P := by fun_prop
protected map_eq : P.map X = μ
attribute [fun_prop] HasLaw.aemeasurable
variable {X μ} {P : Measure Ω}
lemma HasLaw.congr {Y : Ω → 𝓧} (hX : HasLaw X μ P) (hY : Y =ᵐ[P] X) : HasLaw Y μ P where
aemeasurable := hX.aemeasurable.congr hY.symm
map_eq := by rw [map_congr hY, hX.map_eq]
lemma _root_.MeasureTheory.MeasurePreserving.hasLaw (h : MeasurePreserving X P μ) :
HasLaw X μ P where
aemeasurable := h.measurable.aemeasurable
map_eq := h.map_eq
lemma HasLaw.measurePreserving (h₁ : HasLaw X μ P) (h₂ : Measurable X) :
MeasurePreserving X P μ where
measurable := h₂
map_eq := h₁.map_eq
protected lemma HasLaw.id : HasLaw id μ μ where
map_eq := map_id
protected theorem HasLaw.isFiniteMeasure_iff (hX : HasLaw X μ P) :
IsFiniteMeasure μ ↔ IsFiniteMeasure P := by
rw [← hX.map_eq, isFiniteMeasure_map_iff hX.aemeasurable]
protected theorem HasLaw.isProbabilityMeasure_iff (hX : HasLaw X μ P) :
IsProbabilityMeasure μ ↔ IsProbabilityMeasure P := by
rw [← hX.map_eq, isProbabilityMeasure_map_iff hX.aemeasurable]
@[fun_prop]
lemma HasLaw.comp {𝒴 : Type*} {m𝒴 : MeasurableSpace 𝒴} {ν : Measure 𝒴} {Y : 𝓧 → 𝒴}
(hY : HasLaw Y ν μ) (hX : HasLaw X μ P) : HasLaw (Y ∘ X) ν P where
aemeasurable := (hX.map_eq ▸ hY.aemeasurable).comp_aemeasurable hX.aemeasurable
map_eq := by
rw [← AEMeasurable.map_map_of_aemeasurable _ hX.aemeasurable, hX.map_eq, hY.map_eq]
rw [hX.map_eq]; exact hY.aemeasurable
@[fun_prop]
lemma HasLaw.fun_comp {𝒴 : Type*} {m𝒴 : MeasurableSpace 𝒴} {ν : Measure 𝒴} {Y : 𝓧 → 𝒴}
(hY : HasLaw Y ν μ) (hX : HasLaw X μ P) : HasLaw (fun ω ↦ Y (X ω)) ν P :=
hY.comp hX
@[to_additive]
lemma IndepFun.hasLaw_mul {M : Type*} [Monoid M] {mM : MeasurableSpace M} [MeasurableMul₂ M]
{μ ν : Measure M} [SigmaFinite μ] [SigmaFinite ν] {X Y : Ω → M}
(hX : HasLaw X μ P) (hY : HasLaw Y ν P) (hXY : X ⟂ᵢ[P] Y) :
HasLaw (X * Y) (μ ∗ₘ ν) P where
map_eq := by
rw [hXY.map_mul_eq_map_mconv_map₀' hX.aemeasurable hY.aemeasurable, hX.map_eq, hY.map_eq]
· rwa [hX.map_eq]
· rwa [hY.map_eq]
@[to_additive]
lemma IndepFun.hasLaw_fun_mul {M : Type*} [Monoid M] {mM : MeasurableSpace M} [MeasurableMul₂ M]
{μ ν : Measure M} [SigmaFinite μ] [SigmaFinite ν] {X Y : Ω → M}
(hX : HasLaw X μ P) (hY : HasLaw Y ν P) (hXY : X ⟂ᵢ[P] Y) :
HasLaw (fun ω ↦ X ω * Y ω) (μ ∗ₘ ν) P := hXY.hasLaw_mul hX hY
lemma HasLaw.integral_comp {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
{X : Ω → 𝓧} (hX : HasLaw X μ P) {f : 𝓧 → E} (hf : AEStronglyMeasurable f μ) :
P[f ∘ X] = ∫ x, f x ∂μ := by
rw [← hX.map_eq, integral_map hX.aemeasurable, Function.comp_def]
rwa [hX.map_eq]
lemma HasLaw.lintegral_comp {X : Ω → 𝓧} (hX : HasLaw X μ P) {f : 𝓧 → ℝ≥0∞}
(hf : AEMeasurable f μ) : ∫⁻ ω, f (X ω) ∂P = ∫⁻ x, f x ∂μ := by
rw [← hX.map_eq, lintegral_map' _ hX.aemeasurable]
rwa [hX.map_eq]
lemma HasLaw.integral_eq {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
[SecondCountableTopology E] {mE : MeasurableSpace E} [OpensMeasurableSpace E] {μ : Measure E}
{X : Ω → E} (hX : HasLaw X μ P) : P[X] = ∫ x, x ∂μ := by
rw [← Function.id_comp X, hX.integral_comp aestronglyMeasurable_id]
simp
lemma HasLaw.covariance_comp (hX : HasLaw X μ P) {f g : 𝓧 → ℝ}
(hf : AEMeasurable f μ) (hg : AEMeasurable g μ) :
cov[f ∘ X, g ∘ X; P] = cov[f, g; μ] := by
rw [← hX.map_eq, covariance_map]
· rw [hX.map_eq]
exact hf.aestronglyMeasurable
· rw [hX.map_eq]
exact hg.aestronglyMeasurable
· exact hX.aemeasurable
lemma HasLaw.covariance_fun_comp (hX : HasLaw X μ P) {f g : 𝓧 → ℝ}
(hf : AEMeasurable f μ) (hg : AEMeasurable g μ) :
cov[fun ω ↦ f (X ω), fun ω ↦ g (X ω); P] = cov[f, g; μ] :=
hX.covariance_comp hf hg
lemma HasLaw.variance_eq {μ : Measure ℝ} {X : Ω → ℝ} (hX : HasLaw X μ P) :
Var[X; P] = Var[id; μ] := by
rw [← hX.map_eq, variance_map aemeasurable_id hX.aemeasurable, Function.id_comp]
lemma HasPDF.hasLaw [h : HasPDF X P μ] : HasLaw X (μ.withDensity (pdf X P μ)) P where
aemeasurable := h.aemeasurable
map_eq := map_eq_withDensity_pdf X P μ
end ProbabilityTheory |
.lake/packages/mathlib/Mathlib/Probability/ProductMeasure.lean | import Mathlib.Probability.Kernel.Composition.MeasureComp
import Mathlib.Probability.Kernel.IonescuTulcea.Traj
/-!
# Infinite product of probability measures
This file provides a definition for the product measure of an arbitrary family of probability
measures. Given `μ : (i : ι) → Measure (X i)` such that each `μ i` is a probability measure,
`Measure.infinitePi μ` is the only probability measure `ν` over `Π i, X i` such that
`ν (Set.pi s t) = ∏ i ∈ s, μ i (t i)`, with `s : Finset ι` and
such that `∀ i ∈ s, MeasurableSet (t i)` (see `eq_infinitePi` and `infinitePi_pi`).
We also provide a few results regarding integration against this measure.
## Main definition
* `Measure.infinitePi μ`: The product measure of the family of probability measures `μ`.
## Main statements
* `eq_infinitePi`: Any measure which gives to a finite product of sets the mass which is the
product of their measures is the product measure.
* `infinitePi_pi`: the product measure gives to finite products of sets a mass which is
the product of their masses.
* `infinitePi_cylinder`: `infinitePi μ (cylinder s S) = Measure.pi (fun i : s ↦ μ i) S`
## Implementation notes
To construct the product measure we first use the kernel `traj` obtained via the Ionescu-Tulcea
theorem to construct the measure over a product indexed by `ℕ`, which is `infinitePiNat`. This
is an implementation detail and should not be used directly. Then we construct the product measure
over an arbitrary type by extending `piContent μ` thanks to Carathéodory's theorem. The key lemma
to do so is `piContent_tendsto_zero`, which states that `piContent μ (A n)` tends to zero if
`A` is a nonincreasing sequence of sets satisfying `⋂ n, A n = ∅`.
We prove this lemma by reducing to the case of an at most countable product,
in which case `piContent μ` is known to be a true measure (see `piContent_eq_measure_pi` and
`piContent_eq_infinitePiNat`).
## Tags
infinite product measure
-/
open ProbabilityTheory Finset Filter Preorder MeasurableEquiv
open scoped ENNReal Topology
namespace MeasureTheory
section Preliminaries
variable {ι : Type*} {X : ι → Type*} {mX : ∀ i, MeasurableSpace (X i)}
variable (μ : (i : ι) → Measure (X i)) [hμ : ∀ i, IsProbabilityMeasure (μ i)]
/-- Consider a family of probability measures. You can take their products for any finite
subfamily. This gives a projective family of measures. -/
lemma isProjectiveMeasureFamily_pi :
IsProjectiveMeasureFamily (fun I : Finset ι ↦ (Measure.pi (fun i : I ↦ μ i))) := by
refine fun I J hJI ↦ Measure.pi_eq (fun s ms ↦ ?_)
classical
simp_rw [Measure.map_apply (measurable_restrict₂ hJI) (.univ_pi ms), restrict₂_preimage hJI,
Measure.pi_pi, prod_eq_prod_extend]
refine (prod_subset_one_on_sdiff hJI (fun x hx ↦ ?_) (fun x hx ↦ ?_)).symm
· rw [Function.extend_val_apply (mem_sdiff.1 hx).1, dif_neg (mem_sdiff.1 hx).2, measure_univ]
· rw [Function.extend_val_apply hx, Function.extend_val_apply (hJI hx), dif_pos hx]
/-- Consider a family of probability measures. You can take their products for any finite
subfamily. This gives an additive content on the measurable cylinders. -/
noncomputable def piContent : AddContent (measurableCylinders X) :=
projectiveFamilyContent (isProjectiveMeasureFamily_pi μ)
lemma piContent_cylinder {I : Finset ι} {S : Set (Π i : I, X i)} (hS : MeasurableSet S) :
piContent μ (cylinder I S) = Measure.pi (fun i : I ↦ μ i) S :=
projectiveFamilyContent_cylinder _ hS
theorem piContent_eq_measure_pi [Fintype ι] {s : Set (Π i, X i)} (hs : MeasurableSet s) :
piContent μ s = Measure.pi μ s := by
let e : @Finset.univ ι _ ≃ ι :=
{ toFun i := i
invFun i := ⟨i, mem_univ i⟩ }
have : s = cylinder univ (MeasurableEquiv.piCongrLeft X e ⁻¹' s) := rfl
nth_rw 1 [this]
dsimp [e]
rw [piContent_cylinder _ (hs.preimage (by fun_prop)), ← Measure.pi_map_piCongrLeft e,
← Measure.map_apply (by fun_prop) hs]; rfl
end Preliminaries
section Nat
open Kernel
/-! ### Product of measures indexed by `ℕ` -/
variable {X : ℕ → Type*}
variable {mX : ∀ n, MeasurableSpace (X n)}
(μ : (n : ℕ) → Measure (X n)) [hμ : ∀ n, IsProbabilityMeasure (μ n)]
namespace Measure
/-- Infinite product measure indexed by `ℕ`. This is an auxiliary construction, you should use
the generic product measure `Measure.infinitePi`. -/
noncomputable def infinitePiNat : Measure (Π n, X n) :=
(traj (fun n ↦ const _ (μ (n + 1))) 0) ∘ₘ (Measure.pi (fun i : Iic 0 ↦ μ i))
instance : IsProbabilityMeasure (Measure.infinitePiNat μ) := by
rw [Measure.infinitePiNat]; infer_instance
/-- Let `μ : (i : Ioc a c) → Measure (X i)` be a family of measures. Up to an equivalence,
`(⨂ i : Ioc a b, μ i) ⊗ (⨂ i : Ioc b c, μ i) = ⨂ i : Ioc a c, μ i`, where `⊗` denotes the
product of measures. -/
lemma pi_prod_map_IocProdIoc {a b c : ℕ} (hab : a ≤ b) (hbc : b ≤ c) :
((Measure.pi (fun i : Ioc a b ↦ μ i)).prod (Measure.pi (fun i : Ioc b c ↦ μ i))).map
(IocProdIoc a b c) = Measure.pi (fun i : Ioc a c ↦ μ i) := by
refine (Measure.pi_eq fun s ms ↦ ?_).symm
simp_rw [Measure.map_apply measurable_IocProdIoc (.univ_pi ms), IocProdIoc_preimage hab hbc,
Measure.prod_prod, Measure.pi_pi, prod_eq_prod_extend]
nth_rw 1 [Eq.comm, ← Ioc_union_Ioc_eq_Ioc hab hbc, prod_union (Ioc_disjoint_Ioc_of_le le_rfl)]
congr 1 <;> refine prod_congr rfl fun x hx ↦ ?_
· rw [Function.extend_val_apply hx, Function.extend_val_apply (Ioc_subset_Ioc_right hbc hx),
restrict₂]
· rw [Function.extend_val_apply hx, Function.extend_val_apply (Ioc_subset_Ioc_left hab hx),
restrict₂]
/-- Let `μ : (i : Iic b) → Measure (X i)` be a family of measures. Up to an equivalence,
`(⨂ i : Iic a, μ i) ⊗ (⨂ i : Ioc a b, μ i) = ⨂ i : Iic b, μ i`, where `⊗` denotes the
product of measures. -/
lemma pi_prod_map_IicProdIoc {a b : ℕ} :
((Measure.pi (fun i : Iic a ↦ μ i)).prod (Measure.pi (fun i : Ioc a b ↦ μ i))).map
(IicProdIoc a b) = Measure.pi (fun i : Iic b ↦ μ i) := by
obtain hab | hba := le_total a b
· refine (Measure.pi_eq fun s ms ↦ ?_).symm
simp_rw [Measure.map_apply measurable_IicProdIoc (.univ_pi ms), IicProdIoc_preimage hab,
Measure.prod_prod, Measure.pi_pi, prod_eq_prod_extend]
nth_rw 1 [Eq.comm, ← Iic_union_Ioc_eq_Iic hab, prod_union (Iic_disjoint_Ioc le_rfl)]
congr 1 <;> refine prod_congr rfl fun x hx ↦ ?_
· rw [Function.extend_val_apply hx, Function.extend_val_apply (Iic_subset_Iic.2 hab hx),
frestrictLe₂, restrict₂]
· rw [Function.extend_val_apply hx, Function.extend_val_apply (Ioc_subset_Iic_self hx),
restrict₂]
· rw [IicProdIoc_le hba, ← Measure.map_map, ← Measure.fst, Measure.fst_prod]
· exact isProjectiveMeasureFamily_pi μ (Iic a) (Iic b) (Iic_subset_Iic.2 hba) |>.symm
all_goals fun_prop
/-- Let `μ (i + 1) : Measure (X (i + 1))` be a measure. Up to an equivalence,
`μ i = ⨂ j : Ioc i (i + 1), μ i`, where `⊗` denotes the product of measures. -/
lemma map_piSingleton (μ : (n : ℕ) → Measure (X n)) [∀ n, SigmaFinite (μ n)] (n : ℕ) :
(μ (n + 1)).map (piSingleton n) = Measure.pi (fun i : Ioc n (n + 1) ↦ μ i) := by
refine (Measure.pi_eq fun s hs ↦ ?_).symm
have : Subsingleton (Ioc n (n + 1)) := by rw [Nat.Ioc_succ_singleton]; infer_instance
rw [Fintype.prod_subsingleton _ ⟨n + 1, mem_Ioc.2 (by cutsat)⟩,
Measure.map_apply (by fun_prop) (.univ_pi hs)]
congr 1 with x
simp only [Set.mem_preimage, Set.mem_pi, Set.mem_univ, forall_const, Subtype.forall,
Nat.Ioc_succ_singleton, mem_singleton]
exact ⟨fun h ↦ h (n + 1) rfl, fun h a b ↦ b.symm ▸ h⟩
end Measure
/-- `partialTraj κ a b` is a kernel which up to an equivalence is equal to
`Kernel.id ×ₖ (κ a ⊗ₖ ... ⊗ₖ κ (b - 1))`. This lemma therefore states that if the kernels `κ`
are constant then their composition-product is the product measure. -/
theorem partialTraj_const_restrict₂ {a b : ℕ} :
(partialTraj (fun n ↦ const _ (μ (n + 1))) a b).map (restrict₂ Ioc_subset_Iic_self) =
const _ (Measure.pi (fun i : Ioc a b ↦ μ i)) := by
obtain hab | hba := lt_or_ge a b
· refine Nat.le_induction ?_ (fun n hn hind ↦ ?_) b (Nat.succ_le.2 hab) <;> ext1 x₀
· rw [partialTraj_succ_self, ← map_comp_right, map_apply, prod_apply, map_apply, const_apply,
const_apply, Measure.map_piSingleton, restrict₂_comp_IicProdIoc, Measure.map_snd_prod,
measure_univ, one_smul]
all_goals fun_prop
· have : (restrict₂ (Ioc_subset_Iic_self (a := a))) ∘ (IicProdIoc (X := X) n (n + 1)) =
(IocProdIoc a n (n + 1)) ∘ (Prod.map (restrict₂ Ioc_subset_Iic_self) id) := rfl
rw [const_apply, partialTraj_succ_of_le (by cutsat), map_const, prod_const_comp, id_comp,
← map_comp_right, this, map_comp_right, ← map_prod_map, hind, Kernel.map_id, map_apply,
prod_apply, const_apply, const_apply, Measure.map_piSingleton,
Measure.pi_prod_map_IocProdIoc]
any_goals fun_prop
all_goals cutsat
· have : IsEmpty (Ioc a b) := by simpa [hba] using Subtype.isEmpty_false
ext x s ms
by_cases hs : s.Nonempty
· rw [Subsingleton.eq_univ_of_nonempty hs, @measure_univ .., measure_univ]
exact (IsMarkovKernel.map _ (measurable_restrict₂ _)) |>.isProbabilityMeasure x
· rw [Set.not_nonempty_iff_eq_empty.1 hs]
simp
/-- `partialTraj κ a b` is a kernel which up to an equivalence is equal to
`Kernel.id ×ₖ (κ a ⊗ₖ ... ⊗ₖ κ (b - 1))`. This lemma therefore states that if the kernel `κ i`
is constant equal to `μ i` for all `i`, then up to an equivalence
`partialTraj κ a b = Kernel.id ×ₖ Kernel.const (⨂ μ i)`. -/
theorem partialTraj_const {a b : ℕ} :
partialTraj (fun n ↦ const _ (μ (n + 1))) a b =
(Kernel.id ×ₖ (const _ (Measure.pi (fun i : Ioc a b ↦ μ i)))).map (IicProdIoc a b) := by
rw [partialTraj_eq_prod, partialTraj_const_restrict₂]
namespace Measure
theorem isProjectiveLimit_infinitePiNat :
IsProjectiveLimit (infinitePiNat μ) (fun I : Finset ℕ ↦ (Measure.pi (fun i : I ↦ μ i))) := by
intro I
rw [isProjectiveMeasureFamily_pi μ _ _ I.subset_Iic_sup_id,
← restrict₂_comp_restrict I.subset_Iic_sup_id, ← map_map, ← frestrictLe, infinitePiNat,
map_comp, traj_map_frestrictLe, partialTraj_const, ← map_comp, ← compProd_eq_comp_prod,
compProd_const, pi_prod_map_IicProdIoc]
all_goals fun_prop
/-- Restricting the product measure to a product indexed by a finset yields the usual
product measure. -/
lemma infinitePiNat_map_restrict (I : Finset ℕ) :
(infinitePiNat μ).map I.restrict = Measure.pi fun i : I ↦ μ i :=
isProjectiveLimit_infinitePiNat μ I
theorem piContent_eq_infinitePiNat {A : Set (Π n, X n)} (hA : A ∈ measurableCylinders X) :
piContent μ A = infinitePiNat μ A := by
obtain ⟨s, S, mS, rfl⟩ : ∃ s S, MeasurableSet S ∧ A = cylinder s S := by
simpa [mem_measurableCylinders] using hA
rw [piContent_cylinder _ mS, cylinder, ← map_apply (measurable_restrict _) mS,
infinitePiNat_map_restrict]
end Measure
end Nat
section InfinitePi
open Measure
/-! ### Product of infinitely many probability measures -/
variable {ι : Type*} {X : ι → Type*} {mX : ∀ i, MeasurableSpace (X i)}
(μ : (i : ι) → Measure (X i)) [hμ : ∀ i, IsProbabilityMeasure (μ i)]
/-- If we push the product measure forward by a reindexing equivalence, we get a product measure
on the reindexed product in the sense that it coincides with `piContent μ` over
measurable cylinders. See `infinitePi_map_piCongrLeft` for a general version. -/
lemma Measure.infinitePiNat_map_piCongrLeft (e : ℕ ≃ ι) {s : Set (Π i, X i)}
(hs : s ∈ measurableCylinders X) :
(infinitePiNat (fun n ↦ μ (e n))).map (piCongrLeft X e) s = piContent μ s := by
obtain ⟨I, S, hS, rfl⟩ := (mem_measurableCylinders s).1 hs
rw [map_apply _ hS.cylinder, cylinder, ← Set.preimage_comp, coe_piCongrLeft,
restrict_comp_piCongrLeft, Set.preimage_comp, ← map_apply,
infinitePiNat_map_restrict (fun n ↦ μ (e n)), ← cylinder, piContent_cylinder μ hS,
← pi_map_piCongrLeft (e.restrictPreimageFinset I), map_apply _ hS, coe_piCongrLeft]
· simp
any_goals fun_prop
exact hS.preimage (by fun_prop)
/-- This is the key theorem to build the product of an arbitrary family of probability measures:
the `piContent` of a decreasing sequence of cylinders with empty intersection converges to `0`.
This implies the `σ`-additivity of `piContent` (see `addContent_iUnion_eq_sum_of_tendsto_zero`),
which allows to extend it to the `σ`-algebra by Carathéodory's theorem. -/
theorem piContent_tendsto_zero {A : ℕ → Set (Π i, X i)} (A_mem : ∀ n, A n ∈ measurableCylinders X)
(A_anti : Antitone A) (A_inter : ⋂ n, A n = ∅) :
Tendsto (fun n ↦ piContent μ (A n)) atTop (𝓝 0) := by
have : ∀ i, Nonempty (X i) := fun i ↦ ProbabilityMeasure.nonempty ⟨μ i, hμ i⟩
have A_cyl n : ∃ s S, MeasurableSet S ∧ A n = cylinder s S :=
(mem_measurableCylinders _).1 (A_mem n)
choose s S mS A_eq using A_cyl
-- The family `(Aₙ)` only depends on a countable set of coordinates, called `u`. Therefore our
-- goal is to see it as a family indexed by this countable set, because on the product indexed
-- by this countable set we can build a measure. To do so we have to pull back our cylinders
-- along the injection from `Π i : u, X i` to `Π i, X i`.
let u := ⋃ n, (s n : Set ι)
-- `tₙ` will be `sₙ` seen as a subset of `u`.
let t n : Finset u := (s n).preimage Subtype.val Subtype.val_injective.injOn
classical
-- The map `f` allows to pull back `Aₙ`
let f : (Π i : u, X i) → Π i, X i :=
fun x i ↦ if hi : i ∈ u then x ⟨i, hi⟩ else Classical.ofNonempty
-- `aux` is the obvious equivalence between `sₙ` and `tₙ`
let aux n : t n ≃ s n :=
{ toFun := fun i ↦ ⟨i.1.1, mem_preimage.1 i.2⟩
invFun := fun i ↦ ⟨⟨i.1, Set.mem_iUnion.2 ⟨n, i.2⟩⟩, mem_preimage.2 i.2⟩
left_inv := fun i ↦ by simp
right_inv := fun i ↦ by simp }
-- Finally `gₙ` is the equivalence between the product indexed by `tₙ` and the one indexed by `sₙ`
let g n := (aux n).piCongrLeft (fun i : s n ↦ X i)
-- Mapping from the product indexed by `u` by `f` and then restricting to `sₙ` is the same as
-- first restricting to `tₙ` and then mapping by `gₙ`
have r_comp_f n : (s n).restrict ∘ f = (g n) ∘ (fun (x : Π i : u, X i) i ↦ x i) := by
ext x i
simp only [Function.comp_apply, Finset.restrict,
Equiv.piCongrLeft_apply, Equiv.coe_fn_symm_mk, f, aux, g, t]
rw [dif_pos (Set.mem_iUnion.2 ⟨n, i.2⟩)]
-- `Bₙ` is the same as `Aₙ` but in the product indexed by `u`
let B n := f ⁻¹' (A n)
-- `Tₙ` is the same as `Sₙ` but in the product indexed by `u`
let T n := (g n) ⁻¹' (S n)
-- We now transfer the properties of `Aₙ` and `Sₙ` to `Bₙ` and `Tₙ`
have B_eq n : B n = cylinder (t n) (T n) := by
simp_rw [B, A_eq, cylinder, ← Set.preimage_comp, r_comp_f]; rfl
have mT n : MeasurableSet (T n) := (mS n).preimage (by fun_prop)
have B_mem n : B n ∈ measurableCylinders (fun i : u ↦ X i) :=
(mem_measurableCylinders (B n)).2 ⟨t n, T n, mT n, B_eq n⟩
have mB n : MeasurableSet (B n) := .of_mem_measurableCylinders (B_mem n)
have B_anti : Antitone B := fun m n hmn ↦ Set.preimage_mono <| A_anti hmn
have B_inter : ⋂ n, B n = ∅ := by
simp_rw [B, ← Set.preimage_iInter, A_inter, Set.preimage_empty]
-- We now rewrite `piContent μ (A n)` as `piContent (fun i : u ↦ μ i) (B n)`. Then there are two
-- cases: either `u` is finite and we rewrite it to the finite product measure, either
-- it is countable and we rewrite it to the pushforward measure of `infinitePiNat`. In both cases
-- we have an actual measure and we can conclude with `tendsto_measure_iInter_atTop`.
conv =>
enter [1]; ext n
rw [A_eq, piContent_cylinder μ (mS n), ← pi_map_piCongrLeft (aux n),
map_apply (by fun_prop) (mS n)]
change (Measure.pi (fun i : t n ↦ μ i)) (T n)
rw [← piContent_cylinder (fun i : u ↦ μ i) (mT n), ← B_eq n]
obtain u_fin | u_inf := finite_or_infinite u
· let _ := Fintype.ofFinite u
simp_rw [fun n ↦ piContent_eq_measure_pi (fun i : u ↦ μ i) (mB n)]
convert tendsto_measure_iInter_atTop (fun n ↦ (mB n).nullMeasurableSet) B_anti
⟨0, measure_ne_top _ _⟩
· rw [B_inter, measure_empty]
· infer_instance
· -- If `u` is infinite, then we have an equivalence with `ℕ` so we can apply `secondLemma`.
have count_u : Countable u := Set.countable_iUnion (fun n ↦ (s n).countable_toSet)
obtain ⟨φ, -⟩ := Classical.exists_true_of_nonempty (α := ℕ ≃ u) nonempty_equiv_of_countable
conv => enter [1]; ext n; rw [← infinitePiNat_map_piCongrLeft _ φ (B_mem n)]
convert tendsto_measure_iInter_atTop (fun n ↦ (mB n).nullMeasurableSet) B_anti
⟨0, measure_ne_top _ _⟩
· rw [B_inter, measure_empty]
· infer_instance
/-- The `projectiveFamilyContent` associated to a family of probability measures is
σ-subadditive. -/
theorem isSigmaSubadditive_piContent : (piContent μ).IsSigmaSubadditive := by
refine isSigmaSubadditive_of_addContent_iUnion_eq_tsum
isSetRing_measurableCylinders (fun f hf hf_Union hf' ↦ ?_)
exact addContent_iUnion_eq_sum_of_tendsto_zero isSetRing_measurableCylinders
(piContent μ) (fun s hs ↦ projectiveFamilyContent_ne_top _)
(fun _ ↦ piContent_tendsto_zero μ) hf hf_Union hf'
namespace Measure
open scoped Classical in
/-- The product measure of an arbitrary family of probability measures. It is defined as the unique
extension of the function which gives to cylinders the measure given by the associated product
measure.
It is defined via an `if ... then ... else` so that it can be manipulated without carrying
a proof that the measures are probability measures. -/
noncomputable def infinitePi : Measure (Π i, X i) :=
if h : ∀ i, IsProbabilityMeasure (μ i) then
(piContent μ).measure isSetSemiring_measurableCylinders
generateFrom_measurableCylinders.ge (isSigmaSubadditive_piContent (hμ := h) μ)
else 0
/-- The product measure is the projective limit of the partial product measures. This ensures
uniqueness and expresses the value of the product measure applied to cylinders. -/
theorem isProjectiveLimit_infinitePi :
IsProjectiveLimit (infinitePi μ) (fun I : Finset ι ↦ (Measure.pi (fun i : I ↦ μ i))) := by
intro I
ext s hs
rw [map_apply (measurable_restrict I) hs, infinitePi, dif_pos hμ, AddContent.measure_eq,
← cylinder, piContent_cylinder μ hs]
· exact generateFrom_measurableCylinders.symm
· exact cylinder_mem_measurableCylinders _ _ hs
/-- Restricting the product measure to a product indexed by a finset yields the usual
product measure. -/
theorem infinitePi_map_restrict {I : Finset ι} :
(Measure.infinitePi μ).map I.restrict = Measure.pi fun i : I ↦ μ i :=
isProjectiveLimit_infinitePi μ I
instance : IsProbabilityMeasure (infinitePi μ) := by
constructor
rw [← cylinder_univ ∅, cylinder, ← map_apply (measurable_restrict _) .univ,
infinitePi_map_restrict, measure_univ]
/-- To prove that a measure is equal to the product measure it is enough to check that it
it gives the same measure to measurable boxes. -/
theorem eq_infinitePi {ν : Measure (Π i, X i)}
(hν : ∀ s : Finset ι, ∀ t : (i : ι) → Set (X i),
(∀ i, MeasurableSet (t i)) → ν (Set.pi s t) = ∏ i ∈ s, μ i (t i)) :
ν = infinitePi μ := by
refine (isProjectiveLimit_infinitePi μ).unique ?_ |>.symm
refine fun s ↦ (pi_eq fun t ht ↦ ?_).symm
classical
rw [Measure.map_apply, restrict_preimage, hν, ← prod_attach, univ_eq_attach]
· congr with i
rw [dif_pos i.2]
any_goals fun_prop
· rintro i
split_ifs with hi
· exact ht ⟨i, hi⟩
· exact .univ
· exact .univ_pi ht
-- TODO: add a version for an infinite product
lemma infinitePi_pi {s : Finset ι} {t : (i : ι) → Set (X i)}
(mt : ∀ i ∈ s, MeasurableSet (t i)) :
infinitePi μ (Set.pi s t) = ∏ i ∈ s, (μ i) (t i) := by
have : Set.pi s t = cylinder s ((@Set.univ s).pi (fun i : s ↦ t i)) := by
ext x
simp
rw [this, cylinder, ← map_apply, infinitePi_map_restrict, pi_pi]
· rw [univ_eq_attach, prod_attach _ (fun i ↦ (μ i) (t i))]
· exact measurable_restrict _
· exact .univ_pi fun i ↦ mt i.1 i.2
-- TODO: add a version for infinite `ι`. See TODO on `infinitePi_pi`.
@[simp]
lemma infinitePi_singleton [Fintype ι] [∀ i, MeasurableSingletonClass (X i)] (f : ∀ i, X i) :
infinitePi μ {f} = ∏ i, μ i {f i} := by
simpa [Set.univ_pi_singleton] using
infinitePi_pi μ (s := .univ) (t := fun i ↦ {f i}) fun _ _ ↦ .singleton _
@[simp] lemma infinitePi_dirac (f : ∀ i, X i) : infinitePi (fun i ↦ dirac (f i)) = dirac f :=
.symm <| eq_infinitePi _ <| by simp +contextual [MeasurableSet.pi, Finset.countable_toSet]
lemma _root_.measurePreserving_eval_infinitePi (i : ι) :
MeasurePreserving (Function.eval i) (infinitePi μ) (μ i) where
measurable := by fun_prop
map_eq := by
ext s hs
have : @Function.eval ι X i =
(@Function.eval ({i} : Finset ι) (fun j ↦ X j) ⟨i, by simp⟩) ∘
(Finset.restrict {i}) := by ext; simp
rw [this, ← map_map, infinitePi_map_restrict, (measurePreserving_eval _ _).map_eq]
all_goals fun_prop
lemma infinitePi_map_eval (i : ι) :
(infinitePi μ).map (fun x ↦ x i) = μ i :=
(measurePreserving_eval_infinitePi μ i).map_eq
lemma infinitePi_map_pi {Y : ι → Type*} [∀ i, MeasurableSpace (Y i)] {f : (i : ι) → X i → Y i}
(hf : ∀ i, Measurable (f i)) :
(infinitePi μ).map (fun x i ↦ f i (x i)) = infinitePi (fun i ↦ (μ i).map (f i)) := by
have (i : ι) : IsProbabilityMeasure ((μ i).map (f i)) :=
isProbabilityMeasure_map (hf i).aemeasurable
refine eq_infinitePi _ fun s t ht ↦ ?_
rw [map_apply (by fun_prop) (.pi s.countable_toSet fun _ _ ↦ ht _)]
have : (fun (x : Π i, X i) i ↦ f i (x i)) ⁻¹' ((s : Set ι).pi t) =
(s : Set ι).pi (fun i ↦ (f i) ⁻¹' (t i)) := by ext x; simp
rw [this, infinitePi_pi _ (fun i _ ↦ hf i (ht i))]
congr! with i hi
rw [map_apply (by fun_prop) (ht i)]
/-- If we push the product measure forward by a reindexing equivalence, we get a product measure
on the reindexed product. -/
theorem infinitePi_map_piCongrLeft {α : Type*} (e : α ≃ ι) :
(infinitePi (fun i ↦ μ (e i))).map (piCongrLeft X e) = infinitePi μ := by
refine eq_infinitePi μ fun s t ht ↦ ?_
conv_lhs => enter [2, 1]; rw [← e.image_preimage s, ← coe_preimage _ e.injective.injOn]
rw [map_apply, coe_piCongrLeft, Equiv.piCongrLeft_preimage_pi, infinitePi_pi,
prod_equiv e]
· simp
· simp
· simp_all
· fun_prop
· exact .pi ((countable_toSet _).image e) (by simp_all)
theorem infinitePi_eq_pi [Fintype ι] : infinitePi μ = Measure.pi μ := by
refine (pi_eq fun s hs ↦ ?_).symm
rw [← coe_univ, infinitePi_pi]
simpa
lemma infinitePi_cylinder {s : Finset ι} {S : Set (Π i : s, X i)} (mS : MeasurableSet S) :
infinitePi μ (cylinder s S) = Measure.pi (fun i : s ↦ μ i) S := by
rw [cylinder, ← Measure.map_apply (measurable_restrict _) mS, infinitePi_map_restrict]
section curry
variable {ι : Type*} {κ : ι → Type*} {X : (i : ι) → κ i → Type*}
{mX : ∀ i, ∀ j, MeasurableSpace (X i j)} (μ : (i : ι) → (j : κ i) → Measure (X i j))
[hμ : ∀ i j, IsProbabilityMeasure (μ i j)]
lemma infinitePi_map_piCurry_symm :
(infinitePi fun i : ι ↦ infinitePi fun j : κ i ↦ μ i j).map (piCurry X).symm =
infinitePi fun p : (i : ι) × κ i ↦ μ p.1 p.2 := by
apply eq_infinitePi
intro s t ht
classical
rw [map_apply (by fun_prop) (.pi (countable_toSet _) fun _ _ ↦ ht _),
← Finset.sigma_image_fst_preimage_mk s, coe_piCurry_symm, Finset.coe_sigma,
Set.uncurry_preimage_sigma_pi, infinitePi_pi, Finset.prod_sigma]
· apply Finset.prod_congr rfl
simp only [Finset.mem_image, Sigma.exists, exists_and_right, exists_eq_right,
forall_exists_index]
intro i j hij
rw [infinitePi_pi]
simp [ht]
· simp only [mem_image, Sigma.exists, exists_and_right, exists_eq_right, forall_exists_index]
exact fun i j hij ↦ MeasurableSet.pi (countable_toSet _) fun k hk ↦ by simp_all
lemma infinitePi_map_piCurry :
(infinitePi fun p : (i : ι) × κ i ↦ μ p.1 p.2).map (piCurry X) =
infinitePi fun i : ι ↦ infinitePi fun j : κ i ↦ μ i j := by
rw [MeasurableEquiv.map_apply_eq_iff_map_symm_apply_eq, infinitePi_map_piCurry_symm]
variable {ι κ X : Type*} {mX : MeasurableSpace X} (μ : ι → κ → Measure X)
[hμ : ∀ i j, IsProbabilityMeasure (μ i j)]
lemma infinitePi_map_curry_symm :
(infinitePi fun i : ι ↦ infinitePi fun j : κ ↦ μ i j).map (curry ι κ X).symm =
infinitePi fun p : ι × κ ↦ μ p.1 p.2 := by
rw [← (MeasurableEquiv.piCongrLeft (fun _ ↦ X)
(Equiv.sigmaEquivProd ι κ).symm).map_measurableEquiv_injective.eq_iff, map_map]
· have : (MeasurableEquiv.piCongrLeft (fun _ ↦ X) (Equiv.sigmaEquivProd ι κ).symm) ∘
(MeasurableEquiv.curry ι κ X).symm = ⇑(MeasurableEquiv.piCurry (fun _ _ ↦ X)).symm := by
ext; simp [piCongrLeft, Equiv.piCongrLeft, Sigma.uncurry]
rw [this, infinitePi_map_piCurry_symm]
convert infinitePi_map_piCongrLeft (fun p ↦ μ p.1 p.2) (Equiv.sigmaEquivProd ι κ).symm |>.symm
all_goals fun_prop
lemma infinitePi_map_curry :
(infinitePi fun p : ι × κ ↦ μ p.1 p.2).map (curry ι κ X) =
infinitePi fun i : ι ↦ infinitePi fun j : κ ↦ μ i j := by
rw [MeasurableEquiv.map_apply_eq_iff_map_symm_apply_eq, infinitePi_map_curry_symm]
end curry
end Measure
section Integral
theorem integral_restrict_infinitePi {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
{s : Finset ι} {f : (Π i : s, X i) → E}
(hf : AEStronglyMeasurable f (Measure.pi (fun i : s ↦ μ i))) :
∫ y, f (s.restrict y) ∂infinitePi μ = ∫ y, f y ∂Measure.pi (fun i : s ↦ μ i) := by
rw [← integral_map, infinitePi_map_restrict]
· fun_prop
· rwa [infinitePi_map_restrict]
theorem lintegral_restrict_infinitePi {s : Finset ι}
{f : (Π i : s, X i) → ℝ≥0∞} (hf : Measurable f) :
∫⁻ y, f (s.restrict y) ∂infinitePi μ = ∫⁻ y, f y ∂Measure.pi (fun i : s ↦ μ i) := by
rw [← lintegral_map hf (measurable_restrict _), isProjectiveLimit_infinitePi μ]
open Filtration
theorem integral_infinitePi_of_piFinset [DecidableEq ι] {E : Type*} [NormedAddCommGroup E]
[NormedSpace ℝ E] {s : Finset ι} {f : (Π i, X i) → E}
(mf : StronglyMeasurable[piFinset s] f) (x : Π i, X i) :
∫ y, f y ∂infinitePi μ =
∫ y, f (Function.updateFinset x s y) ∂Measure.pi (fun i : s ↦ μ i) := by
let g : (Π i : s, X i) → E := fun y ↦ f (Function.updateFinset x _ y)
have this y : g (s.restrict y) = f y :=
mf.dependsOn_of_piFinset fun i hi ↦ by simp_all [Function.updateFinset]
rw [← integral_congr_ae <| ae_of_all _ this, integral_restrict_infinitePi]
exact mf.comp_measurable (measurable_updateFinset.mono le_rfl (piFinset.le s))
|>.aestronglyMeasurable
theorem lintegral_infinitePi_of_piFinset [DecidableEq ι] {s : Finset ι}
{f : (Π i, X i) → ℝ≥0∞} (mf : Measurable[piFinset s] f)
(x : Π i, X i) : ∫⁻ y, f y ∂infinitePi μ = (∫⋯∫⁻_s, f ∂μ) x := by
let g : (Π i : s, X i) → ℝ≥0∞ := fun y ↦ f (Function.updateFinset x _ y)
have this y : g (s.restrict y) = f y :=
mf.dependsOn_of_piFinset fun i hi ↦ by simp_all [Function.updateFinset]
rw [← lintegral_congr_ae <| ae_of_all _ this, lintegral_restrict_infinitePi]
· rfl
· exact mf.comp (measurable_updateFinset.mono le_rfl (piFinset.le s))
end Integral
end InfinitePi
end MeasureTheory |
.lake/packages/mathlib/Mathlib/Probability/Variance.lean | import Mathlib.Probability.Moments.Variance
deprecated_module (since := "2025-05-16") |
.lake/packages/mathlib/Mathlib/Probability/Integration.lean | import Mathlib.Probability.Independence.Integration
deprecated_module (since := "2025-07-30") |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.