@@ -3,10 +3,9 @@ module Categories.CoYoneda where
3
3
4
4
-- CoYoneda Lemma. See Yoneda for more documentation
5
5
6
- open import Level
6
+ open import Level using (Level; _⊔_; lift; lower)
7
7
open import Function.Base using (_$_)
8
8
open import Function.Bundles using (Inverse; Func; _⟨$⟩_)
9
- -- open import Function.Equality using (Π; _⟨$⟩_; cong)
10
9
open import Relation.Binary.Bundles using (module Setoid )
11
10
import Relation.Binary.Reasoning.Setoid as SetoidR
12
11
open import Data.Product using (_,_; Σ)
@@ -15,7 +14,7 @@ open import Categories.Category using (Category; _[_,_])
15
14
open import Categories.Category.Product using (πʳ; πˡ; _※_)
16
15
open import Categories.Category.Construction.Presheaves using (CoPresheaves)
17
16
open import Categories.Category.Construction.Functors using (eval)
18
- open import Categories.Category.Construction.Functors
17
+ open import Categories.Category.Construction.Functors using (Functors)
19
18
open import Categories.Category.Instance.Setoids using (Setoids)
20
19
open import Categories.Functor using (Functor; _∘F_) renaming (id to idF)
21
20
open import Categories.Functor.Hom using (module Hom ; Hom[_][_,-]; Hom[_][-,-])
@@ -28,6 +27,8 @@ import Categories.Morphism as Mor
28
27
import Categories.Morphism.Reasoning as MR
29
28
import Categories.NaturalTransformation.Hom as NT-Hom
30
29
30
+ open Func
31
+
31
32
private
32
33
variable
33
34
o ℓ e : Level
@@ -36,7 +37,7 @@ module Yoneda (C : Category o ℓ e) where
36
37
open Category C hiding (op) -- uses lots
37
38
open HomReasoning using (_○_; ⟺; refl⟩∘⟨_)
38
39
open MR C using (id-comm)
39
- open NaturalTransformation
40
+ open NaturalTransformation using (η; commute; sym-commute)
40
41
open NT-Hom C using (Hom[C,A]⇒Hom[C,B])
41
42
private
42
43
module CE = Category.Equiv C using (refl)
@@ -76,18 +77,18 @@ module Yoneda (C : Category o ℓ e) where
76
77
( λ {b} {nat} eq →
77
78
let module SR = SetoidR (F.₀ a) in
78
79
let open SR in begin
79
- Func. to (η nat a) id ≈⟨ eq {a} {id} {id} CE.refl ⟩
80
- Func. to (F.₁ id) b ≈⟨ F.identity (Setoid.refl (F.₀ a) {b}) ⟩
80
+ to (η nat a) id ≈⟨ eq {a} {id} {id} CE.refl ⟩
81
+ to (F.₁ id) b ≈⟨ F.identity (Setoid.refl (F.₀ a) {b}) ⟩
81
82
b ∎)
82
83
, λ {nat} {y} eq {b} {f} {g} f≈g →
83
84
let open Setoid (F.₀ b) in
84
85
let module SR = SetoidR (F.₀ b) in
85
86
let open SR in
86
87
begin
87
- Func. to (F.₁ f) y ≈⟨ Func. cong (F.₁ f) eq ⟩
88
- Func. to (F.₁ f) (Func. to (η nat a) id) ≈⟨ sym-commute nat f CE.refl ⟩
89
- Func. to (η nat b) (f ∘ id ∘ id) ≈⟨ Func. cong (η nat b) (refl⟩∘⟨ identity² ○ (identityʳ ○ f≈g)) ⟩
90
- Func. to (η nat b) g ∎
88
+ to (F.₁ f) y ≈⟨ cong (F.₁ f) eq ⟩
89
+ to (F.₁ f) (to (η nat a) id) ≈⟨ sym-commute nat f CE.refl ⟩
90
+ to (η nat b) (f ∘ id ∘ id) ≈⟨ cong (η nat b) (refl⟩∘⟨ identity² ○ (identityʳ ○ f≈g)) ⟩
91
+ to (η nat b) g ∎
91
92
}
92
93
where
93
94
module F = Functor F using (₀; ₁; F-resp-≈; homomorphism; identity)
@@ -113,7 +114,7 @@ module Yoneda (C : Category o ℓ e) where
113
114
; cong = λ i≈j → lift (i≈j CE.refl)
114
115
}
115
116
; commute = λ where
116
- {_} {G , B} (α , f) {β} {γ} β≈γ → lift $ Func. cong (η α B) (helper f β γ β≈γ)
117
+ {_} {G , B} (α , f) {β} {γ} β≈γ → lift $ cong (η α B) (helper f β γ β≈γ)
117
118
}
118
119
; F⇐G = ntHelper record
119
120
{ η = λ (F , A) → record
@@ -134,9 +135,9 @@ module Yoneda (C : Category o ℓ e) where
134
135
Setoid._≈_ (Functor.F₀ Nat[Hom[C][c,-],F] (F , A)) β γ →
135
136
Setoid._≈_ (Functor.F₀ F B) (η β B ⟨$⟩ id ∘ f) (Functor.F₁ F f ⟨$⟩ (η γ A ⟨$⟩ id))
136
137
helper {F} {A} {B} f β γ β≈γ = S.begin
137
- η β B ⟨$⟩ id ∘ f S.≈⟨ Func. cong (η β B) (MR.id-comm-sym C ○ ∘-resp-≈ʳ (⟺ identity²)) ⟩
138
+ η β B ⟨$⟩ id ∘ f S.≈⟨ cong (η β B) (MR.id-comm-sym C ○ ∘-resp-≈ʳ (⟺ identity²)) ⟩
138
139
η β B ⟨$⟩ f ∘ id ∘ id S.≈⟨ commute β f CE.refl ⟩
139
- F.₁ f ⟨$⟩ (η β A ⟨$⟩ id) S.≈⟨ Func. cong (F.₁ f) (β≈γ CE.refl) ⟩
140
+ F.₁ f ⟨$⟩ (η β A ⟨$⟩ id) S.≈⟨ cong (F.₁ f) (β≈γ CE.refl) ⟩
140
141
F.₁ f ⟨$⟩ (η γ A ⟨$⟩ id) S.∎
141
142
where
142
143
module F = Functor F using (₀;₁)
@@ -153,9 +154,9 @@ module Yoneda (C : Category o ℓ e) where
153
154
Setoid._≈_ (Functor.F₀ G Z) (Functor.F₁ G h ⟨$⟩ (η α B ⟨$⟩ (Functor.F₁ F f ⟨$⟩ X)))
154
155
(η α Z ⟨$⟩ (Functor.F₁ F (i ∘ f) ⟨$⟩ Y))
155
156
helper′ {F} {G} {A} {B} {Z} {h} {i} {X} {Y} α f eq eq′ = S.begin
156
- G.₁ h ⟨$⟩ (η α B ⟨$⟩ (F.₁ f ⟨$⟩ X)) S.≈˘⟨ commute α h ((S′.sym (Func. cong (F.₁ f) eq))) ⟩
157
- η α Z ⟨$⟩ (F.₁ h ⟨$⟩ (F.₁ f ⟨$⟩ Y)) S.≈⟨ Func. cong (η α Z) ((F.F-resp-≈ eq′ S′.refl)) ⟩
158
- η α Z ⟨$⟩ (F.₁ i ⟨$⟩ (F.₁ f ⟨$⟩ Y)) S.≈˘⟨ Func. cong (η α Z) ((F.homomorphism (Setoid.refl (F.₀ A)))) ⟩
157
+ G.₁ h ⟨$⟩ (η α B ⟨$⟩ (F.₁ f ⟨$⟩ X)) S.≈˘⟨ commute α h ((S′.sym (cong (F.₁ f) eq))) ⟩
158
+ η α Z ⟨$⟩ (F.₁ h ⟨$⟩ (F.₁ f ⟨$⟩ Y)) S.≈⟨ cong (η α Z) ((F.F-resp-≈ eq′ S′.refl)) ⟩
159
+ η α Z ⟨$⟩ (F.₁ i ⟨$⟩ (F.₁ f ⟨$⟩ Y)) S.≈˘⟨ cong (η α Z) ((F.homomorphism (Setoid.refl (F.₀ A)))) ⟩
159
160
η α Z ⟨$⟩ (F.₁ (i ∘ f) ⟨$⟩ Y) S.∎
160
161
where
161
162
module F = Functor F using (₀; ₁; homomorphism; F-resp-≈)
0 commit comments