Skip to content

Commit 9d7718c

Browse files
awslothmartinescardotomdjong
authored
Add Total Categories and report listing (#430)
* Change categories code * Add back old categories * Fix old categories module * Start adding displayed categories * Add displayed examples * Amend instance argument definitions and isomorphism * Add displayed functor * Make functor methods public * Make functor methods public * Move Categories.lagda to Type.lagda * Clean up code * Add Anna Williams to the README * Last fix for moving old categories code * Add Wild Categories * Update Displayed Category for Wild Category changes * Make id-to-iso more general * Make displayed categories displayed precategories * games * Rename MetricSpaces.Alternative to MetricSpaces.StandardDefinition * Minor name change * remove obsolete comment and add new comment * one more comment * one more comment correction * equality of elements of the lifting monad * clean imports * Answer question by Jon Sterling * update file count * update reference * remove conjecture * fix mistake in comment (formalization was correct) * make comments more accurate * very minor thing * remove unnecessary imports * ooops * typo * more typos in comments * comma * comma * update title * numbering * fix comment * improve discussion * minor * maybe clarify proof * maybe clarify proof * let's be pedantic * add one more comment * remove unnecessary 'opening' * code review * clarify * minor improvement * minor improvement * minor improvement * minor improvement * renaming not needed * ooops! * canonical * minor * for clarity * for clarity * minor * improve * improve * add corollary * minor * silly * typo * minor * minor updates * typo * update date * fix typo * generalize universe levels * make definition local * General code clean up * Remove unneeded imports * Fix after merge * Fix after merge * Add Set example * Updates for examples * Add equivalence of subtypes * Move to examples folder and add (messy) magma example * Add generic set based structure builder * Updates to Magma and Set * Update Type * Show Set is a category and update index * Make some clean ups * Fix line lengths * Small clean up * Add displayed Categories * Add projections for isomorphisms * Fix precategory capitalisation * Fix changes after merge * Category Notation * Remove accidental files * Update for new notation * Fix naming * Update for notation * Fix definition * Fix definition * Make changes from master * Update notation for cleanliness * Fix line lengths * Update for notation * Clean code * Code cleanup and comments * Add notation for natural transformations * Add more comments and fix code * suggestions after our meeting today * Clean code and split Type into multiple files * Further cleaning * More cleaning * More changes * More cleanup * Fix double lines * Move to gist * Move back * Revert "Fix double lines" This reverts commit 1cec7db. * Reapply "Fix double lines" This reverts commit 2264a72. * Revert "Move back" This reverts commit f84e5d4. * Finish merge * Fix double lines * Various cleanup of files in displayed categories * More cleanup * Updates to displayed * Remove set based * Remove hole * Composition operation change * More cleanup * Remove functor notation * revert changes to equiv * Add pi-is-set for multiple arguments * Remove examples for now * Remove reference to examples * More cleanup * Remove examples * Remove space * Remove double lines and unrequired imports * More suggestions * cleanup * Add back examples * Fix sets * Clean up and add displayed example * Finish magma proof * Start working on TotalCategory * More cleanup * Fix naming inconsistencies * More fixes * clean file * More cleaning * More cleanup * Remove extra file * Remore unnecessary import and SIP from Magma * More cleanup * Renaming cleanup * Final cleanup * Add in examples * Cleanup * Add adjoint * Attempt at adding adjoint * Progress on total * More edits to Total * More changes * Define left adjoint * Work towards total category * Finish Total Categories * clean up code * Add more helper functions for dependent Id * Most cleanup done * General cleanup * Full clean up * More cleanup * Shorten lines * Further clean up * Remove record * Add index file for paper * Finish paper index file * Move file * Move project listing and add to index --------- Co-authored-by: Martin Escardo <m.escardo@cs.bham.ac.uk> Co-authored-by: Tom de Jong <tdejong.ac@gmail.com>
1 parent 8f9fc51 commit 9d7718c

22 files changed

+1293
-203
lines changed
Lines changed: 327 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,327 @@
1+
Anna Williams, March 2026
2+
3+
This file corresponds to the paper
4+
5+
https://anna-maths.xyz/assets/papers/disp-categories.pdf
6+
7+
\begin{code}
8+
9+
{-# OPTIONS --safe --without-K #-}
10+
11+
open import Categories.Wild
12+
open import Categories.Pre
13+
open import Categories.Univalent
14+
open import Categories.Examples.Set
15+
open import Categories.Examples.Magma
16+
17+
open import Categories.Functor
18+
open import Categories.Functor-Composition
19+
20+
open import Categories.NaturalTransformation
21+
22+
open import Categories.Adjoint
23+
24+
open import Categories.Notation.Wild
25+
open import Categories.Notation.Pre
26+
27+
open import Categories.Displayed.Pre
28+
open import Categories.Displayed.Univalent
29+
open import Categories.Displayed.Examples.Magma
30+
31+
open import Categories.Displayed.Functor
32+
33+
open import Categories.Displayed.Total
34+
35+
open import Categories.Displayed.Notation.Pre
36+
37+
module Categories.AW-MSciProject where
38+
39+
open import MLTT.Spartan
40+
open import Notation.UnderlyingType
41+
open import UF.DependentEquality
42+
open import UF.FunExt
43+
open import UF.Sets
44+
open import UF.Subsingletons
45+
open import UF.Univalence
46+
47+
\end{code}
48+
49+
## Chapter 3: Category Theory
50+
51+
### Section 3.1: Categories
52+
53+
\begin{code}
54+
55+
Definition-3-1 : (𝓤 𝓥 : Universe) → (𝓤 ⊔ 𝓥) ⁺ ̇
56+
Definition-3-1 = WildCategory
57+
58+
Example-3-2 : WildCategory (𝓤 ⁺) 𝓤
59+
Example-3-2 = SetWildCategory
60+
61+
Example-3-3 : Fun-Ext → WildCategory (𝓤 ⁺) 𝓤
62+
Example-3-3 = MagmaWildCategory
63+
64+
Definition-3-4 : (W : WildCategory 𝓤 𝓥)
65+
→ (A B : obj W)
66+
→ 𝓥 ̇
67+
Definition-3-4 W A B = A ≅ B
68+
where
69+
open WildCategoryNotation W
70+
71+
module _ (W : WildCategory 𝓤 𝓥) where
72+
open WildCategoryNotation W
73+
74+
Proposition-3-5 : (A B : obj W)
75+
→ (f : A ≅ B)
76+
→ (g h : inverse ⌜ f ⌝)
77+
→ pr₁ g = pr₁ h
78+
Proposition-3-5 _ _ _ = at-most-one-inverse
79+
80+
Definition-3-6 : (W : WildCategory 𝓤 𝓥)
81+
(p : is-precategory W)
82+
→ Precategory 𝓤 𝓥
83+
Definition-3-6 W p = W , p
84+
85+
Proposition-3-7 : (W : WildCategory 𝓤 𝓥)
86+
→ Fun-Ext
87+
→ is-prop (is-precategory W)
88+
Proposition-3-7 = being-precat-is-prop
89+
90+
Example-3-8-Set : Fun-Ext → Precategory (𝓤 ⁺) 𝓤
91+
Example-3-8-Set = SetPrecategory
92+
93+
Example-3-8-Magma : Fun-Ext → Precategory (𝓤 ⁺) 𝓤
94+
Example-3-8-Magma = MagmaPrecategory
95+
96+
module _ (P : Precategory 𝓤 𝓥) where
97+
open PrecategoryNotation P
98+
99+
Proposition-3-9-prop : {a b : obj P}
100+
(f : hom a b)
101+
→ is-prop (inverse f)
102+
Proposition-3-9-prop = being-iso-is-prop P
103+
104+
Proposition-3-9-set : {a b : obj P}
105+
→ is-set (a ≅ b)
106+
Proposition-3-9-set = isomorphism-type-is-set P
107+
108+
Corollary-3-10 : {a b : obj P}
109+
{f f' : a ≅ b}
110+
→ ⌜ f ⌝ = ⌜ f' ⌝
111+
→ f = f'
112+
Corollary-3-10 = to-≅-=
113+
114+
Proposition-3-11 : (a b : obj P)
115+
→ (a = b → a ≅ b)
116+
Proposition-3-11 a b = id-to-iso a b
117+
118+
Definition-3-12 : (P : Precategory 𝓤 𝓥)
119+
(p : is-category P)
120+
→ Category 𝓤 𝓥
121+
Definition-3-12 P p = P , p
122+
123+
Corollary-3-13 : (C : Category 𝓤 𝓥)
124+
→ ((a b : obj C) → is-set (a = b))
125+
Corollary-3-13 = cat-objs-form-a-1-type
126+
127+
Example-3-15 : is-univalent 𝓤
128+
→ Fun-Ext
129+
→ Category (𝓤 ⁺) 𝓤
130+
Example-3-15 = SetCategory
131+
132+
Example-3-16 : Fun-Ext
133+
→ is-univalent 𝓤
134+
→ Category (𝓤 ⁺) 𝓤
135+
Example-3-16 = MagmaCategory
136+
137+
\end{code}
138+
139+
### Functors
140+
141+
\begin{code}
142+
143+
Definition-3-17 : (P : Precategory 𝓤 𝓥)
144+
(Q : Precategory 𝓦 𝓣)
145+
→ 𝓤 ⊔ 𝓥 ⊔ 𝓦 ⊔ 𝓣 ̇
146+
Definition-3-17 P Q = Functor P Q
147+
148+
Example-3-19 : (P : Precategory 𝓤 𝓥)
149+
→ Functor P P
150+
Example-3-19 P = id-functor P
151+
152+
module _ {A : Precategory 𝓤 𝓥}
153+
{B : Precategory 𝓤' 𝓥'}
154+
{C : Precategory 𝓦 𝓣}
155+
{D : Precategory 𝓦' 𝓣'} where
156+
157+
Definition-3-20 : (G : Functor B C)
158+
(F : Functor A B)
159+
→ Functor A C
160+
Definition-3-20 G F = G F∘ F
161+
162+
Proposition-3-21-left : Fun-Ext
163+
→ (F : Functor A B)
164+
→ F F∘ (id-functor A) = F
165+
Proposition-3-21-left = id-left-neutral-F∘
166+
167+
Proposition-3-21-right : Fun-Ext
168+
→ (F : Functor A B)
169+
→ (id-functor B) F∘ F = F
170+
Proposition-3-21-right = id-right-neutral-F∘
171+
172+
Proposition-3-22 : Fun-Ext
173+
→ (F : Functor A B)
174+
(G : Functor B C)
175+
(H : Functor C D)
176+
→ H F∘ (G F∘ F) = (H F∘ G) F∘ F
177+
Proposition-3-22 = assoc-F∘
178+
179+
\end{code}
180+
181+
### Section 3.3: Natural Transformations
182+
183+
\begin{code}
184+
185+
module _ {A : Precategory 𝓤 𝓥}
186+
{B : Precategory 𝓦 𝓣}
187+
{C : Precategory 𝓤' 𝓥'}
188+
where
189+
190+
Definition-3-23 : (F G : Functor A B)
191+
→ 𝓤 ⊔ 𝓥 ⊔ 𝓣 ̇
192+
Definition-3-23 F G = NaturalTransformation F G
193+
194+
Example-3-25 : (F : Functor A B)
195+
→ NaturalTransformation F F
196+
Example-3-25 F = id-natural-transformation F
197+
198+
Definition-3-26 : {G H : Functor B C}
199+
(μ : NaturalTransformation G H)
200+
(F : Functor A B)
201+
→ NaturalTransformation (G F∘ F) (H F∘ F)
202+
Definition-3-26 = _·_
203+
204+
Definition-3-27 : {F G H : Functor A B}
205+
(γ : NaturalTransformation G H)
206+
(μ : NaturalTransformation F G)
207+
→ NaturalTransformation F H
208+
Definition-3-27 = _N∘_
209+
210+
\end{code}
211+
212+
### Section 3.4: Adjoints
213+
214+
\begin{code}
215+
216+
Definition-3-28 : (F : Functor A B)
217+
→ Fun-Ext
218+
→ 𝓤 ⊔ 𝓥 ⊔ 𝓦 ⊔ 𝓣 ̇
219+
Definition-3-28 F = LeftAdjoint F
220+
221+
\end{code}
222+
223+
## Chapter 4: Displayed Category Theory
224+
225+
### Section 4.1: Displayed Categories
226+
227+
\begin{code}
228+
229+
Definition-4-1 : (𝓦 𝓣 : Universe)
230+
(P : Precategory 𝓤 𝓥)
231+
→ (𝓦 ⊔ 𝓣 ⊔ 𝓤 ⊔ 𝓥) ⁺ ̇
232+
Definition-4-1 𝓦 𝓣 P = DisplayedPrecategory 𝓦 𝓣 P
233+
234+
Example-4-2 : {fe : Fun-Ext}
235+
→ DisplayedPrecategory 𝓤 𝓤 (SetPrecategory fe)
236+
Example-4-2 {𝓤} {fe} = DispPreMagma {𝓤} {fe}
237+
238+
module _ {P : Precategory 𝓦 𝓣}
239+
{a b : obj P} where
240+
open PrecategoryNotation P
241+
242+
Definition-4-3 : (D : DisplayedPrecategory 𝓤 𝓥 P)
243+
(x : obj[ a ] D)
244+
(y : obj[ b ] D)
245+
(f : a ≅ b)
246+
→ 𝓥 ̇
247+
Definition-4-3 D x y f = x ≅[ f ] y
248+
where
249+
open DisplayedPrecategoryNotation D
250+
251+
252+
module _ {D : DisplayedPrecategory 𝓤 𝓥 P} where
253+
open DisplayedPrecategoryNotation D
254+
255+
Proposition-4-4 : {x : obj[ a ] D}
256+
{y : obj[ b ] D}
257+
{f : a ≅ b}
258+
(𝕗 : x ≅[ f ] y)
259+
(g h : D-inverse f D-⌜ 𝕗 ⌝)
260+
→ D-⌞ g ⌟ = D-⌞ h ⌟
261+
Proposition-4-4 𝕗 g h = at-most-one-D-inverse D g h
262+
Proposition-4-5 : {x : obj[ a ] D}
263+
{y : obj[ b ] D}
264+
{f : a ≅ b}
265+
{𝕗 𝕘 : x ≅[ f ] y}
266+
→ D-⌜ 𝕗 ⌝ = D-⌜ 𝕘 ⌝
267+
→ 𝕗 = 𝕘
268+
Proposition-4-5 = to-≅[-]-=
269+
270+
Proposition-4-6 : (x : obj[ a ] D)
271+
(y : obj[ b ] D)
272+
(e : a = b)
273+
→ x =⟦ (λ - → obj[ - ] D) , e ⟧ y
274+
→ x ≅[ id-to-iso a b e ] y
275+
Proposition-4-6 x y e = D-id-to-iso D e x y
276+
277+
Definition-4-7 : (D : DisplayedPrecategory 𝓤 𝓥 P)
278+
→ is-displayed-category D
279+
→ DisplayedCategory 𝓤 𝓥 P
280+
Definition-4-7 D p = D , p
281+
282+
Example-4-8 : {fe : Fun-Ext}
283+
→ DisplayedCategory 𝓤 𝓤 (SetPrecategory fe)
284+
Example-4-8 {𝓤} {fe} = DispCatMagma {𝓤} {fe}
285+
286+
\end{code}
287+
288+
### Section 4.2: Displayed Functor
289+
290+
\begin{code}
291+
292+
Definition-4-9 : {P : Precategory 𝓦 𝓣}
293+
{P' : Precategory 𝓦' 𝓣'}
294+
(F : Functor P P')
295+
(D : DisplayedPrecategory 𝓤 𝓥 P)
296+
(D' : DisplayedPrecategory 𝓤' 𝓥' P')
297+
→ 𝓦 ⊔ 𝓣 ⊔ 𝓤 ⊔ 𝓤' ⊔ 𝓥 ⊔ 𝓥' ̇
298+
Definition-4-9 F D D' = DisplayedFunctor F D D'
299+
300+
\end{code}
301+
302+
### Section 4.3: Total Category
303+
304+
\begin{code}
305+
306+
Proposition-4-10 : (P : Precategory 𝓤 𝓥)
307+
(D : DisplayedPrecategory 𝓦 𝓣 P)
308+
→ Precategory (𝓤 ⊔ 𝓦) (𝓥 ⊔ 𝓣)
309+
Proposition-4-10 P D = TotalPrecategory D
310+
311+
Proposition-4-11 : (C : Category 𝓤 𝓥)
312+
(D : DisplayedCategory 𝓦 𝓣 ⟨ C ⟩)
313+
→ Category (𝓤 ⊔ 𝓦) (𝓥 ⊔ 𝓣)
314+
Proposition-4-11 C D = TotalCategory {_} {_} {_} {_} {C} D
315+
316+
Example-4-12-pre : {𝓤 : Universe}
317+
{fe : Fun-Ext}
318+
→ Precategory (𝓤 ⁺) 𝓤
319+
Example-4-12-pre {𝓤} {fe} = MagmaTotalPre {𝓤} {fe}
320+
321+
Example-4-12-univ : {𝓤 : Universe}
322+
{fe : Fun-Ext}
323+
→ is-univalent 𝓤
324+
→ Category (𝓤 ⁺) 𝓤
325+
Example-4-12-univ {𝓤} {fe} = TotCatMagma {𝓤} {fe}
326+
327+
\end{code}

0 commit comments

Comments
 (0)