Martin Escardo, 17-19 June 2025.

The totally separated reflection of the type Ξ© of propositions.

Any type X has a totally separated reflection, given by the image of
the evaluation map X β†’ ((X β†’ 𝟚) β†’ 𝟚). Here we explore whether the
totally separated reflection of Ξ© has a more direct description.

First, we show, assuming propositional resizing, that the type

    T := (WEM β†’ 𝟚)

has the universal property of the totally separated reflection of Ξ©,
where

    WEM := (p : Ξ©) β†’ Β¬ (p holds) + ¬¬ (p holds)

is the principle of weak excluded middle.

The unit Ξ· : Ξ© β†’ T of the reflection sends a proposition p to the
function that, given a witness of WEM, gives β‚€ or ₁ according to
whether ¬ p holds or ¬¬ p holds.

The universal property says that, for every totally separated type Y,
precomposition with Ξ· (the restriction map) is an equivalence

    (T β†’ Y) ≃ (Ξ© β†’ Y).

Resizing is used to define a section s : T β†’ Ξ© of Ξ· by
s t = "the resized proposition that t is the constant function ₁".

Second, we ask whether this equivalence be established without
assuming propositional resizing.

We don't know, but we explore this a bit here. In particular, we
establish the equivalence, without resizing, for types Y that are
retracts of powers of 𝟚.

TODO. Is every totally separated type a retract of a power of 𝟚,
without assuming resizing? No, because this excludes the empty type
(as pointed out to us by Jason Carr). But what can we say in this
direction?

A side-conclusion of this technical development is that we have an
equivalence

  (Ξ© β†’ 𝟚) ≃ (𝟚 + WEM Γ— 𝟚).

There are always two maps Ξ© β†’ 𝟚, namely the constant ones, plus two
when WEM holds.

Moreover, we show that Ξ· is the universal map of Ξ© into a totally
separated type if and only if it is a surjection.

\begin{code}

{-# OPTIONS --safe --without-K --lossy-unification #-}

open import UF.FunExt
open import UF.Subsingletons

open import MLTT.Spartan

module gist.TotallySeparatedReflectionOfOmega
        (fe : Fun-Ext)
        (pe : Prop-Ext)
        (𝓀 : Universe)
       where

open import MLTT.Two-Properties
open import TypeTopology.CompactTypes
open import TypeTopology.MicroTychonoff
open import TypeTopology.TotallySeparated
open import TypeTopology.SigmaTotallySeparated
open import UF.Base
open import UF.ClassicalLogic
             using (EM ; LEM ; EM-gives-LEM ; double-negation-of-decision)
open import UF.DiscreteAndSeparated
open import UF.Embeddings
open import UF.Equiv
open import UF.PropTrunc
open import UF.Retracts
open import UF.Sets
open import UF.Size
open import UF.SubtypeClassifier renaming (Ξ© to Ξ©-of)
open import UF.Subsingletons-FunExt

private
 fe' : FunExt
 fe' 𝓀 π“₯ = fe {𝓀} {π“₯}

 𝓀⁺ = 𝓀 ⁺

 Ξ© : 𝓀⁺ Μ‡
 Ξ© = Ξ©-of 𝓀

 WEM : 𝓀⁺ Μ‡
 WEM = (p : Ξ©) β†’ is-decidable (Β¬ (p holds))

 WEM-is-prop : is-prop WEM
 WEM-is-prop = Ξ -is-prop fe
                (Ξ» p β†’ decidability-of-prop-is-prop fe (negations-are-props fe))

T : 𝓀⁺ Μ‡
T = WEM β†’ 𝟚

T-is-totally-separated : is-totally-separated T
T-is-totally-separated = Ξ -is-totally-separated fe
                          (Ξ» _ β†’ 𝟚-is-totally-separated)

T-is-set : is-set T
T-is-set = totally-separated-types-are-sets fe T
            T-is-totally-separated

Ο„ : 𝟚 β†’ T
Ο„ b = Ξ» _ β†’ b

Ο„β‚€ τ₁ : T
Ο„β‚€ = Ο„ β‚€
τ₁ = Ο„ ₁

\end{code}

NB. The function Ξ΄ needs --lossy-unification to avoid unsolved constraints.

\begin{code}

Ξ΄ : {p : Ξ©} β†’ is-decidable (Β¬ (p holds)) β†’ 𝟚
Ξ΄ (inl _) = β‚€
Ξ΄ (inr _) = ₁

\end{code}

The unit of the reflection and its non-definitional "computation" rules.

\begin{code}

Ξ· : Ξ© β†’ T
Ξ· p w = Ξ΄ (w p)

Ξ·β‚€ : (p : Ξ©) (w : WEM) β†’ Β¬ (p holds) β†’ Ξ· p w = β‚€
Ξ·β‚€ p w ph = I (w p)
 where
  I : (d : is-decidable (Β¬ (p holds))) β†’ Ξ΄ d = β‚€
  I (inl _) = refl
  I (inr ν) = 𝟘-elim (ν ph)

η₁ : (p : Ξ©) (w : WEM) β†’ ¬¬ (p holds) β†’ Ξ· p w = ₁
η₁ p w Ξ½ = I (w p)
 where
  I : (d : is-decidable (Β¬ (p holds))) β†’ Ξ΄ d = ₁
  I (inl ph) = 𝟘-elim (ν ph)
  I (inr _)  = refl

Ξ·βŠ₯ : Ξ· βŠ₯ = Ο„β‚€
Ξ·βŠ₯ = dfunext fe (Ξ» w β†’ Ξ·β‚€ βŠ₯ w βŠ₯-doesnt-hold)

η⊀ : Ξ· ⊀ = τ₁
η⊀ = dfunext fe (Ξ» w β†’ η₁ ⊀ w (¬¬-intro ⊀-holds))

Ο„-lemma : (t : T) (w : WEM) β†’ t = Ο„ (t w)
Ο„-lemma t w = dfunext fe (Ξ» w' β†’ ap t (WEM-is-prop w' w))

\end{code}

Sufficient condition for boolean-valued maps on Ξ© being constant.

\begin{code}

lemma-βŠ₯ : (f : Ξ© β†’ 𝟚) (p : Ξ©) β†’ Β¬ (p holds) β†’ f p = f βŠ₯
lemma-βŠ₯ f p Ξ½ = ap f (fails-gives-equal-βŠ₯ pe fe p Ξ½)

lemma-⊀ : (f : Ξ© β†’ 𝟚) (p : Ξ©) β†’ p holds β†’ f p = f ⊀
lemma-⊀ f p ph = ap f (holds-gives-equal-⊀ pe fe p ph)

\end{code}

Given f : Ξ© β†’ 𝟚, we can decide whether f βŠ₯ = f ⊀ or not.

 * If so, then f is constant.
 * Otherwise, WEM follows.

