Computation Engines: BDDs and SAT (part 1) 290N: The Unknown Component Problem Lecture 7.
-
date post
21-Dec-2015 -
Category
Documents
-
view
225 -
download
1
Transcript of Computation Engines: BDDs and SAT (part 1) 290N: The Unknown Component Problem Lecture 7.
Computation Engines: Computation Engines: BDDs and SATBDDs and SAT
(part 1)(part 1)
290N: The Unknown Component 290N: The Unknown Component ProblemProblem
Lecture 7Lecture 7
OutlineOutline Formulation and computationFormulation and computation Representations of Boolean functionsRepresentations of Boolean functions Canonicity of a representationCanonicity of a representation Binary decision diagrams (BDDs)Binary decision diagrams (BDDs)
Definition, properties, applications, etcDefinition, properties, applications, etc Boolean operations using BDDsBoolean operations using BDDs Deriving BDDs from the circuitDeriving BDDs from the circuit
Satisfiability (SAT)Satisfiability (SAT) Search, implications, branch-and-bound, etcSearch, implications, branch-and-bound, etc Boolean operations using SATBoolean operations using SAT Deriving CNF from the circuitDeriving CNF from the circuit
Formulation and ComputationFormulation and Computation
FormulationFormulation Uses formalisms (such as automata theory, etc)Uses formalisms (such as automata theory, etc) Requires some statements to be provedRequires some statements to be proved Is not always concerned with how practical it isIs not always concerned with how practical it is
ComputationComputation Relies on formulationRelies on formulation Looks into algorithms and data structuresLooks into algorithms and data structures Is important for practical applicationsIs important for practical applications
Computation in Discrete DomainComputation in Discrete Domain
Is performed by a variety of applications in computer Is performed by a variety of applications in computer science and engineeringscience and engineering
Represents and manipulates various discrete objects Represents and manipulates various discrete objects (functions, relations, sets, automata, FSMs, etc.)(functions, relations, sets, automata, FSMs, etc.)
The most fundamental object seems to be a completely The most fundamental object seems to be a completely specified Boolean functionspecified Boolean function
Boolean functions can be represented and manipulated Boolean functions can be represented and manipulated in a variety of waysin a variety of ways
There is no single best representationThere is no single best representation
Boolean FunctionsBoolean Functions
A completely specified Boolean A completely specified Boolean function is a mapping function is a mapping BBnn BB, , where where BB = {0,1} = {0,1}
All other types of Boolean and All other types of Boolean and multi-valued functions and multi-valued functions and relations can be represented relations can be represented using completely specified using completely specified Boolean functionsBoolean functions
xx11 xx22 xx33 FF
00 00 00 00
00 00 11 00
00 11 00 00
00 11 11 11
11 00 00 00
11 00 11 11
11 11 00 00
11 11 11 11
Representations of Boolean Representations of Boolean FunctionsFunctions
Truth tableTruth table
xx11 xx22 xx33 FF
00 00 00 00
00 00 11 00
00 11 00 00
00 11 11 11
11 00 00 00
11 00 11 11
11 11 00 00
11 11 11 11
0000 0101 1111 1010
00 00 00 00 00
11 00 11 11 11
x1x2
x3
Karnaugh MapKarnaugh Map
Representations of Boolean Representations of Boolean FunctionsFunctions
Sum-of-products (DNF)Sum-of-products (DNF)F = xF = x11’x’x22xx33 + x + x11xx22’x’x33 + x + x11xx22xx33
Product-of-sums (CNF)Product-of-sums (CNF)F = (xF = (x11+x+x22+x+x33) & (x) & (x11+x+x22+x+x33’) &’) &
(x(x11+x+x22’+x’+x33) & (x) & (x11’+x’+x22+x+x33) &) &
(x(x11’+x’+x22’+x’+x33) )
Exclusive sum-of-productsExclusive sum-of-productsF = xF = x33 x x11’x’x22’x’x33
Factored formFactored formF = xF = x33 (x (x11+x+x22))
BDDBDD
x1
x3
x2
10X1
X3
X2
AND/INV AND/INV graphgraph
Canonicity of a RepresentationCanonicity of a Representation A representation is A representation is canonicalcanonical if for each function if for each function
under certain conditionsunder certain conditions there exists only one there exists only one representationrepresentation
Examples:Examples: Truth table is Truth table is canonicalcanonical
• given the ordering of mintermsgiven the ordering of minterms BDD is BDD is canonicalcanonical
• given the ordering of input variablesgiven the ordering of input variables SOP is SOP is not canonicalnot canonical
• but under some conditions it becomes canonicalbut under some conditions it becomes canonical the set of all mintermsthe set of all minterms the set of all primesthe set of all primes ISOP computed using Minato-Morreale algorithm when the ISOP computed using Minato-Morreale algorithm when the
ordering of variables is fixedordering of variables is fixed
Binary Decision DiagramsBinary Decision Diagrams
Formal definitionFormal definition Informal definitionInformal definition Deriving BDD using the definitionDeriving BDD using the definition Deriving BDD from the truth tableDeriving BDD from the truth table The effect of variable orderingThe effect of variable ordering Boolean operations on the BDDBoolean operations on the BDD Computing BDD from the CircuitComputing BDD from the Circuit BDD packageBDD package
Formal DefinitionFormal Definition• Definition.Definition. Let Let ff: {0,1}: {0,1}nn {0,1} be a Boolean function where the {0,1} be a Boolean function where the
arguments to arguments to ff are denoted by a set of variables are denoted by a set of variables VV, such that |, such that |VV|=|=nn. . Let Let : : VV {1,…,{1,…,nn} be a bijection indicating a total ordering of these } be a bijection indicating a total ordering of these variables. That is, we consider variable variables. That is, we consider variable xx and and yy to be ordered to be ordered xx < < yy when when ((xx) < ) < ((yy). An ). An Ordered Binary Decision DiagramOrdered Binary Decision Diagram (OBDD) (OBDD) PP for for ff with respect to the given ordering with respect to the given ordering is a directed acyclic graph is a directed acyclic graph consisting of nonterminal nodes labeled by the variables in consisting of nonterminal nodes labeled by the variables in VV and and terminal nodes labeled by the Boolean constants 1 and 0. Each terminal nodes labeled by the Boolean constants 1 and 0. Each nonterminal node has two outgoing edges: the 1-edge and the 0-nonterminal node has two outgoing edges: the 1-edge and the 0-edge. The OBDD has a starting node called the root. The edge. The OBDD has a starting node called the root. The computation of computation of ff((aa) follows a path from the root to a terminal node, ) follows a path from the root to a terminal node, where at a node labeled by where at a node labeled by xx, if , if aa((xx) = 1, the path follows the 1-) = 1, the path follows the 1-edge, and otherwise it follows the 0-edge. The value of the reached edge, and otherwise it follows the 0-edge. The value of the reached terminal node determines the value of terminal node determines the value of ff((aa). On a path from the root ). On a path from the root to the sink, each variable occurs at most once. The variables on to the sink, each variable occurs at most once. The variables on every path from the root to a terminal node respect ordering every path from the root to a terminal node respect ordering . That . That is, for an edge leading from a node labeled by is, for an edge leading from a node labeled by xx to one labeled by to one labeled by yy, we must have , we must have ((xx) < ) < ((yy). ).
• R. E. Bryant, and C. Meinel, ``Ordered Binary Decision Diagrams,'' R. E. Bryant, and C. Meinel, ``Ordered Binary Decision Diagrams,'' in in Logic Synthesis and VerificationLogic Synthesis and Verification, S. Hassoun and T. Sasao, , S. Hassoun and T. Sasao, eds.eds., , Kluwer Academic Publishers, 2001.Kluwer Academic Publishers, 2001.
Informal DefinitionInformal Definition Negative (positive) cofactorNegative (positive) cofactor of of F(x,y,z)F(x,y,z) w.r.t. w.r.t. xx is the is the
result of substituting result of substituting 0(1)0(1) into into F(x,y,z)F(x,y,z) instead of instead of variable variable xxF0 = F(0,y,z) F1 = F(1,y,z)F0 = F(0,y,z) F1 = F(1,y,z)
Binary decision diagramBinary decision diagram of function of function FF is a direct is a direct acyclic graph, in whichacyclic graph, in which
Each node stands for a function and two incoming edges of Each node stands for a function and two incoming edges of this node represent cofactors of this function w.r.t. a variable. this node represent cofactors of this function w.r.t. a variable.
The leaves of the graph represent constant functions, while The leaves of the graph represent constant functions, while the root represents function the root represents function FF
The same variable order is used for all pathsThe same variable order is used for all paths The graph is reducedThe graph is reduced
Examples of BDDsExamples of BDDs
a1
a2
b1
10
b2
10
a
10
a
F = a
F = a
a
10
b
a
10
b
F = ab
F = a+b
a1
a2
b1
10
b2
F=a1b1+ a2b2 F=a1b1+a2+b2
F=11
Shannon ExpansionShannon Expansion
Shannon expansion isShannon expansion isF(x, y, z) = x’ & F0 + x & F1F(x, y, z) = x’ & F0 + x & F1
Shannon expansion is canonicalShannon expansion is canonical For the given function For the given function FF and variable and variable xx, the cofactors , the cofactors
F0F0 and and F1 F1 are uniquely determinedare uniquely determined Another informal definition of BDD:Another informal definition of BDD:
The Shannon expansion is recursively applied to the The Shannon expansion is recursively applied to the function and its cofactorsfunction and its cofactors
A new node is added to mark each expansionA new node is added to mark each expansion The same variable order is used for all pathsThe same variable order is used for all paths The graph is reducedThe graph is reduced
Deriving BDD using Shannon Deriving BDD using Shannon ExpansionExpansion
x1
x3
x2
10
F = x3 (x1+x2)F = x3 (x1+x2)
F0 =F0 = F|F|x1=0x1=0 = x2x3 = x2x3
F1 =F1 = F|F|x1=1x1=1 = x3 = x3
F0 = x2x3 F0 = x2x3
F00|F00|x2=0x2=0 = 0 = 0
F01|F01|x2=1x2=1 = x3 = x3
x1
FF
F0F0F1F1
x2
F0F0
FF
F0F0
F01F01
x3
10
x3
10
F01F01
0
F00F00 F00F00
Deriving BDD from Truth TableDeriving BDD from Truth Table
x1
x3
x2
x3x3x3
10
x2
110 0 0 0
xx11 00 00 00 00 11 11 11 11
xx22 00 00 11 11 00 00 11 11
xx33 00 11 00 11 00 11 00 11
FF 00 00 00 11 00 11 00 110 1
1010
0 1 0 1 0 1 0 1
Reduction of a Decision TreeReduction of a Decision Tree
Rule 1: Isomorphic nodes are merged
Rule 2: Redundant nodes are removed
a a
b b
a
b b
a
b b
Example of Decision Tree Example of Decision Tree ReductionReduction
x1
x3
x2
x3x3x3
10
x2
110 0 0 0
Example of Decision Tree Example of Decision Tree ReductionReduction
x1
x3
x2
x3 x3x3
x2
10
x1
x3
x2
x3
x2
10
x1
x3
x2
10
BDDDecision tree reduction
Parts of a BDD (and their meaning) Parts of a BDD (and their meaning)
NodesNodes (Boolean functions)(Boolean functions) Terminal nodesTerminal nodes (constant Boolean functions) (constant Boolean functions) EdgesEdges (function/co-factor relationship) (function/co-factor relationship) PathsPaths (true/false variable assignments) (true/false variable assignments) CutsCuts (variable partitions) (variable partitions) Nodes pointed to under a cutNodes pointed to under a cut (the set of (the set of
different cofactors of the function w.r.t. different cofactors of the function w.r.t. variables above the cut)variables above the cut)
Derived parameters:Derived parameters: Number of nodesNumber of nodes (complexity of the function) (complexity of the function) Average path length Average path length (speed of evaluation of the (speed of evaluation of the
function)function)
x1
x3
x2
10
Effect of Variable Ordering on the Effect of Variable Ordering on the BDD sizeBDD size
x1
y1 y1
x2
y2y2
10
x1 < y1 < x2 < y2 x1 < x2 < y1 < y2 x1
x2 x2
y1
y2y2
10
y1y1 y1
F(x1, x2, y1, y2) = (x1 = y1) & (x2 = y2)
Another ExampleAnother Example
a1
a2
b1
10
b2
a1<b1<a2< b2
a1
b1
a2
10
b2
a2
b1
a1<a2<b1< b2
F=aF=a11bb11+ a+ a22bb22
Operations on BDDsOperations on BDDs
Apply – NOT, AND, OR, EXOR, etc.Apply – NOT, AND, OR, EXOR, etc. Quantification (existential, universal, unique)Quantification (existential, universal, unique) Substitute variablesSubstitute variables ComposeCompose Specialized operators Specialized operators
Generalized cofactor (constrain)Generalized cofactor (constrain) Restrict Restrict Compatible projectionCompatible projection etc.etc.
IF-THEN-ELSE (ITE) OperatorIF-THEN-ELSE (ITE) Operator ITE operatorITE operator
ITE( F, G, H ) = F & G + F’ & HITE( F, G, H ) = F & G + F’ & H It can be shown that a cofactor of ITE is the ITE of It can be shown that a cofactor of ITE is the ITE of
cofactorscofactors
ITE( F, G, H )|ITE( F, G, H )|x = 0x = 0 = ITE(F0, G0, H0) = ITE(F0, G0, H0) Computation of Boolean operations is based on the Computation of Boolean operations is based on the
Shannon expansionShannon expansionITE(F,G,H) = ITE(F,G,H) =
= ITE(x, ITE(F, G, H)|= ITE(x, ITE(F, G, H)|x = 0x = 0, ITE(F, G, G)|, ITE(F, G, G)|x = 1x = 1 ) )
= ITE(x, ITE(F0, G0, H0= ITE(x, ITE(F0, G0, H0’’), ITE(F1, G1, H1) )), ITE(F1, G1, H1) )
APPLY operatorAPPLY operator
APPLY( F, G )APPLY( F, G ) operator is a shorthand for any two- operator is a shorthand for any two-variable Boolean operationvariable Boolean operation
APPLYAPPLY is reducible to is reducible to ITEITE Example: Example: AND( F, G ) = ITE( F, G, 0 )AND( F, G ) = ITE( F, G, 0 )
It follows that It follows that APPLYAPPLY can be computed recursively just can be computed recursively just like like ITEITE
APPLY(F,G) = x’ & APPLY(F0, G0) +APPLY(F,G) = x’ & APPLY(F0, G0) +
x & APPLY(F1, G1)x & APPLY(F1, G1)
APPLY Pseudocode APPLY Pseudocode procedure procedure ApplyApply( bdd F, bdd G )( bdd F, bdd G ){{
ifif ( ( IsAlreadyComputedIsAlreadyComputed( F, G ) ) ( F, G ) ) returnreturn result; result;ifif ( F ( F {0,1} && G {0,1} && G {0,1} ) {0,1} ) returnreturn APPLY_TABLE( F, G ); APPLY_TABLE( F, G );ifif ( ( VarVar( F ) == ( F ) == VarVar( G ) )( G ) )
u = u = CreateNodeCreateNode( ( VarVar(F), (F), ApplyApply(Fx’,Gx’), (Fx’,Gx’), ApplyApply(Fx,Gx));(Fx,Gx));else if else if ( ( VarVar( F ) < ( F ) < VarVar( G ) )( G ) )
u = u = CreateNodeCreateNode( ( VarVar(F) , (F) , ApplyApply(Fx’,G ), (Fx’,G ), ApplyApply(Fx,G ));(Fx,G ));else else /* if ( Var( F ) > Var( G ) ) *//* if ( Var( F ) > Var( G ) ) */
u = u = CreateNodeCreateNode( ( VarVar(G) , (G) , ApplyApply(F,Gx’ ), (F,Gx’ ), ApplyApply(F,Gx ));(F,Gx ));InsertComputedInsertComputed( F,G,u );( F,G,u );returnreturn u; u;
}}
F=ac+bc+d G=ac’+d F+G =F=ac+bc+d G=ac’+d F+G = ? ?
a
d
c
b
10
a
c
d
10
+
A1
A2
A6
A3
B1
B5
B2
A4 A5 B3 B4
A1,B1
A2,B2
A6,B2
A3,B2
A4,B3 A5,B4
A6,B5
A5,B2 A3,B4
QuantificationQuantification Given a function Given a function F(xF(x11, x, x22, x, x33))
Existential quantificationExistential quantification of of FF w.r.t. w.r.t. xx11 isis
x1 x1 F(xF(x11, x, x22, x, x33) = F(0, x) = F(0, x22, x, x33) + F(1, x) + F(1, x22, x, x33)) Universal quantificationUniversal quantification of of FF w.r.t. w.r.t. xx11 is is
x1 x1 F(xF(x11, x, x22, x, x33) = F(0, x) = F(0, x22, x, x33) & F(1, x) & F(1, x22, x, x33)) Unique quantificationUnique quantification of of FF w.r.t. w.r.t. xx11 isis
!!x1 x1 F(xF(x11, x, x22, x, x33) = F(0, x) = F(0, x22, x, x33) ) F(1, x F(1, x22, x, x33))
Quantification is generalized to a set of variables by Quantification is generalized to a set of variables by applying it w.r.t each variable in the setapplying it w.r.t each variable in the set
Example of QuantificationExample of Quantification
cdcdabab 0000 0101 1111 1010
0000 00 00 00 000101 00 00 11 001111 11 11 11 111010 11 11 00 00
cdcd
0000 000101 111111 111010 11
cdcd
0000 000101 001111 111010 00
F(a,b,c,d) = ac + cd + abd
H(c,d)=abF(a,b,c,d)
H
G(c,d)=abF(a,b,c,d)
F G
Deriving BDDs from the CircuitDeriving BDDs from the Circuit
The nodes of the circuit are visited The nodes of the circuit are visited recursively starting from the POsrecursively starting from the POs
If the node is a PI, its global If the node is a PI, its global function is an elementary variablefunction is an elementary variable
If the node is an internal nodeIf the node is an internal node the computation is performed the computation is performed
recursively for the faninsrecursively for the fanins the global function of the node is the global function of the node is
computed by composing its local computed by composing its local function with the global functions of function with the global functions of the faninsthe fanins
ba c d e f g h
Fi
F1F2
o1 o2 o3
Properties of BDDsProperties of BDDs
Small size Small size for many practical for many practical
functionsfunctions
Fast manipulationFast manipulation the smaller the fasterthe smaller the faster
CanonicityCanonicity ease of cachingease of caching useful for verificationuseful for verification
Large size Large size for complex functions for complex functions
(i.e. multipliers)(i.e. multipliers)
Slow manipulationSlow manipulation the larger, the slowerthe larger, the slower
Implicit ComputationImplicit Computation With BDDs it is possible to construct and manipulate With BDDs it is possible to construct and manipulate
sets of discrete objects (cubes, states, etc.) in an sets of discrete objects (cubes, states, etc.) in an implicit manner (without explicitly enumerating implicit manner (without explicitly enumerating individual elements). individual elements).
As a result, BDDs may allow for an efficient As a result, BDDs may allow for an efficient computation when explicit methods fail:computation when explicit methods fail:
Reachability analysisReachability analysis• Symbolic model checkingSymbolic model checking• Sequential equivalence checkingSequential equivalence checking
Exact SOP minimizationExact SOP minimization Heuristic ESOP minimizationHeuristic ESOP minimization Computation of symmetries of Boolean functionsComputation of symmetries of Boolean functions Computation of spectra (Walsh, Haar, Reed-Muller, etc)Computation of spectra (Walsh, Haar, Reed-Muller, etc) Manipulation of discrete matricesManipulation of discrete matrices
BDD PackageBDD Package
Stores nodes in the hash tableStores nodes in the hash table The cofactoring variable and the two cofactors are The cofactoring variable and the two cofactors are
used as a key for hashing the nodeused as a key for hashing the node
The computed tables stores the results of The computed tables stores the results of intermediate computationsintermediate computations Reduces the complexity of computation from Reduces the complexity of computation from
exponential to linearexponential to linear
Periodically performs garbage collections and Periodically performs garbage collections and dynamic variable reorderingdynamic variable reordering
Introduction to BDDs: ReferencesIntroduction to BDDs: References
R. E. Bryant.R. E. Bryant. Symbolic Boolean Manipulation with Ordered Symbolic Boolean Manipulation with Ordered Binary Decision Diagrams.Binary Decision Diagrams. ACM Computing SurveysACM Computing Surveys, Vol. , Vol. 24, No. 3 (September, 1992), pp. 293-318. 24, No. 3 (September, 1992), pp. 293-318.
Henrik Reif Andersen. Henrik Reif Andersen. An Introduction to Binary Decision An Introduction to Binary Decision Diagrams.Diagrams. Dept. of Information Technology, Technical Dept. of Information Technology, Technical University of Denmark, 1997. University of Denmark, 1997.
http://www.itu.dk/people/hra/notes-index.htmlhttp://www.itu.dk/people/hra/notes-index.html F. Somenzi.F. Somenzi. Binary Decision Diagrams (TutorialBinary Decision Diagrams (Tutorial), University ), University
of Colorado, 1999, of Colorado, 1999, http://citeseer.nj.nec.com/somenzi99binary.htmlhttp://citeseer.nj.nec.com/somenzi99binary.html
Boolean SatisfiabilityBoolean Satisfiability
DefinitionDefinition Search for a satisfying assignmentSearch for a satisfying assignment Computation using SATComputation using SAT Computing CNF from the CircuitComputing CNF from the Circuit SAT solverSAT solver
DefinitionDefinition
Given a CNF formula Given a CNF formula representing a representing a Boolean function Boolean function f(x1,…,xn),f(x1,…,xn), the the satisfiability satisfiability problemproblem is is
identifying a assignment to the formula variables, identifying a assignment to the formula variables, {x1 = v1, x2 = v2, …, xn = vn},{x1 = v1, x2 = v2, …, xn = vn}, such that all clauses such that all clauses are satisfied, i.e. are satisfied, i.e. f(v1,…,vn) = 1,f(v1,…,vn) = 1,
or proving that such assignment does not existor proving that such assignment does not exist
ExampleExample
(a + b + c)
(a + b + c’)
(a’ + b + c’)
(a + c + d)
(a’ + c + d)
(a’ + c + d’)
(b’ + c’ + d’)
(b’ + c’ + d)
0000 0101 1111 1010
0000 00 00 00 000101 00 11 00 001111 00 00 00 001010 00 00 00 00
ab
cd
Cube: bcd’
Clause: b’ + c’ + d
CNF
CommentComment
Such a simple problem and so much effort to solve itSuch a simple problem and so much effort to solve it because the size of CNF used in practice is very largebecause the size of CNF used in practice is very large
The best known solution is Davis-Logemann-Loveland The best known solution is Davis-Logemann-Loveland (DLL) procedure, which perform exhaustive search with (DLL) procedure, which perform exhaustive search with back-trackingback-tracking
This procedure is efficient because of a combination of This procedure is efficient because of a combination of good heuristics and smart data structuresgood heuristics and smart data structures
Conflict analysis with clause recording Conflict analysis with clause recording Non-chronological backtrackingNon-chronological backtracking Variable selection heuristicsVariable selection heuristics Random restartsRandom restarts Two literal clause watching, etcTwo literal clause watching, etc
Search for a Satisfying AssignmentSearch for a Satisfying Assignment
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + ¬d)
(¬b + ¬c + d)
1
2
3
4
5
6
7
8
a(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + ¬d)
(¬b + ¬c + d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + ¬d)
(¬b + ¬c + d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + ¬d)
(¬b + ¬c + d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + ¬d)
(¬b + ¬c + d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + ¬d)
(¬b + ¬c + d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + ¬d)
(¬b + ¬c + d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + ¬d)
(¬b + ¬c + d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + ¬d)
(¬b + ¬c + d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + ¬d)
(¬b + ¬c + d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + ¬d)
(¬b + ¬c + d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + ¬d)
(¬b + ¬c + d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + ¬d)
(¬b + ¬c + d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + ¬d)
(¬b + ¬c + d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + ¬d)
(¬b + ¬c + d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + ¬d)
(¬b + ¬c + d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + ¬d)
(¬b + ¬c + d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + ¬d)
(¬b + ¬c + d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + ¬d)
(¬b + ¬c + d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + ¬d)
(¬b + ¬c + d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + ¬d)
(¬b + ¬c + d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + ¬d)
(¬b + ¬c + d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + ¬d)
(¬b + ¬c + d)
(¬b + ¬c + ¬d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + d)
(¬b + ¬c + ¬d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + d)
(¬b + ¬c + ¬d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + d)
(¬b + ¬c + ¬d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + d)
(¬b + ¬c + ¬d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + d)
(¬b + ¬c + ¬d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + d)
(¬b + ¬c + ¬d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + d)
(¬b + ¬c + ¬d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + d)
(¬b + ¬c + ¬d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + d)
b
c
d d
b
c
d d
c
d(¬b + ¬c + ¬d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + d)
(¬b + ¬c + ¬d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + d)
(¬b + ¬c + ¬d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + d)
(¬b + ¬c + ¬d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + d)
(¬b + ¬c + ¬d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + d)
(¬b + ¬c + ¬d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + d)
(¬b + ¬c + ¬d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + d)
(¬b + ¬c + ¬d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + d)
(¬b + ¬c + ¬d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + d)
(¬b + ¬c + ¬d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + d)
(¬b + ¬c + ¬d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + d)
(¬b + ¬c + ¬d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + d)
(¬b + ¬c + ¬d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + d)
(¬b + ¬c + ¬d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + d)
(¬b + ¬c + ¬d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + d)
(¬b + ¬c + ¬d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + d)
(¬b + ¬c + ¬d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + d)
(¬b + ¬c + ¬d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + d)
(¬b + ¬c + ¬d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + d)
(¬b + ¬c + ¬d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + d)
(¬b + ¬c + ¬d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + d)
(¬b + ¬c + ¬d)
(a + b + c)
(a + b + ¬c)
(¬a + b + ¬c)
(a + c + d)
(¬a + c + d)
(¬a + c + ¬d)
(¬b + ¬c + d)
Courtesy Karem Sakallah, University of Michigan
Computation using SATComputation using SAT
The classical SAT is a “yes/no” thingThe classical SAT is a “yes/no” thing It returns one satisfying assignment, or no assignment if the It returns one satisfying assignment, or no assignment if the
problem is UNSATproblem is UNSAT If a conflict occurs during search, SAT solver generates a If a conflict occurs during search, SAT solver generates a
conflict clause and continues exploring the search spaceconflict clause and continues exploring the search space It is possible to have SAT enumerate through the It is possible to have SAT enumerate through the
satisfying assignments of the problemsatisfying assignments of the problem for this, each satisfying assignment is treated similar to a conflictfor this, each satisfying assignment is treated similar to a conflict a new clause (“blocking clause”) is added and search continuesa new clause (“blocking clause”) is added and search continues
For large boolean spaces, it is very important to For large boolean spaces, it is very important to generate satisfying assignments in the form of cubes generate satisfying assignments in the form of cubes rather than mintermsrather than minterms
There are several methods for doing thisThere are several methods for doing this
Boolean operations using SATBoolean operations using SAT ComplementComplement
Enumerate through the satisfying assignments and collect all blocking Enumerate through the satisfying assignments and collect all blocking clausesclauses
Boolean AND Boolean AND put CNF clauses of arguments togetherput CNF clauses of arguments together
Other Boolean operationsOther Boolean operations reducible to complement and Boolean ANDreducible to complement and Boolean AND
CompositionComposition renaming variables and appending clausesrenaming variables and appending clauses
Universal quantificationUniversal quantification omitting the quantified variables in all CNF clausesomitting the quantified variables in all CNF clauses
Existential quantificationExistential quantification reduced to universal and two complementsreduced to universal and two complements
FxFx
Deriving CNF from the CircuitDeriving CNF from the Circuit The CNF formula for each node is computedThe CNF formula for each node is computed
One way of computing a CNF for the node is applying de Morgan rule One way of computing a CNF for the node is applying de Morgan rule to the SOP of the off-set of the node’s functionto the SOP of the off-set of the node’s function
Another way is to use AND/INV graph representation of the node’s Another way is to use AND/INV graph representation of the node’s on-set, and add clauses for each gate in the graphon-set, and add clauses for each gate in the graph
The CNF of the network is derived by putting together (ANDing) The CNF of the network is derived by putting together (ANDing) the CNFs for each nodethe CNFs for each node
For single output circuits, if only the positive (negative) phase of For single output circuits, if only the positive (negative) phase of the circuit function is needed, the literal the circuit function is needed, the literal p (p’)p (p’) is added to the CNF, is added to the CNF, where where p (p’)p (p’) is the positive (negative) phase of the output variable is the positive (negative) phase of the output variable of the PO nodeof the PO node
SAT SolverSAT Solver Stores clauses as arrays of integersStores clauses as arrays of integers Makes decisions and propagates implicationsMakes decisions and propagates implications When conflict occurs, adds a conflict clause to the When conflict occurs, adds a conflict clause to the
problemproblem When a satisfying assignment is found, while When a satisfying assignment is found, while
enumerating through all satisfying assignments, enumerating through all satisfying assignments, adds a breaking clause to the problemadds a breaking clause to the problem
Periodically removes inactive clausesPeriodically removes inactive clauses Implements restartsImplements restarts
Surprise: A state-of-the-art SAT solver can be Surprise: A state-of-the-art SAT solver can be implemented in 600 lines of C++ code!!!implemented in 600 lines of C++ code!!!
Introduction to SAT: ReferencesIntroduction to SAT: References
J.P. Marques-Silva, K.A. SakallahJ.P. Marques-Silva, K.A. Sakallah ``GRASP: A Search ``GRASP: A Search Algorithm for Propositional Satisfiability''Algorithm for Propositional Satisfiability'' in IEEE in IEEE Transactions on Computers, vol 48, pp. 506--521, 1999. Transactions on Computers, vol 48, pp. 506--521, 1999.
W. Kunz, J. Marques-Silva, S. Malik.W. Kunz, J. Marques-Silva, S. Malik. SAT and ATPG: SAT and ATPG: Algorithms for Boolean Decision Problems, Algorithms for Boolean Decision Problems, in in Logic Logic Synthesis and VerificationSynthesis and Verification, S. Hassoun and T. Sasao, , S. Hassoun and T. Sasao, eds.eds., , Kluwer Academic Publishers, 2001.Kluwer Academic Publishers, 2001.
N. Eén, N.SörenssonN. Eén, N.Sörensson. . An Extensible SAT-solverAn Extensible SAT-solver. SAT 2003. . SAT 2003. http://www.cs.chalmers.se/~een/Satzoo/An_Extensible_SAThttp://www.cs.chalmers.se/~een/Satzoo/An_Extensible_SAT-solver.ps.gz-solver.ps.gz