(* This program is free software; you can redistribute it and/or      *)
(* modify it under the terms of the GNU Lesser General Public License *)
(* as published by the Free Software Foundation; either version 2.1   *)
(* of the License, or (at your option) any later version.             *)
(*                                                                    *)
(* This program is distributed in the hope that it will be useful,    *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of     *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *)
(* GNU General Public License for more details.                       *)
(*                                                                    *)
(* You should have received a copy of the GNU Lesser General Public   *)
(* License along with this program; if not, write to the Free         *)
(* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *)
(* 02110-1301 USA                                                     *)
(** divides. The division predicate.  @author Olga Caprotti and Martijn Oostdijk @version $Revision$ *)
(** * Division on nat *)
Definition Divides (n m : nat) : Prop := exists q : nat, m = n * q.
(** Divides with bounded ex quantifier. *)
Definition bDivides (d n : nat) :=
n = 0 \/ (exists q : nat, q < S n /\ n = d * q).
(** Divides is decidable. *)
(** If d|n, then either d<sqrt(n) or the other divisor x<sqrt(n). *)
(** Division with remainder. *)
(** Compatibility results. *)
(** * Division on Z. *)
Definition ZDivides (x y : Z) : Prop := exists q : Z, y = (x * q)%Z.

Lemma zdivdiv :
forall a b : Z, ZDivides a b -> Divides (Z.abs_nat a) (Z.abs_nat b).