annotate src/S.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 45de2b31bf02
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1110
45de2b31bf02 add original library and fix for safe mode
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 949
diff changeset
1
608
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 --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
3 --
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 -- sobj : OC → Set c₂
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 -- smap : { i j : OC } → (f : I ) → sobj i → sobj j
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 --
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 --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
8 --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
9 --
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 --In the following agda code, I'd like to prove snat-cong lemma.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11
1110
45de2b31bf02 add original library and fix for safe mode
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 949
diff changeset
12 -- {-# OPTIONS --cubical-compatible --safe #-}
608
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 open import Level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 module S where
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 open import Relation.Binary.Core
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 open import Function
1110
45de2b31bf02 add original library and fix for safe mode
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 949
diff changeset
18 open import Relation.Binary.PropositionalEquality
663
855e497a9c8f introducd HeterogeneousEquality
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 608
diff changeset
19 open import Relation.Binary.HeterogeneousEquality using (_≅_;refl)
608
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 record snat { c₂ } { I OC : Set c₂ } ( sobj : OC → Set c₂ )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 ( smap : { i j : OC } → (f : I ) → sobj i → sobj j ) : Set c₂ where
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 field
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 snmap : ( i : OC ) → sobj i
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 sncommute : ( i j : OC ) → ( f : I ) → smap f ( snmap i ) ≡ snmap j
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 smap0 : { i j : OC } → (f : I ) → sobj i → sobj j
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 smap0 {i} {j} f x = smap f x
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 open snat
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
30
672
749df4959d19 fix completeness
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 663
diff changeset
31 -- snat-cong' : { c : Level } { I OC : Set c } { SObj : OC → Set c } { SMap : { i j : OC } → (f : I )→ SObj i → SObj j }
749df4959d19 fix completeness
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 663
diff changeset
32 -- ( s t : snat SObj SMap )
749df4959d19 fix completeness
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 663
diff changeset
33 -- → ( ( λ i → snmap s i ) ≡ ( λ i → snmap t i ) )
749df4959d19 fix completeness
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 663
diff changeset
34 -- → ( ( λ i j f → smap0 s f ( snmap s i ) ≡ snmap s j ) ≡ ( ( λ i j f → smap0 t f ( snmap t i ) ≡ snmap t j ) ) )
749df4959d19 fix completeness
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 663
diff changeset
35 -- → s ≡ t
749df4959d19 fix completeness
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 663
diff changeset
36 -- snat-cong' s t refl refl = {!!}
663
855e497a9c8f introducd HeterogeneousEquality
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 608
diff changeset
37
855e497a9c8f introducd HeterogeneousEquality
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 608
diff changeset
38 snat-cong : {c : Level}
855e497a9c8f introducd HeterogeneousEquality
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 608
diff changeset
39 {I OC : Set c}
855e497a9c8f introducd HeterogeneousEquality
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 608
diff changeset
40 {sobj : OC → Set c}
855e497a9c8f introducd HeterogeneousEquality
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 608
diff changeset
41 {smap : {i j : OC} → (f : I) → sobj i → sobj j}
855e497a9c8f introducd HeterogeneousEquality
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 608
diff changeset
42 → (s t : snat sobj smap)
855e497a9c8f introducd HeterogeneousEquality
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 608
diff changeset
43 → (snmap-≡ : snmap s ≡ snmap t)
855e497a9c8f introducd HeterogeneousEquality
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 608
diff changeset
44 → (sncommute-≅ : sncommute s ≅ sncommute t)
855e497a9c8f introducd HeterogeneousEquality
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 608
diff changeset
45 → s ≡ t
855e497a9c8f introducd HeterogeneousEquality
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 608
diff changeset
46 snat-cong _ _ refl refl = refl
608
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
47
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 --This is quite simlar to the answer of
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 --
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 -- Equality on dependent record types
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 -- https://stackoverflow.com/questions/37488098/equality-on-dependent-record-types
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 --
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 --So it should work something like
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 --
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 -- snat-cong s t refl refl = refl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 --
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
57 --but it gives an error like this.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 --
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 -- .sncommute i j f != sncommute t i j f of type
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 -- .SMap f (snmap t i) ≡ snmap t j
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
61 --
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 --Is there any help?