]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/computation/cpxs_cpxs.ma
8017af6bfab8eacc9b0bb4d49c262252ef73b9ea
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / computation / cpxs_cpxs.ma
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 include "basic_2/reduction/lpx_ldrop.ma".
16 include "basic_2/computation/cpxs_lift.ma".
17
18 (* CONTEXT-SENSITIVE EXTENDED PARALLEL COMPUTATION ON TERMS *****************)
19
20 (* Main properties **********************************************************)
21
22 theorem cpxs_trans: ∀h,g,L. Transitive … (cpxs h g L).
23 #h #g #L #T1 #T #HT1 #T2 @trans_TC @HT1 qed-. (**) (* auto /3 width=3/ does not work because a δ-expansion gets in the way *)
24
25 theorem cpxs_bind: ∀h,g,a,I,L,V1,V2,T1,T2. ⦃h, L.ⓑ{I}V1⦄ ⊢ T1 ➡*[g] T2 →
26                    ⦃h, L⦄ ⊢ V1 ➡*[g] V2 →
27                    ⦃h, L⦄ ⊢ ⓑ{a,I}V1.T1 ➡*[g] ⓑ{a,I}V2.T2.
28 #h #g #a #I #L #V1 #V2 #T1 #T2 #HT12 #H @(cpxs_ind … H) -V2 /2 width=1/
29 #V #V2 #_ #HV2 #IHV1
30 @(cpxs_trans … IHV1) -V1 /2 width=1/
31 qed.
32
33 theorem cpxs_flat: ∀h,g,I,L,V1,V2,T1,T2. ⦃h, L⦄ ⊢ T1 ➡*[g] T2 →
34                    ⦃h, L⦄ ⊢ V1 ➡*[g] V2 →
35                    ⦃h, L⦄ ⊢ ⓕ{I} V1.T1 ➡*[g] ⓕ{I} V2.T2.
36 #h #g #I #L #V1 #V2 #T1 #T2 #HT12 #H @(cpxs_ind … H) -V2 /2 width=1/
37 #V #V2 #_ #HV2 #IHV1
38 @(cpxs_trans … IHV1) -IHV1 /2 width=1/
39 qed.
40
41 theorem cpxs_beta_rc: ∀h,g,a,L,V1,V2,W1,W2,T1,T2.
42                       ⦃h, L⦄ ⊢ V1 ➡[g] V2 → ⦃h, L.ⓛW1⦄ ⊢ T1 ➡*[g] T2 → ⦃h, L⦄ ⊢ W1 ➡*[g] W2 →
43                       ⦃h, L⦄ ⊢ ⓐV1.ⓛ{a}W1.T1 ➡*[g] ⓓ{a}ⓝW2.V2.T2.
44 #h #g #a #L #V1 #V2 #W1 #W2 #T1 #T2 #HV12 #HT12 #H @(cpxs_ind … H) -W2 /2 width=1/
45 #W #W2 #_ #HW2 #IHW1
46 @(cpxs_trans … IHW1) -IHW1 /3 width=1/
47 qed.
48
49 theorem cpxs_beta: ∀h,g,a,L,V1,V2,W1,W2,T1,T2.
50                    ⦃h, L.ⓛW1⦄ ⊢ T1 ➡*[g] T2 → ⦃h, L⦄ ⊢ W1 ➡*[g] W2 → ⦃h, L⦄ ⊢ V1 ➡*[g] V2 →
51                    ⦃h, L⦄ ⊢ ⓐV1.ⓛ{a}W1.T1 ➡*[g] ⓓ{a}ⓝW2.V2.T2.
52 #h #g #a #L #V1 #V2 #W1 #W2 #T1 #T2 #HT12 #HW12 #H @(cpxs_ind … H) -V2 /2 width=1/
53 #V #V2 #_ #HV2 #IHV1
54 @(cpxs_trans … IHV1) -IHV1 /3 width=1/
55 qed.
56
57 theorem cpxs_theta_rc: ∀h,g,a,L,V1,V,V2,W1,W2,T1,T2.
58                        ⦃h, L⦄ ⊢ V1 ➡[g] V → ⇧[0, 1] V ≡ V2 →
59                        ⦃h, L.ⓓW1⦄ ⊢ T1 ➡*[g] T2 → ⦃h, L⦄ ⊢ W1 ➡*[g] W2 →
60                        ⦃h, L⦄ ⊢ ⓐV1.ⓓ{a}W1.T1 ➡*[g] ⓓ{a}W2.ⓐV2.T2.
61 #h #g #a #L #V1 #V #V2 #W1 #W2 #T1 #T2 #HV1 #HV2 #HT12 #H elim H -W2 /2 width=3/
62 #W #W2 #_ #HW2 #IHW1
63 @(cpxs_trans … IHW1) -IHW1 /2 width=1/
64 qed.
65
66 theorem cpxs_theta: ∀h,g,a,L,V1,V,V2,W1,W2,T1,T2.
67                     ⇧[0, 1] V ≡ V2 → ⦃h, L⦄ ⊢ W1 ➡*[g] W2 →
68                     ⦃h, L.ⓓW1⦄ ⊢ T1 ➡*[g] T2 → ⦃h, L⦄ ⊢ V1 ➡*[g] V →
69                     ⦃h, L⦄ ⊢ ⓐV1.ⓓ{a}W1.T1 ➡*[g] ⓓ{a}W2.ⓐV2.T2.
70 #h #g #a #L #V1 #V #V2 #W1 #W2 #T1 #T2 #HV2 #HW12 #HT12 #H @(TC_ind_dx … V1 H) -V1 /2 width=3/
71 #V1 #V0 #HV10 #_ #IHV0
72 @(cpxs_trans … IHV0) -IHV0 /2 width=1/
73 qed.
74
75 (* Advanced inversion lemmas ************************************************)
76
77 lemma cpxs_inv_appl1: ∀h,g,L,V1,T1,U2. ⦃h, L⦄ ⊢ ⓐV1.T1 ➡*[g] U2 →
78                       ∨∨ ∃∃V2,T2.       ⦃h, L⦄ ⊢ V1 ➡*[g] V2 & ⦃h, L⦄ ⊢ T1 ➡*[g] T2 &
79                                         U2 = ⓐV2. T2
80                        | ∃∃a,W,T.       ⦃h, L⦄ ⊢ T1 ➡*[g] ⓛ{a}W.T & ⦃h, L⦄ ⊢ ⓓ{a}ⓝW.V1.T ➡*[g] U2
81                        | ∃∃a,V0,V2,V,T. ⦃h, L⦄ ⊢ V1 ➡*[g] V0 & ⇧[0,1] V0 ≡ V2 &
82                                         ⦃h, L⦄ ⊢ T1 ➡*[g] ⓓ{a}V.T & ⦃h, L⦄ ⊢ ⓓ{a}V.ⓐV2.T ➡*[g] U2.
83 #h #g #L #V1 #T1 #U2 #H @(cpxs_ind … H) -U2 [ /3 width=5/ ]
84 #U #U2 #_ #HU2 * *
85 [ #V0 #T0 #HV10 #HT10 #H destruct
86   elim (cpx_inv_appl1 … HU2) -HU2 *
87   [ #V2 #T2 #HV02 #HT02 #H destruct /4 width=5/
88   | #a #V2 #W #W2 #T #T2 #HV02 #HW2 #HT2 #H1 #H2 destruct
89     lapply (cpxs_strap1 … HV10 … HV02) -V0 #HV12
90     lapply (lsubx_cpx_trans … HT2 (L.ⓓⓝW.V1) ?) -HT2 /2 width=1/ #HT2
91     @or3_intro1 @(ex2_3_intro … HT10) -HT10 /3 width=1/ (**) (* explicit constructor. /5 width=8/ is too slow because TC_transitive gets in the way *)
92   | #a #V #V2 #W0 #W2 #T #T2 #HV0 #HV2 #HW02 #HT2 #H1 #H2 destruct
93     @or3_intro2 @(ex4_5_intro … HV2 HT10) /2 width=3/ /3 width=1/ (**) (* explicit constructor. /5 width=8/ is too slow because TC_transitive gets in the way *)
94   ]
95 | /4 width=9/
96 | /4 width=11/
97 ]
98 qed-.
99
100 (* Properties on sn extended parallel reduction for local environments ******)
101
102 lemma lpx_cpx_trans: ∀h,g. s_r_trans … (cpx h g) (lpx h g).
103 #h #g #L2 #T1 #T2 #HT12 elim HT12 -L2 -T1 -T2
104 [ /2 width=3/
105 | /3 width=2/
106 | #I #L2 #K2 #V0 #V2 #W2 #i #HLK2 #_ #HVW2 #IHV02 #L1 #HL12
107   elim (lpx_ldrop_trans_O1 … HL12 … HLK2) -L2 #X #HLK1 #H
108   elim (lpx_inv_pair2 … H) -H #K1 #V1 #HK12 #HV10 #H destruct
109   lapply (IHV02 … HK12) -K2 #HV02
110   lapply (cpxs_strap2 … HV10 … HV02) -V0 /2 width=7/
111 | #a #I #L2 #V1 #V2 #T1 #T2 #_ #_ #IHV12 #IHT12 #L1 #HL12
112   lapply (IHT12 (L1.ⓑ{I}V1) ?) -IHT12 /2 width=1/ /3 width=1/
113 |5,7,8: /3 width=1/
114 | #L2 #V2 #T1 #T #T2 #_ #HT2 #IHT1 #L1 #HL12
115   lapply (IHT1 (L1.ⓓV2) ?) -IHT1 /2 width=1/ /2 width=3/
116 | #a #L2 #V1 #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #IHV12 #IHW12 #IHT12 #L1 #HL12
117   lapply (IHT12 (L1.ⓛW1) ?) -IHT12 /2 width=1/ /3 width=1/
118 | #a #L2 #V1 #V #V2 #W1 #W2 #T1 #T2 #_ #HV2 #_ #_ #IHV1 #IHW12 #IHT12 #L1 #HL12
119   lapply (IHT12 (L1.ⓓW1) ?) -IHT12 /2 width=1/ /3 width=3/
120 ]
121 qed-.
122
123 lemma cpx_bind2: ∀h,g,L,V1,V2. ⦃h, L⦄ ⊢ V1 ➡[g] V2 →
124                  ∀I,T1,T2. ⦃h, L.ⓑ{I}V2⦄ ⊢ T1 ➡[g] T2 →
125                  ∀a. ⦃h, L⦄ ⊢ ⓑ{a,I}V1.T1 ➡*[g] ⓑ{a,I}V2.T2.
126 #h #g #L #V1 #V2 #HV12 #I #T1 #T2 #HT12
127 lapply (lpx_cpx_trans … HT12 (L.ⓑ{I}V1) ?) /2 width=1/
128 qed.
129
130 (* Advanced properties ******************************************************)
131
132 lemma lpx_cpxs_trans: ∀h,g. s_rs_trans … (cpx h g) (lpx h g).
133 /3 width=5 by s_r_trans_TC1, lpx_cpx_trans/ qed-.
134
135 lemma cpxs_bind2_dx: ∀h,g,L,V1,V2. ⦃h, L⦄ ⊢ V1 ➡[g] V2 →
136                      ∀I,T1,T2. ⦃h, L.ⓑ{I}V2⦄ ⊢ T1 ➡*[g] T2 →
137                      ∀a. ⦃h, L⦄ ⊢ ⓑ{a,I}V1.T1 ➡*[g] ⓑ{a,I}V2.T2.
138 #h #g #L #V1 #V2 #HV12 #I #T1 #T2 #HT12
139 lapply (lpx_cpxs_trans … HT12 (L.ⓑ{I}V1) ?) /2 width=1/
140 qed.