Section Z_DIV_MUL.
Variable N: Z.      (**r number of relevant bits *)
Hypothesis N_pos: N >= 0.
Variable d: Z.      (**r divisor *)
Hypothesis d_pos: d > 0.
(** This is theorem 4.2 from Granlund and Montgomery, PLDI 1994. *)
(** This is theorem 5.1 from Granlund and Montgomery, PLDI 1994. *)
End Z_DIV_MUL.
(** * Correctness of the division parameters *)

Lemma divs_mul_params_sound:
forall d m p,
divs_mul_params d = Some(p, m) ->
0 <= m < Int.modulus /\ 0 <= p < 32 /\
forall n,
Int.min_signed <= n <= Int.max_signed ->
Z.quot n d = Z.div (m * n) (two_p (32 + p)) + (if zlt n 0 then 1 else 0).