]> matita.cs.unibo.it Git - helm.git/blobdiff - matita/matita/contribs/lambdadelta/basic_2/relocation/ldrop.ma
- improved arithmetics for natural numbers with infinity
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / relocation / ldrop.ma
index 68b23637c4ba85debffe291d9ee38e7eac74b72c..ee4780d884bf23a22a5911e37fc0d0020e6ee7ad 100644 (file)
@@ -18,7 +18,7 @@ include "basic_2/grammar/lenv_length.ma".
 include "basic_2/grammar/cl_restricted_weight.ma".
 include "basic_2/relocation/lift.ma".
 
-(* LOCAL ENVIRONMENT SLICING ************************************************)
+(* BASIC SLICING FOR LOCAL ENVIRONMENTS *************************************)
 
 (* Basic_1: includes: drop_skip_bind *)
 inductive ldrop: relation4 nat nat lenv lenv ≝
@@ -30,7 +30,9 @@ inductive ldrop: relation4 nat nat lenv lenv ≝
                ldrop (d + 1) e (L1. ⓑ{I} V1) (L2. ⓑ{I} V2)
 .
 
-interpretation "local slicing" 'RDrop d e L1 L2 = (ldrop d e L1 L2).
+interpretation
+   "basic slicing (local environment)"
+   'RDrop d e L1 L2 = (ldrop d e L1 L2).
 
 definition l_liftable: predicate (lenv → relation term) ≝
                        λR. ∀K,T1,T2. R K T1 T2 → ∀L,d,e. ⇩[d, e] L ≡ K →
@@ -58,7 +60,7 @@ definition dropable_dx: predicate (relation lenv) ≝
 fact ldrop_inv_atom1_aux: ∀d,e,L1,L2. ⇩[d, e] L1 ≡ L2 → L1 = ⋆ →
                           L2 = ⋆ ∧ e = 0.
 #d #e #L1 #L2 * -d -e -L1 -L2
