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/plus.ma".
17 let rec times n m \def
20 | (S p) \Rightarrow m+(times p m) ].
22 interpretation "natural times" 'times x y = (cic:/matita/nat/times/times.con x y).
24 theorem times_n_O: \forall n:nat. O = n*O.
31 \forall n,m:nat. n+(n*m) = n*(S m).
34 simplify.apply eq_f.rewrite < H.
35 transitivity ((n1+m)+n1*m).symmetry.apply assoc_plus.
36 transitivity ((m+n1)+n1*m).
43 theorem times_O_to_O: \forall n,m:nat.n*m = O \to n = O \lor m= O.
44 apply nat_elim2;intros
49 apply (not_eq_O_S ? (sym_eq ? ? ? H1))
53 theorem times_n_SO : \forall n:nat. n = n * S O.
61 theorem times_SSO_n : \forall n:nat. n + n = S (S O) * n.
68 alias num (instance 0) = "natural number".
69 lemma times_SSO: \forall n.2*(S n) = S(S(2*n)).
70 intro.simplify.rewrite < plus_n_Sm.reflexivity.
73 theorem or_eq_eq_S: \forall n.\exists m.
74 n = (S(S O))*m \lor n = S ((S(S O))*m).
76 [apply (ex_intro ? ? O).
79 [apply (ex_intro ? ? a).
80 right.apply eq_f.assumption
81 |apply (ex_intro ? ? (S a)).
89 theorem symmetric_times : symmetric nat times.
92 simplify.apply times_n_O.
93 simplify.rewrite > H.apply times_n_Sm.
96 variant sym_times : \forall n,m:nat. n*m = m*n \def
99 theorem distributive_times_plus : distributive nat times plus.
102 simplify.reflexivity.
103 simplify.rewrite > H. rewrite > assoc_plus.rewrite > assoc_plus.
104 apply eq_f.rewrite < assoc_plus. rewrite < (sym_plus ? z).
105 rewrite > assoc_plus.reflexivity.
108 variant distr_times_plus: \forall n,m,p:nat. n*(m+p) = n*m + n*p
109 \def distributive_times_plus.
111 theorem associative_times: associative nat times.
112 unfold associative.intros.
113 elim x.simplify.apply refl_eq.
114 simplify.rewrite < sym_times.
115 rewrite > distr_times_plus.
117 rewrite < (sym_times (times n y) z).
118 rewrite < H.apply refl_eq.
121 variant assoc_times: \forall n,m,p:nat. (n*m)*p = n*(m*p) \def