(* KEEP TOGETHER> *)
rewrite H0 in H. absurd (M <= x mod M). apply Zlt_not_le. apply Zmod_lt_z_m. omega. assumption. intro H0; elim H0; intro H1.
rewrite H1. left. ring. rewrite H1. right. ring. omega. apply Zle_lt_trans with (_Z r'). omega. apply lt_z__Z. fold M.
assumption. rewrite ltw_true. elim r'_x. tauto. intro H0; elim H0; intro H1. tauto. absurd (x mod M + M + M < M).
apply Zle_not_lt. cut (0 <= x mod M). omega. apply Zmod_le_0_z. omega. rewrite <- H1. assumption. fold M. assumption. Qed.

(* Specifications: *)
(* <KEEP TOGETHER - r'''_eq *)
Lemma r'''_eq : _Z r''' = x mod M.
unfold r'''. elim r''_eq; intro H. rewrite ltw_true. assumption. rewrite H. fold M. apply Zmod_lt_z_m.