-
Notifications
You must be signed in to change notification settings - Fork 3
/
ReducibilitySubtype.v
216 lines (190 loc) · 4.85 KB
/
ReducibilitySubtype.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
Require Export SystemFR.ReducibilityLemmas.
Opaque reducible_values.
Lemma subtype_reducible_values:
forall ρ v T1 T2,
[ ρ ⊨ v : T1 ]v ->
[ ρ ⊨ T1 <: T2 ] ->
[ ρ ⊨ v : T2 ]v.
Proof.
steps.
Qed.
Lemma subtype_equivalent_types:
forall ρ T1 T2,
[ ρ ⊨ T1 = T2 ] ->
[ ρ ⊨ T1 <: T2 ].
Proof.
unfold equivalent_types; steps; eauto with eapply_any.
Qed.
Lemma subtype_equivalent_types_back:
forall ρ T1 T2,
[ ρ ⊨ T1 = T2 ] ->
[ ρ ⊨ T2 <: T1 ].
Proof.
unfold equivalent_types; steps; eauto with eapply_any.
Qed.
Lemma equivalent_types_refl:
forall ρ T,
[ ρ ⊨ T = T ].
Proof.
unfold equivalent_types; steps; eauto with eapply_any.
Qed.
Lemma equivalent_types_sym:
forall ρ T1 T2,
[ ρ ⊨ T1 = T2 ] ->
[ ρ ⊨ T2 = T1 ].
Proof.
unfold equivalent_types; steps; eauto with eapply_any.
Qed.
Lemma equivalent_types_trans:
forall ρ T1 T2 T3,
[ ρ ⊨ T1 = T2 ] ->
[ ρ ⊨ T2 = T3 ] ->
[ ρ ⊨ T1 = T3 ].
Proof.
unfold equivalent_types; steps; eauto with eapply_any.
eapply H0; eapply H; auto.
Qed.
Lemma subtype_refl:
forall ρ T,
[ ρ ⊨ T <: T ].
Proof.
steps; eauto with eapply_any.
Qed.
Lemma subtype_trans:
forall ρ T1 T2 T3,
[ ρ ⊨ T1 <: T2 ] ->
[ ρ ⊨ T2 <: T3 ] ->
[ ρ ⊨ T1 <: T3 ].
Proof.
steps; eauto with eapply_any.
Qed.
Lemma equivalent_types_reducible_values:
forall ρ v T1 T2,
[ ρ ⊨ v : T1 ]v ->
[ ρ ⊨ T1 = T2 ] ->
[ ρ ⊨ v : T2 ]v.
Proof.
eauto using subtype_reducible_values, subtype_equivalent_types.
Qed.
Lemma equivalent_types_reducible_values_back:
forall ρ v T1 T2,
[ ρ ⊨ v : T1 ]v ->
[ ρ ⊨ T2 = T1 ] ->
[ ρ ⊨ v : T2 ]v.
Proof.
eauto using subtype_reducible_values, subtype_equivalent_types_back.
Qed.
Lemma subtype_reducible:
forall ρ t T1 T2,
[ ρ ⊨ t : T1 ] ->
[ ρ ⊨ T1 <: T2 ] ->
[ ρ ⊨ t : T2 ].
Proof.
steps; eauto using reducible_values_exprs.
Qed.
Lemma equivalent_types_reducible:
forall ρ t T1 T2,
[ ρ ⊨ t : T1 ] ->
[ ρ ⊨ T1 = T2 ] ->
[ ρ ⊨ t : T2 ].
Proof.
eauto using subtype_reducible, subtype_equivalent_types.
Qed.
Lemma equivalent_types_reducible_back:
forall ρ t T1 T2,
[ ρ ⊨ t : T2 ] ->
[ ρ ⊨ T1 = T2 ] ->
[ ρ ⊨ t : T1 ].
Proof.
eauto using subtype_reducible, subtype_equivalent_types_back.
Qed.
Lemma open_subtype_reducible:
forall Θ Γ t T1 T2,
[ Θ; Γ ⊨ t : T1 ] ->
[ Θ; Γ ⊨ T1 <: T2 ] ->
[ Θ; Γ ⊨ t : T2 ].
Proof.
unfold open_subtype, open_reducible; steps; eauto using subtype_reducible.
Qed.
Lemma open_equivalent_types_reducible:
forall Θ Γ t T1 T2,
[ Θ; Γ ⊨ t : T1 ] ->
[ Θ; Γ ⊨ T1 = T2 ] ->
[ Θ; Γ ⊨ t : T2 ].
Proof.
unfold open_equivalent_types, open_reducible; steps; eauto using equivalent_types_reducible.
Qed.
Lemma open_equivalent_types_reducible_back:
forall Θ Γ t T1 T2,
[ Θ; Γ ⊨ t : T1 ] ->
[ Θ; Γ ⊨ T2 = T1 ] ->
[ Θ; Γ ⊨ t : T2 ].
Proof.
unfold open_equivalent_types, open_reducible; steps; eauto using equivalent_types_reducible_back.
Qed.
Lemma open_equivalent_subtype:
forall Θ Γ T1 T2,
[ Θ; Γ ⊨ T1 = T2 ] ->
[ Θ; Γ ⊨ T1 <: T2 ].
Proof.
unfold open_equivalent_types, open_subtype; steps; eauto using subtype_equivalent_types.
Qed.
Lemma open_equivalent_subtype_back:
forall Θ Γ T1 T2,
[ Θ; Γ ⊨ T1 = T2 ] ->
[ Θ; Γ ⊨ T2 <: T1 ].
Proof.
unfold open_equivalent_types, open_subtype; steps; eauto using subtype_equivalent_types_back.
Qed.
Lemma open_equivalent_types_refl:
forall Θ Γ T,
[ Θ; Γ ⊨ T = T ].
Proof.
unfold open_equivalent_types; intros; eauto using equivalent_types_refl.
Qed.
Lemma open_equivalent_types_sym:
forall Θ Γ T1 T2,
[ Θ; Γ ⊨ T1 = T2 ] ->
[ Θ; Γ ⊨ T2 = T1 ].
Proof.
unfold open_equivalent_types; intros; eauto using equivalent_types_sym.
Qed.
Lemma open_equivalent_types_trans:
forall Θ Γ T1 T2 T3,
[ Θ; Γ ⊨ T1 = T2 ] ->
[ Θ; Γ ⊨ T2 = T3 ] ->
[ Θ; Γ ⊨ T1 = T3 ].
Proof.
unfold open_equivalent_types; intros; eauto using equivalent_types_trans.
Qed.
Lemma open_subtype_refl:
forall Θ Γ T,
[ Θ; Γ ⊨ T <: T ].
Proof.
unfold open_subtype; intros; eauto using subtype_refl.
Qed.
Lemma open_subtype_trans:
forall Θ Γ T1 T2 T3,
[ Θ; Γ ⊨ T1 <: T2 ] ->
[ Θ; Γ ⊨ T2 <: T3 ] ->
[ Θ; Γ ⊨ T1 <: T3 ].
Proof.
unfold open_subtype; intros; eauto using subtype_trans.
Qed.
Lemma subtype_antisym:
forall ρ T1 T2 ,
[ ρ ⊨ T1 <: T2 ] ->
[ ρ ⊨ T2 <: T1 ] ->
[ ρ ⊨ T1 = T2 ].
Proof.
unfold equivalent_types; steps.
Qed.
Lemma open_subtype_antisym:
forall Θ Γ T1 T2 ,
[ Θ; Γ ⊨ T1 <: T2 ] ->
[ Θ; Γ ⊨ T2 <: T1 ] ->
[ Θ; Γ ⊨ T1 = T2 ].
Proof.
unfold open_subtype, open_equivalent_types; steps;
eauto using subtype_antisym.
Qed.