Deriving a Correct Logic Program from the Formal Specification of a Non-Linear Planner