-
Notifications
You must be signed in to change notification settings - Fork 0
/
determinePC_SL.v
1179 lines (1101 loc) · 39 KB
/
determinePC_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
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(* 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 *)
(* *)
(****************************************************************************)
(* determinePC_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: determination des paires critiques *)
(* L'idee est:
partant d'un terme-substitution X, trouver tous ses "reduits" possibles
par la relation sigma-lift (SL), c.a.d. tous les Y tq: X--SL-->Y.
on prendra notamment pour X tous les membres gauches des regles de
sigma-lift, ceci nous indique les paires critiques (PC) a resoudre *)
Require Import TS.
Require Import sur_les_relations.
Require Import egaliteTS.
Require Import sigma_lift.
Require Import inversionSL.
(*** (var n) SL ? ***)
Goal forall (n : nat) (M : terms), ~ e_relSL _ (var n) M.
red in |- *; intros n M H; cut (e_invSL _ (var n) M).
2: auto.
simple induction 1.
Save case_SLvar.
(*** (app a b) SL ? ***)
Goal
forall (P : terms -> Prop) (a b : terms),
(forall a' : terms, e_relSL _ a a' -> P (app a' b)) ->
(forall b' : terms, e_relSL _ b b' -> P (app a b')) ->
forall M : terms, e_relSL _ (app a b) M -> P M.
intros P a b H H0 M H1; cut (e_invSL _ (app a b) M).
2: auto.
pattern M in |- *; apply terms_ind.
(* var *)
simple induction 1.
(* app *)
simple induction 3; simple induction 1; intros.
elim H7; apply H; assumption.
elim H6; apply H0; assumption.
(* lam *)
simple induction 2.
(* env *)
simple induction 2.
(* X *)
simple induction 1.
Save case_SLapp.
(*** (lambda a) SL ? ***)
Goal
forall (P : terms -> Prop) (a : terms),
(forall a' : terms, e_relSL _ a a' -> P (lambda a')) ->
forall M : terms, e_relSL _ (lambda a) M -> P M.
intros P a H M H0; cut (e_invSL _ (lambda a) M).
2: auto.
pattern M in |- *; apply terms_ind.
(* var *)
simple induction 1.
(* app *)
simple induction 3.
(* lambda *)
unfold e_invSL at 2 in |- *; intros; apply H; assumption.
(* env *)
simple induction 2.
(* X *)
simple induction 1.
Save case_SLlambda.
(*** (env a s) SL ? ***)
Goal
forall (P : terms -> sub_explicits -> terms -> Prop)
(a : terms) (s : sub_explicits),
(forall a1 b1 : terms, P (app a1 b1) s (app (env a1 s) (env b1 s))) ->
(forall a1 : terms, P (lambda a1) s (lambda (env a1 (lift s)))) ->
(forall (a1 : terms) (s1 : sub_explicits),
P (env a1 s1) s (env a1 (comp s1 s))) ->
(forall n : nat, P (var n) shift (var (S n))) ->
(forall (n : nat) (s1 : sub_explicits),
P (var n) (comp shift s1) (env (var (S n)) s1)) ->
(forall (a1 : terms) (s1 : sub_explicits), P (var 0) (cons a1 s1) a1) ->
(forall s1 : sub_explicits, P (var 0) (lift s1) (var 0)) ->
(forall s1 s2 : sub_explicits, P (var 0) (comp (lift s1) s2) (env (var 0) s2)) ->
(forall (n : nat) (a1 : terms) (s1 : sub_explicits),
P (var (S n)) (cons a1 s1) (env (var n) s1)) ->
(forall (n : nat) (s1 : sub_explicits),
P (var (S n)) (lift s1) (env (var n) (comp s1 shift))) ->
(forall (n : nat) (s1 s2 : sub_explicits),
P (var (S n)) (comp (lift s1) s2) (env (var n) (comp s1 (comp shift s2)))) ->
P a id a ->
(forall a' : terms, e_relSL _ a a' -> P a s (env a' s)) ->
(forall s' : sub_explicits, e_relSL _ s s' -> P a s (env a s')) ->
forall M : terms, e_relSL _ (env a s) M -> P a s M.
intros P a s; intros; cut (e_invSL _ (env a s) M).
2: auto.
pattern M in |- *; apply terms_ind.
(* var *)
simple induction 1.
(* varshift1 *)
do 2 simple induction 1; simple induction 2; intros.
rewrite H20; rewrite H19; rewrite H17; apply H2.
(* fvarlift1 *)
simple induction 1.
do 2 simple induction 1; simple induction 2; intros.
rewrite H21; rewrite H20; rewrite H18; apply H5.
(* fvarcons *)
simple induction 1.
do 2 simple induction 1; intros.
rewrite H20; rewrite H19; apply H4.
(* id *)
simple induction 1; intros.
elim H18; rewrite H19; apply H10.
(* app *)
(* app *)
simple induction 3.
do 3 simple induction 1; simple induction 2; intros.
rewrite H23; rewrite H22; rewrite H20; apply H.
(* fvarcons *)
simple induction 1.
do 2 simple induction 1; intros.
rewrite H21; rewrite H20; apply H4.
(* id *)
simple induction 1; intros.
rewrite H20; elim H19; apply H10.
(* lam *)
(* lambda *)
simple induction 2.
do 2 simple induction 1; intros.
rewrite H19; rewrite H18; apply H0.
(* fvarcons *)
simple induction 1.
do 2 simple induction 1; intros.
rewrite H20; rewrite H19; apply H4.
(* id *)
simple induction 1; intros.
rewrite H19; elim H18; apply H10.
(* env *)
(* clos *)
simple induction 2.
do 2 simple induction 1; intros.
rewrite H19; rewrite H18; apply H1.
(* varshift2 *)
simple induction 1.
do 2 simple induction 1; simple induction 2; intros.
rewrite H22; rewrite H21; rewrite H19; apply H3.
(* fvarcons *)
simple induction 1.
do 2 simple induction 1; intros.
rewrite H21; rewrite H20; apply H4.
(* favrlift2 *)
simple induction 1.
do 2 simple induction 1; simple induction 2; intros.
rewrite H24; rewrite H23; rewrite H21; apply H6.
(* rvarcons *)
simple induction 1.
do 3 simple induction 1; simple induction 2; intros.
rewrite H26; rewrite H25; rewrite H23; apply H7.
(* rvarlift1 *)
simple induction 1.
do 3 simple induction 1; do 2 simple induction 2; intros.
rewrite H29; rewrite H28; rewrite H26; rewrite H24; apply H8.
(* rvarlift2 *)
simple induction 1.
do 4 simple induction 1; do 2 simple induction 2; intros.
rewrite H31; rewrite H30; rewrite H28; rewrite H26; apply H9.
(* id *)
simple induction 1.
simple induction 1; intros.
rewrite H25; elim H24; apply H10.
(* contexte droit *)
simple induction 1.
simple induction 1; intros.
elim H26; apply H11; assumption.
(* contexte gauche *)
simple induction 1.
simple induction 1; intros.
elim H25; apply H12; assumption.
(* X *)
simple induction 1.
(* fvarcons *)
do 2 simple induction 1; intros.
rewrite H18; rewrite H17; apply H4.
(* id *)
simple induction 1; intros.
elim H16; rewrite H17; assumption.
Save case_SLenv.
(*** id SL ? ***)
Goal forall M : sub_explicits, ~ e_relSL _ id M.
red in |- *; intros M H; cut (e_invSL _ id M).
2: auto.
simple induction 1.
Save case_SLid.
(*** shift SL ? ***)
Goal forall M : sub_explicits, ~ e_relSL _ shift M.
red in |- *; intros M H; cut (e_invSL _ shift M).
2: auto.
simple induction 1.
Save case_SLshift.
(*** (cons a s) SL ? ***)
Goal
forall (P : sub_explicits -> Prop) (a : terms) (s : sub_explicits),
(forall a' : terms, e_relSL _ a a' -> P (cons a' s)) ->
(forall s' : sub_explicits, e_relSL _ s s' -> P (cons a s')) ->
forall M : sub_explicits, e_relSL _ (cons a s) M -> P M.
intros P a s H H0 M H1; cut (e_invSL _ (cons a s) M).
2: auto.
pattern M in |- *; apply sub_explicits_ind.
(* id *)
simple induction 1.
(* | *)
simple induction 1.
(* . *)
simple induction 2; simple induction 1; intros.
elim H6; apply H; assumption.
elim H5; apply H0; assumption.
(* o *)
simple induction 3.
(* || *)
simple induction 2.
(* x *)
simple induction 1.
Save case_SLcons.
(*** (comp s t) SL ? ***)
Goal
forall (P : sub_explicits -> sub_explicits -> sub_explicits -> Prop)
(s t : sub_explicits),
(forall s1 s2 : sub_explicits, P (comp s1 s2) t (comp s1 (comp s2 t))) ->
(forall (a : terms) (s1 : sub_explicits),
P (cons a s1) t (cons (env a t) (comp s1 t))) ->
(forall (a : terms) (t1 : sub_explicits), P shift (cons a t1) t1) ->
(forall t1 : sub_explicits, P shift (lift t1) (comp t1 shift)) ->
(forall t1 t2 : sub_explicits,
P shift (comp (lift t1) t2) (comp t1 (comp shift t2))) ->
(forall s1 t1 : sub_explicits, P (lift s1) (lift t1) (lift (comp s1 t1))) ->
(forall s1 t1 t2 : sub_explicits,
P (lift s1) (comp (lift t1) t2) (comp (lift (comp s1 t1)) t2)) ->
(forall (a : terms) (s1 t1 : sub_explicits),
P (lift s1) (cons a t1) (cons a (comp s1 t1))) ->
P id t t ->
P s id s ->
(forall s' : sub_explicits, e_relSL _ s s' -> P s t (comp s' t)) ->
(forall t' : sub_explicits, e_relSL _ t t' -> P s t (comp s t')) ->
forall M : sub_explicits, e_relSL _ (comp s t) M -> P s t M.
intros P s t; intros; cut (e_invSL _ (comp s t) M).
2: auto.
pattern M in |- *; apply sub_explicits_ind.
(* id *)
(* shiftcons *)
simple induction 1.
do 2 simple induction 1; intros.
rewrite H15; rewrite H16; apply H1.
(* idr, idl *)
simple induction 1; intros.
rewrite H14; pattern id at 2 in |- *; elim H15; apply H7.
(* | *)
simple induction 1.
do 2 simple induction 1; intros.
rewrite H15; rewrite H16; apply H1.
(* idl *)
simple induction 1.
simple induction 1; intros.
rewrite H15; elim H16; apply H7.
(* idr *)
simple induction 1; intros.
rewrite H16; elim H15; apply H8.
(* cons *)
(* mapenv *)
simple induction 2.
do 3 simple induction 1; simple induction 2; intros.
rewrite H17; rewrite H20; rewrite H19; apply H0.
(* shiftcons *)
simple induction 1.
do 2 simple induction 1; intros.
rewrite H17; rewrite H18; apply H1.
(* liftenv *)
simple induction 1.
do 3 simple induction 1; simple induction 2; intros.
rewrite H22; rewrite H21; rewrite H19; apply H6.
(* idl *)
simple induction 1.
simple induction 1; intros.
rewrite H18; elim H19; apply H7.
(* idr *)
simple induction 1; intros.
rewrite H19; elim H18; apply H8.
(* comp *)
simple induction 3.
(* assenv *)
do 2 simple induction 1; intros.
rewrite H18; rewrite H17; apply H.
(* shiftcons *)
simple induction 1.
do 2 simple induction 1; intros.
rewrite H18; rewrite H19; apply H1.
(* shiftlift1 *)
simple induction 1.
simple induction 1; simple induction 2; intros.
rewrite H21; rewrite H20; rewrite H18; apply H2.
(* shiftlift2 *)
simple induction 1.
do 2 simple induction 1; simple induction 2; intros.
rewrite H23; rewrite H22; rewrite H20; apply H3.
(* lift2 *)
simple induction 1.
do 3 simple induction 1; simple induction 2; intros.
rewrite H25; rewrite H24; rewrite H22; apply H5.
(* idl *)
simple induction 1.
simple induction 1; intros.
rewrite H21; elim H22; apply H7.
(* idr *)
simple induction 1.
simple induction 1; intros.
rewrite H23; elim H22; apply H8.
(* contexte gauche *)
simple induction 1.
simple induction 1; intros.
elim H24; apply H9; assumption.
(* contexte droit *)
simple induction 1; intros.
elim H23; apply H10; assumption.
(* lift *)
simple induction 2.
(* shiftcons *)
do 2 simple induction 1; intros.
rewrite H17; rewrite H16; apply H1.
(* lift1 *)
simple induction 1.
do 3 simple induction 1; simple induction 2; intros.
rewrite H21; rewrite H20; rewrite H18; apply H4.
(* idl *)
simple induction 1.
simple induction 1; intros.
rewrite H17; elim H18; apply H7.
(* idr *)
simple induction 1; intros.
rewrite H18; elim H17; apply H8.
(* x *)
simple induction 1.
do 2 simple induction 1; intros.
rewrite H15; rewrite H16; apply H1.
(* idl *)
simple induction 1.
simple induction 1; intros.
rewrite H15; elim H16; apply H7.
(* idr *)
simple induction 1; intros.
rewrite H16; elim H15; apply H8.
Save case_SLcomp.
(*** (lift s) SL ? ***)
Goal
forall (P : sub_explicits -> sub_explicits -> Prop) (s : sub_explicits),
P id id ->
(forall s' : sub_explicits, e_relSL _ s s' -> P s (lift s')) ->
forall M : sub_explicits, e_relSL _ (lift s) M -> P s M.
intros P s H H0 M H1; cut (e_invSL _ (lift s) M).
2: auto.
pattern M in |- *; apply sub_explicits_ind.
(* id *)
simpl in |- *; intro H2; rewrite H2; assumption.
(* | *)
simple induction 1.
(* . *)
simple induction 2.
(* o *)
simple induction 3.
(* || *)
unfold e_invSL at 2 in |- *; intros; apply H0; assumption.
(* x *)
simple induction 1.
Save case_SLlift.
(*** (env (lambda a) s) SL ? ***)
Goal
forall (P : sub_explicits -> terms -> Prop) (a : terms) (s : sub_explicits),
P s (lambda (env a (lift s))) ->
P id (lambda a) ->
(forall x' : terms, e_relSL _ (lambda a) x' -> P s (env x' s)) ->
(forall s' : sub_explicits, e_relSL _ s s' -> P s (env (lambda a) s')) ->
forall M : terms, e_relSL _ (env (lambda a) s) M -> P s M.
intros.
cut (lambda a = lambda a).
2: auto.
pattern (lambda a) at 1, s, M in |- *; apply case_SLenv; intros.
15: assumption.
(* app *)elim (diff_app_lambda a1 b1 a H4).
(* lambda *)
rewrite (proj_lambda a1 a H4); assumption.
(* clos *)elim (diff_lambda_env a a1 s1 (sym_equal H4)).
(* varshift1 *)elim (diff_var_lambda n a H4).
(* varshift2 *)elim (diff_var_lambda n a H4).
(* fvarcons *)elim (diff_var_lambda 0 a H4).
(* fvarlift1 *)elim (diff_var_lambda 0 a H4).
(* fvarlift2 *)elim (diff_var_lambda 0 a H4).
(* rvarcons *)elim (diff_var_lambda (S n) a H4).
(* rvarlift1 *)elim (diff_var_lambda (S n) a H4).
(* rvarlift2 *)elim (diff_var_lambda (S n) a H4).
(* id *)
assumption.
(* contexte gauche*)
apply H1; assumption.
(* contexte droit *)
apply H2; assumption.
Save case_SL_reg_lambda.
(*** (env (app a b) s) SL ? ***)
Goal
forall (P : sub_explicits -> terms -> Prop) (a b : terms) (s : sub_explicits),
P s (app (env a s) (env b s)) ->
P id (app a b) ->
(forall x' : terms, e_relSL _ (app a b) x' -> P s (env x' s)) ->
(forall s' : sub_explicits, e_relSL _ s s' -> P s (env (app a b) s')) ->
forall M : terms, e_relSL _ (env (app a b) s) M -> P s M.
intros.
cut (app a b = app a b).
2: auto.
pattern (app a b) at 1, s, M in |- *; apply case_SLenv; intros.
15: assumption.
(* app *)
rewrite (proj_app1 a1 b1 a b H4); rewrite (proj_app2 a1 b1 a b H4);
assumption.
(* lambda *)elim (diff_app_lambda a b a1 (sym_equal H4)).
(* clos *)elim (diff_app_env a b a1 s1 (sym_equal H4)).
(* varshift1 *)elim (diff_var_app n a b H4).
(* varshift2 *)elim (diff_var_app n a b H4).
(* fvarcons *)elim (diff_var_app 0 a b H4).
(* fvarlift1 *)elim (diff_var_app 0 a b H4).
(* fvarlift2 *)elim (diff_var_app 0 a b H4).
(* rvarcons *)elim (diff_var_app (S n) a b H4).
(* rvarlift1 *)elim (diff_var_app (S n) a b H4).
(* rvarlift2 *)elim (diff_var_app (S n) a b H4).
(* id *)
assumption.
(* contexte gauche*)
apply H1; assumption.
(* contexte droit *)
apply H2; assumption.
Save case_SL_reg_app.
(*** (env (env a s) t) SL ? ***)
Goal
forall (P : sub_explicits -> terms -> Prop) (a : terms) (s t : sub_explicits),
P t (env a (comp s t)) ->
P id (env a s) ->
(forall x' : terms, e_relSL _ (env a s) x' -> P t (env x' t)) ->
(forall t' : sub_explicits, e_relSL _ t t' -> P t (env (env a s) t')) ->
forall M : terms, e_relSL _ (env (env a s) t) M -> P t M.
intros.
cut (env a s = env a s).
2: auto.
pattern (env a s) at 1, t, M in |- *; apply case_SLenv; intros.
15: assumption.
(* app *)elim (diff_app_env a1 b1 a s H4).
(* lambda *)elim (diff_lambda_env a1 a s H4).
(* clos *)
rewrite (proj_env1 a1 a s1 s H4); rewrite (proj_env2 a1 a s1 s H4).
assumption.
(* varshift1 *)elim (diff_var_env n a s H4).
(* varshift2 *)elim (diff_var_env n a s H4).
(* fvarcons *)elim (diff_var_env 0 a s H4).
(* fvarlift1 *)elim (diff_var_env 0 a s H4).
(* fvarlift2 *)elim (diff_var_env 0 a s H4).
(* rvarcons *)elim (diff_var_env (S n) a s H4).
(* rvarlift1 *)elim (diff_var_env (S n) a s H4).
(* rvarlift2 *)elim (diff_var_env (S n) a s H4).
(* id *)
assumption.
(* contexte gauche*)
apply H1; assumption.
(* contexte droit *)
apply H2; assumption.
Save case_SL_clos.
(*** (env (var n) shift) SL ? ***)
Goal
forall (P : terms -> Prop) (n : nat),
P (var (S n)) -> forall M : terms, e_relSL _ (env (var n) shift) M -> P M.
intros.
cut (var n = var n).
2: auto.
cut (shift = shift).
2: auto.
pattern (var n) at 1, shift at 1, M in |- *; apply case_SLenv; intros.
15: assumption.
(* app *)elim (diff_var_app n a1 b1 (sym_equal H2)).
(* lambda *)elim (diff_var_lambda n a1 (sym_equal H2)).
(* clos *)elim (diff_var_env n a1 s1 (sym_equal H2)).
(* varshift1 *)
rewrite (proj_var n0 n H2); assumption.
(* varshift2 *)elim (diff_shift_comp shift s1 (sym_equal H1)).
(* fvarcons *)elim (diff_shift_cons a1 s1 (sym_equal H1)).
(* fvarlift1 *)elim (diff_shift_lift s1 (sym_equal H1)).
(* fvarlift2 *)elim (diff_shift_comp (lift s1) s2 (sym_equal H1)).
(* rvarcons *)elim (diff_shift_cons a1 s1 (sym_equal H1)).
(* rvarlift1 *)elim (diff_shift_lift s1 (sym_equal H1)).
(* rvarlift2 *)elim (diff_shift_comp (lift s1) s2 (sym_equal H1)).
(* id *)elim (diff_id_shift H1).
(* contexte gauche*)elim (case_SLvar n a' H1).
(* contexte droit *)elim (case_SLshift s' H1).
Save case_SL_varshift1.
(*** (comp shift s) SL ? ***)
Goal
forall (P : sub_explicits -> sub_explicits -> Prop) (s : sub_explicits),
(forall (a : terms) (s1 : sub_explicits), P (cons a s1) s1) ->
(forall s1 : sub_explicits, P (lift s1) (comp s1 shift)) ->
(forall s1 t : sub_explicits, P (comp (lift s1) t) (comp s1 (comp shift t))) ->
P id shift ->
(forall s' : sub_explicits, e_relSL _ s s' -> P s (comp shift s')) ->
forall M : sub_explicits, e_relSL _ (comp shift s) M -> P s M.
intros.
cut (shift = shift).
2: auto.
pattern shift at 1, s, M in |- *; apply case_SLcomp; intros.
13: assumption.
(* assenv *)elim (diff_shift_comp s1 s2 (sym_equal H5)).
(* mapenv *)elim (diff_shift_cons a s1 (sym_equal H5)).
(* shiftcons *)
apply H.
(* shiftlift1 *)
apply H0.
(* shiftlift2 *)
apply H1.
(* lift1 *)elim (diff_shift_lift s1 (sym_equal H5)).
(* lift2 *)elim (diff_shift_lift s1 (sym_equal H5)).
(* liftenv *)elim (diff_shift_lift s1 (sym_equal H5)).
(* idl *)elim (diff_id_shift H5).
(* idr *)
assumption.
(* contexte gauche *)elim (case_SLshift s' H5).
(* contexte droit *)
apply H3; assumption.
Save case_SLcomp1.
(*** (env (var n) (comp shift s)) SL ? ***)
Goal
forall (P : terms -> Prop) (n : nat) (s : sub_explicits),
P (env (var (S n)) s) ->
(forall x' : sub_explicits, e_relSL _ (comp shift s) x' -> P (env (var n) x')) ->
forall M : terms, e_relSL _ (env (var n) (comp shift s)) M -> P M.
intros.
cut (var n = var n).
2: auto.
cut (comp shift s = comp shift s).
2: auto.
pattern (var n) at 1, (comp shift s) at 1, M in |- *; apply case_SLenv;
intros.
15: assumption.
(* app *)elim (diff_var_app n a1 b1 (sym_equal H3)).
(* lambda *)elim (diff_var_lambda n a1 (sym_equal H3)).
(* clos *)elim (diff_var_env n a1 s1 (sym_equal H3)).
(* varshift1 *)elim (diff_shift_comp shift s H2).
(* varshift2 *)
rewrite (proj_var n0 n H3); rewrite (proj_comp2 shift shift s1 s H2);
assumption.
(* fvarcons *)elim (diff_cons_comp a1 s1 shift s H2).
(* fvarlift1 *)elim (diff_comp_lift shift s s1 (sym_equal H2)).
(* fvarlift2 *)elim
(diff_shift_lift s1
(sym_equal (proj_comp1 (lift s1) shift s2 s H2))).
(* rvarcons *)elim (diff_cons_comp a1 s1 shift s H2).
(* rvarlift1 *)elim (diff_comp_lift shift s s1 (sym_equal H2)).
(* rvarlift2 *)elim
(diff_shift_lift s1
(sym_equal (proj_comp1 (lift s1) shift s2 s H2))).
(* id *)elim (diff_id_comp shift s H2).
(* contexte gauche*)elim (case_SLvar n a' H2).
(* contexte droit *)apply H0; assumption.
Save case_SL_varshift2.
(*** (env (var O) (cons a s)) SL ? ***)
Goal
forall (P : terms -> Prop) (a : terms) (s : sub_explicits),
P a ->
(forall x' : sub_explicits, e_relSL _ (cons a s) x' -> P (env (var 0) x')) ->
forall M : terms, e_relSL _ (env (var 0) (cons a s)) M -> P M.
intros.
cut (var 0 = var 0).
2: auto.
cut (cons a s = cons a s).
2: auto.
pattern (var 0) at 1, (cons a s) at 1, M in |- *; apply case_SLenv; intros.
15: assumption.
(* app *)elim (diff_var_app 0 a1 b1 (sym_equal H3)).
(* lambda *)elim (diff_var_lambda 0 a1 (sym_equal H3)).
(* clos *)elim (diff_var_env 0 a1 s1 (sym_equal H3)).
(* varshift1 *)elim (diff_shift_cons a s H2).
(* varshift2 *)elim (diff_cons_comp a s shift s1 (sym_equal H2)).
(* fvarcons *)rewrite (proj_cons1 a1 a s1 s H2); assumption.
(* fvarlift1 *)elim (diff_cons_lift a s s1 (sym_equal H2)).
(* fvarlift2 *)elim (diff_cons_comp a s (lift s1) s2 (sym_equal H2)).
(* rvarcons *)elim (O_S n (sym_equal (proj_var (S n) 0 H3))).
(* rvarlift1 *)elim (diff_cons_lift a s s1 (sym_equal H2)).
(* rvarlift2 *)elim (O_S n (sym_equal (proj_var (S n) 0 H3))).
(* id *)elim (diff_id_cons a s H2).
(* contexte gauche*)elim (case_SLvar 0 a' H2).
(* contexte droit *)apply H0; assumption.
Save case_SL_fvarcons.
(*** (env (var O) (lift s)) SL ? ***)
Goal
forall (P : terms -> Prop) (s : sub_explicits),
P (var 0) ->
(forall x' : sub_explicits, e_relSL _ (lift s) x' -> P (env (var 0) x')) ->
forall M : terms, e_relSL _ (env (var 0) (lift s)) M -> P M.
intros.
cut (var 0 = var 0).
2: auto.
cut (lift s = lift s).
2: auto.
pattern (var 0) at 1, (lift s) at 1, M in |- *; apply case_SLenv; intros.
15: assumption.
(* app *)elim (diff_var_app 0 a1 b1 (sym_equal H3)).
(* lambda *)elim (diff_var_lambda 0 a1 (sym_equal H3)).
(* clos *)elim (diff_var_env 0 a1 s1 (sym_equal H3)).
(* varshift1 *)elim (diff_shift_lift s H2).
(* varshift2 *)elim (diff_comp_lift shift s1 s H2).
(* fvarcons *)elim (diff_cons_lift a1 s1 s H2).
(* fvarlift1 *)assumption.
(* fvarlift2 *)elim (diff_comp_lift (lift s1) s2 s H2).
(* rvarcons *)elim (diff_cons_lift a1 s1 s H2).
(* rvarlift1 *)elim (O_S n (sym_equal (proj_var (S n) 0 H3))).
(* rvarlift2 *)elim (diff_comp_lift (lift s1) s2 s H2).
(* id *)elim (diff_id_lift s H2).
(* contexte gauche*)elim (case_SLvar 0 a' H2).
(* contexte droit *)apply H0; assumption.
Save case_SL_fvarlift1.
(*** (comp (lift s) t) SL ? ***)
Goal
forall (P : sub_explicits -> sub_explicits -> Prop) (s t : sub_explicits),
(forall t1 : sub_explicits, P (lift t1) (lift (comp s t1))) ->
(forall t1 t2 : sub_explicits,
P (comp (lift t1) t2) (comp (lift (comp s t1)) t2)) ->
(forall (a : terms) (t1 : sub_explicits), P (cons a t1) (cons a (comp s t1))) ->
P id (lift s) ->
(forall x' : sub_explicits, e_relSL _ (lift s) x' -> P t (comp x' t)) ->
(forall t' : sub_explicits, e_relSL _ t t' -> P t (comp (lift s) t')) ->
forall M : sub_explicits, e_relSL _ (comp (lift s) t) M -> P t M.
intros.
cut (lift s = lift s).
2: auto.
pattern (lift s) at 1, t, M in |- *; apply case_SLcomp; intros.
13: assumption.
(* assenv *)elim (diff_comp_lift s1 s2 s H6).
(* mapenv *)elim (diff_cons_lift a s1 s H6).
(* shiftcons *)elim (diff_shift_lift s H6).
(* shiftlift1 *)elim (diff_shift_lift s H6).
(* shiftlift2 *)elim (diff_shift_lift s H6).
(* lift1 *)
rewrite (proj_lift s1 s H6); apply H.
(* lift2 *)
rewrite (proj_lift s1 s H6); apply H0.
(* liftenv *)
rewrite (proj_lift s1 s H6); apply H1.
(* idl *)elim (diff_id_lift s H6).
(* idr *)
assumption.
(* contexte gauche *)
apply H3; assumption.
(* contexte droit *)
apply H4; assumption.
Save case_SLcomp2.
(*** (env (var O) (comp (lift s) t)) SL ? ***)
Goal
forall (P : terms -> Prop) (s t : sub_explicits),
P (env (var 0) t) ->
(forall x' : sub_explicits,
e_relSL _ (comp (lift s) t) x' -> P (env (var 0) x')) ->
forall M : terms, e_relSL _ (env (var 0) (comp (lift s) t)) M -> P M.
intros.
cut (var 0 = var 0).
2: auto.
cut (comp (lift s) t = comp (lift s) t).
2: auto.
pattern (var 0) at 1, (comp (lift s) t) at 1, M in |- *; apply case_SLenv;
intros.
15: assumption.
(* app *)elim (diff_var_app 0 a1 b1 (sym_equal H3)).
(* lambda *)elim (diff_var_lambda 0 a1 (sym_equal H3)).
(* clos *)elim (diff_var_env 0 a1 s1 (sym_equal H3)).
(* varshift1 *)elim (diff_shift_comp (lift s) t H2).
(* varshift2 *)elim (diff_shift_lift s (proj_comp1 shift (lift s) s1 t H2)).
(* fvarcons *)elim (diff_cons_comp a1 s1 (lift s) t H2).
(* fvarlift1 *)elim (diff_comp_lift (lift s) t s1 (sym_equal H2)).
(* fvarlift2 *)
rewrite (proj_comp2 (lift s1) (lift s) s2 t H2); assumption.
(* rvarcons *)elim (diff_cons_comp a1 s1 (lift s) t H2).
(* rvarlift1 *)elim (diff_comp_lift (lift s) t s1 (sym_equal H2)).
(* rvarlift2 *)elim (O_S n (sym_equal (proj_var (S n) 0 H3))).
(* id *)elim (diff_id_comp (lift s) t H2).
(* contexte gauche*)elim (case_SLvar 0 a' H2).
(* contexte droit *)apply H0; assumption.
Save case_SL_fvarlift2.
(*** (env (var (S n)) (cons a s)) SL ? ***)
Goal
forall (P : terms -> Prop) (n : nat) (a : terms) (s : sub_explicits),
P (env (var n) s) ->
(forall x' : sub_explicits, e_relSL _ (cons a s) x' -> P (env (var (S n)) x')) ->
forall M : terms, e_relSL _ (env (var (S n)) (cons a s)) M -> P M.
intros P n a s H H0 M H1.
cut (var (S n) = var (S n)).
2: auto.
cut (cons a s = cons a s).
2: auto.
pattern (var (S n)) at 1, (cons a s) at 1, M in |- *; apply case_SLenv;
intros.
15: assumption.
(* app *)elim (diff_var_app (S n) a1 b1 (sym_equal H3)).
(* lambda *)elim (diff_var_lambda (S n) a1 (sym_equal H3)).
(* clos *)elim (diff_var_env (S n) a1 s1 (sym_equal H3)).
(* varshift1 *)elim (diff_shift_cons a s H2).
(* varshift2 *)elim (diff_cons_comp a s shift s1 (sym_equal H2)).
(* fvarcons *)elim (O_S n (proj_var 0 (S n) H3)).
(* fvarlift1 *)elim (diff_cons_lift a s s1 (sym_equal H2)).
(* fvarlift2 *)elim (diff_cons_comp a s (lift s1) s2 (sym_equal H2)).
(* rvarcons *)
rewrite (eq_add_S n0 n (proj_var (S n0) (S n) H3)).
rewrite (proj_cons2 a1 a s1 s H2); assumption.
(* rvarlift1 *)elim (diff_cons_lift a s s1 (sym_equal H2)).
(* rvarlift2 *)elim (diff_cons_comp a s (lift s1) s2 (sym_equal H2)).
(* id *)elim (diff_id_cons a s H2).
(* contexte gauche*)elim (case_SLvar (S n) a' H2).
(* contexte droit *)apply H0; assumption.
Save case_SL_rvarcons.
(*** (env (var (S n)) (lift s)) SL ? ***)
Goal
forall (P : terms -> Prop) (n : nat) (s : sub_explicits),
P (env (var n) (comp s shift)) ->
(forall x' : sub_explicits, e_relSL _ (lift s) x' -> P (env (var (S n)) x')) ->
forall M : terms, e_relSL _ (env (var (S n)) (lift s)) M -> P M.
intros P n s H H0 M H1.
cut (var (S n) = var (S n)).
2: auto.
cut (lift s = lift s).
2: auto.
pattern (var (S n)) at 1, (lift s) at 1, M in |- *; apply case_SLenv; intros.
15: assumption.
(* app *)elim (diff_var_app (S n) a1 b1 (sym_equal H3)).
(* lambda *)elim (diff_var_lambda (S n) a1 (sym_equal H3)).
(* clos *)elim (diff_var_env (S n) a1 s1 (sym_equal H3)).
(* varshift1 *)elim (diff_shift_lift s H2).
(* varshift2 *)elim (diff_comp_lift shift s1 s H2).
(* fvarcons *)elim (O_S n (proj_var 0 (S n) H3)).
(* fvarlift1 *)elim (O_S n (proj_var 0 (S n) H3)).
(* fvarlift2 *)elim (O_S n (proj_var 0 (S n) H3)).
(* rvarcons *)elim (diff_cons_lift a1 s1 s H2).
(* rvarlift1 *)
rewrite (eq_add_S n0 n (proj_var (S n0) (S n) H3)).
rewrite (proj_lift s1 s H2); assumption.
(* rvarlift2 *)elim (diff_comp_lift (lift s1) s2 s H2).
(* id *)elim (diff_id_lift s H2).
(* contexte gauche*)elim (case_SLvar (S n) a' H2).
(* contexte droit *)apply H0; assumption.
Save case_SL_rvarlift1.
(*** (env (var (S n)) (comp (lift s) t)) SL ? ***)
Goal
forall (P : terms -> Prop) (n : nat) (s t : sub_explicits),
P (env (var n) (comp s (comp shift t))) ->
(forall x' : sub_explicits,
e_relSL _ (comp (lift s) t) x' -> P (env (var (S n)) x')) ->
forall M : terms, e_relSL _ (env (var (S n)) (comp (lift s) t)) M -> P M.
intros P n s t H H0 M H1.
cut (var (S n) = var (S n)).
2: auto.
cut (comp (lift s) t = comp (lift s) t).
2: auto.
pattern (var (S n)) at 1, (comp (lift s) t) at 1, M in |- *; apply case_SLenv;
intros.
15: assumption.
(* app *)elim (diff_var_app (S n) a1 b1 (sym_equal H3)).
(* lambda *)elim (diff_var_lambda (S n) a1 (sym_equal H3)).
(* clos *)elim (diff_var_env (S n) a1 s1 (sym_equal H3)).
(* varshift1 *)elim (diff_shift_comp (lift s) t H2).
(* varshift2 *)elim (diff_shift_lift s (proj_comp1 shift (lift s) s1 t H2)).
(* fvarcons *)elim (diff_cons_comp a1 s1 (lift s) t H2).
(* fvarlift1 *)elim (diff_comp_lift (lift s) t s1 (sym_equal H2)).
(* fvarlift2 *)elim (O_S n (proj_var 0 (S n) H3)).
(* rvarcons *)elim (diff_cons_comp a1 s1 (lift s) t H2).
(* rvarlift1 *)elim (diff_comp_lift (lift s) t s1 (sym_equal H2)).
(* rvarlift2 *)
rewrite (eq_add_S n0 n (proj_var (S n0) (S n) H3)).
rewrite (proj_lift s1 s (proj_comp1 (lift s1) (lift s) s2 t H2)).
rewrite (proj_comp2 (lift s1) (lift s) s2 t H2); assumption.
(* id *)elim (diff_id_comp (lift s) t H2).
(* contexte gauche*)elim (case_SLvar (S n) a' H2).
(* contexte droit *)apply H0; assumption.
Save case_SL_rvarlift2.
(*** (comp (comp s t) u) SL ? ***)
Goal
forall (P : sub_explicits -> sub_explicits -> Prop) (s t u : sub_explicits),
P u (comp s (comp t u)) ->
P id (comp s t) ->
(forall x' : sub_explicits, e_relSL _ (comp s t) x' -> P u (comp x' u)) ->
(forall u' : sub_explicits, e_relSL _ u u' -> P u (comp (comp s t) u')) ->
forall M : sub_explicits, e_relSL _ (comp (comp s t) u) M -> P u M.
intros P s t u H H0 H1 H2 M H3.
cut (comp s t = comp s t).
2: auto.
pattern (comp s t) at 1, u, M in |- *; apply case_SLcomp; intros.
13: assumption.
(* assenv *)
rewrite (proj_comp1 s1 s s2 t H4).
rewrite (proj_comp2 s1 s s2 t H4); assumption.
(* mapenv *)elim (diff_cons_comp a s1 s t H4).
(* shiftcons *)elim (diff_shift_comp s t H4).
(* shiftlift1 *)elim (diff_shift_comp s t H4).
(* shiftlift2 *)elim (diff_shift_comp s t H4).
(* lift1 *)elim (diff_comp_lift s t s1 (sym_equal H4)).
(* lift2 *)elim (diff_comp_lift s t s1 (sym_equal H4)).
(* liftenv *)elim (diff_comp_lift s t s1 (sym_equal H4)).
(* idl *)elim (diff_id_comp s t H4).
(* idr *)
assumption.
(* contexte gauche *)
apply H1; assumption.
(* contexte droit *)
apply H2; assumption.
Save case_SL_assenv.
(*** (comp (cons a s) t) SL ? ***)
Goal
forall (P : sub_explicits -> sub_explicits -> Prop)
(a : terms) (s t : sub_explicits),
P t (cons (env a t) (comp s t)) ->
P id (cons a s) ->
(forall x' : sub_explicits, e_relSL _ (cons a s) x' -> P t (comp x' t)) ->
(forall t' : sub_explicits, e_relSL _ t t' -> P t (comp (cons a s) t')) ->
forall M : sub_explicits, e_relSL _ (comp (cons a s) t) M -> P t M.
intros P a s t H H0 H1 H2 M H3.
cut (cons a s = cons a s).
2: auto.
pattern (cons a s) at 1, t, M in |- *; apply case_SLcomp; intros.
13: assumption.
(* assenv *)elim (diff_cons_comp a s s1 s2 (sym_equal H4)).
(* mapenv *)
rewrite (proj_cons1 a0 a s1 s H4).
rewrite (proj_cons2 a0 a s1 s H4); assumption.
(* shiftcons *)elim (diff_shift_cons a s H4).
(* shiftlift1 *)elim (diff_shift_cons a s H4).
(* shiftlift2 *)elim (diff_shift_cons a s H4).
(* lift1 *)elim (diff_cons_lift a s s1 (sym_equal H4)).
(* lift2 *)elim (diff_cons_lift a s s1 (sym_equal H4)).
(* liftenv *)elim (diff_cons_lift a s s1 (sym_equal H4)).
(* idl *)elim (diff_id_cons a s H4).
(* idr *)
assumption.
(* contexte gauche *)
apply H1; assumption.
(* contexte droit *)
apply H2; assumption.
Save case_SL_mapenv.
(*** (comp shift (cons a s)) SL ? ***)
Goal
forall (P : sub_explicits -> Prop) (a : terms) (s : sub_explicits),
P s ->
(forall x' : sub_explicits, e_relSL _ (cons a s) x' -> P (comp shift x')) ->
forall M : sub_explicits, e_relSL _ (comp shift (cons a s)) M -> P M.
intros P a s H H0 M H1.
cut (cons a s = cons a s).
2: auto.
pattern (cons a s) at 1, M in |- *; apply case_SLcomp1; intros.
6: assumption.
(* shiftcons *)
rewrite (proj_cons2 a0 a s1 s H2); assumption.
(* shiftlift1 *)elim (diff_cons_lift a s s1 (sym_equal H2)).
(* shiftlift2 *)elim (diff_cons_comp a s (lift s1) t (sym_equal H2)).
(* idl *)elim (diff_id_cons a s H2).
(* contexte gauche *)
apply H0; assumption.
Save case_SL_shiftcons.
(*** (comp shift (lift s)) SL ? ***)
Goal
forall (P : sub_explicits -> Prop) (s : sub_explicits),
P (comp s shift) ->
(forall x' : sub_explicits, e_relSL _ (lift s) x' -> P (comp shift x')) ->
forall M : sub_explicits, e_relSL _ (comp shift (lift s)) M -> P M.
intros P s H H0 M H1.
cut (lift s = lift s).
2: auto.
pattern (lift s) at 1, M in |- *; apply case_SLcomp1; intros.
6: assumption.
(* shiftcons *)elim (diff_cons_lift a s1 s H2).
(* shiftlift1 *)
rewrite (proj_lift s1 s H2); assumption.
(* shiftlift2 *)elim (diff_comp_lift (lift s1) t s H2).
(* idl *)elim (diff_id_lift s H2).
(* contexte gauche *)
apply H0; assumption.
Save case_SL_shiflift1.
(*** (comp shift (comp (lift s) t)) SL ? ***)
Goal
forall (P : sub_explicits -> Prop) (s t : sub_explicits),
P (comp s (comp shift t)) ->
(forall x' : sub_explicits,
e_relSL _ (comp (lift s) t) x' -> P (comp shift x')) ->
forall M : sub_explicits, e_relSL _ (comp shift (comp (lift s) t)) M -> P M.
intros P s t H H0 M H1.
cut (comp (lift s) t = comp (lift s) t).
2: auto.
pattern (comp (lift s) t) at 1, M in |- *; apply case_SLcomp1; intros.
6: assumption.
(* shiftcons *)elim (diff_cons_comp a s1 (lift s) t H2).
(* shiftlift1 *)elim (diff_comp_lift (lift s) t s1 (sym_equal H2)).
(* shiftlift2 *)
rewrite (proj_lift s1 s (proj_comp1 (lift s1) (lift s) t0 t H2)).
rewrite (proj_comp2 (lift s1) (lift s) t0 t H2); assumption.
(* idl *)elim (diff_id_comp (lift s) t H2).
(* contexte gauche *)
apply H0; assumption.
Save case_SL_shiflift2.
(*** (comp (lift s) (lift t)) SL ? ***)
Goal
forall (P : sub_explicits -> Prop) (s t : sub_explicits),
P (lift (comp s t)) ->
(forall x' : sub_explicits, e_relSL _ (lift s) x' -> P (comp x' (lift t))) ->
(forall x' : sub_explicits, e_relSL _ (lift t) x' -> P (comp (lift s) x')) ->
forall M : sub_explicits, e_relSL _ (comp (lift s) (lift t)) M -> P M.
intros P s t H H0 H1 M H2.
cut (lift t = lift t).
2: auto.
pattern (lift t) at 1, M in |- *; apply case_SLcomp2 with s; intros.
7: assumption.
(* lift1 *)
rewrite (proj_lift t1 t H3); assumption.
(* lift2 *)elim (diff_comp_lift (lift t1) t2 t H3).
(* liftenv *)elim (diff_cons_lift a t1 t H3).
(* idr *)elim (diff_id_lift t H3).
(* contexte gauche *)
apply H0; assumption.
(* contexte droit *)
apply H1; assumption.
Save case_SL_lift1.