propositional-logic sat-solving
Definition
Davis–Putnam–Logemann–Loveland Algorithm
The DPLL algorithm is a recursive decision procedure for the satisfiability of a set of clauses.
It is a refinement of the splitting algorithm that adds unit propagation at each recursive step before choosing a literal to branch on.
Procedure
Bool DPLL(Set Clause S)
S = unit_propagate(S);
if (S is empty) {
return satisfiable;
}
if (□ ∈ S) {
return unsatisfiable;
}
L = select_literal(S);
if (DPLL(S ∪ {L}) == satisfiable) {
return satisfiable;
}
return DPLL(S ∪ {¬L});
Explanation
Steps
- Propagate. Apply unit propagation to simplify as far as possible.
- Base cases.
- If becomes empty, every clause was satisfied: return satisfiable.
- If the empty clause appears, a contradiction was found: return unsatisfiable.
- Split. Choose an unassigned literal and try both branches recursively:
The choice of is determined by the
select_literalheuristic. Common heuristics include choosing a literal that appears most frequently, or one that occurs in the shortest clause.
Optimisations
Tautology Removal
Any clause is a tautology. Tautologies can be removed.
Pure Literal Removal
Definition
Link to originalPure Atom Property
All clauses containing a pure literal can be satisfied by assigning a suitable truth value to the variable of this literal.
Hence, clauses containing pure literals can be removed too.
Examples
Unsatisfiable set of clauses
Consider the set of clauses
There are no unit clauses, so DPLL must branch. Choose literal .
Left branch — assume .
Adding the unit clause and applying unit propagation:
- and are satisfied and removed;
- simplifies to ;
- simplifies to .
The set becomes . Now is a unit clause, so propagation with removes and replaces by the empty clause . Hence the left branch is unsatisfiable.
Right branch — assume .
Adding the unit clause and applying unit propagation:
- and are satisfied and removed;
- simplifies to ;
- simplifies to .
The set becomes . As in the left branch, propagation yields the empty clause . Hence the right branch is also unsatisfiable.
Since both branches end in the empty clause, the original set is unsatisfiable.
Satisfiable set of clauses
Consider the set of clauses
There are no unit clauses, so DPLL branches on literal .
Left branch — assume .
Adding the unit clause and applying unit propagation:
- simplifies to ;
- simplifies to ;
- is satisfied and removed.
The set becomes . Propagation with removes and replaces by the empty clause . The left branch is unsatisfiable.
Right branch — assume .
Adding the unit clause and applying unit propagation:
- and are satisfied and removed;
- simplifies to .
The set becomes . Propagation with empties the set. The right branch is satisfiable.
The model is obtained from the successful branch: we selected and unit propagation derived . Hence
satisfies the original set .
