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 "static_2/relocation/drops_ltc.ma".
16 include "basic_2/rt_transition/cpt_drops.ma".
17 include "basic_2/rt_computation/cpts.ma".
19 (* T-BOUND CONTEXT-SENSITIVE PARALLEL T-COMPUTATION FOR TERMS ***************)
21 (* Properties with generic slicing for local environments *******************)
23 lemma cpts_lifts_sn (h) (n) (G):
24 d_liftable2_sn … lifts (λL. cpts h G L n).
25 /3 width=6 by d2_liftable_sn_ltc, cpt_lifts_sn/ qed-.
27 lemma cpts_lifts_bi (h) (n) (G):
28 d_liftable2_bi … lifts (λL. cpts h G L n).
29 #h #n #G @d_liftable2_sn_bi
30 /2 width=6 by cpts_lifts_sn, lifts_mono/
33 (* Inversion lemmas with generic slicing for local environments *************)
35 lemma cpts_inv_lifts_sn (h) (n) (G):
36 d_deliftable2_sn … lifts (λL. cpts h G L n).
37 /3 width=6 by d2_deliftable_sn_ltc, cpt_inv_lifts_sn/ qed-.
39 lemma cpts_inv_lifts_bi (h) (n) (G):
40 d_deliftable2_bi … lifts (λL. cpts h G L n).
41 #h #n #G @d_deliftable2_sn_bi
42 /2 width=6 by cpts_inv_lifts_sn, lifts_inj/
45 (* Advanced properties ******************************************************)
47 lemma cpts_delta (h) (n) (G):
48 ∀K,V1,V2. ❪G,K❫ ⊢ V1 ⬆*[h,n] V2 →
49 ∀W2. ⇧[1] V2 ≘ W2 → ❪G,K.ⓓV1❫ ⊢ #0 ⬆*[h,n] W2.
50 #h #n #G #K #V1 #V2 #H @(cpts_ind_dx … H) -V2
51 [ /3 width=3 by cpt_cpts, cpt_delta/
52 | #n1 #n2 #V #V2 #_ #IH #HV2 #W2 #HVW2
53 elim (lifts_total V (𝐔❨1❩)) #W #HVW
54 /5 width=11 by cpts_step_dx, cpt_lifts_bi, drops_refl, drops_drop/
58 lemma cpts_ell (h) (n) (G):
59 ∀K,V1,V2. ❪G,K❫ ⊢ V1 ⬆*[h,n] V2 →
60 ∀W2. ⇧[1] V2 ≘ W2 → ❪G,K.ⓛV1❫ ⊢ #0 ⬆*[h,↑n] W2.
61 #h #n #G #K #V1 #V2 #H @(cpts_ind_dx … H) -V2
62 [ /3 width=3 by cpt_cpts, cpt_ell/
63 | #n1 #n2 #V #V2 #_ #IH #HV2 #W2 #HVW2
64 elim (lifts_total V (𝐔❨1❩)) #W #HVW >plus_S1
65 /5 width=11 by cpts_step_dx, cpt_lifts_bi, drops_refl, drops_drop/
69 lemma cpts_lref (h) (n) (I) (G):
70 ∀K,T,i. ❪G,K❫ ⊢ #i ⬆*[h,n] T →
71 ∀U. ⇧[1] T ≘ U → ❪G,K.ⓘ[I]❫ ⊢ #↑i ⬆*[h,n] U.
72 #h #n #I #G #K #T #i #H @(cpts_ind_dx … H) -T
73 [ /3 width=3 by cpt_cpts, cpt_lref/
74 | #n1 #n2 #T #T2 #_ #IH #HT2 #U2 #HTU2
75 elim (lifts_total T (𝐔❨1❩)) #U #TU
76 /5 width=11 by cpts_step_dx, cpt_lifts_bi, drops_refl, drops_drop/
80 lemma cpts_cast_sn (h) (n) (G) (L):
81 ∀U1,U2. ❪G,L❫ ⊢ U1 ⬆*[h,n] U2 →
82 ∀T1,T2. ❪G,L❫ ⊢ T1 ⬆[h,n] T2 → ❪G,L❫ ⊢ ⓝU1.T1 ⬆*[h,n] ⓝU2.T2.
83 #h #n #G #L #U1 #U2 #H @(cpts_ind_sn … H) -U1 -n
84 [ /3 width=3 by cpt_cpts, cpt_cast/
85 | #n1 #n2 #U1 #U #HU1 #_ #IH #T1 #T2 #H
86 elim (cpt_fwd_plus … H) -H #T #HT1 #HT2
87 /3 width=3 by cpts_step_sn, cpt_cast/
91 lemma cpts_delta_drops (h) (n) (G):
92 ∀L,K,V,i. ⇩[i] L ≘ K.ⓓV →
93 ∀V2. ❪G,K❫ ⊢ V ⬆*[h,n] V2 →
94 ∀W2. ⇧[↑i] V2 ≘ W2 → ❪G,L❫ ⊢ #i ⬆*[h,n] W2.
95 #h #n #G #L #K #V #i #HLK #V2 #H @(cpts_ind_dx … H) -V2
96 [ /3 width=6 by cpt_cpts, cpt_delta_drops/
97 | #n1 #n2 #V1 #V2 #_ #IH #HV12 #W2 #HVW2
98 lapply (drops_isuni_fwd_drop2 … HLK) -HLK // #HLK
99 elim (lifts_total V1 (𝐔❨↑i❩)) #W1 #HVW1
100 /3 width=11 by cpt_lifts_bi, cpts_step_dx/
104 lemma cpts_ell_drops (h) (n) (G):
105 ∀L,K,W,i. ⇩[i] L ≘ K.ⓛW →
106 ∀W2. ❪G,K❫ ⊢ W ⬆*[h,n] W2 →
107 ∀V2. ⇧[↑i] W2 ≘ V2 → ❪G,L❫ ⊢ #i ⬆*[h,↑n] V2.
108 #h #n #G #L #K #W #i #HLK #W2 #H @(cpts_ind_dx … H) -W2
109 [ /3 width=6 by cpt_cpts, cpt_ell_drops/
110 | #n1 #n2 #W1 #W2 #_ #IH #HW12 #V2 #HWV2
111 lapply (drops_isuni_fwd_drop2 … HLK) -HLK // #HLK
112 elim (lifts_total W1 (𝐔❨↑i❩)) #V1 #HWV1 >plus_S1
113 /3 width=11 by cpt_lifts_bi, cpts_step_dx/
117 (* Advanced inversion lemmas ************************************************)
119 lemma cpts_inv_lref_sn_drops (h) (n) (G) (L) (i):
120 ∀X2. ❪G,L❫ ⊢ #i ⬆*[h,n] X2 →
121 ∨∨ ∧∧ X2 = #i & n = 0
122 | ∃∃K,V,V2. ⇩[i] L ≘ K.ⓓV & ❪G,K❫ ⊢ V ⬆*[h,n] V2 & ⇧[↑i] V2 ≘ X2
123 | ∃∃m,K,V,V2. ⇩[i] L ≘ K.ⓛV & ❪G,K❫ ⊢ V ⬆*[h,m] V2 & ⇧[↑i] V2 ≘ X2 & n = ↑m.
124 #h #n #G #L #i #X2 #H @(cpts_ind_dx … H) -X2
125 [ /3 width=1 by or3_intro0, conj/
126 | #n1 #n2 #T #T2 #_ #IH #HT2 cases IH -IH *
128 elim (cpt_inv_lref_sn_drops … HT2) -HT2 *
129 [ /3 width=1 by or3_intro0, conj/
130 | /4 width=6 by cpt_cpts, or3_intro1, ex3_3_intro/
131 | /4 width=8 by cpt_cpts, or3_intro2, ex4_4_intro/
133 | #K #V0 #V #HLK #HV0 #HVT
134 lapply (drops_isuni_fwd_drop2 … HLK) // #H0LK
135 elim (cpt_inv_lifts_sn … HT2 … H0LK … HVT) -H0LK -T
136 /4 width=6 by cpts_step_dx, ex3_3_intro, or3_intro1/
137 | #m #K #V0 #V #HLK #HV0 #HVT #H destruct
138 lapply (drops_isuni_fwd_drop2 … HLK) // #H0LK
139 elim (cpt_inv_lifts_sn … HT2 … H0LK … HVT) -H0LK -T
140 /4 width=8 by cpts_step_dx, ex4_4_intro, or3_intro2/
145 lemma cpts_inv_delta_sn (h) (n) (G) (K) (V):
146 ∀X2. ❪G,K.ⓓV❫ ⊢ #0 ⬆*[h,n] X2 →
147 ∨∨ ∧∧ X2 = #0 & n = 0
148 | ∃∃V2. ❪G,K❫ ⊢ V ⬆*[h,n] V2 & ⇧[1] V2 ≘ X2.
149 #h #n #G #K #V #X2 #H
150 elim (cpts_inv_lref_sn_drops … H) -H *
151 [ /3 width=1 by or_introl, conj/
152 | #Y #X #V2 #H #HV2 #HVT2
153 lapply (drops_fwd_isid … H ?) -H [ // ] #H destruct
154 /3 width=3 by ex2_intro, or_intror/
155 | #m #Y #X #V2 #H #HV2 #HVT2
156 lapply (drops_fwd_isid … H ?) -H [ // ] #H destruct
160 lemma cpts_inv_ell_sn (h) (n) (G) (K) (V):
161 ∀X2. ❪G,K.ⓛV❫ ⊢ #0 ⬆*[h,n] X2 →
162 ∨∨ ∧∧ X2 = #0 & n = 0
163 | ∃∃m,V2. ❪G,K❫ ⊢ V ⬆*[h,m] V2 & ⇧[1] V2 ≘ X2 & n = ↑m.
164 #h #n #G #K #V #X2 #H
165 elim (cpts_inv_lref_sn_drops … H) -H *
166 [ /3 width=1 by or_introl, conj/
167 | #Y #X #V2 #H #HV2 #HVT2
168 lapply (drops_fwd_isid … H ?) -H [ // ] #H destruct
169 | #m #Y #X #V2 #H #HV2 #HVT2 #H0 destruct
170 lapply (drops_fwd_isid … H ?) -H [ // ] #H destruct
171 /3 width=5 by ex3_2_intro, or_intror/
175 lemma cpts_inv_lref_sn (h) (n) (I) (G) (K) (i):
176 ∀X2. ❪G,K.ⓘ[I]❫ ⊢ #↑i ⬆*[h,n] X2 →
177 ∨∨ ∧∧ X2 = #↑i & n = 0
178 | ∃∃T2. ❪G,K❫ ⊢ #i ⬆*[h,n] T2 & ⇧[1] T2 ≘ X2.
179 #h #n #I #G #K #i #X2 #H
180 elim (cpts_inv_lref_sn_drops … H) -H *
181 [ /3 width=1 by or_introl, conj/
182 | #L #V #V2 #H #HV2 #HVU2
183 lapply (drops_inv_drop1 … H) -H #HLK
184 elim (lifts_split_trans … HVU2 (𝐔❨↑i❩) (𝐔❨1❩)) -HVU2
185 [| // ] #T2 #HVT2 #HTU2
186 /4 width=6 by cpts_delta_drops, ex2_intro, or_intror/
187 | #m #L #V #V2 #H #HV2 #HVU2 #H0 destruct
188 lapply (drops_inv_drop1 … H) -H #HLK
189 elim (lifts_split_trans … HVU2 (𝐔❨↑i❩) (𝐔❨1❩)) -HVU2
190 [| // ] #T2 #HVT2 #HTU2
191 /4 width=6 by cpts_ell_drops, ex2_intro, or_intror/
195 lemma cpts_inv_succ_sn (h) (n) (G) (L):
196 ∀T1,T2. ❪G,L❫ ⊢ T1 ⬆*[h,↑n] T2 →
197 ∃∃T. ❪G,L❫ ⊢ T1 ⬆*[h,1] T & ❪G,L❫ ⊢ T ⬆*[h,n] T2.
199 @(insert_eq_0 … (↑n)) #m #H
200 @(cpts_ind_sn … H) -T1 -m
202 | #x1 #n2 #T1 #T #HT1 #HT2 #IH #H
203 elim (plus_inv_S3_sn x1 n2) [1,2: * |*: // ] -H
204 [ #H1 #H2 destruct -HT2
205 elim IH -IH // #T0 #HT0 #HT02
206 /3 width=3 by cpts_step_sn, ex2_intro/
207 | #n1 #H1 #H2 destruct -IH
208 elim (cpt_fwd_plus … 1 n1 … T1 T) [|*: // ] -HT1 #T0 #HT10 #HT0
209 /3 width=5 by cpts_step_sn, cpt_cpts, ex2_intro/