Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
480 B
1
Indexable
Never
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