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

Commit 7803435

Browse files
refactor(topology/metric_space/lipschitz): generalize to pseudo_emetric_space (#6831)
This is part of a series of PR to introduce `semi_normed_group` in mathlib. We introduce here Lipschitz maps for `pseudo_emetric_space` (I also improve some theorem name in `topology/metric_space/emetric_space`).
1 parent 489f522 commit 7803435

File tree

5 files changed

+28
-34
lines changed

5 files changed

+28
-34
lines changed

src/analysis/normed_space/add_torsor.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,10 @@ calc edist (f x -ᵥ g x) (f y -ᵥ g y) ≤ edist (f x) (f y) + edist (g x) (g
226226
(add_mul _ _ _).symm
227227

228228
lemma uniform_continuous_vadd : uniform_continuous (λ x : V × P, x.1 +ᵥ x.2) :=
229-
(lipschitz_with.prod_fst.vadd lipschitz_with.prod_snd).uniform_continuous
229+
((@lipschitz_with.prod_fst V P _ _).vadd lipschitz_with.prod_snd).uniform_continuous
230230

231231
lemma uniform_continuous_vsub : uniform_continuous (λ x : P × P, x.1 -ᵥ x.2) :=
232-
(lipschitz_with.prod_fst.vsub lipschitz_with.prod_snd).uniform_continuous
232+
((@lipschitz_with.prod_fst P P _ _).vsub lipschitz_with.prod_snd).uniform_continuous
233233

234234
lemma continuous_vadd : continuous (λ x : V × P, x.1 +ᵥ x.2) :=
235235
uniform_continuous_vadd.continuous

src/analysis/normed_space/basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ end
583583
continuous. -/
584584
@[priority 100] -- see Note [lower instance priority]
585585
instance normed_uniform_group : uniform_add_group α :=
586-
⟨(lipschitz_with.prod_fst.sub lipschitz_with.prod_snd).uniform_continuous⟩
586+
⟨((@lipschitz_with.prod_fst α α _ _).sub lipschitz_with.prod_snd).uniform_continuous⟩
587587

588588
@[priority 100] -- see Note [lower instance priority]
589589
instance normed_top_monoid : has_continuous_add α :=

src/topology/metric_space/basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1174,7 +1174,7 @@ begin
11741174
{ assume x y,
11751175
rw ← lt_top_iff_ne_top,
11761176
have : (⊥ : ℝ≥0∞) < ⊤ := ennreal.coe_lt_top,
1177-
simp [pseudo_edist_pi_def, finset.sup_lt_iff this, edist_lt_top] },
1177+
simp [edist_pi_def, finset.sup_lt_iff this, edist_lt_top] },
11781178
show ∀ (x y : Π (b : β), π b), ↑(sup univ (λ (b : β), nndist (x b) (y b))) =
11791179
ennreal.to_real (sup univ (λ (b : β), edist (x b) (y b))),
11801180
{ assume x y,

src/topology/metric_space/emetric_space.lean

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ instance prod.pseudo_emetric_space_max [pseudo_emetric_space β] : pseudo_emetri
418418
end,
419419
to_uniform_space := prod.uniform_space }
420420

421-
lemma prod.pesudoedist_eq [pseudo_emetric_space β] (x y : α × β) :
421+
lemma prod.edist_eq [pseudo_emetric_space β] (x y : α × β) :
422422
edist x y = max (edist x.1 y.1) (edist x.2 y.2) :=
423423
rfl
424424

@@ -452,11 +452,11 @@ instance pseudo_emetric_space_pi [∀b, pseudo_emetric_space (π b)] :
452452
simp [set.ext_iff, εpos]
453453
end }
454454

455-
lemma pseudo_edist_pi_def [Π b, pseudo_emetric_space (π b)] (f g : Π b, π b) :
455+
lemma edist_pi_def [Π b, pseudo_emetric_space (π b)] (f g : Π b, π b) :
456456
edist f g = finset.sup univ (λb, edist (f b) (g b)) := rfl
457457

458-
@[priority 1100]
459-
lemma pseudo_edist_pi_const [nonempty β] (a b : α) :
458+
@[simp]
459+
lemma edist_pi_const [nonempty β] (a b : α) :
460460
edist (λ x : β, a) (λ _, b) = edist a b := finset.sup_const univ_nonempty (edist a b)
461461

