unfold r'0. unfold d0. unfold r0. fold r'_i. (* too long *)
elim (Zle_or_lt c r'_i); intro H. rewrite ltw_false. rewrite Z_from_minusw. fold M. rewrite modred. rewrite r'_i_eq.
cut (((h mod M * 2 ^ w + l) / 2 ^ p * 2 ^ p) mod M < M). cut ((h mod M * 2 ^ w + l) mod 2 ^ p < 2 ^ p). omega.
apply Zmod_lt_z_m. apply lt_0_Zpow. auto with a. apply Zmod_lt_z_m. omega. cut (M <= r'_i). omega.
apply Zle_trans with c. rewrite c_M. exact le_M_2pp. assumption. cut (0 <= M). cut (r'_i < 2 ^ w). omega. apply lt_z__Z.
omega. assumption. rewrite ltw_true. rewrite <- c_M. assumption. assumption. Qed.

(* Specifications: *)
(* <KE EP TOGETHER - r''0_eq *)
Lemma r''0_eq : _Z r''0 = x mod M \/ _Z r''0 = x mod M + M.
clear x_i_in_Z_ x_i s_i s'_i s''_i h'_i q_i q'_i y_i h'_i h'_i' x'.