Skip to content

Categories.AW-MSciProject

Anna Williams, March 2026

This file corresponds to the paper

https://anna-maths.xyz/assets/papers/disp-categories.pdf


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

open import Categories.Wild
open import Categories.Pre
open import Categories.Univalent
open import Categories.Examples.Set
open import Categories.Examples.Magma

open import Categories.Functor
open import Categories.Functor-Composition

open import Categories.NaturalTransformation

open import Categories.Adjoint

open import Categories.Notation.Wild
open import Categories.Notation.Pre

open import Categories.Displayed.Pre
open import Categories.Displayed.Univalent
open import Categories.Displayed.Examples.Magma

open import Categories.Displayed.Functor

open import Categories.Displayed.Total

open import Categories.Displayed.Notation.Pre

module Categories.AW-MSciProject where

open import MLTT.Spartan
open import Notation.UnderlyingType
open import UF.DependentEquality
open import UF.FunExt
open import UF.Sets
open import UF.Subsingletons
open import UF.Univalence


## Chapter 3: Category Theory

### Section 3.1: Categories


Definition-3-1 : (๐“ค ๐“ฅ : Universe) โ†’ (๐“ค โŠ” ๐“ฅ) โบ ฬ‡
Definition-3-1 = WildCategory

Example-3-2 : WildCategory (๐“ค โบ) ๐“ค
Example-3-2 = SetWildCategory

Example-3-3 : Fun-Ext โ†’ WildCategory (๐“ค โบ) ๐“ค
Example-3-3 = MagmaWildCategory

Definition-3-4 : (W : WildCategory ๐“ค ๐“ฅ)
               โ†’ (A B : obj W)
               โ†’ ๐“ฅ ฬ‡
Definition-3-4 W A B = A โ‰… B
 where
  open WildCategoryNotation W

module _ (W : WildCategory ๐“ค ๐“ฅ) where
 open WildCategoryNotation W

 Proposition-3-5 : (A B : obj W)
                 โ†’ (f : A โ‰… B)
                 โ†’ (g h : inverse โŒœ f โŒ)
                 โ†’ prโ‚ g ๏ผ prโ‚ h
 Proposition-3-5 _ _ _ = at-most-one-inverse

Definition-3-6 : (W : WildCategory ๐“ค ๐“ฅ)
                 (p : is-precategory W)
               โ†’ Precategory ๐“ค ๐“ฅ
Definition-3-6 W p = W , p

Proposition-3-7 : (W : WildCategory ๐“ค ๐“ฅ)
                โ†’ Fun-Ext
                โ†’ is-prop (is-precategory W)
Proposition-3-7 = being-precat-is-prop

Example-3-8-Set : Fun-Ext โ†’ Precategory (๐“ค โบ) ๐“ค
Example-3-8-Set = SetPrecategory

Example-3-8-Magma : Fun-Ext โ†’ Precategory (๐“ค โบ) ๐“ค
Example-3-8-Magma = MagmaPrecategory

