Martin Escardo
\begin{code}
{-# OPTIONS --safe --without-K #-}
module UF.HedbergApplications where
open import MLTT.Spartan
open import UF.Equiv
open import UF.FunExt
open import UF.Hedberg
open import UF.Sets
open import UF.Subsingletons
open import UF.Subsingletons-FunExt
đ-is-collapsible : collapsible (đ {đ€})
đ-is-collapsible {đ€} = id , (λ x y â đ-elim y)
pointed-types-are-collapsible : {X : đ€ Ì } â X â collapsible X
pointed-types-are-collapsible x = (λ y â x) , (λ y y' â refl)
\end{code}
Under Curry-Howard, the function type X â đ is understood as the
negation of X when X is viewed as a proposition. But when X is
understood as a mathematical object, inhabiting the type X â đ amounts
to showing that X is empty. (In fact, assuming univalence, defined
below, the type X â đ is equivalent to the type X ïŒ đ
(written (X â đ) â (X ïŒ đ)).)
\begin{code}
empty-types-are-collapsible : {X : đ€ Ì } â is-empty X â collapsible X
empty-types-are-collapsible u = (id , (λ x x' â unique-from-đ (u x)))
đ-is-collapsible' : collapsible đ
đ-is-collapsible' = empty-types-are-collapsible id
\end{code}
Added 30 Jul 2023.
\begin{code}
constant-maps-are-h-isolated : funext đ€ đ„
                             â {X : đ€ Ì } {Y : đ„ Ì } (yâ : Y)
                             â is-h-isolated yâ
                             â is-h-isolated (λ (x : X) â yâ)
constant-maps-are-h-isolated fe yâ yâ-iso {f} = II
 where
  I = ((λ x â yâ) ïŒ f) ââš â-funext fe (λ x â yâ) f â©
       (λ x â yâ) ⌠f   â 
  II : is-prop ((λ x â yâ) ïŒ f)
  II = equiv-to-prop I (Π-is-prop fe (λ _ â yâ-iso))
\end{code}
Added before 2018 and moved here 7th March 2025 from another file
where it was in less general form.
\begin{code}
reflexive-prop-valued-relation-that-implies-equality-gives-set
 : {X : đ€ Ì }
 â (_R_ : X â X â đ„ Ì )
 â ((x y : X) â is-prop (x R y))
 â ((x : X) â x R x)
 â ((x y : X) â x R y â x ïŒ y)
 â is-set X
reflexive-prop-valued-relation-that-implies-equality-gives-set
 {đ€} {đ„} {X} _R_ p r e = Îł
 where
  f : {x y :  X} â x ïŒ y â x ïŒ y
  f {x} {y} p = e x y (transport (x R_) p (r x))
  ec : {x y : X} {l l' : x R y} â e x y l ïŒ e x y l'
  ec {x} {y} {l} {l'} = ap (e x y) (p x y l l')
  Îș : {x y : X} â wconstant (f {x} {y})
  Îș p q = ec
  Îł : is-set X
  Îł = Id-collapsibles-are-sets (f , Îș)
type-with-prop-valued-refl-antisym-rel-is-set
 : {X : đ€ Ì }
 â (_â€_ : X â X â đ„ Ì )
 â ((x y : X) â is-prop (x †y))
 â ((x : X) â x †x)
 â ((x y : X) â x †y â y †x â x ïŒ y)
 â is-set X
type-with-prop-valued-refl-antisym-rel-is-set _â€_ â€-prop-valued â€-refl â€-anti
 = reflexive-prop-valued-relation-that-implies-equality-gives-set
    (λ x y â (x †y) Ă (y †x))
    (λ x y â Ă-is-prop (â€-prop-valued x y) (â€-prop-valued y x))
    (λ x â â€-refl x , â€-refl x)
    (λ x y (l , m) â â€-anti x y l m)
\end{code}