Martin Escardo. March 2022.

When is Ξ£ totally separated?

This is, in particular, needed in order to prove things about compact
ordinals.

\begin{code}

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

module TypeTopology.SigmaTotallySeparated where

open import CoNaturals.Type
open import MLTT.Spartan
open import Taboos.WLPO
open import TypeTopology.CompactTypes
open import TypeTopology.FailureOfTotalSeparatedness
open import TypeTopology.GenericConvergentSequenceCompactness
open import TypeTopology.MicroTychonoff
open import TypeTopology.TotallySeparated
open import UF.Base
open import UF.DiscreteAndSeparated
open import UF.FunExt
open import UF.Subsingletons

\end{code}

Recall that we proved the following:

\begin{code}

_ : (X : 𝓀 Μ‡ ) (Y : X β†’ π“₯ Μ‡ )
  β†’ is-discrete X
  β†’ ((x : X) β†’ is-totally-separated (Y x))
  β†’ is-totally-separated (Ξ£ Y)
_ = Ξ£-is-totally-separated-if-index-type-is-discrete

\end{code}

We now derive a constructive taboo from the assumption that totally
separated types are closed under Ξ£.

\begin{code}

module _ (feβ‚€ : funext 𝓀₀ 𝓀₀) where

 Ξ£-totally-separated-taboo
  : (βˆ€ {𝓀} {π“₯} (X : 𝓀 Μ‡ ) (Y : X β†’ π“₯ Μ‡ )
          β†’ is-totally-separated X
          β†’ ((x : X) β†’ is-totally-separated (Y x))
          β†’ is-totally-separated (Ξ£ Y))
  β†’ ¬¬ WLPO
 Ξ£-totally-separated-taboo Ο„ =
   β„•βˆžβ‚‚-is-not-totally-separated-in-general feβ‚€
    (Ο„ β„•βˆž (Ξ» u β†’ u = ∞ β†’ 𝟚)
       (β„•βˆž-is-totally-separated feβ‚€)
          (Ξ» u β†’ Ξ -is-totally-separated feβ‚€ (Ξ» _ β†’ 𝟚-is-totally-separated)))
\end{code}

Remark. Β¬ WLPO is equivalent to a continuity principle that is
compatible with constructive mathematics and with MLTT. Therefore its
negatation is not provable. See

  Constructive decidability of classical continuity.
  Mathematical Structures in Computer Science
  Volume 25 , Special Issue 7: Computing with Infinite Data:
  Topological and Logical Foundations Part 1 , October 2015 , pp. 1578-1589
  https://doi.org/10.1017/S096012951300042X

and the module TypeTopology.DecidabilityOfNonContinuity.

Even compact totally separated types fail to be closed under Ξ£:

\begin{code}

 Ξ£-totally-separated-stronger-taboo
  : (βˆ€ {𝓀} {π“₯} (X : 𝓀 Μ‡ ) (Y : X β†’ π“₯ Μ‡ )
          β†’ is-compact X
          β†’ ((x : X) β†’ is-compact (Y x))
          β†’ is-totally-separated X
          β†’ ((x : X) β†’ is-totally-separated (Y x))
          β†’ is-totally-separated (Ξ£ Y))
   β†’ ¬¬ WLPO
 Ξ£-totally-separated-stronger-taboo Ο„ =
   β„•βˆžβ‚‚-is-not-totally-separated-in-general feβ‚€
    (Ο„ β„•βˆž (Ξ» u β†’ u = ∞ β†’ 𝟚)
       (β„•βˆž-compact feβ‚€)
       (Ξ» _ β†’ compactβˆ™-types-are-compact
               (micro-tychonoff feβ‚€ (β„•βˆž-is-set feβ‚€) (Ξ» _ β†’ 𝟚-is-compactβˆ™)))
       (β„•βˆž-is-totally-separated feβ‚€)
       (Ξ» u β†’ Ξ -is-totally-separated feβ‚€ (Ξ» _ β†’ 𝟚-is-totally-separated)))

\end{code}

Added 20th December 2023. Sums are not closed under total
separatedness in general, as discussed above, but we have the
following useful special case.

\begin{code}

open import Notation.CanonicalMap hiding ([_])

Ξ£-indexed-by-β„•βˆž-is-totally-separated-if-family-at-∞-is-prop
  : funext 𝓀₀ 𝓀₀
  β†’ (A : β„•βˆž β†’ π“₯ Μ‡ )
  β†’ ((u : β„•βˆž) β†’ is-totally-separated (A u))
  β†’ is-prop (A ∞)
  β†’ is-totally-separated (Ξ£ A)
