Skip to content

Commit 737069e

Browse files
committed
feat(Topology/Sets): Singleton instances for (Nonempty)Compacts (#31035)
1 parent e29df49 commit 737069e

File tree

1 file changed

+39
-3
lines changed

1 file changed

+39
-3
lines changed

Mathlib/Topology/Sets/Compacts.lean

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,14 @@ theorem coe_finset_sup {ι : Type*} {s : Finset ι} {f : ι → Compacts α} :
117117
simp_rw [Finset.sup_cons, coe_sup, sup_eq_union]
118118
congr
119119

120+
@[simps]
121+
instance : Singleton α (Compacts α) where
122+
singleton x := ⟨{x}, isCompact_singleton⟩
123+
124+
@[simp]
125+
theorem mem_singleton (x y : α) : x ∈ ({y} : Compacts α) ↔ x = y :=
126+
Iff.rfl
127+
120128
/-- The image of a compact set under a continuous function. -/
121129
protected def map (f : α → β) (hf : Continuous f) (K : Compacts α) : Compacts β :=
122130
⟨f '' K.1, K.2.image hf⟩
@@ -133,6 +141,10 @@ theorem map_comp (f : β → γ) (g : α → β) (hf : Continuous f) (hg : Conti
133141
K.map (f ∘ g) (hf.comp hg) = (K.map g hg).map f hf :=
134142
Compacts.ext <| Set.image_comp _ _ _
135143

144+
@[simp]
145+
theorem map_singleton {f : α → β} (hf : Continuous f) (x : α) : Compacts.map f hf {x} = {f x} :=
146+
Compacts.ext Set.image_singleton
147+
136148
/-- A homeomorphism induces an equivalence on compact sets, by taking the image. -/
137149
@[simps]
138150
protected def equiv (f : α ≃ₜ β) : Compacts α ≃ Compacts β where
@@ -174,6 +186,11 @@ theorem coe_prod (K : Compacts α) (L : Compacts β) :
174186
(K.prod L : Set (α × β)) = (K : Set α) ×ˢ (L : Set β) :=
175187
rfl
176188

189+
@[simp]
190+
theorem singleton_prod_singleton (x : α) (y : β) :
191+
Compacts.prod {x} {y} = {(x, y)} :=
192+
Compacts.ext Set.singleton_prod_singleton
193+
177194
-- todo: add `pi`
178195

179196
end Compacts
@@ -242,12 +259,26 @@ theorem coe_sup (s t : NonemptyCompacts α) : (↑(s ⊔ t) : Set α) = ↑s ∪
242259
theorem coe_top [CompactSpace α] [Nonempty α] : (↑(⊤ : NonemptyCompacts α) : Set α) = univ :=
243260
rfl
244261

262+
@[simps!]
263+
instance : Singleton α (NonemptyCompacts α) where
264+
singleton x := ⟨{x}, singleton_nonempty x⟩
265+
266+
@[simp]
267+
theorem mem_singleton (x y : α) : x ∈ ({y} : NonemptyCompacts α) ↔ x = y :=
268+
Iff.rfl
269+
270+
@[simp]
271+
theorem toCompacts_singleton (x : α) : toCompacts {x} = {x} :=
272+
rfl
273+
274+
@[simp]
275+
theorem toCloseds_singleton [T2Space α] (x : α) : toCloseds {x} = Closeds.singleton x :=
276+
rfl
277+
245278
/-- In an inhabited space, the type of nonempty compact subsets is also inhabited, with
246279
default element the singleton set containing the default element. -/
247280
instance [Inhabited α] : Inhabited (NonemptyCompacts α) :=
248-
⟨{ carrier := {default}
249-
isCompact' := isCompact_singleton
250-
nonempty' := singleton_nonempty _ }⟩
281+
⟨{default}⟩
251282

252283
instance toCompactSpace {s : NonemptyCompacts α} : CompactSpace s :=
253284
isCompact_iff_compactSpace.1 s.isCompact
@@ -265,6 +296,11 @@ theorem coe_prod (K : NonemptyCompacts α) (L : NonemptyCompacts β) :
265296
(K.prod L : Set (α × β)) = (K : Set α) ×ˢ (L : Set β) :=
266297
rfl
267298

299+
@[simp]
300+
theorem singleton_prod_singleton (x : α) (y : β) :
301+
NonemptyCompacts.prod {x} {y} = {(x, y)} :=
302+
NonemptyCompacts.ext Set.singleton_prod_singleton
303+
268304
end NonemptyCompacts
269305

270306
/-! ### Positive compact sets -/

0 commit comments

Comments
 (0)