450 likes | 630 Views
Introduction to SMT Lecture 2, 2012. Nikolaj Bjørner Microsoft Research DTU Winter course January 3 rd 2012 Organized by Hanne Riis Nielson, Flemming Nielson. Background Reading. September 2011. Plan. General overview of what is SMT Compare with SAT, first-order theorem proving,..
E N D
Introduction to SMT Lecture 2, 2012 Nikolaj Bjørner Microsoft Research DTU Winter course January 3rd2012 Organized by Hanne Riis Nielson, Flemming Nielson
Background Reading September 2011
Plan • General overview of what is SMT • Compare with SAT, first-order theorem proving,.. • Refresher on SAT and modern DPLL • Introduction to SMT solving techniques • Selected SMT applications (more Jan 4,5th)
Takeaways - this section should teach: • The syntax and semantics of SAT/SMT. • Algorithmic principles of modern SAT solvers • Algorithmic principles of modern SMT solvers
Some context On Theorem Proving
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]
SAT - Milestones Problems impossible 10 years ago are trivial today Concept 2002 2010 Millions of variables from HW designs Courtesy Daniel le Berre
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, Manchester U
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
Introducing SMT by examples
Satisfiability Modulo Theories (SMT) • Is formula satisfiable modulo theory T ? SMT solvers have specialized algorithms for T
Satisfiability Modulo Theories (SMT) Array Theory Arithmetic Uninterpreted Functions
Satisfiability Modulo Theories (SMT) • b + 2 = c and f(select(store(a,b,3), c-2)) ≠ f(c-b+1)
Satisfiability Modulo Theories (SMT) • b + 2 = c and f(select(store(a,b,3), c-2)) ≠ f(c-b+1) Arithmetic
Satisfiability Modulo Theories (SMT) • b + 2 = c and f(select(store(a,b,3), c-2)) ≠ f(c-b+1) Array Theory Arithmetic
Satisfiability Modulo Theories (SMT) • b + 2 = c and f(select(store(a,b,3), c-2)) ≠ f(c-b+1) Uninterpreted Functions Array Theory Arithmetic
Satisfiability Modulo Theories (SMT) • b + 2 = c and f(select(store(a,b,3), c-2)) ≠ f(c-b+1) • Substituting c by b+2
Satisfiability Modulo Theories (SMT) • b + 2 = c and f(select(store(a,b,3), b+2-2)) ≠ f(b+2-b+1) • Simplifying
Satisfiability Modulo Theories (SMT) • b + 2 = c and f(select(store(a,b,3), b)) ≠ f(3)
Satisfiability Modulo Theories (SMT) • b + 2 = c and f(select(store(a,b,3), b)) ≠ f(3) • Applying array theory axiom
Satisfiability Modulo Theories (SMT) • b + 2 = c and f(3) ≠ f(3) • Inconsistent/Unsatisfiable
Job Shop Scheduling Machines Tasks Jobs P = NP? Laundry
Job Shop Scheduling Constraints: Precedence: between two tasks of the same job Resource: Machines execute at most one job at a time 3 1 2 4
Job Shop Scheduling Constraints: Encoding: Precedence: - start time of job 2 on mach 3 - duration of job 2 on mach 3 Resource: 3 1 2 4 Notconvex
Job Shop Scheduling Efficient solvers: - Floyd-Warshal algorithm - Ford-Fulkerson algorithm case split case split
Modern DPLL in a nutshell Adapted and modified from [Nieuwenhuis, Oliveras, Tinelli J.ACM 06]
DPLL(T) solver interaction T- Propagate T- Conflict
Main components of modern SMT Solvers Purification Note: read is just another name for select, write is just another name for store
Main components of modern SMT Solvers Purification
Main components of modern SMT Solvers Purification Arithmetic Arrrays Functions
Main components of modern SMT Solvers Propositional Abstraction
Main components of modern SMT Solvers Propositional Assignment Using SAT solver
Main components of modern SMT Solvers Theory Solving Arithmetic Arrays Theories exchange equalities between shared variables. But how? Free functions
Model-based Combination The running example was easy. But what about: Either or . or (are integers) Arithmetic module needs to somehow learn that . - Integer linear arithmetic is non-convex.
Model-based combination • Delayed Theory Combination solution [2006 Bruttomesso et.al.] Add equality literals for every pair of shared variables: : Solvers work completely independently. : Works with non-convex theories. : O(n2) up-front cost. No use of propagation.
Model-based combination Idea: • Have solvers produce models. • Use models to introduce equalities on demand. If Then guess : No up-front O(n2) cost of adding equalities : Works with non-convex theories : Models are conservative approximations then