462462
end pi
@@ -971,10 +971,6 @@ instance prod.emetric_space_max [emetric_space β] : emetric_space (γ × β) :=
971971
end,
972972
..prod.pseudo_emetric_space_max }
973973

974-
lemma prod.edist_eq [emetric_space β] (x y : α × β) :
975-
edist x y = max (edist x.1 y.1) (edist x.2 y.2) :=
976-
rfl
977-
978974
/-- Reformulation of the uniform structure in terms of the extended distance -/
979975
theorem uniformity_edist :
980976
𝓤 γ = ⨅ ε>0, 𝓟 {p:γ×γ | edist p.1 p.2 < ε} :=
@@ -998,12 +994,6 @@ instance emetric_space_pi [∀b, emetric_space (π b)] : emetric_space (Πb, π
998994
end,
999995
..pseudo_emetric_space_pi }
1000996

1001-
lemma edist_pi_def [Π b, emetric_space (π b)] (f g : Π b, π b) :
1002-
edist f g = finset.sup univ (λb, edist (f b) (g b)) := rfl
1003-
1004-
@[simp] lemma edist_pi_const [nonempty β] (a b : α) : edist (λ x : β, a) (λ _, b) = edist a b :=
1005-
finset.sup_const univ_nonempty (edist a b)
1006-
1007997
end pi
1008998

1009999
namespace emetric

src/topology/metric_space/lipschitz.lean

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,48 +45,51 @@ variables {α : Type u} {β : Type v} {γ : Type w} {ι : Type x}
4545

4646
/-- A function `f` is Lipschitz continuous with constant `K ≥ 0` if for all `x, y`
4747
we have `dist (f x) (f y) ≤ K * dist x y` -/
48-
def lipschitz_with [emetric_space α] [emetric_space β] (K : ℝ≥0) (f : α → β) :=
48+
def lipschitz_with [pseudo_emetric_space α] [pseudo_emetric_space β] (K : ℝ≥0) (f : α → β) :=
4949
∀x y, edist (f x) (f y) ≤ K * edist x y
5050

51-
lemma lipschitz_with_iff_dist_le_mul [metric_space α] [metric_space β] {K : ℝ≥0} {f : α → β} :
52-
lipschitz_with K f ↔ ∀ x y, dist (f x) (f y) ≤ K * dist x y :=
51+
lemma lipschitz_with_iff_dist_le_mul [pseudo_metric_space α] [pseudo_metric_space β] {K : ℝ≥0}
52+
{f : α → β} : lipschitz_with K f ↔ ∀ x y, dist (f x) (f y) ≤ K * dist x y :=
5353
by { simp only [lipschitz_with, edist_nndist, dist_nndist], norm_cast }
5454

5555
alias lipschitz_with_iff_dist_le_mul ↔ lipschitz_with.dist_le_mul lipschitz_with.of_dist_le_mul
5656

5757
/-- A function `f` is Lipschitz continuous with constant `K ≥ 0` on `s` if for all `x, y` in `s`
5858
we have `dist (f x) (f y) ≤ K * dist x y` -/
59-
def lipschitz_on_with [emetric_space α] [emetric_space β] (K : ℝ≥0) (f : α → β) (s : set α) :=
59+
def lipschitz_on_with [pseudo_emetric_space α] [pseudo_emetric_space β] (K : ℝ≥0) (f : α → β)
60+
(s : set α) :=
6061
∀ ⦃x⦄ (hx : x ∈ s) ⦃y⦄ (hy : y ∈ s), edist (f x) (f y) ≤ K * edist x y
6162

62-
@[simp] lemma lipschitz_on_with_empty [emetric_space α] [emetric_space β] (K : ℝ≥0) (f : α → β) :
63-
lipschitz_on_with K f ∅ :=
63+
@[simp] lemma lipschitz_on_with_empty [pseudo_emetric_space α] [pseudo_emetric_space β] (K : ℝ≥0)
64+
(f : α → β) : lipschitz_on_with K f ∅ :=
6465
λ x x_in y y_in, false.elim x_in
6566

