annotate CatExponetial.agda @ 200:6e704f4d4f03

exponential
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 31 Aug 2013 12:41:31 +0900
parents
children eb935f04bf39
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
200
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 ----
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 --
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 -- B^A
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 -- Shinji KONO <kono@ie.u-ryukyu.ac.jp>
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 ----
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 open import Category -- https://github.com/konn/category-agda
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 open import Level
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 module CatExponetial {c₁ c₂ ℓ c₁' c₂' ℓ' : Level} (A : Category c₁ c₂ ℓ) (B : Category c₁' c₂' ℓ') where
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 open import HomReasoning
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 open import cat-utility
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 -- Object is a Functor : A → B
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 -- Hom is a natural transformation
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 open Functor
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 CObj = Functor A B
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 CHom = λ (f : CObj ) → λ (g : CObj ) → NTrans A B f g
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 open NTrans
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 Cid : {a : CObj} → CHom a a
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 Cid {a} = record { TMap = \x -> id1 B (FObj a x) ; isNTrans = isNTrans1 {a} } where
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 commute : {a : CObj} {a₁ b : Obj A} {f : Hom A a₁ b} →
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 B [ B [ FMap a f o id1 B (FObj a a₁) ] ≈
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 B [ id1 B (FObj a b) o FMap a f ] ]
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 commute {a} {a₁} {b} {f} = let open ≈-Reasoning B in begin
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 FMap a f o id1 B (FObj a a₁)
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 ≈⟨ idR ⟩
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 FMap a f
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 ≈↑⟨ idL ⟩
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 id1 B (FObj a b) o FMap a f
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
35
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 isNTrans1 : {a : CObj } → IsNTrans A B a a (\x -> id1 B (FObj a x))
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 isNTrans1 {a} = record { commute = \{a₁ b f} -> commute {a} {a₁} {b} {f} }
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
38
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 _+_ : {a b c : CObj} → CHom b c → CHom a b → CHom a c
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 _+_{a} {b} {c} f g = record { TMap = λ x → B [ TMap f x o TMap g x ] ; isNTrans = isNTrans1 } where
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 commute1 : (a b c : CObj ) (f : CHom b c) (g : CHom a b )
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 (a₁ b₁ : Obj A) (h : Hom A a₁ b₁) →
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 B [ B [ FMap c h o B [ TMap f a₁ o TMap g a₁ ] ] ≈
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 B [ B [ TMap f b₁ o TMap g b₁ ] o FMap a h ] ]
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 commute1 a b c f g a₁ b₁ h = let open ≈-Reasoning B in begin
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 B [ FMap c h o B [ TMap f a₁ o TMap g a₁ ] ]
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 ≈⟨ assoc ⟩
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 B [ B [ FMap c h o TMap f a₁ ] o TMap g a₁ ]
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 ≈⟨ car (nat f) ⟩
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 B [ B [ TMap f b₁ o FMap b h ] o TMap g a₁ ]
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 ≈↑⟨ assoc ⟩
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 B [ TMap f b₁ o B [ FMap b h o TMap g a₁ ] ]
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 ≈⟨ cdr (nat g) ⟩
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 B [ TMap f b₁ o B [ TMap g b₁ o FMap a h ] ]
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 ≈⟨ assoc ⟩
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 B [ B [ TMap f b₁ o TMap g b₁ ] o FMap a h ]
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
57
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 isNTrans1 : IsNTrans A B a c (λ x → B [ TMap f x o TMap g x ])
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 isNTrans1 = record { commute = λ {a₁ b₁ h} → commute1 a b c f g a₁ b₁ h }
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
60
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
61 _==_ : {a b : CObj} → CHom a b → CHom a b → Set (ℓ' ⊔ c₁)
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 _==_ {a} {b} f g = ∀{x} → B [ TMap f x ≈ TMap g x ]
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
63
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
64 infix 4 _==_
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
65
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 import Relation.Binary.PropositionalEquality
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 -- 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 )
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
68 postulate extensionality : Relation.Binary.PropositionalEquality.Extensionality c₁ c₁
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
69
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
70 open import Relation.Binary.Core
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
71 isB^A : IsCategory CObj CHom _==_ _+_ Cid
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
72 isB^A =
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
73 record { isEquivalence = record {refl = IsEquivalence.refl (IsCategory.isEquivalence ( Category.isCategory B ));
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 sym = \{i j} → sym1 {_} {_} {i} {j} ;
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
75 trans = \{i j k} → trans1 {_} {_} {i} {j} {k} }
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
76 ; identityL = IsCategory.identityL ( Category.isCategory B )
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 ; identityR = IsCategory.identityR ( Category.isCategory B )
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 ; o-resp-≈ = λ{a b c f g h i } → o-resp-≈1 {a} {b} {c} {f} {g} {h} {i}
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 ; associative = IsCategory.associative ( Category.isCategory B )
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 } where
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 sym1 : {a b : CObj } {i j : CHom a b } → i == j → j == i
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 sym1 {a} {b} {i} {j} eq {x} = let open ≈-Reasoning B in begin
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
83 TMap j x
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 ≈⟨ sym eq ⟩
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 TMap i x
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
86
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
87 trans1 : {a b : CObj } {i j k : CHom a b} → i == j → j == k → i == k
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 trans1 {a} {b} {i} {j} {k} i=j j=k {x} = let open ≈-Reasoning B in begin
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
89 TMap i x
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
90 ≈⟨ i=j ⟩
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
91 TMap j x
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
92 ≈⟨ j=k ⟩
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
93 TMap k x
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
94
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
95 o-resp-≈1 : {a b c : CObj} {f g : CHom a b} {h i : CHom b c } →
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
96 f == g → h == i → h + f == i + g
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
97 o-resp-≈1 {a} {b} {c} {f} {g} {h} {i} f=g h=i {x} = let open ≈-Reasoning B in begin
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
98 TMap h x o TMap f x
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
99 ≈⟨ resp f=g h=i ⟩
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
100 TMap i x o TMap g x
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
101
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
102
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
103 B^A : Category (suc ℓ' ⊔ (suc c₂' ⊔ (suc c₁' ⊔ (suc ℓ ⊔ (suc c₂ ⊔ suc c₁))))) (suc ℓ' ⊔ (suc c₂' ⊔ (suc c₁' ⊔ (suc ℓ ⊔ (suc c₂ ⊔ suc c₁))))) (ℓ' ⊔ c₁)
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
104 B^A =
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
105 record { Obj = CObj
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
106 ; Hom = CHom
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
107 ; _o_ = _+_
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
108 ; _≈_ = _==_
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
109 ; Id = Cid
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
110 ; isCategory = isB^A
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
111 }
6e704f4d4f03 exponential
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
112