Foundations and Theoretical Aspects of Propositional Satisfiability - - PowerPoint PPT Presentation

foundations and theoretical aspects of propositional
SMART_READER_LITE
LIVE PREVIEW

Foundations and Theoretical Aspects of Propositional Satisfiability - - PowerPoint PPT Presentation

Foundations and Theoretical Aspects of Propositional Satisfiability John Franco franco@gauss.ececs.uc.edu presentation to SMT/SAT Summer School, Helsinki, 2013 July, 2013 Outline Objective: Introduce SAT and SMT Show SAT and SMT


slide-1
SLIDE 1

Foundations and Theoretical Aspects

  • f Propositional Satisfiability

John Franco franco@gauss.ececs.uc.edu

presentation to

SMT/SAT Summer School, Helsinki, 2013

July, 2013

slide-2
SLIDE 2

Outline

Objective:

Introduce SAT and SMT Show SAT and SMT algorithmic operations Show some complexity results

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 Bounds on complexity Probabilistic analysis to show how algorithms get “stuck,” identify hard instances, measure “size” of easy classes, and suggest new algorithms that may be counter-intuitive

slide-3
SLIDE 3

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 A clause of width 0 is empty and denoted ∅ Symbols φ and ψ denote an instance of SAT An assignment of values satisfying ψ is a model for ψ

slide-4
SLIDE 4

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-5
SLIDE 5

Shannon’s Expansion

At the dawn of the information age:

f(v1, v2, . . . , vn) = (v1 ∧ f(1, v2, . . . , vn)) ∨ (v1 ∧ f(0, v2, . . . , vn)) f(v1, v2, . . . , vn) = (v1 ∨ f(1, v2, . . . , vn)) ∧ (v1 ∨ f(0, v2, . . . , vn))

slide-6
SLIDE 6

Shannon’s Expansion

At the dawn of the information age:

f(v1, v2, . . . , vn) = (v1 ∧ f(1, v2, . . . , vn)) ∨ (v1 ∧ f(0, v2, . . . , vn)) f(v1, v2, . . . , vn) = (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-7
SLIDE 7

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-8
SLIDE 8

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-9
SLIDE 9

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-10
SLIDE 10

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-11
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) (v0 ∧ v2) (v2 ∧ v4)

slide-12
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 ❞ ❝ t ❞ ❝ t ❞ ❝

∨ ∨ ∨ (v1 ∧ v2) (v3 ∧ v4) va vb (v0 ∨ va) ∧ (v2 ∨ va) ∧ (v0 ∨ v2 ∨ va) ∧ (v2 ∨ vb) ∧ (v4 ∨ vb) ∧ (v2 ∨ v4 ∨ vb)

