1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 include "arithmetics/nat.ma".
16 include "Ground_2/star.ma".
18 (* ARITHMETICAL PROPERTIES **************************************************)
20 (* Equations ****************************************************************)
22 lemma le_plus_minus: ∀m,n,p. p ≤ n → m + n - p = m + (n - p).
23 /2 by plus_minus/ qed.
25 lemma le_plus_minus_comm: ∀n,m,p. p ≤ m → m + n - p = m - p + n.
26 /2 by plus_minus/ qed.
28 lemma arith_b1: ∀a,b,c1. c1 ≤ b → a - c1 - (b - c1) = a - b.
29 #a #b #c1 #H >minus_minus_comm >minus_le_minus_minus_comm //
32 lemma arith_b2: ∀a,b,c1,c2. c1 + c2 ≤ b → a - c1 - c2 - (b - c1 - c2) = a - b.
33 #a #b #c1 #c2 #H >minus_plus >minus_plus >minus_plus /2 width=1/
36 lemma arith_c1x: ∀x,a,b,c1. x + c1 + a - (b + c1) = x + a - b.
37 /3 by monotonic_le_minus_l, le_to_le_to_eq, le_n/ qed.
39 lemma arith_h1: ∀a1,a2,b,c1. c1 ≤ a1 → c1 ≤ b →
40 a1 - c1 + a2 - (b - c1) = a1 + a2 - b.
41 #a1 #a2 #b #c1 #H1 #H2 >plus_minus // /2 width=1/
44 (* inversion & forward lemmas ***********************************************)
46 axiom eq_nat_dec: ∀n1,n2:nat. Decidable (n1 = n2).
48 axiom lt_dec: ∀n1,n2. Decidable (n1 < n2).
50 lemma lt_or_eq_or_gt: ∀m,n. ∨∨ m < n | n = m | n < m.
51 #m #n elim (lt_or_ge m n) /2 width=1/
52 #H elim H -m /2 width=1/
53 #m #Hm * #H /2 width=1/ /3 width=1/
56 lemma lt_refl_false: ∀n. n < n → False.
57 #n #H elim (lt_to_not_eq … H) -H /2 width=1/
60 lemma lt_zero_false: ∀n. n < 0 → False.
61 #n #H elim (lt_to_not_le … H) -H /2 width=1/
64 lemma false_lt_to_le: ∀x,y. (x < y → False) → y ≤ x.
65 #x #y #H elim (decidable_lt x y) /2 width=1/
70 lemma pippo: ∀x,y,z. x < z → y < z - x → x + y < z.
73 lemma le_or_ge: ∀m,n. m ≤ n ∨ n ≤ m.
74 #m #n elim (lt_or_ge m n) /2 width=1/ /3 width=2/