Mercurial > hg > Members > kono > Proof > category
annotate limit-to.agda @ 404:07bea66e5ceb
...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 20 Mar 2016 12:32:13 +0900 |
parents | 375edfefbf6a |
children | 4c34c0e3c4bb |
rev | line source |
---|---|
350 | 1 open import Category -- https://github.com/konn/category-agda |
2 open import Level | |
3 | |
403 | 4 module limit-to where |
350 | 5 |
6 open import cat-utility | |
7 open import HomReasoning | |
8 open import Relation.Binary.Core | |
401
e4c10d6375f6
Maybe Category to-limit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
400
diff
changeset
|
9 open import Data.Maybe |
350 | 10 open Functor |
11 | |
12 | |
401
e4c10d6375f6
Maybe Category to-limit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
400
diff
changeset
|
13 |
e4c10d6375f6
Maybe Category to-limit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
400
diff
changeset
|
14 |
350 | 15 -- If we have limit then we have equalizer |
16 --- two objects category | |
17 --- | |
18 --- f | |
19 --- ------> | |
20 --- 0 1 | |
366 | 21 --- ------> |
22 --- g | |
387 | 23 |
350 | 24 |
355
8fd085379380
add DataCategory Universal mapping
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
354
diff
changeset
|
25 |
385 | 26 data TwoObject {c₁ : Level} : Set c₁ where |
363 | 27 t0 : TwoObject |
28 t1 : TwoObject | |
359 | 29 |
385 | 30 data Arrow {ℓ : Level } : Set ℓ where |
377
2dfa2d59268c
associative in twocat dead end?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
376
diff
changeset
|
31 id-t0 : Arrow |
2dfa2d59268c
associative in twocat dead end?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
376
diff
changeset
|
32 arrow-f : Arrow |
2dfa2d59268c
associative in twocat dead end?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
376
diff
changeset
|
33 arrow-g : Arrow |
397
dd3fa0680897
inconsistent distribution law on nil x arrow-g
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
396
diff
changeset
|
34 nil : Arrow |
377
2dfa2d59268c
associative in twocat dead end?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
376
diff
changeset
|
35 |
403 | 36 record Two-Hom { c₁ c₂ : Level } (a : TwoObject { c₁} ) (b : TwoObject { c₁} ) : Set c₂ where |
377
2dfa2d59268c
associative in twocat dead end?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
376
diff
changeset
|
37 field |
404 | 38 hom : Maybe ( Arrow { c₂ } ) |
400 | 39 |
40 open Two-Hom | |
41 | |
403 | 42 Two-id : { c₁ c₂ : Level } -> (a : TwoObject {c₁} ) -> Two-Hom {c₁} { c₂} a a |
404 | 43 Two-id _ = record { hom = just id-t0 } |
377
2dfa2d59268c
associative in twocat dead end?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
376
diff
changeset
|
44 |
2dfa2d59268c
associative in twocat dead end?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
376
diff
changeset
|
45 -- arrow composition |
2dfa2d59268c
associative in twocat dead end?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
376
diff
changeset
|
46 |
404 | 47 twocomp : {c₁ c₂ : Level } -> { a b : TwoObject {c₁} } -> Arrow { c₂ } -> Arrow { c₂ } -> Maybe ( Arrow { c₂ } ) |
48 twocomp id-t0 f = just f | |
49 twocomp f id-t0 = just f | |
400 | 50 twocomp _ _ = nothing |
377
2dfa2d59268c
associative in twocat dead end?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
376
diff
changeset
|
51 |
403 | 52 _×_ : { c₁ c₂ : Level } -> {A B C : TwoObject { c₁} } → Two-Hom { c₁} {c₂} B C → Two-Hom { c₁} {c₂} A B → Two-Hom { c₁} {c₂} A C |
401
e4c10d6375f6
Maybe Category to-limit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
400
diff
changeset
|
53 _×_ { c₁} {ℓ} {a} {b} {c} f g with hom f | hom g |
e4c10d6375f6
Maybe Category to-limit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
400
diff
changeset
|
54 _×_ { c₁} {ℓ} {a} {b} {c} f g | nothing | _ = record { hom = nothing } |
e4c10d6375f6
Maybe Category to-limit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
400
diff
changeset
|
55 _×_ { c₁} {ℓ} {a} {b} {c} f g | _ | nothing = record { hom = nothing } |
404 | 56 _×_ { c₁} {ℓ} {a} {b} {c} _ _ | just f | just g = record { hom = twocomp { c₁} {ℓ} {a} {c} f g } |
57 | |
58 _==_ : {c₁ c₂ : Level } -> {a b : TwoObject {c₁} } -> Rel (Maybe (Arrow { c₂ })) c₂ | |
59 _==_ = Eq ( _≡_ ) | |
60 | |
61 open import Relation.Binary.PropositionalEquality | |
401
e4c10d6375f6
Maybe Category to-limit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
400
diff
changeset
|
62 |
404 | 63 ==-refl : { c₂ : Level } {x : Maybe ( Arrow { c₂ } ) } → x == x |
64 ==-refl {_} {just x} = just refl | |
65 ==-refl {_} {nothing} = nothing | |
66 | |
67 ==-sym : { c₂ : Level } {x y : Maybe ( Arrow { c₂ } ) } → x == y → y == x | |
68 ==-sym (just x≈y) = just (sym x≈y) | |
69 ==-sym nothing = nothing | |
70 | |
71 ==-trans : { c₂ : Level } -> {x y z : Maybe ( Arrow { c₂ } ) } → x == y → y == z → x == z | |
72 ==-trans (just x≈y) (just y≈z) = just (trans x≈y y≈z) | |
73 ==-trans nothing nothing = nothing | |
74 | |
75 | |
393 | 76 |
403 | 77 open import maybeCat |
78 | |
393 | 79 |
403 | 80 TwoCat : { c₁ c₂ ℓ : Level } -> Category c₁ c₂ c₂ |
385 | 81 TwoCat {c₁} {c₂} {ℓ} = record { |
82 Obj = TwoObject {c₁} ; | |
403 | 83 Hom = λ a b → Two-Hom {c₁ } { c₂} a b ; |
84 _o_ = _×_ { c₁} {c₂} ; | |
401
e4c10d6375f6
Maybe Category to-limit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
400
diff
changeset
|
85 _≈_ = λ a b → hom a == hom b ; |
377
2dfa2d59268c
associative in twocat dead end?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
376
diff
changeset
|
86 Id = \{a} -> Two-id a ; |
2dfa2d59268c
associative in twocat dead end?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
376
diff
changeset
|
87 isCategory = record { |
404 | 88 isEquivalence = record {refl = ==-refl ; trans = ==-trans ; sym = ==-sym } ; |
384 | 89 identityL = \{a b f} -> identityL {a} {b} {f} ; |
90 identityR = \{a b f} -> identityR {a} {b} {f} ; | |
379 | 91 o-resp-≈ = \{a b c f g h i} -> o-resp-≈ {a} {b} {c} {f} {g} {h} {i} ; |
381 | 92 associative = \{a b c d f g h } -> associative {a} {b} {c} {d} {f} {g} {h} |
377
2dfa2d59268c
associative in twocat dead end?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
376
diff
changeset
|
93 } |
2dfa2d59268c
associative in twocat dead end?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
376
diff
changeset
|
94 } where |
2dfa2d59268c
associative in twocat dead end?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
376
diff
changeset
|
95 ≡-cong = Relation.Binary.PropositionalEquality.cong |
401
e4c10d6375f6
Maybe Category to-limit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
400
diff
changeset
|
96 identityL : {A B : TwoObject} {f : Two-Hom A B} → hom ( Two-id B × f ) == hom f |
402 | 97 identityL {a} {b} {f} = {!!} |
401
e4c10d6375f6
Maybe Category to-limit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
400
diff
changeset
|
98 identityR : {A B : TwoObject} {f : Two-Hom A B} → hom ( f × Two-id A ) == hom f |
402 | 99 identityR {a} {b} {f} = {!!} |
383 | 100 o-resp-≈ : {A B C : TwoObject} {f g : Two-Hom A B} {h i : Two-Hom B C} → |
401
e4c10d6375f6
Maybe Category to-limit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
400
diff
changeset
|
101 hom f == hom g → hom h == hom i → hom ( h × f ) == hom ( i × g ) |
402 | 102 o-resp-≈ {a} {b} {c} {f} {g} {h} {i} f≡g h≡i = {!!} |
401
e4c10d6375f6
Maybe Category to-limit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
400
diff
changeset
|
103 associative : {A B C D : TwoObject} {f : Two-Hom C D} {g : Two-Hom B C} {h : Two-Hom A B} → hom ( f × (g × h) ) == hom ( (f × g) × h ) |
402 | 104 associative {_} {_} {_} {_} {f} {g} {h} = {!!} |
393 | 105 |
403 | 106 indexFunctor : {c₁ c₂ ℓ : Level} (A : Category c₁ c₂ ℓ) ( a b : Obj (MaybeCat A )) ( f g : Hom A a b ) -> Functor (TwoCat {c₁} {c₂} {c₂} ) (MaybeCat A ) |
107 indexFunctor {c₁} {c₂} {ℓ} A a b f g = record { | |
385 | 108 FObj = λ a → fobj a |
366 | 109 ; FMap = λ f → fmap f |
110 ; isFunctor = record { | |
374
5641b923201e
limit-to: indexFunctor distribution law cannot be proved
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
111 identity = \{x} -> identity {x} |
388 | 112 ; distr = \ {a} {b} {c} {f} {g} -> distr1 {a} {b} {c} {f} {g} |
396 | 113 ; ≈-cong = \ {a} {b} {c} {f} -> ≈-cong {a} {b} {c} {f} |
366 | 114 } |
115 } where | |
388 | 116 I = TwoCat {c₁} {c₂} {ℓ} |
402 | 117 MA = MaybeCat A |
404 | 118 open ≈-Reasoning (MA) |
388 | 119 fobj : Obj I -> Obj A |
385 | 120 fobj t0 = a |
121 fobj t1 = b | |
403 | 122 fmap1 : {x y : Obj I } -> (Arrow {c₂} ) -> Hom MA (fobj x) (fobj y) |
401
e4c10d6375f6
Maybe Category to-limit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
400
diff
changeset
|
123 fmap1 {t0} {t1} arrow-f = record { hom = just f } |
404 | 124 fmap1 {t0} {t1} arrow-g = record { hom = just g } |
401
e4c10d6375f6
Maybe Category to-limit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
400
diff
changeset
|
125 fmap1 {t0} {t0} id-t0 = record { hom = just ( id1 A a )} |
e4c10d6375f6
Maybe Category to-limit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
400
diff
changeset
|
126 fmap1 {t1} {t1} id-t0 = record { hom = just ( id1 A b )} |
e4c10d6375f6
Maybe Category to-limit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
400
diff
changeset
|
127 fmap1 {_} {_} _ = record { hom = nothing } |
402 | 128 fmap : {x y : Obj I } -> Hom I x y -> Hom MA (fobj x) (fobj y) |
401
e4c10d6375f6
Maybe Category to-limit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
400
diff
changeset
|
129 fmap {x} {y} f with ( hom f ) |
e4c10d6375f6
Maybe Category to-limit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
400
diff
changeset
|
130 fmap {x} {y} f | nothing = record { hom = nothing } |
404 | 131 fmap {x} {y} _ | just f = fmap1 {x} {y} f |
388 | 132 open ≈-Reasoning (A) |
404 | 133 identity : {x : Obj I} → {!!} |
402 | 134 identity {t0} = {!!} |
135 identity {t1} = {!!} | |
404 | 136 distr1 : {a₁ : Obj I} {b₁ : Obj I} {c : Obj I} {f₁ : Hom I a₁ b₁} {g₁ : Hom I b₁ c} → {!!} |
402 | 137 distr1 {a1} {b1} {c} {f1} {g1} = {!!} |
404 | 138 ≈-cong : {a : Obj I} {b : Obj I} {f g : Hom I a b} → _[_≈_] I f g → {!!} |
402 | 139 ≈-cong {_} {_} {f1} {g1} f≈g = {!!} |
388 | 140 |
365 | 141 |
387 | 142 --- Equalizer |
143 --- f | |
144 --- e ------> | |
145 --- c ------> a b | |
146 --- ^ / ------> | |
147 --- |k h g | |
148 --- | / | |
149 --- | / | |
150 --- | / | |
151 --- |/ | |
152 --- d | |
153 | |
350 | 154 open Limit |
352 | 155 |
403 | 156 lim-to-equ : {c₁ c₂ ℓ : Level} (A : Category c₁ c₂ ℓ) -> |
364 | 157 (lim : (I : Category c₁ c₂ ℓ) ( Γ : Functor I A ) → { a0 : Obj A } { u : NTrans I A ( K A I a0 ) Γ } → Limit A I Γ a0 u ) -- completeness |
401
e4c10d6375f6
Maybe Category to-limit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
400
diff
changeset
|
158 → {a b c : Obj A} (f g : Hom A a b ) |
365 | 159 → (e : Hom A c a ) → (fe=ge : A [ A [ f o e ] ≈ A [ g o e ] ] ) → Equalizer A e f g |
403 | 160 lim-to-equ {c₁} {c₂} {ℓ } A lim {a} {b} {c} f g e fe=ge = record { |
350 | 161 fe=ge = fe=ge |
162 ; k = λ {d} h fh=gh → k {d} h fh=gh | |
373 | 163 ; ek=h = λ {d} {h} {fh=gh} → ek=h d h fh=gh |
164 ; uniqueness = λ {d} {h} {fh=gh} {k'} → uniquness d h fh=gh k' | |
350 | 165 } where |
388 | 166 I = TwoCat {c₁} {c₂} {ℓ } |
402 | 167 Γ = {!!} |
375 | 168 nmap : (x : Obj I) ( d : Obj A ) (h : Hom A d a ) -> Hom A (FObj (K A I d) x) (FObj Γ x) |
385 | 169 nmap x d h = {!!} |
375 | 170 commute1 : {x y : Obj I} {f' : Hom I x y} (d : Obj A) (h : Hom A d a ) -> A [ A [ f o h ] ≈ A [ g o h ] ] |
171 → A [ A [ FMap Γ f' o nmap x d h ] ≈ A [ nmap y d h o FMap (K A I d) f' ] ] | |
385 | 172 commute1 {x} {y} {f'} d h fh=gh = {!!} |
375 | 173 nat : (d : Obj A) → (h : Hom A d a ) → A [ A [ f o h ] ≈ A [ g o h ] ] → NTrans I A (K A I d) Γ |
368
b18585089d2e
add more parameter to nat in lim-to-equ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
367
diff
changeset
|
174 nat d h fh=gh = record { |
367 | 175 TMap = λ x → nmap x d h ; |
350 | 176 isNTrans = record { |
371
3a125d05ae0f
limit-to nat will be done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
370
diff
changeset
|
177 commute = λ {x} {y} {f'} -> commute1 {x} {y} {f'} d h fh=gh |
350 | 178 } |
179 } | |
180 k : {d : Obj A} (h : Hom A d a) → A [ A [ f o h ] ≈ A [ g o h ] ] → Hom A d c | |
385 | 181 k {d} h fh=gh = {!!} -- limit (lim I Γ {c} {nat c e fe=ge }) d (nat d h fh=gh ) |
372
b4855a3ebd34
add more lemma in limit-to
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
371
diff
changeset
|
182 ek=h : (d : Obj A ) (h : Hom A d a ) -> ( fh=gh : A [ A [ f o h ] ≈ A [ g o h ] ] ) -> A [ A [ e o k h fh=gh ] ≈ h ] |
374
5641b923201e
limit-to: indexFunctor distribution law cannot be proved
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
183 ek=h d h fh=gh = {!!} |
372
b4855a3ebd34
add more lemma in limit-to
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
371
diff
changeset
|
184 uniquness : (d : Obj A ) (h : Hom A d a ) -> ( fh=gh : A [ A [ f o h ] ≈ A [ g o h ] ] ) -> |
b4855a3ebd34
add more lemma in limit-to
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
371
diff
changeset
|
185 ( k' : Hom A d c ) |
b4855a3ebd34
add more lemma in limit-to
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
371
diff
changeset
|
186 -> A [ A [ e o k' ] ≈ h ] → A [ k h fh=gh ≈ k' ] |
b4855a3ebd34
add more lemma in limit-to
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
371
diff
changeset
|
187 uniquness d h fh=gh = {!!} |
368
b18585089d2e
add more parameter to nat in lim-to-equ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
367
diff
changeset
|
188 |
372
b4855a3ebd34
add more lemma in limit-to
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
371
diff
changeset
|
189 |