Skip to content

Commit e094b5a

Browse files
TOTBWFplt-amy
andauthored
Two-sided fibrations (the1lab#456)
# Description This PR defines two-sided fibrations and two-sided discrete fibrations, and proves that the comma category is a two-sided discrete fibration when regarded as a displayed category. ## Checklist Before submitting a merge request, please check the items below: - [x] I've read [the contributing guidelines](https://github.com/plt-amy/1lab/blob/main/CONTRIBUTING.md). - [x] The imports of new modules have been sorted with `support/sort-imports.hs` (or `nix run --experimental-features nix-command -f . sort-imports`). - [x] All new code blocks have "agda" as their language. If your change affects many files without adding substantial content, and you don't want your name to appear on those pages (for example, treewide refactorings or reformattings), start the commit message and PR title with `chore:`. --------- Co-authored-by: Amélia <[email protected]>
1 parent d2d3918 commit e094b5a

File tree

5 files changed

+796
-3
lines changed

5 files changed

+796
-3
lines changed

src/Cat/Displayed/Cartesian/Discrete.lagda.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ open is-cartesian
2929
```
3030
-->
3131

32-
# Discrete fibrations
32+
# Discrete fibrations {defines="discrete-fibration"}
3333

3434
A **discrete fibration** is a [[displayed category]] whose [[fibre
3535
categories]] are all _discrete categories_: thin, univalent groupoids.
@@ -203,7 +203,7 @@ that every vertical morphism in a discrete fibration is invertible.
203203
x''≡x' = ap fst (discrete→vertical-id disc (x' , f'))
204204
```
205205

206-
## Discrete fibrations are presheaves
206+
## Discrete fibrations are presheaves {defines="discrete-fibrations-are-presheaves"}
207207

208208
As noted earlier, a discrete fibration over $\cB$ encodes the same
209209
data as a presheaf on $\cB$. First, let us show that we can construct

src/Cat/Displayed/Cocartesian.lagda.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ cocartesian→precompose-equiv cocart =
384384
```
385385

386386

387-
## Cocartesian lifts
387+
## Cocartesian lifts {defines="cocartesian-lift"}
388388

389389
We call an object $b'$ over $b$ together with a cartesian arrow
390390
$f' : a \to_{f} b'$ a **cocartesian lift** of $f$.
Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
---
2+
description: |
3+
Comma categories as two-sided displayed categories.
4+
---
5+
<!--
6+
```agda
7+
open import Cat.Displayed.TwoSided.Discrete
8+
open import Cat.Displayed.Cocartesian
9+
open import Cat.Displayed.Cartesian
10+
open import Cat.Instances.Product
11+
open import Cat.Displayed.Base
12+
open import Cat.Prelude
13+
14+
import Cat.Functor.Reasoning
15+
import Cat.Reasoning
16+
```
17+
-->
18+
```agda
19+
module Cat.Displayed.Instances.Comma where
20+
```
21+
22+
# Comma categories as displayed categories
23+
24+
We can neatly present [[comma categories]] as categories displayed over
25+
product categories.
26+
27+
<!--
28+
```agda
29+
module _
30+
{oa ℓa ob ℓb oc ℓc}
31+
{A : Precategory oa ℓa}
32+
{B : Precategory ob ℓb}
33+
{C : Precategory oc ℓc}
34+
(F : Functor A C)
35+
(G : Functor B C)
36+
where
37+
private
38+
module A = Cat.Reasoning A
39+
module B = Cat.Reasoning B
40+
module C = Cat.Reasoning C
41+
module F = Cat.Functor.Reasoning F
42+
module G = Cat.Functor.Reasoning G
43+
44+
open Displayed
45+
```
46+
-->
47+
48+
```agda
49+
Comma : Displayed (A ×ᶜ B) ℓc ℓc
50+
Comma .Ob[_] (a , b) = C.Hom (F.₀ a) (G.₀ b)
51+
Comma .Hom[_] (u , v) f g = G.₁ v C.∘ f ≡ g C.∘ F.₁ u
52+
Comma .Hom[_]-set _ _ _ = hlevel 2
53+
Comma .id' = C.eliml G.F-id ∙ C.intror F.F-id
54+
Comma ._∘'_ α β = G.popr β ∙ sym (F.shufflel (sym α))
55+
Comma .idr' _ = prop!
56+
Comma .idl' _ = prop!
57+
Comma .assoc' _ _ _ = prop!
58+
```
59+
60+
## Comma categories are discrete two-sided fibrations
61+
62+
<!--
63+
```agda
64+
module _
65+
{oa ℓa ob ℓb oc ℓc}
66+
{A : Precategory oa ℓa}
67+
{B : Precategory ob ℓb}
68+
{C : Precategory oc ℓc}
69+
{F : Functor A C}
70+
{G : Functor B C}
71+
where
72+
private
73+
module A = Cat.Reasoning A
74+
module B = Cat.Reasoning B
75+
module C = Cat.Reasoning C
76+
module F = Cat.Functor.Reasoning F
77+
module G = Cat.Functor.Reasoning G
78+
79+
open is-discrete-two-sided-fibration
80+
open Displayed
81+
```
82+
-->
83+
84+
Comma categories are [[discrete two-sided fibrations]].
85+
86+
```agda
87+
Comma-is-discrete-two-sided-fibration
88+
: is-discrete-two-sided-fibration (Comma F G)
89+
Comma-is-discrete-two-sided-fibration .fibre-set _ _ = hlevel 2
90+
Comma-is-discrete-two-sided-fibration .cart-lift f g .centre =
91+
g C.∘ F.₁ f , C.eliml G.F-id
92+
Comma-is-discrete-two-sided-fibration .cart-lift f g .paths (h , p) =
93+
Σ-prop-path! (sym p ∙ C.eliml G.F-id)
94+
Comma-is-discrete-two-sided-fibration .cocart-lift f g .centre =
95+
G.₁ f C.∘ g , C.intror F.F-id
96+
Comma-is-discrete-two-sided-fibration .cocart-lift f g .paths (h , p) =
97+
Σ-prop-path! (p ∙ C.elimr F.F-id)
98+
Comma-is-discrete-two-sided-fibration .vert-lift {x = f} {y = g} {u = h} {v = k} p =
99+
G.F₁ B.id C.∘ G.F₁ k C.∘ f ≡⟨ C.eliml G.F-id ⟩
100+
G.F₁ k C.∘ f ≡⟨ p ⟩
101+
g C.∘ F.₁ h ≡⟨ C.intror F.F-id ⟩
102+
(g C.∘ F.F₁ h) C.∘ F.F₁ A.id ∎
103+
Comma-is-discrete-two-sided-fibration .factors _ = prop!
104+
```
105+
106+
Every *$B$-vertical* morphism in a discrete two-sided fibration is [[cartesian|cartesian morphism]],
107+
but this is not neccesarily true of *every* morphism. In our setting,
108+
the cartesian maps are given by squares that satisfy the following
109+
pasting property: for every (potentially non-commutative) square of the below
110+
form, if the overall rectangle commutes, then the upper square commutes.
111+
112+
~~~{.quiver}
113+
\begin{tikzcd}
114+
F(A) && G(Y) \\
115+
\\
116+
F(W) && G(Y) \\
117+
\\
118+
F(X) && G(Z)
119+
\arrow["h", from=1-1, to=1-3]
120+
\arrow["F(j)"', from=1-1, to=3-1]
121+
\arrow["G(k)", from=1-3, to=3-3]
122+
\arrow["f", from=3-1, to=3-3]
123+
\arrow["F(u)"', from=3-1, to=5-1]
124+
\arrow["G(v)", from=3-3, to=5-3]
125+
\arrow["g"', from=5-1, to=5-3]
126+
\end{tikzcd}
127+
~~~
128+
129+
```agda
130+
pasting→comma-cartesian
131+
: ∀ {w x y z} {u : A.Hom w x} {v : B.Hom y z} {f : C.Hom (F.₀ w) (G.₀ y)} {g : C.Hom (F.₀ x) (G.₀ z)}
132+
→ (p : G.₁ v C.∘ f ≡ g C.∘ F.₁ u)
133+
→ (∀ {a b} {h : C.Hom (F.₀ a) (G.₀ b)} {j : A.Hom a w} {k : B.Hom b y}
134+
→ G.₁ v C.∘ G.₁ k C.∘ h ≡ g C.∘ F.₁ u C.∘ F.₁ j
135+
→ G.₁ k C.∘ h ≡ f C.∘ F.₁ j)
136+
→ is-cartesian (Comma F G) (u , v) p
137+
pasting→comma-cartesian p paste .is-cartesian.universal _ outer =
138+
paste (C.pulll (sym $ G.F-∘ _ _) ·· outer ·· ap₂ C._∘_ refl (F.F-∘ _ _))
139+
pasting→comma-cartesian p paste .is-cartesian.commutes _ _ = prop!
140+
pasting→comma-cartesian p paste .is-cartesian.unique _ _ = prop!
141+
142+
comma-cartesian→pasting
143+
: ∀ {w x y z} {u : A.Hom w x} {v : B.Hom y z} {f : C.Hom (F.₀ w) (G.₀ y)} {g : C.Hom (F.₀ x) (G.₀ z)}
144+
→ (p : G.₁ v C.∘ f ≡ g C.∘ F.₁ u)
145+
→ is-cartesian (Comma F G) (u , v) p
146+
→ ∀ {a b} {h : C.Hom (F.₀ a) (G.₀ b)} {j : A.Hom a w} {k : B.Hom b y}
147+
→ G.₁ v C.∘ G.₁ k C.∘ h ≡ g C.∘ F.₁ u C.∘ F.₁ j
148+
→ G.₁ k C.∘ h ≡ f C.∘ F.₁ j
149+
comma-cartesian→pasting p p-cart outer =
150+
is-cartesian.universal p-cart _ $
151+
C.pushl (G.F-∘ _ _) ·· outer ·· ap₂ C._∘_ refl (sym $ F.F-∘ _ _)
152+
```
153+
154+
Moreover, a square is [[cocartesian|cocartesian-morphism]] when it satisfies
155+
the dual pasting lemma.
156+
157+
```agda
158+
pasting→comma-cocartesian
159+
: ∀ {w x y z} {u : A.Hom w x} {v : B.Hom y z} {f : C.Hom (F.₀ w) (G.₀ y)} {g : C.Hom (F.₀ x) (G.₀ z)}
160+
→ (p : G.₁ v C.∘ f ≡ g C.∘ F.₁ u)
161+
→ (∀ {a b} {h : C.Hom (F.₀ a) (G.₀ b)} {j : A.Hom x a} {k : B.Hom z b}
162+
→ G.₁ k C.∘ G.₁ v C.∘ f ≡ h C.∘ F.₁ j C.∘ F.₁ u
163+
→ G.₁ k C.∘ g ≡ h C.∘ F.₁ j)
164+
→ is-cocartesian (Comma F G) (u , v) p
165+
166+
comma-cocartesian→pasting
167+
: ∀ {w x y z} {u : A.Hom w x} {v : B.Hom y z} {f : C.Hom (F.₀ w) (G.₀ y)} {g : C.Hom (F.₀ x) (G.₀ z)}
168+
→ (p : G.₁ v C.∘ f ≡ g C.∘ F.₁ u)
169+
→ is-cocartesian (Comma F G) (u , v) p
170+
→ ∀ {a b} {h : C.Hom (F.₀ a) (G.₀ b)} {j : A.Hom x a} {k : B.Hom z b}
171+
→ G.₁ k C.∘ G.₁ v C.∘ f ≡ h C.∘ F.₁ j C.∘ F.₁ u
172+
→ G.₁ k C.∘ g ≡ h C.∘ F.₁ j
173+
174+
```
175+
176+
<details>
177+
<summary>The proofs are formally dual, so we omit them.
178+
</summary>
179+
180+
```agda
181+
pasting→comma-cocartesian p paste .is-cocartesian.universal _ outer =
182+
paste (C.pulll (sym $ G.F-∘ _ _) ·· outer ·· ap₂ C._∘_ refl (F.F-∘ _ _))
183+
pasting→comma-cocartesian p paste .is-cocartesian.commutes _ _ = prop!
184+
pasting→comma-cocartesian p paste .is-cocartesian.unique _ _ = prop!
185+
186+
comma-cocartesian→pasting p p-cocart outer =
187+
is-cocartesian.universal p-cocart _ $
188+
C.pushl (G.F-∘ _ _) ·· outer ·· ap₂ C._∘_ refl (sym $ F.F-∘ _ _)
189+
```
190+
</details>
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
---
2+
description: |
3+
Two-sided fibrations.
4+
---
5+
<!--
6+
```agda
7+
open import Cat.Displayed.BeckChevalley
8+
open import Cat.Displayed.Cocartesian
9+
open import Cat.Displayed.Cartesian
10+
open import Cat.Instances.Product
11+
open import Cat.Displayed.Base
12+
open import Cat.Prelude
13+
14+
import Cat.Displayed.Reasoning
15+
import Cat.Displayed.Morphism
16+
import Cat.Reasoning
17+
```
18+
-->
19+
```agda
20+
module Cat.Displayed.TwoSided where
21+
```
22+
23+
# Two-sided fibrations
24+
25+
One useful perspective on [[cartesian fibrations]] and [[cocartesian fibrations]]
26+
is that they are (co)presheaves of categories. This raises a natural question: what
27+
is the appropriate generalization of profunctors?
28+
29+
<!--
30+
```agda
31+
module _
32+
{oa ℓa ob ℓb oe ℓe}
33+
{A : Precategory oa ℓa} {B : Precategory ob ℓb}
34+
(E : Displayed (A ×ᶜ B) oe ℓe)
35+
where
36+
private
37+
module A = Cat.Reasoning A
38+
module B = Cat.Reasoning B
39+
open Cat.Displayed.Reasoning E
40+
open Cat.Displayed.Morphism E
41+
open Displayed E
42+
```
43+
-->
44+
45+
:::{.definition #two-sided-fibration}
46+
A displayed category $\cE \liesover \cA \times \cB$ is a **two-sided fibration**
47+
when it satisfies the following 3 conditions:
48+
49+
1. We are given an operation assigning [[cartesian lifts]]
50+
$\pi_{u, Y} : \cE_{u, \id}(u^{*}(Y), Y)$ to each $u : \cA(A_1, A_2)$, $B : \cB$, and $Y : \cE_{A_2, B}$.
51+
52+
2. Similarly, to each $A : \cA, v : \cB(B_1, B_2)$ and $X : \cE_{A, B_1}$,
53+
we are equipped with a [[cocartesian lift]] $\iota_{v, X} : \cE_{\id, v}(X, v_{!}(X))$.
54+
55+
3. For every diagram of the form below with $f$ cocartesian and $g$ cartesian,
56+
$h$ is cartesian if and only if $k$ is cocartesian.
57+
58+
~~~{.quiver}
59+
\begin{tikzcd}
60+
W && X \\
61+
& Y && Z \\
62+
{(A_1, B_1)} && {(A_2, B_1)} \\
63+
& {(A_1, B_2)} && {(A_2, B_2)}
64+
\arrow["g", from=1-1, to=1-3]
65+
\arrow["k", from=1-1, to=2-2]
66+
\arrow[from=1-1, to=3-1]
67+
\arrow["f", from=1-3, to=2-4]
68+
\arrow[from=1-3, to=3-3]
69+
\arrow["h"{pos=0.3}, from=2-2, to=2-4]
70+
\arrow[from=2-2, to=4-2]
71+
\arrow[from=2-4, to=4-4]
72+
\arrow["{(u,\id)}"{pos=0.7}, from=3-1, to=3-3]
73+
\arrow["{(\id, v)}"', from=3-1, to=4-2]
74+
\arrow["{(\id, v)}", from=3-3, to=4-4]
75+
\arrow["{(u,\id)}"', from=4-2, to=4-4]
76+
\end{tikzcd}
77+
~~~
78+
:::
79+
80+
81+
```agda
82+
record Two-sided-fibration : Type (oa ⊔ ℓa ⊔ ob ⊔ ℓb ⊔ oe ⊔ ℓe) where
83+
no-eta-equality
84+
field
85+
cart-lift
86+
: ∀ {a₁ a₂ : A.Ob} {b : B.Ob}
87+
→ (u : A.Hom a₁ a₂)
88+
→ (y' : Ob[ a₂ , b ])
89+
→ Cartesian-lift E (u , B.id) y'
90+
cocart-lift
91+
: ∀ {a : A.Ob} {b₁ b₂ : B.Ob}
92+
→ (v : B.Hom b₁ b₂)
93+
→ (x' : Ob[ a , b₁ ])
94+
→ Cocartesian-lift E (A.id , v) x'
95+
cart-beck-chevalley
96+
: ∀ {a₁ a₂ : A.Ob} {b₁ b₂ : B.Ob}
97+
→ {u : A.Hom a₁ a₂} {v : B.Hom b₁ b₂}
98+
→ right-beck-chevalley E
99+
(A.id , v) (u , B.id) (u , B.id) (A.id , v)
100+
(sym A.id-comm ,ₚ B.id-comm)
101+
cocart-beck-chevalley
102+
: ∀ {a₁ a₂ : A.Ob} {b₁ b₂ : B.Ob}
103+
→ {u : A.Hom a₁ a₂} {v : B.Hom b₁ b₂}
104+
→ left-beck-chevalley E
105+
(A.id , v) (u , B.id) (u , B.id) (A.id , v)
106+
(sym A.id-comm ,ₚ B.id-comm)
107+
```
108+
109+
This definition is rather opaque, so let's break it down. The first two
110+
conditions ensure that we have 2 functorial actions on each of the [[fibre categories]]
111+
$E_{a, b}$: the first acts contravariantly in $\cA$, the second covariantly
112+
in $\cB$. These are analogs to the actions $P(-, \id)$ and $P(\id, -)$ of
113+
a profunctor $P : \cA \times \cB \to \Sets$. The final condition serves to
114+
ensure that the [[base change]] and [[cobase change]] functors
115+
$u^{*} : \cE_{A_2, B} \to \cE_{A_1, B}$ and $v_{!} : \cE_{A, B_1} \to \cE_{A, B_2}$
116+
preserve cocartesian and cartesian morphisms, resp.

0 commit comments

Comments
 (0)