Data structure repair using goal-directed reasoning