370 likes | 516 Vues
Boolean Satisfiability (SAT). Class Presentation By Girish Paladugu. Overview. Introduction Conjunctive Normal Form (CNF) DLL Procedure for solving SAT problems Backtrack search algorithm Eqvivalence Checking Summary. INTRODUCTION.
E N D
Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu
Overview • Introduction • Conjunctive Normal Form (CNF) • DLL Procedure for solving SAT problems • Backtrack search algorithm • Eqvivalence Checking • Summary
INTRODUCTION • SATGiven a Boolean formula (propositional logic formula), find a variable assignment such that the formula evaluates to 1, or prove that no such assignment exists. • For a formula with n variables, there are 2n possible truth assignments to be checked. j = ( a +c ) ( b +c ) (¬a +¬b + ¬c ) a 0 1 b b 0 1 1 0 c c c c 0 1 0 1 0 1 0 1 Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik
CNF • Conjunctive Normal Form (CNF): A conjunctive normal form (CNF) formula ϕon nbinary variables x1, …, xnis the conjunction of m clauses ω1, …, ωm. • Literal: Variablexor its complement x’. • Clause: Disjunction of one or more literals. • CNF formula is satisfiable if each clause is satisfiable ( or evaluate to true) else it is unsatisfiable. j = ( a +c ) ( b +c ) (¬a +¬b + ¬c )
a d b 2- input AND Gate CNF Truth Table jd= [d = ¬(a b)] = ¬[d Å ¬(a b)] = ¬[¬(a b)¬d + a b d] = ¬[¬a ¬d + ¬b ¬d + a b d] = (a +d)(b +d)(¬a +¬b + ¬d) This method can be applied to any number input gate. Boolean Satisfiability in Electronic Design Automation - joao marques silva, Karem A Sakellah
Circuit - CNF conversion • The CNF formula for circuit is the set union of the CNF formulas of each gate.
DLL Algorithm • Davis, Logemann and Loveland • Basic framework for many modern SAT solvers • Complete Backtracking-based algorithm for solving the CNF-SAT problem Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik
Basic DLL Procedure - DFS (a’ + b + c) (a + c + d) (a + c + d’) (a + c’ + d) (a + c’ + d’) (b’ + c’ + d) (a’ + b + c’) (a’ + b’ + c) Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik
Basic DLL Procedure - DFS a (a’ + b + c) (a + c + d) (a + c + d’) (a + c’ + d) (a + c’ + d’) (b’ + c’ + d) (a’ + b + c’) (a’ + b’ + c) Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik
Basic DLL Procedure - DFS a (a’ + b + c) 0 Decision (a + c + d) (a + c + d’) (a + c’ + d) (a + c’ + d’) (b’ + c’ + d) (a’ + b + c’) (a’ + b’ + c) Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik
Basic DLL Procedure - DFS a (a’ + b + c) 0 (a + c + d) (a + c + d’) b (a + c’ + d) 0 Decision (a + c’ + d’) (b’ + c’ + d) (a’ + b + c’) (a’ + b’ + c) Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik
Basic DLL Procedure - DFS a (a’ + b + c) 0 (a + c + d) (a + c + d’) b (a + c’ + d) 0 (a + c’ + d’) c (b’ + c’ + d) (a’ + b + c’) 0 Decision (a’ + b’ + c) Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik
Basic DLL Procedure - DFS a (a’ + b + c) 0 (a + c + d) (a + c + d’) b (a + c’ + d) 0 (a + c’ + d’) c (b’ + c’ + d) (a’ + b + c’) 0 (a’ + b’ + c) (a + c + d) a=0 d=1 Conflict! Implication Graph c=0 d=0 (a + c + d’) Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik
Basic DLL Procedure - DFS a (a’ + b + c) 0 (a + c + d) (a + c + d’) b (a + c’ + d) 0 (a + c’ + d’) c (b’ + c’ + d) (a’ + b + c’) 0 (a’ + b’ + c) (a + c + d) a=0 d=1 Conflict! Implication Graph c=0 d=0 (a + c + d’) Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik
Basic DLL Procedure - DFS a (a’ + b + c) 0 (a + c + d) (a + c + d’) b (a + c’ + d) 0 (a + c’ + d’) c (b’ + c’ + d) Backtrack (a’ + b + c’) 0 (a’ + b’ + c) Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik
Basic DLL Procedure - DFS a (a’ + b + c) 0 (a + c + d) (a + c + d’) b (a + c’ + d) 0 (a + c’ + d’) c (b’ + c’ + d) (a’ + b + c’) Forced Decision 0 1 (a’ + b’ + c) (a + c’ + d) a=0 d=1 Conflict! c=1 d=0 (a + c’ + d’) Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik
Basic DLL Procedure - DFS a (a’ + b + c) 0 (a + c + d) (a + c + d’) b (a + c’ + d) 0 (a + c’ + d’) c (b’ + c’ + d) Backtrack (a’ + b + c’) 0 1 (a’ + b’ + c) Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik
Basic DLL Procedure - DFS a (a’ + b + c) 0 (a + c + d) (a + c + d’) b (a + c’ + d) Forced Decision 0 1 (a + c’ + d’) c (b’ + c’ + d) (a’ + b + c’) 0 1 (a’ + b’ + c) Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik
Basic DLL Procedure - DFS a (a’ + b + c) 0 (a + c + d) (a + c + d’) b (a + c’ + d) 0 1 (a + c’ + d’) c c (b’ + c’ + d) (a’ + b + c’) 0 0 1 Decision (a’ + b’ + c) (a + c’ + d) a=0 d=1 Conflict! c=0 d=0 (a + c’ + d’) Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik
Basic DLL Procedure - DFS a (a’ + b + c) 0 (a + c + d) (a + c + d’) b (a + c’ + d) 0 1 (a + c’ + d’) c c Backtrack (b’ + c’ + d) (a’ + b + c’) 0 0 1 (a’ + b’ + c) Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik
Basic DLL Procedure - DFS a (a’ + b + c) 0 (a + c + d) (a + c + d’) b (a + c’ + d) 0 1 (a + c’ + d’) c c (b’ + c’ + d) (a’ + b + c’) 0 0 1 1 Forced Decision (a’ + b’ + c) (a + c’ + d) a=0 d=1 Conflict! c=1 d=0 (a + c’ + d’) Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik
Basic DLL Procedure - DFS a Backtrack (a’ + b + c) 0 (a + c + d) (a + c + d’) b (a + c’ + d) 0 1 (a + c’ + d’) c c (b’ + c’ + d) (a’ + b + c’) 0 0 1 1 (a’ + b’ + c) Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik
Basic DLL Procedure - DFS a (a’ + b + c) 0 1 Forced Decision (a + c + d) (a + c + d’) b (a + c’ + d) 0 1 (a + c’ + d’) c c (b’ + c’ + d) (a’ + b + c’) 0 0 1 1 (a’ + b’ + c) Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik
Basic DLL Procedure - DFS a (a’ + b + c) 0 1 (a + c + d) (a + c + d’) b b (a + c’ + d) 0 1 0 Decision (a + c’ + d’) c c (b’ + c’ + d) (a’ + b + c’) 0 0 1 1 (a’ + b’ + c) Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik
Basic DLL Procedure - DFS a (a’ + b + c) 0 1 (a + c + d) (a + c + d’) b b (a + c’ + d) 0 1 0 (a + c’ + d’) c c (b’ + c’ + d) (a’ + b + c’) 0 0 1 1 (a’ + b’ + c) (a’ + b + c) a=1 c=1 Conflict! b=0 c=0 (a’ + b + c’) Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik
Basic DLL Procedure - DFS a (a’ + b + c) 0 1 (a + c + d) (a + c + d’) b b Backtrack (a + c’ + d) 0 1 0 (a + c’ + d’) c c (b’ + c’ + d) (a’ + b + c’) 0 0 1 1 (a’ + b’ + c) Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik
Basic DLL Procedure - DFS a (a’ + b + c) 0 1 (a + c + d) (a + c + d’) b b (a + c’ + d) 0 1 0 Forced Decision 1 (a + c’ + d’) c c (b’ + c’ + d) (a’ + b + c’) 0 0 1 1 (a’ + b’ + c) (a’ + b’ + c) a=1 c=1 b=1 Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik
Basic DLL Procedure - DFS a (a’ + b + c) 0 1 (a + c + d) (a + c + d’) b b (a + c’ + d) 0 1 0 1 (a + c’ + d’) c c (b’ + c’ + d) (a’ + b + c’) 0 0 1 1 (a’ + b’ + c) (a’ + b’ + c) (b’ + c’ + d) a=1 c=1 d=1 b=1 Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik
Basic DLL Procedure - DFS a (a’ + b + c) 0 1 (a + c + d) (a + c + d’) b b (a + c’ + d) 0 1 0 1 (a + c’ + d’) c c SAT (b’ + c’ + d) (a’ + b + c’) 0 0 1 1 (a’ + b’ + c) (a’ + b’ + c) (b’ + c’ + d) a=1 c=1 d=1 b=1 Adapted from ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik
Backtrack Search Algorithm • Backtrack search has proven useful for solving instances of SAT from EDA applications, in particular for applications where the objective is to prove unsatisfiability. • The algorithm conducts a search through the space of the possible assignments to the problem instance variables.
Backtrack Search Algorithm • Decide( ) : Necessary assignments are identified. • Deduce( ): Returns a conflict whenever a clause becomes unsatisfiable. • Diagnose( ): Analyzes the conflict and returns a decision level to which the search process is required to backtrack to. • Erase( ): Clears implied assignments that results from each assignment selection.
Handling Conflicts • Assignments w=1, y3=0, x1=1, y1=0, y2=0 clearly results in a conflict. • To prevent this conflict at least one of the assignments must be complemented. • So the clause (¬x1 + ¬w + y3) is generated.
CA z = 1 ? CB If z = 1 is unsatisfiable, the two circuits are equivalent ! Equivalence Checking
Summary So CNF representation of a problem is given as input to the SAT solvers Core computation engine in many applications like verification and testing, logic synthesis, FPGA routing. State of the art SAT solvers use DLL algorithm The first established NP-Complete problem If the number of variables increases its harder to solve SAT problems
Questions References [1]JP Marques-Silva, “Boolean Satisfiability in Electronic Design Automation,” 2000 [2] Lintao Zhang, Sharad Malik, “The Quest for Efficient Boolean Satisfiability Solvers”