Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computation Engines: BDDs and SAT (part 1) 290N: The Unknown Component Problem Lecture 7.

Similar presentations


Presentation on theme: "Computation Engines: BDDs and SAT (part 1) 290N: The Unknown Component Problem Lecture 7."— Presentation transcript:

1 Computation Engines: BDDs and SAT (part 1) 290N: The Unknown Component Problem Lecture 7

2 Outline  Formulation and computation  Representations of Boolean functions  Canonicity of a representation  Binary decision diagrams (BDDs) Definition, properties, applications, etc Definition, properties, applications, etc Boolean operations using BDDs Boolean operations using BDDs Deriving BDDs from the circuit Deriving BDDs from the circuit  Satisfiability (SAT) Search, implications, branch-and-bound, etc Search, implications, branch-and-bound, etc Boolean operations using SAT Boolean operations using SAT Deriving CNF from the circuit Deriving CNF from the circuit

3 Formulation and Computation  Formulation Uses formalisms (such as automata theory, etc) Uses formalisms (such as automata theory, etc) Requires some statements to be proved Requires some statements to be proved Is not always concerned with how practical it is Is not always concerned with how practical it is  Computation Relies on formulation Relies on formulation Looks into algorithms and data structures Looks into algorithms and data structures Is important for practical applications Is important for practical applications

4 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 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 There is no single best representation

5 Boolean Functions  A completely specified Boolean function is a mapping B n  B, where B = {0,1}  All other types of Boolean and multi-valued functions and relations can be represented using completely specified Boolean functions x1x1x1x1 x2x2x2x2 x3x3x3x3F 0000 0010 0100 0111 1000 1011 1100 1111

6 Representations of Boolean Functions  Truth table x1x1x1x1 x2x2x2x2 x3x3x3x3F 0000 0010 0100 0111 1000 1011 1100 1111 0001111000000 10111 x1x2x1x2 x3x3  Karnaugh Map

7 Representations of Boolean Functions  Sum-of-products (DNF) F = x 1 ’x 2 x 3 + x 1 x 2 ’x 3 + x 1 x 2 x 3  Product-of-sums (CNF) F = (x 1 +x 2 +x 3 ) & (x 1 +x 2 +x 3 ’) & (x 1 +x 2 ’+x 3 ) & (x 1 ’+x 2 +x 3 ) & (x 1 +x 2 ’+x 3 ) & (x 1 ’+x 2 +x 3 ) & (x 1 ’+x 2 ’+x 3 ) (x 1 ’+x 2 ’+x 3 )  Exclusive sum-of-products F = x 3  x 1 ’x 2 ’x 3  Factored form F = x 3 (x 1 +x 2 )  BDD x1x1 x3x3 x2x2 10 X1X1 X3X3 X2X2  AND/INV graph

8 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 Truth table is canonical given the ordering of mintermsgiven the ordering of minterms BDD is canonical BDD is canonical given the ordering of input variablesgiven the ordering of input variables SOP is not canonical SOP is not canonical but under some conditions it becomes canonicalbut under some conditions it becomes canonical the set of all minterms the set of all minterms the set of all primes the set of all primes ISOP computed using Minato-Morreale algorithm when the ordering of variables is fixed ISOP computed using Minato-Morreale algorithm when the ordering of variables is fixed

9 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

10 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). 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. 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.

11 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. 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 leaves of the graph represent constant functions, while the root represents function F The same variable order is used for all paths The same variable order is used for all paths The graph is reduced The graph is reduced

12 Examples of BDDs a1a1 a2a2 b1b1 1 0 b2b2 1 0 a 1 0 a F = a a 1 0 b a 1 0 b F = ab F = a+b a1a1 a2a2 b1b1 1 0 b2b2 F=a 1 b 1 + a 2 b 2 F=a 1 b 1 +a 2 +b 2 F=1 1

