annotate CCCGraph1.agda @ 839:111ee96c09ab

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 02 Apr 2020 09:15:52 +0900
parents be4b8e70fa8e
children f9167bc017cd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
832
a115daa7d30e separete
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 open import Level
a115daa7d30e separete
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 open import Category
a115daa7d30e separete
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 module CCCgraph1 where
a115daa7d30e separete
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4
a115daa7d30e separete
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 open import HomReasoning
a115daa7d30e separete
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 open import cat-utility
838
be4b8e70fa8e add category
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 837
diff changeset
7 open import Relation.Binary.PropositionalEquality hiding ( [_] )
832
a115daa7d30e separete
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 open import CCC
a115daa7d30e separete
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 open import graph
a115daa7d30e separete
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10
a115daa7d30e separete
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 module ccc-from-graph {c₁ c₂ : Level} (G : Graph {c₁} {c₂} ) where
838
be4b8e70fa8e add category
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 837
diff changeset
12 open import Relation.Binary.PropositionalEquality hiding ( [_] )
832
a115daa7d30e separete
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 open Graph
a115daa7d30e separete
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14
a115daa7d30e separete
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 data Objs : Set (c₁ ⊔ c₂) where
a115daa7d30e separete
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 atom : (vertex G) → Objs
a115daa7d30e separete
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 ⊤ : Objs
a115daa7d30e separete
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 _∧_ : Objs → Objs → Objs
a115daa7d30e separete
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 _<=_ : Objs → Objs → Objs
a115daa7d30e separete
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
837
d809e2502be4 concat defined
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 836
diff changeset
21 data Arrow : Objs → Objs → Set (c₁ ⊔ c₂) where --- case i
832
a115daa7d30e separete
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 arrow : {a b : vertex G} → (edge G) a b → Arrow (atom a) (atom b)
a115daa7d30e separete
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 ○ : (a : Objs ) → Arrow a ⊤
a115daa7d30e separete
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 π : {a b : Objs } → Arrow ( a ∧ b ) a
a115daa7d30e separete
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 π' : {a b : Objs } → Arrow ( a ∧ b ) b
a115daa7d30e separete
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 ε : {a b : Objs } → Arrow ((a <= b) ∧ b ) a
837
d809e2502be4 concat defined
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 836
diff changeset
27 _* : {a b c : Objs } → Arrow (c ∧ b ) a → Arrow c ( a <= b ) --- case v
832
a115daa7d30e separete
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28
a115daa7d30e separete
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 data Arrows : (b c : Objs ) → Set ( c₁ ⊔ c₂ ) where
837
d809e2502be4 concat defined
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 836
diff changeset
30 id : ( a : Objs ) → Arrows a a --- case i
d809e2502be4 concat defined
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 836
diff changeset
31 <_,_> : {a b c : Objs } → Arrows c a → Arrows c b → Arrows c (a ∧ b) --- case iii
d809e2502be4 concat defined
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 836
diff changeset
32 iv : {b c d : Objs } ( f : Arrow d c ) ( g : Arrows b d ) → Arrows b c -- cas iv
833
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 832
diff changeset
33
834
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 833
diff changeset
34 _・_ : {a b c : Objs } (f : Arrows b c ) → (g : Arrows a b) → Arrows a c
837
d809e2502be4 concat defined
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 836
diff changeset
35 id a ・ g = g
838
be4b8e70fa8e add category
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 837
diff changeset
36 < f , g > ・ h = < f ・ h , g ・ h >
837
d809e2502be4 concat defined
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 836
diff changeset
37 iv f (id _) ・ h = iv f h
839
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 838
diff changeset
38 iv (○ a) g ・ h = iv (○ _) (id _)
837
d809e2502be4 concat defined
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 836
diff changeset
39 iv π < g , g₁ > ・ h = g ・ h
d809e2502be4 concat defined
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 836
diff changeset
40 iv π' < g , g₁ > ・ h = g₁ ・ h
d809e2502be4 concat defined
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 836
diff changeset
41 iv ε < g , g₁ > ・ h = iv ε < g ・ h , g₁ ・ h >
838
be4b8e70fa8e add category
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 837
diff changeset
42 iv (f *) < g , g₁ > ・ h = iv (f *) < g ・ h , g₁ ・ h >
837
d809e2502be4 concat defined
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 836
diff changeset
43 iv f (iv f₁ g) ・ h = iv f ( (iv f₁ g) ・ h )
832
a115daa7d30e separete
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
44
838
be4b8e70fa8e add category
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 837
diff changeset
45 PL : Category (c₁ ⊔ c₂) (c₁ ⊔ c₂) (c₁ ⊔ c₂)
be4b8e70fa8e add category
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 837
diff changeset
46 PL = record {
be4b8e70fa8e add category
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 837
diff changeset
47 Obj = Objs;
be4b8e70fa8e add category
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 837
diff changeset
48 Hom = λ a b → Arrows a b ;
be4b8e70fa8e add category
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 837
diff changeset
49 _o_ = λ{a} {b} {c} x y → x ・ y ;
be4b8e70fa8e add category
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 837
diff changeset
50 _≈_ = λ x y → x ≡ y ;
be4b8e70fa8e add category
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 837
diff changeset
51 Id = λ{a} → id a ;
be4b8e70fa8e add category
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 837
diff changeset
52 isCategory = record {
be4b8e70fa8e add category
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 837
diff changeset
53 isEquivalence = record {refl = refl ; trans = trans ; sym = sym } ;
be4b8e70fa8e add category
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 837
diff changeset
54 identityL = identityL;
be4b8e70fa8e add category
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 837
diff changeset
55 identityR = identityR ;
be4b8e70fa8e add category
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 837
diff changeset
56 o-resp-≈ = o-resp-≈ ;
be4b8e70fa8e add category
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 837
diff changeset
57 associative = λ{a b c d f g h } → associative f g h
be4b8e70fa8e add category
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 837
diff changeset
58 }
be4b8e70fa8e add category
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 837
diff changeset
59 } where
be4b8e70fa8e add category
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 837
diff changeset
60 identityL : {A B : Objs} {f : Arrows A B} → (id B ・ f) ≡ f
839
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 838
diff changeset
61 identityL {_} {_} {id a} = refl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 838
diff changeset
62 identityL {a} {b} {< f , f₁ >} = refl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 838
diff changeset
63 identityL {_} {_} {iv f f₁} = refl
838
be4b8e70fa8e add category
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 837
diff changeset
64 identityR : {A B : Objs} {f : Arrows A B} → (f ・ id A) ≡ f
839
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 838
diff changeset
65 identityR {a} {_} {id a} = refl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 838
diff changeset
66 identityR {a} {b} {< f , g >} = cong₂ ( λ j k → < j , k > ) ( identityR {_} {_} {f} ) ( identityR {_} {_} {g} )
838
be4b8e70fa8e add category
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 837
diff changeset
67 identityR {a} {b} {iv x f} = {!!} -- cong ( λ k → iv x k ) ( identityR {_} {_} {f} )
be4b8e70fa8e add category
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 837
diff changeset
68 o-resp-≈ : {A B C : Objs} {f g : Arrows A B} {h i : Arrows B C} →
be4b8e70fa8e add category
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 837
diff changeset
69 f ≡ g → h ≡ i → (h ・ f) ≡ (i ・ g)
be4b8e70fa8e add category
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 837
diff changeset
70 o-resp-≈ refl refl = refl
be4b8e70fa8e add category
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 837
diff changeset
71 associative : {a b c d : Objs} (f : Arrows c d) (g : Arrows b c) (h : Arrows a b) →
be4b8e70fa8e add category
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 837
diff changeset
72 (f ・ (g ・ h)) ≡ ((f ・ g) ・ h)
839
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 838
diff changeset
73 associative (id a) g h = refl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 838
diff changeset
74 associative (< f , f1 > ) g h = cong₂ ( λ j k → < j , k > ) (associative f g h) (associative f1 g h)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 838
diff changeset
75 associative (iv x f) g h = ? -- cong ( λ k → iv x k ) ( associative f g h )
838
be4b8e70fa8e add category
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 837
diff changeset
76