Skip to content

Commit ec57da0

Browse files
TOTBWFplt-amyncfavier
authored andcommitted
chore: refactor liftings & orthogonality (the1lab#555)
This PR refactors the APIs for lifting and orthogonality properties, and also redefines projective/injective objects in terms of lifts. I've also made some minor code improvements along the way, like pulling out `Factorisation` into its own module. Closes the1lab#552. --------- Co-authored-by: Amélia <[email protected]> Co-authored-by: Naïm Camille Favier <[email protected]>
1 parent da79271 commit ec57da0

29 files changed

+1415
-893
lines changed

src/1Lab/Truncation.lagda.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,13 @@ from the HoTT book. For example, a type $X$ is said _merely equivalent_
222222
to $Y$ if the type $\| X \equiv Y \|$ is inhabited.
223223
:::
224224

225+
<!--
226+
```agda
227+
is-prop∥∥→is-contr : ∀ {ℓ} {P : Type ℓ} → is-prop P → ∥ P ∥ → is-contr P
228+
is-prop∥∥→is-contr pprop mp = is-prop∙→is-contr pprop (∥-∥-out pprop mp)
229+
```
230+
-->
231+
225232
## Maps into sets
226233

227234
The elimination principle for $\| A \|$ says that we can only use the

src/Borceux.lagda.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ open import Algebra.Group.Cat.Base
1010
open import Algebra.Group.Free hiding (_◆_)
1111
open import Algebra.Group.Ab
1212
13+
open import Cat.Morphism.Factorisation.Orthogonal
1314
open import Cat.Diagram.Coequaliser.RegularEpi
1415
open import Cat.Functor.Adjoint.Epireflective
1516
open import Cat.Functor.Adjoint.Representable
@@ -89,6 +90,7 @@ open import Cat.Instances.Slice
8990
open import Cat.Functor.Closed
9091
open import Cat.Instances.Free
9192
open import Cat.Instances.Sets
93+
open import Cat.Morphism.Lifts
9294
open import Cat.Diagram.Monad
9395
open import Cat.Functor.Final
9496
open import Cat.Functor.Joint
@@ -786,7 +788,7 @@ _ = Karoubi-is-completion
786788
```agda
787789
_ = is-regular-epi
788790
_ = is-strong-epi
789-
_ = strong-epi-∘
791+
_ = ∘-is-strong-epic
790792
_ = strong-epi-cancelr
791793
_ = strong-epi+mono→invertible
792794
_ = is-regular-epi→is-strong-epi
@@ -799,7 +801,7 @@ _ = is-extremal-epi→is-strong-epi
799801
* Definition 4.3.1: `is-regular-epi`{.Agda}
800802
* Definition 4.3.5: `is-strong-epi`{.Agda}
801803
* Proposition 4.3.6:
802-
* 1. `strong-epi-∘`{.Agda}
804+
* 1. `∘-is-strong-epic`{.Agda}
803805
* 2. `strong-epi-cancelr`{.Agda}
804806
* 3. `strong-epi-mono→invertible`{.Agda}
805807
* 4. `is-regular-epi→is-strong-epi`{.Agda}
@@ -954,9 +956,7 @@ _ = Localisation
954956

955957
<!--
956958
```agda
957-
_ = m⊥m
958-
_ = m⊥o
959-
_ = o⊥m
959+
_ = Orthogonal
960960
_ = object-orthogonal-!-orthogonal
961961
_ = in-subcategory→orthogonal-to-inverted
962962
_ = orthogonal-to-ηs→in-subcategory
@@ -966,8 +966,8 @@ _ = in-subcategory→orthogonal-to-ηs
966966

967967
* Definition 5.4.1: `m⊥m`{.Agda}
968968
* Definition 5.4.2:
969-
1. `m⊥o`{.Agda}
970-
2. `o⊥m`{.Agda}
969+
1. `Orthogonal`{.Agda}
970+
2. `Orthogonal`{.Agda}
971971
* Proposition 5.4.3: `object-orthogonal-!-orthogonal`{.Agda}
972972
* Proposition 5.4.4:
973973
* 1.
@@ -978,9 +978,9 @@ _ = in-subcategory→orthogonal-to-ηs
978978

979979
<!--
980980
```agda
981-
_ = is-factorisation-system
981+
_ = is-ofs
982982
_ = factorisation-essentially-unique
983-
_ = E-is-⊥M
983+
_ = L-is-⊥R
984984
_ = in-intersection≃is-iso
985985
```
986986
-->
@@ -1116,5 +1116,3 @@ _ = const-nato
11161116
* Exercise 8.4.6:
11171117
* (⇒) `dependent-product→lcc`{.Agda}
11181118
* (⇐) `lcc→dependent-product`{.Agda}
1119-
1120-
[[marked graph homomorphism]]

src/Cat/Bi/Instances/Relations.lagda.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,10 @@ into a subobject.]
201201
open Relation t renaming (src to t₁ ; tgt to t₂) hiding (rel)
202202
203203
i : ∀ {x y} {f : Hom x y} → Hom im[ f ] y
204-
i = factor _ .forget
204+
i = factor _ .right
205205
206206
q : ∀ {x y} {f : Hom x y} → Hom x im[ f ]
207-
q = factor _ .mediate
207+
q = factor _ .left
208208
209209
ξ₁ = [rs]t.inter .p₁
210210
ξ₂ = [rs]t.inter .p₂
@@ -374,7 +374,7 @@ Since $q$ is a strong epi, $\alpha$ is, too.
374374
α-is-pb = pasting-outer→left-is-pullback ([rs]t.inter .has-is-pb) rem₁ ([rs]t.inter .p₂∘universal)
375375
376376
α-cover : is-strong-epi C α
377-
α-cover = stable _ _ (□-out! (factor rs.it .mediate∈E)) α-is-pb
377+
α-cover = stable _ _ (factor rs.it .left∈L) α-is-pb
378378
```
379379

380380
The purpose of all this calculation is the following: Postcomposing with
@@ -433,7 +433,7 @@ want to look at the formalisation.
433433
(r[st].inter .p₁∘universal)
434434
435435
β-cover : is-strong-epi C β
436-
β-cover = stable _ _ (□-out! (factor st.it .mediate∈E)) β-is-pb
436+
β-cover = stable _ _ (factor st.it .left∈L) β-is-pb
437437
438438
r[st]≅i : Im r[st].it Sub.≅ Im j
439439
r[st]≅i = subst (λ e → Im r[st].it Sub.≅ Im e)
@@ -474,7 +474,7 @@ but keep in mind that they are not commented.
474474
```agda
475475
∘-rel-monotone {r = r} {r'} {s} {s'} α β =
476476
Im-universal (∘-rel.it r s) _
477-
{e = factor _ .mediate ∘ ∘-rel.inter r' s' .universal
477+
{e = factor _ .left ∘ ∘-rel.inter r' s' .universal
478478
{p₁' = β .map ∘ ∘-rel.inter _ _ .p₁}
479479
{p₂' = α .map ∘ ∘-rel.inter _ _ .p₂}
480480
( pullr (pulll (sym (β .com) ∙ idl _))
@@ -497,7 +497,7 @@ but keep in mind that they are not commented.
497497
(assoc _ _ _)
498498
499499
f≤fid : f ≤ₘ ∘-rel f id-rel
500-
f≤fid .map = factor _ .mediate
500+
f≤fid .map = factor _ .left
501501
∘-rel.inter f id-rel .universal {p₁' = Relation.src f} {p₂' = id}
502502
(eliml π₂∘⟨⟩ ∙ intror refl)
503503
f≤fid .com = idl _ ∙ sym (pulll (sym (factor _ .factors)) ∙ ⟨⟩∘ _ ∙ sym (⟨⟩-unique
@@ -511,7 +511,7 @@ but keep in mind that they are not commented.
511511
(assoc _ _ _ ∙ ∘-rel.inter id-rel f .square ∙ eliml π₁∘⟨⟩ ∙ introl π₂∘⟨⟩)
512512
513513
f≤idf : f ≤ₘ ∘-rel id-rel f
514-
f≤idf .map = factor _ .mediate
514+
f≤idf .map = factor _ .left
515515
∘-rel.inter id-rel f .universal {p₁' = id} {p₂' = Relation.tgt f}
516516
(idr _ ∙ sym (eliml π₁∘⟨⟩))
517517
f≤idf .com = idl _ ∙ sym (pulll (sym (factor _ .factors)) ∙ ⟨⟩∘ _ ∙ sym (⟨⟩-unique

src/Cat/Diagram/Coequaliser/RegularEpi.lagda.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ module _ {o ℓ oj ℓj}
143143
{C : Precategory o ℓ} {J : Precategory oj ℓj}
144144
{F : Functor J C}
145145
(∐Ob : has-coproducts-indexed-by C ⌞ J ⌟)
146-
(∐Hom : has-coproducts-indexed-by C (Arrows J))
146+
(∐Hom : has-coproducts-indexed-by C (Arrow J))
147147
(∐F : Colimit F)
148148
where
149149
```

src/Cat/Diagram/Colimit/Base.lagda.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -578,10 +578,10 @@ module _ {o ℓ} {C : Precategory o ℓ} where
578578
colimit-as-coequaliser-of-coproduct
579579
: ∀ {oj ℓj} {J : Precategory oj ℓj}
580580
→ has-coproducts-indexed-by C ⌞ J ⌟
581-
→ has-coproducts-indexed-by C (Arrows J)
581+
→ has-coproducts-indexed-by C (Arrow J)
582582
→ has-coequalisers C
583583
→ (F : Functor J C) → Colimit F
584-
colimit-as-coequaliser-of-coproduct {oj} {ℓj} {J} has-Ob-cop has-Arrows-cop has-coeq F =
584+
colimit-as-coequaliser-of-coproduct {oj} {ℓj} {J} has-Ob-cop has-Arrow-cop has-coeq F =
585585
to-colimit (to-is-colimit colim) where
586586
```
587587

@@ -616,15 +616,15 @@ and the second morphism to be the injection into the codomain component precompo
616616

617617
~~~{.quiver}
618618
\[\begin{tikzcd}
619-
{\displaystyle \coprod_{(f : a \to b) : \text{Arrows}(\mathcal J)} F(a)} & {\displaystyle \coprod_{o : \text{Ob}(\mathcal J)} F(o)}
619+
{\displaystyle \coprod_{(f : a \to b) : \text{Arrow}(\mathcal J)} F(a)} & {\displaystyle \coprod_{o : \text{Ob}(\mathcal J)} F(o)}
620620
\arrow["{\iota_a}", shift left, from=1-1, to=1-2]
621621
\arrow["{\iota_b \circ F(f)}"', shift right, from=1-1, to=1-2]
622622
\end{tikzcd}\]
623623
~~~
624624

625625
```agda
626-
Dom : Indexed-coproduct C {Idx = Arrows J} λ (a , b , f) → F₀ a
627-
Dom = has-Arrows-cop _
626+
Dom : Indexed-coproduct C {Idx = Arrow J} λ (a , b , f) → F₀ a
627+
Dom = has-Arrow-cop _
628628
629629
s t : C.Hom (Dom .ΣF) (Obs .ΣF)
630630
s = Dom .match λ (a , b , f) → Obs .ι b C.∘ F₁ f

src/Cat/Diagram/Injective.lagda.md

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ open import Cat.Diagram.Pullback.Along
1010
open import Cat.Diagram.Pullback
1111
open import Cat.Functor.Morphism
1212
open import Cat.Diagram.Product
13+
open import Cat.Morphism.Lifts
1314
open import Cat.Diagram.Omega
1415
open import Cat.Functor.Hom
1516
open import Cat.Prelude hiding (Ω; true)
@@ -65,9 +66,7 @@ relative to monomorphisms in $\cC$.
6566

6667
```agda
6768
is-injective : (A : Ob) → Type _
68-
is-injective A =
69-
∀ {X Y} (i : Hom X A) (m : X ↪ Y)
70-
→ ∃[ r ∈ Hom Y A ] (r ∘ m .mor ≡ i)
69+
is-injective A = Lifts C Monos A
7170
```
7271

7372
Classically, injective objects are usually very easy to find. For example.
@@ -98,10 +97,10 @@ epis. This directly gives us the factorization we need!
9897
preserves-epis→injective
9998
: preserves-epis (Hom-into C A)
10099
→ is-injective A
101-
preserves-epis→injective {A = A} hom-epi {X = X} {Y = Y} i m =
100+
preserves-epis→injective {A = A} hom-epi {X} {Y} m m-monic i =
102101
epi→surjective (el! (Hom Y A)) (el! (Hom X A))
103-
(_∘ m .mor)
104-
(λ {c} → hom-epi (m .monic) {c = c})
102+
(_∘ m)
103+
(λ {c} → hom-epi m-monic {c = c})
105104
i
106105
```
107106

@@ -122,7 +121,7 @@ injective→preserves-epis inj {f = m} m-mono g h p =
122121
g (r ∘ m) ≡⟨ p $ₚ r ⟩
123122
h (r ∘ m) ≡⟨ ap h r-retract ⟩
124123
h k ∎)
125-
(inj k (make-mono m m-mono))
124+
(inj m m-mono k)
126125
```
127126

128127
## Closure of injectives
@@ -180,9 +179,9 @@ $\pi_2 \circ \langle r_1 , r_2 \rangle \circ m = r_2 \circ m = i$, so $\langle r
180179
is a valid extension.
181180

182181
```agda
183-
product-injective {π₁ = π₁} {π₂ = π₂} A-inj B-inj prod i m = do
184-
(r₁ , r₁-factor) ← A-inj (π₁ ∘ i) m
185-
(r₂ , r₂-factor) ← B-inj (π₂ ∘ i) m
182+
product-injective {π₁ = π₁} {π₂ = π₂} A-inj B-inj prod m m-monic i = do
183+
(r₁ , r₁-factor) ← A-inj m m-monic (π₁ ∘ i)
184+
(r₂ , r₂-factor) ← B-inj m m-monic (π₂ ∘ i)
186185
pure (⟨ r₁ , r₂ ⟩ , unique₂ (pulll π₁∘⟨⟩) (pulll π₂∘⟨⟩) (sym r₁-factor) (sym r₂-factor))
187186
where open is-product prod
188187
```
@@ -223,11 +222,11 @@ each extension $r_i$ for each $i : I$, whereas we need the mere existence of
223222
but we can avoid this by requiring that $I$ be set-projective.
224223

225224
```agda
226-
indexed-coproduct-projective {Aᵢ = Aᵢ} {π = π} Idx-pro Aᵢ-inj prod {X = X} {Y = Y} ι m = do
225+
indexed-coproduct-projective {Aᵢ = Aᵢ} {π = π} Idx-pro Aᵢ-inj prod {X} {Y} m m-monic ι = do
227226
r ← Idx-pro
228-
(λ i → Σ[ rᵢ ∈ Hom Y (Aᵢ i) ] rᵢ ∘ m .mor ≡ π i ∘ ι)
227+
(λ i → Σ[ rᵢ ∈ Hom Y (Aᵢ i) ] rᵢ ∘ m ≡ π i ∘ ι)
229228
(λ _ → hlevel 2)
230-
(λ i → Aᵢ-inj i (π i ∘ ι) m)
229+
(λ i → Aᵢ-inj i m m-monic (π i ∘ ι))
231230
pure (tuple (λ i → r i .fst) , unique₂ (λ i → pulll commute ∙ r i .snd))
232231
where open is-indexed-product prod
233232
```
@@ -241,8 +240,8 @@ section→injective
241240
→ (r : Hom A S)
242241
→ has-section r
243242
→ is-injective S
244-
section→injective A-inj r s i m = do
245-
(t , t-factor) ← A-inj (s .section ∘ i) m
243+
section→injective A-inj r s m m-monic i = do
244+
(t , t-factor) ← A-inj m m-monic (s .section ∘ i)
246245
pure (r ∘ t , pullr t-factor ∙ cancell (s .is-section))
247246
```
248247

@@ -272,7 +271,7 @@ consider the following extension problem.
272271
~~~
273272

274273
```agda
275-
Ω-injective {Ω = Ω} {true = true} pullbacks Ω-subobj {X} {Y} i m =
274+
Ω-injective {Ω = Ω} {true = true} pullbacks Ω-subobj {X} {Y} m m-monic i =
276275
pure extension
277276
where
278277
open is-generic-subobject Ω-subobj
@@ -312,7 +311,7 @@ $X$, which we can then compose with $m$ to get a subobject of $Y$.
312311
[i] = named i
313312
314313
m∩[i] : Subobject Y
315-
m∩[i] = cutₛ (∘-is-monic (m .monic) ([i] .monic))
314+
m∩[i] = cutₛ (∘-is-monic m-monic ([i] .monic))
316315
```
317316

318317
We can then classify our subobject $m \circ [i]$ to get a map
@@ -364,13 +363,13 @@ This means that $\mathrm{name}(m \circ [i]) \circ m = i$, which completes
364363
the proof.
365364

366365
```agda
367-
extension : Σ[ i* ∈ Hom Y Ω ] i* ∘ m .mor ≡ i
366+
extension : Σ[ i* ∈ Hom Y Ω ] i* ∘ m ≡ i
368367
extension .fst = name m∩[i]
369368
extension .snd =
370369
Ω-unique₂ $
371370
paste-is-pullback-along
372371
(classifies m∩[i])
373-
(is-pullback-along-monic (m .monic))
372+
(is-pullback-along-monic m-monic)
374373
refl
375374
```
376375

src/Cat/Diagram/Limit/Base.lagda.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -716,10 +716,10 @@ module _ {o ℓ} {C : Precategory o ℓ} where
716716
limit-as-equaliser-of-product
717717
: ∀ {oj ℓj} {J : Precategory oj ℓj}
718718
→ has-products-indexed-by C ⌞ J ⌟
719-
→ has-products-indexed-by C (Arrows J)
719+
→ has-products-indexed-by C (Arrow J)
720720
→ has-equalisers C
721721
→ (F : Functor J C) → Limit F
722-
limit-as-equaliser-of-product {oj} {ℓj} {J} has-Ob-prod has-Arrows-prod has-eq F =
722+
limit-as-equaliser-of-product {oj} {ℓj} {J} has-Ob-prod has-Arrow-prod has-eq F =
723723
to-limit (to-is-limit lim) where
724724
```
725725

@@ -753,15 +753,15 @@ and the second morphism to be the projection of the domain postcomposed with $f$
753753

754754
~~~{.quiver}
755755
\[\begin{tikzcd}
756-
{\displaystyle \prod_{o : \text{Ob}(\mathcal J)} F(o)} & {\displaystyle \prod_{(f : a \to b) : \text{Arrows}(\mathcal J)} F(b)}
756+
{\displaystyle \prod_{o : \text{Ob}(\mathcal J)} F(o)} & {\displaystyle \prod_{(f : a \to b) : \text{Arrow}(\mathcal J)} F(b)}
757757
\arrow["{\pi_b}", shift left, from=1-1, to=1-2]
758758
\arrow["{F(f) \circ \pi_a}"', shift right, from=1-1, to=1-2]
759759
\end{tikzcd}\]
760760
~~~
761761

762762
```agda
763-
Cod : Indexed-product C {Idx = Arrows J} λ (a , b , f) → F₀ b
764-
Cod = has-Arrows-prod _
763+
Cod : Indexed-product C {Idx = Arrow J} λ (a , b , f) → F₀ b
764+
Cod = has-Arrow-prod _
765765
766766
s t : C.Hom (Obs .ΠF) (Cod .ΠF)
767767
s = Cod .tuple λ (a , b , f) → F₁ f C.∘ Obs .π a

src/Cat/Diagram/Limit/Finite.lagda.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ products).
103103
Finitely-complete→is-finitely-complete cat Flim finite =
104104
limit-as-equaliser-of-product
105105
(Cartesian→finite-products (Flim .terminal) (Flim .products) cat (finite .has-finite-Ob))
106-
(Cartesian→finite-products (Flim .terminal) (Flim .products) cat (finite .has-finite-Arrows))
106+
(Cartesian→finite-products (Flim .terminal) (Flim .products) cat (finite .has-finite-Arrow))
107107
(Flim .equalisers)
108108
109109
is-finitely-complete→Finitely-complete

0 commit comments

Comments
 (0)