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_2/lib/ltc.ma".
16 include "basic_2/notation/relations/predstar_6.ma".
17 include "basic_2/notation/relations/predstar_5.ma".
18 include "basic_2/rt_transition/cpm.ma".
20 (* T-BOUND CONTEXT-SENSITIVE PARALLEL RT-COMPUTATION FOR TERMS **************)
22 (* Basic_2A1: uses: scpds *)
23 definition cpms (h) (G) (L): relation3 nat term term ≝
24 ltc … plus … (cpm h G L).
27 "t-bound context-sensitive parallel rt-computarion (term)"
28 'PRedStar n h G L T1 T2 = (cpms h G L n T1 T2).
31 "context-sensitive parallel r-computation (term)"
32 'PRedStar h G L T1 T2 = (cpms h G L O T1 T2).
34 (* Basic eliminators ********************************************************)
36 lemma cpms_ind_sn (h) (G) (L) (T2) (Q:relation2 …):
38 (∀n1,n2,T1,T. ❪G,L❫ ⊢ T1 ➡[n1,h] T → ❪G,L❫ ⊢ T ➡*[n2,h] T2 → Q n2 T → Q (n1+n2) T1) →
39 ∀n,T1. ❪G,L❫ ⊢ T1 ➡*[n,h] T2 → Q n T1.
40 #h #G #L #T2 #Q @ltc_ind_sn_refl //
43 lemma cpms_ind_dx (h) (G) (L) (T1) (Q:relation2 …):
45 (∀n1,n2,T,T2. ❪G,L❫ ⊢ T1 ➡*[n1,h] T → Q n1 T → ❪G,L❫ ⊢ T ➡[n2,h] T2 → Q (n1+n2) T2) →
46 ∀n,T2. ❪G,L❫ ⊢ T1 ➡*[n,h] T2 → Q n T2.
47 #h #G #L #T1 #Q @ltc_ind_dx_refl //
50 (* Basic properties *********************************************************)
52 (* Basic_1: includes: pr1_pr0 *)
53 (* Basic_1: uses: pr3_pr2 *)
54 (* Basic_2A1: includes: cpr_cprs *)
55 lemma cpm_cpms (h) (G) (L): ∀n,T1,T2. ❪G,L❫ ⊢ T1 ➡[n,h] T2 → ❪G,L❫ ⊢ T1 ➡*[n,h] T2.
56 /2 width=1 by ltc_rc/ qed.
58 lemma cpms_step_sn (h) (G) (L): ∀n1,T1,T. ❪G,L❫ ⊢ T1 ➡[n1,h] T →
59 ∀n2,T2. ❪G,L❫ ⊢ T ➡*[n2,h] T2 → ❪G,L❫ ⊢ T1 ➡*[n1+n2,h] T2.
60 /2 width=3 by ltc_sn/ qed-.
62 lemma cpms_step_dx (h) (G) (L): ∀n1,T1,T. ❪G,L❫ ⊢ T1 ➡*[n1,h] T →
63 ∀n2,T2. ❪G,L❫ ⊢ T ➡[n2,h] T2 → ❪G,L❫ ⊢ T1 ➡*[n1+n2,h] T2.
64 /2 width=3 by ltc_dx/ qed-.
66 (* Basic_2A1: uses: cprs_bind_dx *)
67 lemma cpms_bind_dx (n) (h) (G) (L):
68 ∀V1,V2. ❪G,L❫ ⊢ V1 ➡[h] V2 →
69 ∀I,T1,T2. ❪G,L.ⓑ[I]V1❫ ⊢ T1 ➡*[n,h] T2 →
70 ∀p. ❪G,L❫ ⊢ ⓑ[p,I]V1.T1 ➡*[n,h] ⓑ[p,I]V2.T2.
71 #n #h #G #L #V1 #V2 #HV12 #I #T1 #T2 #H #a @(cpms_ind_sn … H) -T1
72 /3 width=3 by cpms_step_sn, cpm_cpms, cpm_bind/ qed.
74 lemma cpms_appl_dx (n) (h) (G) (L):
75 ∀V1,V2. ❪G,L❫ ⊢ V1 ➡[h] V2 →
76 ∀T1,T2. ❪G,L❫ ⊢ T1 ➡*[n,h] T2 →
77 ❪G,L❫ ⊢ ⓐV1.T1 ➡*[n,h] ⓐV2.T2.
78 #n #h #G #L #V1 #V2 #HV12 #T1 #T2 #H @(cpms_ind_sn … H) -T1
79 /3 width=3 by cpms_step_sn, cpm_cpms, cpm_appl/
82 lemma cpms_zeta (n) (h) (G) (L):
84 ∀V,T2. ❪G,L❫ ⊢ T ➡*[n,h] T2 → ❪G,L❫ ⊢ +ⓓV.T1 ➡*[n,h] T2.
85 #n #h #G #L #T1 #T #HT1 #V #T2 #H @(cpms_ind_dx … H) -T2
86 /3 width=3 by cpms_step_dx, cpm_cpms, cpm_zeta/
89 (* Basic_2A1: uses: cprs_zeta *)
90 lemma cpms_zeta_dx (n) (h) (G) (L):
92 ∀V,T1. ❪G,L.ⓓV❫ ⊢ T1 ➡*[n,h] T → ❪G,L❫ ⊢ +ⓓV.T1 ➡*[n,h] T2.
93 #n #h #G #L #T2 #T #HT2 #V #T1 #H @(cpms_ind_sn … H) -T1
94 /3 width=3 by cpms_step_sn, cpm_cpms, cpm_bind, cpm_zeta/
97 (* Basic_2A1: uses: cprs_eps *)
98 lemma cpms_eps (n) (h) (G) (L):
99 ∀T1,T2. ❪G,L❫ ⊢ T1 ➡*[n,h] T2 →
100 ∀V. ❪G,L❫ ⊢ ⓝV.T1 ➡*[n,h] T2.
101 #n #h #G #L #T1 #T2 #H @(cpms_ind_sn … H) -T1
102 /3 width=3 by cpms_step_sn, cpm_cpms, cpm_eps/
105 lemma cpms_ee (n) (h) (G) (L):
106 ∀U1,U2. ❪G,L❫ ⊢ U1 ➡*[n,h] U2 →
107 ∀T. ❪G,L❫ ⊢ ⓝU1.T ➡*[↑n,h] U2.
108 #n #h #G #L #U1 #U2 #H @(cpms_ind_sn … H) -U1 -n
109 [ /3 width=1 by cpm_cpms, cpm_ee/
110 | #n1 #n2 #U1 #U #HU1 #HU2 #_ #T >plus_S1
111 /3 width=3 by cpms_step_sn, cpm_ee/
115 (* Basic_2A1: uses: cprs_beta_dx *)
116 lemma cpms_beta_dx (n) (h) (G) (L):
117 ∀V1,V2. ❪G,L❫ ⊢ V1 ➡[h] V2 →
118 ∀W1,W2. ❪G,L❫ ⊢ W1 ➡[h] W2 →
119 ∀T1,T2. ❪G,L.ⓛW1❫ ⊢ T1 ➡*[n,h] T2 →
120 ∀p. ❪G,L❫ ⊢ ⓐV1.ⓛ[p]W1.T1 ➡*[n,h] ⓓ[p]ⓝW2.V2.T2.
121 #n #h #G #L #V1 #V2 #HV12 #W1 #W2 #HW12 #T1 #T2 #H @(cpms_ind_dx … H) -T2
122 /4 width=7 by cpms_step_dx, cpm_cpms, cpms_bind_dx, cpms_appl_dx, cpm_beta/
125 (* Basic_2A1: uses: cprs_theta_dx *)
126 lemma cpms_theta_dx (n) (h) (G) (L):
127 ∀V1,V. ❪G,L❫ ⊢ V1 ➡[h] V →
129 ∀W1,W2. ❪G,L❫ ⊢ W1 ➡[h] W2 →
130 ∀T1,T2. ❪G,L.ⓓW1❫ ⊢ T1 ➡*[n,h] T2 →
131 ∀p. ❪G,L❫ ⊢ ⓐV1.ⓓ[p]W1.T1 ➡*[n,h] ⓓ[p]W2.ⓐV2.T2.
132 #n #h #G #L #V1 #V #HV1 #V2 #HV2 #W1 #W2 #HW12 #T1 #T2 #H @(cpms_ind_dx … H) -T2
133 /4 width=9 by cpms_step_dx, cpm_cpms, cpms_bind_dx, cpms_appl_dx, cpm_theta/
136 (* Basic properties with r-transition ***************************************)
138 (* Basic_1: was: pr3_refl *)
139 lemma cprs_refl: ∀h,G,L. reflexive … (cpms h G L 0).
140 /2 width=1 by cpm_cpms/ qed.
142 (* Advanced properties ******************************************************)
144 lemma cpms_sort (h) (G) (L) (n):
145 ∀s. ❪G,L❫ ⊢ ⋆s ➡*[n,h] ⋆((next h)^n s).
146 #h #G #L #n elim n -n [ // ]
147 #n #IH #s <plus_SO_dx
148 /3 width=3 by cpms_step_dx, cpm_sort/
151 (* Basic inversion lemmas ***************************************************)
153 lemma cpms_inv_sort1 (n) (h) (G) (L): ∀X2,s. ❪G,L❫ ⊢ ⋆s ➡*[n,h] X2 → X2 = ⋆(((next h)^n) s).
154 #n #h #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 (n) (h) (G):
160 ∀X2,i. ❪G,⋆❫ ⊢ #i ➡*[n,h] X2 → ∧∧ X2 = #i & n = 0.
161 #n #h #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 (n) (h) (I) (K) (G):
170 ∀X2. ❪G,K.ⓤ[I]❫ ⊢ #0 ➡*[n,h] X2 → ∧∧ X2 = #0 & n = 0.
171 #n #h #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 (n) (h) (G) (L):
180 ∀X2,l. ❪G,L❫ ⊢ §l ➡*[n,h] X2 → ∧∧ X2 = §l & n = 0.
181 #n #h #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 ➡*[n,h] X2 →
191 ∨∨ ∃∃W2,T2. ❪G,L❫ ⊢ W1 ➡*[n,h] W2 & ❪G,L❫ ⊢ T1 ➡*[n,h] T2 & X2 = ⓝW2.T2
192 | ❪G,L❫ ⊢ T1 ➡*[n,h] X2
193 | ∃∃m. ❪G,L❫ ⊢ W1 ➡*[m,h] 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