intro M. rewrite <- Zmod_minus_m. symmetry. apply modred; elim (M'ex M); tauto. exact lt02w. Qed.
(* <KE EP TOGETHER - d_n_r_n_def *)
Definition d_n := zero_in_Z_.
Definition r_n := zero_in_Z_.
(* KE EP TOGETHER> *)
Definition MultiRed (M : 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 (foldlz x (f' M ptM'cM'') (d_n, r_n) n).
(* <KE EP 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)).
(* KE EP TOGETHER> *)

(* <KE EP 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.