intro M. rewrite <- Zmod_minus_m. symmetry. apply modred; elim (M'ex M); tauto. exact lt02w. Qed.
(* <KEEP TOGETHER - d_n_r_n_def *)
Definition d_n := zero_in_Z_.
Definition r_n := zero_in_Z_.
(* KEEP TOGETHER> *)
Definition MultiRed (M_in_Z_ : Z_ (2 ^ w)) (ptM'cM'' : Z_ w * Z_ w * Z_ (2 ^ w) * Z_ (2 ^ w) * Z_ (2 ^ w))
(n : nat) (x : Z_ (2 ^ (Z_of_nat n * w))) :=
g' M_in_Z_ ptM'cM'' (foldlz x (f' M_in_Z_ ptM'cM'') (d_n, r_n) n).
(* <KEEP TOGETHER - C'def *)
Definition C' (M : Mset) :=
( C M,
exist (in_Z_ (2 ^ w)) (2 ^ Zlog_sup M)                             (cex M),
exist (in_Z_ (2 ^ w)) (2 ^ (w - Zlog_sup M - 1 / M) * M mod 2 ^ w) (M''ex M)).
(* KEEP TOGETHER> *)

(* Specifications: *)
(* <KEEP TOGETHER - multired_equality *)
Theorem MultiRed_eq : forall (M : Mset) (n : nat) (x : Z_ (2 ^ (Z_of_nat n * w))),
_Z (MultiRed M (C' M) n x) = x mod M.