Mercurial > hg > Members > kono > Proof > category
annotate src/yoneda.agda @ 1036:b836c3dc7a29
...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 02 Apr 2021 11:26:44 +0900 |
parents | 40c39d3e6a75 |
children | 321f0fef54c2 |
rev | line source |
---|---|
202
58ee98bbb333
remove an extensionality
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
199
diff
changeset
|
1 --- |
189 | 2 -- |
3 -- A → Sets^A^op : Yoneda Functor | |
4 -- Contravariant Functor h_a | |
5 -- Nat(h_a,F) | |
6 -- Shinji KONO <kono@ie.u-ryukyu.ac.jp> | |
7 ---- | |
8 | |
178 | 9 open import Category -- https://github.com/konn/category-agda |
10 open import Level | |
11 open import Category.Sets | |
996 | 12 open import cat-utility |
13 module yoneda { c₁ c₂ ℓ : Level} ( A : Category c₁ c₂ ℓ ) (I : Set c₁) ( small : Small A I ) where | |
178 | 14 |
15 open import HomReasoning | |
179 | 16 open import Relation.Binary.Core |
17 open import Relation.Binary | |
781 | 18 open import Relation.Binary.PropositionalEquality hiding ( [_] ; sym ) |
19 | |
179 | 20 |
178 | 21 |
22 -- Contravariant Functor : op A → Sets ( Obj of Sets^{A^op} ) | |
197 | 23 -- Obj and Hom of Sets^A^op |
181 | 24 |
197 | 25 open Functor |
996 | 26 open NTrans |
184 | 27 |
996 | 28 SetsAop : Category (suc ℓ ⊔ (suc (suc c₂) ⊔ suc c₁)) (suc ℓ ⊔ (suc (suc c₂) ⊔ suc c₁)) (c₂ ⊔ c₁) |
29 SetsAop = record { Obj = YObj | |
30 ; Hom = YHom | |
31 ; _o_ = _+_ | |
32 ; _≈_ = _==_ | |
33 ; Id = Yid | |
34 ; isCategory = record { | |
35 isEquivalence = record {refl = refl ; trans = λ {i} {j} {k} → trans1 {_} {_} {i} {j} {k} ; sym = λ {i j} → sym1 {_} {_} {i} {j}} | |
36 ; identityL = refl | |
37 ; identityR = refl | |
38 ; o-resp-≈ = λ{a b c f g h i } → o-resp-≈ {a} {b} {c} {f} {g} {h} {i} | |
39 ; associative = refl | |
40 } } where | |
41 open ≈-Reasoning (Sets {c₂}) | |
42 YObj : Set (suc ℓ ⊔ (suc (suc c₂) ⊔ suc c₁)) | |
43 YObj = Functor (Category.op A) (Sets {c₂}) | |
44 YHom : ( f : YObj ) → (g : YObj ) → Set (suc ℓ ⊔ (suc (suc c₂) ⊔ suc c₁)) | |
45 YHom f g = NTrans (Category.op A) (Sets {c₂}) f g | |
184 | 46 |
996 | 47 Yid : {a : YObj } → YHom a a |
48 Yid {a} = record { TMap = λ a → λ x → x ; isNTrans = isNTrans1 {a} } where | |
49 isNTrans1 : {a : YObj } → IsNTrans (Category.op A) (Sets {c₂}) a a (λ a → λ x → x ) | |
50 isNTrans1 {a} = record { commute = refl } | |
184 | 51 |
996 | 52 _+_ : {a b c : YObj} → YHom b c → YHom a b → YHom a c |
53 _+_ {a} {b} {c} f g = | |
54 record { TMap = λ x → Sets [ TMap f x o TMap g x ] ; | |
55 isNTrans = record { commute = λ {a₁ b₁ h} → commute1 a b c f g a₁ b₁ h } } where | |
56 commute1 : (a b c : YObj ) (f : YHom b c) (g : YHom a b ) | |
57 (a₁ b₁ : Obj (Category.op A)) (h : Hom (Category.op A) a₁ b₁) → | |
58 Sets [ Sets [ FMap c h o Sets [ TMap f a₁ o TMap g a₁ ] ] ≈ | |
59 Sets [ Sets [ TMap f b₁ o TMap g b₁ ] o FMap a h ] ] | |
60 commute1 a b c f g a₁ b₁ h = begin | |
61 Sets [ FMap c h o Sets [ TMap f a₁ o TMap g a₁ ] ] ≈⟨ assoc {_} {_} {_} {_} {FMap c h } {TMap f a₁} {TMap g a₁} ⟩ | |
62 Sets [ Sets [ FMap c h o TMap f a₁ ] o TMap g a₁ ] ≈⟨ car (nat f) ⟩ | |
63 Sets [ Sets [ TMap f b₁ o FMap b h ] o TMap g a₁ ] ≈↑⟨ assoc {_} {_} {_} {_} { TMap f b₁} {FMap b h } {TMap g a₁}⟩ | |
64 Sets [ TMap f b₁ o Sets [ FMap b h o TMap g a₁ ] ] ≈⟨ cdr {_} {_} {_} {_} {_} { TMap f b₁} (nat g) ⟩ | |
65 Sets [ TMap f b₁ o Sets [ TMap g b₁ o FMap a h ] ] ≈↑⟨ assoc {_} {_} {_} {_} {TMap f b₁} {TMap g b₁} { FMap a h} ⟩ | |
66 Sets [ Sets [ TMap f b₁ o TMap g b₁ ] o FMap a h ] ∎ | |
186
b2e01aa0924d
y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
185
diff
changeset
|
67 |
996 | 68 _==_ : {a b : YObj} → YHom a b → YHom a b → Set (c₂ ⊔ c₁) |
69 _==_ f g = ∀{x : Obj (Category.op A)} → (Sets {c₂}) [ TMap f x ≈ TMap g x ] | |
70 | |
987 | 71 sym1 : {a b : YObj } {i j : YHom a b } → i == j → j == i |
358 | 72 sym1 {a} {b} {i} {j} eq {x} = sym eq |
987 | 73 trans1 : {a b : YObj } {i j k : YHom a b} → i == j → j == k → i == k |
358 | 74 trans1 {a} {b} {i} {j} {k} i=j j=k {x} = trans-hom i=j j=k |
987 | 75 o-resp-≈ : {A₁ B C : YObj} {f g : YHom A₁ B} {h i : YHom B C} → |
996 | 76 f == g → h == i → (h + f) == (i + g) |
358 | 77 o-resp-≈ {a} {b} {c} {f} {g} {h} {i} f=g h=i {x} = resp f=g h=i |
186
b2e01aa0924d
y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
185
diff
changeset
|
78 |
197 | 79 -- A is Locally small |
996 | 80 postulate ≈-≡ : { c₁ c₂ ℓ : Level} ( A : Category c₁ c₂ ℓ ) {a b : Obj A } { x y : Hom A a b } → (x≈y : A [ x ≈ y ]) → x ≡ y |
197 | 81 |
82 ---- | |
83 -- | |
84 -- Object mapping in Yoneda Functor | |
85 -- | |
86 ---- | |
87 | |
88 open import Function | |
89 | |
987 | 90 y-obj : (a : Obj A) → Functor (Category.op A) (Sets {c₂}) |
91 y-obj a = record { | |
197 | 92 FObj = λ b → Hom (Category.op A) a b ; |
93 FMap = λ {b c : Obj A } → λ ( f : Hom A c b ) → λ (g : Hom A b a ) → (Category.op A) [ f o g ] ; | |
94 isFunctor = record { | |
468
c375d8f93a2c
discrete category and product from a limit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
358
diff
changeset
|
95 identity = λ {b} → extensionality A ( λ x → lemma-y-obj1 {b} x ) ; |
c375d8f93a2c
discrete category and product from a limit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
358
diff
changeset
|
96 distr = λ {a} {b} {c} {f} {g} → extensionality A ( λ x → lemma-y-obj2 a b c f g x ) ; |
c375d8f93a2c
discrete category and product from a limit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
358
diff
changeset
|
97 ≈-cong = λ eq → extensionality A ( λ x → lemma-y-obj3 x eq ) |
197 | 98 } |
99 } where | |
100 lemma-y-obj1 : {b : Obj A } → (x : Hom A b a) → (Category.op A) [ id1 A b o x ] ≡ x | |
996 | 101 lemma-y-obj1 {b} x = let open ≈-Reasoning (Category.op A) in ≈-≡ A idL |
197 | 102 lemma-y-obj2 : (a₁ b c : Obj A) (f : Hom A b a₁) (g : Hom A c b ) → (x : Hom A a₁ a )→ |
103 Category.op A [ Category.op A [ g o f ] o x ] ≡ (Sets [ _[_o_] (Category.op A) g o _[_o_] (Category.op A) f ]) x | |
996 | 104 lemma-y-obj2 a₁ b c f g x = let open ≈-Reasoning (Category.op A) in ≈-≡ A ( begin |
105 Category.op A [ Category.op A [ g o f ] o x ] ≈↑⟨ assoc ⟩ | |
106 Category.op A [ g o Category.op A [ f o x ] ] ≈⟨⟩ | |
107 ( λ x → Category.op A [ g o x ] ) ( ( λ x → Category.op A [ f o x ] ) x ) ∎ ) | |
197 | 108 lemma-y-obj3 : {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 ] |
996 | 109 lemma-y-obj3 {_} {_} {f} {g} x eq = let open ≈-Reasoning (Category.op A) in ≈-≡ A ( begin |
110 Category.op A [ f o x ] ≈⟨ resp refl-hom eq ⟩ | |
111 Category.op A [ g o x ] ∎ ) | |
197 | 112 |
113 ---- | |
114 -- | |
115 -- Hom mapping in Yoneda Functor | |
116 -- | |
117 ---- | |
118 | |
987 | 119 y-tmap : ( a b : Obj A ) → (f : Hom A a b ) → (x : Obj (Category.op A)) → |
120 FObj (y-obj a) x → FObj (y-obj b ) x | |
121 y-tmap a b f x = λ ( g : Hom A x a ) → A [ f o g ] -- ( h : Hom A x b ) | |
197 | 122 |
996 | 123 y-map : {a b : Obj A } → (f : Hom A a b ) → NTrans (Category.op A) (Sets {c₂}) (y-obj a) (y-obj b) |
987 | 124 y-map {a} {b} f = record { TMap = y-tmap a b f ; isNTrans = isNTrans1 {a} {b} f } where |
197 | 125 lemma-y-obj4 : {a₁ b₁ : Obj (Category.op A)} {g : Hom (Category.op A) a₁ b₁} → {a b : Obj A } → (f : Hom A a b ) → |
987 | 126 Sets [ Sets [ FMap (y-obj b) g o y-tmap a b f a₁ ] ≈ |
127 Sets [ y-tmap a b f b₁ o FMap (y-obj a) g ] ] | |
996 | 128 lemma-y-obj4 {a₁} {b₁} {g} {a} {b} f = let open ≈-Reasoning A in extensionality A ( λ x → ≈-≡ A ( begin |
129 A [ A [ f o x ] o g ] ≈↑⟨ assoc ⟩ | |
130 A [ f o A [ x o g ] ] ∎ ) ) | |
987 | 131 isNTrans1 : {a b : Obj A } → (f : Hom A a b ) → IsNTrans (Category.op A) (Sets {c₂}) (y-obj a) (y-obj b) (y-tmap a b f ) |
197 | 132 isNTrans1 {a} {b} f = record { commute = λ{a₁ b₁ g } → lemma-y-obj4 {a₁} {b₁} {g} {a} {b} f } |
133 | |
134 ----- | |
135 -- | |
136 -- Yoneda Functor itself | |
137 -- | |
138 ----- | |
139 | |
987 | 140 YonedaFunctor : Functor A SetsAop |
141 YonedaFunctor = record { | |
142 FObj = λ a → y-obj a | |
143 ; FMap = λ f → y-map f | |
186
b2e01aa0924d
y-nat (FMap of Yoneda Functor )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
185
diff
changeset
|
144 ; isFunctor = record { |
187 | 145 identity = identity |
146 ; distr = distr1 | |
147 ; ≈-cong = ≈-cong | |
996 | 148 } } where |
987 | 149 ≈-cong : {a b : Obj A} {f g : Hom A a b} → A [ f ≈ g ] → SetsAop [ y-map f ≈ y-map g ] |
150 ≈-cong {a} {b} {f} {g} eq = let open ≈-Reasoning A in -- (λ x g₁ → A [ f o g₁ ] ) ≡ (λ x g₁ → A [ g o g₁ ] ) | |
996 | 151 extensionality A ( λ h → ≈-≡ A ( begin |
152 A [ f o h ] ≈⟨ resp refl-hom eq ⟩ | |
153 A [ g o h ] ∎ ) ) | |
987 | 154 identity : {a : Obj A} → SetsAop [ y-map (id1 A a) ≈ id1 SetsAop (y-obj a ) ] |
155 identity {a} = let open ≈-Reasoning A in -- (λ x g → A [ id1 A a o g ] ) ≡ (λ a₁ x → x) | |
996 | 156 extensionality A ( λ g → ≈-≡ A ( begin |
157 A [ id1 A a o g ] ≈⟨ idL ⟩ | |
158 g ∎ ) ) | |
987 | 159 distr1 : {a b c : Obj A} {f : Hom A a b} {g : Hom A b c} → SetsAop [ y-map (A [ g o f ]) ≈ SetsAop [ y-map g o y-map f ] ] |
160 distr1 {a} {b} {c} {f} {g} = let open ≈-Reasoning A in -- (λ x g₁ → (A [ (A [ g o f] o g₁ ]))) ≡ (λ x x₁ → A [ g o A [ f o x₁ ] ] ) | |
996 | 161 extensionality A ( λ h → ≈-≡ A ( begin |
162 A [ A [ g o f ] o h ] ≈↑⟨ assoc ⟩ | |
163 A [ g o A [ f o h ] ] ∎ ) ) | |
185 | 164 |
190 | 165 ------ |
166 -- | |
996 | 167 -- Hom(_ , _) : Obj (op A) → Obj A → Sets |
168 -- | |
169 -- | |
170 ------ | |
171 | |
172 -- module _ where | |
173 -- | |
174 -- open import Category.Constructions.Product | |
175 -- open import Data.Product renaming (_×_ to _*_) | |
176 -- | |
177 -- HomAAop : Functor ((Category.op A) × A) (Sets {c₂}) | |
178 -- HomAAop = record { | |
179 -- FObj = λ x → Hom A (proj₁ x) (proj₂ x) | |
180 -- -- f : Hom (Category.op A × A) A₁ B | |
181 -- -- g : Category.Category.Hom A (proj₁ A₁) (proj₂ A₁) | |
182 -- ; FMap = λ f g → A [ A [ proj₂ f o g ] o proj₁ f ] | |
183 -- ; isFunctor = record { ≈-cong = λ {a} {b} {f} {g} f=g → extensionality A ( λ h → cong (λ k → A [ A [ proj₂ k o h ] o (proj₁ k) ] ) {!!}) | |
184 -- ; distr = {!!} ; identity = {!!} } | |
185 -- } where open ≈-Reasoning A | |
186 | |
187 ------ | |
188 -- | |
189 -- Yoneda Lemma | |
190 -- | |
191 -- (F : Obj SetsAop) → ( | |
192 -- Hom SetsAop (FObj YonedaFunctor a , F ) ≅ FObj F a | |
193 -- | |
194 -- F : Functor (co A) Sets ∈ Obj SetsAop | |
190 | 195 -- |
300 | 196 -- F(a) → Nat(h_a,F) |
191 | 197 -- x ∈ F(a) , (g : Hom A b a) → ( FMap F g ) x |
190 | 198 ------ |
187 | 199 |
987 | 200 F2Natmap : {a : Obj A} → {F : Obj SetsAop } |
201 → {x : FObj F a} → (b : Obj (Category.op A)) → Hom Sets (FObj (y-obj a) b) (FObj F b) | |
202 F2Natmap {a} {F} {x} b = λ ( g : Hom A b a ) → ( FMap F g ) x | |
190 | 203 |
987 | 204 F2Nat : {a : Obj A} → {F : Obj SetsAop } → FObj F a → Hom SetsAop (y-obj a) F |
205 F2Nat {a} {F} x = record { TMap = F2Natmap {a} {F} {x} ; isNTrans = isNTrans1 } where | |
192
d7e4b7b441be
F(a) → Nat(h_a,F) done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
191
diff
changeset
|
206 commute1 : {a₁ b : Obj (Category.op A)} {f : Hom (Category.op A) a₁ b} (g : Hom A a₁ a) → |
d7e4b7b441be
F(a) → Nat(h_a,F) done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
191
diff
changeset
|
207 (Sets [ FMap F f o FMap F g ]) x ≡ FMap F (A [ g o f ] ) x |
d7e4b7b441be
F(a) → Nat(h_a,F) done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
191
diff
changeset
|
208 commute1 g = let open ≈-Reasoning (Sets) in |
d7e4b7b441be
F(a) → Nat(h_a,F) done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
191
diff
changeset
|
209 cong ( λ f → f x ) ( sym ( distr F ) ) |
191 | 210 commute : {a₁ b : Obj (Category.op A)} {f : Hom (Category.op A) a₁ b} → |
987 | 211 Sets [ Sets [ FMap F f o F2Natmap {a} {F} {x} a₁ ] ≈ Sets [ F2Natmap {a} {F} {x} b o FMap (y-obj a) f ] ] |
192
d7e4b7b441be
F(a) → Nat(h_a,F) done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
191
diff
changeset
|
212 commute {a₁} {b} {f} = let open ≈-Reasoning (Sets) in |
d7e4b7b441be
F(a) → Nat(h_a,F) done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
191
diff
changeset
|
213 begin |
987 | 214 Sets [ FMap F f o F2Natmap {a} {F} {x} a₁ ] |
192
d7e4b7b441be
F(a) → Nat(h_a,F) done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
191
diff
changeset
|
215 ≈⟨⟩ |
d7e4b7b441be
F(a) → Nat(h_a,F) done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
191
diff
changeset
|
216 Sets [ FMap F f o (λ ( g : Hom A a₁ a ) → ( FMap F g ) x) ] |
468
c375d8f93a2c
discrete category and product from a limit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
358
diff
changeset
|
217 ≈⟨ extensionality A ( λ (g : Hom A a₁ a) → commute1 {a₁} {b} {f} g ) ⟩ |
987 | 218 Sets [ (λ ( g : Hom A b a ) → ( FMap F g ) x) o FMap (y-obj a) f ] |
192
d7e4b7b441be
F(a) → Nat(h_a,F) done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
191
diff
changeset
|
219 ≈⟨⟩ |
987 | 220 Sets [ F2Natmap {a} {F} {x} b o FMap (y-obj a) f ] |
192
d7e4b7b441be
F(a) → Nat(h_a,F) done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
191
diff
changeset
|
221 ∎ |
987 | 222 isNTrans1 : IsNTrans (Category.op A) (Sets {c₂}) (y-obj a) F (F2Natmap {a} {F}) |
191 | 223 isNTrans1 = record { commute = λ {a₁ b f} → commute {a₁} {b} {f} } |
190 | 224 |
1000
3ef1b472e9f9
yoneda full and faithful
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
997
diff
changeset
|
225 -- |
3ef1b472e9f9
yoneda full and faithful
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
997
diff
changeset
|
226 -- Obj Part : SetAop (Y - , F) ≅ F |
3ef1b472e9f9
yoneda full and faithful
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
997
diff
changeset
|
227 -- |
190 | 228 |
199 | 229 -- F(a) <- Nat(h_a,F) |
987 | 230 Nat2F : {a : Obj A} → {F : Obj SetsAop } → Hom SetsAop (y-obj a) F → FObj F a |
231 Nat2F {a} {F} ha = ( TMap ha a ) (id1 A a) | |
190 | 232 |
199 | 233 ---- |
234 -- | |
235 -- Prove Bijection (as routine exercise ...) | |
236 -- | |
237 ---- | |
238 | |
987 | 239 F2Nat→Nat2F : {a : Obj A } → {F : Obj SetsAop } → (fa : FObj F a) |
240 → Nat2F {a} {F} (F2Nat {a} {F} fa) ≡ fa | |
241 F2Nat→Nat2F {a} {F} fa = let open ≈-Reasoning (Sets) in cong ( λ f → f fa ) ( | |
199 | 242 -- FMap F (Category.Category.Id A) fa ≡ fa |
194 | 243 begin |
244 ( FMap F (id1 A _ )) | |
245 ≈⟨ IsFunctor.identity (isFunctor F) ⟩ | |
246 id1 Sets (FObj F a) | |
247 ∎ ) | |
248 | |
202
58ee98bbb333
remove an extensionality
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
199
diff
changeset
|
249 ≡-cong = Relation.Binary.PropositionalEquality.cong |
193
4e6f080f0107
isomorphic problem written
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
192
diff
changeset
|
250 |
197 | 251 -- ha : NTrans (op A) Sets (y-obj {a}) F |
252 -- FMap F g o TMap ha a ≈ TMap ha b o FMap (y-obj {a}) g | |
987 | 253 Nat2F→F2Nat : {a : Obj A } → {F : Obj SetsAop } → (ha : Hom SetsAop (y-obj a) F) |
254 → SetsAop [ F2Nat {a} {F} (Nat2F {a} {F} ha) ≈ ha ] | |
996 | 255 Nat2F→F2Nat {a} {F} ha {b} = let open ≡-Reasoning in begin |
256 TMap (F2Nat {a} {F} (Nat2F {a} {F} ha)) b ≡⟨⟩ | |
257 (λ g → FMap F g (TMap ha a (id1 A _))) ≡⟨ extensionality A (λ g → ( begin | |
258 FMap F g (TMap ha a (id1 A _)) ≡⟨ ≡-cong (λ f → f (id1 A _)) (IsNTrans.commute (isNTrans ha)) ⟩ | |
259 TMap ha b (FMap (y-obj a) g (id1 A _)) ≡⟨⟩ | |
260 TMap ha b ( A [ id1 A _ o g ] ) ≡⟨ ≡-cong ( TMap ha b ) ( ≈-≡ A (≈-Reasoning.idL A)) ⟩ | |
261 TMap ha b g ∎ )) ⟩ | |
262 TMap ha b | |
263 ∎ | |
264 | |
196
c040369bd6d4
give up injective on Object?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
195
diff
changeset
|
265 -- Yoneda's Lemma |
199 | 266 -- Yoneda Functor is full and faithfull |
196
c040369bd6d4
give up injective on Object?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
195
diff
changeset
|
267 -- that is FMapp Yoneda is injective and surjective |
194 | 268 |
196
c040369bd6d4
give up injective on Object?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
195
diff
changeset
|
269 -- λ b g → (A Category.o f₁) g |
1000
3ef1b472e9f9
yoneda full and faithful
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
997
diff
changeset
|
270 YonedaLemma1 : {a a' : Obj A } {f : FObj (FObj YonedaFunctor a) a' } |
987 | 271 → SetsAop [ F2Nat {a'} {FObj YonedaFunctor a} f ≈ FMap YonedaFunctor f ] |
1000
3ef1b472e9f9
yoneda full and faithful
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
997
diff
changeset
|
272 YonedaLemma1 {a} {a'} {f} = refl |
3ef1b472e9f9
yoneda full and faithful
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
997
diff
changeset
|
273 |
3ef1b472e9f9
yoneda full and faithful
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
997
diff
changeset
|
274 YonedaIso0 : {a a' : Obj A } {f : FObj (FObj YonedaFunctor a) a' } |
3ef1b472e9f9
yoneda full and faithful
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
997
diff
changeset
|
275 → Nat2F ( FMap YonedaFunctor f ) ≡ f |
3ef1b472e9f9
yoneda full and faithful
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
997
diff
changeset
|
276 YonedaIso0 {a} {a'} {f} = ≈-≡ A (≈-Reasoning.idR A) |
3ef1b472e9f9
yoneda full and faithful
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
997
diff
changeset
|
277 |
3ef1b472e9f9
yoneda full and faithful
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
997
diff
changeset
|
278 YonedaIso1 : {a a' : Obj A } → (ha : Hom SetsAop (y-obj a) (y-obj a')) |
3ef1b472e9f9
yoneda full and faithful
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
997
diff
changeset
|
279 → SetsAop [ FMap YonedaFunctor (Nat2F {a} ha) ≈ ha ] |
3ef1b472e9f9
yoneda full and faithful
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
997
diff
changeset
|
280 YonedaIso1 {a} {a'} ha = Nat2F→F2Nat ha |
987 | 281 |
282 domF : (y : Obj SetsAop) → {x : Obj (Category.op A)} → FObj y x → Obj A | |
283 domF y {x} z = x | |
284 | |
1000
3ef1b472e9f9
yoneda full and faithful
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
997
diff
changeset
|
285 YonedaLemma2 : {a a' b : Obj A } (f : Hom A a a' ) → NTrans (Category.op A) Sets (FObj YonedaFunctor a) (FObj YonedaFunctor a') |
3ef1b472e9f9
yoneda full and faithful
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
997
diff
changeset
|
286 YonedaLemma2 f = FMap YonedaFunctor f |
991
e7848ad0c6f9
remove suc level in CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
990
diff
changeset
|
287 |
1000
3ef1b472e9f9
yoneda full and faithful
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
997
diff
changeset
|
288 YonedaLemma3 : {a a' b : Obj A } (f : Hom A a a' ) → (g : Hom A b a ) → Hom A b a' -- f o g |
3ef1b472e9f9
yoneda full and faithful
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
997
diff
changeset
|
289 YonedaLemma3 {a} {a'} {b} f g = TMap (FMap YonedaFunctor f) b g |
989 | 290 |
1000
3ef1b472e9f9
yoneda full and faithful
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
997
diff
changeset
|
291 YonedaLemma4 : {a a' b : Obj A } (f : Hom A a a' ) → (g : Hom A b a ) → Hom A b a' -- f o g |
3ef1b472e9f9
yoneda full and faithful
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
997
diff
changeset
|
292 YonedaLemma4 {a} {a'} {b} f = TMap (FMap YonedaFunctor f) b |
989 | 293 |
991
e7848ad0c6f9
remove suc level in CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
990
diff
changeset
|
294 -- |
e7848ad0c6f9
remove suc level in CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
990
diff
changeset
|
295 -- f ∈ FMap (FObj YonedaFunctor a') a |
e7848ad0c6f9
remove suc level in CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
990
diff
changeset
|
296 -- |
e7848ad0c6f9
remove suc level in CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
990
diff
changeset
|
297 |
996 | 298 -- g f |
299 -- b --→ a ------→ a' | |
300 -- | | | |
301 -- TMap (H f) b | | TMap (H id) a' | |
302 -- o g ↓ ↓ o (f o g) | |
303 -- H a ------→ H a' | |
304 -- H f | |
995 | 305 -- |
1000
3ef1b472e9f9
yoneda full and faithful
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
997
diff
changeset
|
306 |
989 | 307 _^ : {a a' b : Obj A } → (f : Hom A a a' ) → Hom A b a → Hom A b a' |
308 _^ {a} {a'} {b} f g = (FMap (FObj YonedaFunctor a') g) f | |
309 | |
310 f-unique : {a a' b : Obj A } (f : Hom A a a' ) → f ^ ≡ TMap (FMap YonedaFunctor f) b | |
311 f-unique {a} {a'} {b} f = extensionality A (λ g → begin | |
312 (f ^ ) g ≡⟨⟩ | |
313 (FMap (FObj YonedaFunctor a') g) f ≡⟨⟩ | |
314 A [ f o g ] ≡⟨⟩ | |
315 TMap (FMap YonedaFunctor f) b g ∎ ) where open ≡-Reasoning | |
316 | |
1000
3ef1b472e9f9
yoneda full and faithful
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
997
diff
changeset
|
317 f-u : {a a' b : Obj A } (f : FObj (FObj YonedaFunctor a') a ) → Sets [ f ^ ≈ TMap (FMap YonedaFunctor f ) b ] |
3ef1b472e9f9
yoneda full and faithful
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
997
diff
changeset
|
318 f-u = f-unique |
3ef1b472e9f9
yoneda full and faithful
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
997
diff
changeset
|
319 |
1001 | 320 -- faithful (injective ) |
1003 | 321 Yoneda-injective : {a b b' : Obj A } → {x y : Obj SetsAop} → (g h : Hom A b b' ) (f : Hom A a b ) |
322 → SetsAop [ FMap YonedaFunctor g ≈ FMap YonedaFunctor h ] | |
323 → A [ g ≈ h ] | |
1001 | 324 Yoneda-injective {a} {b} {x} {y} g h f yg=yh = begin |
1003 | 325 g ≈↑⟨ idR ⟩ |
326 Nat2F (FMap YonedaFunctor g) ≈⟨ ylem11 yg=yh ⟩ | |
327 Nat2F (FMap YonedaFunctor h) ≈⟨ idR ⟩ | |
328 h ∎ where | |
329 ylem11 : SetsAop [ FMap YonedaFunctor g ≈ FMap YonedaFunctor h ] → A [ Nat2F (FMap YonedaFunctor g) ≈ Nat2F (FMap YonedaFunctor h) ] | |
330 ylem11 yg=yh with yg=yh {b} | |
331 ... | eq = ≈-Reasoning.≈←≡ A ( cong (λ k → k (id1 A b)) eq ) | |
332 open ≈-Reasoning A | |
1001 | 333 |
334 -- full (surjective) | |
335 | |
336 record CatSurjective { c₁ c₂ ℓ c₁' c₂' ℓ' : Level} ( A : Category c₁ c₂ ℓ ) ( B : Category c₁' c₂' ℓ' ) (F : Functor A B) | |
337 : Set (suc (c₁ ⊔ c₂ ⊔ ℓ ⊔ c₁' ⊔ c₂' ⊔ ℓ')) where | |
338 field | |
339 sur : {a a' : Obj A} (g : Hom B (FObj F a) (FObj F a')) → Hom A a a' | |
340 surjective : {a a' : Obj A} (g : Hom B (FObj F a) (FObj F a')) → B [ FMap F (sur g) ≈ g ] | |
341 | |
1002 | 342 open CatSurjective |
343 | |
1004 | 344 CatEpi : {c : Level} (F : Functor (Sets {c}) (Sets {c})) |
345 → (s : CatSurjective Sets Sets F ) | |
346 → {a a' : Obj Sets } {b : Obj Sets} (g h : Hom Sets (FObj F a') b) | |
1005 | 347 → Sets [ Sets [ g o FMap F ( sur s (id1 Sets _)) ] ≈ Sets [ h o FMap F ( sur s (id1 Sets _)) ] ] → Sets [ g ≈ h ] |
348 CatEpi F s g h eq = begin | |
349 g ≈↑⟨ idR ⟩ | |
350 Sets [ g o id1 Sets _ ] ≈↑⟨ cdr (surjective s (id1 Sets _) ) ⟩ | |
351 Sets [ g o FMap F (sur s (id1 Sets _)) ] ≈⟨ eq ⟩ | |
352 Sets [ h o FMap F (sur s (id1 Sets _)) ] ≈⟨ cdr (surjective s (id1 Sets _) ) ⟩ | |
353 Sets [ h o id1 Sets _ ] ≈⟨ idR ⟩ | |
1001 | 354 h ∎ |
355 where | |
1004 | 356 open ≈-Reasoning Sets |
1002 | 357 -- sj : B [ FMap F ( CatSurjective.sur s (FMap F (f g h))) ≈ FMap F (f g h) ] |
358 -- sj = CatSurjective.surjective s (FMap F (f g h)) | |
1001 | 359 |
360 Yoneda-surjective : CatSurjective A SetsAop YonedaFunctor | |
361 Yoneda-surjective = record { sur = λ {a} {a'} g → f g ; surjective = λ g → | |
362 begin | |
363 TMap (FMap YonedaFunctor (f g) ) _ ≈⟨ YonedaIso1 g ⟩ | |
364 TMap g _ ∎ | |
365 } where | |
366 open ≈-Reasoning Sets | |
367 f : {a a' : Obj A } → (g : Hom SetsAop (FObj YonedaFunctor a) (FObj YonedaFunctor a')) → Hom A a a' | |
368 f g = Nat2F g | |
369 | |
1005 | 370 Yoneda-epi : { b : Obj A } {x y : Obj SetsAop} → (g h : Hom SetsAop (FObj YonedaFunctor b) y) |
371 → ( {a : Obj A } (f : Hom A a b ) → SetsAop [ SetsAop [ g o FMap YonedaFunctor f ] ≈ SetsAop [ h o FMap YonedaFunctor f ] ] ) | |
1001 | 372 → SetsAop [ g ≈ h ] |
1005 | 373 Yoneda-epi {b} {x} {y} g h yg=yh = begin |
374 TMap g _ ≈↑⟨ idR ⟩ | |
375 Sets [ TMap g _ o id1 Sets _ ] ≈↑⟨ cdr (surjective Yoneda-surjective (id1 SetsAop _)) ⟩ | |
376 Sets [ TMap g _ o (λ z → A [ sur Yoneda-surjective (id1 SetsAop _) o z ] ) ] ≈⟨⟩ | |
377 (λ z → TMap g _ (A [ id1 A _ o z ] )) ≈⟨ yg=yh (id1 A b) ⟩ | |
378 Sets [ TMap h _ o (λ z → A [ sur Yoneda-surjective (id1 SetsAop _) o z ] ) ] ≈⟨ cdr (surjective Yoneda-surjective (id1 SetsAop _)) ⟩ | |
379 Sets [ TMap h _ o id1 Sets _ ] ≈⟨ idR ⟩ | |
1001 | 380 TMap h _ |
381 ∎ where | |
1002 | 382 open ≈-Reasoning Sets |
1001 | 383 s : CatSurjective A SetsAop YonedaFunctor |
384 s = Yoneda-surjective | |
385 | |
1008 | 386 --- How to prove it? from smallness? |
1005 | 387 |
1008 | 388 data _~_ {a b : Obj A} (f : Hom A a b) |
389 : ∀{x y : Obj A} → Hom A x y → Set (suc (c₁ ⊔ c₂ ⊔ ℓ)) where | |
390 refl : {g : Hom A a b} → (eqv : A [ f ≈ g ]) → f ~ g | |
1005 | 391 |
1008 | 392 postulate -- ? |
393 eqObj1 : {a b a' b' : Obj A } → Hom A a b ≡ Hom A a' b' → b ≡ b' | |
996 | 394 |
989 | 395 Yoneda-full-embed : {a b : Obj A } → FObj YonedaFunctor a ≡ FObj YonedaFunctor b → a ≡ b |
1008 | 396 Yoneda-full-embed {a} {b} eq = eqObj1 ylem1 where |
989 | 397 ylem1 : Hom A a a ≡ Hom A a b |
398 ylem1 = cong (λ k → FObj k a) eq | |
783 | 399 |