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