Skip to content

Commit

Permalink
feat(UniformSpace): add Unique instance (#10774)
Browse files Browse the repository at this point in the history
There is only one `UniformSpace` structure on a `Subsingleton`.
  • Loading branch information
urkud committed Feb 21, 2024
1 parent 65d9c6c commit 00df8d1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Mathlib/Data/Set/Prod.lean
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,11 @@ theorem diag_image (s : Set α) : (fun x => (x, x)) '' s = diagonal α ∩ s ×
exact mem_image_of_mem _ h2x.1
#align set.diag_image Set.diag_image

theorem diagonal_eq_univ_iff : diagonal α = univ ↔ Subsingleton α := by
simp only [subsingleton_iff, eq_univ_iff_forall, Prod.forall, mem_diagonal_iff]

theorem diagonal_eq_univ [Subsingleton α] : diagonal α = univ := diagonal_eq_univ_iff.2 ‹_›

end Diagonal

end Set
Expand Down
4 changes: 4 additions & 0 deletions Mathlib/Topology/UniformSpace/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -1261,6 +1261,10 @@ instance inhabitedUniformSpaceCore : Inhabited (UniformSpace.Core α) :=
⟨@UniformSpace.toCore _ default⟩
#align inhabited_uniform_space_core inhabitedUniformSpaceCore

instance [Subsingleton α] : Unique (UniformSpace α) where
uniq u := bot_unique <| le_principal_iff.2 <| by
rw [idRel, ← diagonal, diagonal_eq_univ]; exact univ_mem

/-- Given `f : α → β` and a uniformity `u` on `β`, the inverse image of `u` under `f`
is the inverse image in the filter sense of the induced function `α × α → β × β`.
See note [reducible non-instances]. -/
Expand Down

0 comments on commit 00df8d1

Please sign in to comment.