Notation Zeven_bool_succ := Z.even_succ (only parsing).
Notation Zeven_bool_pred := Z.even_pred (only parsing).
Notation Zodd_bool_succ := Z.odd_succ (only parsing).
Notation Zodd_bool_pred := Z.odd_pred (only parsing).
(******************************************************************)
(** * Definition of [Z.quot2], [Z.div2] and properties wrt [Zeven] and [Zodd] *)
(** Properties of [Z.div2] *)

(* Specifications: *)
Lemma Zdiv2_odd_eqn n : n = 2*(Z.div2 n) + if Z.odd n then 1 else 0.
Proof (Z.div2_odd n).
Lemma Zeven_div2 n : Zeven n -> n = 2 * Z.div2 n.
Lemma Zodd_div2 n : Zodd n -> n = 2 * Z.div2 n + 1.
(** Properties of [Z.quot2] *)
(** TODO: move to Numbers someday *)
Lemma Zquot2_odd_eqn n : n = 2*(Z.quot2 n) + if Z.odd n then Z.sgn n else 0.
Lemma Zeven_quot2 n : Zeven n -> n = 2 * Z.quot2 n.
Lemma Zodd_quot2 n : n >= 0 -> Zodd n -> n = 2 * Z.quot2 n + 1.
Lemma Zodd_quot2_neg n : n <= 0 -> Zodd n -> n = 2 * Z.quot2 n - 1.
Lemma Zquot2_opp n : Z.quot2 (-n) = - Z.quot2 n.
Lemma Zquot2_quot n : Z.quot2 n = n ÷ 2.
(** More properties of parity *)
Lemma Z_modulo_2 n : {y | n = 2 * y} + {y | n = 2 * y + 1}.
Lemma Zsplit2 n :
{p : Z * Z | let (x1, x2) := p in n = x1 + x2 /\ (x1 = x2 \/ x2 = x1 + 1)}.
Theorem Zeven_ex n : Zeven n -> exists m, n = 2 * m.
Theorem Zodd_ex n : Zodd n -> exists m, n = 2 * m + 1.
Theorem Zeven_2p p : Zeven (2 * p).
Theorem Zodd_2p_plus_1 p : Zodd (2 * p + 1).
Theorem Zeven_plus_Zodd a b : Zeven a -> Zodd b -> Zodd (a + b).
Theorem Zeven_plus_Zeven a b : Zeven a -> Zeven b -> Zeven (a + b).
Theorem Zodd_plus_Zeven a b : Zodd a -> Zeven b -> Zodd (a + b).
Theorem Zodd_plus_Zodd a b : Zodd a -> Zodd b -> Zeven (a + b).
Theorem Zeven_mult_Zeven_l a b : Zeven a -> Zeven (a * b).
Theorem Zeven_mult_Zeven_r a b : Zeven b -> Zeven (a * b).
Theorem Zodd_mult_Zodd a b : Zodd a -> Zodd b -> Zodd (a * b).