rewrite <- Zmod_minus_distr_l. rewrite H. cut (_Z d_Si = 1). intro H1. rewrite H1. rewrite mod_1_0. replace (1 + 0 - 1) with 0.
apply modred. omega. auto with a. ring. rewrite c_M in H0. rewrite p_M in H0. rewrite H in H0. simpl in H0. cut (d_Si < 2).
omega. elim d_Si_eq; intro H1. rewrite H1. apply Zlt_trans with M. apply Zmod_lt_z_m. omega. omega. elim H1; intro H2.
rewrite H2. rewrite H. rewrite mod_1_0. omega. elim H2; intro H3. rewrite H3. rewrite H. rewrite mod_1_0. omega. rewrite H3.
rewrite H. rewrite mod_1_0. omega. auto with a. assumption. cut (_Z d_Si = 0). intro H1. rewrite ltw_true. rewrite r_Si_eq_lit.
rewrite H1. rewrite H. rewrite mod_1_0. simpl. apply modred. omega. exact lt02w. rewrite H1. fold c. rewrite c_M.
auto with a. elim d_Si_eq; intro H1. rewrite H1. rewrite H. apply mod_1_0. rewrite c_M in H0. rewrite p_M in H0.
rewrite H in H0. simpl in H0. cut (0 <= d_Si). omega. apply le_0__Z. Qed.

Lemma M1_h_i_eq : M = 1 -> _Z h_i = 0.
intro H. unfold h_i. simpl. rewrite M1_r'_i_eq. fold t. replace (2 ^ t * 0) with 0. apply modred. omega. auto with a. ring.