1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| A.Asperti, C.Sacerdoti Coen, *)
8 (* ||A|| E.Tassi, S.Zacchiroli *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU Lesser General Public License Version 2.1 *)
13 (**************************************************************************)
15 set "baseuri" "cic:/matita/nat/le_arith".
17 include "nat/times.ma".
18 include "nat/orders.ma".
21 theorem monotonic_le_plus_r:
22 \forall n:nat.monotonic nat le (\lambda m.n + m).
23 simplify.intros.elim n.
25 simplify.apply le_S_S.assumption.
28 theorem le_plus_r: \forall p,n,m:nat. n \le m \to p + n \le p + m
29 \def monotonic_le_plus_r.
31 theorem monotonic_le_plus_l:
32 \forall m:nat.monotonic nat le (\lambda n.n + m).
34 rewrite < sym_plus.rewrite < (sym_plus m).
35 apply le_plus_r.assumption.
38 theorem le_plus_l: \forall p,n,m:nat. n \le m \to n + p \le m + p
39 \def monotonic_le_plus_l.
41 theorem le_plus: \forall n1,n2,m1,m2:nat. n1 \le n2 \to m1 \le m2
42 \to n1 + m1 \le n2 + m2.
44 apply (trans_le ? (n2 + m1)).
45 apply le_plus_l.assumption.
46 apply le_plus_r.assumption.
49 theorem le_plus_n :\forall n,m:nat. m \le n + m.
50 intros.change with (O+m \le n+m).
51 apply le_plus_l.apply le_O_n.
54 theorem le_plus_n_r :\forall n,m:nat. m \le m + n.
55 intros.rewrite > sym_plus.
59 theorem eq_plus_to_le: \forall n,m,p:nat.n=m+p \to m \le n.
65 theorem le_plus_to_le:
66 \forall a,n,m. a + n \le a + m \to n \le m.
71 apply le_S_S_to_le.assumption
76 theorem monotonic_le_times_r:
77 \forall n:nat.monotonic nat le (\lambda m. n * m).
78 simplify.intros.elim n.
79 simplify.apply le_O_n.
80 simplify.apply le_plus.
85 theorem le_times_r: \forall p,n,m:nat. n \le m \to p*n \le p*m
86 \def monotonic_le_times_r.
88 theorem monotonic_le_times_l:
89 \forall m:nat.monotonic nat le (\lambda n.n*m).
91 rewrite < sym_times.rewrite < (sym_times m).
92 apply le_times_r.assumption.
95 theorem le_times_l: \forall p,n,m:nat. n \le m \to n*p \le m*p
96 \def monotonic_le_times_l.
98 theorem le_times: \forall n1,n2,m1,m2:nat. n1 \le n2 \to m1 \le m2
101 apply (trans_le ? (n2*m1)).
102 apply le_times_l.assumption.
103 apply le_times_r.assumption.
106 theorem le_times_n: \forall n,m:nat.(S O) \le n \to m \le n*m.
107 intros.elim H.simplify.
108 elim (plus_n_O ?).apply le_n.
109 simplify.rewrite < sym_plus.apply le_plus_n.
112 theorem le_times_to_le:
113 \forall a,n,m. S O \le a \to a * n \le a * m \to n \le m.
115 apply nat_elim2;intros
118 rewrite < times_n_O in H1.
119 generalize in match H1.
120 apply (lt_O_n_elim ? H).
123 apply (le_to_not_lt ? ? H2).
128 |rewrite < times_n_Sm in H2.
129 rewrite < times_n_Sm in H2.
130 apply (le_plus_to_le a).