(****************************************************************************)
(*                 The Calculus of Inductive Constructions                  *)
(*                                                                          *)
(*                                Projet Coq                                *)
(*                                                                          *)
(*                     INRIA        LRI-CNRS        ENS-CNRS                *)
(*              Rocquencourt         Orsay          Lyon                    *)
(*                                                                          *)
(*                                 Coq V6.2                                 *)
(*                               May 1st 1998                               *)
(*                                                                          *)
(****************************************************************************)
(*                                 Minus.v                                  *)
(****************************************************************************)

(*********************************************************)
(*    Subtraction                                        *)
(*********************************************************)

(* All theorems of Minus.v are solvable by Omega                            *)

Require Omega.

(* difference between two natural numbers *)
Fixpoint minus [n:nat] : nat -> nat := 
  [m:nat]<nat> Case n of
               (* O *) O
             (* S k *) [k:nat]<nat> Case m of
                                  (* O *)    (S k)
                                (* S l *)    [l:nat](minus k l) end end.

Lemma minus_plus_simpl : (n,m,p:nat)((minus n m)=(minus (plus p n) (plus p m))).
Proof.
Intros; Omega.
Qed.
Hint minus_plus_simpl.

Lemma minus_n_O : (n:nat)(n=(minus n O)).
Proof.
Intros; Omega.
Qed.
Hint minus_n_O.

Lemma minus_n_n : (n:nat)(O=(minus n n)).
Proof.
Intros; Omega.
Qed.
Hint minus_n_n.

Lemma plus_minus : (n,m,p:nat)(n=(plus m p))->(p=(minus n m)).
Proof.
Intros; Omega.
Qed.
Immediate plus_minus.

Lemma minus_plus : (n,m:nat)(minus (plus n m) n)=m.
Proof.
Intros; Omega.
Qed.
Hint minus_plus.

Require Le.

Lemma le_plus_minus : (n,m:nat)(le n m)->(m=(plus n (minus m n))).
Proof.
Intros; Omega.
Qed.
Hint le_plus_minus.

Lemma le_plus_minus_r : (n,m:nat)(le n m)->(plus n (minus m n))=m.
Proof.
Intros; Omega.
Qed.
Hint le_plus_minus_r.


Lemma minus_Sn_m : (n,m:nat)(le m n)->((S (minus n m))=(minus (S n) m)).
Proof.
Intros; Omega.
Qed.
Hint minus_Sn_m.

Require Lt.

Lemma lt_minus : (n,m:nat)(le m n)->(lt O m)->(lt (minus n m) n).
Proof.
Intros; Omega.
Qed.
Hint lt_minus.

Lemma lt_O_minus_lt : (n,m:nat)(lt O (minus n m))->(lt m n).
Proof.
Intros; Omega.
Qed.
Immediate lt_O_minus_lt.


(* $Id: Minus_omega.v,v 1.1 1998/07/02 13:22:16 loiseleu Exp $ *)
