let p_exists x p = if p_hasvar [x] p then Pexists(x,p) else p