]> matita.cs.unibo.it Git - helm.git/blobdiff - matita/matita/contribs/lambda_delta/Basic_2/substitution/tps_lift.ma
- the relocation properties of cpr are closed!
[helm.git] / matita / matita / contribs / lambda_delta / Basic_2 / substitution / tps_lift.ma
index e7243c21255752b48c0c00d0b9033a1df72b99c7..35cff33723f7565bc03d2c17ef31917a1f1e94fa 100644 (file)
@@ -12,7 +12,7 @@
 (*                                                                        *)
 (**************************************************************************)
 
-include "Basic_2/substitution/drop_drop.ma".
+include "Basic_2/substitution/ldrop_ldrop.ma".
 include "Basic_2/substitution/tps.ma".
 
 (* PARTIAL SUBSTITUTION ON TERMS ********************************************)
@@ -25,9 +25,9 @@ fact tps_inv_refl_SO2_aux: ∀L,T1,T2,d,e. L ⊢ T1 [d, e] ≫ T2 → e = 1 →
 [ //
 | #L #K0 #V0 #W #i #d #e #Hdi #Hide #HLK0 #_ #H destruct -e;
   >(le_to_le_to_eq … Hdi ?) /2/ -d #K #V #HLK
-  lapply (drop_mono … HLK0 … HLK) #H destruct
+  lapply (ldrop_mono … HLK0 … HLK) #H destruct
 | #L #I #V1 #V2 #T1 #T2 #d #e #_ #_ #IHV12 #IHT12 #H1 #K #V #HLK
-  >(IHV12 H1 … HLK) -IHV12 >(IHT12 H1 K V) -IHT12 /2/
+  >(IHV12 H1 … HLK) -IHV12 >(IHT12 H1 K V) -IHT12 // /2/
 | #L #I #V1 #V2 #T1 #T2 #d #e #_ #_ #IHV12 #IHT12 #H1 #K #V #HLK
   >(IHV12 H1 … HLK) -IHV12 >(IHT12 H1 … HLK) -IHT12 //
 ]
