]> matita.cs.unibo.it Git - helm.git/blob - matita/library/nat/le_arith.ma
ae386d313882f2b37903ae28c60c77dfa9fda072
[helm.git] / matita / library / nat / le_arith.ma
1 (**************************************************************************)
2 (*       ___                                                                *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||       A.Asperti, C.Sacerdoti Coen,                          *)
8 (*      ||A||       E.Tassi, S.Zacchiroli                                 *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU Lesser General Public License Version 2.1         *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 set "baseuri" "cic:/matita/nat/le_arith".
16
17 include "nat/times.ma".
18 include "nat/orders.ma".
19
20 (* plus *)
21 theorem monotonic_le_plus_r: 
22 \forall n:nat.monotonic nat le (\lambda m.n + m).
23 simplify.intros.elim n.
24 simplify.assumption.
25 simplify.apply le_S_S.assumption.
26 qed.
27
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.
30
31 theorem monotonic_le_plus_l: 
32 \forall m:nat.monotonic nat le (\lambda n.n + m).
33 simplify.intros.
34 rewrite < sym_plus.rewrite < (sym_plus m).
35 apply le_plus_r.assumption.
36 qed.
37
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.
40
41 theorem le_plus: \forall n1,n2,m1,m2:nat. n1 \le n2  \to m1 \le m2 
42 \to n1 + m1 \le n2 + m2.
43 intros.
44 apply (trans_le ? (n2 + m1)).
45 apply le_plus_l.assumption.
46 apply le_plus_r.assumption.
47 qed.
48
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.
52 qed.
53
54 theorem le_plus_n_r :\forall n,m:nat. m \le m + n.
55 intros.rewrite > sym_plus.
56 apply le_plus_n.
57 qed.
58
59 theorem eq_plus_to_le: \forall n,m,p:nat.n=m+p \to m \le n.
60 intros.rewrite > H.
61 rewrite < sym_plus.
62 apply le_plus_n.
63 qed.
64
65 (* times *)
66 theorem monotonic_le_times_r: 
67 \forall n:nat.monotonic nat le (\lambda m. n * m).
68 simplify.intros.elim n.
69 simplify.apply le_O_n.
70 simplify.apply le_plus.
71 assumption.
72 assumption.
73 qed.
74
75 theorem le_times_r: \forall p,n,m:nat. n \le m \to p*n \le p*m
76 \def monotonic_le_times_r.
77
78 theorem monotonic_le_times_l: 
79 \forall m:nat.monotonic nat le (\lambda n.n*m).
80 simplify.intros.
81 rewrite < sym_times.rewrite < (sym_times m).
82 apply le_times_r.assumption.
83 qed.
84
85 theorem le_times_l: \forall p,n,m:nat. n \le m \to n*p \le m*p
86 \def monotonic_le_times_l.
87
88 theorem le_times: \forall n1,n2,m1,m2:nat. n1 \le n2  \to m1 \le m2 
89 \to n1*m1 \le n2*m2.
90 intros.
91 apply (trans_le ? (n2*m1)).
92 apply le_times_l.assumption.
93 apply le_times_r.assumption.
94 qed.
95
96 theorem le_times_n: \forall n,m:nat.(S O) \le n \to m \le n*m.
97 intros.elim H.simplify.
98 elim (plus_n_O ?).apply le_n.
99 simplify.rewrite < sym_plus.apply le_plus_n.
100 qed.