]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/computation/cpxs.ma
635aff910339b0e6392b2f298fc27a98bd5abdac
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / computation / 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/notation/relations/predstar_5.ma".
16 include "basic_2/unfold/sstas.ma".
17 include "basic_2/reduction/cnx.ma".
18 include "basic_2/computation/cprs.ma".
19
20 (* CONTEXT-SENSITIVE EXTENDED PARALLEL COMPUTATION ON TERMS *****************)
21
22 definition cpxs: ∀h. sd h → lenv → relation term ≝
23                  λh,g. LTC … (cpx h g).
24
25 interpretation "extended context-sensitive parallel computation (term)"
26    'PRedStar h g L T1 T2 = (cpxs h g L T1 T2).
27
28 (* Basic eliminators ********************************************************)
29
30 lemma cpxs_ind: ∀h,g,L,T1. ∀R:predicate term. R T1 →
31                 (∀T,T2. ⦃h, L⦄ ⊢ T1 ➡*[g] T → ⦃h, L⦄ ⊢ T ➡[g] T2 → R T → R T2) →
32                 ∀T2. ⦃h, L⦄ ⊢ T1 ➡*[g] T2 → R T2.
33 #h #g #L #T1 #R #HT1 #IHT1 #T2 #HT12
34 @(TC_star_ind … HT1 IHT1 … HT12) //
35 qed-.
36
37 lemma cpxs_ind_dx: ∀h,g,L,T2. ∀R:predicate term. R T2 →
38                    (∀T1,T. ⦃h, L⦄ ⊢ T1 ➡[g] T → ⦃h, L⦄ ⊢ T ➡*[g] T2 → R T → R T1) →
39                    ∀T1. ⦃h, L⦄ ⊢ T1 ➡*[g] T2 → R T1.
40 #h #g #L #T2 #R #HT2 #IHT2 #T1 #HT12
41 @(TC_star_ind_dx … HT2 IHT2 … HT12) //
42 qed-.
43
44 (* Basic properties *********************************************************)
45
46 lemma cpxs_refl: ∀h,g,L,T. ⦃h, L⦄ ⊢ T ➡*[g] T.
47 /2 width=1/ qed.
48
49 lemma cpx_cpxs: ∀h,g,L,T1,T2. ⦃h, L⦄ ⊢ T1 ➡[g] T2 → ⦃h, L⦄ ⊢ T1 ➡*[g] T2.
50 /2 width=1/ qed.
51
52 lemma cpxs_strap1: ∀h,g,L,T1,T. ⦃h, L⦄ ⊢ T1 ➡*[g] T →
53                    ∀T2. ⦃h, L⦄ ⊢ T ➡[g] T2 → ⦃h, L⦄ ⊢ T1 ➡*[g] T2.
54 normalize /2 width=3/ qed.
55
56 lemma cpxs_strap2: ∀h,g,L,T1,T. ⦃h, L⦄ ⊢ T1 ➡[g] T →
57                    ∀T2. ⦃h, L⦄ ⊢ T ➡*[g] T2 → ⦃h, L⦄ ⊢ T1 ➡*[g] T2.
58 normalize /2 width=3/ qed.
59
60 lemma lsubr_cpxs_trans: ∀h,g. lsub_trans … (cpxs h g) lsubr.
61 /3 width=5 by lsubr_cpx_trans, TC_lsub_trans/
62 qed-.
63
64 lemma sstas_cpxs: ∀h,g,L,T1,T2. ⦃h, L⦄ ⊢ T1 •* [g] T2 → ⦃h, L⦄ ⊢ T1 ➡*[g] T2.
65 #h #g #L #T1 #T2 #H @(sstas_ind … H) -T2 //
66 /3 width=4 by cpxs_strap1, ssta_cpx/
67 qed.
68
69 lemma cprs_cpxs: ∀h,g,L,T1,T2. L ⊢ T1 ➡* T2 → ⦃h, L⦄ ⊢ T1 ➡*[g] T2.
70 #h #g #L #T1 #T2 #H @(cprs_ind … H) -T2 // /3 width=3/
71 qed.
72
73 lemma cpxs_bind_dx: ∀h,g,L,V1,V2. ⦃h, L⦄ ⊢ V1 ➡[g] V2 →
74                     ∀I,T1,T2. ⦃h, L. ⓑ{I}V1⦄ ⊢ T1 ➡*[g] T2 →
75                     ∀a. ⦃h, L⦄ ⊢ ⓑ{a,I}V1.T1 ➡*[g] ⓑ{a,I}V2.T2.
76 #h #g #L #V1 #V2 #HV12 #I #T1 #T2 #HT12 #a @(cpxs_ind_dx … HT12) -T1
77 /3 width=1/ /3 width=3/
78 qed.
79
80 lemma cpxs_flat_dx: ∀h,g,L,V1,V2. ⦃h, L⦄ ⊢ V1 ➡[g] V2 →
81                     ∀T1,T2. ⦃h, L⦄ ⊢ T1 ➡*[g] T2 →
82                     ∀I. ⦃h, L⦄ ⊢ ⓕ{I} V1. T1 ➡*[g] ⓕ{I} V2. T2.
83 #h #g #L #V1 #V2 #HV12 #T1 #T2 #HT12 @(cpxs_ind … HT12) -T2 /3 width=1/ /3 width=5/
84 qed.
85
86 lemma cpxs_flat_sn: ∀h,g,L,T1,T2. ⦃h, L⦄ ⊢ T1 ➡[g] T2 →
87                     ∀V1,V2. ⦃h, L⦄ ⊢ V1 ➡*[g] V2 →
88                     ∀I. ⦃h, L⦄ ⊢ ⓕ{I} V1. T1 ➡*[g] ⓕ{I} V2. T2.
89 #h #g #L #T1 #T2 #HT12 #V1 #V2 #H @(cpxs_ind … H) -V2 /3 width=1/ /3 width=5/
90 qed.
91
92 lemma cpxs_zeta: ∀h,g,L,V,T1,T,T2. ⇧[0, 1] T2 ≡ T →
93                  ⦃h, L.ⓓV⦄ ⊢ T1 ➡*[g] T → ⦃h, L⦄ ⊢ +ⓓV.T1 ➡*[g] T2.
94 #h #g #L #V #T1 #T #T2 #HT2 #H @(TC_ind_dx … T1 H) -T1 /3 width=3/
95 qed.
96
97 lemma cpxs_tau: ∀h,g,L,T1,T2. ⦃h, L⦄ ⊢ T1 ➡*[g] T2 → ∀V. ⦃h, L⦄ ⊢ ⓝV.T1 ➡*[g] T2.
98 #h #g #L #T1 #T2 #H elim H -T2 /2 width=3/ /3 width=1/
99 qed.
100
101 lemma cpxs_ti: ∀h,g,L,V1,V2. ⦃h, L⦄ ⊢ V1 ➡*[g] V2 → ∀T. ⦃h, L⦄ ⊢ ⓝV1.T ➡*[g] V2.
102 #h #g #L #V1 #V2 #H elim H -V2 /2 width=3/ /3 width=1/
103 qed.
104
105 lemma cpxs_beta_dx: ∀h,g,a,L,V1,V2,W1,W2,T1,T2.
106                     ⦃h, L⦄ ⊢ V1 ➡[g] V2 → ⦃h, L.ⓛW1⦄ ⊢ T1 ➡*[g] T2 → ⦃h, L⦄ ⊢ W1 ➡[g] W2 →
107                     ⦃h, L⦄ ⊢ ⓐV1.ⓛ{a}W1.T1 ➡*[g] ⓓ{a}ⓝW2.V2.T2.
108 #h #g #a #L #V1 #V2 #W1 #W2 #T1 #T2 #HV12 * -T2 /3 width=1/
109 /4 width=7 by cpxs_strap1, cpxs_bind_dx, cpxs_flat_dx, cpx_beta/ (**) (* auto too slow without trace *)
110 qed.
111
112 lemma cpxs_theta_dx: ∀h,g,a,L,V1,V,V2,W1,W2,T1,T2.
113                      ⦃h, L⦄ ⊢ V1 ➡[g] V → ⇧[0, 1] V ≡ V2 → ⦃h, L.ⓓW1⦄ ⊢ T1 ➡*[g] T2 →
114                      ⦃h, L⦄ ⊢ W1 ➡[g] W2 → ⦃h, L⦄ ⊢ ⓐV1.ⓓ{a}W1.T1 ➡*[g] ⓓ{a}W2.ⓐV2.T2.
115 #h #g #a #L #V1 #V #V2 #W1 #W2 #T1 #T2 #HV1 #HV2 * -T2 [ /3 width=3/ ]
116 /4 width=9 by cpxs_strap1, cpxs_bind_dx, cpxs_flat_dx, cpx_theta/ (**) (* auto too slow without trace *)
117 qed.
118
119 (* Basic inversion lemmas ***************************************************)
120
121 lemma cpxs_inv_sort1: ∀h,g,L,U2,k. ⦃h, L⦄ ⊢ ⋆k ➡*[g] U2 →
122                       ∃∃n,l. deg h g k (n+l) & U2 = ⋆((next h)^n k).
123 #h #g #L #U2 #k #H @(cpxs_ind … H) -U2
124 [ elim (deg_total h g k) #l #Hkl
125   @(ex2_2_intro … 0 … Hkl) -Hkl //
126 | #U #U2 #_ #HU2 * #n #l #Hknl #H destruct
127   elim (cpx_inv_sort1 … HU2) -HU2
128   [ #H destruct /2 width=4/
129   | * #l0 #Hkl0 #H destruct -l
130     @(ex2_2_intro … (n+1) l0) /2 width=1 by deg_inv_prec/ >iter_SO //
131   ]
132 ]
133 qed-.
134
135 lemma cpxs_inv_cast1: ∀h,g,L,W1,T1,U2. ⦃h, L⦄ ⊢ ⓝW1.T1 ➡*[g] U2 →
136                       ∨∨ ∃∃W2,T2. ⦃h, L⦄ ⊢ W1 ➡*[g] W2 & ⦃h, L⦄ ⊢ T1 ➡*[g] T2 & U2 = ⓝW2.T2
137                        | ⦃h, L⦄ ⊢ T1 ➡*[g] U2
138                        | ⦃h, L⦄ ⊢ W1 ➡*[g] U2.
139 #h #g #L #W1 #T1 #U2 #H @(cpxs_ind … H) -U2 /3 width=5/
140 #U2 #U #_ #HU2 * /3 width=3/ *
141 #W #T #HW1 #HT1 #H destruct
142 elim (cpx_inv_cast1 … HU2) -HU2 /3 width=3/ *
143 #W2 #T2 #HW2 #HT2 #H destruct
144 lapply (cpxs_strap1 … HW1 … HW2) -W
145 lapply (cpxs_strap1 … HT1 … HT2) -T /3 width=5/
146 qed-.
147
148 lemma cpxs_inv_cnx1: ∀h,g,L,T,U. ⦃h, L⦄ ⊢ T ➡*[g] U → ⦃h, L⦄ ⊢ 𝐍[g]⦃T⦄ → T = U.
149 #h #g #L #T #U #H @(cpxs_ind_dx … H) -T //
150 #T0 #T #H1T0 #_ #IHT #H2T0
151 lapply (H2T0 … H1T0) -H1T0 #H destruct /2 width=1/
152 qed-.