-[ /2 width=1/
+[ /2 width=1 by conj/
 | #L #I #V #H destruct
 | #L1 #L2 #I #V #e #_ #H destruct
 | #L1 #L2 #I #V1 #V2 #d #e #_ #_ #H destruct
@@ -75,8 +77,8 @@ fact ldrop_inv_O1_pair1_aux: ∀d,e,L1,L2. ⇩[d, e] L1 ≡ L2 → d = 0 →
                              (0 < e ∧ ⇩[d, e - 1] K ≡ L2).
 #d #e #L1 #L2 * -d -e -L1 -L2
 [ #d #_ #K #I #V #H destruct
-| #L #I #V #_ #K #J #W #HX destruct /3 width=1/
-| #L1 #L2 #I #V #e #HL12 #_ #K #J #W #H destruct /3 width=1/
+| #L #I #V #_ #K #J #W #HX destruct /3 width=1 by or_introl, conj/
+| #L1 #L2 #I #V #e #HL12 #_ #K #J #W #H destruct /3 width=1 by or_intror, conj/
 | #L1 #L2 #I #V1 #V2 #d #e #_ #_ >commutative_plus normalize #H destruct
 ]
 qed-.
@@ -93,13 +95,18 @@ elim (lt_refl_false … H)
 qed-.
 
 (* Basic_1: was: drop_gen_drop *)
-lemma ldrop_inv_ldrop1: ∀e,K,I,V,L2.
-                        ⇩[0, e] K. ⓑ{I} V ≡ L2 → 0 < e → ⇩[0, e - 1] K ≡ L2.
+lemma ldrop_inv_ldrop1_lt: ∀e,K,I,V,L2.
+                           ⇩[0, e] K. ⓑ{I} V ≡ L2 → 0 < e → ⇩[0, e - 1] K ≡ L2.
 #e #K #I #V #L2 #H #He
 elim (ldrop_inv_O1_pair1 … H) -H * // #H destruct
 elim (lt_refl_false … He)
 qed-.
 
+lemma ldrop_inv_ldrop1: ∀e,K,I,V,L2.
+                        ⇩[0, e+1] K. ⓑ{I} V ≡ L2 → ⇩[0, e] K ≡ L2.
+#e #K #I #V #L2 #H lapply (ldrop_inv_ldrop1_lt … H ?) -H //
+qed-.
+
 fact ldrop_inv_skip1_aux: ∀d,e,L1,L2. ⇩[d, e] L1 ≡ L2 → 0 < d →
                           ∀I,K1,V1. L1 = K1. ⓑ{I} V1 →
                           ∃∃K2,V2. ⇩[d - 1, e] K1 ≡ K2 &
@@ -109,7 +116,7 @@ fact ldrop_inv_skip1_aux: ∀d,e,L1,L2. ⇩[d, e] L1 ≡ L2 → 0 < d →
 [ #d #_ #I #K #V #H destruct
 | #L #I #V #H elim (lt_refl_false … H)
 | #L1 #L2 #I #V #e #_ #H elim (lt_refl_false … H)
-| #X #L2 #Y #Z #V2 #d #e #HL12 #HV12 #_ #I #L1 #V1 #H destruct /2 width=5/
+| #X #L2 #Y #Z #V2 #d #e #HL12 #HV12 #_ #I #L1 #V1 #H destruct /2 width=5 by ex3_2_intro/
 ]
 qed-.
 
@@ -127,7 +134,7 @@ lemma ldrop_inv_O1_pair2: ∀I,K,V,e,L1. ⇩[0, e] L1 ≡ K. ⓑ{I} V →
 [ #H elim (ldrop_inv_atom1 … H) -H #H destruct
 | #L1 #I1 #V1 #H
   elim (ldrop_inv_O1_pair1 … H) -H *
-  [ #H1 #H2 destruct /3 width=1/
+  [ #H1 #H2 destruct /3 width=1 by or_introl, conj/
   | /3 width=5/
   ]
 ]
@@ -142,7 +149,7 @@ fact ldrop_inv_skip2_aux: ∀d,e,L1,L2. ⇩[d, e] L1 ≡ L2 → 0 < d →
 [ #d #_ #I #K #V #H destruct
 | #L #I #V #H elim (lt_refl_false … H)
 | #L1 #L2 #I #V #e #_ #H elim (lt_refl_false … H)
-| #L1 #X #Y #V1 #Z #d #e #HL12 #HV12 #_ #I #L2 #V2 #H destruct /2 width=5/
+| #L1 #X #Y #V1 #Z #d #e #HL12 #HV12 #_ #I #L2 #V2 #H destruct /2 width=5 by ex3_2_intro/
 ]
 qed-.
 
@@ -157,18 +164,18 @@ lemma ldrop_inv_skip2: ∀d,e,I,L1,K2,V2. ⇩[d, e] L1 ≡ K2. ⓑ{I} V2 → 0 <
 (* Basic_1: was by definition: drop_refl *)
 lemma ldrop_refl: ∀L,d. ⇩[d, 0] L ≡ L.
 #L elim L -L //
-#L #I #V #IHL #d @(nat_ind_plus … d) -d // /2 width=1/
+#L #I #V #IHL #d @(nat_ind_plus … d) -d /2 width=1 by ldrop_pair, ldrop_skip/
 qed.
 
 lemma ldrop_ldrop_lt: ∀L1,L2,I,V,e.
                       ⇩[0, e - 1] L1 ≡ L2 → 0 < e → ⇩[0, e] L1. ⓑ{I} V ≡ L2.
-#L1 #L2 #I #V #e #HL12 #He >(plus_minus_m_m e 1) // /2 width=1/
+#L1 #L2 #I #V #e #HL12 #He >(plus_minus_m_m e 1) /2 width=1 by ldrop_ldrop/
 qed.
 
 lemma ldrop_skip_lt: ∀L1,L2,I,V1,V2,d,e.
                      ⇩[d - 1, e] L1 ≡ L2 → ⇧[d - 1, e] V2 ≡ V1 → 0 < d →
                      ⇩[d, e] L1. ⓑ{I} V1 ≡ L2. ⓑ{I} V2.
-#L1 #L2 #I #V1 #V2 #d #e #HL12 #HV21 #Hd >(plus_minus_m_m d 1) // /2 width=1/
+#L1 #L2 #I #V1 #V2 #d #e #HL12 #HV21 #Hd >(plus_minus_m_m d 1) /2 width=1 by ldrop_skip/
 qed.
 
 lemma ldrop_O1_le: ∀e,L. e ≤ |L| → ∃K. ⇩[0, e] L ≡ K.
@@ -176,16 +183,16 @@ lemma ldrop_O1_le: ∀e,L. e ≤ |L| → ∃K. ⇩[0, e] L ≡ K.
 #e #IHe *
 [ #H lapply (le_n_O_to_eq … H) -H >commutative_plus normalize #H destruct
 | #L #I #V normalize #H
-  elim (IHe L) -IHe /2 width=1/ -H /3 width=2/
+  elim (IHe L) -IHe /2 width=1/ -H /3 width=2 by ldrop_ldrop, ex_intro/
 ]
 qed.
 
 lemma ldrop_O1_lt: ∀L,e. e < |L| → ∃∃I,K,V. ⇩[0, e] L ≡ K.ⓑ{I}V.
 #L elim L -L
 [ #e #H elim (lt_zero_false … H)
-| #L #I #V #IHL #e @(nat_ind_plus … e) -e /2 width=4/
+| #L #I #V #IHL #e @(nat_ind_plus … e) -e /2 width=4 by ldrop_pair, ex1_3_intro/
   #e #_ normalize #H
-  elim (IHL e) -IHL /2 width=1/ -H /3 width=4/
+  elim (IHL e) -IHL /3 width=4 by ldrop_ldrop, lt_plus_to_minus_r, lt_plus_to_lt_l, ex1_3_intro/
 ]
 qed.
 
@@ -193,55 +200,55 @@ lemma l_liftable_LTC: ∀R. l_liftable R → l_liftable (LTC … R).
 #R #HR #K #T1 #T2 #H elim H -T2
 [ /3 width=9/
 | #T #T2 #_ #HT2 #IHT1 #L #d #e #HLK #U1 #HTU1 #U2 #HTU2
-  elim (lift_total T d e) /4 width=11 by step/ (**) (* auto too slow without trace *)
+  elim (lift_total T d e) /4 width=11 by step/
 ]
 qed.
 
 lemma l_deliftable_sn_LTC: ∀R. l_deliftable_sn R → l_deliftable_sn (LTC … R).
 #R #HR #L #U1 #U2 #H elim H -U2
 [ #U2 #HU12 #K #d #e #HLK #T1 #HTU1
-  elim (HR … HU12 … HLK … HTU1) -HR -L -U1 /3 width=3/
+  elim (HR … HU12 … HLK … HTU1) -HR -L -U1 /3 width=3 by inj, ex2_intro/
 | #U #U2 #_ #HU2 #IHU1 #K #d #e #HLK #T1 #HTU1
   elim (IHU1 … HLK … HTU1) -IHU1 -U1 #T #HTU #HT1
-  elim (HR … HU2 … HLK … HTU) -HR -L -U /3 width=5/
+  elim (HR … HU2 … HLK … HTU) -HR -L -U /3 width=5 by step, ex2_intro/
 ]
 qed.
 
 lemma dropable_sn_TC: ∀R. dropable_sn R → dropable_sn (TC … R).
 #R #HR #L1 #K1 #d #e #HLK1 #L2 #H elim H -L2
 [ #L2 #HL12
-  elim (HR … HLK1 … HL12) -HR -L1 /3 width=3/
+  elim (HR … HLK1 … HL12) -HR -L1 /3 width=3 by inj, ex2_intro/
 | #L #L2 #_ #HL2 * #K #HK1 #HLK
-  elim (HR … HLK … HL2) -HR -L /3 width=3/
+  elim (HR … HLK … HL2) -HR -L /3 width=3 by step, ex2_intro/
 ]
 qed.
 
 lemma dedropable_sn_TC: ∀R. dedropable_sn R → dedropable_sn (TC … R).
 #R #HR #L1 #K1 #d #e #HLK1 #K2 #H elim H -K2
 [ #K2 #HK12
-  elim (HR … HLK1 … HK12) -HR -K1 /3 width=3/
+  elim (HR … HLK1 … HK12) -HR -K1 /3 width=3 by inj, ex2_intro/
 | #K #K2 #_ #HK2 * #L #HL1 #HLK
-  elim (HR … HLK … HK2) -HR -K /3 width=3/
+  elim (HR … HLK … HK2) -HR -K /3 width=3 by step, ex2_intro/
 ]
 qed.
 
 lemma dropable_dx_TC: ∀R. dropable_dx R → dropable_dx (TC … R).
 #R #HR #L1 #L2 #H elim H -L2
 [ #L2 #HL12 #K2 #e #HLK2
-  elim (HR … HL12 … HLK2) -HR -L2 /3 width=3/
+  elim (HR … HL12 … HLK2) -HR -L2 /3 width=3 by inj, ex2_intro/
 | #L #L2 #_ #HL2 #IHL1 #K2 #e #HLK2
   elim (HR … HL2 … HLK2) -HR -L2 #K #HLK #HK2
-  elim (IHL1 … HLK) -L /3 width=5/
+  elim (IHL1 … HLK) -L /3 width=5 by step, ex2_intro/
 ]
 qed.
 
 lemma l_deliftable_sn_llstar: ∀R. l_deliftable_sn R →
                               ∀l. l_deliftable_sn (llstar … R l).
 #R #HR #l #L #U1 #U2 #H @(lstar_ind_r … l U2 H) -l -U2
-[ /2 width=3/
+[ /2 width=3 by lstar_O, ex2_intro/
 | #l #U #U2 #_ #HU2 #IHU1 #K #d #e #HLK #T1 #HTU1
   elim (IHU1 … HLK … HTU1) -IHU1 -U1 #T #HTU #HT1
-  elim (HR … HU2 … HLK … HTU) -HR -L -U /3 width=5/
+  elim (HR … HU2 … HLK … HTU) -HR -L -U /3 width=5 by lstar_dx, ex2_intro/
 ]
 qed.
 
@@ -255,17 +262,17 @@ lemma ldrop_fwd_ldrop2: ∀L1,I2,K2,V2,e. ⇩[O, e] L1 ≡ K2. ⓑ{I2} V2 →
 | #K1 #I1 #V1 #IHL1 #I2 #K2 #V2 #e #H
   elim (ldrop_inv_O1_pair1 … H) -H * #He #H
   [ -IHL1 destruct /2 width=1/
-  | @ldrop_ldrop >(plus_minus_m_m e 1) // /2 width=3/
+  | @ldrop_ldrop >(plus_minus_m_m e 1) /2 width=3 by /
   ]
 ]
 qed-.
 
 lemma ldrop_fwd_length: ∀L1,L2,d,e. ⇩[d, e] L1 ≡ L2 → |L1| = |L2| + e.
-#L1 #L2 #d #e #H elim H -L1 -L2 -d -e // normalize /2 width=1/
+#L1 #L2 #d #e #H elim H -L1 -L2 -d -e // normalize /2 width=1 by /
 qed-.
 
 lemma ldrop_fwd_length_minus2: ∀L1,L2,d,e. ⇩[d, e] L1 ≡ L2 → |L2| = |L1| - e.
-#L1 #L2 #d #e #H lapply (ldrop_fwd_length … H) -H /2 width=1/
+#L1 #L2 #d #e #H lapply (ldrop_fwd_length … H) -H /2 width=1 by plus_minus, le_n/
 qed-.
 
 lemma ldrop_fwd_length_minus4: ∀L1,L2,d,e. ⇩[d, e] L1 ≡ L2 → e = |L1| - |L2|.
@@ -287,22 +294,29 @@ lapply (ldrop_fwd_length … H) normalize in ⊢ (%→?); -I2 -V2 //
 qed-.
 
 lemma ldrop_fwd_length_lt4: ∀L1,L2,d,e. ⇩[d, e] L1 ≡ L2 → 0 < e → |L2| < |L1|.
-#L1 #L2 #d #e #H lapply (ldrop_fwd_length … H) -H /2 width=1/
+#L1 #L2 #d #e #H lapply (ldrop_fwd_length … H) -H /2 width=1 by lt_minus_to_plus_r/
 qed-.
 
-lemma ldrop_fwd_length_eq: ∀L1,L2,K1,K2,d,e. ⇩[d, e] L1 ≡ K1 → ⇩[d, e] L2 ≡ K2 →
-                           |L1| = |L2| → |K1| = |K2|.
+lemma ldrop_fwd_length_eq1: ∀L1,L2,K1,K2,d,e. ⇩[d, e] L1 ≡ K1 → ⇩[d, e] L2 ≡ K2 →
+                            |L1| = |L2| → |K1| = |K2|.
 #L1 #L2 #K1 #K2 #d #e #HLK1 #HLK2 #HL12
 lapply (ldrop_fwd_length … HLK1) -HLK1
 lapply (ldrop_fwd_length … HLK2) -HLK2
-/2 width=2 by injective_plus_r/ (**) (* full auto fails *)
+/2 width=2 by injective_plus_r/
+qed-.
+
+lemma ldrop_fwd_length_eq2: ∀L1,L2,K1,K2,d,e. ⇩[d, e] L1 ≡ K1 → ⇩[d, e] L2 ≡ K2 →
+                            |K1| = |K2| → |L1| = |L2|.
+#L1 #L2 #K1 #K2 #d #e #HLK1 #HLK2 #HL12
+lapply (ldrop_fwd_length … HLK1) -HLK1
+lapply (ldrop_fwd_length … HLK2) -HLK2 //
 qed-.
 
 lemma ldrop_fwd_lw: ∀L1,L2,d,e. ⇩[d, e] L1 ≡ L2 → ♯{L2} ≤ ♯{L1}.
 #L1 #L2 #d #e #H elim H -L1 -L2 -d -e // normalize
-[ /2 width=3/
+[ /2 width=3 by transitive_le/
 | #L1 #L2 #I #V1 #V2 #d #e #_ #HV21 #IHL12
-  >(lift_fwd_tw … HV21) -HV21 /2 width=1/
+  >(lift_fwd_tw … HV21) -HV21 /2 width=1 by monotonic_le_plus_l/
 ]
 qed-.
 
@@ -313,7 +327,7 @@ lemma ldrop_fwd_lw_lt: ∀L1,L2,d,e. ⇩[d, e] L1 ≡ L2 → 0 < e → ♯{L2} <
   lapply (ldrop_fwd_lw … HL12) -HL12 #HL12
   @(le_to_lt_to_lt … HL12) -HL12 //
 | #L1 #L2 #I #V1 #V2 #d #e #_ #HV21 #IHL12 #H normalize in ⊢ (?%%); -I
-  >(lift_fwd_tw … HV21) -V2 /3 by lt_minus_to_plus/ (**) (* auto too slow without trace *)
+  >(lift_fwd_tw … HV21) -V2 /3 by lt_minus_to_plus/
 ]
 qed-.