| /2 width=1/
| /3 width=1/
| /3 width=1/
-| #L1 #L2 #_ #_ #_ #_ #d #e #_ #_ #H
- elim (plus_S_eq_O_false … H)
+| #L1 #L2 #_ #_ #_ #_ #d #e #_ #_ >commutative_plus normalize #H destruct
]
qed.
| /2 width=1/
| /3 width=1/
| /3 width=1/
-| #L1 #L2 #_ #_ #_ #_ #d #e #_ #_ #H
- elim (plus_S_eq_O_false … H)
+| #L1 #L2 #_ #_ #_ #_ #d #e #_ #_ >commutative_plus normalize #H destruct
]
qed.
non associative with precedence 45
for @{ 'RLift $d $e $T1 $T2 }.
+notation "hvbox( ↓ [ e ] break L1 ≡ break L2 )"
+ non associative with precedence 45
+ for @{ 'RDrop $e $L1 $L2 }.
+
notation "hvbox( ↓ [ d , break e ] break L1 ≡ break L2 )"
non associative with precedence 45
for @{ 'RDrop $d $e $L1 $L2 }.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "Basic_2/substitution/ldrop.ma".
+
+(* GLOBAL ENVIRONMENT SLICING ***********************************************)
+
+inductive gdrop (e:nat) (G1:lenv) : predicate lenv ≝
+| gdrop_lt: ∀G2. e < |G1| → ↓[0, |G1| - (e + 1)] G1 ≡ G2 → gdrop e G1 G2
+| gdrop_ge: |G1| ≤ e → gdrop e G1 (⋆)
+.
+
+interpretation "global slicing" 'RDrop e G1 G2 = (gdrop e G1 G2).
+
+(* basic inversion lemmas ***************************************************)
+
+fact gdrop_inv_atom2_aux: ∀G1,G2,e. ↓[e] G1 ≡ G2 → G2 = ⋆ → |G1| ≤ e.
+#G1 #G2 #e * -G2 //
+#G2 #He #HG12 #H destruct
+lapply (ldrop_fwd_O1_length … HG12) -HG12
+>minus_le_minus_minus_comm // -He >le_plus_minus_comm // <minus_n_n
+>(commutative_plus e) normalize #H destruct
+qed.
+
+lemma gdrop_inv_atom2: ∀G1,e. ↓[e] G1 ≡ ⋆ → |G1| ≤ e.
+/2 width=3/ qed-.
+
+lemma gdrop_inv_ge: ∀G1,G2,e. ↓[e] G1 ≡ G2 → |G1| ≤ e → G2 = ⋆.
+#G1 #G2 #e * // #G2 #H1 #_ #H2
+lapply (lt_to_le_to_lt … H1 H2) -H1 -H2 #He
+elim (lt_refl_false … He)
+qed-.
ldrop (d + 1) e (L1. 𝕓{I} V1) (L2. 𝕓{I} V2)
.
-interpretation "ldropping" 'RDrop d e L1 L2 = (ldrop d e L1 L2).
+interpretation "local slicing" 'RDrop d e L1 L2 = (ldrop d e L1 L2).
(* Basic inversion lemmas ***************************************************)
#d #e #L1 #L2 * -d -e -L1 -L2
[ //
| //
-| #L1 #L2 #I #V #e #_ #_ #H
- elim (plus_S_eq_O_false … H)
-| #L1 #L2 #I #V1 #V2 #d #e #_ #_ #H
- elim (plus_S_eq_O_false … H)
+| #L1 #L2 #I #V #e #_ #_ >commutative_plus normalize #H destruct
+| #L1 #L2 #I #V1 #V2 #d #e #_ #_ >commutative_plus normalize #H destruct
]
qed.
[ #d #e #_ #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/
-| #L1 #L2 #I #V1 #V2 #d #e #_ #_ #H elim (plus_S_eq_O_false … H)
+| #L1 #L2 #I #V1 #V2 #d #e #_ #_ >commutative_plus normalize #H destruct
]
qed.
lemma lift_inv_lref2_lt: ∀d,e,T1,i. ↑[d,e] T1 ≡ #i → i < d → T1 = #i.
#d #e #T1 #i #H elim (lift_inv_lref2 … H) -H * //
#Hdi #_ #Hid lapply (le_to_lt_to_lt … Hdi Hid) -Hdi -Hid #Hdd
-elim (plus_lt_false … Hdd)
+elim (lt_inv_plus_l … Hdd) -Hdd #Hdd
+elim (lt_refl_false … Hdd)
qed-.
(* Basic_1: was: lift_gen_lref_false *)
lemma lift_inv_lref2_ge: ∀d,e,T1,i. ↑[d,e] T1 ≡ #i → d + e ≤ i → T1 = #(i - e).
#d #e #T1 #i #H elim (lift_inv_lref2 … H) -H * //
#Hid #_ #Hdi lapply (le_to_lt_to_lt … Hdi Hid) -Hdi -Hid #Hdd
-elim (plus_lt_false … Hdd)
+elim (lt_inv_plus_l … Hdd) -Hdd #Hdd
+elim (lt_refl_false … Hdd)
qed-.
fact lift_inv_gref2_aux: ∀d,e,T1,T2. ↑[d,e] T1 ≡ T2 → ∀p. T2 = §p → T1 = §p.
fact ltps_inv_refl_O2_aux: ∀d,e,L1,L2. L1 [d, e] ≫ L2 → e = 0 → L1 = L2.
#d #e #L1 #L2 #H elim H -d -e -L1 -L2 //
-[ #L1 #L2 #I #V1 #V2 #e #_ #_ #_ #H
- elim (plus_S_eq_O_false … H)
+[ #L1 #L2 #I #V1 #V2 #e #_ #_ #_ >commutative_plus normalize #H destruct
| #L1 #L2 #I #V1 #V2 #d #e #_ #HV12 #IHL12 #He destruct
>(IHL12 ?) -IHL12 // >(tps_inv_refl_O2 … HV12) //
]
[ #d #e #_ #_ #K1 #I #V1 #H destruct
| #L1 #I #V #_ #H elim (lt_refl_false … H)
| #L1 #L2 #I #V1 #V2 #e #HL12 #HV12 #_ #_ #K1 #J #W1 #H destruct /2 width=5/
-| #L1 #L2 #I #V1 #V2 #d #e #_ #_ #H elim (plus_S_eq_O_false … H)
+| #L1 #L2 #I #V1 #V2 #d #e #_ #_ >commutative_plus normalize #H destruct
]
qed.
[ #d #e #_ #_ #K1 #I #V1 #H destruct
| #L1 #I #V #_ #H elim (lt_refl_false … H)
| #L1 #L2 #I #V1 #V2 #e #HL12 #HV12 #_ #_ #K2 #J #W2 #H destruct /2 width=5/
-| #L1 #L2 #I #V1 #V2 #d #e #_ #_ #H elim (plus_S_eq_O_false … H)
+| #L1 #L2 #I #V1 #V2 #d #e #_ #_ >commutative_plus normalize #H destruct
]
qed.
/2 by plus_minus/ qed.
lemma minus_minus_comm: ∀a,b,c. a - b - c = a - c - b.
- /3 by monotonic_le_minus_l, le_to_le_to_eq/ qed.
+/3 by monotonic_le_minus_l, le_to_le_to_eq/ qed.
lemma minus_le_minus_minus_comm: ∀b,c,a. c ≤ b → a - (b - c) = a + c - b.
-#b elim b -b
-[ #c #a #H >(le_n_O_to_eq … H) -H //
-| #b #IHb #c elim c -c //
- #c #_ #a #Hcb
- lapply (le_S_S_to_le … Hcb) -Hcb #Hcb
- <plus_n_Sm normalize /2 width=1/
-]
+#b #c #a #H >(plus_minus_m_m b c) in ⊢ (? ? ?%); //
qed.
lemma arith_b1: ∀a,b,c1. c1 ≤ b → a - c1 - (b - c1) = a - b.
-#a #b #c1 #H >minus_plus /3 width=1/
+#a #b #c1 #H >minus_minus_comm >minus_le_minus_minus_comm //
qed.
lemma arith_b2: ∀a,b,c1,c2. c1 + c2 ≤ b → a - c1 - c2 - (b - c1 - c2) = a - b.
qed-.
lemma lt_or_eq_or_gt: ∀m,n. ∨∨ m < n | n = m | n < m.
-#m elim m -m
-[ * /2 width=1/
-| #m #IHm * /2 width=1/
- #n elim (IHm n) -IHm #H
- [ @or3_intro0 | @or3_intro1 destruct | @or3_intro2 ] // /2 width=1/ (**) (* /3 width=1/ is slow *)
+#m #n elim (lt_or_ge m n) /2 width=1/
+#H elim H -m /2 width=1/
+#m #Hm * #H /2 width=1/ /3 width=1/
qed-.
lemma le_inv_plus_plus_r: ∀x,y,z. x + z ≤ y + z → x ≤ y.
lemma le_inv_plus_l: ∀x,y,z. x + y ≤ z → x ≤ z - y ∧ y ≤ z.
/3 width=2/ qed-.
+lemma lt_inv_plus_l: ∀x,y,z. x + y < z → x < z ∧ y < z - x.
+/3 width=2/ qed-.
+
lemma lt_refl_false: ∀n. n < n → False.
#n #H elim (lt_to_not_eq … H) -H /2 width=1/
qed-.
#n #H elim (lt_to_not_le … H) -H /2 width=1/
qed-.
-lemma plus_S_eq_O_false: ∀n,m. n + S m = 0 → False.
-#n #m <plus_n_Sm #H destruct
-qed-.
-
-lemma plus_lt_false: ∀m,n. m + n < m → False.
-#m #n #H1 lapply (le_plus_n_r n m) #H2
-lapply (le_to_lt_to_lt … H2 H1) -H2 -H1 #H
-elim (lt_refl_false … H)
-qed-.
-
lemma false_lt_to_le: ∀x,y. (x < y → False) → y ≤ x.
#x #y #H elim (decidable_lt x y) /2 width=1/
#Hxy elim (H Hxy)
qed-.
lemma le_fwd_plus_plus_ge: ∀m1,m2. m2 ≤ m1 → ∀n1,n2. m1 + n1 ≤ m2 + n2 → n1 ≤ n2.
-#m1 #m2 #H elim H -m1
-[ /2 width=2/
-| #m1 #_ #IHm1 #n1 #n2 #H @IHm1 /2 width=3/
-]
-qed-.
+#m1 #m2 #H #n1 #n2 >commutative_plus
+#H elim (le_inv_plus_l … H) -H >commutative_plus <minus_le_minus_minus_comm //
+#H #_ @(transitive_le … H) /2 width=1/
+qed-.
+
+(*
+lemma pippo: ∀x,y,z. x < z → y < z - x → x + y < z.
+/3 width=2/
+*)