CS195Y Lecture 20

3/13/2017


Simplifying Boolean Expressions

person implies likes cookies or like donuts
likes donuts implies likes cookies
want to prove person implies likes cookies
show unsat if we add: person not likes cookies
MP can derive: (likes cookies or likes donuts)

generally:
(x1 or not x2) and
(x1 or x2) and
(not x1 or x2) and
(not x1 or not x2)

What can we pull out here?
(x1 or not x2) and x2 => x1
(x1 or x2) and not x2 => x1
(not x1 or x2) and x1 => x2
(not x1 or not x2) x1 => not x2

Take the last two, what can we derive now?
x1 => x2 and not x2

Take the first and last ones, what can we derive now?
x2 => not x2

This means that in the expresion we need to have the clause (not x2 or not x2).
Thus we get a unit clause! (not x2)

The Resolution Rule

(l1, ..., ln, L) (ln+1, ..., lm, not L)
---------------------------------------
(l1, ..., ln, ln+1, ..., lm)

In words, we have two clauses that have a bunch of literals. In the first clause, we have some particular literal L. In the second clause, we have the same particular literal L but it's the negation of L. That means we can make a new clause out of all the literals in clause 1 minus L and all the literals in clause 2 minus not L. We call this new clause the resolvant. Any time you have two clauses with a the same literal and one has it regular and one has it negated you can use this rule!

Get ready for the full proof of this example!

If we finish resolving and we get the empty clause that means that the expression is unsatisfiable (inconsistant), if not it's satisfiable (consistant)
What if we wanted to chain on multiple literals at a time?
Disclaimer: do not try this at home! It doesn't work :(

x1 or x2 or x3 not x1 or not x2 or x4
---------------------------------------
x3 or x4

This doesn't work because:
not x3 => x1 or x2 not (not x1 or not x2) => x4
x1 and x2 => x4
does x or y imply x and y? No, not at all!

When you're implementing your resolution machine, make sure you're only ever resolving on one literal at a time.

Davis-Putnam Algorithm (DP)

input: a set of clauses
output: sat or unsat
pseudocode:
for each variable in input:
  for each c1 with x:
    for each c2 with (not x):
      add (c1, RES, c2) to NEW
      add c2 to REM<
    add c1 to REM
  remove REM from input
  add NEW to input
This is tragically slow. But it was a good idea back in the day (the 60's).

This week you'll be implementing a DPLL SAT solver in lab and resolution in next week's assignment!