Ltac npe_simpl := rewrite ?NPEmul_ok, ?NPEpow_ok, ?PEpow_mul_l.
Ltac npe_ring := intro l; simpl; ring.

Theorem isIn_ok e1 p1 e2 p2 :
match isIn e1 p1 e2 p2 with
| Some(n, e3) =>
let n' := ZtoN (Zpos p1 - NtoZ n) in
(e2 ^ N.pos p2 === e1 ^ n' * e3)%poly
/\ (Zpos p1 > NtoZ n)%Z
|  _ => True
end.