Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
548 B
1
Indexable
Never
def clean(clause_set, partial_assignment):
    clause_set_copy = clause_set.copy()

    for clause in clause_set_copy:
        for literal in partial_assignment:
            negated_literal = -1 * literal

            # If literal in clause, remove the clause
            if literal in clause:
                clause_set.remove(clause)
                break

            # If negated literal is in the clause, remove the negated literal
            if negated_literal in clause:
                clause.remove(negated_literal)

    return clause_set