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

Slides:



Advertisements
Similar presentations
Model Checking Lecture 4. Outline 1 Specifications: logic vs. automata, linear vs. branching, safety vs. liveness 2 Graph algorithms for model checking.
Advertisements

Hybrid BDD and All-SAT Method for Model Checking Orna Grumberg Joint work with Assaf Schuster and Avi Yadgar Technion – Israel Institute of Technology.
Representing Boolean Functions for Symbolic Model Checking Supratik Chakraborty IIT Bombay.
Planning based on Model Checking Dept. of Information Systems and Applied CS Bamberg University Seminar Paper Svetlana Balinova.
CS357 Lecture: BDD basics David Dill 1. 2 BDDs (Boolean/binary decision diagrams) BDDs are a very successful representation for Boolean functions. A BDD.
ECE Synthesis & Verification 1 ECE 667 Synthesis and Verification of Digital Systems Formal Verification Combinational Equivalence Checking.
ECE 667 Synthesis & Verification - SAT 1 ECE 667 ECE 667 Synthesis and Verification of Digital Systems Boolean SAT CNF Representation Slides adopted (with.
Class Presentation on Binary Moment Diagrams by Krishna Chillara Base Paper: “Verification of Arithmetic Circuits using Binary Moment Diagrams” by.
© 2011 Carnegie Mellon University Binary Decision Diagrams Part Bug Catching: Automated Program Verification and Testing Sagar Chaki September.
© 2011 Carnegie Mellon University Binary Decision Diagrams Part Bug Catching: Automated Program Verification and Testing Sagar Chaki September.
ECE 667 Synthesis & Verification - Boolean Functions 1 ECE 667 Spring 2013 ECE 667 Spring 2013 Synthesis and Verification of Digital Circuits Boolean Functions.
Binary Decision Diagrams. ROBDDs Slide 2 Example Directed acyclic graph non-terminal node terminal node What function is represented by the graph?
Spring 07, Feb 13 ELEC 7770: Advanced VLSI Design (Agrawal) 1 ELEC 7770 Advanced VLSI Design Spring 2007 Binary Decision Diagrams Vishwani D. Agrawal James.
DATE-2002TED1 Taylor Expansion Diagrams: A Compact Canonical Representation for Symbolic Verification M. Ciesielski, P. Kalla, Z. Zeng B. Rouzeyre Electrical.
Chapter 2 – Combinational Logic Circuits Part 1 – Gate Circuits and Boolean Equations Logic and Computer Design Fundamentals.
Presented by Ed Clarke Slides borrowed from P. Chauhan and C. Bartzis
1 Quantified Formulas Acknowledgement: QBF slides borrowed from S. Malik.
ECE Synthesis & Verification - Lecture 18 1 ECE 697B (667) Spring 2006 ECE 697B (667) Spring 2006 Synthesis and Verification of Digital Systems Word-level.
Boolean Functions and their Representations
A New Approach to Structural Analysis and Transformation of Networks Alan Mishchenko November 29, 1999.
Introduction to Logic Synthesis Alan Mishchenko UC Berkeley.
Reachability Analysis using AIGs (instead of BDDs?) 290N: The Unknown Component Problem Lecture 23.
Computation Engines: BDDs and SAT (part 2) 290N: The Unknown Component Problem Lecture 8.
ECE Synthesis & Verification - L211 ECE 697B (667) Spring 2006 Synthesis and Verification of Digital Systems Verification Equivalence checking.
A Compressed Breadth-First Search for Satisfiability DoRon B. Motter and Igor L. Markov University of Michigan, Ann Arbor.
Boolean Matching in Logic Synthesis. Equivalence of Functions Equivalence of two functions defined under l Negation of input variables l Permutation of.
SAT Algorithms in EDA Applications Mukul R. Prasad Dept. of Electrical Engineering & Computer Sciences University of California-Berkeley EE219B Seminar.
Taylor Expansion Diagrams (TED): Verification EC667: Synthesis and Verification of Digital Systems Spring 2011 Presented by: Sudhan.
ECE Synthesis & Verification - Lecture 10 1 ECE 697B (667) Spring 2006 ECE 697B (667) Spring 2006 Synthesis and Verification of Digital Systems Binary.
 2001 CiesielskiBDD Tutorial1 Decision Diagrams Maciej Ciesielski Electrical & Computer Engineering University of Massachusetts, Amherst, USA
ECE 667 Synthesis & Verification - BDD 1 ECE 667 ECE 667 Synthesis and Verification of Digital Systems Binary Decision Diagrams (BDD)
ENGG3190 Logic Synthesis “Binary Decision Diagrams” BDDs Winter 2014 S. Areibi School of Engineering University of Guelph.
ENGG3190 Logic Synthesis “Boolean Satisfiability” Winter 2014 S. Areibi School of Engineering University of Guelph.
ECE 667 Synthesis and Verification of Digital Systems
IT University of Copenhagen Lecture 8: Binary Decision Diagrams 1. Classical Boolean expression representations 2. If-then-else Normal Form (INF) 3. Binary.
Chapter 2: Boolean Algebra and Logic Functions
Digitaalsüsteemide verifitseerimise kursus1 Formal verification: BDD BDDs applied in equivalence checking.
Athens 2004 Symposium on Innovation of Computer Science Curriculum in Higher Education Athens 2004 Decision Diagrams: Principles of Programming Dragan.
B. Alizadeh Advanced Logic Design (2008) 1 / 55 Decision Diagrams.
Binary Decision Diagrams (BDDs)
BOOLEAN ALGEBRA Saras M. Srivastava PGT (Computer Science)
November,2000University of Southern California1 Introduction to Binary Decision Diagrams - Shesha Shayee K. Raghunathan.
MBSat Satisfiability Program and Heuristics Brief Overview VLSI Testing B Marc Boulé April 2001 McGill University Electrical and Computer Engineering.
CS 267: Automated Verification Lecture 6: Binary Decision Diagrams Instructor: Tevfik Bultan.
Two Level and Multi level Minimization
BoolTool: A Tool for Manipulation of Boolean Functions Petr Fišer, David Toman Czech Technical University in Prague Dept. of Computer Science and Engineering.
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View BDDs.
UM EECS 270 Spring 2011 – Taken from Dr.Karem Sakallah Logic Synthesis: From Specs to Circuits Implementation Styles –Random –Regular Optimization Criteria.
CHAPTER 3: PRINCIPLES OF COMBINATIONAL LOGIC
On the Relation between SAT and BDDs for Equivalence Checking Sherief Reda Rolf Drechsler Alex Orailoglu Computer Science & Engineering Dept. University.
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View BDDs.
Binary decision diagrams (BDD’s) Compact representation of a logic function ROBDD’s (reduced ordered BDD’s) are a canonical representation: equivalence.
BDDs1 Binary Tree Representation The recursive Shannon expansion corresponds to a binary tree Example: Each path from the root to a leaf corresponds to.
Boolean Functions 1 ECE 667 ECE 667 Synthesis and Verification of Digital Circuits Boolean Functions Basics Maciej Ciesielski Univ.
1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Binary Decision Diagrams Prof. Shobha Vasudevan ECE, UIUC ECE 462.
Faster Logic Manipulation for Large Designs
Logic Synthesis CNF Satisfiability.
ECE 667 Synthesis and Verification of Digital Systems
LPSAT: A Unified Approach to RTL Satisfiability
Faster Logic Manipulation for Large Designs
Binary Decision Diagrams
ECE 667 Synthesis and Verification of Digital Circuits
Binary Decision Diagrams
Introduction to Logic Synthesis
A logic function f in n inputs x1, x2, ...xn and
Introduction to BDDs.
A logic function f in n inputs x1, x2, ...xn and
SAT-based Methods: Logic Synthesis and Technology Mapping
Presentation transcript:

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

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

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

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

Representations of Boolean Functions  Truth table x1x1x1x1 x2x2x2x2 x3x3x3x3F x1x2x1x2 x3x3  Karnaugh Map

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

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

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

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

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

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

Deriving BDD from Truth Table x1x1 x3x3 x2x2 x3x3 x3x3 x3x3 10 x2x x1x1x1x x2x2x2x x3x3x3x F

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

Example of Decision Tree Reduction x1x1 x3x3 x2x2 x3x3 x3x3 x3x3 10 x2x

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

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

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 )

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

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.

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

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)

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 = ? 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

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

Example of Quantification cd ab cd cd 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

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

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

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

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

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  Henrik Reif Andersen. An Introduction to Binary Decision Diagrams. Dept. of Information Technology, Technical University of Denmark,  F. Somenzi. Binary Decision Diagrams (Tutorial), University of Colorado, 1999,

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

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) ab cd Cube: bcd’ Clause: b’ + c’ + d CNF

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

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

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

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

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

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 ,  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,  N. Eén, N.Sörensson. An Extensible SAT-solver. SAT solver.ps.gz