\begin{code}

constancy-lemma : (f : Ξ© β†’ 𝟚) β†’ f βŠ₯ = f ⊀ β†’ (p : Ξ©) β†’ f p = f βŠ₯
constancy-lemma f e p = 𝟚-is-¬¬-separated (f p) (f βŠ₯) I
 where
  I : ¬¬ (f p = f βŠ₯)
  I ne = I₁ Iβ‚€
   where
    Iβ‚€ : Β¬ (p holds)
    Iβ‚€ ph = ne (f p =⟨ lemma-⊀ f p ph ⟩
                f ⊀ =⟨ e ⁻¹ ⟩
                f βŠ₯ ∎)

    I₁ : ¬¬ (p holds)
    I₁ Ξ½ = ne (lemma-βŠ₯ f p Ξ½)

WEM-lemma : (f : Ξ© β†’ 𝟚) β†’ f βŠ₯ β‰  f ⊀ β†’ WEM
WEM-lemma f ne p = I (𝟚-is-discrete (f p) (f ⊀))
 where
  I : is-decidable (f p = f ⊀) β†’ is-decidable (Β¬ (p holds))
  I (inl e)   = inr (Ξ» ph β†’ ne (f βŠ₯ =⟨ (lemma-βŠ₯ f p ph)⁻¹ ⟩
                                f p =⟨ e ⟩
                                f ⊀ ∎))
  I (inr ne') = inl (Ξ» ph β†’ ne' (lemma-⊀ f p ph))

\end{code}

Some observations not needed for our development:

\begin{code}

_ : (Y : π“₯ Μ‡ ) β†’ is-totally-separated Y β†’ is-¬¬-separated Y
_ = totally-separated-types-are-¬¬-separated

_ : {Y : π“₯ Μ‡ }
  β†’ is-¬¬-separated Y
  β†’ (f : Ξ© β†’ Y) β†’ f βŠ₯ = f ⊀ β†’ (p q : Ξ©) β†’ f p = f q
_ = βŠ₯-⊀-density' fe pe

Β¬WEM-observation : Β¬ WEM
                 β†’ {Y : π“₯ Μ‡ }
                 β†’ is-totally-separated Y
                 β†’ (f : Ξ© β†’ Y) (p q : Ξ©) β†’ f p = f q
Β¬WEM-observation nwem {Y} ts f = III
 where
  I : (g : Y β†’ 𝟚) β†’ g (f βŠ₯) = g (f ⊀)
  I g = 𝟚-is-¬¬-separated (g (f βŠ₯)) (g (f ⊀)) Iβ‚€
   where
    Iβ‚€ : ¬¬ (g (f βŠ₯) = g (f ⊀))
    Iβ‚€ ne = nwem (WEM-lemma (g ∘ f) ne)

  II : f βŠ₯ = f ⊀
  II = ts I

  III : (p q : Ξ©) β†’ f p = f q
  III = βŠ₯-⊀-density' fe pe (totally-separated-types-are-¬¬-separated Y ts) f II

¬¬WEM-observation : {Y : π“₯ Μ‡ }
                  β†’ is-totally-separated Y
                  β†’ (Ξ£ f κž‰ (Ξ© β†’ Y) , f βŠ₯ β‰  f ⊀)
                  β†’ ¬¬ WEM
¬¬WEM-observation ts (f , ne) =
 contrapositive
  (Ξ» (nwem : Β¬ WEM) β†’ Β¬WEM-observation nwem ts f βŠ₯ ⊀)
  ne

\end{code}

Restriction along Ξ·:

\begin{code}

ρ : (Y : π“₯ Μ‡ ) β†’ (T β†’ Y) β†’ (Ξ© β†’ Y)
ρ Y g = g ∘ η

\end{code}

We now show that T is the totally separated reflection of Ξ© assuming
resizing, and after that we record everything we know about the
universal property of T without assuming resizing.

\begin{code}

module T-is-ts-reflection-of-Ξ©-assuming-resizing
        (r : propositional-resizing 𝓀⁺ 𝓀)
       where

 being-equal-to-τ₁-is-prop : (t : T) β†’ is-prop (t = τ₁)
 being-equal-to-τ₁-is-prop t = T-is-set

\end{code}

We apply resizing to the proposition (t = τ₁), to show that T is a
retract of Ξ© with a section s of Ξ·.

\begin{code}

 s : T β†’ Ξ©
 s t = resize r (t = τ₁) (being-equal-to-τ₁-is-prop t) ,
       resize-is-prop r (t = τ₁) (being-equal-to-τ₁-is-prop t)

 to-s-holds : (t : T) β†’ (t = τ₁) β†’ s t holds
 to-s-holds t = to-resize r (t = τ₁) (being-equal-to-τ₁-is-prop t)

 from-s-holds : (t : T) β†’ s t holds β†’ (t = τ₁)
 from-s-holds t = from-resize r (t = τ₁) (being-equal-to-τ₁-is-prop t)

 Ξ·s : (t : T) β†’ Ξ· (s t) = t
 Ξ·s t = dfunext fe (Ξ» w β†’ 𝟚-equality-cases (I w) (II w))
  where
   I : (w : WEM) β†’ t w = β‚€ β†’ Ξ· (s t) w = t w
   I w eβ‚€ = Ξ· (s t) w =⟨ Ξ·β‚€ (s t) w Iβ‚€ ⟩
            β‚€         =⟨ eβ‚€ ⁻¹ ⟩
            t w       ∎
    where
     Iβ‚€ : Β¬ (s t holds)
     Iβ‚€ h = zero-is-not-one
             (β‚€     =⟨ eβ‚€ ⁻¹ ⟩
              t  w  =⟨ happly (from-s-holds t h) w ⟩
              τ₁ w  =⟨ refl ⟩
              ₁     ∎)
   II : (w : WEM) β†’ t w = ₁ β†’ Ξ· (s t) w = t w
   II w e₁ = Ξ· (s t) w =⟨ η₁ (s t) w II₁ ⟩
             ₁         =⟨ e₁ ⁻¹ ⟩
             t w       ∎
    where
     IIβ‚€ : t = τ₁
     IIβ‚€ = t       =⟨ Ο„-lemma t w ⟩
           Ο„ (t w) =⟨ ap Ο„ e₁ ⟩
           τ₁      ∎

     II₁ : ¬¬ (s t holds)
     II₁ Ξ½ = Ξ½ (to-s-holds t IIβ‚€)

\end{code}

Although s is not necessarily a retraction of Ξ·, any function Ξ© β†’ 𝟚
believes it is, assuming WEM. But then this can be used to get the
same conclusion without assuming WEM.

