aboutsummaryrefslogtreecommitdiffhomepage
path: root/theories/Arith/Minus.v
diff options
context:
space:
mode:
authorGravatar filliatr <filliatr@85f007b7-540e-0410-9357-904b9bb8a0f7>2000-03-10 17:46:01 +0000
committerGravatar filliatr <filliatr@85f007b7-540e-0410-9357-904b9bb8a0f7>2000-03-10 17:46:01 +0000
commit9f8ccadf2f68ff44ee81d782b6881b9cc3c04c4b (patch)
treecb38ff6db4ade84d47f9788ae7bc821767abf638 /theories/Arith/Minus.v
parent20b4a46e9956537a0bb21c5eacf2539dee95cb67 (diff)
mise sous CVS du repertoire theories/Arith
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@311 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'theories/Arith/Minus.v')
-rwxr-xr-xtheories/Arith/Minus.v89
1 files changed, 89 insertions, 0 deletions
diff --git a/theories/Arith/Minus.v b/theories/Arith/Minus.v
new file mode 100755
index 000000000..4594aa74d
--- /dev/null
+++ b/theories/Arith/Minus.v
@@ -0,0 +1,89 @@
+
+(* $Id$ *)
+
+
+(**************************************************************************)
+(* Subtraction (difference between two natural numbers *)
+(**************************************************************************)
+
+
+Require Lt.
+Require Le.
+
+Fixpoint minus [n:nat] : nat -> nat :=
+ [m:nat]Cases n m of
+ O _ => O
+ | (S k) O => (S k)
+ | (S k) (S l) => (minus k l)
+ end.
+
+Lemma minus_plus_simpl :
+ (n,m,p:nat)((minus n m)=(minus (plus p n) (plus p m))).
+Proof.
+ Induction p; Simpl; Auto with arith.
+Qed.
+Hints Resolve minus_plus_simpl : arith v62.
+
+Lemma minus_n_O : (n:nat)(n=(minus n O)).
+Proof.
+Induction n; Simpl; Auto with arith.
+Qed.
+Hints Resolve minus_n_O : arith v62.
+
+Lemma minus_n_n : (n:nat)(O=(minus n n)).
+Proof.
+Induction n; Simpl; Auto with arith.
+Qed.
+Hints Resolve minus_n_n : arith v62.
+
+Lemma plus_minus : (n,m,p:nat)(n=(plus m p))->(p=(minus n m)).
+Proof.
+Intros n m p; Pattern m n; Apply nat_double_ind; Simpl; Intros.
+Replace (minus n0 O) with n0; Auto with arith.
+Absurd O=(S (plus n0 p)); Auto with arith.
+Auto with arith.
+Qed.
+Hints Immediate plus_minus : arith v62.
+
+Lemma minus_plus : (n,m:nat)(minus (plus n m) n)=m.
+Symmetry; Auto with arith.
+Save.
+Hints Resolve minus_plus : arith v62.
+
+Lemma le_plus_minus : (n,m:nat)(le n m)->(m=(plus n (minus m n))).
+Proof.
+Intros n m Le; Pattern n m; Apply le_elim_rel; Simpl; Auto with arith.
+Qed.
+Hints Resolve le_plus_minus : arith v62.
+
+Lemma le_plus_minus_r : (n,m:nat)(le n m)->(plus n (minus m n))=m.
+Proof.
+Symmetry; Auto with arith.
+Qed.
+Hints Resolve le_plus_minus_r : arith v62.
+
+
+Lemma minus_Sn_m : (n,m:nat)(le m n)->((S (minus n m))=(minus (S n) m)).
+Proof.
+Intros n m Le; Pattern m n; Apply le_elim_rel; Simpl; Auto with arith.
+Qed.
+Hints Resolve minus_Sn_m : arith v62.
+
+
+Lemma lt_minus : (n,m:nat)(le m n)->(lt O m)->(lt (minus n m) n).
+Proof.
+Intros n m Le; Pattern m n; Apply le_elim_rel; Simpl; Auto with arith.
+Intros; Absurd (lt O O); Auto with arith.
+Intros p q lepq Hp gtp.
+Elim (le_lt_or_eq O p); Auto with arith.
+Auto with arith.
+Induction 1; Elim minus_n_O; Auto with arith.
+Qed.
+Hints Resolve lt_minus : arith v62.
+
+Lemma lt_O_minus_lt : (n,m:nat)(lt O (minus n m))->(lt m n).
+Proof.
+Intros n m; Pattern n m; Apply nat_double_ind; Simpl; Auto with arith.
+Intros; Absurd (lt O O); Trivial with arith.
+Qed.
+Hints Immediate lt_O_minus_lt : arith v62.