Untitled
unknown
plain_text
4 years ago
537 B
10
Indexable
def clean(clause_set, partial_assignment):
for clause in clause_set:
for literal in partial_assignment:
negated_literal = -1 * literal
# If literal in clause, remove the clause
if literal in clause:
clause_set.remove(clause)
# If negated literal is in the clause, remove the negated literal
if negated_literal in clause:
clause.remove(negated_literal)
return clause_set
print(clean([[1], [1, -2], [-1, 2], [1, -2]], [1, -2]))Editor is loading...