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 le_0_mod_M : forall z : Z, 0 <= z mod M.
intro z. apply Zmod_le_0_z. omega. Qed.