]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/rt_transition/cpg_drops.ma
bug fix in cpg allows to prove lsubr_cpg_trans
[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 "basic_2/relocation/drops_drops.ma".
16 include "basic_2/s_computation/fqup_weight.ma".
17 include "basic_2/s_computation/fqup_drops.ma".
18 include "basic_2/rt_transition/cpg.ma".
19
20 (* CONTEXT-SENSITIVE GENERIC PARALLEL RT-TRANSITION FOR TERMS ***************)
21
22 (* Advanced properties ******************************************************)
23
24 lemma cpg_delta_drops: ∀c,h,G,K,V,V2,i,L,T2. ⬇*[i] L ≡ K.ⓓV → ⦃G, K⦄ ⊢ V ➡[c, h] V2 →
25                        ⬆*[⫯i] V2 ≡ T2 →  ⦃G, L⦄ ⊢ #i ➡[c, h] T2.
26 #c #h #G #K #V #V2 #i elim i -i
27 [ #L #T2 #HLK lapply (drops_fwd_isid … HLK ?) // #H destruct /3 width=3 by cpg_delta/
28 | #i #IH #L0 #T0 #H0 #HV2 #HVT2
29   elim (drops_inv_succ … H0) -H0 #I #L #V0 #HLK #H destruct
30   elim (lifts_split_trans … HVT2 (𝐔❴⫯i❵) (𝐔❴1❵) ?) -HVT2 /3 width=3 by cpg_lref/
31 ]
32 qed.
33
34 lemma cpg_ell_drops: ∀c,h,G,K,V,V2,i,L,T2. ⬇*[i] L ≡ K.ⓛV → ⦃G, K⦄ ⊢ V ➡[c, h] V2 →
35                      ⬆*[⫯i] V2 ≡ T2 →  ⦃G, L⦄ ⊢ #i ➡[(↓c)+𝟘𝟙, h] T2.
36 #c #h #G #K #V #V2 #i elim i -i
37 [ #L #T2 #HLK lapply (drops_fwd_isid … HLK ?) // #H destruct /3 width=3 by cpg_ell/
38 | #i #IH #L0 #T0 #H0 #HV2 #HVT2
39   elim (drops_inv_succ … H0) -H0 #I #L #V0 #HLK #H destruct
40   elim (lifts_split_trans … HVT2 (𝐔❴⫯i❵) (𝐔❴1❵) ?) -HVT2 /3 width=3 by cpg_lref/
41 ]
42 qed.
43
44 (* Advanced inversion lemmas ************************************************)
45
46 lemma cpg_inv_lref1_drops: ∀c,h,G,i,L,T2. ⦃G, L⦄ ⊢ #i ➡[c, h] T2 →
47                            ∨∨ T2 = #i ∧ c = 𝟘𝟘
48                             | ∃∃cV,K,V,V2. ⬇*[i] L ≡ K.ⓓV & ⦃G, K⦄ ⊢ V ➡[cV, h] V2 &
49                                            ⬆*[⫯i] V2 ≡ T2 & c = cV
50                             | ∃∃cV,K,V,V2. ⬇*[i] L ≡ K.ⓛV & ⦃G, K⦄ ⊢ V ➡[cV, h] V2 &
51                                            ⬆*[⫯i] V2 ≡ T2 & c = (↓cV) + 𝟘𝟙.
52 #c #h #G #i elim i -i
53 [ #L #T2 #H elim (cpg_inv_zero1 … H) -H * /3 width=1 by or3_intro0, conj/
54   /4 width=8 by drops_refl, ex4_4_intro, or3_intro2, or3_intro1/
55 | #i #IH #L #T2 #H elim (cpg_inv_lref1 … H) -H * /3 width=1 by or3_intro0, conj/
56   #I #K #V #V2 #H #HVT2 #H0 destruct elim (IH … H) -IH -H
57   [ * #H1 #H2 destruct lapply (lifts_inv_lref1_uni … HVT2) -HVT2 #H destruct /3 width=1 by or3_intro0, conj/ ] *
58   #cV #L #W #W2 #HKL #HW2 #HWV2 #H destruct
59   lapply (lifts_trans … HWV2 … HVT2 ??) -V2
60   /4 width=8 by drops_drop, ex4_4_intro, or3_intro2, or3_intro1/
61 ]
62 qed-.
63
64 (* Properties with generic slicing for local environments *******************)
65
66 lemma cpg_lifts: ∀c,h,G. d_liftable2 (cpg h c G).
67 #c #h #G #K #T generalize in match c; -c
68 @(fqup_wf_ind_eq … G K T) -G -K -T #G0 #K0 #T0 #IH #G #K * *
69 [ #s #HG #HK #HT #c #X2 #H2 #b #f #L #HLK #X1 #H1 destruct -IH
70   lapply (lifts_inv_sort1 … H1) -H1 #H destruct
71   elim (cpg_inv_sort1 … H2) -H2 * #H1 #H2 destruct
72   /2 width=3 by cpg_atom, cpg_ess, lifts_sort, ex2_intro/
73 | #i1 #HG #HK #HT #c #T2 #H2 #b #f #L #HLK #X1 #H1 destruct
74   elim (cpg_inv_lref1_drops … H2) -H2 *
75   [ #H1 #H2 destruct /2 width=3 by ex2_intro/ ]
76   #cV #K0 #V #V2 #HK0 #HV2 #HVT2 #H destruct
77   elim (lifts_inv_lref1 … H1) -H1 #i2 #Hf #H destruct
78   lapply (drops_trans … HLK … HK0 ??) -HLK [3,6: |*: // ] #H
79   elim (drops_split_trans … H) -H [1,6: |*: /2 width=6 by after_uni_dx/ ] #Y #HL0 #HY
80   lapply (drops_inv_tls_at … Hf … HY) -HY #HY
81   elim (drops_inv_skip2 … HY) -HY #L0 #W #HLK0 #HVW #H destruct
82   elim (IH … HV2 … HLK0 … HVW) -IH /2 width=2 by fqup_lref/ -K -K0 -V #W2 #HVW2 #HW2
83   elim (lifts_total W2 (𝐔❴⫯i2❵)) #U2 #HWU2
84   lapply (lifts_trans … HVW2 … HWU2 ??) -HVW2 [3,6: |*: // ] #HVU2
85   lapply (lifts_conf … HVT2 … HVU2 f ?) -V2 [1,3: /2 width=3 by after_uni_succ_sn/ ]
86   /4 width=8 by cpg_ell_drops, cpg_delta_drops, drops_inv_gen, ex2_intro/
87 | #l #HG #HK #HT #c #X2 #H2 #b #f #L #HLK #X1 #H1 destruct -IH
88   lapply (lifts_inv_gref1 … H1) -H1 #H destruct
89   elim (cpg_inv_gref1 … H2) -H2 #H1 #H2 destruct
90   /2 width=3 by cpg_atom, lifts_gref, ex2_intro/
91 | #p #I #V1 #T1 #HG #HK #HT #c #X2 #H2 #b #f #L #HLK #X1 #H1 destruct
92   elim (lifts_inv_bind1 … H1) -H1 #W1 #U1 #HVW1 #HTU1 #H destruct
93   elim (cpg_inv_bind1 … H2) -H2 *
94   [ #cV #cT #V2 #T2 #HV12 #HT12 #H1 #H2 destruct
95     elim (IH … HV12 … HLK … HVW1) -HV12 //
96     elim (IH … HT12 … HTU1) -IH -HT12 -HTU1 [ |*: /3 width=3 by drops_skip/ ]
97     /3 width=5 by cpg_bind, lifts_bind, ex2_intro/
98   | #cT #T2 #HT12 #HXT2 #H1 #H2 #H3 destruct
99     elim (IH … HT12 … HTU1) -IH -HT12 -HTU1 [ |*: /3 width=3 by drops_skip/ ] #U2 #HTU2 #HU12
100     lapply (lifts_trans … HXT2 … HTU2 ??) -T2 [3: |*: // ] #HXU2
101     elim (lifts_split_trans … HXU2 f (𝐔❴⫯O❵)) [2: /2 width=1 by after_uni_one_dx/ ]
102     /3 width=5 by cpg_zeta, ex2_intro/
103   ]
104 | #I #V1 #T1 #HG #HK #HT #c #X2 #H2 #b #f #L #HLK #X1 #H1 destruct
105   elim (lifts_inv_flat1 … H1) -H1 #W1 #U1 #HVW1 #HTU1 #H destruct
106   elim (cpg_inv_flat1 … H2) -H2 *
107   [ #cV #cT #V2 #T2 #HV12 #HT12 #H1 #H2 destruct
108     elim (IH … HV12 … HLK … HVW1) -HV12 -HVW1 //
109     elim (IH … HT12 … HLK … HTU1) -IH -HT12 -HLK -HTU1 //
110     /3 width=5 by cpg_flat, lifts_flat, ex2_intro/
111   | #cT #HT12 #H1 #H2 destruct
112     elim (IH … HT12 … HLK … HTU1) -IH -HT12 -HLK -HTU1 //
113     /3 width=3 by cpg_eps, ex2_intro/
114   | #cV #HV12 #H1 #H2 destruct
115     elim (IH … HV12 … HLK … HVW1) -IH -HV12 -HLK -HVW1 //
116     /3 width=3 by cpg_ee, ex2_intro/
117   | #cV #cY #cT #a #V2 #Y1 #Y2 #T0 #T2 #HV12 #HY12 #HT12 #H1 #H2 #H3 #H4 destruct
118     elim (lifts_inv_bind1 … HTU1) -HTU1 #Z1 #U0 #HYZ1 #HTU1 #H destruct
119     elim (IH … HV12 … HLK … HVW1) -HV12 -HVW1 //
120     elim (IH … HY12 … HLK … HYZ1) -HY12 //
121     elim (IH … HT12 … HTU1) -IH -HT12 -HTU1 [ |*: /3 width=3 by drops_skip/ ]
122     /4 width=7 by cpg_beta, lifts_bind, lifts_flat, ex2_intro/
123   | #cV #cY #cT #a #V2 #V20 #Y1 #Y2 #T0 #T2 #HV12 #HV20 #HY12 #HT12 #H1 #H2 #H3 #H4 destruct
124     elim (lifts_inv_bind1 … HTU1) -HTU1 #Z1 #U0 #HYZ1 #HTU1 #H destruct
125     elim (IH … HV12 … HLK … HVW1) -HV12 -HVW1 // #W2 #HVW2 #HW12
126     elim (IH … HY12 … HLK … HYZ1) -HY12 //
127     elim (IH … HT12 … HTU1) -IH -HT12 -HTU1 [ |*: /3 width=3 by drops_skip/ ]
128     elim (lifts_total W2 (𝐔❴1❵)) #W20 #HW20
129     lapply (lifts_trans … HVW2 … HW20 ??) -HVW2 [3: |*: // ] #H
130     lapply (lifts_conf … HV20 … H (↑f) ?) -V2 /2 width=3 by after_uni_one_sn/
131     /4 width=9 by cpg_theta, lifts_bind, lifts_flat, ex2_intro/
132   ]
133 ]
134 qed-.
135
136 (* Inversion lemmas with generic slicing for local environments *************)
137
138 lemma cpg_inv_lift1: ∀c,h,G. d_deliftable2_sn (cpg h c G).
139 #c #h #G #L #U generalize in match c; -c
140 @(fqup_wf_ind_eq … G L U) -G -L -U #G0 #L0 #U0 #IH #G #L * *
141 [ #s #HG #HL #HU #c #X2 #H2 #b #f #K #HLK #X1 #H1 destruct -IH
142   lapply (lifts_inv_sort2 … H1) -H1 #H destruct
143   elim (cpg_inv_sort1 … H2) -H2 * #H1 #H2 destruct
144   /2 width=3 by cpg_atom, cpg_ess, lifts_sort, ex2_intro/
145 | #i2 #HG #HL #HU #c #U2 #H2 #b #f #K #HLK #X1 #H1 destruct
146   elim (cpg_inv_lref1_drops … H2) -H2 *
147   [ #H1 #H2 destruct /2 width=3 by ex2_intro/ ]
148   #cW #L0 #W #W2 #HL0 #HW2 #HWU2 #H destruct
149   elim (lifts_inv_lref2 … H1) -H1 #i1 #Hf #H destruct
150   lapply (drops_split_div … HLK (𝐔❴i1❵) ???) -HLK [4,8: * |*: // ] #Y0 #HK0 #HLY0
151   lapply (drops_conf … HL0 … HLY0 ??) -HLY0 [3,6: |*: /2 width=6 by after_uni_dx/ ] #HLY0
152   lapply (drops_inv_tls_at … Hf … HLY0) -HLY0 #HLY0
153   elim (drops_inv_skip1 … HLY0) -HLY0 #K0 #V #HLK0 #HVW #H destruct
154   elim (IH … HW2 … HLK0 … HVW) -IH /2 width=2 by fqup_lref/ -L -L0 -W #V2 #HVW2 #HV2
155   lapply (lifts_trans … HVW2 … HWU2 ??) -W2 [3,6: |*: // ] #HVU2
156   elim (lifts_split_trans … HVU2 ? f) -HVU2 [1,4: |*: /2 width=4 by after_uni_succ_sn/ ]
157   /4 width=8 by cpg_ell_drops, cpg_delta_drops, drops_inv_F, ex2_intro/
158 | #l #HG #HL #HU #c #X2 #H2 #b #f #K #HLK #X1 #H1 destruct -IH
159   lapply (lifts_inv_gref2 … H1) -H1 #H destruct
160   elim (cpg_inv_gref1 … H2) -H2 #H1 #H2 destruct
161   /2 width=3 by cpg_atom, lifts_gref, ex2_intro/
162 | #p #I #W1 #U1 #HG #HL #HU #c #X2 #H2 #b #f #K #HLK #X1 #H1 destruct
163   elim (lifts_inv_bind2 … H1) -H1 #V1 #T1 #HVW1 #HTU1 #H destruct
164   elim (cpg_inv_bind1 … H2) -H2 *
165   [ #cW #cU #W2 #U2 #HW12 #HU12 #H1 #H2 destruct
166     elim (IH … HW12 … HLK … HVW1) -HW12 //
167     elim (IH … HU12 … HTU1) -IH -HU12 -HTU1 [ |*: /3 width=3 by drops_skip/ ]
168     /3 width=5 by cpg_bind, lifts_bind, ex2_intro/
169   | #cU #U2 #HU12 #HXU2 #H1 #H2 #H3 destruct
170     elim (IH … HU12 … HTU1) -IH -HU12 -HTU1 [ |*: /3 width=3 by drops_skip/ ] #T2 #HTU2 #HT12
171     elim (lifts_div4_one … HTU2 … HXU2) -U2 /3 width=5 by cpg_zeta, ex2_intro/
172   ]
173 | #I #W1 #U1 #HG #HL #HU #c #X2 #H2 #b #f #K #HLK #X1 #H1 destruct
174   elim (lifts_inv_flat2 … H1) -H1 #V1 #T1 #HVW1 #HTU1 #H destruct
175   elim (cpg_inv_flat1 … H2) -H2 *
176   [ #cW #cU #W2 #U2 #HW12 #HU12 #H1 #H2 destruct
177     elim (IH … HW12 … HLK … HVW1) -HW12 -HVW1 //
178     elim (IH … HU12 … HLK … HTU1) -IH -HU12 -HLK -HTU1 //
179     /3 width=5 by cpg_flat, lifts_flat, ex2_intro/
180   | #cU #HU12 #H1 #H2 destruct
181     elim (IH … HU12 … HLK … HTU1) -IH -HU12 -HLK -HTU1 //
182     /3 width=3 by cpg_eps, ex2_intro/
183   | #cW #HW12 #H1 #H2 destruct
184     elim (IH … HW12 … HLK … HVW1) -IH -HW12 -HLK -HVW1 //
185     /3 width=3 by cpg_ee, ex2_intro/
186   | #cW #cZ #cU #a #W2 #Z1 #Z2 #U0 #U2 #HW12 #HZ12 #HU12 #H1 #H2 #H3 #H4 destruct
187     elim (lifts_inv_bind2 … HTU1) -HTU1 #Y1 #T0 #HYZ1 #HTU1 #H destruct
188     elim (IH … HW12 … HLK … HVW1) -HW12 -HVW1 //
189     elim (IH … HZ12 … HLK … HYZ1) -HZ12 //
190     elim (IH … HU12 … HTU1) -IH -HU12 -HTU1 [ |*: /3 width=3 by drops_skip/ ]
191     /4 width=7 by cpg_beta, lifts_bind, lifts_flat, ex2_intro/
192   | #cW #cZ #cU #a #W2 #W20 #Z1 #Z2 #U0 #U2 #HW12 #HW20 #HZ12 #HU12 #H1 #H2 #H3 #H4 destruct
193     elim (lifts_inv_bind2 … HTU1) -HTU1 #Y1 #T0 #HYZ1 #HTU1 #H destruct
194     elim (IH … HW12 … HLK … HVW1) -HW12 -HVW1 // #V2 #HVW2 #HV12
195     elim (IH … HZ12 … HLK … HYZ1) -HZ12 //
196     elim (IH … HU12 … HTU1) -IH -HU12 -HTU1 [ |*: /3 width=3 by drops_skip/ ]
197     lapply (lifts_trans … HVW2 … HW20 ??) -W2 [3: |*: // ] #H
198     elim (lifts_split_trans … H ? (↑f)) -H [ |*: /2 width=3 by after_uni_one_sn/ ]
199     /4 width=9 by cpg_theta, lifts_bind, lifts_flat, ex2_intro/
200   ]
201 ]
202 qed-.