(** * Logic Predicates *)

Definition eq := @Logic.eq Z.Definition eq_equiv := @eq_equivalence Z.Notation "x <= y <= z" := (x <= y /\ y <= z) : Z_scope.Notation "x <= y < z" := (x <= y /\ y < z) : Z_scope.Notation "x < y < z" := (x < y /\ y < z) : Z_scope.Notation "x < y <= z" := (x < y /\ y <= z) : Z_scope.Definition divide x y := exists z, y = z*x.Notation "( x | y )" := (divide x y) (at level 0).Definition Even a := exists b, a = 2*b.Definition Odd a := exists b, a = 2*b+1.(** * Decidability of equality. *)

Definition eq_dec (x y : Z) : {x = y} + {x <> y}.Program Definition succ_wd : Proper (eq==>eq) succ := _.Program Definition pred_wd : Proper (eq==>eq) pred := _.Program Definition opp_wd : Proper (eq==>eq) opp := _.Program Definition add_wd : Proper (eq==>eq==>eq) add := _.Program Definition sub_wd : Proper (eq==>eq==>eq) sub := _.Program Definition mul_wd : Proper (eq==>eq==>eq) mul := _.Program Definition lt_wd : Proper (eq==>eq==>iff) lt := _.Program Definition div_wd : Proper (eq==>eq==>eq) div := _.Program Definition mod_wd : Proper (eq==>eq==>eq) modulo := _.Program Definition quot_wd : Proper (eq==>eq==>eq) quot := _.Program Definition rem_wd : Proper (eq==>eq==>eq) rem := _.Program Definition pow_wd : Proper (eq==>eq==>eq) pow := _.Program Definition testbit_wd : Proper (eq==>eq==>Logic.eq) testbit := _.

Lemma mul_add_distr_pos (p:positive) n m : (n + m) * pos p = n * pos p + m * pos p.