-
Notifications
You must be signed in to change notification settings - Fork 0
/
conf_local_SL.v
372 lines (309 loc) · 12.8 KB
/
conf_local_SL.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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
(* Contribution to the Coq Library V6.3 (July 1999) *)
(****************************************************************************)
(* The Calculus of Inductive Constructions *)
(* *)
(* Projet Coq *)
(* *)
(* INRIA ENS-CNRS *)
(* Rocquencourt Lyon *)
(* *)
(* Coq V5.10 *)
(* Nov 25th 1994 *)
(* *)
(****************************************************************************)
(* conf_local_SL.v *)
(****************************************************************************)
(*****************************************************************************)
(* Projet Coq - Calculus of Inductive Constructions V5.8 *)
(*****************************************************************************)
(* *)
(* Meta-theory of the explicit substitution calculus lambda-env *)
(* Amokrane Saibi *)
(* *)
(* September 1993 *)
(* *)
(*****************************************************************************)
(* Confluence locale de sigma-lift *)
Require Import TS.
Require Import sur_les_relations.
Require Import sigma_lift.
Require Import determinePC_SL.
Require Import resoudPC_SL.
Definition e_local1 (b : wsort) (x y : TS b) :=
forall z : TS b,
e_relSL _ x z -> exists u : TS b, e_relSLstar _ y u /\ e_relSLstar _ z u.
Notation local1 := (e_local1 _) (only parsing).
(* <Warning> : Syntax is discontinued *)
(* app *)
Goal forall x y : terms, reg_app x y -> e_local1 _ x y.
simple induction 1; red in |- *; intros a b0 s z H0.
pattern s, z in |- *; apply case_SL_reg_app with a b0; auto.
exists (app (env a s) (env b0 s)); auto.
Save local_app.
Hint Resolve local_app.
(* lambda *)
Goal forall x y : terms, reg_lambda x y -> e_local1 _ x y.
simple induction 1; red in |- *; intros a s z H0.
pattern s, z in |- *; apply case_SL_reg_lambda with a; auto.
exists (lambda (env a (lift s))); auto.
Save local_lambda.
Hint Resolve local_lambda.
(* clos *)
Goal forall x y : terms, reg_clos x y -> e_local1 _ x y.
simple induction 1; red in |- *; intros a s t z H0.
pattern t, z in |- *; apply case_SL_clos with a s; auto.
exists (env a (comp s t)); auto.
Save local_clos.
Hint Resolve local_clos.
(* varshift1 *)
Goal forall x y : terms, reg_varshift1 x y -> e_local1 _ x y.
simple induction 1; red in |- *; intros n z H0.
pattern z in |- *; apply case_SL_varshift1 with n; auto.
exists (var (S n)); auto.
Save local_varshift1.
Hint Resolve local_varshift1.
(* varshift2 *)
Goal forall x y : terms, reg_varshift2 x y -> e_local1 _ x y.
simple induction 1; red in |- *; intros n s z H0.
pattern z in |- *; apply case_SL_varshift2 with n s; auto.
exists (env (var (S n)) s); auto.
Save local_varshift2.
Hint Resolve local_varshift2.
(* fvarcons *)
Goal forall x y : terms, reg_fvarcons x y -> e_local1 _ x y.
simple induction 1; red in |- *; intros a s z H0.
pattern z in |- *; apply case_SL_fvarcons with a s; intros.
3: assumption.
exists a; auto.
apply PC_fvarcons_ctxt_r with s; assumption.
Save local_fvarcons.
Hint Resolve local_fvarcons.
(* fvarlift1 *)
Goal forall x y : terms, reg_fvarlift1 x y -> e_local1 _ x y.
simple induction 1; red in |- *; intros s z H0.
pattern z in |- *; apply case_SL_fvarlift1 with s; intros.
3: assumption.
exists (var 0); auto.
apply PC_fvarlift1_ctxt_r' with s; assumption.
Save local_fvarlift1.
Hint Resolve local_fvarlift1.
(* fvarlift2 *)
Goal forall x y : terms, reg_fvarlift2 x y -> e_local1 _ x y.
simple induction 1; red in |- *; intros s t z H0.
pattern z in |- *; apply case_SL_fvarlift2 with s t; intros.
3: assumption.
exists (env (var 0) t); auto.
apply PC_fvarlift2_ctxt_r with s; assumption.
Save local_fvarlift2.
Hint Resolve local_fvarlift2.
(* rvarcons *)
Goal forall x y : terms, reg_rvarcons x y -> e_local1 _ x y.
simple induction 1; red in |- *; intros n a s z H0.
pattern z in |- *; apply case_SL_rvarcons with n a s; intros.
3: assumption.
exists (env (var n) s); auto.
apply PC_rvarcons_ctxt_r with a; assumption.
Save local_rvarcons.
Hint Resolve local_rvarcons.
(* rvarlift1 *)
Goal forall x y : terms, reg_rvarlift1 x y -> e_local1 _ x y.
simple induction 1; red in |- *; intros n s z H0.
pattern z in |- *; apply case_SL_rvarlift1 with n s; auto.
exists (env (var n) (comp s shift)); auto.
Save local_rvarlift1.
Hint Resolve local_rvarlift1.
(* rvarlift2 *)
Goal forall x y : terms, reg_rvarlift2 x y -> e_local1 _ x y.
simple induction 1; red in |- *; intros n s t z H0.
pattern z in |- *; apply case_SL_rvarlift2 with n s t; auto.
exists (env (var n) (comp s (comp shift t))); auto.
Save local_rvarlift2.
Hint Resolve local_rvarlift2.
(* assenv *)
Goal forall x y : sub_explicits, reg_assenv x y -> e_local1 _ x y.
simple induction 1; red in |- *; intros s t u z H0.
pattern u, z in |- *; apply case_SL_assenv with s t; auto.
exists (comp s (comp t u)); auto.
Save local_assenv.
Hint Resolve local_assenv.
(* mapenv *)
Goal forall x y : sub_explicits, reg_mapenv x y -> e_local1 _ x y.
simple induction 1; red in |- *; intros a s t z H0.
pattern t, z in |- *; apply case_SL_mapenv with a s; auto.
exists (cons (env a t) (comp s t)); auto.
Save local_mapenv.
Hint Resolve local_mapenv.
(* shiftcons *)
Goal forall x y : sub_explicits, reg_shiftcons x y -> e_local1 _ x y.
simple induction 1; red in |- *; intros a s z H0.
pattern z in |- *; apply case_SL_shiftcons with a s; intros.
3: assumption.
exists s; auto.
apply PC_shiftcons_ctxt_r with a; assumption.
Save local_shiftcons.
Hint Resolve local_shiftcons.
(* shiftlift1 *)
Goal forall x y : sub_explicits, reg_shiftlift1 x y -> e_local1 _ x y.
simple induction 1; red in |- *; intros s z H0.
pattern z in |- *; apply case_SL_shiflift1 with s; auto.
exists (comp s shift); auto.
Save local_shiftlift1.
Hint Resolve local_shiftlift1.
(* shiftlift2 *)
Goal forall x y : sub_explicits, reg_shiftlift2 x y -> e_local1 _ x y.
simple induction 1; red in |- *; intros s t z H0.
pattern z in |- *; apply case_SL_shiflift2 with s t; auto.
exists (comp s (comp shift t)); auto.
Save local_shiftlift2.
Hint Resolve local_shiftlift2.
(* lift1 *)
Goal forall x y : sub_explicits, reg_lift1 x y -> e_local1 _ x y.
simple induction 1; red in |- *; intros s t z H0.
pattern z in |- *; apply case_SL_lift1 with s t; auto.
exists (lift (comp s t)); auto.
Save local_lift1.
Hint Resolve local_lift1.
(* lift2 *)
Goal forall x y : sub_explicits, reg_lift2 x y -> e_local1 _ x y.
simple induction 1; red in |- *; intros s t u z H0.
pattern z in |- *; apply case_SL_lift2 with s t u; auto.
exists (comp (lift (comp s t)) u); auto.
Save local_lift2.
Hint Resolve local_lift2.
(* liftenv *)
Goal forall x y : sub_explicits, reg_liftenv x y -> e_local1 _ x y.
simple induction 1; red in |- *; intros a s t z H0.
pattern z in |- *; apply case_SL_liftenv with a s t; auto.
exists (cons a (comp s t)); auto.
Save local_liftenv.
Hint Resolve local_liftenv.
(* idl *)
Goal forall x y : sub_explicits, reg_idl x y -> e_local1 _ x y.
simple induction 1; red in |- *; intros s z H0.
pattern s, z in |- *; apply case_SL_idl; auto.
exists s; auto.
Save local_idl.
Hint Resolve local_idl.
(* idr *)
Goal forall x y : sub_explicits, reg_idr x y -> e_local1 _ x y.
simple induction 1; red in |- *; intros s z H0.
apply Ex_PQ; pattern s, z in |- *; apply case_SL_idr; auto.
exists s; auto.
Save local_idr.
Hint Resolve local_idr.
(* liftid *)
Goal forall x y : sub_explicits, reg_liftid x y -> e_local1 _ x y.
simple induction 1; red in |- *; intros z H0.
pattern z in |- *; apply case_SL_liftid; auto.
Save local_liftid.
Hint Resolve local_liftid.
(* id *)
Goal forall x y : terms, reg_id x y -> e_local1 _ x y.
simple induction 1; red in |- *; intros a z H0.
apply Ex_PQ; pattern a, z in |- *; apply case_SL_reg_id; auto.
exists a; auto 6.
Save local_id.
Hint Resolve local_id.
(* systeme SL *)
Goal forall (b : wsort) (x y : TS b), e_systemSL _ x y -> e_local1 _ x y.
simple induction 1; auto.
Save local_systemSL.
Goal forall (b : wsort) (x y : TS b), e_relSL _ x y -> e_local1 _ x y.
simple induction 1.
(* systemSL *)
intros; apply local_systemSL; assumption.
(* contexte app gauche *)
red in |- *; intros a a' b0 H0 H1 z H2.
pattern z in |- *; apply case_SLapp with a b0.
3: assumption.
intros a'' H3; elim (H1 a'' H3); intros a_ H4.
elim H4; intros H5 H6.
exists (app a_ b0); auto.
intros b0' H3; exists (app a' b0'); auto.
(* contexte app droit *)
red in |- *; intros a b0 b0' H0 H1 z H2.
pattern z in |- *; apply case_SLapp with a b0.
3: assumption.
intros a' H3; exists (app a' b0'); auto.
intros b0'' H3; elim (H1 b0'' H3); intros b0_ H4.
elim H4; intros H5 H6.
exists (app a b0_); auto.
(* contexte lambda *)
red in |- *; intros a a' H0 H1 z H2.
pattern z in |- *; apply case_SLlambda with a.
2: assumption.
intros a'' H3; elim (H1 a'' H3); intros a_ H4; elim H4; intros H5 H6.
exists (lambda a_); auto.
(* contexte env gauche *)
red in |- *; intros a a' s H0 H1 z H2.
apply Ex_PQ; generalize H0; pattern a, s, z in |- *; apply case_SLenv; auto.
intros n H3; elim (case_SLvar n a' H3).
intros n s1 H3; elim (case_SLvar n a' H3).
intros a1 s1 H3; elim (case_SLvar 0 a' H3).
intros s1 H3; elim (case_SLvar 0 a' H3).
intros s1 s2 H3; elim (case_SLvar 0 a' H3).
intros n a1 s1 H3; elim (case_SLvar (S n) a' H3).
intros n s1 H3; elim (case_SLvar (S n) a' H3).
intros n s1 s2 H3; elim (case_SLvar (S n) a' H3).
intros a'' H3 H4; elim (H1 a'' H3); intros a_ H5; elim H5; intros H6 H7.
exists (env a_ s); auto.
intros s' H3 H4; exists (env a' s'); auto.
(* contexte env droit *)
red in |- *; intros a s s' H0 H1 z H2.
apply Ex_PQ; generalize H0; pattern a, s, z in |- *; apply case_SLenv; auto.
intros n H3; elim (case_SLshift s' H3).
intros; apply PC_fvarcons_ctxt_r with s1; assumption.
intros; apply PC_fvarlift1_ctxt_r' with s1; assumption.
intros; apply PC_fvarlift2_ctxt_r with s1; assumption.
intros; apply PC_rvarcons_ctxt_r with a1; assumption.
intro H3; elim (case_SLid s' H3).
intros a' H3 H4; exists (env a' s'); auto.
intros s'' H3 H4; elim (H1 s'' H3); intros s_ H5; elim H5; intros H6 H7.
exists (env a s_); auto.
(* contexte cons gauche *)
red in |- *; intros a a' s H0 H1 z H2.
pattern z in |- *; apply case_SLcons with a s; auto.
intros a'' H3; elim (H1 a'' H3); intros a_ H4; elim H4; intros H5 H6.
exists (cons a_ s); auto.
intros s' H3; exists (cons a' s'); auto.
(* contexte cons droit *)
red in |- *; intros a s s' H0 H1 z H2.
pattern z in |- *; apply case_SLcons with a s; auto.
intros a' H3; exists (cons a' s'); auto.
intros s'' H3; elim (H1 s'' H3); intros s_ H4; elim H4; intros H5 H6.
exists (cons a s_); auto.
(* contexte comp gauche *)
red in |- *; intros s s' t H0 H1 z H2.
apply Ex_PQ; generalize H0; pattern s, t, z in |- *; apply case_SLcomp; auto.
intros a t1 H3; elim (case_SLshift s' H3).
intros t1 H3; elim (case_SLshift s' H3).
intros t1 t2 H3; elim (case_SLshift s' H3).
intro H3; elim (case_SLid s' H3).
intros s'' H3; elim (H1 s'' H3); intros s_ H4; elim H4; intros H5 H6.
exists (comp s_ t); auto.
intros t' H3; exists (comp s' t'); auto.
(* contexte comp droit *)
red in |- *; intros s t t' H0 H1 z H2.
apply Ex_PQ; generalize H0; pattern s, t, z in |- *; apply case_SLcomp; auto.
intros; apply PC_shiftcons_ctxt_r with a; assumption.
intro H3; elim (case_SLid t' H3).
intros s' H3; exists (comp s' t'); auto.
intros t'' H3; elim (H1 t'' H3); intros t_ H4; elim H4; intros H5 H6.
exists (comp s t_); auto.
(* contexte lift *)
red in |- *; intros s s' H0 H1 z H2.
generalize H0; pattern s, z in |- *; apply case_SLlift.
3: assumption.
intro H3; elim (case_SLid s' H3).
intros s'' H3; elim (H1 s'' H3); intros s_ H4; elim H4; intros H5 H6.
exists (lift s_); auto.
Save local_relSL.
(*************************************************************)
(* sigma-lift est localement confluente *)
(*************************************************************)
Theorem conf_local_SL :
forall b : wsort, explicit_local_confluence _ (e_relSL b).
red in |- *; red in |- *; intros b x y z H H0.
generalize z H0.
change (e_local1 _ x y) in |- *; apply local_relSL; assumption.
Qed.