Mercurial > hg > Members > kono > Proof > category
annotate nat.agda @ 111:c670d0e6b1e2
Category._o_ /= Category.Category.Id
when checking that the expression _∙_ has type
(EMHom .B .C → EMHom .A .B → EMHom .A .C)
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 31 Jul 2013 21:59:02 +0900 |
parents | e763efd30868 |
children | 5f331dfc000b |
rev | line source |
---|---|
82 | 1 -- -- -- -- -- -- -- -- |
2 -- Monad to Kelisli Category | |
3 -- defines U_T and F_T as a resolution of Monad | |
4 -- checks Adjointness | |
5 -- | |
6 -- Shinji KONO <kono@ie.u-ryukyu.ac.jp> | |
7 -- -- -- -- -- -- -- -- | |
0 | 8 |
9 -- Monad | |
10 -- Category A | |
11 -- A = Category | |
22 | 12 -- Functor T : A → A |
0 | 13 --T(a) = t(a) |
14 --T(f) = tf(f) | |
15 | |
2 | 16 open import Category -- https://github.com/konn/category-agda |
0 | 17 open import Level |
56 | 18 --open import Category.HomReasoning |
19 open import HomReasoning | |
20 open import cat-utility | |
72
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
21 open import Category.Cat |
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
22 |
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
23 module nat { c₁ c₂ ℓ : Level} { A : Category c₁ c₂ ℓ } |
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
24 { T : Functor A A } |
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
25 { η : NTrans A A identityFunctor T } |
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
26 { μ : NTrans A A (T ○ T) T } |
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
27 { M : Monad A T η μ } |
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
28 { K : Kleisli A T η μ M } where |
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
29 |
0 | 30 |
1 | 31 --T(g f) = T(g) T(f) |
32 | |
31 | 33 open Functor |
22 | 34 Lemma1 : {c₁ c₂ l : Level} {A : Category c₁ c₂ l} (T : Functor A A) → {a b c : Obj A} {g : Hom A b c} { f : Hom A a b } |
35 → A [ ( FMap T (A [ g o f ] )) ≈ (A [ FMap T g o FMap T f ]) ] | |
36 Lemma1 = \t → IsFunctor.distr ( isFunctor t ) | |
0 | 37 |
38 | |
7 | 39 open NTrans |
1 | 40 Lemma2 : {c₁ c₂ l : Level} {A : Category c₁ c₂ l} {F G : Functor A A} |
22 | 41 → (μ : NTrans A A F G) → {a b : Obj A} { f : Hom A a b } |
30 | 42 → A [ A [ FMap G f o TMap μ a ] ≈ A [ TMap μ b o FMap F f ] ] |
22 | 43 Lemma2 = \n → IsNTrans.naturality ( isNTrans n ) |
0 | 44 |
82 | 45 -- Laws of Monad |
46 -- | |
22 | 47 -- η : 1_A → T |
48 -- μ : TT → T | |
82 | 49 -- μ(a)η(T(a)) = a -- unity law 1 |
50 -- μ(a)T(η(a)) = a -- unity law 2 | |
51 -- μ(a)(μ(T(a))) = μ(a)T(μ(a)) -- association law | |
0 | 52 |
53 | |
2 | 54 open Monad |
55 Lemma3 : {c₁ c₂ ℓ : Level} {A : Category c₁ c₂ ℓ} | |
56 { T : Functor A A } | |
7 | 57 { η : NTrans A A identityFunctor T } |
58 { μ : NTrans A A (T ○ T) T } | |
22 | 59 { a : Obj A } → |
2 | 60 ( M : Monad A T η μ ) |
30 | 61 → A [ A [ TMap μ a o TMap μ ( FObj T a ) ] ≈ A [ TMap μ a o FMap T (TMap μ a) ] ] |
22 | 62 Lemma3 = \m → IsMonad.assoc ( isMonad m ) |
2 | 63 |
64 | |
65 Lemma4 : {c₁ c₂ ℓ : Level} (A : Category c₁ c₂ ℓ) {a b : Obj A } { f : Hom A a b} | |
22 | 66 → A [ A [ Id {_} {_} {_} {A} b o f ] ≈ f ] |
67 Lemma4 = \a → IsCategory.identityL ( Category.isCategory a ) | |
0 | 68 |
3 | 69 Lemma5 : {c₁ c₂ ℓ : Level} {A : Category c₁ c₂ ℓ} |
70 { T : Functor A A } | |
7 | 71 { η : NTrans A A identityFunctor T } |
72 { μ : NTrans A A (T ○ T) T } | |
22 | 73 { a : Obj A } → |
3 | 74 ( M : Monad A T η μ ) |
30 | 75 → A [ A [ TMap μ a o TMap η ( FObj T a ) ] ≈ Id {_} {_} {_} {A} (FObj T a) ] |
22 | 76 Lemma5 = \m → IsMonad.unity1 ( isMonad m ) |
3 | 77 |
78 Lemma6 : {c₁ c₂ ℓ : Level} {A : Category c₁ c₂ ℓ} | |
79 { T : Functor A A } | |
7 | 80 { η : NTrans A A identityFunctor T } |
81 { μ : NTrans A A (T ○ T) T } | |
22 | 82 { a : Obj A } → |
3 | 83 ( M : Monad A T η μ ) |
30 | 84 → A [ A [ TMap μ a o (FMap T (TMap η a )) ] ≈ Id {_} {_} {_} {A} (FObj T a) ] |
22 | 85 Lemma6 = \m → IsMonad.unity2 ( isMonad m ) |
3 | 86 |
82 | 87 -- Laws of Kleisli Category |
88 -- | |
0 | 89 -- nat of η |
82 | 90 -- g ○ f = μ(c) T(g) f -- join definition |
91 -- η(b) ○ f = f -- left id (Lemma7) | |
92 -- f ○ η(a) = f -- right id (Lemma8) | |
93 -- h ○ (g ○ f) = (h ○ g) ○ f -- assocation law (Lemma9) | |
11 | 94 |
4 | 95 open Kleisli |
22 | 96 -- η(b) ○ f = f |
73 | 97 Lemma7 : { a : Obj A } { b : Obj A } ( f : Hom A a ( FObj T b) ) |
98 → A [ join K (TMap η b) f ≈ f ] | |
99 Lemma7 {_} {b} f = | |
100 let open ≈-Reasoning (A) in | |
21 | 101 begin |
73 | 102 join K (TMap η b) f |
21 | 103 ≈⟨ refl-hom ⟩ |
73 | 104 A [ TMap μ b o A [ FMap T ((TMap η b)) o f ] ] |
105 ≈⟨ IsCategory.associative (Category.isCategory A) ⟩ | |
106 A [ A [ TMap μ b o FMap T ((TMap η b)) ] o f ] | |
107 ≈⟨ car ( IsMonad.unity2 ( isMonad ( monad K )) ) ⟩ | |
108 A [ id (FObj T b) o f ] | |
109 ≈⟨ IsCategory.identityL (Category.isCategory A) ⟩ | |
21 | 110 f |
111 ∎ | |
7 | 112 |
22 | 113 -- f ○ η(a) = f |
73 | 114 Lemma8 : { a : Obj A } { b : Obj A } |
22 | 115 ( f : Hom A a ( FObj T b) ) |
72
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
116 → A [ join K f (TMap η a) ≈ f ] |
73 | 117 Lemma8 {a} {b} f = |
22 | 118 begin |
72
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
119 join K f (TMap η a) |
22 | 120 ≈⟨ refl-hom ⟩ |
72
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
121 A [ TMap μ b o A [ FMap T f o (TMap η a) ] ] |
66 | 122 ≈⟨ cdr ( nat η ) ⟩ |
72
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
123 A [ TMap μ b o A [ (TMap η ( FObj T b)) o f ] ] |
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
124 ≈⟨ IsCategory.associative (Category.isCategory A) ⟩ |
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
125 A [ A [ TMap μ b o (TMap η ( FObj T b)) ] o f ] |
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
126 ≈⟨ car ( IsMonad.unity1 ( isMonad ( monad K )) ) ⟩ |
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
127 A [ id (FObj T b) o f ] |
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
128 ≈⟨ IsCategory.identityL (Category.isCategory A) ⟩ |
22 | 129 f |
130 ∎ where | |
72
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
131 open ≈-Reasoning (A) |
5 | 132 |
22 | 133 -- h ○ (g ○ f) = (h ○ g) ○ f |
72
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
134 Lemma9 : { a b c d : Obj A } |
73 | 135 ( h : Hom A c ( FObj T d) ) |
23 | 136 ( g : Hom A b ( FObj T c) ) |
73 | 137 ( f : Hom A a ( FObj T b) ) |
72
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
138 → A [ join K h (join K g f) ≈ join K ( join K h g) f ] |
73 | 139 Lemma9 {a} {b} {c} {d} h g f = |
24 | 140 begin |
72
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
141 join K h (join K g f) |
30 | 142 ≈⟨⟩ |
72
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
143 join K h ( ( TMap μ c o ( FMap T g o f ) ) ) |
28 | 144 ≈⟨ refl-hom ⟩ |
30 | 145 ( TMap μ d o ( FMap T h o ( TMap μ c o ( FMap T g o f ) ) ) ) |
28 | 146 ≈⟨ cdr ( cdr ( assoc )) ⟩ |
30 | 147 ( TMap μ d o ( FMap T h o ( ( TMap μ c o FMap T g ) o f ) ) ) |
28 | 148 ≈⟨ assoc ⟩ --- ( f o ( g o h ) ) = ( ( f o g ) o h ) |
30 | 149 ( ( TMap μ d o FMap T h ) o ( (TMap μ c o FMap T g ) o f ) ) |
25 | 150 ≈⟨ assoc ⟩ |
30 | 151 ( ( ( TMap μ d o FMap T h ) o (TMap μ c o FMap T g ) ) o f ) |
28 | 152 ≈⟨ car (sym assoc) ⟩ |
30 | 153 ( ( TMap μ d o ( FMap T h o ( TMap μ c o FMap T g ) ) ) o f ) |
28 | 154 ≈⟨ car ( cdr (assoc) ) ⟩ |
30 | 155 ( ( TMap μ d o ( ( FMap T h o TMap μ c ) o FMap T g ) ) o f ) |
28 | 156 ≈⟨ car assoc ⟩ |
30 | 157 ( ( ( TMap μ d o ( FMap T h o TMap μ c ) ) o FMap T g ) o f ) |
28 | 158 ≈⟨ car (car ( cdr ( begin |
30 | 159 ( FMap T h o TMap μ c ) |
66 | 160 ≈⟨ nat μ ⟩ |
30 | 161 ( TMap μ (FObj T d) o FMap T (FMap T h) ) |
25 | 162 ∎ |
163 ))) ⟩ | |
30 | 164 ( ( ( TMap μ d o ( TMap μ ( FObj T d) o FMap T ( FMap T h ) ) ) o FMap T g ) o f ) |
28 | 165 ≈⟨ car (sym assoc) ⟩ |
30 | 166 ( ( TMap μ d o ( ( TMap μ ( FObj T d) o FMap T ( FMap T h ) ) o FMap T g ) ) o f ) |
28 | 167 ≈⟨ car ( cdr (sym assoc) ) ⟩ |
30 | 168 ( ( TMap μ d o ( TMap μ ( FObj T d) o ( FMap T ( FMap T h ) o FMap T g ) ) ) o f ) |
28 | 169 ≈⟨ car ( cdr (cdr (sym (distr T )))) ⟩ |
30 | 170 ( ( TMap μ d o ( TMap μ ( FObj T d) o FMap T ( ( FMap T h o g ) ) ) ) o f ) |
28 | 171 ≈⟨ car assoc ⟩ |
30 | 172 ( ( ( TMap μ d o TMap μ ( FObj T d) ) o FMap T ( ( FMap T h o g ) ) ) o f ) |
28 | 173 ≈⟨ car ( car ( |
27 | 174 begin |
30 | 175 ( TMap μ d o TMap μ (FObj T d) ) |
72
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
176 ≈⟨ IsMonad.assoc ( isMonad M) ⟩ |
30 | 177 ( TMap μ d o FMap T (TMap μ d) ) |
27 | 178 ∎ |
179 )) ⟩ | |
30 | 180 ( ( ( TMap μ d o FMap T ( TMap μ d) ) o FMap T ( ( FMap T h o g ) ) ) o f ) |
28 | 181 ≈⟨ car (sym assoc) ⟩ |
30 | 182 ( ( TMap μ d o ( FMap T ( TMap μ d ) o FMap T ( ( FMap T h o g ) ) ) ) o f ) |
24 | 183 ≈⟨ sym assoc ⟩ |
30 | 184 ( TMap μ d o ( ( FMap T ( TMap μ d ) o FMap T ( ( FMap T h o g ) ) ) o f ) ) |
28 | 185 ≈⟨ cdr ( car ( sym ( distr T ))) ⟩ |
30 | 186 ( TMap μ d o ( FMap T ( ( ( TMap μ d ) o ( FMap T h o g ) ) ) o f ) ) |
23 | 187 ≈⟨ refl-hom ⟩ |
72
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
188 join K ( ( TMap μ d o ( FMap T h o g ) ) ) f |
23 | 189 ≈⟨ refl-hom ⟩ |
72
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
190 join K ( join K h g) f |
24 | 191 ∎ where open ≈-Reasoning (A) |
3 | 192 |
82 | 193 -- |
194 -- o-resp in Kleisli Category ( for Functor definitions ) | |
195 -- | |
74
49e6eb3ef9c0
Kleisli Category constructed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
73
diff
changeset
|
196 Lemma10 : {a b c : Obj A} -> (f g : Hom A a (FObj T b) ) → (h i : Hom A b (FObj T c) ) → |
49e6eb3ef9c0
Kleisli Category constructed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
73
diff
changeset
|
197 A [ f ≈ g ] → A [ h ≈ i ] → A [ (join K h f) ≈ (join K i g) ] |
49e6eb3ef9c0
Kleisli Category constructed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
73
diff
changeset
|
198 Lemma10 {a} {b} {c} f g h i eq-fg eq-hi = let open ≈-Reasoning (A) in |
49e6eb3ef9c0
Kleisli Category constructed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
73
diff
changeset
|
199 begin |
49e6eb3ef9c0
Kleisli Category constructed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
73
diff
changeset
|
200 join K h f |
49e6eb3ef9c0
Kleisli Category constructed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
73
diff
changeset
|
201 ≈⟨⟩ |
49e6eb3ef9c0
Kleisli Category constructed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
73
diff
changeset
|
202 TMap μ c o ( FMap T h o f ) |
49e6eb3ef9c0
Kleisli Category constructed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
73
diff
changeset
|
203 ≈⟨ cdr ( IsCategory.o-resp-≈ (Category.isCategory A) eq-fg ((IsFunctor.≈-cong (isFunctor T)) eq-hi )) ⟩ |
49e6eb3ef9c0
Kleisli Category constructed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
73
diff
changeset
|
204 TMap μ c o ( FMap T i o g ) |
49e6eb3ef9c0
Kleisli Category constructed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
73
diff
changeset
|
205 ≈⟨⟩ |
49e6eb3ef9c0
Kleisli Category constructed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
73
diff
changeset
|
206 join K i g |
49e6eb3ef9c0
Kleisli Category constructed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
73
diff
changeset
|
207 ∎ |
49e6eb3ef9c0
Kleisli Category constructed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
73
diff
changeset
|
208 |
82 | 209 -- |
210 -- Hom in Kleisli Category | |
211 -- | |
74
49e6eb3ef9c0
Kleisli Category constructed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
73
diff
changeset
|
212 |
87 | 213 |
214 record KleisliHom { c₁ c₂ ℓ : Level} { A : Category c₁ c₂ ℓ } { T : Functor A A } (a : Obj A) (b : Obj A) | |
78 | 215 : Set c₂ where |
70 | 216 field |
217 KMap : Hom A a ( FObj T b ) | |
69
84a150c980ce
generalized distr and assco1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
218 |
88 | 219 open KleisliHom |
220 KHom = \(a b : Obj A) -> KleisliHom {c₁} {c₂} {ℓ} {A} {T} a b | |
87 | 221 |
72
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
222 K-id : {a : Obj A} → KHom a a |
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
223 K-id {a = a} = record { KMap = TMap η a } |
56 | 224 |
69
84a150c980ce
generalized distr and assco1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
225 open import Relation.Binary.Core |
56 | 226 |
74
49e6eb3ef9c0
Kleisli Category constructed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
73
diff
changeset
|
227 _⋍_ : { a : Obj A } { b : Obj A } (f g : KHom a b ) -> Set ℓ |
73 | 228 _⋍_ {a} {b} f g = A [ KMap f ≈ KMap g ] |
71
709c1bde54dc
Kleisli category problem written
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
70
diff
changeset
|
229 |
108 | 230 _*_ : { a b c : Obj A } → ( KHom b c) → ( KHom a b) → KHom a c |
72
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
231 _*_ {a} {b} {c} g f = record { KMap = join K {a} {b} {c} (KMap g) (KMap f) } |
70 | 232 |
72
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
233 isKleisliCategory : IsCategory ( Obj A ) KHom _⋍_ _*_ K-id |
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
234 isKleisliCategory = record { isEquivalence = isEquivalence |
71
709c1bde54dc
Kleisli category problem written
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
70
diff
changeset
|
235 ; identityL = KidL |
709c1bde54dc
Kleisli category problem written
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
70
diff
changeset
|
236 ; identityR = KidR |
709c1bde54dc
Kleisli category problem written
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
70
diff
changeset
|
237 ; o-resp-≈ = Ko-resp |
709c1bde54dc
Kleisli category problem written
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
70
diff
changeset
|
238 ; associative = Kassoc |
69
84a150c980ce
generalized distr and assco1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
239 } |
84a150c980ce
generalized distr and assco1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
240 where |
73 | 241 open ≈-Reasoning (A) |
72
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
242 isEquivalence : { a b : Obj A } -> |
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
243 IsEquivalence {_} {_} {KHom a b} _⋍_ |
82 | 244 isEquivalence {C} {D} = -- this is the same function as A's equivalence but has different types |
245 record { refl = refl-hom | |
246 ; sym = sym | |
247 ; trans = trans-hom | |
248 } | |
72
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
249 KidL : {C D : Obj A} -> {f : KHom C D} → (K-id * f) ⋍ f |
73 | 250 KidL {_} {_} {f} = Lemma7 (KMap f) |
72
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
251 KidR : {C D : Obj A} -> {f : KHom C D} → (f * K-id) ⋍ f |
73 | 252 KidR {_} {_} {f} = Lemma8 (KMap f) |
72
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
253 Ko-resp : {a b c : Obj A} -> {f g : KHom a b } → {h i : KHom b c } → |
71
709c1bde54dc
Kleisli category problem written
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
70
diff
changeset
|
254 f ⋍ g → h ⋍ i → (h * f) ⋍ (i * g) |
74
49e6eb3ef9c0
Kleisli Category constructed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
73
diff
changeset
|
255 Ko-resp {a} {b} {c} {f} {g} {h} {i} eq-fg eq-hi = Lemma10 {a} {b} {c} (KMap f) (KMap g) (KMap h) (KMap i) eq-fg eq-hi |
72
cbc30519e961
stack overflow solved by moving implicit parameters to module parameters
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
256 Kassoc : {a b c d : Obj A} -> {f : KHom c d } → {g : KHom b c } → {h : KHom a b } → |
71
709c1bde54dc
Kleisli category problem written
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
70
diff
changeset
|
257 (f * (g * h)) ⋍ ((f * g) * h) |
73 | 258 Kassoc {_} {_} {_} {_} {f} {g} {h} = Lemma9 (KMap f) (KMap g) (KMap h) |
3 | 259 |
78 | 260 KleisliCategory : Category c₁ c₂ ℓ |
75 | 261 KleisliCategory = |
262 record { Obj = Obj A | |
263 ; Hom = KHom | |
264 ; _o_ = _*_ | |
265 ; _≈_ = _⋍_ | |
266 ; Id = K-id | |
267 ; isCategory = isKleisliCategory | |
268 } | |
56 | 269 |
82 | 270 -- |
271 -- Resolution | |
272 -- T = U_T U_F | |
273 -- nat-ε | |
274 -- nat-η | |
275 -- | |
276 | |
80 | 277 ufmap : {a b : Obj A} (f : KHom a b ) -> Hom A (FObj T a) (FObj T b) |
278 ufmap {a} {b} f = A [ TMap μ (b) o FMap T (KMap f) ] | |
279 | |
75 | 280 U_T : Functor KleisliCategory A |
281 U_T = record { | |
282 FObj = FObj T | |
283 ; FMap = ufmap | |
284 ; isFunctor = record | |
285 { ≈-cong = ≈-cong | |
286 ; identity = identity | |
76 | 287 ; distr = distr1 |
75 | 288 } |
289 } where | |
290 identity : {a : Obj A} → A [ ufmap (K-id {a}) ≈ id1 A (FObj T a) ] | |
291 identity {a} = let open ≈-Reasoning (A) in | |
292 begin | |
293 TMap μ (a) o FMap T (TMap η a) | |
294 ≈⟨ IsMonad.unity2 (isMonad M) ⟩ | |
295 id1 A (FObj T a) | |
296 ∎ | |
297 ≈-cong : {a b : Obj A} {f g : KHom a b} → A [ KMap f ≈ KMap g ] → A [ ufmap f ≈ ufmap g ] | |
298 ≈-cong {a} {b} {f} {g} f≈g = let open ≈-Reasoning (A) in | |
299 begin | |
300 TMap μ (b) o FMap T (KMap f) | |
301 ≈⟨ cdr (fcong T f≈g) ⟩ | |
302 TMap μ (b) o FMap T (KMap g) | |
303 ∎ | |
76 | 304 distr1 : {a b c : Obj A} {f : KHom a b} {g : KHom b c} → A [ ufmap (g * f) ≈ (A [ ufmap g o ufmap f ] )] |
305 distr1 {a} {b} {c} {f} {g} = let open ≈-Reasoning (A) in | |
75 | 306 begin |
307 ufmap (g * f) | |
76 | 308 ≈⟨⟩ |
309 ufmap {a} {c} ( record { KMap = TMap μ (c) o (FMap T (KMap g) o (KMap f)) } ) | |
310 ≈⟨⟩ | |
311 TMap μ (c) o FMap T ( TMap μ (c) o (FMap T (KMap g) o (KMap f))) | |
312 ≈⟨ cdr ( distr T) ⟩ | |
313 TMap μ (c) o (( FMap T ( TMap μ (c)) o FMap T (FMap T (KMap g) o (KMap f)))) | |
314 ≈⟨ assoc ⟩ | |
315 (TMap μ (c) o ( FMap T ( TMap μ (c)))) o FMap T (FMap T (KMap g) o (KMap f)) | |
316 ≈⟨ car (sym (IsMonad.assoc (isMonad M))) ⟩ | |
317 (TMap μ (c) o ( TMap μ (FObj T c))) o FMap T (FMap T (KMap g) o (KMap f)) | |
318 ≈⟨ sym assoc ⟩ | |
319 TMap μ (c) o (( TMap μ (FObj T c)) o FMap T (FMap T (KMap g) o (KMap f))) | |
320 ≈⟨ cdr (cdr (distr T)) ⟩ | |
321 TMap μ (c) o (( TMap μ (FObj T c)) o (FMap T (FMap T (KMap g)) o FMap T (KMap f))) | |
322 ≈⟨ cdr (assoc) ⟩ | |
323 TMap μ (c) o ((( TMap μ (FObj T c)) o (FMap T (FMap T (KMap g)))) o FMap T (KMap f)) | |
324 ≈⟨ sym (cdr (car (nat μ ))) ⟩ | |
325 TMap μ (c) o ((FMap T (KMap g ) o TMap μ (b)) o FMap T (KMap f )) | |
326 ≈⟨ cdr (sym assoc) ⟩ | |
327 TMap μ (c) o (FMap T (KMap g ) o ( TMap μ (b) o FMap T (KMap f ))) | |
328 ≈⟨ assoc ⟩ | |
329 ( TMap μ (c) o FMap T (KMap g ) ) o ( TMap μ (b) o FMap T (KMap f ) ) | |
330 ≈⟨⟩ | |
75 | 331 ufmap g o ufmap f |
332 ∎ | |
333 | |
334 | |
335 ffmap : {a b : Obj A} (f : Hom A a b) -> KHom a b | |
336 ffmap f = record { KMap = A [ TMap η (Category.cod A f) o f ] } | |
337 | |
338 F_T : Functor A KleisliCategory | |
339 F_T = record { | |
340 FObj = \a -> a | |
341 ; FMap = ffmap | |
342 ; isFunctor = record | |
343 { ≈-cong = ≈-cong | |
344 ; identity = identity | |
76 | 345 ; distr = distr1 |
75 | 346 } |
347 } where | |
348 identity : {a : Obj A} → A [ A [ TMap η a o id1 A a ] ≈ TMap η a ] | |
349 identity {a} = IsCategory.identityR ( Category.isCategory A) | |
82 | 350 -- Category.cod A f and Category.cod A g are actualy the same b, so we don't need cong-≈, just refl |
75 | 351 lemma1 : {a b : Obj A} {f g : Hom A a b} → A [ f ≈ g ] → A [ TMap η b ≈ TMap η b ] |
352 lemma1 f≈g = IsEquivalence.refl (IsCategory.isEquivalence ( Category.isCategory A )) | |
353 ≈-cong : {a b : Obj A} {f g : Hom A a b} → A [ f ≈ g ] → A [ A [ TMap η (Category.cod A f) o f ] ≈ A [ TMap η (Category.cod A g) o g ] ] | |
354 ≈-cong f≈g = (IsCategory.o-resp-≈ (Category.isCategory A)) f≈g ( lemma1 f≈g ) | |
76 | 355 distr1 : {a b c : Obj A} {f : Hom A a b} {g : Hom A b c} → |
75 | 356 ( ffmap (A [ g o f ]) ⋍ ( ffmap g * ffmap f ) ) |
77 | 357 distr1 {a} {b} {c} {f} {g} = let open ≈-Reasoning (A) in |
75 | 358 begin |
359 KMap (ffmap (A [ g o f ])) | |
77 | 360 ≈⟨⟩ |
361 TMap η (c) o (g o f) | |
362 ≈⟨ assoc ⟩ | |
363 (TMap η (c) o g) o f | |
364 ≈⟨ car (sym (nat η)) ⟩ | |
365 (FMap T g o TMap η (b)) o f | |
366 ≈⟨ sym idL ⟩ | |
367 id1 A (FObj T c) o ((FMap T g o TMap η (b)) o f) | |
368 ≈⟨ sym (car (IsMonad.unity2 (isMonad M))) ⟩ | |
369 (TMap μ c o FMap T (TMap η c)) o ((FMap T g o TMap η (b)) o f) | |
370 ≈⟨ sym assoc ⟩ | |
371 TMap μ c o ( FMap T (TMap η c) o ((FMap T g o TMap η (b)) o f) ) | |
372 ≈⟨ cdr (cdr (sym assoc)) ⟩ | |
373 TMap μ c o ( FMap T (TMap η c) o (FMap T g o (TMap η (b) o f))) | |
374 ≈⟨ cdr assoc ⟩ | |
375 TMap μ c o ( ( FMap T (TMap η c) o FMap T g ) o (TMap η (b) o f) ) | |
376 ≈⟨ sym (cdr ( car ( distr T ))) ⟩ | |
377 TMap μ c o ( ( FMap T (TMap η c o g)) o (TMap η (b) o f)) | |
378 ≈⟨ assoc ⟩ | |
379 (TMap μ c o ( FMap T (TMap η c o g))) o (TMap η (b) o f) | |
380 ≈⟨ assoc ⟩ | |
381 ((TMap μ c o (FMap T (TMap η c o g))) o TMap η b) o f | |
382 ≈⟨ sym assoc ⟩ | |
383 (TMap μ c o (FMap T (TMap η c o g))) o (TMap η b o f) | |
384 ≈⟨ sym assoc ⟩ | |
385 TMap μ c o ( (FMap T (TMap η c o g)) o (TMap η b o f) ) | |
386 ≈⟨⟩ | |
387 join K (TMap η c o g) (TMap η b o f) | |
388 ≈⟨⟩ | |
75 | 389 KMap ( ffmap g * ffmap f ) |
390 ∎ | |
391 | |
82 | 392 -- |
393 -- T = (U_T ○ F_T) | |
394 -- | |
395 | |
79 | 396 Lemma11-1 : ∀{a b : Obj A} -> (f : Hom A a b ) -> A [ FMap T f ≈ FMap (U_T ○ F_T) f ] |
397 Lemma11-1 {a} {b} f = let open ≈-Reasoning (A) in | |
398 sym ( begin | |
399 FMap (U_T ○ F_T) f | |
400 ≈⟨⟩ | |
401 FMap U_T ( FMap F_T f ) | |
402 ≈⟨⟩ | |
403 TMap μ (b) o FMap T (KMap ( ffmap f ) ) | |
404 ≈⟨⟩ | |
405 TMap μ (b) o FMap T (TMap η (b) o f) | |
406 ≈⟨ cdr (distr T ) ⟩ | |
407 TMap μ (b) o ( FMap T (TMap η (b)) o FMap T f) | |
408 ≈⟨ assoc ⟩ | |
409 (TMap μ (b) o FMap T (TMap η (b))) o FMap T f | |
410 ≈⟨ car (IsMonad.unity2 (isMonad M)) ⟩ | |
411 id1 A (FObj T b) o FMap T f | |
412 ≈⟨ idL ⟩ | |
413 FMap T f | |
414 ∎ ) | |
415 | |
82 | 416 -- construct ≃ |
417 | |
81
0404b2ba7db6
Resolution Adjoint proved.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
80
diff
changeset
|
418 Lemma11 : T ≃ (U_T ○ F_T) |
0404b2ba7db6
Resolution Adjoint proved.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
80
diff
changeset
|
419 Lemma11 f = Category.Cat.refl (Lemma11-1 f) |
78 | 420 |
82 | 421 -- |
422 -- natural transformations | |
423 -- | |
424 | |
78 | 425 nat-η : NTrans A A identityFunctor ( U_T ○ F_T ) |
426 nat-η = record { TMap = \x -> TMap η x ; isNTrans = isNTrans1 } where | |
79 | 427 naturality1 : {a b : Obj A} {f : Hom A a b} |
428 → A [ A [ ( FMap ( U_T ○ F_T ) f ) o ( TMap η a ) ] ≈ A [ (TMap η b ) o f ] ] | |
429 naturality1 {a} {b} {f} = let open ≈-Reasoning (A) in | |
430 begin | |
431 ( FMap ( U_T ○ F_T ) f ) o ( TMap η a ) | |
84 | 432 ≈⟨ sym (resp refl-hom (Lemma11-1 f)) ⟩ |
433 FMap T f o TMap η a | |
79 | 434 ≈⟨ nat η ⟩ |
84 | 435 TMap η b o f |
79 | 436 ∎ |
78 | 437 isNTrans1 : IsNTrans A A identityFunctor ( U_T ○ F_T ) (\a -> TMap η a) |
79 | 438 isNTrans1 = record { naturality = naturality1 } |
77 | 439 |
79 | 440 tmap-ε : (a : Obj A) -> KHom (FObj T a) a |
78 | 441 tmap-ε a = record { KMap = id1 A (FObj T a) } |
442 | |
443 nat-ε : NTrans KleisliCategory KleisliCategory ( F_T ○ U_T ) identityFunctor | |
444 nat-ε = record { TMap = \a -> tmap-ε a; isNTrans = isNTrans1 } where | |
79 | 445 naturality1 : {a b : Obj A} {f : KHom a b} |
78 | 446 → (f * ( tmap-ε a ) ) ⋍ (( tmap-ε b ) * ( FMap (F_T ○ U_T) f ) ) |
79 | 447 naturality1 {a} {b} {f} = let open ≈-Reasoning (A) in |
448 sym ( begin | |
449 KMap (( tmap-ε b ) * ( FMap (F_T ○ U_T) f )) | |
80 | 450 ≈⟨⟩ |
451 TMap μ b o ( FMap T ( id1 A (FObj T b) ) o ( KMap (FMap (F_T ○ U_T) f ) )) | |
452 ≈⟨ cdr ( cdr ( | |
453 begin | |
454 KMap (FMap (F_T ○ U_T) f ) | |
455 ≈⟨⟩ | |
456 KMap (FMap F_T (FMap U_T f)) | |
457 ≈⟨⟩ | |
458 TMap η (FObj T b) o (TMap μ (b) o FMap T (KMap f)) | |
459 ∎ | |
460 )) ⟩ | |
461 TMap μ b o ( FMap T ( id1 A (FObj T b) ) o (TMap η (FObj T b) o (TMap μ (b) o FMap T (KMap f)))) | |
462 ≈⟨ cdr (car (IsFunctor.identity (isFunctor T))) ⟩ | |
463 TMap μ b o ( id1 A (FObj T (FObj T b) ) o (TMap η (FObj T b) o (TMap μ (b) o FMap T (KMap f)))) | |
464 ≈⟨ cdr idL ⟩ | |
465 TMap μ b o (TMap η (FObj T b) o (TMap μ (b) o FMap T (KMap f))) | |
466 ≈⟨ assoc ⟩ | |
467 (TMap μ b o (TMap η (FObj T b))) o (TMap μ (b) o FMap T (KMap f)) | |
468 ≈⟨ (car (IsMonad.unity1 (isMonad M))) ⟩ | |
469 id1 A (FObj T b) o (TMap μ (b) o FMap T (KMap f)) | |
470 ≈⟨ idL ⟩ | |
471 TMap μ b o FMap T (KMap f) | |
472 ≈⟨ cdr (sym idR) ⟩ | |
473 TMap μ b o ( FMap T (KMap f) o id1 A (FObj T a) ) | |
474 ≈⟨⟩ | |
79 | 475 KMap (f * ( tmap-ε a )) |
476 ∎ ) | |
78 | 477 isNTrans1 : IsNTrans KleisliCategory KleisliCategory ( F_T ○ U_T ) identityFunctor (\a -> tmap-ε a ) |
79 | 478 isNTrans1 = record { naturality = naturality1 } |
77 | 479 |
82 | 480 -- |
481 -- μ = U_T ε U_F | |
482 -- | |
95 | 483 tmap-μ : (a : Obj A) -> Hom A (FObj ( U_T ○ F_T ) (FObj ( U_T ○ F_T ) a)) (FObj ( U_T ○ F_T ) a) |
484 tmap-μ a = FMap U_T ( TMap nat-ε ( FObj F_T a )) | |
485 | |
486 nat-μ : NTrans A A (( U_T ○ F_T ) ○ ( U_T ○ F_T )) ( U_T ○ F_T ) | |
487 nat-μ = record { TMap = tmap-μ ; isNTrans = isNTrans1 } where | |
488 naturality1 : {a b : Obj A} {f : Hom A a b} | |
489 → A [ A [ (FMap (U_T ○ F_T) f) o ( tmap-μ a) ] ≈ A [ ( tmap-μ b ) o FMap (U_T ○ F_T) ( FMap (U_T ○ F_T) f) ] ] | |
490 naturality1 {a} {b} {f} = let open ≈-Reasoning (A) in | |
491 sym ( begin | |
492 ( tmap-μ b ) o FMap (U_T ○ F_T) ( FMap (U_T ○ F_T) f) | |
493 ≈⟨⟩ | |
494 ( FMap U_T ( TMap nat-ε ( FObj F_T b )) ) o FMap (U_T ○ F_T) ( FMap (U_T ○ F_T) f) | |
495 ≈⟨ sym ( distr U_T) ⟩ | |
496 FMap U_T ( KleisliCategory [ TMap nat-ε ( FObj F_T b ) o FMap F_T ( FMap (U_T ○ F_T) f) ] ) | |
497 ≈⟨ fcong U_T (sym (nat nat-ε)) ⟩ | |
498 FMap U_T ( KleisliCategory [ (FMap F_T f) o TMap nat-ε ( FObj F_T a ) ] ) | |
499 ≈⟨ distr U_T ⟩ | |
500 (FMap U_T (FMap F_T f)) o FMap U_T ( TMap nat-ε ( FObj F_T a )) | |
501 ≈⟨⟩ | |
502 (FMap (U_T ○ F_T) f) o ( tmap-μ a) | |
503 ∎ ) | |
504 isNTrans1 : IsNTrans A A (( U_T ○ F_T ) ○ ( U_T ○ F_T )) ( U_T ○ F_T ) tmap-μ | |
505 isNTrans1 = record { naturality = naturality1 } | |
506 | |
507 Lemma12 : {x : Obj A } -> A [ TMap nat-μ x ≈ FMap U_T ( TMap nat-ε ( FObj F_T x ) ) ] | |
80 | 508 Lemma12 {x} = let open ≈-Reasoning (A) in |
509 sym ( begin | |
510 FMap U_T ( TMap nat-ε ( FObj F_T x ) ) | |
511 ≈⟨⟩ | |
95 | 512 tmap-μ x |
513 ≈⟨⟩ | |
514 TMap nat-μ x | |
515 ∎ ) | |
516 | |
517 Lemma13 : {x : Obj A } -> A [ TMap μ x ≈ FMap U_T ( TMap nat-ε ( FObj F_T x ) ) ] | |
518 Lemma13 {x} = let open ≈-Reasoning (A) in | |
519 sym ( begin | |
520 FMap U_T ( TMap nat-ε ( FObj F_T x ) ) | |
521 ≈⟨⟩ | |
80 | 522 TMap μ x o FMap T (id1 A (FObj T x) ) |
523 ≈⟨ cdr (IsFunctor.identity (isFunctor T)) ⟩ | |
524 TMap μ x o id1 A (FObj T (FObj T x) ) | |
525 ≈⟨ idR ⟩ | |
526 TMap μ x | |
527 ∎ ) | |
78 | 528 |
84 | 529 Adj_T : Adjunction A KleisliCategory U_T F_T nat-η nat-ε |
530 Adj_T = record { | |
80 | 531 isAdjunction = record { |
532 adjoint1 = adjoint1 ; | |
533 adjoint2 = adjoint2 | |
534 } | |
535 } where | |
536 adjoint1 : { b : Obj KleisliCategory } → | |
537 A [ A [ ( FMap U_T ( TMap nat-ε b)) o ( TMap nat-η ( FObj U_T b )) ] ≈ id1 A (FObj U_T b) ] | |
81
0404b2ba7db6
Resolution Adjoint proved.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
80
diff
changeset
|
538 adjoint1 {b} = let open ≈-Reasoning (A) in |
0404b2ba7db6
Resolution Adjoint proved.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
80
diff
changeset
|
539 begin |
0404b2ba7db6
Resolution Adjoint proved.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
80
diff
changeset
|
540 ( FMap U_T ( TMap nat-ε b)) o ( TMap nat-η ( FObj U_T b )) |
0404b2ba7db6
Resolution Adjoint proved.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
80
diff
changeset
|
541 ≈⟨⟩ |
0404b2ba7db6
Resolution Adjoint proved.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
80
diff
changeset
|
542 (TMap μ (b) o FMap T (id1 A (FObj T b ))) o ( TMap η ( FObj T b )) |
0404b2ba7db6
Resolution Adjoint proved.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
80
diff
changeset
|
543 ≈⟨ car ( cdr (IsFunctor.identity (isFunctor T))) ⟩ |
0404b2ba7db6
Resolution Adjoint proved.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
80
diff
changeset
|
544 (TMap μ (b) o (id1 A (FObj T (FObj T b )))) o ( TMap η ( FObj T b )) |
0404b2ba7db6
Resolution Adjoint proved.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
80
diff
changeset
|
545 ≈⟨ car idR ⟩ |
0404b2ba7db6
Resolution Adjoint proved.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
80
diff
changeset
|
546 TMap μ (b) o ( TMap η ( FObj T b )) |
0404b2ba7db6
Resolution Adjoint proved.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
80
diff
changeset
|
547 ≈⟨ IsMonad.unity1 (isMonad M) ⟩ |
0404b2ba7db6
Resolution Adjoint proved.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
80
diff
changeset
|
548 id1 A (FObj U_T b) |
0404b2ba7db6
Resolution Adjoint proved.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
80
diff
changeset
|
549 ∎ |
80 | 550 adjoint2 : {a : Obj A} → |
551 KleisliCategory [ KleisliCategory [ ( TMap nat-ε ( FObj F_T a )) o ( FMap F_T ( TMap nat-η a )) ] | |
87 | 552 ≈ id1 KleisliCategory (FObj F_T a) ] |
81
0404b2ba7db6
Resolution Adjoint proved.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
80
diff
changeset
|
553 adjoint2 {a} = let open ≈-Reasoning (A) in |
0404b2ba7db6
Resolution Adjoint proved.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
80
diff
changeset
|
554 begin |
0404b2ba7db6
Resolution Adjoint proved.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
80
diff
changeset
|
555 KMap (( TMap nat-ε ( FObj F_T a )) * ( FMap F_T ( TMap nat-η a )) ) |
0404b2ba7db6
Resolution Adjoint proved.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
80
diff
changeset
|
556 ≈⟨⟩ |
0404b2ba7db6
Resolution Adjoint proved.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
80
diff
changeset
|
557 TMap μ a o (FMap T (id1 A (FObj T a) ) o ((TMap η (FObj T a)) o (TMap η a))) |
0404b2ba7db6
Resolution Adjoint proved.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
80
diff
changeset
|
558 ≈⟨ cdr ( car ( IsFunctor.identity (isFunctor T))) ⟩ |
0404b2ba7db6
Resolution Adjoint proved.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
80
diff
changeset
|
559 TMap μ a o ((id1 A (FObj T (FObj T a) )) o ((TMap η (FObj T a)) o (TMap η a))) |
0404b2ba7db6
Resolution Adjoint proved.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
80
diff
changeset
|
560 ≈⟨ cdr ( idL ) ⟩ |
0404b2ba7db6
Resolution Adjoint proved.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
80
diff
changeset
|
561 TMap μ a o ((TMap η (FObj T a)) o (TMap η a)) |
0404b2ba7db6
Resolution Adjoint proved.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
80
diff
changeset
|
562 ≈⟨ assoc ⟩ |
0404b2ba7db6
Resolution Adjoint proved.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
80
diff
changeset
|
563 (TMap μ a o (TMap η (FObj T a))) o (TMap η a) |
0404b2ba7db6
Resolution Adjoint proved.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
80
diff
changeset
|
564 ≈⟨ car (IsMonad.unity1 (isMonad M)) ⟩ |
0404b2ba7db6
Resolution Adjoint proved.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
80
diff
changeset
|
565 id1 A (FObj T a) o (TMap η a) |
0404b2ba7db6
Resolution Adjoint proved.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
80
diff
changeset
|
566 ≈⟨ idL ⟩ |
0404b2ba7db6
Resolution Adjoint proved.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
80
diff
changeset
|
567 TMap η a |
0404b2ba7db6
Resolution Adjoint proved.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
80
diff
changeset
|
568 ≈⟨⟩ |
0404b2ba7db6
Resolution Adjoint proved.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
80
diff
changeset
|
569 TMap η (FObj F_T a) |
0404b2ba7db6
Resolution Adjoint proved.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
80
diff
changeset
|
570 ≈⟨⟩ |
0404b2ba7db6
Resolution Adjoint proved.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
80
diff
changeset
|
571 KMap (id1 KleisliCategory (FObj F_T a)) |
82 | 572 ∎ |
77 | 573 |
87 | 574 open MResolution |
84 | 575 |
95 | 576 Resolution_T : MResolution A KleisliCategory T U_T F_T {nat-η} {nat-ε} {nat-μ} Adj_T |
84 | 577 Resolution_T = record { |
87 | 578 T=UF = Lemma11; |
579 μ=UεF = Lemma12 | |
84 | 580 } |
581 | |
97
2feec58bb02d
seprate comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
96
diff
changeset
|
582 -- end |