source stringlengths 17 118 | lean4 stringlengths 0 335k |
|---|---|
.lake/packages/mathlib/Mathlib/Analysis/Calculus/LineDeriv/Basic.lean | import Mathlib.Analysis.Calculus.Deriv.Comp
import Mathlib.Analysis.Calculus.Deriv.Add
import Mathlib.Analysis.Calculus.Deriv.Mul
import Mathlib.Analysis.Calculus.Deriv.Slope
/-!
# Line derivatives
We define the line derivative of a function `f : E ā F`, at a point `x : E` along a vector `v : E`,
as the element `f' : F` such that `f (x + t ⢠v) = f x + t ⢠f' + o (t)` as `t` tends to `0` in
the scalar field `š`, if it exists. It is denoted by `lineDeriv š f x v`.
This notion is generally less well behaved than the full FrƩchet derivative (for instance, the
composition of functions which are line-differentiable is not line-differentiable in general).
The FrƩchet derivative should therefore be favored over this one in general, although the line
derivative may sometimes prove handy.
The line derivative in direction `v` is also called the Gateaux derivative in direction `v`,
although the term "Gateaux derivative" is sometimes reserved for the situation where there is
such a derivative in all directions, for the map `v ⦠lineDeriv š f x v` (which doesn't have to be
linear in general).
## Main definition and results
We mimic the definitions and statements for the FrƩchet derivative and the one-dimensional
derivative. We define in particular the following objects:
* `LineDifferentiableWithinAt š f s x v`
* `LineDifferentiableAt š f x v`
* `HasLineDerivWithinAt š f f' s x v`
* `HasLineDerivAt š f s x v`
* `lineDerivWithin š f s x v`
* `lineDeriv š f x v`
and develop about them a basic API inspired by the one for the FrƩchet derivative.
We depart from the FrƩchet derivative in two places, as the dependence of the following predicates
on the direction would make them barely usable:
* We do not define an analogue of the predicate `UniqueDiffOn`;
* We do not define `LineDifferentiableOn` nor `LineDifferentiable`.
-/
noncomputable section
open scoped Topology Filter ENNReal NNReal
open Filter Asymptotics Set
variable {š : Type*} [NontriviallyNormedField š]
variable {F : Type*} [NormedAddCommGroup F] [NormedSpace š F]
section Module
/-!
Results that do not rely on a topological structure on `E`
-/
variable (š)
variable {E : Type*} [AddCommGroup E] [Module š E]
/-- `f` has the derivative `f'` at the point `x` along the direction `v` in the set `s`.
That is, `f (x + t v) = f x + t ⢠f' + o (t)` when `t` tends to `0` and `x + t v ā s`.
Note that this definition is less well behaved than the total FrƩchet derivative, which
should generally be favored over this one. -/
def HasLineDerivWithinAt (f : E ā F) (f' : F) (s : Set E) (x : E) (v : E) :=
HasDerivWithinAt (fun t ⦠f (x + t ⢠v)) f' ((fun t ⦠x + t ⢠v) ā»Ā¹' s) (0 : š)
/-- `f` has the derivative `f'` at the point `x` along the direction `v`.
That is, `f (x + t v) = f x + t ⢠f' + o (t)` when `t` tends to `0`.
Note that this definition is less well behaved than the total FrƩchet derivative, which
should generally be favored over this one. -/
def HasLineDerivAt (f : E ā F) (f' : F) (x : E) (v : E) :=
HasDerivAt (fun t ⦠f (x + t ⢠v)) f' (0 : š)
/-- `f` is line-differentiable at the point `x` in the direction `v` in the set `s` if there
exists `f'` such that `f (x + t v) = f x + t ⢠f' + o (t)` when `t` tends to `0` and `x + t v ā s`.
-/
def LineDifferentiableWithinAt (f : E ā F) (s : Set E) (x : E) (v : E) : Prop :=
DifferentiableWithinAt š (fun t ⦠f (x + t ⢠v)) ((fun t ⦠x + t ⢠v) ā»Ā¹' s) (0 : š)
/-- `f` is line-differentiable at the point `x` in the direction `v` if there
exists `f'` such that `f (x + t v) = f x + t ⢠f' + o (t)` when `t` tends to `0`. -/
def LineDifferentiableAt (f : E ā F) (x : E) (v : E) : Prop :=
DifferentiableAt š (fun t ⦠f (x + t ⢠v)) (0 : š)
/-- Line derivative of `f` at the point `x` in the direction `v` within the set `s`, if it exists.
Zero otherwise.
If the line derivative exists (i.e., `ā f', HasLineDerivWithinAt š f f' s x v`), then
`f (x + t v) = f x + t lineDerivWithin š f s x v + o (t)` when `t` tends to `0` and `x + t v ā s`.
-/
def lineDerivWithin (f : E ā F) (s : Set E) (x : E) (v : E) : F :=
derivWithin (fun t ⦠f (x + t ⢠v)) ((fun t ⦠x + t ⢠v) ā»Ā¹' s) (0 : š)
/-- Line derivative of `f` at the point `x` in the direction `v`, if it exists. Zero otherwise.
If the line derivative exists (i.e., `ā f', HasLineDerivAt š f f' x v`), then
`f (x + t v) = f x + t lineDeriv š f x v + o (t)` when `t` tends to `0`.
-/
def lineDeriv (f : E ā F) (x : E) (v : E) : F :=
deriv (fun t ⦠f (x + t ⢠v)) (0 : š)
variable {š}
variable {f fā : E ā F} {f' fā' fā' : F} {s t : Set E} {x v : E}
lemma HasLineDerivWithinAt.mono (hf : HasLineDerivWithinAt š f f' s x v) (hst : t ā s) :
HasLineDerivWithinAt š f f' t x v :=
HasDerivWithinAt.mono hf (preimage_mono hst)
lemma HasLineDerivAt.hasLineDerivWithinAt (hf : HasLineDerivAt š f f' x v) (s : Set E) :
HasLineDerivWithinAt š f f' s x v :=
HasDerivAt.hasDerivWithinAt hf
lemma HasLineDerivWithinAt.lineDifferentiableWithinAt (hf : HasLineDerivWithinAt š f f' s x v) :
LineDifferentiableWithinAt š f s x v :=
HasDerivWithinAt.differentiableWithinAt hf
theorem HasLineDerivAt.lineDifferentiableAt (hf : HasLineDerivAt š f f' x v) :
LineDifferentiableAt š f x v :=
HasDerivAt.differentiableAt hf
theorem LineDifferentiableWithinAt.hasLineDerivWithinAt (h : LineDifferentiableWithinAt š f s x v) :
HasLineDerivWithinAt š f (lineDerivWithin š f s x v) s x v :=
DifferentiableWithinAt.hasDerivWithinAt h
theorem LineDifferentiableAt.hasLineDerivAt (h : LineDifferentiableAt š f x v) :
HasLineDerivAt š f (lineDeriv š f x v) x v :=
DifferentiableAt.hasDerivAt h
@[simp] lemma hasLineDerivWithinAt_univ :
HasLineDerivWithinAt š f f' univ x v ā HasLineDerivAt š f f' x v := by
simp only [HasLineDerivWithinAt, HasLineDerivAt, preimage_univ, hasDerivWithinAt_univ]
theorem lineDerivWithin_zero_of_not_lineDifferentiableWithinAt
(h : ¬LineDifferentiableWithinAt š f s x v) :
lineDerivWithin š f s x v = 0 :=
derivWithin_zero_of_not_differentiableWithinAt h
theorem lineDeriv_zero_of_not_lineDifferentiableAt (h : ¬LineDifferentiableAt š f x v) :
lineDeriv š f x v = 0 :=
deriv_zero_of_not_differentiableAt h
theorem hasLineDerivAt_iff_isLittleO_nhds_zero :
HasLineDerivAt š f f' x v ā
(fun t : š => f (x + t ⢠v) - f x - t ⢠f') =o[š 0] fun t => t := by
simp only [HasLineDerivAt, hasDerivAt_iff_isLittleO_nhds_zero, zero_add, zero_smul, add_zero]
theorem HasLineDerivAt.unique (hā : HasLineDerivAt š f fā' x v) (hā : HasLineDerivAt š f fā' x v) :
fā' = fā' :=
HasDerivAt.unique hā hā
protected theorem HasLineDerivAt.lineDeriv (h : HasLineDerivAt š f f' x v) :
lineDeriv š f x v = f' := by
rw [h.unique h.lineDifferentiableAt.hasLineDerivAt]
theorem lineDifferentiableWithinAt_univ :
LineDifferentiableWithinAt š f univ x v ā LineDifferentiableAt š f x v := by
simp only [LineDifferentiableWithinAt, LineDifferentiableAt, preimage_univ,
differentiableWithinAt_univ]
theorem LineDifferentiableAt.lineDifferentiableWithinAt (h : LineDifferentiableAt š f x v) :
LineDifferentiableWithinAt š f s x v :=
(differentiableWithinAt_univ.2 h).mono (subset_univ _)
@[simp]
theorem lineDerivWithin_univ : lineDerivWithin š f univ x v = lineDeriv š f x v := by
simp [lineDerivWithin, lineDeriv]
theorem LineDifferentiableWithinAt.mono (h : LineDifferentiableWithinAt š f t x v) (st : s ā t) :
LineDifferentiableWithinAt š f s x v :=
(h.hasLineDerivWithinAt.mono st).lineDifferentiableWithinAt
theorem HasLineDerivWithinAt.congr_mono (h : HasLineDerivWithinAt š f f' s x v) (ht : EqOn fā f t)
(hx : fā x = f x) (hā : t ā s) : HasLineDerivWithinAt š fā f' t x v :=
HasDerivWithinAt.congr_mono h (fun _ hy ⦠ht hy) (by simpa using hx) (preimage_mono hā)
theorem HasLineDerivWithinAt.congr (h : HasLineDerivWithinAt š f f' s x v) (hs : EqOn fā f s)
(hx : fā x = f x) : HasLineDerivWithinAt š fā f' s x v :=
h.congr_mono hs hx (Subset.refl _)
theorem HasLineDerivWithinAt.congr' (h : HasLineDerivWithinAt š f f' s x v)
(hs : EqOn fā f s) (hx : x ā s) :
HasLineDerivWithinAt š fā f' s x v :=
h.congr hs (hs hx)
theorem LineDifferentiableWithinAt.congr_mono (h : LineDifferentiableWithinAt š f s x v)
(ht : EqOn fā f t) (hx : fā x = f x) (hā : t ā s) :
LineDifferentiableWithinAt š fā t x v :=
(HasLineDerivWithinAt.congr_mono h.hasLineDerivWithinAt ht hx hā).differentiableWithinAt
theorem LineDifferentiableWithinAt.congr (h : LineDifferentiableWithinAt š f s x v)
(ht : ā x ā s, fā x = f x) (hx : fā x = f x) :
LineDifferentiableWithinAt š fā s x v :=
LineDifferentiableWithinAt.congr_mono h ht hx (Subset.refl _)
theorem lineDerivWithin_congr (hs : EqOn fā f s) (hx : fā x = f x) :
lineDerivWithin š fā s x v = lineDerivWithin š f s x v :=
derivWithin_congr (fun _ hy ⦠hs hy) (by simpa using hx)
theorem lineDerivWithin_congr' (hs : EqOn fā f s) (hx : x ā s) :
lineDerivWithin š fā s x v = lineDerivWithin š f s x v :=
lineDerivWithin_congr hs (hs hx)
theorem hasLineDerivAt_iff_tendsto_slope_zero :
HasLineDerivAt š f f' x v ā
Tendsto (fun (t : š) ⦠tā»Ā¹ ⢠(f (x + t ⢠v) - f x)) (š[ā ] 0) (š f') := by
simp only [HasLineDerivAt, hasDerivAt_iff_tendsto_slope_zero, zero_add,
zero_smul, add_zero]
alias āØHasLineDerivAt.tendsto_slope_zero, _ā© := hasLineDerivAt_iff_tendsto_slope_zero
theorem HasLineDerivAt.tendsto_slope_zero_right [Preorder š] (h : HasLineDerivAt š f f' x v) :
Tendsto (fun (t : š) ⦠tā»Ā¹ ⢠(f (x + t ⢠v) - f x)) (š[>] 0) (š f') :=
h.tendsto_slope_zero.mono_left (nhdsGT_le_nhdsNE 0)
theorem HasLineDerivAt.tendsto_slope_zero_left [Preorder š] (h : HasLineDerivAt š f f' x v) :
Tendsto (fun (t : š) ⦠tā»Ā¹ ⢠(f (x + t ⢠v) - f x)) (š[<] 0) (š f') :=
h.tendsto_slope_zero.mono_left (nhdsLT_le_nhdsNE 0)
theorem HasLineDerivWithinAt.hasLineDerivAt'
(h : HasLineDerivWithinAt š f f' s x v) (hs : āį¶ t : š in š 0, x + t ⢠v ā s) :
HasLineDerivAt š f f' x v :=
h.hasDerivAt hs
end Module
section NormedSpace
/-!
Results that need a normed space structure on `E`
-/
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace š E]
{f fā fā : E ā F} {f' : F} {s t : Set E} {x v : E} {L : E āL[š] F}
theorem HasLineDerivWithinAt.mono_of_mem_nhdsWithin
(h : HasLineDerivWithinAt š f f' t x v) (hst : t ā š[s] x) :
HasLineDerivWithinAt š f f' s x v := by
apply HasDerivWithinAt.mono_of_mem_nhdsWithin h
apply ContinuousWithinAt.preimage_mem_nhdsWithin'' _ hst (by simp)
apply Continuous.continuousWithinAt; fun_prop
theorem HasLineDerivWithinAt.hasLineDerivAt
(h : HasLineDerivWithinAt š f f' s x v) (hs : s ā š x) :
HasLineDerivAt š f f' x v :=
h.hasLineDerivAt' <| (Continuous.tendsto' (by fun_prop) 0 _ (by simp)).eventually hs
theorem LineDifferentiableWithinAt.lineDifferentiableAt (h : LineDifferentiableWithinAt š f s x v)
(hs : s ā š x) : LineDifferentiableAt š f x v :=
(h.hasLineDerivWithinAt.hasLineDerivAt hs).lineDifferentiableAt
lemma HasFDerivWithinAt.hasLineDerivWithinAt (hf : HasFDerivWithinAt f L s x) (v : E) :
HasLineDerivWithinAt š f (L v) s x v := by
let F := fun (t : š) ⦠x + t ⢠v
rw [show x = F (0 : š) by simp [F]] at hf
have A : HasDerivWithinAt F (0 + (1 : š) ⢠v) (F ā»Ā¹' s) 0 :=
((hasDerivAt_const (0 : š) x).add ((hasDerivAt_id' (0 : š)).smul_const v)).hasDerivWithinAt
simp only [one_smul, zero_add] at A
exact hf.comp_hasDerivWithinAt (x := (0 : š)) A (mapsTo_preimage F s)
lemma HasFDerivAt.hasLineDerivAt (hf : HasFDerivAt f L x) (v : E) :
HasLineDerivAt š f (L v) x v := by
rw [ā hasLineDerivWithinAt_univ]
exact hf.hasFDerivWithinAt.hasLineDerivWithinAt v
lemma DifferentiableAt.lineDeriv_eq_fderiv (hf : DifferentiableAt š f x) :
lineDeriv š f x v = fderiv š f x v :=
(hf.hasFDerivAt.hasLineDerivAt v).lineDeriv
theorem LineDifferentiableWithinAt.mono_of_mem_nhdsWithin (h : LineDifferentiableWithinAt š f s x v)
(hst : s ā š[t] x) : LineDifferentiableWithinAt š f t x v :=
(h.hasLineDerivWithinAt.mono_of_mem_nhdsWithin hst).lineDifferentiableWithinAt
theorem lineDerivWithin_of_mem_nhds (h : s ā š x) :
lineDerivWithin š f s x v = lineDeriv š f x v := by
apply derivWithin_of_mem_nhds
apply (Continuous.continuousAt _).preimage_mem_nhds (by simpa using h)
fun_prop
theorem lineDerivWithin_of_isOpen (hs : IsOpen s) (hx : x ā s) :
lineDerivWithin š f s x v = lineDeriv š f x v :=
lineDerivWithin_of_mem_nhds (hs.mem_nhds hx)
theorem hasLineDerivWithinAt_congr_set (h : s =į¶ [š x] t) :
HasLineDerivWithinAt š f f' s x v ā HasLineDerivWithinAt š f f' t x v := by
apply hasDerivWithinAt_congr_set
let F := fun (t : š) ⦠x + t ⢠v
have B : ContinuousAt F 0 := by apply Continuous.continuousAt; fun_prop
have : s =į¶ [š (F 0)] t := by convert h; simp [F]
exact B.preimage_mem_nhds this
theorem lineDifferentiableWithinAt_congr_set (h : s =į¶ [š x] t) :
LineDifferentiableWithinAt š f s x v ā LineDifferentiableWithinAt š f t x v :=
āØfun h' ⦠((hasLineDerivWithinAt_congr_set h).1
h'.hasLineDerivWithinAt).lineDifferentiableWithinAt,
fun h' ⦠((hasLineDerivWithinAt_congr_set h.symm).1
h'.hasLineDerivWithinAt).lineDifferentiableWithinAtā©
theorem lineDerivWithin_congr_set (h : s =į¶ [š x] t) :
lineDerivWithin š f s x v = lineDerivWithin š f t x v := by
apply derivWithin_congr_set
let F := fun (t : š) ⦠x + t ⢠v
have B : ContinuousAt F 0 := by apply Continuous.continuousAt; fun_prop
have : s =į¶ [š (F 0)] t := by convert h; simp [F]
exact B.preimage_mem_nhds this
theorem Filter.EventuallyEq.hasLineDerivAt_iff (h : fā =į¶ [š x] fā) :
HasLineDerivAt š fā f' x v ā HasLineDerivAt š fā f' x v := by
apply hasDerivAt_iff
let F := fun (t : š) ⦠x + t ⢠v
have B : ContinuousAt F 0 := by apply Continuous.continuousAt; fun_prop
have : fā =į¶ [š (F 0)] fā := by convert h; simp [F]
exact B.preimage_mem_nhds this
theorem Filter.EventuallyEq.lineDifferentiableAt_iff (h : fā =į¶ [š x] fā) :
LineDifferentiableAt š fā x v ā LineDifferentiableAt š fā x v :=
āØfun h' ⦠(h.hasLineDerivAt_iff.1 h'.hasLineDerivAt).lineDifferentiableAt,
fun h' ⦠(h.hasLineDerivAt_iff.2 h'.hasLineDerivAt).lineDifferentiableAtā©
theorem Filter.EventuallyEq.hasLineDerivWithinAt_iff (h : fā =į¶ [š[s] x] fā) (hx : fā x = fā x) :
HasLineDerivWithinAt š fā f' s x v ā HasLineDerivWithinAt š fā f' s x v := by
apply hasDerivWithinAt_iff
Ā· have A : Continuous (fun (t : š) ⦠x + t ⢠v) := by fun_prop
exact A.continuousWithinAt.preimage_mem_nhdsWithin'' h (by simp)
Ā· simpa using hx
theorem Filter.EventuallyEq.hasLineDerivWithinAt_iff_of_mem (h : fā =į¶ [š[s] x] fā) (hx : x ā s) :
HasLineDerivWithinAt š fā f' s x v ā HasLineDerivWithinAt š fā f' s x v :=
h.hasLineDerivWithinAt_iff (h.eq_of_nhdsWithin hx)
theorem Filter.EventuallyEq.lineDifferentiableWithinAt_iff
(h : fā =į¶ [š[s] x] fā) (hx : fā x = fā x) :
LineDifferentiableWithinAt š fā s x v ā LineDifferentiableWithinAt š fā s x v :=
āØfun h' ⦠((h.hasLineDerivWithinAt_iff hx).1 h'.hasLineDerivWithinAt).lineDifferentiableWithinAt,
fun h' ⦠((h.hasLineDerivWithinAt_iff hx).2 h'.hasLineDerivWithinAt).lineDifferentiableWithinAtā©
theorem Filter.EventuallyEq.lineDifferentiableWithinAt_iff_of_mem
(h : fā =į¶ [š[s] x] fā) (hx : x ā s) :
LineDifferentiableWithinAt š fā s x v ā LineDifferentiableWithinAt š fā s x v :=
h.lineDifferentiableWithinAt_iff (h.eq_of_nhdsWithin hx)
lemma HasLineDerivWithinAt.congr_of_eventuallyEq (hf : HasLineDerivWithinAt š f f' s x v)
(h'f : fā =į¶ [š[s] x] f) (hx : fā x = f x) : HasLineDerivWithinAt š fā f' s x v :=
h'f.symm.hasLineDerivWithinAt_iff hx.symm |>.mp hf
theorem HasLineDerivAt.congr_of_eventuallyEq (h : HasLineDerivAt š f f' x v) (hā : fā =į¶ [š x] f) :
HasLineDerivAt š fā f' x v :=
(EventuallyEq.hasLineDerivAt_iff hā.symm).mp h
theorem LineDifferentiableWithinAt.congr_of_eventuallyEq (h : LineDifferentiableWithinAt š f s x v)
(hā : fā =į¶ [š[s] x] f) (hx : fā x = f x) : LineDifferentiableWithinAt š fā s x v :=
(h.hasLineDerivWithinAt.congr_of_eventuallyEq hā hx).differentiableWithinAt
theorem LineDifferentiableAt.congr_of_eventuallyEq
(h : LineDifferentiableAt š f x v) (hL : fā =į¶ [š x] f) :
LineDifferentiableAt š fā x v :=
hL.symm.lineDifferentiableAt_iff.mp h
theorem Filter.EventuallyEq.lineDerivWithin_eq (hs : fā =į¶ [š[s] x] f) (hx : fā x = f x) :
lineDerivWithin š fā s x v = lineDerivWithin š f s x v := by
apply derivWithin_eq ?_ (by simpa using hx)
have A : Continuous (fun (t : š) ⦠x + t ⢠v) := by fun_prop
exact A.continuousWithinAt.preimage_mem_nhdsWithin'' hs (by simp)
theorem Filter.EventuallyEq.lineDerivWithin_eq_nhds (h : fā =į¶ [š x] f) :
lineDerivWithin š fā s x v = lineDerivWithin š f s x v :=
(h.filter_mono nhdsWithin_le_nhds).lineDerivWithin_eq h.self_of_nhds
theorem Filter.EventuallyEq.lineDeriv_eq (h : fā =į¶ [š x] f) :
lineDeriv š fā x v = lineDeriv š f x v := by
rw [ā lineDerivWithin_univ, ā lineDerivWithin_univ, h.lineDerivWithin_eq_nhds]
/-- Converse to the mean value inequality: if `f` is line differentiable at `xā` and `C`-lipschitz
on a neighborhood of `xā` then its line derivative at `xā` in the direction `v` has norm
bounded by `C * āvā`. This version only assumes that `āf x - f xāā ⤠C * āx - xāā` in a
neighborhood of `x`. -/
theorem HasLineDerivAt.le_of_lip' {f : E ā F} {f' : F} {xā : E} (hf : HasLineDerivAt š f f' xā v)
{C : ā} (hCā : 0 ⤠C) (hlip : āį¶ x in š xā, āf x - f xāā ⤠C * āx - xāā) :
āf'ā ⤠C * āvā := by
apply HasDerivAt.le_of_lip' hf (by positivity)
have A : Continuous (fun (t : š) ⦠xā + t ⢠v) := by fun_prop
have : āį¶ x in š (xā + (0 : š) ⢠v), āf x - f xāā ⤠C * āx - xāā := by simpa using hlip
filter_upwards [(A.continuousAt (x := 0)).preimage_mem_nhds this] with t ht
simp only [preimage_setOf_eq, add_sub_cancel_left, norm_smul, mem_setOf_eq, mul_comm (ātā)] at ht
simpa [mul_assoc] using ht
/-- Converse to the mean value inequality: if `f` is line differentiable at `xā` and `C`-lipschitz
on a neighborhood of `xā` then its line derivative at `xā` in the direction `v` has norm
bounded by `C * āvā`. This version only assumes that `āf x - f xāā ⤠C * āx - xāā` in a
neighborhood of `x`. -/
theorem HasLineDerivAt.le_of_lipschitzOn
{f : E ā F} {f' : F} {xā : E} (hf : HasLineDerivAt š f f' xā v)
{s : Set E} (hs : s ā š xā) {C : āā„0} (hlip : LipschitzOnWith C f s) :
āf'ā ⤠C * āvā := by
refine hf.le_of_lip' C.coe_nonneg ?_
filter_upwards [hs] with x hx using hlip.norm_sub_le hx (mem_of_mem_nhds hs)
/-- Converse to the mean value inequality: if `f` is line differentiable at `xā` and `C`-lipschitz
then its line derivative at `xā` in the direction `v` has norm bounded by `C * āvā`. -/
theorem HasLineDerivAt.le_of_lipschitz
{f : E ā F} {f' : F} {xā : E} (hf : HasLineDerivAt š f f' xā v)
{C : āā„0} (hlip : LipschitzWith C f) : āf'ā ⤠C * āvā :=
hf.le_of_lipschitzOn univ_mem (lipschitzOnWith_univ.2 hlip)
variable (š)
/-- Converse to the mean value inequality: if `f` is `C`-lipschitz
on a neighborhood of `xā` then its line derivative at `xā` in the direction `v` has norm
bounded by `C * āvā`. This version only assumes that `āf x - f xāā ⤠C * āx - xāā` in a
neighborhood of `x`.
Version using `lineDeriv`. -/
theorem norm_lineDeriv_le_of_lip' {f : E ā F} {xā : E}
{C : ā} (hCā : 0 ⤠C) (hlip : āį¶ x in š xā, āf x - f xāā ⤠C * āx - xāā) :
ālineDeriv š f xā vā ⤠C * āvā := by
apply norm_deriv_le_of_lip' (by positivity)
have A : Continuous (fun (t : š) ⦠xā + t ⢠v) := by fun_prop
have : āį¶ x in š (xā + (0 : š) ⢠v), āf x - f xāā ⤠C * āx - xāā := by simpa using hlip
filter_upwards [(A.continuousAt (x := 0)).preimage_mem_nhds this] with t ht
simp only [preimage_setOf_eq, add_sub_cancel_left, norm_smul, mem_setOf_eq, mul_comm (ātā)] at ht
simpa [mul_assoc] using ht
/-- Converse to the mean value inequality: if `f` is `C`-lipschitz on a neighborhood of `xā`
then its line derivative at `xā` in the direction `v` has norm bounded by `C * āvā`.
Version using `lineDeriv`. -/
theorem norm_lineDeriv_le_of_lipschitzOn {f : E ā F} {xā : E} {s : Set E} (hs : s ā š xā)
{C : āā„0} (hlip : LipschitzOnWith C f s) : ālineDeriv š f xā vā ⤠C * āvā := by
refine norm_lineDeriv_le_of_lip' š C.coe_nonneg ?_
filter_upwards [hs] with x hx using hlip.norm_sub_le hx (mem_of_mem_nhds hs)
/-- Converse to the mean value inequality: if `f` is `C`-lipschitz then
its line derivative at `xā` in the direction `v` has norm bounded by `C * āvā`.
Version using `lineDeriv`. -/
theorem norm_lineDeriv_le_of_lipschitz {f : E ā F} {xā : E}
{C : āā„0} (hlip : LipschitzWith C f) : ālineDeriv š f xā vā ⤠C * āvā :=
norm_lineDeriv_le_of_lipschitzOn š univ_mem (lipschitzOnWith_univ.2 hlip)
variable {š}
end NormedSpace
section Zero
variable {E : Type*} [AddCommGroup E] [Module š E] {f : E ā F} {s : Set E} {x : E}
theorem hasLineDerivWithinAt_zero : HasLineDerivWithinAt š f 0 s x 0 := by
simp [HasLineDerivWithinAt, hasDerivWithinAt_const]
theorem hasLineDerivAt_zero : HasLineDerivAt š f 0 x 0 := by
simp [HasLineDerivAt, hasDerivAt_const]
theorem lineDifferentiableWithinAt_zero : LineDifferentiableWithinAt š f s x 0 :=
hasLineDerivWithinAt_zero.lineDifferentiableWithinAt
theorem lineDifferentiableAt_zero : LineDifferentiableAt š f x 0 :=
hasLineDerivAt_zero.lineDifferentiableAt
theorem lineDeriv_zero : lineDeriv š f x 0 = 0 :=
hasLineDerivAt_zero.lineDeriv
end Zero
section CompRight
variable {E : Type*} [AddCommGroup E] [Module š E]
{E' : Type*} [AddCommGroup E'] [Module š E']
{f : E ā F} {f' : F} {x : E'} {L : E' āā[š] E}
theorem HasLineDerivAt.of_comp {v : E'} (hf : HasLineDerivAt š (f ā L) f' x v) :
HasLineDerivAt š f f' (L x) (L v) := by
simpa [HasLineDerivAt] using hf
theorem LineDifferentiableAt.of_comp {v : E'} (hf : LineDifferentiableAt š (f ā L) x v) :
LineDifferentiableAt š f (L x) (L v) :=
hf.hasLineDerivAt.of_comp.lineDifferentiableAt
end CompRight
section SMul
variable {E : Type*} [AddCommGroup E] [Module š E] {f : E ā F} {s : Set E} {x v : E} {f' : F}
theorem HasLineDerivWithinAt.smul (h : HasLineDerivWithinAt š f f' s x v) (c : š) :
HasLineDerivWithinAt š f (c ⢠f') s x (c ⢠v) := by
simp only [HasLineDerivWithinAt] at h ā¢
let g := fun (t : š) ⦠c ⢠t
let s' := (fun (t : š) ⦠x + t ⢠v) ā»Ā¹' s
have A : HasDerivAt g c 0 := by simpa using (hasDerivAt_id (0 : š)).const_smul c
have B : HasDerivWithinAt (fun t ⦠f (x + t ⢠v)) f' s' (g 0) := by simpa [g] using h
have Z := B.scomp (0 : š) A.hasDerivWithinAt (mapsTo_preimage g s')
simp only [g, s', Function.comp_def, smul_eq_mul, mul_comm c, ā smul_smul] at Z
convert Z
ext t
simp [ā smul_smul]
theorem hasLineDerivWithinAt_smul_iff {c : š} (hc : c ā 0) :
HasLineDerivWithinAt š f (c ⢠f') s x (c ⢠v) ā HasLineDerivWithinAt š f f' s x v :=
āØfun h ⦠by simpa [smul_smul, inv_mul_cancelā hc] using h.smul (c ā»Ā¹), fun h ⦠h.smul cā©
theorem HasLineDerivAt.smul (h : HasLineDerivAt š f f' x v) (c : š) :
HasLineDerivAt š f (c ⢠f') x (c ⢠v) := by
simp only [ā hasLineDerivWithinAt_univ] at h ā¢
exact HasLineDerivWithinAt.smul h c
theorem hasLineDerivAt_smul_iff {c : š} (hc : c ā 0) :
HasLineDerivAt š f (c ⢠f') x (c ⢠v) ā HasLineDerivAt š f f' x v :=
āØfun h ⦠by simpa [smul_smul, inv_mul_cancelā hc] using h.smul (c ā»Ā¹), fun h ⦠h.smul cā©
theorem LineDifferentiableWithinAt.smul (h : LineDifferentiableWithinAt š f s x v) (c : š) :
LineDifferentiableWithinAt š f s x (c ⢠v) :=
(h.hasLineDerivWithinAt.smul c).lineDifferentiableWithinAt
theorem lineDifferentiableWithinAt_smul_iff {c : š} (hc : c ā 0) :
LineDifferentiableWithinAt š f s x (c ⢠v) ā LineDifferentiableWithinAt š f s x v :=
āØfun h ⦠by simpa [smul_smul, inv_mul_cancelā hc] using h.smul (c ā»Ā¹), fun h ⦠h.smul cā©
theorem LineDifferentiableAt.smul (h : LineDifferentiableAt š f x v) (c : š) :
LineDifferentiableAt š f x (c ⢠v) :=
(h.hasLineDerivAt.smul c).lineDifferentiableAt
theorem lineDifferentiableAt_smul_iff {c : š} (hc : c ā 0) :
LineDifferentiableAt š f x (c ⢠v) ā LineDifferentiableAt š f x v :=
āØfun h ⦠by simpa [smul_smul, inv_mul_cancelā hc] using h.smul (c ā»Ā¹), fun h ⦠h.smul cā©
theorem lineDeriv_smul {c : š} : lineDeriv š f x (c ⢠v) = c ⢠lineDeriv š f x v := by
rcases eq_or_ne c 0 with rfl | hc
Ā· simp [lineDeriv_zero]
by_cases H : LineDifferentiableAt š f x v
Ā· exact (H.hasLineDerivAt.smul c).lineDeriv
Ā· have H' : ¬ (LineDifferentiableAt š f x (c ⢠v)) := by
simpa [lineDifferentiableAt_smul_iff hc] using H
simp [lineDeriv_zero_of_not_lineDifferentiableAt, H, H']
theorem lineDeriv_neg : lineDeriv š f x (-v) = - lineDeriv š f x v := by
rw [ā neg_one_smul (R := š) v, lineDeriv_smul, neg_one_smul]
end SMul |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/LineDeriv/Measurable.lean | import Mathlib.Analysis.Calculus.LineDeriv.Basic
import Mathlib.Analysis.Calculus.FDeriv.Measurable
/-! # Measurability of the line derivative
We prove in `measurable_lineDeriv` that the line derivative of a function (with respect to a
locally compact scalar field) is measurable, provided the function is continuous.
In `measurable_lineDeriv_uncurry`, assuming additionally that the source space is second countable,
we show that `(x, v) ⦠lineDeriv š f x v` is also measurable.
An assumption such as continuity is necessary, as otherwise one could alternate in a non-measurable
way between differentiable and non-differentiable functions along the various lines
directed by `v`.
-/
open MeasureTheory
variable {š : Type*} [NontriviallyNormedField š] [LocallyCompactSpace š]
{E : Type*} [NormedAddCommGroup E] [NormedSpace š E] [MeasurableSpace E] [OpensMeasurableSpace E]
{F : Type*} [NormedAddCommGroup F] [NormedSpace š F] [CompleteSpace F]
{f : E ā F} {v : E}
/-!
Measurability of the line derivative `lineDeriv š f x v` with respect to a fixed direction `v`.
-/
theorem measurableSet_lineDifferentiableAt (hf : Continuous f) :
MeasurableSet {x : E | LineDifferentiableAt š f x v} := by
borelize š
let g : E ā š ā F := fun x t ⦠f (x + t ⢠v)
have hg : Continuous g.uncurry := by fun_prop
exact measurable_prodMk_right (measurableSet_of_differentiableAt_with_param š hg)
theorem measurable_lineDeriv [MeasurableSpace F] [BorelSpace F]
(hf : Continuous f) : Measurable (fun x ⦠lineDeriv š f x v) := by
borelize š
let g : E ā š ā F := fun x t ⦠f (x + t ⢠v)
have hg : Continuous g.uncurry := by fun_prop
exact (measurable_deriv_with_param hg).comp measurable_prodMk_right
theorem stronglyMeasurable_lineDeriv [SecondCountableTopologyEither E F] (hf : Continuous f) :
StronglyMeasurable (fun x ⦠lineDeriv š f x v) := by
borelize š
let g : E ā š ā F := fun x t ⦠f (x + t ⢠v)
have hg : Continuous g.uncurry := by fun_prop
exact (stronglyMeasurable_deriv_with_param hg).comp_measurable measurable_prodMk_right
theorem aemeasurable_lineDeriv [MeasurableSpace F] [BorelSpace F]
(hf : Continuous f) (μ : Measure E) :
AEMeasurable (fun x ⦠lineDeriv š f x v) μ :=
(measurable_lineDeriv hf).aemeasurable
theorem aestronglyMeasurable_lineDeriv [SecondCountableTopologyEither E F]
(hf : Continuous f) (μ : Measure E) :
AEStronglyMeasurable (fun x ⦠lineDeriv š f x v) μ :=
(stronglyMeasurable_lineDeriv hf).aestronglyMeasurable
/-!
Measurability of the line derivative `lineDeriv š f x v` when varying both `x` and `v`. For this,
we need an additional second countability assumption on `E` to make sure that open sets are
measurable in `E Ć E`.
-/
variable [SecondCountableTopology E]
theorem measurableSet_lineDifferentiableAt_uncurry (hf : Continuous f) :
MeasurableSet {p : E Ć E | LineDifferentiableAt š f p.1 p.2} := by
borelize š
let g : (E Ć E) ā š ā F := fun p t ⦠f (p.1 + t ⢠p.2)
have : Continuous g.uncurry :=
hf.comp <| (continuous_fst.comp continuous_fst).add
<| continuous_snd.smul (continuous_snd.comp continuous_fst)
have M_meas : MeasurableSet {q : (E Ć E) Ć š | DifferentiableAt š (g q.1) q.2} :=
measurableSet_of_differentiableAt_with_param š this
exact measurable_prodMk_right M_meas
theorem measurable_lineDeriv_uncurry [MeasurableSpace F] [BorelSpace F]
(hf : Continuous f) : Measurable (fun (p : E Ć E) ⦠lineDeriv š f p.1 p.2) := by
borelize š
let g : (E Ć E) ā š ā F := fun p t ⦠f (p.1 + t ⢠p.2)
have : Continuous g.uncurry :=
hf.comp <| (continuous_fst.comp continuous_fst).add
<| continuous_snd.smul (continuous_snd.comp continuous_fst)
exact (measurable_deriv_with_param this).comp measurable_prodMk_right
theorem stronglyMeasurable_lineDeriv_uncurry (hf : Continuous f) :
StronglyMeasurable (fun (p : E Ć E) ⦠lineDeriv š f p.1 p.2) := by
borelize š
let g : (E Ć E) ā š ā F := fun p t ⦠f (p.1 + t ⢠p.2)
have : Continuous g.uncurry :=
hf.comp <| (continuous_fst.comp continuous_fst).add
<| continuous_snd.smul (continuous_snd.comp continuous_fst)
exact (stronglyMeasurable_deriv_with_param this).comp_measurable measurable_prodMk_right
theorem aemeasurable_lineDeriv_uncurry [MeasurableSpace F] [BorelSpace F]
(hf : Continuous f) (μ : Measure (E à E)) :
AEMeasurable (fun (p : E Ć E) ⦠lineDeriv š f p.1 p.2) μ :=
(measurable_lineDeriv_uncurry hf).aemeasurable
theorem aestronglyMeasurable_lineDeriv_uncurry (hf : Continuous f) (μ : Measure (E à E)) :
AEStronglyMeasurable (fun (p : E Ć E) ⦠lineDeriv š f p.1 p.2) μ :=
(stronglyMeasurable_lineDeriv_uncurry hf).aestronglyMeasurable |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/BumpFunction/Normed.lean | import Mathlib.Analysis.Calculus.BumpFunction.Basic
import Mathlib.MeasureTheory.Integral.Bochner.ContinuousLinearMap
import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar
/-!
# Normed bump function
In this file we define `ContDiffBump.normed f μ` to be the bump function `f` normalized so that
`ā« x, f.normed μ x āμ = 1` and prove some properties of this function.
-/
noncomputable section
open Function Filter Set Metric MeasureTheory Module Measure
open scoped Topology
namespace ContDiffBump
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ā E] [HasContDiffBump E]
[MeasurableSpace E] {c : E} (f : ContDiffBump c) {x : E} {n : āā} {μ : Measure E}
/-- A bump function normed so that `ā« x, f.normed μ x āμ = 1`. -/
protected def normed (μ : Measure E) : E ā ā := fun x => f x / ā« x, f x āμ
theorem normed_def {μ : Measure E} (x : E) : f.normed μ x = f x / ā« x, f x āμ :=
rfl
theorem nonneg_normed (x : E) : 0 ⤠f.normed μ x :=
div_nonneg f.nonneg <| integral_nonneg f.nonneg'
theorem contDiff_normed {n : āā} : ContDiff ā n (f.normed μ) :=
f.contDiff.div_const _
theorem continuous_normed : Continuous (f.normed μ) :=
f.continuous.div_const _
theorem normed_sub (x : E) : f.normed μ (c - x) = f.normed μ (c + x) := by
simp_rw [f.normed_def, f.sub]
theorem normed_neg (f : ContDiffBump (0 : E)) (x : E) : f.normed μ (-x) = f.normed μ x := by
simp_rw [f.normed_def, f.neg]
variable [BorelSpace E] [FiniteDimensional ā E] [IsLocallyFiniteMeasure μ]
protected theorem integrable : Integrable f μ :=
f.continuous.integrable_of_hasCompactSupport f.hasCompactSupport
protected theorem integrable_normed : Integrable (f.normed μ) μ :=
f.integrable.div_const _
section
variable [μ.IsOpenPosMeasure]
theorem integral_pos : 0 < ā« x, f x āμ := by
refine (integral_pos_iff_support_of_nonneg f.nonneg' f.integrable).mpr ?_
rw [f.support_eq]
exact measure_ball_pos μ c f.rOut_pos
theorem integral_normed : ā« x, f.normed μ x āμ = 1 := by
simp_rw [ContDiffBump.normed, div_eq_mul_inv, mul_comm (f _), ā smul_eq_mul, integral_smul]
exact inv_mul_cancelā f.integral_pos.ne'
theorem support_normed_eq : Function.support (f.normed μ) = Metric.ball c f.rOut := by
unfold ContDiffBump.normed
rw [support_div, f.support_eq, support_const f.integral_pos.ne', inter_univ]
theorem tsupport_normed_eq : tsupport (f.normed μ) = Metric.closedBall c f.rOut := by
rw [tsupport, f.support_normed_eq, closure_ball _ f.rOut_pos.ne']
theorem hasCompactSupport_normed : HasCompactSupport (f.normed μ) := by
simp only [HasCompactSupport, f.tsupport_normed_eq (μ := μ), isCompact_closedBall]
theorem tendsto_support_normed_smallSets {ι} {Ļ : ι ā ContDiffBump c} {l : Filter ι}
(hĻ : Tendsto (fun i => (Ļ i).rOut) l (š 0)) :
Tendsto (fun i => Function.support fun x => (Ļ i).normed μ x) l (š c).smallSets := by
simp_rw [NormedAddCommGroup.tendsto_nhds_zero, Real.norm_eq_abs,
abs_eq_self.mpr (Ļ _).rOut_pos.le] at hĻ
rw [nhds_basis_ball.smallSets.tendsto_right_iff]
refine fun ε hε ⦠(hĻ Īµ hε).mono fun i hi ⦠?_
rw [(Ļ i).support_normed_eq]
exact ball_subset_ball hi.le
variable (μ)
theorem integral_normed_smul {X} [NormedAddCommGroup X] [NormedSpace ā X]
[CompleteSpace X] (z : X) : ā« x, f.normed μ x ⢠z āμ = z := by
simp_rw [integral_smul_const, f.integral_normed (μ := μ), one_smul]
end
variable (μ)
theorem measure_closedBall_le_integral : μ.real (closedBall c f.rIn) ⤠⫠x, f x āμ := by calc
μ.real (closedBall c f.rIn) = ā« x in closedBall c f.rIn, 1 āμ := by simp
_ = ā« x in closedBall c f.rIn, f x āμ := setIntegral_congr_fun measurableSet_closedBall
(fun x hx ⦠(one_of_mem_closedBall f hx).symm)
_ ⤠⫠x, f x āμ := setIntegral_le_integral f.integrable (Eventually.of_forall (fun x ⦠f.nonneg))
theorem normed_le_div_measure_closedBall_rIn [μ.IsOpenPosMeasure] (x : E) :
f.normed μ x ⤠1 / μ.real (closedBall c f.rIn) := by
rw [normed_def]
gcongr
Ā· exact ENNReal.toReal_pos (measure_closedBall_pos _ _ f.rIn_pos).ne' measure_closedBall_lt_top.ne
Ā· exact f.le_one
· exact f.measure_closedBall_le_integral μ
theorem integral_le_measure_closedBall : ā« x, f x āμ ⤠μ.real (closedBall c f.rOut) := by calc
ā« x, f x āμ = ā« x in closedBall c f.rOut, f x āμ := by
apply (setIntegral_eq_integral_of_forall_compl_eq_zero (fun x hx ⦠?_)).symm
apply f.zero_of_le_dist (le_of_lt _)
simpa using hx
_ ⤠⫠x in closedBall c f.rOut, 1 āμ := by
apply setIntegral_mono f.integrable.integrableOn _ (fun x ⦠f.le_one)
simp [measure_closedBall_lt_top]
_ = μ.real (closedBall c f.rOut) := by simp
theorem measure_closedBall_div_le_integral [IsAddHaarMeasure μ] (K : ā) (h : f.rOut ⤠K * f.rIn) :
μ.real (closedBall c f.rOut) / K ^ finrank ā E ⤠⫠x, f x āμ := by
have K_pos : 0 < K := by
simpa [f.rIn_pos, not_lt.2 f.rIn_pos.le] using mul_pos_iff.1 (f.rOut_pos.trans_le h)
apply le_trans _ (f.measure_closedBall_le_integral μ)
rw [div_le_iffā (pow_pos K_pos _), addHaar_real_closedBall' _ _ f.rIn_pos.le,
addHaar_real_closedBall' _ _ f.rOut_pos.le, mul_assoc, mul_comm _ (K ^ _), ā mul_assoc,
ā mul_pow, mul_comm _ K]
gcongr
exact f.rOut_pos.le
theorem normed_le_div_measure_closedBall_rOut [IsAddHaarMeasure μ] (K : ā) (h : f.rOut ⤠K * f.rIn)
(x : E) :
f.normed μ x ⤠K ^ finrank ā E / μ.real (closedBall c f.rOut) := by
have K_pos : 0 < K := by
simpa [f.rIn_pos, not_lt.2 f.rIn_pos.le] using mul_pos_iff.1 (f.rOut_pos.trans_le h)
have : f x / ā« y, f y āμ ⤠1 / ā« y, f y āμ := by
gcongr
Ā· exact f.integral_pos.le
Ā· exact f.le_one
apply this.trans
rw [div_le_div_iffā f.integral_pos, one_mul, ā div_le_iffā' (pow_pos K_pos _)]
· exact f.measure_closedBall_div_le_integral μ K h
Ā· exact ENNReal.toReal_pos (measure_closedBall_pos _ _ f.rOut_pos).ne'
measure_closedBall_lt_top.ne
end ContDiffBump |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/BumpFunction/Convolution.lean | import Mathlib.Analysis.Convolution
import Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension
import Mathlib.Analysis.Calculus.BumpFunction.Normed
import Mathlib.MeasureTheory.Integral.Average
import Mathlib.MeasureTheory.Covering.Differentiation
import Mathlib.MeasureTheory.Covering.BesicovitchVectorSpace
import Mathlib.MeasureTheory.Measure.Haar.Unique
/-!
# Convolution with a bump function
In this file we prove lemmas about convolutions `(Ļ.normed μ ā[lsmul ā ā, μ] g) xā`,
where `Ļ : ContDiffBump 0` is a smooth bump function.
We prove that this convolution is equal to `g xā`
if `g` is a constant on `Metric.ball xā Ļ.rOut`.
We also provide estimates in the case if `g x` is close to `g xā` on this ball.
## Main results
- `ContDiffBump.convolution_tendsto_right_of_continuous`:
Let `g` be a continuous function; let `Ļ i` be a family of `ContDiffBump 0` functions with.
If `(Ļ i).rOut` tends to zero along a filter `l`,
then `((Ļ i).normed μ ā[lsmul ā ā, μ] g) xā` tends to `g xā` along the same filter.
- `ContDiffBump.convolution_tendsto_right`: generalization of the above lemma.
- `ContDiffBump.ae_convolution_tendsto_right_of_locallyIntegrable`: let `g` be a locally
integrable function. Then the convolution of `g` with a family of bump functions with
support tending to `0` converges almost everywhere to `g`.
## Keywords
convolution, smooth function, bump function
-/
universe uG uE'
open ContinuousLinearMap Metric MeasureTheory Filter Function Measure Set
open scoped Convolution Topology
namespace ContDiffBump
variable {G : Type uG} {E' : Type uE'} [NormedAddCommGroup E'] {g : G ā E'} [MeasurableSpace G]
{μ : MeasureTheory.Measure G} [NormedSpace ā E'] [NormedAddCommGroup G] [NormedSpace ā G]
[CompleteSpace E'] {Ļ : ContDiffBump (0 : G)} {xā : G}
/-- If `Ļ` is a bump function, compute `(Ļ ā g) xā`
if `g` is constant on `Metric.ball xā Ļ.rOut`. -/
theorem convolution_eq_right [HasContDiffBump G] {xā : G} (hg : ā x ā ball xā Ļ.rOut, g x = g xā) :
(Ļ ā[lsmul ā ā, μ] g : G ā E') xā = integral μ Ļ ā¢ g xā := by
simp_rw [convolution_eq_right' _ Ļ.support_eq.subset hg, lsmul_apply, integral_smul_const]
variable [BorelSpace G] [FiniteDimensional ā G]
/-- If `Ļ` is a normed bump function, compute `Ļ ā g`
if `g` is constant on `Metric.ball xā Ļ.rOut`. -/
theorem normed_convolution_eq_right [IsLocallyFiniteMeasure μ] [μ.IsOpenPosMeasure] {xā : G}
(hg : ā x ā ball xā Ļ.rOut, g x = g xā) :
(Ļ.normed μ ā[lsmul ā ā, μ] g : G ā E') xā = g xā := by
rw [convolution_eq_right' _ Ļ.support_normed_eq.subset hg]
exact integral_normed_smul Ļ Ī¼ (g xā)
variable [μ.IsAddHaarMeasure]
/-- If `Ļ` is a normed bump function, approximate `(Ļ ā g) xā`
if `g` is near `g xā` on a ball with radius `Ļ.rOut` around `xā`. -/
theorem dist_normed_convolution_le {xā : G} {ε : ā} (hmg : AEStronglyMeasurable g μ)
(hg : ā x ā ball xā Ļ.rOut, dist (g x) (g xā) ⤠ε) :
dist ((Ļ.normed μ ā[lsmul ā ā, μ] g : G ā E') xā) (g xā) ⤠ε :=
dist_convolution_le (by simp_rw [ā dist_self (g xā), hg xā (mem_ball_self Ļ.rOut_pos)])
Ļ.support_normed_eq.subset Ļ.nonneg_normed Ļ.integral_normed hmg hg
/-- `(Ļ i ā g i) (k i)` tends to `zā` as `i` tends to some filter `l` if
* `Ļ` is a sequence of normed bump functions
such that `(Ļ i).rOut` tends to `0` as `i` tends to `l`;
* `g i` is `μ`-a.e. strongly measurable as `i` tends to `l`;
* `g i x` tends to `zā` as `(i, x)` tends to `l ĆĖ¢ š xā`;
* `k i` tends to `xā`. -/
nonrec theorem convolution_tendsto_right {ι} {Ļ : ι ā ContDiffBump (0 : G)} {g : ι ā G ā E'}
{k : ι ā G} {xā : G} {zā : E'} {l : Filter ι} (hĻ : Tendsto (fun i => (Ļ i).rOut) l (š 0))
(hig : āį¶ i in l, AEStronglyMeasurable (g i) μ) (hcg : Tendsto (uncurry g) (l ĆĖ¢ š xā) (š zā))
(hk : Tendsto k l (š xā)) :
Tendsto (fun i => ((Ļ i).normed μ ā[lsmul ā ā, μ] g i) (k i)) l (š zā) :=
convolution_tendsto_right (Eventually.of_forall fun i => (Ļ i).nonneg_normed)
(Eventually.of_forall fun i => (Ļ i).integral_normed) (tendsto_support_normed_smallSets hĻ) hig
hcg hk
/-- Special case of `ContDiffBump.convolution_tendsto_right` where `g` is continuous,
and the limit is taken only in the first function. -/
theorem convolution_tendsto_right_of_continuous {ι} {Ļ : ι ā ContDiffBump (0 : G)} {l : Filter ι}
(hĻ : Tendsto (fun i => (Ļ i).rOut) l (š 0)) (hg : Continuous g) (xā : G) :
Tendsto (fun i => ((Ļ i).normed μ ā[lsmul ā ā, μ] g) xā) l (š (g xā)) :=
convolution_tendsto_right hĻ (Eventually.of_forall fun _ => hg.aestronglyMeasurable)
((hg.tendsto xā).comp tendsto_snd) tendsto_const_nhds
/-- If a function `g` is locally integrable, then the convolution `Ļ i * g` converges almost
everywhere to `g` if `Ļ i` is a sequence of bump functions with support tending to `0`, provided
that the ratio between the inner and outer radii of `Ļ i` remains bounded. -/
theorem ae_convolution_tendsto_right_of_locallyIntegrable
{ι} {Ļ : ι ā ContDiffBump (0 : G)} {l : Filter ι} {K : ā}
(hĻ : Tendsto (fun i ⦠(Ļ i).rOut) l (š 0))
(h'Ļ : āį¶ i in l, (Ļ i).rOut ⤠K * (Ļ i).rIn) (hg : LocallyIntegrable g μ) : āįµ xā āμ,
Tendsto (fun i ⦠((Ļ i).normed μ ā[lsmul ā ā, μ] g) xā) l (š (g xā)) := by
-- By Lebesgue differentiation theorem, the average of `g` on a small ball converges
-- almost everywhere to the value of `g` as the radius shrinks to zero.
-- We will see that this set of points satisfies the desired conclusion.
filter_upwards [(Besicovitch.vitaliFamily μ).ae_tendsto_average_norm_sub hg] with xā hā
simp only [convolution_eq_swap, lsmul_apply]
have hĻ' : Tendsto (fun i ⦠(Ļ i).rOut) l (š[>] 0) :=
tendsto_nhdsWithin_iff.2 āØhĻ, Eventually.of_forall (fun i ⦠(Ļ i).rOut_pos)ā©
have := (hā.comp (Besicovitch.tendsto_filterAt μ xā)).comp hĻ'
simp only at this
apply tendsto_integral_smul_of_tendsto_average_norm_sub (K ^ (Module.finrank ā G)) this
Ā· filter_upwards with i using
hg.integrableOn_isCompact (isCompact_closedBall _ _)
· apply tendsto_const_nhds.congr (fun i ⦠?_)
rw [ā integral_neg_eq_self]
simp only [sub_neg_eq_add, integral_add_left_eq_self, integral_normed]
Ā· filter_upwards with i
change support ((ContDiffBump.normed (Ļ i) μ) ā (fun y ⦠xā - y)) ā closedBall xā (Ļ i).rOut
simp only [support_comp_eq_preimage, support_normed_eq]
intro x hx
simp only [mem_preimage, mem_ball, dist_zero_right] at hx
simpa [dist_eq_norm_sub'] using hx.le
Ā· filter_upwards [h'Ļ] with i hi x
rw [abs_of_nonneg (nonneg_normed _ _), addHaar_real_closedBall_center]
exact (Ļ i).normed_le_div_measure_closedBall_rOut _ _ hi _
end ContDiffBump |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/BumpFunction/Basic.lean | import Mathlib.Analysis.Calculus.ContDiff.Operations
import Mathlib.Analysis.Normed.Module.FiniteDimension
/-!
# Infinitely smooth "bump" functions
A smooth bump function is an infinitely smooth function `f : E ā ā` supported on a ball
that is equal to `1` on a ball of smaller radius.
These functions have many uses in real analysis. E.g.,
- they can be used to construct a smooth partition of unity which is a very useful tool;
- they can be used to approximate a continuous function by infinitely smooth functions.
There are two classes of spaces where bump functions are guaranteed to exist:
inner product spaces and finite-dimensional spaces.
In this file we define a typeclass `HasContDiffBump`
saying that a normed space has a family of smooth bump functions with certain properties.
We also define a structure `ContDiffBump` that holds the center and radii of the balls from above.
An element `f : ContDiffBump c` can be coerced to a function which is an infinitely smooth function
such that
- `f` is equal to `1` in `Metric.closedBall c f.rIn`;
- `support f = Metric.ball c f.rOut`;
- `0 ⤠f x ⤠1` for all `x`.
## Main Definitions
- `ContDiffBump (c : E)`: a structure holding data needed to construct
an infinitely smooth bump function.
- `ContDiffBumpBase (E : Type*)`: a family of infinitely smooth bump functions
that can be used to construct coercion of a `ContDiffBump (c : E)`
to a function.
- `HasContDiffBump (E : Type*)`: a typeclass saying that `E` has a `ContDiffBumpBase`.
Two instances of this typeclass (for inner product spaces and for finite-dimensional spaces)
are provided elsewhere.
## Keywords
smooth function, smooth bump function
-/
noncomputable section
open Function Set Filter
open scoped Topology Filter ContDiff
variable {E X : Type*}
/-- `f : ContDiffBump c`, where `c` is a point in a normed vector space, is a
bundled smooth function such that
- `f` is equal to `1` in `Metric.closedBall c f.rIn`;
- `support f = Metric.ball c f.rOut`;
- `0 ⤠f x ⤠1` for all `x`.
The structure `ContDiffBump` contains the data required to construct the function:
real numbers `rIn`, `rOut`, and proofs of `0 < rIn < rOut`. The function itself is available through
`CoeFun` when the space is nice enough, i.e., satisfies the `HasContDiffBump` typeclass. -/
structure ContDiffBump (c : E) where
/-- real numbers `0 < rIn < rOut` -/
(rIn rOut : ā)
rIn_pos : 0 < rIn
rIn_lt_rOut : rIn < rOut
/-- The base function from which one will construct a family of bump functions. One could
add more properties if they are useful and satisfied in the examples of inner product spaces
and finite-dimensional vector spaces, notably derivative norm control in terms of `R - 1`.
TODO: do we ever need `f x = 1 ā āxā ⤠1`? -/
structure ContDiffBumpBase (E : Type*) [NormedAddCommGroup E] [NormedSpace ā E] where
/-- The function underlying this family of bump functions -/
toFun : ā ā E ā ā
mem_Icc : ā (R : ā) (x : E), toFun R x ā Icc (0 : ā) 1
symmetric : ā (R : ā) (x : E), toFun R (-x) = toFun R x
smooth : ContDiffOn ā ā (uncurry toFun) (Ioi (1 : ā) ĆĖ¢ (univ : Set E))
eq_one : ā R : ā, 1 < R ā ā x : E, āxā ⤠1 ā toFun R x = 1
support : ā R : ā, 1 < R ā Function.support (toFun R) = Metric.ball (0 : E) R
/-- A class registering that a real vector space admits bump functions. This will be instantiated
first for inner product spaces, and then for finite-dimensional normed spaces.
We use a specific class instead of `Nonempty (ContDiffBumpBase E)` for performance reasons. -/
class HasContDiffBump (E : Type*) [NormedAddCommGroup E] [NormedSpace ā E] : Prop where
out : Nonempty (ContDiffBumpBase E)
/-- In a space with `C^ā` bump functions, register some function that will be used as a basis
to construct bump functions of arbitrary size around any point. -/
def someContDiffBumpBase (E : Type*) [NormedAddCommGroup E] [NormedSpace ā E]
[hb : HasContDiffBump E] : ContDiffBumpBase E :=
Nonempty.some hb.out
namespace ContDiffBump
theorem rOut_pos {c : E} (f : ContDiffBump c) : 0 < f.rOut :=
f.rIn_pos.trans f.rIn_lt_rOut
theorem one_lt_rOut_div_rIn {c : E} (f : ContDiffBump c) : 1 < f.rOut / f.rIn := by
rw [one_lt_div f.rIn_pos]
exact f.rIn_lt_rOut
instance (c : E) : Inhabited (ContDiffBump c) :=
āØāØ1, 2, zero_lt_one, one_lt_twoā©ā©
variable [NormedAddCommGroup E] [NormedSpace ā E] [NormedAddCommGroup X] [NormedSpace ā X]
[HasContDiffBump E] {c : E} (f : ContDiffBump c) {x : E} {n : āā}
/-- The function defined by `f : ContDiffBump c`. Use automatic coercion to
function instead. -/
@[coe] def toFun {c : E} (f : ContDiffBump c) : E ā ā :=
(someContDiffBumpBase E).toFun (f.rOut / f.rIn) ā fun x ⦠(f.rInā»Ā¹ ⢠(x - c))
instance : CoeFun (ContDiffBump c) fun _ => E ā ā :=
āØtoFunā©
protected theorem apply (x : E) :
f x = (someContDiffBumpBase E).toFun (f.rOut / f.rIn) (f.rInā»Ā¹ ⢠(x - c)) :=
rfl
protected theorem sub (x : E) : f (c - x) = f (c + x) := by
simp [f.apply, ContDiffBumpBase.symmetric]
protected theorem neg (f : ContDiffBump (0 : E)) (x : E) : f (-x) = f x := by
simp_rw [ā zero_sub, f.sub, zero_add]
open Metric
theorem one_of_mem_closedBall (hx : x ā closedBall c f.rIn) : f x = 1 := by
apply ContDiffBumpBase.eq_one _ _ f.one_lt_rOut_div_rIn
simpa only [norm_smul, Real.norm_eq_abs, abs_inv, abs_of_nonneg f.rIn_pos.le, ā div_eq_inv_mul,
div_le_one f.rIn_pos] using mem_closedBall_iff_norm.1 hx
theorem nonneg : 0 ⤠f x :=
(ContDiffBumpBase.mem_Icc (someContDiffBumpBase E) _ _).1
/-- A version of `ContDiffBump.nonneg` with `x` explicit -/
theorem nonneg' (x : E) : 0 ⤠f x := f.nonneg
theorem le_one : f x ⤠1 :=
(ContDiffBumpBase.mem_Icc (someContDiffBumpBase E) _ _).2
theorem support_eq : Function.support f = Metric.ball c f.rOut := by
simp only [toFun, support_comp_eq_preimage, ContDiffBumpBase.support _ _ f.one_lt_rOut_div_rIn]
ext x
simp only [mem_ball_iff_norm, sub_zero, norm_smul, mem_preimage, Real.norm_eq_abs, abs_inv,
abs_of_pos f.rIn_pos, ā div_eq_inv_mul, div_lt_div_iff_of_pos_right f.rIn_pos]
theorem tsupport_eq : tsupport f = closedBall c f.rOut := by
simp_rw [tsupport, f.support_eq, closure_ball _ f.rOut_pos.ne']
theorem pos_of_mem_ball (hx : x ā ball c f.rOut) : 0 < f x :=
f.nonneg.lt_of_ne' <| by rwa [ā support_eq, mem_support] at hx
theorem zero_of_le_dist (hx : f.rOut ⤠dist x c) : f x = 0 := by
rwa [ā notMem_support, support_eq, mem_ball, not_lt]
protected theorem hasCompactSupport [FiniteDimensional ā E] : HasCompactSupport f := by
simp_rw [HasCompactSupport, f.tsupport_eq, isCompact_closedBall]
theorem eventuallyEq_one_of_mem_ball (h : x ā ball c f.rIn) : f =į¶ [š x] 1 :=
mem_of_superset (closedBall_mem_nhds_of_mem h) fun _ ⦠f.one_of_mem_closedBall
theorem eventuallyEq_one : f =į¶ [š c] 1 :=
f.eventuallyEq_one_of_mem_ball (mem_ball_self f.rIn_pos)
/-- `ContDiffBump` is `šāæ` in all its arguments. -/
protected theorem _root_.ContDiffWithinAt.contDiffBump {c g : X ā E} {s : Set X}
{f : ā x, ContDiffBump (c x)} {x : X} (hc : ContDiffWithinAt ā n c s x)
(hr : ContDiffWithinAt ā n (fun x => (f x).rIn) s x)
(hR : ContDiffWithinAt ā n (fun x => (f x).rOut) s x)
(hg : ContDiffWithinAt ā n g s x) :
ContDiffWithinAt ā n (fun x => f x (g x)) s x := by
change ContDiffWithinAt ā n (uncurry (someContDiffBumpBase E).toFun ā fun x : X =>
((f x).rOut / (f x).rIn, (f x).rInā»Ā¹ ⢠(g x - c x))) s x
refine (((someContDiffBumpBase E).smooth.contDiffAt ?_).of_le
(mod_cast le_top)).comp_contDiffWithinAt x ?_
Ā· exact prod_mem_nhds (Ioi_mem_nhds (f x).one_lt_rOut_div_rIn) univ_mem
Ā· exact (hR.div hr (f x).rIn_pos.ne').prodMk ((hr.inv (f x).rIn_pos.ne').smul (hg.sub hc))
/-- `ContDiffBump` is `šāæ` in all its arguments. -/
protected nonrec theorem _root_.ContDiffAt.contDiffBump {c g : X ā E} {f : ā x, ContDiffBump (c x)}
{x : X} (hc : ContDiffAt ā n c x) (hr : ContDiffAt ā n (fun x => (f x).rIn) x)
(hR : ContDiffAt ā n (fun x => (f x).rOut) x) (hg : ContDiffAt ā n g x) :
ContDiffAt ā n (fun x => f x (g x)) x :=
hc.contDiffBump hr hR hg
theorem _root_.ContDiff.contDiffBump {c g : X ā E} {f : ā x, ContDiffBump (c x)}
(hc : ContDiff ā n c) (hr : ContDiff ā n fun x => (f x).rIn)
(hR : ContDiff ā n fun x => (f x).rOut) (hg : ContDiff ā n g) :
ContDiff ā n fun x => f x (g x) := by
rw [contDiff_iff_contDiffAt] at *
exact fun x => (hc x).contDiffBump (hr x) (hR x) (hg x)
protected theorem contDiff : ContDiff ā n f :=
contDiff_const.contDiffBump contDiff_const contDiff_const contDiff_id
protected theorem contDiffAt : ContDiffAt ā n f x :=
f.contDiff.contDiffAt
protected theorem contDiffWithinAt {s : Set E} : ContDiffWithinAt ā n f s x :=
f.contDiffAt.contDiffWithinAt
protected theorem continuous : Continuous f :=
contDiff_zero.mp f.contDiff
end ContDiffBump |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/BumpFunction/FiniteDimension.lean | import Mathlib.Analysis.Calculus.SmoothSeries
import Mathlib.Analysis.Calculus.BumpFunction.InnerProduct
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.InnerProductSpace.EuclideanDist
import Mathlib.Data.Set.Pointwise.Support
import Mathlib.MeasureTheory.Measure.Haar.NormedSpace
import Mathlib.MeasureTheory.Measure.Haar.Unique
/-!
# Bump functions in finite-dimensional vector spaces
Let `E` be a finite-dimensional real normed vector space. We show that any open set `s` in `E` is
exactly the support of a smooth function taking values in `[0, 1]`,
in `IsOpen.exists_smooth_support_eq`.
Then we use this construction to construct bump functions with nice behavior, by convolving
the indicator function of `closedBall 0 1` with a function as above with `s = ball 0 D`.
-/
noncomputable section
open Set Metric TopologicalSpace Function Asymptotics MeasureTheory Module
ContinuousLinearMap Filter MeasureTheory.Measure Bornology
open scoped Pointwise Topology NNReal Convolution ContDiff
variable {E : Type*} [NormedAddCommGroup E]
section
variable [NormedSpace ā E] [FiniteDimensional ā E]
/-- If a set `s` is a neighborhood of `x`, then there exists a smooth function `f` taking
values in `[0, 1]`, supported in `s` and with `f x = 1`. -/
theorem exists_smooth_tsupport_subset {s : Set E} {x : E} (hs : s ā š x) :
ā f : E ā ā,
tsupport f ā s ā§ HasCompactSupport f ā§ ContDiff ā ā f ā§ range f ā Icc 0 1 ā§ f x = 1 := by
obtain āØd : ā, d_pos : 0 < d, hd : Euclidean.closedBall x d ā sā© :=
Euclidean.nhds_basis_closedBall.mem_iff.1 hs
let c : ContDiffBump (toEuclidean x) :=
{ rIn := d / 2
rOut := d
rIn_pos := half_pos d_pos
rIn_lt_rOut := half_lt_self d_pos }
let f : E ā ā := c ā toEuclidean
have f_supp : f.support ā Euclidean.ball x d := by
intro y hy
have : toEuclidean y ā Function.support c := by
simpa only [Function.mem_support, Function.comp_apply, Ne] using hy
rwa [c.support_eq] at this
have f_tsupp : tsupport f ā Euclidean.closedBall x d := by
rw [tsupport, ā Euclidean.closure_ball _ d_pos.ne']
exact closure_mono f_supp
refine āØf, f_tsupp.trans hd, ?_, ?_, ?_, ?_ā©
Ā· refine isCompact_of_isClosed_isBounded isClosed_closure ?_
have : IsBounded (Euclidean.closedBall x d) := Euclidean.isCompact_closedBall.isBounded
refine this.subset (Euclidean.isClosed_closedBall.closure_subset_iff.2 ?_)
exact f_supp.trans Euclidean.ball_subset_closedBall
Ā· apply c.contDiff.comp
exact ContinuousLinearEquiv.contDiff _
Ā· rintro t āØy, rflā©
exact āØc.nonneg, c.le_oneā©
Ā· apply c.one_of_mem_closedBall
apply mem_closedBall_self
exact (half_pos d_pos).le
/-- Given an open set `s` in a finite-dimensional real normed vector space, there exists a smooth
function with values in `[0, 1]` whose support is exactly `s`. -/
theorem IsOpen.exists_smooth_support_eq {s : Set E} (hs : IsOpen s) :
ā f : E ā ā, f.support = s ā§ ContDiff ā ā f ā§ Set.range f ā Set.Icc 0 1 := by
/- For any given point `x` in `s`, one can construct a smooth function with support in `s` and
nonzero at `x`. By second-countability, it follows that we may cover `s` with the supports of
countably many such functions, say `g i`.
Then `ā i, r i ⢠g i` will be the desired function if `r i` is a sequence of positive numbers
tending quickly enough to zero. Indeed, this ensures that, for any `k ⤠i`, the `k`-th
derivative of `r i ⢠g i` is bounded by a prescribed (summable) sequence `u i`. From this, the
summability of the series and of its successive derivatives follows. -/
rcases eq_empty_or_nonempty s with (rfl | h's)
Ā· exact
āØfun _ => 0, Function.support_zero, contDiff_const, by
simp only [range_const, singleton_subset_iff, left_mem_Icc, zero_le_one]ā©
let ι := { f : E ā ā // f.support ā s ā§ HasCompactSupport f ā§ ContDiff ā ā f ā§ range f ā Icc 0 1 }
obtain āØT, T_count, hTā© : ā T : Set ι, T.Countable ā§ ā f ā T, support (f : E ā ā) = s := by
have : ā f : ι, (f : E ā ā).support = s := by
refine Subset.antisymm (iUnion_subset fun f => f.2.1) ?_
intro x hx
rcases exists_smooth_tsupport_subset (hs.mem_nhds hx) with āØf, hfā©
let g : ι := āØf, (subset_tsupport f).trans hf.1, hf.2.1, hf.2.2.1, hf.2.2.2.1ā©
have : x ā support (g : E ā ā) := by
simp only [g, hf.2.2.2.2, mem_support, Ne, one_ne_zero, not_false_iff]
exact mem_iUnion_of_mem _ this
simp_rw [ā this]
apply isOpen_iUnion_countable
rintro āØf, hfā©
exact hf.2.2.1.continuous.isOpen_support
obtain āØg0, hgā© : ā g0 : ā ā ι, T = range g0 := by
apply Countable.exists_eq_range T_count
rcases eq_empty_or_nonempty T with (rfl | hT)
Ā· simp only [ā hT, mem_empty_iff_false, iUnion_of_empty, iUnion_empty, Set.not_nonempty_empty]
at h's
Ā· exact hT
let g : ā ā E ā ā := fun n => (g0 n).1
have g_s : ā n, support (g n) ā s := fun n => (g0 n).2.1
have s_g : ā x ā s, ā n, x ā support (g n) := fun x hx ⦠by
rw [ā hT] at hx
obtain āØi, iT, hiā© : ā i ā T, x ā support (i : E ā ā) := by
simpa only [mem_iUnion, exists_prop] using hx
grind
have g_smooth : ā n, ContDiff ā ā (g n) := fun n => (g0 n).2.2.2.1
have g_comp_supp : ā n, HasCompactSupport (g n) := fun n => (g0 n).2.2.1
have g_nonneg : ā n x, 0 ⤠g n x := fun n x => ((g0 n).2.2.2.2 (mem_range_self x)).1
obtain āØĪ“, Ī“pos, c, Ī“c, c_ltā© :
ā Ī“ : ā ā āā„0, (ā i : ā, 0 < Ī“ i) ā§ ā c : NNReal, HasSum Ī“ c ā§ c < 1 :=
NNReal.exists_pos_sum_of_countable one_ne_zero ā
have : ā n : ā, ā r : ā, 0 < r ā§ ā i ⤠n, ā x, āiteratedFDeriv ā i (r ⢠g n) xā ⤠Γ n := by
intro n
have : ā i, ā R, ā x, āiteratedFDeriv ā i (fun x => g n x) xā ⤠R := by
intro i
have : BddAbove (range fun x => āiteratedFDeriv ā i (fun x : E => g n x) xā) := by
apply ((g_smooth n).continuous_iteratedFDeriv
(mod_cast le_top)).norm.bddAbove_range_of_hasCompactSupport
apply HasCompactSupport.comp_left _ norm_zero
apply (g_comp_supp n).iteratedFDeriv
rcases this with āØR, hRā©
exact āØR, fun x => hR (mem_range_self _)ā©
choose R hR using this
let M := max (((Finset.range (n + 1)).image R).max' (by simp)) 1
have Γnpos : 0 < Γ n := Γpos n
have IR : ā i ⤠n, R i ⤠M := by
intro i hi
refine le_trans ?_ (le_max_left _ _)
apply Finset.le_max'
apply Finset.mem_image_of_mem
simp only [Finset.mem_range]
omega
refine āØMā»Ā¹ * Ī“ n, by positivity, fun i hi x => ?_ā©
calc
āiteratedFDeriv ā i ((Mā»Ā¹ * Ī“ n) ⢠g n) xā = ā(Mā»Ā¹ * Ī“ n) ⢠iteratedFDeriv ā i (g n) xā := by
rw [iteratedFDeriv_const_smul_apply]
exact (g_smooth n).contDiffAt.of_le (mod_cast le_top)
_ = Mā»Ā¹ * Ī“ n * āiteratedFDeriv ā i (g n) xā := by
rw [norm_smul _ (iteratedFDeriv ā i (g n) x), Real.norm_of_nonneg]; positivity
_ ⤠Mā»Ā¹ * Ī“ n * M := by gcongr; exact (hR i x).trans (IR i hi)
_ = Ī“ n := by simp [field]
choose r rpos hr using this
have S : ā x, Summable fun n => (r n ⢠g n) x := fun x ⦠by
refine .of_nnnorm_bounded Γc.summable fun n => ?_
rw [ā NNReal.coe_le_coe, coe_nnnorm]
simpa only [norm_iteratedFDeriv_zero] using hr n 0 (zero_le n) x
refine āØfun x => ā' n, (r n ⢠g n) x, ?_, ?_, ?_ā©
Ā· apply Subset.antisymm
Ā· intro x hx
simp only [Pi.smul_apply, Algebra.id.smul_eq_mul, mem_support, Ne] at hx
contrapose! hx
have : ā n, g n x = 0 := by
intro n
contrapose! hx
exact g_s n hx
simp only [this, mul_zero, tsum_zero]
Ā· intro x hx
obtain āØn, hnā© : ā n, x ā support (g n) := s_g x hx
have I : 0 < r n * g n x := mul_pos (rpos n) (lt_of_le_of_ne (g_nonneg n x) (Ne.symm hn))
exact ne_of_gt ((S x).tsum_pos (fun i => mul_nonneg (rpos i).le (g_nonneg i x)) n I)
Ā· refine
contDiff_tsum_of_eventually (fun n => (g_smooth n).const_smul (r n))
(fun k _ => (NNReal.hasSum_coe.2 Γc).summable) ?_
intro i _
simp only [Nat.cofinite_eq_atTop, Filter.eventually_atTop]
exact āØi, fun n hn x => hr _ _ hn _ā©
Ā· rintro - āØy, rflā©
refine āØtsum_nonneg fun n => mul_nonneg (rpos n).le (g_nonneg n y), le_trans ?_ c_lt.leā©
have A : HasSum (fun n => (Ī“ n : ā)) c := NNReal.hasSum_coe.2 Ī“c
simp only [Pi.smul_apply, smul_eq_mul, NNReal.val_eq_coe, ā A.tsum_eq]
apply Summable.tsum_le_tsum _ (S y) A.summable
intro n
apply (le_abs_self _).trans
simpa only [norm_iteratedFDeriv_zero] using hr n 0 (zero_le n) y
end
section
namespace ExistsContDiffBumpBase
/-- An auxiliary function to construct partitions of unity on finite-dimensional real vector spaces.
It is the characteristic function of the closed unit ball. -/
def Ļ : E ā ā :=
(closedBall (0 : E) 1).indicator fun _ => (1 : ā)
variable [NormedSpace ā E] [FiniteDimensional ā E]
section HelperDefinitions
variable (E)
theorem u_exists :
ā u : E ā ā,
ContDiff ā ā u ā§ (ā x, u x ā Icc (0 : ā) 1) ā§ support u = ball 0 1 ā§ ā x, u (-x) = u x := by
have A : IsOpen (ball (0 : E) 1) := isOpen_ball
obtain āØf, f_support, f_smooth, f_rangeā© :
ā f : E ā ā, f.support = ball (0 : E) 1 ā§ ContDiff ā ā f ā§ Set.range f ā Set.Icc 0 1 :=
A.exists_smooth_support_eq
have B : ā x, f x ā Icc (0 : ā) 1 := fun x => f_range (mem_range_self x)
refine āØfun x => (f x + f (-x)) / 2, ?_, ?_, ?_, ?_ā©
Ā· exact (f_smooth.add (f_smooth.comp contDiff_neg)).div_const _
Ā· intro x
simp only [mem_Icc]
constructor
Ā· linarith [(B x).1, (B (-x)).1]
Ā· linarith [(B x).2, (B (-x)).2]
Ā· refine support_eq_iff.2 āØfun x hx => ?_, fun x hx => ?_ā©
Ā· apply ne_of_gt
have : 0 < f x := by
apply lt_of_le_of_ne (B x).1 (Ne.symm _)
rwa [ā f_support] at hx
linarith [(B (-x)).1]
Ā· have I1 : x ā support f := by rwa [f_support]
have I2 : -x ā support f := by
rw [f_support]
simpa using hx
simp only [mem_support, Classical.not_not] at I1 I2
simp only [I1, I2, add_zero, zero_div]
Ā· intro x; simp only [add_comm, neg_neg]
variable {E} in
/-- An auxiliary function to construct partitions of unity on finite-dimensional real vector spaces,
which is smooth, symmetric, and with support equal to the unit ball. -/
def u (x : E) : ā :=
Classical.choose (u_exists E) x
theorem u_smooth : ContDiff ā ā (u : E ā ā) :=
(Classical.choose_spec (u_exists E)).1
theorem u_continuous : Continuous (u : E ā ā) :=
(u_smooth E).continuous
theorem u_support : support (u : E ā ā) = ball 0 1 :=
(Classical.choose_spec (u_exists E)).2.2.1
theorem u_compact_support : HasCompactSupport (u : E ā ā) := by
rw [hasCompactSupport_def, u_support, closure_ball (0 : E) one_ne_zero]
exact isCompact_closedBall _ _
variable {E}
theorem u_nonneg (x : E) : 0 ⤠u x :=
((Classical.choose_spec (u_exists E)).2.1 x).1
theorem u_le_one (x : E) : u x ⤠1 :=
((Classical.choose_spec (u_exists E)).2.1 x).2
theorem u_neg (x : E) : u (-x) = u x :=
(Classical.choose_spec (u_exists E)).2.2.2 x
variable [MeasurableSpace E] [BorelSpace E]
local notation "μ" => MeasureTheory.Measure.addHaar
variable (E) in
theorem u_int_pos : 0 < ā« x : E, u x āμ := by
refine (integral_pos_iff_support_of_nonneg u_nonneg ?_).mpr ?_
Ā· exact (u_continuous E).integrable_of_hasCompactSupport (u_compact_support E)
Ā· rw [u_support]; exact measure_ball_pos _ _ zero_lt_one
/-- An auxiliary function to construct partitions of unity on finite-dimensional real vector spaces,
which is smooth, symmetric, with support equal to the ball of radius `D` and integral `1`. -/
def w (D : ā) (x : E) : ā :=
((ā« x : E, u x āμ) * |D| ^ finrank ā E)ā»Ā¹ ⢠u (Dā»Ā¹ ⢠x)
theorem w_def (D : ā) :
(w D : E ā ā) = fun x => ((ā« x : E, u x āμ) * |D| ^ finrank ā E)ā»Ā¹ ⢠u (Dā»Ā¹ ⢠x) := by
ext1 x; rfl
theorem w_nonneg (D : ā) (x : E) : 0 ⤠w D x := by
apply mul_nonneg _ (u_nonneg _)
apply inv_nonneg.2
apply mul_nonneg (u_int_pos E).le
norm_cast
apply pow_nonneg (abs_nonneg D)
theorem w_mul_Ļ_nonneg (D : ā) (x y : E) : 0 ⤠w D y * Ļ (x - y) :=
mul_nonneg (w_nonneg D y) (indicator_nonneg (by simp only [zero_le_one, imp_true_iff]) _)
variable (E)
-- see https://github.com/leanprover-community/mathlib4/issues/29041
set_option linter.unusedSimpArgs false in
theorem w_integral {D : ā} (Dpos : 0 < D) : ā« x : E, w D x āμ = 1 := by
simp_rw [w, integral_smul]
rw [integral_comp_inv_smul_of_nonneg μ (u : E ā ā) Dpos.le, abs_of_nonneg Dpos.le, mul_comm]
simp [field, (u_int_pos E).ne']
theorem w_support {D : ā} (Dpos : 0 < D) : support (w D : E ā ā) = ball 0 D := by
have B : D ⢠ball (0 : E) 1 = ball 0 D := by
rw [smul_unitBall Dpos.ne', Real.norm_of_nonneg Dpos.le]
have C : D ^ finrank ā E ā 0 := by
norm_cast
exact pow_ne_zero _ Dpos.ne'
simp only [w_def, Algebra.id.smul_eq_mul, support_mul, support_inv, univ_inter,
support_comp_inv_smulā Dpos.ne', u_support, B, support_const (u_int_pos E).ne', support_const C,
abs_of_nonneg Dpos.le]
theorem w_compact_support {D : ā} (Dpos : 0 < D) : HasCompactSupport (w D : E ā ā) := by
rw [hasCompactSupport_def, w_support E Dpos, closure_ball (0 : E) Dpos.ne']
exact isCompact_closedBall _ _
variable {E}
/-- An auxiliary function to construct partitions of unity on finite-dimensional real vector spaces.
It is the convolution between a smooth function of integral `1` supported in the ball of radius `D`,
with the indicator function of the closed unit ball. Therefore, it is smooth, equal to `1` on the
ball of radius `1 - D`, with support equal to the ball of radius `1 + D`. -/
def y (D : ā) : E ā ā :=
w D ā[lsmul ā ā, μ] Ļ
theorem y_neg (D : ā) (x : E) : y D (-x) = y D x := by
apply convolution_neg_of_neg_eq
Ā· filter_upwards with x
simp only [w_def, mul_inv_rev, smul_neg, u_neg, smul_eq_mul]
Ā· filter_upwards with x
simp only [Ļ, indicator, mem_closedBall, dist_zero_right, norm_neg]
theorem y_eq_one_of_mem_closedBall {D : ā} {x : E} (Dpos : 0 < D)
(hx : x ā closedBall (0 : E) (1 - D)) : y D x = 1 := by
change (w D ā[lsmul ā ā, μ] Ļ) x = 1
have B : ā y : E, y ā ball x D ā Ļ y = 1 := by
have C : ball x D ā ball 0 1 := by
apply ball_subset_ball'
simp only [mem_closedBall] at hx
linarith only [hx]
intro y hy
simp only [Ļ, indicator, mem_closedBall, ite_eq_left_iff, not_le, zero_ne_one]
intro h'y
linarith only [mem_ball.1 (C hy), h'y]
have Bx : Ļ x = 1 := B _ (mem_ball_self Dpos)
have B' : ā y, y ā ball x D ā Ļ y = Ļ x := by rw [Bx]; exact B
rw [convolution_eq_right' _ (le_of_eq (w_support E Dpos)) B']
simp only [lsmul_apply, Algebra.id.smul_eq_mul, integral_mul_const, w_integral E Dpos, Bx,
one_mul]
theorem y_eq_zero_of_notMem_ball {D : ā} {x : E} (Dpos : 0 < D) (hx : x ā ball (0 : E) (1 + D)) :
y D x = 0 := by
change (w D ā[lsmul ā ā, μ] Ļ) x = 0
have B : ā y, y ā ball x D ā Ļ y = 0 := by
intro y hy
simp only [Ļ, indicator, mem_closedBall_zero_iff, ite_eq_right_iff, one_ne_zero]
intro h'y
have C : ball y D ā ball 0 (1 + D) := by
apply ball_subset_ball'
rw [ā dist_zero_right] at h'y
linarith only [h'y]
exact hx (C (mem_ball_comm.1 hy))
have Bx : Ļ x = 0 := B _ (mem_ball_self Dpos)
have B' : ā y, y ā ball x D ā Ļ y = Ļ x := by rw [Bx]; exact B
rw [convolution_eq_right' _ (le_of_eq (w_support E Dpos)) B']
simp only [lsmul_apply, Algebra.id.smul_eq_mul, Bx, mul_zero, integral_const]
@[deprecated (since := "2025-05-23")] alias y_eq_zero_of_not_mem_ball := y_eq_zero_of_notMem_ball
theorem y_nonneg (D : ā) (x : E) : 0 ⤠y D x :=
integral_nonneg (w_mul_Ļ_nonneg D x)
theorem y_le_one {D : ā} (x : E) (Dpos : 0 < D) : y D x ⤠1 := by
have A : (w D ā[lsmul ā ā, μ] Ļ) x ⤠(w D ā[lsmul ā ā, μ] 1) x := by
apply
convolution_mono_right_of_nonneg _ (w_nonneg D) (indicator_le_self' fun x _ => zero_le_one)
fun _ => zero_le_one
refine ((w_compact_support E Dpos).convolutionExists_left _ ?_
(locallyIntegrable_const (1 : ā)) x).integrable
exact continuous_const.mul ((u_continuous E).comp (continuous_id.const_smul _))
have B : (w D ā[lsmul ā ā, μ] fun _ => (1 : ā)) x = 1 := by
simp only [convolution, mul_one, lsmul_apply, Algebra.id.smul_eq_mul, w_integral E Dpos]
exact A.trans (le_of_eq B)
theorem y_pos_of_mem_ball {D : ā} {x : E} (Dpos : 0 < D) (D_lt_one : D < 1)
(hx : x ā ball (0 : E) (1 + D)) : 0 < y D x := by
simp only [mem_ball_zero_iff] at hx
refine (integral_pos_iff_support_of_nonneg (w_mul_Ļ_nonneg D x) ?_).2 ?_
Ā· have F_comp : HasCompactSupport (w D) := w_compact_support E Dpos
have B : LocallyIntegrable (Ļ : E ā ā) μ :=
(locallyIntegrable_const _).indicator measurableSet_closedBall
have C : Continuous (w D : E ā ā) :=
continuous_const.mul ((u_continuous E).comp (continuous_id.const_smul _))
exact (F_comp.convolutionExists_left (lsmul ā ā : ā āL[ā] ā āL[ā] ā) C B x).integrable
· set z := (D / (1 + D)) ⢠x with hz
have B : 0 < 1 + D := by linarith
have C : ball z (D * (1 + D - āxā) / (1 + D)) ā support fun y : E => w D y * Ļ (x - y) := by
intro y hy
simp only [support_mul, w_support E Dpos]
simp only [Ļ, mem_inter_iff, mem_support, Ne, indicator_apply_eq_zero,
mem_closedBall_zero_iff, one_ne_zero, not_forall, not_false_iff, exists_prop, and_true]
constructor
Ā· apply ball_subset_ball' _ hy
simp only [hz, norm_smul, abs_of_nonneg Dpos.le, abs_of_nonneg B.le, dist_zero_right,
Real.norm_eq_abs, abs_div]
field_simp
linarith only
Ā· have ID : āD / (1 + D) - 1ā = 1 / (1 + D) := by
rw [Real.norm_of_nonpos]
Ā· field
Ā· field_simp
linarith only
rw [ā mem_closedBall_iff_norm']
apply closedBall_subset_closedBall' _ (ball_subset_closedBall hy)
rw [ā one_smul ā x, dist_eq_norm, hz, ā sub_smul, one_smul, norm_smul, ID]
field_simp
nlinarith only [hx, D_lt_one]
apply lt_of_lt_of_le _ (measure_mono C)
apply measure_ball_pos
exact div_pos (mul_pos Dpos (by linarith only [hx])) B
variable (E)
theorem y_smooth : ContDiffOn ā ā (uncurry y) (Ioo (0 : ā) 1 ĆĖ¢ (univ : Set E)) := by
have hs : IsOpen (Ioo (0 : ā) (1 : ā)) := isOpen_Ioo
have hk : IsCompact (closedBall (0 : E) 1) := ProperSpace.isCompact_closedBall _ _
refine contDiffOn_convolution_left_with_param (lsmul ā ā) hs hk ?_ ?_ ?_
Ā· rintro p x hp hx
simp only [w, mul_inv_rev, Algebra.id.smul_eq_mul, mul_eq_zero, inv_eq_zero]
right
contrapose! hx
have : pā»Ā¹ ⢠x ā support u := mem_support.2 hx
simp only [u_support, norm_smul, mem_ball_zero_iff, Real.norm_eq_abs, abs_inv,
abs_of_nonneg hp.1.le, ā div_eq_inv_mul, div_lt_one hp.1] at this
rw [mem_closedBall_zero_iff]
exact this.le.trans hp.2.le
Ā· exact (locallyIntegrable_const _).indicator measurableSet_closedBall
Ā· apply ContDiffOn.mul
Ā· norm_cast
refine
(contDiffOn_const.mul ?_).inv fun x hx =>
ne_of_gt (mul_pos (u_int_pos E) (pow_pos (abs_pos_of_pos hx.1.1) (finrank ā E)))
apply ContDiffOn.pow
simp_rw [ā Real.norm_eq_abs]
apply ContDiffOn.norm ā
Ā· exact contDiffOn_fst
Ā· intro x hx; exact ne_of_gt hx.1.1
Ā· apply (u_smooth E).comp_contDiffOn
exact ContDiffOn.smul (contDiffOn_fst.inv fun x hx => ne_of_gt hx.1.1) contDiffOn_snd
theorem y_support {D : ā} (Dpos : 0 < D) (D_lt_one : D < 1) :
support (y D : E ā ā) = ball (0 : E) (1 + D) :=
support_eq_iff.2
āØfun _ hx => (y_pos_of_mem_ball Dpos D_lt_one hx).ne', fun _ hx =>
y_eq_zero_of_notMem_ball Dpos hxā©
variable {E}
end HelperDefinitions
instance (priority := 100) {E : Type*} [NormedAddCommGroup E] [NormedSpace ā E]
[FiniteDimensional ā E] : HasContDiffBump E := by
refine āØāØ?_ā©ā©
borelize E
have IR : ā R : ā, 1 < R ā 0 < (R - 1) / (R + 1) := by intro R hR; apply div_pos <;> linarith
exact
{ toFun := fun R x => if 1 < R then y ((R - 1) / (R + 1)) (((R + 1) / 2)ā»Ā¹ ⢠x) else 0
mem_Icc := fun R x => by
simp only [mem_Icc]
split_ifs with h
Ā· refine āØy_nonneg _ _, y_le_one _ (IR R h)ā©
Ā· simp only [le_refl, zero_le_one, and_self]
symmetric := fun R x => by
split_ifs
Ā· simp only [y_neg, smul_neg]
Ā· rfl
smooth := by
suffices
ContDiffOn ā ā
(uncurry y ā fun p : ā Ć E => ((p.1 - 1) / (p.1 + 1), ((p.1 + 1) / 2)ā»Ā¹ ⢠p.2))
(Ioi 1 ĆĖ¢ univ) by
apply this.congr
rintro āØR, xā© āØhR : 1 < R, _ā©
simp only [hR, uncurry_apply_pair, if_true, Function.comp_apply]
apply (y_smooth E).comp
Ā· apply ContDiffOn.prodMk
Ā· refine
(contDiffOn_fst.sub contDiffOn_const).div (contDiffOn_fst.add contDiffOn_const) ?_
rintro āØR, xā© āØhR : 1 < R, _ā©
apply ne_of_gt
dsimp only
linarith
Ā· apply ContDiffOn.smul _ contDiffOn_snd
refine ((contDiffOn_fst.add contDiffOn_const).div_const _).inv ?_
rintro āØR, xā© āØhR : 1 < R, _ā©
apply ne_of_gt
dsimp only
linarith
Ā· rintro āØR, xā© āØhR : 1 < R, _ā©
have A : 0 < (R - 1) / (R + 1) := by apply div_pos <;> linarith
have B : (R - 1) / (R + 1) < 1 := by apply (div_lt_one _).2 <;> linarith
simp only [prodMk_mem_set_prod_eq, mem_Ioo, mem_univ, and_true, A, B]
eq_one := fun R hR x hx => by
have A : 0 < R + 1 := by linarith
simp only [hR, if_true]
apply y_eq_one_of_mem_closedBall (IR R hR)
simp only [norm_smul, inv_div, mem_closedBall_zero_iff, Real.norm_eq_abs, abs_div, abs_two,
abs_of_nonneg A.le]
calc
2 / (R + 1) * āxā ⤠2 / (R + 1) := mul_le_of_le_one_right (by positivity) hx
_ = 1 - (R - 1) / (R + 1) := by field
support := fun R hR => by
have A : 0 < (R + 1) / 2 := by linarith
have C : (R - 1) / (R + 1) < 1 := by apply (div_lt_one _).2 <;> linarith
simp only [hR, if_true, support_comp_inv_smulā A.ne', y_support _ (IR R hR) C,
_root_.smul_ball A.ne', Real.norm_of_nonneg A.le, smul_zero]
refine congr (congr_arg ball (Eq.refl 0)) ?_
field }
end ExistsContDiffBumpBase
end |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/BumpFunction/InnerProduct.lean | import Mathlib.Analysis.Calculus.BumpFunction.Basic
import Mathlib.Analysis.InnerProductSpace.Calculus
import Mathlib.Analysis.SpecialFunctions.SmoothTransition
/-!
# Smooth bump functions in inner product spaces
In this file we prove that a real inner product space has smooth bump functions,
see `hasContDiffBump_of_innerProductSpace`.
## Keywords
smooth function, bump function, inner product space
-/
open Function Real
open scoped Topology
variable (E : Type*) [NormedAddCommGroup E] [InnerProductSpace ā E]
/-- A base bump function in an inner product space. This construction works in any space with a
norm smooth away from zero but we do not have a typeclass for this. -/
noncomputable def ContDiffBumpBase.ofInnerProductSpace : ContDiffBumpBase E where
toFun R x := smoothTransition ((R - āxā) / (R - 1))
mem_Icc _ _ := āØsmoothTransition.nonneg _, smoothTransition.le_one _ā©
symmetric _ _ := by simp only [norm_neg]
smooth := by
rintro āØR, xā© āØhR : 1 < R, -ā©
apply ContDiffAt.contDiffWithinAt
rw [ā sub_pos] at hR
rcases eq_or_ne x 0 with rfl | hx
Ā· have A : ContinuousAt (fun p : ā Ć E ⦠(p.1 - āp.2ā) / (p.1 - 1)) (R, 0) :=
(continuousAt_fst.sub continuousAt_snd.norm).div
(continuousAt_fst.sub continuousAt_const) hR.ne'
have B : āį¶ p in š (R, (0 : E)), 1 ⤠(p.1 - āp.2ā) / (p.1 - 1) :=
A.eventually <| le_mem_nhds <| (one_lt_div hR).2 <| sub_lt_sub_left (by simp) _
refine (contDiffAt_const (c := 1)).congr_of_eventuallyEq <| B.mono fun _ ā¦
smoothTransition.one_of_one_le
Ā· refine smoothTransition.contDiffAt.comp _ (ContDiffAt.div ?_ ?_ hR.ne')
Ā· exact contDiffAt_fst.sub (contDiffAt_snd.norm ā hx)
Ā· exact contDiffAt_fst.sub contDiffAt_const
eq_one _ hR _ hx := smoothTransition.one_of_one_le <| (one_le_div <| sub_pos.2 hR).2 <|
sub_le_sub_left hx _
support R hR := by
ext x
rw [mem_support, Ne, smoothTransition.zero_iff_nonpos, not_le, mem_ball_zero_iff]
simp [hR]
/-- Any inner product space has smooth bump functions. -/
instance (priority := 100) hasContDiffBump_of_innerProductSpace : HasContDiffBump E :=
āØāØ.ofInnerProductSpace Eā©ā© |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/BumpFunction/SmoothApprox.lean | import Mathlib.Analysis.Calculus.BumpFunction.Convolution
import Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension
/-!
# Density of smooth functions in the space of continuous functions
In this file we prove that smooth functions are dense in the set of continuous functions
from a real finite-dimensional vector space to a Banach space,
see `ContinuousMap.dense_setOf_contDiff`.
We also prove several unbundled versions of this statement.
The heavy part of the proof is done upstream in `ContDiffBump.dist_normed_convolution_le`
and `HasCompactSupport.contDiff_convolution_left`.
Here we wrap these results removing measure-related arguments from the assumptions.
-/
variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ā E] [FiniteDimensional ā E]
[NormedAddCommGroup F] [NormedSpace ā F] [CompleteSpace F] {f : E ā F} {ε : ā}
open scoped ContDiff unitInterval Topology
open Function Set Metric MeasureTheory
theorem MeasureTheory.LocallyIntegrable.exists_contDiff_dist_le_of_forall_mem_ball_dist_le
[MeasurableSpace E] [BorelSpace E] {μ : Measure E} [μ.IsAddHaarMeasure]
(hf : LocallyIntegrable f μ) (hε : 0 < ε) :
ā g : E ā F, ContDiff ā ā g ā§ ā a, ā Ī“, (ā x ā ball a ε, dist (f x) (f a) ⤠Γ) ā
dist (g a) (f a) ⤠Γ := by
set Ļ : ContDiffBump (0 : E) := āØĪµ / 2, ε, half_pos hε, half_lt_self hεā©
refine āØ_, ?_, fun a Ī“ ⦠Ļ.dist_normed_convolution_le hf.aestronglyMeasurableā©
exact Ļ.hasCompactSupport_normed.contDiff_convolution_left _ Ļ.contDiff_normed hf
theorem Continuous.exists_contDiff_dist_le_of_forall_mem_ball_dist_le (hf : Continuous f)
(hε : 0 < ε) :
ā g : E ā F, ContDiff ā ā g ā§ ā a, ā Ī“, (ā x ā ball a ε, dist (f x) (f a) ⤠Γ) ā
dist (g a) (f a) ⤠Γ := by
borelize E
exact (hf.locallyIntegrable (μ := .addHaar)).exists_contDiff_dist_le_of_forall_mem_ball_dist_le hε
theorem UniformContinuous.exists_contDiff_dist_le (hf : UniformContinuous f) (hε : 0 < ε) :
ā g : E ā F, ContDiff ā ā g ā§ ā a, dist (g a) (f a) < ε := by
rcases Metric.uniformContinuous_iff.mp hf (ε / 2) (half_pos hε) with āØĪ“, hĪ“, hfĪ“ā©
rcases hf.continuous.exists_contDiff_dist_le_of_forall_mem_ball_dist_le hĪ“ with āØg, hgc, hgā©
exact āØg, hgc, fun a ⦠(hg a _ fun _ h ⦠(hfĪ“ h).le).trans_lt (half_lt_self hε)ā©
/-- Infinitely smooth functions are dense in the space of continuous functions. -/
theorem ContinuousMap.dense_setOf_contDiff : Dense {f : C(E, F) | ContDiff ā ā f} := by
intro f
rw [mem_closure_iff_nhds_basis
(nhds_basis_uniformity uniformity_basis_dist.compactConvergenceUniformity)]
simp only [Prod.forall, mem_setOf_eq, and_imp]
intro K ε hK hε
have : UniformContinuousOn f (cthickening 1 K) :=
hK.cthickening.uniformContinuousOn_of_continuous <| by fun_prop
rcases Metric.uniformContinuousOn_iff.mp this (ε / 2) (half_pos hε) with āØĪ“, hĪ“, hfĪ“ā©
rcases (map_continuous f).exists_contDiff_dist_le_of_forall_mem_ball_dist_le
(lt_min one_pos hĪ“) with āØg, hgc, hgā©
refine āØāØg, hgc.continuousā©, hgc, fun x hx ⦠(hg _ _ fun y hy ⦠?_).trans_lt (half_lt_self hε)ā©
rw [mem_ball, lt_min_iff] at hy
exact hfΓ _ (mem_cthickening_of_dist_le _ x _ _ hx hy.1.le) _
(self_subset_cthickening _ hx) hy.2 |>.le |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/Deriv/Pow.lean | import Mathlib.Analysis.Calculus.FDeriv.Pow
/-!
# Derivative of `(f x) ^ n`, `n : ā`
In this file we prove that the FrƩchet derivative of `fun x => f x ^ n`,
where `n` is a natural number, is `n * f x ^ (n - 1) * f'`.
Additionally, we prove the case for non-commutative rings (with primed names like `deriv_pow'`),
where the result is instead `ā i ā Finset.range n, f x ^ (n.pred - i) * f' * f x ^ i`.
For a more detailed overview of one-dimensional derivatives in mathlib, see the module docstring of
`Mathlib/Analysis/Calculus/Deriv/Basic.lean`.
## Keywords
derivative, power
-/
variable {š šø : Type*}
section NormedRing
variable [NontriviallyNormedField š] [NormedRing šø]
variable [NormedAlgebra š šø] {f : š ā šø} {f' : šø} {x : š} {s : Set š}
nonrec theorem HasStrictDerivAt.fun_pow' (h : HasStrictDerivAt f f' x) (n : ā) :
HasStrictDerivAt (fun x ⦠f x ^ n)
(ā i ā Finset.range n, f x ^ (n.pred - i) * f' * f x ^ i) x := by
unfold HasStrictDerivAt
convert h.pow' n
ext
simp
nonrec theorem HasStrictDerivAt.pow' (h : HasStrictDerivAt f f' x) (n : ā) :
HasStrictDerivAt (f ^ n)
(ā i ā Finset.range n, f x ^ (n.pred - i) * f' * f x ^ i) x := h.fun_pow' n
nonrec theorem HasDerivWithinAt.fun_pow' (h : HasDerivWithinAt f f' s x) (n : ā) :
HasDerivWithinAt (fun x ⦠f x ^ n)
(ā i ā Finset.range n, f x ^ (n.pred - i) * f' * f x ^ i) s x := by
simpa using h.hasFDerivWithinAt.pow' n |>.hasDerivWithinAt
nonrec theorem HasDerivWithinAt.pow' (h : HasDerivWithinAt f f' s x) (n : ā) :
HasDerivWithinAt (f ^ n)
(ā i ā Finset.range n, f x ^ (n.pred - i) * f' * f x ^ i) s x := h.fun_pow' n
theorem HasDerivAt.fun_pow' (h : HasDerivAt f f' x) (n : ā) :
HasDerivAt (fun x ⦠f x ^ n)
(ā i ā Finset.range n, f x ^ (n.pred - i) * f' * f x ^ i) x := by
simpa using h.hasFDerivAt.pow' n |>.hasDerivAt
theorem HasDerivAt.pow' (h : HasDerivAt f f' x) (n : ā) :
HasDerivAt (f ^ n)
(ā i ā Finset.range n, f x ^ (n.pred - i) * f' * f x ^ i) x := h.fun_pow' n
@[simp low]
theorem derivWithin_fun_pow' (h : DifferentiableWithinAt š f s x) (n : ā) :
derivWithin (fun x => f x ^ n) s x =
ā i ā Finset.range n, f x ^ (n.pred - i) * derivWithin f s x * f x ^ i := by
by_cases hsx : UniqueDiffWithinAt š s x
Ā· exact (h.hasDerivWithinAt.pow' n).derivWithin hsx
Ā· simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]
@[simp low]
theorem derivWithin_pow' (h : DifferentiableWithinAt š f s x) (n : ā) :
derivWithin (f ^ n) s x =
ā i ā Finset.range n, f x ^ (n.pred - i) * derivWithin f s x * f x ^ i :=
derivWithin_fun_pow' h n
@[simp low]
theorem deriv_fun_pow' (h : DifferentiableAt š f x) (n : ā) :
deriv (fun x => f x ^ n) x = ā i ā Finset.range n, f x ^ (n.pred - i) * deriv f x * f x ^ i :=
(h.hasDerivAt.pow' n).deriv
@[simp low]
theorem deriv_pow' (h : DifferentiableAt š f x) (n : ā) :
deriv (f ^ n) x = ā i ā Finset.range n, f x ^ (n.pred - i) * deriv f x * f x ^ i :=
deriv_fun_pow' h n
end NormedRing
section NormedCommRing
variable [NontriviallyNormedField š] [NormedCommRing šø]
variable [NormedAlgebra š šø] {f : š ā šø} {f' : šø} {x : š} {s : Set š}
open scoped RightActions
nonrec theorem HasStrictDerivAt.fun_pow (h : HasStrictDerivAt f f' x) (n : ā) :
HasStrictDerivAt (fun x ⦠f x ^ n) (n * f x ^ (n - 1) * f') x := by
unfold HasStrictDerivAt
convert h.pow n
ext
simp [mul_assoc]
nonrec theorem HasStrictDerivAt.pow (h : HasStrictDerivAt f f' x) (n : ā) :
HasStrictDerivAt (f ^ n) (n * f x ^ (n - 1) * f') x := h.fun_pow n
nonrec theorem HasDerivWithinAt.fun_pow (h : HasDerivWithinAt f f' s x) (n : ā) :
HasDerivWithinAt (fun x ⦠f x ^ n) (n * f x ^ (n - 1) * f') s x := by
simpa using h.hasFDerivWithinAt.pow n |>.hasDerivWithinAt
nonrec theorem HasDerivWithinAt.pow (h : HasDerivWithinAt f f' s x) (n : ā) :
HasDerivWithinAt (f ^ n) (n * f x ^ (n - 1) * f') s x := h.fun_pow n
theorem HasDerivAt.fun_pow (h : HasDerivAt f f' x) (n : ā) :
HasDerivAt (fun x ⦠f x ^ n) (n * f x ^ (n - 1) * f') x := by
simpa using h.hasFDerivAt.pow n |>.hasDerivAt
theorem HasDerivAt.pow (h : HasDerivAt f f' x) (n : ā) :
HasDerivAt (f ^ n) (n * f x ^ (n - 1) * f') x := h.fun_pow n
@[simp]
theorem derivWithin_fun_pow (h : DifferentiableWithinAt š f s x) (n : ā) :
derivWithin (fun x => f x ^ n) s x = n * f x ^ (n - 1) * derivWithin f s x := by
by_cases hsx : UniqueDiffWithinAt š s x
Ā· exact (h.hasDerivWithinAt.pow n).derivWithin hsx
Ā· simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]
@[simp]
theorem derivWithin_pow (h : DifferentiableWithinAt š f s x) (n : ā) :
derivWithin (f ^ n) s x = n * f x ^ (n - 1) * derivWithin f s x :=
derivWithin_fun_pow h n
@[simp]
theorem deriv_fun_pow (h : DifferentiableAt š f x) (n : ā) :
deriv (fun x => f x ^ n) x = n * f x ^ (n - 1) * deriv f x :=
(h.hasDerivAt.pow n).deriv
@[simp]
theorem deriv_pow (h : DifferentiableAt š f x) (n : ā) :
deriv (f ^ n) x = n * f x ^ (n - 1) * deriv f x := deriv_fun_pow h n
end NormedCommRing
section NontriviallyNormedField
variable [NontriviallyNormedField š] {x : š} {s : Set š} {c : š ā š}
@[deprecated deriv_fun_pow (since := "2025-07-16")]
theorem deriv_fun_pow'' {c : š ā š} (n : ā) (hc : DifferentiableAt š c x) :
deriv (fun x => c x ^ n) x = (n : š) * c x ^ (n - 1) * deriv c x :=
deriv_fun_pow hc n
@[deprecated deriv_pow (since := "2025-07-16")]
theorem deriv_pow'' {c : š ā š} (n : ā) (hc : DifferentiableAt š c x) :
deriv (c ^ n) x = (n : š) * c x ^ (n - 1) * deriv c x :=
deriv_pow hc n
theorem hasStrictDerivAt_pow (n : ā) (x : š) :
HasStrictDerivAt (fun x : š ⦠x ^ n) (n * x ^ (n - 1)) x := by
simpa using (hasStrictDerivAt_id x).pow n
theorem hasDerivWithinAt_pow (n : ā) (x : š) :
HasDerivWithinAt (fun x : š ⦠x ^ n) (n * x ^ (n - 1)) s x := by
simpa using (hasDerivWithinAt_id x s).pow n
theorem hasDerivAt_pow (n : ā) (x : š) :
HasDerivAt (fun x : š => x ^ n) ((n : š) * x ^ (n - 1)) x := by
simpa using (hasStrictDerivAt_pow n x).hasDerivAt
theorem derivWithin_pow_field (h : UniqueDiffWithinAt š s x) (n : ā) :
derivWithin (fun x => x ^ n) s x = (n : š) * x ^ (n - 1) := by
rw [derivWithin_fun_pow (differentiableWithinAt_id' (s := s)) n, derivWithin_id' _ _ h, mul_one]
theorem deriv_pow_field (n : ā) : deriv (fun x => x ^ n) x = (n : š) * x ^ (n - 1) := by
simp
end NontriviallyNormedField |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/Deriv/Inverse.lean | import Mathlib.Analysis.Calculus.Deriv.Comp
import Mathlib.Analysis.Calculus.FDeriv.Equiv
/-!
# Inverse function theorem - the easy half
In this file we prove that `g' (f x) = (f' x)ā»Ā¹` provided that `f` is strictly differentiable at
`x`, `f' x ā 0`, and `g` is a local left inverse of `f` that is continuous at `f x`. This is the
easy half of the inverse function theorem: the harder half states that `g` exists.
For a more detailed overview of one-dimensional derivatives in mathlib, see the module docstring of
`Analysis/Calculus/Deriv/Basic`.
## Keywords
derivative, inverse function
-/
universe u v
open scoped Topology
open Filter Set
variable {š : Type u} [NontriviallyNormedField š]
variable {F : Type v} [NormedAddCommGroup F] [NormedSpace š F]
variable {f : š ā F}
variable {f' : F}
variable {s : Set š} {x : š} {c : F}
theorem HasStrictDerivAt.hasStrictFDerivAt_equiv {f : š ā š} {f' x : š}
(hf : HasStrictDerivAt f f' x) (hf' : f' ā 0) :
HasStrictFDerivAt f (ContinuousLinearEquiv.unitsEquivAut š (Units.mk0 f' hf') : š āL[š] š) x :=
hf
theorem HasDerivAt.hasFDerivAt_equiv {f : š ā š} {f' x : š} (hf : HasDerivAt f f' x)
(hf' : f' ā 0) :
HasFDerivAt f (ContinuousLinearEquiv.unitsEquivAut š (Units.mk0 f' hf') : š āL[š] š) x :=
hf
/-- If `f (g y) = y` for `y` in some neighborhood of `a`, `g` is continuous at `a`, and `f` has an
invertible derivative `f'` at `g a` in the strict sense, then `g` has the derivative `f'ā»Ā¹` at `a`
in the strict sense.
This is one of the easy parts of the inverse function theorem: it assumes that we already have an
inverse function. -/
theorem HasStrictDerivAt.of_local_left_inverse {f g : š ā š} {f' a : š} (hg : ContinuousAt g a)
(hf : HasStrictDerivAt f f' (g a)) (hf' : f' ā 0) (hfg : āį¶ y in š a, f (g y) = y) :
HasStrictDerivAt g f'ā»Ā¹ a :=
(hf.hasStrictFDerivAt_equiv hf').of_local_left_inverse hg hfg
/-- If `f` is an open partial homeomorphism defined on a neighbourhood of `f.symm a`, and `f` has a
nonzero derivative `f'` at `f.symm a` in the strict sense, then `f.symm` has the derivative `f'ā»Ā¹`
at `a` in the strict sense.
This is one of the easy parts of the inverse function theorem: it assumes that we already have
an inverse function. -/
theorem OpenPartialHomeomorph.hasStrictDerivAt_symm (f : OpenPartialHomeomorph š š) {a f' : š}
(ha : a ā f.target) (hf' : f' ā 0) (htff' : HasStrictDerivAt f f' (f.symm a)) :
HasStrictDerivAt f.symm f'ā»Ā¹ a :=
htff'.of_local_left_inverse (f.symm.continuousAt ha) hf' (f.eventually_right_inverse ha)
/-- If `f (g y) = y` for `y` in some neighborhood of `a`, `g` is continuous at `a`, and `f` has an
invertible derivative `f'` at `g a`, then `g` has the derivative `f'ā»Ā¹` at `a`.
This is one of the easy parts of the inverse function theorem: it assumes that we already have
an inverse function. -/
theorem HasDerivAt.of_local_left_inverse {f g : š ā š} {f' a : š} (hg : ContinuousAt g a)
(hf : HasDerivAt f f' (g a)) (hf' : f' ā 0) (hfg : āį¶ y in š a, f (g y) = y) :
HasDerivAt g f'ā»Ā¹ a :=
(hf.hasFDerivAt_equiv hf').of_local_left_inverse hg hfg
/-- If `f` is an open partial homeomorphism defined on a neighbourhood of `f.symm a`, and `f` has a
nonzero derivative `f'` at `f.symm a`, then `f.symm` has the derivative `f'ā»Ā¹` at `a`.
This is one of the easy parts of the inverse function theorem: it assumes that we already have
an inverse function. -/
theorem OpenPartialHomeomorph.hasDerivAt_symm (f : OpenPartialHomeomorph š š) {a f' : š}
(ha : a ā f.target) (hf' : f' ā 0) (htff' : HasDerivAt f f' (f.symm a)) :
HasDerivAt f.symm f'ā»Ā¹ a :=
htff'.of_local_left_inverse (f.symm.continuousAt ha) hf' (f.eventually_right_inverse ha)
theorem HasDerivWithinAt.eventually_ne (h : HasDerivWithinAt f f' s x) (hf' : f' ā 0) :
āį¶ z in š[s \ {x}] x, f z ā c :=
h.hasFDerivWithinAt.eventually_ne
āØāf'āā»Ā¹, fun z => by simp [norm_smul]; field_simp; rflā©
theorem HasDerivAt.eventually_ne (h : HasDerivAt f f' x) (hf' : f' ā 0) :
āį¶ z in š[ā ] x, f z ā c := by
simpa only [compl_eq_univ_diff] using (hasDerivWithinAt_univ.2 h).eventually_ne hf'
theorem HasDerivAt.tendsto_nhdsNE (h : HasDerivAt f f' x) (hf' : f' ā 0) :
Tendsto f (š[ā ] x) (š[ā ] f x) :=
tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within _ h.continuousAt.continuousWithinAt
(h.eventually_ne hf')
/-- If a function is equal to a constant at a set of points that accumulates to `x` in `s`,
then its derivative within `s` at `x` equals zero,
either because it has derivative zero or because it isn't differentiable at this point. -/
theorem derivWithin_zero_of_frequently_const {c} (h : āį¶ y in š[s \ {x}] x, f y = c) :
derivWithin f s x = 0 := by
by_cases hf : DifferentiableWithinAt š f s x
Ā· contrapose h
rw [not_frequently]
exact hf.hasDerivWithinAt.eventually_ne h
Ā· exact derivWithin_zero_of_not_differentiableWithinAt hf
/-- If a function is equal to a constant at a set of points that accumulates to `x`,
then its derivative at `x` equals zero,
either because it has derivative zero or because it isn't differentiable at this point. -/
theorem deriv_zero_of_frequently_const {c} (h : āį¶ y in š[ā ] x, f y = c) : deriv f x = 0 := by
rw [ā derivWithin_univ, derivWithin_zero_of_frequently_const]
rwa [ā compl_eq_univ_diff]
theorem not_differentiableWithinAt_of_local_left_inverse_hasDerivWithinAt_zero {f g : š ā š} {a : š}
{s t : Set š} (ha : a ā s) (hsu : UniqueDiffWithinAt š s a) (hf : HasDerivWithinAt f 0 t (g a))
(hst : MapsTo g s t) (hfg : f ā g =į¶ [š[s] a] id) : ¬DifferentiableWithinAt š g s a := by
intro hg
have := (hf.comp a hg.hasDerivWithinAt hst).congr_of_eventuallyEq_of_mem hfg.symm ha
simpa using hsu.eq_deriv _ this (hasDerivWithinAt_id _ _)
theorem not_differentiableAt_of_local_left_inverse_hasDerivAt_zero {f g : š ā š} {a : š}
(hf : HasDerivAt f 0 (g a)) (hfg : f ā g =į¶ [š a] id) : ¬DifferentiableAt š g a := by
intro hg
have := (hf.comp a hg.hasDerivAt).congr_of_eventuallyEq hfg.symm
simpa using this.unique (hasDerivAt_id a) |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/Deriv/Comp.lean | import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.FDeriv.Comp
import Mathlib.Analysis.Calculus.FDeriv.RestrictScalars
/-!
# One-dimensional derivatives of compositions of functions
In this file we prove the chain rule for the following cases:
* `HasDerivAt.comp` etc: `f : š' ā š'` composed with `g : š ā š'`;
* `HasDerivAt.scomp` etc: `f : š' ā E` composed with `g : š ā š'`;
* `HasFDerivAt.comp_hasDerivAt` etc: `f : E ā F` composed with `g : š ā E`;
Here `š` is the base normed field, `E` and `F` are normed spaces over `š` and `š'` is an algebra
over `š` (e.g., `š'=š` or `š=ā`, `š'=ā`).
We also give versions with the `of_eq` suffix, which require an equality proof instead
of definitional equality of the different points used in the composition. These versions are
often more flexible to use.
For a more detailed overview of one-dimensional derivatives in mathlib, see the module docstring of
`analysis/calculus/deriv/basic`.
## Keywords
derivative, chain rule
-/
universe u v w
open scoped Topology Filter ENNReal
open Filter Asymptotics Set
open ContinuousLinearMap (smulRight smulRight_one_eq_iff)
variable {š : Type u} [NontriviallyNormedField š]
variable {F : Type v} [NormedAddCommGroup F] [NormedSpace š F]
variable {E : Type w} [NormedAddCommGroup E] [NormedSpace š E]
variable {f : š ā F}
variable {f' : F}
variable {x : š}
variable {s : Set š}
variable {L : Filter š}
section Composition
/-!
### Derivative of the composition of a vector function and a scalar function
We use `scomp` in lemmas on composition of vector-valued and scalar-valued functions, and `comp`
in lemmas on composition of scalar-valued functions, in analogy for `smul` and `mul` (and also
because the `comp` version with the shorter name will show up much more often in applications).
The formula for the derivative involves `smul` in `scomp` lemmas, which can be reduced to
usual multiplication in `comp` lemmas.
-/
/- For composition lemmas, we put x explicit to help the elaborator, as otherwise Lean tends to
get confused since there are too many possibilities for composition -/
variable {š' : Type*} [NontriviallyNormedField š'] [NormedAlgebra š š'] [NormedSpace š' F]
[IsScalarTower š š' F] {s' t' : Set š'} {h : š ā š'} {hā : š' ā š'} {h' hā' : š'}
{gā : š' ā F} {gā' : F} {L' : Filter š'} {y : š'} (x)
theorem HasDerivAtFilter.scomp (hg : HasDerivAtFilter gā gā' (h x) L')
(hh : HasDerivAtFilter h h' x L) (hL : Tendsto h L L') :
HasDerivAtFilter (gā ā h) (h' ⢠gā') x L := by
simpa using ((hg.restrictScalars š).comp x hh hL).hasDerivAtFilter
theorem HasDerivAtFilter.scomp_of_eq (hg : HasDerivAtFilter gā gā' y L')
(hh : HasDerivAtFilter h h' x L) (hy : y = h x) (hL : Tendsto h L L') :
HasDerivAtFilter (gā ā h) (h' ⢠gā') x L := by
rw [hy] at hg; exact hg.scomp x hh hL
theorem HasDerivWithinAt.scomp_hasDerivAt (hg : HasDerivWithinAt gā gā' s' (h x))
(hh : HasDerivAt h h' x) (hs : ā x, h x ā s') : HasDerivAt (gā ā h) (h' ⢠gā') x :=
hg.scomp x hh <| tendsto_inf.2 āØhh.continuousAt, tendsto_principal.2 <| Eventually.of_forall hsā©
theorem HasDerivWithinAt.scomp_hasDerivAt_of_eq (hg : HasDerivWithinAt gā gā' s' y)
(hh : HasDerivAt h h' x) (hs : ā x, h x ā s') (hy : y = h x) :
HasDerivAt (gā ā h) (h' ⢠gā') x := by
rw [hy] at hg; exact hg.scomp_hasDerivAt x hh hs
nonrec theorem HasDerivWithinAt.scomp (hg : HasDerivWithinAt gā gā' t' (h x))
(hh : HasDerivWithinAt h h' s x) (hst : MapsTo h s t') :
HasDerivWithinAt (gā ā h) (h' ⢠gā') s x :=
hg.scomp x hh <| hh.continuousWithinAt.tendsto_nhdsWithin hst
theorem HasDerivWithinAt.scomp_of_eq (hg : HasDerivWithinAt gā gā' t' y)
(hh : HasDerivWithinAt h h' s x) (hst : MapsTo h s t') (hy : y = h x) :
HasDerivWithinAt (gā ā h) (h' ⢠gā') s x := by
rw [hy] at hg; exact hg.scomp x hh hst
/-- The chain rule. -/
nonrec theorem HasDerivAt.scomp (hg : HasDerivAt gā gā' (h x)) (hh : HasDerivAt h h' x) :
HasDerivAt (gā ā h) (h' ⢠gā') x :=
hg.scomp x hh hh.continuousAt
/-- The chain rule. -/
theorem HasDerivAt.scomp_of_eq
(hg : HasDerivAt gā gā' y) (hh : HasDerivAt h h' x) (hy : y = h x) :
HasDerivAt (gā ā h) (h' ⢠gā') x := by
rw [hy] at hg; exact hg.scomp x hh
theorem HasStrictDerivAt.scomp (hg : HasStrictDerivAt gā gā' (h x)) (hh : HasStrictDerivAt h h' x) :
HasStrictDerivAt (gā ā h) (h' ⢠gā') x := by
simpa using ((hg.restrictScalars š).comp x hh).hasStrictDerivAt
theorem HasStrictDerivAt.scomp_of_eq
(hg : HasStrictDerivAt gā gā' y) (hh : HasStrictDerivAt h h' x) (hy : y = h x) :
HasStrictDerivAt (gā ā h) (h' ⢠gā') x := by
rw [hy] at hg; exact hg.scomp x hh
theorem HasDerivAt.scomp_hasDerivWithinAt (hg : HasDerivAt gā gā' (h x))
(hh : HasDerivWithinAt h h' s x) : HasDerivWithinAt (gā ā h) (h' ⢠gā') s x :=
HasDerivWithinAt.scomp x hg.hasDerivWithinAt hh (mapsTo_univ _ _)
theorem HasDerivAt.scomp_hasDerivWithinAt_of_eq (hg : HasDerivAt gā gā' y)
(hh : HasDerivWithinAt h h' s x) (hy : y = h x) :
HasDerivWithinAt (gā ā h) (h' ⢠gā') s x := by
rw [hy] at hg; exact hg.scomp_hasDerivWithinAt x hh
theorem derivWithin.scomp (hg : DifferentiableWithinAt š' gā t' (h x))
(hh : DifferentiableWithinAt š h s x) (hs : MapsTo h s t') :
derivWithin (gā ā h) s x = derivWithin h s x ⢠derivWithin gā t' (h x) := by
by_cases hsx : UniqueDiffWithinAt š s x
Ā· exact (HasDerivWithinAt.scomp x hg.hasDerivWithinAt hh.hasDerivWithinAt hs).derivWithin hsx
Ā· simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]
theorem derivWithin.scomp_of_eq (hg : DifferentiableWithinAt š' gā t' y)
(hh : DifferentiableWithinAt š h s x) (hs : MapsTo h s t')
(hy : y = h x) :
derivWithin (gā ā h) s x = derivWithin h s x ⢠derivWithin gā t' (h x) := by
rw [hy] at hg; exact derivWithin.scomp x hg hh hs
theorem deriv.scomp (hg : DifferentiableAt š' gā (h x)) (hh : DifferentiableAt š h x) :
deriv (gā ā h) x = deriv h x ⢠deriv gā (h x) :=
(HasDerivAt.scomp x hg.hasDerivAt hh.hasDerivAt).deriv
theorem deriv.scomp_of_eq
(hg : DifferentiableAt š' gā y) (hh : DifferentiableAt š h x) (hy : y = h x) :
deriv (gā ā h) x = deriv h x ⢠deriv gā (h x) := by
rw [hy] at hg; exact deriv.scomp x hg hh
/-! ### Derivative of the composition of a scalar and vector functions -/
theorem HasDerivAtFilter.comp_hasFDerivAtFilter {f : E ā š'} {f' : E āL[š] š'} (x) {L'' : Filter E}
(hhā : HasDerivAtFilter hā hā' (f x) L') (hf : HasFDerivAtFilter f f' x L'')
(hL : Tendsto f L'' L') : HasFDerivAtFilter (hā ā f) (hā' ⢠f') x L'' := by
convert (hhā.restrictScalars š).comp x hf hL
ext x
simp [mul_comm]
theorem HasDerivAtFilter.comp_hasFDerivAtFilter_of_eq
{f : E ā š'} {f' : E āL[š] š'} (x) {L'' : Filter E}
(hhā : HasDerivAtFilter hā hā' y L') (hf : HasFDerivAtFilter f f' x L'')
(hL : Tendsto f L'' L') (hy : y = f x) : HasFDerivAtFilter (hā ā f) (hā' ⢠f') x L'' := by
rw [hy] at hhā; exact hhā.comp_hasFDerivAtFilter x hf hL
theorem HasStrictDerivAt.comp_hasStrictFDerivAt {f : E ā š'} {f' : E āL[š] š'} (x)
(hh : HasStrictDerivAt hā hā' (f x)) (hf : HasStrictFDerivAt f f' x) :
HasStrictFDerivAt (hā ā f) (hā' ⢠f') x := by
rw [HasStrictDerivAt] at hh
convert (hh.restrictScalars š).comp x hf
ext x
simp [mul_comm]
theorem HasStrictDerivAt.comp_hasStrictFDerivAt_of_eq {f : E ā š'} {f' : E āL[š] š'} (x)
(hh : HasStrictDerivAt hā hā' y) (hf : HasStrictFDerivAt f f' x) (hy : y = f x) :
HasStrictFDerivAt (hā ā f) (hā' ⢠f') x := by
rw [hy] at hh; exact hh.comp_hasStrictFDerivAt x hf
theorem HasDerivAt.comp_hasFDerivAt {f : E ā š'} {f' : E āL[š] š'} (x)
(hh : HasDerivAt hā hā' (f x)) (hf : HasFDerivAt f f' x) : HasFDerivAt (hā ā f) (hā' ⢠f') x :=
hh.comp_hasFDerivAtFilter x hf hf.continuousAt
theorem HasDerivAt.comp_hasFDerivAt_of_eq {f : E ā š'} {f' : E āL[š] š'} (x)
(hh : HasDerivAt hā hā' y) (hf : HasFDerivAt f f' x) (hy : y = f x) :
HasFDerivAt (hā ā f) (hā' ⢠f') x := by
rw [hy] at hh; exact hh.comp_hasFDerivAt x hf
theorem HasDerivAt.comp_hasFDerivWithinAt {f : E ā š'} {f' : E āL[š] š'} {s} (x)
(hh : HasDerivAt hā hā' (f x)) (hf : HasFDerivWithinAt f f' s x) :
HasFDerivWithinAt (hā ā f) (hā' ⢠f') s x :=
hh.comp_hasFDerivAtFilter x hf hf.continuousWithinAt
theorem HasDerivAt.comp_hasFDerivWithinAt_of_eq {f : E ā š'} {f' : E āL[š] š'} {s} (x)
(hh : HasDerivAt hā hā' y) (hf : HasFDerivWithinAt f f' s x) (hy : y = f x) :
HasFDerivWithinAt (hā ā f) (hā' ⢠f') s x := by
rw [hy] at hh; exact hh.comp_hasFDerivWithinAt x hf
theorem HasDerivWithinAt.comp_hasFDerivWithinAt {f : E ā š'} {f' : E āL[š] š'} {s t} (x)
(hh : HasDerivWithinAt hā hā' t (f x)) (hf : HasFDerivWithinAt f f' s x) (hst : MapsTo f s t) :
HasFDerivWithinAt (hā ā f) (hā' ⢠f') s x :=
hh.comp_hasFDerivAtFilter x hf <| hf.continuousWithinAt.tendsto_nhdsWithin hst
theorem HasDerivWithinAt.comp_hasFDerivWithinAt_of_eq {f : E ā š'} {f' : E āL[š] š'} {s t} (x)
(hh : HasDerivWithinAt hā hā' t y) (hf : HasFDerivWithinAt f f' s x) (hst : MapsTo f s t)
(hy : y = f x) :
HasFDerivWithinAt (hā ā f) (hā' ⢠f') s x := by
rw [hy] at hh; exact hh.comp_hasFDerivWithinAt x hf hst
theorem HasDerivWithinAt.comp_hasFDerivAt {f : E ā š'} {f' : E āL[š] š'} {t} (x)
(hh : HasDerivWithinAt hā hā' t (f x)) (hf : HasFDerivAt f f' x) (ht : āį¶ x' in š x, f x' ā t) :
HasFDerivAt (hā ā f) (hā' ⢠f') x :=
hh.comp_hasFDerivAtFilter x hf <| tendsto_nhdsWithin_iff.mpr āØhf.continuousAt, htā©
theorem HasDerivWithinAt.comp_hasFDerivAt_of_eq {f : E ā š'} {f' : E āL[š] š'} {t} (x)
(hh : HasDerivWithinAt hā hā' t y) (hf : HasFDerivAt f f' x) (ht : āį¶ x' in š x, f x' ā t)
(hy : y = f x) : HasFDerivAt (hā ā f) (hā' ⢠f') x := by
subst y; exact hh.comp_hasFDerivAt x hf ht
/-! ### Derivative of the composition of two scalar functions -/
theorem HasDerivAtFilter.comp (hhā : HasDerivAtFilter hā hā' (h x) L')
(hh : HasDerivAtFilter h h' x L) (hL : Tendsto h L L') :
HasDerivAtFilter (hā ā h) (hā' * h') x L := by
rw [mul_comm]
exact hhā.scomp x hh hL
theorem HasDerivAtFilter.comp_of_eq (hhā : HasDerivAtFilter hā hā' y L')
(hh : HasDerivAtFilter h h' x L) (hL : Tendsto h L L') (hy : y = h x) :
HasDerivAtFilter (hā ā h) (hā' * h') x L := by
rw [hy] at hhā; exact hhā.comp x hh hL
theorem HasDerivWithinAt.comp (hhā : HasDerivWithinAt hā hā' s' (h x))
(hh : HasDerivWithinAt h h' s x) (hst : MapsTo h s s') :
HasDerivWithinAt (hā ā h) (hā' * h') s x := by
rw [mul_comm]
exact hhā.scomp x hh hst
theorem HasDerivWithinAt.comp_of_eq (hhā : HasDerivWithinAt hā hā' s' y)
(hh : HasDerivWithinAt h h' s x) (hst : MapsTo h s s') (hy : y = h x) :
HasDerivWithinAt (hā ā h) (hā' * h') s x := by
rw [hy] at hhā; exact hhā.comp x hh hst
/-- The chain rule.
Note that the function `hā` is a function on an algebra. If you are looking for the chain rule
with `hā` taking values in a vector space, use `HasDerivAt.scomp`. -/
nonrec theorem HasDerivAt.comp (hhā : HasDerivAt hā hā' (h x)) (hh : HasDerivAt h h' x) :
HasDerivAt (hā ā h) (hā' * h') x :=
hhā.comp x hh hh.continuousAt
/-- The chain rule.
Note that the function `hā` is a function on an algebra. If you are looking for the chain rule
with `hā` taking values in a vector space, use `HasDerivAt.scomp_of_eq`. -/
theorem HasDerivAt.comp_of_eq
(hhā : HasDerivAt hā hā' y) (hh : HasDerivAt h h' x) (hy : y = h x) :
HasDerivAt (hā ā h) (hā' * h') x := by
rw [hy] at hhā; exact hhā.comp x hh
theorem HasStrictDerivAt.comp (hhā : HasStrictDerivAt hā hā' (h x)) (hh : HasStrictDerivAt h h' x) :
HasStrictDerivAt (hā ā h) (hā' * h') x := by
rw [mul_comm]
exact hhā.scomp x hh
theorem HasStrictDerivAt.comp_of_eq
(hhā : HasStrictDerivAt hā hā' y) (hh : HasStrictDerivAt h h' x) (hy : y = h x) :
HasStrictDerivAt (hā ā h) (hā' * h') x := by
rw [hy] at hhā; exact hhā.comp x hh
theorem HasDerivAt.comp_hasDerivWithinAt (hhā : HasDerivAt hā hā' (h x))
(hh : HasDerivWithinAt h h' s x) : HasDerivWithinAt (hā ā h) (hā' * h') s x :=
hhā.hasDerivWithinAt.comp x hh (mapsTo_univ _ _)
theorem HasDerivAt.comp_hasDerivWithinAt_of_eq (hhā : HasDerivAt hā hā' y)
(hh : HasDerivWithinAt h h' s x) (hy : y = h x) :
HasDerivWithinAt (hā ā h) (hā' * h') s x := by
rw [hy] at hhā; exact hhā.comp_hasDerivWithinAt x hh
theorem HasDerivWithinAt.comp_hasDerivAt {t} (hhā : HasDerivWithinAt hā hā' t (h x))
(hh : HasDerivAt h h' x) (ht : āį¶ x' in š x, h x' ā t) : HasDerivAt (hā ā h) (hā' * h') x :=
HasDerivAtFilter.comp x hhā hh <| tendsto_nhdsWithin_iff.mpr āØhh.continuousAt, htā©
theorem HasDerivWithinAt.comp_hasDerivAt_of_eq {t} (hhā : HasDerivWithinAt hā hā' t y)
(hh : HasDerivAt h h' x) (ht : āį¶ x' in š x, h x' ā t) (hy : y = h x) :
HasDerivAt (hā ā h) (hā' * h') x := by
subst y; exact hhā.comp_hasDerivAt x hh ht
theorem derivWithin_comp (hhā : DifferentiableWithinAt š' hā s' (h x))
(hh : DifferentiableWithinAt š h s x) (hs : MapsTo h s s') :
derivWithin (hā ā h) s x = derivWithin hā s' (h x) * derivWithin h s x := by
by_cases hsx : UniqueDiffWithinAt š s x
Ā· exact (hhā.hasDerivWithinAt.comp x hh.hasDerivWithinAt hs).derivWithin hsx
Ā· simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]
theorem derivWithin_comp_of_eq (hhā : DifferentiableWithinAt š' hā s' y)
(hh : DifferentiableWithinAt š h s x) (hs : MapsTo h s s')
(hy : h x = y) :
derivWithin (hā ā h) s x = derivWithin hā s' (h x) * derivWithin h s x := by
subst hy; exact derivWithin_comp x hhā hh hs
theorem deriv_comp (hhā : DifferentiableAt š' hā (h x)) (hh : DifferentiableAt š h x) :
deriv (hā ā h) x = deriv hā (h x) * deriv h x :=
(hhā.hasDerivAt.comp x hh.hasDerivAt).deriv
theorem deriv_comp_of_eq (hhā : DifferentiableAt š' hā y) (hh : DifferentiableAt š h x)
(hy : h x = y) :
deriv (hā ā h) x = deriv hā (h x) * deriv h x := by
subst hy; exact deriv_comp x hhā hh
protected nonrec theorem HasDerivAtFilter.iterate {f : š ā š} {f' : š}
(hf : HasDerivAtFilter f f' x L) (hL : Tendsto f L L) (hx : f x = x) (n : ā) :
HasDerivAtFilter f^[n] (f' ^ n) x L := by
have := hf.iterate hL hx n
rwa [ContinuousLinearMap.smulRight_one_pow] at this
protected nonrec theorem HasDerivAt.iterate {f : š ā š} {f' : š} (hf : HasDerivAt f f' x)
(hx : f x = x) (n : ā) : HasDerivAt f^[n] (f' ^ n) x :=
hf.iterate _ (have := hf.tendsto_nhds le_rfl; by rwa [hx] at this) hx n
protected theorem HasDerivWithinAt.iterate {f : š ā š} {f' : š} (hf : HasDerivWithinAt f f' s x)
(hx : f x = x) (hs : MapsTo f s s) (n : ā) : HasDerivWithinAt f^[n] (f' ^ n) s x := by
have := HasFDerivWithinAt.iterate hf hx hs n
rwa [ContinuousLinearMap.smulRight_one_pow] at this
protected nonrec theorem HasStrictDerivAt.iterate {f : š ā š} {f' : š}
(hf : HasStrictDerivAt f f' x) (hx : f x = x) (n : ā) :
HasStrictDerivAt f^[n] (f' ^ n) x := by
have := hf.iterate hx n
rwa [ContinuousLinearMap.smulRight_one_pow] at this
end Composition
section CompositionVector
/-! ### Derivative of the composition of a function between vector spaces and a function on `š` -/
open ContinuousLinearMap
variable {l : F ā E} {l' : F āL[š] E} {y : F}
variable (x)
/-- The composition `l ā f` where `l : F ā E` and `f : š ā F`, has a derivative within a set
equal to the FrƩchet derivative of `l` applied to the derivative of `f`. -/
theorem HasFDerivWithinAt.comp_hasDerivWithinAt {t : Set F} (hl : HasFDerivWithinAt l l' t (f x))
(hf : HasDerivWithinAt f f' s x) (hst : MapsTo f s t) :
HasDerivWithinAt (l ā f) (l' f') s x := by
simpa only [one_apply, one_smul, smulRight_apply, coe_comp', (Ā· ā Ā·)] using
(hl.comp x hf.hasFDerivWithinAt hst).hasDerivWithinAt
/-- The composition `l ā f` where `l : F ā E` and `f : š ā F`, has a derivative within a set
equal to the FrƩchet derivative of `l` applied to the derivative of `f`. -/
theorem HasFDerivWithinAt.comp_hasDerivWithinAt_of_eq {t : Set F}
(hl : HasFDerivWithinAt l l' t y)
(hf : HasDerivWithinAt f f' s x) (hst : MapsTo f s t) (hy : y = f x) :
HasDerivWithinAt (l ā f) (l' f') s x := by
rw [hy] at hl; exact hl.comp_hasDerivWithinAt x hf hst
theorem HasFDerivWithinAt.comp_hasDerivAt {t : Set F} (hl : HasFDerivWithinAt l l' t (f x))
(hf : HasDerivAt f f' x) (ht : āį¶ x' in š x, f x' ā t) : HasDerivAt (l ā f) (l' f') x := by
simpa only [one_apply, one_smul, smulRight_apply, coe_comp', (Ā· ā Ā·)] using
(hl.comp_hasFDerivAt x hf.hasFDerivAt ht).hasDerivAt
theorem HasFDerivWithinAt.comp_hasDerivAt_of_eq {t : Set F} (hl : HasFDerivWithinAt l l' t y)
(hf : HasDerivAt f f' x) (ht : āį¶ x' in š x, f x' ā t) (hy : y = f x) :
HasDerivAt (l ā f) (l' f') x := by
subst y; exact hl.comp_hasDerivAt x hf ht
theorem HasFDerivAt.comp_hasDerivWithinAt (hl : HasFDerivAt l l' (f x))
(hf : HasDerivWithinAt f f' s x) : HasDerivWithinAt (l ā f) (l' f') s x :=
hl.hasFDerivWithinAt.comp_hasDerivWithinAt x hf (mapsTo_univ _ _)
theorem HasFDerivAt.comp_hasDerivWithinAt_of_eq (hl : HasFDerivAt l l' y)
(hf : HasDerivWithinAt f f' s x) (hy : y = f x) :
HasDerivWithinAt (l ā f) (l' f') s x := by
rw [hy] at hl; exact hl.comp_hasDerivWithinAt x hf
/-- The composition `l ā f` where `l : F ā E` and `f : š ā F`, has a derivative equal to the
FrƩchet derivative of `l` applied to the derivative of `f`. -/
theorem HasFDerivAt.comp_hasDerivAt (hl : HasFDerivAt l l' (f x)) (hf : HasDerivAt f f' x) :
HasDerivAt (l ā f) (l' f') x :=
hasDerivWithinAt_univ.mp <| hl.comp_hasDerivWithinAt x hf.hasDerivWithinAt
/-- The composition `l ā f` where `l : F ā E` and `f : š ā F`, has a derivative equal to the
FrƩchet derivative of `l` applied to the derivative of `f`. -/
theorem HasFDerivAt.comp_hasDerivAt_of_eq
(hl : HasFDerivAt l l' y) (hf : HasDerivAt f f' x) (hy : y = f x) :
HasDerivAt (l ā f) (l' f') x := by
rw [hy] at hl; exact hl.comp_hasDerivAt x hf
theorem HasStrictFDerivAt.comp_hasStrictDerivAt (hl : HasStrictFDerivAt l l' (f x))
(hf : HasStrictDerivAt f f' x) : HasStrictDerivAt (l ā f) (l' f') x := by
simpa only [one_apply, one_smul, smulRight_apply, coe_comp', (Ā· ā Ā·)] using
(hl.comp x hf.hasStrictFDerivAt).hasStrictDerivAt
theorem HasStrictFDerivAt.comp_hasStrictDerivAt_of_eq (hl : HasStrictFDerivAt l l' y)
(hf : HasStrictDerivAt f f' x) (hy : y = f x) :
HasStrictDerivAt (l ā f) (l' f') x := by
rw [hy] at hl; exact hl.comp_hasStrictDerivAt x hf
theorem fderivWithin_comp_derivWithin {t : Set F} (hl : DifferentiableWithinAt š l t (f x))
(hf : DifferentiableWithinAt š f s x) (hs : MapsTo f s t) :
derivWithin (l ā f) s x = (fderivWithin š l t (f x) : F ā E) (derivWithin f s x) := by
by_cases hsx : UniqueDiffWithinAt š s x
Ā· exact (hl.hasFDerivWithinAt.comp_hasDerivWithinAt x hf.hasDerivWithinAt hs).derivWithin hsx
Ā· simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]
theorem fderivWithin_comp_derivWithin_of_eq {t : Set F} (hl : DifferentiableWithinAt š l t y)
(hf : DifferentiableWithinAt š f s x) (hs : MapsTo f s t) (hy : y = f x) :
derivWithin (l ā f) s x = (fderivWithin š l t (f x) : F ā E) (derivWithin f s x) := by
rw [hy] at hl; exact fderivWithin_comp_derivWithin x hl hf hs
theorem fderiv_comp_deriv (hl : DifferentiableAt š l (f x)) (hf : DifferentiableAt š f x) :
deriv (l ā f) x = (fderiv š l (f x) : F ā E) (deriv f x) :=
(hl.hasFDerivAt.comp_hasDerivAt x hf.hasDerivAt).deriv
theorem fderiv_comp_deriv_of_eq (hl : DifferentiableAt š l y) (hf : DifferentiableAt š f x)
(hy : y = f x) :
deriv (l ā f) x = (fderiv š l (f x) : F ā E) (deriv f x) := by
rw [hy] at hl; exact fderiv_comp_deriv x hl hf
end CompositionVector |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/Deriv/Support.lean | import Mathlib.Analysis.Calculus.Deriv.Basic
/-!
# Support of the derivative of a function
In this file we prove that the (topological) support of a function includes the support of its
derivative. As a corollary, we show that the derivative of a function with compact support has
compact support.
## Keywords
derivative, support
-/
universe u v
variable {š : Type u} [NontriviallyNormedField š]
variable {E : Type v} [NormedAddCommGroup E] [NormedSpace š E]
variable {f : š ā E}
/-! ### Support of derivatives -/
section Support
open Function
theorem support_deriv_subset : support (deriv f) ā tsupport f := by
intro x
rw [ā not_imp_not]
intro h2x
rw [notMem_tsupport_iff_eventuallyEq] at h2x
exact notMem_support.mpr (h2x.deriv_eq.trans (deriv_const x 0))
protected theorem HasCompactSupport.deriv (hf : HasCompactSupport f) :
HasCompactSupport (deriv f) :=
hf.mono' support_deriv_subset
end Support |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/Deriv/Add.lean | import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.FDeriv.Add
/-!
# One-dimensional derivatives of sums etc
In this file we prove formulas about derivatives of `f + g`, `-f`, `f - g`, and `ā i, f i x` for
functions from the base field to a normed space over this field.
For a more detailed overview of one-dimensional derivatives in mathlib, see the module docstring of
`Analysis/Calculus/Deriv/Basic`.
## Keywords
derivative
-/
universe u v w
open scoped Topology Filter ENNReal
open Asymptotics Set
variable {š : Type u} [NontriviallyNormedField š]
variable {F : Type v} [NormedAddCommGroup F] [NormedSpace š F]
variable {f g : š ā F}
variable {f' g' : F}
variable {x : š} {s : Set š} {L : Filter š}
section Add
/-! ### Derivative of the sum of two functions -/
nonrec theorem HasDerivAtFilter.fun_add (hf : HasDerivAtFilter f f' x L)
(hg : HasDerivAtFilter g g' x L) : HasDerivAtFilter (fun y ⦠f y + g y) (f' + g') x L := by
simpa using (hf.add hg).hasDerivAtFilter
nonrec theorem HasDerivAtFilter.add (hf : HasDerivAtFilter f f' x L)
(hg : HasDerivAtFilter g g' x L) : HasDerivAtFilter (f + g) (f' + g') x L := by
simpa using (hf.add hg).hasDerivAtFilter
nonrec theorem HasStrictDerivAt.fun_add
(hf : HasStrictDerivAt f f' x) (hg : HasStrictDerivAt g g' x) :
HasStrictDerivAt (fun y ⦠f y + g y) (f' + g') x := by simpa using (hf.add hg).hasStrictDerivAt
nonrec theorem HasStrictDerivAt.add (hf : HasStrictDerivAt f f' x) (hg : HasStrictDerivAt g g' x) :
HasStrictDerivAt (f + g) (f' + g') x := by simpa using (hf.add hg).hasStrictDerivAt
nonrec theorem HasDerivWithinAt.fun_add (hf : HasDerivWithinAt f f' s x)
(hg : HasDerivWithinAt g g' s x) : HasDerivWithinAt (fun y ⦠f y + g y) (f' + g') s x :=
hf.add hg
nonrec theorem HasDerivWithinAt.add (hf : HasDerivWithinAt f f' s x)
(hg : HasDerivWithinAt g g' s x) : HasDerivWithinAt (f + g) (f' + g') s x :=
hf.add hg
nonrec theorem HasDerivAt.fun_add (hf : HasDerivAt f f' x) (hg : HasDerivAt g g' x) :
HasDerivAt (fun x ⦠f x + g x) (f' + g') x :=
hf.add hg
nonrec theorem HasDerivAt.add (hf : HasDerivAt f f' x) (hg : HasDerivAt g g' x) :
HasDerivAt (f + g) (f' + g') x :=
hf.add hg
theorem derivWithin_fun_add (hf : DifferentiableWithinAt š f s x)
(hg : DifferentiableWithinAt š g s x) :
derivWithin (fun y ⦠f y + g y) s x = derivWithin f s x + derivWithin g s x := by
by_cases hsx : UniqueDiffWithinAt š s x
Ā· exact (hf.hasDerivWithinAt.add hg.hasDerivWithinAt).derivWithin hsx
Ā· simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]
theorem derivWithin_add (hf : DifferentiableWithinAt š f s x)
(hg : DifferentiableWithinAt š g s x) :
derivWithin (f + g) s x = derivWithin f s x + derivWithin g s x :=
derivWithin_fun_add hf hg
@[simp]
theorem deriv_fun_add (hf : DifferentiableAt š f x) (hg : DifferentiableAt š g x) :
deriv (fun y ⦠f y + g y) x = deriv f x + deriv g x :=
(hf.hasDerivAt.add hg.hasDerivAt).deriv
@[simp]
theorem deriv_add (hf : DifferentiableAt š f x) (hg : DifferentiableAt š g x) :
deriv (f + g) x = deriv f x + deriv g x :=
(hf.hasDerivAt.add hg.hasDerivAt).deriv
@[simp]
theorem hasDerivAtFilter_add_const_iff (c : F) :
HasDerivAtFilter (f Ā· + c) f' x L ā HasDerivAtFilter f f' x L :=
hasFDerivAtFilter_add_const_iff c
alias āØ_, HasDerivAtFilter.add_constā© := hasDerivAtFilter_add_const_iff
@[simp]
theorem hasStrictDerivAt_add_const_iff (c : F) :
HasStrictDerivAt (f Ā· + c) f' x ā HasStrictDerivAt f f' x :=
hasStrictFDerivAt_add_const_iff c
alias āØ_, HasStrictDerivAt.add_constā© := hasStrictDerivAt_add_const_iff
@[simp]
theorem hasDerivWithinAt_add_const_iff (c : F) :
HasDerivWithinAt (f Ā· + c) f' s x ā HasDerivWithinAt f f' s x :=
hasDerivAtFilter_add_const_iff c
alias āØ_, HasDerivWithinAt.add_constā© := hasDerivWithinAt_add_const_iff
@[simp]
theorem hasDerivAt_add_const_iff (c : F) : HasDerivAt (f Ā· + c) f' x ā HasDerivAt f f' x :=
hasDerivAtFilter_add_const_iff c
alias āØ_, HasDerivAt.add_constā© := hasDerivAt_add_const_iff
theorem derivWithin_add_const (c : F) :
derivWithin (fun y ⦠f y + c) s x = derivWithin f s x := by
simp only [derivWithin, fderivWithin_add_const]
theorem deriv_add_const (c : F) : deriv (fun y ⦠f y + c) x = deriv f x := by
simp only [deriv, fderiv_add_const]
@[simp]
theorem deriv_add_const' (c : F) : (deriv fun y ⦠f y + c) = deriv f :=
funext fun _ ⦠deriv_add_const c
theorem hasDerivAtFilter_const_add_iff (c : F) :
HasDerivAtFilter (c + f Ā·) f' x L ā HasDerivAtFilter f f' x L :=
hasFDerivAtFilter_const_add_iff c
alias āØ_, HasDerivAtFilter.const_addā© := hasDerivAtFilter_const_add_iff
@[simp]
theorem hasStrictDerivAt_const_add_iff (c : F) :
HasStrictDerivAt (c + f Ā·) f' x ā HasStrictDerivAt f f' x :=
hasStrictFDerivAt_const_add_iff c
alias āØ_, HasStrictDerivAt.const_addā© := hasStrictDerivAt_const_add_iff
@[simp]
theorem hasDerivWithinAt_const_add_iff (c : F) :
HasDerivWithinAt (c + f Ā·) f' s x ā HasDerivWithinAt f f' s x :=
hasDerivAtFilter_const_add_iff c
alias āØ_, HasDerivWithinAt.const_addā© := hasDerivWithinAt_const_add_iff
@[simp]
theorem hasDerivAt_const_add_iff (c : F) : HasDerivAt (c + f Ā·) f' x ā HasDerivAt f f' x :=
hasDerivAtFilter_const_add_iff c
alias āØ_, HasDerivAt.const_addā© := hasDerivAt_const_add_iff
theorem derivWithin_const_add (c : F) :
derivWithin (c + f Ā·) s x = derivWithin f s x := by
simp only [derivWithin, fderivWithin_const_add]
@[simp]
theorem derivWithin_const_add_fun (c : F) :
derivWithin (c + f Ā·) = derivWithin f := by
ext
apply derivWithin_const_add
theorem deriv_const_add (c : F) : deriv (c + f Ā·) x = deriv f x := by
simp only [deriv, fderiv_const_add]
@[simp]
theorem deriv_const_add' (c : F) : (deriv (c + f Ā·)) = deriv f :=
funext fun _ ⦠deriv_const_add c
@[deprecated (since := "2025-10-06")]
alias differentiableAt_comp_const_add := differentiableAt_comp_add_left
lemma differentiableAt_comp_add_const {a b : š} :
DifferentiableAt š (fun x ⦠f (x + b)) a ā DifferentiableAt š f (a + b) := by
grind [add_comm, differentiableAt_comp_add_left]
lemma differentiableAt_iff_comp_const_add {a b : š} :
DifferentiableAt š f a ā DifferentiableAt š (fun x ⦠f (b + x)) (-b + a) := by
simp [differentiableAt_comp_add_left]
lemma differentiableAt_iff_comp_add_const {a b : š} :
DifferentiableAt š f a ā DifferentiableAt š (fun x ⦠f (x + b)) (a - b) := by
simp [differentiableAt_comp_add_const]
end Add
section Sum
/-! ### Derivative of a finite sum of functions -/
variable {ι : Type*} {u : Finset ι} {A : ι ā š ā F} {A' : ι ā F}
theorem HasDerivAtFilter.fun_sum (h : ā i ā u, HasDerivAtFilter (A i) (A' i) x L) :
HasDerivAtFilter (fun y ⦠ā i ā u, A i y) (ā i ā u, A' i) x L := by
simpa using (HasFDerivAtFilter.fun_sum h).hasDerivAtFilter
theorem HasDerivAtFilter.sum (h : ā i ā u, HasDerivAtFilter (A i) (A' i) x L) :
HasDerivAtFilter (ā i ā u, A i) (ā i ā u, A' i) x L := by
convert HasDerivAtFilter.fun_sum h
simp
theorem HasStrictDerivAt.fun_sum (h : ā i ā u, HasStrictDerivAt (A i) (A' i) x) :
HasStrictDerivAt (fun y ⦠ā i ā u, A i y) (ā i ā u, A' i) x := by
simpa using (HasStrictFDerivAt.fun_sum h).hasStrictDerivAt
theorem HasStrictDerivAt.sum (h : ā i ā u, HasStrictDerivAt (A i) (A' i) x) :
HasStrictDerivAt (ā i ā u, A i) (ā i ā u, A' i) x := by
simpa using (HasStrictFDerivAt.sum h).hasStrictDerivAt
theorem HasDerivWithinAt.fun_sum (h : ā i ā u, HasDerivWithinAt (A i) (A' i) s x) :
HasDerivWithinAt (fun y ⦠ā i ā u, A i y) (ā i ā u, A' i) s x :=
HasDerivAtFilter.fun_sum h
theorem HasDerivWithinAt.sum (h : ā i ā u, HasDerivWithinAt (A i) (A' i) s x) :
HasDerivWithinAt (ā i ā u, A i) (ā i ā u, A' i) s x :=
HasDerivAtFilter.sum h
theorem HasDerivAt.fun_sum (h : ā i ā u, HasDerivAt (A i) (A' i) x) :
HasDerivAt (fun y ⦠ā i ā u, A i y) (ā i ā u, A' i) x :=
HasDerivAtFilter.fun_sum h
theorem HasDerivAt.sum (h : ā i ā u, HasDerivAt (A i) (A' i) x) :
HasDerivAt (ā i ā u, A i) (ā i ā u, A' i) x :=
HasDerivAtFilter.sum h
theorem derivWithin_fun_sum (h : ā i ā u, DifferentiableWithinAt š (A i) s x) :
derivWithin (fun y ⦠ā i ā u, A i y) s x = ā i ā u, derivWithin (A i) s x := by
by_cases hsx : UniqueDiffWithinAt š s x
· exact (HasDerivWithinAt.fun_sum fun i hi ⦠(h i hi).hasDerivWithinAt).derivWithin hsx
Ā· simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]
theorem derivWithin_sum (h : ā i ā u, DifferentiableWithinAt š (A i) s x) :
derivWithin (ā i ā u, A i) s x = ā i ā u, derivWithin (A i) s x := by
by_cases hsx : UniqueDiffWithinAt š s x
· exact (HasDerivWithinAt.sum fun i hi ⦠(h i hi).hasDerivWithinAt).derivWithin hsx
Ā· simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]
@[simp]
theorem deriv_fun_sum (h : ā i ā u, DifferentiableAt š (A i) x) :
deriv (fun y ⦠ā i ā u, A i y) x = ā i ā u, deriv (A i) x :=
(HasDerivAt.fun_sum fun i hi ⦠(h i hi).hasDerivAt).deriv
@[simp]
theorem deriv_sum (h : ā i ā u, DifferentiableAt š (A i) x) :
deriv (ā i ā u, A i) x = ā i ā u, deriv (A i) x :=
(HasDerivAt.sum fun i hi ⦠(h i hi).hasDerivAt).deriv
end Sum
section Neg
/-! ### Derivative of the negative of a function -/
nonrec theorem HasDerivAtFilter.fun_neg (h : HasDerivAtFilter f f' x L) :
HasDerivAtFilter (fun x ⦠-f x) (-f') x L := by simpa using h.neg.hasDerivAtFilter
nonrec theorem HasDerivAtFilter.neg (h : HasDerivAtFilter f f' x L) :
HasDerivAtFilter (-f) (-f') x L := by simpa using h.neg.hasDerivAtFilter
nonrec theorem HasDerivWithinAt.fun_neg (h : HasDerivWithinAt f f' s x) :
HasDerivWithinAt (fun x ⦠-f x) (-f') s x :=
h.neg
nonrec theorem HasDerivWithinAt.neg (h : HasDerivWithinAt f f' s x) :
HasDerivWithinAt (-f) (-f') s x :=
h.neg
nonrec theorem HasDerivAt.fun_neg (h : HasDerivAt f f' x) : HasDerivAt (fun x ⦠-f x) (-f') x :=
h.neg
nonrec theorem HasDerivAt.neg (h : HasDerivAt f f' x) : HasDerivAt (-f) (-f') x :=
h.neg
nonrec theorem HasStrictDerivAt.fun_neg (h : HasStrictDerivAt f f' x) :
HasStrictDerivAt (fun x ⦠-f x) (-f') x := by simpa using h.neg.hasStrictDerivAt
nonrec theorem HasStrictDerivAt.neg (h : HasStrictDerivAt f f' x) :
HasStrictDerivAt (-f) (-f') x := by simpa using h.neg.hasStrictDerivAt
theorem derivWithin.fun_neg : derivWithin (fun y ⦠-f y) s x = -derivWithin f s x := by
by_cases hsx : UniqueDiffWithinAt š s x
Ā· simp only [derivWithin, fderivWithin_fun_neg hsx, ContinuousLinearMap.neg_apply]
Ā· simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]
theorem derivWithin.neg : derivWithin (-f) s x = -derivWithin f s x :=
derivWithin.fun_neg
theorem deriv.fun_neg : deriv (fun y ⦠-f y) x = -deriv f x := by
simp only [deriv, fderiv_fun_neg, ContinuousLinearMap.neg_apply]
theorem deriv.neg : deriv (-f) x = -deriv f x :=
deriv.fun_neg
@[simp]
theorem deriv.fun_neg' : (deriv fun y ⦠-f y) = fun x ⦠-deriv f x :=
funext fun _ ⦠deriv.fun_neg
@[simp]
theorem deriv.neg' : (deriv (-f)) = fun x ⦠-deriv f x :=
deriv.fun_neg'
end Neg
section Neg2
/-! ### Derivative of the negation function (i.e `Neg.neg`) -/
variable (s x L)
theorem hasDerivAtFilter_neg : HasDerivAtFilter Neg.neg (-1) x L :=
HasDerivAtFilter.neg <| hasDerivAtFilter_id _ _
theorem hasDerivWithinAt_neg : HasDerivWithinAt Neg.neg (-1) s x :=
hasDerivAtFilter_neg _ _
theorem hasDerivAt_neg : HasDerivAt Neg.neg (-1) x :=
hasDerivAtFilter_neg _ _
theorem hasDerivAt_neg' : HasDerivAt (fun x ⦠-x) (-1) x :=
hasDerivAtFilter_neg _ _
theorem hasStrictDerivAt_neg : HasStrictDerivAt Neg.neg (-1) x :=
HasStrictDerivAt.neg <| hasStrictDerivAt_id _
theorem deriv_neg : deriv Neg.neg x = -1 :=
HasDerivAt.deriv (hasDerivAt_neg x)
@[simp]
theorem deriv_neg' : deriv (Neg.neg : š ā š) = fun _ ⦠-1 :=
funext deriv_neg
@[simp]
theorem deriv_neg'' : deriv (fun x : š ⦠-x) x = -1 :=
deriv_neg x
theorem derivWithin_neg (hxs : UniqueDiffWithinAt š s x) : derivWithin Neg.neg s x = -1 :=
(hasDerivWithinAt_neg x s).derivWithin hxs
theorem differentiable_neg : Differentiable š (Neg.neg : š ā š) :=
Differentiable.neg differentiable_id
theorem differentiableOn_neg : DifferentiableOn š (Neg.neg : š ā š) s :=
DifferentiableOn.neg differentiableOn_id
lemma differentiableAt_comp_neg {a : š} :
DifferentiableAt š (fun x ⦠f (-x)) a ā DifferentiableAt š f (-a) := by
refine āØfun H ⦠?_, fun H ⦠H.comp a differentiable_neg.differentiableAtā©
convert ((neg_neg a).symm āø H).comp (-a) differentiable_neg.differentiableAt
ext
simp only [Function.comp_apply, neg_neg]
lemma differentiableAt_iff_comp_neg {a : š} :
DifferentiableAt š f a ā DifferentiableAt š (fun x ⦠f (-x)) (-a) := by
simp_rw [ā differentiableAt_comp_neg, neg_neg]
end Neg2
section Sub
/-! ### Derivative of the difference of two functions -/
theorem HasDerivAtFilter.fun_sub (hf : HasDerivAtFilter f f' x L) (hg : HasDerivAtFilter g g' x L) :
HasDerivAtFilter (fun x ⦠f x - g x) (f' - g') x L := by
simpa only [sub_eq_add_neg] using hf.add hg.neg
theorem HasDerivAtFilter.sub (hf : HasDerivAtFilter f f' x L) (hg : HasDerivAtFilter g g' x L) :
HasDerivAtFilter (f - g) (f' - g') x L := by
simpa only [sub_eq_add_neg] using hf.add hg.neg
nonrec theorem HasDerivWithinAt.fun_sub (hf : HasDerivWithinAt f f' s x)
(hg : HasDerivWithinAt g g' s x) : HasDerivWithinAt (fun x ⦠f x - g x) (f' - g') s x :=
hf.sub hg
nonrec theorem HasDerivWithinAt.sub (hf : HasDerivWithinAt f f' s x)
(hg : HasDerivWithinAt g g' s x) : HasDerivWithinAt (f - g) (f' - g') s x :=
hf.sub hg
nonrec theorem HasDerivAt.fun_sub (hf : HasDerivAt f f' x) (hg : HasDerivAt g g' x) :
HasDerivAt (fun x ⦠f x - g x) (f' - g') x :=
hf.sub hg
nonrec theorem HasDerivAt.sub (hf : HasDerivAt f f' x) (hg : HasDerivAt g g' x) :
HasDerivAt (f - g) (f' - g') x :=
hf.sub hg
theorem HasStrictDerivAt.fun_sub (hf : HasStrictDerivAt f f' x) (hg : HasStrictDerivAt g g' x) :
HasStrictDerivAt (fun x ⦠f x - g x) (f' - g') x := by
simpa only [sub_eq_add_neg] using hf.add hg.neg
theorem HasStrictDerivAt.sub (hf : HasStrictDerivAt f f' x) (hg : HasStrictDerivAt g g' x) :
HasStrictDerivAt (f - g) (f' - g') x := by
simpa only [sub_eq_add_neg] using hf.add hg.neg
theorem derivWithin_fun_sub (hf : DifferentiableWithinAt š f s x)
(hg : DifferentiableWithinAt š g s x) :
derivWithin (fun y ⦠f y - g y) s x = derivWithin f s x - derivWithin g s x := by
simp only [sub_eq_add_neg, derivWithin_fun_add hf hg.fun_neg, derivWithin.fun_neg]
theorem derivWithin_sub (hf : DifferentiableWithinAt š f s x)
(hg : DifferentiableWithinAt š g s x) :
derivWithin (f - g) s x = derivWithin f s x - derivWithin g s x :=
derivWithin_fun_sub hf hg
@[simp]
theorem deriv_fun_sub (hf : DifferentiableAt š f x) (hg : DifferentiableAt š g x) :
deriv (fun y ⦠f y - g y) x = deriv f x - deriv g x :=
(hf.hasDerivAt.sub hg.hasDerivAt).deriv
@[simp]
theorem deriv_sub (hf : DifferentiableAt š f x) (hg : DifferentiableAt š g x) :
deriv (f - g) x = deriv f x - deriv g x :=
(hf.hasDerivAt.sub hg.hasDerivAt).deriv
@[simp]
theorem hasDerivAtFilter_sub_const_iff (c : F) :
HasDerivAtFilter (fun x ⦠f x - c) f' x L ā HasDerivAtFilter f f' x L :=
hasFDerivAtFilter_sub_const_iff c
alias āØ_, HasDerivAtFilter.sub_constā© := hasDerivAtFilter_sub_const_iff
@[simp]
theorem hasDerivWithinAt_sub_const_iff (c : F) :
HasDerivWithinAt (f Ā· - c) f' s x ā HasDerivWithinAt f f' s x :=
hasDerivAtFilter_sub_const_iff c
alias āØ_, HasDerivWithinAt.sub_constā© := hasDerivWithinAt_sub_const_iff
@[simp]
theorem hasDerivAt_sub_const_iff (c : F) : HasDerivAt (f Ā· - c) f' x ā HasDerivAt f f' x :=
hasDerivAtFilter_sub_const_iff c
alias āØ_, HasDerivAt.sub_constā© := hasDerivAt_sub_const_iff
theorem derivWithin_sub_const (c : F) :
derivWithin (fun y ⦠f y - c) s x = derivWithin f s x := by
simp only [derivWithin, fderivWithin_sub_const]
@[simp]
theorem derivWithin_sub_const_fun (c : F) : derivWithin (f Ā· - c) = derivWithin f := by
ext
apply derivWithin_sub_const
theorem deriv_sub_const (c : F) : deriv (fun y ⦠f y - c) x = deriv f x := by
simp only [deriv, fderiv_sub_const]
@[simp]
theorem deriv_sub_const_fun (c : F) : deriv (f Ā· - c) = deriv f := by
ext
apply deriv_sub_const
theorem HasDerivAtFilter.const_sub (c : F) (hf : HasDerivAtFilter f f' x L) :
HasDerivAtFilter (fun x ⦠c - f x) (-f') x L := by
simpa only [sub_eq_add_neg] using hf.neg.const_add c
nonrec theorem HasDerivWithinAt.const_sub (c : F) (hf : HasDerivWithinAt f f' s x) :
HasDerivWithinAt (fun x ⦠c - f x) (-f') s x :=
hf.const_sub c
theorem HasStrictDerivAt.const_sub (c : F) (hf : HasStrictDerivAt f f' x) :
HasStrictDerivAt (fun x ⦠c - f x) (-f') x := by
simpa only [sub_eq_add_neg] using hf.neg.const_add c
nonrec theorem HasDerivAt.const_sub (c : F) (hf : HasDerivAt f f' x) :
HasDerivAt (fun x ⦠c - f x) (-f') x :=
hf.const_sub c
theorem derivWithin_const_sub (c : F) :
derivWithin (fun y ⦠c - f y) s x = -derivWithin f s x := by
simp [sub_eq_add_neg, derivWithin.fun_neg]
theorem deriv_const_sub (c : F) : deriv (fun y ⦠c - f y) x = -deriv f x := by
simp only [ā derivWithin_univ, derivWithin_const_sub]
lemma differentiableAt_comp_sub_const {a b : š} :
DifferentiableAt š (fun x ⦠f (x - b)) a ā DifferentiableAt š f (a - b) := by
simp [sub_eq_add_neg, differentiableAt_comp_add_const]
lemma differentiableAt_comp_const_sub {a b : š} :
DifferentiableAt š (fun x ⦠f (b - x)) a ā DifferentiableAt š f (b - a) := by
refine āØfun H ⦠?_, fun H ⦠H.comp a (differentiable_id.const_sub _).differentiableAtā©
convert ((sub_sub_cancel _ a).symm āø H).comp (b - a)
(differentiable_id.const_sub _).differentiableAt
ext
simp
lemma differentiableAt_iff_comp_sub_const {a b : š} :
DifferentiableAt š f a ā DifferentiableAt š (fun x ⦠f (x - b)) (a + b) := by
simp [sub_eq_add_neg, differentiableAt_comp_add_const]
lemma differentiableAt_iff_comp_const_sub {a b : š} :
DifferentiableAt š f a ā DifferentiableAt š (fun x ⦠f (b - x)) (b - a) := by
simp [differentiableAt_comp_const_sub]
end Sub |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/Deriv/Star.lean | import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.FDeriv.Star
/-!
# Star operations on derivatives
This file contains the usual formulas (and existence assertions) for the derivative of the star
operation.
Most of the results in this file only apply when the field that the derivative is respect to has a
trivial star operation; which as should be expected rules out `š = ā`. The exceptions are
`HasDerivAt.conj_conj` and `DifferentiableAt.conj_conj`, showing that `conj ā f ā conj` is
differentiable when `f` is (and giving a formula for its derivative).
-/
universe u v w
variable {š : Type u} [NontriviallyNormedField š] [StarRing š]
{F : Type v} [NormedAddCommGroup F] [NormedSpace š F] [StarAddMonoid F] [StarModule š F]
[ContinuousStar F] {f : š ā F} {f' : F} {x : š}
/-! ### Derivative of `x ⦠star x` -/
section TrivialStar
variable [TrivialStar š] {s : Set š} {L : Filter š}
protected nonrec theorem HasDerivAtFilter.star (h : HasDerivAtFilter f f' x L) :
HasDerivAtFilter (fun x => star (f x)) (star f') x L := by
simpa using h.star.hasDerivAtFilter
protected nonrec theorem HasDerivWithinAt.star (h : HasDerivWithinAt f f' s x) :
HasDerivWithinAt (fun x => star (f x)) (star f') s x :=
h.star
protected nonrec theorem HasDerivAt.star (h : HasDerivAt f f' x) :
HasDerivAt (fun x => star (f x)) (star f') x :=
h.star
protected nonrec theorem HasStrictDerivAt.star (h : HasStrictDerivAt f f' x) :
HasStrictDerivAt (fun x => star (f x)) (star f') x := by simpa using h.star.hasStrictDerivAt
protected theorem derivWithin.star :
derivWithin (fun y => star (f y)) s x = star (derivWithin f s x) := by
by_cases hxs : UniqueDiffWithinAt š s x
Ā· exact DFunLike.congr_fun (fderivWithin_star hxs) _
Ā· simp [derivWithin_zero_of_not_uniqueDiffWithinAt hxs]
protected theorem deriv.star : deriv (fun y => star (f y)) x = star (deriv f x) :=
DFunLike.congr_fun fderiv_star _
@[simp]
protected theorem deriv.star' : (deriv fun y => star (f y)) = fun x => star (deriv f x) :=
funext fun _ => deriv.star
end TrivialStar
section NontrivialStar
variable [NormedStarGroup š]
open scoped ComplexConjugate
/-- If `f` has derivative `f'` at `z`, then `star ā f ā conj` has derivative `conj f'` at
`conj z`. -/
lemma HasDerivAt.star_conj {f : š ā F} {f' : F} (hf : HasDerivAt f f' x) :
HasDerivAt (star ā f ā conj) (star f') (conj x) := by
rw [hasDerivAt_iff_hasFDerivAt]
convert hf.hasFDerivAt.star_star
ext
simp
/-- If `f` has derivative `f'` at `z`, then `conj ā f ā conj` has derivative `conj f'` at
`conj z`. -/
lemma HasDerivAt.conj_conj {f : š ā š} {f' : š} (hf : HasDerivAt f f' x) :
HasDerivAt (conj ā f ā conj) (conj f') (conj x) :=
hf.star_conj
/-- If `f` is differentiable at `conj z`, then `conj ā f ā conj` is differentiable at `z`. -/
lemma DifferentiableAt.conj_conj {f : š ā š} (hf : DifferentiableAt š f x) :
DifferentiableAt š (conj ā f ā conj) (conj x) :=
hf.star_star
end NontrivialStar |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/Deriv/Prod.lean | import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.FDeriv.Prod
/-!
# Derivatives of functions taking values in product types
In this file we prove lemmas about derivatives of functions `f : š ā E Ć F` and of functions
`f : š ā (Ī i, E i)`.
For a more detailed overview of one-dimensional derivatives in mathlib, see the module docstring of
`Mathlib/Analysis/Calculus/Deriv/Basic.lean`.
## Keywords
derivative
-/
universe u v w
open Topology Filter Asymptotics Set
variable {š : Type u} [NontriviallyNormedField š]
variable {F : Type v} [NormedAddCommGroup F] [NormedSpace š F]
variable {fā : š ā F} {fā' : F} {x : š} {s : Set š} {L : Filter š}
section CartesianProduct
/-! ### Derivative of the Cartesian product of two functions -/
variable {G : Type w} [NormedAddCommGroup G] [NormedSpace š G]
variable {fā : š ā G} {fā' : G}
nonrec theorem HasDerivAtFilter.prodMk (hfā : HasDerivAtFilter fā fā' x L)
(hfā : HasDerivAtFilter fā fā' x L) : HasDerivAtFilter (fun x => (fā x, fā x)) (fā', fā') x L :=
hfā.prodMk hfā
nonrec theorem HasDerivWithinAt.prodMk (hfā : HasDerivWithinAt fā fā' s x)
(hfā : HasDerivWithinAt fā fā' s x) : HasDerivWithinAt (fun x => (fā x, fā x)) (fā', fā') s x :=
hfā.prodMk hfā
nonrec theorem HasDerivAt.prodMk (hfā : HasDerivAt fā fā' x) (hfā : HasDerivAt fā fā' x) :
HasDerivAt (fun x => (fā x, fā x)) (fā', fā') x :=
hfā.prodMk hfā
nonrec theorem HasStrictDerivAt.prodMk (hfā : HasStrictDerivAt fā fā' x)
(hfā : HasStrictDerivAt fā fā' x) : HasStrictDerivAt (fun x => (fā x, fā x)) (fā', fā') x :=
hfā.prodMk hfā
end CartesianProduct
section Pi
/-! ### Derivatives of functions `f : š ā Ī i, E i` -/
variable {ι : Type*} [Fintype ι] {E' : ι ā Type*} [ā i, NormedAddCommGroup (E' i)]
[ā i, NormedSpace š (E' i)] {Ļ : š ā ā i, E' i} {Ļ' : ā i, E' i}
@[simp]
theorem hasStrictDerivAt_pi :
HasStrictDerivAt Ļ Ļ' x ā ā i, HasStrictDerivAt (fun x => Ļ x i) (Ļ' i) x :=
hasStrictFDerivAt_pi'
@[simp]
theorem hasDerivAtFilter_pi :
HasDerivAtFilter Ļ Ļ' x L ā ā i, HasDerivAtFilter (fun x => Ļ x i) (Ļ' i) x L :=
hasFDerivAtFilter_pi'
theorem hasDerivAt_pi : HasDerivAt Ļ Ļ' x ā ā i, HasDerivAt (fun x => Ļ x i) (Ļ' i) x :=
hasDerivAtFilter_pi
theorem hasDerivWithinAt_pi :
HasDerivWithinAt Ļ Ļ' s x ā ā i, HasDerivWithinAt (fun x => Ļ x i) (Ļ' i) s x :=
hasDerivAtFilter_pi
theorem derivWithin_pi (h : ā i, DifferentiableWithinAt š (fun x => Ļ x i) s x) :
derivWithin Ļ s x = fun i => derivWithin (fun x => Ļ x i) s x := by
by_cases hsx : UniqueDiffWithinAt š s x
Ā· exact (hasDerivWithinAt_pi.2 fun i => (h i).hasDerivWithinAt).derivWithin hsx
Ā· simp only [derivWithin_zero_of_not_uniqueDiffWithinAt hsx, Pi.zero_def]
theorem deriv_pi (h : ā i, DifferentiableAt š (fun x => Ļ x i) x) :
deriv Ļ x = fun i => deriv (fun x => Ļ x i) x :=
(hasDerivAt_pi.2 fun i => (h i).hasDerivAt).deriv
end Pi
/-!
### Derivatives of tuples `f : š ā Ī i : Fin n.succ, F' i`
These can be used to prove results about functions of the form `fun x ⦠![f x, g x, h x]`,
as `Matrix.vecCons` is defeq to `Fin.cons`.
-/
section PiFin
variable {n : Nat} {F' : Fin n.succ ā Type*}
variable [ā i, NormedAddCommGroup (F' i)] [ā i, NormedSpace š (F' i)]
variable {Ļ : š ā F' 0} {Ļs : š ā ā i, F' (Fin.succ i)}
theorem hasStrictDerivAt_finCons {Ļ' : Ī i, F' i} :
HasStrictDerivAt (fun x => Fin.cons (Ļ x) (Ļs x)) Ļ' x ā
HasStrictDerivAt Ļ (Ļ' 0) x ā§ HasStrictDerivAt Ļs (fun i => Ļ' i.succ) x :=
hasStrictFDerivAt_finCons
/-- A variant of `hasStrictDerivAt_finCons` where the derivative variables are free on the RHS
instead. -/
theorem hasStrictDerivAt_finCons' {Ļ' : F' 0} {Ļs' : Ī i, F' (Fin.succ i)} :
HasStrictDerivAt (fun x => Fin.cons (Ļ x) (Ļs x)) (Fin.cons Ļ' Ļs') x ā
HasStrictDerivAt Ļ Ļ' x ā§ HasStrictDerivAt Ļs Ļs' x :=
hasStrictDerivAt_finCons
theorem HasStrictDerivAt.finCons {Ļ' : F' 0} {Ļs' : Ī i, F' (Fin.succ i)}
(h : HasStrictDerivAt Ļ Ļ' x) (hs : HasStrictDerivAt Ļs Ļs' x) :
HasStrictDerivAt (fun x => Fin.cons (Ļ x) (Ļs x)) (Fin.cons Ļ' Ļs') x :=
hasStrictDerivAt_finCons'.mpr āØh, hsā©
theorem hasDerivAtFilter_finCons {Ļ' : Ī i, F' i} {l : Filter š} :
HasDerivAtFilter (fun x => Fin.cons (Ļ x) (Ļs x)) Ļ' x l ā
HasDerivAtFilter Ļ (Ļ' 0) x l ā§ HasDerivAtFilter Ļs (fun i => Ļ' i.succ) x l :=
hasFDerivAtFilter_finCons
/-- A variant of `hasDerivAtFilter_finCons` where the derivative variables are free on the RHS
instead. -/
theorem hasDerivAtFilter_finCons' {Ļ' : F' 0} {Ļs' : Ī i, F' (Fin.succ i)} {l : Filter š} :
HasDerivAtFilter (fun x => Fin.cons (Ļ x) (Ļs x)) (Fin.cons Ļ' Ļs') x l ā
HasDerivAtFilter Ļ Ļ' x l ā§ HasDerivAtFilter Ļs Ļs' x l :=
hasDerivAtFilter_finCons
theorem HasDerivAtFilter.finCons {Ļ' : F' 0} {Ļs' : Ī i, F' (Fin.succ i)} {l : Filter š}
(h : HasDerivAtFilter Ļ Ļ' x l) (hs : HasDerivAtFilter Ļs Ļs' x l) :
HasDerivAtFilter (fun x => Fin.cons (Ļ x) (Ļs x)) (Fin.cons Ļ' Ļs') x l :=
hasDerivAtFilter_finCons'.mpr āØh, hsā©
theorem hasDerivAt_finCons {Ļ' : Ī i, F' i} :
HasDerivAt (fun x => Fin.cons (Ļ x) (Ļs x)) Ļ' x ā
HasDerivAt Ļ (Ļ' 0) x ā§ HasDerivAt Ļs (fun i => Ļ' i.succ) x :=
hasDerivAtFilter_finCons
/-- A variant of `hasDerivAt_finCons` where the derivative variables are free on the RHS
instead. -/
theorem hasDerivAt_finCons' {Ļ' : F' 0} {Ļs' : Ī i, F' (Fin.succ i)} :
HasDerivAt (fun x => Fin.cons (Ļ x) (Ļs x)) (Fin.cons Ļ' Ļs') x ā
HasDerivAt Ļ Ļ' x ā§ HasDerivAt Ļs Ļs' x :=
hasDerivAt_finCons
theorem HasDerivAt.finCons {Ļ' : F' 0} {Ļs' : Ī i, F' (Fin.succ i)}
(h : HasDerivAt Ļ Ļ' x) (hs : HasDerivAt Ļs Ļs' x) :
HasDerivAt (fun x => Fin.cons (Ļ x) (Ļs x)) (Fin.cons Ļ' Ļs') x :=
hasDerivAt_finCons'.mpr āØh, hsā©
theorem hasDerivWithinAt_finCons {Ļ' : Ī i, F' i} :
HasDerivWithinAt (fun x => Fin.cons (Ļ x) (Ļs x)) Ļ' s x ā
HasDerivWithinAt Ļ (Ļ' 0) s x ā§ HasDerivWithinAt Ļs (fun i => Ļ' i.succ) s x :=
hasDerivAtFilter_finCons
/-- A variant of `hasDerivWithinAt_finCons` where the derivative variables are free on the RHS
instead. -/
theorem hasDerivWithinAt_finCons' {Ļ' : F' 0} {Ļs' : Ī i, F' (Fin.succ i)} :
HasDerivWithinAt (fun x => Fin.cons (Ļ x) (Ļs x)) (Fin.cons Ļ' Ļs') s x ā
HasDerivWithinAt Ļ Ļ' s x ā§ HasDerivWithinAt Ļs Ļs' s x :=
hasDerivAtFilter_finCons
theorem HasDerivWithinAt.finCons {Ļ' : F' 0} {Ļs' : Ī i, F' (Fin.succ i)}
(h : HasDerivWithinAt Ļ Ļ' s x) (hs : HasDerivWithinAt Ļs Ļs' s x) :
HasDerivWithinAt (fun x => Fin.cons (Ļ x) (Ļs x)) (Fin.cons Ļ' Ļs') s x :=
hasDerivWithinAt_finCons'.mpr āØh, hsā©
-- TODO: write the `Fin.cons` versions of `derivWithin_pi` and `deriv_pi`
end PiFin |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/Deriv/AffineMap.lean | import Mathlib.Analysis.Calculus.Deriv.Add
import Mathlib.Analysis.Calculus.Deriv.Linear
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
/-!
# Derivatives of affine maps
In this file we prove formulas for one-dimensional derivatives of affine maps `f : š āįµ[š] E`. We
also specialise some of these results to `AffineMap.lineMap` because it is useful to transfer MVT
from dimension 1 to a domain in higher dimension.
## TODO
Add theorems about `deriv`s and `fderiv`s of `ContinuousAffineMap`s once they will be ported to
Mathlib 4.
## Keywords
affine map, derivative, differentiability
-/
variable {š : Type*} [NontriviallyNormedField š]
{E : Type*} [NormedAddCommGroup E] [NormedSpace š E]
(f : š āįµ[š] E) {a b : E} {L : Filter š} {s : Set š} {x : š}
namespace AffineMap
theorem hasStrictDerivAt : HasStrictDerivAt f (f.linear 1) x := by
rw [f.decomp]
exact f.linear.hasStrictDerivAt.add_const (f 0)
theorem hasDerivAtFilter : HasDerivAtFilter f (f.linear 1) x L := by
rw [f.decomp]
exact f.linear.hasDerivAtFilter.add_const (f 0)
theorem hasDerivWithinAt : HasDerivWithinAt f (f.linear 1) s x := f.hasDerivAtFilter
theorem hasDerivAt : HasDerivAt f (f.linear 1) x := f.hasDerivAtFilter
protected theorem derivWithin (hs : UniqueDiffWithinAt š s x) :
derivWithin f s x = f.linear 1 :=
f.hasDerivWithinAt.derivWithin hs
@[simp] protected theorem deriv : deriv f x = f.linear 1 := f.hasDerivAt.deriv
protected theorem differentiableAt : DifferentiableAt š f x := f.hasDerivAt.differentiableAt
protected theorem differentiable : Differentiable š f := fun _ ⦠f.differentiableAt
protected theorem differentiableWithinAt : DifferentiableWithinAt š f s x :=
f.differentiableAt.differentiableWithinAt
protected theorem differentiableOn : DifferentiableOn š f s := fun _ _ ⦠f.differentiableWithinAt
/-!
### Line map
In this section we specialize some lemmas to `AffineMap.lineMap` because this map is very useful to
deduce higher-dimensional lemmas from one-dimensional versions.
-/
theorem hasStrictDerivAt_lineMap : HasStrictDerivAt (lineMap a b) (b - a) x := by
simpa using (lineMap a b : š āįµ[š] E).hasStrictDerivAt
theorem hasDerivAt_lineMap : HasDerivAt (lineMap a b) (b - a) x :=
hasStrictDerivAt_lineMap.hasDerivAt
theorem hasDerivWithinAt_lineMap : HasDerivWithinAt (lineMap a b) (b - a) s x :=
hasDerivAt_lineMap.hasDerivWithinAt
end AffineMap |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/Deriv/Linear.lean | import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.FDeriv.Linear
/-!
# Derivatives of continuous linear maps from the base field
In this file we prove that `f : š āL[š] E` (or `f : š āā[š] E`) has derivative `f 1`.
For a more detailed overview of one-dimensional derivatives in mathlib, see the module docstring of
`Analysis/Calculus/Deriv/Basic`.
## Keywords
derivative, linear map
-/
universe u v w
open Topology Filter
open Filter Asymptotics Set
variable {š : Type u} [NontriviallyNormedField š]
variable {F : Type v} [NormedAddCommGroup F] [NormedSpace š F]
variable {E : Type w} [NormedAddCommGroup E] [NormedSpace š E]
variable {x : š}
variable {s : Set š}
variable {L : Filter š}
section ContinuousLinearMap
/-! ### Derivative of continuous linear maps -/
variable (e : š āL[š] F)
protected theorem ContinuousLinearMap.hasDerivAtFilter : HasDerivAtFilter e (e 1) x L :=
e.hasFDerivAtFilter.hasDerivAtFilter
protected theorem ContinuousLinearMap.hasStrictDerivAt : HasStrictDerivAt e (e 1) x :=
e.hasStrictFDerivAt.hasStrictDerivAt
protected theorem ContinuousLinearMap.hasDerivAt : HasDerivAt e (e 1) x :=
e.hasDerivAtFilter
protected theorem ContinuousLinearMap.hasDerivWithinAt : HasDerivWithinAt e (e 1) s x :=
e.hasDerivAtFilter
@[simp]
protected theorem ContinuousLinearMap.deriv : deriv e x = e 1 :=
e.hasDerivAt.deriv
protected theorem ContinuousLinearMap.derivWithin (hxs : UniqueDiffWithinAt š s x) :
derivWithin e s x = e 1 :=
e.hasDerivWithinAt.derivWithin hxs
end ContinuousLinearMap
section LinearMap
/-! ### Derivative of bundled linear maps -/
variable (e : š āā[š] F)
protected theorem LinearMap.hasDerivAtFilter : HasDerivAtFilter e (e 1) x L :=
e.toContinuousLinearMapā.hasDerivAtFilter
protected theorem LinearMap.hasStrictDerivAt : HasStrictDerivAt e (e 1) x :=
e.toContinuousLinearMapā.hasStrictDerivAt
protected theorem LinearMap.hasDerivAt : HasDerivAt e (e 1) x :=
e.hasDerivAtFilter
protected theorem LinearMap.hasDerivWithinAt : HasDerivWithinAt e (e 1) s x :=
e.hasDerivAtFilter
@[simp]
protected theorem LinearMap.deriv : deriv e x = e 1 :=
e.hasDerivAt.deriv
protected theorem LinearMap.derivWithin (hxs : UniqueDiffWithinAt š s x) :
derivWithin e s x = e 1 :=
e.hasDerivWithinAt.derivWithin hxs
end LinearMap |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/Deriv/Pi.lean | import Mathlib.Analysis.Calculus.FDeriv.Pi
import Mathlib.Analysis.Calculus.Deriv.Basic
/-!
# One-dimensional derivatives on pi-types.
-/
variable {š ι : Type*} [DecidableEq ι] [Fintype ι] [NontriviallyNormedField š]
theorem hasDerivAt_update (x : ι ā š) (i : ι) (y : š) :
HasDerivAt (Function.update x i) (Pi.single i (1 : š)) y := by
convert (hasFDerivAt_update x y).hasDerivAt
ext z j
rw [Pi.single, Function.update_apply]
split_ifs with h
Ā· simp [h]
Ā· simp [Pi.single_eq_of_ne h]
theorem hasDerivAt_single (i : ι) (y : š) :
HasDerivAt (Pi.single (M := fun _ ⦠š) i) (Pi.single i (1 : š)) y :=
hasDerivAt_update 0 i y
theorem deriv_update (x : ι ā š) (i : ι) (y : š) :
deriv (Function.update x i) y = Pi.single i (1 : š) :=
(hasDerivAt_update x i y).deriv
theorem deriv_single (i : ι) (y : š) :
deriv (Pi.single (M := fun _ ⦠š) i) y = Pi.single i (1 : š) :=
deriv_update 0 i y |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/Deriv/Mul.lean | import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.FDeriv.Mul
import Mathlib.Analysis.Calculus.FDeriv.Add
import Mathlib.Analysis.Calculus.FDeriv.CompCLM
/-!
# Derivative of `f x * g x`
In this file we prove formulas for `(f x * g x)'` and `(f x ⢠g x)'`.
For a more detailed overview of one-dimensional derivatives in mathlib, see the module docstring of
`Analysis/Calculus/Deriv/Basic`.
## Keywords
derivative, multiplication
-/
universe u v w
noncomputable section
open scoped Topology Filter ENNReal
open Filter Asymptotics Set
open ContinuousLinearMap (smulRight smulRight_one_eq_iff)
variable {š : Type u} [NontriviallyNormedField š]
variable {F : Type v} [NormedAddCommGroup F] [NormedSpace š F]
variable {E : Type w} [NormedAddCommGroup E] [NormedSpace š E]
variable {G : Type*} [NormedAddCommGroup G] [NormedSpace š G]
variable {f : š ā F}
variable {f' : F}
variable {x : š}
variable {s : Set š}
variable {L : Filter š}
/-! ### Derivative of bilinear maps -/
namespace ContinuousLinearMap
variable {B : E āL[š] F āL[š] G} {u : š ā E} {v : š ā F} {u' : E} {v' : F}
theorem hasDerivWithinAt_of_bilinear
(hu : HasDerivWithinAt u u' s x) (hv : HasDerivWithinAt v v' s x) :
HasDerivWithinAt (fun x ⦠B (u x) (v x)) (B (u x) v' + B u' (v x)) s x := by
simpa using (B.hasFDerivWithinAt_of_bilinear
hu.hasFDerivWithinAt hv.hasFDerivWithinAt).hasDerivWithinAt
theorem hasDerivAt_of_bilinear (hu : HasDerivAt u u' x) (hv : HasDerivAt v v' x) :
HasDerivAt (fun x ⦠B (u x) (v x)) (B (u x) v' + B u' (v x)) x := by
simpa using (B.hasFDerivAt_of_bilinear hu.hasFDerivAt hv.hasFDerivAt).hasDerivAt
theorem hasStrictDerivAt_of_bilinear (hu : HasStrictDerivAt u u' x) (hv : HasStrictDerivAt v v' x) :
HasStrictDerivAt (fun x ⦠B (u x) (v x)) (B (u x) v' + B u' (v x)) x := by
simpa using
(B.hasStrictFDerivAt_of_bilinear hu.hasStrictFDerivAt hv.hasStrictFDerivAt).hasStrictDerivAt
theorem derivWithin_of_bilinear
(hu : DifferentiableWithinAt š u s x) (hv : DifferentiableWithinAt š v s x) :
derivWithin (fun y => B (u y) (v y)) s x =
B (u x) (derivWithin v s x) + B (derivWithin u s x) (v x) := by
by_cases hsx : UniqueDiffWithinAt š s x
Ā· exact (B.hasDerivWithinAt_of_bilinear hu.hasDerivWithinAt hv.hasDerivWithinAt).derivWithin hsx
Ā· simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]
theorem deriv_of_bilinear (hu : DifferentiableAt š u x) (hv : DifferentiableAt š v x) :
deriv (fun y => B (u y) (v y)) x = B (u x) (deriv v x) + B (deriv u x) (v x) :=
(B.hasDerivAt_of_bilinear hu.hasDerivAt hv.hasDerivAt).deriv
end ContinuousLinearMap
section SMul
/-! ### Derivative of the multiplication of a scalar function and a vector function -/
variable {š' : Type*} [NontriviallyNormedField š'] [NormedAlgebra š š'] [NormedSpace š' F]
[IsScalarTower š š' F] {c : š ā š'} {c' : š'}
theorem HasDerivWithinAt.fun_smul
(hc : HasDerivWithinAt c c' s x) (hf : HasDerivWithinAt f f' s x) :
HasDerivWithinAt (fun y => c y ⢠f y) (c x ⢠f' + c' ⢠f x) s x := by
simpa using (HasFDerivWithinAt.smul hc hf).hasDerivWithinAt
theorem HasDerivWithinAt.smul (hc : HasDerivWithinAt c c' s x) (hf : HasDerivWithinAt f f' s x) :
HasDerivWithinAt (c ⢠f) (c x ⢠f' + c' ⢠f x) s x := by
simpa using (HasFDerivWithinAt.smul hc hf).hasDerivWithinAt
theorem HasDerivAt.fun_smul (hc : HasDerivAt c c' x) (hf : HasDerivAt f f' x) :
HasDerivAt (fun y => c y ⢠f y) (c x ⢠f' + c' ⢠f x) x := by
rw [ā hasDerivWithinAt_univ] at *
exact hc.smul hf
theorem HasDerivAt.smul (hc : HasDerivAt c c' x) (hf : HasDerivAt f f' x) :
HasDerivAt (c ⢠f) (c x ⢠f' + c' ⢠f x) x :=
hc.fun_smul hf
nonrec theorem HasStrictDerivAt.fun_smul
(hc : HasStrictDerivAt c c' x) (hf : HasStrictDerivAt f f' x) :
HasStrictDerivAt (fun y => c y ⢠f y) (c x ⢠f' + c' ⢠f x) x := by
simpa using (hc.smul hf).hasStrictDerivAt
nonrec theorem HasStrictDerivAt.smul (hc : HasStrictDerivAt c c' x) (hf : HasStrictDerivAt f f' x) :
HasStrictDerivAt (c ⢠f) (c x ⢠f' + c' ⢠f x) x := by
simpa using (hc.smul hf).hasStrictDerivAt
theorem derivWithin_fun_smul (hc : DifferentiableWithinAt š c s x)
(hf : DifferentiableWithinAt š f s x) :
derivWithin (fun y => c y ⢠f y) s x = c x ⢠derivWithin f s x + derivWithin c s x ⢠f x := by
by_cases hsx : UniqueDiffWithinAt š s x
Ā· exact (hc.hasDerivWithinAt.smul hf.hasDerivWithinAt).derivWithin hsx
Ā· simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]
theorem derivWithin_smul (hc : DifferentiableWithinAt š c s x)
(hf : DifferentiableWithinAt š f s x) :
derivWithin (c ⢠f) s x = c x ⢠derivWithin f s x + derivWithin c s x ⢠f x :=
derivWithin_fun_smul hc hf
theorem deriv_fun_smul (hc : DifferentiableAt š c x) (hf : DifferentiableAt š f x) :
deriv (fun y => c y ⢠f y) x = c x ⢠deriv f x + deriv c x ⢠f x :=
(hc.hasDerivAt.smul hf.hasDerivAt).deriv
theorem deriv_smul (hc : DifferentiableAt š c x) (hf : DifferentiableAt š f x) :
deriv (c ⢠f) x = c x ⢠deriv f x + deriv c x ⢠f x :=
(hc.hasDerivAt.smul hf.hasDerivAt).deriv
theorem HasStrictDerivAt.smul_const (hc : HasStrictDerivAt c c' x) (f : F) :
HasStrictDerivAt (fun y => c y ⢠f) (c' ⢠f) x := by
have := hc.smul (hasStrictDerivAt_const x f)
rwa [smul_zero, zero_add] at this
theorem HasDerivWithinAt.smul_const (hc : HasDerivWithinAt c c' s x) (f : F) :
HasDerivWithinAt (fun y => c y ⢠f) (c' ⢠f) s x := by
have := hc.smul (hasDerivWithinAt_const x s f)
rwa [smul_zero, zero_add] at this
theorem HasDerivAt.smul_const (hc : HasDerivAt c c' x) (f : F) :
HasDerivAt (fun y => c y ⢠f) (c' ⢠f) x := by
rw [ā hasDerivWithinAt_univ] at *
exact hc.smul_const f
theorem derivWithin_smul_const (hc : DifferentiableWithinAt š c s x) (f : F) :
derivWithin (fun y => c y ⢠f) s x = derivWithin c s x ⢠f := by
by_cases hsx : UniqueDiffWithinAt š s x
Ā· exact (hc.hasDerivWithinAt.smul_const f).derivWithin hsx
Ā· simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]
theorem deriv_smul_const (hc : DifferentiableAt š c x) (f : F) :
deriv (fun y => c y ⢠f) x = deriv c x ⢠f :=
(hc.hasDerivAt.smul_const f).deriv
end SMul
section ConstSMul
variable {R : Type*} [Semiring R] [Module R F] [SMulCommClass š R F] [ContinuousConstSMul R F]
nonrec theorem HasStrictDerivAt.fun_const_smul (c : R) (hf : HasStrictDerivAt f f' x) :
HasStrictDerivAt (fun y => c ⢠f y) (c ⢠f') x := by
simpa using (hf.const_smul c).hasStrictDerivAt
nonrec theorem HasStrictDerivAt.const_smul (c : R) (hf : HasStrictDerivAt f f' x) :
HasStrictDerivAt (c ⢠f) (c ⢠f') x := by
simpa using (hf.const_smul c).hasStrictDerivAt
nonrec theorem HasDerivAtFilter.fun_const_smul (c : R) (hf : HasDerivAtFilter f f' x L) :
HasDerivAtFilter (fun y => c ⢠f y) (c ⢠f') x L := by
simpa using (hf.const_smul c).hasDerivAtFilter
nonrec theorem HasDerivAtFilter.const_smul (c : R) (hf : HasDerivAtFilter f f' x L) :
HasDerivAtFilter (c ⢠f) (c ⢠f') x L := by
simpa using (hf.const_smul c).hasDerivAtFilter
nonrec theorem HasDerivWithinAt.fun_const_smul (c : R) (hf : HasDerivWithinAt f f' s x) :
HasDerivWithinAt (fun y => c ⢠f y) (c ⢠f') s x :=
hf.const_smul c
nonrec theorem HasDerivWithinAt.const_smul (c : R) (hf : HasDerivWithinAt f f' s x) :
HasDerivWithinAt (c ⢠f) (c ⢠f') s x :=
hf.const_smul c
nonrec theorem HasDerivAt.fun_const_smul (c : R) (hf : HasDerivAt f f' x) :
HasDerivAt (fun y => c ⢠f y) (c ⢠f') x :=
hf.const_smul c
nonrec theorem HasDerivAt.const_smul (c : R) (hf : HasDerivAt f f' x) :
HasDerivAt (c ⢠f) (c ⢠f') x :=
hf.const_smul c
theorem derivWithin_fun_const_smul (c : R) (hf : DifferentiableWithinAt š f s x) :
derivWithin (fun y => c ⢠f y) s x = c ⢠derivWithin f s x := by
by_cases hsx : UniqueDiffWithinAt š s x
Ā· exact (hf.hasDerivWithinAt.const_smul c).derivWithin hsx
Ā· simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]
theorem derivWithin_const_smul (c : R) (hf : DifferentiableWithinAt š f s x) :
derivWithin (c ⢠f) s x = c ⢠derivWithin f s x :=
derivWithin_fun_const_smul c hf
/-- A variant of `derivWithin_fun_const_smul` without differentiability assumption when the scalar
multiplication is by field elements. -/
lemma derivWithin_fun_const_smul' {f : š ā F} {x : š} {R : Type*} [Field R] [Module R F]
[SMulCommClass š R F] [ContinuousConstSMul R F] (c : R) :
derivWithin (fun y ⦠c ⢠f y) s x = c ⢠derivWithin f s x := by
by_cases hsx : UniqueDiffWithinAt š s x
Ā· simp [ā fderivWithin_derivWithin, ā Pi.smul_def, fderivWithin_const_smul_field c hsx]
Ā· simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]
/-- A variant of `derivWithin_const_smul` without differentiability assumption when the scalar
multiplication is by field elements. -/
lemma derivWithin_const_smul' {f : š ā F} {x : š} {R : Type*} [Field R] [Module R F]
[SMulCommClass š R F] [ContinuousConstSMul R F] (c : R) :
derivWithin (c ⢠f) s x = c ⢠derivWithin f s x :=
derivWithin_fun_const_smul' c
theorem deriv_fun_const_smul (c : R) (hf : DifferentiableAt š f x) :
deriv (fun y => c ⢠f y) x = c ⢠deriv f x :=
(hf.hasDerivAt.const_smul c).deriv
theorem deriv_const_smul (c : R) (hf : DifferentiableAt š f x) :
deriv (c ⢠f) x = c ⢠deriv f x :=
(hf.hasDerivAt.const_smul c).deriv
/-- A variant of `deriv_const_smul` without differentiability assumption when the scalar
multiplication is by field elements. -/
lemma deriv_fun_const_smul' {f : š ā F} {x : š}
{R : Type*} [Field R] [Module R F] [SMulCommClass š R F] [ContinuousConstSMul R F] (c : R) :
deriv (fun y ⦠c ⢠f y) x = c ⢠deriv f x := by
simp only [ā derivWithin_univ, derivWithin_fun_const_smul']
/-- A variant of `deriv_const_smul` without differentiability assumption when the scalar
multiplication is by field elements. -/
lemma deriv_const_smul' {f : š ā F} {x : š}
{R : Type*} [Field R] [Module R F] [SMulCommClass š R F] [ContinuousConstSMul R F] (c : R) :
deriv (c ⢠f) x = c ⢠deriv f x := by
simp only [ā derivWithin_univ, derivWithin_const_smul']
end ConstSMul
section Mul
/-! ### Derivative of the multiplication of two functions -/
variable {š' šø : Type*} [NormedField š'] [NormedRing šø] [NormedAlgebra š š'] [NormedAlgebra š šø]
{c d : š ā šø} {c' d' : šø} {u v : š ā š'}
theorem HasDerivWithinAt.fun_mul (hc : HasDerivWithinAt c c' s x) (hd : HasDerivWithinAt d d' s x) :
HasDerivWithinAt (fun y => c y * d y) (c' * d x + c x * d') s x := by
have := (HasFDerivWithinAt.mul' hc hd).hasDerivWithinAt
rwa [ContinuousLinearMap.add_apply, ContinuousLinearMap.smul_apply,
ContinuousLinearMap.smulRight_apply, ContinuousLinearMap.smul_apply,
ContinuousLinearMap.smulRight_apply, ContinuousLinearMap.one_apply, one_smul, one_smul,
add_comm] at this
theorem HasDerivWithinAt.mul (hc : HasDerivWithinAt c c' s x) (hd : HasDerivWithinAt d d' s x) :
HasDerivWithinAt (c * d) (c' * d x + c x * d') s x :=
hc.fun_mul hd
theorem HasDerivAt.fun_mul (hc : HasDerivAt c c' x) (hd : HasDerivAt d d' x) :
HasDerivAt (fun y => c y * d y) (c' * d x + c x * d') x := by
rw [ā hasDerivWithinAt_univ] at *
exact hc.mul hd
theorem HasDerivAt.mul (hc : HasDerivAt c c' x) (hd : HasDerivAt d d' x) :
HasDerivAt (c * d) (c' * d x + c x * d') x :=
hc.fun_mul hd
theorem HasStrictDerivAt.fun_mul (hc : HasStrictDerivAt c c' x) (hd : HasStrictDerivAt d d' x) :
HasStrictDerivAt (fun y => c y * d y) (c' * d x + c x * d') x := by
have := (HasStrictFDerivAt.mul' hc hd).hasStrictDerivAt
rwa [ContinuousLinearMap.add_apply, ContinuousLinearMap.smul_apply,
ContinuousLinearMap.smulRight_apply, ContinuousLinearMap.smul_apply,
ContinuousLinearMap.smulRight_apply, ContinuousLinearMap.one_apply, one_smul, one_smul,
add_comm] at this
theorem HasStrictDerivAt.mul (hc : HasStrictDerivAt c c' x) (hd : HasStrictDerivAt d d' x) :
HasStrictDerivAt (c * d) (c' * d x + c x * d') x :=
hc.fun_mul hd
theorem derivWithin_fun_mul (hc : DifferentiableWithinAt š c s x)
(hd : DifferentiableWithinAt š d s x) :
derivWithin (fun y => c y * d y) s x = derivWithin c s x * d x + c x * derivWithin d s x := by
by_cases hsx : UniqueDiffWithinAt š s x
Ā· exact (hc.hasDerivWithinAt.mul hd.hasDerivWithinAt).derivWithin hsx
Ā· simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]
theorem derivWithin_mul (hc : DifferentiableWithinAt š c s x)
(hd : DifferentiableWithinAt š d s x) :
derivWithin (c * d) s x = derivWithin c s x * d x + c x * derivWithin d s x :=
derivWithin_fun_mul hc hd
@[simp]
theorem deriv_fun_mul (hc : DifferentiableAt š c x) (hd : DifferentiableAt š d x) :
deriv (fun y => c y * d y) x = deriv c x * d x + c x * deriv d x :=
(hc.hasDerivAt.mul hd.hasDerivAt).deriv
@[simp]
theorem deriv_mul (hc : DifferentiableAt š c x) (hd : DifferentiableAt š d x) :
deriv (c * d) x = deriv c x * d x + c x * deriv d x :=
(hc.hasDerivAt.mul hd.hasDerivAt).deriv
theorem HasDerivWithinAt.mul_const (hc : HasDerivWithinAt c c' s x) (d : šø) :
HasDerivWithinAt (fun y => c y * d) (c' * d) s x := by
convert hc.mul (hasDerivWithinAt_const x s d) using 1
rw [mul_zero, add_zero]
theorem HasDerivAt.mul_const (hc : HasDerivAt c c' x) (d : šø) :
HasDerivAt (fun y => c y * d) (c' * d) x := by
rw [ā hasDerivWithinAt_univ] at *
exact hc.mul_const d
theorem hasDerivAt_mul_const (c : š) : HasDerivAt (fun x => x * c) c x := by
simpa only [one_mul] using (hasDerivAt_id' x).mul_const c
theorem HasStrictDerivAt.mul_const (hc : HasStrictDerivAt c c' x) (d : šø) :
HasStrictDerivAt (fun y => c y * d) (c' * d) x := by
convert hc.mul (hasStrictDerivAt_const x d) using 1
rw [mul_zero, add_zero]
theorem derivWithin_mul_const (hc : DifferentiableWithinAt š c s x) (d : šø) :
derivWithin (fun y => c y * d) s x = derivWithin c s x * d := by
by_cases hsx : UniqueDiffWithinAt š s x
Ā· exact (hc.hasDerivWithinAt.mul_const d).derivWithin hsx
Ā· simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]
lemma derivWithin_mul_const_field (u : š') :
derivWithin (fun y => v y * u) s x = derivWithin v s x * u := by
by_cases hv : DifferentiableWithinAt š v s x
Ā· rw [derivWithin_mul_const hv u]
by_cases hu : u = 0
Ā· simp [hu]
rw [derivWithin_zero_of_not_differentiableWithinAt hv, zero_mul,
derivWithin_zero_of_not_differentiableWithinAt]
have : v = fun x ⦠(v x * u) * uā»Ā¹ := by ext; simp [hu]
exact fun h_diff ⦠hv <| this ⸠h_diff.mul_const _
theorem deriv_mul_const (hc : DifferentiableAt š c x) (d : šø) :
deriv (fun y => c y * d) x = deriv c x * d :=
(hc.hasDerivAt.mul_const d).deriv
theorem deriv_mul_const_field (v : š') : deriv (fun y => u y * v) x = deriv u x * v := by
by_cases hu : DifferentiableAt š u x
Ā· exact deriv_mul_const hu v
Ā· rw [deriv_zero_of_not_differentiableAt hu, zero_mul]
rcases eq_or_ne v 0 with (rfl | hd)
Ā· simp only [mul_zero, deriv_const]
Ā· refine deriv_zero_of_not_differentiableAt (mt (fun H => ?_) hu)
simpa only [mul_inv_cancel_rightā hd] using H.mul_const vā»Ā¹
@[simp]
theorem deriv_mul_const_field' (v : š') : (deriv fun x => u x * v) = fun x => deriv u x * v :=
funext fun _ => deriv_mul_const_field v
theorem HasDerivWithinAt.const_mul (c : šø) (hd : HasDerivWithinAt d d' s x) :
HasDerivWithinAt (fun y => c * d y) (c * d') s x := by
convert (hasDerivWithinAt_const x s c).mul hd using 1
rw [zero_mul, zero_add]
theorem HasDerivAt.const_mul (c : šø) (hd : HasDerivAt d d' x) :
HasDerivAt (fun y => c * d y) (c * d') x := by
rw [ā hasDerivWithinAt_univ] at *
exact hd.const_mul c
theorem HasStrictDerivAt.const_mul (c : šø) (hd : HasStrictDerivAt d d' x) :
HasStrictDerivAt (fun y => c * d y) (c * d') x := by
convert (hasStrictDerivAt_const _ _).mul hd using 1
rw [zero_mul, zero_add]
theorem derivWithin_const_mul (c : šø) (hd : DifferentiableWithinAt š d s x) :
derivWithin (fun y => c * d y) s x = c * derivWithin d s x := by
by_cases hsx : UniqueDiffWithinAt š s x
Ā· exact (hd.hasDerivWithinAt.const_mul c).derivWithin hsx
Ā· simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]
lemma derivWithin_const_mul_field (u : š') :
derivWithin (fun y => u * v y) s x = u * derivWithin v s x := by
simp_rw [mul_comm u]
exact derivWithin_mul_const_field u
theorem deriv_const_mul (c : šø) (hd : DifferentiableAt š d x) :
deriv (fun y => c * d y) x = c * deriv d x :=
(hd.hasDerivAt.const_mul c).deriv
theorem deriv_const_mul_field (u : š') : deriv (fun y => u * v y) x = u * deriv v x := by
simp only [mul_comm u, deriv_mul_const_field]
@[simp]
theorem deriv_const_mul_field' (u : š') : (deriv fun x => u * v x) = fun x => u * deriv v x :=
funext fun _ => deriv_const_mul_field u
end Mul
section Prod
section HasDeriv
variable {ι : Type*} [DecidableEq ι] {šø' : Type*} [NormedCommRing šø'] [NormedAlgebra š šø']
{u : Finset ι} {f : ι ā š ā šø'} {f' : ι ā šø'}
theorem HasDerivAt.fun_finset_prod (hf : ā i ā u, HasDerivAt (f i) (f' i) x) :
HasDerivAt (ā i ā u, f i Ā·) (ā i ā u, (ā j ā u.erase i, f j x) ⢠f' i) x := by
simpa [ContinuousLinearMap.sum_apply, ContinuousLinearMap.smul_apply] using
(HasFDerivAt.finset_prod (fun i hi ⦠(hf i hi).hasFDerivAt)).hasDerivAt
theorem HasDerivAt.finset_prod (hf : ā i ā u, HasDerivAt (f i) (f' i) x) :
HasDerivAt (ā i ā u, f i) (ā i ā u, (ā j ā u.erase i, f j x) ⢠f' i) x := by
convert HasDerivAt.fun_finset_prod hf; simp
theorem HasDerivWithinAt.fun_finset_prod (hf : ā i ā u, HasDerivWithinAt (f i) (f' i) s x) :
HasDerivWithinAt (ā i ā u, f i Ā·) (ā i ā u, (ā j ā u.erase i, f j x) ⢠f' i) s x := by
simpa [ContinuousLinearMap.sum_apply, ContinuousLinearMap.smul_apply] using
(HasFDerivWithinAt.finset_prod (fun i hi ⦠(hf i hi).hasFDerivWithinAt)).hasDerivWithinAt
theorem HasDerivWithinAt.finset_prod (hf : ā i ā u, HasDerivWithinAt (f i) (f' i) s x) :
HasDerivWithinAt (ā i ā u, f i) (ā i ā u, (ā j ā u.erase i, f j x) ⢠f' i) s x := by
convert HasDerivWithinAt.fun_finset_prod hf; simp
theorem HasStrictDerivAt.fun_finset_prod (hf : ā i ā u, HasStrictDerivAt (f i) (f' i) x) :
HasStrictDerivAt (ā i ā u, f i Ā·) (ā i ā u, (ā j ā u.erase i, f j x) ⢠f' i) x := by
simpa [ContinuousLinearMap.sum_apply, ContinuousLinearMap.smul_apply] using
(HasStrictFDerivAt.finset_prod (fun i hi ⦠(hf i hi).hasStrictFDerivAt)).hasStrictDerivAt
theorem HasStrictDerivAt.finset_prod (hf : ā i ā u, HasStrictDerivAt (f i) (f' i) x) :
HasStrictDerivAt (ā i ā u, f i) (ā i ā u, (ā j ā u.erase i, f j x) ⢠f' i) x := by
convert HasStrictDerivAt.fun_finset_prod hf; simp
theorem deriv_fun_finset_prod (hf : ā i ā u, DifferentiableAt š (f i) x) :
deriv (ā i ā u, f i Ā·) x = ā i ā u, (ā j ā u.erase i, f j x) ⢠deriv (f i) x :=
(HasDerivAt.fun_finset_prod fun i hi ⦠(hf i hi).hasDerivAt).deriv
theorem deriv_finset_prod (hf : ā i ā u, DifferentiableAt š (f i) x) :
deriv (ā i ā u, f i) x = ā i ā u, (ā j ā u.erase i, f j x) ⢠deriv (f i) x :=
(HasDerivAt.finset_prod fun i hi ⦠(hf i hi).hasDerivAt).deriv
theorem derivWithin_fun_finset_prod (hf : ā i ā u, DifferentiableWithinAt š (f i) s x) :
derivWithin (ā i ā u, f i Ā·) s x =
ā i ā u, (ā j ā u.erase i, f j x) ⢠derivWithin (f i) s x := by
by_cases hsx : UniqueDiffWithinAt š s x
· exact (HasDerivWithinAt.fun_finset_prod fun i hi ⦠(hf i hi).hasDerivWithinAt).derivWithin hsx
Ā· simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]
theorem derivWithin_finset_prod (hf : ā i ā u, DifferentiableWithinAt š (f i) s x) :
derivWithin (ā i ā u, f i) s x =
ā i ā u, (ā j ā u.erase i, f j x) ⢠derivWithin (f i) s x := by
convert derivWithin_fun_finset_prod hf; simp
end HasDeriv
variable {ι : Type*} {šø' : Type*} [NormedCommRing šø'] [NormedAlgebra š šø']
{u : Finset ι} {f : ι ā š ā šø'}
@[fun_prop]
theorem DifferentiableAt.fun_finset_prod (hd : ā i ā u, DifferentiableAt š (f i) x) :
DifferentiableAt š (ā i ā u, f i Ā·) x := by
classical
exact
(HasDerivAt.fun_finset_prod (fun i hi ⦠DifferentiableAt.hasDerivAt (hd i hi))).differentiableAt
@[fun_prop]
theorem DifferentiableAt.finset_prod (hd : ā i ā u, DifferentiableAt š (f i) x) :
DifferentiableAt š (ā i ā u, f i) x := by
convert DifferentiableAt.fun_finset_prod hd; simp
@[fun_prop]
theorem DifferentiableWithinAt.fun_finset_prod (hd : ā i ā u, DifferentiableWithinAt š (f i) s x) :
DifferentiableWithinAt š (ā i ā u, f i Ā·) s x := by
classical
exact (HasDerivWithinAt.fun_finset_prod (fun i hi ā¦
DifferentiableWithinAt.hasDerivWithinAt (hd i hi))).differentiableWithinAt
@[fun_prop]
theorem DifferentiableWithinAt.finset_prod (hd : ā i ā u, DifferentiableWithinAt š (f i) s x) :
DifferentiableWithinAt š (ā i ā u, f i) s x := by
convert DifferentiableWithinAt.fun_finset_prod hd; simp
@[fun_prop]
theorem DifferentiableOn.fun_finset_prod (hd : ā i ā u, DifferentiableOn š (f i) s) :
DifferentiableOn š (ā i ā u, f i Ā·) s :=
fun x hx ⦠.fun_finset_prod (fun i hi ⦠hd i hi x hx)
@[fun_prop]
theorem DifferentiableOn.finset_prod (hd : ā i ā u, DifferentiableOn š (f i) s) :
DifferentiableOn š (ā i ā u, f i) s :=
fun x hx ⦠.finset_prod (fun i hi ⦠hd i hi x hx)
@[fun_prop]
theorem Differentiable.fun_finset_prod (hd : ā i ā u, Differentiable š (f i)) :
Differentiable š (ā i ā u, f i Ā·) :=
fun x ⦠.fun_finset_prod (fun i hi ⦠hd i hi x)
@[fun_prop]
theorem Differentiable.finset_prod (hd : ā i ā u, Differentiable š (f i)) :
Differentiable š (ā i ā u, f i) :=
fun x ⦠.finset_prod (fun i hi ⦠hd i hi x)
end Prod
section Div
variable {š' : Type*} [NontriviallyNormedField š'] [NormedAlgebra š š'] {c : š ā š'} {c' : š'}
theorem HasDerivAt.div_const (hc : HasDerivAt c c' x) (d : š') :
HasDerivAt (fun x => c x / d) (c' / d) x := by
simpa only [div_eq_mul_inv] using hc.mul_const dā»Ā¹
theorem HasDerivWithinAt.div_const (hc : HasDerivWithinAt c c' s x) (d : š') :
HasDerivWithinAt (fun x => c x / d) (c' / d) s x := by
simpa only [div_eq_mul_inv] using hc.mul_const dā»Ā¹
theorem HasStrictDerivAt.div_const (hc : HasStrictDerivAt c c' x) (d : š') :
HasStrictDerivAt (fun x => c x / d) (c' / d) x := by
simpa only [div_eq_mul_inv] using hc.mul_const dā»Ā¹
@[fun_prop]
theorem DifferentiableWithinAt.div_const (hc : DifferentiableWithinAt š c s x) (d : š') :
DifferentiableWithinAt š (fun x => c x / d) s x :=
(hc.hasDerivWithinAt.div_const _).differentiableWithinAt
@[simp, fun_prop]
theorem DifferentiableAt.div_const (hc : DifferentiableAt š c x) (d : š') :
DifferentiableAt š (fun x => c x / d) x :=
(hc.hasDerivAt.div_const _).differentiableAt
@[fun_prop]
theorem DifferentiableOn.div_const (hc : DifferentiableOn š c s) (d : š') :
DifferentiableOn š (fun x => c x / d) s := fun x hx => (hc x hx).div_const d
@[simp, fun_prop]
theorem Differentiable.div_const (hc : Differentiable š c) (d : š') :
Differentiable š fun x => c x / d := fun x => (hc x).div_const d
theorem derivWithin_div_const (hc : DifferentiableWithinAt š c s x) (d : š') :
derivWithin (fun x => c x / d) s x = derivWithin c s x / d := by
simp [div_eq_inv_mul, derivWithin_const_mul, hc]
@[simp]
theorem deriv_div_const (d : š') : deriv (fun x => c x / d) x = deriv c x / d := by
simp only [div_eq_mul_inv, deriv_mul_const_field]
end Div
section CLMCompApply
/-! ### Derivative of the pointwise composition/application of continuous linear maps -/
open ContinuousLinearMap
variable {G : Type*} [NormedAddCommGroup G] [NormedSpace š G] {c : š ā F āL[š] G} {c' : F āL[š] G}
{d : š ā E āL[š] F} {d' : E āL[š] F} {u : š ā F} {u' : F}
theorem HasStrictDerivAt.clm_comp (hc : HasStrictDerivAt c c' x) (hd : HasStrictDerivAt d d' x) :
HasStrictDerivAt (fun y => (c y).comp (d y)) (c'.comp (d x) + (c x).comp d') x := by
have := (hc.hasStrictFDerivAt.clm_comp hd.hasStrictFDerivAt).hasStrictDerivAt
rwa [add_apply, comp_apply, comp_apply, smulRight_apply, smulRight_apply, one_apply, one_smul,
one_smul, add_comm] at this
theorem HasDerivWithinAt.clm_comp (hc : HasDerivWithinAt c c' s x)
(hd : HasDerivWithinAt d d' s x) :
HasDerivWithinAt (fun y => (c y).comp (d y)) (c'.comp (d x) + (c x).comp d') s x := by
have := (hc.hasFDerivWithinAt.clm_comp hd.hasFDerivWithinAt).hasDerivWithinAt
rwa [add_apply, comp_apply, comp_apply, smulRight_apply, smulRight_apply, one_apply, one_smul,
one_smul, add_comm] at this
theorem HasDerivAt.clm_comp (hc : HasDerivAt c c' x) (hd : HasDerivAt d d' x) :
HasDerivAt (fun y => (c y).comp (d y)) (c'.comp (d x) + (c x).comp d') x := by
rw [ā hasDerivWithinAt_univ] at *
exact hc.clm_comp hd
theorem derivWithin_clm_comp (hc : DifferentiableWithinAt š c s x)
(hd : DifferentiableWithinAt š d s x) :
derivWithin (fun y => (c y).comp (d y)) s x =
(derivWithin c s x).comp (d x) + (c x).comp (derivWithin d s x) := by
by_cases hsx : UniqueDiffWithinAt š s x
Ā· exact (hc.hasDerivWithinAt.clm_comp hd.hasDerivWithinAt).derivWithin hsx
Ā· simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]
theorem deriv_clm_comp (hc : DifferentiableAt š c x) (hd : DifferentiableAt š d x) :
deriv (fun y => (c y).comp (d y)) x = (deriv c x).comp (d x) + (c x).comp (deriv d x) :=
(hc.hasDerivAt.clm_comp hd.hasDerivAt).deriv
theorem HasStrictDerivAt.clm_apply (hc : HasStrictDerivAt c c' x) (hu : HasStrictDerivAt u u' x) :
HasStrictDerivAt (fun y => (c y) (u y)) (c' (u x) + c x u') x := by
have := (hc.hasStrictFDerivAt.clm_apply hu.hasStrictFDerivAt).hasStrictDerivAt
rwa [add_apply, comp_apply, flip_apply, smulRight_apply, smulRight_apply, one_apply, one_smul,
one_smul, add_comm] at this
theorem HasDerivWithinAt.clm_apply (hc : HasDerivWithinAt c c' s x)
(hu : HasDerivWithinAt u u' s x) :
HasDerivWithinAt (fun y => (c y) (u y)) (c' (u x) + c x u') s x := by
have := (hc.hasFDerivWithinAt.clm_apply hu.hasFDerivWithinAt).hasDerivWithinAt
rwa [add_apply, comp_apply, flip_apply, smulRight_apply, smulRight_apply, one_apply, one_smul,
one_smul, add_comm] at this
theorem HasDerivAt.clm_apply (hc : HasDerivAt c c' x) (hu : HasDerivAt u u' x) :
HasDerivAt (fun y => (c y) (u y)) (c' (u x) + c x u') x := by
have := (hc.hasFDerivAt.clm_apply hu.hasFDerivAt).hasDerivAt
rwa [add_apply, comp_apply, flip_apply, smulRight_apply, smulRight_apply, one_apply, one_smul,
one_smul, add_comm] at this
theorem derivWithin_clm_apply (hc : DifferentiableWithinAt š c s x)
(hu : DifferentiableWithinAt š u s x) :
derivWithin (fun y => (c y) (u y)) s x = derivWithin c s x (u x) + c x (derivWithin u s x) := by
by_cases hsx : UniqueDiffWithinAt š s x
Ā· exact (hc.hasDerivWithinAt.clm_apply hu.hasDerivWithinAt).derivWithin hsx
Ā· simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]
theorem deriv_clm_apply (hc : DifferentiableAt š c x) (hu : DifferentiableAt š u x) :
deriv (fun y => (c y) (u y)) x = deriv c x (u x) + c x (deriv u x) :=
(hc.hasDerivAt.clm_apply hu.hasDerivAt).deriv
end CLMCompApply |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/Deriv/Basic.lean | import Mathlib.Analysis.Calculus.FDeriv.Const
import Mathlib.Analysis.Normed.Operator.NormedSpace
import Mathlib.Analysis.Calculus.TangentCone.DimOne
import Mathlib.Analysis.Calculus.TangentCone.Real
/-!
# One-dimensional derivatives
This file defines the derivative of a function `f : š ā F` where `š` is a
normed field and `F` is a normed space over this field. The derivative of
such a function `f` at a point `x` is given by an element `f' : F`.
The theory is developed analogously to the [FrƩchet
derivatives](./fderiv.html). We first introduce predicates defined in terms
of the corresponding predicates for FrƩchet derivatives:
- `HasDerivAtFilter f f' x L` states that the function `f` has the
derivative `f'` at the point `x` as `x` goes along the filter `L`.
- `HasDerivWithinAt f f' s x` states that the function `f` has the
derivative `f'` at the point `x` within the subset `s`.
- `HasDerivAt f f' x` states that the function `f` has the derivative `f'`
at the point `x`.
- `HasStrictDerivAt f f' x` states that the function `f` has the derivative `f'`
at the point `x` in the sense of strict differentiability, i.e.,
`f y - f z = (y - z) ⢠f' + o (y - z)` as `y, z ā x`.
For the last two notions we also define a functional version:
- `derivWithin f s x` is a derivative of `f` at `x` within `s`. If the
derivative does not exist, then `derivWithin f s x` equals zero.
- `deriv f x` is a derivative of `f` at `x`. If the derivative does not
exist, then `deriv f x` equals zero.
The theorems `fderivWithin_derivWithin` and `fderiv_deriv` show that the
one-dimensional derivatives coincide with the general FrƩchet derivatives.
We also show the existence and compute the derivatives of:
- constants
- the identity function
- linear maps (in `Linear.lean`)
- addition (in `Add.lean`)
- sum of finitely many functions (in `Add.lean`)
- negation (in `Add.lean`)
- subtraction (in `Add.lean`)
- star (in `Star.lean`)
- multiplication of two functions in `š ā š` (in `Mul.lean`)
- multiplication of a function in `š ā š` and of a function in `š ā E` (in `Mul.lean`)
- powers of a function (in `Pow.lean` and `ZPow.lean`)
- inverse `x ā xā»Ā¹` (in `Inv.lean`)
- division (in `Inv.lean`)
- composition of a function in `š ā F` with a function in `š ā š` (in `Comp.lean`)
- composition of a function in `F ā E` with a function in `š ā F` (in `Comp.lean`)
- inverse function (assuming that it exists; the inverse function theorem is in `Inverse.lean`)
- polynomials (in `Polynomial.lean`)
For most binary operations we also define `const_op` and `op_const` theorems for the cases when
the first or second argument is a constant. This makes writing chains of `HasDerivAt`'s easier,
and they more frequently lead to the desired result.
We set up the simplifier so that it can compute the derivative of simple functions. For instance,
```lean
example (x : ā) :
deriv (fun x ⦠cos (sin x) * exp x) x = (cos (sin x) - sin (sin x) * cos x) * exp x := by
simp; ring
```
The relationship between the derivative of a function and its definition from a standard
undergraduate course as the limit of the slope `(f y - f x) / (y - x)` as `y` tends to `š[ā ] x`
is developed in the file `Slope.lean`.
## Implementation notes
Most of the theorems are direct restatements of the corresponding theorems
for FrƩchet derivatives.
The strategy to construct simp lemmas that give the simplifier the possibility to compute
derivatives is the same as the one for differentiability statements, as explained in
`FDeriv/Basic.lean`. See the explanations there.
-/
universe u v w
noncomputable section
open scoped Topology ENNReal NNReal
open Filter Asymptotics Set
open ContinuousLinearMap (smulRight smulRight_one_eq_iff)
section TVS
variable {š : Type u} [NontriviallyNormedField š]
variable {F : Type v} [AddCommGroup F] [Module š F] [TopologicalSpace F]
section
variable [ContinuousSMul š F]
/-- `f` has the derivative `f'` at the point `x` as `x` goes along the filter `L`.
That is, `f x' = f x + (x' - x) ⢠f' + o(x' - x)` where `x'` converges along the filter `L`.
-/
def HasDerivAtFilter (f : š ā F) (f' : F) (x : š) (L : Filter š) :=
HasFDerivAtFilter f (smulRight (1 : š āL[š] š) f') x L
/-- `f` has the derivative `f'` at the point `x` within the subset `s`.
That is, `f x' = f x + (x' - x) ⢠f' + o(x' - x)` where `x'` converges to `x` inside `s`.
-/
def HasDerivWithinAt (f : š ā F) (f' : F) (s : Set š) (x : š) :=
HasDerivAtFilter f f' x (š[s] x)
/-- `f` has the derivative `f'` at the point `x`.
That is, `f x' = f x + (x' - x) ⢠f' + o(x' - x)` where `x'` converges to `x`.
-/
def HasDerivAt (f : š ā F) (f' : F) (x : š) :=
HasDerivAtFilter f f' x (š x)
/-- `f` has the derivative `f'` at the point `x` in the sense of strict differentiability.
That is, `f y - f z = (y - z) ⢠f' + o(y - z)` as `y, z ā x`. -/
def HasStrictDerivAt (f : š ā F) (f' : F) (x : š) :=
HasStrictFDerivAt f (smulRight (1 : š āL[š] š) f') x
end
/-- Derivative of `f` at the point `x` within the set `s`, if it exists. Zero otherwise.
If the derivative exists (i.e., `ā f', HasDerivWithinAt f f' s x`), then
`f x' = f x + (x' - x) ⢠derivWithin f s x + o(x' - x)` where `x'` converges to `x` inside `s`.
-/
def derivWithin (f : š ā F) (s : Set š) (x : š) :=
fderivWithin š f s x 1
/-- Derivative of `f` at the point `x`, if it exists. Zero otherwise.
If the derivative exists (i.e., `ā f', HasDerivAt f f' x`), then
`f x' = f x + (x' - x) ⢠deriv f x + o(x' - x)` where `x'` converges to `x`.
-/
def deriv (f : š ā F) (x : š) :=
fderiv š f x 1
variable {f fā fā : š ā F}
variable {f' fā' fā' g' : F}
variable {x : š}
variable {s t : Set š}
variable {L Lā Lā : Filter š}
section
variable [ContinuousSMul š F]
/-- Expressing `HasFDerivAtFilter f f' x L` in terms of `HasDerivAtFilter` -/
theorem hasFDerivAtFilter_iff_hasDerivAtFilter {f' : š āL[š] F} :
HasFDerivAtFilter f f' x L ā HasDerivAtFilter f (f' 1) x L := by simp [HasDerivAtFilter]
theorem HasFDerivAtFilter.hasDerivAtFilter {f' : š āL[š] F} :
HasFDerivAtFilter f f' x L ā HasDerivAtFilter f (f' 1) x L :=
hasFDerivAtFilter_iff_hasDerivAtFilter.mp
/-- Expressing `HasFDerivWithinAt f f' s x` in terms of `HasDerivWithinAt` -/
theorem hasFDerivWithinAt_iff_hasDerivWithinAt {f' : š āL[š] F} :
HasFDerivWithinAt f f' s x ā HasDerivWithinAt f (f' 1) s x :=
hasFDerivAtFilter_iff_hasDerivAtFilter
/-- Expressing `HasDerivWithinAt f f' s x` in terms of `HasFDerivWithinAt` -/
theorem hasDerivWithinAt_iff_hasFDerivWithinAt {f' : F} :
HasDerivWithinAt f f' s x ā HasFDerivWithinAt f (smulRight (1 : š āL[š] š) f') s x :=
Iff.rfl
theorem HasFDerivWithinAt.hasDerivWithinAt {f' : š āL[š] F} :
HasFDerivWithinAt f f' s x ā HasDerivWithinAt f (f' 1) s x :=
hasFDerivWithinAt_iff_hasDerivWithinAt.mp
theorem HasDerivWithinAt.hasFDerivWithinAt {f' : F} :
HasDerivWithinAt f f' s x ā HasFDerivWithinAt f (smulRight (1 : š āL[š] š) f') s x :=
hasDerivWithinAt_iff_hasFDerivWithinAt.mp
/-- Expressing `HasFDerivAt f f' x` in terms of `HasDerivAt` -/
theorem hasFDerivAt_iff_hasDerivAt {f' : š āL[š] F} : HasFDerivAt f f' x ā HasDerivAt f (f' 1) x :=
hasFDerivAtFilter_iff_hasDerivAtFilter
theorem HasFDerivAt.hasDerivAt {f' : š āL[š] F} : HasFDerivAt f f' x ā HasDerivAt f (f' 1) x :=
hasFDerivAt_iff_hasDerivAt.mp
theorem hasStrictFDerivAt_iff_hasStrictDerivAt {f' : š āL[š] F} :
HasStrictFDerivAt f f' x ā HasStrictDerivAt f (f' 1) x := by
simp [HasStrictDerivAt]
protected theorem HasStrictFDerivAt.hasStrictDerivAt {f' : š āL[š] F} :
HasStrictFDerivAt f f' x ā HasStrictDerivAt f (f' 1) x :=
hasStrictFDerivAt_iff_hasStrictDerivAt.mp
theorem hasStrictDerivAt_iff_hasStrictFDerivAt :
HasStrictDerivAt f f' x ā HasStrictFDerivAt f (smulRight (1 : š āL[š] š) f') x :=
Iff.rfl
alias āØHasStrictDerivAt.hasStrictFDerivAt, _ā© := hasStrictDerivAt_iff_hasStrictFDerivAt
/-- Expressing `HasDerivAt f f' x` in terms of `HasFDerivAt` -/
theorem hasDerivAt_iff_hasFDerivAt {f' : F} :
HasDerivAt f f' x ā HasFDerivAt f (smulRight (1 : š āL[š] š) f') x :=
Iff.rfl
alias āØHasDerivAt.hasFDerivAt, _ā© := hasDerivAt_iff_hasFDerivAt
end
theorem derivWithin_zero_of_not_differentiableWithinAt (h : ¬DifferentiableWithinAt š f s x) :
derivWithin f s x = 0 := by
unfold derivWithin
rw [fderivWithin_zero_of_not_differentiableWithinAt h]
simp
theorem differentiableWithinAt_of_derivWithin_ne_zero (h : derivWithin f s x ā 0) :
DifferentiableWithinAt š f s x :=
not_imp_comm.1 derivWithin_zero_of_not_differentiableWithinAt h
end TVS
variable {š : Type u} [NontriviallyNormedField š]
variable {F : Type v} [NormedAddCommGroup F] [NormedSpace š F]
variable {f fā fā : š ā F}
variable {f' fā' fā' g' : F}
variable {x : š}
variable {s t : Set š}
variable {L Lā Lā : Filter š}
theorem derivWithin_zero_of_not_accPt (h : ¬AccPt x (š s)) : derivWithin f s x = 0 := by
rw [derivWithin, fderivWithin_zero_of_not_accPt h, ContinuousLinearMap.zero_apply]
theorem derivWithin_zero_of_not_uniqueDiffWithinAt (h : ¬UniqueDiffWithinAt š s x) :
derivWithin f s x = 0 :=
derivWithin_zero_of_not_accPt <| mt AccPt.uniqueDiffWithinAt h
theorem derivWithin_zero_of_notMem_closure (h : x ā closure s) : derivWithin f s x = 0 := by
rw [derivWithin, fderivWithin_zero_of_notMem_closure h, ContinuousLinearMap.zero_apply]
@[deprecated (since := "2025-05-24")]
alias derivWithin_zero_of_nmem_closure := derivWithin_zero_of_notMem_closure
theorem deriv_zero_of_not_differentiableAt (h : ¬DifferentiableAt š f x) : deriv f x = 0 := by
unfold deriv
rw [fderiv_zero_of_not_differentiableAt h]
simp
theorem differentiableAt_of_deriv_ne_zero (h : deriv f x ā 0) : DifferentiableAt š f x :=
not_imp_comm.1 deriv_zero_of_not_differentiableAt h
theorem UniqueDiffWithinAt.eq_deriv (s : Set š) (H : UniqueDiffWithinAt š s x)
(h : HasDerivWithinAt f f' s x) (hā : HasDerivWithinAt f fā' s x) : f' = fā' :=
smulRight_one_eq_iff.mp <| UniqueDiffWithinAt.eq H h hā
theorem hasDerivAtFilter_iff_isLittleO :
HasDerivAtFilter f f' x L ā (fun x' : š => f x' - f x - (x' - x) ⢠f') =o[L] fun x' => x' - x :=
hasFDerivAtFilter_iff_isLittleO ..
theorem hasDerivAtFilter_iff_tendsto :
HasDerivAtFilter f f' x L ā
Tendsto (fun x' : š => āx' - xāā»Ā¹ * āf x' - f x - (x' - x) ⢠f'ā) L (š 0) :=
hasFDerivAtFilter_iff_tendsto
theorem hasDerivWithinAt_iff_isLittleO :
HasDerivWithinAt f f' s x ā
(fun x' : š => f x' - f x - (x' - x) ⢠f') =o[š[s] x] fun x' => x' - x :=
hasFDerivAtFilter_iff_isLittleO ..
theorem hasDerivWithinAt_iff_tendsto :
HasDerivWithinAt f f' s x ā
Tendsto (fun x' => āx' - xāā»Ā¹ * āf x' - f x - (x' - x) ⢠f'ā) (š[s] x) (š 0) :=
hasFDerivAtFilter_iff_tendsto
theorem hasDerivAt_iff_isLittleO :
HasDerivAt f f' x ā (fun x' : š => f x' - f x - (x' - x) ⢠f') =o[š x] fun x' => x' - x :=
hasFDerivAtFilter_iff_isLittleO ..
theorem hasDerivAt_iff_tendsto :
HasDerivAt f f' x ā Tendsto (fun x' => āx' - xāā»Ā¹ * āf x' - f x - (x' - x) ⢠f'ā) (š x) (š 0) :=
hasFDerivAtFilter_iff_tendsto
theorem HasDerivAtFilter.isBigO_sub (h : HasDerivAtFilter f f' x L) :
(fun x' => f x' - f x) =O[L] fun x' => x' - x :=
HasFDerivAtFilter.isBigO_sub h
nonrec theorem HasDerivAtFilter.isBigO_sub_rev (hf : HasDerivAtFilter f f' x L) (hf' : f' ā 0) :
(fun x' => x' - x) =O[L] fun x' => f x' - f x :=
suffices AntilipschitzWith āf'āāā»Ā¹ (smulRight (1 : š āL[š] š) f') from hf.isBigO_sub_rev this
AddMonoidHomClass.antilipschitz_of_bound (smulRight (1 : š āL[š] š) f') fun x => by
simp [norm_smul, ā div_eq_inv_mul, mul_div_cancel_rightā _ (mt norm_eq_zero.1 hf')]
theorem HasStrictDerivAt.hasDerivAt (h : HasStrictDerivAt f f' x) : HasDerivAt f f' x :=
h.hasFDerivAt
theorem hasDerivWithinAt_congr_set' {s t : Set š} (y : š) (h : s =į¶ [š[{y}į¶] x] t) :
HasDerivWithinAt f f' s x ā HasDerivWithinAt f f' t x :=
hasFDerivWithinAt_congr_set' y h
theorem hasDerivWithinAt_congr_set {s t : Set š} (h : s =į¶ [š x] t) :
HasDerivWithinAt f f' s x ā HasDerivWithinAt f f' t x :=
hasFDerivWithinAt_congr_set h
alias āØHasDerivWithinAt.congr_set, _ā© := hasDerivWithinAt_congr_set
@[simp]
theorem hasDerivWithinAt_diff_singleton :
HasDerivWithinAt f f' (s \ {x}) x ā HasDerivWithinAt f f' s x :=
hasFDerivWithinAt_diff_singleton _
@[simp]
theorem hasDerivWithinAt_Ioi_iff_Ici [PartialOrder š] :
HasDerivWithinAt f f' (Ioi x) x ā HasDerivWithinAt f f' (Ici x) x := by
rw [ā Ici_diff_left, hasDerivWithinAt_diff_singleton]
alias āØHasDerivWithinAt.Ici_of_Ioi, HasDerivWithinAt.Ioi_of_Iciā© := hasDerivWithinAt_Ioi_iff_Ici
@[simp]
theorem hasDerivWithinAt_Iio_iff_Iic [PartialOrder š] :
HasDerivWithinAt f f' (Iio x) x ā HasDerivWithinAt f f' (Iic x) x := by
rw [ā Iic_diff_right, hasDerivWithinAt_diff_singleton]
alias āØHasDerivWithinAt.Iic_of_Iio, HasDerivWithinAt.Iio_of_Iicā© := hasDerivWithinAt_Iio_iff_Iic
theorem HasDerivWithinAt.Ioi_iff_Ioo [LinearOrder š] [OrderClosedTopology š] {x y : š} (h : x < y) :
HasDerivWithinAt f f' (Ioo x y) x ā HasDerivWithinAt f f' (Ioi x) x :=
hasFDerivWithinAt_inter <| Iio_mem_nhds h
alias āØHasDerivWithinAt.Ioi_of_Ioo, HasDerivWithinAt.Ioo_of_Ioiā© := HasDerivWithinAt.Ioi_iff_Ioo
theorem hasDerivAt_iff_isLittleO_nhds_zero :
HasDerivAt f f' x ā (fun h => f (x + h) - f x - h ⢠f') =o[š 0] fun h => h :=
hasFDerivAt_iff_isLittleO_nhds_zero
theorem HasDerivAtFilter.mono (h : HasDerivAtFilter f f' x Lā) (hst : Lā ⤠Lā) :
HasDerivAtFilter f f' x Lā :=
HasFDerivAtFilter.mono h hst
theorem HasDerivWithinAt.mono (h : HasDerivWithinAt f f' t x) (hst : s ā t) :
HasDerivWithinAt f f' s x :=
HasFDerivWithinAt.mono h hst
theorem HasDerivWithinAt.mono_of_mem_nhdsWithin (h : HasDerivWithinAt f f' t x) (hst : t ā š[s] x) :
HasDerivWithinAt f f' s x :=
HasFDerivWithinAt.mono_of_mem_nhdsWithin h hst
theorem HasDerivAt.hasDerivAtFilter (h : HasDerivAt f f' x) (hL : L ⤠š x) :
HasDerivAtFilter f f' x L :=
HasFDerivAt.hasFDerivAtFilter h hL
theorem HasDerivAt.hasDerivWithinAt (h : HasDerivAt f f' x) : HasDerivWithinAt f f' s x :=
HasFDerivAt.hasFDerivWithinAt h
theorem HasDerivWithinAt.differentiableWithinAt (h : HasDerivWithinAt f f' s x) :
DifferentiableWithinAt š f s x :=
HasFDerivWithinAt.differentiableWithinAt h
theorem HasDerivAt.differentiableAt (h : HasDerivAt f f' x) : DifferentiableAt š f x :=
HasFDerivAt.differentiableAt h
@[simp]
theorem hasDerivWithinAt_univ : HasDerivWithinAt f f' univ x ā HasDerivAt f f' x :=
hasFDerivWithinAt_univ
theorem HasDerivAt.unique (hā : HasDerivAt f fā' x) (hā : HasDerivAt f fā' x) : fā' = fā' :=
smulRight_one_eq_iff.mp <| hā.hasFDerivAt.unique hā
theorem hasDerivWithinAt_inter' (h : t ā š[s] x) :
HasDerivWithinAt f f' (s ā© t) x ā HasDerivWithinAt f f' s x :=
hasFDerivWithinAt_inter' h
theorem hasDerivWithinAt_inter (h : t ā š x) :
HasDerivWithinAt f f' (s ā© t) x ā HasDerivWithinAt f f' s x :=
hasFDerivWithinAt_inter h
theorem HasDerivWithinAt.union (hs : HasDerivWithinAt f f' s x) (ht : HasDerivWithinAt f f' t x) :
HasDerivWithinAt f f' (s āŖ t) x :=
hs.hasFDerivWithinAt.union ht.hasFDerivWithinAt
theorem HasDerivWithinAt.hasDerivAt (h : HasDerivWithinAt f f' s x) (hs : s ā š x) :
HasDerivAt f f' x :=
HasFDerivWithinAt.hasFDerivAt h hs
theorem DifferentiableWithinAt.hasDerivWithinAt (h : DifferentiableWithinAt š f s x) :
HasDerivWithinAt f (derivWithin f s x) s x :=
h.hasFDerivWithinAt.hasDerivWithinAt
theorem DifferentiableAt.hasDerivAt (h : DifferentiableAt š f x) : HasDerivAt f (deriv f x) x :=
h.hasFDerivAt.hasDerivAt
@[simp]
theorem hasDerivAt_deriv_iff : HasDerivAt f (deriv f x) x ā DifferentiableAt š f x :=
āØfun h => h.differentiableAt, fun h => h.hasDerivAtā©
@[simp]
theorem hasDerivWithinAt_derivWithin_iff :
HasDerivWithinAt f (derivWithin f s x) s x ā DifferentiableWithinAt š f s x :=
āØfun h => h.differentiableWithinAt, fun h => h.hasDerivWithinAtā©
theorem DifferentiableOn.hasDerivAt (h : DifferentiableOn š f s) (hs : s ā š x) :
HasDerivAt f (deriv f x) x :=
(h.hasFDerivAt hs).hasDerivAt
theorem HasDerivAt.deriv (h : HasDerivAt f f' x) : deriv f x = f' :=
h.differentiableAt.hasDerivAt.unique h
theorem deriv_eq {f' : š ā F} (h : ā x, HasDerivAt f (f' x) x) : deriv f = f' :=
funext fun x => (h x).deriv
theorem HasDerivWithinAt.derivWithin (h : HasDerivWithinAt f f' s x)
(hxs : UniqueDiffWithinAt š s x) : derivWithin f s x = f' :=
hxs.eq_deriv _ h.differentiableWithinAt.hasDerivWithinAt h
theorem fderivWithin_derivWithin : (fderivWithin š f s x : š ā F) 1 = derivWithin f s x :=
rfl
theorem derivWithin_fderivWithin :
smulRight (1 : š āL[š] š) (derivWithin f s x) = fderivWithin š f s x := by simp [derivWithin]
theorem norm_derivWithin_eq_norm_fderivWithin : āderivWithin f s xā = āfderivWithin š f s xā := by
simp [ā derivWithin_fderivWithin]
theorem fderiv_deriv : (fderiv š f x : š ā F) 1 = deriv f x :=
rfl
@[simp]
theorem fderiv_eq_smul_deriv (y : š) : (fderiv š f x : š ā F) y = y ⢠deriv f x := by
rw [ā fderiv_deriv, ā ContinuousLinearMap.map_smul]
simp only [smul_eq_mul, mul_one]
theorem deriv_fderiv : smulRight (1 : š āL[š] š) (deriv f x) = fderiv š f x := by
simp only [deriv, ContinuousLinearMap.smulRight_one_one]
lemma fderiv_eq_deriv_mul {f : š ā š} {x y : š} : (fderiv š f x : š ā š) y = (deriv f x) * y := by
simp [mul_comm]
theorem norm_deriv_eq_norm_fderiv : āderiv f xā = āfderiv š f xā := by
simp [ā deriv_fderiv]
theorem DifferentiableAt.derivWithin (h : DifferentiableAt š f x) (hxs : UniqueDiffWithinAt š s x) :
derivWithin f s x = deriv f x := by
unfold _root_.derivWithin deriv
rw [h.fderivWithin hxs]
theorem HasDerivWithinAt.deriv_eq_zero (hd : HasDerivWithinAt f 0 s x)
(H : UniqueDiffWithinAt š s x) : deriv f x = 0 :=
(em' (DifferentiableAt š f x)).elim deriv_zero_of_not_differentiableAt fun h =>
H.eq_deriv _ h.hasDerivAt.hasDerivWithinAt hd
theorem derivWithin_of_mem_nhdsWithin (st : t ā š[s] x) (ht : UniqueDiffWithinAt š s x)
(h : DifferentiableWithinAt š f t x) : derivWithin f s x = derivWithin f t x :=
((DifferentiableWithinAt.hasDerivWithinAt h).mono_of_mem_nhdsWithin st).derivWithin ht
theorem derivWithin_subset (st : s ā t) (ht : UniqueDiffWithinAt š s x)
(h : DifferentiableWithinAt š f t x) : derivWithin f s x = derivWithin f t x :=
((DifferentiableWithinAt.hasDerivWithinAt h).mono st).derivWithin ht
theorem derivWithin_congr_set' (y : š) (h : s =į¶ [š[{y}į¶] x] t) :
derivWithin f s x = derivWithin f t x := by simp only [derivWithin, fderivWithin_congr_set' y h]
theorem derivWithin_congr_set (h : s =į¶ [š x] t) : derivWithin f s x = derivWithin f t x := by
simp only [derivWithin, fderivWithin_congr_set h]
@[simp]
theorem derivWithin_univ : derivWithin f univ = deriv f := by
ext
unfold derivWithin deriv
rw [fderivWithin_univ]
theorem derivWithin_inter (ht : t ā š x) : derivWithin f (s ā© t) x = derivWithin f s x := by
unfold derivWithin
rw [fderivWithin_inter ht]
theorem derivWithin_of_mem_nhds (h : s ā š x) : derivWithin f s x = deriv f x := by
simp only [derivWithin, deriv, fderivWithin_of_mem_nhds h]
theorem derivWithin_of_isOpen (hs : IsOpen s) (hx : x ā s) : derivWithin f s x = deriv f x :=
derivWithin_of_mem_nhds (hs.mem_nhds hx)
lemma deriv_eqOn {f' : š ā F} (hs : IsOpen s) (hf' : ā x ā s, HasDerivWithinAt f (f' x) s x) :
s.EqOn (deriv f) f' := fun x hx ⦠by
rw [ā derivWithin_of_isOpen hs hx, (hf' _ hx).derivWithin <| hs.uniqueDiffWithinAt hx]
theorem deriv_mem_iff {f : š ā F} {s : Set F} {x : š} :
deriv f x ā s ā
DifferentiableAt š f x ā§ deriv f x ā s ⨠¬DifferentiableAt š f x ā§ (0 : F) ā s := by
by_cases hx : DifferentiableAt š f x <;> simp [deriv_zero_of_not_differentiableAt, *]
theorem derivWithin_mem_iff {f : š ā F} {t : Set š} {s : Set F} {x : š} :
derivWithin f t x ā s ā
DifferentiableWithinAt š f t x ā§ derivWithin f t x ā s āØ
¬DifferentiableWithinAt š f t x ā§ (0 : F) ā s := by
by_cases hx : DifferentiableWithinAt š f t x <;>
simp [derivWithin_zero_of_not_differentiableWithinAt, *]
theorem differentiableWithinAt_Ioi_iff_Ici [PartialOrder š] :
DifferentiableWithinAt š f (Ioi x) x ā DifferentiableWithinAt š f (Ici x) x :=
āØfun h => h.hasDerivWithinAt.Ici_of_Ioi.differentiableWithinAt, fun h =>
h.hasDerivWithinAt.Ioi_of_Ici.differentiableWithinAtā©
-- Golfed while splitting the file
theorem derivWithin_Ioi_eq_Ici {E : Type*} [NormedAddCommGroup E] [NormedSpace ā E] (f : ā ā E)
(x : ā) : derivWithin f (Ioi x) x = derivWithin f (Ici x) x := by
by_cases H : DifferentiableWithinAt ā f (Ioi x) x
Ā· have A := H.hasDerivWithinAt.Ici_of_Ioi
have B := (differentiableWithinAt_Ioi_iff_Ici.1 H).hasDerivWithinAt
simpa using (uniqueDiffOn_Ici x).eq left_mem_Ici A B
Ā· rw [derivWithin_zero_of_not_differentiableWithinAt H,
derivWithin_zero_of_not_differentiableWithinAt]
rwa [differentiableWithinAt_Ioi_iff_Ici] at H
section congr
/-! ### Congruence properties of derivatives -/
theorem Filter.EventuallyEq.hasDerivAtFilter_iff (hā : fā =į¶ [L] fā) (hx : fā x = fā x)
(hā : fā' = fā') : HasDerivAtFilter fā fā' x L ā HasDerivAtFilter fā fā' x L :=
hā.hasFDerivAtFilter_iff hx (by simp [hā])
theorem HasDerivAtFilter.congr_of_eventuallyEq (h : HasDerivAtFilter f f' x L) (hL : fā =į¶ [L] f)
(hx : fā x = f x) : HasDerivAtFilter fā f' x L := by rwa [hL.hasDerivAtFilter_iff hx rfl]
theorem HasDerivWithinAt.congr_mono (h : HasDerivWithinAt f f' s x) (ht : ā x ā t, fā x = f x)
(hx : fā x = f x) (hā : t ā s) : HasDerivWithinAt fā f' t x :=
HasFDerivWithinAt.congr_mono h ht hx hā
theorem HasDerivWithinAt.congr (h : HasDerivWithinAt f f' s x) (hs : ā x ā s, fā x = f x)
(hx : fā x = f x) : HasDerivWithinAt fā f' s x :=
h.congr_mono hs hx (Subset.refl _)
theorem HasDerivWithinAt.congr_of_mem (h : HasDerivWithinAt f f' s x) (hs : ā x ā s, fā x = f x)
(hx : x ā s) : HasDerivWithinAt fā f' s x :=
h.congr hs (hs _ hx)
theorem HasDerivWithinAt.congr_of_eventuallyEq (h : HasDerivWithinAt f f' s x)
(hā : fā =į¶ [š[s] x] f) (hx : fā x = f x) : HasDerivWithinAt fā f' s x :=
HasDerivAtFilter.congr_of_eventuallyEq h hā hx
theorem Filter.EventuallyEq.hasDerivWithinAt_iff (hā : fā =į¶ [š[s] x] f) (hx : fā x = f x) :
HasDerivWithinAt fā f' s x ā HasDerivWithinAt f f' s x :=
āØfun h' ⦠h'.congr_of_eventuallyEq hā.symm hx.symm, fun h' ⦠h'.congr_of_eventuallyEq hā hxā©
theorem HasDerivWithinAt.congr_of_eventuallyEq_of_mem (h : HasDerivWithinAt f f' s x)
(hā : fā =į¶ [š[s] x] f) (hx : x ā s) : HasDerivWithinAt fā f' s x :=
h.congr_of_eventuallyEq hā (hā.eq_of_nhdsWithin hx)
theorem Filter.EventuallyEq.hasDerivWithinAt_iff_of_mem (hā : fā =į¶ [š[s] x] f) (hx : x ā s) :
HasDerivWithinAt fā f' s x ā HasDerivWithinAt f f' s x :=
āØfun h' ⦠h'.congr_of_eventuallyEq_of_mem hā.symm hx,
fun h' ⦠h'.congr_of_eventuallyEq_of_mem hā hxā©
theorem HasStrictDerivAt.congr_deriv (h : HasStrictDerivAt f f' x) (h' : f' = g') :
HasStrictDerivAt f g' x :=
h.congr_fderiv <| congr_arg _ h'
theorem HasDerivAt.congr_deriv (h : HasDerivAt f f' x) (h' : f' = g') : HasDerivAt f g' x :=
HasFDerivAt.congr_fderiv h <| congr_arg _ h'
theorem HasDerivWithinAt.congr_deriv (h : HasDerivWithinAt f f' s x) (h' : f' = g') :
HasDerivWithinAt f g' s x :=
HasFDerivWithinAt.congr_fderiv h <| congr_arg _ h'
theorem HasDerivAt.congr_of_eventuallyEq (h : HasDerivAt f f' x) (hā : fā =į¶ [š x] f) :
HasDerivAt fā f' x :=
HasDerivAtFilter.congr_of_eventuallyEq h hā (mem_of_mem_nhds hā :)
theorem Filter.EventuallyEq.hasDerivAt_iff (h : fā =į¶ [š x] fā) :
HasDerivAt fā f' x ā HasDerivAt fā f' x :=
āØfun h' ⦠h'.congr_of_eventuallyEq h.symm, fun h' ⦠h'.congr_of_eventuallyEq hā©
theorem Filter.EventuallyEq.derivWithin_eq (hs : fā =į¶ [š[s] x] f) (hx : fā x = f x) :
derivWithin fā s x = derivWithin f s x := by
unfold derivWithin
rw [hs.fderivWithin_eq hx]
theorem Filter.EventuallyEq.derivWithin_eq_of_mem (hs : fā =į¶ [š[s] x] f) (hx : x ā s) :
derivWithin fā s x = derivWithin f s x :=
hs.derivWithin_eq <| hs.self_of_nhdsWithin hx
theorem Filter.EventuallyEq.derivWithin_eq_of_nhds (hs : fā =į¶ [š x] f) :
derivWithin fā s x = derivWithin f s x :=
(hs.filter_mono nhdsWithin_le_nhds).derivWithin_eq hs.self_of_nhds
theorem derivWithin_congr (hs : EqOn fā f s) (hx : fā x = f x) :
derivWithin fā s x = derivWithin f s x := by
unfold derivWithin
rw [fderivWithin_congr hs hx]
lemma Set.EqOn.deriv {f g : š ā F} {s : Set š} (hfg : s.EqOn f g) (hs : IsOpen s) :
s.EqOn (deriv f) (deriv g) := by
intro x hx
rw [ā derivWithin_of_isOpen hs hx, ā derivWithin_of_isOpen hs hx]
exact derivWithin_congr hfg (hfg hx)
theorem Filter.EventuallyEq.deriv_eq (hL : fā =į¶ [š x] f) : deriv fā x = deriv f x := by
unfold deriv
rwa [Filter.EventuallyEq.fderiv_eq]
protected theorem Filter.EventuallyEq.deriv (h : fā =į¶ [š x] f) : deriv fā =į¶ [š x] deriv f :=
h.eventuallyEq_nhds.mono fun _ h => h.deriv_eq
end congr
section id
/-! ### Derivative of the identity -/
variable (s x L)
theorem hasDerivAtFilter_id : HasDerivAtFilter id 1 x L :=
(hasFDerivAtFilter_id x L).hasDerivAtFilter
theorem hasDerivWithinAt_id : HasDerivWithinAt id 1 s x :=
hasDerivAtFilter_id _ _
theorem hasDerivAt_id : HasDerivAt id 1 x :=
hasDerivAtFilter_id _ _
theorem hasDerivAt_id' : HasDerivAt (fun x : š => x) 1 x :=
hasDerivAtFilter_id _ _
theorem hasStrictDerivAt_id : HasStrictDerivAt id 1 x :=
(hasStrictFDerivAt_id x).hasStrictDerivAt
theorem deriv_id : deriv id x = 1 :=
HasDerivAt.deriv (hasDerivAt_id x)
@[simp]
theorem deriv_id' : deriv (@id š) = fun _ => 1 :=
funext deriv_id
/-- Variant with `fun x => x` rather than `id` -/
@[simp]
theorem deriv_id'' : (deriv fun x : š => x) = fun _ => 1 :=
deriv_id'
theorem derivWithin_id (hxs : UniqueDiffWithinAt š s x) : derivWithin id s x = 1 :=
(hasDerivWithinAt_id x s).derivWithin hxs
/-- Variant with `fun x => x` rather than `id` -/
theorem derivWithin_id' (hxs : UniqueDiffWithinAt š s x) : derivWithin (fun x => x) s x = 1 :=
derivWithin_id x s hxs
end id
section Const
/-! ### Derivative of constant functions
This include the constant functions `0`, `1`, `Nat.cast n`, `Int.cast z`, and other numerals.
-/
variable (c : F) (s x L)
theorem hasDerivAtFilter_const : HasDerivAtFilter (fun _ => c) 0 x L :=
(hasFDerivAtFilter_const c x L).hasDerivAtFilter
theorem hasDerivAtFilter_zero : HasDerivAtFilter (0 : š ā F) 0 x L :=
hasDerivAtFilter_const _ _ _
theorem hasDerivAtFilter_one [One F] : HasDerivAtFilter (1 : š ā F) 0 x L :=
hasDerivAtFilter_const _ _ _
theorem hasDerivAtFilter_natCast [NatCast F] (n : ā) : HasDerivAtFilter (n : š ā F) 0 x L :=
hasDerivAtFilter_const _ _ _
theorem hasDerivAtFilter_intCast [IntCast F] (z : ā¤) : HasDerivAtFilter (z : š ā F) 0 x L :=
hasDerivAtFilter_const _ _ _
theorem hasDerivAtFilter_ofNat (n : ā) [OfNat F n] : HasDerivAtFilter (ofNat(n) : š ā F) 0 x L :=
hasDerivAtFilter_const _ _ _
theorem hasStrictDerivAt_const : HasStrictDerivAt (fun _ => c) 0 x :=
(hasStrictFDerivAt_const c x).hasStrictDerivAt
theorem hasStrictDerivAt_zero : HasStrictDerivAt (0 : š ā F) 0 x :=
hasStrictDerivAt_const _ _
theorem hasStrictDerivAt_one [One F] : HasStrictDerivAt (1 : š ā F) 0 x :=
hasStrictDerivAt_const _ _
theorem hasStrictDerivAt_natCast [NatCast F] (n : ā) : HasStrictDerivAt (n : š ā F) 0 x :=
hasStrictDerivAt_const _ _
theorem hasStrictDerivAt_intCast [IntCast F] (z : ā¤) : HasStrictDerivAt (z : š ā F) 0 x :=
hasStrictDerivAt_const _ _
theorem HasStrictDerivAt_ofNat (n : ā) [OfNat F n] : HasStrictDerivAt (ofNat(n) : š ā F) 0 x :=
hasStrictDerivAt_const _ _
theorem hasDerivWithinAt_const : HasDerivWithinAt (fun _ => c) 0 s x :=
hasDerivAtFilter_const _ _ _
theorem hasDerivWithinAt_zero : HasDerivWithinAt (0 : š ā F) 0 s x :=
hasDerivAtFilter_zero _ _
theorem hasDerivWithinAt_one [One F] : HasDerivWithinAt (1 : š ā F) 0 s x :=
hasDerivWithinAt_const _ _ _
theorem hasDerivWithinAt_natCast [NatCast F] (n : ā) : HasDerivWithinAt (n : š ā F) 0 s x :=
hasDerivWithinAt_const _ _ _
theorem hasDerivWithinAt_intCast [IntCast F] (z : ā¤) : HasDerivWithinAt (z : š ā F) 0 s x :=
hasDerivWithinAt_const _ _ _
theorem hasDerivWithinAt_ofNat (n : ā) [OfNat F n] : HasDerivWithinAt (ofNat(n) : š ā F) 0 s x :=
hasDerivWithinAt_const _ _ _
theorem hasDerivAt_const : HasDerivAt (fun _ => c) 0 x :=
hasDerivAtFilter_const _ _ _
theorem hasDerivAt_zero : HasDerivAt (0 : š ā F) 0 x :=
hasDerivAtFilter_zero _ _
theorem hasDerivAt_one [One F] : HasDerivAt (1 : š ā F) 0 x :=
hasDerivAt_const _ _
theorem hasDerivAt_natCast [NatCast F] (n : ā) : HasDerivAt (n : š ā F) 0 x :=
hasDerivAt_const _ _
theorem hasDerivAt_intCast [IntCast F] (z : ā¤) : HasDerivAt (z : š ā F) 0 x :=
hasDerivAt_const _ _
theorem hasDerivAt_ofNat (n : ā) [OfNat F n] : HasDerivAt (ofNat(n) : š ā F) 0 x :=
hasDerivAt_const _ _
theorem deriv_const : deriv (fun _ => c) x = 0 :=
HasDerivAt.deriv (hasDerivAt_const x c)
@[simp]
theorem deriv_const' : (deriv fun _ : š => c) = fun _ => 0 :=
funext fun x => deriv_const x c
@[simp]
theorem deriv_zero : deriv (0 : š ā F) = 0 := funext fun _ => deriv_const _ _
@[simp]
theorem deriv_one [One F] : deriv (1 : š ā F) = 0 := funext fun _ => deriv_const _ _
@[simp]
theorem deriv_natCast [NatCast F] (n : ā) : deriv (n : š ā F) = 0 := funext fun _ => deriv_const _ _
@[simp]
theorem deriv_intCast [IntCast F] (z : ā¤) : deriv (z : š ā F) = 0 := funext fun _ => deriv_const _ _
@[simp low]
theorem deriv_ofNat (n : ā) [OfNat F n] : deriv (ofNat(n) : š ā F) = 0 :=
funext fun _ => deriv_const _ _
@[simp]
theorem derivWithin_fun_const : derivWithin (fun _ => c) s = 0 := by
ext; simp [derivWithin]
@[simp]
theorem derivWithin_const : derivWithin (Function.const š c) s = 0 :=
derivWithin_fun_const _ _
@[simp]
theorem derivWithin_zero : derivWithin (0 : š ā F) s = 0 := derivWithin_const _ _
@[simp]
theorem derivWithin_one [One F] : derivWithin (1 : š ā F) s = 0 := derivWithin_const _ _
@[simp]
theorem derivWithin_natCast [NatCast F] (n : ā) : derivWithin (n : š ā F) s = 0 :=
derivWithin_const _ _
@[simp]
theorem derivWithin_intCast [IntCast F] (z : ā¤) : derivWithin (z : š ā F) s = 0 :=
derivWithin_const _ _
@[simp low]
theorem derivWithin_ofNat (n : ā) [OfNat F n] : derivWithin (ofNat(n) : š ā F) s = 0 :=
derivWithin_const _ _
end Const
section Continuous
/-! ### Continuity of a function admitting a derivative -/
nonrec theorem HasDerivAtFilter.tendsto_nhds (hL : L ⤠š x) (h : HasDerivAtFilter f f' x L) :
Tendsto f L (š (f x)) :=
h.tendsto_nhds hL
theorem HasDerivWithinAt.continuousWithinAt (h : HasDerivWithinAt f f' s x) :
ContinuousWithinAt f s x :=
HasDerivAtFilter.tendsto_nhds inf_le_left h
theorem HasDerivAt.continuousAt (h : HasDerivAt f f' x) : ContinuousAt f x :=
HasDerivAtFilter.tendsto_nhds le_rfl h
theorem HasDerivWithinAt.continuousOn {f f' : š ā F} (h : ā x ā s, HasDerivWithinAt f (f' x) s x) :
ContinuousOn f s := fun x hx => (h x hx).continuousWithinAt
protected theorem HasDerivAt.continuousOn {f f' : š ā F} (hderiv : ā x ā s, HasDerivAt f (f' x) x) :
ContinuousOn f s := fun x hx => (hderiv x hx).continuousAt.continuousWithinAt
end Continuous
section MeanValue
/-- Converse to the mean value inequality: if `f` is differentiable at `xā` and `C`-lipschitz
on a neighborhood of `xā` then its derivative at `xā` has norm bounded by `C`. This version
only assumes that `āf x - f xāā ⤠C * āx - xāā` in a neighborhood of `x`. -/
theorem HasDerivAt.le_of_lip' {f : š ā F} {f' : F} {xā : š} (hf : HasDerivAt f f' xā)
{C : ā} (hCā : 0 ⤠C) (hlip : āį¶ x in š xā, āf x - f xāā ⤠C * āx - xāā) :
āf'ā ⤠C := by
simpa using HasFDerivAt.le_of_lip' hf.hasFDerivAt hCā hlip
/-- Converse to the mean value inequality: if `f` is differentiable at `xā` and `C`-lipschitz
on a neighborhood of `xā` then its derivative at `xā` has norm bounded by `C`. -/
theorem HasDerivAt.le_of_lipschitzOn {f : š ā F} {f' : F} {xā : š} (hf : HasDerivAt f f' xā)
{s : Set š} (hs : s ā š xā) {C : āā„0} (hlip : LipschitzOnWith C f s) : āf'ā ⤠C := by
simpa using HasFDerivAt.le_of_lipschitzOn hf.hasFDerivAt hs hlip
/-- Converse to the mean value inequality: if `f` is differentiable at `xā` and `C`-lipschitz
then its derivative at `xā` has norm bounded by `C`. -/
theorem HasDerivAt.le_of_lipschitz {f : š ā F} {f' : F} {xā : š} (hf : HasDerivAt f f' xā)
{C : āā„0} (hlip : LipschitzWith C f) : āf'ā ⤠C := by
simpa using HasFDerivAt.le_of_lipschitz hf.hasFDerivAt hlip
/-- Converse to the mean value inequality: if `f` is `C`-lipschitz
on a neighborhood of `xā` then its derivative at `xā` has norm bounded by `C`. This version
only assumes that `āf x - f xāā ⤠C * āx - xāā` in a neighborhood of `x`. -/
theorem norm_deriv_le_of_lip' {f : š ā F} {xā : š}
{C : ā} (hCā : 0 ⤠C) (hlip : āį¶ x in š xā, āf x - f xāā ⤠C * āx - xāā) :
āderiv f xāā ⤠C := by
simpa [norm_deriv_eq_norm_fderiv] using norm_fderiv_le_of_lip' š hCā hlip
/-- Converse to the mean value inequality: if `f` is `C`-lipschitz
on a neighborhood of `xā` then its derivative at `xā` has norm bounded by `C`.
Version using `deriv`. -/
theorem norm_deriv_le_of_lipschitzOn {f : š ā F} {xā : š} {s : Set š} (hs : s ā š xā)
{C : āā„0} (hlip : LipschitzOnWith C f s) : āderiv f xāā ⤠C := by
simpa [norm_deriv_eq_norm_fderiv] using norm_fderiv_le_of_lipschitzOn š hs hlip
/-- Converse to the mean value inequality: if `f` is `C`-lipschitz then
its derivative at `xā` has norm bounded by `C`.
Version using `deriv`. -/
theorem norm_deriv_le_of_lipschitz {f : š ā F} {xā : š}
{C : āā„0} (hlip : LipschitzWith C f) : āderiv f xāā ⤠C := by
simpa [norm_deriv_eq_norm_fderiv] using norm_fderiv_le_of_lipschitz š hlip
end MeanValue
section Semilinear
variable {Ļ Ļ' : RingHom š š} [RingHomIsometric Ļ] [RingHomInvPair Ļ Ļ']
{F' : Type*} [NormedAddCommGroup F'] [NormedSpace š F'] (L : F āSL[Ļ] F')
variable (Ļ')
/-- If `L` is a `Ļ`-semilinear map, and `f` has FrĆ©chet derivative `f'` at `x`, then `L ā f ā Ļā»Ā¹`
has FrĆ©chet derivative `L ā f'` at `Ļ x`. -/
lemma HasDerivAt.comp_semilinear (hf : HasDerivAt f f' x) :
HasDerivAt (L ā f ā Ļ') (L f') (Ļ x) := by
have : RingHomIsometric Ļ' := .inv Ļ
let R : š āSL[Ļ'] š := āØĻ'.toSemilinearMap, Ļ'.isometry.continuousā©
have hR (k : š) : R k = Ļ' k := rfl
rw [hasDerivAt_iff_hasFDerivAt]
convert HasFDerivAt.comp_semilinear L R (f' := (1 : š āL[š] š).smulRight f') ?_
Ā· ext
simp [R]
Ā· rwa [ā hasDerivAt_iff_hasFDerivAt, hR, RingHomInvPair.comp_apply_eq]
/-- If `f` is differentiable at `x`, and `L` is `Ļ`-semilinear, then `L ā f ā Ļā»Ā¹` is
differentiable at `Ļ x`. -/
lemma DifferentiableAt.comp_semilinearā (hf : DifferentiableAt š f x) :
DifferentiableAt š (L ā f ā Ļ') (Ļ x) :=
(hf.hasDerivAt.comp_semilinear Ļ' L).differentiableAt
variable (Ļ) {f : š ā š} {f' : š}
/-- If `f` has derivative `f'` at `x`, and `Ļ, Ļ'` are mutually inverse normed-ring automorphisms,
then `Ļ ā f ā Ļ'` has derivative `Ļ f'` at `Ļ x`. -/
lemma HasDerivAt.comp_ringHom (hf : HasDerivAt f f' x) : HasDerivAt (Ļ ā f ā Ļ') (Ļ f') (Ļ x) :=
hf.comp_semilinear Ļ' āØĻ.toSemilinearMap, Ļ.isometry.continuousā©
/-- If `f` is differentiable at `x`, and `L` is `Ļ`-semilinear, then `L ā f ā Ļā»Ā¹` is
differentiable at `Ļ x`. -/
lemma DifferentiableAt.comp_ringHom (hf : DifferentiableAt š f x) :
DifferentiableAt š (Ļ ā f ā Ļ') (Ļ x) :=
(hf.hasDerivAt.comp_ringHom Ļ Ļ').differentiableAt
end Semilinear |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/Deriv/Slope.lean | import Mathlib.Analysis.Calculus.Deriv.Add
import Mathlib.LinearAlgebra.AffineSpace.Slope
import Mathlib.Topology.Algebra.Module.PerfectSpace
/-!
# Derivative as the limit of the slope
In this file we relate the derivative of a function with its definition from a standard
undergraduate course as the limit of the slope `(f y - f x) / (y - x)` as `y` tends to `š[ā ] x`.
Since we are talking about functions taking values in a normed space instead of the base field, we
use `slope f x y = (y - x)ā»Ā¹ ⢠(f y - f x)` instead of division.
We also prove some estimates on the upper/lower limits of the slope in terms of the derivative.
For a more detailed overview of one-dimensional derivatives in mathlib, see the module docstring of
`analysis/calculus/deriv/basic`.
## Keywords
derivative, slope
-/
universe u v
open scoped Topology
open Filter TopologicalSpace Set
section NormedField
variable {š : Type u} [NontriviallyNormedField š]
variable {F : Type v} [NormedAddCommGroup F] [NormedSpace š F]
variable {f : š ā F}
variable {f' : F}
variable {x : š}
variable {s : Set š}
/-- If the domain has dimension one, then FrƩchet derivative is equivalent to the classical
definition with a limit. In this version we have to take the limit along the subset `{x}į¶`,
because for `y=x` the slope equals zero due to the convention `0ā»Ā¹=0`. -/
theorem hasDerivAtFilter_iff_tendsto_slope {x : š} {L : Filter š} :
HasDerivAtFilter f f' x L ā Tendsto (slope f x) (L ā š {x}į¶) (š f') :=
calc HasDerivAtFilter f f' x L
ā Tendsto (fun y ⦠slope f x y - (y - x)ā»Ā¹ ⢠(y - x) ⢠f') L (š 0) := by
simp only [hasDerivAtFilter_iff_tendsto, ā norm_inv, ā norm_smul,
ā tendsto_zero_iff_norm_tendsto_zero, slope_def_module, smul_sub]
_ ā Tendsto (fun y ⦠slope f x y - (y - x)ā»Ā¹ ⢠(y - x) ⢠f') (L ā š {x}į¶) (š 0) :=
.symm <| tendsto_inf_principal_nhds_iff_of_forall_eq <| by simp
_ ā Tendsto (fun y ⦠slope f x y - f') (L ā š {x}į¶) (š 0) := tendsto_congr' <| by
refine (EqOn.eventuallyEq fun y hy ⦠?_).filter_mono inf_le_right
rw [inv_smul_smulā (sub_ne_zero.2 hy) f']
_ ā Tendsto (slope f x) (L ā š {x}į¶) (š f') := by
rw [ā nhds_translation_sub f', tendsto_comap_iff]; rfl
theorem hasDerivWithinAt_iff_tendsto_slope :
HasDerivWithinAt f f' s x ā Tendsto (slope f x) (š[s \ {x}] x) (š f') := by
simp only [HasDerivWithinAt, nhdsWithin, diff_eq, ā inf_assoc, inf_principal.symm]
exact hasDerivAtFilter_iff_tendsto_slope
theorem hasDerivWithinAt_iff_tendsto_slope' (hs : x ā s) :
HasDerivWithinAt f f' s x ā Tendsto (slope f x) (š[s] x) (š f') := by
rw [hasDerivWithinAt_iff_tendsto_slope, diff_singleton_eq_self hs]
theorem hasDerivAt_iff_tendsto_slope : HasDerivAt f f' x ā Tendsto (slope f x) (š[ā ] x) (š f') :=
hasDerivAtFilter_iff_tendsto_slope
alias āØHasDerivAt.tendsto_slope, _ā© := hasDerivAt_iff_tendsto_slope
theorem hasDerivAt_iff_tendsto_slope_left_right [LinearOrder š] : HasDerivAt f f' x ā
Tendsto (slope f x) (š[<] x) (š f') ā§ Tendsto (slope f x) (š[>] x) (š f') := by
simp [hasDerivAt_iff_tendsto_slope, ā Iio_union_Ioi, nhdsWithin_union]
theorem hasDerivAt_iff_tendsto_slope_zero :
HasDerivAt f f' x ā Tendsto (fun t ⦠tā»Ā¹ ⢠(f (x + t) - f x)) (š[ā ] 0) (š f') := by
have : š[ā ] x = Filter.map (fun t ⦠x + t) (š[ā ] 0) := by
simp [nhdsWithin, map_add_left_nhds_zero x, Filter.map_inf, add_right_injective x]
simp [hasDerivAt_iff_tendsto_slope, this, slope, Function.comp_def]
alias āØHasDerivAt.tendsto_slope_zero, _ā© := hasDerivAt_iff_tendsto_slope_zero
theorem HasDerivAt.tendsto_slope_zero_right [Preorder š] (h : HasDerivAt f f' x) :
Tendsto (fun t ⦠tā»Ā¹ ⢠(f (x + t) - f x)) (š[>] 0) (š f') :=
h.tendsto_slope_zero.mono_left (nhdsGT_le_nhdsNE 0)
theorem HasDerivAt.tendsto_slope_zero_left [Preorder š] (h : HasDerivAt f f' x) :
Tendsto (fun t ⦠tā»Ā¹ ⢠(f (x + t) - f x)) (š[<] 0) (š f') :=
h.tendsto_slope_zero.mono_left (nhdsLT_le_nhdsNE 0)
/-- Given a set `t` such that `s ā© t` is dense in `s`, then the range of `derivWithin f s` is
contained in the closure of the submodule spanned by the image of `t`. -/
theorem range_derivWithin_subset_closure_span_image
(f : š ā F) {s t : Set š} (h : s ā closure (s ā© t)) :
range (derivWithin f s) ā closure (Submodule.span š (f '' t)) := by
rintro - āØx, rflā©
by_cases H : UniqueDiffWithinAt š s x; swap
Ā· simpa [derivWithin_zero_of_not_uniqueDiffWithinAt H] using subset_closure (zero_mem _)
by_cases H' : DifferentiableWithinAt š f s x; swap
Ā· rw [derivWithin_zero_of_not_differentiableWithinAt H']
exact subset_closure (zero_mem _)
have I : (š[(s ā© t) \ {x}] x).NeBot := by
rw [ā accPt_principal_iff_nhdsWithin, ā uniqueDiffWithinAt_iff_accPt]
exact H.mono_closure h
have : Tendsto (slope f x) (š[(s ā© t) \ {x}] x) (š (derivWithin f s x)) := by
apply Tendsto.mono_left (hasDerivWithinAt_iff_tendsto_slope.1 H'.hasDerivWithinAt)
rw [inter_comm, inter_diff_assoc]
exact nhdsWithin_mono _ inter_subset_right
rw [ā closure_closure, ā Submodule.topologicalClosure_coe]
apply mem_closure_of_tendsto this
filter_upwards [self_mem_nhdsWithin] with y hy
simp only [slope, vsub_eq_sub, SetLike.mem_coe]
refine Submodule.smul_mem _ _ (Submodule.sub_mem _ ?_ ?_)
Ā· apply Submodule.le_topologicalClosure
apply Submodule.subset_span
exact mem_image_of_mem _ hy.1.2
Ā· apply Submodule.closure_subset_topologicalClosure_span
suffices A : f x ā closure (f '' (s ā© t)) from
closure_mono (image_mono inter_subset_right) A
apply ContinuousWithinAt.mem_closure_image
Ā· apply H'.continuousWithinAt.mono inter_subset_left
rw [mem_closure_iff_nhdsWithin_neBot]
exact I.mono (nhdsWithin_mono _ diff_subset)
/-- Given a dense set `t`, then the range of `deriv f` is contained in the closure of the submodule
spanned by the image of `t`. -/
theorem range_deriv_subset_closure_span_image
(f : š ā F) {t : Set š} (h : Dense t) :
range (deriv f) ā closure (Submodule.span š (f '' t)) := by
rw [ā derivWithin_univ]
apply range_derivWithin_subset_closure_span_image
simp [dense_iff_closure_eq.1 h]
theorem isSeparable_range_derivWithin [SeparableSpace š] (f : š ā F) (s : Set š) :
IsSeparable (range (derivWithin f s)) := by
obtain āØt, ts, t_count, htā© : ā t, t ā s ā§ Set.Countable t ā§ s ā closure t :=
(IsSeparable.of_separableSpace s).exists_countable_dense_subset
have : s ā closure (s ā© t) := by rwa [inter_eq_self_of_subset_right ts]
apply IsSeparable.mono _ (range_derivWithin_subset_closure_span_image f this)
exact (Countable.image t_count f).isSeparable.span.closure
theorem isSeparable_range_deriv [SeparableSpace š] (f : š ā F) :
IsSeparable (range (deriv f)) := by
rw [ā derivWithin_univ]
exact isSeparable_range_derivWithin _ _
lemma HasDerivAt.continuousAt_div [DecidableEq š] {f : š ā š} {c a : š} (hf : HasDerivAt f a c) :
ContinuousAt (Function.update (fun x ⦠(f x - f c) / (x - c)) c a) c := by
rw [ā slope_fun_def_field]
exact continuousAt_update_same.mpr <| hasDerivAt_iff_tendsto_slope.mp hf
section Order
variable [LinearOrder š] [IsStrictOrderedRing š] [OrderTopology š] {g : š ā š} {g' : š}
/-- If a monotone function has a derivative within a set at a non-isolated point, then this
derivative is nonnegative. -/
lemma HasDerivWithinAt.nonneg_of_monotoneOn (hx : AccPt x (š s))
(hd : HasDerivWithinAt g g' s x) (hg : MonotoneOn g s) : 0 ⤠g' := by
have : (š[s \ {x}] x).NeBot := accPt_principal_iff_nhdsWithin.mp hx
have h'g : MonotoneOn g (insert x s) :=
hg.insert_of_continuousWithinAt hx.clusterPt hd.continuousWithinAt
have : Tendsto (slope g x) (š[s \ {x}] x) (š g') := hasDerivWithinAt_iff_tendsto_slope.mp hd
apply ge_of_tendsto this
filter_upwards [self_mem_nhdsWithin] with y hy
simp only [mem_diff, mem_singleton_iff] at hy
exact h'g.slope_nonneg (by simp) (by simp [hy])
/-- The derivative within a set of a monotone function is nonnegative. -/
lemma MonotoneOn.derivWithin_nonneg (hg : MonotoneOn g s) :
0 ⤠derivWithin g s x := by
by_cases hd : DifferentiableWithinAt š g s x; swap
Ā· simp [derivWithin_zero_of_not_differentiableWithinAt hd]
by_cases hx : AccPt x (š s); swap
Ā· simp [derivWithin_zero_of_not_accPt hx]
exact hd.hasDerivWithinAt.nonneg_of_monotoneOn hx hg
/-- If a monotone function has a derivative, then this derivative is nonnegative. -/
lemma HasDerivAt.nonneg_of_monotone (hd : HasDerivAt g g' x) (hg : Monotone g) : 0 ⤠g' := by
rw [ā hasDerivWithinAt_univ] at hd
apply hd.nonneg_of_monotoneOn _ (hg.monotoneOn _)
exact PerfectSpace.univ_preperfect _ (mem_univ _)
/-- The derivative of a monotone function is nonnegative. -/
lemma Monotone.deriv_nonneg (hg : Monotone g) : 0 ⤠deriv g x := by
rw [ā derivWithin_univ]
exact (hg.monotoneOn univ).derivWithin_nonneg
/-- If an antitone function has a derivative within a set at a non-isolated point, then this
derivative is nonpositive. -/
lemma HasDerivWithinAt.nonpos_of_antitoneOn (hx : AccPt x (š s))
(hd : HasDerivWithinAt g g' s x) (hg : AntitoneOn g s) : g' ⤠0 := by
have : MonotoneOn (-g) s := fun x hx y hy hxy ⦠by simpa using hg hx hy hxy
simpa using hd.neg.nonneg_of_monotoneOn hx this
/-- The derivative within a set of an antitone function is nonpositive. -/
lemma AntitoneOn.derivWithin_nonpos (hg : AntitoneOn g s) :
derivWithin g s x ⤠0 := by
simpa [derivWithin.fun_neg] using hg.neg.derivWithin_nonneg
/-- If an antitone function has a derivative, then this derivative is nonpositive. -/
lemma HasDerivAt.nonpos_of_antitone (hd : HasDerivAt g g' x) (hg : Antitone g) : g' ⤠0 := by
rw [ā hasDerivWithinAt_univ] at hd
apply hd.nonpos_of_antitoneOn _ (hg.antitoneOn _)
exact PerfectSpace.univ_preperfect _ (mem_univ _)
/-- The derivative of an antitone function is nonpositive. -/
lemma Antitone.deriv_nonpos (hg : Antitone g) : deriv g x ⤠0 := by
rw [ā derivWithin_univ]
exact (hg.antitoneOn univ).derivWithin_nonpos
end Order
end NormedField
/-! ### Upper estimates on liminf and limsup -/
section Real
variable {f : ā ā ā} {f' : ā} {s : Set ā} {x : ā} {r : ā}
theorem HasDerivWithinAt.limsup_slope_le (hf : HasDerivWithinAt f f' s x) (hr : f' < r) :
āį¶ z in š[s \ {x}] x, slope f x z < r :=
hasDerivWithinAt_iff_tendsto_slope.1 hf (IsOpen.mem_nhds isOpen_Iio hr)
theorem HasDerivWithinAt.limsup_slope_le' (hf : HasDerivWithinAt f f' s x) (hs : x ā s)
(hr : f' < r) : āį¶ z in š[s] x, slope f x z < r :=
(hasDerivWithinAt_iff_tendsto_slope' hs).1 hf (IsOpen.mem_nhds isOpen_Iio hr)
theorem HasDerivWithinAt.liminf_right_slope_le (hf : HasDerivWithinAt f f' (Ici x) x)
(hr : f' < r) : āį¶ z in š[>] x, slope f x z < r :=
(hf.Ioi_of_Ici.limsup_slope_le' (lt_irrefl x) hr).frequently
end Real
section RealSpace
open Metric
variable {E : Type u} [NormedAddCommGroup E] [NormedSpace ā E] {f : ā ā E} {f' : E} {s : Set ā}
{x r : ā}
/-- If `f` has derivative `f'` within `s` at `x`, then for any `r > āf'ā` the ratio
`āf z - f xā / āz - xā` is less than `r` in some neighborhood of `x` within `s`.
In other words, the limit superior of this ratio as `z` tends to `x` along `s`
is less than or equal to `āf'ā`. -/
theorem HasDerivWithinAt.limsup_norm_slope_le (hf : HasDerivWithinAt f f' s x) (hr : āf'ā < r) :
āį¶ z in š[s] x, āz - xāā»Ā¹ * āf z - f xā < r := by
have hrā : 0 < r := lt_of_le_of_lt (norm_nonneg f') hr
have A : āį¶ z in š[s \ {x}] x, ā(z - x)ā»Ā¹ ⢠(f z - f x)ā ā Iio r :=
(hasDerivWithinAt_iff_tendsto_slope.1 hf).norm (IsOpen.mem_nhds isOpen_Iio hr)
have B : āį¶ z in š[{x}] x, ā(z - x)ā»Ā¹ ⢠(f z - f x)ā ā Iio r :=
mem_of_superset self_mem_nhdsWithin (singleton_subset_iff.2 <| by simp [hrā])
have C := mem_sup.2 āØA, Bā©
rw [ā nhdsWithin_union, diff_union_self, nhdsWithin_union, mem_sup] at C
filter_upwards [C.1]
simp only [norm_smul, mem_Iio, norm_inv]
exact fun _ => id
/-- If `f` has derivative `f'` within `s` at `x`, then for any `r > āf'ā` the ratio
`(āf zā - āf xā) / āz - xā` is less than `r` in some neighborhood of `x` within `s`.
In other words, the limit superior of this ratio as `z` tends to `x` along `s`
is less than or equal to `āf'ā`.
This lemma is a weaker version of `HasDerivWithinAt.limsup_norm_slope_le`
where `āf zā - āf xā` is replaced by `āf z - f xā`. -/
theorem HasDerivWithinAt.limsup_slope_norm_le (hf : HasDerivWithinAt f f' s x) (hr : āf'ā < r) :
āį¶ z in š[s] x, āz - xāā»Ā¹ * (āf zā - āf xā) < r := by
apply (hf.limsup_norm_slope_le hr).mono
intro z hz
refine lt_of_le_of_lt (mul_le_mul_of_nonneg_left (norm_sub_norm_le _ _) ?_) hz
exact inv_nonneg.2 (norm_nonneg _)
/-- If `f` has derivative `f'` within `(x, +ā)` at `x`, then for any `r > āf'ā` the ratio
`āf z - f xā / āz - xā` is frequently less than `r` as `z ā x+0`.
In other words, the limit inferior of this ratio as `z` tends to `x+0`
is less than or equal to `āf'ā`. See also `HasDerivWithinAt.limsup_norm_slope_le`
for a stronger version using limit superior and any set `s`. -/
theorem HasDerivWithinAt.liminf_right_norm_slope_le (hf : HasDerivWithinAt f f' (Ici x) x)
(hr : āf'ā < r) : āį¶ z in š[>] x, āz - xāā»Ā¹ * āf z - f xā < r :=
(hf.Ioi_of_Ici.limsup_norm_slope_le hr).frequently
/-- If `f` has derivative `f'` within `(x, +ā)` at `x`, then for any `r > āf'ā` the ratio
`(āf zā - āf xā) / (z - x)` is frequently less than `r` as `z ā x+0`.
In other words, the limit inferior of this ratio as `z` tends to `x+0`
is less than or equal to `āf'ā`.
See also
* `HasDerivWithinAt.limsup_norm_slope_le` for a stronger version using
limit superior and any set `s`;
* `HasDerivWithinAt.liminf_right_norm_slope_le` for a stronger version using
`āf z - f xpā` instead of `āf zā - āf xā`. -/
theorem HasDerivWithinAt.liminf_right_slope_norm_le (hf : HasDerivWithinAt f f' (Ici x) x)
(hr : āf'ā < r) : āį¶ z in š[>] x, (z - x)ā»Ā¹ * (āf zā - āf xā) < r := by
have := (hf.Ioi_of_Ici.limsup_slope_norm_le hr).frequently
refine this.mp (Eventually.mono self_mem_nhdsWithin fun z hxz hz ⦠?_)
rwa [Real.norm_eq_abs, abs_of_pos (sub_pos_of_lt hxz)] at hz
end RealSpace |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/Deriv/ZPow.lean | import Mathlib.Analysis.Calculus.Deriv.Pow
import Mathlib.Analysis.Calculus.Deriv.Inv
import Mathlib.Analysis.Calculus.Deriv.Shift
/-!
# Derivatives of `x ^ m`, `m : ā¤`
In this file we prove theorems about (iterated) derivatives of `x ^ m`, `m : ā¤`.
For a more detailed overview of one-dimensional derivatives in mathlib, see the module docstring of
`analysis/calculus/deriv/basic`.
## Keywords
derivative, power
-/
universe u v w
open Topology Filter Asymptotics Set
open scoped Nat
variable {š : Type u} [NontriviallyNormedField š]
variable {E : Type v} [NormedAddCommGroup E] [NormedSpace š E]
variable {x : š}
variable {s : Set š}
variable {m : ā¤}
/-! ### Derivative of `x ⦠x^m` for `m : ā¤` -/
theorem hasStrictDerivAt_zpow (m : ā¤) (x : š) (h : x ā 0 ⨠0 ⤠m) :
HasStrictDerivAt (fun x => x ^ m) ((m : š) * x ^ (m - 1)) x := by
have : ā m : ā¤, 0 < m ā HasStrictDerivAt (Ā· ^ m) ((m : š) * x ^ (m - 1)) x := fun m hm ⦠by
lift m to ā using hm.le
simp only [zpow_natCast, Int.cast_natCast]
convert hasStrictDerivAt_pow m x using 2
rw [ā Int.ofNat_one, ā Int.ofNat_sub, zpow_natCast]
norm_cast at hm
rcases lt_trichotomy m 0 with (hm | hm | hm)
Ā· have hx : x ā 0 := h.resolve_right hm.not_ge
have := (hasStrictDerivAt_inv ?_).scomp _ (this (-m) (neg_pos.2 hm)) <;>
[skip; exact zpow_ne_zero _ hx]
simp only [Function.comp_def, zpow_neg, inv_inv, smul_eq_mul] at this
convert this using 1
rw [sq, mul_inv, inv_inv, Int.cast_neg, neg_mul, neg_mul_neg, ā zpow_addā hx, mul_assoc, ā
zpow_addā hx]
congr
abel
Ā· simp only [hm, zpow_zero, Int.cast_zero, zero_mul, hasStrictDerivAt_const]
Ā· exact this m hm
theorem hasDerivAt_zpow (m : ā¤) (x : š) (h : x ā 0 ⨠0 ⤠m) :
HasDerivAt (fun x => x ^ m) ((m : š) * x ^ (m - 1)) x :=
(hasStrictDerivAt_zpow m x h).hasDerivAt
theorem hasDerivWithinAt_zpow (m : ā¤) (x : š) (h : x ā 0 ⨠0 ⤠m) (s : Set š) :
HasDerivWithinAt (fun x => x ^ m) ((m : š) * x ^ (m - 1)) s x :=
(hasDerivAt_zpow m x h).hasDerivWithinAt
theorem differentiableAt_zpow : DifferentiableAt š (fun x => x ^ m) x ā x ā 0 ⨠0 ⤠m :=
āØfun H => NormedField.continuousAt_zpow.1 H.continuousAt, fun H =>
(hasDerivAt_zpow m x H).differentiableAtā©
theorem differentiableWithinAt_zpow (m : ā¤) (x : š) (h : x ā 0 ⨠0 ⤠m) :
DifferentiableWithinAt š (fun x => x ^ m) s x :=
(differentiableAt_zpow.mpr h).differentiableWithinAt
theorem differentiableOn_zpow (m : ā¤) (s : Set š) (h : (0 : š) ā s ⨠0 ⤠m) :
DifferentiableOn š (fun x => x ^ m) s := fun x hxs =>
differentiableWithinAt_zpow m x <| h.imp_left <| ne_of_mem_of_not_mem hxs
theorem deriv_zpow (m : ā¤) (x : š) : deriv (fun x => x ^ m) x = m * x ^ (m - 1) := by
by_cases H : x ā 0 ⨠0 ⤠m
Ā· exact (hasDerivAt_zpow m x H).deriv
Ā· rw [deriv_zero_of_not_differentiableAt (mt differentiableAt_zpow.1 H)]
push_neg at H
rcases H with āØrfl, hmā©
rw [zero_zpow _ ((sub_one_lt _).trans hm).ne, mul_zero]
@[simp]
theorem deriv_zpow' (m : ā¤) : (deriv fun x : š => x ^ m) = fun x => (m : š) * x ^ (m - 1) :=
funext <| deriv_zpow m
theorem derivWithin_zpow (hxs : UniqueDiffWithinAt š s x) (h : x ā 0 ⨠0 ⤠m) :
derivWithin (fun x => x ^ m) s x = (m : š) * x ^ (m - 1) :=
(hasDerivWithinAt_zpow m x h s).derivWithin hxs
@[simp]
theorem iter_deriv_zpow' (m : ā¤) (k : ā) :
(deriv^[k] fun x : š => x ^ m) =
fun x => (ā i ā Finset.range k, ((m : š) - i)) * x ^ (m - k) := by
induction k with
| zero =>
simp only [one_mul, Int.ofNat_zero, id, sub_zero, Finset.prod_range_zero, Function.iterate_zero]
| succ k ihk =>
simp only [Function.iterate_succ_apply', ihk, deriv_const_mul_field', deriv_zpow',
Finset.prod_range_succ, Int.natCast_succ, ā sub_sub, Int.cast_sub, Int.cast_natCast,
mul_assoc]
theorem iter_deriv_zpow (m : ā¤) (x : š) (k : ā) :
deriv^[k] (fun y => y ^ m) x = (ā i ā Finset.range k, ((m : š) - i)) * x ^ (m - k) :=
congr_fun (iter_deriv_zpow' m k) x
theorem iter_deriv_pow (n : ā) (x : š) (k : ā) :
deriv^[k] (fun x : š => x ^ n) x = (ā i ā Finset.range k, ((n : š) - i)) * x ^ (n - k) := by
simp only [ā zpow_natCast, iter_deriv_zpow, Int.cast_natCast]
rcases le_or_gt k n with hkn | hnk
Ā· rw [Int.ofNat_sub hkn]
Ā· have : (ā i ā Finset.range k, (n - i : š)) = 0 :=
Finset.prod_eq_zero (Finset.mem_range.2 hnk) (sub_self _)
simp only [this, zero_mul]
@[simp]
theorem iter_deriv_pow' (n k : ā) :
(deriv^[k] fun x : š => x ^ n) =
fun x => (ā i ā Finset.range k, ((n : š) - i)) * x ^ (n - k) :=
funext fun x => iter_deriv_pow n x k
theorem iter_deriv_inv (k : ā) (x : š) :
deriv^[k] Inv.inv x = (-1) ^ k * k ! * x ^ (-1 - k : ā¤) := calc
deriv^[k] Inv.inv x = deriv^[k] (Ā· ^ (-1 : ā¤)) x := by simp
_ = (ā i ā Finset.range k, (-1 - i : š)) * x ^ (-1 - k : ā¤) := mod_cast iter_deriv_zpow (-1) x k
_ = (-1) ^ k * k ! * x ^ (-1 - k : ā¤) := by
simp only [ā neg_add', Finset.prod_neg, ā Finset.prod_Ico_id_eq_factorial,
Finset.prod_Ico_eq_prod_range]
simp
@[simp]
theorem iter_deriv_inv' (k : ā) :
deriv^[k] Inv.inv = fun x : š => (-1) ^ k * k ! * x ^ (-1 - k : ā¤) :=
funext (iter_deriv_inv k)
open Nat Function in
theorem iter_deriv_inv_linear (k : ā) (c d : š) :
deriv^[k] (fun x ⦠(c * x + d)ā»Ā¹) =
(fun x : š ⦠(-1) ^ k * k ! * c ^ k * (c * x + d) ^ (-1 - k : ā¤)) := by
induction k with
| zero => simp
| succ k ihk =>
rw [factorial_succ, add_comm k 1, iterate_add_apply, ihk]
ext z
simp only [Int.reduceNeg, iterate_one, deriv_const_mul_field', cast_add, cast_one]
by_cases hd : c = 0
Ā· simp [hd]
Ā· have := deriv_comp_add_const (fun x ⦠(c * x) ^ (-1 - k : ā¤)) (d / c) z
have h0 : (fun x ⦠(c * (x + d / c)) ^ (-1 - (k : ā¤))) =
(fun x ⦠(c * x + d) ^ (-1 - (k : ā¤))) := by
ext y
field_simp
rw [h0, deriv_comp_mul_left c (fun x ⦠(x) ^ (-1 - k : ā¤)) (z + d / c)] at this
simp [this]
field_simp
ring_nf
theorem iter_deriv_inv_linear_sub (k : ā) (c d : š) :
deriv^[k] (fun x ⦠(c * x - d)ā»Ā¹) =
(fun x : š ⦠(-1) ^ k * k ! * c ^ k * (c * x - d) ^ (-1 - k : ā¤)) := by
simpa [sub_eq_add_neg] using iter_deriv_inv_linear k c (-d)
variable {f : E ā š} {t : Set E} {a : E}
theorem DifferentiableWithinAt.zpow (hf : DifferentiableWithinAt š f t a) (h : f a ā 0 ⨠0 ⤠m) :
DifferentiableWithinAt š (fun x => f x ^ m) t a :=
(differentiableAt_zpow.2 h).comp_differentiableWithinAt a hf
theorem DifferentiableAt.zpow (hf : DifferentiableAt š f a) (h : f a ā 0 ⨠0 ⤠m) :
DifferentiableAt š (fun x => f x ^ m) a :=
(differentiableAt_zpow.2 h).comp a hf
theorem DifferentiableOn.zpow (hf : DifferentiableOn š f t) (h : (ā x ā t, f x ā 0) ⨠0 ⤠m) :
DifferentiableOn š (fun x => f x ^ m) t := fun x hx =>
(hf x hx).zpow <| h.imp_left fun h => h x hx
theorem Differentiable.zpow (hf : Differentiable š f) (h : (ā x, f x ā 0) ⨠0 ⤠m) :
Differentiable š fun x => f x ^ m := fun x => (hf x).zpow <| h.imp_left fun h => h x |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/Deriv/CompMul.lean | import Mathlib.Analysis.Calculus.FDeriv.Equiv
import Mathlib.Analysis.Calculus.Deriv.Mul
/-!
# Derivative of `x ⦠f (cx)`
In this file we prove that the derivative of `fun x ⦠f (c * x)`
equals `c` times the derivative of `f` evaluated at `c * x`.
Since Mathlib uses `0` as the fallback value for the derivatives whenever they are undefined,
the theorems in this file require neither differentiability of `f`,
nor assumptions like `UniqueDiffWithinAt š s x`.
-/
open Set
open scoped Pointwise
variable {š E : Type*} [NontriviallyNormedField š] [NormedAddCommGroup E] [NormedSpace š E]
{c : š} {f : š ā E} {f' : E} {s : Set š} {x : š}
theorem hasDerivWithinAt_comp_mul_left_smul_iff :
HasDerivWithinAt (f <| c * Ā·) (c ⢠f') s x ā HasDerivWithinAt f f' (c ⢠s) (c * x) := by
simp only [hasDerivWithinAt_iff_hasFDerivWithinAt, ā smul_eq_mul,
ā hasFDerivWithinAt_comp_smul_smul_iff]
simp only [ContinuousLinearMap.one_smulRight_eq_toSpanSingleton,
ContinuousLinearMap.toSpanSingleton_smul]
variable (c f s x) in
theorem derivWithin_comp_mul_left :
derivWithin (f <| c * ·) s x = c ⢠derivWithin f (c ⢠s) (c * x) := by
simp only [ā smul_eq_mul]
rw [ā derivWithin_const_smul', derivWithin, derivWithin,
fderivWithin_comp_smul_eq_fderivWithin_smul, Pi.smul_def]
variable (c f x) in
theorem deriv_comp_mul_left : deriv (f <| c * ·) x = c ⢠deriv f (c * x) := by
simp only [ā smul_eq_mul, deriv, fderiv_comp_smul, ContinuousLinearMap.smul_apply] |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/Deriv/Polynomial.lean | import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Algebra.Polynomial.Derivative
import Mathlib.Analysis.Calculus.Deriv.Mul
import Mathlib.Analysis.Calculus.Deriv.Pow
import Mathlib.Analysis.Calculus.Deriv.Add
/-!
# Derivatives of polynomials
In this file we prove that derivatives of polynomials in the analysis sense agree with their
derivatives in the algebraic sense.
For a more detailed overview of one-dimensional derivatives in mathlib, see the module docstring of
`analysis/calculus/deriv/basic`.
## TODO
* Add results about multivariable polynomials.
* Generalize some (most?) results to an algebra over the base field.
## Keywords
derivative, polynomial
-/
universe u
open scoped Polynomial
open ContinuousLinearMap (smulRight)
variable {š : Type u} [NontriviallyNormedField š] {x : š} {s : Set š}
namespace Polynomial
/-! ### Derivative of a polynomial -/
variable {R : Type*} [CommSemiring R] [Algebra R š]
variable (p : š[X]) (q : R[X])
/-- The derivative (in the analysis sense) of a polynomial `p` is given by `p.derivative`. -/
protected theorem hasStrictDerivAt (x : š) :
HasStrictDerivAt (fun x => p.eval x) (p.derivative.eval x) x := by
induction p using Polynomial.induction_on' with
| add p q hp hq => simpa using hp.add hq
| monomial n a => simpa [mul_assoc, derivative_monomial]
using (hasStrictDerivAt_pow n x).const_mul a
protected theorem hasStrictDerivAt_aeval (x : š) :
HasStrictDerivAt (fun x => aeval x q) (aeval x (derivative q)) x := by
simpa only [aeval_def, evalā_eq_eval_map, derivative_map] using
(q.map (algebraMap R š)).hasStrictDerivAt x
/-- The derivative (in the analysis sense) of a polynomial `p` is given by `p.derivative`. -/
protected theorem hasDerivAt (x : š) : HasDerivAt (fun x => p.eval x) (p.derivative.eval x) x :=
(p.hasStrictDerivAt x).hasDerivAt
protected theorem hasDerivAt_aeval (x : š) :
HasDerivAt (fun x => aeval x q) (aeval x (derivative q)) x :=
(q.hasStrictDerivAt_aeval x).hasDerivAt
protected theorem hasDerivWithinAt (x : š) (s : Set š) :
HasDerivWithinAt (fun x => p.eval x) (p.derivative.eval x) s x :=
(p.hasDerivAt x).hasDerivWithinAt
protected theorem hasDerivWithinAt_aeval (x : š) (s : Set š) :
HasDerivWithinAt (fun x => aeval x q) (aeval x (derivative q)) s x :=
(q.hasDerivAt_aeval x).hasDerivWithinAt
protected theorem differentiableAt : DifferentiableAt š (fun x => p.eval x) x :=
(p.hasDerivAt x).differentiableAt
protected theorem differentiableAt_aeval : DifferentiableAt š (fun x => aeval x q) x :=
(q.hasDerivAt_aeval x).differentiableAt
protected theorem differentiableWithinAt : DifferentiableWithinAt š (fun x => p.eval x) s x :=
p.differentiableAt.differentiableWithinAt
protected theorem differentiableWithinAt_aeval :
DifferentiableWithinAt š (fun x => aeval x q) s x :=
q.differentiableAt_aeval.differentiableWithinAt
@[fun_prop]
protected theorem differentiable : Differentiable š fun x => p.eval x := fun _ => p.differentiableAt
protected theorem differentiable_aeval : Differentiable š fun x : š => aeval x q := fun _ =>
q.differentiableAt_aeval
protected theorem differentiableOn : DifferentiableOn š (fun x => p.eval x) s :=
p.differentiable.differentiableOn
protected theorem differentiableOn_aeval : DifferentiableOn š (fun x => aeval x q) s :=
q.differentiable_aeval.differentiableOn
@[simp]
protected theorem deriv : deriv (fun x => p.eval x) x = p.derivative.eval x :=
(p.hasDerivAt x).deriv
@[simp]
protected theorem deriv_aeval : deriv (fun x => aeval x q) x = aeval x (derivative q) :=
(q.hasDerivAt_aeval x).deriv
protected theorem derivWithin (hxs : UniqueDiffWithinAt š s x) :
derivWithin (fun x => p.eval x) s x = p.derivative.eval x := by
rw [DifferentiableAt.derivWithin p.differentiableAt hxs]
exact p.deriv
protected theorem derivWithin_aeval (hxs : UniqueDiffWithinAt š s x) :
derivWithin (fun x => aeval x q) s x = aeval x (derivative q) := by
simpa only [aeval_def, evalā_eq_eval_map, derivative_map] using
(q.map (algebraMap R š)).derivWithin hxs
protected theorem hasFDerivAt (x : š) :
HasFDerivAt (fun x => p.eval x) (smulRight (1 : š āL[š] š) (p.derivative.eval x)) x :=
p.hasDerivAt x
protected theorem hasFDerivAt_aeval (x : š) :
HasFDerivAt (fun x => aeval x q) (smulRight (1 : š āL[š] š) (aeval x (derivative q))) x :=
q.hasDerivAt_aeval x
protected theorem hasFDerivWithinAt (x : š) :
HasFDerivWithinAt (fun x => p.eval x) (smulRight (1 : š āL[š] š) (p.derivative.eval x)) s x :=
(p.hasFDerivAt x).hasFDerivWithinAt
protected theorem hasFDerivWithinAt_aeval (x : š) :
HasFDerivWithinAt (fun x => aeval x q) (smulRight (1 : š āL[š] š)
(aeval x (derivative q))) s x :=
(q.hasFDerivAt_aeval x).hasFDerivWithinAt
@[simp]
protected theorem fderiv :
fderiv š (fun x => p.eval x) x = smulRight (1 : š āL[š] š) (p.derivative.eval x) :=
(p.hasFDerivAt x).fderiv
@[simp]
protected theorem fderiv_aeval :
fderiv š (fun x => aeval x q) x = smulRight (1 : š āL[š] š) (aeval x (derivative q)) :=
(q.hasFDerivAt_aeval x).fderiv
protected theorem fderivWithin (hxs : UniqueDiffWithinAt š s x) :
fderivWithin š (fun x => p.eval x) s x = smulRight (1 : š āL[š] š) (p.derivative.eval x) :=
(p.hasFDerivWithinAt x).fderivWithin hxs
protected theorem fderivWithin_aeval (hxs : UniqueDiffWithinAt š s x) :
fderivWithin š (fun x => aeval x q) s x = smulRight (1 : š āL[š] š) (aeval x (derivative q)) :=
(q.hasFDerivWithinAt_aeval x).fderivWithin hxs
end Polynomial |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/Deriv/Shift.lean | import Mathlib.Analysis.Calculus.Deriv.Add
import Mathlib.Analysis.Calculus.Deriv.Comp
import Mathlib.Analysis.Calculus.Deriv.CompMul
/-!
### Invariance of the derivative under translation
We show that if a function `f` has derivative `f'` at a point `a + x`, then `f (a + Ā·)`
has derivative `f'` at `x`. Similarly for `x + a`.
-/
open scoped Pointwise
variable {š F : Type*} [NontriviallyNormedField š] [NormedAddCommGroup F] [NormedSpace š F]
{f : š ā F} {f' : F}
/-- Translation in the domain does not change the derivative. -/
lemma HasDerivAt.comp_const_add (a x : š) (hf : HasDerivAt f f' (a + x)) :
HasDerivAt (fun x ⦠f (a + x)) f' x := by
simpa [Function.comp_def] using HasDerivAt.scomp (š := š) x hf <| hasDerivAt_id' x |>.const_add a
/-- Translation in the domain does not change the derivative. -/
lemma HasDerivAt.comp_add_const (x a : š) (hf : HasDerivAt f f' (x + a)) :
HasDerivAt (fun x ⦠f (x + a)) f' x := by
simpa [Function.comp_def] using HasDerivAt.scomp (š := š) x hf <| hasDerivAt_id' x |>.add_const a
/-- Translation in the domain does not change the derivative. -/
lemma HasDerivAt.comp_const_sub (a x : š) (hf : HasDerivAt f f' (a - x)) :
HasDerivAt (fun x ⦠f (a - x)) (-f') x := by
simpa [Function.comp_def] using HasDerivAt.scomp (š := š) x hf <| hasDerivAt_id' x |>.const_sub a
/-- Translation in the domain does not change the derivative. -/
lemma HasDerivAt.comp_sub_const (x a : š) (hf : HasDerivAt f f' (x - a)) :
HasDerivAt (fun x ⦠f (x - a)) f' x := by
simpa [Function.comp_def] using HasDerivAt.scomp (š := š) x hf <| hasDerivAt_id' x |>.sub_const a
variable (f)
variable (a : š) (s : Set š) (x : š)
lemma derivWithin_comp_neg : derivWithin (f <| -Ā·) s x = -derivWithin f (-s) (-x) := by
simpa using derivWithin_comp_mul_left (-1) f s x
/-- The derivative of `x ⦠f (-x)` at `a` is the negative of the derivative of `f` at `-a`. -/
lemma deriv_comp_neg : deriv (fun x ⦠f (-x)) x = -deriv f (-x) := by
simpa using deriv_comp_mul_left (-1) f x
/-- Translation in the domain does not change the derivative. -/
lemma derivWithin_comp_const_add :
derivWithin (f <| a + ·) s x = derivWithin f (a +ᵄ s) (a + x) := by
simp only [derivWithin, fderivWithin_comp_add_left]
/-- Translation in the domain does not change the derivative. -/
lemma deriv_comp_const_add : deriv (fun x ⦠f (a + x)) x = deriv f (a + x) := by
simp only [deriv, fderiv_comp_add_left]
/-- Translation in the domain does not change the derivative. -/
lemma derivWithin_comp_add_const :
derivWithin (f <| · + a) s x = derivWithin f (a +ᵄ s) (x + a) := by
simp only [derivWithin, fderivWithin_comp_add_right]
/-- Translation in the domain does not change the derivative. -/
lemma deriv_comp_add_const : deriv (fun x ⦠f (x + a)) x = deriv f (x + a) := by
simpa [add_comm] using deriv_comp_const_add f a x
lemma derivWithin_comp_const_sub :
derivWithin (f <| a - ·) s x = -derivWithin f (a +ᵄ -s) (a - x) := by
simp only [sub_eq_add_neg]
rw [derivWithin_comp_neg (f <| a + Ā·), derivWithin_comp_const_add]
lemma deriv_comp_const_sub : deriv (fun x ⦠f (a - x)) x = -deriv f (a - x) := by
simp_rw [sub_eq_add_neg, deriv_comp_neg (f <| a + Ā·), deriv_comp_const_add]
lemma derivWithin_comp_sub_const :
derivWithin (fun x ⦠f (x - a)) s x = derivWithin f (-a +ᵄ s) (x - a) := by
simp_rw [sub_eq_add_neg, derivWithin_comp_add_const]
lemma deriv_comp_sub_const : deriv (fun x ⦠f (x - a)) x = deriv f (x - a) := by
simp_rw [sub_eq_add_neg, deriv_comp_add_const] |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/Deriv/MeanValue.lean | import Mathlib.Analysis.Calculus.Deriv.AffineMap
import Mathlib.Analysis.Calculus.Deriv.Comp
import Mathlib.Analysis.Calculus.Deriv.Mul
import Mathlib.Analysis.Calculus.Deriv.Slope
import Mathlib.Analysis.Calculus.LocalExtr.Rolle
import Mathlib.Analysis.Normed.Group.AddTorsor
import Mathlib.Analysis.RCLike.Basic
/-!
# Mean value theorem
In this file we prove Cauchy's and Lagrange's mean value theorems, and deduce some corollaries.
Cauchy's mean value theorem says that for two functions `f` and `g`
that are continuous on `[a, b]` and are differentiable on `(a, b)`,
there exists a point `c ā (a, b)` such that `f' c / g' c = (f b - f a) / (g b - g a)`.
We formulate this theorem with both sides multiplied by the denominators,
see `exists_ratio_hasDerivAt_eq_ratio_slope`,
in order to avoid auxiliary conditions like `g' c ā 0`.
Lagrange's mean value theorem, see `exists_hasDerivAt_eq_slope`,
says that for a function `f` that is continuous on `[a, b]` and is differentiable on `(a, b)`,
there exists a point `c ā (a, b)` such that `f' c = (f b - f a) / (b - a)`.
Lagrange's MVT implies that `(f b - f a) / (b - a) > C`
provided that `f' c > C` for all `c ā (a, b)`, see `mul_sub_lt_image_sub_of_lt_deriv`,
and other theorems for `>` / `ā„` / `<` / `ā¤`.
In case `C = 0`, we deduce that a function with a positive derivative is strictly monotone,
see `strictMonoOn_of_deriv_pos` and nearby theorems for other types of monotonicity.
We also prove that a real function whose derivative tends to infinity from the right at a point
is not differentiable on the right at that point, and similarly differentiability on the left.
## Main results
* `exists_ratio_hasDerivAt_eq_ratio_slope` and `exists_ratio_deriv_eq_ratio_slope` :
Cauchy's Mean Value Theorem.
* `exists_hasDerivAt_eq_slope` and `exists_deriv_eq_slope` : Lagrange's Mean Value Theorem.
* `domain_mvt` : Lagrange's Mean Value Theorem, applied to a segment in a convex domain.
* `Convex.image_sub_lt_mul_sub_of_deriv_lt`, `Convex.mul_sub_lt_image_sub_of_lt_deriv`,
`Convex.image_sub_le_mul_sub_of_deriv_le`, `Convex.mul_sub_le_image_sub_of_le_deriv`,
if `ā x, C (</ā¤/>/ā„) (f' x)`, then `C * (y - x) (</ā¤/>/ā„) (f y - f x)` whenever `x < y`.
* `monotoneOn_of_deriv_nonneg`, `antitoneOn_of_deriv_nonpos`,
`strictMono_of_deriv_pos`, `strictAnti_of_deriv_neg` :
if the derivative of a function is non-negative/non-positive/positive/negative, then
the function is monotone/antitone/strictly monotone/strictly monotonically
decreasing.
* `convexOn_of_deriv`, `convexOn_of_deriv2_nonneg` : if the derivative of a function
is increasing or its second derivative is nonnegative, then the original function is convex.
-/
open Set Function Filter
open scoped Topology
/-! ### Functions `[a, b] ā ā`. -/
section Interval
-- Declare all variables here to make sure they come in a correct order
variable (f f' : ā ā ā) {a b : ā} (hab : a < b) (hfc : ContinuousOn f (Icc a b))
(hff' : ā x ā Ioo a b, HasDerivAt f (f' x) x) (hfd : DifferentiableOn ā f (Ioo a b))
(g g' : ā ā ā) (hgc : ContinuousOn g (Icc a b)) (hgg' : ā x ā Ioo a b, HasDerivAt g (g' x) x)
(hgd : DifferentiableOn ā g (Ioo a b))
include hab hfc hff' hgc hgg' in
/-- Cauchy's **Mean Value Theorem**, `HasDerivAt` version. -/
theorem exists_ratio_hasDerivAt_eq_ratio_slope :
ā c ā Ioo a b, (g b - g a) * f' c = (f b - f a) * g' c := by
let h x := (g b - g a) * f x - (f b - f a) * g x
have hI : h a = h b := by simp only [h]; ring
let h' x := (g b - g a) * f' x - (f b - f a) * g' x
have hhh' : ā x ā Ioo a b, HasDerivAt h (h' x) x := fun x hx =>
((hff' x hx).const_mul (g b - g a)).sub ((hgg' x hx).const_mul (f b - f a))
have hhc : ContinuousOn h (Icc a b) :=
(continuousOn_const.mul hfc).sub (continuousOn_const.mul hgc)
rcases exists_hasDerivAt_eq_zero hab hhc hI hhh' with āØc, cmem, hcā©
exact āØc, cmem, sub_eq_zero.1 hcā©
include hab in
/-- Cauchy's **Mean Value Theorem**, extended `HasDerivAt` version. -/
theorem exists_ratio_hasDerivAt_eq_ratio_slope' {lfa lga lfb lgb : ā}
(hff' : ā x ā Ioo a b, HasDerivAt f (f' x) x) (hgg' : ā x ā Ioo a b, HasDerivAt g (g' x) x)
(hfa : Tendsto f (š[>] a) (š lfa)) (hga : Tendsto g (š[>] a) (š lga))
(hfb : Tendsto f (š[<] b) (š lfb)) (hgb : Tendsto g (š[<] b) (š lgb)) :
ā c ā Ioo a b, (lgb - lga) * f' c = (lfb - lfa) * g' c := by
let h x := (lgb - lga) * f x - (lfb - lfa) * g x
have hha : Tendsto h (š[>] a) (š <| lgb * lfa - lfb * lga) := by
have : Tendsto h (š[>] a) (š <| (lgb - lga) * lfa - (lfb - lfa) * lga) :=
(tendsto_const_nhds.mul hfa).sub (tendsto_const_nhds.mul hga)
convert this using 2
ring
have hhb : Tendsto h (š[<] b) (š <| lgb * lfa - lfb * lga) := by
have : Tendsto h (š[<] b) (š <| (lgb - lga) * lfb - (lfb - lfa) * lgb) :=
(tendsto_const_nhds.mul hfb).sub (tendsto_const_nhds.mul hgb)
convert this using 2
ring
let h' x := (lgb - lga) * f' x - (lfb - lfa) * g' x
have hhh' : ā x ā Ioo a b, HasDerivAt h (h' x) x := by
intro x hx
exact ((hff' x hx).const_mul _).sub ((hgg' x hx).const_mul _)
rcases exists_hasDerivAt_eq_zero' hab hha hhb hhh' with āØc, cmem, hcā©
exact āØc, cmem, sub_eq_zero.1 hcā©
include hab hfc hff' in
/-- Lagrange's Mean Value Theorem, `HasDerivAt` version -/
theorem exists_hasDerivAt_eq_slope : ā c ā Ioo a b, f' c = (f b - f a) / (b - a) := by
obtain āØc, cmem, hcā© : ā c ā Ioo a b, (b - a) * f' c = (f b - f a) * 1 :=
exists_ratio_hasDerivAt_eq_ratio_slope f f' hab hfc hff' id 1 continuousOn_id
fun x _ => hasDerivAt_id x
use c, cmem
rwa [mul_one, mul_comm, ā eq_div_iff (sub_ne_zero.2 hab.ne')] at hc
include hab hfc hgc hgd hfd in
/-- Cauchy's Mean Value Theorem, `deriv` version. -/
theorem exists_ratio_deriv_eq_ratio_slope :
ā c ā Ioo a b, (g b - g a) * deriv f c = (f b - f a) * deriv g c :=
exists_ratio_hasDerivAt_eq_ratio_slope f (deriv f) hab hfc
(fun x hx => ((hfd x hx).differentiableAt <| IsOpen.mem_nhds isOpen_Ioo hx).hasDerivAt) g
(deriv g) hgc fun x hx =>
((hgd x hx).differentiableAt <| IsOpen.mem_nhds isOpen_Ioo hx).hasDerivAt
include hab in
/-- Cauchy's Mean Value Theorem, extended `deriv` version. -/
theorem exists_ratio_deriv_eq_ratio_slope' {lfa lga lfb lgb : ā}
(hdf : DifferentiableOn ā f <| Ioo a b) (hdg : DifferentiableOn ā g <| Ioo a b)
(hfa : Tendsto f (š[>] a) (š lfa)) (hga : Tendsto g (š[>] a) (š lga))
(hfb : Tendsto f (š[<] b) (š lfb)) (hgb : Tendsto g (š[<] b) (š lgb)) :
ā c ā Ioo a b, (lgb - lga) * deriv f c = (lfb - lfa) * deriv g c :=
exists_ratio_hasDerivAt_eq_ratio_slope' _ _ hab _ _
(fun x hx => ((hdf x hx).differentiableAt <| Ioo_mem_nhds hx.1 hx.2).hasDerivAt)
(fun x hx => ((hdg x hx).differentiableAt <| Ioo_mem_nhds hx.1 hx.2).hasDerivAt) hfa hga hfb hgb
include hab hfc hfd in
/-- Lagrange's **Mean Value Theorem**, `deriv` version. -/
theorem exists_deriv_eq_slope : ā c ā Ioo a b, deriv f c = (f b - f a) / (b - a) :=
exists_hasDerivAt_eq_slope f (deriv f) hab hfc fun x hx =>
((hfd x hx).differentiableAt <| IsOpen.mem_nhds isOpen_Ioo hx).hasDerivAt
include hab hfc hfd in
/-- Lagrange's **Mean Value Theorem**, `deriv` version. -/
theorem exists_deriv_eq_slope' : ā c ā Ioo a b, deriv f c = slope f a b := by
rw [slope_def_field]
exact exists_deriv_eq_slope f hab hfc hfd
/-- A real function whose derivative tends to infinity from the right at a point is not
differentiable on the right at that point. -/
theorem not_differentiableWithinAt_of_deriv_tendsto_atTop_Ioi (f : ā ā ā) {a : ā}
(hf : Tendsto (deriv f) (š[>] a) atTop) : ¬ DifferentiableWithinAt ā f (Ioi a) a := by
replace hf : Tendsto (derivWithin f (Ioi a)) (š[>] a) atTop := by
refine hf.congr' ?_
filter_upwards [eventually_mem_nhdsWithin] with x hx
have : Ioi a ā š x := by simp [ā mem_interior_iff_mem_nhds, hx]
exact (derivWithin_of_mem_nhds this).symm
by_cases hcont_at_a : ContinuousWithinAt f (Ici a) a
case neg =>
intro hcontra
have := hcontra.continuousWithinAt
rw [ā ContinuousWithinAt.diff_iff this] at hcont_at_a
simp at hcont_at_a
case pos =>
intro hdiff
replace hdiff := hdiff.hasDerivWithinAt
rw [hasDerivWithinAt_iff_tendsto_slope, Set.diff_singleton_eq_self notMem_Ioi_self] at hdiff
have hā : āį¶ b in š[>] a,
ā x ā Ioc a b, max (derivWithin f (Ioi a) a + 1) 0 < derivWithin f (Ioi a) x := by
rw [(nhdsGT_basis a).eventually_iff]
rw [(nhdsGT_basis a).tendsto_left_iff] at hf
obtain āØb, hab, hbā© := hf (Ioi (max (derivWithin f (Ioi a) a + 1) 0)) (Ioi_mem_atTop _)
refine āØb, hab, fun x hx z hz => ?_ā©
simp only [MapsTo, mem_Ioo, mem_Ioi, and_imp] at hb
exact hb hz.1 <| hz.2.trans_lt hx.2
have hā : āį¶ b in š[>] a, slope f a b < derivWithin f (Ioi a) a + 1 := by
rw [(nhds_basis_Ioo _).tendsto_right_iff] at hdiff
specialize hdiff āØderivWithin f (Ioi a) a - 1, derivWithin f (Ioi a) a + 1ā© <| by simp
filter_upwards [hdiff] with z hz using hz.2
have hcontra : āį¶ _ in š[>] a, False := by
filter_upwards [hā, hā, eventually_mem_nhdsWithin] with b hb hslope (hab : a < b)
have hdiff' : DifferentiableOn ā f (Ioc a b) := fun z hz => by
refine DifferentiableWithinAt.mono (t := Ioi a) ?_ Ioc_subset_Ioi_self
have : derivWithin f (Ioi a) z ā 0 := ne_of_gt <| by
simp_all only [and_imp, mem_Ioc, max_lt_iff]
exact differentiableWithinAt_of_derivWithin_ne_zero this
have hcont_Ioc : ā z ā Ioc a b, ContinuousWithinAt f (Icc a b) z := by
intro z hz''
refine (hdiff'.continuousOn z hz'').mono_of_mem_nhdsWithin ?_
have hfinal : š[Ioc a b] z = š[Icc a b] z := by
refine nhdsWithin_eq_nhdsWithin' (s := Ioi a) (Ioi_mem_nhds hz''.1) ?_
simp only [Ioc_inter_Ioi, le_refl, sup_of_le_left]
ext y
exact āØfun h => āØmem_Icc_of_Ioc h, mem_of_mem_inter_left hā©, fun āØH1, H2ā© => āØH2, H1.2ā©ā©
rw [ā hfinal]
exact self_mem_nhdsWithin
have hcont : ContinuousOn f (Icc a b) := by
intro z hz
by_cases hz' : z = a
Ā· rw [hz']
exact hcont_at_a.mono Icc_subset_Ici_self
Ā· exact hcont_Ioc z āØlt_of_le_of_ne hz.1 (Ne.symm hz'), hz.2ā©
obtain āØx, hxā, hxāā© :=
exists_deriv_eq_slope' f hab hcont (hdiff'.mono (Ioo_subset_Ioc_self))
specialize hb x āØhxā.1, le_of_lt hxā.2ā©
replace hxā : derivWithin f (Ioi a) x = slope f a b := by
have : Ioi a ā š x := by simp [ā mem_interior_iff_mem_nhds, hxā.1]
rwa [derivWithin_of_mem_nhds this]
rw [hxā, max_lt_iff] at hb
linarith
simp [Filter.eventually_false_iff_eq_bot, ā notMem_closure_iff_nhdsWithin_eq_bot] at hcontra
/-- A real function whose derivative tends to minus infinity from the right at a point is not
differentiable on the right at that point -/
theorem not_differentiableWithinAt_of_deriv_tendsto_atBot_Ioi (f : ā ā ā) {a : ā}
(hf : Tendsto (deriv f) (š[>] a) atBot) : ¬ DifferentiableWithinAt ā f (Ioi a) a := by
intro h
have hf' : Tendsto (deriv (-f)) (š[>] a) atTop := by
rw [deriv.neg']
exact tendsto_neg_atBot_atTop.comp hf
exact not_differentiableWithinAt_of_deriv_tendsto_atTop_Ioi (-f) hf' h.neg
/-- A real function whose derivative tends to minus infinity from the left at a point is not
differentiable on the left at that point -/
theorem not_differentiableWithinAt_of_deriv_tendsto_atBot_Iio (f : ā ā ā) {a : ā}
(hf : Tendsto (deriv f) (š[<] a) atBot) : ¬ DifferentiableWithinAt ā f (Iio a) a := by
let f' := f ā Neg.neg
have hderiv : deriv f' =į¶ [š[>] (-a)] -(deriv f ā Neg.neg) := by
rw [atBot_basis.tendsto_right_iff] at hf
specialize hf (-1) trivial
rw [(nhdsLT_basis a).eventually_iff] at hf
rw [EventuallyEq, (nhdsGT_basis (-a)).eventually_iff]
obtain āØb, hbā, hbāā© := hf
refine āØ-b, by linarith, fun x hx => ?_ā©
simp only [Pi.neg_apply, Function.comp_apply]
suffices deriv f' x = deriv f (-x) * deriv (Neg.neg : ā ā ā) x by simpa using this
refine deriv_comp x (differentiableAt_of_deriv_ne_zero ?_) (by fun_prop)
rw [mem_Ioo] at hx
have hā : -x ā Ioo b a := āØby linarith, by linarithā©
have hā : deriv f (-x) ⤠-1 := hbā hā
exact ne_of_lt (by linarith)
have hmain : ¬ DifferentiableWithinAt ā f' (Ioi (-a)) (-a) := by
refine not_differentiableWithinAt_of_deriv_tendsto_atTop_Ioi f' <| Tendsto.congr' hderiv.symm ?_
refine Tendsto.comp (g := -deriv f) ?_ tendsto_neg_nhdsGT_neg
exact Tendsto.comp (g := Neg.neg) tendsto_neg_atBot_atTop hf
intro h
have : DifferentiableWithinAt ā f' (Ioi (-a)) (-a) := by
refine DifferentiableWithinAt.comp (g := f) (f := Neg.neg) (t := Iio a) (-a) ?_ ?_ ?_
Ā· simp [h]
Ā· fun_prop
Ā· intro x
simp [neg_lt]
exact hmain this
/-- A real function whose derivative tends to infinity from the left at a point is not
differentiable on the left at that point -/
theorem not_differentiableWithinAt_of_deriv_tendsto_atTop_Iio (f : ā ā ā) {a : ā}
(hf : Tendsto (deriv f) (š[<] a) atTop) : ¬ DifferentiableWithinAt ā f (Iio a) a := by
intro h
have hf' : Tendsto (deriv (-f)) (š[<] a) atBot := by
rw [deriv.neg']
exact tendsto_neg_atTop_atBot.comp hf
exact not_differentiableWithinAt_of_deriv_tendsto_atBot_Iio (-f) hf' h.neg
end Interval
/-- Let `f` be a function continuous on a convex (or, equivalently, connected) subset `D`
of the real line. If `f` is differentiable on the interior of `D` and `C < f'`, then
`f` grows faster than `C * x` on `D`, i.e., `C * (y - x) < f y - f x` whenever `x, y ā D`,
`x < y`. -/
theorem Convex.mul_sub_lt_image_sub_of_lt_deriv {D : Set ā} (hD : Convex ā D) {f : ā ā ā}
(hf : ContinuousOn f D) (hf' : DifferentiableOn ā f (interior D)) {C}
(hf'_gt : ā x ā interior D, C < deriv f x) :
āįµ (x ā D) (y ā D), x < y ā C * (y - x) < f y - f x := by
intro x hx y hy hxy
have hxyD : Icc x y ā D := hD.ordConnected.out hx hy
have hxyD' : Ioo x y ā interior D :=
subset_sUnion_of_mem āØisOpen_Ioo, Ioo_subset_Icc_self.trans hxyDā©
obtain āØa, a_mem, haā© : ā a ā Ioo x y, deriv f a = (f y - f x) / (y - x) :=
exists_deriv_eq_slope f hxy (hf.mono hxyD) (hf'.mono hxyD')
have : C < (f y - f x) / (y - x) := ha āø hf'_gt _ (hxyD' a_mem)
exact (lt_div_iffā (sub_pos.2 hxy)).1 this
/-- Let `f : ā ā ā` be a differentiable function. If `C < f'`, then `f` grows faster than
`C * x`, i.e., `C * (y - x) < f y - f x` whenever `x < y`. -/
theorem mul_sub_lt_image_sub_of_lt_deriv {f : ā ā ā} (hf : Differentiable ā f) {C}
(hf'_gt : ā x, C < deriv f x) ā¦x y⦠(hxy : x < y) : C * (y - x) < f y - f x :=
convex_univ.mul_sub_lt_image_sub_of_lt_deriv hf.continuous.continuousOn hf.differentiableOn
(fun x _ => hf'_gt x) x trivial y trivial hxy
/-- Let `f` be a function continuous on a convex (or, equivalently, connected) subset `D`
of the real line. If `f` is differentiable on the interior of `D` and `C ⤠f'`, then
`f` grows at least as fast as `C * x` on `D`, i.e., `C * (y - x) ⤠f y - f x` whenever `x, y ā D`,
`x ⤠y`. -/
theorem Convex.mul_sub_le_image_sub_of_le_deriv {D : Set ā} (hD : Convex ā D) {f : ā ā ā}
(hf : ContinuousOn f D) (hf' : DifferentiableOn ā f (interior D)) {C}
(hf'_ge : ā x ā interior D, C ⤠deriv f x) :
āįµ (x ā D) (y ā D), x ⤠y ā C * (y - x) ⤠f y - f x := by
intro x hx y hy hxy
rcases eq_or_lt_of_le hxy with hxy' | hxy'
Ā· rw [hxy', sub_self, sub_self, mul_zero]
have hxyD : Icc x y ā D := hD.ordConnected.out hx hy
have hxyD' : Ioo x y ā interior D :=
subset_sUnion_of_mem āØisOpen_Ioo, Ioo_subset_Icc_self.trans hxyDā©
obtain āØa, a_mem, haā© : ā a ā Ioo x y, deriv f a = (f y - f x) / (y - x) :=
exists_deriv_eq_slope f hxy' (hf.mono hxyD) (hf'.mono hxyD')
have : C ⤠(f y - f x) / (y - x) := ha ⸠hf'_ge _ (hxyD' a_mem)
exact (le_div_iffā (sub_pos.2 hxy')).1 this
/-- Let `f : ā ā ā` be a differentiable function. If `C ⤠f'`, then `f` grows at least as fast
as `C * x`, i.e., `C * (y - x) ⤠f y - f x` whenever `x ⤠y`. -/
theorem mul_sub_le_image_sub_of_le_deriv {f : ā ā ā} (hf : Differentiable ā f) {C}
(hf'_ge : ā x, C ⤠deriv f x) ā¦x y⦠(hxy : x ⤠y) : C * (y - x) ⤠f y - f x :=
convex_univ.mul_sub_le_image_sub_of_le_deriv hf.continuous.continuousOn hf.differentiableOn
(fun x _ => hf'_ge x) x trivial y trivial hxy
/-- Let `f` be a function continuous on a convex (or, equivalently, connected) subset `D`
of the real line. If `f` is differentiable on the interior of `D` and `f' < C`, then
`f` grows slower than `C * x` on `D`, i.e., `f y - f x < C * (y - x)` whenever `x, y ā D`,
`x < y`. -/
theorem Convex.image_sub_lt_mul_sub_of_deriv_lt {D : Set ā} (hD : Convex ā D) {f : ā ā ā}
(hf : ContinuousOn f D) (hf' : DifferentiableOn ā f (interior D)) {C}
(lt_hf' : ā x ā interior D, deriv f x < C) (x : ā) (hx : x ā D) (y : ā) (hy : y ā D)
(hxy : x < y) : f y - f x < C * (y - x) :=
have hf'_gt : ā x ā interior D, -C < deriv (fun y => -f y) x := fun x hx => by
rw [deriv.fun_neg, neg_lt_neg_iff]
exact lt_hf' x hx
by linarith [hD.mul_sub_lt_image_sub_of_lt_deriv hf.neg hf'.neg hf'_gt x hx y hy hxy]
/-- Let `f : ā ā ā` be a differentiable function. If `f' < C`, then `f` grows slower than
`C * x` on `D`, i.e., `f y - f x < C * (y - x)` whenever `x < y`. -/
theorem image_sub_lt_mul_sub_of_deriv_lt {f : ā ā ā} (hf : Differentiable ā f) {C}
(lt_hf' : ā x, deriv f x < C) ā¦x y⦠(hxy : x < y) : f y - f x < C * (y - x) :=
convex_univ.image_sub_lt_mul_sub_of_deriv_lt hf.continuous.continuousOn hf.differentiableOn
(fun x _ => lt_hf' x) x trivial y trivial hxy
/-- Let `f` be a function continuous on a convex (or, equivalently, connected) subset `D`
of the real line. If `f` is differentiable on the interior of `D` and `f' ⤠C`, then
`f` grows at most as fast as `C * x` on `D`, i.e., `f y - f x ⤠C * (y - x)` whenever `x, y ā D`,
`x ⤠y`. -/
theorem Convex.image_sub_le_mul_sub_of_deriv_le {D : Set ā} (hD : Convex ā D) {f : ā ā ā}
(hf : ContinuousOn f D) (hf' : DifferentiableOn ā f (interior D)) {C}
(le_hf' : ā x ā interior D, deriv f x ⤠C) (x : ā) (hx : x ā D) (y : ā) (hy : y ā D)
(hxy : x ⤠y) : f y - f x ⤠C * (y - x) :=
have hf'_ge : ā x ā interior D, -C ⤠deriv (fun y => -f y) x := fun x hx => by
rw [deriv.fun_neg, neg_le_neg_iff]
exact le_hf' x hx
by linarith [hD.mul_sub_le_image_sub_of_le_deriv hf.neg hf'.neg hf'_ge x hx y hy hxy]
/-- Let `f : ā ā ā` be a differentiable function. If `f' ⤠C`, then `f` grows at most as fast
as `C * x`, i.e., `f y - f x ⤠C * (y - x)` whenever `x ⤠y`. -/
theorem image_sub_le_mul_sub_of_deriv_le {f : ā ā ā} (hf : Differentiable ā f) {C}
(le_hf' : ā x, deriv f x ⤠C) ā¦x y⦠(hxy : x ⤠y) : f y - f x ⤠C * (y - x) :=
convex_univ.image_sub_le_mul_sub_of_deriv_le hf.continuous.continuousOn hf.differentiableOn
(fun x _ => le_hf' x) x trivial y trivial hxy
/-- Let `f` be a function continuous on a convex (or, equivalently, connected) subset `D`
of the real line. If `f` is differentiable on the interior of `D` and `f'` is positive, then
`f` is a strictly monotone function on `D`.
Note that we don't require differentiability explicitly as it already implied by the derivative
being strictly positive. -/
theorem strictMonoOn_of_deriv_pos {D : Set ā} (hD : Convex ā D) {f : ā ā ā}
(hf : ContinuousOn f D) (hf' : ā x ā interior D, 0 < deriv f x) : StrictMonoOn f D := by
intro x hx y hy
have : DifferentiableOn ā f (interior D) := fun z hz =>
(differentiableAt_of_deriv_ne_zero (hf' z hz).ne').differentiableWithinAt
simpa only [zero_mul, sub_pos] using
hD.mul_sub_lt_image_sub_of_lt_deriv hf this hf' x hx y hy
/-- Let `f : ā ā ā` be a differentiable function. If `f'` is positive, then
`f` is a strictly monotone function.
Note that we don't require differentiability explicitly as it already implied by the derivative
being strictly positive. -/
theorem strictMono_of_deriv_pos {f : ā ā ā} (hf' : ā x, 0 < deriv f x) : StrictMono f :=
strictMonoOn_univ.1 <| strictMonoOn_of_deriv_pos convex_univ (fun z _ =>
(differentiableAt_of_deriv_ne_zero (hf' z).ne').differentiableWithinAt.continuousWithinAt)
fun x _ => hf' x
/-- Let `f` be a function continuous on a convex (or, equivalently, connected) subset `D`
of the real line. If `f` is differentiable on the interior of `D` and `f'` is strictly positive,
then `f` is a strictly monotone function on `D`. -/
lemma strictMonoOn_of_hasDerivWithinAt_pos {D : Set ā} (hD : Convex ā D) {f f' : ā ā ā}
(hf : ContinuousOn f D) (hf' : ā x ā interior D, HasDerivWithinAt f (f' x) (interior D) x)
(hf'ā : ā x ā interior D, 0 < f' x) : StrictMonoOn f D :=
strictMonoOn_of_deriv_pos hD hf fun x hx ⦠by
rw [deriv_eqOn isOpen_interior hf' hx]; exact hf'ā _ hx
/-- Let `f : ā ā ā` be a differentiable function. If `f'` is strictly positive, then
`f` is a strictly monotone function. -/
lemma strictMono_of_hasDerivAt_pos {f f' : ā ā ā} (hf : ā x, HasDerivAt f (f' x) x)
(hf' : ā x, 0 < f' x) : StrictMono f :=
strictMono_of_deriv_pos fun x ⦠by rw [(hf _).deriv]; exact hf' _
/-- Let `f` be a function continuous on a convex (or, equivalently, connected) subset `D`
of the real line. If `f` is differentiable on the interior of `D` and `f'` is nonnegative, then
`f` is a monotone function on `D`. -/
theorem monotoneOn_of_deriv_nonneg {D : Set ā} (hD : Convex ā D) {f : ā ā ā}
(hf : ContinuousOn f D) (hf' : DifferentiableOn ā f (interior D))
(hf'_nonneg : ā x ā interior D, 0 ⤠deriv f x) : MonotoneOn f D := fun x hx y hy hxy => by
simpa only [zero_mul, sub_nonneg] using
hD.mul_sub_le_image_sub_of_le_deriv hf hf' hf'_nonneg x hx y hy hxy
/-- Let `f : ā ā ā` be a differentiable function. If `f'` is nonnegative, then
`f` is a monotone function. -/
theorem monotone_of_deriv_nonneg {f : ā ā ā} (hf : Differentiable ā f) (hf' : ā x, 0 ⤠deriv f x) :
Monotone f :=
monotoneOn_univ.1 <|
monotoneOn_of_deriv_nonneg convex_univ hf.continuous.continuousOn hf.differentiableOn fun x _ =>
hf' x
/-- Let `f` be a function continuous on a convex (or, equivalently, connected) subset `D`
of the real line. If `f` is differentiable on the interior of `D` and `f'` is nonnegative, then
`f` is a monotone function on `D`. -/
lemma monotoneOn_of_hasDerivWithinAt_nonneg {D : Set ā} (hD : Convex ā D) {f f' : ā ā ā}
(hf : ContinuousOn f D) (hf' : ā x ā interior D, HasDerivWithinAt f (f' x) (interior D) x)
(hf'ā : ā x ā interior D, 0 ⤠f' x) : MonotoneOn f D :=
monotoneOn_of_deriv_nonneg hD hf (fun _ hx ⦠(hf' _ hx).differentiableWithinAt) fun x hx ⦠by
rw [deriv_eqOn isOpen_interior hf' hx]; exact hf'ā _ hx
/-- Let `f : ā ā ā` be a differentiable function. If `f'` is nonnegative, then
`f` is a monotone function. -/
lemma monotone_of_hasDerivAt_nonneg {f f' : ā ā ā} (hf : ā x, HasDerivAt f (f' x) x)
(hf' : 0 ⤠f') : Monotone f :=
monotone_of_deriv_nonneg (fun _ ⦠(hf _).differentiableAt) fun x ⦠by
rw [(hf _).deriv]; exact hf' _
/-- Let `f` be a function continuous on a convex (or, equivalently, connected) subset `D`
of the real line. If `f` is differentiable on the interior of `D` and `f'` is negative, then
`f` is a strictly antitone function on `D`. -/
theorem strictAntiOn_of_deriv_neg {D : Set ā} (hD : Convex ā D) {f : ā ā ā}
(hf : ContinuousOn f D) (hf' : ā x ā interior D, deriv f x < 0) : StrictAntiOn f D :=
fun x hx y => by
simpa only [zero_mul, sub_lt_zero] using
hD.image_sub_lt_mul_sub_of_deriv_lt hf
(fun z hz => (differentiableAt_of_deriv_ne_zero (hf' z hz).ne).differentiableWithinAt) hf' x
hx y
/-- Let `f : ā ā ā` be a differentiable function. If `f'` is negative, then
`f` is a strictly antitone function.
Note that we don't require differentiability explicitly as it already implied by the derivative
being strictly negative. -/
theorem strictAnti_of_deriv_neg {f : ā ā ā} (hf' : ā x, deriv f x < 0) : StrictAnti f :=
strictAntiOn_univ.1 <| strictAntiOn_of_deriv_neg convex_univ
(fun z _ =>
(differentiableAt_of_deriv_ne_zero (hf' z).ne).differentiableWithinAt.continuousWithinAt)
fun x _ => hf' x
/-- Let `f` be a function continuous on a convex (or, equivalently, connected) subset `D`
of the real line. If `f` is differentiable on the interior of `D` and `f'` is strictly positive,
then `f` is a strictly monotone function on `D`. -/
lemma strictAntiOn_of_hasDerivWithinAt_neg {D : Set ā} (hD : Convex ā D) {f f' : ā ā ā}
(hf : ContinuousOn f D) (hf' : ā x ā interior D, HasDerivWithinAt f (f' x) (interior D) x)
(hf'ā : ā x ā interior D, f' x < 0) : StrictAntiOn f D :=
strictAntiOn_of_deriv_neg hD hf fun x hx ⦠by
rw [deriv_eqOn isOpen_interior hf' hx]; exact hf'ā _ hx
/-- Let `f : ā ā ā` be a differentiable function. If `f'` is strictly positive, then
`f` is a strictly monotone function. -/
lemma strictAnti_of_hasDerivAt_neg {f f' : ā ā ā} (hf : ā x, HasDerivAt f (f' x) x)
(hf' : ā x, f' x < 0) : StrictAnti f :=
strictAnti_of_deriv_neg fun x ⦠by rw [(hf _).deriv]; exact hf' _
/-- Let `f` be a function continuous on a convex (or, equivalently, connected) subset `D`
of the real line. If `f` is differentiable on the interior of `D` and `f'` is nonpositive, then
`f` is an antitone function on `D`. -/
theorem antitoneOn_of_deriv_nonpos {D : Set ā} (hD : Convex ā D) {f : ā ā ā}
(hf : ContinuousOn f D) (hf' : DifferentiableOn ā f (interior D))
(hf'_nonpos : ā x ā interior D, deriv f x ⤠0) : AntitoneOn f D := fun x hx y hy hxy => by
simpa only [zero_mul, sub_nonpos] using
hD.image_sub_le_mul_sub_of_deriv_le hf hf' hf'_nonpos x hx y hy hxy
/-- Let `f : ā ā ā` be a differentiable function. If `f'` is nonpositive, then
`f` is an antitone function. -/
theorem antitone_of_deriv_nonpos {f : ā ā ā} (hf : Differentiable ā f) (hf' : ā x, deriv f x ⤠0) :
Antitone f :=
antitoneOn_univ.1 <|
antitoneOn_of_deriv_nonpos convex_univ hf.continuous.continuousOn hf.differentiableOn fun x _ =>
hf' x
/-- Let `f` be a function continuous on a convex (or, equivalently, connected) subset `D`
of the real line. If `f` is differentiable on the interior of `D` and `f'` is nonpositive, then
`f` is an antitone function on `D`. -/
lemma antitoneOn_of_hasDerivWithinAt_nonpos {D : Set ā} (hD : Convex ā D) {f f' : ā ā ā}
(hf : ContinuousOn f D) (hf' : ā x ā interior D, HasDerivWithinAt f (f' x) (interior D) x)
(hf'ā : ā x ā interior D, f' x ⤠0) : AntitoneOn f D :=
antitoneOn_of_deriv_nonpos hD hf (fun _ hx ⦠(hf' _ hx).differentiableWithinAt) fun x hx ⦠by
rw [deriv_eqOn isOpen_interior hf' hx]; exact hf'ā _ hx
/-- Let `f : ā ā ā` be a differentiable function. If `f'` is nonpositive, then `f` is an antitone
function. -/
lemma antitone_of_hasDerivAt_nonpos {f f' : ā ā ā} (hf : ā x, HasDerivAt f (f' x) x)
(hf' : f' ⤠0) : Antitone f :=
antitone_of_deriv_nonpos (fun _ ⦠(hf _).differentiableAt) fun x ⦠by
rw [(hf _).deriv]; exact hf' _
/-! ### Functions `f : E ā ā` -/
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ā E]
/-- Lagrange's **Mean Value Theorem**, applied to convex domains. -/
theorem domain_mvt {f : E ā ā} {s : Set E} {x y : E} {f' : E ā StrongDual ā E}
(hf : ā x ā s, HasFDerivWithinAt f (f' x) s x) (hs : Convex ā s) (xs : x ā s) (ys : y ā s) :
ā z ā segment ā x y, f y - f x = f' z (y - x) := by
-- Use `g = AffineMap.lineMap x y` to parametrize the segment
set g : ā ā E := fun t => AffineMap.lineMap x y t
set I := Icc (0 : ā) 1
have hsub : Ioo (0 : ā) 1 ā I := Ioo_subset_Icc_self
have hmaps : MapsTo g I s := hs.mapsTo_lineMap xs ys
-- The one-variable function `f ā g` has derivative `f' (g t) (y - x)` at each `t ā I`
have hfg : ā t ā I, HasDerivWithinAt (f ā g) (f' (g t) (y - x)) I t := fun t ht =>
(hf _ (hmaps ht)).comp_hasDerivWithinAt t AffineMap.hasDerivWithinAt_lineMap hmaps
-- apply 1-variable mean value theorem to pullback
have hMVT : ā t ā Ioo (0 : ā) 1, f' (g t) (y - x) = (f (g 1) - f (g 0)) / (1 - 0) := by
refine exists_hasDerivAt_eq_slope (f ā g) _ (by simp) ?_ ?_
Ā· exact fun t Ht => (hfg t Ht).continuousWithinAt
Ā· exact fun t Ht => (hfg t <| hsub Ht).hasDerivAt (Icc_mem_nhds Ht.1 Ht.2)
-- reinterpret on domain
rcases hMVT with āØt, Ht, hMVT'ā©
rw [segment_eq_image_lineMap, exists_mem_image]
refine āØt, hsub Ht, ?_ā©
simpa [g] using hMVT'.symm |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/Deriv/Abs.lean | import Mathlib.Analysis.Calculus.Deriv.Add
import Mathlib.Analysis.InnerProductSpace.Calculus
/-!
# Derivative of the absolute value
This file compiles basic derivability properties of the absolute value, and is largely inspired from
`Mathlib/Analysis/InnerProductSpace/Calculus.lean`, which is the analogous file for norms derived
from an inner product space.
## Tags
absolute value, derivative
-/
open Filter Real Set
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ā E]
variable {n : āā} {f : E ā ā} {f' : StrongDual ā E} {s : Set E} {x : E}
theorem contDiffAt_abs {x : ā} (hx : x ā 0) : ContDiffAt ā n (|Ā·|) x := contDiffAt_norm ā hx
theorem ContDiffAt.abs (hf : ContDiffAt ā n f x) (hā : f x ā 0) :
ContDiffAt ā n (fun x ⦠|f x|) x := hf.norm ā hā
theorem contDiffWithinAt_abs {x : ā} (hx : x ā 0) (s : Set ā) :
ContDiffWithinAt ā n (|Ā·|) s x := (contDiffAt_abs hx).contDiffWithinAt
theorem ContDiffWithinAt.abs (hf : ContDiffWithinAt ā n f s x) (hā : f x ā 0) :
ContDiffWithinAt ā n (fun y ⦠|f y|) s x :=
(contDiffAt_abs hā).comp_contDiffWithinAt x hf
theorem contDiffOn_abs {s : Set ā} (hs : ā x ā s, x ā 0) :
ContDiffOn ā n (|Ā·|) s := fun x hx ⦠contDiffWithinAt_abs (hs x hx) s
theorem ContDiffOn.abs (hf : ContDiffOn ā n f s) (hā : ā x ā s, f x ā 0) :
ContDiffOn ā n (fun y ⦠|f y|) s := fun x hx ⦠(hf x hx).abs (hā x hx)
theorem ContDiff.abs (hf : ContDiff ā n f) (hā : ā x, f x ā 0) : ContDiff ā n fun y ⦠|f y| :=
contDiff_iff_contDiffAt.2 fun x ⦠hf.contDiffAt.abs (hā x)
theorem hasStrictDerivAt_abs_neg {x : ā} (hx : x < 0) :
HasStrictDerivAt (|Ā·|) (-1) x :=
(hasStrictDerivAt_neg x).congr_of_eventuallyEq <|
EqOn.eventuallyEq_of_mem (fun _ hy ⦠(abs_of_neg (mem_Iio.1 hy)).symm) (Iio_mem_nhds hx)
theorem hasDerivAt_abs_neg {x : ā} (hx : x < 0) :
HasDerivAt (|Ā·|) (-1) x := (hasStrictDerivAt_abs_neg hx).hasDerivAt
theorem hasStrictDerivAt_abs_pos {x : ā} (hx : 0 < x) :
HasStrictDerivAt (|Ā·|) 1 x :=
(hasStrictDerivAt_id x).congr_of_eventuallyEq <|
EqOn.eventuallyEq_of_mem (fun _ hy ⦠(abs_of_pos (mem_Iio.1 hy)).symm) (Ioi_mem_nhds hx)
theorem hasDerivAt_abs_pos {x : ā} (hx : 0 < x) :
HasDerivAt (|Ā·|) 1 x := (hasStrictDerivAt_abs_pos hx).hasDerivAt
theorem hasStrictDerivAt_abs {x : ā} (hx : x ā 0) :
HasStrictDerivAt (|Ā·|) (SignType.sign x : ā) x := by
obtain hx | hx := hx.lt_or_gt
Ā· simpa [hx] using hasStrictDerivAt_abs_neg hx
Ā· simpa [hx] using hasStrictDerivAt_abs_pos hx
theorem hasDerivAt_abs {x : ā} (hx : x ā 0) :
HasDerivAt (|Ā·|) (SignType.sign x : ā) x := (hasStrictDerivAt_abs hx).hasDerivAt
theorem HasStrictFDerivAt.abs_of_neg (hf : HasStrictFDerivAt f f' x)
(hā : f x < 0) : HasStrictFDerivAt (fun x ⦠|f x|) (-f') x := by
convert (hasStrictDerivAt_abs_neg hā).hasStrictFDerivAt.comp x hf using 1
ext y
simp
theorem HasFDerivAt.abs_of_neg (hf : HasFDerivAt f f' x)
(hā : f x < 0) : HasFDerivAt (fun x ⦠|f x|) (-f') x := by
convert (hasDerivAt_abs_neg hā).hasFDerivAt.comp x hf using 1
ext y
simp
theorem HasStrictFDerivAt.abs_of_pos (hf : HasStrictFDerivAt f f' x)
(hā : 0 < f x) : HasStrictFDerivAt (fun x ⦠|f x|) f' x := by
convert (hasStrictDerivAt_abs_pos hā).hasStrictFDerivAt.comp x hf using 1
ext y
simp
theorem HasFDerivAt.abs_of_pos (hf : HasFDerivAt f f' x)
(hā : 0 < f x) : HasFDerivAt (fun x ⦠|f x|) f' x := by
convert (hasDerivAt_abs_pos hā).hasFDerivAt.comp x hf using 1
ext y
simp
theorem HasStrictFDerivAt.abs (hf : HasStrictFDerivAt f f' x)
(hā : f x ā 0) : HasStrictFDerivAt (fun x ⦠|f x|) ((SignType.sign (f x) : ā) ⢠f') x := by
convert (hasStrictDerivAt_abs hā).hasStrictFDerivAt.comp x hf using 1
ext y
simp [mul_comm]
theorem HasFDerivAt.abs (hf : HasFDerivAt f f' x)
(hā : f x ā 0) : HasFDerivAt (fun x ⦠|f x|) ((SignType.sign (f x) : ā) ⢠f') x := by
convert (hasDerivAt_abs hā).hasFDerivAt.comp x hf using 1
ext y
simp [mul_comm]
theorem hasDerivWithinAt_abs_neg (s : Set ā) {x : ā} (hx : x < 0) :
HasDerivWithinAt (|Ā·|) (-1) s x := (hasDerivAt_abs_neg hx).hasDerivWithinAt
theorem hasDerivWithinAt_abs_pos (s : Set ā) {x : ā} (hx : 0 < x) :
HasDerivWithinAt (|Ā·|) 1 s x := (hasDerivAt_abs_pos hx).hasDerivWithinAt
theorem hasDerivWithinAt_abs (s : Set ā) {x : ā} (hx : x ā 0) :
HasDerivWithinAt (|Ā·|) (SignType.sign x : ā) s x := (hasDerivAt_abs hx).hasDerivWithinAt
theorem HasFDerivWithinAt.abs_of_neg (hf : HasFDerivWithinAt f f' s x)
(hā : f x < 0) : HasFDerivWithinAt (fun x ⦠|f x|) (-f') s x := by
convert (hasDerivAt_abs_neg hā).comp_hasFDerivWithinAt x hf using 1
simp
theorem HasFDerivWithinAt.abs_of_pos (hf : HasFDerivWithinAt f f' s x)
(hā : 0 < f x) : HasFDerivWithinAt (fun x ⦠|f x|) f' s x := by
convert (hasDerivAt_abs_pos hā).comp_hasFDerivWithinAt x hf using 1
simp
theorem HasFDerivWithinAt.abs (hf : HasFDerivWithinAt f f' s x)
(hā : f x ā 0) : HasFDerivWithinAt (fun x ⦠|f x|) ((SignType.sign (f x) : ā) ⢠f') s x :=
(hasDerivAt_abs hā).comp_hasFDerivWithinAt x hf
theorem differentiableAt_abs_neg {x : ā} (hx : x < 0) :
DifferentiableAt ā (|Ā·|) x := (hasDerivAt_abs_neg hx).differentiableAt
theorem differentiableAt_abs_pos {x : ā} (hx : 0 < x) :
DifferentiableAt ā (|Ā·|) x := (hasDerivAt_abs_pos hx).differentiableAt
theorem differentiableAt_abs {x : ā} (hx : x ā 0) :
DifferentiableAt ā (|Ā·|) x := (hasDerivAt_abs hx).differentiableAt
theorem DifferentiableAt.abs_of_neg (hf : DifferentiableAt ā f x) (hā : f x < 0) :
DifferentiableAt ā (fun x ⦠|f x|) x := (differentiableAt_abs_neg hā).comp x hf
theorem DifferentiableAt.abs_of_pos (hf : DifferentiableAt ā f x) (hā : 0 < f x) :
DifferentiableAt ā (fun x ⦠|f x|) x := (differentiableAt_abs_pos hā).comp x hf
theorem DifferentiableAt.abs (hf : DifferentiableAt ā f x) (hā : f x ā 0) :
DifferentiableAt ā (fun x ⦠|f x|) x := (differentiableAt_abs hā).comp x hf
theorem differentiableWithinAt_abs_neg (s : Set ā) {x : ā} (hx : x < 0) :
DifferentiableWithinAt ā (|Ā·|) s x := (differentiableAt_abs_neg hx).differentiableWithinAt
theorem differentiableWithinAt_abs_pos (s : Set ā) {x : ā} (hx : 0 < x) :
DifferentiableWithinAt ā (|Ā·|) s x := (differentiableAt_abs_pos hx).differentiableWithinAt
theorem differentiableWithinAt_abs (s : Set ā) {x : ā} (hx : x ā 0) :
DifferentiableWithinAt ā (|Ā·|) s x := (differentiableAt_abs hx).differentiableWithinAt
theorem DifferentiableWithinAt.abs_of_neg (hf : DifferentiableWithinAt ā f s x) (hā : f x < 0) :
DifferentiableWithinAt ā (fun x ⦠|f x|) s x :=
(differentiableAt_abs_neg hā).comp_differentiableWithinAt x hf
theorem DifferentiableWithinAt.abs_of_pos (hf : DifferentiableWithinAt ā f s x) (hā : 0 < f x) :
DifferentiableWithinAt ā (fun x ⦠|f x|) s x :=
(differentiableAt_abs_pos hā).comp_differentiableWithinAt x hf
theorem DifferentiableWithinAt.abs (hf : DifferentiableWithinAt ā f s x) (hā : f x ā 0) :
DifferentiableWithinAt ā (fun x ⦠|f x|) s x :=
(differentiableAt_abs hā).comp_differentiableWithinAt x hf
theorem differentiableOn_abs {s : Set ā} (hs : ā x ā s, x ā 0) : DifferentiableOn ā (|Ā·|) s :=
fun x hx ⦠differentiableWithinAt_abs s (hs x hx)
theorem DifferentiableOn.abs (hf : DifferentiableOn ā f s) (hā : ā x ā s, f x ā 0) :
DifferentiableOn ā (fun x ⦠|f x|) s :=
fun x hx ⦠(hf x hx).abs (hā x hx)
theorem Differentiable.abs (hf : Differentiable ā f) (hā : ā x, f x ā 0) :
Differentiable ā (fun x ⦠|f x|) := fun x ⦠(hf x).abs (hā x)
theorem not_differentiableAt_abs_zero : ¬ DifferentiableAt ā (abs : ā ā ā) 0 := by
intro h
have hā : deriv abs (0 : ā) = 1 :=
(uniqueDiffOn_Ici _ _ Set.left_mem_Ici).eq_deriv _ h.hasDerivAt.hasDerivWithinAt <|
(hasDerivWithinAt_id _ _).congr_of_mem (fun _ h ⦠abs_of_nonneg h) Set.left_mem_Ici
have hā : deriv abs (0 : ā) = -1 :=
(uniqueDiffOn_Iic _ _ Set.right_mem_Iic).eq_deriv _ h.hasDerivAt.hasDerivWithinAt <|
(hasDerivWithinAt_neg _ _).congr_of_mem (fun _ h ⦠abs_of_nonpos h) Set.right_mem_Iic
linarith
theorem deriv_abs_neg {x : ā} (hx : x < 0) : deriv (|Ā·|) x = -1 := (hasDerivAt_abs_neg hx).deriv
theorem deriv_abs_pos {x : ā} (hx : 0 < x) : deriv (|Ā·|) x = 1 := (hasDerivAt_abs_pos hx).deriv
theorem deriv_abs_zero : deriv (|Ā·|) (0 : ā) = 0 :=
deriv_zero_of_not_differentiableAt not_differentiableAt_abs_zero
theorem deriv_abs (x : ā) : deriv (|Ā·|) x = SignType.sign x := by
obtain rfl | hx := eq_or_ne x 0
Ā· simpa using deriv_abs_zero
Ā· simpa [hx] using (hasDerivAt_abs hx).deriv |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/Deriv/Inv.lean | import Mathlib.Analysis.Calculus.Deriv.Mul
import Mathlib.Analysis.Calculus.Deriv.Comp
/-!
# Derivatives of `x ⦠xā»Ā¹` and `f x / g x`
In this file we prove `(xā»Ā¹)' = -1 / x ^ 2`, `((f x)ā»Ā¹)' = -f' x / (f x) ^ 2`, and
`(f x / g x)' = (f' x * g x - f x * g' x) / (g x) ^ 2` for different notions of derivative.
For a more detailed overview of one-dimensional derivatives in mathlib, see the module docstring of
`Analysis/Calculus/Deriv/Basic`.
## Keywords
derivative
-/
universe u
open scoped Topology
open Filter Asymptotics Set
open ContinuousLinearMap (smulRight)
variable {š : Type u} [NontriviallyNormedField š] {x : š} {s : Set š}
section Inverse
/-! ### Derivative of `x ⦠xā»Ā¹` -/
theorem hasStrictDerivAt_inv (hx : x ā 0) : HasStrictDerivAt Inv.inv (-(x ^ 2)ā»Ā¹) x := by
suffices
(fun p : š Ć š => (p.1 - p.2) * ((x * x)ā»Ā¹ - (p.1 * p.2)ā»Ā¹)) =o[š (x, x)] fun p =>
(p.1 - p.2) * 1 by
refine .of_isLittleO <| this.congr' ?_ (Eventually.of_forall fun _ => mul_one _)
refine Eventually.mono ((isOpen_ne.prod isOpen_ne).mem_nhds āØhx, hxā©) ?_
rintro āØy, zā© āØhy, hzā©
simp only [mem_setOf_eq] at hy hz
simp [field]
ring
refine (isBigO_refl (fun p : š Ć š => p.1 - p.2) _).mul_isLittleO ((isLittleO_one_iff š).2 ?_)
rw [ā sub_self (x * x)ā»Ā¹]
exact tendsto_const_nhds.sub ((continuous_mul.tendsto (x, x)).invā <| mul_ne_zero hx hx)
theorem hasDerivAt_inv (x_ne_zero : x ā 0) : HasDerivAt (fun y => yā»Ā¹) (-(x ^ 2)ā»Ā¹) x :=
(hasStrictDerivAt_inv x_ne_zero).hasDerivAt
theorem hasDerivWithinAt_inv (x_ne_zero : x ā 0) (s : Set š) :
HasDerivWithinAt (fun x => xā»Ā¹) (-(x ^ 2)ā»Ā¹) s x :=
(hasDerivAt_inv x_ne_zero).hasDerivWithinAt
theorem differentiableAt_inv_iff : DifferentiableAt š (fun x => xā»Ā¹) x ā x ā 0 :=
āØfun H => NormedField.continuousAt_inv.1 H.continuousAt, fun H =>
(hasDerivAt_inv H).differentiableAtā©
theorem deriv_inv : deriv (fun x => xā»Ā¹) x = -(x ^ 2)ā»Ā¹ := by
rcases eq_or_ne x 0 with (rfl | hne)
Ā· simp [deriv_zero_of_not_differentiableAt (mt differentiableAt_inv_iff.1 (not_not.2 rfl))]
Ā· exact (hasDerivAt_inv hne).deriv
@[simp]
theorem deriv_inv' : (deriv fun x : š => xā»Ā¹) = fun x => -(x ^ 2)ā»Ā¹ :=
funext fun _ => deriv_inv
theorem derivWithin_inv (x_ne_zero : x ā 0) (hxs : UniqueDiffWithinAt š s x) :
derivWithin (fun x => xā»Ā¹) s x = -(x ^ 2)ā»Ā¹ := by
rw [DifferentiableAt.derivWithin (differentiableAt_inv x_ne_zero) hxs]
exact deriv_inv
theorem hasFDerivAt_inv (x_ne_zero : x ā 0) :
HasFDerivAt (fun x => xā»Ā¹) (smulRight (1 : š āL[š] š) (-(x ^ 2)ā»Ā¹) : š āL[š] š) x :=
hasDerivAt_inv x_ne_zero
theorem hasStrictFDerivAt_inv (x_ne_zero : x ā 0) :
HasStrictFDerivAt (fun x => xā»Ā¹) (smulRight (1 : š āL[š] š) (-(x ^ 2)ā»Ā¹) : š āL[š] š) x :=
hasStrictDerivAt_inv x_ne_zero
theorem hasFDerivWithinAt_inv (x_ne_zero : x ā 0) :
HasFDerivWithinAt (fun x => xā»Ā¹) (smulRight (1 : š āL[š] š) (-(x ^ 2)ā»Ā¹) : š āL[š] š) s x :=
(hasFDerivAt_inv x_ne_zero).hasFDerivWithinAt
theorem fderiv_inv : fderiv š (fun x => xā»Ā¹) x = smulRight (1 : š āL[š] š) (-(x ^ 2)ā»Ā¹) := by
rw [ā deriv_fderiv, deriv_inv]
theorem fderivWithin_inv (x_ne_zero : x ā 0) (hxs : UniqueDiffWithinAt š s x) :
fderivWithin š (fun x => xā»Ā¹) s x = smulRight (1 : š āL[š] š) (-(x ^ 2)ā»Ā¹) := by
rw [DifferentiableAt.fderivWithin (differentiableAt_inv x_ne_zero) hxs]
exact fderiv_inv
variable {c : š ā š} {c' : š}
theorem HasDerivWithinAt.fun_inv (hc : HasDerivWithinAt c c' s x) (hx : c x ā 0) :
HasDerivWithinAt (fun y => (c y)ā»Ā¹) (-c' / c x ^ 2) s x := by
convert (hasDerivAt_inv hx).comp_hasDerivWithinAt x hc using 1
ring
theorem HasDerivWithinAt.inv (hc : HasDerivWithinAt c c' s x) (hx : c x ā 0) :
HasDerivWithinAt (cā»Ā¹) (-c' / c x ^ 2) s x :=
hc.fun_inv hx
theorem HasDerivAt.fun_inv (hc : HasDerivAt c c' x) (hx : c x ā 0) :
HasDerivAt (fun y => (c y)ā»Ā¹) (-c' / c x ^ 2) x := by
rw [ā hasDerivWithinAt_univ] at *
exact hc.inv hx
theorem HasDerivAt.inv (hc : HasDerivAt c c' x) (hx : c x ā 0) :
HasDerivAt (cā»Ā¹) (-c' / c x ^ 2) x :=
hc.fun_inv hx
theorem derivWithin_fun_inv' (hc : DifferentiableWithinAt š c s x) (hx : c x ā 0) :
derivWithin (fun x => (c x)ā»Ā¹) s x = -derivWithin c s x / c x ^ 2 := by
by_cases hsx : UniqueDiffWithinAt š s x
Ā· exact (hc.hasDerivWithinAt.inv hx).derivWithin hsx
Ā· simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]
theorem derivWithin_inv' (hc : DifferentiableWithinAt š c s x) (hx : c x ā 0) :
derivWithin (cā»Ā¹) s x = -derivWithin c s x / c x ^ 2 :=
derivWithin_fun_inv' hc hx
@[simp]
theorem deriv_fun_inv'' (hc : DifferentiableAt š c x) (hx : c x ā 0) :
deriv (fun x => (c x)ā»Ā¹) x = -deriv c x / c x ^ 2 :=
(hc.hasDerivAt.inv hx).deriv
@[simp]
theorem deriv_inv'' (hc : DifferentiableAt š c x) (hx : c x ā 0) :
deriv (cā»Ā¹) x = -deriv c x / c x ^ 2 :=
(hc.hasDerivAt.inv hx).deriv
end Inverse
section Division
/-! ### Derivative of `x ⦠c x / d x` -/
variable {š' : Type*} [NontriviallyNormedField š'] [NormedAlgebra š š'] {c d : š ā š'} {c' d' : š'}
theorem HasDerivWithinAt.fun_div (hc : HasDerivWithinAt c c' s x) (hd : HasDerivWithinAt d d' s x)
(hx : d x ā 0) :
HasDerivWithinAt (fun y => c y / d y) ((c' * d x - c x * d') / d x ^ 2) s x := by
convert hc.fun_mul ((hasDerivAt_inv hx).comp_hasDerivWithinAt x hd) using 1
Ā· simp only [div_eq_mul_inv, (Ā· ā Ā·)]
Ā· simp [field]
ring
theorem HasDerivWithinAt.div (hc : HasDerivWithinAt c c' s x) (hd : HasDerivWithinAt d d' s x)
(hx : d x ā 0) :
HasDerivWithinAt (c / d) ((c' * d x - c x * d') / d x ^ 2) s x :=
hc.fun_div hd hx
theorem HasStrictDerivAt.fun_div (hc : HasStrictDerivAt c c' x) (hd : HasStrictDerivAt d d' x)
(hx : d x ā 0) : HasStrictDerivAt (fun y => c y / d y) ((c' * d x - c x * d') / d x ^ 2) x := by
convert hc.fun_mul ((hasStrictDerivAt_inv hx).comp x hd) using 1
Ā· simp only [div_eq_mul_inv, (Ā· ā Ā·)]
Ā· simp [field]
ring
theorem HasStrictDerivAt.div (hc : HasStrictDerivAt c c' x) (hd : HasStrictDerivAt d d' x)
(hx : d x ā 0) : HasStrictDerivAt (c / d) ((c' * d x - c x * d') / d x ^ 2) x :=
hc.fun_div hd hx
theorem HasDerivAt.fun_div (hc : HasDerivAt c c' x) (hd : HasDerivAt d d' x) (hx : d x ā 0) :
HasDerivAt (fun y => c y / d y) ((c' * d x - c x * d') / d x ^ 2) x := by
rw [ā hasDerivWithinAt_univ] at *
exact hc.div hd hx
theorem HasDerivAt.div (hc : HasDerivAt c c' x) (hd : HasDerivAt d d' x) (hx : d x ā 0) :
HasDerivAt (c / d) ((c' * d x - c x * d') / d x ^ 2) x :=
hc.fun_div hd hx
theorem DifferentiableWithinAt.fun_div (hc : DifferentiableWithinAt š c s x)
(hd : DifferentiableWithinAt š d s x) (hx : d x ā 0) :
DifferentiableWithinAt š (fun x => c x / d x) s x :=
(hc.hasDerivWithinAt.div hd.hasDerivWithinAt hx).differentiableWithinAt
theorem DifferentiableWithinAt.div (hc : DifferentiableWithinAt š c s x)
(hd : DifferentiableWithinAt š d s x) (hx : d x ā 0) :
DifferentiableWithinAt š (c / d) s x :=
hc.fun_div hd hx
@[simp, fun_prop]
theorem DifferentiableAt.fun_div (hc : DifferentiableAt š c x) (hd : DifferentiableAt š d x)
(hx : d x ā 0) : DifferentiableAt š (fun x => c x / d x) x :=
(hc.hasDerivAt.div hd.hasDerivAt hx).differentiableAt
@[simp, fun_prop]
theorem DifferentiableAt.div (hc : DifferentiableAt š c x) (hd : DifferentiableAt š d x)
(hx : d x ā 0) : DifferentiableAt š (c / d) x :=
hc.fun_div hd hx
@[fun_prop]
theorem DifferentiableOn.fun_div (hc : DifferentiableOn š c s) (hd : DifferentiableOn š d s)
(hx : ā x ā s, d x ā 0) : DifferentiableOn š (fun x => c x / d x) s := fun x h =>
(hc x h).div (hd x h) (hx x h)
@[fun_prop]
theorem DifferentiableOn.div (hc : DifferentiableOn š c s) (hd : DifferentiableOn š d s)
(hx : ā x ā s, d x ā 0) : DifferentiableOn š (c / d) s := fun x h =>
(hc x h).div (hd x h) (hx x h)
@[simp, fun_prop]
theorem Differentiable.fun_div (hc : Differentiable š c) (hd : Differentiable š d)
(hx : ā x, d x ā 0) :
Differentiable š (fun x => c x / d x) := fun x => (hc x).div (hd x) (hx x)
@[simp, fun_prop]
theorem Differentiable.div (hc : Differentiable š c) (hd : Differentiable š d) (hx : ā x, d x ā 0) :
Differentiable š (c / d) := fun x => (hc x).div (hd x) (hx x)
theorem derivWithin_fun_div
(hc : DifferentiableWithinAt š c s x) (hd : DifferentiableWithinAt š d s x) (hx : d x ā 0) :
derivWithin (fun x => c x / d x) s x =
(derivWithin c s x * d x - c x * derivWithin d s x) / d x ^ 2 := by
by_cases hsx : UniqueDiffWithinAt š s x
Ā· exact (hc.hasDerivWithinAt.div hd.hasDerivWithinAt hx).derivWithin hsx
Ā· simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]
theorem derivWithin_div (hc : DifferentiableWithinAt š c s x) (hd : DifferentiableWithinAt š d s x)
(hx : d x ā 0) :
derivWithin (c / d) s x = (derivWithin c s x * d x - c x * derivWithin d s x) / d x ^ 2 :=
derivWithin_fun_div hc hd hx
@[simp]
theorem deriv_fun_div (hc : DifferentiableAt š c x) (hd : DifferentiableAt š d x) (hx : d x ā 0) :
deriv (fun x => c x / d x) x = (deriv c x * d x - c x * deriv d x) / d x ^ 2 :=
(hc.hasDerivAt.div hd.hasDerivAt hx).deriv
@[simp]
theorem deriv_div (hc : DifferentiableAt š c x) (hd : DifferentiableAt š d x) (hx : d x ā 0) :
deriv (c / d) x = (deriv c x * d x - c x * deriv d x) / d x ^ 2 :=
(hc.hasDerivAt.div hd.hasDerivAt hx).deriv
end Division |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/InverseFunctionTheorem/Deriv.lean | import Mathlib.Analysis.Calculus.Deriv.Inverse
import Mathlib.Analysis.Calculus.InverseFunctionTheorem.FDeriv
/-!
# Inverse function theorem, 1D case
In this file we prove a version of the inverse function theorem for maps `f : š ā š`.
We use `ContinuousLinearEquiv.unitsEquivAut` to translate `HasStrictDerivAt f f' a` and
`f' ā 0` into `HasStrictFDerivAt f (_ : š āL[š] š) a`.
-/
open Filter
open scoped Topology
variable {š : Type*} [NontriviallyNormedField š] [CompleteSpace š] (f : š ā š)
noncomputable section
namespace HasStrictDerivAt
variable (f' a : š) (hf : HasStrictDerivAt f f' a) (hf' : f' ā 0)
include hf hf'
/-- A function that is inverse to `f` near `a`. -/
abbrev localInverse : š ā š :=
(hf.hasStrictFDerivAt_equiv hf').localInverse _ _ _
variable {f f' a}
theorem map_nhds_eq : map f (š a) = š (f a) :=
(hf.hasStrictFDerivAt_equiv hf').map_nhds_eq_of_equiv
theorem to_localInverse : HasStrictDerivAt (hf.localInverse f f' a hf') f'ā»Ā¹ (f a) :=
(hf.hasStrictFDerivAt_equiv hf').to_localInverse
theorem to_local_left_inverse {g : š ā š} (hg : āį¶ x in š a, g (f x) = x) :
HasStrictDerivAt g f'ā»Ā¹ (f a) :=
(hf.hasStrictFDerivAt_equiv hf').to_local_left_inverse hg
end HasStrictDerivAt
variable {f}
/-- If a function has a non-zero strict derivative at all points, then it is an open map. -/
theorem isOpenMap_of_hasStrictDerivAt {f' : š ā š}
(hf : ā x, HasStrictDerivAt f (f' x) x) (h0 : ā x, f' x ā 0) : IsOpenMap f :=
isOpenMap_iff_nhds_le.2 fun x => ((hf x).map_nhds_eq (h0 x)).ge |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/InverseFunctionTheorem/ContDiff.lean | import Mathlib.Analysis.Calculus.ContDiff.Operations
import Mathlib.Analysis.Calculus.ContDiff.RCLike
import Mathlib.Analysis.Calculus.InverseFunctionTheorem.FDeriv
/-!
# Inverse function theorem, `C^r` case
In this file we specialize the inverse function theorem to `C^r`-smooth functions.
-/
noncomputable section
namespace ContDiffAt
variable {š : Type*} [RCLike š]
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace š E]
variable {F : Type*} [NormedAddCommGroup F] [NormedSpace š F]
variable [CompleteSpace E] (f : E ā F) {f' : E āL[š] F} {a : E} {n : WithTop āā}
/-- Given a `ContDiff` function over `š` (which is `ā` or `ā`) with an invertible
derivative at `a`, returns an `OpenPartialHomeomorph` with `to_fun = f` and `a ā source`. -/
def toOpenPartialHomeomorph (hf : ContDiffAt š n f a) (hf' : HasFDerivAt f (f' : E āL[š] F) a)
(hn : 1 ⤠n) : OpenPartialHomeomorph E F :=
(hf.hasStrictFDerivAt' hf' hn).toOpenPartialHomeomorph f
@[deprecated (since := "2025-08-29")] noncomputable alias
toPartialHomeomorph := toOpenPartialHomeomorph
variable {f}
@[simp]
theorem toOpenPartialHomeomorph_coe (hf : ContDiffAt š n f a)
(hf' : HasFDerivAt f (f' : E āL[š] F) a) (hn : 1 ⤠n) :
(hf.toOpenPartialHomeomorph f hf' hn : E ā F) = f :=
rfl
@[deprecated (since := "2025-08-29")] alias
toPartialHomeomorph_coe := toOpenPartialHomeomorph_coe
theorem mem_toOpenPartialHomeomorph_source (hf : ContDiffAt š n f a)
(hf' : HasFDerivAt f (f' : E āL[š] F) a) (hn : 1 ⤠n) :
a ā (hf.toOpenPartialHomeomorph f hf' hn).source :=
(hf.hasStrictFDerivAt' hf' hn).mem_toOpenPartialHomeomorph_source
@[deprecated (since := "2025-08-29")] alias
mem_toPartialHomeomorph_source := mem_toOpenPartialHomeomorph_source
theorem image_mem_toOpenPartialHomeomorph_target (hf : ContDiffAt š n f a)
(hf' : HasFDerivAt f (f' : E āL[š] F) a) (hn : 1 ⤠n) :
f a ā (hf.toOpenPartialHomeomorph f hf' hn).target :=
(hf.hasStrictFDerivAt' hf' hn).image_mem_toOpenPartialHomeomorph_target
@[deprecated (since := "2025-08-29")] alias
image_mem_toPartialHomeomorph_target := image_mem_toOpenPartialHomeomorph_target
/-- Given a `ContDiff` function over `š` (which is `ā` or `ā`) with an invertible derivative
at `a`, returns a function that is locally inverse to `f`. -/
def localInverse (hf : ContDiffAt š n f a) (hf' : HasFDerivAt f (f' : E āL[š] F) a)
(hn : 1 ⤠n) : F ā E :=
(hf.hasStrictFDerivAt' hf' hn).localInverse f f' a
theorem localInverse_apply_image (hf : ContDiffAt š n f a)
(hf' : HasFDerivAt f (f' : E āL[š] F) a) (hn : 1 ⤠n) : hf.localInverse hf' hn (f a) = a :=
(hf.hasStrictFDerivAt' hf' hn).localInverse_apply_image
/-- Given a `ContDiff` function over `š` (which is `ā` or `ā`) with an invertible derivative
at `a`, the inverse function (produced by `ContDiff.toOpenPartialHomeomorph`) is
also `ContDiff`. -/
theorem to_localInverse (hf : ContDiffAt š n f a)
(hf' : HasFDerivAt f (f' : E āL[š] F) a) (hn : 1 ⤠n) :
ContDiffAt š n (hf.localInverse hf' hn) (f a) := by
have := hf.localInverse_apply_image hf' hn
apply (hf.toOpenPartialHomeomorph f hf' hn).contDiffAt_symm
(image_mem_toOpenPartialHomeomorph_target hf hf' hn)
Ā· convert hf'
Ā· convert hf
end ContDiffAt |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/InverseFunctionTheorem/ApproximatesLinearOn.lean | import Mathlib.Analysis.Normed.Operator.Banach
import Mathlib.Analysis.Normed.Operator.NormedSpace
import Mathlib.Topology.OpenPartialHomeomorph
/-!
# Non-linear maps close to affine maps
In this file we study a map `f` such that `āf x - f y - f' (x - y)ā ⤠c * āx - yā` on an open set
`s`, where `f' : E āL[š] F` is a continuous linear map and `c` is suitably small. Maps of this type
behave like `f a + f' (x - a)` near each `a ā s`.
When `f'` is onto, we show that `f` is locally onto.
When `f'` is a continuous linear equiv, we show that `f` is a homeomorphism
between `s` and `f '' s`. More precisely, we define `ApproximatesLinearOn.toOpenPartialHomeomorph`
to be an `OpenPartialHomeomorph` with `toFun = f`, `source = s`, and `target = f '' s`.
between `s` and `f '' s`. More precisely, we define `ApproximatesLinearOn.toOpenPartialHomeomorph`
to be an `OpenPartialHomeomorph` with `toFun = f`, `source = s`, and `target = f '' s`.
Maps of this type naturally appear in the proof of the inverse function theorem (see next section),
and `ApproximatesLinearOn.toOpenPartialHomeomorph` will imply that the locally inverse function
and `ApproximatesLinearOn.toOpenPartialHomeomorph` will imply that the locally inverse function
exists.
We define this auxiliary notion to split the proof of the inverse function theorem into small
lemmas. This approach makes it possible
- to prove a lower estimate on the size of the domain of the inverse function;
- to reuse parts of the proofs in the case if a function is not strictly differentiable. E.g., for a
function `f : E Ć F ā G` with estimates on `f x yā - f x yā` but not on `f xā y - f xā y`.
## Notation
We introduce some `local notation` to make formulas shorter:
* by `N` we denote `āf'ā»Ā¹ā`;
* by `g` we denote the auxiliary contracting map `x ⦠x + f'.symm (y - f x)` used to prove that
`{x | f x = y}` is nonempty.
-/
open Function Set Filter Metric
open scoped Topology NNReal
noncomputable section
variable {š : Type*} [NontriviallyNormedField š]
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace š E]
variable {F : Type*} [NormedAddCommGroup F] [NormedSpace š F]
variable {ε : ā}
open Filter Metric Set
open ContinuousLinearMap (id)
/-- We say that `f` approximates a continuous linear map `f'` on `s` with constant `c`,
if `āf x - f y - f' (x - y)ā ⤠c * āx - yā` whenever `x, y ā s`.
This predicate is defined to facilitate the splitting of the inverse function theorem into small
lemmas. Some of these lemmas can be useful, e.g., to prove that the inverse function is defined
on a specific set. -/
def ApproximatesLinearOn (f : E ā F) (f' : E āL[š] F) (s : Set E) (c : āā„0) : Prop :=
ā x ā s, ā y ā s, āf x - f y - f' (x - y)ā ⤠c * āx - yā
@[simp]
theorem approximatesLinearOn_empty (f : E ā F) (f' : E āL[š] F) (c : āā„0) :
ApproximatesLinearOn f f' ā
c := by simp [ApproximatesLinearOn]
namespace ApproximatesLinearOn
variable {f : E ā F}
/-! First we prove some properties of a function that `ApproximatesLinearOn` a (not necessarily
invertible) continuous linear map. -/
section
variable {f' : E āL[š] F} {s t : Set E} {c c' : āā„0}
theorem mono_num (hc : c ⤠c') (hf : ApproximatesLinearOn f f' s c) :
ApproximatesLinearOn f f' s c' := fun x hx y hy =>
le_trans (hf x hx y hy) (mul_le_mul_of_nonneg_right hc <| norm_nonneg _)
theorem mono_set (hst : s ā t) (hf : ApproximatesLinearOn f f' t c) :
ApproximatesLinearOn f f' s c := fun x hx y hy => hf x (hst hx) y (hst hy)
theorem approximatesLinearOn_iff_lipschitzOnWith {f : E ā F} {f' : E āL[š] F} {s : Set E}
{c : āā„0} : ApproximatesLinearOn f f' s c ā LipschitzOnWith c (f - āf') s := by
have : ā x y, f x - f y - f' (x - y) = (f - f') x - (f - f') y := fun x y ⦠by
simp only [map_sub, Pi.sub_apply]; abel
simp only [this, lipschitzOnWith_iff_norm_sub_le, ApproximatesLinearOn]
alias āØlipschitzOnWith, _root_.LipschitzOnWith.approximatesLinearOnā© :=
approximatesLinearOn_iff_lipschitzOnWith
theorem lipschitz_sub (hf : ApproximatesLinearOn f f' s c) :
LipschitzWith c fun x : s => f x - f' x :=
hf.lipschitzOnWith.to_restrict
protected theorem lipschitz (hf : ApproximatesLinearOn f f' s c) :
LipschitzWith (āf'āā + c) (s.restrict f) := by
simpa only [restrict_apply, add_sub_cancel] using
(f'.lipschitz.restrict s).add hf.lipschitz_sub
protected theorem continuous (hf : ApproximatesLinearOn f f' s c) : Continuous (s.restrict f) :=
hf.lipschitz.continuous
protected theorem continuousOn (hf : ApproximatesLinearOn f f' s c) : ContinuousOn f s :=
continuousOn_iff_continuous_restrict.2 hf.continuous
end
section LocallyOnto
/-!
We prove that a function which is linearly approximated by a continuous linear map with a nonlinear
right inverse is locally onto. This will apply to the case where the approximating map is a linear
equivalence, for the local inverse theorem, but also whenever the approximating map is onto,
by Banach's open mapping theorem. -/
variable [CompleteSpace E] {s : Set E} {c : āā„0} {f' : E āL[š] F}
/-- If a function is linearly approximated by a continuous linear map with a (possibly nonlinear)
right inverse, then it is locally onto: a ball of an explicit radius is included in the image
of the map. -/
theorem surjOn_closedBall_of_nonlinearRightInverse
(hf : ApproximatesLinearOn f f' s c)
(f'symm : f'.NonlinearRightInverse) {ε : ā} {b : E} (ε0 : 0 ⤠ε) (hε : closedBall b ε ā s) :
SurjOn f (closedBall b ε) (closedBall (f b) (((f'symm.nnnorm : ā)ā»Ā¹ - c) * ε)) := by
intro y hy
rcases le_or_gt (f'symm.nnnorm : ā)ā»Ā¹ c with hc | hc
Ā· refine āØb, by simp [ε0], ?_ā©
have : dist y (f b) ⤠0 :=
(mem_closedBall.1 hy).trans (mul_nonpos_of_nonpos_of_nonneg (by linarith) ε0)
simp only [dist_le_zero] at this
rw [this]
have If' : (0 : ā) < f'symm.nnnorm := by rw [ā inv_pos]; exact (NNReal.coe_nonneg _).trans_lt hc
have Icf' : (c : ā) * f'symm.nnnorm < 1 := by rwa [inv_eq_one_div, lt_div_iffā If'] at hc
have Jcf' : (1 : ā) - c * f'symm.nnnorm ā 0 := by apply ne_of_gt; linarith
/- We have to show that `y` can be written as `f x` for some `x ā closedBall b ε`.
The idea of the proof is to apply the Banach contraction principle to the map
`g : x ⦠x + f'symm (y - f x)`, as a fixed point of this map satisfies `f x = y`.
When `f'symm` is a genuine linear inverse, `g` is a contracting map. In our case, since `f'symm`
is nonlinear, this map is not contracting (it is not even continuous), but still the proof of
the contraction theorem holds: `uā = gāæ b` is a Cauchy sequence, converging exponentially fast
to the desired point `x`. Instead of appealing to general results, we check this by hand.
The main point is that `f (u n)` becomes exponentially close to `y`, and therefore
`dist (u (n+1)) (u n)` becomes exponentally small, making it possible to get an inductive
bound on `dist (u n) b`, from which one checks that `u n` stays in the ball on which one has a
control. Therefore, the bound can be checked at the next step, and so on inductively.
-/
set g := fun x => x + f'symm (y - f x) with hg
set u := fun n : ā => g^[n] b with hu
have usucc : ā n, u (n + 1) = g (u n) := by simp [hu, ā iterate_succ_apply' g _ b]
-- First bound: if `f z` is close to `y`, then `g z` is close to `z` (i.e., almost a fixed point).
have A : ā z, dist (g z) z ⤠f'symm.nnnorm * dist (f z) y := by
intro z
rw [dist_eq_norm, hg, add_sub_cancel_left, dist_eq_norm']
exact f'symm.bound _
-- Second bound: if `z` and `g z` are in the set with good control, then `f (g z)` becomes closer
-- to `y` than `f z` was (this uses the linear approximation property, and is the reason for the
-- choice of the formula for `g`).
have B :
ā z ā closedBall b ε,
g z ā closedBall b ε ā dist (f (g z)) y ⤠c * f'symm.nnnorm * dist (f z) y := by
intro z hz hgz
set v := f'symm (y - f z)
calc
dist (f (g z)) y = āf (z + v) - yā := by rw [dist_eq_norm]
_ = āf (z + v) - f z - f' v + f' v - (y - f z)ā := by congr 1; abel
_ = āf (z + v) - f z - f' (z + v - z)ā := by
simp only [v, ContinuousLinearMap.NonlinearRightInverse.right_inv, add_sub_cancel_left,
sub_add_cancel]
_ ⤠c * āz + v - zā := hf _ (hε hgz) _ (hε hz)
_ ⤠c * (f'symm.nnnorm * dist (f z) y) := by
gcongr
simpa [dist_eq_norm'] using f'symm.bound (y - f z)
_ = c * f'symm.nnnorm * dist (f z) y := by ring
-- Third bound: a complicated bound on `dist w b` (that will show up in the induction) is enough
-- to check that `w` is in the ball on which one has controls. Will be used to check that `u n`
-- belongs to this ball for all `n`.
have C : ā (n : ā) (w : E), dist w b ⤠f'symm.nnnorm * (1 - ((c : ā) * f'symm.nnnorm) ^ n) /
(1 - c * f'symm.nnnorm) * dist (f b) y ā w ā closedBall b ε := fun n w hw ⦠by
apply hw.trans
rw [div_mul_eq_mul_div, div_le_iffā]; swap; Ā· linarith
calc
(f'symm.nnnorm : ā) * (1 - ((c : ā) * f'symm.nnnorm) ^ n) * dist (f b) y =
f'symm.nnnorm * dist (f b) y * (1 - ((c : ā) * f'symm.nnnorm) ^ n) := by
ring
_ ⤠f'symm.nnnorm * dist (f b) y * 1 := by
gcongr
rw [sub_le_self_iff]
positivity
_ ⤠f'symm.nnnorm * (((f'symm.nnnorm : ā)ā»Ā¹ - c) * ε) := by
rw [mul_one]
gcongr
exact mem_closedBall'.1 hy
_ = ε * (1 - c * f'symm.nnnorm) := by field
/- Main inductive control: `f (u n)` becomes exponentially close to `y`, and therefore
`dist (u (n+1)) (u n)` becomes exponentally small, making it possible to get an inductive
bound on `dist (u n) b`, from which one checks that `u n` remains in the ball on which we
have estimates. -/
have D : ā n : ā, dist (f (u n)) y ⤠((c : ā) * f'symm.nnnorm) ^ n * dist (f b) y ā§
dist (u n) b ⤠f'symm.nnnorm * (1 - ((c : ā) * f'symm.nnnorm) ^ n) /
(1 - (c : ā) * f'symm.nnnorm) * dist (f b) y := fun n ⦠by
induction n with
| zero => simp [hu, le_refl]
| succ n IH => ?_
rw [usucc]
have Ign : dist (g (u n)) b ⤠f'symm.nnnorm * (1 - ((c : ā) * f'symm.nnnorm) ^ n.succ) /
(1 - c * f'symm.nnnorm) * dist (f b) y :=
calc
dist (g (u n)) b ⤠dist (g (u n)) (u n) + dist (u n) b := dist_triangle _ _ _
_ ⤠f'symm.nnnorm * dist (f (u n)) y + dist (u n) b := add_le_add (A _) le_rfl
_ ⤠f'symm.nnnorm * (((c : ā) * f'symm.nnnorm) ^ n * dist (f b) y) +
f'symm.nnnorm * (1 - ((c : ā) * f'symm.nnnorm) ^ n) / (1 - c * f'symm.nnnorm) *
dist (f b) y := by
gcongr
Ā· exact IH.1
Ā· exact IH.2
_ = f'symm.nnnorm * (1 - ((c : ā) * f'symm.nnnorm) ^ n.succ) /
(1 - (c : ā) * f'symm.nnnorm) * dist (f b) y := by
replace Jcf' : (1:ā) - f'symm.nnnorm * c ā 0 := by convert Jcf' using 1; ring
simp [field, pow_succ, -mul_eq_mul_left_iff]
ring
refine āØ?_, Ignā©
calc
dist (f (g (u n))) y ⤠c * f'symm.nnnorm * dist (f (u n)) y :=
B _ (C n _ IH.2) (C n.succ _ Ign)
_ ⤠(c : ā) * f'symm.nnnorm * (((c : ā) * f'symm.nnnorm) ^ n * dist (f b) y) := by
gcongr
apply IH.1
_ = ((c : ā) * f'symm.nnnorm) ^ n.succ * dist (f b) y := by simp only [pow_succ']; ring
-- Deduce from the inductive bound that `uā` is a Cauchy sequence, therefore converging.
have : CauchySeq u := by
refine cauchySeq_of_le_geometric _ (āf'symm.nnnorm * dist (f b) y) Icf' fun n ⦠?_
calc
dist (u n) (u (n + 1)) = dist (g (u n)) (u n) := by rw [usucc, dist_comm]
_ ⤠f'symm.nnnorm * dist (f (u n)) y := A _
_ ⤠f'symm.nnnorm * (((c : ā) * f'symm.nnnorm) ^ n * dist (f b) y) := by
gcongr
exact (D n).1
_ = f'symm.nnnorm * dist (f b) y * ((c : ā) * f'symm.nnnorm) ^ n := by ring
obtain āØx, hxā© : ā x, Tendsto u atTop (š x) := cauchySeq_tendsto_of_complete this
-- As all the `uā` belong to the ball `closedBall b ε`, so does their limit `x`.
have xmem : x ā closedBall b ε :=
isClosed_closedBall.mem_of_tendsto hx (Eventually.of_forall fun n => C n _ (D n).2)
refine āØx, xmem, ?_ā©
-- It remains to check that `f x = y`. This follows from continuity of `f` on `closedBall b ε`
-- and from the fact that `f uā` is converging to `y` by construction.
have hx' : Tendsto u atTop (š[closedBall b ε] x) := by
simp only [nhdsWithin, tendsto_inf, hx, true_and, tendsto_principal]
exact Eventually.of_forall fun n => C n _ (D n).2
have T1 : Tendsto (f ā u) atTop (š (f x)) :=
(hf.continuousOn.mono hε x xmem).tendsto.comp hx'
have T2 : Tendsto (f ā u) atTop (š y) := by
rw [tendsto_iff_dist_tendsto_zero]
refine squeeze_zero (fun _ => dist_nonneg) (fun n => (D n).1) ?_
simpa using (tendsto_pow_atTop_nhds_zero_of_lt_one (by positivity) Icf').mul tendsto_const_nhds
exact tendsto_nhds_unique T1 T2
theorem open_image (hf : ApproximatesLinearOn f f' s c) (f'symm : f'.NonlinearRightInverse)
(hs : IsOpen s) (hc : Subsingleton F ⨠c < f'symm.nnnormā»Ā¹) : IsOpen (f '' s) := by
rcases hc with hE | hc
Ā· exact isOpen_discrete _
simp only [isOpen_iff_mem_nhds, nhds_basis_closedBall.mem_iff, forall_mem_image] at hs ā¢
intro x hx
rcases hs x hx with āØĪµ, ε0, hεā©
refine āØ(f'symm.nnnormā»Ā¹ - c) * ε, mul_pos (sub_pos.2 hc) ε0, ?_ā©
exact (hf.surjOn_closedBall_of_nonlinearRightInverse f'symm (le_of_lt ε0) hε).mono hε Subset.rfl
theorem image_mem_nhds (hf : ApproximatesLinearOn f f' s c) (f'symm : f'.NonlinearRightInverse)
{x : E} (hs : s ā š x) (hc : Subsingleton F ⨠c < f'symm.nnnormā»Ā¹) : f '' s ā š (f x) := by
obtain āØt, hts, ht, xtā© : ā t, t ā s ā§ IsOpen t ā§ x ā t := _root_.mem_nhds_iff.1 hs
have := IsOpen.mem_nhds ((hf.mono_set hts).open_image f'symm ht hc) (mem_image_of_mem _ xt)
exact mem_of_superset this (image_mono hts)
theorem map_nhds_eq (hf : ApproximatesLinearOn f f' s c) (f'symm : f'.NonlinearRightInverse) {x : E}
(hs : s ā š x) (hc : Subsingleton F ⨠c < f'symm.nnnormā»Ā¹) : map f (š x) = š (f x) := by
refine
le_antisymm ((hf.continuousOn x (mem_of_mem_nhds hs)).continuousAt hs) (le_map fun t ht => ?_)
have : f '' (s ā© t) ā š (f x) :=
(hf.mono_set inter_subset_left).image_mem_nhds f'symm (inter_mem hs ht) hc
exact mem_of_superset this (image_mono inter_subset_right)
end LocallyOnto
/-!
From now on we assume that `f` approximates an invertible continuous linear map `f : E āL[š] F`.
We also assume that either `E = {0}`, or `c < āf'ā»Ā¹āā»Ā¹`. We use `N` as an abbreviation for `āf'ā»Ā¹ā`.
-/
variable {f' : E āL[š] F} {s : Set E} {c : āā„0}
local notation "N" => ā(f'.symm : F āL[š] E)āā
protected theorem antilipschitz (hf : ApproximatesLinearOn f (f' : E āL[š] F) s c)
(hc : Subsingleton E ⨠c < Nā»Ā¹) : AntilipschitzWith (Nā»Ā¹ - c)ā»Ā¹ (s.restrict f) := by
rcases hc with hE | hc
Ā· exact AntilipschitzWith.of_subsingleton
convert (f'.antilipschitz.restrict s).add_lipschitzWith hf.lipschitz_sub hc
simp [restrict]
protected theorem injective (hf : ApproximatesLinearOn f (f' : E āL[š] F) s c)
(hc : Subsingleton E ⨠c < Nā»Ā¹) : Injective (s.restrict f) :=
(hf.antilipschitz hc).injective
protected theorem injOn (hf : ApproximatesLinearOn f (f' : E āL[š] F) s c)
(hc : Subsingleton E ⨠c < Nā»Ā¹) : InjOn f s :=
injOn_iff_injective.2 <| hf.injective hc
protected theorem surjective [CompleteSpace E] (hf : ApproximatesLinearOn f (f' : E āL[š] F) univ c)
(hc : Subsingleton E ⨠c < Nā»Ā¹) : Surjective f := by
rcases hc with hE | hc
Ā· haveI : Subsingleton F := (Equiv.subsingleton_congr f'.toEquiv).1 hE
exact surjective_to_subsingleton _
Ā· apply forall_of_forall_mem_closedBall (fun y : F => ā a, f a = y) (f 0) _
have hc' : (0 : ā) < Nā»Ā¹ - c := by rw [sub_pos]; exact hc
let p : ā ā Prop := fun R => closedBall (f 0) R ā Set.range f
have hp : āį¶ r : ā in atTop, p ((Nā»Ā¹ - c) * r) := by
have hr : āį¶ r : ā in atTop, 0 ⤠r := eventually_ge_atTop 0
refine hr.mono fun r hr => Subset.trans ?_ (image_subset_range f (closedBall 0 r))
refine hf.surjOn_closedBall_of_nonlinearRightInverse f'.toNonlinearRightInverse hr ?_
exact subset_univ _
refine ((tendsto_id.const_mul_atTop hc').frequently hp.frequently).mono ?_
exact fun R h y hy => h hy
/-- A map approximating a linear equivalence on a set defines a partial equivalence on this set.
Should not be used outside of this file, because it is superseded by `toOpenPartialHomeomorph`
below.
This is a first step towards the inverse function. -/
def toPartialEquiv (hf : ApproximatesLinearOn f (f' : E āL[š] F) s c)
(hc : Subsingleton E ⨠c < Nā»Ā¹) : PartialEquiv E F :=
(hf.injOn hc).toPartialEquiv _ _
/-- The inverse function is continuous on `f '' s`.
Use properties of `OpenPartialHomeomorph` instead. -/
theorem inverse_continuousOn (hf : ApproximatesLinearOn f (f' : E āL[š] F) s c)
(hc : Subsingleton E ⨠c < Nā»Ā¹) : ContinuousOn (hf.toPartialEquiv hc).symm (f '' s) := by
apply continuousOn_iff_continuous_restrict.2
refine ((hf.antilipschitz hc).to_rightInvOn' ?_ (hf.toPartialEquiv hc).right_inv').continuous
exact fun x hx => (hf.toPartialEquiv hc).map_target hx
/-- The inverse function is approximated linearly on `f '' s` by `f'.symm`. -/
theorem to_inv (hf : ApproximatesLinearOn f (f' : E āL[š] F) s c) (hc : Subsingleton E ⨠c < Nā»Ā¹) :
ApproximatesLinearOn (hf.toPartialEquiv hc).symm (f'.symm : F āL[š] E) (f '' s)
(N * (Nā»Ā¹ - c)ā»Ā¹ * c) := fun x hx y hy ⦠by
set A := hf.toPartialEquiv hc
have Af : ā z, A z = f z := fun z => rfl
rcases (mem_image _ _ _).1 hx with āØx', x's, rflā©
rcases (mem_image _ _ _).1 hy with āØy', y's, rflā©
rw [ā Af x', ā Af y', A.left_inv x's, A.left_inv y's]
calc
āx' - y' - f'.symm (A x' - A y')ā ⤠N * āf' (x' - y' - f'.symm (A x' - A y'))ā :=
(f' : E āL[š] F).bound_of_antilipschitz f'.antilipschitz _
_ = N * āA y' - A x' - f' (y' - x')ā := by
congr 2
simp only [ContinuousLinearEquiv.apply_symm_apply, ContinuousLinearEquiv.map_sub]
abel
_ ⤠N * (c * āy' - x'ā) := mul_le_mul_of_nonneg_left (hf _ y's _ x's) (NNReal.coe_nonneg _)
_ ⤠N * (c * (((Nā»Ā¹ - c)ā»Ā¹ : āā„0) * āA y' - A x'ā)) := by
gcongr
rw [ā dist_eq_norm, ā dist_eq_norm]
exact (hf.antilipschitz hc).le_mul_dist āØy', y'sā© āØx', x'sā©
_ = (N * (Nā»Ā¹ - c)ā»Ā¹ * c : āā„0) * āA x' - A y'ā := by
simp only [norm_sub_rev, NNReal.coe_mul]; ring
variable [CompleteSpace E]
section
variable (f s)
/-- Given a function `f` that approximates a linear equivalence on an open set `s`,
returns a open partial homeomorphism with `toFun = f` and `source = s`. -/
def toOpenPartialHomeomorph (hf : ApproximatesLinearOn f (f' : E āL[š] F) s c)
(hc : Subsingleton E ⨠c < Nā»Ā¹) (hs : IsOpen s) : OpenPartialHomeomorph E F where
toPartialEquiv := hf.toPartialEquiv hc
open_source := hs
open_target := hf.open_image f'.toNonlinearRightInverse hs <| by
rwa [f'.toEquiv.subsingleton_congr] at hc
continuousOn_toFun := hf.continuousOn
continuousOn_invFun := hf.inverse_continuousOn hc
@[deprecated (since := "2025-08-29")] noncomputable alias
toPartialHomeomorph := toOpenPartialHomeomorph
@[simp]
theorem toOpenPartialHomeomorph_coe (hf : ApproximatesLinearOn f (f' : E āL[š] F) s c)
(hc : Subsingleton E ⨠c < Nā»Ā¹) (hs : IsOpen s) :
(hf.toOpenPartialHomeomorph f s hc hs : E ā F) = f :=
rfl
@[deprecated (since := "2025-08-29")] alias
toPartialHomeomorph_coe := toOpenPartialHomeomorph_coe
@[simp]
theorem toOpenPartialHomeomorph_source (hf : ApproximatesLinearOn f (f' : E āL[š] F) s c)
(hc : Subsingleton E ⨠c < Nā»Ā¹) (hs : IsOpen s) :
(hf.toOpenPartialHomeomorph f s hc hs).source = s :=
rfl
@[deprecated (since := "2025-08-29")] alias
toPartialHomeomorph_source := toOpenPartialHomeomorph_source
@[simp]
theorem toOpenPartialHomeomorph_target (hf : ApproximatesLinearOn f (f' : E āL[š] F) s c)
(hc : Subsingleton E ⨠c < Nā»Ā¹) (hs : IsOpen s) :
(hf.toOpenPartialHomeomorph f s hc hs).target = f '' s :=
rfl
@[deprecated (since := "2025-08-29")] alias
toPartialHomeomorph_target := toOpenPartialHomeomorph_target
/-- A function `f` that approximates a linear equivalence on the whole space is a homeomorphism. -/
def toHomeomorph (hf : ApproximatesLinearOn f (f' : E āL[š] F) univ c)
(hc : Subsingleton E ⨠c < Nā»Ā¹) : E āā F := by
refine
(hf.toOpenPartialHomeomorph _ _ hc isOpen_univ).toHomeomorphOfSourceEqUnivTargetEqUniv rfl ?_
rw [toOpenPartialHomeomorph_target, image_univ, range_eq_univ]
exact hf.surjective hc
end
theorem closedBall_subset_target (hf : ApproximatesLinearOn f (f' : E āL[š] F) s c)
(hc : Subsingleton E ⨠c < Nā»Ā¹) (hs : IsOpen s) {b : E} (ε0 : 0 ⤠ε) (hε : closedBall b ε ā s) :
closedBall (f b) ((Nā»Ā¹ - c) * ε) ā (hf.toOpenPartialHomeomorph f s hc hs).target :=
(hf.surjOn_closedBall_of_nonlinearRightInverse f'.toNonlinearRightInverse ε0 hε).mono hε
Subset.rfl
end ApproximatesLinearOn |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/InverseFunctionTheorem/FDeriv.lean | import Mathlib.Analysis.Calculus.FDeriv.Equiv
import Mathlib.Analysis.Calculus.InverseFunctionTheorem.ApproximatesLinearOn
/-!
# Inverse function theorem
In this file we prove the inverse function theorem. It says that if a map `f : E ā F`
has an invertible strict derivative `f'` at `a`, then it is locally invertible,
and the inverse function has derivative `f' ā»Ā¹`.
We define `HasStrictFDerivAt.toOpenPartialHomeomorph` that repacks a function `f`
with a `hf : HasStrictFDerivAt f f' a`, `f' : E āL[š] F`, into an `OpenPartialHomeomorph`.
The `toFun` of this `OpenPartialHomeomorph` is defeq to `f`, so one can apply theorems
about `OpenPartialHomeomorph` to `hf.toOpenPartialHomeomorph f`, and get statements about `f`.
Then we define `HasStrictFDerivAt.localInverse` to be the `invFun` of this `OpenPartialHomeomorph`,
and prove two versions of the inverse function theorem:
* `HasStrictFDerivAt.to_localInverse`: if `f` has an invertible derivative `f'` at `a` in the
strict sense (`hf`), then `hf.localInverse f f' a` has derivative `f'.symm` at `f a` in the
strict sense;
* `HasStrictFDerivAt.to_local_left_inverse`: if `f` has an invertible derivative `f'` at `a` in
the strict sense and `g` is locally left inverse to `f` near `a`, then `g` has derivative
`f'.symm` at `f a` in the strict sense.
Some related theorems, providing the derivative and higher regularity assuming that we already know
the inverse function, are formulated in the `Analysis/Calculus/FDeriv` and `Analysis/Calculus/Deriv`
folders, and in `ContDiff.lean`.
## Tags
derivative, strictly differentiable, continuously differentiable, smooth, inverse function
-/
open Function Set Filter Metric
open scoped Topology NNReal
noncomputable section
variable {š : Type*} [NontriviallyNormedField š]
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace š E]
variable {F : Type*} [NormedAddCommGroup F] [NormedSpace š F]
open Asymptotics Filter Metric Set
open ContinuousLinearMap (id)
/-!
### Inverse function theorem
Let `f : E ā F` be a map defined on a complete vector
space `E`. Assume that `f` has an invertible derivative `f' : E āL[š] F` at `a : E` in the strict
sense. Then `f` approximates `f'` in the sense of `ApproximatesLinearOn` on an open neighborhood
of `a`, and we can apply `ApproximatesLinearOn.toOpenPartialHomeomorph` to construct the inverse
function. -/
namespace HasStrictFDerivAt
/-- If `f` has derivative `f'` at `a` in the strict sense and `c > 0`, then `f` approximates `f'`
with constant `c` on some neighborhood of `a`. -/
theorem approximates_deriv_on_nhds {f : E ā F} {f' : E āL[š] F} {a : E}
(hf : HasStrictFDerivAt f f' a) {c : āā„0} (hc : Subsingleton E ⨠0 < c) :
ā s ā š a, ApproximatesLinearOn f f' s c := by
rcases hc with hE | hc
Ā· refine āØuniv, IsOpen.mem_nhds isOpen_univ trivial, fun x _ y _ => ?_ā©
simp [@Subsingleton.elim E hE x y]
have := hf.isLittleO.def hc
rw [nhds_prod_eq, Filter.Eventually, mem_prod_same_iff] at this
rcases this with āØs, has, hsā©
exact āØs, has, fun x hx y hy => hs (mk_mem_prod hx hy)ā©
theorem map_nhds_eq_of_surj [CompleteSpace E] [CompleteSpace F] {f : E ā F} {f' : E āL[š] F} {a : E}
(hf : HasStrictFDerivAt f (f' : E āL[š] F) a) (h : LinearMap.range f' = ā¤) :
map f (š a) = š (f a) := by
let f'symm := f'.nonlinearRightInverseOfSurjective h
set c : āā„0 := f'symm.nnnormā»Ā¹ / 2 with hc
have f'symm_pos : 0 < f'symm.nnnorm := f'.nonlinearRightInverseOfSurjective_nnnorm_pos h
have cpos : 0 < c := by simp [hc, inv_pos, f'symm_pos]
obtain āØs, s_nhds, hsā© : ā s ā š a, ApproximatesLinearOn f f' s c :=
hf.approximates_deriv_on_nhds (Or.inr cpos)
apply hs.map_nhds_eq f'symm s_nhds (Or.inr (NNReal.half_lt_self _))
simp [ne_of_gt f'symm_pos]
variable {f : E ā F} {f' : E āL[š] F} {a : E}
theorem approximates_deriv_on_open_nhds (hf : HasStrictFDerivAt f (f' : E āL[š] F) a) :
ā s : Set E, a ā s ā§ IsOpen s ā§
ApproximatesLinearOn f (f' : E āL[š] F) s (ā(f'.symm : F āL[š] E)āāā»Ā¹ / 2) := by
simp only [ā and_assoc]
refine ((nhds_basis_opens a).exists_iff fun s t => ApproximatesLinearOn.mono_set).1 ?_
exact
hf.approximates_deriv_on_nhds <|
f'.subsingleton_or_nnnorm_symm_pos.imp id fun hf' => half_pos <| inv_pos.2 hf'
variable (f)
variable [CompleteSpace E]
/-- Given a function with an invertible strict derivative at `a`, returns an `OpenPartialHomeomorph`
with `to_fun = f` and `a ā source`. This is a part of the inverse function theorem.
The other part `HasStrictFDerivAt.to_localInverse` states that the inverse function
of this `OpenPartialHomeomorph` has derivative `f'.symm`. -/
def toOpenPartialHomeomorph (hf : HasStrictFDerivAt f (f' : E āL[š] F) a) :
OpenPartialHomeomorph E F :=
ApproximatesLinearOn.toOpenPartialHomeomorph f
(Classical.choose hf.approximates_deriv_on_open_nhds)
(Classical.choose_spec hf.approximates_deriv_on_open_nhds).2.2
(f'.subsingleton_or_nnnorm_symm_pos.imp id fun hf' =>
NNReal.half_lt_self <| ne_of_gt <| inv_pos.2 hf')
(Classical.choose_spec hf.approximates_deriv_on_open_nhds).2.1
@[deprecated (since := "2025-08-29")] noncomputable alias
toPartialHomeomorph := toOpenPartialHomeomorph
variable {f}
@[simp]
theorem toOpenPartialHomeomorph_coe (hf : HasStrictFDerivAt f (f' : E āL[š] F) a) :
(hf.toOpenPartialHomeomorph f : E ā F) = f :=
rfl
@[deprecated (since := "2025-08-29")] alias
toPartialHomeomorph_coe := toOpenPartialHomeomorph_coe
theorem mem_toOpenPartialHomeomorph_source (hf : HasStrictFDerivAt f (f' : E āL[š] F) a) :
a ā (hf.toOpenPartialHomeomorph f).source :=
(Classical.choose_spec hf.approximates_deriv_on_open_nhds).1
@[deprecated (since := "2025-08-29")] alias
mem_toPartialHomeomorph_source := mem_toOpenPartialHomeomorph_source
theorem image_mem_toOpenPartialHomeomorph_target (hf : HasStrictFDerivAt f (f' : E āL[š] F) a) :
f a ā (hf.toOpenPartialHomeomorph f).target :=
(hf.toOpenPartialHomeomorph f).map_source hf.mem_toOpenPartialHomeomorph_source
@[deprecated (since := "2025-08-29")] alias
image_mem_toPartialHomeomorph_target := image_mem_toOpenPartialHomeomorph_target
theorem map_nhds_eq_of_equiv (hf : HasStrictFDerivAt f (f' : E āL[š] F) a) :
map f (š a) = š (f a) :=
(hf.toOpenPartialHomeomorph f).map_nhds_eq hf.mem_toOpenPartialHomeomorph_source
variable (f f' a)
/-- Given a function `f` with an invertible derivative, returns a function that is locally inverse
to `f`. -/
def localInverse (hf : HasStrictFDerivAt f (f' : E āL[š] F) a) : F ā E :=
(hf.toOpenPartialHomeomorph f).symm
variable {f f' a}
theorem localInverse_def (hf : HasStrictFDerivAt f (f' : E āL[š] F) a) :
hf.localInverse f _ _ = (hf.toOpenPartialHomeomorph f).symm :=
rfl
theorem eventually_left_inverse (hf : HasStrictFDerivAt f (f' : E āL[š] F) a) :
āį¶ x in š a, hf.localInverse f f' a (f x) = x :=
(hf.toOpenPartialHomeomorph f).eventually_left_inverse hf.mem_toOpenPartialHomeomorph_source
@[simp]
theorem localInverse_apply_image (hf : HasStrictFDerivAt f (f' : E āL[š] F) a) :
hf.localInverse f f' a (f a) = a :=
hf.eventually_left_inverse.self_of_nhds
theorem eventually_right_inverse (hf : HasStrictFDerivAt f (f' : E āL[š] F) a) :
āį¶ y in š (f a), f (hf.localInverse f f' a y) = y :=
(hf.toOpenPartialHomeomorph f).eventually_right_inverse' hf.mem_toOpenPartialHomeomorph_source
theorem localInverse_continuousAt (hf : HasStrictFDerivAt f (f' : E āL[š] F) a) :
ContinuousAt (hf.localInverse f f' a) (f a) :=
(hf.toOpenPartialHomeomorph f).continuousAt_symm hf.image_mem_toOpenPartialHomeomorph_target
theorem localInverse_tendsto (hf : HasStrictFDerivAt f (f' : E āL[š] F) a) :
Tendsto (hf.localInverse f f' a) (š <| f a) (š a) :=
(hf.toOpenPartialHomeomorph f).tendsto_symm hf.mem_toOpenPartialHomeomorph_source
theorem localInverse_unique (hf : HasStrictFDerivAt f (f' : E āL[š] F) a) {g : F ā E}
(hg : āį¶ x in š a, g (f x) = x) : āį¶ y in š (f a), g y = localInverse f f' a hf y :=
eventuallyEq_of_left_inv_of_right_inv hg hf.eventually_right_inverse <|
(hf.toOpenPartialHomeomorph f).tendsto_symm hf.mem_toOpenPartialHomeomorph_source
/-- If `f` has an invertible derivative `f'` at `a` in the sense of strict differentiability `(hf)`,
then the inverse function `hf.localInverse f` has derivative `f'.symm` at `f a`. -/
theorem to_localInverse (hf : HasStrictFDerivAt f (f' : E āL[š] F) a) :
HasStrictFDerivAt (hf.localInverse f f' a) (f'.symm : F āL[š] E) (f a) :=
(hf.toOpenPartialHomeomorph f).hasStrictFDerivAt_symm
hf.image_mem_toOpenPartialHomeomorph_target <| by
simpa [ā localInverse_def] using hf
/-- If `f : E ā F` has an invertible derivative `f'` at `a` in the sense of strict differentiability
and `g (f x) = x` in a neighborhood of `a`, then `g` has derivative `f'.symm` at `f a`.
For a version assuming `f (g y) = y` and continuity of `g` at `f a` but not `[CompleteSpace E]`
see `of_local_left_inverse`. -/
theorem to_local_left_inverse (hf : HasStrictFDerivAt f (f' : E āL[š] F) a) {g : F ā E}
(hg : āį¶ x in š a, g (f x) = x) : HasStrictFDerivAt g (f'.symm : F āL[š] E) (f a) :=
hf.to_localInverse.congr_of_eventuallyEq <| (hf.localInverse_unique hg).mono fun _ => Eq.symm
end HasStrictFDerivAt
/-- If a function has an invertible strict derivative at all points, then it is an open map. -/
theorem isOpenMap_of_hasStrictFDerivAt_equiv [CompleteSpace E] {f : E ā F} {f' : E ā E āL[š] F}
(hf : ā x, HasStrictFDerivAt f (f' x : E āL[š] F) x) : IsOpenMap f :=
isOpenMap_iff_nhds_le.2 fun x => (hf x).map_nhds_eq_of_equiv.ge |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/InverseFunctionTheorem/FiniteDimensional.lean | import Mathlib.Analysis.Calculus.InverseFunctionTheorem.ApproximatesLinearOn
import Mathlib.Analysis.Normed.Module.FiniteDimension
/-!
# A lemma about `ApproximatesLinearOn` that needs `FiniteDimensional`
In this file we prove that in a real vector space,
a function `f` that approximates a linear equivalence on a subset `s`
can be extended to a homeomorphism of the whole space.
This used to be the only lemma in `Mathlib/Analysis/Calculus/Inverse`
depending on `FiniteDimensional`, so it was moved to a new file when the original file got split.
-/
open Set
open scoped NNReal
namespace ApproximatesLinearOn
/-- In a real vector space, a function `f` that approximates a linear equivalence on a subset `s`
can be extended to a homeomorphism of the whole space. -/
theorem exists_homeomorph_extension {E : Type*} [NormedAddCommGroup E] [NormedSpace ā E]
{F : Type*} [NormedAddCommGroup F] [NormedSpace ā F] [FiniteDimensional ā F] {s : Set E}
{f : E ā F} {f' : E āL[ā] F} {c : āā„0} (hf : ApproximatesLinearOn f (f' : E āL[ā] F) s c)
(hc : Subsingleton E ⨠lipschitzExtensionConstant F * c < ā(f'.symm : F āL[ā] E)āāā»Ā¹) :
ā g : E āā F, EqOn f g s := by
-- the difference `f - f'` is Lipschitz on `s`. It can be extended to a Lipschitz function `u`
-- on the whole space, with a slightly worse Lipschitz constant. Then `f' + u` will be the
-- desired homeomorphism.
obtain āØu, hu, ufā© :
ā u : E ā F, LipschitzWith (lipschitzExtensionConstant F * c) u ā§ EqOn (f - āf') u s :=
hf.lipschitzOnWith.extend_finite_dimension
let g : E ā F := fun x => f' x + u x
have fg : EqOn f g s := fun x hx => by simp_rw [g, ā uf hx, Pi.sub_apply, add_sub_cancel]
have hg : ApproximatesLinearOn g (f' : E āL[ā] F) univ (lipschitzExtensionConstant F * c) := by
apply LipschitzOnWith.approximatesLinearOn
rw [lipschitzOnWith_univ]
convert hu
ext x
simp only [g, add_sub_cancel_left, ContinuousLinearEquiv.coe_coe, Pi.sub_apply]
haveI : FiniteDimensional ā E := f'.symm.finiteDimensional
exact āØhg.toHomeomorph g hc, fgā©
end ApproximatesLinearOn |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/TangentCone/ProperSpace.lean | import Mathlib.Analysis.Seminorm
import Mathlib.Analysis.Calculus.TangentCone.Defs
/-!
# Tangent cone in a proper space
In this file we prove that the tangent cone of a set in a proper normed space
at an accumulation point of this set is nontrivial.
-/
open Filter Set Metric NormedField
open scoped Topology
variable {š : Type*} [NontriviallyNormedField š]
{E : Type*} [NormedAddCommGroup E] [NormedSpace š E]
/-- In a proper space, the tangent cone at a non-isolated point is nontrivial. -/
theorem tangentConeAt_nonempty_of_properSpace [ProperSpace E]
{s : Set E} {x : E} (hx : AccPt x (š s)) :
(tangentConeAt š s x ā© {0}į¶).Nonempty := by
/- Take a sequence `d n` tending to `0` such that `x + d n ā s`. Taking `c n` of the order
of `1 / d n`. Then `c n ⢠d n` belongs to a fixed annulus. By compactness, one can extract
a subsequence converging to a limit `l`. Then `l` is nonzero, and by definition it belongs to
the tangent cone. -/
obtain āØu, -, u_pos, u_limā© :
ā u, StrictAnti u ā§ (ā (n : ā), 0 < u n) ā§ Tendsto u atTop (š (0 : ā)) :=
exists_seq_strictAnti_tendsto (0 : ā)
have A n : ā y ā closedBall x (u n) ā© s, y ā x :=
(accPt_iff_nhds).mp hx _ (closedBall_mem_nhds _ (u_pos n))
choose v hv hvx using A
choose hvu hvs using hv
let d := fun n ⦠v n - x
have M n : x + d n ā s \ {x} := by simp [d, hvs, hvx]
let āØr, hrā© := exists_one_lt_norm š
have W n := rescale_to_shell hr zero_lt_one (x := d n) (by simpa using (M n).2)
choose c c_ne c_le le_c hc using W
have c_lim : Tendsto (fun n ⦠āc nā) atTop atTop := by
suffices Tendsto (fun n ⦠āc nāā»Ā¹ ā»Ā¹ ) atTop atTop by simpa
apply tendsto_inv_nhdsGT_zero.comp
simp only [nhdsWithin, tendsto_inf, tendsto_principal, mem_Ioi, eventually_atTop, ge_iff_le]
have B (n : ā) : āc nāā»Ā¹ ⤠1ā»Ā¹ * ārā * u n := by
apply (hc n).trans
gcongr
simpa [d, dist_eq_norm] using hvu n
refine āØ?_, 0, fun n hn ⦠by simpa using c_ne nā©
apply squeeze_zero (fun n ⦠by positivity) B
simpa using u_lim.const_mul _
obtain āØl, l_mem, Ļ, Ļ_strict, hĻā© :
ā l ā Metric.closedBall (0 : E) 1 \ Metric.ball (0 : E) (1 / ārā),
ā (Ļ : ā ā ā), StrictMono Ļ ā§ Tendsto ((fun n ⦠c n ⢠d n) ā Ļ) atTop (š l) := by
apply IsCompact.tendsto_subseq _ (fun n ⦠?_)
Ā· exact (isCompact_closedBall 0 1).diff Metric.isOpen_ball
simp only [mem_diff, Metric.mem_closedBall, dist_zero_right, (c_le n).le,
Metric.mem_ball, not_lt, true_and, le_c n]
refine āØl, ?_, ?_ā©; swap
Ā· simp only [mem_compl_iff, mem_singleton_iff]
contrapose! l_mem
simp only [one_div, l_mem, mem_diff, Metric.mem_closedBall, dist_self, zero_le_one,
Metric.mem_ball, inv_pos, norm_pos_iff, ne_eq, not_not, true_and]
contrapose! hr
simp [hr]
refine āØc ā Ļ, d ā Ļ, .of_forall fun n ⦠?_, ?_, hĻā©
Ā· simpa [d] using hvs (Ļ n)
Ā· exact c_lim.comp Ļ_strict.tendsto_atTop
@[deprecated (since := "2025-04-27")]
alias tangentCone_nonempty_of_properSpace := tangentConeAt_nonempty_of_properSpace |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/TangentCone/Prod.lean | import Mathlib.Analysis.SpecificLimits.Basic
import Mathlib.Analysis.Calculus.TangentCone.Defs
import Mathlib.Analysis.Normed.Module.Basic
/-!
# Product of sets with unique differentiability property
In this file we prove that the product of two sets with unique differentiability property
has the same property, see `UniqueDiffOn.prod`.
-/
open Filter Set
open scoped Topology
variable {š E F : Type*} [NontriviallyNormedField š]
[NormedAddCommGroup E] [NormedSpace š E]
[NormedAddCommGroup F] [NormedSpace š F]
{x : E} {s : Set E} {y : F} {t : Set F}
/-- The tangent cone of a product contains the tangent cone of its left factor. -/
theorem subset_tangentConeAt_prod_left (ht : y ā closure t) :
LinearMap.inl š E F '' tangentConeAt š s x ā tangentConeAt š (s ĆĖ¢ t) (x, y) := by
rintro _ āØv, āØc, d, hd, hc, hyā©, rflā©
have : ā n, ā d', y + d' ā t ā§ āc n ⢠d'ā < ((1 : ā) / 2) ^ n := by
intro n
rcases mem_closure_iff_nhds.1 ht _
(eventually_nhds_norm_smul_sub_lt (c n) y (pow_pos one_half_pos n)) with
āØz, hz, hztā©
exact āØz - y, by simpa using hzt, by simpa using hzā©
choose d' hd' using this
refine āØc, fun n => (d n, d' n), ?_, hc, ?_ā©
Ā· change āį¶ n in atTop, (x, y) + (d n, d' n) ā s ĆĖ¢ t
filter_upwards [hd] with n hn
simp [hn, (hd' n).1]
Ā· apply Tendsto.prodMk_nhds hy _
refine squeeze_zero_norm (fun n => (hd' n).2.le) ?_
exact tendsto_pow_atTop_nhds_zero_of_lt_one one_half_pos.le one_half_lt_one
@[deprecated (since := "2025-04-27")]
alias subset_tangentCone_prod_left := subset_tangentConeAt_prod_left
/-- The tangent cone of a product contains the tangent cone of its right factor. -/
theorem subset_tangentConeAt_prod_right (hs : x ā closure s) :
LinearMap.inr š E F '' tangentConeAt š t y ā tangentConeAt š (s ĆĖ¢ t) (x, y) := by
rintro _ āØw, āØc, d, hd, hc, hyā©, rflā©
have : ā n, ā d', x + d' ā s ā§ āc n ⢠d'ā < ((1 : ā) / 2) ^ n := by
intro n
rcases mem_closure_iff_nhds.1 hs _
(eventually_nhds_norm_smul_sub_lt (c n) x (pow_pos one_half_pos n)) with
āØz, hz, hzsā©
exact āØz - x, by simpa using hzs, by simpa using hzā©
choose d' hd' using this
refine āØc, fun n => (d' n, d n), ?_, hc, ?_ā©
Ā· change āį¶ n in atTop, (x, y) + (d' n, d n) ā s ĆĖ¢ t
filter_upwards [hd] with n hn
simp [hn, (hd' n).1]
Ā· apply Tendsto.prodMk_nhds _ hy
refine squeeze_zero_norm (fun n => (hd' n).2.le) ?_
exact tendsto_pow_atTop_nhds_zero_of_lt_one one_half_pos.le one_half_lt_one
@[deprecated (since := "2025-04-27")]
alias subset_tangentCone_prod_right := subset_tangentConeAt_prod_right
/-- The product of two sets of unique differentiability at points `x` and `y` has unique
differentiability at `(x, y)`. -/
theorem UniqueDiffWithinAt.prod {t : Set F} {y : F} (hs : UniqueDiffWithinAt š s x)
(ht : UniqueDiffWithinAt š t y) : UniqueDiffWithinAt š (s ĆĖ¢ t) (x, y) := by
rw [uniqueDiffWithinAt_iff] at hs ht ā¢
rw [closure_prod_eq]
refine āØ?_, hs.2, ht.2ā©
have : _ ⤠Submodule.span š (tangentConeAt š (s ĆĖ¢ t) (x, y)) := Submodule.span_mono
(union_subset (subset_tangentConeAt_prod_left ht.2) (subset_tangentConeAt_prod_right hs.2))
rw [LinearMap.span_inl_union_inr, SetLike.le_def] at this
exact (hs.1.prod ht.1).mono this
/-- The product of two sets of unique differentiability is a set of unique differentiability. -/
theorem UniqueDiffOn.prod {t : Set F} (hs : UniqueDiffOn š s) (ht : UniqueDiffOn š t) :
UniqueDiffOn š (s ĆĖ¢ t) :=
fun āØx, yā© h => UniqueDiffWithinAt.prod (hs x h.1) (ht y h.2) |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/TangentCone/Pi.lean | import Mathlib.Analysis.Calculus.TangentCone.Basic
/-!
# Indexed product of sets with unique differentiability property
In this file we prove that the indexed product
of a family sets with unique differentiability property
has the same property, see `UniqueDiffOn.pi` and `UniqueDiffOn.univ_pi`.
-/
open Filter Set
open scoped Topology
variable {š : Type*} [NontriviallyNormedField š]
{ι : Type*} {E : ι ā Type*} [ā i, NormedAddCommGroup (E i)] [ā i, NormedSpace š (E i)]
{s : ā i, Set (E i)} {x : ā i, E i}
/-- The tangent cone of a product contains the tangent cone of each factor. -/
theorem mapsTo_tangentConeAt_pi [DecidableEq ι] {i : ι} (hi : ā j ā i, x j ā closure (s j)) :
MapsTo (LinearMap.single š E i) (tangentConeAt š (s i) (x i))
(tangentConeAt š (Set.pi univ s) x) := by
rintro w āØc, d, hd, hc, hyā©
have : ā n, ā j ā i, ā d', x j + d' ā s j ā§ āc n ⢠d'ā < (1 / 2 : ā) ^ n := fun n j hj ⦠by
rcases mem_closure_iff_nhds.1 (hi j hj) _
(eventually_nhds_norm_smul_sub_lt (c n) (x j) (pow_pos one_half_pos n)) with
āØz, hz, hzsā©
exact āØz - x j, by simpa using hzs, by simpa using hzā©
choose! d' hd's hcd' using this
refine āØc, fun n => Function.update (d' n) i (d n), hd.mono fun n hn j _ => ?_, hc,
tendsto_pi_nhds.2 fun j => ?_ā©
Ā· rcases em (j = i) with (rfl | hj) <;> simp [*]
Ā· rcases em (j = i) with (rfl | hj)
Ā· simp [hy]
Ā· suffices Tendsto (fun n => c n ⢠d' n j) atTop (š 0) by simpa [hj]
refine squeeze_zero_norm (fun n => (hcd' n j hj).le) ?_
exact tendsto_pow_atTop_nhds_zero_of_lt_one one_half_pos.le one_half_lt_one
@[deprecated (since := "2025-04-27")] alias mapsTo_tangentCone_pi := mapsTo_tangentConeAt_pi
variable (ι E)
variable [Finite ι]
theorem UniqueDiffWithinAt.univ_pi (s : ā i, Set (E i)) (x : ā i, E i)
(h : ā i, UniqueDiffWithinAt š (s i) (x i)) : UniqueDiffWithinAt š (Set.pi univ s) x := by
classical
simp only [uniqueDiffWithinAt_iff, closure_pi_set] at h ā¢
refine āØ(dense_pi univ fun i _ => (h i).1).mono ?_, fun i _ => (h i).2ā©
norm_cast
simp only [ā Submodule.iSup_map_single, iSup_le_iff, LinearMap.map_span, Submodule.span_le,
ā mapsTo_iff_image_subset]
exact fun i => (mapsTo_tangentConeAt_pi fun j _ => (h j).2).mono Subset.rfl Submodule.subset_span
theorem UniqueDiffWithinAt.pi (s : ā i, Set (E i)) (x : ā i, E i)
(I : Set ι) (h : ā i ā I, UniqueDiffWithinAt š (s i) (x i)) :
UniqueDiffWithinAt š (Set.pi I s) x := by
classical
rw [ā Set.univ_pi_piecewise_univ]
refine UniqueDiffWithinAt.univ_pi ι E _ _ fun i => ?_
by_cases hi : i ā I <;> simp [*, uniqueDiffWithinAt_univ]
/-- The finite product of a family of sets of unique differentiability is a set of unique
differentiability. -/
theorem UniqueDiffOn.pi (s : ā i, Set (E i)) (I : Set ι)
(h : ā i ā I, UniqueDiffOn š (s i)) : UniqueDiffOn š (Set.pi I s) :=
fun x hx => UniqueDiffWithinAt.pi _ _ _ _ _ fun i hi => h i hi (x i) (hx i hi)
/-- The finite product of a family of sets of unique differentiability is a set of unique
differentiability. -/
theorem UniqueDiffOn.univ_pi (s : ā i, Set (E i)) (h : ā i, UniqueDiffOn š (s i)) :
UniqueDiffOn š (Set.pi univ s) :=
UniqueDiffOn.pi _ _ _ _ fun i _ => h i |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/TangentCone/Basic.lean | import Mathlib.Analysis.Calculus.TangentCone.Defs
import Mathlib.Analysis.SpecificLimits.Basic
import Mathlib.Analysis.Normed.Module.Basic
/-!
# Basic properties of tangent cones and sets with unique differentiability property
In this file we prove basic lemmas about `tangentConeAt`, `UniqueDiffWithinAt`,
and `UniqueDiffOn`.
-/
open Filter Set Metric NormedField
open scoped Topology Pointwise
variable {š : Type*} [NontriviallyNormedField š]
variable {E F G : Type*}
section TVS
variable [AddCommGroup E] [Module š E] [TopologicalSpace E]
variable {x y : E} {s t : Set E}
theorem mem_tangentConeAt_of_pow_smul {r : š} (hrā : r ā 0) (hr : ārā < 1)
(hs : āį¶ n : ā in atTop, x + r ^ n ⢠y ā s) : y ā tangentConeAt š s x := by
refine āØfun n ⦠(r ^ n)ā»Ā¹, fun n ⦠r ^ n ⢠y, hs, ?_, ?_ā©
Ā· simp only [norm_inv, norm_pow, ā inv_pow]
exact tendsto_pow_atTop_atTop_of_one_lt <| (one_lt_invā (norm_pos_iff.2 hrā)).2 hr
Ā· simp only [inv_smul_smulā (pow_ne_zero _ hrā), tendsto_const_nhds]
@[simp]
theorem tangentConeAt_univ : tangentConeAt š univ x = univ :=
let āØ_r, hrā, hrā© := exists_norm_lt_one š
eq_univ_of_forall fun _ ⦠mem_tangentConeAt_of_pow_smul (norm_pos_iff.1 hrā) hr <|
Eventually.of_forall fun _ ⦠mem_univ _
@[deprecated (since := "2025-04-27")] alias tangentCone_univ := tangentConeAt_univ
@[gcongr]
theorem tangentConeAt_mono (h : s ā t) : tangentConeAt š s x ā tangentConeAt š t x := by
rintro y āØc, d, ds, ctop, climā©
exact āØc, d, mem_of_superset ds fun n hn => h hn, ctop, climā©
@[deprecated (since := "2025-04-27")] alias tangentCone_mono := tangentConeAt_mono
/--
Given `x ā s` and a field extension `š ā š'`, the tangent cone of `s` at `x` with
respect to `š` is contained in the tangent cone of `s` at `x` with respect to `š'`.
-/
theorem tangentConeAt_mono_field {š' : Type*} [NontriviallyNormedField š'] [NormedAlgebra š š']
[Module š' E] [IsScalarTower š š' E] : tangentConeAt š s x ā tangentConeAt š' s x := by
intro α hα
simp only [tangentConeAt, eventually_atTop, ge_iff_le, tendsto_norm_atTop_iff_cobounded,
mem_setOf_eq] at hα ā¢
obtain āØc, d, āØa, hāaā©, hā, hāā© := hα
use ((algebraMap š š') ā c), d
constructor
Ā· use a
Ā· constructor
· intro β hβ
rw [mem_map, mem_atTop_sets]
obtain āØn, hnā© := mem_atTop_sets.1
(mem_map.1 (hā (tendsto_algebraMap_cobounded (š := š) (š' := š') hβ)))
use n, fun _ _ ⦠by simp_all
Ā· simpa
variable [ContinuousSMul š E]
/-- Auxiliary lemma ensuring that, under the assumptions defining the tangent cone,
the sequence `d` tends to 0 at infinity. -/
theorem tangentConeAt.lim_zero {α : Type*} (l : Filter α) {c : α ā š} {d : α ā E}
(hc : Tendsto (fun n => āc nā) l atTop) (hd : Tendsto (fun n => c n ⢠d n) l (š y)) :
Tendsto d l (š 0) := by
have : āį¶ n in l, (c n)ā»Ā¹ ⢠c n ⢠d n = d n :=
(eventually_ne_of_tendsto_norm_atTop hc 0).mono fun n hn ⦠inv_smul_smulā hn (d n)
rw [tendsto_norm_atTop_iff_cobounded] at hc
simpa using Tendsto.congr' this <| (tendsto_invā_cobounded.comp hc).smul hd
variable [ContinuousAdd E]
theorem tangentConeAt_mono_nhds (h : š[s] x ⤠š[t] x) :
tangentConeAt š s x ā tangentConeAt š t x := by
rintro y āØc, d, ds, ctop, climā©
refine āØc, d, ?_, ctop, climā©
suffices Tendsto (fun n => x + d n) atTop (š[t] x) from
tendsto_principal.1 (tendsto_inf.1 this).2
refine (tendsto_inf.2 āØ?_, tendsto_principal.2 dsā©).mono_right h
simpa only [add_zero] using tendsto_const_nhds.add (tangentConeAt.lim_zero atTop ctop clim)
@[deprecated (since := "2025-04-27")] alias tangentCone_mono_nhds := tangentConeAt_mono_nhds
/-- Tangent cone of `s` at `x` depends only on `š[s] x`. -/
theorem tangentConeAt_congr (h : š[s] x = š[t] x) : tangentConeAt š s x = tangentConeAt š t x :=
Subset.antisymm (tangentConeAt_mono_nhds h.le) (tangentConeAt_mono_nhds h.ge)
@[deprecated (since := "2025-04-27")] alias tangentCone_congr := tangentConeAt_congr
/-- Intersecting with a neighborhood of the point does not change the tangent cone. -/
theorem tangentConeAt_inter_nhds (ht : t ā š x) : tangentConeAt š (s ā© t) x = tangentConeAt š s x :=
tangentConeAt_congr (nhdsWithin_restrict' _ ht).symm
@[deprecated (since := "2025-04-27")] alias tangentCone_inter_nhds := tangentConeAt_inter_nhds
end TVS
section Normed
variable [NormedAddCommGroup E] [NormedSpace š E]
variable [NormedAddCommGroup F] [NormedSpace š F]
variable {x y : E} {s t : Set E}
@[simp]
theorem tangentConeAt_closure : tangentConeAt š (closure s) x = tangentConeAt š s x := by
refine Subset.antisymm ?_ (tangentConeAt_mono subset_closure)
rintro y āØc, d, ds, ctop, climā©
obtain āØu, -, u_pos, u_limā© :
ā u, StrictAnti u ā§ (ā (n : ā), 0 < u n) ā§ Tendsto u atTop (š (0 : ā)) :=
exists_seq_strictAnti_tendsto (0 : ā)
have : āį¶ n in atTop, ā d', x + d' ā s ā§ dist (c n ⢠d n) (c n ⢠d') < u n := by
filter_upwards [ctop.eventually_gt_atTop 0, ds] with n hn hns
rcases Metric.mem_closure_iff.mp hns (u n / āc nā) (div_pos (u_pos n) hn) with āØy, hys, hyā©
refine āØy - x, by simpa, ?_ā©
rwa [dist_smulā, ā dist_add_left x, add_sub_cancel, ā lt_div_iffā' hn]
simp only [Filter.skolem, eventually_and] at this
rcases this with āØd', hd's, hd'ā©
exact āØc, d', hd's, ctop, clim.congr_dist
(squeeze_zero' (.of_forall fun _ ⦠dist_nonneg) (hd'.mono fun _ ⦠le_of_lt) u_lim)ā©
/-- The tangent cone at a non-isolated point contains `0`. -/
theorem zero_mem_tangentCone {s : Set E} {x : E} (hx : x ā closure s) :
0 ā tangentConeAt š s x := by
/- Take a sequence `d n` tending to `0` such that `x + d n ā s`. Taking `c n` of the order
of `1 / (d n) ^ (1/2)`, then `c n` tends to infinity, but `c n ⢠d n` tends to `0`. By definition,
this shows that `0` belongs to the tangent cone. -/
obtain āØu, -, hu, u_limā© :
ā u, StrictAnti u ā§ (ā (n : ā), 0 < u n ā§ u n < 1) ā§ Tendsto u atTop (š (0 : ā)) :=
exists_seq_strictAnti_tendsto' one_pos
choose u_pos u_lt_one using hu
choose v hvs hvu using fun n ⦠Metric.mem_closure_iff.mp hx _ (mul_pos (u_pos n) (u_pos n))
let d n := v n - x
let āØr, hrā© := exists_one_lt_norm š
have A n := exists_nat_pow_near (one_le_inv_iffā.mpr āØu_pos n, (u_lt_one n).leā©) hr
choose m hm_le hlt_m using A
set c := fun n ⦠r ^ (m n + 1)
have c_lim : Tendsto (fun n ⦠āc nā) atTop atTop := by
simp only [c, norm_pow]
refine tendsto_atTop_mono (fun n ⦠(hlt_m n).le) <| .inv_tendsto_nhdsGT_zero ?_
exact tendsto_nhdsWithin_iff.mpr āØu_lim, .of_forall u_posā©
refine āØc, d, .of_forall <| by simpa [d], c_lim, ?_ā©
have Hle n : āc n ⢠d nā ⤠ārā * u n := by
specialize u_pos n
calc
āc n ⢠d nā ⤠(u n)ā»Ā¹ * ārā * (u n * u n) := by
simp only [c, norm_smul, norm_pow, pow_succ, norm_mul, d, ā dist_eq_norm']
gcongr
exacts [hm_le n, (hvu n).le]
_ = ārā * u n := by field
refine squeeze_zero_norm Hle ?_
simpa using tendsto_const_nhds.mul u_lim
/-- If `x` is not an accumulation point of `s`, then the tangent cone of `s` at `x`
is a subset of `{0}`. -/
theorem tangentConeAt_subset_zero (hx : ¬AccPt x (š s)) : tangentConeAt š s x ā 0 := by
rintro y āØc, d, hds, hc, hcdā©
suffices āį¶ n in .atTop, d n = 0 from
tendsto_nhds_unique hcd <| tendsto_const_nhds.congr' <| this.mono fun n hn ⦠by simp [hn]
simp only [accPt_iff_frequently, not_frequently, not_and', ne_eq, not_not] at hx
have : Tendsto (x + d Ā·) atTop (š x) := by
simpa using tendsto_const_nhds.add (tangentConeAt.lim_zero _ hc hcd)
filter_upwards [this.eventually hx, hds] with n hā hā
simpa using hā hā
theorem UniqueDiffWithinAt.accPt [Nontrivial E] (h : UniqueDiffWithinAt š s x) : AccPt x (š s) := by
by_contra! h'
have : Dense (Submodule.span š (0 : Set E) : Set E) :=
h.1.mono <| by gcongr; exact tangentConeAt_subset_zero h'
simp [dense_iff_closure_eq] at this
end Normed
section UniqueDiff
/-!
### Properties of `UniqueDiffWithinAt` and `UniqueDiffOn`
This section is devoted to properties of the predicates `UniqueDiffWithinAt` and `UniqueDiffOn`. -/
section Module
variable [AddCommGroup E] [Module š E] [TopologicalSpace E]
variable {x y : E} {s t : Set E}
theorem UniqueDiffOn.uniqueDiffWithinAt {s : Set E} {x} (hs : UniqueDiffOn š s) (h : x ā s) :
UniqueDiffWithinAt š s x :=
hs x h
@[simp]
theorem uniqueDiffWithinAt_univ : UniqueDiffWithinAt š univ x := by
rw [uniqueDiffWithinAt_iff, tangentConeAt_univ]
simp
@[simp]
theorem uniqueDiffOn_univ : UniqueDiffOn š (univ : Set E) :=
fun _ _ => uniqueDiffWithinAt_univ
theorem uniqueDiffOn_empty : UniqueDiffOn š (ā
: Set E) :=
fun _ hx => hx.elim
theorem UniqueDiffWithinAt.congr_pt (h : UniqueDiffWithinAt š s x) (hy : x = y) :
UniqueDiffWithinAt š s y := hy āø h
variable {š' : Type*} [NontriviallyNormedField š'] [NormedAlgebra š š']
[Module š' E] [IsScalarTower š š' E]
/--
Assume that `E` is a normed vector space over normed fields `š ā š'` and that `x ā s` is a point
of unique differentiability with respect to the set `s` and the smaller field `š`, then `x` is also
a point of unique differentiability with respect to the set `s` and the larger field `š'`.
-/
theorem UniqueDiffWithinAt.mono_field (hās : UniqueDiffWithinAt š s x) :
UniqueDiffWithinAt š' s x := by
simp_all only [uniqueDiffWithinAt_iff, and_true]
apply Dense.mono _ hās.1
trans ā(Submodule.span š (tangentConeAt š' s x))
<;> simp [Submodule.span_mono tangentConeAt_mono_field]
/--
Assume that `E` is a normed vector space over normed fields `š ā š'` and all points of `s` are
points of unique differentiability with respect to the smaller field `š`, then they are also points
of unique differentiability with respect to the larger field `š`.
-/
theorem UniqueDiffOn.mono_field (hās : UniqueDiffOn š s) :
UniqueDiffOn š' s := fun x hx ⦠(hās x hx).mono_field
end Module
section TVS
variable [AddCommGroup E] [Module š E] [TopologicalSpace E]
variable {x y : E} {s t : Set E}
variable [ContinuousAdd E] [ContinuousSMul š E]
theorem UniqueDiffWithinAt.mono_nhds (h : UniqueDiffWithinAt š s x) (st : š[s] x ⤠š[t] x) :
UniqueDiffWithinAt š t x := by
simp only [uniqueDiffWithinAt_iff] at *
rw [mem_closure_iff_nhdsWithin_neBot] at h ā¢
exact āØh.1.mono <| Submodule.span_mono <| tangentConeAt_mono_nhds st, h.2.mono stā©
theorem UniqueDiffWithinAt.mono (h : UniqueDiffWithinAt š s x) (st : s ā t) :
UniqueDiffWithinAt š t x :=
h.mono_nhds <| nhdsWithin_mono _ st
theorem uniqueDiffWithinAt_congr (st : š[s] x = š[t] x) :
UniqueDiffWithinAt š s x ā UniqueDiffWithinAt š t x :=
āØfun h => h.mono_nhds <| le_of_eq st, fun h => h.mono_nhds <| le_of_eq st.symmā©
theorem uniqueDiffWithinAt_inter (ht : t ā š x) :
UniqueDiffWithinAt š (s ā© t) x ā UniqueDiffWithinAt š s x :=
uniqueDiffWithinAt_congr <| (nhdsWithin_restrict' _ ht).symm
theorem UniqueDiffWithinAt.inter (hs : UniqueDiffWithinAt š s x) (ht : t ā š x) :
UniqueDiffWithinAt š (s ā© t) x :=
(uniqueDiffWithinAt_inter ht).2 hs
theorem uniqueDiffWithinAt_inter' (ht : t ā š[s] x) :
UniqueDiffWithinAt š (s ā© t) x ā UniqueDiffWithinAt š s x :=
uniqueDiffWithinAt_congr <| (nhdsWithin_restrict'' _ ht).symm
theorem UniqueDiffWithinAt.inter' (hs : UniqueDiffWithinAt š s x) (ht : t ā š[s] x) :
UniqueDiffWithinAt š (s ā© t) x :=
(uniqueDiffWithinAt_inter' ht).2 hs
theorem uniqueDiffWithinAt_of_mem_nhds (h : s ā š x) : UniqueDiffWithinAt š s x := by
simpa only [univ_inter] using uniqueDiffWithinAt_univ.inter h
theorem IsOpen.uniqueDiffWithinAt (hs : IsOpen s) (xs : x ā s) : UniqueDiffWithinAt š s x :=
uniqueDiffWithinAt_of_mem_nhds (IsOpen.mem_nhds hs xs)
theorem UniqueDiffOn.inter (hs : UniqueDiffOn š s) (ht : IsOpen t) : UniqueDiffOn š (s ā© t) :=
fun x hx => (hs x hx.1).inter (IsOpen.mem_nhds ht hx.2)
theorem IsOpen.uniqueDiffOn (hs : IsOpen s) : UniqueDiffOn š s :=
fun _ hx => IsOpen.uniqueDiffWithinAt hs hx
end TVS
section Normed
variable [NormedAddCommGroup E] [NormedSpace š E]
variable [NormedAddCommGroup F] [NormedSpace š F]
variable {x y : E} {s t : Set E}
@[simp]
theorem uniqueDiffWithinAt_closure :
UniqueDiffWithinAt š (closure s) x ā UniqueDiffWithinAt š s x := by
simp [uniqueDiffWithinAt_iff]
protected alias āØUniqueDiffWithinAt.of_closure, UniqueDiffWithinAt.closureā© :=
uniqueDiffWithinAt_closure
theorem UniqueDiffWithinAt.mono_closure (h : UniqueDiffWithinAt š s x) (st : s ā closure t) :
UniqueDiffWithinAt š t x :=
(h.mono st).of_closure
end Normed
end UniqueDiff |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/TangentCone/Defs.lean | import Mathlib.Analysis.Normed.Field.Basic
/-!
# Tangent cone
In this file, we define two predicates `UniqueDiffWithinAt š s x` and `UniqueDiffOn š s`
ensuring that, if a function has two derivatives, then they have to coincide. As a direct
definition of this fact (quantifying on all target types and all functions) would depend on
universes, we use a more intrinsic definition: if all the possible tangent directions to the set
`s` at the point `x` span a dense subset of the whole subset, it is easy to check that the
derivative has to be unique.
Therefore, we introduce the set of all tangent directions, named `tangentConeAt`,
and express `UniqueDiffWithinAt` and `UniqueDiffOn` in terms of it.
One should however think of this definition as an implementation detail: the only reason to
introduce the predicates `UniqueDiffWithinAt` and `UniqueDiffOn` is to ensure the uniqueness
of the derivative. This is why their names reflect their uses, and not how they are defined.
## Implementation details
Note that this file is imported by `Mathlib/Analysis/Calculus/FDeriv/Basic.lean`. Hence, derivatives
are not defined yet. The property of uniqueness of the derivative is therefore proved in
`Mathlib/Analysis/Calculus/FDeriv/Basic.lean`, but based on the properties of the tangent cone we
prove here.
-/
open Filter Set Metric
open scoped Topology Pointwise
variable (š : Type*) [NontriviallyNormedField š]
variable {E : Type*} [AddCommMonoid E] [Module š E] [TopologicalSpace E]
/-- The set of all tangent directions to the set `s` at the point `x`. -/
def tangentConeAt (s : Set E) (x : E) : Set E :=
{ y : E | ā (c : ā ā š) (d : ā ā E),
(āį¶ n in atTop, x + d n ā s) ā§
Tendsto (fun n => āc nā) atTop atTop ā§
Tendsto (fun n => c n ⢠d n) atTop (š y) }
/-- A property ensuring that the tangent cone to `s` at `x` spans a dense subset of the whole space.
The main role of this property is to ensure that the differential within `s` at `x` is unique,
hence this name. The uniqueness it asserts is proved in `UniqueDiffWithinAt.eq` in
`Mathlib/Analysis/Calculus/FDeriv/Basic.lean`.
To avoid pathologies in dimension 0, we also require that `x` belongs to the closure of `s` (which
is automatic when `E` is not `0`-dimensional). -/
@[mk_iff]
structure UniqueDiffWithinAt (s : Set E) (x : E) : Prop where
dense_tangentConeAt : Dense (Submodule.span š (tangentConeAt š s x) : Set E)
mem_closure : x ā closure s
@[deprecated (since := "2025-04-27")]
alias UniqueDiffWithinAt.dense_tangentCone := UniqueDiffWithinAt.dense_tangentConeAt
/-- A property ensuring that the tangent cone to `s` at any of its points spans a dense subset of
the whole space. The main role of this property is to ensure that the differential along `s` is
unique, hence this name. The uniqueness it asserts is proved in `UniqueDiffOn.eq` in
`Mathlib/Analysis/Calculus/FDeriv/Basic.lean`. -/
def UniqueDiffOn (s : Set E) : Prop :=
ā x ā s, UniqueDiffWithinAt š s x |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/TangentCone/DimOne.lean | import Mathlib.Analysis.Calculus.TangentCone.Basic
/-!
# Unique differentiability property of a set in the base field
In this file we prove that a set in the base field has the unique differentiability property at `x`
iff `x` is an accumulation point of the set, see `uniqueDiffWithinAt_iff_accPt`.
-/
open Filter Metric Set
open scoped Topology
variable {š : Type*} [NontriviallyNormedField š]
/-- The tangent cone at a non-isolated point in dimension 1 is the whole space. -/
theorem tangentConeAt_eq_univ {s : Set š} {x : š} (hx : AccPt x (š s)) :
tangentConeAt š s x = univ := by
apply eq_univ_iff_forall.2 (fun y ⦠?_)
-- first deal with the case of `0`, which has to be handled separately.
rcases eq_or_ne y 0 with rfl | hy
Ā· exact zero_mem_tangentCone (mem_closure_iff_clusterPt.mpr hx.clusterPt)
/- Assume now `y` is a fixed nonzero scalar. Take a sequence `d n` tending to `0` such
that `x + d n ā s`. Let `c n = y / d n`. Then `āc nā` tends to infinity, and `c n ⢠d n`
converges to `y` (as it is equal to `y`). By definition, this shows that `y` belongs to the
tangent cone. -/
obtain āØu, -, u_pos, u_limā© :
ā u, StrictAnti u ā§ (ā (n : ā), 0 < u n) ā§ Tendsto u atTop (š (0 : ā)) :=
exists_seq_strictAnti_tendsto (0 : ā)
have A n : ā y ā closedBall x (u n) ā© s, y ā x :=
accPt_iff_nhds.mp hx _ (closedBall_mem_nhds _ (u_pos n))
choose v hv hvx using A
choose hvu hvs using hv
let d := fun n ⦠v n - x
have d_ne n : d n ā 0 := by simpa [d, sub_eq_zero] using hvx n
refine āØfun n ⦠y * (d n)ā»Ā¹, d, .of_forall ?_, ?_, ?_ā©
Ā· simpa [d] using hvs
Ā· simp only [norm_mul, norm_inv]
apply (tendsto_const_mul_atTop_of_pos (by simpa using hy)).2
apply tendsto_inv_nhdsGT_zero.comp
simp only [nhdsWithin, tendsto_inf, tendsto_principal, mem_Ioi, norm_pos_iff, ne_eq,
eventually_atTop, ge_iff_le]
have B (n : ā) : ād nā ⤠u n := by simpa [dist_eq_norm] using hvu n
refine āØ?_, 0, fun n hn ⦠by simpa using d_ne nā©
exact squeeze_zero (fun n ⦠by positivity) B u_lim
Ā· convert tendsto_const_nhds (α := ā) (x := y) with n
simp [mul_assoc, inv_mul_cancelā (d_ne n)]
@[deprecated (since := "2025-04-27")] alias tangentCone_eq_univ := tangentConeAt_eq_univ
/-- In one dimension, a point is a point of unique differentiability of a set
iff it is an accumulation point of the set. -/
theorem uniqueDiffWithinAt_iff_accPt {s : Set š} {x : š} :
UniqueDiffWithinAt š s x ā AccPt x (š s) :=
āØUniqueDiffWithinAt.accPt, fun h ā¦
āØby simp [tangentConeAt_eq_univ h], mem_closure_iff_clusterPt.mpr h.clusterPtā©ā©
alias āØ_, AccPt.uniqueDiffWithinAtā© := uniqueDiffWithinAt_iff_accPt |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/TangentCone/Real.lean | import Mathlib.Analysis.Calculus.TangentCone.Basic
import Mathlib.Analysis.Convex.Topology
/-!
# Unique differentiability property in real normed spaces
In this file we prove that
- `uniqueDiffOn_convex`: a convex set with nonempty interior in a real normed space
has the unique differentiability property;
- `uniqueDiffOn_Ioc` etc: intervals on the real line have the unique differentiability property.
-/
open Filter Set
open scoped Topology
section RealNormed
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ā E]
/-- If a subset of a real vector space contains an open segment, then the direction of this
segment belongs to the tangent cone at its endpoints. -/
theorem mem_tangentConeAt_of_openSegment_subset {s : Set E} {x y : E} (h : openSegment ā x y ā s) :
y - x ā tangentConeAt ā s x := by
refine mem_tangentConeAt_of_pow_smul one_half_pos.ne' (by norm_num) ?_
refine (eventually_ne_atTop 0).mono fun n hn ⦠(h ?_)
rw [openSegment_eq_image]
refine āØ(1 / 2) ^ n, āØ?_, ?_ā©, ?_ā©
Ā· exact pow_pos one_half_pos _
Ā· exact pow_lt_oneā one_half_pos.le one_half_lt_one hn
Ā· simp only [sub_smul, one_smul, smul_sub]; abel
@[deprecated (since := "2025-04-27")]
alias mem_tangentCone_of_openSegment_subset := mem_tangentConeAt_of_openSegment_subset
/-- If a subset of a real vector space contains a segment, then the direction of this
segment belongs to the tangent cone at its endpoints. -/
theorem mem_tangentConeAt_of_segment_subset {s : Set E} {x y : E} (h : segment ā x y ā s) :
y - x ā tangentConeAt ā s x :=
mem_tangentConeAt_of_openSegment_subset ((openSegment_subset_segment ā x y).trans h)
@[deprecated (since := "2025-04-27")]
alias mem_tangentCone_of_segment_subset := mem_tangentConeAt_of_segment_subset
theorem Convex.span_tangentConeAt {s : Set E} (conv : Convex ā s) (hs : (interior s).Nonempty)
{x : E} (hx : x ā closure s) : Submodule.span ā (tangentConeAt ā s x) = ⤠:= by
rcases hs with āØy, hyā©
suffices y - x ā interior (tangentConeAt ā s x) by
apply (Submodule.span ā (tangentConeAt ā s x)).eq_top_of_nonempty_interior'
exact āØy - x, interior_mono Submodule.subset_span thisā©
rw [mem_interior_iff_mem_nhds]
replace hy : interior s ā š y := IsOpen.mem_nhds isOpen_interior hy
apply mem_of_superset ((isOpenMap_sub_right x).image_mem_nhds hy)
rintro _ āØz, zs, rflā©
refine mem_tangentConeAt_of_openSegment_subset (Subset.trans ?_ interior_subset)
exact conv.openSegment_closure_interior_subset_interior hx zs
/-- In a real vector space, a convex set with nonempty interior is a set of unique
differentiability at every point of its closure. -/
theorem uniqueDiffWithinAt_convex {s : Set E} (conv : Convex ā s) (hs : (interior s).Nonempty)
{x : E} (hx : x ā closure s) : UniqueDiffWithinAt ā s x := by
simp [uniqueDiffWithinAt_iff, conv.span_tangentConeAt hs hx, hx]
/-- In a real vector space, a convex set with nonempty interior is a set of unique
differentiability. -/
theorem uniqueDiffOn_convex {s : Set E} (conv : Convex ā s) (hs : (interior s).Nonempty) :
UniqueDiffOn ā s :=
fun _ xs => uniqueDiffWithinAt_convex conv hs (subset_closure xs)
end RealNormed
section Real
theorem uniqueDiffOn_Ici (a : ā) : UniqueDiffOn ā (Ici a) :=
uniqueDiffOn_convex (convex_Ici a) <| by simp only [interior_Ici, nonempty_Ioi]
theorem uniqueDiffOn_Iic (a : ā) : UniqueDiffOn ā (Iic a) :=
uniqueDiffOn_convex (convex_Iic a) <| by simp only [interior_Iic, nonempty_Iio]
theorem uniqueDiffOn_Ioi (a : ā) : UniqueDiffOn ā (Ioi a) :=
isOpen_Ioi.uniqueDiffOn
theorem uniqueDiffOn_Iio (a : ā) : UniqueDiffOn ā (Iio a) :=
isOpen_Iio.uniqueDiffOn
theorem uniqueDiffOn_Icc {a b : ā} (hab : a < b) : UniqueDiffOn ā (Icc a b) :=
uniqueDiffOn_convex (convex_Icc a b) <| by simp only [interior_Icc, nonempty_Ioo, hab]
theorem uniqueDiffOn_Ico (a b : ā) : UniqueDiffOn ā (Ico a b) :=
if hab : a < b then
uniqueDiffOn_convex (convex_Ico a b) <| by simp only [interior_Ico, nonempty_Ioo, hab]
else by simp only [Ico_eq_empty hab, uniqueDiffOn_empty]
theorem uniqueDiffOn_Ioc (a b : ā) : UniqueDiffOn ā (Ioc a b) :=
if hab : a < b then
uniqueDiffOn_convex (convex_Ioc a b) <| by simp only [interior_Ioc, nonempty_Ioo, hab]
else by simp only [Ioc_eq_empty hab, uniqueDiffOn_empty]
theorem uniqueDiffOn_Ioo (a b : ā) : UniqueDiffOn ā (Ioo a b) :=
isOpen_Ioo.uniqueDiffOn
/-- The real interval `[0, 1]` is a set of unique differentiability. -/
theorem uniqueDiffOn_Icc_zero_one : UniqueDiffOn ā (Icc (0 : ā) 1) :=
uniqueDiffOn_Icc zero_lt_one
theorem uniqueDiffWithinAt_Ioo {a b t : ā} (ht : t ā Set.Ioo a b) :
UniqueDiffWithinAt ā (Set.Ioo a b) t :=
IsOpen.uniqueDiffWithinAt isOpen_Ioo ht
theorem uniqueDiffWithinAt_Ioi (a : ā) : UniqueDiffWithinAt ā (Ioi a) a :=
uniqueDiffWithinAt_convex (convex_Ioi a) (by simp) (by simp)
theorem uniqueDiffWithinAt_Iio (a : ā) : UniqueDiffWithinAt ā (Iio a) a :=
uniqueDiffWithinAt_convex (convex_Iio a) (by simp) (by simp)
theorem uniqueDiffWithinAt_Ici (x : ā) : UniqueDiffWithinAt ā (Ici x) x :=
(uniqueDiffWithinAt_Ioi x).mono Set.Ioi_subset_Ici_self
theorem uniqueDiffWithinAt_Iic (x : ā) : UniqueDiffWithinAt ā (Iic x) x :=
(uniqueDiffWithinAt_Iio x).mono Set.Iio_subset_Iic_self
end Real |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/LocalExtr/LineDeriv.lean | import Mathlib.Analysis.Calculus.LocalExtr.Basic
import Mathlib.Analysis.Calculus.LineDeriv.Basic
/-!
# Local extremum and line derivatives
If `f` has a local extremum at a point, then the derivative at this point is zero.
In this file we prove several versions of this fact for line derivatives.
-/
open Function Set Filter
open scoped Topology
section Module
variable {E : Type*} [AddCommGroup E] [Module ā E] {f : E ā ā} {s : Set E} {a b : E} {f' : ā}
theorem IsExtrFilter.hasLineDerivAt_eq_zero {l : Filter E} (h : IsExtrFilter f l a)
(hd : HasLineDerivAt ā f f' a b) (h' : Tendsto (fun t : ā ⦠a + t ⢠b) (š 0) l) : f' = 0 :=
IsLocalExtr.hasDerivAt_eq_zero (IsExtrFilter.comp_tendsto (by simpa using h) h') hd
theorem IsExtrFilter.lineDeriv_eq_zero {l : Filter E} (h : IsExtrFilter f l a)
(h' : Tendsto (fun t : ā ⦠a + t ⢠b) (š 0) l) : lineDeriv ā f a b = 0 := by
classical
exact if hd : LineDifferentiableAt ā f a b then
h.hasLineDerivAt_eq_zero hd.hasLineDerivAt h'
else
lineDeriv_zero_of_not_lineDifferentiableAt hd
theorem IsExtrOn.hasLineDerivAt_eq_zero (h : IsExtrOn f s a) (hd : HasLineDerivAt ā f f' a b)
(h' : āį¶ t : ā in š 0, a + t ⢠b ā s) : f' = 0 :=
IsExtrFilter.hasLineDerivAt_eq_zero h hd <| tendsto_principal.2 h'
theorem IsExtrOn.lineDeriv_eq_zero (h : IsExtrOn f s a) (h' : āį¶ t : ā in š 0, a + t ⢠b ā s) :
lineDeriv ā f a b = 0 :=
IsExtrFilter.lineDeriv_eq_zero h <| tendsto_principal.2 h'
theorem IsMinOn.hasLineDerivAt_eq_zero (h : IsMinOn f s a) (hd : HasLineDerivAt ā f f' a b)
(h' : āį¶ t : ā in š 0, a + t ⢠b ā s) : f' = 0 :=
h.isExtr.hasLineDerivAt_eq_zero hd h'
theorem IsMinOn.lineDeriv_eq_zero (h : IsMinOn f s a) (h' : āį¶ t : ā in š 0, a + t ⢠b ā s) :
lineDeriv ā f a b = 0 :=
h.isExtr.lineDeriv_eq_zero h'
theorem IsMaxOn.hasLineDerivAt_eq_zero (h : IsMaxOn f s a) (hd : HasLineDerivAt ā f f' a b)
(h' : āį¶ t : ā in š 0, a + t ⢠b ā s) : f' = 0 :=
h.isExtr.hasLineDerivAt_eq_zero hd h'
theorem IsMaxOn.lineDeriv_eq_zero (h : IsMaxOn f s a) (h' : āį¶ t : ā in š 0, a + t ⢠b ā s) :
lineDeriv ā f a b = 0 :=
h.isExtr.lineDeriv_eq_zero h'
theorem IsExtrOn.hasLineDerivWithinAt_eq_zero (h : IsExtrOn f s a)
(hd : HasLineDerivWithinAt ā f f' s a b) (h' : āį¶ t : ā in š 0, a + t ⢠b ā s) : f' = 0 :=
h.hasLineDerivAt_eq_zero (hd.hasLineDerivAt' h') h'
theorem IsExtrOn.lineDerivWithin_eq_zero (h : IsExtrOn f s a)
(h' : āį¶ t : ā in š 0, a + t ⢠b ā s) : lineDerivWithin ā f s a b = 0 := by
classical
exact if hd : LineDifferentiableWithinAt ā f s a b then
h.hasLineDerivWithinAt_eq_zero hd.hasLineDerivWithinAt h'
else
lineDerivWithin_zero_of_not_lineDifferentiableWithinAt hd
theorem IsMinOn.hasLineDerivWithinAt_eq_zero (h : IsMinOn f s a)
(hd : HasLineDerivWithinAt ā f f' s a b) (h' : āį¶ t : ā in š 0, a + t ⢠b ā s) : f' = 0 :=
h.isExtr.hasLineDerivWithinAt_eq_zero hd h'
theorem IsMinOn.lineDerivWithin_eq_zero (h : IsMinOn f s a)
(h' : āį¶ t : ā in š 0, a + t ⢠b ā s) : lineDerivWithin ā f s a b = 0 :=
h.isExtr.lineDerivWithin_eq_zero h'
theorem IsMaxOn.hasLineDerivWithinAt_eq_zero (h : IsMaxOn f s a)
(hd : HasLineDerivWithinAt ā f f' s a b) (h' : āį¶ t : ā in š 0, a + t ⢠b ā s) : f' = 0 :=
h.isExtr.hasLineDerivWithinAt_eq_zero hd h'
theorem IsMaxOn.lineDerivWithin_eq_zero (h : IsMaxOn f s a)
(h' : āį¶ t : ā in š 0, a + t ⢠b ā s) : lineDerivWithin ā f s a b = 0 :=
h.isExtr.lineDerivWithin_eq_zero h'
end Module
variable {E : Type*} [AddCommGroup E] [Module ā E]
[TopologicalSpace E] [ContinuousAdd E] [ContinuousSMul ā E]
{f : E ā ā} {s : Set E} {a b : E} {f' : ā}
theorem IsLocalExtr.hasLineDerivAt_eq_zero (h : IsLocalExtr f a) (hd : HasLineDerivAt ā f f' a b) :
f' = 0 :=
IsExtrFilter.hasLineDerivAt_eq_zero h hd <| Continuous.tendsto' (by fun_prop) _ _ (by simp)
theorem IsLocalExtr.lineDeriv_eq_zero (h : IsLocalExtr f a) : lineDeriv ā f a = 0 :=
funext fun b ⦠IsExtrFilter.lineDeriv_eq_zero h <| Continuous.tendsto' (by fun_prop) _ _ (by simp)
theorem IsLocalMin.hasLineDerivAt_eq_zero (h : IsLocalMin f a) (hd : HasLineDerivAt ā f f' a b) :
f' = 0 :=
IsLocalExtr.hasLineDerivAt_eq_zero (.inl h) hd
theorem IsLocalMin.lineDeriv_eq_zero (h : IsLocalMin f a) : lineDeriv ā f a = 0 :=
IsLocalExtr.lineDeriv_eq_zero (.inl h)
theorem IsLocalMax.hasLineDerivAt_eq_zero (h : IsLocalMax f a) (hd : HasLineDerivAt ā f f' a b) :
f' = 0 :=
IsLocalExtr.hasLineDerivAt_eq_zero (.inr h) hd
theorem IsLocalMax.lineDeriv_eq_zero (h : IsLocalMax f a) : lineDeriv ā f a = 0 :=
IsLocalExtr.lineDeriv_eq_zero (.inr h) |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/LocalExtr/Basic.lean | import Mathlib.Analysis.Calculus.Deriv.Add
/-!
# Local extrema of differentiable functions
## Main definitions
In a real normed space `E` we define `posTangentConeAt (s : Set E) (x : E)`.
This would be the same as `tangentConeAt āā„0 s x` if we had a theory of normed semifields.
This set is used in the proof of Fermat's Theorem (see below), and can be used to formalize
[Lagrange multipliers](https://en.wikipedia.org/wiki/Lagrange_multiplier) and/or
[KarushāKuhnāTucker conditions](https://en.wikipedia.org/wiki/KarushāKuhnāTucker_conditions).
## Main statements
For each theorem name listed below,
we also prove similar theorems for `min`, `extr` (if applicable),
and `fderiv`/`deriv` instead of `HasFDerivAt`/`HasDerivAt`.
* `IsLocalMaxOn.hasFDerivWithinAt_nonpos` : `f' y ⤠0` whenever `a` is a local maximum
of `f` on `s`, `f` has derivative `f'` at `a` within `s`, and `y` belongs to the positive tangent
cone of `s` at `a`.
* `IsLocalMaxOn.hasFDerivWithinAt_eq_zero` : In the settings of the previous theorem, if both
`y` and `-y` belong to the positive tangent cone, then `f' y = 0`.
* `IsLocalMax.hasFDerivAt_eq_zero` :
[Fermat's Theorem](https://en.wikipedia.org/wiki/Fermat's_theorem_(stationary_points)),
the derivative of a differentiable function at a local extremum point equals zero.
## Implementation notes
For each mathematical fact we prove several versions of its formalization:
* for maxima and minima;
* using `HasFDeriv*`/`HasDeriv*` or `fderiv*`/`deriv*`.
For the `fderiv*`/`deriv*` versions we omit the differentiability condition whenever it is possible
due to the fact that `fderiv` and `deriv` are defined to be zero for non-differentiable functions.
## References
* [Fermat's Theorem](https://en.wikipedia.org/wiki/Fermat's_theorem_(stationary_points));
* [Tangent cone](https://en.wikipedia.org/wiki/Tangent_cone);
## Tags
local extremum, tangent cone, Fermat's Theorem
-/
universe u v
open Filter Set
open scoped Topology Convex
section Module
variable {E : Type u} [NormedAddCommGroup E] [NormedSpace ā E]
{f : E ā ā} {f' : StrongDual ā E} {s : Set E} {a x y : E}
/-!
### Positive tangent cone
-/
/-- "Positive" tangent cone to `s` at `x`; the only difference from `tangentConeAt`
is that we require `c n ā ā` instead of `āc nā ā ā`. One can think about `posTangentConeAt`
as `tangentConeAt NNReal` but we have no theory of normed semifields yet. -/
def posTangentConeAt (s : Set E) (x : E) : Set E :=
{ y : E | ā (c : ā ā ā) (d : ā ā E), (āį¶ n in atTop, x + d n ā s) ā§
Tendsto c atTop atTop ā§ Tendsto (fun n => c n ⢠d n) atTop (š y) }
theorem posTangentConeAt_mono : Monotone fun s => posTangentConeAt s a := by
rintro s t hst y āØc, d, hd, hc, hcdā©
exact āØc, d, mem_of_superset hd fun h hn => hst hn, hc, hcdā©
theorem mem_posTangentConeAt_of_frequently_mem (h : āį¶ t : ā in š[>] 0, x + t ⢠y ā s) :
y ā posTangentConeAt s x := by
obtain āØa, ha, hasā© := Filter.exists_seq_forall_of_frequently h
refine āØaā»Ā¹, (a Ā· ⢠y), Eventually.of_forall has, tendsto_inv_nhdsGT_zero.comp ha, ?_ā©
refine tendsto_const_nhds.congr' ?_
filter_upwards [(tendsto_nhdsWithin_iff.1 ha).2] with n (hn : 0 < a n)
simp [ne_of_gt hn]
/-- If `[x -[ā] x + y] ā s`, then `y` belongs to the positive tangent cone of `s`.
Before 2024-07-13, this lemma used to be called `mem_posTangentConeAt_of_segment_subset`.
See also `sub_mem_posTangentConeAt_of_segment_subset`
for the lemma that used to be called `mem_posTangentConeAt_of_segment_subset`. -/
theorem mem_posTangentConeAt_of_segment_subset (h : [x -[ā] x + y] ā s) :
y ā posTangentConeAt s x := by
refine mem_posTangentConeAt_of_frequently_mem (Eventually.frequently ?_)
rw [eventually_nhdsWithin_iff]
filter_upwards [ge_mem_nhds one_pos] with t htā htā
apply h
rw [segment_eq_image', add_sub_cancel_left]
exact mem_image_of_mem _ āØle_of_lt htā, htāā©
theorem sub_mem_posTangentConeAt_of_segment_subset (h : segment ā x y ā s) :
y - x ā posTangentConeAt s x :=
mem_posTangentConeAt_of_segment_subset <| by rwa [add_sub_cancel]
@[simp]
theorem posTangentConeAt_univ : posTangentConeAt univ a = univ :=
eq_univ_of_forall fun _ => mem_posTangentConeAt_of_segment_subset (subset_univ _)
/-!
### Fermat's Theorem (vector space)
-/
/-- If `f` has a local max on `s` at `a`, `f'` is the derivative of `f` at `a` within `s`, and
`y` belongs to the positive tangent cone of `s` at `a`, then `f' y ⤠0`. -/
theorem IsLocalMaxOn.hasFDerivWithinAt_nonpos (h : IsLocalMaxOn f s a)
(hf : HasFDerivWithinAt f f' s a) (hy : y ā posTangentConeAt s a) : f' y ⤠0 := by
rcases hy with āØc, d, hd, hc, hcdā©
have hc' : Tendsto (āc Ā·ā) atTop atTop := tendsto_abs_atTop_atTop.comp hc
suffices āį¶ n in atTop, c n ⢠(f (a + d n) - f a) ⤠0 from
le_of_tendsto (hf.lim atTop hd hc' hcd) this
replace hd : Tendsto (fun n => a + d n) atTop (š[s] (a + 0)) :=
tendsto_nhdsWithin_iff.2 āØtendsto_const_nhds.add (tangentConeAt.lim_zero _ hc' hcd), hdā©
rw [add_zero] at hd
filter_upwards [hd.eventually h, hc.eventually_ge_atTop 0] with n hfn hcn
exact mul_nonpos_of_nonneg_of_nonpos hcn (sub_nonpos.2 hfn)
/-- If `f` has a local max on `s` at `a` and `y` belongs to the positive tangent cone
of `s` at `a`, then `f' y ⤠0`. -/
theorem IsLocalMaxOn.fderivWithin_nonpos (h : IsLocalMaxOn f s a)
(hy : y ā posTangentConeAt s a) : (fderivWithin ā f s a : E ā ā) y ⤠0 := by
classical
exact
if hf : DifferentiableWithinAt ā f s a then h.hasFDerivWithinAt_nonpos hf.hasFDerivWithinAt hy
else by rw [fderivWithin_zero_of_not_differentiableWithinAt hf]; rfl
/-- If `f` has a local max on `s` at `a`, `f'` is a derivative of `f` at `a` within `s`, and
both `y` and `-y` belong to the positive tangent cone of `s` at `a`, then `f' y ⤠0`. -/
theorem IsLocalMaxOn.hasFDerivWithinAt_eq_zero (h : IsLocalMaxOn f s a)
(hf : HasFDerivWithinAt f f' s a) (hy : y ā posTangentConeAt s a)
(hy' : -y ā posTangentConeAt s a) : f' y = 0 :=
le_antisymm (h.hasFDerivWithinAt_nonpos hf hy) <| by simpa using h.hasFDerivWithinAt_nonpos hf hy'
/-- If `f` has a local max on `s` at `a` and both `y` and `-y` belong to the positive tangent cone
of `s` at `a`, then `f' y = 0`. -/
theorem IsLocalMaxOn.fderivWithin_eq_zero (h : IsLocalMaxOn f s a)
(hy : y ā posTangentConeAt s a) (hy' : -y ā posTangentConeAt s a) :
(fderivWithin ā f s a : E ā ā) y = 0 := by
classical
exact if hf : DifferentiableWithinAt ā f s a then
h.hasFDerivWithinAt_eq_zero hf.hasFDerivWithinAt hy hy'
else by rw [fderivWithin_zero_of_not_differentiableWithinAt hf]; rfl
/-- If `f` has a local min on `s` at `a`, `f'` is the derivative of `f` at `a` within `s`, and
`y` belongs to the positive tangent cone of `s` at `a`, then `0 ⤠f' y`. -/
theorem IsLocalMinOn.hasFDerivWithinAt_nonneg (h : IsLocalMinOn f s a)
(hf : HasFDerivWithinAt f f' s a) (hy : y ā posTangentConeAt s a) : 0 ⤠f' y := by
simpa using h.neg.hasFDerivWithinAt_nonpos hf.neg hy
/-- If `f` has a local min on `s` at `a` and `y` belongs to the positive tangent cone
of `s` at `a`, then `0 ⤠f' y`. -/
theorem IsLocalMinOn.fderivWithin_nonneg (h : IsLocalMinOn f s a)
(hy : y ā posTangentConeAt s a) : (0 : ā) ⤠(fderivWithin ā f s a : E ā ā) y := by
classical
exact
if hf : DifferentiableWithinAt ā f s a then h.hasFDerivWithinAt_nonneg hf.hasFDerivWithinAt hy
else by rw [fderivWithin_zero_of_not_differentiableWithinAt hf]; rfl
/-- If `f` has a local max on `s` at `a`, `f'` is a derivative of `f` at `a` within `s`, and
both `y` and `-y` belong to the positive tangent cone of `s` at `a`, then `f' y ⤠0`. -/
theorem IsLocalMinOn.hasFDerivWithinAt_eq_zero (h : IsLocalMinOn f s a)
(hf : HasFDerivWithinAt f f' s a) (hy : y ā posTangentConeAt s a)
(hy' : -y ā posTangentConeAt s a) : f' y = 0 := by
simpa using h.neg.hasFDerivWithinAt_eq_zero hf.neg hy hy'
/-- If `f` has a local min on `s` at `a` and both `y` and `-y` belong to the positive tangent cone
of `s` at `a`, then `f' y = 0`. -/
theorem IsLocalMinOn.fderivWithin_eq_zero (h : IsLocalMinOn f s a)
(hy : y ā posTangentConeAt s a) (hy' : -y ā posTangentConeAt s a) :
(fderivWithin ā f s a : E ā ā) y = 0 := by
classical
exact if hf : DifferentiableWithinAt ā f s a then
h.hasFDerivWithinAt_eq_zero hf.hasFDerivWithinAt hy hy'
else by rw [fderivWithin_zero_of_not_differentiableWithinAt hf]; rfl
/-- **Fermat's Theorem**: the derivative of a function at a local minimum equals zero. -/
theorem IsLocalMin.hasFDerivAt_eq_zero (h : IsLocalMin f a) (hf : HasFDerivAt f f' a) : f' = 0 := by
ext y
apply (h.on univ).hasFDerivWithinAt_eq_zero hf.hasFDerivWithinAt <;>
rw [posTangentConeAt_univ] <;>
apply mem_univ
/-- **Fermat's Theorem**: the derivative of a function at a local minimum equals zero. -/
theorem IsLocalMin.fderiv_eq_zero (h : IsLocalMin f a) : fderiv ā f a = 0 := by
classical
exact if hf : DifferentiableAt ā f a then h.hasFDerivAt_eq_zero hf.hasFDerivAt
else fderiv_zero_of_not_differentiableAt hf
/-- **Fermat's Theorem**: the derivative of a function at a local maximum equals zero. -/
theorem IsLocalMax.hasFDerivAt_eq_zero (h : IsLocalMax f a) (hf : HasFDerivAt f f' a) : f' = 0 :=
neg_eq_zero.1 <| h.neg.hasFDerivAt_eq_zero hf.neg
/-- **Fermat's Theorem**: the derivative of a function at a local maximum equals zero. -/
theorem IsLocalMax.fderiv_eq_zero (h : IsLocalMax f a) : fderiv ā f a = 0 := by
classical
exact if hf : DifferentiableAt ā f a then h.hasFDerivAt_eq_zero hf.hasFDerivAt
else fderiv_zero_of_not_differentiableAt hf
/-- **Fermat's Theorem**: the derivative of a function at a local extremum equals zero. -/
theorem IsLocalExtr.hasFDerivAt_eq_zero (h : IsLocalExtr f a) : HasFDerivAt f f' a ā f' = 0 :=
h.elim IsLocalMin.hasFDerivAt_eq_zero IsLocalMax.hasFDerivAt_eq_zero
/-- **Fermat's Theorem**: the derivative of a function at a local extremum equals zero. -/
theorem IsLocalExtr.fderiv_eq_zero (h : IsLocalExtr f a) : fderiv ā f a = 0 :=
h.elim IsLocalMin.fderiv_eq_zero IsLocalMax.fderiv_eq_zero
end Module
/-!
### Fermat's Theorem
-/
section Real
variable {f : ā ā ā} {f' : ā} {s : Set ā} {a b : ā}
lemma one_mem_posTangentConeAt_iff_mem_closure :
1 ā posTangentConeAt s a ā a ā closure (Ioi a ā© s) := by
constructor
Ā· rintro āØc, d, hs, hc, hcdā©
have : Tendsto (a + d Ā·) atTop (š a) := by
simpa only [add_zero] using tendsto_const_nhds.add
(tangentConeAt.lim_zero _ (tendsto_abs_atTop_atTop.comp hc) hcd)
apply mem_closure_of_tendsto this
filter_upwards [hc.eventually_gt_atTop 0, hcd.eventually (lt_mem_nhds one_pos), hs]
with n hcn hcdn hdn
simp_all
Ā· intro h
apply mem_posTangentConeAt_of_frequently_mem
rw [mem_closure_iff_frequently, ā map_add_left_nhds_zero, frequently_map] at h
simpa [nhdsWithin, frequently_inf_principal] using h
lemma one_mem_posTangentConeAt_iff_frequently :
1 ā posTangentConeAt s a ā āį¶ x in š[>] a, x ā s := by
rw [one_mem_posTangentConeAt_iff_mem_closure, mem_closure_iff_frequently,
frequently_nhdsWithin_iff, inter_comm]
simp_rw [mem_inter_iff]
/-- **Fermat's Theorem**: the derivative of a function at a local minimum equals zero. -/
theorem IsLocalMin.hasDerivAt_eq_zero (h : IsLocalMin f a) (hf : HasDerivAt f f' a) : f' = 0 := by
simpa using DFunLike.congr_fun (h.hasFDerivAt_eq_zero (hasDerivAt_iff_hasFDerivAt.1 hf)) 1
/-- **Fermat's Theorem**: the derivative of a function at a local minimum equals zero. -/
theorem IsLocalMin.deriv_eq_zero (h : IsLocalMin f a) : deriv f a = 0 := by
classical
exact if hf : DifferentiableAt ā f a then h.hasDerivAt_eq_zero hf.hasDerivAt
else deriv_zero_of_not_differentiableAt hf
/-- **Fermat's Theorem**: the derivative of a function at a local maximum equals zero. -/
theorem IsLocalMax.hasDerivAt_eq_zero (h : IsLocalMax f a) (hf : HasDerivAt f f' a) : f' = 0 :=
neg_eq_zero.1 <| h.neg.hasDerivAt_eq_zero hf.neg
/-- **Fermat's Theorem**: the derivative of a function at a local maximum equals zero. -/
theorem IsLocalMax.deriv_eq_zero (h : IsLocalMax f a) : deriv f a = 0 := by
classical
exact if hf : DifferentiableAt ā f a then h.hasDerivAt_eq_zero hf.hasDerivAt
else deriv_zero_of_not_differentiableAt hf
/-- **Fermat's Theorem**: the derivative of a function at a local extremum equals zero. -/
theorem IsLocalExtr.hasDerivAt_eq_zero (h : IsLocalExtr f a) : HasDerivAt f f' a ā f' = 0 :=
h.elim IsLocalMin.hasDerivAt_eq_zero IsLocalMax.hasDerivAt_eq_zero
/-- **Fermat's Theorem**: the derivative of a function at a local extremum equals zero. -/
theorem IsLocalExtr.deriv_eq_zero (h : IsLocalExtr f a) : deriv f a = 0 :=
h.elim IsLocalMin.deriv_eq_zero IsLocalMax.deriv_eq_zero
end Real |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/LocalExtr/Polynomial.lean | import Mathlib.Analysis.Calculus.LocalExtr.Rolle
import Mathlib.Analysis.Calculus.Deriv.Polynomial
import Mathlib.Topology.Algebra.Polynomial
/-!
# Rolle's Theorem for polynomials
In this file we use Rolle's Theorem
to relate the number of real roots of a real polynomial and its derivative.
Namely, we prove the following facts.
* `Polynomial.card_roots_toFinset_le_card_roots_derivative_diff_roots_succ`:
the number of roots of a real polynomial `p` is at most the number of roots of its derivative
that are not roots of `p` plus one.
* `Polynomial.card_roots_toFinset_le_derivative`, `Polynomial.card_rootSet_le_derivative`:
the number of roots of a real polynomial
is at most the number of roots of its derivative plus one.
* `Polynomial.card_roots_le_derivative`: same, but the roots are counted with multiplicities.
## Keywords
polynomial, Rolle's Theorem, root
-/
namespace Polynomial
/-- The number of roots of a real polynomial `p` is at most the number of roots of its derivative
that are not roots of `p` plus one. -/
theorem card_roots_toFinset_le_card_roots_derivative_diff_roots_succ (p : ā[X]) :
p.roots.toFinset.card ⤠(p.derivative.roots.toFinset \ p.roots.toFinset).card + 1 := by
rcases eq_or_ne (derivative p) 0 with hp' | hp'
Ā· rw [eq_C_of_derivative_eq_zero hp', roots_C, Multiset.toFinset_zero, Finset.card_empty]
exact zero_le _
have hp : p ā 0 := ne_of_apply_ne derivative (by rwa [derivative_zero])
refine Finset.card_le_diff_of_interleaved fun x hx y hy hxy hxy' => ?_
rw [Multiset.mem_toFinset, mem_roots hp] at hx hy
obtain āØz, hz1, hz2ā© := exists_deriv_eq_zero hxy p.continuousOn (hx.trans hy.symm)
refine āØz, ?_, hz1ā©
rwa [Multiset.mem_toFinset, mem_roots hp', IsRoot, ā p.deriv]
/-- The number of roots of a real polynomial is at most the number of roots of its derivative plus
one. -/
theorem card_roots_toFinset_le_derivative (p : ā[X]) :
p.roots.toFinset.card ⤠p.derivative.roots.toFinset.card + 1 :=
p.card_roots_toFinset_le_card_roots_derivative_diff_roots_succ.trans <| by
grw [Finset.sdiff_subset]
/-- The number of roots of a real polynomial (counted with multiplicities) is at most the number of
roots of its derivative (counted with multiplicities) plus one. -/
theorem card_roots_le_derivative (p : ā[X]) :
Multiset.card p.roots ⤠Multiset.card (derivative p).roots + 1 :=
calc
Multiset.card p.roots = ā x ā p.roots.toFinset, p.roots.count x :=
(Multiset.toFinset_sum_count_eq _).symm
_ = ā x ā p.roots.toFinset, (p.roots.count x - 1 + 1) :=
(Eq.symm <| Finset.sum_congr rfl fun _ hx => tsub_add_cancel_of_le <|
Nat.succ_le_iff.2 <| Multiset.count_pos.2 <| Multiset.mem_toFinset.1 hx)
_ = (ā x ā p.roots.toFinset, (p.rootMultiplicity x - 1)) + p.roots.toFinset.card := by
simp only [Finset.sum_add_distrib, Finset.card_eq_sum_ones, count_roots]
_ ⤠(ā x ā p.roots.toFinset, p.derivative.rootMultiplicity x) +
((p.derivative.roots.toFinset \ p.roots.toFinset).card + 1) :=
(add_le_add
(Finset.sum_le_sum fun _ _ => rootMultiplicity_sub_one_le_derivative_rootMultiplicity _ _)
p.card_roots_toFinset_le_card_roots_derivative_diff_roots_succ)
_ ⤠(ā x ā p.roots.toFinset, p.derivative.roots.count x) +
((ā x ā p.derivative.roots.toFinset \ p.roots.toFinset,
p.derivative.roots.count x) + 1) := by
simp only [ā count_roots, Finset.card_eq_sum_ones]
gcongr with x hx
rw [Nat.succ_le_iff, Multiset.count_pos, ā Multiset.mem_toFinset]
exact (Finset.mem_sdiff.1 hx).1
_ = Multiset.card (derivative p).roots + 1 := by
rw [ā add_assoc, ā Finset.sum_union Finset.disjoint_sdiff, Finset.union_sdiff_self_eq_union, ā
Multiset.toFinset_sum_count_eq, ā Finset.sum_subset Finset.subset_union_right]
intro x _ hxā
simpa only [Multiset.mem_toFinset, Multiset.count_eq_zero] using hxā
/-- The number of real roots of a polynomial is at most the number of roots of its derivative plus
one. -/
theorem card_rootSet_le_derivative {F : Type*} [CommRing F] [Algebra F ā] (p : F[X]) :
Fintype.card (p.rootSet ā) ⤠Fintype.card (p.derivative.rootSet ā) + 1 := by
simpa only [rootSet_def, Finset.coe_sort_coe, Fintype.card_coe, derivative_map] using
card_roots_toFinset_le_derivative (p.map (algebraMap F ā))
end Polynomial |
.lake/packages/mathlib/Mathlib/Analysis/Calculus/LocalExtr/Rolle.lean | import Mathlib.Analysis.Calculus.LocalExtr.Basic
import Mathlib.Topology.Order.Rolle
/-!
# Rolle's Theorem
In this file we prove Rolle's Theorem. The theorem says that for a function `f : ā ā ā` such that
* $f$ is differentiable on an open interval $(a, b)$, $a < b$;
* $f$ is continuous on the corresponding closed interval $[a, b]$;
* $f(a) = f(b)$,
there exists a point $cā(a, b)$ such that $f'(c)=0$.
We prove four versions of this theorem.
* `exists_hasDerivAt_eq_zero` is closest to the statement given above. It assumes that at every
point $x ā (a, b)$ function $f$ has derivative $f'(x)$, then concludes that $f'(c)=0$ for some
$cā(a, b)$.
* `exists_deriv_eq_zero` deals with `deriv f` instead of an arbitrary function `f'` and a predicate
`HasDerivAt`; since we use zero as the "junk" value for `deriv f c`, this version does not
assume that `f` is differentiable on the open interval.
* `exists_hasDerivAt_eq_zero'` is similar to `exists_hasDerivAt_eq_zero` but instead of assuming
continuity on the closed interval $[a, b]$ it assumes that $f$ tends to the same limit as $x$
tends to $a$ from the right and as $x$ tends to $b$ from the left.
* `exists_deriv_eq_zero'` relates to `exists_deriv_eq_zero` as `exists_hasDerivAt_eq_zero'`
relates to `exists_hasDerivAt_eq_zero`.
## References
* [Rolle's Theorem](https://en.wikipedia.org/wiki/Rolle's_theorem);
## Tags
local extremum, Rolle's Theorem
-/
open Set Filter Topology
variable {f f' : ā ā ā} {a b l : ā}
/-- **Rolle's Theorem** `HasDerivAt` version -/
theorem exists_hasDerivAt_eq_zero (hab : a < b) (hfc : ContinuousOn f (Icc a b)) (hfI : f a = f b)
(hff' : ā x ā Ioo a b, HasDerivAt f (f' x) x) : ā c ā Ioo a b, f' c = 0 :=
let āØc, cmem, hcā© := exists_isLocalExtr_Ioo hab hfc hfI
āØc, cmem, hc.hasDerivAt_eq_zero <| hff' c cmemā©
/-- **Rolle's Theorem** `deriv` version -/
theorem exists_deriv_eq_zero (hab : a < b) (hfc : ContinuousOn f (Icc a b)) (hfI : f a = f b) :
ā c ā Ioo a b, deriv f c = 0 :=
let āØc, cmem, hcā© := exists_isLocalExtr_Ioo hab hfc hfI
āØc, cmem, hc.deriv_eq_zeroā©
/-- **Rolle's Theorem**, a version for a function on an open interval: if `f` has derivative `f'`
on `(a, b)` and has the same limit `l` at `š[>] a` and `š[<] b`, then `f' c = 0`
for some `c ā (a, b)`. -/
theorem exists_hasDerivAt_eq_zero' (hab : a < b) (hfa : Tendsto f (š[>] a) (š l))
(hfb : Tendsto f (š[<] b) (š l)) (hff' : ā x ā Ioo a b, HasDerivAt f (f' x) x) :
ā c ā Ioo a b, f' c = 0 :=
let āØc, cmem, hcā© := exists_isLocalExtr_Ioo_of_tendsto hab
(fun x hx ⦠(hff' x hx).continuousAt.continuousWithinAt) hfa hfb
āØc, cmem, hc.hasDerivAt_eq_zero <| hff' c cmemā©
/-- **Rolle's Theorem**, a version for a function on an open interval: if `f` has the same limit
`l` at `š[>] a` and `š[<] b`, then `deriv f c = 0` for some `c ā (a, b)`. This version
does not require differentiability of `f` because we define `deriv f c = 0` whenever `f` is not
differentiable at `c`. -/
theorem exists_deriv_eq_zero' (hab : a < b) (hfa : Tendsto f (š[>] a) (š l))
(hfb : Tendsto f (š[<] b) (š l)) : ā c ā Ioo a b, deriv f c = 0 := by
by_cases! h : ā x ā Ioo a b, DifferentiableAt ā f x
Ā· exact exists_hasDerivAt_eq_zero' hab hfa hfb fun x hx => (h x hx).hasDerivAt
Ā· obtain āØc, hc, hcdiffā© : ā x ā Ioo a b, ¬DifferentiableAt ā f x := h
exact āØc, hc, deriv_zero_of_not_differentiableAt hcdiffā© |
.lake/packages/mathlib/Mathlib/Analysis/Normed/MulAction.lean | import Mathlib.Analysis.Normed.Field.Basic
import Mathlib.Data.ENNReal.Action
import Mathlib.Topology.Algebra.UniformMulAction
import Mathlib.Topology.MetricSpace.Algebra
/-!
# Lemmas for `IsBoundedSMul` over normed additive groups
Lemmas which hold only in `NormedSpace α β` are provided in another file.
Notably we prove that `NonUnitalSeminormedRing`s have bounded actions by left- and right-
multiplication. This allows downstream files to write general results about `IsBoundedSMul`, and
then deduce `const_mul` and `mul_const` results as an immediate corollary.
-/
variable {α β : Type*}
section SeminormedAddGroup
variable [SeminormedAddGroup α] [SeminormedAddGroup β] [SMulZeroClass α β]
variable [IsBoundedSMul α β] {r : α} {x : β}
@[bound]
theorem norm_smul_le (r : α) (x : β) : ār ⢠xā ⤠ārā * āxā := by
simpa [smul_zero] using dist_smul_pair r 0 x
@[bound]
theorem nnnorm_smul_le (r : α) (x : β) : ār ⢠xāā ⤠ārāā * āxāā :=
norm_smul_le _ _
@[bound]
lemma enorm_smul_le : ār ⢠xāā ⤠ārāā * āxāā := by
simpa [enorm, ā ENNReal.coe_mul] using nnnorm_smul_le ..
theorem dist_smul_le (s : α) (x y : β) : dist (s ⢠x) (s ⢠y) ⤠āsā * dist x y := by
simpa only [dist_eq_norm, sub_zero] using dist_smul_pair s x y
theorem nndist_smul_le (s : α) (x y : β) : nndist (s ⢠x) (s ⢠y) ⤠āsāā * nndist x y :=
dist_smul_le s x y
theorem lipschitzWith_smul (s : α) : LipschitzWith āsāā (s ⢠· : β ā β) :=
lipschitzWith_iff_dist_le_mul.2 <| dist_smul_le _
theorem edist_smul_le (s : α) (x y : β) : edist (s ⢠x) (s ⢠y) ⤠āsāā ⢠edist x y :=
lipschitzWith_smul s x y
end SeminormedAddGroup
/-- Left multiplication is bounded. -/
instance NonUnitalSeminormedRing.isBoundedSMul [NonUnitalSeminormedRing α] :
IsBoundedSMul α α where
dist_smul_pair' x yā yā := by simpa [mul_sub, dist_eq_norm] using norm_mul_le x (yā - yā)
dist_pair_smul' xā xā y := by simpa [sub_mul, dist_eq_norm] using norm_mul_le (xā - xā) y
/-- Right multiplication is bounded. -/
instance NonUnitalSeminormedRing.isBoundedSMulOpposite [NonUnitalSeminormedRing α] :
IsBoundedSMul αįµįµįµ α where
dist_smul_pair' x yā yā := by
simpa [sub_mul, dist_eq_norm, mul_comm] using norm_mul_le (yā - yā) x.unop
dist_pair_smul' xā xā y := by
simpa [mul_sub, dist_eq_norm, mul_comm] using norm_mul_le y (xā - xā).unop
section SeminormedRing
variable [SeminormedRing α] [SeminormedAddCommGroup β] [Module α β]
theorem IsBoundedSMul.of_norm_smul_le (h : ā (r : α) (x : β), ār ⢠xā ⤠ārā * āxā) :
IsBoundedSMul α β :=
{ dist_smul_pair' := fun a bā bā => by simpa [smul_sub, dist_eq_norm] using h a (bā - bā)
dist_pair_smul' := fun aā aā b => by simpa [sub_smul, dist_eq_norm] using h (aā - aā) b }
theorem IsBoundedSMul.of_enorm_smul_le (h : ā (r : α) (x : β), ār ⢠xāā ⤠ārāā * āxāā) :
IsBoundedSMul α β :=
.of_norm_smul_le (by simpa [enorm_eq_nnnorm, ā ENNReal.coe_mul, ENNReal.coe_le_coe] using h)
theorem IsBoundedSMul.of_nnnorm_smul_le (h : ā (r : α) (x : β), ār ⢠xāā ⤠ārāā * āxāā) :
IsBoundedSMul α β := .of_norm_smul_le h
end SeminormedRing
section NormSMulClass
/-- Mixin class for scalar-multiplication actions with a strictly multiplicative norm, i.e.
`ār ⢠xā = ārā * āxā`. -/
class NormSMulClass (α β : Type*) [Norm α] [Norm β] [SMul α β] : Prop where
protected norm_smul (r : α) (x : β) : ār ⢠xā = ārā * āxā
lemma norm_smul [Norm α] [Norm β] [SMul α β] [NormSMulClass α β] (r : α) (x : β) :
ār ⢠xā = ārā * āxā :=
NormSMulClass.norm_smul r x
instance (priority := 100) NormMulClass.toNormSMulClass [Norm α] [Mul α] [NormMulClass α] :
NormSMulClass α α where
norm_smul := norm_mul
instance (priority := 100) NormMulClass.toNormSMulClass_op [SeminormedRing α] [NormMulClass α] :
NormSMulClass αįµįµįµ α where
norm_smul a b := mul_comm ābā āaā āø norm_mul b a.unop
/-- Mixin class for scalar-multiplication actions with a strictly multiplicative norm, i.e.
`ār ⢠xāā = ārāā * āxāā`. -/
class ENormSMulClass (α β : Type*) [ENorm α] [ENorm β] [SMul α β] : Prop where
protected enorm_smul (r : α) (x : β) : ār ⢠xāā = ārāā * āxāā
lemma enorm_smul [ENorm α] [ENorm β] [SMul α β] [ENormSMulClass α β] (r : α) (x : β) :
ār ⢠xāā = ārāā * āxāā :=
ENormSMulClass.enorm_smul r x
variable [SeminormedRing α] [SeminormedAddGroup β] [SMul α β]
theorem NormSMulClass.of_nnnorm_smul (h : ā (r : α) (x : β), ār ⢠xāā = ārāā * āxāā) :
NormSMulClass α β where
norm_smul r b := congr_arg NNReal.toReal (h r b)
variable [NormSMulClass α β]
theorem nnnorm_smul (r : α) (x : β) : ār ⢠xāā = ārāā * āxāā :=
NNReal.eq <| norm_smul r x
instance (priority := 100) : ENormSMulClass α β where
enorm_smul r x := by simp [enorm, nnnorm_smul]
instance Pi.instNormSMulClass {ι : Type*} {β : ι ā Type*} [Fintype ι]
[SeminormedRing α] [ā i, SeminormedAddGroup (β i)] [ā i, SMul α (β i)]
[ā i, NormSMulClass α (β i)] : NormSMulClass α (Ī i, β i) where
norm_smul r x := by
simp [nnnorm_def, ā coe_nnnorm, nnnorm_smul, ā NNReal.coe_mul, NNReal.mul_finset_sup]
instance Prod.instNormSMulClass {γ : Type*} [SeminormedAddGroup γ] [SMul α γ] [NormSMulClass α γ] :
NormSMulClass α (β à γ) where
norm_smul := fun r āØvā, vā⩠⦠by simp only [smul_def, ā coe_nnnorm, nnnorm_def,
nnnorm_smul r, ā NNReal.coe_mul, NNReal.mul_sup]
instance ULift.instNormSMulClass : NormSMulClass α (ULift β) where
norm_smul r v := norm_smul r v.down
end NormSMulClass
section NormSMulClassModule
variable [SeminormedRing α] [SeminormedAddCommGroup β] [Module α β] [NormSMulClass α β]
theorem dist_smulā (s : α) (x y : β) : dist (s ⢠x) (s ⢠y) = āsā * dist x y := by
simp_rw [dist_eq_norm, (norm_smul s (x - y)).symm, smul_sub]
theorem nndist_smulā (s : α) (x y : β) : nndist (s ⢠x) (s ⢠y) = āsāā * nndist x y :=
NNReal.eq <| dist_smulā s x y
theorem edist_smulā (s : α) (x y : β) : edist (s ⢠x) (s ⢠y) = āsāā ⢠edist x y := by
simp only [edist_nndist, nndist_smulā, ENNReal.coe_mul, ENNReal.smul_def, smul_eq_mul]
instance NormSMulClass.toIsBoundedSMul : IsBoundedSMul α β :=
.of_norm_smul_le fun r x ⦠(norm_smul r x).le
end NormSMulClassModule
section NormedDivisionRing
variable [NormedDivisionRing α] [SeminormedAddGroup β]
variable [MulActionWithZero α β] [IsBoundedSMul α β]
/-- For a normed division ring, a sub-multiplicative norm is actually strictly multiplicative.
This is not an instance as it forms a loop with `NormSMulClass.toIsBoundedSMul`. -/
lemma NormedDivisionRing.toNormSMulClass : NormSMulClass α β where
norm_smul r x := by
by_cases h : r = 0
· simp [h, zero_smul α x]
Ā· refine le_antisymm (norm_smul_le r x) ?_
calc
ārā * āxā = ārā * ārā»Ā¹ ⢠r ⢠xā := by rw [inv_smul_smulā h]
_ ⤠ārā * (ārā»Ā¹ā * ār ⢠xā) := by gcongr; apply norm_smul_le
_ = ār ⢠xā := by rw [norm_inv, ā mul_assoc, mul_inv_cancelā (mt norm_eq_zero.1 h), one_mul]
end NormedDivisionRing |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Order/Basic.lean | import Mathlib.Analysis.Normed.Group.Basic
/-!
# Ordered normed spaces
In this file, we define classes for fields and groups that are both normed and ordered.
These are mostly useful to avoid diamonds during type class inference.
-/
open Filter Set
open Topology
variable {α : Type*} |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Order/UpperLower.lean | import Mathlib.Algebra.Order.Field.Pi
import Mathlib.Algebra.Order.Pi
import Mathlib.Analysis.Normed.Field.Basic
import Mathlib.Analysis.Normed.Group.Pointwise
import Mathlib.Topology.Algebra.Order.UpperLower
import Mathlib.Topology.MetricSpace.Sequences
/-!
# Upper/lower/order-connected sets in normed groups
The topological closure and interior of an upper/lower/order-connected set is an
upper/lower/order-connected set (with the notable exception of the closure of an order-connected
set).
We also prove lemmas specific to `āāæ`. Those are helpful to prove that order-connected sets in `āāæ`
are measurable.
## TODO
Is there a way to generalise `IsClosed.upperClosure_pi`/`IsClosed.lowerClosure_pi` so that they also
apply to `ā`, `ā Ć ā`, `EuclideanSpace ι ā`? `_pi` has been appended to their names to disambiguate
from the other possible lemmas, but we will want there to be a single set of lemmas for all
situations.
-/
open Bornology Function Metric Set
open scoped Pointwise
variable {α ι : Type*}
section NormedOrderedGroup
variable [NormedCommGroup α] [PartialOrder α] [IsOrderedMonoid α] {s : Set α}
@[to_additive IsUpperSet.thickening]
protected theorem IsUpperSet.thickening' (hs : IsUpperSet s) (ε : ā) :
IsUpperSet (thickening ε s) := by
rw [ā ball_mul_one]
exact hs.mul_left
@[to_additive IsLowerSet.thickening]
protected theorem IsLowerSet.thickening' (hs : IsLowerSet s) (ε : ā) :
IsLowerSet (thickening ε s) := by
rw [ā ball_mul_one]
exact hs.mul_left
@[to_additive IsUpperSet.cthickening]
protected theorem IsUpperSet.cthickening' (hs : IsUpperSet s) (ε : ā) :
IsUpperSet (cthickening ε s) := by
rw [cthickening_eq_iInter_thickening'']
exact isUpperSet_iInterā fun Ī“ _ => hs.thickening' _
@[to_additive IsLowerSet.cthickening]
protected theorem IsLowerSet.cthickening' (hs : IsLowerSet s) (ε : ā) :
IsLowerSet (cthickening ε s) := by
rw [cthickening_eq_iInter_thickening'']
exact isLowerSet_iInterā fun Ī“ _ => hs.thickening' _
@[to_additive upperClosure_interior_subset] lemma upperClosure_interior_subset' (s : Set α) :
(upperClosure (interior s) : Set α) ā interior (upperClosure s) :=
upperClosure_min (interior_mono subset_upperClosure) (upperClosure s).upper.interior
@[to_additive lowerClosure_interior_subset] lemma lowerClosure_interior_subset' (s : Set α) :
(lowerClosure (interior s) : Set α) ā interior (lowerClosure s) :=
lowerClosure_min (interior_mono subset_lowerClosure) (lowerClosure s).lower.interior
end NormedOrderedGroup
/-! ### `āāæ` -/
section Finite
variable [Finite ι] {s : Set (ι ā ā)} {x y : ι ā ā}
theorem IsUpperSet.mem_interior_of_forall_lt (hs : IsUpperSet s) (hx : x ā closure s)
(h : ā i, x i < y i) : y ā interior s := by
cases nonempty_fintype ι
obtain āØĪµ, hε, hxyā© := Pi.exists_forall_pos_add_lt h
obtain āØz, hz, hxzā© := Metric.mem_closure_iff.1 hx _ hε
rw [dist_pi_lt_iff hε] at hxz
have hyz : ā i, z i < y i := by
refine fun i => (hxy _).trans_le' (sub_le_iff_le_add'.1 <| (le_abs_self _).trans ?_)
rw [ā Real.norm_eq_abs, ā dist_eq_norm']
exact (hxz _).le
obtain āØĪ“, hĪ“, hyzā© := Pi.exists_forall_pos_add_lt hyz
refine mem_interior.2 āØball y Ī“, ?_, isOpen_ball, mem_ball_self hĪ“ā©
rintro w hw
refine hs (fun i => ?_) hz
simp_rw [ball_pi _ hΓ, Real.ball_eq_Ioo] at hw
exact ((lt_sub_iff_add_lt.2 <| hyz _).trans (hw _ <| mem_univ _).1).le
theorem IsLowerSet.mem_interior_of_forall_lt (hs : IsLowerSet s) (hx : x ā closure s)
(h : ā i, y i < x i) : y ā interior s := by
cases nonempty_fintype ι
obtain āØĪµ, hε, hxyā© := Pi.exists_forall_pos_add_lt h
obtain āØz, hz, hxzā© := Metric.mem_closure_iff.1 hx _ hε
rw [dist_pi_lt_iff hε] at hxz
have hyz : ā i, y i < z i := by
refine fun i =>
(lt_sub_iff_add_lt.2 <| hxy _).trans_le (sub_le_comm.1 <| (le_abs_self _).trans ?_)
rw [ā Real.norm_eq_abs, ā dist_eq_norm]
exact (hxz _).le
obtain āØĪ“, hĪ“, hyzā© := Pi.exists_forall_pos_add_lt hyz
refine mem_interior.2 āØball y Ī“, ?_, isOpen_ball, mem_ball_self hĪ“ā©
rintro w hw
refine hs (fun i => ?_) hz
simp_rw [ball_pi _ hΓ, Real.ball_eq_Ioo] at hw
exact ((hw _ <| mem_univ _).2.trans <| hyz _).le
end Finite
section Fintype
variable [Fintype ι] {s : Set (ι ā ā)} {aā aā bā bā x y : ι ā ā} {Ī“ : ā}
-- TODO: Generalise those lemmas so that they also apply to `ā` and `EuclideanSpace ι ā`
lemma dist_inf_sup_pi (x y : ι ā ā) : dist (x ā y) (x ā y) = dist x y := by
refine congr_arg NNReal.toReal (Finset.sup_congr rfl fun i _ ⦠?_)
simp only [Real.nndist_eq', max_sub_min_eq_abs, Pi.inf_apply,
Pi.sup_apply, Real.nnabs_of_nonneg, abs_nonneg, Real.toNNReal_abs]
lemma dist_mono_left_pi : MonotoneOn (dist Ā· y) (Ici y) := by
refine fun yā hyā yā hyā hy ⦠NNReal.coe_le_coe.2 (Finset.sup_mono_fun fun i _ ⦠?_)
rw [Real.nndist_eq, Real.nnabs_of_nonneg (sub_nonneg_of_le (ā¹y ⤠_āŗ i : y i ⤠yā i)),
Real.nndist_eq, Real.nnabs_of_nonneg (sub_nonneg_of_le (ā¹y ⤠_āŗ i : y i ⤠yā i))]
grw [hy i] -- TODO(gcongr): we would like `grw [hy]` to work here
lemma dist_mono_right_pi : MonotoneOn (dist x) (Ici x) := by
simpa only [dist_comm _ x] using dist_mono_left_pi (y := x)
lemma dist_anti_left_pi : AntitoneOn (dist Ā· y) (Iic y) := by
refine fun yā hyā yā hyā hy ⦠NNReal.coe_le_coe.2 (Finset.sup_mono_fun fun i _ ⦠?_)
rw [Real.nndist_eq', Real.nnabs_of_nonneg (sub_nonneg_of_le (ā¹_ ⤠yāŗ i : yā i ⤠y i)),
Real.nndist_eq', Real.nnabs_of_nonneg (sub_nonneg_of_le (ā¹_ ⤠yāŗ i : yā i ⤠y i))]
exact Real.toNNReal_mono (sub_le_sub_left (hy _) _)
lemma dist_anti_right_pi : AntitoneOn (dist x) (Iic x) := by
simpa only [dist_comm] using dist_anti_left_pi (y := x)
lemma dist_le_dist_of_le_pi (ha : aā ⤠aā) (hā : aā ⤠bā) (hb : bā ⤠bā) :
dist aā bā ⤠dist aā bā :=
(dist_mono_right_pi hā (hā.trans hb) hb).trans <|
dist_anti_left_pi (ha.trans <| hā.trans hb) (hā.trans hb) ha
theorem IsUpperSet.exists_subset_ball (hs : IsUpperSet s) (hx : x ā closure s) (hĪ“ : 0 < Ī“) :
ā y, closedBall y (Ī“ / 4) ā closedBall x Ī“ ā§ closedBall y (Ī“ / 4) ā interior s := by
refine āØx + const _ (3 / 4 * Ī“), closedBall_subset_closedBall' ?_, ?_ā©
Ā· grw [dist_self_add_left, ā const_def, pi_norm_const_le]
apply le_of_eq
simp [abs_of_nonneg, hΓ.le]
ring
obtain āØy, hy, hxyā© := Metric.mem_closure_iff.1 hx _ (div_pos hĪ“ zero_lt_four)
refine fun z hz => hs.mem_interior_of_forall_lt (subset_closure hy) fun i => ?_
rw [mem_closedBall, dist_eq_norm'] at hz
rw [dist_eq_norm] at hxy
replace hxy := (norm_le_pi_norm _ i).trans hxy.le
replace hz := (norm_le_pi_norm _ i).trans hz
dsimp at hxy hz
rw [abs_sub_le_iff] at hxy hz
linarith
theorem IsLowerSet.exists_subset_ball (hs : IsLowerSet s) (hx : x ā closure s) (hĪ“ : 0 < Ī“) :
ā y, closedBall y (Ī“ / 4) ā closedBall x Ī“ ā§ closedBall y (Ī“ / 4) ā interior s := by
refine āØx - const _ (3 / 4 * Ī“), closedBall_subset_closedBall' ?_, ?_ā©
Ā· grw [dist_self_sub_left, ā const_def, pi_norm_const_le]
apply le_of_eq
simp [abs_of_nonneg, hΓ.le]
ring
obtain āØy, hy, hxyā© := Metric.mem_closure_iff.1 hx _ (div_pos hĪ“ zero_lt_four)
refine fun z hz => hs.mem_interior_of_forall_lt (subset_closure hy) fun i => ?_
rw [mem_closedBall, dist_eq_norm'] at hz
rw [dist_eq_norm] at hxy
replace hxy := (norm_le_pi_norm _ i).trans hxy.le
replace hz := (norm_le_pi_norm _ i).trans hz
dsimp at hxy hz
rw [abs_sub_le_iff] at hxy hz
linarith
end Fintype
section Finite
variable [Finite ι] {s : Set (ι ā ā)}
/-!
#### Note
The closure and frontier of an antichain might not be antichains. Take for example the union
of the open segments from `(0, 2)` to `(1, 1)` and from `(2, 1)` to `(3, 0)`. `(1, 1)` and `(2, 1)`
are comparable and both in the closure/frontier.
-/
protected lemma IsClosed.upperClosure_pi (hs : IsClosed s) (hs' : BddBelow s) :
IsClosed (upperClosure s : Set (ι ā ā)) := by
cases nonempty_fintype ι
refine IsSeqClosed.isClosed fun f x hf hx ⦠?_
choose g hg hgf using hf
obtain āØa, haā© := hx.bddAbove_range
obtain āØb, hb, Ļ, hĻ, hbfā© := tendsto_subseq_of_bounded (hs'.isBounded_inter bddAbove_Iic) fun n ā¦
āØhg n, (hgf _).trans <| ha <| mem_range_self _ā©
exact āØb, closure_minimal inter_subset_left hs hb,
le_of_tendsto_of_tendsto' hbf (hx.comp hĻ.tendsto_atTop) fun _ ⦠hgf _ā©
protected lemma IsClosed.lowerClosure_pi (hs : IsClosed s) (hs' : BddAbove s) :
IsClosed (lowerClosure s : Set (ι ā ā)) := by
cases nonempty_fintype ι
refine IsSeqClosed.isClosed fun f x hf hx ⦠?_
choose g hg hfg using hf
haveI : BoundedGENhdsClass ā := by infer_instance
obtain āØa, haā© := hx.bddBelow_range
obtain āØb, hb, Ļ, hĻ, hbfā© := tendsto_subseq_of_bounded (hs'.isBounded_inter bddBelow_Ici) fun n ā¦
āØhg n, (ha <| mem_range_self _).trans <| hfg _ā©
exact āØb, closure_minimal inter_subset_left hs hb,
le_of_tendsto_of_tendsto' (hx.comp hĻ.tendsto_atTop) hbf fun _ ⦠hfg _ā©
protected lemma IsClopen.upperClosure_pi (hs : IsClopen s) (hs' : BddBelow s) :
IsClopen (upperClosure s : Set (ι ā ā)) := āØhs.1.upperClosure_pi hs', hs.2.upperClosureā©
protected lemma IsClopen.lowerClosure_pi (hs : IsClopen s) (hs' : BddAbove s) :
IsClopen (lowerClosure s : Set (ι ā ā)) := āØhs.1.lowerClosure_pi hs', hs.2.lowerClosureā©
lemma closure_upperClosure_comm_pi (hs : BddBelow s) :
closure (upperClosure s : Set (ι ā ā)) = upperClosure (closure s) :=
(closure_minimal (upperClosure_anti subset_closure) <|
isClosed_closure.upperClosure_pi hs.closure).antisymm <|
upperClosure_min (closure_mono subset_upperClosure) (upperClosure s).upper.closure
lemma closure_lowerClosure_comm_pi (hs : BddAbove s) :
closure (lowerClosure s : Set (ι ā ā)) = lowerClosure (closure s) :=
(closure_minimal (lowerClosure_mono subset_closure) <|
isClosed_closure.lowerClosure_pi hs.closure).antisymm <|
lowerClosure_min (closure_mono subset_lowerClosure) (lowerClosure s).lower.closure
end Finite |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Order/Lattice.lean | import Mathlib.Analysis.Normed.Group.Constructions
import Mathlib.Analysis.Normed.Group.Rat
import Mathlib.Analysis.Normed.Group.Uniform
import Mathlib.Topology.Order.Lattice
/-!
# Normed lattice ordered groups
Motivated by the theory of Banach Lattices, we then define `NormedLatticeAddCommGroup` as a
lattice with a covariant normed group addition satisfying the solid axiom.
## Main statements
We show that a normed lattice ordered group is a topological lattice with respect to the norm
topology.
## References
* [Meyer-Nieberg, Banach lattices][MeyerNieberg1991]
## Tags
normed, lattice, ordered, group
-/
/-!
### Normed lattice ordered groups
Motivated by the theory of Banach Lattices, this section introduces normed lattice ordered groups.
-/
section SolidNorm
/-- Let `α` be an `AddCommGroup` with a `Lattice` structure. A norm on `α` is *solid* if, for `a`
and `b` in `α`, with absolute values `|a|` and `|b|` respectively, `|a| ⤠|b|` implies `āaā ⤠ābā`.
-/
class HasSolidNorm (α : Type*) [NormedAddCommGroup α] [Lattice α] : Prop where
solid : ā ā¦x y : αā¦, |x| ⤠|y| ā āxā ⤠āyā
variable {α : Type*} [NormedAddCommGroup α] [Lattice α] [HasSolidNorm α]
theorem norm_le_norm_of_abs_le_abs {a b : α} (h : |a| ⤠|b|) : āaā ⤠ābā :=
HasSolidNorm.solid h
/-- If `α` has a solid norm, then the balls centered at the origin of `α` are solid sets. -/
theorem LatticeOrderedAddCommGroup.isSolid_ball (r : ā) :
LatticeOrderedAddCommGroup.IsSolid (Metric.ball (0 : α) r) := fun _ hx _ hxy =>
mem_ball_zero_iff.mpr ((HasSolidNorm.solid hxy).trans_lt (mem_ball_zero_iff.mp hx))
instance : HasSolidNorm ā := āØfun _ _ => idā©
instance : HasSolidNorm ā := āØfun _ _ _ => by simpa only [norm, ā Rat.cast_abs, Rat.cast_le]ā©
instance Int.hasSolidNorm : HasSolidNorm ⤠where
solid x y h := by simpa [ā Int.norm_cast_real, ā Int.cast_abs] using h
end SolidNorm
variable {α : Type*} [NormedAddCommGroup α] [Lattice α] [HasSolidNorm α] [IsOrderedAddMonoid α]
open HasSolidNorm
theorem dual_solid (a b : α) (h : b ā -b ⤠a ā -a) : āaā ⤠ābā := by
apply solid
rw [abs]
nth_rw 1 [ā neg_neg a]
rw [ā neg_inf]
rw [abs]
nth_rw 1 [ā neg_neg b]
rwa [ā neg_inf, neg_le_neg_iff, inf_comm _ b, inf_comm _ a]
-- see Note [lower instance priority]
/-- Let `α` be a normed lattice ordered group, then the order dual is also a
normed lattice ordered group.
-/
instance (priority := 100) OrderDual.instHasSolidNorm :
HasSolidNorm αįµįµ :=
{ solid := dual_solid (α := α) }
theorem norm_abs_eq_norm (a : α) : ā|a|ā = āaā :=
(solid (abs_abs a).le).antisymm (solid (abs_abs a).symm.le)
theorem norm_inf_sub_inf_le_add_norm (a b c d : α) : āa ā b - c ā dā ⤠āa - cā + āb - dā := by
rw [ā norm_abs_eq_norm (a - c), ā norm_abs_eq_norm (b - d)]
refine le_trans (solid ?_) (norm_add_le |a - c| |b - d|)
rw [abs_of_nonneg (add_nonneg (abs_nonneg (a - c)) (abs_nonneg (b - d)))]
calc
|a ā b - c ā d| = |a ā b - c ā b + (c ā b - c ā d)| := by rw [sub_add_sub_cancel]
_ ⤠|a ā b - c ā b| + |c ā b - c ā d| := abs_add_le _ _
_ ⤠|a - c| + |b - d| := by
gcongr ?_ + ?_
Ā· exact abs_inf_sub_inf_le_abs _ _ _
Ā· rw [inf_comm c, inf_comm c]
exact abs_inf_sub_inf_le_abs _ _ _
theorem norm_sup_sub_sup_le_add_norm (a b c d : α) : āa ā b - c ā dā ⤠āa - cā + āb - dā := by
rw [ā norm_abs_eq_norm (a - c), ā norm_abs_eq_norm (b - d)]
refine le_trans (solid ?_) (norm_add_le |a - c| |b - d|)
rw [abs_of_nonneg (add_nonneg (abs_nonneg (a - c)) (abs_nonneg (b - d)))]
calc
|a ā b - c ā d| = |a ā b - c ā b + (c ā b - c ā d)| := by rw [sub_add_sub_cancel]
_ ⤠|a ā b - c ā b| + |c ā b - c ā d| := abs_add_le _ _
_ ⤠|a - c| + |b - d| := by
gcongr ?_ + ?_
Ā· exact abs_sup_sub_sup_le_abs _ _ _
Ā· rw [sup_comm c, sup_comm c]
exact abs_sup_sub_sup_le_abs _ _ _
theorem norm_inf_le_add (x y : α) : āx ā yā ⤠āxā + āyā := by
have h : āx ā y - 0 ā 0ā ⤠āx - 0ā + āy - 0ā := norm_inf_sub_inf_le_add_norm x y 0 0
simpa only [inf_idem, sub_zero] using h
theorem norm_sup_le_add (x y : α) : āx ā yā ⤠āxā + āyā := by
have h : āx ā y - 0 ā 0ā ⤠āx - 0ā + āy - 0ā := norm_sup_sub_sup_le_add_norm x y 0 0
simpa only [sup_idem, sub_zero] using h
-- see Note [lower instance priority]
/-- Let `α` be a normed lattice ordered group. Then the infimum is jointly continuous.
-/
instance (priority := 100) HasSolidNorm.continuousInf : ContinuousInf α := by
refine āØcontinuous_iff_continuousAt.2 fun q => tendsto_iff_norm_sub_tendsto_zero.2 <| ?_ā©
have : ā p : α à α, āp.1 ā p.2 - q.1 ā q.2ā ⤠āp.1 - q.1ā + āp.2 - q.2ā := fun _ =>
norm_inf_sub_inf_le_add_norm _ _ _ _
refine squeeze_zero (fun e => norm_nonneg _) this ?_
convert ((continuous_fst.tendsto q).sub <| tendsto_const_nhds).norm.add
((continuous_snd.tendsto q).sub <| tendsto_const_nhds).norm
simp
-- see Note [lower instance priority]
instance (priority := 100) HasSolidNorm.continuousSup {α : Type*}
[NormedAddCommGroup α] [Lattice α] [HasSolidNorm α] [IsOrderedAddMonoid α] : ContinuousSup α :=
OrderDual.continuousSup αįµįµ
-- see Note [lower instance priority]
/--
Let `α` be a normed lattice ordered group. Then `α` is a topological lattice in the norm topology.
-/
instance (priority := 100) HasSolidNorm.toTopologicalLattice : TopologicalLattice α :=
TopologicalLattice.mk
theorem norm_abs_sub_abs (a b : α) : ā|a| - |b|ā ⤠āa - bā := solid (abs_abs_sub_abs_le _ _)
theorem norm_sup_sub_sup_le_norm (x y z : α) : āx ā z - y ā zā ⤠āx - yā :=
solid (abs_sup_sub_sup_le_abs x y z)
theorem norm_inf_sub_inf_le_norm (x y z : α) : āx ā z - y ā zā ⤠āx - yā :=
solid (abs_inf_sub_inf_le_abs x y z)
theorem lipschitzWith_sup_right (z : α) : LipschitzWith 1 fun x => x ā z :=
LipschitzWith.of_dist_le_mul fun x y => by
rw [NNReal.coe_one, one_mul, dist_eq_norm, dist_eq_norm]
exact norm_sup_sub_sup_le_norm x y z
lemma lipschitzWith_posPart : LipschitzWith 1 (posPart : α ā α) :=
lipschitzWith_sup_right 0
lemma lipschitzWith_negPart : LipschitzWith 1 (negPart : α ā α) := by
simpa [Function.comp] using lipschitzWith_posPart.comp LipschitzWith.id.neg
@[fun_prop]
lemma continuous_posPart : Continuous (posPart : α ā α) := lipschitzWith_posPart.continuous
@[fun_prop]
lemma continuous_negPart : Continuous (negPart : α ā α) := lipschitzWith_negPart.continuous
lemma isClosed_nonneg : IsClosed {x : α | 0 ⤠x} := by
have : {x : α | 0 ⤠x} = negPart ā»Ā¹' {0} := by ext; simp [negPart_eq_zero]
rw [this]
exact isClosed_singleton.preimage continuous_negPart
theorem isClosed_le_of_isClosed_nonneg {G}
[AddCommGroup G] [PartialOrder G] [IsOrderedAddMonoid G] [TopologicalSpace G]
[ContinuousSub G] (h : IsClosed { x : G | 0 ⤠x }) :
IsClosed { p : G à G | p.fst ⤠p.snd } := by
have : { p : G Ć G | p.fst ⤠p.snd } = (fun p : G Ć G => p.snd - p.fst) ā»Ā¹' { x : G | 0 ⤠x } :=
by ext1 p; simp only [sub_nonneg, Set.preimage_setOf_eq]
rw [this]
exact IsClosed.preimage (continuous_snd.sub continuous_fst) h
-- See note [lower instance priority]
instance (priority := 100) HasSolidNorm.orderClosedTopology {E}
[NormedAddCommGroup E] [Lattice E] [HasSolidNorm E] [IsOrderedAddMonoid E] :
OrderClosedTopology E :=
āØisClosed_le_of_isClosed_nonneg isClosed_nonnegā© |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Order/Hom/Ultra.lean | import Mathlib.Analysis.Normed.Order.Hom.Basic
import Mathlib.Topology.MetricSpace.Ultra.Basic
/-!
# Constructing nonarchimedean (ultrametric) normed groups from nonarchimedean normed homs
This file defines constructions that upgrade `Add(Comm)Group` to `(Semi)NormedAdd(Comm)Group`
using an `AddGroup(Semi)normClass` when the codomain is the reals and the hom is nonarchimedean.
## Implementation details
The lemmas need to assume `[Dist α]` to be able to be stated, so they take an extra argument
that shows that this distance instance is propositionally equal to the one that comes from the
hom-based `AddGroupSeminormClass.toSeminormedAddGroup f` construction. To help at use site,
the argument is an autoparam that resolves by definitional equality when using these constructions.
-/
variable {F α : Type*} [FunLike F α ā]
/-- Proves that when a `SeminormedAddGroup` structure is constructed from an
`AddGroupSeminormClass` that satisfies `IsNonarchimedean`, the group has an `IsUltrametricDist`. -/
lemma AddGroupSeminormClass.isUltrametricDist [AddGroup α] [AddGroupSeminormClass F α ā]
[inst : Dist α] {f : F} (hna : IsNonarchimedean f)
(hd : inst = (AddGroupSeminormClass.toSeminormedAddGroup f).toDist := by rfl) :
IsUltrametricDist α :=
āØfun x y z ⦠by simpa only [hd, dist_eq_norm, AddGroupSeminormClass.toSeminormedAddGroup_norm_eq,
ā sub_add_sub_cancel x y z] using hna _ _ā© |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Order/Hom/Basic.lean | import Mathlib.Algebra.Order.Hom.Basic
import Mathlib.Analysis.Normed.Group.Basic
/-!
# Constructing (semi)normed groups from (semi)normed homs
This file defines constructions that upgrade `(Comm)Group` to `(Semi)Normed(Comm)Group`
using a `Group(Semi)normClass` when the codomain is the reals.
See `Mathlib/Analysis/Normed/Order/Hom/Ultra.lean` for further upgrades to nonarchimedean normed
groups.
-/
variable {F α : Type*} [FunLike F α ā]
/-- Constructs a `SeminormedGroup` structure from a `GroupSeminormClass` on a `Group`. -/
-- See note [reducible non-instances]
@[to_additive /-- Constructs a `SeminormedAddGroup` structure from an `AddGroupSeminormClass` on an
`AddGroup`. -/]
abbrev GroupSeminormClass.toSeminormedGroup [Group α] [GroupSeminormClass F α ā]
(f : F) : SeminormedGroup α where
norm := f
dist x y := f (x / y)
dist_eq _ _ := rfl
dist_self _ := by simp
dist_comm x y := by simp only [ā map_inv_eq_map f (x / y), inv_div]
dist_triangle x y z := by simpa using map_mul_le_add f (x / y) (y / z)
@[to_additive]
lemma GroupSeminormClass.toSeminormedGroup_norm_eq [Group α] [GroupSeminormClass F α ā]
(f : F) (x : α) : @norm _ (GroupSeminormClass.toSeminormedGroup f).toNorm x = f x := rfl
/-- Constructs a `SeminormedCommGroup` structure from a `GroupSeminormClass` on a `CommGroup`. -/
-- See note [reducible non-instances]
@[to_additive /-- Constructs a `SeminormedAddCommGroup` structure from an `AddGroupSeminormClass`
on an `AddCommGroup`. -/]
abbrev GroupSeminormClass.toSeminormedCommGroup [CommGroup α] [GroupSeminormClass F α ā]
(f : F) : SeminormedCommGroup α where
__ := GroupSeminormClass.toSeminormedGroup f
__ : CommGroup α := inferInstance
@[to_additive]
lemma GroupSeminormClass.toSeminormedCommGroup_norm_eq [CommGroup α] [GroupSeminormClass F α ā]
(f : F) (x : α) : @norm _ (GroupSeminormClass.toSeminormedCommGroup f).toNorm x = f x := rfl
/-- Constructs a `NormedGroup` structure from a `GroupNormClass` on a `Group`. -/
-- See note [reducible non-instances]
@[to_additive /-- Constructs a `NormedAddGroup` structure from an `AddGroupNormClass` on an
`AddGroup`. -/]
abbrev GroupNormClass.toNormedGroup [Group α] [GroupNormClass F α ā]
(f : F) : NormedGroup α where
__ := GroupSeminormClass.toSeminormedGroup f
eq_of_dist_eq_zero h := div_eq_one.mp (eq_one_of_map_eq_zero f h)
@[to_additive]
lemma GroupNormClass.toNormedGroup_norm_eq [Group α] [GroupNormClass F α ā]
(f : F) (x : α) : @norm _ (GroupNormClass.toNormedGroup f).toNorm x = f x := rfl
/-- Constructs a `NormedCommGroup` structure from a `GroupNormClass` on a `CommGroup`. -/
-- See note [reducible non-instances]
@[to_additive /-- Constructs a `NormedAddCommGroup` structure from an `AddGroupNormClass` on an
`AddCommGroup`. -/]
abbrev GroupNormClass.toNormedCommGroup [CommGroup α] [GroupNormClass F α ā]
(f : F) : NormedCommGroup α where
__ := GroupNormClass.toNormedGroup f
__ : CommGroup α := inferInstance
@[to_additive]
lemma GroupNormClass.toNormedCommGroup_norm_eq [CommGroup α] [GroupNormClass F α ā]
(f : F) (x : α) : @norm _ (GroupNormClass.toNormedCommGroup f).toNorm x = f x := rfl |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Group/HomCompletion.lean | import Mathlib.Analysis.Normed.Group.Hom
import Mathlib.Analysis.Normed.Group.Completion
/-!
# Completion of normed group homs
Given two (semi) normed groups `G` and `H` and a normed group hom `f : NormedAddGroupHom G H`,
we build and study a normed group hom
`f.completion : NormedAddGroupHom (completion G) (completion H)` such that the diagram
```
f
G -----------> H
| |
| |
| |
V V
completion G -----------> completion H
f.completion
```
commutes. The map itself comes from the general theory of completion of uniform spaces, but here
we want a normed group hom, study its operator norm and kernel.
The vertical maps in the above diagrams are also normed group homs constructed in this file.
## Main definitions and results:
* `NormedAddGroupHom.completion`: see the discussion above.
* `NormedAddCommGroup.toCompl : NormedAddGroupHom G (completion G)`: the canonical map from
`G` to its completion, as a normed group hom
* `NormedAddGroupHom.completion_toCompl`: the above diagram indeed commutes.
* `NormedAddGroupHom.norm_completion`: `āf.completionā = āfā`
* `NormedAddGroupHom.ker_le_ker_completion`: the kernel of `f.completion` contains the image of
the kernel of `f`.
* `NormedAddGroupHom.ker_completion`: the kernel of `f.completion` is the closure of the image of
the kernel of `f` under an assumption that `f` is quantitatively surjective onto its image.
* `NormedAddGroupHom.extension` : if `H` is complete, the extension of
`f : NormedAddGroupHom G H` to a `NormedAddGroupHom (completion G) H`.
-/
noncomputable section
open Set NormedAddGroupHom UniformSpace
section Completion
variable {G : Type*} [SeminormedAddCommGroup G] {H : Type*} [SeminormedAddCommGroup H]
{K : Type*} [SeminormedAddCommGroup K]
/-- The normed group hom induced between completions. -/
def NormedAddGroupHom.completion (f : NormedAddGroupHom G H) :
NormedAddGroupHom (Completion G) (Completion H) :=
.ofLipschitz (f.toAddMonoidHom.completion f.continuous) f.lipschitz.completion_map
theorem NormedAddGroupHom.completion_def (f : NormedAddGroupHom G H) (x : Completion G) :
f.completion x = Completion.map f x :=
rfl
@[simp]
theorem NormedAddGroupHom.completion_coe_to_fun (f : NormedAddGroupHom G H) :
(f.completion : Completion G ā Completion H) = Completion.map f := rfl
theorem NormedAddGroupHom.completion_coe (f : NormedAddGroupHom G H) (g : G) :
f.completion g = f g :=
Completion.map_coe f.uniformContinuous _
@[simp]
theorem NormedAddGroupHom.completion_coe' (f : NormedAddGroupHom G H) (g : G) :
Completion.map f g = f g :=
f.completion_coe g
/-- Completion of normed group homs as a normed group hom. -/
@[simps]
def normedAddGroupHomCompletionHom :
NormedAddGroupHom G H ā+ NormedAddGroupHom (Completion G) (Completion H) where
toFun := NormedAddGroupHom.completion
map_zero' := toAddMonoidHom_injective AddMonoidHom.completion_zero
map_add' f g := toAddMonoidHom_injective <|
f.toAddMonoidHom.completion_add g.toAddMonoidHom f.continuous g.continuous
@[simp]
theorem NormedAddGroupHom.completion_id :
(NormedAddGroupHom.id G).completion = NormedAddGroupHom.id (Completion G) := by
ext x
rw [NormedAddGroupHom.completion_def, NormedAddGroupHom.coe_id, Completion.map_id]
rfl
theorem NormedAddGroupHom.completion_comp (f : NormedAddGroupHom G H) (g : NormedAddGroupHom H K) :
g.completion.comp f.completion = (g.comp f).completion := by
ext x
rw [NormedAddGroupHom.coe_comp, NormedAddGroupHom.completion_def,
NormedAddGroupHom.completion_coe_to_fun, NormedAddGroupHom.completion_coe_to_fun,
Completion.map_comp g.uniformContinuous f.uniformContinuous]
rfl
theorem NormedAddGroupHom.completion_neg (f : NormedAddGroupHom G H) :
(-f).completion = -f.completion :=
map_neg (normedAddGroupHomCompletionHom : NormedAddGroupHom G H ā+ _) f
theorem NormedAddGroupHom.completion_add (f g : NormedAddGroupHom G H) :
(f + g).completion = f.completion + g.completion :=
normedAddGroupHomCompletionHom.map_add f g
theorem NormedAddGroupHom.completion_sub (f g : NormedAddGroupHom G H) :
(f - g).completion = f.completion - g.completion :=
map_sub (normedAddGroupHomCompletionHom : NormedAddGroupHom G H ā+ _) f g
@[simp]
theorem NormedAddGroupHom.zero_completion : (0 : NormedAddGroupHom G H).completion = 0 :=
normedAddGroupHomCompletionHom.map_zero
/-- The map from a normed group to its completion, as a normed group hom. -/
@[simps]
def NormedAddCommGroup.toCompl : NormedAddGroupHom G (Completion G) where
toFun := (ā)
map_add' := Completion.toCompl.map_add
bound' := āØ1, by simp [le_refl]ā©
open NormedAddCommGroup
theorem NormedAddCommGroup.norm_toCompl (x : G) : ātoCompl xā = āxā :=
Completion.norm_coe x
theorem NormedAddCommGroup.denseRange_toCompl : DenseRange (toCompl : G ā Completion G) :=
Completion.isDenseInducing_coe.dense
@[simp]
theorem NormedAddGroupHom.completion_toCompl (f : NormedAddGroupHom G H) :
f.completion.comp toCompl = toCompl.comp f := by ext x; simp
@[simp]
theorem NormedAddGroupHom.norm_completion (f : NormedAddGroupHom G H) : āf.completionā = āfā :=
le_antisymm (ofLipschitz_norm_le _ _) <| opNorm_le_bound _ (norm_nonneg _) fun x => by
simpa using f.completion.le_opNorm x
theorem NormedAddGroupHom.ker_le_ker_completion (f : NormedAddGroupHom G H) :
(toCompl.comp <| incl f.ker).range ⤠f.completion.ker := by
rintro _ āØāØg, hā : f g = 0ā©, rflā©
simp [hā, mem_ker, Completion.coe_zero]
theorem NormedAddGroupHom.ker_completion {f : NormedAddGroupHom G H} {C : ā}
(h : f.SurjectiveOnWith f.range C) :
(f.completion.ker : Set <| Completion G) = closure (toCompl.comp <| incl f.ker).range := by
refine le_antisymm ?_ (closure_minimal f.ker_le_ker_completion f.completion.isClosed_ker)
rintro hatg (hatg_in : f.completion hatg = 0)
rw [SeminormedAddCommGroup.mem_closure_iff]
intro ε ε_pos
rcases h.exists_pos with āØC', C'_pos, hC'ā©
rcases exists_pos_mul_lt ε_pos (1 + C' * āfā) with āØĪ“, Ī“_pos, hĪ“ā©
obtain āØ_, āØg : G, rflā©, hg : āhatg - gā < Γ⩠:=
SeminormedAddCommGroup.mem_closure_iff.mp (Completion.isDenseInducing_coe.dense hatg) Γ Γ_pos
obtain āØg' : G, hgg' : f g' = f g, hfg : āg'ā ⤠C' * āf gāā© := hC' (f g) (mem_range_self _ g)
have mem_ker : g - g' ā f.ker := by rw [f.mem_ker, map_sub, sub_eq_zero.mpr hgg'.symm]
refine āØ_, āØāØg - g', mem_kerā©, rflā©, ?_ā©
have : āf gā ⤠āfā * Ī“ := calc
āf gā ⤠āfā * āhatg - gā := by
simpa [map_sub, hatg_in] using f.completion.le_opNorm (hatg - g)
_ ⤠āfā * Ī“ := by gcongr
calc āhatg - ā(g - g')ā = āhatg - g + g'ā := by rw [Completion.coe_sub, sub_add]
_ ⤠āhatg - gā + ā(g' : Completion G)ā := norm_add_le _ _
_ = āhatg - gā + āg'ā := by rw [Completion.norm_coe]
_ < Ī“ + C' * āf gā := add_lt_add_of_lt_of_le hg hfg
_ ⤠Γ + C' * (āfā * Ī“) := by gcongr
_ < ε := by simpa only [add_mul, one_mul, mul_assoc] using hΓ
end Completion
section Extension
variable {G : Type*} [SeminormedAddCommGroup G]
variable {H : Type*} [SeminormedAddCommGroup H] [T0Space H] [CompleteSpace H]
/-- If `H` is complete, the extension of `f : NormedAddGroupHom G H` to a
`NormedAddGroupHom (completion G) H`. -/
def NormedAddGroupHom.extension (f : NormedAddGroupHom G H) : NormedAddGroupHom (Completion G) H :=
.ofLipschitz (f.toAddMonoidHom.extension f.continuous) <|
let _ := MetricSpace.ofT0PseudoMetricSpace H
f.lipschitz.completion_extension
theorem NormedAddGroupHom.extension_def (f : NormedAddGroupHom G H) (v : G) :
f.extension v = Completion.extension f v :=
rfl
@[simp]
theorem NormedAddGroupHom.extension_coe (f : NormedAddGroupHom G H) (v : G) : f.extension v = f v :=
AddMonoidHom.extension_coe _ f.continuous _
theorem NormedAddGroupHom.extension_coe_to_fun (f : NormedAddGroupHom G H) :
(f.extension : Completion G ā H) = Completion.extension f :=
rfl
theorem NormedAddGroupHom.extension_unique (f : NormedAddGroupHom G H)
{g : NormedAddGroupHom (Completion G) H} (hg : ā v, f v = g v) : f.extension = g := by
ext v
rw [NormedAddGroupHom.extension_coe_to_fun,
Completion.extension_unique f.uniformContinuous g.uniformContinuous fun a => hg a]
end Extension |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Group/Int.lean | import Mathlib.Analysis.Normed.Group.Basic
import Mathlib.Topology.Instances.Int
/-! # ⤠as a normed group -/
open NNReal
variable {α : Type*}
namespace Int
instance instNormedAddCommGroup : NormedAddCommGroup ⤠where
norm n := ā(n : ā)ā
dist_eq m n := by simp only [Int.dist_eq, norm, Int.cast_sub]
@[norm_cast]
theorem norm_cast_real (m : ā¤) : ā(m : ā)ā = āmā :=
rfl
theorem norm_eq_abs (n : ā¤) : ānā = |(n : ā)| :=
rfl
theorem norm_natCast (n : ā) : ā(n : ā¤)ā = n := by simp [Int.norm_eq_abs]
theorem _root_.NNReal.natCast_natAbs (n : ā¤) : (n.natAbs : āā„0) = ānāā :=
NNReal.eq <|
calc
((n.natAbs : āā„0) : ā) = (n.natAbs : ā¤) := by simp only [Int.cast_natCast, NNReal.coe_natCast]
_ = |(n : ā)| := by simp only [Int.natCast_natAbs, Int.cast_abs]
_ = ānā := (norm_eq_abs n).symm
theorem abs_le_floor_nnreal_iff (z : ā¤) (c : āā„0) : |z| ⤠ācāā ā āzāā ⤠c := by
rw [Int.abs_eq_natAbs, Int.ofNat_le, Nat.le_floor_iff (zero_le c), NNReal.natCast_natAbs z]
end Int
-- Now that we've installed the norm on `ā¤`,
-- we can state some lemmas about `zsmul`.
section
variable [SeminormedCommGroup α]
@[to_additive norm_zsmul_le]
theorem norm_zpow_le_mul_norm (n : ā¤) (a : α) : āa ^ nā ⤠ānā * āaā := by
rcases n.eq_nat_or_neg with āØn, rfl | rflā© <;> simpa [Int.norm_natCast] using norm_pow_le_mul_norm
@[to_additive nnnorm_zsmul_le]
theorem nnnorm_zpow_le_mul_norm (n : ā¤) (a : α) : āa ^ nāā ⤠ānāā * āaāā := by
simpa only [ā NNReal.coe_le_coe, NNReal.coe_mul] using norm_zpow_le_mul_norm n a
end |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Group/Uniform.lean | import Mathlib.Analysis.Normed.Group.Continuity
import Mathlib.Topology.Algebra.IsUniformGroup.Basic
import Mathlib.Topology.MetricSpace.Algebra
import Mathlib.Topology.MetricSpace.IsometricSMul
/-!
# Normed groups are uniform groups
This file proves lipschitzness of normed group operations and shows that normed groups are uniform
groups.
-/
variable {š E F : Type*}
open Filter Function Metric Bornology
open scoped ENNReal NNReal Uniformity Pointwise Topology
section SeminormedGroup
variable [SeminormedGroup E] [SeminormedGroup F] {s : Set E} {a b : E} {r : ā}
@[to_additive]
instance NormedGroup.to_isIsometricSMul_right : IsIsometricSMul Eįµįµįµ E :=
āØfun a => Isometry.of_dist_eq fun b c => by simp [dist_eq_norm_div]ā©
@[to_additive]
theorem Isometry.norm_map_of_map_one {f : E ā F} (hi : Isometry f) (hā : f 1 = 1) (x : E) :
āf xā = āxā := by rw [ā dist_one_right, ā hā, hi.dist_eq, dist_one_right]
@[to_additive (attr := simp) norm_map]
theorem norm_map' [FunLike š E F] [IsometryClass š E F] [OneHomClass š E F] (f : š) (x : E) :
āf xā = āxā :=
(IsometryClass.isometry f).norm_map_of_map_one (map_one f) x
@[to_additive (attr := simp) nnnorm_map]
theorem nnnorm_map' [FunLike š E F] [IsometryClass š E F] [OneHomClass š E F] (f : š) (x : E) :
āf xāā = āxāā :=
NNReal.eq <| norm_map' f x
@[to_additive (attr := simp)]
theorem dist_mul_self_right (a b : E) : dist b (a * b) = āaā := by
rw [ā dist_one_left, ā dist_mul_right 1 a b, one_mul]
@[to_additive (attr := simp)]
theorem dist_mul_self_left (a b : E) : dist (a * b) b = āaā := by
rw [dist_comm, dist_mul_self_right]
@[to_additive (attr := simp)]
theorem dist_div_eq_dist_mul_left (a b c : E) : dist (a / b) c = dist a (c * b) := by
rw [ā dist_mul_right _ _ b, div_mul_cancel]
@[to_additive (attr := simp)]
theorem dist_div_eq_dist_mul_right (a b c : E) : dist a (b / c) = dist (a * c) b := by
rw [ā dist_mul_right _ _ c, div_mul_cancel]
open Finset
variable [FunLike š E F]
/-- A homomorphism `f` of seminormed groups is Lipschitz, if there exists a constant `C` such that
for all `x`, one has `āf xā ⤠C * āxā`. The analogous condition for a linear map of
(semi)normed spaces is in `Mathlib/Analysis/NormedSpace/OperatorNorm.lean`. -/
@[to_additive /-- A homomorphism `f` of seminormed groups is Lipschitz, if there exists a constant
`C` such that for all `x`, one has `āf xā ⤠C * āxā`. The analogous condition for a linear map of
(semi)normed spaces is in `Mathlib/Analysis/NormedSpace/OperatorNorm.lean`. -/]
theorem MonoidHomClass.lipschitz_of_bound [MonoidHomClass š E F] (f : š) (C : ā)
(h : ā x, āf xā ⤠C * āxā) : LipschitzWith (Real.toNNReal C) f :=
LipschitzWith.of_dist_le' fun x y => by simpa only [dist_eq_norm_div, map_div] using h (x / y)
@[to_additive]
theorem lipschitzOnWith_iff_norm_div_le {f : E ā F} {C : āā„0} :
LipschitzOnWith C f s ā ā ā¦xā¦, x ā s ā ā ā¦yā¦, y ā s ā āf x / f yā ⤠C * āx / yā := by
simp only [lipschitzOnWith_iff_dist_le_mul, dist_eq_norm_div]
alias āØLipschitzOnWith.norm_div_le, _ā© := lipschitzOnWith_iff_norm_div_le
attribute [to_additive] LipschitzOnWith.norm_div_le
@[to_additive]
theorem LipschitzOnWith.norm_div_le_of_le {f : E ā F} {C : āā„0} (h : LipschitzOnWith C f s)
(ha : a ā s) (hb : b ā s) (hr : āa / bā ⤠r) : āf a / f bā ⤠C * r :=
(h.norm_div_le ha hb).trans <| by gcongr
@[to_additive]
theorem lipschitzWith_iff_norm_div_le {f : E ā F} {C : āā„0} :
LipschitzWith C f ā ā x y, āf x / f yā ⤠C * āx / yā := by
simp only [lipschitzWith_iff_dist_le_mul, dist_eq_norm_div]
alias āØLipschitzWith.norm_div_le, _ā© := lipschitzWith_iff_norm_div_le
attribute [to_additive] LipschitzWith.norm_div_le
@[to_additive]
theorem LipschitzWith.norm_div_le_of_le {f : E ā F} {C : āā„0} (h : LipschitzWith C f)
(hr : āa / bā ⤠r) : āf a / f bā ⤠C * r :=
(h.norm_div_le _ _).trans <| by gcongr
/-- A homomorphism `f` of seminormed groups is continuous, if there exists a constant `C` such that
for all `x`, one has `āf xā ⤠C * āxā`. -/
@[to_additive /-- A homomorphism `f` of seminormed groups is continuous, if there exists a constant
`C` such that for all `x`, one has `āf xā ⤠C * āxā`. -/]
theorem MonoidHomClass.continuous_of_bound [MonoidHomClass š E F] (f : š) (C : ā)
(h : ā x, āf xā ⤠C * āxā) : Continuous f :=
(MonoidHomClass.lipschitz_of_bound f C h).continuous
@[to_additive]
theorem MonoidHomClass.uniformContinuous_of_bound [MonoidHomClass š E F] (f : š) (C : ā)
(h : ā x, āf xā ⤠C * āxā) : UniformContinuous f :=
(MonoidHomClass.lipschitz_of_bound f C h).uniformContinuous
@[to_additive]
theorem MonoidHomClass.isometry_iff_norm [MonoidHomClass š E F] (f : š) :
Isometry f ā ā x, āf xā = āxā := by
simp only [isometry_iff_dist_eq, dist_eq_norm_div, ā map_div]
refine āØfun h x => ?_, fun h x y => h _ā©
simpa using h x 1
alias āØ_, MonoidHomClass.isometry_of_normā© := MonoidHomClass.isometry_iff_norm
attribute [to_additive] MonoidHomClass.isometry_of_norm
section NNNorm
@[to_additive]
theorem MonoidHomClass.lipschitz_of_bound_nnnorm [MonoidHomClass š E F] (f : š) (C : āā„0)
(h : ā x, āf xāā ⤠C * āxāā) : LipschitzWith C f :=
@Real.toNNReal_coe C āø MonoidHomClass.lipschitz_of_bound f C h
@[to_additive]
theorem MonoidHomClass.antilipschitz_of_bound [MonoidHomClass š E F] (f : š) {K : āā„0}
(h : ā x, āxā ⤠K * āf xā) : AntilipschitzWith K f :=
AntilipschitzWith.of_le_mul_dist fun x y => by
simpa only [dist_eq_norm_div, map_div] using h (x / y)
@[to_additive LipschitzWith.norm_le_mul]
theorem LipschitzWith.norm_le_mul' {f : E ā F} {K : āā„0} (h : LipschitzWith K f) (hf : f 1 = 1)
(x) : āf xā ⤠K * āxā := by simpa only [dist_one_right, hf] using h.dist_le_mul x 1
@[to_additive LipschitzWith.nnorm_le_mul]
theorem LipschitzWith.nnorm_le_mul' {f : E ā F} {K : āā„0} (h : LipschitzWith K f) (hf : f 1 = 1)
(x) : āf xāā ⤠K * āxāā :=
h.norm_le_mul' hf x
@[to_additive AntilipschitzWith.le_mul_norm]
theorem AntilipschitzWith.le_mul_norm' {f : E ā F} {K : āā„0} (h : AntilipschitzWith K f)
(hf : f 1 = 1) (x) : āxā ⤠K * āf xā := by
simpa only [dist_one_right, hf] using h.le_mul_dist x 1
@[to_additive AntilipschitzWith.le_mul_nnnorm]
theorem AntilipschitzWith.le_mul_nnnorm' {f : E ā F} {K : āā„0} (h : AntilipschitzWith K f)
(hf : f 1 = 1) (x) : āxāā ⤠K * āf xāā :=
h.le_mul_norm' hf x
@[to_additive]
theorem OneHomClass.bound_of_antilipschitz [OneHomClass š E F] (f : š) {K : āā„0}
(h : AntilipschitzWith K f) (x) : āxā ⤠K * āf xā :=
h.le_mul_nnnorm' (map_one f) x
@[to_additive]
theorem Isometry.nnnorm_map_of_map_one {f : E ā F} (hi : Isometry f) (hā : f 1 = 1) (x : E) :
āf xāā = āxāā :=
Subtype.ext <| hi.norm_map_of_map_one hā x
end NNNorm
@[to_additive lipschitzWith_one_norm]
theorem lipschitzWith_one_norm' : LipschitzWith 1 (norm : E ā ā) := by
simpa using LipschitzWith.dist_right (1 : E)
@[to_additive lipschitzWith_one_nnnorm]
theorem lipschitzWith_one_nnnorm' : LipschitzWith 1 (NNNorm.nnnorm : E ā āā„0) :=
lipschitzWith_one_norm'
@[to_additive uniformContinuous_norm]
theorem uniformContinuous_norm' : UniformContinuous (norm : E ā ā) :=
lipschitzWith_one_norm'.uniformContinuous
@[to_additive uniformContinuous_nnnorm]
theorem uniformContinuous_nnnorm' : UniformContinuous fun a : E => āaāā :=
uniformContinuous_norm'.subtype_mk _
end SeminormedGroup
section SeminormedCommGroup
variable [SeminormedCommGroup E] [SeminormedCommGroup F] {aā aā bā bā : E} {rā rā : ā}
@[to_additive]
instance NormedGroup.to_isIsometricSMul_left : IsIsometricSMul E E :=
āØfun a => Isometry.of_dist_eq fun b c => by simp [dist_eq_norm_div]ā©
@[to_additive (attr := simp)]
theorem dist_self_mul_right (a b : E) : dist a (a * b) = ābā := by
rw [ā dist_one_left, ā dist_mul_left a 1 b, mul_one]
@[to_additive (attr := simp)]
theorem dist_self_mul_left (a b : E) : dist (a * b) a = ābā := by
rw [dist_comm, dist_self_mul_right]
@[to_additive (attr := simp 1001)] -- Increase priority because `simp` can prove this
theorem dist_self_div_right (a b : E) : dist a (a / b) = ābā := by
rw [div_eq_mul_inv, dist_self_mul_right, norm_inv']
@[to_additive (attr := simp 1001)] -- Increase priority because `simp` can prove this
theorem dist_self_div_left (a b : E) : dist (a / b) a = ābā := by
rw [dist_comm, dist_self_div_right]
@[to_additive]
theorem dist_mul_mul_le (aā aā bā bā : E) : dist (aā * aā) (bā * bā) ⤠dist aā bā + dist aā bā := by
simpa only [dist_mul_left, dist_mul_right] using dist_triangle (aā * aā) (bā * aā) (bā * bā)
@[to_additive]
theorem dist_mul_mul_le_of_le (hā : dist aā bā ⤠rā) (hā : dist aā bā ⤠rā) :
dist (aā * aā) (bā * bā) ⤠rā + rā :=
(dist_mul_mul_le aā aā bā bā).trans <| add_le_add hā hā
@[to_additive]
theorem dist_div_div_le (aā aā bā bā : E) : dist (aā / aā) (bā / bā) ⤠dist aā bā + dist aā bā := by
simpa only [div_eq_mul_inv, dist_inv_inv] using dist_mul_mul_le aā aāā»Ā¹ bā bāā»Ā¹
@[to_additive]
theorem dist_div_div_le_of_le (hā : dist aā bā ⤠rā) (hā : dist aā bā ⤠rā) :
dist (aā / aā) (bā / bā) ⤠rā + rā :=
(dist_div_div_le aā aā bā bā).trans <| add_le_add hā hā
@[to_additive]
theorem abs_dist_sub_le_dist_mul_mul (aā aā bā bā : E) :
|dist aā bā - dist aā bā| ⤠dist (aā * aā) (bā * bā) := by
simpa only [dist_mul_left, dist_mul_right, dist_comm bā] using
abs_dist_sub_le (aā * aā) (bā * bā) (bā * aā)
open Finset
@[to_additive]
theorem nndist_mul_mul_le (aā aā bā bā : E) :
nndist (aā * aā) (bā * bā) ⤠nndist aā bā + nndist aā bā :=
NNReal.coe_le_coe.1 <| dist_mul_mul_le aā aā bā bā
@[to_additive]
theorem edist_mul_mul_le (aā aā bā bā : E) :
edist (aā * aā) (bā * bā) ⤠edist aā bā + edist aā bā := by
simp only [edist_nndist]
norm_cast
apply nndist_mul_mul_le
section PseudoEMetricSpace
variable {α E : Type*} [SeminormedCommGroup E] [PseudoEMetricSpace α] {K Kf Kg : āā„0}
{f g : α ā E} {s : Set α}
@[to_additive (attr := simp)]
lemma lipschitzWith_inv_iff : LipschitzWith K fā»Ā¹ ā LipschitzWith K f := by simp [LipschitzWith]
@[to_additive (attr := simp)]
lemma antilipschitzWith_inv_iff : AntilipschitzWith K fā»Ā¹ ā AntilipschitzWith K f := by
simp [AntilipschitzWith]
@[to_additive (attr := simp)]
lemma lipschitzOnWith_inv_iff : LipschitzOnWith K fā»Ā¹ s ā LipschitzOnWith K f s := by
simp [LipschitzOnWith]
@[to_additive (attr := simp)]
lemma locallyLipschitz_inv_iff : LocallyLipschitz fā»Ā¹ ā LocallyLipschitz f := by
simp [LocallyLipschitz]
@[to_additive (attr := simp)]
lemma locallyLipschitzOn_inv_iff : LocallyLipschitzOn s fā»Ā¹ ā LocallyLipschitzOn s f := by
simp [LocallyLipschitzOn]
@[to_additive] alias āØLipschitzWith.of_inv, LipschitzWith.invā© := lipschitzWith_inv_iff
@[to_additive] alias āØAntilipschitzWith.of_inv, AntilipschitzWith.invā© := antilipschitzWith_inv_iff
@[to_additive] alias āØLipschitzOnWith.of_inv, LipschitzOnWith.invā© := lipschitzOnWith_inv_iff
@[to_additive] alias āØLocallyLipschitz.of_inv, LocallyLipschitz.invā© := locallyLipschitz_inv_iff
@[to_additive]
alias āØLocallyLipschitzOn.of_inv, LocallyLipschitzOn.invā© := locallyLipschitzOn_inv_iff
@[to_additive]
lemma LipschitzOnWith.mul (hf : LipschitzOnWith Kf f s) (hg : LipschitzOnWith Kg g s) :
LipschitzOnWith (Kf + Kg) (fun x ⦠f x * g x) s := fun x hx y hy ā¦
calc
edist (f x * g x) (f y * g y) ⤠edist (f x) (f y) + edist (g x) (g y) :=
edist_mul_mul_le _ _ _ _
_ ⤠Kf * edist x y + Kg * edist x y := add_le_add (hf hx hy) (hg hx hy)
_ = (Kf + Kg) * edist x y := (add_mul _ _ _).symm
@[to_additive]
lemma LipschitzWith.mul (hf : LipschitzWith Kf f) (hg : LipschitzWith Kg g) :
LipschitzWith (Kf + Kg) fun x ⦠f x * g x := by
simpa [ā lipschitzOnWith_univ] using hf.lipschitzOnWith.mul hg.lipschitzOnWith
@[to_additive]
lemma LocallyLipschitzOn.mul (hf : LocallyLipschitzOn s f) (hg : LocallyLipschitzOn s g) :
LocallyLipschitzOn s fun x ⦠f x * g x := fun x hx ⦠by
obtain āØKf, t, ht, hKfā© := hf hx
obtain āØKg, u, hu, hKgā© := hg hx
exact āØKf + Kg, t ā© u, inter_mem ht hu,
(hKf.mono Set.inter_subset_left).mul (hKg.mono Set.inter_subset_right)ā©
@[to_additive]
lemma LocallyLipschitz.mul (hf : LocallyLipschitz f) (hg : LocallyLipschitz g) :
LocallyLipschitz fun x ⦠f x * g x := by
simpa [ā locallyLipschitzOn_univ] using hf.locallyLipschitzOn.mul hg.locallyLipschitzOn
@[to_additive]
lemma LipschitzOnWith.div (hf : LipschitzOnWith Kf f s) (hg : LipschitzOnWith Kg g s) :
LipschitzOnWith (Kf + Kg) (fun x ⦠f x / g x) s := by
simpa only [div_eq_mul_inv] using hf.mul hg.inv
@[to_additive]
theorem LipschitzWith.div (hf : LipschitzWith Kf f) (hg : LipschitzWith Kg g) :
LipschitzWith (Kf + Kg) fun x => f x / g x := by
simpa only [div_eq_mul_inv] using hf.mul hg.inv
@[to_additive]
lemma LocallyLipschitzOn.div (hf : LocallyLipschitzOn s f) (hg : LocallyLipschitzOn s g) :
LocallyLipschitzOn s fun x ⦠f x / g x := by
simpa only [div_eq_mul_inv] using hf.mul hg.inv
@[to_additive]
lemma LocallyLipschitz.div (hf : LocallyLipschitz f) (hg : LocallyLipschitz g) :
LocallyLipschitz fun x ⦠f x / g x := by
simpa only [div_eq_mul_inv] using hf.mul hg.inv
namespace AntilipschitzWith
@[to_additive]
theorem mul_lipschitzWith (hf : AntilipschitzWith Kf f) (hg : LipschitzWith Kg g) (hK : Kg < Kfā»Ā¹) :
AntilipschitzWith (Kfā»Ā¹ - Kg)ā»Ā¹ fun x => f x * g x := by
letI : PseudoMetricSpace α := PseudoEMetricSpace.toPseudoMetricSpace hf.edist_ne_top
refine AntilipschitzWith.of_le_mul_dist fun x y => ?_
rw [NNReal.coe_inv, ā _root_.div_eq_inv_mul]
rw [le_div_iffā (NNReal.coe_pos.2 <| tsub_pos_iff_lt.2 hK)]
rw [mul_comm, NNReal.coe_sub hK.le, sub_mul]
calc
āKfā»Ā¹ * dist x y - Kg * dist x y ⤠dist (f x) (f y) - dist (g x) (g y) :=
sub_le_sub (hf.mul_le_dist x y) (hg.dist_le_mul x y)
_ ⤠_ := le_trans (le_abs_self _) (abs_dist_sub_le_dist_mul_mul _ _ _ _)
@[to_additive]
theorem mul_div_lipschitzWith (hf : AntilipschitzWith Kf f) (hg : LipschitzWith Kg (g / f))
(hK : Kg < Kfā»Ā¹) : AntilipschitzWith (Kfā»Ā¹ - Kg)ā»Ā¹ g := by
simpa only [Pi.div_apply, mul_div_cancel] using hf.mul_lipschitzWith hg hK
@[to_additive le_mul_norm_sub]
theorem le_mul_norm_div {f : E ā F} (hf : AntilipschitzWith K f) (x y : E) :
āx / yā ⤠K * āf x / f yā := by simp [ā dist_eq_norm_div, hf.le_mul_dist x y]
end AntilipschitzWith
end PseudoEMetricSpace
-- See note [lower instance priority]
@[to_additive]
instance (priority := 100) SeminormedCommGroup.to_lipschitzMul : LipschitzMul E :=
āØāØ1 + 1, LipschitzWith.prod_fst.mul LipschitzWith.prod_sndā©ā©
-- See note [lower instance priority]
/-- A seminormed group is a uniform group, i.e., multiplication and division are uniformly
continuous. -/
@[to_additive /-- A seminormed group is a uniform additive group, i.e., addition and subtraction are
uniformly continuous. -/]
instance (priority := 100) SeminormedCommGroup.to_isUniformGroup : IsUniformGroup E :=
āØ(LipschitzWith.prod_fst.div LipschitzWith.prod_snd).uniformContinuousā©
-- short-circuit type class inference
-- See note [lower instance priority]
@[to_additive]
instance (priority := 100) SeminormedCommGroup.toIsTopologicalGroup : IsTopologicalGroup E :=
inferInstance
/-! ### SeparationQuotient -/
namespace SeparationQuotient
@[to_additive instNorm]
instance instMulNorm : Norm (SeparationQuotient E) where
norm := lift Norm.norm fun _ _ h => h.norm_eq_norm'
set_option linter.docPrime false in
@[to_additive (attr := simp) norm_mk]
theorem norm_mk' (p : E) : āmk pā = āpā := rfl
@[to_additive]
instance : NormedCommGroup (SeparationQuotient E) where
__ : CommGroup (SeparationQuotient E) := instCommGroup
dist_eq := Quotient.indā dist_eq_norm_div
@[to_additive]
theorem mk_eq_one_iff {p : E} : mk p = 1 ā āpā = 0 := by
rw [ā norm_mk', norm_eq_zero']
set_option linter.docPrime false in
@[to_additive (attr := simp) nnnorm_mk]
theorem nnnorm_mk' (p : E) : āmk pāā = āpāā := rfl
end SeparationQuotient
@[to_additive]
theorem cauchySeq_prod_of_eventually_eq {u v : ā ā E} {N : ā} (huv : ā n ā„ N, u n = v n)
(hv : CauchySeq fun n => ā k ā range (n + 1), v k) :
CauchySeq fun n => ā k ā range (n + 1), u k := by
let d : ā ā E := fun n => ā k ā range (n + 1), u k / v k
rw [show (fun n => ā k ā range (n + 1), u k) = d * fun n => ā k ā range (n + 1), v k
by ext n; simp [d]]
suffices ā n ā„ N, d n = d N from (tendsto_atTop_of_eventually_const this).cauchySeq.mul hv
intro n hn
dsimp [d]
rw [eventually_constant_prod (N := N + 1) _ (by gcongr)]
intro m hm
simp [huv m (le_of_lt hm)]
@[to_additive CauchySeq.norm_bddAbove]
lemma CauchySeq.mul_norm_bddAbove {G : Type*} [SeminormedGroup G] {u : ā ā G}
(hu : CauchySeq u) : BddAbove (Set.range (fun n ⦠āu nā)) := by
obtain āØC, -, hCā© := cauchySeq_bdd hu
simp_rw [SeminormedGroup.dist_eq] at hC
have : ā n, āu nā ⤠C + āu 0ā := by
intro n
rw [add_comm]
refine (norm_le_norm_add_norm_div' (u n) (u 0)).trans ?_
simp [(hC _ _).le]
rw [bddAbove_def]
exact āØC + āu 0ā, by simpa using thisā©
end SeminormedCommGroup |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Group/Indicator.lean | import Mathlib.Algebra.Order.Group.Indicator
import Mathlib.Algebra.Order.Pi
import Mathlib.Analysis.Normed.Group.Basic
/-!
# Indicator function and (e)norm
This file contains a few simple lemmas about `Set.indicator`, `norm` and `enorm`.
## Tags
indicator, norm
-/
open Set
section ESeminormedAddMonoid
variable {α ε : Type*} [TopologicalSpace ε] [ESeminormedAddMonoid ε]
{s t : Set α} (f : α ā ε) (a : α)
lemma enorm_indicator_eq_indicator_enorm :
āindicator s f aāā = indicator s (fun a => āf aāā) a :=
flip congr_fun a (indicator_comp_of_zero (enorm_zero (E := ε))).symm
theorem enorm_indicator_le_of_subset (h : s ā t) (f : α ā ε) (a : α) :
āindicator s f aāā ⤠āindicator t f aāā := by
simp only [enorm_indicator_eq_indicator_enorm]
apply indicator_le_indicator_of_subset ā¹_āŗ (zero_le _)
theorem indicator_enorm_le_enorm_self : indicator s (fun a => āf aāā) a ⤠āf aāā :=
indicator_le_self' (fun _ _ ⦠zero_le _) a
theorem enorm_indicator_le_enorm_self : āindicator s f aāā ⤠āf aāā := by
rw [enorm_indicator_eq_indicator_enorm]
apply indicator_enorm_le_enorm_self
end ESeminormedAddMonoid
section SeminormedAddGroup
variable {α E : Type*} [SeminormedAddGroup E] {s t : Set α} (f : α ā E) (a : α)
theorem norm_indicator_eq_indicator_norm : āindicator s f aā = indicator s (fun a => āf aā) a :=
flip congr_fun a (indicator_comp_of_zero norm_zero).symm
theorem nnnorm_indicator_eq_indicator_nnnorm :
āindicator s f aāā = indicator s (fun a => āf aāā) a :=
flip congr_fun a (indicator_comp_of_zero nnnorm_zero).symm
theorem norm_indicator_le_of_subset (h : s ā t) (f : α ā E) (a : α) :
āindicator s f aā ⤠āindicator t f aā := by
simp only [norm_indicator_eq_indicator_norm]
exact indicator_le_indicator_of_subset ā¹_āŗ (fun _ => norm_nonneg _) _
theorem indicator_norm_le_norm_self : indicator s (fun a => āf aā) a ⤠āf aā :=
indicator_le_self' (fun _ _ => norm_nonneg _) a
theorem norm_indicator_le_norm_self : āindicator s f aā ⤠āf aā := by
rw [norm_indicator_eq_indicator_norm]
apply indicator_norm_le_norm_self
end SeminormedAddGroup |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Group/Lemmas.lean | import Mathlib.Analysis.Normed.Group.Uniform
/-!
# Further lemmas about normed groups
This file contains further lemmas about normed groups, requiring heavier imports than
`Mathlib/Analysis/Normed/Group/Basic.lean`.
## TODO
- Move lemmas from `Basic` to other places, including this file.
-/
variable {E : Type*} [SeminormedAddCommGroup E]
open NNReal Topology
theorem eventually_nnnorm_sub_lt (xā : E) {ε : āā„0} (ε_pos : 0 < ε) :
āį¶ x in š xā, āx - xāāā < ε :=
(continuousAt_id.sub continuousAt_const).nnnorm (gt_mem_nhds <| by simpa)
theorem eventually_norm_sub_lt (xā : E) {ε : ā} (ε_pos : 0 < ε) :
āį¶ x in š xā, āx - xāā < ε :=
(continuousAt_id.sub continuousAt_const).norm (gt_mem_nhds <| by simpa) |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Group/InfiniteSum.lean | import Mathlib.Algebra.BigOperators.Intervals
import Mathlib.Analysis.Normed.Group.Uniform
import Mathlib.Topology.Instances.NNReal.Lemmas
import Mathlib.Topology.Instances.ENNReal.Lemmas
/-!
# Infinite sums in (semi)normed groups
In a complete (semi)normed group,
- `summable_iff_vanishing_norm`: a series `ā' i, f i` is summable if and only if for any `ε > 0`,
there exists a finite set `s` such that the sum `ā i ā t, f i` over any finite set `t` disjoint
with `s` has norm less than `ε`;
- `Summable.of_norm_bounded`, `Summable.of_norm_bounded_eventually`: if `āf iā` is bounded above by
a summable series `ā' i, g i`, then `ā' i, f i` is summable as well; the same is true if the
inequality hold only off some finite set.
- `tsum_of_norm_bounded`, `HasSum.norm_le_of_bounded`: if `āf iā ⤠g i`, where `ā' i, g i` is a
summable series, then `āā' i, f iā ⤠ā' i, g i`.
- versions of these lemmas for `nnnorm` and `enorm`.
## Tags
infinite series, absolute convergence, normed group
-/
open Topology ENNReal NNReal
open Finset Filter Metric
variable {ι α E F ε : Type*} [SeminormedAddCommGroup E] [SeminormedAddCommGroup F]
[TopologicalSpace ε] [ESeminormedAddCommMonoid ε]
theorem cauchySeq_finset_iff_vanishing_norm {f : ι ā E} :
(CauchySeq fun s : Finset ι => ā i ā s, f i) ā
ā ε > (0 : ā), ā s : Finset ι, ā t, Disjoint t s ā āā i ā t, f iā < ε := by
rw [cauchySeq_finset_iff_sum_vanishing, nhds_basis_ball.forall_iff]
Ā· simp only [ball_zero_eq, Set.mem_setOf_eq]
Ā· rintro s t hst āØs', hs'ā©
exact āØs', fun t' ht' => hst <| hs' _ ht'ā©
theorem summable_iff_vanishing_norm [CompleteSpace E] {f : ι ā E} :
Summable f ā ā ε > (0 : ā), ā s : Finset ι, ā t, Disjoint t s ā āā i ā t, f iā < ε := by
rw [summable_iff_cauchySeq_finset, cauchySeq_finset_iff_vanishing_norm]
theorem cauchySeq_finset_of_norm_bounded_eventually {f : ι ā E} {g : ι ā ā} (hg : Summable g)
(h : āį¶ i in cofinite, āf iā ⤠g i) : CauchySeq fun s => ā i ā s, f i := by
refine cauchySeq_finset_iff_vanishing_norm.2 fun ε hε => ?_
rcases summable_iff_vanishing_norm.1 hg ε hε with āØs, hsā©
classical
refine āØs āŖ h.toFinset, fun t ht => ?_ā©
have : ā i ā t, āf iā ⤠g i := by
intro i hi
simp only [disjoint_left, mem_union, not_or, h.mem_toFinset, Set.mem_compl_iff,
Classical.not_not] at ht
exact (ht hi).2
calc
āā i ā t, f iā ⤠ā i ā t, g i := norm_sum_le_of_le _ this
_ ⤠āā i ā t, g iā := le_abs_self _
_ < ε := hs _ (ht.mono_right le_sup_left)
theorem cauchySeq_finset_of_norm_bounded {f : ι ā E} {g : ι ā ā} (hg : Summable g)
(h : ā i, āf iā ⤠g i) : CauchySeq fun s : Finset ι => ā i ā s, f i :=
cauchySeq_finset_of_norm_bounded_eventually hg <| Eventually.of_forall h
/-- A version of the **direct comparison test** for conditionally convergent series.
See `cauchySeq_finset_of_norm_bounded` for the same statement about absolutely convergent ones. -/
theorem cauchySeq_range_of_norm_bounded {f : ā ā E} {g : ā ā ā}
(hg : CauchySeq fun n => ā i ā range n, g i) (hf : ā i, āf iā ⤠g i) :
CauchySeq fun n => ā i ā range n, f i := by
refine Metric.cauchySeq_iff'.2 fun ε hε => ?_
refine (Metric.cauchySeq_iff'.1 hg ε hε).imp fun N hg n hn => ?_
specialize hg n hn
rw [dist_eq_norm, ā sum_Ico_eq_sub _ hn] at hg ā¢
calc
āā k ā Ico N n, f kā ⤠ā k ā _, āf kā := norm_sum_le _ _
_ ⤠ā k ā _, g k := sum_le_sum fun x _ => hf x
_ ⤠āā k ā _, g kā := le_abs_self _
_ < ε := hg
theorem cauchySeq_finset_of_summable_norm {f : ι ā E} (hf : Summable fun a => āf aā) :
CauchySeq fun s : Finset ι => ā a ā s, f a :=
cauchySeq_finset_of_norm_bounded hf fun _i => le_rfl
/-- If a function `f` is summable in norm, and along some sequence of finsets exhausting the space
its sum is converging to a limit `a`, then this holds along all finsets, i.e., `f` is summable
with sum `a`. -/
theorem hasSum_of_subseq_of_summable {f : ι ā E} (hf : Summable fun a => āf aā) {s : α ā Finset ι}
{p : Filter α} [NeBot p] (hs : Tendsto s p atTop) {a : E}
(ha : Tendsto (fun b => ā i ā s b, f i) p (š a)) : HasSum f a :=
tendsto_nhds_of_cauchySeq_of_subseq (cauchySeq_finset_of_summable_norm hf) hs ha
theorem hasSum_iff_tendsto_nat_of_summable_norm {f : ā ā E} {a : E} (hf : Summable fun i => āf iā) :
HasSum f a ā Tendsto (fun n : ā => ā i ā range n, f i) atTop (š a) :=
āØfun h => h.tendsto_sum_nat, fun h => hasSum_of_subseq_of_summable hf tendsto_finset_range hā©
/-- The direct comparison test for series: if the norm of `f` is bounded by a real function `g`
which is summable, then `f` is summable. -/
theorem Summable.of_norm_bounded [CompleteSpace E] {f : ι ā E} {g : ι ā ā} (hg : Summable g)
(h : ā i, āf iā ⤠g i) : Summable f := by
rw [summable_iff_cauchySeq_finset]
exact cauchySeq_finset_of_norm_bounded hg h
theorem HasSum.enorm_le_of_bounded {f : ι ā ε} {g : ι ā āā„0ā} {a : ε} {b : āā„0ā} (hf : HasSum f a)
(hg : HasSum g b) (h : ā i, āf iāā ⤠g i) : āaāā ⤠b := by
exact le_of_tendsto_of_tendsto' hf.enorm hg fun _s ⦠enorm_sum_le_of_le _ fun i _hi ⦠h i
theorem HasSum.norm_le_of_bounded {f : ι ā E} {g : ι ā ā} {a : E} {b : ā} (hf : HasSum f a)
(hg : HasSum g b) (h : ā i, āf iā ⤠g i) : āaā ⤠b := by
exact le_of_tendsto_of_tendsto' hf.norm hg fun _s ⦠norm_sum_le_of_le _ fun i _hi ⦠h i
/-- Quantitative result associated to the direct comparison test for series: If, for all `i`,
`āf iāā ⤠g i`, then `āā' i, f iāā ⤠ā' i, g i`. Note that we do not assume that `ā' i, f i` is
summable, and it might not be the case if `α` is not a complete space. -/
theorem tsum_of_enorm_bounded {f : ι ā ε} {g : ι ā āā„0ā} {a : āā„0ā} (hg : HasSum g a)
(h : ā i, āf iāā ⤠g i) : āā' i : ι, f iāā ⤠a := by
by_cases hf : Summable f
Ā· exact hf.hasSum.enorm_le_of_bounded hg h
Ā· simp [tsum_eq_zero_of_not_summable hf]
theorem enorm_tsum_le_tsum_enorm {f : ι ā ε} :
āā' i, f iāā ⤠ā' i, āf iāā :=
tsum_of_enorm_bounded ENNReal.summable.hasSum fun _i => le_rfl
/-- Quantitative result associated to the direct comparison test for series: If `ā' i, g i` is
summable, and for all `i`, `āf iā ⤠g i`, then `āā' i, f iā ⤠ā' i, g i`. Note that we do not
assume that `ā' i, f i` is summable, and it might not be the case if `α` is not a complete space. -/
theorem tsum_of_norm_bounded {f : ι ā E} {g : ι ā ā} {a : ā} (hg : HasSum g a)
(h : ā i, āf iā ⤠g i) : āā' i : ι, f iā ⤠a := by
by_cases hf : Summable f
Ā· exact hf.hasSum.norm_le_of_bounded hg h
Ā· rw [tsum_eq_zero_of_not_summable hf, norm_zero]
classical exact ge_of_tendsto' hg fun s => sum_nonneg fun i _hi => (norm_nonneg _).trans (h i)
/-- If `ā' i, āf iā` is summable, then `āā' i, f iā ⤠(ā' i, āf iā)`. Note that we do not assume
that `ā' i, f i` is summable, and it might not be the case if `α` is not a complete space. -/
theorem norm_tsum_le_tsum_norm {f : ι ā E} (hf : Summable fun i => āf iā) :
āā' i, f iā ⤠ā' i, āf iā :=
tsum_of_norm_bounded hf.hasSum fun _i => le_rfl
/-- Quantitative result associated to the direct comparison test for series: If `ā' i, g i` is
summable, and for all `i`, `āf iāā ⤠g i`, then `āā' i, f iāā ⤠ā' i, g i`. Note that we
do not assume that `ā' i, f i` is summable, and it might not be the case if `α` is not a complete
space. -/
theorem tsum_of_nnnorm_bounded {f : ι ā E} {g : ι ā āā„0} {a : āā„0} (hg : HasSum g a)
(h : ā i, āf iāā ⤠g i) : āā' i : ι, f iāā ⤠a := by
simp only [ā NNReal.coe_le_coe, ā NNReal.hasSum_coe, coe_nnnorm] at *
exact tsum_of_norm_bounded hg h
/-- If `ā' i, āf iāā` is summable, then `āā' i, f iāā ⤠ā' i, āf iāā`. Note that
we do not assume that `ā' i, f i` is summable, and it might not be the case if `α` is not a complete
space. -/
theorem nnnorm_tsum_le {f : ι ā E} (hf : Summable fun i => āf iāā) : āā' i, f iāā ⤠ā' i, āf iāā :=
tsum_of_nnnorm_bounded hf.hasSum fun _i => le_rfl
variable [CompleteSpace E]
/-- Variant of the direct comparison test for series: if the norm of `f` is eventually bounded by a
real function `g` which is summable, then `f` is summable. -/
theorem Summable.of_norm_bounded_eventually {f : ι ā E} {g : ι ā ā} (hg : Summable g)
(h : āį¶ i in cofinite, āf iā ⤠g i) : Summable f :=
summable_iff_cauchySeq_finset.2 <| cauchySeq_finset_of_norm_bounded_eventually hg h
/-- Variant of the direct comparison test for series: if the norm of `f` is eventually bounded by a
real function `g` which is summable, then `f` is summable. -/
theorem Summable.of_norm_bounded_eventually_nat {f : ā ā E} {g : ā ā ā} (hg : Summable g)
(h : āį¶ i in atTop, āf iā ⤠g i) : Summable f :=
.of_norm_bounded_eventually hg <| Nat.cofinite_eq_atTop āø h
theorem Summable.of_nnnorm_bounded {f : ι ā E} {g : ι ā āā„0} (hg : Summable g)
(h : ā i, āf iāā ⤠g i) : Summable f :=
.of_norm_bounded (NNReal.summable_coe.2 hg) h
theorem Summable.of_norm {f : ι ā E} (hf : Summable fun a => āf aā) : Summable f :=
.of_norm_bounded hf fun _i => le_rfl
theorem Summable.of_nnnorm {f : ι ā E} (hf : Summable fun a => āf aāā) : Summable f :=
.of_nnnorm_bounded hf fun _i => le_rfl |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Group/AddCircle.lean | import Mathlib.Analysis.Normed.Group.Quotient
import Mathlib.Analysis.Normed.Module.Ball.Pointwise
import Mathlib.Topology.Instances.AddCircle.Real
/-!
# The additive circle as a normed group
We define the normed group structure on `AddCircle p`, for `p : ā`. For example if `p = 1` then:
`ā(x : AddCircle 1)ā = |x - round x|` for any `x : ā` (see `UnitAddCircle.norm_eq`).
## Main definitions:
* `AddCircle.norm_eq`: a characterisation of the norm on `AddCircle p`
## TODO
* The fact `InnerProductGeometry.angle (Real.cos Īø) (Real.sin Īø) = ā(Īø : Real.Angle)ā`
-/
noncomputable section
open Metric QuotientAddGroup Set
open Int hiding mem_zmultiples_iff
open AddSubgroup
namespace AddCircle
variable (p : ā)
instance : NormedAddCommGroup (AddCircle p) := QuotientAddGroup.instNormedAddCommGroup _
@[simp]
theorem norm_coe_mul (x : ā) (t : ā) :
ā(ā(t * x) : AddCircle (t * p))ā = |t| * ā(x : AddCircle p)ā := by
obtain rfl | ht := eq_or_ne t 0
Ā· simp
simp only [norm_eq_infDist, ā Real.norm_eq_abs, ā infDist_smulā ht, smul_zero]
congr 1 with m
simp_rw [zmultiples, eq_iff_sub_mem, zsmul_eq_mul, mul_left_comm, ā smul_eq_mul, Set.range_smul]
simp [mem_smul_set_iff_inv_smul_memā ht, mul_sub, ht]
theorem norm_neg_period (x : ā) : ā(x : AddCircle (-p))ā = ā(x : AddCircle p)ā := by
suffices ā(ā(-1 * x) : AddCircle (-1 * p))ā = ā(x : AddCircle p)ā by
rw [ā this, neg_one_mul]
simp
simp only [norm_coe_mul, abs_neg, abs_one, one_mul]
@[simp]
theorem norm_eq_of_zero {x : ā} : ā(x : AddCircle (0 : ā))ā = |x| := by
suffices { y : ā | (y : AddCircle (0 : ā)) = (x : AddCircle (0 : ā)) } = {x} by
simp [norm_eq_infDist, this]
ext y
simp [eq_iff_sub_mem, sub_eq_zero]
theorem norm_eq {x : ā} : ā(x : AddCircle p)ā = |x - round (pā»Ā¹ * x) * p| := by
suffices ā x : ā, ā(x : AddCircle (1 : ā))ā = |x - round x| by
rcases eq_or_ne p 0 with (rfl | hp)
Ā· simp
have hx := norm_coe_mul p x pā»Ā¹
rw [abs_inv, eq_inv_mul_iff_mul_eqā ((not_congr abs_eq_zero).mpr hp)] at hx
rw [ā hx, inv_mul_cancelā hp, this, ā abs_mul, mul_sub, mul_inv_cancel_leftā hp, mul_comm p]
clear! x p
intro x
simp only [le_antisymm_iff, le_norm_iff, Real.norm_eq_abs]
refine āØle_of_forall_le fun r hr ⦠?_, ?_ā©
Ā· rw [abs_sub_round_eq_min, le_inf_iff]
rw [le_norm_iff] at hr
constructor
Ā· simpa [abs_of_nonneg] using hr (fract x)
Ā· simpa [abs_sub_comm (fract x)] using hr (fract x - 1) (by simp)
Ā· simpa [zmultiples, QuotientAddGroup.eq, zsmul_eq_mul, mul_one, mem_mk, mem_range, and_imp,
forall_exists_index, eq_neg_add_iff_add_eq, ā eq_sub_iff_add_eq, forall_swap (α := ā)]
using round_le _
theorem norm_eq' (hp : 0 < p) {x : ā} : ā(x : AddCircle p)ā = p * |pā»Ā¹ * x - round (pā»Ā¹ * x)| := by
conv_rhs =>
congr
rw [ā abs_eq_self.mpr hp.le]
rw [ā abs_mul, mul_sub, mul_inv_cancel_leftā hp.ne.symm, norm_eq, mul_comm p]
theorem norm_le_half_period {x : AddCircle p} (hp : p ā 0) : āxā ⤠|p| / 2 := by
obtain āØxā© := x
change ā(x : AddCircle p)ā ⤠|p| / 2
rw [norm_eq, ā mul_le_mul_iff_rightā (abs_pos.mpr (inv_ne_zero hp)), ā abs_mul, mul_sub,
mul_left_comm, ā mul_div_assoc, ā abs_mul, inv_mul_cancelā hp, mul_one, abs_one]
exact abs_sub_round (pā»Ā¹ * x)
@[simp]
theorem norm_half_period_eq : ā(ā(p / 2) : AddCircle p)ā = |p| / 2 := by
rcases eq_or_ne p 0 with (rfl | hp); Ā· simp
rw [norm_eq, ā mul_div_assoc, inv_mul_cancelā hp, one_div, round_two_inv, Int.cast_one,
one_mul, (by linarith : p / 2 - p = -(p / 2)), abs_neg, abs_div, abs_two]
theorem norm_coe_eq_abs_iff {x : ā} (hp : p ā 0) : ā(x : AddCircle p)ā = |x| ā |x| ⤠|p| / 2 := by
refine āØfun hx => hx āø norm_le_half_period p hp, fun hx => ?_ā©
suffices ā p : ā, 0 < p ā |x| ⤠p / 2 ā ā(x : AddCircle p)ā = |x| by
rcases hp.symm.lt_or_gt with (hp | hp)
Ā· rw [abs_eq_self.mpr hp.le] at hx
exact this p hp hx
Ā· rw [ā norm_neg_period]
rw [abs_eq_neg_self.mpr hp.le] at hx
exact this (-p) (neg_pos.mpr hp) hx
clear hx
intro p hp hx
rcases eq_or_ne x (p / (2 : ā)) with (rfl | hx')
Ā· simp [abs_div]
suffices round (pā»Ā¹ * x) = 0 by simp [norm_eq, this]
rw [round_eq_zero_iff]
obtain āØhxā, hxāā© := abs_le.mp hx
replace hxā := Ne.lt_of_le hx' hxā
constructor
Ā· rwa [le_inv_mul_iffā hp, mul_neg, ā mul_div_assoc, mul_one]
Ā· rwa [inv_mul_lt_iffā hp, ā mul_div_assoc, mul_one]
open Metric
theorem closedBall_eq_univ_of_half_period_le (hp : p ā 0) (x : AddCircle p) {ε : ā}
(hε : |p| / 2 ⤠ε) : closedBall x ε = univ :=
eq_univ_iff_forall.mpr fun x => by
simpa only [mem_closedBall, dist_eq_norm] using (norm_le_half_period p hp).trans hε
@[simp]
theorem coe_real_preimage_closedBall_period_zero (x ε : ā) :
(ā) ā»Ā¹' closedBall (x : AddCircle (0 : ā)) ε = closedBall x ε := by
ext y
simp [dist_eq_norm, ā QuotientAddGroup.mk_sub]
theorem coe_real_preimage_closedBall_eq_iUnion (x ε : ā) :
(ā) ā»Ā¹' closedBall (x : AddCircle p) ε = ā z : ā¤, closedBall (x + z ⢠p) ε := by
rcases eq_or_ne p 0 with (rfl | hp)
Ā· simp [iUnion_const]
ext y
simp only [dist_eq_norm, mem_preimage, mem_closedBall, zsmul_eq_mul, mem_iUnion, Real.norm_eq_abs,
ā QuotientAddGroup.mk_sub, norm_eq, ā sub_sub]
refine āØfun h => āØround (pā»Ā¹ * (y - x)), hā©, ?_ā©
rintro āØn, hnā©
rw [ā mul_le_mul_iff_rightā (abs_pos.mpr <| inv_ne_zero hp), ā abs_mul, mul_sub, mul_comm _ p,
inv_mul_cancel_leftā hp] at hn ā¢
exact (round_le (pā»Ā¹ * (y - x)) n).trans hn
theorem coe_real_preimage_closedBall_inter_eq {x ε : ā} (s : Set ā)
(hs : s ā closedBall x (|p| / 2)) :
(ā) ā»Ā¹' closedBall (x : AddCircle p) ε ā© s = if ε < |p| / 2 then closedBall x ε ā© s else s := by
rcases le_or_gt (|p| / 2) ε with hε | hε
Ā· rcases eq_or_ne p 0 with (rfl | hp)
· simp only [abs_zero, zero_div] at hε
simp only [not_lt.mpr hε, coe_real_preimage_closedBall_period_zero, abs_zero, zero_div,
if_false, inter_eq_right]
exact hs.trans (closedBall_subset_closedBall <| by simp [hε])
simp [closedBall_eq_univ_of_half_period_le p hp (āx) hε, not_lt.mpr hε]
Ā· suffices ā z : ā¤, closedBall (x + z ⢠p) ε ā© s = if z = 0 then closedBall x ε ā© s else ā
by
simp [-zsmul_eq_mul, coe_real_preimage_closedBall_eq_iUnion,
iUnion_inter, iUnion_ite, this, hε]
intro z
simp only [Real.closedBall_eq_Icc] at hs ā¢
rcases eq_or_ne z 0 with (rfl | hz)
Ā· simp
simp only [hz, zsmul_eq_mul, if_false, eq_empty_iff_forall_notMem]
rintro y āØāØhyā, hyāā©, hyāā©
obtain āØhyā, hyāā© := hs hyā
rcases lt_trichotomy 0 p with (hp | (rfl : 0 = p) | hp)
Ā· rcases Int.cast_le_neg_one_or_one_le_cast_of_ne_zero ā hz with hz' | hz'
Ā· have : āz * p ⤠-p := by nlinarith
linarith [abs_eq_self.mpr hp.le]
Ā· have : p ⤠āz * p := by nlinarith
linarith [abs_eq_self.mpr hp.le]
Ā· simp only [mul_zero, add_zero, abs_zero, zero_div] at hyā hyā hε
linarith
Ā· rcases Int.cast_le_neg_one_or_one_le_cast_of_ne_zero ā hz with hz' | hz'
Ā· have : -p ⤠āz * p := by nlinarith
linarith [abs_eq_neg_self.mpr hp.le]
Ā· have : āz * p ⤠p := by nlinarith
linarith [abs_eq_neg_self.mpr hp.le]
section FiniteOrderPoints
variable {p} [hp : Fact (0 < p)]
theorem norm_div_natCast {m n : ā} :
ā(ā(ām / ān * p) : AddCircle p)ā = p * (ā(min (m % n) (n - m % n)) / n) := by
have : pā»Ā¹ * (ām / ān * p) = ām / ān := by rw [mul_comm _ p, inv_mul_cancel_leftā hp.out.ne.symm]
rw [norm_eq' p hp.out, this, abs_sub_round_div_natCast_eq]
theorem exists_norm_eq_of_isOfFinAddOrder {u : AddCircle p} (hu : IsOfFinAddOrder u) :
ā k : ā, āuā = p * (k / addOrderOf u) := by
let n := addOrderOf u
change ā k : ā, āuā = p * (k / n)
obtain āØm, -, -, hmā© := exists_gcd_eq_one_of_isOfFinAddOrder hu
refine āØmin (m % n) (n - m % n), ?_ā©
rw [ā hm, norm_div_natCast]
theorem le_add_order_smul_norm_of_isOfFinAddOrder {u : AddCircle p} (hu : IsOfFinAddOrder u)
(hu' : u ā 0) : p ⤠addOrderOf u ⢠āuā := by
obtain āØn, hnā© := exists_norm_eq_of_isOfFinAddOrder hu
replace hu : (addOrderOf u : ā) ā 0 := by
norm_cast
exact (addOrderOf_pos_iff.mpr hu).ne'
conv_lhs => rw [ā mul_one p]
rw [hn, nsmul_eq_mul, ā mul_assoc, mul_comm _ p, mul_assoc, mul_div_cancelā _ hu,
mul_le_mul_iff_rightā hp.out, Nat.one_le_cast, Nat.one_le_iff_ne_zero]
contrapose! hu'
simpa only [hu', Nat.cast_zero, zero_div, mul_zero, norm_eq_zero] using hn
end FiniteOrderPoints
end AddCircle
namespace UnitAddCircle
theorem norm_eq {x : ā} : ā(x : UnitAddCircle)ā = |x - round x| := by simp [AddCircle.norm_eq]
end UnitAddCircle |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Group/Rat.lean | import Mathlib.Analysis.Normed.Group.Int
import Mathlib.Topology.Instances.Rat
/-! # ā as a normed group -/
namespace Rat
instance instNormedAddCommGroup : NormedAddCommGroup ā where
norm r := ā(r : ā)ā
dist_eq rā rā := by simp only [Rat.dist_eq, norm, Rat.cast_sub]
@[norm_cast, simp high] -- increase priority to prevent the left-hand side from simplifying
theorem norm_cast_real (r : ā) : ā(r : ā)ā = ārā :=
rfl
@[norm_cast, simp]
theorem _root_.Int.norm_cast_rat (m : ā¤) : ā(m : ā)ā = āmā := by
rw [ā Rat.norm_cast_real, ā Int.norm_cast_real]; congr 1
end Rat |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Group/Ultra.lean | import Mathlib.Analysis.Normed.Group.Uniform
import Mathlib.Topology.Algebra.Nonarchimedean.Basic
import Mathlib.Topology.MetricSpace.Ultra.Basic
import Mathlib.Topology.Algebra.InfiniteSum.Group
import Mathlib.Topology.Order.LiminfLimsup
/-!
# Ultrametric norms
This file contains results on the behavior of norms in ultrametric groups.
## Main results
* `IsUltrametricDist.isUltrametricDist_of_isNonarchimedean_norm`:
a normed additive group has an ultrametric iff the norm is nonarchimedean
* `IsUltrametricDist.nonarchimedeanGroup` and its additive version: instance showing that a
commutative group with a nonarchimedean seminorm is a nonarchimedean topological group (i.e.
there is a neighbourhood basis of the identity consisting of open subgroups).
## Implementation details
Some results are proved first about `nnnorm : X ā āā„0` because the bottom element
in `NNReal` is 0, so easier to make statements about maxima of empty sets.
## Tags
ultrametric, nonarchimedean
-/
open Metric NNReal
namespace IsUltrametricDist
section Group
variable {S S' ι : Type*} [SeminormedGroup S] [SeminormedGroup S'] [IsUltrametricDist S]
@[to_additive]
lemma norm_mul_le_max (x y : S) :
āx * yā ⤠max āxā āyā := by
simpa only [le_max_iff, dist_eq_norm_div, div_inv_eq_mul, div_one, one_mul] using
dist_triangle_max x 1 yā»Ā¹
@[to_additive]
lemma isUltrametricDist_of_forall_norm_mul_le_max_norm
(h : ā x y : S', āx * yā ⤠max āxā āyā) : IsUltrametricDist S' where
dist_triangle_max x y z := by
simpa only [dist_eq_norm_div, le_max_iff, div_mul_div_cancel] using h (x / y) (y / z)
lemma isUltrametricDist_of_isNonarchimedean_norm {S' : Type*} [SeminormedAddGroup S']
(h : IsNonarchimedean (norm : S' ā ā)) : IsUltrametricDist S' :=
isUltrametricDist_of_forall_norm_add_le_max_norm h
lemma isNonarchimedean_norm {R} [SeminormedAddCommGroup R] [IsUltrametricDist R] :
IsNonarchimedean (āĀ·ā : R ā ā) := by
intro x y
convert dist_triangle_max 0 x (x + y) using 1
Ā· simp
Ā· congr <;> simp [SeminormedAddGroup.dist_eq]
lemma isUltrametricDist_iff_isNonarchimedean_norm {R} [SeminormedAddCommGroup R] :
IsUltrametricDist R ā IsNonarchimedean (āĀ·ā : R ā ā) :=
āØfun h => h.isNonarchimedean_norm, IsUltrametricDist.isUltrametricDist_of_isNonarchimedean_normā©
@[to_additive]
lemma nnnorm_mul_le_max (x y : S) :
āx * yāā ⤠max āxāā āyāā :=
norm_mul_le_max _ _
@[to_additive]
lemma isUltrametricDist_of_forall_nnnorm_mul_le_max_nnnorm
(h : ā x y : S', āx * yāā ⤠max āxāā āyāā) : IsUltrametricDist S' :=
isUltrametricDist_of_forall_norm_mul_le_max_norm h
lemma isUltrametricDist_of_isNonarchimedean_nnnorm {S' : Type*} [SeminormedAddGroup S']
(h : IsNonarchimedean (nnnorm : S' ā āā„0)) : IsUltrametricDist S' :=
isUltrametricDist_of_forall_nnnorm_add_le_max_nnnorm h
lemma isNonarchimedean_nnnorm {R} [SeminormedAddCommGroup R] [IsUltrametricDist R] :
IsNonarchimedean (āĀ·āā : R ā ā) := by
intro x y
convert dist_triangle_max 0 x (x + y) using 1
Ā· simp
Ā· congr <;> simp [SeminormedAddGroup.dist_eq]
lemma isUltrametricDist_iff_isNonarchimedean_nnnorm {R} [SeminormedAddCommGroup R] :
IsUltrametricDist R ā IsNonarchimedean (āĀ·āā : R ā ā) :=
āØfun h => h.isNonarchimedean_norm, IsUltrametricDist.isUltrametricDist_of_isNonarchimedean_normā©
/-- All triangles are isosceles in an ultrametric normed group. -/
@[to_additive /-- All triangles are isosceles in an ultrametric normed additive group. -/]
lemma norm_mul_eq_max_of_norm_ne_norm
{x y : S} (h : āxā ā āyā) : āx * yā = max āxā āyā := by
rw [ā div_inv_eq_mul, ā dist_eq_norm_div, dist_eq_max_of_dist_ne_dist _ 1 _ (by simp [h])]
simp only [dist_one_right, dist_one_left, norm_inv']
@[to_additive]
lemma norm_eq_of_mul_norm_lt_max {x y : S} (h : āx * yā < max āxā āyā) :
āxā = āyā :=
not_ne_iff.mp (h.ne ā norm_mul_eq_max_of_norm_ne_norm)
/-- All triangles are isosceles in an ultrametric normed group. -/
@[to_additive /-- All triangles are isosceles in an ultrametric normed additive group. -/]
lemma nnnorm_mul_eq_max_of_nnnorm_ne_nnnorm
{x y : S} (h : āxāā ā āyāā) : āx * yāā = max āxāā āyāā := by
simpa only [ā NNReal.coe_inj, NNReal.coe_max] using
norm_mul_eq_max_of_norm_ne_norm (NNReal.coe_injective.ne h)
@[to_additive]
lemma nnnorm_eq_of_mul_nnnorm_lt_max {x y : S} (h : āx * yāā < max āxāā āyāā) :
āxāā = āyāā :=
not_ne_iff.mp (h.ne ā nnnorm_mul_eq_max_of_nnnorm_ne_nnnorm)
/-- All triangles are isosceles in an ultrametric normed group. -/
@[to_additive /-- All triangles are isosceles in an ultrametric normed additive group. -/]
lemma norm_div_eq_max_of_norm_div_ne_norm_div (x y z : S) (h : āx / yā ā āy / zā) :
āx / zā = max āx / yā āy / zā := by
simpa only [div_mul_div_cancel] using norm_mul_eq_max_of_norm_ne_norm h
/-- All triangles are isosceles in an ultrametric normed group. -/
@[to_additive /-- All triangles are isosceles in an ultrametric normed additive group. -/]
lemma nnnorm_div_eq_max_of_nnnorm_div_ne_nnnorm_div (x y z : S) (h : āx / yāā ā āy / zāā) :
āx / zāā = max āx / yāā āy / zāā := by
simpa only [ā NNReal.coe_inj, NNReal.coe_max] using
norm_div_eq_max_of_norm_div_ne_norm_div _ _ _ (NNReal.coe_injective.ne h)
@[to_additive]
lemma nnnorm_pow_le (x : S) (n : ā) :
āx ^ nāā ⤠āxāā := by
induction n with
| zero => simp
| succ n hn => simpa [pow_add, hn] using nnnorm_mul_le_max (x ^ n) x
@[to_additive]
lemma norm_pow_le (x : S) (n : ā) :
āx ^ nā ⤠āxā :=
nnnorm_pow_le x n
@[to_additive]
lemma nnnorm_zpow_le (x : S) (z : ā¤) :
āx ^ zāā ⤠āxāā := by
cases z <;>
simpa using nnnorm_pow_le _ _
@[to_additive]
lemma norm_zpow_le (x : S) (z : ā¤) :
āx ^ zā ⤠āxā :=
nnnorm_zpow_le x z
section nonarch
variable (S)
/--
In a group with an ultrametric norm, open balls around 1 of positive radius are open subgroups.
-/
@[to_additive /-- In an additive group with an ultrametric norm, open balls around 0 of
positive radius are open subgroups. -/]
def ball_openSubgroup {r : ā} (hr : 0 < r) : OpenSubgroup S where
carrier := Metric.ball (1 : S) r
mul_mem' {x} {y} hx hy := by
simp only [Metric.mem_ball, dist_eq_norm_div, div_one] at hx hy ā¢
exact (norm_mul_le_max x y).trans_lt (max_lt hx hy)
one_mem' := Metric.mem_ball_self hr
inv_mem' := by simp only [Metric.mem_ball, dist_one_right, norm_inv', imp_self, implies_true]
isOpen' := Metric.isOpen_ball
/--
In a group with an ultrametric norm, closed balls around 1 of positive radius are open subgroups.
-/
@[to_additive /-- In an additive group with an ultrametric norm, closed balls around 0 of positive
radius are open subgroups. -/]
def closedBall_openSubgroup {r : ā} (hr : 0 < r) : OpenSubgroup S where
carrier := Metric.closedBall (1 : S) r
mul_mem' {x} {y} hx hy := by
simp only [Metric.mem_closedBall, dist_eq_norm_div, div_one] at hx hy ā¢
exact (norm_mul_le_max x y).trans (max_le hx hy)
one_mem' := Metric.mem_closedBall_self hr.le
inv_mem' := by simp only [mem_closedBall, dist_one_right, norm_inv', imp_self, implies_true]
isOpen' := IsUltrametricDist.isOpen_closedBall _ hr.ne'
end nonarch
end Group
section CommGroup
variable {M ι : Type*} [SeminormedCommGroup M] [IsUltrametricDist M]
/-- A commutative group with an ultrametric group seminorm is nonarchimedean (as a topological
group, i.e. every neighborhood of 1 contains an open subgroup). -/
@[to_additive /-- A commutative additive group with an ultrametric group seminorm is nonarchimedean
(as a topological group, i.e. every neighborhood of 0 contains an open subgroup). -/]
instance nonarchimedeanGroup : NonarchimedeanGroup M where
is_nonarchimedean := by simpa only [Metric.mem_nhds_iff]
using fun U āØĪµ, hεp, hεU⩠⦠āØball_openSubgroup M hεp, hεUā©
/-- Nonarchimedean norm of a product is less than or equal the norm of any term in the product.
This version is phrased using `Finset.sup'` and `Finset.Nonempty` due to `Finset.sup`
operating over an `OrderBot`, which `ā` is not. -/
@[to_additive /-- Nonarchimedean norm of a sum is less than or equal the norm of any term in the
sum. This version is phrased using `Finset.sup'` and `Finset.Nonempty` due to `Finset.sup`
operating over an `OrderBot`, which `ā` is not. -/]
lemma _root_.Finset.Nonempty.norm_prod_le_sup'_norm {s : Finset ι} (hs : s.Nonempty) (f : ι ā M) :
āā i ā s, f iā ⤠s.sup' hs (āf Ā·ā) := by
simp only [Finset.le_sup'_iff]
induction hs using Finset.Nonempty.cons_induction with
| singleton j => simp only [Finset.mem_singleton, Finset.prod_singleton, exists_eq_left, le_refl]
| cons j t hj _ IH =>
simp only [Finset.prod_cons, Finset.mem_cons, exists_eq_or_imp]
refine (le_total āā i ā t, f iā āf jā).imp ?_ ?_ <;> intro h
Ā· exact (norm_mul_le_max _ _).trans (max_eq_left h).le
Ā· exact āØ_, IH.choose_spec.left, (norm_mul_le_max _ _).trans <|
((max_eq_right h).le.trans IH.choose_spec.right)ā©
/-- Nonarchimedean norm of a product is less than or equal to the largest norm of a term in the
product. -/
@[to_additive /-- Nonarchimedean norm of a sum is less than or equal to the largest norm of a term
in the sum. -/]
lemma _root_.Finset.nnnorm_prod_le_sup_nnnorm (s : Finset ι) (f : ι ā M) :
āā i ā s, f iāā ⤠s.sup (āf Ā·āā) := by
rcases s.eq_empty_or_nonempty with rfl | hs
Ā· simp only [Finset.prod_empty, nnnorm_one', Finset.sup_empty, bot_eq_zero', le_refl]
Ā· simpa only [ā Finset.sup'_eq_sup hs, Finset.le_sup'_iff, coe_le_coe, coe_nnnorm']
using hs.norm_prod_le_sup'_norm f
/--
Generalised ultrametric triangle inequality for finite products in commutative groups with
an ultrametric norm.
-/
@[to_additive /-- Generalised ultrametric triangle inequality for finite sums in additive
commutative groups with an ultrametric norm. -/]
lemma nnnorm_prod_le_of_forall_le {s : Finset ι} {f : ι ā M} {C : āā„0}
(hC : ā i ā s, āf iāā ⤠C) : āā i ā s, f iāā ⤠C :=
(s.nnnorm_prod_le_sup_nnnorm f).trans <| Finset.sup_le hC
/--
Generalised ultrametric triangle inequality for nonempty finite products in commutative groups with
an ultrametric norm.
-/
@[to_additive /-- Generalised ultrametric triangle inequality for nonempty finite sums in additive
commutative groups with an ultrametric norm. -/]
lemma norm_prod_le_of_forall_le_of_nonempty {s : Finset ι} (hs : s.Nonempty) {f : ι ā M} {C : ā}
(hC : ā i ā s, āf iā ⤠C) : āā i ā s, f iā ⤠C :=
(hs.norm_prod_le_sup'_norm f).trans (Finset.sup'_le hs _ hC)
/--
Generalised ultrametric triangle inequality for finite products in commutative groups with
an ultrametric norm.
-/
@[to_additive /-- Generalised ultrametric triangle inequality for finite sums in additive
commutative groups with an ultrametric norm. -/]
lemma norm_prod_le_of_forall_le_of_nonneg {s : Finset ι} {f : ι ā M} {C : ā}
(h_nonneg : 0 ⤠C) (hC : ā i ā s, āf iā ⤠C) : āā i ā s, f iā ⤠C := by
lift C to NNReal using h_nonneg
exact nnnorm_prod_le_of_forall_le hC
/--
Given a function `f : ι ā M` and a nonempty finite set `t ā ι`, we can always find `i ā t` such that
`āā j in t, f jā ⤠āf iā`.
-/
@[to_additive /-- Given a function `f : ι ā M` and a nonempty finite set `t ā ι`, we can always find
`i ā t` such that `āā j ā t, f jā ⤠āf iā`. -/]
theorem exists_norm_finset_prod_le_of_nonempty {t : Finset ι} (ht : t.Nonempty) (f : ι ā M) :
ā i ā t, āā j ā t, f jā ⤠āf iā :=
match t.exists_mem_eq_sup' ht (āf Ā·ā) with
|āØj, hj, hj'ā© => āØj, hj, (ht.norm_prod_le_sup'_norm f).trans (le_of_eq hj')ā©
/--
Given a function `f : ι ā M` and a finite set `t ā ι`, we can always find `i : ι`, belonging to `t`
if `t` is nonempty, such that `āā j ā t, f jā ⤠āf iā`.
-/
@[to_additive /-- Given a function `f : ι ā M` and a finite set `t ā ι`, we can always find `i : ι`,
belonging to `t` if `t` is nonempty, such that `āā j ā t, f jā ⤠āf iā`. -/]
theorem exists_norm_finset_prod_le (t : Finset ι) [Nonempty ι] (f : ι ā M) :
ā i : ι, (t.Nonempty ā i ā t) ā§ āā j ā t, f jā ⤠āf iā := by
rcases t.eq_empty_or_nonempty with rfl | ht
Ā· simp
exact (fun āØi, h, h'ā© => āØi, fun _ ⦠h, h'ā©) <| exists_norm_finset_prod_le_of_nonempty ht f
/--
Given a function `f : ι ā M` and a multiset `t : Multiset ι`, we can always find `i : ι`, belonging
to `t` if `t` is nonempty, such that `ā(s.map f).prodā ⤠āf iā`.
-/
@[to_additive /-- Given a function `f : ι ā M` and a multiset `t : Multiset ι`, we can always find
`i : ι`, belonging to `t` if `t` is nonempty, such that `ā(s.map f).sumā ⤠āf iā`. -/]
theorem exists_norm_multiset_prod_le (s : Multiset ι) [Nonempty ι] {f : ι ā M} :
ā i : ι, (s ā 0 ā i ā s) ā§ ā(s.map f).prodā ⤠āf iā := by
inhabit ι
induction s using Multiset.induction_on with
| empty => simp
| cons a t hM =>
obtain āØM, hMs, hMā© := hM
by_cases! hMa : āf Mā ⤠āf aā
Ā· refine āØa, by simp, ?_ā©
Ā· rw [Multiset.map_cons, Multiset.prod_cons]
exact le_trans (norm_mul_le_max _ _) (max_le (le_refl _) (le_trans hM hMa))
Ā· rcases eq_or_ne t 0 with rfl | ht
Ā· exact āØa, by simp, by simpā©
Ā· refine āØM, ?_, ?_ā©
Ā· simp [hMs ht]
rw [Multiset.map_cons, Multiset.prod_cons]
exact le_trans (norm_mul_le_max _ _) (max_le hMa.le hM)
@[to_additive]
lemma norm_tprod_le (f : ι ā M) : āā' i, f iā ⤠⨠i, āf iā := by
rcases isEmpty_or_nonempty ι with hι | hι
Ā· -- Silly case #1 : the index type is empty
simp only [tprod_empty, norm_one', Real.iSup_of_isEmpty, le_refl]
by_cases h : Multipliable f; swap
Ā· -- Silly case #2 : the product is divergent
rw [tprod_eq_one_of_not_multipliable h, norm_one']
by_cases h_bd : BddAbove (Set.range fun i ⦠āf iā)
· exact le_ciSup_of_le h_bd hι.some (norm_nonneg' _)
Ā· rw [Real.iSup_of_not_bddAbove h_bd]
-- now the interesting case
have h_bd : BddAbove (Set.range fun i ⦠āf iā) :=
h.tendsto_cofinite_one.norm'.bddAbove_range_of_cofinite
refine le_of_tendsto' h.hasProd.norm' (fun s ⦠norm_prod_le_of_forall_le_of_nonneg ?_ ?_)
· exact le_ciSup_of_le h_bd hι.some (norm_nonneg' _)
· exact fun i _ ⦠le_ciSup h_bd i
@[to_additive]
lemma nnnorm_tprod_le (f : ι ā M) : āā' i, f iāā ⤠⨠i, āf iāā := by
simpa only [ā NNReal.coe_le_coe, coe_nnnorm', coe_iSup] using norm_tprod_le f
@[to_additive]
lemma norm_tprod_le_of_forall_le [Nonempty ι] {f : ι ā M} {C : ā} (h : ā i, āf iā ⤠C) :
āā' i, f iā ⤠C :=
(norm_tprod_le f).trans (ciSup_le h)
@[to_additive]
lemma norm_tprod_le_of_forall_le_of_nonneg {f : ι ā M} {C : ā} (hC : 0 ⤠C) (h : ā i, āf iā ⤠C) :
āā' i, f iā ⤠C := by
rcases isEmpty_or_nonempty ι
Ā· simpa only [tprod_empty, norm_one'] using hC
Ā· exact norm_tprod_le_of_forall_le h
@[to_additive]
lemma nnnorm_tprod_le_of_forall_le {f : ι ā M} {C : āā„0} (h : ā i, āf iāā ⤠C) : āā' i, f iāā ⤠C :=
(nnnorm_tprod_le f).trans (ciSup_le' h)
@[to_additive]
lemma nnnorm_prod_eq_sup_of_pairwise_ne {s : Finset ι} {f : ι ā M}
(hs : Set.Pairwise s (fun i j ⦠āf iāā ā āf jāā)) :
āā i ā s, f iāā = s.sup (fun i ⦠āf iāā) := by
induction s using Finset.cons_induction with
| empty => simp
| cons a s ha IH =>
rcases s.eq_empty_or_nonempty with rfl | hs'
Ā· simp
specialize IH (hs.mono (by simp))
obtain āØj, hj, hj'ā© : ā j ā s, āā i ā s, f iāā = āf jāā := by
simpa [IH] using s.exists_mem_eq_sup hs' _
suffices āf aāā ā āā x ā s, f xāā by simp [ā IH, nnnorm_mul_eq_max_of_nnnorm_ne_nnnorm this]
rw [hj']
apply hs <;> grind
@[to_additive]
lemma norm_prod_eq_sup'_of_pairwise_ne {s : Finset ι} {f : ι ā M} (hs' : s.Nonempty)
(hs : Set.Pairwise s (fun i j ⦠āf iā ā āf jā)) :
āā i ā s, f iā = s.sup' hs' (fun i ⦠āf iā) := by
rw [ā coe_nnnorm', nnnorm_prod_eq_sup_of_pairwise_ne, ā Finset.sup'_eq_sup hs']
Ā· exact s.comp_sup'_eq_sup'_comp hs' _ (by tauto)
Ā· simpa [ā NNReal.coe_inj] using hs
end CommGroup
end IsUltrametricDist |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Group/AddTorsor.lean | import Mathlib.Analysis.Normed.Group.Constructions
import Mathlib.Analysis.Normed.Group.Submodule
import Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic
import Mathlib.Topology.Algebra.Group.AddTorsor
import Mathlib.Topology.MetricSpace.IsometricSMul
/-!
# Torsors of additive normed group actions.
This file defines torsors of additive normed group actions, with a
metric space structure. The motivating case is Euclidean affine
spaces.
-/
noncomputable section
open NNReal Topology
open Filter
/-- A `NormedAddTorsor V P` is a torsor of an additive seminormed group
action by a `SeminormedAddCommGroup V` on points `P`. We bundle the pseudometric space
structure and require the distance to be the same as results from the
norm (which in fact implies the distance yields a pseudometric space, but
bundling just the distance and using an instance for the pseudometric space
results in type class problems). -/
class NormedAddTorsor (V : outParam Type*) (P : Type*) [SeminormedAddCommGroup V]
[PseudoMetricSpace P] extends AddTorsor V P where
dist_eq_norm' : ā x y : P, dist x y = ā(x -ᵄ y : V)ā
/-- Shortcut instance to help typeclass inference out. -/
instance (priority := 100) NormedAddTorsor.toAddTorsor' {V P : Type*} [NormedAddCommGroup V]
[MetricSpace P] [NormedAddTorsor V P] : AddTorsor V P :=
NormedAddTorsor.toAddTorsor
variable {α V P W Q : Type*} [SeminormedAddCommGroup V] [PseudoMetricSpace P] [NormedAddTorsor V P]
[NormedAddCommGroup W] [MetricSpace Q] [NormedAddTorsor W Q]
instance (priority := 100) NormedAddTorsor.to_isIsIsometricVAdd : IsIsometricVAdd V P :=
āØfun c => Isometry.of_dist_eq fun x y => by
simp [NormedAddTorsor.dist_eq_norm']ā©
/-- A `SeminormedAddCommGroup` is a `NormedAddTorsor` over itself. -/
instance (priority := 100) SeminormedAddCommGroup.toNormedAddTorsor : NormedAddTorsor V V where
dist_eq_norm' := dist_eq_norm
-- Because of the AddTorsor.nonempty instance.
/-- A nonempty affine subspace of a `NormedAddTorsor` is itself a `NormedAddTorsor`. -/
instance AffineSubspace.toNormedAddTorsor {R : Type*} [Ring R] [Module R V]
(s : AffineSubspace R P) [Nonempty s] : NormedAddTorsor s.direction s :=
{ AffineSubspace.toAddTorsor s with
dist_eq_norm' := fun x y => NormedAddTorsor.dist_eq_norm' x.val y.val }
instance : NormedAddTorsor (V Ć W) (P Ć Q) where
dist_eq_norm' x y := by
simp only [Prod.dist_eq, NormedAddTorsor.dist_eq_norm', Prod.norm_def, Prod.fst_vsub,
Prod.snd_vsub]
section
variable (V W)
/-- The distance equals the norm of subtracting two points. In this
lemma, it is necessary to have `V` as an explicit argument; otherwise
`rw dist_eq_norm_vsub` sometimes doesn't work. -/
theorem dist_eq_norm_vsub (x y : P) : dist x y = āx -ᵄ yā :=
NormedAddTorsor.dist_eq_norm' x y
theorem nndist_eq_nnnorm_vsub (x y : P) : nndist x y = āx -ᵄ yāā :=
NNReal.eq <| dist_eq_norm_vsub V x y
/-- The distance equals the norm of subtracting two points. In this
lemma, it is necessary to have `V` as an explicit argument; otherwise
`rw dist_eq_norm_vsub'` sometimes doesn't work. -/
theorem dist_eq_norm_vsub' (x y : P) : dist x y = āy -ᵄ xā :=
(dist_comm _ _).trans (dist_eq_norm_vsub _ _ _)
theorem nndist_eq_nnnorm_vsub' (x y : P) : nndist x y = āy -ᵄ xāā :=
NNReal.eq <| dist_eq_norm_vsub' V x y
end
theorem dist_vadd_cancel_left (v : V) (x y : P) : dist (v +ᵄ x) (v +ᵄ y) = dist x y :=
dist_vadd _ _ _
theorem nndist_vadd_cancel_left (v : V) (x y : P) : nndist (v +ᵄ x) (v +ᵄ y) = nndist x y :=
NNReal.eq <| dist_vadd_cancel_left _ _ _
@[simp]
theorem dist_vadd_cancel_right (vā vā : V) (x : P) : dist (vā +ᵄ x) (vā +ᵄ x) = dist vā vā := by
rw [dist_eq_norm_vsub V, dist_eq_norm, vadd_vsub_vadd_cancel_right]
@[simp]
theorem nndist_vadd_cancel_right (vā vā : V) (x : P) : nndist (vā +ᵄ x) (vā +ᵄ x) = nndist vā vā :=
NNReal.eq <| dist_vadd_cancel_right _ _ _
@[simp]
theorem dist_vadd_left (v : V) (x : P) : dist (v +ᵄ x) x = āvā := by
simp [dist_eq_norm_vsub V _ x]
@[simp]
theorem nndist_vadd_left (v : V) (x : P) : nndist (v +ᵄ x) x = āvāā :=
NNReal.eq <| dist_vadd_left _ _
@[simp]
theorem dist_vadd_right (v : V) (x : P) : dist x (v +ᵄ x) = āvā := by rw [dist_comm, dist_vadd_left]
@[simp]
theorem nndist_vadd_right (v : V) (x : P) : nndist x (v +ᵄ x) = āvāā :=
NNReal.eq <| dist_vadd_right _ _
/-- Isometry between the tangent space `V` of a (semi)normed add torsor `P` and `P` given by
addition/subtraction of `x : P`. -/
@[simps!]
def IsometryEquiv.vaddConst (x : P) : V āįµ¢ P where
toEquiv := Equiv.vaddConst x
isometry_toFun := Isometry.of_dist_eq fun _ _ => dist_vadd_cancel_right _ _ _
@[simp]
theorem dist_vsub_cancel_left (x y z : P) : dist (x -ᵄ y) (x -ᵄ z) = dist y z := by
rw [dist_eq_norm, vsub_sub_vsub_cancel_left, dist_comm, dist_eq_norm_vsub V]
@[simp]
theorem nndist_vsub_cancel_left (x y z : P) : nndist (x -ᵄ y) (x -ᵄ z) = nndist y z :=
NNReal.eq <| dist_vsub_cancel_left _ _ _
/-- Isometry between the tangent space `V` of a (semi)normed add torsor `P` and `P` given by
subtraction from `x : P`. -/
@[simps!]
def IsometryEquiv.constVSub (x : P) : P āįµ¢ V where
toEquiv := Equiv.constVSub x
isometry_toFun := Isometry.of_dist_eq fun _ _ => dist_vsub_cancel_left _ _ _
@[simp]
theorem dist_vsub_cancel_right (x y z : P) : dist (x -ᵄ z) (y -ᵄ z) = dist x y :=
(IsometryEquiv.vaddConst z).symm.dist_eq x y
@[simp]
theorem nndist_vsub_cancel_right (x y z : P) : nndist (x -ᵄ z) (y -ᵄ z) = nndist x y :=
NNReal.eq <| dist_vsub_cancel_right _ _ _
theorem dist_vadd_vadd_le (v v' : V) (p p' : P) :
dist (v +ᵄ p) (v' +ᵄ p') ⤠dist v v' + dist p p' := by
simpa using dist_triangle (v +ᵄ p) (v' +ᵄ p) (v' +ᵄ p')
theorem nndist_vadd_vadd_le (v v' : V) (p p' : P) :
nndist (v +ᵄ p) (v' +ᵄ p') ⤠nndist v v' + nndist p p' :=
dist_vadd_vadd_le _ _ _ _
theorem dist_vsub_vsub_le (pā pā pā pā : P) :
dist (pā -ᵄ pā) (pā -ᵄ pā) ⤠dist pā pā + dist pā pā := by
rw [dist_eq_norm, vsub_sub_vsub_comm, dist_eq_norm_vsub V, dist_eq_norm_vsub V]
exact norm_sub_le _ _
theorem nndist_vsub_vsub_le (pā pā pā pā : P) :
nndist (pā -ᵄ pā) (pā -ᵄ pā) ⤠nndist pā pā + nndist pā pā := by
simp only [ā NNReal.coe_le_coe, NNReal.coe_add, ā dist_nndist, dist_vsub_vsub_le]
theorem edist_vadd_vadd_le (v v' : V) (p p' : P) :
edist (v +ᵄ p) (v' +ᵄ p') ⤠edist v v' + edist p p' := by
simp only [edist_nndist]
norm_cast
apply dist_vadd_vadd_le
theorem edist_vsub_vsub_le (pā pā pā pā : P) :
edist (pā -ᵄ pā) (pā -ᵄ pā) ⤠edist pā pā + edist pā pā := by
simp only [edist_nndist]
norm_cast
apply dist_vsub_vsub_le
/-- The pseudodistance defines a pseudometric space structure on the torsor. This
is not an instance because it depends on `V` to define a `MetricSpace P`. -/
def pseudoMetricSpaceOfNormedAddCommGroupOfAddTorsor (V P : Type*) [SeminormedAddCommGroup V]
[AddTorsor V P] : PseudoMetricSpace P where
dist x y := ā(x -ᵄ y : V)ā
dist_self x := by simp
dist_comm x y := by simp only [ā neg_vsub_eq_vsub_rev y x, norm_neg]
dist_triangle x y z := by
rw [ā vsub_add_vsub_cancel]
apply norm_add_le
/-- The distance defines a metric space structure on the torsor. This
is not an instance because it depends on `V` to define a `MetricSpace P`. -/
def metricSpaceOfNormedAddCommGroupOfAddTorsor (V P : Type*) [NormedAddCommGroup V]
[AddTorsor V P] : MetricSpace P where
dist x y := ā(x -ᵄ y : V)ā
dist_self x := by simp
eq_of_dist_eq_zero h := by simpa using h
dist_comm x y := by simp only [ā neg_vsub_eq_vsub_rev y x, norm_neg]
dist_triangle x y z := by
rw [ā vsub_add_vsub_cancel]
apply norm_add_le
theorem LipschitzWith.vadd [PseudoEMetricSpace α] {f : α ā V} {g : α ā P} {Kf Kg : āā„0}
(hf : LipschitzWith Kf f) (hg : LipschitzWith Kg g) : LipschitzWith (Kf + Kg) (f +ᵄ g) :=
fun x y =>
calc
edist (f x +ᵄ g x) (f y +ᵄ g y) ⤠edist (f x) (f y) + edist (g x) (g y) :=
edist_vadd_vadd_le _ _ _ _
_ ⤠Kf * edist x y + Kg * edist x y := add_le_add (hf x y) (hg x y)
_ = (Kf + Kg) * edist x y := (add_mul _ _ _).symm
theorem LipschitzWith.vsub [PseudoEMetricSpace α] {f g : α ā P} {Kf Kg : āā„0}
(hf : LipschitzWith Kf f) (hg : LipschitzWith Kg g) : LipschitzWith (Kf + Kg) (f -ᵄ g) :=
fun x y =>
calc
edist (f x -ᵄ g x) (f y -ᵄ g y) ⤠edist (f x) (f y) + edist (g x) (g y) :=
edist_vsub_vsub_le _ _ _ _
_ ⤠Kf * edist x y + Kg * edist x y := add_le_add (hf x y) (hg x y)
_ = (Kf + Kg) * edist x y := (add_mul _ _ _).symm
theorem uniformContinuous_vadd : UniformContinuous fun x : V à P => x.1 +ᵄ x.2 :=
(LipschitzWith.prod_fst.vadd LipschitzWith.prod_snd).uniformContinuous
theorem uniformContinuous_vsub : UniformContinuous fun x : P à P => x.1 -ᵄ x.2 :=
(LipschitzWith.prod_fst.vsub LipschitzWith.prod_snd).uniformContinuous
instance : IsTopologicalAddTorsor P where
continuous_vadd := uniformContinuous_vadd.continuous
continuous_vsub := uniformContinuous_vsub.continuous |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Group/Tannery.lean | import Mathlib.Analysis.RCLike.Basic
import Mathlib.Analysis.Normed.Group.InfiniteSum
/-!
# Tannery's theorem
Tannery's theorem gives a sufficient criterion for the limit of an infinite sum (with respect to
an auxiliary parameter) to equal the sum of the pointwise limits. See
https://en.wikipedia.org/wiki/Tannery%27s_theorem. It is a special case of the dominated convergence
theorem (with the measure chosen to be the counting measure); but we give here a direct proof, in
order to avoid some unnecessary hypotheses that appear when specialising the general
measure-theoretic result.
-/
open Filter Topology
/-- **Tannery's theorem**: topological sums commute with termwise limits, when the norms of the
summands are eventually uniformly bounded by a summable function.
(This is the special case of the Lebesgue dominated convergence theorem for the counting measure
on a discrete set. However, we prove it under somewhat weaker assumptions than the general
measure-theoretic result, e.g. `G` is not assumed to be an `ā`-vector space or second countable,
and the limit is along an arbitrary filter rather than `atTop ā`.)
See also:
* `MeasureTheory.tendsto_integral_of_dominated_convergence` (for general integrals, but
with more assumptions on `G`)
* `continuous_tsum` (continuity of infinite sums in a parameter)
-/
lemma tendsto_tsum_of_dominated_convergence {α β G : Type*} {š : Filter α}
[NormedAddCommGroup G] [CompleteSpace G]
{f : α ā β ā G} {g : β ā G} {bound : β ā ā} (h_sum : Summable bound)
(hab : ā k : β, Tendsto (f Ā· k) š (š (g k)))
(h_bound : āį¶ n in š, ā k, āf n kā ⤠bound k) :
Tendsto (ā' k, f Ā· k) š (š (ā' k, g k)) := by
-- WLOG β is nonempty
rcases isEmpty_or_nonempty β
Ā· simpa only [tsum_empty] using tendsto_const_nhds
-- WLOG š ā ā„
rcases š.eq_or_neBot with rfl | _
Ā· simp only [tendsto_bot]
-- Auxiliary lemmas
have h_g_le (k : β) : āg kā ⤠bound k :=
le_of_tendsto (tendsto_norm.comp (hab k)) <| h_bound.mono (fun n h => h k)
have h_sumg : Summable (āg Ā·ā) :=
h_sum.of_norm_bounded (fun k ⦠(norm_norm (g k)).symm ⸠h_g_le k)
have h_suma : āį¶ n in š, Summable (āf n Ā·ā) := by
filter_upwards [h_bound] with n h
exact h_sum.of_norm_bounded <| by simpa only [norm_norm] using h
-- Now main proof, by an `ε / 3` argument
rw [Metric.tendsto_nhds]
intro ε hε
let āØS, hSā© := h_sum
obtain āØT, hTā© : ā (T : Finset β), dist (ā b ā T, bound b) S < ε / 3 := by
rw [HasSum, Metric.tendsto_nhds] at hS
classical exact Eventually.exists <| hS _ (by positivity)
have h1 : ā' (k : (Tį¶ : Set β)), bound k < ε / 3 := by
calc _ ⤠āā' (k : (Tį¶ : Set β)), bound kā := Real.le_norm_self _
_ = āS - ā b ā T, bound bā := congrArg _ ?_
_ < ε / 3 := by rwa [dist_eq_norm, norm_sub_rev] at hT
simpa only [h_sum.sum_add_tsum_compl, eq_sub_iff_add_eq'] using hS.tsum_eq
have h2 : Tendsto (ā k ā T, f Ā· k) š (š (T.sum g)) := tendsto_finset_sum _ (fun i _ ⦠hab i)
rw [Metric.tendsto_nhds] at h2
filter_upwards [h2 (ε / 3) (by positivity), h_suma, h_bound] with n hn h_suma h_bound
rw [dist_eq_norm, ā h_suma.of_norm.tsum_sub h_sumg.of_norm,
ā (h_suma.of_norm.sub h_sumg.of_norm).sum_add_tsum_compl (s := T),
(by ring : ε = ε / 3 + (ε / 3 + ε / 3))]
refine (norm_add_le _ _).trans_lt (add_lt_add ?_ ?_)
Ā· simpa only [dist_eq_norm, Finset.sum_sub_distrib] using hn
Ā· rw [(h_suma.subtype _).of_norm.tsum_sub (h_sumg.subtype _).of_norm]
refine (norm_sub_le _ _).trans_lt (add_lt_add ?_ ?_)
Ā· refine ((norm_tsum_le_tsum_norm (h_suma.subtype _)).trans ?_).trans_lt h1
exact (h_suma.subtype _).tsum_le_tsum (h_bound Ā·) (h_sum.subtype _)
Ā· refine ((norm_tsum_le_tsum_norm <| h_sumg.subtype _).trans ?_).trans_lt h1
exact (h_sumg.subtype _).tsum_le_tsum (h_g_le Ā·) (h_sum.subtype _) |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Group/Pointwise.lean | import Mathlib.Analysis.Normed.Group.Bounded
import Mathlib.Analysis.Normed.Group.Uniform
import Mathlib.Topology.MetricSpace.Thickening
/-!
# Properties of pointwise addition of sets in normed groups
We explore the relationships between pointwise addition of sets in normed groups, and the norm.
Notably, we show that the sum of bounded sets remain bounded.
-/
open Metric Set Pointwise Topology
variable {E : Type*}
section SeminormedGroup
variable [SeminormedGroup E] {s t : Set E}
-- note: we can't use `LipschitzOnWith.isBounded_image2` here without adding `[IsIsometricSMul E E]`
@[to_additive]
theorem Bornology.IsBounded.mul (hs : IsBounded s) (ht : IsBounded t) : IsBounded (s * t) := by
obtain āØRs, hRsā© : ā R, ā x ā s, āxā ⤠R := hs.exists_norm_le'
obtain āØRt, hRtā© : ā R, ā x ā t, āxā ⤠R := ht.exists_norm_le'
refine isBounded_iff_forall_norm_le'.2 āØRs + Rt, ?_ā©
rintro z āØx, hx, y, hy, rflā©
exact norm_mul_le_of_le' (hRs x hx) (hRt y hy)
@[to_additive]
theorem Bornology.IsBounded.of_mul (hst : IsBounded (s * t)) : IsBounded s ⨠IsBounded t :=
AntilipschitzWith.isBounded_of_image2_left _ (fun x => (isometry_mul_right x).antilipschitz) hst
@[to_additive]
theorem Bornology.IsBounded.inv : IsBounded s ā IsBounded sā»Ā¹ := by
simp_rw [isBounded_iff_forall_norm_le', ā image_inv_eq_inv, forall_mem_image, norm_inv']
exact id
@[to_additive]
theorem Bornology.IsBounded.div (hs : IsBounded s) (ht : IsBounded t) : IsBounded (s / t) :=
div_eq_mul_inv s t āø hs.mul ht.inv
end SeminormedGroup
section SeminormedCommGroup
variable [SeminormedCommGroup E] {Ī“ : ā} {s : Set E} {x y : E}
section EMetric
open EMetric
@[to_additive (attr := simp)]
theorem infEdist_inv_inv (x : E) (s : Set E) : infEdist xā»Ā¹ sā»Ā¹ = infEdist x s := by
rw [ā image_inv_eq_inv, infEdist_image isometry_inv]
@[to_additive]
theorem infEdist_inv (x : E) (s : Set E) : infEdist xā»Ā¹ s = infEdist x sā»Ā¹ := by
rw [ā infEdist_inv_inv, inv_inv]
@[to_additive]
theorem ediam_mul_le (x y : Set E) : EMetric.diam (x * y) ⤠EMetric.diam x + EMetric.diam y :=
(LipschitzOnWith.ediam_image2_le (Ā· * Ā·) _ _
(fun _ _ => (isometry_mul_right _).lipschitz.lipschitzOnWith) fun _ _ =>
(isometry_mul_left _).lipschitz.lipschitzOnWith).trans_eq <|
by simp only [ENNReal.coe_one, one_mul]
end EMetric
variable (Ī“ s x y)
@[to_additive (attr := simp)]
theorem inv_thickening : (thickening Ī“ s)ā»Ā¹ = thickening Ī“ sā»Ā¹ := by
simp_rw [thickening, ā infEdist_inv]
rfl
@[to_additive (attr := simp)]
theorem inv_cthickening : (cthickening Ī“ s)ā»Ā¹ = cthickening Ī“ sā»Ā¹ := by
simp_rw [cthickening, ā infEdist_inv]
rfl
@[to_additive (attr := simp)]
theorem inv_ball : (ball x Ī“)ā»Ā¹ = ball xā»Ā¹ Ī“ := (IsometryEquiv.inv E).preimage_ball x Ī“
@[to_additive (attr := simp)]
theorem inv_closedBall : (closedBall x Ī“)ā»Ā¹ = closedBall xā»Ā¹ Ī“ :=
(IsometryEquiv.inv E).preimage_closedBall x Ī“
@[to_additive]
theorem singleton_mul_ball : {x} * ball y Ī“ = ball (x * y) Ī“ := by
simp only [preimage_mul_ball, image_mul_left, singleton_mul, div_inv_eq_mul, mul_comm y x]
@[to_additive]
theorem singleton_div_ball : {x} / ball y Ī“ = ball (x / y) Ī“ := by
simp_rw [div_eq_mul_inv, inv_ball, singleton_mul_ball]
@[to_additive]
theorem ball_mul_singleton : ball x Ī“ * {y} = ball (x * y) Ī“ := by
rw [mul_comm, singleton_mul_ball, mul_comm y]
@[to_additive]
theorem ball_div_singleton : ball x Ī“ / {y} = ball (x / y) Ī“ := by
simp_rw [div_eq_mul_inv, inv_singleton, ball_mul_singleton]
@[to_additive]
theorem singleton_mul_ball_one : {x} * ball 1 Ī“ = ball x Ī“ := by simp
@[to_additive]
theorem singleton_div_ball_one : {x} / ball 1 Ī“ = ball x Ī“ := by
rw [singleton_div_ball, div_one]
@[to_additive]
theorem ball_one_mul_singleton : ball 1 Ī“ * {x} = ball x Ī“ := by simp
@[to_additive]
theorem ball_one_div_singleton : ball 1 Ī“ / {x} = ball xā»Ā¹ Ī“ := by
rw [ball_div_singleton, one_div]
@[to_additive]
theorem smul_ball_one : x ⢠ball (1 : E) Γ = ball x Γ := by
rw [smul_ball, smul_eq_mul, mul_one]
@[to_additive (attr := simp 1100)]
theorem singleton_mul_closedBall : {x} * closedBall y Ī“ = closedBall (x * y) Ī“ := by
simp_rw [singleton_mul, ā smul_eq_mul, image_smul, smul_closedBall]
@[to_additive (attr := simp 1100)]
theorem singleton_div_closedBall : {x} / closedBall y Ī“ = closedBall (x / y) Ī“ := by
simp_rw [div_eq_mul_inv, inv_closedBall, singleton_mul_closedBall]
@[to_additive (attr := simp 1100)]
theorem closedBall_mul_singleton : closedBall x Ī“ * {y} = closedBall (x * y) Ī“ := by
simp [mul_comm _ {y}, mul_comm y]
@[to_additive (attr := simp 1100)]
theorem closedBall_div_singleton : closedBall x Ī“ / {y} = closedBall (x / y) Ī“ := by
simp [div_eq_mul_inv]
@[to_additive]
theorem singleton_mul_closedBall_one : {x} * closedBall 1 Ī“ = closedBall x Ī“ := by simp
@[to_additive]
theorem singleton_div_closedBall_one : {x} / closedBall 1 Ī“ = closedBall x Ī“ := by
rw [singleton_div_closedBall, div_one]
@[to_additive]
theorem closedBall_one_mul_singleton : closedBall 1 Ī“ * {x} = closedBall x Ī“ := by simp
@[to_additive]
theorem closedBall_one_div_singleton : closedBall 1 Ī“ / {x} = closedBall xā»Ā¹ Ī“ := by simp
@[to_additive (attr := simp 1100)]
theorem smul_closedBall_one : x ⢠closedBall (1 : E) Γ = closedBall x Γ := by simp
@[to_additive]
theorem mul_ball_one : s * ball 1 Ī“ = thickening Ī“ s := by
rw [thickening_eq_biUnion_ball]
convert iUnionā_mul (fun x (_ : x ā s) => {x}) (ball (1 : E) Ī“)
Ā· exact s.biUnion_of_singleton.symm
ext x
simp_rw [singleton_mul_ball, mul_one]
@[to_additive]
theorem div_ball_one : s / ball 1 Ī“ = thickening Ī“ s := by simp [div_eq_mul_inv, mul_ball_one]
@[to_additive]
theorem ball_mul_one : ball 1 Ī“ * s = thickening Ī“ s := by rw [mul_comm, mul_ball_one]
@[to_additive]
theorem ball_div_one : ball 1 Ī“ / s = thickening Ī“ sā»Ā¹ := by simp [div_eq_mul_inv, ball_mul_one]
@[to_additive (attr := simp)]
theorem mul_ball : s * ball x Γ = x ⢠thickening Γ s := by
rw [ā smul_ball_one, mul_smul_comm, mul_ball_one]
@[to_additive (attr := simp)]
theorem div_ball : s / ball x Ī“ = xā»Ā¹ ⢠thickening Ī“ s := by simp [div_eq_mul_inv]
@[to_additive (attr := simp)]
theorem ball_mul : ball x Γ * s = x ⢠thickening Γ s := by rw [mul_comm, mul_ball]
@[to_additive (attr := simp)]
theorem ball_div : ball x Ī“ / s = x ⢠thickening Ī“ sā»Ā¹ := by simp [div_eq_mul_inv]
variable {Ī“ s x y}
@[to_additive]
theorem IsCompact.mul_closedBall_one (hs : IsCompact s) (hΓ : 0 ⤠Γ) :
s * closedBall (1 : E) Ī“ = cthickening Ī“ s := by
rw [hs.cthickening_eq_biUnion_closedBall hΓ]
ext x
simp only [mem_mul, dist_eq_norm_div, exists_prop, mem_iUnion, mem_closedBall,
ā eq_div_iff_mul_eq'', div_one, exists_eq_right]
@[to_additive]
theorem IsCompact.div_closedBall_one (hs : IsCompact s) (hΓ : 0 ⤠Γ) :
s / closedBall 1 Γ = cthickening Γ s := by simp [div_eq_mul_inv, hs.mul_closedBall_one hΓ]
@[to_additive]
theorem IsCompact.closedBall_one_mul (hs : IsCompact s) (hΓ : 0 ⤠Γ) :
closedBall 1 Γ * s = cthickening Γ s := by rw [mul_comm, hs.mul_closedBall_one hΓ]
@[to_additive]
theorem IsCompact.closedBall_one_div (hs : IsCompact s) (hΓ : 0 ⤠Γ) :
closedBall 1 Ī“ / s = cthickening Ī“ sā»Ā¹ := by
simp [div_eq_mul_inv, mul_comm, hs.inv.mul_closedBall_one hΓ]
@[to_additive]
theorem IsCompact.mul_closedBall (hs : IsCompact s) (hΓ : 0 ⤠Γ) (x : E) :
s * closedBall x Γ = x ⢠cthickening Γ s := by
rw [ā smul_closedBall_one, mul_smul_comm, hs.mul_closedBall_one hĪ“]
@[to_additive]
theorem IsCompact.div_closedBall (hs : IsCompact s) (hΓ : 0 ⤠Γ) (x : E) :
s / closedBall x Ī“ = xā»Ā¹ ⢠cthickening Ī“ s := by
simp [div_eq_mul_inv, hs.mul_closedBall hΓ]
@[to_additive]
theorem IsCompact.closedBall_mul (hs : IsCompact s) (hΓ : 0 ⤠Γ) (x : E) :
closedBall x Γ * s = x ⢠cthickening Γ s := by rw [mul_comm, hs.mul_closedBall hΓ]
@[to_additive]
theorem IsCompact.closedBall_div (hs : IsCompact s) (hΓ : 0 ⤠Γ) (x : E) :
closedBall x Γ * s = x ⢠cthickening Γ s := by
simp [hs.closedBall_mul hΓ]
end SeminormedCommGroup |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Group/Completion.lean | import Mathlib.Analysis.Normed.Group.Uniform
import Mathlib.Topology.Algebra.GroupCompletion
import Mathlib.Topology.MetricSpace.Completion
/-!
# Completion of a normed group
In this file we prove that the completion of a (semi)normed group is a normed group.
## Tags
normed group, completion
-/
noncomputable section
namespace UniformSpace
namespace Completion
variable (E : Type*)
instance [UniformSpace E] [Norm E] : Norm (Completion E) where
norm := Completion.extension Norm.norm
@[simp]
theorem norm_coe {E} [SeminormedAddCommGroup E] (x : E) : ā(x : Completion E)ā = āxā :=
Completion.extension_coe uniformContinuous_norm x
instance [SeminormedAddCommGroup E] : NormedAddCommGroup (Completion E) where
dist_eq x y := by
induction x, y using Completion.induction_onā
Ā· refine isClosed_eq (Completion.uniformContinuous_extensionā _).continuous ?_
exact Continuous.comp Completion.continuous_extension continuous_sub
Ā· rw [ā Completion.coe_sub, norm_coe, Completion.dist_eq, dist_eq_norm]
@[simp]
theorem nnnorm_coe {E} [SeminormedAddCommGroup E] (x : E) : ā(x : Completion E)āā = āxāā := by
simp [nnnorm]
@[simp]
lemma enorm_coe {E} [SeminormedAddCommGroup E] (x : E) : ā(x : Completion E)āā = āxāā := by
simp [enorm]
end Completion
end UniformSpace |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Group/CocompactMap.lean | import Mathlib.Analysis.Normed.Group.Basic
import Mathlib.Topology.ContinuousMap.CocompactMap
import Mathlib.Topology.MetricSpace.Bounded
/-!
# Cocompact maps in normed groups
This file gives a characterization of cocompact maps in terms of norm estimates.
## Main statements
* `CocompactMapClass.norm_le`: Every cocompact map satisfies a norm estimate
* `ContinuousMapClass.toCocompactMapClass_of_norm`: Conversely, this norm estimate implies that a
map is cocompact.
-/
open Filter Metric
variable {š E F š : Type*}
variable [NormedAddCommGroup E] [NormedAddCommGroup F]
variable {f : š}
theorem CocompactMapClass.norm_le [ProperSpace F] [FunLike š E F] [CocompactMapClass š E F]
(ε : ā) : ā r : ā, ā x : E, r < āxā ā ε < āf xā := by
have h := cocompact_tendsto f
rw [tendsto_def] at h
specialize h (Metric.closedBall 0 ε)į¶ (mem_cocompact_of_closedBall_compl_subset 0 āØĪµ, rfl.subsetā©)
rcases closedBall_compl_subset_of_mem_cocompact h 0 with āØr, hrā©
use r
intro x hx
suffices x ā fā»Ā¹' (Metric.closedBall 0 ε)į¶ by simp_all
apply hr
simp [hx]
theorem Filter.tendsto_cocompact_cocompact_of_norm [ProperSpace E] {f : E ā F}
(h : ā ε : ā, ā r : ā, ā x : E, r < āxā ā ε < āf xā) :
Tendsto f (cocompact E) (cocompact F) := by
rw [tendsto_def]
intro s hs
rcases closedBall_compl_subset_of_mem_cocompact hs 0 with āØĪµ, hεā©
rcases h ε with āØr, hrā©
apply mem_cocompact_of_closedBall_compl_subset 0
use r
intro x hx
simp only [Set.mem_compl_iff, Metric.mem_closedBall, dist_zero_right, not_le] at hx
apply hε
simp [hr x hx]
theorem ContinuousMapClass.toCocompactMapClass_of_norm [ProperSpace E] [FunLike š E F]
[ContinuousMapClass š E F] (h : ā (f : š) (ε : ā), ā r : ā, ā x : E, r < āxā ā ε < āf xā) :
CocompactMapClass š E F where
cocompact_tendsto := (tendsto_cocompact_cocompact_of_norm <| h Ā·) |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Group/SeparationQuotient.lean | import Mathlib.Analysis.Normed.Group.Hom
import Mathlib.Topology.Algebra.SeparationQuotient.Hom
/-!
# Lifts of maps to separation quotients of seminormed groups
For any `SeminormedAddCommGroup M`, a `NormedAddCommGroup` instance has been defined in
`Mathlib/Analysis/Normed/Group/Uniform.lean`.
## Main definitions
We use `M` and `N` to denote seminormed groups.
All the following definitions are in the `SeparationQuotient` namespace. Hence we can access
`SeparationQuotient.normedMk` as `normedMk`.
* `normedMk` : the normed group hom from `M` to `SeparationQuotient M`.
* `liftNormedAddGroupHom` : any bounded group hom `f : M ā N` such that `ā x, āxā = 0 ā f x = 0`
descends to a bounded group hom `SeparationQuotient M ā N`.
Here, `(f : NormedAddGroupHom M N)`, `(hf : ā x : M, āxā = 0 ā f x = 0)`
and `liftNormedAddGroupHom f hf : NormedAddGroupHom (SeparationQuotient M) N` such that
`liftNormedAddGroupHom f hf (mk x) = f x`.
## Main results
* `norm_normedMk_eq_one` : the operator norm of the projection is `1` if the subspace is not `ā¤`.
* `norm_liftNormedAddGroupHom_le` : `āliftNormedAddGroupHom f hfā ⤠āfā`.
-/
section
open SeparationQuotient NNReal
variable {M N : Type*} [SeminormedAddCommGroup M] [SeminormedAddCommGroup N]
namespace SeparationQuotient
open NormedAddGroupHom
/-- The morphism from a seminormed group to the quotient by the inseparable setoid. -/
@[simps]
noncomputable def normedMk : NormedAddGroupHom M (SeparationQuotient M) where
__ := mkAddMonoidHom
bound' := āØ1, by simpā©
/-- The operator norm of the projection is at most `1`. -/
theorem norm_normedMk_le : ānormedMk (M := M)ā ⤠1 :=
NormedAddGroupHom.opNorm_le_bound _ zero_le_one fun m => by simp
lemma apply_eq_apply_of_inseparable {F : Type*} [FunLike F M N] [AddMonoidHomClass F M N] (f : F)
(hf : ā x, āxā = 0 ā f x = 0) : ā x y, Inseparable x y ā f x = f y :=
fun x y h ⦠eq_of_sub_eq_zero <| by
rw [ā map_sub]
rw [Metric.inseparable_iff, dist_eq_norm] at h
exact hf (x - y) h
/-- The lift of a group hom to the separation quotient as a group hom. -/
@[simps]
noncomputable def liftNormedAddGroupHom (f : NormedAddGroupHom M N)
(hf : ā x, āxā = 0 ā f x = 0) : NormedAddGroupHom (SeparationQuotient M) N where
toFun := SeparationQuotient.liftContinuousAddMonoidHom f <| apply_eq_apply_of_inseparable f hf
map_add' vā vā := map_add ..
bound' := by
refine āØāfā, fun v ⦠?_ā©
obtain āØv, rflā© := surjective_mk v
exact le_opNorm f v
theorem norm_liftNormedAddGroupHom_apply_le (f : NormedAddGroupHom M N)
(hf : ā x, āxā = 0 ā f x = 0) (x : SeparationQuotient M) :
āliftNormedAddGroupHom f hf xā ⤠āfā * āxā := by
obtain āØx, rflā© := surjective_mk x
exact le_opNorm f x
/-- The equivalence between `NormedAddGroupHom M N` vanishing on the inseparable setoid and
`NormedAddGroupHom (SeparationQuotient M) N`. -/
@[simps]
noncomputable def liftNormedAddGroupHomEquiv {N : Type*} [SeminormedAddCommGroup N] :
{f : NormedAddGroupHom M N // ā x, āxā = 0 ā f x = 0} ā
NormedAddGroupHom (SeparationQuotient M) N where
toFun f := liftNormedAddGroupHom f f.prop
invFun g := āØg.comp normedMk, by
intro x hx
rw [ā norm_mk, norm_eq_zero] at hx
simp [hx]ā©
right_inv _ := by
ext x
obtain āØx, rflā© := surjective_mk x
rfl
/-- For a norm-continuous group homomorphism `f`, its lift to the separation quotient
is bounded by the norm of `f`. -/
theorem norm_liftNormedAddGroupHom_le {N : Type*} [SeminormedAddCommGroup N]
(f : NormedAddGroupHom M N) (hf : ā s, āsā = 0 ā f s = 0) :
āliftNormedAddGroupHom f hfā ⤠āfā :=
NormedAddGroupHom.opNorm_le_bound _ (norm_nonneg f) (norm_liftNormedAddGroupHom_apply_le f hf)
theorem liftNormedAddGroupHom_norm_le {N : Type*} [SeminormedAddCommGroup N]
(f : NormedAddGroupHom M N) (hf : ā s, āsā = 0 ā f s = 0) {c : āā„0} (fb : āfā ⤠c) :
āliftNormedAddGroupHom f hfā ⤠c :=
(norm_liftNormedAddGroupHom_le f hf).trans fb
theorem liftNormedAddGroupHom_normNoninc {N : Type*} [SeminormedAddCommGroup N]
(f : NormedAddGroupHom M N) (hf : ā s, āsā = 0 ā f s = 0) (fb : f.NormNoninc) :
(liftNormedAddGroupHom f hf).NormNoninc := fun x => by
have fb' : āfā ⤠1 := NormedAddGroupHom.NormNoninc.normNoninc_iff_norm_le_one.mp fb
exact le_trans (norm_liftNormedAddGroupHom_apply_le f hf x)
(mul_le_of_le_one_left (norm_nonneg x) fb')
/-- The operator norm of the projection is `1` if there is an element whose norm is different from
`0`. -/
theorem norm_normedMk_eq_one (h : ā x : M, āxā ā 0) :
ānormedMk (M := M)ā = 1 := by
apply NormedAddGroupHom.opNorm_eq_of_bounds _ zero_le_one
· simpa only [normedMk_apply, one_mul] using fun _ ⦠le_rfl
Ā· intro N _ hle
obtain āØx, _ā© := h
exact one_le_of_le_mul_rightā (by positivity) (hle x)
/-- The projection is `0` if and only if all the elements have norm `0`. -/
theorem normedMk_eq_zero_iff : normedMk (M := M) = 0 ā ā (x : M), āxā = 0 := by
constructor
Ā· intro h x
rw [SeparationQuotient.mk_eq_zero_iff.mp]
have : normedMk x = 0 := by
rw [h]
simp only [zero_apply]
rw [ā this]
simp
Ā· intro h
ext x
simpa [ā norm_eq_zero] using h x
end SeparationQuotient
end |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Group/NullSubmodule.lean | import Mathlib.Analysis.Normed.Group.Continuity
import Mathlib.Analysis.Normed.MulAction
/-!
# The null subgroup in a seminormed commutative group
For any `SeminormedAddCommGroup M`, the quotient `SeparationQuotient M` by the null subgroup is
defined as a `NormedAddCommGroup` instance in `Mathlib/Analysis/Normed/Group/Uniform.lean`. Here we
define the null space as a subgroup.
## Main definitions
We use `M` to denote seminormed groups.
* `nullAddSubgroup` : the subgroup of elements `x` with `āxā = 0`.
If `E` is a vector space over `š` with an appropriate continuous action, we also define the null
subspace as a submodule of `E`.
* `nullSubmodule` : the subspace of elements `x` with `āxā = 0`.
-/
variable {M : Type*} [SeminormedCommGroup M]
variable (M) in
/-- The null subgroup with respect to the norm. -/
@[to_additive /-- The additive null subgroup with respect to the norm. -/]
def nullSubgroup : Subgroup M where
carrier := {x : M | āxā = 0}
mul_mem' {x y} (hx : āxā = 0) (hy : āyā = 0) := by
apply le_antisymm _ (norm_nonneg' _)
refine (norm_mul_le' x y).trans_eq ?_
rw [hx, hy, add_zero]
one_mem' := norm_one'
inv_mem' {x} (hx : āxā = 0) := by simpa only [Set.mem_setOf_eq, norm_inv'] using hx
@[to_additive]
lemma isClosed_nullSubgroup : IsClosed (nullSubgroup M : Set M) := by
apply isClosed_singleton.preimage continuous_norm'
@[to_additive (attr := simp)]
lemma mem_nullSubgroup_iff {x : M} : x ā nullSubgroup M ā āxā = 0 := Iff.rfl
variable {š E : Type*}
variable [SeminormedAddCommGroup E] [SeminormedRing š] [Module š E] [IsBoundedSMul š E]
variable (š E) in
/-- The null space with respect to the norm. -/
def nullSubmodule : Submodule š E where
__ := nullAddSubgroup E
smul_mem' c x (hx : āxā = 0) := by
apply le_antisymm _ (norm_nonneg _)
refine (norm_smul_le _ _).trans_eq ?_
rw [hx, mul_zero]
lemma isClosed_nullSubmodule : IsClosed (nullSubmodule š E : Set E) := isClosed_nullAddSubgroup
@[simp]
lemma mem_nullSubmodule_iff {x : E} : x ā nullSubmodule š E ā āxā = 0 := Iff.rfl |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Group/Basic.lean | import Mathlib.Analysis.Normed.Group.Seminorm
import Mathlib.Data.NNReal.Basic
import Mathlib.Topology.Algebra.Support
import Mathlib.Topology.MetricSpace.Basic
import Mathlib.Topology.Order.Real
/-!
# Normed (semi)groups
In this file we define 10 classes:
* `Norm`, `NNNorm`: auxiliary classes endowing a type `α` with a function `norm : α ā ā`
(notation: `āxā`) and `nnnorm : α ā āā„0` (notation: `āxāā`), respectively;
* `Seminormed...Group`: A seminormed (additive) (commutative) group is an (additive) (commutative)
group with a norm and a compatible pseudometric space structure:
`ā x y, dist x y = āx / yā` or `ā x y, dist x y = āx - yā`, depending on the group operation.
* `Normed...Group`: A normed (additive) (commutative) group is an (additive) (commutative) group
with a norm and a compatible metric space structure.
We also prove basic properties of (semi)normed groups and provide some instances.
## Notes
The current convention `dist x y = āx - yā` means that the distance is invariant under right
addition, but actions in mathlib are usually from the left. This means we might want to change it to
`dist x y = ā-x + yā`.
The normed group hierarchy would lend itself well to a mixin design (that is, having
`SeminormedGroup` and `SeminormedAddGroup` not extend `Group` and `AddGroup`), but we choose not
to for performance concerns.
## Tags
normed group
-/
variable {š α ι Īŗ E F G : Type*}
open Filter Function Metric Bornology
open ENNReal Filter NNReal Uniformity Pointwise Topology
/-- Auxiliary class, endowing a type `E` with a function `norm : E ā ā` with notation `āxā`. This
class is designed to be extended in more interesting classes specifying the properties of the norm.
-/
@[notation_class]
class Norm (E : Type*) where
/-- the `ā`-valued norm function. -/
norm : E ā ā
/-- Auxiliary class, endowing a type `α` with a function `nnnorm : α ā āā„0` with notation `āxāā`. -/
@[notation_class]
class NNNorm (E : Type*) where
/-- the `āā„0`-valued norm function. -/
nnnorm : E ā āā„0
/-- Auxiliary class, endowing a type `α` with a function `enorm : α ā āā„0ā` with notation `āxāā`. -/
@[notation_class]
class ENorm (E : Type*) where
/-- the `āā„0ā`-valued norm function. -/
enorm : E ā āā„0ā
export Norm (norm)
export NNNorm (nnnorm)
export ENorm (enorm)
@[inherit_doc] notation "ā" e "ā" => norm e
@[inherit_doc] notation "ā" e "āā" => nnnorm e
@[inherit_doc] notation "ā" e "āā" => enorm e
section ENorm
variable {E : Type*} [NNNorm E] {x : E} {r : āā„0}
instance NNNorm.toENorm : ENorm E where enorm := (āĀ·āā : E ā āā„0ā)
lemma enorm_eq_nnnorm (x : E) : āxāā = āxāā := rfl
@[simp] lemma toNNReal_enorm (x : E) : āxāā.toNNReal = āxāā := rfl
@[simp, norm_cast] lemma coe_le_enorm : r ⤠āxāā ā r ⤠āxāā := by simp [enorm]
@[simp, norm_cast] lemma enorm_le_coe : āxāā ⤠r ā āxāā ⤠r := by simp [enorm]
@[simp, norm_cast] lemma coe_lt_enorm : r < āxāā ā r < āxāā := by simp [enorm]
@[simp, norm_cast] lemma enorm_lt_coe : āxāā < r ā āxāā < r := by simp [enorm]
@[aesop (rule_sets := [finiteness]) safe apply, simp]
lemma enorm_ne_top : āxāā ā ā := by simp [enorm]
@[simp] lemma enorm_lt_top : āxāā < ā := by simp [enorm]
end ENorm
/-- A type `E` equipped with a continuous map `āĀ·āā : E ā āā„0ā`
NB. We do not demand that the topology is somehow defined by the enorm:
for `āā„0ā` (the motivating example behind this definition), this is not true. -/
class ContinuousENorm (E : Type*) [TopologicalSpace E] extends ENorm E where
continuous_enorm : Continuous enorm
/-- An e-seminormed monoid is an additive monoid endowed with a continuous enorm.
Note that we do not ask for the enorm to be positive definite:
non-trivial elements may have enorm zero. -/
class ESeminormedAddMonoid (E : Type*) [TopologicalSpace E]
extends ContinuousENorm E, AddMonoid E where
enorm_zero : ā(0 : E)āā = 0
protected enorm_add_le : ā x y : E, āx + yāā ⤠āxāā + āyāā
/-- An enormed monoid is an additive monoid endowed with a continuous enorm,
which is positive definite: in other words, this is an `ESeminormedAddMonoid` with a positive
definiteness condition added. -/
class ENormedAddMonoid (E : Type*) [TopologicalSpace E]
extends ESeminormedAddMonoid E where
enorm_eq_zero : ā x : E, āxāā = 0 ā x = 0
/-- An e-seminormed monoid is a monoid endowed with a continuous enorm.
Note that we only ask for the enorm to be a semi-norm: non-trivial elements may have enorm zero. -/
@[to_additive]
class ESeminormedMonoid (E : Type*) [TopologicalSpace E] extends ContinuousENorm E, Monoid E where
enorm_zero : ā(1 : E)āā = 0
enorm_mul_le : ā x y : E, āx * yāā ⤠āxāā + āyāā
/-- An enormed monoid is a monoid endowed with a continuous enorm,
which is positive definite: in other words, this is an `ESeminormedMonoid` with a positive
definiteness condition added. -/
@[to_additive]
class ENormedMonoid (E : Type*) [TopologicalSpace E] extends ESeminormedMonoid E where
enorm_eq_zero : ā x : E, āxāā = 0 ā x = 1
/-- An e-seminormed commutative monoid is an additive commutative monoid endowed with a continuous
enorm.
We don't have `ESeminormedAddCommMonoid` extend `EMetricSpace`, since the canonical instance `āā„0ā`
is not an `EMetricSpace`. This is because `āā„0ā` carries the order topology, which is distinct from
the topology coming from `edist`. -/
class ESeminormedAddCommMonoid (E : Type*) [TopologicalSpace E]
extends ESeminormedAddMonoid E, AddCommMonoid E where
/-- An enormed commutative monoid is an additive commutative monoid
endowed with a continuous enorm which is positive definite.
We don't have `ENormedAddCommMonoid` extend `EMetricSpace`, since the canonical instance `āā„0ā`
is not an `EMetricSpace`. This is because `āā„0ā` carries the order topology, which is distinct from
the topology coming from `edist`. -/
class ENormedAddCommMonoid (E : Type*) [TopologicalSpace E]
extends ESeminormedAddCommMonoid E, ENormedAddMonoid E where
/-- An e-seminormed commutative monoid is a commutative monoid endowed with a continuous enorm. -/
@[to_additive]
class ESeminormedCommMonoid (E : Type*) [TopologicalSpace E]
extends ESeminormedMonoid E, CommMonoid E where
/-- An enormed commutative monoid is a commutative monoid endowed with a continuous enorm
which is positive definite. -/
@[to_additive]
class ENormedCommMonoid (E : Type*) [TopologicalSpace E]
extends ESeminormedCommMonoid E, ENormedMonoid E where
/-- A seminormed group is an additive group endowed with a norm for which `dist x y = āx - yā`
defines a pseudometric space structure. -/
class SeminormedAddGroup (E : Type*) extends Norm E, AddGroup E, PseudoMetricSpace E where
dist := fun x y => āx - yā
/-- The distance function is induced by the norm. -/
dist_eq : ā x y, dist x y = āx - yā := by aesop
/-- A seminormed group is a group endowed with a norm for which `dist x y = āx / yā` defines a
pseudometric space structure. -/
@[to_additive]
class SeminormedGroup (E : Type*) extends Norm E, Group E, PseudoMetricSpace E where
dist := fun x y => āx / yā
/-- The distance function is induced by the norm. -/
dist_eq : ā x y, dist x y = āx / yā := by aesop
/-- A normed group is an additive group endowed with a norm for which `dist x y = āx - yā` defines a
metric space structure. -/
class NormedAddGroup (E : Type*) extends Norm E, AddGroup E, MetricSpace E where
dist := fun x y => āx - yā
/-- The distance function is induced by the norm. -/
dist_eq : ā x y, dist x y = āx - yā := by aesop
/-- A normed group is a group endowed with a norm for which `dist x y = āx / yā` defines a metric
space structure. -/
@[to_additive]
class NormedGroup (E : Type*) extends Norm E, Group E, MetricSpace E where
dist := fun x y => āx / yā
/-- The distance function is induced by the norm. -/
dist_eq : ā x y, dist x y = āx / yā := by aesop
/-- A seminormed group is an additive group endowed with a norm for which `dist x y = āx - yā`
defines a pseudometric space structure. -/
class SeminormedAddCommGroup (E : Type*) extends Norm E, AddCommGroup E,
PseudoMetricSpace E where
dist := fun x y => āx - yā
/-- The distance function is induced by the norm. -/
dist_eq : ā x y, dist x y = āx - yā := by aesop
/-- A seminormed group is a group endowed with a norm for which `dist x y = āx / yā`
defines a pseudometric space structure. -/
@[to_additive]
class SeminormedCommGroup (E : Type*) extends Norm E, CommGroup E, PseudoMetricSpace E where
dist := fun x y => āx / yā
/-- The distance function is induced by the norm. -/
dist_eq : ā x y, dist x y = āx / yā := by aesop
/-- A normed group is an additive group endowed with a norm for which `dist x y = āx - yā` defines a
metric space structure. -/
class NormedAddCommGroup (E : Type*) extends Norm E, AddCommGroup E, MetricSpace E where
dist := fun x y => āx - yā
/-- The distance function is induced by the norm. -/
dist_eq : ā x y, dist x y = āx - yā := by aesop
/-- A normed group is a group endowed with a norm for which `dist x y = āx / yā` defines a metric
space structure. -/
@[to_additive]
class NormedCommGroup (E : Type*) extends Norm E, CommGroup E, MetricSpace E where
dist := fun x y => āx / yā
/-- The distance function is induced by the norm. -/
dist_eq : ā x y, dist x y = āx / yā := by aesop
-- See note [lower instance priority]
@[to_additive]
instance (priority := 100) NormedGroup.toSeminormedGroup [NormedGroup E] : SeminormedGroup E :=
{ ā¹NormedGroup Eāŗ with }
-- See note [lower instance priority]
@[to_additive]
instance (priority := 100) NormedCommGroup.toSeminormedCommGroup [NormedCommGroup E] :
SeminormedCommGroup E :=
{ ā¹NormedCommGroup Eāŗ with }
-- See note [lower instance priority]
@[to_additive]
instance (priority := 100) SeminormedCommGroup.toSeminormedGroup [SeminormedCommGroup E] :
SeminormedGroup E :=
{ ā¹SeminormedCommGroup Eāŗ with }
-- See note [lower instance priority]
@[to_additive]
instance (priority := 100) NormedCommGroup.toNormedGroup [NormedCommGroup E] : NormedGroup E :=
{ ā¹NormedCommGroup Eāŗ with }
-- See note [reducible non-instances]
/-- Construct a `NormedGroup` from a `SeminormedGroup` satisfying `ā x, āxā = 0 ā x = 1`. This
avoids having to go back to the `(Pseudo)MetricSpace` level when declaring a `NormedGroup`
instance as a special case of a more general `SeminormedGroup` instance. -/
@[to_additive /-- Construct a `NormedAddGroup` from a `SeminormedAddGroup`
satisfying `ā x, āxā = 0 ā x = 0`. This avoids having to go back to the `(Pseudo)MetricSpace`
level when declaring a `NormedAddGroup` instance as a special case of a more general
`SeminormedAddGroup` instance. -/]
abbrev NormedGroup.ofSeparation [SeminormedGroup E] (h : ā x : E, āxā = 0 ā x = 1) :
NormedGroup E where
dist_eq := ā¹SeminormedGroup Eāŗ.dist_eq
toMetricSpace :=
{ eq_of_dist_eq_zero := fun hxy =>
div_eq_one.1 <| h _ <| (ā¹SeminormedGroup Eāŗ.dist_eq _ _).symm.trans hxy }
-- See note [reducible non-instances]
/-- Construct a `NormedCommGroup` from a `SeminormedCommGroup` satisfying
`ā x, āxā = 0 ā x = 1`. This avoids having to go back to the `(Pseudo)MetricSpace` level when
declaring a `NormedCommGroup` instance as a special case of a more general `SeminormedCommGroup`
instance. -/
@[to_additive /-- Construct a `NormedAddCommGroup` from a
`SeminormedAddCommGroup` satisfying `ā x, āxā = 0 ā x = 0`. This avoids having to go back to the
`(Pseudo)MetricSpace` level when declaring a `NormedAddCommGroup` instance as a special case
of a more general `SeminormedAddCommGroup` instance. -/]
abbrev NormedCommGroup.ofSeparation [SeminormedCommGroup E] (h : ā x : E, āxā = 0 ā x = 1) :
NormedCommGroup E :=
{ ā¹SeminormedCommGroup Eāŗ, NormedGroup.ofSeparation h with }
-- See note [reducible non-instances]
/-- Construct a seminormed group from a multiplication-invariant distance. -/
@[to_additive
/-- Construct a seminormed group from a translation-invariant distance. -/]
abbrev SeminormedGroup.ofMulDist [Norm E] [Group E] [PseudoMetricSpace E]
(hā : ā x : E, āxā = dist x 1) (hā : ā x y z : E, dist x y ⤠dist (x * z) (y * z)) :
SeminormedGroup E where
dist_eq x y := by
rw [hā]; apply le_antisymm
Ā· simpa only [div_eq_mul_inv, ā mul_inv_cancel y] using hā _ _ _
Ā· simpa only [div_mul_cancel, one_mul] using hā (x / y) 1 y
-- See note [reducible non-instances]
/-- Construct a seminormed group from a multiplication-invariant pseudodistance. -/
@[to_additive
/-- Construct a seminormed group from a translation-invariant pseudodistance. -/]
abbrev SeminormedGroup.ofMulDist' [Norm E] [Group E] [PseudoMetricSpace E]
(hā : ā x : E, āxā = dist x 1) (hā : ā x y z : E, dist (x * z) (y * z) ⤠dist x y) :
SeminormedGroup E where
dist_eq x y := by
rw [hā]; apply le_antisymm
Ā· simpa only [div_mul_cancel, one_mul] using hā (x / y) 1 y
Ā· simpa only [div_eq_mul_inv, ā mul_inv_cancel y] using hā _ _ _
-- See note [reducible non-instances]
/-- Construct a seminormed group from a multiplication-invariant pseudodistance. -/
@[to_additive
/-- Construct a seminormed group from a translation-invariant pseudodistance. -/]
abbrev SeminormedCommGroup.ofMulDist [Norm E] [CommGroup E] [PseudoMetricSpace E]
(hā : ā x : E, āxā = dist x 1) (hā : ā x y z : E, dist x y ⤠dist (x * z) (y * z)) :
SeminormedCommGroup E :=
{ SeminormedGroup.ofMulDist hā hā with
mul_comm := mul_comm }
-- See note [reducible non-instances]
/-- Construct a seminormed group from a multiplication-invariant pseudodistance. -/
@[to_additive
/-- Construct a seminormed group from a translation-invariant pseudodistance. -/]
abbrev SeminormedCommGroup.ofMulDist' [Norm E] [CommGroup E] [PseudoMetricSpace E]
(hā : ā x : E, āxā = dist x 1) (hā : ā x y z : E, dist (x * z) (y * z) ⤠dist x y) :
SeminormedCommGroup E :=
{ SeminormedGroup.ofMulDist' hā hā with
mul_comm := mul_comm }
-- See note [reducible non-instances]
/-- Construct a normed group from a multiplication-invariant distance. -/
@[to_additive
/-- Construct a normed group from a translation-invariant distance. -/]
abbrev NormedGroup.ofMulDist [Norm E] [Group E] [MetricSpace E] (hā : ā x : E, āxā = dist x 1)
(hā : ā x y z : E, dist x y ⤠dist (x * z) (y * z)) : NormedGroup E :=
{ SeminormedGroup.ofMulDist hā hā with
eq_of_dist_eq_zero := eq_of_dist_eq_zero }
-- See note [reducible non-instances]
/-- Construct a normed group from a multiplication-invariant pseudodistance. -/
@[to_additive
/-- Construct a normed group from a translation-invariant pseudodistance. -/]
abbrev NormedGroup.ofMulDist' [Norm E] [Group E] [MetricSpace E] (hā : ā x : E, āxā = dist x 1)
(hā : ā x y z : E, dist (x * z) (y * z) ⤠dist x y) : NormedGroup E :=
{ SeminormedGroup.ofMulDist' hā hā with
eq_of_dist_eq_zero := eq_of_dist_eq_zero }
-- See note [reducible non-instances]
/-- Construct a normed group from a multiplication-invariant pseudodistance. -/
@[to_additive
/-- Construct a normed group from a translation-invariant pseudodistance. -/]
abbrev NormedCommGroup.ofMulDist [Norm E] [CommGroup E] [MetricSpace E]
(hā : ā x : E, āxā = dist x 1) (hā : ā x y z : E, dist x y ⤠dist (x * z) (y * z)) :
NormedCommGroup E :=
{ NormedGroup.ofMulDist hā hā with
mul_comm := mul_comm }
-- See note [reducible non-instances]
/-- Construct a normed group from a multiplication-invariant pseudodistance. -/
@[to_additive
/-- Construct a normed group from a translation-invariant pseudodistance. -/]
abbrev NormedCommGroup.ofMulDist' [Norm E] [CommGroup E] [MetricSpace E]
(hā : ā x : E, āxā = dist x 1) (hā : ā x y z : E, dist (x * z) (y * z) ⤠dist x y) :
NormedCommGroup E :=
{ NormedGroup.ofMulDist' hā hā with
mul_comm := mul_comm }
-- See note [reducible non-instances]
/-- Construct a seminormed group from a seminorm, i.e., registering the pseudodistance and the
pseudometric space structure from the seminorm properties. Note that in most cases this instance
creates bad definitional equalities (e.g., it does not take into account a possibly existing
`UniformSpace` instance on `E`). -/
@[to_additive
/-- Construct a seminormed group from a seminorm, i.e., registering the pseudodistance
and the pseudometric space structure from the seminorm properties. Note that in most cases this
instance creates bad definitional equalities (e.g., it does not take into account a possibly
existing `UniformSpace` instance on `E`). -/]
abbrev GroupSeminorm.toSeminormedGroup [Group E] (f : GroupSeminorm E) : SeminormedGroup E where
dist x y := f (x / y)
norm := f
dist_eq _ _ := rfl
dist_self x := by simp only [div_self', map_one_eq_zero]
dist_triangle := le_map_div_add_map_div f
dist_comm := map_div_rev f
-- See note [reducible non-instances]
/-- Construct a seminormed group from a seminorm, i.e., registering the pseudodistance and the
pseudometric space structure from the seminorm properties. Note that in most cases this instance
creates bad definitional equalities (e.g., it does not take into account a possibly existing
`UniformSpace` instance on `E`). -/
@[to_additive
/-- Construct a seminormed group from a seminorm, i.e., registering the pseudodistance
and the pseudometric space structure from the seminorm properties. Note that in most cases this
instance creates bad definitional equalities (e.g., it does not take into account a possibly
existing `UniformSpace` instance on `E`). -/]
abbrev GroupSeminorm.toSeminormedCommGroup [CommGroup E] (f : GroupSeminorm E) :
SeminormedCommGroup E :=
{ f.toSeminormedGroup with
mul_comm := mul_comm }
-- See note [reducible non-instances]
/-- Construct a normed group from a norm, i.e., registering the distance and the metric space
structure from the norm properties. Note that in most cases this instance creates bad definitional
equalities (e.g., it does not take into account a possibly existing `UniformSpace` instance on
`E`). -/
@[to_additive
/-- Construct a normed group from a norm, i.e., registering the distance and the metric
space structure from the norm properties. Note that in most cases this instance creates bad
definitional equalities (e.g., it does not take into account a possibly existing `UniformSpace`
instance on `E`). -/]
abbrev GroupNorm.toNormedGroup [Group E] (f : GroupNorm E) : NormedGroup E :=
{ f.toGroupSeminorm.toSeminormedGroup with
eq_of_dist_eq_zero := fun h => div_eq_one.1 <| eq_one_of_map_eq_zero f h }
-- See note [reducible non-instances]
/-- Construct a normed group from a norm, i.e., registering the distance and the metric space
structure from the norm properties. Note that in most cases this instance creates bad definitional
equalities (e.g., it does not take into account a possibly existing `UniformSpace` instance on
`E`). -/
@[to_additive
/-- Construct a normed group from a norm, i.e., registering the distance and the metric
space structure from the norm properties. Note that in most cases this instance creates bad
definitional equalities (e.g., it does not take into account a possibly existing `UniformSpace`
instance on `E`). -/]
abbrev GroupNorm.toNormedCommGroup [CommGroup E] (f : GroupNorm E) : NormedCommGroup E :=
{ f.toNormedGroup with
mul_comm := mul_comm }
section SeminormedGroup
variable [SeminormedGroup E] [SeminormedGroup F] [SeminormedGroup G] {s : Set E}
{a aā aā b c : E} {r rā rā : ā}
@[to_additive]
theorem dist_eq_norm_div (a b : E) : dist a b = āa / bā :=
SeminormedGroup.dist_eq _ _
@[to_additive]
theorem dist_eq_norm_div' (a b : E) : dist a b = āb / aā := by rw [dist_comm, dist_eq_norm_div]
alias dist_eq_norm := dist_eq_norm_sub
alias dist_eq_norm' := dist_eq_norm_sub'
@[to_additive of_forall_le_norm]
lemma DiscreteTopology.of_forall_le_norm' (hpos : 0 < r) (hr : ā x : E, x ā 1 ā r ⤠āxā) :
DiscreteTopology E :=
.of_forall_le_dist hpos fun x y hne ⦠by
simp only [dist_eq_norm_div]
exact hr _ (div_ne_one.2 hne)
@[to_additive (attr := simp)]
theorem dist_one_right (a : E) : dist a 1 = āaā := by rw [dist_eq_norm_div, div_one]
@[to_additive]
theorem inseparable_one_iff_norm {a : E} : Inseparable a 1 ā āaā = 0 := by
rw [Metric.inseparable_iff, dist_one_right]
@[to_additive]
lemma dist_one_left (a : E) : dist 1 a = āaā := by rw [dist_comm, dist_one_right]
@[to_additive (attr := simp)]
lemma dist_one : dist (1 : E) = norm := funext dist_one_left
@[to_additive]
theorem norm_div_rev (a b : E) : āa / bā = āb / aā := by
simpa only [dist_eq_norm_div] using dist_comm a b
@[to_additive (attr := simp) norm_neg]
theorem norm_inv' (a : E) : āaā»Ā¹ā = āaā := by simpa using norm_div_rev 1 a
@[to_additive (attr := simp) norm_abs_zsmul]
theorem norm_zpow_abs (a : E) (n : ā¤) : āa ^ |n|ā = āa ^ nā := by
rcases le_total 0 n with hn | hn <;> simp [hn, abs_of_nonneg, abs_of_nonpos]
@[to_additive (attr := simp) norm_natAbs_smul]
theorem norm_pow_natAbs (a : E) (n : ā¤) : āa ^ n.natAbsā = āa ^ nā := by
rw [ā zpow_natCast, ā Int.abs_eq_natAbs, norm_zpow_abs]
@[to_additive norm_isUnit_zsmul]
theorem norm_zpow_isUnit (a : E) {n : ā¤} (hn : IsUnit n) : āa ^ nā = āaā := by
rw [ā norm_pow_natAbs, Int.isUnit_iff_natAbs_eq.mp hn, pow_one]
@[simp]
theorem norm_units_zsmul {E : Type*} [SeminormedAddGroup E] (n : ā¤Ė£) (a : E) : ān ⢠aā = āaā :=
norm_isUnit_zsmul a n.isUnit
open scoped symmDiff in
@[to_additive]
theorem dist_mulIndicator (s t : Set α) (f : α ā E) (x : α) :
dist (s.mulIndicator f x) (t.mulIndicator f x) = ā(s ā t).mulIndicator f xā := by
rw [dist_eq_norm_div, Set.apply_mulIndicator_symmDiff norm_inv']
/-- **Triangle inequality** for the norm. -/
@[to_additive norm_add_le /-- **Triangle inequality** for the norm. -/]
theorem norm_mul_le' (a b : E) : āa * bā ⤠āaā + ābā := by
simpa [dist_eq_norm_div] using dist_triangle a 1 bā»Ā¹
/-- **Triangle inequality** for the norm. -/
@[to_additive norm_add_le_of_le /-- **Triangle inequality** for the norm. -/]
theorem norm_mul_le_of_le' (hā : āaāā ⤠rā) (hā : āaāā ⤠rā) : āaā * aāā ⤠rā + rā :=
(norm_mul_le' aā aā).trans <| add_le_add hā hā
/-- **Triangle inequality** for the norm. -/
@[to_additive norm_addā_le /-- **Triangle inequality** for the norm. -/]
lemma norm_mulā_le' : āa * b * cā ⤠āaā + ābā + ācā := norm_mul_le_of_le' (norm_mul_le' _ _) le_rfl
@[to_additive]
lemma norm_div_le_norm_div_add_norm_div (a b c : E) : āa / cā ⤠āa / bā + āb / cā := by
simpa only [dist_eq_norm_div] using dist_triangle a b c
@[to_additive]
lemma norm_le_norm_div_add (a b : E) : āaā ⤠āa / bā + ābā := by
simpa only [div_one] using norm_div_le_norm_div_add_norm_div a b 1
@[to_additive (attr := simp) norm_nonneg]
theorem norm_nonneg' (a : E) : 0 ⤠āaā := by
rw [ā dist_one_right]
exact dist_nonneg
attribute [bound] norm_nonneg
@[to_additive (attr := simp) abs_norm]
theorem abs_norm' (z : E) : |āzā| = āzā := abs_of_nonneg <| norm_nonneg' _
@[to_additive (attr := simp) norm_zero]
theorem norm_one' : ā(1 : E)ā = 0 := by rw [ā dist_one_right, dist_self]
@[to_additive]
theorem ne_one_of_norm_ne_zero : āaā ā 0 ā a ā 1 :=
mt <| by
rintro rfl
exact norm_one'
@[to_additive (attr := nontriviality) norm_of_subsingleton]
theorem norm_of_subsingleton' [Subsingleton E] (a : E) : āaā = 0 := by
rw [Subsingleton.elim a 1, norm_one']
@[to_additive zero_lt_one_add_norm_sq]
theorem zero_lt_one_add_norm_sq' (x : E) : 0 < 1 + āxā ^ 2 := by
positivity
@[to_additive]
theorem norm_div_le (a b : E) : āa / bā ⤠āaā + ābā := by
simpa [dist_eq_norm_div] using dist_triangle a 1 b
attribute [bound] norm_sub_le
@[to_additive]
theorem norm_div_le_of_le {rā rā : ā} (Hā : āaāā ⤠rā) (Hā : āaāā ⤠rā) : āaā / aāā ⤠rā + rā :=
(norm_div_le aā aā).trans <| add_le_add Hā Hā
@[to_additive dist_le_norm_add_norm]
theorem dist_le_norm_add_norm' (a b : E) : dist a b ⤠āaā + ābā := by
rw [dist_eq_norm_div]
apply norm_div_le
@[to_additive abs_norm_sub_norm_le]
theorem abs_norm_sub_norm_le' (a b : E) : |āaā - ābā| ⤠āa / bā := by
simpa [dist_eq_norm_div] using abs_dist_sub_le a b 1
@[to_additive norm_sub_norm_le]
theorem norm_sub_norm_le' (a b : E) : āaā - ābā ⤠āa / bā :=
(le_abs_self _).trans (abs_norm_sub_norm_le' a b)
@[to_additive (attr := bound)]
theorem norm_sub_le_norm_mul (a b : E) : āaā - ābā ⤠āa * bā := by
simpa using norm_mul_le' (a * b) (bā»Ā¹)
@[to_additive dist_norm_norm_le]
theorem dist_norm_norm_le' (a b : E) : dist āaā ābā ⤠āa / bā :=
abs_norm_sub_norm_le' a b
@[to_additive]
theorem norm_le_norm_add_norm_div' (u v : E) : āuā ⤠āvā + āu / vā := by
rw [add_comm]
refine (norm_mul_le' _ _).trans_eq' ?_
rw [div_mul_cancel]
@[to_additive]
theorem norm_le_norm_add_norm_div (u v : E) : āvā ⤠āuā + āu / vā := by
rw [norm_div_rev]
exact norm_le_norm_add_norm_div' v u
alias norm_le_insert' := norm_le_norm_add_norm_sub'
alias norm_le_insert := norm_le_norm_add_norm_sub
@[to_additive]
theorem norm_le_mul_norm_add (u v : E) : āuā ⤠āu * vā + āvā :=
calc
āuā = āu * v / vā := by rw [mul_div_cancel_right]
_ ⤠āu * vā + āvā := norm_div_le _ _
/-- An analogue of `norm_le_mul_norm_add` for the multiplication from the left. -/
@[to_additive /-- An analogue of `norm_le_add_norm_add` for the addition from the left. -/]
theorem norm_le_mul_norm_add' (u v : E) : āvā ⤠āu * vā + āuā :=
calc
āvā = āuā»Ā¹ * (u * v)ā := by rw [ā mul_assoc, inv_mul_cancel, one_mul]
_ ⤠āuā»Ā¹ā + āu * vā := norm_mul_le' uā»Ā¹ (u * v)
_ = āu * vā + āuā := by rw [norm_inv', add_comm]
@[to_additive]
lemma norm_mul_eq_norm_right {x : E} (y : E) (h : āxā = 0) : āx * yā = āyā := by
apply le_antisymm ?_ ?_
Ā· simpa [h] using norm_mul_le' x y
Ā· simpa [h] using norm_le_mul_norm_add' x y
@[to_additive]
lemma norm_mul_eq_norm_left (x : E) {y : E} (h : āyā = 0) : āx * yā = āxā := by
apply le_antisymm ?_ ?_
Ā· simpa [h] using norm_mul_le' x y
Ā· simpa [h] using norm_le_mul_norm_add x y
@[to_additive]
lemma norm_div_eq_norm_right {x : E} (y : E) (h : āxā = 0) : āx / yā = āyā := by
apply le_antisymm ?_ ?_
Ā· simpa [h] using norm_div_le x y
Ā· simpa [h, norm_div_rev x y] using norm_sub_norm_le' y x
@[to_additive]
lemma norm_div_eq_norm_left (x : E) {y : E} (h : āyā = 0) : āx / yā = āxā := by
apply le_antisymm ?_ ?_
Ā· simpa [h] using norm_div_le x y
Ā· simpa [h] using norm_sub_norm_le' x y
@[to_additive ball_eq]
theorem ball_eq' (y : E) (ε : ā) : ball y ε = { x | āx / yā < ε } :=
Set.ext fun a => by simp [dist_eq_norm_div]
@[to_additive]
theorem ball_one_eq (r : ā) : ball (1 : E) r = { x | āxā < r } :=
Set.ext fun a => by simp
@[to_additive mem_ball_iff_norm]
theorem mem_ball_iff_norm'' : b ā ball a r ā āb / aā < r := by rw [mem_ball, dist_eq_norm_div]
@[to_additive mem_ball_iff_norm']
theorem mem_ball_iff_norm''' : b ā ball a r ā āa / bā < r := by rw [mem_ball', dist_eq_norm_div]
@[to_additive]
theorem mem_ball_one_iff : a ā ball (1 : E) r ā āaā < r := by rw [mem_ball, dist_one_right]
@[to_additive mem_closedBall_iff_norm]
theorem mem_closedBall_iff_norm'' : b ā closedBall a r ā āb / aā ⤠r := by
rw [mem_closedBall, dist_eq_norm_div]
@[to_additive]
theorem mem_closedBall_one_iff : a ā closedBall (1 : E) r ā āaā ⤠r := by
rw [mem_closedBall, dist_one_right]
@[to_additive mem_closedBall_iff_norm']
theorem mem_closedBall_iff_norm''' : b ā closedBall a r ā āa / bā ⤠r := by
rw [mem_closedBall', dist_eq_norm_div]
@[to_additive norm_le_of_mem_closedBall]
theorem norm_le_of_mem_closedBall' (h : b ā closedBall a r) : ābā ⤠āaā + r :=
(norm_le_norm_add_norm_div' _ _).trans <| add_le_add_left (by rwa [ā dist_eq_norm_div]) _
@[to_additive norm_le_norm_add_const_of_dist_le]
theorem norm_le_norm_add_const_of_dist_le' : dist a b ⤠r ā āaā ⤠ābā + r :=
norm_le_of_mem_closedBall'
@[to_additive norm_lt_of_mem_ball]
theorem norm_lt_of_mem_ball' (h : b ā ball a r) : ābā < āaā + r :=
(norm_le_norm_add_norm_div' _ _).trans_lt <| add_lt_add_left (by rwa [ā dist_eq_norm_div]) _
@[to_additive]
theorem norm_div_sub_norm_div_le_norm_div (u v w : E) : āu / wā - āv / wā ⤠āu / vā := by
simpa only [div_div_div_cancel_right] using norm_sub_norm_le' (u / w) (v / w)
@[to_additive norm_add_sub_norm_sub_le_two_mul]
lemma norm_mul_sub_norm_div_le_two_mul {E : Type*} [SeminormedGroup E] (u v : E) :
āu * vā - āu / vā ⤠2 * āvā := by
simpa [- tsub_le_iff_right, tsub_le_iff_left, two_mul, add_assoc]
using norm_mulā_le' (a := (u / v)) (b := v) (c := v)
@[to_additive norm_add_sub_norm_sub_le_two_mul_min]
lemma norm_mul_sub_norm_div_le_two_mul_min {E : Type*} [SeminormedCommGroup E] (u v : E) :
āu * vā - āu / vā ⤠2 * min āuā āvā := by
rw [mul_min_of_nonneg _ _ (by positivity)]
refine le_min ?_ (norm_mul_sub_norm_div_le_two_mul u v)
rw [norm_div_rev, mul_comm]
exact norm_mul_sub_norm_div_le_two_mul _ _
-- Higher priority to fire before `mem_sphere`.
@[to_additive (attr := simp high) mem_sphere_iff_norm]
theorem mem_sphere_iff_norm' : b ā sphere a r ā āb / aā = r := by simp [dist_eq_norm_div]
@[to_additive] -- `simp` can prove this
theorem mem_sphere_one_iff_norm : a ā sphere (1 : E) r ā āaā = r := by simp
@[to_additive (attr := simp) norm_eq_of_mem_sphere]
theorem norm_eq_of_mem_sphere' (x : sphere (1 : E) r) : ā(x : E)ā = r :=
mem_sphere_one_iff_norm.mp x.2
@[to_additive]
theorem ne_one_of_mem_sphere (hr : r ā 0) (x : sphere (1 : E) r) : (x : E) ā 1 :=
ne_one_of_norm_ne_zero <| by rwa [norm_eq_of_mem_sphere' x]
@[to_additive ne_zero_of_mem_unit_sphere]
theorem ne_one_of_mem_unit_sphere (x : sphere (1 : E) 1) : (x : E) ā 1 :=
ne_one_of_mem_sphere one_ne_zero _
variable (E)
/-- The norm of a seminormed group as a group seminorm. -/
@[to_additive /-- The norm of a seminormed group as an additive group seminorm. -/]
def normGroupSeminorm : GroupSeminorm E :=
āØnorm, norm_one', norm_mul_le', norm_inv'ā©
@[to_additive (attr := simp)]
theorem coe_normGroupSeminorm : ā(normGroupSeminorm E) = norm :=
rfl
variable {E}
@[to_additive]
theorem NormedCommGroup.tendsto_nhds_one {f : α ā E} {l : Filter α} :
Tendsto f l (š 1) ā ā ε > 0, āį¶ x in l, āf xā < ε :=
Metric.tendsto_nhds.trans <| by simp only [dist_one_right]
@[to_additive]
theorem NormedCommGroup.tendsto_nhds_nhds {f : E ā F} {x : E} {y : F} :
Tendsto f (š x) (š y) ā ā ε > 0, ā Ī“ > 0, ā x', āx' / xā < Ī“ ā āf x' / yā < ε := by
simp_rw [Metric.tendsto_nhds_nhds, dist_eq_norm_div]
@[to_additive]
theorem NormedCommGroup.nhds_basis_norm_lt (x : E) :
(š x).HasBasis (fun ε : ā => 0 < ε) fun ε => { y | āy / xā < ε } := by
simp_rw [ā ball_eq']
exact Metric.nhds_basis_ball
@[to_additive]
theorem NormedCommGroup.nhds_one_basis_norm_lt :
(š (1 : E)).HasBasis (fun ε : ā => 0 < ε) fun ε => { y | āyā < ε } := by
convert NormedCommGroup.nhds_basis_norm_lt (1 : E)
simp
@[to_additive]
theorem NormedCommGroup.uniformity_basis_dist :
(š¤ E).HasBasis (fun ε : ā => 0 < ε) fun ε => { p : E Ć E | āp.fst / p.sndā < ε } := by
convert Metric.uniformity_basis_dist (α := E) using 1
simp [dist_eq_norm_div]
open Finset
variable [FunLike š E F]
section NNNorm
-- See note [lower instance priority]
@[to_additive]
instance (priority := 100) SeminormedGroup.toNNNorm : NNNorm E :=
āØfun a => āØāaā, norm_nonneg' aā©ā©
@[to_additive (attr := simp, norm_cast) coe_nnnorm]
theorem coe_nnnorm' (a : E) : (āaāā : ā) = āaā := rfl
@[to_additive (attr := simp) coe_comp_nnnorm]
theorem coe_comp_nnnorm' : (toReal : āā„0 ā ā) ā (nnnorm : E ā āā„0) = norm :=
rfl
@[to_additive (attr := simp) norm_toNNReal]
theorem norm_toNNReal' : āaā.toNNReal = āaāā :=
@Real.toNNReal_coe āaāā
@[to_additive (attr := simp) toReal_enorm]
lemma toReal_enorm' (x : E) : āxāā.toReal = āxā := by simp [enorm]
@[to_additive (attr := simp) ofReal_norm]
lemma ofReal_norm' (x : E) : .ofReal āxā = āxāā := by
simp [enorm, ENNReal.ofReal, Real.toNNReal, nnnorm]
@[to_additive enorm_eq_iff_norm_eq]
theorem enorm'_eq_iff_norm_eq {x : E} {y : F} : āxāā = āyāā ā āxā = āyā := by
simp only [ā ofReal_norm']
refine āØfun h ⦠?_, fun h ⦠by congrā©
exact (Real.toNNReal_eq_toNNReal_iff (norm_nonneg' _) (norm_nonneg' _)).mp (ENNReal.coe_inj.mp h)
@[to_additive enorm_le_iff_norm_le]
theorem enorm'_le_iff_norm_le {x : E} {y : F} : āxāā ⤠āyāā ā āxā ⤠āyā := by
simp only [ā ofReal_norm']
refine āØfun h ⦠?_, fun h ⦠by gcongrā©
rw [ENNReal.ofReal_le_ofReal_iff (norm_nonneg' _)] at h
exact h
@[to_additive]
theorem nndist_eq_nnnorm_div (a b : E) : nndist a b = āa / bāā :=
NNReal.eq <| dist_eq_norm_div _ _
alias nndist_eq_nnnorm := nndist_eq_nnnorm_sub
@[to_additive (attr := simp)]
theorem nndist_one_right (a : E) : nndist a 1 = āaāā := by simp [nndist_eq_nnnorm_div]
@[to_additive (attr := simp)]
lemma edist_one_right (a : E) : edist a 1 = āaāā := by simp [edist_nndist, nndist_one_right, enorm]
@[to_additive (attr := simp) nnnorm_zero]
theorem nnnorm_one' : ā(1 : E)āā = 0 := NNReal.eq norm_one'
@[to_additive]
theorem ne_one_of_nnnorm_ne_zero {a : E} : āaāā ā 0 ā a ā 1 :=
mt <| by
rintro rfl
exact nnnorm_one'
@[to_additive nnnorm_add_le]
theorem nnnorm_mul_le' (a b : E) : āa * bāā ⤠āaāā + ābāā :=
NNReal.coe_le_coe.1 <| norm_mul_le' a b
@[to_additive norm_nsmul_le]
lemma norm_pow_le_mul_norm : ā {n : ā}, āa ^ nā ⤠n * āaā
| 0 => by simp
| n + 1 => by simpa [pow_succ, add_mul] using norm_mul_le_of_le' norm_pow_le_mul_norm le_rfl
@[to_additive nnnorm_nsmul_le]
lemma nnnorm_pow_le_mul_norm {n : ā} : āa ^ nāā ⤠n * āaāā := by
simpa only [ā NNReal.coe_le_coe, NNReal.coe_mul, NNReal.coe_natCast] using norm_pow_le_mul_norm
@[to_additive (attr := simp) nnnorm_neg]
theorem nnnorm_inv' (a : E) : āaā»Ā¹āā = āaāā :=
NNReal.eq <| norm_inv' a
@[to_additive (attr := simp) nnnorm_abs_zsmul]
theorem nnnorm_zpow_abs (a : E) (n : ā¤) : āa ^ |n|āā = āa ^ nāā :=
NNReal.eq <| norm_zpow_abs a n
@[to_additive (attr := simp) nnnorm_natAbs_smul]
theorem nnnorm_pow_natAbs (a : E) (n : ā¤) : āa ^ n.natAbsāā = āa ^ nāā :=
NNReal.eq <| norm_pow_natAbs a n
@[to_additive nnnorm_isUnit_zsmul]
theorem nnnorm_zpow_isUnit (a : E) {n : ā¤} (hn : IsUnit n) : āa ^ nāā = āaāā :=
NNReal.eq <| norm_zpow_isUnit a hn
@[simp]
theorem nnnorm_units_zsmul {E : Type*} [SeminormedAddGroup E] (n : ā¤Ė£) (a : E) : ān ⢠aāā = āaāā :=
NNReal.eq <| norm_isUnit_zsmul a n.isUnit
@[to_additive (attr := simp)]
theorem nndist_one_left (a : E) : nndist 1 a = āaāā := by simp [nndist_eq_nnnorm_div]
@[to_additive (attr := simp)]
theorem edist_one_left (a : E) : edist 1 a = āaāā := by
rw [edist_nndist, nndist_one_left]
open scoped symmDiff in
@[to_additive]
theorem nndist_mulIndicator (s t : Set α) (f : α ā E) (x : α) :
nndist (s.mulIndicator f x) (t.mulIndicator f x) = ā(s ā t).mulIndicator f xāā :=
NNReal.eq <| dist_mulIndicator s t f x
@[to_additive]
theorem nnnorm_div_le (a b : E) : āa / bāā ⤠āaāā + ābāā :=
NNReal.coe_le_coe.1 <| norm_div_le _ _
@[to_additive]
lemma enorm_div_le : āa / bāā ⤠āaāā + ābāā := by
simpa [enorm, ā ENNReal.coe_add] using nnnorm_div_le a b
@[to_additive nndist_nnnorm_nnnorm_le]
theorem nndist_nnnorm_nnnorm_le' (a b : E) : nndist āaāā ābāā ⤠āa / bāā :=
NNReal.coe_le_coe.1 <| dist_norm_norm_le' a b
@[to_additive]
theorem nnnorm_le_nnnorm_add_nnnorm_div (a b : E) : ābāā ⤠āaāā + āa / bāā :=
norm_le_norm_add_norm_div _ _
@[to_additive]
theorem nnnorm_le_nnnorm_add_nnnorm_div' (a b : E) : āaāā ⤠ābāā + āa / bāā :=
norm_le_norm_add_norm_div' _ _
alias nnnorm_le_insert' := nnnorm_le_nnnorm_add_nnnorm_sub'
alias nnnorm_le_insert := nnnorm_le_nnnorm_add_nnnorm_sub
@[to_additive]
theorem nnnorm_le_mul_nnnorm_add (a b : E) : āaāā ⤠āa * bāā + ābāā :=
norm_le_mul_norm_add _ _
/-- An analogue of `nnnorm_le_mul_nnnorm_add` for the multiplication from the left. -/
@[to_additive /-- An analogue of `nnnorm_le_add_nnnorm_add` for the addition from the left. -/]
theorem nnnorm_le_mul_nnnorm_add' (a b : E) : ābāā ⤠āa * bāā + āaāā :=
norm_le_mul_norm_add' _ _
@[to_additive]
lemma nnnorm_mul_eq_nnnorm_right {x : E} (y : E) (h : āxāā = 0) : āx * yāā = āyāā :=
NNReal.eq <| norm_mul_eq_norm_right _ <| congr_arg NNReal.toReal h
@[to_additive]
lemma nnnorm_mul_eq_nnnorm_left (x : E) {y : E} (h : āyāā = 0) : āx * yāā = āxāā :=
NNReal.eq <| norm_mul_eq_norm_left _ <| congr_arg NNReal.toReal h
@[to_additive]
lemma nnnorm_div_eq_nnnorm_right {x : E} (y : E) (h : āxāā = 0) : āx / yāā = āyāā :=
NNReal.eq <| norm_div_eq_norm_right _ <| congr_arg NNReal.toReal h
@[to_additive]
lemma nnnorm_div_eq_nnnorm_left (x : E) {y : E} (h : āyāā = 0) : āx / yāā = āxāā :=
NNReal.eq <| norm_div_eq_norm_left _ <| congr_arg NNReal.toReal h
/-- The nonnegative norm seen as an `ENNReal` and then as a `Real` is equal to the norm. -/
@[to_additive toReal_coe_nnnorm /-- The nonnegative norm seen as an `ENNReal` and
then as a `Real` is equal to the norm. -/]
theorem toReal_coe_nnnorm' (a : E) : (āaāā : āā„0ā).toReal = āaā := rfl
open scoped symmDiff in
@[to_additive]
theorem edist_mulIndicator (s t : Set α) (f : α ā E) (x : α) :
edist (s.mulIndicator f x) (t.mulIndicator f x) = ā(s ā t).mulIndicator f xāā := by
rw [edist_nndist, nndist_mulIndicator]
end NNNorm
section ENorm
@[to_additive (attr := simp) enorm_zero]
lemma enorm_one' {E : Type*} [TopologicalSpace E] [ESeminormedMonoid E] : ā(1 : E)āā = 0 := by
rw [ESeminormedMonoid.enorm_zero]
@[to_additive exists_enorm_lt]
lemma exists_enorm_lt' (E : Type*) [TopologicalSpace E] [ESeminormedMonoid E]
[hbot : NeBot (š[ā ] (1 : E))] {c : āā„0ā} (hc : c ā 0) : ā x ā (1 : E), āxāā < c :=
frequently_iff_neBot.mpr hbot |>.and_eventually
(ContinuousENorm.continuous_enorm.tendsto' 1 0 (by simp) |>.eventually_lt_const hc.bot_lt)
|>.exists
@[to_additive (attr := simp) enorm_neg]
lemma enorm_inv' (a : E) : āaā»Ā¹āā = āaāā := by simp [enorm]
@[to_additive ofReal_norm_eq_enorm]
lemma ofReal_norm_eq_enorm' (a : E) : .ofReal āaā = āaāā := ENNReal.ofReal_eq_coe_nnreal _
instance : ENorm āā„0ā where
enorm x := x
@[simp] lemma enorm_eq_self (x : āā„0ā) : āxāā = x := rfl
@[to_additive]
theorem edist_eq_enorm_div (a b : E) : edist a b = āa / bāā := by
rw [edist_dist, dist_eq_norm_div, ofReal_norm_eq_enorm']
@[to_additive]
theorem edist_one_eq_enorm (x : E) : edist x 1 = āxāā := by rw [edist_eq_enorm_div, div_one]
@[to_additive]
lemma enorm_div_rev {E : Type*} [SeminormedGroup E] (a b : E) : āa / bāā = āb / aāā := by
rw [ā edist_eq_enorm_div, edist_comm, edist_eq_enorm_div]
@[to_additive]
theorem mem_emetric_ball_one_iff {r : āā„0ā} : a ā EMetric.ball 1 r ā āaāā < r := by
rw [EMetric.mem_ball, edist_one_eq_enorm]
end ENorm
section ContinuousENorm
variable {E : Type*} [TopologicalSpace E] [ContinuousENorm E]
@[continuity, fun_prop]
lemma continuous_enorm : Continuous fun a : E ⦠āaāā := ContinuousENorm.continuous_enorm
variable {X : Type*} [TopologicalSpace X] {f : X ā E} {s : Set X} {a : X}
@[fun_prop]
lemma Continuous.enorm : Continuous f ā Continuous (āf Ā·āā) :=
continuous_enorm.comp
lemma ContinuousAt.enorm {a : X} (h : ContinuousAt f a) : ContinuousAt (āf Ā·āā) a := by fun_prop
@[fun_prop]
lemma ContinuousWithinAt.enorm {s : Set X} {a : X} (h : ContinuousWithinAt f s a) :
ContinuousWithinAt (āf Ā·āā) s a :=
(ContinuousENorm.continuous_enorm.continuousWithinAt).comp (t := Set.univ) h
(fun _ _ ⦠by trivial)
@[fun_prop]
lemma ContinuousOn.enorm (h : ContinuousOn f s) : ContinuousOn (āf Ā·āā) s :=
(ContinuousENorm.continuous_enorm.continuousOn).comp (t := Set.univ) h <| Set.mapsTo_univ _ _
end ContinuousENorm
section ESeminormedMonoid
variable {E : Type*} [TopologicalSpace E] [ESeminormedMonoid E]
@[to_additive enorm_add_le]
lemma enorm_mul_le' (a b : E) : āa * bāā ⤠āaāā + ābāā := ESeminormedMonoid.enorm_mul_le a b
end ESeminormedMonoid
section ENormedMonoid
variable {E : Type*} [TopologicalSpace E] [ENormedMonoid E]
@[to_additive (attr := simp) enorm_eq_zero]
lemma enorm_eq_zero' {a : E} : āaāā = 0 ā a = 1 := by
simp [ENormedMonoid.enorm_eq_zero]
@[to_additive enorm_ne_zero]
lemma enorm_ne_zero' {a : E} : āaāā ā 0 ā a ā 1 :=
enorm_eq_zero'.ne
@[to_additive (attr := simp) enorm_pos]
lemma enorm_pos' {a : E} : 0 < āaāā ā a ā 1 :=
pos_iff_ne_zero.trans enorm_ne_zero'
end ENormedMonoid
instance : ENormedAddCommMonoid āā„0ā where
continuous_enorm := continuous_id
enorm_zero := by simp
enorm_eq_zero := by simp
enorm_add_le := by simp
open Set in
@[to_additive]
lemma SeminormedGroup.disjoint_nhds (x : E) (f : Filter E) :
Disjoint (š x) f ā ā Ī“ > 0, āį¶ y in f, Ī“ ⤠āy / xā := by
simp [NormedCommGroup.nhds_basis_norm_lt x |>.disjoint_iff_left, compl_setOf, eventually_iff]
@[to_additive]
lemma SeminormedGroup.disjoint_nhds_one (f : Filter E) :
Disjoint (š 1) f ā ā Ī“ > 0, āį¶ y in f, Ī“ ⤠āyā := by
simpa using disjoint_nhds 1 f
end SeminormedGroup
section Induced
variable (E F)
variable [FunLike š E F]
-- See note [reducible non-instances]
/-- A group homomorphism from a `Group` to a `SeminormedGroup` induces a `SeminormedGroup`
structure on the domain. -/
@[to_additive /-- A group homomorphism from an `AddGroup` to a
`SeminormedAddGroup` induces a `SeminormedAddGroup` structure on the domain. -/]
abbrev SeminormedGroup.induced [Group E] [SeminormedGroup F] [MonoidHomClass š E F] (f : š) :
SeminormedGroup E :=
{ PseudoMetricSpace.induced f toPseudoMetricSpace with
norm := fun x => āf xā
dist_eq := fun x y => by simp only [map_div, ā dist_eq_norm_div]; rfl }
-- See note [reducible non-instances]
/-- A group homomorphism from a `CommGroup` to a `SeminormedGroup` induces a
`SeminormedCommGroup` structure on the domain. -/
@[to_additive /-- A group homomorphism from an `AddCommGroup` to a
`SeminormedAddGroup` induces a `SeminormedAddCommGroup` structure on the domain. -/]
abbrev SeminormedCommGroup.induced
[CommGroup E] [SeminormedGroup F] [MonoidHomClass š E F] (f : š) :
SeminormedCommGroup E :=
{ SeminormedGroup.induced E F f with
mul_comm := mul_comm }
-- See note [reducible non-instances].
/-- An injective group homomorphism from a `Group` to a `NormedGroup` induces a `NormedGroup`
structure on the domain. -/
@[to_additive /-- An injective group homomorphism from an `AddGroup` to a
`NormedAddGroup` induces a `NormedAddGroup` structure on the domain. -/]
abbrev NormedGroup.induced
[Group E] [NormedGroup F] [MonoidHomClass š E F] (f : š) (h : Injective f) :
NormedGroup E :=
{ SeminormedGroup.induced E F f, MetricSpace.induced f h _ with }
-- See note [reducible non-instances].
/-- An injective group homomorphism from a `CommGroup` to a `NormedGroup` induces a
`NormedCommGroup` structure on the domain. -/
@[to_additive /-- An injective group homomorphism from a `CommGroup` to a
`NormedCommGroup` induces a `NormedCommGroup` structure on the domain. -/]
abbrev NormedCommGroup.induced [CommGroup E] [NormedGroup F] [MonoidHomClass š E F] (f : š)
(h : Injective f) : NormedCommGroup E :=
{ SeminormedGroup.induced E F f, MetricSpace.induced f h _ with
mul_comm := mul_comm }
end Induced
namespace Real
variable {r : ā}
instance norm : Norm ā where
norm r := |r|
@[simp]
theorem norm_eq_abs (r : ā) : ārā = |r| :=
rfl
instance normedAddCommGroup : NormedAddCommGroup ā :=
āØfun _r _y => rflā©
theorem norm_of_nonneg (hr : 0 ⤠r) : ārā = r :=
abs_of_nonneg hr
theorem norm_of_nonpos (hr : r ⤠0) : ārā = -r :=
abs_of_nonpos hr
theorem le_norm_self (r : ā) : r ⤠ārā :=
le_abs_self r
lemma norm_natCast (n : ā) : ā(n : ā)ā = n := abs_of_nonneg n.cast_nonneg
@[simp 1100] lemma nnnorm_natCast (n : ā) : ā(n : ā)āā = n := NNReal.eq <| norm_natCast _
@[simp 1100] lemma enorm_natCast (n : ā) : ā(n : ā)āā = n := by simp [enorm]
@[simp 1100] lemma norm_ofNat (n : ā) [n.AtLeastTwo] :
ā(ofNat(n) : ā)ā = ofNat(n) := norm_natCast n
@[simp 1100] lemma nnnorm_ofNat (n : ā) [n.AtLeastTwo] :
ā(ofNat(n) : ā)āā = ofNat(n) := nnnorm_natCast n
lemma norm_two : ā(2 : ā)ā = 2 := abs_of_pos zero_lt_two
lemma nnnorm_two : ā(2 : ā)āā = 2 := NNReal.eq <| by simp
@[simp 1100, norm_cast]
lemma norm_nnratCast (q : āā„0) : ā(q : ā)ā = q := norm_of_nonneg q.cast_nonneg
@[simp 1100, norm_cast]
lemma nnnorm_nnratCast (q : āā„0) : ā(q : ā)āā = q := by simp [nnnorm, -norm_eq_abs]
theorem nnnorm_of_nonneg (hr : 0 ⤠r) : ārāā = āØr, hrā© :=
NNReal.eq <| norm_of_nonneg hr
lemma enorm_of_nonneg (hr : 0 ⤠r) : ārāā = .ofReal r := by
simp [enorm, nnnorm_of_nonneg hr, ENNReal.ofReal, toNNReal, hr]
lemma enorm_ofReal_of_nonneg {a : ā} (ha : 0 ⤠a) : āENNReal.ofReal aāā = āaāā:= by
simp [Real.enorm_of_nonneg, ha]
@[simp] lemma nnnorm_abs (r : ā) : ā|r|āā = ārāā := by simp [nnnorm]
@[simp] lemma enorm_abs (r : ā) : ā|r|āā = ārāā := by simp [enorm]
theorem enorm_eq_ofReal (hr : 0 ⤠r) : ārāā = .ofReal r := by
rw [ā ofReal_norm_eq_enorm, norm_of_nonneg hr]
theorem enorm_eq_ofReal_abs (r : ā) : ārāā = ENNReal.ofReal |r| := by
rw [ā enorm_eq_ofReal (abs_nonneg _), enorm_abs]
theorem toNNReal_eq_nnnorm_of_nonneg (hr : 0 ⤠r) : r.toNNReal = ārāā := by
rw [Real.toNNReal_of_nonneg hr]
congr
rw [Real.norm_eq_abs r, abs_of_nonneg hr]
theorem ofReal_le_enorm (r : ā) : ENNReal.ofReal r ⤠ārāā := by
rw [enorm_eq_ofReal_abs]; gcongr; exact le_abs_self _
end Real
namespace NNReal
instance : NNNorm āā„0 where
nnnorm x := x
@[simp] lemma nnnorm_eq_self (x : āā„0) : āxāā = x := rfl
end NNReal
section SeminormedCommGroup
variable [SeminormedCommGroup E] [SeminormedCommGroup F] {a b : E} {r : ā}
variable {ε : Type*} [TopologicalSpace ε] [ESeminormedCommMonoid ε]
@[to_additive]
theorem dist_inv (x y : E) : dist xā»Ā¹ y = dist x yā»Ā¹ := by
simp_rw [dist_eq_norm_div, ā norm_inv' (xā»Ā¹ / y), inv_div, div_inv_eq_mul, mul_comm]
theorem norm_multiset_sum_le {E} [SeminormedAddCommGroup E] (m : Multiset E) :
ām.sumā ⤠(m.map fun x => āxā).sum :=
m.le_sum_of_subadditive norm norm_zero.le norm_add_le
variable {ε : Type*} [TopologicalSpace ε] [ESeminormedAddCommMonoid ε] in
theorem enorm_multisetSum_le (m : Multiset ε) :
ām.sumāā ⤠(m.map fun x => āxāā).sum :=
m.le_sum_of_subadditive enorm enorm_zero.le enorm_add_le
@[to_additive existing]
theorem norm_multiset_prod_le (m : Multiset E) : ām.prodā ⤠(m.map fun x => āxā).sum :=
m.apply_prod_le_sum_map _ norm_one'.le norm_mul_le'
variable {ε : Type*} [TopologicalSpace ε] [ESeminormedCommMonoid ε] in
@[to_additive existing]
theorem enorm_multisetProd_le (m : Multiset ε) :
ām.prodāā ⤠(m.map fun x => āxāā).sum :=
m.apply_prod_le_sum_map _ enorm_one'.le enorm_mul_le'
variable {ε : Type*} [TopologicalSpace ε] [ESeminormedAddCommMonoid ε] in
@[bound]
theorem enorm_sum_le (s : Finset ι) (f : ι ā ε) :
āā i ā s, f iāā ⤠ā i ā s, āf iāā :=
s.le_sum_of_subadditive enorm enorm_zero.le enorm_add_le f
@[bound]
theorem norm_sum_le {E} [SeminormedAddCommGroup E] (s : Finset ι) (f : ι ā E) :
āā i ā s, f iā ⤠ā i ā s, āf iā :=
s.le_sum_of_subadditive norm norm_zero.le norm_add_le f
@[to_additive existing]
theorem enorm_prod_le (s : Finset ι) (f : ι ā ε) : āā i ā s, f iāā ⤠ā i ā s, āf iāā :=
s.apply_prod_le_sum_apply _ enorm_one'.le enorm_mul_le'
@[to_additive existing]
theorem norm_prod_le (s : Finset ι) (f : ι ā E) : āā i ā s, f iā ⤠ā i ā s, āf iā :=
s.apply_prod_le_sum_apply _ norm_one'.le norm_mul_le'
@[to_additive]
theorem enorm_prod_le_of_le (s : Finset ι) {f : ι ā ε} {n : ι ā āā„0ā} (h : ā b ā s, āf bāā ⤠n b) :
āā b ā s, f bāā ⤠ā b ā s, n b :=
(enorm_prod_le s f).trans <| Finset.sum_le_sum h
@[to_additive]
theorem norm_prod_le_of_le (s : Finset ι) {f : ι ā E} {n : ι ā ā} (h : ā b ā s, āf bā ⤠n b) :
āā b ā s, f bā ⤠ā b ā s, n b :=
(norm_prod_le s f).trans <| Finset.sum_le_sum h
@[to_additive]
theorem dist_prod_prod_le_of_le (s : Finset ι) {f a : ι ā E} {d : ι ā ā}
(h : ā b ā s, dist (f b) (a b) ⤠d b) :
dist (ā b ā s, f b) (ā b ā s, a b) ⤠ā b ā s, d b := by
simp only [dist_eq_norm_div, ā Finset.prod_div_distrib] at *
exact norm_prod_le_of_le s h
@[to_additive]
theorem dist_prod_prod_le (s : Finset ι) (f a : ι ā E) :
dist (ā b ā s, f b) (ā b ā s, a b) ⤠ā b ā s, dist (f b) (a b) :=
dist_prod_prod_le_of_le s fun _ _ => le_rfl
@[to_additive]
theorem mul_mem_ball_iff_norm : a * b ā ball a r ā ābā < r := by
rw [mem_ball_iff_norm'', mul_div_cancel_left]
@[to_additive]
theorem mul_mem_closedBall_iff_norm : a * b ā closedBall a r ā ābā ⤠r := by
rw [mem_closedBall_iff_norm'', mul_div_cancel_left]
-- Higher priority to apply this before the equivalent lemma `Metric.preimage_mul_left_ball`.
@[to_additive (attr := simp high)]
theorem preimage_mul_ball (a b : E) (r : ā) : (b * Ā·) ā»Ā¹' ball a r = ball (a / b) r := by
ext c
simp only [dist_eq_norm_div, Set.mem_preimage, mem_ball, div_div_eq_mul_div, mul_comm]
-- Higher priority to apply this before the equivalent lemma `Metric.preimage_mul_left_closedBall`.
@[to_additive (attr := simp high)]
theorem preimage_mul_closedBall (a b : E) (r : ā) :
(b * Ā·) ā»Ā¹' closedBall a r = closedBall (a / b) r := by
ext c
simp only [dist_eq_norm_div, Set.mem_preimage, mem_closedBall, div_div_eq_mul_div, mul_comm]
@[to_additive (attr := simp)]
theorem preimage_mul_sphere (a b : E) (r : ā) : (b * Ā·) ā»Ā¹' sphere a r = sphere (a / b) r := by
ext c
simp only [Set.mem_preimage, mem_sphere_iff_norm', div_div_eq_mul_div, mul_comm]
@[to_additive]
theorem pow_mem_closedBall {n : ā} (h : a ā closedBall b r) :
a ^ n ā closedBall (b ^ n) (n ⢠r) := by
simp only [mem_closedBall, dist_eq_norm_div, ā div_pow] at h ā¢
refine norm_pow_le_mul_norm.trans ?_
simpa only [nsmul_eq_mul] using mul_le_mul_of_nonneg_left h n.cast_nonneg
@[to_additive]
theorem pow_mem_ball {n : ā} (hn : 0 < n) (h : a ā ball b r) : a ^ n ā ball (b ^ n) (n ⢠r) := by
simp only [mem_ball, dist_eq_norm_div, ā div_pow] at h ā¢
refine lt_of_le_of_lt norm_pow_le_mul_norm ?_
replace hn : 0 < (n : ā) := by norm_cast
rw [nsmul_eq_mul]
nlinarith
@[to_additive]
theorem mul_mem_closedBall_mul_iff {c : E} : a * c ā closedBall (b * c) r ā a ā closedBall b r := by
simp only [mem_closedBall, dist_eq_norm_div, mul_div_mul_right_eq_div]
@[to_additive]
theorem mul_mem_ball_mul_iff {c : E} : a * c ā ball (b * c) r ā a ā ball b r := by
simp only [mem_ball, dist_eq_norm_div, mul_div_mul_right_eq_div]
@[to_additive]
theorem smul_closedBall'' : a ⢠closedBall b r = closedBall (a ⢠b) r := by
ext
simp [mem_closedBall, Set.mem_smul_set, dist_eq_norm_div, div_eq_inv_mul, ā
eq_inv_mul_iff_mul_eq, mul_assoc]
@[to_additive]
theorem smul_ball'' : a ⢠ball b r = ball (a ⢠b) r := by
ext
simp [mem_ball, Set.mem_smul_set, dist_eq_norm_div, _root_.div_eq_inv_mul,
ā eq_inv_mul_iff_mul_eq, mul_assoc]
@[to_additive]
theorem nnnorm_multiset_prod_le (m : Multiset E) : ām.prodāā ⤠(m.map fun x => āxāā).sum :=
NNReal.coe_le_coe.1 <| by
push_cast
rw [Multiset.map_map]
exact norm_multiset_prod_le _
@[to_additive]
theorem nnnorm_prod_le (s : Finset ι) (f : ι ā E) : āā a ā s, f aāā ⤠ā a ā s, āf aāā :=
NNReal.coe_le_coe.1 <| by
push_cast
exact norm_prod_le _ _
@[to_additive]
theorem nnnorm_prod_le_of_le (s : Finset ι) {f : ι ā E} {n : ι ā āā„0} (h : ā b ā s, āf bāā ⤠n b) :
āā b ā s, f bāā ⤠ā b ā s, n b :=
(norm_prod_le_of_le s h).trans_eq (NNReal.coe_sum ..).symm
@[to_additive (attr := simp high) norm_norm] -- Higher priority as a shortcut lemma.
lemma norm_norm' (x : E) : āāxāā = āxā := Real.norm_of_nonneg (norm_nonneg' _)
@[to_additive (attr := simp) nnnorm_norm]
lemma nnnorm_norm' (x : E) : āāxāāā = āxāā := by simp [nnnorm]
@[to_additive (attr := simp) enorm_norm]
lemma enorm_norm' (x : E) : āāxāāā = āxāā := by simp [enorm]
lemma enorm_enorm {ε : Type*} [ENorm ε] (x : ε) : āāxāāāā = āxāā := by simp [enorm]
end SeminormedCommGroup
section NormedGroup
variable [NormedGroup E] {a b : E}
@[to_additive (attr := simp) norm_le_zero_iff]
lemma norm_le_zero_iff' : āaā ⤠0 ā a = 1 := by rw [ā dist_one_right, dist_le_zero]
@[to_additive (attr := simp) norm_pos_iff]
lemma norm_pos_iff' : 0 < āaā ā a ā 1 := by rw [ā not_le, norm_le_zero_iff']
@[to_additive (attr := simp) norm_eq_zero]
lemma norm_eq_zero' : āaā = 0 ā a = 1 := (norm_nonneg' a).ge_iff_eq'.symm.trans norm_le_zero_iff'
@[to_additive norm_ne_zero_iff]
lemma norm_ne_zero_iff' : āaā ā 0 ā a ā 1 := norm_eq_zero'.not
@[to_additive]
theorem norm_div_eq_zero_iff : āa / bā = 0 ā a = b := by rw [norm_eq_zero', div_eq_one]
@[to_additive]
theorem norm_div_pos_iff : 0 < āa / bā ā a ā b := by
rw [(norm_nonneg' _).lt_iff_ne, ne_comm]
exact norm_div_eq_zero_iff.not
@[to_additive eq_of_norm_sub_le_zero]
theorem eq_of_norm_div_le_zero (h : āa / bā ⤠0) : a = b := by
rwa [ā div_eq_one, ā norm_le_zero_iff']
alias āØeq_of_norm_div_eq_zero, _ā© := norm_div_eq_zero_iff
attribute [to_additive] eq_of_norm_div_eq_zero
@[to_additive]
theorem eq_one_or_norm_pos (a : E) : a = 1 ⨠0 < āaā := by
simpa [eq_comm] using (norm_nonneg' a).eq_or_lt
@[to_additive]
theorem eq_one_or_nnnorm_pos (a : E) : a = 1 ⨠0 < āaāā :=
eq_one_or_norm_pos a
@[to_additive (attr := simp) nnnorm_eq_zero]
theorem nnnorm_eq_zero' : āaāā = 0 ā a = 1 := by
rw [ā NNReal.coe_eq_zero, coe_nnnorm', norm_eq_zero']
@[to_additive nnnorm_ne_zero_iff]
theorem nnnorm_ne_zero_iff' : āaāā ā 0 ā a ā 1 :=
nnnorm_eq_zero'.not
@[to_additive (attr := simp) nnnorm_pos]
lemma nnnorm_pos' : 0 < āaāā ā a ā 1 := pos_iff_ne_zero.trans nnnorm_ne_zero_iff'
variable (E)
/-- The norm of a normed group as a group norm. -/
@[to_additive /-- The norm of a normed group as an additive group norm. -/]
def normGroupNorm : GroupNorm E :=
{ normGroupSeminorm _ with eq_one_of_map_eq_zero' := fun _ => norm_eq_zero'.1 }
@[simp]
theorem coe_normGroupNorm : ā(normGroupNorm E) = norm :=
rfl
end NormedGroup
section NormedAddGroup
variable [NormedAddGroup E] [TopologicalSpace α] {f : α ā E}
/-! Some relations with `HasCompactSupport` -/
theorem hasCompactSupport_norm_iff : (HasCompactSupport fun x => āf xā) ā HasCompactSupport f :=
hasCompactSupport_comp_left norm_eq_zero
alias āØ_, HasCompactSupport.normā© := hasCompactSupport_norm_iff
end NormedAddGroup
lemma tendsto_norm_atTop_atTop : Tendsto (norm : ā ā ā) atTop atTop := tendsto_abs_atTop_atTop
/-! ### `positivity` extensions -/
namespace Mathlib.Meta.Positivity
open Lean Meta Qq Function
/-- Extension for the `positivity` tactic: multiplicative norms are always nonnegative, and positive
on non-one inputs. -/
@[positivity ā_ā]
def evalMulNorm : PositivityExt where eval {u α} _ _ e := do
match u, α, e with
| 0, ~q(ā), ~q(@Norm.norm $E $_n $a) =>
let _seminormedGroup_E ā synthInstanceQ q(SeminormedGroup $E)
assertInstancesCommute
-- Check whether we are in a normed group and whether the context contains a `a ā 1` assumption
let o : Option (Q(NormedGroup $E) Ć Q($a ā 1)) := ā do
let .some normedGroup_E ā trySynthInstanceQ q(NormedGroup $E) | return none
let some pa ā findLocalDeclWithTypeQ? q($a ā 1) | return none
return some (normedGroup_E, pa)
match o with
-- If so, return a proof of `0 < āaā`
| some (_normedGroup_E, pa) =>
assertInstancesCommute
return .positive q(norm_pos_iff'.2 $pa)
-- Else, return a proof of `0 ⤠āaā`
| none => return .nonnegative q(norm_nonneg' $a)
| _, _, _ => throwError "not `āĀ·ā`"
/-- Extension for the `positivity` tactic: additive norms are always nonnegative, and positive
on non-zero inputs. -/
@[positivity ā_ā]
def evalAddNorm : PositivityExt where eval {u α} _ _ e := do
match u, α, e with
| 0, ~q(ā), ~q(@Norm.norm $E $_n $a) =>
let _seminormedAddGroup_E ā synthInstanceQ q(SeminormedAddGroup $E)
assertInstancesCommute
-- Check whether we are in a normed group and whether the context contains a `a ā 0` assumption
let o : Option (Q(NormedAddGroup $E) Ć Q($a ā 0)) := ā do
let .some normedAddGroup_E ā trySynthInstanceQ q(NormedAddGroup $E) | return none
let some pa ā findLocalDeclWithTypeQ? q($a ā 0) | return none
return some (normedAddGroup_E, pa)
match o with
-- If so, return a proof of `0 < āaā`
| some (_normedAddGroup_E, pa) =>
assertInstancesCommute
return .positive q(norm_pos_iff.2 $pa)
-- Else, return a proof of `0 ⤠āaā`
| none => return .nonnegative q(norm_nonneg $a)
| _, _, _ => throwError "not `āĀ·ā`"
end Mathlib.Meta.Positivity |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Group/Quotient.lean | import Mathlib.Analysis.Normed.Module.Basic
import Mathlib.Analysis.Normed.Group.Hom
import Mathlib.Analysis.Normed.Operator.LinearIsometry
import Mathlib.LinearAlgebra.Isomorphisms
import Mathlib.RingTheory.Ideal.Quotient.Operations
import Mathlib.Topology.MetricSpace.HausdorffDistance
/-!
# Quotients of seminormed groups
For any `SeminormedAddCommGroup M` and any `S : AddSubgroup M`, we provide a
`SeminormedAddCommGroup`, the group quotient `M ā§ø S`.
If `S` is closed, we provide `NormedAddCommGroup (M ā§ø S)` (regardless of whether `M` itself is
separated). The two main properties of these structures are the underlying topology is the quotient
topology and the projection is a normed group homomorphism which is norm non-increasing
(better, it has operator norm exactly one unless `S` is dense in `M`). The corresponding
universal property is that every normed group hom defined on `M` which vanishes on `S` descends
to a normed group hom defined on `M ā§ø S`.
This file also introduces a predicate `IsQuotient` characterizing normed group homs that
are isomorphic to the canonical projection onto a normed group quotient.
In addition, this file also provides normed structures for quotients of modules by submodules, and
of (commutative) rings by ideals. The `SeminormedAddCommGroup` and `NormedAddCommGroup`
instances described above are transferred directly, but we also define instances of `NormedSpace`,
`SeminormedCommRing`, `NormedCommRing` and `NormedAlgebra` under appropriate type class
assumptions on the original space. Moreover, while `QuotientAddGroup.completeSpace` works
out-of-the-box for quotients of `NormedAddCommGroup`s by `AddSubgroup`s, we need to transfer
this instance in `Submodule.Quotient.completeSpace` so that it applies to these other quotients.
## Main definitions
We use `M` and `N` to denote seminormed groups and `S : AddSubgroup M`.
All the following definitions are in the `AddSubgroup` namespace. Hence we can access
`AddSubgroup.normedMk S` as `S.normedMk`.
* `seminormedAddCommGroupQuotient` : The seminormed group structure on the quotient by
an additive subgroup. This is an instance so there is no need to explicitly use it.
* `normedAddCommGroupQuotient` : The normed group structure on the quotient by
a closed additive subgroup. This is an instance so there is no need to explicitly use it.
* `normedMk S` : the normed group hom from `M` to `M ā§ø S`.
* `lift S f hf`: implements the universal property of `M ā§ø S`. Here
`(f : NormedAddGroupHom M N)`, `(hf : ā s ā S, f s = 0)` and
`lift S f hf : NormedAddGroupHom (M ā§ø S) N`.
* `IsQuotient`: given `f : NormedAddGroupHom M N`, `IsQuotient f` means `N` is isomorphic
to a quotient of `M` by a subgroup, with projection `f`. Technically it asserts `f` is
surjective and the norm of `f x` is the infimum of the norms of `x + m` for `m` in `f.ker`.
## Main results
* `norm_normedMk` : the operator norm of the projection is `1` if the subspace is not dense.
* `IsQuotient.norm_lift`: Provided `f : normed_hom M N` satisfies `IsQuotient f`, for every
`n : N` and positive `ε`, there exists `m` such that `f m = n ā§ āmā < ānā + ε`.
## Implementation details
For any `SeminormedAddCommGroup M` and any `S : AddSubgroup M` we define a norm on `M ā§ø S` by
`āxā = sInf (norm '' {m | mk' S m = x})`. This formula is really an implementation detail, it
shouldn't be needed outside of this file setting up the theory.
Since `M ā§ø S` is automatically a topological space (as any quotient of a topological space),
one needs to be careful while defining the `SeminormedAddCommGroup` instance to avoid having two
different topologies on this quotient. This is not purely a technological issue.
Mathematically there is something to prove. The main point is proved in the auxiliary lemma
`quotient_nhds_basis` that has no use beyond this verification and states that zero in the quotient
admits as basis of neighborhoods in the quotient topology the sets `{x | āxā < ε}` for positive `ε`.
Once this mathematical point is settled, we have two topologies that are propositionally equal. This
is not good enough for the type class system. As usual we ensure *definitional* equality
using forgetful inheritance, see Note [forgetful inheritance]. A (semi)-normed group structure
includes a uniform space structure which includes a topological space structure, together
with propositional fields asserting compatibility conditions.
The usual way to define a `SeminormedAddCommGroup` is to let Lean build a uniform space structure
using the provided norm, and then trivially build a proof that the norm and uniform structure are
compatible. Here the uniform structure is provided using `IsTopologicalAddGroup.rightUniformSpace`
which uses the topological structure and the group structure to build the uniform structure. This
uniform structure induces the correct topological structure by construction, but the fact that it
is compatible with the norm is not obvious; this is where the mathematical content explained in
the previous paragraph kicks in.
-/
noncomputable section
open Metric Set Topology NNReal
namespace QuotientGroup
variable {M : Type*} [SeminormedCommGroup M] {S T : Subgroup M} {x : M ā§ø S} {m : M} {r ε : ā}
@[to_additive add_norm_aux]
private lemma norm_aux (x : M ā§ø S) : {m : M | (m : M ā§ø S) = x}.Nonempty := Quot.exists_rep x
/-- The norm of `x` on the quotient by a subgroup `S` is defined as the infimum of the norm on
`x * M`. -/
@[to_additive
/-- The norm of `x` on the quotient by a subgroup `S` is defined as the infimum of the norm on
`x + S`. -/]
noncomputable def groupSeminorm : GroupSeminorm (M ā§ø S) where
toFun x := infDist 1 {m : M | (m : M ā§ø S) = x}
map_one' := infDist_zero_of_mem (by simp)
mul_le' x y := by
simp only [infDist_eq_iInf]
have := (norm_aux x).to_subtype
have := (norm_aux y).to_subtype
refine le_ciInf_add_ciInf ?_
rintro āØa, rflā© āØb, rflā©
refine ciInf_le_of_le āØ0, forall_mem_range.2 fun _ ⦠dist_nonnegā© āØa * b, rflā© ?_
simpa using norm_mul_le' _ _
inv' x := eq_of_forall_le_iff fun r ⦠by
simp only [le_infDist (norm_aux _)]
exact (Equiv.inv _).forall_congr (by simp [ā inv_eq_iff_eq_inv])
/-- The norm of `x` on the quotient by a subgroup `S` is defined as the infimum of the norm on
`x * S`. -/
@[to_additive
/-- The norm of `x` on the quotient by a subgroup `S` is defined as the infimum of the norm on
`x + S`. -/]
noncomputable instance instNorm : Norm (M ā§ø S) where norm := groupSeminorm
@[to_additive]
lemma norm_eq_groupSeminorm (x : M ā§ø S) : āxā = groupSeminorm x := rfl
@[to_additive]
lemma norm_eq_infDist (x : M ā§ø S) : āxā = infDist 1 {m : M | (m : M ā§ø S) = x} := rfl
@[to_additive]
lemma le_norm_iff : r ⤠āxā ā ā m : M, ām = x ā r ⤠āmā := by
simp [norm_eq_infDist, le_infDist (norm_aux _)]
@[to_additive]
lemma norm_lt_iff : āxā < r ā ā m : M, ām = x ā§ āmā < r := by
simp [norm_eq_infDist, infDist_lt_iff (norm_aux _)]
@[to_additive]
lemma nhds_one_hasBasis : (š (1 : M ā§ø S)).HasBasis (fun ε ⦠0 < ε) fun ε ⦠{x | āxā < ε} := by
have : ā ε : ā, mk '' ball (1 : M) ε = {x : M ā§ø S | āxā < ε} := by
refine fun ε ⦠Set.ext <| forall_mk.2 fun x ⦠?_
rw [ball_one_eq, mem_setOf_eq, norm_lt_iff, mem_image]
exact exists_congr fun _ ⦠and_comm
rw [ā mk_one, nhds_eq, ā funext this]
exact .map _ Metric.nhds_basis_ball
/-- An alternative definition of the norm on the quotient group: the norm of `((x : M) : M ā§ø S)` is
equal to the distance from `x` to `S`. -/
@[to_additive
/-- An alternative definition of the norm on the quotient group: the norm of `((x : M) : M ā§ø S)` is
equal to the distance from `x` to `S`. -/]
lemma norm_mk (x : M) : ā(x : M ā§ø S)ā = infDist x S := by
rw [norm_eq_infDist, ā infDist_image (IsometryEquiv.divLeft x).isometry,
ā IsometryEquiv.preimage_symm]
simp
/-- The norm of the projection is smaller or equal to the norm of the original element. -/
@[to_additive
/-- The norm of the projection is smaller or equal to the norm of the original element. -/]
lemma norm_mk_le_norm : ā(m : M ā§ø S)ā ⤠āmā :=
(infDist_le_dist_of_mem (by simp)).trans_eq (dist_one_left _)
/-- The norm of the image of `m : M` in the quotient by `S` is zero if and only if `m` belongs
to the closure of `S`. -/
@[to_additive /-- The norm of the image of `m : M` in the quotient by `S` is zero if and only if `m`
belongs to the closure of `S`. -/]
lemma norm_mk_eq_zero_iff_mem_closure : ā(m : M ā§ø S)ā = 0 ā m ā closure (S : Set M) := by
rw [norm_mk, ā mem_closure_iff_infDist_zero]
exact āØ1, S.one_memā©
/-- The norm of the image of `m : M` in the quotient by a closed subgroup `S` is zero if and only if
`m ā S`. -/
@[to_additive /-- The norm of the image of `m : M` in the quotient by a closed subgroup `S` is zero
if and only if `m ā S`. -/]
lemma norm_mk_eq_zero [hS : IsClosed (S : Set M)] : ā(m : M ā§ø S)ā = 0 ā m ā S := by
rw [norm_mk_eq_zero_iff_mem_closure, hS.closure_eq, SetLike.mem_coe]
/-- For any `x : M ⧸ S` and any `0 < ε`, there is `m : M` such that `mk' S m = x`
and `āmā < āxā + ε`. -/
@[to_additive /-- For any `x : M ⧸ S` and any `0 < ε`, there is `m : M` such that `mk' S m = x`
and `āmā < āxā + ε`. -/]
lemma exists_norm_mk_lt (x : M ā§ø S) (hε : 0 < ε) : ā m : M, m = x ā§ āmā < āxā + ε :=
norm_lt_iff.1 <| lt_add_of_pos_right _ hε
/-- For any `m : M` and any `0 < ε`, there is `s ā S` such that `ām * sā < āmk' S mā + ε`. -/
@[to_additive
/-- For any `m : M` and any `0 < ε`, there is `s ā S` such that `ām + sā < āmk' S mā + ε`. -/]
lemma exists_norm_mul_lt (S : Subgroup M) (m : M) {ε : ā} (hε : 0 < ε) :
ā s ā S, ām * sā < āmk' S mā + ε := by
obtain āØn : M, hn, hn'ā© := exists_norm_mk_lt (QuotientGroup.mk' S m) hε
exact āØmā»Ā¹ * n, by simpa [eq_comm, QuotientGroup.eq] using hn, by simpaā©
variable (S) in
/-- The seminormed group structure on the quotient by a subgroup. -/
@[to_additive /-- The seminormed group structure on the quotient by an additive subgroup. -/]
noncomputable instance instSeminormedCommGroup : SeminormedCommGroup (M ā§ø S) where
toUniformSpace := IsTopologicalGroup.rightUniformSpace (M ā§ø S)
__ := groupSeminorm.toSeminormedCommGroup
uniformity_dist := by
rw [uniformity_eq_comap_nhds_one', (nhds_one_hasBasis.comap _).eq_biInf]
simp only [dist, preimage_setOf_eq, norm_eq_groupSeminorm, map_div_rev]
variable (S) in
/-- The quotient in the category of normed groups. -/
@[to_additive /-- The quotient in the category of normed groups. -/]
noncomputable instance instNormedCommGroup [hS : IsClosed (S : Set M)] :
NormedCommGroup (M ā§ø S) where
__ := MetricSpace.ofT0PseudoMetricSpace _
-- This is a sanity check left here on purpose to ensure that potential refactors won't destroy
-- this important property.
example :
(instTopologicalSpaceQuotient : TopologicalSpace <| M ā§ø S) =
(instSeminormedCommGroup S).toUniformSpace.toTopologicalSpace := rfl
example [IsClosed (S : Set M)] :
(instSeminormedCommGroup S) = NormedCommGroup.toSeminormedCommGroup := rfl
/-- An isometric version of `Subgroup.quotientEquivOfEq`. -/
@[to_additive /-- An isometric version of `AddSubgroup.quotientEquivOfEq`. -/]
def _root_.Subgroup.quotientIsometryEquivOfEq (h : S = T) : M ā§ø S āįµ¢ M ā§ø T where
__ := Subgroup.quotientEquivOfEq h
isometry_toFun := by subst h; rintro āØ_ā© āØ_ā©; rfl
/-- An isometric version of `QuotientGroup.quotientBot`. -/
@[to_additive /-- An isometric version of `QuotientAddGroup.quotientBot`. -/]
def quotientBotIsometryEquiv : M ā§ø (ā„ : Subgroup M) āįµ¢ M where
__ := quotientBot
isometry_toFun : Isometry quotientBot := by
rw [MonoidHomClass.isometry_iff_norm]
rintro āØxā©
change āxā = āQuotientGroup.mk xā
simp [norm_mk]
/-- An isometric version of `QuotientGroup.quotientQuotientEquivQuotient`. -/
@[to_additive /-- An isometric version of `QuotientAddGroup.quotientQuotientEquivQuotient`. -/]
def quotientQuotientIsometryEquivQuotient (h : S ⤠T) : (M ā§ø S) ā§ø T.map (mk' S) āįµ¢ M ā§ø T where
__ := quotientQuotientEquivQuotient S T h
isometry_toFun : Isometry (quotientQuotientEquivQuotient S T h) := by
rw [MonoidHomClass.isometry_iff_norm]
refine fun x => eq_of_forall_le_iff fun r => ?_
simp only [le_norm_iff]
exact āØ
fun hā y hā z hā => hā z <| by subst_vars; rfl,
fun hā y hā => hā y ((quotientQuotientEquivQuotient S T h).injective hā) y rflā©
end QuotientGroup
open QuotientAddGroup Metric Set Topology NNReal
variable {M N : Type*} [SeminormedAddCommGroup M] [SeminormedAddCommGroup N]
/-- The norm of the image under the natural morphism to the quotient. -/
theorem quotient_norm_mk_eq (S : AddSubgroup M) (m : M) :
āmk' S mā = sInf ((ām + Ā·ā) '' S) := by
rw [mk'_apply, norm_mk, sInf_image', ā infDist_image isometry_neg, image_neg_eq_neg,
neg_coe_set (H := S), infDist_eq_iInf]
simp only [dist_eq_norm', sub_neg_eq_add, add_comm]
/-- The quotient norm satisfies the triangle inequality. -/
theorem quotient_norm_add_le (S : AddSubgroup M) (x y : M ā§ø S) : āx + yā ⤠āxā + āyā :=
norm_add_le x y
namespace AddSubgroup
open NormedAddGroupHom
/-- The morphism from a seminormed group to the quotient by a subgroup. -/
noncomputable def normedMk (S : AddSubgroup M) : NormedAddGroupHom M (M ā§ø S) where
__ := QuotientAddGroup.mk' S
bound' := āØ1, fun m => by simpa [one_mul] using norm_mk_le_normā©
/-- `S.normedMk` agrees with `QuotientAddGroup.mk' S`. -/
@[simp]
theorem normedMk.apply (S : AddSubgroup M) (m : M) : normedMk S m = QuotientAddGroup.mk' S m :=
rfl
/-- `S.normedMk` is surjective. -/
theorem surjective_normedMk (S : AddSubgroup M) : Function.Surjective (normedMk S) :=
Quot.mk_surjective
/-- The kernel of `S.normedMk` is `S`. -/
theorem ker_normedMk (S : AddSubgroup M) : S.normedMk.ker = S :=
QuotientAddGroup.ker_mk' _
/-- The operator norm of the projection is at most `1`. -/
theorem norm_normedMk_le (S : AddSubgroup M) : āS.normedMkā ⤠1 :=
NormedAddGroupHom.opNorm_le_bound _ zero_le_one fun m => by simp [norm_mk_le_norm]
theorem _root_.QuotientAddGroup.norm_lift_apply_le {S : AddSubgroup M} (f : NormedAddGroupHom M N)
(hf : ā x ā S, f x = 0) (x : M ā§ø S) : ālift S f.toAddMonoidHom hf xā ⤠āfā * āxā := by
cases (norm_nonneg f).eq_or_lt' with
| inl h =>
rcases mk_surjective x with āØx, rflā©
simpa [h] using le_opNorm f x
| inr h =>
rw [ā not_lt, ā lt_div_iffā' h, norm_lt_iff]
rintro āØx, rfl, hxā©
exact ((lt_div_iffā' h).1 hx).not_ge (le_opNorm f x)
/-- The operator norm of the projection is `1` if the subspace is not dense. -/
theorem norm_normedMk (S : AddSubgroup M) (h : (S.topologicalClosure : Set M) ā univ) :
āS.normedMkā = 1 := by
refine le_antisymm (norm_normedMk_le S) ?_
obtain āØx, hxā© : ā x : M, 0 < ā(x : M ā§ø S)ā := by
refine (Set.nonempty_compl.2 h).imp fun x hx ⦠?_
exact (norm_nonneg _).lt_of_ne' <| mt norm_mk_eq_zero_iff_mem_closure.1 hx
refine (le_mul_iff_one_le_left hx).1 ?_
exact norm_lift_apply_le S.normedMk (fun x ⦠(eq_zero_iff x).2) x
/-- The operator norm of the projection is `0` if the subspace is dense. -/
theorem norm_trivial_quotient_mk (S : AddSubgroup M)
(h : (S.topologicalClosure : Set M) = Set.univ) : āS.normedMkā = 0 := by
refine le_antisymm (opNorm_le_bound _ le_rfl fun x => ?_) (norm_nonneg _)
have hker : x ā S.normedMk.ker.topologicalClosure := by
rw [S.ker_normedMk, ā SetLike.mem_coe, h]
trivial
rw [ker_normedMk] at hker
simp [norm_mk_eq_zero_iff_mem_closure.mpr hker]
end AddSubgroup
namespace NormedAddGroupHom
/-- `IsQuotient f`, for `f : M ā¶ N` means that `N` is isomorphic to the quotient of `M`
by the kernel of `f`. -/
structure IsQuotient (f : NormedAddGroupHom M N) : Prop where
protected surjective : Function.Surjective f
protected norm : ā x, āf xā = sInf ((fun m => āx + mā) '' f.ker)
/-- Given `f : NormedAddGroupHom M N` such that `f s = 0` for all `s ā S`, where,
`S : AddSubgroup M` is closed, the induced morphism `NormedAddGroupHom (M ā§ø S) N`. -/
noncomputable def lift {N : Type*} [SeminormedAddCommGroup N] (S : AddSubgroup M)
(f : NormedAddGroupHom M N) (hf : ā s ā S, f s = 0) : NormedAddGroupHom (M ā§ø S) N :=
{ QuotientAddGroup.lift S f.toAddMonoidHom hf with
bound' := āØāfā, norm_lift_apply_le f hfā© }
theorem lift_mk {N : Type*} [SeminormedAddCommGroup N] (S : AddSubgroup M)
(f : NormedAddGroupHom M N) (hf : ā s ā S, f s = 0) (m : M) :
lift S f hf (S.normedMk m) = f m :=
rfl
theorem lift_unique {N : Type*} [SeminormedAddCommGroup N] (S : AddSubgroup M)
(f : NormedAddGroupHom M N) (hf : ā s ā S, f s = 0) (g : NormedAddGroupHom (M ā§ø S) N)
(h : g.comp S.normedMk = f) : g = lift S f hf := by
ext x
rcases AddSubgroup.surjective_normedMk _ x with āØx, rflā©
change g.comp S.normedMk x = _
simp only [h]
rfl
/-- `S.normedMk` satisfies `IsQuotient`. -/
theorem isQuotientQuotient (S : AddSubgroup M) : IsQuotient S.normedMk :=
āØS.surjective_normedMk, fun m => by simpa [S.ker_normedMk] using quotient_norm_mk_eq _ mā©
theorem IsQuotient.norm_lift {f : NormedAddGroupHom M N} (hquot : IsQuotient f) {ε : ā} (hε : 0 < ε)
(n : N) : ā m : M, f m = n ā§ āmā < ānā + ε := by
obtain āØm, rflā© := hquot.surjective n
have nonemp : ((fun m' => ām + m'ā) '' f.ker).Nonempty := by
rw [Set.image_nonempty]
exact āØ0, f.ker.zero_memā©
rcases Real.lt_sInf_add_pos nonemp hε
with āØ_, āØāØx, hx, rflā©, H : ām + xā < sInf ((fun m' : M => ām + m'ā) '' f.ker) + εā©ā©
exact āØm + x, by rw [map_add, (NormedAddGroupHom.mem_ker f x).mp hx, add_zero], by
rwa [hquot.norm]ā©
theorem IsQuotient.norm_le {f : NormedAddGroupHom M N} (hquot : IsQuotient f) (m : M) :
āf mā ⤠āmā := by
rw [hquot.norm]
apply csInf_le
Ā· use 0
rintro _ āØm', -, rflā©
apply norm_nonneg
Ā· exact āØ0, f.ker.zero_mem, by simpā©
theorem norm_lift_le {N : Type*} [SeminormedAddCommGroup N] (S : AddSubgroup M)
(f : NormedAddGroupHom M N) (hf : ā s ā S, f s = 0) :
ālift S f hfā ⤠āfā :=
opNorm_le_bound _ (norm_nonneg f) (norm_lift_apply_le f hf)
-- TODO: deprecate?
theorem lift_norm_le {N : Type*} [SeminormedAddCommGroup N] (S : AddSubgroup M)
(f : NormedAddGroupHom M N) (hf : ā s ā S, f s = 0) {c : āā„0} (fb : āfā ⤠c) :
ālift S f hfā ⤠c :=
(norm_lift_le S f hf).trans fb
theorem lift_normNoninc {N : Type*} [SeminormedAddCommGroup N] (S : AddSubgroup M)
(f : NormedAddGroupHom M N) (hf : ā s ā S, f s = 0) (fb : f.NormNoninc) :
(lift S f hf).NormNoninc := fun x => by
have fb' : āfā ⤠(1 : āā„0) := NormNoninc.normNoninc_iff_norm_le_one.mp fb
simpa using le_of_opNorm_le _ (f.lift_norm_le _ _ fb') _
end NormedAddGroupHom
/-!
### Submodules and ideals
In what follows, the norm structures created above for quotients of (semi)`NormedAddCommGroup`s
by `AddSubgroup`s are transferred via definitional equality to quotients of modules by submodules,
and of rings by ideals, thereby preserving the definitional equality for the topological group and
uniform structures worked for above. Completeness is also transferred via this definitional
equality.
In addition, instances are constructed for `NormedSpace`, `SeminormedCommRing`,
`NormedCommRing` and `NormedAlgebra` under the appropriate hypotheses. Currently, we do not
have quotients of rings by two-sided ideals, hence the commutativity hypotheses are required.
-/
section Submodule
variable {R : Type*} [Ring R] [Module R M] (S T : Submodule R M)
instance Submodule.Quotient.seminormedAddCommGroup : SeminormedAddCommGroup (M ā§ø S) :=
QuotientAddGroup.instSeminormedAddCommGroup S.toAddSubgroup
instance Submodule.Quotient.normedAddCommGroup [hS : IsClosed (S : Set M)] :
NormedAddCommGroup (M ā§ø S) :=
QuotientAddGroup.instNormedAddCommGroup S.toAddSubgroup (hS := hS)
instance Submodule.Quotient.completeSpace [CompleteSpace M] : CompleteSpace (M ā§ø S) :=
QuotientAddGroup.completeSpace M S.toAddSubgroup
/-- For any `x : M ⧸ S` and any `0 < ε`, there is `m : M` such that `Submodule.Quotient.mk m = x`
and `āmā < āxā + ε`. -/
nonrec theorem Submodule.Quotient.norm_mk_lt {S : Submodule R M} (x : M ā§ø S) {ε : ā} (hε : 0 < ε) :
ā m : M, Submodule.Quotient.mk m = x ā§ āmā < āxā + ε :=
exists_norm_mk_lt x hε
theorem Submodule.Quotient.norm_mk_le (m : M) : ā(Submodule.Quotient.mk m : M ā§ø S)ā ⤠āmā :=
norm_mk_le_norm
instance Submodule.Quotient.instIsBoundedSMul (š : Type*)
[SeminormedCommRing š] [Module š M] [IsBoundedSMul š M] [SMul š R] [IsScalarTower š R M] :
IsBoundedSMul š (M ā§ø S) :=
.of_norm_smul_le fun k x =>
-- this is `QuotientAddGroup.norm_lift_apply_le` for `f : M ā M ā§ø S` given by
-- `x ⦠mk (k ⢠x)`; todo: add scalar multiplication as `NormedAddGroupHom`, use it here
_root_.le_of_forall_pos_le_add fun ε hε => by
have := (nhds_basis_ball.tendsto_iff nhds_basis_ball).mp
((@Real.uniformContinuous_const_mul ākā).continuous.tendsto āxā) ε hε
simp only [mem_ball, dist, abs_sub_lt_iff] at this
rcases this with āØĪ“, hĪ“, hā©
obtain āØa, rfl, haā© := Submodule.Quotient.norm_mk_lt x hĪ“
specialize h āaā āØby linarith, by linarith [Submodule.Quotient.norm_mk_le S a]ā©
calc
_ ⤠ākā * āaā := (norm_mk_le ..).trans (norm_smul_le k a)
_ ⤠_ := (sub_lt_iff_lt_add'.mp h.1).le
instance Submodule.Quotient.normedSpace (š : Type*) [NormedField š] [NormedSpace š M] [SMul š R]
[IsScalarTower š R M] : NormedSpace š (M ā§ø S) where
norm_smul_le := norm_smul_le
/-- An isometric version of `Submodule.quotEquivOfEq`. -/
def Submodule.quotLIEOfEq (h : S = T) : M ā§ø S āāįµ¢[R] M ā§ø T where
__ := Submodule.quotEquivOfEq S T h
norm_map' := by subst h; rintro āØ_ā©; rfl
/-- An isometric version of `Submodule.quotientQuotientEquivQuotient`. -/
def Submodule.quotientQuotientLIEQuotient (h : S ⤠T) : (M ā§ø S) ā§ø map S.mkQ T āāįµ¢[R] M ā§ø T where
__ := Submodule.quotientQuotientEquivQuotient S T h
norm_map' :=
(AddMonoidHomClass.isometry_iff_norm _).mp
(QuotientAddGroup.quotientQuotientIsometryEquivQuotient
((Submodule.toAddSubgroup_le S T).mpr h)).isometry
/-- An isometric version of `Submodule.quotientQuotientEquivQuotientSup`. -/
def Submodule.quotientQuotientLIEQuotientSup : (M ā§ø S) ā§ø map S.mkQ T āāįµ¢[R] M ā§ø (S ā T) :=
(quotLIEOfEq _ _ (by simp)).trans (quotientQuotientLIEQuotient _ _ le_sup_left)
end Submodule
section Ideal
variable {R : Type*} [SeminormedCommRing R] (I : Ideal R)
nonrec theorem Ideal.Quotient.norm_mk_lt {I : Ideal R} (x : R ā§ø I) {ε : ā} (hε : 0 < ε) :
ā r : R, Ideal.Quotient.mk I r = x ā§ ārā < āxā + ε :=
exists_norm_mk_lt x hε
theorem Ideal.Quotient.norm_mk_le (r : R) : āIdeal.Quotient.mk I rā ⤠ārā := norm_mk_le_norm
instance Ideal.Quotient.semiNormedCommRing : SeminormedCommRing (R ā§ø I) where
dist_eq := dist_eq_norm
mul_comm := _root_.mul_comm
norm_mul_le x y := le_of_forall_pos_le_add fun ε hε => by
have := ((nhds_basis_ball.prod_nhds nhds_basis_ball).tendsto_iff nhds_basis_ball).mp
(continuous_mul.tendsto (āxā, āyā)) ε hε
simp only [Set.mem_prod, mem_ball, and_imp, Prod.forall, Prod.exists] at this
rcases this with āØĪµā, εā, āØhā, hāā©, hā©
obtain āØāØa, rfl, haā©, āØb, rfl, hbā©ā© := Ideal.Quotient.norm_mk_lt x hā,
Ideal.Quotient.norm_mk_lt y hā
simp only [dist, abs_sub_lt_iff] at h
specialize h āaā ābā āØby linarith, by linarith [Ideal.Quotient.norm_mk_le I a]ā©
āØby linarith, by linarith [Ideal.Quotient.norm_mk_le I b]ā©
calc
_ ⤠āaā * ābā := (Ideal.Quotient.norm_mk_le I (a * b)).trans (norm_mul_le a b)
_ ⤠_ := (sub_lt_iff_lt_add'.mp h.1).le
instance Ideal.Quotient.normedCommRing [IsClosed (I : Set R)] : NormedCommRing (R ā§ø I) :=
{ Ideal.Quotient.semiNormedCommRing I, Submodule.Quotient.normedAddCommGroup I with }
variable (š : Type*) [NormedField š]
instance Ideal.Quotient.normedAlgebra [NormedAlgebra š R] : NormedAlgebra š (R ā§ø I) :=
{ Submodule.Quotient.normedSpace I š, Ideal.Quotient.algebra š with }
end Ideal |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Group/Constructions.lean | import Mathlib.Algebra.Group.PUnit
import Mathlib.Algebra.Group.ULift
import Mathlib.Analysis.Normed.Group.Basic
/-!
# Product of normed groups and other constructions
This file constructs the infinity norm on finite products of normed groups and provides instances
for type synonyms.
-/
open NNReal
variable {ι E F : Type*} {G : ι ā Type*}
/-! ### `PUnit` -/
namespace PUnit
instance normedAddCommGroup : NormedAddCommGroup PUnit where
norm := Function.const _ 0
dist_eq _ _ := rfl
@[simp] lemma norm_eq_zero (x : PUnit) : āxā = 0 := rfl
end PUnit
/-! ### `ULift` -/
namespace ULift
section Norm
variable [Norm E]
instance norm : Norm (ULift E) where norm x := āx.downā
lemma norm_def (x : ULift E) : āxā = āx.downā := rfl
@[simp] lemma norm_up (x : E) : āULift.up xā = āxā := rfl
@[simp] lemma norm_down (x : ULift E) : āx.downā = āxā := rfl
end Norm
section NNNorm
variable [NNNorm E]
instance nnnorm : NNNorm (ULift E) where nnnorm x := āx.downāā
lemma nnnorm_def (x : ULift E) : āxāā = āx.downāā := rfl
@[simp] lemma nnnorm_up (x : E) : āULift.up xāā = āxāā := rfl
@[simp] lemma nnnorm_down (x : ULift E) : āx.downāā = āxāā := rfl
end NNNorm
@[to_additive]
instance seminormedGroup [SeminormedGroup E] : SeminormedGroup (ULift E) :=
SeminormedGroup.induced _ _
{ toFun := ULift.down,
map_one' := rfl,
map_mul' := fun _ _ => rfl : ULift E ā* E }
@[to_additive]
instance seminormedCommGroup [SeminormedCommGroup E] : SeminormedCommGroup (ULift E) :=
SeminormedCommGroup.induced _ _
{ toFun := ULift.down,
map_one' := rfl,
map_mul' := fun _ _ => rfl : ULift E ā* E }
@[to_additive]
instance normedGroup [NormedGroup E] : NormedGroup (ULift E) :=
NormedGroup.induced _ _
{ toFun := ULift.down,
map_one' := rfl,
map_mul' := fun _ _ => rfl : ULift E ā* E }
down_injective
@[to_additive]
instance normedCommGroup [NormedCommGroup E] : NormedCommGroup (ULift E) :=
NormedCommGroup.induced _ _
{ toFun := ULift.down,
map_one' := rfl,
map_mul' := fun _ _ => rfl : ULift E ā* E }
down_injective
end ULift
/-! ### `Additive`, `Multiplicative` -/
section AdditiveMultiplicative
open Additive Multiplicative
section Norm
variable [Norm E]
instance Additive.toNorm : Norm (Additive E) := ā¹Norm Eāŗ
instance Multiplicative.toNorm : Norm (Multiplicative E) := ā¹Norm Eāŗ
@[simp] lemma norm_toMul (x : Additive E) : ā(x.toMul : E)ā = āxā := rfl
@[simp] lemma norm_ofMul (x : E) : āofMul xā = āxā := rfl
@[simp] lemma norm_toAdd (x : Multiplicative E) : ā(x.toAdd : E)ā = āxā := rfl
@[simp] lemma norm_ofAdd (x : E) : āofAdd xā = āxā := rfl
end Norm
section NNNorm
variable [NNNorm E]
instance Additive.toNNNorm : NNNorm (Additive E) := ā¹NNNorm Eāŗ
instance Multiplicative.toNNNorm : NNNorm (Multiplicative E) := ā¹NNNorm Eāŗ
@[simp] lemma nnnorm_toMul (x : Additive E) : ā(x.toMul : E)āā = āxāā := rfl
@[simp] lemma nnnorm_ofMul (x : E) : āofMul xāā = āxāā := rfl
@[simp] lemma nnnorm_toAdd (x : Multiplicative E) : ā(x.toAdd : E)āā = āxāā := rfl
@[simp] lemma nnnorm_ofAdd (x : E) : āofAdd xāā = āxāā := rfl
end NNNorm
instance Additive.seminormedAddGroup [SeminormedGroup E] : SeminormedAddGroup (Additive E) where
dist_eq x y := dist_eq_norm_div x.toMul y.toMul
instance Multiplicative.seminormedGroup [SeminormedAddGroup E] :
SeminormedGroup (Multiplicative E) where
dist_eq x y := dist_eq_norm_sub x.toAdd y.toAdd
instance Additive.seminormedCommGroup [SeminormedCommGroup E] :
SeminormedAddCommGroup (Additive E) :=
{ Additive.seminormedAddGroup with
add_comm := add_comm }
instance Multiplicative.seminormedAddCommGroup [SeminormedAddCommGroup E] :
SeminormedCommGroup (Multiplicative E) :=
{ Multiplicative.seminormedGroup with
mul_comm := mul_comm }
instance Additive.normedAddGroup [NormedGroup E] : NormedAddGroup (Additive E) :=
{ Additive.seminormedAddGroup with
eq_of_dist_eq_zero := eq_of_dist_eq_zero }
instance Multiplicative.normedGroup [NormedAddGroup E] : NormedGroup (Multiplicative E) :=
{ Multiplicative.seminormedGroup with
eq_of_dist_eq_zero := eq_of_dist_eq_zero }
instance Additive.normedAddCommGroup [NormedCommGroup E] : NormedAddCommGroup (Additive E) :=
{ Additive.seminormedAddGroup with
add_comm := add_comm
eq_of_dist_eq_zero := eq_of_dist_eq_zero }
instance Multiplicative.normedCommGroup [NormedAddCommGroup E] :
NormedCommGroup (Multiplicative E) :=
{ Multiplicative.seminormedGroup with
mul_comm := mul_comm
eq_of_dist_eq_zero := eq_of_dist_eq_zero }
end AdditiveMultiplicative
/-! ### Order dual -/
section OrderDual
open OrderDual
section Norm
variable [Norm E]
instance OrderDual.toNorm : Norm Eįµįµ := ā¹Norm Eāŗ
@[simp] lemma norm_toDual (x : E) : ātoDual xā = āxā := rfl
@[simp] lemma norm_ofDual (x : Eįµįµ) : āofDual xā = āxā := rfl
end Norm
section NNNorm
variable [NNNorm E]
instance OrderDual.toNNNorm : NNNorm Eįµįµ := ā¹NNNorm Eāŗ
@[simp] lemma nnnorm_toDual (x : E) : ātoDual xāā = āxāā := rfl
@[simp] lemma nnnorm_ofDual (x : Eįµįµ) : āofDual xāā = āxāā := rfl
end NNNorm
namespace OrderDual
-- See note [lower instance priority]
@[to_additive]
instance (priority := 100) seminormedGroup [SeminormedGroup E] : SeminormedGroup Eįµįµ :=
ā¹SeminormedGroup Eāŗ
-- See note [lower instance priority]
@[to_additive]
instance (priority := 100) seminormedCommGroup [SeminormedCommGroup E] : SeminormedCommGroup Eįµįµ :=
ā¹SeminormedCommGroup Eāŗ
-- See note [lower instance priority]
@[to_additive]
instance (priority := 100) normedGroup [NormedGroup E] : NormedGroup Eįµįµ := ā¹NormedGroup Eāŗ
-- See note [lower instance priority]
@[to_additive]
instance (priority := 100) normedCommGroup [NormedCommGroup E] : NormedCommGroup Eįµįµ :=
ā¹NormedCommGroup Eāŗ
end OrderDual
end OrderDual
/-! ### Binary product of normed groups -/
section Norm
variable [Norm E] [Norm F] {x : E Ć F} {r : ā}
instance Prod.toNorm : Norm (E Ć F) where norm x := āx.1ā ā āx.2ā
lemma Prod.norm_def (x : E Ć F) : āxā = max āx.1ā āx.2ā := rfl
@[simp] lemma Prod.norm_mk (x : E) (y : F) : ā(x, y)ā = max āxā āyā := rfl
lemma norm_fst_le (x : E Ć F) : āx.1ā ⤠āxā := le_max_left _ _
lemma norm_snd_le (x : E Ć F) : āx.2ā ⤠āxā := le_max_right _ _
lemma norm_prod_le_iff : āxā ⤠r ā āx.1ā ⤠r ā§ āx.2ā ⤠r := max_le_iff
end Norm
section SeminormedGroup
variable [SeminormedGroup E] [SeminormedGroup F]
/-- Product of seminormed groups, using the sup norm. -/
@[to_additive /-- Product of seminormed groups, using the sup norm. -/]
instance Prod.seminormedGroup : SeminormedGroup (E Ć F) where
dist_eq x y := by
simp only [Prod.norm_def, Prod.dist_eq, dist_eq_norm_div, Prod.fst_div, Prod.snd_div]
/-- Multiplicative version of `Prod.nnnorm_def`.
Earlier, this names was used for the additive version. -/
@[to_additive Prod.nnnorm_def]
lemma Prod.nnnorm_def' (x : E Ć F) : āxāā = max āx.1āā āx.2āā := rfl
/-- Multiplicative version of `Prod.nnnorm_mk`. -/
@[to_additive (attr := simp) Prod.nnnorm_mk]
lemma Prod.nnnorm_mk' (x : E) (y : F) : ā(x, y)āā = max āxāā āyāā := rfl
end SeminormedGroup
namespace Prod
/-- Product of seminormed groups, using the sup norm. -/
@[to_additive /-- Product of seminormed groups, using the sup norm. -/]
instance seminormedCommGroup [SeminormedCommGroup E] [SeminormedCommGroup F] :
SeminormedCommGroup (E Ć F) :=
{ Prod.seminormedGroup with
mul_comm := mul_comm }
/-- Product of normed groups, using the sup norm. -/
@[to_additive /-- Product of normed groups, using the sup norm. -/]
instance normedGroup [NormedGroup E] [NormedGroup F] : NormedGroup (E Ć F) :=
{ Prod.seminormedGroup with
eq_of_dist_eq_zero := eq_of_dist_eq_zero }
/-- Product of normed groups, using the sup norm. -/
@[to_additive /-- Product of normed groups, using the sup norm. -/]
instance normedCommGroup [NormedCommGroup E] [NormedCommGroup F] : NormedCommGroup (E Ć F) :=
{ Prod.seminormedGroup with
mul_comm := mul_comm
eq_of_dist_eq_zero := eq_of_dist_eq_zero }
end Prod
/-! ### Finite product of normed groups -/
section Pi
variable [Fintype ι]
section SeminormedGroup
variable [ā i, SeminormedGroup (G i)] [SeminormedGroup E] (f : ā i, G i) {x : ā i, G i} {r : ā}
/-- Finite product of seminormed groups, using the sup norm. -/
@[to_additive /-- Finite product of seminormed groups, using the sup norm. -/]
instance Pi.seminormedGroup : SeminormedGroup (ā i, G i) where
norm f := ā(Finset.univ.sup fun b => āf bāā)
dist_eq x y :=
congr_arg (toReal : āā„0 ā ā) <|
congr_arg (Finset.sup Finset.univ) <|
funext fun a => show nndist (x a) (y a) = āx a / y aāā from nndist_eq_nnnorm_div (x a) (y a)
@[to_additive Pi.norm_def]
lemma Pi.norm_def' : āfā = ā(Finset.univ.sup fun b => āf bāā) := rfl
@[to_additive Pi.nnnorm_def]
lemma Pi.nnnorm_def' : āfāā = Finset.univ.sup fun b => āf bāā := Subtype.eta _ _
/-- The seminorm of an element in a product space is `⤠r` if and only if the norm of each
component is. -/
@[to_additive pi_norm_le_iff_of_nonneg /-- The seminorm of an element in a product space is `⤠r` if
and only if the norm of each component is. -/]
lemma pi_norm_le_iff_of_nonneg' (hr : 0 ⤠r) : āxā ⤠r ā ā i, āx iā ⤠r := by
simp only [ā dist_one_right, dist_pi_le_iff hr, Pi.one_apply]
@[to_additive pi_nnnorm_le_iff]
lemma pi_nnnorm_le_iff' {r : āā„0} : āxāā ⤠r ā ā i, āx iāā ⤠r :=
pi_norm_le_iff_of_nonneg' r.coe_nonneg
@[to_additive pi_norm_le_iff_of_nonempty]
lemma pi_norm_le_iff_of_nonempty' [Nonempty ι] : āfā ⤠r ā ā b, āf bā ⤠r := by
by_cases hr : 0 ⤠r
Ā· exact pi_norm_le_iff_of_nonneg' hr
Ā· exact
iff_of_false (fun h => hr <| (norm_nonneg' _).trans h) fun h =>
hr <| (norm_nonneg' _).trans <| h <| Classical.arbitrary _
/-- The seminorm of an element in a product space is `< r` if and only if the norm of each
component is. -/
@[to_additive pi_norm_lt_iff /-- The seminorm of an element in a product space is `< r` if and only
if the norm of each component is. -/]
lemma pi_norm_lt_iff' (hr : 0 < r) : āxā < r ā ā i, āx iā < r := by
simp only [ā dist_one_right, dist_pi_lt_iff hr, Pi.one_apply]
@[to_additive pi_nnnorm_lt_iff]
lemma pi_nnnorm_lt_iff' {r : āā„0} (hr : 0 < r) : āxāā < r ā ā i, āx iāā < r :=
pi_norm_lt_iff' hr
@[to_additive norm_le_pi_norm]
lemma norm_le_pi_norm' (i : ι) : āf iā ⤠āfā :=
(pi_norm_le_iff_of_nonneg' <| norm_nonneg' _).1 le_rfl i
@[to_additive nnnorm_le_pi_nnnorm]
lemma nnnorm_le_pi_nnnorm' (i : ι) : āf iāā ⤠āfāā :=
norm_le_pi_norm' _ i
@[to_additive pi_norm_const_le]
lemma pi_norm_const_le' (a : E) : āfun _ : ι => aā ⤠āaā :=
(pi_norm_le_iff_of_nonneg' <| norm_nonneg' _).2 fun _ => le_rfl
@[to_additive pi_nnnorm_const_le]
lemma pi_nnnorm_const_le' (a : E) : āfun _ : ι => aāā ⤠āaāā :=
pi_norm_const_le' _
@[to_additive (attr := simp) pi_norm_const]
lemma pi_norm_const' [Nonempty ι] (a : E) : āfun _i : ι => aā = āaā := by
simpa only [ā dist_one_right] using dist_pi_const a 1
@[to_additive (attr := simp) pi_nnnorm_const]
lemma pi_nnnorm_const' [Nonempty ι] (a : E) : āfun _i : ι => aāā = āaāā :=
NNReal.eq <| pi_norm_const' a
/-- The $L^1$ norm is less than the $L^\infty$ norm scaled by the cardinality. -/
@[to_additive Pi.sum_norm_apply_le_norm /-- The $L^1$ norm is less than the $L^\infty$ norm scaled
by the cardinality. -/]
lemma Pi.sum_norm_apply_le_norm' : ā i, āf iā ⤠Fintype.card ι ⢠āfā :=
Finset.sum_le_card_nsmul _ _ _ fun i _hi => norm_le_pi_norm' _ i
/-- The $L^1$ norm is less than the $L^\infty$ norm scaled by the cardinality. -/
@[to_additive Pi.sum_nnnorm_apply_le_nnnorm /-- The $L^1$ norm is less than the $L^\infty$ norm
scaled by the cardinality. -/]
lemma Pi.sum_nnnorm_apply_le_nnnorm' : ā i, āf iāā ⤠Fintype.card ι ⢠āfāā :=
(NNReal.coe_sum ..).trans_le <| Pi.sum_norm_apply_le_norm' _
end SeminormedGroup
/-- Finite product of seminormed groups, using the sup norm. -/
@[to_additive /-- Finite product of seminormed groups, using the sup norm. -/]
instance Pi.seminormedCommGroup [ā i, SeminormedCommGroup (G i)] : SeminormedCommGroup (ā i, G i) :=
{ Pi.seminormedGroup with
mul_comm := mul_comm }
/-- Finite product of normed groups, using the sup norm. -/
@[to_additive /-- Finite product of seminormed groups, using the sup norm. -/]
instance Pi.normedGroup [ā i, NormedGroup (G i)] : NormedGroup (ā i, G i) :=
{ Pi.seminormedGroup with
eq_of_dist_eq_zero := eq_of_dist_eq_zero }
/-- Finite product of normed groups, using the sup norm. -/
@[to_additive /-- Finite product of seminormed groups, using the sup norm. -/]
instance Pi.normedCommGroup [ā i, NormedCommGroup (G i)] : NormedCommGroup (ā i, G i) :=
{ Pi.seminormedGroup with
mul_comm := mul_comm
eq_of_dist_eq_zero := eq_of_dist_eq_zero }
theorem Pi.nnnorm_single [DecidableEq ι] [ā i, NormedAddCommGroup (G i)] {i : ι} (y : G i) :
āPi.single i yāā = āyāā := by
have H : ā b, āsingle i y bāā = single (M := fun _ ⦠āā„0) i āyāā b := by
intro b
refine Pi.apply_single (fun i (x : G i) ⦠āxāā) ?_ i y b
simp
simp [Pi.nnnorm_def, H, Pi.single_apply, Finset.sup_ite, Finset.filter_eq']
lemma Pi.enorm_single [DecidableEq ι] [ā i, NormedAddCommGroup (G i)] {i : ι} (y : G i) :
āPi.single i yāā = āyāā := by simp [enorm, Pi.nnnorm_single]
theorem Pi.norm_single [DecidableEq ι] [ā i, NormedAddCommGroup (G i)] {i : ι} (y : G i) :
āPi.single i yā = āyā :=
congr_arg Subtype.val <| Pi.nnnorm_single y
end Pi
/-! ### Multiplicative opposite -/
namespace MulOpposite
/-- The (additive) norm on the multiplicative opposite is the same as the norm on the original type.
Note that we do not provide this more generally as `Norm Eįµįµįµ`, as this is not always a good
choice of norm in the multiplicative `SeminormedGroup E` case.
We could repeat this instance to provide a `[SeminormedGroup E] : SeminormedGroup Eįµįµįµ` instance,
but that case would likely never be used.
-/
instance instSeminormedAddGroup [SeminormedAddGroup E] : SeminormedAddGroup Eįµįµįµ where
__ := instPseudoMetricSpace
norm x := āx.unopā
dist_eq _ _ := dist_eq_norm _ _
lemma norm_op [SeminormedAddGroup E] (a : E) : āMulOpposite.op aā = āaā := rfl
lemma norm_unop [SeminormedAddGroup E] (a : Eįµįµįµ) : āMulOpposite.unop aā = āaā := rfl
lemma nnnorm_op [SeminormedAddGroup E] (a : E) : āMulOpposite.op aāā = āaāā := rfl
lemma nnnorm_unop [SeminormedAddGroup E] (a : Eįµįµįµ) : āMulOpposite.unop aāā = āaāā := rfl
instance instNormedAddGroup [NormedAddGroup E] : NormedAddGroup Eįµįµįµ where
__ := instMetricSpace
__ := instSeminormedAddGroup
instance instSeminormedAddCommGroup [SeminormedAddCommGroup E] : SeminormedAddCommGroup Eįµįµįµ where
dist_eq _ _ := dist_eq_norm _ _
instance instNormedAddCommGroup [NormedAddCommGroup E] : NormedAddCommGroup Eįµįµįµ where
__ := instSeminormedAddCommGroup
__ := instNormedAddGroup
end MulOpposite |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Group/Continuity.lean | import Mathlib.Analysis.Normed.Group.Basic
import Mathlib.Topology.Algebra.Ring.Real
import Mathlib.Topology.Metrizable.Uniformity
import Mathlib.Topology.Sequences
/-!
# Continuity of the norm on (semi)groups
## Tags
normed group
-/
variable {š α ι Īŗ E F G : Type*}
open Filter Function Metric Bornology ENNReal NNReal Uniformity Pointwise Topology
section SeminormedGroup
variable [SeminormedGroup E] [SeminormedGroup F] [SeminormedGroup G] {s : Set E} {a : E}
@[to_additive]
theorem tendsto_iff_norm_div_tendsto_zero {f : α ā E} {a : Filter α} {b : E} :
Tendsto f a (š b) ā Tendsto (fun e => āf e / bā) a (š 0) := by
simp only [ā dist_eq_norm_div, ā tendsto_iff_dist_tendsto_zero]
@[to_additive]
theorem tendsto_one_iff_norm_tendsto_zero {f : α ā E} {a : Filter α} :
Tendsto f a (š 1) ā Tendsto (āf Ā·ā) a (š 0) :=
tendsto_iff_norm_div_tendsto_zero.trans <| by simp only [div_one]
@[to_additive (attr := simp 1100)]
theorem comap_norm_nhds_one : comap norm (š 0) = š (1 : E) := by
simpa only [dist_one_right] using nhds_comap_dist (1 : E)
/-- Special case of the sandwich theorem: if the norm of `f` is eventually bounded by a real
function `a` which tends to `0`, then `f` tends to `1` (neutral element of `SeminormedGroup`).
In this pair of lemmas (`squeeze_one_norm'` and `squeeze_one_norm`), following a convention of
similar lemmas in `Topology.MetricSpace.Basic` and `Topology.Algebra.Order`, the `'` version is
phrased using "eventually" and the non-`'` version is phrased absolutely. -/
@[to_additive /-- Special case of the sandwich theorem: if the norm of `f` is eventually bounded by
a real function `a` which tends to `0`, then `f` tends to `0`. In this pair of lemmas
(`squeeze_zero_norm'` and `squeeze_zero_norm`), following a convention of similar lemmas in
`Topology.MetricSpace.Pseudo.Defs` and `Topology.Algebra.Order`, the `'` version is phrased using
"eventually" and the non-`'` version is phrased absolutely. -/]
theorem squeeze_one_norm' {f : α ā E} {a : α ā ā} {tā : Filter α} (h : āį¶ n in tā, āf nā ⤠a n)
(h' : Tendsto a tā (š 0)) : Tendsto f tā (š 1) :=
tendsto_one_iff_norm_tendsto_zero.2 <|
squeeze_zero' (Eventually.of_forall fun _n => norm_nonneg' _) h h'
/-- Special case of the sandwich theorem: if the norm of `f` is bounded by a real function `a` which
tends to `0`, then `f` tends to `1`. -/
@[to_additive /-- Special case of the sandwich theorem: if the norm of `f` is bounded by a real
function `a` which tends to `0`, then `f` tends to `0`. -/]
theorem squeeze_one_norm {f : α ā E} {a : α ā ā} {tā : Filter α} (h : ā n, āf nā ⤠a n) :
Tendsto a tā (š 0) ā Tendsto f tā (š 1) :=
squeeze_one_norm' <| Eventually.of_forall h
@[to_additive]
theorem tendsto_norm_div_self (x : E) : Tendsto (fun a => āa / xā) (š x) (š 0) := by
simpa [dist_eq_norm_div] using
tendsto_id.dist (tendsto_const_nhds : Tendsto (fun _a => (x : E)) (š x) _)
@[to_additive]
theorem tendsto_norm_div_self_nhdsGE (x : E) : Tendsto (fun a ⦠āa / xā) (š x) (š[ā„] 0) :=
tendsto_nhdsWithin_iff.mpr āØtendsto_norm_div_self x, by simpā©
@[to_additive tendsto_norm]
theorem tendsto_norm' {x : E} : Tendsto (fun a => āaā) (š x) (š āxā) := by
simpa using tendsto_id.dist (tendsto_const_nhds : Tendsto (fun _a => (1 : E)) _ _)
/-- See `tendsto_norm_one` for a version with pointed neighborhoods. -/
@[to_additive /-- See `tendsto_norm_zero` for a version with pointed neighborhoods. -/]
theorem tendsto_norm_one : Tendsto (fun a : E => āaā) (š 1) (š 0) := by
simpa using tendsto_norm_div_self (1 : E)
@[to_additive (attr := continuity, fun_prop) continuous_norm]
theorem continuous_norm' : Continuous fun a : E => āaā := by
simpa using continuous_id.dist (continuous_const : Continuous fun _a => (1 : E))
@[to_additive (attr := continuity, fun_prop) continuous_nnnorm]
theorem continuous_nnnorm' : Continuous fun a : E => āaāā :=
continuous_norm'.subtype_mk _
end SeminormedGroup
section Instances
@[to_additive]
instance SeminormedGroup.toContinuousENorm [SeminormedGroup E] : ContinuousENorm E where
continuous_enorm := ENNReal.isOpenEmbedding_coe.continuous.comp continuous_nnnorm'
@[to_additive]
instance NormedGroup.toENormedMonoid {F : Type*} [NormedGroup F] : ENormedMonoid F where
enorm_zero := by simp [enorm_eq_nnnorm]
enorm_eq_zero := by simp [enorm_eq_nnnorm]
enorm_mul_le := by simp [enorm_eq_nnnorm, ā coe_add, nnnorm_mul_le']
@[to_additive]
instance NormedCommGroup.toENormedCommMonoid [NormedCommGroup E] : ENormedCommMonoid E where
__ := NormedGroup.toENormedMonoid
__ := ā¹NormedCommGroup Eāŗ
end Instances
section SeminormedGroup
variable [SeminormedGroup E] [SeminormedGroup F] [SeminormedGroup G] {s : Set E} {a : E}
set_option linter.docPrime false in
@[to_additive Inseparable.norm_eq_norm]
theorem Inseparable.norm_eq_norm' {u v : E} (h : Inseparable u v) : āuā = āvā :=
h.map continuous_norm' |>.eq
set_option linter.docPrime false in
@[to_additive Inseparable.nnnorm_eq_nnnorm]
theorem Inseparable.nnnorm_eq_nnnorm' {u v : E} (h : Inseparable u v) : āuāā = āvāā :=
h.map continuous_nnnorm' |>.eq
@[to_additive Inseparable.enorm_eq_enorm]
theorem Inseparable.enorm_eq_enorm' {E : Type*} [TopologicalSpace E] [ContinuousENorm E]
{u v : E} (h : Inseparable u v) : āuāā = āvāā :=
h.map continuous_enorm |>.eq
@[to_additive]
theorem mem_closure_one_iff_norm {x : E} : x ā closure ({1} : Set E) ā āxā = 0 := by
rw [ā closedBall_zero', mem_closedBall_one_iff, (norm_nonneg' x).ge_iff_eq']
@[to_additive]
theorem closure_one_eq : closure ({1} : Set E) = { x | āxā = 0 } :=
Set.ext fun _x => mem_closure_one_iff_norm
section
variable {l : Filter α} {f : α ā E}
@[to_additive Filter.Tendsto.norm]
theorem Filter.Tendsto.norm' (h : Tendsto f l (š a)) : Tendsto (fun x => āf xā) l (š āaā) :=
tendsto_norm'.comp h
@[to_additive Filter.Tendsto.nnnorm]
theorem Filter.Tendsto.nnnorm' (h : Tendsto f l (š a)) : Tendsto (fun x => āf xāā) l (š āaāā) :=
Tendsto.comp continuous_nnnorm'.continuousAt h
end
section
variable [TopologicalSpace α] {f : α ā E} {s : Set α} {a : α}
@[to_additive (attr := fun_prop) Continuous.norm]
theorem Continuous.norm' : Continuous f ā Continuous fun x => āf xā :=
continuous_norm'.comp
@[to_additive (attr := fun_prop) Continuous.nnnorm]
theorem Continuous.nnnorm' : Continuous f ā Continuous fun x => āf xāā :=
continuous_nnnorm'.comp
end
end SeminormedGroup
section ContinuousENorm
variable [TopologicalSpace E] [ContinuousENorm E] {a : E} {l : Filter α} {f : α ā E}
@[to_additive Filter.Tendsto.enorm]
lemma Filter.Tendsto.enorm' (h : Tendsto f l (š a)) : Tendsto (āf Ā·āā) l (š āaāā) :=
.comp continuous_enorm.continuousAt h
end ContinuousENorm
section SeminormedGroup
variable [SeminormedGroup E] [SeminormedGroup F] [SeminormedGroup G] {s : Set E} {a : E}
section
variable [TopologicalSpace α] {f : α ā E} {s : Set α} {a : α}
@[to_additive (attr := fun_prop) ContinuousAt.norm]
theorem ContinuousAt.norm' {a : α} (h : ContinuousAt f a) : ContinuousAt (fun x => āf xā) a :=
Tendsto.norm' h
@[to_additive (attr := fun_prop) ContinuousAt.nnnorm]
theorem ContinuousAt.nnnorm' {a : α} (h : ContinuousAt f a) : ContinuousAt (fun x => āf xāā) a :=
Tendsto.nnnorm' h
@[to_additive ContinuousWithinAt.norm]
theorem ContinuousWithinAt.norm' {s : Set α} {a : α} (h : ContinuousWithinAt f s a) :
ContinuousWithinAt (fun x => āf xā) s a :=
Tendsto.norm' h
@[to_additive ContinuousWithinAt.nnnorm]
theorem ContinuousWithinAt.nnnorm' {s : Set α} {a : α} (h : ContinuousWithinAt f s a) :
ContinuousWithinAt (fun x => āf xāā) s a :=
Tendsto.nnnorm' h
@[to_additive (attr := fun_prop) ContinuousOn.norm]
theorem ContinuousOn.norm' {s : Set α} (h : ContinuousOn f s) : ContinuousOn (fun x => āf xā) s :=
fun x hx => (h x hx).norm'
@[to_additive (attr := fun_prop) ContinuousOn.nnnorm]
theorem ContinuousOn.nnnorm' {s : Set α} (h : ContinuousOn f s) :
ContinuousOn (fun x => āf xāā) s := fun x hx => (h x hx).nnnorm'
end
/-- If `āyā ā ā`, then we can assume `y ā x` for any fixed `x`. -/
@[to_additive eventually_ne_of_tendsto_norm_atTop /-- If `āyāāā`, then we can assume `yā x` for any
fixed `x` -/]
theorem eventually_ne_of_tendsto_norm_atTop' {l : Filter α} {f : α ā E}
(h : Tendsto (fun y => āf yā) l atTop) (x : E) : āį¶ y in l, f y ā x :=
(h.eventually_ne_atTop _).mono fun _x => ne_of_apply_ne norm
@[to_additive]
theorem SeminormedCommGroup.mem_closure_iff :
a ā closure s ā ā ε, 0 < ε ā ā b ā s, āa / bā < ε := by
simp [Metric.mem_closure_iff, dist_eq_norm_div]
@[to_additive]
theorem SeminormedGroup.tendstoUniformlyOn_one {f : ι ā Īŗ ā G} {s : Set Īŗ} {l : Filter ι} :
TendstoUniformlyOn f 1 l s ā ā ε > 0, āį¶ i in l, ā x ā s, āf i xā < ε := by
simp only [tendstoUniformlyOn_iff, Pi.one_apply, dist_one_left]
@[to_additive]
theorem SeminormedGroup.uniformCauchySeqOnFilter_iff_tendstoUniformlyOnFilter_one {f : ι ā Īŗ ā G}
{l : Filter ι} {l' : Filter κ} :
UniformCauchySeqOnFilter f l l' ā
TendstoUniformlyOnFilter (fun n : ι à ι => fun z => f n.fst z / f n.snd z) 1 (l ĆĖ¢ l) l' := by
refine āØfun hf u hu => ?_, fun hf u hu => ?_ā©
Ā· obtain āØĪµ, hε, Hā© := uniformity_basis_dist.mem_uniformity_iff.mp hu
refine
(hf { p : G à G | dist p.fst p.snd < ε } <| dist_mem_uniformity hε).mono fun x hx =>
H 1 (f x.fst.fst x.snd / f x.fst.snd x.snd) ?_
simpa [dist_eq_norm_div, norm_div_rev] using hx
Ā· obtain āØĪµ, hε, Hā© := uniformity_basis_dist.mem_uniformity_iff.mp hu
refine
(hf { p : G à G | dist p.fst p.snd < ε } <| dist_mem_uniformity hε).mono fun x hx =>
H (f x.fst.fst x.snd) (f x.fst.snd x.snd) ?_
simpa [dist_eq_norm_div, norm_div_rev] using hx
@[to_additive]
theorem SeminormedGroup.uniformCauchySeqOn_iff_tendstoUniformlyOn_one {f : ι ā Īŗ ā G} {s : Set Īŗ}
{l : Filter ι} :
UniformCauchySeqOn f l s ā
TendstoUniformlyOn (fun n : ι à ι => fun z => f n.fst z / f n.snd z) 1 (l ĆĖ¢ l) s := by
rw [tendstoUniformlyOn_iff_tendstoUniformlyOnFilter,
uniformCauchySeqOn_iff_uniformCauchySeqOnFilter,
SeminormedGroup.uniformCauchySeqOnFilter_iff_tendstoUniformlyOnFilter_one]
end SeminormedGroup
section SeminormedCommGroup
variable [SeminormedCommGroup E] [SeminormedCommGroup F] {a b : E} {r : ā}
open Finset
@[to_additive]
theorem controlled_prod_of_mem_closure {s : Subgroup E} (hg : a ā closure (s : Set E)) {b : ā ā ā}
(b_pos : ā n, 0 < b n) :
ā v : ā ā E,
Tendsto (fun n => ā i ā range (n + 1), v i) atTop (š a) ā§
(ā n, v n ā s) ā§ āv 0 / aā < b 0 ā§ ā n, 0 < n ā āv nā < b n := by
obtain āØu : ā ā E, u_in : ā n, u n ā s, lim_u : Tendsto u atTop (š a)ā© :=
mem_closure_iff_seq_limit.mp hg
obtain āØnā, hnāā© : ā nā, ā n ā„ nā, āu n / aā < b 0 :=
haveI : { x | āx / aā < b 0 } ā š a := by
simp_rw [ā dist_eq_norm_div]
exact Metric.ball_mem_nhds _ (b_pos _)
Filter.tendsto_atTop'.mp lim_u _ this
set z : ā ā E := fun n => u (n + nā)
have lim_z : Tendsto z atTop (š a) := lim_u.comp (tendsto_add_atTop_nat nā)
have mem_š¤ : ā n, { p : E Ć E | āp.1 / p.2ā < b (n + 1) } ā š¤ E := fun n => by
simpa [ā dist_eq_norm_div] using Metric.dist_mem_uniformity (b_pos <| n + 1)
obtain āØĻ : ā ā ā, Ļ_extr : StrictMono Ļ, hĻ : ā n, āz (Ļ <| n + 1) / z (Ļ n)ā < b (n + 1)ā© :=
lim_z.cauchySeq.subseq_mem mem_š¤
set w : ā ā E := z ā Ļ
have hw : Tendsto w atTop (š a) := lim_z.comp Ļ_extr.tendsto_atTop
set v : ā ā E := fun i => if i = 0 then w 0 else w i / w (i - 1)
refine āØv, Tendsto.congr (Finset.eq_prod_range_div' w) hw, ?_, hnā _ (nā.le_add_left _), ?_ā©
Ā· rintro āØā©
Ā· change w 0 ā s
apply u_in
Ā· apply s.div_mem <;> apply u_in
Ā· intro l hl
obtain āØk, rflā© : ā k, l = k + 1 := Nat.exists_eq_succ_of_ne_zero hl.ne'
apply hĻ
@[to_additive]
theorem controlled_prod_of_mem_closure_range {j : E ā* F} {b : F}
(hb : b ā closure (j.range : Set F)) {f : ā ā ā} (b_pos : ā n, 0 < f n) :
ā a : ā ā E,
Tendsto (fun n => ā i ā range (n + 1), j (a i)) atTop (š b) ā§
āj (a 0) / bā < f 0 ā§ ā n, 0 < n ā āj (a n)ā < f n := by
obtain āØv, sum_v, v_in, hvā, hv_posā© := controlled_prod_of_mem_closure hb b_pos
choose g hg using v_in
exact
āØg, by simpa [ā hg] using sum_v, by simpa [hg 0] using hvā,
fun n hn => by simpa [hg] using hv_pos n hnā©
end SeminormedCommGroup
section NormedGroup
variable [NormedGroup E] {a b : E}
/-- See `tendsto_norm_one` for a version with full neighborhoods. -/
@[to_additive /-- See `tendsto_norm_zero` for a version with full neighborhoods. -/]
lemma tendsto_norm_nhdsNE_one : Tendsto (norm : E ā ā) (š[ā ] 1) (š[>] 0) :=
tendsto_norm_one.inf <| tendsto_principal_principal.2 fun _ hx ⦠norm_pos_iff'.2 hx
@[to_additive]
theorem tendsto_norm_div_self_nhdsNE (a : E) : Tendsto (fun x => āx / aā) (š[ā ] a) (š[>] 0) :=
(tendsto_norm_div_self a).inf <|
tendsto_principal_principal.2 fun _x hx => norm_pos_iff'.2 <| div_ne_one.2 hx
variable (E)
/-- A version of `comap_norm_nhdsGT_zero` for a multiplicative normed group. -/
@[to_additive comap_norm_nhdsGT_zero]
lemma comap_norm_nhdsGT_zero' : comap norm (š[>] 0) = š[ā ] (1 : E) := by
simp [nhdsWithin, comap_norm_nhds_one, Set.preimage, Set.compl_def]
end NormedGroup |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Group/Completeness.lean | import Mathlib.Analysis.Normed.Group.Uniform
import Mathlib.Analysis.SpecificLimits.Basic
/-!
# Completeness of normed groups
This file includes a completeness criterion for normed additive groups in terms of convergent
series.
## Main results
* `NormedAddCommGroup.completeSpace_of_summable_imp_tendsto`: A normed additive group is
complete if any absolutely convergent series converges in the space.
## References
* [bergh_lofstrom_1976] `NormedAddCommGroup.completeSpace_of_summable_imp_tendsto` and
`NormedAddCommGroup.summable_imp_tendsto_of_complete` correspond to the two directions of
Lemma 2.2.1.
## Tags
CompleteSpace, CauchySeq
-/
open scoped Topology
open Filter Finset
section Metric
variable {α : Type*} [PseudoMetricSpace α]
lemma Metric.exists_subseq_summable_dist_of_cauchySeq (u : ā ā α) (hu : CauchySeq u) :
ā f : ā ā ā, StrictMono f ā§ Summable fun i => dist (u (f (i+1))) (u (f i)) := by
obtain āØf, hfā, hfāā© := Metric.exists_subseq_bounded_of_cauchySeq u hu
(fun n => (1 / (2 : ā))^n) (fun n => by positivity)
refine āØf, hfā, ?_ā©
refine Summable.of_nonneg_of_le (fun n => by positivity) ?_ summable_geometric_two
exact fun n => le_of_lt <| hfā n (f (n + 1)) <| hfā.monotone (Nat.le_add_right n 1)
end Metric
section Normed
variable {E : Type*} [NormedAddCommGroup E]
/-- A normed additive group is complete if any absolutely convergent series converges in the
space. -/
lemma NormedAddCommGroup.completeSpace_of_summable_imp_tendsto
(h : ā u : ā ā E,
Summable (āu Ā·ā) ā ā a, Tendsto (fun n => ā i ā range n, u i) atTop (š a)) :
CompleteSpace E := by
apply Metric.complete_of_cauchySeq_tendsto
intro u hu
obtain āØf, hfā, hfāā© := Metric.exists_subseq_summable_dist_of_cauchySeq u hu
simp only [dist_eq_norm] at hfā
let v n := u (f (n + 1)) - u (f n)
have hv_sum : (fun n => (ā i ā range n, v i)) = fun n => u (f n) - u (f 0) := by
ext n
exact sum_range_sub (u ā f) n
obtain āØa, haā© := h v hfā
refine āØa + u (f 0), ?_ā©
refine tendsto_nhds_of_cauchySeq_of_subseq hu hfā.tendsto_atTop ?_
rw [hv_sum] at ha
have hā : Tendsto (fun n => u (f n) - u (f 0) + u (f 0)) atTop (š (a + u (f 0))) :=
Tendsto.add_const _ ha
simpa only [sub_add_cancel] using hā
/-- In a complete normed additive group, every absolutely convergent series converges in the
space. -/
lemma NormedAddCommGroup.summable_imp_tendsto_of_complete [CompleteSpace E] (u : ā ā E)
(hu : Summable (āu Ā·ā)) : ā a, Tendsto (fun n => ā i ā range n, u i) atTop (š a) := by
refine cauchySeq_tendsto_of_complete <| cauchySeq_of_summable_dist ?_
simp [dist_eq_norm, sum_range_succ, hu]
/-- In a normed additive group, every absolutely convergent series converges in the
space iff the space is complete. -/
lemma NormedAddCommGroup.summable_imp_tendsto_iff_completeSpace :
(ā u : ā ā E, Summable (āu Ā·ā) ā ā a, Tendsto (fun n => ā i ā range n, u i) atTop (š a))
ā CompleteSpace E :=
āØcompleteSpace_of_summable_imp_tendsto, fun _ u hu => summable_imp_tendsto_of_complete u huā©
end Normed |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Group/Subgroup.lean | import Mathlib.Algebra.Group.Subgroup.Defs
import Mathlib.Analysis.Normed.Group.Basic
/-!
# Subgroups of normed (semi)groups
In this file, we prove that subgroups of a normed (semi)group are also normed (semi)groups.
## Tags
normed group
-/
open Filter Function Metric Bornology
open ENNReal Filter NNReal Uniformity Pointwise Topology
/-! ### Subgroups of normed groups -/
variable {E : Type*}
namespace Subgroup
section SeminormedGroup
variable [SeminormedGroup E] {s : Subgroup E}
/-- A subgroup of a seminormed group is also a seminormed group,
with the restriction of the norm. -/
@[to_additive /-- A subgroup of a seminormed group is also a seminormed group, with the restriction
of the norm. -/]
instance seminormedGroup : SeminormedGroup s :=
SeminormedGroup.induced _ _ s.subtype
/-- If `x` is an element of a subgroup `s` of a seminormed group `E`, its norm in `s` is equal to
its norm in `E`. -/
@[to_additive (attr := simp) /-- If `x` is an element of a subgroup `s` of a seminormed group `E`,
its norm in `s` is equal to its norm in `E`. -/]
theorem coe_norm (x : s) : āxā = ā(x : E)ā :=
rfl
/-- If `x` is an element of a subgroup `s` of a seminormed group `E`, its norm in `s` is equal to
its norm in `E`.
This is a reversed version of the `simp` lemma `Subgroup.coe_norm` for use by `norm_cast`. -/
@[to_additive (attr := norm_cast) /-- If `x` is an element of a subgroup `s` of a seminormed group
`E`, its norm in `s` is equal to its norm in `E`.
This is a reversed version of the `simp` lemma `AddSubgroup.coe_norm` for use by `norm_cast`. -/]
theorem norm_coe {s : Subgroup E} (x : s) : ā(x : E)ā = āxā :=
rfl
end SeminormedGroup
@[to_additive]
instance seminormedCommGroup [SeminormedCommGroup E] {s : Subgroup E} : SeminormedCommGroup s :=
SeminormedCommGroup.induced _ _ s.subtype
@[to_additive]
instance normedGroup [NormedGroup E] {s : Subgroup E} : NormedGroup s :=
NormedGroup.induced _ _ s.subtype Subtype.coe_injective
@[to_additive]
instance normedCommGroup [NormedCommGroup E] {s : Subgroup E} : NormedCommGroup s :=
NormedCommGroup.induced _ _ s.subtype Subtype.coe_injective
end Subgroup
/-! ### Subgroup classes of normed groups -/
namespace SubgroupClass
section SeminormedGroup
variable [SeminormedGroup E] {S : Type*} [SetLike S E] [SubgroupClass S E] (s : S)
/-- A subgroup of a seminormed group is also a seminormed group,
with the restriction of the norm. -/
@[to_additive /-- A subgroup of a seminormed additive group is also a seminormed additive group,
with the restriction of the norm. -/]
instance (priority := 75) seminormedGroup : SeminormedGroup s :=
SeminormedGroup.induced _ _ (SubgroupClass.subtype s)
/-- If `x` is an element of a subgroup `s` of a seminormed group `E`, its norm in `s` is equal to
its norm in `E`. -/
@[to_additive (attr := simp) /-- If `x` is an element of an additive subgroup `s` of a seminormed
additive group `E`, its norm in `s` is equal to its norm in `E`. -/]
theorem coe_norm (x : s) : āxā = ā(x : E)ā :=
rfl
end SeminormedGroup
@[to_additive]
instance (priority := 75) seminormedCommGroup [SeminormedCommGroup E] {S : Type*} [SetLike S E]
[SubgroupClass S E] (s : S) : SeminormedCommGroup s :=
SeminormedCommGroup.induced _ _ (SubgroupClass.subtype s)
@[to_additive]
instance (priority := 75) normedGroup [NormedGroup E] {S : Type*} [SetLike S E] [SubgroupClass S E]
(s : S) : NormedGroup s :=
NormedGroup.induced _ _ (SubgroupClass.subtype s) Subtype.coe_injective
@[to_additive]
instance (priority := 75) normedCommGroup [NormedCommGroup E] {S : Type*} [SetLike S E]
[SubgroupClass S E] (s : S) : NormedCommGroup s :=
NormedCommGroup.induced _ _ (SubgroupClass.subtype s) Subtype.coe_injective
end SubgroupClass |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Group/Submodule.lean | import Mathlib.Algebra.Module.Submodule.LinearMap
import Mathlib.Analysis.Normed.Group.Basic
/-! # Submodules of normed groups -/
variable {š E : Type*}
namespace Submodule
/-- A submodule of a seminormed group is also a seminormed group, with the restriction of the norm.
-/
instance seminormedAddCommGroup [Ring š] [SeminormedAddCommGroup E] [Module š E]
(s : Submodule š E) : SeminormedAddCommGroup s :=
SeminormedAddCommGroup.induced _ _ s.subtype.toAddMonoidHom
/-- If `x` is an element of a submodule `s` of a normed group `E`, its norm in `s` is equal to its
norm in `E`. -/
@[simp]
theorem coe_norm [Ring š] [SeminormedAddCommGroup E] [Module š E] {s : Submodule š E}
(x : s) : āxā = ā(x : E)ā :=
rfl
/-- If `x` is an element of a submodule `s` of a normed group `E`, its norm in `E` is equal to its
norm in `s`.
This is a reversed version of the `simp` lemma `Submodule.coe_norm` for use by `norm_cast`. -/
@[norm_cast]
theorem norm_coe [Ring š] [SeminormedAddCommGroup E] [Module š E] {s : Submodule š E}
(x : s) : ā(x : E)ā = āxā :=
rfl
/-- A submodule of a normed group is also a normed group, with the restriction of the norm. -/
instance normedAddCommGroup [Ring š] [NormedAddCommGroup E] [Module š E]
(s : Submodule š E) : NormedAddCommGroup s :=
{ Submodule.seminormedAddCommGroup s with
eq_of_dist_eq_zero := eq_of_dist_eq_zero }
end Submodule |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Group/Bounded.lean | import Mathlib.Analysis.Normed.Group.Continuity
import Mathlib.Topology.MetricSpace.Bounded
import Mathlib.Order.Filter.Pointwise
/-!
# Boundedness in normed groups
This file rephrases metric boundedness in terms of norms.
## Tags
normed group
-/
open Filter Metric Bornology
open scoped Pointwise Topology
variable {α E F G : Type*}
section SeminormedGroup
variable [SeminormedGroup E] [SeminormedGroup F] [SeminormedGroup G] {s : Set E}
@[to_additive (attr := simp) comap_norm_atTop]
lemma comap_norm_atTop' : comap norm atTop = cobounded E := by
simpa only [dist_one_right] using comap_dist_right_atTop (1 : E)
@[to_additive Filter.HasBasis.cobounded_of_norm]
lemma Filter.HasBasis.cobounded_of_norm' {ι : Sort*} {p : ι ā Prop} {s : ι ā Set ā}
(h : HasBasis atTop p s) : HasBasis (cobounded E) p fun i ⦠norm ā»Ā¹' s i :=
comap_norm_atTop' (E := E) āø h.comap _
@[to_additive Filter.hasBasis_cobounded_norm]
lemma Filter.hasBasis_cobounded_norm' : HasBasis (cobounded E) (fun _ ⦠True) ({x | Ā· ⤠āxā}) :=
atTop_basis.cobounded_of_norm'
@[to_additive (attr := simp) tendsto_norm_atTop_iff_cobounded]
lemma tendsto_norm_atTop_iff_cobounded' {f : α ā E} {l : Filter α} :
Tendsto (āf Ā·ā) l atTop ā Tendsto f l (cobounded E) := by
rw [ā comap_norm_atTop', tendsto_comap_iff]; rfl
@[to_additive tendsto_norm_cobounded_atTop]
lemma tendsto_norm_cobounded_atTop' : Tendsto norm (cobounded E) atTop :=
tendsto_norm_atTop_iff_cobounded'.2 tendsto_id
@[to_additive eventually_cobounded_le_norm]
lemma eventually_cobounded_le_norm' (a : ā) : āį¶ x in cobounded E, a ⤠āxā :=
tendsto_norm_cobounded_atTop'.eventually_ge_atTop a
@[to_additive tendsto_norm_cocompact_atTop]
lemma tendsto_norm_cocompact_atTop' [ProperSpace E] : Tendsto norm (cocompact E) atTop :=
cobounded_eq_cocompact (α := E) ⸠tendsto_norm_cobounded_atTop'
@[to_additive (attr := simp)]
lemma Filter.inv_cobounded : (cobounded E)ā»Ā¹ = cobounded E := by
simp only [ā comap_norm_atTop', ā Filter.comap_inv, comap_comap, Function.comp_def, norm_inv']
/-- In a (semi)normed group, inversion `x ⦠xā»Ā¹` tends to infinity at infinity. -/
@[to_additive /-- In a (semi)normed group, negation `x ⦠-x` tends to infinity at infinity. -/]
theorem Filter.tendsto_inv_cobounded : Tendsto Inv.inv (cobounded E) (cobounded E) :=
inv_cobounded.le
@[to_additive isBounded_iff_forall_norm_le]
lemma isBounded_iff_forall_norm_le' : Bornology.IsBounded s ā ā C, ā x ā s, āxā ⤠C := by
simpa only [Set.subset_def, mem_closedBall_one_iff] using isBounded_iff_subset_closedBall (1 : E)
alias āØBornology.IsBounded.exists_norm_le', _ā© := isBounded_iff_forall_norm_le'
alias āØBornology.IsBounded.exists_norm_le, _ā© := isBounded_iff_forall_norm_le
attribute [to_additive existing exists_norm_le] Bornology.IsBounded.exists_norm_le'
@[to_additive exists_pos_norm_le]
lemma Bornology.IsBounded.exists_pos_norm_le' (hs : IsBounded s) : ā R > 0, ā x ā s, āxā ⤠R :=
let āØRā, hRāā© := hs.exists_norm_le'
āØmax Rā 1, by positivity, fun x hx => (hRā x hx).trans <| le_max_left _ _ā©
@[to_additive Bornology.IsBounded.exists_pos_norm_lt]
lemma Bornology.IsBounded.exists_pos_norm_lt' (hs : IsBounded s) : ā R > 0, ā x ā s, āxā < R :=
let āØR, hRā, hRā© := hs.exists_pos_norm_le'
āØR + 1, by positivity, fun x hx ⦠(hR x hx).trans_lt (lt_add_one _)ā©
@[to_additive]
lemma NormedCommGroup.cauchySeq_iff [Nonempty α] [SemilatticeSup α] {u : α ā E} :
CauchySeq u ā ā ε > 0, ā N, ā m, N ⤠m ā ā n, N ⤠n ā āu m / u nā < ε := by
simp [Metric.cauchySeq_iff, dist_eq_norm_div]
@[to_additive IsCompact.exists_bound_of_continuousOn]
lemma IsCompact.exists_bound_of_continuousOn' [TopologicalSpace α] {s : Set α} (hs : IsCompact s)
{f : α ā E} (hf : ContinuousOn f s) : ā C, ā x ā s, āf xā ⤠C :=
(isBounded_iff_forall_norm_le'.1 (hs.image_of_continuousOn hf).isBounded).imp fun _C hC _x hx =>
hC _ <| Set.mem_image_of_mem _ hx
@[to_additive]
lemma HasCompactMulSupport.exists_bound_of_continuous [TopologicalSpace α]
{f : α ā E} (hf : HasCompactMulSupport f) (h'f : Continuous f) : ā C, ā x, āf xā ⤠C := by
simpa using (hf.isCompact_range h'f).isBounded.exists_norm_le'
/-- A helper lemma used to prove that the (scalar or usual) product of a function that tends to one
and a bounded function tends to one. This lemma is formulated for any binary operation
`op : E ā F ā G` with an estimate `āop x yā ⤠A * āxā * āyā` for some constant A instead of
multiplication so that it can be applied to `(*)`, `flip (*)`, `(ā¢)`, and `flip (ā¢)`. -/
@[to_additive /-- A helper lemma used to prove that the (scalar or usual) product of a function that
tends to zero and a bounded function tends to zero. This lemma is formulated for any binary
operation `op : E ā F ā G` with an estimate `āop x yā ⤠A * āxā * āyā` for some constant A instead
of multiplication so that it can be applied to `(*)`, `flip (*)`, `(ā¢)`, and `flip (ā¢)`. -/]
lemma Filter.Tendsto.op_one_isBoundedUnder_le' {f : α ā E} {g : α ā F} {l : Filter α}
(hf : Tendsto f l (š 1)) (hg : IsBoundedUnder (Ā· ⤠·) l (Norm.norm ā g)) (op : E ā F ā G)
(h_op : ā A, ā x y, āop x yā ⤠A * āxā * āyā) : Tendsto (fun x => op (f x) (g x)) l (š 1) := by
obtain āØA, h_opā© := h_op
rcases hg with āØC, hCā©; rw [eventually_map] at hC
rw [NormedCommGroup.tendsto_nhds_one] at hf ā¢
intro ε εā
rcases exists_pos_mul_lt εā (A * C) with āØĪ“, Ī“ā, hĪ“ā©
filter_upwards [hf Ī“ Ī“ā, hC] with i hf hg
refine (h_op _ _).trans_lt ?_
rcases le_total A 0 with hA | hA
Ā· exact (mul_nonpos_of_nonpos_of_nonneg (mul_nonpos_of_nonpos_of_nonneg hA <| norm_nonneg' _) <|
norm_nonneg' _).trans_lt εā
calc
A * āf iā * āg iā ⤠A * Ī“ * C := by gcongr; exact hg
_ = A * C * Ī“ := mul_right_comm _ _ _
_ < ε := hΓ
/-- A helper lemma used to prove that the (scalar or usual) product of a function that tends to one
and a bounded function tends to one. This lemma is formulated for any binary operation
`op : E ā F ā G` with an estimate `āop x yā ⤠āxā * āyā` instead of multiplication so that it
can be applied to `(*)`, `flip (*)`, `(ā¢)`, and `flip (ā¢)`. -/
@[to_additive /-- A helper lemma used to prove that the (scalar or usual) product of a function that
tends to zero and a bounded function tends to zero. This lemma is formulated for any binary
operation `op : E ā F ā G` with an estimate `āop x yā ⤠āxā * āyā` instead of multiplication so
that it can be applied to `(*)`, `flip (*)`, `(ā¢)`, and `flip (ā¢)`. -/]
theorem Filter.Tendsto.op_one_isBoundedUnder_le {f : α ā E} {g : α ā F} {l : Filter α}
(hf : Tendsto f l (š 1)) (hg : IsBoundedUnder (Ā· ⤠·) l (Norm.norm ā g)) (op : E ā F ā G)
(h_op : ā x y, āop x yā ⤠āxā * āyā) : Tendsto (fun x => op (f x) (g x)) l (š 1) :=
hf.op_one_isBoundedUnder_le' hg op āØ1, fun x y => (one_mul āxā).symm āø h_op x yā©
@[to_additive tendsto_norm_comp_cofinite_atTop_of_isClosedEmbedding]
lemma tendsto_norm_comp_cofinite_atTop_of_isClosedEmbedding' {X : Type*} [TopologicalSpace X]
[DiscreteTopology X] [ProperSpace E] {e : X ā E}
(he : Topology.IsClosedEmbedding e) : Tendsto (norm ā e) cofinite atTop := by
rw [ā Filter.cocompact_eq_cofinite X]
apply tendsto_norm_cocompact_atTop'.comp (Topology.IsClosedEmbedding.tendsto_cocompact he)
end SeminormedGroup
section NormedAddGroup
variable [NormedAddGroup E] [TopologicalSpace α] {f : α ā E}
lemma Continuous.bounded_above_of_compact_support (hf : Continuous f) (h : HasCompactSupport f) :
ā C, ā x, āf xā ⤠C := by
simpa [bddAbove_def] using hf.norm.bddAbove_range_of_hasCompactSupport h.norm
end NormedAddGroup
section NormedAddGroupSource
variable [NormedAddGroup α] {f : α ā E}
@[to_additive]
lemma HasCompactMulSupport.exists_pos_le_norm [One E] (hf : HasCompactMulSupport f) :
ā R : ā, 0 < R ā§ ā x : α, R ⤠āxā ā f x = 1 := by
obtain āØK, āØhK1, hK2ā©ā© := exists_compact_iff_hasCompactMulSupport.mpr hf
obtain āØS, hS, hS'ā© := hK1.isBounded.exists_pos_norm_le
refine āØS + 1, by positivity, fun x hx => hK2 x ((mt <| hS' x) ?_)ā©
contrapose! hx
exact lt_add_of_le_of_pos hx zero_lt_one
end NormedAddGroupSource |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Group/SemiNormedGrp.lean | import Mathlib.Analysis.Normed.Group.Constructions
import Mathlib.Analysis.Normed.Group.Hom
import Mathlib.CategoryTheory.Limits.Shapes.ZeroMorphisms
import Mathlib.CategoryTheory.Elementwise
/-!
# The category of seminormed groups
We define `SemiNormedGrp`, the category of seminormed groups and normed group homs between
them, as well as `SemiNormedGrpā`, the subcategory of norm non-increasing morphisms.
-/
noncomputable section
universe u
open CategoryTheory
/-- The category of seminormed abelian groups and bounded group homomorphisms. -/
structure SemiNormedGrp : Type (u + 1) where
/-- Construct a bundled `SemiNormedGrp` from the underlying type and typeclass. -/
of ::
/-- The underlying seminormed abelian group. -/
carrier : Type u
[str : SeminormedAddCommGroup carrier]
attribute [instance] SemiNormedGrp.str
namespace SemiNormedGrp
instance : CoeSort SemiNormedGrp Type* where
coe X := X.carrier
/-- The type of morphisms in `SemiNormedGrp` -/
@[ext]
structure Hom (M N : SemiNormedGrp.{u}) where
/-- The underlying `NormedAddGroupHom`. -/
hom' : NormedAddGroupHom M N
instance : LargeCategory.{u} SemiNormedGrp where
Hom X Y := Hom X Y
id X := āØNormedAddGroupHom.id Xā©
comp f g := āØg.hom'.comp f.hom'ā©
instance : ConcreteCategory SemiNormedGrp (NormedAddGroupHom Ā· Ā·) where
hom f := f.hom'
ofHom f := āØfā©
/-- Turn a morphism in `SemiNormedGrp` back into a `NormedAddGroupHom`. -/
abbrev Hom.hom {M N : SemiNormedGrp.{u}} (f : Hom M N) :=
ConcreteCategory.hom (C := SemiNormedGrp) f
/-- Typecheck a `NormedAddGroupHom` as a morphism in `SemiNormedGrp`. -/
abbrev ofHom {M N : Type u} [SeminormedAddCommGroup M] [SeminormedAddCommGroup N]
(f : NormedAddGroupHom M N) : of M ā¶ of N :=
ConcreteCategory.ofHom (C := SemiNormedGrp) f
/-- Use the `ConcreteCategory.hom` projection for `@[simps]` lemmas. -/
def Hom.Simps.hom (M N : SemiNormedGrp.{u}) (f : Hom M N) :=
f.hom
initialize_simps_projections Hom (hom' ā hom)
/-!
The results below duplicate the `ConcreteCategory` simp lemmas, but we can keep them for `dsimp`.
-/
@[ext]
lemma ext {M N : SemiNormedGrp} {fā fā : M ā¶ N} (h : ā (x : M), fā x = fā x) : fā = fā :=
ConcreteCategory.ext_apply h
@[simp]
lemma hom_id {M : SemiNormedGrp} : (š M : M ā¶ M).hom = NormedAddGroupHom.id M := rfl
/- Provided for rewriting. -/
lemma id_apply (M : SemiNormedGrp) (r : M) :
(š M : M ā¶ M) r = r := by simp
@[simp]
lemma hom_comp {M N O : SemiNormedGrp} (f : M ā¶ N) (g : N ā¶ O) :
(f ā« g).hom = g.hom.comp f.hom := rfl
/- Provided for rewriting. -/
lemma comp_apply {M N O : SemiNormedGrp} (f : M ā¶ N) (g : N ā¶ O) (r : M) :
(f ā« g) r = g (f r) := by simp
@[ext]
lemma hom_ext {M N : SemiNormedGrp} {f g : M ā¶ N} (hf : f.hom = g.hom) : f = g :=
Hom.ext hf
@[simp]
lemma hom_ofHom {M N : Type u} [SeminormedAddCommGroup M] [SeminormedAddCommGroup N]
(f : NormedAddGroupHom M N) : (ofHom f).hom = f := rfl
@[simp]
lemma ofHom_hom {M N : SemiNormedGrp} (f : M ā¶ N) :
ofHom (Hom.hom f) = f := rfl
@[simp]
lemma ofHom_id {M : Type u} [SeminormedAddCommGroup M] :
ofHom (NormedAddGroupHom.id M) = š (of M) := rfl
@[simp]
lemma ofHom_comp {M N O : Type u} [SeminormedAddCommGroup M] [SeminormedAddCommGroup N]
[SeminormedAddCommGroup O] (f : NormedAddGroupHom M N) (g : NormedAddGroupHom N O) :
ofHom (g.comp f) = ofHom f ā« ofHom g :=
rfl
lemma ofHom_apply {M N : Type u} [SeminormedAddCommGroup M] [SeminormedAddCommGroup N]
(f : NormedAddGroupHom M N) (r : M) : ofHom f r = f r := rfl
lemma inv_hom_apply {M N : SemiNormedGrp} (e : M ā
N) (r : M) : e.inv (e.hom r) = r := by
simp
lemma hom_inv_apply {M N : SemiNormedGrp} (e : M ā
N) (s : N) : e.hom (e.inv s) = s := by
simp
theorem coe_of (V : Type u) [SeminormedAddCommGroup V] : (SemiNormedGrp.of V : Type u) = V :=
rfl
theorem coe_id (V : SemiNormedGrp) : (š V : V ā V) = id :=
rfl
theorem coe_comp {M N K : SemiNormedGrp} (f : M ā¶ N) (g : N ā¶ K) :
(f ā« g : M ā K) = g ā f :=
rfl
instance : Inhabited SemiNormedGrp :=
āØof PUnitā©
instance {M N : SemiNormedGrp} : Zero (M ā¶ N) where
zero := ofHom 0
@[simp]
theorem hom_zero {V W : SemiNormedGrp} : (0 : V ā¶ W).hom = 0 :=
rfl
theorem zero_apply {V W : SemiNormedGrp} (x : V) : (0 : V ā¶ W) x = 0 :=
rfl
instance : Limits.HasZeroMorphisms.{u, u + 1} SemiNormedGrp where
theorem isZero_of_subsingleton (V : SemiNormedGrp) [Subsingleton V] : Limits.IsZero V := by
refine āØfun X => āØāØāØ0ā©, fun f => ?_ā©ā©, fun X => āØāØāØ0ā©, fun f => ?_ā©ā©ā©
Ā· ext x; have : x = 0 := Subsingleton.elim _ _; simp only [this, map_zero]
Ā· ext; apply Subsingleton.elim
instance hasZeroObject : Limits.HasZeroObject SemiNormedGrp.{u} :=
āØāØof PUnit, isZero_of_subsingleton _ā©ā©
theorem iso_isometry_of_normNoninc {V W : SemiNormedGrp} (i : V ā
W) (h1 : i.hom.hom.NormNoninc)
(h2 : i.inv.hom.NormNoninc) : Isometry i.hom := by
apply AddMonoidHomClass.isometry_of_norm
intro v
apply le_antisymm (h1 v)
calc
āvā = āi.inv (i.hom v)ā := by rw [ā comp_apply, Iso.hom_inv_id, id_apply]
_ ⤠āi.hom vā := h2 _
instance Hom.add {M N : SemiNormedGrp} : Add (M ā¶ N) where
add f g := ofHom (f.hom + g.hom)
@[simp]
theorem hom_add {V W : SemiNormedGrp} (f g : V ā¶ W) : (f + g).hom = f.hom + g.hom :=
rfl
instance Hom.neg {M N : SemiNormedGrp} : Neg (M ā¶ N) where
neg f := ofHom (- f.hom)
@[simp]
theorem hom_neg {V W : SemiNormedGrp} (f : V ā¶ W) : (-f).hom = - f.hom :=
rfl
instance Hom.sub {M N : SemiNormedGrp} : Sub (M ā¶ N) where
sub f g := ofHom (f.hom - g.hom)
@[simp]
theorem hom_sub {V W : SemiNormedGrp} (f g : V ā¶ W) : (f - g).hom = f.hom - g.hom :=
rfl
instance Hom.nsmul {M N : SemiNormedGrp} : SMul ā (M ā¶ N) where
smul n f := ofHom (n ⢠f.hom)
@[simp]
theorem hom_nsum {V W : SemiNormedGrp} (n : ā) (f : V ā¶ W) : (n ⢠f).hom = n ⢠f.hom :=
rfl
instance Hom.zsmul {M N : SemiNormedGrp} : SMul ⤠(M ⶠN) where
smul n f := ofHom (n ⢠f.hom)
@[simp]
theorem hom_zsum {V W : SemiNormedGrp} (n : ā¤) (f : V ā¶ W) : (n ⢠f).hom = n ⢠f.hom :=
rfl
instance Hom.addCommGroup {V W : SemiNormedGrp} : AddCommGroup (V ā¶ W) :=
Function.Injective.addCommGroup _ ConcreteCategory.hom_injective rfl (fun _ _ => rfl)
(fun _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl)
end SemiNormedGrp
/-- `SemiNormedGrpā` is a type synonym for `SemiNormedGrp`,
which we shall equip with the category structure consisting only of the norm non-increasing maps.
-/
structure SemiNormedGrpā : Type (u + 1) where
/-- Construct a bundled `SemiNormedGrpā` from the underlying type and typeclass. -/
of ::
/-- The underlying seminormed abelian group. -/
carrier : Type u
[str : SeminormedAddCommGroup carrier]
attribute [instance] SemiNormedGrpā.str
namespace SemiNormedGrpā
instance : CoeSort SemiNormedGrpā Type* where
coe X := X.carrier
/-- The type of morphisms in `SemiNormedGrpā` -/
@[ext]
structure Hom (M N : SemiNormedGrpā.{u}) where
/-- The underlying `NormedAddGroupHom`. -/
hom' : NormedAddGroupHom M N
normNoninc : hom'.NormNoninc
instance : LargeCategory.{u} SemiNormedGrpā where
Hom := Hom
id X := āØNormedAddGroupHom.id X, NormedAddGroupHom.NormNoninc.idā©
comp {_ _ _} f g := āØg.1.comp f.1, g.2.comp f.2ā©
instance instFunLike (X Y : SemiNormedGrpā) :
FunLike { f : NormedAddGroupHom X Y // f.NormNoninc } X Y where
coe f := f.1.toFun
coe_injective' _ _ h := Subtype.val_inj.mp (NormedAddGroupHom.coe_injective h)
instance : ConcreteCategory SemiNormedGrpā
fun X Y => { f : NormedAddGroupHom X Y // f.NormNoninc } where
hom f := āØf.1, f.2ā©
ofHom f := āØf.1, f.2ā©
instance (X Y : SemiNormedGrpā) :
AddMonoidHomClass { f : NormedAddGroupHom X Y // f.NormNoninc } X Y where
map_add f := map_add f.1
map_zero f := map_zero f.1
/-- Turn a morphism in `SemiNormedGrpā` back into a norm-nonincreasing `NormedAddGroupHom`. -/
abbrev Hom.hom {M N : SemiNormedGrpā.{u}} (f : Hom M N) :=
ConcreteCategory.hom (C := SemiNormedGrpā) f
/-- Promote a `NormedAddGroupHom` to a morphism in `SemiNormedGrpā`. -/
abbrev mkHom {M N : Type u} [SeminormedAddCommGroup M] [SeminormedAddCommGroup N]
(f : NormedAddGroupHom M N) (i : f.NormNoninc) :
SemiNormedGrpā.of M ā¶ SemiNormedGrpā.of N :=
ConcreteCategory.ofHom āØf, iā©
/-- Use the `ConcreteCategory.hom` projection for `@[simps]` lemmas. -/
def Hom.Simps.hom (M N : SemiNormedGrpā.{u}) (f : Hom M N) : NormedAddGroupHom M N :=
f.hom
initialize_simps_projections Hom (hom' ā hom)
instance (X Y : SemiNormedGrpā) : CoeFun (X ā¶ Y) (fun _ => X ā Y) where
coe f := f.hom.1
theorem mkHom_apply {M N : Type u} [SeminormedAddCommGroup M] [SeminormedAddCommGroup N]
(f : NormedAddGroupHom M N) (i : f.NormNoninc) (x) :
mkHom f i x = f x :=
rfl
/-!
The results below duplicate the `ConcreteCategory` simp lemmas, but we can keep them for `dsimp`.
-/
@[ext]
lemma ext {M N : SemiNormedGrpā} {fā fā : M ā¶ N} (h : ā (x : M), fā x = fā x) : fā = fā :=
ConcreteCategory.ext_apply h
@[simp]
lemma hom_id {M : SemiNormedGrpā} : (š M : M ā¶ M).hom = NormedAddGroupHom.id M := rfl
/- Provided for rewriting. -/
lemma id_apply (M : SemiNormedGrpā) (r : M) :
(š M : M ā¶ M) r = r := by simp
@[simp]
lemma hom_comp {M N O : SemiNormedGrpā} (f : M ā¶ N) (g : N ā¶ O) :
(f ā« g).hom.1 = g.hom.1.comp f.hom.1 := rfl
/- Provided for rewriting. -/
lemma comp_apply {M N O : SemiNormedGrpā} (f : M ā¶ N) (g : N ā¶ O) (r : M) :
(f ā« g) r = g (f r) := by simp
@[ext]
lemma hom_ext {M N : SemiNormedGrpā} {f g : M ā¶ N} (hf : f.hom = g.hom) : f = g :=
Hom.ext (congr_arg Subtype.val hf)
@[simp]
lemma hom_mkHom {M N : Type u} [SeminormedAddCommGroup M] [SeminormedAddCommGroup N]
(f : NormedAddGroupHom M N) (hf : f.NormNoninc) : (mkHom f hf).hom = f := rfl
@[simp]
lemma mkHom_hom {M N : SemiNormedGrpā} (f : M ā¶ N) :
mkHom (Hom.hom f) f.normNoninc = f := rfl
@[simp]
lemma mkHom_id {M : Type u} [SeminormedAddCommGroup M] :
mkHom (NormedAddGroupHom.id M) NormedAddGroupHom.NormNoninc.id = š (of M) := rfl
@[simp]
lemma mkHom_comp {M N O : Type u} [SeminormedAddCommGroup M] [SeminormedAddCommGroup N]
[SeminormedAddCommGroup O] (f : NormedAddGroupHom M N) (g : NormedAddGroupHom N O)
(hf : f.NormNoninc) (hg : g.NormNoninc) (hgf : (g.comp f).NormNoninc) :
mkHom (g.comp f) hgf = mkHom f hf ā« mkHom g hg :=
rfl
@[simp]
lemma inv_hom_apply {M N : SemiNormedGrpā} (e : M ā
N) (r : M) : e.inv (e.hom r) = r := by
rw [ā comp_apply]
simp
@[simp]
lemma hom_inv_apply {M N : SemiNormedGrpā} (e : M ā
N) (s : N) : e.hom (e.inv s) = s := by
rw [ā comp_apply]
simp
instance (M : SemiNormedGrpā) : SeminormedAddCommGroup M :=
M.str
/-- Promote an isomorphism in `SemiNormedGrp` to an isomorphism in `SemiNormedGrpā`. -/
@[simps]
def mkIso {M N : SemiNormedGrp} (f : M ā
N) (i : f.hom.hom.NormNoninc) (i' : f.inv.hom.NormNoninc) :
SemiNormedGrpā.of M ā
SemiNormedGrpā.of N where
hom := mkHom f.hom.hom i
inv := mkHom f.inv.hom i'
instance : HasForgetā SemiNormedGrpā SemiNormedGrp where
forgetā :=
{ obj := fun X => SemiNormedGrp.of X
map := fun f => SemiNormedGrp.ofHom f.1 }
theorem coe_of (V : Type u) [SeminormedAddCommGroup V] : (SemiNormedGrpā.of V : Type u) = V :=
rfl
theorem coe_id (V : SemiNormedGrpā) : ā(š V) = id :=
rfl
theorem coe_comp {M N K : SemiNormedGrpā} (f : M ā¶ N) (g : N ā¶ K) :
(f ā« g : M ā K) = g ā f :=
rfl
instance : Inhabited SemiNormedGrpā :=
āØof PUnitā©
instance (X Y : SemiNormedGrpā) : Zero (X ā¶ Y) where
zero := āØ0, NormedAddGroupHom.NormNoninc.zeroā©
@[simp]
theorem zero_apply {V W : SemiNormedGrpā} (x : V) : (0 : V ā¶ W) x = 0 :=
rfl
instance : Limits.HasZeroMorphisms.{u, u + 1} SemiNormedGrpā where
theorem isZero_of_subsingleton (V : SemiNormedGrpā) [Subsingleton V] : Limits.IsZero V := by
refine āØfun X => āØāØāØ0ā©, fun f => ?_ā©ā©, fun X => āØāØāØ0ā©, fun f => ?_ā©ā©ā©
Ā· ext x; have : x = 0 := Subsingleton.elim _ _; simp only [this, map_zero]
Ā· ext; apply Subsingleton.elim
instance hasZeroObject : Limits.HasZeroObject SemiNormedGrpā.{u} :=
āØāØof PUnit, isZero_of_subsingleton _ā©ā©
theorem iso_isometry {V W : SemiNormedGrpā} (i : V ā
W) : Isometry i.hom := by
change Isometry (āØāØi.hom, map_zero _ā©, fun _ _ => map_add _ _ _ā© : V ā+ W)
refine AddMonoidHomClass.isometry_of_norm _ ?_
intro v
apply le_antisymm (i.hom.2 v)
calc
āvā = āi.inv (i.hom v)ā := by rw [ā comp_apply, Iso.hom_inv_id, id_apply]
_ ⤠āi.hom vā := i.inv.2 _
end SemiNormedGrpā |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Group/FunctionSeries.lean | import Mathlib.Analysis.Normed.Group.InfiniteSum
import Mathlib.Topology.Instances.ENNReal.Lemmas
/-!
# Continuity of series of functions
We show that series of functions are continuous when each individual function in the series is and
additionally suitable uniform summable bounds are satisfied, in `continuous_tsum`.
For smoothness of series of functions, see the file `Analysis.Calculus.SmoothSeries`.
TODO: update this to use `SummableUniformlyOn`.
-/
open Set Metric TopologicalSpace Function Filter
open scoped Topology NNReal
variable {α β F : Type*} [NormedAddCommGroup F] [CompleteSpace F] {u : α ā ā}
/-- An infinite sum of functions with summable sup norm is the uniform limit of its partial sums.
Version relative to a set, with general index set. -/
theorem tendstoUniformlyOn_tsum {f : α ā β ā F} (hu : Summable u) {s : Set β}
(hfu : ā n x, x ā s ā āf n xā ⤠u n) :
TendstoUniformlyOn (fun t : Finset α => fun x => ā n ā t, f n x) (fun x => ā' n, f n x) atTop
s := by
refine tendstoUniformlyOn_iff.2 fun ε εpos => ?_
filter_upwards [(tendsto_order.1 (tendsto_tsum_compl_atTop_zero u)).2 _ εpos] with t ht x hx
have A : Summable fun n => āf n xā :=
.of_nonneg_of_le (fun _ ⦠norm_nonneg _) (fun n => hfu n x hx) hu
rw [dist_eq_norm, ā A.of_norm.sum_add_tsum_subtype_compl t, add_sub_cancel_left]
apply lt_of_le_of_lt _ ht
apply (norm_tsum_le_tsum_norm (A.subtype _)).trans
exact (A.subtype _).tsum_le_tsum (fun n => hfu _ _ hx) (hu.subtype _)
/-- An infinite sum of functions with summable sup norm is the uniform limit of its partial sums.
Version relative to a set, with index set `ā`. -/
theorem tendstoUniformlyOn_tsum_nat {f : ā ā β ā F} {u : ā ā ā} (hu : Summable u) {s : Set β}
(hfu : ā n x, x ā s ā āf n xā ⤠u n) :
TendstoUniformlyOn (fun N => fun x => ā n ā Finset.range N, f n x) (fun x => ā' n, f n x) atTop
s :=
fun v hv => tendsto_finset_range.eventually (tendstoUniformlyOn_tsum hu hfu v hv)
/-- An infinite sum of functions with eventually summable sup norm is the uniform limit of its
partial sums. Version relative to a set, with general index set. -/
theorem tendstoUniformlyOn_tsum_of_cofinite_eventually {ι : Type*} {f : ι ā β ā F} {u : ι ā ā}
(hu : Summable u) {s : Set β} (hfu : āį¶ n in cofinite, ā x ā s, āf n xā ⤠u n) :
TendstoUniformlyOn (fun t x => ā n ā t, f n x) (fun x => ā' n, f n x) atTop s := by
classical
refine tendstoUniformlyOn_iff.2 fun ε εpos => ?_
have := (tendsto_order.1 (tendsto_tsum_compl_atTop_zero u)).2 _ εpos
simp only [gt_iff_lt,
eventually_atTop, ge_iff_le, Finset.le_eq_subset] at *
obtain āØt, htā© := this
rw [eventually_iff_exists_mem] at hfu
obtain āØN, hN, HNā© := hfu
refine āØhN.toFinset āŖ t, fun n hn x hx => ?_ā©
have A : Summable fun n => āf n xā := by
apply Summable.add_compl (s := hN.toFinset) Summable.of_finite
apply Summable.of_nonneg_of_le (fun _ ⦠norm_nonneg _) _ (hu.subtype _)
simp only [comp_apply, Subtype.forall, Set.mem_compl_iff, Finset.mem_coe]
aesop
rw [dist_eq_norm, ā A.of_norm.sum_add_tsum_subtype_compl n, add_sub_cancel_left]
apply lt_of_le_of_lt _ (ht n (Finset.union_subset_right hn))
apply (norm_tsum_le_tsum_norm (A.subtype _)).trans
apply (A.subtype _).tsum_le_tsum _ (hu.subtype _)
simp only [comp_apply, Subtype.forall, imp_false]
apply fun i hi => HN i ?_ x hx
have : i ā hN.toFinset := fun hg ⦠hi (Finset.union_subset_left hn hg)
simp_all
theorem tendstoUniformlyOn_tsum_nat_eventually {α F : Type*} [NormedAddCommGroup F]
[CompleteSpace F] {f : ā ā α ā F} {u : ā ā ā} (hu : Summable u) {s : Set α}
(hfu : āį¶ n in atTop, ā x ā s, āf n xā ⤠u n) :
TendstoUniformlyOn (fun N x => ā n ā Finset.range N, f n x)
(fun x => ā' n, f n x) atTop s :=
fun v hv ⦠tendsto_finset_range.eventually <|
tendstoUniformlyOn_tsum_of_cofinite_eventually hu (Nat.cofinite_eq_atTop āø hfu) v hv
/-- An infinite sum of functions with summable sup norm is the uniform limit of its partial sums.
Version with general index set. -/
theorem tendstoUniformly_tsum {f : α ā β ā F} (hu : Summable u) (hfu : ā n x, āf n xā ⤠u n) :
TendstoUniformly (fun t : Finset α => fun x => ā n ā t, f n x)
(fun x => ā' n, f n x) atTop := by
rw [ā tendstoUniformlyOn_univ]; exact tendstoUniformlyOn_tsum hu fun n x _ => hfu n x
/-- An infinite sum of functions with summable sup norm is the uniform limit of its partial sums.
Version with index set `ā`. -/
theorem tendstoUniformly_tsum_nat {f : ā ā β ā F} {u : ā ā ā} (hu : Summable u)
(hfu : ā n x, āf n xā ⤠u n) :
TendstoUniformly (fun N => fun x => ā n ā Finset.range N, f n x) (fun x => ā' n, f n x)
atTop :=
fun v hv => tendsto_finset_range.eventually (tendstoUniformly_tsum hu hfu v hv)
/-- An infinite sum of functions with eventually summable sup norm is the uniform limit of its
partial sums. Version with general index set. -/
theorem tendstoUniformly_tsum_of_cofinite_eventually {ι : Type*} {f : ι ā β ā F} {u : ι ā ā}
(hu : Summable u) (hfu : āį¶ (n : ι) in cofinite, ā x : β, āf n xā ⤠u n) :
TendstoUniformly (fun t x => ā n ā t, f n x) (fun x => ā' n, f n x) atTop := by
rw [ā tendstoUniformlyOn_univ]
apply tendstoUniformlyOn_tsum_of_cofinite_eventually hu
simpa using hfu
/-- An infinite sum of functions with summable sup norm is continuous on a set if each individual
function is. -/
theorem continuousOn_tsum [TopologicalSpace β] {f : α ā β ā F} {s : Set β}
(hf : ā i, ContinuousOn (f i) s) (hu : Summable u) (hfu : ā n x, x ā s ā āf n xā ⤠u n) :
ContinuousOn (fun x => ā' n, f n x) s := by
classical
refine (tendstoUniformlyOn_tsum hu hfu).continuousOn (Eventually.of_forall ?_)
intro t
exact continuousOn_finset_sum _ fun i _ => hf i
/-- An infinite sum of functions with summable sup norm is continuous if each individual
function is. -/
theorem continuous_tsum [TopologicalSpace β] {f : α ā β ā F} (hf : ā i, Continuous (f i))
(hu : Summable u) (hfu : ā n x, āf n xā ⤠u n) : Continuous fun x => ā' n, f n x := by
simp_rw [ā continuousOn_univ] at hf ā¢
exact continuousOn_tsum hf hu fun n x _ => hfu n x |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Group/BallSphere.lean | import Mathlib.Analysis.Normed.Group.Uniform
/-!
# Negation on spheres and balls
In this file we define `InvolutiveNeg` and `ContinuousNeg` instances for spheres, open balls, and
closed balls in a seminormed group.
-/
open Metric Set Topology
variable {E : Type*} [i : SeminormedAddCommGroup E] {r : ā}
/-- We equip the sphere, in a seminormed group, with a formal operation of negation, namely the
antipodal map. -/
instance : InvolutiveNeg (sphere (0 : E) r) where
neg := Subtype.map Neg.neg fun w => by simp
neg_neg x := Subtype.ext <| neg_neg x.1
@[simp]
theorem coe_neg_sphere {r : ā} (v : sphere (0 : E) r) : ā(-v) = (-v : E) :=
rfl
instance : ContinuousNeg (sphere (0 : E) r) := IsInducing.subtypeVal.continuousNeg fun _ => rfl
/-- We equip the ball, in a seminormed group, with a formal operation of negation, namely the
antipodal map. -/
instance {r : ā} : InvolutiveNeg (ball (0 : E) r) where
neg := Subtype.map Neg.neg fun w => by simp
neg_neg x := Subtype.ext <| neg_neg x.1
@[simp] theorem coe_neg_ball {r : ā} (v : ball (0 : E) r) : ā(-v) = (-v : E) := rfl
instance : ContinuousNeg (ball (0 : E) r) := IsInducing.subtypeVal.continuousNeg fun _ => rfl
/-- We equip the closed ball, in a seminormed group, with a formal operation of negation, namely the
antipodal map. -/
instance {r : ā} : InvolutiveNeg (closedBall (0 : E) r) where
neg := Subtype.map Neg.neg fun w => by simp
neg_neg x := Subtype.ext <| neg_neg x.1
@[simp] theorem coe_neg_closedBall {r : ā} (v : closedBall (0 : E) r) : ā(-v) = (-v : E) := rfl
instance : ContinuousNeg (closedBall (0 : E) r) := IsInducing.subtypeVal.continuousNeg fun _ => rfl |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Group/Seminorm.lean | import Mathlib.Data.NNReal.Defs
import Mathlib.Order.ConditionallyCompleteLattice.Group
/-!
# Group seminorms
This file defines norms and seminorms in a group. A group seminorm is a function to the reals which
is positive-semidefinite and subadditive. A norm further only maps zero to zero.
## Main declarations
* `AddGroupSeminorm`: A function `f` from an additive group `G` to the reals that preserves zero,
takes nonnegative values, is subadditive and such that `f (-x) = f x` for all `x`.
* `NonarchAddGroupSeminorm`: A function `f` from an additive group `G` to the reals that
preserves zero, takes nonnegative values, is nonarchimedean and such that `f (-x) = f x`
for all `x`.
* `GroupSeminorm`: A function `f` from a group `G` to the reals that sends one to zero, takes
nonnegative values, is submultiplicative and such that `f xā»Ā¹ = f x` for all `x`.
* `AddGroupNorm`: A seminorm `f` such that `f x = 0 ā x = 0` for all `x`.
* `NonarchAddGroupNorm`: A nonarchimedean seminorm `f` such that `f x = 0 ā x = 0` for all `x`.
* `GroupNorm`: A seminorm `f` such that `f x = 0 ā x = 1` for all `x`.
## Notes
The corresponding hom classes are defined in `Analysis.Order.Hom.Basic` to be used by absolute
values.
We do not define `NonarchAddGroupSeminorm` as an extension of `AddGroupSeminorm` to avoid
having a superfluous `add_le'` field in the resulting structure. The same applies to
`NonarchAddGroupNorm`.
## References
* [H. H. Schaefer, *Topological Vector Spaces*][schaefer1966]
## Tags
norm, seminorm
-/
assert_not_exists Finset
open Set
open NNReal
variable {R R' E F G : Type*}
/-- A seminorm on an additive group `G` is a function `f : G ā ā` that preserves zero, is
subadditive and such that `f (-x) = f x` for all `x`. -/
structure AddGroupSeminorm (G : Type*) [AddGroup G] where
-- Porting note: can't extend `ZeroHom G ā` because otherwise `to_additive` won't work since
-- we aren't using old structures
/-- The bare function of an `AddGroupSeminorm`. -/
protected toFun : G ā ā
/-- The image of zero is zero. -/
protected map_zero' : toFun 0 = 0
/-- The seminorm is subadditive. -/
protected add_le' : ā r s, toFun (r + s) ⤠toFun r + toFun s
/-- The seminorm is invariant under negation. -/
protected neg' : ā r, toFun (-r) = toFun r
/-- A seminorm on a group `G` is a function `f : G ā ā` that sends one to zero, is submultiplicative
and such that `f xā»Ā¹ = f x` for all `x`. -/
@[to_additive]
structure GroupSeminorm (G : Type*) [Group G] where
/-- The bare function of a `GroupSeminorm`. -/
protected toFun : G ā ā
/-- The image of one is zero. -/
protected map_one' : toFun 1 = 0
/-- The seminorm applied to a product is dominated by the sum of the seminorm applied to the
factors. -/
protected mul_le' : ā x y, toFun (x * y) ⤠toFun x + toFun y
/-- The seminorm is invariant under inversion. -/
protected inv' : ā x, toFun xā»Ā¹ = toFun x
/-- A nonarchimedean seminorm on an additive group `G` is a function `f : G ā ā` that preserves
zero, is nonarchimedean and such that `f (-x) = f x` for all `x`. -/
structure NonarchAddGroupSeminorm (G : Type*) [AddGroup G] extends ZeroHom G ā where
/-- The seminorm applied to a sum is dominated by the maximum of the function applied to the
addends. -/
protected add_le_max' : ā r s, toFun (r + s) ⤠max (toFun r) (toFun s)
/-- The seminorm is invariant under negation. -/
protected neg' : ā r, toFun (-r) = toFun r
/-! NOTE: We do not define `NonarchAddGroupSeminorm` as an extension of `AddGroupSeminorm`
to avoid having a superfluous `add_le'` field in the resulting structure. The same applies to
`NonarchAddGroupNorm` below. -/
/-- A norm on an additive group `G` is a function `f : G ā ā` that preserves zero, is subadditive
and such that `f (-x) = f x` and `f x = 0 ā x = 0` for all `x`. -/
structure AddGroupNorm (G : Type*) [AddGroup G] extends AddGroupSeminorm G where
/-- If the image under the seminorm is zero, then the argument is zero. -/
protected eq_zero_of_map_eq_zero' : ā x, toFun x = 0 ā x = 0
/-- A seminorm on a group `G` is a function `f : G ā ā` that sends one to zero, is submultiplicative
and such that `f xā»Ā¹ = f x` and `f x = 0 ā x = 1` for all `x`. -/
@[to_additive]
structure GroupNorm (G : Type*) [Group G] extends GroupSeminorm G where
/-- If the image under the norm is zero, then the argument is one. -/
protected eq_one_of_map_eq_zero' : ā x, toFun x = 0 ā x = 1
/-- A nonarchimedean norm on an additive group `G` is a function `f : G ā ā` that preserves zero, is
nonarchimedean and such that `f (-x) = f x` and `f x = 0 ā x = 0` for all `x`. -/
structure NonarchAddGroupNorm (G : Type*) [AddGroup G] extends NonarchAddGroupSeminorm G where
/-- If the image under the norm is zero, then the argument is zero. -/
protected eq_zero_of_map_eq_zero' : ā x, toFun x = 0 ā x = 0
/-- `NonarchAddGroupSeminormClass F α` states that `F` is a type of nonarchimedean seminorms on
the additive group `α`.
You should extend this class when you extend `NonarchAddGroupSeminorm`. -/
class NonarchAddGroupSeminormClass (F : Type*) (α : outParam Type*)
[AddGroup α] [FunLike F α ā] : Prop
extends NonarchimedeanHomClass F α ā where
/-- The image of zero is zero. -/
protected map_zero (f : F) : f 0 = 0
/-- The seminorm is invariant under negation. -/
protected map_neg_eq_map' (f : F) (a : α) : f (-a) = f a
/-- `NonarchAddGroupNormClass F α` states that `F` is a type of nonarchimedean norms on the
additive group `α`.
You should extend this class when you extend `NonarchAddGroupNorm`. -/
class NonarchAddGroupNormClass (F : Type*) (α : outParam Type*) [AddGroup α] [FunLike F α ā] : Prop
extends NonarchAddGroupSeminormClass F α where
/-- If the image under the norm is zero, then the argument is zero. -/
protected eq_zero_of_map_eq_zero (f : F) {a : α} : f a = 0 ā a = 0
section NonarchAddGroupSeminormClass
variable [AddGroup E] [FunLike F E ā] [NonarchAddGroupSeminormClass F E] (f : F) (x y : E)
theorem map_sub_le_max : f (x - y) ⤠max (f x) (f y) := by
rw [sub_eq_add_neg, ā NonarchAddGroupSeminormClass.map_neg_eq_map' f y]
exact map_add_le_max _ _ _
end NonarchAddGroupSeminormClass
-- See note [lower instance priority]
instance (priority := 100) NonarchAddGroupSeminormClass.toAddGroupSeminormClass
[FunLike F E ā] [AddGroup E] [NonarchAddGroupSeminormClass F E] : AddGroupSeminormClass F E ā :=
{ ā¹NonarchAddGroupSeminormClass F Eāŗ with
map_add_le_add := fun f _ _ =>
haveI h_nonneg : ā a, 0 ⤠f a := by
intro a
rw [ā NonarchAddGroupSeminormClass.map_zero f, ā sub_self a]
exact le_trans (map_sub_le_max _ _ _) (by rw [max_self (f a)])
le_trans (map_add_le_max _ _ _)
(max_le (le_add_of_nonneg_right (h_nonneg _)) (le_add_of_nonneg_left (h_nonneg _)))
map_neg_eq_map := NonarchAddGroupSeminormClass.map_neg_eq_map' }
-- See note [lower instance priority]
instance (priority := 100) NonarchAddGroupNormClass.toAddGroupNormClass
[FunLike F E ā] [AddGroup E] [NonarchAddGroupNormClass F E] : AddGroupNormClass F E ā :=
{ ā¹NonarchAddGroupNormClass F Eāŗ with
map_add_le_add := map_add_le_add
map_neg_eq_map := NonarchAddGroupSeminormClass.map_neg_eq_map' }
/-! ### Seminorms -/
namespace GroupSeminorm
section Group
variable [Group E] [Group F] [Group G] {p q : GroupSeminorm E}
@[to_additive]
instance funLike : FunLike (GroupSeminorm E) E ā where
coe f := f.toFun
coe_injective' f g h := by cases f; cases g; congr
@[to_additive]
instance groupSeminormClass : GroupSeminormClass (GroupSeminorm E) E ā where
map_one_eq_zero f := f.map_one'
map_mul_le_add f := f.mul_le'
map_inv_eq_map f := f.inv'
@[to_additive (attr := simp)]
theorem toFun_eq_coe : p.toFun = p :=
rfl
@[to_additive (attr := ext)]
theorem ext : (ā x, p x = q x) ā p = q :=
DFunLike.ext p q
@[to_additive]
instance : PartialOrder (GroupSeminorm E) :=
PartialOrder.lift _ DFunLike.coe_injective
@[to_additive]
theorem le_def : p ⤠q ā (p : E ā ā) ⤠q :=
Iff.rfl
@[to_additive]
theorem lt_def : p < q ā (p : E ā ā) < q :=
Iff.rfl
@[to_additive (attr := simp, norm_cast)]
theorem coe_le_coe : (p : E ā ā) ⤠q ā p ⤠q :=
Iff.rfl
@[to_additive (attr := simp, norm_cast)]
theorem coe_lt_coe : (p : E ā ā) < q ā p < q :=
Iff.rfl
variable (p q) (f : F ā* E)
@[to_additive]
instance instZeroGroupSeminorm : Zero (GroupSeminorm E) :=
āØ{ toFun := 0
map_one' := Pi.zero_apply _
mul_le' := fun _ _ => (zero_add _).ge
inv' := fun _ => rfl }ā©
@[to_additive (attr := simp, norm_cast)]
theorem coe_zero : ā(0 : GroupSeminorm E) = 0 :=
rfl
@[to_additive (attr := simp)]
theorem zero_apply (x : E) : (0 : GroupSeminorm E) x = 0 :=
rfl
@[to_additive]
instance : Inhabited (GroupSeminorm E) :=
āØ0ā©
@[to_additive]
instance : Add (GroupSeminorm E) :=
āØfun p q =>
{ toFun := fun x => p x + q x
map_one' := by simp_rw [map_one_eq_zero p, map_one_eq_zero q, zero_add]
mul_le' := fun _ _ =>
(add_le_add (map_mul_le_add p _ _) <| map_mul_le_add q _ _).trans_eq <|
add_add_add_comm _ _ _ _
inv' := fun x => by simp_rw [map_inv_eq_map p, map_inv_eq_map q] }ā©
@[to_additive (attr := simp)]
theorem coe_add : ā(p + q) = p + q :=
rfl
@[to_additive (attr := simp)]
theorem add_apply (x : E) : (p + q) x = p x + q x :=
rfl
-- TODO: define `SupSet` too, from the skeleton at
-- https://github.com/leanprover-community/mathlib/pull/11329#issuecomment-1008915345
@[to_additive]
instance : Max (GroupSeminorm E) :=
āØfun p q =>
{ toFun := p ā q
map_one' := by
rw [Pi.sup_apply, ā map_one_eq_zero p, sup_eq_left, map_one_eq_zero p, map_one_eq_zero q]
mul_le' := fun x y =>
sup_le ((map_mul_le_add p x y).trans <| add_le_add le_sup_left le_sup_left)
((map_mul_le_add q x y).trans <| add_le_add le_sup_right le_sup_right)
inv' := fun x => by rw [Pi.sup_apply, Pi.sup_apply, map_inv_eq_map p, map_inv_eq_map q] }ā©
@[to_additive (attr := simp, norm_cast)]
theorem coe_sup : ā(p ā q) = āp ā āq :=
rfl
@[to_additive (attr := simp)]
theorem sup_apply (x : E) : (p ā q) x = p x ā q x :=
rfl
@[to_additive]
instance semilatticeSup : SemilatticeSup (GroupSeminorm E) :=
DFunLike.coe_injective.semilatticeSup _ coe_sup
/-- Composition of a group seminorm with a monoid homomorphism as a group seminorm. -/
@[to_additive /-- Composition of an additive group seminorm with an additive monoid homomorphism as
an additive group seminorm. -/]
def comp (p : GroupSeminorm E) (f : F ā* E) : GroupSeminorm F where
toFun x := p (f x)
map_one' := by simp_rw [f.map_one, map_one_eq_zero p]
mul_le' _ _ := (congr_arg p <| f.map_mul _ _).trans_le <| map_mul_le_add p _ _
inv' x := by simp_rw [map_inv, map_inv_eq_map p]
@[to_additive (attr := simp)]
theorem coe_comp : ā(p.comp f) = p ā f :=
rfl
@[to_additive (attr := simp)]
theorem comp_apply (x : F) : (p.comp f) x = p (f x) :=
rfl
@[to_additive (attr := simp)]
theorem comp_id : p.comp (MonoidHom.id _) = p :=
ext fun _ => rfl
@[to_additive (attr := simp)]
theorem comp_zero : p.comp (1 : F ā* E) = 0 :=
ext fun _ => map_one_eq_zero p
@[to_additive (attr := simp)]
theorem zero_comp : (0 : GroupSeminorm E).comp f = 0 :=
ext fun _ => rfl
@[to_additive]
theorem comp_assoc (g : F ā* E) (f : G ā* F) : p.comp (g.comp f) = (p.comp g).comp f :=
ext fun _ => rfl
@[to_additive]
theorem add_comp (f : F ā* E) : (p + q).comp f = p.comp f + q.comp f :=
ext fun _ => rfl
variable {p q}
@[to_additive]
theorem comp_mono (hp : p ⤠q) : p.comp f ⤠q.comp f := fun _ => hp _
end Group
section CommGroup
variable [CommGroup E] [CommGroup F] (p q : GroupSeminorm E) (x : E)
@[to_additive]
theorem comp_mul_le (f g : F ā* E) : p.comp (f * g) ⤠p.comp f + p.comp g := fun _ =>
map_mul_le_add p _ _
@[to_additive]
theorem mul_bddBelow_range_add {p q : GroupSeminorm E} {x : E} :
BddBelow (range fun y => p y + q (x / y)) :=
āØ0, by
rintro _ āØx, rflā©
dsimp
positivityā©
@[to_additive]
noncomputable instance : Min (GroupSeminorm E) :=
āØfun p q =>
{ toFun := fun x => āØ
y, p y + q (x / y)
map_one' :=
ciInf_eq_of_forall_ge_of_forall_gt_exists_lt
(fun _ => by positivity) fun r hr =>
āØ1, by rwa [div_one, map_one_eq_zero p, map_one_eq_zero q, add_zero]ā©
mul_le' := fun x y =>
le_ciInf_add_ciInf fun u v => by
refine ciInf_le_of_le mul_bddBelow_range_add (u * v) ?_
rw [mul_div_mul_comm, add_add_add_comm]
exact add_le_add (map_mul_le_add p _ _) (map_mul_le_add q _ _)
inv' := fun x =>
(inv_surjective.iInf_comp _).symm.trans <| by
simp_rw [map_inv_eq_map p, ā inv_div', map_inv_eq_map q] }ā©
@[to_additive (attr := simp)]
theorem inf_apply : (p ā q) x = āØ
y, p y + q (x / y) :=
rfl
@[to_additive]
noncomputable instance : Lattice (GroupSeminorm E) :=
{ GroupSeminorm.semilatticeSup with
inf := (Ā· ā Ā·)
inf_le_left := fun p q x =>
ciInf_le_of_le mul_bddBelow_range_add x <| by rw [div_self', map_one_eq_zero q, add_zero]
inf_le_right := fun p q x =>
ciInf_le_of_le mul_bddBelow_range_add (1 : E) <| by
simpa only [div_one x, map_one_eq_zero p, zero_add (q x)] using le_rfl
le_inf := fun a _ _ hb hc _ =>
le_ciInf fun _ => (le_map_add_map_div a _ _).trans <| add_le_add (hb _) (hc _) }
end CommGroup
end GroupSeminorm
/- TODO: All the following ought to be automated using `to_additive`. The problem is that it doesn't
see that `SMul R ā` should be fixed because `ā` is fixed. -/
namespace AddGroupSeminorm
variable [AddGroup E] [SMul R ā] [SMul R āā„0] [IsScalarTower R āā„0 ā]
instance toOne [DecidableEq E] : One (AddGroupSeminorm E) :=
āØ{ toFun := fun x => if x = 0 then 0 else 1
map_zero' := if_pos rfl
add_le' := fun x y => by
by_cases hx : x = 0
Ā· rw [if_pos hx, hx, zero_add, zero_add]
Ā· rw [if_neg hx]
refine le_add_of_le_of_nonneg ?_ ?_ <;> split_ifs <;> norm_num
neg' := fun x => by simp_rw [neg_eq_zero] }ā©
@[simp]
theorem apply_one [DecidableEq E] (x : E) : (1 : AddGroupSeminorm E) x = if x = 0 then 0 else 1 :=
rfl
/-- Any action on `ā` which factors through `āā„0` applies to an `AddGroupSeminorm`. -/
instance toSMul : SMul R (AddGroupSeminorm E) :=
āØfun r p =>
{ toFun := fun x => r ⢠p x
map_zero' := by
simp only [ā smul_one_smul āā„0 r (_ : ā), NNReal.smul_def, smul_eq_mul, map_zero, mul_zero]
add_le' := fun _ _ => by
simp only [ā smul_one_smul āā„0 r (_ : ā), NNReal.smul_def, smul_eq_mul, ā mul_add]
gcongr
apply map_add_le_add
neg' := fun x => by simp_rw [map_neg_eq_map] }ā©
@[simp, norm_cast]
theorem coe_smul (r : R) (p : AddGroupSeminorm E) : ā(r ⢠p) = r ⢠āp :=
rfl
@[simp]
theorem smul_apply (r : R) (p : AddGroupSeminorm E) (x : E) : (r ⢠p) x = r ⢠p x :=
rfl
instance isScalarTower [SMul R' ā] [SMul R' āā„0] [IsScalarTower R' āā„0 ā] [SMul R R']
[IsScalarTower R R' ā] : IsScalarTower R R' (AddGroupSeminorm E) :=
āØfun r a p => ext fun x => smul_assoc r a (p x)ā©
theorem smul_sup (r : R) (p q : AddGroupSeminorm E) : r ⢠(p ā q) = r ⢠p ā r ⢠q :=
have Real.smul_max : ā x y : ā, r ⢠max x y = max (r ⢠x) (r ⢠y) := fun x y => by
simpa only [ā smul_eq_mul, ā NNReal.smul_def, smul_one_smul āā„0 r (_ : ā)] using
mul_max_of_nonneg x y (r ⢠(1 : āā„0) : āā„0).coe_nonneg
ext fun _ => Real.smul_max _ _
end AddGroupSeminorm
namespace NonarchAddGroupSeminorm
section AddGroup
variable [AddGroup E] {p q : NonarchAddGroupSeminorm E}
instance funLike : FunLike (NonarchAddGroupSeminorm E) E ā where
coe f := f.toFun
coe_injective' f g h := by obtain āØāØ_, _ā©, _, _ā© := f; cases g; congr
instance nonarchAddGroupSeminormClass :
NonarchAddGroupSeminormClass (NonarchAddGroupSeminorm E) E where
map_add_le_max f := f.add_le_max'
map_zero f := f.map_zero'
map_neg_eq_map' f := f.neg'
@[simp]
theorem toZeroHom_eq_coe : āp.toZeroHom = p := by
rfl
@[ext]
theorem ext : (ā x, p x = q x) ā p = q :=
DFunLike.ext p q
noncomputable instance : PartialOrder (NonarchAddGroupSeminorm E) :=
PartialOrder.lift _ DFunLike.coe_injective
theorem le_def : p ⤠q ā (p : E ā ā) ⤠q :=
Iff.rfl
theorem lt_def : p < q ā (p : E ā ā) < q :=
Iff.rfl
@[simp, norm_cast]
theorem coe_le_coe : (p : E ā ā) ⤠q ā p ⤠q :=
Iff.rfl
@[simp, norm_cast]
theorem coe_lt_coe : (p : E ā ā) < q ā p < q :=
Iff.rfl
variable (p q)
instance : Zero (NonarchAddGroupSeminorm E) :=
āØ{ toFun := 0
map_zero' := Pi.zero_apply _
add_le_max' := fun r s => by simp only [Pi.zero_apply]; rw [max_eq_right]; rfl
neg' := fun _ => rfl }ā©
@[simp, norm_cast]
theorem coe_zero : ā(0 : NonarchAddGroupSeminorm E) = 0 :=
rfl
@[simp]
theorem zero_apply (x : E) : (0 : NonarchAddGroupSeminorm E) x = 0 :=
rfl
instance : Inhabited (NonarchAddGroupSeminorm E) :=
āØ0ā©
-- TODO: define `SupSet` too, from the skeleton at
-- https://github.com/leanprover-community/mathlib/pull/11329#issuecomment-1008915345
instance : Max (NonarchAddGroupSeminorm E) :=
āØfun p q =>
{ toFun := p ā q
map_zero' := by rw [Pi.sup_apply, ā map_zero p, sup_eq_left, map_zero p, map_zero q]
add_le_max' := fun x y =>
sup_le ((map_add_le_max p x y).trans <| max_le_max le_sup_left le_sup_left)
((map_add_le_max q x y).trans <| max_le_max le_sup_right le_sup_right)
neg' := fun x => by simp_rw [Pi.sup_apply, map_neg_eq_map p, map_neg_eq_map q]}ā©
@[simp, norm_cast]
theorem coe_sup : ā(p ā q) = āp ā āq :=
rfl
@[simp]
theorem sup_apply (x : E) : (p ā q) x = p x ā q x :=
rfl
noncomputable instance : SemilatticeSup (NonarchAddGroupSeminorm E) :=
DFunLike.coe_injective.semilatticeSup _ coe_sup
end AddGroup
section AddCommGroup
variable [AddCommGroup E]
theorem add_bddBelow_range_add {p q : NonarchAddGroupSeminorm E} {x : E} :
BddBelow (range fun y => p y + q (x - y)) :=
āØ0, by
rintro _ āØx, rflā©
dsimp
positivityā©
end AddCommGroup
end NonarchAddGroupSeminorm
namespace GroupSeminorm
variable [Group E] [SMul R ā] [SMul R āā„0] [IsScalarTower R āā„0 ā]
instance toOne [DecidableEq E] : One (GroupSeminorm E) :=
āØ{ toFun := fun x => if x = 1 then 0 else 1
map_one' := if_pos rfl
mul_le' := fun x y => by
by_cases hx : x = 1
Ā· rw [if_pos hx, hx, one_mul, zero_add]
Ā· rw [if_neg hx]
refine le_add_of_le_of_nonneg ?_ ?_ <;> split_ifs <;> norm_num
inv' := fun x => by simp_rw [inv_eq_one] }ā©
@[simp]
theorem apply_one [DecidableEq E] (x : E) : (1 : GroupSeminorm E) x = if x = 1 then 0 else 1 :=
rfl
/-- Any action on `ā` which factors through `āā„0` applies to an `AddGroupSeminorm`. -/
instance : SMul R (GroupSeminorm E) :=
āØfun r p =>
{ toFun := fun x => r ⢠p x
map_one' := by
simp only [ā smul_one_smul āā„0 r (_ : ā), NNReal.smul_def, smul_eq_mul, map_one_eq_zero p,
mul_zero]
mul_le' := fun _ _ => by
simp only [ā smul_one_smul āā„0 r (_ : ā), NNReal.smul_def, smul_eq_mul, ā mul_add]
gcongr
apply map_mul_le_add
inv' := fun x => by simp_rw [map_inv_eq_map p] }ā©
instance [SMul R' ā] [SMul R' āā„0] [IsScalarTower R' āā„0 ā] [SMul R R'] [IsScalarTower R R' ā] :
IsScalarTower R R' (GroupSeminorm E) :=
āØfun r a p => ext fun x => smul_assoc r a <| p xā©
@[simp, norm_cast]
theorem coe_smul (r : R) (p : GroupSeminorm E) : ā(r ⢠p) = r ⢠āp :=
rfl
@[simp]
theorem smul_apply (r : R) (p : GroupSeminorm E) (x : E) : (r ⢠p) x = r ⢠p x :=
rfl
theorem smul_sup (r : R) (p q : GroupSeminorm E) : r ⢠(p ā q) = r ⢠p ā r ⢠q :=
have Real.smul_max : ā x y : ā, r ⢠max x y = max (r ⢠x) (r ⢠y) := fun x y => by
simpa only [ā smul_eq_mul, ā NNReal.smul_def, smul_one_smul āā„0 r (_ : ā)] using
mul_max_of_nonneg x y (r ⢠(1 : āā„0) : āā„0).coe_nonneg
ext fun _ => Real.smul_max _ _
end GroupSeminorm
namespace NonarchAddGroupSeminorm
variable [AddGroup E] [SMul R ā] [SMul R āā„0] [IsScalarTower R āā„0 ā]
instance [DecidableEq E] : One (NonarchAddGroupSeminorm E) :=
āØ{ toFun := fun x => if x = 0 then 0 else 1
map_zero' := if_pos rfl
add_le_max' := fun x y => by
by_cases hx : x = 0
Ā· simp_rw [if_pos hx, hx, zero_add]
exact le_max_of_le_right (le_refl _)
Ā· simp_rw [if_neg hx]
split_ifs <;> simp
neg' := fun x => by simp_rw [neg_eq_zero] }ā©
@[simp]
theorem apply_one [DecidableEq E] (x : E) :
(1 : NonarchAddGroupSeminorm E) x = if x = 0 then 0 else 1 :=
rfl
/-- Any action on `ā` which factors through `āā„0` applies to a `NonarchAddGroupSeminorm`. -/
instance : SMul R (NonarchAddGroupSeminorm E) :=
āØfun r p =>
{ toFun := fun x => r ⢠p x
map_zero' := by
simp only [ā smul_one_smul āā„0 r (_ : ā), NNReal.smul_def, smul_eq_mul, map_zero p,
mul_zero]
add_le_max' := fun x y => by
simp only [ā smul_one_smul āā„0 r (_ : ā), NNReal.smul_def, smul_eq_mul, ā
mul_max_of_nonneg _ _ NNReal.zero_le_coe]
gcongr
apply map_add_le_max
neg' := fun x => by simp_rw [map_neg_eq_map p] }ā©
instance [SMul R' ā] [SMul R' āā„0] [IsScalarTower R' āā„0 ā] [SMul R R'] [IsScalarTower R R' ā] :
IsScalarTower R R' (NonarchAddGroupSeminorm E) :=
āØfun r a p => ext fun x => smul_assoc r a <| p xā©
@[simp, norm_cast]
theorem coe_smul (r : R) (p : NonarchAddGroupSeminorm E) : ā(r ⢠p) = r ⢠āp :=
rfl
@[simp]
theorem smul_apply (r : R) (p : NonarchAddGroupSeminorm E) (x : E) : (r ⢠p) x = r ⢠p x :=
rfl
theorem smul_sup (r : R) (p q : NonarchAddGroupSeminorm E) : r ⢠(p ā q) = r ⢠p ā r ⢠q :=
have Real.smul_max : ā x y : ā, r ⢠max x y = max (r ⢠x) (r ⢠y) := fun x y => by
simpa only [ā smul_eq_mul, ā NNReal.smul_def, smul_one_smul āā„0 r (_ : ā)] using
mul_max_of_nonneg x y (r ⢠(1 : āā„0) : āā„0).coe_nonneg
ext fun _ => Real.smul_max _ _
end NonarchAddGroupSeminorm
/-! ### Norms -/
namespace GroupNorm
section Group
variable [Group E] {p q : GroupNorm E}
@[to_additive]
instance funLike : FunLike (GroupNorm E) E ā where
coe f := f.toFun
coe_injective' f g h := by obtain āØāØ_, _, _, _ā©, _ā© := f; cases g; congr
@[to_additive]
instance groupNormClass : GroupNormClass (GroupNorm E) E ā where
map_one_eq_zero f := f.map_one'
map_mul_le_add f := f.mul_le'
map_inv_eq_map f := f.inv'
eq_one_of_map_eq_zero f := f.eq_one_of_map_eq_zero' _
@[to_additive (attr := simp)]
theorem toGroupSeminorm_eq_coe : āp.toGroupSeminorm = p :=
rfl
@[to_additive (attr := ext)]
theorem ext : (ā x, p x = q x) ā p = q :=
DFunLike.ext p q
@[to_additive]
instance : PartialOrder (GroupNorm E) :=
PartialOrder.lift _ DFunLike.coe_injective
@[to_additive]
theorem le_def : p ⤠q ā (p : E ā ā) ⤠q :=
Iff.rfl
@[to_additive]
theorem lt_def : p < q ā (p : E ā ā) < q :=
Iff.rfl
@[to_additive (attr := simp, norm_cast)]
theorem coe_le_coe : (p : E ā ā) ⤠q ā p ⤠q :=
Iff.rfl
@[to_additive (attr := simp, norm_cast)]
theorem coe_lt_coe : (p : E ā ā) < q ā p < q :=
Iff.rfl
variable (p q)
@[to_additive]
instance : Add (GroupNorm E) :=
āØfun p q =>
{ p.toGroupSeminorm + q.toGroupSeminorm with
eq_one_of_map_eq_zero' := fun _x hx =>
of_not_not fun h => hx.not_gt <| add_pos (map_pos_of_ne_one p h) (map_pos_of_ne_one q h) }ā©
@[to_additive (attr := simp)]
theorem coe_add : ā(p + q) = p + q :=
rfl
@[to_additive (attr := simp)]
theorem add_apply (x : E) : (p + q) x = p x + q x :=
rfl
-- TODO: define `SupSet`
@[to_additive]
instance : Max (GroupNorm E) :=
āØfun p q =>
{ p.toGroupSeminorm ā q.toGroupSeminorm with
eq_one_of_map_eq_zero' := fun _x hx =>
of_not_not fun h => hx.not_gt <| lt_sup_iff.2 <| Or.inl <| map_pos_of_ne_one p h }ā©
@[to_additive (attr := simp, norm_cast)]
theorem coe_sup : ā(p ā q) = āp ā āq :=
rfl
@[to_additive (attr := simp)]
theorem sup_apply (x : E) : (p ā q) x = p x ā q x :=
rfl
@[to_additive]
instance : SemilatticeSup (GroupNorm E) :=
DFunLike.coe_injective.semilatticeSup _ coe_sup
end Group
end GroupNorm
namespace AddGroupNorm
variable [AddGroup E] [DecidableEq E]
instance : One (AddGroupNorm E) :=
āØ{ (1 : AddGroupSeminorm E) with
eq_zero_of_map_eq_zero' := fun _x => zero_ne_one.ite_eq_left_iff.1 }ā©
@[simp]
theorem apply_one (x : E) : (1 : AddGroupNorm E) x = if x = 0 then 0 else 1 :=
rfl
instance : Inhabited (AddGroupNorm E) :=
āØ1ā©
end AddGroupNorm
namespace GroupNorm
instance _root_.AddGroupNorm.toOne [AddGroup E] [DecidableEq E] : One (AddGroupNorm E) :=
āØ{ (1 : AddGroupSeminorm E) with
eq_zero_of_map_eq_zero' := fun _ => zero_ne_one.ite_eq_left_iff.1 }ā©
variable [Group E] [DecidableEq E]
instance toOne : One (GroupNorm E) :=
āØ{ (1 : GroupSeminorm E) with eq_one_of_map_eq_zero' := fun _ => zero_ne_one.ite_eq_left_iff.1 }ā©
@[simp]
theorem apply_one (x : E) : (1 : GroupNorm E) x = if x = 1 then 0 else 1 :=
rfl
@[to_additive existing]
instance : Inhabited (GroupNorm E) :=
āØ1ā©
end GroupNorm
namespace NonarchAddGroupNorm
section AddGroup
variable [AddGroup E] {p q : NonarchAddGroupNorm E}
instance funLike : FunLike (NonarchAddGroupNorm E) E ā where
coe f := f.toFun
coe_injective' f g h := by obtain āØāØāØ_, _ā©, _, _ā©, _ā© := f; cases g; congr
instance nonarchAddGroupNormClass : NonarchAddGroupNormClass (NonarchAddGroupNorm E) E where
map_add_le_max f := f.add_le_max'
map_zero f := f.map_zero'
map_neg_eq_map' f := f.neg'
eq_zero_of_map_eq_zero f := f.eq_zero_of_map_eq_zero' _
@[simp]
theorem toNonarchAddGroupSeminorm_eq_coe : āp.toNonarchAddGroupSeminorm = p :=
rfl
@[ext]
theorem ext : (ā x, p x = q x) ā p = q :=
DFunLike.ext p q
noncomputable instance : PartialOrder (NonarchAddGroupNorm E) :=
PartialOrder.lift _ DFunLike.coe_injective
theorem le_def : p ⤠q ā (p : E ā ā) ⤠q :=
Iff.rfl
theorem lt_def : p < q ā (p : E ā ā) < q :=
Iff.rfl
@[simp, norm_cast]
theorem coe_le_coe : (p : E ā ā) ⤠q ā p ⤠q :=
Iff.rfl
@[simp, norm_cast]
theorem coe_lt_coe : (p : E ā ā) < q ā p < q :=
Iff.rfl
variable (p q)
instance : Max (NonarchAddGroupNorm E) :=
āØfun p q =>
{ p.toNonarchAddGroupSeminorm ā q.toNonarchAddGroupSeminorm with
eq_zero_of_map_eq_zero' := fun _x hx =>
of_not_not fun h => hx.not_gt <| lt_sup_iff.2 <| Or.inl <| map_pos_of_ne_zero p h }ā©
@[simp, norm_cast]
theorem coe_sup : ā(p ā q) = āp ā āq :=
rfl
@[simp]
theorem sup_apply (x : E) : (p ā q) x = p x ā q x :=
rfl
noncomputable instance : SemilatticeSup (NonarchAddGroupNorm E) :=
DFunLike.coe_injective.semilatticeSup _ coe_sup
instance [DecidableEq E] : One (NonarchAddGroupNorm E) :=
āØ{ (1 : NonarchAddGroupSeminorm E) with
eq_zero_of_map_eq_zero' := fun _ => zero_ne_one.ite_eq_left_iff.1 }ā©
@[simp]
theorem apply_one [DecidableEq E] (x : E) :
(1 : NonarchAddGroupNorm E) x = if x = 0 then 0 else 1 :=
rfl
instance [DecidableEq E] : Inhabited (NonarchAddGroupNorm E) :=
āØ1ā©
end AddGroup
end NonarchAddGroupNorm |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Group/ControlledClosure.lean | import Mathlib.Analysis.Normed.Group.Hom
import Mathlib.Analysis.SpecificLimits.Normed
/-! # Extending a backward bound on a normed group homomorphism from a dense set
Possible TODO (from the PR's review, https://github.com/leanprover-community/mathlib/pull/8498):
"This feels a lot like the second step in the proof of the Banach open mapping theorem
(`exists_preimage_norm_le`) ... wonder if it would be possible to refactor it using one of [the
lemmas in this file]."
-/
open Filter Finset
open Topology
variable {G : Type*} [NormedAddCommGroup G] [CompleteSpace G]
variable {H : Type*} [NormedAddCommGroup H]
/-- Given `f : NormedAddGroupHom G H` for some complete `G` and a subgroup `K` of `H`, if every
element `x` of `K` has a preimage under `f` whose norm is at most `C*āxā` then the same holds for
elements of the (topological) closure of `K` with constant `C+ε` instead of `C`, for any
positive `ε`.
-/
theorem controlled_closure_of_complete {f : NormedAddGroupHom G H} {K : AddSubgroup H} {C ε : ā}
(hC : 0 < C) (hε : 0 < ε) (hyp : f.SurjectiveOnWith K C) :
f.SurjectiveOnWith K.topologicalClosure (C + ε) := by
rintro (h : H) (h_in : h ā K.topologicalClosure)
-- We first get rid of the easy case where `h = 0`.
by_cases hyp_h : h = 0
Ā· rw [hyp_h]
use 0
simp
/- The desired preimage will be constructed as the sum of a series. Convergence of
the series will be guaranteed by completeness of `G`. We first write `h` as the sum
of a sequence `v` of elements of `K` which starts close to `h` and then quickly goes to zero.
The sequence `b` below quantifies this. -/
set b : ā ā ā := fun i => (1 / 2) ^ i * (ε * āhā / 2) / C
have b_pos (i) : 0 < b i := by positivity
obtain
āØv : ā ā H, lim_v : Tendsto (fun n : ā => ā k ā range (n + 1), v k) atTop (š h), v_in :
ā n, v n ā K, hvā : āv 0 - hā < b 0, hv : ā n > 0, āv nā < b nā© :=
controlled_sum_of_mem_closure h_in b_pos
/- The controlled surjectivity assumption on `f` allows to build preimages `u n` for all
elements `v n` of the `v` sequence. -/
have : ā n, ā m' : G, f m' = v n ā§ ām'ā ⤠C * āv nā := fun n : ā => hyp (v n) (v_in n)
choose u hu hnorm_u using this
/- The desired series `s` is then obtained by summing `u`. We then check our choice of
`b` ensures `s` is Cauchy. -/
set s : ā ā G := fun n => ā k ā range (n + 1), u k
have : CauchySeq s := by
apply NormedAddCommGroup.cauchy_series_of_le_geometric'' (by simp) one_half_lt_one
Ā· rintro n (hn : n ā„ 1)
calc
āu nā ⤠C * āv nā := hnorm_u n
_ ⤠C * b n := by gcongr; exact (hv _ <| Nat.succ_le_iff.mp hn).le
_ = (1 / 2) ^ n * (ε * āhā / 2) := by simp [b, mul_div_cancelā _ hC.ne.symm]
_ = ε * āhā / 2 * (1 / 2) ^ n := mul_comm _ _
-- We now show that the limit `g` of `s` is the desired preimage.
obtain āØg : G, hgā© := cauchySeq_tendsto_of_complete this
refine āØg, ?_, ?_ā©
Ā· -- We indeed get a preimage. First note:
have : f ā s = fun n => ā k ā range (n + 1), v k := by
ext n
simp [s, map_sum, hu]
/- In the above equality, the left-hand-side converges to `f g` by continuity of `f` and
definition of `g` while the right-hand-side converges to `h` by construction of `v` so
`g` is indeed a preimage of `h`. -/
rw [ā this] at lim_v
exact tendsto_nhds_unique ((f.continuous.tendsto g).comp hg) lim_v
Ā· -- Then we need to estimate the norm of `g`, using our careful choice of `b`.
suffices ā n, ās nā ⤠(C + ε) * āhā from
le_of_tendsto' (continuous_norm.continuousAt.tendsto.comp hg) this
intro n
have hnormā : āu 0ā ⤠C * b 0 + C * āhā := by
have :=
calc
āv 0ā ⤠āhā + āv 0 - hā := norm_le_insert' _ _
_ ⤠āhā + b 0 := by gcongr
calc
āu 0ā ⤠C * āv 0ā := hnorm_u 0
_ ⤠C * (āhā + b 0) := by gcongr
_ = C * b 0 + C * āhā := by rw [add_comm, mul_add]
have : (ā k ā range (n + 1), C * b k) ⤠ε * āhā :=
calc (ā k ā range (n + 1), C * b k)
_ = (ā k ā range (n + 1), (1 / 2 : ā) ^ k) * (ε * āhā / 2) := by
simp only [b, mul_div_cancelā _ hC.ne.symm, ā sum_mul]
_ ⤠2 * (ε * āhā / 2) := by gcongr; apply sum_geometric_two_le
_ = ε * āhā := mul_div_cancelā _ two_ne_zero
calc
ās nā ⤠ā k ā range (n + 1), āu kā := norm_sum_le _ _
_ = (ā k ā range n, āu (k + 1)ā) + āu 0ā := sum_range_succ' _ _
_ ⤠(ā k ā range n, C * āv (k + 1)ā) + āu 0ā := by gcongr; apply hnorm_u
_ ⤠(ā k ā range n, C * b (k + 1)) + (C * b 0 + C * āhā) := by
gcongr with k; exact (hv _ k.succ_pos).le
_ = (ā k ā range (n + 1), C * b k) + C * āhā := by rw [ā add_assoc, sum_range_succ']
_ ⤠(C + ε) * āhā := by
rw [add_comm, add_mul]
gcongr
/-- Given `f : NormedAddGroupHom G H` for some complete `G`, if every element `x` of the image of
an isometric immersion `j : NormedAddGroupHom K H` has a preimage under `f` whose norm is at most
`C*āxā` then the same holds for elements of the (topological) closure of this image with constant
`C+ε` instead of `C`, for any positive `ε`.
This is useful in particular if `j` is the inclusion of a normed group into its completion
(in this case the closure is the full target group).
-/
theorem controlled_closure_range_of_complete {f : NormedAddGroupHom G H} {K : Type*}
[SeminormedAddCommGroup K] {j : NormedAddGroupHom K H} (hj : ā x, āj xā = āxā) {C ε : ā}
(hC : 0 < C) (hε : 0 < ε) (hyp : ā k, ā g, f g = j k ā§ āgā ⤠C * ākā) :
f.SurjectiveOnWith j.range.topologicalClosure (C + ε) := by
replace hyp : ā h ā j.range, ā g, f g = h ā§ āgā ⤠C * āhā := by
intro h h_in
rcases (j.mem_range _).mp h_in with āØk, rflā©
rw [hj]
exact hyp k
exact controlled_closure_of_complete hC hε hyp |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Group/ZeroAtInfty.lean | import Mathlib.Topology.ContinuousMap.ZeroAtInfty
/-!
# ZeroAtInftyContinuousMapClass in normed additive groups
In this file we give a characterization of the predicate `zero_at_infty` from
`ZeroAtInftyContinuousMapClass`. A continuous map `f` is zero at infinity if and only if
for every `ε > 0` there exists a `r : ā` such that for all `x : E` with `r < āxā` it holds that
`āf xā < ε`.
-/
open Topology Filter
variable {E F š : Type*}
variable [SeminormedAddGroup E] [SeminormedAddCommGroup F]
variable [FunLike š E F] [ZeroAtInftyContinuousMapClass š E F]
theorem ZeroAtInftyContinuousMapClass.norm_le (f : š) (ε : ā) (hε : 0 < ε) :
ā (r : ā), ā (x : E) (_hx : r < āxā), āf xā < ε := by
have h := zero_at_infty f
rw [tendsto_zero_iff_norm_tendsto_zero, tendsto_def] at h
specialize h (Metric.ball 0 ε) (Metric.ball_mem_nhds 0 hε)
rcases Metric.closedBall_compl_subset_of_mem_cocompact h 0 with āØr, hrā©
use r
intro x hr'
suffices x ā (fun x ⦠āf xā) ā»Ā¹' Metric.ball 0 ε by simp_all
apply hr
simp_all
variable [ProperSpace E]
theorem zero_at_infty_of_norm_le (f : E ā F)
(h : ā (ε : ā) (_hε : 0 < ε), ā (r : ā), ā (x : E) (_hx : r < āxā), āf xā < ε) :
Tendsto f (cocompact E) (š 0) := by
rw [tendsto_zero_iff_norm_tendsto_zero]
intro s hs
rw [mem_map, Metric.mem_cocompact_iff_closedBall_compl_subset 0]
rw [Metric.mem_nhds_iff] at hs
rcases hs with āØĪµ, hε, hsā©
rcases h ε hε with āØr, hrā©
use r
intro
aesop |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Group/Hom.lean | import Mathlib.Analysis.Normed.Group.Int
import Mathlib.Analysis.Normed.Group.Subgroup
import Mathlib.Analysis.Normed.Group.Uniform
/-!
# Normed groups homomorphisms
This file gathers definitions and elementary constructions about bounded group homomorphisms
between normed (abelian) groups (abbreviated to "normed group homs").
The main lemmas relate the boundedness condition to continuity and Lipschitzness.
The main construction is to endow the type of normed group homs between two given normed groups
with a group structure and a norm, giving rise to a normed group structure. We provide several
simple constructions for normed group homs, like kernel, range and equalizer.
Some easy other constructions are related to subgroups of normed groups.
Since a lot of elementary properties don't require `āxā = 0 ā x = 0` we start setting up the
theory of `SeminormedAddGroupHom` and we specialize to `NormedAddGroupHom` when needed.
-/
noncomputable section
open NNReal
-- TODO: migrate to the new morphism / morphism_class style
/-- A morphism of seminormed abelian groups is a bounded group homomorphism. -/
structure NormedAddGroupHom (V W : Type*) [SeminormedAddCommGroup V]
[SeminormedAddCommGroup W] where
/-- The function underlying a `NormedAddGroupHom` -/
toFun : V ā W
/-- A `NormedAddGroupHom` is additive. -/
map_add' : ā vā vā, toFun (vā + vā) = toFun vā + toFun vā
/-- A `NormedAddGroupHom` is bounded. -/
bound' : ā C, ā v, ātoFun vā ⤠C * āvā
namespace AddMonoidHom
variable {V W : Type*} [SeminormedAddCommGroup V] [SeminormedAddCommGroup W]
{f g : NormedAddGroupHom V W}
/-- Associate to a group homomorphism a bounded group homomorphism under a norm control condition.
See `AddMonoidHom.mkNormedAddGroupHom'` for a version that uses `āā„0` for the bound. -/
def mkNormedAddGroupHom (f : V ā+ W) (C : ā) (h : ā v, āf vā ⤠C * āvā) : NormedAddGroupHom V W :=
{ f with bound' := āØC, hā© }
/-- Associate to a group homomorphism a bounded group homomorphism under a norm control condition.
See `AddMonoidHom.mkNormedAddGroupHom` for a version that uses `ā` for the bound. -/
def mkNormedAddGroupHom' (f : V ā+ W) (C : āā„0) (hC : ā x, āf xāā ⤠C * āxāā) :
NormedAddGroupHom V W :=
{ f with bound' := āØC, hCā© }
end AddMonoidHom
theorem exists_pos_bound_of_bound {V W : Type*} [SeminormedAddCommGroup V]
[SeminormedAddCommGroup W] {f : V ā W} (M : ā) (h : ā x, āf xā ⤠M * āxā) :
ā N, 0 < N ā§ ā x, āf xā ⤠N * āxā :=
āØmax M 1, lt_of_lt_of_le zero_lt_one (le_max_right _ _), fun x =>
calc
āf xā ⤠M * āxā := h x
_ ⤠max M 1 * āxā := by gcongr; apply le_max_left
ā©
namespace NormedAddGroupHom
variable {V Vā Vā Vā : Type*} [SeminormedAddCommGroup V] [SeminormedAddCommGroup Vā]
[SeminormedAddCommGroup Vā] [SeminormedAddCommGroup Vā]
variable {f g : NormedAddGroupHom Vā Vā}
/-- A Lipschitz continuous additive homomorphism is a normed additive group homomorphism. -/
def ofLipschitz (f : Vā ā+ Vā) {K : āā„0} (h : LipschitzWith K f) : NormedAddGroupHom Vā Vā :=
f.mkNormedAddGroupHom K fun x ⦠by simpa only [map_zero, dist_zero_right] using h.dist_le_mul x 0
instance funLike : FunLike (NormedAddGroupHom Vā Vā) Vā Vā where
coe := toFun
coe_injective' f g h := by cases f; cases g; congr
instance toAddMonoidHomClass : AddMonoidHomClass (NormedAddGroupHom Vā Vā) Vā Vā where
map_add f := f.map_add'
map_zero f := (AddMonoidHom.mk' f.toFun f.map_add').map_zero
initialize_simps_projections NormedAddGroupHom (toFun ā apply)
theorem coe_inj (H : (f : Vā ā Vā) = g) : f = g := by
cases f; cases g; congr
theorem coe_injective : @Function.Injective (NormedAddGroupHom Vā Vā) (Vā ā Vā) toFun := by
apply coe_inj
theorem coe_inj_iff : f = g ā (f : Vā ā Vā) = g :=
āØcongr_arg _, coe_injā©
@[ext]
theorem ext (H : ā x, f x = g x) : f = g :=
coe_inj <| funext H
variable (f g)
@[simp]
theorem toFun_eq_coe : f.toFun = f :=
rfl
theorem coe_mk (f) (hā) (hā) (hā) : ā(āØf, hā, hā, hāā© : NormedAddGroupHom Vā Vā) = f :=
rfl
@[simp]
theorem coe_mkNormedAddGroupHom (f : Vā ā+ Vā) (C) (hC) : ā(f.mkNormedAddGroupHom C hC) = f :=
rfl
@[simp]
theorem coe_mkNormedAddGroupHom' (f : Vā ā+ Vā) (C) (hC) : ā(f.mkNormedAddGroupHom' C hC) = f :=
rfl
/-- The group homomorphism underlying a bounded group homomorphism. -/
def toAddMonoidHom (f : NormedAddGroupHom Vā Vā) : Vā ā+ Vā :=
AddMonoidHom.mk' f f.map_add'
@[simp]
theorem coe_toAddMonoidHom : āf.toAddMonoidHom = f :=
rfl
theorem toAddMonoidHom_injective :
Function.Injective (@NormedAddGroupHom.toAddMonoidHom Vā Vā _ _) := fun f g h =>
coe_inj <| by rw [ā coe_toAddMonoidHom f, ā coe_toAddMonoidHom g, h]
@[simp]
theorem mk_toAddMonoidHom (f) (hā) (hā) :
(āØf, hā, hāā© : NormedAddGroupHom Vā Vā).toAddMonoidHom = AddMonoidHom.mk' f hā :=
rfl
theorem bound : ā C, 0 < C ā§ ā x, āf xā ⤠C * āxā :=
let āØ_C, hCā© := f.bound'
exists_pos_bound_of_bound _ hC
theorem antilipschitz_of_norm_ge {K : āā„0} (h : ā x, āxā ⤠K * āf xā) : AntilipschitzWith K f :=
AntilipschitzWith.of_le_mul_dist fun x y => by simpa only [dist_eq_norm, map_sub] using h (x - y)
/-- A normed group hom is surjective on the subgroup `K` with constant `C` if every element
`x` of `K` has a preimage whose norm is bounded above by `C*āxā`. This is a more
abstract version of `f` having a right inverse defined on `K` with operator norm
at most `C`. -/
def SurjectiveOnWith (f : NormedAddGroupHom Vā Vā) (K : AddSubgroup Vā) (C : ā) : Prop :=
ā h ā K, ā g, f g = h ā§ āgā ⤠C * āhā
theorem SurjectiveOnWith.mono {f : NormedAddGroupHom Vā Vā} {K : AddSubgroup Vā} {C C' : ā}
(h : f.SurjectiveOnWith K C) (H : C ⤠C') : f.SurjectiveOnWith K C' := by
intro k k_in
rcases h k k_in with āØg, rfl, hgā©
use g, rfl
by_cases Hg : āf gā = 0
Ā· simpa [Hg] using hg
Ā· exact hg.trans (by gcongr)
theorem SurjectiveOnWith.exists_pos {f : NormedAddGroupHom Vā Vā} {K : AddSubgroup Vā} {C : ā}
(h : f.SurjectiveOnWith K C) : ā C' > 0, f.SurjectiveOnWith K C' := by
refine āØ|C| + 1, ?_, ?_ā©
Ā· linarith [abs_nonneg C]
Ā· apply h.mono
linarith [le_abs_self C]
theorem SurjectiveOnWith.surjOn {f : NormedAddGroupHom Vā Vā} {K : AddSubgroup Vā} {C : ā}
(h : f.SurjectiveOnWith K C) : Set.SurjOn f Set.univ K := fun x hx =>
(h x hx).imp fun _a āØha, _ā© => āØSet.mem_univ _, haā©
/-! ### The operator norm -/
/-- The operator norm of a seminormed group homomorphism is the inf of all its bounds. -/
def opNorm (f : NormedAddGroupHom Vā Vā) :=
sInf { c | 0 ⤠c ā§ ā x, āf xā ⤠c * āxā }
instance hasOpNorm : Norm (NormedAddGroupHom Vā Vā) :=
āØopNormā©
theorem norm_def : āfā = sInf { c | 0 ⤠c ā§ ā x, āf xā ⤠c * āxā } :=
rfl
-- So that invocations of `le_csInf` make sense: we show that the set of
-- bounds is nonempty and bounded below.
theorem bounds_nonempty {f : NormedAddGroupHom Vā Vā} :
ā c, c ā { c | 0 ⤠c ā§ ā x, āf xā ⤠c * āxā } :=
let āØM, hMp, hMbā© := f.bound
āØM, le_of_lt hMp, hMbā©
theorem bounds_bddBelow {f : NormedAddGroupHom Vā Vā} :
BddBelow { c | 0 ⤠c ā§ ā x, āf xā ⤠c * āxā } :=
āØ0, fun _ āØhn, _ā© => hnā©
theorem opNorm_nonneg : 0 ⤠āfā :=
le_csInf bounds_nonempty fun _ āØhx, _ā© => hx
/-- The fundamental property of the operator norm: `āf xā ⤠āfā * āxā`. -/
theorem le_opNorm (x : Vā) : āf xā ⤠āfā * āxā := by
obtain āØC, _Cpos, hCā© := f.bound
replace hC := hC x
by_cases h : āxā = 0
Ā· rwa [h, mul_zero] at hC ā¢
have hlt : 0 < āxā := lt_of_le_of_ne (norm_nonneg x) (Ne.symm h)
exact
(div_le_iffā hlt).mp
(le_csInf bounds_nonempty fun c āØ_, hcā© => (div_le_iffā hlt).mpr <| by apply hc)
theorem le_opNorm_of_le {c : ā} {x} (h : āxā ⤠c) : āf xā ⤠āfā * c :=
le_trans (f.le_opNorm x) (by gcongr; exact f.opNorm_nonneg)
theorem le_of_opNorm_le {c : ā} (h : āfā ⤠c) (x : Vā) : āf xā ⤠c * āxā :=
(f.le_opNorm x).trans (by gcongr)
/-- continuous linear maps are Lipschitz continuous. -/
theorem lipschitz : LipschitzWith āØāfā, opNorm_nonneg fā© f :=
LipschitzWith.of_dist_le_mul fun x y => by
rw [dist_eq_norm, dist_eq_norm, ā map_sub]
apply le_opNorm
protected theorem uniformContinuous (f : NormedAddGroupHom Vā Vā) : UniformContinuous f :=
f.lipschitz.uniformContinuous
@[continuity]
protected theorem continuous (f : NormedAddGroupHom Vā Vā) : Continuous f :=
f.uniformContinuous.continuous
instance : ContinuousMapClass (NormedAddGroupHom Vā Vā) Vā Vā where
map_continuous := fun f => f.continuous
theorem ratio_le_opNorm (x : Vā) : āf xā / āxā ⤠āfā :=
div_le_of_le_mulā (norm_nonneg _) f.opNorm_nonneg (le_opNorm _ _)
/-- If one controls the norm of every `f x`, then one controls the norm of `f`. -/
theorem opNorm_le_bound {M : ā} (hMp : 0 ⤠M) (hM : ā x, āf xā ⤠M * āxā) : āfā ⤠M :=
csInf_le bounds_bddBelow āØhMp, hMā©
theorem opNorm_eq_of_bounds {M : ā} (M_nonneg : 0 ⤠M) (h_above : ā x, āf xā ⤠M * āxā)
(h_below : ā N ā„ 0, (ā x, āf xā ⤠N * āxā) ā M ⤠N) : āfā = M :=
le_antisymm (f.opNorm_le_bound M_nonneg h_above)
((le_csInf_iff NormedAddGroupHom.bounds_bddBelow āØM, M_nonneg, h_aboveā©).mpr
fun N āØN_nonneg, hNā© => h_below N N_nonneg hN)
theorem opNorm_le_of_lipschitz {f : NormedAddGroupHom Vā Vā} {K : āā„0} (hf : LipschitzWith K f) :
āfā ⤠K :=
f.opNorm_le_bound K.2 fun x => by simpa only [dist_zero_right, map_zero] using hf.dist_le_mul x 0
/-- If a bounded group homomorphism map is constructed from a group homomorphism via the constructor
`AddMonoidHom.mkNormedAddGroupHom`, then its norm is bounded by the bound given to the constructor
if it is nonnegative. -/
theorem mkNormedAddGroupHom_norm_le (f : Vā ā+ Vā) {C : ā} (hC : 0 ⤠C) (h : ā x, āf xā ⤠C * āxā) :
āf.mkNormedAddGroupHom C hā ⤠C :=
opNorm_le_bound _ hC h
/-- If a bounded group homomorphism map is constructed from a group homomorphism via the constructor
`NormedAddGroupHom.ofLipschitz`, then its norm is bounded by the bound given to the constructor. -/
theorem ofLipschitz_norm_le (f : Vā ā+ Vā) {K : āā„0} (h : LipschitzWith K f) :
āofLipschitz f hā ⤠K :=
mkNormedAddGroupHom_norm_le f K.coe_nonneg _
/-- If a bounded group homomorphism map is constructed from a group homomorphism
via the constructor `AddMonoidHom.mkNormedAddGroupHom`, then its norm is bounded by the bound
given to the constructor or zero if this bound is negative. -/
theorem mkNormedAddGroupHom_norm_le' (f : Vā ā+ Vā) {C : ā} (h : ā x, āf xā ⤠C * āxā) :
āf.mkNormedAddGroupHom C hā ⤠max C 0 :=
opNorm_le_bound _ (le_max_right _ _) fun x =>
(h x).trans <| by gcongr; apply le_max_left
alias _root_.AddMonoidHom.mkNormedAddGroupHom_norm_le := mkNormedAddGroupHom_norm_le
alias _root_.AddMonoidHom.mkNormedAddGroupHom_norm_le' := mkNormedAddGroupHom_norm_le'
/-! ### Addition of normed group homs -/
/-- Addition of normed group homs. -/
instance add : Add (NormedAddGroupHom Vā Vā) :=
āØfun f g =>
(f.toAddMonoidHom + g.toAddMonoidHom).mkNormedAddGroupHom (āfā + āgā) fun v =>
calc
āf v + g vā ⤠āf vā + āg vā := norm_add_le _ _
_ ⤠āfā * āvā + āgā * āvā := by gcongr <;> apply le_opNorm
_ = (āfā + āgā) * āvā := by rw [add_mul]
ā©
/-- The operator norm satisfies the triangle inequality. -/
theorem opNorm_add_le : āf + gā ⤠āfā + āgā :=
mkNormedAddGroupHom_norm_le _ (add_nonneg (opNorm_nonneg _) (opNorm_nonneg _)) _
@[simp]
theorem coe_add (f g : NormedAddGroupHom Vā Vā) : ā(f + g) = f + g :=
rfl
@[simp]
theorem add_apply (f g : NormedAddGroupHom Vā Vā) (v : Vā) :
(f + g) v = f v + g v :=
rfl
/-! ### The zero normed group hom -/
instance zero : Zero (NormedAddGroupHom Vā Vā) :=
āØ(0 : Vā ā+ Vā).mkNormedAddGroupHom 0 (by simp)ā©
instance inhabited : Inhabited (NormedAddGroupHom Vā Vā) :=
āØ0ā©
/-- The norm of the `0` operator is `0`. -/
theorem opNorm_zero : ā(0 : NormedAddGroupHom Vā Vā)ā = 0 :=
le_antisymm
(csInf_le bounds_bddBelow
āØge_of_eq rfl, fun _ =>
le_of_eq
(by
rw [zero_mul]
exact norm_zero)ā©)
(opNorm_nonneg _)
/-- For normed groups, an operator is zero iff its norm vanishes. -/
theorem opNorm_zero_iff {Vā Vā : Type*} [NormedAddCommGroup Vā] [NormedAddCommGroup Vā]
{f : NormedAddGroupHom Vā Vā} : āfā = 0 ā f = 0 :=
Iff.intro
(fun hn =>
ext fun x =>
norm_le_zero_iff.1
(calc
_ ⤠āfā * āxā := le_opNorm _ _
_ = _ := by rw [hn, zero_mul]
))
fun hf => by rw [hf, opNorm_zero]
@[simp]
theorem coe_zero : ā(0 : NormedAddGroupHom Vā Vā) = 0 :=
rfl
@[simp]
theorem zero_apply (v : Vā) : (0 : NormedAddGroupHom Vā Vā) v = 0 :=
rfl
variable {f g}
/-! ### The identity normed group hom -/
variable (V)
/-- The identity as a continuous normed group hom. -/
@[simps!]
def id : NormedAddGroupHom V V :=
(AddMonoidHom.id V).mkNormedAddGroupHom 1 (by simp [le_refl])
/-- The norm of the identity is at most `1`. It is in fact `1`, except when the norm of every
element vanishes, where it is `0`. (Since we are working with seminorms this can happen even if the
space is non-trivial.) It means that one cannot do better than an inequality in general. -/
theorem norm_id_le : ā(id V : NormedAddGroupHom V V)ā ⤠1 :=
opNorm_le_bound _ zero_le_one fun x => by simp
/-- If there is an element with norm different from `0`, then the norm of the identity equals `1`.
(Since we are working with seminorms supposing that the space is non-trivial is not enough.) -/
theorem norm_id_of_nontrivial_seminorm (h : ā x : V, āxā ā 0) : āid Vā = 1 :=
le_antisymm (norm_id_le V) <| by
let āØx, hxā© := h
have := (id V).ratio_le_opNorm x
rwa [id_apply, div_self hx] at this
/-- If a normed space is non-trivial, then the norm of the identity equals `1`. -/
theorem norm_id {V : Type*} [NormedAddCommGroup V] [Nontrivial V] : āid Vā = 1 := by
refine norm_id_of_nontrivial_seminorm V ?_
obtain āØx, hxā© := exists_ne (0 : V)
exact āØx, ne_of_gt (norm_pos_iff.2 hx)ā©
theorem coe_id : (NormedAddGroupHom.id V : V ā V) = _root_.id :=
rfl
/-! ### The negation of a normed group hom -/
/-- Opposite of a normed group hom. -/
instance neg : Neg (NormedAddGroupHom Vā Vā) :=
āØfun f => (-f.toAddMonoidHom).mkNormedAddGroupHom āfā fun v => by simp [le_opNorm f v]ā©
@[simp]
theorem coe_neg (f : NormedAddGroupHom Vā Vā) : ā(-f) = -f :=
rfl
@[simp]
theorem neg_apply (f : NormedAddGroupHom Vā Vā) (v : Vā) :
(-f : NormedAddGroupHom Vā Vā) v = -f v :=
rfl
theorem opNorm_neg (f : NormedAddGroupHom Vā Vā) : ā-fā = āfā := by
simp only [norm_def, coe_neg, norm_neg, Pi.neg_apply]
/-! ### Subtraction of normed group homs -/
/-- Subtraction of normed group homs. -/
instance sub : Sub (NormedAddGroupHom Vā Vā) :=
āØfun f g =>
{ f.toAddMonoidHom - g.toAddMonoidHom with
bound' := by
simp only [AddMonoidHom.toFun_eq_coe, sub_eq_add_neg]
exact (f + -g).bound' }ā©
@[simp]
theorem coe_sub (f g : NormedAddGroupHom Vā Vā) : ā(f - g) = f - g :=
rfl
@[simp]
theorem sub_apply (f g : NormedAddGroupHom Vā Vā) (v : Vā) :
(f - g : NormedAddGroupHom Vā Vā) v = f v - g v :=
rfl
/-! ### Scalar actions on normed group homs -/
section SMul
variable {R R' : Type*} [MonoidWithZero R] [DistribMulAction R Vā] [PseudoMetricSpace R]
[IsBoundedSMul R Vā] [MonoidWithZero R'] [DistribMulAction R' Vā] [PseudoMetricSpace R']
[IsBoundedSMul R' Vā]
instance smul : SMul R (NormedAddGroupHom Vā Vā) where
smul r f :=
{ toFun := r ⢠āf
map_add' := (r ⢠f.toAddMonoidHom).map_add'
bound' :=
let āØb, hbā© := f.bound'
āØdist r 0 * b, fun x => by
have := dist_smul_pair r (f x) (f 0)
rw [map_zero, smul_zero, dist_zero_right, dist_zero_right] at this
rw [mul_assoc]
refine this.trans ?_
gcongr
exact hb xā© }
@[simp]
theorem coe_smul (r : R) (f : NormedAddGroupHom Vā Vā) : ā(r ⢠f) = r ⢠āf :=
rfl
@[simp]
theorem smul_apply (r : R) (f : NormedAddGroupHom Vā Vā) (v : Vā) : (r ⢠f) v = r ⢠f v :=
rfl
instance smulCommClass [SMulCommClass R R' Vā] :
SMulCommClass R R' (NormedAddGroupHom Vā Vā) where
smul_comm _ _ _ := ext fun _ => smul_comm _ _ _
instance isScalarTower [SMul R R'] [IsScalarTower R R' Vā] :
IsScalarTower R R' (NormedAddGroupHom Vā Vā) where
smul_assoc _ _ _ := ext fun _ => smul_assoc _ _ _
instance isCentralScalar [DistribMulAction Rįµįµįµ Vā] [IsCentralScalar R Vā] :
IsCentralScalar R (NormedAddGroupHom Vā Vā) where
op_smul_eq_smul _ _ := ext fun _ => op_smul_eq_smul _ _
end SMul
instance nsmul : SMul ā (NormedAddGroupHom Vā Vā) where
smul n f :=
{ toFun := n ⢠āf
map_add' := (n ⢠f.toAddMonoidHom).map_add'
bound' :=
let āØb, hbā© := f.bound'
āØn ⢠b, fun v => by
rw [Pi.smul_apply, nsmul_eq_mul, mul_assoc]
exact norm_nsmul_le.trans (by gcongr; apply hb)ā© }
@[simp]
theorem coe_nsmul (r : ā) (f : NormedAddGroupHom Vā Vā) : ā(r ⢠f) = r ⢠āf :=
rfl
@[simp]
theorem nsmul_apply (r : ā) (f : NormedAddGroupHom Vā Vā) (v : Vā) : (r ⢠f) v = r ⢠f v :=
rfl
instance zsmul : SMul ⤠(NormedAddGroupHom Vā Vā) where
smul z f :=
{ toFun := z ⢠āf
map_add' := (z ⢠f.toAddMonoidHom).map_add'
bound' :=
let āØb, hbā© := f.bound'
āØāzā ⢠b, fun v => by
rw [Pi.smul_apply, smul_eq_mul, mul_assoc]
exact (norm_zsmul_le _ _).trans (by gcongr; apply hb)ā© }
@[simp]
theorem coe_zsmul (r : ā¤) (f : NormedAddGroupHom Vā Vā) : ā(r ⢠f) = r ⢠āf :=
rfl
@[simp]
theorem zsmul_apply (r : ā¤) (f : NormedAddGroupHom Vā Vā) (v : Vā) : (r ⢠f) v = r ⢠f v :=
rfl
/-! ### Normed group structure on normed group homs -/
/-- Homs between two given normed groups form a commutative additive group. -/
instance toAddCommGroup : AddCommGroup (NormedAddGroupHom Vā Vā) :=
coe_injective.addCommGroup _ rfl (fun _ _ => rfl) (fun _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl)
fun _ _ => rfl
/-- Normed group homomorphisms themselves form a seminormed group with respect to
the operator norm. -/
instance toSeminormedAddCommGroup : SeminormedAddCommGroup (NormedAddGroupHom Vā Vā) :=
AddGroupSeminorm.toSeminormedAddCommGroup
{ toFun := opNorm
map_zero' := opNorm_zero
neg' := opNorm_neg
add_le' := opNorm_add_le }
/-- Normed group homomorphisms themselves form a normed group with respect to
the operator norm. -/
instance toNormedAddCommGroup {Vā Vā : Type*} [NormedAddCommGroup Vā] [NormedAddCommGroup Vā] :
NormedAddCommGroup (NormedAddGroupHom Vā Vā) :=
AddGroupNorm.toNormedAddCommGroup
{ toFun := opNorm
map_zero' := opNorm_zero
neg' := opNorm_neg
add_le' := opNorm_add_le
eq_zero_of_map_eq_zero' := fun _f => opNorm_zero_iff.1 }
/-- Coercion of a `NormedAddGroupHom` is an `AddMonoidHom`. Similar to `AddMonoidHom.coeFn`. -/
@[simps]
def coeAddHom : NormedAddGroupHom Vā Vā ā+ Vā ā Vā where
toFun := DFunLike.coe
map_zero' := coe_zero
map_add' := coe_add
@[simp]
theorem coe_sum {ι : Type*} (s : Finset ι) (f : ι ā NormedAddGroupHom Vā Vā) :
ā(ā i ā s, f i) = ā i ā s, (f i : Vā ā Vā) :=
map_sum coeAddHom f s
theorem sum_apply {ι : Type*} (s : Finset ι) (f : ι ā NormedAddGroupHom Vā Vā) (v : Vā) :
(ā i ā s, f i) v = ā i ā s, f i v := by simp only [coe_sum, Finset.sum_apply]
/-! ### Module structure on normed group homs -/
instance distribMulAction {R : Type*} [MonoidWithZero R] [DistribMulAction R Vā]
[PseudoMetricSpace R] [IsBoundedSMul R Vā] : DistribMulAction R (NormedAddGroupHom Vā Vā) :=
Function.Injective.distribMulAction coeAddHom coe_injective coe_smul
instance module {R : Type*} [Semiring R] [Module R Vā] [PseudoMetricSpace R] [IsBoundedSMul R Vā] :
Module R (NormedAddGroupHom Vā Vā) :=
Function.Injective.module _ coeAddHom coe_injective coe_smul
/-! ### Composition of normed group homs -/
/-- The composition of continuous normed group homs. -/
@[simps!]
protected def comp (g : NormedAddGroupHom Vā Vā) (f : NormedAddGroupHom Vā Vā) :
NormedAddGroupHom Vā Vā :=
(g.toAddMonoidHom.comp f.toAddMonoidHom).mkNormedAddGroupHom (āgā * āfā) fun v =>
calc
āg (f v)ā ⤠āgā * āf vā := le_opNorm _ _
_ ⤠āgā * (āfā * āvā) := by gcongr; apply le_opNorm
_ = āgā * āfā * āvā := by rw [mul_assoc]
theorem norm_comp_le (g : NormedAddGroupHom Vā Vā) (f : NormedAddGroupHom Vā Vā) :
āg.comp fā ⤠āgā * āfā :=
mkNormedAddGroupHom_norm_le _ (by positivity) _
theorem norm_comp_le_of_le {g : NormedAddGroupHom Vā Vā} {Cā Cā : ā} (hg : āgā ⤠Cā)
(hf : āfā ⤠Cā) : āg.comp fā ⤠Cā * Cā :=
le_trans (norm_comp_le g f) <| by gcongr; exact le_trans (norm_nonneg _) hg
theorem norm_comp_le_of_le' {g : NormedAddGroupHom Vā Vā} (Cā Cā Cā : ā) (h : Cā = Cā * Cā)
(hg : āgā ⤠Cā) (hf : āfā ⤠Cā) : āg.comp fā ⤠Cā := by
rw [h]
exact norm_comp_le_of_le hg hf
/-- Composition of normed groups hom as an additive group morphism. -/
def compHom : NormedAddGroupHom Vā Vā ā+ NormedAddGroupHom Vā Vā ā+ NormedAddGroupHom Vā Vā :=
AddMonoidHom.mk'
(fun g =>
AddMonoidHom.mk' (fun f => g.comp f)
(by
intros
ext
exact map_add g _ _))
(by
intros
ext
simp only [comp_apply, Pi.add_apply, AddMonoidHom.add_apply,
AddMonoidHom.mk'_apply, coe_add])
@[simp]
theorem comp_zero (f : NormedAddGroupHom Vā Vā) : f.comp (0 : NormedAddGroupHom Vā Vā) = 0 := by
ext
exact map_zero f
@[simp]
theorem zero_comp (f : NormedAddGroupHom Vā Vā) : (0 : NormedAddGroupHom Vā Vā).comp f = 0 := by
ext
rfl
theorem comp_assoc {Vā : Type*} [SeminormedAddCommGroup Vā] (h : NormedAddGroupHom Vā Vā)
(g : NormedAddGroupHom Vā Vā) (f : NormedAddGroupHom Vā Vā) :
(h.comp g).comp f = h.comp (g.comp f) := by
ext
rfl
theorem coe_comp (f : NormedAddGroupHom Vā Vā) (g : NormedAddGroupHom Vā Vā) :
(g.comp f : Vā ā Vā) = (g : Vā ā Vā) ā (f : Vā ā Vā) :=
rfl
end NormedAddGroupHom
namespace NormedAddGroupHom
variable {V W Vā Vā Vā : Type*} [SeminormedAddCommGroup V] [SeminormedAddCommGroup W]
[SeminormedAddCommGroup Vā] [SeminormedAddCommGroup Vā] [SeminormedAddCommGroup Vā]
/-- The inclusion of an `AddSubgroup`, as bounded group homomorphism. -/
@[simps!]
def incl (s : AddSubgroup V) : NormedAddGroupHom s V where
toFun := (Subtype.val : s ā V)
map_add' _ _ := AddSubgroup.coe_add _ _ _
bound' := āØ1, fun v => by rw [one_mul, AddSubgroup.coe_norm]ā©
theorem norm_incl {V' : AddSubgroup V} (x : V') : āincl _ xā = āxā :=
rfl
/-!### Kernel -/
section Kernels
variable (f : NormedAddGroupHom Vā Vā) (g : NormedAddGroupHom Vā Vā)
/-- The kernel of a bounded group homomorphism. Naturally endowed with a
`SeminormedAddCommGroup` instance. -/
def ker : AddSubgroup Vā :=
f.toAddMonoidHom.ker
theorem mem_ker (v : Vā) : v ā f.ker ā f v = 0 := by
rw [ker, f.toAddMonoidHom.mem_ker, coe_toAddMonoidHom]
/-- Given a normed group hom `f : Vā ā Vā` satisfying `g.comp f = 0` for some `g : Vā ā Vā`,
the corestriction of `f` to the kernel of `g`. -/
@[simps]
def ker.lift (h : g.comp f = 0) : NormedAddGroupHom Vā g.ker where
toFun v := āØf v, by rw [g.mem_ker, ā comp_apply g f, h, zero_apply]ā©
map_add' v w := by simp only [map_add, AddMemClass.mk_add_mk]
bound' := f.bound'
@[simp]
theorem ker.incl_comp_lift (h : g.comp f = 0) : (incl g.ker).comp (ker.lift f g h) = f := by
ext
rfl
@[simp]
theorem ker_zero : (0 : NormedAddGroupHom Vā Vā).ker = ⤠:= by
ext
simp [mem_ker]
theorem coe_ker : (f.ker : Set Vā) = (f : Vā ā Vā) ā»Ā¹' {0} :=
rfl
theorem isClosed_ker {Vā : Type*} [NormedAddCommGroup Vā] (f : NormedAddGroupHom Vā Vā) :
IsClosed (f.ker : Set Vā) :=
f.coe_ker āø IsClosed.preimage f.continuous (T1Space.t1 0)
end Kernels
/-! ### Range -/
section Range
variable (f : NormedAddGroupHom Vā Vā) (g : NormedAddGroupHom Vā Vā)
/-- The image of a bounded group homomorphism. Naturally endowed with a
`SeminormedAddCommGroup` instance. -/
def range : AddSubgroup Vā :=
f.toAddMonoidHom.range
theorem mem_range (v : Vā) : v ā f.range ā ā w, f w = v := Iff.rfl
@[simp]
theorem mem_range_self (v : Vā) : f v ā f.range :=
āØv, rflā©
theorem comp_range : (g.comp f).range = AddSubgroup.map g.toAddMonoidHom f.range := by
unfold range
rw [AddMonoidHom.map_range]
rfl
theorem incl_range (s : AddSubgroup Vā) : (incl s).range = s := by
ext x
exact āØfun āØy, hyā© => by rw [ā hy]; simp, fun hx => āØāØx, hxā©, by simpā©ā©
@[simp]
theorem range_comp_incl_top : (f.comp (incl (⤠: AddSubgroup Vā))).range = f.range := by
simp [comp_range, incl_range, ā AddMonoidHom.range_eq_map]; rfl
end Range
variable {f : NormedAddGroupHom V W}
/-- A `NormedAddGroupHom` is *norm-nonincreasing* if `āf vā ⤠āvā` for all `v`. -/
def NormNoninc (f : NormedAddGroupHom V W) : Prop :=
ā v, āf vā ⤠āvā
namespace NormNoninc
theorem normNoninc_iff_norm_le_one : f.NormNoninc ā āfā ⤠1 := by
refine āØfun h => ?_, fun h => fun v => ?_ā©
Ā· refine opNorm_le_bound _ zero_le_one fun v => ?_
simpa [one_mul] using h v
Ā· simpa using le_of_opNorm_le f h v
theorem zero : (0 : NormedAddGroupHom Vā Vā).NormNoninc := fun v => by simp
theorem id : (id V).NormNoninc := fun _v => le_rfl
theorem comp {g : NormedAddGroupHom Vā Vā} {f : NormedAddGroupHom Vā Vā} (hg : g.NormNoninc)
(hf : f.NormNoninc) : (g.comp f).NormNoninc := fun v => (hg (f v)).trans (hf v)
@[simp]
theorem neg_iff {f : NormedAddGroupHom Vā Vā} : (-f).NormNoninc ā f.NormNoninc :=
āØfun h x => by simpa using h x, fun h x => (norm_neg (f x)).le.trans (h x)ā©
end NormNoninc
section Isometry
theorem norm_eq_of_isometry {f : NormedAddGroupHom V W} (hf : Isometry f) (v : V) : āf vā = āvā :=
(AddMonoidHomClass.isometry_iff_norm f).mp hf v
theorem isometry_id : @Isometry V V _ _ (id V) :=
_root_.isometry_id
theorem isometry_comp {g : NormedAddGroupHom Vā Vā} {f : NormedAddGroupHom Vā Vā} (hg : Isometry g)
(hf : Isometry f) : Isometry (g.comp f) :=
hg.comp hf
theorem normNoninc_of_isometry (hf : Isometry f) : f.NormNoninc := fun v =>
le_of_eq <| norm_eq_of_isometry hf v
end Isometry
variable {Wā Wā Wā : Type*} [SeminormedAddCommGroup Wā] [SeminormedAddCommGroup Wā]
[SeminormedAddCommGroup Wā]
variable (f) (g : NormedAddGroupHom V W)
variable {fā gā : NormedAddGroupHom Vā Wā}
variable {fā gā : NormedAddGroupHom Vā Wā}
variable {fā gā : NormedAddGroupHom Vā Wā}
/-- The equalizer of two morphisms `f g : NormedAddGroupHom V W`. -/
def equalizer :=
(f - g).ker
namespace Equalizer
/-- The inclusion of `f.equalizer g` as a `NormedAddGroupHom`. -/
def ι : NormedAddGroupHom (f.equalizer g) V :=
incl _
theorem comp_ι_eq : f.comp (ι f g) = g.comp (ι f g) := by
ext x
rw [comp_apply, comp_apply, ā sub_eq_zero, ā NormedAddGroupHom.sub_apply]
exact x.2
variable {f g}
/-- If `Ļ : NormedAddGroupHom Vā V` is such that `f.comp Ļ = g.comp Ļ`, the induced morphism
`NormedAddGroupHom Vā (f.equalizer g)`. -/
@[simps]
def lift (Ļ : NormedAddGroupHom Vā V) (h : f.comp Ļ = g.comp Ļ) :
NormedAddGroupHom Vā (f.equalizer g) where
toFun v :=
āØĻ v,
show (f - g) (Ļ v) = 0 by
rw [NormedAddGroupHom.sub_apply, sub_eq_zero, ā comp_apply, h, comp_apply]ā©
map_add' vā vā := by
ext
simp only [map_add, AddSubgroup.coe_add]
bound' := by
obtain āØC, _C_pos, hCā© := Ļ.bound
exact āØC, hCā©
@[simp]
theorem ι_comp_lift (Ļ : NormedAddGroupHom Vā V) (h : f.comp Ļ = g.comp Ļ) :
(ι _ _).comp (lift Ļ h) = Ļ := by
ext
rfl
/-- The lifting property of the equalizer as an equivalence. -/
@[simps]
def liftEquiv :
{ Ļ : NormedAddGroupHom Vā V // f.comp Ļ = g.comp Ļ } ā
NormedAddGroupHom Vā (f.equalizer g) where
toFun Ļ := lift Ļ Ļ.prop
invFun Ļ := āØ(ι f g).comp Ļ, by rw [ā comp_assoc, ā comp_assoc, comp_ι_eq]ā©
left_inv Ļ := by simp
/-- Given `Ļ : NormedAddGroupHom Vā Vā` and `Ļ : NormedAddGroupHom Wā Wā` such that
`Ļ.comp fā = fā.comp Ļ` and `Ļ.comp gā = gā.comp Ļ`, the induced morphism
`NormedAddGroupHom (fā.equalizer gā) (fā.equalizer gā)`. -/
def map (Ļ : NormedAddGroupHom Vā Vā) (Ļ : NormedAddGroupHom Wā Wā) (hf : Ļ.comp fā = fā.comp Ļ)
(hg : Ļ.comp gā = gā.comp Ļ) : NormedAddGroupHom (fā.equalizer gā) (fā.equalizer gā) :=
lift (Ļ.comp <| ι _ _) <| by
simp only [ā comp_assoc, ā hf, ā hg]
simp only [comp_assoc, comp_ι_eq fā gā]
variable {Ļ : NormedAddGroupHom Vā Vā} {Ļ : NormedAddGroupHom Wā Wā}
variable {Ļ' : NormedAddGroupHom Vā Vā} {Ļ' : NormedAddGroupHom Wā Wā}
@[simp]
theorem ι_comp_map (hf : Ļ.comp fā = fā.comp Ļ) (hg : Ļ.comp gā = gā.comp Ļ) :
(ι fā gā).comp (map Ļ Ļ hf hg) = Ļ.comp (ι fā gā) :=
ι_comp_lift _ _
@[simp]
theorem map_id : map (fā := fā) (gā := gā) (id Vā) (id Wā) rfl rfl = id (fā.equalizer gā) := by
ext
rfl
theorem comm_sqā (hf : Ļ.comp fā = fā.comp Ļ) (hf' : Ļ'.comp fā = fā.comp Ļ') :
(Ļ'.comp Ļ).comp fā = fā.comp (Ļ'.comp Ļ) := by
rw [comp_assoc, hf, ā comp_assoc, hf', comp_assoc]
theorem map_comp_map (hf : Ļ.comp fā = fā.comp Ļ) (hg : Ļ.comp gā = gā.comp Ļ)
(hf' : Ļ'.comp fā = fā.comp Ļ') (hg' : Ļ'.comp gā = gā.comp Ļ') :
(map Ļ' Ļ' hf' hg').comp (map Ļ Ļ hf hg) =
map (Ļ'.comp Ļ) (Ļ'.comp Ļ) (comm_sqā hf hf') (comm_sqā hg hg') := by
ext
rfl
theorem ι_normNoninc : (ι f g).NormNoninc := fun _v => le_rfl
/-- The lifting of a norm nonincreasing morphism is norm nonincreasing. -/
theorem lift_normNoninc (Ļ : NormedAddGroupHom Vā V) (h : f.comp Ļ = g.comp Ļ) (hĻ : Ļ.NormNoninc) :
(lift Ļ h).NormNoninc :=
hĻ
/-- If `Ļ` satisfies `āĻā ⤠C`, then the same is true for the lifted morphism. -/
theorem norm_lift_le (Ļ : NormedAddGroupHom Vā V) (h : f.comp Ļ = g.comp Ļ) (C : ā) (hĻ : āĻā ⤠C) :
ālift Ļ hā ⤠C :=
hĻ
theorem map_normNoninc (hf : Ļ.comp fā = fā.comp Ļ) (hg : Ļ.comp gā = gā.comp Ļ)
(hĻ : Ļ.NormNoninc) : (map Ļ Ļ hf hg).NormNoninc :=
lift_normNoninc _ _ <| hĻ.comp ι_normNoninc
theorem norm_map_le (hf : Ļ.comp fā = fā.comp Ļ) (hg : Ļ.comp gā = gā.comp Ļ) (C : ā)
(hĻ : āĻ.comp (ι fā gā)ā ⤠C) : āmap Ļ Ļ hf hgā ⤠C :=
norm_lift_le _ _ _ hĻ
end Equalizer
end NormedAddGroupHom |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Group/SemiNormedGrp/Completion.lean | import Mathlib.Analysis.Normed.Group.SemiNormedGrp
import Mathlib.CategoryTheory.Preadditive.AdditiveFunctor
import Mathlib.Analysis.Normed.Group.HomCompletion
/-!
# Completions of normed groups
This file contains an API for completions of seminormed groups (basic facts about
objects and morphisms).
## Main definitions
- `SemiNormedGrp.Completion : SemiNormedGrp ℤ SemiNormedGrp` : the completion of a
seminormed group (defined as a functor on `SemiNormedGrp` to itself).
- `SemiNormedGrp.Completion.lift (f : V ā¶ W) : (Completion.obj V ā¶ W)` : a normed group hom
from `V` to complete `W` extends ("lifts") to a seminormed group hom from the completion of
`V` to `W`.
## Projects
1. Construct the category of complete seminormed groups, say `CompleteSemiNormedGrp`
and promote the `Completion` functor below to a functor landing in this category.
2. Prove that the functor `Completion : SemiNormedGrp ℤ CompleteSemiNormedGrp`
is left adjoint to the forgetful functor.
-/
noncomputable section
universe u
open UniformSpace MulOpposite CategoryTheory NormedAddGroupHom
namespace SemiNormedGrp
/-- The completion of a seminormed group, as an endofunctor on `SemiNormedGrp`. -/
@[simps]
def completion : SemiNormedGrp.{u} ℤ SemiNormedGrp.{u} where
obj V := SemiNormedGrp.of (Completion V)
map f := SemiNormedGrp.ofHom f.hom.completion
map_id _ := SemiNormedGrp.hom_ext completion_id
map_comp f g := SemiNormedGrp.hom_ext (completion_comp f.hom g.hom).symm
instance completion_completeSpace {V : SemiNormedGrp} : CompleteSpace (completion.obj V) :=
Completion.completeSpace _
/-- The canonical morphism from a seminormed group `V` to its completion. -/
def completion.incl {V : SemiNormedGrp} : V ā¶ completion.obj V :=
ofHom
{ toFun v := (v : Completion V)
map_add' := Completion.coe_add
bound' := āØ1, fun v => by simpā© }
theorem completion.norm_incl_eq {V : SemiNormedGrp} {v : V} : ācompletion.incl vā = āvā :=
UniformSpace.Completion.norm_coe _
theorem completion.map_normNoninc {V W : SemiNormedGrp} {f : V ā¶ W} (hf : f.hom.NormNoninc) :
(completion.map f).hom.NormNoninc :=
NormedAddGroupHom.NormNoninc.normNoninc_iff_norm_le_one.2 <|
(NormedAddGroupHom.norm_completion f.hom).le.trans <|
NormedAddGroupHom.NormNoninc.normNoninc_iff_norm_le_one.1 hf
variable (V W : SemiNormedGrp)
/-- Given a normed group hom `V ā¶ W`, this defines the associated morphism
from the completion of `V` to the completion of `W`.
The difference from the definition obtained from the functoriality of completion is in that the
map sending a morphism `f` to the associated morphism of completions is itself additive. -/
def completion.mapHom (V W : SemiNormedGrp.{u}) :
(V ā¶ W) ā+ (completion.obj V ā¶ completion.obj W) :=
@AddMonoidHom.mk' _ _ (_) (_) completion.map fun f g =>
SemiNormedGrp.hom_ext (f.hom.completion_add g.hom)
theorem completion.map_zero (V W : SemiNormedGrp) : completion.map (0 : V ā¶ W) = 0 :=
(completion.mapHom V W).map_zero
instance : Preadditive SemiNormedGrp.{u} where
instance : Functor.Additive completion where
map_add := SemiNormedGrp.hom_ext <| NormedAddGroupHom.completion_add _ _
/-- Given a normed group hom `f : V ā W` with `W` complete, this provides a lift of `f` to
the completion of `V`. The lemmas `lift_unique` and `lift_comp_incl` provide the api for the
universal property of the completion. -/
def completion.lift {V W : SemiNormedGrp} [CompleteSpace W] [T0Space W] (f : V ā¶ W) :
completion.obj V ā¶ W :=
ofHom
{ toFun := f.hom.extension
map_add' := f.hom.extension.toAddMonoidHom.map_add'
bound' := f.hom.extension.bound' }
theorem completion.lift_comp_incl {V W : SemiNormedGrp} [CompleteSpace W] [T0Space W]
(f : V ā¶ W) : completion.incl ā« completion.lift f = f :=
ext <| NormedAddGroupHom.extension_coe _
theorem completion.lift_unique {V W : SemiNormedGrp} [CompleteSpace W] [T0Space W]
(f : V ā¶ W) (g : completion.obj V ā¶ W) : completion.incl ā« g = f ā g = completion.lift f :=
fun h => SemiNormedGrp.hom_ext (NormedAddGroupHom.extension_unique _ fun v =>
((SemiNormedGrp.ext_iff.1 h) v).symm).symm
end SemiNormedGrp |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Group/SemiNormedGrp/Kernels.lean | import Mathlib.Analysis.Normed.Group.SemiNormedGrp
import Mathlib.Analysis.Normed.Group.Quotient
import Mathlib.CategoryTheory.Limits.Shapes.Kernels
/-!
# Kernels and cokernels in SemiNormedGrpā and SemiNormedGrp
We show that `SemiNormedGrpā` has cokernels
(for which of course the `cokernel.Ļ f` maps are norm non-increasing),
as well as the easier result that `SemiNormedGrp` has cokernels. We also show that
`SemiNormedGrp` has kernels.
So far, I don't see a way to state nicely what we really want:
`SemiNormedGrp` has cokernels, and `cokernel.Ļ f` is norm non-increasing.
The problem is that the limits API doesn't promise you any particular model of the cokernel,
and in `SemiNormedGrp` one can always take a cokernel and rescale its norm
(and hence making `cokernel.Ļ f` arbitrarily large in norm), obtaining another categorical cokernel.
-/
open CategoryTheory CategoryTheory.Limits
universe u
namespace SemiNormedGrpā
noncomputable section
/-- Auxiliary definition for `HasCokernels SemiNormedGrpā`. -/
def cokernelCocone {X Y : SemiNormedGrpā.{u}} (f : X ā¶ Y) : Cofork f 0 :=
Cofork.ofĻ
(@SemiNormedGrpā.mkHom _ (Y ā§ø NormedAddGroupHom.range f.1) _ _
f.hom.1.range.normedMk (NormedAddGroupHom.isQuotientQuotient _).norm_le)
(by
ext x
rw [Limits.zero_comp, comp_apply, SemiNormedGrpā.mkHom_apply,
SemiNormedGrpā.zero_apply, ā NormedAddGroupHom.mem_ker, f.hom.1.range.ker_normedMk,
f.hom.1.mem_range]
use x)
/-- Auxiliary definition for `HasCokernels SemiNormedGrpā`. -/
def cokernelLift {X Y : SemiNormedGrpā.{u}} (f : X ā¶ Y) (s : CokernelCofork f) :
(cokernelCocone f).pt ā¶ s.pt := by
fconstructor
-- The lift itself:
Ā· apply NormedAddGroupHom.lift _ s.Ļ.1
rintro _ āØb, rflā©
change (f ā« s.Ļ) b = 0
simp
-- The lift has norm at most one:
exact NormedAddGroupHom.lift_normNoninc _ _ _ s.Ļ.2
instance : HasCokernels SemiNormedGrpā.{u} where
has_colimit f :=
HasColimit.mk
{ cocone := cokernelCocone f
isColimit :=
isColimitAux _ (cokernelLift f)
(fun s => by
ext
apply NormedAddGroupHom.lift_mk f.1.range
rintro _ āØb, rflā©
change (f ā« s.Ļ) b = 0
simp)
fun _ _ w =>
SemiNormedGrpā.hom_ext <| Subtype.eq
(NormedAddGroupHom.lift_unique f.1.range _ _ _
(congr_arg Subtype.val (congr_arg Hom.hom w))) }
-- Sanity check
example : HasCokernels SemiNormedGrpā := by infer_instance
end
end SemiNormedGrpā
namespace SemiNormedGrp
section EqualizersAndKernels
noncomputable instance {V W : SemiNormedGrp.{u}} : Norm (V ā¶ W) where
norm f := norm f.hom
noncomputable instance {V W : SemiNormedGrp.{u}} : NNNorm (V ā¶ W) where
nnnorm f := nnnorm f.hom
/-- The equalizer cone for a parallel pair of morphisms of seminormed groups. -/
def fork {V W : SemiNormedGrp.{u}} (f g : V ā¶ W) : Fork f g :=
@Fork.ofι _ _ _ _ _ _ (of (f - g).hom.ker)
(ofHom (NormedAddGroupHom.incl (f - g).hom.ker)) <| by
ext v
have : v.1 ā (f - g).hom.ker := v.2
simpa [-SetLike.coe_mem, NormedAddGroupHom.mem_ker, sub_eq_zero] using this
instance hasLimit_parallelPair {V W : SemiNormedGrp.{u}} (f g : V ā¶ W) :
HasLimit (parallelPair f g) where
exists_limit :=
Nonempty.intro
{ cone := fork f g
isLimit :=
have this := fun (c : Fork f g) =>
show NormedAddGroupHom.compHom (f - g).hom c.ι.hom = 0 by
rw [hom_sub, AddMonoidHom.map_sub, AddMonoidHom.sub_apply, sub_eq_zero]
exact congr_arg Hom.hom c.condition
Fork.IsLimit.mk _
(fun c => ofHom <|
NormedAddGroupHom.ker.lift (Fork.ι c).hom _ <| this c)
(fun _ => SemiNormedGrp.hom_ext <| NormedAddGroupHom.ker.incl_comp_lift _ _ (this _))
fun c g h => by ext x; dsimp; simp_rw [ā h]; rfl}
instance : Limits.HasEqualizers.{u, u + 1} SemiNormedGrp :=
@hasEqualizers_of_hasLimit_parallelPair SemiNormedGrp _ fun {_ _ f g} =>
SemiNormedGrp.hasLimit_parallelPair f g
end EqualizersAndKernels
section Cokernel
-- PROJECT: can we reuse the work to construct cokernels in `SemiNormedGrpā` here?
-- I don't see a way to do this that is less work than just repeating the relevant parts.
/-- Auxiliary definition for `HasCokernels SemiNormedGrp`. -/
noncomputable
def cokernelCocone {X Y : SemiNormedGrp.{u}} (f : X ā¶ Y) : Cofork f 0 :=
Cofork.ofĻ (P := SemiNormedGrp.of (Y ā§ø NormedAddGroupHom.range f.hom))
(ofHom f.hom.range.normedMk)
(by aesop)
/-- Auxiliary definition for `HasCokernels SemiNormedGrp`. -/
noncomputable
def cokernelLift {X Y : SemiNormedGrp.{u}} (f : X ā¶ Y) (s : CokernelCofork f) :
(cokernelCocone f).pt ā¶ s.pt :=
ofHom <| NormedAddGroupHom.lift _ s.Ļ.hom
(by
rintro _ āØb, rflā©
change (f ā« s.Ļ) b = 0
simp)
/-- Auxiliary definition for `HasCokernels SemiNormedGrp`. -/
noncomputable
def isColimitCokernelCocone {X Y : SemiNormedGrp.{u}} (f : X ā¶ Y) :
IsColimit (cokernelCocone f) :=
isColimitAux _ (cokernelLift f)
(fun s => by
ext
apply NormedAddGroupHom.lift_mk f.hom.range
rintro _ āØb, rflā©
change (f ā« s.Ļ) b = 0
simp)
fun _ _ w => SemiNormedGrp.hom_ext <| NormedAddGroupHom.lift_unique f.hom.range _ _ _ <|
congr_arg Hom.hom w
instance : HasCokernels SemiNormedGrp.{u} where
has_colimit f :=
HasColimit.mk
{ cocone := cokernelCocone f
isColimit := isColimitCokernelCocone f }
-- Sanity check
example : HasCokernels SemiNormedGrp := by infer_instance
section ExplicitCokernel
/-- An explicit choice of cokernel, which has good properties with respect to the norm. -/
noncomputable
def explicitCokernel {X Y : SemiNormedGrp.{u}} (f : X ā¶ Y) : SemiNormedGrp.{u} :=
(cokernelCocone f).pt
/-- Descend to the explicit cokernel. -/
noncomputable
def explicitCokernelDesc {X Y Z : SemiNormedGrp.{u}} {f : X ā¶ Y} {g : Y ā¶ Z} (w : f ā« g = 0) :
explicitCokernel f ā¶ Z :=
(isColimitCokernelCocone f).desc (Cofork.ofĻ g (by simp [w]))
/-- The projection from `Y` to the explicit cokernel of `X ā¶ Y`. -/
noncomputable
def explicitCokernelĻ {X Y : SemiNormedGrp.{u}} (f : X ā¶ Y) : Y ā¶ explicitCokernel f :=
(cokernelCocone f).ι.app WalkingParallelPair.one
theorem explicitCokernelĻ_surjective {X Y : SemiNormedGrp.{u}} {f : X ā¶ Y} :
Function.Surjective (explicitCokernelĻ f) :=
Quot.mk_surjective
@[reassoc (attr := simp)]
theorem comp_explicitCokernelĻ {X Y : SemiNormedGrp.{u}} (f : X ā¶ Y) :
f ā« explicitCokernelĻ f = 0 := by
convert (cokernelCocone f).w WalkingParallelPairHom.left
simp
@[simp]
theorem explicitCokernelĻ_apply_dom_eq_zero {X Y : SemiNormedGrp.{u}} {f : X ā¶ Y} (x : X) :
(explicitCokernelĻ f) (f x) = 0 :=
show (f ā« explicitCokernelĻ f) x = 0 by rw [comp_explicitCokernelĻ]; rfl
@[simp, reassoc]
theorem explicitCokernelĻ_desc {X Y Z : SemiNormedGrp.{u}} {f : X ā¶ Y} {g : Y ā¶ Z}
(w : f ā« g = 0) : explicitCokernelĻ f ā« explicitCokernelDesc w = g :=
(isColimitCokernelCocone f).fac _ _
@[simp]
theorem explicitCokernelĻ_desc_apply {X Y Z : SemiNormedGrp.{u}} {f : X ā¶ Y} {g : Y ā¶ Z}
{cond : f ā« g = 0} (x : Y) : explicitCokernelDesc cond (explicitCokernelĻ f x) = g x :=
show (explicitCokernelĻ f ā« explicitCokernelDesc cond) x = g x by rw [explicitCokernelĻ_desc]
theorem explicitCokernelDesc_unique {X Y Z : SemiNormedGrp.{u}} {f : X ā¶ Y} {g : Y ā¶ Z}
(w : f ā« g = 0) (e : explicitCokernel f ā¶ Z) (he : explicitCokernelĻ f ā« e = g) :
e = explicitCokernelDesc w := by
apply (isColimitCokernelCocone f).uniq (Cofork.ofĻ g (by simp [w]))
rintro (_ | _)
Ā· convert w.symm
simp
Ā· exact he
theorem explicitCokernelDesc_comp_eq_desc {X Y Z W : SemiNormedGrp.{u}} {f : X ā¶ Y} {g : Y ā¶ Z}
{h : Z ā¶ W} {cond : f ā« g = 0} :
explicitCokernelDesc cond ā« h =
explicitCokernelDesc
(show f ā« g ā« h = 0 by rw [ā CategoryTheory.Category.assoc, cond, Limits.zero_comp]) := by
refine explicitCokernelDesc_unique _ _ ?_
rw [ā CategoryTheory.Category.assoc, explicitCokernelĻ_desc]
@[simp]
theorem explicitCokernelDesc_zero {X Y Z : SemiNormedGrp.{u}} {f : X ā¶ Y} :
explicitCokernelDesc (show f ā« (0 : Y ā¶ Z) = 0 from CategoryTheory.Limits.comp_zero) = 0 :=
Eq.symm <| explicitCokernelDesc_unique _ _ CategoryTheory.Limits.comp_zero
@[ext]
theorem explicitCokernel_hom_ext {X Y Z : SemiNormedGrp.{u}} {f : X ā¶ Y}
(eā eā : explicitCokernel f ā¶ Z) (h : explicitCokernelĻ f ā« eā = explicitCokernelĻ f ā« eā) :
eā = eā := by
let g : Y ā¶ Z := explicitCokernelĻ f ā« eā
have w : f ā« g = 0 := by simp [g]
have : eā = explicitCokernelDesc w := by apply explicitCokernelDesc_unique; rfl
rw [this]
apply explicitCokernelDesc_unique
exact h
instance explicitCokernelĻ.epi {X Y : SemiNormedGrp.{u}} {f : X ā¶ Y} :
Epi (explicitCokernelĻ f) := by
constructor
intro Z g h H
ext x
rw [H]
theorem isQuotient_explicitCokernelĻ {X Y : SemiNormedGrp.{u}} (f : X ā¶ Y) :
NormedAddGroupHom.IsQuotient (explicitCokernelĻ f).hom :=
NormedAddGroupHom.isQuotientQuotient _
theorem normNoninc_explicitCokernelĻ {X Y : SemiNormedGrp.{u}} (f : X ā¶ Y) :
(explicitCokernelĻ f).hom.NormNoninc :=
(isQuotient_explicitCokernelĻ f).norm_le
open scoped NNReal
theorem explicitCokernelDesc_norm_le_of_norm_le {X Y Z : SemiNormedGrp.{u}} {f : X ā¶ Y}
{g : Y ā¶ Z} (w : f ā« g = 0) (c : āā„0) (h : āgā ⤠c) : āexplicitCokernelDesc wā ⤠c :=
NormedAddGroupHom.lift_norm_le _ _ _ h
theorem explicitCokernelDesc_normNoninc {X Y Z : SemiNormedGrp.{u}} {f : X ā¶ Y} {g : Y ā¶ Z}
{cond : f ā« g = 0} (hg : g.hom.NormNoninc) : (explicitCokernelDesc cond).hom.NormNoninc := by
refine NormedAddGroupHom.NormNoninc.normNoninc_iff_norm_le_one.2 ?_
rw [ā NNReal.coe_one]
exact
explicitCokernelDesc_norm_le_of_norm_le cond 1
(NormedAddGroupHom.NormNoninc.normNoninc_iff_norm_le_one.1 hg)
theorem explicitCokernelDesc_comp_eq_zero {X Y Z W : SemiNormedGrp.{u}} {f : X ā¶ Y} {g : Y ā¶ Z}
{h : Z ā¶ W} (cond : f ā« g = 0) (cond2 : g ā« h = 0) : explicitCokernelDesc cond ā« h = 0 := by
rw [ā cancel_epi (explicitCokernelĻ f), ā Category.assoc, explicitCokernelĻ_desc]
simp [cond2]
theorem explicitCokernelDesc_norm_le {X Y Z : SemiNormedGrp.{u}} {f : X ā¶ Y} {g : Y ā¶ Z}
(w : f ā« g = 0) : āexplicitCokernelDesc wā ⤠āgā :=
explicitCokernelDesc_norm_le_of_norm_le w āgāā le_rfl
/-- The explicit cokernel is isomorphic to the usual cokernel. -/
noncomputable
def explicitCokernelIso {X Y : SemiNormedGrp.{u}} (f : X ā¶ Y) :
explicitCokernel f ā
cokernel f :=
(isColimitCokernelCocone f).coconePointUniqueUpToIso (colimit.isColimit _)
@[simp]
theorem explicitCokernelIso_hom_Ļ {X Y : SemiNormedGrp.{u}} (f : X ā¶ Y) :
explicitCokernelĻ f ā« (explicitCokernelIso f).hom = cokernel.Ļ _ := by
simp [explicitCokernelĻ, explicitCokernelIso, IsColimit.coconePointUniqueUpToIso]
@[simp]
theorem explicitCokernelIso_inv_Ļ {X Y : SemiNormedGrp.{u}} (f : X ā¶ Y) :
cokernel.Ļ f ā« (explicitCokernelIso f).inv = explicitCokernelĻ f := by
simp [explicitCokernelĻ, explicitCokernelIso]
@[simp]
theorem explicitCokernelIso_hom_desc {X Y Z : SemiNormedGrp.{u}} {f : X ā¶ Y} {g : Y ā¶ Z}
(w : f ā« g = 0) :
(explicitCokernelIso f).hom ā« cokernel.desc f g w = explicitCokernelDesc w := by
ext1
simp [explicitCokernelDesc, explicitCokernelĻ, explicitCokernelIso,
IsColimit.coconePointUniqueUpToIso]
/-- A special case of `CategoryTheory.Limits.cokernel.map` adapted to `explicitCokernel`. -/
noncomputable def explicitCokernel.map {A B C D : SemiNormedGrp.{u}}
{fab : A ā¶ B} {fbd : B ā¶ D} {fac : A ā¶ C} {fcd : C ā¶ D} (h : fab ā« fbd = fac ā« fcd) :
explicitCokernel fab ā¶ explicitCokernel fcd :=
@explicitCokernelDesc _ _ _ fab (fbd ā« explicitCokernelĻ _) <| by simp [reassoc_of% h]
/-- A special case of `CategoryTheory.Limits.cokernel.map_desc` adapted to `explicitCokernel`. -/
theorem ExplicitCoker.map_desc {A B C D B' D' : SemiNormedGrp.{u}}
{fab : A ā¶ B} {fbd : B ā¶ D} {fac : A ā¶ C} {fcd : C ā¶ D} {h : fab ā« fbd = fac ā« fcd}
{fbb' : B ā¶ B'} {fdd' : D ā¶ D'} {condb : fab ā« fbb' = 0} {condd : fcd ā« fdd' = 0} {g : B' ā¶ D'}
(h' : fbb' ā« g = fbd ā« fdd') :
explicitCokernelDesc condb ā« g = explicitCokernel.map h ā« explicitCokernelDesc condd := by
delta explicitCokernel.map
simp only [ā Category.assoc, ā cancel_epi (explicitCokernelĻ fab)]
simp [Category.assoc, explicitCokernelĻ_desc, h']
end ExplicitCokernel
end Cokernel
end SemiNormedGrp |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Module/WeakDual.lean | import Mathlib.Analysis.Normed.Module.Dual
import Mathlib.Analysis.Normed.Operator.Completeness
import Mathlib.Topology.Algebra.Module.WeakDual
/-!
# Weak dual of normed space
Let `E` be a normed space over a field `š`. This file is concerned with properties of the weak-*
topology on the dual of `E`. By the dual, we mean either of the type synonyms
`StrongDual š E` or `WeakDual š E`, depending on whether it is viewed as equipped with its usual
operator norm topology or the weak-* topology.
It is shown that the canonical mapping `StrongDual š E ā WeakDual š E` is continuous, and
as a consequence the weak-* topology is coarser than the topology obtained from the operator norm
(dual norm).
In this file, we also establish the Banach-Alaoglu theorem about the compactness of closed balls
in the dual of `E` (as well as sets of somewhat more general form) with respect to the weak-*
topology.
## Main definitions
The main definitions concern the canonical mapping `StrongDual š E ā WeakDual š E`.
* `StrongDual.toWeakDual` and `WeakDual.toStrongDual`: Linear equivalences from `StrongDual š E` to
`WeakDual š E` and in the converse direction.
* `NormedSpace.Dual.continuousLinearMapToWeakDual`: A continuous linear mapping from
`StrongDual š E` to `WeakDual š E` (same as `StrongDual.toWeakDual` but different bundled data).
## Main results
The first main result concerns the comparison of the operator norm topology on `StrongDual š E` and
the weak-* topology on (its type synonym) `WeakDual š E`:
* `dual_norm_topology_le_weak_dual_topology`: The weak-* topology on the dual of a normed space is
coarser (not necessarily strictly) than the operator norm topology.
* `WeakDual.isCompact_polar` (a version of the Banach-Alaoglu theorem): The polar set of a
neighborhood of the origin in a normed space `E` over `š` is compact in `WeakDual _ E`, if the
nontrivially normed field `š` is proper as a topological space.
* `WeakDual.isCompact_closedBall` (the most common special case of the Banach-Alaoglu theorem):
Closed balls in the dual of a normed space `E` over `ā` or `ā` are compact in the weak-star
topology.
## TODO
* Add that in finite dimensions, the weak-* topology and the dual norm topology coincide.
* Add that in infinite dimensions, the weak-* topology is strictly coarser than the dual norm
topology.
* Add metrizability of the dual unit ball (more generally weak-star compact subsets) of
`WeakDual š E` under the assumption of separability of `E`.
* Add the sequential Banach-Alaoglu theorem: the dual unit ball of a separable normed space `E`
is sequentially compact in the weak-star topology. This would follow from the metrizability above.
## Implementation notes
Weak-* topology is defined generally in the file `Topology.Algebra.Module.WeakDual`.
When `M` is a vector space, the duals `StrongDual š M` and `WeakDual š M` are type synonyms with
different topology instances.
For the proof of Banach-Alaoglu theorem, the weak dual of `E` is embedded in the space of
functions `E ā š` with the topology of pointwise convergence.
The polar set `polar š s` of a subset `s` of `E` is originally defined as a subset of the dual
`StrongDual š E`. We care about properties of these w.r.t. weak-* topology, and for this purpose
give the definition `WeakDual.polar š s` for the "same" subset viewed as a subset of `WeakDual š E`
(a type synonym of the dual but with a different topology instance).
## References
* https://en.wikipedia.org/wiki/Weak_topology#Weak-*_topology
* https://en.wikipedia.org/wiki/Banach%E2%80%93Alaoglu_theorem
## Tags
weak-star, weak dual
-/
noncomputable section
open Filter Function Bornology Metric Set
open Topology Filter
namespace StrongDual
section
variable {R : Type*} [CommSemiring R] [TopologicalSpace R] [ContinuousAdd R]
[ContinuousConstSMul R R]
variable {M : Type*} [AddCommMonoid M] [TopologicalSpace M] [Module R M]
/-- For vector spaces `M`, there is a canonical map `StrongDual R M ā WeakDual R M` (the "identity"
mapping). It is a linear equivalence. -/
def toWeakDual : StrongDual R M āā[R] WeakDual R M :=
LinearEquiv.refl R (StrongDual R M)
@[deprecated (since := "2025-08-3")] alias _root_.NormedSpace.Dual.toWeakDual := toWeakDual
@[simp]
theorem coe_toWeakDual (x' : StrongDual R M) : toWeakDual x' = x' :=
rfl
@[deprecated (since := "2025-08-3")] alias _root_.NormedSpace.Dual.coe_toWeakDual := coe_toWeakDual
@[simp]
theorem toWeakDual_inj (x' y' : StrongDual R M) : toWeakDual x' = toWeakDual y' ā x' = y' :=
(LinearEquiv.injective toWeakDual).eq_iff
@[deprecated (since := "2025-08-3")] alias _root_.NormedSpace.Dual.toWeakDual_inj := toWeakDual_inj
end
end StrongDual
namespace WeakDual
variable {š : Type*} [NontriviallyNormedField š]
variable {E : Type*} [AddCommMonoid E] [TopologicalSpace E] [Module š E]
/-- For vector spaces `E`, there is a canonical map `WeakDual š E ā StrongDual š E` (the "identity"
mapping). It is a linear equivalence. Here it is implemented as the inverse of the linear
equivalence `StrongDual.toWeakDual` in the other direction. -/
def toStrongDual : WeakDual š E āā[š] StrongDual š E :=
StrongDual.toWeakDual.symm
@[deprecated (since := "2025-08-03")] alias toNormedDual := toStrongDual
theorem toStrongDual_apply (x : WeakDual š E) (y : E) : (toStrongDual x) y = x y :=
rfl
@[deprecated (since := "2025-08-03")] alias toNormedDual_apply := toStrongDual_apply
@[simp]
theorem coe_toStrongDual (x' : WeakDual š E) : toStrongDual x' = x' :=
rfl
@[deprecated (since := "2025-08-03")] alias coe_toNormedDual := coe_toStrongDual
@[simp]
theorem toStrongDual_inj (x' y' : WeakDual š E) : toStrongDual x' = toStrongDual y' ā x' = y' :=
(LinearEquiv.injective toStrongDual).eq_iff
@[deprecated (since := "2025-08-03")] alias toNormedDual_inj := toStrongDual_inj
variable (š)
/-- The polar set `polar š s` of `s : Set E` seen as a subset of the dual of `E` with the
weak-star topology is `WeakDual.polar š s`. -/
def polar (s : Set E) : Set (WeakDual š E) :=
toStrongDual ā»Ā¹' (StrongDual.polar š) s
theorem polar_def (s : Set E) : polar š s = { f : WeakDual š E | ā x ā s, āf xā ⤠1 } :=
rfl
/-- The polar `polar š s` of a set `s : E` is a closed subset when the weak star topology
is used. -/
theorem isClosed_polar (s : Set E) : IsClosed (polar š s) := by
simp only [polar_def, setOf_forall]
exact isClosed_biInter fun x hx => isClosed_Iic.preimage (WeakBilin.eval_continuous _ _).norm
end WeakDual
/-!
### Weak star topology on duals of normed spaces
In this section, we prove properties about the weak-* topology on duals of normed spaces.
We prove in particular that the canonical mapping `StrongDual š E ā WeakDual š E` is continuous,
i.e., that the weak-* topology is coarser (not necessarily strictly) than the topology given
by the dual-norm (i.e. the operator-norm).
-/
variable {š : Type*} [NontriviallyNormedField š]
variable {E : Type*} [SeminormedAddCommGroup E] [NormedSpace š E]
namespace NormedSpace
namespace Dual
theorem toWeakDual_continuous : Continuous fun x' : StrongDual š E => StrongDual.toWeakDual x' :=
WeakBilin.continuous_of_continuous_eval _ fun z => (inclusionInDoubleDual š E z).continuous
/-- For a normed space `E`, according to `toWeakDual_continuous` the "identity mapping"
`StrongDual š E ā WeakDual š E` is continuous. This definition implements it as a continuous linear
map. -/
def continuousLinearMapToWeakDual : StrongDual š E āL[š] WeakDual š E :=
{ StrongDual.toWeakDual with cont := toWeakDual_continuous }
/-- The weak-star topology is coarser than the dual-norm topology. -/
theorem dual_norm_topology_le_weak_dual_topology :
(UniformSpace.toTopologicalSpace : TopologicalSpace (StrongDual š E)) ā¤
(instTopologicalSpaceWeakDual .. : TopologicalSpace (WeakDual š E)) := by
convert (@toWeakDual_continuous _ _ _ _ (by assumption)).le_induced
exact induced_id.symm
end Dual
end NormedSpace
namespace WeakDual
open NormedSpace
theorem isClosed_closedBall (x' : StrongDual š E) (r : ā) :
IsClosed (toStrongDual ā»Ā¹' closedBall x' r) :=
isClosed_induced_iff'.2 (ContinuousLinearMap.is_weak_closed_closedBall x' r)
/-!
### Polar sets in the weak dual space
-/
/-- While the coercion `ā : WeakDual š E ā (E ā š)` is not a closed map, it sends *bounded*
closed sets to closed sets. -/
theorem isClosed_image_coe_of_bounded_of_closed {s : Set (WeakDual š E)}
(hb : IsBounded (StrongDual.toWeakDual ā»Ā¹' s)) (hc : IsClosed s) :
IsClosed (((ā) : WeakDual š E ā E ā š) '' s) :=
ContinuousLinearMap.isClosed_image_coe_of_bounded_of_weak_closed hb (isClosed_induced_iff'.1 hc)
theorem isCompact_of_bounded_of_closed [ProperSpace š] {s : Set (WeakDual š E)}
(hb : IsBounded (StrongDual.toWeakDual ā»Ā¹' s)) (hc : IsClosed s) : IsCompact s :=
DFunLike.coe_injective.isEmbedding_induced.isCompact_iff.mpr <|
ContinuousLinearMap.isCompact_image_coe_of_bounded_of_closed_image hb <|
isClosed_image_coe_of_bounded_of_closed hb hc
variable (š)
/-- The image under `ā : WeakDual š E ā (E ā š)` of a polar `WeakDual.polar š s` of a
neighborhood `s` of the origin is a closed set. -/
theorem isClosed_image_polar_of_mem_nhds {s : Set E} (s_nhds : s ā š (0 : E)) :
IsClosed (((ā) : WeakDual š E ā E ā š) '' polar š s) :=
isClosed_image_coe_of_bounded_of_closed (isBounded_polar_of_mem_nhds_zero š s_nhds)
(isClosed_polar _ _)
/-- The image under `ā : StrongDual š E ā (E ā š)` of a polar `polar š s` of a
neighborhood `s` of the origin is a closed set. -/
theorem _root_.NormedSpace.Dual.isClosed_image_polar_of_mem_nhds {s : Set E}
(s_nhds : s ā š (0 : E)) :
IsClosed (((ā) : StrongDual š E ā E ā š) '' StrongDual.polar š s) :=
WeakDual.isClosed_image_polar_of_mem_nhds š s_nhds
/-- The **Banach-Alaoglu theorem**: the polar set of a neighborhood `s` of the origin in a
normed space `E` is a compact subset of `WeakDual š E`. -/
theorem isCompact_polar [ProperSpace š] {s : Set E} (s_nhds : s ā š (0 : E)) :
IsCompact (polar š s) :=
isCompact_of_bounded_of_closed (isBounded_polar_of_mem_nhds_zero š s_nhds) (isClosed_polar _ _)
/-- The **Banach-Alaoglu theorem**: closed balls of the dual of a normed space `E` are compact in
the weak-star topology. -/
theorem isCompact_closedBall [ProperSpace š] (x' : StrongDual š E) (r : ā) :
IsCompact (toStrongDual ā»Ā¹' closedBall x' r) :=
isCompact_of_bounded_of_closed isBounded_closedBall (isClosed_closedBall x' r)
end WeakDual |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Module/HahnBanach.lean | import Mathlib.Analysis.Convex.Cone.Extension
import Mathlib.Analysis.Normed.Module.RCLike.Extend
import Mathlib.Analysis.RCLike.Lemmas
/-!
# Extension Hahn-Banach theorem
In this file we prove the analytic Hahn-Banach theorem. For any continuous linear function on a
subspace, we can extend it to a function on the entire space without changing its norm.
We prove
* `Real.exists_extension_norm_eq`: Hahn-Banach theorem for continuous linear functions on normed
spaces over `ā`.
* `exists_extension_norm_eq`: Hahn-Banach theorem for continuous linear functions on normed spaces
over `ā` or `ā`.
In order to state and prove the corollaries uniformly, we prove the statements for a field `š`
satisfying `RCLike š`.
In this setting, `exists_dual_vector` states that, for any nonzero `x`, there exists a continuous
linear form `g` of norm `1` with `g x = āxā` (where the norm has to be interpreted as an element
of `š`).
-/
universe u v
namespace Real
variable {E : Type*} [SeminormedAddCommGroup E] [NormedSpace ā E]
/-- **Hahn-Banach theorem** for continuous linear functions over `ā`.
See also `exists_extension_norm_eq` in the root namespace for a more general version
that works both for `ā` and `ā`. -/
theorem exists_extension_norm_eq (p : Subspace ā E) (f : StrongDual ā p) :
ā g : StrongDual ā E, (ā x : p, g x = f x) ā§ āgā = āfā := by
rcases exists_extension_of_le_sublinear āØp, fā© (fun x => āfā * āxā)
(fun c hc x => by simp only [norm_smul c x, Real.norm_eq_abs, abs_of_pos hc, mul_left_comm])
(fun x y => by
rw [ā left_distrib]
exact mul_le_mul_of_nonneg_left (norm_add_le x y) (@norm_nonneg _ _ f))
fun x => le_trans (le_abs_self _) (f.le_opNorm _) with āØg, g_eq, g_leā©
set g' :=
g.mkContinuous āfā fun x => abs_le.2 āØneg_le.1 <| g.map_neg x āø norm_neg x āø g_le (-x), g_le xā©
refine āØg', g_eq, ?_ā©
apply le_antisymm (g.mkContinuous_norm_le (norm_nonneg f) _)
refine f.opNorm_le_bound (norm_nonneg _) fun x => ?_
dsimp at g_eq
rw [ā g_eq]
apply g'.le_opNorm
end Real
section RCLike
open RCLike
variable {š : Type*} [NontriviallyNormedField š] [IsRCLikeNormedField š] {E F : Type*}
[SeminormedAddCommGroup E] [NormedSpace š E]
[NormedAddCommGroup F] [NormedSpace š F]
/-- **Hahn-Banach theorem** for continuous linear functions over `š`
satisfying `IsRCLikeNormedField š`. -/
theorem exists_extension_norm_eq (p : Subspace š E) (f : StrongDual š p) :
ā g : StrongDual š E, (ā x : p, g x = f x) ā§ āgā = āfā := by
letI : RCLike š := IsRCLikeNormedField.rclike š
letI : Module ā E := RestrictScalars.module ā š E
letI : IsScalarTower ā š E := RestrictScalars.isScalarTower _ _ _
letI : NormedSpace ā E := NormedSpace.restrictScalars _ š _
-- Let `fr: StrongDual ā p` be the real part of `f`.
let fr := reCLM.comp (f.restrictScalars ā)
-- Use the real version to get a norm-preserving extension of `fr`, which
-- we'll call `g : StrongDual ā E`.
rcases Real.exists_extension_norm_eq (p.restrictScalars ā) fr with āØg, āØhextends, hnormeqā©ā©
-- Now `g` can be extended to the `StrongDual š E` we need.
refine āØg.extendToš, ?_ā©
-- It is an extension of `f`.
have h : ā x : p, g.extendToš x = f x := by
intro x
rw [ContinuousLinearMap.extendToš_apply, ā Submodule.coe_smul]
-- This used to be `rw`, but we need `erw` after https://github.com/leanprover/lean4/pull/2644
-- The goal has a coercion from `RestrictScalars ā š StrongDual ā E`, but
-- `hextends` involves a coercion from `StrongDual ā E`.
erw [hextends]
erw [hextends]
have :
(fr x : š) - I * ā(fr ((I : š) ⢠x)) = (re (f x) : š) - (I : š) * re (f ((I : š) ⢠x)) := by
rfl
-- This used to be `rw`, but we need `erw` after https://github.com/leanprover/lean4/pull/2644
erw [this]
apply ext
Ā· simp only [add_zero, Algebra.id.smul_eq_mul, I_re, ofReal_im, AddMonoidHom.map_add, zero_sub,
I_im', zero_mul, ofReal_re, sub_zero, mul_neg, ofReal_neg,
mul_re, mul_zero, sub_neg_eq_add, ContinuousLinearMap.map_smul]
Ā· simp only [Algebra.id.smul_eq_mul, I_re, ofReal_im, AddMonoidHom.map_add, zero_sub, I_im',
zero_mul, ofReal_re, mul_neg, mul_im, zero_add, ofReal_neg, mul_re,
sub_neg_eq_add, ContinuousLinearMap.map_smul]
-- And we derive the equality of the norms by bounding on both sides.
refine āØh, le_antisymm ?_ ?_ā©
Ā· calc
āg.extendTošā = āgā := g.norm_extendToš
_ = āfrā := hnormeq
_ ⤠āreCLMā * āfā := ContinuousLinearMap.opNorm_comp_le _ _
_ = āfā := by rw [reCLM_norm, one_mul]
Ā· exact f.opNorm_le_bound g.extendToš.opNorm_nonneg fun x => h x āø g.extendToš.le_opNorm x
open Module
/-- Corollary of the **Hahn-Banach theorem**: if `f : p ā F` is a continuous linear map
from a submodule of a normed space `E` over `š`, `š = ā` or `š = ā`,
with a finite-dimensional range, then `f` admits an extension to a continuous linear map `E ā F`.
Note that contrary to the case `F = š`, see `exists_extension_norm_eq`,
we provide no estimates on the norm of the extension.
-/
lemma ContinuousLinearMap.exist_extension_of_finiteDimensional_range {p : Submodule š E}
(f : p āL[š] F) [FiniteDimensional š (LinearMap.range f)] :
ā g : E āL[š] F, f = g.comp p.subtypeL := by
letI : RCLike š := IsRCLikeNormedField.rclike š
set b := Module.finBasis š (LinearMap.range f)
set e := b.equivFunL
set fi := fun i ⦠(LinearMap.toContinuousLinearMap (b.coord i)).comp
(f.codRestrict _ <| LinearMap.mem_range_self _)
choose gi hgf _ using fun i ⦠exists_extension_norm_eq p (fi i)
use (LinearMap.range f).subtypeL.comp <| e.symm.toContinuousLinearMap.comp (.pi gi)
ext x
simp [fi, e, hgf]
/-- A finite-dimensional submodule over `ā` or `ā` is `Submodule.ClosedComplemented`. -/
lemma Submodule.ClosedComplemented.of_finiteDimensional (p : Submodule š F)
[FiniteDimensional š p] : p.ClosedComplemented :=
let āØg, hgā© := (ContinuousLinearMap.id š p).exist_extension_of_finiteDimensional_range
āØg, DFunLike.congr_fun hg.symmā©
end RCLike
section DualVector
variable (š : Type v) [RCLike š]
variable {E : Type u} [NormedAddCommGroup E] [NormedSpace š E]
open ContinuousLinearEquiv Submodule
theorem coord_norm' {x : E} (h : x ā 0) : ā(āxā : š) ⢠coord š x hā = 1 := by
simp [-algebraMap_smul, norm_smul, mul_inv_cancelā (mt norm_eq_zero.mp h)]
/-- Corollary of Hahn-Banach. Given a nonzero element `x` of a normed space, there exists an
element of the dual space, of norm `1`, whose value on `x` is `āxā`. -/
theorem exists_dual_vector (x : E) (h : x ā 0) : ā g : StrongDual š E, āgā = 1 ā§ g x = āxā := by
let p : Submodule š E := š ā x
let f := (āxā : š) ⢠coord š x h
obtain āØg, hgā© := exists_extension_norm_eq p f
refine āØg, ?_, ?_ā©
Ā· rw [hg.2, coord_norm']
Ā· calc
g x = g (āØx, mem_span_singleton_self xā© : š ā x) := by rw [Submodule.coe_mk]
_ = ((āxā : š) ⢠coord š x h) (āØx, mem_span_singleton_self xā© : š ā x) := by rw [ā hg.1]
_ = āxā := by simp [-algebraMap_smul]
/-- Variant of Hahn-Banach, eliminating the hypothesis that `x` be nonzero, and choosing
the dual element arbitrarily when `x = 0`. -/
theorem exists_dual_vector' [Nontrivial E] (x : E) : ā g : StrongDual š E, āgā = 1 ā§ g x = āxā := by
by_cases hx : x = 0
Ā· obtain āØy, hyā© := exists_ne (0 : E)
obtain āØg, hgā© : ā g : StrongDual š E, āgā = 1 ā§ g y = āyā := exists_dual_vector š y hy
refine āØg, hg.left, ?_ā©
simp [hx]
Ā· exact exists_dual_vector š x hx
/-- Variant of Hahn-Banach, eliminating the hypothesis that `x` be nonzero, but only ensuring that
the dual element has norm at most `1` (this cannot be improved for the trivial
vector space). -/
theorem exists_dual_vector'' (x : E) : ā g : StrongDual š E, āgā ⤠1 ā§ g x = āxā := by
by_cases hx : x = 0
Ā· refine āØ0, by simp, ?_ā©
symm
simp [hx]
Ā· rcases exists_dual_vector š x hx with āØg, g_norm, g_eqā©
exact āØg, g_norm.le, g_eqā©
end DualVector |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Module/Convex.lean | import Mathlib.Analysis.Convex.Jensen
import Mathlib.Analysis.Convex.PathConnected
import Mathlib.Analysis.Convex.Topology
import Mathlib.Analysis.Normed.Group.Pointwise
import Mathlib.Analysis.Normed.Module.Basic
import Mathlib.Analysis.Normed.Module.RCLike.Real
/-!
# Metric properties of convex sets in normed spaces
We prove the following facts:
* `convexOn_norm`, `convexOn_dist` : norm and distance to a fixed point is convex on any convex
set;
* `convexOn_univ_norm`, `convexOn_univ_dist` : norm and distance to a fixed point is convex on
the whole space;
* `convexHull_ediam`, `convexHull_diam` : convex hull of a set has the same (e)metric diameter
as the original set;
* `isBounded_convexHull` : convex hull of a set is bounded if and only if the original set
is bounded.
-/
-- TODO assert_not_exists Cardinal
variable {E : Type*}
open Metric Set
section SeminormedAddCommGroup
variable [SeminormedAddCommGroup E] [NormedSpace ā E]
variable {s : Set E}
/-- The norm on a real normed space is convex on any convex set. See also `Seminorm.convexOn`
and `convexOn_univ_norm`. -/
theorem convexOn_norm (hs : Convex ā s) : ConvexOn ā s norm :=
āØhs, fun x _ y _ a b ha hb _ =>
calc
āa ⢠x + b ⢠yā ⤠āa ⢠xā + āb ⢠yā := norm_add_le _ _
_ = a * āxā + b * āyā := by
rw [norm_smul, norm_smul, Real.norm_of_nonneg ha, Real.norm_of_nonneg hb]ā©
/-- The norm on a real normed space is convex on the whole space. See also `Seminorm.convexOn`
and `convexOn_norm`. -/
theorem convexOn_univ_norm : ConvexOn ā univ (norm : E ā ā) :=
convexOn_norm convex_univ
theorem convexOn_dist (z : E) (hs : Convex ā s) : ConvexOn ā s fun z' => dist z' z := by
simpa [dist_eq_norm, preimage_preimage] using
(convexOn_norm (hs.translate (-z))).comp_affineMap (AffineMap.id ā E - AffineMap.const ā E z)
theorem convexOn_univ_dist (z : E) : ConvexOn ā univ fun z' => dist z' z :=
convexOn_dist z convex_univ
theorem convex_ball (a : E) (r : ā) : Convex ā (Metric.ball a r) := by
simpa only [Metric.ball, sep_univ] using (convexOn_univ_dist a).convex_lt r
theorem convex_closedBall (a : E) (r : ā) : Convex ā (Metric.closedBall a r) := by
simpa only [Metric.closedBall, sep_univ] using (convexOn_univ_dist a).convex_le r
variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ā F]
open Pointwise in
theorem convexHull_sphere_eq_closedBall [Nontrivial F] (x : F) {r : ā} (hr : 0 ⤠r) :
convexHull ā (sphere x r) = closedBall x r := by
suffices convexHull ā (sphere (0 : F) r) = closedBall 0 r by
rw [ā add_zero x, ā vadd_eq_add, ā vadd_sphere, convexHull_vadd,
this, vadd_closedBall_zero, vadd_eq_add, add_zero]
refine subset_antisymm (convexHull_min sphere_subset_closedBall (convex_closedBall 0 r))
(fun x h ⦠mem_convexHull_iff.mpr fun U hU_sub hU ⦠?_)
have zero_mem : (0 : F) ā U := by
have _ : Invertible (2 : ā) := by use 2ā»Ā¹ <;> grind
obtain āØz, hzā© := NormedSpace.sphere_nonempty (E := F).mpr hr
rw [ā midpoint_self_neg (R := ā) (x := z)]
exact Convex.midpoint_mem hU (hU_sub hz) <| hU_sub (by simp_all)
by_cases hrā : r = 0
Ā· simp_all
by_cases x_zero : x = 0
Ā· rwa [x_zero]
set z := (r * āxāā»Ā¹) ⢠x with hz_def
have hrā : rā»Ā¹ * āxā ⤠1 := by
simp only [mem_closedBall, dist_zero_right] at h
grw [h, inv_mul_le_one]
have hz : z ā U := by
apply hU_sub
simp_all [norm_smul]
have := StarConvex.smul_mem (hU.starConvex zero_mem) hz (by positivity) hrā
rwa [hz_def, ā smul_assoc, smul_eq_mul, ā mul_assoc, mul_comm, mul_comm rā»Ā¹, mul_assoc _ rā»Ā¹,
inv_mul_cancelā hrā, mul_one, inv_mul_cancelā (by simp_all), one_smul] at this
/-- Given a point `x` in the convex hull of `s` and a point `y`, there exists a point
of `s` at distance at least `dist x y` from `y`. -/
theorem convexHull_exists_dist_ge {s : Set E} {x : E} (hx : x ā convexHull ā s) (y : E) :
ā x' ā s, dist x y ⤠dist x' y :=
(convexOn_dist y (convex_convexHull ā _)).exists_ge_of_mem_convexHull (subset_convexHull ..) hx
theorem Convex.thickening (hs : Convex ā s) (Ī“ : ā) : Convex ā (thickening Ī“ s) := by
rw [ā add_ball_zero]
exact hs.add (convex_ball 0 _)
theorem Convex.cthickening (hs : Convex ā s) (Ī“ : ā) : Convex ā (cthickening Ī“ s) := by
obtain hΓ | hΓ := le_total 0 Γ
· rw [cthickening_eq_iInter_thickening hΓ]
exact convex_iInterā fun _ _ => hs.thickening _
· rw [cthickening_of_nonpos hΓ]
exact hs.closure
/-- Given a point `x` in the convex hull of `s` and a point `y` in the convex hull of `t`,
there exist points `x' ā s` and `y' ā t` at distance at least `dist x y`. -/
theorem convexHull_exists_dist_ge2 {s t : Set E} {x y : E} (hx : x ā convexHull ā s)
(hy : y ā convexHull ā t) : ā x' ā s, ā y' ā t, dist x y ⤠dist x' y' := by
rcases convexHull_exists_dist_ge hx y with āØx', hx', Hx'ā©
rcases convexHull_exists_dist_ge hy x' with āØy', hy', Hy'ā©
use x', hx', y', hy'
exact le_trans Hx' (dist_comm y x' āø dist_comm y' x' āø Hy')
/-- Emetric diameter of the convex hull of a set `s` equals the emetric diameter of `s`. -/
@[simp]
theorem convexHull_ediam (s : Set E) : EMetric.diam (convexHull ā s) = EMetric.diam s := by
refine (EMetric.diam_le fun x hx y hy => ?_).antisymm (EMetric.diam_mono <| subset_convexHull ā s)
rcases convexHull_exists_dist_ge2 hx hy with āØx', hx', y', hy', Hā©
rw [edist_dist]
apply le_trans (ENNReal.ofReal_le_ofReal H)
rw [ā edist_dist]
exact EMetric.edist_le_diam_of_mem hx' hy'
/-- Diameter of the convex hull of a set `s` equals the emetric diameter of `s`. -/
@[simp]
theorem convexHull_diam (s : Set E) : Metric.diam (convexHull ā s) = Metric.diam s := by
simp only [Metric.diam, convexHull_ediam]
/-- Convex hull of `s` is bounded if and only if `s` is bounded. -/
@[simp]
theorem isBounded_convexHull {s : Set E} :
Bornology.IsBounded (convexHull ā s) ā Bornology.IsBounded s := by
simp only [Metric.isBounded_iff_ediam_ne_top, convexHull_ediam]
instance (priority := 100) NormedSpace.instPathConnectedSpace : PathConnectedSpace E :=
IsTopologicalAddGroup.pathConnectedSpace
/-- The set of vectors in the same ray as `x` is connected. -/
theorem isConnected_setOf_sameRay (x : E) : IsConnected { y | SameRay ā x y } := by
by_cases hx : x = 0; · simpa [hx] using isConnected_univ (α := E)
simp_rw [ā exists_nonneg_left_iff_sameRay hx]
exact isConnected_Ici.image _ (continuous_id.smul continuous_const).continuousOn
/-- The set of nonzero vectors in the same ray as the nonzero vector `x` is connected. -/
theorem isConnected_setOf_sameRay_and_ne_zero {x : E} (hx : x ā 0) :
IsConnected { y | SameRay ā x y ā§ y ā 0 } := by
simp_rw [ā exists_pos_left_iff_sameRay_and_ne_zero hx]
exact isConnected_Ioi.image _ (continuous_id.smul continuous_const).continuousOn
lemma norm_sub_le_of_mem_segment {x y z : E} (hy : y ā segment ā x z) :
āy - xā ⤠āz - xā := by
rw [segment_eq_image'] at hy
simp only [mem_image, mem_Icc] at hy
obtain āØu, āØhu_nonneg, hu_le_oneā©, rflā© := hy
simp only [add_sub_cancel_left, norm_smul, Real.norm_eq_abs]
rw [abs_of_nonneg hu_nonneg]
conv_rhs => rw [ā one_mul (āz - xā)]
gcongr
namespace Filter
open scoped Convex Topology
variable {α : Type*} {f : Filter α} {x : E} {y z : α ā E} {r : α ā E ā Prop}
theorem Eventually.segment_of_prod_nhds (hy : Tendsto y f (š x)) (hz : Tendsto z f (š x))
(hr : āį¶ p in f ĆĖ¢ š x, r p.1 p.2) : āį¶ Ļ in f, ā v ā [y Ļ -[ā] z Ļ], r Ļ v := by
obtain āØp, hp, Ī“, hĪ“, hrā© := eventually_prod_nhds_iff.mp hr
rw [Metric.tendsto_nhds] at hy hz
filter_upwards [hp, hy Ī“ hĪ“, hz Ī“ hĪ“] with Ļ hp hy hz
exact fun v hv => hr hp <| convex_iff_segment_subset.mp (convex_ball x Ī“) hy hz hv
theorem Eventually.segment_of_prod_nhdsWithin (hy : Tendsto y f (š x)) (hz : Tendsto z f (š x))
(hr : āį¶ p in f ĆĖ¢ š[s] x, r p.1 p.2) (seg : āį¶ Ļ in f, [y Ļ -[ā] z Ļ] ā s) :
āį¶ Ļ in f, ā v ā [y Ļ -[ā] z Ļ], r Ļ v := by
refine seg.mp <| .mono ?_ (fun _ => forallā_imp)
apply Eventually.segment_of_prod_nhds hy hz
simpa [nhdsWithin, prod_eq_inf, ā inf_assoc, eventually_inf_principal] using hr
end Filter
end SeminormedAddCommGroup |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Module/Ray.lean | import Mathlib.LinearAlgebra.Ray
import Mathlib.Analysis.Normed.Module.RCLike.Real
import Mathlib.Algebra.Ring.Regular
/-!
# Rays in a real normed vector space
In this file we prove some lemmas about the `SameRay` predicate in case of a real normed space. In
this case, for two vectors `x y` in the same ray, the norm of their sum is equal to the sum of their
norms and `āyā ⢠x = āxā ⢠y`.
-/
open Real
variable {E : Type*} [SeminormedAddCommGroup E] [NormedSpace ā E] {F : Type*}
[NormedAddCommGroup F] [NormedSpace ā F]
namespace SameRay
variable {x y : E}
/-- If `x` and `y` are on the same ray, then the triangle inequality becomes the equality: the norm
of `x + y` is the sum of the norms of `x` and `y`. The converse is true for a strictly convex
space. -/
theorem norm_add (h : SameRay ā x y) : āx + yā = āxā + āyā := by
rcases h.exists_eq_smul with āØu, a, b, ha, hb, -, rfl, rflā©
rw [ā add_smul, norm_smul_of_nonneg (add_nonneg ha hb), norm_smul_of_nonneg ha,
norm_smul_of_nonneg hb, add_mul]
theorem norm_sub (h : SameRay ā x y) : āx - yā = |āxā - āyā| := by
rcases h.exists_eq_smul with āØu, a, b, ha, hb, -, rfl, rflā©
wlog hab : b ⤠a generalizing a b with H
Ā· rw [SameRay.sameRay_comm] at h
rw [norm_sub_rev, abs_sub_comm]
exact H b a hb ha h (le_of_not_ge hab)
rw [ā sub_nonneg] at hab
rw [ā sub_smul, norm_smul_of_nonneg hab, norm_smul_of_nonneg ha, norm_smul_of_nonneg hb, ā
sub_mul, abs_of_nonneg (mul_nonneg hab (norm_nonneg _))]
theorem norm_smul_eq (h : SameRay ā x y) : āxā ⢠y = āyā ⢠x := by
rcases h.exists_eq_smul with āØu, a, b, ha, hb, -, rfl, rflā©
simp only [norm_smul_of_nonneg, *, mul_smul]
rw [smul_comm, smul_comm b, smul_comm a b u]
end SameRay
variable {x y : F}
theorem norm_injOn_ray_left (hx : x ā 0) : { y | SameRay ā x y }.InjOn norm := by
rintro y hy z hz h
rcases hy.exists_nonneg_left hx with āØr, hr, rflā©
rcases hz.exists_nonneg_left hx with āØs, hs, rflā©
rw [norm_smul, norm_smul, mul_left_inj' (norm_ne_zero_iff.2 hx), norm_of_nonneg hr,
norm_of_nonneg hs] at h
rw [h]
theorem norm_injOn_ray_right (hy : y ā 0) : { x | SameRay ā x y }.InjOn norm := by
simpa only [SameRay.sameRay_comm] using norm_injOn_ray_left hy
theorem sameRay_iff_norm_smul_eq : SameRay ā x y ā āxā ⢠y = āyā ⢠x :=
āØSameRay.norm_smul_eq, fun h =>
or_iff_not_imp_left.2 fun hx =>
or_iff_not_imp_left.2 fun hy => āØāyā, āxā, norm_pos_iff.2 hy, norm_pos_iff.2 hx, h.symmā©ā©
/-- Two nonzero vectors `x y` in a real normed space are on the same ray if and only if the unit
vectors `āxāā»Ā¹ ⢠x` and `āyāā»Ā¹ ⢠y` are equal. -/
theorem sameRay_iff_inv_norm_smul_eq_of_ne (hx : x ā 0) (hy : y ā 0) :
SameRay ā x y ā āxāā»Ā¹ ⢠x = āyāā»Ā¹ ⢠y := by
rw [inv_smul_eq_iffā, smul_comm, eq_comm, inv_smul_eq_iffā, sameRay_iff_norm_smul_eq] <;>
rwa [norm_ne_zero_iff]
alias āØSameRay.inv_norm_smul_eq, _ā© := sameRay_iff_inv_norm_smul_eq_of_ne
/-- Two vectors `x y` in a real normed space are on the ray if and only if one of them is zero or
the unit vectors `āxāā»Ā¹ ⢠x` and `āyāā»Ā¹ ⢠y` are equal. -/
theorem sameRay_iff_inv_norm_smul_eq : SameRay ā x y ā x = 0 ⨠y = 0 ⨠āxāā»Ā¹ ⢠x = āyāā»Ā¹ ⢠y := by
rcases eq_or_ne x 0 with (rfl | hx); Ā· simp [SameRay.zero_left]
rcases eq_or_ne y 0 with (rfl | hy); Ā· simp [SameRay.zero_right]
simp only [sameRay_iff_inv_norm_smul_eq_of_ne hx hy, *, false_or]
/-- Two vectors of the same norm are on the same ray if and only if they are equal. -/
theorem sameRay_iff_of_norm_eq (h : āxā = āyā) : SameRay ā x y ā x = y := by
obtain rfl | hy := eq_or_ne y 0
Ā· rw [norm_zero, norm_eq_zero] at h
exact iff_of_true (SameRay.zero_right _) h
Ā· exact āØfun hxy => norm_injOn_ray_right hy hxy SameRay.rfl h, fun hxy => hxy āø SameRay.rflā©
theorem not_sameRay_iff_of_norm_eq (h : āxā = āyā) : ¬SameRay ā x y ā x ā y :=
(sameRay_iff_of_norm_eq h).not
/-- If two points on the same ray have the same norm, then they are equal. -/
theorem SameRay.eq_of_norm_eq (h : SameRay ā x y) (hn : āxā = āyā) : x = y :=
(sameRay_iff_of_norm_eq hn).mp h
/-- The norms of two vectors on the same ray are equal if and only if they are equal. -/
theorem SameRay.norm_eq_iff (h : SameRay ā x y) : āxā = āyā ā x = y :=
āØh.eq_of_norm_eq, fun h => h āø rflā© |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Module/Completion.lean | import Mathlib.Analysis.Normed.Group.Completion
import Mathlib.Analysis.Normed.Operator.NormedSpace
import Mathlib.Topology.Algebra.UniformRing
import Mathlib.Topology.Algebra.UniformField
/-!
# Normed space structure on the completion of a normed space
If `E` is a normed space over `š`, then so is `UniformSpace.Completion E`. In this file we provide
necessary instances and define `UniformSpace.Completion.toComplāįµ¢` - coercion
`E ā UniformSpace.Completion E` as a bundled linear isometry.
We also show that if `A` is a normed algebra over `š`, then so is `UniformSpace.Completion A`.
TODO: Generalise the results here from the concrete `completion` to any `AbstractCompletion`.
-/
noncomputable section
namespace UniformSpace
namespace Completion
variable (š E : Type*)
instance [NormedField š] [SeminormedAddCommGroup E] [NormedSpace š E] :
NormedSpace š (Completion E) where
norm_smul_le := norm_smul_le
section Module
variable {š E}
variable [Semiring š] [SeminormedAddCommGroup E] [Module š E] [UniformContinuousConstSMul š E]
/-- Embedding of a normed space to its completion as a linear isometry. -/
def toComplāįµ¢ : E āāįµ¢[š] Completion E :=
{ toCompl with
toFun := (ā)
map_smul' := coe_smul
norm_map' := norm_coe }
@[simp]
theorem coe_toComplāįµ¢ : ā(toComplāįµ¢ : E āāįµ¢[š] Completion E) = ((ā) : E ā Completion E) :=
rfl
/-- Embedding of a normed space to its completion as a continuous linear map. -/
def toComplL : E āL[š] Completion E :=
toComplāįµ¢.toContinuousLinearMap
@[simp]
theorem coe_toComplL : ā(toComplL : E āL[š] Completion E) = ((ā) : E ā Completion E) :=
rfl
@[simp]
theorem norm_toComplL {š E : Type*} [NontriviallyNormedField š] [NormedAddCommGroup E]
[NormedSpace š E] [Nontrivial E] : ā(toComplL : E āL[š] Completion E)ā = 1 :=
(toComplāįµ¢ : E āāįµ¢[š] Completion E).norm_toContinuousLinearMap
end Module
section Algebra
variable (A : Type*)
instance [SeminormedRing A] : NormedRing (Completion A) where
__ : NormedAddCommGroup (Completion A) := inferInstance
__ : Ring (Completion A) := inferInstance
norm_mul_le x y := by
induction x, y using induction_onā with
| hp => apply isClosed_le <;> fun_prop
| ih x y => simpa only [ā coe_mul, norm_coe] using norm_mul_le x y
instance [SeminormedCommRing A] : NormedCommRing (Completion A) where
__ : CommRing (Completion A) := inferInstance
__ : NormedRing (Completion A) := inferInstance
instance [NormedField š] [SeminormedCommRing A] [NormedAlgebra š A] :
NormedAlgebra š (Completion A) where
norm_smul_le := norm_smul_le
instance [NormedField A] [CompletableTopField A] :
NormedField (UniformSpace.Completion A) where
__ : NormedCommRing (Completion A) := inferInstance
__ : Field (Completion A) := inferInstance
norm_mul x y := induction_onā x y (isClosed_eq (by fun_prop) (by fun_prop)) (by simp [ā coe_mul])
end Algebra
end Completion
end UniformSpace |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Module/Complemented.lean | import Mathlib.Analysis.Normed.Operator.Banach
import Mathlib.Topology.Algebra.Module.FiniteDimension
/-!
# Complemented subspaces of normed vector spaces
A submodule `p` of a topological module `E` over `R` is called *complemented* if there exists
a continuous linear projection `f : E āā[R] p`, `ā x : p, f x = x`. We prove that for
a closed subspace of a normed space this condition is equivalent to existence of a closed
subspace `q` such that `p ā q = ā„`, `p ā q = ā¤`. We also prove that a subspace of finite codimension
is always a complemented subspace.
## Tags
complemented subspace, normed vector space
-/
variable {š E F G : Type*} [NontriviallyNormedField š] [NormedAddCommGroup E] [NormedSpace š E]
[NormedAddCommGroup F] [NormedSpace š F] [NormedAddCommGroup G] [NormedSpace š G]
noncomputable section
open LinearMap (ker range)
namespace ContinuousLinearMap
section
variable [CompleteSpace š]
theorem ker_closedComplemented_of_finiteDimensional_range (f : E āL[š] F)
[FiniteDimensional š (range f)] : (ker f).ClosedComplemented := by
set f' : E āL[š] range f := f.codRestrict _ (LinearMap.mem_range_self (f : E āā[š] F))
rcases f'.exists_right_inverse_of_surjective (f : E āā[š] F).range_rangeRestrict with āØg, hgā©
simpa only [f', ker_codRestrict]
using f'.closedComplemented_ker_of_rightInverse g (ContinuousLinearMap.ext_iff.1 hg)
end
variable [CompleteSpace E] [CompleteSpace (F Ć G)]
/-- If `f : E āL[R] F` and `g : E āL[R] G` are two surjective linear maps and
their kernels are complement of each other, then `x ⦠(f x, g x)` defines
a linear equivalence `E āL[R] F Ć G`. -/
nonrec def equivProdOfSurjectiveOfIsCompl (f : E āL[š] F) (g : E āL[š] G) (hf : range f = ā¤)
(hg : range g = ā¤) (hfg : IsCompl (ker f) (ker g)) : E āL[š] F Ć G :=
(f.equivProdOfSurjectiveOfIsCompl (g : E āā[š] G) hf hg hfg).toContinuousLinearEquivOfContinuous
(f.continuous.prodMk g.continuous)
@[simp]
theorem coe_equivProdOfSurjectiveOfIsCompl {f : E āL[š] F} {g : E āL[š] G} (hf : range f = ā¤)
(hg : range g = ā¤) (hfg : IsCompl (ker f) (ker g)) :
(equivProdOfSurjectiveOfIsCompl f g hf hg hfg : E āā[š] F Ć G) = f.prod g := rfl
@[simp]
theorem equivProdOfSurjectiveOfIsCompl_toLinearEquiv {f : E āL[š] F} {g : E āL[š] G}
(hf : range f = ā¤) (hg : range g = ā¤) (hfg : IsCompl (ker f) (ker g)) :
(equivProdOfSurjectiveOfIsCompl f g hf hg hfg).toLinearEquiv =
LinearMap.equivProdOfSurjectiveOfIsCompl f g hf hg hfg := rfl
@[simp]
theorem equivProdOfSurjectiveOfIsCompl_apply {f : E āL[š] F} {g : E āL[š] G} (hf : range f = ā¤)
(hg : range g = ā¤) (hfg : IsCompl (ker f) (ker g)) (x : E) :
equivProdOfSurjectiveOfIsCompl f g hf hg hfg x = (f x, g x) := rfl
end ContinuousLinearMap
namespace Submodule
variable [CompleteSpace E] (p q : Subspace š E)
/-- If `q` is a closed complement of a closed subspace `p`, then `p Ć q` is continuously
isomorphic to `E`. -/
def prodEquivOfClosedCompl (h : IsCompl p q) (hp : IsClosed (p : Set E))
(hq : IsClosed (q : Set E)) : (p Ć q) āL[š] E := by
haveI := hp.completeSpace_coe; haveI := hq.completeSpace_coe
refine (p.prodEquivOfIsCompl q h).toContinuousLinearEquivOfContinuous ?_
exact (p.subtypeL.coprod q.subtypeL).continuous
/-- Projection to a closed submodule along a closed complement. -/
def linearProjOfClosedCompl (h : IsCompl p q) (hp : IsClosed (p : Set E))
(hq : IsClosed (q : Set E)) : E āL[š] p :=
ContinuousLinearMap.fst š p q āL ā(prodEquivOfClosedCompl p q h hp hq).symm
variable {p q}
@[simp]
theorem coe_prodEquivOfClosedCompl (h : IsCompl p q) (hp : IsClosed (p : Set E))
(hq : IsClosed (q : Set E)) :
ā(p.prodEquivOfClosedCompl q h hp hq) = p.prodEquivOfIsCompl q h := rfl
@[simp]
theorem coe_prodEquivOfClosedCompl_symm (h : IsCompl p q) (hp : IsClosed (p : Set E))
(hq : IsClosed (q : Set E)) :
ā(p.prodEquivOfClosedCompl q h hp hq).symm = (p.prodEquivOfIsCompl q h).symm := rfl
@[simp]
theorem coe_continuous_linearProjOfClosedCompl (h : IsCompl p q) (hp : IsClosed (p : Set E))
(hq : IsClosed (q : Set E)) :
(p.linearProjOfClosedCompl q h hp hq : E āā[š] p) = p.linearProjOfIsCompl q h := rfl
@[simp]
theorem coe_continuous_linearProjOfClosedCompl' (h : IsCompl p q) (hp : IsClosed (p : Set E))
(hq : IsClosed (q : Set E)) :
ā(p.linearProjOfClosedCompl q h hp hq) = p.linearProjOfIsCompl q h := rfl
theorem ClosedComplemented.of_isCompl_isClosed (h : IsCompl p q) (hp : IsClosed (p : Set E))
(hq : IsClosed (q : Set E)) : p.ClosedComplemented :=
āØp.linearProjOfClosedCompl q h hp hq, Submodule.linearProjOfIsCompl_apply_left hā©
alias IsCompl.closedComplemented_of_isClosed := ClosedComplemented.of_isCompl_isClosed
theorem closedComplemented_iff_isClosed_exists_isClosed_isCompl :
p.ClosedComplemented ā
IsClosed (p : Set E) ā§ ā q : Submodule š E, IsClosed (q : Set E) ā§ IsCompl p q :=
āØfun h => āØh.isClosed, h.exists_isClosed_isComplā©,
fun āØhp, āØ_, hq, hpqā©ā© => .of_isCompl_isClosed hpq hp hqā©
theorem ClosedComplemented.of_quotient_finiteDimensional [CompleteSpace š]
[FiniteDimensional š (E ā§ø p)] (hp : IsClosed (p : Set E)) : p.ClosedComplemented := by
obtain āØq, hqā© : ā q, IsCompl p q := p.exists_isCompl
haveI : FiniteDimensional š q := (p.quotientEquivOfIsCompl q hq).finiteDimensional
exact .of_isCompl_isClosed hq hp q.closed_of_finiteDimensional
end Submodule |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Module/Basic.lean | import Mathlib.Algebra.Algebra.Pi
import Mathlib.Algebra.Algebra.Prod
import Mathlib.Algebra.Algebra.Rat
import Mathlib.Algebra.Algebra.RestrictScalars
import Mathlib.Algebra.Module.Rat
import Mathlib.Analysis.Normed.Field.Lemmas
import Mathlib.Analysis.Normed.MulAction
/-!
# Normed spaces
In this file we define (semi)normed spaces and algebras. We also prove some theorems
about these definitions.
-/
variable {š š' E F α : Type*}
open Filter Metric Function Set Topology Bornology
open scoped NNReal ENNReal uniformity
section SeminormedAddCommGroup
-- Here, we set a rather high priority for the instance `[NormedSpace š E] : Module š E`
-- to take precedence over `Semiring.toModule` as this leads to instance paths with better
-- unification properties.
/-- A normed space over a normed field is a vector space endowed with a norm which satisfies the
equality `āc ⢠xā = ācā āxā`. We require only `āc ⢠xā ⤠ācā āxā` in the definition, then prove
`āc ⢠xā = ācā āxā` in `norm_smul`.
Note that since this requires `SeminormedAddCommGroup` and not `NormedAddCommGroup`, this
typeclass can be used for "seminormed spaces" too, just as `Module` can be used for
"semimodules". -/
@[ext]
class NormedSpace (š : Type*) (E : Type*) [NormedField š] [SeminormedAddCommGroup E]
extends Module š E where
protected norm_smul_le : ā (a : š) (b : E), āa ⢠bā ⤠āaā * ābā
attribute [inherit_doc NormedSpace] NormedSpace.norm_smul_le
variable [NormedField š] [SeminormedAddCommGroup E] [SeminormedAddCommGroup F]
variable [NormedSpace š E] [NormedSpace š F]
-- see Note [lower instance priority]
instance (priority := 100) NormedSpace.toNormSMulClass [NormedSpace š E] : NormSMulClass š E :=
haveI : IsBoundedSMul š E := .of_norm_smul_le NormedSpace.norm_smul_le
NormedDivisionRing.toNormSMulClass
/-- This is a shortcut instance, which was found to help with performance in
https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/Normed.20modules/near/516757412.
It is implied via `NormedSpace.toNormSMulClass`. -/
instance NormedSpace.toIsBoundedSMul [NormedSpace š E] : IsBoundedSMul š E := inferInstance
instance NormedField.toNormedSpace : NormedSpace š š where norm_smul_le a b := norm_mul_le a b
variable (š) in
theorem norm_zsmul (n : ā¤) (x : E) : ān ⢠xā = ā(n : š)ā * āxā := by
rw [ā norm_smul, ā Int.smul_one_eq_cast, smul_assoc, one_smul]
theorem norm_intCast_eq_abs_mul_norm_one (α) [SeminormedRing α] [NormSMulClass ⤠α] (n : ā¤) :
ā(n : α)ā = |n| * ā(1 : α)ā := by
rw [ā zsmul_one, norm_smul, Int.norm_eq_abs, Int.cast_abs]
theorem norm_natCast_eq_mul_norm_one (α) [SeminormedRing α] [NormSMulClass ⤠α] (n : ā) :
ā(n : α)ā = n * ā(1 : α)ā := by
simpa using norm_intCast_eq_abs_mul_norm_one α n
@[simp]
lemma norm_natCast {α : Type*} [SeminormedRing α] [NormOneClass α] [NormSMulClass ⤠α]
(a : ā) : ā(a : α)ā = a := by
simpa using norm_natCast_eq_mul_norm_one α a
theorem eventually_nhds_norm_smul_sub_lt (c : š) (x : E) {ε : ā} (h : 0 < ε) :
āį¶ y in š x, āc ⢠(y - x)ā < ε :=
have : Tendsto (fun y ⦠āc ⢠(y - x)ā) (š x) (š 0) :=
Continuous.tendsto' (by fun_prop) _ _ (by simp)
this.eventually (gt_mem_nhds h)
theorem Filter.Tendsto.zero_smul_isBoundedUnder_le {f : α ā š} {g : α ā E} {l : Filter α}
(hf : Tendsto f l (š 0)) (hg : IsBoundedUnder (Ā· ⤠·) l (Norm.norm ā g)) :
Tendsto (fun x => f x ⢠g x) l (š 0) :=
hf.op_zero_isBoundedUnder_le hg (· ⢠·) norm_smul_le
theorem Filter.IsBoundedUnder.smul_tendsto_zero {f : α ā š} {g : α ā E} {l : Filter α}
(hf : IsBoundedUnder (Ā· ⤠·) l (norm ā f)) (hg : Tendsto g l (š 0)) :
Tendsto (fun x => f x ⢠g x) l (š 0) :=
hg.op_zero_isBoundedUnder_le hf (flip (· ⢠·)) fun x y =>
(norm_smul_le y x).trans_eq (mul_comm _ _)
instance NormedSpace.discreteTopology_zmultiples
{E : Type*} [NormedAddCommGroup E] [NormedSpace ā E] (e : E) :
DiscreteTopology <| AddSubgroup.zmultiples e := by
have : IsAddTorsionFree E := .of_module_rat E
rcases eq_or_ne e 0 with (rfl | he)
Ā· rw [AddSubgroup.zmultiples_zero_eq_bot]
exact Subsingleton.discreteTopology (α := ā(ā„ : Subspace ā E))
Ā· rw [discreteTopology_iff_isOpen_singleton_zero, isOpen_induced_iff]
refine āØMetric.ball 0 āeā, Metric.isOpen_ball, ?_ā©
ext āØx, hxā©
obtain āØk, rflā© := AddSubgroup.mem_zmultiples_iff.mp hx
rw [mem_preimage, mem_ball_zero_iff, AddSubgroup.coe_mk, mem_singleton_iff, Subtype.ext_iff,
AddSubgroup.coe_mk, AddSubgroup.coe_zero, norm_zsmul ā k e, Int.norm_cast_rat,
Int.norm_eq_abs, mul_lt_iff_lt_one_left (norm_pos_iff.mpr he), ā @Int.cast_one ā _,
ā Int.cast_abs, Int.cast_lt, Int.abs_lt_one_iff, smul_eq_zero, or_iff_left he]
open NormedField
instance ULift.normedSpace : NormedSpace š (ULift E) :=
{ __ := ULift.seminormedAddCommGroup (E := E),
__ := ULift.module'
norm_smul_le := fun s x => (norm_smul_le s x.down :) }
/-- The product of two normed spaces is a normed space, with the sup norm. -/
instance Prod.normedSpace : NormedSpace š (E Ć F) :=
{ Prod.seminormedAddCommGroup (E := E) (F := F), Prod.instModule with
norm_smul_le := fun s x => by
simp only [norm_smul, Prod.norm_def,
mul_max_of_nonneg, norm_nonneg, le_rfl] }
/-- The product of finitely many normed spaces is a normed space, with the sup norm. -/
instance Pi.normedSpace {ι : Type*} {E : ι ā Type*} [Fintype ι] [ā i, SeminormedAddCommGroup (E i)]
[ā i, NormedSpace š (E i)] : NormedSpace š (ā i, E i) where
norm_smul_le a f := by
simp_rw [ā coe_nnnorm, ā NNReal.coe_mul, NNReal.coe_le_coe, Pi.nnnorm_def,
NNReal.mul_finset_sup]
exact Finset.sup_mono_fun fun _ _ => norm_smul_le a _
instance SeparationQuotient.instNormedSpace : NormedSpace š (SeparationQuotient E) where
norm_smul_le := norm_smul_le
instance MulOpposite.instNormedSpace : NormedSpace š Eįµįµįµ where
norm_smul_le _ x := norm_smul_le _ x.unop
/-- A subspace of a normed space is also a normed space, with the restriction of the norm. -/
instance Submodule.normedSpace {š R : Type*} [SMul š R] [NormedField š] [Ring R] {E : Type*}
[SeminormedAddCommGroup E] [NormedSpace š E] [Module R E] [IsScalarTower š R E]
(s : Submodule R E) : NormedSpace š s where
norm_smul_le c x := norm_smul_le c (x : E)
variable {S š R E : Type*} [SMul š R] [NormedField š] [Ring R] [SeminormedAddCommGroup E]
variable [NormedSpace š E] [Module R E] [IsScalarTower š R E] [SetLike S E] [AddSubgroupClass S E]
variable [SMulMemClass S R E] (s : S)
instance (priority := 75) SubmoduleClass.toNormedSpace : NormedSpace š s where
norm_smul_le c x := norm_smul_le c (x : E)
end SeminormedAddCommGroup
/-- A linear map from a `Module` to a `NormedSpace` induces a `NormedSpace` structure on the
domain, using the `SeminormedAddCommGroup.induced` norm.
See note [reducible non-instances] -/
abbrev NormedSpace.induced {F : Type*} (š E G : Type*) [NormedField š] [AddCommGroup E] [Module š E]
[SeminormedAddCommGroup G] [NormedSpace š G] [FunLike F E G] [LinearMapClass F š E G] (f : F) :
@NormedSpace š E _ (SeminormedAddCommGroup.induced E G f) :=
let _ := SeminormedAddCommGroup.induced E G f
āØfun a b ⦠by simpa only [ā map_smul f a b] using norm_smul_le a (f b)ā©
section NontriviallyNormedSpace
variable (š E)
variable [NontriviallyNormedField š] [NormedAddCommGroup E] [NormedSpace š E] [Nontrivial E]
include š
/-- If `E` is a nontrivial normed space over a nontrivially normed field `š`, then `E` is unbounded:
for any `c : ā`, there exists a vector `x : E` with norm strictly greater than `c`. -/
theorem NormedSpace.exists_lt_norm (c : ā) : ā x : E, c < āxā := by
rcases exists_ne (0 : E) with āØx, hxā©
rcases NormedField.exists_lt_norm š (c / āxā) with āØr, hrā©
use r ⢠x
rwa [norm_smul, ā div_lt_iffā]
rwa [norm_pos_iff]
protected theorem NormedSpace.unbounded_univ : ¬Bornology.IsBounded (univ : Set E) := fun h =>
let āØR, hRā© := isBounded_iff_forall_norm_le.1 h
let āØx, hxā© := NormedSpace.exists_lt_norm š E R
hx.not_ge (hR x trivial)
protected lemma NormedSpace.cobounded_neBot : NeBot (cobounded E) := by
rw [neBot_iff, Ne, cobounded_eq_bot_iff, ā isBounded_univ]
exact NormedSpace.unbounded_univ š E
instance (priority := 100) NontriviallyNormedField.cobounded_neBot : NeBot (cobounded š) :=
NormedSpace.cobounded_neBot š š
instance (priority := 80) RealNormedSpace.cobounded_neBot [NormedSpace ā E] :
NeBot (cobounded E) := NormedSpace.cobounded_neBot ā E
instance (priority := 80) NontriviallyNormedField.infinite : Infinite š :=
āØfun _ ⦠NormedSpace.unbounded_univ š š (Set.toFinite _).isBoundedā©
end NontriviallyNormedSpace
section NormedSpace
variable (š E)
variable [NormedField š] [Infinite š] [NormedAddCommGroup E] [Nontrivial E] [NormedSpace š E]
include š
/-- A normed vector space over an infinite normed field is a noncompact space.
This cannot be an instance because in order to apply it,
Lean would have to search for `NormedSpace š E` with unknown `š`.
We register this as an instance in two cases: `š = E` and `š = ā`. -/
protected theorem NormedSpace.noncompactSpace : NoncompactSpace E := by
by_cases! H : ā c : š, c ā 0 ā§ ācā ā 1
Ā· letI := NontriviallyNormedField.ofNormNeOne H
exact āØfun h ⦠NormedSpace.unbounded_univ š E h.isBoundedā©
Ā· rcases exists_ne (0 : E) with āØx, hxā©
suffices IsClosedEmbedding (Infinite.natEmbedding š Ā· ⢠x) from this.noncompactSpace
refine isClosedEmbedding_of_pairwise_le_dist (norm_pos_iff.2 hx) fun k n hne ⦠?_
simp only [dist_eq_norm, ā sub_smul, norm_smul]
rw [H, one_mul]
rwa [sub_ne_zero, (Embedding.injective _).ne_iff]
instance (priority := 100) NormedField.noncompactSpace : NoncompactSpace š :=
NormedSpace.noncompactSpace š š
instance (priority := 100) RealNormedSpace.noncompactSpace [NormedSpace ā E] : NoncompactSpace E :=
NormedSpace.noncompactSpace ā E
end NormedSpace
section NormedAlgebra
/-- A normed algebra `š'` over `š` is normed module that is also an algebra.
See the implementation notes for `Algebra` for a discussion about non-unital algebras. Following
the strategy there, a non-unital *normed* algebra can be written as:
```lean
variable [NormedField š] [NonUnitalSeminormedRing š']
variable [NormedSpace š š'] [SMulCommClass š š' š'] [IsScalarTower š š' š']
```
-/
class NormedAlgebra (š : Type*) (š' : Type*) [NormedField š] [SeminormedRing š'] extends
Algebra š š' where
norm_smul_le : ā (r : š) (x : š'), ār ⢠xā ⤠ārā * āxā
attribute [inherit_doc NormedAlgebra] NormedAlgebra.norm_smul_le
variable (š')
variable [NormedField š] [SeminormedRing š'] [NormedAlgebra š š']
instance (priority := 100) NormedAlgebra.toNormedSpace : NormedSpace š š' :=
{ NormedAlgebra.toAlgebra.toModule with
norm_smul_le := NormedAlgebra.norm_smul_le }
theorem norm_algebraMap (x : š) : āalgebraMap š š' xā = āxā * ā(1 : š')ā := by
rw [Algebra.algebraMap_eq_smul_one]
exact norm_smul _ _
theorem nnnorm_algebraMap (x : š) : āalgebraMap š š' xāā = āxāā * ā(1 : š')āā :=
Subtype.ext <| norm_algebraMap š' x
theorem dist_algebraMap (x y : š) :
(dist (algebraMap š š' x) (algebraMap š š' y)) = dist x y * ā(1 : š')ā := by
simp only [dist_eq_norm, ā map_sub, norm_algebraMap]
/-- This is a simpler version of `norm_algebraMap` when `ā1ā = 1` in `š'`. -/
@[simp]
theorem norm_algebraMap' [NormOneClass š'] (x : š) : āalgebraMap š š' xā = āxā := by
rw [norm_algebraMap, norm_one, mul_one]
@[simp]
theorem Algebra.norm_smul_one_eq_norm [NormOneClass š'] (x : š) : āx ⢠(1 : š')ā = āxā := by
simp [norm_smul]
/-- This is a simpler version of `nnnorm_algebraMap` when `ā1ā = 1` in `š'`. -/
@[simp]
theorem nnnorm_algebraMap' [NormOneClass š'] (x : š) : āalgebraMap š š' xāā = āxāā :=
Subtype.ext <| norm_algebraMap' _ _
/-- This is a simpler version of `dist_algebraMap` when `ā1ā = 1` in `š'`. -/
@[simp]
theorem dist_algebraMap' [NormOneClass š'] (x y : š) :
(dist (algebraMap š š' x) (algebraMap š š' y)) = dist x y := by
simp only [dist_eq_norm, ā map_sub, norm_algebraMap']
section NNReal
variable [NormOneClass š'] [NormedAlgebra ā š']
@[simp]
theorem norm_algebraMap_nnreal (x : āā„0) : āalgebraMap āā„0 š' xā = x :=
(norm_algebraMap' š' (x : ā)).symm āø Real.norm_of_nonneg x.prop
@[simp]
theorem nnnorm_algebraMap_nnreal (x : āā„0) : āalgebraMap āā„0 š' xāā = x :=
Subtype.ext <| norm_algebraMap_nnreal š' x
end NNReal
variable (š)
open Filter Bornology in
/-- Preimages of cobounded sets under the algebra map are cobounded. -/
@[simp]
theorem tendsto_algebraMap_cobounded (š š' : Type*) [NormedField š] [SeminormedRing š']
[NormedAlgebra š š'] [NormOneClass š'] :
Tendsto (algebraMap š š') (cobounded š) (cobounded š') := by
intro c hc
rw [mem_map]
rw [ā isCobounded_def, ā isBounded_compl_iff, isBounded_iff_forall_norm_le] at hc ā¢
obtain āØs, hsā© := hc
exact āØs, fun x hx ⦠by simpa using hs (algebraMap š š' x) hxā©
@[deprecated (since := "2025-11-04")] alias
algebraMap_cobounded_le_cobounded := tendsto_algebraMap_cobounded
/-- In a normed algebra, the inclusion of the base field in the extended field is an isometry. -/
theorem algebraMap_isometry [NormOneClass š'] : Isometry (algebraMap š š') := by
refine Isometry.of_dist_eq fun x y => ?_
rw [dist_eq_norm, dist_eq_norm, ā RingHom.map_sub, norm_algebraMap']
instance NormedAlgebra.id : NormedAlgebra š š :=
{ NormedField.toNormedSpace, Algebra.id š with }
/-- Any normed characteristic-zero division ring that is a normed algebra over the reals is also a
normed algebra over the rationals.
Phrased another way, if `š` is a normed algebra over the reals, then `AlgebraRat` respects that
norm. -/
instance normedAlgebraRat {š} [NormedDivisionRing š] [CharZero š] [NormedAlgebra ā š] :
NormedAlgebra ā š where
norm_smul_le q x := by
rw [ā smul_one_smul ā q x, Rat.smul_one_eq_cast, norm_smul, Rat.norm_cast_real]
instance PUnit.normedAlgebra : NormedAlgebra š PUnit where
norm_smul_le q _ := by simp only [norm_eq_zero, mul_zero, le_refl]
instance : NormedAlgebra š (ULift š') :=
{ ULift.normedSpace, ULift.algebra with }
/-- The product of two normed algebras is a normed algebra, with the sup norm. -/
instance Prod.normedAlgebra {E F : Type*} [SeminormedRing E] [SeminormedRing F] [NormedAlgebra š E]
[NormedAlgebra š F] : NormedAlgebra š (E Ć F) :=
{ Prod.normedSpace, Prod.algebra š E F with }
/-- The product of finitely many normed algebras is a normed algebra, with the sup norm. -/
instance Pi.normedAlgebra {ι : Type*} {E : ι ā Type*} [Fintype ι] [ā i, SeminormedRing (E i)]
[ā i, NormedAlgebra š (E i)] : NormedAlgebra š (ā i, E i) :=
{ Pi.normedSpace, Pi.algebra _ E with }
variable [SeminormedRing E] [NormedAlgebra š E]
instance SeparationQuotient.instNormedAlgebra : NormedAlgebra š (SeparationQuotient E) where
__ : NormedSpace š (SeparationQuotient E) := inferInstance
__ : Algebra š (SeparationQuotient E) := inferInstance
instance MulOpposite.instNormedAlgebra {E : Type*} [SeminormedRing E] [NormedAlgebra š E] :
NormedAlgebra š Eįµįµįµ where
__ := instAlgebra
__ := instNormedSpace
end NormedAlgebra
/-- A non-unital algebra homomorphism from an `Algebra` to a `NormedAlgebra` induces a
`NormedAlgebra` structure on the domain, using the `SeminormedRing.induced` norm.
See note [reducible non-instances] -/
abbrev NormedAlgebra.induced {F : Type*} (š R S : Type*) [NormedField š] [Ring R] [Algebra š R]
[SeminormedRing S] [NormedAlgebra š S] [FunLike F R S] [NonUnitalAlgHomClass F š R S]
(f : F) :
@NormedAlgebra š R _ (SeminormedRing.induced R S f) :=
letI := SeminormedRing.induced R S f
āØfun a b ⦠show āf (a ⢠b)ā ⤠āaā * āf bā from (map_smul f a b).symm āø norm_smul_le a (f b)ā©
instance Subalgebra.toNormedAlgebra {š A : Type*} [SeminormedRing A] [NormedField š]
[NormedAlgebra š A] (S : Subalgebra š A) : NormedAlgebra š S :=
NormedAlgebra.induced š S A S.val
section SubalgebraClass
variable {S š E : Type*} [NormedField š] [SeminormedRing E] [NormedAlgebra š E]
variable [SetLike S E] [SubringClass S E] [SMulMemClass S š E] (s : S)
instance (priority := 75) SubalgebraClass.toNormedAlgebra : NormedAlgebra š s where
norm_smul_le c x := norm_smul_le c (x : E)
end SubalgebraClass
section RestrictScalars
section NormInstances
instance [I : SeminormedAddCommGroup E] :
SeminormedAddCommGroup (RestrictScalars š š' E) :=
I
instance [I : NormedAddCommGroup E] :
NormedAddCommGroup (RestrictScalars š š' E) :=
I
instance [I : NonUnitalSeminormedRing E] :
NonUnitalSeminormedRing (RestrictScalars š š' E) :=
I
instance [I : NonUnitalNormedRing E] :
NonUnitalNormedRing (RestrictScalars š š' E) :=
I
instance [I : SeminormedRing E] :
SeminormedRing (RestrictScalars š š' E) :=
I
instance [I : NormedRing E] :
NormedRing (RestrictScalars š š' E) :=
I
instance [I : NonUnitalSeminormedCommRing E] :
NonUnitalSeminormedCommRing (RestrictScalars š š' E) :=
I
instance [I : NonUnitalNormedCommRing E] :
NonUnitalNormedCommRing (RestrictScalars š š' E) :=
I
instance [I : SeminormedCommRing E] :
SeminormedCommRing (RestrictScalars š š' E) :=
I
instance [I : NormedCommRing E] :
NormedCommRing (RestrictScalars š š' E) :=
I
end NormInstances
section NormedSpace
variable (š š' E)
variable [NormedField š] [NormedField š'] [NormedAlgebra š š']
[SeminormedAddCommGroup E] [NormedSpace š' E]
/-- If `E` is a normed space over `š'` and `š` is a normed algebra over `š'`, then
`RestrictScalars.module` is additionally a `NormedSpace`. -/
instance RestrictScalars.normedSpace : NormedSpace š (RestrictScalars š š' E) :=
{ RestrictScalars.module š š' E with
norm_smul_le := fun c x =>
(norm_smul_le (algebraMap š š' c) (_ : E)).trans_eq <| by rw [norm_algebraMap'] }
-- If you think you need this, consider instead reproducing `RestrictScalars.lsmul`
-- appropriately modified here.
/-- The action of the original normed_field on `RestrictScalars š š' E`.
This is not an instance as it would be contrary to the purpose of `RestrictScalars`.
-/
def Module.RestrictScalars.normedSpaceOrig {š : Type*} {š' : Type*} {E : Type*} [NormedField š']
[SeminormedAddCommGroup E] [I : NormedSpace š' E] : NormedSpace š' (RestrictScalars š š' E) :=
I
/-- Warning: This declaration should be used judiciously.
Please consider using `IsScalarTower` and/or `RestrictScalars š š' E` instead.
This definition allows the `RestrictScalars.normedSpace` instance to be put directly on `E`
rather on `RestrictScalars š š' E`. This would be a very bad instance; both because `š'` cannot be
inferred, and because it is likely to create instance diamonds.
See Note [reducible non-instances].
-/
abbrev NormedSpace.restrictScalars : NormedSpace š E :=
RestrictScalars.normedSpace _ š' E
theorem NormedSpace.restrictScalars_eq {E : Type*} [SeminormedAddCommGroup E]
[h : NormedSpace š E] [NormedSpace š' E] [IsScalarTower š š' E] :
NormedSpace.restrictScalars š š' E = h := by
ext
apply algebraMap_smul
end NormedSpace
section NormedAlgebra
variable (š š' E)
variable [NormedField š] [NormedField š'] [NormedAlgebra š š']
[SeminormedRing E] [NormedAlgebra š' E]
/-- If `E` is a normed algebra over `š'` and `š` is a normed algebra over `š'`, then
`RestrictScalars.module` is additionally a `NormedAlgebra`. -/
instance RestrictScalars.normedAlgebra : NormedAlgebra š (RestrictScalars š š' E) :=
{ RestrictScalars.algebra š š' E with
norm_smul_le := norm_smul_le }
-- If you think you need this, consider instead reproducing `RestrictScalars.lsmul`
-- appropriately modified here.
/-- The action of the original normed_field on `RestrictScalars š š' E`.
This is not an instance as it would be contrary to the purpose of `RestrictScalars`.
-/
def Module.RestrictScalars.normedAlgebraOrig {š : Type*} {š' : Type*} {E : Type*} [NormedField š']
[SeminormedRing E] [I : NormedAlgebra š' E] : NormedAlgebra š' (RestrictScalars š š' E) :=
I
/-- Warning: This declaration should be used judiciously.
Please consider using `IsScalarTower` and/or `RestrictScalars š š' E` instead.
This definition allows the `RestrictScalars.normedAlgebra` instance to be put directly on `E`
rather on `RestrictScalars š š' E`. This would be a very bad instance; both because `š'` cannot be
inferred, and because it is likely to create instance diamonds.
See Note [reducible non-instances].
-/
abbrev NormedAlgebra.restrictScalars : NormedAlgebra š E :=
RestrictScalars.normedAlgebra _ š' _
end NormedAlgebra
end RestrictScalars
section Core
/-!
### Structures for constructing new normed spaces
This section contains tools meant for constructing new normed spaces. These allow one to easily
construct all the relevant instances (distances measures, etc) while proving only a minimal
set of axioms. Furthermore, tools are provided to add a norm structure to a type that already
has a preexisting uniformity or bornology: in such cases, it is necessary to keep the preexisting
instances, while ensuring that the norm induces the same uniformity/bornology.
-/
open scoped Uniformity Bornology
/-- A structure encapsulating minimal axioms needed to defined a seminormed vector space, as found
in textbooks. This is meant to be used to easily define `SeminormedSpace E` instances from
scratch on a type with no preexisting distance or topology. -/
structure SeminormedSpace.Core (š : Type*) (E : Type*) [NormedField š] [AddCommGroup E]
[Norm E] [Module š E] : Prop where
norm_nonneg (x : E) : 0 ⤠āxā
norm_smul (c : š) (x : E) : āc ⢠xā = ācā * āxā
norm_triangle (x y : E) : āx + yā ⤠āxā + āyā
@[deprecated (since := "2025-06-03")] alias SeminormedAddCommGroup.Core := SeminormedSpace.Core
/-- Produces a `PseudoMetricSpace E` instance from a `SeminormedSpace.Core`. Note that
if this is used to define an instance on a type, it also provides a new uniformity and
topology on the type. See note [reducible non-instances]. -/
abbrev PseudoMetricSpace.ofSeminormedSpaceCore {š E : Type*} [NormedField š] [AddCommGroup E]
[Norm E] [Module š E] (core : SeminormedSpace.Core š E) :
PseudoMetricSpace E where
dist x y := āx - yā
dist_self x := by
show āx - xā = 0
simp only [sub_self]
have : (0 : E) = (0 : š) ⢠(0 : E) := by simp
rw [this, core.norm_smul]
simp
dist_comm x y := by
show āx - yā = āy - xā
have : y - x = (-1 : š) ⢠(x - y) := by simp
rw [this, core.norm_smul]
simp
dist_triangle x y z := by
show āx - zā ⤠āx - yā + āy - zā
have : x - z = (x - y) + (y - z) := by abel
rw [this]
exact core.norm_triangle _ _
edist_dist x y := by exact (ENNReal.ofReal_eq_coe_nnreal _).symm
@[deprecated (since := "2025-06-03")]
alias PseudoMetricSpace.ofSeminormedAddCommGroupCore := PseudoMetricSpace.ofSeminormedSpaceCore
/-- Produces a `PseudoEMetricSpace E` instance from a `SeminormedSpace.Core`. Note that
if this is used to define an instance on a type, it also provides a new uniformity and
topology on the type. See note [reducible non-instances]. -/
abbrev PseudoEMetricSpace.ofSeminormedSpaceCore {š E : Type*} [NormedField š]
[AddCommGroup E] [Norm E] [Module š E]
(core : SeminormedSpace.Core š E) : PseudoEMetricSpace E :=
(PseudoMetricSpace.ofSeminormedSpaceCore core).toPseudoEMetricSpace
@[deprecated (since := "2025-06-03")]
alias PseudoEMetricSpace.ofSeminormedAddCommGroupCore := PseudoEMetricSpace.ofSeminormedSpaceCore
/-- Produces a `PseudoEMetricSpace E` instance from a `SeminormedSpace.Core` on a type that
already has an existing uniform space structure. This requires a proof that the uniformity induced
by the norm is equal to the preexisting uniformity. See note [reducible non-instances]. -/
abbrev PseudoMetricSpace.ofSeminormedSpaceCoreReplaceUniformity {š E : Type*} [NormedField š]
[AddCommGroup E] [Norm E] [Module š E] [U : UniformSpace E]
(core : SeminormedSpace.Core š E)
(H : š¤[U] = š¤[PseudoEMetricSpace.toUniformSpace
(self := PseudoEMetricSpace.ofSeminormedSpaceCore core)]) :
PseudoMetricSpace E :=
.replaceUniformity (.ofSeminormedSpaceCore core) H
@[deprecated (since := "2025-06-03")]
alias PseudoMetricSpace.ofSeminormedAddCommGroupCoreReplaceUniformity :=
PseudoMetricSpace.ofSeminormedSpaceCoreReplaceUniformity
/-- Produces a `PseudoEMetricSpace E` instance from a `SeminormedSpace.Core` on a type that
already has an existing topology. This requires a proof that the topology induced
by the norm is equal to the preexisting topology. See note [reducible non-instances]. -/
abbrev PseudoMetricSpace.ofSeminormedSpaceCoreReplaceTopology {š E : Type*} [NormedField š]
[AddCommGroup E] [Norm E] [Module š E] [T : TopologicalSpace E]
(core : SeminormedSpace.Core š E)
(H : T = (PseudoEMetricSpace.ofSeminormedSpaceCore
core).toUniformSpace.toTopologicalSpace) :
PseudoMetricSpace E :=
.replaceTopology (.ofSeminormedSpaceCore core) H
open Bornology in
/-- Produces a `PseudoEMetricSpace E` instance from a `SeminormedSpace.Core` on a type that
already has a preexisting uniform space structure and a preexisting bornology. This requires proofs
that the uniformity induced by the norm is equal to the preexisting uniformity, and likewise for
the bornology. See note [reducible non-instances]. -/
abbrev PseudoMetricSpace.ofSeminormedSpaceCoreReplaceAll {š E : Type*} [NormedField š]
[AddCommGroup E] [Norm E] [Module š E] [U : UniformSpace E] [B : Bornology E]
(core : SeminormedSpace.Core š E)
(HU : š¤[U] = š¤[PseudoEMetricSpace.toUniformSpace
(self := PseudoEMetricSpace.ofSeminormedSpaceCore core)])
(HB : ā s : Set E, @IsBounded _ B s
ā @IsBounded _ (PseudoMetricSpace.ofSeminormedSpaceCore core).toBornology s) :
PseudoMetricSpace E :=
.replaceBornology (.replaceUniformity (.ofSeminormedSpaceCore core) HU) HB
@[deprecated (since := "2025-06-03")]
alias PseudoMetricSpace.ofSeminormedAddCommGroupCoreReplaceAll :=
PseudoMetricSpace.ofSeminormedSpaceCoreReplaceAll
/-- Produces a `SeminormedAddCommGroup E` instance from a `SeminormedSpace.Core`. Note that
if this is used to define an instance on a type, it also provides a new distance measure from the
norm. it must therefore not be used on a type with a preexisting distance measure or topology.
See note [reducible non-instances]. -/
abbrev SeminormedAddCommGroup.ofCore {š : Type*} {E : Type*} [NormedField š] [AddCommGroup E]
[Norm E] [Module š E] (core : SeminormedSpace.Core š E) : SeminormedAddCommGroup E :=
{ PseudoMetricSpace.ofSeminormedSpaceCore core with }
/-- Produces a `SeminormedAddCommGroup E` instance from a `SeminormedSpace.Core` on a type
that already has an existing uniform space structure. This requires a proof that the uniformity
induced by the norm is equal to the preexisting uniformity. See note [reducible non-instances]. -/
abbrev SeminormedAddCommGroup.ofCoreReplaceUniformity {š : Type*} {E : Type*} [NormedField š]
[AddCommGroup E] [Norm E] [Module š E] [U : UniformSpace E]
(core : SeminormedSpace.Core š E)
(H : š¤[U] = š¤[PseudoEMetricSpace.toUniformSpace
(self := PseudoEMetricSpace.ofSeminormedSpaceCore core)]) :
SeminormedAddCommGroup E :=
{ PseudoMetricSpace.ofSeminormedSpaceCoreReplaceUniformity core H with }
/-- Produces a `SeminormedAddCommGroup E` instance from a `SeminormedSpace.Core` on a type
that already has an existing topology. This requires a proof that the uniformity
induced by the norm is equal to the preexisting uniformity. See note [reducible non-instances]. -/
abbrev SeminormedAddCommGroup.ofCoreReplaceTopology {š : Type*} {E : Type*} [NormedField š]
[AddCommGroup E] [Norm E] [Module š E] [T : TopologicalSpace E]
(core : SeminormedSpace.Core š E)
(H : T = (PseudoEMetricSpace.ofSeminormedSpaceCore
core).toUniformSpace.toTopologicalSpace) :
SeminormedAddCommGroup E :=
{ PseudoMetricSpace.ofSeminormedSpaceCoreReplaceTopology core H with }
open Bornology in
/-- Produces a `SeminormedAddCommGroup E` instance from a `SeminormedSpace.Core` on a type
that already has a preexisting uniform space structure and a preexisting bornology. This requires
proofs that the uniformity induced by the norm is equal to the preexisting uniformity, and likewise
for the bornology. See note [reducible non-instances]. -/
abbrev SeminormedAddCommGroup.ofCoreReplaceAll {š : Type*} {E : Type*} [NormedField š]
[AddCommGroup E] [Norm E] [Module š E] [U : UniformSpace E] [B : Bornology E]
(core : SeminormedSpace.Core š E)
(HU : š¤[U] = š¤[PseudoEMetricSpace.toUniformSpace
(self := PseudoEMetricSpace.ofSeminormedSpaceCore core)])
(HB : ā s : Set E, @IsBounded _ B s
ā @IsBounded _ (PseudoMetricSpace.ofSeminormedSpaceCore core).toBornology s) :
SeminormedAddCommGroup E :=
{ PseudoMetricSpace.ofSeminormedSpaceCoreReplaceAll core HU HB with }
/-- A structure encapsulating minimal axioms needed to defined a normed vector space, as found
in textbooks. This is meant to be used to easily define `NormedAddCommGroup E` and `NormedSpace E`
instances from scratch on a type with no preexisting distance or topology. -/
structure NormedSpace.Core (š : Type*) (E : Type*)
[NormedField š] [AddCommGroup E] [Module š E] [Norm E] : Prop
extends SeminormedSpace.Core š E where
norm_eq_zero_iff (x : E) : āxā = 0 ā x = 0
variable {š : Type*} {E : Type*} [NormedField š] [AddCommGroup E] [Module š E] [Norm E]
/-- Produces a `NormedAddCommGroup E` instance from a `NormedSpace.Core`. Note that if this is
used to define an instance on a type, it also provides a new distance measure from the norm.
it must therefore not be used on a type with a preexisting distance measure.
See note [reducible non-instances]. -/
abbrev NormedAddCommGroup.ofCore (core : NormedSpace.Core š E) : NormedAddCommGroup E :=
{ SeminormedAddCommGroup.ofCore core.toCore with
eq_of_dist_eq_zero := by
intro x y h
rw [ā sub_eq_zero, ā core.norm_eq_zero_iff]
exact h }
/-- Produces a `NormedAddCommGroup E` instance from a `NormedSpace.Core` on a type
that already has an existing uniform space structure. This requires a proof that the uniformity
induced by the norm is equal to the preexisting uniformity. See note [reducible non-instances]. -/
abbrev NormedAddCommGroup.ofCoreReplaceUniformity [U : UniformSpace E] (core : NormedSpace.Core š E)
(H : š¤[U] = š¤[PseudoEMetricSpace.toUniformSpace
(self := PseudoEMetricSpace.ofSeminormedSpaceCore core.toCore)]) :
NormedAddCommGroup E :=
{ SeminormedAddCommGroup.ofCoreReplaceUniformity core.toCore H with
eq_of_dist_eq_zero := by
intro x y h
rw [ā sub_eq_zero, ā core.norm_eq_zero_iff]
exact h }
/-- Produces a `NormedAddCommGroup E` instance from a `NormedSpace.Core` on a type
that already has an existing topology. This requires a proof that the uniformity
induced by the norm is equal to the preexisting uniformity. See note [reducible non-instances]. -/
abbrev NormedAddCommGroup.ofCoreReplaceTopology [T : TopologicalSpace E]
(core : NormedSpace.Core š E)
(H : T = (PseudoEMetricSpace.ofSeminormedSpaceCore
core.toCore).toUniformSpace.toTopologicalSpace) :
NormedAddCommGroup E :=
{ SeminormedAddCommGroup.ofCoreReplaceTopology core.toCore H with
eq_of_dist_eq_zero := by
intro x y h
rw [ā sub_eq_zero, ā core.norm_eq_zero_iff]
exact h }
open Bornology in
/-- Produces a `NormedAddCommGroup E` instance from a `NormedSpace.Core` on a type
that already has a preexisting uniform space structure and a preexisting bornology. This requires
proofs that the uniformity induced by the norm is equal to the preexisting uniformity, and likewise
for the bornology. See note [reducible non-instances]. -/
abbrev NormedAddCommGroup.ofCoreReplaceAll [U : UniformSpace E] [B : Bornology E]
(core : NormedSpace.Core š E)
(HU : š¤[U] = š¤[PseudoEMetricSpace.toUniformSpace
(self := PseudoEMetricSpace.ofSeminormedSpaceCore core.toCore)])
(HB : ā s : Set E, @IsBounded _ B s
ā @IsBounded _ (PseudoMetricSpace.ofSeminormedSpaceCore core.toCore).toBornology s) :
NormedAddCommGroup E :=
{ SeminormedAddCommGroup.ofCoreReplaceAll core.toCore HU HB with
eq_of_dist_eq_zero := by
intro x y h
rw [ā sub_eq_zero, ā core.norm_eq_zero_iff]
exact h }
/-- Produces a `NormedSpace š E` instance from a `NormedSpace.Core`. This is meant to be used
on types where the `NormedAddCommGroup E` instance has also been defined using `core`.
See note [reducible non-instances]. -/
abbrev NormedSpace.ofCore {š : Type*} {E : Type*} [NormedField š] [SeminormedAddCommGroup E]
[Module š E] (core : NormedSpace.Core š E) : NormedSpace š E where
norm_smul_le r x := by rw [core.norm_smul r x]
end Core
variable {G H : Type*} [SeminormedAddCommGroup G] [SeminormedAddCommGroup H] [NormedSpace ā H]
{s : Set G}
/-- A group homomorphism from a normed group to a real normed space,
bounded on a neighborhood of `0`, must be continuous. -/
lemma AddMonoidHom.continuous_of_isBounded_nhds_zero (f : G ā+ H) (hs : s ā š (0 : G))
(hbounded : IsBounded (f '' s)) : Continuous f := by
obtain āØĪ“, hĪ“, hUε⩠:= Metric.mem_nhds_iff.mp hs
obtain āØC, hCā© := (isBounded_iff_subset_ball 0).1 (hbounded.subset <| image_mono hUε)
refine continuous_of_continuousAt_zero _ (continuousAt_iff.2 fun ε (hε : _ < _) => ?_)
simp only [dist_zero_right, map_zero]
simp only [subset_def, mem_image, mem_ball, dist_zero_right, forall_exists_index, and_imp,
forall_apply_eq_imp_iffā] at hC
have hCā : 0 < C := (norm_nonneg _).trans_lt <| hC 0 (by simpa)
obtain āØn, hnā© := exists_nat_gt (C / ε)
have hnpos : 0 < (n : ā) := (div_pos hCā hε).trans hn
have hnā : n ā 0 := by rintro rfl; simp at hnpos
refine āØĪ“ / n, div_pos hĪ“ hnpos, fun {x} hxĪ“ => ?_ā©
calc
āf xā
_ = ā(n : ā)ā»Ā¹ ⢠f (n ⢠x)ā := by simp [ā Nat.cast_smul_eq_nsmul ā, hnā]
_ ⤠ā(n : ā)ā»Ā¹ā * āf (n ⢠x)ā := norm_smul_le ..
_ < ā(n : ā)ā»Ā¹ā * C := by
gcongr
Ā· simpa [pos_iff_ne_zero]
Ā· refine hC _ <| norm_nsmul_le.trans_lt ?_
simpa only [norm_mul, Real.norm_natCast, lt_div_iffā hnpos, mul_comm] using hxĪ“
_ = (n : ā)ā»Ā¹ * C := by simp
_ < (C / ε : ā)ā»Ā¹ * C := by gcongr
_ = ε := by simp [hCā.ne'] |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Module/FiniteDimension.lean | import Mathlib.Analysis.Asymptotics.AsymptoticEquivalent
import Mathlib.Analysis.Normed.Group.Lemmas
import Mathlib.Analysis.Normed.Affine.Isometry
import Mathlib.Analysis.Normed.Operator.NormedSpace
import Mathlib.Analysis.NormedSpace.RieszLemma
import Mathlib.Analysis.Normed.Module.Ball.Pointwise
import Mathlib.Analysis.SpecificLimits.Normed
import Mathlib.Logic.Encodable.Pi
import Mathlib.Topology.Algebra.AffineSubspace
import Mathlib.Topology.Algebra.Module.FiniteDimension
import Mathlib.Topology.Algebra.InfiniteSum.Module
import Mathlib.Topology.Instances.Matrix
import Mathlib.LinearAlgebra.Dimension.LinearMap
/-!
# Finite-dimensional normed spaces over complete fields
Over a complete nontrivially normed field, in finite dimension, all norms are equivalent and all
linear maps are continuous. Moreover, a finite-dimensional subspace is always complete and closed.
## Main results:
* `FiniteDimensional.complete` : a finite-dimensional space over a complete field is complete. This
is not registered as an instance, as the field would be an unknown metavariable in typeclass
resolution.
* `Submodule.closed_of_finiteDimensional` : a finite-dimensional subspace over a complete field is
closed
* `FiniteDimensional.proper` : a finite-dimensional space over a proper field is proper. This
is not registered as an instance, as the field would be an unknown metavariable in typeclass
resolution. It is however registered as an instance for `š = ā` and `š = ā`. As properness
implies completeness, there is no need to also register `FiniteDimensional.complete` on `ā` or
`ā`.
* `FiniteDimensional.of_isCompact_closedBall`: Riesz' theorem: if the closed unit ball is
compact, then the space is finite-dimensional.
## Implementation notes
The fact that all norms are equivalent is not written explicitly, as it would mean having two norms
on a single space, which is not the way type classes work. However, if one has a
finite-dimensional vector space `E` with a norm, and a copy `E'` of this type with another norm,
then the identities from `E` to `E'` and from `E'`to `E` are continuous thanks to
`LinearMap.continuous_of_finiteDimensional`. This gives the desired norm equivalence.
-/
universe u v w x
noncomputable section
open Asymptotics Filter Module Metric Module NNReal Set TopologicalSpace Topology
namespace LinearIsometry
open LinearMap
variable {F Eā : Type*} [SeminormedAddCommGroup F] [NormedAddCommGroup Eā]
variable {Rā : Type*} [Field Rā] [Module Rā Eā] [Module Rā F] [FiniteDimensional Rā Eā]
[FiniteDimensional Rā F]
/-- A linear isometry between finite-dimensional spaces of equal dimension can be upgraded
to a linear isometry equivalence. -/
def toLinearIsometryEquiv (li : Eā āāįµ¢[Rā] F) (h : finrank Rā Eā = finrank Rā F) :
Eā āāįµ¢[Rā] F where
toLinearEquiv := li.toLinearMap.linearEquivOfInjective li.injective h
norm_map' := li.norm_map'
@[simp]
theorem coe_toLinearIsometryEquiv (li : Eā āāįµ¢[Rā] F) (h : finrank Rā Eā = finrank Rā F) :
(li.toLinearIsometryEquiv h : Eā ā F) = li :=
rfl
@[simp]
theorem toLinearIsometryEquiv_apply (li : Eā āāįµ¢[Rā] F) (h : finrank Rā Eā = finrank Rā F)
(x : Eā) : (li.toLinearIsometryEquiv h) x = li x :=
rfl
end LinearIsometry
namespace AffineIsometry
open AffineMap
variable {š : Type*} {Vā Vā : Type*} {Pā Pā : Type*} [NormedField š] [NormedAddCommGroup Vā]
[SeminormedAddCommGroup Vā] [NormedSpace š Vā] [NormedSpace š Vā] [MetricSpace Pā]
[PseudoMetricSpace Pā] [NormedAddTorsor Vā Pā] [NormedAddTorsor Vā Pā]
variable [FiniteDimensional š Vā] [FiniteDimensional š Vā]
/-- An affine isometry between finite-dimensional spaces of equal dimension can be upgraded
to an affine isometry equivalence. -/
def toAffineIsometryEquiv [Inhabited Pā] (li : Pā āįµā±[š] Pā) (h : finrank š Vā = finrank š Vā) :
Pā āįµā±[š] Pā :=
AffineIsometryEquiv.mk' li (li.linearIsometry.toLinearIsometryEquiv h)
(Inhabited.default (α := Pā)) fun p => by simp
@[simp]
theorem coe_toAffineIsometryEquiv [Inhabited Pā] (li : Pā āįµā±[š] Pā)
(h : finrank š Vā = finrank š Vā) : (li.toAffineIsometryEquiv h : Pā ā Pā) = li :=
rfl
@[simp]
theorem toAffineIsometryEquiv_apply [Inhabited Pā] (li : Pā āįµā±[š] Pā)
(h : finrank š Vā = finrank š Vā) (x : Pā) : (li.toAffineIsometryEquiv h) x = li x :=
rfl
end AffineIsometry
section CompleteField
variable {š : Type u} [NontriviallyNormedField š] {E : Type v} [NormedAddCommGroup E]
[NormedSpace š E] {F : Type w} [NormedAddCommGroup F] [NormedSpace š F] [CompleteSpace š]
section Affine
variable {PE PF : Type*} [MetricSpace PE] [NormedAddTorsor E PE] [MetricSpace PF]
[NormedAddTorsor F PF] [FiniteDimensional š E]
theorem AffineMap.continuous_of_finiteDimensional (f : PE āįµ[š] PF) : Continuous f :=
AffineMap.continuous_linear_iff.1 f.linear.continuous_of_finiteDimensional
theorem AffineEquiv.continuous_of_finiteDimensional (f : PE āįµ[š] PF) : Continuous f :=
f.toAffineMap.continuous_of_finiteDimensional
/-- Reinterpret an affine equivalence as a homeomorphism. -/
def AffineEquiv.toHomeomorphOfFiniteDimensional (f : PE āįµ[š] PF) : PE āā PF where
toEquiv := f.toEquiv
continuous_toFun := f.continuous_of_finiteDimensional
continuous_invFun :=
haveI : FiniteDimensional š F := f.linear.finiteDimensional
f.symm.continuous_of_finiteDimensional
@[simp]
theorem AffineEquiv.coe_toHomeomorphOfFiniteDimensional (f : PE āįµ[š] PF) :
āf.toHomeomorphOfFiniteDimensional = f :=
rfl
@[simp]
theorem AffineEquiv.coe_toHomeomorphOfFiniteDimensional_symm (f : PE āįµ[š] PF) :
āf.toHomeomorphOfFiniteDimensional.symm = f.symm :=
rfl
end Affine
theorem ContinuousLinearMap.continuous_det : Continuous fun f : E āL[š] E => f.det := by
change Continuous fun f : E āL[š] E => LinearMap.det (f : E āā[š] E)
-- TODO: this could be easier with `det_cases`
by_cases h : ā s : Finset E, Nonempty (Basis (ā„s) š E)
Ā· rcases h with āØs, āØbā©ā©
haveI : FiniteDimensional š E := b.finiteDimensional_of_finite
classical
simp_rw [LinearMap.det_eq_det_toMatrix_of_finset b]
refine Continuous.matrix_det ?_
exact
((LinearMap.toMatrix b b).toLinearMap.comp
(ContinuousLinearMap.coeLM š)).continuous_of_finiteDimensional
Ā· rw [LinearMap.det]
simpa only [h, MonoidHom.one_apply, dif_neg, not_false_iff] using continuous_const
/-- Any `K`-Lipschitz map from a subset `s` of a metric space `α` to a finite-dimensional real
vector space `E'` can be extended to a Lipschitz map on the whole space `α`, with a slightly worse
constant `C * K` where `C` only depends on `E'`. We record a working value for this constant `C`
as `lipschitzExtensionConstant E'`. -/
irreducible_def lipschitzExtensionConstant (E' : Type*) [NormedAddCommGroup E'] [NormedSpace ā E']
[FiniteDimensional ā E'] : āā„0 :=
let A := (Basis.ofVectorSpace ā E').equivFun.toContinuousLinearEquiv
max (āA.symm.toContinuousLinearMapāā * āA.toContinuousLinearMapāā) 1
theorem lipschitzExtensionConstant_pos (E' : Type*) [NormedAddCommGroup E'] [NormedSpace ā E']
[FiniteDimensional ā E'] : 0 < lipschitzExtensionConstant E' := by
rw [lipschitzExtensionConstant]
exact zero_lt_one.trans_le (le_max_right _ _)
/-- Any `K`-Lipschitz map from a subset `s` of a metric space `α` to a finite-dimensional real
vector space `E'` can be extended to a Lipschitz map on the whole space `α`, with a slightly worse
constant `lipschitzExtensionConstant E' * K`. -/
theorem LipschitzOnWith.extend_finite_dimension {α : Type*} [PseudoMetricSpace α] {E' : Type*}
[NormedAddCommGroup E'] [NormedSpace ā E'] [FiniteDimensional ā E'] {s : Set α} {f : α ā E'}
{K : āā„0} (hf : LipschitzOnWith K f s) :
ā g : α ā E', LipschitzWith (lipschitzExtensionConstant E' * K) g ā§ EqOn f g s := by
/- This result is already known for spaces `ι ā ā`. We use a continuous linear equiv between
`E'` and such a space to transfer the result to `E'`. -/
let ι : Type _ := Basis.ofVectorSpaceIndex ā E'
let A := (Basis.ofVectorSpace ā E').equivFun.toContinuousLinearEquiv
have LA : LipschitzWith āA.toContinuousLinearMapāā A := by apply A.lipschitz
have L : LipschitzOnWith (āA.toContinuousLinearMapāā * K) (A ā f) s :=
LA.comp_lipschitzOnWith hf
obtain āØg, hg, gsā© :
ā g : α ā ι ā ā, LipschitzWith (āA.toContinuousLinearMapāā * K) g ā§ EqOn (A ā f) g s :=
L.extend_pi
refine āØA.symm ā g, ?_, ?_ā©
Ā· have LAsymm : LipschitzWith āA.symm.toContinuousLinearMapāā A.symm := by
apply A.symm.lipschitz
apply (LAsymm.comp hg).weaken
rw [lipschitzExtensionConstant, ā mul_assoc]
exact mul_le_mul' (le_max_left _ _) le_rfl
Ā· intro x hx
have : A (f x) = g x := gs hx
simp only [(Ā· ā Ā·), ā this, A.symm_apply_apply]
theorem LinearMap.exists_antilipschitzWith [FiniteDimensional š E] (f : E āā[š] F)
(hf : LinearMap.ker f = ā„) : ā K > 0, AntilipschitzWith K f := by
cases subsingleton_or_nontrivial E
Ā· exact āØ1, zero_lt_one, AntilipschitzWith.of_subsingletonā©
Ā· rw [LinearMap.ker_eq_bot] at hf
let e : E āL[š] LinearMap.range f := (LinearEquiv.ofInjective f hf).toContinuousLinearEquiv
exact āØ_, e.nnnorm_symm_pos, e.antilipschitzā©
open Function in
/-- A `LinearMap` on a finite-dimensional space over a complete field
is injective iff it is anti-Lipschitz. -/
theorem LinearMap.injective_iff_antilipschitz [FiniteDimensional š E] (f : E āā[š] F) :
Injective f ā ā K > 0, AntilipschitzWith K f := by
constructor
Ā· rw [ā LinearMap.ker_eq_bot]
exact f.exists_antilipschitzWith
Ā· rintro āØK, -, Hā©
exact H.injective
open Function in
/-- The set of injective continuous linear maps `E ā F` is open,
if `E` is finite-dimensional over a complete field. -/
theorem ContinuousLinearMap.isOpen_injective [FiniteDimensional š E] :
IsOpen { L : E āL[š] F | Injective L } := by
rw [isOpen_iff_eventually]
rintro Ļā hĻā
rcases Ļā.injective_iff_antilipschitz.mp hĻā with āØK, K_pos, Hā©
have : āį¶ Ļ in š Ļā, āĻ - Ļāāā < Kā»Ā¹ := eventually_nnnorm_sub_lt _ <| inv_pos_of_pos K_pos
filter_upwards [this] with Ļ hĻ
apply Ļ.injective_iff_antilipschitz.mpr
exact āØ(Kā»Ā¹ - āĻ - Ļāāā)ā»Ā¹, inv_pos_of_pos (tsub_pos_of_lt hĻ),
H.add_sub_lipschitzWith (Ļ - Ļā).lipschitz hĻā©
protected theorem LinearIndependent.eventually {ι} [Finite ι] {f : ι ā E}
(hf : LinearIndependent š f) : āį¶ g in š f, LinearIndependent š g := by
cases nonempty_fintype ι
classical
simp only [Fintype.linearIndependent_iff'] at hf ā¢
rcases LinearMap.exists_antilipschitzWith _ hf with āØK, K0, hKā©
have : Tendsto (fun g : ι ā E => ā i, āg i - f iā) (š f) (š <| ā i, āf i - f iā) :=
tendsto_finset_sum _ fun i _ =>
Tendsto.norm <| ((continuous_apply i).tendsto _).sub tendsto_const_nhds
simp only [sub_self, norm_zero, Finset.sum_const_zero] at this
refine (this.eventually (gt_mem_nhds <| inv_pos.2 K0)).mono fun g hg => ?_
replace hg : ā i, āg i - f iāā < Kā»Ā¹ := by
rw [ā NNReal.coe_lt_coe]
push_cast
exact hg
rw [LinearMap.ker_eq_bot]
refine (hK.add_sub_lipschitzWith (LipschitzWith.of_dist_le_mul fun v u => ?_) hg).injective
simp only [dist_eq_norm, LinearMap.lsum_apply, Pi.sub_apply, LinearMap.sum_apply,
LinearMap.comp_apply, LinearMap.proj_apply, LinearMap.smulRight_apply, LinearMap.id_apply, ā
Finset.sum_sub_distrib, ā smul_sub, ā sub_smul, NNReal.coe_sum, coe_nnnorm, Finset.sum_mul]
refine norm_sum_le_of_le _ fun i _ => ?_
rw [norm_smul, mul_comm]
gcongr
exact norm_le_pi_norm (v - u) i
theorem isOpen_setOf_linearIndependent {ι : Type*} [Finite ι] :
IsOpen { f : ι ā E | LinearIndependent š f } :=
isOpen_iff_mem_nhds.2 fun _ => LinearIndependent.eventually
theorem isOpen_setOf_nat_le_rank (n : ā) :
IsOpen { f : E āL[š] F | ān ⤠(f : E āā[š] F).rank } := by
simp only [LinearMap.le_rank_iff_exists_linearIndependent_finset, setOf_exists, ā exists_prop]
refine isOpen_biUnion fun t _ => ?_
have : Continuous fun f : E āL[š] F => fun x : (t : Set E) => f x :=
continuous_pi fun x => (ContinuousLinearMap.apply š F (x : E)).continuous
exact isOpen_setOf_linearIndependent.preimage this
theorem isOpen_setOf_affineIndependent {ι : Type*} [Finite ι] :
IsOpen {p : ι ā E | AffineIndependent š p} := by
classical
rcases isEmpty_or_nonempty ι with h | āØāØiāā©ā©
Ā· exact isOpen_discrete _
Ā· simp_rw [affineIndependent_iff_linearIndependent_vsub š _ iā]
let ι' := { x // x ā iā }
cases nonempty_fintype ι
haveI : Fintype ι' := Subtype.fintype _
convert_to
IsOpen ((fun (p : ι ā E) (i : ι') ⦠p i -ᵄ p iā) ā»Ā¹' {p : ι' ā E | LinearIndependent š p})
exact isOpen_setOf_linearIndependent.preimage (by fun_prop)
namespace Module.Basis
theorem opNNNorm_le {ι : Type*} [Fintype ι] (v : Basis ι š E) {u : E āL[š] F} (M : āā„0)
(hu : ā i, āu (v i)āā ⤠M) : āuāā ⤠Fintype.card ι ⢠āv.equivFunL.toContinuousLinearMapāā * M :=
u.opNNNorm_le_bound _ fun e => by
set Ļ := v.equivFunL.toContinuousLinearMap
calc
āu eāā = āu (ā i, v.equivFun e i ⢠v i)āā := by rw [v.sum_equivFun]
_ = āā i, v.equivFun e i ⢠(u <| v i)āā := by simp only [equivFun_apply, map_sum, map_smul]
_ ⤠ā i, āv.equivFun e i ⢠(u <| v i)āā := nnnorm_sum_le _ _
_ = ā i, āv.equivFun e iāā * āu (v i)āā := by simp only [nnnorm_smul]
_ ⤠ā i, āv.equivFun e iāā * M := by gcongr; apply hu
_ = (ā i, āv.equivFun e iāā) * M := by rw [Finset.sum_mul]
_ ⤠Fintype.card ι ⢠(āĻāā * āeāā) * M := by
gcongr
calc
ā i, āv.equivFun e iāā ⤠Fintype.card ι ⢠āĻ eāā := Pi.sum_nnnorm_apply_le_nnnorm _
_ ⤠Fintype.card ι ⢠(āĻāā * āeāā) := nsmul_le_nsmul_right (Ļ.le_opNNNorm e) _
_ = Fintype.card ι ⢠āĻāā * M * āeāā := by simp only [smul_mul_assoc, mul_right_comm]
theorem opNorm_le {ι : Type*} [Fintype ι] (v : Basis ι š E) {u : E āL[š] F} {M : ā}
(hM : 0 ⤠M) (hu : ā i, āu (v i)ā ⤠M) :
āuā ⤠Fintype.card ι ⢠āv.equivFunL.toContinuousLinearMapā * M := by
simpa using NNReal.coe_le_coe.mpr (v.opNNNorm_le āØM, hMā© hu)
/-- A weaker version of `Basis.opNNNorm_le` that abstracts away the value of `C`. -/
theorem exists_opNNNorm_le {ι : Type*} [Finite ι] (v : Basis ι š E) :
ā C > (0 : āā„0), ā {u : E āL[š] F} (M : āā„0), (ā i, āu (v i)āā ⤠M) ā āuāā ⤠C * M := by
cases nonempty_fintype ι
exact
āØmax (Fintype.card ι ⢠āv.equivFunL.toContinuousLinearMapāā) 1,
zero_lt_one.trans_le (le_max_right _ _), fun {u} M hu =>
(v.opNNNorm_le M hu).trans <| mul_le_mul_of_nonneg_right (le_max_left _ _) (zero_le M)ā©
/-- A weaker version of `Basis.opNorm_le` that abstracts away the value of `C`. -/
theorem exists_opNorm_le {ι : Type*} [Finite ι] (v : Basis ι š E) :
ā C > (0 : ā), ā {u : E āL[š] F} {M : ā}, 0 ⤠M ā (ā i, āu (v i)ā ⤠M) ā āuā ⤠C * M := by
obtain āØC, hC, hā© := v.exists_opNNNorm_le (F := F)
refine āØC, hC, ?_ā©
intro u M hM H
simpa using h āØM, hMā© H
end Module.Basis
instance [FiniteDimensional š E] [SecondCountableTopology F] :
SecondCountableTopology (E āL[š] F) := by
set d := Module.finrank š E
suffices
ā ε > (0 : ā), ā n : (E āL[š] F) ā Fin d ā ā, ā f g : E āL[š] F, n f = n g ā dist f g ⤠ε from
Metric.secondCountable_of_countable_discretization fun ε ε_pos =>
āØFin d ā ā, by infer_instance, this ε ε_posā©
intro ε ε_pos
obtain āØu : ā ā F, hu : DenseRange uā© := exists_dense_seq F
let v := Module.finBasis š E
obtain
āØC : ā, C_pos : 0 < C, hC :
ā {Ļ : E āL[š] F} {M : ā}, 0 ⤠M ā (ā i, āĻ (v i)ā ⤠M) ā āĻā ⤠C * Mā© :=
v.exists_opNorm_le (E := E) (F := F)
have h_2C : 0 < 2 * C := mul_pos zero_lt_two C_pos
have hε2C : 0 < ε / (2 * C) := div_pos ε_pos h_2C
have : ā Ļ : E āL[š] F, ā n : Fin d ā ā, āĻ - (v.constrL <| u ā n)ā ⤠ε / 2 := by
intro Ļ
have : ā i, ā n, āĻ (v i) - u nā ⤠ε / (2 * C) := by
simp only [norm_sub_rev]
intro i
have : Ļ (v i) ā closure (range u) := hu _
obtain āØn, hnā© : ā n, āu n - Ļ (v i)ā < ε / (2 * C) := by
rw [mem_closure_iff_nhds_basis Metric.nhds_basis_ball] at this
specialize this (ε / (2 * C)) hε2C
simpa [dist_eq_norm]
exact āØn, le_of_lt hnā©
choose n hn using this
use n
replace hn : ā i : Fin d, ā(Ļ - (v.constrL <| u ā n)) (v i)ā ⤠ε / (2 * C) := by simp [hn]
have : C * (ε / (2 * C)) = ε / 2 := by
rw [eq_div_iff (two_ne_zero : (2 : ā) ā 0), mul_comm, ā mul_assoc,
mul_div_cancelā _ (ne_of_gt h_2C)]
specialize hC (le_of_lt hε2C) hn
rwa [this] at hC
choose n hn using this
set Φ := fun Ļ : E āL[š] F => v.constrL <| u ā n Ļ
change ā z, dist z (Φ z) ⤠ε / 2 at hn
use n
intro x y hxy
calc
dist x y ⤠dist x (Φ x) + dist (Φ x) y := dist_triangle _ _ _
_ = dist x (Φ x) + dist y (Φ y) := by simp [Φ, hxy, dist_comm]
_ ⤠ε := by linarith [hn x, hn y]
theorem AffineSubspace.closed_of_finiteDimensional {P : Type*} [MetricSpace P]
[NormedAddTorsor E P] (s : AffineSubspace š P) [FiniteDimensional š s.direction] :
IsClosed (s : Set P) :=
s.isClosed_direction_iff.mp s.direction.closed_of_finiteDimensional
section Riesz
/-- In an infinite-dimensional space, given a finite number of points, one may find a point
with norm at most `R` which is at distance at least `1` of all these points. -/
theorem exists_norm_le_le_norm_sub_of_finset {c : š} (hc : 1 < ācā) {R : ā} (hR : ācā < R)
(h : ¬FiniteDimensional š E) (s : Finset E) : ā x : E, āxā ⤠R ā§ ā y ā s, 1 ⤠āy - xā := by
let F := Submodule.span š (s : Set E)
haveI : FiniteDimensional š F :=
Module.finite_def.2
((Submodule.fg_top _).2 (Submodule.fg_def.2 āØs, Finset.finite_toSet _, rflā©))
have Fclosed : IsClosed (F : Set E) := Submodule.closed_of_finiteDimensional _
have : ā x, x ā F := by
contrapose! h
have : (⤠: Submodule š E) = F := by
ext x
simp [h]
have : FiniteDimensional š (⤠: Submodule š E) := by rwa [this]
exact Module.finite_def.2 ((Submodule.fg_top _).1 (Module.finite_def.1 this))
obtain āØx, xR, hxā© : ā x : E, āxā ⤠R ā§ ā y : E, y ā F ā 1 ⤠āx - yā :=
riesz_lemma_of_norm_lt hc hR Fclosed this
have hx' : ā y : E, y ā F ā 1 ⤠āy - xā := by
intro y hy
rw [ā norm_neg]
simpa using hx y hy
exact āØx, xR, fun y hy => hx' _ (Submodule.subset_span hy)ā©
/-- In an infinite-dimensional normed space, there exists a sequence of points which are all
bounded by `R` and at distance at least `1`. For a version not assuming `c` and `R`, see
`exists_seq_norm_le_one_le_norm_sub`. -/
theorem exists_seq_norm_le_one_le_norm_sub' {c : š} (hc : 1 < ācā) {R : ā} (hR : ācā < R)
(h : ¬FiniteDimensional š E) :
ā f : ā ā E, (ā n, āf nā ⤠R) ā§ Pairwise fun m n => 1 ⤠āf m - f nā := by
have : IsSymm E fun x y : E => 1 ⤠āx - yā := by
constructor
intro x y hxy
rw [ā norm_neg]
simpa
apply
exists_seq_of_forall_finset_exists' (fun x : E => āxā ⤠R) fun (x : E) (y : E) => 1 ⤠āx - yā
rintro s -
exact exists_norm_le_le_norm_sub_of_finset hc hR h s
theorem exists_seq_norm_le_one_le_norm_sub (h : ¬FiniteDimensional š E) :
ā (R : ā) (f : ā ā E), 1 < R ā§ (ā n, āf nā ⤠R) ā§ Pairwise fun m n => 1 ⤠āf m - f nā := by
obtain āØc, hcā© : ā c : š, 1 < ācā := NormedField.exists_one_lt_norm š
have A : ācā < ācā + 1 := by linarith
rcases exists_seq_norm_le_one_le_norm_sub' hc A h with āØf, hfā©
exact āØācā + 1, f, hc.trans A, hf.1, hf.2ā©
variable (š)
/-- **Riesz's theorem**: if a closed ball with center zero of positive radius is compact in a vector
space, then the space is finite-dimensional. -/
theorem FiniteDimensional.of_isCompact_closedBallā {r : ā} (rpos : 0 < r)
(h : IsCompact (Metric.closedBall (0 : E) r)) : FiniteDimensional š E := by
by_contra hfin
obtain āØR, f, Rgt, fle, lefā© :
ā (R : ā) (f : ā ā E), 1 < R ā§ (ā n, āf nā ⤠R) ā§ Pairwise fun m n => 1 ⤠āf m - f nā :=
exists_seq_norm_le_one_le_norm_sub hfin
have rRpos : 0 < r / R := div_pos rpos (zero_lt_one.trans Rgt)
obtain āØc, hcā© : ā c : š, 0 < ācā ā§ ācā < r / R := NormedField.exists_norm_lt _ rRpos
let g := fun n : ā => c ⢠f n
have A : ā n, g n ā Metric.closedBall (0 : E) r := by
intro n
simp only [g, norm_smul, dist_zero_right, Metric.mem_closedBall]
calc
ācā * āf nā ⤠r / R * R := by
gcongr
Ā· exact hc.2.le
Ā· apply fle
_ = r := by simp [(zero_lt_one.trans Rgt).ne']
obtain āØx : E, _ : x ā Metric.closedBall (0 : E) r, Ļ : ā ā ā, Ļmono : StrictMono Ļ,
Ļlim : Tendsto (g ā Ļ) atTop (š x)ā© := h.tendsto_subseq A
have B : CauchySeq (g ā Ļ) := Ļlim.cauchySeq
obtain āØN, hNā© : ā N : ā, ā n : ā, N ⤠n ā dist ((g ā Ļ) n) ((g ā Ļ) N) < ācā :=
Metric.cauchySeq_iff'.1 B ācā hc.1
apply lt_irrefl ācā
calc
ācā ⤠dist (g (Ļ (N + 1))) (g (Ļ N)) := by
conv_lhs => rw [ā mul_one ācā]
simp only [g, dist_eq_norm, ā smul_sub, norm_smul]
gcongr
apply lef (ne_of_gt _)
exact Ļmono (Nat.lt_succ_self N)
_ < ācā := hN (N + 1) (Nat.le_succ N)
/-- **Riesz's theorem**: if a closed ball of positive radius is compact in a vector space, then the
space is finite-dimensional. -/
theorem FiniteDimensional.of_isCompact_closedBall {r : ā} (rpos : 0 < r) {c : E}
(h : IsCompact (Metric.closedBall c r)) : FiniteDimensional š E :=
.of_isCompact_closedBallā š rpos <| by simpa using h.vadd (-c)
/-- **Riesz's theorem**: a locally compact normed vector space is finite-dimensional. -/
theorem FiniteDimensional.of_locallyCompactSpace [LocallyCompactSpace E] :
FiniteDimensional š E :=
let āØ_r, rpos, hrā© := exists_isCompact_closedBall (0 : E)
.of_isCompact_closedBallā š rpos hr
/-- If a function has compact support, then either the function is trivial
or the space is finite-dimensional. -/
theorem HasCompactSupport.eq_zero_or_finiteDimensional {X : Type*} [TopologicalSpace X] [Zero X]
[T1Space X] {f : E ā X} (hf : HasCompactSupport f) (h'f : Continuous f) :
f = 0 ⨠FiniteDimensional š E :=
(HasCompactSupport.eq_zero_or_locallyCompactSpace_of_addGroup hf h'f).imp_right fun h ā¦
-- TODO: Lean doesn't find the instance without this `have`
have : LocallyCompactSpace E := h; .of_locallyCompactSpace š
/-- If a function has compact multiplicative support, then either the function is trivial
or the space is finite-dimensional. -/
@[to_additive existing]
theorem HasCompactMulSupport.eq_one_or_finiteDimensional {X : Type*} [TopologicalSpace X] [One X]
[T1Space X] {f : E ā X} (hf : HasCompactMulSupport f) (h'f : Continuous f) :
f = 1 ⨠FiniteDimensional š E :=
have : T1Space (Additive X) := ā¹_āŗ
HasCompactSupport.eq_zero_or_finiteDimensional (X := Additive X) š hf h'f
/-- A locally compact normed vector space is proper. -/
lemma ProperSpace.of_locallyCompactSpace (š : Type*) [NontriviallyNormedField š]
{E : Type*} [SeminormedAddCommGroup E] [NormedSpace š E] [LocallyCompactSpace E] :
ProperSpace E := by
rcases exists_isCompact_closedBall (0 : E) with āØr, rpos, hrā©
rcases NormedField.exists_one_lt_norm š with āØc, hcā©
have hC : ā n, IsCompact (closedBall (0 : E) (ācā^n * r)) := fun n ⦠by
have : c ^ n ā 0 := pow_ne_zero _ <| fun h ⦠by simp [h, zero_le_one.not_gt] at hc
simpa [_root_.smul_closedBall' this] using hr.smul (c ^ n)
have hTop : Tendsto (fun n ⦠ācā^n * r) atTop atTop :=
Tendsto.atTop_mul_const rpos (tendsto_pow_atTop_atTop_of_one_lt hc)
exact .of_seq_closedBall hTop (Eventually.of_forall hC)
variable (E)
lemma ProperSpace.of_locallyCompact_module [Nontrivial E] [LocallyCompactSpace E] :
ProperSpace š :=
have : LocallyCompactSpace š := by
obtain āØv, hvā© : ā v : E, v ā 0 := exists_ne 0
let L : š ā E := fun t ⦠t ⢠v
have : IsClosedEmbedding L := isClosedEmbedding_smul_left hv
apply IsClosedEmbedding.locallyCompactSpace this
.of_locallyCompactSpace š
end Riesz
open ContinuousLinearMap
/-- Continuous linear equivalence between continuous linear functions `šāæ ā E` and `Eāæ`.
The spaces `šāæ` and `Eāæ` are represented as `ι ā š` and `ι ā E`, respectively,
where `ι` is a finite type. -/
def ContinuousLinearEquiv.piRing (ι : Type*) [Fintype ι] [DecidableEq ι] :
((ι ā š) āL[š] E) āL[š] ι ā E :=
{ LinearMap.toContinuousLinearMap.symm.trans (LinearEquiv.piRing š E ι š) with
continuous_toFun := by
refine continuous_pi fun i => ?_
exact (ContinuousLinearMap.apply š E (Pi.single i 1)).continuous
continuous_invFun := by
simp_rw [LinearEquiv.invFun_eq_symm, LinearEquiv.trans_symm, LinearEquiv.symm_symm]
-- Note: added explicit type and removed `change` that tried to achieve the same
refine AddMonoidHomClass.continuous_of_bound
(LinearMap.toContinuousLinearMap.toLinearMap.comp
(LinearEquiv.piRing š E ι š).symm.toLinearMap)
(Fintype.card ι : ā) fun g => ?_
rw [ā nsmul_eq_mul]
refine opNorm_le_bound _ (nsmul_nonneg (norm_nonneg g) (Fintype.card ι)) fun t => ?_
simp_rw [LinearMap.coe_comp, LinearEquiv.coe_toLinearMap, Function.comp_apply,
LinearMap.coe_toContinuousLinearMap', LinearEquiv.piRing_symm_apply]
apply le_trans (norm_sum_le _ _)
rw [smul_mul_assoc]
refine Finset.sum_le_card_nsmul _ _ _ fun i _ => ?_
rw [norm_smul, mul_comm]
gcongr <;> apply norm_le_pi_norm }
/-- A family of continuous linear maps is continuous on `s` if all its applications are. -/
theorem continuousOn_clm_apply {X : Type*} [TopologicalSpace X] [FiniteDimensional š E]
{f : X ā E āL[š] F} {s : Set X} : ContinuousOn f s ā ā y, ContinuousOn (fun x => f x y) s := by
refine āØfun h y => (ContinuousLinearMap.apply š F y).continuous.comp_continuousOn h, fun h => ?_ā©
let d := finrank š E
have hd : d = finrank š (Fin d ā š) := (finrank_fin_fun š).symm
let eā : E āL[š] Fin d ā š := ContinuousLinearEquiv.ofFinrankEq hd
let eā : (E āL[š] F) āL[š] Fin d ā F :=
(eā.arrowCongr (1 : F āL[š] F)).trans (ContinuousLinearEquiv.piRing (Fin d))
rw [ā f.id_comp, ā eā.symm_comp_self]
exact eā.symm.continuous.comp_continuousOn (continuousOn_pi.mpr fun i => h _)
theorem continuous_clm_apply {X : Type*} [TopologicalSpace X] [FiniteDimensional š E]
{f : X ā E āL[š] F} : Continuous f ā ā y, Continuous (f Ā· y) := by
simp_rw [ā continuousOn_univ, continuousOn_clm_apply]
end CompleteField
section LocallyCompactField
variable (š : Type u) [NontriviallyNormedField š] (E : Type v) [NormedAddCommGroup E]
[NormedSpace š E] [LocallyCompactSpace š]
/-- Any finite-dimensional vector space over a locally compact field is proper.
We do not register this as an instance to avoid an instance loop when trying to prove the
properness of `š`, and the search for `š` as an unknown metavariable. Declare the instance
explicitly when needed. -/
theorem FiniteDimensional.proper [FiniteDimensional š E] : ProperSpace E := by
have : ProperSpace š := .of_locallyCompactSpace š
set e := ContinuousLinearEquiv.ofFinrankEq (@finrank_fin_fun š _ _ (finrank š E)).symm
exact e.symm.antilipschitz.properSpace e.symm.continuous e.symm.surjective
end LocallyCompactField
/- Over the real numbers, we can register the previous statement as an instance as it will not
cause problems in instance resolution since the properness of `ā` is already known. -/
instance (priority := 900) FiniteDimensional.proper_real (E : Type u) [NormedAddCommGroup E]
[NormedSpace ā E] [FiniteDimensional ā E] : ProperSpace E :=
FiniteDimensional.proper ā E
/-- A submodule of a locally compact space over a complete field is also locally compact (and even
proper). -/
instance {š E : Type*} [NontriviallyNormedField š] [CompleteSpace š]
[NormedAddCommGroup E] [NormedSpace š E] [LocallyCompactSpace E] (S : Submodule š E) :
ProperSpace S := by
nontriviality E
have : ProperSpace š := .of_locallyCompact_module š E
have : FiniteDimensional š E := .of_locallyCompactSpace š
exact FiniteDimensional.proper š S
/-- If `E` is a finite-dimensional normed real vector space, `x : E`, and `s` is a neighborhood of
`x` that is not equal to the whole space, then there exists a point `y ā frontier s` at distance
`Metric.infDist x sį¶` from `x`. See also
`IsCompact.exists_mem_frontier_infDist_compl_eq_dist`. -/
theorem exists_mem_frontier_infDist_compl_eq_dist {E : Type*} [NormedAddCommGroup E]
[NormedSpace ā E] [FiniteDimensional ā E] {x : E} {s : Set E} (hx : x ā s) (hs : s ā univ) :
ā y ā frontier s, Metric.infDist x sį¶ = dist x y := by
rcases Metric.exists_mem_closure_infDist_eq_dist (nonempty_compl.2 hs) x with āØy, hys, hydā©
rw [closure_compl] at hys
refine āØy, āØMetric.closedBall_infDist_compl_subset_closure hx <|
Metric.mem_closedBall.2 <| ge_of_eq ?_, hysā©, hydā©
rwa [dist_comm]
/-- If `K` is a compact set in a nontrivial real normed space and `x ā K`, then there exists a point
`y` of the boundary of `K` at distance `Metric.infDist x Kį¶` from `x`. See also
`exists_mem_frontier_infDist_compl_eq_dist`. -/
nonrec theorem IsCompact.exists_mem_frontier_infDist_compl_eq_dist {E : Type*}
[NormedAddCommGroup E] [NormedSpace ā E] [Nontrivial E] {x : E} {K : Set E} (hK : IsCompact K)
(hx : x ā K) :
ā y ā frontier K, Metric.infDist x Kį¶ = dist x y := by
obtain hx' | hx' : x ā interior K āŖ frontier K := by
rw [ā closure_eq_interior_union_frontier]
exact subset_closure hx
Ā· rw [mem_interior_iff_mem_nhds, Metric.nhds_basis_closedBall.mem_iff] at hx'
rcases hx' with āØr, hrā, hrKā©
have : FiniteDimensional ā E :=
.of_isCompact_closedBall ā hrā
(hK.of_isClosed_subset Metric.isClosed_closedBall hrK)
exact exists_mem_frontier_infDist_compl_eq_dist hx hK.ne_univ
Ā· refine āØx, hx', ?_ā©
rw [frontier_eq_closure_inter_closure] at hx'
rw [Metric.infDist_zero_of_mem_closure hx'.2, dist_self]
/-- In a finite-dimensional vector space over `ā`, the series `ā x, āf xā` is unconditionally
summable if and only if the series `ā x, f x` is unconditionally summable. One implication holds in
any complete normed space, while the other holds only in finite-dimensional spaces. -/
theorem summable_norm_iff {α E : Type*} [NormedAddCommGroup E] [NormedSpace ā E]
[FiniteDimensional ā E] {f : α ā E} : (Summable fun x => āf xā) ā Summable f := by
refine āØSummable.of_norm, fun hf ⦠?_ā©
-- First we use a finite basis to reduce the problem to the case `E = Fin N ā ā`
suffices ā {N : ā} {g : α ā Fin N ā ā}, Summable g ā Summable fun x => āg xā by
obtain v := Module.finBasis ā E
set e := v.equivFunL
have H : Summable fun x => āe (f x)ā := this (e.summable.2 hf)
refine .of_norm_bounded (H.mul_left āā(e.symm : (Fin (finrank ā E) ā ā) āL[ā] E)āā) fun i ⦠?_
simpa using (e.symm : (Fin (finrank ā E) ā ā) āL[ā] E).le_opNorm (e <| f i)
clear! E
-- Now we deal with `g : α ā Fin N ā ā`
intro N g hg
have : ā i, Summable fun x => āg x iā := fun i => (Pi.summable.1 hg i).abs
refine .of_norm_bounded (summable_sum fun i (_ : i ā Finset.univ) => this i) fun x => ?_
rw [norm_norm, pi_norm_le_iff_of_nonneg]
Ā· refine fun i => Finset.single_le_sum (f := fun i => āg x iā) (fun i _ => ?_) (Finset.mem_univ i)
exact norm_nonneg (g x i)
Ā· exact Finset.sum_nonneg fun _ _ => norm_nonneg _
alias āØ_, Summable.normā© := summable_norm_iff
theorem summable_of_sum_range_norm_le {E : Type*} [NormedAddCommGroup E] [NormedSpace ā E]
[FiniteDimensional ā E] {c : ā} {f : ā ā E} (h : ā n, ā i ā Finset.range n, āf iā ⤠c) :
Summable f :=
summable_norm_iff.mp <| summable_of_sum_range_le (fun _ ⦠norm_nonneg _) h
theorem summable_of_isBigO' {ι E F : Type*} [NormedAddCommGroup E] [CompleteSpace E]
[NormedAddCommGroup F] [NormedSpace ā F] [FiniteDimensional ā F] {f : ι ā E} {g : ι ā F}
(hg : Summable g) (h : f =O[cofinite] g) : Summable f :=
summable_of_isBigO hg.norm h.norm_right
lemma Asymptotics.IsBigO.comp_summable {ι E F : Type*}
[NormedAddCommGroup E] [NormedSpace ā E] [FiniteDimensional ā E]
[NormedAddCommGroup F] [CompleteSpace F]
{f : E ā F} (hf : f =O[š 0] id) {g : ι ā E} (hg : Summable g) : Summable (f ā g) :=
.of_norm <| hf.comp_summable_norm hg.norm
theorem summable_of_isBigO_nat' {E F : Type*} [NormedAddCommGroup E] [CompleteSpace E]
[NormedAddCommGroup F] [NormedSpace ā F] [FiniteDimensional ā F] {f : ā ā E} {g : ā ā F}
(hg : Summable g) (h : f =O[atTop] g) : Summable f :=
summable_of_isBigO_nat hg.norm h.norm_right
open Nat Asymptotics in
/-- This is a version of `summable_norm_mul_geometric_of_norm_lt_one` for more general codomains. We
keep the original one due to import restrictions. -/
theorem summable_norm_mul_geometric_of_norm_lt_one' {F : Type*} [NormedRing F]
[NormOneClass F] [NormMulClass F] {k : ā} {r : F} (hr : ārā < 1) {u : ā ā F}
(hu : u =O[atTop] fun n ⦠((n ^ k : ā) : F)) : Summable fun n : ā ⦠āu n * r ^ nā := by
rcases exists_between hr with āØr', hrr', hā©
apply summable_of_isBigO_nat (summable_geometric_of_lt_one ((norm_nonneg _).trans hrr'.le) h).norm
calc
fun n ⦠ā(u n) * r ^ nā
_ =O[atTop] fun n ⦠āu nā * ārā ^ n := by
apply (IsBigOWith.of_bound (c := ā(1 : ā)ā) ?_).isBigO
filter_upwards [eventually_norm_pow_le r] with n hn
simp
_ =O[atTop] fun n ⦠ā((n : F) ^ k)ā * ārā ^ n := by
simpa [Nat.cast_pow] using
(isBigO_norm_left.mpr (isBigO_norm_right.mpr hu)).mul (isBigO_refl (fun n ⦠(ārā ^ n)) atTop)
_ =O[atTop] fun n ⦠ār' ^ nā := by
convert isBigO_norm_right.mpr (isBigO_norm_left.mpr
(isLittleO_pow_const_mul_const_pow_const_pow_of_norm_lt k hrr').isBigO)
simp only [norm_pow, norm_mul]
theorem summable_of_isEquivalent {ι E : Type*} [NormedAddCommGroup E] [NormedSpace ā E]
[FiniteDimensional ā E] {f : ι ā E} {g : ι ā E} (hg : Summable g) (h : f ~[cofinite] g) :
Summable f :=
hg.trans_sub (summable_of_isBigO' hg h.isLittleO.isBigO)
theorem summable_of_isEquivalent_nat {E : Type*} [NormedAddCommGroup E] [NormedSpace ā E]
[FiniteDimensional ā E] {f : ā ā E} {g : ā ā E} (hg : Summable g) (h : f ~[atTop] g) :
Summable f :=
hg.trans_sub (summable_of_isBigO_nat' hg h.isLittleO.isBigO)
theorem IsEquivalent.summable_iff {ι E : Type*} [NormedAddCommGroup E] [NormedSpace ā E]
[FiniteDimensional ā E] {f : ι ā E} {g : ι ā E} (h : f ~[cofinite] g) :
Summable f ā Summable g :=
āØfun hf => summable_of_isEquivalent hf h.symm, fun hg => summable_of_isEquivalent hg hā©
theorem IsEquivalent.summable_iff_nat {E : Type*} [NormedAddCommGroup E] [NormedSpace ā E]
[FiniteDimensional ā E] {f : ā ā E} {g : ā ā E} (h : f ~[atTop] g) : Summable f ā Summable g :=
āØfun hf => summable_of_isEquivalent_nat hf h.symm, fun hg => summable_of_isEquivalent_nat hg hā©
namespace Module.Basis
variable {ι R M : Type*} [Finite ι]
[NontriviallyNormedField R] [CompleteSpace R]
[AddCommGroup M] [TopologicalSpace M] [IsTopologicalAddGroup M] [T2Space M]
[Module R M] [ContinuousSMul R M] (B : Module.Basis ι R M)
-- Note that Finsupp has no topology so we need the coercion, see
-- https://leanprover.zulipchat.com/#narrow/channel/217875-Is-there-code-for-X.3F/topic/TVS.20and.20NormedSpace.20on.20Finsupp.2C.20DFinsupp.2C.20DirectSum.2C.20.2E.2E/near/512890984
theorem continuous_coe_repr : Continuous (fun m : M => ā(B.repr m)) :=
have := Finite.of_basis B
LinearMap.continuous_of_finiteDimensional B.equivFun.toLinearMap
-- Note: this could be generalized if we had some typeclass to indicate "each of the projections
-- into the basis is continuous".
theorem continuous_toMatrix : Continuous fun (v : ι ā M) => B.toMatrix v :=
let _ := Fintype.ofFinite ι
have := Finite.of_basis B
LinearMap.continuous_of_finiteDimensional B.toMatrixEquiv.toLinearMap
end Module.Basis |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Module/Span.lean | import Mathlib.Analysis.Normed.Operator.LinearIsometry
import Mathlib.Analysis.Normed.Operator.ContinuousLinearMap
import Mathlib.Analysis.Normed.Module.Basic
import Mathlib.LinearAlgebra.Basis.VectorSpace
/-!
# The span of a single vector
The equivalence of `š` and `š ⢠x` for `x ā 0` are defined as continuous linear equivalence and
isometry.
## Main definitions
* `ContinuousLinearEquiv.toSpanNonzeroSingleton`: The continuous linear equivalence between `š` and
`š ⢠x` for `x ā 0`.
* `LinearIsometryEquiv.toSpanUnitSingleton`: For `āxā = 1` the continuous linear equivalence is a
linear isometry equivalence.
-/
variable {š E : Type*}
namespace LinearMap
variable (š)
section Seminormed
variable [NormedDivisionRing š] [SeminormedAddCommGroup E] [Module š E] [NormSMulClass š E]
theorem toSpanSingleton_homothety (x : E) (c : š) :
āLinearMap.toSpanSingleton š E x cā = āxā * ācā := by
rw [mul_comm]
exact norm_smul _ _
end Seminormed
end LinearMap
namespace ContinuousLinearEquiv
variable (š)
section Seminormed
variable [NormedDivisionRing š] [SeminormedAddCommGroup E] [Module š E] [NormSMulClass š E]
theorem _root_.LinearEquiv.toSpanNonzeroSingleton_homothety (x : E) (h : x ā 0) (c : š) :
āLinearEquiv.toSpanNonzeroSingleton š E x h cā = āxā * ācā :=
LinearMap.toSpanSingleton_homothety _ _ _
end Seminormed
section Normed
variable [NormedField š] [NormedAddCommGroup E] [NormedSpace š E]
/-- Given a nonzero element `x` of a normed space `Eā` over a field `š`, the natural
continuous linear equivalence from `š` to the span of `x`. -/
@[simps!]
noncomputable def toSpanNonzeroSingleton (x : E) (h : x ā 0) : š āL[š] š ā x :=
ofHomothety (LinearEquiv.toSpanNonzeroSingleton š E x h) āxā (norm_pos_iff.mpr h)
(LinearEquiv.toSpanNonzeroSingleton_homothety š x h)
/-- Given a nonzero element `x` of a normed space `Eā` over a field `š`, the natural continuous
linear map from the span of `x` to `š`. -/
noncomputable def coord (x : E) (h : x ā 0) : StrongDual š (š ā x) :=
(toSpanNonzeroSingleton š x h).symm
@[simp]
theorem coe_toSpanNonzeroSingleton_symm {x : E} (h : x ā 0) :
ā(toSpanNonzeroSingleton š x h).symm = coord š x h :=
rfl
@[simp]
theorem coord_toSpanNonzeroSingleton {x : E} (h : x ā 0) (c : š) :
coord š x h (toSpanNonzeroSingleton š x h c) = c :=
(toSpanNonzeroSingleton š x h).symm_apply_apply c
@[simp]
theorem toSpanNonzeroSingleton_coord {x : E} (h : x ā 0) (y : š ā x) :
toSpanNonzeroSingleton š x h (coord š x h y) = y :=
(toSpanNonzeroSingleton š x h).apply_symm_apply y
@[simp]
theorem coord_self (x : E) (h : x ā 0) :
(coord š x h) (āØx, Submodule.mem_span_singleton_self xā© : š ā x) = 1 :=
LinearEquiv.coord_self š E x h
end Normed
end ContinuousLinearEquiv
namespace LinearIsometryEquiv
variable [NormedDivisionRing š] [SeminormedAddCommGroup E] [Module š E] [NormSMulClass š E]
/-- Given a unit element `x` of a normed space `E` over a field `š`, the natural
linear isometry equivalence from `š` to the span of `x`. -/
noncomputable def toSpanUnitSingleton (x : E) (hx : āxā = 1) :
š āāįµ¢[š] š ā x where
toLinearEquiv := LinearEquiv.toSpanNonzeroSingleton š E x (by aesop)
norm_map' := by
intro
rw [LinearEquiv.toSpanNonzeroSingleton_homothety, hx, one_mul]
@[simp] theorem toSpanUnitSingleton_apply (x : E) (hx : āxā = 1) (r : š) :
toSpanUnitSingleton x hx r = (āØr ⢠x, by aesopā© : š ā x) := by
rfl
end LinearIsometryEquiv |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Module/Dual.lean | import Mathlib.Analysis.LocallyConvex.Polar
import Mathlib.Analysis.Normed.Module.HahnBanach
import Mathlib.Analysis.Normed.Module.RCLike.Basic
import Mathlib.Data.Set.Finite.Lemmas
import Mathlib.Analysis.LocallyConvex.AbsConvex
import Mathlib.Analysis.Normed.Module.Convex
/-!
# The strong dual of a normed space
In this file we consider the strong dual `StrongDual` of a normed space, and the continuous linear
map `NormedSpace.inclusionInDoubleDual` from a normed space into its double StrongDual.
For base field `š = ā` or `š = ā`, this map is actually an isometric embedding; we provide a
version `NormedSpace.inclusionInDoubleDualLi` of the map which is of type a bundled linear
isometric embedding, `E āāįµ¢[š] (StrongDual š (StrongDual š E))`.
Since a lot of elementary properties don't require `eq_of_dist_eq_zero` we start setting up the
theory for `SeminormedAddCommGroup` and we specialize to `NormedAddCommGroup` when needed.
## Main definitions
* `inclusionInDoubleDual` and `inclusionInDoubleDualLi` are the inclusion of a normed space
in its double `StrongDual`, considered as a bounded linear map and as a linear isometry,
respectively.
* `polar š s` is the subset of `StrongDual š E` consisting of those functionals `x'` for which
`āx' zā ⤠1` for every `z ā s`.
## References
* [Conway, John B., A course in functional analysis][conway1990]
## Tags
strong dual, polar
-/
noncomputable section
open Topology Bornology
universe u v
namespace NormedSpace
section General
variable (š : Type*) [NontriviallyNormedField š]
variable (E : Type*) [SeminormedAddCommGroup E] [NormedSpace š E]
variable (F : Type*) [NormedAddCommGroup F] [NormedSpace š F]
/-- The inclusion of a normed space in its double (topological) strong dual, considered
as a bounded linear map. -/
def inclusionInDoubleDual : E āL[š] StrongDual š (StrongDual š E) :=
ContinuousLinearMap.apply š š
@[simp]
theorem dual_def (x : E) (f : StrongDual š E) : inclusionInDoubleDual š E x f = f x :=
rfl
theorem inclusionInDoubleDual_norm_eq :
āinclusionInDoubleDual š Eā = āContinuousLinearMap.id š (StrongDual š E)ā :=
ContinuousLinearMap.opNorm_flip _
theorem inclusionInDoubleDual_norm_le : āinclusionInDoubleDual š Eā ⤠1 := by
rw [inclusionInDoubleDual_norm_eq]
exact ContinuousLinearMap.norm_id_le
theorem double_dual_bound (x : E) : ā(inclusionInDoubleDual š E) xā ⤠āxā := by
simpa using ContinuousLinearMap.le_of_opNorm_le _ (inclusionInDoubleDual_norm_le š E) x
end General
section BidualIsometry
variable (š : Type v) [RCLike š] {E : Type u} [NormedAddCommGroup E] [NormedSpace š E]
/-- If one controls the norm of every `f x`, then one controls the norm of `x`.
Compare `ContinuousLinearMap.opNorm_le_bound`. -/
theorem norm_le_dual_bound (x : E) {M : ā} (hMp : 0 ⤠M)
(hM : ā f : StrongDual š E, āf xā ⤠M * āfā) : āxā ⤠M := by
classical
by_cases h : x = 0
Ā· simp only [h, hMp, norm_zero]
Ā· obtain āØf, hfā, hfxā© : ā f : StrongDual š E, āfā = 1 ā§ f x = āxā := exists_dual_vector š x h
calc
āxā = ā(āxā : š)ā := RCLike.norm_coe_norm.symm
_ = āf xā := by rw [hfx]
_ ⤠M * āfā := hM f
_ = M := by rw [hfā, mul_one]
theorem eq_zero_of_forall_dual_eq_zero {x : E} (h : ā f : StrongDual š E, f x = (0 : š)) : x = 0 :=
norm_le_zero_iff.mp (norm_le_dual_bound š x le_rfl fun f => by simp [h f])
theorem eq_zero_iff_forall_dual_eq_zero (x : E) : x = 0 ā ā g : StrongDual š E, g x = 0 :=
āØfun hx => by simp [hx], fun h => eq_zero_of_forall_dual_eq_zero š hā©
/-- See also `geometric_hahn_banach_point_point`. -/
theorem eq_iff_forall_dual_eq {x y : E} : x = y ā ā g : StrongDual š E, g x = g y := by
rw [ā sub_eq_zero, eq_zero_iff_forall_dual_eq_zero š (x - y)]
simp [sub_eq_zero]
/-- The inclusion of a normed space in its double strong dual is an isometry onto its image. -/
def inclusionInDoubleDualLi : E āāįµ¢[š] StrongDual š (StrongDual š E) :=
{ inclusionInDoubleDual š E with
norm_map' := by
intro x
apply le_antisymm
Ā· exact double_dual_bound š E x
rw [ContinuousLinearMap.norm_def]
refine le_csInf ContinuousLinearMap.bounds_nonempty ?_
rintro c āØhc1, hc2ā©
exact norm_le_dual_bound š x hc1 hc2 }
end BidualIsometry
section PolarSets
open Metric Set StrongDual
variable (š : Type*) [NontriviallyNormedField š]
variable {E : Type*} [SeminormedAddCommGroup E] [NormedSpace š E]
theorem isClosed_polar (s : Set E) : IsClosed (StrongDual.polar š s) := by
dsimp only [StrongDual.polar]
simp only [LinearMap.polar_eq_iInter, LinearMap.flip_apply]
refine isClosed_biInter fun z _ => ?_
exact isClosed_Iic.preimage (ContinuousLinearMap.apply š š z).continuous.norm
@[simp]
theorem polar_closure (s : Set E) : StrongDual.polar š (closure s) = StrongDual.polar š s :=
((topDualPairing š E).flip.polar_antitone subset_closure).antisymm <|
(topDualPairing š E).flip.polar_gc.l_le <|
closure_minimal ((topDualPairing š E).flip.polar_gc.le_u_l s) <| by
simpa [LinearMap.flip_flip] using
(isClosed_polar _ _).preimage (inclusionInDoubleDual š E).continuous
variable {š}
/-- If `x'` is a `StrongDual š E` element such that the norms `āx' zā` are bounded for `z ā s`, then
a small scalar multiple of `x'` is in `polar š s`. -/
theorem smul_mem_polar {s : Set E} {x' : StrongDual š E} {c : š} (hc : ā z, z ā s ā āx' zā ⤠ācā) :
cā»Ā¹ ⢠x' ā StrongDual.polar š s := by
by_cases c_zero : c = 0
Ā· simp only [c_zero, inv_zero, zero_smul]
exact (topDualPairing š E).flip.zero_mem_polar _
have eq : ā z, ācā»Ā¹ ⢠x' zā = ācā»Ā¹ā * āx' zā := fun z => norm_smul cā»Ā¹ _
have le : ā z, z ā s ā ācā»Ā¹ ⢠x' zā ⤠ācā»Ā¹ā * ācā := by
intro z hzs
rw [eq z]
apply mul_le_mul (le_of_eq rfl) (hc z hzs) (norm_nonneg _) (norm_nonneg _)
have cancel : ācā»Ā¹ā * ācā = 1 := by
simp only [c_zero, norm_eq_zero, Ne, not_false_iff, inv_mul_cancelā, norm_inv]
rwa [cancel] at le
theorem polar_ball_subset_closedBall_div {c : š} (hc : 1 < ācā) {r : ā} (hr : 0 < r) :
StrongDual.polar š (ball (0 : E) r) ā closedBall (0 : StrongDual š E) (ācā / r) := by
intro x' hx'
rw [StrongDual.mem_polar_iff] at hx'
simp only [mem_closedBall_zero_iff, mem_ball_zero_iff] at *
have hcr : 0 < ācā / r := div_pos (zero_lt_one.trans hc) hr
refine ContinuousLinearMap.opNorm_le_of_shell hr hcr.le hc fun x hā hā => ?_
calc
āx' xā ⤠1 := hx' _ hā
_ ⤠ācā / r * āxā := (inv_le_iff_one_le_mulā' hcr).1 (by rwa [inv_div])
variable (š)
theorem closedBall_inv_subset_polar_closedBall {r : ā} :
closedBall (0 : StrongDual š E) rā»Ā¹ ā StrongDual.polar š (closedBall (0 : E) r) :=
fun x' hx' x hx =>
calc
āx' xā ⤠āx'ā * āxā := x'.le_opNorm x
_ ⤠rā»Ā¹ * r :=
(mul_le_mul (mem_closedBall_zero_iff.1 hx') (mem_closedBall_zero_iff.1 hx) (norm_nonneg _)
(dist_nonneg.trans hx'))
_ = r / r := inv_mul_eq_div _ _
_ ⤠1 := div_self_le_one r
/-- The `polar` of closed ball in a normed space `E` is the closed ball of the dual with inverse
radius. -/
theorem polar_closedBall {š E : Type*} [RCLike š] [NormedAddCommGroup E] [NormedSpace š E] {r : ā}
(hr : 0 < r) :
StrongDual.polar š (closedBall (0 : E) r) = closedBall (0 : StrongDual š E) rā»Ā¹ := by
refine Subset.antisymm ?_ (closedBall_inv_subset_polar_closedBall š)
intro x' h
simp only [mem_closedBall_zero_iff]
refine ContinuousLinearMap.opNorm_le_of_ball hr (inv_nonneg.mpr hr.le) fun z _ => ?_
simpa only [one_div] using LinearMap.bound_of_ball_bound' hr 1 x'.toLinearMap h z
theorem polar_ball {š E : Type*} [RCLike š] [NormedAddCommGroup E] [NormedSpace š E] {r : ā}
(hr : 0 < r) : StrongDual.polar š (ball (0 : E) r) = closedBall (0 : StrongDual š E) rā»Ā¹ := by
apply le_antisymm
Ā· intro x hx
rw [mem_closedBall_zero_iff]
apply le_of_forall_gt_imp_ge_of_dense
intro a ha
rw [ā mem_closedBall_zero_iff, ā (mul_div_cancel_leftā a (Ne.symm (ne_of_lt hr)))]
rw [ā RCLike.norm_of_nonneg (K := š) (le_trans zero_le_one
(le_of_lt ((inv_lt_iff_one_lt_mulā' hr).mp ha)))]
apply polar_ball_subset_closedBall_div _ hr hx
rw [RCLike.norm_of_nonneg (K := š) (le_trans zero_le_one
(le_of_lt ((inv_lt_iff_one_lt_mulā' hr).mp ha)))]
exact (inv_lt_iff_one_lt_mulā' hr).mp ha
Ā· rw [ā polar_closedBall hr]
exact LinearMap.polar_antitone _ ball_subset_closedBall
/-- Given a neighborhood `s` of the origin in a normed space `E`, the dual norms of all elements of
the polar `polar š s` are bounded by a constant. -/
theorem isBounded_polar_of_mem_nhds_zero {s : Set E} (s_nhds : s ā š (0 : E)) :
IsBounded (StrongDual.polar š s) := by
obtain āØa, haā© : ā a : š, 1 < āaā := NormedField.exists_one_lt_norm š
obtain āØr, r_pos, r_ballā© : ā r : ā, 0 < r ā§ ball 0 r ā s := Metric.mem_nhds_iff.1 s_nhds
exact isBounded_closedBall.subset
(((topDualPairing š E).flip.polar_antitone r_ball).trans <|
polar_ball_subset_closedBall_div ha r_pos)
theorem sInter_polar_eq_closedBall {š E : Type*} [RCLike š] [NormedAddCommGroup E] [NormedSpace š E]
{r : ā} (hr : 0 < r) :
āā (StrongDual.polar š '' { F | F.Finite ā§ F ā closedBall (0 : E) rā»Ā¹ }) = closedBall 0 r := by
conv_rhs => rw [ā inv_inv r]
rw [ā polar_closedBall (inv_pos_of_pos hr), StrongDual.polar,
(topDualPairing š E).flip.sInter_polar_finite_subset_eq_polar (closedBall (0 : E) rā»Ā¹)]
end PolarSets
end NormedSpace
namespace LinearMap
section NormedField
variable {š E F : Type*}
variable [RCLike š] [AddCommMonoid E] [AddCommMonoid F]
variable [Module š E] [Module š F]
variable {B : E āā[š] F āā[š] š} (s : Set E)
open ComplexOrder in
theorem polar_AbsConvex : AbsConvex š (B.polar s) := by
rw [polar_eq_biInter_preimage]
exact AbsConvex.iInterā fun i hi =>
āØbalanced_closedBall_zero.mulActionHom_preimage (f := (B i : (F āā[(RingHom.id š)] š))),
(convex_RCLike_iff_convex_real.mpr (convex_closedBall 0 1)).linear_preimage _ā©
end NormedField
end LinearMap |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Module/RCLike/Basic.lean | import Mathlib.Analysis.RCLike.Basic
import Mathlib.Analysis.Normed.Module.RCLike.Real
import Mathlib.Analysis.Normed.Operator.Basic
/-!
# Normed spaces over R or C
This file is about results on normed spaces over the fields `ā` and `ā`.
## Main definitions
None.
## Main theorems
* `ContinuousLinearMap.opNorm_bound_of_ball_bound`: A bound on the norms of values of a linear
map in a ball yields a bound on the operator norm.
## Notes
This file exists mainly to avoid importing `RCLike` in the main normed space theory files.
-/
open Metric
variable {š : Type*} [RCLike š] {E : Type*} [NormedAddCommGroup E]
theorem RCLike.norm_coe_norm {z : E} : ā(āzā : š)ā = āzā := by simp
variable [NormedSpace š E]
/-- Lemma to normalize a vector in a normed space `E` over either `ā` or `ā` to unit length. -/
@[simp]
theorem norm_smul_inv_norm {x : E} (hx : x ā 0) : ā(āxāā»Ā¹ : š) ⢠xā = 1 := by
have : āxā ā 0 := by simp [hx]
simp [field, norm_smul]
/-- Lemma to normalize a vector in a normed space `E` over either `ā` or `ā` to length `r`. -/
theorem norm_smul_inv_norm' {r : ā} (r_nonneg : 0 ⤠r) {x : E} (hx : x ā 0) :
ā((r : š) * (āxā : š)ā»Ā¹) ⢠xā = r := by
have : āxā ā 0 := by simp [hx]
simp [field, norm_smul, r_nonneg, rclike_simps]
theorem LinearMap.bound_of_sphere_bound {r : ā} (r_pos : 0 < r) (c : ā) (f : E āā[š] š)
(h : ā z ā sphere (0 : E) r, āf zā ⤠c) (z : E) : āf zā ⤠c / r * āzā := by
by_cases z_zero : z = 0
Ā· rw [z_zero]
simp only [LinearMap.map_zero, norm_zero, mul_zero]
exact le_rfl
set zā := ((r : š) * (āzā : š)ā»Ā¹) ⢠z with hzā
have norm_f_zā : āf zāā ⤠c := by
apply h
rw [mem_sphere_zero_iff_norm]
exact norm_smul_inv_norm' r_pos.le z_zero
have r_ne_zero : (r : š) ā 0 := RCLike.ofReal_ne_zero.mpr r_pos.ne'
have eq : f z = āzā / r * f zā := by
rw [hzā, LinearMap.map_smul, smul_eq_mul]
rw [ā mul_assoc, ā mul_assoc, div_mul_cancelā _ r_ne_zero, mul_inv_cancelā, one_mul]
simp only [z_zero, RCLike.ofReal_eq_zero, norm_eq_zero, Ne, not_false_iff]
rw [eq, norm_mul, norm_div, RCLike.norm_coe_norm, RCLike.norm_of_nonneg r_pos.le,
div_mul_eq_mul_div, div_mul_eq_mul_div, mul_comm]
apply div_le_divā _ _ r_pos rfl.ge
Ā· exact mul_nonneg ((norm_nonneg _).trans norm_f_zā) (norm_nonneg z)
apply mul_le_mul norm_f_zā rfl.le (norm_nonneg z) ((norm_nonneg _).trans norm_f_zā)
/-- `LinearMap.bound_of_ball_bound` is a version of this over arbitrary nontrivially normed fields.
It produces a less precise bound so we keep both versions. -/
theorem LinearMap.bound_of_ball_bound' {r : ā} (r_pos : 0 < r) (c : ā) (f : E āā[š] š)
(h : ā z ā closedBall (0 : E) r, āf zā ⤠c) (z : E) : āf zā ⤠c / r * āzā :=
f.bound_of_sphere_bound r_pos c (fun z hz => h z hz.le) z
theorem ContinuousLinearMap.opNorm_bound_of_ball_bound {r : ā} (r_pos : 0 < r) (c : ā)
(f : StrongDual š E) (h : ā z ā closedBall (0 : E) r, āf zā ⤠c) : āfā ⤠c / r := by
apply ContinuousLinearMap.opNorm_le_bound
Ā· apply div_nonneg _ r_pos.le
exact
(norm_nonneg _).trans
(h 0 (by simp only [norm_zero, mem_closedBall, dist_zero_left, r_pos.le]))
apply LinearMap.bound_of_ball_bound' r_pos
exact fun z hz => h z hz
variable (š)
include š in
theorem NormedSpace.sphere_nonempty_rclike [Nontrivial E] {r : ā} (hr : 0 ⤠r) :
Nonempty (sphere (0 : E) r) :=
letI : NormedSpace ā E := NormedSpace.restrictScalars ā š E
(NormedSpace.sphere_nonempty.mpr hr).coe_sort |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Module/RCLike/Extend.lean | import Mathlib.Analysis.RCLike.Extend
import Mathlib.Analysis.Normed.Operator.Basic
/-!
# Norm properties of the extension of continuous `ā`-linear functionals to `š`-linear functionals
This file shows that `ContinuousLinearMap.extendToš` preserves the norm of the functional.
-/
open RCLike
open scoped ComplexConjugate
namespace ContinuousLinearMap
variable {š F : Type*} [RCLike š] [SeminormedAddCommGroup F] [NormedSpace š F]
section ScalarTower
variable [NormedSpace ā F] [IsScalarTower ā š F]
/-- The norm of the extension is bounded by `āfrā`. -/
theorem norm_extendToš'_bound (fr : StrongDual ā F) (x : F) :
ā(fr.extendToš' x : š)ā ⤠āfrā * āxā := by
set lm : F āL[š] š := fr.extendToš'
by_cases h : lm x = 0
Ā· rw [h, norm_zero]
positivity
rw [ā mul_le_mul_iff_rightā (norm_pos_iff.2 h), ā sq]
calc
ālm xā ^ 2 = fr (conj (lm x : š) ⢠x) := fr.toLinearMap.norm_extendToš'_apply_sq x
_ ⤠āfr (conj (lm x : š) ⢠x)ā := le_abs_self _
_ ⤠āfrā * āconj (lm x : š) ⢠xā := le_opNorm _ _
_ = ā(lm x : š)ā * (āfrā * āxā) := by rw [norm_smul, norm_conj, mul_left_comm]
@[simp]
theorem norm_extendToš' (fr : StrongDual ā F) : ā(fr.extendToš' : StrongDual š F)ā = āfrā :=
le_antisymm (ContinuousLinearMap.opNorm_le_bound _ (norm_nonneg _) fr.norm_extendToš'_bound) <|
opNorm_le_bound _ (norm_nonneg _) fun x =>
calc
āfr xā = āre (fr.extendToš' x : š)ā := congr_arg norm (fr.extendToš'_apply_re x).symm
_ ⤠ā(fr.extendToš' x : š)ā := abs_re_le_norm _
_ ⤠ā(fr.extendToš' : StrongDual š F)ā * āxā := le_opNorm _ _
end ScalarTower
@[simp]
theorem norm_extendToš (fr : StrongDual ā (RestrictScalars ā š F)) :
āfr.extendTošā = āfrā :=
fr.norm_extendToš'
end ContinuousLinearMap |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Module/RCLike/Real.lean | import Mathlib.Analysis.Normed.Module.Basic
import Mathlib.LinearAlgebra.Basis.VectorSpace
/-!
# Basic facts about real (semi)normed spaces
In this file we prove some theorems about (semi)normed spaces over real numberes.
## Main results
- `closure_ball`, `frontier_ball`, `interior_closedBall`, `frontier_closedBall`, `interior_sphere`,
`frontier_sphere`: formulas for the closure/interior/frontier
of nontrivial balls and spheres in a real seminormed space;
- `interior_closedBall'`, `frontier_closedBall'`, `interior_sphere'`, `frontier_sphere'`:
similar lemmas assuming that the ambient space is separated and nontrivial instead of `r ā 0`.
-/
open Metric Set Function Filter
open scoped NNReal Topology
/-- If `E` is a nontrivial topological module over `ā`, then `E` has no isolated points.
This is a particular case of `Module.punctured_nhds_neBot`. -/
instance Real.punctured_nhds_module_neBot {E : Type*} [AddCommGroup E] [TopologicalSpace E]
[ContinuousAdd E] [Nontrivial E] [Module ā E] [ContinuousSMul ā E] (x : E) : NeBot (š[ā ] x) :=
Module.punctured_nhds_neBot ā E x
section Seminormed
variable {E : Type*} [SeminormedAddCommGroup E] [NormedSpace ā E]
theorem inv_norm_smul_mem_unitClosedBall (x : E) :
āxāā»Ā¹ ⢠x ā closedBall (0 : E) 1 := by
simp only [mem_closedBall_zero_iff, norm_smul, norm_inv, norm_norm, ā div_eq_inv_mul,
div_self_le_one]
theorem norm_smul_of_nonneg {t : ā} (ht : 0 ⤠t) (x : E) : āt ⢠xā = t * āxā := by
rw [norm_smul, Real.norm_eq_abs, abs_of_nonneg ht]
theorem dist_smul_add_one_sub_smul_le {r : ā} {x y : E} (h : r ā Icc 0 1) :
dist (r ⢠x + (1 - r) ⢠y) x ⤠dist y x :=
calc
dist (r ⢠x + (1 - r) ⢠y) x = ā1 - rā * āx - yā := by
simp_rw [dist_eq_norm', ā norm_smul, sub_smul, one_smul, smul_sub, ā sub_sub, ā sub_add,
sub_right_comm]
_ = (1 - r) * dist y x := by
rw [Real.norm_eq_abs, abs_eq_self.mpr (sub_nonneg.mpr h.2), dist_eq_norm']
_ ⤠(1 - 0) * dist y x := by gcongr; exact h.1
_ = dist y x := by rw [sub_zero, one_mul]
theorem closure_ball (x : E) {r : ā} (hr : r ā 0) : closure (ball x r) = closedBall x r := by
refine Subset.antisymm closure_ball_subset_closedBall fun y hy => ?_
have : ContinuousWithinAt (fun c : ā => c ⢠(y - x) + x) (Ico 0 1) 1 :=
((continuous_id.smul continuous_const).add continuous_const).continuousWithinAt
convert this.mem_closure _ _
Ā· rw [one_smul, sub_add_cancel]
Ā· simp [closure_Ico zero_ne_one, zero_le_one]
Ā· rintro c āØhc0, hc1ā©
rw [mem_ball, dist_eq_norm, add_sub_cancel_right, norm_smul, Real.norm_eq_abs,
abs_of_nonneg hc0, mul_comm, ā mul_one r]
rw [mem_closedBall, dist_eq_norm] at hy
replace hr : 0 < r := ((norm_nonneg _).trans hy).lt_of_ne hr.symm
apply mul_lt_mul' <;> assumption
theorem frontier_ball (x : E) {r : ā} (hr : r ā 0) :
frontier (ball x r) = sphere x r := by
rw [frontier, closure_ball x hr, isOpen_ball.interior_eq, closedBall_diff_ball]
theorem interior_closedBall (x : E) {r : ā} (hr : r ā 0) :
interior (closedBall x r) = ball x r := by
rcases hr.lt_or_gt with hr | hr
Ā· rw [closedBall_eq_empty.2 hr, ball_eq_empty.2 hr.le, interior_empty]
refine Subset.antisymm ?_ ball_subset_interior_closedBall
intro y hy
rcases (mem_closedBall.1 <| interior_subset hy).lt_or_eq with (hr | rfl)
Ā· exact hr
set f : ā ā E := fun c : ā => c ⢠(y - x) + x
suffices f ā»Ā¹' closedBall x (dist y x) ā Icc (-1) 1 by
have hfc : Continuous f := (continuous_id.smul continuous_const).add continuous_const
have hf1 : (1 : ā) ā f ā»Ā¹' interior (closedBall x <| dist y x) := by simpa [f]
have h1 : (1 : ā) ā interior (Icc (-1 : ā) 1) :=
interior_mono this (preimage_interior_subset_interior_preimage hfc hf1)
simp at h1
intro c hc
rw [mem_Icc, ā abs_le, ā Real.norm_eq_abs, ā mul_le_mul_iff_leftā hr]
simpa [f, dist_eq_norm, norm_smul] using hc
theorem frontier_closedBall (x : E) {r : ā} (hr : r ā 0) :
frontier (closedBall x r) = sphere x r := by
rw [frontier, closure_closedBall, interior_closedBall x hr, closedBall_diff_ball]
theorem interior_sphere (x : E) {r : ā} (hr : r ā 0) : interior (sphere x r) = ā
:= by
rw [ā frontier_closedBall x hr, interior_frontier isClosed_closedBall]
theorem frontier_sphere (x : E) {r : ā} (hr : r ā 0) : frontier (sphere x r) = sphere x r := by
rw [isClosed_sphere.frontier_eq, interior_sphere x hr, diff_empty]
end Seminormed
section Normed
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ā E] [Nontrivial E]
section Surj
variable (E)
theorem exists_norm_eq {c : ā} (hc : 0 ⤠c) : ā x : E, āxā = c := by
rcases exists_ne (0 : E) with āØx, hxā©
rw [ā norm_ne_zero_iff] at hx
use c ⢠āxāā»Ā¹ ⢠x
simp [norm_smul, Real.norm_of_nonneg hc, inv_mul_cancelā hx]
@[simp]
theorem range_norm : range (norm : E ā ā) = Ici 0 :=
Subset.antisymm (range_subset_iff.2 norm_nonneg) fun _ => exists_norm_eq E
theorem nnnorm_surjective : Surjective (nnnorm : E ā āā„0) := fun c =>
(exists_norm_eq E c.coe_nonneg).imp fun _ h => NNReal.eq h
@[simp]
theorem range_nnnorm : range (nnnorm : E ā āā„0) = univ :=
(nnnorm_surjective E).range_eq
variable {E} in
/-- In a nontrivial real normed space, a sphere is nonempty if and only if its radius is
nonnegative. -/
@[simp]
theorem NormedSpace.sphere_nonempty {x : E} {r : ā} : (sphere x r).Nonempty ā 0 ⤠r := by
refine āØfun h => nonempty_closedBall.1 (h.mono sphere_subset_closedBall), fun hr => ?_ā©
obtain āØy, hyā© := exists_norm_eq E hr
exact āØx + y, by simpa using hyā©
end Surj
theorem interior_closedBall' (x : E) (r : ā) : interior (closedBall x r) = ball x r := by
rcases eq_or_ne r 0 with (rfl | hr)
Ā· rw [closedBall_zero, ball_zero, interior_singleton]
Ā· exact interior_closedBall x hr
theorem frontier_closedBall' (x : E) (r : ā) : frontier (closedBall x r) = sphere x r := by
rw [frontier, closure_closedBall, interior_closedBall' x r, closedBall_diff_ball]
@[simp]
theorem interior_sphere' (x : E) (r : ā) : interior (sphere x r) = ā
:= by
rw [ā frontier_closedBall' x, interior_frontier isClosed_closedBall]
@[simp]
theorem frontier_sphere' (x : E) (r : ā) : frontier (sphere x r) = sphere x r := by
rw [isClosed_sphere.frontier_eq, interior_sphere' x, diff_empty]
end Normed |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Module/Ball/Homeomorph.lean | import Mathlib.Topology.OpenPartialHomeomorph
import Mathlib.Analysis.Normed.Group.AddTorsor
import Mathlib.Analysis.Normed.Module.Ball.Pointwise
import Mathlib.Data.Real.Sqrt
/-!
# (Local) homeomorphism between a normed space and a ball
In this file we show that a real (semi)normed vector space is homeomorphic to the unit ball.
We formalize it in two ways:
- as a `Homeomorph`, see `Homeomorph.unitBall`;
- as an `OpenPartialHomeomorph` with `source = Set.univ` and `target = Metric.ball (0 : E) 1`.
While the former approach is more natural, the latter approach provides us
with a globally defined inverse function which makes it easier to say
that this homeomorphism is in fact a diffeomorphism.
We also show that the unit ball `Metric.ball (0 : E) 1` is homeomorphic
to a ball of positive radius in an affine space over `E`, see `OpenPartialHomeomorph.unitBallBall`.
## Tags
homeomorphism, ball
-/
open Set Metric Pointwise
variable {E : Type*} [SeminormedAddCommGroup E] [NormedSpace ā E]
noncomputable section
/-- Local homeomorphism between a real (semi)normed space and the unit ball.
See also `Homeomorph.unitBall`. -/
@[simps -isSimp]
def OpenPartialHomeomorph.univUnitBall : OpenPartialHomeomorph E E where
toFun x := (ā(1 + āxā ^ 2))ā»Ā¹ ⢠x
invFun y := (ā(1 - ā(y : E)ā ^ 2))ā»Ā¹ ⢠(y : E)
source := univ
target := ball 0 1
map_source' x _ := by
have : 0 < 1 + āxā ^ 2 := by positivity
rw [mem_ball_zero_iff, norm_smul, Real.norm_eq_abs, abs_inv, ā _root_.div_eq_inv_mul,
div_lt_one (abs_pos.mpr <| Real.sqrt_ne_zero'.mpr this), ā abs_norm x, ā sq_lt_sq,
abs_norm, Real.sq_sqrt this.le]
exact lt_one_add _
map_target' _ _ := trivial
left_inv' x _ := by
match_scalars
simp [norm_smul]
field_simp
simp [sq_abs, Real.sq_sqrt (zero_lt_one_add_norm_sq x).le]
right_inv' y hy := by
have : 0 < 1 - āyā ^ 2 := by nlinarith [norm_nonneg y, mem_ball_zero_iff.1 hy]
match_scalars
simp [norm_smul]
field_simp
simp [field, sq_abs, Real.sq_sqrt this.le]
open_source := isOpen_univ
open_target := isOpen_ball
continuousOn_toFun := by
suffices Continuous fun (x : E) => (ā(1 + āxā ^ 2))ā»Ā¹ by fun_prop
exact Continuous.invā (by fun_prop) fun x => Real.sqrt_ne_zero'.mpr (by positivity)
continuousOn_invFun := by
have : ā y ā ball (0 : E) 1, ā(1 - ā(y : E)ā ^ 2) ā 0 := fun y hy ⦠by
rw [Real.sqrt_ne_zero']
nlinarith [norm_nonneg y, mem_ball_zero_iff.1 hy]
exact ContinuousOn.smul (ContinuousOn.invā
(continuousOn_const.sub (continuous_norm.continuousOn.pow _)).sqrt this) continuousOn_id
@[simp]
theorem OpenPartialHomeomorph.univUnitBall_apply_zero : univUnitBall (0 : E) = 0 := by
simp [OpenPartialHomeomorph.univUnitBall_apply]
@[simp]
theorem OpenPartialHomeomorph.univUnitBall_symm_apply_zero : univUnitBall.symm (0 : E) = 0 := by
simp [OpenPartialHomeomorph.univUnitBall_symm_apply]
/-- A (semi) normed real vector space is homeomorphic to the unit ball in the same space.
This homeomorphism sends `x : E` to `(1 + āxā²)^(- ½) ⢠x`.
In many cases the actual implementation is not important, so we don't mark the projection lemmas
`Homeomorph.unitBall_apply_coe` and `Homeomorph.unitBall_symm_apply` as `@[simp]`.
See also `Homeomorph.contDiff_unitBall` and `OpenPartialHomeomorph.contDiffOn_unitBall_symm`
for smoothness properties that hold when `E` is an inner-product space. -/
@[simps! -isSimp]
def Homeomorph.unitBall : E āā ball (0 : E) 1 :=
(Homeomorph.Set.univ _).symm.trans OpenPartialHomeomorph.univUnitBall.toHomeomorphSourceTarget
@[simp]
theorem Homeomorph.coe_unitBall_apply_zero :
(Homeomorph.unitBall (0 : E) : E) = 0 :=
OpenPartialHomeomorph.univUnitBall_apply_zero
variable {P : Type*} [PseudoMetricSpace P] [NormedAddTorsor E P]
namespace OpenPartialHomeomorph
/-- Affine homeomorphism `(r ⢠· +ᵄ c)` between a normed space and an add torsor over this space,
interpreted as an `OpenPartialHomeomorph` between `Metric.ball 0 1` and `Metric.ball c r`. -/
@[simps!]
def unitBallBall (c : P) (r : ā) (hr : 0 < r) : OpenPartialHomeomorph E P :=
((Homeomorph.smulOfNeZero r hr.ne').trans
(IsometryEquiv.vaddConst c).toHomeomorph).toOpenPartialHomeomorphOfImageEq
(ball 0 1) isOpen_ball (ball c r) <| by
change (IsometryEquiv.vaddConst c) ā (r ⢠·) '' ball (0 : E) 1 = ball c r
rw [image_comp, image_smul, smul_unitBall hr.ne', IsometryEquiv.image_ball]
simp [abs_of_pos hr]
/-- If `r > 0`, then `OpenPartialHomeomorph.univBall c r` is a smooth open partial homeomorphism
with `source = Set.univ` and `target = Metric.ball c r`.
Otherwise, it is the translation by `c`.
Thus in all cases, it sends `0` to `c`, see `OpenPartialHomeomorph.univBall_apply_zero`. -/
def univBall (c : P) (r : ā) : OpenPartialHomeomorph E P :=
if h : 0 < r then univUnitBall.trans' (unitBallBall c r h) rfl
else (IsometryEquiv.vaddConst c).toHomeomorph.toOpenPartialHomeomorph
@[simp]
theorem univBall_source (c : P) (r : ā) : (univBall c r).source = univ := by
unfold univBall; split_ifs <;> rfl
theorem univBall_target (c : P) {r : ā} (hr : 0 < r) : (univBall c r).target = ball c r := by
rw [univBall, dif_pos hr]; rfl
theorem ball_subset_univBall_target (c : P) (r : ā) : ball c r ā (univBall c r).target := by
by_cases hr : 0 < r
Ā· rw [univBall_target c hr]
Ā· rw [univBall, dif_neg hr]
exact subset_univ _
@[simp]
theorem univBall_apply_zero (c : P) (r : ā) : univBall c r 0 = c := by
unfold univBall; split_ifs <;> simp
@[simp]
theorem univBall_symm_apply_center (c : P) (r : ā) : (univBall c r).symm c = 0 := by
have : 0 ā (univBall c r).source := by simp
simpa only [univBall_apply_zero] using (univBall c r).left_inv this
@[continuity]
theorem continuous_univBall (c : P) (r : ā) : Continuous (univBall c r) := by
simpa [continuousOn_univ] using (univBall c r).continuousOn
theorem continuousOn_univBall_symm (c : P) (r : ā) : ContinuousOn (univBall c r).symm (ball c r) :=
(univBall c r).symm.continuousOn.mono <| ball_subset_univBall_target c r
end OpenPartialHomeomorph |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Module/Ball/RadialEquiv.lean | import Mathlib.Analysis.Normed.Module.Basic
import Mathlib.LinearAlgebra.Basis.VectorSpace
/-!
# Homeomorphism between a normed space and sphere times `(0, +ā)`
In this file we define a homeomorphism between nonzero elements of a normed space `E`
and `Metric.sphere (0 : E) 1 Ć Set.Ioi (0 : ā)`.
One may think about it as generalization of polar coordinates to any normed space.
-/
variable (E : Type*) [NormedAddCommGroup E] [NormedSpace ā E]
open Set Metric
/-- The natural homeomorphism between nonzero elements of a normed space `E`
and `Metric.sphere (0 : E) 1 Ć Set.Ioi (0 : ā)`.
The forward map sends `āØx, hxā©` to `āØāxāā»Ā¹ ⢠x, āxāā©`,
the inverse map sends `(x, r)` to `r ⢠x`.
One may think about it as generalization of polar coordinates to any normed space. -/
@[simps apply_fst_coe apply_snd_coe symm_apply_coe]
noncomputable def homeomorphUnitSphereProd :
({0}į¶ : Set E) āā (sphere (0 : E) 1 Ć Ioi (0 : ā)) where
toFun x := (āØāx.1āā»Ā¹ ⢠x.1, by
rw [mem_sphere_zero_iff_norm, norm_smul, norm_inv, norm_norm,
inv_mul_cancelā (norm_ne_zero_iff.2 x.2)]ā©, āØāx.1ā, norm_pos_iff.2 x.2ā©)
invFun x := āØx.2.1 ⢠x.1.1, smul_ne_zero x.2.2.out.ne' (ne_of_mem_sphere x.1.2 one_ne_zero)ā©
left_inv x := Subtype.eq <| by simp [smul_inv_smulā (norm_ne_zero_iff.2 x.2)]
right_inv
| (āØx, hxā©, āØr, hrā©) => by
rw [mem_sphere_zero_iff_norm] at hx
rw [mem_Ioi] at hr
ext <;> simp [hx, norm_smul, abs_of_pos hr, hr.ne']
continuous_toFun := by
refine .prodMk (.codRestrict (.smul (.invā ?_ ?_) ?_) _) ?_
Ā· fun_prop
Ā· simp
Ā· fun_prop
Ā· fun_prop
continuous_invFun := by apply Continuous.subtype_mk (by fun_prop) |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Module/Ball/Pointwise.lean | import Mathlib.Analysis.Normed.Group.Pointwise
import Mathlib.Analysis.Normed.Module.RCLike.Real
/-!
# Properties of pointwise scalar multiplication of sets in normed spaces.
We explore the relationships between scalar multiplication of sets in vector spaces, and the norm.
Notably, we express arbitrary balls as rescaling of other balls, and we show that the
multiplication of bounded sets remain bounded.
-/
open Metric Set
open Pointwise Topology
variable {š E : Type*}
section SMulZeroClass
variable [SeminormedAddCommGroup š] [SeminormedAddCommGroup E]
variable [SMulZeroClass š E] [IsBoundedSMul š E]
theorem ediam_smul_le (c : š) (s : Set E) : EMetric.diam (c ⢠s) ⤠ācāā ⢠EMetric.diam s :=
(lipschitzWith_smul c).ediam_image_le s
end SMulZeroClass
section DivisionRing
variable [NormedDivisionRing š] [SeminormedAddCommGroup E]
variable [Module š E] [NormSMulClass š E]
theorem ediam_smulā (c : š) (s : Set E) : EMetric.diam (c ⢠s) = ācāā ⢠EMetric.diam s := by
refine le_antisymm (ediam_smul_le c s) ?_
obtain rfl | hc := eq_or_ne c 0
Ā· obtain rfl | hs := s.eq_empty_or_nonempty
Ā· simp
simp [zero_smul_set hs, ā Set.singleton_zero]
Ā· have := (lipschitzWith_smul cā»Ā¹).ediam_image_le (c ⢠s)
rwa [ā smul_eq_mul, ā ENNReal.smul_def, Set.image_smul, inv_smul_smulā hc s, nnnorm_inv,
le_inv_smul_iff_of_pos (nnnorm_pos.2 hc)] at this
theorem diam_smulā (c : š) (x : Set E) : diam (c ⢠x) = ācā * diam x := by
simp_rw [diam, ediam_smulā, ENNReal.toReal_smul, NNReal.smul_def, coe_nnnorm, smul_eq_mul]
theorem infEdist_smulā {c : š} (hc : c ā 0) (s : Set E) (x : E) :
EMetric.infEdist (c ⢠x) (c ⢠s) = ācāā ⢠EMetric.infEdist x s := by
simp_rw [EMetric.infEdist]
have : Function.Surjective ((c ⢠·) : E ā E) :=
Function.RightInverse.surjective (smul_inv_smulā hc)
trans āØ
(y) (_ : y ā s), ācāā ⢠edist x y
Ā· refine (this.iInf_congr _ fun y => ?_).symm
simp_rw [smul_mem_smul_set_iffā hc, edist_smulā]
Ā· have : (ācāā : ENNReal) ā 0 := by simp [hc]
simp_rw [ENNReal.smul_def, smul_eq_mul, ENNReal.mul_iInf_of_ne this ENNReal.coe_ne_top]
theorem infDist_smulā {c : š} (hc : c ā 0) (s : Set E) (x : E) :
Metric.infDist (c ⢠x) (c ⢠s) = ācā * Metric.infDist x s := by
simp_rw [Metric.infDist, infEdist_smulā hc s, ENNReal.toReal_smul, NNReal.smul_def, coe_nnnorm,
smul_eq_mul]
end DivisionRing
variable [NormedField š]
section SeminormedAddCommGroup
variable [SeminormedAddCommGroup E] [NormedSpace š E]
theorem smul_ball {c : š} (hc : c ā 0) (x : E) (r : ā) : c ⢠ball x r = ball (c ⢠x) (ācā * r) := by
ext y
rw [mem_smul_set_iff_inv_smul_memā hc]
conv_lhs => rw [ā inv_smul_smulā hc x]
simp [ā div_eq_inv_mul, div_lt_iffā (norm_pos_iff.2 hc), mul_comm _ r, dist_smulā]
theorem smul_unitBall {c : š} (hc : c ā 0) : c ⢠ball (0 : E) (1 : ā) = ball (0 : E) ācā := by
rw [_root_.smul_ball hc, smul_zero, mul_one]
theorem smul_sphere' {c : š} (hc : c ā 0) (x : E) (r : ā) :
c ⢠sphere x r = sphere (c ⢠x) (ācā * r) := by
ext y
rw [mem_smul_set_iff_inv_smul_memā hc]
conv_lhs => rw [ā inv_smul_smulā hc x]
simp only [mem_sphere, dist_smulā, norm_inv, ā div_eq_inv_mul, div_eq_iff (norm_pos_iff.2 hc).ne',
mul_comm r]
theorem smul_closedBall' {c : š} (hc : c ā 0) (x : E) (r : ā) :
c ⢠closedBall x r = closedBall (c ⢠x) (ācā * r) := by
simp only [ā ball_union_sphere, Set.smul_set_union, _root_.smul_ball hc, smul_sphere' hc]
theorem set_smul_sphere_zero {s : Set š} (hs : 0 ā s) (r : ā) :
s ⢠sphere (0 : E) r = (āĀ·ā) ā»Ā¹' ((āĀ·ā * r) '' s) :=
calc
s ⢠sphere (0 : E) r = ā c ā s, c ⢠sphere (0 : E) r := iUnion_smul_left_image.symm
_ = ā c ā s, sphere (0 : E) (ācā * r) := iUnionā_congr fun c hc ⦠by
rw [smul_sphere' (ne_of_mem_of_not_mem hc hs), smul_zero]
_ = (āĀ·ā) ā»Ā¹' ((āĀ·ā * r) '' s) := by ext; simp [eq_comm]
/-- Image of a bounded set in a normed space under scalar multiplication by a constant is
bounded. See also `Bornology.IsBounded.smul` for a similar lemma about an isometric action. -/
theorem Bornology.IsBounded.smulā {s : Set E} (hs : IsBounded s) (c : š) : IsBounded (c ⢠s) :=
(lipschitzWith_smul c).isBounded_image hs
/-- If `s` is a bounded set, then for small enough `r`, the set `{x} + r ⢠s` is contained in any
fixed neighborhood of `x`. -/
theorem eventually_singleton_add_smul_subset {x : E} {s : Set E} (hs : Bornology.IsBounded s)
{u : Set E} (hu : u ā š x) : āį¶ r in š (0 : š), {x} + r ⢠s ā u := by
obtain āØĪµ, εpos, hε⩠: ā ε : ā, 0 < ε ā§ closedBall x ε ā u := nhds_basis_closedBall.mem_iff.1 hu
obtain āØR, Rpos, hRā© : ā R : ā, 0 < R ā§ s ā closedBall 0 R := hs.subset_closedBall_lt 0 0
have : Metric.closedBall (0 : š) (ε / R) ā š (0 : š) := closedBall_mem_nhds _ (div_pos εpos Rpos)
filter_upwards [this] with r hr
simp only [image_add_left, singleton_add]
intro y hy
obtain āØz, zs, hzā© : ā z : E, z ā s ā§ r ⢠z = -x + y := by simpa [mem_smul_set] using hy
have I : ār ⢠zā ⤠ε :=
calc
ār ⢠zā = ārā * āzā := norm_smul _ _
_ ⤠ε / R * R := by
gcongr
exacts [mem_closedBall_zero_iff.1 hr, mem_closedBall_zero_iff.1 (hR zs)]
_ = ε := by field
have : y = x + r ⢠z := by simp only [hz, add_neg_cancel_left]
apply hε
simpa only [this, dist_eq_norm, add_sub_cancel_left, mem_closedBall] using I
variable [NormedSpace ā E] {x y z : E} {Ī“ ε : ā}
/-- In a real normed space, the image of the unit ball under scalar multiplication by a positive
constant `r` is the ball of radius `r`. -/
theorem smul_unitBall_of_pos {r : ā} (hr : 0 < r) : r ⢠ball (0 : E) 1 = ball (0 : E) r := by
rw [smul_unitBall hr.ne', Real.norm_of_nonneg hr.le]
lemma Ioo_smul_sphere_zero {a b r : ā} (ha : 0 ⤠a) (hr : 0 < r) :
Ioo a b ⢠sphere (0 : E) r = ball 0 (b * r) \ closedBall 0 (a * r) := by
have : EqOn (āĀ·ā) id (Ioo a b) := fun x hx ⦠abs_of_pos (ha.trans_lt hx.1)
rw [set_smul_sphere_zero (by simp [ha.not_gt]), ā image_image (Ā· * r), this.image_eq, image_id,
image_mul_right_Ioo _ _ hr]
ext x; simp [and_comm]
-- This is also true for `ā`-normed spaces
theorem exists_dist_eq (x z : E) {a b : ā} (ha : 0 ⤠a) (hb : 0 ⤠b) (hab : a + b = 1) :
ā y, dist x y = b * dist x z ā§ dist y z = a * dist x z := by
use a ⢠x + b ⢠z
nth_rw 1 [ā one_smul ā x]
nth_rw 4 [ā one_smul ā z]
simp [dist_eq_norm, ā hab, add_smul, ā smul_sub, norm_smul_of_nonneg, ha, hb]
theorem exists_dist_le_le (hΓ : 0 ⤠Γ) (hε : 0 ⤠ε) (h : dist x z ⤠ε + Γ) :
ā y, dist x y ⤠Γ ā§ dist y z ⤠ε := by
obtain rfl | hε' := hε.eq_or_lt
Ā· exact āØz, by rwa [zero_add] at h, (dist_self _).leā©
have hεΓ := add_pos_of_pos_of_nonneg hε' hΓ
refine (exists_dist_eq x z (div_nonneg hε <| add_nonneg hε hΓ)
(div_nonneg hΓ <| add_nonneg hε hΓ) <| by
rw [ā add_div, div_self hεΓ.ne']).imp
fun y hy => ?_
rw [hy.1, hy.2, div_mul_comm, div_mul_comm ε]
rw [ā div_le_one hεΓ] at h
exact āØmul_le_of_le_one_left hĪ“ h, mul_le_of_le_one_left hε hā©
-- This is also true for `ā`-normed spaces
theorem exists_dist_le_lt (hΓ : 0 ⤠Γ) (hε : 0 < ε) (h : dist x z < ε + Γ) :
ā y, dist x y ⤠Γ ā§ dist y z < ε := by
refine (exists_dist_eq x z (div_nonneg hε.le <| add_nonneg hε.le hΓ)
(div_nonneg hΓ <| add_nonneg hε.le hΓ) <| by
rw [ā add_div, div_self (add_pos_of_pos_of_nonneg hε hĪ“).ne']).imp
fun y hy => ?_
rw [hy.1, hy.2, div_mul_comm, div_mul_comm ε]
rw [ā div_lt_one (add_pos_of_pos_of_nonneg hε hĪ“)] at h
exact āØmul_le_of_le_one_left hĪ“ h.le, mul_lt_of_lt_one_left hε hā©
-- This is also true for `ā`-normed spaces
theorem exists_dist_lt_le (hΓ : 0 < Γ) (hε : 0 ⤠ε) (h : dist x z < ε + Γ) :
ā y, dist x y < Ī“ ā§ dist y z ⤠ε := by
obtain āØy, yz, xyā© :=
exists_dist_le_lt hε hΓ (show dist z x < Γ + ε by simpa only [dist_comm, add_comm] using h)
exact āØy, by simp [dist_comm x y, dist_comm y z, *]ā©
-- This is also true for `ā`-normed spaces
theorem exists_dist_lt_lt (hΓ : 0 < Γ) (hε : 0 < ε) (h : dist x z < ε + Γ) :
ā y, dist x y < Ī“ ā§ dist y z < ε := by
refine (exists_dist_eq x z (div_nonneg hε.le <| add_nonneg hε.le hΓ.le)
(div_nonneg hΓ.le <| add_nonneg hε.le hΓ.le) <| by
rw [ā add_div, div_self (add_pos hε hĪ“).ne']).imp
fun y hy => ?_
rw [hy.1, hy.2, div_mul_comm, div_mul_comm ε]
rw [ā div_lt_one (add_pos hε hĪ“)] at h
exact āØmul_lt_of_lt_one_left hĪ“ h, mul_lt_of_lt_one_left hε hā©
-- This is also true for `ā`-normed spaces
theorem disjoint_ball_ball_iff (hΓ : 0 < Γ) (hε : 0 < ε) :
Disjoint (ball x Ī“) (ball y ε) ā Ī“ + ε ⤠dist x y := by
refine āØfun h => le_of_not_gt fun hxy => ?_, ball_disjoint_ballā©
rw [add_comm] at hxy
obtain āØz, hxz, hzyā© := exists_dist_lt_lt hĪ“ hε hxy
rw [dist_comm] at hxz
exact h.le_bot āØhxz, hzyā©
-- This is also true for `ā`-normed spaces
theorem disjoint_ball_closedBall_iff (hΓ : 0 < Γ) (hε : 0 ⤠ε) :
Disjoint (ball x Ī“) (closedBall y ε) ā Ī“ + ε ⤠dist x y := by
refine āØfun h => le_of_not_gt fun hxy => ?_, ball_disjoint_closedBallā©
rw [add_comm] at hxy
obtain āØz, hxz, hzyā© := exists_dist_lt_le hĪ“ hε hxy
rw [dist_comm] at hxz
exact h.le_bot āØhxz, hzyā©
-- This is also true for `ā`-normed spaces
theorem disjoint_closedBall_ball_iff (hΓ : 0 ⤠Γ) (hε : 0 < ε) :
Disjoint (closedBall x Ī“) (ball y ε) ā Ī“ + ε ⤠dist x y := by
rw [disjoint_comm, disjoint_ball_closedBall_iff hε hΓ, add_comm, dist_comm]
theorem disjoint_closedBall_closedBall_iff (hΓ : 0 ⤠Γ) (hε : 0 ⤠ε) :
Disjoint (closedBall x Ī“) (closedBall y ε) ā Ī“ + ε < dist x y := by
refine āØfun h => lt_of_not_ge fun hxy => ?_, closedBall_disjoint_closedBallā©
rw [add_comm] at hxy
obtain āØz, hxz, hzyā© := exists_dist_le_le hĪ“ hε hxy
rw [dist_comm] at hxz
exact h.le_bot āØhxz, hzyā©
open EMetric ENNReal
@[simp]
theorem infEdist_thickening (hΓ : 0 < Γ) (s : Set E) (x : E) :
infEdist x (thickening Ī“ s) = infEdist x s - ENNReal.ofReal Ī“ := by
obtain hs | hs := lt_or_ge (infEdist x s) (ENNReal.ofReal Ī“)
Ā· rw [infEdist_zero_of_mem, tsub_eq_zero_of_le hs.le]
exact hs
refine (tsub_le_iff_right.2 infEdist_le_infEdist_thickening_add).antisymm' ?_
refine le_sub_of_add_le_right ofReal_ne_top ?_
refine le_infEdist.2 fun z hz => le_of_forall_gt fun r h => ?_
cases r with
| top =>
exact add_lt_top.2 āØlt_top_iff_ne_top.2 <| infEdist_ne_top āØz, self_subset_thickening hĪ“ _ hzā©,
ofReal_lt_topā©
| coe r =>
have hr : 0 < ār - Ī“ := by
refine sub_pos_of_lt ?_
have := hs.trans_lt ((infEdist_le_edist_of_mem hz).trans_lt h)
rw [ofReal_eq_coe_nnreal hΓ.le] at this
exact mod_cast this
rw [edist_lt_coe, ā dist_lt_coe, ā add_sub_cancel Ī“ ār] at h
obtain āØy, hxy, hyzā© := exists_dist_lt_lt hr hĪ“ h
refine (ENNReal.add_lt_add_right ofReal_ne_top <|
infEdist_lt_iff.2 āØ_, mem_thickening_iff.2 āØ_, hz, hyzā©, edist_lt_ofReal.2 hxyā©).trans_le ?_
rw [ā ofReal_add hr.le hĪ“.le, sub_add_cancel, ofReal_coe_nnreal]
@[simp]
theorem thickening_thickening (hε : 0 < ε) (hΓ : 0 < Γ) (s : Set E) :
thickening ε (thickening Γ s) = thickening (ε + Γ) s :=
(thickening_thickening_subset _ _ _).antisymm fun x => by
simp_rw [mem_thickening_iff]
rintro āØz, hz, hxzā©
rw [add_comm] at hxz
obtain āØy, hxy, hyzā© := exists_dist_lt_lt hε hĪ“ hxz
exact āØy, āØ_, hz, hyzā©, hxyā©
@[simp]
theorem cthickening_thickening (hε : 0 ⤠ε) (hΓ : 0 < Γ) (s : Set E) :
cthickening ε (thickening Γ s) = cthickening (ε + Γ) s :=
(cthickening_thickening_subset hε _ _).antisymm fun x => by
simp_rw [mem_cthickening_iff, ENNReal.ofReal_add hε hΓ.le, infEdist_thickening hΓ]
exact tsub_le_iff_right.2
-- Note: `interior (cthickening Ī“ s) ā thickening Ī“ s` in general
@[simp]
theorem closure_thickening (hΓ : 0 < Γ) (s : Set E) :
closure (thickening Ī“ s) = cthickening Ī“ s := by
rw [ā cthickening_zero, cthickening_thickening le_rfl hĪ“, zero_add]
@[simp]
theorem infEdist_cthickening (Ī“ : ā) (s : Set E) (x : E) :
infEdist x (cthickening Ī“ s) = infEdist x s - ENNReal.ofReal Ī“ := by
obtain hΓ | hΓ := le_or_gt Γ 0
· rw [cthickening_of_nonpos hΓ, infEdist_closure, ofReal_of_nonpos hΓ, tsub_zero]
Ā· rw [ā closure_thickening hĪ“, infEdist_closure, infEdist_thickening hĪ“]
@[simp]
theorem thickening_cthickening (hε : 0 < ε) (hΓ : 0 ⤠Γ) (s : Set E) :
thickening ε (cthickening Γ s) = thickening (ε + Γ) s := by
obtain rfl | hΓ := hΓ.eq_or_lt
Ā· rw [cthickening_zero, thickening_closure, add_zero]
Ā· rw [ā closure_thickening hĪ“, thickening_closure, thickening_thickening hε hĪ“]
@[simp]
theorem cthickening_cthickening (hε : 0 ⤠ε) (hΓ : 0 ⤠Γ) (s : Set E) :
cthickening ε (cthickening Γ s) = cthickening (ε + Γ) s :=
(cthickening_cthickening_subset hε hΓ _).antisymm fun x => by
simp_rw [mem_cthickening_iff, ENNReal.ofReal_add hε hΓ, infEdist_cthickening]
exact tsub_le_iff_right.2
@[simp]
theorem thickening_ball (hε : 0 < ε) (hΓ : 0 < Γ) (x : E) :
thickening ε (ball x Γ) = ball x (ε + Γ) := by
rw [ā thickening_singleton, thickening_thickening hε hĪ“, thickening_singleton]
@[simp]
theorem thickening_closedBall (hε : 0 < ε) (hΓ : 0 ⤠Γ) (x : E) :
thickening ε (closedBall x Γ) = ball x (ε + Γ) := by
rw [ā cthickening_singleton _ hĪ“, thickening_cthickening hε hĪ“, thickening_singleton]
@[simp]
theorem cthickening_ball (hε : 0 ⤠ε) (hΓ : 0 < Γ) (x : E) :
cthickening ε (ball x Γ) = closedBall x (ε + Γ) := by
rw [ā thickening_singleton, cthickening_thickening hε hĪ“,
cthickening_singleton _ (add_nonneg hε hΓ.le)]
@[simp]
theorem cthickening_closedBall (hε : 0 ⤠ε) (hΓ : 0 ⤠Γ) (x : E) :
cthickening ε (closedBall x Γ) = closedBall x (ε + Γ) := by
rw [ā cthickening_singleton _ hĪ“, cthickening_cthickening hε hĪ“,
cthickening_singleton _ (add_nonneg hε hΓ)]
theorem ball_add_ball (hε : 0 < ε) (hΓ : 0 < Γ) (a b : E) :
ball a ε + ball b Γ = ball (a + b) (ε + Γ) := by
rw [ball_add, thickening_ball hε hΓ b, Metric.vadd_ball, vadd_eq_add]
theorem ball_sub_ball (hε : 0 < ε) (hΓ : 0 < Γ) (a b : E) :
ball a ε - ball b Γ = ball (a - b) (ε + Γ) := by
simp_rw [sub_eq_add_neg, neg_ball, ball_add_ball hε hΓ]
theorem ball_add_closedBall (hε : 0 < ε) (hΓ : 0 ⤠Γ) (a b : E) :
ball a ε + closedBall b Γ = ball (a + b) (ε + Γ) := by
rw [ball_add, thickening_closedBall hε hΓ b, Metric.vadd_ball, vadd_eq_add]
theorem ball_sub_closedBall (hε : 0 < ε) (hΓ : 0 ⤠Γ) (a b : E) :
ball a ε - closedBall b Γ = ball (a - b) (ε + Γ) := by
simp_rw [sub_eq_add_neg, neg_closedBall, ball_add_closedBall hε hΓ]
theorem closedBall_add_ball (hε : 0 ⤠ε) (hΓ : 0 < Γ) (a b : E) :
closedBall a ε + ball b Γ = ball (a + b) (ε + Γ) := by
rw [add_comm, ball_add_closedBall hΓ hε b, add_comm, add_comm Γ]
theorem closedBall_sub_ball (hε : 0 ⤠ε) (hΓ : 0 < Γ) (a b : E) :
closedBall a ε - ball b Γ = ball (a - b) (ε + Γ) := by
simp_rw [sub_eq_add_neg, neg_ball, closedBall_add_ball hε hΓ]
theorem closedBall_add_closedBall [ProperSpace E] (hε : 0 ⤠ε) (hΓ : 0 ⤠Γ) (a b : E) :
closedBall a ε + closedBall b Γ = closedBall (a + b) (ε + Γ) := by
rw [(isCompact_closedBall _ _).add_closedBall hΓ b, cthickening_closedBall hΓ hε a,
Metric.vadd_closedBall, vadd_eq_add, add_comm, add_comm Ī“]
theorem closedBall_sub_closedBall [ProperSpace E] (hε : 0 ⤠ε) (hΓ : 0 ⤠Γ) (a b : E) :
closedBall a ε - closedBall b Γ = closedBall (a - b) (ε + Γ) := by
rw [sub_eq_add_neg, neg_closedBall, closedBall_add_closedBall hε hΓ, sub_eq_add_neg]
end SeminormedAddCommGroup
section NormedAddCommGroup
variable [NormedAddCommGroup E] [NormedSpace š E]
theorem smul_closedBall (c : š) (x : E) {r : ā} (hr : 0 ⤠r) :
c ⢠closedBall x r = closedBall (c ⢠x) (ācā * r) := by
rcases eq_or_ne c 0 with (rfl | hc)
Ā· simp [hr, zero_smul_set, Set.singleton_zero, nonempty_closedBall]
Ā· exact smul_closedBall' hc x r
theorem smul_unitClosedBall (c : š) : c ⢠closedBall (0 : E) (1 : ā) = closedBall (0 : E) ācā := by
rw [_root_.smul_closedBall _ _ zero_le_one, smul_zero, mul_one]
variable [NormedSpace ā E]
/-- In a real normed space, the image of the unit closed ball under multiplication by a nonnegative
number `r` is the closed ball of radius `r` with center at the origin. -/
theorem smul_unitClosedBall_of_nonneg {r : ā} (hr : 0 ⤠r) :
r ⢠closedBall (0 : E) 1 = closedBall (0 : E) r := by
rw [smul_unitClosedBall, Real.norm_of_nonneg hr]
theorem smul_sphere [Nontrivial E] (c : š) (x : E) {r : ā} (hr : 0 ⤠r) :
c ⢠sphere x r = sphere (c ⢠x) (ācā * r) := by
rcases eq_or_ne c 0 with (rfl | hc)
Ā· simp [zero_smul_set, Set.singleton_zero, hr]
Ā· exact smul_sphere' hc x r
/-- Any ball `Metric.ball x r`, `0 < r` is the image of the unit ball under `fun y ⦠x + r ⢠y`. -/
theorem affinity_unitBall {r : ā} (hr : 0 < r) (x : E) : x +ᵄ r ⢠ball (0 : E) 1 = ball x r := by
rw [smul_unitBall_of_pos hr, vadd_ball_zero]
/-- Any closed ball `Metric.closedBall x r`, `0 ⤠r` is the image of the unit closed ball under
`fun y ⦠x + r ⢠y`. -/
theorem affinity_unitClosedBall {r : ā} (hr : 0 ⤠r) (x : E) :
x +ᵄ r ⢠closedBall (0 : E) 1 = closedBall x r := by
rw [smul_unitClosedBall, Real.norm_of_nonneg hr, vadd_closedBall_zero]
end NormedAddCommGroup |
.lake/packages/mathlib/Mathlib/Analysis/Normed/Module/Ball/Action.lean | import Mathlib.Analysis.Normed.Field.UnitBall
import Mathlib.Analysis.Normed.Module.Basic
import Mathlib.LinearAlgebra.Basis.VectorSpace
/-!
# Multiplicative actions of/on balls and spheres
Let `E` be a normed vector space over a normed field `š`. In this file we define the following
multiplicative actions.
- The closed unit ball in `š` acts on open balls and closed balls centered at `0` in `E`.
- The unit sphere in `š` acts on open balls, closed balls, and spheres centered at `0` in `E`.
-/
open Metric Set
variable {š š' E : Type*} [NormedField š] [NormedField š'] [SeminormedAddCommGroup E]
[NormedSpace š E] [NormedSpace š' E] {r : ā}
section ClosedBall
instance mulActionClosedBallBall : MulAction (closedBall (0 : š) 1) (ball (0 : E) r) where
smul c x :=
āØ(c : š) ⢠āx,
mem_ball_zero_iff.2 <| by
simpa only [norm_smul, one_mul] using
mul_lt_mul' (mem_closedBall_zero_iff.1 c.2) (mem_ball_zero_iff.1 x.2) (norm_nonneg _)
one_posā©
one_smul _cā := Subtype.ext <| one_smul š _
mul_smul _ _ _ := Subtype.ext <| mul_smul _ _ _
instance continuousSMul_closedBall_ball : ContinuousSMul (closedBall (0 : š) 1) (ball (0 : E) r) :=
āØ(continuous_subtype_val.fst'.smul continuous_subtype_val.snd').subtype_mk _ā©
instance mulActionClosedBallClosedBall :
MulAction (closedBall (0 : š) 1) (closedBall (0 : E) r) where
smul c x :=
āØ(c : š) ⢠āx,
mem_closedBall_zero_iff.2 <| by
simpa only [norm_smul, one_mul] using
mul_le_mul (mem_closedBall_zero_iff.1 c.2) (mem_closedBall_zero_iff.1 x.2) (norm_nonneg _)
zero_le_oneā©
one_smul _ := Subtype.ext <| one_smul š _
mul_smul _ _ _ := Subtype.ext <| mul_smul _ _ _
instance continuousSMul_closedBall_closedBall :
ContinuousSMul (closedBall (0 : š) 1) (closedBall (0 : E) r) :=
āØ(continuous_subtype_val.fst'.smul continuous_subtype_val.snd').subtype_mk _ā©
end ClosedBall
section Sphere
instance mulActionSphereBall : MulAction (sphere (0 : š) 1) (ball (0 : E) r) where
smul c x := inclusion sphere_subset_closedBall c ⢠x
one_smul _ := Subtype.ext <| one_smul _ _
mul_smul _ _ _ := Subtype.ext <| mul_smul _ _ _
instance continuousSMul_sphere_ball : ContinuousSMul (sphere (0 : š) 1) (ball (0 : E) r) :=
āØ(continuous_subtype_val.fst'.smul continuous_subtype_val.snd').subtype_mk _ā©
instance mulActionSphereClosedBall : MulAction (sphere (0 : š) 1) (closedBall (0 : E) r) where
smul c x := inclusion sphere_subset_closedBall c ⢠x
one_smul _ := Subtype.ext <| one_smul _ _
mul_smul _ _ _ := Subtype.ext <| mul_smul _ _ _
instance continuousSMul_sphere_closedBall :
ContinuousSMul (sphere (0 : š) 1) (closedBall (0 : E) r) :=
āØ(continuous_subtype_val.fst'.smul continuous_subtype_val.snd').subtype_mk _ā©
instance mulActionSphereSphere : MulAction (sphere (0 : š) 1) (sphere (0 : E) r) where
smul c x :=
āØ(c : š) ⢠āx,
mem_sphere_zero_iff_norm.2 <| by
rw [norm_smul, mem_sphere_zero_iff_norm.1 c.coe_prop, mem_sphere_zero_iff_norm.1 x.coe_prop,
one_mul]ā©
one_smul _ := Subtype.ext <| one_smul _ _
mul_smul _ _ _ := Subtype.ext <| mul_smul _ _ _
instance continuousSMul_sphere_sphere : ContinuousSMul (sphere (0 : š) 1) (sphere (0 : E) r) :=
āØ(continuous_subtype_val.fst'.smul continuous_subtype_val.snd').subtype_mk _ā©
end Sphere
section IsScalarTower
variable [NormedAlgebra š š'] [IsScalarTower š š' E]
instance isScalarTower_closedBall_closedBall_closedBall :
IsScalarTower (closedBall (0 : š) 1) (closedBall (0 : š') 1) (closedBall (0 : E) r) :=
āØfun a b c => Subtype.ext <| smul_assoc (a : š) (b : š') (c : E)ā©
instance isScalarTower_closedBall_closedBall_ball :
IsScalarTower (closedBall (0 : š) 1) (closedBall (0 : š') 1) (ball (0 : E) r) :=
āØfun a b c => Subtype.ext <| smul_assoc (a : š) (b : š') (c : E)ā©
instance isScalarTower_sphere_closedBall_closedBall :
IsScalarTower (sphere (0 : š) 1) (closedBall (0 : š') 1) (closedBall (0 : E) r) :=
āØfun a b c => Subtype.ext <| smul_assoc (a : š) (b : š') (c : E)ā©
instance isScalarTower_sphere_closedBall_ball :
IsScalarTower (sphere (0 : š) 1) (closedBall (0 : š') 1) (ball (0 : E) r) :=
āØfun a b c => Subtype.ext <| smul_assoc (a : š) (b : š') (c : E)ā©
instance isScalarTower_sphere_sphere_closedBall :
IsScalarTower (sphere (0 : š) 1) (sphere (0 : š') 1) (closedBall (0 : E) r) :=
āØfun a b c => Subtype.ext <| smul_assoc (a : š) (b : š') (c : E)ā©
instance isScalarTower_sphere_sphere_ball :
IsScalarTower (sphere (0 : š) 1) (sphere (0 : š') 1) (ball (0 : E) r) :=
āØfun a b c => Subtype.ext <| smul_assoc (a : š) (b : š') (c : E)ā©
instance isScalarTower_sphere_sphere_sphere :
IsScalarTower (sphere (0 : š) 1) (sphere (0 : š') 1) (sphere (0 : E) r) :=
āØfun a b c => Subtype.ext <| smul_assoc (a : š) (b : š') (c : E)ā©
instance isScalarTower_sphere_ball_ball :
IsScalarTower (sphere (0 : š) 1) (ball (0 : š') 1) (ball (0 : š') 1) :=
āØfun a b c => Subtype.ext <| smul_assoc (a : š) (b : š') (c : š')ā©
instance isScalarTower_closedBall_ball_ball :
IsScalarTower (closedBall (0 : š) 1) (ball (0 : š') 1) (ball (0 : š') 1) :=
āØfun a b c => Subtype.ext <| smul_assoc (a : š) (b : š') (c : š')ā©
end IsScalarTower
section SMulCommClass
variable [SMulCommClass š š' E]
instance instSMulCommClass_closedBall_closedBall_closedBall :
SMulCommClass (closedBall (0 : š) 1) (closedBall (0 : š') 1) (closedBall (0 : E) r) :=
āØfun a b c => Subtype.ext <| smul_comm (a : š) (b : š') (c : E)ā©
instance instSMulCommClass_closedBall_closedBall_ball :
SMulCommClass (closedBall (0 : š) 1) (closedBall (0 : š') 1) (ball (0 : E) r) :=
āØfun a b c => Subtype.ext <| smul_comm (a : š) (b : š') (c : E)ā©
instance instSMulCommClass_sphere_closedBall_closedBall :
SMulCommClass (sphere (0 : š) 1) (closedBall (0 : š') 1) (closedBall (0 : E) r) :=
āØfun a b c => Subtype.ext <| smul_comm (a : š) (b : š') (c : E)ā©
instance instSMulCommClass_sphere_closedBall_ball :
SMulCommClass (sphere (0 : š) 1) (closedBall (0 : š') 1) (ball (0 : E) r) :=
āØfun a b c => Subtype.ext <| smul_comm (a : š) (b : š') (c : E)ā©
instance instSMulCommClass_sphere_ball_ball [NormedAlgebra š š'] :
SMulCommClass (sphere (0 : š) 1) (ball (0 : š') 1) (ball (0 : š') 1) :=
āØfun a b c => Subtype.ext <| smul_comm (a : š) (b : š') (c : š')ā©
instance instSMulCommClass_sphere_sphere_closedBall :
SMulCommClass (sphere (0 : š) 1) (sphere (0 : š') 1) (closedBall (0 : E) r) :=
āØfun a b c => Subtype.ext <| smul_comm (a : š) (b : š') (c : E)ā©
instance instSMulCommClass_sphere_sphere_ball :
SMulCommClass (sphere (0 : š) 1) (sphere (0 : š') 1) (ball (0 : E) r) :=
āØfun a b c => Subtype.ext <| smul_comm (a : š) (b : š') (c : E)ā©
instance instSMulCommClass_sphere_sphere_sphere :
SMulCommClass (sphere (0 : š) 1) (sphere (0 : š') 1) (sphere (0 : E) r) :=
āØfun a b c => Subtype.ext <| smul_comm (a : š) (b : š') (c : E)ā©
end SMulCommClass
variable (š)
variable [CharZero š]
include š in
theorem ne_neg_of_mem_sphere {r : ā} (hr : r ā 0) (x : sphere (0 : E) r) : x ā -x :=
have : IsAddTorsionFree E := .of_noZeroSMulDivisors š E
fun h => ne_zero_of_mem_sphere hr x (self_eq_neg.mp (by (conv_lhs => rw [h]); rfl))
include š in
theorem ne_neg_of_mem_unit_sphere (x : sphere (0 : E) 1) : x ā -x :=
ne_neg_of_mem_sphere š one_ne_zero x |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.