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/xoa/ex_5_5.ma".
16 include "static_2/relocation/drops_drops.ma".
17 include "static_2/s_computation/fqup_weight.ma".
18 include "static_2/s_computation/fqup_drops.ma".
19 include "basic_2/rt_transition/cpg.ma".
21 (* BOUND CONTEXT-SENSITIVE PARALLEL RT-TRANSITION FOR TERMS *****************)
23 (* Advanced properties ******************************************************)
25 lemma cpg_delta_drops: ∀Rt,c,h,G,K,V,V2,i,L,T2. ⇩[i] L ≘ K.ⓓV → ❪G,K❫ ⊢ V ⬈[Rt,c,h] V2 →
26 ⇧[↑i] V2 ≘ T2 → ❪G,L❫ ⊢ #i ⬈[Rt,c,h] T2.
27 #Rt #c #h #G #K #V #V2 #i elim i -i
28 [ #L #T2 #HLK lapply (drops_fwd_isid … HLK ?) // #H destruct /3 width=3 by cpg_delta/
29 | #i #IH #L0 #T0 #H0 #HV2 #HVT2
30 elim (drops_inv_succ … H0) -H0 #I #L #HLK #H destruct
31 elim (lifts_split_trans … HVT2 (𝐔❨↑i❩) (𝐔❨1❩) ?) -HVT2 /3 width=3 by cpg_lref/
35 lemma cpg_ell_drops: ∀Rt,c,h,G,K,V,V2,i,L,T2. ⇩[i] L ≘ K.ⓛV → ❪G,K❫ ⊢ V ⬈[Rt,c,h] V2 →
36 ⇧[↑i] V2 ≘ T2 → ❪G,L❫ ⊢ #i ⬈[Rt,c+𝟘𝟙,h] T2.
37 #Rt #c #h #G #K #V #V2 #i elim i -i
38 [ #L #T2 #HLK lapply (drops_fwd_isid … HLK ?) // #H destruct /3 width=3 by cpg_ell/
39 | #i #IH #L0 #T0 #H0 #HV2 #HVT2
40 elim (drops_inv_succ … H0) -H0 #I #L #HLK #H destruct
41 elim (lifts_split_trans … HVT2 (𝐔❨↑i❩) (𝐔❨1❩) ?) -HVT2 /3 width=3 by cpg_lref/
45 (* Advanced inversion lemmas ************************************************)
47 lemma cpg_inv_lref1_drops: ∀Rt,c,h,G,i,L,T2. ❪G,L❫ ⊢ #i ⬈[Rt,c,h] T2 →
49 | ∃∃cV,K,V,V2. ⇩[i] L ≘ K.ⓓV & ❪G,K❫ ⊢ V ⬈[Rt,cV,h] V2 &
50 ⇧[↑i] V2 ≘ T2 & c = cV
51 | ∃∃cV,K,V,V2. ⇩[i] L ≘ K.ⓛV & ❪G,K❫ ⊢ V ⬈[Rt,cV,h] V2 &
52 ⇧[↑i] V2 ≘ T2 & c = cV + 𝟘𝟙.
53 #Rt #c #h #G #i elim i -i
54 [ #L #T2 #H elim (cpg_inv_zero1 … H) -H * /3 width=1 by or3_intro0, conj/
55 /4 width=8 by drops_refl, ex4_4_intro, or3_intro2, or3_intro1/
56 | #i #IH #L #T2 #H elim (cpg_inv_lref1 … H) -H * /3 width=1 by or3_intro0, conj/
57 #I #K #V2 #H #HVT2 #H0 destruct elim (IH … H) -IH -H
59 lapply (lifts_inv_lref1_uni … HVT2) -HVT2 #H destruct
60 /3 width=1 by or3_intro0, conj/
62 #cV #L #W #W2 #HKL #HW2 #HWV2 #H destruct
63 lapply (lifts_trans … HWV2 … HVT2 ??) -V2 [3,6: |*: // ] #H
64 lapply (lifts_uni … H) -H #H
65 /4 width=8 by drops_drop, ex4_4_intro, or3_intro2, or3_intro1/
69 lemma cpg_inv_atom1_drops: ∀Rt,c,h,I,G,L,T2. ❪G,L❫ ⊢ ⓪[I] ⬈[Rt,c,h] T2 →
71 | ∃∃s. T2 = ⋆(⫯[h]s) & I = Sort s & c = 𝟘𝟙
72 | ∃∃cV,i,K,V,V2. ⇩[i] L ≘ K.ⓓV & ❪G,K❫ ⊢ V ⬈[Rt,cV,h] V2 &
73 ⇧[↑i] V2 ≘ T2 & I = LRef i & c = cV
74 | ∃∃cV,i,K,V,V2. ⇩[i] L ≘ K.ⓛV & ❪G,K❫ ⊢ V ⬈[Rt,cV,h] V2 &
75 ⇧[↑i] V2 ≘ T2 & I = LRef i & c = cV + 𝟘𝟙.
76 #Rt #c #h * #n #G #L #T2 #H
77 [ elim (cpg_inv_sort1 … H) -H *
78 /3 width=3 by or4_intro0, or4_intro1, ex3_intro, conj/
79 | elim (cpg_inv_lref1_drops … H) -H *
80 /3 width=10 by or4_intro0, or4_intro2, or4_intro3, ex5_5_intro, conj/
81 | elim (cpg_inv_gref1 … H) -H
82 /3 width=1 by or4_intro0, conj/
86 (* Properties with generic slicing for local environments *******************)
88 (* Note: it should use drops_split_trans_pair2 *)
89 lemma cpg_lifts_sn: ∀Rt. reflexive … Rt →
90 ∀c,h,G. d_liftable2_sn … lifts (cpg Rt h c G).
91 #Rt #HRt #c #h #G #K #T generalize in match c; -c
92 @(fqup_wf_ind_eq (Ⓣ) … G K T) -G -K -T #G0 #K0 #T0 #IH #G #K * *
93 [ #s #HG #HK #HT #c #X2 #H2 #b #f #L #HLK #X1 #H1 destruct -IH
94 lapply (lifts_inv_sort1 … H1) -H1 #H destruct
95 elim (cpg_inv_sort1 … H2) -H2 * #H1 #H2 destruct
96 /2 width=3 by cpg_atom, cpg_ess, lifts_sort, ex2_intro/
97 | #i1 #HG #HK #HT #c #T2 #H2 #b #f #L #HLK #X1 #H1 destruct
98 elim (cpg_inv_lref1_drops … H2) -H2 *
99 [ #H1 #H2 destruct /3 width=3 by cpg_refl, ex2_intro/ ]
100 #cV #K0 #V #V2 #HK0 #HV2 #HVT2 #H destruct
101 elim (lifts_inv_lref1 … H1) -H1 #i2 #Hf #H destruct
102 lapply (drops_trans … HLK … HK0 ??) -HLK [3,6: |*: // ] #H
103 elim (drops_split_trans … H) -H [1,6: |*: /2 width=6 by after_uni_dx/ ] #Y #HL0 #HY
104 lapply (drops_tls_at … Hf … HY) -HY #HY
105 elim (drops_inv_skip2 … HY) -HY #Z #L0 #HLK0 #HZ #H destruct
106 elim (liftsb_inv_pair_sn … HZ) -HZ #W #HVW #H destruct
107 elim (IH … HV2 … HLK0 … HVW) -IH /2 width=2 by fqup_lref/ -K -K0 -V #W2 #HVW2 #HW2
108 elim (lifts_total W2 (𝐔❨↑i2❩)) #U2 #HWU2
109 lapply (lifts_trans … HVW2 … HWU2 ??) -HVW2 [3,6: |*: // ] #HVU2
110 lapply (lifts_conf … HVT2 … HVU2 f ?) -V2 [1,3: /2 width=3 by after_uni_succ_sn/ ]
111 /4 width=8 by cpg_ell_drops, cpg_delta_drops, drops_inv_gen, ex2_intro/
112 | #l #HG #HK #HT #c #X2 #H2 #b #f #L #HLK #X1 #H1 destruct -IH
113 lapply (lifts_inv_gref1 … H1) -H1 #H destruct
114 elim (cpg_inv_gref1 … H2) -H2 #H1 #H2 destruct
115 /2 width=3 by cpg_atom, lifts_gref, ex2_intro/
116 | #p #I #V1 #T1 #HG #HK #HT #c #X2 #H2 #b #f #L #HLK #X1 #H1 destruct
117 elim (lifts_inv_bind1 … H1) -H1 #W1 #U1 #HVW1 #HTU1 #H destruct
118 elim (cpg_inv_bind1 … H2) -H2 *
119 [ #cV #cT #V2 #T2 #HV12 #HT12 #H1 #H2 destruct
120 elim (IH … HV12 … HLK … HVW1) -HV12 //
121 elim (IH … HT12 … HTU1) -IH -HT12 -HTU1 [ |*: /3 width=3 by drops_skip, ext2_pair/ ]
122 /3 width=5 by cpg_bind, lifts_bind, ex2_intro/
123 | #cT #T2 #HT21 #HTX2 #H1 #H2 #H3 destruct
124 elim (lifts_trans4_one … HT21 … HTU1) -HTU1 #U2 #HTU2 #HU21
125 elim (IH … HTX2 … HLK … HTU2) [| /3 width=1 by fqup_zeta/ ] -K -V1 -T1 -T2
126 /3 width=5 by cpg_zeta, ex2_intro/
128 | * #V1 #T1 #HG #HK #HT #c #X2 #H2 #b #f #L #HLK #X1 #H1 destruct
129 elim (lifts_inv_flat1 … H1) -H1 #W1 #U1 #HVW1 #HTU1 #H destruct
130 [ elim (cpg_inv_appl1 … H2) -H2 *
131 [ #cV #cT #V2 #T2 #HV12 #HT12 #H1 #H2 destruct
132 elim (IH … HV12 … HLK … HVW1) -HV12 -HVW1 //
133 elim (IH … HT12 … HLK … HTU1) -IH -HT12 -HLK -HTU1 //
134 /3 width=5 by cpg_appl, lifts_flat, ex2_intro/
135 | #cV #cY #cT #a #V2 #Y1 #Y2 #T0 #T2 #HV12 #HY12 #HT12 #H1 #H2 #H3 destruct
136 elim (lifts_inv_bind1 … HTU1) -HTU1 #Z1 #U0 #HYZ1 #HTU1 #H destruct
137 elim (IH … HV12 … HLK … HVW1) -HV12 -HVW1 //
138 elim (IH … HY12 … HLK … HYZ1) -HY12 //
139 elim (IH … HT12 … HTU1) -IH -HT12 -HTU1 [ |*: /3 width=3 by drops_skip, ext2_pair/ ]
140 /4 width=7 by cpg_beta, lifts_bind, lifts_flat, ex2_intro/
141 | #cV #cY #cT #a #V2 #V20 #Y1 #Y2 #T0 #T2 #HV12 #HV20 #HY12 #HT12 #H1 #H2 #H3 destruct
142 elim (lifts_inv_bind1 … HTU1) -HTU1 #Z1 #U0 #HYZ1 #HTU1 #H destruct
143 elim (IH … HV12 … HLK … HVW1) -HV12 -HVW1 // #W2 #HVW2 #HW12
144 elim (IH … HY12 … HLK … HYZ1) -HY12 //
145 elim (IH … HT12 … HTU1) -IH -HT12 -HTU1 [ |*: /3 width=3 by drops_skip, ext2_pair/ ]
146 elim (lifts_total W2 (𝐔❨1❩)) #W20 #HW20
147 lapply (lifts_trans … HVW2 … HW20 ??) -HVW2 [3: |*: // ] #H
148 lapply (lifts_conf … HV20 … H (⫯f) ?) -V2 /2 width=3 by after_uni_one_sn/
149 /4 width=9 by cpg_theta, lifts_bind, lifts_flat, ex2_intro/
151 | elim (cpg_inv_cast1 … H2) -H2 *
152 [ #cV #cT #V2 #T2 #HV12 #HT12 #HcVT #H1 #H2 destruct
153 elim (IH … HV12 … HLK … HVW1) -HV12 -HVW1 //
154 elim (IH … HT12 … HLK … HTU1) -IH -HT12 -HLK -HTU1 //
155 /3 width=5 by cpg_cast, lifts_flat, ex2_intro/
156 | #cT #HT12 #H destruct
157 elim (IH … HT12 … HLK … HTU1) -IH -HT12 -HLK -HTU1 //
158 /3 width=3 by cpg_eps, ex2_intro/
159 | #cV #HV12 #H destruct
160 elim (IH … HV12 … HLK … HVW1) -IH -HV12 -HLK -HVW1 //
161 /3 width=3 by cpg_ee, ex2_intro/
167 lemma cpg_lifts_bi: ∀Rt. reflexive … Rt →
168 ∀c,h,G. d_liftable2_bi … lifts (cpg Rt h c G).
169 /3 width=12 by cpg_lifts_sn, d_liftable2_sn_bi, lifts_mono/ qed-.
171 (* Inversion lemmas with generic slicing for local environments *************)
173 lemma cpg_inv_lifts_sn: ∀Rt. reflexive … Rt →
174 ∀c,h,G. d_deliftable2_sn … lifts (cpg Rt h c G).
175 #Rt #HRt #c #h #G #L #U generalize in match c; -c
176 @(fqup_wf_ind_eq (Ⓣ) … G L U) -G -L -U #G0 #L0 #U0 #IH #G #L * *
177 [ #s #HG #HL #HU #c #X2 #H2 #b #f #K #HLK #X1 #H1 destruct -IH
178 lapply (lifts_inv_sort2 … H1) -H1 #H destruct
179 elim (cpg_inv_sort1 … H2) -H2 * #H1 #H2 destruct
180 /2 width=3 by cpg_atom, cpg_ess, lifts_sort, ex2_intro/
181 | #i2 #HG #HL #HU #c #U2 #H2 #b #f #K #HLK #X1 #H1 destruct
182 elim (cpg_inv_lref1_drops … H2) -H2 *
183 [ #H1 #H2 destruct /3 width=3 by cpg_refl, ex2_intro/ ]
184 #cW #L0 #W #W2 #HL0 #HW2 #HWU2 #H destruct
185 elim (lifts_inv_lref2 … H1) -H1 #i1 #Hf #H destruct
186 lapply (drops_split_div … HLK (𝐔❨i1❩) ???) -HLK [4,8: * |*: // ] #Y0 #HK0 #HLY0
187 lapply (drops_conf … HL0 … HLY0 ??) -HLY0 [3,6: |*: /2 width=6 by after_uni_dx/ ] #HLY0
188 lapply (drops_tls_at … Hf … HLY0) -HLY0 #HLY0
189 elim (drops_inv_skip1 … HLY0) -HLY0 #Z #K0 #HLK0 #HZ #H destruct
190 elim (liftsb_inv_pair_dx … HZ) -HZ #V #HVW #H destruct
191 elim (IH … HW2 … HLK0 … HVW) -IH /2 width=2 by fqup_lref/ -L -L0 -W #V2 #HVW2 #HV2
192 lapply (lifts_trans … HVW2 … HWU2 ??) -W2 [3,6: |*: // ] #HVU2
193 elim (lifts_split_trans … HVU2 ? f) -HVU2 [1,4: |*: /2 width=4 by after_uni_succ_sn/ ]
194 /4 width=8 by cpg_ell_drops, cpg_delta_drops, drops_inv_F, ex2_intro/
195 | #l #HG #HL #HU #c #X2 #H2 #b #f #K #HLK #X1 #H1 destruct -IH
196 lapply (lifts_inv_gref2 … H1) -H1 #H destruct
197 elim (cpg_inv_gref1 … H2) -H2 #H1 #H2 destruct
198 /2 width=3 by cpg_atom, lifts_gref, ex2_intro/
199 | #p #I #W1 #U1 #HG #HL #HU #c #X2 #H2 #b #f #K #HLK #X1 #H1 destruct
200 elim (lifts_inv_bind2 … H1) -H1 #V1 #T1 #HVW1 #HTU1 #H destruct
201 elim (cpg_inv_bind1 … H2) -H2 *
202 [ #cW #cU #W2 #U2 #HW12 #HU12 #H1 #H2 destruct
203 elim (IH … HW12 … HLK … HVW1) -HW12 //
204 elim (IH … HU12 … HTU1) -IH -HU12 -HTU1 [ |*: /3 width=3 by drops_skip, ext2_pair/ ]
205 /3 width=5 by cpg_bind, lifts_bind, ex2_intro/
206 | #cU #U2 #HU21 #HUX2 #H1 #H2 #H3 destruct
207 elim (lifts_div4_one … HTU1 … HU21) -HTU1 #T2 #HT21 #HTU2
208 elim (IH … HUX2 … HLK … HTU2) [| /3 width=1 by fqup_zeta/ ] -L -W1 -U1 -U2
209 /3 width=5 by cpg_zeta, ex2_intro/
211 | * #W1 #U1 #HG #HL #HU #c #X2 #H2 #b #f #K #HLK #X1 #H1 destruct
212 elim (lifts_inv_flat2 … H1) -H1 #V1 #T1 #HVW1 #HTU1 #H destruct
213 [ elim (cpg_inv_appl1 … H2) -H2 *
214 [ #cW #cU #W2 #U2 #HW12 #HU12 #H1 #H2 destruct
215 elim (IH … HW12 … HLK … HVW1) -HW12 -HVW1 //
216 elim (IH … HU12 … HLK … HTU1) -IH -HU12 -HLK -HTU1 //
217 /3 width=5 by cpg_appl, lifts_flat, ex2_intro/
218 | #cW #cZ #cU #a #W2 #Z1 #Z2 #U0 #U2 #HW12 #HZ12 #HU12 #H1 #H2 #H3 destruct
219 elim (lifts_inv_bind2 … HTU1) -HTU1 #Y1 #T0 #HYZ1 #HTU1 #H destruct
220 elim (IH … HW12 … HLK … HVW1) -HW12 -HVW1 //
221 elim (IH … HZ12 … HLK … HYZ1) -HZ12 //
222 elim (IH … HU12 … HTU1) -IH -HU12 -HTU1 [ |*: /3 width=3 by drops_skip, ext2_pair/ ]
223 /4 width=7 by cpg_beta, lifts_bind, lifts_flat, ex2_intro/
224 | #cW #cZ #cU #a #W2 #W20 #Z1 #Z2 #U0 #U2 #HW12 #HW20 #HZ12 #HU12 #H1 #H2 #H3 destruct
225 elim (lifts_inv_bind2 … HTU1) -HTU1 #Y1 #T0 #HYZ1 #HTU1 #H destruct
226 elim (IH … HW12 … HLK … HVW1) -HW12 -HVW1 // #V2 #HVW2 #HV12
227 elim (IH … HZ12 … HLK … HYZ1) -HZ12 //
228 elim (IH … HU12 … HTU1) -IH -HU12 -HTU1 [ |*: /3 width=3 by drops_skip, ext2_pair/ ]
229 lapply (lifts_trans … HVW2 … HW20 ??) -W2 [3: |*: // ] #H
230 elim (lifts_split_trans … H ? (⫯f)) -H [ |*: /2 width=3 by after_uni_one_sn/ ]
231 /4 width=9 by cpg_theta, lifts_bind, lifts_flat, ex2_intro/
233 | elim (cpg_inv_cast1 … H2) -H2 *
234 [ #cW #cU #W2 #U2 #HW12 #HU12 #HcWU #H1 #H2 destruct
235 elim (IH … HW12 … HLK … HVW1) -HW12 -HVW1 //
236 elim (IH … HU12 … HLK … HTU1) -IH -HU12 -HLK -HTU1 //
237 /3 width=5 by cpg_cast, lifts_flat, ex2_intro/
238 | #cU #HU12 #H destruct
239 elim (IH … HU12 … HLK … HTU1) -IH -HU12 -HLK -HTU1 //
240 /3 width=3 by cpg_eps, ex2_intro/
241 | #cW #HW12 #H destruct
242 elim (IH … HW12 … HLK … HVW1) -IH -HW12 -HLK -HVW1 //
243 /3 width=3 by cpg_ee, ex2_intro/
249 lemma cpg_inv_lifts_bi: ∀Rt. reflexive … Rt →
250 ∀c,h,G. d_deliftable2_bi … lifts (cpg Rt h c G).
251 /3 width=12 by cpg_inv_lifts_sn, d_deliftable2_sn_bi, lifts_inj/ qed-.