]> matita.cs.unibo.it Git - helm.git/blob - helm/coq-contribs/LAMBDA-TYPES/pr2_subst1.v
contribution about \lambda-\delta
[helm.git] / helm / coq-contribs / LAMBDA-TYPES / pr2_subst1.v
1 (*#* #stop file *)
2
3 Require subst1_defs.
4 Require subst1_confluence.
5 Require drop_props.
6 Require pr0_subst1.
7 Require pr2_defs.
8
9    Section pr2_subst1_props. (***********************************************)
10
11       Theorem pr2_delta1: (c,d:?; u:?; i:?) (drop i (0) c (CTail d (Bind Abbr) u)) ->
12                           (t1,t2:?) (subst1 i u t1 t2) -> (pr2 c t1 t2).
13       Intros; XElim H0; Clear t2; XEAuto.
14       Qed.
15
16       Hints Resolve pr2_delta1 : ltlc.
17
18       Theorem pr2_subst1: (c,e:?; v:?; i:?) (drop i (0) c (CTail e (Bind Abbr) v)) ->
19                           (t1,t2:?) (pr2 c t1 t2) ->
20                           (w1:?) (subst1 i v t1 w1) ->
21                           (EX w2 | (pr2 c w1 w2) & (subst1 i v t2 w2)).
22      Intros until 2; XElim H0; Intros.
23 (* case 1: pr2_pr0 *)
24      Pr0Subst1; XEAuto.
25 (* case 2: pr2_delta *)
26      Apply (neq_eq_e i i0); Intros.
27 (* case 2.1: i <> i0 *)
28      Subst1Confluence; XEAuto.
29 (* case 2.2: i = i0 *)
30      Rewrite <- H3 in H0; Rewrite <- H3 in H1; Clear H3 i0.
31      DropDis; Inversion H0; Rewrite H5 in H2; Clear H0 H4 H5 e v.
32      Subst1Confluence; XEAuto.
33      Qed.
34
35    End pr2_subst1_props.
36
37       Hints Resolve pr2_delta1 : ltlc.
38
39       Tactic Definition Pr2Subst1 :=
40          Match Context With
41             | [ H0: (drop ?1 (0) ?2 (CTail ?3 (Bind Abbr) ?4));
42                 H1: (pr2 ?2 ?5 ?6); H3: (subst1 ?1 ?4 ?5 ?7) |- ? ] ->
43                LApply (pr2_subst1 ?2 ?3 ?4 ?1); [ Intros H_x | XAuto ];
44                LApply (H_x ?5 ?6); [ Clear H_x H1; Intros H1 | XAuto ];
45                LApply (H1 ?7); [ Clear H1; Intros H1 | XAuto ];
46                XElim H1; Intros.