1 / 81

Satisfiability of Propositional Formulas

Satisfiability of Propositional Formulas. Mooly Sagiv. Based on a presentation by Sharad Malik & Ohad Shacham. a. 0. 1. b. b. 0. 1. 1. 0. c. c. c. c. 0. 1. 0. 1. 0. 1. 0. 1. The SAT Problem. Given a propositional formula (Boolean function)

layp
Download Presentation

Satisfiability of Propositional Formulas

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Satisfiability of Propositional Formulas Mooly Sagiv Based on a presentation by Sharad Malik & Ohad Shacham

  2. a 0 1 b b 0 1 1 0 c c c c 0 1 0 1 0 1 0 1 The SAT Problem • Given a propositional formula (Boolean function) •  =(a  b) ( ab  c) • Determine if  is valid • Determine if  is satisfiable • Find a satisfying assignment or report that such does not exit • For n variables, there are 2n possible truth assignments to be checked

  3. Why Bother? • Core computational engine for major applications • Artificial Intelligence • Knowledge base deduction • Automatic theorem proving • Electronic Design Automaton • Testing and Verification • Logic synthesis • FPGA routing • Path delay analysis • And more…

  4. Problem Representation • Represent the formulas in Conjunctive Normal Form (CNF) • Conversion to CNF is straightforward • a  (b  (c   d)) (a  (b  c  d))  (a  (b  c  d))  (a  b)  (a  c)  (a d) • May need to add variables • Notations • Literals • Variable or its negation • Clauses • Disjunction of literals •  =(a  b) ( ab  c) (a + b)(a’ + b’+ c) • Advantages of CNF • Simple data structure • All the clauses need to be satisfied

  5. Complexity Results • First established NP-Complete problem • Even when at most 3 literals per clause (3-SAT) S. A. Cook, The complexity of theorem proving procedures, Proceedings, Third Annual ACM Symp. on the Theory of Computing,1971, 151-158 • No polynomial algorithm for all instances unless P = NP • Becomes polynomial when • At most two literals per clause (2-SAT) • At most one positive literal in every clause (Horn)

  6. Goals • Develop algorithms which solve all SAT instances • Exponential worst case complexity • But works well on many instances • Interesting Heuristics • Annual SAT conferences • SAT competitions • Randomly, Handmade, Industrial, AI • 10 Millions variables!

  7. a + b + c’ + f g + h’ + c + f a + b + g + h’ a + b + g + h’ + f Resolution • Resolution of a pair of clauses with exactly ONE incompatible variable • What if more than one incompatible variables?

  8. (a + b + c) (b + c’ + f’) (b’ + e) (a + b) (a + b’) (a’ + c) (a’ + c’) (a + c + e) (c’ + e + f’) (a) (a’ + c) (a’ + c’) (c) (c’) (a + e + f’) ( ) Davis Putnam Algorithm M .Davis, H. Putnam, “A computing procedure for quantification theory", J. of ACM, Vol. 7, pp. 201-214, 1960 • Iteratively select a variable for resolution till no more variables are left • Report UNSAT when the empty clause occurs • Can discard resolved clauses after each iteration SAT UNSAT Potential memory explosion problem!

  9. Can we avoid using exponential space?

  10. DLL Algorithm • Davis, Logemann and Loveland M. Davis, G. Logemann and D. Loveland, “A Machine Program for Theorem-Proving", Communications of ACM, Vol. 5, No. 7, pp. 394-397, 1962 • Basic framework for many modern SAT solvers • Also known as DPLL for historical reasons

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

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

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

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

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

  16. 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’)

  17. 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’)

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

  19. 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’)

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

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

  22. 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’)

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

  24. 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’)

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

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

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

  28. 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’)

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

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

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

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

  33. Features of DLL • Eliminates the exponential memory requirements of DP • Exponential time is still a problem • Limited practical applicability – largest use seen in automatic theorem proving • Very limited size of problems are allowed • 32K word memory • Problem size limited by total size of clauses (1300 clauses)

  34. Satisfied Literal Unsatisfied Literal Unassigned Literal (a+b’+c)(b+c’)(a’+c’) a = T, b = T, c is unassigned Implications and Boolean Constraint Propagation • Implication • A variable is forced to be assigned to be True or False based on previous assignments • Unit clause rule (rule for elimination of one literal clauses) • An unsatisfied clause is a unit clause if it has exactly one unassigned literal • The unassigned literal is implied because of the unit clause • Boolean Constraint Propagation (BCP) • Iteratively apply the unit clause rule until there is no unit clause available. • Workhorse of DLL based algorithms

  35. GRASP • Marques-Silva and Sakallah [SS96,SS99] J. P. Marques-Silva and Karem A. Sakallah, “GRASP: A Search Algorithm for Propositional Satisfiability”, IEEE Trans. Computers, C-48, 5:506-521, 1999. • Incorporates conflict driven learning and non-chronological backtracking • Practical SAT instances can be solved in reasonable time • Bayardo and Schrag’s RelSAT also proposed conflict driven learning [BS97] R. J. Bayardo Jr. and R. C. Schrag “Using CSP look-back techniques to solve real world SAT instances.” Proc. AAAI, pp. 203-208, 1997

  36. Conflict Driven Learning andNon-chronological Backtracking x1 + x4 x1 + x3’ + x8’ x1 + x8 + x12 x2 + x11 x7’ + x3’ + x9 x7’ + x8 + x9’ x7 + x8 + x10’ x7 + x10 + x12’

  37. x1 Conflict Driven Learning andNon-chronological Backtracking x1 + x4 x1 + x3’ + x8’ x1 + x8 + x12 x2 + x11 x7’ + x3’ + x9 x7’ + x8 + x9’ x7 + x8 + x10’ x7 + x10 + x12’ x1=0 x1=0

  38. x1 x4=1 Conflict Driven Learning andNon-chronological Backtracking x1 + x4 x1 + x3’ + x8’ x1 + x8 + x12 x2 + x11 x7’ + x3’ + x9 x7’ + x8 + x9’ x7 + x8 + x10’ x7 + x10 + x12’ x1=0, x4=1 x1=0

  39. x1 x3 x4=1 Conflict Driven Learning andNon-chronological Backtracking x1 + x4 x1 + x3’ + x8’ x1 + x8 + x12 x2 + x11 x7’ + x3’ + x9 x7’ + x8 + x9’ x7 + x8 + x10’ x7 + x10 + x12’ x1=0, x4=1 x3=1 x1=0 x3=1

  40. x1 x3 x4=1 Conflict Driven Learning andNon-chronological Backtracking x1 + x4 x1 + x3’ + x8’ x1 + x8 + x12 x2 + x11 x7’ + x3’ + x9 x7’ + x8 + x9’ x7 + x8 + x10’ x7 + x10 + x12’ x1=0, x4=1 x3=1, x8=0 x1=0 x3=1 x8=0

  41. x1 x3 x4=1 Conflict Driven Learning andNon-chronological Backtracking x1 + x4 x1 + x3’ + x8’ x1 + x8 + x12 x2 + x11 x7’ + x3’ + x9 x7’ + x8 + x9’ x7 + x8 + x10’ x7 + x10 + x12’ x1=0, x4=1 x3=1, x8=0, x12=1 x1=0 x3=1 x8=0 x12=1

  42. x1 x3 x4=1 Conflict Driven Learning andNon-chronological Backtracking x1 + x4 x1 + x3’ + x8’ x1 + x8 + x12 x2 + x11 x7’ + x3’ + x9 x7’ + x8 + x9’ x7 + x8 + x10’ x7 + x10 + x12’ x1=0, x4=1 x3=1, x8=0, x12=1 x2 x2=0 x1=0 x3=1 x8=0 x12=1 x2=0

  43. x1 x3 x4=1 x11=1 Conflict Driven Learning andNon-chronological Backtracking x1 + x4 x1 + x3’ + x8’ x1 + x8 + x12 x2 + x11 x7’ + x3’ + x9 x7’ + x8 + x9’ x7 + x8 + x10’ x7 + x10 + x12’ x1=0, x4=1 x3=1, x8=0, x12=1 x2 x2=0, x11=1 x1=0 x3=1 x8=0 x12=1 x2=0

  44. x1 x3 x4=1 x11=1 Conflict Driven Learning andNon-chronological Backtracking x1 + x4 x1 + x3’ + x8’ x1 + x8 + x12 x2 + x11 x7’ + x3’ + x9 x7’ + x8 + x9’ x7 + x8 + x10’ x7 + x10 + x12’ x1=0, x4=1 x3=1, x8=0, x12=1 x2 x2=0, x11=1 x7 x7=1 x1=0 x3=1 x7=1 x8=0 x12=1 x2=0

  45. x1 x3 x4=1 x11=1 x9=1 Conflict Driven Learning andNon-chronological Backtracking x1 + x4 x1 + x3’ + x8’ x1 + x8 + x12 x2 + x11 x7’ + x3’ + x9 x7’ + x8 + x9’ x7 + x8 + x10’ x7 + x10 + x12’ x1=0, x4=1 x3=1, x8=0, x12=1 x2 x2=0, x11=1 x7 x7=1, x9= 0, 1 x1=0 x3=1 x7=1 x9=0 x8=0 x12=1 x2=0

  46. x1 x3 x4=1 x11=1 x9=1 Conflict Driven Learning andNon-chronological Backtracking x1 + x4 x1 + x3’ + x8’ x1 + x8 + x12 x2 + x11 x7’ + x3’ + x9 x7’ + x8 + x9’ x7 + x8 + x10’ x7 + x10 + x12’ x1=0, x4=1 x3=1, x8=0, x12=1 x2 x2=0, x11=1 x7 x7=1, x9=1 x1=0 x3=1 x7=1 x9=0 x8=0 x3=1x7=1x8=0  conflict x12=1 x2=0

  47. x1 x3 x4=1 x9=1 x11=1 Conflict Driven Learning andNon-chronological Backtracking x1 + x4 x1 + x3’ + x8’ x1 + x8 + x12 x2 + x11 x7’ + x3’ + x9 x7’ + x8 + x9’ x7 + x8 + x10’ x7 + x10 + x12’ x1=0, x4=1 x3=1, x8=0, x12=1 x2 x2=0, x11=1 x7 x7=1, x9=1 x1=0 x3=1 x7=1 x9=0 x8=0 x3=1x7=1x8=0  conflict x12=1 Add conflict clause: x3’+x7’+x8 x2=0

  48. x1 x3 x4=1 x9=1 x11=1 Conflict Driven Learning andNon-chronological Backtracking x1 + x4 x1 + x3’ + x8’ x1 + x8 + x12 x2 + x11 x7’ + x3’ + x9 x7’ + x8 + x9’ x7 + x8 + x10’ x7 + x10 + x12’ x1=0, x4=1 x3=1, x8=0, x12=1 x3’+x7’+x8 x2 x2=0, x11=1 x7 x7=1, x9=1 x1=0 x3=1 x7=1 x9=0 x8=0 x3=1x7=1x8=0  conflict x12=1 Add conflict clause: x3’+x7’+x8 x2=0

  49. x1 x3 x4=1 Conflict Driven Learning andNon-chronological Backtracking x1 + x4 x1 + x3’ + x8’ x1 + x8 + x12 x2 + x11 x7’ + x3’ + x9 x7’ + x8 + x9’ x7 + x8 + x10’ x7 + x10 + x12’ x3’ + x8 + x7’ x1=0, x4=1 x3=1, x8=0, x12=1 x2 x7 x1=0 x3=1 x8=0 Backtrack to the decision level of x3=1 x7 = 0 x12=1

  50. x1 x3 x4=1 Conflict Driven Learning andNon-chronological Backtracking x1 + x4 x1 + x3’ + x8’ x1 + x8 + x12 x2 + x11 x7’ + x3’ + x9 x7’ + x8 + x9’ x7+ x8 + x10’ x7 + x10 + x12’ x3’ + x8 + x7’ x1=0, x4=1 x3=1, x8=0, x12=1, X7=0 x1=0 x3=1 x7=0 x8=0 x12=1

More Related