unfold q'. rewrite Z_from_plusw. rewrite q_eq. rewrite h'_eq. rewrite Zplus_comm.
rewrite <- Zdiv_times_plus. rewrite <- Zmult_plus_distr_r. rewrite large_M'_eq. trivial. auto with a. 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.