fold M. rewrite modred. cut (d_Si < 2 ^ p + M). cut (l mod 2 ^ p mod M < M). omega. apply Zmod_lt_z_m. omega.
apply Zlt_le_trans with (M + M). exact d_Si_small. apply Zplus_le_compat. exact le_M_2pp. omega.
cut (0 <= d_Si - M). cut (0 <= (l mod 2 ^ p) mod M). omega. apply Zmod_le_0_z. omega. cut (M <= d_Si). omega.
apply Zle_trans with (2 ^ p). exact le_M_2pp. omega. cut ((l mod 2 ^ p) mod M < M). cut (d_Si < 2 ^ w). omega. apply lt_z__Z.
apply Zmod_lt_z_m. omega. exact lt02w. assumption. rewrite ltw_true. rewrite r_Si_eq_lit. rewrite modred.
apply Zplus_lt_compat. apply Zlt_le_trans with c. assumption. omega. apply Zmod_lt_z_m. omega. apply Zplus_le_0_compat.
apply le_0__Z. apply Zmod_le_0_z. omega. rewrite Zpow_2_w_is_2Zpow_2_wm1. apply Zlt_le_trans with (c + M). apply Zplus_lt_compat.
assumption. apply Zmod_lt_z_m. omega. apply Zplus_le_compat. rewrite c_M. apply Zle_pow_le. auto with a. cut (p < w). omega.
auto with a. omega. assumption. Qed.
Let r'a := ltw r'_i c_in_Z_ r'_i (minusw r'_i M_in_Z_).

(* Specifications: *)
Lemma r'a_small : r'a < 2 ^ p.
unfold r'a. elim (Zle_or_lt c r'_i); intro H. rewrite ltw_false. simpl. fold M. rewrite modred. cut (r'_i < 2 ^ p + M).