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

  1. Propagate. Apply unit propagation to simplify as far as possible.
  2. Base cases.
  3. Split. Choose an unassigned literal and try both branches recursively:
    • first assume is true (add the unit clause );
    • if that fails, assume is false (add the unit clause ).

The choice of is determined by the select_literal heuristic. 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

Pure Atom Property

All clauses containing a pure literal can be satisfied by assigning a suitable truth value to the variable of this literal.

Link to original

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 .