(* KE EP TOGETHER> *)
unfold y_i. rewrite Z_from_multw. fold M. elim q'_i_eq; intro H; rewrite H. left.
rewrite <- Zmod_mult_distr_l. trivial. auto with a. right. rewrite <- Zmod_mult_distr_l.
apply f_equal2 with (f := Zmod). ring. trivial. auto with a. Qed.

(* <KE EP TOGETHER - d_i_eq *)
Lemma d_i_eq :
_Z d_i = x' / 2 ^ p * 2 ^ p mod M \/
_Z d_i = x' / 2 ^ p * 2 ^ p mod M + M.