Definition Z__from_Mset (M : Mset) := exist (in_Z_ (2 ^ w)) M (in_Z__if_in_Mset M).(* <KEEP TOGETHER - Cdef *)
Definition C (M : Mset) :=
      ( exist (in_Z_ w)       (Zlog_sup M)                       (pex M),
        exist (in_Z_ w)       (w - Zlog_sup M - 1 / M)           (tex M),
        exist (in_Z_ (2 ^ w)) (2 ^ (Zlog_sup M + w) / M - 2 ^ w) (M'ex M)).

Theorem ModRed_eq : forall (M : Mset) (x : Z_ (2 ^ (Zlog_sup M + w))), ModRed M (C M) (exist (in_Z_ (2 ^ w)) (x / 2 ^ w) (xhex M x)) (exist (in_Z_ (2 ^ w)) (x mod 2 ^ w) (xlex x)) = x mod M.