Martin Escardo 1st May 2020.
This is ported from the Midlands Graduate School 2019 lecture notes
https://www.cs.bham.ac.uk/~mhe/HoTT-UF.in-Agda-Lecture-Notes/HoTT-UF-Agda.html
https://github.com/martinescardo/HoTT-UF.Agda-Lecture-Notes
\begin{code}
{-# OPTIONS --safe --without-K #-}
module MGS.Classifiers where
open import MGS.Map-Classifiers public
open import MGS.Embeddings public
open import MGS.Powerset public
open import MGS.Universe-Lifting public
Subtypes : π€ Μ β π€ βΊ Μ
Subtypes {π€} Y = Ξ£ X κ π€ Μ , X βͺ Y
_/[_]_ : (π€ : Universe) β (π€ Μ β π₯ Μ ) β π€ Μ β π€ βΊ β π₯ Μ
π€ /[ P ] Y = Ξ£ X κ π€ Μ , Ξ£ f κ (X β Y) , ((y : Y) β P (fiber f y))
Ο-special : (P : π€ Μ β π₯ Μ ) (Y : π€ Μ ) β π€ /[ P ] Y β (Y β Ξ£ P)
Ο-special P Y (X , f , Ο) y = fiber f y , Ο y
is-special-map-classifier : (π€ Μ β π₯ Μ ) β π€ βΊ β π₯ Μ
is-special-map-classifier {π€} P = (Y : π€ Μ ) β is-equiv (Ο-special P Y)
mc-gives-sc : is-map-classifier π€
β (P : π€ Μ β π₯ Μ ) β is-special-map-classifier P
mc-gives-sc {π€} s P Y = Ξ³
where
e = (π€ /[ P ] Y) ββ¨ β-sym a β©
(Ξ£ Ο κ π€ / Y , ((y : Y) β P ((Ο Y) Ο y))) ββ¨ β-sym b β©
(Ξ£ A κ (Y β π€ Μ ), ((y : Y) β P (A y))) ββ¨ β-sym c β©
(Y β Ξ£ P) β
where
a = Ξ£-assoc
b = Ξ£-change-of-variable (Ξ» A β Ξ (P β A)) (Ο Y) (s Y)
c = Ξ Ξ£-distr-β
observation : Ο-special P Y οΌ β e β
observation = refl _
Ξ³ : is-equiv (Ο-special P Y)
Ξ³ = ββ-is-equiv e
Ο-special-is-equiv : is-univalent π€ β dfunext π€ (π€ βΊ)
β (P : π€ Μ β π₯ Μ ) (Y : π€ Μ )
β is-equiv (Ο-special P Y)
Ο-special-is-equiv {π€} ua fe P Y = mc-gives-sc (universes-are-map-classifiers ua fe) P Y
special-map-classifier : is-univalent π€ β dfunext π€ (π€ βΊ)
β (P : π€ Μ β π₯ Μ ) (Y : π€ Μ )
β π€ /[ P ] Y β (Y β Ξ£ P)
special-map-classifier {π€} ua fe P Y = Ο-special P Y , Ο-special-is-equiv ua fe P Y
Ξ©-is-subtype-classifier : Univalence
β (Y : π€ Μ ) β Subtypes Y β (Y β Ξ© π€)
Ξ©-is-subtype-classifier {π€} ua = special-map-classifier (ua π€)
(univalence-gives-dfunext' (ua π€) (ua (π€ βΊ)))
is-subsingleton
subtypes-form-set : Univalence β (Y : π€ Μ ) β is-set (Subtypes Y)
subtypes-form-set {π€} ua Y = equiv-to-set
(Ξ©-is-subtype-classifier ua Y)
(powersets-are-sets' ua)
π’ : (π€ : Universe) β π€ βΊ Μ
π’ π€ = Ξ£ S κ π€ Μ , is-singleton S
equiv-classification : Univalence
β (Y : π€ Μ ) β (Ξ£ X κ π€ Μ , X β Y) β (Y β π’ π€)
equiv-classification {π€} ua = special-map-classifier (ua π€)
(univalence-gives-dfunext' (ua π€) (ua (π€ βΊ)))
is-singleton
the-singletons-form-a-singleton : propext π€ β dfunext π€ π€ β is-singleton (π’ π€)
the-singletons-form-a-singleton {π€} pe fe = c , Ο
where
i : is-singleton (Lift π€ π)
i = equiv-to-singleton (Lift-β π) π-is-singleton
c : π’ π€
c = Lift π€ π , i
Ο : (x : π’ π€) β c οΌ x
Ο (S , s) = to-subtype-οΌ (Ξ» _ β being-singleton-is-subsingleton fe) p
where
p : Lift π€ π οΌ S
p = pe (singletons-are-subsingletons (Lift π€ π) i)
(singletons-are-subsingletons S s)
(Ξ» _ β center S s) (Ξ» _ β center (Lift π€ π) i)
univalenceβ-again : Univalence
β (Y : π€ Μ ) β is-singleton (Ξ£ X κ π€ Μ , X β Y)
univalenceβ-again {π€} ua Y = equiv-to-singleton (equiv-classification ua Y) i
where
i : is-singleton (Y β π’ π€)
i = univalence-gives-vvfunext' (ua π€) (ua (π€ βΊ))
(Ξ» y β the-singletons-form-a-singleton
(univalence-gives-propext (ua π€))
(univalence-gives-dfunext (ua π€)))
\end{code}