]> matita.cs.unibo.it Git - helm.git/blobdiff - matita/matita/contribs/lambdadelta/basic_2/relocation/ldrop_ldrop.ma
- improved arithmetics for natural numbers with infinity
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / relocation / ldrop_ldrop.ma
index 8b1e5d29206caa710c569a3b348f394f1b64405b..ce3326a9d19759daf05179eefa3ba6e0c2b089e8 100644 (file)
@@ -15,7 +15,7 @@
 include "basic_2/relocation/lift_lift.ma".
 include "basic_2/relocation/ldrop.ma".
 
-(* DROPPING *****************************************************************)
+(* BASIC SLICING FOR LOCAL ENVIRONMENTS *************************************)
 
 (* Main properties **********************************************************)
 
@@ -26,7 +26,7 @@ theorem ldrop_mono: ∀d,e,L,L1. ⇩[d, e] L ≡ L1 →
 [ #d #L2 #H elim (ldrop_inv_atom1 … H) -H //
 | #K #I #V #L2 #HL12 <(ldrop_inv_O2 … HL12) -L2 //
 | #L #K #I #V #e #_ #IHLK #L2 #H
-  lapply (ldrop_inv_ldrop1 … H ?) -H // /2 width=1/
+  lapply (ldrop_inv_ldrop1 … H) -H /2 width=1 by/
 | #L #K1 #I #T #V1 #d #e #_ #HVT1 #IHLK1 #X #H
   elim (ldrop_inv_skip1 … H) -H // <minus_plus_m_m #K2 #V2 #HLK2 #HVT2 #H destruct
   >(lift_inj … HVT1 … HVT2) -HVT1 -HVT2
@@ -40,13 +40,13 @@ theorem ldrop_conf_ge: ∀d1,e1,L,L1. ⇩[d1, e1] L ≡ L1 →
                        ⇩[0, e2 - e1] L1 ≡ L2.
 #d1 #e1 #L #L1 #H elim H -d1 -e1 -L -L1 //
 [ #L #K #I #V #e #_ #IHLK #e2 #L2 #H #He2
-  lapply (ldrop_inv_ldrop1 … H ?) -H /2 width=2/ #HL2
-  <minus_plus >minus_minus_comm /3 width=1/
+  lapply (ldrop_inv_ldrop1_lt … H ?) -H /2 width=2 by ltn_to_ltO/ #HL2
+  <minus_plus >minus_minus_comm /3 width=1 by monotonic_pred/
 | #L #K #I #V1 #V2 #d #e #_ #_ #IHLK #e2 #L2 #H #Hdee2
   lapply (transitive_le 1 … Hdee2) // #He2
-  lapply (ldrop_inv_ldrop1 … H ?) -H // -He2 #HL2
+  lapply (ldrop_inv_ldrop1_lt … H ?) -H // -He2 #HL2
   lapply (transitive_le (1 + e) … Hdee2) // #Hee2
-  @ldrop_ldrop_lt >minus_minus_comm /3 width=1/ (**) (* explicit constructor *)
+  @ldrop_ldrop_lt >minus_minus_comm /3 width=1 by O, lt_minus_to_plus_r, monotonic_le_minus_r, monotonic_pred/ (**) (* explicit constructor *)
 ]
 qed.
 
@@ -56,21 +56,21 @@ theorem ldrop_conf_be: ∀L0,L1,d1,e1. ⇩[d1, e1] L0 ≡ L1 →
                        ∃∃L. ⇩[0, d1 + e1 - e2] L2 ≡ L & ⇩[0, d1] L1 ≡ L.
 #L0 #L1 #d1 #e1 #H elim H -L0 -L1 -d1 -e1
 [ #d1 #L2 #e2 #H #Hd1 #_ elim (ldrop_inv_atom1 … H) -H #H1 #H2 destruct
-  <(le_n_O_to_eq … Hd1) -d1 /2 width=3/
+  <(le_n_O_to_eq … Hd1) -d1 /2 width=3 by ldrop_atom, ex2_intro/
 | normalize #L #I #V #L2 #e2 #HL2 #_ #He2
   lapply (le_n_O_to_eq … He2) -He2 #H destruct
-  lapply (ldrop_inv_O2 … HL2) -HL2 #H destruct /2 width=3/
+  lapply (ldrop_inv_O2 … HL2) -HL2 #H destruct /2 width=3 by ldrop_pair, ex2_intro/
 | normalize #L0 #K0 #I #V1 #e1 #HLK0 #IHLK0 #L2 #e2 #H #_ #He21
   lapply (ldrop_inv_O1_pair1 … H) -H * * #He2 #HL20
-  [ -IHLK0 -He21 destruct <minus_n_O /3 width=3/
+  [ -IHLK0 -He21 destruct <minus_n_O /3 width=3 by ldrop_ldrop, ex2_intro/
   | -HLK0 <minus_le_minus_minus_comm //
-    elim (IHLK0 … HL20) -L0 // /2 width=1/ /2 width=3/
+    elim (IHLK0 … HL20) -L0 /2 width=3 by monotonic_pred, ex2_intro/
   ]
 | #L0 #K0 #I #V0 #V1 #d1 #e1 >plus_plus_comm_23 #_ #_ #IHLK0 #L2 #e2 #H #Hd1e2 #He2de1
   elim (le_inv_plus_l … Hd1e2) #_ #He2
   <minus_le_minus_minus_comm //
-  lapply (ldrop_inv_ldrop1 … H ?) -H // #HL02
-  elim (IHLK0 … HL02) -L0 /2 width=1/ /3 width=3/
+  lapply (ldrop_inv_ldrop1_lt … H ?) -H // #HL02
+  elim (IHLK0 … HL02) -L0 /3 width=3 by ldrop_ldrop, monotonic_pred, ex2_intro/
 ]
 qed.
 
@@ -80,18 +80,19 @@ theorem ldrop_conf_le: ∀L0,L1,d1,e1. ⇩[d1, e1] L0 ≡ L1 →
                        ∃∃L. ⇩[0, e2] L1 ≡ L & ⇩[d1 - e2, e1] L2 ≡ L.
 #L0 #L1 #d1 #e1 #H elim H -L0 -L1 -d1 -e1
 [ #d1 #L2 #e2 #H
-  elim (ldrop_inv_atom1 … H) -H #H destruct /2 width=3/
+  elim (ldrop_inv_atom1 … H) -H #H destruct /2 width=3 by ldrop_atom, ex2_intro/
 | #K0 #I #V0 #L2 #e2 #H1 #H2
   lapply (le_n_O_to_eq … H2) -H2 #H destruct
-  lapply (ldrop_inv_pair1 … H1) -H1 #H destruct /2 width=3/
+  lapply (ldrop_inv_pair1 … H1) -H1 #H destruct /2 width=3 by ldrop_pair, ex2_intro/
 | #K0 #K1 #I #V0 #e1 #HK01 #_ #L2 #e2 #H1 #H2
   lapply (le_n_O_to_eq … H2) -H2 #H destruct
-  lapply (ldrop_inv_pair1 … H1) -H1 #H destruct /3 width=3/
+  lapply (ldrop_inv_pair1 … H1) -H1 #H destruct /3 width=3 by ldrop_ldrop, ex2_intro/
 | #K0 #K1 #I #V0 #V1 #d1 #e1 #HK01 #HV10 #IHK01 #L2 #e2 #H #He2d1
   elim (ldrop_inv_O1_pair1 … H) -H *
-  [ -IHK01 -He2d1 #H1 #H2 destruct /3 width=5/
+  [ -IHK01 -He2d1 #H1 #H2 destruct /3 width=5 by ldrop_pair, ldrop_skip, ex2_intro/
   | -HK01 -HV10 #He2 #HK0L2
-    elim (IHK01 … HK0L2) -IHK01 -HK0L2 /2 width=1/ >minus_le_minus_minus_comm // /3 width=3/
+    elim (IHK01 … HK0L2) -IHK01 -HK0L2 /2 width=1 by monotonic_pred/
+    >minus_le_minus_minus_comm /3 width=3 by ldrop_ldrop_lt, ex2_intro/
   ]
 ]
 qed.
@@ -104,8 +105,8 @@ theorem ldrop_trans_ge: ∀d1,e1,L1,L. ⇩[d1, e1] L1 ≡ L →
 | #L1 #L2 #I #V1 #V2 #d #e #H_ #_ #IHL12 #e2 #L #H #Hde2
   lapply (lt_to_le_to_lt 0 … Hde2) // #He2
   lapply (lt_to_le_to_lt … (e + e2) He2 ?) // #Hee2
-  lapply (ldrop_inv_ldrop1 … H ?) -H // #HL2
-  @ldrop_ldrop_lt // >le_plus_minus // @IHL12 /2 width=1/ (**) (* explicit constructor *)
+  lapply (ldrop_inv_ldrop1_lt … H ?) -H // #HL2
+  @ldrop_ldrop_lt // >le_plus_minus /3 width=1 by monotonic_pred/
 ]
 qed.
 
@@ -115,18 +116,18 @@ theorem ldrop_trans_le: ∀d1,e1,L1,L. ⇩[d1, e1] L1 ≡ L →
                         ∃∃L0. ⇩[0, e2] L1 ≡ L0 & ⇩[d1 - e2, e1] L0 ≡ L2.
 #d1 #e1 #L1 #L #H elim H -d1 -e1 -L1 -L
 [ #d #e2 #L2 #H
-  elim (ldrop_inv_atom1 … H) -H /2 width=3/
+  elim (ldrop_inv_atom1 … H) -H /2 width=3 by ldrop_atom, ex2_intro/
 | #K #I #V #e2 #L2 #HL2 #H
-  lapply (le_n_O_to_eq … H) -H #H destruct /2 width=3/
+  lapply (le_n_O_to_eq … H) -H #H destruct /2 width=3 by ldrop_pair, ex2_intro/
 | #L1 #L2 #I #V #e #_ #IHL12 #e2 #L #HL2 #H
   lapply (le_n_O_to_eq … H) -H #H destruct
   elim (IHL12 … HL2) -IHL12 -HL2 // #L0 #H #HL0
-  lapply (ldrop_inv_O2 … H) -H #H destruct /3 width=5/
+  lapply (ldrop_inv_O2 … H) -H #H destruct /3 width=5 by ldrop_pair, ldrop_ldrop, ex2_intro/
 | #L1 #L2 #I #V1 #V2 #d #e #HL12 #HV12 #IHL12 #e2 #L #H #He2d
   elim (ldrop_inv_O1_pair1 … H) -H *
-  [ -He2d -IHL12 #H1 #H2 destruct /3 width=5/
+  [ -He2d -IHL12 #H1 #H2 destruct /3 width=5 by ldrop_pair, ldrop_skip, ex2_intro/
   | -HL12 -HV12 #He2 #HL2
-    elim (IHL12 … HL2) -L2 [ >minus_le_minus_minus_comm // /3 width=3/ | /2 width=1/ ]
+    elim (IHL12 … HL2) -L2 [ >minus_le_minus_minus_comm // /3 width=3 by ldrop_ldrop_lt, ex2_intro/ | /2 width=1 by monotonic_pred/ ]
   ]
 ]
 qed.
@@ -142,7 +143,7 @@ lemma l_liftable_llstar: ∀R. l_liftable R → ∀l. l_liftable (llstar … R l
 [ #L #d #e #_ #U1 #HTU1 #U2 #HTU2 -HR -K
   >(lift_mono … HTU2 … HTU1) -T1 -U2 -d -e //
 | #l #T #T2 #_ #HT2 #IHT1 #L #d #e #HLK #U1 #HTU1 #U2 #HTU2
-  elim (lift_total T d e) /3 width=11 by lstar_dx/ (**) (* auto too slow without trace *)
+  elim (lift_total T d e) /3 width=11 by lstar_dx/
 ]
 qed.
 
@@ -153,8 +154,8 @@ lemma ldrop_conf_lt: ∀d1,e1,L,L1. ⇩[d1, e1] L ≡ L1 →
                      ∃∃K1,V1. ⇩[0, e2] L1 ≡ K1. ⓑ{I} V1 &
                               ⇩[d, e1] K2 ≡ K1 & ⇧[d, e1] V1 ≡ V2.
 #d1 #e1 #L #L1 #H1 #e2 #K2 #I #V2 #H2 #He2d1
-elim (ldrop_conf_le … H1 … H2) -L [2: /2 width=2/] #K #HL1K #HK2
-elim (ldrop_inv_skip1 … HK2) -HK2 [2: /2 width=1/] #K1 #V1 #HK21 #HV12 #H destruct /2 width=5/
+elim (ldrop_conf_le … H1 … H2) -L /2 width=2 by lt_to_le/ #K #HL1K #HK2
+elim (ldrop_inv_skip1 … HK2) -HK2 /2 width=1 by lt_plus_to_minus_r/ #K1 #V1 #HK21 #HV12 #H destruct /2 width=5 by ex3_2_intro/
 qed.
 
 (* Note: apparently this was missing in basic_1 *)
@@ -164,14 +165,14 @@ lemma ldrop_trans_lt: ∀d1,e1,L1,L. ⇩[d1, e1] L1 ≡ L →
                       ∃∃L0,V0. ⇩[0, e2] L1 ≡ L0.ⓑ{I}V0 &
                                ⇩[d, e1] L0 ≡ L2 & ⇧[d, e1] V2 ≡ V0.
 #d1 #e1 #L1 #L #HL1 #e2 #L2 #I #V2 #HL2 #Hd21
-elim (ldrop_trans_le … HL1 … HL2) -L [2: /2 width=1/ ] #L0 #HL10 #HL02
-elim (ldrop_inv_skip2 … HL02) -HL02 [2: /2 width=1/ ] #L #V1 #HL2 #HV21 #H destruct /2 width=5/
+elim (ldrop_trans_le … HL1 … HL2) -L /2 width=1 by lt_to_le/ #L0 #HL10 #HL02
+elim (ldrop_inv_skip2 … HL02) -HL02 /2 width=1 by lt_plus_to_minus_r/ #L #V1 #HL2 #HV21 #H destruct /2 width=5 by ex3_2_intro/
 qed-.
 
 lemma ldrop_trans_ge_comm: ∀d1,e1,e2,L1,L2,L.
                            ⇩[d1, e1] L1 ≡ L → ⇩[0, e2] L ≡ L2 → d1 ≤ e2 →
                            ⇩[0, e2 + e1] L1 ≡ L2.
-#e1 #e1 #e2 >commutative_plus /2 width=5/
+#e1 #e1 #e2 >commutative_plus /2 width=5 by ldrop_trans_ge/
 qed.
 
 lemma ldrop_conf_div: ∀I1,L,K,V1,e1. ⇩[0, e1] L ≡ K. ⓑ{I1} V1 →
@@ -187,5 +188,15 @@ elim (discr_minus_x_xy … H) -H
 [1,3: normalize <plus_n_Sm #H destruct ]
 #H >H in HK; #HK
 lapply (ldrop_inv_O2 … HK) -HK #H destruct
-lapply (inv_eq_minus_O … H) -H /3 width=1/
+lapply (inv_eq_minus_O … H) -H /3 width=1 by le_to_le_to_eq, and3_intro/
+qed-.
+
+(* Advanced forward lemmas **************************************************)
+
+lemma ldrop_fwd_be: ∀L,K,d,e,i. ⇩[d, e] L ≡ K → |K| ≤ i → i < d → |L| ≤ i.
+#L #K #d #e #i #HLK #HK #Hd elim (lt_or_ge i (|L|)) //
+#HL elim (ldrop_O1_lt … HL) #I #K0 #V #HLK0 -HL
+elim (ldrop_conf_lt … HLK … HLK0) // -HLK -HLK0 -Hd
+#K1 #V1 #HK1 #_ #_ lapply (ldrop_fwd_length_lt2 … HK1) -I -K1 -V1
+#H elim (lt_refl_false i) /2 width=3 by lt_to_le_to_lt/
 qed-.