1 / 103

Nikolaj Bjørner Senior Researcher Microsoft Research Redmond

Nikolaj Bjørner Senior Researcher Microsoft Research Redmond. Modern Satisfiability Modulo Theories Solvers in Program Analysis. Lectures. Wednesday 10:45–12:15 An Introduction to Z3 with Applications Thursday August 30 th 15:45–17:15 Introduction to SAT and SMT Friday 10:30–10:45

varuna
Download Presentation

Nikolaj Bjørner Senior Researcher Microsoft Research Redmond

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. Nikolaj Bjørner Senior Researcher Microsoft Research Redmond Modern Satisfiability Modulo Theories Solvers in Program Analysis

  2. Lectures Wednesday10:45–12:15An Introduction to Z3 with Applications Thursday August 30th15:45–17:15 Introduction to SAT and SMT Friday 10:30–10:45 Theories and Solving Algorithms Friday 15:45–17:15 Advanced: Quantifiers, Arrays, Fixed-points

  3. Plan • Logic: Calculus of Computation • SAT, First-order Theorem Proving, SMT • Introduction to Propositional Logic(SAT): • Language, Satisfiability, Validity, • Normal forms, CNF, • Search, Resolution, DPLL search • Introduction to SMT by example • SMT solving, Combining theories

  4. Takeaways The syntax and semantics of propositional and predicate logic Algorithmic principles of modern SAT solvers: • DPLL algorithm • Conflict Directed Clause Learning (CDCL) • Two-watch literal indexing Principles of modern SMT solvers

  5. Background Reading

  6. Background Reading September 2011

  7. Logic: Calculus of Computation Formal Logic: Language: Precise syntax of well-formed formulas Examples: propositional logic, equational logic, first-order logic, higher-order logic, and modal logics. Model theory: Precise semantics of truth and valid consequences Proof theory: Axioms and inference rules for truth and consequences Calculus: Basis for specifications and reasoning about computation Mechanized Formal Logic: Symbolic: The art and science of effective symbolic reasoning Automatic: Computers can automate symbolic calculations

  8. Symbolic Engines: SAT, FTP and SMT SAT: Propositional Satisfiability. (Tie  Shirt)  (Tie Shirt)  (Tie  Shirt) FTP: First-order Theorem Proving. X,Y,Z [X*(Y*Z) = (X*Y)*Z] X [X*inv(X) = e] X [X*e = e] SMT: Satisfiability Modulo background Theoriesb + 2 = c  A[3]≠ A[c-b+1]

  9. SAT - Milestones Problems impossible 10 years ago are trivial today Concept 2002 2010 Millions of variables from HW designs Courtesy Daniel le Berre

  10. FTP - Milestones • Some successstories: • Open Problems (of 25 years):XCB: X  ((X  Y)  (Z  Y))  Z)is a single axiom for equivalence • Knowledge Ontologies GBs of formulas Courtesy Andrei Voronkov, U of Manchester

  11. SMT - Milestones Z3 (of ’07) Time On BoogieRegression 1sec Simplify (of ’01) time Z3 Time On VCC Regression Includes progress from SAT: 15KLOC + 285KLOC = Z3 Nov 08 March 09

  12. Propositional Logic Syntax, Semantics and Normal Forms Resolution, Classical DPLL, Modern DPLL

  13. Propositional Logic: Language Logical symbols: , ,  ,true, false,  - fixed interpretation Non-logical symbols: p, q, r - interpretations vary Well-formed formulas: built by combining logical and non-logical symbols

  14. Propositional Logic: Language Formulas:  := p | 12| 12|1 | 1 2 Examples: p  q  q  p p  q  (p  q) We say pand qare propositional variables.

  15. Propositional Logic Syntax, Semantics and Normal Forms Resolution, Classical DPLL, Modern DPLL

  16. Interpretation An interpretation M assigns values {true, false} to propositional variables. Let F and G range over PL formulas.

  17. Satisfiability & Validity A formula is: • satisfiable if it has an interpretation that makes it logically true. In this case, we say the interpretation is a model. • unsatisfiable if it does not have any model. • valid if it is logically true in any interpretation. • A propositional formula is valid if and only if its negation is unsatisfiable.

  18. Satisfiability & Validity: examples p  q  q  p p  q  q p  q  (p  q)

  19. Satisfiability & Validity: examples p  q  q  p VALID p  q  q SATISFIABLE p  q  (p  q) UNSATISFIABLE

  20. Equivalence We say two formulas F and G are equivalent if and only if they evaluate to the same value (true or false) in every interpretation

  21. Equisatisfiable We say formulas A and B are equisatisfiable if and only if A is satisfiable if and only if B is. equisat. During this tutorial, we describe transformations that preserve equivalence and equisatisfiability.

  22. Propositional Logic Syntax, Semantics, Normal Forms Resolution, Classical DPLL, Modern DPLL

  23. Normal Forms Literal – either a propositional atom or its negation NNF – Negation Normal Form Formula with negation only used for literals CNF – Conjunctive Normal Form Conjunction of disjunctions of literals DNF – Disjunctive Normal Form Disjunction of conjunctions of literals

  24. Normal Forms Conditional normal form Formula with only collectives BDD – (reduced ordered) Binary Decision Diagram Formula with only collectives test only uses atomsAtoms are ordered such that DAG: Share common sub-expressions Exercises: • Show that every propositional formula is equivalent to a formula in • (1) NNF, (2) CNF, (3) DNF, (4)CondNF, (5) BDD • In each case, what is the size overhead of the conversion? • Show that every n-ary Boolean function can be expressed using and

  25. Normal Forms NNF? (p  q)  (q  (r  p))

  26. Normal Forms NNF? NO

  27. Normal Forms NNF? NO

  28. Normal Forms NNF? NO 

  29. Normal Forms NNF? NO

  30. Normal Forms CNF? ((p  s) (q r))  (q  p s)  (r s)

  31. Normal Forms CNF? NO ((p  s) (q  r))  (q  p  s)  (r  s)

  32. Normal Forms CNF? NO ((p  s) (q  r))  (q  p  s)  (r  s) Distributivity 1. A(BC)  (AB)(AC) 2. A(BC)  (AB)(AC)

  33. Normal Forms CNF? NO ((p  s) (q  r))  (q  p  s)  (r  s)  ((p  s) q)) ((p  s) r))  (q  p  s)  (r  s) Distributivity 1. A(BC)  (AB)(AC) 2. A(BC)  (AB)(AC)

  34. Normal Forms CNF? NO Distributivity

  35. Normal Forms CNF? .. yes ((p  s) (q  r))  (q  p  s)  (r  s)  ((p  s) q)) ((p  s) r))  (q  p  s)  (r  s)  (p  q)  (s q) ((p  s) r))  (q  p  s)  (r  s)  (p  q)  (s  q)  (p  r) (s  r)  (q  p  s)  (r  s)

  36. Normal Forms DNF? p  (p  q)  (q  r)

  37. Normal Forms DNF? NO, actually this formula is in CNF p  (p  q)  (q  r)

  38. Normal Forms DNF? NO, actually this formula is in CNF p  (p  q)  (q  r) Distributivity 1. A(BC)  (AB)(AC) 2. A(BC)  (AB)(AC)

  39. Normal Forms DNF? NO, actually this formula is in CNF p  (p  q)  (q  r)  ((p  p) (p q))  (q  r) Distributivity 1. A(BC)  (AB)(AC) 2. A(BC)  (AB)(AC)

  40. Normal Forms DNF? NO, actually this formula is in CNF p  (p  q)  (q  r)  ((p  p) (p q))  (q  r)  (p  q)  (q  r) Distributivity 1. A(BC)  (AB)(AC) 2. A(BC)  (AB)(AC) Other Rules AA   A  A

  41. Normal Forms DNF? … yes p  (p  q)  (q  r)  ((p  p) (p q))  (q  r)  (p  q)  (q  r)  ((p  q) q) ((p  q)  r)  (pq)  (p r) (q r) Distributivity 1. A(BC)  (AB)(AC) 2. A(BC)  (AB)(AC) Other Rules AA   A  A

  42. Efficient CNF Translation CNF translation using distributivity rule is too expensive (exponential blowup). Linear time/space translation produces equisatisfiable formula: where is a fresh variable. Exercise: show that each transformation preserves satisfiability. Exercise: finish the transformation for:

  43. CNF translation (example)

  44. Propositional Logic Syntax, Semantics, Normal Forms Resolution, Classical DPLL, Modern DPLL

  45. Resolution Formula must be in CNF Resolution rule: Example: The result of resolution is the resolvent(clause). Original clauses are kept (not deleted). Duplicate literals are deleted from the resolvent. Note: No branching. Termination: Only finite number of possible derived clauses.

  46. Resolution (example)

  47. Unit & Input Resolution Unit resolution: (is subsumed by Input resolution: ( member of input F). Exercise: Set of clauses F: F has an input refutation iffF has a unit refutation.

  48. Propositional Logic Syntax, Semantics, Normal Forms Resolution, Classical DPLL, Modern DPLL

  49. DPLL DPLL: David Putnam Logeman Loveland = Unit resolution + split rule. split unit Ingredient of most efficient SAT solvers

  50. Pure Literals A literal is pure if only occurs positively or negatively.

More Related