@@ -48,17 +48,49 @@ lemma tps_lift_le: ∀K,T1,T2,dt,et. K ⊢ T1 [dt, et] ≫ T2 →
 #K #T1 #T2 #dt #et #H elim H -H K T1 T2 dt et
 [ #K #I #dt #et #L #U1 #U2 #d #e #_ #H1 #H2 #_
   >(lift_mono … H1 … H2) -H1 H2 //
-| #K #KV #V #W #i #dt #et #Hdti #Hidet #HKV #HVW #L #U1 #U2 #d #e #HLK #H #HVU2 #Hdetd
+| #K #KV #V #W #i #dt #et #Hdti #Hidet #HKV #HVW #L #U1 #U2 #d #e #HLK #H #HWU2 #Hdetd
   lapply (lt_to_le_to_lt … Hidet … Hdetd) -Hdetd #Hid
   lapply (lift_inv_lref1_lt … H … Hid) -H #H destruct -U1;
-  elim (lift_trans_ge … HVW … HVU2 ?) -HVW HVU2 W // <minus_plus #W #HVW #HWU2
-  elim (drop_trans_le … HLK … HKV ?) -HLK HKV K [2: /2/] #X #HLK #H
-  elim (drop_inv_skip2 … H ?) -H [2: /2/] -Hid #K #Y #_ #HVY
+  elim (lift_trans_ge … HVW … HWU2 ?) -HVW HWU2 W // <minus_plus #W #HVW #HWU2
+  elim (ldrop_trans_le … HLK … HKV ?) -HLK HKV K [2: /2/] #X #HLK #H
+  elim (ldrop_inv_skip2 … H ?) -H [2: /2/] -Hid #K #Y #_ #HVY
   >(lift_mono … HVY … HVW) -HVY HVW Y #H destruct -X /2/
 | #K #I #V1 #V2 #T1 #T2 #dt #et #_ #_ #IHV12 #IHT12 #L #U1 #U2 #d #e #HLK #H1 #H2 #Hdetd
   elim (lift_inv_bind1 … H1) -H1 #VV1 #TT1 #HVV1 #HTT1 #H1
   elim (lift_inv_bind1 … H2) -H2 #VV2 #TT2 #HVV2 #HTT2 #H2 destruct -U1 U2;
-  @tps_bind [ /2 width=6/ | @IHT12 [3,4,5: /2/ |1,2: skip | /2/ ] ] (**) (* /3 width=6/ is too slow, arith3 needed to avoid crash *)
+  @tps_bind [ /2 width=6/ | @IHT12 [4,5: // |1,2: skip | /2/ | /2/ ] ] (**) (* /3 width=6/ is too slow, arith3 needed to avoid crash *)
+| #K #I #V1 #V2 #T1 #T2 #dt #et #_ #_ #IHV12 #IHT12 #L #U1 #U2 #d #e #HLK #H1 #H2 #Hdetd
+  elim (lift_inv_flat1 … H1) -H1 #VV1 #TT1 #HVV1 #HTT1 #H1
+  elim (lift_inv_flat1 … H2) -H2 #VV2 #TT2 #HVV2 #HTT2 #H2 destruct -U1 U2;
+  /3 width=6/
+]
+qed.
+
+lemma tps_lift_be: ∀K,T1,T2,dt,et. K ⊢ T1 [dt, et] ≫ T2 →
+                   ∀L,U1,U2,d,e. ↓[d, e] L ≡ K →
+                   ↑[d, e] T1 ≡ U1 → ↑[d, e] T2 ≡ U2 →
+                   dt ≤ d → d ≤ dt + et →
+                   L ⊢ U1 [dt, et + e] ≫ U2.
+#K #T1 #T2 #dt #et #H elim H -H K T1 T2 dt et
+[ #K #I #dt #et #L #U1 #U2 #d #e #_ #H1 #H2 #_ #_
+  >(lift_mono … H1 … H2) -H1 H2 //
+| #K #KV #V #W #i #dt #et #Hdti #Hidet #HKV #HVW #L #U1 #U2 #d #e #HLK #H #HWU2 #Hdtd #_
+  elim (lift_inv_lref1 … H) -H * #Hid #H destruct -U1;
+  [ -Hdtd;
+    lapply (lt_to_le_to_lt … (dt+et+e) Hidet ?) // -Hidet #Hidete
+    elim (lift_trans_ge … HVW … HWU2 ?) -W // <minus_plus #W #HVW #HWU2
+    elim (ldrop_trans_le … HLK … HKV ?) -K [2: /2/] #X #HLK #H
+    elim (ldrop_inv_skip2 … H ?) -H [2: /2/] -Hid #K #Y #_ #HVY
+    >(lift_mono … HVY … HVW) -V #H destruct -X /2/
+  | -Hdti;
+    lapply (transitive_le … Hdtd Hid) -Hdtd #Hdti
+    lapply (lift_trans_be … HVW … HWU2 ? ?) -W // [ /2/ ] >plus_plus_comm_23 #HVU2
+    lapply (ldrop_trans_ge_comm … HLK … HKV ?) -K // -Hid /3/
+  ]
+| #K #I #V1 #V2 #T1 #T2 #dt #et #_ #_ #IHV12 #IHT12 #L #U1 #U2 #d #e #HLK #H1 #H2 #Hdtd #Hddet
+  elim (lift_inv_bind1 … H1) -H1 #VV1 #TT1 #HVV1 #HTT1 #H1
+  elim (lift_inv_bind1 … H2) -H2 #VV2 #TT2 #HVV2 #HTT2 #H2 destruct -U1 U2;
+  @tps_bind [ /2 width=6/ | @IHT12 [3,4: // | skip |5,6: /2/ | /2/ ] ] (**) (* /3 width=6/ is too slow, arith3 needed to avoid crash *)
 | #K #I #V1 #V2 #T1 #T2 #dt #et #_ #_ #IHV12 #IHT12 #L #U1 #U2 #d #e #HLK #H1 #H2 #Hdetd
   elim (lift_inv_flat1 … H1) -H1 #VV1 #TT1 #HVV1 #HTT1 #H1
   elim (lift_inv_flat1 … H2) -H2 #VV2 #TT2 #HVV2 #HTT2 #H2 destruct -U1 U2;
@@ -79,7 +111,7 @@ lemma tps_lift_ge: ∀K,T1,T2,dt,et. K ⊢ T1 [dt, et] ≫ T2 →
   lapply (transitive_le … Hddt … Hdti) -Hddt #Hid
   lapply (lift_inv_lref1_ge … H … Hid) -H #H destruct -U1;
   lapply (lift_trans_be … HVW … HWU2 ? ?) -HVW HWU2 W // [ /2/ ] >plus_plus_comm_23 #HVU2
-  lapply (drop_trans_ge_comm … HLK … HKV ?) -HLK HKV K // -Hid /3/
+  lapply (ldrop_trans_ge_comm … HLK … HKV ?) -HLK HKV K // -Hid /3/
 | #K #I #V1 #V2 #T1 #T2 #dt #et #_ #_ #IHV12 #IHT12 #L #U1 #U2 #d #e #HLK #H1 #H2 #Hddt
   elim (lift_inv_bind1 … H1) -H1 #VV1 #TT1 #HVV1 #HTT1 #H1
   elim (lift_inv_bind1 … H2) -H2 #VV2 #TT2 #HVV2 #HTT2 #H2 destruct -U1 U2;
@@ -100,16 +132,17 @@ lemma tps_inv_lift1_le: ∀L,U1,U2,dt,et. L ⊢ U1 [dt, et] ≫ U2 →
 [ #L * #i #dt #et #K #d #e #_ #T1 #H #_
   [ lapply (lift_inv_sort2 … H) -H #H destruct -T1 /2/
   | elim (lift_inv_lref2 … H) -H * #Hid #H destruct -T1 /3/
+  | lapply (lift_inv_gref2 … H) -H #H destruct -T1 /2/
   ]
 | #L #KV #V #W #i #dt #et #Hdti #Hidet #HLKV #HVW #K #d #e #HLK #T1 #H #Hdetd
   lapply (lt_to_le_to_lt … Hidet … Hdetd) -Hdetd #Hid
   lapply (lift_inv_lref2_lt … H … Hid) -H #H destruct -T1;
-  elim (drop_conf_lt … HLK … HLKV ?) -HLK HLKV L // #L #U #HKL #_ #HUV
+  elim (ldrop_conf_lt … HLK … HLKV ?) -HLK HLKV L // #L #U #HKL #_ #HUV
   elim (lift_trans_le … HUV … HVW ?) -HUV HVW V // >arith_a2 // -Hid /3/
 | #L #I #V1 #V2 #U1 #U2 #dt #et #_ #_ #IHV12 #IHU12 #K #d #e #HLK #X #H #Hdetd
   elim (lift_inv_bind2 … H) -H #W1 #T1 #HWV1 #HTU1 #H destruct -X;
   elim (IHV12 … HLK … HWV1 ?) -IHV12 HWV1 // #W2 #HW12 #HWV2
-  elim (IHU12 … HTU1 ?) -IHU12 HTU1 [3: /2/ |4: @drop_skip // |2: skip ] -HLK Hdetd (**) (* /3 width=5/ is too slow *)
+  elim (IHU12 … HTU1 ?) -IHU12 HTU1 [3: /2/ |4: @ldrop_skip // |2: skip ] -HLK Hdetd (**) (* /3 width=5/ is too slow *)
   /3 width=5/
 | #L #I #V1 #V2 #U1 #U2 #dt #et #_ #_ #IHV12 #IHU12 #K #d #e #HLK #X #H #Hdetd
   elim (lift_inv_flat2 … H) -H #W1 #T1 #HWV1 #HTU1 #H destruct -X;
@@ -118,6 +151,41 @@ lemma tps_inv_lift1_le: ∀L,U1,U2,dt,et. L ⊢ U1 [dt, et] ≫ U2 →
 ]
 qed.
 
+lemma tps_inv_lift1_be: ∀L,U1,U2,dt,et. L ⊢ U1 [dt, et] ≫ U2 →
+                        ∀K,d,e. ↓[d, e] L ≡ K → ∀T1. ↑[d, e] T1 ≡ U1 →
+                        dt ≤ d → d + e ≤ dt + et →
+                        ∃∃T2. K ⊢ T1 [dt, et - e] ≫ T2 & ↑[d, e] T2 ≡ U2.
+#L #U1 #U2 #dt #et #H elim H -H L U1 U2 dt et
+[ #L * #i #dt #et #K #d #e #_ #T1 #H #_
+  [ lapply (lift_inv_sort2 … H) -H #H destruct -T1 /2/
+  | elim (lift_inv_lref2 … H) -H * #Hid #H destruct -T1 /3/
+  | lapply (lift_inv_gref2 … H) -H #H destruct -T1 /2/
+  ]
+| #L #KV #V #W #i #dt #et #Hdti #Hidet #HLKV #HVW #K #d #e #HLK #T1 #H #Hdtd #Hdedet
+  lapply (le_fwd_plus_plus_ge … Hdtd … Hdedet) #Heet
+  elim (lift_inv_lref2 … H) -H * #Hid #H destruct -T1
+  [ -Hdtd Hidet;
+    lapply (lt_to_le_to_lt … (dt + (et - e)) Hid ?) [ <le_plus_minus /2/ ] -Hdedet #Hidete
+    elim (ldrop_conf_lt … HLK … HLKV ?) -L // #L #U #HKL #_ #HUV
+    elim (lift_trans_le … HUV … HVW ?) -V // >arith_a2 // -Hid /3/
+  | -Hdti Hdedet;
+    lapply (transitive_le … (i - e) Hdtd ?) [ /2/ ] -Hdtd #Hdtie
+    lapply (plus_le_weak … Hid) #Hei
+    lapply (ldrop_conf_ge … HLK … HLKV ?) -L // #HKV
+    elim (lift_split … HVW d (i - e + 1) ? ? ?) -HVW; [4: // |2,3: /2/ ] -Hid >arith_e2 // /4/
+  ]
+| #L #I #V1 #V2 #U1 #U2 #dt #et #_ #_ #IHV12 #IHU12 #K #d #e #HLK #X #H #Hdtd #Hdedet
+  elim (lift_inv_bind2 … H) -H #W1 #T1 #HWV1 #HTU1 #H destruct -X;
+  elim (IHV12 … HLK … HWV1 ? ?) -IHV12 HWV1 // #W2 #HW12 #HWV2
+  elim (IHU12 … HTU1 ? ?) -IHU12 HTU1 [5: @ldrop_skip // |2: skip |3: >plus_plus_comm_23 >(plus_plus_comm_23 dt) /2/ ]
+  /3 width=5/
+| #L #I #V1 #V2 #U1 #U2 #dt #et #_ #_ #IHV12 #IHU12 #K #d #e #HLK #X #H #Hdtd #Hdedet
+  elim (lift_inv_flat2 … H) -H #W1 #T1 #HWV1 #HTU1 #H destruct -X;
+  elim (IHV12 … HLK … HWV1 ? ?) -IHV12 HWV1 //
+  elim (IHU12 … HLK … HTU1 ? ?) -IHU12 HLK HTU1 // /3 width=5/
+]
+qed.
+
 (* Basic_1: was: subst1_gen_lift_ge *)
 lemma tps_inv_lift1_ge: ∀L,U1,U2,dt,et. L ⊢ U1 [dt, et] ≫ U2 →
                         ∀K,d,e. ↓[d, e] L ≡ K → ∀T1. ↑[d, e] T1 ≡ U1 →
@@ -127,14 +195,15 @@ lemma tps_inv_lift1_ge: ∀L,U1,U2,dt,et. L ⊢ U1 [dt, et] ≫ U2 →
 [ #L * #i #dt #et #K #d #e #_ #T1 #H #_
   [ lapply (lift_inv_sort2 … H) -H #H destruct -T1 /2/
   | elim (lift_inv_lref2 … H) -H * #Hid #H destruct -T1 /3/
+  | lapply (lift_inv_gref2 … H) -H #H destruct -T1 /2/
   ]
 | #L #KV #V #W #i #dt #et #Hdti #Hidet #HLKV #HVW #K #d #e #HLK #T1 #H #Hdedt  
   lapply (transitive_le … Hdedt … Hdti) #Hdei
   lapply (plus_le_weak … Hdedt) -Hdedt #Hedt
   lapply (plus_le_weak … Hdei) #Hei  
   lapply (lift_inv_lref2_ge … H … Hdei) -H #H destruct -T1;
-  lapply (drop_conf_ge … HLK … HLKV ?) -HLK HLKV L // #HKV
-  elim (lift_split … HVW d (i - e + 1) ? ? ?) -HVW; [2,3,4: normalize /2/ ] -Hdei >arith_e2 // #V0 #HV10 #HV02
+  lapply (ldrop_conf_ge … HLK … HLKV ?) -HLK HLKV L // #HKV
+  elim (lift_split … HVW d (i - e + 1) ? ? ?) -HVW; [4: // | 2,3: normalize /2/ ] -Hdei >arith_e2 // #V0 #HV10 #HV02
   @ex2_1_intro
   [2: @tps_subst [3: /2/ |5,6: // |1,2: skip |4: @arith5 // ]
   |1: skip
@@ -144,7 +213,7 @@ lemma tps_inv_lift1_ge: ∀L,U1,U2,dt,et. L ⊢ U1 [dt, et] ≫ U2 →
   elim (lift_inv_bind2 … H) -H #W1 #T1 #HWV1 #HTU1 #H destruct -X;
   lapply (plus_le_weak … Hdetd) #Hedt
   elim (IHV12 … HLK … HWV1 ?) -IHV12 HWV1 // #W2 #HW12 #HWV2
-  elim (IHU12 … HTU1 ?) -IHU12 HTU1 [4: @drop_skip // |2: skip |3: /2/ ]
+  elim (IHU12 … HTU1 ?) -IHU12 HTU1 [4: @ldrop_skip // |2: skip |3: /2/ ]
   <plus_minus // /3 width=5/
 | #L #I #V1 #V2 #U1 #U2 #dt #et #_ #_ #IHV12 #IHU12 #K #d #e #HLK #X #H #Hdetd
   elim (lift_inv_flat2 … H) -H #W1 #T1 #HWV1 #HTU1 #H destruct -X;
@@ -198,3 +267,12 @@ lapply (tps_weak … HU1 d e ? ?) -HU1 // <plus_minus_m_m_comm // -Hddt Hdtde #H
 lapply (tps_inv_lift1_eq … HU1 … HTU1) -HU1 #HU1 destruct -U1;
 elim (tps_inv_lift1_ge … HU2 … HLK … HTU1 ?) -HU2 HLK HTU1 // <minus_plus_m_m /2/
 qed.
+
+lemma tps_inv_lift1_be_up: ∀L,U1,U2,dt,et. L ⊢ U1 [dt, et] ≫ U2 →
+                           ∀K,d,e. ↓[d, e] L ≡ K → ∀T1. ↑[d, e] T1 ≡ U1 →
+                           dt ≤ d → dt + et ≤ d + e →
+                           ∃∃T2. K ⊢ T1 [dt, d - dt] ≫ T2 & ↑[d, e] T2 ≡ U2.
+#L #U1 #U2 #dt #et #HU12 #K #d #e #HLK #T1 #HTU1 #Hdtd #Hdetde
+lapply (tps_weak … HU12 dt (d + e - dt) ? ?) -HU12 // [ /2/ ] -Hdetde #HU12
+elim (tps_inv_lift1_be … HU12 … HLK … HTU1 ? ?) -U1 L /2/
+qed.