annotate yoneda.agda @ 186:b2e01aa0924d

y-nat (FMap of Yoneda Functor )
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Wed, 28 Aug 2013 23:32:24 +0900
parents 173d078ee443
children 47d6a9bc3933
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
178
6626a7cd9129 Yoneda Functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 open import Category -- https://github.com/konn/category-agda
6626a7cd9129 Yoneda Functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 open import Level
6626a7cd9129 Yoneda Functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 open import Category.Sets
6626a7cd9129 Yoneda Functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 module yoneda { c₁ c₂ ℓ : Level} { A : Category c₁ c₂ ℓ } where
6626a7cd9129 Yoneda Functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
6626a7cd9129 Yoneda Functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 open import HomReasoning
6626a7cd9129 Yoneda Functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 open import cat-utility
179
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
8 open import Relation.Binary.Core
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
9 open import Relation.Binary
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
10
178
6626a7cd9129 Yoneda Functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11
6626a7cd9129 Yoneda Functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 -- Contravariant Functor : op A → Sets ( Obj of Sets^{A^op} )
179
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
13 open Functor
178
6626a7cd9129 Yoneda Functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14
181
b58453d90db6 contravariant functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 180
diff changeset
15 -- A is Locally small
b58453d90db6 contravariant functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 180
diff changeset
16 postulate ≈-≡ : {a b : Obj A } { x y : Hom A a b } → (x≈y : A [ x ≈ y ]) → x ≡ y
b58453d90db6 contravariant functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 180
diff changeset
17
b58453d90db6 contravariant functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 180
diff changeset
18 import Relation.Binary.PropositionalEquality
b58453d90db6 contravariant functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 180
diff changeset
19 -- Extensionality a b = {A : Set a} {B : A → Set b} {f g : (x : A) → B x} → (∀ x → f x ≡ g x) → f ≡ g → ( λ x → f x ≡ λ x → g x )
b58453d90db6 contravariant functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 180
diff changeset
20 postulate extensionality : Relation.Binary.PropositionalEquality.Extensionality c₂ c₂
b58453d90db6 contravariant functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 180
diff changeset
21
b58453d90db6 contravariant functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 180
diff changeset
22
182
346e8eb35ec3 contravariant continue ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 181
diff changeset
23 CF' : (a : Obj A) → Functor A Sets
346e8eb35ec3 contravariant continue ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 181
diff changeset
24 CF' a = record {
178
6626a7cd9129 Yoneda Functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 FObj = λ b → Hom A a b
180
2d983d843e29 no yellow on co-Contravariant Functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 179
diff changeset
26 ; FMap = λ {b c : Obj A } → λ ( f : Hom A b c ) → λ (g : Hom A a b ) → A [ f o g ]
178
6626a7cd9129 Yoneda Functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 ; isFunctor = record {
180
2d983d843e29 no yellow on co-Contravariant Functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 179
diff changeset
28 identity = identity
2d983d843e29 no yellow on co-Contravariant Functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 179
diff changeset
29 ; distr = λ {a} {b} {c} {f} {g} → distr1 a b c f g
178
6626a7cd9129 Yoneda Functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 ; ≈-cong = cong1
6626a7cd9129 Yoneda Functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 }
6626a7cd9129 Yoneda Functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 } where
181
b58453d90db6 contravariant functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 180
diff changeset
33 lemma-CF1 : {b : Obj A } → (x : Hom A a b) → A [ id1 A b o x ] ≡ x
b58453d90db6 contravariant functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 180
diff changeset
34 lemma-CF1 {b} x = let open ≈-Reasoning (A) in ≈-≡ idL
180
2d983d843e29 no yellow on co-Contravariant Functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 179
diff changeset
35 identity : {b : Obj A} → Sets [ (λ (g : Hom A a b ) → A [ id1 A b o g ]) ≈ ( λ g → g ) ]
181
b58453d90db6 contravariant functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 180
diff changeset
36 identity {b} = extensionality lemma-CF1
b58453d90db6 contravariant functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 180
diff changeset
37 lemma-CF2 : (a₁ b c : Obj A) (f : Hom A a₁ b) (g : Hom A b c) → (x : Hom A a a₁ )→ A [ A [ g o f ] o x ] ≡ (Sets [ _[_o_] A g o _[_o_] A f ]) x
b58453d90db6 contravariant functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 180
diff changeset
38 lemma-CF2 a₁ b c f g x = let open ≈-Reasoning (A) in ≈-≡ ( begin
b58453d90db6 contravariant functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 180
diff changeset
39 A [ A [ g o f ] o x ]
b58453d90db6 contravariant functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 180
diff changeset
40 ≈↑⟨ assoc ⟩
b58453d90db6 contravariant functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 180
diff changeset
41 A [ g o A [ f o x ] ]
b58453d90db6 contravariant functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 180
diff changeset
42 ≈⟨⟩
b58453d90db6 contravariant functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 180
diff changeset
43 ( λ x → A [ g o x ] ) ( ( λ x → A [ f o x ] ) x )
b58453d90db6 contravariant functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 180
diff changeset
44 ∎ )
180
2d983d843e29 no yellow on co-Contravariant Functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 179
diff changeset
45 distr1 : (a₁ b c : Obj A) (f : Hom A a₁ b) (g : Hom A b c) →
2d983d843e29 no yellow on co-Contravariant Functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 179
diff changeset
46 Sets [ (λ g₁ → A [ A [ g o f ] o g₁ ]) ≈ Sets [ (λ g₁ → A [ g o g₁ ]) o (λ g₁ → A [ f o g₁ ]) ] ]
181
b58453d90db6 contravariant functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 180
diff changeset
47 distr1 a b c f g = extensionality ( λ x → lemma-CF2 a b c f g x )
180
2d983d843e29 no yellow on co-Contravariant Functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 179
diff changeset
48 cong1 : {A₁ B : Obj A} {f g : Hom A A₁ B} → A [ f ≈ g ] → Sets [ (λ g₁ → A [ f o g₁ ]) ≈ (λ g₁ → A [ g o g₁ ]) ]
181
b58453d90db6 contravariant functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 180
diff changeset
49 cong1 eq = extensionality ( λ x → ( ≈-≡ (
b58453d90db6 contravariant functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 180
diff changeset
50 (IsCategory.o-resp-≈ ( Category.isCategory A )) ( IsEquivalence.refl (IsCategory.isEquivalence ( Category.isCategory A ))) eq )))
178
6626a7cd9129 Yoneda Functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
51
182
346e8eb35ec3 contravariant continue ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 181
diff changeset
52 open import Function
178
6626a7cd9129 Yoneda Functor
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
53
184
d2d749318bee oeration
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 183
diff changeset
54 CF : {a : Obj A} → Functor (Category.op A) (Sets {c₂})
d2d749318bee oeration
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 183
diff changeset
55 CF {a} = record {
182
346e8eb35ec3 contravariant continue ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 181
diff changeset
56 FObj = λ b → Hom (Category.op A) a b
346e8eb35ec3 contravariant continue ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 181
diff changeset
57 ; FMap = λ {b c : Obj A } → λ ( f : Hom A c b ) → λ (g : Hom A b a ) → (Category.op A) [ f o g ]
346e8eb35ec3 contravariant continue ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 181
diff changeset
58 ; isFunctor = record {
346e8eb35ec3 contravariant continue ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 181
diff changeset
59 identity = \{b} → extensionality ( λ x → lemma-CF1 {b} x )
183
ea6fc610b480 Contravariant functor done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 182
diff changeset
60 ; distr = λ {a} {b} {c} {f} {g} → extensionality ( λ x → lemma-CF2 a b c f g x )
ea6fc610b480 Contravariant functor done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 182
diff changeset
61 ; ≈-cong = λ eq → extensionality ( λ x → lemma-CF3 x eq )
182
346e8eb35ec3 contravariant continue ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 181
diff changeset
62 }
346e8eb35ec3 contravariant continue ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 181
diff changeset
63 } where
346e8eb35ec3 contravariant continue ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 181
diff changeset
64 lemma-CF1 : {b : Obj A } → (x : Hom A b a) → (Category.op A) [ id1 A b o x ] ≡ x
346e8eb35ec3 contravariant continue ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 181
diff changeset
65 lemma-CF1 {b} x = let open ≈-Reasoning (Category.op A) in ≈-≡ idL
183
ea6fc610b480 Contravariant functor done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 182
diff changeset
66 lemma-CF2 : (a₁ b c : Obj A) (f : Hom A b a₁) (g : Hom A c b ) → (x : Hom A a₁ a )→
ea6fc610b480 Contravariant functor done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 182
diff changeset
67 Category.op A [ Category.op A [ g o f ] o x ] ≡ (Sets [ _[_o_] (Category.op A) g o _[_o_] (Category.op A) f ]) x
ea6fc610b480 Contravariant functor done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 182
diff changeset
68 lemma-CF2 a₁ b c f g x = let open ≈-Reasoning (Category.op A) in ≈-≡ ( begin
ea6fc610b480 Contravariant functor done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 182
diff changeset
69 Category.op A [ Category.op A [ g o f ] o x ]
ea6fc610b480 Contravariant functor done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 182
diff changeset
70 ≈↑⟨ assoc ⟩
ea6fc610b480 Contravariant functor done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 182
diff changeset
71 Category.op A [ g o Category.op A [ f o x ] ]
ea6fc610b480 Contravariant functor done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 182
diff changeset
72 ≈⟨⟩
ea6fc610b480 Contravariant functor done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 182
diff changeset
73 ( λ x → Category.op A [ g o x ] ) ( ( λ x → Category.op A [ f o x ] ) x )
ea6fc610b480 Contravariant functor done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 182
diff changeset
74 ∎ )
ea6fc610b480 Contravariant functor done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 182
diff changeset
75 lemma-CF3 : {b c : Obj A} {f g : Hom A c b } → (x : Hom A b a ) → A [ f ≈ g ] → Category.op A [ f o x ] ≡ Category.op A [ g o x ]
ea6fc610b480 Contravariant functor done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 182
diff changeset
76 lemma-CF3 {_} {_} {f} {g} x eq = let open ≈-Reasoning (Category.op A) in ≈-≡ ( begin
ea6fc610b480 Contravariant functor done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 182
diff changeset
77 Category.op A [ f o x ]
ea6fc610b480 Contravariant functor done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 182
diff changeset
78 ≈⟨ resp refl-hom eq ⟩
ea6fc610b480 Contravariant functor done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 182
diff changeset
79 Category.op A [ g o x ]
ea6fc610b480 Contravariant functor done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 182
diff changeset
80 ∎ )
ea6fc610b480 Contravariant functor done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 182
diff changeset
81
184
d2d749318bee oeration
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 183
diff changeset
82 YObj = Functor (Category.op A) (Sets {c₂})
d2d749318bee oeration
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 183
diff changeset
83 YHom = λ (f : YObj ) → λ (g : YObj ) → NTrans (Category.op A) Sets f g
d2d749318bee oeration
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 183
diff changeset
84
186
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
85 y-map : ( a b : Obj A ) → (f : Hom A a b ) → (x : Obj (Category.op A)) → FObj (CF {a}) x → FObj (CF {b} ) x
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
86 y-map a b f x = λ ( g : Hom A x a ) → A [ f o g ] -- ( h : Hom A x b )
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
87
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
88 y-nat : {a b : Obj A } → (f : Hom A a b ) → YHom (CF {a}) (CF {b})
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
89 y-nat {a} {b} f = record { TMap = y-map a b f ; isNTrans = isNTrans1 {a} {b} f } where
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
90 lemma-CF5 : {a₁ b₁ : Obj (Category.op A)} {g : Hom (Category.op A) a₁ b₁} → {a b : Obj A } → (x : Hom A a₁ a) → (f : Hom A a b ) →
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
91 (Sets [ FMap CF g o y-map a b f a₁ ]) x ≡ (Sets [ y-map a b f b₁ o FMap CF g ]) x
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
92 lemma-CF5 {a₁} {b₁} {g} {a} {b} x f = let open ≈-Reasoning (A) in ≈-≡ ( begin
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
93 A [ A [ f o x ] o g ]
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
94 ≈↑⟨ assoc ⟩
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
95 A [ f o A [ x o g ] ]
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
96 ∎ )
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
97 lemma-CF4 : {a₁ b₁ : Obj (Category.op A)} {g : Hom (Category.op A) a₁ b₁} → {a b : Obj A } → (f : Hom A a b ) →
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
98 Sets [ Sets [ FMap CF g o y-map a b f a₁ ] ≈
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
99 Sets [ y-map a b f b₁ o FMap CF g ] ]
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
100 lemma-CF4 {a₁} {b₁} {g} {a} {b} f = let open ≈-Reasoning (Sets {c₂})in begin
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
101 Sets [ FMap CF g o y-map a b f a₁ ]
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
102 ≈⟨ extensionality ( λ x → lemma-CF5 {a₁} {b₁} {g} {a} {b} x f) ⟩
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
103 Sets [ y-map a b f b₁ o FMap CF g ]
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
104
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
105 isNTrans1 : {a b : Obj A } → (f : Hom A a b ) → IsNTrans (Category.op A) (Sets {c₂}) (CF {a}) (CF {b}) (y-map a b f )
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
106 isNTrans1 {a} {b} f = record { commute = λ{a₁ b₁ g } → lemma-CF4 {a₁} {b₁} {g} {a} {b} f }
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
107
184
d2d749318bee oeration
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 183
diff changeset
108 open NTrans
d2d749318bee oeration
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 183
diff changeset
109 Yid : {a : YObj} → YHom a a
d2d749318bee oeration
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 183
diff changeset
110 Yid {a} = record { TMap = \a -> \x -> x ; isNTrans = isNTrans1 {a} } where
d2d749318bee oeration
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 183
diff changeset
111 isNTrans1 : {a : YObj } → IsNTrans (Category.op A) (Sets {c₂}) a a (\a -> \x -> x )
d2d749318bee oeration
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 183
diff changeset
112 isNTrans1 {a} = record { commute = refl }
d2d749318bee oeration
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 183
diff changeset
113
d2d749318bee oeration
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 183
diff changeset
114 _+_ : {a b c : YObj} → YHom b c → YHom a b → YHom a c
185
173d078ee443 Yoneda join
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 184
diff changeset
115 _+_{a} {b} {c} f g = record { TMap = λ x → Sets [ TMap f x o TMap g x ] ; isNTrans = isNTrans1 } where
173d078ee443 Yoneda join
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 184
diff changeset
116 commute1 : (a b c : YObj ) (f : YHom b c) (g : YHom a b )
173d078ee443 Yoneda join
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 184
diff changeset
117 (a₁ b₁ : Obj (Category.op A)) (h : Hom (Category.op A) a₁ b₁) →
173d078ee443 Yoneda join
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 184
diff changeset
118 Sets [ Sets [ FMap c h o Sets [ TMap f a₁ o TMap g a₁ ] ] ≈
173d078ee443 Yoneda join
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 184
diff changeset
119 Sets [ Sets [ TMap f b₁ o TMap g b₁ ] o FMap a h ] ]
173d078ee443 Yoneda join
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 184
diff changeset
120 commute1 a b c f g a₁ b₁ h = let open ≈-Reasoning (Sets {c₂})in begin
173d078ee443 Yoneda join
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 184
diff changeset
121 Sets [ FMap c h o Sets [ TMap f a₁ o TMap g a₁ ] ]
173d078ee443 Yoneda join
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 184
diff changeset
122 ≈⟨ assoc {_} {_} {_} {_} {FMap c h } {TMap f a₁} {TMap g a₁} ⟩
173d078ee443 Yoneda join
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 184
diff changeset
123 Sets [ Sets [ FMap c h o TMap f a₁ ] o TMap g a₁ ]
173d078ee443 Yoneda join
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 184
diff changeset
124 ≈⟨ car (nat f) ⟩
173d078ee443 Yoneda join
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 184
diff changeset
125 Sets [ Sets [ TMap f b₁ o FMap b h ] o TMap g a₁ ]
173d078ee443 Yoneda join
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 184
diff changeset
126 ≈↑⟨ assoc {_} {_} {_} {_} { TMap f b₁} {FMap b h } {TMap g a₁}⟩
173d078ee443 Yoneda join
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 184
diff changeset
127 Sets [ TMap f b₁ o Sets [ FMap b h o TMap g a₁ ] ]
173d078ee443 Yoneda join
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 184
diff changeset
128 ≈⟨ cdr {_} {_} {_} {_} {_} { TMap f b₁} (nat g) ⟩
173d078ee443 Yoneda join
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 184
diff changeset
129 Sets [ TMap f b₁ o Sets [ TMap g b₁ o FMap a h ] ]
173d078ee443 Yoneda join
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 184
diff changeset
130 ≈↑⟨ assoc {_} {_} {_} {_} {TMap f b₁} {TMap g b₁} { FMap a h} ⟩
173d078ee443 Yoneda join
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 184
diff changeset
131 Sets [ Sets [ TMap f b₁ o TMap g b₁ ] o FMap a h ]
173d078ee443 Yoneda join
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 184
diff changeset
132
173d078ee443 Yoneda join
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 184
diff changeset
133 isNTrans1 : IsNTrans (Category.op A) (Sets {c₂}) a c (λ x → Sets [ TMap f x o TMap g x ])
173d078ee443 Yoneda join
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 184
diff changeset
134 isNTrans1 = record { commute = λ {a₁ b₁ h} → commute1 a b c f g a₁ b₁ h }
184
d2d749318bee oeration
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 183
diff changeset
135
186
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
136 _==_ : {a b : YObj} → YHom a b → YHom a b → Set (c₂ ⊔ c₁)
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
137 _==_ f g = TMap f ≡ TMap g
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
138
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
139 infix 4 _==_
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
140
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
141 isSetsAop : IsCategory YObj YHom _==_ _+_ Yid
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
142 isSetsAop = record { isEquivalence = record {refl = refl ; trans = ≡-trans ; sym = ≡-sym}
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
143 ; identityL = refl
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
144 ; identityR = refl
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
145 ; o-resp-≈ = λ{a b c f g h i } → o-resp-≈ {a} {b} {c} {f} {g} {h} {i}
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
146 ; associative = refl
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
147 } where
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
148 o-resp-≈ : {A₁ B C : YObj} {f g : YHom A₁ B} {h i : YHom B C} →
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
149 f == g → h == i → h + f == i + g
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
150 o-resp-≈ refl refl = refl
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
151
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
152 SetsAop : Category (suc (ℓ ⊔ (suc c₂) ⊔ c₁)) (suc ( ℓ ⊔ (suc c₂) ⊔ c₁)) (c₂ ⊔ c₁)
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
153 SetsAop =
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
154 record { Obj = YObj
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
155 ; Hom = YHom
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
156 ; _o_ = _+_
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
157 ; _≈_ = _==_
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
158 ; Id = Yid
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
159 ; isCategory = isSetsAop
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
160 }
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
161
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
162 YonedaFunctor : Functor A SetsAop
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
163 YonedaFunctor = record {
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
164 FObj = λ a → CF {a}
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
165 ; FMap = λ f → y-nat f
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
166 ; isFunctor = record {
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
167 identity = {!!}
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
168 ; distr = {!!}
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
169 ; ≈-cong = {!!}
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
170 }
b2e01aa0924d y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 185
diff changeset
171 }
184
d2d749318bee oeration
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 183
diff changeset
172
185
173d078ee443 Yoneda join
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 184
diff changeset
173