]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/matita/library/nat/factorial.ma
ocaml 3.09 transition
[helm.git] / helm / matita / library / nat / factorial.ma
index 742ca2a3ba517b2b0d7942076a8ee70edb0a35d5..14217bbcbdee58a7dba618d68642da3eb315d37c 100644 (file)
 
 set "baseuri" "cic:/matita/nat/factorial".
 
-include "nat/lt_arith.ma".
+include "nat/le_arith.ma".
 
 let rec fact n \def
   match n with 
   [ 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).
-apply trans_le ? ((S n1)*(S O)).simplify.
+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).
-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).
-apply trans_le ? ((S(S O))*(S O)).apply le_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)*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).
-apply trans_le ? ((S n1)*(S O)).
+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).
-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).
-apply lt_to_le_to_lt ? ((S m)*(S (S O))).
+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)*m!).
+apply (lt_to_le_to_lt ? ((S m)*(S (S O)))).
 rewrite < sym_times.
-simplify.
+simplify.unfold lt.
 apply le_S_S.rewrite < plus_n_O.
 apply le_plus_n.
 apply le_times_r.apply le_SSO_fact.
-simplify.apply le_S_S_to_le.exact H.
+simplify.unfold lt.apply le_S_S_to_le.exact H.
 qed.