def __backward_chaining_and(kb, goals, theta): if theta is problem.FAILURE: return problem.FAILURE if len(goals) == 0: return theta for goal in goals: theta = __backward_chaining_or(kb, substitute(goal, theta), theta) return theta
def __standardize_resolvent(resolvent, theta): replacer = StandartizationReplacer("x") result = set() for index, disjunct in enumerate(resolvent): # Do we need standartization? No, we don't result.add(substitute(disjunct, theta)) StandartizationReplacer.GlobalIndex = replacer.index resolvent = frozenset(result) return resolvent