\begin{code}

 sΞ·-with-WEM : WEM β†’ (f : Ξ© β†’ 𝟚) (p : Ξ©) β†’ f (s (Ξ· p)) = f p
 sΞ·-with-WEM w f p = I (w p)
  where
   I : is-decidable (Β¬ (p holds)) β†’ f (s (Ξ· p)) = f p
   I (inl Ξ½) = f (s (Ξ· p)) =⟨ ap f (fails-gives-equal-βŠ₯ pe fe (s (Ξ· p)) Iβ‚€) ⟩
               f βŠ₯         =⟨ (lemma-βŠ₯ f p Ξ½)⁻¹ ⟩
               f p         ∎
    where
     Iβ‚€ : Β¬ (s (Ξ· p) holds)
     Iβ‚€ sh = zero-is-not-one
              (β‚€      =⟨ (Ξ·β‚€ p w Ξ½)⁻¹ ⟩
               η p w  =⟨ happly (from-s-holds (η p) sh) w ⟩
               τ₁ w   =⟨ refl ⟩
               ₁      ∎)

   I (inr Ξ½Ξ½) = f (s (Ξ· p)) =⟨ ap f (holds-gives-equal-⊀ pe fe (s (Ξ· p)) I₁) ⟩
                f ⊀         =⟨ Iβ‚‚ ⁻¹ ⟩
                f p         ∎
    where
     Iβ‚€ : Ξ· p = τ₁
     Iβ‚€ = dfunext fe (Ξ» w β†’ η₁ p w Ξ½Ξ½)

     I₁ : s (Ξ· p) holds
     I₁ = to-s-holds (Ξ· p) Iβ‚€

     Iβ‚‚ : f p = f ⊀
     Iβ‚‚ = 𝟚-is-¬¬-separated (f p) (f ⊀)
           (Ξ» (ne : f p β‰  f ⊀) β†’ Ξ½Ξ½ (Ξ» (ph : p holds) β†’ ne (lemma-⊀ f p ph)))

 sΞ· : (f : Ξ© β†’ 𝟚) (p : Ξ©) β†’ f (s (Ξ· p)) = f p
 sη f p = 𝟚-is-¬¬-separated (f (s (η p))) (f p) I
  where
   I : ¬¬ (f (s (η p)) = f p)
   I ne = ne (f (s (Ξ· p)) =⟨ constancy-lemma f I₁ (s (Ξ· p)) ⟩
              f βŠ₯         =⟨ (constancy-lemma f I₁ p)⁻¹ ⟩
              f p         ∎)
    where
     Iβ‚€ : Β¬ WEM
     Iβ‚€ w = ne (sΞ·-with-WEM w f p)

     I₁ : f βŠ₯ = f ⊀
     I₁ = 𝟚-is-¬¬-separated (f βŠ₯) (f ⊀) (Ξ» ne' β†’ Iβ‚€ (WEM-lemma f ne'))

 ρ-is-equiv : (Y : 𝓦 Μ‡ )
            β†’ is-totally-separated Y
            β†’ is-equiv (ρ Y)
 ρ-is-equiv Y ts = qinvs-are-equivs (ρ Y) (ρ⁻¹ , I , II)
  where
   ρ⁻¹ : (Ξ© β†’ Y) β†’ (T β†’ Y)
   ρ⁻¹ f = f ∘ s

   I : (g : T β†’ Y) β†’ ρ⁻¹ (ρ Y g) = g
   I g = dfunext fe (Ξ» t β†’ ap g (Ξ·s t))

   II : (f : Ξ© β†’ Y) β†’ ρ Y (ρ⁻¹ f) = f
   II f = dfunext fe (Ξ» p β†’ ts (Ξ» h β†’ sΞ· (Ξ» q β†’ h (f q)) p))

 reflection : (Y : 𝓦 Μ‡ )
            β†’ is-totally-separated Y
            β†’ (T β†’ Y) ≃ (Ξ© β†’ Y)
 reflection Y ts = ρ Y , ρ-is-equiv Y ts

 module _ (pt : propositional-truncations-exist) where

  open import UF.ImageAndSurjection pt
  open PropositionalTruncation pt

  resizing-gives-Ξ·surjection : is-surjection Ξ·
  resizing-gives-ηsurjection t = ∣ s t , ηs t ∣

\end{code}

This is the end of the above module assuming resizing, and we now
record everything we know about the universal property of T without
assuming resizing.

We first show that the universal property holds when 𝟚 is the target type.

\begin{code}

extensionβ‚‚'-along-Ξ· : (f : Ξ© β†’ 𝟚) β†’ is-decidable (f βŠ₯ = f ⊀) β†’ T β†’ 𝟚
extensionβ‚‚'-along-Ξ· f (inl _)  t = f βŠ₯
extensionβ‚‚'-along-Ξ· f (inr ne) t = 𝟚-cases (f βŠ₯) (f ⊀) (t (WEM-lemma f ne))

extensionβ‚‚-along-Ξ· : (Ξ© β†’ 𝟚) β†’ (T β†’ 𝟚)
extensionβ‚‚-along-Ξ· f = extensionβ‚‚'-along-Ξ· f (𝟚-is-discrete (f βŠ₯) (f ⊀))

extensionβ‚‚'-property : (f : Ξ© β†’ 𝟚) (d : is-decidable (f βŠ₯ = f ⊀)) (p : Ξ©)
                     β†’ extensionβ‚‚'-along-Ξ· f d (Ξ· p) = f p
extensionβ‚‚'-property f (inl e)  p = (constancy-lemma f e p)⁻¹
extensionβ‚‚'-property f (inr ne) p = I (WEM-lemma f ne p)
 where
  I : (d : is-decidable (Β¬ (p holds))) β†’ 𝟚-cases (f βŠ₯) (f ⊀) (Ξ΄ d) = f p
  I (inl Ξ½)  = (lemma-βŠ₯ f p Ξ½)⁻¹
  I (inr νν) = (𝟚-is-¬¬-separated (f p) (f ⊀)
                 (Ξ» (ne : f p β‰  f ⊀) β†’ Ξ½Ξ½ (Ξ» (ph : p holds) β†’ ne (lemma-⊀ f p ph))))⁻¹

extensionβ‚‚-property : (f : Ξ© β†’ 𝟚) (p : Ξ©) β†’ extensionβ‚‚-along-Ξ· f (Ξ· p) = f p
extensionβ‚‚-property f p = extensionβ‚‚'-property f (𝟚-is-discrete (f βŠ₯) (f ⊀)) p

ρ₂ : (T β†’ 𝟚) β†’ Ξ© β†’ 𝟚
ρ₂ = ρ 𝟚

restriction-of-extensionβ‚‚ : (f : Ξ© β†’ 𝟚) β†’ ρ₂ (extensionβ‚‚-along-Ξ· f) = f
restriction-of-extensionβ‚‚ f = dfunext fe (Ξ» p β†’ extensionβ‚‚-property f p)

