Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 7d754e0

Browse files
committed
chore(analysis/calculus/mean_value): use nnnorm in a few lemmas (#8348)
Use `nnnorm` instead of `norm` and `C : nnreal` in lemmas about `lipschitz_on_with`. This way we can use them to prove any statement of the form `lipschitz_on_with C f s`, not only something of the form `lipschitz_on_with (real.to_nnreal C) f s`.
1 parent 3782c19 commit 7d754e0

File tree

4 files changed

+59
-41
lines changed

4 files changed

+59
-41
lines changed

src/analysis/calculus/mean_value.lean

Lines changed: 44 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -515,14 +515,31 @@ end
515515
/-- The mean value theorem on a convex set: if the derivative of a function is bounded by `C` on
516516
`s`, then the function is `C`-Lipschitz on `s`. Version with `has_fderiv_within` and
517517
`lipschitz_on_with`. -/
518-
theorem convex.lipschitz_on_with_of_norm_has_fderiv_within_le
519-
(hf : ∀ x ∈ s, has_fderiv_within_at f (f' x) s x) (bound : ∀x∈s, ∥f' x∥ ≤ C)
520-
(hs : convex s) : lipschitz_on_with (real.to_nnreal C) f s :=
518+
theorem convex.lipschitz_on_with_of_nnnorm_has_fderiv_within_le {C : ℝ≥0}
519+
(hf : ∀ x ∈ s, has_fderiv_within_at f (f' x) s x) (bound : ∀x∈s, ∥f' x∥ ≤ C)
520+
(hs : convex s) : lipschitz_on_with C f s :=
521521
begin
522522
rw lipschitz_on_with_iff_norm_sub_le,
523523
intros x x_in y y_in,
524-
convert hs.norm_image_sub_le_of_norm_has_fderiv_within_le hf bound y_in x_in,
525-
exact real.coe_to_nnreal C ((norm_nonneg $ f' x).trans $ bound x x_in)
524+
exact hs.norm_image_sub_le_of_norm_has_fderiv_within_le hf bound y_in x_in
525+
end
526+
527+
/-- Let `s` be a convex set in a real normed vector space `E`, let `f : E → G` be a function
528+
differentiable within `s` in a neighborhood of `x : E` with derivative `f'`. Suppose that `f'`
529+
is continuous within `s` at `x`. Then for any number `K : ℝ≥0` larger than `∥f' x∥₊`, `f` is
530+
`K`-Lipschitz on some neighborhood of `x` within `s`. -/
531+
lemma convex.exists_nhds_within_lipschitz_on_with_of_has_fderiv_within_at_of_continuous_within_at
532+
(hs : convex s) {f : E → G} (hder : ∀ᶠ y in 𝓝[s] x, has_fderiv_within_at f (f' y) s y)
533+
(hcont : continuous_within_at f' s x) (K : ℝ≥0) (hK : ∥f' x∥₊ < K) :
534+
∃ t ∈ 𝓝[s] x, lipschitz_on_with K f t :=
535+
begin
536+
obtain ⟨ε, ε0, hε⟩ :
537+
∃ ε > 0, ball x ε ∩ s ⊆ {y | has_fderiv_within_at f (f' y) s y ∧ ∥f' y∥₊ < K},
538+
from mem_nhds_within_iff.1 (hder.and $ hcont.nnnorm.eventually (gt_mem_nhds hK)),
539+
rw inter_comm at hε,
540+
refine ⟨s ∩ ball x ε, inter_mem_nhds_within _ (ball_mem_nhds _ ε0), _⟩,
541+
exact (hs.inter (convex_ball _ _)).lipschitz_on_with_of_nnnorm_has_fderiv_within_le
542+
(λ y hy, (hε hy).1.mono (inter_subset_left _ _)) (λ y hy, (hε hy).2.le)
526543
end
527544

528545
/-- The mean value theorem on a convex set: if the derivative of a function within this set is
@@ -536,10 +553,10 @@ bound xs ys
536553
/-- The mean value theorem on a convex set: if the derivative of a function is bounded by `C` on
537554
`s`, then the function is `C`-Lipschitz on `s`. Version with `fderiv_within` and
538555
`lipschitz_on_with`. -/
539-
theorem convex.lipschitz_on_with_of_norm_fderiv_within_le
540-
(hf : differentiable_on 𝕜 f s) (bound : ∀x∈s, ∥fderiv_within 𝕜 f s x∥ ≤ C)
541-
(hs : convex s) : lipschitz_on_with (real.to_nnreal C) f s:=
542-
hs.lipschitz_on_with_of_norm_has_fderiv_within_le (λ x hx, (hf x hx).has_fderiv_within_at) bound
556+
theorem convex.lipschitz_on_with_of_nnnorm_fderiv_within_le {C : ℝ≥0}
557+
(hf : differentiable_on 𝕜 f s) (bound : ∀ x ∈ s, ∥fderiv_within 𝕜 f s x∥ ≤ C)
558+
(hs : convex s) : lipschitz_on_with C f s:=
559+
hs.lipschitz_on_with_of_nnnorm_has_fderiv_within_le (λ x hx, (hf x hx).has_fderiv_within_at) bound
543560

544561
/-- The mean value theorem on a convex set: if the derivative of a function is bounded by `C`,
545562
then the function is `C`-Lipschitz. Version with `fderiv`. -/
@@ -551,10 +568,10 @@ hs.norm_image_sub_le_of_norm_has_fderiv_within_le
551568

552569
/-- The mean value theorem on a convex set: if the derivative of a function is bounded by `C` on
553570
`s`, then the function is `C`-Lipschitz on `s`. Version with `fderiv` and `lipschitz_on_with`. -/
554-
theorem convex.lipschitz_on_with_of_norm_fderiv_le
555-
(hf : ∀ x ∈ s, differentiable_at 𝕜 f x) (bound : ∀x∈s, ∥fderiv 𝕜 f x∥ ≤ C)
556-
(hs : convex s) : lipschitz_on_with (real.to_nnreal C) f s :=
557-
hs.lipschitz_on_with_of_norm_has_fderiv_within_le
571+
theorem convex.lipschitz_on_with_of_nnnorm_fderiv_le {C : ℝ≥0}
572+
(hf : ∀ x ∈ s, differentiable_at 𝕜 f x) (bound : ∀x∈s, ∥fderiv 𝕜 f x∥ ≤ C)
573+
(hs : convex s) : lipschitz_on_with C f s :=
574+
hs.lipschitz_on_with_of_nnnorm_has_fderiv_within_le
558575
(λ x hx, (hf x hx).has_fderiv_at.has_fderiv_within_at) bound
559576

560577
/-- Variant of the mean value inequality on a convex set, using a bound on the difference between
@@ -620,11 +637,11 @@ convex.norm_image_sub_le_of_norm_has_fderiv_within_le (λ x hx, (hf x hx).has_fd
620637
/-- The mean value theorem on a convex set in dimension 1: if the derivative of a function is
621638
bounded by `C` on `s`, then the function is `C`-Lipschitz on `s`.
622639
Version with `has_deriv_within` and `lipschitz_on_with`. -/
623-
theorem convex.lipschitz_on_with_of_norm_has_deriv_within_le
624-
{f f' : ℝ → F} {C : ℝ} {s : set ℝ} (hs : convex s)
625-
(hf : ∀ x ∈ s, has_deriv_within_at f (f' x) s x) (bound : ∀x∈s, ∥f' x∥ ≤ C) :
626-
lipschitz_on_with (real.to_nnreal C) f s :=
627-
convex.lipschitz_on_with_of_norm_has_fderiv_within_le (λ x hx, (hf x hx).has_fderiv_within_at)
640+
theorem convex.lipschitz_on_with_of_nnnorm_has_deriv_within_le
641+
{f f' : ℝ → F} {C : ℝ0} {s : set ℝ} (hs : convex s)
642+
(hf : ∀ x ∈ s, has_deriv_within_at f (f' x) s x) (bound : ∀x∈s, ∥f' x∥ ≤ C) :
643+
lipschitz_on_with C f s :=
644+
convex.lipschitz_on_with_of_nnnorm_has_fderiv_within_le (λ x hx, (hf x hx).has_fderiv_within_at)
628645
(λ x hx, le_trans (by simp) (bound x hx)) hs
629646

630647
/-- The mean value theorem on a convex set in dimension 1: if the derivative of a function within
@@ -639,11 +656,11 @@ bound xs ys
639656
/-- The mean value theorem on a convex set in dimension 1: if the derivative of a function is
640657
bounded by `C` on `s`, then the function is `C`-Lipschitz on `s`.
641658
Version with `deriv_within` and `lipschitz_on_with`. -/
642-
theorem convex.lipschitz_on_with_of_norm_deriv_within_le
643-
{f : ℝ → F} {C : ℝ} {s : set ℝ} (hs : convex s)
644-
(hf : differentiable_on ℝ f s) (bound : ∀x∈s, ∥deriv_within f s x∥ ≤ C) :
645-
lipschitz_on_with (real.to_nnreal C) f s :=
646-
hs.lipschitz_on_with_of_norm_has_deriv_within_le (λ x hx, (hf x hx).has_deriv_within_at) bound
659+
theorem convex.lipschitz_on_with_of_nnnorm_deriv_within_le
660+
{f : ℝ → F} {C : ℝ0} {s : set ℝ} (hs : convex s)
661+
(hf : differentiable_on ℝ f s) (bound : ∀x∈s, ∥deriv_within f s x∥ ≤ C) :
662+
lipschitz_on_with C f s :=
663+
hs.lipschitz_on_with_of_nnnorm_has_deriv_within_le (λ x hx, (hf x hx).has_deriv_within_at) bound
647664

648665
/-- The mean value theorem on a convex set in dimension 1: if the derivative of a function is
649666
bounded by `C`, then the function is `C`-Lipschitz. Version with `deriv`. -/
@@ -656,10 +673,10 @@ hs.norm_image_sub_le_of_norm_has_deriv_within_le
656673
/-- The mean value theorem on a convex set in dimension 1: if the derivative of a function is
657674
bounded by `C` on `s`, then the function is `C`-Lipschitz on `s`.
658675
Version with `deriv` and `lipschitz_on_with`. -/
659-
theorem convex.lipschitz_on_with_of_norm_deriv_le {f : ℝ → F} {C : ℝ} {s : set ℝ}
660-
(hf : ∀ x ∈ s, differentiable_at ℝ f x) (bound : ∀x∈s, ∥deriv f x∥ ≤ C)
661-
(hs : convex s) : lipschitz_on_with (real.to_nnreal C) f s :=
662-
hs.lipschitz_on_with_of_norm_has_deriv_within_le
676+
theorem convex.lipschitz_on_with_of_nnnorm_deriv_le {f : ℝ → F} {C : ℝ0} {s : set ℝ}
677+
(hf : ∀ x ∈ s, differentiable_at ℝ f x) (bound : ∀x∈s, ∥deriv f x∥ ≤ C)
678+
(hs : convex s) : lipschitz_on_with C f s :=
679+
hs.lipschitz_on_with_of_nnnorm_has_deriv_within_le
663680
(λ x hx, (hf x hx).has_deriv_at.has_deriv_within_at) bound
664681

665682
/-! ### Functions `[a, b] → ℝ`. -/

src/analysis/calculus/parametric_integral.lean

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,10 @@ begin
196196
have : ∀ᵐ a ∂μ, lipschitz_on_with (real.nnabs (bound a)) (λ x, F x a) (ball x₀ ε),
197197
{ apply (h_diff.and h_bound).mono,
198198
rintros a ⟨ha_deriv, ha_bound⟩,
199-
have bound_nonneg : 0 ≤ bound a := (norm_nonneg (F' x₀ a)).trans (ha_bound x₀ x₀_in),
200-
rw show real.nnabs (bound a) = real.to_nnreal (bound a), by simp [bound_nonneg],
201-
apply convex.lipschitz_on_with_of_norm_has_fderiv_within_le _ ha_bound (convex_ball _ _),
202-
intros x x_in,
203-
exact (ha_deriv x x_in).has_fderiv_within_at, },
199+
refine (convex_ball _ _).lipschitz_on_with_of_nnnorm_has_fderiv_within_le
200+
(λ x x_in, (ha_deriv x x_in).has_fderiv_within_at) (λ x x_in, _),
201+
rw [← nnreal.coe_le_coe, coe_nnnorm, nnreal.coe_nnabs],
202+
exact (ha_bound x x_in).trans (le_abs_self _) },
204203
exact (has_fderiv_at_of_dominated_loc_of_lip ε_pos hF_meas hF_int
205204
hF'_meas this bound_integrable diff_x₀).2
206205
end
@@ -254,10 +253,10 @@ begin
254253
have : ∀ᵐ a ∂μ, lipschitz_on_with (real.nnabs (bound a)) (λ (x : ℝ), F x a) (ball x₀ ε),
255254
{ apply (h_diff.and h_bound).mono,
256255
rintros a ⟨ha_deriv, ha_bound⟩,
257-
have bound_nonneg : 0 ≤ bound a := (norm_nonneg (F' x₀ a)).trans (ha_bound x₀ x₀_in),
258-
rw show real.nnabs (bound a) = real.to_nnreal (bound a), by simp [bound_nonneg],
259-
apply convex.lipschitz_on_with_of_norm_has_deriv_within_le (convex_ball _ _)
260-
(λ x x_in, (ha_deriv x x_in).has_deriv_within_at) ha_bound },
256+
refine (convex_ball _ _).lipschitz_on_with_of_nnnorm_has_deriv_within_le
257+
(λ x x_in, (ha_deriv x x_in).has_deriv_within_at) (λ x x_in, _),
258+
rw [← nnreal.coe_le_coe, coe_nnnorm, nnreal.coe_nnabs],
259+
exact (ha_bound x x_in).trans (le_abs_self _) },
261260
exact has_deriv_at_of_dominated_loc_of_lip ε_pos hF_meas hF_int hF'_meas this
262261
bound_integrable diff_x₀
263262
end

src/analysis/normed_space/operator_norm.lean

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,6 +1195,12 @@ begin
11951195
... ≤ ∥smul_right c f∥ * ∥x∥ : le_op_norm _ _ } },
11961196
end
11971197

1198+
/-- The non-negative norm of the tensor product of a scalar linear map and of an element of a normed
1199+
space is the product of the non-negative norms. -/
1200+
@[simp] lemma nnnorm_smul_right_apply (c : E →L[𝕜] 𝕜) (f : F) :
1201+
∥smul_right c f∥₊ = ∥c∥₊ * ∥f∥₊ :=
1202+
nnreal.eq $ c.norm_smul_right_apply f
1203+
11981204
variables (𝕜 E F)
11991205

12001206
/-- `continuous_linear_map.smul_right` as a continuous trilinear map:

src/data/real/nnreal.lean

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -785,11 +785,7 @@ lemma real.nnabs_of_nonneg {x : ℝ} (h : 0 ≤ x) : real.nnabs x = real.to_nnre
785785
by { ext, simp [real.coe_to_nnreal x h, abs_of_nonneg h] }
786786

787787
lemma real.coe_to_nnreal_le (x : ℝ) : (real.to_nnreal x : ℝ) ≤ abs x :=
788-
begin
789-
by_cases h : 0 ≤ x,
790-
{ simp [h, real.coe_to_nnreal x h, le_abs_self] },
791-
{ simp [real.to_nnreal, h, le_abs_self, abs_nonneg] }
792-
end
788+
max_le (le_abs_self _) (abs_nonneg _)
793789

794790
lemma cast_nat_abs_eq_nnabs_cast (n : ℤ) :
795791
(n.nat_abs : ℝ≥0) = real.nnabs n :=

0 commit comments

Comments
 (0)