1 / 21

Satisfiability modulo theories

Satisfiability modulo theories. SPb SU ITMO Software Engineering Seminar July 2011. Anton Bannykh. Introduction. Appeared at late 70’s – early 80’s SAT + background theories First-order logic Quantifier-free Motivation Consider formula: x < y ∧ ¬ (x < y + 0) Inconsistent

roxy
Télécharger la présentation

Satisfiability modulo theories

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 modulo theories SPb SU ITMO Software Engineering Seminar July 2011 Anton Bannykh

  2. Introduction Appeared at late 70’s – early 80’s SAT + background theories • First-order logic • Quantifier-free Motivation • Consider formula: x < y ∧¬(x < y + 0) • Inconsistent • Nontrivial task for general-purpose prover Satisfiability Modulo Theories

  3. General idea Take a formula Replace theory-specific predicates with variables Split task into: • Finding a SAT solution • 1 ∧ 3 ∧ ¬ 4 • Checking consistence of a conjunction of predicates • g(a) = c ∧ g(a) = d ∧ c ≠ d 1 ∧ (¬2 ∨ 3) ∧¬ 4 g(a) = c ∧ ( f(g(a)) ≠ f(c) ∨ g(a) = d ) ∧ c ≠ d 1: g(a) = c 2: f(g(a)) = f(c) 3: g(a) = d 4: c = d 1 ¬ 2 3 ¬ 4 Satisfiability Modulo Theories

  4. SAT Propositional logic • CNF Performance • NP-complete • Expressive • Requires encoding • Fast in practice • 104 variables • 106 clauses Satisfiability Modulo Theories

  5. Theories Equality and Uninterpreted Functions (EUF) Bit-Vectors Arrays Lists Linear Arithmetic Non-Linear Arithmetic Satisfiability Modulo Theories

  6. EUF Consider formula: • a · (f(b) + f(c)) = d ∧b · (f(a) + f(c)) ≠ d ∧ a = b Facts: • Inconsistent • No arithmetic reasoning is needed Rewritein a more abstract way • h(a, g(f(b), f(c))) = d ∧ h(b, g(f(a), f(c))) ≠ d ∧ a = b • Still inconsistent Satisfiability Modulo Theories

  7. Linear Arithmetic Domain • Reals • Integers Subtheories • Difference logic • Unit-Two-Variable-Per-Inequality Satisfiability Modulo Theories

  8. Eager approach Encode SMT into SAT • Translate problem into equisatisfiable propositional formula and use any SAT solver • Use optimizations to get small SAT problem Benefits • Use best available SAT solver Drawbacks • Sophisticated encoding of theories • Theory-specific • Multiple approaches • Low performance Satisfiability Modulo Theories

  9. Lazy approach Methodology • Get SAT solution • Check T-consistence • If fail then learn and repeat Example • Formula: • Problem: 1 ∧ (¬2∨3) ∧¬4 • SAT solver returns 1 ∧ ¬2 ∧¬4 • T-solver says inconsistent • SAT solver returns 1 ∧ 2 ∧ 3 ∧¬4 • T-solver says inconsistent • SAT solver detects unsatisfiable g(a) = c ∧ ( f(g(a)) ≠ f(c) ∨ g(a) = d ) ∧ c ≠ d 1 ¬ 2 3 ¬ 4 ∧ (¬1∨2∨4) • ∧ (¬1∨¬2∨¬3∨4) Satisfiability Modulo Theories

  10. Lazy approach Benefits • No theory translation • SAT solver takes care of Boolean information • Theory solver takes care of theory information • Theory solver receives conjunction of literals • Modular and flexible • New theory requires only a new T-solver • Simple communication API Drawbacks • Theory information does not guide the search Satisfiability Modulo Theories

  11. DPLL Overview • Davis-Putnam-Logemann-Loveland (1962) • Key to effective SAT solver implementation • Backtracking with optimizations Features • Unit propagate • Learn • Branching heuristics • Backjump • Restart Satisfiability Modulo Theories

  12. DPLL(T) T-propagation • Find T-consequences instead of only validating • Naïve implementation • Add ¬P • Check consistency • Need fast T-solvers specialized in T-propagation Usage • DPLL + T-solver • Call T-solver in process • Use T-propagations Theory information used in the search Satisfiability Modulo Theories

  13. DPLL(T) example Consider formula: Process: • ∅ • UnitPropagate • 1 • UnitPropagate • 1 ∧ ¬4 • T-propagate: g(a)=c ⇒ f(g(a)) = f(c) • 1∧ ¬4 ∧ 2 • T-propagate: g(a)=c ∧ c ≠ d ⇒ g(a) ≠ d • 1∧ ¬4 ∧ 2 ∧¬3 • Fail g(a) = c ∧ ( f(g(a)) ≠ f(c) ∨ g(a) = d ) ∧ c ≠ d 1 ¬ 2 3 ¬ 4 Satisfiability Modulo Theories

  14. Theory solvers Is given conjunction of literals T-satisfiable? Key features • Model generation • Conflict set generation • Incrementality • Backtrackability • Deduction of unassigned literals • Deduction of interface equalities Satisfiability Modulo Theories

  15. Optimizations Layered solvers Preprocessing • Normalizing T-atoms • Static learning Look-ahead and look-back Splitting on demand Assignment simplification • Clustering • T-literal filtering Solver1 UNSAT SAT Solver2 UNSAT Abstraction SAT Solver2 UNSAT SAT SAT UNSAT Satisfiability Modulo Theories

  16. Theories combination Theories are not isolated Ackermann’s expansion • EUF • Replace function applications with fresh variables • Add all needed functional congruence constraints Nelson-Oppen combination • T-solvers exchage deduced information Delayed Theory combination • T-solvers interact only with SAT solver Satisfiability Modulo Theories

  17. Problems and limitations Expressivity • Quantifier-free (most) DPLL-related • Generating partial assignments • Avoiding ghost literals • T-backjumping not perfect • T-propagation • Branching heuristics General • Producing proofs • Model generation • Identifying unsatisfiable cores Satisfiability Modulo Theories

  18. Related approaches OBDD • Ordered binary decision diagrams • Exponential space in worst case Circuit-based techniques • Booleans circuits instead of CNF • Efficient boolean constraint propagation • Don’t care values Rewrite-based • Superposition calculus • Applied to theories axiomatizable by a small set of F.O. clauses • Simplified prove of correctness and theory combination • Sophisticated implementation Mixed Satisfiability Modulo Theories

  19. SMTLIB & SMTCOMP Created in 2003 Goals • Standard descriptions of background theories • Standard input and output language for SMT solvers • Benchmarking Satisfiability Modulo Theories

  20. Ask Z3 http://rise4fun.com/Z3 Satisfiability Modulo Theories

  21. Conclusion SMT adds domain-specific reasoning to SAT Lots of applications: • Resource planning • Temporal reasoning • Formal verification • Compiler optimization • Model checking • Test generation • … Significant performance improvement Satisfiability Modulo Theories

More Related