annotate src/CCCSets.agda @ 1018:4b517d46e987

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Wed, 24 Mar 2021 23:15:22 +0900
parents bbbe97d2a5ea
children 501e016bf877
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
999
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 {-# OPTIONS --allow-unsolved-metas #-}
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 module CCCSets where
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 open import Level
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 open import Category
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 open import HomReasoning
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 open import cat-utility
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 open import Data.Product renaming (_×_ to _/\_ ) hiding ( <_,_> )
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 open import Category.Constructions.Product
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 open import Relation.Binary.PropositionalEquality hiding ( [_] )
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 open import CCC
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 open Functor
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 -- ccc-1 : Hom A a 1 ≅ {*}
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 -- ccc-2 : Hom A c (a × b) ≅ (Hom A c a ) × ( Hom A c b )
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 -- ccc-3 : Hom A a (c ^ b) ≅ Hom A (a × b) c
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 open import Category.Sets
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 -- Sets is a CCC
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22
1018
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1016
diff changeset
23 open import SetsCompleteness hiding (ki1)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1016
diff changeset
24
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1016
diff changeset
25 -- import Axiom.Extensionality.Propositional
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1016
diff changeset
26 -- postulate extensionality : { c₁ c₂ ℓ : Level} ( A : Category c₁ c₂ ℓ ) → Axiom.Extensionality.Propositional.Extensionality c₂ c₂
999
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 data One {c : Level } : Set c where
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 OneObj : One -- () in Haskell ( or any one object set )
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
30
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 sets : {c : Level } → CCC (Sets {c})
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 sets = record {
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 1 = One
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 ; ○ = λ _ → λ _ → OneObj
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 ; _∧_ = _∧_
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 ; <_,_> = <,>
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 ; π = π
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 ; π' = π'
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 ; _<=_ = _<=_
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 ; _* = _*
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 ; ε = ε
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 ; isCCC = isCCC
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 } where
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 1 : Obj Sets
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 1 = One
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 ○ : (a : Obj Sets ) → Hom Sets a 1
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 ○ a = λ _ → OneObj
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 _∧_ : Obj Sets → Obj Sets → Obj Sets
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 _∧_ a b = a /\ b
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 <,> : {a b c : Obj Sets } → Hom Sets c a → Hom Sets c b → Hom Sets c ( a ∧ b)
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 <,> f g = λ x → ( f x , g x )
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 π : {a b : Obj Sets } → Hom Sets (a ∧ b) a
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 π {a} {b} = proj₁
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 π' : {a b : Obj Sets } → Hom Sets (a ∧ b) b
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 π' {a} {b} = proj₂
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 _<=_ : (a b : Obj Sets ) → Obj Sets
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
57 a <= b = b → a
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 _* : {a b c : Obj Sets } → Hom Sets (a ∧ b) c → Hom Sets a (c <= b)
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 f * = λ x → λ y → f ( x , y )
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 ε : {a b : Obj Sets } → Hom Sets ((a <= b ) ∧ b) a
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
61 ε {a} {b} = λ x → ( proj₁ x ) ( proj₂ x )
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 isCCC : CCC.IsCCC Sets 1 ○ _∧_ <,> π π' _<=_ _* ε
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 isCCC = record {
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
64 e2 = e2
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
65 ; e3a = λ {a} {b} {c} {f} {g} → e3a {a} {b} {c} {f} {g}
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 ; e3b = λ {a} {b} {c} {f} {g} → e3b {a} {b} {c} {f} {g}
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 ; e3c = e3c
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
68 ; π-cong = π-cong
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
69 ; e4a = e4a
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
70 ; e4b = e4b
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
71 ; *-cong = *-cong
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
72 } where
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
73 e2 : {a : Obj Sets} {f : Hom Sets a 1} → Sets [ f ≈ ○ a ]
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 e2 {a} {f} = extensionality Sets ( λ x → e20 x )
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
75 where
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
76 e20 : (x : a ) → f x ≡ ○ a x
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 e20 x with f x
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 e20 x | OneObj = refl
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 e3a : {a b c : Obj Sets} {f : Hom Sets c a} {g : Hom Sets c b} →
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 Sets [ ( Sets [ π o ( <,> f g) ] ) ≈ f ]
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 e3a = refl
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 e3b : {a b c : Obj Sets} {f : Hom Sets c a} {g : Hom Sets c b} →
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
83 Sets [ Sets [ π' o ( <,> f g ) ] ≈ g ]
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 e3b = refl
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 e3c : {a b c : Obj Sets} {h : Hom Sets c (a ∧ b)} →
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 Sets [ <,> (Sets [ π o h ]) (Sets [ π' o h ]) ≈ h ]
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
87 e3c = refl
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 π-cong : {a b c : Obj Sets} {f f' : Hom Sets c a} {g g' : Hom Sets c b} →
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
89 Sets [ f ≈ f' ] → Sets [ g ≈ g' ] → Sets [ <,> f g ≈ <,> f' g' ]
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
90 π-cong refl refl = refl
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
91 e4a : {a b c : Obj Sets} {h : Hom Sets (c ∧ b) a} →
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
92 Sets [ Sets [ ε o <,> (Sets [ h * o π ]) π' ] ≈ h ]
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
93 e4a = refl
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
94 e4b : {a b c : Obj Sets} {k : Hom Sets c (a <= b)} →
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
95 Sets [ (Sets [ ε o <,> (Sets [ k o π ]) π' ]) * ≈ k ]
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
96 e4b = refl
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
97 *-cong : {a b c : Obj Sets} {f f' : Hom Sets (a ∧ b) c} →
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
98 Sets [ f ≈ f' ] → Sets [ f * ≈ f' * ]
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
99 *-cong refl = refl
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
100
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
101 -- ○ b
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
102 -- b -----------→ 1
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
103 -- | |
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
104 -- m | | ⊤
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
105 -- ↓ char m ↓
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
106 -- a -----------→ Ω
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
107 -- h
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
108
1010
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 999
diff changeset
109 data Bool {c : Level } : Set c where
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 999
diff changeset
110 true : Bool
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 999
diff changeset
111 false : Bool
999
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
112
1018
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1016
diff changeset
113 -- data sequ {c : Level} (A B : Set c) ( f g : A → B ) : Set c where
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1016
diff changeset
114 -- elem : (x : A ) → (eq : f x ≡ g x) → sequ A B f g
999
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
115
1018
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1016
diff changeset
116 -- irr : { c₂ : Level} {d : Set c₂ } { x y : d } ( eq eq' : x ≡ y ) → eq ≡ eq'
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1016
diff changeset
117 -- irr refl refl = refl
999
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
118
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
119 topos : {c : Level } → Topos (Sets {c}) sets
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
120 topos {c} = record {
1010
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 999
diff changeset
121 Ω = Bool
999
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
122 ; ⊤ = λ _ → true
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
123 ; Ker = tker
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
124 ; char = tchar
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
125 ; isTopos = record {
1018
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1016
diff changeset
126 char-uniqueness = λ {a} {b} {h} m mono → extensionality Sets ( λ x → uniq h m mono x )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1016
diff changeset
127 ; ker-m = imequ
999
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
128 }
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
129 } where
1010
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 999
diff changeset
130 tker : {a : Obj Sets} (h : Hom Sets a Bool) → Equalizer Sets h (Sets [ (λ _ → true) o CCC.○ sets a ])
999
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
131 tker {a} h = record {
1018
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1016
diff changeset
132 equalizer-c = sequ a Bool h (λ _ → true)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1016
diff changeset
133 ; equalizer = λ e → equ e
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1016
diff changeset
134 ; isEqualizer = SetsIsEqualizer _ _ _ _ }
1010
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 999
diff changeset
135 tchar : {a b : Obj Sets} (m : Hom Sets b a) → Mono Sets m → Hom Sets a Bool
999
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
136 tchar {a} {b} m mono x = true
1018
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1016
diff changeset
137 selem : {a : Obj (Sets {c})} → (x : sequ a Bool (λ x₁ → true) (λ _ → true)) → a
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1016
diff changeset
138 selem (elem x eq) = x
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1016
diff changeset
139 imequ : {a b : Obj Sets} (m : Hom Sets b a) (mono : Mono Sets m) → IsEqualizer Sets m (tchar m mono) (Sets [ (λ _ → true) o CCC.○ sets a ])
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1016
diff changeset
140 imequ {a} {b} m mono = record {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1016
diff changeset
141 fe=ge = extensionality Sets ( λ x → refl )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1016
diff changeset
142 ; k = λ h eq → {!!}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1016
diff changeset
143 ; ek=h = {!!}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1016
diff changeset
144 ; uniqueness = {!!}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1016
diff changeset
145 }
1010
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 999
diff changeset
146 uniq : {a : Obj (Sets {c})} {b : Obj Sets} (h : Hom Sets a Bool) (m : Hom Sets b a) (mono : Mono Sets m) (x : a) → true ≡ h x
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 999
diff changeset
147 uniq {a} {b} h m mono x = begin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 999
diff changeset
148 true ≡⟨⟩
1016
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1010
diff changeset
149 (λ × → true ) x ≡⟨ cong (λ k → {!!} ) (sym (IsEqualizer.fe=ge (Equalizer.isEqualizer (tker h)) ) ) ⟩
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1010
diff changeset
150 {!!} ≡⟨ {!!} ⟩
1010
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 999
diff changeset
151 h x ∎ where
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 999
diff changeset
152 open ≡-Reasoning
1016
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1010
diff changeset
153 yy : Sets [ (λ e → {!!} ) ≈ (λ e → true) ]
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1010
diff changeset
154 yy = IsEqualizer.fe=ge (Equalizer.isEqualizer (tker h))
1010
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 999
diff changeset
155 yyy : {c : Obj Sets } → (f g : c → b ) → Sets [ Sets [ m o f ] ≈ Sets [ m o g ] ] → f ≡ g
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 999
diff changeset
156 yyy f g eq = Mono.isMono mono f g eq
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 999
diff changeset
157 yyy1 : {c : Obj Sets } → (f g : c → b ) → Sets [ Sets [ m o f ] ≈ Sets [ m o g ] ] → f ≡ g
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 999
diff changeset
158 yyy1 f g eq = Mono.isMono mono f g eq
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 999
diff changeset
159
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 999
diff changeset
160
999
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
161
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
162 open import graph
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
163 module ccc-from-graph {c₁ c₂ : Level } (G : Graph {c₁} {c₂}) where
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
164
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
165 open import Relation.Binary.PropositionalEquality renaming ( cong to ≡-cong ) hiding ( [_] )
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
166 open Graph
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
167
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
168 V = vertex G
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
169 E : V → V → Set c₂
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
170 E = edge G
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
171
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
172 data Objs : Set c₁ where
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
173 atom : V → Objs
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
174 ⊤ : Objs
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
175 _∧_ : Objs → Objs → Objs
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
176 _<=_ : Objs → Objs → Objs
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
177
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
178 data Arrows : (b c : Objs ) → Set (c₁ ⊔ c₂)
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
179 data Arrow : Objs → Objs → Set (c₁ ⊔ c₂) where --- case i
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
180 arrow : {a b : V} → E a b → Arrow (atom a) (atom b)
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
181 π : {a b : Objs } → Arrow ( a ∧ b ) a
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
182 π' : {a b : Objs } → Arrow ( a ∧ b ) b
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
183 ε : {a b : Objs } → Arrow ((a <= b) ∧ b ) a
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
184 _* : {a b c : Objs } → Arrows (c ∧ b ) a → Arrow c ( a <= b ) --- case v
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
185
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
186 data Arrows where
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
187 id : ( a : Objs ) → Arrows a a --- case i
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
188 ○ : ( a : Objs ) → Arrows a ⊤ --- case i
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
189 <_,_> : {a b c : Objs } → Arrows c a → Arrows c b → Arrows c (a ∧ b) -- case iii
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
190 iv : {b c d : Objs } ( f : Arrow d c ) ( g : Arrows b d ) → Arrows b c -- cas iv
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
191
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
192 _・_ : {a b c : Objs } (f : Arrows b c ) → (g : Arrows a b) → Arrows a c
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
193 id a ・ g = g
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
194 ○ a ・ g = ○ _
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
195 < f , g > ・ h = < f ・ h , g ・ h >
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
196 iv f g ・ h = iv f ( g ・ h )
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
197
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
198
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
199 identityL : {A B : Objs} {f : Arrows A B} → (id B ・ f) ≡ f
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
200 identityL = refl
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
201
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
202 identityR : {A B : Objs} {f : Arrows A B} → (f ・ id A) ≡ f
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
203 identityR {a} {a} {id a} = refl
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
204 identityR {a} {⊤} {○ a} = refl
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
205 identityR {a} {_} {< f , f₁ >} = cong₂ (λ j k → < j , k > ) identityR identityR
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
206 identityR {a} {b} {iv f g} = cong (λ k → iv f k ) identityR
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
207
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
208 assoc≡ : {a b c d : Objs} (f : Arrows c d) (g : Arrows b c) (h : Arrows a b) →
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
209 (f ・ (g ・ h)) ≡ ((f ・ g) ・ h)
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
210 assoc≡ (id a) g h = refl
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
211 assoc≡ (○ a) g h = refl
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
212 assoc≡ < f , f₁ > g h = cong₂ (λ j k → < j , k > ) (assoc≡ f g h) (assoc≡ f₁ g h)
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
213 assoc≡ (iv f f1) g h = cong (λ k → iv f k ) ( assoc≡ f1 g h )
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
214
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
215 -- positive intutionistic calculus
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
216 PL : Category c₁ (c₁ ⊔ c₂) (c₁ ⊔ c₂)
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
217 PL = record {
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
218 Obj = Objs;
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
219 Hom = λ a b → Arrows a b ;
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
220 _o_ = λ{a} {b} {c} x y → x ・ y ;
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
221 _≈_ = λ x y → x ≡ y ;
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
222 Id = λ{a} → id a ;
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
223 isCategory = record {
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
224 isEquivalence = record {refl = refl ; trans = trans ; sym = sym} ;
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
225 identityL = λ {a b f} → identityL {a} {b} {f} ;
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
226 identityR = λ {a b f} → identityR {a} {b} {f} ;
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
227 o-resp-≈ = λ {a b c f g h i} → o-resp-≈ {a} {b} {c} {f} {g} {h} {i} ;
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
228 associative = λ{a b c d f g h } → assoc≡ f g h
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
229 }
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
230 } where
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
231 o-resp-≈ : {A B C : Objs} {f g : Arrows A B} {h i : Arrows B C} →
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
232 f ≡ g → h ≡ i → (h ・ f) ≡ (i ・ g)
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
233 o-resp-≈ refl refl = refl
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
234 --------
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
235 --
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
236 -- Functor from Positive Logic to Sets
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
237 --
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
238
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
239 -- open import Category.Sets
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
240 -- postulate extensionality : { c₁ c₂ ℓ : Level} ( A : Category c₁ c₂ ℓ ) → Relation.Binary.PropositionalEquality.Extensionalit y c₂ c₂
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
241
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
242 open import Data.List
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
243
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
244 C = graphtocat.Chain G
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
245
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
246 tr : {a b : vertex G} → edge G a b → ((y : vertex G) → C y a) → (y : vertex G) → C y b
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
247 tr f x y = graphtocat.next f (x y)
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
248
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
249 fobj : ( a : Objs ) → Set (c₁ ⊔ c₂)
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
250 fobj (atom x) = ( y : vertex G ) → C y x
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
251 fobj ⊤ = One
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
252 fobj (a ∧ b) = ( fobj a /\ fobj b)
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
253 fobj (a <= b) = fobj b → fobj a
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
254
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
255 fmap : { a b : Objs } → Hom PL a b → fobj a → fobj b
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
256 amap : { a b : Objs } → Arrow a b → fobj a → fobj b
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
257 amap (arrow x) y = tr x y -- tr x
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
258 amap π ( x , y ) = x
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
259 amap π' ( x , y ) = y
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
260 amap ε (f , x ) = f x
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
261 amap (f *) x = λ y → fmap f ( x , y )
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
262 fmap (id a) x = x
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
263 fmap (○ a) x = OneObj
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
264 fmap < f , g > x = ( fmap f x , fmap g x )
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
265 fmap (iv x f) a = amap x ( fmap f a )
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
266
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
267 -- CS is a map from Positive logic to Sets
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
268 -- Sets is CCC, so we have a cartesian closed category generated by a graph
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
269 -- as a sub category of Sets
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
270
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
271 CS : Functor PL (Sets {c₁ ⊔ c₂})
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
272 FObj CS a = fobj a
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
273 FMap CS {a} {b} f = fmap {a} {b} f
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
274 isFunctor CS = isf where
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
275 _+_ = Category._o_ PL
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
276 ++idR = IsCategory.identityR ( Category.isCategory PL )
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
277 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)
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
278 distr {a} {a₁} {a₁} {f} {id a₁} z = refl
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
279 distr {a} {a₁} {⊤} {f} {○ a₁} z = refl
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
280 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)
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
281 distr {a} {b} {c} {f} {iv {_} {_} {d} x g} z = adistr (distr {a} {b} {d} {f} {g} z) x where
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
282 adistr : fmap (g + f) z ≡ fmap g (fmap f z) →
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
283 ( x : Arrow d c ) → fmap ( iv x (g + f) ) z ≡ fmap ( iv x g ) (fmap f z )
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
284 adistr eq x = cong ( λ k → amap x k ) eq
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
285 isf : IsFunctor PL Sets fobj fmap
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
286 IsFunctor.identity isf = extensionality Sets ( λ x → refl )
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
287 IsFunctor.≈-cong isf refl = refl
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
288 IsFunctor.distr isf {a} {b} {c} {g} {f} = extensionality Sets ( λ z → distr {a} {b} {c} {g} {f} z )
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
289
d89f2c8cf0f4 separate CCCSets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
290