Mercurial > hg > Members > kono > Proof > category
annotate Comma.agda @ 479:a5034bdf6f38
Comma Category with A B C
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 09 Mar 2017 14:16:03 +0900 |
parents | dc24ac6ebdb3 |
children | 08f9c8a59ff4 |
rev | line source |
---|---|
477 | 1 open import Level |
2 open import Category | |
479
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
3 module Comma {c₁ c₂ ℓ c₁' c₂' ℓ' : Level} {A : Category c₁ c₂ ℓ} {B : Category c₁ c₂ ℓ} {C : Category c₁' c₂' ℓ'} |
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
4 ( F : Functor A C ) ( G : Functor B C ) where |
477 | 5 |
6 open import HomReasoning | |
7 open import cat-utility | |
8 | |
478 | 9 -- |
10 -- F G | |
11 -- A -> C <- B | |
12 -- | |
477 | 13 |
14 open Functor | |
15 | |
16 record CommaObj : Set ( c₁ ⊔ c₂' ) where | |
17 field | |
18 obj : Obj A | |
479
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
19 objb : Obj B |
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
20 hom : Hom C ( FObj F obj ) ( FObj G objb ) |
477 | 21 |
22 open CommaObj | |
23 | |
24 record CommaHom ( a b : CommaObj ) : Set ( c₂ ⊔ ℓ' ) where | |
25 field | |
26 arrow : Hom A ( obj a ) ( obj b ) | |
479
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
27 arrowg : Hom B ( objb a ) ( objb b ) |
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
28 comm : C [ C [ FMap G arrowg o hom a ] ≈ C [ hom b o FMap F arrow ] ] |
477 | 29 |
30 open CommaHom | |
31 | |
479
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
32 record _⋍_ { a b : CommaObj } ( f g : CommaHom a b ) : Set ℓ where |
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
33 field |
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
34 eqa : A [ arrow f ≈ arrow g ] |
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
35 eqb : B [ arrowg f ≈ arrowg g ] |
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
36 |
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
37 open _⋍_ |
477 | 38 |
39 _∙_ : {a b c : CommaObj } → CommaHom b c → CommaHom a b → CommaHom a c | |
40 _∙_ {a} {b} {c} f g = record { | |
41 arrow = A [ arrow f o arrow g ] ; | |
42 comm = comm1 | |
43 } where | |
479
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
44 comm1 : C [ C [ FMap G (B [ arrowg f o arrowg g ] ) o hom a ] ≈ C [ hom c o FMap F (A [ arrow f o arrow g ]) ] ] |
478 | 45 comm1 = let open ≈-Reasoning C in begin |
479
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
46 FMap G (B [ arrowg f o arrowg g ] ) o hom a |
478 | 47 ≈⟨ car ( distr G ) ⟩ |
479
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
48 ( FMap G (arrowg f) o FMap G (arrowg g )) o hom a |
478 | 49 ≈↑⟨ assoc ⟩ |
479
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
50 FMap G (arrowg f) o ( FMap G (arrowg g ) o hom a ) |
478 | 51 ≈⟨ cdr ( comm g ) ⟩ |
479
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
52 FMap G (arrowg f) o ( hom b o FMap F (arrow g ) ) |
478 | 53 ≈⟨ assoc ⟩ |
479
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
54 ( FMap G (arrowg f) o hom b) o FMap F (arrow g ) |
478 | 55 ≈⟨ car ( comm f ) ⟩ |
56 ( hom c o FMap F (arrow f) ) o FMap F (arrow g ) | |
57 ≈↑⟨ assoc ⟩ | |
58 hom c o ( FMap F (arrow f) o FMap F (arrow g ) ) | |
59 ≈↑⟨ cdr ( distr F) ⟩ | |
60 hom c o FMap F (A [ arrow f o arrow g ]) | |
61 ∎ | |
477 | 62 |
63 CommaId : { a : CommaObj } → CommaHom a a | |
64 CommaId {a} = record { arrow = id1 A ( obj a ) ; | |
65 comm = comm2 } where | |
479
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
66 comm2 : C [ C [ FMap G (id1 B (objb a)) o hom a ] ≈ C [ hom a o FMap F (id1 A (obj a)) ] ] |
478 | 67 comm2 = let open ≈-Reasoning C in begin |
479
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
68 FMap G (id1 B (objb a)) o hom a |
478 | 69 ≈⟨ car ( IsFunctor.identity ( isFunctor G ) ) ⟩ |
479
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
70 id1 C (FObj G (objb a)) o hom a |
478 | 71 ≈⟨ idL ⟩ |
72 hom a | |
73 ≈↑⟨ idR ⟩ | |
74 hom a o id1 C (FObj F (obj a)) | |
75 ≈↑⟨ cdr ( IsFunctor.identity ( isFunctor F ) )⟩ | |
76 hom a o FMap F (id1 A (obj a)) | |
77 ∎ | |
477 | 78 |
79 isCommaCategory : IsCategory CommaObj CommaHom _⋍_ _∙_ CommaId | |
80 isCommaCategory = record { | |
479
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
81 isEquivalence = record { refl = record { eqa = let open ≈-Reasoning (A) in refl-hom ; eqb = let open ≈-Reasoning (B) in refl-hom } ; |
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
82 sym = λ {f} {g} f=g → record { eqa = let open ≈-Reasoning (A) in sym ( eqa f=g) ; eqb = let open ≈-Reasoning (B) in sym ( eqb f=g ) } ; |
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
83 trans = λ {f} {g} {h} f=g g=h → record { |
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
84 eqa = let open ≈-Reasoning (A) in trans-hom (eqa f=g) (eqa g=h) |
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
85 ; eqb = let open ≈-Reasoning (B) in trans-hom (eqb f=g) (eqb g=h) |
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
86 } } |
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
87 ; identityL = λ{a b f} → record { |
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
88 eqa = let open ≈-Reasoning (A) in idL {obj a} {obj b} {arrow f} |
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
89 ; eqb = let open ≈-Reasoning (B) in idL {objb a} {objb b} {arrowg f} |
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
90 } |
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
91 ; identityR = λ{a b f} → record { |
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
92 eqa = let open ≈-Reasoning (A) in idR {obj a} {obj b} {arrow f} |
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
93 ; eqb = let open ≈-Reasoning (B) in idR {objb a} {objb b} {arrowg f} |
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
94 } |
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
95 ; o-resp-≈ = λ {a b c } {f g } {h i } f=g h=i → record { |
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
96 eqa = IsCategory.o-resp-≈ (Category.isCategory A) (eqa f=g) (eqa h=i ) |
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
97 ; eqb = IsCategory.o-resp-≈ (Category.isCategory B) (eqb f=g) (eqb h=i ) |
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
98 } |
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
99 ; associative = λ {a b c d} {f} {g} {h} → record { |
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
100 eqa = IsCategory.associative (Category.isCategory A) |
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
101 ; eqb = IsCategory.associative (Category.isCategory B) |
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
102 } |
a5034bdf6f38
Comma Category with A B C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
478
diff
changeset
|
103 } |
478 | 104 |
105 _↓_ : Category (c₂' ⊔ c₁) (ℓ' ⊔ c₂) ℓ | |
106 _↓_ = record { Obj = CommaObj | |
107 ; Hom = CommaHom | |
108 ; _o_ = _∙_ | |
109 ; _≈_ = _⋍_ | |
110 ; Id = CommaId | |
111 ; isCategory = isCommaCategory | |
112 } | |
477 | 113 |
114 |