13 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 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 The Shannon expansion is recursively applied to the function and its cofactors A new node is added to mark each expansion A new node is added to mark each expansion The same variable order is used for all paths The same variable order is used for all paths The graph is reduced The graph is reduced

14 Deriving BDD using Shannon Expansion x1x1 x3x3 x2x2 10 F = x3 (x1+x2) F0 =F| x1=0 = x2x3 F0 = F| x1=0 = x2x3 F1 =F| x1=1 = x3 F1 = F| x1=1 = x3 F0 = x2x3 F00| x2=0 = 0 F01| x2=1 = x3 x1x1 F F0 F1 x2x2 F0 F F0 F01 x3x3 10 x3x3 10 F01 0 F00 F00

15 Deriving BDD from Truth Table x1x1 x3x3 x2x2 x3x3 x3x3 x3x3 10 x2x2 1 10000 x1x1x1x100001111 x2x2x2x200110011 x3x3x3x301010101 F00010101 0 1 1 0 10 0 1 0 1 010 1

16 Reduction of a Decision Tree Rule 1: Isomorphic nodes are merged Rule 2: Redundant nodes are removed aa bb a bb a b b

17 Example of Decision Tree Reduction x1x1 x3x3 x2x2 x3x3 x3x3 x3x3 10 x2x2 110000

18 x1x1 x3x3 x2x2 x3x3 x3x3 x3x3 x2x2 10 x1x1 x3x3 x2x2 x3x3 x2x2 10 x1x1 x3x3 x2x2 10 BDD Decision tree reduction

19 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) Number of nodes (complexity of the function) Average path length (speed of evaluation of the function) Average path length (speed of evaluation of the function) x1x1 x3x3 x2x2 10

20 Effect of Variable Ordering on the BDD size x1x1 y1y1 y1y1 x2x2 y2y2 y2y2 10 x 1 < y 1 < x 2 < y 2 x 1 < x 2 < y 1 < y 2 x1x1 x2x2 x2x2 y1y1 y2y2 y2y2 10 y1y1 y1y1 y1y1 F(x 1, x 2, y 1, y 2 ) = (x 1 = y 1 ) & (x 2 = y 2 )

21 Another Example a1a1 a2a2 b1b1 1 0 b2b2 a 1 <b 1 <a 2 < b 2 a1a1 b1b1 a2a2 1 0 b2b2 a2a2 b1b1 a 1 <a 2 <b 1 < b 2 F=a 1 b 1 + a 2 b 2

22 Operations on BDDs  Apply – NOT, AND, OR, EXOR, etc.  Quantification (existential, universal, unique)  Substitute variables  Compose  Specialized operators Generalized cofactor (constrain) Generalized cofactor (constrain) Restrict Restrict Compatible projection Compatible projection etc. etc.

23 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(F, G, H)| x = 0, ITE(F, G, G)| x = 1 ) = ITE(x, ITE(F0, G0, H0 ’ ), ITE(F1, G1, H1) ) = ITE(x, ITE(F0, G0, H0 ’ ), ITE(F1, G1, H1) )

24 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 ) 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) x & APPLY(F1, G1)

25 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; }

26 F=ac+bc+d G=ac’+d F+G = ? a d c b 1 0 a c d 10 + A1A1 A2A2 A6A6 A3A3 B1B1 B5B5 B2B2 A4A4 A5A5 B3B3 B4B4 A 1,B 1 A 2,B 2 A 6,B 2 A 3,B 2 A 4,B 3 A 5,B 4 A 6,B 5 A 5,B 2 A 3,B 4

