Anna Williams 14 February 2026 \begin{code} {-# OPTIONS --safe --without-K #-} open import MLTT.Spartan open import UF.Base open import UF.Equiv hiding (_โ _) open import UF.EquivalenceExamples open import UF.Sets-Properties open import UF.DependentEquality open import Notation.UnderlyingType open import Categories.Wild open import Categories.Pre open import Categories.Univalent open import Categories.Notation.Univalent hiding (โ_โ) open import Categories.Displayed.Pre open import Categories.Displayed.Univalent open import Categories.Displayed.Notation.Pre open import Categories.Displayed.Notation.Univalent module Categories.Displayed.Total where \end{code} We can now define a total precategory. This is the category that pairs up the objects of a 'base' precategory with the corresponding objects index by that object in the displayed precategory. That is, the objects are of the form ฮฃ x : obj P , obj[ x ]. We similarly define the homomorphisms and other fields. \begin{code} module _ {๐ค ๐ฅ ๐ฆ ๐ฃ : Universe} where TotalPrecategory : {P : Precategory ๐ค ๐ฅ} (D : DisplayedPrecategory ๐ฆ ๐ฃ P) โ Precategory (๐ค โ ๐ฆ) (๐ฅ โ ๐ฃ) TotalPrecategory {P} D = (total-wild-category , total-is-precategory) where open PrecategoryNotation P open DisplayedPrecategoryNotation D total-wild-category : WildCategory (๐ค โ ๐ฆ) (๐ฅ โ ๐ฃ) total-wild-category = wildcategory (ฮฃ p ๊ obj P , obj[ p ] D) (ฮป (a , x) (b , y) โ ฮฃ f ๊ hom a b , hom[ f ] x y) (๐๐ , D-๐๐ ) (ฮป (g , ๐) (f , ๐) โ g โฆ f , ๐ โ ๐) (ฮป (f , ๐) โ to-ฮฃ-๏ผ (๐๐ -is-left-neutral f , transport-from-dependent-Id (D-๐๐ -is-left-neutral ๐))) (ฮป (f , ๐) โ to-ฮฃ-๏ผ (๐๐ -is-right-neutral f , transport-from-dependent-Id (D-๐๐ -is-right-neutral ๐))) (ฮป f g h โ to-ฮฃ-๏ผ (assoc _ _ _ , transport-from-dependent-Id D-assoc)) total-is-precategory : is-precategory total-wild-category total-is-precategory _ _ = ฮฃ-is-set (hom-is-set P) (ฮป _ โ hom[-]-is-set) \end{code} We now show that if we have a category and a displayed category, the total category formed of these is a category. \begin{code} module _ {P : Precategory ๐ค ๐ฅ} (D : DisplayedPrecategory ๐ฆ ๐ฃ P) where open PrecategoryNotation P open PrecategoryNotation (TotalPrecategory D) open DisplayedPrecategoryNotation D total-iso-join : {a b : obj P} {x : obj[ a ] D} {y : obj[ b ] D} โ (ฮฃ f ๊ a โ b , x โ [ f ] y) โ ((a , x) โ (b , y)) total-iso-join {a} {b} {x} {y} = qinveq F (Fโปยน , has-section , is-section) where F : (ฮฃ f ๊ a โ b , x โ [ f ] y) โ ((a , x) โ (b , y)) F ((f , fโปยน , p , q) , (๐ , ๐โปยน , ๐ก , ๐ข)) = (f , ๐) , (fโปยน , ๐โปยน) , to-ฮฃ-๏ผ (p , transport-from-dependent-Id ๐ก) , to-ฮฃ-๏ผ (q , transport-from-dependent-Id ๐ข) Fโปยน : ((a , x) โ (b , y)) โ (ฮฃ f ๊ a โ b , x โ [ f ] y) Fโปยน ((f , ๐) , (fโปยน , ๐โปยน) , p , q) = (f , fโปยน , ap prโ p , ap prโ q) , (๐ , ๐โปยน , snd-eq-left , snd-eq-right) where snd-eq-left : ๐โปยน โ ๐ ๏ผโฆ (ฮป - โ hom[ - ] _ _) , ap prโ p โง D-๐๐ snd-eq-left = dependent-Id-from-transport (prโ (from-ฮฃ-๏ผ p)) snd-eq-right : ๐ โ ๐โปยน ๏ผโฆ (ฮป - โ hom[ - ] _ _) , ap prโ q โง D-๐๐ snd-eq-right = dependent-Id-from-transport (prโ (from-ฮฃ-๏ผ q)) has-section : Fโปยน โ F โผ id has-section e@(iso@(f , fโปยน , p , q) , d-iso@(๐ , ๐โปยน , ๐ก , ๐ข)) = to-ฮฃ-๏ผ (f-eq , disp-eq) where f-eq = to-โ -๏ผ refl lem : {a b : obj P} {x : obj[ a ] D} {y : obj[ b ] D} {f f' : a โ b} (e : f ๏ผ f') (๐ : x โ [ f ] y) โ prโ (transport (ฮป - โ x โ [ - ] y) e ๐) ๏ผ transport _ (ap prโ e) (prโ ๐) lem refl _ = refl ๐' = (prโ ((Fโปยน โ F) e)) eq : prโ (transport (ฮป - โ x โ [ - ] y) f-eq ๐') ๏ผ ๐ eq = prโ (transport (ฮป - โ x โ [ - ] y) f-eq ๐') ๏ผโจ I โฉ transport (ฮป - โ hom[ - ] x y) (ap prโ f-eq) (prโ ๐') ๏ผโจ II โฉ ๐ โ where I = lem f-eq _ II = apโ (transport (ฮป - โ hom[ - ] x y)) (hom-is-set P (ap prโ f-eq) refl) refl disp-eq : transport (ฮป - โ x โ [ - ] y) f-eq (prโ ((Fโปยน โ F) e)) ๏ผ d-iso disp-eq = to-โ [-]-๏ผ eq is-section : F โ Fโปยน โผ id is-section ((f , ๐) , (fโปยน , ๐โปยน) , p , q) = to-โ -๏ผ refl TotalCategory : {C : Category ๐ค ๐ฅ} (D : DisplayedCategory ๐ฆ ๐ฃ โจ C โฉ) โ Category (๐ค โ ๐ฆ) (๐ฅ โ ๐ฃ) TotalCategory {C} D = (TotalPrecategory โจ D โฉ) , is-cat where open CategoryNotation C open DisplayedCategoryNotation D open PrecategoryNotation (TotalPrecategory โจ D โฉ) is-cat : is-category (TotalPrecategory โจ D โฉ) is-cat (a , x) (b , y) = equiv-closed-under-โผ โ univalence โ (id-to-iso (a , x) (b , y)) โ univalence โ-is-equiv pointwise-equality where univalence : ((a , x) ๏ผ (b , y)) โ ((a , x) โ (b , y)) univalence = ((a , x) ๏ผ (b , y)) โโจ i โฉ ((ฮฃ e ๊ a ๏ผ b , transport _ e x ๏ผ y)) โโจ ii โฉ (ฮฃ e ๊ a ๏ผ b , x โ [ id-to-iso a b e ] y) โโจ iii โฉ (ฮฃ f ๊ a โ b , x โ [ f ] y) โโจ iv โฉ total-isomorphism โ where total-isomorphism : ๐ฅ โ ๐ฃฬ total-isomorphism = ((a , x) โ (b , y)) transport-equiv-iso : (e : a ๏ผ b) โ (transport (ฮป - โ obj[ - ] D) e x ๏ผ y) โ x โ [ id-to-iso a b e ] y transport-equiv-iso refl = (D-id-to-iso โจ D โฉ refl x y) , D-id-to-iso-is-equiv D refl x y i = ฮฃ-๏ผ-โ ii = ฮฃ-cong transport-equiv-iso iii = ฮฃ-change-of-variable (ฮป - โ (x โ [ - ] y)) (id-to-iso a b) (id-to-iso-is-equiv C a b) iv = total-iso-join โจ D โฉ pointwise-equality : id-to-iso (a , x) (b , y) โผ โ univalence โ pointwise-equality refl = refl \end{code}