def apply(self, goal, x, y, auto_remove=True): info = dict(goal=goal, x=x, y=y) if x: ta.arg_add_facts(goal.node, y) removed = [] removed_str = [] if auto_remove: g = goal while g is not None and ta.refuted_goal(g): removed.append(g) removed_str.append(str(g)) ta.remove_goal(g) g = g.parent info['removed'] = removed if g is not None: info['active'] = g else: info['active'] = goal.node info['msg'] = dedent(""" Learned new fact at arg node {}: {} Removed goals: {} """).strip().format( goal.node.id, y, ', '.join(removed_str), ) else: ta.push_goal(y) info['active'] = y info['msg'] = dedent(""" No refinement for goal {}, pushed new goal {} """).strip().format(goal, y) self.step(**info) return x
def apply(self, goal): if ta.refuted_goal(goal): ta.remove_goal(goal) self.step(goal=goal, active=ta.top_goal()) return True else: return False
def apply(self, goal): ta.remove_goal(goal) self.step(goal=goal, active=ta.top_goal()) return True