(* KE EP TOGETHER> *)
rewrite q'_i_eq_pre. apply mod_ab_mod. auto with a.
cut (x' / 2 ^ p * (2 ^ p * 2 ^ w / M) / 2 ^ w = x' / 2 ^ p * 2 ^ p / M - 1 \/
x' / 2 ^ p * (2 ^ p * 2 ^ w / M) / 2 ^ w = x' / 2 ^ p * 2 ^ p / M).
rewrite Zpower_exp. tauto. apply Zle_ge. auto with a. apply Zle_ge. auto with a.
cut (x' / 2 ^ p * 2 ^ p / M - 1 <= x' / 2 ^ p * (2 ^ p * 2 ^ w / M) / 2 ^ w).
cut (x' / 2 ^ p * (2 ^ p * 2 ^ w / M) / 2 ^ w <= x' / 2 ^ p * 2 ^ p / M). intros H H0.
elim (Zle_lt_or_eq (x' / 2 ^ p * (2 ^ p * 2 ^ w / M) / 2 ^ w) (x' / 2 ^ p * 2 ^ p / M)). intro H1. left.
omega. intro H1. right. omega. assumption. apply approx_0_one. omega. auto with a. auto with a.
auto with a. apply approx_m1_one. auto with a. auto with a. omega. auto with a.
cut (x' < 2 ^ p * 2 ^ w). cut (0 < 2 ^ p). omega. auto with a. rewrite <- Zpower_exp. auto with a.
apply Zle_ge. auto with a. apply Zle_ge. auto with a. Qed.

(* <KE EP TOGETHER - y_i_eq *)
Lemma y_i_eq :
_Z y_i = x' / 2 ^ p * 2 ^ p / M * M mod 2 ^ w \/
_Z y_i = (x' / 2 ^ p * 2 ^ p / M * M - M) mod 2 ^ w.