]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/rt_computation/cpms.ma
update in basic_2 and apps_2
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / rt_computation / cpms.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 "ground_2/lib/ltc.ma".
16 include "basic_2/notation/relations/predstar_6.ma".
17 include "basic_2/rt_transition/cpm.ma".
18
19 (* T-BOUND CONTEXT-SENSITIVE PARALLEL RT-COMPUTATION FOR TERMS **************)
20
21 (* Basic_2A1: uses: scpds *)
22 definition cpms (h) (G) (L): relation3 nat term term ≝
23            ltc … plus … (cpm h G L).
24
25 interpretation
26    "t-bound context-sensitive parallel rt-computarion (term)"
27    'PRedStar h n G L T1 T2 = (cpms h G L n T1 T2).
28
29 (* Basic eliminators ********************************************************)
30
31 lemma cpms_ind_sn (h) (G) (L) (T2) (Q:relation2 …):
32       Q 0 T2 →
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 //
36 qed-.
37
38 lemma cpms_ind_dx (h) (G) (L) (T1) (Q:relation2 …):
39       Q 0 T1 →
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 //
43 qed-.
44
45 (* Basic properties *********************************************************)
46
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.
53
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-.
58
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-.
63
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.
71
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/
78 qed.
79
80 lemma cpms_zeta (h) (n) (G) (L):
81       ∀T1,T. ⇧[1] T ≘ T1 →
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/
85 qed.
86
87 (* Basic_2A1: uses: cprs_zeta *)
88 lemma cpms_zeta_dx (h) (n) (G) (L):
89       ∀T2,T. ⇧[1] T2 ≘ T →
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/
93 qed.
94
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/
101 qed.
102
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/
110 ]
111 qed.
112
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/
121 qed.
122
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 →
126       ∀V2. ⇧[1] V ≘ V2 →
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/
132 qed.
133
134 (* Basic properties with r-transition ***************************************)
135
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.
140
141 (* Advanced properties ******************************************************)
142
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/
148 qed.
149
150 (* Basic inversion lemmas ***************************************************)
151
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 //
157 qed-.
158
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
165   /2 width=1 by conj/
166 ]
167 qed-.
168
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
175   /2 width=1 by conj/
176 ]
177 qed-.
178
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
185   /2 width=1 by conj/
186 ]
187 qed-.
188
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/
204     ]
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/
208   ]
209 ]
210 qed-.
211
212 (* Basic_2A1: removed theorems 5:
213               sta_cprs_scpds lstas_scpds scpds_strap1 scpds_fwd_cprs
214               scpds_inv_lstas_eq
215 *)