Martin Escardo, 24 June 2026.
In the module TypeTopology.TotallySeparated we construct the totally
separated reflection of a type X as the image of the evaluation map
X β ((X β π) β π).
An alternative construction, developed here, is given by the set-quotient
of X by the equivalence relation
x οΌβ y := (p : X β π) β p x οΌ p y.
\begin{code}
{-# OPTIONS --safe --without-K #-}
open import UF.FunExt
open import UF.PropTrunc
open import Quotient.Type
module TypeTopology.TotallySeparatedReflectionViaQuotients
(fe : FunExt)
(pt : propositional-truncations-exist)
(sq : set-quotients-exist)
where
open import MLTT.Spartan
open import MLTT.Two-Properties
open import TypeTopology.TotallySeparated
open import UF.DiscreteAndSeparated
open import UF.Equiv
open import UF.ImageAndSurjection pt
open import UF.Sets
open import UF.Subsingletons
open import UF.Subsingletons-FunExt
open PropositionalTruncation pt
open general-set-quotients-exist sq
open totally-separated-reflection fe pt
private
fe' : Fun-Ext
fe' {π€} {π₯} = fe π€ π₯
οΌβ-eqrel : {X : π€ Μ } β EqRel {π€} {π€} X
οΌβ-eqrel = _οΌβ_ ,
(Ξ» x y β Ξ -is-prop fe' (Ξ» _ β π-is-set)) ,
(Ξ» x p β refl) ,
(Ξ» x y e p β (e p)β»ΒΉ) ,
(Ξ» x y z e d p β e p β d p)
πβ : π€ Μ β π€ Μ
πβ X = X / οΌβ-eqrel
Ο : {X : π€ Μ } β X β πβ X
Ο = Ξ·/ οΌβ-eqrel
Ο-identifies-οΌβ : {X : π€ Μ } {x y : X}
β x οΌβ y β Ο x οΌ Ο y
Ο-identifies-οΌβ = Ξ·/-identifies-related-points οΌβ-eqrel
πβ-is-set : {X : π€ Μ } β is-set (πβ X)
πβ-is-set = /-is-set οΌβ-eqrel
Ο-is-surjection : {X : π€ Μ } β is-surjection (Ο {π€} {X})
Ο-is-surjection = Ξ·/-is-surjection οΌβ-eqrel pt
\end{code}
Every map into a totally separated type respects οΌβ.
\begin{code}
maps-into-ts-identify-related-points : {X : π€ Μ } {A : π₯ Μ }
β is-totally-separated A
β (f : X β A)
β ({x x' : X} β x οΌβ x' β f x οΌ f x')
maps-into-ts-identify-related-points ts f e = ts (Ξ» p β e (p β f))
\end{code}
The universal property says that for any totally separated type A, the
restriction map _β Ο : (πβ X β A) β (X β A) is an equivalence.
The extension of f : X β A along Ο is the unique extension given by the
quotient universal property, which applies because A is totally
separated (hence f respects οΌβ).
\begin{code}
private
ts-types-are-sets : {A : π₯ Μ } β is-totally-separated A β is-set A
ts-types-are-sets {π₯} {A} ts = totally-separated-types-are-sets fe' A ts
extension : {X : π€ Μ } {A : π₯ Μ }
β is-totally-separated A
β (X β A) β (πβ X β A)
extension {π€} {π₯} {X} {A} ts f =
β!-witness
(/-universality οΌβ-eqrel (ts-types-are-sets ts) f
(maps-into-ts-identify-related-points ts f))
extension-property : {X : π€ Μ } {A : π₯ Μ }
β (ts : is-totally-separated A)
β (f : X β A)
β extension ts f β Ο βΌ f
extension-property ts f =
β!-is-witness
(/-universality οΌβ-eqrel (ts-types-are-sets ts) f
(maps-into-ts-identify-related-points ts f))
\end{code}
We now show that the quotient type πβ X is totally separated. Given
two points u v : πβ X with all π-valued maps agreeing on them, we use
the surjectivity of Ο to get preimages x and y, and then show that
x οΌβ y by extending each p : X β π along Ο.
\begin{code}
πβ-is-totally-separated : {X : π€ Μ } β is-totally-separated (πβ X)
πβ-is-totally-separated {π€} {X} {u} {v} eβ = III
where
_ : u οΌβ v
_ = eβ
Ξ΅ : (X β π) β πβ X β π
Ξ΅ = extension π-is-totally-separated
I : (x y : X) β Ο x οΌ u β Ο y οΌ v β x οΌβ y
I x y ex ey p =
p x οΌβ¨ (extension-property π-is-totally-separated p x)β»ΒΉ β©
Ξ΅ p (Ο x) οΌβ¨ ap (Ξ΅ p) ex β©
Ξ΅ p u οΌβ¨ eβ (Ξ΅ p) β©
Ξ΅ p v οΌβ¨ ap (Ξ΅ p) (ey β»ΒΉ) β©
Ξ΅ p (Ο y) οΌβ¨ extension-property π-is-totally-separated p y β©
p y β
II : (Ξ£ x κ X , Ο x οΌ u) β (Ξ£ y κ X , Ο y οΌ v) β u οΌ v
II (x , ex) (y , ey) =
u οΌβ¨ ex β»ΒΉ β©
Ο x οΌβ¨ Ο-identifies-οΌβ (I x y ex ey) β©
Ο y οΌβ¨ ey β©
v β
III : u οΌ v
III = β₯β₯-recβ πβ-is-set II (Ο-is-surjection u) (Ο-is-surjection v)
extension-of-restriction : {X : π€ Μ } {A : π₯ Μ }
β (ts : is-totally-separated A)
β (g : πβ X β A)
β extension ts (g β Ο) οΌ g
extension-of-restriction ts g =
ap prβ
(β!-uniqueness
(/-universality οΌβ-eqrel (ts-types-are-sets ts) (g β Ο)
(maps-into-ts-identify-related-points ts (g β Ο)))
g (Ξ» x β refl))
universal-property : {X : π€ Μ } {A : π₯ Μ }
β is-totally-separated A
β (πβ X β A) β (X β A)
universal-property ts = qinveq (_β Ο)
(extension ts ,
extension-of-restriction ts ,
(Ξ» f β dfunext fe' (extension-property ts f)))
\end{code}
We now record the comparison maps between π X (the image construction)
and πβ X (the quotient construction). Each one is the unique map given
by the universal property of the other.
\begin{code}
module comparison {X : π€ Μ } where
c : π X β πβ X
c = extα΅ πβ-is-totally-separated Ο
c-triangle : c β Ξ·α΅ βΌ Ο
c-triangle = ext-Ξ·α΅ πβ-is-totally-separated Ο
π-is-set : is-set (π X)
π-is-set = totally-separated-types-are-sets fe' (π X) π-is-totally-separated
cβ»ΒΉ : πβ X β π X
cβ»ΒΉ = extension π-is-totally-separated Ξ·α΅
cβ»ΒΉ-triangle : cβ»ΒΉ β Ο βΌ Ξ·α΅
cβ»ΒΉ-triangle = extension-property π-is-totally-separated Ξ·α΅
c-is-section : cβ»ΒΉ β c βΌ id
c-is-section = Ξ·α΅-induction _ (Ξ» _ β π-is-set) (Ξ» x β
cβ»ΒΉ (c (Ξ·α΅ x)) οΌβ¨ ap cβ»ΒΉ (c-triangle x) β©
cβ»ΒΉ (Ο x) οΌβ¨ cβ»ΒΉ-triangle x β©
Ξ·α΅ x β)
c-is-retraction : c β cβ»ΒΉ βΌ id
c-is-retraction = surjection-induction Ο Ο-is-surjection _ (Ξ» _ β πβ-is-set {π€} {X}) (Ξ» x β
c (cβ»ΒΉ (Ο x)) οΌβ¨ ap c (cβ»ΒΉ-triangle x) β©
c (Ξ·α΅ x) οΌβ¨ c-triangle x β©
Ο x β)
π-β-πβ : π X β πβ X
π-β-πβ = qinveq c (cβ»ΒΉ , c-is-section , c-is-retraction)
\end{code}