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