Planning as tabled logic programming