]> matita.cs.unibo.it Git - helm.git/blobdiff - 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
index 8b33836a250f77f43660632e261970e7b2d8e192..4e66d137de367a4df8a8e5052258e1731cc823ae 100644 (file)
 (*                                                                        *)
 (**************************************************************************)
 
-include "basic_2/relocation/drops_drops.ma".
-include "basic_2/s_computation/fqup_weight.ma".
-include "basic_2/s_computation/fqup_drops.ma".
+include "ground/xoa/ex_5_5.ma".
+include "static_2/relocation/drops_drops.ma".
+include "static_2/s_computation/fqup_weight.ma".
+include "static_2/s_computation/fqup_drops.ma".
 include "basic_2/rt_transition/cpg.ma".
 
-(* COUNTED CONTEXT-SENSITIVE PARALLEL RT-TRANSITION FOR TERMS ***************)
+(* BOUND CONTEXT-SENSITIVE PARALLEL RT-TRANSITION FOR TERMS *****************)
 
 (* Advanced properties ******************************************************)
 
-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 →
-                       ⬆*[↑i] V2 ≘ T2 →  ⦃G, L⦄ ⊢ #i ⬈[Rt, c, h] T2.
-#Rt #c #h #G #K #V #V2 #i elim i -i
+lemma cpg_delta_drops (Rs) (Rk) (c) (G) (K):
+      ∀V,V2,i,L,T2. ⇩[i] L ≘ K.ⓓV → ❪G,K❫ ⊢ V ⬈[Rs,Rk,c] V2 →
+      ⇧[↑i] V2 ≘ T2 → ❪G,L❫ ⊢ #i ⬈[Rs,Rk,c] T2.
+#Rs #Rk #c #G #K #V #V2 #i elim i -i
 [ #L #T2 #HLK lapply (drops_fwd_isid … HLK ?) // #H destruct /3 width=3 by cpg_delta/
 | #i #IH #L0 #T0 #H0 #HV2 #HVT2
   elim (drops_inv_succ … H0) -H0 #I #L #HLK #H destruct
-  elim (lifts_split_trans â\80¦ HVT2 (ð\9d\90\94â\9d´â\86\91\9dµ) (ð\9d\90\94â\9d´1â\9dµ) ?) -HVT2 /3 width=3 by cpg_lref/
+  elim (lifts_split_trans â\80¦ HVT2 (ð\9d\90\94â\9d¨â\86\91\9d©) (ð\9d\90\94â\9d¨1â\9d©) ?) -HVT2 /3 width=3 by cpg_lref/
 ]
 qed.
 
-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 →
-                     ⬆*[↑i] V2 ≘ T2 →  ⦃G, L⦄ ⊢ #i ⬈[Rt, c+𝟘𝟙, h] T2.
-#Rt #c #h #G #K #V #V2 #i elim i -i
+lemma cpg_ell_drops (Rs) (Rk) (c) (G) (K):
+      ∀V,V2,i,L,T2. ⇩[i] L ≘ K.ⓛV → ❪G,K❫ ⊢ V ⬈[Rs,Rk,c] V2 →
+      ⇧[↑i] V2 ≘ T2 → ❪G,L❫ ⊢ #i ⬈[Rs,Rk,c+𝟘𝟙] T2.
+#Rs #Rk #c #G #K #V #V2 #i elim i -i
 [ #L #T2 #HLK lapply (drops_fwd_isid … HLK ?) // #H destruct /3 width=3 by cpg_ell/
 | #i #IH #L0 #T0 #H0 #HV2 #HVT2
   elim (drops_inv_succ … H0) -H0 #I #L #HLK #H destruct
-  elim (lifts_split_trans â\80¦ HVT2 (ð\9d\90\94â\9d´â\86\91\9dµ) (ð\9d\90\94â\9d´1â\9dµ) ?) -HVT2 /3 width=3 by cpg_lref/
+  elim (lifts_split_trans â\80¦ HVT2 (ð\9d\90\94â\9d¨â\86\91\9d©) (ð\9d\90\94â\9d¨1â\9d©) ?) -HVT2 /3 width=3 by cpg_lref/
 ]
 qed.
 
 (* Advanced inversion lemmas ************************************************)
 