module _ (P : Precategory ๐“ค ๐“ฅ) where
 open PrecategoryNotation P

 Proposition-3-9-prop : {a b : obj P}
                        (f : hom a b)
                      โ†’ is-prop (inverse f)
 Proposition-3-9-prop = being-iso-is-prop P

 Proposition-3-9-set : {a b : obj P}
                     โ†’ is-set (a โ‰… b)
 Proposition-3-9-set = isomorphism-type-is-set P

 Corollary-3-10 : {a b : obj P}
                  {f f' : a โ‰… b}
                โ†’ โŒœ f โŒ ๏ผ โŒœ f' โŒ
                โ†’ f ๏ผ f'
 Corollary-3-10 = to-โ‰…-๏ผ

 Proposition-3-11 : (a b : obj P)
                  โ†’ (a ๏ผ b โ†’ a โ‰… b)
 Proposition-3-11 a b = id-to-iso a b

Definition-3-12 : (P : Precategory ๐“ค ๐“ฅ)
                  (p : is-category P)
                โ†’ Category ๐“ค ๐“ฅ
Definition-3-12 P p = P , p

Corollary-3-13 : (C : Category ๐“ค ๐“ฅ)
               โ†’ ((a b : obj C) โ†’ is-set (a ๏ผ b))
Corollary-3-13 = cat-objs-form-a-1-type

Example-3-15 : is-univalent ๐“ค
             โ†’ Fun-Ext
             โ†’ Category (๐“ค โบ) ๐“ค
Example-3-15 = SetCategory

Example-3-16 : Fun-Ext
             โ†’ is-univalent ๐“ค
             โ†’ Category (๐“ค โบ) ๐“ค
Example-3-16 = MagmaCategory


### Functors


Definition-3-17 : (P : Precategory ๐“ค ๐“ฅ)
                  (Q : Precategory ๐“ฆ ๐“ฃ)
                โ†’ ๐“ค โŠ” ๐“ฅ โŠ” ๐“ฆ โŠ” ๐“ฃ ฬ‡
Definition-3-17 P Q = Functor P Q

Example-3-19 : (P : Precategory ๐“ค ๐“ฅ)
             โ†’ Functor P P
Example-3-19 P = id-functor P

module _ {A : Precategory ๐“ค ๐“ฅ}
         {B : Precategory ๐“ค' ๐“ฅ'}
         {C : Precategory ๐“ฆ ๐“ฃ}
         {D : Precategory ๐“ฆ' ๐“ฃ'} where

 Definition-3-20 : (G : Functor B C)
                   (F : Functor A B)
                 โ†’ Functor A C
 Definition-3-20 G F = G Fโˆ˜ F

 Proposition-3-21-left : Fun-Ext
                       โ†’ (F : Functor A B)
                       โ†’ F Fโˆ˜ (id-functor A) ๏ผ F
 Proposition-3-21-left = id-left-neutral-Fโˆ˜

 Proposition-3-21-right : Fun-Ext
                        โ†’ (F : Functor A B)
                        โ†’ (id-functor B) Fโˆ˜ F ๏ผ F
 Proposition-3-21-right = id-right-neutral-Fโˆ˜

 Proposition-3-22 : Fun-Ext
                  โ†’ (F : Functor A B)
                    (G : Functor B C)
                    (H : Functor C D)
                  โ†’ H Fโˆ˜ (G Fโˆ˜ F) ๏ผ (H Fโˆ˜ G) Fโˆ˜ F
 Proposition-3-22 = assoc-Fโˆ˜


### Section 3.3: Natural Transformations


module _ {A : Precategory ๐“ค ๐“ฅ}
         {B : Precategory ๐“ฆ ๐“ฃ}
         {C : Precategory ๐“ค' ๐“ฅ'}
         where

 Definition-3-23 : (F G : Functor A B)
                 โ†’ ๐“ค โŠ” ๐“ฅ โŠ” ๐“ฃ ฬ‡
 Definition-3-23 F G = NaturalTransformation F G

 Example-3-25 : (F : Functor A B)
              โ†’ NaturalTransformation F F
 Example-3-25 F = id-natural-transformation F

 Definition-3-26 : {G H : Functor B C}
                   (ฮผ : NaturalTransformation G H)
                   (F : Functor A B)
                 โ†’ NaturalTransformation (G Fโˆ˜ F) (H Fโˆ˜ F)
 Definition-3-26 = _ยท_

 Definition-3-27 : {F G H : Functor A B}
                   (ฮณ : NaturalTransformation G H)
                   (ฮผ : NaturalTransformation F G)
                 โ†’ NaturalTransformation F H
 Definition-3-27 = _Nโˆ˜_


### Section 3.4: Adjoints


 Definition-3-28 : (F : Functor A B)
                 โ†’ Fun-Ext
                 โ†’ ๐“ค โŠ” ๐“ฅ โŠ” ๐“ฆ โŠ” ๐“ฃ ฬ‡
 Definition-3-28 F = LeftAdjoint F


## Chapter 4: Displayed Category Theory

### Section 4.1: Displayed Categories


Definition-4-1 : (๐“ฆ ๐“ฃ : Universe)
                 (P : Precategory ๐“ค ๐“ฅ)
               โ†’ (๐“ฆ โŠ” ๐“ฃ โŠ” ๐“ค โŠ” ๐“ฅ) โบ ฬ‡
Definition-4-1 ๐“ฆ ๐“ฃ P = DisplayedPrecategory ๐“ฆ ๐“ฃ P

Example-4-2 : {fe : Fun-Ext}
            โ†’ DisplayedPrecategory ๐“ค ๐“ค (SetPrecategory fe)
Example-4-2 {๐“ค} {fe} = DispPreMagma {๐“ค} {fe}

module _ {P : Precategory ๐“ฆ ๐“ฃ}
         {a b : obj P} where
 open PrecategoryNotation P

 Definition-4-3 : (D : DisplayedPrecategory ๐“ค ๐“ฅ P)
                  (x : obj[ a ] D)
                  (y : obj[ b ] D)
                  (f : a โ‰… b)
                โ†’ ๐“ฅ ฬ‡
 Definition-4-3 D x y f = x โ‰…[ f ] y
  where
   open DisplayedPrecategoryNotation D


 module _ {D : DisplayedPrecategory ๐“ค ๐“ฅ P} where
  open DisplayedPrecategoryNotation D

  Proposition-4-4 : {x : obj[ a ] D}
                    {y : obj[ b ] D}
                    {f : a โ‰… b}
                    (๐•— : x โ‰…[ f ] y)
                    (g h : D-inverse f D-โŒœ ๐•— โŒ)
                  โ†’ D-โŒž g โŒŸ ๏ผ D-โŒž h โŒŸ
  Proposition-4-4 ๐•— g h = at-most-one-D-inverse D g h
  Proposition-4-5 : {x : obj[ a ] D}
                    {y : obj[ b ] D}
                    {f : a โ‰… b}
                    {๐•— ๐•˜ : x โ‰…[ f ] y}
                  โ†’ D-โŒœ ๐•— โŒ ๏ผ D-โŒœ ๐•˜ โŒ
                  โ†’ ๐•— ๏ผ ๐•˜
  Proposition-4-5 = to-โ‰…[-]-๏ผ

  Proposition-4-6 : (x : obj[ a ] D)
                    (y : obj[ b ] D)
                    (e : a ๏ผ b)
                  โ†’ x ๏ผโŸฆ (ฮป - โ†’ obj[ - ] D) , e โŸง y
                  โ†’ x โ‰…[ id-to-iso a b e ] y
  Proposition-4-6 x y e = D-id-to-iso D e x y

 Definition-4-7 : (D : DisplayedPrecategory ๐“ค ๐“ฅ P)
                โ†’ is-displayed-category D
                โ†’ DisplayedCategory ๐“ค ๐“ฅ P
 Definition-4-7 D p = D , p

 Example-4-8 : {fe : Fun-Ext}
             โ†’ DisplayedCategory ๐“ค ๐“ค (SetPrecategory fe)
 Example-4-8 {๐“ค} {fe} = DispCatMagma {๐“ค} {fe}


### Section 4.2: Displayed Functor


Definition-4-9 : {P : Precategory ๐“ฆ ๐“ฃ}
                 {P' : Precategory ๐“ฆ' ๐“ฃ'}
                 (F : Functor P P')
                 (D : DisplayedPrecategory ๐“ค ๐“ฅ P)
                 (D' : DisplayedPrecategory ๐“ค' ๐“ฅ' P')
               โ†’ ๐“ฆ โŠ” ๐“ฃ โŠ” ๐“ค โŠ” ๐“ค' โŠ” ๐“ฅ โŠ” ๐“ฅ' ฬ‡
Definition-4-9 F D D' = DisplayedFunctor F D D'


### Section 4.3: Total Category


Proposition-4-10 : (P : Precategory ๐“ค ๐“ฅ)
                   (D : DisplayedPrecategory ๐“ฆ ๐“ฃ P)
                 โ†’ Precategory (๐“ค โŠ” ๐“ฆ) (๐“ฅ โŠ” ๐“ฃ)
Proposition-4-10 P D = TotalPrecategory D

Proposition-4-11 : (C : Category ๐“ค ๐“ฅ)
                   (D : DisplayedCategory ๐“ฆ ๐“ฃ โŸจ C โŸฉ)
                 โ†’ Category (๐“ค โŠ” ๐“ฆ) (๐“ฅ โŠ” ๐“ฃ)
Proposition-4-11 C D = TotalCategory {_} {_} {_} {_} {C} D

Example-4-12-pre : {๐“ค : Universe}
                   {fe : Fun-Ext}
                 โ†’ Precategory (๐“ค โบ) ๐“ค
Example-4-12-pre {๐“ค} {fe} = MagmaTotalPre {๐“ค} {fe}

Example-4-12-univ : {๐“ค : Universe}
                    {fe : Fun-Ext}
                  โ†’ is-univalent ๐“ค
                  โ†’ Category (๐“ค โบ) ๐“ค
Example-4-12-univ {๐“ค} {fe} = TotCatMagma {๐“ค} {fe}