annotate cat-utility.agda @ 260:a87d3ea9efe4

pullback
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Fri, 20 Sep 2013 15:39:50 +0900
parents 24e83b8b81be
children 78ce12f8e6b6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
56
83ff8d48fdca add unitility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 module cat-utility where
83ff8d48fdca add unitility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
83ff8d48fdca add unitility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 -- Shinji KONO <kono@ie.u-ryukyu.ac.jp>
83ff8d48fdca add unitility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4
87
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
5 open import Category -- https://github.com/konn/category-agda
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
6 open import Level
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
7 --open import Category.HomReasoning
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
8 open import HomReasoning
56
83ff8d48fdca add unitility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9
87
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
10 open Functor
56
83ff8d48fdca add unitility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11
87
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
12 id1 : ∀{c₁ c₂ ℓ : Level} (A : Category c₁ c₂ ℓ) (a : Obj A ) → Hom A a a
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
13 id1 A a = (Id {_} {_} {_} {A} a)
253
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 202
diff changeset
14 -- We cannot make A implicit
56
83ff8d48fdca add unitility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15
87
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
16 record IsUniversalMapping {c₁ c₂ ℓ c₁' c₂' ℓ' : Level} (A : Category c₁ c₂ ℓ) (B : Category c₁' c₂' ℓ')
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
17 ( U : Functor B A )
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
18 ( F : Obj A → Obj B )
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
19 ( η : (a : Obj A) → Hom A a ( FObj U (F a) ) )
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
20 ( _* : { a : Obj A}{ b : Obj B} → ( Hom A a (FObj U b) ) → Hom B (F a ) b )
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
21 : Set (suc (c₁ ⊔ c₂ ⊔ ℓ ⊔ c₁' ⊔ c₂' ⊔ ℓ' )) where
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
22 field
101
0f7086b6a1a6 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
23 universalMapping : {a : Obj A} { b : Obj B } → { f : Hom A a (FObj U b) } →
0f7086b6a1a6 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
24 A [ A [ FMap U ( f * ) o η a ] ≈ f ]
0f7086b6a1a6 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
25 uniquness : {a : Obj A} { b : Obj B } → { f : Hom A a (FObj U b) } → { g : Hom B (F a) b } →
0f7086b6a1a6 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
26 A [ A [ FMap U g o η a ] ≈ f ] → B [ f * ≈ g ]
56
83ff8d48fdca add unitility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27
87
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
28 record UniversalMapping {c₁ c₂ ℓ c₁' c₂' ℓ' : Level} (A : Category c₁ c₂ ℓ) (B : Category c₁' c₂' ℓ')
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
29 ( U : Functor B A )
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
30 ( F : Obj A → Obj B )
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
31 ( η : (a : Obj A) → Hom A a ( FObj U (F a) ) )
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
32 : Set (suc (c₁ ⊔ c₂ ⊔ ℓ ⊔ c₁' ⊔ c₂' ⊔ ℓ' )) where
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
33 infixr 11 _*
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
34 field
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
35 _* : { a : Obj A}{ b : Obj B} → ( Hom A a (FObj U b) ) → Hom B (F a ) b
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
36 isUniversalMapping : IsUniversalMapping A B U F η _*
56
83ff8d48fdca add unitility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
37
87
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
38 open NTrans
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
39 open import Category.Cat
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
40 record IsAdjunction {c₁ c₂ ℓ c₁' c₂' ℓ' : Level} (A : Category c₁ c₂ ℓ) (B : Category c₁' c₂' ℓ')
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
41 ( U : Functor B A )
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
42 ( F : Functor A B )
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
43 ( η : NTrans A A identityFunctor ( U ○ F ) )
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
44 ( ε : NTrans B B ( F ○ U ) identityFunctor )
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
45 : Set (suc (c₁ ⊔ c₂ ⊔ ℓ ⊔ c₁' ⊔ c₂' ⊔ ℓ' )) where
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
46 field
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
47 adjoint1 : { b : Obj B } →
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
48 A [ A [ ( FMap U ( TMap ε b )) o ( TMap η ( FObj U b )) ] ≈ id1 A (FObj U b) ]
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
49 adjoint2 : {a : Obj A} →
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
50 B [ B [ ( TMap ε ( FObj F a )) o ( FMap F ( TMap η a )) ] ≈ id1 B (FObj F a) ]
56
83ff8d48fdca add unitility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
51
87
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
52 record Adjunction {c₁ c₂ ℓ c₁' c₂' ℓ' : Level} (A : Category c₁ c₂ ℓ) (B : Category c₁' c₂' ℓ')
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
53 ( U : Functor B A )
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
54 ( F : Functor A B )
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
55 ( η : NTrans A A identityFunctor ( U ○ F ) )
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
56 ( ε : NTrans B B ( F ○ U ) identityFunctor )
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
57 : Set (suc (c₁ ⊔ c₂ ⊔ ℓ ⊔ c₁' ⊔ c₂' ⊔ ℓ' )) where
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
58 field
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
59 isAdjunction : IsAdjunction A B U F η ε
202
58ee98bbb333 remove an extensionality
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 176
diff changeset
60 U-functor = U
58ee98bbb333 remove an extensionality
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 176
diff changeset
61 F-functor = F
58ee98bbb333 remove an extensionality
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 176
diff changeset
62 Eta = η
58ee98bbb333 remove an extensionality
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 176
diff changeset
63 Epsiron = ε
56
83ff8d48fdca add unitility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
64
83ff8d48fdca add unitility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
65
87
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
66 record IsMonad {c₁ c₂ ℓ : Level} (A : Category c₁ c₂ ℓ)
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
67 ( T : Functor A A )
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
68 ( η : NTrans A A identityFunctor T )
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
69 ( μ : NTrans A A (T ○ T) T)
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
70 : Set (suc (c₁ ⊔ c₂ ⊔ ℓ )) where
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
71 field
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
72 assoc : {a : Obj A} → A [ A [ TMap μ a o TMap μ ( FObj T a ) ] ≈ A [ TMap μ a o FMap T (TMap μ a) ] ]
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
73 unity1 : {a : Obj A} → A [ A [ TMap μ a o TMap η ( FObj T a ) ] ≈ Id {_} {_} {_} {A} (FObj T a) ]
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
74 unity2 : {a : Obj A} → A [ A [ TMap μ a o (FMap T (TMap η a ))] ≈ Id {_} {_} {_} {A} (FObj T a) ]
56
83ff8d48fdca add unitility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
75
87
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
76 record Monad {c₁ c₂ ℓ : Level} (A : Category c₁ c₂ ℓ) (T : Functor A A) (η : NTrans A A identityFunctor T) (μ : NTrans A A (T ○ T) T)
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
77 : Set (suc (c₁ ⊔ c₂ ⊔ ℓ )) where
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
78 field
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
79 isMonad : IsMonad A T η μ
130
5f331dfc000b remove Kleisli record
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 101
diff changeset
80 -- g ○ f = μ(c) T(g) f
5f331dfc000b remove Kleisli record
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 101
diff changeset
81 join : { a b : Obj A } → { c : Obj A } →
5f331dfc000b remove Kleisli record
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 101
diff changeset
82 ( Hom A b ( FObj T c )) → ( Hom A a ( FObj T b)) → Hom A a ( FObj T c )
5f331dfc000b remove Kleisli record
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 101
diff changeset
83 join {_} {_} {c} g f = A [ TMap μ c o A [ FMap T g o f ] ]
5f331dfc000b remove Kleisli record
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 101
diff changeset
84
56
83ff8d48fdca add unitility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
85
87
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
86 Functor*Nat : {c₁ c₂ ℓ c₁' c₂' ℓ' c₁'' c₂'' ℓ'' : Level} (A : Category c₁ c₂ ℓ) {B : Category c₁' c₂' ℓ'} (C : Category c₁'' c₂'' ℓ'')
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
87 (F : Functor B C) -> { G H : Functor A B } -> ( n : NTrans A B G H ) -> NTrans A C (F ○ G) (F ○ H)
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
88 Functor*Nat A {B} C F {G} {H} n = record {
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
89 TMap = \a -> FMap F (TMap n a)
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
90 ; isNTrans = record {
130
5f331dfc000b remove Kleisli record
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 101
diff changeset
91 commute = commute
87
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
92 }
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
93 } where
130
5f331dfc000b remove Kleisli record
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 101
diff changeset
94 commute : {a b : Obj A} {f : Hom A a b}
87
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
95 → C [ C [ (FMap F ( FMap H f )) o ( FMap F (TMap n a)) ] ≈ C [ (FMap F (TMap n b )) o (FMap F (FMap G f)) ] ]
130
5f331dfc000b remove Kleisli record
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 101
diff changeset
96 commute {a} {b} {f} = let open ≈-Reasoning (C) in
87
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
97 begin
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
98 (FMap F ( FMap H f )) o ( FMap F (TMap n a))
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
99 ≈⟨ sym (distr F) ⟩
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
100 FMap F ( B [ (FMap H f) o TMap n a ])
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
101 ≈⟨ IsFunctor.≈-cong (isFunctor F) ( nat n ) ⟩
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
102 FMap F ( B [ (TMap n b ) o FMap G f ] )
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
103 ≈⟨ distr F ⟩
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
104 (FMap F (TMap n b )) o (FMap F (FMap G f))
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
105
56
83ff8d48fdca add unitility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
106
87
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
107 Nat*Functor : {c₁ c₂ ℓ c₁' c₂' ℓ' c₁'' c₂'' ℓ'' : Level} (A : Category c₁ c₂ ℓ) {B : Category c₁' c₂' ℓ'} (C : Category c₁'' c₂'' ℓ'')
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
108 { G H : Functor B C } -> ( n : NTrans B C G H ) -> (F : Functor A B) -> NTrans A C (G ○ F) (H ○ F)
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
109 Nat*Functor A {B} C {G} {H} n F = record {
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
110 TMap = \a -> TMap n (FObj F a)
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
111 ; isNTrans = record {
130
5f331dfc000b remove Kleisli record
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 101
diff changeset
112 commute = commute
87
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
113 }
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
114 } where
130
5f331dfc000b remove Kleisli record
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 101
diff changeset
115 commute : {a b : Obj A} {f : Hom A a b}
87
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
116 → C [ C [ ( FMap H (FMap F f )) o ( TMap n (FObj F a)) ] ≈ C [ (TMap n (FObj F b )) o (FMap G (FMap F f)) ] ]
130
5f331dfc000b remove Kleisli record
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 101
diff changeset
117 commute {a} {b} {f} = IsNTrans.commute ( isNTrans n)
56
83ff8d48fdca add unitility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
118
87
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
119 -- T ≃ (U_R ○ F_R)
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
120 -- μ = U_R ε F_R
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
121 -- nat-ε
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
122 -- nat-η -- same as η but has different types
84
ee25f96ee8cc record Resolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 80
diff changeset
123
87
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
124 record MResolution {c₁ c₂ ℓ c₁' c₂' ℓ' : Level} (A : Category c₁ c₂ ℓ) ( B : Category c₁' c₂' ℓ' )
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
125 ( T : Functor A A )
94
4fa718e4fd77 Comparison Functor constructed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
126 -- { η : NTrans A A identityFunctor T }
4fa718e4fd77 Comparison Functor constructed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
127 -- { μ : NTrans A A (T ○ T) T }
4fa718e4fd77 Comparison Functor constructed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
128 -- { M : Monad A T η μ }
87
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
129 ( UR : Functor B A ) ( FR : Functor A B )
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
130 { ηR : NTrans A A identityFunctor ( UR ○ FR ) }
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
131 { εR : NTrans B B ( FR ○ UR ) identityFunctor }
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
132 { μR : NTrans A A ( (UR ○ FR) ○ ( UR ○ FR )) ( UR ○ FR ) }
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
133 ( Adj : Adjunction A B UR FR ηR εR )
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
134 : Set (suc (c₁ ⊔ c₂ ⊔ ℓ ⊔ c₁' ⊔ c₂' ⊔ ℓ' )) where
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
135 field
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
136 T=UF : T ≃ (UR ○ FR)
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
137 μ=UεF : {x : Obj A } -> A [ TMap μR x ≈ FMap UR ( TMap εR ( FObj FR x ) ) ]
94
4fa718e4fd77 Comparison Functor constructed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
138 -- ηR=η : {x : Obj A } -> A [ TMap ηR x ≈ TMap η x ] -- We need T -> UR FR conversion
87
4690953794c4 MEsolution
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
139 -- μR=μ : {x : Obj A } -> A [ TMap μR x ≈ TMap μ x ]
86
be4e3b073e0d resosultion
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 84
diff changeset
140
88
419923b149ca on going
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 87
diff changeset
141
260
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
142 record Equalizer { c₁ c₂ ℓ : Level} ( A : Category c₁ c₂ ℓ ) {c a b : Obj A} (e : Hom A c a) (f g : Hom A a b) : Set (ℓ ⊔ (c₁ ⊔ c₂)) where
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
143 field
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
144 fe=ge : A [ A [ f o e ] ≈ A [ g o e ] ]
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
145 k : {d : Obj A} (h : Hom A d a) → A [ A [ f o h ] ≈ A [ g o h ] ] → Hom A d c
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
146 ek=h : {d : Obj A} → ∀ {h : Hom A d a} → {eq : A [ A [ f o h ] ≈ A [ g o h ] ] } → A [ A [ e o k {d} h eq ] ≈ h ]
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
147 uniqueness : {d : Obj A} → ∀ {h : Hom A d a} → {eq : A [ A [ f o h ] ≈ A [ g o h ] ] } → {k' : Hom A d c } →
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
148 A [ A [ e o k' ] ≈ h ] → A [ k {d} h eq ≈ k' ]
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
149 equalizer : Hom A c a
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
150 equalizer = e
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
151
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
152 --
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
153 -- Product
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
154 --
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
155 --
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
156 --
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
157 --
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
158 --
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
159 --
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
160 --
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
161
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
162
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
163 record Product { c₁ c₂ ℓ : Level} ( A : Category c₁ c₂ ℓ ) (a b ab : Obj A)
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
164 ( π1 : Hom A ab a )
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
165 ( π2 : Hom A ab b )
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
166 : Set (ℓ ⊔ (c₁ ⊔ c₂)) where
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
167 field
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
168 _×_ : {c : Obj A} ( f : Hom A c a ) → ( g : Hom A c b ) → Hom A c ab
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
169 π1fxg=f : {c : Obj A} { f : Hom A c a } → { g : Hom A c b } → A [ A [ π1 o ( f × g ) ] ≈ f ]
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
170 π2fxg=g : {c : Obj A} { f : Hom A c a } → { g : Hom A c b } → A [ A [ π2 o ( f × g ) ] ≈ g ]
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
171 uniqueness : {c : Obj A} { h : Hom A c ab } → A [ ( A [ π1 o h ] ) × ( A [ π2 o h ] ) ≈ h ]
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
172 axb : Obj A
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
173 axb = ab
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
174
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
175 --
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
176 -- Pullback
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
177 -- f
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
178 -- a -------> c
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
179 -- ^ ^
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
180 -- π1 | |g
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
181 -- | |
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
182 -- ab -------> b
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
183 -- ^ π2
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
184 -- |
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
185 -- d
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
186 --
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
187 record Pullback { c₁ c₂ ℓ : Level} ( A : Category c₁ c₂ ℓ ) (a b c ab : Obj A)
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
188 ( f : Hom A a c ) ( g : Hom A b c )
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
189 ( π1 : Hom A ab a ) ( π2 : Hom A ab b )
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
190 : Set (ℓ ⊔ (c₁ ⊔ c₂)) where
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
191 field
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
192 commute : A [ A [ f o π1 ] ≈ A [ g o π2 ] ]
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
193 p : { d : Obj A } → { π1' : Hom A d a } { π2' : Hom A d b } → A [ A [ f o π1' ] ≈ A [ g o π2' ] ] → Hom A d ab
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
194 π1p=π1 : { d : Obj A } → { π1' : Hom A d a } { π2' : Hom A d b } → { eq : A [ A [ f o π1' ] ≈ A [ g o π2' ] ] }
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
195 → A [ A [ π1 o p eq ] ≈ π1' ]
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
196 π2p=π2 : { d : Obj A } → { π1' : Hom A d a } { π2' : Hom A d b } → { eq : A [ A [ f o π1' ] ≈ A [ g o π2' ] ] }
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
197 → A [ A [ π2 o p eq ] ≈ π2' ]
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
198 uniqueness : { d : Obj A } → ( p' : Hom A d ab ) → { π1' : Hom A d a } { π2' : Hom A d b } → { eq : A [ A [ f o π1' ] ≈ A [ g o π2' ] ] }
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
199 → { π1p=π1' : A [ A [ π1 o p' ] ≈ π1' ] }
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
200 → { π2p=π2' : A [ A [ π2 o p' ] ≈ π2' ] }
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
201 → A [ p eq ≈ p' ]
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
202 axb : Obj A
a87d3ea9efe4 pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
203 axb = ab