Mercurial > hg > Members > kono > Proof > category
annotate src/SetsCompleteness.agda @ 1124:f683d96fbc93 default tip
safe fix done
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 07 Jul 2024 22:28:50 +0900 |
parents | 5620d4a85069 |
children |
rev | line source |
---|---|
1115
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
1 {-# OPTIONS --cubical-compatible --safe #-} |
1110
45de2b31bf02
add original library and fix for safe mode
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1034
diff
changeset
|
2 |
606 | 3 open import Category -- https://github.com/konn/category-agda |
500
6c993c1fe9de
try to make prodcut and equalizer in Sets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
4 open import Level |
1115
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
5 open import Category.Sets |
500
6c993c1fe9de
try to make prodcut and equalizer in Sets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
6 |
6c993c1fe9de
try to make prodcut and equalizer in Sets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
7 module SetsCompleteness where |
6c993c1fe9de
try to make prodcut and equalizer in Sets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
8 |
1110
45de2b31bf02
add original library and fix for safe mode
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1034
diff
changeset
|
9 open import Definitions |
500
6c993c1fe9de
try to make prodcut and equalizer in Sets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
10 open import Relation.Binary.Core |
6c993c1fe9de
try to make prodcut and equalizer in Sets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
11 open import Function |
510
5eb4b69bf541
equalizer in Sets , uniquness remains
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
509
diff
changeset
|
12 import Relation.Binary.PropositionalEquality |
5eb4b69bf541
equalizer in Sets , uniquness remains
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
509
diff
changeset
|
13 |
781 | 14 open import Relation.Binary.PropositionalEquality hiding ( [_] ) |
15 | |
604 | 16 lemma1 : { c₂ : Level } {a b : Obj (Sets { c₂})} {f g : Hom Sets a b} → |
524 | 17 Sets [ f ≈ g ] → (x : a ) → f x ≡ g x |
1115
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
18 lemma1 eq x = eq x |
503 | 19 |
504 | 20 record Σ {a} (A : Set a) (B : Set a) : Set a where |
503 | 21 constructor _,_ |
22 field | |
23 proj₁ : A | |
606 | 24 proj₂ : B |
503 | 25 |
26 open Σ public | |
500
6c993c1fe9de
try to make prodcut and equalizer in Sets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
27 |
6c993c1fe9de
try to make prodcut and equalizer in Sets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
28 |
681
bd8f7346f252
fix Product and pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
29 SetsProduct : { c₂ : Level} → ( a b : Obj (Sets {c₂})) → Product ( Sets { c₂} ) a b |
bd8f7346f252
fix Product and pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
30 SetsProduct { c₂ } a b = record { |
bd8f7346f252
fix Product and pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
31 product = Σ a b |
bd8f7346f252
fix Product and pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
32 ; π1 = λ ab → (proj₁ ab) |
bd8f7346f252
fix Product and pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
33 ; π2 = λ ab → (proj₂ ab) |
bd8f7346f252
fix Product and pullback
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
34 ; isProduct = record { |
606 | 35 _×_ = λ f g x → record { proj₁ = f x ; proj₂ = g x } -- ( f x , g x ) |
1115
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
36 ; π1fxg=f = λ {c} {f} {g} x → refl |
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
37 ; π2fxg=g = λ {c} {f} {g} x → refl |
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
38 ; uniqueness = λ {c} {h} x → refl |
500
6c993c1fe9de
try to make prodcut and equalizer in Sets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
39 ; ×-cong = λ {c} {f} {f'} {g} {g'} f=f g=g → prod-cong a b f=f g=g |
6c993c1fe9de
try to make prodcut and equalizer in Sets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
40 } |
6c993c1fe9de
try to make prodcut and equalizer in Sets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
41 } where |
6c993c1fe9de
try to make prodcut and equalizer in Sets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
42 prod-cong : ( a b : Obj (Sets {c₂}) ) {c : Obj (Sets {c₂}) } {f f' : Hom Sets c a } {g g' : Hom Sets c b } |
6c993c1fe9de
try to make prodcut and equalizer in Sets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
43 → Sets [ f ≈ f' ] → Sets [ g ≈ g' ] |
6c993c1fe9de
try to make prodcut and equalizer in Sets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
44 → Sets [ (λ x → f x , g x) ≈ (λ x → f' x , g' x) ] |
1115
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
45 prod-cong a b {c} {f} {f1} {g} {g1} eq eq1 x = cong₂ (λ j k → j , k) (eq x) (eq1 x) |
500
6c993c1fe9de
try to make prodcut and equalizer in Sets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
46 |
6c993c1fe9de
try to make prodcut and equalizer in Sets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
47 |
604 | 48 record iproduct {a} (I : Set a) ( pi0 : I → Set a ) : Set a where |
508
3ce21b2a671a
IProduct is written in Sets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
507
diff
changeset
|
49 field |
604 | 50 pi1 : ( i : I ) → pi0 i |
508
3ce21b2a671a
IProduct is written in Sets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
507
diff
changeset
|
51 |
604 | 52 open iproduct |
574 | 53 |
986 | 54 open Small |
55 | |
1115
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
56 open import Axiom.Extensionality.Propositional |
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
57 |
606 | 58 SetsIProduct : { c₂ : Level} → (I : Obj Sets) (ai : I → Obj Sets ) |
1124 | 59 → Extensionality c₂ c₂ -- cannot avoid this here |
691
917e51be9bbf
change argument of Limit and K
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
681
diff
changeset
|
60 → IProduct I ( Sets { c₂} ) ai |
1115
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
61 SetsIProduct {c₂} I fi ext = record { |
673
0007f9a25e9c
fix limit from product and equalizer (not yet finished )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
62 iprod = iproduct I fi |
604 | 63 ; pi = λ i prod → pi1 prod i |
509 | 64 ; isIProduct = record { |
604 | 65 iproduct = iproduct1 |
676 | 66 ; pif=q = λ {q} {qi} {i} → pif=q {q} {qi} {i} |
509 | 67 ; ip-uniqueness = ip-uniqueness |
604 | 68 ; ip-cong = ip-cong |
509 | 69 } |
70 } where | |
604 | 71 iproduct1 : {q : Obj Sets} → ((i : I) → Hom Sets q (fi i)) → Hom Sets q (iproduct I fi) |
72 iproduct1 {q} qi x = record { pi1 = λ i → (qi i) x } | |
676 | 73 pif=q : {q : Obj Sets} {qi : (i : I) → Hom Sets q (fi i)} → {i : I} → Sets [ Sets [ (λ prod → pi1 prod i) o iproduct1 qi ] ≈ qi i ] |
1115
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
74 pif=q {q} {qi} {i} x = refl |
604 | 75 ip-uniqueness : {q : Obj Sets} {h : Hom Sets q (iproduct I fi)} → Sets [ iproduct1 (λ i → Sets [ (λ prod → pi1 prod i) o h ]) ≈ h ] |
1115
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
76 ip-uniqueness {q} {h} x = refl |
604 | 77 ipcx : {q : Obj Sets} {qi qi' : (i : I) → Hom Sets q (fi i)} → ((i : I) → Sets [ qi i ≈ qi' i ]) → (x : q) → iproduct1 qi x ≡ iproduct1 qi' x |
606 | 78 ipcx {q} {qi} {qi'} qi=qi x = |
604 | 79 begin |
80 record { pi1 = λ i → (qi i) x } | |
1115
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
81 ≡⟨ cong (λ k → record { pi1 = k} ) (ext (λ i → qi=qi i x) ) ⟩ |
604 | 82 record { pi1 = λ i → (qi' i) x } |
83 ∎ where | |
606 | 84 open import Relation.Binary.PropositionalEquality |
85 open ≡-Reasoning | |
604 | 86 ip-cong : {q : Obj Sets} {qi qi' : (i : I) → Hom Sets q (fi i)} → ((i : I) → Sets [ qi i ≈ qi' i ]) → Sets [ iproduct1 qi ≈ iproduct1 qi' ] |
1115
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
87 ip-cong {q} {qi} {qi'} qi=qi = ipcx qi=qi |
509 | 88 |
986 | 89 data coproduct {c} (a b : Set c) : Set c where |
90 k1 : ( i : a ) → coproduct a b | |
91 k2 : ( i : b ) → coproduct a b | |
92 | |
93 SetsCoProduct : { c₂ : Level} → (a b : Obj (Sets {c₂})) → coProduct Sets a b | |
94 SetsCoProduct a b = record { | |
95 coproduct = coproduct a b | |
96 ; κ1 = λ i → k1 i | |
97 ; κ2 = λ i → k2 i | |
98 ; isProduct = record { | |
99 _+_ = sum | |
1115
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
100 ; κ1f+g=f = λ {c} {f} {g} x → fk1 {c} {f} {g} x |
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
101 ; κ2f+g=g = λ {c} {f} {g} x → fk2 {c} {f} {g} x |
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
102 ; uniqueness = λ {c} {h} x → uniq {c} {h} x |
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
103 ; +-cong = pccong |
986 | 104 } |
105 } where | |
106 sum : {c : Obj Sets} → Hom Sets a c → Hom Sets b c → Hom Sets (coproduct a b ) c | |
107 sum {c} f g (k1 i) = f i | |
108 sum {c} f g (k2 i) = g i | |
109 uniq : {c : Obj Sets} {h : Hom Sets (coproduct a b) c} → (x : coproduct a b ) → sum (Sets [ h o (λ i → k1 i) ]) (Sets [ h o (λ i → k2 i) ]) x ≡ h x | |
110 uniq {c} {h} (k1 i) = refl | |
111 uniq {c} {h} (k2 i) = refl | |
1115
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
112 pccong : {c : Obj Sets} {f f' : Hom Sets a c} {g g' : Hom Sets b c} → Sets [ f ≈ f' ] → Sets [ g ≈ g' ] → Sets [ sum f g ≈ sum f' g' ] |
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
113 pccong {c} {f} {f'} {g} {g'} eq eq1 (k1 i) = eq i |
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
114 pccong {c} {f} {f'} {g} {g'} eq eq1 (k2 i) = eq1 i |
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
115 fk1 : {c : Obj Sets} {f : Hom Sets a c} {g : Hom Sets b c} → Sets [ Sets [ sum f g o (λ i → k1 i) ] ≈ f ] |
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
116 fk1 {c} {f} {g} x = refl |
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
117 fk2 : {c : Obj Sets} {f : Hom Sets a c} {g : Hom Sets b c} → Sets [ Sets [ sum f g o (λ i → k2 i) ] ≈ g ] |
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
118 fk2 {c} {f} {g} x = refl |
986 | 119 |
120 | |
121 data icoproduct {a} (I : Set a) (ki : I → Set a) : Set a where | |
122 ki1 : (i : I) (x : ki i ) → icoproduct I ki | |
123 | |
124 SetsICoProduct : { c₂ : Level} → (I : Obj (Sets {c₂})) (ci : I → Obj Sets ) | |
125 → ICoProduct I ( Sets { c₂} ) ci | |
126 SetsICoProduct I fi = record { | |
127 icoprod = icoproduct I fi | |
128 ; ki = λ i x → ki1 i x | |
129 ; isICoProduct = record { | |
130 icoproduct = isum | |
131 ; kif=q = λ {q} {qi} {i} → kif=q {q} {qi} {i} | |
132 ; icp-uniqueness = uniq | |
133 ; icp-cong = iccong | |
134 } | |
135 } where | |
136 isum : {q : Obj Sets} → ((i : I) → Hom Sets (fi i) q) → Hom Sets (icoproduct I fi) q | |
137 isum {q} fi (ki1 i x) = fi i x | |
138 kif=q : {q : Obj Sets} {qi : (i : I) → Hom Sets (fi i) q} {i : I} → Sets [ Sets [ isum qi o (λ x → ki1 i x) ] ≈ qi i ] | |
1115
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
139 kif=q {q} {qi} {i} x = refl |
986 | 140 uniq : {q : Obj Sets} {h : Hom Sets (icoproduct I fi) q} → Sets [ isum (λ i → Sets [ h o (λ x → ki1 i x) ]) ≈ h ] |
1115
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
141 uniq {q} {h} = u1 where |
986 | 142 u1 : (x : icoproduct I fi ) → isum (λ i → Sets [ h o (λ x₁ → ki1 i x₁) ]) x ≡ h x |
143 u1 (ki1 i x) = refl | |
144 iccong : {q : Obj Sets} {qi qi' : (i : I) → Hom Sets (fi i) q} → ((i : I) → Sets [ qi i ≈ qi' i ]) → Sets [ isum qi ≈ isum qi' ] | |
1115
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
145 iccong {q} {qi} {qi'} ieq = u2 where |
986 | 146 u2 : (x : icoproduct I fi ) → isum qi x ≡ isum qi' x |
1115
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
147 u2 (ki1 i x) = ieq i x |
509 | 148 |
510
5eb4b69bf541
equalizer in Sets , uniquness remains
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
509
diff
changeset
|
149 -- |
5eb4b69bf541
equalizer in Sets , uniquness remains
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
509
diff
changeset
|
150 -- e f |
606 | 151 -- c -------→ a ---------→ b f ( f' |
604 | 152 -- ^ . ---------→ |
510
5eb4b69bf541
equalizer in Sets , uniquness remains
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
509
diff
changeset
|
153 -- | . g |
5eb4b69bf541
equalizer in Sets , uniquness remains
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
509
diff
changeset
|
154 -- |k . |
5eb4b69bf541
equalizer in Sets , uniquness remains
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
509
diff
changeset
|
155 -- | . h |
604 | 156 --y : d |
509 | 157 |
522
8fd030f9f572
Equalizer in Sets done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
521
diff
changeset
|
158 -- cf. https://github.com/danr/Agda-projects/blob/master/Category-Theory/Equalizer.agda |
508
3ce21b2a671a
IProduct is written in Sets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
507
diff
changeset
|
159 |
510
5eb4b69bf541
equalizer in Sets , uniquness remains
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
509
diff
changeset
|
160 data sequ {c : Level} (A B : Set c) ( f g : A → B ) : Set c where |
5eb4b69bf541
equalizer in Sets , uniquness remains
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
509
diff
changeset
|
161 elem : (x : A ) → (eq : f x ≡ g x) → sequ A B f g |
5eb4b69bf541
equalizer in Sets , uniquness remains
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
509
diff
changeset
|
162 |
532
d5d7163f2a1d
equalizer does not fit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
531
diff
changeset
|
163 equ : { c₂ : Level} {a b : Obj (Sets {c₂}) } { f g : Hom (Sets {c₂}) a b } → ( sequ a b f g ) → a |
606 | 164 equ (elem x eq) = x |
532
d5d7163f2a1d
equalizer does not fit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
531
diff
changeset
|
165 |
606 | 166 fe=ge0 : { c₂ : Level} {a b : Obj (Sets {c₂}) } { f g : Hom (Sets {c₂}) a b } → |
533 | 167 (x : sequ a b f g) → (Sets [ f o (λ e → equ e) ]) x ≡ (Sets [ g o (λ e → equ e) ]) x |
168 fe=ge0 (elem x eq ) = eq | |
169 | |
1115
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
170 -- we need -with-K to prove this |
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
171 --- ≡-irr : { c₂ : Level} {d : Set c₂ } { x y : d } ( eq eq' : x ≡ y ) → eq ≡ eq' |
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
172 |
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
173 equ-inject : { c₂ : Level} {a b : Set c₂} |
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
174 (≡-irr : { c₂ : Level} {d : Set c₂ } { x y : d } ( eq eq' : x ≡ y ) → eq ≡ eq') |
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
175 {f g : Hom (Sets {c₂}) a b} (x y : sequ a b f g) → equ x ≡ equ y → x ≡ y |
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
176 equ-inject ≡-irr ( elem x eq ) (elem .x eq' ) refl = cong (λ k → elem x k ) (≡-irr eq eq' ) |
541 | 177 |
510
5eb4b69bf541
equalizer in Sets , uniquness remains
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
509
diff
changeset
|
178 open sequ |
5eb4b69bf541
equalizer in Sets , uniquness remains
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
509
diff
changeset
|
179 |
532
d5d7163f2a1d
equalizer does not fit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
531
diff
changeset
|
180 -- equalizer-c = sequ a b f g |
d5d7163f2a1d
equalizer does not fit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
531
diff
changeset
|
181 -- ; equalizer = λ e → equ e |
d5d7163f2a1d
equalizer does not fit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
531
diff
changeset
|
182 |
1115
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
183 open import Relation.Binary.PropositionalEquality |
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
184 |
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
185 SetsIsEqualizer : { c₂ : Level} |
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
186 (≡-irr : { c₂ : Level} {d : Set c₂ } { x y : d } ( eq eq' : x ≡ y ) → eq ≡ eq') |
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
187 → (a b : Obj (Sets {c₂}) ) (f g : Hom (Sets {c₂}) a b) → IsEqualizer Sets (λ e → equ e) f g |
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
188 SetsIsEqualizer {c₂} ≡-irr a b f g = record { |
604 | 189 fe=ge = fe=ge |
190 ; k = k | |
191 ; ek=h = λ {d} {h} {eq} → ek=h {d} {h} {eq} | |
510
5eb4b69bf541
equalizer in Sets , uniquness remains
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
509
diff
changeset
|
192 ; uniqueness = uniqueness |
5eb4b69bf541
equalizer in Sets , uniquness remains
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
509
diff
changeset
|
193 } where |
604 | 194 fe=ge : Sets [ Sets [ f o (λ e → equ e ) ] ≈ Sets [ g o (λ e → equ e ) ] ] |
1115
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
195 fe=ge (elem x eq) = eq |
604 | 196 k : {d : Obj Sets} (h : Hom Sets d a) → Sets [ Sets [ f o h ] ≈ Sets [ g o h ] ] → Hom Sets d (sequ a b f g) |
1115
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
197 k {d} h eq x = elem (h x) (eq x) |
604 | 198 ek=h : {d : Obj Sets} {h : Hom Sets d a} {eq : Sets [ Sets [ f o h ] ≈ Sets [ g o h ] ]} → Sets [ Sets [ (λ e → equ e ) o k h eq ] ≈ h ] |
1115
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
199 ek=h {d} {h} {eq} x = refl |
523 | 200 injection : { c₂ : Level } {a b : Obj (Sets { c₂})} (f : Hom Sets a b) → Set c₂ |
201 injection f = ∀ x y → f x ≡ f y → x ≡ y | |
512 | 202 uniqueness : {d : Obj Sets} {h : Hom Sets d a} {fh=gh : Sets [ Sets [ f o h ] ≈ Sets [ g o h ] ]} {k' : Hom Sets d (sequ a b f g)} → |
203 Sets [ Sets [ (λ e → equ e) o k' ] ≈ h ] → Sets [ k h fh=gh ≈ k' ] | |
1115
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
204 uniqueness {d} {h} {fh=gh} {k'} ek'=h x = equ-inject ≡-irr _ _ ( begin |
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
205 equ ( k h fh=gh x) ≡⟨⟩ |
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
206 h x ≡⟨ sym ( ek'=h x) ⟩ |
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
207 equ (k' x) ∎ ) where open ≡-Reasoning |
999 | 208 |
1009 | 209 -- -- we have to make this Level c, that is {B : Set c} → (A → B) is iso to I : Set c |
210 -- record cequ {c : Level} (A B : Set c) : Set (suc c) where | |
211 -- field | |
212 -- rev : {B : Set c} → (A → B) → B → A | |
213 -- surjective : {B : Set c } (x : B ) → (g : A → B) → g (rev g x) ≡ x | |
999 | 214 |
1009 | 215 -- -- λ f₁ x y → (λ x₁ → x (f₁ x₁)) ≡ (λ x₁ → y (f₁ x₁)) → x ≡ y |
216 -- -- λ x y → (λ x₁ → x x₁ ≡ y x₁) → x ≡ y | |
217 -- -- Y / R | |
218 | |
219 -- open import HomReasoning | |
986 | 220 |
1115
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
221 -- SetsIsCoEqualizer : { c₂ : Level} → (a b : Obj (Sets {c₂}) ) (f g : Hom (Sets {c₂}) a b) |
1009 | 222 -- → IsCoEqualizer Sets (λ x → {!!} ) f g |
1115
5620d4a85069
safe rewriting nearly finished
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1112
diff
changeset
|
223 -- SetsIsCoEqualizer {c₂} a b f g = record { |
1009 | 224 -- ef=eg = extensionality Sets (λ x → {!!} ) |
225 -- ; k = {!!} | |
226 -- ; ke=h = λ {d} {h} {eq} → ke=h {d} {h} {eq} | |
227 -- ; uniqueness = {!!} | |
228 -- } where | |
229 -- c : Set c₂ | |
230 -- c = {!!} --cequ a b | |
231 -- d : cequ a b | |
232 -- d = {!!} | |
233 -- ef=eg : Sets [ Sets [ cequ.rev d f o f ] ≈ Sets [ cequ.rev d g o g ] ] | |
234 -- ef=eg = begin | |
235 -- Sets [ cequ.rev d f o f ] ≈↑⟨ idL ⟩ | |
236 -- Sets [ id1 Sets _ o Sets [ cequ.rev d f o f ] ] ≈↑⟨ assoc ⟩ | |
237 -- Sets [ Sets [ id1 Sets _ o cequ.rev d f ] o f ] ≈⟨ {!!} ⟩ | |
238 -- Sets [ Sets [ id1 Sets _ o cequ.rev d (id1 Sets _) ] o {!!} ] ≈⟨ car ( extensionality Sets (λ x → cequ.surjective d {!!} {!!} )) ⟩ | |
239 -- Sets [ {!!} o f ] ≈⟨ {!!} ⟩ | |
240 -- Sets [ id1 Sets _ o Sets [ cequ.rev d g o g ] ] ≈⟨ idL ⟩ | |
241 -- Sets [ cequ.rev d g o g ] ∎ where open ≈-Reasoning Sets | |
242 -- epi : { c₂ : Level } {a b c : Obj (Sets { c₂})} (e : Hom Sets b c ) → (f g : Hom Sets a b) → Set c₂ | |
243 -- epi e f g = Sets [ Sets [ e o f ] ≈ Sets [ e o g ] ] → Sets [ f ≈ g ] | |
244 -- k : {d : Obj Sets} (h : Hom Sets b d) → Sets [ Sets [ h o f ] ≈ Sets [ h o g ] ] → Hom Sets c d | |
245 -- k {d} h hf=hg = {!!} where | |
246 -- ca : Sets [ Sets [ h o f ] ≈ Sets [ h o g ] ] → a -- (λ x → h (f x)) ≡ (λ x → h (g x)) | |
247 -- ca eq = {!!} | |
248 -- cd : ( {y : a} → f y ≡ g y → sequ a b f g ) → d | |
249 -- cd = {!!} | |
250 -- ke=h : {d : Obj Sets } {h : Hom Sets b d } → { eq : Sets [ Sets [ h o f ] ≈ Sets [ h o g ] ] } | |
251 -- → Sets [ Sets [ k h eq o {!!} ] ≈ h ] | |
252 -- ke=h {d} {h} {eq} = extensionality Sets ( λ x → begin | |
253 -- k h eq ( {!!}) ≡⟨ {!!} ⟩ | |
254 -- h (f {!!}) ≡⟨ {!!} ⟩ | |
255 -- h (g {!!}) ≡⟨ {!!} ⟩ | |
256 -- h x | |
257 -- ∎ ) where | |
258 -- open import Relation.Binary.PropositionalEquality | |
259 -- open ≡-Reasoning | |
997 | 260 |
500
6c993c1fe9de
try to make prodcut and equalizer in Sets
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
261 |