Data.agda 1.6 KB

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