Nested.agda 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. {-# OPTIONS --type-in-type #-}
  2. module Nested where
  3. record Σ₁ (A : Set)(B : A → Set) : Set where
  4. constructor _,_
  5. field fst : A
  6. snd : B fst
  7. infixr 2 _,_
  8. record Σ (A : Set)(B : A → Set) : Set where
  9. field p : Σ₁ A B
  10. open Σ₁ p public
  11. open Σ
  12. data ⊤ : Set where
  13. tt : ⊤
  14. ∃ : {A : Set}(B : A → Set) → Set
  15. ∃ B = Σ _ B
  16. infix 10 _≡_
  17. data _≡_ {A : Set}(a : A) : {B : Set} → B → Set where
  18. refl : a ≡ a
  19. Cat : Set
  20. Cat =
  21. ∃ λ (Obj : Set) →
  22. ∃ λ (Hom : Obj → Obj → Set) →
  23. ∃ λ (id : ∀ X → Hom X X) →
  24. ∃ λ (_○_ : ∀ {X Y Z} → Hom Y Z → Hom X Y → Hom X Z) →
  25. ∃ λ (idl : ∀ {X Y}{f : Hom X Y} → (id Y ○ f) ≡ f) →
  26. ∃ λ (idr : ∀ {X Y}{f : Hom X Y} → (f ○ id X) ≡ f) →
  27. ∃ λ (assoc : ∀ {W X Y Z}{f : Hom W X}{g : Hom X Y}{h : Hom Y Z} →
  28. ((h ○ g) ○ f) ≡ (h ○ (g ○ f))) →
  29. Obj : (C : Cat) → Set
  30. Obj C = fst C
  31. Hom : (C : Cat) → Obj C → Obj C → Set
  32. Hom C = fst (snd C)
  33. id : (C : Cat) → ∀ X → Hom C X X
  34. id C = fst (snd (snd C))
  35. comp : (C : Cat) → ∀ {X Y Z} → Hom C Y Z → Hom C X Y → Hom C X Z
  36. comp C = fst (snd (snd (snd C)))
  37. idl : (C : Cat) → ∀ {X Y}{f : Hom C X Y} → comp C (id C Y) f ≡ f
  38. idl C = fst (snd (snd (snd (snd C))))
  39. idr : (C : Cat) → ∀ {X Y}{f : Hom C X Y} → comp C f (id C X) ≡ f
  40. idr C = fst (snd (snd (snd (snd (snd C)))))
  41. assoc : (C : Cat) → ∀ {W X Y Z}{f : Hom C W X}{g : Hom C X Y}{h : Hom C Y Z} →
  42. comp C (comp C h g) f ≡ comp C h (comp C g f)
  43. assoc C = fst (snd (snd (snd (snd (snd (snd C))))))