annotate system-f.agda @ 327:7645185970f2

fix Emp commnet
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 22 Mar 2014 08:53:02 +0700
parents c299dd508263
children d6eb3520ccf8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
315
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 open import Level
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 open import Relation.Binary.PropositionalEquality
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 module system-f {l : Level} where
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 postulate A : Set
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 postulate B : Set
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 data _∨_ (A B : Set) : Set where
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 or1 : A -> A ∨ B
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 or2 : B -> A ∨ B
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 lemma01 : A -> A ∨ B
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 lemma01 a = or1 a
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 lemma02 : B -> A ∨ B
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 lemma02 b = or2 b
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 lemma03 : {C : Set} -> (A ∨ B) -> (A -> C) -> (B -> C) -> C
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 lemma03 (or1 a) ac bc = ac a
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 lemma03 (or2 b) ac bc = bc b
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 postulate U : Set l
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 postulate V : Set l
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26
325
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
27 Bool = \{l : Level} -> {X : Set l} -> X -> X -> X
315
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28
325
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
29 T : {l : Level} -> Bool
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
30 T {l} = \{X : Set l} -> \(x y : X) -> x
315
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31
325
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
32 F : {l : Level} -> Bool
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
33 F {l} = \{X : Set l} -> \(x y : X) -> y
315
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
34
325
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
35 D : {l : Level} -> {U : Set l} -> U -> U -> Bool -> U
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
36 D {l} {U} u v t = t {U} u v
315
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
37
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 lemma04 : {u v : U} -> D u v T ≡ u
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 lemma04 = refl
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
40
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 lemma05 : {u v : U} -> D u v F ≡ v
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 lemma05 = refl
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
43
321
33c6dd3598ca Emp with yellow
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 320
diff changeset
44 _×_ : {l : Level} -> Set l -> Set l -> Set (suc l)
33c6dd3598ca Emp with yellow
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 320
diff changeset
45 _×_ {l} U V = {X : Set l} -> (U -> V -> X) -> X
315
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
46
321
33c6dd3598ca Emp with yellow
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 320
diff changeset
47 <_,_> : {l : Level} {U V : Set l} -> U -> V -> (U × V)
33c6dd3598ca Emp with yellow
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 320
diff changeset
48 <_,_> {l} {U} {V} u v = \{X} -> \(x : U -> V -> X) -> x u v
315
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
49
321
33c6dd3598ca Emp with yellow
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 320
diff changeset
50 π1 : {l : Level} {U V : Set l} -> (U × V) -> U
33c6dd3598ca Emp with yellow
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 320
diff changeset
51 π1 {l} {U} {V} t = t {U} (\(x : U) -> \(y : V) -> x)
315
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
52
321
33c6dd3598ca Emp with yellow
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 320
diff changeset
53 π2 : {l : Level} {U V : Set l} -> (U × V) -> V
33c6dd3598ca Emp with yellow
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 320
diff changeset
54 π2 {l} {U} {V} t = t {V} (\(x : U) -> \(y : V) -> y)
315
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
55
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 lemma06 : {U V : Set l } -> {u : U } -> {v : V} -> π1 ( < u , v > ) ≡ u
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
57 lemma06 = refl
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
58
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 lemma07 : {U V : Set l } -> {u : U } -> {v : V} -> π2 ( < u , v > ) ≡ v
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 lemma07 = refl
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
61
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 hoge : {U V : Set l} -> U -> V -> (U × V)
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 hoge u v = < u , v >
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
64
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
65 -- lemma08 : (t : U × V) -> < π1 t , π2 t > ≡ t
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 -- lemma08 t = {!!}
316
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
67
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
68 -- Emp definision is still wrong...
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
69
327
7645185970f2 fix Emp commnet
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 326
diff changeset
70 Emp : {l : Level} {X : Set l} -> Set l
7645185970f2 fix Emp commnet
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 326
diff changeset
71 Emp {l} = \{X : Set l} -> X
316
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
72
327
7645185970f2 fix Emp commnet
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 326
diff changeset
73 -- ε : {l : Level} (U : Set l) {l' : Level} {U' : Set l'} -> Emp -> Emp
7645185970f2 fix Emp commnet
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 326
diff changeset
74 -- ε {l} U t = t
316
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
75
327
7645185970f2 fix Emp commnet
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 326
diff changeset
76 -- lemma09 : {l : Level} {U : Set l} {l' : Level} {U' : Set l} -> (t : Emp {l} {U} ) -> ε U (ε Emp t) ≡ ε U t
322
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 321
diff changeset
77 -- lemma09 t = refl
321
33c6dd3598ca Emp with yellow
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 320
diff changeset
78
327
7645185970f2 fix Emp commnet
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 326
diff changeset
79 -- lemma10 : {l : Level} {U V X : Set l} -> (t : Emp {_} {U × V}) -> U × V
7645185970f2 fix Emp commnet
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 326
diff changeset
80 -- lemma10 {l} {U} {V} t = ε (U × V) t
316
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
81
327
7645185970f2 fix Emp commnet
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 326
diff changeset
82 -- lemma10' : {l : Level} {U V X : Set l} -> (t : Emp {_} {U × V}) -> Emp
7645185970f2 fix Emp commnet
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 326
diff changeset
83 -- lemma10' {l} {U} {V} {X} t = ε (U × V) t
7645185970f2 fix Emp commnet
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 326
diff changeset
84
7645185970f2 fix Emp commnet
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 326
diff changeset
85 -- lemma100 : {l : Level} {U V X : Set l} -> (t : Emp {_} {U}) -> Emp
322
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 321
diff changeset
86 -- lemma100 {l} {U} {V} t = ε U t
321
33c6dd3598ca Emp with yellow
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 320
diff changeset
87
327
7645185970f2 fix Emp commnet
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 326
diff changeset
88 -- lemma101 : {l k : Level} {U V : Set l} -> (t : Emp {_} {U × V}) -> π1 (ε (U × V) t) ≡ ε U t
322
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 321
diff changeset
89 -- lemma101 t = refl
319
5791b7b04820 Emp in System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
90
327
7645185970f2 fix Emp commnet
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 326
diff changeset
91 -- lemma102 : {l k : Level} {U V : Set l} -> (t : Emp {_} {U × V}) -> π2 (ε (U × V) t) ≡ ε V t
322
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 321
diff changeset
92 -- lemma102 t = refl
321
33c6dd3598ca Emp with yellow
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 320
diff changeset
93
327
7645185970f2 fix Emp commnet
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 326
diff changeset
94 -- lemma103 : {l : Level} {U V : Set l} -> (u : U) -> (t : Emp {l} {_} ) -> (ε (U -> V) t) u ≡ ε V t
322
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 321
diff changeset
95 -- lemma103 u t = refl
316
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
96
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
97 _+_ : Set l -> Set l -> Set (suc l)
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
98 U + V = {X : Set l} -> ( U -> X ) -> (V -> X) -> X
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
99
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
100 ι1 : {U V : Set l} -> U -> U + V
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
101 ι1 {U} {V} u = \{X} -> \(x : U -> X) -> \(y : V -> X ) -> x u
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
102
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
103 ι2 : {U V : Set l} -> V -> U + V
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
104 ι2 {U} {V} v = \{X} -> \(x : U -> X) -> \(y : V -> X ) -> y v
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
105
317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 316
diff changeset
106 δ : { U V R S : Set l } -> (R -> U) -> (S -> U) -> ( R + S ) -> U
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 316
diff changeset
107 δ {U} {V} {R} {S} u v t = t {U} (\(x : R) -> u x) ( \(y : S) -> v y)
316
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
108
317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 316
diff changeset
109 lemma11 : { U V R S : Set l } -> (u : R -> U ) (v : S -> U ) -> (r : R) -> δ {U} {V} {R} {S} u v ( ι1 r ) ≡ u r
316
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
110 lemma11 u v r = refl
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
111
317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 316
diff changeset
112 lemma12 : { U V R S : Set l } -> (u : R -> U ) (v : S -> U ) -> (s : S) -> δ {U} {V} {R} {S} u v ( ι2 s ) ≡ v s
316
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
113 lemma12 u v s = refl
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
114
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
115
322
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 321
diff changeset
116 _××_ : {l : Level} -> Set (suc l) -> Set l -> Set (suc l)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 321
diff changeset
117 _××_ {l} U V = {X : Set l} -> (U -> V -> X) -> X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 321
diff changeset
118
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 321
diff changeset
119 <<_,_>> : {l : Level} {U : Set (suc l) } {V : Set l} -> U -> V -> (U ×× V)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 321
diff changeset
120 <<_,_>> {l} {U} {V} u v = \{X} -> \(x : U -> V -> X) -> x u v
316
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
121
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
122
322
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 321
diff changeset
123 Int = \{l : Level } -> \{ X : Set l } -> X -> ( X -> X ) -> X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 321
diff changeset
124
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 321
diff changeset
125 Zero : {l : Level } -> { X : Set l } -> Int
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 321
diff changeset
126 Zero {l} {X} = \(x : X ) -> \(y : X -> X ) -> x
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 321
diff changeset
127
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 321
diff changeset
128 S : {l : Level } -> { X : Set l } -> Int -> Int
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 321
diff changeset
129 S {l} {X} t = \(x : X) -> \(y : X -> X ) -> y ( t x y )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 321
diff changeset
130
326
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 325
diff changeset
131 n0 : {l : Level} {X : Set l} -> Int {l} {X}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 325
diff changeset
132 n0 = Zero
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 325
diff changeset
133
322
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 321
diff changeset
134 n1 : {l : Level } -> { X : Set l } -> Int {l} {X}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 321
diff changeset
135 n1 {l} {X} = \(x : X ) -> \(y : X -> X ) -> y x
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 321
diff changeset
136
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 321
diff changeset
137 n2 : {l : Level } -> { X : Set l } -> Int {l} {X}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 321
diff changeset
138 n2 {l} {X} = \(x : X ) -> \(y : X -> X ) -> y (y x)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 321
diff changeset
139
323
d22a39e155c4 fact error on R
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 322
diff changeset
140 n3 : {l : Level } -> { X : Set l } -> Int {l} {X}
d22a39e155c4 fact error on R
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 322
diff changeset
141 n3 {l} {X} = \(x : X ) -> \(y : X -> X ) -> y (y (y x))
d22a39e155c4 fact error on R
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 322
diff changeset
142
322
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 321
diff changeset
143 lemma13 : {l : Level } -> { X : Set l } -> S ( S ( Zero {l} {X}) ) ≡ n2
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 321
diff changeset
144 lemma13 {l} {X} = refl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 321
diff changeset
145
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 321
diff changeset
146 It : {l : Level} {U : Set l} -> U -> ( U -> U ) -> Int -> U
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 321
diff changeset
147 It {l} {U} u f t = t u f
316
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
148
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
149
323
d22a39e155c4 fact error on R
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 322
diff changeset
150 R : {l : Level} { U X : Set l} -> U -> ( U -> Int {l} {X} -> U ) -> Int -> U
d22a39e155c4 fact error on R
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 322
diff changeset
151 R {l} {U} u v t = π1 ( It {suc l} {U × Int} (< u , Zero >) (λ (x : U × Int) → < v (π1 x) (π2 x) , S (π2 x) > ) t )
d22a39e155c4 fact error on R
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 322
diff changeset
152
d22a39e155c4 fact error on R
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 322
diff changeset
153 sum : {l : Level} {X : Set l} -> Int -> Int {l} {X} -> Int
326
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 325
diff changeset
154 sum x y = It y ( λ z -> S z ) x
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 325
diff changeset
155
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 325
diff changeset
156 mul : {l : Level } {X : Set l} -> Int {l} {_} -> Int -> Int {l} {X}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 325
diff changeset
157 mul x y = It Zero ( λ (z : Int) -> sum y z ) x
324
6e9bca4e67a3 R lemma
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 323
diff changeset
158
326
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 325
diff changeset
159 copyInt : {l : Level } {X : Set l} -> Int {l} {_} -> Int {l} {X}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 325
diff changeset
160 copyInt x = It Zero ( λ (z : Int) -> S z ) x
324
6e9bca4e67a3 R lemma
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 323
diff changeset
161
326
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 325
diff changeset
162 -- fact : {l : Level} {X X' : Set l} -> Int -> Int {l} {_}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 325
diff changeset
163 -- fact {l} {X} {X'} n = R (S Zero) (λ ( z w : Int) -> mul {l} {_} z (S w) ) n
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 325
diff changeset
164
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 325
diff changeset
165 -- lemma13' : fact n3 ≡ mul n1 ( mul n2 n3)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 325
diff changeset
166 -- lemma13' = refl
324
6e9bca4e67a3 R lemma
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 323
diff changeset
167
6e9bca4e67a3 R lemma
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 323
diff changeset
168 -- lemma14 : (x y : Int) -> mul x y ≡ mul y x
326
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 325
diff changeset
169 -- lemma14 x y = It {!!} {!!} {!!}
323
d22a39e155c4 fact error on R
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 322
diff changeset
170
326
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 325
diff changeset
171 lemma15 : {l : Level} {X : Set l} (x y : Int {l} {X}) -> mul {l} {X} n2 n3 ≡ mul {l} {X} n3 n2
324
6e9bca4e67a3 R lemma
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 323
diff changeset
172 lemma15 x y = refl
323
d22a39e155c4 fact error on R
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 322
diff changeset
173
324
6e9bca4e67a3 R lemma
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 323
diff changeset
174 lemma16 : {l : Level} {X U : Set l} -> (u : U ) -> (v : U -> Int {l} {X} -> U ) -> R u v Zero ≡ u
6e9bca4e67a3 R lemma
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 323
diff changeset
175 lemma16 u v = refl
6e9bca4e67a3 R lemma
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 323
diff changeset
176
6e9bca4e67a3 R lemma
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 323
diff changeset
177 -- lemma17 : {l : Level} {X U : Set l} -> (u : U ) -> (v : U -> Int -> U ) -> (t : Int ) -> R u v (S t) ≡ v ( R u v t ) t
6e9bca4e67a3 R lemma
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 323
diff changeset
178 -- lemma17 u v t = refl
6e9bca4e67a3 R lemma
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 323
diff changeset
179
6e9bca4e67a3 R lemma
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 323
diff changeset
180 -- postulate lemma17 : {l : Level} {X U : Set l} -> (u : U ) -> (v : U -> Int -> U ) -> (t : Int ) -> R u v (S t) ≡ v ( R u v t ) t
316
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
181
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
182
325
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
183 List = \{l : Level} -> \{ U X : Set l} -> X -> ( U -> X -> X ) -> X
323
d22a39e155c4 fact error on R
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 322
diff changeset
184
325
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
185 Nil : {l : Level} {U : Set l} {X : Set l} -> List {l} {U} {X}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
186 Nil {l} {U} {X} = \(x : X) -> \(y : U -> X -> X) -> x
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
187
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
188 Cons : {l : Level} {U : Set l} {X : Set l} -> U -> List {l} {U} {X} -> List {l} {U} {X}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
189 Cons {l} {U} {X} u t = \(x : X) -> \(y : U -> X -> X) -> y u (t x y )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
190
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
191 l0 : {l : Level} {X : Set l} -> List {l} {Int {l} {X}} {X}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
192 l0 = Nil
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
193
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
194 l1 : {l : Level} {X : Set l} -> List {l} {Int {l} {X}} {X}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
195 l1 = Cons n1 Nil
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
196
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
197 l2 : {l : Level} {X : Set l} -> List {l} {Int {l} {X}} {X}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
198 l2 = Cons n2 l1
323
d22a39e155c4 fact error on R
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 322
diff changeset
199
325
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
200 ListIt : {l : Level} {U W X : Set l} -> W -> ( U -> W -> W ) -> List {l} {U} {W} -> W
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
201 ListIt {l} {U} {W} {X} w f t = t w f
323
d22a39e155c4 fact error on R
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 322
diff changeset
202
325
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
203 Nullp : {l : Level} {U : Set (suc l)} { X : Set (suc l)} -> List {suc l} {U} {Bool {l}} -> Bool
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
204 Nullp {l} {U} {X} list = ListIt {suc l} {U} {Bool} {X} T (\u w -> F) list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
205
326
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 325
diff changeset
206 Append : {l : Level} {U : Set l} {X : Set l} -> List {l} {U} {_} -> List {l} {U} {X} -> List {l} {U} {_}
325
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
207 Append {l} {U} {X} x y = ListIt {l} {U} {_} {X} y (\u w -> Cons u w) x
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
208
326
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 325
diff changeset
209 -- lemma18 : Append l1 l2 ≡ Cons n1 ( Cons n2 Nil )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 325
diff changeset
210 -- lemma18 = refl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 325
diff changeset
211
325
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
212 Tree = \{l : Level} -> \{ U X : Set l} -> X -> ( (U -> X) -> X ) -> X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
213
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
214 NilTree : {l : Level} {U : Set l} {X : Set l} -> Tree {l} {U} {X}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
215 NilTree {l} {U} {X} = \(x : X) -> \(y : (U -> X) -> X) -> x
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
216
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
217 Collect : {l : Level} {U : Set l} {X : Set l} -> (U -> X -> ((U -> X) -> X) -> X ) -> Tree {l} {U} {X}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
218 Collect {l} {U} {X} f = \(x : X) -> \(y : (U -> X) -> X) -> y (\(z : U) -> f z x y )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
219
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
220 TreeIt : {l : Level} {U W X : Set l} -> W -> ( (U -> W) -> W ) -> Tree {l} {U} {W} -> W
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 324
diff changeset
221 TreeIt {l} {U} {W} {X} w h t = t w h