Ξ£-indexed-by-β„•βˆž-is-totally-separated-if-family-at-∞-is-prop
 feβ‚€ A A-is-ts A∞-is-prop {u , a} {v , b} Ο• = IV
 where
  _ : (p : Ξ£ A β†’ 𝟚) β†’ p (u , a) = p (v , b)
  _ = Ο•

  ϕ₁ : (q : β„•βˆž β†’ 𝟚) β†’ q u = q v
  ϕ₁ q = Ο• (Ξ» (w , _) β†’ q w)

  Iβ‚€ : u = v
  Iβ‚€ = β„•βˆž-is-totally-separated feβ‚€ ϕ₁

  a' : A v
  a' = transport A Iβ‚€ a

  I : (u , a) =[ Σ A ] (v , a')
  I = to-Ξ£-= (Iβ‚€ , refl)

  II : (r : A v β†’ 𝟚) β†’ r a' = r b
  II r = II₃
   where
    IIβ‚€ : (n : β„•) β†’ v = ΞΉ n β†’ r a' = r b
    IIβ‚€ n refl = e
     where
      p' : ((w , c) : Ξ£ A) β†’ is-decidable (ΞΉ n = w) β†’ 𝟚
      p' (w , c) (inl e) = r (transport⁻¹ A e c)
      p' (w , c) (inr Ξ½) = β‚€ -- Anything works here.

      p'-property : ((w , c) : Σ A) (d d' : is-decidable (ι n = w))
                  β†’ p' (w , c) d = p' (w , c) d'
      p'-property (w , c) (inl e) (inl e') = ap (Ξ» - β†’ r (transport⁻¹ A - c))
                                                (β„•βˆž-is-set feβ‚€ e e')
      p'-property (w , c) (inl e) (inr ν') = 𝟘-elim (ν' e)
      p'-property (w , c) (inr ν) (inl e') = 𝟘-elim (ν e')
      p'-property (w , c) (inr Ξ½) (inr Ξ½') = refl

      p : Ξ£ A β†’ 𝟚
      p (w , c) = p' (w , c) (finite-isolated feβ‚€ n w)

      e = r a'                   =⟨refl⟩
          p' (v , a') (inl refl) =⟨ eβ‚€ ⟩
          p (v , a')             =⟨ e₁ ⟩
          p (u , a)              =⟨ eβ‚‚ ⟩
          p (v , b)              =⟨ e₃ ⟩
          p' (v , b) (inl refl)  =⟨refl⟩
          r b                    ∎
           where
            eβ‚€ = p'-property (v , a') (inl refl) (finite-isolated feβ‚€ n v)
            e₁ = ap p (I ⁻¹)
            eβ‚‚ = Ο• p
            e₃ = (p'-property (v , b) (inl refl) (finite-isolated feβ‚€ n v))⁻¹

    II₁ : v = ∞ β†’ r a' = r b
    II₁ refl = ap r (A∞-is-prop a' b)

    IIβ‚‚ : Β¬ (r a' β‰  r b)
    IIβ‚‚ Ξ½ = II∞ (not-finite-is-∞ feβ‚€ IIβ‚™)
     where
      IIβ‚™ : (n : β„•) β†’ v β‰  ΞΉ n
      IIβ‚™ n = contrapositive (IIβ‚€ n) Ξ½

      II∞ : v β‰  ∞
      II∞ = contrapositive II₁ Ξ½

    II₃ : r a' = r b
    II₃ = 𝟚-is-¬¬-separated (r a') (r b) IIβ‚‚

  III : a' = b
  III = A-is-ts v II

  IV : (u , a) =[ Σ A ] (v , b)
  IV = to-Ξ£-= (Iβ‚€ , III)

\end{code}

Added 21st December 2023. A modification of the above proof gives the
following.

\begin{code}

open import UF.Embeddings

subtype-is-totally-separated''
  : {X : 𝓀 Μ‡ } {Y : π“₯ Μ‡ }
    (f : X β†’ Y)
  β†’ is-totally-separated Y
  β†’ left-cancellable f
  β†’ is-totally-separated X
subtype-is-totally-separated'' {𝓀} {π“₯} {X} {Y} f Y-is-ts f-lc {x} {x'} Ο• = II
 where
  _ : (p : X β†’ 𝟚) β†’ p x = p x'
  _ = Ο•

  ϕ₁ : (q : Y β†’ 𝟚) β†’ q (f x) = q (f x')
  ϕ₁ q = Ο• (q ∘ f)

  I : f x = f x'
  I = Y-is-ts ϕ₁

  II : x = x'
  II = f-lc I

subtype-is-totally-separated'
  : {X : 𝓀 Μ‡ } {Y : π“₯ Μ‡ }
    (f : X β†’ Y)
  β†’ is-totally-separated Y
  β†’ is-embedding f
  β†’ is-totally-separated X
subtype-is-totally-separated' f Y-is-ts f-is-emb =
 subtype-is-totally-separated'' f Y-is-ts (embeddings-are-lc f f-is-emb)

subtype-is-totally-separated
  : {X : 𝓀 Μ‡ } (A : X β†’ π“₯ Μ‡ )
  β†’ is-totally-separated X
  β†’ ((x : X) β†’ is-prop (A x))
  β†’ is-totally-separated (Ξ£ A)
subtype-is-totally-separated A X-is-ts A-is-prop-valued =
 subtype-is-totally-separated'' pr₁ X-is-ts (pr₁-lc (Ξ» {x} β†’ A-is-prop-valued x))

\end{code}