SLIDE 1 Foundations and Theoretical Aspects
- f Propositional Satisfiability
John Franco franco@gauss.ececs.uc.edu
presentation to
SMT/SAT Summer School 2012
June, 2012
SLIDE 2
Outline
Objective:
Illuminate aspects of SAT resulting in hard/easy sub-classes Show worst/average case performance of some algorithms
Discussion:
Review various representations of Boolean functions Review some important operations within those representations Some algorithms have exponential time on some classes Modifications that may lead to polynomial time solutions Compare different operations Probabilistic analysis to show how algorithms get “stuck,” identify hard problems, measure “size” of easy classes, and suggest new algorithms that may be counter-intuitive Bounds on complexity
SLIDE 3 A Boolean Function
v0 v1 v2 v3 v4 f 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
mapping of {0, 1}n to {0, 1} Shown to the left is a truth table Values in a row to the left of | are an input assignment The value to the right of | in a row is the value of the function for that input assignment
SLIDE 4
Terms and Connectives
A variable looks like this: v9, takes a value from {0, 1} A positive literal: v9, a negative literal: v9
Boolean OR: vx ∨ vy = 1 iff vx = 1 or vy = 1 Boolean AND: vx ∧ vy = 1 iff both vx = 1 and vy = 1 Boolean XOR: vx ⊕ vy = 1 iff one of vx, vy has value 1
A clause looks like this: (v1 ∨ v2 ∨ v5 ∨ v9) An instance of SAT looks like this (CNF):
(v1 ∨ v2 ∨ v7) ∧ (v2 ∨ v6) ∧ (v2 ∨ v4 ∨ v5) ∧ (v10)...
Clause width: # literals; k-SAT: fixed width k An assignment of values satisfying ψ is a model for ψ
SLIDE 5 Shannon’s Expansion
At the dawn of the information age:
f(v1, v2, . . . , xn) = (v1 ∧ f(1, v2, . . . , vn)) ∨ (v1 ∧ f(0, v2, . . . , vn)) f(v1, v2, . . . , xn) = (v1 ∨ f(1, v2, . . . , vn)) ∧ (v1 ∨ f(0, v2, . . . , vn))
normal forms:
f(v1, v2, ..., vn) = (f(0, 0, ..., 0) ∧ v1 ∧ v2 ∧ ... ∧ vn) ∨
DNF
(f(1, 0, ..., 0) ∧ v1 ∧ v2 ∧ ... ∧ vn) ∨ (f(0, 1, ..., 0) ∧ v1 ∧ v2 ∧ ... ∧ vn) ∨
...
(f(1, 1, ..., 1) ∧ v1 ∧ v2 ∧ ... ∧ vn) f(v1, v2, ..., vn) = (f(0, 0, ..., 0) ∨ v1 ∨ v2 ∨ . . . ∨ vn) ∧
CNF
(f(1, 0, ..., 0) ∨ v1 ∨ v2 ∨ . . . ∨ vn) ∧
...
(f(1, 1, ..., 1) ∨ v1 ∨ v2 ∨ . . . ∨ vn)
SLIDE 6 CNF and DNF Representations
v0 v1 v2 v3 v4 f 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
DNF:
(v0 ∧ v1 ∧ v2 ∧ v3 ∧ v4) ∨ (v0 ∧ v1 ∧ v2 ∧ v3 ∧ v4) ∨ (v0 ∧ v1 ∧ v2 ∧ v3 ∧ v4) ∨ (v0 ∧ v1 ∧ v2 ∧ v3 ∧ v4) ∨ . . . (v0 ∧ v1 ∧ v2 ∧ v3 ∧ v4)
CNF:
(v0 ∨ v1 ∨ v2 ∨ v3 ∨ v4) ∧ (v0 ∨ v1 ∨ v2 ∨ v3 ∨ v4) ∧ (v0 ∨ v1 ∨ v2 ∨ v3 ∨ v4) ∧ (v0 ∨ v1 ∨ v2 ∨ v3 ∨ v4) ∧ . . . (v0 ∨ v1 ∨ v2 ∨ v3 ∨ v4)
SLIDE 7 Resolution/Consensus
Resolution (CNF):
(v1 ∨ v2 ∨ vi) (v1 ∨ v3 ∨ vi)
❍❍❍❍❍ ❥ ✟ ✟ ✟ ✟ ✟ ✙ If resolvent = ∅: formula is unsatisfiable. If cannot generate ∅: formula is satisfiable.
(v1 ∨ v2 ∨ v3)
Consensus (DNF):
(v1 ∧ v2 ∧ vi) (v1 ∧ v3 ∧ vi)
❍❍❍❍❍ ❥ ✟ ✟ ✟ ✟ ✟ ✙ DNF is not minimized until consensus is no longer possible
(v1 ∧ v2 ∧ v3)
Subsumption:
DNF:
(v1 ∧ v2)
subsumes
(v1 ∧ v2 ∧ v3 ∧ v4)
CNF:
(v1 ∨ v2)
subsumes
(v1 ∨ v2 ∨ v3 ∨ v4)
SLIDE 8 Reduced CNF and DNF Representations
v0 v1 v2 v3 v4 f 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
DNF:
(v1 ∧ v2) ∨ (v3 ∧ v4) ∨ (v0 ∧ v2) ∨ (v2 ∧ v4)
CNF:
(v0 ∨ v1 ∨ v4) ∧ (v0 ∨ v2 ∨ v3) ∧ (v1 ∨ v2 ∨ v3) ∧ (v2 ∨ v4)
SLIDE 9 Linear Time Translation to CNF
Ox Equivalent CNF Expression Comment 0000 (vx) vx ⇔ 0 1111 (vx) vx ⇔ 1 0011 (vl ∨ vx) ∧ (vl ∨ vx) 1100 (vl ∨ vx) ∧ (vl ∨ vx) vx ⇔ (vl) 0101 (vr ∨ vx) ∧ (vr ∨ vx) 1010 (vr ∨ vx) ∧ (vr ∨ vx) vx ⇔ (vr) 0001 (vl ∨ vx) ∧ (vr ∨ vx) ∧ (vl ∨ vr ∨ vx) vx ⇔ (vl ∧ vr) 1110 (vl ∨ vx) ∧ (vr ∨ vx) ∧ (vl ∨ vr ∨ vx) 0010 (vl ∨ vx) ∧ (vr ∨ vx) ∧ (vl ∨ vr ∨ vx) 1101 (vl ∨ vx) ∧ (vr ∨ vx) ∧ (vl ∨ vr ∨ vx) vx ⇔ (vl → vr) 0100 (vl ∨ vx) ∧ (vr ∨ vx) ∧ (vl ∨ vr ∨ vx) 1011 (vl ∨ vx) ∧ (vr ∨ vx) ∧ (vl ∨ vr ∨ vx) vx ⇔ (vl ← vr) 1000 (vl ∨ vx) ∧ (vr ∨ vx) ∧ (vl ∨ vr ∨ vx) 0111 (vl ∨ vx) ∧ (vr ∨ vx) ∧ (vl ∨ vr ∨ vx) vx ⇔ (vl ∨ vr) 1001 (vl ∨ vr ∨ vx) ∧ (vl ∨ vr ∨ vx) ∧ (vl ∨ vr ∨ vx) ∧ (vl ∨ vr ∨ vx) vx ⇔ (vl ⇔ vr) 0110 (vl ∨ vr ∨ vx) ∧ (vl ∨ vr ∨ vx) ∧ (vl ∨ vr ∨ vx) ∧ (vl ∨ vr ∨ vx) vx ⇔ (vl ⊕ vr) CNF expressions equivalent to vx ⇔ (vl Ox vr) for Ox as shown
SLIDE 10 Linear Time Translation to CNF
Example:
(v1 ∧ v2) ∨ (v3 ∨ v4) ∨ (v0 ∧ v2) ∨ (v2 ∧ v4)
Translation: (to obtain equi-satisfiable CNF formula)
❅ ❅
❅ ❅
❅ ❅ t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝
∨ ∨ ∨ (v1 ∧ v2) (v3 ∧ v4) (v0 ∧ v2) (v2 ∧ v4)
SLIDE 11 Linear Time Translation to CNF
Example:
(v1 ∧ v2) ∨ (v3 ∨ v4) ∨ (v0 ∧ v2) ∨ (v2 ∧ v4)
Translation: (to obtain equi-satisfiable CNF formula)
❅ ❅
❅ ❅
❅ ❅ t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝
∨ ∨ ∨ (v1 ∧ v2) (v3 ∧ v4) va vb (v0 ∨ va) ∧ (v2 ∨ va) ∧ (v0 ∨ v2 ∨ va) ∧ (v2 ∨ vb) ∧ (v4 ∨ vb) ∧ (v2 ∨ v4 ∨ vb)
SLIDE 12 Linear Time Translation to CNF
Example:
(v1 ∧ v2) ∨ (v3 ∨ v4) ∨ (v0 ∧ v2) ∨ (v2 ∧ v4)
Translation: (to obtain equi-satisfiable CNF formula)
❅ ❅
❅ ❅ t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝
∨ ∨ (v1 ∧ v2) (v3 ∧ v4) vc (v0 ∨ va) ∧ (v2 ∨ va) ∧ (v0 ∨ v2 ∨ va) ∧ (v2 ∨ vb) ∧ (v4 ∨ vb) ∧ (v2 ∨ v4 ∨ vb) ∧ (va ∨ vc) ∧ (vb ∨ vc) ∧ (va ∨ vb ∨ vc)
SLIDE 13 Linear Time Translation to CNF
Example:
(v1 ∧ v2) ∨ (v3 ∨ v4) ∨ (v0 ∧ v2) ∨ (v2 ∧ v4)
Translation: (to obtain equi-satisfiable CNF formula)
❅ ❅
❅ ❅ t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝
∨ ∨ (v1 ∧ v2) vd vc (v0 ∨ va) ∧ (v2 ∨ va) ∧ (v0 ∨ v2 ∨ va) ∧ (v2 ∨ vb) ∧ (v4 ∨ vb) ∧ (v2 ∨ v4 ∨ vb) ∧ (va ∨ vc) ∧ (vb ∨ vc) ∧ (va ∨ vb ∨ vc) ∧ (v3 ∨ vd) ∧ (v4 ∨ vd) ∧ (v3 ∨ v4 ∨ vd)
SLIDE 14 Linear Time Translation to CNF
Example:
(v1 ∧ v2) ∨ (v3 ∨ v4) ∨ (v0 ∧ v2) ∨ (v2 ∧ v4)
Translation: (to obtain equi-satisfiable CNF formula)
❅ ❅ t ❞ ❝ t ❞ ❝ t ❞ ❝
∨ (v1 ∧ v2) ve (v0 ∨ va) ∧ (v2 ∨ va) ∧ (v0 ∨ v2 ∨ va) ∧ (v2 ∨ vb) ∧ (v4 ∨ vb) ∧ (v2 ∨ v4 ∨ vb) ∧ (va ∨ vc) ∧ (vb ∨ vc) ∧ (va ∨ vb ∨ vc) ∧ (v3 ∨ vd) ∧ (v4 ∨ vd) ∧ (v3 ∨ v4 ∨ vd) ∧ (vd ∨ ve) ∧ (vc ∨ ve) ∧ (vd ∨ vc ∨ ve)
SLIDE 15 Linear Time Translation to CNF
Example:
(v1 ∧ v2) ∨ (v3 ∨ v4) ∨ (v0 ∧ v2) ∨ (v2 ∧ v4)
Translation: (to obtain equi-satisfiable CNF formula)
❅ ❅ t ❞ ❝ t ❞ ❝ t ❞ ❝
∨ vf ve (v0 ∨ va) ∧ (v2 ∨ va) ∧ (v0 ∨ v2 ∨ va) ∧ (v2 ∨ vb) ∧ (v4 ∨ vb) ∧ (v2 ∨ v4 ∨ vb) ∧ (va ∨ vc) ∧ (vb ∨ vc) ∧ (va ∨ vb ∨ vc) ∧ (v3 ∨ vd) ∧ (v4 ∨ vd) ∧ (v3 ∨ v4 ∨ vd) ∧ (vd ∨ ve) ∧ (vc ∨ ve) ∧ (vd ∨ vc ∨ ve) ∧ (v1 ∨ vf) ∧ (v2 ∨ vf) ∧ (v1 ∨ v2 ∨ vf)
SLIDE 16 Linear Time Translation to CNF
Example:
(v1 ∧ v2) ∨ (v3 ∨ v4) ∨ (v0 ∧ v2) ∨ (v2 ∧ v4)
Translation: (to obtain equi-satisfiable CNF formula)
t ❞ ❝
vg (v0 ∨ va) ∧ (v2 ∨ va) ∧ (v0 ∨ v2 ∨ va) ∧ (v2 ∨ vb) ∧ (v4 ∨ vb) ∧ (v2 ∨ v4 ∨ vb) ∧ (va ∨ vc) ∧ (vb ∨ vc) ∧ (va ∨ vb ∨ vc) ∧ (v3 ∨ vd) ∧ (v4 ∨ vd) ∧ (v3 ∨ v4 ∨ vd) ∧ (vd ∨ ve) ∧ (vc ∨ ve) ∧ (vd ∨ vc ∨ ve) ∧ (v1 ∨ vf) ∧ (v2 ∨ vf) ∧ (v1 ∨ v2 ∨ vf) ∧ (vf ∨ vg) ∧ (ve ∨ vg) ∧ (vf ∨ ve ∨ vg)
SLIDE 17 Linear Time Translation to CNF
Example:
(v1 ∧ v2) ∨ (v3 ∨ v4) ∨ (v0 ∧ v2) ∨ (v2 ∧ v4)
Translation: (to obtain equi-satisfiable CNF formula)
(v0 ∨ va) ∧ (v2 ∨ va) ∧ (v0 ∨ v2 ∨ va) ∧ (v2 ∨ vb) ∧ (v4 ∨ vb) ∧ (v2 ∨ v4 ∨ vb) ∧ (va ∨ vc) ∧ (vb ∨ vc) ∧ (va ∨ vb ∨ vc) ∧ (v3 ∨ vd) ∧ (v4 ∨ vd) ∧ (v3 ∨ v4 ∨ vd) ∧ (vd ∨ ve) ∧ (vc ∨ ve) ∧ (vd ∨ vc ∨ ve) ∧ (v1 ∨ vf) ∧ (v2 ∨ vf) ∧ (v1 ∨ v2 ∨ vf) ∧ (vf ∨ vg) ∧ (ve ∨ vg) ∧ (vf ∨ ve ∨ vg) ∧ (vg)
SLIDE 18 Linear Time Translation to CNF
Example:
v0 ⇔ ((v0 ⇔ (v1 ∨ v2)) ∧ (v1 ∨ v2) ∧ (v2 → v3 → v4))
Parse DAG:
❅ ❅
❅ ❅ ❅
❅ ❅
❅ ❅
❅ ❅
❅ ❅
❅ ❅ t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝
⇔ v0 ∧ ⇔ v0 ∨ v1 v2 ∧ v1 ∨ → v2 → v4 v3
SLIDE 19 Linear Time Translation to CNF
Example:
v0 ⇔ ((v0 ⇔ (v1 ∨ v2)) ∧ (v1 ∨ v2) ∧ (v2 → v3 → v4))
Translation: (to obtain equi-satisfiable CNF formula)
(v0 ∨ vx1) ∧ (v0 ∨ vx1) ∧ (v2 ∨ vx2) ∧ (v2 ∨ vx2) ∧ (v3 ∨ vx3) ∧ (v3 ∨ vx3) ∧ (v1 ∨ vx4) ∧ (vx2 ∨ vx4) ∧ (v1 ∨ vx2 ∨ vx4) ∧ (vx3 ∨ vx5) ∧ (v4 ∨ vx5) ∧ (vx3 ∨ v4 ∨ vx5) ∧ (vx1 ∨ vx4 ∨ vx6) ∧ (vx1 ∨ vx4 ∨ vx6) ∧ (vx1 ∨ vx4 ∨ vx6) ∧ (vx1 ∨ vx4 ∨ vx6) ∧ (vx2 ∨ vx7) ∧ (vx5 ∨ vx7) ∧ (vx2 ∨ vx5 ∨ vx7) ∧ (vx4 ∨ vx8) ∧ (vx7 ∨ vx8) ∧ (vx4 ∨ vx7 ∨ vx8) ∧ (vx6 ∨ vx9) ∧ (vx8 ∨ vx9) ∧ (vx6 ∨ vx8 ∨ vx9) ∧ (v0 ∨ vx9 ∨ vx10) ∧ (v0 ∨ vx9 ∨ vx10) ∧ (v0 ∨ vx9 ∨ vx10) ∧ (v0 ∨ vx9 ∨ vx10) ∧ (vx10)
SLIDE 20 Regular Resolution
Davis-Putnam (CNF):
(v1 ∨ v2 ∨ vi) ∧ (vi ∨ v3) ∧ (v2 ∨ v4) ∧ (v1 ∨ vi) ∧ (vi ∨ v3)
collect all resolvents with vi:
(v1 ∨ v2 ∨ vi) ∧ (vi ∨ v3) ∧ (v2 ∨ v4) ∧ (v1 ∨ vi) ∧ (vi ∨ v3)∧ (v1 ∨ v2 ∨ v3) ∧ (v3) ∧ (v1 ∨ v3)
remove all clauses with vi:
(v2 ∨ v4) ∧ (v1 ∨ v2 ∨ v3) ∧ (v3) ∧ (v1 ∨ v3)
SLIDE 21 A Search Procedure
Davis-Putnam-Loveland-Logemann (CNF):
splitting rule: ❍❍❍❍❍ t ❞ ❝ t ❞ ❝ t ❞ ❝
(v1 ∨ v2 ∨ vi) ∧ (vi ∨ v3) ∧ (v2 ∨ v4) vi (v3) ∧ (v2 ∨ v4) (v1 ∨ v2) ∧ (v2 ∨ v4)
unit clause rule: pure literal rule: ✟ ✟ ✟ ✟ ✟ t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝
(v1 ∨ v2 ∨ vi) ∧ (vi).. (v1 ∨ vi) ∧ (v2 ∨ vi) ∧ (v3 ∨ v4).. vi vi (v1 ∨ v2).. (v3 ∨ v4)..
SLIDE 22 DPLL Refutation
❅ ❅ ❅ ❅ ❅ ❅ ❅ ❅ ❅ ❍❍❍❍ ❍ ❅ ❅ ❅ ❅ ❅ ❅ ❍❍❍❍ ❍ ❅ ❅ ❅ ❅ ❅ ❅ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ v1 v2 v5 v3 v4 v4 v5 v3 v5
(v1 ∨ v2 ∨ v5) ∧ (v3 ∨ v4 ∨ v5) ∧ (v1 ∨ v2 ∨ v4) ∧ (v1 ∨ v3 ∨ v5) ∧ (v1 ∨ v2) ∧ (v3 ∨ v4 ∨ v5) ∧ (v1 ∨ v4 ∨ v5) ∧ (v1 ∨ v5)
SLIDE 23 DPLL Refutation
❅ ❅ ❅ ❅ ❅ ❅ ❅ ❅ ❅ ❍❍❍❍ ❍ ❅ ❅ ❅ ❅ ❅ ❅ ❍❍❍❍ ❍ ❅ ❅ ❅ ❅ ❅ ❅ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ v1 v2 v5 v3 v4 v4 v5 v3 v5 (v1 ∨ v2 ∨ v5)
(v1 ∨ v2 ∨ v5) ∧ (v3 ∨ v4 ∨ v5) ∧ (v1 ∨ v2 ∨ v4) ∧ (v1 ∨ v3 ∨ v5) ∧ (v1 ∨ v2) ∧ (v3 ∨ v4 ∨ v5) ∧ (v1 ∨ v4 ∨ v5) ∧ (v1 ∨ v5)
SLIDE 24 DPLL is Resolution
❅ ❅ ❅ ❅ ❅ ❅ ❅ ❅ ❅ ❍❍❍❍ ❍ ❅ ❅ ❅ ❅ ❅ ❅ ❍❍❍❍ ❍ ❅ ❅ ❅ ❅ ❅ ❅ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ v1 v2 v5 v3 v4 v4 v5 v3 v5 (v1 ∨ v2 ∨ v5) (v3 ∨ v4 ∨ v5) (v1 ∨ v2 ∨ v4) (v1 ∨ v3 ∨ v5) (v3 ∨ v4 ∨ v5) (v1 ∨ v4 ∨ v5) (v1 ∨ v5) (v1 ∨ v2) ✻ ✻ ❅ ❅
(v1 ∨ v2 ∨ v5) ∧ (v3 ∨ v4 ∨ v5) ∧ (v1 ∨ v2 ∨ v4) ∧ (v1 ∨ v3 ∨ v5) ∧ (v1 ∨ v2) ∧ (v3 ∨ v4 ∨ v5) ∧ (v1 ∨ v4 ∨ v5) ∧ (v1 ∨ v5)
SLIDE 25 DPLL is Resolution
❅ ❅ ❅ ❅ ❅ ❅ ❅ ❅ ❅ ❍❍❍❍ ❍ ❅ ❅ ❅ ❅ ❅ ❅ ❍❍❍❍ ❍ ❅ ❅ ❅ ❅ ❅ ❅ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ s ❝ v1 v2 v5 v3 v4 v4 v5 v3 v5 (v1 ∨ v2 ∨ v5) (v3 ∨ v4 ∨ v5) (v1 ∨ v2 ∨ v4) (v1 ∨ v3 ∨ v5) (v3 ∨ v4 ∨ v5) (v1 ∨ v4 ∨ v5) (v1 ∨ v5) (v1 ∨ v2) (v1 ∨ v2 ∨ v3 ∨ v4) ❆ ❆ ❆ ❆ ❆ ❆ ❯ (v1 ∨ v2 ∨ v3) ✄ ✄ ✄ ✄ ✄ ✎ (v1 ∨ v2) ❈ ❈ ❈ ❈ ❲ (v1 ∨ v2 ∨ v3) ❇ ❇ ❇ ❇ ❇ ❇ ❇ ❇ ◆ (v1) ✄ ✄ ✄ ✎ (∅) ✎ (v1) ✄ ✄ ✄ ✎ (v1 ∨ v5) ✄ ✄ ✄ ✎ ✻ ✻ ❅ ❅
(v1 ∨ v2 ∨ v5) ∧ (v3 ∨ v4 ∨ v5) ∧ (v1 ∨ v2 ∨ v4) ∧ (v1 ∨ v3 ∨ v5) ∧ (v1 ∨ v2) ∧ (v3 ∨ v4 ∨ v5) ∧ (v1 ∨ v4 ∨ v5) ∧ (v1 ∨ v5)
SLIDE 26
Resolution vs. DPLL Complexity
Minimum size of a refutation
If there is a DPLL search involving n choicepoints for problem X then there’s a resolution refutation of length p(n) for problem X By adding some components to DPLL, namely clause learning and restarts, DPLL can p-simulate resolution By adding new variables & clauses that preserve unsatisfiability, DPLL with clause learning effectively p-simulate resolution and refute the augmented set of unsatisfiable clauses iff resolution can refute the original set of clauses. Pool resolution is exponentially stronger than regular resolution. Pool resolution is closely related to DPLL plus clause learning. Hence DPLL success with clause learning likely can be explained.
SLIDE 27 Refutation Size and Max Clause Width
Minimum size of a refutation
S(ψ) = e
Ω
|V |
ψ is a CNF formula with variable set V . w(ψ) is the width of the widest clause in ψ. w(ψ ⊢ ∅) is the minimum of the width of the
widest clause over all refutations of ψ.
S(ψ) is the minimum size of a resolution refutation of ψ.
when
Sparseness: few pairs of clauses have a common literal
- r complementary pair of literals.
SLIDE 28 Upper Bounds
Autarky
A partial assignment that satisfies all those clauses affected by it. examples: a pure literal; v1 = v2 = 1 below.
(v1 ∨ v2 ∨ v3) ∧ (v1 ∨ v2 ∨ v4) ∧ (v3 ∨ v4 ∨ v5) ∧ (v1 ∨ v4 ∨ v5)
A subformula obtained by applying an autarky is satisfiable if and only if the formula is.
Algorithm Idea for k-CNF formulas - 20.695n for 3-SAT
Choose smallest clause c = (lπ1 ∨ . . . ∨ lπi) Create i subproblems using the following assignments:
lπ1 = 1 lπ1 = 0, lπ2 = 1 . . . lπ1 = 0, lπ2 = 0, . . ., lπi−1 = 0, lπi = 1
If ∃ subformula with width k clauses, remove and continue Otherwise solve subformulas
SLIDE 29
Upper Bounds
A probabilistic algorithm
Repeat the following (2 − 2/k)n times: Randomly choose an assignment M. If M is a model for ψ return M. Repeat the following 3n times: Pick an unsatisfied clause c ∈ ψ. Randomly choose l ∈ c. Reverse the polarity of the variable associated with l. If the updated M is a model for ψ return M. Return “unsatisfiable?” Probability a model is found in 3n steps is p ≥ (2/3)(2 − 2/k)−n Hence the algorithm solves k-SAT in time |ψ|O(1)(2 − 2/k)n (|ψ|O(1)20.42n for k = 3) with error probability o(1) Look at the SAT Handbook for more information
SLIDE 30 Resolution Can Be Bad
Prove that it is impossible to assign n + 1 pigeons to n holes without at least one hole containing two pigeons
Variables Subscript Range Meaning vi,k 1 ≤ i ≤ n 1 ≤ k ≤ n + 1 vi,k = 1 iff the kth pigeon is in hole i Clauses Subscript Range Meaning (v1,k ∨ . . . ∨ vn,k) 1 ≤ k ≤ n + 1 Every pigeon in at least one hole (vi,l ∨ vi,k) 1 ≤ l < k ≤n + 1 1 ≤ i ≤ n Each hole has at most one pigeon
Every resolution proof requires generating exponentially many resolvents
SLIDE 31
Extended Resolution
Just add this:
w ⇔ f(x, y, . . . , z)
where w is a variable not already in the formula and f is any Boolean function of variables that are in the formula. Example:
(w ∨ x) ∧ (w ∨ y) ∧ (w ∨ x ∨ y)
This is equivalent to:
w ⇔ (x ∨ y)
which means either x and y both have value 1 (then w = 0) or at least one of x or y has value 0 (then w = 1).
SLIDE 32 Example, Pigeon Hole Formulas
wn−1
i,j
⇔ vi,j ∨ (vn,j ∧ vi,n+1), 1 ≤ i ≤ n − 1, 1 ≤ j ≤ n
All the wn−1
i,j
act like the vi,j except that the maximum of i and j are reduced by 1. That is, if a unique mapping is possible and the modified formula is satisfied, one of wn−1
i,1 ,wn−1 i,2 ,. . ., wn−1 i,n , 1 ≤ i ≤ n − 1, will have value 1 and all clauses wn−1 i,j
∨ wn−1
i,k
will also have value 1.
SLIDE 33 Binary Decision Diagrams
✓ ✒ ✏ ✑ v0 ✓ ✒ ✏ ✑ v1 ✓ ✒ ✏ ✑ v2 ✓ ✒ ✏ ✑ v3 ✓ ✒ ✏ ✑ v4 T F ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✑ ✑ ✑ ✑ ✑ ❙ ❙ ❙ ✑ ✑ ✑ ✑ ✑ ❇ ❇ ❇ ❇ ❇ ❇ ❇ (v0, v1, v4), {v0, v1, v2, v3, v4}, {v0, v1, v2, v3}, {v0, v2, v3, v4}, {v1, v2, v3}} Rooted binary directed acyclic graph Two leaves labeled T and F Other nodes are labeled with variable names Edges are dotted indicating a value of 0
- r solid indicating a value of 1 for up var
Out of each non-leaf, there is one solid and
There is an order on the variables of the BDD and variables on any path obey it A single BDD compactly represents a Boolean function
SLIDE 34 Binary Decision Diagrams
✓ ✒ ✏ ✑ v0 ✓ ✒ ✏ ✑ v1 ✓ ✒ ✏ ✑ v2 ✓ ✒ ✏ ✑ v3 ✓ ✒ ✏ ✑ v4 T F ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✑ ✑ ✑ ✑ ✑ ❙ ❙ ❙ ✑ ✑ ✑ ✑ ✑ ❇ ❇ ❇ ❇ ❇ ❇ ❇ (v0, v1, v4), {v0, v1, v2, v3, v4}, {v0, v1, v2, v3}, {v0, v2, v3, v4}, {v1, v2, v3}}
v0 v1 v2 v3 v4 f 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
SLIDE 35 Binary Decision Diagrams
✓ ✒ ✏ ✑ v0 ✓ ✒ ✏ ✑ v1 ✓ ✒ ✏ ✑ v2 ✓ ✒ ✏ ✑ v3 ✓ ✒ ✏ ✑ v4 T F ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✑ ✑ ✑ ✑ ✑ ❙ ❙ ❙ ✑ ✑ ✑ ✑ ✑ ❇ ❇ ❇ ❇ ❇ ❇ ❇ (v0 ∨ v1 ∨ v4) ∧ (v0 ∨ v1 ∨ v2 ∨ v3 ∨ v4) ∧ (v0 ∨ v1 ∨ v2 ∨ v3)∧ (v0 ∨ v2 ∨ v3 ∨ v4) ∧ (v0 ∨ v2 ∨ v3) Rooted binary directed acyclic graph Two leaves labeled T and F Other nodes are labeled with variable names Edges are dotted indicating a value of 0
- r solid indicating a value of 1 for up var
Out of each non-leaf, there is one solid and
There is an order on the variables of the BDD and variables on any path obey it A single BDD compactly represents a Boolean function Every path to F represents a clause, anding them gives the function
SLIDE 36 Binary Decision Diagrams
(v0 ∨ v1 ∨ v2 ∨ v3 ∨ v4) ∧ (v0 ∨ v1 ∨ v2 ∨ v3 ∨ v4) ∧ (v0 ∨ v1 ∨ v2 ∨ v3 ∨ v4) ∧ . . . ∧ (v0 ∨ v1 ∨ v2 ∨ v3 ∨ v4) ∧ . . . ∧ (v0 ∨ v1 ∨ v2 ∨ v3 ∨ v4) ∧ (v0 ∨ v1 ∨ v2 ∨ v3 ∨ v4) ∧ . . . ∧ (v0 ∨ v1 ∨ v2 ∨ v3 ∨ v4) ∧ (v0 ∨ v1 ∨ v2 ∨ v3 ∨ v4) ∧ XOR representations: BDDs are exponentially smaller than CNFs unless you do something like this (for parity constraint):
(v1 ⊕ w1) ⇔ p ∧ (v2 ⊕ w2) ⇔ w1 ∧ . . . ∧ (vn−1 ⊕ wn−1) ⇔ wn ∧ vn ⇔ wn
SLIDE 37 Binary Decision Diagrams
Via the BDD-visualizer - ordering affects size
available from: http://cs.uc.edu/˜weaversa/BDD Visualizer.html
SLIDE 38 Binary Decision Diagrams
ite(v4,T,F) ; BDD $1 Created ite(v3,F,T) ; BDD $2 Created ite(v2,$2,T) ; bdd $3 created ite(v1,$2,$1) ; bdd $4 created print($3,$4) findOrCreateNode(v,t,e) { if (t == e) return t; if ((node = lookup(<v,t,e>)) != null) return node; node = createNode(<v,t,e>); insertNodeDataBase(<v,t,e>,node) return node; } Hashtable lookup on nodes - nodes shared across BDDs
(above is an example of the language of the BDD Visualizer)
SLIDE 39 Binary Decision Diagrams
ite(v4,T,F) ; BDD $1 Created ite(v3,F,T) ; BDD $2 Created ite(v2,$2,T) ; bdd $3 created ite(v1,$2,$1) ; bdd $4 created and($3,$4) ; bdd $5 created print($5) All interesting applications conjoin BDDs
SLIDE 40 Binary Decision Diagrams
Conjoining is a bottom up process - complexity linear in # nodes Both v3 = 0 and v4 = 1 to get to T
SLIDE 41 Binary Decision Diagrams
Conjoining is a bottom up process - complexity linear in # nodes
v2 = 1 goes to v3, no change
If v2 = 0 then v4 = 1 to get to T
SLIDE 42 Binary Decision Diagrams
Conjoining is a bottom up process - complexity linear in # nodes
SLIDE 43 Binary Decision Diagrams
Conjoining is a bottom up process - complexity linear in # nodes but the number of nodes can double - hence 2n nodes may result from n binary conjunctions.
SLIDE 44 Binary Decision Diagrams
Conjoining is a bottom up process - complexity linear in # nodes but the number of nodes can double - hence 2n nodes may result from n binary conjunctions. But more conjunctions may reduce the size of the BDD - here not(or(v2,v4)) is added.
SLIDE 45 Binary Decision Diagrams
Conjoining is a bottom up process - complexity linear in # nodes but the number of nodes can double - hence 2n nodes may result from n binary conjunctions. But more conjunctions may reduce the size of the BDD - here not(or(v2,v4)) is added. Then or(v2,v3)
SLIDE 46 Binary Decision Diagrams
Existential quantification: A Boolean function which can be written
f(v, x) = (v ∧ h1( x)) ∨ (v ∧ h2( x))
can be replaced by
f( x) = h1( x) ∨ h2( x)
where
x is a list of one or more variables.
There is a solution to f(
x) iff there is a solution to f(v, x) so it is sufficient to solve f( x) to get a solution
to f(v,
x).
- a variable is eliminated!
- this is natural for BDDs
SLIDE 47 Binary Decision Diagrams
inps inps inps f c g 0000 0000 0000 1 0001 0001 1 0001 0010 1 0010 0010 0011 1 0011 1 0011 1 . . . . . . . . . . . .
Consider the truth tables for BDDs f and c. Build a new BDD g over variables in f and c. On any row of c’s truth table that has value 1, let the corresponding row in g map to the same value as f. On other rows g maps to any value. Observe f ∧ c and g ∧ c are identical, so g can replace f in a collection of BDDs. BDD g is said to be a reduction -
- BDD g can be made smaller than f.
- Inferences can be discovered.
- BDDs can be removed from the collection without loss.
SLIDE 48
Binary Decision Diagrams
Obvious reduction: g maps to 0 all rows that c maps to 0. Called zero-restrict, has weaknesses - for example
c = (v1 ∨ v2) ∧ (v1 ∨ v3) f = (v2 ∨ v3)
will yield
g = v3 ∧ (v1 ∨ (v1 ∧ v2))
instead of the possible
g = (v3)
Obvious dual: g maps to 1 all rows that c maps to 0 No better. Desired: some rows of g to map to 1, others to 0 so that
g’s truth table reflects a pattern that generates inferences. g maps 011 and 111 to 0 and 010 and 101 to 1
to get v3.
SLIDE 49 Binary Decision Diagrams
BDD
g is a generalized co-factor of f and if for any truth assignment t, g( t) has the same value as f( t′) where t′ is the nearest truth
assignment to
t that maps to 1.
The notion of nearest truth assignment depends on a permutation π of the numbers 1,2,. . .,
n that gives the variable ordering of the input BDDs.
Represent a truth assignment to
n variables as a vector in {0, 1}n
for assignment
t, let ti denote the ith bit of the vector representing t.
Then the distance between two truth assignments
t′ and t′′ is defined as
n i=1 2n−i(t′ πi ⊕ t′′ πi).
One pair of assignments is nearer to each other than another pair if the distance between that pair is less.
SLIDE 50 Binary Decision Diagrams
inps inps inps f c g 000 1 000 000 001 001 001 010 010 1 010 011 011 1 011 100 1 100 1 100 1 101 1 101 1 101 1 110 1 110 1 110 1 111 111 1 111 ✲ ✲ ✲ ✲ ☛ ✡ ✟ ✠ v1 ☛ ✡ ✟ ✠ v2 ☛ ✡ ✟ ✠ v2 ☛ ✡ ✟ ✠ v3 ☛ ✡ ✟ ✠ v3 T F ✓ ✓ ✓ ✓ ✓ ✓ ❍❍❍❍❍ ☛ ✡ ✟ ✠ v1 ☛ ✡ ✟ ✠ v2 T F ✓ ✓ ☛ ✡ ✟ ✠ v1 ☛ ✡ ✟ ✠ v2 ☛ ✡ ✟ ✠ v3 F T ◗◗◗ ✓ ✓ ✓ ✓ f = (v1 ∨ v3) ∧ (v1 ∨ v2) ∧ (v1 ∨ v2 ∨ v3) c = (v1 ∨ v2) gcf(f, c) = (v1 ∧ (v2 → v3))
SLIDE 51 Binary Decision Diagrams
Theorem:
Given BDDs f1, ..., fk, for any 1 ≤ i ≤ k, f1 ∧ f2 ∧ ... ∧ fk is satisfiable if and only if (f1|fi) ∧ ... ∧ (fi−1|fi) ∧ (fi+1|fi) ∧ ... ∧ (fk|fi) is satisfiable. Moreover, any assignment satisfying the latter can be mapped to an assignment that satisfies f1 ∧ ... ∧ fk. So generalized co-factoring can be used to eliminate one of the BDDs among a given conjoined set of BDDs: the solver finds an assignment satisfying gcf(f1, fi) ∧ ... ∧ gcf(fk, fi) and then extends the assignment to satisfy fi, otherwise the solver reports that the instance has no solution.
SLIDE 52
Algebraic Methods
Example:
(v1 ∨ v2 ∨ v3)
is represented by the equation
v1(1 + v2)(1 + v3) + v2(1 + v3) + v3 + 1 = 0
which may be rewritten
v1v2v3 + v1v2 + v1v3 + v2v3 + v1 + v2 + v3 + 1 = 0
Example:
v1 ⊕ v2 ⊕ v3 ⊕ v4
is represented by the equation
v1 + v2 + v3 + v4 + 1 = 0.
SLIDE 53 Algebraic Methods
Arithmetic mod 2:
New facts are derived from old facts using the following rules:
- 1. Any even sum of like terms in an equation may be replaced by 0.
e.g.: v1v2 + v1v2 ⇒ 0 and 1 + 1 ⇒ 0. Needed to eliminate terms when adding equations.
- 2. A factor v2 may be replaced by v
Needed to ensure terms remain multi-linear after multiplication
- 3. An equation may be multiplied by a term,
the resulting equation may be reduced by the rule above. e.g.: v3v4(v1 + v3 = 0) ⇒ v1v3v4 + v3v4 = 0. The new equation is said to be a new, derived fact.
- 4. Two equations may be added, using mod 2 arithmetic
The new equation is said to be a new, derived fact.
SLIDE 54 Algebraic Methods
Example:
(v1 ∨ v2) ∧ (v2 ∨ v3) ∧ (v3 ∨ v1) The equations corresponding to the above are shown below as equations (1), (2), and (3). All equations below the line are derived as stated on the right. v1v2 +v2 = 0 (1) v2v3 +v3 = 0 (2) v1v3 +v1 = 0 (3) v1v2v3 +v2v3 = 0 (4) ⇐ v3 · (1) v1v2v3 +v3 = 0 (5) ⇐ (4) + (2) v1v2v3 +v1v3 = 0 (6) ⇐ v1 · (2) v1v2v3 +v1 = 0 (7) ⇐ (6) + (3) v1v2v3 +v1v2 = 0 (8) ⇐ v2 · (3) v1v2v3 +v2 = 0 (9) ⇐ (8) + (1) v1 +v2 = 0 (10) ⇐ (9) + (7) v1 +v3 = 0 (11) ⇐ (5) + (7) From the bottom two equations, v1 = v2 = v3.
SLIDE 55 Algebraic Methods
An Algebraic Solver (ψ, d)
/* Input: List of equations ψ = e1, ..., em, integer d */ /* Output: “satisfiable” or “unsatisfiable” */ /* Locals: Set B of equations */ Set B ← ∅. Repeat while ψ = ∅: Pop e ← ψ. Repeat while ∃e′ ∈ B : first non-zero(e) = first non-zero(e′): Set e ← reduce(e + e′). /* Rule 4. */ If e is 1 = 0: Output “unsatisfiable” If e is not 0 = 0: Set B ← B ∪ {e}. If degree(e) < d: Repeat for all variables v: If reduce(v · e) has not been in ψ: Append ψ ← reduce(v · e). /* Rule 3. */ Output “satisfiable”.
SLIDE 56
Algebraic Methods
Arithmetic mod 2: Theorem: The number of derivations used by the algebraic solver is within a polynomial factor of the minimum number possible. Theorem: The minimum number of derivations used by the algebraic solver cannot be much greater than, and may sometimes be far less than the minimum number needed by resolution.
SLIDE 57 Algebraic Methods
Arithmetic mod 2: Comparison with BDD operations (restrict(f,c)):
✎ ✍ ☞ ✌ v1 ✎ ✍ ☞ ✌ v3 ✎ ✍ ☞ ✌ v2 T F ✓ ✓ ✓ ◗◗◗ ◗ ✎ ✍ ☞ ✌ v2 ✎ ✍ ☞ ✌ v3 T F ❙ ❙
⇓
f = (v1 ∨ v2) ∧ (v1 ∨ v3) c = (v2 ∨ v3)
⇒
✎ ✍ ☞ ✌ v1 ✎ ✍ ☞ ✌ v3 ✎ ✍ ☞ ✌ v2 T F ✓ ✓ ✓ ◗◗◗ ◗ Algebra: f : v1v3 + v2 + v1v2 = 0 and c : v2v3 + v3 = 0 (v2v3) · (v1v3 + v2 + v1v2 = 0) ⇒ (v2v3 = 0) + (v2v3 + v3 = 0) ⇒ v3 = 0. As BDDs: (v2v3) means v2 = v3 = 1 rows are 0, all other rows are 1. All 1 rows of f are 1 rows of (v2v3) so product can be added as a fact. But when conjoined with c, the inference v3 = 0 is obtained.
SLIDE 58 Algebraic Methods
Arithmetic mod 2: Comparison with BDD operations (gcf(f,c) and Ex. Quant.):
On BDDs, gcf(f,c) depends on the variable ordering But gcf(f,c) may replace f, not so for algebra In algebra, ex. quant. means multiply two equations Example: consider g = v1v2v3 + v1v3 + v1 + 1 = 0. To existentially quantify v2 away from g: form equations: v1 + 1 = 0 (v2 = 1) v1v3 + v1 + 1 = 0 (v2 = 0) Then multiply (v1 + 1) · (v1v3 + v1 + 1) = (v1v3 + v1v3 + v1 + 1) = (v1 + 1). But the variable that is quantified away can be in just one equation.
SLIDE 59 And Inverter Graphs
gate 4 gate 5
Y X
gate 2
v
gate 3 gate 1
A B C w u
A B C X Y u w v
SLIDE 60 And Inverter Graphs
Can be small vs. CNF representation:
v1 v2 v3 v4 . . .
linear in AIG but exponential in CNF or in DNF
(v1 ∨ v2 ∨ v3...) ∧ (¯ v1 ∨ ¯ v2 ∨ v3...) ∧ (¯ v1 ∨ v2 ∨ ¯ v3...)...(¯ v1 ∨ ¯ v2 ∨ ¯ v3 ∨ ¯ v4 ∨ v5...)...
SLIDE 61 And Inverter Graphs
Can be small vs. BDD representation: Consider an integer multiplier for word size n with outputs numbered 0 to 2n − 1. For the Boolean function representing either the output
i − 1 or 2n − i − 1:
- 1. there is a circuit of size linear in n that implements it;
- 2. every BDD representing one of them has exponential size.
SLIDE 62
Satisfiability Modulo Theories
How does it work?
The SAT solver takes care of reasoning When needed, it consults a theory solver which decides the validity of predicates.
Core
DPLL−based SAT Solver
Data Types Bit Vectors Arrays Arithmetic
SLIDE 63
Satisfiability Modulo Theories
What is a first order theory? Theory of linear arithmetic (ax + by <= c) Theory of bit vectors (concat(bv1, bv2) == bv3) Theory of arrays (arr[i := v1][j] = v2) Theory of uninterpreted functions (f(f(f(x))) == x) A sentence spanning several theories
φ = x ≤ y; y ≤ x + car(cons(0, x)); p(h(x) − h(y)); p(0);
SLIDE 64 Is Probabilistic Analysis Worthwhile?
The Questions:
- Why are some problems so difficult?
- Are there algorithms that will make them easier?
SLIDE 65
Almost nothing past this point was presented but was intended to be presented
SLIDE 66 Is Probabilistic Analysis Worthwhile?
The Questions:
- Why are some problems so difficult?
- Are there algorithms that will make them easier?
Why Probability?
- Results and process tend to draw out intuition
− Identify properties that may be exploited by a fast
algorithm and properties that may prevent exploitation.
− Identify reasons for the hardness of various problems -
why lots of instances are hard.
- Can explain the good or bad behavior of an algorithm
- Afford comparison of incomparable classes of formulas
SLIDE 67 Is Probabilistic Analysis Worthwhile?
Some problems:
- Must assume an input distribution,
- ften not reflecting reality
(but sometimes we do not need to)
- Analysis can be difficult or impossible -
algorithmic steps may significantly change distribution (known tools are limited)
- Can yield misleading results
SLIDE 68
A Misleading Result
Example: A probabilistic model for random formulas Given: set L = {v1, v1, ..., vn, vn} of literals and 0 < p < 1 Construct clause c: l ∈ L independently in c with probability p Construct formula ψ: m independently constructed clauses Justification: All formulas are equally likely if p = 1/3.
SLIDE 69 A Misleading Result
Example: A probabilistic model for random formulas Given: set L = {v1, v1, ..., vn, vn} of literals and 0 < p < 1 Construct clause c: l ∈ L independently in c with probability p Construct formula ψ: m independently constructed clauses Justification: All formulas are equally likely if p = 1/3. Applied to splitting (DPLL):
❍❍❍❍❍ t ❞ ❝ t ❞ ❝ t ❞ ❝ (v1 ∨ v2 ∨ vi) ∧ (vi ∨ v3) ∧ (v2 ∨ v4) (v1 ∨ v2) ∧ (v2 ∨ v4) (v3) ∧ (v2 ∨ v4) vi
SLIDE 70
A Misleading Result
Analysis sketch:
Given m clauses, the average number of clauses removed when a value is assigned is pm
SLIDE 71 A Misleading Result
Analysis sketch:
Given m clauses, the average number of clauses removed when a value is assigned is pm Let Ti be the average number of clauses remaining
Then T0 = m and Ti = (1 − p)Ti−1 For what i does Ti = 1?
SLIDE 72 A Misleading Result
Analysis sketch:
Given m clauses, the average number of clauses removed when a value is assigned is pm Let Ti be the average number of clauses remaining
Then T0 = m and Ti = (1 − p)Ti−1 For what i does Ti = 1? When 1 = m(1 − p)i or
lg(m) = −i lg(1 − p) i = lg(m)/ − lg(1 − p)
So, size of search space is 2i ≈ 2lg(m)/p = mc if p = 1/3
SLIDE 73 A Misleading Result
Analysis sketch:
Given m clauses, the average number of clauses removed when a value is assigned is pm Let Ti be the average number of clauses remaining
Then T0 = m and Ti = (1 − p)Ti−1 For what i does Ti = 1? When 1 = m(1 − p)i or
lg(m) = −i lg(1 − p) i = lg(m)/ − lg(1 − p)
So, size of search space is 2i ≈ 2lg(m)/p = mc if p = 1/3 Conclusion: DPLL is fantastic, on the average!
SLIDE 74 A Misleading Result
Problems with the analysis:
- The input model is funky!
The probability that a random assignment satisfies a random formula is
(1 − (1 − p)2n)m ≈ e−me−2pn
which tends to 1 if ln(m)/pn = o(1) and means the average width of a clause can be at least ln(m). With p = 1/3, this holds if n > ln(m).
SLIDE 75 A Misleading Result
Problems with the analysis:
- The input model is funky!
The probability that a random assignment satisfies a random formula is
(1 − (1 − p)2n)m ≈ e−me−2pn
which tends to 1 if ln(m)/pn = o(1) and means the average width of a clause can be at least ln(m). With p = 1/3, this holds if n > ln(m).
- If average clause width is constant (p = c/n)
then the average search space size is
2− lg(m)/ lg(1−p) ≈ 2lg(m)/(c/n) = 2n lg(m)/c = mn/c
SLIDE 76 A Misleading Result
Problems with the analysis:
- The input model is funky!
The probability that a random assignment satisfies a random formula is
(1 − (1 − p)2n)m ≈ e−me−2pn
which tends to 1 if ln(m)/pn = o(1) and means the average width of a clause can be at least ln(m). With p = 1/3, this holds if n > ln(m).
- If average clause width is constant (p = c/n)
then the average search space size is
2− lg(m)/ lg(1−p) ≈ 2lg(m)/(c/n) = 2n lg(m)/c = mn/c
Exponential complexity!
SLIDE 77 Probabilistic Toolbox
Linearity of expectation:
E{
Xi} =
E{Xi}, Xi real valued r.v.s
SLIDE 78 Probabilistic Toolbox
Linearity of expectation:
E{
Xi} =
E{Xi}, Xi real valued r.v.s
First Moment Method: show Pr(P) → 0 as n → ∞.
Let X be a count of some entity Suppose some property P holds if and only if X > 1. Since
Pr(X > 1) ≤ E{X}
if E{X} → 0 then Pr(P) → 0, as n → ∞.
SLIDE 79
First Moment Method
An Example:
Assume ψ is a random k-SAT formula, m clauses, n variables Let P be the property that ψ has a model
SLIDE 80 First Moment Method
An Example:
Assume ψ is a random k-SAT formula, m clauses, n variables Let P be the property that ψ has a model Let X be the number of models for ψ Let Xi =
- 1 if the ith assignment is a model for ψ
0 otherwise
SLIDE 81 First Moment Method
An Example:
Assume ψ is a random k-SAT formula, m clauses, n variables Let P be the property that ψ has a model Let X be the number of models for ψ Let Xi =
- 1 if the ith assignment is a model for ψ
0 otherwise Pr(Xi = 1) = (1 − 2−k)m E{X} =
2n
Pr(Xi = 1) = 2n(1 − 2−k)m
SLIDE 82 First Moment Method
An Example:
Assume ψ is a random k-SAT formula, m clauses, n variables Let P be the property that ψ has a model Let X be the number of models for ψ Let Xi =
- 1 if the ith assignment is a model for ψ
0 otherwise Pr(Xi = 1) = (1 − 2−k)m E{X} =
2n
Pr(Xi = 1) = 2n(1 − 2−k)m Pr(ψ has a model) → 0 if m n > 1 lg(1 − 2−k) ≈ 2k
For k = 3, ψ has no model w.h.p. if
m n > 5.19
SLIDE 83
Probabilistic Toolbox
Flow Analysis:
Consider straight-line (non-backtracking) variants of DPLL
Let ψ be a CNF Boolean expression Set M = ∅ Repeat the following: Choose an unassigned literal l in ψ If l is a positive literal, set M = M ∪ {l} Remove all clauses containing l from ψ Remove all literals l from ψ If ψ is empty then return M If some clause in ψ is falsified return "give up"
SLIDE 84
Probabilistic Toolbox
Flow Analysis:
Consider straight-line (non-backtracking) variants of DPLL
Let ψ be a CNF Boolean expression Set M = ∅ Repeat the following: Choose an unassigned literal l in ψ If l is a positive literal, set M = M ∪ {l} Remove all clauses containing l from ψ Remove all literals l from ψ If ψ is empty then return M If some clause in ψ is falsified return "give up"
When does this not give up with probability tending to 1? Answer depends on the way literals are chosen
SLIDE 85 Flow Analysis
Ck(j) ✲ ❄
zk(j) wk−1(j)
Ck−1(j) ✲ ❄
zk−1(j) wk−2(j)
. . .
w2(j)
❄ C2(j) ✲ ❄
z2(j) w1(j)
C1(j) ✲ ❄
z1(j) w0(j) E{m4(j)} j/n✲ 1/4 1/2 3/4 1 m E{m3(j)} j/n✲ 1/4 1/2 3/4 1 m E{m2(j)} j/n✲ 1/4 1/2 3/4 1 m
SLIDE 86
Flow Analysis
Example: Unit clause heuristic: When there is a clause with one unassigned variable remaining, set the value of such a variable so as to satisfy its clause.
SLIDE 87
Flow Analysis
Example: Unit clause heuristic: When there is a clause with one unassigned variable remaining, set the value of such a variable so as to satisfy its clause. Intuitively: If the clause flow w1(j) < 1 then any accumulation of unit clauses can be prevented and no clauses will ever be eliminated
SLIDE 88 Flow Analysis
Example: Unit clause heuristic: When there is a clause with one unassigned variable remaining, set the value of such a variable so as to satisfy its clause. Intuitively: If the clause flow w1(j) < 1 then any accumulation of unit clauses can be prevented and no clauses will ever be eliminated Analysis: Write difference equations describing flows:
mi(j + 1) = mi(j) + wi(j) − wi−1(j) − zi(j), ∀ 0 ≤ i ≤ k, 1 < j < n
Take expectations and rearrange:
E{mi(j + 1) − mi(j)} = E{wi(j)} − E{wi−1(j)} − E{zi(j)}
SLIDE 89 Compute the expectations:
E{zi(j)} = E{E{zi(j)|mi(j)}} = E
i · mi(j)
2(n − j)
2(n − j) E{wi(j)} = E{E{...}} = E
(i + 1)mi+1(j)
2(n − j)
2(n − j)
SLIDE 90 Compute the expectations:
E{zi(j)} = E{E{zi(j)|mi(j)}} = E
i · mi(j)
2(n − j)
2(n − j) E{wi(j)} = E{E{...}} = E
(i + 1)mi+1(j)
2(n − j)
2(n − j)
Substitute into difference equations:
E{mi(j + 1) − mi(j)} = (i + 1)E{mi+1(j)} 2(n − j) − i · E{mi(j)} n − j , i < k E{mk(j + 1) − mk(j)} = −k · E{mk(j)} n − j
SLIDE 91 Compute the expectations:
E{zi(j)} = E{E{zi(j)|mi(j)}} = E
i · mi(j)
2(n − j)
2(n − j) E{wi(j)} = E{E{...}} = E
(i + 1)mi+1(j)
2(n − j)
2(n − j)
Substitute into difference equations:
E{mi(j + 1) − mi(j)} = (i + 1)E{mi+1(j)} 2(n − j) − i · E{mi(j)} n − j , i < k E{mk(j + 1) − mk(j)} = −k · E{mk(j)} n − j
Switch to differential equations (use x for j/n):
d ¯ mi(x) dx = (i + 1) ¯ mi+1(x) 2n(1 − x) − i · ¯ mi(x) n − j ; ¯ mk(0) = m/n, ¯ mi(0) = 0 for i < k
SLIDE 92 Compute the expectations:
E{zi(j)} = E{E{zi(j)|mi(j)}} = E
i · mi(j)
2(n − j)
2(n − j) E{wi(j)} = E{E{...}} = E
(i + 1)mi+1(j)
2(n − j)
2(n − j)
Substitute into difference equations:
E{mi(j + 1) − mi(j)} = (i + 1)E{mi+1(j)} 2(n − j) − i · E{mi(j)} n − j , i < k E{mk(j + 1) − mk(j)} = −k · E{mk(j)} n − j
Switch to differential equations (use x for j/n):
d ¯ mi(x) dx = (i + 1) ¯ mi+1(x) 2n(1 − x) − i · ¯ mi(x) n − j ; ¯ mk(0) = m/n, ¯ mi(0) = 0 for i < k
Solve: Translation:
¯ mi(x) = 1 2k−i m n k i
E{mi(j)} = m 2k−i k i 1 − j n i j n k−i
SLIDE 93 Flow Analysis
The important flow:
E{w1(j)} = E{m2(j)} (n − j) = 1 2k−2 k 2 1 − j n 2 j n k−2 m
Find location of maximum (set derivative = 0):
j∗ = k − 2 k − 1
So,
E{w1(j∗)} < 1 when m n < 2k−1 k k − 1 k − 2 k−1
for k = 3 this is m
n < 8 3
SLIDE 94 Flow Analysis
The important flow:
E{w1(j)} = E{m2(j)} (n − j) = 1 2k−2 k 2 1 − j n 2 j n k−2 m
Find location of maximum (set derivative = 0):
j∗ = k − 2 k − 1
So,
E{w1(j∗)} < 1 when m n < 2k−1 k k − 1 k − 2 k−1
for k = 3 this is m
n < 8 3
Conclusion: unit clause heuristic succeeds with probability bounded by a constant when m
n < 8 3.
SLIDE 95 Flow Analysis
What makes this work? The clausal distribution is the same, up to parameters m and n, at each level (algorithm is myopic - no information is revealed) There is pretty much never a sudden spurious flow
Pr(||Ci(j + 1)| − |Ci(j)|| > n0.2) = o(n−3)
The average flow change is pretty smooth
E{|Ci(j + 1)| − |Ci(j)|} = fi(j/n, |C0(j)|/n, ..., |Ck(j)|/n) + o(1), fi is continuous and |fi(u1, ..., uk+2) − fi(v1, ..., vk+2)| ≤ L
|ui − vi|
SLIDE 96 Flow Analysis
good when m/n < literal selection
k-SAT 3-SAT Choose from unit clause, otherwise randomly 2k/k 2.66 Choose var with maximum difference between
- ccurrences of positive and negative lits. Set
value to maximize satisfied clauses c · 2k/k 3.003 Choose randomly from a clause with fewest non-falsified literals 1.125 · 2k/k 3.09 Best possible myopic algorithm c · 2k/k 3.26
literal selection, non-myopic algorithms
Greedy algorithm: maximize number of clauses satisfied, eliminate unit clauses when they exist c · 2k/k? 3.52 Maximize the expected number of models of the reduced instance c · 2k/k? > 3.6?
SLIDE 97 Flow Analysis
Pr(success) 1
0.4635 2k k + 1
k − 2
k−2
0.7725 2k k + 1
k − 2
k−2 m n ⇒
Typical probability curve of these algorithms
SLIDE 98 Flow Analysis
Pr(success) 1
0.4635 2k k + 1
k − 2
k−2
0.7725 2k k + 1
k − 2
k−2 m n ⇒
Typical probability curve of these algorithms Is 2k
k the crossover to unsatisfiability or is it 2k?
SLIDE 99 An explanation?
Put points above a “floor” at distance = # clauses falsified Create clusters of points around a lowest point At m/n = r∗
k ≈ (2k/k) log(k):
Suddenly very many exponentially small clusters appear far apart from each other, surrounded by tall “mountains,” and containing mostly frozen variables
SLIDE 100 Probabilistic Toolbox
Second Moment Method: show Pr(P) → 1 as n → ∞ Let P be some property of a formula A witness for P: a structure whose presence in ψ implies P Let W = {w : w is a witness for P in ψ} Let Xi =
0 otherwise
Let X =
Xi and E{Xi} = q, then E{X} ∆
= µ = q|W|
Suppose var(X) ∆
= σ2 = o(µ2). Then, since
Pr(X = 0) ≤ σ2 µ2
we get
Pr(P) → 1 as n → ∞
SLIDE 101 To show σ2 = o(µ2): Start with one witness w chosen arbitrarily Let Aw be all witnesses sharing at least one clause with w Let Dw be all witnesses sharing no clause with w. Then
σ2 = µ(1 − q) + µ
z∈Aw
(Pr(z|w) − q) +
(Pr(z|w) − q)
Need |Aw| ≪ |Dw| or “little” overlap among witnesses since
Pr(z|w) = Pr(z) = q if z ∈ Dw so
z∈Dw(Pr(z|w) − q) = 0.
If µ → ∞ and
Pr(z|W) → o(µ) as n → ∞ then Pr(P) → 1 as n → ∞
SLIDE 102 Where is the Crossover?
Cannot apply the second moment method directly to k-SAT
- variance of the number of models is too high
the reason: the asymmetry of k-SAT
SLIDE 103 Where is the Crossover?
Cannot apply the second moment method directly to k-SAT
- variance of the number of models is too high
the reason: the asymmetry of k-SAT Let z and w be assignments agreeing in αn variables
Pr(z satisfies ψ | w satisfies ψ) =
2k − 1
m
Variance gets too big, maximum occurs at α = 1/2
Pr(z|w) =
n
αn 1 − 1 − αk 2k − 1
m
SLIDE 104 Where is the Crossover?
Analyze a different problem: Not All Equal k-SAT A NAE model: one for which every clause has at least one true and at least one false literal
Pr(∃ a model for ψ) > Pr(∃ a NAE-model for ψ)
Let X = number of models, XNAE = number of NAE models
Pr(XNAE = 0) > Pr(X = 0)
SLIDE 105 Where is the Crossover?
Analyze a different problem: Not All Equal k-SAT A NAE model: one for which every clause has at least one true and at least one false literal
Pr(∃ a model for ψ) > Pr(∃ a NAE-model for ψ)
Let X = number of models, XNAE = number of NAE models
Pr(XNAE = 0) > Pr(X = 0)
Pr(z NAE-satisfies ψ | w NAE-satisfies ψ) =
2k−1 − 1 m
Variance is low, maximum term occurs at α = 1/2.
n
αn 1 − 1 − αk − (1 − α)k 2k−1 − 1
m
≈ 2n(1 − 21−k)m √n ≈ o(µ)
Pr(XNAE = 0) < 1 µNAE ≈ 1 2n(1 − 2k−1)m → 0 if m n > 1 lg(1 − 2k−1) ≈ 2k−1
SLIDE 106
What About Easy Classes?
Examples: Horn, Hidden Horn, 2-SAT, Extended Horn, q-Horn, CC-balanced, SLUR, Matched, Linear Autarkies Horn: every clause has at most one positive literal solved in linear time by unit clause algorithm
SLIDE 107 What About Easy Classes?
Examples: Horn, Hidden Horn, 2-SAT, Extended Horn, q-Horn, CC-balanced, SLUR, Matched, Linear Autarkies Horn: every clause has at most one positive literal solved in linear time by unit clause algorithm Probabilistic analysis of polytime solvable classes can reveal:
- What critically distinguishes an easy class
from more difficult classes
- Whether one class is much larger than another
incomparable class in a probabilistic sense
SLIDE 108 Polynomial Time Solvable Classes
Example: Matched
✓ ✒ ✏ ✑ v0 ✓ ✒ ✏ ✑ v1 ✓ ✒ ✏ ✑ v2 ✓ ✒ ✏ ✑ v3 ✓ ✒ ✏ ✑ v4 ✓ ✒ ✏ ✑ (v0 ∨ v2 ∨ v3) ✓ ✒ ✏ ✑ (v1 ∨ v2 ∨ v4) ✓ ✒ ✏ ✑ (v0 ∨ v2 ∨ v4) ❛❛❛❛❛❛❛❛❛❛❛❛❛❛❛❛ ❛ ❆ ❆ ❆ ❆ ❆ ❆ ❆
❧ ❧ ❧ ❧ ❧ ❧ ❧ ✑ ✑ ✑ ✑ ✑ ✑ ✑ ✑ ✑ ✑ ✑ ✱ ✱ ✱ ✱ ✱ ✱ ✱ ✱ (v0 ∨ v2 ∨ v3) ∧ (v1 ∨ v2 ∨ v4) ∧ (v0 ∨ v2 ∨ v4)
SLIDE 109 Polynomial Time Solvable Classes
Example: Horn
(v0 ∨ v1 ∨ v2) ∧ (v0) ∧ (v1 ∨ v3 ∨ v5) ∧ (v2) ∧ (v2 ∨ v4)
Horn Solver (ψ)
Set M ← ∅. Repeat the following until ψ has no positive unit clauses: Choose variable v from a positive unit clause in ψ. Set M ← M ∪ {v}. Remove clauses containing literal v from ψ. Remove all literals v from ψ. If ψ has an empty clause, output ‘unsatisfiable.” Output M.
Unique minimum satisfying assignment w.r.t. 1
All assignments satisfying above include v2 = v4 = 1
SLIDE 110 Polynomial Time Solvable Classes
Example: q-Horn variables
Horn
clauses
non-positive
1 1
1
1
1 1
1
1
Zero 2-SAT
SLIDE 111 Polynomial Time Solvable Classes
Example: q-Horn variables
Horn
clauses
non-positive
1 1
1
1
1 1
1
1
Zero 2-SAT
If the satisfiability index of a given formula is no greater than 1, then the formula is q-Horn. The class of formulas with a satisfiability index greater than
1 + n−ǫ, for any ǫ, is NP-complete.
SLIDE 112 Polynomial Time Solvable Classes
Vulnerability of q-Horn to particular cycles
. . . (u2 ∨ u1 ∨ ...) (u1 ∨ v0 ∨ u3p ∨ ...) (u3p ∨ u3p−1 ∨ ...) . . . . . . (up−1 ∨ up ∨ ...) (up ∨ v0 ∨ up+1 ∨ ...) (up+1 ∨ up+2 ∨ ...). . .
u1 up v0 up+1 u3p
SLIDE 113 Polynomial Time Solvable Classes
Vulnerability of q-Horn to particular cycles
. . . (u2 ∨ u1 ∨ ...) (u1 ∨ v0 ∨ u3p ∨ ...) (u3p ∨ u3p−1 ∨ ...) . . . . . . (up−1 ∨ up ∨ ...) (up ∨ v0 ∨ up+1 ∨ ...) (up+1 ∨ up+2 ∨ ...). . .
u1 up v0 up+1 u3p
Pr(random formula is of specified class)
class as n → ∞
k-SAT 3-SAT Horn m > ǫ m > ǫ Hidden Horn m/n > 1/(k − lg(k + 1)) m/n > 1 q-Horn m/n > 4/(k2 − k) m/n > 0.66 SLUR m/n > 4/(k2 − k) m/n > 0.66 Matched 1 m/n < ck, ck → 1 m/n < 0.64 No Cycles 1 m/n < 1.36/(k2 − k) m/n < 0.226
SLIDE 114 Algorithms for Unsatisfiability
Resolution performs badly on random unsatisfiable formulas
Pr(random k-SAT formula is unsatisfiable) → 1 if
m n > 2k
Pr(resolution does well) → 1
m n >
lg(n) k−2
Are there better alternatives? Must avoid getting stuck on “sparse” nature of formulas
SLIDE 115 Algorithms for Unsatisfiability
Resolution performs badly on random unsatisfiable formulas
Pr(random k-SAT formula is unsatisfiable) → 1 if
m n > 2k
Pr(resolution does well) → 1
m n >
lg(n) k−2
Are there better alternatives? Must avoid getting stuck on “sparse” nature of formulas One possibility: Hitting Set Focus attention on clauses which are all positive or negative Let n+ = min number of 1 valued variables to satisfy positives Let n− = min number of 0 valued variables to satisfy negatives If n+ + n− > n then some variable must be set to 1 AND 0 That is impossible, conclude the formula is unsatisfiable
SLIDE 116 Hitting Set
Construct graphs G+, G− Vertices are labeled as pairs of variables Edge a, b ⇔ some clause contains all variables labeling a, b
(v1 ∨ v2 ∨ v3 ∨ v4) ∧ (v2 ∨ v3 ∨ v4 ∨ v5) ∧ (v1 ∨ v3 ∨ v4 ∨ v5)
v1, v2
① ❤ ❣ ❢
v3, v4
① ❤ ❣ ❢ ❆ ❆ ❆ ❆ ❆ ✁ ✁ ✁ ✁ ✁
v2, v5
① ❤ ❣ ❢
v1, v5
① ❤ ❣ ❢
v2, v4
① ❤ ❣ ❢
v1, v3
① ❤ ❣ ❢ ❆ ❆ ❆ ❆ ❆ ✁ ✁ ✁ ✁ ✁
v4, v5
① ❤ ❣ ❢
v2, v3
① ❤ ❣ ❢ ❆ ❆ ❆ ❆ ❆ ✁ ✁ ✁ ✁ ✁
v1, v4
① ❤ ❣ ❢
v3, v5
① ❤ ❣ ❢ ❆ ❆ ❆ ❆ ❆
For k = 4, if a model exists, one graph has |IS| > n2
8
Because, if ψ has a model, then there is some subset V ′
- f n/2 variables s.t. ψ has no positive clause or negative
clause taken from V ′.
SLIDE 117 Hitting Set
Construct graphs G+, G− Vertices are labeled as pairs of variables Edge a, b ⇔ some clause contains all variables labeling a, b
(v1 ∨ v2 ∨ v3 ∨ v4) ∧ (v2 ∨ v3 ∨ v4 ∨ v5) ∧ (v1 ∨ v3 ∨ v4 ∨ v5)
v1, v2
① ❤ ❣ ❢
v3, v4
① ❤ ❣ ❢ ❆ ❆ ❆ ❆ ❆ ✁ ✁ ✁ ✁ ✁
v2, v5
① ❤ ❣ ❢
v1, v5
① ❤ ❣ ❢
v2, v4
① ❤ ❣ ❢
v1, v3
① ❤ ❣ ❢ ❆ ❆ ❆ ❆ ❆ ✁ ✁ ✁ ✁ ✁
v4, v5
① ❤ ❣ ❢
v2, v3
① ❤ ❣ ❢ ❆ ❆ ❆ ❆ ❆ ✁ ✁ ✁ ✁ ✁
v1, v4
① ❤ ❣ ❢
v3, v5
① ❤ ❣ ❢ ❆ ❆ ❆ ❆ ❆
For k = 4, if a model exists, one graph has |IS| > n2
8
Because, if ψ has a model, then there is some subset V ′
- f n/2 variables s.t. ψ has no positive clause or negative
clause taken from V ′.
SLIDE 118 Hitting Set
Construct matrices M +, M − Columns and rows are indexed on vertices
Mi,j =
− 1−p
p
if there is an edge between vertices i and j
1
where p represents a probability that can be adjusted Exploit relationship between max eigenvalue and max IS
α(G+) < λ1(M +) and α(G−) < λ1(M −)
SLIDE 119 Hitting Set
Construct matrices M +, M − Columns and rows are indexed on vertices
Mi,j =
− 1−p
p
if there is an edge between vertices i and j
1
where p represents a probability that can be adjusted Exploit relationship between max eigenvalue and max IS
α(G+) < λ1(M +) and α(G−) < λ1(M −)
For purposes of proving a bound If p = ln7(n′)
n′
then max
i {|λi(M)|} =
2n′ ln3.5(n′) (1 + o(1))
w.h.p. This leads to Pr(HS does well) → 1 if m
n > n(k−2)/2
Recall Pr(resolution does well) → 1 only if m
n > nk−2.
SLIDE 120 A De-randomized Algorithm for MAXSAT
MAX k-SAT
Given: A CNF formula ψ with k literals per clause Find: An assignment to the variables of ψ that satisfies a maximum number of its clauses. Suppose ψ has variables v1, v2, . . . , vn. Define indicators
Ai
t1,...,tj =
1 if clause i satisfied given v1 = t1, ..., vj = tj
0 otherwise What is the probability that Ai
t1,...,,tj = 1 for random tj+1, ..., tn?
for example: Pr((v1 ∨ v3 ∨ v5) = 1 | t1 = 1, t2 = 0) = Pr(Ai
1,0) = 3/4
SLIDE 121 A De-randomized Algorithm for MAXSAT
Let N be the number of satisfied clauses in ψ. Then
E{N} =
n
Pr(Ai) = (1 − 2−k)m
and
Pr(Ai
t1,...,tj−1)
= (Pr(Ai
t1,...,tj−1,1) + Pr(Ai t1,...,tj−1,0))/2
≤ max {Pr(Ai
t1,...,tj)}
so keep choosing a value tj, for j = 1, 2, ... that maximizes
Pr(Ai
t1,...,tj) to get
E{N} = (1 − 2−k)m =
n
Pr(Ai) ≤
n
max {Pr(Ai
t1)}...
≤
n
max {Pr(Ai
t1,...,tn)} = # clauses satisfied given t1, ..., tn
SLIDE 122 A De-randomized Algorithm for MAXSAT
MAX k-SAT approximation algorithm uses this:
bool chooseValue (Variable *var) { double sum pos=0.0, sum neg=0.0, prob=0.5; for (int sz=1 ; sz <= k ; sz++) { sum pos += var->no clauses as pos lit[sz]*prob; sum neg += var->no clauses as neg lit[sz]*prob; prob *= 0.5;
}
return (sum pos >= sum neg) ? true : false;
}
and will always find an assignment that satisfies at least
(1 − 2−k)m clauses - for any input formula!