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 include "nat/times.ma".
16 include "nat/orders.ma".
19 theorem monotonic_le_plus_r:
20 \forall n:nat.monotonic nat le (\lambda m.n + m).
21 simplify.intros.elim n
23 |simplify.apply le_S_S.assumption
27 theorem le_plus_r: \forall p,n,m:nat. n \le m \to p + n \le p + m
28 \def monotonic_le_plus_r.
30 theorem monotonic_le_plus_l:
31 \forall m:nat.monotonic nat le (\lambda n.n + m).
33 rewrite < sym_plus.rewrite < (sym_plus m).
34 apply le_plus_r.assumption.
37 theorem le_plus_l: \forall p,n,m:nat. n \le m \to n + p \le m + p
38 \def monotonic_le_plus_l.
40 theorem le_plus: \forall n1,n2,m1,m2:nat. n1 \le n2 \to m1 \le m2
41 \to n1 + m1 \le n2 + m2.
46 apply (transitive_le (plus n1 m1) (plus n1 m2) (plus n2 m2) ? ?);
47 [apply (monotonic_le_plus_r n1 m1 m2 ?).
49 |apply (monotonic_le_plus_l m2 n1 n2 ?).
52 (* end auto($Revision$) proof: TIME=0.61 SIZE=100 DEPTH=100 *)
54 apply (trans_le ? (n2 + m1)).
55 apply le_plus_l.assumption.
56 apply le_plus_r.assumption.
60 theorem le_plus_n :\forall n,m:nat. m \le n + m.
61 intros.change with (O+m \le n+m).
62 apply le_plus_l.apply le_O_n.
65 theorem le_plus_n_r :\forall n,m:nat. m \le m + n.
66 intros.rewrite > sym_plus.
70 theorem eq_plus_to_le: \forall n,m,p:nat.n=m+p \to m \le n.
76 theorem le_plus_to_le:
77 \forall a,n,m. a + n \le a + m \to n \le m.
82 apply le_S_S_to_le.assumption
87 theorem monotonic_le_times_r:
88 \forall n:nat.monotonic nat le (\lambda m. n * m).
89 simplify.intros.elim n.
90 simplify.apply le_O_n.
91 simplify.apply le_plus.
96 theorem le_times_r: \forall p,n,m:nat. n \le m \to p*n \le p*m
97 \def monotonic_le_times_r.
99 theorem monotonic_le_times_l:
100 \forall m:nat.monotonic nat le (\lambda n.n*m).
102 rewrite < sym_times.rewrite < (sym_times m).
103 apply le_times_r.assumption.
106 theorem le_times_l: \forall p,n,m:nat. n \le m \to n*p \le m*p
107 \def monotonic_le_times_l.
109 theorem le_times: \forall n1,n2,m1,m2:nat. n1 \le n2 \to m1 \le m2
112 apply (trans_le ? (n2*m1)).
113 apply le_times_l.assumption.
114 apply le_times_r.assumption.
117 theorem le_times_n: \forall n,m:nat.(S O) \le n \to m \le n*m.
118 intros.elim H.simplify.
119 elim (plus_n_O ?).apply le_n.
120 simplify.rewrite < sym_plus.apply le_plus_n.
123 theorem le_times_to_le:
124 \forall a,n,m. S O \le a \to a * n \le a * m \to n \le m.
126 apply nat_elim2;intros
129 rewrite < times_n_O in H1.
130 generalize in match H1.
131 apply (lt_O_n_elim ? H).
134 apply (le_to_not_lt ? ? H2).
139 |rewrite < times_n_Sm in H2.
140 rewrite < times_n_Sm in H2.
141 apply (le_plus_to_le a).
147 theorem le_S_times_SSO: \forall n,m.O < m \to
148 n \le m \to S n \le (S(S O))*m.
152 simplify.rewrite > plus_n_Sm.
160 theorem O_lt_const_to_le_times_const: \forall a,c:nat.
161 O \lt c \to a \le a*c.
163 rewrite > (times_n_SO a) in \vdash (? % ?).