(* KE EP TOGETHER> *)
elim (Zle_lt_or_eq 1 M). intro H. elim q_i_eq_ch; intro H0. absurd (1 < M); omega. assumption. intro H. unfold q_i.
rewrite uhwm_eq. fold M'. rewrite M'_M. rewrite <- H. replace (2 ^ (p + w)) with (2 ^ (p + w) * 1). rewrite Z_div_mult.
rewrite Zpower_exp. rewrite Zmult_comm with (m := 2 ^ w). rewrite Zmod_mult_distr_l. rewrite Z_mod_same.
replace (0 * 2 ^ p) with 0. rewrite modred. replace (_Z h'_i * 0) with 0. replace (x' / 2 ^ p * 0) with 0. trivial. ring. ring.
omega. exact lt02w. ring. apply Zlt_gt. exact lt02w. exact lt02w. apply Zle_ge. auto with a. apply Zle_ge. auto with a. omega.
ring. omega. Qed.

Lemma q'_i_eq_pre_ch :
M = 1 \/ _Z q'_i = (x' / 2 ^ p * (2 ^ (p + w) / M) / 2 ^ w) mod 2 ^ w.