simpl. do 2 rewrite div_1_id. rewrite Z_div_mult. rewrite Z_mod_same. replace (x' * 0) with 0. rewrite Zdiv_small_0. simpl.
unfold x'. symmetry. apply Zmod_km_plus. auto with a. omega. auto with a. ring. apply Zlt_gt. auto with a. apply Zlt_gt.
auto with a. assumption. assumption. Qed.

Lemma mod_ab_mod : forall z a b m : Z, 0 < m ->
z = a \/ z = b -> z mod m = a mod m \/ z mod m = b mod m.