elim r'0_eq_1; intro H; rewrite H. left. apply modred. apply Zplus_le_0_compat. apply Zmod_le_0_z. omega. apply Zmod_le_0_z.
omega. rewrite Zpow_2_w_is_2Zpow_2_wm1. apply Zplus_lt_compat. apply Zlt_le_trans with M. apply Zmod_lt_z_m. omega. assumption.
apply Zlt_le_trans with M. apply Zmod_lt_z_m. omega. assumption. right. apply modred. apply Zplus_le_0_compat. apply Zmod_le_0_z.
omega. apply Zmod_le_0_z. omega. rewrite Zpow_2_w_is_2Zpow_2_wm1. apply Zplus_lt_compat. apply Zlt_le_trans with M.
apply Zmod_lt_z_m. omega. assumption. apply Zlt_le_trans with M. apply Zmod_lt_z_m. omega. assumption. Qed.

Lemma r'0_eq_5 : forall b : Z, ((b mod M + M) * 2 ^ w + l) mod M = (b * 2 ^ w + l) mod M.
intro b. rewrite Zmod_plus_distr_l. rewrite Zmod_mult_distr_l. replace (b mod M + M) with (b mod M + 1 * M). rewrite Z_mod_plus.