X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fmatita%2Flibrary%2Fnat%2Ffactorial.ma;fp=helm%2Fmatita%2Flibrary%2Fnat%2Ffactorial.ma;h=159559f092b271a4131fdab1b834f84ce600bf40;hb=373b88228a8f9a6b4b4dcf781bc166865f89f43d;hp=50345ee121e62aca628e4e82b9811e040199d08b;hpb=b75631eb92b06591c86cd4563d753cd8ed7e11b7;p=helm.git diff --git a/helm/matita/library/nat/factorial.ma b/helm/matita/library/nat/factorial.ma index 50345ee12..159559f09 100644 --- a/helm/matita/library/nat/factorial.ma +++ b/helm/matita/library/nat/factorial.ma @@ -21,33 +21,35 @@ let rec fact n \def [ O \Rightarrow (S O) | (S m) \Rightarrow (S m)*(fact m)]. -theorem le_SO_fact : \forall n. (S O) \le (fact n). +interpretation "factorial" 'fact n = (cic:/matita/nat/factorial/fact.con n). + +theorem le_SO_fact : \forall n. (S O) \le n !. intro.elim n.simplify.apply le_n. -change with (S O) \le (S n1)*(fact n1). +change with (S O) \le (S n1)*n1 !. apply trans_le ? ((S n1)*(S O)).simplify. apply le_S_S.apply le_O_n. apply le_times_r.assumption. qed. -theorem le_SSO_fact : \forall n. (S O) < n \to (S(S O)) \le (fact n). +theorem le_SSO_fact : \forall n. (S O) < n \to (S(S O)) \le n !. intro.apply nat_case n.intro.apply False_ind.apply not_le_Sn_O (S O) H. -intros.change with (S (S O)) \le (S m)*(fact m). +intros.change with (S (S O)) \le (S m)*m !. apply trans_le ? ((S(S O))*(S O)).apply le_n. apply le_times.exact H.apply le_SO_fact. qed. -theorem le_n_fact_n: \forall n. n \le (fact n). +theorem le_n_fact_n: \forall n. n \le n !. intro. elim n.apply le_O_n. -change with S n1 \le (S n1)*(fact n1). +change with S n1 \le (S n1)*n1 !. apply trans_le ? ((S n1)*(S O)). rewrite < times_n_SO.apply le_n. apply le_times.apply le_n. apply le_SO_fact. qed. -theorem lt_n_fact_n: \forall n. (S(S O)) < n \to n < (fact n). +theorem lt_n_fact_n: \forall n. (S(S O)) < n \to n < n !. intro.apply nat_case n.intro.apply False_ind.apply not_le_Sn_O (S(S O)) H. -intros.change with (S m) < (S m)*(fact m). +intros.change with (S m) < (S m)*m !. apply lt_to_le_to_lt ? ((S m)*(S (S O))). rewrite < sym_times. simplify.