aboutsummaryrefslogtreecommitdiffhomepage
path: root/theories7/Arith/Factorial.v
diff options
context:
space:
mode:
authorGravatar herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7>2003-11-29 16:15:58 +0000
committerGravatar herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7>2003-11-29 16:15:58 +0000
commit9058fb97426307536f56c3e7447be2f70798e081 (patch)
treeb9a5fcf2ace7ecec13ed264b93c33fc04b0f220f /theories7/Arith/Factorial.v
parent95ad10e5eb2efc9b63382e0e6a2f9ada8da2ea2d (diff)
Deplacement des fichiers ancienne syntaxe dans theories7, contrib7 et states7
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@5026 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'theories7/Arith/Factorial.v')
-rw-r--r--theories7/Arith/Factorial.v51
1 files changed, 51 insertions, 0 deletions
diff --git a/theories7/Arith/Factorial.v b/theories7/Arith/Factorial.v
new file mode 100644
index 000000000..1d1ee00af
--- /dev/null
+++ b/theories7/Arith/Factorial.v
@@ -0,0 +1,51 @@
+(***********************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA-Rocquencourt & LRI-CNRS-Orsay *)
+(* \VV/ *************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(***********************************************************************)
+
+(*i $Id$ i*)
+
+Require Plus.
+Require Mult.
+Require Lt.
+V7only [Import nat_scope.].
+Open Local Scope nat_scope.
+
+(** Factorial *)
+
+Fixpoint fact [n:nat]:nat:=
+ Cases n of
+ O => (S O)
+ |(S n) => (mult (S n) (fact n))
+ end.
+
+Arguments Scope fact [ nat_scope ].
+
+Lemma lt_O_fact : (n:nat)(lt O (fact n)).
+Proof.
+Induction n; Unfold lt; Simpl; Auto with arith.
+Qed.
+
+Lemma fact_neq_0:(n:nat)~(fact n)=O.
+Proof.
+Intro.
+Apply sym_not_eq.
+Apply lt_O_neq.
+Apply lt_O_fact.
+Qed.
+
+Lemma fact_growing : (n,m:nat) (le n m) -> (le (fact n) (fact m)).
+Proof.
+NewInduction 1.
+Apply le_n.
+Assert (le (mult (S O) (fact n)) (mult (S m) (fact m))).
+Apply le_mult_mult.
+Apply lt_le_S; Apply lt_O_Sn.
+Assumption.
+Simpl (mult (S O) (fact n)) in H0.
+Rewrite <- plus_n_O in H0.
+Assumption.
+Qed.