\end{code}

The points Ο„β‚€ and τ₁ are ¬¬-dense in T, which gives left-cancellability of ρ₂.

\begin{code}

τ₀₁-density : (t : T) β†’ ¬¬ ((t = Ο„β‚€) + (t = τ₁))
τ₀₁-density t Ξ½ = II (Ξ» d β†’ Ξ½ (I d))
 where
  I : is-decidable WEM β†’ (t = Ο„β‚€) + (t = τ₁)
  I (inl w) = 𝟚-equality-cases
               (Ξ» e β†’ inl (t       =⟨ Ο„-lemma t w ⟩
                           Ο„ (t w) =⟨ ap Ο„ e ⟩
                           Ο„β‚€      ∎))
               (Ξ» e β†’ inr (t       =⟨ Ο„-lemma t w ⟩
                           Ο„ (t w) =⟨ ap Ο„ e ⟩
                           τ₁      ∎))
  I (inr nw) = inl (dfunext fe (Ξ» w β†’ 𝟘-elim (nw w)))

  II : ¬¬ (is-decidable WEM)
  II = double-negation-of-decision

ρ₂-lc : (g g' : T β†’ 𝟚) β†’ ρ₂ g = ρ₂ g' β†’ g = g'
ρ₂-lc g g' e = dfunext fe (Ξ» t β†’ 𝟚-is-¬¬-separated (g t) (g' t) (III t))
 where
  I : g Ο„β‚€ = g' Ο„β‚€
  I = g Ο„β‚€     =⟨ ap g (Ξ·βŠ₯ ⁻¹) ⟩
      g (Ξ· βŠ₯)  =⟨ happly e βŠ₯ ⟩
      g' (Ξ· βŠ₯) =⟨ ap g' Ξ·βŠ₯ ⟩
      g' Ο„β‚€    ∎

  II : g τ₁ = g' τ₁
  II = g τ₁     =⟨ ap g (η⊀ ⁻¹) ⟩
       g (η ⊀)  =⟨ happly e ⊀ ⟩
       g' (η ⊀) =⟨ ap g' η⊀ ⟩
       g' τ₁    ∎

  III : (t : T) β†’ ¬¬ (g t = g' t)
  III t ne = τ₀₁-density t IIIβ‚€
   where
    IIIβ‚€ : Β¬ ((t = Ο„β‚€) + (t = τ₁))
    IIIβ‚€ (inl eβ‚€) = ne (g  t  =⟨ ap g eβ‚€ ⟩
                        g  Ο„β‚€ =⟨ I ⟩
                        g' Ο„β‚€ =⟨ ap g' (eβ‚€ ⁻¹) ⟩
                        g' t  ∎)

    IIIβ‚€ (inr e₁) = ne (g  t  =⟨ ap g e₁ ⟩
                        g  τ₁ =⟨ II ⟩
                        g' τ₁ =⟨ ap g' (e₁ ⁻¹) ⟩
                        g' t  ∎)

extensionβ‚‚-of-restriction : (g : T β†’ 𝟚) β†’ extensionβ‚‚-along-Ξ· (ρ₂ g) = g
extensionβ‚‚-of-restriction g = ρ₂-lc (extensionβ‚‚-along-Ξ· (ρ₂ g)) g
                               (restriction-of-extensionβ‚‚ (ρ₂ g))

ρ₂-is-equiv : is-equiv ρ₂
ρ₂-is-equiv = qinvs-are-equivs ρ₂
               (extensionβ‚‚-along-Ξ· ,
                extensionβ‚‚-of-restriction ,
                restriction-of-extensionβ‚‚)

\end{code}

TODO. Actually, we can replace 𝟚 by any discrete type to get the same
conclusion.

We now prove the universal property when the target type is a power of 𝟚,
pointwise. More generally, if ρ Y is an equivalence then so is ρ (J β†’ Y)
for any J.

\begin{code}

module _
        {π“₯ 𝓙 : Universe}
        (Y : π“₯ Μ‡ )
        {J : 𝓙 Μ‡ }
        (ρY-is-equiv : is-equiv (ρ Y))
       where

 private
  𝕣 : (T β†’ Y) ≃ (Ξ© β†’ Y)
  𝕣 = (ρ Y , ρY-is-equiv)

 extension-power : (Ξ© β†’ (J β†’ Y)) β†’ (T β†’ (J β†’ Y))
 extension-power f t j = ⌜ 𝕣 ⌝⁻¹ (Ξ» p β†’ f p j) t

 restriction-of-extension-power : (f : Ξ© β†’ (J β†’ Y))
                                β†’ ρ (J β†’ Y) (extension-power f) = f
 restriction-of-extension-power f = dfunext fe (Ξ» p β†’
                                    dfunext fe (Ξ» j β†’ happly
                                                       (inverses-are-sections' 𝕣
                                                         (Ξ» (q : Ξ©) β†’ f q j))
                                                       p))

 extension-of-restriction-power : (g : T β†’ (J β†’ Y))
                                β†’ extension-power (ρ (J β†’ Y) g) = g
 extension-of-restriction-power g =
  dfunext fe (Ξ» t β†’ dfunext fe (Ξ» j β†’
   happly (inverses-are-retractions' 𝕣 (Ξ» t' β†’ g t' j)) t))

 ρ-of-power-is-equiv : is-equiv (ρ (J β†’ Y))
 ρ-of-power-is-equiv =
  qinvs-are-equivs (ρ (J β†’ Y))
   (extension-power ,
    extension-of-restriction-power ,
    restriction-of-extension-power)

ρ-of-power-of-𝟚-is-equiv : {π“˜ : Universe} {J : π“˜ Μ‡ } β†’ is-equiv (ρ (J β†’ 𝟚))
ρ-of-power-of-𝟚-is-equiv {π“˜} {J} = ρ-of-power-is-equiv 𝟚 ρ₂-is-equiv

\end{code}

Retracts of targets that satisfy the universal property also satisfy
the universal property of totally separated reflection.

\begin{code}

ρ-of-retract-is-equiv : {Y : 𝓦 Μ‡ } {Z : 𝓣 Μ‡ }
                      β†’ retract Y of Z
                      β†’ is-equiv (ρ Z)
                      β†’ is-equiv (ρ Y)
ρ-of-retract-is-equiv {𝓦} {𝓣} {Y} {Z} (r , s , rs) ez =
 qinvs-are-equivs (ρ Y) (ρY⁻¹ , III , IV)
 where
  ρZ⁻¹ : (Ξ© β†’ Z) β†’ (T β†’ Z)
  ρZ⁻¹ = inverse (ρ Z) ez

  I : (Ο† : Ξ© β†’ Z) β†’ ρ Z (ρZ⁻¹ Ο†) = Ο†
  I = inverses-are-sections (ρ Z) ez

  II : (ψ : T β†’ Z) β†’ ρZ⁻¹ (ρ Z ψ) = ψ
  II = inverses-are-retractions (ρ Z) ez

  ρY⁻¹ : (Ξ© β†’ Y) β†’ (T β†’ Y)
  ρY⁻¹ f = r ∘ ρZ⁻¹ (s ∘ f)

  III : (g : T β†’ Y) β†’ ρY⁻¹ (ρ Y g) = g
  III g = ρY⁻¹ (ρ Y g)  =⟨ ap (Ξ» - β†’ r ∘ -) (II (s ∘ g)) ⟩
          r ∘ (s ∘ g)   =⟨ dfunext fe (Ξ» t β†’ rs (g t)) ⟩
          g             ∎

  IV : (f : Ξ© β†’ Y) β†’ ρ Y (ρY⁻¹ f) = f
  IV f = ρ Y (ρY⁻¹ f) =⟨ ap (Ξ» - β†’ r ∘ -) (I (s ∘ f)) ⟩
         r ∘ (s ∘ f)  =⟨ dfunext fe (Ξ» p β†’ rs (f p)) ⟩
         f            ∎

\end{code}

The universal property for retracts of powers of 𝟚.

\begin{code}

ρ-of-retract-of-power-of-𝟚-is-equiv
 : {π“˜ : Universe} {Y : 𝓦 Μ‡ } {J : π“˜ Μ‡ }
 β†’ retract Y of (J β†’ 𝟚)
 β†’ is-equiv (ρ Y)
ρ-of-retract-of-power-of-𝟚-is-equiv ret =
 ρ-of-retract-is-equiv ret ρ-of-power-of-𝟚-is-equiv

reflection-for-retract-of-power-of-𝟚
 : {π“˜ : Universe} {Y : 𝓦 Μ‡ } {J : π“˜ Μ‡ }
 β†’ retract Y of (J β†’ 𝟚)
 β†’ (T β†’ Y) ≃ (Ξ© β†’ Y)
reflection-for-retract-of-power-of-𝟚 r =
 ρ _ , ρ-of-retract-of-power-of-𝟚-is-equiv r

\end{code}

The remainder of this file has a number of observations, eventually
culminating in the fact that Ξ· : Ξ© β†’ T is the universal map from Ξ© to
a totally separated type if and only if it is a surjection.

We first connect this to the investigation of 𝟚-injective types from
the file gist.2-injective-types.

\begin{code}

open import gist.2-injective-types fe'

T-is-𝟚-injective : {π“₯ 𝓦 : Universe} β†’ 𝟚-injective T π“₯ 𝓦
T-is-𝟚-injective = first-dual-is-𝟚-injective

η-is-𝟚-injecting : is-𝟚-injecting η
Ξ·-is-𝟚-injecting f = extensionβ‚‚-along-Ξ· f , happly (restriction-of-extensionβ‚‚ f)

ρ-of-𝟚-injective-is-equiv : {Y : 𝓦 Μ‡ }
                          β†’ 𝟚-injective Y 𝓦 𝓦
                          β†’ is-equiv (ρ Y)
ρ-of-𝟚-injective-is-equiv i =
 ρ-of-retract-of-power-of-𝟚-is-equiv (𝟚-injectives-are-K-retracts i)

\end{code}

There is at most one extension for a totally separated target. The
following generalizes and uses ρ₂-lc.

\begin{code}

ρ₂-of-ts-is-lc : (Y : 𝓦 Μ‡ )
               β†’ is-totally-separated Y
               β†’ (g g' : T β†’ Y) β†’ ρ Y g = ρ Y g' β†’ g = g'
ρ₂-of-ts-is-lc Y ts g g' e =
 dfunext fe (Ξ» t β†’ ts (Ξ» q β†’ happly
                              (ρ₂-lc
                                (Ξ» t' β†’ q (g t'))
                                (Ξ» t' β†’ q (g' t'))
                                (ap (Ξ» - β†’ q ∘ -) e)) t))

\end{code}

The notion of compactness is defined in TypeTopology.CompactTypes,
where it is proved that Ξ© is-compact.

\begin{code}

T-is-compactβˆ™ : is-compactβˆ™ T
T-is-compactβˆ™ = micro-tychonoff fe WEM-is-prop (Ξ» _ β†’ 𝟚-is-compactβˆ™)

EM-gives-Ξ©-discrete : EM 𝓀 β†’ is-discrete Ξ©
EM-gives-Ξ©-discrete em p q = II (I p) (I q)
 where
  I : LEM 𝓀
  I = EM-gives-LEM em

  II : is-decidable (p holds) β†’ is-decidable (q holds) β†’ is-decidable (p = q)
  II (inl ph) (inl qh)  = inl (p =⟨ holds-gives-equal-⊀ pe fe p ph ⟩
                               ⊀ =⟨ (holds-gives-equal-⊀ pe fe q qh)⁻¹ ⟩
                               q ∎)

  II (inl ph) (inr nq) = inr (Ξ» e β†’ nq (transport _holds e ph))
  II (inr np) (inl qh) = inr (Ξ» e β†’ np (transport _holds (e ⁻¹) qh))
  II (inr np) (inr nq) = inl (p =⟨ fails-gives-equal-βŠ₯ pe fe p np ⟩
                              βŠ₯ =⟨ (fails-gives-equal-βŠ₯ pe fe q nq)⁻¹ ⟩
                              q ∎)

EM-gives-Ξ©-totally-separated : EM 𝓀 β†’ is-totally-separated Ξ©
EM-gives-Ξ©-totally-separated em = discrete-types-are-totally-separated
                                   (EM-gives-Ξ©-discrete em)

extensionβ‚‚-along-Ξ·-under-WEM : (f : Ξ© β†’ 𝟚) (w : WEM) (t : T)
                             β†’ extensionβ‚‚-along-Ξ· f t = 𝟚-cases (f βŠ₯) (f ⊀) (t w)
extensionβ‚‚-along-Ξ·-under-WEM f w t = I (𝟚-is-discrete (f βŠ₯) (f ⊀))
 where
  I : (d : is-decidable (f βŠ₯ = f ⊀))
    β†’ extensionβ‚‚'-along-Ξ· f d t = 𝟚-cases (f βŠ₯) (f ⊀) (t w)
  I (inl e)  = 𝟚-equality-cases
                (Ξ» e' β†’ f βŠ₯                       =⟨ Iβ‚€ e' ⟩
                        𝟚-cases (f βŠ₯) (f ⊀) (t w) ∎)
                (Ξ» e' β†’ f βŠ₯                       =⟨ e ⟩
                        f ⊀                       =⟨ I₁ e' ⟩
                        𝟚-cases (f βŠ₯) (f ⊀) (t w) ∎)
               where
                Iβ‚€ = Ξ» e' β†’ ap (𝟚-cases (f βŠ₯) (f ⊀)) (e' ⁻¹)
                I₁ = Ξ» e' β†’ ap (𝟚-cases (f βŠ₯) (f ⊀)) (e' ⁻¹)

  I (inr ne) = ap (𝟚-cases (f βŠ₯) (f ⊀))
                  (ap t (WEM-is-prop (WEM-lemma f ne) w))

extensionβ‚‚-along-Ξ·-under-Β¬WEM : (f : Ξ© β†’ 𝟚) (t : T)
                              β†’ Β¬ WEM
                              β†’ extensionβ‚‚-along-Ξ· f t = f βŠ₯
extensionβ‚‚-along-Ξ·-under-Β¬WEM f t nw = I (𝟚-is-discrete (f βŠ₯) (f ⊀))
 where
  I : (d : is-decidable (f βŠ₯ = f ⊀)) β†’ extensionβ‚‚'-along-Ξ· f d t = f βŠ₯
  I (inl e)  = refl
  I (inr ne) = 𝟘-elim (nw (WEM-lemma f ne))

\end{code}

We now assume propositional truncations.

\begin{code}

module comparison (pt : propositional-truncations-exist) where

 open import UF.ImageAndSurjection pt

 ΞΉ : image Ξ· β†’ T
 ΞΉ = restriction Ξ·

 ΞΉ-is-embedding : is-embedding ΞΉ
 ΞΉ-is-embedding = restrictions-are-embeddings Ξ·

 ΞΉ-image-is-ts : is-totally-separated (image Ξ·)
 ΞΉ-image-is-ts = subtype-is-totally-separated' ΞΉ
                  T-is-totally-separated
                  ΞΉ-is-embedding

 Ξ·c : Ξ© β†’ image Ξ·
 Ξ·c = corestriction Ξ·

 section-of-ΞΉ-gives-Ξ·-surjection : (𝓼 : T β†’ image Ξ·)
                                 β†’ ΞΉ ∘ 𝓼 = id
                                 β†’ is-surjection Ξ·
 section-of-ΞΉ-gives-Ξ·-surjection 𝓼 e =
  ∘-is-surjection
   (corestrictions-are-surjections Ξ·)
   (equivs-are-surjections
     (embeddings-with-sections-are-equivs ΞΉ ΞΉ-is-embedding (𝓼 , happly e)))

 ρ-equiv-gives-η-surjection
  : ({π“₯ : Universe} (Y : π“₯ Μ‡ ) β†’ is-totally-separated Y β†’ is-equiv (ρ Y))
  β†’ is-surjection Ξ·
 ρ-equiv-gives-Ξ·-surjection up = section-of-ΞΉ-gives-Ξ·-surjection 𝓼 III
  where
   I : is-equiv (ρ (image η))
   I = up (image Ξ·) ΞΉ-image-is-ts

   𝓼 : T β†’ image Ξ·
   𝓼 = inverse (ρ (image Ξ·)) I Ξ·c

   II : ρ (image Ξ·) 𝓼 = Ξ·c
   II = inverses-are-sections (ρ (image η)) I ηc

   III : ΞΉ ∘ 𝓼 = id
   III = ρ₂-of-ts-is-lc T T-is-totally-separated (ΞΉ ∘ 𝓼) id
          (ap (Ξ» - β†’ ΞΉ ∘ -) II)

 𝟚-injective-image-gives-Ξ·-surjection : 𝟚-injective (image Ξ·) 𝓀⁺ 𝓀⁺
                                      β†’ is-surjection Ξ·
 𝟚-injective-image-gives-Ξ·-surjection i = section-of-ΞΉ-gives-Ξ·-surjection 𝓼 III
  where
   I : Ξ£ 𝓼 κž‰ (T β†’ image Ξ·) , 𝓼 ∘ Ξ· ∼ Ξ·c
   I = i η η-is-𝟚-injecting ηc

   𝓼 : T β†’ image Ξ·
   𝓼 = pr₁ I

   II : 𝓼 ∘ Ξ· ∼ Ξ·c
   II = prβ‚‚ I

   III : ΞΉ ∘ 𝓼 = id
   III = ρ₂-of-ts-is-lc T T-is-totally-separated (ΞΉ ∘ 𝓼) id
          (dfunext fe (Ξ» p β†’ ap ΞΉ (II p)))

\end{code}

We now relate T to the general construction of the totally separated reflection
of any type X as the image of the evaluation map X β†’ ((X β†’ 𝟚) β†’ 𝟚).

\begin{code}

 open totally-separated-reflection fe' pt

\end{code}

The comparison map 𝓬.

\begin{code}

 𝓬 : 𝕋 Ξ© β†’ T
 𝓬 = βˆƒ!-witness (totally-separated-reflection T-is-totally-separated Ξ·)

 𝓬-triangle : 𝓬 ∘ Ξ·α΅€ = Ξ·
 𝓬-triangle = βˆƒ!-is-witness
                        (totally-separated-reflection T-is-totally-separated Ξ·)

 reflection-gives-𝕋-equivalence
  : ({π“₯ : Universe} (Y : π“₯ Μ‡ ) β†’ is-totally-separated Y β†’ is-equiv (ρ Y))
  β†’ is-equiv 𝓬
 reflection-gives-𝕋-equivalence up
  = qinvs-are-equivs 𝓬 (𝓬⁻¹ , III , IV)
  where
   I : is-equiv (ρ (𝕋 Ξ©))
   I = up (𝕋 Ξ©) 𝕋-is-totally-separated

   𝓬⁻¹ : T β†’ 𝕋 Ξ©
   𝓬⁻¹ = inverse (ρ (𝕋 Ξ©)) I Ξ·α΅€

   II : ρ (𝕋 Ξ©) 𝓬⁻¹ = Ξ·α΅€
   II = inverses-are-sections (ρ (𝕋 Ξ©)) I Ξ·α΅€

   III : 𝓬⁻¹ ∘ 𝓬 ∼ id
   III = happly VI
    where
     V : (𝓬⁻¹ ∘ 𝓬) ∘ Ξ·α΅€ = Ξ·α΅€
     V = (𝓬⁻¹ ∘ 𝓬) ∘ Ξ·α΅€ =⟨ ap (Ξ» - β†’ 𝓬⁻¹ ∘ -) 𝓬-triangle ⟩
         𝓬⁻¹ ∘ Ξ·                 =⟨ II ⟩
         Ξ·α΅€                    ∎
     VI : 𝓬⁻¹ ∘ 𝓬 = id
     VI = witness-uniqueness _
            (totally-separated-reflection 𝕋-is-totally-separated Ξ·α΅€)
            (𝓬⁻¹ ∘ 𝓬) id V refl

   IV : 𝓬 ∘ 𝓬⁻¹ ∼ id
   IV = happly VII
    where
     VII : 𝓬 ∘ 𝓬⁻¹ = id
     VII = ρ₂-of-ts-is-lc T T-is-totally-separated (𝓬 ∘ 𝓬⁻¹) id
            (ρ T (𝓬 ∘ 𝓬⁻¹) =⟨ ap (Ξ» - β†’ 𝓬 ∘ -) II ⟩
             𝓬 ∘ Ξ·α΅€           =⟨ 𝓬-triangle ⟩
             η                         ∎)

\end{code}

The above development gives the equivalence

    (Ξ© β†’ 𝟚) ≃ (𝟚 + WEM Γ— 𝟚)

more or less directly.

\begin{code}

ψ' : (f : Ξ© β†’ 𝟚) β†’ is-decidable (f βŠ₯ = f ⊀) β†’ 𝟚 + WEM Γ— 𝟚
ψ' f (inl _)  = inl (f βŠ₯)
ψ' f (inr ne) = inr (WEM-lemma f ne , f βŠ₯)

ψ : (Ξ© β†’ 𝟚) β†’ 𝟚 + WEM Γ— 𝟚
ψ f = ψ' f (𝟚-is-discrete (f βŠ₯) (f ⊀))

ψ⁻¹ : 𝟚 + WEM Γ— 𝟚 β†’ (Ξ© β†’ 𝟚)
ψ⁻¹ (inl b)       _ = b
ψ⁻¹ (inr (w , b)) p = 𝟚-cases b (complement b) (δ (w p))

ψη : ψ⁻¹ ∘ ψ ∼ id
ψη f = I (𝟚-is-discrete (f βŠ₯) (f ⊀))
 where
  I : (d : is-decidable (f βŠ₯ = f ⊀)) β†’ ψ⁻¹ (ψ' f d) = f
  I (inl e)  = dfunext fe (Ξ» p β†’ (constancy-lemma f e p)⁻¹)
  I (inr ne) = dfunext fe II
   where
    w : WEM
    w = WEM-lemma f ne

    II : (p : Ξ©) β†’ 𝟚-cases (f βŠ₯) (complement (f βŠ₯)) (Ξ΄ (w p)) = f p
    II p = III (w p)
     where
      III : (d : is-decidable (Β¬ (p holds)))
          β†’ 𝟚-cases (f βŠ₯) (complement (f βŠ₯)) (Ξ΄ d) = f p
      III (inl Ξ½)  = (lemma-βŠ₯ f p Ξ½)⁻¹
      III (inr Ξ½Ξ½) = complement (f βŠ₯) =⟨ (complement-of-different-booleans ne)⁻¹ ⟩
                     f ⊀              =⟨ IV ⁻¹ ⟩
                     f p              ∎
       where
        IV = 𝟚-is-¬¬-separated (f p) (f ⊀)
             (Ξ» Ξ½ β†’ Ξ½Ξ½ (Ξ» ph β†’ Ξ½ (lemma-⊀ f p ph)))

ψΡ : ψ ∘ ψ⁻¹ ∼ id
ψΡ (inl b) = I (𝟚-is-discrete b b)
 where
  I : (d : is-decidable (b = b)) β†’ ψ' (ψ⁻¹ (inl b)) d = inl b
  I (inl _)  = refl
  I (inr ne) = 𝟘-elim (ne refl)
ψΡ (inr (w , b)) = IV (𝟚-is-discrete (f βŠ₯) (f ⊀))
 where
  f : Ξ© β†’ 𝟚
  f = ψ⁻¹ (inr (w , b))

  I : f βŠ₯ = b
  I = ap (𝟚-cases b (complement b)) (Ξ·β‚€ βŠ₯ w βŠ₯-doesnt-hold)

  II : f ⊀ = complement b
  II = ap (𝟚-cases b (complement b)) (η₁ ⊀ w (¬¬-intro ⊀-holds))

  III : f βŠ₯ β‰  f ⊀
  III e = complement-no-fp b
           (b            =⟨ I ⁻¹ ⟩
            f βŠ₯          =⟨ e ⟩
            f ⊀          =⟨ II ⟩
            complement b ∎)

  IV : (d : is-decidable (f βŠ₯ = f ⊀)) β†’ ψ' f d = inr (w , b)
  IV (inl e)  = 𝟘-elim (III e)
  IV (inr ne) = ap inr (to-Γ—-= (WEM-is-prop (WEM-lemma f ne) w) I)

Ξ¨ : (Ξ© β†’ 𝟚) ≃ (𝟚 + WEM Γ— 𝟚)
Ψ = ψ , qinvs-are-equivs ψ (ψ⁻¹ , ψη , ψΡ)

\end{code}

We now show that Ξ· : Ξ© β†’ T is the universal map from Ξ© into a totally
separated type if and only if it is a surjection.

\begin{code}

module _ (pt : propositional-truncations-exist) where

 open import UF.ImageAndSurjection pt
 open PropositionalTruncation pt
 open totally-separated-reflection fe' pt
 open comparison pt

 universal-property : 𝓀ω
 universal-property = {π“₯ : Universe} (Y : π“₯ Μ‡ )
                    β†’ is-totally-separated Y
                    β†’ is-equiv (ρ Y)

 universal-property-gives-Ξ·-surjection : universal-property
                                       β†’ is-surjection Ξ·
 universal-property-gives-η-surjection = ρ-equiv-gives-η-surjection

 Ξ·-surjection-gives-universal-property : is-surjection Ξ·
                                       β†’ universal-property
 η-surjection-gives-universal-property η-surj Y ts = ρ-is-equiv
  where
   _ : type-of (eval Y) = (Y β†’ ((Y β†’ 𝟚) β†’ 𝟚))
   _ = refl

   _ : eval Y = (Ξ» (y : Y) (g : Y β†’ 𝟚) β†’ g y)
   _ = refl

   eval-is-embedding : is-embedding (eval Y)
   eval-is-embedding = totally-separated-gives-totally-separatedβ‚‚ fe ts

   Ξ΅ : (Ξ© β†’ Y) β†’ (T β†’ ((Y β†’ 𝟚) β†’ 𝟚))
   Ξ΅ f t g = extensionβ‚‚-along-Ξ· (g ∘ f) t

\end{code}

In the next step we show that

                Ξ·
      Ξ© ───────────────────→ T
      β”‚                      β”‚
      β”‚                      β”‚
    f β”‚                      β”‚ Ξ΅ f
      β”‚                      β”‚
      ↓                      ↓
      Y ─────────────→ ((Y β†’ 𝟚) β†’ 𝟚)
              eval Y

\begin{code}

   Ξ΅-square : (f : Ξ© β†’ Y) β†’ Ξ΅ f ∘ Ξ· ∼ eval Y ∘ f
   Ξ΅-square f p = dfunext fe (Ξ» g β†’ extensionβ‚‚-property (g ∘ f) p)

\end{code}

It is in the following step that the surjectivity of Ξ· is used:

\begin{code}

   Ο† : (f : Ξ© β†’ Y) (t : T) β†’ fiber (eval Y) (Ξ΅ f t)
   Ο† f t = βˆ₯βˆ₯-rec (eval-is-embedding (Ξ΅ f t)) I (Ξ·-surj t)
    where
     I : (Ξ£ p κž‰ Ξ© , Ξ· p = t) β†’ fiber (eval Y) (Ξ΅ f t)
     I (p , e) = f p , (eval Y (f p) =⟨ (Ρ-square f p)⁻¹ ⟩
                        Ρ f (η p)    =⟨ ap (Ρ f) e ⟩
                        Ρ f t        ∎)

   Οƒ : (Ξ© β†’ Y) β†’ (T β†’ Y)
   Οƒ f t = fiber-point (Ο† f t)

\end{code}

Next we show that

                  T
                 β•±β”‚
                β•± β”‚
               β•±  β”‚
              β•±   β”‚
             β•±    β”‚
       Οƒ f  β•±     β”‚ Ξ΅ f
           β•±      β”‚
          β•±       β”‚
         β•±        β”‚
        ↙         ↓
       Y ─────→ ((Y β†’ 𝟚) β†’ 𝟚)
          eval Y

\begin{code}

   Οƒ-triangle : (f : Ξ© β†’ Y) β†’ eval Y ∘ Οƒ f ∼ Ξ΅ f
   Οƒ-triangle f t = fiber-identification (Ο† f t)

\end{code}

Pasting these two diagrams we get that Οƒ is section of ρ.

\begin{code}

   ρσ : ρ Y ∘ Οƒ ∼ id
   ρσ f = dfunext fe
           (Ξ» p β†’ embeddings-are-lc (eval Y) eval-is-embedding
                   (eval Y (Οƒ f (Ξ· p)) =⟨ Οƒ-triangle f (Ξ· p) ⟩
                    Ρ f (η p)          =⟨ Ρ-square f p ⟩
                    eval Y (f p)       ∎))

\end{code}

And that Οƒ is a retraction of ρ follows from from this and the total
separatedness of Y.

\begin{code}

   σρ : Οƒ ∘ ρ Y ∼ id
   σρ g = Οƒ (ρ Y g) =⟨ ρ₂-of-ts-is-lc Y ts (Οƒ (ρ Y g)) g I ⟩
          g         ∎
          where
           I : ρ Y (Οƒ (ρ Y g)) = ρ Y g
           I = ρσ (ρ Y g)

   ρ-is-equiv : is-equiv (ρ Y)
   ρ-is-equiv = qinvs-are-equivs (ρ Y) (Οƒ , σρ , ρσ)

\end{code}

So the main question reduces to whether the map Ξ· : Ξ© β†’ T is a
surjection in the absense of propositional resizing, or whether its
surjectivity implies an unprovable form of resizing.

Next we record the immediate fact that Ξ· : Ξ© β†’ T is a surjection if
and only if the comparison map 𝓬 : 𝕋 Ξ© β†’ T is an equivalence.

\begin{code}

 ρᡀ-lc : (g g' : 𝕋 Ξ© β†’ 𝟚) β†’ g ∘ Ξ·α΅€ = g' ∘ Ξ·α΅€ β†’ g = g'
 ρᡀ-lc g g' e = dfunext fe
                 (surjection-induction Ξ·α΅€ Ξ·α΅€-is-surjection
                   (Ξ» t β†’ g t = g' t)
                   (Ξ» t β†’ 𝟚-is-set)
                   (happly e))

 𝓬-lc : left-cancellable 𝓬
 𝓬-lc {x} {y} c = 𝕋-is-totally-separated I
  where
   I : (g : 𝕋 Ξ© β†’ 𝟚) β†’ g x = g y
   I g = g x     =⟨ (happly I₁ x)⁻¹ ⟩
         r (𝓬 x) =⟨ ap r c ⟩
         r (𝓬 y) =⟨ happly I₁ y ⟩
         g y     ∎
    where
     r : T β†’ 𝟚
     r = inverse ρ₂ ρ₂-is-equiv (g ∘ Ξ·α΅€)

     Iβ‚€ : r ∘ Ξ· = g ∘ Ξ·α΅€
     Iβ‚€ = inverses-are-sections ρ₂ ρ₂-is-equiv (g ∘ Ξ·α΅€)

     I₁ : r ∘ 𝓬 = g
     I₁ = ρᡀ-lc (r ∘ 𝓬) g
           ((r ∘ 𝓬) ∘ Ξ·α΅€ =⟨ ap (Ξ» - β†’ r ∘ -) 𝓬-triangle ⟩
            r ∘ Ξ·        =⟨ Iβ‚€ ⟩
            g ∘ Ξ·α΅€       ∎)

 𝓬-is-embedding : is-embedding 𝓬
 𝓬-is-embedding = lc-maps-into-sets-are-embeddings 𝓬 𝓬-lc T-is-set

 𝓬-is-surjection : is-surjection Ξ· β†’ is-surjection 𝓬
 𝓬-is-surjection Οƒ t = βˆ₯βˆ₯-functor f (Οƒ t)
  where
   f : (Ξ£ p κž‰ Ξ© , Ξ· p = t) β†’ (Ξ£ z κž‰ 𝕋 Ξ© , 𝓬 z = t)
   f (p , e) = Ξ·α΅€ p , (𝓬 (Ξ·α΅€ p) =⟨ happly 𝓬-triangle p ⟩
                       η p      =⟨ e ⟩
                       t        ∎)

 Ξ·-surjection-gives-𝓬-is-equiv : is-surjection Ξ· β†’ is-equiv 𝓬
 Ξ·-surjection-gives-𝓬-is-equiv Οƒ = surjective-embeddings-are-equivs 𝓬
                                    𝓬-is-embedding
                                    (𝓬-is-surjection Οƒ)

 𝓬-is-equiv-gives-Ξ·-surjection : is-equiv 𝓬 β†’ is-surjection Ξ·
 𝓬-is-equiv-gives-Ξ·-surjection e = transport is-surjection 𝓬-triangle
                                    (∘-is-surjection
                                      Ξ·α΅€-is-surjection
                                      (equivs-are-surjections e))

\end{code}

It is worth comparing the development in this file to the earlier
development of the following module:

\begin{code}

 import Taboos.P2

\end{code}