rewrite H1 in H0.
case (lt_eq_lt_dec q q');intro.
case s;intro.
rewrite (le_plus_minus q q') in H0;try (auto with arith).
rewrite mult_plus_distr_l in H0.
assert (b*(q'-q)+r' = r).
apply plus_reg_l with (b*q).
rewrite plus_assoc;trivial.
assert (0<(q'-q));try omega.
assert (b<=b*(q'-q));try omega.
case (mult_O_le b (q'-q));intro;try omega.
rewrite mult_comm;trivial.
split;try tauto.
rewrite <- e in H0.
symmetry;apply plus_reg_l with (b*q);trivial.
rewrite (le_plus_minus q' q) in H0;try (auto with arith).
rewrite mult_plus_distr_l in H0.
assert (r'=(b*(q-q')+r)).
apply plus_reg_l with (b*q').
rewrite plus_assoc;trivial.
assert (0<(q-q'));try omega.
assert (b<=b*(q-q'));try omega.
case (mult_O_le b (q-q'));intro;try omega.
rewrite mult_comm;trivial.
Qed.

(** if b<>0, then b | a iff a mod b = 0 *)
Lemma divides_euclide : forall (a b:nat)(H:(b<>O)),((divides a b)<->((remainder_euclide a b H)=O)).
intros.