Skip to content

Commit 7b8912d

Browse files
committed
Completeness of uniform space
1 parent 85e9583 commit 7b8912d

1 file changed

Lines changed: 224 additions & 28 deletions

File tree

Munkres/Explore/Bilipschitz.lean

Lines changed: 224 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ open Set Filter Topology
88

99
universe u v
1010

11-
variable {α : Type u} {β : Type v} [M : MetricSpace α] {x y z : α}
11+
variable {X : Type u} {β : Type v} [M : MetricSpace X] {x y z : X}
1212

13-
private def B (M : MetricSpace α) := @Metric.ball α M.toPseudoMetricSpace
13+
private def B (M : MetricSpace X) := @Metric.ball X M.toPseudoMetricSpace
1414

15-
private def d (x y : α) := M.dist x y
15+
private def d (x y : X) := M.dist x y
1616
private noncomputable def f (t : ℝ) : ℝ := t / (1 + t)
17-
private noncomputable def ρ (x y : α) : ℝ := f (d x y)
17+
private noncomputable def ρ (x y : X) : ℝ := f (d x y)
1818

19-
private lemma hd₁ {x y : α} : 0 < 1 + dist x y := add_pos_of_pos_of_nonneg zero_lt_one dist_nonneg
19+
private lemma hd₁ {x y : X} : 0 < 1 + dist x y := add_pos_of_pos_of_nonneg zero_lt_one dist_nonneg
2020

2121
private lemma hf : MonotoneOn f (Ici 0)
2222
:= by --
@@ -28,12 +28,18 @@ private lemma hf : MonotoneOn f (Ici 0)
2828
refine add_le_add hab ?_
2929
rw [mul_comm] -- ∎
3030

