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 (* \ / Matita is distributed under the terms of the *)
11 (* v GNU Lesser General Public License Version 2.1 *)
13 (**************************************************************************)
15 set "baseuri" "cic:/matita/nat/factorial".
17 include "nat/le_arith.ma".
22 | (S m) \Rightarrow (S m)*(fact m)].
24 interpretation "factorial" 'fact n = (cic:/matita/nat/factorial/fact.con n).
26 theorem le_SO_fact : \forall n. (S O) \le n!.
27 intro.elim n.simplify.apply le_n.
28 change with ((S O) \le (S n1)*n1!).
29 apply (trans_le ? ((S n1)*(S O))).simplify.
30 apply le_S_S.apply le_O_n.
31 apply le_times_r.assumption.
34 theorem le_SSO_fact : \forall n. (S O) < n \to (S(S O)) \le n!.
35 intro.apply (nat_case n).intro.apply False_ind.apply (not_le_Sn_O (S O) H).
36 intros.change with ((S (S O)) \le (S m)*m!).
37 apply (trans_le ? ((S(S O))*(S O))).apply le_n.
38 apply le_times.exact H.apply le_SO_fact.
41 theorem le_n_fact_n: \forall n. n \le n!.
42 intro. elim n.apply le_O_n.
43 change with (S n1 \le (S n1)*n1!).
44 apply (trans_le ? ((S n1)*(S O))).
45 rewrite < times_n_SO.apply le_n.
46 apply le_times.apply le_n.
50 theorem lt_n_fact_n: \forall n. (S(S O)) < n \to n < n!.
51 intro.apply (nat_case n).intro.apply False_ind.apply (not_le_Sn_O (S(S O)) H).
52 intros.change with ((S m) < (S m)*m!).
53 apply (lt_to_le_to_lt ? ((S m)*(S (S O)))).
56 apply le_S_S.rewrite < plus_n_O.
58 apply le_times_r.apply le_SSO_fact.
59 simplify.unfold lt.apply le_S_S_to_le.exact H.