annotate comparison-functor.agda @ 784:f27d966939f8

add CCC hom
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Wed, 17 Apr 2019 14:47:39 +0900
parents a5f2ca67e7c5
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
98
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 -- -- -- -- -- -- -- --
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 -- Comparison Functor of Kelisli Category
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 -- defines U_K and F_K as a resolution of Monad
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 -- checks Adjointness
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 --
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 -- Shinji KONO <kono@ie.u-ryukyu.ac.jp>
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 -- -- -- -- -- -- -- --
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 open import Category -- https://github.com/konn/category-agda
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 open import Level
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 --open import Category.HomReasoning
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 open import HomReasoning
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 open import cat-utility
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 open import Category.Cat
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 open import Relation.Binary.Core
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 module comparison-functor
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 { c₁ c₂ ℓ : Level} { A : Category c₁ c₂ ℓ }
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 { T : Functor A A }
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 { η : NTrans A A identityFunctor T }
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 { μ : NTrans A A (T ○ T) T }
688
a5f2ca67e7c5 fix monad/adjunction definition
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 465
diff changeset
22 { M' : IsMonad A T η μ }
98
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 {c₁' c₂' ℓ' : Level} ( B : Category c₁' c₂' ℓ' )
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 { U_K : Functor B A } { F_K : Functor A B }
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 { η_K : NTrans A A identityFunctor ( U_K ○ F_K ) }
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 { ε_K : NTrans B B ( F_K ○ U_K ) identityFunctor }
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 { μ_K' : NTrans A A (( U_K ○ F_K ) ○ ( U_K ○ F_K )) ( U_K ○ F_K ) }
688
a5f2ca67e7c5 fix monad/adjunction definition
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 465
diff changeset
28 ( AdjK : IsAdjunction A B U_K F_K η_K ε_K )
465
d3cd28a71b3f clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 301
diff changeset
29 where
98
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
30
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 open import adj-monad
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
32
99
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
33 T_K = U_K ○ F_K
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
34
98
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 μ_K : NTrans A A (( U_K ○ F_K ) ○ ( U_K ○ F_K )) ( U_K ○ F_K )
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 μ_K = UεF A B U_K F_K ε_K
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
37
688
a5f2ca67e7c5 fix monad/adjunction definition
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 465
diff changeset
38 M : IsMonad A (U_K ○ F_K ) η_K μ_K
a5f2ca67e7c5 fix monad/adjunction definition
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 465
diff changeset
39 M = Monad.isMonad ( Adj2Monad A B ( record { U = U_K; F = F_K ; η = η_K ; ε = ε_K ; isAdjunction = AdjK } ) )
98
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
40
152
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 130
diff changeset
41 open import kleisli {c₁} {c₂} {ℓ} {A} { U_K ○ F_K } { η_K } { μ_K } { M }
98
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
42
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 open Functor
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 open NTrans
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 open KleisliHom
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 open Adjunction
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 open MResolution
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
48
300
d6a6dd305da2 arrow and lambda fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 152
diff changeset
49 kfmap : {a b : Obj A} (f : KHom a b) → Hom B (FObj F_K a) (FObj F_K b)
98
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 kfmap {_} {b} f = B [ TMap ε_K (FObj F_K b) o FMap F_K (KMap f) ]
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
51
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 K_T : Functor KleisliCategory B
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 K_T = record {
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 FObj = FObj F_K
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 ; FMap = kfmap
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 ; isFunctor = record
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
57 { ≈-cong = ≈-cong
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 ; identity = identity
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 ; distr = distr1
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 }
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
61 } where
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 identity : {a : Obj A} → B [ kfmap (K-id {a}) ≈ id1 B (FObj F_K a) ]
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 identity {a} = let open ≈-Reasoning (B) in
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
64 begin
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
65 kfmap (K-id {a})
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 ≈⟨⟩
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 TMap ε_K (FObj F_K a) o FMap F_K (KMap (K-id {a}))
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
68 ≈⟨⟩
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
69 TMap ε_K (FObj F_K a) o FMap F_K (TMap η_K a)
688
a5f2ca67e7c5 fix monad/adjunction definition
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 465
diff changeset
70 ≈⟨ IsAdjunction.adjoint2 AdjK ⟩
98
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
71 id1 B (FObj F_K a)
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
72
300
d6a6dd305da2 arrow and lambda fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 152
diff changeset
73 ≈-cong : {a b : Obj A} → {f g : KHom a b} → A [ KMap f ≈ KMap g ] → B [ kfmap f ≈ kfmap g ]
98
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 ≈-cong {a} {b} {f} {g} f≈g = let open ≈-Reasoning (B) in
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
75 begin
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
76 kfmap f
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 ≈⟨⟩
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 TMap ε_K (FObj F_K b) o FMap F_K (KMap f)
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 ≈⟨ cdr ( fcong F_K f≈g) ⟩
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 TMap ε_K (FObj F_K b) o FMap F_K (KMap g)
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 ≈⟨⟩
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 kfmap g
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
83
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 distr1 : {a b c : Obj A} {f : KHom a b} {g : KHom b c} → B [ kfmap (g * f) ≈ (B [ kfmap g o kfmap f ] )]
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 distr1 {a} {b} {c} {f} {g} = let open ≈-Reasoning (B) in
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 begin
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
87 kfmap (g * f)
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 ≈⟨⟩
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
89 TMap ε_K (FObj F_K c) o FMap F_K (KMap (g * f))
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
90 ≈⟨⟩
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
91 TMap ε_K (FObj F_K c) o FMap F_K (A [ TMap μ_K c o A [ FMap ( U_K ○ F_K ) (KMap g) o KMap f ] ] )
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
92 ≈⟨ cdr ( distr F_K ) ⟩
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
93 TMap ε_K (FObj F_K c) o ( FMap F_K (TMap μ_K c) o ( FMap F_K (A [ FMap ( U_K ○ F_K ) (KMap g) o KMap f ])))
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
94 ≈⟨ cdr (cdr ( distr F_K )) ⟩
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
95 TMap ε_K (FObj F_K c) o ( FMap F_K (TMap μ_K c) o (( FMap F_K (FMap ( U_K ○ F_K ) (KMap g))) o (FMap F_K (KMap f))))
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
96 ≈⟨ cdr assoc ⟩
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
97 TMap ε_K (FObj F_K c) o ((( FMap F_K (TMap μ_K c) o ( FMap F_K (FMap (U_K ○ F_K) (KMap g))))) o (FMap F_K (KMap f)))
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
98 ≈⟨⟩
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
99 TMap ε_K (FObj F_K c) o (( FMap F_K ( FMap U_K ( TMap ε_K ( FObj F_K c ) )) o
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
100 ( FMap F_K (FMap (U_K ○ F_K) (KMap g)))) o (FMap F_K (KMap f)))
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
101 ≈⟨ sym (cdr assoc) ⟩
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
102 TMap ε_K (FObj F_K c) o (( FMap F_K ( FMap U_K ( TMap ε_K ( FObj F_K c ) ))) o
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
103 (( FMap F_K (FMap (U_K ○ F_K) (KMap g))) o (FMap F_K (KMap f))))
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
104 ≈⟨ assoc ⟩
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
105 (TMap ε_K (FObj F_K c) o ( FMap F_K ( FMap U_K ( TMap ε_K ( FObj F_K c ) )))) o
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
106 (( FMap F_K (FMap (U_K ○ F_K) (KMap g))) o (FMap F_K (KMap f)))
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
107 ≈⟨ car (sym (nat ε_K)) ⟩
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
108 (TMap ε_K (FObj F_K c) o ( TMap ε_K (FObj (F_K ○ U_K) (FObj F_K c)))) o
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
109 (( FMap F_K (FMap (U_K ○ F_K) (KMap g))) o (FMap F_K (KMap f)))
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
110 ≈⟨ sym assoc ⟩
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
111 TMap ε_K (FObj F_K c) o (( TMap ε_K (FObj (F_K ○ U_K) (FObj F_K c))) o
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
112 ((( FMap F_K (FMap (U_K ○ F_K) (KMap g)))) o (FMap F_K (KMap f))))
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
113 ≈⟨ cdr assoc ⟩
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
114 TMap ε_K (FObj F_K c) o ((( TMap ε_K (FObj (F_K ○ U_K) (FObj F_K c))) o
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
115 (( FMap F_K (FMap (U_K ○ F_K) (KMap g))))) o (FMap F_K (KMap f)))
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
116 ≈⟨ cdr ( car (
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
117 begin
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
118 TMap ε_K (FObj (F_K ○ U_K) (FObj F_K c)) o ((FMap F_K (FMap (U_K ○ F_K) (KMap g))))
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
119 ≈⟨⟩
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
120 TMap ε_K (FObj (F_K ○ U_K) (FObj F_K c)) o (FMap (F_K ○ U_K) (FMap F_K (KMap g)))
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
121 ≈⟨ sym (nat ε_K) ⟩
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
122 ( FMap F_K (KMap g)) o (TMap ε_K (FObj F_K b))
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
123
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
124 )) ⟩
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
125 TMap ε_K (FObj F_K c) o ((( FMap F_K (KMap g)) o (TMap ε_K (FObj F_K b))) o FMap F_K (KMap f))
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
126 ≈⟨ cdr (sym assoc) ⟩
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
127 TMap ε_K (FObj F_K c) o (( FMap F_K (KMap g)) o (TMap ε_K (FObj F_K b) o FMap F_K (KMap f)))
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
128 ≈⟨ assoc ⟩
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
129 (TMap ε_K (FObj F_K c) o FMap F_K (KMap g)) o (TMap ε_K (FObj F_K b) o FMap F_K (KMap f))
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
130 ≈⟨⟩
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
131 kfmap g o kfmap f
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
132
b0ba34a27783 generated version of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
133
300
d6a6dd305da2 arrow and lambda fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 152
diff changeset
134 Lemma-K1 : {a b : Obj A} ( f : Hom A a b ) → B [ FMap K_T ( FMap F_T f) ≈ FMap F_K f ]
99
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
135 Lemma-K1 {a} {b} f = let open ≈-Reasoning (B) in
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
136 begin
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
137 FMap K_T ( FMap F_T f)
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
138 ≈⟨⟩
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
139 TMap ε_K (FObj F_K b) o FMap F_K (KMap( FMap F_T f))
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
140 ≈⟨⟩
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
141 TMap ε_K (FObj F_K b) o FMap F_K (A [ TMap η_K b o f ])
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
142 ≈⟨ cdr ( distr F_K) ⟩
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
143 TMap ε_K (FObj F_K b) o (FMap F_K (TMap η_K b) o FMap F_K f )
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
144 ≈⟨ assoc ⟩
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
145 (TMap ε_K (FObj F_K b) o FMap F_K (TMap η_K b)) o FMap F_K f
688
a5f2ca67e7c5 fix monad/adjunction definition
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 465
diff changeset
146 ≈⟨ car ( IsAdjunction.adjoint2 AdjK) ⟩
99
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
147 id1 B (FObj F_K b) o FMap F_K f
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
148 ≈⟨ idL ⟩
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
149 FMap F_K f
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
150
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
151
300
d6a6dd305da2 arrow and lambda fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 152
diff changeset
152 Lemma-K2 : {a b : Obj A} ( f : KHom a b ) → A [ FMap U_K ( FMap K_T f) ≈ FMap U_T f ]
99
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
153 Lemma-K2 {a} {b} f = let open ≈-Reasoning (A) in
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
154 begin
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
155 FMap U_K ( FMap K_T f)
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
156 ≈⟨⟩
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
157 FMap U_K ( B [ TMap ε_K (FObj F_K b) o FMap F_K (KMap f) ] )
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
158 ≈⟨ distr U_K ⟩
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
159 FMap U_K ( TMap ε_K (FObj F_K b)) o FMap U_K (FMap F_K (KMap f) )
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
160 ≈⟨⟩
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
161 TMap μ_K b o FMap T_K (KMap f)
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
162 ≈⟨⟩ -- the definition
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
163 FMap U_T f
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
164
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
165
300
d6a6dd305da2 arrow and lambda fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 152
diff changeset
166 Lemma-K3 : (b : Obj A) → B [ FMap K_T (record { KMap = (TMap η_K b) }) ≈ id1 B (FObj F_K b) ]
99
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
167 Lemma-K3 b = let open ≈-Reasoning (B) in
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
168 begin
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
169 FMap K_T (record { KMap = (TMap η_K b) })
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
170 ≈⟨⟩
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
171 TMap ε_K (FObj F_K b) o FMap F_K (TMap η_K b)
688
a5f2ca67e7c5 fix monad/adjunction definition
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 465
diff changeset
172 ≈⟨ IsAdjunction.adjoint2 AdjK ⟩
99
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
173 id1 B (FObj F_K b)
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
174
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
175
300
d6a6dd305da2 arrow and lambda fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 152
diff changeset
176 Lemma-K4 : (b c : Obj A) (g : Hom A b (FObj T_K c)) →
128
276f33602700 Comparison Functor all done.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 99
diff changeset
177 B [ FMap K_T ( record { KMap = A [ (TMap η_K (FObj T_K c)) o g ] }) ≈ FMap F_K g ]
99
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
178 Lemma-K4 b c g = let open ≈-Reasoning (B) in
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
179 begin
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
180 FMap K_T ( record { KMap = A [ (TMap η_K (FObj T_K c)) o g ] })
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
181 ≈⟨⟩
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
182 TMap ε_K (FObj F_K (FObj T_K c)) o FMap F_K (A [ (TMap η_K (FObj T_K c)) o g ])
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
183 ≈⟨ cdr (distr F_K) ⟩
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
184 TMap ε_K (FObj F_K (FObj T_K c)) o ( FMap F_K (TMap η_K (FObj T_K c)) o FMap F_K g )
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
185 ≈⟨ assoc ⟩
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
186 (TMap ε_K (FObj F_K (FObj T_K c)) o ( FMap F_K (TMap η_K (FObj T_K c)))) o FMap F_K g
688
a5f2ca67e7c5 fix monad/adjunction definition
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 465
diff changeset
187 ≈⟨ car ( IsAdjunction.adjoint2 AdjK) ⟩
99
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
188 id1 B (FObj F_K (FObj T_K c)) o FMap F_K g
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
189 ≈⟨ idL ⟩
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
190 FMap F_K g
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
191
bd542a1caf08 uniquness of comparison functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
192
300
d6a6dd305da2 arrow and lambda fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 152
diff changeset
193 -- Lemma-K5 : (a : Obj A) → FObj U_K ( FObj K_T a ) = U_T a
128
276f33602700 Comparison Functor all done.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 99
diff changeset
194
300
d6a6dd305da2 arrow and lambda fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 152
diff changeset
195 Lemma-K6 : (b c : Obj A) (g : KHom b c) → A [ FMap U_K ( FMap K_T g ) ≈ FMap U_T g ]
128
276f33602700 Comparison Functor all done.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 99
diff changeset
196 Lemma-K6 b c g = let open ≈-Reasoning (A) in
276f33602700 Comparison Functor all done.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 99
diff changeset
197 begin
276f33602700 Comparison Functor all done.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 99
diff changeset
198 FMap U_K ( FMap K_T g )
276f33602700 Comparison Functor all done.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 99
diff changeset
199 ≈⟨⟩
276f33602700 Comparison Functor all done.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 99
diff changeset
200 FMap U_K ( B [ TMap ε_K ( FObj F_K c ) o FMap F_K (KMap g) ] )
276f33602700 Comparison Functor all done.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 99
diff changeset
201 ≈⟨ distr U_K ⟩
276f33602700 Comparison Functor all done.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 99
diff changeset
202 FMap U_K ( TMap ε_K ( FObj F_K c )) o FMap U_K ( FMap F_K (KMap g) )
276f33602700 Comparison Functor all done.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 99
diff changeset
203 ≈⟨⟩
276f33602700 Comparison Functor all done.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 99
diff changeset
204 TMap μ_K c o FMap U_K ( FMap F_K (KMap g) )
276f33602700 Comparison Functor all done.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 99
diff changeset
205 ≈⟨⟩
276f33602700 Comparison Functor all done.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 99
diff changeset
206 FMap U_T g
276f33602700 Comparison Functor all done.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 99
diff changeset
207
276f33602700 Comparison Functor all done.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 99
diff changeset
208
276f33602700 Comparison Functor all done.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 99
diff changeset
209