unfold modNat.
assert (N.of_nat x mod N.of_nat p < N.of_nat p)%N.
apply N.mod_bound_pos.
apply of_nat_ge_0.
apply of_posnat_gt_0.
specialize (Nnat.N2Nat.inj_compare); intuition.
rewrite <- (Nnat.Nat2N.id p) at 2.
apply nat_compare_lt.
rewrite <- H0.
apply N.compare_lt_iff.
trivial.
Qed.

(* Specifications: *)
Lemma modNat_eq : forall (n : posnat) x, (x < n -> modNat x n = x)%nat.
intuition.