(* This code is copyrighted by its authors; it is distributed under  *)
(* the terms of the LGPL license (see LICENSE and description files) *)
(* Contribution to the Coq Library   V6.3 (July 1999)                    *)
(****************************************************************************)
(*                                                                          *)
(*                                                                          *)
(*                   Solange Coupet-Grimal & Line Jakubiec                  *)
(*                                                                          *)
(*                                                                          *)
(*              Laboratoire d'Informatique de Marseille                     *)
(*               CMI-Technopole de Chateau-Gombert                          *)
(*                   39, Rue F. Joliot Curie                                *)
(*                   13453 MARSEILLE Cedex 13                               *)
(*           e-mail:{Solange.Coupet,Line.Jakubiec}@lim.univ-mrs.fr          *)
(*                                                                          *)
(*                                                                          *)
(*                                Coq V5.10                                 *)
(*                              May 30th 1996                               *)
(*                                                                          *)
(****************************************************************************)
(*                               Lib_Minus.v                                *)
(****************************************************************************)
Require Export Lib_Pred.
intros n.
elim minus_Sn_m.
apply eq_S.
elim minus_Sn_m.
apply eq_S.
elim minus_n_n; auto with arith.
auto with arith.
auto with arith.
Qed.
Hint Resolve minus_SS_n.
intros; simpl in |- *; auto with arith.
Qed.
Hint Resolve minus_S.
simple induction n; simple induction m; auto with arith.
intros; elim minus_S.
elim minus_S; auto with arith.
Qed.
Hint Resolve pred_minus_minus.
intros n m p H.
rewrite H; auto with arith.
Qed.
Hint Resolve minus_pred_S.
simple induction n; auto with arith.
Qed.
Hint Resolve pred_minus.
intros n m H.
elim pred_minus_minus.
elim H; auto with arith.
Qed.
Hint Resolve O_minus_S.
simple induction n; simple induction m; auto with arith.
intros; elim minus_S.
change (n0 - n1 - p = S n0 - S (n1 + p)) in |- *.
elim minus_S; apply H.
Qed.
Hint Resolve minus_minus_plus.
simple induction n; simple induction m; simpl in |- *; auto with arith.
intro.
apply lt_trans with (S n0); auto with arith.
Qed.
Hint Resolve lt_O_minus.
simple induction n; auto with arith.
intros.
case m; simpl in |- *; auto with arith.
Qed.
Hint Resolve le_minus.
simple induction n; simple induction m; auto with arith.
intros.
elim minus_S.
elim minus_S; apply H.
Qed.
Hint Resolve le_minus_n_Sn.
intros.
elim H; auto with arith.
intros.
apply le_trans with (m0 - p).
assumption.
apply le_minus_n_Sn.
Qed.
Hint Resolve le_reg_minus.
simple induction m; simple induction p.
elim plus_n_O; auto with arith.
elim plus_n_O; auto with arith.
auto with arith.
intros.
simpl in |- *.
apply H.
auto with arith.
apply lt_S_n.
replace (S (n + n0)) with (n + S n0).
auto with arith.
elim plus_comm; simpl in |- *; auto with arith.
Qed.
intros.
elim H.
rewrite minus_SS_n; auto with arith.
intros.
elim minus_Sn_m.
simpl in |- *.
auto with arith.
apply le_trans with (S (S n)); auto with arith.
Qed.
Hint Resolve lt_neq_O_pred.
simple induction n; auto with arith.
Qed.
Hint Resolve minus_Sn_n.

Lemma eq_minus_plus : forall n m : nat, m <= n -> n - m + m = n.