rewrite p_M. rewrite H. simpl. fold x_i. replace x_i with (x_i * 1). rewrite Z_div_mult. transitivity x_i. apply modred.
unfold x_i. apply le_0__Z. unfold x_i. apply lt_z__Z. ring. omega. ring. rewrite M1_r'_i_eq. fold c. rewrite c_M. auto with a.
assumption. assumption. Qed.

Lemma lt_plus_M_2p_2w : forall a b : Z, a mod M + b mod 2 ^ p < 2 ^ w.
intros a b. rewrite Zpow_2_w_is_2Zpow_2_wm1. apply Zplus_lt_compat. apply Zlt_le_trans with M. apply Zmod_lt_z_m. omega.