X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fmatita%2Flibrary%2Fnat%2Ftimes.ma;h=2707c2ba1cdd8ff08a0404fa40de9f714390542c;hb=5c56a926588a63ceac31e6ddd6e3eeb02fadf3a9;hp=953b3a1b630321187f46f9c2199e8b3dde12a928;hpb=5e1fd9ee5ced5737c7fd4f25fca47feda1fda8e9;p=helm.git diff --git a/helm/matita/library/nat/times.ma b/helm/matita/library/nat/times.ma index 953b3a1b6..2707c2ba1 100644 --- a/helm/matita/library/nat/times.ma +++ b/helm/matita/library/nat/times.ma @@ -1,5 +1,5 @@ (**************************************************************************) -(* ___ *) +(* __ *) (* ||M|| *) (* ||A|| A project by Andrea Asperti *) (* ||T|| *) @@ -14,44 +14,53 @@ set "baseuri" "cic:/matita/nat/times". -include "logic/equality.ma". -include "nat/nat.ma". include "nat/plus.ma". let rec times n m \def match n with [ O \Rightarrow O - | (S p) \Rightarrow (plus m (times p m)) ]. + | (S p) \Rightarrow m+(times p m) ]. -theorem times_n_O: \forall n:nat. eq nat O (times n O). +(*CSC: the URI must disappear: there is a bug now *) +interpretation "natural times" 'times x y = (cic:/matita/nat/times/times.con x y). + +theorem times_n_O: \forall n:nat. O = n*O. intros.elim n. simplify.reflexivity. simplify.assumption. qed. theorem times_n_Sm : -\forall n,m:nat. eq nat (plus n (times n m)) (times n (S m)). +\forall n,m:nat. n+(n*m) = n*(S m). intros.elim n. simplify.reflexivity. simplify.apply eq_f.rewrite < H. -transitivity (plus (plus n1 m) (times n1 m)).symmetry.apply assoc_plus. -transitivity (plus (plus m n1) (times n1 m)). +transitivity ((n1+m)+n1*m).symmetry.apply assoc_plus. +transitivity ((m+n1)+n1*m). apply eq_f2. apply sym_plus. reflexivity. apply assoc_plus. qed. -(* same problem with symmetric: see plus -theorem symmetric_times : symmetric nat times. *) +theorem times_n_SO : \forall n:nat. eq nat n (times n (S O)). +intros. +rewrite < times_n_Sm. +rewrite < times_n_O. +rewrite < plus_n_O. +reflexivity. +qed. -theorem sym_times : -\forall n,m:nat. eq nat (times n m) (times m n). -intros.elim n. +theorem symmetric_times : symmetric nat times. +simplify. +intros.elim x. simplify.apply times_n_O. simplify.rewrite > H.apply times_n_Sm. qed. +variant sym_times : \forall n,m:nat. n*m = m*n \def +symmetric_times. + theorem distributive_times_plus : distributive nat times plus. simplify. intros.elim x. @@ -61,7 +70,18 @@ apply eq_f.rewrite < assoc_plus. rewrite < sym_plus ? z. rewrite > assoc_plus.reflexivity. qed. -variant times_plus_distr: \forall n,m,p:nat. -eq nat (times n (plus m p)) (plus (times n m) (times n p)) +variant times_plus_distr: \forall n,m,p:nat. n*(m+p) = n*m + n*p \def distributive_times_plus. +theorem associative_times: associative nat times. +simplify.intros. +elim x.simplify.apply refl_eq. +simplify.rewrite < sym_times. +rewrite > times_plus_distr. +rewrite < sym_times. +rewrite < sym_times (times n y) z. +rewrite < H.apply refl_eq. +qed. + +variant assoc_times: \forall n,m,p:nat. (n*m)*p = n*(m*p) \def +associative_times.