annotate S.agda @ 639:4cf8f982dc5b

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 02 Jul 2017 02:18:57 +0900
parents 7194ba55df56
children 855e497a9c8f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
608
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 --I'd like to write the Limit in Sets Category using Agda. Assuming local smallness, a functor is a pair of map on Set OC and I, like this.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 --
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 -- sobj : OC → Set c₂
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 -- smap : { i j : OC } → (f : I ) → sobj i → sobj j
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 --
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 --A cone for the functor is a record with two fields. Using the record, commutativity of the cone and the propertiesy of the Limit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 --are easity shown, except uniquness. The uniquness of the Limit turned out that congruence of the record with two fields.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 --
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 --In the following agda code, I'd like to prove snat-cong lemma.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 open import Level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 module S where
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 open import Relation.Binary.Core
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 open import Function
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 import Relation.Binary.PropositionalEquality
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 record snat { c₂ } { I OC : Set c₂ } ( sobj : OC → Set c₂ )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 ( smap : { i j : OC } → (f : I ) → sobj i → sobj j ) : Set c₂ where
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 field
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 snmap : ( i : OC ) → sobj i
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 sncommute : ( i j : OC ) → ( f : I ) → smap f ( snmap i ) ≡ snmap j
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 smap0 : { i j : OC } → (f : I ) → sobj i → sobj j
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 smap0 {i} {j} f x = smap f x
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 open snat
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 snat-cong : { c : Level } { I OC : Set c } { SObj : OC → Set c } { SMap : { i j : OC } → (f : I )→ SObj i → SObj j }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 ( s t : snat SObj SMap )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 → ( ( λ i → snmap s i ) ≡ ( λ i → snmap t i ) )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 → ( ( λ i j f → smap0 s f ( snmap s i ) ≡ snmap s j ) ≡ ( ( λ i j f → smap0 t f ( snmap t i ) ≡ snmap t j ) ) )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 → s ≡ t
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 snat-cong s t refl refl = {!!}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
34
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 --This is quite simlar to the answer of
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 --
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 -- Equality on dependent record types
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 -- https://stackoverflow.com/questions/37488098/equality-on-dependent-record-types
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 --
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 --So it should work something like
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 --
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 -- snat-cong s t refl refl = refl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 --
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 --but it gives an error like this.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 --
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 -- .sncommute i j f != sncommute t i j f of type
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 -- .SMap f (snmap t i) ≡ snmap t j
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 --
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 --Is there any help?