]> matita.cs.unibo.it Git - helm.git/blob - helm/matita/library/nat/le_arith.ma
ocaml 3.09 transition
[helm.git] / helm / 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 eq_plus_to_le: \forall n,m,p:nat.n=m+p \to m \le n.
55 intros.rewrite > H.
56 rewrite < sym_plus.
57 apply le_plus_n.
58 qed.
59
60 (* times *)
61 theorem monotonic_le_times_r: 
62 \forall n:nat.monotonic nat le (\lambda m. n * m).
63 simplify.intros.elim n.
64 simplify.apply le_O_n.
65 simplify.apply le_plus.
66 assumption.
67 assumption.
68 qed.
69
70 theorem le_times_r: \forall p,n,m:nat. n \le m \to p*n \le p*m
71 \def monotonic_le_times_r.
72
73 theorem monotonic_le_times_l: 
74 \forall m:nat.monotonic nat le (\lambda n.n*m).
75 simplify.intros.
76 rewrite < sym_times.rewrite < (sym_times m).
77 apply le_times_r.assumption.
78 qed.
79
80 theorem le_times_l: \forall p,n,m:nat. n \le m \to n*p \le m*p
81 \def monotonic_le_times_l.
82
83 theorem le_times: \forall n1,n2,m1,m2:nat. n1 \le n2  \to m1 \le m2 
84 \to n1*m1 \le n2*m2.
85 intros.
86 apply (trans_le ? (n2*m1)).
87 apply le_times_l.assumption.
88 apply le_times_r.assumption.
89 qed.
90
91 theorem le_times_n: \forall n,m:nat.(S O) \le n \to m \le n*m.
92 intros.elim H.simplify.
93 elim (plus_n_O ?).apply le_n.
94 simplify.rewrite < sym_plus.apply le_plus_n.
95 qed.