Skip to content

Commit 9e5ed18

Browse files
committed
feat(UniformSpace/Cauchy): add lemmas about TotallyBounded (#13451)
1 parent 30dcbcc commit 9e5ed18

File tree

5 files changed

+96
-26
lines changed

5 files changed

+96
-26
lines changed

Mathlib/Data/Set/Finite.lean

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,6 +1038,13 @@ theorem Finite.finite_subsets {α : Type u} {a : Set α} (h : a.Finite) : { b |
10381038
protected theorem Finite.powerset {s : Set α} (h : s.Finite) : (𝒫 s).Finite :=
10391039
h.finite_subsets
10401040

1041+
theorem exists_subset_image_finite_and {f : α → β} {s : Set α} {p : Set β → Prop} :
1042+
(∃ t ⊆ f '' s, t.Finite ∧ p t) ↔ ∃ t ⊆ s, t.Finite ∧ p (f '' t) := by
1043+
classical
1044+
simp_rw [@and_comm (_ ⊆ _), and_assoc, exists_finite_iff_finset, @and_comm (p _),
1045+
Finset.subset_image_iff]
1046+
aesop
1047+
10411048
section Pi
10421049
variable {ι : Type*} [Finite ι] {κ : ι → Type*} {t : ∀ i, Set (κ i)}
10431050

Mathlib/Topology/Instances/Rat.lean

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,9 @@ instance : TopologicalRing ℚ := inferInstance
113113
#align rat.continuous_mul continuous_mul
114114

115115
nonrec theorem totallyBounded_Icc (a b : ℚ) : TotallyBounded (Icc a b) := by
116-
simpa only [preimage_cast_Icc] using
117-
totallyBounded_preimage Rat.uniformEmbedding_coe_real (totallyBounded_Icc (a : ℝ) b)
116+
simpa only [preimage_cast_Icc]
117+
using totallyBounded_preimage Rat.uniformEmbedding_coe_real.toUniformInducing
118+
(totallyBounded_Icc (a : ℝ) b)
118119
#align rat.totally_bounded_Icc Rat.totallyBounded_Icc
119120

120121
end Rat

Mathlib/Topology/MetricSpace/Bounded.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,15 +339,15 @@ theorem _root_.totallyBounded_Icc (a b : α) : TotallyBounded (Icc a b) :=
339339
#align totally_bounded_Icc totallyBounded_Icc
340340

341341
theorem _root_.totallyBounded_Ico (a b : α) : TotallyBounded (Ico a b) :=
342-
totallyBounded_subset Ico_subset_Icc_self (totallyBounded_Icc a b)
342+
(totallyBounded_Icc a b).subset Ico_subset_Icc_self
343343
#align totally_bounded_Ico totallyBounded_Ico
344344

345345
theorem _root_.totallyBounded_Ioc (a b : α) : TotallyBounded (Ioc a b) :=
346-
totallyBounded_subset Ioc_subset_Icc_self (totallyBounded_Icc a b)
346+
(totallyBounded_Icc a b).subset Ioc_subset_Icc_self
347347
#align totally_bounded_Ioc totallyBounded_Ioc
348348

349349
theorem _root_.totallyBounded_Ioo (a b : α) : TotallyBounded (Ioo a b) :=
350-
totallyBounded_subset Ioo_subset_Icc_self (totallyBounded_Icc a b)
350+
(totallyBounded_Icc a b).subset Ioo_subset_Icc_self
351351
#align totally_bounded_Ioo totallyBounded_Ioo
352352

353353
theorem isBounded_Icc (a b : α) : IsBounded (Icc a b) :=

Mathlib/Topology/UniformSpace/Cauchy.lean

Lines changed: 71 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -533,9 +533,7 @@ theorem TotallyBounded.exists_subset {s : Set α} (hs : TotallyBounded s) {U : S
533533
theorem totallyBounded_iff_subset {s : Set α} :
534534
TotallyBounded s ↔
535535
∀ d ∈ 𝓤 α, ∃ t, t ⊆ s ∧ Set.Finite t ∧ s ⊆ ⋃ y ∈ t, { x | (x, y) ∈ d } :=
536-
fun H _ hd => H.exists_subset hd, fun H d hd =>
537-
let ⟨t, _, ht⟩ := H d hd
538-
⟨t, ht⟩⟩
536+
fun H _ hd ↦ H.exists_subset hd, fun H d hd ↦ let ⟨t, _, ht⟩ := H d hd; ⟨t, ht⟩⟩
539537
#align totally_bounded_iff_subset totallyBounded_iff_subset
540538

541539
theorem Filter.HasBasis.totallyBounded_iff {ι} {p : ι → Prop} {U : ι → Set (α × α)}
@@ -552,15 +550,14 @@ theorem totallyBounded_of_forall_symm {s : Set α}
552550
simpa only [ball_eq_of_symmetry hV.2] using h V hV.1 hV.2
553551
#align totally_bounded_of_forall_symm totallyBounded_of_forall_symm
554552

555-
theorem totallyBounded_subset {s₁ s₂ : Set α} (hs : s₁ ⊆ s₂) (h : TotallyBounded s₂) :
553+
theorem TotallyBounded.subset {s₁ s₂ : Set α} (hs : s₁ ⊆ s₂) (h : TotallyBounded s₂) :
556554
TotallyBounded s₁ := fun d hd =>
557555
let ⟨t, ht₁, ht₂⟩ := h d hd
558556
⟨t, ht₁, Subset.trans hs ht₂⟩
559-
#align totally_bounded_subset totallyBounded_subset
557+
#align totally_bounded_subset TotallyBounded.subset
560558

561-
theorem totallyBounded_empty : TotallyBounded (∅ : Set α) := fun _ _ =>
562-
⟨∅, finite_empty, empty_subset _⟩
563-
#align totally_bounded_empty totallyBounded_empty
559+
@[deprecated (since := "2024-06-01")]
560+
alias totallyBounded_subset := TotallyBounded.subset
564561

565562
/-- The closure of a totally bounded set is totally bounded. -/
566563
theorem TotallyBounded.closure {s : Set α} (h : TotallyBounded s) : TotallyBounded (closure s) :=
@@ -571,6 +568,70 @@ theorem TotallyBounded.closure {s : Set α} (h : TotallyBounded s) : TotallyBoun
571568
htf.isClosed_biUnion fun _ _ => hV.2.preimage (continuous_id.prod_mk continuous_const)⟩
572569
#align totally_bounded.closure TotallyBounded.closure
573570

571+
@[simp]
572+
lemma totallyBounded_closure {s : Set α} : TotallyBounded (closure s) ↔ TotallyBounded s :=
573+
fun h ↦ h.subset subset_closure, TotallyBounded.closure⟩
574+
575+
/-- A finite indexed union is totally bounded
576+
if and only if each set of the family is totally bounded. -/
577+
@[simp]
578+
lemma totallyBounded_iUnion {ι : Sort*} [Finite ι] {s : ι → Set α} :
579+
TotallyBounded (⋃ i, s i) ↔ ∀ i, TotallyBounded (s i) := by
580+
refine ⟨fun h i ↦ h.subset (subset_iUnion _ _), fun h U hU ↦ ?_⟩
581+
choose t htf ht using (h · U hU)
582+
refine ⟨⋃ i, t i, finite_iUnion htf, ?_⟩
583+
rw [biUnion_iUnion]
584+
gcongr; apply ht
585+
586+
/-- A union indexed by a finite set is totally bounded
587+
if and only if each set of the family is totally bounded. -/
588+
lemma totallyBounded_biUnion {ι : Type*} {I : Set ι} (hI : I.Finite) {s : ι → Set α} :
589+
TotallyBounded (⋃ i ∈ I, s i) ↔ ∀ i ∈ I, TotallyBounded (s i) := by
590+
have := hI.to_subtype
591+
rw [biUnion_eq_iUnion, totallyBounded_iUnion, Subtype.forall]
592+
593+
/-- A union of a finite family of sets is totally bounded
594+
if and only if each set of the family is totally bounded. -/
595+
lemma totallyBounded_sUnion {S : Set (Set α)} (hS : S.Finite) :
596+
TotallyBounded (⋃₀ S) ↔ ∀ s ∈ S, TotallyBounded s := by
597+
rw [sUnion_eq_biUnion, totallyBounded_biUnion hS]
598+
599+
/-- A finite set is totally bounded. -/
600+
lemma Set.Finite.totallyBounded {s : Set α} (hs : s.Finite) : TotallyBounded s := fun _U hU ↦
601+
⟨s, hs, fun _x hx ↦ mem_biUnion hx <| refl_mem_uniformity hU⟩
602+
603+
/-- A subsingleton is totally bounded. -/
604+
lemma Set.Subsingleton.totallyBounded {s : Set α} (hs : s.Subsingleton) :
605+
TotallyBounded s :=
606+
hs.finite.totallyBounded
607+
608+
@[simp]
609+
lemma totallyBounded_singleton (a : α) : TotallyBounded {a} := (finite_singleton a).totallyBounded
610+
611+
@[simp]
612+
theorem totallyBounded_empty : TotallyBounded (∅ : Set α) := finite_empty.totallyBounded
613+
#align totally_bounded_empty totallyBounded_empty
614+
615+
/-- The union of two sets is totally bounded
616+
if and only if each of the two sets is totally bounded.-/
617+
@[simp]
618+
lemma totallyBounded_union {s t : Set α} :
619+
TotallyBounded (s ∪ t) ↔ TotallyBounded s ∧ TotallyBounded t := by
620+
rw [union_eq_iUnion, totallyBounded_iUnion]
621+
simp [and_comm]
622+
623+
/-- The union of two totally bounded sets is totally bounded. -/
624+
protected lemma TotallyBounded.union {s t : Set α} (hs : TotallyBounded s) (ht : TotallyBounded t) :
625+
TotallyBounded (s ∪ t) :=
626+
totallyBounded_union.2 ⟨hs, ht⟩
627+
628+
@[simp]
629+
lemma totallyBounded_insert (a : α) {s : Set α} :
630+
TotallyBounded (insert a s) ↔ TotallyBounded s := by
631+
simp_rw [← singleton_union, totallyBounded_union, totallyBounded_singleton, true_and]
632+
633+
protected alias ⟨_, TotallyBounded.insert⟩ := totallyBounded_insert
634+
574635
/-- The image of a totally bounded set under a uniformly continuous map is totally bounded. -/
575636
theorem TotallyBounded.image [UniformSpace β] {f : α → β} {s : Set α} (hs : TotallyBounded s)
576637
(hf : UniformContinuous f) : TotallyBounded (f '' s) := fun t ht =>
@@ -662,9 +723,9 @@ theorem isCompact_of_totallyBounded_isClosed [CompleteSpace α] {s : Set α} (ht
662723
/-- Every Cauchy sequence over `ℕ` is totally bounded. -/
663724
theorem CauchySeq.totallyBounded_range {s : ℕ → α} (hs : CauchySeq s) :
664725
TotallyBounded (range s) := by
665-
refine totallyBounded_iff_subset.2 fun a ha => ?_
726+
intro a ha
666727
cases' cauchySeq_iff.1 hs a ha with n hn
667-
refine ⟨s '' { k | k ≤ n }, image_subset_range _ _, (finite_le_nat _).image _, ?_⟩
728+
refine ⟨s '' { k | k ≤ n }, (finite_le_nat _).image _, ?_⟩
668729
rw [range_subset_iff, biUnion_image]
669730
intro m
670731
rw [mem_iUnion₂]

Mathlib/Topology/UniformSpace/UniformEmbedding.lean

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -397,17 +397,18 @@ theorem completeSpace_extension {m : β → α} (hm : UniformInducing m) (dense
397397
⟩⟩
398398
#align complete_space_extension completeSpace_extension
399399

400-
theorem totallyBounded_preimage {f : α → β} {s : Set β} (hf : UniformEmbedding f)
401-
(hs : TotallyBounded s) : TotallyBounded (f ⁻¹' s) := fun t ht => by
402-
rw [← hf.comap_uniformity] at ht
403-
rcases mem_comap.2 ht with ⟨t', ht', ts⟩
404-
rcases totallyBounded_iff_subset.1 (totallyBounded_subset (image_preimage_subset f s) hs) _ ht'
405-
with ⟨c, cs, hfc, hct⟩
406-
refine ⟨f ⁻¹' c, hfc.preimage hf.inj.injOn, fun x h => ?_⟩
407-
have := hct (mem_image_of_mem f h); simp at this ⊢
408-
rcases this with ⟨z, zc, zt⟩
409-
rcases cs zc with ⟨y, -, rfl⟩
410-
exact ⟨y, zc, ts zt⟩
400+
lemma totallyBounded_image_iff {f : α → β} {s : Set α} (hf : UniformInducing f) :
401+
TotallyBounded (f '' s) ↔ TotallyBounded s := by
402+
refine ⟨fun hs ↦ ?_, fun h ↦ h.image hf.uniformContinuous⟩
403+
simp_rw [(hf.basis_uniformity (basis_sets _)).totallyBounded_iff]
404+
intro t ht
405+
rcases exists_subset_image_finite_and.1 (hs.exists_subset ht) with ⟨u, -, hfin, h⟩
406+
use u, hfin
407+
rwa [biUnion_image, image_subset_iff, preimage_iUnion₂] at h
408+
409+
theorem totallyBounded_preimage {f : α → β} {s : Set β} (hf : UniformInducing f)
410+
(hs : TotallyBounded s) : TotallyBounded (f ⁻¹' s) :=
411+
(totallyBounded_image_iff hf).1 <| hs.subset <| image_preimage_subset ..
411412
#align totally_bounded_preimage totallyBounded_preimage
412413

413414
instance CompleteSpace.sum [CompleteSpace α] [CompleteSpace β] : CompleteSpace (Sum α β) := by

0 commit comments

Comments
 (0)