1 / 55

Introduction to SAT, Predicate Logic and DPLL solving Lecture 1

Introduction to SAT, Predicate Logic and DPLL solving Lecture 1. Nikolaj Bjørner Microsoft Research DTU Winter course January 2 nd 2012 Organized by Flemming Nielson & Hanne Riis Nielson. Plan. General overview of propositional and predicate logic Refresher on SAT and modern DPLL.

denton-rush
Download Presentation

Introduction to SAT, Predicate Logic and DPLL solving Lecture 1

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. Introduction to SAT, Predicate Logic and DPLL solving Lecture 1 Nikolaj Bjørner Microsoft Research DTU Winter course January 2nd2012 Organized by Flemming Nielson & Hanne Riis Nielson

  2. Plan • General overview of propositional and predicate logic • Refresher on SAT and modern DPLL

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

  4. What is logic? • Logic is the art and science of effective reasoning. • How can we draw general and reliable conclusions from a collection of facts? • Formal logic: Precise, syntactic characterizations of well-formed expressions and valid deductions. • Formal logic makes it possible to calculate consequences at the symbolic level. • Computers can be used to automate such symbolic calculations.

  5. What is logic? • Logic studies the relationship between language, meaning, and (proof) method. • A logic consists of a language in which (well-formed) sentences are expressed. • A semantic that distinguishes the valid sentences from the refutable ones. • A proof system for constructing arguments justifying valid sentences. • Examples of logics include propositional logic, equational logic, first-order logic, higher-order logic, and modal logics.

  6. What is logical language? • A language consists of logical symbols whose interpretations are fixed, and non-logical ones whose interpretations vary. • These symbols are combined together to form well-formed formulas. • In propositional logic PL, the connectives , , and have a fixed interpretation, whereas the constants p, q, rmay be interpreted at will.

  7. SMT : Basic Architecture • Equality + UF • Arithmetic • Bit-vectors • … Case Analysis

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

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

  10. 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. • A formula is unsatisfiable if it does not have any model. • A formula is valid if it is logically true in any interpretation. • A propositional formula is valid if and only if its negation is unsatisfiable.

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

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

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

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

  15. Normal Forms

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

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

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

  19. Normal Forms NNF? NO (p  q)  (q  (r  p))  (p  q)  (q  (r  p))

  20. Normal Forms NNF? NO (p  q)  (q  (r  p))  (p  q)  (q  (r  p))  (p  q)  (q  (r  p))

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

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

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

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

  25. Normal Forms CNF? NO ((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) Distributivity 1. A(BC)  (AB)(AC) 2. A(BC)  (AB)(AC)

  26. Normal Forms CNF? NO ((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)

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

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

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

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

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

  32. 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)  ((p  q) q) ((p  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

  33. Efficient CNF Translation

  34. CNF translation (example)

  35. Resolution

  36. Resolution (example)

  37. Unit & Input Resolution

  38. DPLL DPLL

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

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

  41. DPLL (as a procedure)

  42. M | F DPLL Partial model Set of clauses

  43. Guessing DPLL • p | p  q, q  r p, q | p  q, q  r

  44. Deducing DPLL • p | p  q, p  s p, s| p  q, p  s

  45. Backtracking DPLL • p, s, q | p  q, s  q, p q p, s| p  q, s  q, p q

  46. Efficient indexing (two-watch literal) Non-chronological backtracking (backjumping) Lemma learning Modern DPLL

  47. Modern DPLL in a nutshell Adapted and modified from [Nieuwenhuis, Oliveras, Tinelli J.ACM 06]

  48. Lemma learning CDCL – Conflict Directed Clause Learning • t, p, q, s | t  p  q, q  s, p s • t, p, q, s | t  p  q, q  s, p s |p s • t, p, q, s | t  p  q, q  s, p s |p q • t, p, q, s | t  p  q, q  s, p s |p t

  49. Two-watch literals • Indexing is key to efficient theorem proving. • An index is a dictionary that is tuned to search. • The literal two-watch scheme is the main index in modern SAT solvers. • Track two literals per clause, such that: • Track literals that are unassigned or assigned to true. • If one of the tracked literals is assigned to false, search for non-tracked literal that is either unassigned or true. • If there is no other unassigned or true literal to select, then the other watched literal can be assigned to true. • Unit propagation or conflict detection.

  50. Two-watch literals • Watch literals for Propagate and Conflict • Naïve: For every literal lmaintain map: • Watch(l) = {C1 … Cm} where l  Ci • If l is assigned to true, check each Cj Watch(l)for Conflict or Propagate • But most of the time, some other literal inCj is either: • Unassigned (not yet assigned) • Assigned to true.

More Related