annotate CCCGraph.agda @ 933:e702aa8be9dd

level try and CCC bad approach
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 14 May 2020 10:48:52 +0900
parents f19425b54aba
children cce9e539486e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
779
6b4bd02efd80 CCC start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 open import Level
6b4bd02efd80 CCC start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 open import Category
932
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
3 module CCCgraph where
779
6b4bd02efd80 CCC start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4
6b4bd02efd80 CCC start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 open import HomReasoning
6b4bd02efd80 CCC start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 open import cat-utility
795
030c5b87ed78 ccc to adjunction done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 794
diff changeset
7 open import Data.Product renaming (_×_ to _/\_ ) hiding ( <_,_> )
784
f27d966939f8 add CCC hom
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 783
diff changeset
8 open import Category.Constructions.Product
790
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
9 open import Relation.Binary.PropositionalEquality hiding ( [_] )
817
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 816
diff changeset
10 open import CCC
779
6b4bd02efd80 CCC start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11
6b4bd02efd80 CCC start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 open Functor
6b4bd02efd80 CCC start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13
6b4bd02efd80 CCC start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 -- ccc-1 : Hom A a 1 ≅ {*}
6b4bd02efd80 CCC start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 -- ccc-2 : Hom A c (a × b) ≅ (Hom A c a ) × ( Hom A c b )
6b4bd02efd80 CCC start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 -- ccc-3 : Hom A a (c ^ b) ≅ Hom A (a × b) c
6b4bd02efd80 CCC start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17
790
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
18 open import Category.Sets
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
19
815
bb9fd483f560 simpler proof of CCC from graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 814
diff changeset
20 -- Sets is a CCC
bb9fd483f560 simpler proof of CCC from graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 814
diff changeset
21
790
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
22 postulate extensionality : { c₁ c₂ ℓ : Level} ( A : Category c₁ c₂ ℓ ) → Relation.Binary.PropositionalEquality.Extensionality c₂ c₂
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
23
931
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 930
diff changeset
24 data One {c : Level } : Set c where
817
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 816
diff changeset
25 OneObj : One -- () in Haskell ( or any one object set )
790
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
26
932
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
27 sets : {c : Level } → CCC (Sets {c})
929
1e8ed7dedc03 ... simpler level on CCC Graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 928
diff changeset
28 sets = record {
817
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 816
diff changeset
29 1 = One
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 816
diff changeset
30 ; ○ = λ _ → λ _ → OneObj
795
030c5b87ed78 ccc to adjunction done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 794
diff changeset
31 ; _∧_ = _∧_
790
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
32 ; <_,_> = <,>
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
33 ; π = π
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
34 ; π' = π'
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
35 ; _<=_ = _<=_
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
36 ; _* = _*
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
37 ; ε = ε
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
38 ; isCCC = isCCC
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
39 } where
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
40 1 : Obj Sets
817
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 816
diff changeset
41 1 = One
790
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
42 ○ : (a : Obj Sets ) → Hom Sets a 1
817
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 816
diff changeset
43 ○ a = λ _ → OneObj
795
030c5b87ed78 ccc to adjunction done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 794
diff changeset
44 _∧_ : Obj Sets → Obj Sets → Obj Sets
030c5b87ed78 ccc to adjunction done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 794
diff changeset
45 _∧_ a b = a /\ b
030c5b87ed78 ccc to adjunction done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 794
diff changeset
46 <,> : {a b c : Obj Sets } → Hom Sets c a → Hom Sets c b → Hom Sets c ( a ∧ b)
790
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
47 <,> f g = λ x → ( f x , g x )
795
030c5b87ed78 ccc to adjunction done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 794
diff changeset
48 π : {a b : Obj Sets } → Hom Sets (a ∧ b) a
790
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
49 π {a} {b} = proj₁
795
030c5b87ed78 ccc to adjunction done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 794
diff changeset
50 π' : {a b : Obj Sets } → Hom Sets (a ∧ b) b
790
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
51 π' {a} {b} = proj₂
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
52 _<=_ : (a b : Obj Sets ) → Obj Sets
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
53 a <= b = b → a
795
030c5b87ed78 ccc to adjunction done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 794
diff changeset
54 _* : {a b c : Obj Sets } → Hom Sets (a ∧ b) c → Hom Sets a (c <= b)
790
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
55 f * = λ x → λ y → f ( x , y )
795
030c5b87ed78 ccc to adjunction done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 794
diff changeset
56 ε : {a b : Obj Sets } → Hom Sets ((a <= b ) ∧ b) a
790
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
57 ε {a} {b} = λ x → ( proj₁ x ) ( proj₂ x )
795
030c5b87ed78 ccc to adjunction done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 794
diff changeset
58 isCCC : CCC.IsCCC Sets 1 ○ _∧_ <,> π π' _<=_ _* ε
790
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
59 isCCC = record {
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
60 e2 = e2
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
61 ; e3a = λ {a} {b} {c} {f} {g} → e3a {a} {b} {c} {f} {g}
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
62 ; e3b = λ {a} {b} {c} {f} {g} → e3b {a} {b} {c} {f} {g}
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
63 ; e3c = e3c
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
64 ; π-cong = π-cong
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
65 ; e4a = e4a
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
66 ; e4b = e4b
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
67 ; *-cong = *-cong
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
68 } where
793
f37f11e1b871 Hom a,b = Hom 1 b^a
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 790
diff changeset
69 e2 : {a : Obj Sets} {f : Hom Sets a 1} → Sets [ f ≈ ○ a ]
f37f11e1b871 Hom a,b = Hom 1 b^a
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 790
diff changeset
70 e2 {a} {f} = extensionality Sets ( λ x → e20 x )
790
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
71 where
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
72 e20 : (x : a ) → f x ≡ ○ a x
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
73 e20 x with f x
817
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 816
diff changeset
74 e20 x | OneObj = refl
790
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
75 e3a : {a b c : Obj Sets} {f : Hom Sets c a} {g : Hom Sets c b} →
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
76 Sets [ ( Sets [ π o ( <,> f g) ] ) ≈ f ]
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
77 e3a = refl
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
78 e3b : {a b c : Obj Sets} {f : Hom Sets c a} {g : Hom Sets c b} →
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
79 Sets [ Sets [ π' o ( <,> f g ) ] ≈ g ]
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
80 e3b = refl
795
030c5b87ed78 ccc to adjunction done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 794
diff changeset
81 e3c : {a b c : Obj Sets} {h : Hom Sets c (a ∧ b)} →
790
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
82 Sets [ <,> (Sets [ π o h ]) (Sets [ π' o h ]) ≈ h ]
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
83 e3c = refl
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
84 π-cong : {a b c : Obj Sets} {f f' : Hom Sets c a} {g g' : Hom Sets c b} →
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
85 Sets [ f ≈ f' ] → Sets [ g ≈ g' ] → Sets [ <,> f g ≈ <,> f' g' ]
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
86 π-cong refl refl = refl
795
030c5b87ed78 ccc to adjunction done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 794
diff changeset
87 e4a : {a b c : Obj Sets} {h : Hom Sets (c ∧ b) a} →
790
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
88 Sets [ Sets [ ε o <,> (Sets [ h * o π ]) π' ] ≈ h ]
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
89 e4a = refl
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
90 e4b : {a b c : Obj Sets} {k : Hom Sets c (a <= b)} →
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
91 Sets [ (Sets [ ε o <,> (Sets [ k o π ]) π' ]) * ≈ k ]
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
92 e4b = refl
795
030c5b87ed78 ccc to adjunction done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 794
diff changeset
93 *-cong : {a b c : Obj Sets} {f f' : Hom Sets (a ∧ b) c} →
790
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
94 Sets [ f ≈ f' ] → Sets [ f * ≈ f' * ]
1e7319868d77 Sets is CCC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
95 *-cong refl = refl
787
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 786
diff changeset
96
932
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
97
933
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
98
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
99
911
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
100 open import graph
932
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
101 module ccc-from-graph {c₁ c₂ : Level } (G : Graph {c₁} {c₂}) where
787
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 786
diff changeset
102
802
7bc41fc7b563 graph with positive logic to Sets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 801
diff changeset
103 open import Relation.Binary.PropositionalEquality renaming ( cong to ≡-cong ) hiding ( [_] )
803
984d20c10c87 simpler graph to category
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 802
diff changeset
104 open Graph
984d20c10c87 simpler graph to category
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 802
diff changeset
105
932
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
106 data Objs : Set (suc c₁) where
911
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
107 atom : (vertex G) → Objs
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
108 ⊤ : Objs
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
109 _∧_ : Objs → Objs → Objs
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
110 _<=_ : Objs → Objs → Objs
803
984d20c10c87 simpler graph to category
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 802
diff changeset
111
932
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
112 data Arrows : (b c : Objs ) → Set (suc c₁ ⊔ c₂)
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
113 data Arrow : Objs → Objs → Set (suc c₁ ⊔ c₂) where --- case i
911
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
114 arrow : {a b : vertex G} → (edge G) a b → Arrow (atom a) (atom b)
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
115 π : {a b : Objs } → Arrow ( a ∧ b ) a
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
116 π' : {a b : Objs } → Arrow ( a ∧ b ) b
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
117 ε : {a b : Objs } → Arrow ((a <= b) ∧ b ) a
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
118 _* : {a b c : Objs } → Arrows (c ∧ b ) a → Arrow c ( a <= b ) --- case v
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
119
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
120 data Arrows where
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
121 id : ( a : Objs ) → Arrows a a --- case i
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
122 ○ : ( a : Objs ) → Arrows a ⊤ --- case i
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
123 <_,_> : {a b c : Objs } → Arrows c a → Arrows c b → Arrows c (a ∧ b) -- case iii
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
124 iv : {b c d : Objs } ( f : Arrow d c ) ( g : Arrows b d ) → Arrows b c -- cas iv
803
984d20c10c87 simpler graph to category
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 802
diff changeset
125
911
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
126 _・_ : {a b c : Objs } (f : Arrows b c ) → (g : Arrows a b) → Arrows a c
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
127 id a ・ g = g
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
128 ○ a ・ g = ○ _
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
129 < f , g > ・ h = < f ・ h , g ・ h >
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
130 iv f g ・ h = iv f ( g ・ h )
819
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 818
diff changeset
131
933
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
132
911
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
133 identityL : {A B : Objs} {f : Arrows A B} → (id B ・ f) ≡ f
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
134 identityL = refl
819
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 818
diff changeset
135
911
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
136 identityR : {A B : Objs} {f : Arrows A B} → (f ・ id A) ≡ f
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
137 identityR {a} {a} {id a} = refl
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
138 identityR {a} {⊤} {○ a} = refl
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
139 identityR {a} {_} {< f , f₁ >} = cong₂ (λ j k → < j , k > ) identityR identityR
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
140 identityR {a} {b} {iv f g} = cong (λ k → iv f k ) identityR
819
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 818
diff changeset
141
911
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
142 assoc≡ : {a b c d : Objs} (f : Arrows c d) (g : Arrows b c) (h : Arrows a b) →
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
143 (f ・ (g ・ h)) ≡ ((f ・ g) ・ h)
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
144 assoc≡ (id a) g h = refl
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
145 assoc≡ (○ a) g h = refl
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
146 assoc≡ < f , f₁ > g h = cong₂ (λ j k → < j , k > ) (assoc≡ f g h) (assoc≡ f₁ g h)
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
147 assoc≡ (iv f f1) g h = cong (λ k → iv f k ) ( assoc≡ f1 g h )
819
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 818
diff changeset
148
911
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
149 -- positive intutionistic calculus
932
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
150 PL : Category (suc c₁) (suc c₁ ⊔ c₂) (suc c₁ ⊔ c₂)
911
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
151 PL = record {
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
152 Obj = Objs;
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
153 Hom = λ a b → Arrows a b ;
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
154 _o_ = λ{a} {b} {c} x y → x ・ y ;
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
155 _≈_ = λ x y → x ≡ y ;
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
156 Id = λ{a} → id a ;
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
157 isCategory = record {
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
158 isEquivalence = record {refl = refl ; trans = trans ; sym = sym} ;
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
159 identityL = λ {a b f} → identityL {a} {b} {f} ;
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
160 identityR = λ {a b f} → identityR {a} {b} {f} ;
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
161 o-resp-≈ = λ {a b c f g h i} → o-resp-≈ {a} {b} {c} {f} {g} {h} {i} ;
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
162 associative = λ{a b c d f g h } → assoc≡ f g h
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
163 }
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
164 } where
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
165 o-resp-≈ : {A B C : Objs} {f g : Arrows A B} {h i : Arrows B C} →
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
166 f ≡ g → h ≡ i → (h ・ f) ≡ (i ・ g)
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
167 o-resp-≈ refl refl = refl
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
168
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
169 --------
819
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 818
diff changeset
170 --
911
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
171 -- Functor from Positive Logic to Sets
819
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 818
diff changeset
172 --
911
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
173
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
174 -- open import Category.Sets
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
175 -- postulate extensionality : { c₁ c₂ ℓ : Level} ( A : Category c₁ c₂ ℓ ) → Relation.Binary.PropositionalEquality.Extensionalit y c₂ c₂
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
176
932
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
177 open import Data.List
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
178
911
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
179 C = graphtocat.Chain G
819
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 818
diff changeset
180
911
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
181 tr : {a b : vertex G} → edge G a b → ((y : vertex G) → C y a) → (y : vertex G) → C y b
932
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
182 tr f x y = graphtocat.next f (x y)
911
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
183
932
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
184 fobj : ( a : Objs ) → Set (c₁ ⊔ c₂)
911
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
185 fobj (atom x) = ( y : vertex G ) → C y x
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
186 fobj ⊤ = One
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
187 fobj (a ∧ b) = ( fobj a /\ fobj b)
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
188 fobj (a <= b) = fobj b → fobj a
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
189
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
190 fmap : { a b : Objs } → Hom PL a b → fobj a → fobj b
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
191 amap : { a b : Objs } → Arrow a b → fobj a → fobj b
932
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
192 amap (arrow x) y = tr x y -- tr x
911
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
193 amap π ( x , y ) = x
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
194 amap π' ( x , y ) = y
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
195 amap ε (f , x ) = f x
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
196 amap (f *) x = λ y → fmap f ( x , y )
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
197 fmap (id a) x = x
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
198 fmap (○ a) x = OneObj
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
199 fmap < f , g > x = ( fmap f x , fmap g x )
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
200 fmap (iv x f) a = amap x ( fmap f a )
819
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 818
diff changeset
201
911
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
202 -- CS is a map from Positive logic to Sets
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
203 -- Sets is CCC, so we have a cartesian closed category generated by a graph
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
204 -- as a sub category of Sets
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
205
932
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
206 CS : Functor PL (Sets {c₁ ⊔ c₂})
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
207 FObj CS a = fobj a
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
208 FMap CS {a} {b} f = fmap {a} {b} f
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
209 isFunctor CS = isf where
911
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
210 _+_ = Category._o_ PL
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
211 ++idR = IsCategory.identityR ( Category.isCategory PL )
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
212 distr : {a b c : Obj PL} { f : Hom PL a b } { g : Hom PL b c } → (z : fobj a ) → fmap (g + f) z ≡ fmap g (fmap f z)
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
213 distr {a} {a₁} {a₁} {f} {id a₁} z = refl
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
214 distr {a} {a₁} {⊤} {f} {○ a₁} z = refl
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
215 distr {a} {b} {c ∧ d} {f} {< g , g₁ >} z = cong₂ (λ j k → j , k ) (distr {a} {b} {c} {f} {g} z) (distr {a} {b} {d} {f} {g₁} z)
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
216 distr {a} {b} {c} {f} {iv {_} {_} {d} x g} z = adistr (distr {a} {b} {d} {f} {g} z) x where
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
217 adistr : fmap (g + f) z ≡ fmap g (fmap f z) →
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
218 ( x : Arrow d c ) → fmap ( iv x (g + f) ) z ≡ fmap ( iv x g ) (fmap f z )
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
219 adistr eq x = cong ( λ k → amap x k ) eq
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
220 isf : IsFunctor PL Sets fobj fmap
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
221 IsFunctor.identity isf = extensionality Sets ( λ x → refl )
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
222 IsFunctor.≈-cong isf refl = refl
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
223 IsFunctor.distr isf {a} {b} {c} {g} {f} = extensionality Sets ( λ z → distr {a} {b} {c} {g} {f} z )
819
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 818
diff changeset
224
933
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
225 pccc : CCC PL -- this does not work because of ≡ , if we define another equality, o-resp-≈ may trouble
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
226 pccc = record {
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
227 1 = ⊤
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
228 ; ○ = λ _ → ○ _
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
229 ; _∧_ = _∧_
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
230 ; <_,_> = λ f g → < f , g >
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
231 ; π = iv π (id _)
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
232 ; π' = iv π' (id _)
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
233 ; _<=_ = _<=_
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
234 ; _* = λ f → iv (f *) (id _)
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
235 ; ε = iv ε (id _)
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
236 ; isCCC = isCCC
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
237 } where
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
238 open graphtocat.Chain
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
239 isCCC : CCC.IsCCC PL ⊤ ○ _∧_ <_,_> (iv π (id _)) (iv π' (id _)) _<=_ (λ f → iv (f *) (id _)) (iv ε (id _))
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
240 isCCC = record {
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
241 e2 = {!!} --e2
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
242 ; e3a = {!!} --λ {a} {b} {c} {f} {g} → e3a {a} {b} {c} {f} {g}
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
243 ; e3b = {!!} --λ {a} {b} {c} {f} {g} → e3b {a} {b} {c} {f} {g}
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
244 ; e3c = {!!} --e3c
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
245 ; π-cong = {!!} --π-cong
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
246 ; e4a = {!!} --e4a
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
247 ; e4b = {!!} --e4b
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
248 ; *-cong = {!!} --*-cong
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
249 }
801
aa4fbd007247 using setoid
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
250
818
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 817
diff changeset
251 ---
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 817
diff changeset
252 --- SubCategoy SC F A is a category with Obj = FObj F, Hom = FMap
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 817
diff changeset
253 ---
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 817
diff changeset
254 --- CCC ( SC (CS G)) Sets have to be proved
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 817
diff changeset
255 --- SM can be eliminated if we have
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 817
diff changeset
256 --- sobj (a : vertex g ) → {a} a set have only a
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 817
diff changeset
257 --- smap (a b : vertex g ) → {a} → {b}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 817
diff changeset
258
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 817
diff changeset
259
932
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
260 record CCCObj {c₁ c₂ ℓ : Level} : Set (suc (ℓ ⊔ (c₂ ⊔ c₁))) where
818
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 817
diff changeset
261 field
932
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
262 cat : Category c₁ c₂ ℓ
911
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
263 ≡←≈ : {a b : Obj cat } → { f g : Hom cat a b } → cat [ f ≈ g ] → f ≡ g
818
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 817
diff changeset
264 ccc : CCC cat
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 817
diff changeset
265
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 817
diff changeset
266 open CCCObj
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 817
diff changeset
267
932
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
268 record CCCMap {c₁ c₂ ℓ c₁′ c₂′ ℓ′ : Level} (A : CCCObj {c₁} {c₂} {ℓ} ) (B : CCCObj {c₁′} {c₂′}{ℓ′} ) : Set (suc (ℓ′ ⊔ (c₂′ ⊔ c₁′) ⊔ ℓ ⊔ (c₂ ⊔ c₁))) where
818
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 817
diff changeset
269 field
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 817
diff changeset
270 cmap : Functor (cat A ) (cat B )
820
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 819
diff changeset
271 ccf : CCC (cat A) → CCC (cat B)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 819
diff changeset
272
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 819
diff changeset
273 open import Category.Cat
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 819
diff changeset
274
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 819
diff changeset
275 open CCCMap
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 819
diff changeset
276 open import Relation.Binary.Core
818
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 817
diff changeset
277
932
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
278 Cart : {c₁ c₂ ℓ : Level} → Category (suc (c₁ ⊔ c₂ ⊔ ℓ)) (suc (ℓ ⊔ (c₂ ⊔ c₁))) (suc (ℓ ⊔ c₁ ⊔ c₂))
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
279 Cart {c₁} {c₂} {ℓ} = record {
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
280 Obj = CCCObj {c₁} {c₂} {ℓ}
820
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 819
diff changeset
281 ; Hom = CCCMap
824
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 823
diff changeset
282 ; _o_ = λ {A} {B} {C} f g → record { cmap = (cmap f) ○ ( cmap g ) ; ccf = λ _ → ccf f ( ccf g (ccc A )) }
820
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 819
diff changeset
283 ; _≈_ = λ {a} {b} f g → cmap f ≃ cmap g
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 819
diff changeset
284 ; Id = λ {a} → record { cmap = identityFunctor ; ccf = λ x → x }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 819
diff changeset
285 ; isCategory = record {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 819
diff changeset
286 isEquivalence = λ {A} {B} → record {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 819
diff changeset
287 refl = λ {f} → let open ≈-Reasoning (CAT) in refl-hom {cat A} {cat B} {cmap f}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 819
diff changeset
288 ; sym = λ {f} {g} → let open ≈-Reasoning (CAT) in sym-hom {cat A} {cat B} {cmap f} {cmap g}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 819
diff changeset
289 ; trans = λ {f} {g} {h} → let open ≈-Reasoning (CAT) in trans-hom {cat A} {cat B} {cmap f} {cmap g} {cmap h} }
821
fbbc9c03bfed Grp and Cart
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 820
diff changeset
290 ; identityL = λ {x} {y} {f} → let open ≈-Reasoning (CAT) in idL {cat x} {cat y} {cmap f} {_} {_}
fbbc9c03bfed Grp and Cart
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 820
diff changeset
291 ; identityR = λ {x} {y} {f} → let open ≈-Reasoning (CAT) in idR {cat x} {cat y} {cmap f}
fbbc9c03bfed Grp and Cart
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 820
diff changeset
292 ; o-resp-≈ = λ {x} {y} {z} {f} {g} {h} {i} → IsCategory.o-resp-≈ ( Category.isCategory CAT) {cat x}{cat y}{cat z} {cmap f} {cmap g} {cmap h} {cmap i}
fbbc9c03bfed Grp and Cart
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 820
diff changeset
293 ; associative = λ {a} {b} {c} {d} {f} {g} {h} → let open ≈-Reasoning (CAT) in assoc {cat a} {cat b} {cat c} {cat d} {cmap f} {cmap g} {cmap h}
824
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 823
diff changeset
294 }}
818
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 817
diff changeset
295
825
8f41ad966eaa rename discrete
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 824
diff changeset
296 open import graph
818
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 817
diff changeset
297 open Graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 817
diff changeset
298
932
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
299 record GMap {c₁ c₂ c₁' c₂' : Level} (x : Graph {c₁} {c₂} ) (y : Graph {c₁'} {c₂'} ) : Set (c₁ ⊔ c₂ ⊔ c₁' ⊔ c₂') where
820
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 819
diff changeset
300 field
818
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 817
diff changeset
301 vmap : vertex x → vertex y
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 817
diff changeset
302 emap : {a b : vertex x} → edge x a b → edge y (vmap a) (vmap b)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 817
diff changeset
303
820
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 819
diff changeset
304 open GMap
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 819
diff changeset
305
821
fbbc9c03bfed Grp and Cart
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 820
diff changeset
306 open import Relation.Binary.HeterogeneousEquality using (_≅_;refl ) renaming ( sym to ≅-sym ; trans to ≅-trans ; cong to ≅-cong )
fbbc9c03bfed Grp and Cart
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 820
diff changeset
307
932
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
308 data [_]_==_ {c₁ c₂ : Level} (C : Graph {c₁} {c₂}) {A B : vertex C} (f : edge C A B)
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
309 : ∀{X Y : vertex C} → edge C X Y → Set (c₁ ⊔ c₂ ) where
824
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 823
diff changeset
310 mrefl : {g : edge C A B} → (eqv : f ≡ g ) → [ C ] f == g
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 823
diff changeset
311
932
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
312 _=m=_ : {c₁ c₂ c₁' c₂' : Level} {C : Graph {c₁} {c₂} } {D : Graph {c₁'} {c₂'} }
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
313 → (F G : GMap C D) → Set (c₁ ⊔ c₂ ⊔ c₁' ⊔ c₂')
824
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 823
diff changeset
314 _=m=_ {C = C} {D = D} F G = ∀{A B : vertex C} → (f : edge C A B) → [ D ] emap F f == emap G f
821
fbbc9c03bfed Grp and Cart
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 820
diff changeset
315
932
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
316 _&_ : {c₁ c₂ : Level} {x y z : Graph {c₁} {c₂} } ( f : GMap y z ) ( g : GMap x y ) → GMap x z
821
fbbc9c03bfed Grp and Cart
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 820
diff changeset
317 f & g = record { vmap = λ x → vmap f ( vmap g x ) ; emap = λ x → emap f ( emap g x ) }
fbbc9c03bfed Grp and Cart
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 820
diff changeset
318
932
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
319 Grph : {c₁ c₂ : Level} → Category (suc (c₁ ⊔ c₂)) (c₁ ⊔ c₂) (c₁ ⊔ c₂)
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
320 Grph {c₁} {c₂} = record {
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
321 Obj = Graph {c₁} {c₂}
929
1e8ed7dedc03 ... simpler level on CCC Graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 928
diff changeset
322 ; Hom = GMap
821
fbbc9c03bfed Grp and Cart
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 820
diff changeset
323 ; _o_ = _&_
fbbc9c03bfed Grp and Cart
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 820
diff changeset
324 ; _≈_ = _=m=_
820
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 819
diff changeset
325 ; Id = record { vmap = λ y → y ; emap = λ f → f }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 819
diff changeset
326 ; isCategory = record {
824
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 823
diff changeset
327 isEquivalence = λ {A} {B} → ise
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 823
diff changeset
328 ; identityL = λ e → mrefl refl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 823
diff changeset
329 ; identityR = λ e → mrefl refl
821
fbbc9c03bfed Grp and Cart
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 820
diff changeset
330 ; o-resp-≈ = m--resp-≈
824
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 823
diff changeset
331 ; associative = λ e → mrefl refl
821
fbbc9c03bfed Grp and Cart
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 820
diff changeset
332 }} where
932
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
333 msym : {x y : Graph {c₁} {c₂} } { f g : GMap x y } → f =m= g → g =m= f
929
1e8ed7dedc03 ... simpler level on CCC Graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 928
diff changeset
334 msym {x} {y} f=g f = lemma ( f=g f ) where
824
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 823
diff changeset
335 lemma : ∀{a b c d} {f : edge y a b} {g : edge y c d} → [ y ] f == g → [ y ] g == f
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 823
diff changeset
336 lemma (mrefl Ff≈Gf) = mrefl (sym Ff≈Gf)
932
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
337 mtrans : {x y : Graph {c₁} {c₂} } { f g h : GMap x y } → f =m= g → g =m= h → f =m= h
929
1e8ed7dedc03 ... simpler level on CCC Graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 928
diff changeset
338 mtrans {x} {y} f=g g=h f = lemma ( f=g f ) ( g=h f ) where
824
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 823
diff changeset
339 lemma : ∀{a b c d e f} {p : edge y a b} {q : edge y c d} → {r : edge y e f} → [ y ] p == q → [ y ] q == r → [ y ] p == r
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 823
diff changeset
340 lemma (mrefl eqv) (mrefl eqv₁) = mrefl ( trans eqv eqv₁ )
932
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
341 ise : {x y : Graph {c₁} {c₂} } → IsEquivalence {_} {c₁ ⊔ c₂} {_} ( _=m=_ {_} {_} {_} {_} {x} {y})
821
fbbc9c03bfed Grp and Cart
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 820
diff changeset
342 ise = record {
824
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 823
diff changeset
343 refl = λ f → mrefl refl
821
fbbc9c03bfed Grp and Cart
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 820
diff changeset
344 ; sym = msym
fbbc9c03bfed Grp and Cart
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 820
diff changeset
345 ; trans = mtrans
fbbc9c03bfed Grp and Cart
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 820
diff changeset
346 }
932
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
347 m--resp-≈ : {A B C : Graph {c₁} {c₂} }
824
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 823
diff changeset
348 {f g : GMap A B} {h i : GMap B C} → f =m= g → h =m= i → ( h & f ) =m= ( i & g )
929
1e8ed7dedc03 ... simpler level on CCC Graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 928
diff changeset
349 m--resp-≈ {A} {B} {C} {f} {g} {h} {i} f=g h=i e =
824
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 823
diff changeset
350 lemma (emap f e) (emap g e) (emap i (emap g e)) (f=g e) (h=i ( emap g e )) where
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 823
diff changeset
351 lemma : {a b c d : vertex B } {z w : vertex C } (ϕ : edge B a b) (ψ : edge B c d) (π : edge C z w) →
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 823
diff changeset
352 [ B ] ϕ == ψ → [ C ] (emap h ψ) == π → [ C ] (emap h ϕ) == π
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 823
diff changeset
353 lemma _ _ _ (mrefl refl) (mrefl refl) = mrefl refl
820
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 819
diff changeset
354
821
fbbc9c03bfed Grp and Cart
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 820
diff changeset
355 --- Forgetful functor
fbbc9c03bfed Grp and Cart
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 820
diff changeset
356
929
1e8ed7dedc03 ... simpler level on CCC Graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 928
diff changeset
357 module forgetful where
927
2c5ae3015a05 level hell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 926
diff changeset
358
2c5ae3015a05 level hell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 926
diff changeset
359 ≃-cong : {c₁ c₂ ℓ : Level} (B : Category c₁ c₂ ℓ ) → {a b a' b' : Obj B }
822
4c0580d9dda4 from cart to graph, hom equality to set equality
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 821
diff changeset
360 → { f f' : Hom B a b }
4c0580d9dda4 from cart to graph, hom equality to set equality
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 821
diff changeset
361 → { g g' : Hom B a' b' }
4c0580d9dda4 from cart to graph, hom equality to set equality
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 821
diff changeset
362 → [_]_~_ B f g → B [ f ≈ f' ] → B [ g ≈ g' ] → [_]_~_ B f' g'
927
2c5ae3015a05 level hell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 926
diff changeset
363 ≃-cong B {a} {b} {a'} {b'} {f} {f'} {g} {g'} (refl {g2} eqv) f=f' g=g' = let open ≈-Reasoning B in refl {_} {_} {_} {B} {a'} {b'} {f'} {g'} ( begin
822
4c0580d9dda4 from cart to graph, hom equality to set equality
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 821
diff changeset
364 f'
4c0580d9dda4 from cart to graph, hom equality to set equality
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 821
diff changeset
365 ≈↑⟨ f=f' ⟩
4c0580d9dda4 from cart to graph, hom equality to set equality
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 821
diff changeset
366 f
4c0580d9dda4 from cart to graph, hom equality to set equality
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 821
diff changeset
367 ≈⟨ eqv ⟩
4c0580d9dda4 from cart to graph, hom equality to set equality
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 821
diff changeset
368 g
4c0580d9dda4 from cart to graph, hom equality to set equality
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 821
diff changeset
369 ≈⟨ g=g' ⟩
4c0580d9dda4 from cart to graph, hom equality to set equality
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 821
diff changeset
370 g'
4c0580d9dda4 from cart to graph, hom equality to set equality
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 821
diff changeset
371 ∎ )
4c0580d9dda4 from cart to graph, hom equality to set equality
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 821
diff changeset
372
933
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
373 fobj : {c₁ c₂ ℓ : Level} → Obj (Cart {c₁} {c₂} {ℓ}) → Obj Grph
927
2c5ae3015a05 level hell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 926
diff changeset
374 fobj a = record { vertex = Obj (cat a) ; edge = Hom (cat a) }
933
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
375 fmap : {c₁ c₂ ℓ : Level} {a b : Obj (Cart {c₁} {c₂} {ℓ} ) } → Hom (Cart ) a b → Hom (Grph ) ( fobj a ) ( fobj b )
927
2c5ae3015a05 level hell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 926
diff changeset
376 fmap f = record { vmap = FObj (cmap f) ; emap = FMap (cmap f) }
822
4c0580d9dda4 from cart to graph, hom equality to set equality
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 821
diff changeset
377
933
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
378 UX : {c₁ c₂ : Level} → Functor (Cart {suc (c₁ ⊔ c₂)} {c₁ ⊔ c₂} {c₁ ⊔ c₂}) (Grph {c₁} {c₂})
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
379 FObj UX a = {!!} -- fobj a
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
380 FMap UX f = {!!} -- fmap f
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
381 isFunctor UX = {!!} where -- isf where
927
2c5ae3015a05 level hell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 926
diff changeset
382 isf : IsFunctor Cart Grph fobj fmap
2c5ae3015a05 level hell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 926
diff changeset
383 IsFunctor.identity isf {a} {b} {f} e = mrefl refl
2c5ae3015a05 level hell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 926
diff changeset
384 IsFunctor.distr isf {a} {b} {c} f = mrefl refl
2c5ae3015a05 level hell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 926
diff changeset
385 IsFunctor.≈-cong isf {a} {b} {f} {g} f=g e = lemma ( (extensionality Sets ( λ z → lemma4 (
2c5ae3015a05 level hell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 926
diff changeset
386 ≃-cong (cat b) (f=g (id1 (cat a) z)) (IsFunctor.identity (Functor.isFunctor (cmap f))) (IsFunctor.identity (Functor.isFunctor (cmap g)))
2c5ae3015a05 level hell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 926
diff changeset
387 )))) (f=g e) where
2c5ae3015a05 level hell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 926
diff changeset
388 lemma4 : {x y : vertex (fobj b)} → [_]_~_ (cat b) (id1 (cat b) x) (id1 (cat b) y) → x ≡ y
2c5ae3015a05 level hell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 926
diff changeset
389 lemma4 (refl eqv) = refl
2c5ae3015a05 level hell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 926
diff changeset
390 lemma : vmap (fmap f) ≡ vmap (fmap g) → [ cat b ] FMap (cmap f) e ~ FMap (cmap g) e → [ fobj b ] emap (fmap f) e == emap (fmap g) e
2c5ae3015a05 level hell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 926
diff changeset
391 lemma refl (refl eqv) = mrefl (≡←≈ b eqv)
824
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 823
diff changeset
392
821
fbbc9c03bfed Grp and Cart
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 820
diff changeset
393
911
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
394 open ccc-from-graph.Objs
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
395 open ccc-from-graph.Arrow
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
396 open ccc-from-graph.Arrows
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
397 open graphtocat.Chain
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
398
932
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
399 Sets0 : {c₂ : Level } → Category (suc c₂) c₂ c₂
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
400 Sets0 {c₂} = Sets {c₂}
930
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 929
diff changeset
401
933
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
402 ccc-graph-univ : {c₁ c₂ : Level} → UniversalMapping (Grph {c₁} {c₂}) (Cart {suc (c₁ ⊔ c₂)} {c₁ ⊔ c₂} {c₁ ⊔ c₂}) forgetful.UX
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
403 ccc-graph-univ {c₁} {c₂} = record {
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
404 F = F ;
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
405 η = η ; -- λ a → record { vmap = λ y → graphtocat.Chain {!!} {!!} {!!} ; emap = λ f x → {!!} } ; --
927
2c5ae3015a05 level hell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 926
diff changeset
406 _* = solution ;
911
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
407 isUniversalMapping = record {
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
408 universalMapping = {!!} ;
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
409 uniquness = {!!}
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
410 }
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
411 } where
929
1e8ed7dedc03 ... simpler level on CCC Graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 928
diff changeset
412 open forgetful
926
a7332c329b57 remove CSC and subcat
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 925
diff changeset
413 open ccc-from-graph
933
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
414 F : Obj (Grph {c₁} {c₂}) → Obj (Cart {suc (c₁ ⊔ c₂)} {c₁ ⊔ c₂} {c₁ ⊔ c₂})
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
415 F g = record { cat = Sets {c₁ ⊔ c₂} ; ccc = sets ; ≡←≈ = λ eq → eq }
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
416 FO : (a : Obj (Grph {c₁} {c₂}) ) → Graph {(c₁ ⊔ c₂)} {(c₁ ⊔ c₂)}
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
417 FO a = FObj UX (F a)
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
418 η : (a : Obj (Grph {c₁} {c₂}) ) → Hom Grph a (FObj UX (F a))
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
419 η a = record { vmap = λ y → {!!} ; emap = λ f x → {!!} }
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
420 csc : Graph → Obj Cart
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
421 csc g = record { cat = Sets {c₁ ⊔ c₂} ; ccc = sets ; ≡←≈ = λ eq → eq }
932
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
422 cs : {c₁ c₂ : Level} → (g : Graph {c₁} {c₂} ) → Functor (ccc-from-graph.PL g) (Sets {_})
931
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 930
diff changeset
423 cs g = CS g
932
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
424 pl : {c₁ c₂ : Level} → (g : Graph {c₁} {c₂} ) → Category _ _ _
926
a7332c329b57 remove CSC and subcat
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 925
diff changeset
425 pl g = PL g
933
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
426 cobj : {g : Obj (Grph {c₁} {c₂} ) } {c : Obj Cart} → Hom Grph g (FObj UX c) → Objs g → Obj (cat c)
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
427 cobj {g} {c} f (atom x) = {!!} -- vmap f x
912
635418b4b2f3 add subcat
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 911
diff changeset
428 cobj {g} {c} f ⊤ = CCC.1 (ccc c)
914
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 912
diff changeset
429 cobj {g} {c} f (x ∧ y) = CCC._∧_ (ccc c) (cobj {g} {c} f x) (cobj {g} {c} f y)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 912
diff changeset
430 cobj {g} {c} f (b <= a) = CCC._<=_ (ccc c) (cobj {g} {c} f b) (cobj {g} {c} f a)
932
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
431 c-map : {g : Obj (Grph )} {c : Obj Cart} {A B : Objs g}
f19425b54aba introduce detailed level on CCCGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 931
diff changeset
432 → (f : Hom Grph g (FObj UX c) ) → (p : Hom (pl g) A B) → Hom (cat c) (cobj {g} {c} f A) (cobj {g} {c} f B)
926
a7332c329b57 remove CSC and subcat
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 925
diff changeset
433 c-map {g} {c} {atom a} {atom x} f y = {!!}
927
2c5ae3015a05 level hell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 926
diff changeset
434 c-map {g} {c} {⊤} {atom x} f (iv f1 y) = {!!}
2c5ae3015a05 level hell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 926
diff changeset
435 c-map {g} {c} {a ∧ b} {atom x} f (iv f1 y) = {!!}
926
a7332c329b57 remove CSC and subcat
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 925
diff changeset
436 c-map {g} {c} {b <= a} {atom x} f y = {!!}
914
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 912
diff changeset
437 c-map {g} {c} {a} {⊤} f x = CCC.○ (ccc c) (cobj f a)
926
a7332c329b57 remove CSC and subcat
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 925
diff changeset
438 c-map {g} {c} {a} {x ∧ y} f z = CCC.<_,_> (ccc c) (c-map f {!!}) (c-map f {!!})
a7332c329b57 remove CSC and subcat
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 925
diff changeset
439 c-map {g} {c} {d} {b <= a} f x = CCC._* (ccc c) ( c-map f {!!})
933
e702aa8be9dd level try and CCC bad approach
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
440 solution : {g : Obj Grph } {c : Obj Cart } → Hom Grph g (FObj UX c) → Hom Cart (csc g) c
929
1e8ed7dedc03 ... simpler level on CCC Graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 928
diff changeset
441 solution {g} {c} f = {!!} -- record { cmap = record { FObj = λ x → {!!} ; FMap = {!!} ; isFunctor = {!!} } ; ccf = {!!} }
911
b8c5f15ee561 small graph and small category on CCC to graph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 825
diff changeset
442
912
635418b4b2f3 add subcat
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 911
diff changeset
443