430 likes | 443 Views
Dive into the formulation and computation of Boolean functions using Binary Decision Diagrams (BDDs) and the Satisfiability (SAT) concept. Learn about representations, canonicity, and operations with practical applications in mind.
E N D
Computation Engines: BDDs and SAT(part 1) 290N: The Unknown Component Problem Lecture 7
Outline • Formulation and computation • Representations of Boolean functions • Canonicity of a representation • Binary decision diagrams (BDDs) • Definition, properties, applications, etc • Boolean operations using BDDs • Deriving BDDs from the circuit • Satisfiability (SAT) • Search, implications, branch-and-bound, etc • Boolean operations using SAT • Deriving CNF from the circuit
Formulation and Computation • Formulation • Uses formalisms (such as automata theory, etc) • Requires some statements to be proved • Is not always concerned with how practical it is • Computation • Relies on formulation • Looks into algorithms and data structures • Is important for practical applications
Computation in Discrete Domain • Is performed by a variety of applications in computer science and engineering • Represents and manipulates various discrete objects (functions, relations, sets, automata, FSMs, etc.) • The most fundamental object seems to be a completely specified Boolean function • Boolean functions can be represented and manipulated in a variety of ways • There is no single best representation
Boolean Functions • A completely specified Boolean function is a mapping Bn B, where B = {0,1} • All other types of Boolean and multi-valued functions and relations can be represented using completely specified Boolean functions
Representations of Boolean Functions • Truth table • Karnaugh Map x1x2 x3
Representations of Boolean Functions • BDD • Sum-of-products (DNF) F = x1’x2x3 + x1x2’x3 + x1x2x3 • Product-of-sums (CNF) F = (x1+x2+x3) & (x1+x2+x3’) & (x1+x2’+x3) & (x1’+x2+x3) & (x1’+x2’+x3) • Exclusive sum-of-products F = x3 x1’x2’x3 • Factored form F = x3 (x1+x2) • AND/INV graph x1 x2 X3 x3 X1 X2 0 1
Canonicity of a Representation • A representation is canonical if for each function under certain conditions there exists only one representation • Examples: • Truth table is canonical • given the ordering of minterms • BDD is canonical • given the ordering of input variables • SOP is not canonical • but under some conditions it becomes canonical • the set of all minterms • the set of all primes • ISOP computed using Minato-Morreale algorithm when the ordering of variables is fixed
Binary Decision Diagrams • Formal definition • Informal definition • Deriving BDD using the definition • Deriving BDD from the truth table • The effect of variable ordering • Boolean operations on the BDD • Computing BDD from the Circuit • BDD package
Formal Definition • Definition. Let f: {0,1}n {0,1} be a Boolean function where the arguments to f are denoted by a set of variables V, such that |V|=n. Let : V {1,…,n}be a bijection indicating a total ordering of these variables. That is, we consider variable x and y to be ordered x < y when (x) < (y). An Ordered Binary Decision Diagram (OBDD) P for f with respect to the given ordering is a directed acyclic graph consisting of nonterminal nodes labeled by the variables in V and terminal nodes labeled by the Boolean constants 1 and 0. Each nonterminal node has two outgoing edges: the 1-edge and the 0-edge. The OBDD has a starting node called the root. The computation of f(a) follows a path from the root to a terminal node, where at a node labeled by x, if a(x) = 1, the path follows the 1-edge, and otherwise it follows the 0-edge. The value of the reached terminal node determines the value of f(a). On a path from the root to the sink, each variable occurs at most once. The variables on every path from the root to a terminal node respect ordering . That is, for an edge leading from a node labeled by x to one labeled by y, we must have (x) < (y). • R. E. Bryant, and C. Meinel, ``Ordered Binary Decision Diagrams,'' in Logic Synthesis and Verification, S. Hassoun and T. Sasao, eds., Kluwer Academic Publishers, 2001.
Informal Definition • Negative (positive) cofactor of F(x,y,z) w.r.t. x is the result of substituting 0(1) into F(x,y,z) instead of variable x F0 = F(0,y,z) F1 = F(1,y,z) • Binary decision diagram of function F is a direct acyclic graph, in which • Each node stands for a function and two incoming edges of this node represent cofactors of this function w.r.t. a variable. • The leaves of the graph represent constant functions, while the root represents function F • The same variable order is used for all paths • The graph is reduced
Examples of BDDs a a1 a a1 b b1 b1 0 1 0 1 a2 F = a F = ab a2 a b2 1 b2 a F=1 b 0 1 0 1 0 1 0 1 F=a1b1+ a2b2 F=a1b1+a2+b2 F = a F = a+b
Shannon Expansion • Shannon expansion is F(x, y, z) = x’ & F0 + x & F1 • Shannon expansion is canonical • For the given function F and variable x, the cofactors F0 and F1 are uniquely determined • Another informal definition of BDD: • The Shannon expansion is recursively applied to the function and its cofactors • A new node is added to mark each expansion • The same variable order is used for all paths • The graph is reduced
Deriving BDD using Shannon Expansion F F = x3 (x1+x2) F0 =F|x1=0 = x2x3 F1 =F|x1=1 = x3 F x1 x1 F1 F0 x3 F0 x2 0 1 F01 x3 F0 F0 = x2x3 F00|x2=0 = 0 F01|x2=1 = x3 x2 F00 F00 F01 0 1 x3 0 0 1
Deriving BDD from Truth Table x1 1 0 x2 x2 0 1 0 1 x3 x3 x3 x3 1 0 0 1 0 1 0 1 1 0 0 0 1 0 0 1
Reduction of a Decision Tree Rule 1: Isomorphic nodes are merged Rule 2: Redundant nodes are removed a a a a b b b b b b
Example of Decision Tree Reduction x1 x2 x2 x3 x3 x3 x3 0 0 0 1 0 1 0 1
Example of Decision Tree Reduction x1 x1 x1 x2 x2 x2 x2 x2 x3 x3 x3 x3 x3 x3 x3 0 1 0 1 0 1 reduction Decision tree BDD
Parts of a BDD (and their meaning) • Nodes(Boolean functions) • Terminal nodes (constant Boolean functions) • Edges (function/co-factor relationship) • Paths (true/false variable assignments) • Cuts (variable partitions) • Nodes pointed to under a cut (the set of different cofactors of the function w.r.t. variables above the cut) • Derived parameters: • Number of nodes (complexity of the function) • Average path length (speed of evaluation of the function) x1 x2 x3 0 1
Effect of Variable Ordering on the BDD size F(x1, x2, y1, y2) = (x1 = y1) & (x2 = y2) x1 < y1 < x2 < y2 x1 < x2 < y1 < y2 x1 x1 y1 y1 x2 x2 x2 y1 y1 y1 y1 y2 y2 y2 y2 0 1 0 1
Another Example F=a1b1+ a2b2 a1 a1 b1 a2 a2 a2 b1 b1 b2 b2 0 1 0 1 a1<b1<a2<b2 a1<a2<b1<b2
Operations on BDDs • Apply – NOT, AND, OR, EXOR, etc. • Quantification (existential, universal, unique) • Substitute variables • Compose • Specialized operators • Generalized cofactor (constrain) • Restrict • Compatible projection • etc.
IF-THEN-ELSE (ITE) Operator • ITE operator ITE( F, G, H ) = F & G + F’ & H • It can be shown that a cofactor of ITE is the ITE of cofactors ITE( F, G, H )|x = 0 = ITE(F0, G0, H0) • Computation of Boolean operations is based on the Shannon expansion ITE(F,G,H) = = ITE(x, ITE(F, G, H)|x = 0, ITE(F, G, G)|x = 1 ) = ITE(x, ITE(F0, G0, H0’), ITE(F1, G1, H1) )
APPLY operator • APPLY( F, G ) operator is a shorthand for any two-variable Boolean operation • APPLY is reducible to ITE • Example: AND( F, G ) = ITE( F, G, 0 ) • It follows that APPLY can be computed recursively just like ITE APPLY(F,G) = x’ & APPLY(F0, G0) + x & APPLY(F1, G1)
APPLY Pseudocode procedure Apply( bdd F, bdd G ) { if ( IsAlreadyComputed( F, G ) ) return result; if ( F {0,1} && G {0,1} ) return APPLY_TABLE( F, G ); if ( Var( F ) == Var( G ) ) u = CreateNode( Var(F), Apply(Fx’,Gx’), Apply(Fx,Gx)); else if ( Var( F ) < Var( G ) ) u = CreateNode( Var(F) , Apply(Fx’,G ), Apply(Fx,G )); else /* if ( Var( F ) > Var( G ) ) */ u = CreateNode( Var(G) , Apply(F,Gx’ ), Apply(F,Gx )); InsertComputed( F,G,u ); return u; }
F=ac+bc+d G=ac’+d F+G = ? A1,B1 A1 B1 a a A2,B2 A2 b A6,B2 A6,B5 + A6 B5 c c B2 A3,B2 A5,B2 A3 A3,B4 d d A4,B3 A5,B4 0 1 0 1 B3 B4 A4 A5
Quantification • Given a function F(x1, x2, x3) • Existential quantification of F w.r.t.x1is x1 F(x1, x2, x3) = F(0, x2, x3) + F(1, x2, x3) • Universal quantification of F w.r.t.x1 is x1 F(x1, x2, x3) = F(0, x2, x3) & F(1, x2, x3) • Unique quantification of F w.r.t.x1is !x1 F(x1, x2, x3) = F(0, x2, x3) F(1, x2, x3) • Quantification is generalized to a set of variables by applying it w.r.t each variable in the set
Example of Quantification F(a,b,c,d) = ac + cd + abd G(c,d)=abF(a,b,c,d) H(c,d)=abF(a,b,c,d) G F H
Deriving BDDs from the Circuit • The nodes of the circuit are visited recursively starting from the POs • If the node is a PI, its global function is an elementary variable • If the node is an internal node • the computation is performed recursively for the fanins • the global function of the node is computed by composing its local function with the global functions of the fanins o2 o3 o1 Fi F1 F2 g h a b c d e f
Small size for many practical functions Fast manipulation the smaller the faster Canonicity ease of caching useful for verification Large size for complex functions (i.e. multipliers) Slow manipulation the larger, the slower Properties of BDDs
Implicit Computation • With BDDs it is possible to construct and manipulate sets of discrete objects (cubes, states, etc.) in an implicit manner (without explicitly enumerating individual elements). • As a result, BDDs may allow for an efficient computation when explicit methods fail: • Reachability analysis • Symbolic model checking • Sequential equivalence checking • Exact SOP minimization • Heuristic ESOP minimization • Computation of symmetries of Boolean functions • Computation of spectra (Walsh, Haar, Reed-Muller, etc) • Manipulation of discrete matrices
BDD Package • Stores nodes in the hash table • The cofactoring variable and the two cofactors are used as a key for hashing the node • The computed tables stores the results of intermediate computations • Reduces the complexity of computation from exponential to linear • Periodically performs garbage collections and dynamic variable reordering
Introduction to BDDs: References • R. E. Bryant.Symbolic Boolean Manipulation with Ordered Binary Decision Diagrams.ACM Computing Surveys, Vol. 24, No. 3 (September, 1992), pp. 293-318. • Henrik Reif Andersen. An Introduction to Binary Decision Diagrams. Dept. of Information Technology, Technical University of Denmark, 1997. http://www.itu.dk/people/hra/notes-index.html • F. Somenzi.Binary Decision Diagrams (Tutorial), University of Colorado, 1999, http://citeseer.nj.nec.com/somenzi99binary.html
Boolean Satisfiability • Definition • Search for a satisfying assignment • Computation using SAT • Computing CNF from the Circuit • SAT solver
Definition • Given a CNF formula representing a Boolean function f(x1,…,xn), the satisfiability problem is • identifying a assignment to the formula variables, {x1 = v1, x2 = v2, …, xn = vn}, such that all clauses are satisfied, i.e. f(v1,…,vn) = 1, • or proving that such assignment does not exist
Example CNF ab (a + b + c) (a + b + c’) (a’ + b + c’) (a + c + d) (a’ + c + d) (a’ + c + d’) (b’ + c’ + d’) (b’ + c’ + d) cd Cube: bcd’ Clause: b’ + c’ + d
Comment • Such a simple problem and so much effort to solve it • because the size of CNF used in practice is very large • The best known solution is Davis-Logemann-Loveland (DLL) procedure, which perform exhaustive search with back-tracking • This procedure is efficient because of a combination of good heuristics and smart data structures • Conflict analysis with clause recording • Non-chronological backtracking • Variable selection heuristics • Random restarts • Two literal clause watching, etc
(a+ b + c) (a+ b + c) (a+ b + c) (a+ b + c) (a+ b + c) (a+ b + c) (a+ b + c) (a+ b + c) (a+ b + c) (a+ b + c) 1 (a + b + c) (a+ b + c) (a+ b + c) (a+ b + c) (a+ b + c) (a+ b + c) (a+ b + c) (a+ b + c) (a+ b + c) (a+ b + c) (a+ b + c) (a+ b + c) (a+ b + c) (a+ b + c) (a+ b + c) (a+ b + c) (a+ b + c) (a + b + c) (a+ b + c) (a+ b + c) (a+ b + c) (a+ b + c) (a+ b + c) (a+ b + c) (a+ b + c) (a+ b + c) (a+ b + c) (a+ b + c) (a+ b + c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + c) (a+ b + c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + c) (a+ b + c) (a+ b + c) (a+ b + c) (a+ b + c) (a+ b + c) (a+ b + c) (a+ b + c) (a+ b + c) (a+ b + c) 2 (a + b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (a + b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + c) (a + b + ¬c) (a+ b + c) (a+ b + ¬c) (a+ b + c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + ¬c) (a+ b + ¬c) 3 (¬a + b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (¬a + b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (a+ b + ¬c) (¬a + b + ¬c) (a+ b + ¬c) (¬a+ b + ¬c) (a+ b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (a+ c + d) (a+ c + d) (a+ c + d) (a+ c + d) (¬a+ b + ¬c) (¬a+ b + ¬c) (a+ c + d) (a+ c + d) (a+ c + d) (a+ c + d) (a+ c + d) (a+ c + d) (¬a+ b + ¬c) (¬a + b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) (¬a+ b + ¬c) 4 (a + c + d) (a+ c + d) (a+ c + d) (a+ c + d) (a+ c + d) (a+ c + d) (a+ c + d) (a+ c + d) (a+ c + d) (a+ c + d) (a+ c + d) (a + c + d) (a+ c + d) (a+ c + d) (a+ c + d) (a+ c + d) (a+ c + d) (a+ c + d) (a+ c + d) (a+ c + d) (a+ c + d) (¬a+ b + ¬c) (¬a+ b + ¬c) (a + c + d) (a+ c + d) (¬a+ b + ¬c) (a+ c + d) (a+ c + d) (a+ c + d) (a+ c + d) (a+ c + d) (a+ c + d) (¬a+ c + d) (¬a+ c + d) (¬a+ c + d) (¬a+ c + d) (¬a+ c + d) (¬a+ c + d) (¬a+ c + d) (¬a+ c + d) (¬a+ c + d) (¬a+ c + d) (a+ c + d) (a+ c + d) (a + c + d) (a + c + d) (a+ c + d) (a+ c + d) (a+ c + d) (a+ c + d) (a+ c + d) (a+ c + d) (a+ c + d) (a+ c + d) 5 (¬a + c + d) (¬a+ c + d) (¬a+ c + d) (¬a + c + d) (¬a+ c + d) (¬a+ c + d) (¬a+ c + d) (¬a+ c + d) (¬a+ c + d) (¬a+ c + d) (¬a+ c + d) (¬a+ c + d) (¬a+ c + d) (¬a+ c + d) (¬a+ c + d) (¬a+ c + d) (¬a+ c + d) (¬a+ c + d) (¬a+ c + d) (¬a+ c + d) (¬a+ c + d) (¬a + c + d) (a+ c + d) (a+ c + d) (¬a+ c + d) (¬a+ c + d) (¬a+ c + d) (¬a + c + d) (¬a+ c + d) (¬a+ c + d) (¬a+ c + d) (a+ c + d) (¬a+ c + ¬d) (¬a+ c + ¬d) (¬a+ c + ¬d) (¬a+ c + ¬d) (¬a+ c + d) (¬a+ c + d) (¬a+ c + ¬d) (¬a+ c + ¬d) (¬a+ c + ¬d) (¬a+ c + ¬d) (¬a+ c + ¬d) (¬a+ c + ¬d) (¬a + c + d) (¬a + c + d) (¬a+ c + d) (¬a+ c + d) (¬a+ c + d) (¬a+ c + d) (¬a+ c + d) (¬a+ c + d) (¬a+ c + d) (¬a+ c + d) 6 (¬a + c + ¬d) (¬a+ c + ¬d) (¬a+ c + ¬d) (¬a+ c + ¬d) (¬a+ c + ¬d) (¬a + c + ¬d) (¬a+ c + ¬d) (¬a+ c + ¬d) (¬a+ c + ¬d) (¬a+ c + ¬d) (¬a+ c + ¬d) (¬a+ c + ¬d) (¬a+ c + ¬d) (¬a+ c + ¬d) (¬a+ c + ¬d) (¬a+ c + ¬d) (¬a+ c + ¬d) (¬a+ c + ¬d) (¬a+ c + ¬d) (¬a+ c + ¬d) (¬a+ c + ¬d) (¬a+ c + d) (¬a+ c + d) (¬a + c + ¬d) (¬a+ c + ¬d) (¬a+ c + d) (¬a+ c + ¬d) (¬a+ c + ¬d) (¬a + c + ¬d) (¬a+ c + ¬d) (¬a + c + ¬d) (¬a+ c + ¬d) (¬b+ ¬c + ¬d) (¬b+ ¬c + ¬d) (¬b+ ¬c + ¬d) (¬b+ ¬c + ¬d) (¬a+ c + ¬d) (¬a+ c + ¬d) (¬b+ ¬c + ¬d) (¬b+ ¬c + ¬d) (¬b+ ¬c + ¬d) (¬b+ ¬c + ¬d) (¬b+ ¬c + ¬d) (¬b+ ¬c + ¬d) (¬a + c + ¬d) (¬a + c + ¬d) (¬a+ c + ¬d) (¬a+ c + ¬d) (¬a+ c + ¬d) (¬a+ c + ¬d) (¬a+ c + ¬d) (¬a+ c + ¬d) (¬a+ c + ¬d) (¬a+ c + ¬d) 7 (¬b + ¬c + ¬d) (¬b+ ¬c + ¬d) (¬b+ ¬c + ¬d) (¬b+ ¬c + ¬d) (¬b+ ¬c + ¬d) (¬b+ ¬c + ¬d) (¬b + ¬c + ¬d) (¬b+ ¬c + ¬d) (¬b+ ¬c + ¬d) (¬b+ ¬c + ¬d) (¬b+ ¬c + ¬d) (¬b+ ¬c + ¬d) (¬b+ ¬c + ¬d) (¬b+ ¬c + ¬d) (¬b + ¬c + ¬d) (¬b+ ¬c + ¬d) (¬b + ¬c + ¬d) (¬b+ ¬c + ¬d) (¬b+ ¬c + ¬d) (¬b+ ¬c + ¬d) (¬b+ ¬c + ¬d) (¬a+ c + ¬d) (¬b + ¬c + ¬d) (¬a+ c + ¬d) (¬b+ ¬c + ¬d) (¬a+ c + ¬d) (¬b + ¬c + ¬d) (¬b + ¬c + ¬d) (¬b + ¬c + ¬d) (¬b + ¬c + ¬d) (¬b + ¬c + ¬d) (¬b+ ¬c + ¬d) (¬b+ ¬c + d) (¬b+ ¬c + d) (¬b+ ¬c + d) (¬b+ ¬c + d) (¬b+ ¬c + ¬d) (¬b+ ¬c + ¬d) (¬b+ ¬c + d) (¬b+ ¬c + d) (¬b+ ¬c + d) (¬b+ ¬c + d) (¬b+ ¬c + d) (¬b+ ¬c + d) (¬b + ¬c + ¬d) (¬b + ¬c + ¬d) (¬b+ ¬c + ¬d) (¬b+ ¬c + ¬d) (¬b+ ¬c + ¬d) (¬b+ ¬c + ¬d) (¬b+ ¬c + ¬d) (¬b + ¬c + ¬d) (¬b+ ¬c + ¬d) (¬b+ ¬c + ¬d) 8 (¬b + ¬c + d) (¬b+ ¬c + d) (¬b+ ¬c + d) (¬b+ ¬c + d) (¬b+ ¬c + d) (¬b+ ¬c + d) (¬b+ ¬c + d) (¬b+ ¬c + d) (¬b + ¬c + d) (¬b+ ¬c + d) (¬b+ ¬c + d) (¬b + ¬c + d) (¬b+ ¬c + d) (¬b+ ¬c + d) (¬b+ ¬c + d) (¬b+ ¬c + d) (¬b+ ¬c + d) (¬b+ ¬c + d) (¬b+ ¬c + d) (¬b+ ¬c + d) (¬b + ¬c + d) (¬b+ ¬c + ¬d) (¬b+ ¬c + ¬d) (¬b + ¬c + d) (¬b+ ¬c + d) (¬b+ ¬c + ¬d) (¬b + ¬c + d) (¬b + ¬c + d) (¬b + ¬c + d) (¬b + ¬c + d) (¬b + ¬c + d) (¬b+ ¬c + d) (¬b+ ¬c + d) (¬b+ ¬c + d) (¬b + ¬c + d) (¬b + ¬c + d) (¬b+ ¬c + d) (¬b+ ¬c + d) (¬b+ ¬c + d) (¬b+ ¬c + d) (¬b + ¬c + d) (¬b+ ¬c + d) (¬b + ¬c + d) (¬b+ ¬c + d) (¬b+ ¬c + d) (¬b+ ¬c + d) (¬b+ ¬c + d) Search for a Satisfying Assignment a b b c c c d d d d d Courtesy Karem Sakallah, University of Michigan
Computation using SAT • The classical SAT is a “yes/no” thing • It returns one satisfying assignment, or no assignment if the problem is UNSAT • If a conflict occurs during search, SAT solver generates a conflict clause and continues exploring the search space • It is possible to have SAT enumerate through the satisfying assignments of the problem • for this, each satisfying assignment is treated similar to a conflict • a new clause (“blocking clause”) is added and search continues • For large boolean spaces, it is very important to generate satisfying assignments in the form of cubes rather than minterms • There are several methods for doing this
Boolean operations using SAT • Complement • Enumerate through the satisfying assignments and collect all blocking clauses • Boolean AND • put CNF clauses of arguments together • Other Boolean operations • reducible to complement and Boolean AND • Composition • renaming variables and appending clauses • Universal quantification • omitting the quantified variables in all CNF clauses • Existential quantification • reduced to universal and two complements
Deriving CNF from the Circuit • The CNF formula for each node is computed • 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 function • Another way is to use AND/INV graph representation of the node’s on-set, and add clauses for each gate in the graph • The CNF of the network is derived by putting together (ANDing) the CNFs for each node • For single output circuits, if only the positive (negative) phase of the circuit function is needed, the literal p (p’) is added to the CNF, where p (p’) is the positive (negative) phase of the output variable of the PO node
SAT Solver • Stores clauses as arrays of integers • Makes decisions and propagates implications • When conflict occurs, adds a conflict clause to the problem • When a satisfying assignment is found, while enumerating through all satisfying assignments, adds a breaking clause to the problem • Periodically removes inactive clauses • Implements restarts • Surprise: A state-of-the-art SAT solver can be implemented in 600 lines of C++ code!!!
Introduction to SAT: References • J.P. Marques-Silva, K.A. Sakallah``GRASP: A Search Algorithm for Propositional Satisfiability'' in IEEE Transactions on Computers, vol 48, pp. 506--521, 1999. • W. Kunz, J. Marques-Silva, S. Malik. SAT and ATPG: Algorithms for Boolean Decision Problems, in Logic Synthesis and Verification, S. Hassoun and T. Sasao, eds., Kluwer Academic Publishers, 2001. • N. Eén, N.Sörensson. An Extensible SAT-solver. SAT 2003. http://www.cs.chalmers.se/~een/Satzoo/An_Extensible_SAT-solver.ps.gz