Example.agda 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. module Example where
  2. open import Logic.Identity
  3. open import Base
  4. open import Category
  5. open import Product
  6. open import Terminal
  7. open import Unique
  8. import Iso
  9. infixr 30 _─→_
  10. infixr 90 _∘_
  11. data Name : Set where
  12. Zero : Name
  13. One : Name
  14. Half : Name
  15. data Obj : Set1 where
  16. obj : Name -> Obj
  17. mutual
  18. _─→'_ : Name -> Name -> Set
  19. x ─→' y = obj x ─→ obj y
  20. data _─→_ : Obj -> Obj -> Set where
  21. Idle : {A : Name} -> A ─→' A
  22. All : Zero ─→' One
  23. Start : Zero ─→' Half
  24. Turn : Half ─→' Half
  25. Back : One ─→' Half
  26. End : Half ─→' One
  27. id : {A : Obj} -> A ─→ A
  28. id {obj x} = Idle
  29. _∘_ : {A B C : Obj} -> B ─→ C -> A ─→ B -> A ─→ C
  30. f ∘ Idle = f
  31. Idle ∘ All = All
  32. Idle ∘ Start = Start
  33. Turn ∘ Start = Start
  34. End ∘ Start = All
  35. Idle ∘ Turn = Turn
  36. Turn ∘ Turn = Turn
  37. End ∘ Turn = End
  38. Idle ∘ Back = Back
  39. Turn ∘ Back = Back
  40. End ∘ Back = Idle
  41. Idle ∘ End = End
  42. idL : {A B : Obj}{f : A ─→ B} -> id ∘ f ≡ f
  43. idL {f = Idle } = refl
  44. idL {f = All } = refl
  45. idL {f = Start } = refl
  46. idL {f = Turn } = refl
  47. idL {f = Back } = refl
  48. idL {f = End } = refl
  49. idR : {A B : Obj}{f : A ─→ B} -> f ∘ id ≡ f
  50. idR {obj _} = refl
  51. assoc : {A B C D : Obj}{f : C ─→ D}{g : B ─→ C}{h : A ─→ B} ->
  52. (f ∘ g) ∘ h ≡ f ∘ (g ∘ h)
  53. assoc {f = _ }{g = _ }{h = Idle } = refl
  54. assoc {f = _ }{g = Idle}{h = All } = refl
  55. assoc {f = _ }{g = Idle}{h = Start} = refl
  56. assoc {f = Idle}{g = Turn}{h = Start} = refl
  57. assoc {f = Turn}{g = Turn}{h = Start} = refl
  58. assoc {f = End }{g = Turn}{h = Start} = refl
  59. assoc {f = Idle}{g = End }{h = Start} = refl
  60. assoc {f = _ }{g = Idle}{h = Turn } = refl
  61. assoc {f = Idle}{g = Turn}{h = Turn } = refl
  62. assoc {f = Turn}{g = Turn}{h = Turn } = refl
  63. assoc {f = End }{g = Turn}{h = Turn } = refl
  64. assoc {f = Idle}{g = End }{h = Turn } = refl
  65. assoc {f = _ }{g = Idle}{h = Back } = refl
  66. assoc {f = Idle}{g = Turn}{h = Back } = refl
  67. assoc {f = Turn}{g = Turn}{h = Back } = refl
  68. assoc {f = End }{g = Turn}{h = Back } = refl
  69. assoc {f = Idle}{g = End }{h = Back } = refl
  70. assoc {f = _ }{g = Idle}{h = End } = refl
  71. ℂ : Cat
  72. ℂ = cat Obj _─→_ id _∘_
  73. (\{_}{_} -> Equiv)
  74. (\{_}{_}{_} -> cong2 _∘_)
  75. idL idR assoc
  76. open module T = Term ℂ
  77. open module I = Init ℂ
  78. open module S = Sum ℂ
  79. term : Terminal (obj One)
  80. term (obj Zero) = ?
  81. init : Initial (obj Zero)
  82. init = ?