27 Quantification  Given a function F(x 1, x 2, x 3 ) Existential quantification of F w.r.t. x 1 is Existential quantification of F w.r.t. x 1 is  x1 F(x 1, x 2, x 3 ) = F(0, x 2, x 3 ) + F(1, x 2, x 3 )  x1 F(x 1, x 2, x 3 ) = F(0, x 2, x 3 ) + F(1, x 2, x 3 ) Universal quantification of F w.r.t. x 1 is Universal quantification of F w.r.t. x 1 is  x1 F(x 1, x 2, x 3 ) = F(0, x 2, x 3 ) & F(1, x 2, x 3 )  x1 F(x 1, x 2, x 3 ) = F(0, x 2, x 3 ) & F(1, x 2, x 3 ) Unique quantification of F w.r.t. x 1 is Unique quantification of F w.r.t. x 1 is ! x1 F(x 1, x 2, x 3 ) = F(0, x 2, x 3 )  F(1, x 2, x 3 ) ! x1 F(x 1, x 2, x 3 ) = F(0, x 2, x 3 )  F(1, x 2, x 3 )  Quantification is generalized to a set of variables by applying it w.r.t each variable in the set

28 Example of Quantification cd ab 00011110 000000 010010 111111 101100 cd000 011 111 101 cd000 010 111 100 F(a,b,c,d) = ac + cd + abd H(c,d)=  ab F(a,b,c,d) H G(c,d)=  ab F(a,b,c,d) F G

29 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 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 the global function of the node is computed by composing its local function with the global functions of the fanins bacdef gh Fi F1F1 F2F2 o1 o2o3

30 Properties of BDDs  Small size for many practical functions for many practical functions  Fast manipulation the smaller the faster the smaller the faster  Canonicity ease of caching ease of caching useful for verification useful for verification  Large size for complex functions (i.e. multipliers)  Slow manipulation the larger, the slower

31 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 Reachability analysis Symbolic model checkingSymbolic model checking Sequential equivalence checkingSequential equivalence checking Exact SOP minimization Exact SOP minimization Heuristic ESOP minimization Heuristic ESOP minimization Computation of symmetries of Boolean functions Computation of symmetries of Boolean functions Computation of spectra (Walsh, Haar, Reed-Muller, etc) Computation of spectra (Walsh, Haar, Reed-Muller, etc) Manipulation of discrete matrices Manipulation of discrete matrices

32 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 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 Reduces the complexity of computation from exponential to linear  Periodically performs garbage collections and dynamic variable reordering

33 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 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

34 Boolean Satisfiability  Definition  Search for a satisfying assignment  Computation using SAT  Computing CNF from the Circuit  SAT solver

35 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, 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 or proving that such assignment does not exist

36 Example (a + b + c) (a + b + c’) (a’ + b + c’) (a + c + d) (a’ + c + d) (a’ + c + d’) (b’ + c’ + d’) (b’ + c’ + d) 00011110 000000 010100 110000 100000 ab cd Cube: bcd’ Clause: b’ + c’ + d CNF

37 Comment  Such a simple problem and so much effort to solve it because the size of CNF used in practice is very large 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 Conflict analysis with clause recording Non-chronological backtracking Non-chronological backtracking Variable selection heuristics Variable selection heuristics Random restarts Random restarts Two literal clause watching, etc Two literal clause watching, etc

38 Search 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 dd b c dd 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

39 Computation using SAT  The classical SAT is a “yes/no” thing It returns one satisfying assignment, or no assignment if the problem is UNSAT 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 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 for this, each satisfying assignment is treated similar to a conflict a new clause (“blocking clause”) is added and search continues 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 There are several methods for doing this

40 Boolean operations using SAT  Complement Enumerate through the satisfying assignments and collect all blocking clauses Enumerate through the satisfying assignments and collect all blocking clauses  Boolean AND put CNF clauses of arguments together put CNF clauses of arguments together  Other Boolean operations reducible to complement and Boolean AND reducible to complement and Boolean AND  Composition renaming variables and appending clauses renaming variables and appending clauses  Universal quantification omitting the quantified variables in all CNF clauses omitting the quantified variables in all CNF clauses  Existential quantification reduced to universal and two complements reduced to universal and two complements

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

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

43 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


Download ppt "Computation Engines: BDDs and SAT (part 1) 290N: The Unknown Component Problem Lecture 7."

Similar presentations


Ads by Google