-lemma cpg_inv_lref1_drops: ∀Rt,c,h,G,i,L,T2. ⦃G, L⦄ ⊢ #i ⬈[Rt,c, h] T2 →
-                           ∨∨ T2 = #i ∧ c = 𝟘𝟘
-                            | ∃∃cV,K,V,V2. ⬇*[i] L ≘ K.ⓓV & ⦃G, K⦄ ⊢ V ⬈[Rt, cV, h] V2 &
-                                           ⬆*[↑i] V2 ≘ T2 & c = cV
-                            | ∃∃cV,K,V,V2. ⬇*[i] L ≘ K.ⓛV & ⦃G, K⦄ ⊢ V ⬈[Rt, cV, h] V2 &
-                                           ⬆*[↑i] V2 ≘ T2 & c = cV + 𝟘𝟙.
-#Rt #c #h #G #i elim i -i
+lemma cpg_inv_lref1_drops (Rs) (Rk) (c) (G):
+      ∀i,L,T2. ❪G,L❫ ⊢ #i ⬈[Rs,Rk,c] T2 →
+      ∨∨ ∧∧ T2 = #i & c = 𝟘𝟘
+       | ∃∃cV,K,V,V2. ⇩[i] L ≘ K.ⓓV & ❪G,K❫ ⊢ V ⬈[Rs,Rk,cV] V2 & ⇧[↑i] V2 ≘ T2 & c = cV
+       | ∃∃cV,K,V,V2. ⇩[i] L ≘ K.ⓛV & ❪G,K❫ ⊢ V ⬈[Rs,Rk,cV] V2 & ⇧[↑i] V2 ≘ T2 & c = cV + 𝟘𝟙.
+#Rs #Rk #c #G #i elim i -i
 [ #L #T2 #H elim (cpg_inv_zero1 … H) -H * /3 width=1 by or3_intro0, conj/
   /4 width=8 by drops_refl, ex4_4_intro, or3_intro2, or3_intro1/
 | #i #IH #L #T2 #H elim (cpg_inv_lref1 … H) -H * /3 width=1 by or3_intro0, conj/
   #I #K #V2 #H #HVT2 #H0 destruct elim (IH … H) -IH -H
-  [ * #H1 #H2 destruct lapply (lifts_inv_lref1_uni … HVT2) -HVT2 #H destruct /3 width=1 by or3_intro0, conj/ ] *
+  [ * #H1 #H2 destruct
+    lapply (lifts_inv_lref1_uni … HVT2) -HVT2 #H destruct
+    /3 width=1 by or3_intro0, conj/
+  ] *
   #cV #L #W #W2 #HKL #HW2 #HWV2 #H destruct
-  lapply (lifts_trans … HWV2 … HVT2 ??) -V2
+  lapply (lifts_trans … HWV2 … HVT2 (𝐔❨↑↑i❩) ?) -V2 [1,3: // ] #H (**) (* explicit rtmap *)
   /4 width=8 by drops_drop, ex4_4_intro, or3_intro2, or3_intro1/
 ]
 qed-.
 
-lemma cpg_inv_atom1_drops: ∀Rt,c,h,I,G,L,T2. ⦃G, L⦄ ⊢ ⓪{I} ⬈[Rt, c, h] T2 →
-                           ∨∨ T2 = ⓪{I} ∧ c = 𝟘𝟘
-                            | ∃∃s. T2 = ⋆(next h s) & I = Sort s & c = 𝟘𝟙
-                            | ∃∃cV,i,K,V,V2. ⬇*[i] L ≘ K.ⓓV & ⦃G, K⦄ ⊢ V ⬈[Rt, cV, h] V2 &
-                                             ⬆*[↑i] V2 ≘ T2 & I = LRef i & c = cV
-                            | ∃∃cV,i,K,V,V2. ⬇*[i] L ≘ K.ⓛV & ⦃G, K⦄ ⊢ V ⬈[Rt, cV, h] V2 &
-                                             ⬆*[↑i] V2 ≘ T2 & I = LRef i & c = cV + 𝟘𝟙.
-#Rt #c #h * #n #G #L #T2 #H
+lemma cpg_inv_atom1_drops (Rs) (Rk) (c) (G) (L):
+      ∀I,T2. ❪G,L❫ ⊢ ⓪[I] ⬈[Rs,Rk,c] T2 →
+      ∨∨ ∧∧ T2 = ⓪[I] & c = 𝟘𝟘
+       | ∃∃s1,s2. Rs s1 s2 & T2 = ⋆s2 & I = Sort s1 & c = 𝟘𝟙
+       | ∃∃cV,i,K,V,V2. ⇩[i] L ≘ K.ⓓV & ❪G,K❫ ⊢ V ⬈[Rs,Rk,cV] V2 & ⇧[↑i] V2 ≘ T2 & I = LRef i & c = cV
+       | ∃∃cV,i,K,V,V2. ⇩[i] L ≘ K.ⓛV & ❪G,K❫ ⊢ V ⬈[Rs,Rk,cV] V2 & ⇧[↑i] V2 ≘ T2 & I = LRef i & c = cV + 𝟘𝟙.
+#Rs #Rk #c #G #L * #x #T2 #H
 [ elim (cpg_inv_sort1 … H) -H *
-  /3 width=3 by or4_intro0, or4_intro1, ex3_intro, conj/
+  /3 width=5 by or4_intro0, or4_intro1, ex4_2_intro, conj/
 | elim (cpg_inv_lref1_drops … H) -H *
   /3 width=10 by or4_intro0, or4_intro2, or4_intro3, ex5_5_intro, conj/
 | elim (cpg_inv_gref1 … H) -H
@@ -81,14 +85,16 @@ qed-.
 (* Properties with generic slicing for local environments *******************)
 
 (* Note: it should use drops_split_trans_pair2 *)
-lemma cpg_lifts_sn: ∀Rt. reflexive … Rt →
-                    ∀c,h,G. d_liftable2_sn … lifts (cpg Rt h c G).
-#Rt #HRt #c #h #G #K #T generalize in match c; -c
+lemma cpg_lifts_sn (Rs) (Rk) (c) (G): reflexive … Rk →
+      d_liftable2_sn … lifts (cpg Rs Rk c G).
+#Rs #Rk #c #G #HRk #K #T generalize in match c; -c
 @(fqup_wf_ind_eq (Ⓣ) … G K T) -G -K -T #G0 #K0 #T0 #IH #G #K * *
-[ #s #HG #HK #HT #c #X2 #H2 #b #f #L #HLK #X1 #H1 destruct -IH
+[ #s1 #HG #HK #HT #c #X2 #H2 #b #f #L #HLK #X1 #H1 destruct -IH
   lapply (lifts_inv_sort1 … H1) -H1 #H destruct
-  elim (cpg_inv_sort1 … H2) -H2 * #H1 #H2 destruct
-  /2 width=3 by cpg_atom, cpg_ess, lifts_sort, ex2_intro/
+  elim (cpg_inv_sort1 … H2) -H2 *
+  [ #H1 #H2 destruct /2 width=3 by cpg_atom, lifts_sort, ex2_intro/
+  | #s2 #HRs #H1 #H2 destruct /3 width=3 by cpg_ess, lifts_sort, ex2_intro/
+  ]
 | #i1 #HG #HK #HT #c #T2 #H2 #b #f #L #HLK #X1 #H1 destruct
   elim (cpg_inv_lref1_drops … H2) -H2 *
   [ #H1 #H2 destruct /3 width=3 by cpg_refl, ex2_intro/ ]
@@ -100,7 +106,7 @@ lemma cpg_lifts_sn: ∀Rt. reflexive … Rt →
   elim (drops_inv_skip2 … HY) -HY #Z #L0 #HLK0 #HZ #H destruct
   elim (liftsb_inv_pair_sn … HZ) -HZ #W #HVW #H destruct
   elim (IH … HV2 … HLK0 … HVW) -IH /2 width=2 by fqup_lref/ -K -K0 -V #W2 #HVW2 #HW2
-  elim (lifts_total W2 (ð\9d\90\94â\9d´â\86\91i2â\9dµ)) #U2 #HWU2
+  elim (lifts_total W2 (ð\9d\90\94â\9d¨â\86\91i2â\9d©)) #U2 #HWU2
   lapply (lifts_trans … HVW2 … HWU2 ??) -HVW2 [3,6: |*: // ] #HVU2
   lapply (lifts_conf … HVT2 … HVU2 f ?) -V2 [1,3: /2 width=3 by after_uni_succ_sn/ ]
   /4 width=8 by cpg_ell_drops, cpg_delta_drops, drops_inv_gen, ex2_intro/
@@ -115,10 +121,9 @@ lemma cpg_lifts_sn: ∀Rt. reflexive … Rt →
     elim (IH … HV12 … HLK … HVW1) -HV12 //
     elim (IH … HT12 … HTU1) -IH -HT12 -HTU1 [ |*: /3 width=3 by drops_skip, ext2_pair/ ]
     /3 width=5 by cpg_bind, lifts_bind, ex2_intro/
-  | #cT #T2 #HT12 #HXT2 #H1 #H2 #H3 destruct
-    elim (IH … HT12 … HTU1) -IH -HT12 -HTU1 [ |*: /3 width=3 by drops_skip, ext2_pair/ ] #U2 #HTU2 #HU12
-    lapply (lifts_trans … HXT2 … HTU2 ??) -T2 [3: |*: // ] #HXU2
-    elim (lifts_split_trans … HXU2 f (𝐔❴↑O❵)) [2: /2 width=1 by after_uni_one_dx/ ]
+  | #cT #T2 #HT21 #HTX2 #H1 #H2 #H3 destruct
+    elim (lifts_trans4_one … HT21 … HTU1) -HTU1 #U2 #HTU2 #HU21
+    elim (IH … HTX2 … HLK … HTU2) [| /3 width=1 by fqup_zeta/ ] -K -V1 -T1 -T2
     /3 width=5 by cpg_zeta, ex2_intro/
   ]
 | * #V1 #T1 #HG #HK #HT #c #X2 #H2 #b #f #L #HLK #X1 #H1 destruct
@@ -139,7 +144,7 @@ lemma cpg_lifts_sn: ∀Rt. reflexive … Rt →
       elim (IH … HV12 … HLK … HVW1) -HV12 -HVW1 // #W2 #HVW2 #HW12
       elim (IH … HY12 … HLK … HYZ1) -HY12 //
       elim (IH … HT12 … HTU1) -IH -HT12 -HTU1 [ |*: /3 width=3 by drops_skip, ext2_pair/ ]
-      elim (lifts_total W2 (ð\9d\90\94â\9d´1â\9dµ)) #W20 #HW20
+      elim (lifts_total W2 (ð\9d\90\94â\9d¨1â\9d©)) #W20 #HW20
       lapply (lifts_trans … HVW2 … HW20 ??) -HVW2 [3: |*: // ] #H
       lapply (lifts_conf … HV20 … H (⫯f) ?) -V2 /2 width=3 by after_uni_one_sn/
       /4 width=9 by cpg_theta, lifts_bind, lifts_flat, ex2_intro/
@@ -160,26 +165,28 @@ lemma cpg_lifts_sn: ∀Rt. reflexive … Rt →
 ]
 qed-.
 
-lemma cpg_lifts_bi: ∀Rt. reflexive … Rt →
-                    ∀c,h,G. d_liftable2_bi … lifts (cpg Rt h c G).
+lemma cpg_lifts_bi (Rs) (Rk) (c) (G): reflexive … Rk →
+      d_liftable2_bi … lifts (cpg Rs Rk c G).
 /3 width=12 by cpg_lifts_sn, d_liftable2_sn_bi, lifts_mono/ qed-.
 
 (* Inversion lemmas with generic slicing for local environments *************)
 
-lemma cpg_inv_lifts_sn: ∀Rt. reflexive … Rt →
-                        ∀c,h,G. d_deliftable2_sn … lifts (cpg Rt h c G).
-#Rt #HRt #c #h #G #L #U generalize in match c; -c
+lemma cpg_inv_lifts_sn (Rs) (Rk) (c) (G): reflexive … Rk →
+      d_deliftable2_sn … lifts (cpg Rs Rk c G).
+#Rs #Rk #c #G #HRk #L #U generalize in match c; -c
 @(fqup_wf_ind_eq (Ⓣ) … G L U) -G -L -U #G0 #L0 #U0 #IH #G #L * *
-[ #s #HG #HL #HU #c #X2 #H2 #b #f #K #HLK #X1 #H1 destruct -IH
+[ #s1 #HG #HL #HU #c #X2 #H2 #b #f #K #HLK #X1 #H1 destruct -IH
   lapply (lifts_inv_sort2 … H1) -H1 #H destruct
-  elim (cpg_inv_sort1 … H2) -H2 * #H1 #H2 destruct
-  /2 width=3 by cpg_atom, cpg_ess, lifts_sort, ex2_intro/
+  elim (cpg_inv_sort1 … H2) -H2 *
+  [ #H1 #H2 destruct /2 width=3 by cpg_atom, lifts_sort, ex2_intro/
+  | #s2 #HRs #H1 #H2 destruct /3 width=3 by cpg_ess, lifts_sort, ex2_intro/
+  ] 
 | #i2 #HG #HL #HU #c #U2 #H2 #b #f #K #HLK #X1 #H1 destruct
   elim (cpg_inv_lref1_drops … H2) -H2 *
   [ #H1 #H2 destruct /3 width=3 by cpg_refl, ex2_intro/ ]
   #cW #L0 #W #W2 #HL0 #HW2 #HWU2 #H destruct
   elim (lifts_inv_lref2 … H1) -H1 #i1 #Hf #H destruct
-  lapply (drops_split_div â\80¦ HLK (ð\9d\90\94â\9d´i1â\9dµ) ???) -HLK [4,8: * |*: // ] #Y0 #HK0 #HLY0
+  lapply (drops_split_div â\80¦ HLK (ð\9d\90\94â\9d¨i1â\9d©) ???) -HLK [4,8: * |*: // ] #Y0 #HK0 #HLY0
   lapply (drops_conf … HL0 … HLY0 ??) -HLY0 [3,6: |*: /2 width=6 by after_uni_dx/ ] #HLY0
   lapply (drops_tls_at … Hf … HLY0) -HLY0 #HLY0
   elim (drops_inv_skip1 … HLY0) -HLY0 #Z #K0 #HLK0 #HZ #H destruct
@@ -199,9 +206,10 @@ lemma cpg_inv_lifts_sn: ∀Rt. reflexive … Rt →
     elim (IH … HW12 … HLK … HVW1) -HW12 //
     elim (IH … HU12 … HTU1) -IH -HU12 -HTU1 [ |*: /3 width=3 by drops_skip, ext2_pair/ ]
     /3 width=5 by cpg_bind, lifts_bind, ex2_intro/
-  | #cU #U2 #HU12 #HXU2 #H1 #H2 #H3 destruct
-    elim (IH … HU12 … HTU1) -IH -HU12 -HTU1 [ |*: /3 width=3 by drops_skip, ext2_pair/ ] #T2 #HTU2 #HT12
-    elim (lifts_div4_one … HTU2 … HXU2) -U2 /3 width=5 by cpg_zeta, ex2_intro/
+  | #cU #U2 #HU21 #HUX2 #H1 #H2 #H3 destruct
+    elim (lifts_div4_one … HTU1 … HU21) -HTU1 #T2 #HT21 #HTU2
+    elim (IH … HUX2 … HLK … HTU2) [| /3 width=1 by fqup_zeta/ ] -L -W1 -U1 -U2
+    /3 width=5 by cpg_zeta, ex2_intro/
   ]
 | * #W1 #U1 #HG #HL #HU #c #X2 #H2 #b #f #K #HLK #X1 #H1 destruct
   elim (lifts_inv_flat2 … H1) -H1 #V1 #T1 #HVW1 #HTU1 #H destruct
@@ -241,6 +249,6 @@ lemma cpg_inv_lifts_sn: ∀Rt. reflexive … Rt →
 ]
 qed-.
 
-lemma cpg_inv_lifts_bi: ∀Rt. reflexive … Rt →
-                        ∀c,h,G. d_deliftable2_bi … lifts (cpg Rt h c G).
+lemma cpg_inv_lifts_bi (Rs) (Rk) (c) (G): reflexive … Rk →
+      d_deliftable2_bi … lifts (cpg Rs Rk c G).
 /3 width=12 by cpg_inv_lifts_sn, d_deliftable2_sn_bi, lifts_inj/ qed-.