Planning as Theorem Proving with Heuristics