]> matita.cs.unibo.it Git - helm.git/blob - helm/coq-contribs/LAMBDA-TYPES/subst1_gen.v
ocaml 3.09 transition
[helm.git] / helm / coq-contribs / LAMBDA-TYPES / subst1_gen.v
1 (*#* #stop file *)
2
3 Require subst0_gen.
4 Require subst1_defs.
5
6    Section subst1_gen_lift. (************************************************)
7
8       Theorem subst1_gen_lift_lt : (u,t1,x:?; i,h,d:?) (subst1 i (lift h d u) (lift h (S (plus i d)) t1) x) ->
9                                    (EX t2 | x = (lift h (S (plus i d)) t2) & (subst1 i u t1 t2)).
10       Intros; XElim H; Clear x; Intros;
11       Try Subst0Gen; XEAuto.
12       Qed.
13
14       Theorem subst1_gen_lift_eq : (t,u,x:?; h,d,i:?)
15                                    (le d i) -> (lt i (plus d h)) ->
16                                    (subst1 i u (lift h d t) x) ->
17                                    x = (lift h d t).
18       Intros; XElim H1; Clear x; Intros;
19       Try Subst0Gen; XAuto.
20       Qed.
21
22       Theorem subst1_gen_lift_ge : (u,t1,x:?; i,h,d:?) (subst1 i u (lift h d t1) x) ->
23                                    (le (plus d h) i) ->
24                                    (EX t2 | x = (lift h d t2) & (subst1 (minus i h) u t1 t2)).
25       Intros; XElim H; Clear x; Intros;
26       Try Subst0Gen; XEAuto.
27       Qed.
28
29    End subst1_gen_lift.
30
31       Tactic Definition Subst1Gen :=
32          Match Context With
33             | [ H: (subst1 ?0 (lift ?1 ?2 ?3) (lift ?1 (S (plus ?0 ?2)) ?4) ?5) |- ? ] ->
34                LApply (subst1_gen_lift_lt ?3 ?4 ?5 ?0 ?1 ?2); [ Clear H; Intros H | XAuto ];
35                XElim H; Intros
36             | [ H: (subst1 ?0 ?1 (lift (1) ?0 ?2) ?3) |- ? ] ->
37                LApply (subst1_gen_lift_eq ?2 ?1 ?3 (1) ?0 ?0); [ Intros H_x | XAuto ];
38                LApply H_x; [ Clear H_x; Intros H_x | Rewrite plus_sym; XAuto ];
39                LApply H_x; [ Clear H H_x; Intros | XAuto ]
40             | [ H0: (subst1 ?0 ?1 (lift (1) ?4 ?2) ?3); H1: (lt ?4 ?0) |- ? ] ->
41                LApply (subst1_gen_lift_ge ?1 ?2 ?3 ?0 (1) ?4); [ Clear H0; Intros H0 | XAuto ];
42                LApply H0; [ Clear H0; Intros H0 | Rewrite plus_sym; XAuto ];
43                XElim H0; Intros
44             | _ -> Subst1GenBase.