Professional Documents
Culture Documents
1
Logic to Layout Computational Boolean
Algebra Representations:
Satisfiability (SAT), Part 1
Rob A. Rutenbar
University of Illinois
Some Terminology
Satisfiability (called SAT for short)
Give me an appropriate representation of function F(x1, x2, xn)
Find an assignment of the variables (vars for short) (x1, x2, xn) so F( ) = 1
Note this assignment need not be unique. Could be many satisfying solutions
But if there are no satisfying assignments at all prove it, and return this info
Some things you can do with BDDs, can do easier with SAT
SAT is aimed at scenarios where you just need one satisfying assignment
or prove that there is no such satisfying assignment
= ( a + c ) ( b + c) ( a + b + c)
= ( a + b ) (a + b + c) ( a + c + d ) ( a + b + c)
( 1 )( y )( y + z ) ( y + z ) ( 1 )( y + z ) ( y + z )
y=1 y=0 z=1
( 1 )( z ) ( z ) 0 (1)(1)
z=0 z=1 unSAT SAT!!
0 0 How do we do
unSAT unSAT this fast?
Slide 7 2013, R.A. Rutenbar
VLSI CAD: Lecture 4.2
Logic to Layout Computational Boolean
Algebra Representations:
Boolean Constraint
Propagation (BCP) for SAT
Rob A. Rutenbar
University of Illinois
BCP: Boolean Constraint Propagation
To do deduction, use BCP
Given a set of fixed variable assignments, what else can you deduce about
necessary assignments by propagating constraints
= ( a + c ) ( b + c) ( a + b + c)
Assume:
a=1, b=1
Slide 9 2013, R.A. Rutenbar
BCP Iterative Go Until No More Implications
= (1)(2)(3)(4)(5)(6)(7)(8)(9)
Example from
1 = ( x1 + x2 ) J.P. Marques-Silva and K. Sakallah,
0 GRASP: A Search Algorithm for
2 = ( x1 + x3 + x9) Propositional Satisfiability, IEEE
3 = ( x2 + x3 + x4) Trans. Computers, Vol 8, No 5, May99
0 No SAT
4 = ( x4 + x5 + x10)
0 No BCP Partial assignment is:
5 = ( x4 + x6 + x11)
Now what?
6 = ( x5 + x6) x9=0 x10=0 x11=0 x12=1 x13=1
0
7 = ( x1 + x7 + x12) To start
8 = ( x1 + x8) What are obvious simplifications when
0 we assign these variables?
9 = ( x7 + x8 + x13)
Slide 10 2013, R.A. Rutenbar
BCP Iterative Go Until No More Implications
= (1)(2)(3)(4)(5)(6)(7)(8)(9)
Partial assignment is:
0
1 = ( x1 + x2 ) x9=0 x10=0 x11=0 x12=1 x13=1
0 0 Unit
2 = ( x1 + x3 + x9) Next: Assign a variable to value
3 = ( x2 + x3 + x4) Assign x1=1
0
4 = ( x4 + x5 + x10)
0
5 = ( x4 + x6 + x11)
6 = ( x5 + x6) Implications!
1 0 x1=1 x2=1 && x3=1
7 = ( x1 + x7 + x12)
1 SAT
8 = ( x1 + x8)
0
9 = ( x7 + x8 + x13)
Slide 11 2013, R.A. Rutenbar
BCP Iterative Go Until No More Implications
= (1)(2)(3)(4)(5)(6)(7)(8)(9)
Partial assignment is:
0 1
1 = ( x1 + x2 ) x9=0 x10=0 x11=0 x12=1 x13=1
0 1 0 SAT
2 = ( x1 + x3 + x9) Next: Assign a var to value
0 0
3 = ( x2 + x3 + x4) UNIT Assign x1=1
0
4 = ( x4 + x5 + x10) Assign (implied): x2=1, x3=1
0
5 = ( x4 + x6 + x11)
6 = ( x5 + x6) Implications!
1 0 x2=1,x3=1 x4=1
7 = ( x1 + x7 + x12)
1 SAT
8 = ( x1 + x8)
0
9 = ( x7 + x8 + x13)
Slide 12 2013, R.A. Rutenbar
BCP Iterative Go Until No More Implications
= (1)(2)(3)(4)(5)(6)(7)(8)(9)
Partial assignment is:
0 1
1 = ( x1 + x2 ) x9=0 x10=0 x11=0 x12=1 x13=1
0 1 0 SAT
2 = ( x1 + x3 + x9) Next: Assign a var to value
0 0 1
3 = ( x2 + x3 + x4) Assign x1=1
0 0
4 = ( x4 + x5 + x10) Assign (implied): x2=1, x3=1
0 0 UNIT
5 = ( x4 + x6 + x11) Assign (implied): x4=1
6 = ( x5 + x6)
1 0
7 = ( x1 + x7 + x12) Implications!
1 SAT x4=1 x5=1 && x6=1
8 = ( x1 + x8)
0
9 = ( x7 + x8 + x13)
Slide 13 2013, R.A. Rutenbar
BCP Iterative Go Until No More Implications
= (1)(2)(3)(4)(5)(6)(7)(8)(9)
Partial assignment is:
0 1
1 = ( x1 + x2 ) x9=0 x10=0 x11=0 x12=1 x13=1
0 1 0 SAT
2 = ( x1 + x3 + x9) Next: Assign a var to value
0 0 1
3 = ( x2 + x3 + x4) Assign x1=1
0 1 0
4 = ( x4 + x5 + x10) Assign (implied): x2=1, x3=1
0 1 0 UNIT
Assign (implied): x4=1
5 = ( x4 + x6 + x11)
0 0 Assign (implied): x5=1 && x6=1
6 = ( x5 + x6) CONFLICT!
1 0
7 = ( x1 + x7 + x12)
1 SAT Conflict unSAT
8 = ( x1 + x8)
0 x5=1 && x6=1 clause 6==0!
9 = ( x7 + x8 + x13)
Slide 14 2013, R.A. Rutenbar
BCP Iterative Go Until No More Implications
= (1)(2)(3)(4)(5)(6)(7)(8)(9)
3 cases when BCP finishes
0 1
1 = ( x1 + x2 ) SAT: Find a SAT assignment, all
0 1 0 SAT clauses resolve to 1. Return it.
2 = ( x1 + x3 + x9)
0 0 1 UNRESOLVED: One or more
3 = ( x2 + x3 + x4)
0 1 0 clauses unresolved. Pick another
4 = ( x4 + x5 + x10) unassigned var, and recurse more.
0 1 0 SAT
5 = ( x4 + x6 + x11) UNSAT: Like this. Found conflict,
0 0
6 = ( x5 + x6) CONFLICT! one or more clauses eval to 0
1 0
7 = ( x1 + x7 + x12)
SAT Now what?
1
8 = ( x1 + x8) You need to undo one of our
0
9 = ( x7 + x8 + x13) UNRESOLVED variable assignments, try again
Slide 15 2013, R.A. Rutenbar
This Has a Famous Name: DPLL
Davis-Putnam-Logemann-Loveland Algorithm
Davis, Putnam published the basic recursive framework in 1960 (!)
Davis, Logemann, Loveland: found smarter BCP, eg, unit-clause rule, in 1962
Often called Davis-Putnam or DP in honor of the first paper in 1960, or
(inaccurately) DPLL (all four of them never did publish this stuff together)
Big ideas
A complete, systematic search of variable assignments
Useful CNF form for efficiency
BCP makes search stop earlier, resolving more assignments w/o recursing more
Examples
MiniSAT, from Niklas En, Niklas Srensson in Sweden.
We are using this one for our MOOC
CHAFF, from Sharad Malik and students, Princeton University
GRASP, from Joao Marques-Silva and Karem Sakallah, University of Michigan
and many others too. Go google around for them
F G
F1 F2 G1 G2
Do SAT solve on this new network
If SAT: networks not same,
and this pattern makes them
give different outputs
If unSAT: yes, same!
Slide 23 2013, R.A. Rutenbar
Final Topic: Gates CNF
How do I start with a gate-level description and get CNF?
Isnt this hard? Dont I need Boolean algebra or BDDs? No its really easy
1 3
2 4 5
Trick: build up CNF one gate at a time
Gate consistency function ( or gate satisfiability function)
a d = [d == (ab)] =
b d
EXNOR:
AB + A B
Slide 25 2013, R.A. Rutenbar
Final Topic: Gates CNF
Gate consistency function == 1 just for combinations of inputs
and the output that are consistent with what gate actually does
a
b d d = ( a + d ) ( b + d ) ( a + b + d )
a=0 b=0 d = 1
a=1 b=1 d = 1
a d
b 1 3
f d =
h
2 4 5
c e g e =
f =
g =
h =
z=EXOR(a, b) z=EXNOR(a, b)
z = z (a b)
Do it
good practice!
= (z + a + b)(z + a + b)
(z + a + b)(z + a + b)
z = ( x1 + z ) ( x2 + z ) ( x1 + x2 + z )