66-
lemma lipschitz_on_with.mono [emetric_space α] [emetric_space β] {K : ℝ≥0} {s t : set α} {f : α → β}
67-
(hf : lipschitz_on_with K f t) (h : s ⊆ t) : lipschitz_on_with K f s :=
67+
lemma lipschitz_on_with.mono [pseudo_emetric_space α] [pseudo_emetric_space β] {K : ℝ≥0}
68+
{s t : set α} {f : α → β} (hf : lipschitz_on_with K f t) (h : s ⊆ t) : lipschitz_on_with K f s :=
6869
λ x x_in y y_in, hf (h x_in) (h y_in)
6970

70-
lemma lipschitz_on_with_iff_dist_le_mul [metric_space α] [metric_space β] {K : ℝ≥0} {s : set α}
71-
{f : α → β} : lipschitz_on_with K f s ↔ ∀ (x ∈ s) (y ∈ s), dist (f x) (f y) ≤ K * dist x y :=
71+
lemma lipschitz_on_with_iff_dist_le_mul [pseudo_metric_space α] [pseudo_metric_space β] {K : ℝ≥0}
72+
{s : set α} {f : α → β} :
73+
lipschitz_on_with K f s ↔ ∀ (x ∈ s) (y ∈ s), dist (f x) (f y) ≤ K * dist x y :=
7274
by { simp only [lipschitz_on_with, edist_nndist, dist_nndist], norm_cast }
7375

7476
alias lipschitz_on_with_iff_dist_le_mul ↔
7577
lipschitz_on_with.dist_le_mul lipschitz_on_with.of_dist_le_mul
7678

77-
@[simp] lemma lipschitz_on_univ [emetric_space α] [emetric_space β] {K : ℝ≥0} {f : α → β} :
78-
lipschitz_on_with K f univ ↔ lipschitz_with K f :=
79+
@[simp] lemma lipschitz_on_univ [pseudo_emetric_space α] [pseudo_emetric_space β] {K : ℝ≥0}
80+
{f : α → β} : lipschitz_on_with K f univ ↔ lipschitz_with K f :=
7981
by simp [lipschitz_on_with, lipschitz_with]
8082

81-
lemma lipschitz_on_with_iff_restrict [emetric_space α] [emetric_space β] {K : ℝ≥0}
83+
lemma lipschitz_on_with_iff_restrict [pseudo_emetric_space α] [pseudo_emetric_space β] {K : ℝ≥0}
8284
{f : α → β} {s : set α} : lipschitz_on_with K f s ↔ lipschitz_with K (s.restrict f) :=
8385
by simp only [lipschitz_on_with, lipschitz_with, set_coe.forall', restrict, subtype.edist_eq]
8486

8587
namespace lipschitz_with
8688

8789
section emetric
8890

89-
variables [emetric_space α] [emetric_space β] [emetric_space γ] {K : ℝ≥0} {f : α → β}
91+
variables [pseudo_emetric_space α] [pseudo_emetric_space β] [pseudo_emetric_space γ]
92+
variables {K : ℝ≥0} {f : α → β}
9093

9194
lemma edist_le_mul (h : lipschitz_with K f) (x y : α) : edist (f x) (f y) ≤ K * edist x y := h x y
9295

@@ -221,7 +224,7 @@ end emetric
221224

222225
section metric
223226

224-
variables [metric_space α] [metric_space β] [metric_space γ] {K : ℝ≥0}
227+
variables [pseudo_metric_space α] [pseudo_metric_space β] [pseudo_metric_space γ] {K : ℝ≥0}
225228

226229
protected lemma of_dist_le' {f : α → β} {K : ℝ} (h : ∀ x y, dist (f x) (f y) ≤ K * dist x y) :
227230
lipschitz_with (nnreal.of_real K) f :=
@@ -296,7 +299,8 @@ end lipschitz_with
296299

297300
namespace lipschitz_on_with
298301

299-
variables [emetric_space α] [emetric_space β] [emetric_space γ] {K : ℝ≥0} {s : set α} {f : α → β}
302+
variables [pseudo_emetric_space α] [pseudo_emetric_space β] [pseudo_emetric_space γ]
303+
variables {K : ℝ≥0} {s : set α} {f : α → β}
300304

301305
protected lemma uniform_continuous_on (hf : lipschitz_on_with K f s) : uniform_continuous_on f s :=
302306
uniform_continuous_on_iff_restrict.mpr (lipschitz_on_with_iff_restrict.mp hf).uniform_continuous

0 commit comments

Comments
 (0)