]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/computation/cpxs_tstc_vector.ma
partial commit of the components before "conversion"
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / computation / cpxs_tstc_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_2/grammar/tstc_vector.ma".
16 include "basic_2/relocation/lift_vector.ma".
17 include "basic_2/computation/cpxs_tstc.ma".
18
19 (* CONTEXT-SENSITIVE EXTENDED PARALLEL COMPUTATION ON TERMS *****************)
20
21 (* Vector form of forward lemmas involving same top term constructor ********)
22
23 (* Basic_1: was just: nf2_iso_appls_lref *)
24 lemma cpxs_fwd_cnx_vector: ∀h,g,L,T.  𝐒⦃T⦄ → ⦃h, L⦄ ⊢ 𝐍[g]⦃T⦄ →
25                            ∀Vs,U. ⦃h, L⦄ ⊢ ⒶVs.T ➡*[g] U → ⒶVs.T ≃ U.
26 #h #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/
30 | #a #V0 #W0 #T0 #HV0 #HT0 #HU
31   lapply (IHVs … HT0) -IHVs -HT0 #HT0
32   elim (tstc_inv_bind_appls_simple … HT0) //
33 | #a #V1 #V2 #V0 #T0 #HV1 #HV12 #HT0 #HU
34   lapply (IHVs … HT0) -IHVs -HT0 #HT0
35   elim (tstc_inv_bind_appls_simple … HT0) //
36 ]
37 qed-.
38
39 (* Basic_1: was just: pr3_iso_appls_beta *)
40 lemma cpxs_fwd_beta_vector: ∀h,g,a,L,Vs,V,W,T,U. ⦃h, L⦄ ⊢ ⒶVs.ⓐV.ⓛ{a}W.T ➡*[g] U →
41                             ⒶVs. ⓐV. ⓛ{a}W. T ≃ U ∨
42                             ∃∃T0.⦃h, L.ⓛW⦄ ⊢ T ➡*[g] T0 & ⦃h, L⦄ ⊢ ⒶVs.ⓓ{a}V.T0 ➡*[g] U.
43 #h #g #a #L #Vs elim Vs -Vs /2 width=1 by cpxs_fwd_beta/
44 #V0 #Vs #IHVs #V #W #T #U #H
45 elim (cpxs_inv_appl1 … H) -H *
46 [ -IHVs #V1 #T1 #_ #_ #H destruct /2 width=1/
47 | #b #V1 #W1 #T1 #HV01 #HT1 #HU
48   elim (IHVs … HT1) -IHVs -HT1
49   [ #HT1 elim (tstc_inv_bind_appls_simple … HT1) //
50   | * #T0 #HT0 #HT01
51     @or_intror @(ex2_intro … HT0) -W (**) (* explicit constructor *)
52     @(cpxs_trans … HU) -U
53     @(cpxs_strap1 … (ⓐV1.ⓛ{b}W1.T1)) [ /2 width=1/ ] -V -V0 -Vs -T /3 width=1/
54   ]
55 | #b #V1 #V2 #V3 #T1 #HV01 #HV12 #HT1 #HU
56   elim (IHVs … HT1) -IHVs -HT1
57   [ #HT1 elim (tstc_inv_bind_appls_simple … HT1) //
58   | * #T0 #HT0 #HT01
59     @or_intror @(ex2_intro … HT0) -W (**) (* explicit constructor *)
60     @(cpxs_trans … HU) -U
61     @(cpxs_strap1 … (ⓐV1.ⓓ{b}V3.T1)) [ /2 width=1/ ] -V -V0 -Vs -T /3 width=3/
62   ]
63 ]
64 qed-.
65
66 lemma cpxs_fwd_delta_vector: ∀h,g,I,L,K,V1,i. ⇩[0, i] L ≡ K.ⓑ{I}V1 →
67                              ∀V2. ⇧[0, i + 1] V1 ≡ V2 →
68                              ∀Vs,U. ⦃h, L⦄ ⊢ ⒶVs.#i ➡*[g] U →
69                              ⒶVs.#i ≃ U ∨ ⦃h, L⦄ ⊢ ⒶVs.V2 ➡*[g] U.
70 #h #g #I #L #K #V1 #i #HLK #V2 #HV12 #Vs elim Vs -Vs /2 width=5 by cpxs_fwd_delta/
71 #V #Vs #IHVs #U #H -K -V1
72 elim (cpxs_inv_appl1 … H) -H *
73 [ -IHVs #V0 #T0 #_ #_ #H destruct /2 width=1/
74 | #b #V0 #W0 #T0 #HV0 #HT0 #HU
75   elim (IHVs … HT0) -IHVs -HT0 #HT0
76   [ elim (tstc_inv_bind_appls_simple … HT0) //
77   | @or_intror -i (**) (* explicit constructor *)
78     @(cpxs_trans … HU) -U
79     @(cpxs_strap1 … (ⓐV0.ⓛ{b}W0.T0)) [ /2 width=1/ ] -V -V2 -Vs /3 width=1/
80   ]
81 | #b #V0 #V1 #V3 #T0 #HV0 #HV01 #HT0 #HU
82   elim (IHVs … HT0) -IHVs -HT0 #HT0
83   [ elim (tstc_inv_bind_appls_simple … HT0) //
84   | @or_intror -i (**) (* explicit constructor *)
85     @(cpxs_trans … HU) -U
86     @(cpxs_strap1 … (ⓐV0.ⓓ{b}V3.T0)) [ /2 width=1/ ] -V -V2 -Vs /3 width=3/
87   ]
88 ]
89 qed-.
90
91 (* Basic_1: was just: pr3_iso_appls_abbr *)
92 lemma cpxs_fwd_theta_vector: ∀h,g,L,V1s,V2s. ⇧[0, 1] V1s ≡ V2s →
93                              ∀a,V,T,U. ⦃h, L⦄ ⊢ ⒶV1s.ⓓ{a}V.T ➡*[g] U →
94                              ⒶV1s. ⓓ{a}V. T ≃ U ∨ ⦃h, L⦄ ⊢ ⓓ{a}V.ⒶV2s.T ➡*[g] U.
95 #h #g #L #V1s #V2s * -V1s -V2s /3 width=1/
96 #V1s #V2s #V1a #V2a #HV12a #HV12s #a
97 generalize in match HV12a; -HV12a
98 generalize in match V2a; -V2a
99 generalize in match V1a; -V1a
100 elim HV12s -V1s -V2s /2 width=1 by cpxs_fwd_theta/
101 #V1s #V2s #V1b #V2b #HV12b #_ #IHV12s #V1a #V2a #HV12a #V #T #U #H
102 elim (cpxs_inv_appl1 … H) -H *
103 [ -IHV12s -HV12a -HV12b #V0 #T0 #_ #_ #H destruct /2 width=1/
104 | #b #V0a #W0 #T0 #HV10a #HT0 #HU
105   elim (IHV12s … HV12b … HT0) -IHV12s -HT0 #HT0
106   [ -HV12a -HV12b -HV10a -HU
107     elim (tstc_inv_pair1 … HT0) #V1 #T1 #H destruct
108   | @or_intror -V1s (**) (* explicit constructor *)
109     @(cpxs_trans … HU) -U
110     elim (cpxs_inv_abbr1 … HT0) -HT0 *
111     [ -HV12a -HV12b -HV10a #V1 #T1 #_ #_ #H destruct
112     | -V1b #X #HT1 #H #H0 destruct
113       elim (lift_inv_bind1 … H) -H #W1 #T1 #HW01 #HT01 #H destruct
114       @(cpxs_trans … (+ⓓV.ⓐV2a.ⓛ{b}W1.T1)) [ /3 width=1/ ] -T -V2b -V2s
115       @(cpxs_strap2 … (ⓐV1a.ⓛ{b}W0.T0)) [ /5 width=7/ ] -V -V2a -W1 -T1
116       @(cpxs_strap2 … (ⓓ{b}V1a.T0)) [ /3 width=1/ ] -W0 /2 width=1/
117     ]
118   ]
119 | #b #V0a #Va #V0 #T0 #HV10a #HV0a #HT0 #HU
120   elim (IHV12s … HV12b … HT0) -HV12b -IHV12s -HT0 #HT0
121   [ -HV12a -HV10a -HV0a -HU
122     elim (tstc_inv_pair1 … HT0) #V1 #T1 #H destruct
123   | @or_intror -V1s -V1b (**) (* explicit constructor *)
124     @(cpxs_trans … HU) -U
125     elim (cpxs_inv_abbr1 … HT0) -HT0 *
126     [ #V1 #T1 #HV1 #HT1 #H destruct
127       lapply (cpxs_lift … HV10a (L.ⓓV) … HV12a … HV0a) -V1a -V0a [ /2 width=1/ ] #HV2a
128       @(cpxs_trans … (ⓓ{a}V.ⓐV2a.T1)) [ /3 width=1/ ] -T -V2b -V2s /3 width=1/
129     | #X #HT1 #H #H0 destruct
130       elim (lift_inv_bind1 … H) -H #V1 #T1 #HW01 #HT01 #H destruct
131       lapply (cpxs_lift … HV10a (L.ⓓV0) … HV12a … HV0a) -V0a [ /2 width=1/ ] #HV2a
132       @(cpxs_trans … (+ⓓV.ⓐV2a.ⓓ{b}V1.T1)) [ /3 width=1/ ] -T -V2b -V2s
133       @(cpxs_strap2 … (ⓐV1a.ⓓ{b}V0.T0)) [ /5 width=7/ ] -V -V1 -T1
134       @(cpxs_strap2 … (ⓓ{b}V0.ⓐV2a.T0)) [ /3 width=3/ ] -V1a /3 width=1/
135     ]
136   ]
137 ]
138 qed-.
139
140 (* Basic_1: was just: pr3_iso_appls_cast *)
141 lemma cpxs_fwd_tau_vector: ∀h,g,L,Vs,W,T,U. ⦃h, L⦄ ⊢ ⒶVs.ⓝW.T ➡*[g] U →
142                            ⒶVs. ⓝW. T ≃ U ∨ ⦃h, L⦄ ⊢ ⒶVs.T ➡*[g] U.
143 #h #g #L #Vs elim Vs -Vs /2 width=1 by cpxs_fwd_tau/
144 #V #Vs #IHVs #W #T #U #H
145 elim (cpxs_inv_appl1 … H) -H *
146 [ -IHVs #V0 #T0 #_ #_ #H destruct /2 width=1/
147 | #b #V0 #W0 #T0 #HV0 #HT0 #HU
148   elim (IHVs … HT0) -IHVs -HT0 #HT0
149   [ elim (tstc_inv_bind_appls_simple … HT0) //
150   | @or_intror -W (**) (* explicit constructor *)
151     @(cpxs_trans … HU) -U
152     @(cpxs_strap1 … (ⓐV0.ⓛ{b}W0.T0)) [ /2 width=1/ ] -V -Vs -T /3 width=1/
153   ]
154 | #b #V0 #V1 #V2 #T0 #HV0 #HV01 #HT0 #HU
155   elim (IHVs … HT0) -IHVs -HT0 #HT0
156   [ elim (tstc_inv_bind_appls_simple … HT0) //
157   | @or_intror -W (**) (* explicit constructor *)
158     @(cpxs_trans … HU) -U
159     @(cpxs_strap1 … (ⓐV0.ⓓ{b}V2.T0)) [ /2 width=1/ ] -V -Vs -T /3 width=3/
160   ]
161 ]
162 qed-.