slide-13
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) (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-14
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 ❞ ❝ 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-15
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 ❞ ❝

∨ (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-16
SLIDE 16

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-17
SLIDE 17

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-18
SLIDE 18

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-19
SLIDE 19

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-20
SLIDE 20

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-21
SLIDE 21

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-22
SLIDE 22

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)

Do this repeatedly If an empty resolvent (∅) is generated, the instance has no model Otherwise, there is a model

slide-23
SLIDE 23

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-24
SLIDE 24

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-25
SLIDE 25

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-26
SLIDE 26

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-27
SLIDE 27

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-28
SLIDE 28

DP in DPLL

t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝ (v1 ∨ v3 ∨ v5) (v1 ∨ v2 ∨ v5) (v3 ∨ v4 ∨ v5) (v1 ∨ v4 ∨ v5) (v1 ∨ v5) (v3 ∨ v4 ∨ v5) t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝ v5 v5 v5 v5 v5 v5 t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝ v4 v4 v4 (v1 ∨ v2 ∨ v4) t ❞ ❝ t ❞ ❝ v3 v3 (v1 ∨ v2) t ❞ ❝ t ❞ ❝ v2 t ❞ ❝ v1

  • PPPPPPP

✟ ✟ ✟ ✟ ✟ ❅ ❅ ❅ ❆ ❆ ❆ ❆ ❆ ✁ ✁ ✁ ✁ ✁ ✡ ✡ ✡ ✡ ✡ ✡ ✡ ✡ ❍❍❍❍ ❍ ❅ ❅ ❅ ◗◗◗◗◗◗◗

(v1 ∨ v2 ∨ v5) ∧ (v3 ∨ v4 ∨ v5) ∧ (v1 ∨ v2 ∨ v4) ∧ (v1 ∨ v3 ∨ v5) ∧ (v1 ∨ v2) ∧ (v3 ∨ v4 ∨ v5) ∧ (v1 ∨ v4 ∨ v5) ∧ (v1 ∨ v5)

slide-29
SLIDE 29

DP in DPLL

t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝ (v1 ∨ v2 ∨ v3) (v1 ∨ v2 ∨ v3 ∨ v4) (v1 ∨ v3 ∨ v4) (v1 ∨ v4) (v1 ∨ v4) (v1 ∨ v3 ∨ v4) t ❞ ❝ t ❞ ❝ t ❞ ❝ t ❞ ❝ v4 v4 v4 (v1 ∨ v2 ∨ v4) t ❞ ❝ t ❞ ❝ v3 v3 (v1 ∨ v2) t ❞ ❝ t ❞ ❝ v2 t ❞ ❝ v1 ❅ ❅ ❅ ❆ ❆ ❆ ❆ ❆ ✁ ✁ ✁ ✁ ✁ ✡ ✡ ✡ ✡ ✡ ✡ ✡ ✡ ❍❍❍❍ ❍ ❅ ❅ ❅ ◗◗◗◗◗◗◗

(v1 ∨ v2 ∨ v5) ∧ (v3 ∨ v4 ∨ v5) ∧ (v1 ∨ v2 ∨ v4) ∧ (v1 ∨ v3 ∨ v5) ∧ (v1 ∨ v2) ∧ (v3 ∨ v4 ∨ v5) ∧ (v1 ∨ v4 ∨ v5) ∧ (v1 ∨ v5)

slide-30
SLIDE 30

DP in DPLL

t ❞ ❝ (v1 ∨ v2 ∨ v3) t ❞ ❝ t ❞ ❝ t ❞ ❝ (v1 ∨ v2 ∨ v3) (v1 ∨ v3) (v1 ∨ v3) t ❞ ❝ t ❞ ❝ v3 v3 (v1 ∨ v2) t ❞ ❝ t ❞ ❝ v2 t ❞ ❝ v1 ✡ ✡ ✡ ✡ ✡ ✡ ✡ ✡ ❍❍❍❍ ❍ ❅ ❅ ❅ ◗◗◗◗◗◗◗

(v1 ∨ v2 ∨ v5) ∧ (v3 ∨ v4 ∨ v5) ∧ (v1 ∨ v2 ∨ v4) ∧ (v1 ∨ v3 ∨ v5) ∧ (v1 ∨ v2) ∧ (v3 ∨ v4 ∨ v5) ∧ (v1 ∨ v4 ∨ v5) ∧ (v1 ∨ v5)

slide-31
SLIDE 31

DP in DPLL

t ❞ ❝ t ❞ ❝ (v1 ∨ v2) (v1 ∨ v2) (v1) t ❞ ❝ t ❞ ❝ v2 t ❞ ❝ v1 ❅ ❅ ❅ ◗◗◗◗◗◗◗

(v1 ∨ v2 ∨ v5) ∧ (v3 ∨ v4 ∨ v5) ∧ (v1 ∨ v2 ∨ v4) ∧ (v1 ∨ v3 ∨ v5) ∧ (v1 ∨ v2) ∧ (v3 ∨ v4 ∨ v5) ∧ (v1 ∨ v4 ∨ v5) ∧ (v1 ∨ v5)

slide-32
SLIDE 32

DP in DPLL

t ❞ ❝ (v1) t ❞ ❝ (v1) t ❞ ❝ v1 ◗◗◗◗◗◗◗

(v1 ∨ v2 ∨ v5) ∧ (v3 ∨ v4 ∨ v5) ∧ (v1 ∨ v2 ∨ v4) ∧ (v1 ∨ v3 ∨ v5) ∧ (v1 ∨ v2) ∧ (v3 ∨ v4 ∨ v5) ∧ (v1 ∨ v4 ∨ v5) ∧ (v1 ∨ v5)

slide-33
SLIDE 33

DP in DPLL

t ❞ ❝ (∅)

(v1 ∨ v2 ∨ v5) ∧ (v3 ∨ v4 ∨ v5) ∧ (v1 ∨ v2 ∨ v4) ∧ (v1 ∨ v3 ∨ v5) ∧ (v1 ∨ v2) ∧ (v3 ∨ v4 ∨ v5) ∧ (v1 ∨ v4 ∨ v5) ∧ (v1 ∨ v5)

slide-34
SLIDE 34

Resolution vs. DPLL Complexity

Minimum size of a refutation

If there is a DPLL search involving n choicepoints for instance X then there’s a resolution refutation of length p(n) for instance X By adding some components to DPLL, namely clause learning and restarts, DPLL can p-simulate resolution

slide-35
SLIDE 35

Refutation Size and Max Clause Width

Minimum size of a refutation

S(ψ) = e

  • (w(ψ ⊢ ∅) − w(ψ))2

|V |

  • where

ψ 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-36
SLIDE 36

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-37
SLIDE 37

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 value 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-38
SLIDE 38

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-39
SLIDE 39

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-40
SLIDE 40

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-41
SLIDE 41

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

  • ne dotted edge

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-42
SLIDE 42

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-43
SLIDE 43

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

  • ne dotted edge

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-44
SLIDE 44

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):

