1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 include "ground/lib/ltc.ma".
16 include "basic_2/notation/relations/predstar_6.ma".
17 include "basic_2/rt_transition/cpm.ma".
19 (* T-BOUND CONTEXT-SENSITIVE PARALLEL RT-COMPUTATION FOR TERMS **************)
21 (* Basic_2A1: uses: scpds *)
22 definition cpms (h) (G) (L): relation3 nat term term ≝
23 ltc … plus … (cpm h G L).
26 "t-bound context-sensitive parallel rt-computarion (term)"
27 'PRedStar h n G L T1 T2 = (cpms h G L n T1 T2).
29 (* Basic eliminators ********************************************************)
31 lemma cpms_ind_sn (h) (G) (L) (T2) (Q:relation2 …):
33 (∀n1,n2,T1,T. ❨G,L❩ ⊢ T1 ➡[h,n1] T → ❨G,L❩ ⊢ T ➡*[h,n2] T2 → Q n2 T → Q (n1+n2) T1) →
34 ∀n,T1. ❨G,L❩ ⊢ T1 ➡*[h,n] T2 → Q n T1.
35 #h #G #L #T2 #Q @ltc_ind_sn_refl //
38 lemma cpms_ind_dx (h) (G) (L) (T1) (Q:relation2 …):
40 (∀n1,n2,T,T2. ❨G,L❩ ⊢ T1 ➡*[h,n1] T → Q n1 T → ❨G,L❩ ⊢ T ➡[h,n2] T2 → Q (n1+n2) T2) →
41 ∀n,T2. ❨G,L❩ ⊢ T1 ➡*[h,n] T2 → Q n T2.
42 #h #G #L #T1 #Q @ltc_ind_dx_refl //
45 (* Basic properties *********************************************************)
47 (* Basic_1: includes: pr1_pr0 *)
48 (* Basic_1: uses: pr3_pr2 *)
49 (* Basic_2A1: includes: cpr_cprs *)
50 lemma cpm_cpms (h) (G) (L):
51 ∀n,T1,T2. ❨G,L❩ ⊢ T1 ➡[h,n] T2 → ❨G,L❩ ⊢ T1 ➡*[h,n] T2.
52 /2 width=1 by ltc_rc/ qed.
54 lemma cpms_step_sn (h) (G) (L):
55 ∀n1,T1,T. ❨G,L❩ ⊢ T1 ➡[h,n1] T →
56 ∀n2,T2. ❨G,L❩ ⊢ T ➡*[h,n2] T2 → ❨G,L❩ ⊢ T1 ➡*[h,n1+n2] T2.
57 /2 width=3 by ltc_sn/ qed-.
59 lemma cpms_step_dx (h) (G) (L):
60 ∀n1,T1,T. ❨G,L❩ ⊢ T1 ➡*[h,n1] T →
61 ∀n2,T2. ❨G,L❩ ⊢ T ➡[h,n2] T2 → ❨G,L❩ ⊢ T1 ➡*[h,n1+n2] T2.
62 /2 width=3 by ltc_dx/ qed-.
64 (* Basic_2A1: uses: cprs_bind_dx *)
65 lemma cpms_bind_dx (h) (n) (G) (L):
66 ∀V1,V2. ❨G,L❩ ⊢ V1 ➡[h,0] V2 →
67 ∀I,T1,T2. ❨G,L.ⓑ[I]V1❩ ⊢ T1 ➡*[h,n] T2 →
68 ∀p. ❨G,L❩ ⊢ ⓑ[p,I]V1.T1 ➡*[h,n] ⓑ[p,I]V2.T2.
69 #h #n #G #L #V1 #V2 #HV12 #I #T1 #T2 #H #a @(cpms_ind_sn … H) -T1
70 /3 width=3 by cpms_step_sn, cpm_cpms, cpm_bind/ qed.
72 lemma cpms_appl_dx (h) (n) (G) (L):
73 ∀V1,V2. ❨G,L❩ ⊢ V1 ➡[h,0] V2 →
74 ∀T1,T2. ❨G,L❩ ⊢ T1 ➡*[h,n] T2 →
75 ❨G,L❩ ⊢ ⓐV1.T1 ➡*[h,n] ⓐV2.T2.
76 #h #n #G #L #V1 #V2 #HV12 #T1 #T2 #H @(cpms_ind_sn … H) -T1
77 /3 width=3 by cpms_step_sn, cpm_cpms, cpm_appl/
80 lemma cpms_zeta (h) (n) (G) (L):
82 ∀V,T2. ❨G,L❩ ⊢ T ➡*[h,n] T2 → ❨G,L❩ ⊢ +ⓓV.T1 ➡*[h,n] T2.
83 #h #n #G #L #T1 #T #HT1 #V #T2 #H @(cpms_ind_dx … H) -T2
84 /3 width=3 by cpms_step_dx, cpm_cpms, cpm_zeta/
87 (* Basic_2A1: uses: cprs_zeta *)
88 lemma cpms_zeta_dx (h) (n) (G) (L):
90 ∀V,T1. ❨G,L.ⓓV❩ ⊢ T1 ➡*[h,n] T → ❨G,L❩ ⊢ +ⓓV.T1 ➡*[h,n] T2.
91 #h #n #G #L #T2 #T #HT2 #V #T1 #H @(cpms_ind_sn … H) -T1
92 /3 width=3 by cpms_step_sn, cpm_cpms, cpm_bind, cpm_zeta/
95 (* Basic_2A1: uses: cprs_eps *)
96 lemma cpms_eps (h) (n) (G) (L):
97 ∀T1,T2. ❨G,L❩ ⊢ T1 ➡*[h,n] T2 →
98 ∀V. ❨G,L❩ ⊢ ⓝV.T1 ➡*[h,n] T2.
99 #h #n #G #L #T1 #T2 #H @(cpms_ind_sn … H) -T1
100 /3 width=3 by cpms_step_sn, cpm_cpms, cpm_eps/
103 lemma cpms_ee (h) (n) (G) (L):
104 ∀U1,U2. ❨G,L❩ ⊢ U1 ➡*[h,n] U2 →
105 ∀T. ❨G,L❩ ⊢ ⓝU1.T ➡*[h,↑n] U2.
106 #h #n #G #L #U1 #U2 #H @(cpms_ind_sn … H) -U1 -n
107 [ /3 width=1 by cpm_cpms, cpm_ee/
108 | #n1 #n2 #U1 #U #HU1 #HU2 #_ #T >plus_S1
109 /3 width=3 by cpms_step_sn, cpm_ee/
113 (* Basic_2A1: uses: cprs_beta_dx *)
114 lemma cpms_beta_dx (h) (n) (G) (L):
115 ∀V1,V2. ❨G,L❩ ⊢ V1 ➡[h,0] V2 →
116 ∀W1,W2. ❨G,L❩ ⊢ W1 ➡[h,0] W2 →
117 ∀T1,T2. ❨G,L.ⓛW1❩ ⊢ T1 ➡*[h,n] T2 →
118 ∀p. ❨G,L❩ ⊢ ⓐV1.ⓛ[p]W1.T1 ➡*[h,n] ⓓ[p]ⓝW2.V2.T2.
119 #h #n #G #L #V1 #V2 #HV12 #W1 #W2 #HW12 #T1 #T2 #H @(cpms_ind_dx … H) -T2
120 /4 width=7 by cpms_step_dx, cpm_cpms, cpms_bind_dx, cpms_appl_dx, cpm_beta/
123 (* Basic_2A1: uses: cprs_theta_dx *)
124 lemma cpms_theta_dx (h) (n) (G) (L):
125 ∀V1,V. ❨G,L❩ ⊢ V1 ➡[h,0] V →
127 ∀W1,W2. ❨G,L❩ ⊢ W1 ➡[h,0] W2 →
128 ∀T1,T2. ❨G,L.ⓓW1❩ ⊢ T1 ➡*[h,n] T2 →
129 ∀p. ❨G,L❩ ⊢ ⓐV1.ⓓ[p]W1.T1 ➡*[h,n] ⓓ[p]W2.ⓐV2.T2.
130 #h #n #G #L #V1 #V #HV1 #V2 #HV2 #W1 #W2 #HW12 #T1 #T2 #H @(cpms_ind_dx … H) -T2
131 /4 width=9 by cpms_step_dx, cpm_cpms, cpms_bind_dx, cpms_appl_dx, cpm_theta/
134 (* Basic properties with r-transition ***************************************)
136 (* Basic_1: was: pr3_refl *)
137 lemma cprs_refl (h) (G) (L):
138 reflexive … (cpms h G L 0).
139 /2 width=1 by cpm_cpms/ qed.
141 (* Advanced properties ******************************************************)
143 lemma cpms_sort (h) (G) (L):
144 ∀n,s. ❨G,L❩ ⊢ ⋆s ➡*[h,n] ⋆((next h)^n s).
145 #h #G #L #n elim n -n [ // ]
146 #n #IH #s <plus_SO_dx
147 /3 width=3 by cpms_step_dx, cpm_sort/
150 (* Basic inversion lemmas ***************************************************)
152 lemma cpms_inv_sort1 (h) (n) (G) (L):
153 ∀X2,s. ❨G,L❩ ⊢ ⋆s ➡*[h,n] X2 → X2 = ⋆(((next h)^n) s).
154 #h #n #G #L #X2 #s #H @(cpms_ind_dx … H) -X2 //
155 #n1 #n2 #X #X2 #_ #IH #HX2 destruct
156 elim (cpm_inv_sort1 … HX2) -HX2 #H #_ destruct //
159 lemma cpms_inv_lref1_ctop (h) (n) (G):
160 ∀X2,i. ❨G,⋆❩ ⊢ #i ➡*[h,n] X2 → ∧∧ X2 = #i & n = 0.
161 #h #n #G #X2 #i #H @(cpms_ind_dx … H) -X2
162 [ /2 width=1 by conj/
163 | #n1 #n2 #X #X2 #_ * #HX #Hn1 #HX2 destruct
164 elim (cpm_inv_lref1_ctop … HX2) -HX2 #H1 #H2 destruct
169 lemma cpms_inv_zero1_unit (h) (n) (I) (K) (G):
170 ∀X2. ❨G,K.ⓤ[I]❩ ⊢ #0 ➡*[h,n] X2 → ∧∧ X2 = #0 & n = 0.
171 #h #n #I #G #K #X2 #H @(cpms_ind_dx … H) -X2
172 [ /2 width=1 by conj/
173 | #n1 #n2 #X #X2 #_ * #HX #Hn1 #HX2 destruct
174 elim (cpm_inv_zero1_unit … HX2) -HX2 #H1 #H2 destruct
179 lemma cpms_inv_gref1 (h) (n) (G) (L):
180 ∀X2,l. ❨G,L❩ ⊢ §l ➡*[h,n] X2 → ∧∧ X2 = §l & n = 0.
181 #h #n #G #L #X2 #l #H @(cpms_ind_dx … H) -X2
182 [ /2 width=1 by conj/
183 | #n1 #n2 #X #X2 #_ * #HX #Hn1 #HX2 destruct
184 elim (cpm_inv_gref1 … HX2) -HX2 #H1 #H2 destruct
189 lemma cpms_inv_cast1 (h) (n) (G) (L):
190 ∀W1,T1,X2. ❨G,L❩ ⊢ ⓝW1.T1 ➡*[h,n] X2 →
191 ∨∨ ∃∃W2,T2. ❨G,L❩ ⊢ W1 ➡*[h,n] W2 & ❨G,L❩ ⊢ T1 ➡*[h,n] T2 & X2 = ⓝW2.T2
192 | ❨G,L❩ ⊢ T1 ➡*[h,n] X2
193 | ∃∃m. ❨G,L❩ ⊢ W1 ➡*[h,m] X2 & n = ↑m.
194 #h #n #G #L #W1 #T1 #X2 #H @(cpms_ind_dx … H) -n -X2
195 [ /3 width=5 by or3_intro0, ex3_2_intro/
196 | #n1 #n2 #X #X2 #_ * [ * || * ]
197 [ #W #T #HW1 #HT1 #H #HX2 destruct
198 elim (cpm_inv_cast1 … HX2) -HX2 [ * || * ]
199 [ #W2 #T2 #HW2 #HT2 #H destruct
200 /4 width=5 by cpms_step_dx, ex3_2_intro, or3_intro0/
201 | #HX2 /3 width=3 by cpms_step_dx, or3_intro1/
202 | #m #HX2 #H destruct <plus_n_Sm
203 /4 width=3 by cpms_step_dx, ex2_intro, or3_intro2/
205 | #HX #HX2 /3 width=3 by cpms_step_dx, or3_intro1/
206 | #m #HX #H #HX2 destruct
207 /4 width=3 by cpms_step_dx, ex2_intro, or3_intro2/
212 (* Basic_2A1: removed theorems 5:
213 sta_cprs_scpds lstas_scpds scpds_strap1 scpds_fwd_cprs