Slice.agda 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. module Slice where
  2. open import Logic.Relations
  3. open import Logic.Equivalence
  4. open import Logic.Base
  5. open import Category
  6. module SliceCat (ℂ : Cat)(Γ : Category.Obj ℂ) where
  7. open module CC = Category.Category ℂ
  8. record SlObj : Set1 where
  9. field
  10. dom : Obj
  11. arr : dom ─→ Γ
  12. record _Sl→_ (f f' : SlObj) : Set where
  13. field
  14. h : (SlObj.dom f) ─→ (SlObj.dom f')
  15. π : (SlObj.arr f') ∘ h == (SlObj.arr f)
  16. SlId : {f : SlObj} -> f Sl→ f
  17. SlId = record
  18. { h = id
  19. ; π = idRight
  20. }
  21. _o_ : {f f' f'' : SlObj} -> f' Sl→ f'' -> f Sl→ f' -> f Sl→ f''
  22. _o_ {F} {F'} {F''} F₁ F₂ =
  23. let f = SlObj.arr F in
  24. let f' = SlObj.arr F' in
  25. let f'' = SlObj.arr F'' in
  26. let h' = _Sl→_.h F₁ in
  27. let h = _Sl→_.h F₂ in
  28. record
  29. { h = (_Sl→_.h F₁) ∘ (_Sl→_.h F₂)
  30. -- Proof of f'' ∘ (h' ∘ h) == f
  31. ; π = trans (trans (sym assoc)
  32. (congL (_Sl→_.π F₁)))
  33. (_Sl→_.π F₂)
  34. }
  35. SlRel : {A B : SlObj} -> Rel (A Sl→ B)
  36. SlRel f f' = (_Sl→_.h f) == (_Sl→_.h f')
  37. SlRefl : {A B : SlObj} -> Reflexive {A Sl→ B} SlRel
  38. SlRefl = refl
  39. SlSym : {A B : SlObj} -> Symmetric {A Sl→ B} SlRel
  40. SlSym = sym
  41. SlTrans : {A B : SlObj} -> Transitive {A Sl→ B} SlRel
  42. SlTrans = trans
  43. SlEq : {A B : SlObj} -> Equivalence (A Sl→ B)
  44. SlEq {A} {B} = record
  45. { _==_ = SlRel {A} {B}
  46. ; refl = \{f : A Sl→ B} -> SlRefl {A}{B}{f}
  47. ; sym = \{f g : A Sl→ B} -> SlSym {A}{B}{f}{g}
  48. ; trans = \{f g h : A Sl→ B} -> SlTrans {A}{B}{f}{g}{h}
  49. }
  50. SlCong : {A B C : SlObj}{f f' : B Sl→ C}{g g' : A Sl→ B} ->
  51. SlRel f f' -> SlRel g g' -> SlRel (f o g) (f' o g')
  52. SlCong = cong
  53. SlIdLeft : {A B : SlObj}{f : A Sl→ B} -> SlRel (SlId o f) f
  54. SlIdLeft = idLeft
  55. SlIdRight : {A B : SlObj}{f : A Sl→ B} -> SlRel (f o SlId) f
  56. SlIdRight = idRight
  57. SlAssoc : {A B C D : SlObj}{f : C Sl→ D}{g : B Sl→ C}{h : A Sl→ B} ->
  58. SlRel ((f o g) o h) (f o (g o h))
  59. SlAssoc = assoc
  60. Slice : Cat
  61. Slice = record
  62. { Obj = SlObj
  63. ; _─→_ = _Sl→_
  64. ; id = SlId
  65. ; _∘_ = _o_
  66. ; Eq = SlEq
  67. ; cong = \{A B C : SlObj}{f f' : B Sl→ C}{g g' : A Sl→ B} -> SlCong {A}{B}{C}{f}{f'}{g}{g'}
  68. ; idLeft = \{A B : SlObj}{f : A Sl→ B} -> SlIdLeft {A} {B} {f}
  69. ; idRight = \{A B : SlObj}{f : A Sl→ B} -> SlIdRight {A} {B} {f}
  70. ; assoc = \{A B C D : SlObj}{f : C Sl→ D}{g : B Sl→ C}{h : A Sl→ B} ->
  71. SlAssoc {A}{B}{C}{D}{f}{g}{h}
  72. }