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/times".
17 include "nat/plus.ma".
19 let rec times n m \def
22 | (S p) \Rightarrow m+(times p m) ].
24 interpretation "natural times" 'times x y = (cic:/matita/nat/times/times.con x y).
26 theorem times_n_O: \forall n:nat. O = n*O.
33 \forall n,m:nat. n+(n*m) = n*(S m).
36 simplify.apply eq_f.rewrite < H.
37 transitivity ((n1+m)+n1*m).symmetry.apply assoc_plus.
38 transitivity ((m+n1)+n1*m).
45 theorem times_O_to_O: \forall n,m:nat.n*m = O \to n = O \lor m= O.
46 apply nat_elim2;intros
51 apply (not_eq_O_S ? (sym_eq ? ? ? H1))
55 theorem times_n_SO : \forall n:nat. n = n * S O.
63 theorem times_SSO_n : \forall n:nat. n + n = S (S O) * n.
70 alias num (instance 0) = "natural number".
71 lemma times_SSO: \forall n.2*(S n) = S(S(2*n)).
72 intro.simplify.rewrite < plus_n_Sm.reflexivity.
75 theorem or_eq_eq_S: \forall n.\exists m.
76 n = (S(S O))*m \lor n = S ((S(S O))*m).
78 [apply (ex_intro ? ? O).
81 [apply (ex_intro ? ? a).
82 right.apply eq_f.assumption
83 |apply (ex_intro ? ? (S a)).
91 theorem symmetric_times : symmetric nat times.
94 simplify.apply times_n_O.
95 simplify.rewrite > H.apply times_n_Sm.
98 variant sym_times : \forall n,m:nat. n*m = m*n \def
101 theorem distributive_times_plus : distributive nat times plus.
104 simplify.reflexivity.
105 simplify.rewrite > H. rewrite > assoc_plus.rewrite > assoc_plus.
106 apply eq_f.rewrite < assoc_plus. rewrite < (sym_plus ? z).
107 rewrite > assoc_plus.reflexivity.
110 variant distr_times_plus: \forall n,m,p:nat. n*(m+p) = n*m + n*p
111 \def distributive_times_plus.
113 theorem associative_times: associative nat times.
114 unfold associative.intros.
115 elim x.simplify.apply refl_eq.
116 simplify.rewrite < sym_times.
117 rewrite > distr_times_plus.
119 rewrite < (sym_times (times n y) z).
120 rewrite < H.apply refl_eq.
123 variant assoc_times: \forall n,m,p:nat. (n*m)*p = n*(m*p) \def