intuition.
unfold modNat in *.
assert (p > 0)%nat.
eapply posnat_pos.
assert (posnatToNat p <> 0)%nat.
omega.
assert (N.of_nat p <> 0%N).
intuition.
eapply H0.
rewrite <- Nnat.Nat2N.id.
rewrite <- (Nnat.Nat2N.id p).
f_equal.
trivial.
exists (N.to_nat (N.of_nat x / N.of_nat p)).
rewrite N.mod_eq; trivial.
rewrite <- (Nnat.Nat2N.id p) at 2.
rewrite <- Nnat.N2Nat.inj_mul.
rewrite <- Nnat.N2Nat.inj_add.
rewrite N.mul_comm.
remember (N.of_nat p * (N.of_nat x / N.of_nat p)) as z.
rewrite N.add_sub_assoc.
rewrite N.add_comm.
rewrite N.add_sub.
rewrite Nnat.Nat2N.id.
trivial.
subst.
eapply N.mul_div_le.
trivial.
Qed.

Lemma modNat_divides : forall x p,
modNat x p = O ->
exists k, (x = k * p)%nat.