31+
private lemma hf₁ {t : ℝ} (ht : 0 ≤ t) : f t ≤ 1
32+
:= by --
33+
dsimp only [f]
34+
have : 0 < 1 + t := by
35+
refine zero_lt_one.trans_le ?_
36+
exact (le_add_iff_nonneg_right 1).mpr ht
37+
rw [div_le_one this, le_add_iff_nonneg_left]
38+
exact zero_le_one -- ∎
39+
3140
-- ρ = d / (1 + d) is a metric.
32-
private noncomputable def M' (α : Type u) [MetricSpace α] : MetricSpace α
41+
private noncomputable def M' (X : Type u) [MetricSpace X] : MetricSpace X
3342
:= by --
34-
-- have hd₁ (x y : α) : 0 < 1 + d x y := by
35-
-- refine zero_lt_one.trans_le ?_
36-
-- exact (le_add_iff_nonneg_right 1).mpr dist_nonneg
3743
exact {
3844
dist := ρ
3945
dist_comm x y := by dsimp only [ρ, d]; rw [dist_comm]
@@ -63,11 +69,18 @@ private noncomputable def M' (α : Type u) [MetricSpace α] : MetricSpace α
6369
exact (le_add_iff_nonneg_left _).mpr dist_nonneg
6470
} -- ∎
6571
private noncomputable def P := M.toPseudoMetricSpace
66-
private noncomputable def P' := (M' α).toPseudoMetricSpace
72+
private noncomputable def P' (X : Type u) [MetricSpace X] := (M' X).toPseudoMetricSpace
73+
private noncomputable def P₁ := (M' X).toPseudoMetricSpace
6774
private noncomputable def U := M.toPseudoMetricSpace.toUniformSpace
68-
private noncomputable def U' := (M' α).toPseudoMetricSpace.toUniformSpace
75+
private noncomputable def U' (X : Type u) [MetricSpace X] :=
76+
(M' X).toPseudoMetricSpace.toUniformSpace
77+
private noncomputable def U₁ := (M' X).toPseudoMetricSpace.toUniformSpace
6978
private noncomputable def T := M.toPseudoMetricSpace.toUniformSpace.toTopologicalSpace
70-
private noncomputable def T' := (M' α).toPseudoMetricSpace.toUniformSpace.toTopologicalSpace
79+
private noncomputable def T' (X : Type u) [MetricSpace X] :=
80+
(M' X).toPseudoMetricSpace.toUniformSpace.toTopologicalSpace
81+
private noncomputable def T₁ := (M' X).toPseudoMetricSpace.toUniformSpace.toTopologicalSpace
82+
83+
private lemma ρ_eq : ρ = (M' X).dist := rfl
7184

7285
private lemma ρ_le_d : ρ x y ≤ d x y
7386
:= by --
@@ -96,7 +109,7 @@ private lemma d_le_ρ' (hle : ρ x y ≤ 1 / 2) : d x y ≤ 2 * ρ x y
96109
rw [add_le_add_iff_right (d x y)] at h
97110
exact d_le_ρ h -- ∎
98111

99-
private theorem t₁ {ε : ℝ} (hε : ε ≤ 1) : B (M' α) x (ε / 2) ⊆ B M x ε
112+
private theorem t₁ {ε : ℝ} (hε : ε ≤ 1) : B (M' X) x (ε / 2) ⊆ B M x ε
100113
:= by --
101114
intro y (hy : ρ y x < ε / 2)
102115
-- change d y x < ε
@@ -107,19 +120,19 @@ private theorem t₁ {ε : ℝ} (hε : ε ≤ 1) : B (M' α) x (ε / 2) ⊆ B M
107120
refine hy.le.trans ?_
108121
exact div_le_div_of_nonneg_right hε zero_le_two -- ∎
109122

110-
private theorem t₂ {ε : ℝ} : B M x ε ⊆ B (M' α) x ε
123+
private theorem t₂ {ε : ℝ} : B M x ε ⊆ B (M' X) x ε
111124
:= by --
112125
intro y (hy : d y x < ε)
113126
-- change ρ y x < ε
114127
exact ρ_le_d.trans_lt hy -- ∎
115128

116129
private def MetricSpace.CauchySeq (M : MetricSpace β) (f : ℕ → β) := _root_.CauchySeq f
117130

118-
private theorem cauchy_iff₀ (f : ℕ → α) : M.CauchySeq f ↔ (M' α).CauchySeq f
131+
private theorem cauchy_iff₀ (f : ℕ → X) : M.CauchySeq f ↔ (M' X).CauchySeq f
119132
:= by --
120133
simp only [MetricSpace.CauchySeq]
121134
rw [Metric.cauchySeq_iff']
122-
rw [@Metric.cauchySeq_iff' αP']
135+
rw [@Metric.cauchySeq_iff' X(P' X)]
123136
change (∀ ε > 0, ∃ N, ∀ n ≥ N, d (f n) (f N) < ε) ↔ ∀ ε > 0, ∃ N, ∀ n ≥ N, ρ (f n) (f N) < ε
124137
constructor
125138
· intro h ε hε
@@ -147,11 +160,11 @@ private theorem cauchy_iff₀ (f : ℕ → α) : M.CauchySeq f ↔ (M' α).Cauch
147160
refine div_lt_div_of_pos_left hε' zero_lt_two ?_
148161
norm_num -- ∎
149162

150-
private theorem t_eq : T (α := α) = T'
163+
private theorem t_eq : T = T' X
151164
:= by --
152165
refine TopologicalSpace.ext ?_
153166
ext U : 2
154-
rw [@Metric.isOpen_iff α P, @Metric.isOpen_iff α P']
167+
rw [@Metric.isOpen_iff X P, @Metric.isOpen_iff X (P' X)]
155168
constructor
156169
· intro h x hxU
157170
specialize h x hxU
@@ -179,18 +192,18 @@ private theorem t_eq : T (α := α) = T'
179192
intro y hy
180193
exact ρ_le_d.trans_lt hy -- ∎
181194

182-
private lemma c₁ : @CompleteSpace α U → @CompleteSpace α U'
195+
private lemma c₁ : @CompleteSpace X U → @CompleteSpace X (U' X)
183196
:= by --
184197
intro h
185-
rw [@Munkres.Metric.CompleteSpace_iff α M] at h
186-
rw [@Munkres.Metric.CompleteSpace_iff α (M' α)]
187-
intro f (hf : (M' α).CauchySeq f)
198+
rw [@Munkres.Metric.CompleteSpace_iff X M] at h
199+
rw [@Munkres.Metric.CompleteSpace_iff X (M' X)]
200+
intro f (hf : (M' X).CauchySeq f)
188201
rw [<-cauchy_iff₀ f] at hf
189202
specialize h f hf
190203
obtain ⟨x, h⟩ := h
191204
refine ⟨x, ?_⟩
192205
rw [Metric.tendsto_atTop] at h
193-
rw [@Metric.tendsto_atTop αP']
206+
rw [@Metric.tendsto_atTop X(P' X)]
194207
intro ε hε
195208
specialize h ε hε
196209
obtain ⟨N, h⟩ := h
@@ -201,18 +214,18 @@ private lemma c₁ : @CompleteSpace α U → @CompleteSpace α U'
201214
refine ρ_le_d.trans_lt ?_
202215
exact h -- ∎
203216

204-
private lemma c₂ : @CompleteSpace α U' → @CompleteSpace α U
217+
private lemma c₂ : @CompleteSpace X (U' X) → @CompleteSpace X U
205218
:= by --
206219
intro h
207-
rw [@Munkres.Metric.CompleteSpace_iff α (M' α)] at h
208-
rw [@Munkres.Metric.CompleteSpace_iff α M]
220+
rw [@Munkres.Metric.CompleteSpace_iff X (M' X)] at h
221+
rw [@Munkres.Metric.CompleteSpace_iff X M]
209222
intro f (hf : M.CauchySeq f)
210223
rw [cauchy_iff₀ f] at hf
211224
specialize h f hf
212225
obtain ⟨x, h⟩ := h
213226
refine ⟨x, ?_⟩
214227
rw [Metric.tendsto_atTop]
215-
rw [@Metric.tendsto_atTop αP'] at h
228+
rw [@Metric.tendsto_atTop X(P' X)] at h
216229
change ∀ ε > 0, ∃ N, ∀ n ≥ N, ρ (f n) x < ε at h
217230
intro ε' hε'
218231
let ε := min (1 / 2) (ε' / 2)
@@ -230,4 +243,187 @@ private lemma c₂ : @CompleteSpace α U' → @CompleteSpace α U
230243
refine (le_mul_inv_iff₀' zero_lt_two).mp ?_
231244
exact min_le_right _ _ -- ∎
232245

233-
example : @CompleteSpace α U ↔ @CompleteSpace α U' := ⟨c₁, c₂⟩
246+
example : @CompleteSpace X U ↔ @CompleteSpace X (U' X) := ⟨c₁, c₂⟩
247+
248+
variable {Λ : Type v} {x y : Λ → X}
249+
250+
/-- ρ-bar. -/
251+
private noncomputable def b (x y : Λ → X) : ℝ := sSup { ρ (x α) (y α) | α : Λ }
252+
253+
private def subsingleton_ms : Subsingleton Λ → MetricSpace Λ
254+
:= by --
255+
intro h
256+
exact {
257+
dist := 0
258+
dist_self x := rfl
259+
dist_comm x y := rfl
260+
dist_triangle x y z := by
261+
simp only [Pi.zero_apply, add_zero]
262+
exact le_rfl
263+
eq_of_dist_eq_zero {x y} _ := h.allEq x y
264+
} -- ∎
265+
266+
267+
private theorem hρ₁ : 1 ∈ upperBounds { ρ (x α) (y α) | α : Λ }
268+
:= by --
269+
intro d ⟨α, heq⟩
270+
subst heq
271+
exact hf₁ dist_nonneg -- ∎
272+
273+
private theorem ρ_bdd_above : BddAbove { ρ (x α) (y α) | α : Λ }
274+
:= by --
275+
exact ⟨1, hρ₁⟩ -- ∎
276+
277+
theorem sSup_le_add {A B : Set ℝ}
278+
(hA₀ : A.Nonempty) (hB₀ : B.Nonempty)
279+
(hA : BddAbove A) (hB : BddAbove B)
280+
: sSup { a + b | (a ∈ A) (b ∈ B) } ≤ sSup A + sSup B
281+
:= by --
282+
refine csSup_le ?_ ?_
283+
· obtain ⟨a, ha⟩ := hA₀
284+
obtain ⟨b, hb⟩ := hB₀
285+
exact ⟨a + b, a, ha, b, hb, rfl⟩
286+
· intro v ⟨a, ha, b, hb, heq⟩
287+
subst heq
288+
refine add_le_add ?_ ?_
289+
· exact le_csSup hA ha
290+
· exact le_csSup hB hb -- ∎
291+
292+
private noncomputable def M₂ (Λ : Type v) (X : Type u) [MetricSpace X] : MetricSpace (Λ → X)
293+
:= by --
294+
exact {
295+
dist := b
296+
dist_comm x y := by
297+
dsimp only [b]
298+
simp only [ρ_eq, (M' X).dist_comm]
299+
dist_self x := by
300+
dsimp only [b]
301+
simp only [ρ_eq, (M' X).dist_self]
302+
if h₀ : IsEmpty Λ then
303+
simp only [IsEmpty.exists_iff, setOf_false, Real.sSup_empty]
304+
else
305+
replace h₀ : Nonempty Λ := not_isEmpty_iff.mp h₀
306+
refine le_antisymm ?_ ?_
307+
· refine csSup_le ?_ ?_
308+
· exact ⟨0, h₀.some, rfl⟩
309+
· intro b ⟨_, hb⟩
310+
exact hb.ge
311+
· refine le_csSup ?_ ?_
312+
· refine ⟨1, ?_⟩
313+
intro x ⟨_, hx⟩
314+
subst hx
315+
exact zero_le_one
316+
· exact ⟨h₀.some, rfl⟩
317+
eq_of_dist_eq_zero {x y} heq := by
318+
dsimp only [b] at heq
319+
funext α
320+
refine (M' X).eq_of_dist_eq_zero ?_
321+
refine le_antisymm ?_ (@dist_nonneg _ P₁ _ _)
322+
rw [<-heq]
323+
exact le_csSup ⟨1, hρ₁⟩ ⟨α, rfl⟩
324+
dist_triangle x y z := by
325+
if h₀ : IsEmpty Λ then
326+
dsimp only [b]
327+
simp only [IsEmpty.exists_iff, setOf_false, Real.sSup_empty, add_zero, le_refl]
328+
else
329+
replace h₀ : Nonempty Λ := not_isEmpty_iff.mp h₀
330+
let ζ (x y : Λ → X) := { ρ (x α) (y α) | α }
331+
change sSup (ζ x z) ≤ sSup (ζ x y) + sSup (ζ y z)
332+
let α := h₀.some
333+
have h₀ (x y : Λ → X) : (ζ x y).Nonempty := ⟨ρ (x α) (y α), α, rfl⟩
334+
have := sSup_le_add (A := ζ x y) (B := ζ y z) (h₀ x y) (h₀ y z) ⟨1, hρ₁⟩ ⟨1, hρ₁⟩
335+
refine this.trans' ?_
336+
refine csSup_le (h₀ x z) ?_
337+
intro v ⟨α, heq⟩
338+
subst heq
339+
have : ρ (x α) (z α) ≤ ρ (x α) (y α) + ρ (y α) (z α) := @dist_triangle _ P₁ (x α) (y α) (z α)
340+
refine this.trans ?_
341+
refine le_csSup ?_ ?_
342+
· refine ⟨2, ?_⟩
343+
intro v ⟨a, ha, b, hb, heq⟩
344+
subst heq
345+
rw [<-one_add_one_eq_two]
346+
exact add_le_add (hρ₁ ha) (hρ₁ hb)
347+
· refine ⟨ρ (x α) (y α), ?_, ρ (y α) (z α), ?_, rfl⟩
348+
· exact ⟨α, rfl⟩
349+
· exact ⟨α, rfl⟩
350+
} -- ∎
351+
private noncomputable def P₂ := (M₂ Λ X).toPseudoMetricSpace
352+
private noncomputable def U₂ := (M₂ Λ X).toPseudoMetricSpace.toUniformSpace
353+
private noncomputable def T₂ := (M₂ Λ X).toPseudoMetricSpace.toUniformSpace.toTopologicalSpace
354+
355+
private lemma b_eq : b = (M₂ Λ X).dist := rfl
356+
357+
private lemma c₃ : @CompleteSpace X (U' X) → @CompleteSpace (Λ → X) U₂
358+
:= by --
359+
intro h
360+
-- Handle the trivial case so that we have `Nonempty Λ` for csSup_le later
361+
if h₀ : IsEmpty Λ then
362+
have h₁ : Subsingleton (Λ → X) := Unique.instSubsingleton
363+
have h₀ : Nonempty (Λ → X) := instNonemptyOfInhabited
364+
rw [@Munkres.Metric.CompleteSpace_iff _ (M₂ Λ X)]
365+
intro f hf
366+
use h₀.some
367+
rw [nhds_discrete, tendsto_pure, eventually_atTop]
368+
use 0
369+
intro _ _
370+
exact h₁.allEq _ _
371+
else
372+
have h₀ : Nonempty Λ := not_isEmpty_iff.mp h₀
373+
rw [@Munkres.Metric.CompleteSpace_iff X (M' X)] at h
374+
rw [@Munkres.Metric.CompleteSpace_iff _ (M₂ Λ X)]
375+
intro f hf
376+
-- Fixing α, each fₙ(α) is a Cauchy Sequence.
377+
have hc (α : Λ) : @CauchySeq _ _ U₁ _ (fun n ↦ f n α) := by
378+
rw [@Metric.cauchySeq_iff' _ _ P₁]
379+
rw [@Metric.cauchySeq_iff'] at hf
380+
intro ε hε
381+
specialize hf ε hε
382+
obtain ⟨N, hf⟩ := hf
383+
use N
384+
intro n hn
385+
specialize hf n hn
386+
exact (le_csSup ⟨1, hρ₁⟩ ⟨α, rfl⟩).trans_lt hf
387+
-- So for each α, fₙ(α) converges to a point in X. Consolidate all these
388+
-- points into a function. This will be the limit.
389+
let y (α : Λ) : X := (h (f · α) (hc α)).choose
390+
use y
391+
rw [@Metric.tendsto_atTop]
392+
rw [@Metric.cauchySeq_iff] at hf
393+
394+
-- We have to choose the first N. At this point we obly have that fₙ is Cauchy.
395+
-- Use that first.
396+
intro E hE
397+
obtain ⟨ε, hε, hεE⟩ := exists_between hE
398+
specialize hf (ε / 2) (half_pos hε)
399+
obtain ⟨N, hf : ∀ m ≥ N, ∀ n ≥ N, b (f m) (f n) < ε / 2⟩ := hf
400+
use N
401+
intro n hn -- Fix the `n` first. We'll use the `m` next, right away.
402+
403+
-- Use the supremum-ness of b (ρ-bar) to trickle down to a "∀ α" situation.
404+
have h₂ (α : Λ) : ∀ m ≥ N, ρ (f n α) (f m α) < ε / 2 := by
405+
intro m hm
406+
specialize hf n hn m hm
407+
exact (le_csSup ⟨1, hρ₁⟩ ⟨α, rfl⟩).trans_lt hf
408+
409+
-- so now, we have that for all α ∈ Λ, ρ(fₙ(α),fₘ(α)) < ε / 2, and we can
410+
-- obtain ρ(fₘ(α),f(α)) < ε / 2 from the fact that fₘ(α) → f(α) as m → ∞.
411+
412+
refine hεE.trans_le' ?_
413+
refine csSup_le ?_ ?_
414+
· let α := h₀.some -- here we use the Nonempty Λ we secured way early on.
415+
exact ⟨ρ (f n α) (y α), α, rfl⟩ -- csSup_le is happy.
416+
· intro v ⟨α, heq⟩
417+
subst heq
418+
have htt : Tendsto (f · α) atTop (@nhds _ T₁ (y α)) := (h (f · α) (hc α)).choose_spec
419+
rw [@Metric.tendsto_atTop _ _ P₁] at htt
420+
specialize h₂ α
421+
specialize htt (ε / 2) (half_pos hε)
422+
obtain ⟨N', htt : ∀ n ≥ N', ρ (f n α) (y α) < ε / 2⟩ := htt
423+
let M := max N N'
424+
specialize h₂ M (le_max_left _ _)
425+
specialize htt M (le_max_right _ _)
426+
rw [ρ_eq]
427+
refine (@dist_triangle _ P₁ (f n α) (f M α) (y α)).trans ?_
428+
rw [<-add_halves ε]
429+
exact add_le_add h₂.le htt.le -- ∎

0 commit comments

Comments
 (0)