]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2A/computation/cpxs_tsts_vector.ma
update in lambdadelta
[helm.git] / matita / matita / contribs / lambdadelta / basic_2A / computation / cpxs_tsts_vector.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_2A/grammar/tsts_vector.ma".
16 include "basic_2A/substitution/lift_vector.ma".
17 include "basic_2A/computation/cpxs_tsts.ma".
18
19 (* CONTEXT-SENSITIVE EXTENDED PARALLEL COMPUTATION ON TERMS *****************)
20
21 (* Vector form of forward lemmas involving same top term structure **********)
22
23 (* Basic_1: was just: nf2_iso_appls_lref *)
24 lemma cpxs_fwd_cnx_vector: ∀h,g,G,L,T.  𝐒⦃T⦄ → ⦃G, L⦄ ⊢ ➡[h, g] 𝐍⦃T⦄ →
25                            ∀Vs,U. ⦃G, L⦄ ⊢ ⒶVs.T ➡*[h, g] U → ⒶVs.T ≂ U.
26 #h #g #G #L #T #H1T #H2T #Vs elim Vs -Vs [ @(cpxs_fwd_cnx … H2T) ] (**) (* /2 width=3 by cpxs_fwd_cnx/ does not work *)
27 #V #Vs #IHVs #U #H
28 elim (cpxs_inv_appl1 … H) -H *
29 [ -IHVs #V0 #T0 #_ #_ #H destruct /2 width=1 by tsts_pair/
30 | #a #W0 #T0 #HT0 #HU
31   lapply (IHVs … HT0) -IHVs -HT0 #HT0
32   elim (tsts_inv_bind_applv_simple … HT0) //
33 | #a #V1 #V2 #V0 #T0 #HV1 #HV12 #HT0 #HU
34   lapply (IHVs … HT0) -IHVs -HT0 #HT0
35   elim (tsts_inv_bind_applv_simple … HT0) //
36 ]
37 qed-.
38
39 lemma cpxs_fwd_sort_vector: ∀h,g,G,L,k,Vs,U. ⦃G, L⦄ ⊢ ⒶVs.⋆k ➡*[h, g] U →
40                             ⒶVs.⋆k ≂ U ∨ ⦃G, L⦄ ⊢ ⒶVs.⋆(next h k) ➡*[h, g] U.
41 #h #g #G #L #k #Vs elim Vs -Vs /2 width=1 by cpxs_fwd_sort/
42 #V #Vs #IHVs #U #H
43 elim (cpxs_inv_appl1 … H) -H *
44 [ -IHVs #V1 #T1 #_ #_ #H destruct /2 width=1 by tsts_pair, or_introl/
45 | #a #W1 #T1 #HT1 #HU
46   elim (IHVs … HT1) -IHVs -HT1 #HT1
47   [ elim (tsts_inv_bind_applv_simple … HT1) //
48   | @or_intror (**) (* explicit constructor *)
49     @(cpxs_trans … HU) -U
50     @(cpxs_strap1 … (ⓐV.ⓛ{a}W1.T1)) /3 width=1 by cpxs_flat_dx, cpr_cpx, cpr_beta/
51   ]
52 | #a #V1 #V2 #V3 #T1 #HV01 #HV12 #HT1 #HU
53   elim (IHVs … HT1) -IHVs -HT1 #HT1
54   [ elim (tsts_inv_bind_applv_simple … HT1) //
55   | @or_intror (**) (* explicit constructor *)
56     @(cpxs_trans … HU) -U
57     @(cpxs_strap1 … (ⓐV1.ⓓ{a}V3.T1)) /3 width=3 by cpxs_flat, cpr_cpx, cpr_theta/
58   ]
59 ]
60 qed-.
61
62
63 (* Basic_1: was just: pr3_iso_appls_beta *)
64 lemma cpxs_fwd_beta_vector: ∀h,g,a,G,L,Vs,V,W,T,U. ⦃G, L⦄ ⊢ ⒶVs.ⓐV.ⓛ{a}W.T ➡*[h, g] U →
65                             ⒶVs. ⓐV. ⓛ{a}W. T ≂ U ∨ ⦃G, L⦄ ⊢ ⒶVs.ⓓ{a}ⓝW.V.T ➡*[h, g] U.
66 #h #g #a #G #L #Vs elim Vs -Vs /2 width=1 by cpxs_fwd_beta/
67 #V0 #Vs #IHVs #V #W #T #U #H
68 elim (cpxs_inv_appl1 … H) -H *
69 [ -IHVs #V1 #T1 #_ #_ #H destruct /2 width=1 by tsts_pair, or_introl/
70 | #b #W1 #T1 #HT1 #HU
71   elim (IHVs … HT1) -IHVs -HT1 #HT1
72   [ elim (tsts_inv_bind_applv_simple … HT1) //
73   | @or_intror (**) (* explicit constructor *)
74     @(cpxs_trans … HU) -U
75     @(cpxs_strap1 … (ⓐV0.ⓛ{b}W1.T1)) /3 width=1 by cpxs_flat_dx, cpr_cpx, cpr_beta/
76   ]
77 | #b #V1 #V2 #V3 #T1 #HV01 #HV12 #HT1 #HU
78   elim (IHVs … HT1) -IHVs -HT1 #HT1
79   [ elim (tsts_inv_bind_applv_simple … HT1) //
80   | @or_intror (**) (* explicit constructor *)
81     @(cpxs_trans … HU) -U
82     @(cpxs_strap1 … (ⓐV1.ⓓ{b}V3.T1)) /3 width=3 by cpxs_flat, cpr_cpx, cpr_theta/
83   ]
84 ]
85 qed-.
86
87 lemma cpxs_fwd_delta_vector: ∀h,g,I,G,L,K,V1,i. ⬇[i] L ≡ K.ⓑ{I}V1 →
88                              ∀V2. ⬆[0, i + 1] V1 ≡ V2 →
89                              ∀Vs,U. ⦃G, L⦄ ⊢ ⒶVs.#i ➡*[h, g] U →
90                              ⒶVs.#i ≂ U ∨ ⦃G, L⦄ ⊢ ⒶVs.V2 ➡*[h, g] U.
91 #h #g #I #G #L #K #V1 #i #HLK #V2 #HV12 #Vs elim Vs -Vs /2 width=5 by cpxs_fwd_delta/
92 #V #Vs #IHVs #U #H -K -V1
93 elim (cpxs_inv_appl1 … H) -H *
94 [ -IHVs #V0 #T0 #_ #_ #H destruct /2 width=1 by tsts_pair, or_introl/
95 | #b #W0 #T0 #HT0 #HU
96   elim (IHVs … HT0) -IHVs -HT0 #HT0
97   [ elim (tsts_inv_bind_applv_simple … HT0) //
98   | @or_intror -i (**) (* explicit constructor *)
99     @(cpxs_trans … HU) -U
100     @(cpxs_strap1 … (ⓐV.ⓛ{b}W0.T0)) /3 width=1 by cpxs_flat_dx, cpr_cpx, cpr_beta/
101   ]
102 | #b #V0 #V1 #V3 #T0 #HV0 #HV01 #HT0 #HU
103   elim (IHVs … HT0) -IHVs -HT0 #HT0
104   [ elim (tsts_inv_bind_applv_simple … HT0) //
105   | @or_intror -i (**) (* explicit constructor *)
106     @(cpxs_trans … HU) -U
107     @(cpxs_strap1 … (ⓐV0.ⓓ{b}V3.T0)) /3 width=3 by cpxs_flat, cpr_cpx, cpr_theta/
108   ]
109 ]
110 qed-.
111
112 (* Basic_1: was just: pr3_iso_appls_abbr *)
113 lemma cpxs_fwd_theta_vector: ∀h,g,G,L,V1s,V2s. ⬆[0, 1] V1s ≡ V2s →
114                              ∀a,V,T,U. ⦃G, L⦄ ⊢ ⒶV1s.ⓓ{a}V.T ➡*[h, g] U →
115                              ⒶV1s. ⓓ{a}V. T ≂ U ∨ ⦃G, L⦄ ⊢ ⓓ{a}V.ⒶV2s.T ➡*[h, g] U.
116 #h #g #G #L #V1s #V2s * -V1s -V2s /3 width=1 by or_intror/
117 #V1s #V2s #V1a #V2a #HV12a #HV12s #a
118 generalize in match HV12a; -HV12a
119 generalize in match V2a; -V2a
120 generalize in match V1a; -V1a
121 elim HV12s -V1s -V2s /2 width=1 by cpxs_fwd_theta/
122 #V1s #V2s #V1b #V2b #HV12b #_ #IHV12s #V1a #V2a #HV12a #V #T #U #H
123 elim (cpxs_inv_appl1 … H) -H *
124 [ -IHV12s -HV12a -HV12b #V0 #T0 #_ #_ #H destruct /2 width=1 by tsts_pair, or_introl/
125 | #b #W0 #T0 #HT0 #HU
126   elim (IHV12s … HV12b … HT0) -IHV12s -HT0 #HT0
127   [ -HV12a -HV12b -HU
128     elim (tsts_inv_pair1 … HT0) #V1 #T1 #H destruct
129   | @or_intror -V1s (**) (* explicit constructor *)
130     @(cpxs_trans … HU) -U
131     elim (cpxs_inv_abbr1 … HT0) -HT0 *
132     [ -HV12a -HV12b #V1 #T1 #_ #_ #H destruct
133     | -V1b #X #HT1 #H #H0 destruct
134       elim (lift_inv_bind1 … H) -H #W1 #T1 #HW01 #HT01 #H destruct
135       @(cpxs_trans … (+ⓓV.ⓐV2a.ⓛ{b}W1.T1)) [ /3 width=1 by cpxs_flat_dx, cpxs_bind_dx/ ] -T -V2b -V2s
136       @(cpxs_strap2 … (ⓐV1a.ⓛ{b}W0.T0))
137       /4 width=7 by cpxs_beta_dx, cpx_zeta, lift_bind, lift_flat/
138     ]
139   ]
140 | #b #V0a #Va #V0 #T0 #HV10a #HV0a #HT0 #HU
141   elim (IHV12s … HV12b … HT0) -HV12b -IHV12s -HT0 #HT0
142   [ -HV12a -HV10a -HV0a -HU
143     elim (tsts_inv_pair1 … HT0) #V1 #T1 #H destruct
144   | @or_intror -V1s -V1b (**) (* explicit constructor *)
145     @(cpxs_trans … HU) -U
146     elim (cpxs_inv_abbr1 … HT0) -HT0 *
147     [ #V1 #T1 #HV1 #HT1 #H destruct
148       lapply (cpxs_lift … HV10a (L.ⓓV) (Ⓕ) … HV12a … HV0a) -V1a -V0a [ /2 width=1 by drop_drop/ ] #HV2a
149       @(cpxs_trans … (ⓓ{a}V.ⓐV2a.T1)) /3 width=1 by cpxs_bind, cpxs_pair_sn, cpxs_flat_dx, cpxs_bind_dx/
150     | #X #HT1 #H #H0 destruct
151       elim (lift_inv_bind1 … H) -H #V1 #T1 #HW01 #HT01 #H destruct
152       lapply (cpxs_lift … HV10a (L.ⓓV0) (Ⓕ) … HV12a … HV0a) -V0a [ /2 width=1 by drop_drop/ ] #HV2a
153       @(cpxs_trans … (+ⓓV.ⓐV2a.ⓓ{b}V1.T1)) [ /3 width=1 by cpxs_flat_dx, cpxs_bind_dx/ ] -T -V2b -V2s
154       @(cpxs_strap2 … (ⓐV1a.ⓓ{b}V0.T0)) [ /4 width=7 by cpx_zeta, lift_bind, lift_flat/ ] -V -V1 -T1
155       @(cpxs_strap2 … (ⓓ{b}V0.ⓐV2a.T0)) /3 width=3 by cpxs_pair_sn, cpxs_bind_dx, cpr_cpx, cpr_theta/
156     ]
157   ]
158 ]
159 qed-.
160
161 (* Basic_1: was just: pr3_iso_appls_cast *)
162 lemma cpxs_fwd_cast_vector: ∀h,g,G,L,Vs,W,T,U. ⦃G, L⦄ ⊢ ⒶVs.ⓝW.T ➡*[h, g] U →
163                             ∨∨ ⒶVs. ⓝW. T ≂ U
164                              | ⦃G, L⦄ ⊢ ⒶVs.T ➡*[h, g] U
165                              | ⦃G, L⦄ ⊢ ⒶVs.W ➡*[h, g] U.
166 #h #g #G #L #Vs elim Vs -Vs /2 width=1 by cpxs_fwd_cast/
167 #V #Vs #IHVs #W #T #U #H
168 elim (cpxs_inv_appl1 … H) -H *
169 [ -IHVs #V0 #T0 #_ #_ #H destruct /2 width=1 by tsts_pair, or3_intro0/
170 | #b #W0 #T0 #HT0 #HU elim (IHVs … HT0) -IHVs -HT0 #HT0
171   [ elim (tsts_inv_bind_applv_simple … HT0) //
172   | @or3_intro1 -W (**) (* explicit constructor *)
173     @(cpxs_trans … HU) -U
174     @(cpxs_strap1 … (ⓐV.ⓛ{b}W0.T0)) /2 width=1 by cpxs_flat_dx, cpx_beta/
175   | @or3_intro2 -T (**) (* explicit constructor *)
176     @(cpxs_trans … HU) -U
177     @(cpxs_strap1 … (ⓐV.ⓛ{b}W0.T0)) /2 width=1 by cpxs_flat_dx, cpx_beta/
178   ]
179 | #b #V0 #V1 #V2 #T0 #HV0 #HV01 #HT0 #HU
180   elim (IHVs … HT0) -IHVs -HT0 #HT0
181   [ elim (tsts_inv_bind_applv_simple … HT0) //
182   | @or3_intro1 -W (**) (* explicit constructor *)
183     @(cpxs_trans … HU) -U
184     @(cpxs_strap1 … (ⓐV0.ⓓ{b}V2.T0)) /2 width=3 by cpxs_flat, cpx_theta/
185   | @or3_intro2 -T (**) (* explicit constructor *)
186     @(cpxs_trans … HU) -U
187     @(cpxs_strap1 … (ⓐV0.ⓓ{b}V2.T0)) /2 width=3 by cpxs_flat, cpx_theta/
188   ]
189 ]
190 qed-.