(*****************************************************)
(**                Division by 2                     *)

Definition half_aux (x : N.t) : N.t * N.t :=
  recursion (0, 0) (fun _ p => let (x1, x2) := p in (S x2, x1)) x.Definition half (x : N.t) := snd (half_aux x).#[global]
Instance half_aux_wd : Proper (N.eq ==> N.eq*N.eq) half_aux.#[global]
Instance half_wd : Proper (N.eq==>N.eq) half.

Theorem half_aux_spec : forall n, n == fst (half_aux n) + snd (half_aux n).