]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambda_delta/Ground_2/arith.ma
In case paramodulation fails we apply unit equalities.
[helm.git] / matita / matita / contribs / lambda_delta / Ground_2 / arith.ma
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 include "arithmetics/nat.ma".
16 include "Ground_2/star.ma".
17
18 (* ARITHMETICAL PROPERTIES **************************************************)
19
20 (* equations ****************************************************************)
21
22 lemma plus_plus_comm_23: ∀x,y,z. x + y + z = x + z + y.
23 // qed.
24
25 lemma le_plus_minus: ∀m,n,p. p ≤ n → m + n - p = m + (n - p).
26 /2 by plus_minus/ qed.
27
28 lemma le_plus_minus_comm: ∀n,m,p. p ≤ m → m + n - p = m - p + n.
29 /2 by plus_minus/ qed.
30
31 lemma minus_minus_comm: ∀a,b,c. a - b - c = a - c - b.
32 /3 by monotonic_le_minus_l, le_to_le_to_eq/ qed.
33
34 lemma minus_le_minus_minus_comm: ∀b,c,a. c ≤ b → a - (b - c) = a + c - b.
35 #b #c #a #H >(plus_minus_m_m b c) in ⊢ (? ? ?%); //
36 qed.
37
38 lemma arith_b1: ∀a,b,c1. c1 ≤ b → a - c1 - (b - c1) = a - b.
39 #a #b #c1 #H >minus_minus_comm >minus_le_minus_minus_comm //
40 qed.
41
42 lemma arith_b2: ∀a,b,c1,c2. c1 + c2 ≤ b → a - c1 - c2 - (b - c1 - c2) = a - b.
43 #a #b #c1 #c2 #H >minus_plus >minus_plus >minus_plus /2 width=1/
44 qed.
45
46 lemma arith_c1x: ∀x,a,b,c1. x + c1 + a - (b + c1) = x + a - b.
47 /3 by monotonic_le_minus_l, le_to_le_to_eq, le_n/ qed.
48
49 lemma arith_h1: ∀a1,a2,b,c1. c1 ≤ a1 → c1 ≤ b →
50                 a1 - c1 + a2 - (b - c1) = a1 + a2 - b.
51 #a1 #a2 #b #c1 #H1 #H2 >plus_minus // /2 width=1/
52 qed.
53
54 (* inversion & forward lemmas ***********************************************)
55
56 axiom eq_nat_dec: ∀n1,n2:nat. Decidable (n1 = n2).
57
58 axiom lt_dec: ∀n1,n2. Decidable (n1 < n2).
59
60 lemma lt_or_ge: ∀m,n. m < n ∨ n ≤ m.
61 #m #n elim (decidable_lt m n) /2 width=1/ /3 width=1/
62 qed-.
63
64 lemma lt_or_eq_or_gt: ∀m,n. ∨∨ m < n | n = m | n < m.
65 #m #n elim (lt_or_ge m n) /2 width=1/
66 #H elim H -m /2 width=1/
67 #m #Hm * #H /2 width=1/ /3 width=1/
68 qed-.
69
70 lemma le_inv_plus_plus_r: ∀x,y,z. x + z ≤ y + z → x ≤ y.
71 /2 by le_plus_to_le/ qed-.
72
73 lemma le_inv_plus_l: ∀x,y,z. x + y ≤ z → x ≤ z - y ∧ y ≤ z.
74 /3 width=2/ qed-.
75
76 lemma lt_inv_plus_l: ∀x,y,z. x + y < z → x < z ∧ y < z - x.
77 /3 width=2/ qed-.
78
79 lemma lt_refl_false: ∀n. n < n → False.
80 #n #H elim (lt_to_not_eq … H) -H /2 width=1/
81 qed-.
82
83 lemma lt_zero_false: ∀n. n < 0 → False.
84 #n #H elim (lt_to_not_le … H) -H /2 width=1/
85 qed-.
86
87 lemma false_lt_to_le: ∀x,y. (x < y → False) → y ≤ x.
88 #x #y #H elim (decidable_lt x y) /2 width=1/
89 #Hxy elim (H Hxy)
90 qed-.
91
92 lemma le_fwd_plus_plus_ge: ∀m1,m2. m2 ≤ m1 → ∀n1,n2. m1 + n1 ≤ m2 + n2 → n1 ≤ n2.
93 #m1 #m2 #H #n1 #n2 >commutative_plus
94 #H elim (le_inv_plus_l … H) -H >commutative_plus <minus_le_minus_minus_comm //
95 #H #_ @(transitive_le … H) /2 width=1/
96 qed-. 
97
98 (*
99 lemma pippo: ∀x,y,z. x < z → y < z - x → x + y < z.
100 /3 width=2/
101 *)