module ObjectClassifiers where
open import 1Lab.Type hiding (⊤) open import 1Lab.Type.Pointed open import 1Lab.Type.Sigma open import 1Lab.Path open import 1Lab.Equiv open import 1Lab.HLevel open import 1Lab.HLevel.Closure open import 1Lab.Extensionality open import Data.Id.Base open import 1Lab.Univalence using (Fibre-equiv) -- this does not use univalence -- The (homotopy) pullback, defined using the inductive identity type to -- make some things easier record Pullback {ℓ ℓ' ℓ''} {B : Type ℓ} {C : Type ℓ'} {D : Type ℓ''} (s : B → D) (q : C → D) : Type (ℓ ⊔ ℓ' ⊔ ℓ'') where constructor pb field pb₁ : B pb₂ : C pbeq : s pb₁ ≡ᵢ q pb₂ open Pullback -- A universe-polymorphic unit type to avoid Lift noise record ⊤ {u} : Type u where constructor tt
It is well-known that univalent universes in type theory correspond to object classifiers in higher topos theory. However, there are a few different ways to make sense of this internally to type theory itself.
In what follows, we fix a (Russell) universe and call types in small. We write for the universal projection from pointed small types to small types. We assume function extensionality (implicitly by working in Cubical Agda), but not univalence.
module _ {u} where U = Type u U∙ = Type∙ u U⁺ = Type (lsuc u) Uᵖ : U∙ → U Uᵖ (A , _) = A
We define univalence for as the statement that the type is contractible for all (thus that equivalences form an identity system on ). We will also refer to -univalence, the restriction of that statement to the sub-universe of -types in .
univalence = {X : U} → is-contr (Σ U λ Y → X ≃ Y)
Given a “base” type , there are two main ways we can express “type families over ” in type theory: as maps into from a small domain (this is often called the “fibred” perspective, and such maps may be called “fibrations” or “bundles” over ), or as maps out of into the universe (the “indexed” perspective). We thus define:
module _ (B : U) where Bun : U⁺ Bun = Σ[ A ∈ U ] (A → B) Fam : U⁺ Fam = B → U
We have maps between those in both directions: the map assigns to a bundle its family of fibres, while the map assigns to a -indexed family the first projection out of its total space.
χ : Bun → Fam χ (A , p) = fibre p φ : Fam → Bun φ a = Σ B a , fst
The HoTT book proves (theorem 4.8.3) that and are inverses, assuming that is univalent. This is also formalised in the 1Lab:
_ : is-equiv χ _ = 1Lab.Univalence.Fibration-equiv {ℓ' = u} .snd _ : is-equiv φ _ = (1Lab.Univalence.Fibration-equiv {ℓ' = u} e⁻¹) .snd
A partial converse to this result was formalised independently by Martín Escardó (in TypeTopology) and by Amélia Liao (in this math.SE answer): both of them show that univalence follows from being a fibrewise equivalence if one also assumes -univalence, i.e. that any two contractible types are equal1 (as well as function extensionality). In this Mastodon post I gave an example of a Tarski universe containing two distinct unit types and which can be closed under - and identity types in such a way that and are both fibrewise equivalences, but which is not -univalent for any , thus suggesting that one cannot get rid of the -univalence assumption.
In this note I would like to suggest an explanation for why the converse of theorem 4.8.3 fails. The key is to notice that and can be thought of as the endpoints of a span of types whose apex is the type of pullback squares with bottom-left corner and right-hand side map :
Let us call such a pullback square a classification over : it consists of a fibration over that is classified by a given map .
To define the type of classifications, we take a shortcut: instead of recording three maps and a universal property, we only record the top-left corner and the bottom map , and ask for an equivalence between and a given pullback of along . This fully determines the projection maps out of , so we are justified in leaving them out by function extensionality and contractibility of singletons. Note that we cannot similarly contract away as that would implicitly assume univalence.
record Cls : U⁺ where constructor cls field A : U a : B → U classifies : A ≃ Pullback a Uᵖ module c = Equiv classifies p : A → B p = pb₁ ∘ c.to a⁺ : A → U∙ a⁺ = pb₂ ∘ c.to
We obtain the span promised above by projecting the left and bottom maps of the pullback square, respectively.
π↓ : Cls → Bun π↓ p = _ , Cls.p p π→ : Cls → Fam π→ = Cls.a
Observe that both and have sections, given by taking fibres and total spaces respectively, and that composing one section with the other projection recovers the maps and .
σ↓ : Bun → Cls σ↓ (A , p) = λ where .Cls.A → A .Cls.a → fibre p .Cls.classifies .fst a → pb (p a) (fibre p (p a) , a , refl) reflᵢ .Cls.classifies .snd → is-iso→is-equiv λ where .is-iso.from (pb b (_ , (a , _)) reflᵢ) → a .is-iso.rinv (pb b (_ , (a , eq)) reflᵢ) i → pb (eq i) (fibre p (eq i) , a , λ j → eq (i ∧ j)) reflᵢ .is-iso.linv _ → refl section↓ : is-right-inverse σ↓ π↓ section↓ (A , p) = refl _ : π→ ∘ σ↓ ≡ χ _ = refl σ→ : Fam → Cls σ→ a = λ where .Cls.A → Σ B a .Cls.a → a .Cls.classifies .fst (b , x) → pb b (a b , x) reflᵢ .Cls.classifies .snd → is-iso→is-equiv λ where .is-iso.from (pb b (_ , x) reflᵢ) → b , x .is-iso.rinv (pb b (_ , x) reflᵢ) → refl .is-iso.linv _ → refl section→ : is-right-inverse σ→ π→ section→ a = refl _ : π↓ ∘ σ→ ≡ φ _ = refl
We now come to the main point of this post: each of
and
is an equivalence if and only if univalence holds. This is
reflected in the proof of Fibration-equiv
, which uses
univalence twice, once in the left inverse proof and once in
the right inverse proof. This suggests that the two uses of univalence
cancel each other out in a certain sense, so that we lose
information if we only ask for a composite equivalence between
and
.
In more detail, the statement that is an equivalence says that every bundle is classified by a unique2 pullback square into ; this looks a lot like the definition of an object classifier in higher topos theory! On the other hand, the statement that is an equivalence says that every map has a unique pullback along ; in other words, that this pullback is determined uniquely up to identity rather than just equivalence. Notice that both statements are roughly of the form “there is a unique pullback square”, but that they quantify over different parts of the pullback square.
The easiest way to substantiate our claim is to specialise to the unit type; in this case, the span simplifies to the two projections out of the type of equivalences in :
Equiv : U⁺ Equiv = Σ[ X ∈ U ] Σ[ Y ∈ U ] X ≃ Y π₁≃ : Equiv → U π₁≃ (X , Y , e) = X π₂≃ : Equiv → U π₂≃ (X , Y , e) = Y Fam⊤≃U : Fam ⊤ ≃ U Fam⊤≃U .fst a = a _ Fam⊤≃U .snd = is-iso→is-equiv λ where .is-iso.from X _ → X .is-iso.rinv X → refl .is-iso.linv a → refl Bun⊤≃U : Bun ⊤ ≃ U Bun⊤≃U .fst (A , _) = A Bun⊤≃U .snd = is-iso→is-equiv λ where .is-iso.from X → X , _ .is-iso.rinv _ → refl .is-iso.linv _ → refl Pullback≃a : {a : ⊤ {u} → U} → Pullback a Uᵖ ≃ a _ Pullback≃a .fst (pb _ (_ , b) reflᵢ) = b Pullback≃a .snd = is-iso→is-equiv λ where .is-iso.from b → pb _ (_ , b) reflᵢ .is-iso.rinv _ → refl .is-iso.linv (pb _ (_ , b) reflᵢ) → refl Cls⊤≃Equiv : Cls ⊤ ≃ Equiv Cls⊤≃Equiv .fst (cls A a e) = A , a _ , e ∙e Pullback≃a Cls⊤≃Equiv .snd = is-iso→is-equiv λ where .is-iso.from (X , Y , e) → cls X (λ _ → Y) (e ∙e Pullback≃a e⁻¹) .is-iso.rinv (X , Y , e) → refl ,ₚ refl ,ₚ ext λ _ → refl .is-iso.linv (cls A a e) → let h : (e ∙e Pullback≃a) ∙e Pullback≃a e⁻¹ ≡ e h = ext λ _ → Equiv.η Pullback≃a _ in λ i → cls A a (h i) _ : π₁≃ ≡ Equiv.to Bun⊤≃U ∘ π↓ ⊤ ∘ Equiv.from Cls⊤≃Equiv _ = refl _ : π₂≃ ≡ Equiv.to Fam⊤≃U ∘ π→ ⊤ ∘ Equiv.from Cls⊤≃Equiv _ = refl
This makes the proof immediate after noting that the fibre of at is equivalent to (a general fact that does not require univalence or even function extensionality), and symmetrically for .
π₁≃-equiv→univalence : is-equiv π₁≃ → univalence π₁≃-equiv→univalence h {X} = Equiv→is-hlevel 0 (Fibre-equiv (λ X → Σ U λ Y → X ≃ Y) X e⁻¹) (h .is-eqv X) π↓-equiv→univalence : is-left-inverse (σ↓ ⊤) (π↓ ⊤) → univalence π↓-equiv→univalence h = π₁≃-equiv→univalence $ ∘-is-equiv (Bun⊤≃U .snd) (∘-is-equiv π↓-is-equiv ((Cls⊤≃Equiv e⁻¹) .snd)) where π↓-is-equiv : is-equiv (π↓ ⊤) π↓-is-equiv = is-iso→is-equiv (iso (σ↓ _) (section↓ _) h) sym≃ : Equiv ≃ Equiv sym≃ .fst (X , Y , e) = Y , X , e e⁻¹ sym≃ .snd = is-involutive→is-equiv λ (X , Y , e) → refl ,ₚ refl ,ₚ ext λ _ → refl π→-equiv→univalence : is-left-inverse (σ→ ⊤) (π→ ⊤) → univalence π→-equiv→univalence h = π₁≃-equiv→univalence $ ∘-is-equiv (Fam⊤≃U .snd) (∘-is-equiv π→-is-equiv (∘-is-equiv ((Cls⊤≃Equiv e⁻¹) .snd) (sym≃ .snd))) where π→-is-equiv : is-equiv (π→ ⊤) π→-is-equiv = is-iso→is-equiv (iso (σ→ _) (section→ _) h)
It also makes it easy to see the complete loss of information in assuming an equivalence , since this amounts to the trivial ! Assuming that or is an equivalence doesn’t get us very far either, as in both cases we just get that forming products with a contractible type is an equivalence.
_ : Equiv.to Bun⊤≃U ∘ π↓ ⊤ ∘ σ→ ⊤ ∘ Equiv.from Fam⊤≃U ≡ λ X → ⊤ × X _ = refl _ : Equiv.to Fam⊤≃U ∘ π→ ⊤ ∘ σ↓ ⊤ ∘ Equiv.from Bun⊤≃U ≡ λ X → X × tt ≡ tt _ = refl