case (eq_nat_dec b 0).
case (eq_nat_dec a 0);intros.
rewrite e;left;apply zero_max_div.
right;rewrite e;intro.
elim H;intro q;intro.
simpl in H0;apply n;trivial.
intro.
case (eq_nat_dec (remainder_euclide a b n) 0);[left | right];intros;elim (divides_euclide a b n);auto.
Qed.

(** if a property about integer is decidable then it is decidable if there is an integer less than n that satisfies this property *)
Lemma dec_impl_lt_dec : forall (P:nat->Prop),(forall (n:nat),{(P n)}+{~(P n)})->(forall (m:nat),{n:nat | (n<m)/\(P(n))}+{(forall (n:nat),(n<m)->~(P n))}).
intros.