(v0 ⊕ w0) ⇔ p ∧ (v1 ⊕ w1) ⇔ w0 ∧ . . . ∧ (vn−2 ⊕ wn−1) ⇔ wn−2 ∧ vn−1 ⇔ wn−1

slide-45
SLIDE 45

Binary Decision Diagrams

Via the BDD-visualizer - ordering affects size

available from: http://www.cs.uc.edu/weaversa/BDD_Visualizer.html

slide-46
SLIDE 46

Binary Decision Diagrams

  • rder(v4, v3, v2, v1, v0)

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-47
SLIDE 47

Binary Decision Diagrams

Op: Conjunction -

  • rder(v4, v3, v2, v1, v0)

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-48
SLIDE 48

Binary Decision Diagrams

Conjoining is a bottom up process - complexity linear in # nodes Both v3 = 0 and v4 = 1 to get to T

slide-49
SLIDE 49

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-50
SLIDE 50

Binary Decision Diagrams

Conjoining is a bottom up process - complexity linear in # nodes

slide-51
SLIDE 51

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-52
SLIDE 52

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-53
SLIDE 53

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-54
SLIDE 54

Binary Decision Diagrams

Op: 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-55
SLIDE 55

Binary Decision Diagrams

Op: Restrict -

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-56
SLIDE 56

Binary Decision Diagrams

Obvious restrict: 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-57
SLIDE 57

Binary Decision Diagrams

Op: Generalized Cofactor - 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 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-58
SLIDE 58

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-59
SLIDE 59

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-60
SLIDE 60

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-61
SLIDE 61

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-62
SLIDE 62

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-63
SLIDE 63

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-64
SLIDE 64

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-65
SLIDE 65

Algebraic Methods

