annotate system-f.agda @ 321:33c6dd3598ca

Emp with yellow
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Wed, 19 Mar 2014 16:51:35 +0700
parents 71158a960aa8
children 477d5284d753
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
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 Bool = {X : Set l} -> X -> X -> X
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 T : Bool
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 T = \{X : Set l} -> \(x y : X) -> x
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 F : Bool
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 F = \{X : Set l} -> \(x y : X) -> y
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
34
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 D : {U : Set l} -> U -> U -> Bool -> U
0d7fa6fc5979 System T and System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 D {U} u v t = t {U} u v
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
321
33c6dd3598ca Emp with yellow
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 320
diff changeset
70 Emp : ∀{l : Level} {X : Set l} -> Set l
320
71158a960aa8 fix Emp
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 319
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
321
33c6dd3598ca Emp with yellow
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 320
diff changeset
73 ε : {l : Level} {U : Set l} -> Emp -> Emp
33c6dd3598ca Emp with yellow
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 320
diff changeset
74 ε {l} {U} t = t {l} {U}
316
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
75
321
33c6dd3598ca Emp with yellow
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 320
diff changeset
76 lemma09 : {l : Level} {U : Set l} -> (t : Emp) -> ε U (ε Emp t) ≡ ε U t
33c6dd3598ca Emp with yellow
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 320
diff changeset
77 lemma09 t = refl
33c6dd3598ca Emp with yellow
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 320
diff changeset
78
33c6dd3598ca Emp with yellow
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 320
diff changeset
79 lemma10 : {l : Level} {U V X : Set l} -> (t : Emp ) -> (U × V)
33c6dd3598ca Emp with yellow
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 320
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
321
33c6dd3598ca Emp with yellow
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 320
diff changeset
82 lemma100 : {l : Level} {U V X : Set l} -> (t : Emp ) -> Emp
33c6dd3598ca Emp with yellow
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 320
diff changeset
83 lemma100 {l} {U} {V} t = ε U t
33c6dd3598ca Emp with yellow
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 320
diff changeset
84
33c6dd3598ca Emp with yellow
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 320
diff changeset
85 lemma101 : {l k : Level} {U V : Set l} -> (t : Emp ) -> π1 (ε (U × V) t) ≡ ε U t
33c6dd3598ca Emp with yellow
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 320
diff changeset
86 lemma101 t = refl
319
5791b7b04820 Emp in System F
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
87
321
33c6dd3598ca Emp with yellow
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 320
diff changeset
88 lemma102 : {l k : Level} {U V : Set l} -> (t : Emp ) -> π2 (ε (U × V) t) ≡ ε V t
33c6dd3598ca Emp with yellow
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 320
diff changeset
89 lemma102 t = refl
33c6dd3598ca Emp with yellow
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 320
diff changeset
90
33c6dd3598ca Emp with yellow
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 320
diff changeset
91 lemma103 : {l : Level} {U V : Set l} -> (u : U) -> (t : Emp) -> ε (U -> V) u ≡ ε V t
33c6dd3598ca Emp with yellow
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 320
diff changeset
92 lemma103 u t = refl
316
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
93
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
94 _+_ : 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
95 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
96
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
97 ι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
98 ι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
99
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
100 ι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
101 ι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
102
317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 316
diff changeset
103 δ : { 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
104 δ {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
105
317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 316
diff changeset
106 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
107 lemma11 u v r = refl
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 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
110 lemma12 u v s = refl
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
111
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
112
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
113
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
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
116
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
117
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
118
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
119
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
120
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
7a3229b32b3c Emp and Sum first try
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 315
diff changeset
123