Arithmetic mod 2: Comparison with BDD operations (zero-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: multiply f by (v2v3) means conjoin f with (v2 ∨ v3). Then (v2 ∨ v3) can be added to f ∧ c... since all 1 rows of f are 1 rows of (v2 ∨ v3). But when (v2 ∨ v3) is conjoined with c, the inference v3 = 0 is obtained.

slide-66
SLIDE 66

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-67
SLIDE 67

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-68
SLIDE 68

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-69
SLIDE 69

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-70
SLIDE 70

Satisfiability Modulo Theories

DPLL solves Satisfiability fine on some instances but not others Does not do well on proving multipliers correct pigeon hole formulas cardinality constraints Can do well on bounded model checking but often it does not Is intended for propositional formulas SMT combines subsolvers for certain classes of first order formulas with a DPLL SAT solver

slide-71
SLIDE 71

Satisfiability Modulo Theories

What is a first order theory? A set of first order formulas with no free variables expressed in terms of specific function, predicate, constant, and variable symbols with some semantics arising from the functions, predicates, and values that the variables take. A set of axioms is defined to derive expressions that are true in the theory.

slide-72
SLIDE 72

Satisfiability Modulo Theories

Example theory: Linear Arithmetic Equations or inequalities with addition/subtraction over rational

  • r integer variables with constant multipliers

Syntax:

formula : formula ∧ formula | (formula) | atom atom : sum op sum

  • p :

≤ | = | < sum : term | sum + term | sum − term term : identifier | constant | constant identifier

Examples:

x ≤ y x = 3y + z ∧ 2x − y < 0

Decision procedures: CPLEX, gaussian elimination, branch-and-bound etc.

slide-73
SLIDE 73

Satisfiability Modulo Theories

Example theory: Equalities & Uninterpreted Functions Uninterpreted function and predicate symbols plus equals Requires:

x = y implies f(x) = f(y)

Examples:

g(f(g(x))) = x f(x) = x p(x, y) (x = y) ∧ (y = z) ∧ (f(x) = f(z))

slide-74
SLIDE 74

Satisfiability Modulo Theories

Example theory: Lists Constraints support usual query, construction, and destruction. Let x be a lisp-pair. Define

car(x) to be the left element of x, cdr(x) to be the right element of x, cons(a, b) to be a lisp-pair with a on the left and b on the right, atom(a) to be true if a is not a lisp-pair.

Semantics:

car(cons(x, y)) = x cdr(cons(x, y)) = y atom(x) → cons(car(x), cdr(x)) = x atom(cons(x, y))

slide-75
SLIDE 75

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-76
SLIDE 76

Satisfiability Modulo Theories

Example: A query - prove that

(x ≤ y ∧ y ≤ x + car(cons(0, x)) ∧ p(h(x) − h(y)) → p(0)

where p is a function returning true or false

x and y are numbers, h is any function

slide-77
SLIDE 77

Satisfiability Modulo Theories

Example: A query - prove that

(x ≤ y ∧ y ≤ x + car(cons(0, x)) ∧ p(h(x) − h(y)) → p(0)

where p is a function returning true or false

x and y are numbers, h is any function

The corresponding SMT sentence - show it’s false

φ = x ≤ y; y ≤ x + car(cons(0, x)); p(h(x) − h(y)); p(0);

slide-78
SLIDE 78

Satisfiability Modulo Theories

φ = x ≤ y;

(1)

y ≤ x + car(cons(0, x));

(2)

p(h(x) − h(y));

(3)

p(0);

(4) Purify: create constants, add expressions

slide-79
SLIDE 79

Satisfiability Modulo Theories

φ = x ≤ y;

(1)

y ≤ x + car(cons(0, x));

(2)

p(h(x) − h(y));

(3)

p(0);

(4) Purify: create constants, add expressions (1): not mixed, leave alone

slide-80
SLIDE 80

Satisfiability Modulo Theories

φ = x ≤ y;

(1)

y ≤ x + car(cons(0, x));

(2)

p(h(x) − h(y));

(3)

p(0);

(4) Purify: create constants, add expressions

h(x) − h(y): mixed, create g1 = h(x), g2 = h(y)

slide-81
SLIDE 81

Satisfiability Modulo Theories

φ = x ≤ y;

(1)

y ≤ x + car(cons(0, x));

(2)

p(g1 − g2);

(3)

p(0);

(4)

g1 = h(x); g2 = h(y);

Purify: create constants, add expressions (3): is now p(g1 − g2), mixed, create g3 = g1 − g2

slide-82
SLIDE 82

Satisfiability Modulo Theories

φ = x ≤ y;

(1)

y ≤ x + car(cons(0, x));

(2)

p(g3);

(3)

p(0);

(4)

g1 = h(x); g2 = h(y); g3 = g1 − g2;

Purify: create constants, add expressions (3): becomes p(g3), not mixed, leave alone

slide-83
SLIDE 83

Satisfiability Modulo Theories

φ = x ≤ y;

(1)

y ≤ x + car(cons(0, x));

(2)

p(g3);

(3)

p(0);

(4)

g1 = h(x); g2 = h(y); g3 = g1 − g2;

Purify: create constants, add expressions 0 alien in p(0): create g4 = 0

slide-84
SLIDE 84

Satisfiability Modulo Theories

φ = x ≤ y;

(1)

y ≤ x + car(cons(g4, x));

(2)

p(g3);

(3)

p(g4);

(4)

g1 = h(x); g2 = h(y); g3 = g1 − g2; g4 = 0;

Purify: create constants, add expressions (4): becomes p(g4), not mixed, leave alone

slide-85
SLIDE 85

Satisfiability Modulo Theories

φ = x ≤ y;

(1)

y ≤ x + car(cons(g4, x));

(2)

p(g3);

(3)

p(g4);

(4)

g1 = h(x); g2 = h(y); g3 = g1 − g2; g4 = 0;

Purify: create constants, add expressions (2): mixed, create g5 = car(cons(g4, x))

slide-86
SLIDE 86

Satisfiability Modulo Theories

φ = x ≤ y;

(1)

y ≤ x + g5;

(2)

p(g3);

(3)

p(g4);

(4)

g1 = h(x); g2 = h(y); g3 = g1 − g2; g4 = 0; g5 = car(cons(g4, x));

Purify: create constants, add expressions (2): becomes y ≤ x + g5, leave alone

slide-87
SLIDE 87

Satisfiability Modulo Theories

φ1 = x ≤ y; y ≤ x + g5; g3 = g1 − g2; g4 = 0;

(LA)

φ2 = g1 = h(x); g2 = h(y); p(g4); p(g3);

(EUF)

φ3 = g5 = car(cons(g4, x));

(Lists) Propagate inferred equalities between φ1, φ2, φ3

slide-88
SLIDE 88

Satisfiability Modulo Theories

φ1 = x ≤ y; y ≤ x + g5; g3 = g1 − g2; g4 = 0;

(LA)

φ2 = g1 = h(x); g2 = h(y); p(g4); p(g3);

(EUF)

φ3 = g5 = car(cons(g4, x));

(Lists) Propagate inferred equalities between φ1, φ2, φ3

g5 = car(cons(g4, x)) infers g4 = g5 (List axiom)

slide-89
SLIDE 89

Satisfiability Modulo Theories

φ1 = x ≤ y; y ≤ x + g5; g3 = g1 − g2; g5 = 0;

(LA)

φ2 = g1 = h(x); g2 = h(y); p(g5); p(g3);

(EUF)

φ3 = g5 = car(cons(g5, x));

(Lists) Propagate inferred equalities between φ1, φ2, φ3

g5 = car(cons(g4, x)) infers g4 = g5 (List axiom)

slide-90
SLIDE 90

Satisfiability Modulo Theories

φ1 = x ≤ y; y ≤ x + g5; g3 = g1 − g2; g5 = 0;

(LA)

φ2 = g1 = h(x); g2 = h(y); p(g5); p(g3);

(EUF)

φ3 = g5 = car(cons(g5, x));

(Lists) Propagate inferred equalities between φ1, φ2, φ3

g5 = car(cons(g4, x)) infers g4 = g5 (List axiom) g5 = 0 is inferred in φ1 (Equals for equals)

slide-91
SLIDE 91

Satisfiability Modulo Theories

φ1 = x ≤ y; y ≤ x + g5; g3 = g1 − g2; g5 = 0;

(LA)

φ2 = g1 = h(x); g2 = h(y); p(g5); p(g3);

(EUF)

φ3 = g5 = car(cons(g5, x));

(Lists) Propagate inferred equalities between φ1, φ2, φ3

g5 = car(cons(g4, x)) infers g4 = g5 (List axiom) g5 = 0 is inferred in φ1 (Equals for equals) x ≤ y and y ≤ x + g5 infer x = y (Linear Arithmetic axiom)

slide-92
SLIDE 92

Satisfiability Modulo Theories

φ1 = x = y; g3 = g1 − g2; g5 = 0;

(LA)

φ2 = g1 = h(x); g2 = h(x); p(g5); p(g3);

(EUF)

φ3 = g5 = car(cons(g5, x));

(Lists) Propagate inferred equalities between φ1, φ2, φ3

g5 = car(cons(g4, x)) infers g4 = g5 (List axiom) g5 = 0 is inferred in φ1 (Equals for equals) x ≤ y and y ≤ x + g5 infer x = y (Linear Arithmetic axiom)

slide-93
SLIDE 93

Satisfiability Modulo Theories

φ1 = x = y; g3 = g1 − g2; g5 = 0;

(LA)

φ2 = g1 = h(x); g2 = h(x); p(g5); p(g3);

(EUF)

φ3 = g5 = car(cons(g5, x));

(Lists) Propagate inferred equalities between φ1, φ2, φ3

g5 = car(cons(g4, x)) infers g4 = g5 (List axiom) g5 = 0 is inferred in φ1 (Equals for equals) x ≤ y and y ≤ x + g5 infer x = y (Linear Arithmetic axiom) g1 = h(x) and g2 = h(x) infer g1 = g2 (EUF axiom)

slide-94
SLIDE 94

Satisfiability Modulo Theories

φ1 = x = y; g3 = g1 − g1; g5 = 0;

(LA)

φ2 = g1 = h(x); g1 = h(x); p(g5); p(g3);

(EUF)

φ3 = g5 = car(cons(g5, x));

(Lists) Propagate inferred equalities between φ1, φ2, φ3

g5 = car(cons(g4, x)) infers g4 = g5 (List axiom) g5 = 0 is inferred in φ1 (Equals for equals) x ≤ y and y ≤ x + g5 infer x = y (Linear Arithmetic axiom) g1 = h(x) and g2 = h(x) infer g1 = g2 (EUF axiom)

slide-95
SLIDE 95

Satisfiability Modulo Theories

φ1 = x = y; g3 = g1 − g1; g5 = 0;

(LA)

φ2 = g1 = h(x); g1 = h(x); p(g5); p(g3);

(EUF)

φ3 = g5 = car(cons(g5, x));

(Lists) Propagate inferred equalities between φ1, φ2, φ3

g5 = car(cons(g4, x)) infers g4 = g5 (List axiom) g5 = 0 is inferred in φ1 (Equals for equals) x ≤ y and y ≤ x + g5 infer x = y (Linear Arithmetic axiom) g1 = h(x) and g2 = h(x) infer g1 = g2 (EUF axiom) g3 = g1 − g1 infers g3 = 0 = g5 (LA axiom)

slide-96
SLIDE 96

Satisfiability Modulo Theories

φ1 = x = y; g5 = g1 − g1; g5 = 0;

(LA)

φ2 = g1 = h(x); g1 = h(x); p(g5); p(g5);

(EUF)

φ3 = g5 = car(cons(g5, x));

(Lists) Propagate inferred equalities between φ1, φ2, φ3

g5 = car(cons(g4, x)) infers g4 = g5 (List axiom) g5 = 0 is inferred in φ1 (Equals for equals) x ≤ y and y ≤ x + g5 infer x = y (Linear Arithmetic axiom) g1 = h(x) and g2 = h(x) infer g1 = g2 (EUF axiom) g3 = g1 − g1 infers g3 = 0 = g5 (LA axiom)

slide-97
SLIDE 97

Satisfiability Modulo Theories

φ1 = x = y; g5 = g1 − g1; g5 = 0;

(LA)

φ2 = g1 = h(x); g1 = h(x); p(g5); p(g5);

(EUF)

φ3 = g5 = car(cons(g5, x));

(Lists) Propagate inferred equalities between φ1, φ2, φ3

g5 = car(cons(g4, x)) infers g4 = g5 (List axiom) g5 = 0 is inferred in φ1 (Equals for equals) x ≤ y and y ≤ x + g5 infer x = y (Linear Arithmetic axiom) g1 = h(x) and g2 = h(x) infer g1 = g2 (EUF axiom) g3 = g1 − g1 infers g3 = 0 = g5 (LA axiom) p(g5) ∧ p(g5) is a contradiction

slide-98
SLIDE 98

Is Probabilistic Analysis Worthwhile?

The Questions:

  • Why are some instances so difficult?
  • Are there algorithms that will make them easier?
slide-99
SLIDE 99

Is Probabilistic Analysis Worthwhile?

The Questions:

  • Why are some instances 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 instances -

why lots of instances are hard.

  • Can explain the good or bad behavior of an algorithm
  • Afford comparison of incomparable classes of formulas
slide-100
SLIDE 100

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-101
SLIDE 101

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-102
SLIDE 102

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-103
SLIDE 103

A Misleading Result

Analysis sketch:

Given m clauses, the average number of clauses removed when a value is assigned is pm

slide-104
SLIDE 104

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

  • n the ith iteration

Then T0 = m and Ti = (1 − p)Ti−1 For what i does Ti = 1?

slide-105
SLIDE 105

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

  • n the ith iteration

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-106
SLIDE 106

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

  • n the ith iteration

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-107
SLIDE 107

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 3 ln(m). If all clauses have width 3 ln(m), max # assignments that cannot be models is at most m2n/23 ln(m) < (m/m)2n

slide-108
SLIDE 108

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 3 ln(m). If all clauses have width 3 ln(m), max # assignments that cannot be models is at most m2n/23 ln(m) < (m/m)2n

  • 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-109
SLIDE 109

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 3 ln(m). If all clauses have width 3 ln(m), max # assignments that cannot be models is at most m2n/23 ln(m) < (m/m)2n

  • 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-110
SLIDE 110

Probabilistic Toolbox

Linearity of expectation:

E{

  • i

Xi} =

  • i

E{Xi}, Xi real valued r.v.s

slide-111
SLIDE 111

Probabilistic Toolbox

Linearity of expectation:

E{

  • i

Xi} =

  • i

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-112
SLIDE 112

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-113
SLIDE 113

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-114
SLIDE 114

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

  • i=1

Pr(Xi = 1) = 2n(1 − 2−k)m

slide-115
SLIDE 115

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

  • i=1

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-116
SLIDE 116

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-117
SLIDE 117

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-118
SLIDE 118

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-119
SLIDE 119

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-120
SLIDE 120

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-121
SLIDE 121

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-122
SLIDE 122

Compute the expectations:

E{zi(j)} = E{E{zi(j)|mi(j)}} = E

i · mi(j)

2(n − j)

  • = i · E{mi(j)}

2(n − j) E{wi(j)} = E{E{...}} = E

(i + 1)mi+1(j)

2(n − j)

  • = (i + 1)E{mi+1(j)}

2(n − j)

slide-123
SLIDE 123

Compute the expectations:

E{zi(j)} = E{E{zi(j)|mi(j)}} = E

i · mi(j)

2(n − j)

  • = i · E{mi(j)}

2(n − j) E{wi(j)} = E{E{...}} = E

(i + 1)mi+1(j)

2(n − j)

  • = (i + 1)E{mi+1(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-124
SLIDE 124

Compute the expectations:

E{zi(j)} = E{E{zi(j)|mi(j)}} = E

i · mi(j)

2(n − j)

  • = i · E{mi(j)}

2(n − j) E{wi(j)} = E{E{...}} = E

(i + 1)mi+1(j)

2(n − j)

  • = (i + 1)E{mi+1(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-125
SLIDE 125

Compute the expectations:

E{zi(j)} = E{E{zi(j)|mi(j)}} = E

i · mi(j)

2(n − j)

  • = i · E{mi(j)}

2(n − j) E{wi(j)} = E{E{...}} = E

(i + 1)mi+1(j)

2(n − j)

  • = (i + 1)E{mi+1(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

  • (1 − x)ixk−i

E{mi(j)} = m 2k−i k i 1 − j n i j n k−i

slide-126
SLIDE 126

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

  • n

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-127
SLIDE 127

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

  • n

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-128
SLIDE 128

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

  • 1≤i≤j

|ui − vi|

slide-129
SLIDE 129

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-130
SLIDE 130

Flow Analysis

Pr(success) 1

0.4635 2k k + 1

  • k − 1

k − 2

k−2

0.7725 2k k + 1

  • k − 1

k − 2

k−2 m n ⇒

Typical probability curve of these algorithms

slide-131
SLIDE 131

Flow Analysis

Pr(success) 1

0.4635 2k k + 1

  • k − 1

k − 2

k−2

0.7725 2k k + 1

  • 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-132
SLIDE 132

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-133
SLIDE 133

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 =

  • 1 if structure si ∈ W

0 otherwise

Let X =

  • i

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-134
SLIDE 134

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) +

  • z∈Dw

(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

  • z∈Aw

Pr(z|W) → o(µ) as n → ∞ then Pr(P) → 1 as n → ∞

slide-135
SLIDE 135

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-136
SLIDE 136

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 ψ) =

  • 1 − 1 − αk

2k − 1

m

Variance gets too big, maximum occurs at α = 1/2

  • z∈Aw

Pr(z|w) =

  • 0<α≤1

n

αn 1 − 1 − αk 2k − 1

m

slide-137
SLIDE 137

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-138
SLIDE 138

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 ψ) =

  • 1 − 1 − αk − (1 − α)k

2k−1 − 1 m

Variance is low, maximum term occurs at α = 1/2.

  • 0<α≤1

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-139
SLIDE 139

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-140
SLIDE 140

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-141
SLIDE 141

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-142
SLIDE 142

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-143
SLIDE 143

Polynomial Time Solvable Classes

Example: q-Horn variables

Horn

clauses

non-positive

                      

  • 1

1 1

  • 1
  • 1

1

  • 1
  • 1

1

  • 1
  • 1
  • 1

1 1

  • 1
  • 1

1

  • 1
  • 1
  • 1

1

  • 1
  • 1
  • 1

                      

Zero 2-SAT

slide-144
SLIDE 144

Polynomial Time Solvable Classes

Example: q-Horn variables

Horn

clauses

non-positive

                      

  • 1

1 1

  • 1
  • 1

1

  • 1
  • 1

1

  • 1
  • 1
  • 1

1 1

  • 1
  • 1

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-145
SLIDE 145

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-146
SLIDE 146

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-147
SLIDE 147

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

  • nly if

m n >

  • n

lg(n) k−2

Are there better alternatives? Must avoid getting stuck on “sparse” nature of formulas

slide-148
SLIDE 148

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

  • nly if

m n >

  • 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-149
SLIDE 149

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-150
SLIDE 150

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-151
SLIDE 151

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

  • therwise

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-152
SLIDE 152

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

  • therwise

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-153
SLIDE 153

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-154
SLIDE 154

A De-randomized Algorithm for MAXSAT

Let N be the number of satisfied clauses in ψ. Then

E{N} =

n

  • i=1

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

  • i=1

Pr(Ai) ≤

n

  • i=1

max {Pr(Ai

t1)}...

n

  • i=1

max {Pr(Ai

t1,...,tn)} = # clauses satisfied given t1, ..., tn

slide-155
SLIDE 155

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!